@mui/x-data-grid 8.7.0 → 8.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +229 -24
- package/DataGrid/index.d.ts +0 -1
- package/DataGrid/useDataGridComponent.js +8 -0
- package/components/GridScrollArea.d.ts +1 -1
- package/components/GridScrollArea.js +134 -28
- package/components/containers/GridRootStyles.js +41 -0
- package/components/virtualization/GridVirtualScroller.js +4 -0
- package/constants/gridClasses.d.ts +20 -0
- package/constants/gridClasses.js +3 -1
- package/esm/DataGrid/index.d.ts +0 -1
- package/esm/DataGrid/useDataGridComponent.js +8 -0
- package/esm/components/GridScrollArea.d.ts +1 -1
- package/esm/components/GridScrollArea.js +134 -28
- package/esm/components/containers/GridRootStyles.js +41 -0
- package/esm/components/virtualization/GridVirtualScroller.js +4 -0
- package/esm/constants/gridClasses.d.ts +20 -0
- package/esm/constants/gridClasses.js +3 -1
- package/esm/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +5 -0
- package/esm/hooks/core/pipeProcessing/useGridPipeProcessing.js +20 -5
- package/esm/hooks/core/useGridProps.d.ts +2 -2
- package/esm/hooks/core/useGridProps.js +3 -1
- package/esm/hooks/features/columnGrouping/gridColumnGroupsInterfaces.d.ts +4 -1
- package/esm/hooks/features/columnGrouping/gridColumnGroupsUtils.js +35 -32
- package/esm/hooks/features/columnGrouping/useGridColumnGrouping.js +18 -13
- package/esm/hooks/features/columns/gridColumnsInterfaces.d.ts +3 -3
- package/esm/hooks/features/columns/gridColumnsSelector.js +6 -2
- package/esm/hooks/features/columns/gridColumnsUtils.js +6 -4
- package/esm/hooks/features/columns/useGridColumns.js +8 -10
- package/esm/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
- package/esm/hooks/features/dataSource/useGridDataSourceBase.js +3 -0
- package/esm/hooks/features/dataSource/utils.js +3 -0
- package/esm/hooks/features/export/utils.js +1 -1
- package/esm/hooks/features/filter/useGridFilter.js +3 -3
- package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +5 -9
- package/esm/hooks/features/listView/gridListViewSelectors.d.ts +8 -1
- package/esm/hooks/features/listView/gridListViewSelectors.js +7 -0
- package/esm/hooks/features/rowSelection/useGridRowSelection.js +5 -4
- package/esm/hooks/features/rows/gridRowsUtils.d.ts +1 -1
- package/esm/hooks/features/rows/gridRowsUtils.js +5 -2
- package/esm/hooks/features/rows/useGridRows.js +4 -3
- package/esm/hooks/features/scroll/useGridScroll.d.ts +1 -1
- package/esm/hooks/features/scroll/useGridScroll.js +2 -3
- package/esm/hooks/features/virtualization/useGridVirtualScroller.js +3 -6
- package/esm/hooks/utils/index.d.ts +1 -0
- package/esm/hooks/utils/index.js +2 -1
- package/esm/hooks/utils/useGridInitializeState.d.ts +1 -1
- package/esm/hooks/utils/useGridInitializeState.js +6 -1
- package/esm/hooks/utils/useGridSelector.js +4 -0
- package/esm/hooks/utils/useRunOncePerLoop.d.ts +1 -0
- package/esm/hooks/utils/useRunOncePerLoop.js +26 -0
- package/esm/index.js +1 -1
- package/esm/internals/utils/cache.d.ts +9 -0
- package/esm/internals/utils/cache.js +19 -0
- package/esm/internals/utils/index.d.ts +2 -1
- package/esm/internals/utils/index.js +2 -1
- package/esm/locales/idID.d.ts +4 -0
- package/esm/locales/idID.js +261 -0
- package/esm/locales/index.d.ts +2 -1
- package/esm/locales/index.js +2 -1
- package/esm/models/api/gridRowApi.d.ts +5 -0
- package/esm/models/events/gridEventLookup.d.ts +2 -1
- package/esm/models/gridApiCaches.d.ts +8 -2
- package/esm/models/gridStateCommunity.d.ts +2 -2
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +5 -0
- package/hooks/core/pipeProcessing/useGridPipeProcessing.js +20 -5
- package/hooks/core/useGridProps.d.ts +2 -2
- package/hooks/core/useGridProps.js +3 -1
- package/hooks/features/columnGrouping/gridColumnGroupsInterfaces.d.ts +4 -1
- package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +35 -32
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +18 -13
- package/hooks/features/columns/gridColumnsInterfaces.d.ts +3 -3
- package/hooks/features/columns/gridColumnsSelector.js +6 -2
- package/hooks/features/columns/gridColumnsUtils.js +6 -4
- package/hooks/features/columns/useGridColumns.js +8 -10
- package/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
- package/hooks/features/dataSource/useGridDataSourceBase.js +3 -0
- package/hooks/features/dataSource/utils.js +3 -0
- package/hooks/features/export/utils.js +1 -1
- package/hooks/features/filter/useGridFilter.js +3 -3
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +5 -9
- package/hooks/features/listView/gridListViewSelectors.d.ts +8 -1
- package/hooks/features/listView/gridListViewSelectors.js +8 -1
- package/hooks/features/rowSelection/useGridRowSelection.js +5 -4
- package/hooks/features/rows/gridRowsUtils.d.ts +1 -1
- package/hooks/features/rows/gridRowsUtils.js +5 -2
- package/hooks/features/rows/useGridRows.js +4 -3
- package/hooks/features/scroll/useGridScroll.d.ts +1 -1
- package/hooks/features/scroll/useGridScroll.js +2 -3
- package/hooks/features/virtualization/useGridVirtualScroller.js +3 -6
- package/hooks/utils/index.d.ts +1 -0
- package/hooks/utils/index.js +12 -0
- package/hooks/utils/useGridInitializeState.d.ts +1 -1
- package/hooks/utils/useGridInitializeState.js +6 -1
- package/hooks/utils/useGridSelector.js +4 -0
- package/hooks/utils/useRunOncePerLoop.d.ts +1 -0
- package/hooks/utils/useRunOncePerLoop.js +33 -0
- package/index.js +1 -1
- package/internals/utils/cache.d.ts +9 -0
- package/internals/utils/cache.js +26 -0
- package/internals/utils/index.d.ts +2 -1
- package/internals/utils/index.js +11 -0
- package/locales/idID.d.ts +4 -0
- package/locales/idID.js +267 -0
- package/locales/index.d.ts +2 -1
- package/locales/index.js +11 -0
- package/models/api/gridRowApi.d.ts +5 -0
- package/models/events/gridEventLookup.d.ts +2 -1
- package/models/gridApiCaches.d.ts +8 -2
- package/models/gridStateCommunity.d.ts +2 -2
- package/package.json +3 -3
|
@@ -241,6 +241,12 @@ export const GridRootStyles = styled('div', {
|
|
|
241
241
|
[`& .${c.treeDataGroupingCellToggle}`]: styles.treeDataGroupingCellToggle
|
|
242
242
|
}, {
|
|
243
243
|
[`& .${c.withBorderColor}`]: styles.withBorderColor
|
|
244
|
+
}, {
|
|
245
|
+
[`& .${c['row--dropAbove']}`]: styles['row--dropAbove']
|
|
246
|
+
}, {
|
|
247
|
+
[`& .${c['row--dropBelow']}`]: styles['row--dropBelow']
|
|
248
|
+
}, {
|
|
249
|
+
[`& .${c['row--beingDragged']}`]: styles['row--beingDragged']
|
|
244
250
|
}]
|
|
245
251
|
})(() => {
|
|
246
252
|
const apiRef = useGridPrivateApiContext();
|
|
@@ -836,6 +842,8 @@ export const GridRootStyles = styled('div', {
|
|
|
836
842
|
[`&.${c['scrollbarFiller--pinnedRight']}`]: {
|
|
837
843
|
backgroundColor: vars.cell.background.pinned,
|
|
838
844
|
position: 'sticky',
|
|
845
|
+
zIndex: 40,
|
|
846
|
+
// Should be above the column separator
|
|
839
847
|
right: 0
|
|
840
848
|
}
|
|
841
849
|
},
|
|
@@ -860,6 +868,39 @@ export const GridRootStyles = styled('div', {
|
|
|
860
868
|
[`& .${c['scrollbar--vertical']}, & .${c.pinnedRows}, & .${c.virtualScroller} > .${c.filler}`]: {
|
|
861
869
|
display: 'none'
|
|
862
870
|
}
|
|
871
|
+
},
|
|
872
|
+
[`& .${c['row--dropAbove']}`]: {
|
|
873
|
+
position: 'relative',
|
|
874
|
+
'&::before': {
|
|
875
|
+
content: '""',
|
|
876
|
+
position: 'absolute',
|
|
877
|
+
top: 0,
|
|
878
|
+
left: 0,
|
|
879
|
+
width: '100%',
|
|
880
|
+
height: '2px',
|
|
881
|
+
backgroundColor: vars.colors.interactive.selected
|
|
882
|
+
}
|
|
883
|
+
},
|
|
884
|
+
[`& .${c['row--dropBelow']}`]: {
|
|
885
|
+
position: 'relative',
|
|
886
|
+
'&::before': {
|
|
887
|
+
content: '""',
|
|
888
|
+
position: 'absolute',
|
|
889
|
+
bottom: '-2px',
|
|
890
|
+
left: 0,
|
|
891
|
+
width: '100%',
|
|
892
|
+
height: '2px',
|
|
893
|
+
backgroundColor: vars.colors.interactive.selected
|
|
894
|
+
},
|
|
895
|
+
[`&.${c['row--lastVisible']}`]: {
|
|
896
|
+
'&::before': {
|
|
897
|
+
bottom: 'calc(var(--DataGrid-hasScrollY) * 0px + (1 - var(--DataGrid-hasScrollY)) * -2px)'
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
},
|
|
901
|
+
[`& .${c['row--beingDragged']}`]: {
|
|
902
|
+
backgroundColor: vars.colors.background.overlay,
|
|
903
|
+
color: vars.colors.foreground.disabled
|
|
863
904
|
}
|
|
864
905
|
};
|
|
865
906
|
return gridStyle;
|
|
@@ -97,6 +97,10 @@ function GridVirtualScroller(props) {
|
|
|
97
97
|
scrollDirection: "left"
|
|
98
98
|
}, getScrollAreaProps())), /*#__PURE__*/_jsx(GridScrollArea, _extends({
|
|
99
99
|
scrollDirection: "right"
|
|
100
|
+
}, getScrollAreaProps())), /*#__PURE__*/_jsx(GridScrollArea, _extends({
|
|
101
|
+
scrollDirection: "up"
|
|
102
|
+
}, getScrollAreaProps())), /*#__PURE__*/_jsx(GridScrollArea, _extends({
|
|
103
|
+
scrollDirection: "down"
|
|
100
104
|
}, getScrollAreaProps())), /*#__PURE__*/_jsxs(Scroller, _extends({
|
|
101
105
|
className: classes.scroller
|
|
102
106
|
}, getScrollerProps(), {
|
|
@@ -577,6 +577,18 @@ export interface GridClasses {
|
|
|
577
577
|
* Styles applied to the floating special row reorder cell element when it is dragged.
|
|
578
578
|
*/
|
|
579
579
|
'row--dragging': string;
|
|
580
|
+
/**
|
|
581
|
+
* Styles applied to the row element when it is a drop target above.
|
|
582
|
+
*/
|
|
583
|
+
'row--dropAbove': string;
|
|
584
|
+
/**
|
|
585
|
+
* Styles applied to the row element when it is a drop target below.
|
|
586
|
+
*/
|
|
587
|
+
'row--dropBelow': string;
|
|
588
|
+
/**
|
|
589
|
+
* Styles applied to the row element when it is being dragged (entire row).
|
|
590
|
+
*/
|
|
591
|
+
'row--beingDragged': string;
|
|
580
592
|
/**
|
|
581
593
|
* Styles applied to the first visible row element on every page of the grid.
|
|
582
594
|
*/
|
|
@@ -639,6 +651,14 @@ export interface GridClasses {
|
|
|
639
651
|
* Styles applied to the right scroll area element.
|
|
640
652
|
*/
|
|
641
653
|
'scrollArea--right': string;
|
|
654
|
+
/**
|
|
655
|
+
* Styles applied to the top scroll area element.
|
|
656
|
+
*/
|
|
657
|
+
'scrollArea--up': string;
|
|
658
|
+
/**
|
|
659
|
+
* Styles applied to the bottom scroll area element.
|
|
660
|
+
*/
|
|
661
|
+
'scrollArea--down': string;
|
|
642
662
|
/**
|
|
643
663
|
* Styles applied to the scrollbars.
|
|
644
664
|
*/
|
|
@@ -3,4 +3,6 @@ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
|
3
3
|
export function getDataGridUtilityClass(slot) {
|
|
4
4
|
return generateUtilityClass('MuiDataGrid', slot);
|
|
5
5
|
}
|
|
6
|
-
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['aiAssistantPanel', 'aiAssistantPanelHeader', 'aiAssistantPanelTitleContainer', 'aiAssistantPanelTitle', 'aiAssistantPanelBody', 'aiAssistantPanelEmptyText', 'aiAssistantPanelFooter', 'aiAssistantPanelConversation', 'aiAssistantPanelConversationList', 'aiAssistantPanelConversationTitle', 'aiAssistantPanelSuggestions', 'aiAssistantPanelSuggestionsList', 'aiAssistantPanelSuggestionsItem', 'aiAssistantPanelSuggestionsLabel', 'actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'aggregationRowOverlayWrapper', 'autoHeight', 'autosizing', 'mainContent', 'withSidePanel', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'collapsible', 'collapsibleTrigger', 'collapsibleIcon', 'collapsiblePanel', 'columnHeader', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader--last', 'columnHeader--lastUnpinned', 'columnHeader--siblingFocused', 'columnHeader--filter', 'columnHeaderFilterInput', 'columnHeaderFilterOperatorLabel', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementSearchInput', 'columnsManagementFooter', 'columnsManagementScrollArea', 'columnsManagementEmptyText', 'container--top', 'container--bottom', 'detailPanel', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderBottom', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'main--hiddenContent', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'root--noToolbar', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible',
|
|
6
|
+
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['aiAssistantPanel', 'aiAssistantPanelHeader', 'aiAssistantPanelTitleContainer', 'aiAssistantPanelTitle', 'aiAssistantPanelBody', 'aiAssistantPanelEmptyText', 'aiAssistantPanelFooter', 'aiAssistantPanelConversation', 'aiAssistantPanelConversationList', 'aiAssistantPanelConversationTitle', 'aiAssistantPanelSuggestions', 'aiAssistantPanelSuggestionsList', 'aiAssistantPanelSuggestionsItem', 'aiAssistantPanelSuggestionsLabel', 'actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'aggregationRowOverlayWrapper', 'autoHeight', 'autosizing', 'mainContent', 'withSidePanel', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'collapsible', 'collapsibleTrigger', 'collapsibleIcon', 'collapsiblePanel', 'columnHeader', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader--last', 'columnHeader--lastUnpinned', 'columnHeader--siblingFocused', 'columnHeader--filter', 'columnHeaderFilterInput', 'columnHeaderFilterOperatorLabel', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementSearchInput', 'columnsManagementFooter', 'columnsManagementScrollArea', 'columnsManagementEmptyText', 'container--top', 'container--bottom', 'detailPanel', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderBottom', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'main--hiddenContent', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'root--noToolbar', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible',
|
|
7
|
+
// TODO v9: Rename to `cell--dragging`
|
|
8
|
+
'row--dragging', 'row--dropAbove', 'row--dropBelow', 'row--beingDragged', 'row--dynamicHeight', 'row--detailPanelExpanded', 'row--borderBottom', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowReorderIcon', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea--up', 'scrollArea--down', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--borderBottom', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortButton', 'sortIcon', 'shadowScrollArea', 'sidebar', 'sidebarHeader', 'toolbarContainer', 'toolbar', 'toolbarLabel', 'toolbarDivider', 'toolbarFilterList', 'toolbarQuickFilter', 'toolbarQuickFilterTrigger', 'toolbarQuickFilterControl', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'groupingCriteriaCellLoadingContainer', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pivotPanelAvailableFields', 'pivotPanelField', 'pivotPanelField--sorted', 'pivotPanelFieldActionContainer', 'pivotPanelFieldCheckbox', 'pivotPanelFieldDragIcon', 'pivotPanelFieldList', 'pivotPanelFieldName', 'pivotPanelHeader', 'pivotPanelPlaceholder', 'pivotPanelScrollArea', 'pivotPanelSearchContainer', 'pivotPanelSection', 'pivotPanelSectionTitle', 'pivotPanelSections', 'pivotPanelSwitch', 'pivotPanelSwitchLabel', 'prompt', 'promptContent', 'promptText', 'promptFeedback', 'promptChangeList', 'promptChangesToggle', 'promptChangesToggleIcon', 'promptIcon', 'promptIconContainer', 'promptError', 'promptAction']);
|
|
@@ -138,5 +138,10 @@ export interface GridPipeProcessingPrivateApi {
|
|
|
138
138
|
* @param {GridPipeProcessorGroup} group The group to apply.
|
|
139
139
|
*/
|
|
140
140
|
requestPipeProcessorsApplication: (group: GridPipeProcessorGroup) => void;
|
|
141
|
+
/**
|
|
142
|
+
* Checks of there are any processors that have been updated and runs appliers for them.
|
|
143
|
+
* It is intended to be called in a useEffect in the top-level data grid hook (`useDataGridComponent`).
|
|
144
|
+
*/
|
|
145
|
+
runAppliersForPendingProcessors: () => void;
|
|
141
146
|
}
|
|
142
147
|
export {};
|
|
@@ -49,7 +49,8 @@ export const useGridPipeProcessing = apiRef => {
|
|
|
49
49
|
cache.current[group] = {
|
|
50
50
|
processors: new Map(),
|
|
51
51
|
processorsAsArray: [],
|
|
52
|
-
appliers: {}
|
|
52
|
+
appliers: {},
|
|
53
|
+
processorsUpdated: false
|
|
53
54
|
};
|
|
54
55
|
}
|
|
55
56
|
const groupCache = cache.current[group];
|
|
@@ -57,19 +58,20 @@ export const useGridPipeProcessing = apiRef => {
|
|
|
57
58
|
if (oldProcessor !== processor) {
|
|
58
59
|
groupCache.processors.set(id, processor);
|
|
59
60
|
groupCache.processorsAsArray = Array.from(cache.current[group].processors.values()).filter(processorValue => processorValue !== null);
|
|
60
|
-
|
|
61
|
+
groupCache.processorsUpdated = true;
|
|
61
62
|
}
|
|
62
63
|
return () => {
|
|
63
64
|
cache.current[group].processors.set(id, null);
|
|
64
65
|
cache.current[group].processorsAsArray = Array.from(cache.current[group].processors.values()).filter(processorValue => processorValue !== null);
|
|
65
66
|
};
|
|
66
|
-
}, [
|
|
67
|
+
}, []);
|
|
67
68
|
const registerPipeApplier = React.useCallback((group, id, applier) => {
|
|
68
69
|
if (!cache.current[group]) {
|
|
69
70
|
cache.current[group] = {
|
|
70
71
|
processors: new Map(),
|
|
71
72
|
processorsAsArray: [],
|
|
72
|
-
appliers: {}
|
|
73
|
+
appliers: {},
|
|
74
|
+
processorsUpdated: false
|
|
73
75
|
};
|
|
74
76
|
}
|
|
75
77
|
cache.current[group].appliers[id] = applier;
|
|
@@ -82,6 +84,18 @@ export const useGridPipeProcessing = apiRef => {
|
|
|
82
84
|
const requestPipeProcessorsApplication = React.useCallback(group => {
|
|
83
85
|
runAppliers(cache.current[group]);
|
|
84
86
|
}, [runAppliers]);
|
|
87
|
+
const runAppliersForPendingProcessors = React.useCallback(() => {
|
|
88
|
+
for (const group in cache.current) {
|
|
89
|
+
if (!Object.prototype.hasOwnProperty.call(cache.current, group)) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const groupCache = cache.current[group];
|
|
93
|
+
if (groupCache.processorsUpdated) {
|
|
94
|
+
groupCache.processorsUpdated = false;
|
|
95
|
+
runAppliers(groupCache);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}, [runAppliers]);
|
|
85
99
|
const applyPipeProcessors = React.useCallback((...args) => {
|
|
86
100
|
const [group, value, context] = args;
|
|
87
101
|
if (!cache.current[group]) {
|
|
@@ -97,7 +111,8 @@ export const useGridPipeProcessing = apiRef => {
|
|
|
97
111
|
const preProcessingPrivateApi = {
|
|
98
112
|
registerPipeProcessor,
|
|
99
113
|
registerPipeApplier,
|
|
100
|
-
requestPipeProcessorsApplication
|
|
114
|
+
requestPipeProcessorsApplication,
|
|
115
|
+
runAppliersForPendingProcessors
|
|
101
116
|
};
|
|
102
117
|
const preProcessingPublicApi = {
|
|
103
118
|
unstable_applyPipeProcessors: applyPipeProcessors
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { RefObject } from '@mui/x-internals/types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { DataGridProcessedProps } from "../../models/props/DataGridProps.js";
|
|
3
3
|
import type { GridPrivateApiCommon } from "../../models/api/gridApiCommon.js";
|
|
4
4
|
import type { GridStateInitializer } from "../utils/useGridInitializeState.js";
|
|
5
|
-
type Props = Pick<
|
|
5
|
+
type Props = Pick<DataGridProcessedProps, 'getRowId' | 'listView'>;
|
|
6
6
|
export declare const propsStateInitializer: GridStateInitializer<Props>;
|
|
7
7
|
export declare const useGridProps: <PrivateApi extends GridPrivateApiCommon>(apiRef: RefObject<PrivateApi>, props: Props) => void;
|
|
8
8
|
export {};
|
|
@@ -5,6 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
export const propsStateInitializer = (state, props) => {
|
|
6
6
|
return _extends({}, state, {
|
|
7
7
|
props: {
|
|
8
|
+
listView: props.listView,
|
|
8
9
|
getRowId: props.getRowId
|
|
9
10
|
}
|
|
10
11
|
});
|
|
@@ -13,8 +14,9 @@ export const useGridProps = (apiRef, props) => {
|
|
|
13
14
|
React.useEffect(() => {
|
|
14
15
|
apiRef.current.setState(state => _extends({}, state, {
|
|
15
16
|
props: {
|
|
17
|
+
listView: props.listView,
|
|
16
18
|
getRowId: props.getRowId
|
|
17
19
|
}
|
|
18
20
|
}));
|
|
19
|
-
}, [apiRef, props.getRowId]);
|
|
21
|
+
}, [apiRef, props.listView, props.getRowId]);
|
|
20
22
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GridColumnGroup } from "../../../models/gridColumnGrouping.js";
|
|
1
|
+
import { GridColumnGroup, GridColumnGroupingModel } from "../../../models/gridColumnGrouping.js";
|
|
2
2
|
export type GridColumnGroupLookup = {
|
|
3
3
|
[groupId: string]: Omit<GridColumnGroup, 'children'>;
|
|
4
4
|
};
|
|
@@ -13,4 +13,7 @@ export interface GridColumnsGroupingState {
|
|
|
13
13
|
[columnField: string]: GridColumnGroup['groupId'][];
|
|
14
14
|
};
|
|
15
15
|
maxDepth: number;
|
|
16
|
+
}
|
|
17
|
+
export interface GridColumnGroupingInternalCache {
|
|
18
|
+
lastColumnGroupingModel?: GridColumnGroupingModel;
|
|
16
19
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { isDeepEqual } from '@mui/x-internals/isDeepEqual';
|
|
2
1
|
import { isLeaf } from "../../../models/gridColumnGrouping.js";
|
|
3
2
|
// This is the recurrence function that help writing `unwrapGroupingColumnModel()`
|
|
4
3
|
const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents, unwrappedGroupingModelToComplete) => {
|
|
@@ -37,45 +36,49 @@ export const unwrapGroupingColumnModel = columnGroupingModel => {
|
|
|
37
36
|
export const getColumnGroupsHeaderStructure = (orderedColumns, unwrappedGroupingModel, pinnedFields) => {
|
|
38
37
|
const getParents = field => unwrappedGroupingModel[field] ?? [];
|
|
39
38
|
const groupingHeaderStructure = [];
|
|
40
|
-
const maxDepth = Math.max(...orderedColumns.map(field => getParents(field).length));
|
|
41
|
-
const haveSameParents = (field1, field2, depth) =>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
const maxDepth = Math.max(0, ...orderedColumns.map(field => getParents(field).length));
|
|
40
|
+
const haveSameParents = (field1, field2, depth) => {
|
|
41
|
+
const a = getParents(field1);
|
|
42
|
+
const b = getParents(field2);
|
|
43
|
+
for (let i = 0; i <= depth; i += 1) {
|
|
44
|
+
if (a[i] !== b[i]) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
48
47
|
}
|
|
49
|
-
return
|
|
48
|
+
return true;
|
|
49
|
+
};
|
|
50
|
+
const haveDifferentContainers = (field1, field2) => {
|
|
51
|
+
const left = pinnedFields?.left;
|
|
52
|
+
const right = pinnedFields?.right;
|
|
53
|
+
const inLeft1 = !!left?.includes(field1);
|
|
54
|
+
const inLeft2 = !!left?.includes(field2);
|
|
55
|
+
const inRight1 = !!right?.includes(field1);
|
|
56
|
+
const inRight2 = !!right?.includes(field2);
|
|
57
|
+
return inLeft1 !== inLeft2 || inRight1 !== inRight2;
|
|
50
58
|
};
|
|
51
59
|
for (let depth = 0; depth < maxDepth; depth += 1) {
|
|
52
|
-
const depthStructure =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
const depthStructure = [];
|
|
61
|
+
for (let i = 0; i < orderedColumns.length; i += 1) {
|
|
62
|
+
const field = orderedColumns[i];
|
|
63
|
+
const groupId = getParents(field)[depth] ?? null;
|
|
64
|
+
if (depthStructure.length === 0) {
|
|
65
|
+
depthStructure.push({
|
|
66
|
+
columnFields: [field],
|
|
57
67
|
groupId
|
|
58
|
-
}
|
|
68
|
+
});
|
|
69
|
+
continue;
|
|
59
70
|
}
|
|
60
|
-
const lastGroup =
|
|
71
|
+
const lastGroup = depthStructure[depthStructure.length - 1];
|
|
61
72
|
const prevField = lastGroup.columnFields[lastGroup.columnFields.length - 1];
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
haveDifferentContainers(prevField, newField)) {
|
|
66
|
-
// It's a new group
|
|
67
|
-
return [...structure, {
|
|
68
|
-
columnFields: [newField],
|
|
73
|
+
if (lastGroup.groupId !== groupId || !haveSameParents(prevField, field, depth) || haveDifferentContainers(prevField, field)) {
|
|
74
|
+
depthStructure.push({
|
|
75
|
+
columnFields: [field],
|
|
69
76
|
groupId
|
|
70
|
-
}
|
|
77
|
+
});
|
|
78
|
+
} else {
|
|
79
|
+
lastGroup.columnFields.push(field);
|
|
71
80
|
}
|
|
72
|
-
|
|
73
|
-
// It extends the previous group
|
|
74
|
-
return [...structure.slice(0, structure.length - 1), {
|
|
75
|
-
columnFields: [...lastGroup.columnFields, newField],
|
|
76
|
-
groupId
|
|
77
|
-
}];
|
|
78
|
-
}, []);
|
|
81
|
+
}
|
|
79
82
|
groupingHeaderStructure.push(depthStructure);
|
|
80
83
|
}
|
|
81
84
|
return groupingHeaderStructure;
|
|
@@ -11,10 +11,11 @@ import { getColumnGroupsHeaderStructure, unwrapGroupingColumnModel } from "./gri
|
|
|
11
11
|
import { useGridEvent } from "../../utils/useGridEvent.js";
|
|
12
12
|
import { gridColumnFieldsSelector, gridVisibleColumnFieldsSelector } from "../columns/index.js";
|
|
13
13
|
const createGroupLookup = columnGroupingModel => {
|
|
14
|
-
|
|
15
|
-
columnGroupingModel.
|
|
14
|
+
const groupLookup = {};
|
|
15
|
+
for (let i = 0; i < columnGroupingModel.length; i += 1) {
|
|
16
|
+
const node = columnGroupingModel[i];
|
|
16
17
|
if (isLeaf(node)) {
|
|
17
|
-
|
|
18
|
+
continue;
|
|
18
19
|
}
|
|
19
20
|
const {
|
|
20
21
|
groupId,
|
|
@@ -24,10 +25,8 @@ const createGroupLookup = columnGroupingModel => {
|
|
|
24
25
|
if (!groupId) {
|
|
25
26
|
throw new Error('MUI X: An element of the columnGroupingModel does not have either `field` or `groupId`.');
|
|
26
27
|
}
|
|
27
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
28
|
-
|
|
29
|
-
console.warn(`MUI X: group groupId=${groupId} has no children.`);
|
|
30
|
-
}
|
|
28
|
+
if (process.env.NODE_ENV !== 'production' && !children) {
|
|
29
|
+
console.warn(`MUI X: group groupId=${groupId} has no children.`);
|
|
31
30
|
}
|
|
32
31
|
const groupParam = _extends({}, other, {
|
|
33
32
|
groupId
|
|
@@ -36,13 +35,15 @@ const createGroupLookup = columnGroupingModel => {
|
|
|
36
35
|
if (subTreeLookup[groupId] !== undefined || groupLookup[groupId] !== undefined) {
|
|
37
36
|
throw new Error(`MUI X: The groupId ${groupId} is used multiple times in the columnGroupingModel.`);
|
|
38
37
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return _extends({}, groupLookup);
|
|
38
|
+
Object.assign(groupLookup, subTreeLookup);
|
|
39
|
+
groupLookup[groupId] = groupParam;
|
|
40
|
+
}
|
|
41
|
+
return groupLookup;
|
|
44
42
|
};
|
|
45
43
|
export const columnGroupsStateInitializer = (state, props, apiRef) => {
|
|
44
|
+
apiRef.current.caches.columnGrouping = {
|
|
45
|
+
lastColumnGroupingModel: props.columnGroupingModel
|
|
46
|
+
};
|
|
46
47
|
if (!props.columnGroupingModel) {
|
|
47
48
|
return state;
|
|
48
49
|
}
|
|
@@ -97,6 +98,7 @@ export const useGridColumnGrouping = (apiRef, props) => {
|
|
|
97
98
|
});
|
|
98
99
|
}, [apiRef, props.columnGroupingModel]);
|
|
99
100
|
const updateColumnGroupingState = React.useCallback(columnGroupingModel => {
|
|
101
|
+
apiRef.current.caches.columnGrouping.lastColumnGroupingModel = columnGroupingModel;
|
|
100
102
|
// @ts-expect-error Move this logic to `Pro` package
|
|
101
103
|
const pinnedColumns = apiRef.current.getPinnedColumns?.() ?? {};
|
|
102
104
|
const columnFields = gridColumnFieldsSelector(apiRef);
|
|
@@ -128,6 +130,9 @@ export const useGridColumnGrouping = (apiRef, props) => {
|
|
|
128
130
|
* EFFECTS
|
|
129
131
|
*/
|
|
130
132
|
React.useEffect(() => {
|
|
133
|
+
if (props.columnGroupingModel === apiRef.current.caches.columnGrouping.lastColumnGroupingModel) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
131
136
|
updateColumnGroupingState(props.columnGroupingModel);
|
|
132
|
-
}, [updateColumnGroupingState, props.columnGroupingModel]);
|
|
137
|
+
}, [apiRef, updateColumnGroupingState, props.columnGroupingModel]);
|
|
133
138
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GridColDef, GridStateColDef } from "../../../models/colDef/gridColDef.js";
|
|
1
|
+
import type { GridColDef, GridStateColDef } from "../../../models/colDef/gridColDef.js";
|
|
2
2
|
import type { GridColumnDimensionProperties } from "./gridColumnsUtils.js";
|
|
3
3
|
export declare enum GridPinnedColumnPosition {
|
|
4
4
|
LEFT = "left",
|
|
@@ -21,8 +21,8 @@ export interface GridPinnedColumnFields {
|
|
|
21
21
|
right?: string[];
|
|
22
22
|
}
|
|
23
23
|
export declare const EMPTY_PINNED_COLUMN_FIELDS: {
|
|
24
|
-
left:
|
|
25
|
-
right:
|
|
24
|
+
left: never[];
|
|
25
|
+
right: never[];
|
|
26
26
|
};
|
|
27
27
|
export interface GridPinnedColumns {
|
|
28
28
|
left: GridStateColDef[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createSelector, createSelectorMemoized, createRootSelector } from "../../../utils/createSelector.js";
|
|
2
2
|
import { EMPTY_PINNED_COLUMN_FIELDS } from "./gridColumnsInterfaces.js";
|
|
3
3
|
import { gridIsRtlSelector } from "../../core/gridCoreSelector.js";
|
|
4
|
+
import { gridListColumnSelector, gridListViewSelector } from "../listView/index.js";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Get the columns state
|
|
@@ -45,7 +46,7 @@ export const gridInitialColumnVisibilityModelSelector = createSelector(gridColum
|
|
|
45
46
|
* Get the visible columns as a lookup (an object containing the field for keys and the definition for values).
|
|
46
47
|
* @category Visible Columns
|
|
47
48
|
*/
|
|
48
|
-
export const gridVisibleColumnDefinitionsSelector = createSelectorMemoized(gridColumnDefinitionsSelector, gridColumnVisibilityModelSelector, (columns, columnVisibilityModel) => columns.filter(column => columnVisibilityModel[column.field] !== false));
|
|
49
|
+
export const gridVisibleColumnDefinitionsSelector = createSelectorMemoized(gridColumnDefinitionsSelector, gridColumnVisibilityModelSelector, gridListViewSelector, gridListColumnSelector, (columns, columnVisibilityModel, listView, listColumn) => listView && listColumn ? [listColumn] : columns.filter(column => columnVisibilityModel[column.field] !== false));
|
|
49
50
|
|
|
50
51
|
/**
|
|
51
52
|
* Get the field of each visible column.
|
|
@@ -70,7 +71,10 @@ export const gridExistingPinnedColumnSelector = createSelectorMemoized(gridPinne
|
|
|
70
71
|
* Get the visible pinned columns.
|
|
71
72
|
* @category Visible Columns
|
|
72
73
|
*/
|
|
73
|
-
export const gridVisiblePinnedColumnDefinitionsSelector = createSelectorMemoized(gridColumnsStateSelector, gridPinnedColumnsSelector, gridVisibleColumnFieldsSelector, gridIsRtlSelector, (columnsState, model, visibleColumnFields, isRtl) => {
|
|
74
|
+
export const gridVisiblePinnedColumnDefinitionsSelector = createSelectorMemoized(gridColumnsStateSelector, gridPinnedColumnsSelector, gridVisibleColumnFieldsSelector, gridIsRtlSelector, gridListViewSelector, (columnsState, model, visibleColumnFields, isRtl, listView) => {
|
|
75
|
+
if (listView) {
|
|
76
|
+
return EMPTY_PINNED_COLUMN_FIELDS;
|
|
77
|
+
}
|
|
74
78
|
const visiblePinnedFields = filterMissingColumns(model, visibleColumnFields, isRtl);
|
|
75
79
|
const visiblePinnedColumns = {
|
|
76
80
|
left: visiblePinnedFields.left.map(field => columnsState.lookup[field]),
|
|
@@ -242,11 +242,13 @@ export const createColumnsState = ({
|
|
|
242
242
|
initialColumnVisibilityModel: updateInitialVisibilityModel ? columnVisibilityModel : currentState.initialColumnVisibilityModel
|
|
243
243
|
};
|
|
244
244
|
}
|
|
245
|
-
|
|
245
|
+
const columnsToKeep = {};
|
|
246
246
|
if (keepOnlyColumnsToUpsert && !isInsideStateInitializer) {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
for (const key in columnsState.lookup) {
|
|
248
|
+
if (Object.prototype.hasOwnProperty.call(columnsState.lookup, key)) {
|
|
249
|
+
columnsToKeep[key] = false;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
250
252
|
}
|
|
251
253
|
const columnsToUpsertLookup = {};
|
|
252
254
|
columnsToUpsert.forEach(newColumn => {
|
|
@@ -14,6 +14,9 @@ import { GridPreferencePanelsValue } from "../preferencesPanel/index.js";
|
|
|
14
14
|
import { gridPivotActiveSelector } from "../pivoting/index.js";
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
16
|
export const columnsStateInitializer = (state, props, apiRef) => {
|
|
17
|
+
apiRef.current.caches.columns = {
|
|
18
|
+
lastColumnsProp: props.columns
|
|
19
|
+
};
|
|
17
20
|
const columnsState = createColumnsState({
|
|
18
21
|
apiRef,
|
|
19
22
|
columnsToUpsert: props.columns,
|
|
@@ -36,7 +39,6 @@ export const columnsStateInitializer = (state, props, apiRef) => {
|
|
|
36
39
|
*/
|
|
37
40
|
export function useGridColumns(apiRef, props) {
|
|
38
41
|
const logger = useGridLogger(apiRef, 'useGridColumns');
|
|
39
|
-
const previousColumnsProp = React.useRef(props.columns);
|
|
40
42
|
apiRef.current.registerControlState({
|
|
41
43
|
stateId: 'visibleColumns',
|
|
42
44
|
propModel: props.columnVisibilityModel,
|
|
@@ -299,27 +301,23 @@ export function useGridColumns(apiRef, props) {
|
|
|
299
301
|
*/
|
|
300
302
|
// The effect do not track any value defined synchronously during the 1st render by hooks called after `useGridColumns`
|
|
301
303
|
// As a consequence, the state generated by the 1st run of this useEffect will always be equal to the initialization one
|
|
302
|
-
const isFirstRender = React.useRef(true);
|
|
303
304
|
React.useEffect(() => {
|
|
304
|
-
if (
|
|
305
|
-
isFirstRender.current = false;
|
|
305
|
+
if (apiRef.current.caches.columns.lastColumnsProp === props.columns) {
|
|
306
306
|
return;
|
|
307
307
|
}
|
|
308
|
+
apiRef.current.caches.columns.lastColumnsProp = props.columns;
|
|
308
309
|
logger.info(`GridColumns have changed, new length ${props.columns.length}`);
|
|
309
|
-
if (previousColumnsProp.current === props.columns) {
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
310
|
const columnsState = createColumnsState({
|
|
313
311
|
apiRef,
|
|
314
312
|
initialState: undefined,
|
|
315
313
|
// If the user provides a model, we don't want to set it in the state here because it has it's dedicated `useEffect` which calls `setColumnVisibilityModel`
|
|
316
314
|
columnsToUpsert: props.columns,
|
|
317
315
|
keepOnlyColumnsToUpsert: true,
|
|
318
|
-
updateInitialVisibilityModel: true
|
|
316
|
+
updateInitialVisibilityModel: true,
|
|
317
|
+
columnVisibilityModel: props.columnVisibilityModel
|
|
319
318
|
});
|
|
320
|
-
previousColumnsProp.current = props.columns;
|
|
321
319
|
setGridColumnsState(columnsState);
|
|
322
|
-
}, [logger, apiRef, setGridColumnsState, props.columns]);
|
|
320
|
+
}, [logger, apiRef, setGridColumnsState, props.columns, props.columnVisibilityModel]);
|
|
323
321
|
React.useEffect(() => {
|
|
324
322
|
if (props.columnVisibilityModel !== undefined) {
|
|
325
323
|
apiRef.current.setColumnVisibilityModel(props.columnVisibilityModel);
|
|
@@ -6,7 +6,7 @@ import type { GridPrivateApiCommunity } from "../../../models/api/gridApiCommuni
|
|
|
6
6
|
import type { DataGridProcessedProps } from "../../../models/props/DataGridProps.js";
|
|
7
7
|
import type { GridStrategyProcessor } from "../../core/strategyProcessing/index.js";
|
|
8
8
|
import type { GridEventListener } from "../../../models/events/index.js";
|
|
9
|
-
export declare const useGridDataSourceBase: <Api extends GridPrivateApiCommunity>(apiRef: RefObject<Api>, props: Pick<DataGridProcessedProps, "dataSource" | "dataSourceCache" | "onDataSourceError" | "pageSizeOptions" | "signature">, options?: GridDataSourceBaseOptions) => {
|
|
9
|
+
export declare const useGridDataSourceBase: <Api extends GridPrivateApiCommunity>(apiRef: RefObject<Api>, props: Pick<DataGridProcessedProps, "dataSource" | "dataSourceCache" | "onDataSourceError" | "pageSizeOptions" | "pagination" | "signature">, options?: GridDataSourceBaseOptions) => {
|
|
10
10
|
api: {
|
|
11
11
|
public: GridDataSourceApi;
|
|
12
12
|
};
|
|
@@ -35,6 +35,9 @@ export const useGridDataSourceBase = (apiRef, props, options = {}) => {
|
|
|
35
35
|
const lastRequestId = React.useRef(0);
|
|
36
36
|
const onDataSourceErrorProp = props.onDataSourceError;
|
|
37
37
|
const cacheChunkManager = useLazyRef(() => {
|
|
38
|
+
if (!props.pagination) {
|
|
39
|
+
return new CacheChunkManager(paginationModel.pageSize);
|
|
40
|
+
}
|
|
38
41
|
const sortedPageSizeOptions = props.pageSizeOptions.map(option => typeof option === 'number' ? option : option.value).sort((a, b) => a - b);
|
|
39
42
|
const cacheChunkSize = Math.min(paginationModel.pageSize, sortedPageSizeOptions[0]);
|
|
40
43
|
return new CacheChunkManager(cacheChunkSize);
|
|
@@ -37,6 +37,9 @@ export class CacheChunkManager {
|
|
|
37
37
|
};
|
|
38
38
|
this.splitResponse = (key, response) => {
|
|
39
39
|
const cacheKeys = this.getCacheKeys(key);
|
|
40
|
+
if (cacheKeys.length === 1) {
|
|
41
|
+
return new Map([[key, response]]);
|
|
42
|
+
}
|
|
40
43
|
const responses = new Map();
|
|
41
44
|
cacheKeys.forEach(chunkKey => {
|
|
42
45
|
const isLastChunk = chunkKey.end === key.end;
|
|
@@ -17,7 +17,7 @@ export const getColumnsToExport = ({
|
|
|
17
17
|
}, []);
|
|
18
18
|
}
|
|
19
19
|
const validColumns = options.allColumns ? columns : gridVisibleColumnDefinitionsSelector(apiRef);
|
|
20
|
-
return validColumns.filter(column =>
|
|
20
|
+
return validColumns.filter(column => column.disableExport !== true);
|
|
21
21
|
};
|
|
22
22
|
export const defaultGetRowsToExport = ({
|
|
23
23
|
apiRef
|
|
@@ -342,9 +342,9 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
342
342
|
useGridEvent(apiRef, 'rowExpansionChange', updateVisibleRowsLookupState);
|
|
343
343
|
useGridEvent(apiRef, 'columnVisibilityModelChange', () => {
|
|
344
344
|
const filterModel = gridFilterModelSelector(apiRef);
|
|
345
|
-
if (filterModel.quickFilterValues && shouldQuickFilterExcludeHiddenColumns(filterModel)) {
|
|
345
|
+
if (filterModel.quickFilterValues?.length && shouldQuickFilterExcludeHiddenColumns(filterModel)) {
|
|
346
346
|
// re-apply filters because the quick filter results may have changed
|
|
347
|
-
|
|
347
|
+
updateFilteredRows();
|
|
348
348
|
}
|
|
349
349
|
});
|
|
350
350
|
|
|
@@ -352,7 +352,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
352
352
|
* 1ST RENDER
|
|
353
353
|
*/
|
|
354
354
|
useFirstRender(() => {
|
|
355
|
-
|
|
355
|
+
updateFilteredRows();
|
|
356
356
|
});
|
|
357
357
|
|
|
358
358
|
/**
|
|
@@ -10,4 +10,4 @@ import { DataGridProcessedProps } from "../../../models/props/DataGridProps.js";
|
|
|
10
10
|
* @requires useGridScroll (method) - can be after
|
|
11
11
|
* @requires useGridColumnSpanning (method) - can be after
|
|
12
12
|
*/
|
|
13
|
-
export declare const useGridKeyboardNavigation: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "pagination" | "paginationMode" | "getRowId" | "signature" | "headerFilters"
|
|
13
|
+
export declare const useGridKeyboardNavigation: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "pagination" | "paginationMode" | "getRowId" | "signature" | "headerFilters">) => void;
|