@redis-ui/table 2.4.0 → 2.18.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/Table/Table.cjs +85 -136
- package/dist/Table/Table.context.cjs +16 -1
- package/dist/Table/Table.context.d.ts +22 -4
- package/dist/Table/Table.context.js +16 -1
- package/dist/Table/Table.d.ts +83 -3
- package/dist/Table/Table.js +86 -137
- package/dist/Table/Table.style.cjs +33 -17
- package/dist/Table/Table.style.d.ts +5 -2
- package/dist/Table/Table.style.js +34 -18
- package/dist/Table/Table.types.d.ts +21 -22
- package/dist/Table/components/Compose/Compose.cjs +42 -0
- package/dist/Table/components/Compose/Compose.d.ts +13 -0
- package/dist/Table/components/Compose/Compose.js +42 -0
- package/dist/Table/components/EmptyState/EmptyState.cjs +31 -0
- package/dist/Table/components/EmptyState/EmptyState.d.ts +6 -0
- package/dist/Table/components/EmptyState/EmptyState.js +31 -0
- package/dist/Table/components/ExpandRowButton/ExpandRowButton.cjs +1 -0
- package/dist/Table/components/ExpandRowButton/ExpandRowButton.js +1 -0
- package/dist/Table/components/HiddenCaption/HiddenCaption.cjs +13 -0
- package/dist/Table/components/HiddenCaption/HiddenCaption.d.ts +3 -0
- package/dist/Table/components/HiddenCaption/HiddenCaption.js +13 -0
- package/dist/Table/components/PluggableTable/PluggableTable.cjs +19 -0
- package/dist/Table/components/PluggableTable/PluggableTable.d.ts +10 -0
- package/dist/Table/components/PluggableTable/PluggableTable.js +19 -0
- package/dist/Table/components/PluggableTable/compositionComponents.cjs +21 -0
- package/dist/Table/components/PluggableTable/compositionComponents.d.ts +67 -0
- package/dist/Table/components/PluggableTable/compositionComponents.js +21 -0
- package/dist/Table/components/RowSelection/HeaderMultiRowSelectionButton.cjs +29 -0
- package/dist/Table/components/RowSelection/HeaderMultiRowSelectionButton.d.ts +7 -0
- package/dist/Table/components/RowSelection/HeaderMultiRowSelectionButton.js +29 -0
- package/dist/Table/components/RowSelection/HeaderMultiRowSelectionButton.test.d.ts +1 -0
- package/dist/Table/components/RowSelection/RowSelectionButton.cjs +15 -0
- package/dist/Table/components/RowSelection/RowSelectionButton.d.ts +6 -0
- package/dist/Table/components/RowSelection/RowSelectionButton.js +15 -0
- package/dist/Table/components/RowSelection/RowSelectionButton.test.d.ts +1 -0
- package/dist/Table/components/TableBody/TableBody.cjs +33 -0
- package/dist/Table/components/TableBody/TableBody.d.ts +23 -0
- package/dist/Table/components/TableBody/TableBody.js +33 -0
- package/dist/Table/components/TableBody/components/Compose/Compose.cjs +10 -0
- package/dist/Table/components/TableBody/components/Compose/Compose.d.ts +3 -0
- package/dist/Table/components/TableBody/components/Compose/Compose.js +10 -0
- package/dist/Table/components/TableBodyCell/TableBodyCell.cjs +22 -0
- package/dist/Table/components/TableBodyCell/TableBodyCell.d.ts +12 -0
- package/dist/Table/components/TableBodyCell/TableBodyCell.js +22 -0
- package/dist/Table/components/TableBodyCell/components/Compose/Compose.cjs +5 -0
- package/dist/Table/components/TableBodyCell/components/Compose/Compose.d.ts +3 -0
- package/dist/Table/components/TableBodyCell/components/Compose/Compose.js +5 -0
- package/dist/Table/components/TableBodyRow/TableBodyRow.cjs +38 -0
- package/dist/Table/components/TableBodyRow/TableBodyRow.d.ts +20 -0
- package/dist/Table/components/TableBodyRow/TableBodyRow.js +38 -0
- package/dist/Table/components/TableBodyRow/TableBodyRowExpandable.cjs +33 -0
- package/dist/Table/components/TableBodyRow/TableBodyRowExpandable.d.ts +2 -0
- package/dist/Table/components/TableBodyRow/TableBodyRowExpandable.js +33 -0
- package/dist/Table/components/TableBodyRow/components/Compose/Compose.cjs +17 -0
- package/dist/Table/components/TableBodyRow/components/Compose/Compose.d.ts +4 -0
- package/dist/Table/components/TableBodyRow/components/Compose/Compose.js +17 -0
- package/dist/Table/components/TableExpandedRow/TableAnimatedExpandedRow.cjs +3 -4
- package/dist/Table/components/TableExpandedRow/TableAnimatedExpandedRow.d.ts +1 -1
- package/dist/Table/components/TableExpandedRow/TableAnimatedExpandedRow.js +3 -4
- package/dist/Table/components/TableExpandedRow/TableAnimatedExpandedRow.style.cjs +1 -1
- package/dist/Table/components/TableExpandedRow/TableAnimatedExpandedRow.style.js +1 -1
- package/dist/Table/components/TableExpandedRow/TableExpandedRow.cjs +9 -4
- package/dist/Table/components/TableExpandedRow/TableExpandedRow.d.ts +1 -1
- package/dist/Table/components/TableExpandedRow/TableExpandedRow.js +9 -4
- package/dist/Table/components/TableExpandedRow/TableExpandedRow.style.cjs +2 -2
- package/dist/Table/components/TableExpandedRow/TableExpandedRow.style.js +2 -2
- package/dist/Table/components/TableExpandedRow/TableExpandedRow.types.d.ts +3 -5
- package/dist/Table/components/TableHeader/TableHeader.cjs +28 -0
- package/dist/Table/components/TableHeader/TableHeader.d.ts +21 -0
- package/dist/Table/components/TableHeader/TableHeader.js +28 -0
- package/dist/Table/components/TableHeader/components/Compose/Compose.cjs +5 -0
- package/dist/Table/components/TableHeader/components/Compose/Compose.d.ts +3 -0
- package/dist/Table/components/TableHeader/components/Compose/Compose.js +5 -0
- package/dist/Table/components/TableHeaderCell/SRSortingNotification.cjs +19 -0
- package/dist/Table/components/TableHeaderCell/SRSortingNotification.d.ts +1 -0
- package/dist/Table/components/TableHeaderCell/SRSortingNotification.js +19 -0
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.cjs +23 -0
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.context.cjs +15 -0
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.context.d.ts +8 -0
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.context.js +15 -0
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.d.ts +16 -0
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.js +23 -0
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.test.d.ts +1 -0
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.types.d.ts +13 -0
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.utils.cjs +79 -0
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.utils.d.ts +10 -0
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.utils.js +79 -0
- package/dist/Table/components/TableHeaderCell/components/Compose/Compose.cjs +40 -0
- package/dist/Table/components/TableHeaderCell/components/Compose/Compose.d.ts +9 -0
- package/dist/Table/components/TableHeaderCell/components/Compose/Compose.js +40 -0
- package/dist/Table/components/TableHeaderCell/components/Heading/Heading.cjs +34 -0
- package/dist/Table/components/TableHeaderCell/components/Heading/Heading.d.ts +5 -0
- package/dist/Table/components/TableHeaderCell/components/Heading/Heading.js +34 -0
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/SortableHeading.cjs +16 -0
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/SortableHeading.d.ts +8 -0
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/SortableHeading.js +16 -0
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/components/Compose/Compose.cjs +23 -0
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/components/Compose/Compose.d.ts +5 -0
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/components/Compose/Compose.js +23 -0
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/components/SortIndicator/SortIndicator.cjs +6 -0
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/components/SortIndicator/SortIndicator.d.ts +2 -0
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/components/SortIndicator/SortIndicator.js +6 -0
- package/dist/Table/components/TableHeaderRow/TableHeaderRow.cjs +27 -0
- package/dist/Table/components/TableHeaderRow/TableHeaderRow.d.ts +12 -0
- package/dist/Table/components/TableHeaderRow/TableHeaderRow.js +27 -0
- package/dist/Table/components/TableHeaderRow/components/Compose/Compose.cjs +5 -0
- package/dist/Table/components/TableHeaderRow/components/Compose/Compose.d.ts +3 -0
- package/dist/Table/components/TableHeaderRow/components/Compose/Compose.js +5 -0
- package/dist/Table/components/TablePagination/TablePagination.cjs +63 -78
- package/dist/Table/components/TablePagination/TablePagination.d.ts +23 -3
- package/dist/Table/components/TablePagination/TablePagination.js +64 -79
- package/dist/Table/components/TablePagination/TablePagination.style.cjs +78 -53
- package/dist/Table/components/TablePagination/TablePagination.style.d.ts +17 -49
- package/dist/Table/components/TablePagination/TablePagination.style.js +80 -55
- package/dist/Table/components/TablePagination/components/Compose/Compose.cjs +41 -0
- package/dist/Table/components/TablePagination/components/Compose/Compose.d.ts +3 -0
- package/dist/Table/components/TablePagination/components/Compose/Compose.js +41 -0
- package/dist/Table/components/TableRoot/TableRoot.cjs +5 -0
- package/dist/Table/components/TableRoot/TableRoot.d.ts +1 -0
- package/dist/Table/components/TableRoot/TableRoot.js +5 -0
- package/dist/Table/index.d.ts +3 -6
- package/dist/Table/plugins/ClickableRowPlugin.cjs +48 -0
- package/dist/Table/plugins/ClickableRowPlugin.d.ts +25 -0
- package/dist/Table/plugins/ClickableRowPlugin.js +48 -0
- package/dist/Table/plugins/ExpandableRowPlugin.cjs +38 -0
- package/dist/Table/plugins/ExpandableRowPlugin.d.ts +22 -0
- package/dist/Table/plugins/ExpandableRowPlugin.js +38 -0
- package/dist/Table/plugins/PaginationPlugin.cjs +45 -0
- package/dist/Table/plugins/PaginationPlugin.d.ts +16 -0
- package/dist/Table/plugins/PaginationPlugin.js +45 -0
- package/dist/Table/plugins/RowSelectionPlugin.cjs +28 -0
- package/dist/Table/plugins/RowSelectionPlugin.d.ts +12 -0
- package/dist/Table/plugins/RowSelectionPlugin.js +28 -0
- package/dist/Table/plugins/SortingPlugin.cjs +44 -0
- package/dist/Table/plugins/SortingPlugin.d.ts +18 -0
- package/dist/Table/plugins/SortingPlugin.js +44 -0
- package/dist/Table/tanStackExtendedTypes.d.ts +11 -0
- package/dist/Table/utils/plugin.utils.cjs +49 -0
- package/dist/Table/utils/plugin.utils.d.ts +17 -0
- package/dist/Table/utils/plugin.utils.js +49 -0
- package/dist/Table/utils/plugin.utils.test.d.ts +1 -0
- package/dist/index.cjs +60 -0
- package/dist/index.js +61 -1
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.cjs +55 -0
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +37 -0
- package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs +100 -0
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +82 -0
- package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.cjs +51 -0
- package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js +33 -0
- package/dist/node_modules/@tanstack/react-table/build/lib/index.cjs +7 -0
- package/dist/node_modules/@tanstack/react-table/build/lib/index.js +8 -1
- package/dist/node_modules/@tanstack/table-core/build/lib/index.cjs +361 -4
- package/dist/node_modules/@tanstack/table-core/build/lib/index.js +361 -4
- package/package.json +7 -5
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { composeRefs } from "../../react-compose-refs/dist/index.js";
|
|
3
|
+
import { j as jsxRuntimeExports } from "../../../react/jsx-runtime.js";
|
|
4
|
+
var Slot = React.forwardRef((props, forwardedRef) => {
|
|
5
|
+
const { children, ...slotProps } = props;
|
|
6
|
+
const childrenArray = React.Children.toArray(children);
|
|
7
|
+
const slottable = childrenArray.find(isSlottable);
|
|
8
|
+
if (slottable) {
|
|
9
|
+
const newElement = slottable.props.children;
|
|
10
|
+
const newChildren = childrenArray.map((child) => {
|
|
11
|
+
if (child === slottable) {
|
|
12
|
+
if (React.Children.count(newElement) > 1) return React.Children.only(null);
|
|
13
|
+
return React.isValidElement(newElement) ? newElement.props.children : null;
|
|
14
|
+
} else {
|
|
15
|
+
return child;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
|
|
19
|
+
}
|
|
20
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
21
|
+
});
|
|
22
|
+
Slot.displayName = "Slot";
|
|
23
|
+
var SlotClone = React.forwardRef((props, forwardedRef) => {
|
|
24
|
+
const { children, ...slotProps } = props;
|
|
25
|
+
if (React.isValidElement(children)) {
|
|
26
|
+
const childrenRef = getElementRef(children);
|
|
27
|
+
return React.cloneElement(children, {
|
|
28
|
+
...mergeProps(slotProps, children.props),
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
ref: forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return React.Children.count(children) > 1 ? React.Children.only(null) : null;
|
|
34
|
+
});
|
|
35
|
+
SlotClone.displayName = "SlotClone";
|
|
36
|
+
var Slottable = ({ children }) => {
|
|
37
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children });
|
|
38
|
+
};
|
|
39
|
+
function isSlottable(child) {
|
|
40
|
+
return React.isValidElement(child) && child.type === Slottable;
|
|
41
|
+
}
|
|
42
|
+
function mergeProps(slotProps, childProps) {
|
|
43
|
+
const overrideProps = { ...childProps };
|
|
44
|
+
for (const propName in childProps) {
|
|
45
|
+
const slotPropValue = slotProps[propName];
|
|
46
|
+
const childPropValue = childProps[propName];
|
|
47
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
48
|
+
if (isHandler) {
|
|
49
|
+
if (slotPropValue && childPropValue) {
|
|
50
|
+
overrideProps[propName] = (...args) => {
|
|
51
|
+
childPropValue(...args);
|
|
52
|
+
slotPropValue(...args);
|
|
53
|
+
};
|
|
54
|
+
} else if (slotPropValue) {
|
|
55
|
+
overrideProps[propName] = slotPropValue;
|
|
56
|
+
}
|
|
57
|
+
} else if (propName === "style") {
|
|
58
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
59
|
+
} else if (propName === "className") {
|
|
60
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return { ...slotProps, ...overrideProps };
|
|
64
|
+
}
|
|
65
|
+
function getElementRef(element) {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
68
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
69
|
+
if (mayWarn) {
|
|
70
|
+
return element.ref;
|
|
71
|
+
}
|
|
72
|
+
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
73
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
74
|
+
if (mayWarn) {
|
|
75
|
+
return element.props.ref;
|
|
76
|
+
}
|
|
77
|
+
return element.props.ref || element.ref;
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
Slot,
|
|
81
|
+
Slottable
|
|
82
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const index = require("../../react-primitive/dist/index.cjs");
|
|
5
|
+
const jsxRuntime = require("../../../react/jsx-runtime.cjs");
|
|
6
|
+
function _interopNamespace(e) {
|
|
7
|
+
if (e && e.__esModule) return e;
|
|
8
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
9
|
+
if (e) {
|
|
10
|
+
for (const k in e) {
|
|
11
|
+
if (k !== "default") {
|
|
12
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: () => e[k]
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
n.default = e;
|
|
21
|
+
return Object.freeze(n);
|
|
22
|
+
}
|
|
23
|
+
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
24
|
+
var NAME = "VisuallyHidden";
|
|
25
|
+
var VisuallyHidden = React__namespace.forwardRef(
|
|
26
|
+
(props, forwardedRef) => {
|
|
27
|
+
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
28
|
+
index.Primitive.span,
|
|
29
|
+
{
|
|
30
|
+
...props,
|
|
31
|
+
ref: forwardedRef,
|
|
32
|
+
style: {
|
|
33
|
+
// See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
|
|
34
|
+
position: "absolute",
|
|
35
|
+
border: 0,
|
|
36
|
+
width: 1,
|
|
37
|
+
height: 1,
|
|
38
|
+
padding: 0,
|
|
39
|
+
margin: -1,
|
|
40
|
+
overflow: "hidden",
|
|
41
|
+
clip: "rect(0, 0, 0, 0)",
|
|
42
|
+
whiteSpace: "nowrap",
|
|
43
|
+
wordWrap: "normal",
|
|
44
|
+
...props.style
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
VisuallyHidden.displayName = NAME;
|
|
51
|
+
exports.VisuallyHidden = VisuallyHidden;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Primitive } from "../../react-primitive/dist/index.js";
|
|
3
|
+
import { j as jsxRuntimeExports } from "../../../react/jsx-runtime.js";
|
|
4
|
+
var NAME = "VisuallyHidden";
|
|
5
|
+
var VisuallyHidden = React.forwardRef(
|
|
6
|
+
(props, forwardedRef) => {
|
|
7
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8
|
+
Primitive.span,
|
|
9
|
+
{
|
|
10
|
+
...props,
|
|
11
|
+
ref: forwardedRef,
|
|
12
|
+
style: {
|
|
13
|
+
// See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
|
|
14
|
+
position: "absolute",
|
|
15
|
+
border: 0,
|
|
16
|
+
width: 1,
|
|
17
|
+
height: 1,
|
|
18
|
+
padding: 0,
|
|
19
|
+
margin: -1,
|
|
20
|
+
overflow: "hidden",
|
|
21
|
+
clip: "rect(0, 0, 0, 0)",
|
|
22
|
+
whiteSpace: "nowrap",
|
|
23
|
+
wordWrap: "normal",
|
|
24
|
+
...props.style
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
VisuallyHidden.displayName = NAME;
|
|
31
|
+
export {
|
|
32
|
+
VisuallyHidden
|
|
33
|
+
};
|
|
@@ -95,6 +95,7 @@ exports.aggregationFns = index.aggregationFns;
|
|
|
95
95
|
exports.buildHeaderGroups = index.buildHeaderGroups;
|
|
96
96
|
exports.createCell = index.createCell;
|
|
97
97
|
exports.createColumn = index.createColumn;
|
|
98
|
+
exports.createColumnHelper = index.createColumnHelper;
|
|
98
99
|
exports.createRow = index.createRow;
|
|
99
100
|
exports.createTable = index.createTable;
|
|
100
101
|
exports.defaultColumnSizing = index.defaultColumnSizing;
|
|
@@ -104,6 +105,11 @@ exports.flattenBy = index.flattenBy;
|
|
|
104
105
|
exports.functionalUpdate = index.functionalUpdate;
|
|
105
106
|
exports.getCoreRowModel = index.getCoreRowModel;
|
|
106
107
|
exports.getExpandedRowModel = index.getExpandedRowModel;
|
|
108
|
+
exports.getFacetedMinMaxValues = index.getFacetedMinMaxValues;
|
|
109
|
+
exports.getFacetedRowModel = index.getFacetedRowModel;
|
|
110
|
+
exports.getFacetedUniqueValues = index.getFacetedUniqueValues;
|
|
111
|
+
exports.getFilteredRowModel = index.getFilteredRowModel;
|
|
112
|
+
exports.getGroupedRowModel = index.getGroupedRowModel;
|
|
107
113
|
exports.getMemoOptions = index.getMemoOptions;
|
|
108
114
|
exports.getPaginationRowModel = index.getPaginationRowModel;
|
|
109
115
|
exports.getSortedRowModel = index.getSortedRowModel;
|
|
@@ -113,6 +119,7 @@ exports.isRowSelected = index.isRowSelected;
|
|
|
113
119
|
exports.isSubRowSelected = index.isSubRowSelected;
|
|
114
120
|
exports.makeStateUpdater = index.makeStateUpdater;
|
|
115
121
|
exports.memo = index.memo;
|
|
122
|
+
exports.noop = index.noop;
|
|
116
123
|
exports.orderColumns = index.orderColumns;
|
|
117
124
|
exports.passiveEventSupported = index.passiveEventSupported;
|
|
118
125
|
exports.reSplitAlphaNumeric = index.reSplitAlphaNumeric;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { createTable } from "../../../table-core/build/lib/index.js";
|
|
3
|
-
import { ColumnFaceting, ColumnFiltering, ColumnGrouping, ColumnOrdering, ColumnPinning, ColumnSizing, ColumnVisibility, GlobalFaceting, GlobalFiltering, Headers, RowExpanding, RowPagination, RowPinning, RowSelection, RowSorting, _getVisibleLeafColumns, aggregationFns, buildHeaderGroups, createCell, createColumn, createRow, defaultColumnSizing, expandRows, filterFns, flattenBy, functionalUpdate, getCoreRowModel, getExpandedRowModel, getMemoOptions, getPaginationRowModel, getSortedRowModel, isFunction, isNumberArray, isRowSelected, isSubRowSelected, makeStateUpdater, memo, orderColumns, passiveEventSupported, reSplitAlphaNumeric, selectRowsFn, shouldAutoRemoveFilter, sortingFns } from "../../../table-core/build/lib/index.js";
|
|
3
|
+
import { ColumnFaceting, ColumnFiltering, ColumnGrouping, ColumnOrdering, ColumnPinning, ColumnSizing, ColumnVisibility, GlobalFaceting, GlobalFiltering, Headers, RowExpanding, RowPagination, RowPinning, RowSelection, RowSorting, _getVisibleLeafColumns, aggregationFns, buildHeaderGroups, createCell, createColumn, createColumnHelper, createRow, defaultColumnSizing, expandRows, filterFns, flattenBy, functionalUpdate, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getMemoOptions, getPaginationRowModel, getSortedRowModel, isFunction, isNumberArray, isRowSelected, isSubRowSelected, makeStateUpdater, memo, noop, orderColumns, passiveEventSupported, reSplitAlphaNumeric, selectRowsFn, shouldAutoRemoveFilter, sortingFns } from "../../../table-core/build/lib/index.js";
|
|
4
4
|
/**
|
|
5
5
|
* react-table
|
|
6
6
|
*
|
|
@@ -77,6 +77,7 @@ export {
|
|
|
77
77
|
buildHeaderGroups,
|
|
78
78
|
createCell,
|
|
79
79
|
createColumn,
|
|
80
|
+
createColumnHelper,
|
|
80
81
|
createRow,
|
|
81
82
|
createTable,
|
|
82
83
|
defaultColumnSizing,
|
|
@@ -87,6 +88,11 @@ export {
|
|
|
87
88
|
functionalUpdate,
|
|
88
89
|
getCoreRowModel,
|
|
89
90
|
getExpandedRowModel,
|
|
91
|
+
getFacetedMinMaxValues,
|
|
92
|
+
getFacetedRowModel,
|
|
93
|
+
getFacetedUniqueValues,
|
|
94
|
+
getFilteredRowModel,
|
|
95
|
+
getGroupedRowModel,
|
|
90
96
|
getMemoOptions,
|
|
91
97
|
getPaginationRowModel,
|
|
92
98
|
getSortedRowModel,
|
|
@@ -96,6 +102,7 @@ export {
|
|
|
96
102
|
isSubRowSelected,
|
|
97
103
|
makeStateUpdater,
|
|
98
104
|
memo,
|
|
105
|
+
noop,
|
|
99
106
|
orderColumns,
|
|
100
107
|
passiveEventSupported,
|
|
101
108
|
reSplitAlphaNumeric,
|
|
@@ -10,9 +10,26 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
10
10
|
*
|
|
11
11
|
* @license MIT
|
|
12
12
|
*/
|
|
13
|
+
function createColumnHelper() {
|
|
14
|
+
return {
|
|
15
|
+
accessor: (accessor, column) => {
|
|
16
|
+
return typeof accessor === "function" ? {
|
|
17
|
+
...column,
|
|
18
|
+
accessorFn: accessor
|
|
19
|
+
} : {
|
|
20
|
+
...column,
|
|
21
|
+
accessorKey: accessor
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
display: (column) => column,
|
|
25
|
+
group: (column) => column
|
|
26
|
+
};
|
|
27
|
+
}
|
|
13
28
|
function functionalUpdate(updater, input) {
|
|
14
29
|
return typeof updater === "function" ? updater(input) : updater;
|
|
15
30
|
}
|
|
31
|
+
function noop() {
|
|
32
|
+
}
|
|
16
33
|
function makeStateUpdater(key, instance) {
|
|
17
34
|
return (updater) => {
|
|
18
35
|
instance.setState((old) => {
|
|
@@ -427,7 +444,7 @@ const createRow = (table, id, original, rowIndex, depth, subRows, parentId) => {
|
|
|
427
444
|
var _row$getValue;
|
|
428
445
|
return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue;
|
|
429
446
|
},
|
|
430
|
-
subRows: [],
|
|
447
|
+
subRows: subRows != null ? subRows : [],
|
|
431
448
|
getLeafRows: () => flattenBy(row.subRows, (d) => d.subRows),
|
|
432
449
|
getParentRow: () => row.parentId ? table.getRow(row.parentId, true) : void 0,
|
|
433
450
|
getParentRows: () => {
|
|
@@ -1294,10 +1311,10 @@ function passiveEventSupported() {
|
|
|
1294
1311
|
return false;
|
|
1295
1312
|
}
|
|
1296
1313
|
};
|
|
1297
|
-
const
|
|
1314
|
+
const noop2 = () => {
|
|
1298
1315
|
};
|
|
1299
|
-
window.addEventListener("test",
|
|
1300
|
-
window.removeEventListener("test",
|
|
1316
|
+
window.addEventListener("test", noop2, options);
|
|
1317
|
+
window.removeEventListener("test", noop2);
|
|
1301
1318
|
} catch (err) {
|
|
1302
1319
|
supported = false;
|
|
1303
1320
|
}
|
|
@@ -2653,6 +2670,339 @@ function expandRows(rowModel) {
|
|
|
2653
2670
|
rowsById: rowModel.rowsById
|
|
2654
2671
|
};
|
|
2655
2672
|
}
|
|
2673
|
+
function getFacetedMinMaxValues() {
|
|
2674
|
+
return (table, columnId) => memo(() => {
|
|
2675
|
+
var _table$getColumn;
|
|
2676
|
+
return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()];
|
|
2677
|
+
}, (facetedRowModel) => {
|
|
2678
|
+
var _facetedRowModel$flat;
|
|
2679
|
+
if (!facetedRowModel) return void 0;
|
|
2680
|
+
const firstValue = (_facetedRowModel$flat = facetedRowModel.flatRows[0]) == null ? void 0 : _facetedRowModel$flat.getUniqueValues(columnId);
|
|
2681
|
+
if (typeof firstValue === "undefined") {
|
|
2682
|
+
return void 0;
|
|
2683
|
+
}
|
|
2684
|
+
let facetedMinMaxValues = [firstValue, firstValue];
|
|
2685
|
+
for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
|
|
2686
|
+
const values = facetedRowModel.flatRows[i].getUniqueValues(columnId);
|
|
2687
|
+
for (let j = 0; j < values.length; j++) {
|
|
2688
|
+
const value = values[j];
|
|
2689
|
+
if (value < facetedMinMaxValues[0]) {
|
|
2690
|
+
facetedMinMaxValues[0] = value;
|
|
2691
|
+
} else if (value > facetedMinMaxValues[1]) {
|
|
2692
|
+
facetedMinMaxValues[1] = value;
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
return facetedMinMaxValues;
|
|
2697
|
+
}, getMemoOptions(table.options, "debugTable", "getFacetedMinMaxValues"));
|
|
2698
|
+
}
|
|
2699
|
+
function filterRows(rows, filterRowImpl, table) {
|
|
2700
|
+
if (table.options.filterFromLeafRows) {
|
|
2701
|
+
return filterRowModelFromLeafs(rows, filterRowImpl, table);
|
|
2702
|
+
}
|
|
2703
|
+
return filterRowModelFromRoot(rows, filterRowImpl, table);
|
|
2704
|
+
}
|
|
2705
|
+
function filterRowModelFromLeafs(rowsToFilter, filterRow, table) {
|
|
2706
|
+
var _table$options$maxLea;
|
|
2707
|
+
const newFilteredFlatRows = [];
|
|
2708
|
+
const newFilteredRowsById = {};
|
|
2709
|
+
const maxDepth = (_table$options$maxLea = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea : 100;
|
|
2710
|
+
const recurseFilterRows = function(rowsToFilter2, depth) {
|
|
2711
|
+
if (depth === void 0) {
|
|
2712
|
+
depth = 0;
|
|
2713
|
+
}
|
|
2714
|
+
const rows = [];
|
|
2715
|
+
for (let i = 0; i < rowsToFilter2.length; i++) {
|
|
2716
|
+
var _row$subRows;
|
|
2717
|
+
let row = rowsToFilter2[i];
|
|
2718
|
+
const newRow = createRow(table, row.id, row.original, row.index, row.depth, void 0, row.parentId);
|
|
2719
|
+
newRow.columnFilters = row.columnFilters;
|
|
2720
|
+
if ((_row$subRows = row.subRows) != null && _row$subRows.length && depth < maxDepth) {
|
|
2721
|
+
newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
|
|
2722
|
+
row = newRow;
|
|
2723
|
+
if (filterRow(row) && !newRow.subRows.length) {
|
|
2724
|
+
rows.push(row);
|
|
2725
|
+
newFilteredRowsById[row.id] = row;
|
|
2726
|
+
newFilteredFlatRows.push(row);
|
|
2727
|
+
continue;
|
|
2728
|
+
}
|
|
2729
|
+
if (filterRow(row) || newRow.subRows.length) {
|
|
2730
|
+
rows.push(row);
|
|
2731
|
+
newFilteredRowsById[row.id] = row;
|
|
2732
|
+
newFilteredFlatRows.push(row);
|
|
2733
|
+
continue;
|
|
2734
|
+
}
|
|
2735
|
+
} else {
|
|
2736
|
+
row = newRow;
|
|
2737
|
+
if (filterRow(row)) {
|
|
2738
|
+
rows.push(row);
|
|
2739
|
+
newFilteredRowsById[row.id] = row;
|
|
2740
|
+
newFilteredFlatRows.push(row);
|
|
2741
|
+
}
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2744
|
+
return rows;
|
|
2745
|
+
};
|
|
2746
|
+
return {
|
|
2747
|
+
rows: recurseFilterRows(rowsToFilter),
|
|
2748
|
+
flatRows: newFilteredFlatRows,
|
|
2749
|
+
rowsById: newFilteredRowsById
|
|
2750
|
+
};
|
|
2751
|
+
}
|
|
2752
|
+
function filterRowModelFromRoot(rowsToFilter, filterRow, table) {
|
|
2753
|
+
var _table$options$maxLea2;
|
|
2754
|
+
const newFilteredFlatRows = [];
|
|
2755
|
+
const newFilteredRowsById = {};
|
|
2756
|
+
const maxDepth = (_table$options$maxLea2 = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea2 : 100;
|
|
2757
|
+
const recurseFilterRows = function(rowsToFilter2, depth) {
|
|
2758
|
+
if (depth === void 0) {
|
|
2759
|
+
depth = 0;
|
|
2760
|
+
}
|
|
2761
|
+
const rows = [];
|
|
2762
|
+
for (let i = 0; i < rowsToFilter2.length; i++) {
|
|
2763
|
+
let row = rowsToFilter2[i];
|
|
2764
|
+
const pass = filterRow(row);
|
|
2765
|
+
if (pass) {
|
|
2766
|
+
var _row$subRows2;
|
|
2767
|
+
if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length && depth < maxDepth) {
|
|
2768
|
+
const newRow = createRow(table, row.id, row.original, row.index, row.depth, void 0, row.parentId);
|
|
2769
|
+
newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
|
|
2770
|
+
row = newRow;
|
|
2771
|
+
}
|
|
2772
|
+
rows.push(row);
|
|
2773
|
+
newFilteredFlatRows.push(row);
|
|
2774
|
+
newFilteredRowsById[row.id] = row;
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
return rows;
|
|
2778
|
+
};
|
|
2779
|
+
return {
|
|
2780
|
+
rows: recurseFilterRows(rowsToFilter),
|
|
2781
|
+
flatRows: newFilteredFlatRows,
|
|
2782
|
+
rowsById: newFilteredRowsById
|
|
2783
|
+
};
|
|
2784
|
+
}
|
|
2785
|
+
function getFacetedRowModel() {
|
|
2786
|
+
return (table, columnId) => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter, table.getFilteredRowModel()], (preRowModel, columnFilters, globalFilter) => {
|
|
2787
|
+
if (!preRowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
|
|
2788
|
+
return preRowModel;
|
|
2789
|
+
}
|
|
2790
|
+
const filterableIds = [...columnFilters.map((d) => d.id).filter((d) => d !== columnId), globalFilter ? "__global__" : void 0].filter(Boolean);
|
|
2791
|
+
const filterRowsImpl = (row) => {
|
|
2792
|
+
for (let i = 0; i < filterableIds.length; i++) {
|
|
2793
|
+
if (row.columnFilters[filterableIds[i]] === false) {
|
|
2794
|
+
return false;
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2797
|
+
return true;
|
|
2798
|
+
};
|
|
2799
|
+
return filterRows(preRowModel.rows, filterRowsImpl, table);
|
|
2800
|
+
}, getMemoOptions(table.options, "debugTable", "getFacetedRowModel"));
|
|
2801
|
+
}
|
|
2802
|
+
function getFacetedUniqueValues() {
|
|
2803
|
+
return (table, columnId) => memo(() => {
|
|
2804
|
+
var _table$getColumn;
|
|
2805
|
+
return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()];
|
|
2806
|
+
}, (facetedRowModel) => {
|
|
2807
|
+
if (!facetedRowModel) return /* @__PURE__ */ new Map();
|
|
2808
|
+
let facetedUniqueValues = /* @__PURE__ */ new Map();
|
|
2809
|
+
for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
|
|
2810
|
+
const values = facetedRowModel.flatRows[i].getUniqueValues(columnId);
|
|
2811
|
+
for (let j = 0; j < values.length; j++) {
|
|
2812
|
+
const value = values[j];
|
|
2813
|
+
if (facetedUniqueValues.has(value)) {
|
|
2814
|
+
var _facetedUniqueValues$;
|
|
2815
|
+
facetedUniqueValues.set(value, ((_facetedUniqueValues$ = facetedUniqueValues.get(value)) != null ? _facetedUniqueValues$ : 0) + 1);
|
|
2816
|
+
} else {
|
|
2817
|
+
facetedUniqueValues.set(value, 1);
|
|
2818
|
+
}
|
|
2819
|
+
}
|
|
2820
|
+
}
|
|
2821
|
+
return facetedUniqueValues;
|
|
2822
|
+
}, getMemoOptions(table.options, "debugTable", `getFacetedUniqueValues_${columnId}`));
|
|
2823
|
+
}
|
|
2824
|
+
function getFilteredRowModel() {
|
|
2825
|
+
return (table) => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
|
|
2826
|
+
if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
|
|
2827
|
+
for (let i = 0; i < rowModel.flatRows.length; i++) {
|
|
2828
|
+
rowModel.flatRows[i].columnFilters = {};
|
|
2829
|
+
rowModel.flatRows[i].columnFiltersMeta = {};
|
|
2830
|
+
}
|
|
2831
|
+
return rowModel;
|
|
2832
|
+
}
|
|
2833
|
+
const resolvedColumnFilters = [];
|
|
2834
|
+
const resolvedGlobalFilters = [];
|
|
2835
|
+
(columnFilters != null ? columnFilters : []).forEach((d) => {
|
|
2836
|
+
var _filterFn$resolveFilt;
|
|
2837
|
+
const column = table.getColumn(d.id);
|
|
2838
|
+
if (!column) {
|
|
2839
|
+
return;
|
|
2840
|
+
}
|
|
2841
|
+
const filterFn = column.getFilterFn();
|
|
2842
|
+
if (!filterFn) {
|
|
2843
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2844
|
+
console.warn(`Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`);
|
|
2845
|
+
}
|
|
2846
|
+
return;
|
|
2847
|
+
}
|
|
2848
|
+
resolvedColumnFilters.push({
|
|
2849
|
+
id: d.id,
|
|
2850
|
+
filterFn,
|
|
2851
|
+
resolvedValue: (_filterFn$resolveFilt = filterFn.resolveFilterValue == null ? void 0 : filterFn.resolveFilterValue(d.value)) != null ? _filterFn$resolveFilt : d.value
|
|
2852
|
+
});
|
|
2853
|
+
});
|
|
2854
|
+
const filterableIds = (columnFilters != null ? columnFilters : []).map((d) => d.id);
|
|
2855
|
+
const globalFilterFn = table.getGlobalFilterFn();
|
|
2856
|
+
const globallyFilterableColumns = table.getAllLeafColumns().filter((column) => column.getCanGlobalFilter());
|
|
2857
|
+
if (globalFilter && globalFilterFn && globallyFilterableColumns.length) {
|
|
2858
|
+
filterableIds.push("__global__");
|
|
2859
|
+
globallyFilterableColumns.forEach((column) => {
|
|
2860
|
+
var _globalFilterFn$resol;
|
|
2861
|
+
resolvedGlobalFilters.push({
|
|
2862
|
+
id: column.id,
|
|
2863
|
+
filterFn: globalFilterFn,
|
|
2864
|
+
resolvedValue: (_globalFilterFn$resol = globalFilterFn.resolveFilterValue == null ? void 0 : globalFilterFn.resolveFilterValue(globalFilter)) != null ? _globalFilterFn$resol : globalFilter
|
|
2865
|
+
});
|
|
2866
|
+
});
|
|
2867
|
+
}
|
|
2868
|
+
let currentColumnFilter;
|
|
2869
|
+
let currentGlobalFilter;
|
|
2870
|
+
for (let j = 0; j < rowModel.flatRows.length; j++) {
|
|
2871
|
+
const row = rowModel.flatRows[j];
|
|
2872
|
+
row.columnFilters = {};
|
|
2873
|
+
if (resolvedColumnFilters.length) {
|
|
2874
|
+
for (let i = 0; i < resolvedColumnFilters.length; i++) {
|
|
2875
|
+
currentColumnFilter = resolvedColumnFilters[i];
|
|
2876
|
+
const id = currentColumnFilter.id;
|
|
2877
|
+
row.columnFilters[id] = currentColumnFilter.filterFn(row, id, currentColumnFilter.resolvedValue, (filterMeta) => {
|
|
2878
|
+
row.columnFiltersMeta[id] = filterMeta;
|
|
2879
|
+
});
|
|
2880
|
+
}
|
|
2881
|
+
}
|
|
2882
|
+
if (resolvedGlobalFilters.length) {
|
|
2883
|
+
for (let i = 0; i < resolvedGlobalFilters.length; i++) {
|
|
2884
|
+
currentGlobalFilter = resolvedGlobalFilters[i];
|
|
2885
|
+
const id = currentGlobalFilter.id;
|
|
2886
|
+
if (currentGlobalFilter.filterFn(row, id, currentGlobalFilter.resolvedValue, (filterMeta) => {
|
|
2887
|
+
row.columnFiltersMeta[id] = filterMeta;
|
|
2888
|
+
})) {
|
|
2889
|
+
row.columnFilters.__global__ = true;
|
|
2890
|
+
break;
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
if (row.columnFilters.__global__ !== true) {
|
|
2894
|
+
row.columnFilters.__global__ = false;
|
|
2895
|
+
}
|
|
2896
|
+
}
|
|
2897
|
+
}
|
|
2898
|
+
const filterRowsImpl = (row) => {
|
|
2899
|
+
for (let i = 0; i < filterableIds.length; i++) {
|
|
2900
|
+
if (row.columnFilters[filterableIds[i]] === false) {
|
|
2901
|
+
return false;
|
|
2902
|
+
}
|
|
2903
|
+
}
|
|
2904
|
+
return true;
|
|
2905
|
+
};
|
|
2906
|
+
return filterRows(rowModel.rows, filterRowsImpl, table);
|
|
2907
|
+
}, getMemoOptions(table.options, "debugTable", "getFilteredRowModel", () => table._autoResetPageIndex()));
|
|
2908
|
+
}
|
|
2909
|
+
function getGroupedRowModel() {
|
|
2910
|
+
return (table) => memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => {
|
|
2911
|
+
if (!rowModel.rows.length || !grouping.length) {
|
|
2912
|
+
return rowModel;
|
|
2913
|
+
}
|
|
2914
|
+
const existingGrouping = grouping.filter((columnId) => table.getColumn(columnId));
|
|
2915
|
+
const groupedFlatRows = [];
|
|
2916
|
+
const groupedRowsById = {};
|
|
2917
|
+
const groupUpRecursively = function(rows, depth, parentId) {
|
|
2918
|
+
if (depth === void 0) {
|
|
2919
|
+
depth = 0;
|
|
2920
|
+
}
|
|
2921
|
+
if (depth >= existingGrouping.length) {
|
|
2922
|
+
return rows.map((row) => {
|
|
2923
|
+
row.depth = depth;
|
|
2924
|
+
groupedFlatRows.push(row);
|
|
2925
|
+
groupedRowsById[row.id] = row;
|
|
2926
|
+
if (row.subRows) {
|
|
2927
|
+
row.subRows = groupUpRecursively(row.subRows, depth + 1, row.id);
|
|
2928
|
+
}
|
|
2929
|
+
return row;
|
|
2930
|
+
});
|
|
2931
|
+
}
|
|
2932
|
+
const columnId = existingGrouping[depth];
|
|
2933
|
+
const rowGroupsMap = groupBy(rows, columnId);
|
|
2934
|
+
const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index) => {
|
|
2935
|
+
let [groupingValue, groupedRows2] = _ref;
|
|
2936
|
+
let id = `${columnId}:${groupingValue}`;
|
|
2937
|
+
id = parentId ? `${parentId}>${id}` : id;
|
|
2938
|
+
const subRows = groupUpRecursively(groupedRows2, depth + 1, id);
|
|
2939
|
+
const leafRows = depth ? flattenBy(groupedRows2, (row2) => row2.subRows) : groupedRows2;
|
|
2940
|
+
const row = createRow(table, id, leafRows[0].original, index, depth, void 0, parentId);
|
|
2941
|
+
Object.assign(row, {
|
|
2942
|
+
groupingColumnId: columnId,
|
|
2943
|
+
groupingValue,
|
|
2944
|
+
subRows,
|
|
2945
|
+
leafRows,
|
|
2946
|
+
getValue: (columnId2) => {
|
|
2947
|
+
if (existingGrouping.includes(columnId2)) {
|
|
2948
|
+
if (row._valuesCache.hasOwnProperty(columnId2)) {
|
|
2949
|
+
return row._valuesCache[columnId2];
|
|
2950
|
+
}
|
|
2951
|
+
if (groupedRows2[0]) {
|
|
2952
|
+
var _groupedRows$0$getVal;
|
|
2953
|
+
row._valuesCache[columnId2] = (_groupedRows$0$getVal = groupedRows2[0].getValue(columnId2)) != null ? _groupedRows$0$getVal : void 0;
|
|
2954
|
+
}
|
|
2955
|
+
return row._valuesCache[columnId2];
|
|
2956
|
+
}
|
|
2957
|
+
if (row._groupingValuesCache.hasOwnProperty(columnId2)) {
|
|
2958
|
+
return row._groupingValuesCache[columnId2];
|
|
2959
|
+
}
|
|
2960
|
+
const column = table.getColumn(columnId2);
|
|
2961
|
+
const aggregateFn = column == null ? void 0 : column.getAggregationFn();
|
|
2962
|
+
if (aggregateFn) {
|
|
2963
|
+
row._groupingValuesCache[columnId2] = aggregateFn(columnId2, leafRows, groupedRows2);
|
|
2964
|
+
return row._groupingValuesCache[columnId2];
|
|
2965
|
+
}
|
|
2966
|
+
}
|
|
2967
|
+
});
|
|
2968
|
+
subRows.forEach((subRow) => {
|
|
2969
|
+
groupedFlatRows.push(subRow);
|
|
2970
|
+
groupedRowsById[subRow.id] = subRow;
|
|
2971
|
+
});
|
|
2972
|
+
return row;
|
|
2973
|
+
});
|
|
2974
|
+
return aggregatedGroupedRows;
|
|
2975
|
+
};
|
|
2976
|
+
const groupedRows = groupUpRecursively(rowModel.rows, 0);
|
|
2977
|
+
groupedRows.forEach((subRow) => {
|
|
2978
|
+
groupedFlatRows.push(subRow);
|
|
2979
|
+
groupedRowsById[subRow.id] = subRow;
|
|
2980
|
+
});
|
|
2981
|
+
return {
|
|
2982
|
+
rows: groupedRows,
|
|
2983
|
+
flatRows: groupedFlatRows,
|
|
2984
|
+
rowsById: groupedRowsById
|
|
2985
|
+
};
|
|
2986
|
+
}, getMemoOptions(table.options, "debugTable", "getGroupedRowModel", () => {
|
|
2987
|
+
table._queue(() => {
|
|
2988
|
+
table._autoResetExpanded();
|
|
2989
|
+
table._autoResetPageIndex();
|
|
2990
|
+
});
|
|
2991
|
+
}));
|
|
2992
|
+
}
|
|
2993
|
+
function groupBy(rows, columnId) {
|
|
2994
|
+
const groupMap = /* @__PURE__ */ new Map();
|
|
2995
|
+
return rows.reduce((map, row) => {
|
|
2996
|
+
const resKey = `${row.getGroupingValue(columnId)}`;
|
|
2997
|
+
const previous = map.get(resKey);
|
|
2998
|
+
if (!previous) {
|
|
2999
|
+
map.set(resKey, [row]);
|
|
3000
|
+
} else {
|
|
3001
|
+
previous.push(row);
|
|
3002
|
+
}
|
|
3003
|
+
return map;
|
|
3004
|
+
}, groupMap);
|
|
3005
|
+
}
|
|
2656
3006
|
function getPaginationRowModel(opts) {
|
|
2657
3007
|
return (table) => memo(() => [table.getState().pagination, table.getPrePaginationRowModel(), table.options.paginateExpandedRows ? void 0 : table.getState().expanded], (pagination, rowModel) => {
|
|
2658
3008
|
if (!rowModel.rows.length) {
|
|
@@ -2790,6 +3140,7 @@ exports.aggregationFns = aggregationFns;
|
|
|
2790
3140
|
exports.buildHeaderGroups = buildHeaderGroups;
|
|
2791
3141
|
exports.createCell = createCell;
|
|
2792
3142
|
exports.createColumn = createColumn;
|
|
3143
|
+
exports.createColumnHelper = createColumnHelper;
|
|
2793
3144
|
exports.createRow = createRow;
|
|
2794
3145
|
exports.createTable = createTable;
|
|
2795
3146
|
exports.defaultColumnSizing = defaultColumnSizing;
|
|
@@ -2799,6 +3150,11 @@ exports.flattenBy = flattenBy;
|
|
|
2799
3150
|
exports.functionalUpdate = functionalUpdate;
|
|
2800
3151
|
exports.getCoreRowModel = getCoreRowModel;
|
|
2801
3152
|
exports.getExpandedRowModel = getExpandedRowModel;
|
|
3153
|
+
exports.getFacetedMinMaxValues = getFacetedMinMaxValues;
|
|
3154
|
+
exports.getFacetedRowModel = getFacetedRowModel;
|
|
3155
|
+
exports.getFacetedUniqueValues = getFacetedUniqueValues;
|
|
3156
|
+
exports.getFilteredRowModel = getFilteredRowModel;
|
|
3157
|
+
exports.getGroupedRowModel = getGroupedRowModel;
|
|
2802
3158
|
exports.getMemoOptions = getMemoOptions;
|
|
2803
3159
|
exports.getPaginationRowModel = getPaginationRowModel;
|
|
2804
3160
|
exports.getSortedRowModel = getSortedRowModel;
|
|
@@ -2808,6 +3164,7 @@ exports.isRowSelected = isRowSelected;
|
|
|
2808
3164
|
exports.isSubRowSelected = isSubRowSelected;
|
|
2809
3165
|
exports.makeStateUpdater = makeStateUpdater;
|
|
2810
3166
|
exports.memo = memo;
|
|
3167
|
+
exports.noop = noop;
|
|
2811
3168
|
exports.orderColumns = orderColumns;
|
|
2812
3169
|
exports.passiveEventSupported = passiveEventSupported;
|
|
2813
3170
|
exports.reSplitAlphaNumeric = reSplitAlphaNumeric;
|