material-react-table 2.0.0-alpha.2 → 2.0.0-alpha.4
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/index.js +208 -144
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/icons.d.ts +4 -0
- package/dist/cjs/types/locales/np.d.ts +2 -0
- package/dist/cjs/types/toolbar/MRT_TablePagination.d.ts +2 -2
- package/dist/cjs/types/types.d.ts +29 -3
- package/dist/esm/material-react-table.esm.js +200 -144
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/icons.d.ts +4 -0
- package/dist/esm/types/locales/np.d.ts +2 -0
- package/dist/esm/types/toolbar/MRT_TablePagination.d.ts +2 -2
- package/dist/esm/types/types.d.ts +29 -3
- package/dist/index.d.ts +35 -5
- package/locales/np.d.ts +2 -0
- package/locales/np.esm.d.ts +2 -0
- package/locales/np.esm.js +94 -0
- package/locales/np.esm.js.map +1 -0
- package/locales/np.js +98 -0
- package/locales/np.js.map +1 -0
- package/package.json +26 -26
- package/src/column.utils.ts +1 -5
- package/src/head/MRT_TableHeadCellFilterContainer.tsx +1 -1
- package/src/head/MRT_TableHeadCellFilterLabel.tsx +6 -6
- package/src/hooks/useMRT_Effects.ts +13 -2
- package/src/icons.ts +12 -0
- package/src/inputs/MRT_FilterTextField.tsx +302 -223
- package/src/locales/np.ts +94 -0
- package/src/menus/MRT_ColumnActionMenu.tsx +34 -31
- package/src/menus/MRT_FilterOptionMenu.tsx +1 -1
- package/src/toolbar/MRT_TablePagination.tsx +124 -67
- package/src/types.ts +44 -5
@@ -1,4 +1,4 @@
|
|
1
|
-
import { useEffect, useRef } from 'react';
|
1
|
+
import { useEffect, useReducer, useRef } from 'react';
|
2
2
|
import { getCanRankRows } from '../column.utils';
|
3
3
|
import { type MRT_SortingState, type MRT_TableInstance } from '../types';
|
4
4
|
|
@@ -6,10 +6,12 @@ export const useMRT_Effects = <TData extends Record<string, any> = {}>(
|
|
6
6
|
table: MRT_TableInstance<TData>,
|
7
7
|
) => {
|
8
8
|
const {
|
9
|
+
getIsSomeRowsPinned,
|
9
10
|
getState,
|
10
|
-
options: { enablePagination, rowCount },
|
11
|
+
options: { enablePagination, enableRowPinning, rowCount },
|
11
12
|
} = table;
|
12
13
|
const {
|
14
|
+
density,
|
13
15
|
globalFilter,
|
14
16
|
isFullScreen,
|
15
17
|
isLoading,
|
@@ -18,6 +20,7 @@ export const useMRT_Effects = <TData extends Record<string, any> = {}>(
|
|
18
20
|
sorting,
|
19
21
|
} = getState();
|
20
22
|
|
23
|
+
const rerender = useReducer(() => ({}), {})[1];
|
21
24
|
const isMounted = useRef(false);
|
22
25
|
const initialBodyHeight = useRef<string>();
|
23
26
|
const previousTop = useRef<number>();
|
@@ -74,4 +77,12 @@ export const useMRT_Effects = <TData extends Record<string, any> = {}>(
|
|
74
77
|
table.setSorting(() => appliedSort.current || []);
|
75
78
|
}
|
76
79
|
}, [globalFilter]);
|
80
|
+
|
81
|
+
useEffect(() => {
|
82
|
+
if (enableRowPinning && getIsSomeRowsPinned()) {
|
83
|
+
setTimeout(() => {
|
84
|
+
rerender();
|
85
|
+
}, 150);
|
86
|
+
}
|
87
|
+
}, [density]);
|
77
88
|
};
|
package/src/icons.ts
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
import ArrowDownwardIcon from '@mui/icons-material/ArrowDownward';
|
2
2
|
import ArrowRightIcon from '@mui/icons-material/ArrowRight';
|
3
3
|
import CancelIcon from '@mui/icons-material/Cancel';
|
4
|
+
import ChevronLefIcon from '@mui/icons-material/ChevronLeft';
|
5
|
+
import ChevronRightIcon from '@mui/icons-material/ChevronRight';
|
4
6
|
import ClearAllIcon from '@mui/icons-material/ClearAll';
|
5
7
|
import CloseIcon from '@mui/icons-material/Close';
|
6
8
|
import DensityLargeIcon from '@mui/icons-material/DensityLarge';
|
@@ -13,9 +15,11 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
13
15
|
import FilterAltIcon from '@mui/icons-material/FilterAlt';
|
14
16
|
import FilterListIcon from '@mui/icons-material/FilterList';
|
15
17
|
import FilterListOffIcon from '@mui/icons-material/FilterListOff';
|
18
|
+
import FirstPageIcon from '@mui/icons-material/FirstPage';
|
16
19
|
import FullscreenIcon from '@mui/icons-material/Fullscreen';
|
17
20
|
import FullscreenExitIcon from '@mui/icons-material/FullscreenExit';
|
18
21
|
import KeyboardDoubleArrowDownIcon from '@mui/icons-material/KeyboardDoubleArrowDown';
|
22
|
+
import LastPageIcon from '@mui/icons-material/LastPage';
|
19
23
|
import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
|
20
24
|
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
21
25
|
import PushPinIcon from '@mui/icons-material/PushPin';
|
@@ -31,6 +35,8 @@ export interface MRT_Icons {
|
|
31
35
|
ArrowDownwardIcon: any;
|
32
36
|
ArrowRightIcon: any;
|
33
37
|
CancelIcon: any;
|
38
|
+
ChevronLefIcon: any;
|
39
|
+
ChevronRightIcon: any;
|
34
40
|
ClearAllIcon: any;
|
35
41
|
CloseIcon: any;
|
36
42
|
DensityLargeIcon: any;
|
@@ -43,9 +49,11 @@ export interface MRT_Icons {
|
|
43
49
|
FilterAltIcon: any;
|
44
50
|
FilterListIcon: any;
|
45
51
|
FilterListOffIcon: any;
|
52
|
+
FirstPageIcon?: any;
|
46
53
|
FullscreenExitIcon: any;
|
47
54
|
FullscreenIcon: any;
|
48
55
|
KeyboardDoubleArrowDownIcon: any;
|
56
|
+
LastPageIcon?: any;
|
49
57
|
MoreHorizIcon: any;
|
50
58
|
MoreVertIcon: any;
|
51
59
|
PushPinIcon: any;
|
@@ -62,6 +70,8 @@ export const MRT_Default_Icons: MRT_Icons = {
|
|
62
70
|
ArrowDownwardIcon,
|
63
71
|
ArrowRightIcon,
|
64
72
|
CancelIcon,
|
73
|
+
ChevronLefIcon,
|
74
|
+
ChevronRightIcon,
|
65
75
|
ClearAllIcon,
|
66
76
|
CloseIcon,
|
67
77
|
DensityLargeIcon,
|
@@ -74,9 +84,11 @@ export const MRT_Default_Icons: MRT_Icons = {
|
|
74
84
|
FilterAltIcon,
|
75
85
|
FilterListIcon,
|
76
86
|
FilterListOffIcon,
|
87
|
+
FirstPageIcon,
|
77
88
|
FullscreenExitIcon,
|
78
89
|
FullscreenIcon,
|
79
90
|
KeyboardDoubleArrowDownIcon,
|
91
|
+
LastPageIcon,
|
80
92
|
MoreHorizIcon,
|
81
93
|
MoreVertIcon,
|
82
94
|
PushPinIcon,
|