@mui/x-data-grid 5.17.14 → 5.17.16
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 +54 -0
- package/components/menu/columnMenu/SortGridMenuItems.d.ts +4 -4
- package/components/menu/columnMenu/SortGridMenuItems.js +11 -6
- package/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
- package/index.js +1 -1
- package/legacy/components/menu/columnMenu/SortGridMenuItems.js +11 -6
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
- package/legacy/index.js +1 -1
- package/modern/components/menu/columnMenu/SortGridMenuItems.js +9 -6
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
- package/modern/index.js +1 -1
- package/node/components/menu/columnMenu/SortGridMenuItems.js +13 -8
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +3 -3
- package/node/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,60 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 5.17.16
|
|
7
|
+
|
|
8
|
+
_Dec 16, 2022_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 4 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🐞 Bugfixes
|
|
13
|
+
|
|
14
|
+
### `@mui/x-data-grid@v5.17.16` / `@mui/x-data-grid-pro@v5.17.16` / `@mui/x-data-grid-premium@v5.17.16`
|
|
15
|
+
|
|
16
|
+
#### Changes
|
|
17
|
+
|
|
18
|
+
- [DataGrid] Display sort column menu items as per `sortingOrder` prop (#7125) @hanbin9775
|
|
19
|
+
- [DataGrid] Fix flickering on mount (#7155) @cherniavskii
|
|
20
|
+
- [DataGridPremium] Use separate cache for aggregation columns pre-processor (#7174) @m4theushw
|
|
21
|
+
|
|
22
|
+
### `@mui/x-date-pickers@v5.0.11` / `@mui/x-date-pickers-pro@v5.0.11`
|
|
23
|
+
|
|
24
|
+
#### Changes
|
|
25
|
+
|
|
26
|
+
- [DateTimePicker] Update export pattern (#7172) @kealjones-wk
|
|
27
|
+
|
|
28
|
+
### Docs
|
|
29
|
+
|
|
30
|
+
- [docs] Document aggregation selectors (#7151) @cherniavskii
|
|
31
|
+
|
|
32
|
+
## 5.17.15
|
|
33
|
+
|
|
34
|
+
_Dec 8, 2022_
|
|
35
|
+
|
|
36
|
+
We'd like to offer a big thanks to the 4 contributors who made this release possible. Here are some highlights ✨:
|
|
37
|
+
|
|
38
|
+
- ✨ Fix lazy-loading not working in `DataGridPremium` (#7130) @m4theushw
|
|
39
|
+
- 🐞 Bugfixes
|
|
40
|
+
|
|
41
|
+
### `@mui/x-data-grid@v5.17.15` / `@mui/x-data-grid-pro@v5.17.15` / `@mui/x-data-grid-premium@v5.17.15`
|
|
42
|
+
|
|
43
|
+
#### Changes
|
|
44
|
+
|
|
45
|
+
- [DataGridPremium] Add support for lazy-loading (#7130) @m4theushw
|
|
46
|
+
- [DataGridPremium] Pass `groupId` to the aggregation function (#7143) @m4theushw
|
|
47
|
+
|
|
48
|
+
### `@mui/x-date-pickers@v5.0.10` / `@mui/x-date-pickers-pro@v5.0.10`
|
|
49
|
+
|
|
50
|
+
#### Changes
|
|
51
|
+
|
|
52
|
+
- [pickers] Initialize date without time when selecting year or month (#7136) @LukasTy
|
|
53
|
+
|
|
54
|
+
### Docs
|
|
55
|
+
|
|
56
|
+
- [docs] Fix the nested import on the api pages (#7134) @flaviendelangle
|
|
57
|
+
- [docs] Keep track of the localization completion (#7099) @alexfauquette
|
|
58
|
+
- [docs] Update localization doc to use existing locale (#7104) @LukasTy
|
|
59
|
+
|
|
6
60
|
## 5.17.14
|
|
7
61
|
|
|
8
62
|
_Dec 1, 2022_
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { GridFilterItemProps } from './GridFilterItemProps';
|
|
3
|
-
declare
|
|
4
|
-
|
|
5
|
-
propTypes: any;
|
|
6
|
-
}
|
|
3
|
+
declare function SortGridMenuItems(props: GridFilterItemProps): JSX.Element | null;
|
|
4
|
+
declare namespace SortGridMenuItems {
|
|
5
|
+
var propTypes: any;
|
|
6
|
+
}
|
|
7
7
|
export { SortGridMenuItems };
|
|
@@ -4,16 +4,21 @@ import MenuItem from '@mui/material/MenuItem';
|
|
|
4
4
|
import { useGridSelector } from '../../../hooks/utils/useGridSelector';
|
|
5
5
|
import { gridSortModelSelector } from '../../../hooks/features/sorting/gridSortingSelector';
|
|
6
6
|
import { useGridApiContext } from '../../../hooks/utils/useGridApiContext';
|
|
7
|
+
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
function SortGridMenuItems(props) {
|
|
12
|
+
var _column$sortingOrder;
|
|
13
|
+
|
|
11
14
|
const {
|
|
12
15
|
column,
|
|
13
16
|
onClick
|
|
14
17
|
} = props;
|
|
15
18
|
const apiRef = useGridApiContext();
|
|
16
19
|
const sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
20
|
+
const rootProps = useGridRootProps();
|
|
21
|
+
const sortingOrder = (_column$sortingOrder = column.sortingOrder) != null ? _column$sortingOrder : rootProps.sortingOrder;
|
|
17
22
|
const sortDirection = React.useMemo(() => {
|
|
18
23
|
if (!column) {
|
|
19
24
|
return null;
|
|
@@ -33,23 +38,23 @@ const SortGridMenuItems = props => {
|
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
36
|
-
children: [/*#__PURE__*/_jsx(MenuItem, {
|
|
41
|
+
children: [sortingOrder.includes(null) ? /*#__PURE__*/_jsx(MenuItem, {
|
|
37
42
|
onClick: onSortMenuItemClick,
|
|
38
43
|
disabled: sortDirection == null,
|
|
39
44
|
children: apiRef.current.getLocaleText('columnMenuUnsort')
|
|
40
|
-
}), /*#__PURE__*/_jsx(MenuItem, {
|
|
45
|
+
}) : null, sortingOrder.includes('asc') ? /*#__PURE__*/_jsx(MenuItem, {
|
|
41
46
|
onClick: onSortMenuItemClick,
|
|
42
47
|
"data-value": "asc",
|
|
43
48
|
disabled: sortDirection === 'asc',
|
|
44
49
|
children: apiRef.current.getLocaleText('columnMenuSortAsc')
|
|
45
|
-
}), /*#__PURE__*/_jsx(MenuItem, {
|
|
50
|
+
}) : null, sortingOrder.includes('desc') ? /*#__PURE__*/_jsx(MenuItem, {
|
|
46
51
|
onClick: onSortMenuItemClick,
|
|
47
52
|
"data-value": "desc",
|
|
48
53
|
disabled: sortDirection === 'desc',
|
|
49
54
|
children: apiRef.current.getLocaleText('columnMenuSortDesc')
|
|
50
|
-
})]
|
|
55
|
+
}) : null]
|
|
51
56
|
});
|
|
52
|
-
}
|
|
57
|
+
}
|
|
53
58
|
|
|
54
59
|
process.env.NODE_ENV !== "production" ? SortGridMenuItems.propTypes = {
|
|
55
60
|
// ----------------------------- Warning --------------------------------
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
const _excluded = ["style"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import * as ReactDOM from 'react-dom';
|
|
6
|
-
import { useForkRef } from '@mui/material/utils';
|
|
6
|
+
import { useForkRef, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
|
|
7
7
|
import { useGridApiContext } from '../../utils/useGridApiContext';
|
|
8
8
|
import { useGridRootProps } from '../../utils/useGridRootProps';
|
|
9
9
|
import { useGridSelector } from '../../utils/useGridSelector';
|
|
@@ -158,7 +158,7 @@ export const useGridVirtualScroller = props => {
|
|
|
158
158
|
lastColumnIndex
|
|
159
159
|
};
|
|
160
160
|
}, [disableVirtualization, getNearestIndexToRender, rowsMeta.positions.length, rootProps.autoHeight, rootProps.rowBuffer, currentPage.rows, columnPositions, visibleColumns.length, apiRef, containerWidth]);
|
|
161
|
-
|
|
161
|
+
useEnhancedEffect(() => {
|
|
162
162
|
if (disableVirtualization) {
|
|
163
163
|
renderZoneRef.current.style.transform = `translate3d(0px, 0px, 0px)`;
|
|
164
164
|
} else {
|
|
@@ -167,7 +167,7 @@ export const useGridVirtualScroller = props => {
|
|
|
167
167
|
rootRef.current.scrollTop = 0;
|
|
168
168
|
}
|
|
169
169
|
}, [disableVirtualization]);
|
|
170
|
-
|
|
170
|
+
useEnhancedEffect(() => {
|
|
171
171
|
setContainerWidth(rootRef.current.clientWidth);
|
|
172
172
|
}, [rowsMeta.currentPageTotalHeight]);
|
|
173
173
|
const handleResize = React.useCallback(params => {
|
|
@@ -228,7 +228,7 @@ export const useGridVirtualScroller = props => {
|
|
|
228
228
|
});
|
|
229
229
|
prevRenderContext.current = nextRenderContext;
|
|
230
230
|
}, [apiRef, setRenderContext, prevRenderContext, currentPage.rows.length, rootProps.rowBuffer]);
|
|
231
|
-
|
|
231
|
+
useEnhancedEffect(() => {
|
|
232
232
|
if (containerWidth == null) {
|
|
233
233
|
return;
|
|
234
234
|
}
|
package/index.js
CHANGED
|
@@ -4,14 +4,19 @@ import MenuItem from '@mui/material/MenuItem';
|
|
|
4
4
|
import { useGridSelector } from '../../../hooks/utils/useGridSelector';
|
|
5
5
|
import { gridSortModelSelector } from '../../../hooks/features/sorting/gridSortingSelector';
|
|
6
6
|
import { useGridApiContext } from '../../../hooks/utils/useGridApiContext';
|
|
7
|
+
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
function SortGridMenuItems(props) {
|
|
12
|
+
var _column$sortingOrder;
|
|
13
|
+
|
|
11
14
|
var column = props.column,
|
|
12
15
|
onClick = props.onClick;
|
|
13
16
|
var apiRef = useGridApiContext();
|
|
14
17
|
var sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
18
|
+
var rootProps = useGridRootProps();
|
|
19
|
+
var sortingOrder = (_column$sortingOrder = column.sortingOrder) != null ? _column$sortingOrder : rootProps.sortingOrder;
|
|
15
20
|
var sortDirection = React.useMemo(function () {
|
|
16
21
|
if (!column) {
|
|
17
22
|
return null;
|
|
@@ -33,23 +38,23 @@ var SortGridMenuItems = function SortGridMenuItems(props) {
|
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
36
|
-
children: [/*#__PURE__*/_jsx(MenuItem, {
|
|
41
|
+
children: [sortingOrder.includes(null) ? /*#__PURE__*/_jsx(MenuItem, {
|
|
37
42
|
onClick: onSortMenuItemClick,
|
|
38
43
|
disabled: sortDirection == null,
|
|
39
44
|
children: apiRef.current.getLocaleText('columnMenuUnsort')
|
|
40
|
-
}), /*#__PURE__*/_jsx(MenuItem, {
|
|
45
|
+
}) : null, sortingOrder.includes('asc') ? /*#__PURE__*/_jsx(MenuItem, {
|
|
41
46
|
onClick: onSortMenuItemClick,
|
|
42
47
|
"data-value": "asc",
|
|
43
48
|
disabled: sortDirection === 'asc',
|
|
44
49
|
children: apiRef.current.getLocaleText('columnMenuSortAsc')
|
|
45
|
-
}), /*#__PURE__*/_jsx(MenuItem, {
|
|
50
|
+
}) : null, sortingOrder.includes('desc') ? /*#__PURE__*/_jsx(MenuItem, {
|
|
46
51
|
onClick: onSortMenuItemClick,
|
|
47
52
|
"data-value": "desc",
|
|
48
53
|
disabled: sortDirection === 'desc',
|
|
49
54
|
children: apiRef.current.getLocaleText('columnMenuSortDesc')
|
|
50
|
-
})]
|
|
55
|
+
}) : null]
|
|
51
56
|
});
|
|
52
|
-
}
|
|
57
|
+
}
|
|
53
58
|
|
|
54
59
|
process.env.NODE_ENV !== "production" ? SortGridMenuItems.propTypes = {
|
|
55
60
|
// ----------------------------- Warning --------------------------------
|
|
@@ -4,7 +4,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
4
4
|
var _excluded = ["style"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import * as ReactDOM from 'react-dom';
|
|
7
|
-
import { useForkRef } from '@mui/material/utils';
|
|
7
|
+
import { useForkRef, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
|
|
8
8
|
import { useGridApiContext } from '../../utils/useGridApiContext';
|
|
9
9
|
import { useGridRootProps } from '../../utils/useGridRootProps';
|
|
10
10
|
import { useGridSelector } from '../../utils/useGridSelector';
|
|
@@ -174,7 +174,7 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
|
|
|
174
174
|
lastColumnIndex: lastColumnIndex
|
|
175
175
|
};
|
|
176
176
|
}, [disableVirtualization, getNearestIndexToRender, rowsMeta.positions.length, rootProps.autoHeight, rootProps.rowBuffer, currentPage.rows, columnPositions, visibleColumns.length, apiRef, containerWidth]);
|
|
177
|
-
|
|
177
|
+
useEnhancedEffect(function () {
|
|
178
178
|
if (disableVirtualization) {
|
|
179
179
|
renderZoneRef.current.style.transform = "translate3d(0px, 0px, 0px)";
|
|
180
180
|
} else {
|
|
@@ -183,7 +183,7 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
|
|
|
183
183
|
rootRef.current.scrollTop = 0;
|
|
184
184
|
}
|
|
185
185
|
}, [disableVirtualization]);
|
|
186
|
-
|
|
186
|
+
useEnhancedEffect(function () {
|
|
187
187
|
setContainerWidth(rootRef.current.clientWidth);
|
|
188
188
|
}, [rowsMeta.currentPageTotalHeight]);
|
|
189
189
|
var handleResize = React.useCallback(function (params) {
|
|
@@ -256,7 +256,7 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
|
|
|
256
256
|
});
|
|
257
257
|
prevRenderContext.current = nextRenderContext;
|
|
258
258
|
}, [apiRef, setRenderContext, prevRenderContext, currentPage.rows.length, rootProps.rowBuffer]);
|
|
259
|
-
|
|
259
|
+
useEnhancedEffect(function () {
|
|
260
260
|
if (containerWidth == null) {
|
|
261
261
|
return;
|
|
262
262
|
}
|
package/legacy/index.js
CHANGED
|
@@ -4,16 +4,19 @@ import MenuItem from '@mui/material/MenuItem';
|
|
|
4
4
|
import { useGridSelector } from '../../../hooks/utils/useGridSelector';
|
|
5
5
|
import { gridSortModelSelector } from '../../../hooks/features/sorting/gridSortingSelector';
|
|
6
6
|
import { useGridApiContext } from '../../../hooks/utils/useGridApiContext';
|
|
7
|
+
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
function SortGridMenuItems(props) {
|
|
11
12
|
const {
|
|
12
13
|
column,
|
|
13
14
|
onClick
|
|
14
15
|
} = props;
|
|
15
16
|
const apiRef = useGridApiContext();
|
|
16
17
|
const sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
18
|
+
const rootProps = useGridRootProps();
|
|
19
|
+
const sortingOrder = column.sortingOrder ?? rootProps.sortingOrder;
|
|
17
20
|
const sortDirection = React.useMemo(() => {
|
|
18
21
|
if (!column) {
|
|
19
22
|
return null;
|
|
@@ -33,23 +36,23 @@ const SortGridMenuItems = props => {
|
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
36
|
-
children: [/*#__PURE__*/_jsx(MenuItem, {
|
|
39
|
+
children: [sortingOrder.includes(null) ? /*#__PURE__*/_jsx(MenuItem, {
|
|
37
40
|
onClick: onSortMenuItemClick,
|
|
38
41
|
disabled: sortDirection == null,
|
|
39
42
|
children: apiRef.current.getLocaleText('columnMenuUnsort')
|
|
40
|
-
}), /*#__PURE__*/_jsx(MenuItem, {
|
|
43
|
+
}) : null, sortingOrder.includes('asc') ? /*#__PURE__*/_jsx(MenuItem, {
|
|
41
44
|
onClick: onSortMenuItemClick,
|
|
42
45
|
"data-value": "asc",
|
|
43
46
|
disabled: sortDirection === 'asc',
|
|
44
47
|
children: apiRef.current.getLocaleText('columnMenuSortAsc')
|
|
45
|
-
}), /*#__PURE__*/_jsx(MenuItem, {
|
|
48
|
+
}) : null, sortingOrder.includes('desc') ? /*#__PURE__*/_jsx(MenuItem, {
|
|
46
49
|
onClick: onSortMenuItemClick,
|
|
47
50
|
"data-value": "desc",
|
|
48
51
|
disabled: sortDirection === 'desc',
|
|
49
52
|
children: apiRef.current.getLocaleText('columnMenuSortDesc')
|
|
50
|
-
})]
|
|
53
|
+
}) : null]
|
|
51
54
|
});
|
|
52
|
-
}
|
|
55
|
+
}
|
|
53
56
|
|
|
54
57
|
process.env.NODE_ENV !== "production" ? SortGridMenuItems.propTypes = {
|
|
55
58
|
// ----------------------------- Warning --------------------------------
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
const _excluded = ["style"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import * as ReactDOM from 'react-dom';
|
|
6
|
-
import { useForkRef } from '@mui/material/utils';
|
|
6
|
+
import { useForkRef, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
|
|
7
7
|
import { useGridApiContext } from '../../utils/useGridApiContext';
|
|
8
8
|
import { useGridRootProps } from '../../utils/useGridRootProps';
|
|
9
9
|
import { useGridSelector } from '../../utils/useGridSelector';
|
|
@@ -154,7 +154,7 @@ export const useGridVirtualScroller = props => {
|
|
|
154
154
|
lastColumnIndex
|
|
155
155
|
};
|
|
156
156
|
}, [disableVirtualization, getNearestIndexToRender, rowsMeta.positions.length, rootProps.autoHeight, rootProps.rowBuffer, currentPage.rows, columnPositions, visibleColumns.length, apiRef, containerWidth]);
|
|
157
|
-
|
|
157
|
+
useEnhancedEffect(() => {
|
|
158
158
|
if (disableVirtualization) {
|
|
159
159
|
renderZoneRef.current.style.transform = `translate3d(0px, 0px, 0px)`;
|
|
160
160
|
} else {
|
|
@@ -163,7 +163,7 @@ export const useGridVirtualScroller = props => {
|
|
|
163
163
|
rootRef.current.scrollTop = 0;
|
|
164
164
|
}
|
|
165
165
|
}, [disableVirtualization]);
|
|
166
|
-
|
|
166
|
+
useEnhancedEffect(() => {
|
|
167
167
|
setContainerWidth(rootRef.current.clientWidth);
|
|
168
168
|
}, [rowsMeta.currentPageTotalHeight]);
|
|
169
169
|
const handleResize = React.useCallback(params => {
|
|
@@ -224,7 +224,7 @@ export const useGridVirtualScroller = props => {
|
|
|
224
224
|
});
|
|
225
225
|
prevRenderContext.current = nextRenderContext;
|
|
226
226
|
}, [apiRef, setRenderContext, prevRenderContext, currentPage.rows.length, rootProps.rowBuffer]);
|
|
227
|
-
|
|
227
|
+
useEnhancedEffect(() => {
|
|
228
228
|
if (containerWidth == null) {
|
|
229
229
|
return;
|
|
230
230
|
}
|
package/modern/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.SortGridMenuItems =
|
|
8
|
+
exports.SortGridMenuItems = SortGridMenuItems;
|
|
9
9
|
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
@@ -19,19 +19,25 @@ var _gridSortingSelector = require("../../../hooks/features/sorting/gridSortingS
|
|
|
19
19
|
|
|
20
20
|
var _useGridApiContext = require("../../../hooks/utils/useGridApiContext");
|
|
21
21
|
|
|
22
|
+
var _useGridRootProps = require("../../../hooks/utils/useGridRootProps");
|
|
23
|
+
|
|
22
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
25
|
|
|
24
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
27
|
|
|
26
28
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
function SortGridMenuItems(props) {
|
|
31
|
+
var _column$sortingOrder;
|
|
32
|
+
|
|
29
33
|
const {
|
|
30
34
|
column,
|
|
31
35
|
onClick
|
|
32
36
|
} = props;
|
|
33
37
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
34
38
|
const sortModel = (0, _useGridSelector.useGridSelector)(apiRef, _gridSortingSelector.gridSortModelSelector);
|
|
39
|
+
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
40
|
+
const sortingOrder = (_column$sortingOrder = column.sortingOrder) != null ? _column$sortingOrder : rootProps.sortingOrder;
|
|
35
41
|
const sortDirection = React.useMemo(() => {
|
|
36
42
|
if (!column) {
|
|
37
43
|
return null;
|
|
@@ -51,25 +57,24 @@ const SortGridMenuItems = props => {
|
|
|
51
57
|
}
|
|
52
58
|
|
|
53
59
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
54
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
|
|
60
|
+
children: [sortingOrder.includes(null) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
|
|
55
61
|
onClick: onSortMenuItemClick,
|
|
56
62
|
disabled: sortDirection == null,
|
|
57
63
|
children: apiRef.current.getLocaleText('columnMenuUnsort')
|
|
58
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
|
|
64
|
+
}) : null, sortingOrder.includes('asc') ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
|
|
59
65
|
onClick: onSortMenuItemClick,
|
|
60
66
|
"data-value": "asc",
|
|
61
67
|
disabled: sortDirection === 'asc',
|
|
62
68
|
children: apiRef.current.getLocaleText('columnMenuSortAsc')
|
|
63
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
|
|
69
|
+
}) : null, sortingOrder.includes('desc') ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
|
|
64
70
|
onClick: onSortMenuItemClick,
|
|
65
71
|
"data-value": "desc",
|
|
66
72
|
disabled: sortDirection === 'desc',
|
|
67
73
|
children: apiRef.current.getLocaleText('columnMenuSortDesc')
|
|
68
|
-
})]
|
|
74
|
+
}) : null]
|
|
69
75
|
});
|
|
70
|
-
}
|
|
76
|
+
}
|
|
71
77
|
|
|
72
|
-
exports.SortGridMenuItems = SortGridMenuItems;
|
|
73
78
|
process.env.NODE_ENV !== "production" ? SortGridMenuItems.propTypes = {
|
|
74
79
|
// ----------------------------- Warning --------------------------------
|
|
75
80
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -195,7 +195,7 @@ const useGridVirtualScroller = props => {
|
|
|
195
195
|
lastColumnIndex
|
|
196
196
|
};
|
|
197
197
|
}, [disableVirtualization, getNearestIndexToRender, rowsMeta.positions.length, rootProps.autoHeight, rootProps.rowBuffer, currentPage.rows, columnPositions, visibleColumns.length, apiRef, containerWidth]);
|
|
198
|
-
|
|
198
|
+
(0, _utils.unstable_useEnhancedEffect)(() => {
|
|
199
199
|
if (disableVirtualization) {
|
|
200
200
|
renderZoneRef.current.style.transform = `translate3d(0px, 0px, 0px)`;
|
|
201
201
|
} else {
|
|
@@ -204,7 +204,7 @@ const useGridVirtualScroller = props => {
|
|
|
204
204
|
rootRef.current.scrollTop = 0;
|
|
205
205
|
}
|
|
206
206
|
}, [disableVirtualization]);
|
|
207
|
-
|
|
207
|
+
(0, _utils.unstable_useEnhancedEffect)(() => {
|
|
208
208
|
setContainerWidth(rootRef.current.clientWidth);
|
|
209
209
|
}, [rowsMeta.currentPageTotalHeight]);
|
|
210
210
|
const handleResize = React.useCallback(params => {
|
|
@@ -265,7 +265,7 @@ const useGridVirtualScroller = props => {
|
|
|
265
265
|
});
|
|
266
266
|
prevRenderContext.current = nextRenderContext;
|
|
267
267
|
}, [apiRef, setRenderContext, prevRenderContext, currentPage.rows.length, rootProps.rowBuffer]);
|
|
268
|
-
|
|
268
|
+
(0, _utils.unstable_useEnhancedEffect)(() => {
|
|
269
269
|
if (containerWidth == null) {
|
|
270
270
|
return;
|
|
271
271
|
}
|
package/node/index.js
CHANGED