@mui/x-data-grid 7.24.0 → 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 +71 -0
- package/DataGrid/useDataGridComponent.d.ts +2 -1
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.ts +3 -3
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +21 -7
- 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/context/GridContextProvider.d.ts +2 -1
- package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +2 -2
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +2 -2
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +2 -2
- package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.d.ts +2 -2
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +2 -2
- package/hooks/core/useGridApiInitialization.d.ts +2 -2
- package/hooks/core/useGridInitialization.d.ts +2 -2
- package/hooks/core/useGridIsRtl.d.ts +2 -2
- package/hooks/core/useGridLocaleText.d.ts +2 -2
- package/hooks/core/useGridLoggerFactory.d.ts +2 -2
- package/hooks/core/useGridRefs.d.ts +2 -2
- package/hooks/core/useGridStateInitialization.d.ts +2 -2
- package/hooks/features/clipboard/useGridClipboard.d.ts +2 -2
- package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +2 -2
- package/hooks/features/columnMenu/useGridColumnMenu.d.ts +2 -2
- package/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
- package/hooks/features/columnResize/useGridColumnResize.d.ts +2 -2
- package/hooks/features/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/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/useGridPagination.d.ts +2 -2
- package/hooks/features/pagination/useGridPaginationMeta.d.ts +2 -2
- package/hooks/features/pagination/useGridPaginationModel.d.ts +2 -2
- package/hooks/features/pagination/useGridRowCount.d.ts +2 -2
- package/hooks/features/preferencesPanel/gridPreferencePanelSelector.d.ts +1 -0
- package/hooks/features/preferencesPanel/gridPreferencePanelSelector.js +8 -1
- package/hooks/features/preferencesPanel/index.d.ts +1 -1
- package/hooks/features/preferencesPanel/index.js +1 -1
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +2 -2
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
- package/hooks/features/rowSelection/useGridRowSelection.d.ts +2 -2
- package/hooks/features/rowSelection/useGridRowSelectionPreProcessors.d.ts +2 -2
- package/hooks/features/rowSelection/utils.d.ts +3 -2
- package/hooks/features/rows/gridRowSpanningUtils.d.ts +2 -2
- package/hooks/features/rows/gridRowsUtils.d.ts +4 -4
- package/hooks/features/rows/useGridParamsApi.d.ts +2 -2
- package/hooks/features/rows/useGridRowSpanning.d.ts +2 -2
- package/hooks/features/rows/useGridRows.d.ts +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/useGridVirtualScroller.js +1 -8
- package/hooks/features/virtualization/useGridVirtualization.d.ts +2 -2
- package/hooks/utils/useGridApiContext.d.ts +2 -2
- package/hooks/utils/useGridApiEventHandler.d.ts +4 -4
- package/hooks/utils/useGridApiMethod.d.ts +2 -2
- package/hooks/utils/useGridApiRef.d.ts +2 -2
- package/hooks/utils/useGridApiRef.js +3 -1
- package/hooks/utils/useGridInitializeState.d.ts +3 -3
- package/hooks/utils/useGridLogger.d.ts +2 -2
- package/hooks/utils/useGridNativeEventListener.d.ts +2 -1
- package/hooks/utils/useGridPrivateApiContext.d.ts +2 -1
- package/hooks/utils/useGridSelector.d.ts +3 -3
- package/hooks/utils/useGridVisibleRows.d.ts +3 -3
- package/index.js +1 -1
- package/locales/faIR.js +5 -6
- package/models/colDef/gridColDef.d.ts +9 -8
- package/models/gridExport.d.ts +2 -2
- package/models/gridFilterOperator.d.ts +2 -1
- package/models/props/DataGridProps.d.ts +2 -1
- package/modern/components/columnHeaders/GridColumnHeaderFilterIconButton.js +21 -7
- 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/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +1 -3
- package/modern/hooks/features/filter/gridFilterUtils.js +3 -3
- 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/sorting/gridSortingUtils.js +2 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +1 -8
- package/modern/hooks/utils/useGridApiRef.js +3 -1
- package/modern/index.js +1 -1
- package/modern/locales/faIR.js +5 -6
- package/modern/utils/isJSDOM.js +1 -0
- package/node/components/columnHeaders/GridColumnHeaderFilterIconButton.js +20 -6
- 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/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
- package/node/hooks/features/dimensions/useGridDimensions.js +3 -5
- package/node/hooks/features/filter/gridFilterUtils.js +3 -3
- 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/sorting/gridSortingUtils.js +2 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +3 -10
- package/node/hooks/utils/useGridApiRef.js +3 -1
- package/node/index.js +1 -1
- package/node/locales/faIR.js +5 -6
- package/node/utils/isJSDOM.js +7 -0
- package/package.json +2 -2
- package/utils/createSelector.d.ts +3 -3
- package/utils/getPublicApiRef.d.ts +2 -1
- package/utils/isJSDOM.d.ts +1 -0
- package/utils/isJSDOM.js +1 -0
|
@@ -5,12 +5,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.GridColumnHeaderFilterIconButton =
|
|
8
|
+
exports.GridColumnHeaderFilterIconButton = GridColumnHeaderFilterIconButtonWrapped;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _utils = require("@mui/utils");
|
|
13
|
-
var
|
|
13
|
+
var _useGridSelector = require("../../hooks/utils/useGridSelector");
|
|
14
14
|
var _gridPreferencePanelSelector = require("../../hooks/features/preferencesPanel/gridPreferencePanelSelector");
|
|
15
15
|
var _gridPreferencePanelsValue = require("../../hooks/features/preferencesPanel/gridPreferencePanelsValue");
|
|
16
16
|
var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
@@ -27,6 +27,21 @@ const useUtilityClasses = ownerState => {
|
|
|
27
27
|
};
|
|
28
28
|
return (0, _utils.unstable_composeClasses)(slots, _gridClasses.getDataGridUtilityClass, classes);
|
|
29
29
|
};
|
|
30
|
+
function GridColumnHeaderFilterIconButtonWrapped(props) {
|
|
31
|
+
if (!props.counter) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridColumnHeaderFilterIconButton, (0, _extends2.default)({}, props));
|
|
35
|
+
}
|
|
36
|
+
process.env.NODE_ENV !== "production" ? GridColumnHeaderFilterIconButtonWrapped.propTypes = {
|
|
37
|
+
// ----------------------------- Warning --------------------------------
|
|
38
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
39
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
40
|
+
// ----------------------------------------------------------------------
|
|
41
|
+
counter: _propTypes.default.number,
|
|
42
|
+
field: _propTypes.default.string.isRequired,
|
|
43
|
+
onClick: _propTypes.default.func
|
|
44
|
+
} : void 0;
|
|
30
45
|
function GridColumnHeaderFilterIconButton(props) {
|
|
31
46
|
const {
|
|
32
47
|
counter,
|
|
@@ -39,8 +54,8 @@ function GridColumnHeaderFilterIconButton(props) {
|
|
|
39
54
|
classes: rootProps.classes
|
|
40
55
|
});
|
|
41
56
|
const classes = useUtilityClasses(ownerState);
|
|
42
|
-
const preferencePanel = (0, _hooks.useGridSelector)(apiRef, _gridPreferencePanelSelector.gridPreferencePanelStateSelector);
|
|
43
57
|
const labelId = (0, _utils.unstable_useId)();
|
|
58
|
+
const isOpen = (0, _useGridSelector.useGridSelectorV8)(apiRef, _gridPreferencePanelSelector.gridPreferencePanelSelectorWithLabel, labelId);
|
|
44
59
|
const panelId = (0, _utils.unstable_useId)();
|
|
45
60
|
const toggleFilter = React.useCallback(event => {
|
|
46
61
|
event.preventDefault();
|
|
@@ -61,7 +76,6 @@ function GridColumnHeaderFilterIconButton(props) {
|
|
|
61
76
|
if (!counter) {
|
|
62
77
|
return null;
|
|
63
78
|
}
|
|
64
|
-
const open = preferencePanel.open && preferencePanel.labelId === labelId;
|
|
65
79
|
const iconButton = /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseIconButton, (0, _extends2.default)({
|
|
66
80
|
id: labelId,
|
|
67
81
|
onClick: toggleFilter,
|
|
@@ -70,8 +84,8 @@ function GridColumnHeaderFilterIconButton(props) {
|
|
|
70
84
|
size: "small",
|
|
71
85
|
tabIndex: -1,
|
|
72
86
|
"aria-haspopup": "menu",
|
|
73
|
-
"aria-expanded":
|
|
74
|
-
"aria-controls":
|
|
87
|
+
"aria-expanded": isOpen,
|
|
88
|
+
"aria-controls": isOpen ? panelId : undefined
|
|
75
89
|
}, rootProps.slotProps?.baseIconButton, {
|
|
76
90
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.columnFilteredIcon, {
|
|
77
91
|
className: classes.icon,
|
|
@@ -99,7 +99,8 @@ const GridPanel = exports.GridPanel = (0, _forwardRef.forwardRef)((props, ref) =
|
|
|
99
99
|
}, other, {
|
|
100
100
|
ref: ref,
|
|
101
101
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClickAwayListener.default, {
|
|
102
|
-
mouseEvent: "
|
|
102
|
+
mouseEvent: "onPointerUp",
|
|
103
|
+
touchEvent: false,
|
|
103
104
|
onClickAway: handleClickAway,
|
|
104
105
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(GridPaperRoot, {
|
|
105
106
|
className: classes.paper,
|
|
@@ -54,7 +54,12 @@ const GridToolbarColumnsButton = exports.GridToolbarColumnsButton = (0, _forward
|
|
|
54
54
|
"aria-expanded": isOpen,
|
|
55
55
|
"aria-controls": isOpen ? columnPanelId : undefined,
|
|
56
56
|
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.columnSelectorIcon, {}),
|
|
57
|
-
onClick: showColumns
|
|
57
|
+
onClick: showColumns,
|
|
58
|
+
onPointerUp: event => {
|
|
59
|
+
if (preferencePanel.open) {
|
|
60
|
+
event.stopPropagation();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
58
63
|
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
59
64
|
ref: ref,
|
|
60
65
|
children: apiRef.current.getLocaleText('toolbarColumns')
|
|
@@ -118,7 +118,12 @@ const GridToolbarFilterButton = exports.GridToolbarFilterButton = (0, _forwardRe
|
|
|
118
118
|
}, rootProps.slotProps?.baseBadge, badgeProps, {
|
|
119
119
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.openFilterButtonIcon, {})
|
|
120
120
|
})),
|
|
121
|
-
onClick: toggleFilter
|
|
121
|
+
onClick: toggleFilter,
|
|
122
|
+
onPointerUp: event => {
|
|
123
|
+
if (preferencePanel.open) {
|
|
124
|
+
event.stopPropagation();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
122
127
|
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
123
128
|
ref: ref,
|
|
124
129
|
children: apiRef.current.getLocaleText('toolbarFilters')
|
|
@@ -49,7 +49,6 @@ const useGridColumnMenu = apiRef => {
|
|
|
49
49
|
});
|
|
50
50
|
});
|
|
51
51
|
apiRef.current.hidePreferences();
|
|
52
|
-
apiRef.current.forceUpdate();
|
|
53
52
|
}
|
|
54
53
|
}, [apiRef, logger]);
|
|
55
54
|
const hideColumnMenu = React.useCallback(() => {
|
|
@@ -91,7 +90,6 @@ const useGridColumnMenu = apiRef => {
|
|
|
91
90
|
columnMenu: newState
|
|
92
91
|
});
|
|
93
92
|
});
|
|
94
|
-
apiRef.current.forceUpdate();
|
|
95
93
|
}
|
|
96
94
|
}, [apiRef, logger]);
|
|
97
95
|
const toggleColumnMenu = React.useCallback(field => {
|
|
@@ -24,6 +24,7 @@ var _gridRowsMetaSelector = require("../rows/gridRowsMetaSelector");
|
|
|
24
24
|
var _gridRowsUtils = require("../rows/gridRowsUtils");
|
|
25
25
|
var _gridColumnsUtils = require("../columns/gridColumnsUtils");
|
|
26
26
|
var _dataGridPropsDefaultValues = require("../../../constants/dataGridPropsDefaultValues");
|
|
27
|
+
var _isJSDOM = require("../../../utils/isJSDOM");
|
|
27
28
|
const EMPTY_SIZE = {
|
|
28
29
|
width: 0,
|
|
29
30
|
height: 0
|
|
@@ -247,14 +248,11 @@ function useGridDimensions(apiRef, props) {
|
|
|
247
248
|
const isFirstSizing = React.useRef(true);
|
|
248
249
|
const handleResize = React.useCallback(size => {
|
|
249
250
|
rootDimensionsRef.current = size;
|
|
250
|
-
|
|
251
|
-
// jsdom has no layout capabilities
|
|
252
|
-
const isJSDOM = /jsdom|HappyDOM/.test(window.navigator.userAgent);
|
|
253
|
-
if (size.height === 0 && !errorShown.current && !props.autoHeight && !isJSDOM) {
|
|
251
|
+
if (size.height === 0 && !errorShown.current && !props.autoHeight && !_isJSDOM.isJSDOM) {
|
|
254
252
|
logger.error(['The parent DOM element of the Data Grid has an empty height.', 'Please make sure that this element has an intrinsic height.', 'The grid displays with a height of 0px.', '', 'More details: https://mui.com/r/x-data-grid-no-dimensions.'].join('\n'));
|
|
255
253
|
errorShown.current = true;
|
|
256
254
|
}
|
|
257
|
-
if (size.width === 0 && !errorShown.current && !isJSDOM) {
|
|
255
|
+
if (size.width === 0 && !errorShown.current && !_isJSDOM.isJSDOM) {
|
|
258
256
|
logger.error(['The parent DOM element of the Data Grid has an empty width.', 'Please make sure that this element has an intrinsic width.', 'The grid displays with a width of 0px.', '', 'More details: https://mui.com/r/x-data-grid-no-dimensions.'].join('\n'));
|
|
259
257
|
errorShown.current = true;
|
|
260
258
|
}
|
|
@@ -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 {
|
|
29
|
+
* @param {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 {
|
|
147
|
+
* @param {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 {
|
|
195
|
+
* @param {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,6 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.gridPreferencePanelStateSelector = void 0;
|
|
6
|
+
exports.gridPreferencePanelStateSelector = exports.gridPreferencePanelSelectorWithLabel = void 0;
|
|
7
|
+
var _createSelector = require("../../../utils/createSelector");
|
|
7
8
|
const gridPreferencePanelStateSelector = state => state.preferencePanel;
|
|
8
|
-
exports.gridPreferencePanelStateSelector = gridPreferencePanelStateSelector;
|
|
9
|
+
exports.gridPreferencePanelStateSelector = gridPreferencePanelStateSelector;
|
|
10
|
+
const gridPreferencePanelSelectorWithLabel = exports.gridPreferencePanelSelectorWithLabel = (0, _createSelector.createSelectorV8)(gridPreferencePanelStateSelector, (panel, labelId) => {
|
|
11
|
+
if (panel.open && panel.labelId === labelId) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
15
|
+
});
|
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
gridPreferencePanelStateSelector: true
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "gridPreferencePanelStateSelector", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _gridPreferencePanelSelector.gridPreferencePanelStateSelector;
|
|
13
|
+
}
|
|
16
14
|
});
|
|
15
|
+
var _gridPreferencePanelSelector = require("./gridPreferencePanelSelector");
|
|
17
16
|
var _gridPreferencePanelState = require("./gridPreferencePanelState");
|
|
18
17
|
Object.keys(_gridPreferencePanelState).forEach(function (key) {
|
|
19
18
|
if (key === "default" || key === "__esModule") return;
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
20
20
|
if (key in exports && exports[key] === _gridPreferencePanelState[key]) return;
|
|
21
21
|
Object.defineProperty(exports, key, {
|
|
22
22
|
enumerable: true,
|
|
@@ -28,6 +28,7 @@ Object.keys(_gridPreferencePanelState).forEach(function (key) {
|
|
|
28
28
|
var _gridPreferencePanelsValue = require("./gridPreferencePanelsValue");
|
|
29
29
|
Object.keys(_gridPreferencePanelsValue).forEach(function (key) {
|
|
30
30
|
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
31
32
|
if (key in exports && exports[key] === _gridPreferencePanelsValue[key]) return;
|
|
32
33
|
Object.defineProperty(exports, key, {
|
|
33
34
|
enumerable: true,
|
|
@@ -24,42 +24,29 @@ const preferencePanelStateInitializer = (state, props) => (0, _extends2.default)
|
|
|
24
24
|
exports.preferencePanelStateInitializer = preferencePanelStateInitializer;
|
|
25
25
|
const useGridPreferencesPanel = (apiRef, props) => {
|
|
26
26
|
const logger = (0, _useGridLogger.useGridLogger)(apiRef, 'useGridPreferencesPanel');
|
|
27
|
-
const hideTimeout = React.useRef(undefined);
|
|
28
|
-
const immediateTimeout = React.useRef(undefined);
|
|
29
27
|
|
|
30
28
|
/**
|
|
31
29
|
* API METHODS
|
|
32
30
|
*/
|
|
33
31
|
const hidePreferences = React.useCallback(() => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
apiRef.current.setState(state => {
|
|
33
|
+
if (!state.preferencePanel.open) {
|
|
34
|
+
return state;
|
|
35
|
+
}
|
|
36
|
+
logger.debug('Hiding Preferences Panel');
|
|
37
|
+
const preferencePanelState = (0, _gridPreferencePanelSelector.gridPreferencePanelStateSelector)(state);
|
|
37
38
|
apiRef.current.publishEvent('preferencePanelClose', {
|
|
38
39
|
openedPanelValue: preferencePanelState.openedPanelValue
|
|
39
40
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
})
|
|
46
|
-
apiRef.current.forceUpdate();
|
|
41
|
+
return (0, _extends2.default)({}, state, {
|
|
42
|
+
preferencePanel: {
|
|
43
|
+
open: false
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
47
|
}, [apiRef, logger]);
|
|
48
|
-
|
|
49
|
-
// This is to prevent the preferences from closing when you open a select box or another panel,
|
|
50
|
-
// The issue is in MUI core V4 => Fixed in V5
|
|
51
|
-
const doNotHidePanel = React.useCallback(() => {
|
|
52
|
-
immediateTimeout.current = setTimeout(() => clearTimeout(hideTimeout.current), 0);
|
|
53
|
-
}, []);
|
|
54
|
-
|
|
55
|
-
// This is a hack for the issue with Core V4, by delaying hiding the panel on the clickAwayListener,
|
|
56
|
-
// we can cancel the action if the trigger element still need the panel...
|
|
57
|
-
const hidePreferencesDelayed = React.useCallback(() => {
|
|
58
|
-
hideTimeout.current = setTimeout(hidePreferences, 100);
|
|
59
|
-
}, [hidePreferences]);
|
|
60
48
|
const showPreferences = React.useCallback((newValue, panelId, labelId) => {
|
|
61
49
|
logger.debug('Opening Preferences Panel');
|
|
62
|
-
doNotHidePanel();
|
|
63
50
|
apiRef.current.setState(state => (0, _extends2.default)({}, state, {
|
|
64
51
|
preferencePanel: (0, _extends2.default)({}, state.preferencePanel, {
|
|
65
52
|
open: true,
|
|
@@ -71,11 +58,10 @@ const useGridPreferencesPanel = (apiRef, props) => {
|
|
|
71
58
|
apiRef.current.publishEvent('preferencePanelOpen', {
|
|
72
59
|
openedPanelValue: newValue
|
|
73
60
|
});
|
|
74
|
-
|
|
75
|
-
}, [logger, doNotHidePanel, apiRef]);
|
|
61
|
+
}, [logger, apiRef]);
|
|
76
62
|
(0, _useGridApiMethod.useGridApiMethod)(apiRef, {
|
|
77
63
|
showPreferences,
|
|
78
|
-
hidePreferences
|
|
64
|
+
hidePreferences
|
|
79
65
|
}, 'public');
|
|
80
66
|
|
|
81
67
|
/**
|
|
@@ -108,15 +94,5 @@ const useGridPreferencesPanel = (apiRef, props) => {
|
|
|
108
94
|
}, [apiRef]);
|
|
109
95
|
(0, _pipeProcessing.useGridRegisterPipeProcessor)(apiRef, 'exportState', stateExportPreProcessing);
|
|
110
96
|
(0, _pipeProcessing.useGridRegisterPipeProcessor)(apiRef, 'restoreState', stateRestorePreProcessing);
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* EFFECTS
|
|
114
|
-
*/
|
|
115
|
-
React.useEffect(() => {
|
|
116
|
-
return () => {
|
|
117
|
-
clearTimeout(hideTimeout.current);
|
|
118
|
-
clearTimeout(immediateTimeout.current);
|
|
119
|
-
};
|
|
120
|
-
}, []);
|
|
121
97
|
};
|
|
122
98
|
exports.useGridPreferencesPanel = useGridPreferencesPanel;
|
|
@@ -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 {
|
|
31
|
+
* @param {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 {
|
|
84
|
+
* @param {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) => {
|
|
@@ -37,6 +37,7 @@ var _gridRowSpanningSelectors = require("../rows/gridRowSpanningSelectors");
|
|
|
37
37
|
var _gridListViewSelectors = require("../listView/gridListViewSelectors");
|
|
38
38
|
var _gridRowsUtils = require("../rows/gridRowsUtils");
|
|
39
39
|
var _gridFocusedVirtualCellSelector = require("./gridFocusedVirtualCellSelector");
|
|
40
|
+
var _isJSDOM = require("../../../utils/isJSDOM");
|
|
40
41
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
41
42
|
const MINIMUM_COLUMN_WIDTH = 50;
|
|
42
43
|
var ScrollDirection = /*#__PURE__*/function (ScrollDirection) {
|
|
@@ -56,14 +57,6 @@ const createScrollCache = (isRtl, rowBufferPx, columnBufferPx, verticalBuffer, h
|
|
|
56
57
|
direction: ScrollDirection.NONE,
|
|
57
58
|
buffer: bufferForDirection(isRtl, ScrollDirection.NONE, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer)
|
|
58
59
|
});
|
|
59
|
-
let isJSDOM = false;
|
|
60
|
-
try {
|
|
61
|
-
if (typeof window !== 'undefined') {
|
|
62
|
-
isJSDOM = /jsdom|HappyDOM/.test(window.navigator.userAgent);
|
|
63
|
-
}
|
|
64
|
-
} catch (_) {
|
|
65
|
-
/* ignore */
|
|
66
|
-
}
|
|
67
60
|
const useGridVirtualScroller = () => {
|
|
68
61
|
const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
|
|
69
62
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
@@ -71,8 +64,8 @@ const useGridVirtualScroller = () => {
|
|
|
71
64
|
unstable_listView: listView
|
|
72
65
|
} = rootProps;
|
|
73
66
|
const visibleColumns = (0, _useGridSelector.useGridSelector)(apiRef, () => listView ? [(0, _gridListViewSelectors.gridListColumnSelector)(apiRef.current.state)] : (0, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector)(apiRef));
|
|
74
|
-
const enabledForRows = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridVirtualizationRowEnabledSelector) && !isJSDOM;
|
|
75
|
-
const enabledForColumns = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridVirtualizationColumnEnabledSelector) && !isJSDOM;
|
|
67
|
+
const enabledForRows = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridVirtualizationRowEnabledSelector) && !_isJSDOM.isJSDOM;
|
|
68
|
+
const enabledForColumns = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridVirtualizationColumnEnabledSelector) && !_isJSDOM.isJSDOM;
|
|
76
69
|
const dimensions = (0, _useGridSelector.useGridSelector)(apiRef, _gridDimensionsSelectors.gridDimensionsSelector);
|
|
77
70
|
const outerSize = dimensions.viewportOuterSize;
|
|
78
71
|
const pinnedRows = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridPinnedRowsSelector);
|
|
@@ -9,5 +9,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
/**
|
|
10
10
|
* Hook that instantiate a [[GridApiRef]].
|
|
11
11
|
*/
|
|
12
|
-
const useGridApiRef = () =>
|
|
12
|
+
const useGridApiRef = () =>
|
|
13
|
+
// TODO v8: initialize with null (see https://github.com/mui/mui-x/issues/16135#issuecomment-2589395230 and https://github.com/mui/mui-x/issues/16000#issuecomment-2567820735)
|
|
14
|
+
React.useRef({});
|
|
13
15
|
exports.useGridApiRef = useGridApiRef;
|
package/node/index.js
CHANGED
package/node/locales/faIR.js
CHANGED
|
@@ -40,8 +40,7 @@ const faIRGrid = {
|
|
|
40
40
|
columnsManagementNoColumns: 'بدون سطر',
|
|
41
41
|
columnsManagementShowHideAllText: 'نمایش/مخفی کردن همه',
|
|
42
42
|
columnsManagementReset: 'بازنشانی',
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
columnsManagementDeleteIconLabel: 'پاک کردن',
|
|
45
44
|
// Filter panel text
|
|
46
45
|
filterPanelAddFilter: 'افزودن فیلتر',
|
|
47
46
|
filterPanelRemoveAll: 'حذف همه',
|
|
@@ -55,9 +54,9 @@ const faIRGrid = {
|
|
|
55
54
|
filterPanelInputPlaceholder: 'فیلتر مقدار',
|
|
56
55
|
// Filter operators text
|
|
57
56
|
filterOperatorContains: 'شامل',
|
|
58
|
-
|
|
57
|
+
filterOperatorDoesNotContain: 'شامل نمیشود',
|
|
59
58
|
filterOperatorEquals: 'مساوی',
|
|
60
|
-
|
|
59
|
+
filterOperatorDoesNotEqual: 'برابر نیست',
|
|
61
60
|
filterOperatorStartsWith: 'شروع با',
|
|
62
61
|
filterOperatorEndsWith: 'پایان با',
|
|
63
62
|
filterOperatorIs: 'هست',
|
|
@@ -77,9 +76,9 @@ const faIRGrid = {
|
|
|
77
76
|
'filterOperator<=': '<=',
|
|
78
77
|
// Header filter operators text
|
|
79
78
|
headerFilterOperatorContains: 'شامل',
|
|
80
|
-
|
|
79
|
+
headerFilterOperatorDoesNotContain: 'شامل نمیشود',
|
|
81
80
|
headerFilterOperatorEquals: 'مساوی',
|
|
82
|
-
|
|
81
|
+
headerFilterOperatorDoesNotEqual: 'برابر نیست',
|
|
83
82
|
headerFilterOperatorStartsWith: 'شروع با',
|
|
84
83
|
headerFilterOperatorEndsWith: 'پایان با',
|
|
85
84
|
headerFilterOperatorIs: 'هست',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid",
|
|
3
|
-
"version": "7.24.
|
|
3
|
+
"version": "7.24.1",
|
|
4
4
|
"description": "The Community plan edition of the Data Grid components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"clsx": "^2.1.1",
|
|
43
43
|
"prop-types": "^15.8.1",
|
|
44
44
|
"reselect": "^5.1.1",
|
|
45
|
-
"@mui/x-internals": "7.24.
|
|
45
|
+
"@mui/x-internals": "7.24.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@emotion/react": "^11.9.0",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { Selector, SelectorResultArray } from 'reselect';
|
|
3
3
|
import type { GridCoreApi } from '../models/api/gridCoreApi';
|
|
4
4
|
export interface OutputSelector<State, Result> {
|
|
5
|
-
(apiRef:
|
|
5
|
+
(apiRef: RefObject<{
|
|
6
6
|
state: State;
|
|
7
7
|
instanceId: GridCoreApi['instanceId'];
|
|
8
8
|
}>): Result;
|
|
@@ -10,7 +10,7 @@ export interface OutputSelector<State, Result> {
|
|
|
10
10
|
acceptsApiRef: boolean;
|
|
11
11
|
}
|
|
12
12
|
export interface OutputSelectorV8<State, Args, Result> {
|
|
13
|
-
(apiRef:
|
|
13
|
+
(apiRef: RefObject<{
|
|
14
14
|
state: State;
|
|
15
15
|
instanceId: GridCoreApi['instanceId'];
|
|
16
16
|
}>, args?: Args): Result;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
1
2
|
import type { GridPrivateApiCommunity } from '../models/api/gridApiCommunity';
|
|
2
|
-
export declare function getPublicApiRef<PrivateApi extends GridPrivateApiCommunity>(apiRef:
|
|
3
|
+
export declare function getPublicApiRef<PrivateApi extends GridPrivateApiCommunity>(apiRef: RefObject<PrivateApi>): RefObject<ReturnType<PrivateApi["getPublicApi"]>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isJSDOM: boolean;
|
package/utils/isJSDOM.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const isJSDOM = typeof window !== 'undefined' && /jsdom|HappyDOM/.test(window.navigator.userAgent);
|