@tanstack/react-table 8.17.0 → 9.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +78 -0
- package/{build/lib/index.mjs.map → dist/cjs/index.cjs.map} +1 -1
- package/dist/cjs/index.d.cts +9 -0
- package/{build/lib → dist/esm}/index.d.ts +2 -2
- package/dist/esm/index.js +55 -0
- package/{build/lib → dist/esm}/index.js.map +1 -1
- package/package.json +17 -20
- package/build/lib/index.esm.js +0 -74
- package/build/lib/index.esm.js.map +0 -1
- package/build/lib/index.js +0 -101
- package/build/lib/index.mjs +0 -74
- package/build/umd/index.development.js +0 -3667
- package/build/umd/index.development.js.map +0 -1
- package/build/umd/index.production.js +0 -22
- package/build/umd/index.production.js.map +0 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const tableCore = require("@tanstack/table-core");
|
|
6
|
+
function _interopNamespaceDefault(e) {
|
|
7
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
8
|
+
if (e) {
|
|
9
|
+
for (const k in e) {
|
|
10
|
+
if (k !== "default") {
|
|
11
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: () => e[k]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
n.default = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
|
+
}
|
|
22
|
+
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
23
|
+
function flexRender(Comp, props) {
|
|
24
|
+
return !Comp ? null : isReactComponent(Comp) ? /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...props }) : Comp;
|
|
25
|
+
}
|
|
26
|
+
function isReactComponent(component) {
|
|
27
|
+
return isClassComponent(component) || typeof component === "function" || isExoticComponent(component);
|
|
28
|
+
}
|
|
29
|
+
function isClassComponent(component) {
|
|
30
|
+
return typeof component === "function" && (() => {
|
|
31
|
+
const proto = Object.getPrototypeOf(component);
|
|
32
|
+
return proto.prototype && proto.prototype.isReactComponent;
|
|
33
|
+
})();
|
|
34
|
+
}
|
|
35
|
+
function isExoticComponent(component) {
|
|
36
|
+
return typeof component === "object" && typeof component.$$typeof === "symbol" && ["react.memo", "react.forward_ref"].includes(component.$$typeof.description);
|
|
37
|
+
}
|
|
38
|
+
function useReactTable(options) {
|
|
39
|
+
const resolvedOptions = {
|
|
40
|
+
state: {},
|
|
41
|
+
// Dummy state
|
|
42
|
+
onStateChange: () => {
|
|
43
|
+
},
|
|
44
|
+
// noop
|
|
45
|
+
renderFallbackValue: null,
|
|
46
|
+
...options
|
|
47
|
+
};
|
|
48
|
+
const [tableRef] = React__namespace.useState(() => ({
|
|
49
|
+
current: tableCore.createTable(resolvedOptions)
|
|
50
|
+
}));
|
|
51
|
+
const [state, setState] = React__namespace.useState(() => tableRef.current.initialState);
|
|
52
|
+
tableRef.current.setOptions((prev) => ({
|
|
53
|
+
...prev,
|
|
54
|
+
...options,
|
|
55
|
+
state: {
|
|
56
|
+
...state,
|
|
57
|
+
...options.state
|
|
58
|
+
},
|
|
59
|
+
// Similarly, we'll maintain both our internal state and any user-provided
|
|
60
|
+
// state.
|
|
61
|
+
onStateChange: (updater) => {
|
|
62
|
+
var _a;
|
|
63
|
+
setState(updater);
|
|
64
|
+
(_a = options.onStateChange) == null ? void 0 : _a.call(options, updater);
|
|
65
|
+
}
|
|
66
|
+
}));
|
|
67
|
+
return tableRef.current;
|
|
68
|
+
}
|
|
69
|
+
exports.flexRender = flexRender;
|
|
70
|
+
exports.useReactTable = useReactTable;
|
|
71
|
+
Object.keys(tableCore).forEach((k) => {
|
|
72
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k))
|
|
73
|
+
Object.defineProperty(exports, k, {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: () => tableCore[k]
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.
|
|
1
|
+
{"version":3,"file":"index.cjs","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":["jsx","React","createTable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiBgB,SAAA,WACd,MACA,OAC+B;AACxB,SAAA,CAAC,OAAO,OAAO,iBAAyB,IAAI,IAChDA,+BAAA,MAAA,EAAM,GAAG,MAAO,CAAA,IAEjB;AAEJ;AAEA,SAAS,iBACP,WAC0C;AAC1C,SACE,iBAAiB,SAAS,KAC1B,OAAO,cAAc,cACrB,kBAAkB,SAAS;AAE/B;AAEA,SAAS,iBAAiB,WAAgB;AAEtC,SAAA,OAAO,cAAc,eACpB,MAAM;AACC,UAAA,QAAQ,OAAO,eAAe,SAAS;AACtC,WAAA,MAAM,aAAa,MAAM,UAAU;AAAA,EAAA;AAGhD;AAEA,SAAS,kBAAkB,WAAgB;AACzC,SACE,OAAO,cAAc,YACrB,OAAO,UAAU,aAAa,YAC9B,CAAC,cAAc,mBAAmB,EAAE,SAAS,UAAU,SAAS,WAAW;AAE/E;AAEO,SAAS,cACd,SACA;AAEA,QAAM,kBAA+C;AAAA,IACnD,OAAO,CAAC;AAAA;AAAA,IACR,eAAe,MAAM;AAAA,IAAC;AAAA;AAAA,IACtB,qBAAqB;AAAA,IACrB,GAAG;AAAA,EAAA;AAIL,QAAM,CAAC,QAAQ,IAAIC,iBAAM,SAAS,OAAO;AAAA,IACvC,SAASC,sBAAmB,eAAe;AAAA,EAC3C,EAAA;AAGI,QAAA,CAAC,OAAO,QAAQ,IAAID,iBAAM,SAAS,MAAM,SAAS,QAAQ,YAAY;AAInE,WAAA,QAAQ,WAAW,CAAS,UAAA;AAAA,IACnC,GAAG;AAAA,IACH,GAAG;AAAA,IACH,OAAO;AAAA,MACL,GAAG;AAAA,MACH,GAAG,QAAQ;AAAA,IACb;AAAA;AAAA;AAAA,IAGA,eAAe,CAAW,YAAA;;AACxB,eAAS,OAAO;AAChB,oBAAQ,kBAAR,iCAAwB;AAAA,IAC1B;AAAA,EACA,EAAA;AAEF,SAAO,SAAS;AAClB;;;;;;;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TableOptions, RowData } from '@tanstack/table-core';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export * from '@tanstack/table-core';
|
|
4
|
+
export type Renderable<TProps> = React.ReactNode | React.ComponentType<TProps>;
|
|
5
|
+
/**
|
|
6
|
+
* If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function flexRender<TProps extends object>(Comp: Renderable<TProps>, props: TProps): React.ReactNode | JSX.Element;
|
|
9
|
+
export declare function useReactTable<TData extends RowData>(options: TableOptions<TData>): import('@tanstack/table-core').Table<TData>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { TableOptions, RowData } from '@tanstack/table-core';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
export * from '@tanstack/table-core';
|
|
3
|
-
import { TableOptions, RowData } from '@tanstack/table-core';
|
|
4
4
|
export type Renderable<TProps> = React.ReactNode | React.ComponentType<TProps>;
|
|
5
5
|
/**
|
|
6
6
|
* If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`.
|
|
7
7
|
*/
|
|
8
8
|
export declare function flexRender<TProps extends object>(Comp: Renderable<TProps>, props: TProps): React.ReactNode | JSX.Element;
|
|
9
|
-
export declare function useReactTable<TData extends RowData>(options: TableOptions<TData>): import(
|
|
9
|
+
export declare function useReactTable<TData extends RowData>(options: TableOptions<TData>): import('@tanstack/table-core').Table<TData>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { createTable } from "@tanstack/table-core";
|
|
4
|
+
export * from "@tanstack/table-core";
|
|
5
|
+
function flexRender(Comp, props) {
|
|
6
|
+
return !Comp ? null : isReactComponent(Comp) ? /* @__PURE__ */ jsx(Comp, { ...props }) : Comp;
|
|
7
|
+
}
|
|
8
|
+
function isReactComponent(component) {
|
|
9
|
+
return isClassComponent(component) || typeof component === "function" || isExoticComponent(component);
|
|
10
|
+
}
|
|
11
|
+
function isClassComponent(component) {
|
|
12
|
+
return typeof component === "function" && (() => {
|
|
13
|
+
const proto = Object.getPrototypeOf(component);
|
|
14
|
+
return proto.prototype && proto.prototype.isReactComponent;
|
|
15
|
+
})();
|
|
16
|
+
}
|
|
17
|
+
function isExoticComponent(component) {
|
|
18
|
+
return typeof component === "object" && typeof component.$$typeof === "symbol" && ["react.memo", "react.forward_ref"].includes(component.$$typeof.description);
|
|
19
|
+
}
|
|
20
|
+
function useReactTable(options) {
|
|
21
|
+
const resolvedOptions = {
|
|
22
|
+
state: {},
|
|
23
|
+
// Dummy state
|
|
24
|
+
onStateChange: () => {
|
|
25
|
+
},
|
|
26
|
+
// noop
|
|
27
|
+
renderFallbackValue: null,
|
|
28
|
+
...options
|
|
29
|
+
};
|
|
30
|
+
const [tableRef] = React.useState(() => ({
|
|
31
|
+
current: createTable(resolvedOptions)
|
|
32
|
+
}));
|
|
33
|
+
const [state, setState] = React.useState(() => tableRef.current.initialState);
|
|
34
|
+
tableRef.current.setOptions((prev) => ({
|
|
35
|
+
...prev,
|
|
36
|
+
...options,
|
|
37
|
+
state: {
|
|
38
|
+
...state,
|
|
39
|
+
...options.state
|
|
40
|
+
},
|
|
41
|
+
// Similarly, we'll maintain both our internal state and any user-provided
|
|
42
|
+
// state.
|
|
43
|
+
onStateChange: (updater) => {
|
|
44
|
+
var _a;
|
|
45
|
+
setState(updater);
|
|
46
|
+
(_a = options.onStateChange) == null ? void 0 : _a.call(options, updater);
|
|
47
|
+
}
|
|
48
|
+
}));
|
|
49
|
+
return tableRef.current;
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
flexRender,
|
|
53
|
+
useReactTable
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -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":[
|
|
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":[],"mappings":";;;;AAiBgB,SAAA,WACd,MACA,OAC+B;AACxB,SAAA,CAAC,OAAO,OAAO,iBAAyB,IAAI,IAChD,oBAAA,MAAA,EAAM,GAAG,MAAO,CAAA,IAEjB;AAEJ;AAEA,SAAS,iBACP,WAC0C;AAC1C,SACE,iBAAiB,SAAS,KAC1B,OAAO,cAAc,cACrB,kBAAkB,SAAS;AAE/B;AAEA,SAAS,iBAAiB,WAAgB;AAEtC,SAAA,OAAO,cAAc,eACpB,MAAM;AACC,UAAA,QAAQ,OAAO,eAAe,SAAS;AACtC,WAAA,MAAM,aAAa,MAAM,UAAU;AAAA,EAAA;AAGhD;AAEA,SAAS,kBAAkB,WAAgB;AACzC,SACE,OAAO,cAAc,YACrB,OAAO,UAAU,aAAa,YAC9B,CAAC,cAAc,mBAAmB,EAAE,SAAS,UAAU,SAAS,WAAW;AAE/E;AAEO,SAAS,cACd,SACA;AAEA,QAAM,kBAA+C;AAAA,IACnD,OAAO,CAAC;AAAA;AAAA,IACR,eAAe,MAAM;AAAA,IAAC;AAAA;AAAA,IACtB,qBAAqB;AAAA,IACrB,GAAG;AAAA,EAAA;AAIL,QAAM,CAAC,QAAQ,IAAI,MAAM,SAAS,OAAO;AAAA,IACvC,SAAS,YAAmB,eAAe;AAAA,EAC3C,EAAA;AAGI,QAAA,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAS,MAAM,SAAS,QAAQ,YAAY;AAInE,WAAA,QAAQ,WAAW,CAAS,UAAA;AAAA,IACnC,GAAG;AAAA,IACH,GAAG;AAAA,IACH,OAAO;AAAA,MACL,GAAG;AAAA,MACH,GAAG,QAAQ;AAAA,IACb;AAAA;AAAA;AAAA,IAGA,eAAe,CAAW,YAAA;;AACxB,eAAS,OAAO;AAChB,oBAAQ,kBAAR,iCAAwB;AAAA,IAC1B;AAAA,EACA,EAAA;AAEF,SAAO,SAAS;AAClB;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-table",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0-alpha.0",
|
|
4
4
|
"description": "Headless UI for building powerful tables & datagrids for React.",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,15 +20,20 @@
|
|
|
20
20
|
"react-table",
|
|
21
21
|
"datagrid"
|
|
22
22
|
],
|
|
23
|
-
"type": "
|
|
24
|
-
"
|
|
25
|
-
"main": "
|
|
26
|
-
"
|
|
23
|
+
"type": "module",
|
|
24
|
+
"types": "dist/esm/index.d.ts",
|
|
25
|
+
"main": "dist/cjs/index.cjs",
|
|
26
|
+
"module": "dist/esm/index.js",
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
"import": {
|
|
30
|
+
"types": "./dist/esm/index.d.ts",
|
|
31
|
+
"default": "./dist/esm/index.js"
|
|
32
|
+
},
|
|
33
|
+
"require": {
|
|
34
|
+
"types": "./dist/cjs/index.d.cts",
|
|
35
|
+
"default": "./dist/cjs/index.cjs"
|
|
36
|
+
}
|
|
32
37
|
},
|
|
33
38
|
"./package.json": "./package.json"
|
|
34
39
|
},
|
|
@@ -37,28 +42,20 @@
|
|
|
37
42
|
"node": ">=12"
|
|
38
43
|
},
|
|
39
44
|
"files": [
|
|
40
|
-
"
|
|
41
|
-
"build/umd/*",
|
|
45
|
+
"dist",
|
|
42
46
|
"src"
|
|
43
47
|
],
|
|
44
48
|
"dependencies": {
|
|
45
|
-
"@tanstack/table-core": "
|
|
49
|
+
"@tanstack/table-core": "9.0.0-alpha.0"
|
|
46
50
|
},
|
|
47
51
|
"devDependencies": {
|
|
48
52
|
"@types/react": "^18.3.0",
|
|
53
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
49
54
|
"react": "^18.3.0"
|
|
50
55
|
},
|
|
51
56
|
"peerDependencies": {
|
|
52
57
|
"react": ">=16.8",
|
|
53
58
|
"react-dom": ">=16.8"
|
|
54
59
|
},
|
|
55
|
-
"scripts": {
|
|
56
|
-
"clean": "rimraf ./build",
|
|
57
|
-
"test:lib": "vitest",
|
|
58
|
-
"test:lib:dev": "pnpm test:lib --watch",
|
|
59
|
-
"test:types": "tsc --noEmit",
|
|
60
|
-
"build": "pnpm build:rollup && pnpm build:types",
|
|
61
|
-
"build:rollup": "rollup --config rollup.config.mjs",
|
|
62
|
-
"build:types": "tsc --emitDeclarationOnly"
|
|
63
|
-
}
|
|
60
|
+
"scripts": {}
|
|
64
61
|
}
|
package/build/lib/index.esm.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
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
|
-
import * as React from 'react';
|
|
12
|
-
import { createTable } from '@tanstack/table-core';
|
|
13
|
-
export * from '@tanstack/table-core';
|
|
14
|
-
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`.
|
|
19
|
-
*/
|
|
20
|
-
function flexRender(Comp, props) {
|
|
21
|
-
return !Comp ? null : isReactComponent(Comp) ? /*#__PURE__*/React.createElement(Comp, props) : Comp;
|
|
22
|
-
}
|
|
23
|
-
function isReactComponent(component) {
|
|
24
|
-
return isClassComponent(component) || typeof component === 'function' || isExoticComponent(component);
|
|
25
|
-
}
|
|
26
|
-
function isClassComponent(component) {
|
|
27
|
-
return typeof component === 'function' && (() => {
|
|
28
|
-
const proto = Object.getPrototypeOf(component);
|
|
29
|
-
return proto.prototype && proto.prototype.isReactComponent;
|
|
30
|
-
})();
|
|
31
|
-
}
|
|
32
|
-
function isExoticComponent(component) {
|
|
33
|
-
return typeof component === 'object' && typeof component.$$typeof === 'symbol' && ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description);
|
|
34
|
-
}
|
|
35
|
-
function useReactTable(options) {
|
|
36
|
-
// Compose in the generic options to the user options
|
|
37
|
-
const resolvedOptions = {
|
|
38
|
-
state: {},
|
|
39
|
-
// Dummy state
|
|
40
|
-
onStateChange: () => {},
|
|
41
|
-
// noop
|
|
42
|
-
renderFallbackValue: null,
|
|
43
|
-
...options
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
// Create a new table and store it in state
|
|
47
|
-
const [tableRef] = React.useState(() => ({
|
|
48
|
-
current: createTable(resolvedOptions)
|
|
49
|
-
}));
|
|
50
|
-
|
|
51
|
-
// By default, manage table state here using the table's initial state
|
|
52
|
-
const [state, setState] = React.useState(() => tableRef.current.initialState);
|
|
53
|
-
|
|
54
|
-
// Compose the default state above with any user state. This will allow the user
|
|
55
|
-
// to only control a subset of the state if desired.
|
|
56
|
-
tableRef.current.setOptions(prev => ({
|
|
57
|
-
...prev,
|
|
58
|
-
...options,
|
|
59
|
-
state: {
|
|
60
|
-
...state,
|
|
61
|
-
...options.state
|
|
62
|
-
},
|
|
63
|
-
// Similarly, we'll maintain both our internal state and any user-provided
|
|
64
|
-
// state.
|
|
65
|
-
onStateChange: updater => {
|
|
66
|
-
setState(updater);
|
|
67
|
-
options.onStateChange == null || options.onStateChange(updater);
|
|
68
|
-
}
|
|
69
|
-
}));
|
|
70
|
-
return tableRef.current;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export { flexRender, useReactTable };
|
|
74
|
-
//# sourceMappingURL=index.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.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,KAAA,CAAAC,aAAA,CAACJ,IAAI,EAAKC,KAAQ,CAAC,GAEnBD,IACD,CAAA;AACH,CAAA;AAEA,SAASE,gBAAgBA,CACvBG,SAAkB,EACwB;AAC1C,EAAA,OACEC,gBAAgB,CAACD,SAAS,CAAC,IAC3B,OAAOA,SAAS,KAAK,UAAU,IAC/BE,iBAAiB,CAACF,SAAS,CAAC,CAAA;AAEhC,CAAA;AAEA,SAASC,gBAAgBA,CAACD,SAAc,EAAE;AACxC,EAAA,OACE,OAAOA,SAAS,KAAK,UAAU,IAC/B,CAAC,MAAM;AACL,IAAA,MAAMG,KAAK,GAAGC,MAAM,CAACC,cAAc,CAACL,SAAS,CAAC,CAAA;IAC9C,OAAOG,KAAK,CAACG,SAAS,IAAIH,KAAK,CAACG,SAAS,CAACT,gBAAgB,CAAA;AAC5D,GAAC,GAAG,CAAA;AAER,CAAA;AAEA,SAASK,iBAAiBA,CAACF,SAAc,EAAE;EACzC,OACE,OAAOA,SAAS,KAAK,QAAQ,IAC7B,OAAOA,SAAS,CAACO,QAAQ,KAAK,QAAQ,IACtC,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAACC,QAAQ,CAACR,SAAS,CAACO,QAAQ,CAACE,WAAW,CAAC,CAAA;AAEhF,CAAA;AAEO,SAASC,aAAaA,CAC3BC,OAA4B,EAC5B;AACA;AACA,EAAA,MAAMC,eAA4C,GAAG;IACnDC,KAAK,EAAE,EAAE;AAAE;AACXC,IAAAA,aAAa,EAAEA,MAAM,EAAE;AAAE;AACzBC,IAAAA,mBAAmB,EAAE,IAAI;IACzB,GAAGJ,OAAAA;GACJ,CAAA;;AAED;EACA,MAAM,CAACK,QAAQ,CAAC,GAAGlB,KAAK,CAACmB,QAAQ,CAAC,OAAO;IACvCC,OAAO,EAAEC,WAAW,CAAQP,eAAe,CAAA;AAC7C,GAAC,CAAC,CAAC,CAAA;;AAEH;AACA,EAAA,MAAM,CAACC,KAAK,EAAEO,QAAQ,CAAC,GAAGtB,KAAK,CAACmB,QAAQ,CAAC,MAAMD,QAAQ,CAACE,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.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
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
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
var React = require('react');
|
|
14
|
-
var tableCore = require('@tanstack/table-core');
|
|
15
|
-
|
|
16
|
-
function _interopNamespaceDefault(e) {
|
|
17
|
-
var n = Object.create(null);
|
|
18
|
-
if (e) {
|
|
19
|
-
Object.keys(e).forEach(function (k) {
|
|
20
|
-
if (k !== 'default') {
|
|
21
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
22
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function () { return e[k]; }
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
n.default = e;
|
|
30
|
-
return Object.freeze(n);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
34
|
-
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`.
|
|
39
|
-
*/
|
|
40
|
-
function flexRender(Comp, props) {
|
|
41
|
-
return !Comp ? null : isReactComponent(Comp) ? /*#__PURE__*/React__namespace.createElement(Comp, props) : Comp;
|
|
42
|
-
}
|
|
43
|
-
function isReactComponent(component) {
|
|
44
|
-
return isClassComponent(component) || typeof component === 'function' || isExoticComponent(component);
|
|
45
|
-
}
|
|
46
|
-
function isClassComponent(component) {
|
|
47
|
-
return typeof component === 'function' && (() => {
|
|
48
|
-
const proto = Object.getPrototypeOf(component);
|
|
49
|
-
return proto.prototype && proto.prototype.isReactComponent;
|
|
50
|
-
})();
|
|
51
|
-
}
|
|
52
|
-
function isExoticComponent(component) {
|
|
53
|
-
return typeof component === 'object' && typeof component.$$typeof === 'symbol' && ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description);
|
|
54
|
-
}
|
|
55
|
-
function useReactTable(options) {
|
|
56
|
-
// Compose in the generic options to the user options
|
|
57
|
-
const resolvedOptions = {
|
|
58
|
-
state: {},
|
|
59
|
-
// Dummy state
|
|
60
|
-
onStateChange: () => {},
|
|
61
|
-
// noop
|
|
62
|
-
renderFallbackValue: null,
|
|
63
|
-
...options
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// Create a new table and store it in state
|
|
67
|
-
const [tableRef] = React__namespace.useState(() => ({
|
|
68
|
-
current: tableCore.createTable(resolvedOptions)
|
|
69
|
-
}));
|
|
70
|
-
|
|
71
|
-
// By default, manage table state here using the table's initial state
|
|
72
|
-
const [state, setState] = React__namespace.useState(() => tableRef.current.initialState);
|
|
73
|
-
|
|
74
|
-
// Compose the default state above with any user state. This will allow the user
|
|
75
|
-
// to only control a subset of the state if desired.
|
|
76
|
-
tableRef.current.setOptions(prev => ({
|
|
77
|
-
...prev,
|
|
78
|
-
...options,
|
|
79
|
-
state: {
|
|
80
|
-
...state,
|
|
81
|
-
...options.state
|
|
82
|
-
},
|
|
83
|
-
// Similarly, we'll maintain both our internal state and any user-provided
|
|
84
|
-
// state.
|
|
85
|
-
onStateChange: updater => {
|
|
86
|
-
setState(updater);
|
|
87
|
-
options.onStateChange == null || options.onStateChange(updater);
|
|
88
|
-
}
|
|
89
|
-
}));
|
|
90
|
-
return tableRef.current;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
exports.flexRender = flexRender;
|
|
94
|
-
exports.useReactTable = useReactTable;
|
|
95
|
-
Object.keys(tableCore).forEach(function (k) {
|
|
96
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
97
|
-
enumerable: true,
|
|
98
|
-
get: function () { return tableCore[k]; }
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
//# sourceMappingURL=index.js.map
|
package/build/lib/index.mjs
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
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
|
-
import * as React from 'react';
|
|
12
|
-
import { createTable } from '@tanstack/table-core';
|
|
13
|
-
export * from '@tanstack/table-core';
|
|
14
|
-
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`.
|
|
19
|
-
*/
|
|
20
|
-
function flexRender(Comp, props) {
|
|
21
|
-
return !Comp ? null : isReactComponent(Comp) ? /*#__PURE__*/React.createElement(Comp, props) : Comp;
|
|
22
|
-
}
|
|
23
|
-
function isReactComponent(component) {
|
|
24
|
-
return isClassComponent(component) || typeof component === 'function' || isExoticComponent(component);
|
|
25
|
-
}
|
|
26
|
-
function isClassComponent(component) {
|
|
27
|
-
return typeof component === 'function' && (() => {
|
|
28
|
-
const proto = Object.getPrototypeOf(component);
|
|
29
|
-
return proto.prototype && proto.prototype.isReactComponent;
|
|
30
|
-
})();
|
|
31
|
-
}
|
|
32
|
-
function isExoticComponent(component) {
|
|
33
|
-
return typeof component === 'object' && typeof component.$$typeof === 'symbol' && ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description);
|
|
34
|
-
}
|
|
35
|
-
function useReactTable(options) {
|
|
36
|
-
// Compose in the generic options to the user options
|
|
37
|
-
const resolvedOptions = {
|
|
38
|
-
state: {},
|
|
39
|
-
// Dummy state
|
|
40
|
-
onStateChange: () => {},
|
|
41
|
-
// noop
|
|
42
|
-
renderFallbackValue: null,
|
|
43
|
-
...options
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
// Create a new table and store it in state
|
|
47
|
-
const [tableRef] = React.useState(() => ({
|
|
48
|
-
current: createTable(resolvedOptions)
|
|
49
|
-
}));
|
|
50
|
-
|
|
51
|
-
// By default, manage table state here using the table's initial state
|
|
52
|
-
const [state, setState] = React.useState(() => tableRef.current.initialState);
|
|
53
|
-
|
|
54
|
-
// Compose the default state above with any user state. This will allow the user
|
|
55
|
-
// to only control a subset of the state if desired.
|
|
56
|
-
tableRef.current.setOptions(prev => ({
|
|
57
|
-
...prev,
|
|
58
|
-
...options,
|
|
59
|
-
state: {
|
|
60
|
-
...state,
|
|
61
|
-
...options.state
|
|
62
|
-
},
|
|
63
|
-
// Similarly, we'll maintain both our internal state and any user-provided
|
|
64
|
-
// state.
|
|
65
|
-
onStateChange: updater => {
|
|
66
|
-
setState(updater);
|
|
67
|
-
options.onStateChange == null || options.onStateChange(updater);
|
|
68
|
-
}
|
|
69
|
-
}));
|
|
70
|
-
return tableRef.current;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export { flexRender, useReactTable };
|
|
74
|
-
//# sourceMappingURL=index.mjs.map
|