@mui/x-data-grid 5.17.7 → 5.17.8
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 +30 -0
- package/components/panel/GridColumnsPanel.d.ts +2 -0
- package/components/panel/GridColumnsPanel.js +10 -4
- package/hooks/features/rows/gridRowsState.d.ts +1 -0
- package/hooks/features/rows/gridRowsUtils.d.ts +1 -1
- package/hooks/features/rows/gridRowsUtils.js +3 -1
- package/hooks/features/rows/useGridRows.js +25 -7
- package/index.js +1 -1
- package/legacy/components/panel/GridColumnsPanel.js +10 -3
- package/legacy/hooks/features/rows/gridRowsUtils.js +3 -1
- package/legacy/hooks/features/rows/useGridRows.js +27 -7
- package/legacy/index.js +1 -1
- package/legacy/locales/trTR.js +17 -17
- package/locales/trTR.js +17 -17
- package/modern/components/panel/GridColumnsPanel.js +10 -4
- package/modern/hooks/features/rows/gridRowsUtils.js +3 -1
- package/modern/hooks/features/rows/useGridRows.js +25 -7
- package/modern/index.js +1 -1
- package/modern/locales/trTR.js +17 -17
- package/node/components/panel/GridColumnsPanel.js +10 -4
- package/node/hooks/features/rows/gridRowsUtils.js +3 -1
- package/node/hooks/features/rows/useGridRows.js +25 -7
- package/node/index.js +1 -1
- package/node/locales/trTR.js +17 -17
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,36 @@
|
|
|
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.8
|
|
7
|
+
|
|
8
|
+
_Oct 20, 2022_
|
|
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
|
+
- 🌍 Improve Turkish (tr-TR) locale on the data grid and pickers (#6573) @ramazansancar
|
|
14
|
+
|
|
15
|
+
### `@mui/x-data-grid@v5.17.8` / `@mui/x-data-grid-pro@v5.17.8` / `@mui/x-data-grid-premium@v5.17.8`
|
|
16
|
+
|
|
17
|
+
#### Changes
|
|
18
|
+
|
|
19
|
+
- [DataGrid] Add `searchPredicate` prop to `GridColumnsPanel` component (#6572) @cherniavskii
|
|
20
|
+
- [DataGrid] Fix grid not updating state on `rowCount` prop change (#6474) @cherniavskii
|
|
21
|
+
- [DataGridPro] Fix row order being reset after updating the row (#6544) @cherniavskii
|
|
22
|
+
- [l10n] Improve Turkish (tr-TR) locale on the data grid and pickers (#6542) (#6573) @ramazansancar
|
|
23
|
+
|
|
24
|
+
### `@mui/x-date-pickers@v5.0.5` / `@mui/x-date-pickers-pro@v5.0.5`
|
|
25
|
+
|
|
26
|
+
#### Changes
|
|
27
|
+
|
|
28
|
+
- [CalendarPicker] Don't move to closest enabled date when `props.date` contains a disabled date (#6537) @flaviendelangle
|
|
29
|
+
- [DateRangePicker] Fix calendar day outside of month layout shifting on hover (pick #6448) (#6538) @alexfauquette
|
|
30
|
+
- [pickers] Fix typescript issues (#6510) @flaviendelangle
|
|
31
|
+
|
|
32
|
+
### Docs
|
|
33
|
+
|
|
34
|
+
- [docs] Fix 301 link to the sx prop page @oliviertassinari
|
|
35
|
+
|
|
6
36
|
## 5.17.7
|
|
7
37
|
|
|
8
38
|
_Oct 13, 2022_
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { GridPanelWrapperProps } from './GridPanelWrapper';
|
|
3
|
+
import { GridStateColDef } from '../../models/colDef/gridColDef';
|
|
3
4
|
export interface GridColumnsPanelProps extends GridPanelWrapperProps {
|
|
4
5
|
sort?: 'asc' | 'desc';
|
|
6
|
+
searchPredicate?: (column: GridStateColDef, searchValue: string) => boolean;
|
|
5
7
|
}
|
|
6
8
|
declare function GridColumnsPanel(props: GridColumnsPanelProps): JSX.Element;
|
|
7
9
|
declare namespace GridColumnsPanel {
|
|
@@ -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 = ["sort"];
|
|
3
|
+
const _excluded = ["sort", "searchPredicate"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
@@ -59,6 +59,10 @@ const GridIconButtonRoot = styled(IconButton)({
|
|
|
59
59
|
});
|
|
60
60
|
const collator = new Intl.Collator();
|
|
61
61
|
|
|
62
|
+
const defaultSearchPredicate = (column, searchValue) => {
|
|
63
|
+
return (column.headerName || column.field).toLowerCase().indexOf(searchValue) > -1;
|
|
64
|
+
};
|
|
65
|
+
|
|
62
66
|
function GridColumnsPanel(props) {
|
|
63
67
|
var _rootProps$components, _rootProps$components3, _rootProps$components4;
|
|
64
68
|
|
|
@@ -74,7 +78,8 @@ function GridColumnsPanel(props) {
|
|
|
74
78
|
const classes = useUtilityClasses(ownerState);
|
|
75
79
|
|
|
76
80
|
const {
|
|
77
|
-
sort
|
|
81
|
+
sort,
|
|
82
|
+
searchPredicate = defaultSearchPredicate
|
|
78
83
|
} = props,
|
|
79
84
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
80
85
|
|
|
@@ -128,8 +133,8 @@ function GridColumnsPanel(props) {
|
|
|
128
133
|
}
|
|
129
134
|
|
|
130
135
|
const searchValueToCheck = searchValue.toLowerCase();
|
|
131
|
-
return sortedColumns.filter(column => (column
|
|
132
|
-
}, [sortedColumns, searchValue]);
|
|
136
|
+
return sortedColumns.filter(column => searchPredicate(column, searchValueToCheck));
|
|
137
|
+
}, [sortedColumns, searchValue, searchPredicate]);
|
|
133
138
|
React.useEffect(() => {
|
|
134
139
|
searchInputRef.current.focus();
|
|
135
140
|
}, []);
|
|
@@ -191,6 +196,7 @@ process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
|
|
|
191
196
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
192
197
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
193
198
|
// ----------------------------------------------------------------------
|
|
199
|
+
searchPredicate: PropTypes.func,
|
|
194
200
|
sort: PropTypes.oneOf(['asc', 'desc'])
|
|
195
201
|
} : void 0;
|
|
196
202
|
export { GridColumnsPanel };
|
|
@@ -31,6 +31,7 @@ export interface GridRowsInternalCache extends Omit<GridRowTreeCreationParams, '
|
|
|
31
31
|
* The value of the `loading` prop since the last time that the rows state was updated.
|
|
32
32
|
*/
|
|
33
33
|
loadingPropBeforePartialUpdates: DataGridProcessedProps['loading'];
|
|
34
|
+
rowCountPropBeforePartialUpdates: DataGridProcessedProps['rowCount'];
|
|
34
35
|
}
|
|
35
36
|
export interface GridRowsState extends GridRowTreeCreationValue {
|
|
36
37
|
/**
|
|
@@ -11,7 +11,7 @@ import { GridRowsInternalCache, GridRowsState } from './gridRowsState';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function checkGridRowIdIsValid(id: GridRowId, row: GridRowModel | Partial<GridRowModel>, detailErrorMessage?: string): void;
|
|
13
13
|
export declare const getRowIdFromRowModel: (rowModel: GridRowModel, getRowId?: GridRowIdGetter, detailErrorMessage?: string) => GridRowId;
|
|
14
|
-
export declare const createRowsInternalCache: ({ rows, getRowId, loading, }: Pick<DataGridProcessedProps, 'rows' | 'getRowId' | 'loading'>) => GridRowsInternalCache;
|
|
14
|
+
export declare const createRowsInternalCache: ({ rows, getRowId, loading, rowCount, }: Pick<DataGridProcessedProps, 'rows' | 'getRowId' | 'loading' | 'rowCount'>) => GridRowsInternalCache;
|
|
15
15
|
export declare const getRowsStateFromCache: ({ apiRef, previousTree, rowCountProp, loadingProp, }: {
|
|
16
16
|
apiRef: React.MutableRefObject<GridApiCommunity>;
|
|
17
17
|
previousTree: GridRowTreeConfig | null;
|
|
@@ -22,11 +22,13 @@ export const getRowIdFromRowModel = (rowModel, getRowId, detailErrorMessage) =>
|
|
|
22
22
|
export const createRowsInternalCache = ({
|
|
23
23
|
rows,
|
|
24
24
|
getRowId,
|
|
25
|
-
loading
|
|
25
|
+
loading,
|
|
26
|
+
rowCount
|
|
26
27
|
}) => {
|
|
27
28
|
const cache = {
|
|
28
29
|
rowsBeforePartialUpdates: rows,
|
|
29
30
|
loadingPropBeforePartialUpdates: loading,
|
|
31
|
+
rowCountPropBeforePartialUpdates: rowCount,
|
|
30
32
|
idRowsLookup: {},
|
|
31
33
|
idToIdLookup: {},
|
|
32
34
|
ids: []
|
|
@@ -13,7 +13,8 @@ export const rowsStateInitializer = (state, props, apiRef) => {
|
|
|
13
13
|
apiRef.current.unstable_caches.rows = createRowsInternalCache({
|
|
14
14
|
rows: props.rows,
|
|
15
15
|
getRowId: props.getRowId,
|
|
16
|
-
loading: props.loading
|
|
16
|
+
loading: props.loading,
|
|
17
|
+
rowCount: props.rowCount
|
|
17
18
|
});
|
|
18
19
|
return _extends({}, state, {
|
|
19
20
|
rows: getRowsStateFromCache({
|
|
@@ -94,9 +95,10 @@ export const useGridRows = (apiRef, props) => {
|
|
|
94
95
|
throttledRowsChange(createRowsInternalCache({
|
|
95
96
|
rows,
|
|
96
97
|
getRowId: props.getRowId,
|
|
97
|
-
loading: props.loading
|
|
98
|
+
loading: props.loading,
|
|
99
|
+
rowCount: props.rowCount
|
|
98
100
|
}), true);
|
|
99
|
-
}, [logger, props.getRowId, props.loading, throttledRowsChange]);
|
|
101
|
+
}, [logger, props.getRowId, props.loading, props.rowCount, throttledRowsChange]);
|
|
100
102
|
const updateRows = React.useCallback(updates => {
|
|
101
103
|
if (props.signature === GridSignature.DataGrid && updates.length > 1) {
|
|
102
104
|
// TODO: Add test with direct call to `apiRef.current.updateRows` in DataGrid after enabling the `apiRef` on the free plan.
|
|
@@ -119,6 +121,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
119
121
|
const newCache = {
|
|
120
122
|
rowsBeforePartialUpdates: prevCache.rowsBeforePartialUpdates,
|
|
121
123
|
loadingPropBeforePartialUpdates: prevCache.loadingPropBeforePartialUpdates,
|
|
124
|
+
rowCountPropBeforePartialUpdates: prevCache.rowCountPropBeforePartialUpdates,
|
|
122
125
|
idRowsLookup: _extends({}, prevCache.idRowsLookup),
|
|
123
126
|
idToIdLookup: _extends({}, prevCache.idToIdLookup),
|
|
124
127
|
ids: [...prevCache.ids]
|
|
@@ -241,6 +244,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
241
244
|
ids: updatedRows
|
|
242
245
|
})
|
|
243
246
|
}));
|
|
247
|
+
apiRef.current.unstable_caches.rows.ids = updatedRows;
|
|
244
248
|
apiRef.current.publishEvent('rowsSet');
|
|
245
249
|
}, [apiRef, logger]);
|
|
246
250
|
const replaceRows = React.useCallback((firstRowToRender, newRows) => {
|
|
@@ -332,12 +336,13 @@ export const useGridRows = (apiRef, props) => {
|
|
|
332
336
|
cache = createRowsInternalCache({
|
|
333
337
|
rows: props.rows,
|
|
334
338
|
getRowId: props.getRowId,
|
|
335
|
-
loading: props.loading
|
|
339
|
+
loading: props.loading,
|
|
340
|
+
rowCount: props.rowCount
|
|
336
341
|
});
|
|
337
342
|
}
|
|
338
343
|
|
|
339
344
|
throttledRowsChange(cache, false);
|
|
340
|
-
}, [logger, apiRef, props.rows, props.getRowId, props.loading, throttledRowsChange]);
|
|
345
|
+
}, [logger, apiRef, props.rows, props.getRowId, props.loading, props.rowCount, throttledRowsChange]);
|
|
341
346
|
const handleStrategyProcessorChange = React.useCallback(methodName => {
|
|
342
347
|
if (methodName === 'rowTreeCreation') {
|
|
343
348
|
groupRows();
|
|
@@ -386,7 +391,8 @@ export const useGridRows = (apiRef, props) => {
|
|
|
386
391
|
}
|
|
387
392
|
|
|
388
393
|
const areNewRowsAlreadyInState = apiRef.current.unstable_caches.rows.rowsBeforePartialUpdates === props.rows;
|
|
389
|
-
const isNewLoadingAlreadyInState = apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates === props.loading;
|
|
394
|
+
const isNewLoadingAlreadyInState = apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates === props.loading;
|
|
395
|
+
const isNewRowCountAlreadyInState = apiRef.current.unstable_caches.rows.rowCountPropBeforePartialUpdates === props.rowCount; // The new rows have already been applied (most likely in the `'rowGroupsPreProcessingChange'` listener)
|
|
390
396
|
|
|
391
397
|
if (areNewRowsAlreadyInState) {
|
|
392
398
|
// If the loading prop has changed, we need to update its value in the state because it won't be done by `throttledRowsChange`
|
|
@@ -400,6 +406,17 @@ export const useGridRows = (apiRef, props) => {
|
|
|
400
406
|
apiRef.current.forceUpdate();
|
|
401
407
|
}
|
|
402
408
|
|
|
409
|
+
if (!isNewRowCountAlreadyInState) {
|
|
410
|
+
apiRef.current.setState(state => _extends({}, state, {
|
|
411
|
+
rows: _extends({}, state.rows, {
|
|
412
|
+
totalRowCount: Math.max(props.rowCount || 0, state.rows.totalRowCount),
|
|
413
|
+
totalTopLevelRowCount: Math.max(props.rowCount || 0, state.rows.totalTopLevelRowCount)
|
|
414
|
+
})
|
|
415
|
+
}));
|
|
416
|
+
apiRef.current.unstable_caches.rows.rowCountPropBeforePartialUpdates = props.rowCount;
|
|
417
|
+
apiRef.current.forceUpdate();
|
|
418
|
+
}
|
|
419
|
+
|
|
403
420
|
return;
|
|
404
421
|
}
|
|
405
422
|
|
|
@@ -407,7 +424,8 @@ export const useGridRows = (apiRef, props) => {
|
|
|
407
424
|
throttledRowsChange(createRowsInternalCache({
|
|
408
425
|
rows: props.rows,
|
|
409
426
|
getRowId: props.getRowId,
|
|
410
|
-
loading: props.loading
|
|
427
|
+
loading: props.loading,
|
|
428
|
+
rowCount: props.rowCount
|
|
411
429
|
}), false);
|
|
412
430
|
}, [props.rows, props.rowCount, props.getRowId, props.loading, logger, throttledRowsChange, apiRef]);
|
|
413
431
|
};
|
package/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
|
-
var _excluded = ["sort"];
|
|
6
|
+
var _excluded = ["sort", "searchPredicate"];
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
@@ -66,6 +66,10 @@ var GridIconButtonRoot = styled(IconButton)({
|
|
|
66
66
|
});
|
|
67
67
|
var collator = new Intl.Collator();
|
|
68
68
|
|
|
69
|
+
var defaultSearchPredicate = function defaultSearchPredicate(column, searchValue) {
|
|
70
|
+
return (column.headerName || column.field).toLowerCase().indexOf(searchValue) > -1;
|
|
71
|
+
};
|
|
72
|
+
|
|
69
73
|
function GridColumnsPanel(props) {
|
|
70
74
|
var _rootProps$components, _rootProps$components3, _rootProps$components4;
|
|
71
75
|
|
|
@@ -86,6 +90,8 @@ function GridColumnsPanel(props) {
|
|
|
86
90
|
var classes = useUtilityClasses(ownerState);
|
|
87
91
|
|
|
88
92
|
var sort = props.sort,
|
|
93
|
+
_props$searchPredicat = props.searchPredicate,
|
|
94
|
+
searchPredicate = _props$searchPredicat === void 0 ? defaultSearchPredicate : _props$searchPredicat,
|
|
89
95
|
other = _objectWithoutProperties(props, _excluded);
|
|
90
96
|
|
|
91
97
|
var sortedColumns = React.useMemo(function () {
|
|
@@ -146,9 +152,9 @@ function GridColumnsPanel(props) {
|
|
|
146
152
|
|
|
147
153
|
var searchValueToCheck = searchValue.toLowerCase();
|
|
148
154
|
return sortedColumns.filter(function (column) {
|
|
149
|
-
return (column
|
|
155
|
+
return searchPredicate(column, searchValueToCheck);
|
|
150
156
|
});
|
|
151
|
-
}, [sortedColumns, searchValue]);
|
|
157
|
+
}, [sortedColumns, searchValue, searchPredicate]);
|
|
152
158
|
React.useEffect(function () {
|
|
153
159
|
searchInputRef.current.focus();
|
|
154
160
|
}, []);
|
|
@@ -214,6 +220,7 @@ process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
|
|
|
214
220
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
215
221
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
216
222
|
// ----------------------------------------------------------------------
|
|
223
|
+
searchPredicate: PropTypes.func,
|
|
217
224
|
sort: PropTypes.oneOf(['asc', 'desc'])
|
|
218
225
|
} : void 0;
|
|
219
226
|
export { GridColumnsPanel };
|
|
@@ -25,10 +25,12 @@ export var getRowIdFromRowModel = function getRowIdFromRowModel(rowModel, getRow
|
|
|
25
25
|
export var createRowsInternalCache = function createRowsInternalCache(_ref) {
|
|
26
26
|
var rows = _ref.rows,
|
|
27
27
|
getRowId = _ref.getRowId,
|
|
28
|
-
loading = _ref.loading
|
|
28
|
+
loading = _ref.loading,
|
|
29
|
+
rowCount = _ref.rowCount;
|
|
29
30
|
var cache = {
|
|
30
31
|
rowsBeforePartialUpdates: rows,
|
|
31
32
|
loadingPropBeforePartialUpdates: loading,
|
|
33
|
+
rowCountPropBeforePartialUpdates: rowCount,
|
|
32
34
|
idRowsLookup: {},
|
|
33
35
|
idToIdLookup: {},
|
|
34
36
|
ids: []
|
|
@@ -16,7 +16,8 @@ export var rowsStateInitializer = function rowsStateInitializer(state, props, ap
|
|
|
16
16
|
apiRef.current.unstable_caches.rows = createRowsInternalCache({
|
|
17
17
|
rows: props.rows,
|
|
18
18
|
getRowId: props.getRowId,
|
|
19
|
-
loading: props.loading
|
|
19
|
+
loading: props.loading,
|
|
20
|
+
rowCount: props.rowCount
|
|
20
21
|
});
|
|
21
22
|
return _extends({}, state, {
|
|
22
23
|
rows: getRowsStateFromCache({
|
|
@@ -100,9 +101,10 @@ export var useGridRows = function useGridRows(apiRef, props) {
|
|
|
100
101
|
throttledRowsChange(createRowsInternalCache({
|
|
101
102
|
rows: rows,
|
|
102
103
|
getRowId: props.getRowId,
|
|
103
|
-
loading: props.loading
|
|
104
|
+
loading: props.loading,
|
|
105
|
+
rowCount: props.rowCount
|
|
104
106
|
}), true);
|
|
105
|
-
}, [logger, props.getRowId, props.loading, throttledRowsChange]);
|
|
107
|
+
}, [logger, props.getRowId, props.loading, props.rowCount, throttledRowsChange]);
|
|
106
108
|
var updateRows = React.useCallback(function (updates) {
|
|
107
109
|
if (props.signature === GridSignature.DataGrid && updates.length > 1) {
|
|
108
110
|
// TODO: Add test with direct call to `apiRef.current.updateRows` in DataGrid after enabling the `apiRef` on the free plan.
|
|
@@ -125,6 +127,7 @@ export var useGridRows = function useGridRows(apiRef, props) {
|
|
|
125
127
|
var newCache = {
|
|
126
128
|
rowsBeforePartialUpdates: prevCache.rowsBeforePartialUpdates,
|
|
127
129
|
loadingPropBeforePartialUpdates: prevCache.loadingPropBeforePartialUpdates,
|
|
130
|
+
rowCountPropBeforePartialUpdates: prevCache.rowCountPropBeforePartialUpdates,
|
|
128
131
|
idRowsLookup: _extends({}, prevCache.idRowsLookup),
|
|
129
132
|
idToIdLookup: _extends({}, prevCache.idToIdLookup),
|
|
130
133
|
ids: _toConsumableArray(prevCache.ids)
|
|
@@ -265,6 +268,7 @@ export var useGridRows = function useGridRows(apiRef, props) {
|
|
|
265
268
|
})
|
|
266
269
|
});
|
|
267
270
|
});
|
|
271
|
+
apiRef.current.unstable_caches.rows.ids = updatedRows;
|
|
268
272
|
apiRef.current.publishEvent('rowsSet');
|
|
269
273
|
}, [apiRef, logger]);
|
|
270
274
|
var replaceRows = React.useCallback(function (firstRowToRender, newRows) {
|
|
@@ -363,12 +367,13 @@ export var useGridRows = function useGridRows(apiRef, props) {
|
|
|
363
367
|
cache = createRowsInternalCache({
|
|
364
368
|
rows: props.rows,
|
|
365
369
|
getRowId: props.getRowId,
|
|
366
|
-
loading: props.loading
|
|
370
|
+
loading: props.loading,
|
|
371
|
+
rowCount: props.rowCount
|
|
367
372
|
});
|
|
368
373
|
}
|
|
369
374
|
|
|
370
375
|
throttledRowsChange(cache, false);
|
|
371
|
-
}, [logger, apiRef, props.rows, props.getRowId, props.loading, throttledRowsChange]);
|
|
376
|
+
}, [logger, apiRef, props.rows, props.getRowId, props.loading, props.rowCount, throttledRowsChange]);
|
|
372
377
|
var handleStrategyProcessorChange = React.useCallback(function (methodName) {
|
|
373
378
|
if (methodName === 'rowTreeCreation') {
|
|
374
379
|
groupRows();
|
|
@@ -419,7 +424,8 @@ export var useGridRows = function useGridRows(apiRef, props) {
|
|
|
419
424
|
}
|
|
420
425
|
|
|
421
426
|
var areNewRowsAlreadyInState = apiRef.current.unstable_caches.rows.rowsBeforePartialUpdates === props.rows;
|
|
422
|
-
var isNewLoadingAlreadyInState = apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates === props.loading;
|
|
427
|
+
var isNewLoadingAlreadyInState = apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates === props.loading;
|
|
428
|
+
var isNewRowCountAlreadyInState = apiRef.current.unstable_caches.rows.rowCountPropBeforePartialUpdates === props.rowCount; // The new rows have already been applied (most likely in the `'rowGroupsPreProcessingChange'` listener)
|
|
423
429
|
|
|
424
430
|
if (areNewRowsAlreadyInState) {
|
|
425
431
|
// If the loading prop has changed, we need to update its value in the state because it won't be done by `throttledRowsChange`
|
|
@@ -435,6 +441,19 @@ export var useGridRows = function useGridRows(apiRef, props) {
|
|
|
435
441
|
apiRef.current.forceUpdate();
|
|
436
442
|
}
|
|
437
443
|
|
|
444
|
+
if (!isNewRowCountAlreadyInState) {
|
|
445
|
+
apiRef.current.setState(function (state) {
|
|
446
|
+
return _extends({}, state, {
|
|
447
|
+
rows: _extends({}, state.rows, {
|
|
448
|
+
totalRowCount: Math.max(props.rowCount || 0, state.rows.totalRowCount),
|
|
449
|
+
totalTopLevelRowCount: Math.max(props.rowCount || 0, state.rows.totalTopLevelRowCount)
|
|
450
|
+
})
|
|
451
|
+
});
|
|
452
|
+
});
|
|
453
|
+
apiRef.current.unstable_caches.rows.rowCountPropBeforePartialUpdates = props.rowCount;
|
|
454
|
+
apiRef.current.forceUpdate();
|
|
455
|
+
}
|
|
456
|
+
|
|
438
457
|
return;
|
|
439
458
|
}
|
|
440
459
|
|
|
@@ -442,7 +461,8 @@ export var useGridRows = function useGridRows(apiRef, props) {
|
|
|
442
461
|
throttledRowsChange(createRowsInternalCache({
|
|
443
462
|
rows: props.rows,
|
|
444
463
|
getRowId: props.getRowId,
|
|
445
|
-
loading: props.loading
|
|
464
|
+
loading: props.loading,
|
|
465
|
+
rowCount: props.rowCount
|
|
446
466
|
}), false);
|
|
447
467
|
}, [props.rows, props.rowCount, props.getRowId, props.loading, logger, throttledRowsChange, apiRef]);
|
|
448
468
|
};
|
package/legacy/index.js
CHANGED
package/legacy/locales/trTR.js
CHANGED
|
@@ -41,7 +41,7 @@ var trTRGrid = {
|
|
|
41
41
|
// Filter panel text
|
|
42
42
|
filterPanelAddFilter: 'Filtre Ekle',
|
|
43
43
|
filterPanelDeleteIconLabel: 'Kaldır',
|
|
44
|
-
|
|
44
|
+
filterPanelLinkOperator: 'Mantıksal operatörler',
|
|
45
45
|
filterPanelOperators: 'Operatör',
|
|
46
46
|
// TODO v6: rename to filterPanelOperator
|
|
47
47
|
filterPanelOperatorAnd: 'Ve',
|
|
@@ -93,13 +93,13 @@ var trTRGrid = {
|
|
|
93
93
|
},
|
|
94
94
|
// Checkbox selection text
|
|
95
95
|
checkboxSelectionHeaderName: 'Seçim',
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
checkboxSelectionSelectAllRows: 'Tüm satırları seç',
|
|
97
|
+
checkboxSelectionUnselectAllRows: 'Tüm satırların seçimini kaldır',
|
|
98
|
+
checkboxSelectionSelectRow: 'Satırı seç',
|
|
99
|
+
checkboxSelectionUnselectRow: 'Satır seçimini bırak',
|
|
100
100
|
// Boolean cell text
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
booleanCellTrueLabel: 'Evet',
|
|
102
|
+
booleanCellFalseLabel: 'Hayır',
|
|
103
103
|
// Actions cell more text
|
|
104
104
|
actionsCellMore: 'daha fazla',
|
|
105
105
|
// Column pinning text
|
|
@@ -119,17 +119,17 @@ var trTRGrid = {
|
|
|
119
119
|
return "".concat(name, " i\xE7in gruplamay\u0131 kald\u0131r");
|
|
120
120
|
},
|
|
121
121
|
// Master/detail
|
|
122
|
-
|
|
122
|
+
detailPanelToggle: 'Detay görünümüne geçiş',
|
|
123
123
|
expandDetailPanel: 'Genişlet',
|
|
124
|
-
collapseDetailPanel: 'Gizle'
|
|
125
|
-
//
|
|
124
|
+
collapseDetailPanel: 'Gizle',
|
|
125
|
+
// Row reordering text
|
|
126
|
+
rowReorderingHeaderName: 'Satırı yeniden sırala',
|
|
126
127
|
// Aggregation
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
128
|
+
aggregationMenuItemHeader: 'Toplama',
|
|
129
|
+
aggregationFunctionLabelSum: 'top',
|
|
130
|
+
aggregationFunctionLabelAvg: 'ort',
|
|
131
|
+
aggregationFunctionLabelMin: 'min',
|
|
132
|
+
aggregationFunctionLabelMax: 'maks',
|
|
133
|
+
aggregationFunctionLabelSize: 'boyut'
|
|
134
134
|
};
|
|
135
135
|
export var trTR = getGridLocalization(trTRGrid, trTRCore);
|
package/locales/trTR.js
CHANGED
|
@@ -39,7 +39,7 @@ const trTRGrid = {
|
|
|
39
39
|
// Filter panel text
|
|
40
40
|
filterPanelAddFilter: 'Filtre Ekle',
|
|
41
41
|
filterPanelDeleteIconLabel: 'Kaldır',
|
|
42
|
-
|
|
42
|
+
filterPanelLinkOperator: 'Mantıksal operatörler',
|
|
43
43
|
filterPanelOperators: 'Operatör',
|
|
44
44
|
// TODO v6: rename to filterPanelOperator
|
|
45
45
|
filterPanelOperatorAnd: 'Ve',
|
|
@@ -85,13 +85,13 @@ const trTRGrid = {
|
|
|
85
85
|
footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} / ${totalCount.toLocaleString()}`,
|
|
86
86
|
// Checkbox selection text
|
|
87
87
|
checkboxSelectionHeaderName: 'Seçim',
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
checkboxSelectionSelectAllRows: 'Tüm satırları seç',
|
|
89
|
+
checkboxSelectionUnselectAllRows: 'Tüm satırların seçimini kaldır',
|
|
90
|
+
checkboxSelectionSelectRow: 'Satırı seç',
|
|
91
|
+
checkboxSelectionUnselectRow: 'Satır seçimini bırak',
|
|
92
92
|
// Boolean cell text
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
booleanCellTrueLabel: 'Evet',
|
|
94
|
+
booleanCellFalseLabel: 'Hayır',
|
|
95
95
|
// Actions cell more text
|
|
96
96
|
actionsCellMore: 'daha fazla',
|
|
97
97
|
// Column pinning text
|
|
@@ -107,17 +107,17 @@ const trTRGrid = {
|
|
|
107
107
|
groupColumn: name => `${name} için grupla`,
|
|
108
108
|
unGroupColumn: name => `${name} için gruplamayı kaldır`,
|
|
109
109
|
// Master/detail
|
|
110
|
-
|
|
110
|
+
detailPanelToggle: 'Detay görünümüne geçiş',
|
|
111
111
|
expandDetailPanel: 'Genişlet',
|
|
112
|
-
collapseDetailPanel: 'Gizle'
|
|
113
|
-
//
|
|
112
|
+
collapseDetailPanel: 'Gizle',
|
|
113
|
+
// Row reordering text
|
|
114
|
+
rowReorderingHeaderName: 'Satırı yeniden sırala',
|
|
114
115
|
// Aggregation
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
aggregationMenuItemHeader: 'Toplama',
|
|
117
|
+
aggregationFunctionLabelSum: 'top',
|
|
118
|
+
aggregationFunctionLabelAvg: 'ort',
|
|
119
|
+
aggregationFunctionLabelMin: 'min',
|
|
120
|
+
aggregationFunctionLabelMax: 'maks',
|
|
121
|
+
aggregationFunctionLabelSize: 'boyut'
|
|
122
122
|
};
|
|
123
123
|
export const trTR = getGridLocalization(trTRGrid, trTRCore);
|
|
@@ -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 = ["sort"];
|
|
3
|
+
const _excluded = ["sort", "searchPredicate"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
@@ -59,6 +59,10 @@ const GridIconButtonRoot = styled(IconButton)({
|
|
|
59
59
|
});
|
|
60
60
|
const collator = new Intl.Collator();
|
|
61
61
|
|
|
62
|
+
const defaultSearchPredicate = (column, searchValue) => {
|
|
63
|
+
return (column.headerName || column.field).toLowerCase().indexOf(searchValue) > -1;
|
|
64
|
+
};
|
|
65
|
+
|
|
62
66
|
function GridColumnsPanel(props) {
|
|
63
67
|
const apiRef = useGridApiContext();
|
|
64
68
|
const searchInputRef = React.useRef(null);
|
|
@@ -72,7 +76,8 @@ function GridColumnsPanel(props) {
|
|
|
72
76
|
const classes = useUtilityClasses(ownerState);
|
|
73
77
|
|
|
74
78
|
const {
|
|
75
|
-
sort
|
|
79
|
+
sort,
|
|
80
|
+
searchPredicate = defaultSearchPredicate
|
|
76
81
|
} = props,
|
|
77
82
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
78
83
|
|
|
@@ -126,8 +131,8 @@ function GridColumnsPanel(props) {
|
|
|
126
131
|
}
|
|
127
132
|
|
|
128
133
|
const searchValueToCheck = searchValue.toLowerCase();
|
|
129
|
-
return sortedColumns.filter(column => (column
|
|
130
|
-
}, [sortedColumns, searchValue]);
|
|
134
|
+
return sortedColumns.filter(column => searchPredicate(column, searchValueToCheck));
|
|
135
|
+
}, [sortedColumns, searchValue, searchPredicate]);
|
|
131
136
|
React.useEffect(() => {
|
|
132
137
|
searchInputRef.current.focus();
|
|
133
138
|
}, []);
|
|
@@ -185,6 +190,7 @@ process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
|
|
|
185
190
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
186
191
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
187
192
|
// ----------------------------------------------------------------------
|
|
193
|
+
searchPredicate: PropTypes.func,
|
|
188
194
|
sort: PropTypes.oneOf(['asc', 'desc'])
|
|
189
195
|
} : void 0;
|
|
190
196
|
export { GridColumnsPanel };
|
|
@@ -22,11 +22,13 @@ export const getRowIdFromRowModel = (rowModel, getRowId, detailErrorMessage) =>
|
|
|
22
22
|
export const createRowsInternalCache = ({
|
|
23
23
|
rows,
|
|
24
24
|
getRowId,
|
|
25
|
-
loading
|
|
25
|
+
loading,
|
|
26
|
+
rowCount
|
|
26
27
|
}) => {
|
|
27
28
|
const cache = {
|
|
28
29
|
rowsBeforePartialUpdates: rows,
|
|
29
30
|
loadingPropBeforePartialUpdates: loading,
|
|
31
|
+
rowCountPropBeforePartialUpdates: rowCount,
|
|
30
32
|
idRowsLookup: {},
|
|
31
33
|
idToIdLookup: {},
|
|
32
34
|
ids: []
|
|
@@ -13,7 +13,8 @@ export const rowsStateInitializer = (state, props, apiRef) => {
|
|
|
13
13
|
apiRef.current.unstable_caches.rows = createRowsInternalCache({
|
|
14
14
|
rows: props.rows,
|
|
15
15
|
getRowId: props.getRowId,
|
|
16
|
-
loading: props.loading
|
|
16
|
+
loading: props.loading,
|
|
17
|
+
rowCount: props.rowCount
|
|
17
18
|
});
|
|
18
19
|
return _extends({}, state, {
|
|
19
20
|
rows: getRowsStateFromCache({
|
|
@@ -90,9 +91,10 @@ export const useGridRows = (apiRef, props) => {
|
|
|
90
91
|
throttledRowsChange(createRowsInternalCache({
|
|
91
92
|
rows,
|
|
92
93
|
getRowId: props.getRowId,
|
|
93
|
-
loading: props.loading
|
|
94
|
+
loading: props.loading,
|
|
95
|
+
rowCount: props.rowCount
|
|
94
96
|
}), true);
|
|
95
|
-
}, [logger, props.getRowId, props.loading, throttledRowsChange]);
|
|
97
|
+
}, [logger, props.getRowId, props.loading, props.rowCount, throttledRowsChange]);
|
|
96
98
|
const updateRows = React.useCallback(updates => {
|
|
97
99
|
if (props.signature === GridSignature.DataGrid && updates.length > 1) {
|
|
98
100
|
// TODO: Add test with direct call to `apiRef.current.updateRows` in DataGrid after enabling the `apiRef` on the free plan.
|
|
@@ -115,6 +117,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
115
117
|
const newCache = {
|
|
116
118
|
rowsBeforePartialUpdates: prevCache.rowsBeforePartialUpdates,
|
|
117
119
|
loadingPropBeforePartialUpdates: prevCache.loadingPropBeforePartialUpdates,
|
|
120
|
+
rowCountPropBeforePartialUpdates: prevCache.rowCountPropBeforePartialUpdates,
|
|
118
121
|
idRowsLookup: _extends({}, prevCache.idRowsLookup),
|
|
119
122
|
idToIdLookup: _extends({}, prevCache.idToIdLookup),
|
|
120
123
|
ids: [...prevCache.ids]
|
|
@@ -233,6 +236,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
233
236
|
ids: updatedRows
|
|
234
237
|
})
|
|
235
238
|
}));
|
|
239
|
+
apiRef.current.unstable_caches.rows.ids = updatedRows;
|
|
236
240
|
apiRef.current.publishEvent('rowsSet');
|
|
237
241
|
}, [apiRef, logger]);
|
|
238
242
|
const replaceRows = React.useCallback((firstRowToRender, newRows) => {
|
|
@@ -324,12 +328,13 @@ export const useGridRows = (apiRef, props) => {
|
|
|
324
328
|
cache = createRowsInternalCache({
|
|
325
329
|
rows: props.rows,
|
|
326
330
|
getRowId: props.getRowId,
|
|
327
|
-
loading: props.loading
|
|
331
|
+
loading: props.loading,
|
|
332
|
+
rowCount: props.rowCount
|
|
328
333
|
});
|
|
329
334
|
}
|
|
330
335
|
|
|
331
336
|
throttledRowsChange(cache, false);
|
|
332
|
-
}, [logger, apiRef, props.rows, props.getRowId, props.loading, throttledRowsChange]);
|
|
337
|
+
}, [logger, apiRef, props.rows, props.getRowId, props.loading, props.rowCount, throttledRowsChange]);
|
|
333
338
|
const handleStrategyProcessorChange = React.useCallback(methodName => {
|
|
334
339
|
if (methodName === 'rowTreeCreation') {
|
|
335
340
|
groupRows();
|
|
@@ -378,7 +383,8 @@ export const useGridRows = (apiRef, props) => {
|
|
|
378
383
|
}
|
|
379
384
|
|
|
380
385
|
const areNewRowsAlreadyInState = apiRef.current.unstable_caches.rows.rowsBeforePartialUpdates === props.rows;
|
|
381
|
-
const isNewLoadingAlreadyInState = apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates === props.loading;
|
|
386
|
+
const isNewLoadingAlreadyInState = apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates === props.loading;
|
|
387
|
+
const isNewRowCountAlreadyInState = apiRef.current.unstable_caches.rows.rowCountPropBeforePartialUpdates === props.rowCount; // The new rows have already been applied (most likely in the `'rowGroupsPreProcessingChange'` listener)
|
|
382
388
|
|
|
383
389
|
if (areNewRowsAlreadyInState) {
|
|
384
390
|
// If the loading prop has changed, we need to update its value in the state because it won't be done by `throttledRowsChange`
|
|
@@ -392,6 +398,17 @@ export const useGridRows = (apiRef, props) => {
|
|
|
392
398
|
apiRef.current.forceUpdate();
|
|
393
399
|
}
|
|
394
400
|
|
|
401
|
+
if (!isNewRowCountAlreadyInState) {
|
|
402
|
+
apiRef.current.setState(state => _extends({}, state, {
|
|
403
|
+
rows: _extends({}, state.rows, {
|
|
404
|
+
totalRowCount: Math.max(props.rowCount || 0, state.rows.totalRowCount),
|
|
405
|
+
totalTopLevelRowCount: Math.max(props.rowCount || 0, state.rows.totalTopLevelRowCount)
|
|
406
|
+
})
|
|
407
|
+
}));
|
|
408
|
+
apiRef.current.unstable_caches.rows.rowCountPropBeforePartialUpdates = props.rowCount;
|
|
409
|
+
apiRef.current.forceUpdate();
|
|
410
|
+
}
|
|
411
|
+
|
|
395
412
|
return;
|
|
396
413
|
}
|
|
397
414
|
|
|
@@ -399,7 +416,8 @@ export const useGridRows = (apiRef, props) => {
|
|
|
399
416
|
throttledRowsChange(createRowsInternalCache({
|
|
400
417
|
rows: props.rows,
|
|
401
418
|
getRowId: props.getRowId,
|
|
402
|
-
loading: props.loading
|
|
419
|
+
loading: props.loading,
|
|
420
|
+
rowCount: props.rowCount
|
|
403
421
|
}), false);
|
|
404
422
|
}, [props.rows, props.rowCount, props.getRowId, props.loading, logger, throttledRowsChange, apiRef]);
|
|
405
423
|
};
|
package/modern/index.js
CHANGED
package/modern/locales/trTR.js
CHANGED
|
@@ -39,7 +39,7 @@ const trTRGrid = {
|
|
|
39
39
|
// Filter panel text
|
|
40
40
|
filterPanelAddFilter: 'Filtre Ekle',
|
|
41
41
|
filterPanelDeleteIconLabel: 'Kaldır',
|
|
42
|
-
|
|
42
|
+
filterPanelLinkOperator: 'Mantıksal operatörler',
|
|
43
43
|
filterPanelOperators: 'Operatör',
|
|
44
44
|
// TODO v6: rename to filterPanelOperator
|
|
45
45
|
filterPanelOperatorAnd: 'Ve',
|
|
@@ -85,13 +85,13 @@ const trTRGrid = {
|
|
|
85
85
|
footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} / ${totalCount.toLocaleString()}`,
|
|
86
86
|
// Checkbox selection text
|
|
87
87
|
checkboxSelectionHeaderName: 'Seçim',
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
checkboxSelectionSelectAllRows: 'Tüm satırları seç',
|
|
89
|
+
checkboxSelectionUnselectAllRows: 'Tüm satırların seçimini kaldır',
|
|
90
|
+
checkboxSelectionSelectRow: 'Satırı seç',
|
|
91
|
+
checkboxSelectionUnselectRow: 'Satır seçimini bırak',
|
|
92
92
|
// Boolean cell text
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
booleanCellTrueLabel: 'Evet',
|
|
94
|
+
booleanCellFalseLabel: 'Hayır',
|
|
95
95
|
// Actions cell more text
|
|
96
96
|
actionsCellMore: 'daha fazla',
|
|
97
97
|
// Column pinning text
|
|
@@ -107,17 +107,17 @@ const trTRGrid = {
|
|
|
107
107
|
groupColumn: name => `${name} için grupla`,
|
|
108
108
|
unGroupColumn: name => `${name} için gruplamayı kaldır`,
|
|
109
109
|
// Master/detail
|
|
110
|
-
|
|
110
|
+
detailPanelToggle: 'Detay görünümüne geçiş',
|
|
111
111
|
expandDetailPanel: 'Genişlet',
|
|
112
|
-
collapseDetailPanel: 'Gizle'
|
|
113
|
-
//
|
|
112
|
+
collapseDetailPanel: 'Gizle',
|
|
113
|
+
// Row reordering text
|
|
114
|
+
rowReorderingHeaderName: 'Satırı yeniden sırala',
|
|
114
115
|
// Aggregation
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
aggregationMenuItemHeader: 'Toplama',
|
|
117
|
+
aggregationFunctionLabelSum: 'top',
|
|
118
|
+
aggregationFunctionLabelAvg: 'ort',
|
|
119
|
+
aggregationFunctionLabelMin: 'min',
|
|
120
|
+
aggregationFunctionLabelMax: 'maks',
|
|
121
|
+
aggregationFunctionLabelSize: 'boyut'
|
|
122
122
|
};
|
|
123
123
|
export const trTR = getGridLocalization(trTRGrid, trTRCore);
|
|
@@ -49,7 +49,7 @@ var _gridClasses = require("../../constants/gridClasses");
|
|
|
49
49
|
|
|
50
50
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
51
51
|
|
|
52
|
-
const _excluded = ["sort"];
|
|
52
|
+
const _excluded = ["sort", "searchPredicate"];
|
|
53
53
|
|
|
54
54
|
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); }
|
|
55
55
|
|
|
@@ -92,6 +92,10 @@ const GridIconButtonRoot = (0, _styles.styled)(_IconButton.default)({
|
|
|
92
92
|
});
|
|
93
93
|
const collator = new Intl.Collator();
|
|
94
94
|
|
|
95
|
+
const defaultSearchPredicate = (column, searchValue) => {
|
|
96
|
+
return (column.headerName || column.field).toLowerCase().indexOf(searchValue) > -1;
|
|
97
|
+
};
|
|
98
|
+
|
|
95
99
|
function GridColumnsPanel(props) {
|
|
96
100
|
var _rootProps$components, _rootProps$components3, _rootProps$components4;
|
|
97
101
|
|
|
@@ -106,7 +110,8 @@ function GridColumnsPanel(props) {
|
|
|
106
110
|
};
|
|
107
111
|
const classes = useUtilityClasses(ownerState);
|
|
108
112
|
const {
|
|
109
|
-
sort
|
|
113
|
+
sort,
|
|
114
|
+
searchPredicate = defaultSearchPredicate
|
|
110
115
|
} = props,
|
|
111
116
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
112
117
|
const sortedColumns = React.useMemo(() => {
|
|
@@ -159,8 +164,8 @@ function GridColumnsPanel(props) {
|
|
|
159
164
|
}
|
|
160
165
|
|
|
161
166
|
const searchValueToCheck = searchValue.toLowerCase();
|
|
162
|
-
return sortedColumns.filter(column => (column
|
|
163
|
-
}, [sortedColumns, searchValue]);
|
|
167
|
+
return sortedColumns.filter(column => searchPredicate(column, searchValueToCheck));
|
|
168
|
+
}, [sortedColumns, searchValue, searchPredicate]);
|
|
164
169
|
React.useEffect(() => {
|
|
165
170
|
searchInputRef.current.focus();
|
|
166
171
|
}, []);
|
|
@@ -222,5 +227,6 @@ process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
|
|
|
222
227
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
223
228
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
224
229
|
// ----------------------------------------------------------------------
|
|
230
|
+
searchPredicate: _propTypes.default.func,
|
|
225
231
|
sort: _propTypes.default.oneOf(['asc', 'desc'])
|
|
226
232
|
} : void 0;
|
|
@@ -40,11 +40,13 @@ exports.getRowIdFromRowModel = getRowIdFromRowModel;
|
|
|
40
40
|
const createRowsInternalCache = ({
|
|
41
41
|
rows,
|
|
42
42
|
getRowId,
|
|
43
|
-
loading
|
|
43
|
+
loading,
|
|
44
|
+
rowCount
|
|
44
45
|
}) => {
|
|
45
46
|
const cache = {
|
|
46
47
|
rowsBeforePartialUpdates: rows,
|
|
47
48
|
loadingPropBeforePartialUpdates: loading,
|
|
49
|
+
rowCountPropBeforePartialUpdates: rowCount,
|
|
48
50
|
idRowsLookup: {},
|
|
49
51
|
idToIdLookup: {},
|
|
50
52
|
ids: []
|
|
@@ -37,7 +37,8 @@ const rowsStateInitializer = (state, props, apiRef) => {
|
|
|
37
37
|
apiRef.current.unstable_caches.rows = (0, _gridRowsUtils.createRowsInternalCache)({
|
|
38
38
|
rows: props.rows,
|
|
39
39
|
getRowId: props.getRowId,
|
|
40
|
-
loading: props.loading
|
|
40
|
+
loading: props.loading,
|
|
41
|
+
rowCount: props.rowCount
|
|
41
42
|
});
|
|
42
43
|
return (0, _extends2.default)({}, state, {
|
|
43
44
|
rows: (0, _gridRowsUtils.getRowsStateFromCache)({
|
|
@@ -121,9 +122,10 @@ const useGridRows = (apiRef, props) => {
|
|
|
121
122
|
throttledRowsChange((0, _gridRowsUtils.createRowsInternalCache)({
|
|
122
123
|
rows,
|
|
123
124
|
getRowId: props.getRowId,
|
|
124
|
-
loading: props.loading
|
|
125
|
+
loading: props.loading,
|
|
126
|
+
rowCount: props.rowCount
|
|
125
127
|
}), true);
|
|
126
|
-
}, [logger, props.getRowId, props.loading, throttledRowsChange]);
|
|
128
|
+
}, [logger, props.getRowId, props.loading, props.rowCount, throttledRowsChange]);
|
|
127
129
|
const updateRows = React.useCallback(updates => {
|
|
128
130
|
if (props.signature === _useGridApiEventHandler.GridSignature.DataGrid && updates.length > 1) {
|
|
129
131
|
// TODO: Add test with direct call to `apiRef.current.updateRows` in DataGrid after enabling the `apiRef` on the free plan.
|
|
@@ -146,6 +148,7 @@ const useGridRows = (apiRef, props) => {
|
|
|
146
148
|
const newCache = {
|
|
147
149
|
rowsBeforePartialUpdates: prevCache.rowsBeforePartialUpdates,
|
|
148
150
|
loadingPropBeforePartialUpdates: prevCache.loadingPropBeforePartialUpdates,
|
|
151
|
+
rowCountPropBeforePartialUpdates: prevCache.rowCountPropBeforePartialUpdates,
|
|
149
152
|
idRowsLookup: (0, _extends2.default)({}, prevCache.idRowsLookup),
|
|
150
153
|
idToIdLookup: (0, _extends2.default)({}, prevCache.idToIdLookup),
|
|
151
154
|
ids: [...prevCache.ids]
|
|
@@ -267,6 +270,7 @@ const useGridRows = (apiRef, props) => {
|
|
|
267
270
|
ids: updatedRows
|
|
268
271
|
})
|
|
269
272
|
}));
|
|
273
|
+
apiRef.current.unstable_caches.rows.ids = updatedRows;
|
|
270
274
|
apiRef.current.publishEvent('rowsSet');
|
|
271
275
|
}, [apiRef, logger]);
|
|
272
276
|
const replaceRows = React.useCallback((firstRowToRender, newRows) => {
|
|
@@ -354,12 +358,13 @@ const useGridRows = (apiRef, props) => {
|
|
|
354
358
|
cache = (0, _gridRowsUtils.createRowsInternalCache)({
|
|
355
359
|
rows: props.rows,
|
|
356
360
|
getRowId: props.getRowId,
|
|
357
|
-
loading: props.loading
|
|
361
|
+
loading: props.loading,
|
|
362
|
+
rowCount: props.rowCount
|
|
358
363
|
});
|
|
359
364
|
}
|
|
360
365
|
|
|
361
366
|
throttledRowsChange(cache, false);
|
|
362
|
-
}, [logger, apiRef, props.rows, props.getRowId, props.loading, throttledRowsChange]);
|
|
367
|
+
}, [logger, apiRef, props.rows, props.getRowId, props.loading, props.rowCount, throttledRowsChange]);
|
|
363
368
|
const handleStrategyProcessorChange = React.useCallback(methodName => {
|
|
364
369
|
if (methodName === 'rowTreeCreation') {
|
|
365
370
|
groupRows();
|
|
@@ -408,7 +413,8 @@ const useGridRows = (apiRef, props) => {
|
|
|
408
413
|
}
|
|
409
414
|
|
|
410
415
|
const areNewRowsAlreadyInState = apiRef.current.unstable_caches.rows.rowsBeforePartialUpdates === props.rows;
|
|
411
|
-
const isNewLoadingAlreadyInState = apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates === props.loading;
|
|
416
|
+
const isNewLoadingAlreadyInState = apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates === props.loading;
|
|
417
|
+
const isNewRowCountAlreadyInState = apiRef.current.unstable_caches.rows.rowCountPropBeforePartialUpdates === props.rowCount; // The new rows have already been applied (most likely in the `'rowGroupsPreProcessingChange'` listener)
|
|
412
418
|
|
|
413
419
|
if (areNewRowsAlreadyInState) {
|
|
414
420
|
// If the loading prop has changed, we need to update its value in the state because it won't be done by `throttledRowsChange`
|
|
@@ -422,6 +428,17 @@ const useGridRows = (apiRef, props) => {
|
|
|
422
428
|
apiRef.current.forceUpdate();
|
|
423
429
|
}
|
|
424
430
|
|
|
431
|
+
if (!isNewRowCountAlreadyInState) {
|
|
432
|
+
apiRef.current.setState(state => (0, _extends2.default)({}, state, {
|
|
433
|
+
rows: (0, _extends2.default)({}, state.rows, {
|
|
434
|
+
totalRowCount: Math.max(props.rowCount || 0, state.rows.totalRowCount),
|
|
435
|
+
totalTopLevelRowCount: Math.max(props.rowCount || 0, state.rows.totalTopLevelRowCount)
|
|
436
|
+
})
|
|
437
|
+
}));
|
|
438
|
+
apiRef.current.unstable_caches.rows.rowCountPropBeforePartialUpdates = props.rowCount;
|
|
439
|
+
apiRef.current.forceUpdate();
|
|
440
|
+
}
|
|
441
|
+
|
|
425
442
|
return;
|
|
426
443
|
}
|
|
427
444
|
|
|
@@ -429,7 +446,8 @@ const useGridRows = (apiRef, props) => {
|
|
|
429
446
|
throttledRowsChange((0, _gridRowsUtils.createRowsInternalCache)({
|
|
430
447
|
rows: props.rows,
|
|
431
448
|
getRowId: props.getRowId,
|
|
432
|
-
loading: props.loading
|
|
449
|
+
loading: props.loading,
|
|
450
|
+
rowCount: props.rowCount
|
|
433
451
|
}), false);
|
|
434
452
|
}, [props.rows, props.rowCount, props.getRowId, props.loading, logger, throttledRowsChange, apiRef]);
|
|
435
453
|
};
|
package/node/index.js
CHANGED
package/node/locales/trTR.js
CHANGED
|
@@ -48,7 +48,7 @@ const trTRGrid = {
|
|
|
48
48
|
// Filter panel text
|
|
49
49
|
filterPanelAddFilter: 'Filtre Ekle',
|
|
50
50
|
filterPanelDeleteIconLabel: 'Kaldır',
|
|
51
|
-
|
|
51
|
+
filterPanelLinkOperator: 'Mantıksal operatörler',
|
|
52
52
|
filterPanelOperators: 'Operatör',
|
|
53
53
|
// TODO v6: rename to filterPanelOperator
|
|
54
54
|
filterPanelOperatorAnd: 'Ve',
|
|
@@ -94,13 +94,13 @@ const trTRGrid = {
|
|
|
94
94
|
footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} / ${totalCount.toLocaleString()}`,
|
|
95
95
|
// Checkbox selection text
|
|
96
96
|
checkboxSelectionHeaderName: 'Seçim',
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
checkboxSelectionSelectAllRows: 'Tüm satırları seç',
|
|
98
|
+
checkboxSelectionUnselectAllRows: 'Tüm satırların seçimini kaldır',
|
|
99
|
+
checkboxSelectionSelectRow: 'Satırı seç',
|
|
100
|
+
checkboxSelectionUnselectRow: 'Satır seçimini bırak',
|
|
101
101
|
// Boolean cell text
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
booleanCellTrueLabel: 'Evet',
|
|
103
|
+
booleanCellFalseLabel: 'Hayır',
|
|
104
104
|
// Actions cell more text
|
|
105
105
|
actionsCellMore: 'daha fazla',
|
|
106
106
|
// Column pinning text
|
|
@@ -116,18 +116,18 @@ const trTRGrid = {
|
|
|
116
116
|
groupColumn: name => `${name} için grupla`,
|
|
117
117
|
unGroupColumn: name => `${name} için gruplamayı kaldır`,
|
|
118
118
|
// Master/detail
|
|
119
|
-
|
|
119
|
+
detailPanelToggle: 'Detay görünümüne geçiş',
|
|
120
120
|
expandDetailPanel: 'Genişlet',
|
|
121
|
-
collapseDetailPanel: 'Gizle'
|
|
122
|
-
//
|
|
121
|
+
collapseDetailPanel: 'Gizle',
|
|
122
|
+
// Row reordering text
|
|
123
|
+
rowReorderingHeaderName: 'Satırı yeniden sırala',
|
|
123
124
|
// Aggregation
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
125
|
+
aggregationMenuItemHeader: 'Toplama',
|
|
126
|
+
aggregationFunctionLabelSum: 'top',
|
|
127
|
+
aggregationFunctionLabelAvg: 'ort',
|
|
128
|
+
aggregationFunctionLabelMin: 'min',
|
|
129
|
+
aggregationFunctionLabelMax: 'maks',
|
|
130
|
+
aggregationFunctionLabelSize: 'boyut'
|
|
131
131
|
};
|
|
132
132
|
const trTR = (0, _getGridLocalization.getGridLocalization)(trTRGrid, _locale.trTR);
|
|
133
133
|
exports.trTR = trTR;
|