@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,8 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { TextFieldProps } from '@mui/material/TextField';
|
|
3
3
|
import { GridFilterInputValueProps } from './GridFilterInputValueProps';
|
|
4
4
|
import { GridSingleSelectColDef } from '../../../models/colDef/gridColDef';
|
|
5
5
|
export type GridFilterInputSingleSelectProps = GridFilterInputValueProps & TextFieldProps & Pick<GridSingleSelectColDef, 'getOptionLabel' | 'getOptionValue'> & {
|
|
6
|
+
headerFilterMenu?: React.ReactNode | null;
|
|
7
|
+
clearButton?: React.ReactNode | null;
|
|
8
|
+
/**
|
|
9
|
+
* It is `true` if the filter either has a value or an operator with no value
|
|
10
|
+
* required is selected (e.g. `isEmpty`)
|
|
11
|
+
*/
|
|
12
|
+
isFilterActive?: boolean;
|
|
6
13
|
type?: 'singleSelect';
|
|
7
14
|
};
|
|
8
15
|
declare function GridFilterInputSingleSelect(props: GridFilterInputSingleSelectProps): JSX.Element | null;
|
|
@@ -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
|
var _item$value, _rootProps$slotProps$, _rootProps$slotProps, _rootProps$slotProps$2, _resolvedColumn, _resolvedColumn2, _rootProps$slotProps2, _rootProps$slotProps3, _rootProps$slotProps4;
|
|
38
44
|
const {
|
|
@@ -42,7 +48,13 @@ function GridFilterInputSingleSelect(props) {
|
|
|
42
48
|
apiRef,
|
|
43
49
|
focusElementRef,
|
|
44
50
|
getOptionLabel: getOptionLabelProp,
|
|
45
|
-
getOptionValue: getOptionValueProp
|
|
51
|
+
getOptionValue: getOptionValueProp,
|
|
52
|
+
placeholder,
|
|
53
|
+
tabIndex,
|
|
54
|
+
label: labelProp,
|
|
55
|
+
headerFilterMenu,
|
|
56
|
+
isFilterActive,
|
|
57
|
+
clearButton
|
|
46
58
|
} = props,
|
|
47
59
|
others = _objectWithoutPropertiesLoose(props, _excluded);
|
|
48
60
|
const [filterValueState, setFilterValueState] = React.useState((_item$value = item.value) != null ? _item$value : '');
|
|
@@ -101,36 +113,40 @@ function GridFilterInputSingleSelect(props) {
|
|
|
101
113
|
if (!isSingleSelectColDef(resolvedColumn)) {
|
|
102
114
|
return null;
|
|
103
115
|
}
|
|
104
|
-
const label = apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
105
|
-
return /*#__PURE__*/_jsxs(
|
|
106
|
-
children: [/*#__PURE__*/
|
|
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
|
-
|
|
132
|
-
|
|
133
|
-
|
|
116
|
+
const label = labelProp != null ? labelProp : apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
117
|
+
return /*#__PURE__*/_jsxs(SingleSelectOperatorContainer, {
|
|
118
|
+
children: [/*#__PURE__*/_jsxs(rootProps.slots.baseFormControl, {
|
|
119
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, (_rootProps$slotProps2 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps2.baseInputLabel, {
|
|
120
|
+
id: labelId,
|
|
121
|
+
shrink: true,
|
|
122
|
+
variant: "standard",
|
|
123
|
+
children: label
|
|
124
|
+
})), /*#__PURE__*/_jsx(rootProps.slots.baseSelect, _extends({
|
|
125
|
+
id: id,
|
|
126
|
+
label: label,
|
|
127
|
+
labelId: labelId,
|
|
128
|
+
value: filterValueState,
|
|
129
|
+
onChange: onFilterChange,
|
|
130
|
+
startAdornment: isFilterActive ? headerFilterMenu : null,
|
|
131
|
+
variant: "standard",
|
|
132
|
+
type: type || 'text',
|
|
133
|
+
inputProps: {
|
|
134
|
+
tabIndex,
|
|
135
|
+
ref: focusElementRef,
|
|
136
|
+
placeholder: placeholder != null ? placeholder : apiRef.current.getLocaleText('filterPanelInputPlaceholder')
|
|
137
|
+
},
|
|
138
|
+
native: isSelectNative
|
|
139
|
+
}, others, (_rootProps$slotProps3 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps3.baseSelect, {
|
|
140
|
+
children: renderSingleSelectOptions({
|
|
141
|
+
column: resolvedColumn,
|
|
142
|
+
OptionComponent: rootProps.slots.baseSelectOption,
|
|
143
|
+
getOptionLabel,
|
|
144
|
+
getOptionValue,
|
|
145
|
+
isSelectNative,
|
|
146
|
+
baseSelectOptionProps: (_rootProps$slotProps4 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps4.baseSelectOption
|
|
147
|
+
})
|
|
148
|
+
}))]
|
|
149
|
+
}), clearButton]
|
|
134
150
|
});
|
|
135
151
|
}
|
|
136
152
|
process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes = {
|
|
@@ -142,6 +158,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes =
|
|
|
142
158
|
current: PropTypes.object.isRequired
|
|
143
159
|
}).isRequired,
|
|
144
160
|
applyValue: PropTypes.func.isRequired,
|
|
161
|
+
clearButton: PropTypes.node,
|
|
145
162
|
focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
|
|
146
163
|
/**
|
|
147
164
|
* Used to determine the label displayed for a given value option.
|
|
@@ -155,6 +172,12 @@ process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes =
|
|
|
155
172
|
* @returns {string} The value to be used.
|
|
156
173
|
*/
|
|
157
174
|
getOptionValue: PropTypes.func,
|
|
175
|
+
headerFilterMenu: PropTypes.node,
|
|
176
|
+
/**
|
|
177
|
+
* It is `true` if the filter either has a value or an operator with no value
|
|
178
|
+
* required is selected (e.g. `isEmpty`)
|
|
179
|
+
*/
|
|
180
|
+
isFilterActive: PropTypes.bool,
|
|
158
181
|
item: PropTypes.shape({
|
|
159
182
|
field: PropTypes.string.isRequired,
|
|
160
183
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { TextFieldProps } from '@mui/material/TextField';
|
|
3
3
|
import { GridFilterInputValueProps } from './GridFilterInputValueProps';
|
|
4
4
|
export declare const SUBMIT_FILTER_STROKE_TIME = 500;
|
|
5
|
-
export
|
|
5
|
+
export type GridTypeFilterInputValueProps = GridFilterInputValueProps & TextFieldProps & {
|
|
6
6
|
type?: 'text' | 'number' | 'date' | 'datetime-local';
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
headerFilterMenu?: React.ReactNode | null;
|
|
8
|
+
clearButton?: React.ReactNode | null;
|
|
9
|
+
/**
|
|
10
|
+
* It is `true` if the filter either has a value or an operator with no value
|
|
11
|
+
* required is selected (e.g. `isEmpty`)
|
|
12
|
+
*/
|
|
13
|
+
isFilterActive?: boolean;
|
|
14
|
+
};
|
|
15
|
+
declare function GridFilterInputValue(props: GridTypeFilterInputValueProps): JSX.Element;
|
|
9
16
|
declare namespace GridFilterInputValue {
|
|
10
17
|
var propTypes: any;
|
|
11
18
|
}
|
|
@@ -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';
|
|
@@ -14,7 +14,13 @@ function GridFilterInputValue(props) {
|
|
|
14
14
|
applyValue,
|
|
15
15
|
type,
|
|
16
16
|
apiRef,
|
|
17
|
-
focusElementRef
|
|
17
|
+
focusElementRef,
|
|
18
|
+
tabIndex,
|
|
19
|
+
disabled,
|
|
20
|
+
headerFilterMenu,
|
|
21
|
+
isFilterActive,
|
|
22
|
+
clearButton,
|
|
23
|
+
InputProps
|
|
18
24
|
} = props,
|
|
19
25
|
others = _objectWithoutPropertiesLoose(props, _excluded);
|
|
20
26
|
const filterTimeout = React.useRef();
|
|
@@ -46,9 +52,6 @@ function GridFilterInputValue(props) {
|
|
|
46
52
|
const itemValue = (_item$value2 = item.value) != null ? _item$value2 : '';
|
|
47
53
|
setFilterValueState(String(itemValue));
|
|
48
54
|
}, [item.value]);
|
|
49
|
-
const InputProps = applying ? {
|
|
50
|
-
endAdornment: /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {})
|
|
51
|
-
} : others.InputProps;
|
|
52
55
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
|
|
53
56
|
id: id,
|
|
54
57
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
@@ -57,7 +60,20 @@ function GridFilterInputValue(props) {
|
|
|
57
60
|
onChange: onFilterChange,
|
|
58
61
|
variant: "standard",
|
|
59
62
|
type: type || 'text',
|
|
60
|
-
InputProps:
|
|
63
|
+
InputProps: _extends({}, applying || clearButton ? {
|
|
64
|
+
endAdornment: applying ? /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
|
|
65
|
+
fontSize: "small",
|
|
66
|
+
color: "action"
|
|
67
|
+
}) : clearButton
|
|
68
|
+
} : {}, headerFilterMenu && isFilterActive ? {
|
|
69
|
+
startAdornment: headerFilterMenu
|
|
70
|
+
} : {}, {
|
|
71
|
+
disabled
|
|
72
|
+
}, InputProps, {
|
|
73
|
+
inputProps: _extends({
|
|
74
|
+
tabIndex
|
|
75
|
+
}, InputProps == null ? void 0 : InputProps.inputProps)
|
|
76
|
+
}),
|
|
61
77
|
InputLabelProps: {
|
|
62
78
|
shrink: true
|
|
63
79
|
},
|
|
@@ -73,7 +89,14 @@ process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
|
|
|
73
89
|
current: PropTypes.object.isRequired
|
|
74
90
|
}).isRequired,
|
|
75
91
|
applyValue: PropTypes.func.isRequired,
|
|
92
|
+
clearButton: PropTypes.node,
|
|
76
93
|
focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
|
|
94
|
+
headerFilterMenu: PropTypes.node,
|
|
95
|
+
/**
|
|
96
|
+
* It is `true` if the filter either has a value or an operator with no value
|
|
97
|
+
* required is selected (e.g. `isEmpty`)
|
|
98
|
+
*/
|
|
99
|
+
isFilterActive: PropTypes.bool,
|
|
77
100
|
item: PropTypes.shape({
|
|
78
101
|
field: PropTypes.string.isRequired,
|
|
79
102
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -29,5 +29,6 @@ export interface GridFilterPanelProps extends Pick<GridFilterFormProps, 'logicOp
|
|
|
29
29
|
*/
|
|
30
30
|
children?: React.ReactNode;
|
|
31
31
|
}
|
|
32
|
+
declare const getGridFilter: (col: GridStateColDef) => GridFilterItem;
|
|
32
33
|
declare const GridFilterPanel: React.ForwardRefExoticComponent<GridFilterPanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
33
|
-
export { GridFilterPanel };
|
|
34
|
+
export { GridFilterPanel, getGridFilter };
|
|
@@ -209,4 +209,4 @@ process.env.NODE_ENV !== "production" ? GridFilterPanel.propTypes = {
|
|
|
209
209
|
*/
|
|
210
210
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
211
211
|
} : void 0;
|
|
212
|
-
export { GridFilterPanel };
|
|
212
|
+
export { GridFilterPanel, getGridFilter };
|
|
@@ -2,7 +2,9 @@ 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';
|
|
8
|
+
export type { GetColumnForNewFilterArgs } from './GridFilterPanel';
|
|
7
9
|
export * from './GridFilterInputMultipleValue';
|
|
8
10
|
export * from './GridFilterInputMultipleSingleSelect';
|
|
@@ -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,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { GridCellIndexCoordinates, GridScrollParams, GridColDef, GridCellCoordinates, GridCellParams } from '../../../models';
|
|
2
|
+
import { GridCellIndexCoordinates, GridScrollParams, GridColDef, GridCellCoordinates, GridCellParams, GridEditMode } from '../../../models';
|
|
3
3
|
import { GridInitialStateCommunity } from '../../../models/gridStateCommunity';
|
|
4
4
|
import { GridExportStateParams, GridRestoreStatePreProcessingContext, GridRestoreStatePreProcessingValue } from '../../features/statePersistence/gridStatePersistenceInterface';
|
|
5
5
|
import { GridHydrateColumnsValue } from '../../features/columns/gridColumnsInterfaces';
|
|
@@ -64,6 +64,17 @@ export interface GridPipeProcessingLookup {
|
|
|
64
64
|
cell: GridCellParams | null;
|
|
65
65
|
};
|
|
66
66
|
};
|
|
67
|
+
clipboardCopy: {
|
|
68
|
+
value: string;
|
|
69
|
+
};
|
|
70
|
+
canStartEditing: {
|
|
71
|
+
value: boolean;
|
|
72
|
+
context: {
|
|
73
|
+
event: React.KeyboardEvent;
|
|
74
|
+
cellParams: GridCellParams;
|
|
75
|
+
editMode: GridEditMode;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
67
78
|
}
|
|
68
79
|
export type GridPipeProcessor<P extends GridPipeProcessorGroup> = (value: GridPipeProcessingLookup[P]['value'], context: GridPipeProcessingLookup[P] extends {
|
|
69
80
|
context: any;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
3
|
+
import type { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
3
4
|
/**
|
|
4
5
|
* @requires useGridCsvExport (method)
|
|
5
6
|
* @requires useGridSelection (method)
|
|
6
7
|
*/
|
|
7
|
-
export declare const useGridClipboard: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>) => void;
|
|
8
|
+
export declare const useGridClipboard: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'unstable_ignoreValueFormatterDuringExport' | 'onClipboardCopy' | 'clipboardCopyCellDelimiter'>) => void;
|
|
@@ -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
|
var _window$getSelection;
|
|
23
34
|
// When getSelection is called on an <iframe> that is not displayed Firefox will return null.
|
|
@@ -38,24 +49,11 @@ function hasNativeSelection(element) {
|
|
|
38
49
|
* @requires useGridCsvExport (method)
|
|
39
50
|
* @requires useGridSelection (method)
|
|
40
51
|
*/
|
|
41
|
-
export const useGridClipboard = apiRef => {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const data = apiRef.current.getDataAsCsv({
|
|
47
|
-
includeHeaders: false,
|
|
48
|
-
delimiter: '\t'
|
|
49
|
-
});
|
|
50
|
-
if (navigator.clipboard) {
|
|
51
|
-
navigator.clipboard.writeText(data).catch(() => {
|
|
52
|
-
writeToClipboardPolyfill(data);
|
|
53
|
-
});
|
|
54
|
-
} else {
|
|
55
|
-
writeToClipboardPolyfill(data);
|
|
56
|
-
}
|
|
57
|
-
}, [apiRef]);
|
|
58
|
-
const handleKeydown = React.useCallback(event => {
|
|
52
|
+
export const useGridClipboard = (apiRef, props) => {
|
|
53
|
+
const ignoreValueFormatterProp = props.unstable_ignoreValueFormatterDuringExport;
|
|
54
|
+
const ignoreValueFormatter = (typeof ignoreValueFormatterProp === 'object' ? ignoreValueFormatterProp == null ? void 0 : ignoreValueFormatterProp.clipboardExport : ignoreValueFormatterProp) || false;
|
|
55
|
+
const clipboardCopyCellDelimiter = props.clipboardCopyCellDelimiter;
|
|
56
|
+
const handleCopy = React.useCallback(event => {
|
|
59
57
|
const isModifierKeyPressed = event.ctrlKey || event.metaKey;
|
|
60
58
|
// event.code === 'KeyC' is not enough as event.code assume a QWERTY keyboard layout which would
|
|
61
59
|
// be wrong with a Dvorak keyboard (as if pressing J).
|
|
@@ -67,11 +65,30 @@ export const useGridClipboard = apiRef => {
|
|
|
67
65
|
if (hasNativeSelection(event.target)) {
|
|
68
66
|
return;
|
|
69
67
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
let textToCopy = '';
|
|
69
|
+
const selectedRows = apiRef.current.getSelectedRows();
|
|
70
|
+
if (selectedRows.size > 0) {
|
|
71
|
+
textToCopy = apiRef.current.getDataAsCsv({
|
|
72
|
+
includeHeaders: false,
|
|
73
|
+
// TODO: make it configurable
|
|
74
|
+
delimiter: clipboardCopyCellDelimiter
|
|
75
|
+
});
|
|
76
|
+
} else {
|
|
77
|
+
const focusedCell = gridFocusCellSelector(apiRef);
|
|
78
|
+
if (focusedCell) {
|
|
79
|
+
const cellParams = apiRef.current.getCellParams(focusedCell.id, focusedCell.field);
|
|
80
|
+
textToCopy = serializeCellValue(cellParams, {
|
|
81
|
+
delimiterCharacter: clipboardCopyCellDelimiter,
|
|
82
|
+
ignoreValueFormatter
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
textToCopy = apiRef.current.unstable_applyPipeProcessors('clipboardCopy', textToCopy);
|
|
87
|
+
if (textToCopy) {
|
|
88
|
+
copyToClipboard(textToCopy);
|
|
89
|
+
apiRef.current.publishEvent('clipboardCopy', textToCopy);
|
|
90
|
+
}
|
|
91
|
+
}, [apiRef, ignoreValueFormatter, clipboardCopyCellDelimiter]);
|
|
92
|
+
useGridNativeEventListener(apiRef, apiRef.current.rootElementRef, 'keydown', handleCopy);
|
|
93
|
+
useGridApiOptionHandler(apiRef, 'clipboardCopy', props.onClipboardCopy);
|
|
77
94
|
};
|
|
@@ -25,7 +25,7 @@ export interface UseGridColumnHeadersProps {
|
|
|
25
25
|
columnGroupsHeaderStructure: GridGroupingStructure[][];
|
|
26
26
|
hasOtherElementInTabSequence: boolean;
|
|
27
27
|
}
|
|
28
|
-
interface GetHeadersParams {
|
|
28
|
+
export interface GetHeadersParams {
|
|
29
29
|
renderContext: GridRenderContext | null;
|
|
30
30
|
minFirstColumn?: number;
|
|
31
31
|
maxLastColumn?: number;
|
|
@@ -33,6 +33,13 @@ interface GetHeadersParams {
|
|
|
33
33
|
export declare const useGridColumnHeaders: (props: UseGridColumnHeadersProps) => {
|
|
34
34
|
renderContext: GridRenderContext | null;
|
|
35
35
|
getColumnHeaders: (params?: GetHeadersParams, other?: {}) => JSX.Element | null;
|
|
36
|
+
getColumnsToRender: (params?: GetHeadersParams) => {
|
|
37
|
+
renderedColumns: GridStateColDef[];
|
|
38
|
+
firstColumnToRender: number;
|
|
39
|
+
lastColumnToRender: number;
|
|
40
|
+
minFirstColumn: number;
|
|
41
|
+
maxLastColumn: number;
|
|
42
|
+
} | null;
|
|
36
43
|
getColumnGroupHeaders: (params?: GetHeadersParams) => JSX.Element[] | null;
|
|
37
44
|
isDragging: boolean;
|
|
38
45
|
getRootProps: (other?: {}) => {
|
|
@@ -46,5 +53,5 @@ export declare const useGridColumnHeaders: (props: UseGridColumnHeadersProps) =>
|
|
|
46
53
|
ref: ((instance: HTMLDivElement | null) => void) | null;
|
|
47
54
|
role: string;
|
|
48
55
|
};
|
|
56
|
+
headerHeight: number;
|
|
49
57
|
};
|
|
50
|
-
export {};
|
|
@@ -263,7 +263,7 @@ export const useGridColumnHeaders = props => {
|
|
|
263
263
|
const tabIndex = columnGroupHeaderTabIndexState !== null && columnGroupHeaderTabIndexState.depth === depth && columnFields.includes(columnGroupHeaderTabIndexState.field) ? 0 : -1;
|
|
264
264
|
const headerInfo = {
|
|
265
265
|
groupId,
|
|
266
|
-
width: columnFields.
|
|
266
|
+
width: columnFields.reduce((acc, field) => acc + apiRef.current.getColumn(field).computedWidth, 0),
|
|
267
267
|
fields: columnFields,
|
|
268
268
|
colIndex: columnIndex,
|
|
269
269
|
hasFocus,
|
|
@@ -319,6 +319,7 @@ export const useGridColumnHeaders = props => {
|
|
|
319
319
|
return {
|
|
320
320
|
renderContext,
|
|
321
321
|
getColumnHeaders,
|
|
322
|
+
getColumnsToRender,
|
|
322
323
|
getColumnGroupHeaders,
|
|
323
324
|
isDragging: !!dragCol,
|
|
324
325
|
getRootProps: (other = {}) => _extends({
|
|
@@ -327,6 +328,7 @@ export const useGridColumnHeaders = props => {
|
|
|
327
328
|
getInnerProps: () => ({
|
|
328
329
|
ref: handleInnerRef,
|
|
329
330
|
role: 'rowgroup'
|
|
330
|
-
})
|
|
331
|
+
}),
|
|
332
|
+
headerHeight
|
|
331
333
|
};
|
|
332
334
|
};
|
|
@@ -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,
|
|
@@ -151,14 +150,13 @@ export function useGridDimensions(apiRef, props) {
|
|
|
151
150
|
return Math.min(maximumPageSizeWithoutScrollBar, currentPage.rows.length);
|
|
152
151
|
}, [apiRef, props.pagination, props.paginationMode, props.getRowHeight, rowHeight]);
|
|
153
152
|
const computeSizeAndPublishResizeEvent = React.useCallback(() => {
|
|
154
|
-
var _apiRef$current$
|
|
155
|
-
const
|
|
156
|
-
const mainEl = rootEl == null ? void 0 : rootEl.querySelector(`.${gridClasses.main}`);
|
|
153
|
+
var _apiRef$current$mainE, _previousSize$current, _previousSize$current2;
|
|
154
|
+
const mainEl = (_apiRef$current$mainE = apiRef.current.mainElementRef) == null ? void 0 : _apiRef$current$mainE.current;
|
|
157
155
|
if (!mainEl) {
|
|
158
156
|
return;
|
|
159
157
|
}
|
|
160
|
-
const height = mainEl.
|
|
161
|
-
const width = mainEl.
|
|
158
|
+
const height = mainEl.clientHeight || 0;
|
|
159
|
+
const width = mainEl.clientWidth || 0;
|
|
162
160
|
const win = ownerWindow(mainEl);
|
|
163
161
|
const computedStyle = win.getComputedStyle(mainEl);
|
|
164
162
|
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') {
|
|
@@ -29,9 +29,6 @@ export const useGridEditing = (apiRef, props) => {
|
|
|
29
29
|
if (isCellEditableProp) {
|
|
30
30
|
return isCellEditableProp(params);
|
|
31
31
|
}
|
|
32
|
-
if (params.rowNode.type === 'pinnedRow') {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
32
|
return true;
|
|
36
33
|
}, [isCellEditableProp]);
|
|
37
34
|
const maybeDebounce = (id, field, debounceMs, callback) => {
|
|
@@ -144,10 +144,14 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
144
144
|
}
|
|
145
145
|
} else if (params.isEditable) {
|
|
146
146
|
let reason;
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
const canStartEditing = apiRef.current.unstable_applyPipeProcessors('canStartEditing', true, {
|
|
148
|
+
event,
|
|
149
|
+
cellParams: params,
|
|
150
|
+
editMode: 'row'
|
|
151
|
+
});
|
|
152
|
+
if (!canStartEditing) {
|
|
153
|
+
return;
|
|
149
154
|
}
|
|
150
|
-
|
|
151
155
|
if (isPrintableKey(event)) {
|
|
152
156
|
reason = GridRowEditStartReasons.printableKeyDown;
|
|
153
157
|
} else if ((event.ctrlKey || event.metaKey) && event.key === 'v') {
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { GridRowId } from '../../../../models';
|
|
2
2
|
import { GridCellParams } from '../../../../models/params/gridCellParams';
|
|
3
3
|
import { GridStateColDef } from '../../../../models/colDef/gridColDef';
|
|
4
|
+
export declare const serializeCellValue: (cellParams: GridCellParams, options: {
|
|
5
|
+
delimiterCharacter: string;
|
|
6
|
+
ignoreValueFormatter: boolean;
|
|
7
|
+
}) => any;
|
|
4
8
|
interface BuildCSVOptions {
|
|
5
9
|
columns: GridStateColDef[];
|
|
6
10
|
rowIds: GridRowId[];
|
|
7
11
|
getCellParams: (id: GridRowId, field: string) => GridCellParams;
|
|
8
12
|
delimiterCharacter: string;
|
|
9
13
|
includeHeaders: boolean;
|
|
14
|
+
ignoreValueFormatter: boolean;
|
|
10
15
|
}
|
|
11
16
|
export declare function buildCSV(options: BuildCSVOptions): string;
|
|
12
17
|
export {};
|