@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,256 @@
|
|
|
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
|
+
const apiRef = useGridApiContext();
|
|
32
|
+
const searchInputRef = React.useRef(null);
|
|
33
|
+
const columns = useGridSelector(apiRef, gridColumnDefinitionsSelector);
|
|
34
|
+
const initialColumnVisibilityModel = useLazyRef(() => gridColumnVisibilityModelSelector(apiRef)).current;
|
|
35
|
+
const columnVisibilityModel = useGridSelector(apiRef, gridColumnVisibilityModelSelector);
|
|
36
|
+
const rootProps = useGridRootProps();
|
|
37
|
+
const [searchValue, setSearchValue] = React.useState('');
|
|
38
|
+
const classes = useUtilityClasses(rootProps);
|
|
39
|
+
const {
|
|
40
|
+
sort,
|
|
41
|
+
searchPredicate = defaultSearchPredicate,
|
|
42
|
+
autoFocusSearchField = true,
|
|
43
|
+
disableShowHideToggle = false,
|
|
44
|
+
disableResetButton = false,
|
|
45
|
+
getTogglableColumns
|
|
46
|
+
} = props;
|
|
47
|
+
const isResetDisabled = React.useMemo(() => checkColumnVisibilityModelsSame(columnVisibilityModel, initialColumnVisibilityModel), [columnVisibilityModel, initialColumnVisibilityModel]);
|
|
48
|
+
const sortedColumns = React.useMemo(() => {
|
|
49
|
+
switch (sort) {
|
|
50
|
+
case 'asc':
|
|
51
|
+
return [...columns].sort((a, b) => collator.compare(a.headerName || a.field, b.headerName || b.field));
|
|
52
|
+
case 'desc':
|
|
53
|
+
return [...columns].sort((a, b) => -collator.compare(a.headerName || a.field, b.headerName || b.field));
|
|
54
|
+
default:
|
|
55
|
+
return columns;
|
|
56
|
+
}
|
|
57
|
+
}, [columns, sort]);
|
|
58
|
+
const toggleColumn = event => {
|
|
59
|
+
const {
|
|
60
|
+
name: field
|
|
61
|
+
} = event.target;
|
|
62
|
+
apiRef.current.setColumnVisibility(field, columnVisibilityModel[field] === false);
|
|
63
|
+
};
|
|
64
|
+
const toggleAllColumns = React.useCallback(isVisible => {
|
|
65
|
+
const currentModel = gridColumnVisibilityModelSelector(apiRef);
|
|
66
|
+
const newModel = _extends({}, currentModel);
|
|
67
|
+
const togglableColumns = getTogglableColumns ? getTogglableColumns(columns) : null;
|
|
68
|
+
columns.forEach(col => {
|
|
69
|
+
if (col.hideable && (togglableColumns == null || togglableColumns.includes(col.field))) {
|
|
70
|
+
if (isVisible) {
|
|
71
|
+
// delete the key from the model instead of setting it to `true`
|
|
72
|
+
delete newModel[col.field];
|
|
73
|
+
} else {
|
|
74
|
+
newModel[col.field] = false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return apiRef.current.setColumnVisibilityModel(newModel);
|
|
79
|
+
}, [apiRef, columns, getTogglableColumns]);
|
|
80
|
+
const handleSearchValueChange = React.useCallback(event => {
|
|
81
|
+
setSearchValue(event.target.value);
|
|
82
|
+
}, []);
|
|
83
|
+
const currentColumns = React.useMemo(() => {
|
|
84
|
+
const togglableColumns = getTogglableColumns ? getTogglableColumns(sortedColumns) : null;
|
|
85
|
+
const togglableSortedColumns = togglableColumns ? sortedColumns.filter(({
|
|
86
|
+
field
|
|
87
|
+
}) => togglableColumns.includes(field)) : sortedColumns;
|
|
88
|
+
if (!searchValue) {
|
|
89
|
+
return togglableSortedColumns;
|
|
90
|
+
}
|
|
91
|
+
return togglableSortedColumns.filter(column => searchPredicate(column, searchValue.toLowerCase()));
|
|
92
|
+
}, [sortedColumns, searchValue, searchPredicate, getTogglableColumns]);
|
|
93
|
+
const hideableColumns = React.useMemo(() => currentColumns.filter(col => col.hideable), [currentColumns]);
|
|
94
|
+
const allHideableColumnsVisible = React.useMemo(() => hideableColumns.every(column => columnVisibilityModel[column.field] == null || columnVisibilityModel[column.field] !== false), [columnVisibilityModel, hideableColumns]);
|
|
95
|
+
const allHideableColumnsHidden = React.useMemo(() => hideableColumns.every(column => columnVisibilityModel[column.field] === false), [columnVisibilityModel, hideableColumns]);
|
|
96
|
+
const firstSwitchRef = React.useRef(null);
|
|
97
|
+
React.useEffect(() => {
|
|
98
|
+
if (autoFocusSearchField) {
|
|
99
|
+
searchInputRef.current.focus();
|
|
100
|
+
} else if (firstSwitchRef.current && typeof firstSwitchRef.current.focus === 'function') {
|
|
101
|
+
firstSwitchRef.current.focus();
|
|
102
|
+
}
|
|
103
|
+
}, [autoFocusSearchField]);
|
|
104
|
+
let firstHideableColumnFound = false;
|
|
105
|
+
const isFirstHideableColumn = column => {
|
|
106
|
+
if (firstHideableColumnFound === false && column.hideable !== false) {
|
|
107
|
+
firstHideableColumnFound = true;
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
return false;
|
|
111
|
+
};
|
|
112
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
113
|
+
children: [/*#__PURE__*/_jsx(GridColumnsManagementHeader, {
|
|
114
|
+
className: classes.header,
|
|
115
|
+
ownerState: rootProps,
|
|
116
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
|
|
117
|
+
placeholder: apiRef.current.getLocaleText('columnsManagementSearchTitle'),
|
|
118
|
+
inputRef: searchInputRef,
|
|
119
|
+
value: searchValue,
|
|
120
|
+
onChange: handleSearchValueChange,
|
|
121
|
+
variant: "outlined",
|
|
122
|
+
size: "small",
|
|
123
|
+
InputProps: {
|
|
124
|
+
startAdornment: /*#__PURE__*/_jsx(rootProps.slots.baseInputAdornment, {
|
|
125
|
+
position: "start",
|
|
126
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.quickFilterIcon, {})
|
|
127
|
+
}),
|
|
128
|
+
sx: {
|
|
129
|
+
pl: 1.5
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
fullWidth: true
|
|
133
|
+
}, rootProps.slotProps?.baseTextField))
|
|
134
|
+
}), /*#__PURE__*/_jsxs(GridColumnsManagementBody, {
|
|
135
|
+
className: classes.root,
|
|
136
|
+
ownerState: rootProps,
|
|
137
|
+
children: [currentColumns.map(column => /*#__PURE__*/_jsx(FormControlLabel, {
|
|
138
|
+
className: classes.row,
|
|
139
|
+
control: /*#__PURE__*/_jsx(rootProps.slots.baseCheckbox, _extends({
|
|
140
|
+
disabled: column.hideable === false,
|
|
141
|
+
checked: columnVisibilityModel[column.field] !== false,
|
|
142
|
+
onClick: toggleColumn,
|
|
143
|
+
name: column.field,
|
|
144
|
+
sx: {
|
|
145
|
+
p: 0.5
|
|
146
|
+
},
|
|
147
|
+
inputRef: isFirstHideableColumn(column) ? firstSwitchRef : undefined
|
|
148
|
+
}, rootProps.slotProps?.baseCheckbox)),
|
|
149
|
+
label: column.headerName || column.field
|
|
150
|
+
}, column.field)), currentColumns.length === 0 && /*#__PURE__*/_jsx(GridColumnsManagementEmptyText, {
|
|
151
|
+
ownerState: rootProps,
|
|
152
|
+
children: apiRef.current.getLocaleText('columnsManagementNoColumns')
|
|
153
|
+
})]
|
|
154
|
+
}), !disableShowHideToggle && !disableResetButton && currentColumns.length > 0 ? /*#__PURE__*/_jsxs(GridColumnsManagementFooter, {
|
|
155
|
+
ownerState: rootProps,
|
|
156
|
+
className: classes.footer,
|
|
157
|
+
children: [!disableShowHideToggle ? /*#__PURE__*/_jsx(FormControlLabel, {
|
|
158
|
+
control: /*#__PURE__*/_jsx(rootProps.slots.baseCheckbox, _extends({
|
|
159
|
+
disabled: hideableColumns.length === 0,
|
|
160
|
+
checked: allHideableColumnsVisible,
|
|
161
|
+
indeterminate: !allHideableColumnsVisible && !allHideableColumnsHidden,
|
|
162
|
+
onClick: () => toggleAllColumns(!allHideableColumnsVisible),
|
|
163
|
+
name: apiRef.current.getLocaleText('columnsManagementShowHideAllText')
|
|
164
|
+
}, rootProps.slotProps?.baseCheckbox)),
|
|
165
|
+
sx: {
|
|
166
|
+
[`.MuiFormControlLabel-label`]: {
|
|
167
|
+
textTransform: 'uppercase',
|
|
168
|
+
fontSize: '14px'
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
label: apiRef.current.getLocaleText('columnsManagementShowHideAllText')
|
|
172
|
+
}) : /*#__PURE__*/_jsx("span", {}), !disableResetButton ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
173
|
+
onClick: () => apiRef.current.setColumnVisibilityModel(initialColumnVisibilityModel),
|
|
174
|
+
disabled: isResetDisabled
|
|
175
|
+
}, rootProps.slotProps?.baseButton, {
|
|
176
|
+
children: "Reset"
|
|
177
|
+
})) : null]
|
|
178
|
+
}) : null]
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
process.env.NODE_ENV !== "production" ? GridColumnsManagement.propTypes = {
|
|
182
|
+
// ----------------------------- Warning --------------------------------
|
|
183
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
184
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
185
|
+
// ----------------------------------------------------------------------
|
|
186
|
+
/**
|
|
187
|
+
* If `true`, the column search field will be focused automatically.
|
|
188
|
+
* If `false`, the first column switch input will be focused automatically.
|
|
189
|
+
* This helps to avoid input keyboard panel to popup automatically on touch devices.
|
|
190
|
+
* @default true
|
|
191
|
+
*/
|
|
192
|
+
autoFocusSearchField: PropTypes.bool,
|
|
193
|
+
/**
|
|
194
|
+
* If `true`, the `Reset` button will not be disabled
|
|
195
|
+
* @default false
|
|
196
|
+
*/
|
|
197
|
+
disableResetButton: PropTypes.bool,
|
|
198
|
+
/**
|
|
199
|
+
* If `true`, the `Show/Hide all` toggle checkbox will not be displayed.
|
|
200
|
+
* @default false
|
|
201
|
+
*/
|
|
202
|
+
disableShowHideToggle: PropTypes.bool,
|
|
203
|
+
/**
|
|
204
|
+
* Returns the list of togglable columns.
|
|
205
|
+
* If used, only those columns will be displayed in the panel
|
|
206
|
+
* which are passed as the return value of the function.
|
|
207
|
+
* @param {GridColDef[]} columns The `ColDef` list of all columns.
|
|
208
|
+
* @returns {GridColDef['field'][]} The list of togglable columns' field names.
|
|
209
|
+
*/
|
|
210
|
+
getTogglableColumns: PropTypes.func,
|
|
211
|
+
searchPredicate: PropTypes.func,
|
|
212
|
+
sort: PropTypes.oneOf(['asc', 'desc'])
|
|
213
|
+
} : void 0;
|
|
214
|
+
const GridColumnsManagementBody = styled('div', {
|
|
215
|
+
name: 'MuiDataGrid',
|
|
216
|
+
slot: 'ColumnsManagement',
|
|
217
|
+
overridesResolver: (props, styles) => styles.columnsManagement
|
|
218
|
+
})(({
|
|
219
|
+
theme
|
|
220
|
+
}) => ({
|
|
221
|
+
padding: theme.spacing(0, 3, 1.5),
|
|
222
|
+
display: 'flex',
|
|
223
|
+
flexDirection: 'column',
|
|
224
|
+
overflow: 'auto',
|
|
225
|
+
flex: '1 1',
|
|
226
|
+
maxHeight: 400,
|
|
227
|
+
alignItems: 'flex-start'
|
|
228
|
+
}));
|
|
229
|
+
const GridColumnsManagementHeader = styled('div', {
|
|
230
|
+
name: 'MuiDataGrid',
|
|
231
|
+
slot: 'ColumnsManagementHeader',
|
|
232
|
+
overridesResolver: (props, styles) => styles.columnsManagementHeader
|
|
233
|
+
})(({
|
|
234
|
+
theme
|
|
235
|
+
}) => ({
|
|
236
|
+
padding: theme.spacing(1.5, 3)
|
|
237
|
+
}));
|
|
238
|
+
const GridColumnsManagementFooter = styled('div', {
|
|
239
|
+
name: 'MuiDataGrid',
|
|
240
|
+
slot: 'ColumnsManagementFooter',
|
|
241
|
+
overridesResolver: (props, styles) => styles.columnsManagementFooter
|
|
242
|
+
})(({
|
|
243
|
+
theme
|
|
244
|
+
}) => ({
|
|
245
|
+
padding: theme.spacing(0.5, 1, 0.5, 2.4),
|
|
246
|
+
display: 'flex',
|
|
247
|
+
justifyContent: 'space-between',
|
|
248
|
+
borderTop: `1px solid ${theme.palette.divider}`
|
|
249
|
+
}));
|
|
250
|
+
const GridColumnsManagementEmptyText = styled('div')(({
|
|
251
|
+
theme
|
|
252
|
+
}) => ({
|
|
253
|
+
padding: theme.spacing(0.5, 0),
|
|
254
|
+
color: theme.palette.grey[500]
|
|
255
|
+
}));
|
|
256
|
+
export { GridColumnsManagement };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './GridColumnsManagement';
|
|
@@ -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;
|
|
@@ -1,192 +1,14 @@
|
|
|
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
|
-
const apiRef = useGridApiContext();
|
|
63
|
-
const searchInputRef = React.useRef(null);
|
|
64
|
-
const columns = useGridSelector(apiRef, gridColumnDefinitionsSelector);
|
|
65
|
-
const columnVisibilityModel = useGridSelector(apiRef, gridColumnVisibilityModelSelector);
|
|
66
9
|
const rootProps = useGridRootProps();
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const {
|
|
70
|
-
sort,
|
|
71
|
-
searchPredicate = defaultSearchPredicate,
|
|
72
|
-
autoFocusSearchField = true,
|
|
73
|
-
disableHideAllButton = false,
|
|
74
|
-
disableShowAllButton = false,
|
|
75
|
-
getTogglableColumns
|
|
76
|
-
} = props,
|
|
77
|
-
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
78
|
-
const sortedColumns = React.useMemo(() => {
|
|
79
|
-
switch (sort) {
|
|
80
|
-
case 'asc':
|
|
81
|
-
return [...columns].sort((a, b) => collator.compare(a.headerName || a.field, b.headerName || b.field));
|
|
82
|
-
case 'desc':
|
|
83
|
-
return [...columns].sort((a, b) => -collator.compare(a.headerName || a.field, b.headerName || b.field));
|
|
84
|
-
default:
|
|
85
|
-
return columns;
|
|
86
|
-
}
|
|
87
|
-
}, [columns, sort]);
|
|
88
|
-
const toggleColumn = event => {
|
|
89
|
-
const {
|
|
90
|
-
name: field
|
|
91
|
-
} = event.target;
|
|
92
|
-
apiRef.current.setColumnVisibility(field, columnVisibilityModel[field] === false);
|
|
93
|
-
};
|
|
94
|
-
const toggleAllColumns = React.useCallback(isVisible => {
|
|
95
|
-
const currentModel = gridColumnVisibilityModelSelector(apiRef);
|
|
96
|
-
const newModel = _extends({}, currentModel);
|
|
97
|
-
const togglableColumns = getTogglableColumns ? getTogglableColumns(columns) : null;
|
|
98
|
-
columns.forEach(col => {
|
|
99
|
-
if (col.hideable && (togglableColumns == null || togglableColumns.includes(col.field))) {
|
|
100
|
-
if (isVisible) {
|
|
101
|
-
// delete the key from the model instead of setting it to `true`
|
|
102
|
-
delete newModel[col.field];
|
|
103
|
-
} else {
|
|
104
|
-
newModel[col.field] = false;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
return apiRef.current.setColumnVisibilityModel(newModel);
|
|
109
|
-
}, [apiRef, columns, getTogglableColumns]);
|
|
110
|
-
const handleSearchValueChange = React.useCallback(event => {
|
|
111
|
-
setSearchValue(event.target.value);
|
|
112
|
-
}, []);
|
|
113
|
-
const currentColumns = React.useMemo(() => {
|
|
114
|
-
const togglableColumns = getTogglableColumns ? getTogglableColumns(sortedColumns) : null;
|
|
115
|
-
const togglableSortedColumns = togglableColumns ? sortedColumns.filter(({
|
|
116
|
-
field
|
|
117
|
-
}) => togglableColumns.includes(field)) : sortedColumns;
|
|
118
|
-
if (!searchValue) {
|
|
119
|
-
return togglableSortedColumns;
|
|
120
|
-
}
|
|
121
|
-
return togglableSortedColumns.filter(column => searchPredicate(column, searchValue.toLowerCase()));
|
|
122
|
-
}, [sortedColumns, searchValue, searchPredicate, getTogglableColumns]);
|
|
123
|
-
const firstSwitchRef = React.useRef(null);
|
|
124
|
-
React.useEffect(() => {
|
|
125
|
-
if (autoFocusSearchField) {
|
|
126
|
-
searchInputRef.current.focus();
|
|
127
|
-
} else if (firstSwitchRef.current && typeof firstSwitchRef.current.focus === 'function') {
|
|
128
|
-
firstSwitchRef.current.focus();
|
|
129
|
-
}
|
|
130
|
-
}, [autoFocusSearchField]);
|
|
131
|
-
let firstHideableColumnFound = false;
|
|
132
|
-
const isFirstHideableColumn = column => {
|
|
133
|
-
if (firstHideableColumnFound === false && column.hideable !== false) {
|
|
134
|
-
firstHideableColumnFound = true;
|
|
135
|
-
return true;
|
|
136
|
-
}
|
|
137
|
-
return false;
|
|
138
|
-
};
|
|
139
|
-
return /*#__PURE__*/_jsxs(GridPanelWrapper, _extends({}, other, {
|
|
140
|
-
children: [/*#__PURE__*/_jsx(GridPanelHeader, {
|
|
141
|
-
children: /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
|
|
142
|
-
label: apiRef.current.getLocaleText('columnsPanelTextFieldLabel'),
|
|
143
|
-
placeholder: apiRef.current.getLocaleText('columnsPanelTextFieldPlaceholder'),
|
|
144
|
-
inputRef: searchInputRef,
|
|
145
|
-
value: searchValue,
|
|
146
|
-
onChange: handleSearchValueChange,
|
|
147
|
-
variant: "standard",
|
|
148
|
-
fullWidth: true
|
|
149
|
-
}, rootProps.slotProps?.baseTextField))
|
|
150
|
-
}), /*#__PURE__*/_jsx(GridPanelContent, {
|
|
151
|
-
children: /*#__PURE__*/_jsx(GridColumnsPanelRoot, {
|
|
152
|
-
className: classes.root,
|
|
153
|
-
ownerState: rootProps,
|
|
154
|
-
children: currentColumns.map(column => /*#__PURE__*/_jsxs(GridColumnsPanelRowRoot, {
|
|
155
|
-
className: classes.columnsPanelRow,
|
|
156
|
-
ownerState: rootProps,
|
|
157
|
-
children: [/*#__PURE__*/_jsx(FormControlLabel, {
|
|
158
|
-
control: /*#__PURE__*/_jsx(rootProps.slots.baseSwitch, _extends({
|
|
159
|
-
disabled: column.hideable === false,
|
|
160
|
-
checked: columnVisibilityModel[column.field] !== false,
|
|
161
|
-
onClick: toggleColumn,
|
|
162
|
-
name: column.field,
|
|
163
|
-
size: "small",
|
|
164
|
-
inputRef: isFirstHideableColumn(column) ? firstSwitchRef : undefined
|
|
165
|
-
}, rootProps.slotProps?.baseSwitch)),
|
|
166
|
-
label: column.headerName || column.field
|
|
167
|
-
}), !rootProps.disableColumnReorder && GRID_EXPERIMENTAL_ENABLED && /*#__PURE__*/_jsx(GridIconButtonRoot, {
|
|
168
|
-
draggable: true,
|
|
169
|
-
"aria-label": apiRef.current.getLocaleText('columnsPanelDragIconLabel'),
|
|
170
|
-
title: apiRef.current.getLocaleText('columnsPanelDragIconLabel'),
|
|
171
|
-
size: "small",
|
|
172
|
-
disabled: true,
|
|
173
|
-
children: /*#__PURE__*/_jsx(rootProps.slots.columnReorderIcon, {})
|
|
174
|
-
})]
|
|
175
|
-
}, column.field))
|
|
176
|
-
})
|
|
177
|
-
}), disableShowAllButton && disableHideAllButton ? null : /*#__PURE__*/_jsxs(GridPanelFooter, {
|
|
178
|
-
children: [!disableHideAllButton ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
179
|
-
onClick: () => toggleAllColumns(false)
|
|
180
|
-
}, rootProps.slotProps?.baseButton, {
|
|
181
|
-
disabled: disableHideAllButton,
|
|
182
|
-
children: apiRef.current.getLocaleText('columnsPanelHideAllButton')
|
|
183
|
-
})) : /*#__PURE__*/_jsx("span", {}), !disableShowAllButton ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
184
|
-
onClick: () => toggleAllColumns(true)
|
|
185
|
-
}, rootProps.slotProps?.baseButton, {
|
|
186
|
-
disabled: disableShowAllButton,
|
|
187
|
-
children: apiRef.current.getLocaleText('columnsPanelShowAllButton')
|
|
188
|
-
})) : null]
|
|
189
|
-
})]
|
|
10
|
+
return /*#__PURE__*/_jsx(GridPanelWrapper, _extends({}, props, {
|
|
11
|
+
children: /*#__PURE__*/_jsx(GridColumnsManagement, _extends({}, rootProps.slotProps?.columnsManagement))
|
|
190
12
|
}));
|
|
191
13
|
}
|
|
192
14
|
process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
|
|
@@ -194,33 +16,6 @@ process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
|
|
|
194
16
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
195
17
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
196
18
|
// ----------------------------------------------------------------------
|
|
197
|
-
|
|
198
|
-
* If `true`, the column search field will be focused automatically.
|
|
199
|
-
* If `false`, the first column switch input will be focused automatically.
|
|
200
|
-
* This helps to avoid input keyboard panel to popup automatically on touch devices.
|
|
201
|
-
* @default true
|
|
202
|
-
*/
|
|
203
|
-
autoFocusSearchField: PropTypes.bool,
|
|
204
|
-
/**
|
|
205
|
-
* If `true`, the `Hide all` button will not be displayed.
|
|
206
|
-
* @default false
|
|
207
|
-
*/
|
|
208
|
-
disableHideAllButton: PropTypes.bool,
|
|
209
|
-
/**
|
|
210
|
-
* If `true`, the `Show all` button will be disabled
|
|
211
|
-
* @default false
|
|
212
|
-
*/
|
|
213
|
-
disableShowAllButton: PropTypes.bool,
|
|
214
|
-
/**
|
|
215
|
-
* Returns the list of togglable columns.
|
|
216
|
-
* If used, only those columns will be displayed in the panel
|
|
217
|
-
* which are passed as the return value of the function.
|
|
218
|
-
* @param {GridColDef[]} columns The `ColDef` list of all columns.
|
|
219
|
-
* @returns {GridColDef['field'][]} The list of togglable columns' field names.
|
|
220
|
-
*/
|
|
221
|
-
getTogglableColumns: PropTypes.func,
|
|
222
|
-
searchPredicate: PropTypes.func,
|
|
223
|
-
slotProps: PropTypes.object,
|
|
224
|
-
sort: PropTypes.oneOf(['asc', 'desc'])
|
|
19
|
+
slotProps: PropTypes.object
|
|
225
20
|
} : void 0;
|
|
226
21
|
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
|
});
|
|
@@ -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',
|
|
@@ -98,6 +98,9 @@ export function useGridApiInitialization(inputApiRef, props) {
|
|
|
98
98
|
subscribeEvent,
|
|
99
99
|
publishEvent
|
|
100
100
|
}, 'public');
|
|
101
|
+
if (inputApiRef && !inputApiRef.current?.state) {
|
|
102
|
+
inputApiRef.current = publicApiRef.current;
|
|
103
|
+
}
|
|
101
104
|
React.useImperativeHandle(inputApiRef, () => publicApiRef.current, [publicApiRef]);
|
|
102
105
|
React.useEffect(() => {
|
|
103
106
|
const api = privateApiRef.current;
|
|
@@ -131,7 +131,10 @@ export const getTreeNodeDescendants = (tree, parentId, skipAutoGeneratedRows) =>
|
|
|
131
131
|
if (!skipAutoGeneratedRows || !isAutoGeneratedRow(tree[child])) {
|
|
132
132
|
validDescendants.push(child);
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
const childDescendants = getTreeNodeDescendants(tree, child, skipAutoGeneratedRows);
|
|
135
|
+
for (let j = 0; j < childDescendants.length; j += 1) {
|
|
136
|
+
validDescendants.push(childDescendants[j]);
|
|
137
|
+
}
|
|
135
138
|
}
|
|
136
139
|
if (!skipAutoGeneratedRows && node.footerId != null) {
|
|
137
140
|
validDescendants.push(node.footerId);
|
package/modern/index.js
CHANGED
package/modern/locales/arSD.js
CHANGED
|
@@ -29,12 +29,11 @@ const arSDGrid = {
|
|
|
29
29
|
toolbarExportCSV: 'تنزيل كملف CSV',
|
|
30
30
|
toolbarExportPrint: 'طباعة',
|
|
31
31
|
toolbarExportExcel: 'تحميل كملف الإكسل',
|
|
32
|
-
// Columns
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
columnsPanelHideAllButton: 'إخفاء الكل',
|
|
32
|
+
// Columns management text
|
|
33
|
+
// columnsManagementSearchTitle: 'Search',
|
|
34
|
+
// columnsManagementNoColumns: 'No columns',
|
|
35
|
+
// columnsManagementShowHideAllText: 'Show/Hide All',
|
|
36
|
+
|
|
38
37
|
// Filter panel text
|
|
39
38
|
filterPanelAddFilter: 'إضافة مرشِح',
|
|
40
39
|
filterPanelRemoveAll: 'حذف الكل',
|
package/modern/locales/beBY.js
CHANGED
|
@@ -43,12 +43,11 @@ const beBYGrid = {
|
|
|
43
43
|
toolbarExportCSV: 'Спампаваць у фармаце CSV',
|
|
44
44
|
toolbarExportPrint: 'Друк',
|
|
45
45
|
toolbarExportExcel: 'Спампаваць у фармаце Excel',
|
|
46
|
-
// Columns
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
columnsPanelHideAllButton: 'Схаваць усе',
|
|
46
|
+
// Columns management text
|
|
47
|
+
// columnsManagementSearchTitle: 'Search',
|
|
48
|
+
// columnsManagementNoColumns: 'No columns',
|
|
49
|
+
// columnsManagementShowHideAllText: 'Show/Hide All',
|
|
50
|
+
|
|
52
51
|
// Filter panel text
|
|
53
52
|
filterPanelAddFilter: 'Дадаць фільтр',
|
|
54
53
|
// filterPanelRemoveAll: 'Remove all',
|