material-react-table 1.0.0-beta.2 → 1.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/MaterialReactTable.d.ts +5 -3
- package/dist/cjs/body/MRT_TableBodyCellValue.d.ts +2 -2
- package/dist/cjs/index.js +14 -14
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/MaterialReactTable.d.ts +5 -3
- package/dist/esm/body/MRT_TableBodyCellValue.d.ts +2 -2
- package/dist/esm/material-react-table.esm.js +15 -15
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +7 -2
- package/src/body/MRT_TableBodyCell.tsx +10 -9
- package/src/body/MRT_TableBodyCellValue.tsx +7 -2
- package/src/head/MRT_TableHeadCell.tsx +3 -3
- package/src/table/MRT_TableRoot.tsx +3 -1
package/dist/index.d.ts
CHANGED
|
@@ -517,7 +517,7 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
|
|
|
517
517
|
muiExpandAllButtonProps?: IconButtonProps | (({ table }: {
|
|
518
518
|
table: MRT_TableInstance<TData>;
|
|
519
519
|
}) => IconButtonProps);
|
|
520
|
-
muiExpandButtonProps?: IconButtonProps | (({ table, }: {
|
|
520
|
+
muiExpandButtonProps?: IconButtonProps | (({ row, table, }: {
|
|
521
521
|
table: MRT_TableInstance<TData>;
|
|
522
522
|
row: MRT_Row<TData>;
|
|
523
523
|
}) => IconButtonProps);
|
|
@@ -553,9 +553,11 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
|
|
|
553
553
|
row: MRT_Row<TData>;
|
|
554
554
|
table: MRT_TableInstance<TData>;
|
|
555
555
|
}) => TableCellProps);
|
|
556
|
-
muiTableBodyCellSkeletonProps?: SkeletonProps | (({
|
|
557
|
-
table: MRT_TableInstance<TData>;
|
|
556
|
+
muiTableBodyCellSkeletonProps?: SkeletonProps | (({ cell, column, row, table, }: {
|
|
558
557
|
cell: MRT_Cell<TData>;
|
|
558
|
+
column: MRT_Column<TData>;
|
|
559
|
+
row: MRT_Row<TData>;
|
|
560
|
+
table: MRT_TableInstance<TData>;
|
|
559
561
|
}) => SkeletonProps);
|
|
560
562
|
muiTableBodyProps?: TableBodyProps | (({ table }: {
|
|
561
563
|
table: MRT_TableInstance<TData>;
|
package/package.json
CHANGED
|
@@ -541,6 +541,7 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
|
|
|
541
541
|
muiExpandButtonProps?:
|
|
542
542
|
| IconButtonProps
|
|
543
543
|
| (({
|
|
544
|
+
row,
|
|
544
545
|
table,
|
|
545
546
|
}: {
|
|
546
547
|
table: MRT_TableInstance<TData>;
|
|
@@ -612,11 +613,15 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
|
|
|
612
613
|
muiTableBodyCellSkeletonProps?:
|
|
613
614
|
| SkeletonProps
|
|
614
615
|
| (({
|
|
615
|
-
table,
|
|
616
616
|
cell,
|
|
617
|
+
column,
|
|
618
|
+
row,
|
|
619
|
+
table,
|
|
617
620
|
}: {
|
|
618
|
-
table: MRT_TableInstance<TData>;
|
|
619
621
|
cell: MRT_Cell<TData>;
|
|
622
|
+
column: MRT_Column<TData>;
|
|
623
|
+
row: MRT_Row<TData>;
|
|
624
|
+
table: MRT_TableInstance<TData>;
|
|
620
625
|
}) => SkeletonProps);
|
|
621
626
|
muiTableBodyProps?:
|
|
622
627
|
| TableBodyProps
|
|
@@ -82,6 +82,11 @@ export const MRT_TableBodyCell: FC<Props> = ({
|
|
|
82
82
|
...mcTableCellBodyProps,
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
+
const skeletonProps =
|
|
86
|
+
muiTableBodyCellSkeletonProps instanceof Function
|
|
87
|
+
? muiTableBodyCellSkeletonProps({ cell, column, row, table })
|
|
88
|
+
: muiTableBodyCellSkeletonProps;
|
|
89
|
+
|
|
85
90
|
const isEditable =
|
|
86
91
|
(enableEditing || columnDef.enableEditing) &&
|
|
87
92
|
columnDef.enableEditing !== false;
|
|
@@ -140,7 +145,7 @@ export const MRT_TableBodyCell: FC<Props> = ({
|
|
|
140
145
|
|
|
141
146
|
const getTotalRight = () => {
|
|
142
147
|
return (
|
|
143
|
-
(table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) *
|
|
148
|
+
(table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 160
|
|
144
149
|
);
|
|
145
150
|
};
|
|
146
151
|
|
|
@@ -189,9 +194,9 @@ export const MRT_TableBodyCell: FC<Props> = ({
|
|
|
189
194
|
? alpha(lighten(theme.palette.background.default, 0.04), 0.95)
|
|
190
195
|
: undefined,
|
|
191
196
|
boxShadow: getIsLastLeftPinnedColumn()
|
|
192
|
-
?
|
|
197
|
+
? `-4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
|
|
193
198
|
: getIsFirstRightPinnedColumn()
|
|
194
|
-
?
|
|
199
|
+
? `4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
|
|
195
200
|
: undefined,
|
|
196
201
|
cursor: isEditable && editingMode === 'cell' ? 'pointer' : 'text',
|
|
197
202
|
left:
|
|
@@ -233,11 +238,7 @@ export const MRT_TableBodyCell: FC<Props> = ({
|
|
|
233
238
|
transition: 'all 0.2s ease-in-out',
|
|
234
239
|
whiteSpace: density === 'compact' ? 'nowrap' : 'normal',
|
|
235
240
|
zIndex:
|
|
236
|
-
draggingColumn?.id === column.id
|
|
237
|
-
? 2
|
|
238
|
-
: column.getIsPinned()
|
|
239
|
-
? 1
|
|
240
|
-
: undefined,
|
|
241
|
+
draggingColumn?.id === column.id ? 2 : column.getIsPinned() ? 1 : 0,
|
|
241
242
|
'&:hover': {
|
|
242
243
|
backgroundColor:
|
|
243
244
|
enableHover &&
|
|
@@ -264,7 +265,7 @@ export const MRT_TableBodyCell: FC<Props> = ({
|
|
|
264
265
|
animation="wave"
|
|
265
266
|
height={20}
|
|
266
267
|
width={skeletonWidth}
|
|
267
|
-
{...
|
|
268
|
+
{...skeletonProps}
|
|
268
269
|
/>
|
|
269
270
|
) : enableRowNumbers &&
|
|
270
271
|
rowNumberMode === 'static' &&
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
1
|
+
import React, { FC, memo } from 'react';
|
|
2
2
|
import { MRT_Cell, MRT_TableInstance } from '..';
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
@@ -6,7 +6,7 @@ interface Props {
|
|
|
6
6
|
table: MRT_TableInstance;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const _MRT_TableBodyCellValue: FC<Props> = ({ cell, table }) => {
|
|
10
10
|
const { column, row } = cell;
|
|
11
11
|
const { columnDef } = column;
|
|
12
12
|
|
|
@@ -32,3 +32,8 @@ export const MRT_TableBodyCellValue: FC<Props> = ({ cell, table }) => {
|
|
|
32
32
|
</>
|
|
33
33
|
);
|
|
34
34
|
};
|
|
35
|
+
|
|
36
|
+
export const MRT_TableBodyCellValue = memo(
|
|
37
|
+
_MRT_TableBodyCellValue,
|
|
38
|
+
(prev, next) => prev.cell.getValue() === next.cell.getValue(),
|
|
39
|
+
);
|
|
@@ -67,7 +67,7 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, table }) => {
|
|
|
67
67
|
|
|
68
68
|
const getTotalRight = () => {
|
|
69
69
|
return (
|
|
70
|
-
(table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) *
|
|
70
|
+
(table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 160
|
|
71
71
|
);
|
|
72
72
|
};
|
|
73
73
|
|
|
@@ -121,9 +121,9 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, table }) => {
|
|
|
121
121
|
: 'inherit',
|
|
122
122
|
backgroundImage: 'inherit',
|
|
123
123
|
boxShadow: getIsLastLeftPinnedColumn()
|
|
124
|
-
?
|
|
124
|
+
? `-4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
|
|
125
125
|
: getIsFirstRightPinnedColumn()
|
|
126
|
-
?
|
|
126
|
+
? `4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
|
|
127
127
|
: undefined,
|
|
128
128
|
fontWeight: 'bold',
|
|
129
129
|
left:
|
|
@@ -327,7 +327,9 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
327
327
|
>
|
|
328
328
|
<MRT_TablePaper table={table as any} />
|
|
329
329
|
</Dialog>
|
|
330
|
-
{!table.getState().isFullScreen &&
|
|
330
|
+
{!table.getState().isFullScreen && (
|
|
331
|
+
<MRT_TablePaper table={table as any} />
|
|
332
|
+
)}
|
|
331
333
|
{editingRow && props.editingMode === 'modal' && (
|
|
332
334
|
<MRT_EditRowModal row={editingRow as any} table={table} open />
|
|
333
335
|
)}
|