@mui/x-data-grid 7.13.0 → 7.15.0
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 +151 -2
- package/components/cell/GridActionsCell.js +3 -3
- package/components/cell/GridCell.js +11 -12
- package/components/cell/GridEditSingleSelectCell.js +2 -3
- package/components/menu/columnMenu/GridColumnMenuContainer.js +2 -2
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/GridPanel.js +1 -2
- package/components/panel/filterPanel/GridFilterForm.js +9 -4
- package/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/components/toolbar/GridToolbarExportContainer.js +2 -2
- package/components/toolbar/GridToolbarQuickFilter.js +5 -3
- package/hooks/core/gridCoreSelector.d.ts +1 -1
- package/hooks/core/gridCoreSelector.js +1 -1
- package/hooks/core/useGridInitialization.js +2 -2
- package/hooks/core/{useGridTheme.d.ts → useGridIsRtl.d.ts} +1 -1
- package/hooks/core/{useGridTheme.js → useGridIsRtl.js} +7 -7
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -3
- package/hooks/features/columnResize/useGridColumnResize.js +5 -5
- package/hooks/features/columns/gridColumnsSelector.js +3 -3
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +19 -20
- package/hooks/features/rows/useGridParamsApi.js +2 -1
- package/hooks/features/scroll/useGridScroll.js +4 -4
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -2
- package/hooks/features/virtualization/useGridVirtualScroller.js +13 -13
- package/hooks/utils/useGridSelector.d.ts +4 -1
- package/hooks/utils/useGridSelector.js +38 -0
- package/index.js +1 -1
- package/internals/index.d.ts +2 -1
- package/internals/index.js +2 -1
- package/locales/csCZ.js +4 -5
- package/locales/heIL.js +4 -5
- package/models/gridDataSource.d.ts +6 -6
- package/models/gridStateCommunity.d.ts +1 -2
- package/models/params/gridCellParams.d.ts +4 -0
- package/modern/components/cell/GridActionsCell.js +3 -3
- package/modern/components/cell/GridCell.js +11 -12
- package/modern/components/cell/GridEditSingleSelectCell.js +2 -3
- package/modern/components/menu/columnMenu/GridColumnMenuContainer.js +2 -2
- package/modern/components/panel/GridPanel.js +1 -2
- package/modern/components/panel/filterPanel/GridFilterForm.js +9 -4
- package/modern/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/modern/components/toolbar/GridToolbarExportContainer.js +2 -2
- package/modern/components/toolbar/GridToolbarQuickFilter.js +5 -3
- package/modern/hooks/core/gridCoreSelector.js +1 -1
- package/modern/hooks/core/useGridInitialization.js +2 -2
- package/modern/hooks/core/{useGridTheme.js → useGridIsRtl.js} +7 -7
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -3
- package/modern/hooks/features/columnResize/useGridColumnResize.js +5 -5
- package/modern/hooks/features/columns/gridColumnsSelector.js +3 -3
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +19 -20
- package/modern/hooks/features/rows/useGridParamsApi.js +2 -1
- package/modern/hooks/features/scroll/useGridScroll.js +4 -4
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +13 -13
- package/modern/hooks/utils/useGridSelector.js +38 -0
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -1
- package/modern/locales/csCZ.js +4 -5
- package/modern/locales/heIL.js +4 -5
- package/modern/utils/createSelector.js +116 -0
- package/modern/utils/keyboardUtils.js +1 -11
- package/node/components/cell/GridActionsCell.js +3 -3
- package/node/components/cell/GridCell.js +11 -12
- package/node/components/cell/GridEditSingleSelectCell.js +2 -3
- package/node/components/menu/columnMenu/GridColumnMenuContainer.js +1 -1
- package/node/components/panel/GridPanel.js +1 -2
- package/node/components/panel/filterPanel/GridFilterForm.js +9 -4
- package/node/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/node/components/toolbar/GridToolbarExportContainer.js +1 -1
- package/node/components/toolbar/GridToolbarQuickFilter.js +5 -3
- package/node/hooks/core/gridCoreSelector.js +3 -3
- package/node/hooks/core/useGridInitialization.js +2 -2
- package/node/hooks/core/{useGridTheme.js → useGridIsRtl.js} +9 -9
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +3 -2
- package/node/hooks/features/columnResize/useGridColumnResize.js +5 -5
- package/node/hooks/features/columns/gridColumnsSelector.js +2 -2
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +19 -20
- package/node/hooks/features/rows/useGridParamsApi.js +2 -1
- package/node/hooks/features/scroll/useGridScroll.js +4 -4
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +13 -13
- package/node/hooks/utils/useGridSelector.js +41 -2
- package/node/index.js +1 -1
- package/node/internals/index.js +22 -0
- package/node/locales/csCZ.js +4 -5
- package/node/locales/heIL.js +4 -5
- package/node/utils/createSelector.js +119 -2
- package/node/utils/keyboardUtils.js +2 -15
- package/package.json +6 -6
- package/utils/createSelector.d.ts +19 -0
- package/utils/createSelector.js +116 -0
- package/utils/keyboardUtils.d.ts +1 -9
- package/utils/keyboardUtils.js +1 -11
package/modern/locales/heIL.js
CHANGED
|
@@ -30,11 +30,10 @@ const heILGrid = {
|
|
|
30
30
|
toolbarExportPrint: 'הדפסה',
|
|
31
31
|
toolbarExportExcel: 'ייצוא ל- Excel',
|
|
32
32
|
// Columns management text
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
columnsManagementSearchTitle: 'חיפוש',
|
|
34
|
+
columnsManagementNoColumns: 'אין עמודות',
|
|
35
|
+
columnsManagementShowHideAllText: 'הצג/הסתר הכל',
|
|
36
|
+
columnsManagementReset: 'אתחול',
|
|
38
37
|
// Filter panel text
|
|
39
38
|
filterPanelAddFilter: 'הוסף מסנן',
|
|
40
39
|
filterPanelRemoveAll: 'מחק הכל',
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { createSelector as reselectCreateSelector } from 'reselect';
|
|
2
2
|
import { warnOnce } from '../internals/utils/warning';
|
|
3
|
+
|
|
4
|
+
// TODO v8: Remove this type
|
|
5
|
+
|
|
6
|
+
// TODO v8: Rename this type to `OutputSelector`
|
|
7
|
+
|
|
8
|
+
// TODO v8: Remove this type
|
|
9
|
+
|
|
10
|
+
// TODO v8: Rename this type to `SelectorArgs`
|
|
11
|
+
|
|
12
|
+
// TODO v8: Remove this type
|
|
13
|
+
|
|
14
|
+
// TODO v8: Rename this type to `CreateSelectorFunction`
|
|
15
|
+
|
|
3
16
|
const cache = new WeakMap();
|
|
4
17
|
function checkIsAPIRef(value) {
|
|
5
18
|
return 'current' in value && 'instanceId' in value.current;
|
|
@@ -7,6 +20,8 @@ function checkIsAPIRef(value) {
|
|
|
7
20
|
const DEFAULT_INSTANCE_ID = {
|
|
8
21
|
id: 'default'
|
|
9
22
|
};
|
|
23
|
+
|
|
24
|
+
// TODO v8: Remove this function
|
|
10
25
|
export const createSelector = (a, b, c, d, e, f, ...other) => {
|
|
11
26
|
if (other.length > 0) {
|
|
12
27
|
throw new Error('Unsupported number of selectors');
|
|
@@ -71,6 +86,74 @@ export const createSelector = (a, b, c, d, e, f, ...other) => {
|
|
|
71
86
|
selector.acceptsApiRef = true;
|
|
72
87
|
return selector;
|
|
73
88
|
};
|
|
89
|
+
|
|
90
|
+
// TODO v8: Rename this function to `createSelector`
|
|
91
|
+
export const createSelectorV8 = (a, b, c, d, e, f, ...other) => {
|
|
92
|
+
if (other.length > 0) {
|
|
93
|
+
throw new Error('Unsupported number of selectors');
|
|
94
|
+
}
|
|
95
|
+
let selector;
|
|
96
|
+
if (a && b && c && d && e && f) {
|
|
97
|
+
selector = (stateOrApiRef, args, instanceIdParam) => {
|
|
98
|
+
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
99
|
+
const instanceId = instanceIdParam ?? (isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID);
|
|
100
|
+
const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
101
|
+
const va = a(state, args, instanceId);
|
|
102
|
+
const vb = b(state, args, instanceId);
|
|
103
|
+
const vc = c(state, args, instanceId);
|
|
104
|
+
const vd = d(state, args, instanceId);
|
|
105
|
+
const ve = e(state, args, instanceId);
|
|
106
|
+
return f(va, vb, vc, vd, ve, args);
|
|
107
|
+
};
|
|
108
|
+
} else if (a && b && c && d && e) {
|
|
109
|
+
selector = (stateOrApiRef, args, instanceIdParam) => {
|
|
110
|
+
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
111
|
+
const instanceId = instanceIdParam ?? (isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID);
|
|
112
|
+
const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
113
|
+
const va = a(state, args, instanceId);
|
|
114
|
+
const vb = b(state, args, instanceId);
|
|
115
|
+
const vc = c(state, args, instanceId);
|
|
116
|
+
const vd = d(state, args, instanceId);
|
|
117
|
+
return e(va, vb, vc, vd, args);
|
|
118
|
+
};
|
|
119
|
+
} else if (a && b && c && d) {
|
|
120
|
+
selector = (stateOrApiRef, args, instanceIdParam) => {
|
|
121
|
+
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
122
|
+
const instanceId = instanceIdParam ?? (isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID);
|
|
123
|
+
const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
124
|
+
const va = a(state, args, instanceId);
|
|
125
|
+
const vb = b(state, args, instanceId);
|
|
126
|
+
const vc = c(state, args, instanceId);
|
|
127
|
+
return d(va, vb, vc, args);
|
|
128
|
+
};
|
|
129
|
+
} else if (a && b && c) {
|
|
130
|
+
selector = (stateOrApiRef, args, instanceIdParam) => {
|
|
131
|
+
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
132
|
+
const instanceId = instanceIdParam ?? (isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID);
|
|
133
|
+
const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
134
|
+
const va = a(state, args, instanceId);
|
|
135
|
+
const vb = b(state, args, instanceId);
|
|
136
|
+
return c(va, vb, args);
|
|
137
|
+
};
|
|
138
|
+
} else if (a && b) {
|
|
139
|
+
selector = (stateOrApiRef, args, instanceIdParam) => {
|
|
140
|
+
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
141
|
+
const instanceId = instanceIdParam ?? (isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID);
|
|
142
|
+
const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
143
|
+
const va = a(state, args, instanceId);
|
|
144
|
+
return b(va, args);
|
|
145
|
+
};
|
|
146
|
+
} else {
|
|
147
|
+
throw new Error('Missing arguments');
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// We use this property to detect if the selector was created with createSelector
|
|
151
|
+
// or it's only a simple function the receives the state and returns part of it.
|
|
152
|
+
selector.acceptsApiRef = true;
|
|
153
|
+
return selector;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// TODO v8: Remove this function
|
|
74
157
|
export const createSelectorMemoized = (...args) => {
|
|
75
158
|
const selector = (stateOrApiRef, instanceId) => {
|
|
76
159
|
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
@@ -97,6 +180,39 @@ export const createSelectorMemoized = (...args) => {
|
|
|
97
180
|
return fn(state, cacheKey);
|
|
98
181
|
};
|
|
99
182
|
|
|
183
|
+
// We use this property to detect if the selector was created with createSelector
|
|
184
|
+
// or it's only a simple function the receives the state and returns part of it.
|
|
185
|
+
selector.acceptsApiRef = true;
|
|
186
|
+
return selector;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// TODO v8: Rename this function to `createSelectorMemoized`
|
|
190
|
+
export const createSelectorMemoizedV8 = (...args) => {
|
|
191
|
+
const selector = (stateOrApiRef, selectorArgs, instanceId) => {
|
|
192
|
+
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
193
|
+
const cacheKey = isAPIRef ? stateOrApiRef.current.instanceId : instanceId ?? DEFAULT_INSTANCE_ID;
|
|
194
|
+
const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
195
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
196
|
+
if (cacheKey.id === 'default') {
|
|
197
|
+
warnOnce(['MUI X: A selector was called without passing the instance ID, which may impact the performance of the grid.', 'To fix, call it with `apiRef`, for example `mySelector(apiRef)`, or pass the instance ID explicitly, for example `mySelector(state, apiRef.current.instanceId)`.']);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
const cacheArgsInit = cache.get(cacheKey);
|
|
201
|
+
const cacheArgs = cacheArgsInit ?? new Map();
|
|
202
|
+
const cacheFn = cacheArgs?.get(args);
|
|
203
|
+
if (cacheArgs && cacheFn) {
|
|
204
|
+
// We pass the cache key because the called selector might have as
|
|
205
|
+
// dependency another selector created with this `createSelector`.
|
|
206
|
+
return cacheFn(state, selectorArgs, cacheKey);
|
|
207
|
+
}
|
|
208
|
+
const fn = reselectCreateSelector(...args);
|
|
209
|
+
if (!cacheArgsInit) {
|
|
210
|
+
cache.set(cacheKey, cacheArgs);
|
|
211
|
+
}
|
|
212
|
+
cacheArgs.set(args, fn);
|
|
213
|
+
return fn(state, selectorArgs, cacheKey);
|
|
214
|
+
};
|
|
215
|
+
|
|
100
216
|
// We use this property to detect if the selector was created with createSelector
|
|
101
217
|
// or it's only a simple function the receives the state and returns part of it.
|
|
102
218
|
selector.acceptsApiRef = true;
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated there is no meaninfuly logic abstracted, use event.key directly.
|
|
3
|
-
*/
|
|
4
|
-
export const isEscapeKey = key => key === 'Escape';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated there is no meaninfuly logic abstracted, use event.key directly.
|
|
8
|
-
*/
|
|
9
|
-
export const isTabKey = key => key === 'Tab';
|
|
10
|
-
|
|
11
1
|
// Non printable keys have a name, for example "ArrowRight", see the whole list:
|
|
12
2
|
// https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values
|
|
13
3
|
// So event.key.length === 1 is often enough.
|
|
@@ -27,7 +17,7 @@ export const isCellExitEditModeKeys = key => GRID_CELL_EXIT_EDIT_MODE_KEYS.index
|
|
|
27
17
|
export const isCellEditCommitKeys = key => GRID_CELL_EDIT_COMMIT_KEYS.indexOf(key) > -1;
|
|
28
18
|
export const isNavigationKey = key => key.indexOf('Arrow') === 0 || key.indexOf('Page') === 0 || key === ' ' || key === 'Home' || key === 'End';
|
|
29
19
|
export const isKeyboardEvent = event => !!event.key;
|
|
30
|
-
export const isHideMenuKey = key =>
|
|
20
|
+
export const isHideMenuKey = key => key === 'Tab' || key === 'Escape';
|
|
31
21
|
|
|
32
22
|
// In theory, on macOS, ctrl + v doesn't trigger a paste, so the function should return false.
|
|
33
23
|
// However, maybe it's overkill to fix, so let's be lazy.
|
|
@@ -11,7 +11,7 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _MenuList = _interopRequireDefault(require("@mui/material/MenuList"));
|
|
14
|
-
var
|
|
14
|
+
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
15
15
|
var _utils = require("@mui/utils");
|
|
16
16
|
var _gridClasses = require("../../constants/gridClasses");
|
|
17
17
|
var _GridMenu = require("../menu/GridMenu");
|
|
@@ -39,7 +39,7 @@ function GridActionsCell(props) {
|
|
|
39
39
|
const buttonRef = React.useRef(null);
|
|
40
40
|
const ignoreCallToFocus = React.useRef(false);
|
|
41
41
|
const touchRippleRefs = React.useRef({});
|
|
42
|
-
const
|
|
42
|
+
const isRtl = (0, _RtlProvider.useRtl)();
|
|
43
43
|
const menuId = (0, _utils.unstable_useId)();
|
|
44
44
|
const buttonId = (0, _utils.unstable_useId)();
|
|
45
45
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
@@ -120,7 +120,7 @@ function GridActionsCell(props) {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
// for rtl mode we need to reverse the direction
|
|
123
|
-
const rtlMod =
|
|
123
|
+
const rtlMod = isRtl ? -1 : 1;
|
|
124
124
|
const indexMod = (direction === 'left' ? -1 : 1) * rtlMod;
|
|
125
125
|
|
|
126
126
|
// if the button that should receive focus is disabled go one more step
|
|
@@ -116,13 +116,12 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
|
|
|
116
116
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
117
117
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
118
118
|
const field = column.field;
|
|
119
|
-
const
|
|
119
|
+
const cellParams = (0, _useGridSelector.useGridSelector)(apiRef, () => {
|
|
120
120
|
// This is required because `.getCellParams` tries to get the `state.rows.tree` entry
|
|
121
121
|
// associated with `rowId`/`fieldId`, but this selector runs after the state has been
|
|
122
122
|
// updated, while `rowId`/`fieldId` reference an entry in the old state.
|
|
123
123
|
try {
|
|
124
|
-
const
|
|
125
|
-
const result = cellParams;
|
|
124
|
+
const result = apiRef.current.getCellParams(rowId, field);
|
|
126
125
|
result.api = apiRef.current;
|
|
127
126
|
return result;
|
|
128
127
|
} catch (e) {
|
|
@@ -141,9 +140,9 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
|
|
|
141
140
|
hasFocus,
|
|
142
141
|
isEditable = false,
|
|
143
142
|
value
|
|
144
|
-
} =
|
|
143
|
+
} = cellParams;
|
|
145
144
|
const canManageOwnFocus = column.type === 'actions' && column.getActions?.(apiRef.current.getRowParams(rowId)).some(action => !action.props.disabled);
|
|
146
|
-
const tabIndex = (cellMode === 'view' || !isEditable) && !canManageOwnFocus ?
|
|
145
|
+
const tabIndex = (cellMode === 'view' || !isEditable) && !canManageOwnFocus ? cellParams.tabIndex : -1;
|
|
147
146
|
const {
|
|
148
147
|
classes: rootClasses,
|
|
149
148
|
getCellClassName
|
|
@@ -156,15 +155,15 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
|
|
|
156
155
|
}).filter(Boolean).join(' '));
|
|
157
156
|
const classNames = [pipesClassName];
|
|
158
157
|
if (column.cellClassName) {
|
|
159
|
-
classNames.push(typeof column.cellClassName === 'function' ? column.cellClassName(
|
|
158
|
+
classNames.push(typeof column.cellClassName === 'function' ? column.cellClassName(cellParams) : column.cellClassName);
|
|
160
159
|
}
|
|
161
160
|
if (column.display === 'flex') {
|
|
162
161
|
classNames.push(_gridClasses.gridClasses['cell--flex']);
|
|
163
162
|
}
|
|
164
163
|
if (getCellClassName) {
|
|
165
|
-
classNames.push(getCellClassName(
|
|
164
|
+
classNames.push(getCellClassName(cellParams));
|
|
166
165
|
}
|
|
167
|
-
const valueToRender =
|
|
166
|
+
const valueToRender = cellParams.formattedValue ?? value;
|
|
168
167
|
const cellRef = React.useRef(null);
|
|
169
168
|
const handleRef = (0, _utils.unstable_useForkRef)(ref, cellRef);
|
|
170
169
|
const focusElementRef = React.useRef(null);
|
|
@@ -247,7 +246,7 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
|
|
|
247
246
|
}
|
|
248
247
|
}
|
|
249
248
|
}, [hasFocus, cellMode, apiRef]);
|
|
250
|
-
if (
|
|
249
|
+
if (cellParams === EMPTY_CELL_PARAMS) {
|
|
251
250
|
return null;
|
|
252
251
|
}
|
|
253
252
|
let handleFocus = other.onFocus;
|
|
@@ -269,15 +268,15 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
|
|
|
269
268
|
let children;
|
|
270
269
|
let title;
|
|
271
270
|
if (editCellState === null && column.renderCell) {
|
|
272
|
-
children = column.renderCell(
|
|
271
|
+
children = column.renderCell(cellParams);
|
|
273
272
|
}
|
|
274
273
|
if (editCellState !== null && column.renderEditCell) {
|
|
275
274
|
const updatedRow = apiRef.current.getRowWithUpdatedValues(rowId, column.field);
|
|
276
275
|
|
|
277
276
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
278
277
|
const editCellStateRest = (0, _objectWithoutPropertiesLoose2.default)(editCellState, _excluded2);
|
|
279
|
-
const formattedValue = column.valueFormatter ? column.valueFormatter(editCellState.value, updatedRow, column, apiRef) :
|
|
280
|
-
const params = (0, _extends2.default)({},
|
|
278
|
+
const formattedValue = column.valueFormatter ? column.valueFormatter(editCellState.value, updatedRow, column, apiRef) : cellParams.formattedValue;
|
|
279
|
+
const params = (0, _extends2.default)({}, cellParams, {
|
|
281
280
|
row: updatedRow,
|
|
282
281
|
formattedValue
|
|
283
282
|
}, editCellStateRest);
|
|
@@ -13,7 +13,6 @@ var React = _react;
|
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _utils = require("@mui/utils");
|
|
15
15
|
var _gridEditCellParams = require("../../models/params/gridEditCellParams");
|
|
16
|
-
var _keyboardUtils = require("../../utils/keyboardUtils");
|
|
17
16
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
18
17
|
var _gridEditRowModel = require("../../models/gridEditRowModel");
|
|
19
18
|
var _filterPanelUtils = require("../panel/filterPanel/filterPanelUtils");
|
|
@@ -90,10 +89,10 @@ function GridEditSingleSelectCell(props) {
|
|
|
90
89
|
setOpen(false);
|
|
91
90
|
return;
|
|
92
91
|
}
|
|
93
|
-
if (reason === 'backdropClick' ||
|
|
92
|
+
if (reason === 'backdropClick' || event.key === 'Escape') {
|
|
94
93
|
const params = apiRef.current.getCellParams(id, field);
|
|
95
94
|
apiRef.current.publishEvent('cellEditStop', (0, _extends2.default)({}, params, {
|
|
96
|
-
reason:
|
|
95
|
+
reason: event.key === 'Escape' ? _gridEditCellParams.GridCellEditStopReasons.escapeKeyDown : _gridEditCellParams.GridCellEditStopReasons.cellFocusOut
|
|
97
96
|
}));
|
|
98
97
|
}
|
|
99
98
|
};
|
|
@@ -32,7 +32,7 @@ const GridColumnMenuContainer = exports.GridColumnMenuContainer = /*#__PURE__*/R
|
|
|
32
32
|
} = props,
|
|
33
33
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
34
34
|
const handleListKeyDown = React.useCallback(event => {
|
|
35
|
-
if (
|
|
35
|
+
if (event.key === 'Tab') {
|
|
36
36
|
event.preventDefault();
|
|
37
37
|
}
|
|
38
38
|
if ((0, _keyboardUtils.isHideMenuKey)(event.key)) {
|
|
@@ -16,7 +16,6 @@ var _ClickAwayListener = _interopRequireDefault(require("@mui/material/ClickAway
|
|
|
16
16
|
var _Paper = _interopRequireDefault(require("@mui/material/Paper"));
|
|
17
17
|
var _Popper = _interopRequireDefault(require("@mui/material/Popper"));
|
|
18
18
|
var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
19
|
-
var _keyboardUtils = require("../../utils/keyboardUtils");
|
|
20
19
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
21
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
21
|
const _excluded = ["children", "className", "classes"];
|
|
@@ -60,7 +59,7 @@ const GridPanel = exports.GridPanel = /*#__PURE__*/React.forwardRef((props, ref)
|
|
|
60
59
|
apiRef.current.hidePreferences();
|
|
61
60
|
}, [apiRef]);
|
|
62
61
|
const handleKeyDown = React.useCallback(event => {
|
|
63
|
-
if (
|
|
62
|
+
if (event.key === 'Escape') {
|
|
64
63
|
apiRef.current.hidePreferences();
|
|
65
64
|
}
|
|
66
65
|
}, [apiRef]);
|
|
@@ -290,10 +290,15 @@ const GridFilterForm = exports.GridFilterForm = /*#__PURE__*/React.forwardRef(fu
|
|
|
290
290
|
variant: "standard",
|
|
291
291
|
as: rootProps.slots.baseFormControl
|
|
292
292
|
}, baseFormControlProps, logicOperatorInputProps, {
|
|
293
|
-
sx:
|
|
294
|
-
display:
|
|
295
|
-
|
|
296
|
-
|
|
293
|
+
sx: [hasLogicOperatorColumn ? {
|
|
294
|
+
display: 'flex'
|
|
295
|
+
} : {
|
|
296
|
+
display: 'none'
|
|
297
|
+
}, showMultiFilterOperators ? {
|
|
298
|
+
visibility: 'visible'
|
|
299
|
+
} : {
|
|
300
|
+
visibility: 'hidden'
|
|
301
|
+
}, baseFormControlProps.sx, logicOperatorInputProps.sx],
|
|
297
302
|
className: (0, _clsx.default)(classes.logicOperatorInput, baseFormControlProps.className, logicOperatorInputProps.className),
|
|
298
303
|
ownerState: rootProps,
|
|
299
304
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseSelect, (0, _extends2.default)({
|
|
@@ -71,7 +71,7 @@ const GridToolbarDensitySelector = exports.GridToolbarDensitySelector = /*#__PUR
|
|
|
71
71
|
setOpen(false);
|
|
72
72
|
};
|
|
73
73
|
const handleListKeyDown = event => {
|
|
74
|
-
if (
|
|
74
|
+
if (event.key === 'Tab') {
|
|
75
75
|
event.preventDefault();
|
|
76
76
|
}
|
|
77
77
|
if ((0, _keyboardUtils.isHideMenuKey)(event.key)) {
|
|
@@ -38,7 +38,7 @@ const GridToolbarExportContainer = exports.GridToolbarExportContainer = /*#__PUR
|
|
|
38
38
|
};
|
|
39
39
|
const handleMenuClose = () => setOpen(false);
|
|
40
40
|
const handleListKeyDown = event => {
|
|
41
|
-
if (
|
|
41
|
+
if (event.key === 'Tab') {
|
|
42
42
|
event.preventDefault();
|
|
43
43
|
}
|
|
44
44
|
if ((0, _keyboardUtils.isHideMenuKey)(event.key)) {
|
|
@@ -114,9 +114,11 @@ function GridToolbarQuickFilter(props) {
|
|
|
114
114
|
endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseIconButton, (0, _extends2.default)({
|
|
115
115
|
"aria-label": apiRef.current.getLocaleText('toolbarQuickFilterDeleteIconLabel'),
|
|
116
116
|
size: "small",
|
|
117
|
-
sx: {
|
|
118
|
-
visibility:
|
|
119
|
-
}
|
|
117
|
+
sx: [searchValue ? {
|
|
118
|
+
visibility: 'visible'
|
|
119
|
+
} : {
|
|
120
|
+
visibility: 'hidden'
|
|
121
|
+
}],
|
|
120
122
|
onClick: handleSearchReset
|
|
121
123
|
}, rootProps.slotProps?.baseIconButton, {
|
|
122
124
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.quickFilterClearIcon, {
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.gridIsRtlSelector = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* Get the theme state
|
|
9
9
|
* @category Core
|
|
10
10
|
*/
|
|
11
|
-
const
|
|
12
|
-
exports.
|
|
11
|
+
const gridIsRtlSelector = state => state.isRtl;
|
|
12
|
+
exports.gridIsRtlSelector = gridIsRtlSelector;
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useGridInitialization = void 0;
|
|
7
7
|
var _useGridRefs = require("./useGridRefs");
|
|
8
|
-
var
|
|
8
|
+
var _useGridIsRtl = require("./useGridIsRtl");
|
|
9
9
|
var _useGridLoggerFactory = require("./useGridLoggerFactory");
|
|
10
10
|
var _useGridApiInitialization = require("./useGridApiInitialization");
|
|
11
11
|
var _useGridLocaleText = require("./useGridLocaleText");
|
|
@@ -18,7 +18,7 @@ var _useGridStateInitialization = require("./useGridStateInitialization");
|
|
|
18
18
|
const useGridInitialization = (inputApiRef, props) => {
|
|
19
19
|
const privateApiRef = (0, _useGridApiInitialization.useGridApiInitialization)(inputApiRef, props);
|
|
20
20
|
(0, _useGridRefs.useGridRefs)(privateApiRef);
|
|
21
|
-
(0,
|
|
21
|
+
(0, _useGridIsRtl.useGridIsRtl)(privateApiRef);
|
|
22
22
|
(0, _useGridLoggerFactory.useGridLoggerFactory)(privateApiRef, props);
|
|
23
23
|
(0, _useGridStateInitialization.useGridStateInitialization)(privateApiRef);
|
|
24
24
|
(0, _pipeProcessing.useGridPipeProcessing)(privateApiRef);
|
|
@@ -4,16 +4,16 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.useGridIsRtl = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
var
|
|
10
|
+
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
11
11
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
12
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
apiRef.current.state.
|
|
13
|
+
const useGridIsRtl = apiRef => {
|
|
14
|
+
const isRtl = (0, _RtlProvider.useRtl)();
|
|
15
|
+
if (apiRef.current.state.isRtl === undefined) {
|
|
16
|
+
apiRef.current.state.isRtl = isRtl;
|
|
17
17
|
}
|
|
18
18
|
const isFirstEffect = React.useRef(true);
|
|
19
19
|
React.useEffect(() => {
|
|
@@ -21,9 +21,9 @@ const useGridTheme = apiRef => {
|
|
|
21
21
|
isFirstEffect.current = false;
|
|
22
22
|
} else {
|
|
23
23
|
apiRef.current.setState(state => (0, _extends2.default)({}, state, {
|
|
24
|
-
|
|
24
|
+
isRtl
|
|
25
25
|
}));
|
|
26
26
|
}
|
|
27
|
-
}, [apiRef,
|
|
27
|
+
}, [apiRef, isRtl]);
|
|
28
28
|
};
|
|
29
|
-
exports.
|
|
29
|
+
exports.useGridIsRtl = useGridIsRtl;
|
|
@@ -9,6 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
11
11
|
var _styles = require("@mui/material/styles");
|
|
12
|
+
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
12
13
|
var _utils = require("../../utils");
|
|
13
14
|
var _useGridRootProps = require("../../utils/useGridRootProps");
|
|
14
15
|
var _useGridPrivateApiContext = require("../../utils/useGridPrivateApiContext");
|
|
@@ -53,7 +54,7 @@ const useGridColumnHeaders = props => {
|
|
|
53
54
|
const [dragCol, setDragCol] = React.useState('');
|
|
54
55
|
const [resizeCol, setResizeCol] = React.useState('');
|
|
55
56
|
const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
|
|
56
|
-
const
|
|
57
|
+
const isRtl = (0, _RtlProvider.useRtl)();
|
|
57
58
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
58
59
|
const dimensions = (0, _utils.useGridSelector)(apiRef, _dimensions.gridDimensionsSelector);
|
|
59
60
|
const hasVirtualization = (0, _utils.useGridSelector)(apiRef, _virtualization.gridVirtualizationColumnEnabledSelector);
|
|
@@ -62,7 +63,7 @@ const useGridColumnHeaders = props => {
|
|
|
62
63
|
const renderContext = (0, _utils.useGridSelector)(apiRef, _virtualization.gridRenderContextColumnsSelector);
|
|
63
64
|
const pinnedColumns = (0, _utils.useGridSelector)(apiRef, _columns.gridVisiblePinnedColumnDefinitionsSelector);
|
|
64
65
|
const pinnedRows = (0, _utils.useGridSelector)(apiRef, _gridRowsSelector.gridPinnedRowsSelector);
|
|
65
|
-
const offsetLeft = (0, _useGridVirtualScroller.computeOffsetLeft)(columnPositions, renderContext,
|
|
66
|
+
const offsetLeft = (0, _useGridVirtualScroller.computeOffsetLeft)(columnPositions, renderContext, isRtl, pinnedColumns.left.length);
|
|
66
67
|
const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
|
|
67
68
|
React.useEffect(() => {
|
|
68
69
|
apiRef.current.columnHeadersContainerRef.current.scrollLeft = 0;
|
|
@@ -9,7 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _utils = require("@mui/utils");
|
|
11
11
|
var _useLazyRef = _interopRequireDefault(require("@mui/utils/useLazyRef"));
|
|
12
|
-
var
|
|
12
|
+
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
13
13
|
var _domUtils = require("../../../utils/domUtils");
|
|
14
14
|
var _gridColumnResizeApi = require("./gridColumnResizeApi");
|
|
15
15
|
var _gridClasses = require("../../../constants/gridClasses");
|
|
@@ -61,9 +61,9 @@ function flipResizeDirection(side) {
|
|
|
61
61
|
}
|
|
62
62
|
return 'Right';
|
|
63
63
|
}
|
|
64
|
-
function getResizeDirection(separator,
|
|
64
|
+
function getResizeDirection(separator, isRtl) {
|
|
65
65
|
const side = separator.classList.contains(_gridClasses.gridClasses['columnSeparator--sideRight']) ? 'Right' : 'Left';
|
|
66
|
-
if (
|
|
66
|
+
if (isRtl) {
|
|
67
67
|
// Resizing logic should be mirrored in the RTL case
|
|
68
68
|
return flipResizeDirection(side);
|
|
69
69
|
}
|
|
@@ -187,7 +187,7 @@ function createResizeRefs() {
|
|
|
187
187
|
* TODO: improve experience for last column
|
|
188
188
|
*/
|
|
189
189
|
const useGridColumnResize = (apiRef, props) => {
|
|
190
|
-
const
|
|
190
|
+
const isRtl = (0, _RtlProvider.useRtl)();
|
|
191
191
|
const logger = (0, _utils2.useGridLogger)(apiRef, 'useGridColumnResize');
|
|
192
192
|
const refs = (0, _useLazyRef.default)(createResizeRefs).current;
|
|
193
193
|
|
|
@@ -327,7 +327,7 @@ const useGridColumnResize = (apiRef, props) => {
|
|
|
327
327
|
refs.rightPinnedCellsBefore = pinnedPosition !== _gridColumnsInterfaces.GridPinnedColumnPosition.RIGHT ? [] : (0, _domUtils.findRightPinnedCellsBeforeCol)(apiRef.current, refs.columnHeaderElement);
|
|
328
328
|
refs.leftPinnedHeadersAfter = pinnedPosition !== _gridColumnsInterfaces.GridPinnedColumnPosition.LEFT ? [] : (0, _domUtils.findLeftPinnedHeadersAfterCol)(apiRef.current, refs.columnHeaderElement);
|
|
329
329
|
refs.rightPinnedHeadersBefore = pinnedPosition !== _gridColumnsInterfaces.GridPinnedColumnPosition.RIGHT ? [] : (0, _domUtils.findRightPinnedHeadersBeforeCol)(apiRef.current, refs.columnHeaderElement);
|
|
330
|
-
resizeDirection.current = getResizeDirection(separator,
|
|
330
|
+
resizeDirection.current = getResizeDirection(separator, isRtl);
|
|
331
331
|
initialOffsetToSeparator.current = computeOffsetToSeparator(xStart, refs.columnHeaderElement.getBoundingClientRect(), resizeDirection.current);
|
|
332
332
|
};
|
|
333
333
|
const handleResizeMouseUp = (0, _utils.unstable_useEventCallback)(finishResize);
|
|
@@ -62,8 +62,8 @@ const gridPinnedColumnsSelector = state => state.pinnedColumns;
|
|
|
62
62
|
* @category Visible Columns
|
|
63
63
|
*/
|
|
64
64
|
exports.gridPinnedColumnsSelector = gridPinnedColumnsSelector;
|
|
65
|
-
const gridVisiblePinnedColumnDefinitionsSelector = exports.gridVisiblePinnedColumnDefinitionsSelector = (0, _createSelector.createSelectorMemoized)(gridColumnsStateSelector, gridPinnedColumnsSelector, gridVisibleColumnFieldsSelector, _gridCoreSelector.
|
|
66
|
-
const visiblePinnedFields = filterVisibleColumns(model, visibleColumnFields,
|
|
65
|
+
const gridVisiblePinnedColumnDefinitionsSelector = exports.gridVisiblePinnedColumnDefinitionsSelector = (0, _createSelector.createSelectorMemoized)(gridColumnsStateSelector, gridPinnedColumnsSelector, gridVisibleColumnFieldsSelector, _gridCoreSelector.gridIsRtlSelector, (columnsState, model, visibleColumnFields, isRtl) => {
|
|
66
|
+
const visiblePinnedFields = filterVisibleColumns(model, visibleColumnFields, isRtl);
|
|
67
67
|
const visiblePinnedColumns = {
|
|
68
68
|
left: visiblePinnedFields.left.map(field => columnsState.lookup[field]),
|
|
69
69
|
right: visiblePinnedFields.right.map(field => columnsState.lookup[field])
|