@tanstack/react-table 8.11.2 → 8.11.3
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/LICENSE +21 -0
- package/build/lib/index.esm.js +9 -9
- package/build/lib/index.js +13 -16
- package/build/lib/index.js.map +1 -1
- package/build/lib/index.mjs +9 -9
- package/build/umd/index.development.js +28 -27
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +13 -13
- package/build/umd/index.production.js.map +1 -1
- package/package.json +19 -3
- package/src/index.tsx +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 Tanner Linsley
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/build/lib/index.esm.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
* react-table
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) TanStack
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
11
|
import * as React from 'react';
|
|
12
12
|
import { createTable } from '@tanstack/table-core';
|
|
13
13
|
export * from '@tanstack/table-core';
|
package/build/lib/index.js
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
* react-table
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) TanStack
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
-
|
|
15
13
|
var React = require('react');
|
|
16
14
|
var tableCore = require('@tanstack/table-core');
|
|
17
15
|
|
|
18
|
-
function
|
|
19
|
-
if (e && e.__esModule) return e;
|
|
16
|
+
function _interopNamespaceDefault(e) {
|
|
20
17
|
var n = Object.create(null);
|
|
21
18
|
if (e) {
|
|
22
19
|
Object.keys(e).forEach(function (k) {
|
|
@@ -29,11 +26,11 @@ function _interopNamespace(e) {
|
|
|
29
26
|
}
|
|
30
27
|
});
|
|
31
28
|
}
|
|
32
|
-
n
|
|
29
|
+
n.default = e;
|
|
33
30
|
return Object.freeze(n);
|
|
34
31
|
}
|
|
35
32
|
|
|
36
|
-
var React__namespace = /*#__PURE__*/
|
|
33
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
37
34
|
|
|
38
35
|
//
|
|
39
36
|
|
|
@@ -96,7 +93,7 @@ function useReactTable(options) {
|
|
|
96
93
|
exports.flexRender = flexRender;
|
|
97
94
|
exports.useReactTable = useReactTable;
|
|
98
95
|
Object.keys(tableCore).forEach(function (k) {
|
|
99
|
-
if (k !== 'default' && !
|
|
96
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
100
97
|
enumerable: true,
|
|
101
98
|
get: function () { return tableCore[k]; }
|
|
102
99
|
});
|
package/build/lib/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 TableOptions,\n TableOptionsResolved,\n RowData,\n createTable,\n} from '@tanstack/table-core'\n\nexport type Renderable<TProps> = React.ReactNode | React.ComponentType<TProps>\n\n//\n\n/**\n * If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`.\n */\nexport function flexRender<TProps extends object>(\n Comp: Renderable<TProps>,\n props: TProps\n): React.ReactNode | JSX.Element {\n return !Comp ? null : isReactComponent<TProps>(Comp) ? (\n <Comp {...props} />\n ) : (\n Comp\n )\n}\n\nfunction isReactComponent<TProps>(\n component: unknown\n): component is React.ComponentType<TProps> {\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 function useReactTable<TData extends RowData>(\n options: TableOptions<TData>\n) {\n // Compose in the generic options to the user options\n const resolvedOptions: TableOptionsResolved<TData> = {\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n renderFallbackValue: null,\n ...options,\n }\n\n // Create a new table and store it in state\n const [tableRef] = React.useState(() => ({\n current: createTable<TData>(resolvedOptions),\n }))\n\n // By default, manage table state here using the table's initial state\n const [state, setState] = React.useState(() => tableRef.current.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 tableRef.current.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 return tableRef.current\n}\n"],"names":["flexRender","Comp","props","isReactComponent","React","createElement","component","isClassComponent","isExoticComponent","proto","Object","getPrototypeOf","prototype","$$typeof","includes","description","useReactTable","options","resolvedOptions","state","onStateChange","renderFallbackValue","tableRef","useState","current","createTable","setState","initialState","setOptions","prev","updater"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\nexport * from '@tanstack/table-core'\n\nimport {\n TableOptions,\n TableOptionsResolved,\n RowData,\n createTable,\n} from '@tanstack/table-core'\n\nexport type Renderable<TProps> = React.ReactNode | React.ComponentType<TProps>\n\n//\n\n/**\n * If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`.\n */\nexport function flexRender<TProps extends object>(\n Comp: Renderable<TProps>,\n props: TProps\n): React.ReactNode | JSX.Element {\n return !Comp ? null : isReactComponent<TProps>(Comp) ? (\n <Comp {...props} />\n ) : (\n Comp\n )\n}\n\nfunction isReactComponent<TProps>(\n component: unknown\n): component is React.ComponentType<TProps> {\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 function useReactTable<TData extends RowData>(\n options: TableOptions<TData>\n) {\n // Compose in the generic options to the user options\n const resolvedOptions: TableOptionsResolved<TData> = {\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n renderFallbackValue: null,\n ...options,\n }\n\n // Create a new table and store it in state\n const [tableRef] = React.useState(() => ({\n current: createTable<TData>(resolvedOptions),\n }))\n\n // By default, manage table state here using the table's initial state\n const [state, setState] = React.useState(() => tableRef.current.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 tableRef.current.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 return tableRef.current\n}\n"],"names":["flexRender","Comp","props","isReactComponent","React","createElement","component","isClassComponent","isExoticComponent","proto","Object","getPrototypeOf","prototype","$$typeof","includes","description","useReactTable","options","resolvedOptions","state","onStateChange","renderFallbackValue","tableRef","useState","current","createTable","setState","initialState","setOptions","prev","updater"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA;;AAEA;AACA;AACA;AACO,SAASA,UAAUA,CACxBC,IAAwB,EACxBC,KAAa,EACkB;AAC/B,EAAA,OAAO,CAACD,IAAI,GAAG,IAAI,GAAGE,gBAAgB,CAASF,IAAI,CAAC,gBAClDG,gBAAA,CAAAC,aAAA,CAACJ,IAAI,EAAKC,KAA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,OAAO,CAACG,YAAY,CAAC,CAAA;;AAE7E;AACA;AACAL,EAAAA,QAAQ,CAACE,OAAO,CAACI,UAAU,CAACC,IAAI,KAAK;AACnC,IAAA,GAAGA,IAAI;AACP,IAAA,GAAGZ,OAAO;AACVE,IAAAA,KAAK,EAAE;AACL,MAAA,GAAGA,KAAK;AACR,MAAA,GAAGF,OAAO,CAACE,KAAAA;KACZ;AACD;AACA;IACAC,aAAa,EAAEU,OAAO,IAAI;MACxBJ,QAAQ,CAACI,OAAO,CAAC,CAAA;MACjBb,OAAO,CAACG,aAAa,IAArBH,IAAAA,IAAAA,OAAO,CAACG,aAAa,CAAGU,OAAO,CAAC,CAAA;AAClC,KAAA;AACF,GAAC,CAAC,CAAC,CAAA;EAEH,OAAOR,QAAQ,CAACE,OAAO,CAAA;AACzB;;;;;;;;;;;"}
|
package/build/lib/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
* react-table
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) TanStack
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
11
|
import * as React from 'react';
|
|
12
12
|
import { createTable } from '@tanstack/table-core';
|
|
13
13
|
export * from '@tanstack/table-core';
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
* react-table
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) TanStack
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
11
|
(function (global, factory) {
|
|
12
12
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
|
|
13
13
|
typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
|
|
14
14
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactTable = {}, global.React));
|
|
15
15
|
})(this, (function (exports, React) { 'use strict';
|
|
16
16
|
|
|
17
|
-
function
|
|
18
|
-
if (e && e.__esModule) return e;
|
|
17
|
+
function _interopNamespaceDefault(e) {
|
|
19
18
|
var n = Object.create(null);
|
|
20
19
|
if (e) {
|
|
21
20
|
Object.keys(e).forEach(function (k) {
|
|
@@ -28,22 +27,22 @@
|
|
|
28
27
|
}
|
|
29
28
|
});
|
|
30
29
|
}
|
|
31
|
-
n
|
|
30
|
+
n.default = e;
|
|
32
31
|
return Object.freeze(n);
|
|
33
32
|
}
|
|
34
33
|
|
|
35
|
-
var React__namespace = /*#__PURE__*/
|
|
34
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
36
35
|
|
|
37
36
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
* table-core
|
|
38
|
+
*
|
|
39
|
+
* Copyright (c) TanStack
|
|
40
|
+
*
|
|
41
|
+
* This source code is licensed under the MIT license found in the
|
|
42
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
43
|
+
*
|
|
44
|
+
* @license MIT
|
|
45
|
+
*/
|
|
47
46
|
// Is this type a tuple?
|
|
48
47
|
|
|
49
48
|
// If this type is a tuple, what indices are allowed?
|
|
@@ -2832,11 +2831,15 @@
|
|
|
2832
2831
|
getRowModel: () => {
|
|
2833
2832
|
return table.getPaginationRowModel();
|
|
2834
2833
|
},
|
|
2834
|
+
//in next version, we should just pass in the row model as the optional 2nd arg
|
|
2835
2835
|
getRow: (id, searchAll) => {
|
|
2836
|
-
|
|
2836
|
+
let row = (searchAll ? table.getPrePaginationRowModel() : table.getRowModel()).rowsById[id];
|
|
2837
2837
|
if (!row) {
|
|
2838
|
-
|
|
2839
|
-
|
|
2838
|
+
row = table.getCoreRowModel().rowsById[id];
|
|
2839
|
+
if (!row) {
|
|
2840
|
+
{
|
|
2841
|
+
throw new Error(`getRow could not find row with ID: ${id}`);
|
|
2842
|
+
}
|
|
2840
2843
|
}
|
|
2841
2844
|
}
|
|
2842
2845
|
return row;
|
|
@@ -3879,7 +3882,5 @@
|
|
|
3879
3882
|
exports.sortingFns = sortingFns;
|
|
3880
3883
|
exports.useReactTable = useReactTable;
|
|
3881
3884
|
|
|
3882
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3883
|
-
|
|
3884
3885
|
}));
|
|
3885
3886
|
//# sourceMappingURL=index.development.js.map
|