@mui/x-data-grid 6.4.0 → 6.5.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 +56 -0
- package/DataGrid/useDataGridProps.js +5 -12
- package/colDef/gridNumericOperators.js +0 -6
- package/components/cell/GridEditInputCell.js +4 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +15 -2
- package/components/panel/filterPanel/GridFilterInputBoolean.js +80 -36
- package/components/panel/filterPanel/GridFilterInputDate.d.ts +8 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +27 -6
- package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +8 -1
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +55 -32
- package/components/panel/filterPanel/GridFilterInputValue.d.ts +11 -4
- package/components/panel/filterPanel/GridFilterInputValue.js +29 -6
- package/components/panel/filterPanel/GridFilterPanel.d.ts +2 -1
- package/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/components/panel/filterPanel/index.d.ts +3 -1
- package/components/panel/filterPanel/index.js +2 -1
- package/constants/localeTextConstants.js +26 -0
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +9 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -2
- package/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/hooks/features/editing/useGridEditing.js +0 -3
- package/hooks/features/focus/gridFocusState.d.ts +2 -0
- package/hooks/features/focus/gridFocusStateSelector.d.ts +2 -0
- package/hooks/features/focus/gridFocusStateSelector.js +6 -0
- package/hooks/features/focus/useGridFocus.js +55 -9
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +4 -0
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +5 -0
- package/hooks/features/headerFiltering/index.d.ts +1 -0
- package/hooks/features/headerFiltering/index.js +1 -0
- package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +6 -0
- package/hooks/features/headerFiltering/useGridHeaderFiltering.js +91 -0
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +2 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +113 -4
- package/hooks/features/rows/useGridRows.js +16 -1
- package/index.js +1 -1
- package/internals/index.d.ts +6 -1
- package/internals/index.js +4 -0
- package/internals/utils/index.d.ts +1 -0
- package/internals/utils/index.js +2 -1
- package/internals/utils/useProps.d.ts +8 -0
- package/internals/utils/useProps.js +13 -0
- package/legacy/DataGrid/useDataGridProps.js +8 -8
- package/legacy/colDef/gridNumericOperators.js +0 -6
- package/legacy/components/cell/GridEditInputCell.js +4 -1
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +79 -35
- package/legacy/components/panel/filterPanel/GridFilterInputDate.js +26 -5
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +54 -31
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +28 -5
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/legacy/components/panel/filterPanel/index.js +2 -1
- package/legacy/constants/localeTextConstants.js +26 -0
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -5
- package/legacy/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/legacy/hooks/features/editing/useGridEditing.js +0 -3
- package/legacy/hooks/features/focus/gridFocusStateSelector.js +10 -0
- package/legacy/hooks/features/focus/useGridFocus.js +58 -9
- package/legacy/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +11 -0
- package/legacy/hooks/features/headerFiltering/index.js +1 -0
- package/legacy/hooks/features/headerFiltering/useGridHeaderFiltering.js +93 -0
- package/legacy/hooks/features/index.js +2 -1
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +113 -4
- package/legacy/hooks/features/rows/useGridRows.js +16 -1
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +4 -0
- package/legacy/internals/utils/index.js +2 -1
- package/legacy/internals/utils/useProps.js +11 -0
- package/legacy/locales/arSD.js +28 -0
- package/legacy/locales/beBY.js +28 -0
- package/legacy/locales/bgBG.js +28 -0
- package/legacy/locales/csCZ.js +36 -8
- package/legacy/locales/daDK.js +28 -0
- package/legacy/locales/deDE.js +28 -0
- package/legacy/locales/elGR.js +27 -0
- package/legacy/locales/esES.js +28 -0
- package/legacy/locales/faIR.js +28 -0
- package/legacy/locales/fiFI.js +28 -0
- package/legacy/locales/frFR.js +28 -0
- package/legacy/locales/heIL.js +30 -2
- package/legacy/locales/huHU.js +28 -0
- package/legacy/locales/itIT.js +28 -0
- package/legacy/locales/jaJP.js +28 -0
- package/legacy/locales/koKR.js +28 -0
- package/legacy/locales/nbNO.js +28 -0
- package/legacy/locales/nlNL.js +28 -0
- package/legacy/locales/plPL.js +28 -0
- package/legacy/locales/ptBR.js +28 -0
- package/legacy/locales/roRO.js +28 -0
- package/legacy/locales/ruRU.js +28 -0
- package/legacy/locales/skSK.js +28 -0
- package/legacy/locales/svSE.js +28 -0
- package/legacy/locales/trTR.js +28 -0
- package/legacy/locales/ukUA.js +28 -0
- package/legacy/locales/urPK.js +28 -0
- package/legacy/locales/viVN.js +27 -0
- package/legacy/locales/zhCN.js +28 -0
- package/legacy/locales/zhTW.js +28 -0
- package/legacy/material/index.js +2 -0
- package/legacy/models/api/gridHeaderFilteringApi.js +1 -0
- package/legacy/models/gridHeaderFilteringModel.js +1 -0
- package/legacy/models/index.js +0 -1
- package/locales/arSD.js +28 -0
- package/locales/beBY.js +28 -0
- package/locales/bgBG.js +28 -0
- package/locales/csCZ.js +36 -8
- package/locales/daDK.js +28 -0
- package/locales/deDE.js +28 -0
- package/locales/elGR.js +27 -0
- package/locales/esES.js +28 -0
- package/locales/faIR.js +28 -0
- package/locales/fiFI.js +28 -0
- package/locales/frFR.js +28 -0
- package/locales/heIL.js +30 -2
- package/locales/huHU.js +28 -0
- package/locales/itIT.js +28 -0
- package/locales/jaJP.js +28 -0
- package/locales/koKR.js +28 -0
- package/locales/nbNO.js +28 -0
- package/locales/nlNL.js +28 -0
- package/locales/plPL.js +28 -0
- package/locales/ptBR.js +28 -0
- package/locales/roRO.js +28 -0
- package/locales/ruRU.js +28 -0
- package/locales/skSK.js +28 -0
- package/locales/svSE.js +28 -0
- package/locales/trTR.js +28 -0
- package/locales/ukUA.js +28 -0
- package/locales/urPK.js +28 -0
- package/locales/viVN.js +27 -0
- package/locales/zhCN.js +28 -0
- package/locales/zhTW.js +28 -0
- package/material/index.d.ts +3 -66
- package/material/index.js +2 -0
- package/models/api/gridApiCommon.d.ts +3 -2
- package/models/api/gridCoreApi.d.ts +4 -0
- package/models/api/gridFocusApi.d.ts +6 -0
- package/models/api/gridHeaderFilteringApi.d.ts +30 -0
- package/models/api/gridHeaderFilteringApi.js +1 -0
- package/models/api/gridLocaleTextApi.d.ts +25 -0
- package/models/events/gridEventLookup.d.ts +27 -1
- package/models/gridFilterOperator.d.ts +4 -0
- package/models/gridHeaderFilteringModel.d.ts +5 -0
- package/models/gridHeaderFilteringModel.js +1 -0
- package/models/gridSlotsComponent.d.ts +16 -4
- package/models/gridStateCommunity.d.ts +2 -0
- package/models/index.d.ts +1 -1
- package/models/index.js +0 -1
- package/modern/DataGrid/useDataGridProps.js +5 -12
- package/modern/colDef/gridNumericOperators.js +0 -6
- package/modern/components/cell/GridEditInputCell.js +4 -1
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +80 -36
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +27 -6
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +55 -32
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +29 -6
- package/modern/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/modern/components/panel/filterPanel/index.js +2 -1
- package/modern/constants/localeTextConstants.js +26 -0
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/modern/hooks/features/editing/useGridEditing.js +0 -3
- package/modern/hooks/features/focus/gridFocusStateSelector.js +6 -0
- package/modern/hooks/features/focus/useGridFocus.js +55 -9
- package/modern/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +5 -0
- package/modern/hooks/features/headerFiltering/index.js +1 -0
- package/modern/hooks/features/headerFiltering/useGridHeaderFiltering.js +90 -0
- package/modern/hooks/features/index.js +2 -1
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +113 -4
- package/modern/hooks/features/rows/useGridRows.js +16 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +4 -0
- package/modern/internals/utils/index.js +2 -1
- package/modern/internals/utils/useProps.js +13 -0
- package/modern/locales/arSD.js +28 -0
- package/modern/locales/beBY.js +28 -0
- package/modern/locales/bgBG.js +28 -0
- package/modern/locales/csCZ.js +36 -8
- package/modern/locales/daDK.js +28 -0
- package/modern/locales/deDE.js +28 -0
- package/modern/locales/elGR.js +27 -0
- package/modern/locales/esES.js +28 -0
- package/modern/locales/faIR.js +28 -0
- package/modern/locales/fiFI.js +28 -0
- package/modern/locales/frFR.js +28 -0
- package/modern/locales/heIL.js +30 -2
- package/modern/locales/huHU.js +28 -0
- package/modern/locales/itIT.js +28 -0
- package/modern/locales/jaJP.js +28 -0
- package/modern/locales/koKR.js +28 -0
- package/modern/locales/nbNO.js +28 -0
- package/modern/locales/nlNL.js +28 -0
- package/modern/locales/plPL.js +28 -0
- package/modern/locales/ptBR.js +28 -0
- package/modern/locales/roRO.js +28 -0
- package/modern/locales/ruRU.js +28 -0
- package/modern/locales/skSK.js +28 -0
- package/modern/locales/svSE.js +28 -0
- package/modern/locales/trTR.js +28 -0
- package/modern/locales/ukUA.js +28 -0
- package/modern/locales/urPK.js +28 -0
- package/modern/locales/viVN.js +27 -0
- package/modern/locales/zhCN.js +28 -0
- package/modern/locales/zhTW.js +28 -0
- package/modern/material/index.js +2 -0
- package/modern/models/api/gridHeaderFilteringApi.js +1 -0
- package/modern/models/gridHeaderFilteringModel.js +1 -0
- package/modern/models/index.js +0 -1
- package/node/DataGrid/useDataGridProps.js +4 -11
- package/node/colDef/gridNumericOperators.js +0 -6
- package/node/components/cell/GridEditInputCell.js +4 -1
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +78 -35
- package/node/components/panel/filterPanel/GridFilterInputDate.js +27 -6
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +55 -32
- package/node/components/panel/filterPanel/GridFilterInputValue.js +29 -6
- package/node/components/panel/filterPanel/GridFilterPanel.js +2 -1
- package/node/components/panel/filterPanel/index.js +26 -8
- package/node/constants/localeTextConstants.js +26 -0
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -2
- package/node/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/node/hooks/features/editing/useGridEditing.js +0 -3
- package/node/hooks/features/focus/gridFocusStateSelector.js +9 -1
- package/node/hooks/features/focus/useGridFocus.js +55 -9
- package/node/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +15 -0
- package/node/hooks/features/headerFiltering/index.js +16 -0
- package/node/hooks/features/headerFiltering/useGridHeaderFiltering.js +101 -0
- package/node/hooks/features/index.js +11 -0
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +113 -4
- package/node/hooks/features/rows/useGridRows.js +16 -1
- package/node/index.js +1 -1
- package/node/internals/index.js +46 -0
- package/node/internals/utils/index.js +11 -0
- package/node/internals/utils/useProps.js +22 -0
- package/node/locales/arSD.js +28 -0
- package/node/locales/beBY.js +28 -0
- package/node/locales/bgBG.js +28 -0
- package/node/locales/csCZ.js +36 -8
- package/node/locales/daDK.js +28 -0
- package/node/locales/deDE.js +28 -0
- package/node/locales/elGR.js +27 -0
- package/node/locales/esES.js +28 -0
- package/node/locales/faIR.js +28 -0
- package/node/locales/fiFI.js +28 -0
- package/node/locales/frFR.js +28 -0
- package/node/locales/heIL.js +30 -2
- package/node/locales/huHU.js +28 -0
- package/node/locales/itIT.js +28 -0
- package/node/locales/jaJP.js +28 -0
- package/node/locales/koKR.js +28 -0
- package/node/locales/nbNO.js +28 -0
- package/node/locales/nlNL.js +28 -0
- package/node/locales/plPL.js +28 -0
- package/node/locales/ptBR.js +28 -0
- package/node/locales/roRO.js +28 -0
- package/node/locales/ruRU.js +28 -0
- package/node/locales/skSK.js +28 -0
- package/node/locales/svSE.js +28 -0
- package/node/locales/trTR.js +28 -0
- package/node/locales/ukUA.js +28 -0
- package/node/locales/urPK.js +28 -0
- package/node/locales/viVN.js +27 -0
- package/node/locales/zhCN.js +28 -0
- package/node/locales/zhTW.js +28 -0
- package/node/material/index.js +2 -0
- package/node/models/api/gridHeaderFilteringApi.js +5 -0
- package/node/models/gridHeaderFilteringModel.js +5 -0
- package/node/models/index.js +0 -11
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@ import { gridPinnedRowsSelector } from '../rows/gridRowsSelector';
|
|
|
14
14
|
import { unstable_gridFocusColumnGroupHeaderSelector } from '../focus';
|
|
15
15
|
import { gridColumnGroupsHeaderMaxDepthSelector } from '../columnGrouping/gridColumnGroupsSelector';
|
|
16
16
|
import { useGridSelector } from '../../utils/useGridSelector';
|
|
17
|
+
import { unstable_gridHeaderFilteringEditFieldSelector, unstable_gridHeaderFilteringMenuSelector } from '../headerFiltering/gridHeaderFilteringSelectors';
|
|
17
18
|
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
18
19
|
function enrichPageRowsWithPinnedRows(apiRef, rows) {
|
|
19
20
|
const pinnedRows = gridPinnedRowsSelector(apiRef) || {};
|
|
@@ -68,6 +69,9 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
68
69
|
const initialCurrentPageRows = useGridVisibleRows(apiRef, props).rows;
|
|
69
70
|
const theme = useTheme();
|
|
70
71
|
const currentPageRows = React.useMemo(() => enrichPageRowsWithPinnedRows(apiRef, initialCurrentPageRows), [apiRef, initialCurrentPageRows]);
|
|
72
|
+
const headerFilteringEnabled =
|
|
73
|
+
// @ts-expect-error // TODO move relevant code to the `DataGridPro`
|
|
74
|
+
props.signature !== 'DataGrid' && props.unstable_headerFilters;
|
|
71
75
|
|
|
72
76
|
/**
|
|
73
77
|
* @param {number} colIndex Index of the column to focus
|
|
@@ -104,6 +108,14 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
104
108
|
const field = apiRef.current.getVisibleColumns()[colIndex].field;
|
|
105
109
|
apiRef.current.setColumnHeaderFocus(field, event);
|
|
106
110
|
}, [apiRef, logger]);
|
|
111
|
+
const goToHeaderFilter = React.useCallback((colIndex, event) => {
|
|
112
|
+
logger.debug(`Navigating to header filter col ${colIndex}`);
|
|
113
|
+
apiRef.current.scrollToIndexes({
|
|
114
|
+
colIndex
|
|
115
|
+
});
|
|
116
|
+
const field = apiRef.current.getVisibleColumns()[colIndex].field;
|
|
117
|
+
apiRef.current.setColumnHeaderFilterFocus(field, event);
|
|
118
|
+
}, [apiRef, logger]);
|
|
107
119
|
const goToGroupHeader = React.useCallback((colIndex, depth, event) => {
|
|
108
120
|
logger.debug(`Navigating to header col ${colIndex}`);
|
|
109
121
|
apiRef.current.scrollToIndexes({
|
|
@@ -115,7 +127,7 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
115
127
|
apiRef.current.setColumnGroupHeaderFocus(field, depth, event);
|
|
116
128
|
}, [apiRef, logger]);
|
|
117
129
|
const getRowIdFromIndex = React.useCallback(rowIndex => {
|
|
118
|
-
return currentPageRows[rowIndex].id;
|
|
130
|
+
return currentPageRows == null ? void 0 : currentPageRows[rowIndex].id;
|
|
119
131
|
}, [currentPageRows]);
|
|
120
132
|
const handleColumnHeaderKeyDown = React.useCallback((params, event) => {
|
|
121
133
|
const headerTitleNode = event.currentTarget.querySelector(`.${gridClasses.columnHeaderTitleContainerContent}`);
|
|
@@ -141,7 +153,11 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
141
153
|
case 'ArrowDown':
|
|
142
154
|
{
|
|
143
155
|
if (firstRowIndexInPage !== null) {
|
|
144
|
-
|
|
156
|
+
if (headerFilteringEnabled) {
|
|
157
|
+
goToHeaderFilter(colIndexBefore, event);
|
|
158
|
+
} else {
|
|
159
|
+
goToCell(colIndexBefore, getRowIdFromIndex(firstRowIndexInPage));
|
|
160
|
+
}
|
|
145
161
|
}
|
|
146
162
|
break;
|
|
147
163
|
}
|
|
@@ -215,7 +231,97 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
215
231
|
if (shouldPreventDefault) {
|
|
216
232
|
event.preventDefault();
|
|
217
233
|
}
|
|
218
|
-
}, [apiRef, currentPageRows.length,
|
|
234
|
+
}, [apiRef, currentPageRows.length, headerFilteringEnabled, goToHeaderFilter, goToCell, getRowIdFromIndex, theme.direction, goToHeader, goToGroupHeader]);
|
|
235
|
+
const handleHeaderFilterKeyDown = React.useCallback((params, event) => {
|
|
236
|
+
const dimensions = apiRef.current.getRootDimensions();
|
|
237
|
+
if (!dimensions) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
const isEditing = unstable_gridHeaderFilteringEditFieldSelector(apiRef) === params.field;
|
|
241
|
+
const isHeaderMenuOpen = unstable_gridHeaderFilteringMenuSelector(apiRef) === params.field;
|
|
242
|
+
if (isEditing || isHeaderMenuOpen || !isNavigationKey(event.key)) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const viewportPageSize = apiRef.current.getViewportPageSize();
|
|
246
|
+
const colIndexBefore = params.field ? apiRef.current.getColumnIndex(params.field) : 0;
|
|
247
|
+
const firstRowIndexInPage = 0;
|
|
248
|
+
const lastRowIndexInPage = currentPageRows.length - 1;
|
|
249
|
+
const firstColIndex = 0;
|
|
250
|
+
const lastColIndex = gridVisibleColumnDefinitionsSelector(apiRef).length - 1;
|
|
251
|
+
let shouldPreventDefault = true;
|
|
252
|
+
switch (event.key) {
|
|
253
|
+
case 'ArrowDown':
|
|
254
|
+
{
|
|
255
|
+
const rowId = getRowIdFromIndex(firstRowIndexInPage);
|
|
256
|
+
if (firstRowIndexInPage !== null && rowId != null) {
|
|
257
|
+
goToCell(colIndexBefore, rowId);
|
|
258
|
+
}
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
case 'ArrowRight':
|
|
262
|
+
{
|
|
263
|
+
const rightColIndex = getRightColumnIndex({
|
|
264
|
+
currentColIndex: colIndexBefore,
|
|
265
|
+
firstColIndex,
|
|
266
|
+
lastColIndex,
|
|
267
|
+
direction: theme.direction
|
|
268
|
+
});
|
|
269
|
+
if (rightColIndex !== null) {
|
|
270
|
+
goToHeaderFilter(rightColIndex, event);
|
|
271
|
+
}
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
case 'ArrowLeft':
|
|
275
|
+
{
|
|
276
|
+
const leftColIndex = getLeftColumnIndex({
|
|
277
|
+
currentColIndex: colIndexBefore,
|
|
278
|
+
firstColIndex,
|
|
279
|
+
lastColIndex,
|
|
280
|
+
direction: theme.direction
|
|
281
|
+
});
|
|
282
|
+
if (leftColIndex !== null) {
|
|
283
|
+
goToHeaderFilter(leftColIndex, event);
|
|
284
|
+
} else {
|
|
285
|
+
apiRef.current.setColumnHeaderFilterFocus(params.field, event);
|
|
286
|
+
}
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
case 'ArrowUp':
|
|
290
|
+
{
|
|
291
|
+
goToHeader(colIndexBefore, event);
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
case 'PageDown':
|
|
295
|
+
{
|
|
296
|
+
if (firstRowIndexInPage !== null && lastRowIndexInPage !== null) {
|
|
297
|
+
goToCell(colIndexBefore, getRowIdFromIndex(Math.min(firstRowIndexInPage + viewportPageSize, lastRowIndexInPage)));
|
|
298
|
+
}
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
case 'Home':
|
|
302
|
+
{
|
|
303
|
+
goToHeaderFilter(firstColIndex, event);
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
case 'End':
|
|
307
|
+
{
|
|
308
|
+
goToHeaderFilter(lastColIndex, event);
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
case ' ':
|
|
312
|
+
{
|
|
313
|
+
// prevent Space event from scrolling
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
default:
|
|
317
|
+
{
|
|
318
|
+
shouldPreventDefault = false;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
if (shouldPreventDefault) {
|
|
322
|
+
event.preventDefault();
|
|
323
|
+
}
|
|
324
|
+
}, [apiRef, currentPageRows.length, goToHeaderFilter, theme.direction, goToHeader, goToCell, getRowIdFromIndex]);
|
|
219
325
|
const focusedColumnGroup = useGridSelector(apiRef, unstable_gridFocusColumnGroupHeaderSelector);
|
|
220
326
|
const handleColumnGroupHeaderKeyDown = React.useCallback((params, event) => {
|
|
221
327
|
const dimensions = apiRef.current.getRootDimensions();
|
|
@@ -350,6 +456,8 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
350
456
|
{
|
|
351
457
|
if (rowIndexBefore > firstRowIndexInPage) {
|
|
352
458
|
goToCell(colIndexBefore, getRowIdFromIndex(rowIndexBefore - 1));
|
|
459
|
+
} else if (headerFilteringEnabled) {
|
|
460
|
+
goToHeaderFilter(colIndexBefore, event);
|
|
353
461
|
} else {
|
|
354
462
|
goToHeader(colIndexBefore, event);
|
|
355
463
|
}
|
|
@@ -450,7 +558,7 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
450
558
|
if (shouldPreventDefault) {
|
|
451
559
|
event.preventDefault();
|
|
452
560
|
}
|
|
453
|
-
}, [apiRef, currentPageRows, theme.direction, getRowIdFromIndex,
|
|
561
|
+
}, [apiRef, currentPageRows, theme.direction, goToCell, getRowIdFromIndex, headerFilteringEnabled, goToHeaderFilter, goToHeader]);
|
|
454
562
|
const checkIfCanStartEditing = React.useCallback((initialValue, {
|
|
455
563
|
event
|
|
456
564
|
}) => {
|
|
@@ -462,6 +570,7 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
462
570
|
}, []);
|
|
463
571
|
useGridRegisterPipeProcessor(apiRef, 'canStartEditing', checkIfCanStartEditing);
|
|
464
572
|
useGridApiEventHandler(apiRef, 'columnHeaderKeyDown', handleColumnHeaderKeyDown);
|
|
573
|
+
useGridApiEventHandler(apiRef, 'headerFilterKeyDown', handleHeaderFilterKeyDown);
|
|
465
574
|
useGridApiEventHandler(apiRef, 'columnGroupHeaderKeyDown', handleColumnGroupHeaderKeyDown);
|
|
466
575
|
useGridApiEventHandler(apiRef, 'cellKeyDown', handleCellKeyDown);
|
|
467
576
|
};
|
|
@@ -115,8 +115,23 @@ export const useGridRows = (apiRef, props) => {
|
|
|
115
115
|
if (props.signature === GridSignature.DataGrid && updates.length > 1) {
|
|
116
116
|
throw new Error(["MUI: You can't update several rows at once in `apiRef.current.updateRows` on the DataGrid.", 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
|
|
117
117
|
}
|
|
118
|
+
const nonPinnedRowsUpdates = [];
|
|
119
|
+
updates.forEach(update => {
|
|
120
|
+
const id = getRowIdFromRowModel(update, props.getRowId, 'A row was provided without id when calling updateRows():');
|
|
121
|
+
const rowNode = apiRef.current.getRowNode(id);
|
|
122
|
+
if ((rowNode == null ? void 0 : rowNode.type) === 'pinnedRow') {
|
|
123
|
+
// @ts-ignore because otherwise `release:build` doesn't work
|
|
124
|
+
const pinnedRowsCache = apiRef.current.caches.pinnedRows;
|
|
125
|
+
const prevModel = pinnedRowsCache.idLookup[id];
|
|
126
|
+
if (prevModel) {
|
|
127
|
+
pinnedRowsCache.idLookup[id] = _extends({}, prevModel, update);
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
nonPinnedRowsUpdates.push(update);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
118
133
|
const cache = updateCacheWithNewRows({
|
|
119
|
-
updates,
|
|
134
|
+
updates: nonPinnedRowsUpdates,
|
|
120
135
|
getRowId: props.getRowId,
|
|
121
136
|
previousCache: apiRef.current.caches.rows
|
|
122
137
|
});
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { GridVirtualScrollerRenderZone } from '../components/virtualization/Grid
|
|
|
5
5
|
export { GridBaseColumnHeaders } from '../components/columnHeaders/GridBaseColumnHeaders';
|
|
6
6
|
export { GridColumnHeadersInner } from '../components/columnHeaders/GridColumnHeadersInner';
|
|
7
7
|
export { DATA_GRID_DEFAULT_SLOTS_COMPONENTS } from '../constants/defaultGridSlotsComponents';
|
|
8
|
+
export { getGridFilter } from '../components/panel/filterPanel/GridFilterPanel';
|
|
8
9
|
export { useGridRegisterPipeProcessor } from '../hooks/core/pipeProcessing';
|
|
9
10
|
export type { GridPipeProcessor } from '../hooks/core/pipeProcessing';
|
|
10
11
|
export { useGridRegisterStrategyProcessor, GRID_DEFAULT_STRATEGY, } from '../hooks/core/strategyProcessing';
|
|
@@ -12,9 +13,12 @@ export type { GridStrategyProcessor } from '../hooks/core/strategyProcessing';
|
|
|
12
13
|
export { useGridInitialization } from '../hooks/core/useGridInitialization';
|
|
13
14
|
export { useGridClipboard } from '../hooks/features/clipboard/useGridClipboard';
|
|
14
15
|
export { useGridColumnHeaders } from '../hooks/features/columnHeaders/useGridColumnHeaders';
|
|
15
|
-
export
|
|
16
|
+
export { unstable_gridHeaderFilteringEditFieldSelector, unstable_gridHeaderFilteringMenuSelector, } from '../hooks/features/headerFiltering/gridHeaderFilteringSelectors';
|
|
17
|
+
export type { GridSlotsComponentsProps } from '../models/gridSlotsComponentsProps';
|
|
18
|
+
export type { UseGridColumnHeadersProps, GetHeadersParams, } from '../hooks/features/columnHeaders/useGridColumnHeaders';
|
|
16
19
|
export { useGridColumnMenu, columnMenuStateInitializer, } from '../hooks/features/columnMenu/useGridColumnMenu';
|
|
17
20
|
export { useGridColumns, columnsStateInitializer } from '../hooks/features/columns/useGridColumns';
|
|
21
|
+
export { getTotalHeaderHeight } from '../hooks/features/columns/gridColumnsUtils';
|
|
18
22
|
export { useGridColumnSpanning } from '../hooks/features/columns/useGridColumnSpanning';
|
|
19
23
|
export { useGridColumnGrouping, columnGroupsStateInitializer, } from '../hooks/features/columnGrouping/useGridColumnGrouping';
|
|
20
24
|
export type { GridColumnGroupLookup } from '../hooks/features/columnGrouping/gridColumnGroupsInterfaces';
|
|
@@ -40,6 +44,7 @@ export { useGridRowsMeta, rowsMetaStateInitializer } from '../hooks/features/row
|
|
|
40
44
|
export { useGridParamsApi } from '../hooks/features/rows/useGridParamsApi';
|
|
41
45
|
export { getRowIdFromRowModel } from '../hooks/features/rows/gridRowsUtils';
|
|
42
46
|
export { gridAdditionalRowGroupsSelector, gridPinnedRowsSelector, } from '../hooks/features/rows/gridRowsSelector';
|
|
47
|
+
export { headerFilteringStateInitializer, useGridHeaderFiltering, } from '../hooks/features/headerFiltering/useGridHeaderFiltering';
|
|
43
48
|
export { calculatePinnedRowsHeight } from '../hooks/features/rows/gridRowsUtils';
|
|
44
49
|
export { useGridRowSelection, rowSelectionStateInitializer, } from '../hooks/features/rowSelection/useGridRowSelection';
|
|
45
50
|
export { useGridRowSelectionPreProcessors } from '../hooks/features/rowSelection/useGridRowSelectionPreProcessors';
|
package/internals/index.js
CHANGED
|
@@ -4,13 +4,16 @@ export { GridVirtualScrollerRenderZone } from '../components/virtualization/Grid
|
|
|
4
4
|
export { GridBaseColumnHeaders } from '../components/columnHeaders/GridBaseColumnHeaders';
|
|
5
5
|
export { GridColumnHeadersInner } from '../components/columnHeaders/GridColumnHeadersInner';
|
|
6
6
|
export { DATA_GRID_DEFAULT_SLOTS_COMPONENTS } from '../constants/defaultGridSlotsComponents';
|
|
7
|
+
export { getGridFilter } from '../components/panel/filterPanel/GridFilterPanel';
|
|
7
8
|
export { useGridRegisterPipeProcessor } from '../hooks/core/pipeProcessing';
|
|
8
9
|
export { useGridRegisterStrategyProcessor, GRID_DEFAULT_STRATEGY } from '../hooks/core/strategyProcessing';
|
|
9
10
|
export { useGridInitialization } from '../hooks/core/useGridInitialization';
|
|
10
11
|
export { useGridClipboard } from '../hooks/features/clipboard/useGridClipboard';
|
|
11
12
|
export { useGridColumnHeaders } from '../hooks/features/columnHeaders/useGridColumnHeaders';
|
|
13
|
+
export { unstable_gridHeaderFilteringEditFieldSelector, unstable_gridHeaderFilteringMenuSelector } from '../hooks/features/headerFiltering/gridHeaderFilteringSelectors';
|
|
12
14
|
export { useGridColumnMenu, columnMenuStateInitializer } from '../hooks/features/columnMenu/useGridColumnMenu';
|
|
13
15
|
export { useGridColumns, columnsStateInitializer } from '../hooks/features/columns/useGridColumns';
|
|
16
|
+
export { getTotalHeaderHeight } from '../hooks/features/columns/gridColumnsUtils';
|
|
14
17
|
export { useGridColumnSpanning } from '../hooks/features/columns/useGridColumnSpanning';
|
|
15
18
|
export { useGridColumnGrouping, columnGroupsStateInitializer } from '../hooks/features/columnGrouping/useGridColumnGrouping';
|
|
16
19
|
export { useGridDensity, densityStateInitializer } from '../hooks/features/density/useGridDensity';
|
|
@@ -32,6 +35,7 @@ export { useGridRowsMeta, rowsMetaStateInitializer } from '../hooks/features/row
|
|
|
32
35
|
export { useGridParamsApi } from '../hooks/features/rows/useGridParamsApi';
|
|
33
36
|
export { getRowIdFromRowModel } from '../hooks/features/rows/gridRowsUtils';
|
|
34
37
|
export { gridAdditionalRowGroupsSelector, gridPinnedRowsSelector } from '../hooks/features/rows/gridRowsSelector';
|
|
38
|
+
export { headerFilteringStateInitializer, useGridHeaderFiltering } from '../hooks/features/headerFiltering/useGridHeaderFiltering';
|
|
35
39
|
export { calculatePinnedRowsHeight } from '../hooks/features/rows/gridRowsUtils';
|
|
36
40
|
export { useGridRowSelection, rowSelectionStateInitializer } from '../hooks/features/rowSelection/useGridRowSelection';
|
|
37
41
|
export { useGridRowSelectionPreProcessors } from '../hooks/features/rowSelection/useGridRowSelectionPreProcessors';
|
package/internals/utils/index.js
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GridSlotsComponentsProps } from '../../models/gridSlotsComponentsProps';
|
|
2
|
+
import { GridSlotsComponent } from '../../models';
|
|
3
|
+
interface WithComponents {
|
|
4
|
+
components?: Partial<GridSlotsComponent>;
|
|
5
|
+
componentsProps?: GridSlotsComponentsProps;
|
|
6
|
+
}
|
|
7
|
+
export declare function useProps<T extends WithComponents>(allProps: T): readonly [Partial<GridSlotsComponent> | undefined, GridSlotsComponentsProps | undefined, Omit<T, "components" | "componentsProps">];
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
const _excluded = ["components", "componentsProps"];
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
export function useProps(allProps) {
|
|
5
|
+
return React.useMemo(() => {
|
|
6
|
+
const {
|
|
7
|
+
components,
|
|
8
|
+
componentsProps
|
|
9
|
+
} = allProps,
|
|
10
|
+
themedProps = _objectWithoutPropertiesLoose(allProps, _excluded);
|
|
11
|
+
return [components, componentsProps, themedProps];
|
|
12
|
+
}, [allProps]);
|
|
13
|
+
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import
|
|
3
|
-
var _excluded = ["components", "componentsProps"];
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
3
|
import * as React from 'react';
|
|
5
4
|
import { useThemeProps } from '@mui/material/styles';
|
|
6
5
|
import { GRID_DEFAULT_LOCALE_TEXT } from '../constants';
|
|
7
6
|
import { DATA_GRID_DEFAULT_SLOTS_COMPONENTS } from '../constants/defaultGridSlotsComponents';
|
|
8
7
|
import { GridEditModes } from '../models';
|
|
9
|
-
import { computeSlots, uncapitalizeObjectKeys } from '../internals/utils';
|
|
8
|
+
import { computeSlots, useProps, uncapitalizeObjectKeys } from '../internals/utils';
|
|
10
9
|
var DATA_GRID_FORCED_PROPS = {
|
|
11
10
|
disableMultipleColumnsFiltering: true,
|
|
12
11
|
disableMultipleColumnsSorting: true,
|
|
@@ -72,13 +71,14 @@ export var DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
72
71
|
};
|
|
73
72
|
var defaultSlots = uncapitalizeObjectKeys(DATA_GRID_DEFAULT_SLOTS_COMPONENTS);
|
|
74
73
|
export var useDataGridProps = function useDataGridProps(inProps) {
|
|
75
|
-
var
|
|
74
|
+
var _useProps = useProps(useThemeProps({
|
|
76
75
|
props: inProps,
|
|
77
76
|
name: 'MuiDataGrid'
|
|
78
|
-
}),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
})),
|
|
78
|
+
_useProps2 = _slicedToArray(_useProps, 3),
|
|
79
|
+
components = _useProps2[0],
|
|
80
|
+
componentsProps = _useProps2[1],
|
|
81
|
+
themedProps = _useProps2[2];
|
|
82
82
|
var localeText = React.useMemo(function () {
|
|
83
83
|
return _extends({}, GRID_DEFAULT_LOCALE_TEXT, themedProps.localeText);
|
|
84
84
|
}, [themedProps.localeText]);
|
|
@@ -17,7 +17,6 @@ export var getGridNumericQuickFilterFn = function getGridNumericQuickFilterFn(va
|
|
|
17
17
|
};
|
|
18
18
|
export var getGridNumericOperators = function getGridNumericOperators() {
|
|
19
19
|
return [{
|
|
20
|
-
label: '=',
|
|
21
20
|
value: '=',
|
|
22
21
|
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
23
22
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
@@ -33,7 +32,6 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
33
32
|
type: 'number'
|
|
34
33
|
}
|
|
35
34
|
}, {
|
|
36
|
-
label: '!=',
|
|
37
35
|
value: '!=',
|
|
38
36
|
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
39
37
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
@@ -49,7 +47,6 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
49
47
|
type: 'number'
|
|
50
48
|
}
|
|
51
49
|
}, {
|
|
52
|
-
label: '>',
|
|
53
50
|
value: '>',
|
|
54
51
|
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
55
52
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
@@ -68,7 +65,6 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
68
65
|
type: 'number'
|
|
69
66
|
}
|
|
70
67
|
}, {
|
|
71
|
-
label: '>=',
|
|
72
68
|
value: '>=',
|
|
73
69
|
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
74
70
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
@@ -87,7 +83,6 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
87
83
|
type: 'number'
|
|
88
84
|
}
|
|
89
85
|
}, {
|
|
90
|
-
label: '<',
|
|
91
86
|
value: '<',
|
|
92
87
|
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
93
88
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
@@ -106,7 +101,6 @@ export var getGridNumericOperators = function getGridNumericOperators() {
|
|
|
106
101
|
type: 'number'
|
|
107
102
|
}
|
|
108
103
|
}, {
|
|
109
|
-
label: '<=',
|
|
110
104
|
value: '<=',
|
|
111
105
|
getApplyFilterFn: function getApplyFilterFn(filterItem) {
|
|
112
106
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
@@ -120,7 +120,10 @@ var GridEditInputCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
120
120
|
type: colDef.type === 'number' ? colDef.type : 'text',
|
|
121
121
|
value: valueState != null ? valueState : '',
|
|
122
122
|
onChange: handleChange,
|
|
123
|
-
endAdornment: isProcessingProps ? /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
|
|
123
|
+
endAdornment: isProcessingProps ? /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
|
|
124
|
+
fontSize: "small",
|
|
125
|
+
color: "action"
|
|
126
|
+
}) : undefined
|
|
124
127
|
}, other));
|
|
125
128
|
});
|
|
126
129
|
process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes = {
|
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["item", "applyValue", "apiRef", "focusElementRef"];
|
|
4
|
+
var _excluded = ["item", "applyValue", "apiRef", "focusElementRef", "headerFilterMenu", "isFilterActive", "clearButton", "tabIndex", "label"];
|
|
5
5
|
import * as React from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
6
7
|
import { unstable_useId as useId } from '@mui/utils';
|
|
8
|
+
import { styled } from '@mui/material/styles';
|
|
7
9
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
8
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
|
|
12
|
+
var BooleanOperatorContainer = styled('div')({
|
|
13
|
+
display: 'flex',
|
|
14
|
+
alignItems: 'flex-end',
|
|
15
|
+
width: '100%'
|
|
16
|
+
});
|
|
17
|
+
function GridFilterInputBoolean(props) {
|
|
11
18
|
var _rootProps$slotProps, _baseSelectProps$nati, _rootProps$slotProps2, _rootProps$slotProps3;
|
|
12
19
|
var item = props.item,
|
|
13
20
|
applyValue = props.applyValue,
|
|
14
21
|
apiRef = props.apiRef,
|
|
15
22
|
focusElementRef = props.focusElementRef,
|
|
23
|
+
headerFilterMenu = props.headerFilterMenu,
|
|
24
|
+
isFilterActive = props.isFilterActive,
|
|
25
|
+
clearButton = props.clearButton,
|
|
26
|
+
tabIndex = props.tabIndex,
|
|
27
|
+
labelProp = props.label,
|
|
16
28
|
others = _objectWithoutProperties(props, _excluded);
|
|
17
29
|
var _React$useState = React.useState(item.value || ''),
|
|
18
30
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -34,39 +46,71 @@ export function GridFilterInputBoolean(props) {
|
|
|
34
46
|
React.useEffect(function () {
|
|
35
47
|
setFilterValueState(item.value || '');
|
|
36
48
|
}, [item.value]);
|
|
37
|
-
var label = apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
38
|
-
return /*#__PURE__*/_jsxs(
|
|
39
|
-
children: [/*#__PURE__*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
inputProps: {
|
|
54
|
-
ref: focusElementRef
|
|
55
|
-
}
|
|
56
|
-
}, others, baseSelectProps, {
|
|
57
|
-
children: [/*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
49
|
+
var label = labelProp != null ? labelProp : apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
50
|
+
return /*#__PURE__*/_jsxs(BooleanOperatorContainer, {
|
|
51
|
+
children: [/*#__PURE__*/_jsxs(rootProps.slots.baseFormControl, {
|
|
52
|
+
fullWidth: true,
|
|
53
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, (_rootProps$slotProps3 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps3.baseInputLabel, {
|
|
54
|
+
id: labelId,
|
|
55
|
+
shrink: true,
|
|
56
|
+
variant: "standard",
|
|
57
|
+
children: label
|
|
58
|
+
})), /*#__PURE__*/_jsxs(rootProps.slots.baseSelect, _extends({
|
|
59
|
+
labelId: labelId,
|
|
60
|
+
id: selectId,
|
|
61
|
+
label: label,
|
|
62
|
+
value: filterValueState,
|
|
63
|
+
onChange: onFilterChange,
|
|
64
|
+
variant: "standard",
|
|
58
65
|
native: isSelectNative,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
displayEmpty: true,
|
|
67
|
+
startAdornment: isFilterActive ? headerFilterMenu : null,
|
|
68
|
+
inputProps: {
|
|
69
|
+
ref: focusElementRef,
|
|
70
|
+
tabIndex: tabIndex
|
|
71
|
+
}
|
|
72
|
+
}, others, baseSelectProps, {
|
|
73
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
74
|
+
native: isSelectNative,
|
|
75
|
+
value: "",
|
|
76
|
+
children: apiRef.current.getLocaleText('filterValueAny')
|
|
77
|
+
})), /*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
78
|
+
native: isSelectNative,
|
|
79
|
+
value: "true",
|
|
80
|
+
children: apiRef.current.getLocaleText('filterValueTrue')
|
|
81
|
+
})), /*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
82
|
+
native: isSelectNative,
|
|
83
|
+
value: "false",
|
|
84
|
+
children: apiRef.current.getLocaleText('filterValueFalse')
|
|
85
|
+
}))]
|
|
69
86
|
}))]
|
|
70
|
-
})
|
|
87
|
+
}), clearButton]
|
|
71
88
|
});
|
|
72
|
-
}
|
|
89
|
+
}
|
|
90
|
+
process.env.NODE_ENV !== "production" ? GridFilterInputBoolean.propTypes = {
|
|
91
|
+
// ----------------------------- Warning --------------------------------
|
|
92
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
93
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
94
|
+
// ----------------------------------------------------------------------
|
|
95
|
+
apiRef: PropTypes.shape({
|
|
96
|
+
current: PropTypes.object.isRequired
|
|
97
|
+
}).isRequired,
|
|
98
|
+
applyValue: PropTypes.func.isRequired,
|
|
99
|
+
clearButton: PropTypes.node,
|
|
100
|
+
focusElementRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
101
|
+
current: PropTypes.any.isRequired
|
|
102
|
+
})]),
|
|
103
|
+
headerFilterMenu: PropTypes.node,
|
|
104
|
+
/**
|
|
105
|
+
* It is `true` if the filter either has a value or an operator with no value
|
|
106
|
+
* required is selected (e.g. `isEmpty`)
|
|
107
|
+
*/
|
|
108
|
+
isFilterActive: PropTypes.bool,
|
|
109
|
+
item: PropTypes.shape({
|
|
110
|
+
field: PropTypes.string.isRequired,
|
|
111
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
112
|
+
operator: PropTypes.string.isRequired,
|
|
113
|
+
value: PropTypes.any
|
|
114
|
+
}).isRequired
|
|
115
|
+
} : void 0;
|
|
116
|
+
export { GridFilterInputBoolean };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "InputProps"];
|
|
4
|
+
var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "InputProps", "headerFilterMenu", "isFilterActive", "clearButton", "tabIndex", "disabled"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { unstable_useId as useId } from '@mui/utils';
|
|
@@ -16,6 +16,11 @@ function GridFilterInputDate(props) {
|
|
|
16
16
|
apiRef = props.apiRef,
|
|
17
17
|
focusElementRef = props.focusElementRef,
|
|
18
18
|
InputProps = props.InputProps,
|
|
19
|
+
headerFilterMenu = props.headerFilterMenu,
|
|
20
|
+
isFilterActive = props.isFilterActive,
|
|
21
|
+
clearButton = props.clearButton,
|
|
22
|
+
tabIndex = props.tabIndex,
|
|
23
|
+
disabled = props.disabled,
|
|
19
24
|
other = _objectWithoutProperties(props, _excluded);
|
|
20
25
|
var filterTimeout = React.useRef();
|
|
21
26
|
var _React$useState = React.useState((_item$value = item.value) != null ? _item$value : ''),
|
|
@@ -51,6 +56,7 @@ function GridFilterInputDate(props) {
|
|
|
51
56
|
setFilterValueState(String(itemValue));
|
|
52
57
|
}, [item.value]);
|
|
53
58
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
|
|
59
|
+
fullWidth: true,
|
|
54
60
|
id: id,
|
|
55
61
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
56
62
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
@@ -62,11 +68,19 @@ function GridFilterInputDate(props) {
|
|
|
62
68
|
shrink: true
|
|
63
69
|
},
|
|
64
70
|
inputRef: focusElementRef,
|
|
65
|
-
InputProps: _extends({}, applying ? {
|
|
66
|
-
endAdornment: /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
|
|
67
|
-
|
|
71
|
+
InputProps: _extends({}, applying || clearButton ? {
|
|
72
|
+
endAdornment: applying ? /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
|
|
73
|
+
fontSize: "small",
|
|
74
|
+
color: "action"
|
|
75
|
+
}) : clearButton
|
|
76
|
+
} : {}, headerFilterMenu && isFilterActive ? {
|
|
77
|
+
startAdornment: headerFilterMenu
|
|
78
|
+
} : {}, {
|
|
79
|
+
disabled: disabled
|
|
80
|
+
}, InputProps, {
|
|
68
81
|
inputProps: _extends({
|
|
69
|
-
max: type === 'datetime-local' ? '9999-12-31T23:59' : '9999-12-31'
|
|
82
|
+
max: type === 'datetime-local' ? '9999-12-31T23:59' : '9999-12-31',
|
|
83
|
+
tabIndex: tabIndex
|
|
70
84
|
}, InputProps == null ? void 0 : InputProps.inputProps)
|
|
71
85
|
})
|
|
72
86
|
}, other, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseTextField));
|
|
@@ -80,7 +94,14 @@ process.env.NODE_ENV !== "production" ? GridFilterInputDate.propTypes = {
|
|
|
80
94
|
current: PropTypes.object.isRequired
|
|
81
95
|
}).isRequired,
|
|
82
96
|
applyValue: PropTypes.func.isRequired,
|
|
97
|
+
clearButton: PropTypes.node,
|
|
83
98
|
focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
|
|
99
|
+
headerFilterMenu: PropTypes.node,
|
|
100
|
+
/**
|
|
101
|
+
* It is `true` if the filter either has a value or an operator with no value
|
|
102
|
+
* required is selected (e.g. `isEmpty`)
|
|
103
|
+
*/
|
|
104
|
+
isFilterActive: PropTypes.bool,
|
|
84
105
|
item: PropTypes.shape({
|
|
85
106
|
field: PropTypes.string.isRequired,
|
|
86
107
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|