@mui/x-data-grid 8.0.0-alpha.7 → 8.0.0-alpha.8
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 +115 -0
- package/DataGrid/DataGrid.js +4 -5
- package/DataGrid/useDataGridComponent.js +1 -1
- package/components/GridHeaders.js +2 -2
- package/components/GridRow.d.ts +5 -9
- package/components/GridRow.js +26 -78
- 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/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 +7 -0
- package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +1 -0
- package/components/panel/filterPanel/GridFilterInputBoolean.js +12 -16
- package/components/panel/filterPanel/GridFilterInputDate.d.ts +2 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +32 -29
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -1
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -1
- package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +1 -0
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +13 -17
- package/components/panel/filterPanel/GridFilterInputValue.d.ts +1 -0
- package/components/panel/filterPanel/GridFilterInputValue.js +34 -28
- package/components/panel/filterPanel/GridFilterInputValueProps.d.ts +1 -1
- package/components/virtualization/GridVirtualScrollbar.js +11 -12
- package/components/virtualization/GridVirtualScroller.js +4 -4
- package/constants/gridClasses.d.ts +12 -0
- package/constants/gridClasses.js +1 -1
- package/constants/localeTextConstants.js +1 -0
- package/context/GridContextProvider.d.ts +1 -1
- package/hooks/features/clipboard/useGridClipboard.d.ts +1 -1
- package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +1 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +5 -7
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +34 -76
- package/hooks/features/columnMenu/useGridColumnMenu.d.ts +1 -1
- package/hooks/features/columns/gridColumnsUtils.d.ts +3 -3
- package/hooks/features/columns/useGridColumnSpanning.d.ts +1 -1
- package/hooks/features/columns/useGridColumns.d.ts +1 -1
- package/hooks/features/density/useGridDensity.d.ts +1 -1
- package/hooks/features/dimensions/useGridDimensions.d.ts +1 -1
- package/hooks/features/editing/useGridCellEditing.d.ts +1 -1
- package/hooks/features/editing/useGridCellEditing.js +1 -1
- package/hooks/features/editing/useGridEditing.d.ts +1 -1
- package/hooks/features/editing/useGridRowEditing.d.ts +1 -1
- package/hooks/features/editing/useGridRowEditing.js +1 -1
- package/hooks/features/events/useGridEvents.d.ts +1 -1
- package/hooks/features/export/serializers/csvSerializer.d.ts +1 -1
- package/hooks/features/export/useGridCsvExport.d.ts +1 -1
- package/hooks/features/export/useGridPrintExport.d.ts +1 -1
- package/hooks/features/export/utils.d.ts +1 -1
- package/hooks/features/filter/gridFilterSelector.d.ts +1 -1
- package/hooks/features/filter/gridFilterSelector.js +6 -1
- package/hooks/features/filter/gridFilterUtils.d.ts +6 -6
- package/hooks/features/filter/gridFilterUtils.js +3 -3
- package/hooks/features/filter/useGridFilter.d.ts +1 -1
- package/hooks/features/focus/useGridFocus.d.ts +1 -1
- package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +1 -1
- package/hooks/features/keyboardNavigation/utils.d.ts +2 -2
- package/hooks/features/listView/useGridListView.d.ts +1 -1
- package/hooks/features/pagination/gridPaginationInterfaces.d.ts +3 -0
- package/hooks/features/pagination/gridPaginationSelector.d.ts +21 -2
- package/hooks/features/pagination/gridPaginationSelector.js +39 -1
- package/hooks/features/pagination/useGridPagination.d.ts +2 -2
- package/hooks/features/pagination/useGridPagination.js +5 -3
- package/hooks/features/pagination/useGridPaginationMeta.d.ts +1 -1
- package/hooks/features/pagination/useGridPaginationModel.d.ts +1 -1
- package/hooks/features/pagination/useGridPaginationModel.js +23 -1
- package/hooks/features/pagination/useGridRowCount.d.ts +1 -1
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.d.ts +1 -1
- package/hooks/features/rowSelection/utils.d.ts +2 -2
- package/hooks/features/rows/gridRowSpanningUtils.d.ts +1 -1
- package/hooks/features/rows/gridRowsSelector.js +1 -1
- package/hooks/features/rows/gridRowsUtils.d.ts +3 -3
- package/hooks/features/rows/useGridParamsApi.d.ts +1 -1
- package/hooks/features/rows/useGridRowSpanning.d.ts +1 -1
- package/hooks/features/rows/useGridRows.d.ts +1 -1
- package/hooks/features/rows/useGridRows.js +2 -2
- package/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
- package/hooks/features/scroll/useGridScroll.d.ts +1 -1
- package/hooks/features/sorting/gridSortingUtils.d.ts +2 -2
- package/hooks/features/sorting/gridSortingUtils.js +2 -2
- package/hooks/features/sorting/useGridSorting.d.ts +1 -1
- package/hooks/features/statePersistence/useGridStatePersistence.d.ts +1 -1
- 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 +91 -42
- package/hooks/features/virtualization/useGridVirtualization.d.ts +1 -1
- package/hooks/utils/useGridApiContext.d.ts +1 -1
- package/hooks/utils/useGridApiEventHandler.d.ts +3 -3
- package/hooks/utils/useGridNativeEventListener.d.ts +1 -1
- package/hooks/utils/useGridPrivateApiContext.d.ts +1 -1
- package/hooks/utils/useGridSelector.d.ts +1 -1
- package/hooks/utils/useGridVisibleRows.d.ts +7 -5
- 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/arSD.js +2 -0
- package/locales/beBY.js +1 -0
- package/locales/bgBG.js +2 -0
- package/locales/csCZ.js +2 -0
- package/locales/daDK.js +2 -0
- package/locales/deDE.js +2 -0
- package/locales/elGR.js +2 -0
- package/locales/esES.js +2 -0
- package/locales/faIR.js +2 -0
- package/locales/fiFI.js +2 -0
- package/locales/frFR.js +2 -0
- package/locales/heIL.js +2 -0
- package/locales/hrHR.js +2 -0
- package/locales/huHU.js +2 -0
- package/locales/isIS.js +2 -0
- package/locales/itIT.js +2 -0
- package/locales/jaJP.js +2 -0
- package/locales/koKR.js +2 -0
- package/locales/nbNO.js +2 -0
- package/locales/nlNL.js +2 -0
- package/locales/nnNO.js +2 -0
- package/locales/plPL.js +2 -0
- package/locales/ptBR.js +2 -0
- package/locales/ptPT.js +2 -0
- package/locales/roRO.js +2 -0
- package/locales/ruRU.js +2 -0
- package/locales/skSK.js +2 -0
- package/locales/svSE.js +2 -0
- package/locales/trTR.js +2 -0
- package/locales/ukUA.js +2 -0
- package/locales/urPK.js +2 -0
- package/locales/viVN.js +2 -0
- package/locales/zhCN.js +2 -0
- package/locales/zhHK.js +2 -0
- package/locales/zhTW.js +2 -0
- package/material/index.js +2 -1
- package/models/api/gridLocaleTextApi.d.ts +1 -0
- package/models/colDef/gridColDef.d.ts +8 -8
- package/models/events/gridEventLookup.d.ts +6 -1
- package/models/gridExport.d.ts +1 -1
- package/models/gridFilterOperator.d.ts +1 -1
- package/models/gridIconSlotsComponent.d.ts +5 -0
- package/models/gridStateCommunity.d.ts +4 -0
- 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 +26 -78
- 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/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 +7 -0
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +12 -16
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +32 -29
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +13 -17
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +34 -28
- package/modern/components/virtualization/GridVirtualScrollbar.js +11 -12
- package/modern/components/virtualization/GridVirtualScroller.js +4 -4
- package/modern/constants/gridClasses.js +1 -1
- package/modern/constants/localeTextConstants.js +1 -0
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +34 -76
- package/modern/hooks/features/editing/useGridCellEditing.js +1 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +1 -1
- 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/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 +91 -42
- 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/arSD.js +2 -0
- package/modern/locales/beBY.js +1 -0
- package/modern/locales/bgBG.js +2 -0
- package/modern/locales/csCZ.js +2 -0
- package/modern/locales/daDK.js +2 -0
- package/modern/locales/deDE.js +2 -0
- package/modern/locales/elGR.js +2 -0
- package/modern/locales/esES.js +2 -0
- package/modern/locales/faIR.js +2 -0
- package/modern/locales/fiFI.js +2 -0
- package/modern/locales/frFR.js +2 -0
- package/modern/locales/heIL.js +2 -0
- package/modern/locales/hrHR.js +2 -0
- package/modern/locales/huHU.js +2 -0
- package/modern/locales/isIS.js +2 -0
- package/modern/locales/itIT.js +2 -0
- package/modern/locales/jaJP.js +2 -0
- package/modern/locales/koKR.js +2 -0
- package/modern/locales/nbNO.js +2 -0
- package/modern/locales/nlNL.js +2 -0
- package/modern/locales/nnNO.js +2 -0
- package/modern/locales/plPL.js +2 -0
- package/modern/locales/ptBR.js +2 -0
- package/modern/locales/ptPT.js +2 -0
- package/modern/locales/roRO.js +2 -0
- package/modern/locales/ruRU.js +2 -0
- package/modern/locales/skSK.js +2 -0
- package/modern/locales/svSE.js +2 -0
- package/modern/locales/trTR.js +2 -0
- package/modern/locales/ukUA.js +2 -0
- package/modern/locales/urPK.js +2 -0
- package/modern/locales/viVN.js +2 -0
- package/modern/locales/zhCN.js +2 -0
- package/modern/locales/zhHK.js +2 -0
- package/modern/locales/zhTW.js +2 -0
- package/modern/material/index.js +2 -1
- package/modern/utils/cellBorderUtils.js +5 -5
- package/modern/utils/domUtils.js +7 -2
- 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 +25 -77
- 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/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 +7 -0
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +12 -16
- package/node/components/panel/filterPanel/GridFilterInputDate.js +31 -28
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +13 -17
- package/node/components/panel/filterPanel/GridFilterInputValue.js +33 -27
- package/node/components/virtualization/GridVirtualScrollbar.js +11 -12
- package/node/components/virtualization/GridVirtualScroller.js +4 -4
- package/node/constants/gridClasses.js +1 -1
- package/node/constants/localeTextConstants.js +1 -0
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +32 -74
- package/node/hooks/features/editing/useGridCellEditing.js +1 -1
- package/node/hooks/features/editing/useGridRowEditing.js +1 -1
- 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/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 +91 -42
- 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/arSD.js +2 -0
- package/node/locales/beBY.js +1 -0
- package/node/locales/bgBG.js +2 -0
- package/node/locales/csCZ.js +2 -0
- package/node/locales/daDK.js +2 -0
- package/node/locales/deDE.js +2 -0
- package/node/locales/elGR.js +2 -0
- package/node/locales/esES.js +2 -0
- package/node/locales/faIR.js +2 -0
- package/node/locales/fiFI.js +2 -0
- package/node/locales/frFR.js +2 -0
- package/node/locales/heIL.js +2 -0
- package/node/locales/hrHR.js +2 -0
- package/node/locales/huHU.js +2 -0
- package/node/locales/isIS.js +2 -0
- package/node/locales/itIT.js +2 -0
- package/node/locales/jaJP.js +2 -0
- package/node/locales/koKR.js +2 -0
- package/node/locales/nbNO.js +2 -0
- package/node/locales/nlNL.js +2 -0
- package/node/locales/nnNO.js +2 -0
- package/node/locales/plPL.js +2 -0
- package/node/locales/ptBR.js +2 -0
- package/node/locales/ptPT.js +2 -0
- package/node/locales/roRO.js +2 -0
- package/node/locales/ruRU.js +2 -0
- package/node/locales/skSK.js +2 -0
- package/node/locales/svSE.js +2 -0
- package/node/locales/trTR.js +2 -0
- package/node/locales/ukUA.js +2 -0
- package/node/locales/urPK.js +2 -0
- package/node/locales/viVN.js +2 -0
- package/node/locales/zhCN.js +2 -0
- package/node/locales/zhHK.js +2 -0
- package/node/locales/zhTW.js +2 -0
- package/node/material/index.js +2 -1
- package/node/utils/cellBorderUtils.js +5 -5
- package/node/utils/domUtils.js +7 -2
- 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 +1 -1
- package/utils/domUtils.js +7 -2
- package/utils/getPublicApiRef.d.ts +1 -1
- package/utils/rtlFlipSide.d.ts +2 -0
- package/utils/rtlFlipSide.js +22 -0
|
@@ -14,7 +14,7 @@ var _utils = require("@mui/utils");
|
|
|
14
14
|
var _useTimeout = require("../../../hooks/utils/useTimeout");
|
|
15
15
|
var _useGridRootProps = require("../../../hooks/utils/useGridRootProps");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "tabIndex", "disabled", "isFilterActive", "clearButton", "InputProps", "variant"];
|
|
17
|
+
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "tabIndex", "disabled", "isFilterActive", "clearButton", "headerFilterMenu", "InputProps", "variant"];
|
|
18
18
|
function GridFilterInputValue(props) {
|
|
19
19
|
const {
|
|
20
20
|
item,
|
|
@@ -25,8 +25,9 @@ function GridFilterInputValue(props) {
|
|
|
25
25
|
tabIndex,
|
|
26
26
|
disabled,
|
|
27
27
|
clearButton,
|
|
28
|
+
headerFilterMenu,
|
|
28
29
|
InputProps,
|
|
29
|
-
variant = '
|
|
30
|
+
variant = 'outlined'
|
|
30
31
|
} = props,
|
|
31
32
|
others = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
32
33
|
const filterTimeout = (0, _useTimeout.useTimeout)();
|
|
@@ -53,31 +54,35 @@ function GridFilterInputValue(props) {
|
|
|
53
54
|
setFilterValueState(sanitizeFilterItemValue(item.value));
|
|
54
55
|
}
|
|
55
56
|
}, [id, item]);
|
|
56
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}, InputProps
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
57
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
58
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseTextField, (0, _extends2.default)({
|
|
59
|
+
id: id,
|
|
60
|
+
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
61
|
+
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
62
|
+
value: filterValueState ?? '',
|
|
63
|
+
onChange: onFilterChange,
|
|
64
|
+
variant: variant,
|
|
65
|
+
type: type || 'text',
|
|
66
|
+
disabled: disabled,
|
|
67
|
+
InputProps: (0, _extends2.default)({
|
|
68
|
+
endAdornment: applying ? /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseInputAdornment, {
|
|
69
|
+
position: "end",
|
|
70
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.loadIcon, {
|
|
71
|
+
fontSize: "small",
|
|
72
|
+
color: "action"
|
|
73
|
+
})
|
|
74
|
+
}) : null
|
|
75
|
+
}, InputProps, {
|
|
76
|
+
inputProps: (0, _extends2.default)({
|
|
77
|
+
tabIndex
|
|
78
|
+
}, InputProps?.inputProps)
|
|
79
|
+
}),
|
|
80
|
+
InputLabelProps: {
|
|
81
|
+
shrink: true
|
|
82
|
+
},
|
|
83
|
+
inputRef: focusElementRef
|
|
84
|
+
}, rootProps.slotProps?.baseTextField, others)), headerFilterMenu, clearButton]
|
|
85
|
+
});
|
|
81
86
|
}
|
|
82
87
|
function sanitizeFilterItemValue(value) {
|
|
83
88
|
if (value == null || value === '') {
|
|
@@ -96,6 +101,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
|
|
|
96
101
|
applyValue: _propTypes.default.func.isRequired,
|
|
97
102
|
clearButton: _propTypes.default.node,
|
|
98
103
|
focusElementRef: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
104
|
+
headerFilterMenu: _propTypes.default.node,
|
|
99
105
|
/**
|
|
100
106
|
* It is `true` if the filter either has a value or an operator with no value
|
|
101
107
|
* required is selected (for example `isEmpty`)
|
|
@@ -29,6 +29,9 @@ const Scrollbar = (0, _system.styled)('div')({
|
|
|
29
29
|
position: 'absolute',
|
|
30
30
|
display: 'inline-block',
|
|
31
31
|
zIndex: 6,
|
|
32
|
+
'&:hover': {
|
|
33
|
+
zIndex: 7
|
|
34
|
+
},
|
|
32
35
|
// In macOS Safari and Gnome Web, scrollbars are overlaid and don't affect the layout. So we consider
|
|
33
36
|
// their size to be 0px throughout all the calculations, but the floating scrollbar container does need
|
|
34
37
|
// to appear and have a real size. We set it to 14px because it seems like an acceptable value and we
|
|
@@ -110,19 +113,15 @@ const GridVirtualScrollbar = exports.GridVirtualScrollbar = (0, _forwardRef.forw
|
|
|
110
113
|
(0, _useOnMount.useOnMount)(() => {
|
|
111
114
|
const scroller = apiRef.current.virtualScrollerRef.current;
|
|
112
115
|
const scrollbar = scrollbarRef.current;
|
|
113
|
-
|
|
114
|
-
capture: true
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
const options = {
|
|
117
|
+
capture: true,
|
|
118
|
+
passive: true
|
|
119
|
+
};
|
|
120
|
+
scroller.addEventListener('scroll', onScrollerScroll, options);
|
|
121
|
+
scrollbar.addEventListener('scroll', onScrollbarScroll, options);
|
|
119
122
|
return () => {
|
|
120
|
-
scroller.removeEventListener('scroll', onScrollerScroll,
|
|
121
|
-
|
|
122
|
-
});
|
|
123
|
-
scrollbar.removeEventListener('scroll', onScrollbarScroll, {
|
|
124
|
-
capture: true
|
|
125
|
-
});
|
|
123
|
+
scroller.removeEventListener('scroll', onScrollerScroll, options);
|
|
124
|
+
scrollbar.removeEventListener('scroll', onScrollbarScroll, options);
|
|
126
125
|
};
|
|
127
126
|
});
|
|
128
127
|
React.useEffect(() => {
|
|
@@ -108,10 +108,10 @@ function GridVirtualScroller(props) {
|
|
|
108
108
|
virtualScroller: virtualScroller
|
|
109
109
|
})
|
|
110
110
|
})]
|
|
111
|
-
})), dimensions.
|
|
112
|
-
position: "vertical"
|
|
113
|
-
}, getScrollbarVerticalProps())), dimensions.hasScrollX && !rootProps.unstable_listView && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridVirtualScrollbar.GridVirtualScrollbar, (0, _extends2.default)({
|
|
111
|
+
})), dimensions.hasScrollX && !rootProps.unstable_listView && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridVirtualScrollbar.GridVirtualScrollbar, (0, _extends2.default)({
|
|
114
112
|
position: "horizontal"
|
|
115
|
-
}, getScrollbarHorizontalProps())),
|
|
113
|
+
}, getScrollbarHorizontalProps())), dimensions.hasScrollY && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridVirtualScrollbar.GridVirtualScrollbar, (0, _extends2.default)({
|
|
114
|
+
position: "vertical"
|
|
115
|
+
}, getScrollbarVerticalProps())), props.children]
|
|
116
116
|
}));
|
|
117
117
|
}
|
|
@@ -9,4 +9,4 @@ var _utils = require("@mui/utils");
|
|
|
9
9
|
function getDataGridUtilityClass(slot) {
|
|
10
10
|
return (0, _utils.unstable_generateUtilityClass)('MuiDataGrid', slot);
|
|
11
11
|
}
|
|
12
|
-
const gridClasses = exports.gridClasses = (0, _utils.unstable_generateUtilityClasses)('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', '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', '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', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementSearchInput', 'columnsManagementFooter', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', '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--hasSkeletonLoadingOverlay', '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', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'row--borderBottom', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--borderBottom', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'toolbarPromptControl', 'toolbarPromptControl--recording', 'toolbarPromptControlRecordingIndicator', 'toolbarPromptControlRecordButton', 'toolbarPromptControlSendButton', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'groupingCriteriaCellLoadingContainer', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
12
|
+
const gridClasses = exports.gridClasses = (0, _utils.unstable_generateUtilityClasses)('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', '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', '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', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', '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--hasSkeletonLoadingOverlay', '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', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'row--borderBottom', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--borderBottom', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'toolbarPromptControl', 'toolbarPromptControl--recording', 'toolbarPromptControlRecordingIndicator', 'toolbarPromptControlRecordButton', 'toolbarPromptControlSendButton', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'groupingCriteriaCellLoadingContainer', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
@@ -104,6 +104,7 @@ const GRID_DEFAULT_LOCALE_TEXT = exports.GRID_DEFAULT_LOCALE_TEXT = {
|
|
|
104
104
|
'headerFilterOperator>=': 'Greater than or equal to',
|
|
105
105
|
'headerFilterOperator<': 'Less than',
|
|
106
106
|
'headerFilterOperator<=': 'Less than or equal to',
|
|
107
|
+
headerFilterClear: 'Clear filter',
|
|
107
108
|
// Filter values text
|
|
108
109
|
filterValueAny: 'any',
|
|
109
110
|
filterValueTrue: 'true',
|
|
@@ -10,7 +10,6 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
12
12
|
var _styles = require("@mui/material/styles");
|
|
13
|
-
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
14
13
|
var _utils = require("../../utils");
|
|
15
14
|
var _useGridRootProps = require("../../utils/useGridRootProps");
|
|
16
15
|
var _useGridPrivateApiContext = require("../../utils/useGridPrivateApiContext");
|
|
@@ -26,6 +25,8 @@ var _GridScrollbarFillerCell = require("../../../components/GridScrollbarFillerC
|
|
|
26
25
|
var _getPinnedCellOffset = require("../../../internals/utils/getPinnedCellOffset");
|
|
27
26
|
var _GridColumnHeaderSeparator = require("../../../components/columnHeaders/GridColumnHeaderSeparator");
|
|
28
27
|
var _gridClasses = require("../../../constants/gridClasses");
|
|
28
|
+
var _cellBorderUtils = require("../../../utils/cellBorderUtils");
|
|
29
|
+
var _constants = require("../../../internals/constants");
|
|
29
30
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
30
31
|
const GridColumnHeaderRow = exports.GridColumnHeaderRow = (0, _styles.styled)('div', {
|
|
31
32
|
name: 'MuiDataGrid',
|
|
@@ -52,10 +53,8 @@ const useGridColumnHeaders = props => {
|
|
|
52
53
|
const [dragCol, setDragCol] = React.useState('');
|
|
53
54
|
const [resizeCol, setResizeCol] = React.useState('');
|
|
54
55
|
const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
|
|
55
|
-
const isRtl = (0, _RtlProvider.useRtl)();
|
|
56
56
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
57
57
|
const dimensions = (0, _utils.useGridSelector)(apiRef, _dimensions.gridDimensionsSelector);
|
|
58
|
-
const hasColumnVirtualization = (0, _utils.useGridSelector)(apiRef, _virtualization.gridVirtualizationColumnEnabledSelector);
|
|
59
58
|
const columnGroupsModel = (0, _utils.useGridSelector)(apiRef, _gridColumnGroupsSelector.gridColumnGroupsUnwrappedModelSelector);
|
|
60
59
|
const columnPositions = (0, _utils.useGridSelector)(apiRef, _columns.gridColumnPositionsSelector);
|
|
61
60
|
const renderContext = (0, _utils.useGridSelector)(apiRef, _virtualization.gridRenderContextColumnsSelector);
|
|
@@ -92,18 +91,10 @@ const useGridColumnHeaders = props => {
|
|
|
92
91
|
// Helper for computation common between getColumnHeaders and getColumnGroupHeaders
|
|
93
92
|
const getColumnsToRender = params => {
|
|
94
93
|
const {
|
|
95
|
-
renderContext: currentContext = renderContext
|
|
96
|
-
maxLastColumn = visibleColumns.length
|
|
94
|
+
renderContext: currentContext = renderContext
|
|
97
95
|
} = params || {};
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (!rootProps.disableVirtualization && !hasColumnVirtualization) {
|
|
101
|
-
firstColumnToRender = 0;
|
|
102
|
-
lastColumnToRender = maxLastColumn;
|
|
103
|
-
} else {
|
|
104
|
-
firstColumnToRender = currentContext.firstColumnIndex;
|
|
105
|
-
lastColumnToRender = currentContext.lastColumnIndex;
|
|
106
|
-
}
|
|
96
|
+
const firstColumnToRender = currentContext.firstColumnIndex;
|
|
97
|
+
const lastColumnToRender = currentContext.lastColumnIndex;
|
|
107
98
|
const renderedColumns = visibleColumns.slice(firstColumnToRender, lastColumnToRender);
|
|
108
99
|
return {
|
|
109
100
|
renderedColumns,
|
|
@@ -112,7 +103,7 @@ const useGridColumnHeaders = props => {
|
|
|
112
103
|
};
|
|
113
104
|
};
|
|
114
105
|
const getFillers = (params, children, leftOverflow, borderBottom = false) => {
|
|
115
|
-
const isPinnedRight = params?.position ===
|
|
106
|
+
const isPinnedRight = params?.position === _constants.PinnedColumnPosition.RIGHT;
|
|
116
107
|
const isNotPinned = params?.position === undefined;
|
|
117
108
|
const hasScrollbarFiller = pinnedColumns.right.length > 0 && isPinnedRight || pinnedColumns.right.length === 0 && isNotPinned;
|
|
118
109
|
const leftOffsetWidth = offsetLeft - leftOverflow;
|
|
@@ -133,33 +124,6 @@ const useGridColumnHeaders = props => {
|
|
|
133
124
|
})]
|
|
134
125
|
});
|
|
135
126
|
};
|
|
136
|
-
const getCellOffsetStyle = ({
|
|
137
|
-
pinnedPosition,
|
|
138
|
-
columnIndex,
|
|
139
|
-
computedWidth
|
|
140
|
-
}) => {
|
|
141
|
-
let style;
|
|
142
|
-
const isLeftPinned = pinnedPosition === _columns.GridPinnedColumnPosition.LEFT;
|
|
143
|
-
const isRightPinned = pinnedPosition === _columns.GridPinnedColumnPosition.RIGHT;
|
|
144
|
-
if (isLeftPinned || isRightPinned) {
|
|
145
|
-
const pinnedOffset = (0, _getPinnedCellOffset.getPinnedCellOffset)(pinnedPosition, computedWidth, columnIndex, columnPositions, dimensions);
|
|
146
|
-
let side = isLeftPinned ? 'left' : 'right';
|
|
147
|
-
if (isRtl) {
|
|
148
|
-
side = isLeftPinned ? 'right' : 'left';
|
|
149
|
-
}
|
|
150
|
-
if (pinnedPosition === 'left') {
|
|
151
|
-
style = {
|
|
152
|
-
[side]: pinnedOffset
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
if (pinnedPosition === 'right') {
|
|
156
|
-
style = {
|
|
157
|
-
[side]: pinnedOffset
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return style;
|
|
162
|
-
};
|
|
163
127
|
const getColumnHeaders = (params, other = {}) => {
|
|
164
128
|
const {
|
|
165
129
|
renderedColumns,
|
|
@@ -174,14 +138,15 @@ const useGridColumnHeaders = props => {
|
|
|
174
138
|
const hasFocus = columnHeaderFocus !== null && columnHeaderFocus.field === colDef.field;
|
|
175
139
|
const open = columnMenuState.open && columnMenuState.field === colDef.field;
|
|
176
140
|
const pinnedPosition = params?.position;
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
computedWidth: colDef.computedWidth
|
|
181
|
-
});
|
|
182
|
-
const siblingWithBorderingSeparator = pinnedPosition === _columns.GridPinnedColumnPosition.RIGHT ? renderedColumns[i - 1] : renderedColumns[i + 1];
|
|
141
|
+
const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
|
|
142
|
+
const pinnedOffset = (0, _getPinnedCellOffset.getPinnedCellOffset)(pinnedPosition, colDef.computedWidth, columnIndex, columnPositions, dimensions.columnsTotalWidth, scrollbarWidth);
|
|
143
|
+
const siblingWithBorderingSeparator = pinnedPosition === _constants.PinnedColumnPosition.RIGHT ? renderedColumns[i - 1] : renderedColumns[i + 1];
|
|
183
144
|
const isSiblingFocused = siblingWithBorderingSeparator ? columnHeaderFocus !== null && columnHeaderFocus.field === siblingWithBorderingSeparator.field : false;
|
|
184
145
|
const isLastUnpinned = columnIndex + 1 === columnPositions.length - pinnedColumns.right.length;
|
|
146
|
+
const indexInSection = i;
|
|
147
|
+
const sectionLength = renderedColumns.length;
|
|
148
|
+
const showLeftBorder = (0, _cellBorderUtils.shouldCellShowLeftBorder)(pinnedPosition, indexInSection);
|
|
149
|
+
const showRightBorder = (0, _cellBorderUtils.shouldCellShowRightBorder)(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
|
|
185
150
|
columns.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_GridColumnHeaderItem.GridColumnHeaderItem, (0, _extends2.default)({}, sortColumnLookup[colDef.field], {
|
|
186
151
|
columnMenuOpen: open,
|
|
187
152
|
filterItemsCounter: filterColumnLookup[colDef.field] && filterColumnLookup[colDef.field].length,
|
|
@@ -194,12 +159,11 @@ const useGridColumnHeaders = props => {
|
|
|
194
159
|
hasFocus: hasFocus,
|
|
195
160
|
tabIndex: tabIndex,
|
|
196
161
|
pinnedPosition: pinnedPosition,
|
|
197
|
-
|
|
198
|
-
indexInSection: i,
|
|
199
|
-
sectionLength: renderedColumns.length,
|
|
200
|
-
gridHasFiller: gridHasFiller,
|
|
162
|
+
pinnedOffset: pinnedOffset,
|
|
201
163
|
isLastUnpinned: isLastUnpinned,
|
|
202
|
-
isSiblingFocused: isSiblingFocused
|
|
164
|
+
isSiblingFocused: isSiblingFocused,
|
|
165
|
+
showLeftBorder: showLeftBorder,
|
|
166
|
+
showRightBorder: showRightBorder
|
|
203
167
|
}, other), colDef.field));
|
|
204
168
|
}
|
|
205
169
|
return getFillers(params, columns, 0);
|
|
@@ -211,18 +175,15 @@ const useGridColumnHeaders = props => {
|
|
|
211
175
|
ownerState: rootProps,
|
|
212
176
|
className: _gridClasses.gridClasses['row--borderBottom'],
|
|
213
177
|
children: [leftRenderContext && getColumnHeaders({
|
|
214
|
-
position:
|
|
215
|
-
renderContext: leftRenderContext
|
|
216
|
-
maxLastColumn: leftRenderContext.lastColumnIndex
|
|
178
|
+
position: _constants.PinnedColumnPosition.LEFT,
|
|
179
|
+
renderContext: leftRenderContext
|
|
217
180
|
}, {
|
|
218
181
|
disableReorder: true
|
|
219
182
|
}), getColumnHeaders({
|
|
220
|
-
renderContext
|
|
221
|
-
maxLastColumn: visibleColumns.length - pinnedColumns.right.length
|
|
183
|
+
renderContext
|
|
222
184
|
}), rightRenderContext && getColumnHeaders({
|
|
223
|
-
position:
|
|
224
|
-
renderContext: rightRenderContext
|
|
225
|
-
maxLastColumn: rightRenderContext.lastColumnIndex
|
|
185
|
+
position: _constants.PinnedColumnPosition.RIGHT,
|
|
186
|
+
renderContext: rightRenderContext
|
|
226
187
|
}, {
|
|
227
188
|
disableReorder: true,
|
|
228
189
|
separatorSide: _GridColumnHeaderSeparator.GridColumnHeaderSeparatorSides.Left
|
|
@@ -281,14 +242,11 @@ const useGridColumnHeaders = props => {
|
|
|
281
242
|
tabIndex
|
|
282
243
|
};
|
|
283
244
|
const pinnedPosition = params.position;
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
columnIndex,
|
|
287
|
-
computedWidth: headerInfo.width
|
|
288
|
-
});
|
|
245
|
+
const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
|
|
246
|
+
const pinnedOffset = (0, _getPinnedCellOffset.getPinnedCellOffset)(pinnedPosition, headerInfo.width, columnIndex, columnPositions, dimensions.columnsTotalWidth, scrollbarWidth);
|
|
289
247
|
columnIndex += columnFields.length;
|
|
290
248
|
let indexInSection = index;
|
|
291
|
-
if (pinnedPosition ===
|
|
249
|
+
if (pinnedPosition === _constants.PinnedColumnPosition.LEFT) {
|
|
292
250
|
// Group headers can expand to multiple columns, we need to adjust the index
|
|
293
251
|
indexInSection = columnIndex - 1;
|
|
294
252
|
}
|
|
@@ -304,10 +262,9 @@ const useGridColumnHeaders = props => {
|
|
|
304
262
|
hasFocus: hasFocus,
|
|
305
263
|
tabIndex: tabIndex,
|
|
306
264
|
pinnedPosition: pinnedPosition,
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
gridHasFiller: gridHasFiller
|
|
265
|
+
pinnedOffset: pinnedOffset,
|
|
266
|
+
showLeftBorder: (0, _cellBorderUtils.shouldCellShowLeftBorder)(pinnedPosition, indexInSection),
|
|
267
|
+
showRightBorder: (0, _cellBorderUtils.shouldCellShowRightBorder)(pinnedPosition, indexInSection, visibleColumnGroupHeader.length, rootProps.showCellVerticalBorder, gridHasFiller)
|
|
311
268
|
}, index);
|
|
312
269
|
});
|
|
313
270
|
return getFillers(params, children, leftOverflow);
|
|
@@ -325,7 +282,7 @@ const useGridColumnHeaders = props => {
|
|
|
325
282
|
children: [leftRenderContext && getColumnGroupHeaders({
|
|
326
283
|
depth,
|
|
327
284
|
params: {
|
|
328
|
-
position:
|
|
285
|
+
position: _constants.PinnedColumnPosition.LEFT,
|
|
329
286
|
renderContext: leftRenderContext,
|
|
330
287
|
maxLastColumn: leftRenderContext.lastColumnIndex
|
|
331
288
|
}
|
|
@@ -337,7 +294,7 @@ const useGridColumnHeaders = props => {
|
|
|
337
294
|
}), rightRenderContext && getColumnGroupHeaders({
|
|
338
295
|
depth,
|
|
339
296
|
params: {
|
|
340
|
-
position:
|
|
297
|
+
position: _constants.PinnedColumnPosition.RIGHT,
|
|
341
298
|
renderContext: rightRenderContext,
|
|
342
299
|
maxLastColumn: rightRenderContext.lastColumnIndex
|
|
343
300
|
}
|
|
@@ -352,11 +309,12 @@ const useGridColumnHeaders = props => {
|
|
|
352
309
|
rightRenderContext,
|
|
353
310
|
pinnedColumns,
|
|
354
311
|
visibleColumns,
|
|
355
|
-
|
|
312
|
+
columnPositions,
|
|
356
313
|
getFillers,
|
|
357
314
|
getColumnHeadersRow,
|
|
358
315
|
getColumnsToRender,
|
|
359
316
|
getColumnGroupHeadersRows,
|
|
317
|
+
getPinnedCellOffset: _getPinnedCellOffset.getPinnedCellOffset,
|
|
360
318
|
isDragging: !!dragCol,
|
|
361
319
|
getInnerProps: () => ({
|
|
362
320
|
role: 'rowgroup'
|
|
@@ -346,7 +346,7 @@ const useGridCellEditing = (apiRef, props) => {
|
|
|
346
346
|
if (onProcessRowUpdateError) {
|
|
347
347
|
onProcessRowUpdateError(errorThrown);
|
|
348
348
|
} else if (process.env.NODE_ENV !== 'production') {
|
|
349
|
-
(0, _warning.warnOnce)(['MUI X: A call to `processRowUpdate` threw an error which was not handled because `onProcessRowUpdateError` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError` prop, for example `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see https://mui.com/x/react-data-grid/editing
|
|
349
|
+
(0, _warning.warnOnce)(['MUI X: A call to `processRowUpdate` threw an error which was not handled because `onProcessRowUpdateError` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError` prop, for example `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see https://mui.com/x/react-data-grid/editing/persistence/.'], 'error');
|
|
350
350
|
}
|
|
351
351
|
};
|
|
352
352
|
try {
|
|
@@ -422,7 +422,7 @@ const useGridRowEditing = (apiRef, props) => {
|
|
|
422
422
|
if (onProcessRowUpdateError) {
|
|
423
423
|
onProcessRowUpdateError(errorThrown);
|
|
424
424
|
} else if (process.env.NODE_ENV !== 'production') {
|
|
425
|
-
(0, _warning.warnOnce)(['MUI X: A call to `processRowUpdate` threw an error which was not handled because `onProcessRowUpdateError` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError` prop, for example `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see https://mui.com/x/react-data-grid/editing
|
|
425
|
+
(0, _warning.warnOnce)(['MUI X: A call to `processRowUpdate` threw an error which was not handled because `onProcessRowUpdateError` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError` prop, for example `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see https://mui.com/x/react-data-grid/editing/persistence/.'], 'error');
|
|
426
426
|
}
|
|
427
427
|
};
|
|
428
428
|
try {
|
|
@@ -55,7 +55,12 @@ const gridFilteredDescendantCountLookupSelector = exports.gridFilteredDescendant
|
|
|
55
55
|
* Does not contain the collapsed children.
|
|
56
56
|
* @category Filtering
|
|
57
57
|
*/
|
|
58
|
-
const gridExpandedSortedRowEntriesSelector = exports.gridExpandedSortedRowEntriesSelector = (0, _createSelector.createSelectorMemoized)(gridVisibleRowsLookupSelector, _gridSortingSelector.gridSortedRowEntriesSelector, (visibleRowsLookup, sortedRows
|
|
58
|
+
const gridExpandedSortedRowEntriesSelector = exports.gridExpandedSortedRowEntriesSelector = (0, _createSelector.createSelectorMemoized)(gridVisibleRowsLookupSelector, _gridSortingSelector.gridSortedRowEntriesSelector, _gridRowsSelector.gridRowMaximumTreeDepthSelector, gridFilterModelSelector, gridQuickFilterValuesSelector, (visibleRowsLookup, sortedRows, maxDepth, filterModel, quickFilterValues) => {
|
|
59
|
+
if (maxDepth < 2 && !filterModel.items.length && !quickFilterValues?.length) {
|
|
60
|
+
return sortedRows;
|
|
61
|
+
}
|
|
62
|
+
return sortedRows.filter(row => visibleRowsLookup[row.id] !== false);
|
|
63
|
+
});
|
|
59
64
|
|
|
60
65
|
/**
|
|
61
66
|
* Get the id of the rows accessible after the filtering process.
|
|
@@ -26,7 +26,7 @@ function getHasEval() {
|
|
|
26
26
|
/**
|
|
27
27
|
* Adds default values to the optional fields of a filter items.
|
|
28
28
|
* @param {GridFilterItem} item The raw filter item.
|
|
29
|
-
* @param {React.
|
|
29
|
+
* @param {React.RefObject<GridPrivateApiCommunity>} apiRef The API of the grid.
|
|
30
30
|
* @return {GridFilterItem} The clean filter item with an uniq ID and an always-defined operator.
|
|
31
31
|
* TODO: Make the typing reflect the different between GridFilterInputItem and GridFilterItem.
|
|
32
32
|
*/
|
|
@@ -144,7 +144,7 @@ let filterItemsApplierId = 1;
|
|
|
144
144
|
/**
|
|
145
145
|
* Generates a method to easily check if a row is matching the current filter model.
|
|
146
146
|
* @param {GridFilterModel} filterModel The model with which we want to filter the rows.
|
|
147
|
-
* @param {React.
|
|
147
|
+
* @param {React.RefObject<GridPrivateApiCommunity>} apiRef The API of the grid.
|
|
148
148
|
* @returns {GridAggregatedFilterItemApplier | null} A method that checks if a row is matching the current filter model. If `null`, we consider that all the rows are matching the filters.
|
|
149
149
|
*/
|
|
150
150
|
const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) => {
|
|
@@ -192,7 +192,7 @@ const shouldQuickFilterExcludeHiddenColumns = filterModel => {
|
|
|
192
192
|
/**
|
|
193
193
|
* Generates a method to easily check if a row is matching the current quick filter.
|
|
194
194
|
* @param {any[]} filterModel The model with which we want to filter the rows.
|
|
195
|
-
* @param {React.
|
|
195
|
+
* @param {React.RefObject<GridPrivateApiCommunity>} apiRef The API of the grid.
|
|
196
196
|
* @returns {GridAggregatedFilterItemApplier | null} A method that checks if a row is matching the current filter model. If `null`, we consider that all the rows are matching the filters.
|
|
197
197
|
*/
|
|
198
198
|
exports.shouldQuickFilterExcludeHiddenColumns = shouldQuickFilterExcludeHiddenColumns;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.gridPaginationSelector = exports.gridPaginationRowRangeSelector = exports.gridPaginationRowCountSelector = exports.gridPaginationModelSelector = exports.gridPaginationMetaSelector = exports.gridPaginatedVisibleSortedGridRowIdsSelector = exports.gridPaginatedVisibleSortedGridRowEntriesSelector = exports.gridPageSizeSelector = exports.gridPageSelector = exports.gridPageCountSelector = void 0;
|
|
6
|
+
exports.gridVisibleRowsSelector = exports.gridPaginationSelector = exports.gridPaginationRowRangeSelector = exports.gridPaginationRowCountSelector = exports.gridPaginationModelSelector = exports.gridPaginationMetaSelector = exports.gridPaginationEnabledClientSideSelector = exports.gridPaginatedVisibleSortedGridRowIdsSelector = exports.gridPaginatedVisibleSortedGridRowEntriesSelector = exports.gridPageSizeSelector = exports.gridPageSelector = exports.gridPageCountSelector = void 0;
|
|
7
7
|
var _createSelector = require("../../../utils/createSelector");
|
|
8
8
|
var _gridFilterSelector = require("../filter/gridFilterSelector");
|
|
9
9
|
var _gridRowsSelector = require("../rows/gridRowsSelector");
|
|
@@ -17,10 +17,16 @@ const ALL_RESULTS_PAGE_VALUE = -1;
|
|
|
17
17
|
const gridPaginationSelector = state => state.pagination;
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* Get the pagination model
|
|
21
20
|
* @category Pagination
|
|
21
|
+
* @ignore - do not document.
|
|
22
22
|
*/
|
|
23
23
|
exports.gridPaginationSelector = gridPaginationSelector;
|
|
24
|
+
const gridPaginationEnabledClientSideSelector = exports.gridPaginationEnabledClientSideSelector = (0, _createSelector.createSelector)(gridPaginationSelector, pagination => pagination.enabled && pagination.paginationMode === 'client');
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get the pagination model
|
|
28
|
+
* @category Pagination
|
|
29
|
+
*/
|
|
24
30
|
const gridPaginationModelSelector = exports.gridPaginationModelSelector = (0, _createSelector.createSelector)(gridPaginationSelector, pagination => pagination.paginationModel);
|
|
25
31
|
|
|
26
32
|
/**
|
|
@@ -57,7 +63,10 @@ const gridPageCountSelector = exports.gridPageCountSelector = (0, _createSelecto
|
|
|
57
63
|
* Get the index of the first and the last row to include in the current page if the pagination is enabled.
|
|
58
64
|
* @category Pagination
|
|
59
65
|
*/
|
|
60
|
-
const gridPaginationRowRangeSelector = exports.gridPaginationRowRangeSelector = (0, _createSelector.createSelectorMemoized)(gridPaginationModelSelector, _gridRowsSelector.gridRowTreeSelector, _gridRowsSelector.gridRowMaximumTreeDepthSelector, _gridFilterSelector.gridExpandedSortedRowEntriesSelector, _gridFilterSelector.gridFilteredSortedTopLevelRowEntriesSelector, (paginationModel, rowTree, rowTreeDepth, visibleSortedRowEntries, visibleSortedTopLevelRowEntries) => {
|
|
66
|
+
const gridPaginationRowRangeSelector = exports.gridPaginationRowRangeSelector = (0, _createSelector.createSelectorMemoized)(gridPaginationEnabledClientSideSelector, gridPaginationModelSelector, _gridRowsSelector.gridRowTreeSelector, _gridRowsSelector.gridRowMaximumTreeDepthSelector, _gridFilterSelector.gridExpandedSortedRowEntriesSelector, _gridFilterSelector.gridFilteredSortedTopLevelRowEntriesSelector, (clientSidePaginationEnabled, paginationModel, rowTree, rowTreeDepth, visibleSortedRowEntries, visibleSortedTopLevelRowEntries) => {
|
|
67
|
+
if (!clientSidePaginationEnabled) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
61
70
|
const visibleTopLevelRowCount = visibleSortedTopLevelRowEntries.length;
|
|
62
71
|
const topLevelFirstRowIndex = Math.min(paginationModel.pageSize * paginationModel.page, visibleTopLevelRowCount - 1);
|
|
63
72
|
const topLevelLastRowIndex = paginationModel.pageSize === ALL_RESULTS_PAGE_VALUE ? visibleTopLevelRowCount - 1 : Math.min(topLevelFirstRowIndex + paginationModel.pageSize - 1, visibleTopLevelRowCount - 1);
|
|
@@ -119,4 +128,33 @@ const gridPaginatedVisibleSortedGridRowIdsSelector = exports.gridPaginatedVisibl
|
|
|
119
128
|
return [];
|
|
120
129
|
}
|
|
121
130
|
return visibleSortedRowIds.slice(paginationRange.firstRowIndex, paginationRange.lastRowIndex + 1);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Get the rows, range and rowIndex lookup map after filtering and sorting.
|
|
135
|
+
* Does not contain the collapsed children.
|
|
136
|
+
* @category Pagination
|
|
137
|
+
*/
|
|
138
|
+
const gridVisibleRowsSelector = exports.gridVisibleRowsSelector = (0, _createSelector.createSelectorMemoized)(gridPaginationEnabledClientSideSelector, gridPaginationRowRangeSelector, gridPaginatedVisibleSortedGridRowEntriesSelector, _gridFilterSelector.gridExpandedSortedRowEntriesSelector, (clientPaginationEnabled, paginationRowRange, paginationRows, expandedSortedRowEntries) => {
|
|
139
|
+
if (clientPaginationEnabled) {
|
|
140
|
+
return {
|
|
141
|
+
rows: paginationRows,
|
|
142
|
+
range: paginationRowRange,
|
|
143
|
+
rowToIndexMap: paginationRows.reduce((lookup, row, index) => {
|
|
144
|
+
lookup.set(row.model, index);
|
|
145
|
+
return lookup;
|
|
146
|
+
}, new Map())
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
rows: expandedSortedRowEntries,
|
|
151
|
+
range: expandedSortedRowEntries.length === 0 ? null : {
|
|
152
|
+
firstRowIndex: 0,
|
|
153
|
+
lastRowIndex: expandedSortedRowEntries.length - 1
|
|
154
|
+
},
|
|
155
|
+
rowToIndexMap: expandedSortedRowEntries.reduce((lookup, row, index) => {
|
|
156
|
+
lookup.set(row.model, index);
|
|
157
|
+
return lookup;
|
|
158
|
+
}, new Map())
|
|
159
|
+
};
|
|
122
160
|
});
|
|
@@ -16,11 +16,13 @@ const paginationStateInitializer = (state, props) => {
|
|
|
16
16
|
const rowCount = props.rowCount ?? props.initialState?.pagination?.rowCount;
|
|
17
17
|
const meta = props.paginationMeta ?? props.initialState?.pagination?.meta ?? {};
|
|
18
18
|
return (0, _extends2.default)({}, state, {
|
|
19
|
-
pagination: {
|
|
19
|
+
pagination: (0, _extends2.default)({}, state.pagination, {
|
|
20
20
|
paginationModel,
|
|
21
21
|
rowCount,
|
|
22
|
-
meta
|
|
23
|
-
|
|
22
|
+
meta,
|
|
23
|
+
enabled: props.pagination === true,
|
|
24
|
+
paginationMode: props.paginationMode
|
|
25
|
+
})
|
|
24
26
|
});
|
|
25
27
|
};
|
|
26
28
|
|
|
@@ -164,13 +164,35 @@ const useGridPaginationModel = (apiRef, props) => {
|
|
|
164
164
|
/**
|
|
165
165
|
* EFFECTS
|
|
166
166
|
*/
|
|
167
|
+
const isFirstRender = React.useRef(true);
|
|
167
168
|
React.useEffect(() => {
|
|
169
|
+
if (isFirstRender.current) {
|
|
170
|
+
isFirstRender.current = false;
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (!props.pagination) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
168
176
|
apiRef.current.setState(state => (0, _extends2.default)({}, state, {
|
|
169
177
|
pagination: (0, _extends2.default)({}, state.pagination, {
|
|
170
178
|
paginationModel: getDerivedPaginationModel(state.pagination, props.signature, props.paginationModel)
|
|
171
179
|
})
|
|
172
180
|
}));
|
|
173
|
-
}, [apiRef, props.paginationModel, props.
|
|
181
|
+
}, [apiRef, props.paginationModel, props.signature, props.pagination]);
|
|
182
|
+
React.useEffect(() => {
|
|
183
|
+
apiRef.current.setState(state => {
|
|
184
|
+
const isEnabled = props.pagination === true;
|
|
185
|
+
if (state.pagination.paginationMode === props.paginationMode || state.pagination.enabled === isEnabled) {
|
|
186
|
+
return state;
|
|
187
|
+
}
|
|
188
|
+
return (0, _extends2.default)({}, state, {
|
|
189
|
+
pagination: (0, _extends2.default)({}, state.pagination, {
|
|
190
|
+
paginationMode: props.paginationMode,
|
|
191
|
+
enabled: props.pagination === true
|
|
192
|
+
})
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
}, [apiRef, props.paginationMode, props.pagination]);
|
|
174
196
|
React.useEffect(handleUpdateAutoPageSize, [handleUpdateAutoPageSize]);
|
|
175
197
|
};
|
|
176
198
|
exports.useGridPaginationModel = useGridPaginationModel;
|
|
@@ -21,7 +21,7 @@ const gridRowMaximumTreeDepthSelector = exports.gridRowMaximumTreeDepthSelector
|
|
|
21
21
|
if (entries.length === 0) {
|
|
22
22
|
return 1;
|
|
23
23
|
}
|
|
24
|
-
return entries.filter(([, nodeCount]) => nodeCount > 0).map(([depth]) => Number(depth)).sort((a, b) => b - a)[0] + 1;
|
|
24
|
+
return (entries.filter(([, nodeCount]) => nodeCount > 0).map(([depth]) => Number(depth)).sort((a, b) => b - a)[0] ?? 0) + 1;
|
|
25
25
|
});
|
|
26
26
|
const gridDataRowIdsSelector = exports.gridDataRowIdsSelector = (0, _createSelector.createSelector)(gridRowsStateSelector, rows => rows.dataRowIds);
|
|
27
27
|
|
|
@@ -49,7 +49,7 @@ const useGridRows = (apiRef, props) => {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
const logger = (0, _useGridLogger.useGridLogger)(apiRef, 'useGridRows');
|
|
52
|
-
const currentPage = (0, _useGridVisibleRows.
|
|
52
|
+
const currentPage = (0, _useGridVisibleRows.getVisibleRows)(apiRef);
|
|
53
53
|
const lastUpdateMs = React.useRef(Date.now());
|
|
54
54
|
const lastRowCount = React.useRef(props.rowCount);
|
|
55
55
|
const timeout = (0, _useTimeout.useTimeout)();
|
|
@@ -28,7 +28,7 @@ const isDesc = direction => direction === 'desc';
|
|
|
28
28
|
/**
|
|
29
29
|
* Transform an item of the sorting model into a method comparing two rows.
|
|
30
30
|
* @param {GridSortItem} sortItem The sort item we want to apply.
|
|
31
|
-
* @param {React.
|
|
31
|
+
* @param {React.RefObject<GridApiCommunity>} apiRef The API of the grid.
|
|
32
32
|
* @returns {GridParsedSortItem | null} The parsed sort item. Returns `null` is the sort item is not valid.
|
|
33
33
|
*/
|
|
34
34
|
const parseSortItem = (sortItem, apiRef) => {
|
|
@@ -81,7 +81,7 @@ const compareRows = (parsedSortItems, row1, row2) => {
|
|
|
81
81
|
/**
|
|
82
82
|
* Generates a method to easily sort a list of rows according to the current sort model.
|
|
83
83
|
* @param {GridSortModel} sortModel The model with which we want to sort the rows.
|
|
84
|
-
* @param {React.
|
|
84
|
+
* @param {React.RefObject<GridApiCommunity>} apiRef The API of the grid.
|
|
85
85
|
* @returns {GridSortingModelApplier | null} A method that generates a list of sorted row ids from a list of rows according to the current sort model. If `null`, we consider that the rows should remain in the order there were provided.
|
|
86
86
|
*/
|
|
87
87
|
const buildAggregatedSortingApplier = (sortModel, apiRef) => {
|