@mui/x-data-grid 5.17.12 → 5.17.14
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/ErrorBoundary.d.ts +0 -1
- package/components/ErrorBoundary.js +1 -1
- package/components/ErrorOverlay.d.ts +1 -1
- package/components/ErrorOverlay.js +3 -3
- package/components/base/GridErrorHandler.js +3 -4
- package/hooks/core/useGridErrorHandler.js +7 -1
- package/hooks/features/rows/useGridRows.js +3 -0
- package/hooks/features/selection/useGridSelection.js +14 -7
- package/index.js +1 -1
- package/legacy/components/ErrorBoundary.js +1 -1
- package/legacy/components/ErrorOverlay.js +3 -3
- package/legacy/components/base/GridErrorHandler.js +3 -4
- package/legacy/hooks/core/useGridErrorHandler.js +7 -1
- package/legacy/hooks/features/rows/useGridRows.js +3 -0
- package/legacy/hooks/features/selection/useGridSelection.js +14 -7
- package/legacy/index.js +1 -1
- package/legacy/locales/arSD.js +1 -1
- package/legacy/locales/ukUA.js +24 -20
- package/locales/arSD.js +1 -1
- package/locales/ukUA.js +20 -20
- package/modern/components/ErrorBoundary.js +1 -1
- package/modern/components/ErrorOverlay.js +3 -3
- package/modern/components/base/GridErrorHandler.js +3 -4
- package/modern/hooks/core/useGridErrorHandler.js +7 -1
- package/modern/hooks/features/rows/useGridRows.js +3 -0
- package/modern/hooks/features/selection/useGridSelection.js +12 -7
- package/modern/index.js +1 -1
- package/modern/locales/arSD.js +1 -1
- package/modern/locales/ukUA.js +20 -20
- package/node/components/ErrorBoundary.js +1 -1
- package/node/components/ErrorOverlay.js +3 -3
- package/node/components/base/GridErrorHandler.js +3 -4
- package/node/hooks/core/useGridErrorHandler.js +7 -1
- package/node/hooks/features/rows/useGridRows.js +3 -0
- package/node/hooks/features/selection/useGridSelection.js +15 -7
- package/node/index.js +1 -1
- package/node/locales/arSD.js +1 -1
- package/node/locales/ukUA.js +20 -20
- package/package.json +1 -1
- package/themeAugmentation/props.d.ts +3 -5
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.14
|
|
7
|
+
|
|
8
|
+
_Dec 1, 2022_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 3 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🌍 Improve Ukrainian (uk-UA) locale (#7035) @rettoua
|
|
13
|
+
- 🐞 Bugfixes
|
|
14
|
+
|
|
15
|
+
### `@mui/x-data-grid@v5.17.14` / `@mui/x-data-grid-pro@v5.17.14` / `@mui/x-data-grid-premium@v5.17.14`
|
|
16
|
+
|
|
17
|
+
#### Changes
|
|
18
|
+
|
|
19
|
+
- [DataGrid] Fix row selection when clicking blank cell (#7056) @yami03
|
|
20
|
+
- [DataGridPremium] Update cache before hydrating columns (#7043) @m4theushw
|
|
21
|
+
- [l10n] Improve Ukrainian (uk-UA) locale (#7035) @rettoua
|
|
22
|
+
|
|
23
|
+
## 5.17.13
|
|
24
|
+
|
|
25
|
+
_Nov 24, 2022_
|
|
26
|
+
|
|
27
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
28
|
+
|
|
29
|
+
- 🚀 Fix support of the pickers to Shadow DOM (#6971) @flaviendelangle
|
|
30
|
+
- 💅 Improve DataGrid theme augmentation (#6980) @iigrik
|
|
31
|
+
- 🐞 Bugfixes
|
|
32
|
+
|
|
33
|
+
### `@mui/x-data-grid@v5.17.13` / `@mui/x-data-grid-pro@v5.17.13` / `@mui/x-data-grid-premium@v5.17.13`
|
|
34
|
+
|
|
35
|
+
#### Changes
|
|
36
|
+
|
|
37
|
+
- [DataGrid] Fix `ErrorOverlay` not receiving defined input props (#6885) @banoth-ravinder
|
|
38
|
+
- [DataGrid] Improve typing for `styleOverrides` (#6980) @iigrik
|
|
39
|
+
- [DataGridPro] Fix lazy-loaded rows not working with `updateRows` API method (#6875) @cherniavskii
|
|
40
|
+
- [l10n] Fix translation of `filterOperatorBefore` in Arabic (ar-SD) locale (#6917) @HassanGhazy
|
|
41
|
+
|
|
42
|
+
### `@mui/x-date-pickers@v5.0.9` / `@mui/x-date-pickers-pro@v5.0.9`
|
|
43
|
+
|
|
44
|
+
#### Changes
|
|
45
|
+
|
|
46
|
+
- [pickers] Fix usage with Shadow DOM (#6971) @flaviendelangle
|
|
47
|
+
|
|
48
|
+
### Docs
|
|
49
|
+
|
|
50
|
+
- [docs] Add new "Expired package version" error type (#6937) @oliviertassinari
|
|
51
|
+
- [docs] Enforce values for installation options in Date / Time pickers Getting Started page (#6896) @01zulfi
|
|
52
|
+
- [docs] Fix live edit @oliviertassinari
|
|
53
|
+
- [docs] Upgrade to Next 13 (#6911) @cherniavskii
|
|
54
|
+
|
|
55
|
+
### Core
|
|
56
|
+
|
|
57
|
+
- [core] Upgrade monorepo (#6906) @cherniavskii
|
|
58
|
+
- [core] Upgrade node to v14.21 (#6939) @piwysocki
|
|
59
|
+
|
|
6
60
|
## 5.17.12
|
|
7
61
|
|
|
8
62
|
_Nov 17, 2022_
|
|
@@ -7,7 +7,6 @@ export interface ErrorBoundaryProps {
|
|
|
7
7
|
render: ({ error }: any) => React.ReactNode;
|
|
8
8
|
api: React.MutableRefObject<GridApiCommunity>;
|
|
9
9
|
hasError: boolean;
|
|
10
|
-
componentProps?: any[];
|
|
11
10
|
children?: React.ReactNode;
|
|
12
11
|
}
|
|
13
12
|
export declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, any> {
|
|
@@ -28,7 +28,7 @@ export class ErrorBoundary extends React.Component {
|
|
|
28
28
|
|
|
29
29
|
if (this.props.hasError || (_this$state = this.state) != null && _this$state.hasError) {
|
|
30
30
|
// You can render any custom fallback UI
|
|
31
|
-
return this.props.render(this.
|
|
31
|
+
return this.props.render(this.state);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
return this.props.children;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["
|
|
3
|
+
const _excluded = ["error", "hasError", "errorInfo"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
6
6
|
import { GridOverlay } from './containers/GridOverlay';
|
|
@@ -10,7 +10,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
10
10
|
// TODO v6: rename to GridErrorOverlay
|
|
11
11
|
export const ErrorOverlay = /*#__PURE__*/React.forwardRef(function ErrorOverlay(props, ref) {
|
|
12
12
|
const {
|
|
13
|
-
|
|
13
|
+
error
|
|
14
14
|
} = props,
|
|
15
15
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
16
16
|
|
|
@@ -24,6 +24,6 @@ export const ErrorOverlay = /*#__PURE__*/React.forwardRef(function ErrorOverlay(
|
|
|
24
24
|
minHeight: 2 * rowHeight
|
|
25
25
|
}
|
|
26
26
|
}, other, {
|
|
27
|
-
children: message || defaultLabel
|
|
27
|
+
children: (error == null ? void 0 : error.message) || defaultLabel
|
|
28
28
|
}));
|
|
29
29
|
});
|
|
@@ -15,17 +15,16 @@ function GridErrorHandler(props) {
|
|
|
15
15
|
const apiRef = useGridApiContext();
|
|
16
16
|
const logger = useGridLogger(apiRef, 'GridErrorHandler');
|
|
17
17
|
const rootProps = useGridRootProps();
|
|
18
|
-
const
|
|
18
|
+
const errorState = apiRef.current.state.error;
|
|
19
19
|
return /*#__PURE__*/_jsx(ErrorBoundary, {
|
|
20
|
-
hasError:
|
|
21
|
-
componentProps: error,
|
|
20
|
+
hasError: errorState != null,
|
|
22
21
|
api: apiRef,
|
|
23
22
|
logger: logger,
|
|
24
23
|
render: errorProps => {
|
|
25
24
|
var _rootProps$components;
|
|
26
25
|
|
|
27
26
|
return /*#__PURE__*/_jsx(GridMainContainer, {
|
|
28
|
-
children: /*#__PURE__*/_jsx(rootProps.components.ErrorOverlay, _extends({}, errorProps, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.errorOverlay))
|
|
27
|
+
children: /*#__PURE__*/_jsx(rootProps.components.ErrorOverlay, _extends({}, errorProps, errorState, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.errorOverlay))
|
|
29
28
|
});
|
|
30
29
|
},
|
|
31
30
|
children: children
|
|
@@ -9,7 +9,13 @@ export function useGridErrorHandler(apiRef, props) {
|
|
|
9
9
|
}));
|
|
10
10
|
}, [apiRef]);
|
|
11
11
|
React.useEffect(() => {
|
|
12
|
-
|
|
12
|
+
if (props.error) {
|
|
13
|
+
handleError({
|
|
14
|
+
error: props.error
|
|
15
|
+
});
|
|
16
|
+
} else {
|
|
17
|
+
handleError(null);
|
|
18
|
+
}
|
|
13
19
|
}, [handleError, props.error]);
|
|
14
20
|
useGridApiEventHandler(apiRef, 'componentError', handleError);
|
|
15
21
|
}
|
|
@@ -296,6 +296,9 @@ export const useGridRows = (apiRef, props) => {
|
|
|
296
296
|
updatedIdToIdLookup[row.id] = row.id;
|
|
297
297
|
updatedTree[row.id] = rowTreeNodeConfig;
|
|
298
298
|
});
|
|
299
|
+
apiRef.current.unstable_caches.rows.idRowsLookup = updatedIdRowsLookup;
|
|
300
|
+
apiRef.current.unstable_caches.rows.idToIdLookup = updatedIdToIdLookup;
|
|
301
|
+
apiRef.current.unstable_caches.rows.ids = updatedRows;
|
|
299
302
|
apiRef.current.setState(state => _extends({}, state, {
|
|
300
303
|
rows: _extends({}, state.rows, {
|
|
301
304
|
idRowsLookup: updatedIdRowsLookup,
|
|
@@ -13,6 +13,7 @@ import { GridCellModes } from '../../../models/gridEditRowModel';
|
|
|
13
13
|
import { isKeyboardEvent, isNavigationKey } from '../../../utils/keyboardUtils';
|
|
14
14
|
import { getVisibleRows, useGridVisibleRows } from '../../utils/useGridVisibleRows';
|
|
15
15
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../../../constants/gridDetailPanelToggleField';
|
|
16
|
+
import { gridClasses } from '../../../constants/gridClasses';
|
|
16
17
|
|
|
17
18
|
const getSelectionModelPropValue = (selectionModelProp, prevSelectionModel) => {
|
|
18
19
|
if (selectionModelProp == null) {
|
|
@@ -248,30 +249,36 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
248
249
|
apiRef.current.selectRow(id, !isSelected, false);
|
|
249
250
|
}
|
|
250
251
|
}, [apiRef, canHaveMultipleSelection, checkboxSelection]);
|
|
251
|
-
const
|
|
252
|
+
const handleRowClick = React.useCallback((params, event) => {
|
|
253
|
+
var _closest;
|
|
254
|
+
|
|
252
255
|
if (disableSelectionOnClick) {
|
|
253
256
|
return;
|
|
254
257
|
}
|
|
255
258
|
|
|
256
|
-
|
|
259
|
+
const field = (_closest = event.target.closest(`.${gridClasses.cell}`)) == null ? void 0 : _closest.getAttribute('data-field');
|
|
260
|
+
|
|
261
|
+
if (field === GRID_CHECKBOX_SELECTION_COL_DEF.field) {
|
|
257
262
|
// click on checkbox should not trigger row selection
|
|
258
263
|
return;
|
|
259
264
|
}
|
|
260
265
|
|
|
261
|
-
if (
|
|
266
|
+
if (field === GRID_DETAIL_PANEL_TOGGLE_FIELD) {
|
|
262
267
|
// click to open the detail panel should not select the row
|
|
263
268
|
return;
|
|
264
269
|
}
|
|
265
270
|
|
|
266
|
-
if (
|
|
267
|
-
const column = apiRef.current.getColumn(
|
|
271
|
+
if (field) {
|
|
272
|
+
const column = apiRef.current.getColumn(field);
|
|
268
273
|
|
|
269
274
|
if (column.type === GRID_ACTIONS_COLUMN_TYPE) {
|
|
270
275
|
return;
|
|
271
276
|
}
|
|
272
277
|
}
|
|
273
278
|
|
|
274
|
-
|
|
279
|
+
const rowNode = apiRef.current.getRowNode(params.id);
|
|
280
|
+
|
|
281
|
+
if (rowNode.isPinned) {
|
|
275
282
|
return;
|
|
276
283
|
}
|
|
277
284
|
|
|
@@ -371,7 +378,7 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
371
378
|
}
|
|
372
379
|
}, [apiRef, handleSingleRowSelection, selectRows, visibleRows.rows, canHaveMultipleSelection]);
|
|
373
380
|
useGridApiEventHandler(apiRef, 'sortedRowsSet', removeOutdatedSelection);
|
|
374
|
-
useGridApiEventHandler(apiRef, '
|
|
381
|
+
useGridApiEventHandler(apiRef, 'rowClick', handleRowClick);
|
|
375
382
|
useGridApiEventHandler(apiRef, 'rowSelectionCheckboxChange', handleRowSelectionCheckboxChange);
|
|
376
383
|
useGridApiEventHandler(apiRef, 'headerSelectionCheckboxChange', handleHeaderSelectionCheckboxChange);
|
|
377
384
|
useGridApiEventHandler(apiRef, 'cellMouseDown', preventSelectionOnShift);
|
package/index.js
CHANGED
|
@@ -44,7 +44,7 @@ export var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
|
44
44
|
|
|
45
45
|
if (this.props.hasError || (_this$state = this.state) != null && _this$state.hasError) {
|
|
46
46
|
// You can render any custom fallback UI
|
|
47
|
-
return this.props.render(this.
|
|
47
|
+
return this.props.render(this.state);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
return this.props.children;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["
|
|
3
|
+
var _excluded = ["error", "hasError", "errorInfo"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
6
6
|
import { GridOverlay } from './containers/GridOverlay';
|
|
@@ -9,7 +9,7 @@ import { gridDensityRowHeightSelector } from '../hooks/features/density/densityS
|
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
// TODO v6: rename to GridErrorOverlay
|
|
11
11
|
export var ErrorOverlay = /*#__PURE__*/React.forwardRef(function ErrorOverlay(props, ref) {
|
|
12
|
-
var
|
|
12
|
+
var error = props.error,
|
|
13
13
|
hasError = props.hasError,
|
|
14
14
|
errorInfo = props.errorInfo,
|
|
15
15
|
other = _objectWithoutProperties(props, _excluded);
|
|
@@ -24,6 +24,6 @@ export var ErrorOverlay = /*#__PURE__*/React.forwardRef(function ErrorOverlay(pr
|
|
|
24
24
|
minHeight: 2 * rowHeight
|
|
25
25
|
}
|
|
26
26
|
}, other, {
|
|
27
|
-
children: message || defaultLabel
|
|
27
|
+
children: (error == null ? void 0 : error.message) || defaultLabel
|
|
28
28
|
}));
|
|
29
29
|
});
|
|
@@ -13,17 +13,16 @@ function GridErrorHandler(props) {
|
|
|
13
13
|
var apiRef = useGridApiContext();
|
|
14
14
|
var logger = useGridLogger(apiRef, 'GridErrorHandler');
|
|
15
15
|
var rootProps = useGridRootProps();
|
|
16
|
-
var
|
|
16
|
+
var errorState = apiRef.current.state.error;
|
|
17
17
|
return /*#__PURE__*/_jsx(ErrorBoundary, {
|
|
18
|
-
hasError:
|
|
19
|
-
componentProps: error,
|
|
18
|
+
hasError: errorState != null,
|
|
20
19
|
api: apiRef,
|
|
21
20
|
logger: logger,
|
|
22
21
|
render: function render(errorProps) {
|
|
23
22
|
var _rootProps$components;
|
|
24
23
|
|
|
25
24
|
return /*#__PURE__*/_jsx(GridMainContainer, {
|
|
26
|
-
children: /*#__PURE__*/_jsx(rootProps.components.ErrorOverlay, _extends({}, errorProps, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.errorOverlay))
|
|
25
|
+
children: /*#__PURE__*/_jsx(rootProps.components.ErrorOverlay, _extends({}, errorProps, errorState, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.errorOverlay))
|
|
27
26
|
});
|
|
28
27
|
},
|
|
29
28
|
children: children
|
|
@@ -11,7 +11,13 @@ export function useGridErrorHandler(apiRef, props) {
|
|
|
11
11
|
});
|
|
12
12
|
}, [apiRef]);
|
|
13
13
|
React.useEffect(function () {
|
|
14
|
-
|
|
14
|
+
if (props.error) {
|
|
15
|
+
handleError({
|
|
16
|
+
error: props.error
|
|
17
|
+
});
|
|
18
|
+
} else {
|
|
19
|
+
handleError(null);
|
|
20
|
+
}
|
|
15
21
|
}, [handleError, props.error]);
|
|
16
22
|
useGridApiEventHandler(apiRef, 'componentError', handleError);
|
|
17
23
|
}
|
|
@@ -325,6 +325,9 @@ export var useGridRows = function useGridRows(apiRef, props) {
|
|
|
325
325
|
updatedIdToIdLookup[row.id] = row.id;
|
|
326
326
|
updatedTree[row.id] = rowTreeNodeConfig;
|
|
327
327
|
});
|
|
328
|
+
apiRef.current.unstable_caches.rows.idRowsLookup = updatedIdRowsLookup;
|
|
329
|
+
apiRef.current.unstable_caches.rows.idToIdLookup = updatedIdToIdLookup;
|
|
330
|
+
apiRef.current.unstable_caches.rows.ids = updatedRows;
|
|
328
331
|
apiRef.current.setState(function (state) {
|
|
329
332
|
return _extends({}, state, {
|
|
330
333
|
rows: _extends({}, state.rows, {
|
|
@@ -14,6 +14,7 @@ import { GridCellModes } from '../../../models/gridEditRowModel';
|
|
|
14
14
|
import { isKeyboardEvent, isNavigationKey } from '../../../utils/keyboardUtils';
|
|
15
15
|
import { getVisibleRows, useGridVisibleRows } from '../../utils/useGridVisibleRows';
|
|
16
16
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../../../constants/gridDetailPanelToggleField';
|
|
17
|
+
import { gridClasses } from '../../../constants/gridClasses';
|
|
17
18
|
|
|
18
19
|
var getSelectionModelPropValue = function getSelectionModelPropValue(selectionModelProp, prevSelectionModel) {
|
|
19
20
|
if (selectionModelProp == null) {
|
|
@@ -273,30 +274,36 @@ export var useGridSelection = function useGridSelection(apiRef, props) {
|
|
|
273
274
|
apiRef.current.selectRow(id, !isSelected, false);
|
|
274
275
|
}
|
|
275
276
|
}, [apiRef, canHaveMultipleSelection, checkboxSelection]);
|
|
276
|
-
var
|
|
277
|
+
var handleRowClick = React.useCallback(function (params, event) {
|
|
278
|
+
var _closest;
|
|
279
|
+
|
|
277
280
|
if (disableSelectionOnClick) {
|
|
278
281
|
return;
|
|
279
282
|
}
|
|
280
283
|
|
|
281
|
-
|
|
284
|
+
var field = (_closest = event.target.closest(".".concat(gridClasses.cell))) == null ? void 0 : _closest.getAttribute('data-field');
|
|
285
|
+
|
|
286
|
+
if (field === GRID_CHECKBOX_SELECTION_COL_DEF.field) {
|
|
282
287
|
// click on checkbox should not trigger row selection
|
|
283
288
|
return;
|
|
284
289
|
}
|
|
285
290
|
|
|
286
|
-
if (
|
|
291
|
+
if (field === GRID_DETAIL_PANEL_TOGGLE_FIELD) {
|
|
287
292
|
// click to open the detail panel should not select the row
|
|
288
293
|
return;
|
|
289
294
|
}
|
|
290
295
|
|
|
291
|
-
if (
|
|
292
|
-
var column = apiRef.current.getColumn(
|
|
296
|
+
if (field) {
|
|
297
|
+
var column = apiRef.current.getColumn(field);
|
|
293
298
|
|
|
294
299
|
if (column.type === GRID_ACTIONS_COLUMN_TYPE) {
|
|
295
300
|
return;
|
|
296
301
|
}
|
|
297
302
|
}
|
|
298
303
|
|
|
299
|
-
|
|
304
|
+
var rowNode = apiRef.current.getRowNode(params.id);
|
|
305
|
+
|
|
306
|
+
if (rowNode.isPinned) {
|
|
300
307
|
return;
|
|
301
308
|
}
|
|
302
309
|
|
|
@@ -398,7 +405,7 @@ export var useGridSelection = function useGridSelection(apiRef, props) {
|
|
|
398
405
|
}
|
|
399
406
|
}, [apiRef, handleSingleRowSelection, selectRows, visibleRows.rows, canHaveMultipleSelection]);
|
|
400
407
|
useGridApiEventHandler(apiRef, 'sortedRowsSet', removeOutdatedSelection);
|
|
401
|
-
useGridApiEventHandler(apiRef, '
|
|
408
|
+
useGridApiEventHandler(apiRef, 'rowClick', handleRowClick);
|
|
402
409
|
useGridApiEventHandler(apiRef, 'rowSelectionCheckboxChange', handleRowSelectionCheckboxChange);
|
|
403
410
|
useGridApiEventHandler(apiRef, 'headerSelectionCheckboxChange', handleHeaderSelectionCheckboxChange);
|
|
404
411
|
useGridApiEventHandler(apiRef, 'cellMouseDown', preventSelectionOnShift);
|
package/legacy/index.js
CHANGED
package/legacy/locales/arSD.js
CHANGED
|
@@ -58,7 +58,7 @@ var arSDGrid = {
|
|
|
58
58
|
filterOperatorNot: 'ليس',
|
|
59
59
|
filterOperatorAfter: 'بعد',
|
|
60
60
|
filterOperatorOnOrAfter: 'عند أو بعد',
|
|
61
|
-
filterOperatorBefore: '
|
|
61
|
+
filterOperatorBefore: 'قبل',
|
|
62
62
|
filterOperatorOnOrBefore: 'عند أو قبل',
|
|
63
63
|
filterOperatorIsEmpty: 'خالي',
|
|
64
64
|
filterOperatorIsNotEmpty: 'غير خالي',
|
package/legacy/locales/ukUA.js
CHANGED
|
@@ -41,15 +41,15 @@ var ukUAGrid = {
|
|
|
41
41
|
});
|
|
42
42
|
},
|
|
43
43
|
// Quick filter toolbar field
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
toolbarQuickFilterPlaceholder: 'Пошук…',
|
|
45
|
+
toolbarQuickFilterLabel: 'Пошук',
|
|
46
|
+
toolbarQuickFilterDeleteIconLabel: 'Очистити',
|
|
47
47
|
// Export selector toolbar button text
|
|
48
48
|
toolbarExport: 'Експорт',
|
|
49
49
|
toolbarExportLabel: 'Експорт',
|
|
50
50
|
toolbarExportCSV: 'Завантажити у форматі CSV',
|
|
51
51
|
toolbarExportPrint: 'Друк',
|
|
52
|
-
|
|
52
|
+
toolbarExportExcel: 'Завантажити у форматі Excel',
|
|
53
53
|
// Columns panel text
|
|
54
54
|
columnsPanelTextFieldLabel: 'Знайти стовпець',
|
|
55
55
|
columnsPanelTextFieldPlaceholder: 'Заголовок стовпця',
|
|
@@ -59,7 +59,7 @@ var ukUAGrid = {
|
|
|
59
59
|
// Filter panel text
|
|
60
60
|
filterPanelAddFilter: 'Додати фільтр',
|
|
61
61
|
filterPanelDeleteIconLabel: 'Видалити',
|
|
62
|
-
|
|
62
|
+
filterPanelLinkOperator: 'Логічна функція',
|
|
63
63
|
filterPanelOperators: 'Оператори',
|
|
64
64
|
// TODO v6: rename to filterPanelOperator
|
|
65
65
|
filterPanelOperatorAnd: 'І',
|
|
@@ -80,7 +80,7 @@ var ukUAGrid = {
|
|
|
80
80
|
filterOperatorOnOrBefore: 'менше або дорівнює',
|
|
81
81
|
filterOperatorIsEmpty: 'порожній',
|
|
82
82
|
filterOperatorIsNotEmpty: 'не порожній',
|
|
83
|
-
|
|
83
|
+
filterOperatorIsAnyOf: 'будь-що із',
|
|
84
84
|
// Filter values text
|
|
85
85
|
filterValueAny: 'будь-який',
|
|
86
86
|
filterValueTrue: 'так',
|
|
@@ -119,10 +119,10 @@ var ukUAGrid = {
|
|
|
119
119
|
},
|
|
120
120
|
// Checkbox selection text
|
|
121
121
|
checkboxSelectionHeaderName: 'Вибір прапорця',
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
checkboxSelectionSelectAllRows: 'Вибрати всі рядки',
|
|
123
|
+
checkboxSelectionUnselectAllRows: 'Скасувати вибір всіх рядків',
|
|
124
|
+
checkboxSelectionSelectRow: 'Вибрати рядок',
|
|
125
|
+
checkboxSelectionUnselectRow: 'Скасувати вибір рядка',
|
|
126
126
|
// Boolean cell text
|
|
127
127
|
booleanCellTrueLabel: 'так',
|
|
128
128
|
booleanCellFalseLabel: 'ні',
|
|
@@ -135,19 +135,23 @@ var ukUAGrid = {
|
|
|
135
135
|
// Tree Data
|
|
136
136
|
treeDataGroupingHeaderName: 'Група',
|
|
137
137
|
treeDataExpand: 'показати дочірні елементи',
|
|
138
|
-
treeDataCollapse: 'приховати дочірні елементи'
|
|
139
|
-
//
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
treeDataCollapse: 'приховати дочірні елементи',
|
|
139
|
+
// Grouping columns
|
|
140
|
+
groupingColumnHeaderName: 'Група',
|
|
141
|
+
groupColumn: function groupColumn(name) {
|
|
142
|
+
return "\u0413\u0440\u0443\u043F\u0443\u0432\u0430\u0442\u0438 \u0437\u0430 ".concat(name);
|
|
143
|
+
},
|
|
144
|
+
unGroupColumn: function unGroupColumn(name) {
|
|
145
|
+
return "\u0412\u0456\u0434\u043C\u0456\u043D\u0438\u0442\u0438 \u0433\u0440\u0443\u043F\u0443\u0432\u0430\u043D\u043D\u044F \u0437\u0430 ".concat(name);
|
|
146
|
+
},
|
|
142
147
|
// Master/detail
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
148
|
+
detailPanelToggle: 'Перемикач панелі деталей',
|
|
149
|
+
expandDetailPanel: 'Показати',
|
|
150
|
+
collapseDetailPanel: 'Приховати',
|
|
146
151
|
// Row reordering text
|
|
147
|
-
|
|
152
|
+
rowReorderingHeaderName: 'Порядок рядків',
|
|
148
153
|
// Aggregation
|
|
149
|
-
//
|
|
150
|
-
// aggregationFunctionLabelSum: 'sum',
|
|
154
|
+
aggregationMenuItemHeader: 'Агрегація' // aggregationFunctionLabelSum: 'sum',
|
|
151
155
|
// aggregationFunctionLabelAvg: 'avg',
|
|
152
156
|
// aggregationFunctionLabelMin: 'min',
|
|
153
157
|
// aggregationFunctionLabelMax: 'max',
|
package/locales/arSD.js
CHANGED
|
@@ -56,7 +56,7 @@ const arSDGrid = {
|
|
|
56
56
|
filterOperatorNot: 'ليس',
|
|
57
57
|
filterOperatorAfter: 'بعد',
|
|
58
58
|
filterOperatorOnOrAfter: 'عند أو بعد',
|
|
59
|
-
filterOperatorBefore: '
|
|
59
|
+
filterOperatorBefore: 'قبل',
|
|
60
60
|
filterOperatorOnOrBefore: 'عند أو قبل',
|
|
61
61
|
filterOperatorIsEmpty: 'خالي',
|
|
62
62
|
filterOperatorIsNotEmpty: 'غير خالي',
|
package/locales/ukUA.js
CHANGED
|
@@ -39,15 +39,15 @@ const ukUAGrid = {
|
|
|
39
39
|
many: 'активних фільтрів'
|
|
40
40
|
}),
|
|
41
41
|
// Quick filter toolbar field
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
toolbarQuickFilterPlaceholder: 'Пошук…',
|
|
43
|
+
toolbarQuickFilterLabel: 'Пошук',
|
|
44
|
+
toolbarQuickFilterDeleteIconLabel: 'Очистити',
|
|
45
45
|
// Export selector toolbar button text
|
|
46
46
|
toolbarExport: 'Експорт',
|
|
47
47
|
toolbarExportLabel: 'Експорт',
|
|
48
48
|
toolbarExportCSV: 'Завантажити у форматі CSV',
|
|
49
49
|
toolbarExportPrint: 'Друк',
|
|
50
|
-
|
|
50
|
+
toolbarExportExcel: 'Завантажити у форматі Excel',
|
|
51
51
|
// Columns panel text
|
|
52
52
|
columnsPanelTextFieldLabel: 'Знайти стовпець',
|
|
53
53
|
columnsPanelTextFieldPlaceholder: 'Заголовок стовпця',
|
|
@@ -57,7 +57,7 @@ const ukUAGrid = {
|
|
|
57
57
|
// Filter panel text
|
|
58
58
|
filterPanelAddFilter: 'Додати фільтр',
|
|
59
59
|
filterPanelDeleteIconLabel: 'Видалити',
|
|
60
|
-
|
|
60
|
+
filterPanelLinkOperator: 'Логічна функція',
|
|
61
61
|
filterPanelOperators: 'Оператори',
|
|
62
62
|
// TODO v6: rename to filterPanelOperator
|
|
63
63
|
filterPanelOperatorAnd: 'І',
|
|
@@ -78,7 +78,7 @@ const ukUAGrid = {
|
|
|
78
78
|
filterOperatorOnOrBefore: 'менше або дорівнює',
|
|
79
79
|
filterOperatorIsEmpty: 'порожній',
|
|
80
80
|
filterOperatorIsNotEmpty: 'не порожній',
|
|
81
|
-
|
|
81
|
+
filterOperatorIsAnyOf: 'будь-що із',
|
|
82
82
|
// Filter values text
|
|
83
83
|
filterValueAny: 'будь-який',
|
|
84
84
|
filterValueTrue: 'так',
|
|
@@ -111,10 +111,10 @@ const ukUAGrid = {
|
|
|
111
111
|
footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} з ${totalCount.toLocaleString()}`,
|
|
112
112
|
// Checkbox selection text
|
|
113
113
|
checkboxSelectionHeaderName: 'Вибір прапорця',
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
checkboxSelectionSelectAllRows: 'Вибрати всі рядки',
|
|
115
|
+
checkboxSelectionUnselectAllRows: 'Скасувати вибір всіх рядків',
|
|
116
|
+
checkboxSelectionSelectRow: 'Вибрати рядок',
|
|
117
|
+
checkboxSelectionUnselectRow: 'Скасувати вибір рядка',
|
|
118
118
|
// Boolean cell text
|
|
119
119
|
booleanCellTrueLabel: 'так',
|
|
120
120
|
booleanCellFalseLabel: 'ні',
|
|
@@ -127,19 +127,19 @@ const ukUAGrid = {
|
|
|
127
127
|
// Tree Data
|
|
128
128
|
treeDataGroupingHeaderName: 'Група',
|
|
129
129
|
treeDataExpand: 'показати дочірні елементи',
|
|
130
|
-
treeDataCollapse: 'приховати дочірні елементи'
|
|
131
|
-
//
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
treeDataCollapse: 'приховати дочірні елементи',
|
|
131
|
+
// Grouping columns
|
|
132
|
+
groupingColumnHeaderName: 'Група',
|
|
133
|
+
groupColumn: name => `Групувати за ${name}`,
|
|
134
|
+
unGroupColumn: name => `Відмінити групування за ${name}`,
|
|
134
135
|
// Master/detail
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
detailPanelToggle: 'Перемикач панелі деталей',
|
|
137
|
+
expandDetailPanel: 'Показати',
|
|
138
|
+
collapseDetailPanel: 'Приховати',
|
|
138
139
|
// Row reordering text
|
|
139
|
-
|
|
140
|
+
rowReorderingHeaderName: 'Порядок рядків',
|
|
140
141
|
// Aggregation
|
|
141
|
-
//
|
|
142
|
-
// aggregationFunctionLabelSum: 'sum',
|
|
142
|
+
aggregationMenuItemHeader: 'Агрегація' // aggregationFunctionLabelSum: 'sum',
|
|
143
143
|
// aggregationFunctionLabelAvg: 'avg',
|
|
144
144
|
// aggregationFunctionLabelMin: 'min',
|
|
145
145
|
// aggregationFunctionLabelMax: 'max',
|
|
@@ -26,7 +26,7 @@ export class ErrorBoundary extends React.Component {
|
|
|
26
26
|
render() {
|
|
27
27
|
if (this.props.hasError || this.state?.hasError) {
|
|
28
28
|
// You can render any custom fallback UI
|
|
29
|
-
return this.props.render(this.
|
|
29
|
+
return this.props.render(this.state);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
return this.props.children;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["
|
|
3
|
+
const _excluded = ["error", "hasError", "errorInfo"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
6
6
|
import { GridOverlay } from './containers/GridOverlay';
|
|
@@ -10,7 +10,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
10
10
|
// TODO v6: rename to GridErrorOverlay
|
|
11
11
|
export const ErrorOverlay = /*#__PURE__*/React.forwardRef(function ErrorOverlay(props, ref) {
|
|
12
12
|
const {
|
|
13
|
-
|
|
13
|
+
error
|
|
14
14
|
} = props,
|
|
15
15
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
16
16
|
|
|
@@ -24,6 +24,6 @@ export const ErrorOverlay = /*#__PURE__*/React.forwardRef(function ErrorOverlay(
|
|
|
24
24
|
minHeight: 2 * rowHeight
|
|
25
25
|
}
|
|
26
26
|
}, other, {
|
|
27
|
-
children: message || defaultLabel
|
|
27
|
+
children: error?.message || defaultLabel
|
|
28
28
|
}));
|
|
29
29
|
});
|
|
@@ -15,14 +15,13 @@ function GridErrorHandler(props) {
|
|
|
15
15
|
const apiRef = useGridApiContext();
|
|
16
16
|
const logger = useGridLogger(apiRef, 'GridErrorHandler');
|
|
17
17
|
const rootProps = useGridRootProps();
|
|
18
|
-
const
|
|
18
|
+
const errorState = apiRef.current.state.error;
|
|
19
19
|
return /*#__PURE__*/_jsx(ErrorBoundary, {
|
|
20
|
-
hasError:
|
|
21
|
-
componentProps: error,
|
|
20
|
+
hasError: errorState != null,
|
|
22
21
|
api: apiRef,
|
|
23
22
|
logger: logger,
|
|
24
23
|
render: errorProps => /*#__PURE__*/_jsx(GridMainContainer, {
|
|
25
|
-
children: /*#__PURE__*/_jsx(rootProps.components.ErrorOverlay, _extends({}, errorProps, rootProps.componentsProps?.errorOverlay))
|
|
24
|
+
children: /*#__PURE__*/_jsx(rootProps.components.ErrorOverlay, _extends({}, errorProps, errorState, rootProps.componentsProps?.errorOverlay))
|
|
26
25
|
}),
|
|
27
26
|
children: children
|
|
28
27
|
});
|
|
@@ -9,7 +9,13 @@ export function useGridErrorHandler(apiRef, props) {
|
|
|
9
9
|
}));
|
|
10
10
|
}, [apiRef]);
|
|
11
11
|
React.useEffect(() => {
|
|
12
|
-
|
|
12
|
+
if (props.error) {
|
|
13
|
+
handleError({
|
|
14
|
+
error: props.error
|
|
15
|
+
});
|
|
16
|
+
} else {
|
|
17
|
+
handleError(null);
|
|
18
|
+
}
|
|
13
19
|
}, [handleError, props.error]);
|
|
14
20
|
useGridApiEventHandler(apiRef, 'componentError', handleError);
|
|
15
21
|
}
|
|
@@ -288,6 +288,9 @@ export const useGridRows = (apiRef, props) => {
|
|
|
288
288
|
updatedIdToIdLookup[row.id] = row.id;
|
|
289
289
|
updatedTree[row.id] = rowTreeNodeConfig;
|
|
290
290
|
});
|
|
291
|
+
apiRef.current.unstable_caches.rows.idRowsLookup = updatedIdRowsLookup;
|
|
292
|
+
apiRef.current.unstable_caches.rows.idToIdLookup = updatedIdToIdLookup;
|
|
293
|
+
apiRef.current.unstable_caches.rows.ids = updatedRows;
|
|
291
294
|
apiRef.current.setState(state => _extends({}, state, {
|
|
292
295
|
rows: _extends({}, state.rows, {
|
|
293
296
|
idRowsLookup: updatedIdRowsLookup,
|
|
@@ -13,6 +13,7 @@ import { GridCellModes } from '../../../models/gridEditRowModel';
|
|
|
13
13
|
import { isKeyboardEvent, isNavigationKey } from '../../../utils/keyboardUtils';
|
|
14
14
|
import { getVisibleRows, useGridVisibleRows } from '../../utils/useGridVisibleRows';
|
|
15
15
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../../../constants/gridDetailPanelToggleField';
|
|
16
|
+
import { gridClasses } from '../../../constants/gridClasses';
|
|
16
17
|
|
|
17
18
|
const getSelectionModelPropValue = (selectionModelProp, prevSelectionModel) => {
|
|
18
19
|
if (selectionModelProp == null) {
|
|
@@ -242,30 +243,34 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
242
243
|
apiRef.current.selectRow(id, !isSelected, false);
|
|
243
244
|
}
|
|
244
245
|
}, [apiRef, canHaveMultipleSelection, checkboxSelection]);
|
|
245
|
-
const
|
|
246
|
+
const handleRowClick = React.useCallback((params, event) => {
|
|
246
247
|
if (disableSelectionOnClick) {
|
|
247
248
|
return;
|
|
248
249
|
}
|
|
249
250
|
|
|
250
|
-
|
|
251
|
+
const field = event.target.closest(`.${gridClasses.cell}`)?.getAttribute('data-field');
|
|
252
|
+
|
|
253
|
+
if (field === GRID_CHECKBOX_SELECTION_COL_DEF.field) {
|
|
251
254
|
// click on checkbox should not trigger row selection
|
|
252
255
|
return;
|
|
253
256
|
}
|
|
254
257
|
|
|
255
|
-
if (
|
|
258
|
+
if (field === GRID_DETAIL_PANEL_TOGGLE_FIELD) {
|
|
256
259
|
// click to open the detail panel should not select the row
|
|
257
260
|
return;
|
|
258
261
|
}
|
|
259
262
|
|
|
260
|
-
if (
|
|
261
|
-
const column = apiRef.current.getColumn(
|
|
263
|
+
if (field) {
|
|
264
|
+
const column = apiRef.current.getColumn(field);
|
|
262
265
|
|
|
263
266
|
if (column.type === GRID_ACTIONS_COLUMN_TYPE) {
|
|
264
267
|
return;
|
|
265
268
|
}
|
|
266
269
|
}
|
|
267
270
|
|
|
268
|
-
|
|
271
|
+
const rowNode = apiRef.current.getRowNode(params.id);
|
|
272
|
+
|
|
273
|
+
if (rowNode.isPinned) {
|
|
269
274
|
return;
|
|
270
275
|
}
|
|
271
276
|
|
|
@@ -363,7 +368,7 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
363
368
|
}
|
|
364
369
|
}, [apiRef, handleSingleRowSelection, selectRows, visibleRows.rows, canHaveMultipleSelection]);
|
|
365
370
|
useGridApiEventHandler(apiRef, 'sortedRowsSet', removeOutdatedSelection);
|
|
366
|
-
useGridApiEventHandler(apiRef, '
|
|
371
|
+
useGridApiEventHandler(apiRef, 'rowClick', handleRowClick);
|
|
367
372
|
useGridApiEventHandler(apiRef, 'rowSelectionCheckboxChange', handleRowSelectionCheckboxChange);
|
|
368
373
|
useGridApiEventHandler(apiRef, 'headerSelectionCheckboxChange', handleHeaderSelectionCheckboxChange);
|
|
369
374
|
useGridApiEventHandler(apiRef, 'cellMouseDown', preventSelectionOnShift);
|
package/modern/index.js
CHANGED
package/modern/locales/arSD.js
CHANGED
|
@@ -56,7 +56,7 @@ const arSDGrid = {
|
|
|
56
56
|
filterOperatorNot: 'ليس',
|
|
57
57
|
filterOperatorAfter: 'بعد',
|
|
58
58
|
filterOperatorOnOrAfter: 'عند أو بعد',
|
|
59
|
-
filterOperatorBefore: '
|
|
59
|
+
filterOperatorBefore: 'قبل',
|
|
60
60
|
filterOperatorOnOrBefore: 'عند أو قبل',
|
|
61
61
|
filterOperatorIsEmpty: 'خالي',
|
|
62
62
|
filterOperatorIsNotEmpty: 'غير خالي',
|
package/modern/locales/ukUA.js
CHANGED
|
@@ -39,15 +39,15 @@ const ukUAGrid = {
|
|
|
39
39
|
many: 'активних фільтрів'
|
|
40
40
|
}),
|
|
41
41
|
// Quick filter toolbar field
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
toolbarQuickFilterPlaceholder: 'Пошук…',
|
|
43
|
+
toolbarQuickFilterLabel: 'Пошук',
|
|
44
|
+
toolbarQuickFilterDeleteIconLabel: 'Очистити',
|
|
45
45
|
// Export selector toolbar button text
|
|
46
46
|
toolbarExport: 'Експорт',
|
|
47
47
|
toolbarExportLabel: 'Експорт',
|
|
48
48
|
toolbarExportCSV: 'Завантажити у форматі CSV',
|
|
49
49
|
toolbarExportPrint: 'Друк',
|
|
50
|
-
|
|
50
|
+
toolbarExportExcel: 'Завантажити у форматі Excel',
|
|
51
51
|
// Columns panel text
|
|
52
52
|
columnsPanelTextFieldLabel: 'Знайти стовпець',
|
|
53
53
|
columnsPanelTextFieldPlaceholder: 'Заголовок стовпця',
|
|
@@ -57,7 +57,7 @@ const ukUAGrid = {
|
|
|
57
57
|
// Filter panel text
|
|
58
58
|
filterPanelAddFilter: 'Додати фільтр',
|
|
59
59
|
filterPanelDeleteIconLabel: 'Видалити',
|
|
60
|
-
|
|
60
|
+
filterPanelLinkOperator: 'Логічна функція',
|
|
61
61
|
filterPanelOperators: 'Оператори',
|
|
62
62
|
// TODO v6: rename to filterPanelOperator
|
|
63
63
|
filterPanelOperatorAnd: 'І',
|
|
@@ -78,7 +78,7 @@ const ukUAGrid = {
|
|
|
78
78
|
filterOperatorOnOrBefore: 'менше або дорівнює',
|
|
79
79
|
filterOperatorIsEmpty: 'порожній',
|
|
80
80
|
filterOperatorIsNotEmpty: 'не порожній',
|
|
81
|
-
|
|
81
|
+
filterOperatorIsAnyOf: 'будь-що із',
|
|
82
82
|
// Filter values text
|
|
83
83
|
filterValueAny: 'будь-який',
|
|
84
84
|
filterValueTrue: 'так',
|
|
@@ -111,10 +111,10 @@ const ukUAGrid = {
|
|
|
111
111
|
footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} з ${totalCount.toLocaleString()}`,
|
|
112
112
|
// Checkbox selection text
|
|
113
113
|
checkboxSelectionHeaderName: 'Вибір прапорця',
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
checkboxSelectionSelectAllRows: 'Вибрати всі рядки',
|
|
115
|
+
checkboxSelectionUnselectAllRows: 'Скасувати вибір всіх рядків',
|
|
116
|
+
checkboxSelectionSelectRow: 'Вибрати рядок',
|
|
117
|
+
checkboxSelectionUnselectRow: 'Скасувати вибір рядка',
|
|
118
118
|
// Boolean cell text
|
|
119
119
|
booleanCellTrueLabel: 'так',
|
|
120
120
|
booleanCellFalseLabel: 'ні',
|
|
@@ -127,19 +127,19 @@ const ukUAGrid = {
|
|
|
127
127
|
// Tree Data
|
|
128
128
|
treeDataGroupingHeaderName: 'Група',
|
|
129
129
|
treeDataExpand: 'показати дочірні елементи',
|
|
130
|
-
treeDataCollapse: 'приховати дочірні елементи'
|
|
131
|
-
//
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
treeDataCollapse: 'приховати дочірні елементи',
|
|
131
|
+
// Grouping columns
|
|
132
|
+
groupingColumnHeaderName: 'Група',
|
|
133
|
+
groupColumn: name => `Групувати за ${name}`,
|
|
134
|
+
unGroupColumn: name => `Відмінити групування за ${name}`,
|
|
134
135
|
// Master/detail
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
detailPanelToggle: 'Перемикач панелі деталей',
|
|
137
|
+
expandDetailPanel: 'Показати',
|
|
138
|
+
collapseDetailPanel: 'Приховати',
|
|
138
139
|
// Row reordering text
|
|
139
|
-
|
|
140
|
+
rowReorderingHeaderName: 'Порядок рядків',
|
|
140
141
|
// Aggregation
|
|
141
|
-
//
|
|
142
|
-
// aggregationFunctionLabelSum: 'sum',
|
|
142
|
+
aggregationMenuItemHeader: 'Агрегація' // aggregationFunctionLabelSum: 'sum',
|
|
143
143
|
// aggregationFunctionLabelAvg: 'avg',
|
|
144
144
|
// aggregationFunctionLabelMin: 'min',
|
|
145
145
|
// aggregationFunctionLabelMax: 'max',
|
|
@@ -40,7 +40,7 @@ class ErrorBoundary extends React.Component {
|
|
|
40
40
|
|
|
41
41
|
if (this.props.hasError || (_this$state = this.state) != null && _this$state.hasError) {
|
|
42
42
|
// You can render any custom fallback UI
|
|
43
|
-
return this.props.render(this.
|
|
43
|
+
return this.props.render(this.state);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
return this.props.children;
|
|
@@ -23,7 +23,7 @@ var _densitySelector = require("../hooks/features/density/densitySelector");
|
|
|
23
23
|
|
|
24
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
25
|
|
|
26
|
-
const _excluded = ["
|
|
26
|
+
const _excluded = ["error", "hasError", "errorInfo"];
|
|
27
27
|
|
|
28
28
|
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); }
|
|
29
29
|
|
|
@@ -32,7 +32,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
32
32
|
// TODO v6: rename to GridErrorOverlay
|
|
33
33
|
const ErrorOverlay = /*#__PURE__*/React.forwardRef(function ErrorOverlay(props, ref) {
|
|
34
34
|
const {
|
|
35
|
-
|
|
35
|
+
error
|
|
36
36
|
} = props,
|
|
37
37
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
38
38
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
@@ -45,7 +45,7 @@ const ErrorOverlay = /*#__PURE__*/React.forwardRef(function ErrorOverlay(props,
|
|
|
45
45
|
minHeight: 2 * rowHeight
|
|
46
46
|
}
|
|
47
47
|
}, other, {
|
|
48
|
-
children: message || defaultLabel
|
|
48
|
+
children: (error == null ? void 0 : error.message) || defaultLabel
|
|
49
49
|
}));
|
|
50
50
|
});
|
|
51
51
|
exports.ErrorOverlay = ErrorOverlay;
|
|
@@ -36,17 +36,16 @@ function GridErrorHandler(props) {
|
|
|
36
36
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
37
37
|
const logger = (0, _useGridLogger.useGridLogger)(apiRef, 'GridErrorHandler');
|
|
38
38
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
39
|
-
const
|
|
39
|
+
const errorState = apiRef.current.state.error;
|
|
40
40
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ErrorBoundary.ErrorBoundary, {
|
|
41
|
-
hasError:
|
|
42
|
-
componentProps: error,
|
|
41
|
+
hasError: errorState != null,
|
|
43
42
|
api: apiRef,
|
|
44
43
|
logger: logger,
|
|
45
44
|
render: errorProps => {
|
|
46
45
|
var _rootProps$components;
|
|
47
46
|
|
|
48
47
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridMainContainer.GridMainContainer, {
|
|
49
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.ErrorOverlay, (0, _extends2.default)({}, errorProps, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.errorOverlay))
|
|
48
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.ErrorOverlay, (0, _extends2.default)({}, errorProps, errorState, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.errorOverlay))
|
|
50
49
|
});
|
|
51
50
|
},
|
|
52
51
|
children: children
|
|
@@ -25,7 +25,13 @@ function useGridErrorHandler(apiRef, props) {
|
|
|
25
25
|
}));
|
|
26
26
|
}, [apiRef]);
|
|
27
27
|
React.useEffect(() => {
|
|
28
|
-
|
|
28
|
+
if (props.error) {
|
|
29
|
+
handleError({
|
|
30
|
+
error: props.error
|
|
31
|
+
});
|
|
32
|
+
} else {
|
|
33
|
+
handleError(null);
|
|
34
|
+
}
|
|
29
35
|
}, [handleError, props.error]);
|
|
30
36
|
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'componentError', handleError);
|
|
31
37
|
}
|
|
@@ -318,6 +318,9 @@ const useGridRows = (apiRef, props) => {
|
|
|
318
318
|
updatedIdToIdLookup[row.id] = row.id;
|
|
319
319
|
updatedTree[row.id] = rowTreeNodeConfig;
|
|
320
320
|
});
|
|
321
|
+
apiRef.current.unstable_caches.rows.idRowsLookup = updatedIdRowsLookup;
|
|
322
|
+
apiRef.current.unstable_caches.rows.idToIdLookup = updatedIdToIdLookup;
|
|
323
|
+
apiRef.current.unstable_caches.rows.ids = updatedRows;
|
|
321
324
|
apiRef.current.setState(state => (0, _extends2.default)({}, state, {
|
|
322
325
|
rows: (0, _extends2.default)({}, state.rows, {
|
|
323
326
|
idRowsLookup: updatedIdRowsLookup,
|
|
@@ -37,6 +37,8 @@ var _useGridVisibleRows = require("../../utils/useGridVisibleRows");
|
|
|
37
37
|
|
|
38
38
|
var _gridDetailPanelToggleField = require("../../../constants/gridDetailPanelToggleField");
|
|
39
39
|
|
|
40
|
+
var _gridClasses = require("../../../constants/gridClasses");
|
|
41
|
+
|
|
40
42
|
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); }
|
|
41
43
|
|
|
42
44
|
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; }
|
|
@@ -276,30 +278,36 @@ const useGridSelection = (apiRef, props) => {
|
|
|
276
278
|
apiRef.current.selectRow(id, !isSelected, false);
|
|
277
279
|
}
|
|
278
280
|
}, [apiRef, canHaveMultipleSelection, checkboxSelection]);
|
|
279
|
-
const
|
|
281
|
+
const handleRowClick = React.useCallback((params, event) => {
|
|
282
|
+
var _closest;
|
|
283
|
+
|
|
280
284
|
if (disableSelectionOnClick) {
|
|
281
285
|
return;
|
|
282
286
|
}
|
|
283
287
|
|
|
284
|
-
|
|
288
|
+
const field = (_closest = event.target.closest(`.${_gridClasses.gridClasses.cell}`)) == null ? void 0 : _closest.getAttribute('data-field');
|
|
289
|
+
|
|
290
|
+
if (field === _colDef.GRID_CHECKBOX_SELECTION_COL_DEF.field) {
|
|
285
291
|
// click on checkbox should not trigger row selection
|
|
286
292
|
return;
|
|
287
293
|
}
|
|
288
294
|
|
|
289
|
-
if (
|
|
295
|
+
if (field === _gridDetailPanelToggleField.GRID_DETAIL_PANEL_TOGGLE_FIELD) {
|
|
290
296
|
// click to open the detail panel should not select the row
|
|
291
297
|
return;
|
|
292
298
|
}
|
|
293
299
|
|
|
294
|
-
if (
|
|
295
|
-
const column = apiRef.current.getColumn(
|
|
300
|
+
if (field) {
|
|
301
|
+
const column = apiRef.current.getColumn(field);
|
|
296
302
|
|
|
297
303
|
if (column.type === _colDef.GRID_ACTIONS_COLUMN_TYPE) {
|
|
298
304
|
return;
|
|
299
305
|
}
|
|
300
306
|
}
|
|
301
307
|
|
|
302
|
-
|
|
308
|
+
const rowNode = apiRef.current.getRowNode(params.id);
|
|
309
|
+
|
|
310
|
+
if (rowNode.isPinned) {
|
|
303
311
|
return;
|
|
304
312
|
}
|
|
305
313
|
|
|
@@ -399,7 +407,7 @@ const useGridSelection = (apiRef, props) => {
|
|
|
399
407
|
}
|
|
400
408
|
}, [apiRef, handleSingleRowSelection, selectRows, visibleRows.rows, canHaveMultipleSelection]);
|
|
401
409
|
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'sortedRowsSet', removeOutdatedSelection);
|
|
402
|
-
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, '
|
|
410
|
+
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'rowClick', handleRowClick);
|
|
403
411
|
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'rowSelectionCheckboxChange', handleRowSelectionCheckboxChange);
|
|
404
412
|
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'headerSelectionCheckboxChange', handleHeaderSelectionCheckboxChange);
|
|
405
413
|
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'cellMouseDown', preventSelectionOnShift);
|
package/node/index.js
CHANGED
package/node/locales/arSD.js
CHANGED
|
@@ -65,7 +65,7 @@ const arSDGrid = {
|
|
|
65
65
|
filterOperatorNot: 'ليس',
|
|
66
66
|
filterOperatorAfter: 'بعد',
|
|
67
67
|
filterOperatorOnOrAfter: 'عند أو بعد',
|
|
68
|
-
filterOperatorBefore: '
|
|
68
|
+
filterOperatorBefore: 'قبل',
|
|
69
69
|
filterOperatorOnOrBefore: 'عند أو قبل',
|
|
70
70
|
filterOperatorIsEmpty: 'خالي',
|
|
71
71
|
filterOperatorIsNotEmpty: 'غير خالي',
|
package/node/locales/ukUA.js
CHANGED
|
@@ -47,15 +47,15 @@ const ukUAGrid = {
|
|
|
47
47
|
many: 'активних фільтрів'
|
|
48
48
|
}),
|
|
49
49
|
// Quick filter toolbar field
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
toolbarQuickFilterPlaceholder: 'Пошук…',
|
|
51
|
+
toolbarQuickFilterLabel: 'Пошук',
|
|
52
|
+
toolbarQuickFilterDeleteIconLabel: 'Очистити',
|
|
53
53
|
// Export selector toolbar button text
|
|
54
54
|
toolbarExport: 'Експорт',
|
|
55
55
|
toolbarExportLabel: 'Експорт',
|
|
56
56
|
toolbarExportCSV: 'Завантажити у форматі CSV',
|
|
57
57
|
toolbarExportPrint: 'Друк',
|
|
58
|
-
|
|
58
|
+
toolbarExportExcel: 'Завантажити у форматі Excel',
|
|
59
59
|
// Columns panel text
|
|
60
60
|
columnsPanelTextFieldLabel: 'Знайти стовпець',
|
|
61
61
|
columnsPanelTextFieldPlaceholder: 'Заголовок стовпця',
|
|
@@ -65,7 +65,7 @@ const ukUAGrid = {
|
|
|
65
65
|
// Filter panel text
|
|
66
66
|
filterPanelAddFilter: 'Додати фільтр',
|
|
67
67
|
filterPanelDeleteIconLabel: 'Видалити',
|
|
68
|
-
|
|
68
|
+
filterPanelLinkOperator: 'Логічна функція',
|
|
69
69
|
filterPanelOperators: 'Оператори',
|
|
70
70
|
// TODO v6: rename to filterPanelOperator
|
|
71
71
|
filterPanelOperatorAnd: 'І',
|
|
@@ -86,7 +86,7 @@ const ukUAGrid = {
|
|
|
86
86
|
filterOperatorOnOrBefore: 'менше або дорівнює',
|
|
87
87
|
filterOperatorIsEmpty: 'порожній',
|
|
88
88
|
filterOperatorIsNotEmpty: 'не порожній',
|
|
89
|
-
|
|
89
|
+
filterOperatorIsAnyOf: 'будь-що із',
|
|
90
90
|
// Filter values text
|
|
91
91
|
filterValueAny: 'будь-який',
|
|
92
92
|
filterValueTrue: 'так',
|
|
@@ -119,10 +119,10 @@ const ukUAGrid = {
|
|
|
119
119
|
footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} з ${totalCount.toLocaleString()}`,
|
|
120
120
|
// Checkbox selection text
|
|
121
121
|
checkboxSelectionHeaderName: 'Вибір прапорця',
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
checkboxSelectionSelectAllRows: 'Вибрати всі рядки',
|
|
123
|
+
checkboxSelectionUnselectAllRows: 'Скасувати вибір всіх рядків',
|
|
124
|
+
checkboxSelectionSelectRow: 'Вибрати рядок',
|
|
125
|
+
checkboxSelectionUnselectRow: 'Скасувати вибір рядка',
|
|
126
126
|
// Boolean cell text
|
|
127
127
|
booleanCellTrueLabel: 'так',
|
|
128
128
|
booleanCellFalseLabel: 'ні',
|
|
@@ -135,19 +135,19 @@ const ukUAGrid = {
|
|
|
135
135
|
// Tree Data
|
|
136
136
|
treeDataGroupingHeaderName: 'Група',
|
|
137
137
|
treeDataExpand: 'показати дочірні елементи',
|
|
138
|
-
treeDataCollapse: 'приховати дочірні елементи'
|
|
139
|
-
//
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
treeDataCollapse: 'приховати дочірні елементи',
|
|
139
|
+
// Grouping columns
|
|
140
|
+
groupingColumnHeaderName: 'Група',
|
|
141
|
+
groupColumn: name => `Групувати за ${name}`,
|
|
142
|
+
unGroupColumn: name => `Відмінити групування за ${name}`,
|
|
142
143
|
// Master/detail
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
detailPanelToggle: 'Перемикач панелі деталей',
|
|
145
|
+
expandDetailPanel: 'Показати',
|
|
146
|
+
collapseDetailPanel: 'Приховати',
|
|
146
147
|
// Row reordering text
|
|
147
|
-
|
|
148
|
+
rowReorderingHeaderName: 'Порядок рядків',
|
|
148
149
|
// Aggregation
|
|
149
|
-
//
|
|
150
|
-
// aggregationFunctionLabelSum: 'sum',
|
|
150
|
+
aggregationMenuItemHeader: 'Агрегація' // aggregationFunctionLabelSum: 'sum',
|
|
151
151
|
// aggregationFunctionLabelAvg: 'avg',
|
|
152
152
|
// aggregationFunctionLabelMin: 'min',
|
|
153
153
|
// aggregationFunctionLabelMax: 'max',
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ComponentsOverrides, ComponentsProps
|
|
1
|
+
import { ComponentsOverrides, ComponentsProps } from '@mui/material/styles';
|
|
2
2
|
import { DataGridProps } from '../models/props/DataGridProps';
|
|
3
3
|
export interface DataGridComponentsPropsList {
|
|
4
4
|
MuiDataGrid: DataGridProps;
|
|
5
5
|
}
|
|
6
|
-
export interface DataGridComponents {
|
|
6
|
+
export interface DataGridComponents<Theme = unknown> {
|
|
7
7
|
MuiDataGrid?: {
|
|
8
8
|
defaultProps?: ComponentsProps['MuiDataGrid'];
|
|
9
9
|
styleOverrides?: ComponentsOverrides<Theme>['MuiDataGrid'];
|
|
@@ -12,8 +12,6 @@ export interface DataGridComponents {
|
|
|
12
12
|
declare module '@mui/material/styles' {
|
|
13
13
|
interface ComponentsPropsList extends DataGridComponentsPropsList {
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
declare module '@mui/material/styles/components' {
|
|
17
|
-
interface Components extends DataGridComponents {
|
|
15
|
+
interface Components<Theme = unknown> extends DataGridComponents<Theme> {
|
|
18
16
|
}
|
|
19
17
|
}
|