@mui/x-data-grid 9.8.0 → 9.10.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.
Files changed (266) hide show
  1. package/CHANGELOG.md +230 -0
  2. package/DataGrid/DataGrid.js +7 -0
  3. package/DataGrid/DataGrid.mjs +7 -0
  4. package/colDef/gridNumericOperators.d.mts +1 -1
  5. package/colDef/gridNumericOperators.d.ts +1 -1
  6. package/components/GridColumnSortButton.d.mts +1 -1
  7. package/components/GridColumnSortButton.d.ts +1 -1
  8. package/components/GridColumnUnsortedIcon.d.mts +2 -1
  9. package/components/GridColumnUnsortedIcon.d.ts +2 -1
  10. package/components/GridHeader.d.mts +2 -1
  11. package/components/GridHeader.d.ts +2 -1
  12. package/components/GridHeaders.d.mts +1 -1
  13. package/components/GridHeaders.d.ts +1 -1
  14. package/components/GridPagination.d.mts +2 -1
  15. package/components/GridPagination.d.ts +2 -1
  16. package/components/GridRowDragAndDropOverlay.d.mts +1 -1
  17. package/components/GridRowDragAndDropOverlay.d.ts +1 -1
  18. package/components/GridScrollArea.d.mts +2 -1
  19. package/components/GridScrollArea.d.ts +2 -1
  20. package/components/GridScrollShadows.d.mts +2 -1
  21. package/components/GridScrollShadows.d.ts +2 -1
  22. package/components/GridScrollbarFillerCell.d.mts +1 -1
  23. package/components/GridScrollbarFillerCell.d.ts +1 -1
  24. package/components/GridSkeletonLoadingOverlay.d.mts +1 -1
  25. package/components/GridSkeletonLoadingOverlay.d.ts +1 -1
  26. package/components/base/GridFooterPlaceholder.d.mts +1 -1
  27. package/components/base/GridFooterPlaceholder.d.ts +1 -1
  28. package/components/base/GridFooterPlaceholder.js +1 -1
  29. package/components/base/GridFooterPlaceholder.mjs +1 -1
  30. package/components/base/GridOverlays.d.mts +1 -1
  31. package/components/base/GridOverlays.d.ts +1 -1
  32. package/components/cell/GridActionsCell.d.mts +2 -2
  33. package/components/cell/GridActionsCell.d.ts +2 -2
  34. package/components/cell/GridActionsCellItem.d.mts +10 -10
  35. package/components/cell/GridActionsCellItem.d.ts +10 -10
  36. package/components/cell/GridActionsCellItem.js +1 -58
  37. package/components/cell/GridActionsCellItem.mjs +1 -58
  38. package/components/cell/GridBooleanCell.d.mts +1 -4
  39. package/components/cell/GridBooleanCell.d.ts +1 -4
  40. package/components/cell/GridEditBooleanCell.d.mts +2 -2
  41. package/components/cell/GridEditBooleanCell.d.ts +2 -2
  42. package/components/cell/GridEditDateCell.d.mts +2 -2
  43. package/components/cell/GridEditDateCell.d.ts +2 -2
  44. package/components/cell/GridEditInputCell.d.mts +1 -1
  45. package/components/cell/GridEditInputCell.d.ts +1 -1
  46. package/components/cell/GridEditLongTextCell.d.mts +2 -2
  47. package/components/cell/GridEditLongTextCell.d.ts +2 -2
  48. package/components/cell/GridEditSingleSelectCell.d.mts +3 -2
  49. package/components/cell/GridEditSingleSelectCell.d.ts +3 -2
  50. package/components/cell/GridFooterCell.d.mts +1 -1
  51. package/components/cell/GridFooterCell.d.ts +1 -1
  52. package/components/cell/GridLongTextCell.d.mts +2 -2
  53. package/components/cell/GridLongTextCell.d.ts +2 -2
  54. package/components/cell/GridSkeletonCell.d.mts +1 -4
  55. package/components/cell/GridSkeletonCell.d.ts +1 -4
  56. package/components/columnHeaders/ColumnHeaderMenuIcon.d.mts +1 -1
  57. package/components/columnHeaders/ColumnHeaderMenuIcon.d.ts +1 -1
  58. package/components/columnHeaders/GridColumnGroupHeader.d.mts +1 -1
  59. package/components/columnHeaders/GridColumnGroupHeader.d.ts +1 -1
  60. package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.mts +1 -1
  61. package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.ts +1 -1
  62. package/components/columnHeaders/GridColumnHeaderItem.d.mts +1 -4
  63. package/components/columnHeaders/GridColumnHeaderItem.d.ts +1 -4
  64. package/components/columnHeaders/GridColumnHeaderSeparator.d.mts +1 -4
  65. package/components/columnHeaders/GridColumnHeaderSeparator.d.ts +1 -4
  66. package/components/columnHeaders/GridColumnHeaderSortIcon.d.mts +1 -4
  67. package/components/columnHeaders/GridColumnHeaderSortIcon.d.ts +1 -4
  68. package/components/columnHeaders/GridColumnHeaderTitle.d.mts +1 -1
  69. package/components/columnHeaders/GridColumnHeaderTitle.d.ts +1 -1
  70. package/components/columnsManagement/GridColumnsManagement.d.mts +2 -1
  71. package/components/columnsManagement/GridColumnsManagement.d.ts +2 -1
  72. package/components/menu/GridMenu.d.mts +1 -1
  73. package/components/menu/GridMenu.d.ts +1 -1
  74. package/components/menu/columnMenu/GridColumnHeaderMenu.d.mts +1 -1
  75. package/components/menu/columnMenu/GridColumnHeaderMenu.d.ts +1 -1
  76. package/components/menu/columnMenu/menuItems/GridColumnMenuColumnsItem.d.mts +2 -1
  77. package/components/menu/columnMenu/menuItems/GridColumnMenuColumnsItem.d.ts +2 -1
  78. package/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.d.mts +2 -1
  79. package/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.d.ts +2 -1
  80. package/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.d.mts +2 -1
  81. package/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.d.ts +2 -1
  82. package/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.d.mts +2 -1
  83. package/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.d.ts +2 -1
  84. package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.d.mts +2 -1
  85. package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.d.ts +2 -1
  86. package/components/panel/GridColumnsPanel.d.mts +1 -1
  87. package/components/panel/GridColumnsPanel.d.ts +1 -1
  88. package/components/panel/GridPanelContent.d.mts +1 -1
  89. package/components/panel/GridPanelContent.d.ts +1 -1
  90. package/components/panel/GridPanelContext.d.mts +1 -1
  91. package/components/panel/GridPanelContext.d.ts +1 -1
  92. package/components/panel/GridPanelFooter.d.mts +1 -1
  93. package/components/panel/GridPanelFooter.d.ts +1 -1
  94. package/components/panel/GridPanelHeader.d.mts +1 -1
  95. package/components/panel/GridPanelHeader.d.ts +1 -1
  96. package/components/panel/GridPreferencesPanel.d.mts +1 -1
  97. package/components/panel/GridPreferencesPanel.d.ts +1 -1
  98. package/components/panel/filterPanel/GridFilterForm.d.mts +1 -98
  99. package/components/panel/filterPanel/GridFilterForm.d.ts +1 -98
  100. package/components/panel/filterPanel/GridFilterForm.js +9 -355
  101. package/components/panel/filterPanel/GridFilterForm.mjs +8 -354
  102. package/components/panel/filterPanel/GridFilterFormBase.d.mts +119 -0
  103. package/components/panel/filterPanel/GridFilterFormBase.d.ts +119 -0
  104. package/components/panel/filterPanel/GridFilterFormBase.js +497 -0
  105. package/components/panel/filterPanel/GridFilterFormBase.mjs +491 -0
  106. package/components/panel/filterPanel/GridFilterInputBoolean.d.mts +2 -1
  107. package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +2 -1
  108. package/components/panel/filterPanel/GridFilterInputBoolean.js +6 -1
  109. package/components/panel/filterPanel/GridFilterInputBoolean.mjs +6 -1
  110. package/components/panel/filterPanel/GridFilterInputDate.d.mts +2 -1
  111. package/components/panel/filterPanel/GridFilterInputDate.d.ts +2 -1
  112. package/components/panel/filterPanel/GridFilterInputDate.js +21 -9
  113. package/components/panel/filterPanel/GridFilterInputDate.mjs +21 -9
  114. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.mts +2 -1
  115. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -1
  116. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +6 -1
  117. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.mjs +6 -1
  118. package/components/panel/filterPanel/GridFilterInputMultipleValue.d.mts +2 -1
  119. package/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +2 -1
  120. package/components/panel/filterPanel/GridFilterInputMultipleValue.js +6 -1
  121. package/components/panel/filterPanel/GridFilterInputMultipleValue.mjs +6 -1
  122. package/components/panel/filterPanel/GridFilterInputSingleSelect.d.mts +2 -1
  123. package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +2 -1
  124. package/components/panel/filterPanel/GridFilterInputSingleSelect.js +6 -1
  125. package/components/panel/filterPanel/GridFilterInputSingleSelect.mjs +6 -1
  126. package/components/panel/filterPanel/GridFilterInputValue.d.mts +2 -1
  127. package/components/panel/filterPanel/GridFilterInputValue.d.ts +2 -1
  128. package/components/panel/filterPanel/GridFilterInputValue.js +19 -8
  129. package/components/panel/filterPanel/GridFilterInputValue.mjs +19 -8
  130. package/components/panel/filterPanel/GridFilterPanel.d.mts +3 -40
  131. package/components/panel/filterPanel/GridFilterPanel.d.ts +3 -40
  132. package/components/panel/filterPanel/GridFilterPanel.js +19 -174
  133. package/components/panel/filterPanel/GridFilterPanel.mjs +14 -173
  134. package/components/panel/filterPanel/GridFilterPanelBase.d.mts +79 -0
  135. package/components/panel/filterPanel/GridFilterPanelBase.d.ts +79 -0
  136. package/components/panel/filterPanel/GridFilterPanelBase.js +304 -0
  137. package/components/panel/filterPanel/GridFilterPanelBase.mjs +297 -0
  138. package/components/panel/filterPanel/index.d.mts +3 -1
  139. package/components/panel/filterPanel/index.d.ts +3 -1
  140. package/components/panel/filterPanel/index.js +9 -1
  141. package/components/panel/filterPanel/index.mjs +3 -0
  142. package/components/quickFilter/QuickFilter.d.mts +1 -1
  143. package/components/quickFilter/QuickFilter.d.ts +1 -1
  144. package/components/toolbar/GridToolbarExport.d.mts +2 -2
  145. package/components/toolbar/GridToolbarExport.d.ts +2 -2
  146. package/components/toolbar/GridToolbarQuickFilter.d.mts +1 -1
  147. package/components/toolbar/GridToolbarQuickFilter.d.ts +1 -1
  148. package/components/toolbarV8/GridToolbar.d.mts +3 -3
  149. package/components/toolbarV8/GridToolbar.d.ts +3 -3
  150. package/components/toolbarV8/utils.d.mts +1 -1
  151. package/components/toolbarV8/utils.d.ts +1 -1
  152. package/components/virtualization/GridBottomContainer.d.mts +1 -1
  153. package/components/virtualization/GridBottomContainer.d.ts +1 -1
  154. package/components/virtualization/GridTopContainer.d.mts +1 -1
  155. package/components/virtualization/GridTopContainer.d.ts +1 -1
  156. package/components/virtualization/GridVirtualScroller.d.mts +1 -1
  157. package/components/virtualization/GridVirtualScroller.d.ts +1 -1
  158. package/components/virtualization/GridVirtualScrollerFiller.d.mts +2 -1
  159. package/components/virtualization/GridVirtualScrollerFiller.d.ts +2 -1
  160. package/constants/cssVariables.d.mts +120 -120
  161. package/constants/cssVariables.d.ts +120 -120
  162. package/constants/dataGridPropsDefaultValues.js +1 -0
  163. package/constants/dataGridPropsDefaultValues.mjs +1 -0
  164. package/context/GridContextProvider.d.mts +1 -1
  165. package/context/GridContextProvider.d.ts +1 -1
  166. package/hooks/core/useGridLocaleText.d.mts +1 -1
  167. package/hooks/core/useGridLocaleText.d.ts +1 -1
  168. package/hooks/core/useGridLoggerFactory.d.mts +1 -1
  169. package/hooks/core/useGridLoggerFactory.d.ts +1 -1
  170. package/hooks/features/clipboard/useGridClipboard.d.mts +1 -1
  171. package/hooks/features/clipboard/useGridClipboard.d.ts +1 -1
  172. package/hooks/features/columnGrouping/useGridColumnGrouping.d.mts +1 -1
  173. package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +1 -1
  174. package/hooks/features/columnHeaders/useGridColumnHeaders.d.mts +4 -4
  175. package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +4 -4
  176. package/hooks/features/columnResize/useGridColumnResize.d.mts +1 -1
  177. package/hooks/features/columnResize/useGridColumnResize.d.ts +1 -1
  178. package/hooks/features/columns/gridColumnsUtils.d.mts +1 -1
  179. package/hooks/features/columns/gridColumnsUtils.d.ts +1 -1
  180. package/hooks/features/dataSource/useGridDataSourceBase.d.mts +2 -2
  181. package/hooks/features/dataSource/useGridDataSourceBase.d.ts +2 -2
  182. package/hooks/features/dataSource/useGridDataSourceBase.js +39 -10
  183. package/hooks/features/dataSource/useGridDataSourceBase.mjs +39 -10
  184. package/hooks/features/density/useGridDensity.d.mts +1 -1
  185. package/hooks/features/density/useGridDensity.d.ts +1 -1
  186. package/hooks/features/editing/useGridCellEditing.d.mts +1 -1
  187. package/hooks/features/editing/useGridCellEditing.d.ts +1 -1
  188. package/hooks/features/editing/useGridEditing.d.mts +1 -1
  189. package/hooks/features/editing/useGridEditing.d.ts +1 -1
  190. package/hooks/features/editing/useGridRowEditing.d.mts +1 -1
  191. package/hooks/features/editing/useGridRowEditing.d.ts +1 -1
  192. package/hooks/features/editing/utils.d.mts +1 -1
  193. package/hooks/features/editing/utils.d.ts +1 -1
  194. package/hooks/features/export/useGridCsvExport.d.mts +1 -1
  195. package/hooks/features/export/useGridCsvExport.d.ts +1 -1
  196. package/hooks/features/export/useGridPrintExport.d.mts +1 -1
  197. package/hooks/features/export/useGridPrintExport.d.ts +1 -1
  198. package/hooks/features/filter/gridFilterUtils.d.mts +13 -1
  199. package/hooks/features/filter/gridFilterUtils.d.ts +13 -1
  200. package/hooks/features/filter/gridFilterUtils.js +56 -1
  201. package/hooks/features/filter/gridFilterUtils.mjs +52 -0
  202. package/hooks/features/filter/useGridFilter.d.mts +1 -1
  203. package/hooks/features/filter/useGridFilter.d.ts +1 -1
  204. package/hooks/features/filter/useGridFilter.js +4 -35
  205. package/hooks/features/filter/useGridFilter.mjs +5 -36
  206. package/hooks/features/focus/useGridFocus.d.mts +1 -1
  207. package/hooks/features/focus/useGridFocus.d.ts +1 -1
  208. package/hooks/features/headerFiltering/useGridHeaderFiltering.d.mts +1 -1
  209. package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +1 -1
  210. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.mts +1 -1
  211. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
  212. package/hooks/features/overlays/useGridOverlays.d.mts +1 -1
  213. package/hooks/features/overlays/useGridOverlays.d.ts +1 -1
  214. package/hooks/features/pagination/gridPaginationUtils.d.mts +1 -1
  215. package/hooks/features/pagination/gridPaginationUtils.d.ts +1 -1
  216. package/hooks/features/pagination/useGridPaginationMeta.d.mts +1 -1
  217. package/hooks/features/pagination/useGridPaginationMeta.d.ts +1 -1
  218. package/hooks/features/pagination/useGridPaginationModel.d.mts +2 -2
  219. package/hooks/features/pagination/useGridPaginationModel.d.ts +2 -2
  220. package/hooks/features/pagination/useGridRowCount.d.mts +1 -1
  221. package/hooks/features/pagination/useGridRowCount.d.ts +1 -1
  222. package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.mts +1 -1
  223. package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +1 -1
  224. package/hooks/features/rowSelection/useGridRowSelection.d.mts +1 -1
  225. package/hooks/features/rowSelection/useGridRowSelection.d.ts +1 -1
  226. package/hooks/features/rows/gridRowsUtils.d.mts +4 -4
  227. package/hooks/features/rows/gridRowsUtils.d.ts +4 -4
  228. package/hooks/features/rows/useGridRowSpanning.d.mts +1 -1
  229. package/hooks/features/rows/useGridRowSpanning.d.ts +1 -1
  230. package/hooks/features/rows/useGridRows.d.mts +1 -1
  231. package/hooks/features/rows/useGridRows.d.ts +1 -1
  232. package/hooks/features/rows/useGridRowsMeta.d.mts +1 -1
  233. package/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
  234. package/hooks/features/scroll/useGridScroll.d.mts +1 -1
  235. package/hooks/features/scroll/useGridScroll.d.ts +1 -1
  236. package/hooks/features/sorting/useGridSorting.d.mts +1 -1
  237. package/hooks/features/sorting/useGridSorting.d.ts +1 -1
  238. package/hooks/features/virtualization/gridFocusedVirtualCellSelector.d.mts +2 -2
  239. package/hooks/features/virtualization/gridFocusedVirtualCellSelector.d.ts +2 -2
  240. package/hooks/utils/useGridEvent.d.mts +1 -1
  241. package/hooks/utils/useGridEvent.d.ts +1 -1
  242. package/hooks/utils/useGridVisibleRows.d.mts +2 -2
  243. package/hooks/utils/useGridVisibleRows.d.ts +2 -2
  244. package/index.js +1 -1
  245. package/index.mjs +1 -1
  246. package/internals/demo/TailwindDemoContainer.d.mts +1 -1
  247. package/internals/demo/TailwindDemoContainer.d.ts +1 -1
  248. package/models/api/gridApiCommon.d.mts +1 -1
  249. package/models/api/gridApiCommon.d.ts +1 -1
  250. package/models/gridFilterInputComponent.d.mts +5 -0
  251. package/models/gridFilterInputComponent.d.ts +5 -0
  252. package/models/gridSlotsComponentsProps.d.mts +1 -1
  253. package/models/gridSlotsComponentsProps.d.ts +1 -1
  254. package/models/props/DataGridProps.d.mts +7 -0
  255. package/models/props/DataGridProps.d.ts +7 -0
  256. package/package.json +5 -5
  257. package/utils/cellBorderUtils.d.mts +2 -2
  258. package/utils/cellBorderUtils.d.ts +2 -2
  259. package/utils/css/context.d.mts +3 -3
  260. package/utils/css/context.d.ts +3 -3
  261. package/utils/getPublicApiRef.d.mts +1 -1
  262. package/utils/getPublicApiRef.d.ts +1 -1
  263. package/utils/keyboardUtils.d.mts +1 -1
  264. package/utils/keyboardUtils.d.ts +1 -1
  265. package/utils/rtlFlipSide.d.mts +1 -1
  266. package/utils/rtlFlipSide.d.ts +1 -1
@@ -0,0 +1,491 @@
1
+ 'use client';
2
+
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
+ import _formatErrorMessage from "@mui/x-internals/formatErrorMessage";
6
+ const _excluded = ["item", "hasMultipleFilters", "deleteFilter", "applyFilterChanges", "showMultiFilterOperators", "disableMultiFilterOperator", "applyMultiFilterOperatorChanges", "focusElementRef", "logicOperators", "columnsSort", "filterColumns", "deleteIconProps", "logicOperatorInputProps", "operatorInputProps", "columnInputProps", "valueInputProps", "disableDebounce", "readOnly", "filterModel", "children"],
7
+ _excluded2 = ["InputComponentProps"];
8
+ import * as React from 'react';
9
+ import PropTypes from 'prop-types';
10
+ import clsx from 'clsx';
11
+ import composeClasses from '@mui/utils/composeClasses';
12
+ import useId from '@mui/utils/useId';
13
+ import capitalize from '@mui/utils/capitalize';
14
+ import { styled } from '@mui/material/styles';
15
+ import { forwardRef } from '@mui/x-internals/forwardRef';
16
+ import { vars } from "../../../constants/cssVariables.mjs";
17
+ import { gridFilterableColumnDefinitionsSelector, gridColumnLookupSelector } from "../../../hooks/features/columns/gridColumnsSelector.mjs";
18
+ import { useGridSelector } from "../../../hooks/utils/useGridSelector.mjs";
19
+ import { GridLogicOperator } from "../../../models/gridFilterItem.mjs";
20
+ import { useGridApiContext } from "../../../hooks/utils/useGridApiContext.mjs";
21
+ import { useGridRootProps } from "../../../hooks/utils/useGridRootProps.mjs";
22
+ import { getDataGridUtilityClass } from "../../../constants/gridClasses.mjs";
23
+ import { getValueFromValueOptions, getValueOptions } from "./filterPanelUtils.mjs";
24
+ import { gridPivotActiveSelector, gridPivotInitialColumnsSelector } from "../../../hooks/features/pivoting/index.mjs";
25
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
26
+ import { createElement as _createElement } from "react";
27
+ const useUtilityClasses = ownerState => {
28
+ const {
29
+ classes
30
+ } = ownerState;
31
+ const slots = {
32
+ root: ['filterForm'],
33
+ deleteIcon: ['filterFormDeleteIcon'],
34
+ logicOperatorInput: ['filterFormLogicOperatorInput'],
35
+ columnInput: ['filterFormColumnInput'],
36
+ operatorInput: ['filterFormOperatorInput'],
37
+ valueInput: ['filterFormValueInput']
38
+ };
39
+ return composeClasses(slots, getDataGridUtilityClass, classes);
40
+ };
41
+ const GridFilterFormRoot = styled('div', {
42
+ name: 'MuiDataGrid',
43
+ slot: 'FilterForm'
44
+ })({
45
+ display: 'flex',
46
+ gap: vars.spacing(1.5)
47
+ });
48
+ const FilterFormDeleteIcon = styled('div', {
49
+ name: 'MuiDataGrid',
50
+ slot: 'FilterFormDeleteIcon'
51
+ })({
52
+ flexShrink: 0,
53
+ display: 'flex',
54
+ justifyContent: 'center',
55
+ alignItems: 'center'
56
+ });
57
+ const FilterFormLogicOperatorInput = styled('div', {
58
+ name: 'MuiDataGrid',
59
+ slot: 'FilterFormLogicOperatorInput'
60
+ })({
61
+ minWidth: 75,
62
+ justifyContent: 'end'
63
+ });
64
+ const FilterFormColumnInput = styled('div', {
65
+ name: 'MuiDataGrid',
66
+ slot: 'FilterFormColumnInput'
67
+ })({
68
+ width: 150
69
+ });
70
+ const FilterFormOperatorInput = styled('div', {
71
+ name: 'MuiDataGrid',
72
+ slot: 'FilterFormOperatorInput'
73
+ })({
74
+ width: 150
75
+ });
76
+ const FilterFormValueInput = styled('div', {
77
+ name: 'MuiDataGrid',
78
+ slot: 'FilterFormValueInput'
79
+ })({
80
+ width: 190
81
+ });
82
+ const getLogicOperatorLocaleKey = logicOperator => {
83
+ switch (logicOperator) {
84
+ case GridLogicOperator.And:
85
+ return 'filterPanelOperatorAnd';
86
+ case GridLogicOperator.Or:
87
+ return 'filterPanelOperatorOr';
88
+ default:
89
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X: Invalid `logicOperator` property in the `GridFilterPanel`.' : _formatErrorMessage(71));
90
+ }
91
+ };
92
+ const getColumnLabel = col => col.headerName || col.field;
93
+ const collator = new Intl.Collator();
94
+ const GridFilterFormBase = forwardRef(function GridFilterFormBase(props, ref) {
95
+ const {
96
+ item,
97
+ hasMultipleFilters,
98
+ deleteFilter,
99
+ applyFilterChanges,
100
+ showMultiFilterOperators,
101
+ disableMultiFilterOperator,
102
+ applyMultiFilterOperatorChanges,
103
+ focusElementRef,
104
+ logicOperators = [GridLogicOperator.And, GridLogicOperator.Or],
105
+ columnsSort,
106
+ filterColumns,
107
+ deleteIconProps = {},
108
+ logicOperatorInputProps = {},
109
+ operatorInputProps = {},
110
+ columnInputProps = {},
111
+ valueInputProps = {},
112
+ disableDebounce = false,
113
+ readOnly,
114
+ filterModel
115
+ } = props,
116
+ other = _objectWithoutPropertiesLoose(props, _excluded);
117
+ const apiRef = useGridApiContext();
118
+ const columnLookup = useGridSelector(apiRef, gridColumnLookupSelector);
119
+ const filterableColumns = useGridSelector(apiRef, gridFilterableColumnDefinitionsSelector);
120
+ const columnSelectId = useId();
121
+ const columnSelectLabelId = useId();
122
+ const operatorSelectId = useId();
123
+ const operatorSelectLabelId = useId();
124
+ const rootProps = useGridRootProps();
125
+ const classes = useUtilityClasses(rootProps);
126
+ const valueRef = React.useRef(null);
127
+ const filterSelectorRef = React.useRef(null);
128
+ const multiFilterOperator = filterModel.logicOperator ?? GridLogicOperator.And;
129
+ const hasLogicOperatorColumn = hasMultipleFilters && logicOperators.length > 0;
130
+ const baseSelectProps = rootProps.slotProps?.baseSelect || {};
131
+ const isBaseSelectNative = baseSelectProps.native ?? false;
132
+ const baseSelectOptionProps = rootProps.slotProps?.baseSelectOption || {};
133
+ const {
134
+ InputComponentProps
135
+ } = valueInputProps,
136
+ valueInputPropsOther = _objectWithoutPropertiesLoose(valueInputProps, _excluded2);
137
+ const pivotActive = useGridSelector(apiRef, gridPivotActiveSelector);
138
+ const initialColumns = useGridSelector(apiRef, gridPivotInitialColumnsSelector);
139
+ const {
140
+ filteredColumns,
141
+ selectedField
142
+ } = React.useMemo(() => {
143
+ let itemField = item.field;
144
+
145
+ // Yields a valid value if the current filter belongs to a column that is not filterable
146
+ const selectedNonFilterableColumn = columnLookup[item.field].filterable === false ? columnLookup[item.field] : null;
147
+ if (selectedNonFilterableColumn) {
148
+ return {
149
+ filteredColumns: [selectedNonFilterableColumn],
150
+ selectedField: itemField
151
+ };
152
+ }
153
+ if (pivotActive) {
154
+ return {
155
+ filteredColumns: filterableColumns.filter(column => initialColumns.get(column.field) !== undefined),
156
+ selectedField: itemField
157
+ };
158
+ }
159
+ if (filterColumns === undefined || typeof filterColumns !== 'function') {
160
+ return {
161
+ filteredColumns: filterableColumns,
162
+ selectedField: itemField
163
+ };
164
+ }
165
+ const filteredFields = filterColumns({
166
+ field: item.field,
167
+ columns: filterableColumns,
168
+ currentFilters: filterModel?.items || []
169
+ });
170
+ return {
171
+ filteredColumns: filterableColumns.filter(column => {
172
+ const isFieldIncluded = filteredFields.includes(column.field);
173
+ if (column.field === item.field && !isFieldIncluded) {
174
+ itemField = undefined;
175
+ }
176
+ return isFieldIncluded;
177
+ }),
178
+ selectedField: itemField
179
+ };
180
+ }, [item.field, columnLookup, pivotActive, filterColumns, filterableColumns, filterModel?.items, initialColumns]);
181
+ const sortedFilteredColumns = React.useMemo(() => {
182
+ switch (columnsSort) {
183
+ case 'asc':
184
+ return filteredColumns.sort((a, b) => collator.compare(getColumnLabel(a), getColumnLabel(b)));
185
+ case 'desc':
186
+ return filteredColumns.sort((a, b) => -collator.compare(getColumnLabel(a), getColumnLabel(b)));
187
+ default:
188
+ return filteredColumns;
189
+ }
190
+ }, [filteredColumns, columnsSort]);
191
+ const currentColumn = item.field ? apiRef.current.getColumn(item.field) : null;
192
+ const currentOperator = React.useMemo(() => {
193
+ if (!item.operator || !currentColumn) {
194
+ return null;
195
+ }
196
+ return currentColumn.filterOperators?.find(operator => operator.value === item.operator);
197
+ }, [item, currentColumn]);
198
+ const changeColumn = React.useCallback(event => {
199
+ const field = event.target.value;
200
+ const column = apiRef.current.getColumn(field);
201
+ if (column.field === currentColumn.field) {
202
+ // column did not change
203
+ return;
204
+ }
205
+
206
+ // try to keep the same operator when column change
207
+ const newOperator = column.filterOperators.find(operator => operator.value === item.operator) || column.filterOperators[0];
208
+
209
+ // Erase filter value if the input component or filtered column type is modified
210
+ const eraseFilterValue = !newOperator.InputComponent || newOperator.InputComponent !== currentOperator?.InputComponent || column.type !== currentColumn.type;
211
+ let filterValue = eraseFilterValue ? undefined : item.value;
212
+
213
+ // Check filter value against the new valueOptions
214
+ if (column.type === 'singleSelect' && filterValue !== undefined) {
215
+ const colDef = column;
216
+ const valueOptions = getValueOptions(colDef);
217
+ if (Array.isArray(filterValue)) {
218
+ filterValue = filterValue.filter(val => {
219
+ return (
220
+ // Only keep values that are in the new value options
221
+ getValueFromValueOptions(val, valueOptions, colDef?.getOptionValue) !== undefined
222
+ );
223
+ });
224
+ } else if (getValueFromValueOptions(item.value, valueOptions, colDef?.getOptionValue) === undefined) {
225
+ // Reset the filter value if it is not in the new value options
226
+ filterValue = undefined;
227
+ }
228
+ }
229
+ applyFilterChanges(_extends({}, item, {
230
+ field,
231
+ operator: newOperator.value,
232
+ value: filterValue
233
+ }));
234
+ }, [apiRef, applyFilterChanges, item, currentColumn, currentOperator]);
235
+ const changeOperator = React.useCallback(event => {
236
+ const operator = event.target.value;
237
+ const newOperator = currentColumn?.filterOperators.find(op => op.value === operator);
238
+ const eraseItemValue = !newOperator?.InputComponent || newOperator?.InputComponent !== currentOperator?.InputComponent;
239
+ applyFilterChanges(_extends({}, item, {
240
+ operator,
241
+ value: eraseItemValue ? undefined : item.value
242
+ }));
243
+ }, [applyFilterChanges, item, currentColumn, currentOperator]);
244
+ const changeLogicOperator = React.useCallback(event => {
245
+ const logicOperator = event.target.value === GridLogicOperator.And.toString() ? GridLogicOperator.And : GridLogicOperator.Or;
246
+ applyMultiFilterOperatorChanges(logicOperator);
247
+ }, [applyMultiFilterOperatorChanges]);
248
+ const handleDeleteFilter = () => {
249
+ deleteFilter(item);
250
+ };
251
+ React.useImperativeHandle(focusElementRef, () => ({
252
+ focus: () => {
253
+ if (currentOperator?.InputComponent) {
254
+ valueRef?.current?.focus();
255
+ } else {
256
+ filterSelectorRef.current.focus();
257
+ }
258
+ }
259
+ }), [currentOperator]);
260
+ return /*#__PURE__*/_jsxs(GridFilterFormRoot, _extends({
261
+ className: classes.root,
262
+ "data-id": item.id,
263
+ ownerState: rootProps
264
+ }, other, {
265
+ ref: ref,
266
+ children: [/*#__PURE__*/_jsx(FilterFormDeleteIcon, _extends({}, deleteIconProps, {
267
+ className: clsx(classes.deleteIcon, deleteIconProps.className),
268
+ ownerState: rootProps,
269
+ children: /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
270
+ "aria-label": apiRef.current.getLocaleText('filterPanelDeleteIconLabel'),
271
+ title: apiRef.current.getLocaleText('filterPanelDeleteIconLabel'),
272
+ onClick: handleDeleteFilter,
273
+ size: "small",
274
+ disabled: readOnly
275
+ }, rootProps.slotProps?.baseIconButton, {
276
+ children: /*#__PURE__*/_jsx(rootProps.slots.filterPanelDeleteIcon, {
277
+ fontSize: "small"
278
+ })
279
+ }))
280
+ })), /*#__PURE__*/_jsx(FilterFormLogicOperatorInput, _extends({
281
+ as: rootProps.slots.baseSelect,
282
+ sx: [hasLogicOperatorColumn ? {
283
+ display: 'flex'
284
+ } : {
285
+ display: 'none'
286
+ }, showMultiFilterOperators ? {
287
+ visibility: 'visible'
288
+ } : {
289
+ visibility: 'hidden'
290
+ }, logicOperatorInputProps.sx],
291
+ className: clsx(classes.logicOperatorInput, logicOperatorInputProps.className),
292
+ ownerState: rootProps
293
+ }, logicOperatorInputProps, {
294
+ size: "small",
295
+ slotProps: {
296
+ htmlInput: {
297
+ 'aria-label': apiRef.current.getLocaleText('filterPanelLogicOperator')
298
+ }
299
+ },
300
+ value: multiFilterOperator ?? '',
301
+ onChange: changeLogicOperator,
302
+ disabled: !!disableMultiFilterOperator || logicOperators.length === 1,
303
+ native: isBaseSelectNative
304
+ }, rootProps.slotProps?.baseSelect, {
305
+ children: logicOperators.map(logicOperator => /*#__PURE__*/_createElement(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
306
+ native: isBaseSelectNative,
307
+ key: logicOperator.toString(),
308
+ value: logicOperator.toString()
309
+ }), apiRef.current.getLocaleText(getLogicOperatorLocaleKey(logicOperator))))
310
+ })), /*#__PURE__*/_jsx(FilterFormColumnInput, _extends({
311
+ as: rootProps.slots.baseSelect
312
+ }, columnInputProps, {
313
+ className: clsx(classes.columnInput, columnInputProps.className),
314
+ ownerState: rootProps,
315
+ size: "small",
316
+ labelId: columnSelectLabelId,
317
+ id: columnSelectId,
318
+ label: apiRef.current.getLocaleText('filterPanelColumn'),
319
+ value: selectedField ?? '',
320
+ onChange: changeColumn,
321
+ native: isBaseSelectNative,
322
+ disabled: readOnly
323
+ }, rootProps.slotProps?.baseSelect, {
324
+ children: sortedFilteredColumns.map(col => /*#__PURE__*/_createElement(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
325
+ native: isBaseSelectNative,
326
+ key: col.field,
327
+ value: col.field
328
+ }), getColumnLabel(col)))
329
+ })), /*#__PURE__*/_jsx(FilterFormOperatorInput, _extends({
330
+ as: rootProps.slots.baseSelect,
331
+ size: "small"
332
+ }, operatorInputProps, {
333
+ className: clsx(classes.operatorInput, operatorInputProps.className),
334
+ ownerState: rootProps,
335
+ labelId: operatorSelectLabelId,
336
+ label: apiRef.current.getLocaleText('filterPanelOperator'),
337
+ id: operatorSelectId,
338
+ value: item.operator,
339
+ onChange: changeOperator,
340
+ native: isBaseSelectNative,
341
+ inputRef: filterSelectorRef,
342
+ disabled: readOnly
343
+ }, rootProps.slotProps?.baseSelect, {
344
+ children: currentColumn?.filterOperators?.map(operator => /*#__PURE__*/_createElement(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
345
+ native: isBaseSelectNative,
346
+ key: operator.value,
347
+ value: operator.value
348
+ }), operator.label || apiRef.current.getLocaleText(`filterOperator${capitalize(operator.value)}`)))
349
+ })), /*#__PURE__*/_jsx(FilterFormValueInput, _extends({}, valueInputPropsOther, {
350
+ className: clsx(classes.valueInput, valueInputPropsOther.className),
351
+ ownerState: rootProps,
352
+ children: currentOperator?.InputComponent ? /*#__PURE__*/_jsx(currentOperator.InputComponent, _extends({
353
+ apiRef: apiRef,
354
+ item: item,
355
+ applyValue: applyFilterChanges,
356
+ focusElementRef: valueRef,
357
+ disabled: readOnly,
358
+ disableDebounce: disableDebounce,
359
+ slotProps: {
360
+ root: {
361
+ size: 'small'
362
+ }
363
+ }
364
+ }, currentOperator.InputComponentProps, InputComponentProps), item.field) : null
365
+ }))]
366
+ }));
367
+ });
368
+ if (process.env.NODE_ENV !== "production") GridFilterFormBase.displayName = "GridFilterFormBase";
369
+ process.env.NODE_ENV !== "production" ? GridFilterFormBase.propTypes /* remove-proptypes */ = {
370
+ // ----------------------------- Warning --------------------------------
371
+ // | These PropTypes are generated from the TypeScript type definitions |
372
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
373
+ // ----------------------------------------------------------------------
374
+ /**
375
+ * Callback called when the operator, column field or value is changed.
376
+ * @param {GridFilterItem} item The updated [[GridFilterItem]].
377
+ */
378
+ applyFilterChanges: PropTypes.func.isRequired,
379
+ /**
380
+ * Callback called when the logic operator is changed.
381
+ * @param {GridLogicOperator} operator The new logic operator.
382
+ */
383
+ applyMultiFilterOperatorChanges: PropTypes.func.isRequired,
384
+ /**
385
+ * @ignore - do not document.
386
+ */
387
+ children: PropTypes.node,
388
+ /**
389
+ * Props passed to the column input component.
390
+ * @default {}
391
+ */
392
+ columnInputProps: PropTypes.any,
393
+ /**
394
+ * Changes how the options in the columns selector should be ordered.
395
+ * If not specified, the order is derived from the `columns` prop.
396
+ */
397
+ columnsSort: PropTypes.oneOf(['asc', 'desc']),
398
+ /**
399
+ * Callback called when the delete button is clicked.
400
+ * @param {GridFilterItem} item The deleted [[GridFilterItem]].
401
+ */
402
+ deleteFilter: PropTypes.func.isRequired,
403
+ /**
404
+ * Props passed to the delete icon.
405
+ * @default {}
406
+ */
407
+ deleteIconProps: PropTypes.any,
408
+ /**
409
+ * If `true`, disables the logic operator field but still renders it.
410
+ */
411
+ disableMultiFilterOperator: PropTypes.bool,
412
+ /**
413
+ * Allows to filter the columns displayed in the filter form.
414
+ * @param {FilterColumnsArgs} args The columns of the grid and name of field.
415
+ * @returns {GridColDef['field'][]} The filtered fields array.
416
+ */
417
+ filterColumns: PropTypes.func,
418
+ /**
419
+ * The filter model that populates the form.
420
+ * Its `logicOperator` drives the logic operator field and its `items` are used to compute the
421
+ * columns available in the column selector (e.g. via the `filterColumns` callback).
422
+ */
423
+ filterModel: PropTypes.shape({
424
+ items: PropTypes.arrayOf(PropTypes.shape({
425
+ field: PropTypes.string.isRequired,
426
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
427
+ operator: PropTypes.string.isRequired,
428
+ value: PropTypes.any
429
+ })).isRequired,
430
+ logicOperator: PropTypes.oneOf(['and', 'or']),
431
+ quickFilterExcludeHiddenColumns: PropTypes.bool,
432
+ quickFilterLogicOperator: PropTypes.oneOf(['and', 'or']),
433
+ quickFilterValues: PropTypes.array
434
+ }).isRequired,
435
+ /**
436
+ * A ref allowing to set imperative focus.
437
+ * It can be passed to the el
438
+ */
439
+ focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
440
+ /**
441
+ * If `true`, the logic operator field is rendered.
442
+ * The field will be invisible if `showMultiFilterOperators` is also `true`.
443
+ */
444
+ hasMultipleFilters: PropTypes.bool.isRequired,
445
+ /**
446
+ * The [[GridFilterItem]] representing this form.
447
+ */
448
+ item: PropTypes.shape({
449
+ field: PropTypes.string.isRequired,
450
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
451
+ operator: PropTypes.string.isRequired,
452
+ value: PropTypes.any
453
+ }).isRequired,
454
+ /**
455
+ * Props passed to the logic operator input component.
456
+ * @default {}
457
+ */
458
+ logicOperatorInputProps: PropTypes.any,
459
+ /**
460
+ * Sets the available logic operators.
461
+ * @default [GridLogicOperator.And, GridLogicOperator.Or]
462
+ */
463
+ logicOperators: PropTypes.arrayOf(PropTypes.oneOf(['and', 'or']).isRequired),
464
+ /**
465
+ * Props passed to the operator input component.
466
+ * @default {}
467
+ */
468
+ operatorInputProps: PropTypes.any,
469
+ /**
470
+ * `true` if the filter is disabled/read only.
471
+ * i.e. `colDef.fiterable = false` but passed in `filterModel`
472
+ * @default false
473
+ */
474
+ readOnly: PropTypes.bool,
475
+ /**
476
+ * If `true`, the logic operator field is visible.
477
+ */
478
+ showMultiFilterOperators: PropTypes.bool,
479
+ /**
480
+ * Props passed to the value input component.
481
+ * @default {}
482
+ */
483
+ valueInputProps: PropTypes.any
484
+ } : void 0;
485
+
486
+ /**
487
+ * The lower-level filter form rendered by `GridFilterForm` and `GridFilterPanelBase`.
488
+ * It is controlled through the `filterModel` prop instead of reading the grid filter state.
489
+ * This is an internal component that is not part of the public API.
490
+ */
491
+ export { GridFilterFormBase };
@@ -1,7 +1,8 @@
1
+ import * as React from 'react';
1
2
  import type { TextFieldProps } from "../../../models/gridBaseSlots.mjs";
2
3
  import type { GridFilterInputValueProps } from "../../../models/gridFilterInputComponent.mjs";
3
4
  export type GridFilterInputBooleanProps = GridFilterInputValueProps<TextFieldProps>;
4
- declare function GridFilterInputBoolean(props: GridFilterInputBooleanProps): import("react/jsx-runtime").JSX.Element;
5
+ declare function GridFilterInputBoolean(props: GridFilterInputBooleanProps): React.JSX.Element;
5
6
  declare namespace GridFilterInputBoolean {
6
7
  var propTypes: any;
7
8
  }
@@ -1,7 +1,8 @@
1
+ import * as React from 'react';
1
2
  import type { TextFieldProps } from "../../../models/gridBaseSlots.js";
2
3
  import type { GridFilterInputValueProps } from "../../../models/gridFilterInputComponent.js";
3
4
  export type GridFilterInputBooleanProps = GridFilterInputValueProps<TextFieldProps>;
4
- declare function GridFilterInputBoolean(props: GridFilterInputBooleanProps): import("react/jsx-runtime").JSX.Element;
5
+ declare function GridFilterInputBoolean(props: GridFilterInputBooleanProps): React.JSX.Element;
5
6
  declare namespace GridFilterInputBoolean {
6
7
  var propTypes: any;
7
8
  }
@@ -17,7 +17,7 @@ var _refType = _interopRequireDefault(require("@mui/utils/refType"));
17
17
  var _useId = _interopRequireDefault(require("@mui/utils/useId"));
18
18
  var _useGridRootProps = require("../../../hooks/utils/useGridRootProps");
19
19
  var _jsxRuntime = require("react/jsx-runtime");
20
- const _excluded = ["item", "applyValue", "apiRef", "focusElementRef", "isFilterActive", "headerFilterMenu", "clearButton", "tabIndex", "slotProps"];
20
+ const _excluded = ["item", "applyValue", "apiRef", "focusElementRef", "isFilterActive", "headerFilterMenu", "clearButton", "tabIndex", "slotProps", "disableDebounce"];
21
21
  function GridFilterInputBoolean(props) {
22
22
  const {
23
23
  item,
@@ -102,6 +102,11 @@ process.env.NODE_ENV !== "production" ? GridFilterInputBoolean.propTypes /* remo
102
102
  className: _propTypes.default.string,
103
103
  clearButton: _propTypes.default.node,
104
104
  disabled: _propTypes.default.bool,
105
+ /**
106
+ * If `true`, filter value changes are applied immediately without debouncing.
107
+ * @default false
108
+ */
109
+ disableDebounce: _propTypes.default.bool,
105
110
  focusElementRef: _refType.default,
106
111
  headerFilterMenu: _propTypes.default.node,
107
112
  inputRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
@@ -3,7 +3,7 @@
3
3
  import _formatErrorMessage from "@mui/x-internals/formatErrorMessage";
4
4
  import _extends from "@babel/runtime/helpers/esm/extends";
5
5
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
6
- const _excluded = ["item", "applyValue", "apiRef", "focusElementRef", "isFilterActive", "headerFilterMenu", "clearButton", "tabIndex", "slotProps"];
6
+ const _excluded = ["item", "applyValue", "apiRef", "focusElementRef", "isFilterActive", "headerFilterMenu", "clearButton", "tabIndex", "slotProps", "disableDebounce"];
7
7
  import * as React from 'react';
8
8
  import PropTypes from 'prop-types';
9
9
  import refType from '@mui/utils/refType';
@@ -94,6 +94,11 @@ process.env.NODE_ENV !== "production" ? GridFilterInputBoolean.propTypes /* remo
94
94
  className: PropTypes.string,
95
95
  clearButton: PropTypes.node,
96
96
  disabled: PropTypes.bool,
97
+ /**
98
+ * If `true`, filter value changes are applied immediately without debouncing.
99
+ * @default false
100
+ */
101
+ disableDebounce: PropTypes.bool,
97
102
  focusElementRef: refType,
98
103
  headerFilterMenu: PropTypes.node,
99
104
  inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
@@ -1,9 +1,10 @@
1
+ import * as React from 'react';
1
2
  import type { GridFilterInputValueProps } from "../../../models/gridFilterInputComponent.mjs";
2
3
  import type { TextFieldProps } from "../../../models/gridBaseSlots.mjs";
3
4
  export type GridFilterInputDateProps = GridFilterInputValueProps<TextFieldProps> & {
4
5
  type?: 'date' | 'datetime-local';
5
6
  };
6
- declare function GridFilterInputDate(props: GridFilterInputDateProps): import("react/jsx-runtime").JSX.Element;
7
+ declare function GridFilterInputDate(props: GridFilterInputDateProps): React.JSX.Element;
7
8
  declare namespace GridFilterInputDate {
8
9
  var propTypes: any;
9
10
  }
@@ -1,9 +1,10 @@
1
+ import * as React from 'react';
1
2
  import type { GridFilterInputValueProps } from "../../../models/gridFilterInputComponent.js";
2
3
  import type { TextFieldProps } from "../../../models/gridBaseSlots.js";
3
4
  export type GridFilterInputDateProps = GridFilterInputValueProps<TextFieldProps> & {
4
5
  type?: 'date' | 'datetime-local';
5
6
  };
6
- declare function GridFilterInputDate(props: GridFilterInputDateProps): import("react/jsx-runtime").JSX.Element;
7
+ declare function GridFilterInputDate(props: GridFilterInputDateProps): React.JSX.Element;
7
8
  declare namespace GridFilterInputDate {
8
9
  var propTypes: any;
9
10
  }
@@ -16,7 +16,7 @@ var _useId = _interopRequireDefault(require("@mui/utils/useId"));
16
16
  var _useTimeout = require("../../../hooks/utils/useTimeout");
17
17
  var _useGridRootProps = require("../../../hooks/utils/useGridRootProps");
18
18
  var _jsxRuntime = require("react/jsx-runtime");
19
- const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "slotProps", "isFilterActive", "headerFilterMenu", "clearButton", "tabIndex", "disabled"];
19
+ const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "slotProps", "isFilterActive", "headerFilterMenu", "clearButton", "tabIndex", "disabled", "disableDebounce"];
20
20
  function convertFilterItemValueToInputValue(itemValue, inputType) {
21
21
  if (itemValue == null) {
22
22
  return '';
@@ -48,7 +48,8 @@ function GridFilterInputDate(props) {
48
48
  headerFilterMenu,
49
49
  clearButton,
50
50
  tabIndex,
51
- disabled
51
+ disabled,
52
+ disableDebounce = false
52
53
  } = props,
53
54
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
54
55
  const rootSlotProps = slotProps?.root.slotProps;
@@ -57,19 +58,25 @@ function GridFilterInputDate(props) {
57
58
  const [applying, setIsApplying] = React.useState(false);
58
59
  const id = (0, _useId.default)();
59
60
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
61
+ const debounceMs = disableDebounce ? 0 : rootProps.filterDebounceMs;
60
62
  const onFilterChange = React.useCallback(event => {
61
63
  filterTimeout.clear();
62
64
  const value = event.target.value;
63
65
  setFilterValueState(value);
66
+ const date = new Date(value);
67
+ const newItem = (0, _extends2.default)({}, item, {
68
+ value: Number.isNaN(date.getTime()) ? undefined : date
69
+ });
70
+ if (debounceMs === 0) {
71
+ applyValue(newItem);
72
+ return;
73
+ }
64
74
  setIsApplying(true);
65
- filterTimeout.start(rootProps.filterDebounceMs, () => {
66
- const date = new Date(value);
67
- applyValue((0, _extends2.default)({}, item, {
68
- value: Number.isNaN(date.getTime()) ? undefined : date
69
- }));
75
+ filterTimeout.start(debounceMs, () => {
76
+ applyValue(newItem);
70
77
  setIsApplying(false);
71
78
  });
72
- }, [applyValue, item, rootProps.filterDebounceMs, filterTimeout]);
79
+ }, [applyValue, item, debounceMs, filterTimeout]);
73
80
  React.useEffect(() => {
74
81
  const value = convertFilterItemValueToInputValue(item.value, type);
75
82
  setFilterValueState(value);
@@ -87,7 +94,7 @@ function GridFilterInputDate(props) {
87
94
  inputRef: focusElementRef,
88
95
  slotProps: (0, _extends2.default)({}, rootSlotProps, {
89
96
  input: (0, _extends2.default)({
90
- endAdornment: applying ? /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.loadIcon, {
97
+ endAdornment: applying && debounceMs > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.loadIcon, {
91
98
  fontSize: "small",
92
99
  color: "action"
93
100
  }) : null
@@ -112,6 +119,11 @@ process.env.NODE_ENV !== "production" ? GridFilterInputDate.propTypes /* remove-
112
119
  className: _propTypes.default.string,
113
120
  clearButton: _propTypes.default.node,
114
121
  disabled: _propTypes.default.bool,
122
+ /**
123
+ * If `true`, filter value changes are applied immediately without debouncing.
124
+ * @default false
125
+ */
126
+ disableDebounce: _propTypes.default.bool,
115
127
  focusElementRef: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.func, _propTypes.default.object]),
116
128
  headerFilterMenu: _propTypes.default.node,
117
129
  inputRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({