@mui/x-data-grid 7.26.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +115 -0
  2. package/DataGrid/DataGrid.js +8 -0
  3. package/DataGrid/useDataGridComponent.js +3 -1
  4. package/colDef/gridCheckboxSelectionColDef.js +2 -1
  5. package/colDef/gridDateColDef.js +3 -2
  6. package/colDef/gridSingleSelectColDef.js +2 -2
  7. package/constants/dataGridPropsDefaultValues.js +1 -0
  8. package/hooks/core/gridPropsSelectors.d.ts +9 -0
  9. package/hooks/core/gridPropsSelectors.js +14 -0
  10. package/hooks/core/index.d.ts +1 -0
  11. package/hooks/core/index.js +1 -1
  12. package/hooks/core/useGridInitialization.js +2 -0
  13. package/hooks/core/useGridProps.d.ts +8 -0
  14. package/hooks/core/useGridProps.js +18 -0
  15. package/hooks/features/clipboard/useGridClipboard.js +1 -1
  16. package/hooks/features/dimensions/useGridDimensions.js +8 -9
  17. package/hooks/features/pagination/useGridPaginationModel.d.ts +1 -1
  18. package/hooks/features/pagination/useGridPaginationModel.js +45 -1
  19. package/hooks/features/rowSelection/useGridRowSelection.js +2 -2
  20. package/hooks/features/rows/useGridRows.js +2 -10
  21. package/hooks/features/sorting/gridSortingUtils.js +2 -1
  22. package/hooks/utils/useGridNativeEventListener.d.ts +0 -1
  23. package/hooks/utils/useGridNativeEventListener.js +12 -22
  24. package/index.js +1 -1
  25. package/internals/index.d.ts +1 -0
  26. package/internals/index.js +1 -0
  27. package/locales/bnBD.d.ts +2 -0
  28. package/locales/bnBD.js +154 -0
  29. package/locales/index.d.ts +1 -0
  30. package/locales/index.js +1 -0
  31. package/locales/plPL.js +31 -35
  32. package/locales/ukUA.js +9 -10
  33. package/models/api/gridRowApi.d.ts +0 -1
  34. package/models/gridStateCommunity.d.ts +8 -0
  35. package/models/props/DataGridProps.d.ts +8 -0
  36. package/modern/DataGrid/DataGrid.js +8 -0
  37. package/modern/DataGrid/useDataGridComponent.js +3 -1
  38. package/modern/colDef/gridCheckboxSelectionColDef.js +2 -1
  39. package/modern/colDef/gridDateColDef.js +3 -2
  40. package/modern/colDef/gridSingleSelectColDef.js +2 -2
  41. package/modern/constants/dataGridPropsDefaultValues.js +1 -0
  42. package/modern/hooks/core/gridPropsSelectors.js +14 -0
  43. package/modern/hooks/core/index.js +1 -1
  44. package/modern/hooks/core/useGridInitialization.js +2 -0
  45. package/modern/hooks/core/useGridProps.js +18 -0
  46. package/modern/hooks/features/clipboard/useGridClipboard.js +1 -1
  47. package/modern/hooks/features/dimensions/useGridDimensions.js +8 -9
  48. package/modern/hooks/features/pagination/useGridPaginationModel.js +45 -1
  49. package/modern/hooks/features/rowSelection/useGridRowSelection.js +2 -2
  50. package/modern/hooks/features/rows/useGridRows.js +2 -10
  51. package/modern/hooks/features/sorting/gridSortingUtils.js +2 -1
  52. package/modern/hooks/utils/useGridNativeEventListener.js +12 -22
  53. package/modern/index.js +1 -1
  54. package/modern/internals/index.js +1 -0
  55. package/modern/locales/bnBD.js +154 -0
  56. package/modern/locales/index.js +1 -0
  57. package/modern/locales/plPL.js +31 -35
  58. package/modern/locales/ukUA.js +9 -10
  59. package/node/DataGrid/DataGrid.js +8 -0
  60. package/node/DataGrid/useDataGridComponent.js +3 -1
  61. package/node/colDef/gridCheckboxSelectionColDef.js +2 -1
  62. package/node/colDef/gridDateColDef.js +3 -2
  63. package/node/colDef/gridSingleSelectColDef.js +2 -2
  64. package/node/constants/dataGridPropsDefaultValues.js +1 -0
  65. package/node/hooks/core/gridPropsSelectors.js +20 -0
  66. package/node/hooks/core/index.js +8 -1
  67. package/node/hooks/core/useGridInitialization.js +2 -0
  68. package/node/hooks/core/useGridProps.js +28 -0
  69. package/node/hooks/features/clipboard/useGridClipboard.js +1 -1
  70. package/node/hooks/features/dimensions/useGridDimensions.js +8 -9
  71. package/node/hooks/features/pagination/useGridPaginationModel.js +45 -1
  72. package/node/hooks/features/rowSelection/useGridRowSelection.js +2 -2
  73. package/node/hooks/features/rows/useGridRows.js +2 -10
  74. package/node/hooks/features/sorting/gridSortingUtils.js +2 -1
  75. package/node/hooks/utils/useGridNativeEventListener.js +12 -23
  76. package/node/index.js +1 -1
  77. package/node/internals/index.js +8 -0
  78. package/node/locales/bnBD.js +160 -0
  79. package/node/locales/index.js +11 -0
  80. package/node/locales/plPL.js +31 -35
  81. package/node/locales/ukUA.js +9 -10
  82. package/package.json +1 -1
@@ -1,7 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import { gridFilterModelSelector, gridFilterActiveItemsSelector } from "../filter/gridFilterSelector.js";
3
4
  import { gridDensityFactorSelector } from "../density/index.js";
4
5
  import { useGridLogger, useGridSelector, useGridApiMethod, useGridApiEventHandler } from "../../utils/index.js";
6
+ import { isDeepEqual, runIf } from "../../../utils/utils.js";
5
7
  import { useGridRegisterPipeProcessor } from "../../core/pipeProcessing/index.js";
6
8
  import { gridPageCountSelector, gridPaginationModelSelector } from "./gridPaginationSelector.js";
7
9
  import { getPageCount, defaultPageSize, throwIfPageSizeExceedsTheLimit, getDefaultGridPaginationModel, getValidPage } from "./gridPaginationUtils.js";
@@ -14,7 +16,7 @@ export const getDerivedPaginationModel = (paginationState, signature, pagination
14
16
  if (paginationModelProp && (paginationModelProp?.page !== paginationModel.page || paginationModelProp?.pageSize !== paginationModel.pageSize)) {
15
17
  paginationModel = paginationModelProp;
16
18
  }
17
- const validPage = getValidPage(paginationModel.page, pageCount);
19
+ const validPage = pageSize === -1 ? 0 : getValidPage(paginationModel.page, pageCount);
18
20
  if (validPage !== paginationModel.page) {
19
21
  paginationModel = _extends({}, paginationModel, {
20
22
  page: validPage
@@ -31,6 +33,7 @@ export const getDerivedPaginationModel = (paginationState, signature, pagination
31
33
  export const useGridPaginationModel = (apiRef, props) => {
32
34
  const logger = useGridLogger(apiRef, 'useGridPaginationModel');
33
35
  const densityFactor = useGridSelector(apiRef, gridDensityFactorSelector);
36
+ const previousFilterModel = React.useRef(gridFilterModelSelector(apiRef));
34
37
  const rowHeight = Math.floor(props.rowHeight * densityFactor);
35
38
  apiRef.current.registerControlState({
36
39
  stateId: 'paginationModel',
@@ -143,14 +146,55 @@ export const useGridPaginationModel = (apiRef, props) => {
143
146
  return;
144
147
  }
145
148
  const paginationModel = gridPaginationModelSelector(apiRef);
149
+ if (paginationModel.page === 0) {
150
+ return;
151
+ }
146
152
  const pageCount = gridPageCountSelector(apiRef);
147
153
  if (paginationModel.page > pageCount - 1) {
148
154
  apiRef.current.setPage(Math.max(0, pageCount - 1));
149
155
  }
150
156
  }, [apiRef]);
157
+
158
+ /**
159
+ * Goes to the first row of the grid
160
+ */
161
+ const navigateToStart = React.useCallback(() => {
162
+ const paginationModel = gridPaginationModelSelector(apiRef);
163
+ if (paginationModel.page !== 0) {
164
+ apiRef.current.setPage(0);
165
+ }
166
+
167
+ // If the page was not changed it might be needed to scroll to the top
168
+ const scrollPosition = apiRef.current.getScrollPosition();
169
+ if (scrollPosition.top !== 0) {
170
+ apiRef.current.scroll({
171
+ top: 0
172
+ });
173
+ }
174
+ }, [apiRef]);
175
+
176
+ /**
177
+ * Resets the page only if the active items or quick filter has changed from the last time.
178
+ * This is to avoid resetting the page when the filter model is changed
179
+ * because of and update of the operator from an item that does not have the value
180
+ * or reseting when the filter panel is just opened
181
+ */
182
+ const handleFilterModelChange = React.useCallback(filterModel => {
183
+ const currentActiveFilters = _extends({}, filterModel, {
184
+ // replace items with the active items
185
+ items: gridFilterActiveItemsSelector(apiRef)
186
+ });
187
+ if (isDeepEqual(currentActiveFilters, previousFilterModel.current)) {
188
+ return;
189
+ }
190
+ previousFilterModel.current = currentActiveFilters;
191
+ navigateToStart();
192
+ }, [apiRef, navigateToStart]);
151
193
  useGridApiEventHandler(apiRef, 'viewportInnerSizeChange', handleUpdateAutoPageSize);
152
194
  useGridApiEventHandler(apiRef, 'paginationModelChange', handlePaginationModelChange);
153
195
  useGridApiEventHandler(apiRef, 'rowCountChange', handleRowCountChange);
196
+ useGridApiEventHandler(apiRef, 'sortModelChange', runIf(props.resetPageOnSortFilter, navigateToStart));
197
+ useGridApiEventHandler(apiRef, 'filterModelChange', runIf(props.resetPageOnSortFilter, handleFilterModelChange));
154
198
 
155
199
  /**
156
200
  * EFFECTS
@@ -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.current.getRowNode(id);
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.current.getRowNode(params.id);
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 getRowIdProp = props.getRowId;
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.current.getRowNode(id),
43
+ rowNode: gridRowTreeSelector(apiRef)[id],
43
44
  value: apiRef.current.getCellValue(id, column.field),
44
45
  api: apiRef.current
45
46
  });
@@ -1,27 +1,17 @@
1
- import * as React from 'react';
2
- import { isFunction } from "../../utils/utils.js";
3
1
  import { useGridLogger } from "./useGridLogger.js";
2
+ import { useGridApiOptionHandler } from "./useGridApiEventHandler.js";
4
3
  export const useGridNativeEventListener = (apiRef, ref, eventName, handler, options) => {
5
4
  const logger = useGridLogger(apiRef, 'useNativeEventListener');
6
- const [added, setAdded] = React.useState(false);
7
- const handlerRef = React.useRef(handler);
8
- const targetElement = isFunction(ref) ? ref() : ref?.current ?? null;
9
- const wrapHandler = React.useCallback(event => {
10
- return handlerRef.current && handlerRef.current(event);
11
- }, []);
12
- React.useEffect(() => {
13
- handlerRef.current = handler;
14
- }, [handler]);
15
- React.useEffect(() => {
16
- if (targetElement && eventName && !added) {
17
- logger.debug(`Binding native ${eventName} event`);
18
- targetElement.addEventListener(eventName, wrapHandler, options);
19
- setAdded(true);
20
- const unsubscribe = () => {
21
- logger.debug(`Clearing native ${eventName} event`);
22
- targetElement.removeEventListener(eventName, wrapHandler, options);
23
- };
24
- apiRef.current.subscribeEvent('unmount', unsubscribe);
5
+ useGridApiOptionHandler(apiRef, 'rootMount', () => {
6
+ const targetElement = typeof ref === 'function' ? ref() : ref.current;
7
+ if (!targetElement || !eventName || !handler) {
8
+ return undefined;
25
9
  }
26
- }, [targetElement, wrapHandler, eventName, added, logger, options, apiRef]);
10
+ logger.debug(`Binding native ${eventName} event`);
11
+ targetElement.addEventListener(eventName, handler, options);
12
+ return () => {
13
+ logger.debug(`Clearing native ${eventName} event`);
14
+ targetElement.removeEventListener(eventName, handler, options);
15
+ };
16
+ });
27
17
  };
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.26.0
2
+ * @mui/x-data-grid v7.27.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -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";
@@ -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);
@@ -2,6 +2,7 @@
2
2
  export * from "./arSD.js";
3
3
  export * from "./beBY.js";
4
4
  export * from "./bgBG.js";
5
+ export * from "./bnBD.js";
5
6
  export * from "./csCZ.js";
6
7
  export * from "./daDK.js";
7
8
  export * from "./deDE.js";
@@ -30,12 +30,11 @@ const plPLGrid = {
30
30
  toolbarExportPrint: 'Drukuj',
31
31
  toolbarExportExcel: 'Pobierz jako plik Excel',
32
32
  // Columns management text
33
- // columnsManagementSearchTitle: 'Search',
34
- // columnsManagementNoColumns: 'No columns',
35
- // columnsManagementShowHideAllText: 'Show/Hide All',
36
- // columnsManagementReset: 'Reset',
37
- // columnsManagementDeleteIconLabel: 'Clear',
38
-
33
+ columnsManagementSearchTitle: 'Szukaj',
34
+ columnsManagementNoColumns: 'Brak kolumn',
35
+ columnsManagementShowHideAllText: 'Wyświetl/Ukryj wszystkie',
36
+ columnsManagementReset: 'Resetuj',
37
+ columnsManagementDeleteIconLabel: 'Wyczyść',
39
38
  // Filter panel text
40
39
  filterPanelAddFilter: 'Dodaj filtr',
41
40
  filterPanelRemoveAll: 'Usuń wszystkie',
@@ -63,13 +62,12 @@ const plPLGrid = {
63
62
  filterOperatorIsEmpty: 'jest pusty',
64
63
  filterOperatorIsNotEmpty: 'nie jest pusty',
65
64
  filterOperatorIsAnyOf: 'jest jednym z',
66
- // 'filterOperator=': '=',
67
- // 'filterOperator!=': '!=',
68
- // 'filterOperator>': '>',
69
- // 'filterOperator>=': '>=',
70
- // 'filterOperator<': '<',
71
- // 'filterOperator<=': '<=',
72
-
65
+ 'filterOperator=': 'równa się',
66
+ 'filterOperator!=': 'nie równa się',
67
+ 'filterOperator>': 'większy niż',
68
+ 'filterOperator>=': 'większy lub równy',
69
+ 'filterOperator<': 'mniejszy niż',
70
+ 'filterOperator<=': 'mniejszy lub równy',
73
71
  // Header filter operators text
74
72
  headerFilterOperatorContains: 'Zawiera',
75
73
  // headerFilterOperatorDoesNotContain: 'Does not contain',
@@ -79,20 +77,19 @@ const plPLGrid = {
79
77
  headerFilterOperatorEndsWith: 'Kończy się na',
80
78
  // headerFilterOperatorIs: 'Is',
81
79
  headerFilterOperatorNot: 'Niepuste',
82
- // headerFilterOperatorAfter: 'Is after',
83
- // headerFilterOperatorOnOrAfter: 'Is on or after',
84
- // headerFilterOperatorBefore: 'Is before',
85
- // headerFilterOperatorOnOrBefore: 'Is on or before',
86
- // headerFilterOperatorIsEmpty: 'Is empty',
87
- // headerFilterOperatorIsNotEmpty: 'Is not empty',
88
- // headerFilterOperatorIsAnyOf: 'Is any of',
89
- // 'headerFilterOperator=': 'Equals',
90
- // 'headerFilterOperator!=': 'Not equals',
91
- // 'headerFilterOperator>': 'Greater than',
92
- // 'headerFilterOperator>=': 'Greater than or equal to',
93
- // 'headerFilterOperator<': 'Less than',
94
- // 'headerFilterOperator<=': 'Less than or equal to',
95
-
80
+ headerFilterOperatorAfter: 'Jest po',
81
+ headerFilterOperatorOnOrAfter: 'Jest w lub po',
82
+ headerFilterOperatorBefore: 'Jest przed',
83
+ headerFilterOperatorOnOrBefore: 'Jest w lub przed',
84
+ headerFilterOperatorIsEmpty: 'Jest pusty',
85
+ headerFilterOperatorIsNotEmpty: 'Nie jest pusty',
86
+ headerFilterOperatorIsAnyOf: 'Is any of',
87
+ 'headerFilterOperator=': 'Równa się',
88
+ 'headerFilterOperator!=': 'Nie równa się',
89
+ 'headerFilterOperator>': 'Większy niż',
90
+ 'headerFilterOperator>=': 'Większy lub równy',
91
+ 'headerFilterOperator<': 'Mniejszy niż',
92
+ 'headerFilterOperator<=': 'Mniejszy lub równy',
96
93
  // Filter values text
97
94
  filterValueAny: 'dowolny',
98
95
  filterValueTrue: 'prawda',
@@ -144,14 +141,13 @@ const plPLGrid = {
144
141
  expandDetailPanel: 'Rozwiń',
145
142
  collapseDetailPanel: 'Zwiń',
146
143
  // Row reordering text
147
- rowReorderingHeaderName: 'Porządkowanie wierszy'
148
-
144
+ rowReorderingHeaderName: 'Porządkowanie wierszy',
149
145
  // Aggregation
150
- // aggregationMenuItemHeader: 'Aggregation',
151
- // aggregationFunctionLabelSum: 'sum',
152
- // aggregationFunctionLabelAvg: 'avg',
153
- // aggregationFunctionLabelMin: 'min',
154
- // aggregationFunctionLabelMax: 'max',
155
- // aggregationFunctionLabelSize: 'size',
146
+ aggregationMenuItemHeader: 'Agregacja',
147
+ aggregationFunctionLabelSum: 'suma',
148
+ aggregationFunctionLabelAvg: 'średnia',
149
+ aggregationFunctionLabelMin: 'minimum',
150
+ aggregationFunctionLabelMax: 'maximum',
151
+ aggregationFunctionLabelSize: 'rozmiar'
156
152
  };
157
153
  export const plPL = getGridLocalization(plPLGrid, plPLCore);
@@ -45,12 +45,11 @@ const ukUAGrid = {
45
45
  toolbarExportPrint: 'Друк',
46
46
  toolbarExportExcel: 'Завантажити у форматі Excel',
47
47
  // Columns management text
48
- // columnsManagementSearchTitle: 'Search',
49
- // columnsManagementNoColumns: 'No columns',
50
- // columnsManagementShowHideAllText: 'Show/Hide All',
51
- // columnsManagementReset: 'Reset',
52
- // columnsManagementDeleteIconLabel: 'Clear',
53
-
48
+ columnsManagementSearchTitle: 'Пошук',
49
+ columnsManagementNoColumns: 'Немає стовпців',
50
+ columnsManagementShowHideAllText: 'Показати/Приховати всі',
51
+ columnsManagementReset: 'Скинути',
52
+ columnsManagementDeleteIconLabel: 'Очистити',
54
53
  // Filter panel text
55
54
  filterPanelAddFilter: 'Додати фільтр',
56
55
  filterPanelRemoveAll: 'Видалити всі',
@@ -64,9 +63,9 @@ const ukUAGrid = {
64
63
  filterPanelInputPlaceholder: 'Значення фільтра',
65
64
  // Filter operators text
66
65
  filterOperatorContains: 'містить',
67
- // filterOperatorDoesNotContain: 'does not contain',
66
+ filterOperatorDoesNotContain: 'не містить',
68
67
  filterOperatorEquals: 'дорівнює',
69
- // filterOperatorDoesNotEqual: 'does not equal',
68
+ filterOperatorDoesNotEqual: 'не дорівнює',
70
69
  filterOperatorStartsWith: 'починається з',
71
70
  filterOperatorEndsWith: 'закінчується на',
72
71
  filterOperatorIs: 'дорівнює',
@@ -86,9 +85,9 @@ const ukUAGrid = {
86
85
  'filterOperator<=': '<=',
87
86
  // Header filter operators text
88
87
  headerFilterOperatorContains: 'Містить',
89
- // headerFilterOperatorDoesNotContain: 'Does not contain',
88
+ headerFilterOperatorDoesNotContain: 'Не містить',
90
89
  headerFilterOperatorEquals: 'Дорівнює',
91
- // headerFilterOperatorDoesNotEqual: 'Does not equal',
90
+ headerFilterOperatorDoesNotEqual: 'Не дорівнює',
92
91
  headerFilterOperatorStartsWith: 'Починається з',
93
92
  headerFilterOperatorEndsWith: 'Закінчується на',
94
93
  headerFilterOperatorIs: 'Дорівнює',
@@ -289,6 +289,8 @@ DataGridRaw.propTypes = {
289
289
  getRowHeight: _propTypes.default.func,
290
290
  /**
291
291
  * Return the id of a given [[GridRowModel]].
292
+ * Ensure the reference of this prop is stable to avoid performance implications.
293
+ * It could be done by either defining the prop outside of the component or by memoizing it.
292
294
  */
293
295
  getRowId: _propTypes.default.func,
294
296
  /**
@@ -668,6 +670,12 @@ DataGridRaw.propTypes = {
668
670
  * @returns {Promise<R> | R} The final values to update the row.
669
671
  */
670
672
  processRowUpdate: _propTypes.default.func,
673
+ /**
674
+ * If `true`, the page is set to 0 after each sorting or filtering.
675
+ * This prop will be removed in the next major version and resetting the page will become the default behavior.
676
+ * @default false
677
+ */
678
+ resetPageOnSortFilter: _propTypes.default.bool,
671
679
  /**
672
680
  * The milliseconds throttle delay for resizing the grid.
673
681
  * @default 60
@@ -35,6 +35,7 @@ var _virtualization = require("../hooks/features/virtualization");
35
35
  var _useGridColumnResize = require("../hooks/features/columnResize/useGridColumnResize");
36
36
  var _useGridRowSpanning = require("../hooks/features/rows/useGridRowSpanning");
37
37
  var _useGridListView = require("../hooks/features/listView/useGridListView");
38
+ var _useGridProps = require("../hooks/core/useGridProps");
38
39
  const useDataGridComponent = (inputApiRef, props) => {
39
40
  const apiRef = (0, _useGridInitialization.useGridInitialization)(inputApiRef, props);
40
41
 
@@ -47,10 +48,11 @@ const useDataGridComponent = (inputApiRef, props) => {
47
48
  /**
48
49
  * Register all state initializers here.
49
50
  */
51
+ (0, _useGridInitializeState.useGridInitializeState)(_useGridProps.propsStateInitializer, apiRef, props);
50
52
  (0, _useGridInitializeState.useGridInitializeState)(_useGridRowSelection.rowSelectionStateInitializer, apiRef, props);
51
53
  (0, _useGridInitializeState.useGridInitializeState)(_useGridColumns.columnsStateInitializer, apiRef, props);
52
- (0, _useGridInitializeState.useGridInitializeState)(_useGridPagination.paginationStateInitializer, apiRef, props);
53
54
  (0, _useGridInitializeState.useGridInitializeState)(_useGridRows.rowsStateInitializer, apiRef, props);
55
+ (0, _useGridInitializeState.useGridInitializeState)(_useGridPagination.paginationStateInitializer, apiRef, props);
54
56
  (0, _useGridInitializeState.useGridInitializeState)(_useGridEditing.editingStateInitializer, apiRef, props);
55
57
  (0, _useGridInitializeState.useGridInitializeState)(_useGridFocus.focusStateInitializer, apiRef, props);
56
58
  (0, _useGridInitializeState.useGridInitializeState)(_useGridSorting.sortingStateInitializer, apiRef, props);
@@ -12,6 +12,7 @@ var _GridCellCheckboxRenderer = require("../components/columnSelection/GridCellC
12
12
  var _GridHeaderCheckbox = require("../components/columnSelection/GridHeaderCheckbox");
13
13
  var _gridRowSelectionSelector = require("../hooks/features/rowSelection/gridRowSelectionSelector");
14
14
  var _gridBooleanColDef = require("./gridBooleanColDef");
15
+ var _gridPropsSelectors = require("../hooks/core/gridPropsSelectors");
15
16
  var _jsxRuntime = require("react/jsx-runtime");
16
17
  const GRID_CHECKBOX_SELECTION_FIELD = exports.GRID_CHECKBOX_SELECTION_FIELD = '__check__';
17
18
  const GRID_CHECKBOX_SELECTION_COL_DEF = exports.GRID_CHECKBOX_SELECTION_COL_DEF = (0, _extends2.default)({}, _gridBooleanColDef.GRID_BOOLEAN_COL_DEF, {
@@ -30,7 +31,7 @@ const GRID_CHECKBOX_SELECTION_COL_DEF = exports.GRID_CHECKBOX_SELECTION_COL_DEF
30
31
  display: 'flex',
31
32
  valueGetter: (value, row, column, apiRef) => {
32
33
  const selectionLookup = (0, _gridRowSelectionSelector.selectedIdsLookupSelector)(apiRef);
33
- const rowId = apiRef.current.getRowId(row);
34
+ const rowId = (0, _gridPropsSelectors.gridRowIdSelector)(apiRef.current.state, row);
34
35
  return selectionLookup[rowId] !== undefined;
35
36
  },
36
37
  renderHeader: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridHeaderCheckbox.GridHeaderCheckbox, (0, _extends2.default)({}, params)),
@@ -10,6 +10,7 @@ var _gridSortingUtils = require("../hooks/features/sorting/gridSortingUtils");
10
10
  var _gridDateOperators = require("./gridDateOperators");
11
11
  var _gridStringColDef = require("./gridStringColDef");
12
12
  var _GridEditDateCell = require("../components/cell/GridEditDateCell");
13
+ var _gridPropsSelectors = require("../hooks/core/gridPropsSelectors");
13
14
  function throwIfNotDateObject({
14
15
  value,
15
16
  columnType,
@@ -24,7 +25,7 @@ const gridDateFormatter = (value, row, column, apiRef) => {
24
25
  if (!value) {
25
26
  return '';
26
27
  }
27
- const rowId = apiRef.current.getRowId(row);
28
+ const rowId = (0, _gridPropsSelectors.gridRowIdSelector)(apiRef.current.state, row);
28
29
  throwIfNotDateObject({
29
30
  value,
30
31
  columnType: 'date',
@@ -38,7 +39,7 @@ const gridDateTimeFormatter = (value, row, column, apiRef) => {
38
39
  if (!value) {
39
40
  return '';
40
41
  }
41
- const rowId = apiRef.current.getRowId(row);
42
+ const rowId = (0, _gridPropsSelectors.gridRowIdSelector)(apiRef.current.state, row);
42
43
  throwIfNotDateObject({
43
44
  value,
44
45
  columnType: 'dateTime',
@@ -11,6 +11,7 @@ var _GridEditSingleSelectCell = require("../components/cell/GridEditSingleSelect
11
11
  var _gridSingleSelectOperators = require("./gridSingleSelectOperators");
12
12
  var _filterPanelUtils = require("../components/panel/filterPanel/filterPanelUtils");
13
13
  var _utils = require("../utils/utils");
14
+ var _gridPropsSelectors = require("../hooks/core/gridPropsSelectors");
14
15
  const isArrayOfObjects = options => {
15
16
  return typeof options[0] === 'object';
16
17
  };
@@ -25,8 +26,7 @@ const GRID_SINGLE_SELECT_COL_DEF = exports.GRID_SINGLE_SELECT_COL_DEF = (0, _ext
25
26
  getOptionLabel: defaultGetOptionLabel,
26
27
  getOptionValue: defaultGetOptionValue,
27
28
  valueFormatter(value, row, colDef, apiRef) {
28
- // const { id, field, value, api } = params;
29
- const rowId = apiRef.current.getRowId(row);
29
+ const rowId = (0, _gridPropsSelectors.gridRowIdSelector)(apiRef.current.state, row);
30
30
  if (!(0, _filterPanelUtils.isSingleSelectColDef)(colDef)) {
31
31
  return '';
32
32
  }
@@ -50,6 +50,7 @@ const DATA_GRID_PROPS_DEFAULT_VALUES = exports.DATA_GRID_PROPS_DEFAULT_VALUES =
50
50
  pageSizeOptions: [25, 50, 100],
51
51
  pagination: false,
52
52
  paginationMode: 'client',
53
+ resetPageOnSortFilter: false,
53
54
  resizeThrottleMs: 60,
54
55
  rowBufferPx: 150,
55
56
  rowHeight: 52,
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.gridRowIdSelector = void 0;
7
+ var _gridRowsUtils = require("../features/rows/gridRowsUtils");
8
+ /**
9
+ * Get the row id for a given row
10
+ * @param state - The grid state
11
+ * @param {GridRowModel} row - The row to get the id for
12
+ * @returns {GridRowId} The row id
13
+ */
14
+ const gridRowIdSelector = (state, row) => {
15
+ if (_gridRowsUtils.GRID_ID_AUTOGENERATED in row) {
16
+ return row[_gridRowsUtils.GRID_ID_AUTOGENERATED];
17
+ }
18
+ return state.props.getRowId ? state.props.getRowId(row) : row.id;
19
+ };
20
+ exports.gridRowIdSelector = gridRowIdSelector;