@mui/x-data-grid 6.4.0 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/DataGrid/useDataGridProps.js +5 -12
- package/colDef/gridNumericOperators.js +0 -6
- package/components/cell/GridEditInputCell.js +4 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +15 -2
- package/components/panel/filterPanel/GridFilterInputBoolean.js +80 -36
- package/components/panel/filterPanel/GridFilterInputDate.d.ts +8 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +27 -6
- package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +8 -1
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +55 -32
- package/components/panel/filterPanel/GridFilterInputValue.d.ts +11 -4
- package/components/panel/filterPanel/GridFilterInputValue.js +29 -6
- package/components/panel/filterPanel/GridFilterPanel.d.ts +2 -1
- package/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/components/panel/filterPanel/index.d.ts +3 -1
- package/components/panel/filterPanel/index.js +2 -1
- package/constants/localeTextConstants.js +26 -0
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +9 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -2
- package/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/hooks/features/editing/useGridEditing.js +0 -3
- package/hooks/features/focus/gridFocusState.d.ts +2 -0
- package/hooks/features/focus/gridFocusStateSelector.d.ts +2 -0
- package/hooks/features/focus/gridFocusStateSelector.js +6 -0
- package/hooks/features/focus/useGridFocus.js +55 -9
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +4 -0
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +5 -0
- package/hooks/features/headerFiltering/index.d.ts +1 -0
- package/hooks/features/headerFiltering/index.js +1 -0
- package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +6 -0
- package/hooks/features/headerFiltering/useGridHeaderFiltering.js +91 -0
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +2 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +113 -4
- package/hooks/features/rows/useGridRows.js +16 -1
- package/index.js +1 -1
- package/internals/index.d.ts +6 -1
- package/internals/index.js +4 -0
- package/internals/utils/index.d.ts +1 -0
- package/internals/utils/index.js +2 -1
- package/internals/utils/useProps.d.ts +8 -0
- package/internals/utils/useProps.js +13 -0
- package/legacy/DataGrid/useDataGridProps.js +8 -8
- package/legacy/colDef/gridNumericOperators.js +0 -6
- package/legacy/components/cell/GridEditInputCell.js +4 -1
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +79 -35
- package/legacy/components/panel/filterPanel/GridFilterInputDate.js +26 -5
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +54 -31
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +28 -5
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/legacy/components/panel/filterPanel/index.js +2 -1
- package/legacy/constants/localeTextConstants.js +26 -0
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -5
- package/legacy/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/legacy/hooks/features/editing/useGridEditing.js +0 -3
- package/legacy/hooks/features/focus/gridFocusStateSelector.js +10 -0
- package/legacy/hooks/features/focus/useGridFocus.js +58 -9
- package/legacy/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +11 -0
- package/legacy/hooks/features/headerFiltering/index.js +1 -0
- package/legacy/hooks/features/headerFiltering/useGridHeaderFiltering.js +93 -0
- package/legacy/hooks/features/index.js +2 -1
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +113 -4
- package/legacy/hooks/features/rows/useGridRows.js +16 -1
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +4 -0
- package/legacy/internals/utils/index.js +2 -1
- package/legacy/internals/utils/useProps.js +11 -0
- package/legacy/locales/arSD.js +28 -0
- package/legacy/locales/beBY.js +28 -0
- package/legacy/locales/bgBG.js +28 -0
- package/legacy/locales/csCZ.js +36 -8
- package/legacy/locales/daDK.js +28 -0
- package/legacy/locales/deDE.js +28 -0
- package/legacy/locales/elGR.js +27 -0
- package/legacy/locales/esES.js +28 -0
- package/legacy/locales/faIR.js +28 -0
- package/legacy/locales/fiFI.js +28 -0
- package/legacy/locales/frFR.js +28 -0
- package/legacy/locales/heIL.js +30 -2
- package/legacy/locales/huHU.js +28 -0
- package/legacy/locales/itIT.js +28 -0
- package/legacy/locales/jaJP.js +28 -0
- package/legacy/locales/koKR.js +28 -0
- package/legacy/locales/nbNO.js +28 -0
- package/legacy/locales/nlNL.js +28 -0
- package/legacy/locales/plPL.js +28 -0
- package/legacy/locales/ptBR.js +28 -0
- package/legacy/locales/roRO.js +28 -0
- package/legacy/locales/ruRU.js +28 -0
- package/legacy/locales/skSK.js +28 -0
- package/legacy/locales/svSE.js +28 -0
- package/legacy/locales/trTR.js +28 -0
- package/legacy/locales/ukUA.js +28 -0
- package/legacy/locales/urPK.js +28 -0
- package/legacy/locales/viVN.js +27 -0
- package/legacy/locales/zhCN.js +28 -0
- package/legacy/locales/zhTW.js +28 -0
- package/legacy/material/index.js +2 -0
- package/legacy/models/api/gridHeaderFilteringApi.js +1 -0
- package/legacy/models/gridHeaderFilteringModel.js +1 -0
- package/legacy/models/index.js +0 -1
- package/locales/arSD.js +28 -0
- package/locales/beBY.js +28 -0
- package/locales/bgBG.js +28 -0
- package/locales/csCZ.js +36 -8
- package/locales/daDK.js +28 -0
- package/locales/deDE.js +28 -0
- package/locales/elGR.js +27 -0
- package/locales/esES.js +28 -0
- package/locales/faIR.js +28 -0
- package/locales/fiFI.js +28 -0
- package/locales/frFR.js +28 -0
- package/locales/heIL.js +30 -2
- package/locales/huHU.js +28 -0
- package/locales/itIT.js +28 -0
- package/locales/jaJP.js +28 -0
- package/locales/koKR.js +28 -0
- package/locales/nbNO.js +28 -0
- package/locales/nlNL.js +28 -0
- package/locales/plPL.js +28 -0
- package/locales/ptBR.js +28 -0
- package/locales/roRO.js +28 -0
- package/locales/ruRU.js +28 -0
- package/locales/skSK.js +28 -0
- package/locales/svSE.js +28 -0
- package/locales/trTR.js +28 -0
- package/locales/ukUA.js +28 -0
- package/locales/urPK.js +28 -0
- package/locales/viVN.js +27 -0
- package/locales/zhCN.js +28 -0
- package/locales/zhTW.js +28 -0
- package/material/index.d.ts +3 -66
- package/material/index.js +2 -0
- package/models/api/gridApiCommon.d.ts +3 -2
- package/models/api/gridCoreApi.d.ts +4 -0
- package/models/api/gridFocusApi.d.ts +6 -0
- package/models/api/gridHeaderFilteringApi.d.ts +30 -0
- package/models/api/gridHeaderFilteringApi.js +1 -0
- package/models/api/gridLocaleTextApi.d.ts +25 -0
- package/models/events/gridEventLookup.d.ts +27 -1
- package/models/gridFilterOperator.d.ts +4 -0
- package/models/gridHeaderFilteringModel.d.ts +5 -0
- package/models/gridHeaderFilteringModel.js +1 -0
- package/models/gridSlotsComponent.d.ts +16 -4
- package/models/gridStateCommunity.d.ts +2 -0
- package/models/index.d.ts +1 -1
- package/models/index.js +0 -1
- package/modern/DataGrid/useDataGridProps.js +5 -12
- package/modern/colDef/gridNumericOperators.js +0 -6
- package/modern/components/cell/GridEditInputCell.js +4 -1
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +80 -36
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +27 -6
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +55 -32
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +29 -6
- package/modern/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/modern/components/panel/filterPanel/index.js +2 -1
- package/modern/constants/localeTextConstants.js +26 -0
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/modern/hooks/features/editing/useGridEditing.js +0 -3
- package/modern/hooks/features/focus/gridFocusStateSelector.js +6 -0
- package/modern/hooks/features/focus/useGridFocus.js +55 -9
- package/modern/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +5 -0
- package/modern/hooks/features/headerFiltering/index.js +1 -0
- package/modern/hooks/features/headerFiltering/useGridHeaderFiltering.js +90 -0
- package/modern/hooks/features/index.js +2 -1
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +113 -4
- package/modern/hooks/features/rows/useGridRows.js +16 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +4 -0
- package/modern/internals/utils/index.js +2 -1
- package/modern/internals/utils/useProps.js +13 -0
- package/modern/locales/arSD.js +28 -0
- package/modern/locales/beBY.js +28 -0
- package/modern/locales/bgBG.js +28 -0
- package/modern/locales/csCZ.js +36 -8
- package/modern/locales/daDK.js +28 -0
- package/modern/locales/deDE.js +28 -0
- package/modern/locales/elGR.js +27 -0
- package/modern/locales/esES.js +28 -0
- package/modern/locales/faIR.js +28 -0
- package/modern/locales/fiFI.js +28 -0
- package/modern/locales/frFR.js +28 -0
- package/modern/locales/heIL.js +30 -2
- package/modern/locales/huHU.js +28 -0
- package/modern/locales/itIT.js +28 -0
- package/modern/locales/jaJP.js +28 -0
- package/modern/locales/koKR.js +28 -0
- package/modern/locales/nbNO.js +28 -0
- package/modern/locales/nlNL.js +28 -0
- package/modern/locales/plPL.js +28 -0
- package/modern/locales/ptBR.js +28 -0
- package/modern/locales/roRO.js +28 -0
- package/modern/locales/ruRU.js +28 -0
- package/modern/locales/skSK.js +28 -0
- package/modern/locales/svSE.js +28 -0
- package/modern/locales/trTR.js +28 -0
- package/modern/locales/ukUA.js +28 -0
- package/modern/locales/urPK.js +28 -0
- package/modern/locales/viVN.js +27 -0
- package/modern/locales/zhCN.js +28 -0
- package/modern/locales/zhTW.js +28 -0
- package/modern/material/index.js +2 -0
- package/modern/models/api/gridHeaderFilteringApi.js +1 -0
- package/modern/models/gridHeaderFilteringModel.js +1 -0
- package/modern/models/index.js +0 -1
- package/node/DataGrid/useDataGridProps.js +4 -11
- package/node/colDef/gridNumericOperators.js +0 -6
- package/node/components/cell/GridEditInputCell.js +4 -1
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +78 -35
- package/node/components/panel/filterPanel/GridFilterInputDate.js +27 -6
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +55 -32
- package/node/components/panel/filterPanel/GridFilterInputValue.js +29 -6
- package/node/components/panel/filterPanel/GridFilterPanel.js +2 -1
- package/node/components/panel/filterPanel/index.js +26 -8
- package/node/constants/localeTextConstants.js +26 -0
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -2
- package/node/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/node/hooks/features/editing/useGridEditing.js +0 -3
- package/node/hooks/features/focus/gridFocusStateSelector.js +9 -1
- package/node/hooks/features/focus/useGridFocus.js +55 -9
- package/node/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +15 -0
- package/node/hooks/features/headerFiltering/index.js +16 -0
- package/node/hooks/features/headerFiltering/useGridHeaderFiltering.js +101 -0
- package/node/hooks/features/index.js +11 -0
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +113 -4
- package/node/hooks/features/rows/useGridRows.js +16 -1
- package/node/index.js +1 -1
- package/node/internals/index.js +46 -0
- package/node/internals/utils/index.js +11 -0
- package/node/internals/utils/useProps.js +22 -0
- package/node/locales/arSD.js +28 -0
- package/node/locales/beBY.js +28 -0
- package/node/locales/bgBG.js +28 -0
- package/node/locales/csCZ.js +36 -8
- package/node/locales/daDK.js +28 -0
- package/node/locales/deDE.js +28 -0
- package/node/locales/elGR.js +27 -0
- package/node/locales/esES.js +28 -0
- package/node/locales/faIR.js +28 -0
- package/node/locales/fiFI.js +28 -0
- package/node/locales/frFR.js +28 -0
- package/node/locales/heIL.js +30 -2
- package/node/locales/huHU.js +28 -0
- package/node/locales/itIT.js +28 -0
- package/node/locales/jaJP.js +28 -0
- package/node/locales/koKR.js +28 -0
- package/node/locales/nbNO.js +28 -0
- package/node/locales/nlNL.js +28 -0
- package/node/locales/plPL.js +28 -0
- package/node/locales/ptBR.js +28 -0
- package/node/locales/roRO.js +28 -0
- package/node/locales/ruRU.js +28 -0
- package/node/locales/skSK.js +28 -0
- package/node/locales/svSE.js +28 -0
- package/node/locales/trTR.js +28 -0
- package/node/locales/ukUA.js +28 -0
- package/node/locales/urPK.js +28 -0
- package/node/locales/viVN.js +27 -0
- package/node/locales/zhCN.js +28 -0
- package/node/locales/zhTW.js +28 -0
- package/node/material/index.js +2 -0
- package/node/models/api/gridHeaderFilteringApi.js +5 -0
- package/node/models/gridHeaderFilteringModel.js +5 -0
- package/node/models/index.js +0 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,62 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## v6.5.0
|
|
7
|
+
|
|
8
|
+
_May 19, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 💫 Introduce filtering on column headers for `DataGridPro` and `DataGridPremium`:
|
|
13
|
+
|
|
14
|
+
https://github.com/mui/mui-x/assets/12609561/c4c2bfec-59cf-4cab-932d-dc1983081de9
|
|
15
|
+
|
|
16
|
+
See [the documentation](https://mui.com/x/react-data-grid/filtering/#header-filters) for more information
|
|
17
|
+
|
|
18
|
+
- 🌍 Improve Hebrew (he-IL) and Czech (cs-CZ) locales
|
|
19
|
+
- 📝 Support for editing on pinned rows
|
|
20
|
+
- 🚀 Performance improvements
|
|
21
|
+
- 🐞 Bugfixes
|
|
22
|
+
- 📚 Documentation improvements
|
|
23
|
+
|
|
24
|
+
### `@mui/x-data-grid@6.5.0` / `@mui/x-data-grid-pro@6.5.0` / `@mui/x-data-grid-premium@6.5.0`
|
|
25
|
+
|
|
26
|
+
#### Changes
|
|
27
|
+
|
|
28
|
+
- [DataGrid] Fix grid size calculation when `.MuiDataGrid-main` has border (#8882) @cherniavskii
|
|
29
|
+
- [DataGridPro] Filtering on Column Header (#7760) @MBilalShafi
|
|
30
|
+
- [DataGridPro] Improve `treeData` and `rowGrouping` performance (#8990) @MBilalShafi
|
|
31
|
+
- [DataGridPro] Support pinned rows editing (#8921) @cherniavskii
|
|
32
|
+
- [l10n] Improve Hebrew (he-IL) locale (#8943) @Itzik-Tech
|
|
33
|
+
- [l10n] Improve Czech (cs-CZ) locale (#8829) @harastaivan
|
|
34
|
+
- [l10n] Improve Czech (cs-CZ) locale (#8956) @davidzemancz
|
|
35
|
+
|
|
36
|
+
### `@mui/x-date-pickers@6.5.0` / `@mui/x-date-pickers-pro@6.5.0`
|
|
37
|
+
|
|
38
|
+
#### Changes
|
|
39
|
+
|
|
40
|
+
- [fields] Select the first section instead of last when clicking right of content (#9005) @noraleonte
|
|
41
|
+
- [fields] Refactor prop drilling in fields (#8660) @flaviendelangle
|
|
42
|
+
- [pickers] Allow to render the months before `currentMonth` instead of the one after (#8592) @flaviendelangle
|
|
43
|
+
- [pickers] Fix view management when `openTo` or `views` is modified (#8997) @alexfauquette
|
|
44
|
+
- [l10n] Improve Czech (cs-CZ) locale (#8829) @harastaivan
|
|
45
|
+
|
|
46
|
+
### Docs
|
|
47
|
+
|
|
48
|
+
- [docs] Clarify what Controlled / Uncontrolled means (#8926) @flaviendelangle
|
|
49
|
+
- [docs] Fix docs using wrong service worker (#9030) @cherniavskii
|
|
50
|
+
- [docs] Remove prop-types from JS demos (#9008) @flaviendelangle
|
|
51
|
+
|
|
52
|
+
### Core
|
|
53
|
+
|
|
54
|
+
- [core] Add assertion about checkbox rerenders (#8974) @oliviertassinari
|
|
55
|
+
- [core] Allow selecting a section by type in field tests (#9009) @flaviendelangle
|
|
56
|
+
- [core] Fix `yarn.lock` (#8988) @flaviendelangle
|
|
57
|
+
- [core] Fix flacky adapter test (#8995) @flaviendelangle
|
|
58
|
+
- [charts] Clean the axis rendering (#8948) @alexfauquette
|
|
59
|
+
- [DataGrid] Memoize root props for better performance (#8942) @romgrk
|
|
60
|
+
- [test] Skip flaky unit tests in JSDOM (#8994) @cherniavskii
|
|
61
|
+
|
|
6
62
|
## v6.4.0
|
|
7
63
|
|
|
8
64
|
_May 12, 2023_
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["components", "componentsProps"];
|
|
4
2
|
import * as React from 'react';
|
|
5
3
|
import { useThemeProps } from '@mui/material/styles';
|
|
6
4
|
import { GRID_DEFAULT_LOCALE_TEXT } from '../constants';
|
|
7
5
|
import { DATA_GRID_DEFAULT_SLOTS_COMPONENTS } from '../constants/defaultGridSlotsComponents';
|
|
8
6
|
import { GridEditModes } from '../models';
|
|
9
|
-
import { computeSlots, uncapitalizeObjectKeys } from '../internals/utils';
|
|
7
|
+
import { computeSlots, useProps, uncapitalizeObjectKeys } from '../internals/utils';
|
|
10
8
|
const DATA_GRID_FORCED_PROPS = {
|
|
11
9
|
disableMultipleColumnsFiltering: true,
|
|
12
10
|
disableMultipleColumnsSorting: true,
|
|
@@ -72,15 +70,10 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
72
70
|
};
|
|
73
71
|
const defaultSlots = uncapitalizeObjectKeys(DATA_GRID_DEFAULT_SLOTS_COMPONENTS);
|
|
74
72
|
export const useDataGridProps = inProps => {
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
{
|
|
80
|
-
components,
|
|
81
|
-
componentsProps
|
|
82
|
-
} = _useThemeProps,
|
|
83
|
-
themedProps = _objectWithoutPropertiesLoose(_useThemeProps, _excluded);
|
|
73
|
+
const [components, componentsProps, themedProps] = useProps(useThemeProps({
|
|
74
|
+
props: inProps,
|
|
75
|
+
name: 'MuiDataGrid'
|
|
76
|
+
}));
|
|
84
77
|
const localeText = React.useMemo(() => _extends({}, GRID_DEFAULT_LOCALE_TEXT, themedProps.localeText), [themedProps.localeText]);
|
|
85
78
|
const slots = React.useMemo(() => computeSlots({
|
|
86
79
|
defaultSlots,
|
|
@@ -17,7 +17,6 @@ export const getGridNumericQuickFilterFn = value => {
|
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
export const getGridNumericOperators = () => [{
|
|
20
|
-
label: '=',
|
|
21
20
|
value: '=',
|
|
22
21
|
getApplyFilterFn: filterItem => {
|
|
23
22
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
@@ -34,7 +33,6 @@ export const getGridNumericOperators = () => [{
|
|
|
34
33
|
type: 'number'
|
|
35
34
|
}
|
|
36
35
|
}, {
|
|
37
|
-
label: '!=',
|
|
38
36
|
value: '!=',
|
|
39
37
|
getApplyFilterFn: filterItem => {
|
|
40
38
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
@@ -51,7 +49,6 @@ export const getGridNumericOperators = () => [{
|
|
|
51
49
|
type: 'number'
|
|
52
50
|
}
|
|
53
51
|
}, {
|
|
54
|
-
label: '>',
|
|
55
52
|
value: '>',
|
|
56
53
|
getApplyFilterFn: filterItem => {
|
|
57
54
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
@@ -71,7 +68,6 @@ export const getGridNumericOperators = () => [{
|
|
|
71
68
|
type: 'number'
|
|
72
69
|
}
|
|
73
70
|
}, {
|
|
74
|
-
label: '>=',
|
|
75
71
|
value: '>=',
|
|
76
72
|
getApplyFilterFn: filterItem => {
|
|
77
73
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
@@ -91,7 +87,6 @@ export const getGridNumericOperators = () => [{
|
|
|
91
87
|
type: 'number'
|
|
92
88
|
}
|
|
93
89
|
}, {
|
|
94
|
-
label: '<',
|
|
95
90
|
value: '<',
|
|
96
91
|
getApplyFilterFn: filterItem => {
|
|
97
92
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
@@ -111,7 +106,6 @@ export const getGridNumericOperators = () => [{
|
|
|
111
106
|
type: 'number'
|
|
112
107
|
}
|
|
113
108
|
}, {
|
|
114
|
-
label: '<=',
|
|
115
109
|
value: '<=',
|
|
116
110
|
getApplyFilterFn: filterItem => {
|
|
117
111
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
@@ -88,7 +88,10 @@ const GridEditInputCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
88
88
|
type: colDef.type === 'number' ? colDef.type : 'text',
|
|
89
89
|
value: valueState != null ? valueState : '',
|
|
90
90
|
onChange: handleChange,
|
|
91
|
-
endAdornment: isProcessingProps ? /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
|
|
91
|
+
endAdornment: isProcessingProps ? /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
|
|
92
|
+
fontSize: "small",
|
|
93
|
+
color: "action"
|
|
94
|
+
}) : undefined
|
|
92
95
|
}, other));
|
|
93
96
|
});
|
|
94
97
|
process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes = {
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { TextFieldProps } from '@mui/material/TextField';
|
|
3
3
|
import { GridFilterInputValueProps } from './GridFilterInputValueProps';
|
|
4
|
-
export
|
|
4
|
+
export type GridFilterInputBooleanProps = GridFilterInputValueProps & TextFieldProps & {
|
|
5
|
+
headerFilterMenu?: React.ReactNode | null;
|
|
6
|
+
clearButton?: React.ReactNode | null;
|
|
7
|
+
/**
|
|
8
|
+
* It is `true` if the filter either has a value or an operator with no value
|
|
9
|
+
* required is selected (e.g. `isEmpty`)
|
|
10
|
+
*/
|
|
11
|
+
isFilterActive?: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare function GridFilterInputBoolean(props: GridFilterInputBooleanProps): JSX.Element;
|
|
14
|
+
declare namespace GridFilterInputBoolean {
|
|
15
|
+
var propTypes: any;
|
|
16
|
+
}
|
|
17
|
+
export { GridFilterInputBoolean };
|
|
@@ -1,18 +1,30 @@
|
|
|
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
|
var _rootProps$slotProps, _baseSelectProps$nati, _rootProps$slotProps2, _rootProps$slotProps3;
|
|
11
18
|
const {
|
|
12
19
|
item,
|
|
13
20
|
applyValue,
|
|
14
21
|
apiRef,
|
|
15
|
-
focusElementRef
|
|
22
|
+
focusElementRef,
|
|
23
|
+
headerFilterMenu,
|
|
24
|
+
isFilterActive,
|
|
25
|
+
clearButton,
|
|
26
|
+
tabIndex,
|
|
27
|
+
label: labelProp
|
|
16
28
|
} = props,
|
|
17
29
|
others = _objectWithoutPropertiesLoose(props, _excluded);
|
|
18
30
|
const [filterValueState, setFilterValueState] = React.useState(item.value || '');
|
|
@@ -32,39 +44,71 @@ export function GridFilterInputBoolean(props) {
|
|
|
32
44
|
React.useEffect(() => {
|
|
33
45
|
setFilterValueState(item.value || '');
|
|
34
46
|
}, [item.value]);
|
|
35
|
-
const label = apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
36
|
-
return /*#__PURE__*/_jsxs(
|
|
37
|
-
children: [/*#__PURE__*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
inputProps: {
|
|
52
|
-
ref: focusElementRef
|
|
53
|
-
}
|
|
54
|
-
}, others, baseSelectProps, {
|
|
55
|
-
children: [/*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
47
|
+
const label = labelProp != null ? labelProp : apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
48
|
+
return /*#__PURE__*/_jsxs(BooleanOperatorContainer, {
|
|
49
|
+
children: [/*#__PURE__*/_jsxs(rootProps.slots.baseFormControl, {
|
|
50
|
+
fullWidth: true,
|
|
51
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, (_rootProps$slotProps3 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps3.baseInputLabel, {
|
|
52
|
+
id: labelId,
|
|
53
|
+
shrink: true,
|
|
54
|
+
variant: "standard",
|
|
55
|
+
children: label
|
|
56
|
+
})), /*#__PURE__*/_jsxs(rootProps.slots.baseSelect, _extends({
|
|
57
|
+
labelId: labelId,
|
|
58
|
+
id: selectId,
|
|
59
|
+
label: label,
|
|
60
|
+
value: filterValueState,
|
|
61
|
+
onChange: onFilterChange,
|
|
62
|
+
variant: "standard",
|
|
56
63
|
native: isSelectNative,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
displayEmpty: true,
|
|
65
|
+
startAdornment: isFilterActive ? headerFilterMenu : null,
|
|
66
|
+
inputProps: {
|
|
67
|
+
ref: focusElementRef,
|
|
68
|
+
tabIndex
|
|
69
|
+
}
|
|
70
|
+
}, others, baseSelectProps, {
|
|
71
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
72
|
+
native: isSelectNative,
|
|
73
|
+
value: "",
|
|
74
|
+
children: apiRef.current.getLocaleText('filterValueAny')
|
|
75
|
+
})), /*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
76
|
+
native: isSelectNative,
|
|
77
|
+
value: "true",
|
|
78
|
+
children: apiRef.current.getLocaleText('filterValueTrue')
|
|
79
|
+
})), /*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
80
|
+
native: isSelectNative,
|
|
81
|
+
value: "false",
|
|
82
|
+
children: apiRef.current.getLocaleText('filterValueFalse')
|
|
83
|
+
}))]
|
|
67
84
|
}))]
|
|
68
|
-
})
|
|
85
|
+
}), clearButton]
|
|
69
86
|
});
|
|
70
|
-
}
|
|
87
|
+
}
|
|
88
|
+
process.env.NODE_ENV !== "production" ? GridFilterInputBoolean.propTypes = {
|
|
89
|
+
// ----------------------------- Warning --------------------------------
|
|
90
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
91
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
92
|
+
// ----------------------------------------------------------------------
|
|
93
|
+
apiRef: PropTypes.shape({
|
|
94
|
+
current: PropTypes.object.isRequired
|
|
95
|
+
}).isRequired,
|
|
96
|
+
applyValue: PropTypes.func.isRequired,
|
|
97
|
+
clearButton: PropTypes.node,
|
|
98
|
+
focusElementRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
99
|
+
current: PropTypes.any.isRequired
|
|
100
|
+
})]),
|
|
101
|
+
headerFilterMenu: PropTypes.node,
|
|
102
|
+
/**
|
|
103
|
+
* It is `true` if the filter either has a value or an operator with no value
|
|
104
|
+
* required is selected (e.g. `isEmpty`)
|
|
105
|
+
*/
|
|
106
|
+
isFilterActive: PropTypes.bool,
|
|
107
|
+
item: PropTypes.shape({
|
|
108
|
+
field: PropTypes.string.isRequired,
|
|
109
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
110
|
+
operator: PropTypes.string.isRequired,
|
|
111
|
+
value: PropTypes.any
|
|
112
|
+
}).isRequired
|
|
113
|
+
} : void 0;
|
|
114
|
+
export { GridFilterInputBoolean };
|
|
@@ -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
|
export type GridFilterInputDateProps = GridFilterInputValueProps & TextFieldProps & {
|
|
5
5
|
type?: 'date' | 'datetime-local';
|
|
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
|
};
|
|
7
14
|
export declare const SUBMIT_FILTER_DATE_STROKE_TIME = 500;
|
|
8
15
|
declare function GridFilterInputDate(props: GridFilterInputDateProps): JSX.Element;
|
|
@@ -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';
|
|
@@ -15,7 +15,12 @@ function GridFilterInputDate(props) {
|
|
|
15
15
|
type,
|
|
16
16
|
apiRef,
|
|
17
17
|
focusElementRef,
|
|
18
|
-
InputProps
|
|
18
|
+
InputProps,
|
|
19
|
+
headerFilterMenu,
|
|
20
|
+
isFilterActive,
|
|
21
|
+
clearButton,
|
|
22
|
+
tabIndex,
|
|
23
|
+
disabled
|
|
19
24
|
} = props,
|
|
20
25
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
21
26
|
const filterTimeout = React.useRef();
|
|
@@ -46,6 +51,7 @@ function GridFilterInputDate(props) {
|
|
|
46
51
|
setFilterValueState(String(itemValue));
|
|
47
52
|
}, [item.value]);
|
|
48
53
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
|
|
54
|
+
fullWidth: true,
|
|
49
55
|
id: id,
|
|
50
56
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
51
57
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
@@ -57,11 +63,19 @@ function GridFilterInputDate(props) {
|
|
|
57
63
|
shrink: true
|
|
58
64
|
},
|
|
59
65
|
inputRef: focusElementRef,
|
|
60
|
-
InputProps: _extends({}, applying ? {
|
|
61
|
-
endAdornment: /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
|
|
62
|
-
|
|
66
|
+
InputProps: _extends({}, applying || clearButton ? {
|
|
67
|
+
endAdornment: applying ? /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
|
|
68
|
+
fontSize: "small",
|
|
69
|
+
color: "action"
|
|
70
|
+
}) : clearButton
|
|
71
|
+
} : {}, headerFilterMenu && isFilterActive ? {
|
|
72
|
+
startAdornment: headerFilterMenu
|
|
73
|
+
} : {}, {
|
|
74
|
+
disabled
|
|
75
|
+
}, InputProps, {
|
|
63
76
|
inputProps: _extends({
|
|
64
|
-
max: type === 'datetime-local' ? '9999-12-31T23:59' : '9999-12-31'
|
|
77
|
+
max: type === 'datetime-local' ? '9999-12-31T23:59' : '9999-12-31',
|
|
78
|
+
tabIndex
|
|
65
79
|
}, InputProps == null ? void 0 : InputProps.inputProps)
|
|
66
80
|
})
|
|
67
81
|
}, other, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseTextField));
|
|
@@ -75,7 +89,14 @@ process.env.NODE_ENV !== "production" ? GridFilterInputDate.propTypes = {
|
|
|
75
89
|
current: PropTypes.object.isRequired
|
|
76
90
|
}).isRequired,
|
|
77
91
|
applyValue: PropTypes.func.isRequired,
|
|
92
|
+
clearButton: PropTypes.node,
|
|
78
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,
|
|
79
100
|
item: PropTypes.shape({
|
|
80
101
|
field: PropTypes.string.isRequired,
|
|
81
102
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -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 };
|