@mui/x-data-grid 9.8.0 → 9.9.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 (180) hide show
  1. package/CHANGELOG.md +119 -0
  2. package/DataGrid/DataGrid.js +7 -0
  3. package/DataGrid/DataGrid.mjs +7 -0
  4. package/components/GridColumnSortButton.d.mts +1 -1
  5. package/components/GridColumnSortButton.d.ts +1 -1
  6. package/components/GridColumnUnsortedIcon.d.mts +2 -1
  7. package/components/GridColumnUnsortedIcon.d.ts +2 -1
  8. package/components/GridHeader.d.mts +2 -1
  9. package/components/GridHeader.d.ts +2 -1
  10. package/components/GridHeaders.d.mts +1 -1
  11. package/components/GridHeaders.d.ts +1 -1
  12. package/components/GridPagination.d.mts +2 -1
  13. package/components/GridPagination.d.ts +2 -1
  14. package/components/GridRowDragAndDropOverlay.d.mts +1 -1
  15. package/components/GridRowDragAndDropOverlay.d.ts +1 -1
  16. package/components/GridScrollArea.d.mts +2 -1
  17. package/components/GridScrollArea.d.ts +2 -1
  18. package/components/GridScrollShadows.d.mts +2 -1
  19. package/components/GridScrollShadows.d.ts +2 -1
  20. package/components/GridScrollbarFillerCell.d.mts +1 -1
  21. package/components/GridScrollbarFillerCell.d.ts +1 -1
  22. package/components/base/GridFooterPlaceholder.d.mts +1 -1
  23. package/components/base/GridFooterPlaceholder.d.ts +1 -1
  24. package/components/base/GridFooterPlaceholder.js +1 -1
  25. package/components/base/GridFooterPlaceholder.mjs +1 -1
  26. package/components/base/GridOverlays.d.mts +1 -1
  27. package/components/base/GridOverlays.d.ts +1 -1
  28. package/components/cell/GridActionsCell.d.mts +2 -2
  29. package/components/cell/GridActionsCell.d.ts +2 -2
  30. package/components/cell/GridActionsCellItem.js +1 -58
  31. package/components/cell/GridActionsCellItem.mjs +1 -58
  32. package/components/cell/GridBooleanCell.d.mts +1 -1
  33. package/components/cell/GridBooleanCell.d.ts +1 -1
  34. package/components/cell/GridEditBooleanCell.d.mts +2 -2
  35. package/components/cell/GridEditBooleanCell.d.ts +2 -2
  36. package/components/cell/GridEditDateCell.d.mts +2 -2
  37. package/components/cell/GridEditDateCell.d.ts +2 -2
  38. package/components/cell/GridEditInputCell.d.mts +1 -1
  39. package/components/cell/GridEditInputCell.d.ts +1 -1
  40. package/components/cell/GridEditLongTextCell.d.mts +2 -2
  41. package/components/cell/GridEditLongTextCell.d.ts +2 -2
  42. package/components/cell/GridEditSingleSelectCell.d.mts +3 -2
  43. package/components/cell/GridEditSingleSelectCell.d.ts +3 -2
  44. package/components/cell/GridFooterCell.d.mts +1 -1
  45. package/components/cell/GridFooterCell.d.ts +1 -1
  46. package/components/cell/GridLongTextCell.d.mts +2 -2
  47. package/components/cell/GridLongTextCell.d.ts +2 -2
  48. package/components/cell/GridSkeletonCell.d.mts +1 -1
  49. package/components/cell/GridSkeletonCell.d.ts +1 -1
  50. package/components/columnHeaders/ColumnHeaderMenuIcon.d.mts +1 -1
  51. package/components/columnHeaders/ColumnHeaderMenuIcon.d.ts +1 -1
  52. package/components/columnHeaders/GridColumnGroupHeader.d.mts +1 -1
  53. package/components/columnHeaders/GridColumnGroupHeader.d.ts +1 -1
  54. package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.mts +1 -1
  55. package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.ts +1 -1
  56. package/components/columnHeaders/GridColumnHeaderItem.d.mts +1 -1
  57. package/components/columnHeaders/GridColumnHeaderItem.d.ts +1 -1
  58. package/components/columnHeaders/GridColumnHeaderSeparator.d.mts +1 -1
  59. package/components/columnHeaders/GridColumnHeaderSeparator.d.ts +1 -1
  60. package/components/columnHeaders/GridColumnHeaderSortIcon.d.mts +1 -1
  61. package/components/columnHeaders/GridColumnHeaderSortIcon.d.ts +1 -1
  62. package/components/columnHeaders/GridColumnHeaderTitle.d.mts +1 -1
  63. package/components/columnHeaders/GridColumnHeaderTitle.d.ts +1 -1
  64. package/components/columnsManagement/GridColumnsManagement.d.mts +2 -1
  65. package/components/columnsManagement/GridColumnsManagement.d.ts +2 -1
  66. package/components/menu/GridMenu.d.mts +1 -1
  67. package/components/menu/GridMenu.d.ts +1 -1
  68. package/components/menu/columnMenu/GridColumnHeaderMenu.d.mts +1 -1
  69. package/components/menu/columnMenu/GridColumnHeaderMenu.d.ts +1 -1
  70. package/components/menu/columnMenu/menuItems/GridColumnMenuColumnsItem.d.mts +2 -1
  71. package/components/menu/columnMenu/menuItems/GridColumnMenuColumnsItem.d.ts +2 -1
  72. package/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.d.mts +2 -1
  73. package/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.d.ts +2 -1
  74. package/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.d.mts +2 -1
  75. package/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.d.ts +2 -1
  76. package/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.d.mts +2 -1
  77. package/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.d.ts +2 -1
  78. package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.d.mts +2 -1
  79. package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.d.ts +2 -1
  80. package/components/panel/GridColumnsPanel.d.mts +1 -1
  81. package/components/panel/GridColumnsPanel.d.ts +1 -1
  82. package/components/panel/GridPanelContent.d.mts +1 -1
  83. package/components/panel/GridPanelContent.d.ts +1 -1
  84. package/components/panel/GridPanelContext.d.mts +1 -1
  85. package/components/panel/GridPanelContext.d.ts +1 -1
  86. package/components/panel/GridPanelFooter.d.mts +1 -1
  87. package/components/panel/GridPanelFooter.d.ts +1 -1
  88. package/components/panel/GridPanelHeader.d.mts +1 -1
  89. package/components/panel/GridPanelHeader.d.ts +1 -1
  90. package/components/panel/GridPreferencesPanel.d.mts +1 -1
  91. package/components/panel/GridPreferencesPanel.d.ts +1 -1
  92. package/components/panel/filterPanel/GridFilterForm.d.mts +1 -98
  93. package/components/panel/filterPanel/GridFilterForm.d.ts +1 -98
  94. package/components/panel/filterPanel/GridFilterForm.js +9 -355
  95. package/components/panel/filterPanel/GridFilterForm.mjs +8 -354
  96. package/components/panel/filterPanel/GridFilterFormBase.d.mts +119 -0
  97. package/components/panel/filterPanel/GridFilterFormBase.d.ts +119 -0
  98. package/components/panel/filterPanel/GridFilterFormBase.js +497 -0
  99. package/components/panel/filterPanel/GridFilterFormBase.mjs +491 -0
  100. package/components/panel/filterPanel/GridFilterInputBoolean.d.mts +2 -1
  101. package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +2 -1
  102. package/components/panel/filterPanel/GridFilterInputBoolean.js +6 -1
  103. package/components/panel/filterPanel/GridFilterInputBoolean.mjs +6 -1
  104. package/components/panel/filterPanel/GridFilterInputDate.d.mts +2 -1
  105. package/components/panel/filterPanel/GridFilterInputDate.d.ts +2 -1
  106. package/components/panel/filterPanel/GridFilterInputDate.js +21 -9
  107. package/components/panel/filterPanel/GridFilterInputDate.mjs +21 -9
  108. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.mts +2 -1
  109. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -1
  110. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +6 -1
  111. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.mjs +6 -1
  112. package/components/panel/filterPanel/GridFilterInputMultipleValue.d.mts +2 -1
  113. package/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +2 -1
  114. package/components/panel/filterPanel/GridFilterInputMultipleValue.js +6 -1
  115. package/components/panel/filterPanel/GridFilterInputMultipleValue.mjs +6 -1
  116. package/components/panel/filterPanel/GridFilterInputSingleSelect.d.mts +2 -1
  117. package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +2 -1
  118. package/components/panel/filterPanel/GridFilterInputSingleSelect.js +6 -1
  119. package/components/panel/filterPanel/GridFilterInputSingleSelect.mjs +6 -1
  120. package/components/panel/filterPanel/GridFilterInputValue.d.mts +2 -1
  121. package/components/panel/filterPanel/GridFilterInputValue.d.ts +2 -1
  122. package/components/panel/filterPanel/GridFilterInputValue.js +19 -8
  123. package/components/panel/filterPanel/GridFilterInputValue.mjs +19 -8
  124. package/components/panel/filterPanel/GridFilterPanel.d.mts +3 -40
  125. package/components/panel/filterPanel/GridFilterPanel.d.ts +3 -40
  126. package/components/panel/filterPanel/GridFilterPanel.js +19 -174
  127. package/components/panel/filterPanel/GridFilterPanel.mjs +14 -173
  128. package/components/panel/filterPanel/GridFilterPanelBase.d.mts +79 -0
  129. package/components/panel/filterPanel/GridFilterPanelBase.d.ts +79 -0
  130. package/components/panel/filterPanel/GridFilterPanelBase.js +304 -0
  131. package/components/panel/filterPanel/GridFilterPanelBase.mjs +297 -0
  132. package/components/panel/filterPanel/index.d.mts +3 -1
  133. package/components/panel/filterPanel/index.d.ts +3 -1
  134. package/components/panel/filterPanel/index.js +9 -1
  135. package/components/panel/filterPanel/index.mjs +3 -0
  136. package/components/quickFilter/QuickFilter.d.mts +1 -1
  137. package/components/quickFilter/QuickFilter.d.ts +1 -1
  138. package/components/toolbar/GridToolbarExport.d.mts +2 -2
  139. package/components/toolbar/GridToolbarExport.d.ts +2 -2
  140. package/components/toolbar/GridToolbarQuickFilter.d.mts +1 -1
  141. package/components/toolbar/GridToolbarQuickFilter.d.ts +1 -1
  142. package/components/toolbarV8/GridToolbar.d.mts +3 -3
  143. package/components/toolbarV8/GridToolbar.d.ts +3 -3
  144. package/components/virtualization/GridBottomContainer.d.mts +1 -1
  145. package/components/virtualization/GridBottomContainer.d.ts +1 -1
  146. package/components/virtualization/GridTopContainer.d.mts +1 -1
  147. package/components/virtualization/GridTopContainer.d.ts +1 -1
  148. package/components/virtualization/GridVirtualScroller.d.mts +1 -1
  149. package/components/virtualization/GridVirtualScroller.d.ts +1 -1
  150. package/components/virtualization/GridVirtualScrollerFiller.d.mts +2 -1
  151. package/components/virtualization/GridVirtualScrollerFiller.d.ts +2 -1
  152. package/constants/dataGridPropsDefaultValues.js +1 -0
  153. package/constants/dataGridPropsDefaultValues.mjs +1 -0
  154. package/context/GridContextProvider.d.mts +1 -1
  155. package/context/GridContextProvider.d.ts +1 -1
  156. package/hooks/features/columnHeaders/useGridColumnHeaders.d.mts +2 -2
  157. package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +2 -2
  158. package/hooks/features/dataSource/useGridDataSourceBase.d.mts +1 -1
  159. package/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
  160. package/hooks/features/dataSource/useGridDataSourceBase.js +39 -10
  161. package/hooks/features/dataSource/useGridDataSourceBase.mjs +39 -10
  162. package/hooks/features/filter/gridFilterUtils.d.mts +12 -0
  163. package/hooks/features/filter/gridFilterUtils.d.ts +12 -0
  164. package/hooks/features/filter/gridFilterUtils.js +56 -1
  165. package/hooks/features/filter/gridFilterUtils.mjs +52 -0
  166. package/hooks/features/filter/useGridFilter.js +4 -35
  167. package/hooks/features/filter/useGridFilter.mjs +5 -36
  168. package/index.js +1 -1
  169. package/index.mjs +1 -1
  170. package/internals/demo/TailwindDemoContainer.d.mts +1 -1
  171. package/internals/demo/TailwindDemoContainer.d.ts +1 -1
  172. package/models/gridFilterInputComponent.d.mts +5 -0
  173. package/models/gridFilterInputComponent.d.ts +5 -0
  174. package/models/gridSlotsComponentsProps.d.mts +1 -1
  175. package/models/gridSlotsComponentsProps.d.ts +1 -1
  176. package/models/props/DataGridProps.d.mts +7 -0
  177. package/models/props/DataGridProps.d.ts +7 -0
  178. package/package.json +4 -4
  179. package/utils/css/context.d.mts +3 -3
  180. package/utils/css/context.d.ts +3 -3
@@ -57,7 +57,7 @@ export type QuickFilterProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'class
57
57
  *
58
58
  * - [QuickFilter API](https://mui.com/x/api/data-grid/quick-filter/)
59
59
  */
60
- declare function QuickFilter(props: QuickFilterProps): import("react/jsx-runtime").JSX.Element;
60
+ declare function QuickFilter(props: QuickFilterProps): React.JSX.Element;
61
61
  declare namespace QuickFilter {
62
62
  var propTypes: any;
63
63
  }
@@ -57,7 +57,7 @@ export type QuickFilterProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'class
57
57
  *
58
58
  * - [QuickFilter API](https://mui.com/x/api/data-grid/quick-filter/)
59
59
  */
60
- declare function QuickFilter(props: QuickFilterProps): import("react/jsx-runtime").JSX.Element;
60
+ declare function QuickFilter(props: QuickFilterProps): React.JSX.Element;
61
61
  declare namespace QuickFilter {
62
62
  var propTypes: any;
63
63
  }
@@ -27,11 +27,11 @@ export interface GridToolbarExportProps {
27
27
  };
28
28
  [x: `data-${string}`]: string;
29
29
  }
30
- declare function GridCsvExportMenuItem(props: GridCsvExportMenuItemProps): import("react/jsx-runtime").JSX.Element;
30
+ declare function GridCsvExportMenuItem(props: GridCsvExportMenuItemProps): React.JSX.Element;
31
31
  declare namespace GridCsvExportMenuItem {
32
32
  var propTypes: any;
33
33
  }
34
- declare function GridPrintExportMenuItem(props: GridPrintExportMenuItemProps): import("react/jsx-runtime").JSX.Element;
34
+ declare function GridPrintExportMenuItem(props: GridPrintExportMenuItemProps): React.JSX.Element;
35
35
  declare namespace GridPrintExportMenuItem {
36
36
  var propTypes: any;
37
37
  }
@@ -27,11 +27,11 @@ export interface GridToolbarExportProps {
27
27
  };
28
28
  [x: `data-${string}`]: string;
29
29
  }
30
- declare function GridCsvExportMenuItem(props: GridCsvExportMenuItemProps): import("react/jsx-runtime").JSX.Element;
30
+ declare function GridCsvExportMenuItem(props: GridCsvExportMenuItemProps): React.JSX.Element;
31
31
  declare namespace GridCsvExportMenuItem {
32
32
  var propTypes: any;
33
33
  }
34
- declare function GridPrintExportMenuItem(props: GridPrintExportMenuItemProps): import("react/jsx-runtime").JSX.Element;
34
+ declare function GridPrintExportMenuItem(props: GridPrintExportMenuItemProps): React.JSX.Element;
35
35
  declare namespace GridPrintExportMenuItem {
36
36
  var propTypes: any;
37
37
  }
@@ -30,7 +30,7 @@ export type GridToolbarQuickFilterProps = {
30
30
  /**
31
31
  * @deprecated Use the {@link https://mui.com/x/react-data-grid/components/quick-filter/ Quick Filter} component instead. This component will be removed in a future major release.
32
32
  */
33
- declare function GridToolbarQuickFilter(props: GridToolbarQuickFilterProps): import("react/jsx-runtime").JSX.Element;
33
+ declare function GridToolbarQuickFilter(props: GridToolbarQuickFilterProps): import("react").JSX.Element;
34
34
  declare namespace GridToolbarQuickFilter {
35
35
  var propTypes: any;
36
36
  }
@@ -30,7 +30,7 @@ export type GridToolbarQuickFilterProps = {
30
30
  /**
31
31
  * @deprecated Use the {@link https://mui.com/x/react-data-grid/components/quick-filter/ Quick Filter} component instead. This component will be removed in a future major release.
32
32
  */
33
- declare function GridToolbarQuickFilter(props: GridToolbarQuickFilterProps): import("react/jsx-runtime").JSX.Element;
33
+ declare function GridToolbarQuickFilter(props: GridToolbarQuickFilterProps): import("react").JSX.Element;
34
34
  declare namespace GridToolbarQuickFilter {
35
35
  var propTypes: any;
36
36
  }
@@ -5,12 +5,12 @@ interface GridToolbarInternalProps {
5
5
  additionalExportMenuItems?: (onMenuItemClick: () => void) => React.ReactNode;
6
6
  }
7
7
  export type GridToolbarProps = GridSlotProps['toolbar'] & GridToolbarInternalProps;
8
- declare function GridToolbarDivider(props: GridSlotProps['baseDivider']): import("react/jsx-runtime").JSX.Element;
8
+ declare function GridToolbarDivider(props: GridSlotProps['baseDivider']): React.JSX.Element;
9
9
  declare namespace GridToolbarDivider {
10
10
  var propTypes: any;
11
11
  }
12
- declare function GridToolbarLabel(props: React.HTMLAttributes<HTMLSpanElement>): import("react/jsx-runtime").JSX.Element;
13
- declare function GridToolbar(props: GridToolbarProps): import("react/jsx-runtime").JSX.Element;
12
+ declare function GridToolbarLabel(props: React.HTMLAttributes<HTMLSpanElement>): React.JSX.Element;
13
+ declare function GridToolbar(props: GridToolbarProps): React.JSX.Element;
14
14
  declare namespace GridToolbar {
15
15
  var propTypes: any;
16
16
  }
@@ -5,12 +5,12 @@ interface GridToolbarInternalProps {
5
5
  additionalExportMenuItems?: (onMenuItemClick: () => void) => React.ReactNode;
6
6
  }
7
7
  export type GridToolbarProps = GridSlotProps['toolbar'] & GridToolbarInternalProps;
8
- declare function GridToolbarDivider(props: GridSlotProps['baseDivider']): import("react/jsx-runtime").JSX.Element;
8
+ declare function GridToolbarDivider(props: GridSlotProps['baseDivider']): React.JSX.Element;
9
9
  declare namespace GridToolbarDivider {
10
10
  var propTypes: any;
11
11
  }
12
- declare function GridToolbarLabel(props: React.HTMLAttributes<HTMLSpanElement>): import("react/jsx-runtime").JSX.Element;
13
- declare function GridToolbar(props: GridToolbarProps): import("react/jsx-runtime").JSX.Element;
12
+ declare function GridToolbarLabel(props: React.HTMLAttributes<HTMLSpanElement>): React.JSX.Element;
13
+ declare function GridToolbar(props: GridToolbarProps): React.JSX.Element;
14
14
  declare namespace GridToolbar {
15
15
  var propTypes: any;
16
16
  }
@@ -1,3 +1,3 @@
1
1
  import * as React from 'react';
2
2
  export type GridBottomContainerProps = React.PropsWithChildren;
3
- export declare function GridBottomContainer(props: GridBottomContainerProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function GridBottomContainer(props: GridBottomContainerProps): React.JSX.Element;
@@ -1,3 +1,3 @@
1
1
  import * as React from 'react';
2
2
  export type GridBottomContainerProps = React.PropsWithChildren;
3
- export declare function GridBottomContainer(props: GridBottomContainerProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function GridBottomContainer(props: GridBottomContainerProps): React.JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import * as React from 'react';
2
- export declare function GridTopContainer(props: React.PropsWithChildren): import("react/jsx-runtime").JSX.Element;
2
+ export declare function GridTopContainer(props: React.PropsWithChildren): React.JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import * as React from 'react';
2
- export declare function GridTopContainer(props: React.PropsWithChildren): import("react/jsx-runtime").JSX.Element;
2
+ export declare function GridTopContainer(props: React.PropsWithChildren): React.JSX.Element;
@@ -2,5 +2,5 @@ import * as React from 'react';
2
2
  export interface GridVirtualScrollerProps {
3
3
  children?: React.ReactNode;
4
4
  }
5
- declare function GridVirtualScroller(props: GridVirtualScrollerProps): import("react/jsx-runtime").JSX.Element;
5
+ declare function GridVirtualScroller(props: GridVirtualScrollerProps): React.JSX.Element;
6
6
  export { GridVirtualScroller };
@@ -2,5 +2,5 @@ import * as React from 'react';
2
2
  export interface GridVirtualScrollerProps {
3
3
  children?: React.ReactNode;
4
4
  }
5
- declare function GridVirtualScroller(props: GridVirtualScrollerProps): import("react/jsx-runtime").JSX.Element;
5
+ declare function GridVirtualScroller(props: GridVirtualScrollerProps): React.JSX.Element;
6
6
  export { GridVirtualScroller };
@@ -1,9 +1,10 @@
1
+ import * as React from 'react';
1
2
  type Props = {
2
3
  /** The number of rows */
3
4
  rowsLength: number;
4
5
  };
5
6
  declare function GridVirtualScrollerFiller({
6
7
  rowsLength
7
- }: Props): import("react/jsx-runtime").JSX.Element | null;
8
+ }: Props): React.JSX.Element | null;
8
9
  declare const Memoized: typeof GridVirtualScrollerFiller;
9
10
  export { Memoized as GridVirtualScrollerFiller };
@@ -1,9 +1,10 @@
1
+ import * as React from 'react';
1
2
  type Props = {
2
3
  /** The number of rows */
3
4
  rowsLength: number;
4
5
  };
5
6
  declare function GridVirtualScrollerFiller({
6
7
  rowsLength
7
- }: Props): import("react/jsx-runtime").JSX.Element | null;
8
+ }: Props): React.JSX.Element | null;
8
9
  declare const Memoized: typeof GridVirtualScrollerFiller;
9
10
  export { Memoized as GridVirtualScrollerFiller };
@@ -30,6 +30,7 @@ const DATA_GRID_PROPS_DEFAULT_VALUES = exports.DATA_GRID_PROPS_DEFAULT_VALUES =
30
30
  disableMultipleColumnsFiltering: false,
31
31
  disableMultipleColumnsSorting: false,
32
32
  disableMultipleRowSelection: false,
33
+ dataSourceKeepPreviousData: false,
33
34
  dataSourceRevalidateMs: 0,
34
35
  disableRowSelectionOnClick: false,
35
36
  disableRowSelectionExcludeModel: false,
@@ -24,6 +24,7 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
24
24
  disableMultipleColumnsFiltering: false,
25
25
  disableMultipleColumnsSorting: false,
26
26
  disableMultipleRowSelection: false,
27
+ dataSourceKeepPreviousData: false,
27
28
  dataSourceRevalidateMs: 0,
28
29
  disableRowSelectionOnClick: false,
29
30
  disableRowSelectionExcludeModel: false,
@@ -13,5 +13,5 @@ export declare function GridContextProvider({
13
13
  configuration,
14
14
  props,
15
15
  children
16
- }: GridContextProviderProps): import("react/jsx-runtime").JSX.Element;
16
+ }: GridContextProviderProps): React.JSX.Element;
17
17
  export {};
@@ -13,5 +13,5 @@ export declare function GridContextProvider({
13
13
  configuration,
14
14
  props,
15
15
  children
16
- }: GridContextProviderProps): import("react/jsx-runtime").JSX.Element;
16
+ }: GridContextProviderProps): React.JSX.Element;
17
17
  export {};
@@ -49,8 +49,8 @@ export declare const useGridColumnHeaders: (props: UseGridColumnHeadersProps) =>
49
49
  };
50
50
  visibleColumns: GridStateColDef[];
51
51
  columnPositions: number[];
52
- getFillers: (params: GetHeadersParams | undefined, children: React.ReactNode, leftOverflow: number, borderBottom?: boolean) => import("react/jsx-runtime").JSX.Element;
53
- getColumnHeadersRow: () => import("react/jsx-runtime").JSX.Element;
52
+ getFillers: (params: GetHeadersParams | undefined, children: React.ReactNode, leftOverflow: number, borderBottom?: boolean) => React.JSX.Element;
53
+ getColumnHeadersRow: () => React.JSX.Element;
54
54
  getColumnsToRender: (params?: GetHeadersParams) => {
55
55
  renderedColumns: GridStateColDef[];
56
56
  firstColumnToRender: number;
@@ -49,8 +49,8 @@ export declare const useGridColumnHeaders: (props: UseGridColumnHeadersProps) =>
49
49
  };
50
50
  visibleColumns: GridStateColDef[];
51
51
  columnPositions: number[];
52
- getFillers: (params: GetHeadersParams | undefined, children: React.ReactNode, leftOverflow: number, borderBottom?: boolean) => import("react/jsx-runtime").JSX.Element;
53
- getColumnHeadersRow: () => import("react/jsx-runtime").JSX.Element;
52
+ getFillers: (params: GetHeadersParams | undefined, children: React.ReactNode, leftOverflow: number, borderBottom?: boolean) => React.JSX.Element;
53
+ getColumnHeadersRow: () => React.JSX.Element;
54
54
  getColumnsToRender: (params?: GetHeadersParams) => {
55
55
  renderedColumns: GridStateColDef[];
56
56
  firstColumnToRender: number;
@@ -7,7 +7,7 @@ import type { DataGridProcessedProps } from "../../../models/props/DataGridProps
7
7
  import type { GridStrategyProcessor } from "../../core/strategyProcessing/index.mjs";
8
8
  import type { GridEventListener } from "../../../models/events/index.mjs";
9
9
  import type { GridRowId } from "../../../models/gridRows.mjs";
10
- export declare const useGridDataSourceBase: <Api extends GridPrivateApiCommunity>(apiRef: RefObject<Api>, props: Pick<DataGridProcessedProps, "dataSource" | "dataSourceCache" | "onDataSourceError" | "pageSizeOptions" | "pagination" | "signature" | "dataSourceRevalidateMs">, options?: GridDataSourceBaseOptions) => {
10
+ export declare const useGridDataSourceBase: <Api extends GridPrivateApiCommunity>(apiRef: RefObject<Api>, props: Pick<DataGridProcessedProps, "dataSource" | "dataSourceCache" | "dataSourceKeepPreviousData" | "onDataSourceError" | "pageSizeOptions" | "pagination" | "signature" | "dataSourceRevalidateMs">, options?: GridDataSourceBaseOptions) => {
11
11
  api: {
12
12
  public: GridDataSourceApi;
13
13
  };
@@ -7,7 +7,7 @@ import type { DataGridProcessedProps } from "../../../models/props/DataGridProps
7
7
  import type { GridStrategyProcessor } from "../../core/strategyProcessing/index.js";
8
8
  import type { GridEventListener } from "../../../models/events/index.js";
9
9
  import type { GridRowId } from "../../../models/gridRows.js";
10
- export declare const useGridDataSourceBase: <Api extends GridPrivateApiCommunity>(apiRef: RefObject<Api>, props: Pick<DataGridProcessedProps, "dataSource" | "dataSourceCache" | "onDataSourceError" | "pageSizeOptions" | "pagination" | "signature" | "dataSourceRevalidateMs">, options?: GridDataSourceBaseOptions) => {
10
+ export declare const useGridDataSourceBase: <Api extends GridPrivateApiCommunity>(apiRef: RefObject<Api>, props: Pick<DataGridProcessedProps, "dataSource" | "dataSourceCache" | "dataSourceKeepPreviousData" | "onDataSourceError" | "pageSizeOptions" | "pagination" | "signature" | "dataSourceRevalidateMs">, options?: GridDataSourceBaseOptions) => {
11
11
  api: {
12
12
  public: GridDataSourceApi;
13
13
  };
@@ -209,6 +209,11 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
209
209
  });
210
210
  const handleDataUpdate = React.useCallback(params => {
211
211
  if ('error' in params) {
212
+ // Reset the rows on error, even with `dataSourceKeepPreviousData`. The previous
213
+ // rows belong to the previous query while the pagination/sorting/filtering controls
214
+ // already reflect the failed request, so keeping them would present stale data as if
215
+ // it satisfied the new query. This matches TanStack Query, where `keepPreviousData`
216
+ // clears the placeholder once the query settles with an error.
212
217
  apiRef.current.setRows([]);
213
218
  return;
214
219
  }
@@ -265,17 +270,26 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
265
270
  };
266
271
  const debouncedFetchRows = React.useMemo(() => (0, _debounce.default)(fetchRows, 0), [fetchRows]);
267
272
  const handleFetchRowsOnParamsChange = React.useCallback(() => {
268
- // Clear the rows first and immediately mark the grid as loading so the overlay
269
- // selector never observes the intermediate `rows=[] && loading=false` state that
270
- // would otherwise pick `noRowsOverlay`. Order matters: `setRows([])` rebuilds
271
- // `state.rows` from `props.loading`, so the `setLoading(true)` call must come after
272
- // it to survive the rebuild. This handler is only wired up when a standard strategy
273
- // is active via the `runIf` guards on the returned `events` object.
274
- apiRef.current.setRows([]);
273
+ // `dataSourceKeepPreviousData` only applies to the flat `Default` strategy. For
274
+ // `GroupedData` (tree data / row grouping), skipping the synchronous `setRows([])`
275
+ // would leave the existing tree merged on top of the new response and render rows
276
+ // in stale sort order (https://github.com/mui/mui-x/pull/21619).
277
+ // This handler is only wired up when a standard strategy is active via the `runIf`
278
+ // guards on the returned `events` object.
279
+ const activeStrategy = apiRef.current.getActiveStrategy(_strategyProcessing.GridStrategyGroup.DataSource);
280
+ const keepPreviousData = props.dataSourceKeepPreviousData && activeStrategy === _utils2.DataSourceRowsUpdateStrategy.Default;
281
+ if (!keepPreviousData) {
282
+ // Clear the rows first and immediately mark the grid as loading so the overlay
283
+ // selector never observes the intermediate `rows=[] && loading=false` state that
284
+ // would otherwise pick `noRowsOverlay`. Order matters: `setRows([])` rebuilds
285
+ // `state.rows` from `props.loading`, so the `setLoading(true)` call must come after
286
+ // it to survive the rebuild.
287
+ apiRef.current.setRows([]);
288
+ }
275
289
  apiRef.current.setLoading(true);
276
290
  stopPolling();
277
291
  debouncedFetchRows();
278
- }, [apiRef, stopPolling, debouncedFetchRows]);
292
+ }, [apiRef, props.dataSourceKeepPreviousData, stopPolling, debouncedFetchRows]);
279
293
  const isFirstRender = React.useRef(true);
280
294
  React.useEffect(() => {
281
295
  if (isFirstRender.current) {
@@ -307,7 +321,14 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
307
321
  }
308
322
  if (props.dataSource) {
309
323
  stopPolling();
310
- apiRef.current.setRows([]);
324
+ // `dataSourceKeepPreviousData` only applies to the flat `Default` strategy (mirroring
325
+ // `handleFetchRowsOnParamsChange`). Keep the previous rows visible when the `dataSource`
326
+ // reference changes so the feature isn't silently defeated for a non-memoized
327
+ // `dataSource`. Other strategies must still reset the rows to keep their order consistent
328
+ // with the new response (https://github.com/mui/mui-x/pull/21619).
329
+ if (!props.dataSourceKeepPreviousData || currentStrategy !== _utils2.DataSourceRowsUpdateStrategy.Default) {
330
+ apiRef.current.setRows([]);
331
+ }
311
332
  apiRef.current.dataSource.cache.clear();
312
333
  apiRef.current.dataSource.fetchRows();
313
334
  }
@@ -315,7 +336,15 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
315
336
  // ignore the current request on unmount
316
337
  lastRequestId.current += 1;
317
338
  };
318
- }, [apiRef, props.dataSource, currentStrategy, stopPolling]);
339
+ }, [apiRef, props.dataSource, props.dataSourceKeepPreviousData, currentStrategy, stopPolling]);
340
+ React.useEffect(() => {
341
+ // `dataSourceKeepPreviousData` is a no-op for tree data and row grouping: those
342
+ // strategies always reset the rows on refetch to keep their order consistent with the
343
+ // response. Warn so the limitation is discoverable at runtime, not only in the docs.
344
+ if (process.env.NODE_ENV !== 'production' && props.dataSourceKeepPreviousData && (currentStrategy === _utils2.DataSourceRowsUpdateStrategy.GroupedData || currentStrategy === _utils2.DataSourceRowsUpdateStrategy.LazyLoadedGroupedData)) {
345
+ (0, _warning.warnOnce)(['MUI X: The `dataSourceKeepPreviousData` prop only applies to flat data.', 'It is ignored when tree data or row grouping is enabled, because the rows are always reset on refetch to keep their order consistent with the response.', 'For more details, see https://mui.com/x/react-data-grid/server-side-data/#keep-previous-data-while-fetching.']);
346
+ }
347
+ }, [props.dataSourceKeepPreviousData, currentStrategy]);
319
348
  return {
320
349
  api: {
321
350
  public: dataSourceApi
@@ -202,6 +202,11 @@ export const useGridDataSourceBase = (apiRef, props, options = {}) => {
202
202
  });
203
203
  const handleDataUpdate = React.useCallback(params => {
204
204
  if ('error' in params) {
205
+ // Reset the rows on error, even with `dataSourceKeepPreviousData`. The previous
206
+ // rows belong to the previous query while the pagination/sorting/filtering controls
207
+ // already reflect the failed request, so keeping them would present stale data as if
208
+ // it satisfied the new query. This matches TanStack Query, where `keepPreviousData`
209
+ // clears the placeholder once the query settles with an error.
205
210
  apiRef.current.setRows([]);
206
211
  return;
207
212
  }
@@ -258,17 +263,26 @@ export const useGridDataSourceBase = (apiRef, props, options = {}) => {
258
263
  };
259
264
  const debouncedFetchRows = React.useMemo(() => debounce(fetchRows, 0), [fetchRows]);
260
265
  const handleFetchRowsOnParamsChange = React.useCallback(() => {
261
- // Clear the rows first and immediately mark the grid as loading so the overlay
262
- // selector never observes the intermediate `rows=[] && loading=false` state that
263
- // would otherwise pick `noRowsOverlay`. Order matters: `setRows([])` rebuilds
264
- // `state.rows` from `props.loading`, so the `setLoading(true)` call must come after
265
- // it to survive the rebuild. This handler is only wired up when a standard strategy
266
- // is active via the `runIf` guards on the returned `events` object.
267
- apiRef.current.setRows([]);
266
+ // `dataSourceKeepPreviousData` only applies to the flat `Default` strategy. For
267
+ // `GroupedData` (tree data / row grouping), skipping the synchronous `setRows([])`
268
+ // would leave the existing tree merged on top of the new response and render rows
269
+ // in stale sort order (https://github.com/mui/mui-x/pull/21619).
270
+ // This handler is only wired up when a standard strategy is active via the `runIf`
271
+ // guards on the returned `events` object.
272
+ const activeStrategy = apiRef.current.getActiveStrategy(GridStrategyGroup.DataSource);
273
+ const keepPreviousData = props.dataSourceKeepPreviousData && activeStrategy === DataSourceRowsUpdateStrategy.Default;
274
+ if (!keepPreviousData) {
275
+ // Clear the rows first and immediately mark the grid as loading so the overlay
276
+ // selector never observes the intermediate `rows=[] && loading=false` state that
277
+ // would otherwise pick `noRowsOverlay`. Order matters: `setRows([])` rebuilds
278
+ // `state.rows` from `props.loading`, so the `setLoading(true)` call must come after
279
+ // it to survive the rebuild.
280
+ apiRef.current.setRows([]);
281
+ }
268
282
  apiRef.current.setLoading(true);
269
283
  stopPolling();
270
284
  debouncedFetchRows();
271
- }, [apiRef, stopPolling, debouncedFetchRows]);
285
+ }, [apiRef, props.dataSourceKeepPreviousData, stopPolling, debouncedFetchRows]);
272
286
  const isFirstRender = React.useRef(true);
273
287
  React.useEffect(() => {
274
288
  if (isFirstRender.current) {
@@ -300,7 +314,14 @@ export const useGridDataSourceBase = (apiRef, props, options = {}) => {
300
314
  }
301
315
  if (props.dataSource) {
302
316
  stopPolling();
303
- apiRef.current.setRows([]);
317
+ // `dataSourceKeepPreviousData` only applies to the flat `Default` strategy (mirroring
318
+ // `handleFetchRowsOnParamsChange`). Keep the previous rows visible when the `dataSource`
319
+ // reference changes so the feature isn't silently defeated for a non-memoized
320
+ // `dataSource`. Other strategies must still reset the rows to keep their order consistent
321
+ // with the new response (https://github.com/mui/mui-x/pull/21619).
322
+ if (!props.dataSourceKeepPreviousData || currentStrategy !== DataSourceRowsUpdateStrategy.Default) {
323
+ apiRef.current.setRows([]);
324
+ }
304
325
  apiRef.current.dataSource.cache.clear();
305
326
  apiRef.current.dataSource.fetchRows();
306
327
  }
@@ -308,7 +329,15 @@ export const useGridDataSourceBase = (apiRef, props, options = {}) => {
308
329
  // ignore the current request on unmount
309
330
  lastRequestId.current += 1;
310
331
  };
311
- }, [apiRef, props.dataSource, currentStrategy, stopPolling]);
332
+ }, [apiRef, props.dataSource, props.dataSourceKeepPreviousData, currentStrategy, stopPolling]);
333
+ React.useEffect(() => {
334
+ // `dataSourceKeepPreviousData` is a no-op for tree data and row grouping: those
335
+ // strategies always reset the rows on refetch to keep their order consistent with the
336
+ // response. Warn so the limitation is discoverable at runtime, not only in the docs.
337
+ if (process.env.NODE_ENV !== 'production' && props.dataSourceKeepPreviousData && (currentStrategy === DataSourceRowsUpdateStrategy.GroupedData || currentStrategy === DataSourceRowsUpdateStrategy.LazyLoadedGroupedData)) {
338
+ warnOnce(['MUI X: The `dataSourceKeepPreviousData` prop only applies to flat data.', 'It is ignored when tree data or row grouping is enabled, because the rows are always reset on refetch to keep their order consistent with the response.', 'For more details, see https://mui.com/x/react-data-grid/server-side-data/#keep-previous-data-while-fetching.']);
339
+ }
340
+ }, [props.dataSourceKeepPreviousData, currentStrategy]);
312
341
  return {
313
342
  api: {
314
343
  public: dataSourceApi
@@ -1,8 +1,20 @@
1
1
  import type { RefObject } from '@mui/x-internals/types';
2
+ import { GridLogicOperator } from "../../../models/index.mjs";
2
3
  import type { GridColDef, GridFilterItem, GridFilterModel, GridRowModel } from "../../../models/index.mjs";
3
4
  import type { GridPrivateApiCommunity } from "../../../models/api/gridApiCommunity.mjs";
4
5
  import type { GridStateCommunity } from "../../../models/gridStateCommunity.mjs";
5
6
  import type { GridAggregatedFilterItemApplier, GridFilterItemResult, GridQuickFilterValueResult } from "./gridFilterState.mjs";
7
+ /**
8
+ * Pure helpers computing a new filter model from an existing one.
9
+ * Shared by the imperative `apiRef` methods (`useGridFilter`) and the controlled
10
+ * filter panel (`GridFilterPanelBase`) so both paths produce identical models.
11
+ * Each helper returns the same model reference when nothing changes, so callers
12
+ * relying on referential equality can skip no-op updates.
13
+ */
14
+ export declare const upsertFilterItemInModel: (model: GridFilterModel, item: GridFilterItem) => GridFilterModel;
15
+ export declare const upsertFilterItemsInModel: (model: GridFilterModel, itemsToUpsert: GridFilterItem[]) => GridFilterModel;
16
+ export declare const deleteFilterItemFromModel: (model: GridFilterModel, itemToDelete: GridFilterItem) => GridFilterModel;
17
+ export declare const setFilterLogicOperatorInModel: (model: GridFilterModel, logicOperator: GridLogicOperator) => GridFilterModel;
6
18
  /**
7
19
  * Adds default values to the optional fields of a filter items.
8
20
  * @param {GridFilterItem} item The raw filter item.
@@ -1,8 +1,20 @@
1
1
  import type { RefObject } from '@mui/x-internals/types';
2
+ import { GridLogicOperator } from "../../../models/index.js";
2
3
  import type { GridColDef, GridFilterItem, GridFilterModel, GridRowModel } from "../../../models/index.js";
3
4
  import type { GridPrivateApiCommunity } from "../../../models/api/gridApiCommunity.js";
4
5
  import type { GridStateCommunity } from "../../../models/gridStateCommunity.js";
5
6
  import type { GridAggregatedFilterItemApplier, GridFilterItemResult, GridQuickFilterValueResult } from "./gridFilterState.js";
7
+ /**
8
+ * Pure helpers computing a new filter model from an existing one.
9
+ * Shared by the imperative `apiRef` methods (`useGridFilter`) and the controlled
10
+ * filter panel (`GridFilterPanelBase`) so both paths produce identical models.
11
+ * Each helper returns the same model reference when nothing changes, so callers
12
+ * relying on referential equality can skip no-op updates.
13
+ */
14
+ export declare const upsertFilterItemInModel: (model: GridFilterModel, item: GridFilterItem) => GridFilterModel;
15
+ export declare const upsertFilterItemsInModel: (model: GridFilterModel, itemsToUpsert: GridFilterItem[]) => GridFilterModel;
16
+ export declare const deleteFilterItemFromModel: (model: GridFilterModel, itemToDelete: GridFilterItem) => GridFilterModel;
17
+ export declare const setFilterLogicOperatorInModel: (model: GridFilterModel, logicOperator: GridLogicOperator) => GridFilterModel;
6
18
  /**
7
19
  * Adds default values to the optional fields of a filter items.
8
20
  * @param {GridFilterItem} item The raw filter item.
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.shouldQuickFilterExcludeHiddenColumns = exports.sanitizeFilterModel = exports.removeDiacritics = exports.passFilterLogic = exports.mergeStateWithFilterModel = exports.cleanFilterItem = exports.buildAggregatedFilterApplier = void 0;
7
+ exports.upsertFilterItemsInModel = exports.upsertFilterItemInModel = exports.shouldQuickFilterExcludeHiddenColumns = exports.setFilterLogicOperatorInModel = exports.sanitizeFilterModel = exports.removeDiacritics = exports.passFilterLogic = exports.mergeStateWithFilterModel = exports.deleteFilterItemFromModel = exports.cleanFilterItem = exports.buildAggregatedFilterApplier = void 0;
8
8
  var _formatErrorMessage2 = _interopRequireDefault(require("@mui/x-internals/formatErrorMessage"));
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _warning = require("@mui/x-internals/warning");
@@ -12,6 +12,61 @@ var _models = require("../../../models");
12
12
  var _gridFilterState = require("./gridFilterState");
13
13
  var _getPublicApiRef = require("../../../utils/getPublicApiRef");
14
14
  var _columns = require("../columns");
15
+ /**
16
+ * Pure helpers computing a new filter model from an existing one.
17
+ * Shared by the imperative `apiRef` methods (`useGridFilter`) and the controlled
18
+ * filter panel (`GridFilterPanelBase`) so both paths produce identical models.
19
+ * Each helper returns the same model reference when nothing changes, so callers
20
+ * relying on referential equality can skip no-op updates.
21
+ */
22
+
23
+ const upsertFilterItemInModel = (model, item) => {
24
+ const items = [...model.items];
25
+ const itemIndex = items.findIndex(filterItem => filterItem.id === item.id);
26
+ if (itemIndex === -1) {
27
+ items.push(item);
28
+ } else {
29
+ items[itemIndex] = item;
30
+ }
31
+ return (0, _extends2.default)({}, model, {
32
+ items
33
+ });
34
+ };
35
+ exports.upsertFilterItemInModel = upsertFilterItemInModel;
36
+ const upsertFilterItemsInModel = (model, itemsToUpsert) => {
37
+ const items = [...model.items];
38
+ itemsToUpsert.forEach(item => {
39
+ const itemIndex = items.findIndex(filterItem => filterItem.id === item.id);
40
+ if (itemIndex === -1) {
41
+ items.push(item);
42
+ } else {
43
+ items[itemIndex] = item;
44
+ }
45
+ });
46
+ return (0, _extends2.default)({}, model, {
47
+ items
48
+ });
49
+ };
50
+ exports.upsertFilterItemsInModel = upsertFilterItemsInModel;
51
+ const deleteFilterItemFromModel = (model, itemToDelete) => {
52
+ const items = model.items.filter(item => item.id !== itemToDelete.id);
53
+ if (items.length === model.items.length) {
54
+ return model;
55
+ }
56
+ return (0, _extends2.default)({}, model, {
57
+ items
58
+ });
59
+ };
60
+ exports.deleteFilterItemFromModel = deleteFilterItemFromModel;
61
+ const setFilterLogicOperatorInModel = (model, logicOperator) => {
62
+ if (model.logicOperator === logicOperator) {
63
+ return model;
64
+ }
65
+ return (0, _extends2.default)({}, model, {
66
+ logicOperator
67
+ });
68
+ };
69
+ exports.setFilterLogicOperatorInModel = setFilterLogicOperatorInModel;
15
70
  let hasEval;
16
71
  function getHasEval() {
17
72
  if (hasEval !== undefined) {
@@ -5,6 +5,58 @@ import { GridLogicOperator } from "../../../models/index.mjs";
5
5
  import { getDefaultGridFilterModel } from "./gridFilterState.mjs";
6
6
  import { getPublicApiRef } from "../../../utils/getPublicApiRef.mjs";
7
7
  import { gridColumnFieldsSelector, gridColumnLookupSelector, gridColumnVisibilityModelSelector } from "../columns/index.mjs";
8
+
9
+ /**
10
+ * Pure helpers computing a new filter model from an existing one.
11
+ * Shared by the imperative `apiRef` methods (`useGridFilter`) and the controlled
12
+ * filter panel (`GridFilterPanelBase`) so both paths produce identical models.
13
+ * Each helper returns the same model reference when nothing changes, so callers
14
+ * relying on referential equality can skip no-op updates.
15
+ */
16
+
17
+ export const upsertFilterItemInModel = (model, item) => {
18
+ const items = [...model.items];
19
+ const itemIndex = items.findIndex(filterItem => filterItem.id === item.id);
20
+ if (itemIndex === -1) {
21
+ items.push(item);
22
+ } else {
23
+ items[itemIndex] = item;
24
+ }
25
+ return _extends({}, model, {
26
+ items
27
+ });
28
+ };
29
+ export const upsertFilterItemsInModel = (model, itemsToUpsert) => {
30
+ const items = [...model.items];
31
+ itemsToUpsert.forEach(item => {
32
+ const itemIndex = items.findIndex(filterItem => filterItem.id === item.id);
33
+ if (itemIndex === -1) {
34
+ items.push(item);
35
+ } else {
36
+ items[itemIndex] = item;
37
+ }
38
+ });
39
+ return _extends({}, model, {
40
+ items
41
+ });
42
+ };
43
+ export const deleteFilterItemFromModel = (model, itemToDelete) => {
44
+ const items = model.items.filter(item => item.id !== itemToDelete.id);
45
+ if (items.length === model.items.length) {
46
+ return model;
47
+ }
48
+ return _extends({}, model, {
49
+ items
50
+ });
51
+ };
52
+ export const setFilterLogicOperatorInModel = (model, logicOperator) => {
53
+ if (model.logicOperator === logicOperator) {
54
+ return model;
55
+ }
56
+ return _extends({}, model, {
57
+ logicOperator
58
+ });
59
+ };
8
60
  let hasEval;
9
61
  function getHasEval() {
10
62
  if (hasEval !== undefined) {