@mui/x-data-grid-pro 7.0.0-beta.4 → 7.0.0-beta.5
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 +138 -14
- package/DataGridPro/DataGridPro.js +1 -0
- package/components/GridPinnedRows.js +9 -1
- package/esm/DataGridPro/DataGridPro.js +2 -0
- package/esm/components/GridPinnedRows.js +10 -2
- package/esm/hooks/features/columnResize/useGridColumnResize.js +29 -0
- package/esm/hooks/features/lazyLoader/useGridLazyLoader.js +22 -31
- package/esm/utils/releaseInfo.js +1 -1
- package/hooks/features/columnResize/useGridColumnResize.js +29 -0
- package/hooks/features/lazyLoader/useGridLazyLoader.js +21 -30
- package/index.js +1 -1
- package/modern/DataGridPro/DataGridPro.js +2 -0
- package/modern/components/GridPinnedRows.js +10 -2
- package/modern/hooks/features/columnResize/useGridColumnResize.js +29 -0
- package/modern/hooks/features/lazyLoader/useGridLazyLoader.js +22 -31
- package/modern/index.js +1 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/package.json +2 -2
- package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,89 @@
|
|
|
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
|
+
## 7.0.0-beta.5
|
|
7
|
+
|
|
8
|
+
_Mar 1, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🎁 Add `getSortComparator` for more advanced sorting behaviors (#12215) @cherniavskii
|
|
13
|
+
- 🚀 Add `use client` directive to the Grid packages (#11803) @MBilalShafi
|
|
14
|
+
- 🌍 Improve Korean (ko-KR) and Chinese (zh-CN) locales on the Pickers
|
|
15
|
+
- 🐞 Bugfixes
|
|
16
|
+
- 📚 Documentation improvements
|
|
17
|
+
|
|
18
|
+
### Data Grid
|
|
19
|
+
|
|
20
|
+
#### `@mui/x-data-grid@7.0.0-beta.5`
|
|
21
|
+
|
|
22
|
+
- [DataGrid] Add `getSortComparator` for more advanced sorting behaviors (#12215) @cherniavskii
|
|
23
|
+
- [DataGrid] Add `use client` directive to the Grid packages (#11803) @MBilalShafi
|
|
24
|
+
- [DataGrid] Fix `disableResetButton` and `disableShowHideToggle` flags to not exclude each other (#12169) @adyry
|
|
25
|
+
- [DataGrid] Fix cell range classnames (#12230) @romgrk
|
|
26
|
+
- [DataGrid] Fix wrong offset for right-pinned columns when toggling dark/light modes (#12233) @cherniavskii
|
|
27
|
+
- [DataGrid] Improve row virtualization and rendering performance (#12247) @romgrk
|
|
28
|
+
- [DataGrid] Improve performance by removing `querySelector` call (#12229) @romgrk
|
|
29
|
+
- [DataGrid] Fix `onColumnWidthChange` called before autosize affects column width (#12140) @shaharyar-shamshi
|
|
30
|
+
- [DataGrid] Fix boolean "is" filter (#12117) @shaharyar-shamshi
|
|
31
|
+
- [DataGrid] Fix `upsertFilterItems` removing filters that are not part of the update (#11954) @gitstart
|
|
32
|
+
- [DataGrid] Render scrollbars only if there is scroll (#12265) @cherniavskii
|
|
33
|
+
|
|
34
|
+
#### `@mui/x-data-grid-pro@7.0.0-beta.5` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
35
|
+
|
|
36
|
+
Same changes as in `@mui/x-data-grid@7.0.0-beta.5`, plus:
|
|
37
|
+
|
|
38
|
+
- [DataGridPro] Fix column resize errors on MacOS with automatic scrollbars enabled (#12217) @cherniavskii
|
|
39
|
+
- [DataGridPro] Fix lazy-loading crash (#12080) @romgrk
|
|
40
|
+
- [DataGridPro] Fix useGridRows not giving error on reversed data (#10821) @martijn-basesoft
|
|
41
|
+
|
|
42
|
+
#### `@mui/x-data-grid-premium@7.0.0-beta.5` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
43
|
+
|
|
44
|
+
Same changes as in `@mui/x-data-grid-pro@7.0.0-beta.5`, plus:
|
|
45
|
+
|
|
46
|
+
- [DataGridPremium] Make clipboard copy respect the sorting during cell selection (#12235) @MBilalShafi
|
|
47
|
+
|
|
48
|
+
### Date Pickers
|
|
49
|
+
|
|
50
|
+
#### `@mui/x-date-pickers@7.0.0-beta.5`
|
|
51
|
+
|
|
52
|
+
- [pickers] Fix toolbar components props handling (#12211) @LukasTy
|
|
53
|
+
- [l10n] Improve Chinese (zh-CN) locale (#12245) @headironc
|
|
54
|
+
- [l10n] Improve Korean (ko-KR) locale (#12192) @Luzi
|
|
55
|
+
|
|
56
|
+
#### `@mui/x-date-pickers-pro@7.0.0-beta.5` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
57
|
+
|
|
58
|
+
Same changes as in `@mui/x-date-pickers@7.0.0-beta.5`.
|
|
59
|
+
|
|
60
|
+
- [DateTimeRangePicker] Fix validation behavior (#12243) @LukasTy
|
|
61
|
+
|
|
62
|
+
### Charts / `@mui/x-charts@7.0.0-beta.5`
|
|
63
|
+
|
|
64
|
+
- [charts] Fix grid duplicated key (#12208) @alexfauquette
|
|
65
|
+
|
|
66
|
+
### Tree View / `@mui/x-tree-view@7.0.0-beta.5`
|
|
67
|
+
|
|
68
|
+
- [TreeView] Add public API and expose focus method (#12143) @noraleonte
|
|
69
|
+
|
|
70
|
+
### Docs
|
|
71
|
+
|
|
72
|
+
- [docs] Fix image layout shift when loading @oliviertassinari
|
|
73
|
+
- [docs] Match Material UI repo comment for redirections @oliviertassinari
|
|
74
|
+
- [docs] Non breaking spaces @oliviertassinari
|
|
75
|
+
- [docs] Polish the Date Picker playground (#11869) @zanivan
|
|
76
|
+
- [docs] Standardize WAI-ARIA references @oliviertassinari
|
|
77
|
+
|
|
78
|
+
### Core
|
|
79
|
+
|
|
80
|
+
- [core] Allow local docs next.js settings (#12227) @romgrk
|
|
81
|
+
- [core] Remove grid folder from `getComponentInfo` RegExp (#12241) @flaviendelangle
|
|
82
|
+
- [core] Remove `window.` reference for common globals @oliviertassinari
|
|
83
|
+
- [core] Use runtime agnostic setTimeout type @oliviertassinari
|
|
84
|
+
- [docs-infra] Fix Stack Overflow breaking space @oliviertassinari
|
|
85
|
+
- [docs-infra] Fix missing non breaking spaces @oliviertassinari
|
|
86
|
+
- [github] Update `no-response` workflow (#12193) @MBilalShafi
|
|
87
|
+
- [infra] Fix missing permission reset @oliviertassinari
|
|
88
|
+
|
|
6
89
|
## 7.0.0-beta.4
|
|
7
90
|
|
|
8
91
|
_Feb 23, 2024_
|
|
@@ -49,7 +132,7 @@ Same changes as in `@mui/x-data-grid-pro@7.0.0-beta.4`.
|
|
|
49
132
|
<DateField
|
|
50
133
|
- selectedSections={{ startIndex: 0, endIndex: 0 }}
|
|
51
134
|
+ selectedSections={0}
|
|
52
|
-
|
|
135
|
+
|
|
53
136
|
// If the field has 3 sections
|
|
54
137
|
- selectedSections={{ startIndex: 0, endIndex: 2 }}
|
|
55
138
|
+ selectedSections="all"
|
|
@@ -68,20 +151,20 @@ Same changes as in `@mui/x-data-grid-pro@7.0.0-beta.4`.
|
|
|
68
151
|
+ enableAccessibleFieldDOMStructure,
|
|
69
152
|
// ... rest of the props you are using
|
|
70
153
|
} = props;
|
|
71
|
-
|
|
154
|
+
|
|
72
155
|
return ( /* Some UI to edit the date */ )
|
|
73
156
|
}
|
|
74
|
-
|
|
157
|
+
|
|
75
158
|
function MyCustomField(props) {
|
|
76
159
|
const fieldResponse = useDateField<Dayjs, false, typeof textFieldProps>({
|
|
77
160
|
...props,
|
|
78
161
|
+ // If you only support one DOM structure, we advise you to hardcode it here to avoid unwanted switches in your application
|
|
79
162
|
+ enableAccessibleFieldDOMStructure: false,
|
|
80
163
|
});
|
|
81
|
-
|
|
164
|
+
|
|
82
165
|
return <MyCustomTextField ref={ref} {...fieldResponse} />;
|
|
83
166
|
}
|
|
84
|
-
|
|
167
|
+
|
|
85
168
|
function App() {
|
|
86
169
|
return <DatePicker slots={{ field: MyCustomField }} />;
|
|
87
170
|
}
|
|
@@ -2352,6 +2435,47 @@ Here is an example of the renaming for the `<ChartsTooltip />` component.
|
|
|
2352
2435
|
- [core] Update release instructions as per v7 configuration (#10962) @MBilalShafi
|
|
2353
2436
|
- [license] Correctly throw errors (#10924) @oliviertassinari
|
|
2354
2437
|
|
|
2438
|
+
## 6.19.6
|
|
2439
|
+
|
|
2440
|
+
_Mar 1, 2024_
|
|
2441
|
+
|
|
2442
|
+
We'd like to offer a big thanks to the 4 contributors who made this release possible. Here are some highlights ✨:
|
|
2443
|
+
|
|
2444
|
+
- 🌍 Improve Korean (ko-KR) and Chinese (zh-CN) locales on the Pickers
|
|
2445
|
+
- 🐞 Bugfixes
|
|
2446
|
+
- 📚 Documentation improvements
|
|
2447
|
+
|
|
2448
|
+
### Data Grid
|
|
2449
|
+
|
|
2450
|
+
#### `@mui/x-data-grid@6.19.6`
|
|
2451
|
+
|
|
2452
|
+
- [DataGrid] Fix error when existing rows are passed to `replaceRows` (@martijn-basesoft)
|
|
2453
|
+
|
|
2454
|
+
#### `@mui/x-data-grid-pro@6.19.6` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
2455
|
+
|
|
2456
|
+
Same changes as in `@mui/x-data-grid@6.19.6`.
|
|
2457
|
+
|
|
2458
|
+
#### `@mui/x-data-grid-premium@6.19.6` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
2459
|
+
|
|
2460
|
+
Same changes as in `@mui/x-data-grid-pro@6.19.6`, plus:
|
|
2461
|
+
|
|
2462
|
+
- [DataGridPremium] Make clipboard copy respect the sorting during cell selection (#12255) @MBilalShafi
|
|
2463
|
+
|
|
2464
|
+
### Date Pickers
|
|
2465
|
+
|
|
2466
|
+
#### `@mui/x-date-pickers@6.19.6`
|
|
2467
|
+
|
|
2468
|
+
- [l10n] Improve Chinese (zh-CN) locale (#12250) @headironc
|
|
2469
|
+
- [l10n] Improve Korean (ko-KR) locale (#12186) @Luzi
|
|
2470
|
+
|
|
2471
|
+
#### `@mui/x-date-pickers-pro@6.19.6` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
2472
|
+
|
|
2473
|
+
Same changes as in `@mui/x-date-pickers@6.19.6`.
|
|
2474
|
+
|
|
2475
|
+
### Docs
|
|
2476
|
+
|
|
2477
|
+
- [docs] Update lazy loading demo to show skeleton rows during initial rows fetch (#12062) @cherniavskii
|
|
2478
|
+
|
|
2355
2479
|
## 6.19.5
|
|
2356
2480
|
|
|
2357
2481
|
_Feb 23, 2024_
|
|
@@ -2394,8 +2518,8 @@ Same changes as in `@mui/x-date-pickers@6.19.5`.
|
|
|
2394
2518
|
|
|
2395
2519
|
- [docs] Clarify Pickers 'Component composition' section (#12147) @LukasTy
|
|
2396
2520
|
- [docs] Fix 301 redirection to StackBlitz @oliviertassinari
|
|
2397
|
-
- [docs] Fix 301 to Material
|
|
2398
|
-
- [docs] Fix 301 to Material
|
|
2521
|
+
- [docs] Fix 301 to Material UI @oliviertassinari
|
|
2522
|
+
- [docs] Fix 301 to Material UI @oliviertassinari
|
|
2399
2523
|
- [docs] Fix 404 links to translation source @oliviertassinari
|
|
2400
2524
|
- [docs] Fix dead link to translations @oliviertassinari
|
|
2401
2525
|
- [docs] Fix the Treemap illustration (#12189) @danilo-leal
|
|
@@ -4264,7 +4388,7 @@ We'd like to offer a big thanks to the 13 contributors who made this release pos
|
|
|
4264
4388
|
|
|
4265
4389
|
#### `@mui/x-data-grid@6.9.1`
|
|
4266
4390
|
|
|
4267
|
-
- [DataGrid] Add Joy
|
|
4391
|
+
- [DataGrid] Add Joy UI `tooltip` and `loadingOverlay` slots (#9028) @cherniavskii
|
|
4268
4392
|
- [DataGrid] Add section about enabling pagination on Pro and Premium (#8759) @joserodolfofreitas
|
|
4269
4393
|
- [DataGrid] Don't forward `editCellState` prop to DOM element (#9501) @m4theushw
|
|
4270
4394
|
- [DataGrid] Add experimental API for faster filtering performance (#9254) @romgrk
|
|
@@ -4395,7 +4519,7 @@ Same changes as in `@mui/x-date-pickers@6.9.0`.
|
|
|
4395
4519
|
- [docs] Fix random screenshot generation (#9364) @cherniavskii
|
|
4396
4520
|
- [docs] Remove random generation from chart doc example (#9343) @flaviendelangle
|
|
4397
4521
|
- [docs] Sync h1 with sidenav link (#9252) @oliviertassinari
|
|
4398
|
-
- [docs] Use the mui-x Stack
|
|
4522
|
+
- [docs] Use the mui-x Stack Overflow tag (#9352) @oliviertassinari
|
|
4399
4523
|
|
|
4400
4524
|
### Core
|
|
4401
4525
|
|
|
@@ -4722,8 +4846,8 @@ We'd like to offer a big thanks to the 12 contributors who made this release pos
|
|
|
4722
4846
|
|
|
4723
4847
|
- [DataGrid] Fix DataGrid rendering in JSDOM (#8968) @cherniavskii
|
|
4724
4848
|
- [DataGrid] Fix layout when rendered inside a parent with `display: grid` (#8577) @cherniavskii
|
|
4725
|
-
- [DataGrid] Add Joy
|
|
4726
|
-
- [DataGrid] Add Joy
|
|
4849
|
+
- [DataGrid] Add Joy UI icon slots (#8940) @siriwatknp
|
|
4850
|
+
- [DataGrid] Add Joy UI pagination slot (#8871) @cherniavskii
|
|
4727
4851
|
- [DataGrid] Extract `baseChip` slot (#8748) @cherniavskii
|
|
4728
4852
|
- [DataGridPremium] Implement Clipboard import (#7389) @cherniavskii
|
|
4729
4853
|
- [l10n] Improve French (fr-FR) locale (#8825) @allereaugabriel
|
|
@@ -4773,7 +4897,7 @@ We'd like to offer a big thanks to the 7 contributors who made this release poss
|
|
|
4773
4897
|
- [DataGrid] Fix falsy filter values not showing in filter button tooltip (#8550) @ithrforu
|
|
4774
4898
|
- [DataGrid] Fix missing watermark in Pro and Premium packages (#8797) @cherniavskii
|
|
4775
4899
|
- [DataGrid] Remove unwarranted warning log (#8847) @romgrk
|
|
4776
|
-
- [DataGrid] Add Joy
|
|
4900
|
+
- [DataGrid] Add Joy UI slots (`Select`, `SelectOption`, `InputLabel`, `FormControl`) (#8747) @cherniavskii
|
|
4777
4901
|
- [DataGridPremium] Fix expanded groups being collapsed after calling `updateRows` (#8823) @cherniavskii
|
|
4778
4902
|
|
|
4779
4903
|
### `@mui/x-date-pickers@6.3.1` / `@mui/x-date-pickers-pro@6.3.1`
|
|
@@ -4824,7 +4948,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
|
|
|
4824
4948
|
- [DataGrid] Add overlay classes to `gridClasses` (#8686) @lindapaiste
|
|
4825
4949
|
- [DataGrid] Avoid passing `api` prop to div (#8679) @someden
|
|
4826
4950
|
- [DataGrid] Fix 'ResizeObserver loop limit exceeded' error (#8744) @m4theushw
|
|
4827
|
-
- [DataGrid] Add Joy
|
|
4951
|
+
- [DataGrid] Add Joy UI slots (button and switch) (#8699) @siriwatknp
|
|
4828
4952
|
- [DataGrid] Fix aggregation label alignment (#8694) @joserodolfofreitas
|
|
4829
4953
|
- [DataGridPremium] Fix infinite loop when updating grouped rows (#8693) @cherniavskii
|
|
4830
4954
|
- [DataGridPro] Fix error after updating `columns` and `columnGroupingModel` at once (#8730) @cherniavskii
|
|
@@ -4886,7 +5010,7 @@ We'd like to offer a big thanks to the 9 contributors who made this release poss
|
|
|
4886
5010
|
#### Changes
|
|
4887
5011
|
|
|
4888
5012
|
- [DataGrid] Add `getTogglableColumns` to `Hide all` and `Show all` actions (#8496) @MBilalShafi
|
|
4889
|
-
- [DataGrid] Add Grid + Joy
|
|
5013
|
+
- [DataGrid] Add Grid + Joy UI experiment page (#8067) @cherniavskii
|
|
4890
5014
|
- [DataGrid] Fix print style when rendering inside Shadow DOM (#8656) @Bwatermelon
|
|
4891
5015
|
- [DataGrid] Replace `GridAutoSizer` with `ResizeObserver` (#8091) @m4theushw
|
|
4892
5016
|
- [DataGrid] Use stable ID for the placeholder filter item (#8603) @m4theushw
|
|
@@ -30,10 +30,18 @@ function GridPinnedRows(_ref) {
|
|
|
30
30
|
other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
31
31
|
const classes = useUtilityClasses();
|
|
32
32
|
const apiRef = (0, _internals.useGridPrivateApiContext)();
|
|
33
|
+
const renderContext = (0, _xDataGrid.useGridSelector)(apiRef, _internals.gridRenderContextSelector);
|
|
33
34
|
const pinnedRowsData = (0, _xDataGrid.useGridSelector)(apiRef, _internals.gridPinnedRowsSelector);
|
|
35
|
+
const rows = pinnedRowsData[position];
|
|
34
36
|
const pinnedRows = virtualScroller.getRows({
|
|
35
37
|
position,
|
|
36
|
-
rows
|
|
38
|
+
rows,
|
|
39
|
+
renderContext: React.useMemo(() => ({
|
|
40
|
+
firstRowIndex: 0,
|
|
41
|
+
lastRowIndex: rows.length,
|
|
42
|
+
firstColumnIndex: renderContext.firstColumnIndex,
|
|
43
|
+
lastColumnIndex: renderContext.lastColumnIndex
|
|
44
|
+
}), [rows, renderContext.firstColumnIndex, renderContext.lastColumnIndex])
|
|
37
45
|
});
|
|
38
46
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", (0, _extends2.default)({}, other, {
|
|
39
47
|
className: (0, _clsx.default)(classes.root, other.className, _xDataGrid.gridClasses[`pinnedRows--${position}`]),
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
7
7
|
import { getDataGridUtilityClass, gridClasses, useGridSelector } from '@mui/x-data-grid';
|
|
8
|
-
import { gridPinnedRowsSelector, useGridPrivateApiContext } from '@mui/x-data-grid/internals';
|
|
8
|
+
import { gridPinnedRowsSelector, gridRenderContextSelector, useGridPrivateApiContext } from '@mui/x-data-grid/internals';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
const useUtilityClasses = () => {
|
|
11
11
|
const slots = {
|
|
@@ -21,10 +21,18 @@ export function GridPinnedRows(_ref) {
|
|
|
21
21
|
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
22
22
|
const classes = useUtilityClasses();
|
|
23
23
|
const apiRef = useGridPrivateApiContext();
|
|
24
|
+
const renderContext = useGridSelector(apiRef, gridRenderContextSelector);
|
|
24
25
|
const pinnedRowsData = useGridSelector(apiRef, gridPinnedRowsSelector);
|
|
26
|
+
const rows = pinnedRowsData[position];
|
|
25
27
|
const pinnedRows = virtualScroller.getRows({
|
|
26
28
|
position,
|
|
27
|
-
rows
|
|
29
|
+
rows,
|
|
30
|
+
renderContext: React.useMemo(() => ({
|
|
31
|
+
firstRowIndex: 0,
|
|
32
|
+
lastRowIndex: rows.length,
|
|
33
|
+
firstColumnIndex: renderContext.firstColumnIndex,
|
|
34
|
+
lastColumnIndex: renderContext.lastColumnIndex
|
|
35
|
+
}), [rows, renderContext.firstColumnIndex, renderContext.lastColumnIndex])
|
|
28
36
|
});
|
|
29
37
|
return /*#__PURE__*/_jsx("div", _extends({}, other, {
|
|
30
38
|
className: clsx(classes.root, other.className, gridClasses[`pinnedRows--${position}`]),
|
|
@@ -177,6 +177,7 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
177
177
|
const theme = useTheme();
|
|
178
178
|
const logger = useGridLogger(apiRef, 'useGridColumnResize');
|
|
179
179
|
const colDefRef = React.useRef();
|
|
180
|
+
const previousMouseClickEvent = React.useRef();
|
|
180
181
|
const columnHeaderElementRef = React.useRef();
|
|
181
182
|
const headerFilterElementRef = React.useRef();
|
|
182
183
|
const groupHeaderElementsRef = React.useRef([]);
|
|
@@ -252,6 +253,20 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
252
253
|
const finishResize = nativeEvent => {
|
|
253
254
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
254
255
|
stopListening();
|
|
256
|
+
|
|
257
|
+
// Prevent double-clicks from being interpreted as two separate clicks
|
|
258
|
+
if (previousMouseClickEvent.current) {
|
|
259
|
+
const prevEvent = previousMouseClickEvent.current;
|
|
260
|
+
const prevTimeStamp = prevEvent.timeStamp;
|
|
261
|
+
const prevClientX = prevEvent.clientX;
|
|
262
|
+
const prevClientY = prevEvent.clientY;
|
|
263
|
+
|
|
264
|
+
// Check if the current event is part of a double-click
|
|
265
|
+
if (nativeEvent.timeStamp - prevTimeStamp < 300 && nativeEvent.clientX === prevClientX && nativeEvent.clientY === prevClientY) {
|
|
266
|
+
previousMouseClickEvent.current = undefined;
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
255
270
|
if (colDefRef.current) {
|
|
256
271
|
apiRef.current.setColumnWidth(colDefRef.current.field, colDefRef.current.width);
|
|
257
272
|
logger.debug(`Updating col ${colDefRef.current.field} with new width: ${colDefRef.current.width}`);
|
|
@@ -407,6 +422,7 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
407
422
|
storeReferences(colDef, event.currentTarget, event.clientX);
|
|
408
423
|
const doc = ownerDocument(apiRef.current.rootElementRef.current);
|
|
409
424
|
doc.body.style.cursor = 'col-resize';
|
|
425
|
+
previousMouseClickEvent.current = event.nativeEvent;
|
|
410
426
|
doc.addEventListener('mousemove', handleResizeMouseMove);
|
|
411
427
|
doc.addEventListener('mouseup', handleResizeMouseUp);
|
|
412
428
|
|
|
@@ -479,6 +495,16 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
479
495
|
}
|
|
480
496
|
}
|
|
481
497
|
apiRef.current.updateColumns(newColumns);
|
|
498
|
+
newColumns.forEach((newColumn, index) => {
|
|
499
|
+
if (newColumn.width !== columns[index].width) {
|
|
500
|
+
const width = newColumn.width;
|
|
501
|
+
apiRef.current.publishEvent('columnWidthChange', {
|
|
502
|
+
element: apiRef.current.getColumnHeaderElement(newColumn.field),
|
|
503
|
+
colDef: newColumn,
|
|
504
|
+
width
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
});
|
|
482
508
|
} finally {
|
|
483
509
|
apiRef.current.unstable_setColumnVirtualization(true);
|
|
484
510
|
isAutosizingRef.current = false;
|
|
@@ -514,5 +540,8 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
514
540
|
useGridApiOptionHandler(apiRef, 'columnWidthChange', props.onColumnWidthChange);
|
|
515
541
|
};
|
|
516
542
|
function updateProperty(element, property, delta) {
|
|
543
|
+
if (!element) {
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
517
546
|
element.style[property] = `${parseInt(element.style[property], 10) + delta}px`;
|
|
518
547
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useGridApiEventHandler, useGridSelector, gridSortModelSelector, gridFilterModelSelector, gridRenderContextSelector, useGridApiOptionHandler } from '@mui/x-data-grid';
|
|
3
|
-
import {
|
|
3
|
+
import { getVisibleRows } from '@mui/x-data-grid/internals';
|
|
4
4
|
function findSkeletonRowsSection({
|
|
5
5
|
apiRef,
|
|
6
6
|
visibleRows,
|
|
@@ -37,10 +37,9 @@ function findSkeletonRowsSection({
|
|
|
37
37
|
}
|
|
38
38
|
function isLazyLoadingDisabled({
|
|
39
39
|
lazyLoadingFeatureFlag,
|
|
40
|
-
rowsLoadingMode
|
|
41
|
-
gridDimensions
|
|
40
|
+
rowsLoadingMode
|
|
42
41
|
}) {
|
|
43
|
-
if (!lazyLoadingFeatureFlag
|
|
42
|
+
if (!lazyLoadingFeatureFlag) {
|
|
44
43
|
return true;
|
|
45
44
|
}
|
|
46
45
|
if (rowsLoadingMode !== 'server') {
|
|
@@ -57,7 +56,6 @@ function isLazyLoadingDisabled({
|
|
|
57
56
|
*/
|
|
58
57
|
export const useGridLazyLoader = (privateApiRef, props) => {
|
|
59
58
|
var _props$experimentalFe;
|
|
60
|
-
const visibleRows = useGridVisibleRows(privateApiRef, props);
|
|
61
59
|
const sortModel = useGridSelector(privateApiRef, gridSortModelSelector);
|
|
62
60
|
const filterModel = useGridSelector(privateApiRef, gridFilterModelSelector);
|
|
63
61
|
const renderedRowsIntervalCache = React.useRef({
|
|
@@ -67,13 +65,12 @@ export const useGridLazyLoader = (privateApiRef, props) => {
|
|
|
67
65
|
const {
|
|
68
66
|
lazyLoading
|
|
69
67
|
} = (_props$experimentalFe = props.experimentalFeatures) != null ? _props$experimentalFe : {};
|
|
68
|
+
const isDisabled = isLazyLoadingDisabled({
|
|
69
|
+
lazyLoadingFeatureFlag: lazyLoading,
|
|
70
|
+
rowsLoadingMode: props.rowsLoadingMode
|
|
71
|
+
});
|
|
70
72
|
const handleRenderedRowsIntervalChange = React.useCallback(params => {
|
|
71
|
-
|
|
72
|
-
if (isLazyLoadingDisabled({
|
|
73
|
-
lazyLoadingFeatureFlag: lazyLoading,
|
|
74
|
-
rowsLoadingMode: props.rowsLoadingMode,
|
|
75
|
-
gridDimensions: dimensions
|
|
76
|
-
})) {
|
|
73
|
+
if (isDisabled) {
|
|
77
74
|
return;
|
|
78
75
|
}
|
|
79
76
|
const fetchRowsParams = {
|
|
@@ -85,10 +82,18 @@ export const useGridLazyLoader = (privateApiRef, props) => {
|
|
|
85
82
|
if (renderedRowsIntervalCache.current.firstRowToRender === params.firstRowIndex && renderedRowsIntervalCache.current.lastRowToRender === params.lastRowIndex) {
|
|
86
83
|
return;
|
|
87
84
|
}
|
|
85
|
+
renderedRowsIntervalCache.current = {
|
|
86
|
+
firstRowToRender: params.firstRowIndex,
|
|
87
|
+
lastRowToRender: params.lastRowIndex
|
|
88
|
+
};
|
|
88
89
|
if (sortModel.length === 0 && filterModel.items.length === 0) {
|
|
90
|
+
const currentVisibleRows = getVisibleRows(privateApiRef, {
|
|
91
|
+
pagination: props.pagination,
|
|
92
|
+
paginationMode: props.paginationMode
|
|
93
|
+
});
|
|
89
94
|
const skeletonRowsSection = findSkeletonRowsSection({
|
|
90
95
|
apiRef: privateApiRef,
|
|
91
|
-
visibleRows:
|
|
96
|
+
visibleRows: currentVisibleRows.rows,
|
|
92
97
|
range: {
|
|
93
98
|
firstRowIndex: params.firstRowIndex,
|
|
94
99
|
lastRowIndex: params.lastRowIndex
|
|
@@ -100,19 +105,10 @@ export const useGridLazyLoader = (privateApiRef, props) => {
|
|
|
100
105
|
fetchRowsParams.firstRowToRender = skeletonRowsSection.firstRowIndex;
|
|
101
106
|
fetchRowsParams.lastRowToRender = skeletonRowsSection.lastRowIndex;
|
|
102
107
|
}
|
|
103
|
-
renderedRowsIntervalCache.current = {
|
|
104
|
-
firstRowToRender: params.firstRowIndex,
|
|
105
|
-
lastRowToRender: params.lastRowIndex
|
|
106
|
-
};
|
|
107
108
|
privateApiRef.current.publishEvent('fetchRows', fetchRowsParams);
|
|
108
|
-
}, [privateApiRef, props.
|
|
109
|
+
}, [privateApiRef, isDisabled, props.pagination, props.paginationMode, sortModel, filterModel]);
|
|
109
110
|
const handleGridSortModelChange = React.useCallback(newSortModel => {
|
|
110
|
-
|
|
111
|
-
if (isLazyLoadingDisabled({
|
|
112
|
-
lazyLoadingFeatureFlag: lazyLoading,
|
|
113
|
-
rowsLoadingMode: props.rowsLoadingMode,
|
|
114
|
-
gridDimensions: dimensions
|
|
115
|
-
})) {
|
|
111
|
+
if (isDisabled) {
|
|
116
112
|
return;
|
|
117
113
|
}
|
|
118
114
|
privateApiRef.current.requestPipeProcessorsApplication('hydrateRows');
|
|
@@ -124,14 +120,9 @@ export const useGridLazyLoader = (privateApiRef, props) => {
|
|
|
124
120
|
filterModel
|
|
125
121
|
};
|
|
126
122
|
privateApiRef.current.publishEvent('fetchRows', fetchRowsParams);
|
|
127
|
-
}, [privateApiRef,
|
|
123
|
+
}, [privateApiRef, isDisabled, filterModel]);
|
|
128
124
|
const handleGridFilterModelChange = React.useCallback(newFilterModel => {
|
|
129
|
-
|
|
130
|
-
if (isLazyLoadingDisabled({
|
|
131
|
-
lazyLoadingFeatureFlag: lazyLoading,
|
|
132
|
-
rowsLoadingMode: props.rowsLoadingMode,
|
|
133
|
-
gridDimensions: dimensions
|
|
134
|
-
})) {
|
|
125
|
+
if (isDisabled) {
|
|
135
126
|
return;
|
|
136
127
|
}
|
|
137
128
|
privateApiRef.current.requestPipeProcessorsApplication('hydrateRows');
|
|
@@ -143,7 +134,7 @@ export const useGridLazyLoader = (privateApiRef, props) => {
|
|
|
143
134
|
filterModel: newFilterModel
|
|
144
135
|
};
|
|
145
136
|
privateApiRef.current.publishEvent('fetchRows', fetchRowsParams);
|
|
146
|
-
}, [privateApiRef,
|
|
137
|
+
}, [privateApiRef, isDisabled, sortModel]);
|
|
147
138
|
useGridApiEventHandler(privateApiRef, 'renderedRowsIntervalChange', handleRenderedRowsIntervalChange);
|
|
148
139
|
useGridApiEventHandler(privateApiRef, 'sortModelChange', handleGridSortModelChange);
|
|
149
140
|
useGridApiEventHandler(privateApiRef, 'filterModelChange', handleGridFilterModelChange);
|
package/esm/utils/releaseInfo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTcwOTM1NTYwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
|
@@ -185,6 +185,7 @@ const useGridColumnResize = (apiRef, props) => {
|
|
|
185
185
|
const theme = (0, _styles.useTheme)();
|
|
186
186
|
const logger = (0, _xDataGrid.useGridLogger)(apiRef, 'useGridColumnResize');
|
|
187
187
|
const colDefRef = React.useRef();
|
|
188
|
+
const previousMouseClickEvent = React.useRef();
|
|
188
189
|
const columnHeaderElementRef = React.useRef();
|
|
189
190
|
const headerFilterElementRef = React.useRef();
|
|
190
191
|
const groupHeaderElementsRef = React.useRef([]);
|
|
@@ -260,6 +261,20 @@ const useGridColumnResize = (apiRef, props) => {
|
|
|
260
261
|
const finishResize = nativeEvent => {
|
|
261
262
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
262
263
|
stopListening();
|
|
264
|
+
|
|
265
|
+
// Prevent double-clicks from being interpreted as two separate clicks
|
|
266
|
+
if (previousMouseClickEvent.current) {
|
|
267
|
+
const prevEvent = previousMouseClickEvent.current;
|
|
268
|
+
const prevTimeStamp = prevEvent.timeStamp;
|
|
269
|
+
const prevClientX = prevEvent.clientX;
|
|
270
|
+
const prevClientY = prevEvent.clientY;
|
|
271
|
+
|
|
272
|
+
// Check if the current event is part of a double-click
|
|
273
|
+
if (nativeEvent.timeStamp - prevTimeStamp < 300 && nativeEvent.clientX === prevClientX && nativeEvent.clientY === prevClientY) {
|
|
274
|
+
previousMouseClickEvent.current = undefined;
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
263
278
|
if (colDefRef.current) {
|
|
264
279
|
apiRef.current.setColumnWidth(colDefRef.current.field, colDefRef.current.width);
|
|
265
280
|
logger.debug(`Updating col ${colDefRef.current.field} with new width: ${colDefRef.current.width}`);
|
|
@@ -414,6 +429,7 @@ const useGridColumnResize = (apiRef, props) => {
|
|
|
414
429
|
storeReferences(colDef, event.currentTarget, event.clientX);
|
|
415
430
|
const doc = (0, _utils.unstable_ownerDocument)(apiRef.current.rootElementRef.current);
|
|
416
431
|
doc.body.style.cursor = 'col-resize';
|
|
432
|
+
previousMouseClickEvent.current = event.nativeEvent;
|
|
417
433
|
doc.addEventListener('mousemove', handleResizeMouseMove);
|
|
418
434
|
doc.addEventListener('mouseup', handleResizeMouseUp);
|
|
419
435
|
|
|
@@ -482,6 +498,16 @@ const useGridColumnResize = (apiRef, props) => {
|
|
|
482
498
|
}
|
|
483
499
|
}
|
|
484
500
|
apiRef.current.updateColumns(newColumns);
|
|
501
|
+
newColumns.forEach((newColumn, index) => {
|
|
502
|
+
if (newColumn.width !== columns[index].width) {
|
|
503
|
+
const width = newColumn.width;
|
|
504
|
+
apiRef.current.publishEvent('columnWidthChange', {
|
|
505
|
+
element: apiRef.current.getColumnHeaderElement(newColumn.field),
|
|
506
|
+
colDef: newColumn,
|
|
507
|
+
width
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
});
|
|
485
511
|
} finally {
|
|
486
512
|
apiRef.current.unstable_setColumnVirtualization(true);
|
|
487
513
|
isAutosizingRef.current = false;
|
|
@@ -515,5 +541,8 @@ const useGridColumnResize = (apiRef, props) => {
|
|
|
515
541
|
};
|
|
516
542
|
exports.useGridColumnResize = useGridColumnResize;
|
|
517
543
|
function updateProperty(element, property, delta) {
|
|
544
|
+
if (!element) {
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
518
547
|
element.style[property] = `${parseInt(element.style[property], 10) + delta}px`;
|
|
519
548
|
}
|
|
@@ -44,10 +44,9 @@ function findSkeletonRowsSection({
|
|
|
44
44
|
}
|
|
45
45
|
function isLazyLoadingDisabled({
|
|
46
46
|
lazyLoadingFeatureFlag,
|
|
47
|
-
rowsLoadingMode
|
|
48
|
-
gridDimensions
|
|
47
|
+
rowsLoadingMode
|
|
49
48
|
}) {
|
|
50
|
-
if (!lazyLoadingFeatureFlag
|
|
49
|
+
if (!lazyLoadingFeatureFlag) {
|
|
51
50
|
return true;
|
|
52
51
|
}
|
|
53
52
|
if (rowsLoadingMode !== 'server') {
|
|
@@ -63,7 +62,6 @@ function isLazyLoadingDisabled({
|
|
|
63
62
|
* @requires useGridScroll (method
|
|
64
63
|
*/
|
|
65
64
|
const useGridLazyLoader = (privateApiRef, props) => {
|
|
66
|
-
const visibleRows = (0, _internals.useGridVisibleRows)(privateApiRef, props);
|
|
67
65
|
const sortModel = (0, _xDataGrid.useGridSelector)(privateApiRef, _xDataGrid.gridSortModelSelector);
|
|
68
66
|
const filterModel = (0, _xDataGrid.useGridSelector)(privateApiRef, _xDataGrid.gridFilterModelSelector);
|
|
69
67
|
const renderedRowsIntervalCache = React.useRef({
|
|
@@ -73,13 +71,12 @@ const useGridLazyLoader = (privateApiRef, props) => {
|
|
|
73
71
|
const {
|
|
74
72
|
lazyLoading
|
|
75
73
|
} = props.experimentalFeatures ?? {};
|
|
74
|
+
const isDisabled = isLazyLoadingDisabled({
|
|
75
|
+
lazyLoadingFeatureFlag: lazyLoading,
|
|
76
|
+
rowsLoadingMode: props.rowsLoadingMode
|
|
77
|
+
});
|
|
76
78
|
const handleRenderedRowsIntervalChange = React.useCallback(params => {
|
|
77
|
-
|
|
78
|
-
if (isLazyLoadingDisabled({
|
|
79
|
-
lazyLoadingFeatureFlag: lazyLoading,
|
|
80
|
-
rowsLoadingMode: props.rowsLoadingMode,
|
|
81
|
-
gridDimensions: dimensions
|
|
82
|
-
})) {
|
|
79
|
+
if (isDisabled) {
|
|
83
80
|
return;
|
|
84
81
|
}
|
|
85
82
|
const fetchRowsParams = {
|
|
@@ -91,10 +88,18 @@ const useGridLazyLoader = (privateApiRef, props) => {
|
|
|
91
88
|
if (renderedRowsIntervalCache.current.firstRowToRender === params.firstRowIndex && renderedRowsIntervalCache.current.lastRowToRender === params.lastRowIndex) {
|
|
92
89
|
return;
|
|
93
90
|
}
|
|
91
|
+
renderedRowsIntervalCache.current = {
|
|
92
|
+
firstRowToRender: params.firstRowIndex,
|
|
93
|
+
lastRowToRender: params.lastRowIndex
|
|
94
|
+
};
|
|
94
95
|
if (sortModel.length === 0 && filterModel.items.length === 0) {
|
|
96
|
+
const currentVisibleRows = (0, _internals.getVisibleRows)(privateApiRef, {
|
|
97
|
+
pagination: props.pagination,
|
|
98
|
+
paginationMode: props.paginationMode
|
|
99
|
+
});
|
|
95
100
|
const skeletonRowsSection = findSkeletonRowsSection({
|
|
96
101
|
apiRef: privateApiRef,
|
|
97
|
-
visibleRows:
|
|
102
|
+
visibleRows: currentVisibleRows.rows,
|
|
98
103
|
range: {
|
|
99
104
|
firstRowIndex: params.firstRowIndex,
|
|
100
105
|
lastRowIndex: params.lastRowIndex
|
|
@@ -106,19 +111,10 @@ const useGridLazyLoader = (privateApiRef, props) => {
|
|
|
106
111
|
fetchRowsParams.firstRowToRender = skeletonRowsSection.firstRowIndex;
|
|
107
112
|
fetchRowsParams.lastRowToRender = skeletonRowsSection.lastRowIndex;
|
|
108
113
|
}
|
|
109
|
-
renderedRowsIntervalCache.current = {
|
|
110
|
-
firstRowToRender: params.firstRowIndex,
|
|
111
|
-
lastRowToRender: params.lastRowIndex
|
|
112
|
-
};
|
|
113
114
|
privateApiRef.current.publishEvent('fetchRows', fetchRowsParams);
|
|
114
|
-
}, [privateApiRef, props.
|
|
115
|
+
}, [privateApiRef, isDisabled, props.pagination, props.paginationMode, sortModel, filterModel]);
|
|
115
116
|
const handleGridSortModelChange = React.useCallback(newSortModel => {
|
|
116
|
-
|
|
117
|
-
if (isLazyLoadingDisabled({
|
|
118
|
-
lazyLoadingFeatureFlag: lazyLoading,
|
|
119
|
-
rowsLoadingMode: props.rowsLoadingMode,
|
|
120
|
-
gridDimensions: dimensions
|
|
121
|
-
})) {
|
|
117
|
+
if (isDisabled) {
|
|
122
118
|
return;
|
|
123
119
|
}
|
|
124
120
|
privateApiRef.current.requestPipeProcessorsApplication('hydrateRows');
|
|
@@ -130,14 +126,9 @@ const useGridLazyLoader = (privateApiRef, props) => {
|
|
|
130
126
|
filterModel
|
|
131
127
|
};
|
|
132
128
|
privateApiRef.current.publishEvent('fetchRows', fetchRowsParams);
|
|
133
|
-
}, [privateApiRef,
|
|
129
|
+
}, [privateApiRef, isDisabled, filterModel]);
|
|
134
130
|
const handleGridFilterModelChange = React.useCallback(newFilterModel => {
|
|
135
|
-
|
|
136
|
-
if (isLazyLoadingDisabled({
|
|
137
|
-
lazyLoadingFeatureFlag: lazyLoading,
|
|
138
|
-
rowsLoadingMode: props.rowsLoadingMode,
|
|
139
|
-
gridDimensions: dimensions
|
|
140
|
-
})) {
|
|
131
|
+
if (isDisabled) {
|
|
141
132
|
return;
|
|
142
133
|
}
|
|
143
134
|
privateApiRef.current.requestPipeProcessorsApplication('hydrateRows');
|
|
@@ -149,7 +140,7 @@ const useGridLazyLoader = (privateApiRef, props) => {
|
|
|
149
140
|
filterModel: newFilterModel
|
|
150
141
|
};
|
|
151
142
|
privateApiRef.current.publishEvent('fetchRows', fetchRowsParams);
|
|
152
|
-
}, [privateApiRef,
|
|
143
|
+
}, [privateApiRef, isDisabled, sortModel]);
|
|
153
144
|
(0, _xDataGrid.useGridApiEventHandler)(privateApiRef, 'renderedRowsIntervalChange', handleRenderedRowsIntervalChange);
|
|
154
145
|
(0, _xDataGrid.useGridApiEventHandler)(privateApiRef, 'sortModelChange', handleGridSortModelChange);
|
|
155
146
|
(0, _xDataGrid.useGridApiEventHandler)(privateApiRef, 'filterModelChange', handleGridFilterModelChange);
|
package/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
7
7
|
import { getDataGridUtilityClass, gridClasses, useGridSelector } from '@mui/x-data-grid';
|
|
8
|
-
import { gridPinnedRowsSelector, useGridPrivateApiContext } from '@mui/x-data-grid/internals';
|
|
8
|
+
import { gridPinnedRowsSelector, gridRenderContextSelector, useGridPrivateApiContext } from '@mui/x-data-grid/internals';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
const useUtilityClasses = () => {
|
|
11
11
|
const slots = {
|
|
@@ -21,10 +21,18 @@ export function GridPinnedRows(_ref) {
|
|
|
21
21
|
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
22
22
|
const classes = useUtilityClasses();
|
|
23
23
|
const apiRef = useGridPrivateApiContext();
|
|
24
|
+
const renderContext = useGridSelector(apiRef, gridRenderContextSelector);
|
|
24
25
|
const pinnedRowsData = useGridSelector(apiRef, gridPinnedRowsSelector);
|
|
26
|
+
const rows = pinnedRowsData[position];
|
|
25
27
|
const pinnedRows = virtualScroller.getRows({
|
|
26
28
|
position,
|
|
27
|
-
rows
|
|
29
|
+
rows,
|
|
30
|
+
renderContext: React.useMemo(() => ({
|
|
31
|
+
firstRowIndex: 0,
|
|
32
|
+
lastRowIndex: rows.length,
|
|
33
|
+
firstColumnIndex: renderContext.firstColumnIndex,
|
|
34
|
+
lastColumnIndex: renderContext.lastColumnIndex
|
|
35
|
+
}), [rows, renderContext.firstColumnIndex, renderContext.lastColumnIndex])
|
|
28
36
|
});
|
|
29
37
|
return /*#__PURE__*/_jsx("div", _extends({}, other, {
|
|
30
38
|
className: clsx(classes.root, other.className, gridClasses[`pinnedRows--${position}`]),
|
|
@@ -175,6 +175,7 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
175
175
|
const theme = useTheme();
|
|
176
176
|
const logger = useGridLogger(apiRef, 'useGridColumnResize');
|
|
177
177
|
const colDefRef = React.useRef();
|
|
178
|
+
const previousMouseClickEvent = React.useRef();
|
|
178
179
|
const columnHeaderElementRef = React.useRef();
|
|
179
180
|
const headerFilterElementRef = React.useRef();
|
|
180
181
|
const groupHeaderElementsRef = React.useRef([]);
|
|
@@ -250,6 +251,20 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
250
251
|
const finishResize = nativeEvent => {
|
|
251
252
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
252
253
|
stopListening();
|
|
254
|
+
|
|
255
|
+
// Prevent double-clicks from being interpreted as two separate clicks
|
|
256
|
+
if (previousMouseClickEvent.current) {
|
|
257
|
+
const prevEvent = previousMouseClickEvent.current;
|
|
258
|
+
const prevTimeStamp = prevEvent.timeStamp;
|
|
259
|
+
const prevClientX = prevEvent.clientX;
|
|
260
|
+
const prevClientY = prevEvent.clientY;
|
|
261
|
+
|
|
262
|
+
// Check if the current event is part of a double-click
|
|
263
|
+
if (nativeEvent.timeStamp - prevTimeStamp < 300 && nativeEvent.clientX === prevClientX && nativeEvent.clientY === prevClientY) {
|
|
264
|
+
previousMouseClickEvent.current = undefined;
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
253
268
|
if (colDefRef.current) {
|
|
254
269
|
apiRef.current.setColumnWidth(colDefRef.current.field, colDefRef.current.width);
|
|
255
270
|
logger.debug(`Updating col ${colDefRef.current.field} with new width: ${colDefRef.current.width}`);
|
|
@@ -404,6 +419,7 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
404
419
|
storeReferences(colDef, event.currentTarget, event.clientX);
|
|
405
420
|
const doc = ownerDocument(apiRef.current.rootElementRef.current);
|
|
406
421
|
doc.body.style.cursor = 'col-resize';
|
|
422
|
+
previousMouseClickEvent.current = event.nativeEvent;
|
|
407
423
|
doc.addEventListener('mousemove', handleResizeMouseMove);
|
|
408
424
|
doc.addEventListener('mouseup', handleResizeMouseUp);
|
|
409
425
|
|
|
@@ -472,6 +488,16 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
472
488
|
}
|
|
473
489
|
}
|
|
474
490
|
apiRef.current.updateColumns(newColumns);
|
|
491
|
+
newColumns.forEach((newColumn, index) => {
|
|
492
|
+
if (newColumn.width !== columns[index].width) {
|
|
493
|
+
const width = newColumn.width;
|
|
494
|
+
apiRef.current.publishEvent('columnWidthChange', {
|
|
495
|
+
element: apiRef.current.getColumnHeaderElement(newColumn.field),
|
|
496
|
+
colDef: newColumn,
|
|
497
|
+
width
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
});
|
|
475
501
|
} finally {
|
|
476
502
|
apiRef.current.unstable_setColumnVirtualization(true);
|
|
477
503
|
isAutosizingRef.current = false;
|
|
@@ -504,5 +530,8 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
504
530
|
useGridApiOptionHandler(apiRef, 'columnWidthChange', props.onColumnWidthChange);
|
|
505
531
|
};
|
|
506
532
|
function updateProperty(element, property, delta) {
|
|
533
|
+
if (!element) {
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
507
536
|
element.style[property] = `${parseInt(element.style[property], 10) + delta}px`;
|
|
508
537
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useGridApiEventHandler, useGridSelector, gridSortModelSelector, gridFilterModelSelector, gridRenderContextSelector, useGridApiOptionHandler } from '@mui/x-data-grid';
|
|
3
|
-
import {
|
|
3
|
+
import { getVisibleRows } from '@mui/x-data-grid/internals';
|
|
4
4
|
function findSkeletonRowsSection({
|
|
5
5
|
apiRef,
|
|
6
6
|
visibleRows,
|
|
@@ -36,10 +36,9 @@ function findSkeletonRowsSection({
|
|
|
36
36
|
}
|
|
37
37
|
function isLazyLoadingDisabled({
|
|
38
38
|
lazyLoadingFeatureFlag,
|
|
39
|
-
rowsLoadingMode
|
|
40
|
-
gridDimensions
|
|
39
|
+
rowsLoadingMode
|
|
41
40
|
}) {
|
|
42
|
-
if (!lazyLoadingFeatureFlag
|
|
41
|
+
if (!lazyLoadingFeatureFlag) {
|
|
43
42
|
return true;
|
|
44
43
|
}
|
|
45
44
|
if (rowsLoadingMode !== 'server') {
|
|
@@ -55,7 +54,6 @@ function isLazyLoadingDisabled({
|
|
|
55
54
|
* @requires useGridScroll (method
|
|
56
55
|
*/
|
|
57
56
|
export const useGridLazyLoader = (privateApiRef, props) => {
|
|
58
|
-
const visibleRows = useGridVisibleRows(privateApiRef, props);
|
|
59
57
|
const sortModel = useGridSelector(privateApiRef, gridSortModelSelector);
|
|
60
58
|
const filterModel = useGridSelector(privateApiRef, gridFilterModelSelector);
|
|
61
59
|
const renderedRowsIntervalCache = React.useRef({
|
|
@@ -65,13 +63,12 @@ export const useGridLazyLoader = (privateApiRef, props) => {
|
|
|
65
63
|
const {
|
|
66
64
|
lazyLoading
|
|
67
65
|
} = props.experimentalFeatures ?? {};
|
|
66
|
+
const isDisabled = isLazyLoadingDisabled({
|
|
67
|
+
lazyLoadingFeatureFlag: lazyLoading,
|
|
68
|
+
rowsLoadingMode: props.rowsLoadingMode
|
|
69
|
+
});
|
|
68
70
|
const handleRenderedRowsIntervalChange = React.useCallback(params => {
|
|
69
|
-
|
|
70
|
-
if (isLazyLoadingDisabled({
|
|
71
|
-
lazyLoadingFeatureFlag: lazyLoading,
|
|
72
|
-
rowsLoadingMode: props.rowsLoadingMode,
|
|
73
|
-
gridDimensions: dimensions
|
|
74
|
-
})) {
|
|
71
|
+
if (isDisabled) {
|
|
75
72
|
return;
|
|
76
73
|
}
|
|
77
74
|
const fetchRowsParams = {
|
|
@@ -83,10 +80,18 @@ export const useGridLazyLoader = (privateApiRef, props) => {
|
|
|
83
80
|
if (renderedRowsIntervalCache.current.firstRowToRender === params.firstRowIndex && renderedRowsIntervalCache.current.lastRowToRender === params.lastRowIndex) {
|
|
84
81
|
return;
|
|
85
82
|
}
|
|
83
|
+
renderedRowsIntervalCache.current = {
|
|
84
|
+
firstRowToRender: params.firstRowIndex,
|
|
85
|
+
lastRowToRender: params.lastRowIndex
|
|
86
|
+
};
|
|
86
87
|
if (sortModel.length === 0 && filterModel.items.length === 0) {
|
|
88
|
+
const currentVisibleRows = getVisibleRows(privateApiRef, {
|
|
89
|
+
pagination: props.pagination,
|
|
90
|
+
paginationMode: props.paginationMode
|
|
91
|
+
});
|
|
87
92
|
const skeletonRowsSection = findSkeletonRowsSection({
|
|
88
93
|
apiRef: privateApiRef,
|
|
89
|
-
visibleRows:
|
|
94
|
+
visibleRows: currentVisibleRows.rows,
|
|
90
95
|
range: {
|
|
91
96
|
firstRowIndex: params.firstRowIndex,
|
|
92
97
|
lastRowIndex: params.lastRowIndex
|
|
@@ -98,19 +103,10 @@ export const useGridLazyLoader = (privateApiRef, props) => {
|
|
|
98
103
|
fetchRowsParams.firstRowToRender = skeletonRowsSection.firstRowIndex;
|
|
99
104
|
fetchRowsParams.lastRowToRender = skeletonRowsSection.lastRowIndex;
|
|
100
105
|
}
|
|
101
|
-
renderedRowsIntervalCache.current = {
|
|
102
|
-
firstRowToRender: params.firstRowIndex,
|
|
103
|
-
lastRowToRender: params.lastRowIndex
|
|
104
|
-
};
|
|
105
106
|
privateApiRef.current.publishEvent('fetchRows', fetchRowsParams);
|
|
106
|
-
}, [privateApiRef, props.
|
|
107
|
+
}, [privateApiRef, isDisabled, props.pagination, props.paginationMode, sortModel, filterModel]);
|
|
107
108
|
const handleGridSortModelChange = React.useCallback(newSortModel => {
|
|
108
|
-
|
|
109
|
-
if (isLazyLoadingDisabled({
|
|
110
|
-
lazyLoadingFeatureFlag: lazyLoading,
|
|
111
|
-
rowsLoadingMode: props.rowsLoadingMode,
|
|
112
|
-
gridDimensions: dimensions
|
|
113
|
-
})) {
|
|
109
|
+
if (isDisabled) {
|
|
114
110
|
return;
|
|
115
111
|
}
|
|
116
112
|
privateApiRef.current.requestPipeProcessorsApplication('hydrateRows');
|
|
@@ -122,14 +118,9 @@ export const useGridLazyLoader = (privateApiRef, props) => {
|
|
|
122
118
|
filterModel
|
|
123
119
|
};
|
|
124
120
|
privateApiRef.current.publishEvent('fetchRows', fetchRowsParams);
|
|
125
|
-
}, [privateApiRef,
|
|
121
|
+
}, [privateApiRef, isDisabled, filterModel]);
|
|
126
122
|
const handleGridFilterModelChange = React.useCallback(newFilterModel => {
|
|
127
|
-
|
|
128
|
-
if (isLazyLoadingDisabled({
|
|
129
|
-
lazyLoadingFeatureFlag: lazyLoading,
|
|
130
|
-
rowsLoadingMode: props.rowsLoadingMode,
|
|
131
|
-
gridDimensions: dimensions
|
|
132
|
-
})) {
|
|
123
|
+
if (isDisabled) {
|
|
133
124
|
return;
|
|
134
125
|
}
|
|
135
126
|
privateApiRef.current.requestPipeProcessorsApplication('hydrateRows');
|
|
@@ -141,7 +132,7 @@ export const useGridLazyLoader = (privateApiRef, props) => {
|
|
|
141
132
|
filterModel: newFilterModel
|
|
142
133
|
};
|
|
143
134
|
privateApiRef.current.publishEvent('fetchRows', fetchRowsParams);
|
|
144
|
-
}, [privateApiRef,
|
|
135
|
+
}, [privateApiRef, isDisabled, sortModel]);
|
|
145
136
|
useGridApiEventHandler(privateApiRef, 'renderedRowsIntervalChange', handleRenderedRowsIntervalChange);
|
|
146
137
|
useGridApiEventHandler(privateApiRef, 'sortModelChange', handleGridSortModelChange);
|
|
147
138
|
useGridApiEventHandler(privateApiRef, 'filterModelChange', handleGridFilterModelChange);
|
package/modern/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTcwOTM1NTYwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid-pro",
|
|
3
|
-
"version": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.5",
|
|
4
4
|
"description": "The Pro plan edition of the data grid component (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@babel/runtime": "^7.23.9",
|
|
36
36
|
"@mui/system": "^5.15.9",
|
|
37
37
|
"@mui/utils": "^5.15.9",
|
|
38
|
-
"@mui/x-data-grid": "7.0.0-beta.
|
|
38
|
+
"@mui/x-data-grid": "7.0.0-beta.5",
|
|
39
39
|
"@mui/x-license": "7.0.0-beta.2",
|
|
40
40
|
"@types/format-util": "^1.0.4",
|
|
41
41
|
"clsx": "^2.1.0",
|
package/utils/releaseInfo.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getReleaseInfo = void 0;
|
|
7
7
|
var _utils = require("@mui/utils");
|
|
8
8
|
const getReleaseInfo = () => {
|
|
9
|
-
const releaseInfo = "
|
|
9
|
+
const releaseInfo = "MTcwOTM1NTYwMDAwMA==";
|
|
10
10
|
if (process.env.NODE_ENV !== 'production') {
|
|
11
11
|
// A simple hack to set the value in the test environment (has no build step).
|
|
12
12
|
// eslint-disable-next-line no-useless-concat
|