material-react-table 1.3.14 → 1.3.16

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.14",
2
+ "version": "1.3.16",
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.",
@@ -351,7 +351,7 @@ export const MRT_ColumnActionMenu: FC<Props> = ({
351
351
  ]}
352
352
  {enableHiding && [
353
353
  <MenuItem
354
- disabled={columnDef.enableHiding === false}
354
+ disabled={!column.getCanHide()}
355
355
  key={0}
356
356
  onClick={handleHideColumn}
357
357
  sx={commonMenuItemStyles}
@@ -33,7 +33,13 @@ export const MRT_ShowHideColumnsMenu = <
33
33
  getRightLeafColumns,
34
34
  getState,
35
35
  toggleAllColumnsVisible,
36
- options: { localization, enablePinning, enableColumnOrdering },
36
+ options: {
37
+ enableColumnOrdering,
38
+ enableHiding,
39
+ enablePinning,
40
+ localization,
41
+ columns,
42
+ },
37
43
  } = table;
38
44
  const { density, columnOrder, columnPinning } = getState();
39
45
 
@@ -59,6 +65,7 @@ export const MRT_ShowHideColumnsMenu = <
59
65
  }
60
66
  return columns;
61
67
  }, [
68
+ columns,
62
69
  columnOrder,
63
70
  columnPinning,
64
71
  getAllColumns(),
@@ -88,7 +95,7 @@ export const MRT_ShowHideColumnsMenu = <
88
95
  pt: 0,
89
96
  }}
90
97
  >
91
- {!isSubMenu && (
98
+ {!isSubMenu && enableHiding && (
92
99
  <Button
93
100
  disabled={!getIsSomeColumnsVisible()}
94
101
  onClick={hideAllColumns}
@@ -115,12 +122,14 @@ export const MRT_ShowHideColumnsMenu = <
115
122
  {localization.unpinAll}
116
123
  </Button>
117
124
  )}
118
- <Button
119
- disabled={getIsAllColumnsVisible()}
120
- onClick={() => toggleAllColumnsVisible(true)}
121
- >
122
- {localization.showAll}
123
- </Button>
125
+ {enableHiding && (
126
+ <Button
127
+ disabled={getIsAllColumnsVisible()}
128
+ onClick={() => toggleAllColumnsVisible(true)}
129
+ >
130
+ {localization.showAll}
131
+ </Button>
132
+ )}
124
133
  </Box>
125
134
  <Divider />
126
135
  {allColumns.map((column, index) => (
@@ -157,11 +157,7 @@ export const MRT_ShowHideColumnsMenuItems = <
157
157
  <Switch />
158
158
  </Tooltip>
159
159
  }
160
- disabled={
161
- (isSubMenu && switchChecked) ||
162
- !column.getCanHide() ||
163
- column.getIsGrouped()
164
- }
160
+ disabled={(isSubMenu && switchChecked) || !column.getCanHide()}
165
161
  label={columnDef.header}
166
162
  onChange={() => handleToggleColumnHidden(column)}
167
163
  />