@mui/x-data-grid 7.0.0-alpha.9 → 7.0.0-beta.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/CHANGELOG.md +139 -38
- package/README.md +2 -2
- package/components/GridRow.js +1 -100
- package/components/columnsManagement/GridColumnsManagement.d.ts +36 -0
- package/components/columnsManagement/GridColumnsManagement.js +260 -0
- package/components/columnsManagement/index.d.ts +1 -0
- package/components/columnsManagement/index.js +1 -0
- package/components/columnsManagement/utils.d.ts +4 -0
- package/components/columnsManagement/utils.js +16 -0
- package/components/index.d.ts +1 -0
- package/components/index.js +1 -0
- package/components/panel/GridColumnsPanel.d.ts +0 -28
- package/components/panel/GridColumnsPanel.js +5 -213
- package/constants/defaultGridSlotsComponents.js +2 -1
- package/constants/gridClasses.d.ts +12 -4
- package/constants/gridClasses.js +1 -1
- package/constants/localeTextConstants.js +4 -6
- package/hooks/core/useGridApiInitialization.js +4 -0
- package/hooks/features/rows/gridRowsUtils.js +4 -1
- package/index.js +1 -1
- package/legacy/components/GridRow.js +1 -100
- package/legacy/components/columnsManagement/GridColumnsManagement.js +300 -0
- package/legacy/components/columnsManagement/index.js +1 -0
- package/legacy/components/columnsManagement/utils.js +22 -0
- package/legacy/components/index.js +1 -0
- package/legacy/components/panel/GridColumnsPanel.js +5 -233
- package/legacy/constants/defaultGridSlotsComponents.js +2 -1
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/constants/localeTextConstants.js +4 -6
- package/legacy/hooks/core/useGridApiInitialization.js +4 -0
- package/legacy/hooks/features/rows/gridRowsUtils.js +4 -1
- package/legacy/index.js +1 -1
- package/legacy/locales/arSD.js +5 -6
- package/legacy/locales/beBY.js +5 -6
- package/legacy/locales/bgBG.js +5 -6
- package/legacy/locales/csCZ.js +5 -6
- package/legacy/locales/daDK.js +5 -6
- package/legacy/locales/deDE.js +5 -6
- package/legacy/locales/elGR.js +5 -6
- package/legacy/locales/esES.js +5 -6
- package/legacy/locales/faIR.js +5 -6
- package/legacy/locales/fiFI.js +5 -6
- package/legacy/locales/frFR.js +5 -6
- package/legacy/locales/heIL.js +5 -6
- package/legacy/locales/hrHR.js +5 -6
- package/legacy/locales/huHU.js +5 -6
- package/legacy/locales/itIT.js +5 -6
- package/legacy/locales/jaJP.js +5 -6
- package/legacy/locales/koKR.js +5 -6
- package/legacy/locales/nbNO.js +5 -6
- package/legacy/locales/nlNL.js +5 -6
- package/legacy/locales/plPL.js +5 -6
- package/legacy/locales/ptBR.js +5 -6
- package/legacy/locales/ptPT.js +5 -6
- package/legacy/locales/roRO.js +5 -6
- package/legacy/locales/ruRU.js +5 -6
- package/legacy/locales/skSK.js +5 -6
- package/legacy/locales/svSE.js +5 -6
- package/legacy/locales/trTR.js +5 -6
- package/legacy/locales/ukUA.js +5 -6
- package/legacy/locales/urPK.js +5 -6
- package/legacy/locales/viVN.js +5 -6
- package/legacy/locales/zhCN.js +5 -6
- package/legacy/locales/zhHK.js +5 -6
- package/legacy/locales/zhTW.js +5 -6
- package/locales/arSD.js +5 -6
- package/locales/beBY.js +5 -6
- package/locales/bgBG.js +5 -6
- package/locales/csCZ.js +5 -6
- package/locales/daDK.js +5 -6
- package/locales/deDE.js +5 -6
- package/locales/elGR.js +5 -6
- package/locales/esES.js +5 -6
- package/locales/faIR.js +5 -6
- package/locales/fiFI.js +5 -6
- package/locales/frFR.js +5 -6
- package/locales/heIL.js +5 -6
- package/locales/hrHR.js +5 -6
- package/locales/huHU.js +5 -6
- package/locales/itIT.js +5 -6
- package/locales/jaJP.js +5 -6
- package/locales/koKR.js +5 -6
- package/locales/nbNO.js +5 -6
- package/locales/nlNL.js +5 -6
- package/locales/plPL.js +5 -6
- package/locales/ptBR.js +5 -6
- package/locales/ptPT.js +5 -6
- package/locales/roRO.js +5 -6
- package/locales/ruRU.js +5 -6
- package/locales/skSK.js +5 -6
- package/locales/svSE.js +5 -6
- package/locales/trTR.js +5 -6
- package/locales/ukUA.js +5 -6
- package/locales/urPK.js +5 -6
- package/locales/viVN.js +5 -6
- package/locales/zhCN.js +5 -6
- package/locales/zhHK.js +5 -6
- package/locales/zhTW.js +5 -6
- package/models/api/gridLocaleTextApi.d.ts +3 -5
- package/models/colDef/gridColType.d.ts +11 -2
- package/models/gridSlotsComponent.d.ts +5 -0
- package/models/gridSlotsComponentsProps.d.ts +4 -0
- package/modern/components/GridRow.js +1 -100
- package/modern/components/columnsManagement/GridColumnsManagement.js +256 -0
- package/modern/components/columnsManagement/index.js +1 -0
- package/modern/components/columnsManagement/utils.js +16 -0
- package/modern/components/index.js +1 -0
- package/modern/components/panel/GridColumnsPanel.js +4 -209
- package/modern/constants/defaultGridSlotsComponents.js +2 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/constants/localeTextConstants.js +4 -6
- package/modern/hooks/core/useGridApiInitialization.js +3 -0
- package/modern/hooks/features/rows/gridRowsUtils.js +4 -1
- package/modern/index.js +1 -1
- package/modern/locales/arSD.js +5 -6
- package/modern/locales/beBY.js +5 -6
- package/modern/locales/bgBG.js +5 -6
- package/modern/locales/csCZ.js +5 -6
- package/modern/locales/daDK.js +5 -6
- package/modern/locales/deDE.js +5 -6
- package/modern/locales/elGR.js +5 -6
- package/modern/locales/esES.js +5 -6
- package/modern/locales/faIR.js +5 -6
- package/modern/locales/fiFI.js +5 -6
- package/modern/locales/frFR.js +5 -6
- package/modern/locales/heIL.js +5 -6
- package/modern/locales/hrHR.js +5 -6
- package/modern/locales/huHU.js +5 -6
- package/modern/locales/itIT.js +5 -6
- package/modern/locales/jaJP.js +5 -6
- package/modern/locales/koKR.js +5 -6
- package/modern/locales/nbNO.js +5 -6
- package/modern/locales/nlNL.js +5 -6
- package/modern/locales/plPL.js +5 -6
- package/modern/locales/ptBR.js +5 -6
- package/modern/locales/ptPT.js +5 -6
- package/modern/locales/roRO.js +5 -6
- package/modern/locales/ruRU.js +5 -6
- package/modern/locales/skSK.js +5 -6
- package/modern/locales/svSE.js +5 -6
- package/modern/locales/trTR.js +5 -6
- package/modern/locales/ukUA.js +5 -6
- package/modern/locales/urPK.js +5 -6
- package/modern/locales/viVN.js +5 -6
- package/modern/locales/zhCN.js +5 -6
- package/modern/locales/zhHK.js +5 -6
- package/modern/locales/zhTW.js +5 -6
- package/node/components/GridRow.js +1 -100
- package/node/components/columnsManagement/GridColumnsManagement.js +264 -0
- package/node/components/columnsManagement/index.js +16 -0
- package/node/components/columnsManagement/utils.js +24 -0
- package/node/components/index.js +11 -0
- package/node/components/panel/GridColumnsPanel.js +4 -208
- package/node/constants/defaultGridSlotsComponents.js +1 -0
- package/node/constants/gridClasses.js +1 -1
- package/node/constants/localeTextConstants.js +4 -6
- package/node/hooks/core/useGridApiInitialization.js +3 -0
- package/node/hooks/features/rows/gridRowsUtils.js +4 -1
- package/node/index.js +1 -1
- package/node/locales/arSD.js +5 -6
- package/node/locales/beBY.js +5 -6
- package/node/locales/bgBG.js +5 -6
- package/node/locales/csCZ.js +5 -6
- package/node/locales/daDK.js +5 -6
- package/node/locales/deDE.js +5 -6
- package/node/locales/elGR.js +5 -6
- package/node/locales/esES.js +5 -6
- package/node/locales/faIR.js +5 -6
- package/node/locales/fiFI.js +5 -6
- package/node/locales/frFR.js +5 -6
- package/node/locales/heIL.js +5 -6
- package/node/locales/hrHR.js +5 -6
- package/node/locales/huHU.js +5 -6
- package/node/locales/itIT.js +5 -6
- package/node/locales/jaJP.js +5 -6
- package/node/locales/koKR.js +5 -6
- package/node/locales/nbNO.js +5 -6
- package/node/locales/nlNL.js +5 -6
- package/node/locales/plPL.js +5 -6
- package/node/locales/ptBR.js +5 -6
- package/node/locales/ptPT.js +5 -6
- package/node/locales/roRO.js +5 -6
- package/node/locales/ruRU.js +5 -6
- package/node/locales/skSK.js +5 -6
- package/node/locales/svSE.js +5 -6
- package/node/locales/trTR.js +5 -6
- package/node/locales/ukUA.js +5 -6
- package/node/locales/urPK.js +5 -6
- package/node/locales/viVN.js +5 -6
- package/node/locales/zhCN.js +5 -6
- package/node/locales/zhHK.js +5 -6
- package/node/locales/zhTW.js +5 -6
- package/package.json +3 -3
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
6
|
+
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
7
|
+
import { styled } from '@mui/material/styles';
|
|
8
|
+
import { gridColumnDefinitionsSelector, gridColumnVisibilityModelSelector } from '../../hooks/features/columns/gridColumnsSelector';
|
|
9
|
+
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
10
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
11
|
+
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
12
|
+
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
13
|
+
import { useLazyRef } from '../../hooks/utils/useLazyRef';
|
|
14
|
+
import { checkColumnVisibilityModelsSame, defaultSearchPredicate } from './utils';
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
+
const useUtilityClasses = ownerState => {
|
|
18
|
+
const {
|
|
19
|
+
classes
|
|
20
|
+
} = ownerState;
|
|
21
|
+
const slots = {
|
|
22
|
+
root: ['columnsManagement'],
|
|
23
|
+
header: ['columnsManagementHeader'],
|
|
24
|
+
footer: ['columnsManagementFooter'],
|
|
25
|
+
row: ['columnsManagementRow']
|
|
26
|
+
};
|
|
27
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
28
|
+
};
|
|
29
|
+
const collator = new Intl.Collator();
|
|
30
|
+
function GridColumnsManagement(props) {
|
|
31
|
+
var _rootProps$slotProps, _rootProps$slotProps3, _rootProps$slotProps4;
|
|
32
|
+
const apiRef = useGridApiContext();
|
|
33
|
+
const searchInputRef = React.useRef(null);
|
|
34
|
+
const columns = useGridSelector(apiRef, gridColumnDefinitionsSelector);
|
|
35
|
+
const initialColumnVisibilityModel = useLazyRef(() => gridColumnVisibilityModelSelector(apiRef)).current;
|
|
36
|
+
const columnVisibilityModel = useGridSelector(apiRef, gridColumnVisibilityModelSelector);
|
|
37
|
+
const rootProps = useGridRootProps();
|
|
38
|
+
const [searchValue, setSearchValue] = React.useState('');
|
|
39
|
+
const classes = useUtilityClasses(rootProps);
|
|
40
|
+
const {
|
|
41
|
+
sort,
|
|
42
|
+
searchPredicate = defaultSearchPredicate,
|
|
43
|
+
autoFocusSearchField = true,
|
|
44
|
+
disableShowHideToggle = false,
|
|
45
|
+
disableResetButton = false,
|
|
46
|
+
getTogglableColumns
|
|
47
|
+
} = props;
|
|
48
|
+
const isResetDisabled = React.useMemo(() => checkColumnVisibilityModelsSame(columnVisibilityModel, initialColumnVisibilityModel), [columnVisibilityModel, initialColumnVisibilityModel]);
|
|
49
|
+
const sortedColumns = React.useMemo(() => {
|
|
50
|
+
switch (sort) {
|
|
51
|
+
case 'asc':
|
|
52
|
+
return [...columns].sort((a, b) => collator.compare(a.headerName || a.field, b.headerName || b.field));
|
|
53
|
+
case 'desc':
|
|
54
|
+
return [...columns].sort((a, b) => -collator.compare(a.headerName || a.field, b.headerName || b.field));
|
|
55
|
+
default:
|
|
56
|
+
return columns;
|
|
57
|
+
}
|
|
58
|
+
}, [columns, sort]);
|
|
59
|
+
const toggleColumn = event => {
|
|
60
|
+
const {
|
|
61
|
+
name: field
|
|
62
|
+
} = event.target;
|
|
63
|
+
apiRef.current.setColumnVisibility(field, columnVisibilityModel[field] === false);
|
|
64
|
+
};
|
|
65
|
+
const toggleAllColumns = React.useCallback(isVisible => {
|
|
66
|
+
const currentModel = gridColumnVisibilityModelSelector(apiRef);
|
|
67
|
+
const newModel = _extends({}, currentModel);
|
|
68
|
+
const togglableColumns = getTogglableColumns ? getTogglableColumns(columns) : null;
|
|
69
|
+
columns.forEach(col => {
|
|
70
|
+
if (col.hideable && (togglableColumns == null || togglableColumns.includes(col.field))) {
|
|
71
|
+
if (isVisible) {
|
|
72
|
+
// delete the key from the model instead of setting it to `true`
|
|
73
|
+
delete newModel[col.field];
|
|
74
|
+
} else {
|
|
75
|
+
newModel[col.field] = false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return apiRef.current.setColumnVisibilityModel(newModel);
|
|
80
|
+
}, [apiRef, columns, getTogglableColumns]);
|
|
81
|
+
const handleSearchValueChange = React.useCallback(event => {
|
|
82
|
+
setSearchValue(event.target.value);
|
|
83
|
+
}, []);
|
|
84
|
+
const currentColumns = React.useMemo(() => {
|
|
85
|
+
const togglableColumns = getTogglableColumns ? getTogglableColumns(sortedColumns) : null;
|
|
86
|
+
const togglableSortedColumns = togglableColumns ? sortedColumns.filter(({
|
|
87
|
+
field
|
|
88
|
+
}) => togglableColumns.includes(field)) : sortedColumns;
|
|
89
|
+
if (!searchValue) {
|
|
90
|
+
return togglableSortedColumns;
|
|
91
|
+
}
|
|
92
|
+
return togglableSortedColumns.filter(column => searchPredicate(column, searchValue.toLowerCase()));
|
|
93
|
+
}, [sortedColumns, searchValue, searchPredicate, getTogglableColumns]);
|
|
94
|
+
const hideableColumns = React.useMemo(() => currentColumns.filter(col => col.hideable), [currentColumns]);
|
|
95
|
+
const allHideableColumnsVisible = React.useMemo(() => hideableColumns.every(column => columnVisibilityModel[column.field] == null || columnVisibilityModel[column.field] !== false), [columnVisibilityModel, hideableColumns]);
|
|
96
|
+
const allHideableColumnsHidden = React.useMemo(() => hideableColumns.every(column => columnVisibilityModel[column.field] === false), [columnVisibilityModel, hideableColumns]);
|
|
97
|
+
const firstSwitchRef = React.useRef(null);
|
|
98
|
+
React.useEffect(() => {
|
|
99
|
+
if (autoFocusSearchField) {
|
|
100
|
+
searchInputRef.current.focus();
|
|
101
|
+
} else if (firstSwitchRef.current && typeof firstSwitchRef.current.focus === 'function') {
|
|
102
|
+
firstSwitchRef.current.focus();
|
|
103
|
+
}
|
|
104
|
+
}, [autoFocusSearchField]);
|
|
105
|
+
let firstHideableColumnFound = false;
|
|
106
|
+
const isFirstHideableColumn = column => {
|
|
107
|
+
if (firstHideableColumnFound === false && column.hideable !== false) {
|
|
108
|
+
firstHideableColumnFound = true;
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
return false;
|
|
112
|
+
};
|
|
113
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
114
|
+
children: [/*#__PURE__*/_jsx(GridColumnsManagementHeader, {
|
|
115
|
+
className: classes.header,
|
|
116
|
+
ownerState: rootProps,
|
|
117
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
|
|
118
|
+
placeholder: apiRef.current.getLocaleText('columnsManagementSearchTitle'),
|
|
119
|
+
inputRef: searchInputRef,
|
|
120
|
+
value: searchValue,
|
|
121
|
+
onChange: handleSearchValueChange,
|
|
122
|
+
variant: "outlined",
|
|
123
|
+
size: "small",
|
|
124
|
+
InputProps: {
|
|
125
|
+
startAdornment: /*#__PURE__*/_jsx(rootProps.slots.baseInputAdornment, {
|
|
126
|
+
position: "start",
|
|
127
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.quickFilterIcon, {})
|
|
128
|
+
}),
|
|
129
|
+
sx: {
|
|
130
|
+
pl: 1.5
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
fullWidth: true
|
|
134
|
+
}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseTextField))
|
|
135
|
+
}), /*#__PURE__*/_jsxs(GridColumnsManagementBody, {
|
|
136
|
+
className: classes.root,
|
|
137
|
+
ownerState: rootProps,
|
|
138
|
+
children: [currentColumns.map(column => {
|
|
139
|
+
var _rootProps$slotProps2;
|
|
140
|
+
return /*#__PURE__*/_jsx(FormControlLabel, {
|
|
141
|
+
className: classes.row,
|
|
142
|
+
control: /*#__PURE__*/_jsx(rootProps.slots.baseCheckbox, _extends({
|
|
143
|
+
disabled: column.hideable === false,
|
|
144
|
+
checked: columnVisibilityModel[column.field] !== false,
|
|
145
|
+
onClick: toggleColumn,
|
|
146
|
+
name: column.field,
|
|
147
|
+
sx: {
|
|
148
|
+
p: 0.5
|
|
149
|
+
},
|
|
150
|
+
inputRef: isFirstHideableColumn(column) ? firstSwitchRef : undefined
|
|
151
|
+
}, (_rootProps$slotProps2 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps2.baseCheckbox)),
|
|
152
|
+
label: column.headerName || column.field
|
|
153
|
+
}, column.field);
|
|
154
|
+
}), currentColumns.length === 0 && /*#__PURE__*/_jsx(GridColumnsManagementEmptyText, {
|
|
155
|
+
ownerState: rootProps,
|
|
156
|
+
children: apiRef.current.getLocaleText('columnsManagementNoColumns')
|
|
157
|
+
})]
|
|
158
|
+
}), !disableShowHideToggle && !disableResetButton && currentColumns.length > 0 ? /*#__PURE__*/_jsxs(GridColumnsManagementFooter, {
|
|
159
|
+
ownerState: rootProps,
|
|
160
|
+
className: classes.footer,
|
|
161
|
+
children: [!disableShowHideToggle ? /*#__PURE__*/_jsx(FormControlLabel, {
|
|
162
|
+
control: /*#__PURE__*/_jsx(rootProps.slots.baseCheckbox, _extends({
|
|
163
|
+
disabled: hideableColumns.length === 0,
|
|
164
|
+
checked: allHideableColumnsVisible,
|
|
165
|
+
indeterminate: !allHideableColumnsVisible && !allHideableColumnsHidden,
|
|
166
|
+
onClick: () => toggleAllColumns(!allHideableColumnsVisible),
|
|
167
|
+
name: apiRef.current.getLocaleText('columnsManagementShowHideAllText')
|
|
168
|
+
}, (_rootProps$slotProps3 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps3.baseCheckbox)),
|
|
169
|
+
sx: {
|
|
170
|
+
[`.MuiFormControlLabel-label`]: {
|
|
171
|
+
textTransform: 'uppercase',
|
|
172
|
+
fontSize: '14px'
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
label: apiRef.current.getLocaleText('columnsManagementShowHideAllText')
|
|
176
|
+
}) : /*#__PURE__*/_jsx("span", {}), !disableResetButton ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
177
|
+
onClick: () => apiRef.current.setColumnVisibilityModel(initialColumnVisibilityModel),
|
|
178
|
+
disabled: isResetDisabled
|
|
179
|
+
}, (_rootProps$slotProps4 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps4.baseButton, {
|
|
180
|
+
children: "Reset"
|
|
181
|
+
})) : null]
|
|
182
|
+
}) : null]
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
process.env.NODE_ENV !== "production" ? GridColumnsManagement.propTypes = {
|
|
186
|
+
// ----------------------------- Warning --------------------------------
|
|
187
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
188
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
189
|
+
// ----------------------------------------------------------------------
|
|
190
|
+
/**
|
|
191
|
+
* If `true`, the column search field will be focused automatically.
|
|
192
|
+
* If `false`, the first column switch input will be focused automatically.
|
|
193
|
+
* This helps to avoid input keyboard panel to popup automatically on touch devices.
|
|
194
|
+
* @default true
|
|
195
|
+
*/
|
|
196
|
+
autoFocusSearchField: PropTypes.bool,
|
|
197
|
+
/**
|
|
198
|
+
* If `true`, the `Reset` button will not be disabled
|
|
199
|
+
* @default false
|
|
200
|
+
*/
|
|
201
|
+
disableResetButton: PropTypes.bool,
|
|
202
|
+
/**
|
|
203
|
+
* If `true`, the `Show/Hide all` toggle checkbox will not be displayed.
|
|
204
|
+
* @default false
|
|
205
|
+
*/
|
|
206
|
+
disableShowHideToggle: PropTypes.bool,
|
|
207
|
+
/**
|
|
208
|
+
* Returns the list of togglable columns.
|
|
209
|
+
* If used, only those columns will be displayed in the panel
|
|
210
|
+
* which are passed as the return value of the function.
|
|
211
|
+
* @param {GridColDef[]} columns The `ColDef` list of all columns.
|
|
212
|
+
* @returns {GridColDef['field'][]} The list of togglable columns' field names.
|
|
213
|
+
*/
|
|
214
|
+
getTogglableColumns: PropTypes.func,
|
|
215
|
+
searchPredicate: PropTypes.func,
|
|
216
|
+
sort: PropTypes.oneOf(['asc', 'desc'])
|
|
217
|
+
} : void 0;
|
|
218
|
+
const GridColumnsManagementBody = styled('div', {
|
|
219
|
+
name: 'MuiDataGrid',
|
|
220
|
+
slot: 'ColumnsManagement',
|
|
221
|
+
overridesResolver: (props, styles) => styles.columnsManagement
|
|
222
|
+
})(({
|
|
223
|
+
theme
|
|
224
|
+
}) => ({
|
|
225
|
+
padding: theme.spacing(0, 3, 1.5),
|
|
226
|
+
display: 'flex',
|
|
227
|
+
flexDirection: 'column',
|
|
228
|
+
overflow: 'auto',
|
|
229
|
+
flex: '1 1',
|
|
230
|
+
maxHeight: 400,
|
|
231
|
+
alignItems: 'flex-start'
|
|
232
|
+
}));
|
|
233
|
+
const GridColumnsManagementHeader = styled('div', {
|
|
234
|
+
name: 'MuiDataGrid',
|
|
235
|
+
slot: 'ColumnsManagementHeader',
|
|
236
|
+
overridesResolver: (props, styles) => styles.columnsManagementHeader
|
|
237
|
+
})(({
|
|
238
|
+
theme
|
|
239
|
+
}) => ({
|
|
240
|
+
padding: theme.spacing(1.5, 3)
|
|
241
|
+
}));
|
|
242
|
+
const GridColumnsManagementFooter = styled('div', {
|
|
243
|
+
name: 'MuiDataGrid',
|
|
244
|
+
slot: 'ColumnsManagementFooter',
|
|
245
|
+
overridesResolver: (props, styles) => styles.columnsManagementFooter
|
|
246
|
+
})(({
|
|
247
|
+
theme
|
|
248
|
+
}) => ({
|
|
249
|
+
padding: theme.spacing(0.5, 1, 0.5, 2.4),
|
|
250
|
+
display: 'flex',
|
|
251
|
+
justifyContent: 'space-between',
|
|
252
|
+
borderTop: `1px solid ${theme.palette.divider}`
|
|
253
|
+
}));
|
|
254
|
+
const GridColumnsManagementEmptyText = styled('div')(({
|
|
255
|
+
theme
|
|
256
|
+
}) => ({
|
|
257
|
+
padding: theme.spacing(0.5, 0),
|
|
258
|
+
color: theme.palette.grey[500]
|
|
259
|
+
}));
|
|
260
|
+
export { GridColumnsManagement };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './GridColumnsManagement';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './GridColumnsManagement';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { GridColumnVisibilityModel } from '../../hooks/features/columns/gridColumnsInterfaces';
|
|
2
|
+
import { GridColumnsManagementProps } from './GridColumnsManagement';
|
|
3
|
+
export declare const checkColumnVisibilityModelsSame: (a: GridColumnVisibilityModel, b: GridColumnVisibilityModel) => boolean;
|
|
4
|
+
export declare const defaultSearchPredicate: NonNullable<GridColumnsManagementProps['searchPredicate']>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const checkColumnVisibilityModelsSame = (a, b) => {
|
|
2
|
+
// Filter `false` values only, as `true` and not having a key are the same
|
|
3
|
+
const aFalseValues = new Set(Object.keys(a).filter(key => a[key] === false));
|
|
4
|
+
const bFalseValues = new Set(Object.keys(b).filter(key => b[key] === false));
|
|
5
|
+
if (aFalseValues.size !== bFalseValues.size) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
let result = true;
|
|
9
|
+
aFalseValues.forEach(key => {
|
|
10
|
+
if (!bFalseValues.has(key)) {
|
|
11
|
+
result = false;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
return result;
|
|
15
|
+
};
|
|
16
|
+
export const defaultSearchPredicate = (column, searchValue) => (column.headerName || column.field).toLowerCase().indexOf(searchValue) > -1;
|
package/components/index.d.ts
CHANGED
package/components/index.js
CHANGED
|
@@ -1,34 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridPanelWrapperProps } from './GridPanelWrapper';
|
|
3
|
-
import type { GridColDef } from '../../models/colDef/gridColDef';
|
|
4
3
|
export interface GridColumnsPanelProps extends GridPanelWrapperProps {
|
|
5
|
-
sort?: 'asc' | 'desc';
|
|
6
|
-
searchPredicate?: (column: GridColDef, searchValue: string) => boolean;
|
|
7
|
-
/**
|
|
8
|
-
* If `true`, the column search field will be focused automatically.
|
|
9
|
-
* If `false`, the first column switch input will be focused automatically.
|
|
10
|
-
* This helps to avoid input keyboard panel to popup automatically on touch devices.
|
|
11
|
-
* @default true
|
|
12
|
-
*/
|
|
13
|
-
autoFocusSearchField?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* If `true`, the `Hide all` button will not be displayed.
|
|
16
|
-
* @default false
|
|
17
|
-
*/
|
|
18
|
-
disableHideAllButton?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* If `true`, the `Show all` button will be disabled
|
|
21
|
-
* @default false
|
|
22
|
-
*/
|
|
23
|
-
disableShowAllButton?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Returns the list of togglable columns.
|
|
26
|
-
* If used, only those columns will be displayed in the panel
|
|
27
|
-
* which are passed as the return value of the function.
|
|
28
|
-
* @param {GridColDef[]} columns The `ColDef` list of all columns.
|
|
29
|
-
* @returns {GridColDef['field'][]} The list of togglable columns' field names.
|
|
30
|
-
*/
|
|
31
|
-
getTogglableColumns?: (columns: GridColDef[]) => GridColDef['field'][];
|
|
32
4
|
}
|
|
33
5
|
declare function GridColumnsPanel(props: GridColumnsPanelProps): React.JSX.Element;
|
|
34
6
|
declare namespace GridColumnsPanel {
|
|
@@ -1,196 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["sort", "searchPredicate", "autoFocusSearchField", "disableHideAllButton", "disableShowAllButton", "getTogglableColumns"];
|
|
4
2
|
import * as React from 'react';
|
|
5
3
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
7
|
-
import IconButton from '@mui/material/IconButton';
|
|
8
|
-
import { switchClasses } from '@mui/material/Switch';
|
|
9
|
-
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
10
|
-
import { styled } from '@mui/material/styles';
|
|
11
|
-
import { gridColumnDefinitionsSelector, gridColumnVisibilityModelSelector } from '../../hooks/features/columns/gridColumnsSelector';
|
|
12
|
-
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
13
|
-
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
14
|
-
import { GridPanelContent } from './GridPanelContent';
|
|
15
|
-
import { GridPanelFooter } from './GridPanelFooter';
|
|
16
|
-
import { GridPanelHeader } from './GridPanelHeader';
|
|
17
4
|
import { GridPanelWrapper } from './GridPanelWrapper';
|
|
18
|
-
import {
|
|
5
|
+
import { GridColumnsManagement } from '../columnsManagement';
|
|
19
6
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
20
|
-
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
21
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
-
const useUtilityClasses = ownerState => {
|
|
24
|
-
const {
|
|
25
|
-
classes
|
|
26
|
-
} = ownerState;
|
|
27
|
-
const slots = {
|
|
28
|
-
root: ['columnsPanel'],
|
|
29
|
-
columnsPanelRow: ['columnsPanelRow']
|
|
30
|
-
};
|
|
31
|
-
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
32
|
-
};
|
|
33
|
-
const GridColumnsPanelRoot = styled('div', {
|
|
34
|
-
name: 'MuiDataGrid',
|
|
35
|
-
slot: 'ColumnsPanel',
|
|
36
|
-
overridesResolver: (props, styles) => styles.columnsPanel
|
|
37
|
-
})({
|
|
38
|
-
padding: '8px 0px 8px 8px'
|
|
39
|
-
});
|
|
40
|
-
const GridColumnsPanelRowRoot = styled('div', {
|
|
41
|
-
name: 'MuiDataGrid',
|
|
42
|
-
slot: 'ColumnsPanelRow',
|
|
43
|
-
overridesResolver: (props, styles) => styles.columnsPanelRow
|
|
44
|
-
})(({
|
|
45
|
-
theme
|
|
46
|
-
}) => ({
|
|
47
|
-
display: 'flex',
|
|
48
|
-
justifyContent: 'space-between',
|
|
49
|
-
padding: '1px 8px 1px 7px',
|
|
50
|
-
[`& .${switchClasses.root}`]: {
|
|
51
|
-
marginRight: theme.spacing(0.5)
|
|
52
|
-
}
|
|
53
|
-
}));
|
|
54
|
-
const GridIconButtonRoot = styled(IconButton)({
|
|
55
|
-
justifyContent: 'flex-end'
|
|
56
|
-
});
|
|
57
|
-
const collator = new Intl.Collator();
|
|
58
|
-
const defaultSearchPredicate = (column, searchValue) => {
|
|
59
|
-
return (column.headerName || column.field).toLowerCase().indexOf(searchValue) > -1;
|
|
60
|
-
};
|
|
61
8
|
function GridColumnsPanel(props) {
|
|
62
|
-
var _rootProps$slotProps
|
|
63
|
-
const apiRef = useGridApiContext();
|
|
64
|
-
const searchInputRef = React.useRef(null);
|
|
65
|
-
const columns = useGridSelector(apiRef, gridColumnDefinitionsSelector);
|
|
66
|
-
const columnVisibilityModel = useGridSelector(apiRef, gridColumnVisibilityModelSelector);
|
|
9
|
+
var _rootProps$slotProps;
|
|
67
10
|
const rootProps = useGridRootProps();
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const {
|
|
71
|
-
sort,
|
|
72
|
-
searchPredicate = defaultSearchPredicate,
|
|
73
|
-
autoFocusSearchField = true,
|
|
74
|
-
disableHideAllButton = false,
|
|
75
|
-
disableShowAllButton = false,
|
|
76
|
-
getTogglableColumns
|
|
77
|
-
} = props,
|
|
78
|
-
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
79
|
-
const sortedColumns = React.useMemo(() => {
|
|
80
|
-
switch (sort) {
|
|
81
|
-
case 'asc':
|
|
82
|
-
return [...columns].sort((a, b) => collator.compare(a.headerName || a.field, b.headerName || b.field));
|
|
83
|
-
case 'desc':
|
|
84
|
-
return [...columns].sort((a, b) => -collator.compare(a.headerName || a.field, b.headerName || b.field));
|
|
85
|
-
default:
|
|
86
|
-
return columns;
|
|
87
|
-
}
|
|
88
|
-
}, [columns, sort]);
|
|
89
|
-
const toggleColumn = event => {
|
|
90
|
-
const {
|
|
91
|
-
name: field
|
|
92
|
-
} = event.target;
|
|
93
|
-
apiRef.current.setColumnVisibility(field, columnVisibilityModel[field] === false);
|
|
94
|
-
};
|
|
95
|
-
const toggleAllColumns = React.useCallback(isVisible => {
|
|
96
|
-
const currentModel = gridColumnVisibilityModelSelector(apiRef);
|
|
97
|
-
const newModel = _extends({}, currentModel);
|
|
98
|
-
const togglableColumns = getTogglableColumns ? getTogglableColumns(columns) : null;
|
|
99
|
-
columns.forEach(col => {
|
|
100
|
-
if (col.hideable && (togglableColumns == null || togglableColumns.includes(col.field))) {
|
|
101
|
-
if (isVisible) {
|
|
102
|
-
// delete the key from the model instead of setting it to `true`
|
|
103
|
-
delete newModel[col.field];
|
|
104
|
-
} else {
|
|
105
|
-
newModel[col.field] = false;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
return apiRef.current.setColumnVisibilityModel(newModel);
|
|
110
|
-
}, [apiRef, columns, getTogglableColumns]);
|
|
111
|
-
const handleSearchValueChange = React.useCallback(event => {
|
|
112
|
-
setSearchValue(event.target.value);
|
|
113
|
-
}, []);
|
|
114
|
-
const currentColumns = React.useMemo(() => {
|
|
115
|
-
const togglableColumns = getTogglableColumns ? getTogglableColumns(sortedColumns) : null;
|
|
116
|
-
const togglableSortedColumns = togglableColumns ? sortedColumns.filter(({
|
|
117
|
-
field
|
|
118
|
-
}) => togglableColumns.includes(field)) : sortedColumns;
|
|
119
|
-
if (!searchValue) {
|
|
120
|
-
return togglableSortedColumns;
|
|
121
|
-
}
|
|
122
|
-
return togglableSortedColumns.filter(column => searchPredicate(column, searchValue.toLowerCase()));
|
|
123
|
-
}, [sortedColumns, searchValue, searchPredicate, getTogglableColumns]);
|
|
124
|
-
const firstSwitchRef = React.useRef(null);
|
|
125
|
-
React.useEffect(() => {
|
|
126
|
-
if (autoFocusSearchField) {
|
|
127
|
-
searchInputRef.current.focus();
|
|
128
|
-
} else if (firstSwitchRef.current && typeof firstSwitchRef.current.focus === 'function') {
|
|
129
|
-
firstSwitchRef.current.focus();
|
|
130
|
-
}
|
|
131
|
-
}, [autoFocusSearchField]);
|
|
132
|
-
let firstHideableColumnFound = false;
|
|
133
|
-
const isFirstHideableColumn = column => {
|
|
134
|
-
if (firstHideableColumnFound === false && column.hideable !== false) {
|
|
135
|
-
firstHideableColumnFound = true;
|
|
136
|
-
return true;
|
|
137
|
-
}
|
|
138
|
-
return false;
|
|
139
|
-
};
|
|
140
|
-
return /*#__PURE__*/_jsxs(GridPanelWrapper, _extends({}, other, {
|
|
141
|
-
children: [/*#__PURE__*/_jsx(GridPanelHeader, {
|
|
142
|
-
children: /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
|
|
143
|
-
label: apiRef.current.getLocaleText('columnsPanelTextFieldLabel'),
|
|
144
|
-
placeholder: apiRef.current.getLocaleText('columnsPanelTextFieldPlaceholder'),
|
|
145
|
-
inputRef: searchInputRef,
|
|
146
|
-
value: searchValue,
|
|
147
|
-
onChange: handleSearchValueChange,
|
|
148
|
-
variant: "standard",
|
|
149
|
-
fullWidth: true
|
|
150
|
-
}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseTextField))
|
|
151
|
-
}), /*#__PURE__*/_jsx(GridPanelContent, {
|
|
152
|
-
children: /*#__PURE__*/_jsx(GridColumnsPanelRoot, {
|
|
153
|
-
className: classes.root,
|
|
154
|
-
ownerState: rootProps,
|
|
155
|
-
children: currentColumns.map(column => {
|
|
156
|
-
var _rootProps$slotProps2;
|
|
157
|
-
return /*#__PURE__*/_jsxs(GridColumnsPanelRowRoot, {
|
|
158
|
-
className: classes.columnsPanelRow,
|
|
159
|
-
ownerState: rootProps,
|
|
160
|
-
children: [/*#__PURE__*/_jsx(FormControlLabel, {
|
|
161
|
-
control: /*#__PURE__*/_jsx(rootProps.slots.baseSwitch, _extends({
|
|
162
|
-
disabled: column.hideable === false,
|
|
163
|
-
checked: columnVisibilityModel[column.field] !== false,
|
|
164
|
-
onClick: toggleColumn,
|
|
165
|
-
name: column.field,
|
|
166
|
-
size: "small",
|
|
167
|
-
inputRef: isFirstHideableColumn(column) ? firstSwitchRef : undefined
|
|
168
|
-
}, (_rootProps$slotProps2 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps2.baseSwitch)),
|
|
169
|
-
label: column.headerName || column.field
|
|
170
|
-
}), !rootProps.disableColumnReorder && GRID_EXPERIMENTAL_ENABLED && /*#__PURE__*/_jsx(GridIconButtonRoot, {
|
|
171
|
-
draggable: true,
|
|
172
|
-
"aria-label": apiRef.current.getLocaleText('columnsPanelDragIconLabel'),
|
|
173
|
-
title: apiRef.current.getLocaleText('columnsPanelDragIconLabel'),
|
|
174
|
-
size: "small",
|
|
175
|
-
disabled: true,
|
|
176
|
-
children: /*#__PURE__*/_jsx(rootProps.slots.columnReorderIcon, {})
|
|
177
|
-
})]
|
|
178
|
-
}, column.field);
|
|
179
|
-
})
|
|
180
|
-
})
|
|
181
|
-
}), disableShowAllButton && disableHideAllButton ? null : /*#__PURE__*/_jsxs(GridPanelFooter, {
|
|
182
|
-
children: [!disableHideAllButton ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
183
|
-
onClick: () => toggleAllColumns(false)
|
|
184
|
-
}, (_rootProps$slotProps3 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps3.baseButton, {
|
|
185
|
-
disabled: disableHideAllButton,
|
|
186
|
-
children: apiRef.current.getLocaleText('columnsPanelHideAllButton')
|
|
187
|
-
})) : /*#__PURE__*/_jsx("span", {}), !disableShowAllButton ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
188
|
-
onClick: () => toggleAllColumns(true)
|
|
189
|
-
}, (_rootProps$slotProps4 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps4.baseButton, {
|
|
190
|
-
disabled: disableShowAllButton,
|
|
191
|
-
children: apiRef.current.getLocaleText('columnsPanelShowAllButton')
|
|
192
|
-
})) : null]
|
|
193
|
-
})]
|
|
11
|
+
return /*#__PURE__*/_jsx(GridPanelWrapper, _extends({}, props, {
|
|
12
|
+
children: /*#__PURE__*/_jsx(GridColumnsManagement, _extends({}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.columnsManagement))
|
|
194
13
|
}));
|
|
195
14
|
}
|
|
196
15
|
process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
|
|
@@ -198,33 +17,6 @@ process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
|
|
|
198
17
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
199
18
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
200
19
|
// ----------------------------------------------------------------------
|
|
201
|
-
|
|
202
|
-
* If `true`, the column search field will be focused automatically.
|
|
203
|
-
* If `false`, the first column switch input will be focused automatically.
|
|
204
|
-
* This helps to avoid input keyboard panel to popup automatically on touch devices.
|
|
205
|
-
* @default true
|
|
206
|
-
*/
|
|
207
|
-
autoFocusSearchField: PropTypes.bool,
|
|
208
|
-
/**
|
|
209
|
-
* If `true`, the `Hide all` button will not be displayed.
|
|
210
|
-
* @default false
|
|
211
|
-
*/
|
|
212
|
-
disableHideAllButton: PropTypes.bool,
|
|
213
|
-
/**
|
|
214
|
-
* If `true`, the `Show all` button will be disabled
|
|
215
|
-
* @default false
|
|
216
|
-
*/
|
|
217
|
-
disableShowAllButton: PropTypes.bool,
|
|
218
|
-
/**
|
|
219
|
-
* Returns the list of togglable columns.
|
|
220
|
-
* If used, only those columns will be displayed in the panel
|
|
221
|
-
* which are passed as the return value of the function.
|
|
222
|
-
* @param {GridColDef[]} columns The `ColDef` list of all columns.
|
|
223
|
-
* @returns {GridColDef['field'][]} The list of togglable columns' field names.
|
|
224
|
-
*/
|
|
225
|
-
getTogglableColumns: PropTypes.func,
|
|
226
|
-
searchPredicate: PropTypes.func,
|
|
227
|
-
slotProps: PropTypes.object,
|
|
228
|
-
sort: PropTypes.oneOf(['asc', 'desc'])
|
|
20
|
+
slotProps: PropTypes.object
|
|
229
21
|
} : void 0;
|
|
230
22
|
export { GridColumnsPanel };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { GridSkeletonCell, GridColumnsPanel, GridFilterPanel, GridFooter, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel, GridRow, GridColumnHeaderFilterIconButton, GridRowCount } from '../components';
|
|
2
|
+
import { GridSkeletonCell, GridColumnsPanel, GridFilterPanel, GridFooter, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel, GridRow, GridColumnHeaderFilterIconButton, GridRowCount, GridColumnsManagement } from '../components';
|
|
3
3
|
import { GridCell } from '../components/cell/GridCell';
|
|
4
4
|
import { GridColumnHeaders } from '../components/GridColumnHeaders';
|
|
5
5
|
import { GridColumnMenu } from '../components/menu/columnMenu/GridColumnMenu';
|
|
@@ -27,6 +27,7 @@ export const DATA_GRID_DEFAULT_SLOTS_COMPONENTS = _extends({}, materialSlots, {
|
|
|
27
27
|
pagination: GridPagination,
|
|
28
28
|
filterPanel: GridFilterPanel,
|
|
29
29
|
columnsPanel: GridColumnsPanel,
|
|
30
|
+
columnsManagement: GridColumnsManagement,
|
|
30
31
|
panel: GridPanel,
|
|
31
32
|
row: GridRow
|
|
32
33
|
});
|
|
@@ -228,13 +228,21 @@ export interface GridClasses {
|
|
|
228
228
|
*/
|
|
229
229
|
columnSeparator: string;
|
|
230
230
|
/**
|
|
231
|
-
* Styles applied to the columns
|
|
231
|
+
* Styles applied to the columns management body.
|
|
232
232
|
*/
|
|
233
|
-
|
|
233
|
+
columnsManagement: string;
|
|
234
234
|
/**
|
|
235
|
-
* Styles applied to the columns
|
|
235
|
+
* Styles applied to the columns management row element.
|
|
236
236
|
*/
|
|
237
|
-
|
|
237
|
+
columnsManagementRow: string;
|
|
238
|
+
/**
|
|
239
|
+
* Styles applied to the columns management header element.
|
|
240
|
+
*/
|
|
241
|
+
columnsManagementHeader: string;
|
|
242
|
+
/**
|
|
243
|
+
* Styles applied to the columns management footer element.
|
|
244
|
+
*/
|
|
245
|
+
columnsManagementFooter: string;
|
|
238
246
|
/**
|
|
239
247
|
* Styles applied to the top container.
|
|
240
248
|
*/
|
package/constants/gridClasses.js
CHANGED
|
@@ -2,4 +2,4 @@ import { unstable_generateUtilityClasses as generateUtilityClasses, unstable_gen
|
|
|
2
2
|
export function getDataGridUtilityClass(slot) {
|
|
3
3
|
return generateUtilityClass('MuiDataGrid', slot);
|
|
4
4
|
}
|
|
5
|
-
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellContent', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnGroupHeader', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeader--showColumnBorder', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', '
|
|
5
|
+
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellContent', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnGroupHeader', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeader--showColumnBorder', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementFooter', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
@@ -27,12 +27,10 @@ export const GRID_DEFAULT_LOCALE_TEXT = {
|
|
|
27
27
|
toolbarExportCSV: 'Download as CSV',
|
|
28
28
|
toolbarExportPrint: 'Print',
|
|
29
29
|
toolbarExportExcel: 'Download as Excel',
|
|
30
|
-
// Columns
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
columnsPanelShowAllButton: 'Show all',
|
|
35
|
-
columnsPanelHideAllButton: 'Hide all',
|
|
30
|
+
// Columns management text
|
|
31
|
+
columnsManagementSearchTitle: 'Search',
|
|
32
|
+
columnsManagementNoColumns: 'No columns',
|
|
33
|
+
columnsManagementShowHideAllText: 'Show/Hide All',
|
|
36
34
|
// Filter panel text
|
|
37
35
|
filterPanelAddFilter: 'Add filter',
|
|
38
36
|
filterPanelRemoveAll: 'Remove all',
|