@mui/x-data-grid 7.27.0 → 7.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/DataGrid/DataGrid.js +2 -0
- package/DataGrid/useDataGridComponent.js +2 -0
- package/colDef/gridCheckboxSelectionColDef.js +2 -1
- package/colDef/gridDateColDef.js +3 -2
- package/colDef/gridSingleSelectColDef.js +2 -2
- package/hooks/core/gridPropsSelectors.d.ts +9 -0
- package/hooks/core/gridPropsSelectors.js +14 -0
- package/hooks/core/index.d.ts +1 -0
- package/hooks/core/index.js +1 -1
- package/hooks/core/useGridInitialization.js +2 -0
- package/hooks/core/useGridProps.d.ts +8 -0
- package/hooks/core/useGridProps.js +18 -0
- package/hooks/features/dimensions/useGridDimensions.js +8 -9
- package/hooks/features/pagination/useGridPaginationModel.js +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.js +2 -2
- package/hooks/features/rows/useGridRows.js +2 -10
- package/hooks/features/sorting/gridSortingUtils.js +2 -1
- package/index.js +1 -1
- package/internals/index.d.ts +1 -0
- package/internals/index.js +1 -0
- package/locales/bnBD.d.ts +2 -0
- package/locales/bnBD.js +154 -0
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/models/api/gridRowApi.d.ts +0 -1
- package/models/gridStateCommunity.d.ts +8 -0
- package/models/props/DataGridProps.d.ts +2 -0
- package/modern/DataGrid/DataGrid.js +2 -0
- package/modern/DataGrid/useDataGridComponent.js +2 -0
- package/modern/colDef/gridCheckboxSelectionColDef.js +2 -1
- package/modern/colDef/gridDateColDef.js +3 -2
- package/modern/colDef/gridSingleSelectColDef.js +2 -2
- package/modern/hooks/core/gridPropsSelectors.js +14 -0
- package/modern/hooks/core/index.js +1 -1
- package/modern/hooks/core/useGridInitialization.js +2 -0
- package/modern/hooks/core/useGridProps.js +18 -0
- package/modern/hooks/features/dimensions/useGridDimensions.js +8 -9
- package/modern/hooks/features/pagination/useGridPaginationModel.js +1 -1
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +2 -2
- package/modern/hooks/features/rows/useGridRows.js +2 -10
- package/modern/hooks/features/sorting/gridSortingUtils.js +2 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -0
- package/modern/locales/bnBD.js +154 -0
- package/modern/locales/index.js +1 -0
- package/node/DataGrid/DataGrid.js +2 -0
- package/node/DataGrid/useDataGridComponent.js +2 -0
- package/node/colDef/gridCheckboxSelectionColDef.js +2 -1
- package/node/colDef/gridDateColDef.js +3 -2
- package/node/colDef/gridSingleSelectColDef.js +2 -2
- package/node/hooks/core/gridPropsSelectors.js +20 -0
- package/node/hooks/core/index.js +8 -1
- package/node/hooks/core/useGridInitialization.js +2 -0
- package/node/hooks/core/useGridProps.js +28 -0
- package/node/hooks/features/dimensions/useGridDimensions.js +8 -9
- package/node/hooks/features/pagination/useGridPaginationModel.js +1 -1
- package/node/hooks/features/rowSelection/useGridRowSelection.js +2 -2
- package/node/hooks/features/rows/useGridRows.js +2 -10
- package/node/hooks/features/sorting/gridSortingUtils.js +2 -1
- package/node/index.js +1 -1
- package/node/internals/index.js +8 -0
- package/node/locales/bnBD.js +160 -0
- package/node/locales/index.js +11 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,59 @@
|
|
|
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.27.1
|
|
7
|
+
|
|
8
|
+
_Feb 25, 2025_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 5 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🐞 Bugfixes
|
|
13
|
+
- 🌍 Add Bangla (bn-BD) locale on the Data Grid and Date Pickers
|
|
14
|
+
|
|
15
|
+
Special thanks go out to the community contributors who have helped make this release possible:
|
|
16
|
+
@nusr, @officialkidmax.
|
|
17
|
+
Following are all team members who have contributed to this release:
|
|
18
|
+
@bernardobelchior, @MBilalShafi, @KenanYusuf.
|
|
19
|
+
|
|
20
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
21
|
+
|
|
22
|
+
### Data Grid
|
|
23
|
+
|
|
24
|
+
#### `@mui/x-data-grid@7.27.1`
|
|
25
|
+
|
|
26
|
+
- [DataGrid] Fix the pagination unexpected behavior when using -1 for "All" rows per page (#16485) @nusr
|
|
27
|
+
- [DataGrid] Extract `getRowId()` API method as a selector (#16574) @MBilalShafi
|
|
28
|
+
- [DataGrid] Fix scrollbars overlapping cells on mount (#16653) @KenanYusuf
|
|
29
|
+
- [l10n] Add Bangla (bn-BD) locale (#16649) @officialkidmax
|
|
30
|
+
|
|
31
|
+
#### `@mui/x-data-grid-pro@7.27.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
32
|
+
|
|
33
|
+
Same changes as in `@mui/x-data-grid@7.27.1`.
|
|
34
|
+
|
|
35
|
+
#### `@mui/x-data-grid-premium@7.27.1` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
36
|
+
|
|
37
|
+
Same changes as in `@mui/x-data-grid-pro@7.27.1`.
|
|
38
|
+
|
|
39
|
+
### Date and Time Pickers
|
|
40
|
+
|
|
41
|
+
#### `@mui/x-date-pickers@7.27.1`
|
|
42
|
+
|
|
43
|
+
- [l10n] Add Bangla (bn-BD) locale (#16649) @officialkidmax
|
|
44
|
+
|
|
45
|
+
#### `@mui/x-date-pickers-pro@7.27.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
46
|
+
|
|
47
|
+
Same changes as in `@mui/x-date-pickers@7.27.1`.
|
|
48
|
+
|
|
49
|
+
### Charts
|
|
50
|
+
|
|
51
|
+
#### `@mui/x-charts@7.27.1`
|
|
52
|
+
|
|
53
|
+
- [charts] Fix empty series array in pie chart (#16657) @bernardobelchior
|
|
54
|
+
|
|
55
|
+
#### `@mui/x-charts-pro@7.27.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
56
|
+
|
|
57
|
+
Same changes as in `@mui/x-charts@7.27.1`.
|
|
58
|
+
|
|
6
59
|
## 7.27.0
|
|
7
60
|
|
|
8
61
|
_Feb 17, 2025_
|
package/DataGrid/DataGrid.js
CHANGED
|
@@ -282,6 +282,8 @@ DataGridRaw.propTypes = {
|
|
|
282
282
|
getRowHeight: PropTypes.func,
|
|
283
283
|
/**
|
|
284
284
|
* Return the id of a given [[GridRowModel]].
|
|
285
|
+
* Ensure the reference of this prop is stable to avoid performance implications.
|
|
286
|
+
* It could be done by either defining the prop outside of the component or by memoizing it.
|
|
285
287
|
*/
|
|
286
288
|
getRowId: PropTypes.func,
|
|
287
289
|
/**
|
|
@@ -29,6 +29,7 @@ import { useGridVirtualization, virtualizationStateInitializer } from "../hooks/
|
|
|
29
29
|
import { columnResizeStateInitializer, useGridColumnResize } from "../hooks/features/columnResize/useGridColumnResize.js";
|
|
30
30
|
import { rowSpanningStateInitializer, useGridRowSpanning } from "../hooks/features/rows/useGridRowSpanning.js";
|
|
31
31
|
import { listViewStateInitializer, useGridListView } from "../hooks/features/listView/useGridListView.js";
|
|
32
|
+
import { propsStateInitializer } from "../hooks/core/useGridProps.js";
|
|
32
33
|
export const useDataGridComponent = (inputApiRef, props) => {
|
|
33
34
|
const apiRef = useGridInitialization(inputApiRef, props);
|
|
34
35
|
|
|
@@ -41,6 +42,7 @@ export const useDataGridComponent = (inputApiRef, props) => {
|
|
|
41
42
|
/**
|
|
42
43
|
* Register all state initializers here.
|
|
43
44
|
*/
|
|
45
|
+
useGridInitializeState(propsStateInitializer, apiRef, props);
|
|
44
46
|
useGridInitializeState(rowSelectionStateInitializer, apiRef, props);
|
|
45
47
|
useGridInitializeState(columnsStateInitializer, apiRef, props);
|
|
46
48
|
useGridInitializeState(rowsStateInitializer, apiRef, props);
|
|
@@ -4,6 +4,7 @@ import { GridCellCheckboxRenderer } from "../components/columnSelection/GridCell
|
|
|
4
4
|
import { GridHeaderCheckbox } from "../components/columnSelection/GridHeaderCheckbox.js";
|
|
5
5
|
import { selectedIdsLookupSelector } from "../hooks/features/rowSelection/gridRowSelectionSelector.js";
|
|
6
6
|
import { GRID_BOOLEAN_COL_DEF } from "./gridBooleanColDef.js";
|
|
7
|
+
import { gridRowIdSelector } from "../hooks/core/gridPropsSelectors.js";
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
export const GRID_CHECKBOX_SELECTION_FIELD = '__check__';
|
|
9
10
|
export const GRID_CHECKBOX_SELECTION_COL_DEF = _extends({}, GRID_BOOLEAN_COL_DEF, {
|
|
@@ -22,7 +23,7 @@ export const GRID_CHECKBOX_SELECTION_COL_DEF = _extends({}, GRID_BOOLEAN_COL_DEF
|
|
|
22
23
|
display: 'flex',
|
|
23
24
|
valueGetter: (value, row, column, apiRef) => {
|
|
24
25
|
const selectionLookup = selectedIdsLookupSelector(apiRef);
|
|
25
|
-
const rowId = apiRef.current.
|
|
26
|
+
const rowId = gridRowIdSelector(apiRef.current.state, row);
|
|
26
27
|
return selectionLookup[rowId] !== undefined;
|
|
27
28
|
},
|
|
28
29
|
renderHeader: params => /*#__PURE__*/_jsx(GridHeaderCheckbox, _extends({}, params)),
|
package/colDef/gridDateColDef.js
CHANGED
|
@@ -3,6 +3,7 @@ import { gridDateComparator } from "../hooks/features/sorting/gridSortingUtils.j
|
|
|
3
3
|
import { getGridDateOperators } from "./gridDateOperators.js";
|
|
4
4
|
import { GRID_STRING_COL_DEF } from "./gridStringColDef.js";
|
|
5
5
|
import { renderEditDateCell } from "../components/cell/GridEditDateCell.js";
|
|
6
|
+
import { gridRowIdSelector } from "../hooks/core/gridPropsSelectors.js";
|
|
6
7
|
function throwIfNotDateObject({
|
|
7
8
|
value,
|
|
8
9
|
columnType,
|
|
@@ -17,7 +18,7 @@ export const gridDateFormatter = (value, row, column, apiRef) => {
|
|
|
17
18
|
if (!value) {
|
|
18
19
|
return '';
|
|
19
20
|
}
|
|
20
|
-
const rowId = apiRef.current.
|
|
21
|
+
const rowId = gridRowIdSelector(apiRef.current.state, row);
|
|
21
22
|
throwIfNotDateObject({
|
|
22
23
|
value,
|
|
23
24
|
columnType: 'date',
|
|
@@ -30,7 +31,7 @@ export const gridDateTimeFormatter = (value, row, column, apiRef) => {
|
|
|
30
31
|
if (!value) {
|
|
31
32
|
return '';
|
|
32
33
|
}
|
|
33
|
-
const rowId = apiRef.current.
|
|
34
|
+
const rowId = gridRowIdSelector(apiRef.current.state, row);
|
|
34
35
|
throwIfNotDateObject({
|
|
35
36
|
value,
|
|
36
37
|
columnType: 'dateTime',
|
|
@@ -4,6 +4,7 @@ import { renderEditSingleSelectCell } from "../components/cell/GridEditSingleSel
|
|
|
4
4
|
import { getGridSingleSelectOperators } from "./gridSingleSelectOperators.js";
|
|
5
5
|
import { getValueOptions, isSingleSelectColDef } from "../components/panel/filterPanel/filterPanelUtils.js";
|
|
6
6
|
import { isObject } from "../utils/utils.js";
|
|
7
|
+
import { gridRowIdSelector } from "../hooks/core/gridPropsSelectors.js";
|
|
7
8
|
const isArrayOfObjects = options => {
|
|
8
9
|
return typeof options[0] === 'object';
|
|
9
10
|
};
|
|
@@ -18,8 +19,7 @@ export const GRID_SINGLE_SELECT_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
18
19
|
getOptionLabel: defaultGetOptionLabel,
|
|
19
20
|
getOptionValue: defaultGetOptionValue,
|
|
20
21
|
valueFormatter(value, row, colDef, apiRef) {
|
|
21
|
-
|
|
22
|
-
const rowId = apiRef.current.getRowId(row);
|
|
22
|
+
const rowId = gridRowIdSelector(apiRef.current.state, row);
|
|
23
23
|
if (!isSingleSelectColDef(colDef)) {
|
|
24
24
|
return '';
|
|
25
25
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GridStateCommunity } from '../../models/gridStateCommunity';
|
|
2
|
+
import type { GridRowId, GridRowModel } from '../../models/gridRows';
|
|
3
|
+
/**
|
|
4
|
+
* Get the row id for a given row
|
|
5
|
+
* @param state - The grid state
|
|
6
|
+
* @param {GridRowModel} row - The row to get the id for
|
|
7
|
+
* @returns {GridRowId} The row id
|
|
8
|
+
*/
|
|
9
|
+
export declare const gridRowIdSelector: <State extends GridStateCommunity>(state: State, row: GridRowModel) => GridRowId;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GRID_ID_AUTOGENERATED } from "../features/rows/gridRowsUtils.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Get the row id for a given row
|
|
5
|
+
* @param state - The grid state
|
|
6
|
+
* @param {GridRowModel} row - The row to get the id for
|
|
7
|
+
* @returns {GridRowId} The row id
|
|
8
|
+
*/
|
|
9
|
+
export const gridRowIdSelector = (state, row) => {
|
|
10
|
+
if (GRID_ID_AUTOGENERATED in row) {
|
|
11
|
+
return row[GRID_ID_AUTOGENERATED];
|
|
12
|
+
}
|
|
13
|
+
return state.props.getRowId ? state.props.getRowId(row) : row.id;
|
|
14
|
+
};
|
package/hooks/core/index.d.ts
CHANGED
package/hooks/core/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { gridRowIdSelector } from "./gridPropsSelectors.js";
|
|
@@ -6,6 +6,7 @@ import { useGridLocaleText } from "./useGridLocaleText.js";
|
|
|
6
6
|
import { useGridPipeProcessing } from "./pipeProcessing/index.js";
|
|
7
7
|
import { useGridStrategyProcessing } from "./strategyProcessing/index.js";
|
|
8
8
|
import { useGridStateInitialization } from "./useGridStateInitialization.js";
|
|
9
|
+
import { useGridProps } from "./useGridProps.js";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Initialize the technical pieces of the DataGrid (logger, state, ...) that any DataGrid implementation needs
|
|
@@ -13,6 +14,7 @@ import { useGridStateInitialization } from "./useGridStateInitialization.js";
|
|
|
13
14
|
export const useGridInitialization = (inputApiRef, props) => {
|
|
14
15
|
const privateApiRef = useGridApiInitialization(inputApiRef, props);
|
|
15
16
|
useGridRefs(privateApiRef);
|
|
17
|
+
useGridProps(privateApiRef, props);
|
|
16
18
|
useGridIsRtl(privateApiRef);
|
|
17
19
|
useGridLoggerFactory(privateApiRef, props);
|
|
18
20
|
useGridStateInitialization(privateApiRef);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RefObject } from '@mui/x-internals/types';
|
|
2
|
+
import type { DataGridProps } from '../../models/props/DataGridProps';
|
|
3
|
+
import type { GridPrivateApiCommon } from '../../models/api/gridApiCommon';
|
|
4
|
+
import type { GridStateInitializer } from '../utils/useGridInitializeState';
|
|
5
|
+
type Props = Pick<DataGridProps, 'getRowId'>;
|
|
6
|
+
export declare const propsStateInitializer: GridStateInitializer<Props>;
|
|
7
|
+
export declare const useGridProps: <PrivateApi extends GridPrivateApiCommon>(apiRef: RefObject<PrivateApi>, props: Props) => void;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export const propsStateInitializer = (state, props) => {
|
|
4
|
+
return _extends({}, state, {
|
|
5
|
+
props: {
|
|
6
|
+
getRowId: props.getRowId
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export const useGridProps = (apiRef, props) => {
|
|
11
|
+
React.useEffect(() => {
|
|
12
|
+
apiRef.current.setState(state => _extends({}, state, {
|
|
13
|
+
props: {
|
|
14
|
+
getRowId: props.getRowId
|
|
15
|
+
}
|
|
16
|
+
}));
|
|
17
|
+
}, [apiRef, props.getRowId]);
|
|
18
|
+
};
|
|
@@ -125,8 +125,7 @@ export function useGridDimensions(apiRef, props) {
|
|
|
125
125
|
// All the floating point dimensions should be rounded to .1 decimal places to avoid subpixel rendering issues
|
|
126
126
|
// https://github.com/mui/mui-x/issues/9550#issuecomment-1619020477
|
|
127
127
|
// https://github.com/mui/mui-x/issues/15721
|
|
128
|
-
const
|
|
129
|
-
const scrollbarSize = measureScrollbarSize(rootElement, props.scrollbarSize);
|
|
128
|
+
const scrollbarSize = measureScrollbarSize(apiRef.current.mainElementRef.current, props.scrollbarSize);
|
|
130
129
|
const rowsMeta = gridRowsMetaSelector(apiRef.current.state);
|
|
131
130
|
const topContainerHeight = headersTotalHeight + rowsMeta.pinnedTopRowsTotalHeight;
|
|
132
131
|
const bottomContainerHeight = rowsMeta.pinnedBottomRowsTotalHeight;
|
|
@@ -287,28 +286,28 @@ function getStaticDimensions(props, apiRef, density, pinnedColumnns) {
|
|
|
287
286
|
};
|
|
288
287
|
}
|
|
289
288
|
const scrollbarSizeCache = new WeakMap();
|
|
290
|
-
function measureScrollbarSize(
|
|
289
|
+
function measureScrollbarSize(element, scrollbarSize) {
|
|
291
290
|
if (scrollbarSize !== undefined) {
|
|
292
291
|
return scrollbarSize;
|
|
293
292
|
}
|
|
294
|
-
if (
|
|
293
|
+
if (element === null) {
|
|
295
294
|
return 0;
|
|
296
295
|
}
|
|
297
|
-
const cachedSize = scrollbarSizeCache.get(
|
|
296
|
+
const cachedSize = scrollbarSizeCache.get(element);
|
|
298
297
|
if (cachedSize !== undefined) {
|
|
299
298
|
return cachedSize;
|
|
300
299
|
}
|
|
301
|
-
const doc = ownerDocument(
|
|
300
|
+
const doc = ownerDocument(element);
|
|
302
301
|
const scrollDiv = doc.createElement('div');
|
|
303
302
|
scrollDiv.style.width = '99px';
|
|
304
303
|
scrollDiv.style.height = '99px';
|
|
305
304
|
scrollDiv.style.position = 'absolute';
|
|
306
305
|
scrollDiv.style.overflow = 'scroll';
|
|
307
306
|
scrollDiv.className = 'scrollDiv';
|
|
308
|
-
|
|
307
|
+
element.appendChild(scrollDiv);
|
|
309
308
|
const size = scrollDiv.offsetWidth - scrollDiv.clientWidth;
|
|
310
|
-
|
|
311
|
-
scrollbarSizeCache.set(
|
|
309
|
+
element.removeChild(scrollDiv);
|
|
310
|
+
scrollbarSizeCache.set(element, size);
|
|
312
311
|
return size;
|
|
313
312
|
}
|
|
314
313
|
function areElementSizesEqual(a, b) {
|
|
@@ -16,7 +16,7 @@ export const getDerivedPaginationModel = (paginationState, signature, pagination
|
|
|
16
16
|
if (paginationModelProp && (paginationModelProp?.page !== paginationModel.page || paginationModelProp?.pageSize !== paginationModel.pageSize)) {
|
|
17
17
|
paginationModel = paginationModelProp;
|
|
18
18
|
}
|
|
19
|
-
const validPage = getValidPage(paginationModel.page, pageCount);
|
|
19
|
+
const validPage = pageSize === -1 ? 0 : getValidPage(paginationModel.page, pageCount);
|
|
20
20
|
if (validPage !== paginationModel.page) {
|
|
21
21
|
paginationModel = _extends({}, paginationModel, {
|
|
22
22
|
page: validPage
|
|
@@ -114,7 +114,7 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
114
114
|
if (propIsRowSelectable && !propIsRowSelectable(apiRef.current.getRowParams(id))) {
|
|
115
115
|
return false;
|
|
116
116
|
}
|
|
117
|
-
const rowNode = apiRef
|
|
117
|
+
const rowNode = gridRowTreeSelector(apiRef)[id];
|
|
118
118
|
if (rowNode?.type === 'footer' || rowNode?.type === 'pinnedRow') {
|
|
119
119
|
return false;
|
|
120
120
|
}
|
|
@@ -338,7 +338,7 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
338
338
|
return;
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
|
-
const rowNode = apiRef
|
|
341
|
+
const rowNode = gridRowTreeSelector(apiRef)[params.id];
|
|
342
342
|
if (rowNode.type === 'pinnedRow') {
|
|
343
343
|
return;
|
|
344
344
|
}
|
|
@@ -4,6 +4,7 @@ import useLazyRef from '@mui/utils/useLazyRef';
|
|
|
4
4
|
import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
|
|
5
5
|
import { useGridLogger } from "../../utils/useGridLogger.js";
|
|
6
6
|
import { gridRowCountSelector, gridRowsLookupSelector, gridRowTreeSelector, gridRowGroupingNameSelector, gridRowTreeDepthsSelector, gridDataRowIdsSelector, gridRowsDataRowIdToIdLookupSelector, gridRowMaximumTreeDepthSelector, gridRowGroupsToFetchSelector } from "./gridRowsSelector.js";
|
|
7
|
+
import { gridRowIdSelector } from "../../core/gridPropsSelectors.js";
|
|
7
8
|
import { useTimeout } from "../../utils/useTimeout.js";
|
|
8
9
|
import { GridSignature, useGridApiEventHandler } from "../../utils/useGridApiEventHandler.js";
|
|
9
10
|
import { getVisibleRows } from "../../utils/useGridVisibleRows.js";
|
|
@@ -55,16 +56,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
55
56
|
}
|
|
56
57
|
return null;
|
|
57
58
|
}, [apiRef]);
|
|
58
|
-
const
|
|
59
|
-
const getRowId = React.useCallback(row => {
|
|
60
|
-
if (GRID_ID_AUTOGENERATED in row) {
|
|
61
|
-
return row[GRID_ID_AUTOGENERATED];
|
|
62
|
-
}
|
|
63
|
-
if (getRowIdProp) {
|
|
64
|
-
return getRowIdProp(row);
|
|
65
|
-
}
|
|
66
|
-
return row.id;
|
|
67
|
-
}, [getRowIdProp]);
|
|
59
|
+
const getRowId = React.useCallback(row => gridRowIdSelector(apiRef.current.state, row), [apiRef]);
|
|
68
60
|
const throttledRowsChange = React.useCallback(({
|
|
69
61
|
cache,
|
|
70
62
|
throttle
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { warnOnce } from '@mui/x-internals/warning';
|
|
3
|
+
import { gridRowTreeSelector } from "../rows/gridRowsSelector.js";
|
|
3
4
|
export const sanitizeSortModel = (model, disableMultipleColumnsSorting) => {
|
|
4
5
|
if (disableMultipleColumnsSorting && model.length > 1) {
|
|
5
6
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -39,7 +40,7 @@ const parseSortItem = (sortItem, apiRef) => {
|
|
|
39
40
|
const getSortCellParams = id => ({
|
|
40
41
|
id,
|
|
41
42
|
field: column.field,
|
|
42
|
-
rowNode: apiRef
|
|
43
|
+
rowNode: gridRowTreeSelector(apiRef)[id],
|
|
43
44
|
value: apiRef.current.getCellValue(id, column.field),
|
|
44
45
|
api: apiRef.current
|
|
45
46
|
});
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type { GridPinnedRowsProps } from '../components/GridPinnedRows';
|
|
|
7
7
|
export { GridHeaders } from '../components/GridHeaders';
|
|
8
8
|
export { GridBaseColumnHeaders } from '../components/columnHeaders/GridBaseColumnHeaders';
|
|
9
9
|
export { DATA_GRID_DEFAULT_SLOTS_COMPONENTS } from '../constants/defaultGridSlotsComponents';
|
|
10
|
+
export { propsStateInitializer } from '../hooks/core/useGridProps';
|
|
10
11
|
export { getGridFilter } from '../components/panel/filterPanel/GridFilterPanel';
|
|
11
12
|
export { useGridRegisterPipeProcessor } from '../hooks/core/pipeProcessing';
|
|
12
13
|
export type { GridPipeProcessor } from '../hooks/core/pipeProcessing';
|
package/internals/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { GridVirtualScrollerRenderZone } from "../components/virtualization/Grid
|
|
|
4
4
|
export { GridHeaders } from "../components/GridHeaders.js";
|
|
5
5
|
export { GridBaseColumnHeaders } from "../components/columnHeaders/GridBaseColumnHeaders.js";
|
|
6
6
|
export { DATA_GRID_DEFAULT_SLOTS_COMPONENTS } from "../constants/defaultGridSlotsComponents.js";
|
|
7
|
+
export { propsStateInitializer } from "../hooks/core/useGridProps.js";
|
|
7
8
|
export { getGridFilter } from "../components/panel/filterPanel/GridFilterPanel.js";
|
|
8
9
|
export { useGridRegisterPipeProcessor } from "../hooks/core/pipeProcessing/index.js";
|
|
9
10
|
export { useGridRegisterStrategyProcessor, GRID_DEFAULT_STRATEGY } from "../hooks/core/strategyProcessing/index.js";
|
package/locales/bnBD.js
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { bnBD as bnBDCore } from '@mui/material/locale';
|
|
2
|
+
import { getGridLocalization } from "../utils/getGridLocalization.js";
|
|
3
|
+
const bnBDGrid = {
|
|
4
|
+
// Root
|
|
5
|
+
noRowsLabel: 'কোনো সারি নেই',
|
|
6
|
+
noResultsOverlayLabel: 'কোনো ফলাফল পাওয়া যায়নি।',
|
|
7
|
+
// Density selector toolbar button text
|
|
8
|
+
toolbarDensity: 'ঘনত্ব',
|
|
9
|
+
toolbarDensityLabel: 'ঘনত্ব',
|
|
10
|
+
toolbarDensityCompact: 'সংকুচিত',
|
|
11
|
+
toolbarDensityStandard: 'মানক',
|
|
12
|
+
toolbarDensityComfortable: 'স্বাচ্ছন্দ্যদায়ক',
|
|
13
|
+
// Columns selector toolbar button text
|
|
14
|
+
toolbarColumns: 'কলাম',
|
|
15
|
+
toolbarColumnsLabel: 'কলাম নির্বাচন করুন',
|
|
16
|
+
// Filters toolbar button text
|
|
17
|
+
toolbarFilters: 'ফিল্টার',
|
|
18
|
+
toolbarFiltersLabel: 'ফিল্টার দেখান',
|
|
19
|
+
toolbarFiltersTooltipHide: 'ফিল্টার লুকান',
|
|
20
|
+
toolbarFiltersTooltipShow: 'ফিল্টার দেখান',
|
|
21
|
+
toolbarFiltersTooltipActive: count => count !== 1 ? `${count} টি সক্রিয় ফিল্টার` : `${count} টি সক্রিয় ফিল্টার`,
|
|
22
|
+
// Quick filter toolbar field
|
|
23
|
+
toolbarQuickFilterPlaceholder: 'অনুসন্ধান করুন…',
|
|
24
|
+
toolbarQuickFilterLabel: 'অনুসন্ধান',
|
|
25
|
+
toolbarQuickFilterDeleteIconLabel: 'পরিষ্কার করুন',
|
|
26
|
+
// Export selector toolbar button text
|
|
27
|
+
toolbarExport: 'এক্সপোর্ট',
|
|
28
|
+
toolbarExportLabel: 'এক্সপোর্ট',
|
|
29
|
+
toolbarExportCSV: 'CSV হিসাবে ডাউনলোড করুন',
|
|
30
|
+
toolbarExportPrint: 'প্রিন্ট করুন',
|
|
31
|
+
toolbarExportExcel: 'Excel হিসাবে ডাউনলোড করুন',
|
|
32
|
+
// Columns management text
|
|
33
|
+
columnsManagementSearchTitle: 'অনুসন্ধান',
|
|
34
|
+
columnsManagementNoColumns: 'কোনো কলাম নেই',
|
|
35
|
+
columnsManagementShowHideAllText: 'সব দেখান/লুকান',
|
|
36
|
+
columnsManagementReset: 'রিসেট',
|
|
37
|
+
columnsManagementDeleteIconLabel: 'পরিষ্কার',
|
|
38
|
+
// Filter panel text
|
|
39
|
+
filterPanelAddFilter: 'ফিল্টার যোগ করুন',
|
|
40
|
+
filterPanelRemoveAll: 'সব সরান',
|
|
41
|
+
filterPanelDeleteIconLabel: 'মুছুন',
|
|
42
|
+
filterPanelLogicOperator: 'লজিক অপারেটর',
|
|
43
|
+
filterPanelOperator: 'অপারেটর',
|
|
44
|
+
filterPanelOperatorAnd: 'এবং',
|
|
45
|
+
filterPanelOperatorOr: 'অথবা',
|
|
46
|
+
filterPanelColumns: 'কলাম',
|
|
47
|
+
filterPanelInputLabel: 'মান',
|
|
48
|
+
filterPanelInputPlaceholder: 'ফিল্টার মান',
|
|
49
|
+
// Filter operators text
|
|
50
|
+
filterOperatorContains: 'অন্তর্ভুক্ত',
|
|
51
|
+
filterOperatorDoesNotContain: 'অন্তর্ভুক্ত নয়',
|
|
52
|
+
filterOperatorEquals: 'সমান',
|
|
53
|
+
filterOperatorDoesNotEqual: 'সমান নয়',
|
|
54
|
+
filterOperatorStartsWith: 'দিয়ে শুরু হয়',
|
|
55
|
+
filterOperatorEndsWith: 'দিয়ে শেষ হয়',
|
|
56
|
+
filterOperatorIs: 'হচ্ছে',
|
|
57
|
+
filterOperatorNot: 'হচ্ছে না',
|
|
58
|
+
filterOperatorAfter: 'পরবর্তী',
|
|
59
|
+
filterOperatorOnOrAfter: 'এই তারিখ বা পরবর্তী',
|
|
60
|
+
filterOperatorBefore: 'পূর্ববর্তী',
|
|
61
|
+
filterOperatorOnOrBefore: 'এই তারিখ বা পূর্ববর্তী',
|
|
62
|
+
filterOperatorIsEmpty: 'খালি',
|
|
63
|
+
filterOperatorIsNotEmpty: 'খালি নয়',
|
|
64
|
+
filterOperatorIsAnyOf: 'এর যেকোনো একটি',
|
|
65
|
+
'filterOperator=': '=',
|
|
66
|
+
'filterOperator!=': '!=',
|
|
67
|
+
'filterOperator>': '>',
|
|
68
|
+
'filterOperator>=': '>=',
|
|
69
|
+
'filterOperator<': '<',
|
|
70
|
+
'filterOperator<=': '<=',
|
|
71
|
+
// Header filter operators text
|
|
72
|
+
headerFilterOperatorContains: 'অন্তর্ভুক্ত',
|
|
73
|
+
headerFilterOperatorDoesNotContain: 'অন্তর্ভুক্ত নয়',
|
|
74
|
+
headerFilterOperatorEquals: 'সমান',
|
|
75
|
+
headerFilterOperatorDoesNotEqual: 'সমান নয়',
|
|
76
|
+
headerFilterOperatorStartsWith: 'দিয়ে শুরু হয়',
|
|
77
|
+
headerFilterOperatorEndsWith: 'দিয়ে শেষ হয়',
|
|
78
|
+
headerFilterOperatorIs: 'হচ্ছে',
|
|
79
|
+
headerFilterOperatorNot: 'হচ্ছে না',
|
|
80
|
+
headerFilterOperatorAfter: 'পরবর্তী',
|
|
81
|
+
headerFilterOperatorOnOrAfter: 'এই তারিখ বা পরবর্তী',
|
|
82
|
+
headerFilterOperatorBefore: 'পূর্ববর্তী',
|
|
83
|
+
headerFilterOperatorOnOrBefore: 'এই তারিখ বা পূর্ববর্তী',
|
|
84
|
+
headerFilterOperatorIsEmpty: 'খালি',
|
|
85
|
+
headerFilterOperatorIsNotEmpty: 'খালি নয়',
|
|
86
|
+
headerFilterOperatorIsAnyOf: 'এর যেকোনো একটি',
|
|
87
|
+
'headerFilterOperator=': 'সমান',
|
|
88
|
+
'headerFilterOperator!=': 'সমান নয়',
|
|
89
|
+
'headerFilterOperator>': 'বড়',
|
|
90
|
+
'headerFilterOperator>=': 'বড় বা সমান',
|
|
91
|
+
'headerFilterOperator<': 'ছোট',
|
|
92
|
+
'headerFilterOperator<=': 'ছোট বা সমান',
|
|
93
|
+
// Filter values text
|
|
94
|
+
filterValueAny: 'যেকোনো',
|
|
95
|
+
filterValueTrue: 'সত্য',
|
|
96
|
+
filterValueFalse: 'মিথ্যা',
|
|
97
|
+
// Column menu text
|
|
98
|
+
columnMenuLabel: 'মেনু',
|
|
99
|
+
columnMenuShowColumns: 'কলাম দেখান',
|
|
100
|
+
columnMenuManageColumns: 'কলাম পরিচালনা করুন',
|
|
101
|
+
columnMenuFilter: 'ফিল্টার',
|
|
102
|
+
columnMenuHideColumn: 'কলাম লুকান',
|
|
103
|
+
columnMenuUnsort: 'সাজানো বাতিল করুন',
|
|
104
|
+
columnMenuSortAsc: 'ASC অনুযায়ী সাজান',
|
|
105
|
+
columnMenuSortDesc: 'DESC অনুযায়ী সাজান',
|
|
106
|
+
// Column header text
|
|
107
|
+
columnHeaderFiltersTooltipActive: count => count !== 1 ? `${count} টি সক্রিয় ফিল্টার` : `${count} টি সক্রিয় ফিল্টার`,
|
|
108
|
+
columnHeaderFiltersLabel: 'ফিল্টার দেখান',
|
|
109
|
+
columnHeaderSortIconLabel: 'সাজান',
|
|
110
|
+
// Rows selected footer text
|
|
111
|
+
footerRowSelected: count => count !== 1 ? `${count.toLocaleString()} টি সারি নির্বাচিত` : `${count.toLocaleString()} টি সারি নির্বাচিত`,
|
|
112
|
+
// Total row amount footer text
|
|
113
|
+
footerTotalRows: 'মোট সারি:',
|
|
114
|
+
// Total visible row amount footer text
|
|
115
|
+
footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} of ${totalCount.toLocaleString()}`,
|
|
116
|
+
// Checkbox selection text
|
|
117
|
+
checkboxSelectionHeaderName: 'চেকবক্স নির্বাচন',
|
|
118
|
+
checkboxSelectionSelectAllRows: 'সব সারি নির্বাচন করুন',
|
|
119
|
+
checkboxSelectionUnselectAllRows: 'সব সারি নির্বাচন বাতিল করুন',
|
|
120
|
+
checkboxSelectionSelectRow: 'সারি নির্বাচন করুন',
|
|
121
|
+
checkboxSelectionUnselectRow: 'সারি নির্বাচন বাতিল করুন',
|
|
122
|
+
// Boolean cell text
|
|
123
|
+
booleanCellTrueLabel: 'হ্যাঁ',
|
|
124
|
+
booleanCellFalseLabel: 'না',
|
|
125
|
+
// Actions cell more text
|
|
126
|
+
actionsCellMore: 'আরও',
|
|
127
|
+
// Column pinning text
|
|
128
|
+
pinToLeft: 'বাঁ দিকে পিন করুন',
|
|
129
|
+
pinToRight: 'ডান দিকে পিন করুন',
|
|
130
|
+
unpin: 'আনপিন করুন',
|
|
131
|
+
// Tree Data
|
|
132
|
+
treeDataGroupingHeaderName: 'গ্রুপ',
|
|
133
|
+
// treeDataExpand: 'see children',
|
|
134
|
+
// treeDataCollapse: 'hide children',
|
|
135
|
+
|
|
136
|
+
// Grouping columns
|
|
137
|
+
groupingColumnHeaderName: 'গ্রুপ',
|
|
138
|
+
groupColumn: name => `${name} অনুসারে গ্রুপ করুন`,
|
|
139
|
+
unGroupColumn: name => `${name} অনুসারে গ্রুপ বন্ধ করুন`,
|
|
140
|
+
// Master/detail
|
|
141
|
+
detailPanelToggle: 'বিস্তারিত প্যানেল টগল করুন',
|
|
142
|
+
expandDetailPanel: 'সম্প্রসারিত করুন',
|
|
143
|
+
collapseDetailPanel: 'সংকুচিত করুন',
|
|
144
|
+
// Row reordering text
|
|
145
|
+
rowReorderingHeaderName: 'সারি পুনর্বিন্যাস',
|
|
146
|
+
// Aggregation
|
|
147
|
+
aggregationMenuItemHeader: 'সংকলন',
|
|
148
|
+
aggregationFunctionLabelSum: 'যোগফল',
|
|
149
|
+
aggregationFunctionLabelAvg: 'গড়',
|
|
150
|
+
aggregationFunctionLabelMin: 'সর্বনিম্ন',
|
|
151
|
+
aggregationFunctionLabelMax: 'সর্বোচ্চ',
|
|
152
|
+
aggregationFunctionLabelSize: 'মাপ'
|
|
153
|
+
};
|
|
154
|
+
export const bnBD = getGridLocalization(bnBDGrid, bnBDCore);
|
package/locales/index.d.ts
CHANGED
package/locales/index.js
CHANGED
|
@@ -69,7 +69,6 @@ export interface GridRowApi {
|
|
|
69
69
|
getRowId: <R extends GridValidRowModel = any>(row: R) => GridRowId;
|
|
70
70
|
/**
|
|
71
71
|
* Gets the row node from the internal tree structure.
|
|
72
|
-
* TODO rows v6: Rename `getTreeNode`
|
|
73
72
|
* @param {GridRowId} id The id of the row.
|
|
74
73
|
* @returns {GridTreeNode} The tree node.
|
|
75
74
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { GridColumnMenuState, GridColumnsInitialState, GridColumnsState, GridColumnsGroupingState, GridColumnPinningState, GridDensityState, GridDimensionsState, GridFilterInitialState, GridFilterState, GridFocusState, GridPaginationInitialState, GridPaginationState, GridPreferencePanelInitialState, GridPreferencePanelState, GridRowsState, GridSortingInitialState, GridSortingState, GridTabIndexState, GridVirtualizationState } from '../hooks';
|
|
2
|
+
import type { DataGridProps } from './props/DataGridProps';
|
|
2
3
|
import type { GridRowsMetaState } from '../hooks/features/rows/gridRowsMetaState';
|
|
3
4
|
import type { GridEditingState } from './gridEditRowModel';
|
|
4
5
|
import { GridHeaderFilteringState } from './gridHeaderFilteringModel';
|
|
@@ -7,11 +8,17 @@ import type { GridVisibleRowsLookupState } from '../hooks/features/filter/gridFi
|
|
|
7
8
|
import type { GridColumnResizeState } from '../hooks/features/columnResize';
|
|
8
9
|
import type { GridRowSpanningState } from '../hooks/features/rows/useGridRowSpanning';
|
|
9
10
|
import type { GridListViewState } from '../hooks/features/listView/useGridListView';
|
|
11
|
+
/**
|
|
12
|
+
* Some props are passed on the state to enable grid selectors to select
|
|
13
|
+
* and react to them.
|
|
14
|
+
*/
|
|
15
|
+
type GridStateProps = Pick<DataGridProps, 'getRowId'>;
|
|
10
16
|
/**
|
|
11
17
|
* The state of Data Grid.
|
|
12
18
|
*/
|
|
13
19
|
export interface GridStateCommunity {
|
|
14
20
|
isRtl: boolean;
|
|
21
|
+
props: GridStateProps;
|
|
15
22
|
dimensions: GridDimensionsState;
|
|
16
23
|
rows: GridRowsState;
|
|
17
24
|
visibleRowsLookup: GridVisibleRowsLookupState;
|
|
@@ -50,3 +57,4 @@ export interface GridInitialStateCommunity {
|
|
|
50
57
|
left: number;
|
|
51
58
|
};
|
|
52
59
|
}
|
|
60
|
+
export {};
|
|
@@ -743,6 +743,8 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
743
743
|
columns: readonly GridColDef<R>[];
|
|
744
744
|
/**
|
|
745
745
|
* Return the id of a given [[GridRowModel]].
|
|
746
|
+
* Ensure the reference of this prop is stable to avoid performance implications.
|
|
747
|
+
* It could be done by either defining the prop outside of the component or by memoizing it.
|
|
746
748
|
*/
|
|
747
749
|
getRowId?: GridRowIdGetter<R>;
|
|
748
750
|
/**
|
|
@@ -282,6 +282,8 @@ DataGridRaw.propTypes = {
|
|
|
282
282
|
getRowHeight: PropTypes.func,
|
|
283
283
|
/**
|
|
284
284
|
* Return the id of a given [[GridRowModel]].
|
|
285
|
+
* Ensure the reference of this prop is stable to avoid performance implications.
|
|
286
|
+
* It could be done by either defining the prop outside of the component or by memoizing it.
|
|
285
287
|
*/
|
|
286
288
|
getRowId: PropTypes.func,
|
|
287
289
|
/**
|
|
@@ -29,6 +29,7 @@ import { useGridVirtualization, virtualizationStateInitializer } from "../hooks/
|
|
|
29
29
|
import { columnResizeStateInitializer, useGridColumnResize } from "../hooks/features/columnResize/useGridColumnResize.js";
|
|
30
30
|
import { rowSpanningStateInitializer, useGridRowSpanning } from "../hooks/features/rows/useGridRowSpanning.js";
|
|
31
31
|
import { listViewStateInitializer, useGridListView } from "../hooks/features/listView/useGridListView.js";
|
|
32
|
+
import { propsStateInitializer } from "../hooks/core/useGridProps.js";
|
|
32
33
|
export const useDataGridComponent = (inputApiRef, props) => {
|
|
33
34
|
const apiRef = useGridInitialization(inputApiRef, props);
|
|
34
35
|
|
|
@@ -41,6 +42,7 @@ export const useDataGridComponent = (inputApiRef, props) => {
|
|
|
41
42
|
/**
|
|
42
43
|
* Register all state initializers here.
|
|
43
44
|
*/
|
|
45
|
+
useGridInitializeState(propsStateInitializer, apiRef, props);
|
|
44
46
|
useGridInitializeState(rowSelectionStateInitializer, apiRef, props);
|
|
45
47
|
useGridInitializeState(columnsStateInitializer, apiRef, props);
|
|
46
48
|
useGridInitializeState(rowsStateInitializer, apiRef, props);
|