@tanstack/react-table 8.0.0-alpha.56 → 8.0.0-alpha.59
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/index.js +1 -0
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +20 -20
- package/build/types/index.d.ts +11 -5
- package/build/umd/index.development.js +1 -0
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/index.tsx +22 -11
package/build/cjs/index.js
CHANGED
|
@@ -36,6 +36,7 @@ function _interopNamespace(e) {
|
|
|
36
36
|
|
|
37
37
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
38
38
|
|
|
39
|
+
//
|
|
39
40
|
var render = function render(Comp, props) {
|
|
40
41
|
return !Comp ? null : isReactComponent(Comp) ? /*#__PURE__*/React__namespace.createElement(Comp, props) : Comp;
|
|
41
42
|
};
|
package/build/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\nexport * from '@tanstack/table-core'\n\nimport {\n createTableInstance,\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\nexport * from '@tanstack/table-core'\n\nimport {\n createTableInstance,\n TableOptions,\n TableInstance,\n Table,\n TableGenerics,\n createTableFactory,\n Overwrite,\n PartialKeys,\n} from '@tanstack/table-core'\n\nexport type Renderable<TProps> =\n | React.ReactNode\n | React.FunctionComponent<TProps>\n | React.Component<TProps>\n\nexport type Render = <TProps extends {}>(\n Comp: Renderable<TProps>,\n props: TProps\n) => React.ReactNode | JSX.Element\n\nexport type ReactTableGenerics = Overwrite<\n TableGenerics,\n { Renderer: Render; Rendered: ReturnType<Render> }\n>\n\n//\n\nexport const render: Render = (Comp, props) =>\n !Comp ? null : isReactComponent(Comp) ? <Comp {...props} /> : Comp\n\nfunction isReactComponent(component: unknown): component is React.FC {\n return (\n isClassComponent(component) ||\n typeof component === 'function' ||\n isExoticComponent(component)\n )\n}\n\nfunction isClassComponent(component: any) {\n return (\n typeof component === 'function' &&\n (() => {\n const proto = Object.getPrototypeOf(component)\n return proto.prototype && proto.prototype.isReactComponent\n })()\n )\n}\n\nfunction isExoticComponent(component: any) {\n return (\n typeof component === 'object' &&\n typeof component.$$typeof === 'symbol' &&\n ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description)\n )\n}\n\nexport const createTable = createTableFactory({ render })\n\nconst useIsomorphicLayoutEffect =\n typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\nexport type UseTableInstanceOptions<TGenerics extends ReactTableGenerics> =\n PartialKeys<\n Omit<TableOptions<TGenerics>, 'render'>,\n 'state' | 'onStateChange'\n >\n\nexport function useTableInstance<TGenerics extends ReactTableGenerics>(\n table: Table<TGenerics>,\n options: UseTableInstanceOptions<TGenerics>\n): TableInstance<TGenerics> {\n // Compose in the generic options to the user options\n const resolvedOptions: TableOptions<TGenerics> = {\n ...table.options,\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n render,\n ...options,\n }\n\n // Create a new table instance and store it in state\n const [instance] = React.useState(() =>\n createTableInstance<TGenerics>(resolvedOptions)\n )\n\n // By default, manage table state here using the instance's initial state\n const [state, setState] = React.useState(() => instance.initialState)\n\n // Compose the default state above with any user state. This will allow the user\n // to only control a subset of the state if desired.\n instance.setOptions(prev => ({\n ...prev,\n ...options,\n state: {\n ...state,\n ...options.state,\n },\n // Similarly, we'll maintain both our internal state and any user-provided\n // state.\n onStateChange: updater => {\n setState(updater)\n options.onStateChange?.(updater)\n },\n }))\n\n useIsomorphicLayoutEffect(() => {\n instance.willUpdate()\n })\n\n return instance\n}\n"],"names":["render","Comp","props","isReactComponent","React","component","isClassComponent","isExoticComponent","proto","Object","getPrototypeOf","prototype","$$typeof","includes","description","createTable","createTableFactory","useIsomorphicLayoutEffect","document","useLayoutEffect","useEffect","useTableInstance","table","options","resolvedOptions","_extends","state","onStateChange","useState","createTableInstance","instance","initialState","setState","setOptions","prev","updater","willUpdate"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA;AAEO,IAAMA,MAAc,GAAG,SAAjBA,MAAiB,CAACC,IAAD,EAAOC,KAAP,EAAA;AAAA,EAAA,OAC5B,CAACD,IAAD,GAAQ,IAAR,GAAeE,gBAAgB,CAACF,IAAD,CAAhB,gBAAyBG,+BAAC,IAAD,EAAUF,KAAV,CAAzB,GAA+CD,IADlC,CAAA;AAAA,EAAvB;;AAGP,SAASE,gBAAT,CAA0BE,SAA1B,EAAqE;AACnE,EAAA,OACEC,gBAAgB,CAACD,SAAD,CAAhB,IACA,OAAOA,SAAP,KAAqB,UADrB,IAEAE,iBAAiB,CAACF,SAAD,CAHnB,CAAA;AAKD,CAAA;;AAED,SAASC,gBAAT,CAA0BD,SAA1B,EAA0C;AACxC,EAAA,OACE,OAAOA,SAAP,KAAqB,UAArB,IACC,YAAM;AACL,IAAA,IAAMG,KAAK,GAAGC,MAAM,CAACC,cAAP,CAAsBL,SAAtB,CAAd,CAAA;AACA,IAAOG,OAAAA,KAAK,CAACG,SAAN,IAAmBH,KAAK,CAACG,SAAN,CAAgBR,gBAA1C,CAAA;AACD,GAHD,EAFF,CAAA;AAOD,CAAA;;AAED,SAASI,iBAAT,CAA2BF,SAA3B,EAA2C;AACzC,EACE,OAAA,OAAOA,SAAP,KAAqB,QAArB,IACA,OAAOA,SAAS,CAACO,QAAjB,KAA8B,QAD9B,IAEA,CAAC,YAAD,EAAe,mBAAf,CAAA,CAAoCC,QAApC,CAA6CR,SAAS,CAACO,QAAV,CAAmBE,WAAhE,CAHF,CAAA;AAKD,CAAA;;AAEYC,IAAAA,WAAW,GAAGC,4BAAkB,CAAC;AAAEhB,EAAAA,MAAM,EAANA,MAA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AAO,CAACI,aAAR,IAAA,IAAA,GAAA,KAAA,CAAA,GAAAJ,OAAO,CAACI,aAAR,CAAwBQ,OAAxB,CAAA,CAAA;AACD,OAAA;AAZqB,KAAA,CAAA,CAAA;AAAA,GAAxB,CAAA,CAAA;AAeAlB,EAAAA,yBAAyB,CAAC,YAAM;AAC9Ba,IAAAA,QAAQ,CAACM,UAAT,EAAA,CAAA;AACD,GAFwB,CAAzB,CAAA;AAIA,EAAA,OAAON,QAAP,CAAA;AACD;;;;;;;;;;;;"}
|
package/build/esm/index.js
CHANGED
package/build/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\nexport * from '@tanstack/table-core'\n\nimport {\n createTableInstance,\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\nexport * from '@tanstack/table-core'\n\nimport {\n createTableInstance,\n TableOptions,\n TableInstance,\n Table,\n TableGenerics,\n createTableFactory,\n Overwrite,\n PartialKeys,\n} from '@tanstack/table-core'\n\nexport type Renderable<TProps> =\n | React.ReactNode\n | React.FunctionComponent<TProps>\n | React.Component<TProps>\n\nexport type Render = <TProps extends {}>(\n Comp: Renderable<TProps>,\n props: TProps\n) => React.ReactNode | JSX.Element\n\nexport type ReactTableGenerics = Overwrite<\n TableGenerics,\n { Renderer: Render; Rendered: ReturnType<Render> }\n>\n\n//\n\nexport const render: Render = (Comp, props) =>\n !Comp ? null : isReactComponent(Comp) ? <Comp {...props} /> : Comp\n\nfunction isReactComponent(component: unknown): component is React.FC {\n return (\n isClassComponent(component) ||\n typeof component === 'function' ||\n isExoticComponent(component)\n )\n}\n\nfunction isClassComponent(component: any) {\n return (\n typeof component === 'function' &&\n (() => {\n const proto = Object.getPrototypeOf(component)\n return proto.prototype && proto.prototype.isReactComponent\n })()\n )\n}\n\nfunction isExoticComponent(component: any) {\n return (\n typeof component === 'object' &&\n typeof component.$$typeof === 'symbol' &&\n ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description)\n )\n}\n\nexport const createTable = createTableFactory({ render })\n\nconst useIsomorphicLayoutEffect =\n typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\nexport type UseTableInstanceOptions<TGenerics extends ReactTableGenerics> =\n PartialKeys<\n Omit<TableOptions<TGenerics>, 'render'>,\n 'state' | 'onStateChange'\n >\n\nexport function useTableInstance<TGenerics extends ReactTableGenerics>(\n table: Table<TGenerics>,\n options: UseTableInstanceOptions<TGenerics>\n): TableInstance<TGenerics> {\n // Compose in the generic options to the user options\n const resolvedOptions: TableOptions<TGenerics> = {\n ...table.options,\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n render,\n ...options,\n }\n\n // Create a new table instance and store it in state\n const [instance] = React.useState(() =>\n createTableInstance<TGenerics>(resolvedOptions)\n )\n\n // By default, manage table state here using the instance's initial state\n const [state, setState] = React.useState(() => instance.initialState)\n\n // Compose the default state above with any user state. This will allow the user\n // to only control a subset of the state if desired.\n instance.setOptions(prev => ({\n ...prev,\n ...options,\n state: {\n ...state,\n ...options.state,\n },\n // Similarly, we'll maintain both our internal state and any user-provided\n // state.\n onStateChange: updater => {\n setState(updater)\n options.onStateChange?.(updater)\n },\n }))\n\n useIsomorphicLayoutEffect(() => {\n instance.willUpdate()\n })\n\n return instance\n}\n"],"names":["render","Comp","props","isReactComponent","component","isClassComponent","isExoticComponent","proto","Object","getPrototypeOf","prototype","$$typeof","includes","description","createTable","createTableFactory","useIsomorphicLayoutEffect","document","React","useLayoutEffect","useEffect","useTableInstance","table","options","resolvedOptions","state","onStateChange","useState","createTableInstance","instance","initialState","setState","setOptions","prev","updater","willUpdate"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA;AAEO,IAAMA,MAAc,GAAG,SAAjBA,MAAiB,CAACC,IAAD,EAAOC,KAAP,EAAA;AAAA,EAAA,OAC5B,CAACD,IAAD,GAAQ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
@@ -2669,7 +2669,7 @@ var drawChart = (function (exports) {
|
|
|
2669
2669
|
</script>
|
|
2670
2670
|
<script>
|
|
2671
2671
|
/*<!--*/
|
|
2672
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"uid":"
|
|
2672
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"uid":"76c7-127","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"packages/react-table/src/index.tsx","uid":"76c7-129"}]}],"isRoot":true},"nodeParts":{"76c7-127":{"renderedLength":410,"gzipLength":231,"brotliLength":0,"mainUid":"76c7-126"},"76c7-129":{"renderedLength":2449,"gzipLength":889,"brotliLength":0,"mainUid":"76c7-128"}},"nodeMetas":{"76c7-126":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"76c7-127"},"imported":[],"importedBy":[{"uid":"76c7-128"}]},"76c7-128":{"id":"/packages/react-table/src/index.tsx","moduleParts":{"index.production.js":"76c7-129"},"imported":[{"uid":"76c7-126"},{"uid":"76c7-130"},{"uid":"76c7-131"}],"importedBy":[],"isEntry":true},"76c7-130":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"76c7-128"}],"isExternal":true},"76c7-131":{"id":"@tanstack/table-core","moduleParts":{},"imported":[],"importedBy":[{"uid":"76c7-128"}],"isExternal":true}},"env":{"rollup":"2.70.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
2673
2673
|
|
|
2674
2674
|
const run = () => {
|
|
2675
2675
|
const width = window.innerWidth;
|
package/build/stats-react.json
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
"name": "index.production.js",
|
|
8
8
|
"children": [
|
|
9
9
|
{
|
|
10
|
-
"uid": "
|
|
10
|
+
"uid": "76c7-133",
|
|
11
11
|
"name": "\u0000rollupPluginBabelHelpers.js"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"name": "packages/react-table/src/index.tsx",
|
|
15
|
-
"uid": "
|
|
15
|
+
"uid": "76c7-135"
|
|
16
16
|
}
|
|
17
17
|
]
|
|
18
18
|
}
|
|
@@ -20,69 +20,69 @@
|
|
|
20
20
|
"isRoot": true
|
|
21
21
|
},
|
|
22
22
|
"nodeParts": {
|
|
23
|
-
"
|
|
23
|
+
"76c7-133": {
|
|
24
24
|
"renderedLength": 410,
|
|
25
25
|
"gzipLength": 231,
|
|
26
26
|
"brotliLength": 0,
|
|
27
|
-
"mainUid": "
|
|
27
|
+
"mainUid": "76c7-132"
|
|
28
28
|
},
|
|
29
|
-
"
|
|
30
|
-
"renderedLength":
|
|
31
|
-
"gzipLength":
|
|
29
|
+
"76c7-135": {
|
|
30
|
+
"renderedLength": 2449,
|
|
31
|
+
"gzipLength": 889,
|
|
32
32
|
"brotliLength": 0,
|
|
33
|
-
"mainUid": "
|
|
33
|
+
"mainUid": "76c7-134"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"nodeMetas": {
|
|
37
|
-
"
|
|
37
|
+
"76c7-132": {
|
|
38
38
|
"id": "\u0000rollupPluginBabelHelpers.js",
|
|
39
39
|
"moduleParts": {
|
|
40
|
-
"index.production.js": "
|
|
40
|
+
"index.production.js": "76c7-133"
|
|
41
41
|
},
|
|
42
42
|
"imported": [],
|
|
43
43
|
"importedBy": [
|
|
44
44
|
{
|
|
45
|
-
"uid": "
|
|
45
|
+
"uid": "76c7-134"
|
|
46
46
|
}
|
|
47
47
|
]
|
|
48
48
|
},
|
|
49
|
-
"
|
|
49
|
+
"76c7-134": {
|
|
50
50
|
"id": "/packages/react-table/src/index.tsx",
|
|
51
51
|
"moduleParts": {
|
|
52
|
-
"index.production.js": "
|
|
52
|
+
"index.production.js": "76c7-135"
|
|
53
53
|
},
|
|
54
54
|
"imported": [
|
|
55
55
|
{
|
|
56
|
-
"uid": "
|
|
56
|
+
"uid": "76c7-132"
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
|
-
"uid": "
|
|
59
|
+
"uid": "76c7-136"
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
|
-
"uid": "
|
|
62
|
+
"uid": "76c7-137"
|
|
63
63
|
}
|
|
64
64
|
],
|
|
65
65
|
"importedBy": [],
|
|
66
66
|
"isEntry": true
|
|
67
67
|
},
|
|
68
|
-
"
|
|
68
|
+
"76c7-136": {
|
|
69
69
|
"id": "react",
|
|
70
70
|
"moduleParts": {},
|
|
71
71
|
"imported": [],
|
|
72
72
|
"importedBy": [
|
|
73
73
|
{
|
|
74
|
-
"uid": "
|
|
74
|
+
"uid": "76c7-134"
|
|
75
75
|
}
|
|
76
76
|
],
|
|
77
77
|
"isExternal": true
|
|
78
78
|
},
|
|
79
|
-
"
|
|
79
|
+
"76c7-137": {
|
|
80
80
|
"id": "@tanstack/table-core",
|
|
81
81
|
"moduleParts": {},
|
|
82
82
|
"imported": [],
|
|
83
83
|
"importedBy": [
|
|
84
84
|
{
|
|
85
|
-
"uid": "
|
|
85
|
+
"uid": "76c7-134"
|
|
86
86
|
}
|
|
87
87
|
],
|
|
88
88
|
"isExternal": true
|
package/build/types/index.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export * from '@tanstack/table-core';
|
|
3
|
-
import {
|
|
3
|
+
import { TableOptions, TableInstance, Table, TableGenerics, Overwrite, PartialKeys } from '@tanstack/table-core';
|
|
4
4
|
export declare type Renderable<TProps> = React.ReactNode | React.FunctionComponent<TProps> | React.Component<TProps>;
|
|
5
|
-
export declare
|
|
6
|
-
export declare type
|
|
5
|
+
export declare type Render = <TProps extends {}>(Comp: Renderable<TProps>, props: TProps) => React.ReactNode | JSX.Element;
|
|
6
|
+
export declare type ReactTableGenerics = Overwrite<TableGenerics, {
|
|
7
|
+
Renderer: Render;
|
|
8
|
+
Rendered: ReturnType<Render>;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const render: Render;
|
|
7
11
|
export declare const createTable: () => Table<{
|
|
8
|
-
|
|
12
|
+
Renderer: Render;
|
|
13
|
+
Rendered: React.ReactNode | JSX.Element;
|
|
9
14
|
}>;
|
|
10
|
-
export declare
|
|
15
|
+
export declare type UseTableInstanceOptions<TGenerics extends ReactTableGenerics> = PartialKeys<Omit<TableOptions<TGenerics>, 'render'>, 'state' | 'onStateChange'>;
|
|
16
|
+
export declare function useTableInstance<TGenerics extends ReactTableGenerics>(table: Table<TGenerics>, options: UseTableInstanceOptions<TGenerics>): TableInstance<TGenerics>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.development.js","sources":["../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\nexport * from '@tanstack/table-core'\n\nimport {\n createTableInstance,\n
|
|
1
|
+
{"version":3,"file":"index.development.js","sources":["../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\nexport * from '@tanstack/table-core'\n\nimport {\n createTableInstance,\n TableOptions,\n TableInstance,\n Table,\n TableGenerics,\n createTableFactory,\n Overwrite,\n PartialKeys,\n} from '@tanstack/table-core'\n\nexport type Renderable<TProps> =\n | React.ReactNode\n | React.FunctionComponent<TProps>\n | React.Component<TProps>\n\nexport type Render = <TProps extends {}>(\n Comp: Renderable<TProps>,\n props: TProps\n) => React.ReactNode | JSX.Element\n\nexport type ReactTableGenerics = Overwrite<\n TableGenerics,\n { Renderer: Render; Rendered: ReturnType<Render> }\n>\n\n//\n\nexport const render: Render = (Comp, props) =>\n !Comp ? null : isReactComponent(Comp) ? <Comp {...props} /> : Comp\n\nfunction isReactComponent(component: unknown): component is React.FC {\n return (\n isClassComponent(component) ||\n typeof component === 'function' ||\n isExoticComponent(component)\n )\n}\n\nfunction isClassComponent(component: any) {\n return (\n typeof component === 'function' &&\n (() => {\n const proto = Object.getPrototypeOf(component)\n return proto.prototype && proto.prototype.isReactComponent\n })()\n )\n}\n\nfunction isExoticComponent(component: any) {\n return (\n typeof component === 'object' &&\n typeof component.$$typeof === 'symbol' &&\n ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description)\n )\n}\n\nexport const createTable = createTableFactory({ render })\n\nconst useIsomorphicLayoutEffect =\n typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\nexport type UseTableInstanceOptions<TGenerics extends ReactTableGenerics> =\n PartialKeys<\n Omit<TableOptions<TGenerics>, 'render'>,\n 'state' | 'onStateChange'\n >\n\nexport function useTableInstance<TGenerics extends ReactTableGenerics>(\n table: Table<TGenerics>,\n options: UseTableInstanceOptions<TGenerics>\n): TableInstance<TGenerics> {\n // Compose in the generic options to the user options\n const resolvedOptions: TableOptions<TGenerics> = {\n ...table.options,\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n render,\n ...options,\n }\n\n // Create a new table instance and store it in state\n const [instance] = React.useState(() =>\n createTableInstance<TGenerics>(resolvedOptions)\n )\n\n // By default, manage table state here using the instance's initial state\n const [state, setState] = React.useState(() => instance.initialState)\n\n // Compose the default state above with any user state. This will allow the user\n // to only control a subset of the state if desired.\n instance.setOptions(prev => ({\n ...prev,\n ...options,\n state: {\n ...state,\n ...options.state,\n },\n // Similarly, we'll maintain both our internal state and any user-provided\n // state.\n onStateChange: updater => {\n setState(updater)\n options.onStateChange?.(updater)\n },\n }))\n\n useIsomorphicLayoutEffect(() => {\n instance.willUpdate()\n })\n\n return instance\n}\n"],"names":["render","Comp","props","isReactComponent","React","component","isClassComponent","isExoticComponent","proto","Object","getPrototypeOf","prototype","$$typeof","includes","description","createTable","createTableFactory","useIsomorphicLayoutEffect","document","useLayoutEffect","useEffect","useTableInstance","table","options","resolvedOptions","state","onStateChange","useState","createTableInstance","instance","initialState","setState","setOptions","prev","updater","willUpdate"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BA;AAEO,MAAMA,MAAc,GAAG,SAAjBA,MAAiB,CAACC,IAAD,EAAOC,KAAP,EAAA;EAAA,EAAA,OAC5B,CAACD,IAAD,GAAQ,IAAR,GAAeE,gBAAgB,CAACF,IAAD,CAAhB,g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,"file":"index.production.js","sources":["../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\nexport * from '@tanstack/table-core'\n\nimport {\n createTableInstance,\n
|
|
1
|
+
{"version":3,"file":"index.production.js","sources":["../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\nexport * from '@tanstack/table-core'\n\nimport {\n createTableInstance,\n TableOptions,\n TableInstance,\n Table,\n TableGenerics,\n createTableFactory,\n Overwrite,\n PartialKeys,\n} from '@tanstack/table-core'\n\nexport type Renderable<TProps> =\n | React.ReactNode\n | React.FunctionComponent<TProps>\n | React.Component<TProps>\n\nexport type Render = <TProps extends {}>(\n Comp: Renderable<TProps>,\n props: TProps\n) => React.ReactNode | JSX.Element\n\nexport type ReactTableGenerics = Overwrite<\n TableGenerics,\n { Renderer: Render; Rendered: ReturnType<Render> }\n>\n\n//\n\nexport const render: Render = (Comp, props) =>\n !Comp ? null : isReactComponent(Comp) ? <Comp {...props} /> : Comp\n\nfunction isReactComponent(component: unknown): component is React.FC {\n return (\n isClassComponent(component) ||\n typeof component === 'function' ||\n isExoticComponent(component)\n )\n}\n\nfunction isClassComponent(component: any) {\n return (\n typeof component === 'function' &&\n (() => {\n const proto = Object.getPrototypeOf(component)\n return proto.prototype && proto.prototype.isReactComponent\n })()\n )\n}\n\nfunction isExoticComponent(component: any) {\n return (\n typeof component === 'object' &&\n typeof component.$$typeof === 'symbol' &&\n ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description)\n )\n}\n\nexport const createTable = createTableFactory({ render })\n\nconst useIsomorphicLayoutEffect =\n typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\nexport type UseTableInstanceOptions<TGenerics extends ReactTableGenerics> =\n PartialKeys<\n Omit<TableOptions<TGenerics>, 'render'>,\n 'state' | 'onStateChange'\n >\n\nexport function useTableInstance<TGenerics extends ReactTableGenerics>(\n table: Table<TGenerics>,\n options: UseTableInstanceOptions<TGenerics>\n): TableInstance<TGenerics> {\n // Compose in the generic options to the user options\n const resolvedOptions: TableOptions<TGenerics> = {\n ...table.options,\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n render,\n ...options,\n }\n\n // Create a new table instance and store it in state\n const [instance] = React.useState(() =>\n createTableInstance<TGenerics>(resolvedOptions)\n )\n\n // By default, manage table state here using the instance's initial state\n const [state, setState] = React.useState(() => instance.initialState)\n\n // Compose the default state above with any user state. This will allow the user\n // to only control a subset of the state if desired.\n instance.setOptions(prev => ({\n ...prev,\n ...options,\n state: {\n ...state,\n ...options.state,\n },\n // Similarly, we'll maintain both our internal state and any user-provided\n // state.\n onStateChange: updater => {\n setState(updater)\n options.onStateChange?.(updater)\n },\n }))\n\n useIsomorphicLayoutEffect(() => {\n instance.willUpdate()\n })\n\n return instance\n}\n"],"names":["render","Comp","props","component","proto","Object","getPrototypeOf","prototype","isReactComponent","isClassComponent","$$typeof","includes","description","isExoticComponent","React","createTable","createTableFactory","useIsomorphicLayoutEffect","document","useLayoutEffect","useEffect","table","options","resolvedOptions","_extends","state","onStateChange","instance","useState","createTableInstance","initialState","_React$useState2","setState","setOptions","prev","updater","willUpdate"],"mappings":";;;;;;;;;;o1BA+BaA,IAAAA,EAAiB,SAACC,EAAMC,GAAP,OAC3BD,EAUH,SAA0BE,GACxB,MACuB,mBAAdA,KAECC,EAAQC,OAAOC,eAAeH,IACvBI,WAAaH,EAAMG,UAAUC,kBAF3C,IACOJ,EAVRK,CAFsBN,EAFQF,IAKT,mBAAdE,GAeX,SAA2BA,GAEvB,MAAqB,iBAAdA,GACuB,iBAAvBA,EAAUO,UACjB,CAAC,aAAc,qBAAqBC,SAASR,EAAUO,SAASE,aAlBhEC,CAAkBV,GANoBW,gBAACb,EAASC,GAAYD,EAAtD,KAEV,IAA0BE,GA0BbY,IAAAA,EAAcC,EAAAA,mBAAmB,CAAEhB,OAAAA,IAE1CiB,EACgB,oBAAbC,SAA2BJ,EAAMK,gBAAkBL,EAAMM,wDAQ3D,SACLC,EACAC,GAGA,IAAMC,EAAwCC,EAAA,GACzCH,EAAMC,QADmC,CAE5CG,MAAO,GACPC,cAAe,aACf1B,OAAAA,GACGsB,GAIEK,EAAYb,EAAMc,UAAS,WAChCC,OAAAA,EAAAA,oBAA+BN,SAIPT,EAAAA,EAAMc,UAAS,WAAMD,OAAAA,EAASG,gBAAjDL,EAAPM,EAAA,GAAcC,OAuBd,OAnBAL,EAASM,YAAW,SAAAC,GACfA,OAAAA,EAAAA,GAAAA,EACAZ,EAFmB,CAGtBG,MACKA,EAAAA,GAAAA,EACAH,EAAQG,OAIbC,cAAe,SAAAS,GACbH,EAASG,GACT,MAAAb,EAAQI,eAARJ,EAAQI,cAAgBS,SAI5BlB,GAA0B,WACxBU,EAASS,gBAGJT"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-table",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "8.0.0-alpha.
|
|
4
|
+
"version": "8.0.0-alpha.59",
|
|
5
5
|
"description": "Hooks for building lightweight, fast and extendable datagrids for React",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/tanstack/react-table#readme",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"src"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@tanstack/table-core": "8.0.0-alpha.
|
|
37
|
+
"@tanstack/table-core": "8.0.0-alpha.59"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": ">=16",
|
package/src/index.tsx
CHANGED
|
@@ -3,12 +3,13 @@ export * from '@tanstack/table-core'
|
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
createTableInstance,
|
|
6
|
-
|
|
7
|
-
Options,
|
|
6
|
+
TableOptions,
|
|
8
7
|
TableInstance,
|
|
9
8
|
Table,
|
|
10
9
|
TableGenerics,
|
|
11
10
|
createTableFactory,
|
|
11
|
+
Overwrite,
|
|
12
|
+
PartialKeys,
|
|
12
13
|
} from '@tanstack/table-core'
|
|
13
14
|
|
|
14
15
|
export type Renderable<TProps> =
|
|
@@ -16,13 +17,20 @@ export type Renderable<TProps> =
|
|
|
16
17
|
| React.FunctionComponent<TProps>
|
|
17
18
|
| React.Component<TProps>
|
|
18
19
|
|
|
19
|
-
export
|
|
20
|
+
export type Render = <TProps extends {}>(
|
|
20
21
|
Comp: Renderable<TProps>,
|
|
21
22
|
props: TProps
|
|
22
|
-
)
|
|
23
|
-
|
|
23
|
+
) => React.ReactNode | JSX.Element
|
|
24
|
+
|
|
25
|
+
export type ReactTableGenerics = Overwrite<
|
|
26
|
+
TableGenerics,
|
|
27
|
+
{ Renderer: Render; Rendered: ReturnType<Render> }
|
|
28
|
+
>
|
|
24
29
|
|
|
25
|
-
|
|
30
|
+
//
|
|
31
|
+
|
|
32
|
+
export const render: Render = (Comp, props) =>
|
|
33
|
+
!Comp ? null : isReactComponent(Comp) ? <Comp {...props} /> : Comp
|
|
26
34
|
|
|
27
35
|
function isReactComponent(component: unknown): component is React.FC {
|
|
28
36
|
return (
|
|
@@ -55,15 +63,18 @@ export const createTable = createTableFactory({ render })
|
|
|
55
63
|
const useIsomorphicLayoutEffect =
|
|
56
64
|
typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect
|
|
57
65
|
|
|
58
|
-
export
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Omit<Options<TGenerics>, 'render'>,
|
|
66
|
+
export type UseTableInstanceOptions<TGenerics extends ReactTableGenerics> =
|
|
67
|
+
PartialKeys<
|
|
68
|
+
Omit<TableOptions<TGenerics>, 'render'>,
|
|
62
69
|
'state' | 'onStateChange'
|
|
63
70
|
>
|
|
71
|
+
|
|
72
|
+
export function useTableInstance<TGenerics extends ReactTableGenerics>(
|
|
73
|
+
table: Table<TGenerics>,
|
|
74
|
+
options: UseTableInstanceOptions<TGenerics>
|
|
64
75
|
): TableInstance<TGenerics> {
|
|
65
76
|
// Compose in the generic options to the user options
|
|
66
|
-
const resolvedOptions:
|
|
77
|
+
const resolvedOptions: TableOptions<TGenerics> = {
|
|
67
78
|
...table.options,
|
|
68
79
|
state: {}, // Dummy state
|
|
69
80
|
onStateChange: () => {}, // noop
|