material-react-table 2.0.5 → 2.0.6
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/index.d.ts +2 -1
- package/dist/index.esm.js +585 -528
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +584 -527
- package/dist/index.js.map +1 -1
- package/dist/types/hooks/useMRT_DisplayColumns.d.ts +1 -1
- package/dist/types/locales/he.d.ts +2 -0
- package/dist/types/toolbar/MRT_TablePagination.d.ts +1 -0
- package/package.json +23 -23
- package/src/body/MRT_TableBodyCell.tsx +17 -15
- package/src/body/MRT_TableBodyCellValue.tsx +9 -9
- package/src/body/MRT_TableBodyRow.tsx +13 -13
- package/src/buttons/MRT_RowPinButton.tsx +2 -2
- package/src/buttons/MRT_ToggleDensePaddingButton.tsx +2 -2
- package/src/footer/MRT_TableFooterCell.tsx +2 -2
- package/src/head/MRT_TableHeadCell.tsx +21 -19
- package/src/head/MRT_TableHeadCellResizeHandle.tsx +4 -3
- package/src/hooks/useMRT_DisplayColumns.tsx +172 -125
- package/src/inputs/MRT_FilterCheckbox.tsx +2 -2
- package/src/inputs/MRT_FilterTextField.tsx +16 -16
- package/src/inputs/MRT_SelectCheckbox.tsx +2 -2
- package/src/locales/he.ts +94 -0
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +2 -2
- package/src/style.utils.ts +2 -2
- package/src/toolbar/MRT_TablePagination.tsx +8 -4
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +6 -6
- package/src/types.ts +2 -2
@@ -5,5 +5,5 @@ interface Params<TData extends MRT_RowData> {
|
|
5
5
|
grouping: MRT_GroupingState;
|
6
6
|
tableOptions: MRT_DefinedTableOptions<TData>;
|
7
7
|
}
|
8
|
-
export declare const useMRT_DisplayColumns: <TData extends MRT_RowData>(
|
8
|
+
export declare const useMRT_DisplayColumns: <TData extends MRT_RowData>(params: Params<TData>) => MRT_ColumnDef<TData>[];
|
9
9
|
export {};
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { type PaginationProps } from '@mui/material/Pagination';
|
2
2
|
import { type MRT_RowData, type MRT_TableInstance } from '../types';
|
3
3
|
interface Props<TData extends MRT_RowData> extends Partial<PaginationProps & {
|
4
|
+
disabled?: boolean;
|
4
5
|
rowsPerPageOptions?: {
|
5
6
|
label: string;
|
6
7
|
value: number;
|
package/package.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"version": "2.0.
|
2
|
+
"version": "2.0.6",
|
3
3
|
"license": "MIT",
|
4
4
|
"name": "material-react-table",
|
5
5
|
"description": "A fully featured Material UI V5 implementation of TanStack React Table V8, written from the ground up in TypeScript.",
|
@@ -61,30 +61,30 @@
|
|
61
61
|
"storybook:dev": "storybook dev -p 6006"
|
62
62
|
},
|
63
63
|
"devDependencies": {
|
64
|
-
"@babel/core": "^7.23.
|
64
|
+
"@babel/core": "^7.23.6",
|
65
65
|
"@babel/preset-react": "^7.23.3",
|
66
66
|
"@emotion/react": "^11.11.1",
|
67
67
|
"@emotion/styled": "^11.11.0",
|
68
68
|
"@faker-js/faker": "^8.3.1",
|
69
|
-
"@mui/icons-material": "^5.
|
70
|
-
"@mui/material": "^5.
|
71
|
-
"@mui/x-date-pickers": "^6.18.
|
69
|
+
"@mui/icons-material": "^5.15.0",
|
70
|
+
"@mui/material": "^5.15.0",
|
71
|
+
"@mui/x-date-pickers": "^6.18.4",
|
72
72
|
"@rollup/plugin-typescript": "^11.1.5",
|
73
|
-
"@size-limit/preset-small-lib": "^11.0.
|
74
|
-
"@storybook/addon-a11y": "^7.
|
75
|
-
"@storybook/addon-essentials": "^7.
|
76
|
-
"@storybook/addon-interactions": "^7.
|
77
|
-
"@storybook/addon-links": "^7.
|
78
|
-
"@storybook/addon-storysource": "^7.
|
79
|
-
"@storybook/blocks": "^7.
|
80
|
-
"@storybook/react": "^7.
|
81
|
-
"@storybook/react-vite": "^7.
|
73
|
+
"@size-limit/preset-small-lib": "^11.0.1",
|
74
|
+
"@storybook/addon-a11y": "^7.5.3",
|
75
|
+
"@storybook/addon-essentials": "^7.5.3",
|
76
|
+
"@storybook/addon-interactions": "^7.5.3",
|
77
|
+
"@storybook/addon-links": "^7.5.3",
|
78
|
+
"@storybook/addon-storysource": "^7.5.3",
|
79
|
+
"@storybook/blocks": "^7.5.3",
|
80
|
+
"@storybook/react": "^7.5.3",
|
81
|
+
"@storybook/react-vite": "^7.5.3",
|
82
82
|
"@storybook/testing-library": "^0.2.2",
|
83
|
-
"@types/node": "^20.10.
|
84
|
-
"@types/react": "^18.2.
|
83
|
+
"@types/node": "^20.10.4",
|
84
|
+
"@types/react": "^18.2.45",
|
85
85
|
"@types/react-dom": "^18.2.17",
|
86
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
87
|
-
"@typescript-eslint/parser": "^6.
|
86
|
+
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
87
|
+
"@typescript-eslint/parser": "^6.14.0",
|
88
88
|
"@vitejs/plugin-react": "^4.2.1",
|
89
89
|
"eslint": "^8.55.0",
|
90
90
|
"eslint-plugin-mui-path-imports": "^0.0.15",
|
@@ -96,12 +96,12 @@
|
|
96
96
|
"rollup": "^2.79.1",
|
97
97
|
"rollup-plugin-dts": "^6.1.0",
|
98
98
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
99
|
-
"size-limit": "^11.0.
|
100
|
-
"storybook": "^7.
|
101
|
-
"storybook-dark-mode": "^3.0.
|
99
|
+
"size-limit": "^11.0.1",
|
100
|
+
"storybook": "^7.5.3",
|
101
|
+
"storybook-dark-mode": "^3.0.1",
|
102
102
|
"tslib": "^2.6.2",
|
103
|
-
"typescript": "^5.3.
|
104
|
-
"vite": "^5.0.
|
103
|
+
"typescript": "^5.3.3",
|
104
|
+
"vite": "^5.0.8"
|
105
105
|
},
|
106
106
|
"peerDependencies": {
|
107
107
|
"@emotion/react": ">=11.11",
|
@@ -126,12 +126,12 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
126
126
|
const borderStyle = showResizeBorder
|
127
127
|
? `2px solid ${draggingBorderColor} !important`
|
128
128
|
: isDraggingColumn || isDraggingRow
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
129
|
+
? `1px dashed ${theme.palette.grey[500]} !important`
|
130
|
+
: isHoveredColumn ||
|
131
|
+
isHoveredRow ||
|
132
|
+
columnSizingInfo.isResizingColumn === column.id
|
133
|
+
? `2px dashed ${draggingBorderColor} !important`
|
134
|
+
: undefined;
|
135
135
|
|
136
136
|
if (showResizeBorder) {
|
137
137
|
return { borderRight: borderStyle };
|
@@ -168,6 +168,7 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
168
168
|
]);
|
169
169
|
|
170
170
|
const isEditable =
|
171
|
+
!cell.getIsPlaceholder() &&
|
171
172
|
parseFromValuesOrFunc(enableEditing, row) &&
|
172
173
|
parseFromValuesOrFunc(columnDef.enableEditing, row) !== false;
|
173
174
|
|
@@ -222,7 +223,8 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
222
223
|
sx={(theme) => ({
|
223
224
|
'&:hover': {
|
224
225
|
outline:
|
225
|
-
|
226
|
+
(editDisplayMode === 'cell' && isEditable) ||
|
227
|
+
(editDisplayMode === 'table' && (isCreating || isEditing))
|
226
228
|
? `1px solid ${theme.palette.grey[500]}`
|
227
229
|
: undefined,
|
228
230
|
outlineOffset: '-1px',
|
@@ -241,12 +243,12 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
241
243
|
? '0 0.5rem'
|
242
244
|
: '0.5rem'
|
243
245
|
: density === 'comfortable'
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
246
|
+
? columnDefType === 'display'
|
247
|
+
? '0.5rem 0.75rem'
|
248
|
+
: '1rem'
|
249
|
+
: columnDefType === 'display'
|
250
|
+
? '1rem 1.25rem'
|
251
|
+
: '1.5rem',
|
250
252
|
textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined,
|
251
253
|
[theme.direction === 'rtl' ? 'pr' : 'pl']:
|
252
254
|
column.id === 'mrt-row-expand'
|
@@ -255,8 +257,8 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
255
257
|
(density === 'compact'
|
256
258
|
? 0.5
|
257
259
|
: density === 'comfortable'
|
258
|
-
|
259
|
-
|
260
|
+
? 0.75
|
261
|
+
: 1.25)
|
260
262
|
}rem`
|
261
263
|
: undefined,
|
262
264
|
whiteSpace:
|
@@ -37,15 +37,15 @@ export const MRT_TableBodyCellValue = <TData extends MRT_RowData>({
|
|
37
37
|
table,
|
38
38
|
})
|
39
39
|
: row.getIsGrouped() && !cell.getIsGrouped()
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
40
|
+
? null
|
41
|
+
: cell.getIsGrouped() && columnDef.GroupedCell
|
42
|
+
? columnDef.GroupedCell({
|
43
|
+
cell,
|
44
|
+
column,
|
45
|
+
row,
|
46
|
+
table,
|
47
|
+
})
|
48
|
+
: undefined;
|
49
49
|
|
50
50
|
const isGroupedValue = renderedCellValue !== undefined;
|
51
51
|
|
@@ -153,8 +153,8 @@ export const MRT_TableBodyRow = <TData extends MRT_RowData>({
|
|
153
153
|
? row.getIsSelected()
|
154
154
|
? `${alpha(selectedRowBackgroundColor, 0.3)}`
|
155
155
|
: theme.palette.mode === 'dark'
|
156
|
-
|
157
|
-
|
156
|
+
? `${lighten(baseBackgroundColor, 0.05)}`
|
157
|
+
: `${darken(baseBackgroundColor, 0.05)}`
|
158
158
|
: undefined,
|
159
159
|
},
|
160
160
|
backgroundColor: `${baseBackgroundColor} !important`,
|
@@ -170,28 +170,28 @@ export const MRT_TableBodyRow = <TData extends MRT_RowData>({
|
|
170
170
|
opacity: isPinned
|
171
171
|
? 0.97
|
172
172
|
: draggingRow?.id === row.id || hoveredRow?.id === row.id
|
173
|
-
|
174
|
-
|
173
|
+
? 0.5
|
174
|
+
: 1,
|
175
175
|
position: virtualRow
|
176
176
|
? 'absolute'
|
177
177
|
: rowPinningDisplayMode?.includes('sticky') && isPinned
|
178
|
-
|
179
|
-
|
178
|
+
? 'sticky'
|
179
|
+
: undefined,
|
180
180
|
td: {
|
181
181
|
backgroundColor: row.getIsSelected()
|
182
182
|
? selectedRowBackgroundColor
|
183
183
|
: isPinned
|
184
|
-
|
185
|
-
|
184
|
+
? pinnedRowBackgroundColor
|
185
|
+
: undefined,
|
186
186
|
},
|
187
187
|
top: virtualRow
|
188
188
|
? 0
|
189
189
|
: topPinnedIndex !== undefined && isPinned
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
190
|
+
? `${
|
191
|
+
topPinnedIndex * rowHeight +
|
192
|
+
(enableStickyHeader || isFullScreen ? tableHeadHeight - 1 : 0)
|
193
|
+
}px`
|
194
|
+
: undefined,
|
195
195
|
transition: virtualRow ? 'none' : 'all 150ms ease-in-out',
|
196
196
|
width: '100%',
|
197
197
|
zIndex:
|
@@ -47,8 +47,8 @@ export const MRT_TableFooterCell = <TData extends MRT_RowData>({
|
|
47
47
|
density === 'compact'
|
48
48
|
? '0.5rem'
|
49
49
|
: density === 'comfortable'
|
50
|
-
|
51
|
-
|
50
|
+
? '1rem'
|
51
|
+
: '1.5rem',
|
52
52
|
verticalAlign: 'top',
|
53
53
|
zIndex: column.getIsPinned() && columnDefType !== 'group' ? 2 : 1,
|
54
54
|
...getCommonMRTCellStyles({
|
@@ -97,10 +97,10 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
|
|
97
97
|
const borderStyle = showResizeBorder
|
98
98
|
? `2px solid ${draggingBorderColor} !important`
|
99
99
|
: draggingColumn?.id === column.id
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
100
|
+
? `1px dashed ${theme.palette.grey[500]}`
|
101
|
+
: hoveredColumn?.id === column.id
|
102
|
+
? `2px dashed ${draggingBorderColor}`
|
103
|
+
: undefined;
|
104
104
|
|
105
105
|
if (showResizeBorder) {
|
106
106
|
return { borderRight: borderStyle };
|
@@ -158,32 +158,32 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
|
|
158
158
|
density === 'compact'
|
159
159
|
? '0.5rem'
|
160
160
|
: density === 'comfortable'
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
161
|
+
? columnDefType === 'display'
|
162
|
+
? '0.75rem'
|
163
|
+
: '1rem'
|
164
|
+
: columnDefType === 'display'
|
165
|
+
? '1rem 1.25rem'
|
166
|
+
: '1.5rem',
|
167
167
|
pb:
|
168
168
|
columnDefType === 'display'
|
169
169
|
? 0
|
170
170
|
: showColumnFilters || density === 'compact'
|
171
|
-
|
172
|
-
|
171
|
+
? '0.4rem'
|
172
|
+
: '0.6rem',
|
173
173
|
pt:
|
174
174
|
columnDefType === 'group' || density === 'compact'
|
175
175
|
? '0.25rem'
|
176
176
|
: density === 'comfortable'
|
177
|
-
|
178
|
-
|
177
|
+
? '.75rem'
|
178
|
+
: '1.25rem',
|
179
179
|
userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined,
|
180
180
|
verticalAlign: 'top',
|
181
181
|
zIndex:
|
182
182
|
column.getIsResizing() || draggingColumn?.id === column.id
|
183
183
|
? 3
|
184
184
|
: column.getIsPinned() && columnDefType !== 'group'
|
185
|
-
|
186
|
-
|
185
|
+
? 2
|
186
|
+
: 1,
|
187
187
|
...getCommonMRTCellStyles({
|
188
188
|
column,
|
189
189
|
header,
|
@@ -209,8 +209,8 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
|
|
209
209
|
tableCellProps?.align === 'center'
|
210
210
|
? 'center'
|
211
211
|
: column.getCanResize()
|
212
|
-
|
213
|
-
|
212
|
+
? 'space-between'
|
213
|
+
: 'flex-start',
|
214
214
|
position: 'relative',
|
215
215
|
width: '100%',
|
216
216
|
}}
|
@@ -264,7 +264,9 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
|
|
264
264
|
{columnDefType !== 'group' && (
|
265
265
|
<Box
|
266
266
|
className="Mui-TableHeadCell-Content-Actions"
|
267
|
-
sx={{
|
267
|
+
sx={{
|
268
|
+
whiteSpace: 'nowrap',
|
269
|
+
}}
|
268
270
|
>
|
269
271
|
{showDragHandle && (
|
270
272
|
<MRT_TableHeadCellGrabHandle
|
@@ -52,10 +52,10 @@ export const MRT_TableHeadCellResizeHandle = <TData extends MRT_RowData>({
|
|
52
52
|
cursor: 'col-resize',
|
53
53
|
mr:
|
54
54
|
density === 'compact'
|
55
|
-
? '-
|
55
|
+
? '-8px'
|
56
56
|
: density === 'comfortable'
|
57
|
-
|
58
|
-
|
57
|
+
? '-16px'
|
58
|
+
: '-24px',
|
59
59
|
position: 'absolute',
|
60
60
|
px: '4px',
|
61
61
|
right: column.columnDef.columnDefType === 'display' ? '4px' : '0',
|
@@ -70,6 +70,7 @@ export const MRT_TableHeadCellResizeHandle = <TData extends MRT_RowData>({
|
|
70
70
|
borderWidth: '2px',
|
71
71
|
height: '24px',
|
72
72
|
touchAction: 'none',
|
73
|
+
transform: 'translateX(4px)',
|
73
74
|
transition: column.getIsResizing()
|
74
75
|
? undefined
|
75
76
|
: 'all 150ms ease-in-out',
|