@mui/x-data-grid 7.24.0 → 7.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +148 -0
- package/DataGrid/DataGrid.js +1 -7
- package/DataGrid/useDataGridComponent.d.ts +2 -1
- package/components/GridRow.d.ts +0 -1
- package/components/GridRow.js +25 -19
- package/components/cell/GridCell.d.ts +9 -6
- package/components/cell/GridCell.js +29 -52
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.ts +3 -3
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +21 -7
- package/components/containers/GridRootStyles.js +135 -37
- package/components/panel/GridPanel.js +2 -1
- package/components/panel/filterPanel/GridFilterInputValueProps.d.ts +2 -1
- package/components/toolbar/GridToolbarColumnsButton.js +8 -2
- package/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/components/toolbar/GridToolbarExportContainer.js +2 -2
- package/components/toolbar/GridToolbarFilterButton.js +8 -2
- package/components/virtualization/GridMainContainer.d.ts +10 -0
- package/components/virtualization/GridMainContainer.js +10 -2
- package/components/virtualization/GridVirtualScrollbar.d.ts +4 -0
- package/components/virtualization/GridVirtualScrollbar.js +5 -5
- package/components/virtualization/GridVirtualScroller.js +18 -5
- package/components/virtualization/GridVirtualScrollerContent.js +11 -2
- package/context/GridContextProvider.d.ts +2 -1
- package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +2 -2
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +2 -2
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +2 -2
- package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.d.ts +2 -2
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +2 -2
- package/hooks/core/useGridApiInitialization.d.ts +2 -2
- package/hooks/core/useGridInitialization.d.ts +2 -2
- package/hooks/core/useGridIsRtl.d.ts +2 -2
- package/hooks/core/useGridLocaleText.d.ts +2 -2
- package/hooks/core/useGridLoggerFactory.d.ts +2 -2
- package/hooks/core/useGridRefs.d.ts +2 -2
- package/hooks/core/useGridStateInitialization.d.ts +2 -2
- package/hooks/features/clipboard/useGridClipboard.d.ts +2 -2
- package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +2 -2
- package/hooks/features/columnMenu/useGridColumnMenu.d.ts +2 -2
- package/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
- package/hooks/features/columnResize/useGridColumnResize.d.ts +2 -2
- package/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/hooks/features/columns/gridColumnsUtils.d.ts +4 -4
- package/hooks/features/columns/useGridColumnSpanning.d.ts +2 -2
- package/hooks/features/columns/useGridColumns.d.ts +2 -2
- package/hooks/features/columns/useGridColumns.js +7 -3
- package/hooks/features/density/useGridDensity.d.ts +2 -2
- package/hooks/features/dimensions/useGridDimensions.d.ts +2 -2
- package/hooks/features/dimensions/useGridDimensions.js +7 -11
- package/hooks/features/editing/gridEditingSelectors.d.ts +6 -0
- package/hooks/features/editing/gridEditingSelectors.js +7 -1
- package/hooks/features/editing/index.d.ts +1 -1
- package/hooks/features/editing/index.js +1 -1
- package/hooks/features/editing/useGridCellEditing.d.ts +2 -2
- package/hooks/features/editing/useGridCellEditing.js +3 -3
- package/hooks/features/editing/useGridEditing.d.ts +2 -2
- package/hooks/features/editing/useGridRowEditing.d.ts +2 -2
- package/hooks/features/editing/useGridRowEditing.js +5 -6
- package/hooks/features/events/useGridEvents.d.ts +2 -2
- package/hooks/features/export/serializers/csvSerializer.d.ts +2 -1
- package/hooks/features/export/useGridCsvExport.d.ts +2 -2
- package/hooks/features/export/useGridPrintExport.d.ts +2 -2
- package/hooks/features/export/utils.d.ts +2 -2
- package/hooks/features/filter/gridFilterUtils.d.ts +7 -7
- package/hooks/features/filter/gridFilterUtils.js +3 -3
- package/hooks/features/filter/useGridFilter.d.ts +2 -2
- package/hooks/features/focus/useGridFocus.d.ts +2 -2
- package/hooks/features/focus/useGridFocus.js +3 -2
- package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +2 -2
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +2 -2
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +24 -16
- package/hooks/features/keyboardNavigation/utils.d.ts +3 -4
- package/hooks/features/keyboardNavigation/utils.js +0 -5
- package/hooks/features/listView/useGridListView.d.ts +2 -2
- package/hooks/features/listView/useGridListView.js +2 -1
- package/hooks/features/pagination/useGridPagination.d.ts +2 -2
- package/hooks/features/pagination/useGridPaginationMeta.d.ts +2 -2
- package/hooks/features/pagination/useGridPaginationModel.d.ts +2 -2
- package/hooks/features/pagination/useGridRowCount.d.ts +2 -2
- package/hooks/features/preferencesPanel/gridPreferencePanelSelector.d.ts +1 -0
- package/hooks/features/preferencesPanel/gridPreferencePanelSelector.js +8 -1
- package/hooks/features/preferencesPanel/index.d.ts +1 -1
- package/hooks/features/preferencesPanel/index.js +1 -1
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +2 -2
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
- package/hooks/features/rowSelection/useGridRowSelection.d.ts +2 -2
- package/hooks/features/rowSelection/useGridRowSelection.js +3 -3
- package/hooks/features/rowSelection/useGridRowSelectionPreProcessors.d.ts +2 -2
- package/hooks/features/rowSelection/utils.d.ts +3 -2
- package/hooks/features/rows/gridRowSpanningUtils.d.ts +2 -2
- package/hooks/features/rows/gridRowsUtils.d.ts +4 -4
- package/hooks/features/rows/useGridParamsApi.d.ts +2 -2
- package/hooks/features/rows/useGridParamsApi.js +33 -14
- package/hooks/features/rows/useGridRowSpanning.d.ts +2 -2
- package/hooks/features/rows/useGridRowSpanning.js +94 -91
- package/hooks/features/rows/useGridRows.d.ts +2 -2
- package/hooks/features/rows/useGridRows.js +7 -8
- package/hooks/features/rows/useGridRowsMeta.d.ts +2 -2
- package/hooks/features/rows/useGridRowsMeta.js +3 -2
- package/hooks/features/rows/useGridRowsPreProcessors.d.ts +2 -2
- package/hooks/features/scroll/useGridScroll.d.ts +2 -2
- package/hooks/features/sorting/gridSortingUtils.d.ts +3 -3
- package/hooks/features/sorting/gridSortingUtils.js +2 -2
- package/hooks/features/sorting/useGridSorting.d.ts +2 -2
- package/hooks/features/statePersistence/useGridStatePersistence.d.ts +2 -2
- package/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +9 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +32 -53
- package/hooks/features/virtualization/useGridVirtualization.d.ts +2 -2
- package/hooks/utils/useGridApiContext.d.ts +2 -2
- package/hooks/utils/useGridApiEventHandler.d.ts +4 -4
- package/hooks/utils/useGridApiMethod.d.ts +2 -2
- package/hooks/utils/useGridApiRef.d.ts +2 -2
- package/hooks/utils/useGridApiRef.js +3 -1
- package/hooks/utils/useGridInitializeState.d.ts +3 -3
- package/hooks/utils/useGridLogger.d.ts +2 -2
- package/hooks/utils/useGridNativeEventListener.d.ts +2 -1
- package/hooks/utils/useGridPrivateApiContext.d.ts +2 -1
- package/hooks/utils/useGridSelector.d.ts +3 -3
- package/hooks/utils/useGridVisibleRows.d.ts +3 -3
- package/index.js +1 -1
- package/locales/faIR.js +5 -6
- package/models/api/gridApiCommon.d.ts +2 -2
- package/models/api/gridParamsApi.d.ts +29 -2
- package/models/api/index.d.ts +1 -1
- package/models/api/index.js +0 -1
- package/models/colDef/gridColDef.d.ts +9 -8
- package/models/gridExport.d.ts +2 -2
- package/models/gridFilterOperator.d.ts +2 -1
- package/models/props/DataGridProps.d.ts +2 -1
- package/modern/DataGrid/DataGrid.js +1 -7
- package/modern/components/GridRow.js +25 -19
- package/modern/components/cell/GridCell.js +29 -52
- package/modern/components/columnHeaders/GridColumnHeaderFilterIconButton.js +21 -7
- package/modern/components/containers/GridRootStyles.js +135 -37
- package/modern/components/panel/GridPanel.js +2 -1
- package/modern/components/toolbar/GridToolbarColumnsButton.js +8 -2
- package/modern/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/modern/components/toolbar/GridToolbarExportContainer.js +2 -2
- package/modern/components/toolbar/GridToolbarFilterButton.js +8 -2
- package/modern/components/virtualization/GridMainContainer.js +10 -2
- package/modern/components/virtualization/GridVirtualScrollbar.js +5 -5
- package/modern/components/virtualization/GridVirtualScroller.js +18 -5
- package/modern/components/virtualization/GridVirtualScrollerContent.js +11 -2
- package/modern/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
- package/modern/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/modern/hooks/features/columns/useGridColumns.js +7 -3
- package/modern/hooks/features/dimensions/useGridDimensions.js +7 -11
- package/modern/hooks/features/editing/gridEditingSelectors.js +7 -1
- package/modern/hooks/features/editing/index.js +1 -1
- package/modern/hooks/features/editing/useGridCellEditing.js +3 -3
- package/modern/hooks/features/editing/useGridRowEditing.js +5 -6
- package/modern/hooks/features/filter/gridFilterUtils.js +3 -3
- package/modern/hooks/features/focus/useGridFocus.js +3 -2
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +24 -16
- package/modern/hooks/features/keyboardNavigation/utils.js +0 -5
- package/modern/hooks/features/listView/useGridListView.js +2 -1
- package/modern/hooks/features/preferencesPanel/gridPreferencePanelSelector.js +8 -1
- package/modern/hooks/features/preferencesPanel/index.js +1 -1
- package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +3 -3
- package/modern/hooks/features/rows/useGridParamsApi.js +33 -14
- package/modern/hooks/features/rows/useGridRowSpanning.js +94 -91
- package/modern/hooks/features/rows/useGridRows.js +7 -8
- package/modern/hooks/features/rows/useGridRowsMeta.js +3 -2
- package/modern/hooks/features/sorting/gridSortingUtils.js +2 -2
- package/modern/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +32 -53
- package/modern/hooks/utils/useGridApiRef.js +3 -1
- package/modern/index.js +1 -1
- package/modern/locales/faIR.js +5 -6
- package/modern/models/api/index.js +0 -1
- package/modern/utils/isJSDOM.js +1 -0
- package/modern/utils/roundToDecimalPlaces.js +3 -0
- package/modern/utils/utils.js +6 -1
- package/node/DataGrid/DataGrid.js +1 -7
- package/node/components/GridRow.js +22 -16
- package/node/components/cell/GridCell.js +27 -50
- package/node/components/columnHeaders/GridColumnHeaderFilterIconButton.js +20 -6
- package/node/components/containers/GridRootStyles.js +135 -37
- package/node/components/panel/GridPanel.js +2 -1
- package/node/components/toolbar/GridToolbarColumnsButton.js +8 -2
- package/node/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/node/components/toolbar/GridToolbarExportContainer.js +2 -2
- package/node/components/toolbar/GridToolbarFilterButton.js +8 -2
- package/node/components/virtualization/GridMainContainer.js +10 -2
- package/node/components/virtualization/GridVirtualScrollbar.js +5 -5
- package/node/components/virtualization/GridVirtualScroller.js +18 -5
- package/node/components/virtualization/GridVirtualScrollerContent.js +11 -2
- package/node/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
- package/node/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/node/hooks/features/columns/useGridColumns.js +7 -3
- package/node/hooks/features/dimensions/useGridDimensions.js +9 -13
- package/node/hooks/features/editing/gridEditingSelectors.js +8 -2
- package/node/hooks/features/editing/index.js +7 -11
- package/node/hooks/features/editing/useGridCellEditing.js +2 -2
- package/node/hooks/features/editing/useGridRowEditing.js +3 -4
- package/node/hooks/features/filter/gridFilterUtils.js +3 -3
- package/node/hooks/features/focus/useGridFocus.js +3 -2
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +24 -15
- package/node/hooks/features/keyboardNavigation/utils.js +0 -6
- package/node/hooks/features/listView/useGridListView.js +2 -1
- package/node/hooks/features/preferencesPanel/gridPreferencePanelSelector.js +9 -2
- package/node/hooks/features/preferencesPanel/index.js +11 -10
- package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
- package/node/hooks/features/rowSelection/useGridRowSelection.js +2 -2
- package/node/hooks/features/rows/useGridParamsApi.js +33 -14
- package/node/hooks/features/rows/useGridRowSpanning.js +92 -89
- package/node/hooks/features/rows/useGridRows.js +7 -8
- package/node/hooks/features/rows/useGridRowsMeta.js +5 -4
- package/node/hooks/features/sorting/gridSortingUtils.js +2 -2
- package/node/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +34 -55
- package/node/hooks/utils/useGridApiRef.js +3 -1
- package/node/index.js +1 -1
- package/node/locales/faIR.js +5 -6
- package/node/models/api/index.js +0 -11
- package/node/utils/isJSDOM.js +7 -0
- package/node/utils/roundToDecimalPlaces.js +9 -0
- package/node/utils/utils.js +8 -1
- package/package.json +2 -2
- package/utils/createSelector.d.ts +3 -3
- package/utils/getPublicApiRef.d.ts +2 -1
- package/utils/isJSDOM.d.ts +1 -0
- package/utils/isJSDOM.js +1 -0
- package/utils/roundToDecimalPlaces.d.ts +1 -0
- package/utils/roundToDecimalPlaces.js +3 -0
- package/utils/utils.d.ts +1 -0
- package/utils/utils.js +6 -1
|
@@ -36,7 +36,10 @@ var _useGridVirtualization = require("./useGridVirtualization");
|
|
|
36
36
|
var _gridRowSpanningSelectors = require("../rows/gridRowSpanningSelectors");
|
|
37
37
|
var _gridListViewSelectors = require("../listView/gridListViewSelectors");
|
|
38
38
|
var _gridRowsUtils = require("../rows/gridRowsUtils");
|
|
39
|
+
var _columns = require("../columns");
|
|
39
40
|
var _gridFocusedVirtualCellSelector = require("./gridFocusedVirtualCellSelector");
|
|
41
|
+
var _roundToDecimalPlaces = require("../../../utils/roundToDecimalPlaces");
|
|
42
|
+
var _isJSDOM = require("../../../utils/isJSDOM");
|
|
40
43
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
41
44
|
const MINIMUM_COLUMN_WIDTH = 50;
|
|
42
45
|
var ScrollDirection = /*#__PURE__*/function (ScrollDirection) {
|
|
@@ -56,14 +59,6 @@ const createScrollCache = (isRtl, rowBufferPx, columnBufferPx, verticalBuffer, h
|
|
|
56
59
|
direction: ScrollDirection.NONE,
|
|
57
60
|
buffer: bufferForDirection(isRtl, ScrollDirection.NONE, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer)
|
|
58
61
|
});
|
|
59
|
-
let isJSDOM = false;
|
|
60
|
-
try {
|
|
61
|
-
if (typeof window !== 'undefined') {
|
|
62
|
-
isJSDOM = /jsdom|HappyDOM/.test(window.navigator.userAgent);
|
|
63
|
-
}
|
|
64
|
-
} catch (_) {
|
|
65
|
-
/* ignore */
|
|
66
|
-
}
|
|
67
62
|
const useGridVirtualScroller = () => {
|
|
68
63
|
const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
|
|
69
64
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
@@ -71,22 +66,18 @@ const useGridVirtualScroller = () => {
|
|
|
71
66
|
unstable_listView: listView
|
|
72
67
|
} = rootProps;
|
|
73
68
|
const visibleColumns = (0, _useGridSelector.useGridSelector)(apiRef, () => listView ? [(0, _gridListViewSelectors.gridListColumnSelector)(apiRef.current.state)] : (0, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector)(apiRef));
|
|
74
|
-
const enabledForRows = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridVirtualizationRowEnabledSelector) && !isJSDOM;
|
|
75
|
-
const enabledForColumns = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridVirtualizationColumnEnabledSelector) && !isJSDOM;
|
|
69
|
+
const enabledForRows = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridVirtualizationRowEnabledSelector) && !_isJSDOM.isJSDOM;
|
|
70
|
+
const enabledForColumns = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridVirtualizationColumnEnabledSelector) && !_isJSDOM.isJSDOM;
|
|
76
71
|
const dimensions = (0, _useGridSelector.useGridSelector)(apiRef, _gridDimensionsSelectors.gridDimensionsSelector);
|
|
77
72
|
const outerSize = dimensions.viewportOuterSize;
|
|
78
73
|
const pinnedRows = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridPinnedRowsSelector);
|
|
79
|
-
const pinnedColumnDefinitions = (0,
|
|
80
|
-
const pinnedColumns = listView ?
|
|
81
|
-
left: [],
|
|
82
|
-
right: []
|
|
83
|
-
} : pinnedColumnDefinitions;
|
|
74
|
+
const pinnedColumnDefinitions = (0, _gridColumnsSelector.gridVisiblePinnedColumnDefinitionsSelector)(apiRef);
|
|
75
|
+
const pinnedColumns = listView ? _columns.EMPTY_PINNED_COLUMN_FIELDS : pinnedColumnDefinitions;
|
|
84
76
|
const hasBottomPinnedRows = pinnedRows.bottom.length > 0;
|
|
85
77
|
const [panels, setPanels] = React.useState(EMPTY_DETAIL_PANELS);
|
|
86
78
|
const isRtl = (0, _RtlProvider.useRtl)();
|
|
87
|
-
const rowsMeta = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsMetaSelector.gridRowsMetaSelector);
|
|
88
79
|
const selectedRowsLookup = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowSelectionSelector.selectedIdsLookupSelector);
|
|
89
|
-
const currentPage = (0, _useGridVisibleRows.useGridVisibleRows)(apiRef
|
|
80
|
+
const currentPage = (0, _useGridVisibleRows.useGridVisibleRows)(apiRef);
|
|
90
81
|
const mainRef = apiRef.current.mainElementRef;
|
|
91
82
|
const scrollerRef = apiRef.current.virtualScrollerRef;
|
|
92
83
|
const scrollbarVerticalRef = apiRef.current.virtualScrollbarVerticalRef;
|
|
@@ -102,7 +93,10 @@ const useGridVirtualScroller = () => {
|
|
|
102
93
|
return undefined;
|
|
103
94
|
}
|
|
104
95
|
const initialRect = node.getBoundingClientRect();
|
|
105
|
-
let lastSize =
|
|
96
|
+
let lastSize = {
|
|
97
|
+
width: (0, _roundToDecimalPlaces.roundToDecimalPlaces)(initialRect.width, 1),
|
|
98
|
+
height: (0, _roundToDecimalPlaces.roundToDecimalPlaces)(initialRect.height, 1)
|
|
99
|
+
};
|
|
106
100
|
if (!previousSize.current || lastSize.width !== previousSize.current.width && lastSize.height !== previousSize.current.height) {
|
|
107
101
|
previousSize.current = lastSize;
|
|
108
102
|
apiRef.current.publishEvent('resize', lastSize);
|
|
@@ -115,7 +109,10 @@ const useGridVirtualScroller = () => {
|
|
|
115
109
|
if (!entry) {
|
|
116
110
|
return;
|
|
117
111
|
}
|
|
118
|
-
const newSize =
|
|
112
|
+
const newSize = {
|
|
113
|
+
width: (0, _roundToDecimalPlaces.roundToDecimalPlaces)(entry.contentRect.width, 1),
|
|
114
|
+
height: (0, _roundToDecimalPlaces.roundToDecimalPlaces)(entry.contentRect.height, 1)
|
|
115
|
+
};
|
|
119
116
|
if (newSize.width === lastSize.width && newSize.height === lastSize.height) {
|
|
120
117
|
return;
|
|
121
118
|
}
|
|
@@ -183,9 +180,13 @@ const useGridVirtualScroller = () => {
|
|
|
183
180
|
if (!scroller) {
|
|
184
181
|
return undefined;
|
|
185
182
|
}
|
|
183
|
+
const maxScrollTop = Math.ceil(dimensions.minimumSize.height - dimensions.viewportOuterSize.height);
|
|
184
|
+
const maxScrollLeft = Math.ceil(dimensions.minimumSize.width - dimensions.viewportInnerSize.width);
|
|
185
|
+
|
|
186
|
+
// Clamp the scroll position to the viewport to avoid re-calculating the render context for scroll bounce
|
|
186
187
|
const newScroll = {
|
|
187
|
-
top: scroller.scrollTop,
|
|
188
|
-
left: scroller.scrollLeft
|
|
188
|
+
top: (0, _utils3.clamp)(scroller.scrollTop, 0, maxScrollTop),
|
|
189
|
+
left: isRtl ? (0, _utils3.clamp)(scroller.scrollLeft, -maxScrollLeft, 0) : (0, _utils3.clamp)(scroller.scrollLeft, 0, maxScrollLeft)
|
|
189
190
|
};
|
|
190
191
|
const dx = newScroll.left - scrollPosition.current.left;
|
|
191
192
|
const dy = newScroll.top - scrollPosition.current.top;
|
|
@@ -238,34 +239,15 @@ const useGridVirtualScroller = () => {
|
|
|
238
239
|
frozenContext.current = undefined;
|
|
239
240
|
updateRenderContext(nextRenderContext);
|
|
240
241
|
};
|
|
241
|
-
const handleScroll = (0, _utils.unstable_useEventCallback)(
|
|
242
|
+
const handleScroll = (0, _utils.unstable_useEventCallback)(() => {
|
|
242
243
|
if (ignoreNextScrollEvent.current) {
|
|
243
244
|
ignoreNextScrollEvent.current = false;
|
|
244
245
|
return;
|
|
245
246
|
}
|
|
246
|
-
const {
|
|
247
|
-
scrollTop,
|
|
248
|
-
scrollLeft
|
|
249
|
-
} = event.currentTarget;
|
|
250
|
-
|
|
251
|
-
// On iOS and macOS, negative offsets are possible when swiping past the start
|
|
252
|
-
if (scrollTop < 0) {
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
if (!isRtl) {
|
|
256
|
-
if (scrollLeft < 0) {
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
if (isRtl) {
|
|
261
|
-
if (scrollLeft > 0) {
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
247
|
const nextRenderContext = triggerUpdateRenderContext();
|
|
266
248
|
apiRef.current.publishEvent('scrollPositionChange', {
|
|
267
|
-
top:
|
|
268
|
-
left:
|
|
249
|
+
top: scrollPosition.current.top,
|
|
250
|
+
left: scrollPosition.current.left,
|
|
269
251
|
renderContext: nextRenderContext
|
|
270
252
|
});
|
|
271
253
|
});
|
|
@@ -387,7 +369,6 @@ const useGridVirtualScroller = () => {
|
|
|
387
369
|
rowId: id,
|
|
388
370
|
index: rowIndex,
|
|
389
371
|
selected: isSelected,
|
|
390
|
-
offsetTop: params.rows ? undefined : rowsMeta.positions[rowIndexInPage],
|
|
391
372
|
offsetLeft: offsetLeft,
|
|
392
373
|
columnsTotalWidth: dimensions.columnsTotalWidth,
|
|
393
374
|
rowHeight: baseRowHeight,
|
|
@@ -545,11 +526,13 @@ const useGridVirtualScroller = () => {
|
|
|
545
526
|
}),
|
|
546
527
|
getScrollbarVerticalProps: () => ({
|
|
547
528
|
ref: scrollbarVerticalRef,
|
|
548
|
-
role: 'presentation'
|
|
529
|
+
role: 'presentation',
|
|
530
|
+
scrollPosition
|
|
549
531
|
}),
|
|
550
532
|
getScrollbarHorizontalProps: () => ({
|
|
551
533
|
ref: scrollbarHorizontalRef,
|
|
552
|
-
role: 'presentation'
|
|
534
|
+
role: 'presentation',
|
|
535
|
+
scrollPosition
|
|
553
536
|
})
|
|
554
537
|
};
|
|
555
538
|
};
|
|
@@ -592,6 +575,11 @@ function computeRenderContext(inputs, scrollPosition, scrollCache) {
|
|
|
592
575
|
firstColumnIndex: 0,
|
|
593
576
|
lastColumnIndex: inputs.visibleColumns.length
|
|
594
577
|
};
|
|
578
|
+
if (inputs.listView) {
|
|
579
|
+
return (0, _extends2.default)({}, renderContext, {
|
|
580
|
+
lastColumnIndex: 1
|
|
581
|
+
});
|
|
582
|
+
}
|
|
595
583
|
const {
|
|
596
584
|
top,
|
|
597
585
|
left
|
|
@@ -843,13 +831,4 @@ function bufferForDirection(isRtl, direction, rowBufferPx, columnBufferPx, verti
|
|
|
843
831
|
// eslint unable to figure out enum exhaustiveness
|
|
844
832
|
throw new Error('unreachable');
|
|
845
833
|
}
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
// Round to avoid issues with subpixel rendering
|
|
849
|
-
// https://github.com/mui/mui-x/issues/15721
|
|
850
|
-
function roundDimensions(dimensions) {
|
|
851
|
-
return {
|
|
852
|
-
width: Math.round(dimensions.width * 10) / 10,
|
|
853
|
-
height: Math.round(dimensions.height * 10) / 10
|
|
854
|
-
};
|
|
855
834
|
}
|
|
@@ -9,5 +9,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
/**
|
|
10
10
|
* Hook that instantiate a [[GridApiRef]].
|
|
11
11
|
*/
|
|
12
|
-
const useGridApiRef = () =>
|
|
12
|
+
const useGridApiRef = () =>
|
|
13
|
+
// TODO v8: initialize with null (see https://github.com/mui/mui-x/issues/16135#issuecomment-2589395230 and https://github.com/mui/mui-x/issues/16000#issuecomment-2567820735)
|
|
14
|
+
React.useRef({});
|
|
13
15
|
exports.useGridApiRef = useGridApiRef;
|
package/node/index.js
CHANGED
package/node/locales/faIR.js
CHANGED
|
@@ -40,8 +40,7 @@ const faIRGrid = {
|
|
|
40
40
|
columnsManagementNoColumns: 'بدون سطر',
|
|
41
41
|
columnsManagementShowHideAllText: 'نمایش/مخفی کردن همه',
|
|
42
42
|
columnsManagementReset: 'بازنشانی',
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
columnsManagementDeleteIconLabel: 'پاک کردن',
|
|
45
44
|
// Filter panel text
|
|
46
45
|
filterPanelAddFilter: 'افزودن فیلتر',
|
|
47
46
|
filterPanelRemoveAll: 'حذف همه',
|
|
@@ -55,9 +54,9 @@ const faIRGrid = {
|
|
|
55
54
|
filterPanelInputPlaceholder: 'فیلتر مقدار',
|
|
56
55
|
// Filter operators text
|
|
57
56
|
filterOperatorContains: 'شامل',
|
|
58
|
-
|
|
57
|
+
filterOperatorDoesNotContain: 'شامل نمیشود',
|
|
59
58
|
filterOperatorEquals: 'مساوی',
|
|
60
|
-
|
|
59
|
+
filterOperatorDoesNotEqual: 'برابر نیست',
|
|
61
60
|
filterOperatorStartsWith: 'شروع با',
|
|
62
61
|
filterOperatorEndsWith: 'پایان با',
|
|
63
62
|
filterOperatorIs: 'هست',
|
|
@@ -77,9 +76,9 @@ const faIRGrid = {
|
|
|
77
76
|
'filterOperator<=': '<=',
|
|
78
77
|
// Header filter operators text
|
|
79
78
|
headerFilterOperatorContains: 'شامل',
|
|
80
|
-
|
|
79
|
+
headerFilterOperatorDoesNotContain: 'شامل نمیشود',
|
|
81
80
|
headerFilterOperatorEquals: 'مساوی',
|
|
82
|
-
|
|
81
|
+
headerFilterOperatorDoesNotEqual: 'برابر نیست',
|
|
83
82
|
headerFilterOperatorStartsWith: 'شروع با',
|
|
84
83
|
headerFilterOperatorEndsWith: 'پایان با',
|
|
85
84
|
headerFilterOperatorIs: 'هست',
|
package/node/models/api/index.js
CHANGED
|
@@ -3,17 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var _gridParamsApi = require("./gridParamsApi");
|
|
7
|
-
Object.keys(_gridParamsApi).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _gridParamsApi[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _gridParamsApi[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
6
|
var _gridColumnApi = require("./gridColumnApi");
|
|
18
7
|
Object.keys(_gridColumnApi).forEach(function (key) {
|
|
19
8
|
if (key === "default" || key === "__esModule") return;
|
package/node/utils/utils.js
CHANGED
|
@@ -14,6 +14,7 @@ exports.isNumber = isNumber;
|
|
|
14
14
|
exports.isObject = isObject;
|
|
15
15
|
exports.localStorageAvailable = localStorageAvailable;
|
|
16
16
|
exports.range = range;
|
|
17
|
+
exports.runIf = void 0;
|
|
17
18
|
function isNumber(value) {
|
|
18
19
|
return typeof value === 'number' && !Number.isNaN(value);
|
|
19
20
|
}
|
|
@@ -213,4 +214,10 @@ function deepClone(obj) {
|
|
|
213
214
|
* of a `eslint-disable-next-line react-hooks/exhaustive-deps` because
|
|
214
215
|
* that hint disables checks on all values instead of just one.
|
|
215
216
|
*/
|
|
216
|
-
function eslintUseValue(_) {}
|
|
217
|
+
function eslintUseValue(_) {}
|
|
218
|
+
const runIf = (condition, fn) => params => {
|
|
219
|
+
if (condition) {
|
|
220
|
+
fn(params);
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
exports.runIf = runIf;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.25.0",
|
|
4
4
|
"description": "The Community plan edition of the Data Grid components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"clsx": "^2.1.1",
|
|
43
43
|
"prop-types": "^15.8.1",
|
|
44
44
|
"reselect": "^5.1.1",
|
|
45
|
-
"@mui/x-internals": "7.
|
|
45
|
+
"@mui/x-internals": "7.25.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@emotion/react": "^11.9.0",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { Selector, SelectorResultArray } from 'reselect';
|
|
3
3
|
import type { GridCoreApi } from '../models/api/gridCoreApi';
|
|
4
4
|
export interface OutputSelector<State, Result> {
|
|
5
|
-
(apiRef:
|
|
5
|
+
(apiRef: RefObject<{
|
|
6
6
|
state: State;
|
|
7
7
|
instanceId: GridCoreApi['instanceId'];
|
|
8
8
|
}>): Result;
|
|
@@ -10,7 +10,7 @@ export interface OutputSelector<State, Result> {
|
|
|
10
10
|
acceptsApiRef: boolean;
|
|
11
11
|
}
|
|
12
12
|
export interface OutputSelectorV8<State, Args, Result> {
|
|
13
|
-
(apiRef:
|
|
13
|
+
(apiRef: RefObject<{
|
|
14
14
|
state: State;
|
|
15
15
|
instanceId: GridCoreApi['instanceId'];
|
|
16
16
|
}>, args?: Args): Result;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
1
2
|
import type { GridPrivateApiCommunity } from '../models/api/gridApiCommunity';
|
|
2
|
-
export declare function getPublicApiRef<PrivateApi extends GridPrivateApiCommunity>(apiRef:
|
|
3
|
+
export declare function getPublicApiRef<PrivateApi extends GridPrivateApiCommunity>(apiRef: RefObject<PrivateApi>): RefObject<ReturnType<PrivateApi["getPublicApi"]>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isJSDOM: boolean;
|
package/utils/isJSDOM.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const isJSDOM = typeof window !== 'undefined' && /jsdom|HappyDOM/.test(window.navigator.userAgent);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function roundToDecimalPlaces(value: number, decimals: number): number;
|
package/utils/utils.d.ts
CHANGED
|
@@ -54,3 +54,4 @@ export declare function deepClone(obj: Record<string, any>): any;
|
|
|
54
54
|
* that hint disables checks on all values instead of just one.
|
|
55
55
|
*/
|
|
56
56
|
export declare function eslintUseValue(_: any): void;
|
|
57
|
+
export declare const runIf: (condition: boolean, fn: Function) => (params: unknown) => void;
|
package/utils/utils.js
CHANGED
|
@@ -196,4 +196,9 @@ export function deepClone(obj) {
|
|
|
196
196
|
* of a `eslint-disable-next-line react-hooks/exhaustive-deps` because
|
|
197
197
|
* that hint disables checks on all values instead of just one.
|
|
198
198
|
*/
|
|
199
|
-
export function eslintUseValue(_) {}
|
|
199
|
+
export function eslintUseValue(_) {}
|
|
200
|
+
export const runIf = (condition, fn) => params => {
|
|
201
|
+
if (condition) {
|
|
202
|
+
fn(params);
|
|
203
|
+
}
|
|
204
|
+
};
|