@mui/x-data-grid 6.3.1 → 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 +113 -0
- package/DataGrid/DataGrid.js +20 -1
- package/DataGrid/useDataGridComponent.js +2 -2
- package/DataGrid/useDataGridProps.js +8 -13
- package/colDef/gridBooleanColDef.js +19 -1
- package/colDef/gridDateColDef.js +6 -2
- package/colDef/gridNumericOperators.js +0 -6
- package/colDef/gridSingleSelectColDef.js +21 -1
- package/components/base/GridBody.js +2 -1
- package/components/cell/GridEditInputCell.js +4 -1
- package/components/containers/GridRootStyles.js +1 -0
- 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/GridFilterInputMultipleSingleSelect.js +1 -2
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -2
- 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/core/pipeProcessing/gridPipeProcessingApi.d.ts +12 -1
- package/hooks/features/clipboard/useGridClipboard.d.ts +2 -1
- package/hooks/features/clipboard/useGridClipboard.js +43 -26
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +9 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -2
- package/hooks/features/dimensions/useGridDimensions.js +4 -6
- package/hooks/features/editing/useGridCellEditing.js +7 -3
- package/hooks/features/editing/useGridEditing.js +0 -3
- package/hooks/features/editing/useGridRowEditing.js +7 -3
- package/hooks/features/export/serializers/csvSerializer.d.ts +5 -0
- package/hooks/features/export/serializers/csvSerializer.js +46 -6
- package/hooks/features/export/useGridCsvExport.d.ts +2 -1
- package/hooks/features/export/useGridCsvExport.js +7 -5
- 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 +124 -4
- package/hooks/features/rows/useGridRows.js +16 -1
- package/index.js +1 -1
- package/internals/index.d.ts +9 -3
- package/internals/index.js +7 -2
- 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/joy/icons.d.ts +33 -0
- package/joy/icons.js +433 -0
- package/joy/joySlots.js +114 -4
- package/legacy/DataGrid/DataGrid.js +20 -1
- package/legacy/DataGrid/useDataGridComponent.js +2 -2
- package/legacy/DataGrid/useDataGridProps.js +11 -9
- package/legacy/colDef/gridBooleanColDef.js +21 -1
- package/legacy/colDef/gridDateColDef.js +10 -2
- package/legacy/colDef/gridNumericOperators.js +0 -6
- package/legacy/colDef/gridSingleSelectColDef.js +21 -1
- package/legacy/components/base/GridBody.js +2 -1
- package/legacy/components/cell/GridEditInputCell.js +4 -1
- package/legacy/components/containers/GridRootStyles.js +1 -0
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +79 -35
- package/legacy/components/panel/filterPanel/GridFilterInputDate.js +26 -5
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -2
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -2
- 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/clipboard/useGridClipboard.js +44 -26
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -5
- package/legacy/hooks/features/dimensions/useGridDimensions.js +4 -6
- package/legacy/hooks/features/editing/useGridCellEditing.js +7 -3
- package/legacy/hooks/features/editing/useGridEditing.js +0 -3
- package/legacy/hooks/features/editing/useGridRowEditing.js +7 -3
- package/legacy/hooks/features/export/serializers/csvSerializer.js +43 -6
- package/legacy/hooks/features/export/useGridCsvExport.js +8 -5
- 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 +123 -4
- package/legacy/hooks/features/rows/useGridRows.js +16 -1
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +7 -2
- package/legacy/internals/utils/index.js +2 -1
- package/legacy/internals/utils/useProps.js +11 -0
- package/legacy/joy/icons.js +432 -0
- package/legacy/joy/joySlots.js +118 -4
- 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 +30 -2
- 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 +34 -6
- 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 +29 -1
- 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 +36 -9
- 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 +5 -1
- package/legacy/models/api/index.js +0 -1
- package/legacy/models/index.js +0 -1
- package/legacy/utils/domUtils.js +14 -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 +30 -2
- 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 +34 -6
- 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 +29 -1
- 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 +36 -9
- 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 -65
- package/material/index.js +5 -1
- package/models/api/gridApiCommon.d.ts +3 -3
- package/models/api/gridCoreApi.d.ts +8 -0
- package/models/api/gridFocusApi.d.ts +6 -0
- package/models/api/gridHeaderFilteringApi.d.ts +30 -0
- package/models/api/gridLocaleTextApi.d.ts +25 -0
- package/models/api/index.d.ts +0 -1
- package/models/api/index.js +0 -1
- package/models/events/gridEventLookup.d.ts +33 -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 +21 -4
- package/models/gridSlotsComponentsProps.d.ts +4 -0
- package/models/gridStateCommunity.d.ts +2 -0
- package/models/index.d.ts +1 -1
- package/models/index.js +0 -1
- package/models/props/DataGridProps.d.ts +19 -0
- package/modern/DataGrid/DataGrid.js +20 -1
- package/modern/DataGrid/useDataGridComponent.js +2 -2
- package/modern/DataGrid/useDataGridProps.js +8 -13
- package/modern/colDef/gridBooleanColDef.js +19 -1
- package/modern/colDef/gridDateColDef.js +6 -2
- package/modern/colDef/gridNumericOperators.js +0 -6
- package/modern/colDef/gridSingleSelectColDef.js +21 -1
- package/modern/components/base/GridBody.js +2 -1
- package/modern/components/cell/GridEditInputCell.js +4 -1
- package/modern/components/containers/GridRootStyles.js +1 -0
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +80 -36
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +27 -6
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -2
- package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -2
- 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/clipboard/useGridClipboard.js +43 -26
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +3 -5
- package/modern/hooks/features/editing/useGridCellEditing.js +7 -3
- package/modern/hooks/features/editing/useGridEditing.js +0 -3
- package/modern/hooks/features/editing/useGridRowEditing.js +7 -3
- package/modern/hooks/features/export/serializers/csvSerializer.js +44 -6
- package/modern/hooks/features/export/useGridCsvExport.js +7 -5
- 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 +124 -4
- package/modern/hooks/features/rows/useGridRows.js +16 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +7 -2
- package/modern/internals/utils/index.js +2 -1
- package/modern/internals/utils/useProps.js +13 -0
- package/modern/joy/icons.js +433 -0
- package/modern/joy/joySlots.js +110 -4
- 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 +30 -2
- 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 +34 -6
- 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 +29 -1
- 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 +36 -9
- 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 +5 -1
- package/modern/models/api/gridHeaderFilteringApi.js +1 -0
- package/modern/models/api/index.js +0 -1
- package/modern/models/gridHeaderFilteringModel.js +1 -0
- package/modern/models/index.js +0 -1
- package/modern/utils/domUtils.js +13 -1
- package/node/DataGrid/DataGrid.js +20 -1
- package/node/DataGrid/useDataGridComponent.js +2 -2
- package/node/DataGrid/useDataGridProps.js +7 -12
- package/node/colDef/gridBooleanColDef.js +19 -1
- package/node/colDef/gridDateColDef.js +6 -2
- package/node/colDef/gridNumericOperators.js +0 -6
- package/node/colDef/gridSingleSelectColDef.js +21 -1
- package/node/components/base/GridBody.js +2 -1
- package/node/components/cell/GridEditInputCell.js +4 -1
- package/node/components/containers/GridRootStyles.js +1 -0
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +78 -35
- package/node/components/panel/filterPanel/GridFilterInputDate.js +27 -6
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -2
- package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -2
- 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/clipboard/useGridClipboard.js +42 -25
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -2
- package/node/hooks/features/dimensions/useGridDimensions.js +3 -5
- package/node/hooks/features/editing/useGridCellEditing.js +7 -3
- package/node/hooks/features/editing/useGridEditing.js +0 -3
- package/node/hooks/features/editing/useGridRowEditing.js +7 -3
- package/node/hooks/features/export/serializers/csvSerializer.js +46 -6
- package/node/hooks/features/export/useGridCsvExport.js +6 -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 +124 -4
- package/node/hooks/features/rows/useGridRows.js +16 -1
- package/node/index.js +1 -1
- package/node/internals/index.js +69 -1
- package/node/internals/utils/index.js +11 -0
- package/node/internals/utils/useProps.js +22 -0
- package/node/joy/icons.js +471 -0
- package/node/joy/joySlots.js +110 -3
- 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 +30 -2
- 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 +34 -6
- 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 +29 -1
- 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 +36 -9
- 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 +5 -1
- package/node/models/api/index.js +0 -11
- package/node/models/gridHeaderFilteringModel.js +5 -0
- package/node/models/index.js +0 -11
- package/node/utils/domUtils.js +15 -1
- package/package.json +1 -1
- package/utils/domUtils.d.ts +1 -0
- package/utils/domUtils.js +13 -1
- package/models/api/gridClipboardApi.d.ts +0 -11
- /package/legacy/models/api/{gridClipboardApi.js → gridHeaderFilteringApi.js} +0 -0
- /package/{models/api/gridClipboardApi.js → legacy/models/gridHeaderFilteringModel.js} +0 -0
- /package/{modern/models/api/gridClipboardApi.js → models/api/gridHeaderFilteringApi.js} +0 -0
- /package/node/models/api/{gridClipboardApi.js → gridHeaderFilteringApi.js} +0 -0
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["item", "applyValue", "apiRef", "focusElementRef"];
|
|
3
|
+
const _excluded = ["item", "applyValue", "apiRef", "focusElementRef", "headerFilterMenu", "isFilterActive", "clearButton", "tabIndex", "label"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
5
6
|
import { unstable_useId as useId } from '@mui/utils';
|
|
7
|
+
import { styled } from '@mui/material/styles';
|
|
6
8
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
7
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
|
|
11
|
+
const BooleanOperatorContainer = styled('div')({
|
|
12
|
+
display: 'flex',
|
|
13
|
+
alignItems: 'flex-end',
|
|
14
|
+
width: '100%'
|
|
15
|
+
});
|
|
16
|
+
function GridFilterInputBoolean(props) {
|
|
10
17
|
const {
|
|
11
18
|
item,
|
|
12
19
|
applyValue,
|
|
13
20
|
apiRef,
|
|
14
|
-
focusElementRef
|
|
21
|
+
focusElementRef,
|
|
22
|
+
headerFilterMenu,
|
|
23
|
+
isFilterActive,
|
|
24
|
+
clearButton,
|
|
25
|
+
tabIndex,
|
|
26
|
+
label: labelProp
|
|
15
27
|
} = props,
|
|
16
28
|
others = _objectWithoutPropertiesLoose(props, _excluded);
|
|
17
29
|
const [filterValueState, setFilterValueState] = React.useState(item.value || '');
|
|
@@ -31,39 +43,71 @@ export function GridFilterInputBoolean(props) {
|
|
|
31
43
|
React.useEffect(() => {
|
|
32
44
|
setFilterValueState(item.value || '');
|
|
33
45
|
}, [item.value]);
|
|
34
|
-
const label = apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
35
|
-
return /*#__PURE__*/_jsxs(
|
|
36
|
-
children: [/*#__PURE__*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
inputProps: {
|
|
51
|
-
ref: focusElementRef
|
|
52
|
-
}
|
|
53
|
-
}, others, baseSelectProps, {
|
|
54
|
-
children: [/*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
46
|
+
const label = labelProp ?? apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
47
|
+
return /*#__PURE__*/_jsxs(BooleanOperatorContainer, {
|
|
48
|
+
children: [/*#__PURE__*/_jsxs(rootProps.slots.baseFormControl, {
|
|
49
|
+
fullWidth: true,
|
|
50
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, rootProps.slotProps?.baseInputLabel, {
|
|
51
|
+
id: labelId,
|
|
52
|
+
shrink: true,
|
|
53
|
+
variant: "standard",
|
|
54
|
+
children: label
|
|
55
|
+
})), /*#__PURE__*/_jsxs(rootProps.slots.baseSelect, _extends({
|
|
56
|
+
labelId: labelId,
|
|
57
|
+
id: selectId,
|
|
58
|
+
label: label,
|
|
59
|
+
value: filterValueState,
|
|
60
|
+
onChange: onFilterChange,
|
|
61
|
+
variant: "standard",
|
|
55
62
|
native: isSelectNative,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
displayEmpty: true,
|
|
64
|
+
startAdornment: isFilterActive ? headerFilterMenu : null,
|
|
65
|
+
inputProps: {
|
|
66
|
+
ref: focusElementRef,
|
|
67
|
+
tabIndex
|
|
68
|
+
}
|
|
69
|
+
}, others, baseSelectProps, {
|
|
70
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
71
|
+
native: isSelectNative,
|
|
72
|
+
value: "",
|
|
73
|
+
children: apiRef.current.getLocaleText('filterValueAny')
|
|
74
|
+
})), /*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
75
|
+
native: isSelectNative,
|
|
76
|
+
value: "true",
|
|
77
|
+
children: apiRef.current.getLocaleText('filterValueTrue')
|
|
78
|
+
})), /*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
79
|
+
native: isSelectNative,
|
|
80
|
+
value: "false",
|
|
81
|
+
children: apiRef.current.getLocaleText('filterValueFalse')
|
|
82
|
+
}))]
|
|
66
83
|
}))]
|
|
67
|
-
})
|
|
84
|
+
}), clearButton]
|
|
68
85
|
});
|
|
69
|
-
}
|
|
86
|
+
}
|
|
87
|
+
process.env.NODE_ENV !== "production" ? GridFilterInputBoolean.propTypes = {
|
|
88
|
+
// ----------------------------- Warning --------------------------------
|
|
89
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
90
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
91
|
+
// ----------------------------------------------------------------------
|
|
92
|
+
apiRef: PropTypes.shape({
|
|
93
|
+
current: PropTypes.object.isRequired
|
|
94
|
+
}).isRequired,
|
|
95
|
+
applyValue: PropTypes.func.isRequired,
|
|
96
|
+
clearButton: PropTypes.node,
|
|
97
|
+
focusElementRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
98
|
+
current: PropTypes.any.isRequired
|
|
99
|
+
})]),
|
|
100
|
+
headerFilterMenu: PropTypes.node,
|
|
101
|
+
/**
|
|
102
|
+
* It is `true` if the filter either has a value or an operator with no value
|
|
103
|
+
* required is selected (e.g. `isEmpty`)
|
|
104
|
+
*/
|
|
105
|
+
isFilterActive: PropTypes.bool,
|
|
106
|
+
item: PropTypes.shape({
|
|
107
|
+
field: PropTypes.string.isRequired,
|
|
108
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
109
|
+
operator: PropTypes.string.isRequired,
|
|
110
|
+
value: PropTypes.any
|
|
111
|
+
}).isRequired
|
|
112
|
+
} : void 0;
|
|
113
|
+
export { GridFilterInputBoolean };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "InputProps"];
|
|
3
|
+
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "InputProps", "headerFilterMenu", "isFilterActive", "clearButton", "tabIndex", "disabled"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { unstable_useId as useId } from '@mui/utils';
|
|
@@ -14,7 +14,12 @@ function GridFilterInputDate(props) {
|
|
|
14
14
|
type,
|
|
15
15
|
apiRef,
|
|
16
16
|
focusElementRef,
|
|
17
|
-
InputProps
|
|
17
|
+
InputProps,
|
|
18
|
+
headerFilterMenu,
|
|
19
|
+
isFilterActive,
|
|
20
|
+
clearButton,
|
|
21
|
+
tabIndex,
|
|
22
|
+
disabled
|
|
18
23
|
} = props,
|
|
19
24
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
20
25
|
const filterTimeout = React.useRef();
|
|
@@ -44,6 +49,7 @@ function GridFilterInputDate(props) {
|
|
|
44
49
|
setFilterValueState(String(itemValue));
|
|
45
50
|
}, [item.value]);
|
|
46
51
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
|
|
52
|
+
fullWidth: true,
|
|
47
53
|
id: id,
|
|
48
54
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
49
55
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
@@ -55,11 +61,19 @@ function GridFilterInputDate(props) {
|
|
|
55
61
|
shrink: true
|
|
56
62
|
},
|
|
57
63
|
inputRef: focusElementRef,
|
|
58
|
-
InputProps: _extends({}, applying ? {
|
|
59
|
-
endAdornment: /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
|
|
60
|
-
|
|
64
|
+
InputProps: _extends({}, applying || clearButton ? {
|
|
65
|
+
endAdornment: applying ? /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
|
|
66
|
+
fontSize: "small",
|
|
67
|
+
color: "action"
|
|
68
|
+
}) : clearButton
|
|
69
|
+
} : {}, headerFilterMenu && isFilterActive ? {
|
|
70
|
+
startAdornment: headerFilterMenu
|
|
71
|
+
} : {}, {
|
|
72
|
+
disabled
|
|
73
|
+
}, InputProps, {
|
|
61
74
|
inputProps: _extends({
|
|
62
|
-
max: type === 'datetime-local' ? '9999-12-31T23:59' : '9999-12-31'
|
|
75
|
+
max: type === 'datetime-local' ? '9999-12-31T23:59' : '9999-12-31',
|
|
76
|
+
tabIndex
|
|
63
77
|
}, InputProps?.inputProps)
|
|
64
78
|
})
|
|
65
79
|
}, other, rootProps.slotProps?.baseTextField));
|
|
@@ -73,7 +87,14 @@ process.env.NODE_ENV !== "production" ? GridFilterInputDate.propTypes = {
|
|
|
73
87
|
current: PropTypes.object.isRequired
|
|
74
88
|
}).isRequired,
|
|
75
89
|
applyValue: PropTypes.func.isRequired,
|
|
90
|
+
clearButton: PropTypes.node,
|
|
76
91
|
focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
|
|
92
|
+
headerFilterMenu: PropTypes.node,
|
|
93
|
+
/**
|
|
94
|
+
* It is `true` if the filter either has a value or an operator with no value
|
|
95
|
+
* required is selected (e.g. `isEmpty`)
|
|
96
|
+
*/
|
|
97
|
+
isFilterActive: PropTypes.bool,
|
|
77
98
|
item: PropTypes.shape({
|
|
78
99
|
field: PropTypes.string.isRequired,
|
|
79
100
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -4,7 +4,6 @@ const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "c
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
|
|
7
|
-
import Chip from '@mui/material/Chip';
|
|
8
7
|
import { unstable_useId as useId } from '@mui/utils';
|
|
9
8
|
import { isSingleSelectColDef } from './filterPanelUtils';
|
|
10
9
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
@@ -96,7 +95,7 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
96
95
|
value: filteredValues,
|
|
97
96
|
onChange: handleChange,
|
|
98
97
|
getOptionLabel: getOptionLabel,
|
|
99
|
-
renderTags: (value, getTagProps) => value.map((option, index) => /*#__PURE__*/_jsx(
|
|
98
|
+
renderTags: (value, getTagProps) => value.map((option, index) => /*#__PURE__*/_jsx(rootProps.slots.baseChip, _extends({
|
|
100
99
|
variant: "outlined",
|
|
101
100
|
size: "small",
|
|
102
101
|
label: getOptionLabel(option)
|
|
@@ -4,7 +4,6 @@ const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "c
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import Autocomplete from '@mui/material/Autocomplete';
|
|
7
|
-
import Chip from '@mui/material/Chip';
|
|
8
7
|
import { unstable_useId as useId } from '@mui/utils';
|
|
9
8
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
10
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -55,7 +54,7 @@ function GridFilterInputMultipleValue(props) {
|
|
|
55
54
|
id: id,
|
|
56
55
|
value: filterValueState,
|
|
57
56
|
onChange: handleChange,
|
|
58
|
-
renderTags: (value, getTagProps) => value.map((option, index) => /*#__PURE__*/_jsx(
|
|
57
|
+
renderTags: (value, getTagProps) => value.map((option, index) => /*#__PURE__*/_jsx(rootProps.slots.baseChip, _extends({
|
|
59
58
|
variant: "outlined",
|
|
60
59
|
size: "small",
|
|
61
60
|
label: option
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "getOptionLabel", "getOptionValue"];
|
|
3
|
+
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "getOptionLabel", "getOptionValue", "placeholder", "tabIndex", "label", "headerFilterMenu", "isFilterActive", "clearButton"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { unstable_useId as useId } from '@mui/utils';
|
|
7
|
+
import { styled } from '@mui/material/styles';
|
|
7
8
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
8
9
|
import { getValueFromValueOptions, isSingleSelectColDef } from './filterPanelUtils';
|
|
9
10
|
import { createElement as _createElement } from "react";
|
|
@@ -33,6 +34,11 @@ const renderSingleSelectOptions = ({
|
|
|
33
34
|
}), label);
|
|
34
35
|
});
|
|
35
36
|
};
|
|
37
|
+
const SingleSelectOperatorContainer = styled('div')({
|
|
38
|
+
display: 'flex',
|
|
39
|
+
alignItems: 'flex-end',
|
|
40
|
+
width: '100%'
|
|
41
|
+
});
|
|
36
42
|
function GridFilterInputSingleSelect(props) {
|
|
37
43
|
const {
|
|
38
44
|
item,
|
|
@@ -41,7 +47,13 @@ function GridFilterInputSingleSelect(props) {
|
|
|
41
47
|
apiRef,
|
|
42
48
|
focusElementRef,
|
|
43
49
|
getOptionLabel: getOptionLabelProp,
|
|
44
|
-
getOptionValue: getOptionValueProp
|
|
50
|
+
getOptionValue: getOptionValueProp,
|
|
51
|
+
placeholder,
|
|
52
|
+
tabIndex,
|
|
53
|
+
label: labelProp,
|
|
54
|
+
headerFilterMenu,
|
|
55
|
+
isFilterActive,
|
|
56
|
+
clearButton
|
|
45
57
|
} = props,
|
|
46
58
|
others = _objectWithoutPropertiesLoose(props, _excluded);
|
|
47
59
|
const [filterValueState, setFilterValueState] = React.useState(item.value ?? '');
|
|
@@ -99,36 +111,40 @@ function GridFilterInputSingleSelect(props) {
|
|
|
99
111
|
if (!isSingleSelectColDef(resolvedColumn)) {
|
|
100
112
|
return null;
|
|
101
113
|
}
|
|
102
|
-
const label = apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
103
|
-
return /*#__PURE__*/_jsxs(
|
|
104
|
-
children: [/*#__PURE__*/
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
114
|
+
const label = labelProp ?? apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
115
|
+
return /*#__PURE__*/_jsxs(SingleSelectOperatorContainer, {
|
|
116
|
+
children: [/*#__PURE__*/_jsxs(rootProps.slots.baseFormControl, {
|
|
117
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, rootProps.slotProps?.baseInputLabel, {
|
|
118
|
+
id: labelId,
|
|
119
|
+
shrink: true,
|
|
120
|
+
variant: "standard",
|
|
121
|
+
children: label
|
|
122
|
+
})), /*#__PURE__*/_jsx(rootProps.slots.baseSelect, _extends({
|
|
123
|
+
id: id,
|
|
124
|
+
label: label,
|
|
125
|
+
labelId: labelId,
|
|
126
|
+
value: filterValueState,
|
|
127
|
+
onChange: onFilterChange,
|
|
128
|
+
startAdornment: isFilterActive ? headerFilterMenu : null,
|
|
129
|
+
variant: "standard",
|
|
130
|
+
type: type || 'text',
|
|
131
|
+
inputProps: {
|
|
132
|
+
tabIndex,
|
|
133
|
+
ref: focusElementRef,
|
|
134
|
+
placeholder: placeholder ?? apiRef.current.getLocaleText('filterPanelInputPlaceholder')
|
|
135
|
+
},
|
|
136
|
+
native: isSelectNative
|
|
137
|
+
}, others, rootProps.slotProps?.baseSelect, {
|
|
138
|
+
children: renderSingleSelectOptions({
|
|
139
|
+
column: resolvedColumn,
|
|
140
|
+
OptionComponent: rootProps.slots.baseSelectOption,
|
|
141
|
+
getOptionLabel,
|
|
142
|
+
getOptionValue,
|
|
143
|
+
isSelectNative,
|
|
144
|
+
baseSelectOptionProps: rootProps.slotProps?.baseSelectOption
|
|
145
|
+
})
|
|
146
|
+
}))]
|
|
147
|
+
}), clearButton]
|
|
132
148
|
});
|
|
133
149
|
}
|
|
134
150
|
process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes = {
|
|
@@ -140,6 +156,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes =
|
|
|
140
156
|
current: PropTypes.object.isRequired
|
|
141
157
|
}).isRequired,
|
|
142
158
|
applyValue: PropTypes.func.isRequired,
|
|
159
|
+
clearButton: PropTypes.node,
|
|
143
160
|
focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
|
|
144
161
|
/**
|
|
145
162
|
* Used to determine the label displayed for a given value option.
|
|
@@ -153,6 +170,12 @@ process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes =
|
|
|
153
170
|
* @returns {string} The value to be used.
|
|
154
171
|
*/
|
|
155
172
|
getOptionValue: PropTypes.func,
|
|
173
|
+
headerFilterMenu: PropTypes.node,
|
|
174
|
+
/**
|
|
175
|
+
* It is `true` if the filter either has a value or an operator with no value
|
|
176
|
+
* required is selected (e.g. `isEmpty`)
|
|
177
|
+
*/
|
|
178
|
+
isFilterActive: PropTypes.bool,
|
|
156
179
|
item: PropTypes.shape({
|
|
157
180
|
field: PropTypes.string.isRequired,
|
|
158
181
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef"];
|
|
3
|
+
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "tabIndex", "disabled", "headerFilterMenu", "isFilterActive", "clearButton", "InputProps"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { unstable_useId as useId } from '@mui/utils';
|
|
@@ -13,7 +13,13 @@ function GridFilterInputValue(props) {
|
|
|
13
13
|
applyValue,
|
|
14
14
|
type,
|
|
15
15
|
apiRef,
|
|
16
|
-
focusElementRef
|
|
16
|
+
focusElementRef,
|
|
17
|
+
tabIndex,
|
|
18
|
+
disabled,
|
|
19
|
+
headerFilterMenu,
|
|
20
|
+
isFilterActive,
|
|
21
|
+
clearButton,
|
|
22
|
+
InputProps
|
|
17
23
|
} = props,
|
|
18
24
|
others = _objectWithoutPropertiesLoose(props, _excluded);
|
|
19
25
|
const filterTimeout = React.useRef();
|
|
@@ -44,9 +50,6 @@ function GridFilterInputValue(props) {
|
|
|
44
50
|
const itemValue = item.value ?? '';
|
|
45
51
|
setFilterValueState(String(itemValue));
|
|
46
52
|
}, [item.value]);
|
|
47
|
-
const InputProps = applying ? {
|
|
48
|
-
endAdornment: /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {})
|
|
49
|
-
} : others.InputProps;
|
|
50
53
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
|
|
51
54
|
id: id,
|
|
52
55
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
@@ -55,7 +58,20 @@ function GridFilterInputValue(props) {
|
|
|
55
58
|
onChange: onFilterChange,
|
|
56
59
|
variant: "standard",
|
|
57
60
|
type: type || 'text',
|
|
58
|
-
InputProps:
|
|
61
|
+
InputProps: _extends({}, applying || clearButton ? {
|
|
62
|
+
endAdornment: applying ? /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
|
|
63
|
+
fontSize: "small",
|
|
64
|
+
color: "action"
|
|
65
|
+
}) : clearButton
|
|
66
|
+
} : {}, headerFilterMenu && isFilterActive ? {
|
|
67
|
+
startAdornment: headerFilterMenu
|
|
68
|
+
} : {}, {
|
|
69
|
+
disabled
|
|
70
|
+
}, InputProps, {
|
|
71
|
+
inputProps: _extends({
|
|
72
|
+
tabIndex
|
|
73
|
+
}, InputProps?.inputProps)
|
|
74
|
+
}),
|
|
59
75
|
InputLabelProps: {
|
|
60
76
|
shrink: true
|
|
61
77
|
},
|
|
@@ -71,7 +87,14 @@ process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
|
|
|
71
87
|
current: PropTypes.object.isRequired
|
|
72
88
|
}).isRequired,
|
|
73
89
|
applyValue: PropTypes.func.isRequired,
|
|
90
|
+
clearButton: PropTypes.node,
|
|
74
91
|
focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
|
|
92
|
+
headerFilterMenu: PropTypes.node,
|
|
93
|
+
/**
|
|
94
|
+
* It is `true` if the filter either has a value or an operator with no value
|
|
95
|
+
* required is selected (e.g. `isEmpty`)
|
|
96
|
+
*/
|
|
97
|
+
isFilterActive: PropTypes.bool,
|
|
75
98
|
item: PropTypes.shape({
|
|
76
99
|
field: PropTypes.string.isRequired,
|
|
77
100
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -205,4 +205,4 @@ process.env.NODE_ENV !== "production" ? GridFilterPanel.propTypes = {
|
|
|
205
205
|
*/
|
|
206
206
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
207
207
|
} : void 0;
|
|
208
|
-
export { GridFilterPanel };
|
|
208
|
+
export { GridFilterPanel, getGridFilter };
|
|
@@ -2,7 +2,8 @@ export * from './GridFilterForm';
|
|
|
2
2
|
export * from './GridFilterInputValue';
|
|
3
3
|
export * from './GridFilterInputDate';
|
|
4
4
|
export * from './GridFilterInputSingleSelect';
|
|
5
|
+
export * from './GridFilterInputBoolean';
|
|
5
6
|
export * from './GridFilterInputValueProps';
|
|
6
|
-
export
|
|
7
|
+
export { GridFilterPanel } from './GridFilterPanel';
|
|
7
8
|
export * from './GridFilterInputMultipleValue';
|
|
8
9
|
export * from './GridFilterInputMultipleSingleSelect';
|
|
@@ -58,6 +58,32 @@ export const GRID_DEFAULT_LOCALE_TEXT = {
|
|
|
58
58
|
filterOperatorIsEmpty: 'is empty',
|
|
59
59
|
filterOperatorIsNotEmpty: 'is not empty',
|
|
60
60
|
filterOperatorIsAnyOf: 'is any of',
|
|
61
|
+
'filterOperator=': '=',
|
|
62
|
+
'filterOperator!=': '!=',
|
|
63
|
+
'filterOperator>': '>',
|
|
64
|
+
'filterOperator>=': '>=',
|
|
65
|
+
'filterOperator<': '<',
|
|
66
|
+
'filterOperator<=': '<=',
|
|
67
|
+
// Header filter operators text
|
|
68
|
+
headerFilterOperatorContains: 'Contains',
|
|
69
|
+
headerFilterOperatorEquals: 'Equals',
|
|
70
|
+
headerFilterOperatorStartsWith: 'Starts with',
|
|
71
|
+
headerFilterOperatorEndsWith: 'Ends with',
|
|
72
|
+
headerFilterOperatorIs: 'Is',
|
|
73
|
+
headerFilterOperatorNot: 'Is not',
|
|
74
|
+
headerFilterOperatorAfter: 'Is after',
|
|
75
|
+
headerFilterOperatorOnOrAfter: 'Is on or after',
|
|
76
|
+
headerFilterOperatorBefore: 'Is before',
|
|
77
|
+
headerFilterOperatorOnOrBefore: 'Is on or before',
|
|
78
|
+
headerFilterOperatorIsEmpty: 'Is empty',
|
|
79
|
+
headerFilterOperatorIsNotEmpty: 'Is not empty',
|
|
80
|
+
headerFilterOperatorIsAnyOf: 'Is any of',
|
|
81
|
+
'headerFilterOperator=': 'Equals',
|
|
82
|
+
'headerFilterOperator!=': 'Not equals',
|
|
83
|
+
'headerFilterOperator>': 'Is greater than',
|
|
84
|
+
'headerFilterOperator>=': 'Is greater than or equal to',
|
|
85
|
+
'headerFilterOperator<': 'Is less than',
|
|
86
|
+
'headerFilterOperator<=': 'Is less than or equal to',
|
|
61
87
|
// Filter values text
|
|
62
88
|
filterValueAny: 'any',
|
|
63
89
|
filterValueTrue: 'true',
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useGridApiOptionHandler, useGridNativeEventListener } from '../../utils';
|
|
3
|
+
import { gridFocusCellSelector } from '../focus/gridFocusStateSelector';
|
|
4
|
+
import { serializeCellValue } from '../export/serializers/csvSerializer';
|
|
3
5
|
function writeToClipboardPolyfill(data) {
|
|
4
6
|
const span = document.createElement('span');
|
|
5
7
|
span.style.whiteSpace = 'pre';
|
|
@@ -18,6 +20,15 @@ function writeToClipboardPolyfill(data) {
|
|
|
18
20
|
document.body.removeChild(span);
|
|
19
21
|
}
|
|
20
22
|
}
|
|
23
|
+
function copyToClipboard(data) {
|
|
24
|
+
if (navigator.clipboard) {
|
|
25
|
+
navigator.clipboard.writeText(data).catch(() => {
|
|
26
|
+
writeToClipboardPolyfill(data);
|
|
27
|
+
});
|
|
28
|
+
} else {
|
|
29
|
+
writeToClipboardPolyfill(data);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
21
32
|
function hasNativeSelection(element) {
|
|
22
33
|
// When getSelection is called on an <iframe> that is not displayed Firefox will return null.
|
|
23
34
|
if (window.getSelection()?.toString()) {
|
|
@@ -37,24 +48,11 @@ function hasNativeSelection(element) {
|
|
|
37
48
|
* @requires useGridCsvExport (method)
|
|
38
49
|
* @requires useGridSelection (method)
|
|
39
50
|
*/
|
|
40
|
-
export const useGridClipboard = apiRef => {
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const data = apiRef.current.getDataAsCsv({
|
|
46
|
-
includeHeaders: false,
|
|
47
|
-
delimiter: '\t'
|
|
48
|
-
});
|
|
49
|
-
if (navigator.clipboard) {
|
|
50
|
-
navigator.clipboard.writeText(data).catch(() => {
|
|
51
|
-
writeToClipboardPolyfill(data);
|
|
52
|
-
});
|
|
53
|
-
} else {
|
|
54
|
-
writeToClipboardPolyfill(data);
|
|
55
|
-
}
|
|
56
|
-
}, [apiRef]);
|
|
57
|
-
const handleKeydown = React.useCallback(event => {
|
|
51
|
+
export const useGridClipboard = (apiRef, props) => {
|
|
52
|
+
const ignoreValueFormatterProp = props.unstable_ignoreValueFormatterDuringExport;
|
|
53
|
+
const ignoreValueFormatter = (typeof ignoreValueFormatterProp === 'object' ? ignoreValueFormatterProp?.clipboardExport : ignoreValueFormatterProp) || false;
|
|
54
|
+
const clipboardCopyCellDelimiter = props.clipboardCopyCellDelimiter;
|
|
55
|
+
const handleCopy = React.useCallback(event => {
|
|
58
56
|
const isModifierKeyPressed = event.ctrlKey || event.metaKey;
|
|
59
57
|
// event.code === 'KeyC' is not enough as event.code assume a QWERTY keyboard layout which would
|
|
60
58
|
// be wrong with a Dvorak keyboard (as if pressing J).
|
|
@@ -66,11 +64,30 @@ export const useGridClipboard = apiRef => {
|
|
|
66
64
|
if (hasNativeSelection(event.target)) {
|
|
67
65
|
return;
|
|
68
66
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
let textToCopy = '';
|
|
68
|
+
const selectedRows = apiRef.current.getSelectedRows();
|
|
69
|
+
if (selectedRows.size > 0) {
|
|
70
|
+
textToCopy = apiRef.current.getDataAsCsv({
|
|
71
|
+
includeHeaders: false,
|
|
72
|
+
// TODO: make it configurable
|
|
73
|
+
delimiter: clipboardCopyCellDelimiter
|
|
74
|
+
});
|
|
75
|
+
} else {
|
|
76
|
+
const focusedCell = gridFocusCellSelector(apiRef);
|
|
77
|
+
if (focusedCell) {
|
|
78
|
+
const cellParams = apiRef.current.getCellParams(focusedCell.id, focusedCell.field);
|
|
79
|
+
textToCopy = serializeCellValue(cellParams, {
|
|
80
|
+
delimiterCharacter: clipboardCopyCellDelimiter,
|
|
81
|
+
ignoreValueFormatter
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
textToCopy = apiRef.current.unstable_applyPipeProcessors('clipboardCopy', textToCopy);
|
|
86
|
+
if (textToCopy) {
|
|
87
|
+
copyToClipboard(textToCopy);
|
|
88
|
+
apiRef.current.publishEvent('clipboardCopy', textToCopy);
|
|
89
|
+
}
|
|
90
|
+
}, [apiRef, ignoreValueFormatter, clipboardCopyCellDelimiter]);
|
|
91
|
+
useGridNativeEventListener(apiRef, apiRef.current.rootElementRef, 'keydown', handleCopy);
|
|
92
|
+
useGridApiOptionHandler(apiRef, 'clipboardCopy', props.onClipboardCopy);
|
|
76
93
|
};
|
|
@@ -260,7 +260,7 @@ export const useGridColumnHeaders = props => {
|
|
|
260
260
|
const tabIndex = columnGroupHeaderTabIndexState !== null && columnGroupHeaderTabIndexState.depth === depth && columnFields.includes(columnGroupHeaderTabIndexState.field) ? 0 : -1;
|
|
261
261
|
const headerInfo = {
|
|
262
262
|
groupId,
|
|
263
|
-
width: columnFields.
|
|
263
|
+
width: columnFields.reduce((acc, field) => acc + apiRef.current.getColumn(field).computedWidth, 0),
|
|
264
264
|
fields: columnFields,
|
|
265
265
|
colIndex: columnIndex,
|
|
266
266
|
hasFocus,
|
|
@@ -316,6 +316,7 @@ export const useGridColumnHeaders = props => {
|
|
|
316
316
|
return {
|
|
317
317
|
renderContext,
|
|
318
318
|
getColumnHeaders,
|
|
319
|
+
getColumnsToRender,
|
|
319
320
|
getColumnGroupHeaders,
|
|
320
321
|
isDragging: !!dragCol,
|
|
321
322
|
getRootProps: (other = {}) => _extends({
|
|
@@ -324,6 +325,7 @@ export const useGridColumnHeaders = props => {
|
|
|
324
325
|
getInnerProps: () => ({
|
|
325
326
|
ref: handleInnerRef,
|
|
326
327
|
role: 'rowgroup'
|
|
327
|
-
})
|
|
328
|
+
}),
|
|
329
|
+
headerHeight
|
|
328
330
|
};
|
|
329
331
|
};
|
|
@@ -10,7 +10,6 @@ import { getVisibleRows } from '../../utils/useGridVisibleRows';
|
|
|
10
10
|
import { gridRowsMetaSelector } from '../rows/gridRowsMetaSelector';
|
|
11
11
|
import { calculatePinnedRowsHeight } from '../rows/gridRowsUtils';
|
|
12
12
|
import { getTotalHeaderHeight } from '../columns/gridColumnsUtils';
|
|
13
|
-
import { gridClasses } from '../../../constants/gridClasses';
|
|
14
13
|
const isTestEnvironment = process.env.NODE_ENV === 'test';
|
|
15
14
|
const hasScroll = ({
|
|
16
15
|
content,
|
|
@@ -150,13 +149,12 @@ export function useGridDimensions(apiRef, props) {
|
|
|
150
149
|
return Math.min(maximumPageSizeWithoutScrollBar, currentPage.rows.length);
|
|
151
150
|
}, [apiRef, props.pagination, props.paginationMode, props.getRowHeight, rowHeight]);
|
|
152
151
|
const computeSizeAndPublishResizeEvent = React.useCallback(() => {
|
|
153
|
-
const
|
|
154
|
-
const mainEl = rootEl?.querySelector(`.${gridClasses.main}`);
|
|
152
|
+
const mainEl = apiRef.current.mainElementRef?.current;
|
|
155
153
|
if (!mainEl) {
|
|
156
154
|
return;
|
|
157
155
|
}
|
|
158
|
-
const height = mainEl.
|
|
159
|
-
const width = mainEl.
|
|
156
|
+
const height = mainEl.clientHeight || 0;
|
|
157
|
+
const width = mainEl.clientWidth || 0;
|
|
160
158
|
const win = ownerWindow(mainEl);
|
|
161
159
|
const computedStyle = win.getComputedStyle(mainEl);
|
|
162
160
|
const paddingLeft = parseInt(computedStyle.paddingLeft, 10) || 0;
|
|
@@ -90,10 +90,14 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
90
90
|
}
|
|
91
91
|
} else if (params.isEditable) {
|
|
92
92
|
let reason;
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
const canStartEditing = apiRef.current.unstable_applyPipeProcessors('canStartEditing', true, {
|
|
94
|
+
event,
|
|
95
|
+
cellParams: params,
|
|
96
|
+
editMode: 'cell'
|
|
97
|
+
});
|
|
98
|
+
if (!canStartEditing) {
|
|
99
|
+
return;
|
|
95
100
|
}
|
|
96
|
-
|
|
97
101
|
if (isPrintableKey(event)) {
|
|
98
102
|
reason = GridCellEditStartReasons.printableKeyDown;
|
|
99
103
|
} else if ((event.ctrlKey || event.metaKey) && event.key === 'v') {
|