@mui/x-data-grid 7.23.6 → 7.24.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 +150 -0
- package/DataGrid/DataGrid.js +4 -5
- package/DataGrid/useDataGridComponent.d.ts +2 -1
- package/DataGrid/useDataGridComponent.js +1 -1
- package/components/GridHeaders.js +2 -2
- package/components/GridRow.d.ts +5 -9
- package/components/GridRow.js +28 -105
- package/components/GridSkeletonLoadingOverlay.js +18 -18
- package/components/cell/GridCell.d.ts +9 -16
- package/components/cell/GridCell.js +17 -35
- package/components/columnHeaders/GridColumnGroupHeader.d.ts +5 -5
- package/components/columnHeaders/GridColumnGroupHeader.js +7 -10
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.ts +3 -3
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +21 -7
- package/components/columnHeaders/GridColumnHeaderItem.d.ts +5 -5
- package/components/columnHeaders/GridColumnHeaderItem.js +13 -12
- package/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
- package/components/containers/GridRoot.d.ts +2 -2
- package/components/containers/GridRoot.js +14 -6
- package/components/containers/GridRootStyles.js +1 -0
- package/components/panel/GridPanel.js +2 -1
- package/components/panel/filterPanel/GridFilterInputValueProps.d.ts +2 -1
- package/components/toolbar/GridToolbarColumnsButton.js +6 -1
- package/components/toolbar/GridToolbarFilterButton.js +6 -1
- package/components/virtualization/GridVirtualScrollbar.js +11 -12
- package/components/virtualization/GridVirtualScroller.js +4 -4
- 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/columnHeaders/useGridColumnHeaders.d.ts +5 -7
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +34 -76
- 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 +4 -2
- 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/density/useGridDensity.d.ts +2 -2
- package/hooks/features/dimensions/useGridDimensions.d.ts +2 -2
- package/hooks/features/dimensions/useGridDimensions.js +1 -3
- package/hooks/features/editing/useGridCellEditing.d.ts +2 -2
- package/hooks/features/editing/useGridEditing.d.ts +2 -2
- package/hooks/features/editing/useGridRowEditing.d.ts +2 -2
- 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/gridFilterSelector.js +6 -1
- 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/headerFiltering/useGridHeaderFiltering.d.ts +2 -2
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +2 -2
- package/hooks/features/keyboardNavigation/utils.d.ts +3 -3
- package/hooks/features/listView/useGridListView.d.ts +2 -2
- package/hooks/features/pagination/gridPaginationInterfaces.d.ts +3 -0
- package/hooks/features/pagination/gridPaginationSelector.d.ts +20 -1
- package/hooks/features/pagination/gridPaginationSelector.js +39 -1
- package/hooks/features/pagination/useGridPagination.d.ts +3 -3
- package/hooks/features/pagination/useGridPagination.js +5 -3
- package/hooks/features/pagination/useGridPaginationMeta.d.ts +2 -2
- package/hooks/features/pagination/useGridPaginationModel.d.ts +2 -2
- package/hooks/features/pagination/useGridPaginationModel.js +23 -1
- 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/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/gridRowsSelector.js +1 -1
- package/hooks/features/rows/gridRowsUtils.d.ts +4 -4
- package/hooks/features/rows/useGridParamsApi.d.ts +2 -2
- package/hooks/features/rows/useGridRowSpanning.d.ts +2 -2
- package/hooks/features/rows/useGridRows.d.ts +2 -2
- package/hooks/features/rows/useGridRows.js +2 -2
- package/hooks/features/rows/useGridRowsMeta.d.ts +2 -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.d.ts +6 -0
- package/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +42 -0
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +2 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +92 -50
- 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 +8 -6
- package/hooks/utils/useGridVisibleRows.js +5 -28
- package/index.js +1 -1
- package/internals/constants.d.ts +6 -0
- package/internals/constants.js +8 -1
- package/internals/index.d.ts +1 -0
- package/internals/index.js +1 -0
- package/internals/utils/attachPinnedStyle.d.ts +2 -0
- package/internals/utils/attachPinnedStyle.js +9 -0
- package/internals/utils/getPinnedCellOffset.d.ts +3 -3
- package/internals/utils/getPinnedCellOffset.js +6 -7
- package/internals/utils/index.d.ts +1 -0
- package/internals/utils/index.js +2 -1
- package/locales/faIR.js +5 -6
- package/locales/urPK.js +9 -10
- package/models/colDef/gridColDef.d.ts +9 -8
- package/models/events/gridEventLookup.d.ts +6 -1
- package/models/gridExport.d.ts +2 -2
- package/models/gridFilterOperator.d.ts +2 -1
- package/models/gridStateCommunity.d.ts +4 -0
- package/models/props/DataGridProps.d.ts +2 -1
- package/modern/DataGrid/DataGrid.js +4 -5
- package/modern/DataGrid/useDataGridComponent.js +1 -1
- package/modern/components/GridHeaders.js +2 -2
- package/modern/components/GridRow.js +28 -105
- package/modern/components/GridSkeletonLoadingOverlay.js +18 -18
- package/modern/components/cell/GridCell.js +17 -35
- package/modern/components/columnHeaders/GridColumnGroupHeader.js +7 -10
- package/modern/components/columnHeaders/GridColumnHeaderFilterIconButton.js +21 -7
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +13 -12
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
- package/modern/components/containers/GridRoot.js +14 -6
- package/modern/components/containers/GridRootStyles.js +1 -0
- package/modern/components/panel/GridPanel.js +2 -1
- package/modern/components/toolbar/GridToolbarColumnsButton.js +6 -1
- package/modern/components/toolbar/GridToolbarFilterButton.js +6 -1
- package/modern/components/virtualization/GridVirtualScrollbar.js +11 -12
- package/modern/components/virtualization/GridVirtualScroller.js +4 -4
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +34 -76
- package/modern/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
- package/modern/hooks/features/columnResize/useGridColumnResize.js +4 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +1 -3
- package/modern/hooks/features/filter/gridFilterSelector.js +6 -1
- package/modern/hooks/features/filter/gridFilterUtils.js +3 -3
- package/modern/hooks/features/pagination/gridPaginationSelector.js +39 -1
- package/modern/hooks/features/pagination/useGridPagination.js +5 -3
- package/modern/hooks/features/pagination/useGridPaginationModel.js +23 -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/rows/gridRowsSelector.js +1 -1
- package/modern/hooks/features/rows/useGridRows.js +2 -2
- package/modern/hooks/features/sorting/gridSortingUtils.js +2 -2
- package/modern/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +42 -0
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +92 -50
- package/modern/hooks/utils/useGridApiRef.js +3 -1
- package/modern/hooks/utils/useGridVisibleRows.js +5 -28
- package/modern/index.js +1 -1
- package/modern/internals/constants.js +8 -1
- package/modern/internals/index.js +1 -0
- package/modern/internals/utils/attachPinnedStyle.js +9 -0
- package/modern/internals/utils/getPinnedCellOffset.js +6 -7
- package/modern/internals/utils/index.js +2 -1
- package/modern/locales/faIR.js +5 -6
- package/modern/locales/urPK.js +9 -10
- package/modern/utils/cellBorderUtils.js +5 -5
- package/modern/utils/domUtils.js +7 -2
- package/modern/utils/isJSDOM.js +1 -0
- package/modern/utils/rtlFlipSide.js +22 -0
- package/node/DataGrid/DataGrid.js +2 -3
- package/node/DataGrid/useDataGridComponent.js +1 -1
- package/node/components/GridHeaders.js +2 -2
- package/node/components/GridRow.js +27 -104
- package/node/components/GridSkeletonLoadingOverlay.js +17 -17
- package/node/components/cell/GridCell.js +18 -36
- package/node/components/columnHeaders/GridColumnGroupHeader.js +7 -10
- package/node/components/columnHeaders/GridColumnHeaderFilterIconButton.js +20 -6
- package/node/components/columnHeaders/GridColumnHeaderItem.js +13 -12
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
- package/node/components/containers/GridRoot.js +14 -6
- package/node/components/containers/GridRootStyles.js +1 -0
- package/node/components/panel/GridPanel.js +2 -1
- package/node/components/toolbar/GridToolbarColumnsButton.js +6 -1
- package/node/components/toolbar/GridToolbarFilterButton.js +6 -1
- package/node/components/virtualization/GridVirtualScrollbar.js +11 -12
- package/node/components/virtualization/GridVirtualScroller.js +4 -4
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +32 -74
- package/node/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
- package/node/hooks/features/columnResize/useGridColumnResize.js +4 -2
- package/node/hooks/features/dimensions/useGridDimensions.js +3 -5
- package/node/hooks/features/filter/gridFilterSelector.js +6 -1
- package/node/hooks/features/filter/gridFilterUtils.js +3 -3
- package/node/hooks/features/pagination/gridPaginationSelector.js +41 -3
- package/node/hooks/features/pagination/useGridPagination.js +5 -3
- package/node/hooks/features/pagination/useGridPaginationModel.js +23 -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/rows/gridRowsSelector.js +1 -1
- package/node/hooks/features/rows/useGridRows.js +1 -1
- package/node/hooks/features/sorting/gridSortingUtils.js +2 -2
- package/node/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +49 -0
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +94 -52
- package/node/hooks/utils/useGridApiRef.js +3 -1
- package/node/hooks/utils/useGridVisibleRows.js +3 -28
- package/node/index.js +1 -1
- package/node/internals/constants.js +9 -2
- package/node/internals/index.js +12 -0
- package/node/internals/utils/attachPinnedStyle.js +15 -0
- package/node/internals/utils/getPinnedCellOffset.js +6 -7
- package/node/internals/utils/index.js +11 -0
- package/node/locales/faIR.js +5 -6
- package/node/locales/urPK.js +9 -10
- package/node/utils/cellBorderUtils.js +5 -5
- package/node/utils/domUtils.js +7 -2
- package/node/utils/isJSDOM.js +7 -0
- package/node/utils/rtlFlipSide.js +29 -0
- package/package.json +2 -2
- package/utils/cellBorderUtils.d.ts +3 -3
- package/utils/cellBorderUtils.js +5 -5
- package/utils/createSelector.d.ts +3 -3
- package/utils/domUtils.js +7 -2
- package/utils/getPublicApiRef.d.ts +2 -1
- package/utils/isJSDOM.d.ts +1 -0
- package/utils/isJSDOM.js +1 -0
- package/utils/rtlFlipSide.d.ts +2 -0
- package/utils/rtlFlipSide.js +22 -0
package/modern/locales/faIR.js
CHANGED
|
@@ -34,8 +34,7 @@ const faIRGrid = {
|
|
|
34
34
|
columnsManagementNoColumns: 'بدون سطر',
|
|
35
35
|
columnsManagementShowHideAllText: 'نمایش/مخفی کردن همه',
|
|
36
36
|
columnsManagementReset: 'بازنشانی',
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
columnsManagementDeleteIconLabel: 'پاک کردن',
|
|
39
38
|
// Filter panel text
|
|
40
39
|
filterPanelAddFilter: 'افزودن فیلتر',
|
|
41
40
|
filterPanelRemoveAll: 'حذف همه',
|
|
@@ -49,9 +48,9 @@ const faIRGrid = {
|
|
|
49
48
|
filterPanelInputPlaceholder: 'فیلتر مقدار',
|
|
50
49
|
// Filter operators text
|
|
51
50
|
filterOperatorContains: 'شامل',
|
|
52
|
-
|
|
51
|
+
filterOperatorDoesNotContain: 'شامل نمیشود',
|
|
53
52
|
filterOperatorEquals: 'مساوی',
|
|
54
|
-
|
|
53
|
+
filterOperatorDoesNotEqual: 'برابر نیست',
|
|
55
54
|
filterOperatorStartsWith: 'شروع با',
|
|
56
55
|
filterOperatorEndsWith: 'پایان با',
|
|
57
56
|
filterOperatorIs: 'هست',
|
|
@@ -71,9 +70,9 @@ const faIRGrid = {
|
|
|
71
70
|
'filterOperator<=': '<=',
|
|
72
71
|
// Header filter operators text
|
|
73
72
|
headerFilterOperatorContains: 'شامل',
|
|
74
|
-
|
|
73
|
+
headerFilterOperatorDoesNotContain: 'شامل نمیشود',
|
|
75
74
|
headerFilterOperatorEquals: 'مساوی',
|
|
76
|
-
|
|
75
|
+
headerFilterOperatorDoesNotEqual: 'برابر نیست',
|
|
77
76
|
headerFilterOperatorStartsWith: 'شروع با',
|
|
78
77
|
headerFilterOperatorEndsWith: 'پایان با',
|
|
79
78
|
headerFilterOperatorIs: 'هست',
|
package/modern/locales/urPK.js
CHANGED
|
@@ -30,12 +30,11 @@ const urPKGrid = {
|
|
|
30
30
|
toolbarExportPrint: 'پرنٹ کریں',
|
|
31
31
|
toolbarExportExcel: 'ایکسل کے طور پر ڈاوٴنلوڈ کریں',
|
|
32
32
|
// Columns management text
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
columnsManagementSearchTitle: 'تلاش',
|
|
34
|
+
columnsManagementNoColumns: 'کوئی کالم نہیں',
|
|
35
|
+
columnsManagementShowHideAllText: 'تمام دکھائیں/چھپائیں',
|
|
36
|
+
columnsManagementReset: 'ریسیٹ',
|
|
37
|
+
columnsManagementDeleteIconLabel: 'کلئیر',
|
|
39
38
|
// Filter panel text
|
|
40
39
|
filterPanelAddFilter: 'نیا فلٹر',
|
|
41
40
|
filterPanelRemoveAll: 'سارے ختم کریں',
|
|
@@ -49,9 +48,9 @@ const urPKGrid = {
|
|
|
49
48
|
filterPanelInputPlaceholder: 'ویلیو کو فلٹر کریں',
|
|
50
49
|
// Filter operators text
|
|
51
50
|
filterOperatorContains: 'شامل ہے',
|
|
52
|
-
|
|
51
|
+
filterOperatorDoesNotContain: 'موجود نہیں ہے',
|
|
53
52
|
filterOperatorEquals: 'برابر ہے',
|
|
54
|
-
|
|
53
|
+
filterOperatorDoesNotEqual: 'برابر نہیں ہے',
|
|
55
54
|
filterOperatorStartsWith: 'شروع ہوتا ہے',
|
|
56
55
|
filterOperatorEndsWith: 'ختم ہوتا ہے',
|
|
57
56
|
filterOperatorIs: 'ہے',
|
|
@@ -71,9 +70,9 @@ const urPKGrid = {
|
|
|
71
70
|
'filterOperator<=': '<=',
|
|
72
71
|
// Header filter operators text
|
|
73
72
|
headerFilterOperatorContains: 'شامل ہے',
|
|
74
|
-
|
|
73
|
+
headerFilterOperatorDoesNotContain: 'موجود نہیں ہے',
|
|
75
74
|
headerFilterOperatorEquals: 'برابر ہے',
|
|
76
|
-
|
|
75
|
+
headerFilterOperatorDoesNotEqual: 'برابر نہیں ہے',
|
|
77
76
|
headerFilterOperatorStartsWith: 'شروع ہوتا ہے',
|
|
78
77
|
headerFilterOperatorEndsWith: 'ختم ہوتا ہے',
|
|
79
78
|
headerFilterOperatorIs: 'ہے',
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PinnedColumnPosition } from "../internals/constants.js";
|
|
2
2
|
export const shouldCellShowRightBorder = (pinnedPosition, indexInSection, sectionLength, showCellVerticalBorderRootProp, gridHasFiller) => {
|
|
3
3
|
const isSectionLastCell = indexInSection === sectionLength - 1;
|
|
4
|
-
if (pinnedPosition ===
|
|
4
|
+
if (pinnedPosition === PinnedColumnPosition.LEFT && isSectionLastCell) {
|
|
5
5
|
return true;
|
|
6
6
|
}
|
|
7
7
|
if (showCellVerticalBorderRootProp) {
|
|
8
|
-
if (pinnedPosition ===
|
|
8
|
+
if (pinnedPosition === PinnedColumnPosition.LEFT) {
|
|
9
9
|
return true;
|
|
10
10
|
}
|
|
11
|
-
if (pinnedPosition ===
|
|
11
|
+
if (pinnedPosition === PinnedColumnPosition.RIGHT) {
|
|
12
12
|
return !isSectionLastCell;
|
|
13
13
|
}
|
|
14
14
|
// pinnedPosition === undefined, middle section
|
|
@@ -17,5 +17,5 @@ export const shouldCellShowRightBorder = (pinnedPosition, indexInSection, sectio
|
|
|
17
17
|
return false;
|
|
18
18
|
};
|
|
19
19
|
export const shouldCellShowLeftBorder = (pinnedPosition, indexInSection) => {
|
|
20
|
-
return pinnedPosition ===
|
|
20
|
+
return pinnedPosition === PinnedColumnPosition.RIGHT && indexInSection === 0;
|
|
21
21
|
};
|
package/modern/utils/domUtils.js
CHANGED
|
@@ -153,7 +153,7 @@ const findPinnedHeaders = ({
|
|
|
153
153
|
const elements = [];
|
|
154
154
|
api.columnHeadersContainerRef.current.querySelectorAll(`.${gridClasses[position === 'left' ? 'columnHeader--pinnedLeft' : 'columnHeader--pinnedRight']}`).forEach(element => {
|
|
155
155
|
const currentColIndex = parseCellColIndex(element);
|
|
156
|
-
if (currentColIndex !== null && filterFn(currentColIndex)) {
|
|
156
|
+
if (currentColIndex !== null && filterFn(currentColIndex, element)) {
|
|
157
157
|
elements.push(element);
|
|
158
158
|
}
|
|
159
159
|
});
|
|
@@ -174,7 +174,12 @@ export function findRightPinnedHeadersBeforeCol(api, col, isRtl) {
|
|
|
174
174
|
api,
|
|
175
175
|
position: isRtl ? 'left' : 'right',
|
|
176
176
|
colIndex,
|
|
177
|
-
filterFn: index =>
|
|
177
|
+
filterFn: (index, element) => {
|
|
178
|
+
if (element.classList.contains(gridClasses['columnHeader--last'])) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
return isRtl ? index > colIndex : index < colIndex;
|
|
182
|
+
}
|
|
178
183
|
});
|
|
179
184
|
}
|
|
180
185
|
export function findGridHeader(api, field) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const isJSDOM = typeof window !== 'undefined' && /jsdom|HappyDOM/.test(window.navigator.userAgent);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PinnedColumnPosition } from "../internals/constants.js";
|
|
2
|
+
export const rtlFlipSide = (position, isRtl) => {
|
|
3
|
+
if (!position) {
|
|
4
|
+
return undefined;
|
|
5
|
+
}
|
|
6
|
+
if (!isRtl) {
|
|
7
|
+
if (position === PinnedColumnPosition.LEFT) {
|
|
8
|
+
return 'left';
|
|
9
|
+
}
|
|
10
|
+
if (position === PinnedColumnPosition.RIGHT) {
|
|
11
|
+
return 'right';
|
|
12
|
+
}
|
|
13
|
+
} else {
|
|
14
|
+
if (position === PinnedColumnPosition.LEFT) {
|
|
15
|
+
return 'right';
|
|
16
|
+
}
|
|
17
|
+
if (position === PinnedColumnPosition.RIGHT) {
|
|
18
|
+
return 'left';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return undefined;
|
|
22
|
+
};
|
|
@@ -41,13 +41,12 @@ const DataGridRaw = (0, _forwardRef.forwardRef)(function DataGrid(inProps, ref)
|
|
|
41
41
|
privateApiRef: privateApiRef,
|
|
42
42
|
configuration: configuration,
|
|
43
43
|
props: props,
|
|
44
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
44
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.GridRoot, (0, _extends2.default)({
|
|
45
45
|
className: props.className,
|
|
46
46
|
style: props.style,
|
|
47
47
|
sx: props.sx
|
|
48
48
|
}, props.forwardedProps, props.slotProps?.root, {
|
|
49
|
-
ref: ref
|
|
50
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.GridHeader, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.GridBody, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.GridFooterPlaceholder, {})]
|
|
49
|
+
ref: ref
|
|
51
50
|
}))
|
|
52
51
|
});
|
|
53
52
|
});
|
|
@@ -50,6 +50,7 @@ const useDataGridComponent = (inputApiRef, props) => {
|
|
|
50
50
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridDimensions.dimensionsStateInitializer, apiRef, props);
|
|
51
51
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridRowSelection.rowSelectionStateInitializer, apiRef, props);
|
|
52
52
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridColumns.columnsStateInitializer, apiRef, props);
|
|
53
|
+
(0, _useGridInitializeState.useGridInitializeState)(_useGridPagination.paginationStateInitializer, apiRef, props);
|
|
53
54
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridRows.rowsStateInitializer, apiRef, props);
|
|
54
55
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridEditing.editingStateInitializer, apiRef, props);
|
|
55
56
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridFocus.focusStateInitializer, apiRef, props);
|
|
@@ -59,7 +60,6 @@ const useDataGridComponent = (inputApiRef, props) => {
|
|
|
59
60
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridRowSpanning.rowSpanningStateInitializer, apiRef, props);
|
|
60
61
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridDensity.densityStateInitializer, apiRef, props);
|
|
61
62
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridColumnResize.columnResizeStateInitializer, apiRef, props);
|
|
62
|
-
(0, _useGridInitializeState.useGridInitializeState)(_useGridPagination.paginationStateInitializer, apiRef, props);
|
|
63
63
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridRowsMeta.rowsMetaStateInitializer, apiRef, props);
|
|
64
64
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridColumnMenu.columnMenuStateInitializer, apiRef, props);
|
|
65
65
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridColumnGrouping.columnGroupsStateInitializer, apiRef, props);
|
|
@@ -26,7 +26,7 @@ function GridHeaders() {
|
|
|
26
26
|
const filterColumnLookup = (0, _useGridSelector.useGridSelector)(apiRef, _gridFilterSelector.gridFilterActiveItemsLookupSelector);
|
|
27
27
|
const sortColumnLookup = (0, _useGridSelector.useGridSelector)(apiRef, _gridSortingSelector.gridSortColumnLookupSelector);
|
|
28
28
|
const columnHeaderTabIndexState = (0, _useGridSelector.useGridSelector)(apiRef, _gridFocusStateSelector.gridTabIndexColumnHeaderSelector);
|
|
29
|
-
const
|
|
29
|
+
const hasNoCellTabIndexState = (0, _useGridSelector.useGridSelector)(apiRef, () => (0, _gridFocusStateSelector.gridTabIndexCellSelector)(apiRef) === null);
|
|
30
30
|
const columnGroupHeaderTabIndexState = (0, _useGridSelector.useGridSelector)(apiRef, _gridFocusStateSelector.gridTabIndexColumnGroupHeaderSelector);
|
|
31
31
|
const columnHeaderFocus = (0, _useGridSelector.useGridSelector)(apiRef, _gridFocusStateSelector.gridFocusColumnHeaderSelector);
|
|
32
32
|
const columnGroupHeaderFocus = (0, _useGridSelector.useGridSelector)(apiRef, _gridFocusStateSelector.gridFocusColumnGroupHeaderSelector);
|
|
@@ -34,7 +34,7 @@ function GridHeaders() {
|
|
|
34
34
|
const columnMenuState = (0, _useGridSelector.useGridSelector)(apiRef, _columnMenuSelector.gridColumnMenuSelector);
|
|
35
35
|
const columnVisibility = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridColumnVisibilityModelSelector);
|
|
36
36
|
const columnGroupsHeaderStructure = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnGroupsSelector.gridColumnGroupsHeaderStructureSelector);
|
|
37
|
-
const hasOtherElementInTabSequence = !(columnGroupHeaderTabIndexState === null && columnHeaderTabIndexState === null &&
|
|
37
|
+
const hasOtherElementInTabSequence = !(columnGroupHeaderTabIndexState === null && columnHeaderTabIndexState === null && hasNoCellTabIndexState);
|
|
38
38
|
const columnsContainerRef = apiRef.current.columnHeadersContainerRef;
|
|
39
39
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.columnHeaders, (0, _extends2.default)({
|
|
40
40
|
ref: columnsContainerRef,
|
|
@@ -18,6 +18,7 @@ var _gridEditRowModel = require("../models/gridEditRowModel");
|
|
|
18
18
|
var _gridClasses = require("../constants/gridClasses");
|
|
19
19
|
var _composeGridClasses = require("../utils/composeGridClasses");
|
|
20
20
|
var _useGridRootProps = require("../hooks/utils/useGridRootProps");
|
|
21
|
+
var _cellBorderUtils = require("../utils/cellBorderUtils");
|
|
21
22
|
var _gridColumnsSelector = require("../hooks/features/columns/gridColumnsSelector");
|
|
22
23
|
var _useGridSelector = require("../hooks/utils/useGridSelector");
|
|
23
24
|
var _useGridVisibleRows = require("../hooks/utils/useGridVisibleRows");
|
|
@@ -28,35 +29,12 @@ var _constants = require("../internals/constants");
|
|
|
28
29
|
var _gridSortingSelector = require("../hooks/features/sorting/gridSortingSelector");
|
|
29
30
|
var _gridRowsSelector = require("../hooks/features/rows/gridRowsSelector");
|
|
30
31
|
var _gridEditingSelectors = require("../hooks/features/editing/gridEditingSelectors");
|
|
31
|
-
var _GridCell = require("./cell/GridCell");
|
|
32
32
|
var _GridScrollbarFillerCell = require("./GridScrollbarFillerCell");
|
|
33
33
|
var _getPinnedCellOffset = require("../internals/utils/getPinnedCellOffset");
|
|
34
34
|
var _useGridConfiguration = require("../hooks/utils/useGridConfiguration");
|
|
35
35
|
var _useGridPrivateApiContext = require("../hooks/utils/useGridPrivateApiContext");
|
|
36
|
-
var _hooks = require("../hooks");
|
|
37
36
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
38
|
-
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetTop", "offsetLeft", "
|
|
39
|
-
function EmptyCell({
|
|
40
|
-
width
|
|
41
|
-
}) {
|
|
42
|
-
if (!width) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
46
|
-
role: "presentation",
|
|
47
|
-
className: (0, _clsx.default)(_gridClasses.gridClasses.cell, _gridClasses.gridClasses.cellEmpty),
|
|
48
|
-
style: {
|
|
49
|
-
'--width': `${width}px`
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
process.env.NODE_ENV !== "production" ? EmptyCell.propTypes = {
|
|
54
|
-
// ----------------------------- Warning --------------------------------
|
|
55
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
56
|
-
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
57
|
-
// ----------------------------------------------------------------------
|
|
58
|
-
width: _propTypes.default.number.isRequired
|
|
59
|
-
} : void 0;
|
|
37
|
+
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetTop", "offsetLeft", "columnsTotalWidth", "firstColumnIndex", "lastColumnIndex", "focusedColumnIndex", "isFirstVisible", "isLastVisible", "isNotVisible", "showBottomBorder", "scrollbarWidth", "gridHasFiller", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
|
|
60
38
|
const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
61
39
|
const {
|
|
62
40
|
selected,
|
|
@@ -69,13 +47,16 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
69
47
|
visibleColumns,
|
|
70
48
|
pinnedColumns,
|
|
71
49
|
offsetLeft,
|
|
72
|
-
|
|
73
|
-
|
|
50
|
+
columnsTotalWidth,
|
|
51
|
+
firstColumnIndex,
|
|
52
|
+
lastColumnIndex,
|
|
74
53
|
focusedColumnIndex,
|
|
75
54
|
isFirstVisible,
|
|
76
55
|
isLastVisible,
|
|
77
56
|
isNotVisible,
|
|
78
57
|
showBottomBorder,
|
|
58
|
+
scrollbarWidth,
|
|
59
|
+
gridHasFiller,
|
|
79
60
|
onClick,
|
|
80
61
|
onDoubleClick,
|
|
81
62
|
onMouseEnter,
|
|
@@ -95,14 +76,11 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
95
76
|
const editRowsState = (0, _useGridSelector.useGridSelector)(apiRef, _gridEditingSelectors.gridEditRowsStateSelector);
|
|
96
77
|
const handleRef = (0, _utils.unstable_useForkRef)(ref, refProp);
|
|
97
78
|
const rowNode = apiRef.current.getRowNode(rowId);
|
|
98
|
-
const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
|
|
99
|
-
const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
|
|
100
79
|
const editing = apiRef.current.getRowMode(rowId) === _gridEditRowModel.GridRowModes.Edit;
|
|
101
80
|
const editable = rootProps.editMode === _gridEditRowModel.GridEditModes.Row;
|
|
102
|
-
const hasColumnVirtualization = (0, _useGridSelector.useGridSelector)(apiRef, _hooks.gridVirtualizationColumnEnabledSelector);
|
|
103
81
|
const hasFocusCell = focusedColumnIndex !== undefined;
|
|
104
|
-
const hasVirtualFocusCellLeft = hasFocusCell && focusedColumnIndex >= pinnedColumns.left.length && focusedColumnIndex <
|
|
105
|
-
const hasVirtualFocusCellRight = hasFocusCell && focusedColumnIndex < visibleColumns.length - pinnedColumns.right.length && focusedColumnIndex >=
|
|
82
|
+
const hasVirtualFocusCellLeft = hasFocusCell && focusedColumnIndex >= pinnedColumns.left.length && focusedColumnIndex < firstColumnIndex;
|
|
83
|
+
const hasVirtualFocusCellRight = hasFocusCell && focusedColumnIndex < visibleColumns.length - pinnedColumns.right.length && focusedColumnIndex >= lastColumnIndex;
|
|
106
84
|
const classes = (0, _composeGridClasses.composeGridClasses)(rootProps.classes, {
|
|
107
85
|
root: ['row', selected && 'selected', editable && 'row--editable', editing && 'row--editing', isFirstVisible && 'row--firstVisible', isLastVisible && 'row--lastVisible', showBottomBorder && 'row--borderBottom', rowHeight === 'auto' && 'row--dynamicHeight']
|
|
108
86
|
});
|
|
@@ -218,14 +196,14 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
218
196
|
});
|
|
219
197
|
rowClassNames.push(rootProps.getRowClassName(rowParams));
|
|
220
198
|
}
|
|
221
|
-
const getCell = (column, indexInSection, indexRelativeToAllColumns, sectionLength, pinnedPosition =
|
|
199
|
+
const getCell = (column, indexInSection, indexRelativeToAllColumns, sectionLength, pinnedPosition = _constants.PinnedColumnPosition.NONE) => {
|
|
222
200
|
const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
|
|
223
201
|
if (cellColSpanInfo?.spannedByColSpan) {
|
|
224
202
|
return null;
|
|
225
203
|
}
|
|
226
204
|
const width = cellColSpanInfo?.cellProps.width ?? column.computedWidth;
|
|
227
205
|
const colSpan = cellColSpanInfo?.cellProps.colSpan ?? 1;
|
|
228
|
-
const pinnedOffset = (0, _getPinnedCellOffset.getPinnedCellOffset)(
|
|
206
|
+
const pinnedOffset = (0, _getPinnedCellOffset.getPinnedCellOffset)(pinnedPosition, column.computedWidth, indexRelativeToAllColumns, columnPositions, columnsTotalWidth, scrollbarWidth);
|
|
229
207
|
if (rowNode?.type === 'skeletonRow') {
|
|
230
208
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(slots.skeletonCell, {
|
|
231
209
|
type: column.type,
|
|
@@ -244,7 +222,9 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
244
222
|
const canReorderColumn = !(disableColumnReorder || column.disableReorder);
|
|
245
223
|
const canReorderRow = rowReordering && !sortModel.length && treeDepth <= 1 && !isEditingRows;
|
|
246
224
|
const disableDragEvents = !(canReorderColumn || isReorderCell && canReorderRow);
|
|
247
|
-
const cellIsNotVisible = pinnedPosition ===
|
|
225
|
+
const cellIsNotVisible = pinnedPosition === _constants.PinnedColumnPosition.VIRTUAL;
|
|
226
|
+
const showLeftBorder = (0, _cellBorderUtils.shouldCellShowLeftBorder)(pinnedPosition, indexInSection);
|
|
227
|
+
const showRightBorder = (0, _cellBorderUtils.shouldCellShowRightBorder)(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
|
|
248
228
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(slots.cell, (0, _extends2.default)({
|
|
249
229
|
column: column,
|
|
250
230
|
width: width,
|
|
@@ -257,9 +237,8 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
257
237
|
isNotVisible: cellIsNotVisible,
|
|
258
238
|
pinnedOffset: pinnedOffset,
|
|
259
239
|
pinnedPosition: pinnedPosition,
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
gridHasFiller: gridHasFiller
|
|
240
|
+
showLeftBorder: showLeftBorder,
|
|
241
|
+
showRightBorder: showRightBorder
|
|
263
242
|
}, slotProps?.cell), column.field);
|
|
264
243
|
};
|
|
265
244
|
|
|
@@ -270,25 +249,16 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
270
249
|
}
|
|
271
250
|
const leftCells = pinnedColumns.left.map((column, i) => {
|
|
272
251
|
const indexRelativeToAllColumns = i;
|
|
273
|
-
return getCell(column, i, indexRelativeToAllColumns, pinnedColumns.left.length,
|
|
252
|
+
return getCell(column, i, indexRelativeToAllColumns, pinnedColumns.left.length, _constants.PinnedColumnPosition.LEFT);
|
|
274
253
|
});
|
|
275
254
|
const rightCells = pinnedColumns.right.map((column, i) => {
|
|
276
255
|
const indexRelativeToAllColumns = visibleColumns.length - pinnedColumns.right.length + i;
|
|
277
|
-
return getCell(column, i, indexRelativeToAllColumns, pinnedColumns.right.length,
|
|
256
|
+
return getCell(column, i, indexRelativeToAllColumns, pinnedColumns.right.length, _constants.PinnedColumnPosition.RIGHT);
|
|
278
257
|
});
|
|
279
258
|
const middleColumnsLength = visibleColumns.length - pinnedColumns.left.length - pinnedColumns.right.length;
|
|
280
259
|
const cells = [];
|
|
281
260
|
if (hasVirtualFocusCellLeft) {
|
|
282
|
-
cells.push(getCell(visibleColumns[focusedColumnIndex], focusedColumnIndex - pinnedColumns.left.length, focusedColumnIndex, middleColumnsLength,
|
|
283
|
-
}
|
|
284
|
-
let firstColumnIndex;
|
|
285
|
-
let lastColumnIndex;
|
|
286
|
-
if (!rootProps.disableVirtualization && !hasColumnVirtualization) {
|
|
287
|
-
firstColumnIndex = 0;
|
|
288
|
-
lastColumnIndex = visibleColumns.length;
|
|
289
|
-
} else {
|
|
290
|
-
firstColumnIndex = renderContext.firstColumnIndex;
|
|
291
|
-
lastColumnIndex = renderContext.lastColumnIndex;
|
|
261
|
+
cells.push(getCell(visibleColumns[focusedColumnIndex], focusedColumnIndex - pinnedColumns.left.length, focusedColumnIndex, middleColumnsLength, _constants.PinnedColumnPosition.VIRTUAL));
|
|
292
262
|
}
|
|
293
263
|
for (let i = firstColumnIndex; i < lastColumnIndex; i += 1) {
|
|
294
264
|
const column = visibleColumns[i];
|
|
@@ -299,7 +269,7 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
299
269
|
cells.push(getCell(column, indexInSection, i, middleColumnsLength));
|
|
300
270
|
}
|
|
301
271
|
if (hasVirtualFocusCellRight) {
|
|
302
|
-
cells.push(getCell(visibleColumns[focusedColumnIndex], focusedColumnIndex - pinnedColumns.left.length, focusedColumnIndex, middleColumnsLength,
|
|
272
|
+
cells.push(getCell(visibleColumns[focusedColumnIndex], focusedColumnIndex - pinnedColumns.left.length, focusedColumnIndex, middleColumnsLength, _constants.PinnedColumnPosition.VIRTUAL));
|
|
303
273
|
}
|
|
304
274
|
const eventHandlers = row ? {
|
|
305
275
|
onClick: publishClick,
|
|
@@ -309,8 +279,6 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
309
279
|
onMouseOut: publish('rowMouseOut', onMouseOut),
|
|
310
280
|
onMouseOver: publish('rowMouseOver', onMouseOver)
|
|
311
281
|
} : null;
|
|
312
|
-
const expandedWidth = dimensions.viewportOuterSize.width - dimensions.columnsTotalWidth - scrollbarWidth;
|
|
313
|
-
const emptyCellWidth = Math.max(0, expandedWidth);
|
|
314
282
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _extends2.default)({
|
|
315
283
|
"data-id": rowId,
|
|
316
284
|
"data-rowindex": index,
|
|
@@ -325,11 +293,9 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
325
293
|
style: {
|
|
326
294
|
width: offsetLeft
|
|
327
295
|
}
|
|
328
|
-
}), cells,
|
|
329
|
-
width: emptyCellWidth
|
|
330
|
-
}), rightCells.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
296
|
+
}), cells, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
331
297
|
role: "presentation",
|
|
332
|
-
className: _gridClasses.gridClasses.
|
|
298
|
+
className: (0, _clsx.default)(_gridClasses.gridClasses.cell, _gridClasses.gridClasses.cellEmpty)
|
|
333
299
|
}), rightCells, scrollbarWidth !== 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridScrollbarFillerCell.GridScrollbarFillerCell, {
|
|
334
300
|
pinnedRight: pinnedColumns.right.length > 0
|
|
335
301
|
})]
|
|
@@ -340,48 +306,14 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
340
306
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
341
307
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
342
308
|
// ----------------------------------------------------------------------
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
columnsTotalWidth: _propTypes.default.number.isRequired,
|
|
346
|
-
contentSize: _propTypes.default.shape({
|
|
347
|
-
height: _propTypes.default.number.isRequired,
|
|
348
|
-
width: _propTypes.default.number.isRequired
|
|
349
|
-
}).isRequired,
|
|
350
|
-
groupHeaderHeight: _propTypes.default.number.isRequired,
|
|
351
|
-
hasScrollX: _propTypes.default.bool.isRequired,
|
|
352
|
-
hasScrollY: _propTypes.default.bool.isRequired,
|
|
353
|
-
headerFilterHeight: _propTypes.default.number.isRequired,
|
|
354
|
-
headerHeight: _propTypes.default.number.isRequired,
|
|
355
|
-
headersTotalHeight: _propTypes.default.number.isRequired,
|
|
356
|
-
isReady: _propTypes.default.bool.isRequired,
|
|
357
|
-
leftPinnedWidth: _propTypes.default.number.isRequired,
|
|
358
|
-
minimumSize: _propTypes.default.shape({
|
|
359
|
-
height: _propTypes.default.number.isRequired,
|
|
360
|
-
width: _propTypes.default.number.isRequired
|
|
361
|
-
}).isRequired,
|
|
362
|
-
rightPinnedWidth: _propTypes.default.number.isRequired,
|
|
363
|
-
root: _propTypes.default.shape({
|
|
364
|
-
height: _propTypes.default.number.isRequired,
|
|
365
|
-
width: _propTypes.default.number.isRequired
|
|
366
|
-
}).isRequired,
|
|
367
|
-
rowHeight: _propTypes.default.number.isRequired,
|
|
368
|
-
rowWidth: _propTypes.default.number.isRequired,
|
|
369
|
-
scrollbarSize: _propTypes.default.number.isRequired,
|
|
370
|
-
topContainerHeight: _propTypes.default.number.isRequired,
|
|
371
|
-
viewportInnerSize: _propTypes.default.shape({
|
|
372
|
-
height: _propTypes.default.number.isRequired,
|
|
373
|
-
width: _propTypes.default.number.isRequired
|
|
374
|
-
}).isRequired,
|
|
375
|
-
viewportOuterSize: _propTypes.default.shape({
|
|
376
|
-
height: _propTypes.default.number.isRequired,
|
|
377
|
-
width: _propTypes.default.number.isRequired
|
|
378
|
-
}).isRequired
|
|
379
|
-
}).isRequired,
|
|
309
|
+
columnsTotalWidth: _propTypes.default.number.isRequired,
|
|
310
|
+
firstColumnIndex: _propTypes.default.number.isRequired,
|
|
380
311
|
/**
|
|
381
312
|
* Determines which cell has focus.
|
|
382
313
|
* If `null`, no cell in this row has focus.
|
|
383
314
|
*/
|
|
384
315
|
focusedColumnIndex: _propTypes.default.number,
|
|
316
|
+
gridHasFiller: _propTypes.default.bool.isRequired,
|
|
385
317
|
/**
|
|
386
318
|
* Index of the row in the whole sorted and filtered dataset.
|
|
387
319
|
* If some rows above have expanded children, this index also take those children into account.
|
|
@@ -390,6 +322,7 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
390
322
|
isFirstVisible: _propTypes.default.bool.isRequired,
|
|
391
323
|
isLastVisible: _propTypes.default.bool.isRequired,
|
|
392
324
|
isNotVisible: _propTypes.default.bool.isRequired,
|
|
325
|
+
lastColumnIndex: _propTypes.default.number.isRequired,
|
|
393
326
|
offsetLeft: _propTypes.default.number.isRequired,
|
|
394
327
|
offsetTop: _propTypes.default.number,
|
|
395
328
|
onClick: _propTypes.default.func,
|
|
@@ -397,22 +330,12 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
397
330
|
onMouseEnter: _propTypes.default.func,
|
|
398
331
|
onMouseLeave: _propTypes.default.func,
|
|
399
332
|
pinnedColumns: _propTypes.default.object.isRequired,
|
|
400
|
-
renderContext: _propTypes.default.shape({
|
|
401
|
-
firstColumnIndex: _propTypes.default.number.isRequired,
|
|
402
|
-
firstRowIndex: _propTypes.default.number.isRequired,
|
|
403
|
-
lastColumnIndex: _propTypes.default.number.isRequired,
|
|
404
|
-
lastRowIndex: _propTypes.default.number.isRequired
|
|
405
|
-
}).isRequired,
|
|
406
333
|
row: _propTypes.default.object.isRequired,
|
|
407
334
|
rowHeight: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number]).isRequired,
|
|
408
335
|
rowId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
336
|
+
scrollbarWidth: _propTypes.default.number.isRequired,
|
|
409
337
|
selected: _propTypes.default.bool.isRequired,
|
|
410
338
|
showBottomBorder: _propTypes.default.bool.isRequired,
|
|
411
|
-
/**
|
|
412
|
-
* Determines which cell should be tabbable by having tabIndex=0.
|
|
413
|
-
* If `null`, no cell in this row is in the tab sequence.
|
|
414
|
-
*/
|
|
415
|
-
tabbableCell: _propTypes.default.string,
|
|
416
339
|
visibleColumns: _propTypes.default.arrayOf(_propTypes.default.object).isRequired
|
|
417
340
|
} : void 0;
|
|
418
341
|
const MemoizedGridRow = exports.GridRow = (0, _fastMemo.fastMemo)(GridRow);
|
|
@@ -12,15 +12,19 @@ var _clsx = _interopRequireDefault(require("clsx"));
|
|
|
12
12
|
var _system = require("@mui/system");
|
|
13
13
|
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
14
14
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
15
|
+
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
15
16
|
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
16
17
|
var _useGridApiContext = require("../hooks/utils/useGridApiContext");
|
|
17
18
|
var _useGridRootProps = require("../hooks/utils/useGridRootProps");
|
|
18
19
|
var _hooks = require("../hooks");
|
|
20
|
+
var _constants = require("../internals/constants");
|
|
19
21
|
var _gridClasses = require("../constants/gridClasses");
|
|
20
22
|
var _getPinnedCellOffset = require("../internals/utils/getPinnedCellOffset");
|
|
21
23
|
var _cellBorderUtils = require("../utils/cellBorderUtils");
|
|
22
24
|
var _domUtils = require("../utils/domUtils");
|
|
23
25
|
var _GridScrollbarFillerCell = require("./GridScrollbarFillerCell");
|
|
26
|
+
var _rtlFlipSide = require("../utils/rtlFlipSide");
|
|
27
|
+
var _utils = require("../internals/utils");
|
|
24
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
29
|
const SkeletonOverlay = (0, _system.styled)('div', {
|
|
26
30
|
name: 'MuiDataGrid',
|
|
@@ -48,6 +52,7 @@ const GridSkeletonLoadingOverlay = exports.GridSkeletonLoadingOverlay = (0, _for
|
|
|
48
52
|
const {
|
|
49
53
|
slots
|
|
50
54
|
} = rootProps;
|
|
55
|
+
const isRtl = (0, _RtlProvider.useRtl)();
|
|
51
56
|
const classes = useUtilityClasses({
|
|
52
57
|
classes: rootProps.classes
|
|
53
58
|
});
|
|
@@ -63,18 +68,12 @@ const GridSkeletonLoadingOverlay = exports.GridSkeletonLoadingOverlay = (0, _for
|
|
|
63
68
|
const allVisibleColumns = (0, _hooks.useGridSelector)(apiRef, _hooks.gridVisibleColumnDefinitionsSelector);
|
|
64
69
|
const columns = React.useMemo(() => allVisibleColumns.slice(0, inViewportCount), [allVisibleColumns, inViewportCount]);
|
|
65
70
|
const pinnedColumns = (0, _hooks.useGridSelector)(apiRef, _hooks.gridVisiblePinnedColumnDefinitionsSelector);
|
|
66
|
-
const getPinnedStyle = React.useCallback((computedWidth, index, position) => {
|
|
67
|
-
const pinnedOffset = (0, _getPinnedCellOffset.getPinnedCellOffset)(position, computedWidth, index, positions, dimensions);
|
|
68
|
-
return {
|
|
69
|
-
[position]: pinnedOffset
|
|
70
|
-
};
|
|
71
|
-
}, [dimensions, positions]);
|
|
72
71
|
const getPinnedPosition = React.useCallback(field => {
|
|
73
72
|
if (pinnedColumns.left.findIndex(col => col.field === field) !== -1) {
|
|
74
|
-
return
|
|
73
|
+
return _constants.PinnedColumnPosition.LEFT;
|
|
75
74
|
}
|
|
76
75
|
if (pinnedColumns.right.findIndex(col => col.field === field) !== -1) {
|
|
77
|
-
return
|
|
76
|
+
return _constants.PinnedColumnPosition.RIGHT;
|
|
78
77
|
}
|
|
79
78
|
return undefined;
|
|
80
79
|
}, [pinnedColumns.left, pinnedColumns.right]);
|
|
@@ -85,13 +84,15 @@ const GridSkeletonLoadingOverlay = exports.GridSkeletonLoadingOverlay = (0, _for
|
|
|
85
84
|
for (let colIndex = 0; colIndex < columns.length; colIndex += 1) {
|
|
86
85
|
const column = columns[colIndex];
|
|
87
86
|
const pinnedPosition = getPinnedPosition(column.field);
|
|
88
|
-
const isPinnedLeft = pinnedPosition ===
|
|
89
|
-
const isPinnedRight = pinnedPosition ===
|
|
90
|
-
const
|
|
87
|
+
const isPinnedLeft = pinnedPosition === _constants.PinnedColumnPosition.LEFT;
|
|
88
|
+
const isPinnedRight = pinnedPosition === _constants.PinnedColumnPosition.RIGHT;
|
|
89
|
+
const pinnedSide = (0, _rtlFlipSide.rtlFlipSide)(pinnedPosition, isRtl);
|
|
90
|
+
const sectionLength = pinnedSide ? pinnedColumns[pinnedSide].length // pinned section
|
|
91
91
|
: columns.length - pinnedColumns.left.length - pinnedColumns.right.length; // middle section
|
|
92
|
-
const sectionIndex =
|
|
92
|
+
const sectionIndex = pinnedSide ? pinnedColumns[pinnedSide].findIndex(col => col.field === column.field) // pinned section
|
|
93
93
|
: colIndex - pinnedColumns.left.length; // middle section
|
|
94
|
-
const
|
|
94
|
+
const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
|
|
95
|
+
const pinnedStyle = (0, _utils.attachPinnedStyle)({}, isRtl, pinnedPosition, (0, _getPinnedCellOffset.getPinnedCellOffset)(pinnedPosition, column.computedWidth, colIndex, positions, dimensions.columnsTotalWidth, scrollbarWidth));
|
|
95
96
|
const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
|
|
96
97
|
const showRightBorder = (0, _cellBorderUtils.shouldCellShowRightBorder)(pinnedPosition, sectionIndex, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
|
|
97
98
|
const showLeftBorder = (0, _cellBorderUtils.shouldCellShowLeftBorder)(pinnedPosition, sectionIndex);
|
|
@@ -105,7 +106,6 @@ const GridSkeletonLoadingOverlay = exports.GridSkeletonLoadingOverlay = (0, _for
|
|
|
105
106
|
width: emptyCellWidth,
|
|
106
107
|
empty: true
|
|
107
108
|
}, `skeleton-filler-column-${i}`);
|
|
108
|
-
const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
|
|
109
109
|
const hasScrollbarFiller = isLastColumn && scrollbarWidth !== 0;
|
|
110
110
|
if (hasFillerBefore) {
|
|
111
111
|
rowCells.push(emptyCell);
|
|
@@ -137,7 +137,7 @@ const GridSkeletonLoadingOverlay = exports.GridSkeletonLoadingOverlay = (0, _for
|
|
|
137
137
|
}, `skeleton-row-${i}`));
|
|
138
138
|
}
|
|
139
139
|
return array;
|
|
140
|
-
}, [slots, columns, pinnedColumns, skeletonRowsCount, rootProps.showCellVerticalBorder, dimensions
|
|
140
|
+
}, [slots, columns, pinnedColumns, skeletonRowsCount, rootProps.showCellVerticalBorder, dimensions, positions, getPinnedPosition, isRtl]);
|
|
141
141
|
|
|
142
142
|
// Sync the column resize of the overlay columns with the grid
|
|
143
143
|
const handleColumnResize = params => {
|
|
@@ -151,8 +151,8 @@ const GridSkeletonLoadingOverlay = exports.GridSkeletonLoadingOverlay = (0, _for
|
|
|
151
151
|
}
|
|
152
152
|
const resizedColIndex = columns.findIndex(col => col.field === colDef.field);
|
|
153
153
|
const pinnedPosition = getPinnedPosition(colDef.field);
|
|
154
|
-
const isPinnedLeft = pinnedPosition ===
|
|
155
|
-
const isPinnedRight = pinnedPosition ===
|
|
154
|
+
const isPinnedLeft = pinnedPosition === _constants.PinnedColumnPosition.LEFT;
|
|
155
|
+
const isPinnedRight = pinnedPosition === _constants.PinnedColumnPosition.RIGHT;
|
|
156
156
|
const currentWidth = getComputedStyle(cells[0]).getPropertyValue('--width');
|
|
157
157
|
const delta = parseInt(currentWidth, 10) - width;
|
|
158
158
|
if (cells) {
|