@redis-ui/table 2.18.0 → 2.22.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 +28 -4
- package/dist/Table/Table.context.d.ts +1 -0
- package/dist/Table/Table.d.ts +25 -20
- package/dist/Table/Table.js +28 -4
- package/dist/Table/Table.style.cjs +33 -8
- package/dist/Table/Table.style.d.ts +4 -4
- package/dist/Table/Table.style.js +33 -8
- package/dist/Table/Table.types.d.ts +3 -1
- package/dist/Table/components/Compose/Compose.cjs +4 -1
- package/dist/Table/components/Compose/Compose.d.ts +1 -1
- package/dist/Table/components/Compose/Compose.js +4 -1
- package/dist/Table/components/ExpandRowButton/ExpandAllRowsButton.cjs +20 -0
- package/dist/Table/components/ExpandRowButton/ExpandAllRowsButton.d.ts +8 -0
- package/dist/Table/components/ExpandRowButton/ExpandAllRowsButton.js +20 -0
- package/dist/Table/components/ExpandRowButton/ExpandAllRowsButton.test.d.ts +1 -0
- package/dist/Table/components/ExpandRowButton/useExpanderColumn.cjs +19 -0
- package/dist/Table/components/ExpandRowButton/useExpanderColumn.d.ts +6 -0
- package/dist/Table/components/ExpandRowButton/useExpanderColumn.js +19 -0
- package/dist/Table/components/ExpandRowButton/useExpanderColumn.test.d.ts +1 -0
- package/dist/Table/components/PluggableTable/compositionComponents.d.ts +5 -5
- package/dist/Table/components/RowSelection/HeaderMultiRowSelectionButton.cjs +1 -0
- package/dist/Table/components/RowSelection/HeaderMultiRowSelectionButton.d.ts +1 -1
- package/dist/Table/components/RowSelection/HeaderMultiRowSelectionButton.js +1 -0
- package/dist/Table/components/RowSelection/useRowSelectionColumn.cjs +26 -0
- package/dist/Table/components/RowSelection/useRowSelectionColumn.d.ts +8 -0
- package/dist/Table/components/RowSelection/useRowSelectionColumn.js +26 -0
- package/dist/Table/components/RowSelection/useRowSelectionColumn.test.d.ts +1 -0
- package/dist/Table/components/ShowOnRowHover/ShowOnRowHover.style.cjs +3 -1
- package/dist/Table/components/ShowOnRowHover/ShowOnRowHover.style.js +3 -1
- package/dist/Table/components/TableBody/TableBody.d.ts +1 -1
- package/dist/Table/components/TableBody/components/Compose/Compose.cjs +1 -3
- package/dist/Table/components/TableBody/components/Compose/Compose.js +1 -3
- package/dist/Table/components/TableBodyCell/TableBodyCell.cjs +1 -5
- package/dist/Table/components/TableBodyCell/TableBodyCell.d.ts +4 -7
- package/dist/Table/components/TableBodyCell/TableBodyCell.js +1 -5
- package/dist/Table/components/TableBodyCell/components/Compose/Compose.cjs +21 -1
- package/dist/Table/components/TableBodyCell/components/Compose/Compose.d.ts +8 -2
- package/dist/Table/components/TableBodyCell/components/Compose/Compose.js +21 -1
- package/dist/Table/components/TableBodyCell/components/Compose/Compose.test.d.ts +1 -0
- package/dist/Table/components/TableBodyRow/TableBodyRow.cjs +12 -2
- package/dist/Table/components/TableBodyRow/TableBodyRow.d.ts +3 -3
- package/dist/Table/components/TableBodyRow/TableBodyRow.js +12 -2
- package/dist/Table/components/TableBodyRow/components/Compose/Compose.d.ts +2 -1
- package/dist/Table/components/TableHeader/TableHeader.d.ts +2 -2
- package/dist/Table/components/TableHeaderCell/SRSortingNotification.cjs +4 -5
- package/dist/Table/components/TableHeaderCell/SRSortingNotification.d.ts +1 -1
- package/dist/Table/components/TableHeaderCell/SRSortingNotification.js +4 -5
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.cjs +2 -6
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.d.ts +2 -2
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.js +2 -6
- package/dist/Table/components/TableHeaderCell/components/Compose/Compose.cjs +12 -4
- package/dist/Table/components/TableHeaderCell/components/Compose/Compose.js +12 -4
- package/dist/Table/components/TableHeaderCell/components/Compose/Compose.test.d.ts +1 -0
- package/dist/Table/components/TableHeaderCell/components/Heading/Heading.cjs +6 -5
- package/dist/Table/components/TableHeaderCell/components/Heading/Heading.js +7 -6
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/SortableHeading.d.ts +1 -1
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/components/Compose/Compose.cjs +1 -0
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/components/Compose/Compose.js +1 -0
- package/dist/Table/components/TableRoot/TableRoot.cjs +9 -1
- package/dist/Table/components/TableRoot/TableRoot.d.ts +2 -1
- package/dist/Table/components/TableRoot/TableRoot.js +9 -1
- package/dist/Table/plugins/ExpandableRowPlugin.cjs +11 -5
- package/dist/Table/plugins/ExpandableRowPlugin.d.ts +7 -1
- package/dist/Table/plugins/ExpandableRowPlugin.js +11 -5
- package/dist/Table/plugins/RowNavigationPlugin.cjs +139 -0
- package/dist/Table/plugins/RowNavigationPlugin.d.ts +44 -0
- package/dist/Table/plugins/RowNavigationPlugin.js +139 -0
- package/dist/Table/plugins/SortingPlugin.cjs +1 -1
- package/dist/Table/plugins/SortingPlugin.d.ts +1 -1
- package/dist/Table/plugins/SortingPlugin.js +1 -1
- package/dist/Table/tanStackExtendedTypes.d.ts +9 -0
- package/dist/Table/utils/plugin.utils.d.ts +1 -1
- package/dist/Table/utils/table.utils.cjs +13 -0
- package/dist/Table/utils/table.utils.d.ts +2 -0
- package/dist/Table/utils/table.utils.js +13 -0
- package/dist/Table/utils/table.utils.test.d.ts +1 -0
- package/package.json +4 -4
package/dist/Table/Table.cjs
CHANGED
|
@@ -14,6 +14,11 @@ const ClickableRowPlugin = require("./plugins/ClickableRowPlugin.cjs");
|
|
|
14
14
|
const Table_context = require("./Table.context.cjs");
|
|
15
15
|
const PluggableTable = require("./components/PluggableTable/PluggableTable.cjs");
|
|
16
16
|
const compositionComponents = require("./components/PluggableTable/compositionComponents.cjs");
|
|
17
|
+
const RowNavigationPlugin = require("./plugins/RowNavigationPlugin.cjs");
|
|
18
|
+
const ShowOnRowHover_style = require("./components/ShowOnRowHover/ShowOnRowHover.style.cjs");
|
|
19
|
+
const ExpandAllRowsButton = require("./components/ExpandRowButton/ExpandAllRowsButton.cjs");
|
|
20
|
+
const useExpanderColumn = require("./components/ExpandRowButton/useExpanderColumn.cjs");
|
|
21
|
+
const useRowSelectionColumn = require("./components/RowSelection/useRowSelectionColumn.cjs");
|
|
17
22
|
const Table = Object.assign(({
|
|
18
23
|
columns,
|
|
19
24
|
caption,
|
|
@@ -22,6 +27,7 @@ const Table = Object.assign(({
|
|
|
22
27
|
getRowId,
|
|
23
28
|
emptyState,
|
|
24
29
|
maxHeight,
|
|
30
|
+
minWidth,
|
|
25
31
|
stripedRows = false,
|
|
26
32
|
// sorting
|
|
27
33
|
enableSorting,
|
|
@@ -30,10 +36,12 @@ const Table = Object.assign(({
|
|
|
30
36
|
sorting,
|
|
31
37
|
manualSorting,
|
|
32
38
|
// row expansion
|
|
39
|
+
defaultExpanded,
|
|
33
40
|
getIsRowExpandable,
|
|
34
41
|
renderExpandedRow,
|
|
35
42
|
expandRowOnClick,
|
|
36
43
|
expandedRowComponent,
|
|
44
|
+
getSubRows,
|
|
37
45
|
// pagination
|
|
38
46
|
pagination,
|
|
39
47
|
defaultPagination,
|
|
@@ -47,7 +55,9 @@ const Table = Object.assign(({
|
|
|
47
55
|
defaultRowSelection,
|
|
48
56
|
onRowSelectionChange,
|
|
49
57
|
rowSelectionMode,
|
|
50
|
-
getRowCanSelect
|
|
58
|
+
getRowCanSelect,
|
|
59
|
+
// row navigation
|
|
60
|
+
enableRowNavigation = false
|
|
51
61
|
}) => {
|
|
52
62
|
const clickableRowPluginData = ClickableRowPlugin.useClickableRowPlugin({
|
|
53
63
|
onRowClick: onRowClick && ((row) => onRowClick(row.original)),
|
|
@@ -70,10 +80,15 @@ const Table = Object.assign(({
|
|
|
70
80
|
paginationEnabled
|
|
71
81
|
});
|
|
72
82
|
const expandableRowPluginData = ExpandableRowPlugin.useExpandableRowPlugin({
|
|
83
|
+
defaultExpanded,
|
|
73
84
|
expandRowOnClick,
|
|
74
|
-
getRowCanExpand: getIsRowExpandable && ((row) =>
|
|
85
|
+
getRowCanExpand: getIsRowExpandable && ((row) => {
|
|
86
|
+
var _a;
|
|
87
|
+
return getIsRowExpandable(row.original) && (!getSubRows || !!((_a = getSubRows(row.original, row.index)) == null ? void 0 : _a.length));
|
|
88
|
+
}),
|
|
75
89
|
renderExpandedRow,
|
|
76
|
-
expandedRowComponent
|
|
90
|
+
expandedRowComponent,
|
|
91
|
+
getSubRows
|
|
77
92
|
});
|
|
78
93
|
const rowSelectionPluginData = RowSelectionPlugin.useRowSelectionPlugin({
|
|
79
94
|
rowSelection,
|
|
@@ -82,11 +97,15 @@ const Table = Object.assign(({
|
|
|
82
97
|
rowSelectionMode,
|
|
83
98
|
getRowCanSelect
|
|
84
99
|
});
|
|
100
|
+
const rowNavigationPluginData = RowNavigationPlugin.useRowNavigationPlugin({
|
|
101
|
+
enableRowNavigation
|
|
102
|
+
});
|
|
85
103
|
return jsxRuntime.jsxRuntimeExports.jsx(Table.PluggableTable, {
|
|
86
104
|
...{
|
|
87
105
|
data,
|
|
88
106
|
columns,
|
|
89
107
|
maxHeight,
|
|
108
|
+
minWidth,
|
|
90
109
|
stripedRows,
|
|
91
110
|
caption,
|
|
92
111
|
emptyStateRender: emptyState
|
|
@@ -94,20 +113,25 @@ const Table = Object.assign(({
|
|
|
94
113
|
tableOptions: {
|
|
95
114
|
getRowId
|
|
96
115
|
},
|
|
97
|
-
pluginsData: [clickableRowPluginData, sortingPluginData, paginationPluginData, expandableRowPluginData, rowSelectionPluginData]
|
|
116
|
+
pluginsData: [clickableRowPluginData, sortingPluginData, paginationPluginData, expandableRowPluginData, rowSelectionPluginData, rowNavigationPluginData]
|
|
98
117
|
});
|
|
99
118
|
}, {
|
|
100
119
|
ExpandRowButton: ExpandRowButton.ExpandRowButton,
|
|
120
|
+
ExpandAllRowsButton: ExpandAllRowsButton.ExpandAllRowsButton,
|
|
121
|
+
useExpanderColumn: useExpanderColumn.useExpanderColumn,
|
|
101
122
|
ExpandedRow: TableExpandedRow.TableExpandedRow,
|
|
102
123
|
AnimatedExpandedRow: TableAnimatedExpandedRow.TableAnimatedExpandedRow,
|
|
103
124
|
RowSelectionButton: RowSelectionButton.RowSelectionButton,
|
|
104
125
|
HeaderMultiRowSelectionButton: HeaderMultiRowSelectionButton.HeaderMultiRowSelectionButton,
|
|
126
|
+
useRowSelectionColumn: useRowSelectionColumn.useRowSelectionColumn,
|
|
127
|
+
ShowOnActiveRow: ShowOnRowHover_style.ShowOnRowHover,
|
|
105
128
|
// plugins
|
|
106
129
|
useClickableRowPlugin: ClickableRowPlugin.useClickableRowPlugin,
|
|
107
130
|
useSortingPlugin: SortingPlugin.useSortingPlugin,
|
|
108
131
|
usePaginationPlugin: PaginationPlugin.usePaginationPlugin,
|
|
109
132
|
useExpandableRowPlugin: ExpandableRowPlugin.useExpandableRowPlugin,
|
|
110
133
|
useRowSelectionPlugin: RowSelectionPlugin.useRowSelectionPlugin,
|
|
134
|
+
useRowNavigationPlugin: RowNavigationPlugin.useRowNavigationPlugin,
|
|
111
135
|
// contexts
|
|
112
136
|
useTableContext: Table_context.useTableContext,
|
|
113
137
|
useComposeContext: Table_context.useComposeContext,
|
|
@@ -13,6 +13,7 @@ export type CompositionContextProps<T extends object> = {
|
|
|
13
13
|
export type TableMainContextProps = {
|
|
14
14
|
stripedRows?: boolean;
|
|
15
15
|
maxHeight?: string;
|
|
16
|
+
minWidth?: string;
|
|
16
17
|
};
|
|
17
18
|
export type TableContextProps<T extends object> = TableMainContextProps & {
|
|
18
19
|
table: Table<T>;
|
package/dist/Table/Table.d.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import './tanStackExtendedTypes';
|
|
3
3
|
import type { Row } from '@tanstack/react-table';
|
|
4
4
|
import { TableProps } from './Table.types';
|
|
5
|
-
declare const Table: (<T extends object>({ columns, caption, onRowClick, data, getRowId, emptyState, maxHeight, stripedRows, enableSorting, defaultSorting, onSortingChange, sorting, manualSorting, getIsRowExpandable, renderExpandedRow, expandRowOnClick, expandedRowComponent, pagination, defaultPagination, onPaginationChange, manualPagination, totalRowCount, pageSizes, paginationEnabled, rowSelection, defaultRowSelection, onRowSelectionChange, rowSelectionMode, getRowCanSelect }: TableProps<T>) => import("react/jsx-runtime").JSX.Element) & {
|
|
6
|
-
Compose: <T_1 extends object>({ data, columns, pluginsData, tableOptions, components, maxHeight, stripedRows, ...restProps }: import("./components/Compose/Compose").TableComposeProps<T_1>) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
Root: import("
|
|
5
|
+
declare const Table: (<T extends object>({ columns, caption, onRowClick, data, getRowId, emptyState, maxHeight, minWidth, stripedRows, enableSorting, defaultSorting, onSortingChange, sorting, manualSorting, defaultExpanded, getIsRowExpandable, renderExpandedRow, expandRowOnClick, expandedRowComponent, getSubRows, pagination, defaultPagination, onPaginationChange, manualPagination, totalRowCount, pageSizes, paginationEnabled, rowSelection, defaultRowSelection, onRowSelectionChange, rowSelectionMode, getRowCanSelect, enableRowNavigation }: TableProps<T>) => import("react/jsx-runtime").JSX.Element) & {
|
|
6
|
+
Compose: <T_1 extends object>({ data, columns, pluginsData, tableOptions, components, maxHeight, minWidth, stripedRows, ...restProps }: import("./components/Compose/Compose").TableComposeProps<T_1>) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
Root: (props: import("react").HTMLAttributes<HTMLTableElement>) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
SRCaption: ({ caption }: {
|
|
9
9
|
caption?: string | undefined;
|
|
10
10
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -15,8 +15,8 @@ declare const Table: (<T extends object>({ columns, caption, onRowClick, data, g
|
|
|
15
15
|
};
|
|
16
16
|
Cell: (<T_4 extends object>(props: import("./components/TableHeaderCell/TableHeaderCell").OwnTableHeaderCellProps<T_4> & import("./components/TableHeaderCell/TableHeaderCell").RestTableHeaderCellProps & import("react").RefAttributes<HTMLTableCellElement>) => import("react").ReactElement<any, any> | null) & {
|
|
17
17
|
Compose: <T_5 extends object>(props: import("./components/TableHeaderCell/components/Compose/Compose").OwnTableHeaderCellComposeProps<T_5> & import("@redislabsdev/redis-ui-components").ComposeChildrenProps & Omit<import("react").HTMLAttributes<HTMLTableCellElement>, "content" | "children"> & import("react").RefAttributes<HTMLTableCellElement>) => import("react").ReactElement<any, any> | null;
|
|
18
|
-
SortableHeading: (({ children, ...restProps }: import("@redislabsdev/redis-ui-components").ComposeElementProps<
|
|
19
|
-
Compose: ((props: import("@redislabsdev/redis-ui-components").ComposeElementProps<
|
|
18
|
+
SortableHeading: (({ children, ...restProps }: import("@redislabsdev/redis-ui-components").ComposeElementProps<HTMLElement>) => import("react/jsx-runtime").JSX.Element) & {
|
|
19
|
+
Compose: ((props: import("@redislabsdev/redis-ui-components").ComposeElementProps<HTMLElement>) => import("react/jsx-runtime").JSX.Element) & {
|
|
20
20
|
SortIndicator: () => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
21
21
|
};
|
|
22
22
|
SortIndicator: () => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -40,7 +40,7 @@ declare const Table: (<T extends object>({ columns, caption, onRowClick, data, g
|
|
|
40
40
|
};
|
|
41
41
|
ExpandableRow: <T_9 extends object>(props: import("./components/TableBodyRow/TableBodyRow").OwnTableBodyRowProps<T_9> & import("./components/TableBodyRow/TableBodyRow").RestTableBodyRowProps & import("react").RefAttributes<HTMLTableRowElement>) => import("react").ReactElement<any, any> | null;
|
|
42
42
|
Cell: (<T_10 extends object>(props: import("./components/TableBodyCell/TableBodyCell").OwnTableBodyCellProps<T_10> & import("./components/TableBodyCell/TableBodyCell").RestTableBodyCellProps & import("react").RefAttributes<HTMLTableCellElement>) => import("react").ReactElement<any, any> | null) & {
|
|
43
|
-
Compose: import("
|
|
43
|
+
Compose: <T_11 extends object>(props: import("@redislabsdev/redis-ui-components").ComposeChildrenProps & Omit<import("react").HTMLAttributes<HTMLTableCellElement>, "content" | "children"> & import("./components/TableBodyCell/components/Compose/Compose").OwnTableBodyCellComposeProps<T_11> & import("react").RefAttributes<HTMLTableCellElement>) => import("react").ReactElement<any, any> | null;
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
46
|
Pagination: (() => import("react/jsx-runtime").JSX.Element | null) & {
|
|
@@ -67,21 +67,26 @@ declare const Table: (<T extends object>({ columns, caption, onRowClick, data, g
|
|
|
67
67
|
};
|
|
68
68
|
SRSortingNotification: typeof import("./components/TableHeaderCell/SRSortingNotification").SRSortingNotification;
|
|
69
69
|
ExpandRowButton: ({ row, expandedIcon, collapsedIcon, ...restProps }: import("./components/ExpandRowButton/ExpandRowButton").ExpandRowButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
70
|
+
ExpandAllRowsButton: ({ table, expandedIcon, collapsedIcon, ...restProps }: import("./components/ExpandRowButton/ExpandAllRowsButton").ExpandAllRowsButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
71
|
+
useExpanderColumn: <T_12 extends object>({ allowExpandAll, ...colDef }?: import("./components/ExpandRowButton/useExpanderColumn").UseExpanderColumnParams<T_12>) => import("@tanstack/react-table").ColumnDef<T_12, unknown>;
|
|
72
|
+
ExpandedRow: <T_13 extends object>({ row, keepInDom, rowRef, ...restProps }: import("./components/TableExpandedRow").TableExpandedRowProps<T_13>) => import("react/jsx-runtime").JSX.Element | null;
|
|
73
|
+
AnimatedExpandedRow: <T_14 extends object>({ rowRef, ...restProps }: import("./components/TableExpandedRow").TableExpandedRowProps<T_14>) => import("react/jsx-runtime").JSX.Element;
|
|
74
|
+
RowSelectionButton: <T_15 extends object>({ row, ...restProps }: import("./components/RowSelection/RowSelectionButton").RowSelectionButtonProps<T_15>) => import("react/jsx-runtime").JSX.Element;
|
|
75
|
+
HeaderMultiRowSelectionButton: <T_16 extends object>({ table, managePage, ...restProps }: import("./components/RowSelection/HeaderMultiRowSelectionButton").HeaderMultiRowSelectionButtonProps<T_16>) => import("react/jsx-runtime").JSX.Element | null;
|
|
76
|
+
useRowSelectionColumn: <T_17 extends object>({ disableSelectAll, managePage, ...colDef }?: import("./components/RowSelection/useRowSelectionColumn").UseRowSelectionColumnParams<T_17>) => import("@tanstack/react-table").ColumnDef<T_17, unknown>;
|
|
77
|
+
ShowOnActiveRow: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
78
|
+
useClickableRowPlugin: <T_18 extends object>({ getCanRowClick, onRowClick, shouldClickOnEnter }: Partial<import("./plugins/ClickableRowPlugin").TableClickableRowContext<T_18>>) => import(".").TablePluginData<T_18>;
|
|
79
|
+
useSortingPlugin: <T_19 extends object>({ defaultSorting, onSortingChange, sorting, manualSorting, enableSorting }?: import("./plugins/SortingPlugin").TableSortingParams) => import(".").TablePluginData<T_19>;
|
|
80
|
+
usePaginationPlugin: <T_20 extends object>({ pagination, defaultPagination, onPaginationChange, manualPagination, totalRowCount, pageSizes, paginationEnabled }: import("./plugins/PaginationPlugin").TablePaginationParams) => import(".").TablePluginData<T_20>;
|
|
81
|
+
useExpandableRowPlugin: <T_21 extends object>({ defaultExpanded, getRowCanExpand, renderExpandedRow, expandRowOnClick, expandedRowComponent, getSubRows }: import("./plugins/ExpandableRowPlugin").TableExpandableRowParams<T_21>) => import(".").TablePluginData<T_21>;
|
|
82
|
+
useRowSelectionPlugin: <T_22 extends object>({ rowSelection, defaultRowSelection, onRowSelectionChange, rowSelectionMode, getRowCanSelect }: import("./plugins/RowSelectionPlugin").TableRowSelectionParams<T_22>) => import(".").TablePluginData<T_22>;
|
|
83
|
+
useRowNavigationPlugin: <T_23 extends object>({ enableRowNavigation }: import("./plugins/RowNavigationPlugin").TableRowNavigationParams) => import(".").TablePluginData<T_23>;
|
|
84
|
+
useTableContext: <T_24 extends object = object>() => import("./Table.context").TableContextProps<T_24>;
|
|
85
|
+
useComposeContext: <T_25 extends object, C extends import("./Table.context").CompositionContextProps<T_25> = import("./Table.context").CompositionContextProps<T_25>>(defaults: Partial<C>) => C;
|
|
86
|
+
useClickableRowContext: <T_26 extends object>() => import("./plugins/ClickableRowPlugin").TableClickableRowContext<T_26> | undefined;
|
|
87
|
+
useExpandableRowContext: <T_27 extends object>() => import("./plugins/ExpandableRowPlugin").TableExpandableRowContext<T_27> | undefined;
|
|
83
88
|
usePaginationContext: () => import("./plugins/PaginationPlugin").TablePaginationContext | undefined;
|
|
84
89
|
useSortingContext: () => import("./plugins/SortingPlugin").TableSortingContext | undefined;
|
|
85
|
-
PluggableTable: <
|
|
90
|
+
PluggableTable: <T_28 extends object>({ caption, emptyStateRender, ...restProps }: import("./components/PluggableTable/PluggableTable").PluggableTableProps<T_28>) => import("react/jsx-runtime").JSX.Element;
|
|
86
91
|
};
|
|
87
92
|
export default Table;
|
package/dist/Table/Table.js
CHANGED
|
@@ -12,6 +12,11 @@ import { useClickableRowPlugin, useClickableRowContext } from "./plugins/Clickab
|
|
|
12
12
|
import { useTableContext, useComposeContext } from "./Table.context.js";
|
|
13
13
|
import { PluggableTable } from "./components/PluggableTable/PluggableTable.js";
|
|
14
14
|
import { compositionComponents } from "./components/PluggableTable/compositionComponents.js";
|
|
15
|
+
import { useRowNavigationPlugin } from "./plugins/RowNavigationPlugin.js";
|
|
16
|
+
import { ShowOnRowHover } from "./components/ShowOnRowHover/ShowOnRowHover.style.js";
|
|
17
|
+
import { ExpandAllRowsButton } from "./components/ExpandRowButton/ExpandAllRowsButton.js";
|
|
18
|
+
import { useExpanderColumn } from "./components/ExpandRowButton/useExpanderColumn.js";
|
|
19
|
+
import { useRowSelectionColumn } from "./components/RowSelection/useRowSelectionColumn.js";
|
|
15
20
|
const Table = Object.assign(({
|
|
16
21
|
columns,
|
|
17
22
|
caption,
|
|
@@ -20,6 +25,7 @@ const Table = Object.assign(({
|
|
|
20
25
|
getRowId,
|
|
21
26
|
emptyState,
|
|
22
27
|
maxHeight,
|
|
28
|
+
minWidth,
|
|
23
29
|
stripedRows = false,
|
|
24
30
|
// sorting
|
|
25
31
|
enableSorting,
|
|
@@ -28,10 +34,12 @@ const Table = Object.assign(({
|
|
|
28
34
|
sorting,
|
|
29
35
|
manualSorting,
|
|
30
36
|
// row expansion
|
|
37
|
+
defaultExpanded,
|
|
31
38
|
getIsRowExpandable,
|
|
32
39
|
renderExpandedRow,
|
|
33
40
|
expandRowOnClick,
|
|
34
41
|
expandedRowComponent,
|
|
42
|
+
getSubRows,
|
|
35
43
|
// pagination
|
|
36
44
|
pagination,
|
|
37
45
|
defaultPagination,
|
|
@@ -45,7 +53,9 @@ const Table = Object.assign(({
|
|
|
45
53
|
defaultRowSelection,
|
|
46
54
|
onRowSelectionChange,
|
|
47
55
|
rowSelectionMode,
|
|
48
|
-
getRowCanSelect
|
|
56
|
+
getRowCanSelect,
|
|
57
|
+
// row navigation
|
|
58
|
+
enableRowNavigation = false
|
|
49
59
|
}) => {
|
|
50
60
|
const clickableRowPluginData = useClickableRowPlugin({
|
|
51
61
|
onRowClick: onRowClick && ((row) => onRowClick(row.original)),
|
|
@@ -68,10 +78,15 @@ const Table = Object.assign(({
|
|
|
68
78
|
paginationEnabled
|
|
69
79
|
});
|
|
70
80
|
const expandableRowPluginData = useExpandableRowPlugin({
|
|
81
|
+
defaultExpanded,
|
|
71
82
|
expandRowOnClick,
|
|
72
|
-
getRowCanExpand: getIsRowExpandable && ((row) =>
|
|
83
|
+
getRowCanExpand: getIsRowExpandable && ((row) => {
|
|
84
|
+
var _a;
|
|
85
|
+
return getIsRowExpandable(row.original) && (!getSubRows || !!((_a = getSubRows(row.original, row.index)) == null ? void 0 : _a.length));
|
|
86
|
+
}),
|
|
73
87
|
renderExpandedRow,
|
|
74
|
-
expandedRowComponent
|
|
88
|
+
expandedRowComponent,
|
|
89
|
+
getSubRows
|
|
75
90
|
});
|
|
76
91
|
const rowSelectionPluginData = useRowSelectionPlugin({
|
|
77
92
|
rowSelection,
|
|
@@ -80,11 +95,15 @@ const Table = Object.assign(({
|
|
|
80
95
|
rowSelectionMode,
|
|
81
96
|
getRowCanSelect
|
|
82
97
|
});
|
|
98
|
+
const rowNavigationPluginData = useRowNavigationPlugin({
|
|
99
|
+
enableRowNavigation
|
|
100
|
+
});
|
|
83
101
|
return jsxRuntimeExports.jsx(Table.PluggableTable, {
|
|
84
102
|
...{
|
|
85
103
|
data,
|
|
86
104
|
columns,
|
|
87
105
|
maxHeight,
|
|
106
|
+
minWidth,
|
|
88
107
|
stripedRows,
|
|
89
108
|
caption,
|
|
90
109
|
emptyStateRender: emptyState
|
|
@@ -92,20 +111,25 @@ const Table = Object.assign(({
|
|
|
92
111
|
tableOptions: {
|
|
93
112
|
getRowId
|
|
94
113
|
},
|
|
95
|
-
pluginsData: [clickableRowPluginData, sortingPluginData, paginationPluginData, expandableRowPluginData, rowSelectionPluginData]
|
|
114
|
+
pluginsData: [clickableRowPluginData, sortingPluginData, paginationPluginData, expandableRowPluginData, rowSelectionPluginData, rowNavigationPluginData]
|
|
96
115
|
});
|
|
97
116
|
}, {
|
|
98
117
|
ExpandRowButton,
|
|
118
|
+
ExpandAllRowsButton,
|
|
119
|
+
useExpanderColumn,
|
|
99
120
|
ExpandedRow: TableExpandedRow,
|
|
100
121
|
AnimatedExpandedRow: TableAnimatedExpandedRow,
|
|
101
122
|
RowSelectionButton,
|
|
102
123
|
HeaderMultiRowSelectionButton,
|
|
124
|
+
useRowSelectionColumn,
|
|
125
|
+
ShowOnActiveRow: ShowOnRowHover,
|
|
103
126
|
// plugins
|
|
104
127
|
useClickableRowPlugin,
|
|
105
128
|
useSortingPlugin,
|
|
106
129
|
usePaginationPlugin,
|
|
107
130
|
useExpandableRowPlugin,
|
|
108
131
|
useRowSelectionPlugin,
|
|
132
|
+
useRowNavigationPlugin,
|
|
109
133
|
// contexts
|
|
110
134
|
useTableContext,
|
|
111
135
|
useComposeContext,
|
|
@@ -4,6 +4,7 @@ const _styled = require("styled-components");
|
|
|
4
4
|
const redisUiStyles = require("@redislabsdev/redis-ui-styles");
|
|
5
5
|
const redisUiComponents = require("@redislabsdev/redis-ui-components");
|
|
6
6
|
const ShowOnRowHover_style = require("./components/ShowOnRowHover/ShowOnRowHover.style.cjs");
|
|
7
|
+
const Table_context = require("./Table.context.cjs");
|
|
7
8
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
8
9
|
const _styled__default = /* @__PURE__ */ _interopDefault(_styled);
|
|
9
10
|
const TableContainer = _styled__default.default.div.withConfig({
|
|
@@ -13,11 +14,25 @@ const TableContainer = _styled__default.default.div.withConfig({
|
|
|
13
14
|
const Table = _styled__default.default.table.withConfig({
|
|
14
15
|
displayName: "Tablestyle__Table",
|
|
15
16
|
componentId: "RedisUI__sc-o0xfty-1"
|
|
16
|
-
})(["width:100%;border-collapse:collapse;border-spacing:0;overflow-x:auto;display:block;table-layout:fixed;"])
|
|
17
|
+
})(["width:100%;border-collapse:collapse;border-spacing:0;overflow-x:auto;display:block;table-layout:fixed;", ""], () => {
|
|
18
|
+
const {
|
|
19
|
+
table
|
|
20
|
+
} = Table_context.useTableContext();
|
|
21
|
+
return _styled.css`
|
|
22
|
+
overflow-x: ${table.getRowModel().rows.length ? "auto" : "hidden"};
|
|
23
|
+
`;
|
|
24
|
+
});
|
|
17
25
|
const TableHead = _styled__default.default.thead.withConfig({
|
|
18
26
|
displayName: "Tablestyle__TableHead",
|
|
19
27
|
componentId: "RedisUI__sc-o0xfty-2"
|
|
20
|
-
})(["display:table;table-layout:fixed;"])
|
|
28
|
+
})(["display:table;table-layout:fixed;", ""], () => {
|
|
29
|
+
const {
|
|
30
|
+
minWidth
|
|
31
|
+
} = Table_context.useTableContext();
|
|
32
|
+
return _styled.css`
|
|
33
|
+
min-width: ${minWidth || void 0};
|
|
34
|
+
`;
|
|
35
|
+
});
|
|
21
36
|
const TableHeaderRow = _styled__default.default.tr.withConfig({
|
|
22
37
|
displayName: "Tablestyle__TableHeaderRow",
|
|
23
38
|
componentId: "RedisUI__sc-o0xfty-3"
|
|
@@ -25,7 +40,9 @@ const TableHeaderRow = _styled__default.default.tr.withConfig({
|
|
|
25
40
|
const SortableHeadingCompose = _styled__default.default.button.withConfig({
|
|
26
41
|
displayName: "Tablestyle__SortableHeadingCompose",
|
|
27
42
|
componentId: "RedisUI__sc-o0xfty-4"
|
|
28
|
-
})(["all:unset;border-radius:0.03rem;display:flex;align-items:center;justify-content:flex-start;gap:0.8rem;height:100%;width:100%;min-height:35px;max-width:100%;overflow:
|
|
43
|
+
})(["all:unset;border-radius:0.03rem;display:flex;align-items:center;justify-content:flex-start;gap:0.8rem;height:100%;width:100%;min-height:35px;max-width:100%;overflow:", ";", " svg{flex:none;}"], ({
|
|
44
|
+
$custom
|
|
45
|
+
}) => $custom ? void 0 : "hidden", redisUiStyles.getFocusStyle("0.6rem"));
|
|
29
46
|
const HeaderTitleWrapper = _styled__default.default(redisUiComponents.Typography.Body).withConfig({
|
|
30
47
|
displayName: "Tablestyle__HeaderTitleWrapper",
|
|
31
48
|
componentId: "RedisUI__sc-o0xfty-5"
|
|
@@ -39,17 +56,25 @@ const HeaderTitleWrapper = _styled__default.default(redisUiComponents.Typography
|
|
|
39
56
|
const TableTh = _styled__default.default.th.withConfig({
|
|
40
57
|
displayName: "Tablestyle__TableTh",
|
|
41
58
|
componentId: "RedisUI__sc-o0xfty-6"
|
|
42
|
-
})(["padding:1.05rem 1.2rem;color:", ";user-select:none;white-space:nowrap;word-break:break-word;line-height:normal;position:relative;&:not(:last-child)::after{content:'';position:absolute;inset:1.05rem 0 1.05rem auto;border-right:1px solid ", ";}"], () => redisUiStyles.useTheme().components.table.table.tableTh.color, () => redisUiStyles.useTheme().components.table.table.tableTh.borderRight);
|
|
59
|
+
})(["padding:1.05rem 1.2rem;color:", ";user-select:none;white-space:nowrap;word-break:break-word;line-height:normal;position:relative;overflow:hidden;&:not(:last-child)::after{content:'';position:absolute;inset:1.05rem 0 1.05rem auto;border-right:1px solid ", ";}"], () => redisUiStyles.useTheme().components.table.table.tableTh.color, () => redisUiStyles.useTheme().components.table.table.tableTh.borderRight);
|
|
43
60
|
const TableBody = _styled__default.default.tbody.withConfig({
|
|
44
61
|
displayName: "Tablestyle__TableBody",
|
|
45
62
|
componentId: "RedisUI__sc-o0xfty-7"
|
|
46
|
-
})(["
|
|
47
|
-
|
|
48
|
-
|
|
63
|
+
})(["", " overflow-y:auto;overflow-x:hidden;display:inline-block;table-layout:fixed;"], () => {
|
|
64
|
+
const {
|
|
65
|
+
maxHeight,
|
|
66
|
+
minWidth,
|
|
67
|
+
table
|
|
68
|
+
} = Table_context.useTableContext();
|
|
69
|
+
return _styled.css`
|
|
70
|
+
max-height: ${maxHeight};
|
|
71
|
+
min-width: ${table.getRowModel().rows.length && minWidth || void 0};
|
|
72
|
+
`;
|
|
73
|
+
});
|
|
49
74
|
const TableBodyRow = _styled__default.default.tr.withConfig({
|
|
50
75
|
displayName: "Tablestyle__TableBodyRow",
|
|
51
76
|
componentId: "RedisUI__sc-o0xfty-8"
|
|
52
|
-
})(["border-top:1px solid ", ";height:4.8rem;transition:box-shadow 0.2s ease-in-out;position:relative;&:hover,&:focus{cursor:", ";z-index:1;box-shadow:", ";", "{opacity:1;visibility:visible;}}", " display:table;width:100%;table-layout:fixed;"], () => redisUiStyles.useTheme().components.table.table.tableBodyRow.borderTop, ({
|
|
77
|
+
})(["border-top:1px solid ", ";height:4.8rem;transition:box-shadow 0.2s ease-in-out;position:relative;&:hover,&:focus,&:focus-within{cursor:", ";z-index:1;box-shadow:", ";", "{opacity:1;visibility:visible;}}", " display:table;width:100%;table-layout:fixed;"], () => redisUiStyles.useTheme().components.table.table.tableBodyRow.borderTop, ({
|
|
53
78
|
onClick
|
|
54
79
|
}) => onClick ? "pointer" : "default", () => redisUiStyles.useTheme().components.table.table.tableBodyRow.hoverBoxShadow, ShowOnRowHover_style.ShowOnRowHover, ({
|
|
55
80
|
$stripedRows
|
|
@@ -2,14 +2,14 @@ export declare const TableContainer: import("styled-components").StyledComponent
|
|
|
2
2
|
export declare const Table: import("styled-components").StyledComponent<"table", any, {}, never>;
|
|
3
3
|
export declare const TableHead: import("styled-components").StyledComponent<"thead", any, {}, never>;
|
|
4
4
|
export declare const TableHeaderRow: import("styled-components").StyledComponent<"tr", any, {}, never>;
|
|
5
|
-
export declare const SortableHeadingCompose: import("styled-components").StyledComponent<"button", any, {
|
|
5
|
+
export declare const SortableHeadingCompose: import("styled-components").StyledComponent<"button", any, {
|
|
6
|
+
$custom: boolean;
|
|
7
|
+
}, never>;
|
|
6
8
|
export declare const HeaderTitleWrapper: import("styled-components").StyledComponent<({ size, variant, color, component, ellipsis, ...restProps }: import("@redislabsdev/redis-ui-components").TypographyBodyProps) => import("react/jsx-runtime").JSX.Element, any, {
|
|
7
9
|
$isTextual: boolean;
|
|
8
10
|
}, never>;
|
|
9
11
|
export declare const TableTh: import("styled-components").StyledComponent<"th", any, {}, never>;
|
|
10
|
-
export declare const TableBody: import("styled-components").StyledComponent<"tbody", any, {
|
|
11
|
-
maxHeight?: string | undefined;
|
|
12
|
-
}, never>;
|
|
12
|
+
export declare const TableBody: import("styled-components").StyledComponent<"tbody", any, {}, never>;
|
|
13
13
|
export declare const TableBodyRow: import("styled-components").StyledComponent<"tr", any, {
|
|
14
14
|
$stripedRows: boolean;
|
|
15
15
|
}, never>;
|
|
@@ -2,6 +2,7 @@ import _styled, { css } from "styled-components";
|
|
|
2
2
|
import { useTheme, getFocusStyle } from "@redislabsdev/redis-ui-styles";
|
|
3
3
|
import { Typography } from "@redislabsdev/redis-ui-components";
|
|
4
4
|
import { ShowOnRowHover } from "./components/ShowOnRowHover/ShowOnRowHover.style.js";
|
|
5
|
+
import { useTableContext } from "./Table.context.js";
|
|
5
6
|
const TableContainer = _styled.div.withConfig({
|
|
6
7
|
displayName: "Tablestyle__TableContainer",
|
|
7
8
|
componentId: "RedisUI__sc-o0xfty-0"
|
|
@@ -9,11 +10,25 @@ const TableContainer = _styled.div.withConfig({
|
|
|
9
10
|
const Table = _styled.table.withConfig({
|
|
10
11
|
displayName: "Tablestyle__Table",
|
|
11
12
|
componentId: "RedisUI__sc-o0xfty-1"
|
|
12
|
-
})(["width:100%;border-collapse:collapse;border-spacing:0;overflow-x:auto;display:block;table-layout:fixed;"])
|
|
13
|
+
})(["width:100%;border-collapse:collapse;border-spacing:0;overflow-x:auto;display:block;table-layout:fixed;", ""], () => {
|
|
14
|
+
const {
|
|
15
|
+
table
|
|
16
|
+
} = useTableContext();
|
|
17
|
+
return css`
|
|
18
|
+
overflow-x: ${table.getRowModel().rows.length ? "auto" : "hidden"};
|
|
19
|
+
`;
|
|
20
|
+
});
|
|
13
21
|
const TableHead = _styled.thead.withConfig({
|
|
14
22
|
displayName: "Tablestyle__TableHead",
|
|
15
23
|
componentId: "RedisUI__sc-o0xfty-2"
|
|
16
|
-
})(["display:table;table-layout:fixed;"])
|
|
24
|
+
})(["display:table;table-layout:fixed;", ""], () => {
|
|
25
|
+
const {
|
|
26
|
+
minWidth
|
|
27
|
+
} = useTableContext();
|
|
28
|
+
return css`
|
|
29
|
+
min-width: ${minWidth || void 0};
|
|
30
|
+
`;
|
|
31
|
+
});
|
|
17
32
|
const TableHeaderRow = _styled.tr.withConfig({
|
|
18
33
|
displayName: "Tablestyle__TableHeaderRow",
|
|
19
34
|
componentId: "RedisUI__sc-o0xfty-3"
|
|
@@ -21,7 +36,9 @@ const TableHeaderRow = _styled.tr.withConfig({
|
|
|
21
36
|
const SortableHeadingCompose = _styled.button.withConfig({
|
|
22
37
|
displayName: "Tablestyle__SortableHeadingCompose",
|
|
23
38
|
componentId: "RedisUI__sc-o0xfty-4"
|
|
24
|
-
})(["all:unset;border-radius:0.03rem;display:flex;align-items:center;justify-content:flex-start;gap:0.8rem;height:100%;width:100%;min-height:35px;max-width:100%;overflow:
|
|
39
|
+
})(["all:unset;border-radius:0.03rem;display:flex;align-items:center;justify-content:flex-start;gap:0.8rem;height:100%;width:100%;min-height:35px;max-width:100%;overflow:", ";", " svg{flex:none;}"], ({
|
|
40
|
+
$custom
|
|
41
|
+
}) => $custom ? void 0 : "hidden", getFocusStyle("0.6rem"));
|
|
25
42
|
const HeaderTitleWrapper = _styled(Typography.Body).withConfig({
|
|
26
43
|
displayName: "Tablestyle__HeaderTitleWrapper",
|
|
27
44
|
componentId: "RedisUI__sc-o0xfty-5"
|
|
@@ -35,17 +52,25 @@ const HeaderTitleWrapper = _styled(Typography.Body).withConfig({
|
|
|
35
52
|
const TableTh = _styled.th.withConfig({
|
|
36
53
|
displayName: "Tablestyle__TableTh",
|
|
37
54
|
componentId: "RedisUI__sc-o0xfty-6"
|
|
38
|
-
})(["padding:1.05rem 1.2rem;color:", ";user-select:none;white-space:nowrap;word-break:break-word;line-height:normal;position:relative;&:not(:last-child)::after{content:'';position:absolute;inset:1.05rem 0 1.05rem auto;border-right:1px solid ", ";}"], () => useTheme().components.table.table.tableTh.color, () => useTheme().components.table.table.tableTh.borderRight);
|
|
55
|
+
})(["padding:1.05rem 1.2rem;color:", ";user-select:none;white-space:nowrap;word-break:break-word;line-height:normal;position:relative;overflow:hidden;&:not(:last-child)::after{content:'';position:absolute;inset:1.05rem 0 1.05rem auto;border-right:1px solid ", ";}"], () => useTheme().components.table.table.tableTh.color, () => useTheme().components.table.table.tableTh.borderRight);
|
|
39
56
|
const TableBody = _styled.tbody.withConfig({
|
|
40
57
|
displayName: "Tablestyle__TableBody",
|
|
41
58
|
componentId: "RedisUI__sc-o0xfty-7"
|
|
42
|
-
})(["
|
|
43
|
-
|
|
44
|
-
|
|
59
|
+
})(["", " overflow-y:auto;overflow-x:hidden;display:inline-block;table-layout:fixed;"], () => {
|
|
60
|
+
const {
|
|
61
|
+
maxHeight,
|
|
62
|
+
minWidth,
|
|
63
|
+
table
|
|
64
|
+
} = useTableContext();
|
|
65
|
+
return css`
|
|
66
|
+
max-height: ${maxHeight};
|
|
67
|
+
min-width: ${table.getRowModel().rows.length && minWidth || void 0};
|
|
68
|
+
`;
|
|
69
|
+
});
|
|
45
70
|
const TableBodyRow = _styled.tr.withConfig({
|
|
46
71
|
displayName: "Tablestyle__TableBodyRow",
|
|
47
72
|
componentId: "RedisUI__sc-o0xfty-8"
|
|
48
|
-
})(["border-top:1px solid ", ";height:4.8rem;transition:box-shadow 0.2s ease-in-out;position:relative;&:hover,&:focus{cursor:", ";z-index:1;box-shadow:", ";", "{opacity:1;visibility:visible;}}", " display:table;width:100%;table-layout:fixed;"], () => useTheme().components.table.table.tableBodyRow.borderTop, ({
|
|
73
|
+
})(["border-top:1px solid ", ";height:4.8rem;transition:box-shadow 0.2s ease-in-out;position:relative;&:hover,&:focus,&:focus-within{cursor:", ";z-index:1;box-shadow:", ";", "{opacity:1;visibility:visible;}}", " display:table;width:100%;table-layout:fixed;"], () => useTheme().components.table.table.tableBodyRow.borderTop, ({
|
|
49
74
|
onClick
|
|
50
75
|
}) => onClick ? "pointer" : "default", () => useTheme().components.table.table.tableBodyRow.hoverBoxShadow, ShowOnRowHover, ({
|
|
51
76
|
$stripedRows
|
|
@@ -4,6 +4,7 @@ import { TablePaginationParams } from './plugins/PaginationPlugin';
|
|
|
4
4
|
import { TableRowSelectionParams } from './plugins/RowSelectionPlugin';
|
|
5
5
|
import { TableSortingParams } from './plugins/SortingPlugin';
|
|
6
6
|
import { EmptyStateProps } from './components/EmptyState/EmptyState';
|
|
7
|
+
import { TableRowNavigationParams } from './plugins/RowNavigationPlugin';
|
|
7
8
|
export * from '@tanstack/react-table';
|
|
8
9
|
/** @deprecated use ColumnDef */
|
|
9
10
|
export type ColumnDefinition<T extends object> = ColumnDef<T>;
|
|
@@ -18,13 +19,14 @@ export type SortingTypes = SortingState;
|
|
|
18
19
|
type TableExpandableRowProps<T extends object> = Omit<TableExpandableRowParams<T>, 'getRowCanExpand'> & {
|
|
19
20
|
getIsRowExpandable?: (rowData: T) => boolean;
|
|
20
21
|
};
|
|
21
|
-
export interface TableProps<T extends object> extends TableSortingParams, TableExpandableRowProps<T>, TablePaginationParams, TableRowSelectionParams<T
|
|
22
|
+
export interface TableProps<T extends object> extends TableSortingParams, TableExpandableRowProps<T>, TablePaginationParams, TableRowSelectionParams<T>, TableRowNavigationParams {
|
|
22
23
|
data: T[];
|
|
23
24
|
columns: ColumnDef<T>[];
|
|
24
25
|
getRowId?: (rowData: T, index: number) => string;
|
|
25
26
|
onRowClick?: (rowData: T) => void;
|
|
26
27
|
emptyState?: EmptyStateProps['emptyStateRender'];
|
|
27
28
|
maxHeight?: string;
|
|
29
|
+
minWidth?: string;
|
|
28
30
|
stripedRows?: boolean;
|
|
29
31
|
caption?: string;
|
|
30
32
|
}
|
|
@@ -13,6 +13,7 @@ const TableCompose = ({
|
|
|
13
13
|
tableOptions,
|
|
14
14
|
components,
|
|
15
15
|
maxHeight,
|
|
16
|
+
minWidth,
|
|
16
17
|
stripedRows,
|
|
17
18
|
...restProps
|
|
18
19
|
}) => {
|
|
@@ -22,6 +23,7 @@ const TableCompose = ({
|
|
|
22
23
|
columns,
|
|
23
24
|
getCoreRowModel: index$1.getCoreRowModel(),
|
|
24
25
|
enableSorting: false,
|
|
26
|
+
enableColumnResizing: false,
|
|
25
27
|
...tableOptions,
|
|
26
28
|
...mergedPluginsData == null ? void 0 : mergedPluginsData.tableOptions
|
|
27
29
|
});
|
|
@@ -30,7 +32,8 @@ const TableCompose = ({
|
|
|
30
32
|
plugins: mergedPluginsData.context,
|
|
31
33
|
components,
|
|
32
34
|
stripedRows,
|
|
33
|
-
maxHeight
|
|
35
|
+
maxHeight,
|
|
36
|
+
minWidth
|
|
34
37
|
};
|
|
35
38
|
return jsxRuntime.jsxRuntimeExports.jsx(Table_context.TableContextProvider, {
|
|
36
39
|
value: tableContext,
|
|
@@ -10,4 +10,4 @@ export type OwnTableComposeProps<T extends object> = TableMainContextProps & Pic
|
|
|
10
10
|
};
|
|
11
11
|
export type RestTableComposeProps = ComposeElementProps;
|
|
12
12
|
export type TableComposeProps<T extends object> = OwnTableComposeProps<T> & RestTableComposeProps;
|
|
13
|
-
export declare const TableCompose: <T extends object>({ data, columns, pluginsData, tableOptions, components, maxHeight, stripedRows, ...restProps }: TableComposeProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const TableCompose: <T extends object>({ data, columns, pluginsData, tableOptions, components, maxHeight, minWidth, stripedRows, ...restProps }: TableComposeProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,6 +11,7 @@ const TableCompose = ({
|
|
|
11
11
|
tableOptions,
|
|
12
12
|
components,
|
|
13
13
|
maxHeight,
|
|
14
|
+
minWidth,
|
|
14
15
|
stripedRows,
|
|
15
16
|
...restProps
|
|
16
17
|
}) => {
|
|
@@ -20,6 +21,7 @@ const TableCompose = ({
|
|
|
20
21
|
columns,
|
|
21
22
|
getCoreRowModel: getCoreRowModel(),
|
|
22
23
|
enableSorting: false,
|
|
24
|
+
enableColumnResizing: false,
|
|
23
25
|
...tableOptions,
|
|
24
26
|
...mergedPluginsData == null ? void 0 : mergedPluginsData.tableOptions
|
|
25
27
|
});
|
|
@@ -28,7 +30,8 @@ const TableCompose = ({
|
|
|
28
30
|
plugins: mergedPluginsData.context,
|
|
29
31
|
components,
|
|
30
32
|
stripedRows,
|
|
31
|
-
maxHeight
|
|
33
|
+
maxHeight,
|
|
34
|
+
minWidth
|
|
32
35
|
};
|
|
33
36
|
return jsxRuntimeExports.jsx(TableContextProvider, {
|
|
34
37
|
value: tableContext,
|
|
@@ -0,0 +1,20 @@
|
|
|
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 redisUiIcons = require("@redislabsdev/redis-ui-icons");
|
|
6
|
+
const ExpandAllRowsButton = ({
|
|
7
|
+
table,
|
|
8
|
+
expandedIcon,
|
|
9
|
+
collapsedIcon,
|
|
10
|
+
...restProps
|
|
11
|
+
}) => table.getCanSomeRowsExpand() ? jsxRuntime.jsxRuntimeExports.jsx(redisUiComponents.IconButton, {
|
|
12
|
+
...restProps,
|
|
13
|
+
icon: table.getIsAllRowsExpanded() ? expandedIcon ?? redisUiIcons.DoubleChevronUpIcon : collapsedIcon ?? redisUiIcons.DoubleChevronDownIcon,
|
|
14
|
+
"aria-label": table.getIsAllRowsExpanded() ? "Collapse All" : "Expand All",
|
|
15
|
+
onClick: (e) => {
|
|
16
|
+
e.stopPropagation();
|
|
17
|
+
table.toggleAllRowsExpanded();
|
|
18
|
+
}
|
|
19
|
+
}) : null;
|
|
20
|
+
exports.ExpandAllRowsButton = ExpandAllRowsButton;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IconButtonProps } from '@redislabsdev/redis-ui-components';
|
|
2
|
+
import { Table } from '@tanstack/react-table';
|
|
3
|
+
export interface ExpandAllRowsButtonProps extends Omit<IconButtonProps, 'icon' | 'onClick'> {
|
|
4
|
+
table: Table<any>;
|
|
5
|
+
expandedIcon?: IconButtonProps['icon'];
|
|
6
|
+
collapsedIcon?: IconButtonProps['icon'];
|
|
7
|
+
}
|
|
8
|
+
export declare const ExpandAllRowsButton: ({ table, expandedIcon, collapsedIcon, ...restProps }: ExpandAllRowsButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { j as jsxRuntimeExports } from "../../../node_modules/react/jsx-runtime.js";
|
|
2
|
+
import { IconButton } from "@redislabsdev/redis-ui-components";
|
|
3
|
+
import { DoubleChevronUpIcon, DoubleChevronDownIcon } from "@redislabsdev/redis-ui-icons";
|
|
4
|
+
const ExpandAllRowsButton = ({
|
|
5
|
+
table,
|
|
6
|
+
expandedIcon,
|
|
7
|
+
collapsedIcon,
|
|
8
|
+
...restProps
|
|
9
|
+
}) => table.getCanSomeRowsExpand() ? jsxRuntimeExports.jsx(IconButton, {
|
|
10
|
+
...restProps,
|
|
11
|
+
icon: table.getIsAllRowsExpanded() ? expandedIcon ?? DoubleChevronUpIcon : collapsedIcon ?? DoubleChevronDownIcon,
|
|
12
|
+
"aria-label": table.getIsAllRowsExpanded() ? "Collapse All" : "Expand All",
|
|
13
|
+
onClick: (e) => {
|
|
14
|
+
e.stopPropagation();
|
|
15
|
+
table.toggleAllRowsExpanded();
|
|
16
|
+
}
|
|
17
|
+
}) : null;
|
|
18
|
+
export {
|
|
19
|
+
ExpandAllRowsButton
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|