@redis-ui/table 2.12.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 +70 -145
- 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 -5
- package/dist/Table/Table.js +70 -145
- package/dist/Table/Table.style.cjs +10 -5
- package/dist/Table/Table.style.d.ts +3 -3
- package/dist/Table/Table.style.js +10 -5
- package/dist/Table/Table.types.d.ts +20 -38
- 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/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/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/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.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 +19 -33
- 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 -4
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.js +19 -33
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.test.d.ts +1 -0
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.utils.cjs +0 -22
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.utils.d.ts +0 -1
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.utils.js +1 -23
- 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 +65 -99
- package/dist/Table/components/TablePagination/TablePagination.d.ts +23 -3
- package/dist/Table/components/TablePagination/TablePagination.js +66 -100
- package/dist/Table/components/TablePagination/TablePagination.style.cjs +70 -50
- package/dist/Table/components/TablePagination/TablePagination.style.d.ts +17 -50
- package/dist/Table/components/TablePagination/TablePagination.style.js +72 -52
- 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/@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 +6 -5
- package/dist/Table/components/EmptyStateRow/EmptyStateRow.cjs +0 -16
- package/dist/Table/components/EmptyStateRow/EmptyStateRow.d.ts +0 -8
- package/dist/Table/components/EmptyStateRow/EmptyStateRow.js +0 -16
- package/dist/node_modules/@radix-ui/react-id/dist/index.cjs +0 -32
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +0 -14
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs +0 -24
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +0 -6
|
@@ -1,112 +1,78 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "../../../node_modules/react/jsx-runtime.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
import { Pagination } from "@redislabsdev/redis-ui-components";
|
|
3
|
+
import { usePaginationContext } from "../../plugins/PaginationPlugin.js";
|
|
4
|
+
import { TablePaginationCompose } from "./components/Compose/Compose.js";
|
|
5
|
+
import { PaginationBar, InfoLabel, PageSelect, PageSizeSelect, NavigationButton, PageSizeGroup, PageNavGroup, PageSelectGroup } from "./TablePagination.style.js";
|
|
6
|
+
const renderRowCount = ({
|
|
7
|
+
visibleItemCount,
|
|
8
|
+
totalItemCount
|
|
9
|
+
}) => `Showing ${visibleItemCount} out of ${totalItemCount} rows`;
|
|
10
|
+
const renderPageCount = ({
|
|
11
|
+
pageIndex,
|
|
12
|
+
pageCount
|
|
13
|
+
}) => `${pageIndex + 1} of ${pageCount}`;
|
|
14
|
+
const renderTotalPageCount = ({
|
|
15
|
+
pageCount
|
|
16
|
+
}) => `of ${pageCount}`;
|
|
17
|
+
const TablePagination = Object.assign(() => {
|
|
18
|
+
const pagination = usePaginationContext();
|
|
19
|
+
if (!pagination) {
|
|
16
20
|
return null;
|
|
17
21
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return jsxRuntimeExports.jsx(PaginationRow, {
|
|
31
|
-
"data-role": "pagination",
|
|
32
|
-
children: jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
|
|
33
|
-
children: [jsxRuntimeExports.jsxs(CountInfo, {
|
|
34
|
-
children: ["Showing ", table.getRowModel().rows.length, " out of ", totalRowCount, " rows"]
|
|
35
|
-
}), jsxRuntimeExports.jsxs("div", {
|
|
36
|
-
style: {
|
|
37
|
-
display: "flex",
|
|
38
|
-
alignItems: "center",
|
|
39
|
-
gap: "1rem"
|
|
40
|
-
},
|
|
41
|
-
children: [jsxRuntimeExports.jsx(ItemPerPageText, {
|
|
42
|
-
children: jsxRuntimeExports.jsx(Label, {
|
|
43
|
-
htmlFor: perPageId,
|
|
44
|
-
children: "Items per page:"
|
|
45
|
-
})
|
|
46
|
-
}), jsxRuntimeExports.jsx(Select, {
|
|
47
|
-
id: perPageId,
|
|
48
|
-
value: pageSize.toString(),
|
|
49
|
-
onChange: handlePageSizeChange,
|
|
50
|
-
disabled: pageSizes[0] > totalRowCount,
|
|
51
|
-
options: pageSizes.map(String).map((value) => ({
|
|
52
|
-
value
|
|
53
|
-
}))
|
|
22
|
+
return jsxRuntimeExports.jsx(TablePagination.Compose, {
|
|
23
|
+
children: jsxRuntimeExports.jsxs(TablePagination.Bar, {
|
|
24
|
+
"data-role": "pagination",
|
|
25
|
+
children: [jsxRuntimeExports.jsx(TablePagination.InfoLabel, {
|
|
26
|
+
renderer: renderRowCount,
|
|
27
|
+
ellipsis: true,
|
|
28
|
+
tooltipOnEllipsis: true
|
|
29
|
+
}), jsxRuntimeExports.jsx(TablePagination.Split, {}), jsxRuntimeExports.jsxs(TablePagination.PageSizeGroup, {
|
|
30
|
+
children: [jsxRuntimeExports.jsx(TablePagination.PageSizeSelect.Label, {
|
|
31
|
+
children: "Items per page:"
|
|
32
|
+
}), jsxRuntimeExports.jsx(TablePagination.PageSizeSelect, {
|
|
33
|
+
pageSizes: pagination.pageSizes
|
|
54
34
|
})]
|
|
55
|
-
}), jsxRuntimeExports.jsxs(
|
|
56
|
-
children: [jsxRuntimeExports.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
children: [pageIndex + 1, " of ", pageCount]
|
|
73
|
-
}), jsxRuntimeExports.jsx(PaginationIconButton, {
|
|
74
|
-
icon: ChevronRightIcon,
|
|
75
|
-
size: "S",
|
|
76
|
-
onClick: () => handlePageIndexChange(pageIndex + 1),
|
|
77
|
-
disabled: pageIndex === pageCount - 1,
|
|
78
|
-
title: "Next page",
|
|
79
|
-
"aria-label": "next page"
|
|
80
|
-
}), jsxRuntimeExports.jsx(PaginationIconButton, {
|
|
81
|
-
icon: DoubleChevronRightIcon,
|
|
82
|
-
size: "S",
|
|
83
|
-
onClick: () => handlePageIndexChange(pageCount - 1),
|
|
84
|
-
disabled: pageIndex === pageCount - 1,
|
|
85
|
-
title: "Last page",
|
|
86
|
-
"aria-label": "last page"
|
|
35
|
+
}), jsxRuntimeExports.jsxs(TablePagination.PageNavGroup, {
|
|
36
|
+
children: [jsxRuntimeExports.jsxs("div", {
|
|
37
|
+
children: [jsxRuntimeExports.jsx(TablePagination.NavigationButton, {
|
|
38
|
+
navType: "first"
|
|
39
|
+
}), jsxRuntimeExports.jsx(TablePagination.NavigationButton, {
|
|
40
|
+
navType: "prev"
|
|
41
|
+
})]
|
|
42
|
+
}), jsxRuntimeExports.jsx(TablePagination.InfoLabel, {
|
|
43
|
+
ellipsis: true,
|
|
44
|
+
tooltipOnEllipsis: true,
|
|
45
|
+
renderer: renderPageCount
|
|
46
|
+
}), jsxRuntimeExports.jsxs("div", {
|
|
47
|
+
children: [jsxRuntimeExports.jsx(TablePagination.NavigationButton, {
|
|
48
|
+
navType: "next"
|
|
49
|
+
}), jsxRuntimeExports.jsx(TablePagination.NavigationButton, {
|
|
50
|
+
navType: "last"
|
|
51
|
+
})]
|
|
87
52
|
})]
|
|
88
|
-
}), jsxRuntimeExports.jsxs(
|
|
89
|
-
children: [jsxRuntimeExports.jsx(
|
|
90
|
-
children:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
id: pageNumId,
|
|
96
|
-
value: (pageIndex + 1).toString(),
|
|
97
|
-
onChange: (value) => handlePageIndexChange(Number(value) - 1),
|
|
98
|
-
options: Array.from({
|
|
99
|
-
length: pageCount
|
|
100
|
-
}, (_, i) => String(i + 1)).map((value) => ({
|
|
101
|
-
value
|
|
102
|
-
}))
|
|
103
|
-
}), jsxRuntimeExports.jsxs(TotalPagesText, {
|
|
104
|
-
children: ["of ", pageCount]
|
|
53
|
+
}), jsxRuntimeExports.jsxs(TablePagination.PageSelectGroup, {
|
|
54
|
+
children: [jsxRuntimeExports.jsx(TablePagination.PageSelect.Label, {
|
|
55
|
+
children: "Page"
|
|
56
|
+
}), jsxRuntimeExports.jsx(TablePagination.PageSelect, {}), jsxRuntimeExports.jsx(TablePagination.InfoLabel, {
|
|
57
|
+
ellipsis: true,
|
|
58
|
+
tooltipOnEllipsis: true,
|
|
59
|
+
renderer: renderTotalPageCount
|
|
105
60
|
})]
|
|
106
61
|
})]
|
|
107
62
|
})
|
|
108
63
|
});
|
|
109
|
-
}
|
|
64
|
+
}, {
|
|
65
|
+
Compose: TablePaginationCompose,
|
|
66
|
+
Bar: PaginationBar,
|
|
67
|
+
Split: Pagination.Split,
|
|
68
|
+
InfoLabel,
|
|
69
|
+
PageSelect,
|
|
70
|
+
PageSizeSelect,
|
|
71
|
+
NavigationButton,
|
|
72
|
+
PageSizeGroup,
|
|
73
|
+
PageNavGroup,
|
|
74
|
+
PageSelectGroup
|
|
75
|
+
});
|
|
110
76
|
export {
|
|
111
77
|
TablePagination as default
|
|
112
78
|
};
|
|
@@ -5,61 +5,81 @@ const redisUiStyles = require("@redislabsdev/redis-ui-styles");
|
|
|
5
5
|
const redisUiComponents = require("@redislabsdev/redis-ui-components");
|
|
6
6
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
7
7
|
const _styled__default = /* @__PURE__ */ _interopDefault(_styled);
|
|
8
|
-
const
|
|
9
|
-
displayName: "
|
|
8
|
+
const NavigationButton = _styled__default.default(redisUiComponents.Pagination.NavigationButton).withConfig({
|
|
9
|
+
displayName: "TablePaginationstyle__NavigationButton",
|
|
10
10
|
componentId: "RedisUI__sc-ccqfi0-0"
|
|
11
|
-
})(["
|
|
12
|
-
const
|
|
13
|
-
|
|
11
|
+
})(["", ";"], () => {
|
|
12
|
+
const styles = redisUiStyles.useTheme().components.table.pagination.navButton;
|
|
13
|
+
return _styled.css`
|
|
14
|
+
width: ${styles.width};
|
|
15
|
+
height: ${styles.height};
|
|
16
|
+
padding: ${styles.padding};
|
|
17
|
+
color: ${styles.color};
|
|
18
|
+
|
|
19
|
+
&:disabled {
|
|
20
|
+
color: ${styles.disabledColor};
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
});
|
|
24
|
+
const PaginationBar = _styled__default.default(redisUiComponents.Pagination.Bar).attrs(({
|
|
25
|
+
"aria-label": al
|
|
26
|
+
}) => ({
|
|
27
|
+
"aria-label": al ?? "Table Pagination"
|
|
28
|
+
})).withConfig({
|
|
29
|
+
displayName: "TablePaginationstyle__PaginationBar",
|
|
14
30
|
componentId: "RedisUI__sc-ccqfi0-1"
|
|
15
|
-
})(["
|
|
16
|
-
const
|
|
17
|
-
|
|
31
|
+
})(["", " width:100%;overflow:auto hidden;> *{flex:none;}"], () => {
|
|
32
|
+
const styles = redisUiStyles.useTheme().components.table.pagination.bar;
|
|
33
|
+
return _styled.css`
|
|
34
|
+
font-size: ${styles.fontSize};
|
|
35
|
+
gap: ${styles.gap};
|
|
36
|
+
height: ${styles.height};
|
|
37
|
+
padding: ${styles.padding};
|
|
38
|
+
border: solid ${styles.borderColor};
|
|
39
|
+
border-width: ${styles.borderSize};
|
|
40
|
+
color: ${styles.textColor};
|
|
41
|
+
`;
|
|
42
|
+
});
|
|
43
|
+
const InfoLabel = _styled__default.default(redisUiComponents.Pagination.InfoLabel).withConfig({
|
|
44
|
+
displayName: "TablePaginationstyle__InfoLabel",
|
|
18
45
|
componentId: "RedisUI__sc-ccqfi0-2"
|
|
19
|
-
})(["
|
|
20
|
-
const
|
|
21
|
-
|
|
46
|
+
})(["line-height:", ";"], () => redisUiStyles.useTheme().components.table.pagination.select.height);
|
|
47
|
+
const useSelectStyles = () => {
|
|
48
|
+
const styles = redisUiStyles.useTheme().components.table.pagination.select;
|
|
49
|
+
return _styled.css`
|
|
50
|
+
gap: ${styles.gap};
|
|
51
|
+
height: ${styles.height};
|
|
52
|
+
padding: ${styles.padding};
|
|
53
|
+
color: ${styles.textColor};
|
|
54
|
+
font-size: ${styles.fontSize};
|
|
55
|
+
line-height: initial;
|
|
56
|
+
`;
|
|
57
|
+
};
|
|
58
|
+
const PageSizeSelect = _styled__default.default(redisUiComponents.Pagination.PageSizeSelect).withConfig({
|
|
59
|
+
displayName: "TablePaginationstyle__PageSizeSelect",
|
|
22
60
|
componentId: "RedisUI__sc-ccqfi0-3"
|
|
23
|
-
})(["
|
|
24
|
-
const
|
|
25
|
-
displayName: "
|
|
61
|
+
})(["", ""], useSelectStyles);
|
|
62
|
+
const PageSelect = _styled__default.default(redisUiComponents.Pagination.PageSelect).withConfig({
|
|
63
|
+
displayName: "TablePaginationstyle__PageSelect",
|
|
26
64
|
componentId: "RedisUI__sc-ccqfi0-4"
|
|
27
|
-
})(["
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
}).withConfig({
|
|
31
|
-
displayName: "TablePaginationstyle__ItemPerPageText",
|
|
65
|
+
})(["", ""], useSelectStyles);
|
|
66
|
+
const PageSizeGroup = _styled__default.default(redisUiComponents.Pagination.Group).withConfig({
|
|
67
|
+
displayName: "TablePaginationstyle__PageSizeGroup",
|
|
32
68
|
componentId: "RedisUI__sc-ccqfi0-5"
|
|
33
|
-
})(["
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
}).withConfig({
|
|
37
|
-
displayName: "TablePaginationstyle__PaginationIndexText",
|
|
69
|
+
})(["gap:1rem;"]);
|
|
70
|
+
const PageNavGroup = _styled__default.default(redisUiComponents.Pagination.Group).withConfig({
|
|
71
|
+
displayName: "TablePaginationstyle__PageNavGroup",
|
|
38
72
|
componentId: "RedisUI__sc-ccqfi0-6"
|
|
39
|
-
})(["
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
}).withConfig({
|
|
43
|
-
displayName: "TablePaginationstyle__PageLabelText",
|
|
73
|
+
})(["gap:0.4rem;"]);
|
|
74
|
+
const PageSelectGroup = _styled__default.default(redisUiComponents.Pagination.Group).withConfig({
|
|
75
|
+
displayName: "TablePaginationstyle__PageSelectGroup",
|
|
44
76
|
componentId: "RedisUI__sc-ccqfi0-7"
|
|
45
|
-
})(["
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
componentId: "RedisUI__sc-ccqfi0-9"
|
|
55
|
-
})(["color:", ";flex-shrink:0;"], () => redisUiStyles.useTheme().components.table.components.tablePagination.totalPagesText.color);
|
|
56
|
-
exports.CountInfo = CountInfo;
|
|
57
|
-
exports.ItemPerPageText = ItemPerPageText;
|
|
58
|
-
exports.Label = Label;
|
|
59
|
-
exports.PageLabelText = PageLabelText;
|
|
60
|
-
exports.PaginationActions = PaginationActions;
|
|
61
|
-
exports.PaginationIconButton = PaginationIconButton;
|
|
62
|
-
exports.PaginationIndexText = PaginationIndexText;
|
|
63
|
-
exports.PaginationRow = PaginationRow;
|
|
64
|
-
exports.Select = Select;
|
|
65
|
-
exports.TotalPagesText = TotalPagesText;
|
|
77
|
+
})(["gap:0.4rem;"]);
|
|
78
|
+
exports.InfoLabel = InfoLabel;
|
|
79
|
+
exports.NavigationButton = NavigationButton;
|
|
80
|
+
exports.PageNavGroup = PageNavGroup;
|
|
81
|
+
exports.PageSelect = PageSelect;
|
|
82
|
+
exports.PageSelectGroup = PageSelectGroup;
|
|
83
|
+
exports.PageSizeGroup = PageSizeGroup;
|
|
84
|
+
exports.PageSizeSelect = PageSizeSelect;
|
|
85
|
+
exports.PaginationBar = PaginationBar;
|
|
@@ -1,51 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
allowReset?: boolean | undefined;
|
|
12
|
-
loading?: boolean | undefined;
|
|
13
|
-
} & import("@redislabsdev/redis-ui-components/dist/Select/components/Trigger/components/Compose/Compose.types").RestSelectTriggerComposeProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
14
|
-
Compose: ({ customContainer, id, ...restProps }: import("@redislabsdev/redis-ui-components/dist/Select/components/Trigger/components/Compose/Compose.types").SelectTriggerComposeProps & import("@redislabsdev/redis-ui-components/dist/Select/components/Trigger/components/Compose/Compose.types").RestSelectTriggerComposeProps & import("@redislabsdev/redis-ui-components/dist/Helpers/common.types").ComposeChildrenProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
Value: <TOption_3 extends import("@redislabsdev/redis-ui-components").SelectOption<string> = import("@redislabsdev/redis-ui-components").SelectOption<string>>({ placeholder, valueRender, ...restProps }: import("@redislabsdev/redis-ui-components/dist/Select/components/Trigger/components/Value/Value.types").SelectTriggerValueProps<TOption_3> & import("@redislabsdev/redis-ui-components/dist/Select/components/Trigger/components/Value/Value.types").RestSelectTriggerValueProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
ResetButton: ({ children, title, ...restProps }: import("react").HTMLAttributes<HTMLButtonElement>) => import("react/jsx-runtime").JSX.Element | null;
|
|
17
|
-
StatusIndicator: ({ className, style, size, ...restProps }: import("@redislabsdev/redis-ui-icons/monochrome").MonochromeIconProps & Pick<import("react").HTMLAttributes<unknown>, "style" | "className">) => import("react/jsx-runtime").JSX.Element | null;
|
|
18
|
-
LoadingIndicator: ({ loading, ...restProps }: import("@redislabsdev/redis-ui-components/dist/Inputs/components/LoadingIndicator/LoadingIndicator.types").LoadingIndicatorProps & import("@redislabsdev/redis-ui-components/dist/Inputs/components/LoadingIndicator/LoadingIndicator.types").RestLoadingIndicatorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
19
|
-
Arrow: ({ icon, ...restProps }: import("@redislabsdev/redis-ui-components/dist/Select/components/Trigger/components/Arrow/Arrow.types").TriggerArrowProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
ErrorIcon: ({ className, style, size, ...restProps }: import("@redislabsdev/redis-ui-icons/monochrome").MonochromeIconProps & Pick<import("react").HTMLAttributes<unknown>, "style" | "className">) => import("react/jsx-runtime").JSX.Element | null;
|
|
21
|
-
};
|
|
22
|
-
Content: (<TOption_4 extends import("@redislabsdev/redis-ui-components").SelectOption<string> = import("@redislabsdev/redis-ui-components").SelectOption<string>>({ searchable, optionValueRender, optionComponent, maxVisibleItems, virtualized, ...restProps }: import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/Compose/Compose.types").SelectContentComposeProps & import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/OptionList/OptionList.types").OptionListProps<TOption_4> & {
|
|
23
|
-
searchable?: boolean | undefined;
|
|
24
|
-
} & import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/Compose/Compose.types").RestSelectContentComposeProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
25
|
-
Compose: ({ children, placement, contentWidth, ...restProps }: import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/Compose/Compose.types").SelectContentComposeProps & import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/Compose/Compose.types").RestSelectContentComposeProps & import("@redislabsdev/redis-ui-components/dist/Helpers/common.types").ComposeChildrenProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
OptionList: <TOption_5 extends import("@redislabsdev/redis-ui-components").SelectOption<string> = import("@redislabsdev/redis-ui-components").SelectOption<string>>({ optionValueRender, optionComponent: OptionComponent, maxVisibleItems, virtualized, ...restProps }: import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/OptionList/OptionList.types").OptionListProps<TOption_5> & import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/OptionList/OptionList.types").RestOptionListProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
-
Search: import("react").ForwardRefExoticComponent<Omit<import("@redislabsdev/redis-ui-components/dist/Inputs/components/Compose/TextCompose.types").TextInputComposeProps, "readOnly" | "parser" | "formatter"> & import("@redislabsdev/redis-ui-components/dist/Inputs/components/InputTag/InputTag.types").InputTagProps & import("@redislabsdev/redis-ui-components/dist/Inputs/components/LoadingIndicator/LoadingIndicator.types").LoadingIndicatorProps & import("@redislabsdev/redis-ui-components/dist/Inputs/components/ResetButton/ResetButton.types").ResetButtonProps & import("@redislabsdev/redis-ui-components").RestInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
28
|
-
Footer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
29
|
-
};
|
|
30
|
-
Option: (<TOption_6 extends import("@redislabsdev/redis-ui-components").SelectOption<string> = import("@redislabsdev/redis-ui-components").SelectOption<string>>({ option, content, ...restProps }: import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/Option/components/Compose/Compose.types").SelectOptionComposeProps<TOption_6> & {
|
|
31
|
-
content?: import("react").ReactNode;
|
|
32
|
-
} & import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/Option/components/Compose/Compose.types").RestSelectOptionComposeProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
33
|
-
Compose: import("react").ForwardRefExoticComponent<import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/Option/components/Compose/Compose.types").SelectOptionComposeProps<import("@redislabsdev/redis-ui-components").SelectOption<string>> & import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/Option/components/Compose/Compose.types").RestSelectOptionComposeProps & import("@redislabsdev/redis-ui-components/dist/Helpers/common.types").ComposeChildrenProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
34
|
-
Content: (props: import("@redislabsdev/redis-ui-components/dist/Helpers/common.types").ComposeChildrenProps & import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/Option/components/Content/Content.types").RestSelectOptionContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
35
|
-
Indicator: ({ children, ...restProps }: import("@radix-ui/react-select").SelectItemIndicatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
36
|
-
};
|
|
1
|
+
export declare const NavigationButton: import("styled-components").StyledComponent<({ navType, ...restProps }: import("@redislabsdev/redis-ui-components").PaginationNavigationButtonProps) => import("react/jsx-runtime").JSX.Element, any, {}, never>;
|
|
2
|
+
export declare const PaginationBar: import("styled-components").StyledComponent<"nav", any, {
|
|
3
|
+
'aria-label': string;
|
|
4
|
+
} & {
|
|
5
|
+
'aria-label': string;
|
|
6
|
+
}, "aria-label">;
|
|
7
|
+
export declare const InfoLabel: import("styled-components").StyledComponent<({ renderer, ...restProps }: import("@redislabsdev/redis-ui-components").PaginationInfoLabelProps) => import("react/jsx-runtime").JSX.Element, any, {}, never>;
|
|
8
|
+
export declare const PageSizeSelect: import("styled-components").StyledComponent<{
|
|
9
|
+
({ pageSizes, ...restProps }: import("@redislabsdev/redis-ui-components").PaginationPageSizeSelectProps): import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
Label: ({ children, ...restProps }: import("@redislabsdev/redis-ui-components").TypographyBodyProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
37
11
|
}, any, {}, never>;
|
|
38
|
-
export declare const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
export declare const
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
export declare const PageLabelText: import("styled-components").StyledComponent<({ size, variant, color, component, ellipsis, ...restProps }: import("@redislabsdev/redis-ui-components/dist/Typography/components/Body/Body.types").BodyProps) => import("react/jsx-runtime").JSX.Element, any, {
|
|
46
|
-
size: "S";
|
|
47
|
-
}, "size">;
|
|
48
|
-
export declare const Label: import("styled-components").StyledComponent<"label", any, {}, never>;
|
|
49
|
-
export declare const TotalPagesText: import("styled-components").StyledComponent<({ size, variant, color, component, ellipsis, ...restProps }: import("@redislabsdev/redis-ui-components/dist/Typography/components/Body/Body.types").BodyProps) => import("react/jsx-runtime").JSX.Element, any, {
|
|
50
|
-
size: "S";
|
|
51
|
-
}, "size">;
|
|
12
|
+
export declare const PageSelect: import("styled-components").StyledComponent<{
|
|
13
|
+
({ ...restProps }: import("@redislabsdev/redis-ui-components").PaginationPageSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
Label: ({ children, ...restProps }: import("@redislabsdev/redis-ui-components").TypographyBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
}, any, {}, never>;
|
|
16
|
+
export declare const PageSizeGroup: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
17
|
+
export declare const PageNavGroup: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
18
|
+
export declare const PageSelectGroup: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,63 +1,83 @@
|
|
|
1
|
-
import _styled from "styled-components";
|
|
1
|
+
import _styled, { css } from "styled-components";
|
|
2
2
|
import { useTheme } from "@redislabsdev/redis-ui-styles";
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
displayName: "
|
|
3
|
+
import { Pagination } from "@redislabsdev/redis-ui-components";
|
|
4
|
+
const NavigationButton = _styled(Pagination.NavigationButton).withConfig({
|
|
5
|
+
displayName: "TablePaginationstyle__NavigationButton",
|
|
6
6
|
componentId: "RedisUI__sc-ccqfi0-0"
|
|
7
|
-
})(["
|
|
8
|
-
const
|
|
9
|
-
|
|
7
|
+
})(["", ";"], () => {
|
|
8
|
+
const styles = useTheme().components.table.pagination.navButton;
|
|
9
|
+
return css`
|
|
10
|
+
width: ${styles.width};
|
|
11
|
+
height: ${styles.height};
|
|
12
|
+
padding: ${styles.padding};
|
|
13
|
+
color: ${styles.color};
|
|
14
|
+
|
|
15
|
+
&:disabled {
|
|
16
|
+
color: ${styles.disabledColor};
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
});
|
|
20
|
+
const PaginationBar = _styled(Pagination.Bar).attrs(({
|
|
21
|
+
"aria-label": al
|
|
22
|
+
}) => ({
|
|
23
|
+
"aria-label": al ?? "Table Pagination"
|
|
24
|
+
})).withConfig({
|
|
25
|
+
displayName: "TablePaginationstyle__PaginationBar",
|
|
10
26
|
componentId: "RedisUI__sc-ccqfi0-1"
|
|
11
|
-
})(["
|
|
12
|
-
const
|
|
13
|
-
|
|
27
|
+
})(["", " width:100%;overflow:auto hidden;> *{flex:none;}"], () => {
|
|
28
|
+
const styles = useTheme().components.table.pagination.bar;
|
|
29
|
+
return css`
|
|
30
|
+
font-size: ${styles.fontSize};
|
|
31
|
+
gap: ${styles.gap};
|
|
32
|
+
height: ${styles.height};
|
|
33
|
+
padding: ${styles.padding};
|
|
34
|
+
border: solid ${styles.borderColor};
|
|
35
|
+
border-width: ${styles.borderSize};
|
|
36
|
+
color: ${styles.textColor};
|
|
37
|
+
`;
|
|
38
|
+
});
|
|
39
|
+
const InfoLabel = _styled(Pagination.InfoLabel).withConfig({
|
|
40
|
+
displayName: "TablePaginationstyle__InfoLabel",
|
|
14
41
|
componentId: "RedisUI__sc-ccqfi0-2"
|
|
15
|
-
})(["
|
|
16
|
-
const
|
|
17
|
-
|
|
42
|
+
})(["line-height:", ";"], () => useTheme().components.table.pagination.select.height);
|
|
43
|
+
const useSelectStyles = () => {
|
|
44
|
+
const styles = useTheme().components.table.pagination.select;
|
|
45
|
+
return css`
|
|
46
|
+
gap: ${styles.gap};
|
|
47
|
+
height: ${styles.height};
|
|
48
|
+
padding: ${styles.padding};
|
|
49
|
+
color: ${styles.textColor};
|
|
50
|
+
font-size: ${styles.fontSize};
|
|
51
|
+
line-height: initial;
|
|
52
|
+
`;
|
|
53
|
+
};
|
|
54
|
+
const PageSizeSelect = _styled(Pagination.PageSizeSelect).withConfig({
|
|
55
|
+
displayName: "TablePaginationstyle__PageSizeSelect",
|
|
18
56
|
componentId: "RedisUI__sc-ccqfi0-3"
|
|
19
|
-
})(["
|
|
20
|
-
const
|
|
21
|
-
displayName: "
|
|
57
|
+
})(["", ""], useSelectStyles);
|
|
58
|
+
const PageSelect = _styled(Pagination.PageSelect).withConfig({
|
|
59
|
+
displayName: "TablePaginationstyle__PageSelect",
|
|
22
60
|
componentId: "RedisUI__sc-ccqfi0-4"
|
|
23
|
-
})(["
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
}).withConfig({
|
|
27
|
-
displayName: "TablePaginationstyle__ItemPerPageText",
|
|
61
|
+
})(["", ""], useSelectStyles);
|
|
62
|
+
const PageSizeGroup = _styled(Pagination.Group).withConfig({
|
|
63
|
+
displayName: "TablePaginationstyle__PageSizeGroup",
|
|
28
64
|
componentId: "RedisUI__sc-ccqfi0-5"
|
|
29
|
-
})(["
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
}).withConfig({
|
|
33
|
-
displayName: "TablePaginationstyle__PaginationIndexText",
|
|
65
|
+
})(["gap:1rem;"]);
|
|
66
|
+
const PageNavGroup = _styled(Pagination.Group).withConfig({
|
|
67
|
+
displayName: "TablePaginationstyle__PageNavGroup",
|
|
34
68
|
componentId: "RedisUI__sc-ccqfi0-6"
|
|
35
|
-
})(["
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
}).withConfig({
|
|
39
|
-
displayName: "TablePaginationstyle__PageLabelText",
|
|
69
|
+
})(["gap:0.4rem;"]);
|
|
70
|
+
const PageSelectGroup = _styled(Pagination.Group).withConfig({
|
|
71
|
+
displayName: "TablePaginationstyle__PageSelectGroup",
|
|
40
72
|
componentId: "RedisUI__sc-ccqfi0-7"
|
|
41
|
-
})(["
|
|
42
|
-
const Label = _styled.label.withConfig({
|
|
43
|
-
displayName: "TablePaginationstyle__Label",
|
|
44
|
-
componentId: "RedisUI__sc-ccqfi0-8"
|
|
45
|
-
})(["all:unset;"]);
|
|
46
|
-
const TotalPagesText = _styled(Typography.Body).attrs({
|
|
47
|
-
size: "S"
|
|
48
|
-
}).withConfig({
|
|
49
|
-
displayName: "TablePaginationstyle__TotalPagesText",
|
|
50
|
-
componentId: "RedisUI__sc-ccqfi0-9"
|
|
51
|
-
})(["color:", ";flex-shrink:0;"], () => useTheme().components.table.components.tablePagination.totalPagesText.color);
|
|
73
|
+
})(["gap:0.4rem;"]);
|
|
52
74
|
export {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Select,
|
|
62
|
-
TotalPagesText
|
|
75
|
+
InfoLabel,
|
|
76
|
+
NavigationButton,
|
|
77
|
+
PageNavGroup,
|
|
78
|
+
PageSelect,
|
|
79
|
+
PageSelectGroup,
|
|
80
|
+
PageSizeGroup,
|
|
81
|
+
PageSizeSelect,
|
|
82
|
+
PaginationBar
|
|
63
83
|
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("../../../../../node_modules/react/jsx-runtime.cjs");
|
|
4
|
+
const redisUiComponents = require("@redislabsdev/redis-ui-components");
|
|
5
|
+
const React = require("react");
|
|
6
|
+
const Table_context = require("../../../../Table.context.cjs");
|
|
7
|
+
const PaginationPlugin = require("../../../../plugins/PaginationPlugin.cjs");
|
|
8
|
+
const TablePaginationCompose = ({
|
|
9
|
+
children
|
|
10
|
+
}) => {
|
|
11
|
+
const {
|
|
12
|
+
table
|
|
13
|
+
} = Table_context.useTableContext();
|
|
14
|
+
const pagination = PaginationPlugin.usePaginationContext();
|
|
15
|
+
const paginationEnabled = !!pagination;
|
|
16
|
+
const {
|
|
17
|
+
pageIndex,
|
|
18
|
+
pageSize
|
|
19
|
+
} = table.getState().pagination;
|
|
20
|
+
const pageCount = Math.max(table.getPageCount(), 1);
|
|
21
|
+
React.useEffect(() => {
|
|
22
|
+
if (paginationEnabled) {
|
|
23
|
+
const fixedIndex = Math.min(pageIndex, pageCount - 1);
|
|
24
|
+
if (fixedIndex !== pageIndex) table.setPageIndex(fixedIndex);
|
|
25
|
+
}
|
|
26
|
+
}, [pageCount, pageIndex, table, paginationEnabled]);
|
|
27
|
+
if (!paginationEnabled) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return jsxRuntime.jsxRuntimeExports.jsx(redisUiComponents.Pagination.Compose, {
|
|
31
|
+
onPageChange: table.setPageIndex,
|
|
32
|
+
pageIndex,
|
|
33
|
+
pageSize,
|
|
34
|
+
pageCount,
|
|
35
|
+
onPageSizeChange: table.setPageSize,
|
|
36
|
+
totalItemCount: table.getRowCount(),
|
|
37
|
+
visibleItemCount: table.getRowModel().rows.length,
|
|
38
|
+
children
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
exports.TablePaginationCompose = TablePaginationCompose;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { j as jsxRuntimeExports } from "../../../../../node_modules/react/jsx-runtime.js";
|
|
2
|
+
import { Pagination } from "@redislabsdev/redis-ui-components";
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { useTableContext } from "../../../../Table.context.js";
|
|
5
|
+
import { usePaginationContext } from "../../../../plugins/PaginationPlugin.js";
|
|
6
|
+
const TablePaginationCompose = ({
|
|
7
|
+
children
|
|
8
|
+
}) => {
|
|
9
|
+
const {
|
|
10
|
+
table
|
|
11
|
+
} = useTableContext();
|
|
12
|
+
const pagination = usePaginationContext();
|
|
13
|
+
const paginationEnabled = !!pagination;
|
|
14
|
+
const {
|
|
15
|
+
pageIndex,
|
|
16
|
+
pageSize
|
|
17
|
+
} = table.getState().pagination;
|
|
18
|
+
const pageCount = Math.max(table.getPageCount(), 1);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (paginationEnabled) {
|
|
21
|
+
const fixedIndex = Math.min(pageIndex, pageCount - 1);
|
|
22
|
+
if (fixedIndex !== pageIndex) table.setPageIndex(fixedIndex);
|
|
23
|
+
}
|
|
24
|
+
}, [pageCount, pageIndex, table, paginationEnabled]);
|
|
25
|
+
if (!paginationEnabled) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return jsxRuntimeExports.jsx(Pagination.Compose, {
|
|
29
|
+
onPageChange: table.setPageIndex,
|
|
30
|
+
pageIndex,
|
|
31
|
+
pageSize,
|
|
32
|
+
pageCount,
|
|
33
|
+
onPageSizeChange: table.setPageSize,
|
|
34
|
+
totalItemCount: table.getRowCount(),
|
|
35
|
+
visibleItemCount: table.getRowModel().rows.length,
|
|
36
|
+
children
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
TablePaginationCompose
|
|
41
|
+
};
|