@mui/x-data-grid 9.10.1 → 9.12.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 +283 -0
- package/DataGrid/DataGrid.js +3 -1
- package/DataGrid/DataGrid.mjs +3 -1
- package/DataGrid/useDataGridProps.d.mts +1 -1
- package/DataGrid/useDataGridProps.d.ts +1 -1
- package/README.md +1 -11
- package/components/cell/GridCell.js +14 -1
- package/components/cell/GridCell.mjs +14 -1
- package/components/columnHeaders/GridBaseColumnHeaders.js +1 -1
- package/components/columnHeaders/GridBaseColumnHeaders.mjs +1 -1
- package/components/columnHeaders/GridColumnHeaderItem.js +4 -0
- package/components/columnHeaders/GridColumnHeaderItem.mjs +4 -0
- package/components/columnHeaders/GridGenericColumnHeaderItem.d.mts +7 -0
- package/components/columnHeaders/GridGenericColumnHeaderItem.d.ts +7 -0
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +5 -4
- package/components/columnHeaders/GridGenericColumnHeaderItem.mjs +5 -4
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +18 -6
- package/components/panel/filterPanel/GridFilterInputSingleSelect.mjs +18 -6
- package/components/toolbarV8/Toolbar.js +2 -125
- package/components/toolbarV8/Toolbar.mjs +2 -125
- package/components/toolbarV8/ToolbarButton.js +11 -50
- package/components/toolbarV8/ToolbarButton.mjs +11 -50
- package/constants/gridClasses.d.mts +12 -0
- package/constants/gridClasses.d.ts +12 -0
- package/constants/gridClasses.js +1 -1
- package/constants/gridClasses.mjs +1 -1
- package/constants/localeTextConstants.js +4 -0
- package/constants/localeTextConstants.mjs +4 -0
- package/hooks/core/useGridApiInitialization.js +5 -1
- package/hooks/core/useGridApiInitialization.mjs +5 -1
- package/hooks/core/useGridStateInitialization.js +3 -1
- package/hooks/core/useGridStateInitialization.mjs +3 -1
- package/hooks/core/useGridVirtualizer.js +3 -0
- package/hooks/core/useGridVirtualizer.mjs +3 -0
- package/hooks/features/columnResize/useGridColumnResize.js +5 -0
- package/hooks/features/columnResize/useGridColumnResize.mjs +5 -0
- package/hooks/features/columns/gridColumnsUtils.d.mts +1 -1
- package/hooks/features/columns/gridColumnsUtils.d.ts +1 -1
- package/hooks/features/columns/gridColumnsUtils.js +2 -2
- package/hooks/features/columns/gridColumnsUtils.mjs +2 -2
- package/hooks/features/dataSource/gridDataSourceSelector.js +6 -2
- package/hooks/features/dataSource/gridDataSourceSelector.mjs +6 -2
- package/hooks/features/dataSource/useGridDataSourceBase.js +47 -5
- package/hooks/features/dataSource/useGridDataSourceBase.mjs +47 -5
- package/hooks/features/dataSource/useGridDataSourceFilterModelChange.d.mts +9 -0
- package/hooks/features/dataSource/useGridDataSourceFilterModelChange.d.ts +9 -0
- package/hooks/features/dataSource/useGridDataSourceFilterModelChange.js +57 -0
- package/hooks/features/dataSource/useGridDataSourceFilterModelChange.mjs +49 -0
- package/hooks/features/editing/useGridCellEditing.js +3 -1
- package/hooks/features/editing/useGridCellEditing.mjs +3 -1
- package/hooks/features/editing/useGridRowEditing.js +3 -1
- package/hooks/features/editing/useGridRowEditing.mjs +3 -1
- package/hooks/features/filter/gridFilterUtils.d.mts +13 -0
- package/hooks/features/filter/gridFilterUtils.d.ts +13 -0
- package/hooks/features/filter/gridFilterUtils.js +32 -1
- package/hooks/features/filter/gridFilterUtils.mjs +29 -1
- package/hooks/features/filter/useGridFilter.js +1 -21
- package/hooks/features/filter/useGridFilter.mjs +2 -22
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +1 -1
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.mjs +1 -1
- package/hooks/features/rows/gridRowsUtils.js +17 -1
- package/hooks/features/rows/gridRowsUtils.mjs +17 -1
- package/hooks/features/rows/useGridRowSpanning.js +5 -0
- package/hooks/features/rows/useGridRowSpanning.mjs +5 -0
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.mts +1 -1
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +1 -1
- package/hooks/utils/useGridEvent.d.mts +2 -2
- package/hooks/utils/useGridEvent.d.ts +2 -2
- package/hooks/utils/useGridEvent.js +2 -0
- package/hooks/utils/useGridEvent.mjs +2 -0
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/index.d.mts +2 -0
- package/internals/index.d.ts +2 -0
- package/internals/index.js +20 -0
- package/internals/index.mjs +2 -0
- package/locales/arSD.js +5 -0
- package/locales/arSD.mjs +5 -0
- package/locales/beBY.js +5 -0
- package/locales/beBY.mjs +5 -0
- package/locales/bgBG.js +5 -0
- package/locales/bgBG.mjs +5 -0
- package/locales/bnBD.js +5 -0
- package/locales/bnBD.mjs +5 -0
- package/locales/caES.js +5 -0
- package/locales/caES.mjs +5 -0
- package/locales/csCZ.js +5 -0
- package/locales/csCZ.mjs +5 -0
- package/locales/daDK.js +5 -0
- package/locales/daDK.mjs +5 -0
- package/locales/deDE.js +5 -0
- package/locales/deDE.mjs +5 -0
- package/locales/elGR.js +5 -0
- package/locales/elGR.mjs +5 -0
- package/locales/esES.js +5 -0
- package/locales/esES.mjs +5 -0
- package/locales/faIR.js +5 -0
- package/locales/faIR.mjs +5 -0
- package/locales/fiFI.js +5 -0
- package/locales/fiFI.mjs +5 -0
- package/locales/frFR.js +5 -0
- package/locales/frFR.mjs +5 -0
- package/locales/heIL.js +5 -0
- package/locales/heIL.mjs +5 -0
- package/locales/hrHR.js +5 -0
- package/locales/hrHR.mjs +5 -0
- package/locales/huHU.js +5 -0
- package/locales/huHU.mjs +5 -0
- package/locales/hyAM.js +5 -0
- package/locales/hyAM.mjs +5 -0
- package/locales/idID.js +5 -0
- package/locales/idID.mjs +5 -0
- package/locales/isIS.js +5 -0
- package/locales/isIS.mjs +5 -0
- package/locales/itIT.js +5 -0
- package/locales/itIT.mjs +5 -0
- package/locales/jaJP.js +5 -0
- package/locales/jaJP.mjs +5 -0
- package/locales/koKR.js +5 -0
- package/locales/koKR.mjs +5 -0
- package/locales/nbNO.js +5 -0
- package/locales/nbNO.mjs +5 -0
- package/locales/nlNL.js +5 -0
- package/locales/nlNL.mjs +5 -0
- package/locales/nnNO.js +5 -0
- package/locales/nnNO.mjs +5 -0
- package/locales/plPL.js +5 -0
- package/locales/plPL.mjs +5 -0
- package/locales/ptBR.js +5 -0
- package/locales/ptBR.mjs +5 -0
- package/locales/ptPT.js +5 -0
- package/locales/ptPT.mjs +5 -0
- package/locales/roRO.js +5 -0
- package/locales/roRO.mjs +5 -0
- package/locales/ruRU.js +5 -0
- package/locales/ruRU.mjs +5 -0
- package/locales/skSK.js +5 -0
- package/locales/skSK.mjs +5 -0
- package/locales/svSE.js +5 -0
- package/locales/svSE.mjs +5 -0
- package/locales/thTH.js +5 -0
- package/locales/thTH.mjs +5 -0
- package/locales/trTR.js +5 -0
- package/locales/trTR.mjs +5 -0
- package/locales/ukUA.js +5 -0
- package/locales/ukUA.mjs +5 -0
- package/locales/urPK.js +5 -0
- package/locales/urPK.mjs +5 -0
- package/locales/viVN.js +5 -0
- package/locales/viVN.mjs +5 -0
- package/locales/zhCN.js +5 -0
- package/locales/zhCN.mjs +5 -0
- package/locales/zhHK.js +5 -0
- package/locales/zhHK.mjs +5 -0
- package/locales/zhTW.js +5 -0
- package/locales/zhTW.mjs +5 -0
- package/models/api/gridApiCommon.d.mts +2 -2
- package/models/api/gridApiCommon.d.ts +2 -2
- package/models/api/gridCallbackDetails.d.mts +11 -1
- package/models/api/gridCallbackDetails.d.ts +11 -1
- package/models/api/gridLocaleTextApi.d.mts +3 -0
- package/models/api/gridLocaleTextApi.d.ts +3 -0
- package/models/api/gridRowApi.d.mts +12 -0
- package/models/api/gridRowApi.d.ts +12 -0
- package/models/api/gridStateApi.d.mts +3 -2
- package/models/api/gridStateApi.d.ts +3 -2
- package/models/api/index.d.mts +1 -1
- package/models/api/index.d.ts +1 -1
- package/models/colDef/gridColDef.d.mts +5 -0
- package/models/colDef/gridColDef.d.ts +5 -0
- package/models/configuration/gridConfiguration.d.mts +13 -1
- package/models/configuration/gridConfiguration.d.ts +13 -1
- package/models/controlStateItem.d.mts +3 -2
- package/models/controlStateItem.d.ts +3 -2
- package/models/events/gridEventListener.d.mts +3 -2
- package/models/events/gridEventListener.d.ts +3 -2
- package/models/props/DataGridProps.d.mts +38 -35
- package/models/props/DataGridProps.d.ts +38 -35
- package/package.json +4 -4
- package/utils/domUtils.js +1 -1
- package/utils/domUtils.mjs +1 -1
- package/utils/getPublicApiRef.d.mts +2 -2
- package/utils/getPublicApiRef.d.ts +2 -2
- package/utils/getPublicApiRef.js +15 -3
- package/utils/getPublicApiRef.mjs +15 -3
- package/components/toolbarV8/ToolbarContext.d.mts +0 -11
- package/components/toolbarV8/ToolbarContext.d.ts +0 -11
- package/components/toolbarV8/ToolbarContext.js +0 -21
- package/components/toolbarV8/ToolbarContext.mjs +0 -13
- package/components/toolbarV8/utils.d.mts +0 -5
- package/components/toolbarV8/utils.d.ts +0 -5
- package/components/toolbarV8/utils.js +0 -23
- package/components/toolbarV8/utils.mjs +0 -17
|
@@ -15,12 +15,23 @@ const renderSingleSelectOptions = ({
|
|
|
15
15
|
getOptionLabel,
|
|
16
16
|
getOptionValue,
|
|
17
17
|
isSelectNative,
|
|
18
|
-
baseSelectOptionProps
|
|
18
|
+
baseSelectOptionProps,
|
|
19
|
+
blankOptionLabel
|
|
19
20
|
}) => {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const valueOptions = getValueOptions(column) || [];
|
|
22
|
+
|
|
23
|
+
// A column that declares its own blank entry already offers a way to reset the filter.
|
|
24
|
+
// Prepending another one would render two options sharing the same `''` key.
|
|
25
|
+
const declaresBlankOption = valueOptions.some(option => {
|
|
26
|
+
const optionValue = getOptionValue(option);
|
|
27
|
+
return optionValue === '' || optionValue === null || optionValue === undefined;
|
|
28
|
+
});
|
|
29
|
+
const iterableColumnValues = declaresBlankOption ? valueOptions : ['', ...valueOptions];
|
|
30
|
+
return iterableColumnValues.map((option, index) => {
|
|
31
|
+
// The prepended entry is ours, not a value option, so it skips the column accessors.
|
|
32
|
+
const isBlankOption = !declaresBlankOption && index === 0;
|
|
33
|
+
const value = isBlankOption ? '' : getOptionValue(option);
|
|
34
|
+
let label = isBlankOption ? blankOptionLabel : getOptionLabel(option);
|
|
24
35
|
if (label === '') {
|
|
25
36
|
label = ' '; // To force the height of the empty option
|
|
26
37
|
}
|
|
@@ -90,7 +101,8 @@ function GridFilterInputSingleSelect(props) {
|
|
|
90
101
|
getOptionLabel,
|
|
91
102
|
getOptionValue,
|
|
92
103
|
isSelectNative,
|
|
93
|
-
baseSelectOptionProps: rootProps.slotProps?.baseSelectOption
|
|
104
|
+
baseSelectOptionProps: rootProps.slotProps?.baseSelectOption,
|
|
105
|
+
blankOptionLabel: apiRef.current.getLocaleText('filterValueAny')
|
|
94
106
|
})
|
|
95
107
|
})), headerFilterMenu, clearButton]
|
|
96
108
|
});
|
|
@@ -16,11 +16,10 @@ var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"
|
|
|
16
16
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
17
17
|
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
18
18
|
var _useComponentRenderer = require("@mui/x-internals/useComponentRenderer");
|
|
19
|
+
var _ToolbarContext = require("@mui/x-internals/ToolbarContext");
|
|
19
20
|
var _cssVariables = require("../../constants/cssVariables");
|
|
20
21
|
var _gridClasses = require("../../constants/gridClasses");
|
|
21
|
-
var _ToolbarContext = require("./ToolbarContext");
|
|
22
22
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
23
|
-
var _utils = require("./utils");
|
|
24
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
24
|
const _excluded = ["render", "className"];
|
|
26
25
|
const useUtilityClasses = ownerState => {
|
|
@@ -67,127 +66,6 @@ const Toolbar = exports.Toolbar = (0, _forwardRef.forwardRef)(function Toolbar(p
|
|
|
67
66
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
68
67
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
69
68
|
const classes = useUtilityClasses(rootProps);
|
|
70
|
-
const [focusableItemId, setFocusableItemId] = React.useState(null);
|
|
71
|
-
const [items, setItems] = React.useState([]);
|
|
72
|
-
const getSortedItems = React.useCallback(() => items.sort(_utils.sortByDocumentPosition), [items]);
|
|
73
|
-
const findEnabledItem = React.useCallback((startIndex, step, wrap = true) => {
|
|
74
|
-
let index = startIndex;
|
|
75
|
-
const sortedItems = getSortedItems();
|
|
76
|
-
const itemCount = sortedItems.length;
|
|
77
|
-
|
|
78
|
-
// Look for enabled items in the specified direction
|
|
79
|
-
for (let i = 0; i < itemCount; i += 1) {
|
|
80
|
-
index += step;
|
|
81
|
-
|
|
82
|
-
// Handle wrapping around the ends
|
|
83
|
-
if (index >= itemCount) {
|
|
84
|
-
if (!wrap) {
|
|
85
|
-
return -1;
|
|
86
|
-
}
|
|
87
|
-
index = 0;
|
|
88
|
-
} else if (index < 0) {
|
|
89
|
-
if (!wrap) {
|
|
90
|
-
return -1;
|
|
91
|
-
}
|
|
92
|
-
index = itemCount - 1;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// Return if we found an enabled item
|
|
96
|
-
if (!sortedItems[index].ref.current?.disabled && sortedItems[index].ref.current?.ariaDisabled !== 'true') {
|
|
97
|
-
return index;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// If we've checked all items and found none enabled
|
|
102
|
-
return -1;
|
|
103
|
-
}, [getSortedItems]);
|
|
104
|
-
const registerItem = React.useCallback((id, itemRef) => {
|
|
105
|
-
setItems(prevItems => [...prevItems, {
|
|
106
|
-
id,
|
|
107
|
-
ref: itemRef
|
|
108
|
-
}]);
|
|
109
|
-
}, []);
|
|
110
|
-
const unregisterItem = React.useCallback(id => {
|
|
111
|
-
setItems(prevItems => prevItems.filter(i => i.id !== id));
|
|
112
|
-
}, []);
|
|
113
|
-
const onItemKeyDown = React.useCallback(event => {
|
|
114
|
-
if (!focusableItemId) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const sortedItems = getSortedItems();
|
|
118
|
-
const focusableItemIndex = sortedItems.findIndex(item => item.id === focusableItemId);
|
|
119
|
-
let newIndex = -1;
|
|
120
|
-
if (event.key === 'ArrowRight') {
|
|
121
|
-
event.preventDefault();
|
|
122
|
-
newIndex = findEnabledItem(focusableItemIndex, 1);
|
|
123
|
-
} else if (event.key === 'ArrowLeft') {
|
|
124
|
-
event.preventDefault();
|
|
125
|
-
newIndex = findEnabledItem(focusableItemIndex, -1);
|
|
126
|
-
} else if (event.key === 'Home') {
|
|
127
|
-
event.preventDefault();
|
|
128
|
-
newIndex = findEnabledItem(-1, 1, false);
|
|
129
|
-
} else if (event.key === 'End') {
|
|
130
|
-
event.preventDefault();
|
|
131
|
-
newIndex = findEnabledItem(sortedItems.length, -1, false);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// TODO: Check why this is necessary
|
|
135
|
-
if (newIndex >= 0 && newIndex < sortedItems.length) {
|
|
136
|
-
const item = sortedItems[newIndex];
|
|
137
|
-
setFocusableItemId(item.id);
|
|
138
|
-
item.ref.current?.focus();
|
|
139
|
-
}
|
|
140
|
-
}, [getSortedItems, focusableItemId, findEnabledItem]);
|
|
141
|
-
const onItemFocus = React.useCallback(id => {
|
|
142
|
-
if (focusableItemId !== id) {
|
|
143
|
-
setFocusableItemId(id);
|
|
144
|
-
}
|
|
145
|
-
}, [focusableItemId, setFocusableItemId]);
|
|
146
|
-
const onItemDisabled = React.useCallback(id => {
|
|
147
|
-
const sortedItems = getSortedItems();
|
|
148
|
-
const currentIndex = sortedItems.findIndex(item => item.id === id);
|
|
149
|
-
const newIndex = findEnabledItem(currentIndex, 1);
|
|
150
|
-
if (newIndex >= 0 && newIndex < sortedItems.length) {
|
|
151
|
-
const item = sortedItems[newIndex];
|
|
152
|
-
setFocusableItemId(item.id);
|
|
153
|
-
item.ref.current?.focus();
|
|
154
|
-
}
|
|
155
|
-
}, [getSortedItems, findEnabledItem]);
|
|
156
|
-
React.useEffect(() => {
|
|
157
|
-
const sortedItems = getSortedItems();
|
|
158
|
-
if (sortedItems.length > 0) {
|
|
159
|
-
// Set initial focusable item
|
|
160
|
-
if (!focusableItemId) {
|
|
161
|
-
setFocusableItemId(sortedItems[0].id);
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
const focusableItemIndex = sortedItems.findIndex(item => item.id === focusableItemId);
|
|
165
|
-
if (!sortedItems[focusableItemIndex]) {
|
|
166
|
-
// Last item has been removed from the items array
|
|
167
|
-
const item = sortedItems[sortedItems.length - 1];
|
|
168
|
-
if (item) {
|
|
169
|
-
setFocusableItemId(item.id);
|
|
170
|
-
item.ref.current?.focus();
|
|
171
|
-
}
|
|
172
|
-
} else if (focusableItemIndex === -1) {
|
|
173
|
-
// Focused item has been removed from the items array
|
|
174
|
-
const item = sortedItems[focusableItemIndex];
|
|
175
|
-
if (item) {
|
|
176
|
-
setFocusableItemId(item.id);
|
|
177
|
-
item.ref.current?.focus();
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
182
|
-
}, [getSortedItems, findEnabledItem]);
|
|
183
|
-
const contextValue = React.useMemo(() => ({
|
|
184
|
-
focusableItemId,
|
|
185
|
-
registerItem,
|
|
186
|
-
unregisterItem,
|
|
187
|
-
onItemKeyDown,
|
|
188
|
-
onItemFocus,
|
|
189
|
-
onItemDisabled
|
|
190
|
-
}), [focusableItemId, registerItem, unregisterItem, onItemKeyDown, onItemFocus, onItemDisabled]);
|
|
191
69
|
const element = (0, _useComponentRenderer.useComponentRenderer)(ToolbarRoot, render, (0, _extends2.default)({
|
|
192
70
|
role: 'toolbar',
|
|
193
71
|
'aria-orientation': 'horizontal',
|
|
@@ -196,8 +74,7 @@ const Toolbar = exports.Toolbar = (0, _forwardRef.forwardRef)(function Toolbar(p
|
|
|
196
74
|
}, other, {
|
|
197
75
|
ref
|
|
198
76
|
}));
|
|
199
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToolbarContext.
|
|
200
|
-
value: contextValue,
|
|
77
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToolbarContext.ToolbarContextProvider, {
|
|
201
78
|
children: element
|
|
202
79
|
});
|
|
203
80
|
});
|
|
@@ -10,11 +10,10 @@ import composeClasses from '@mui/utils/composeClasses';
|
|
|
10
10
|
import clsx from 'clsx';
|
|
11
11
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
12
12
|
import { useComponentRenderer } from '@mui/x-internals/useComponentRenderer';
|
|
13
|
+
import { ToolbarContextProvider } from '@mui/x-internals/ToolbarContext';
|
|
13
14
|
import { vars } from "../../constants/cssVariables.mjs";
|
|
14
15
|
import { getDataGridUtilityClass } from "../../constants/gridClasses.mjs";
|
|
15
|
-
import { ToolbarContext } from "./ToolbarContext.mjs";
|
|
16
16
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.mjs";
|
|
17
|
-
import { sortByDocumentPosition } from "./utils.mjs";
|
|
18
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
18
|
const useUtilityClasses = ownerState => {
|
|
20
19
|
const {
|
|
@@ -60,127 +59,6 @@ const Toolbar = forwardRef(function Toolbar(props, ref) {
|
|
|
60
59
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
61
60
|
const rootProps = useGridRootProps();
|
|
62
61
|
const classes = useUtilityClasses(rootProps);
|
|
63
|
-
const [focusableItemId, setFocusableItemId] = React.useState(null);
|
|
64
|
-
const [items, setItems] = React.useState([]);
|
|
65
|
-
const getSortedItems = React.useCallback(() => items.sort(sortByDocumentPosition), [items]);
|
|
66
|
-
const findEnabledItem = React.useCallback((startIndex, step, wrap = true) => {
|
|
67
|
-
let index = startIndex;
|
|
68
|
-
const sortedItems = getSortedItems();
|
|
69
|
-
const itemCount = sortedItems.length;
|
|
70
|
-
|
|
71
|
-
// Look for enabled items in the specified direction
|
|
72
|
-
for (let i = 0; i < itemCount; i += 1) {
|
|
73
|
-
index += step;
|
|
74
|
-
|
|
75
|
-
// Handle wrapping around the ends
|
|
76
|
-
if (index >= itemCount) {
|
|
77
|
-
if (!wrap) {
|
|
78
|
-
return -1;
|
|
79
|
-
}
|
|
80
|
-
index = 0;
|
|
81
|
-
} else if (index < 0) {
|
|
82
|
-
if (!wrap) {
|
|
83
|
-
return -1;
|
|
84
|
-
}
|
|
85
|
-
index = itemCount - 1;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Return if we found an enabled item
|
|
89
|
-
if (!sortedItems[index].ref.current?.disabled && sortedItems[index].ref.current?.ariaDisabled !== 'true') {
|
|
90
|
-
return index;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// If we've checked all items and found none enabled
|
|
95
|
-
return -1;
|
|
96
|
-
}, [getSortedItems]);
|
|
97
|
-
const registerItem = React.useCallback((id, itemRef) => {
|
|
98
|
-
setItems(prevItems => [...prevItems, {
|
|
99
|
-
id,
|
|
100
|
-
ref: itemRef
|
|
101
|
-
}]);
|
|
102
|
-
}, []);
|
|
103
|
-
const unregisterItem = React.useCallback(id => {
|
|
104
|
-
setItems(prevItems => prevItems.filter(i => i.id !== id));
|
|
105
|
-
}, []);
|
|
106
|
-
const onItemKeyDown = React.useCallback(event => {
|
|
107
|
-
if (!focusableItemId) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
const sortedItems = getSortedItems();
|
|
111
|
-
const focusableItemIndex = sortedItems.findIndex(item => item.id === focusableItemId);
|
|
112
|
-
let newIndex = -1;
|
|
113
|
-
if (event.key === 'ArrowRight') {
|
|
114
|
-
event.preventDefault();
|
|
115
|
-
newIndex = findEnabledItem(focusableItemIndex, 1);
|
|
116
|
-
} else if (event.key === 'ArrowLeft') {
|
|
117
|
-
event.preventDefault();
|
|
118
|
-
newIndex = findEnabledItem(focusableItemIndex, -1);
|
|
119
|
-
} else if (event.key === 'Home') {
|
|
120
|
-
event.preventDefault();
|
|
121
|
-
newIndex = findEnabledItem(-1, 1, false);
|
|
122
|
-
} else if (event.key === 'End') {
|
|
123
|
-
event.preventDefault();
|
|
124
|
-
newIndex = findEnabledItem(sortedItems.length, -1, false);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// TODO: Check why this is necessary
|
|
128
|
-
if (newIndex >= 0 && newIndex < sortedItems.length) {
|
|
129
|
-
const item = sortedItems[newIndex];
|
|
130
|
-
setFocusableItemId(item.id);
|
|
131
|
-
item.ref.current?.focus();
|
|
132
|
-
}
|
|
133
|
-
}, [getSortedItems, focusableItemId, findEnabledItem]);
|
|
134
|
-
const onItemFocus = React.useCallback(id => {
|
|
135
|
-
if (focusableItemId !== id) {
|
|
136
|
-
setFocusableItemId(id);
|
|
137
|
-
}
|
|
138
|
-
}, [focusableItemId, setFocusableItemId]);
|
|
139
|
-
const onItemDisabled = React.useCallback(id => {
|
|
140
|
-
const sortedItems = getSortedItems();
|
|
141
|
-
const currentIndex = sortedItems.findIndex(item => item.id === id);
|
|
142
|
-
const newIndex = findEnabledItem(currentIndex, 1);
|
|
143
|
-
if (newIndex >= 0 && newIndex < sortedItems.length) {
|
|
144
|
-
const item = sortedItems[newIndex];
|
|
145
|
-
setFocusableItemId(item.id);
|
|
146
|
-
item.ref.current?.focus();
|
|
147
|
-
}
|
|
148
|
-
}, [getSortedItems, findEnabledItem]);
|
|
149
|
-
React.useEffect(() => {
|
|
150
|
-
const sortedItems = getSortedItems();
|
|
151
|
-
if (sortedItems.length > 0) {
|
|
152
|
-
// Set initial focusable item
|
|
153
|
-
if (!focusableItemId) {
|
|
154
|
-
setFocusableItemId(sortedItems[0].id);
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
const focusableItemIndex = sortedItems.findIndex(item => item.id === focusableItemId);
|
|
158
|
-
if (!sortedItems[focusableItemIndex]) {
|
|
159
|
-
// Last item has been removed from the items array
|
|
160
|
-
const item = sortedItems[sortedItems.length - 1];
|
|
161
|
-
if (item) {
|
|
162
|
-
setFocusableItemId(item.id);
|
|
163
|
-
item.ref.current?.focus();
|
|
164
|
-
}
|
|
165
|
-
} else if (focusableItemIndex === -1) {
|
|
166
|
-
// Focused item has been removed from the items array
|
|
167
|
-
const item = sortedItems[focusableItemIndex];
|
|
168
|
-
if (item) {
|
|
169
|
-
setFocusableItemId(item.id);
|
|
170
|
-
item.ref.current?.focus();
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
175
|
-
}, [getSortedItems, findEnabledItem]);
|
|
176
|
-
const contextValue = React.useMemo(() => ({
|
|
177
|
-
focusableItemId,
|
|
178
|
-
registerItem,
|
|
179
|
-
unregisterItem,
|
|
180
|
-
onItemKeyDown,
|
|
181
|
-
onItemFocus,
|
|
182
|
-
onItemDisabled
|
|
183
|
-
}), [focusableItemId, registerItem, unregisterItem, onItemKeyDown, onItemFocus, onItemDisabled]);
|
|
184
62
|
const element = useComponentRenderer(ToolbarRoot, render, _extends({
|
|
185
63
|
role: 'toolbar',
|
|
186
64
|
'aria-orientation': 'horizontal',
|
|
@@ -189,8 +67,7 @@ const Toolbar = forwardRef(function Toolbar(props, ref) {
|
|
|
189
67
|
}, other, {
|
|
190
68
|
ref
|
|
191
69
|
}));
|
|
192
|
-
return /*#__PURE__*/_jsx(
|
|
193
|
-
value: contextValue,
|
|
70
|
+
return /*#__PURE__*/_jsx(ToolbarContextProvider, {
|
|
194
71
|
children: element
|
|
195
72
|
});
|
|
196
73
|
});
|
|
@@ -12,13 +12,13 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
15
|
-
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
16
15
|
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
17
16
|
var _useComponentRenderer = require("@mui/x-internals/useComponentRenderer");
|
|
17
|
+
var _ToolbarContext = require("@mui/x-internals/ToolbarContext");
|
|
18
18
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
19
|
-
var _ToolbarContext = require("./ToolbarContext");
|
|
20
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
const _excluded = ["render", "onKeyDown", "onFocus", "disabled", "aria-disabled"]
|
|
20
|
+
const _excluded = ["render", "onKeyDown", "onFocus", "onBlur", "disabled", "aria-disabled"],
|
|
21
|
+
_excluded2 = ["tabIndex"];
|
|
22
22
|
/**
|
|
23
23
|
* A button for performing actions from the toolbar.
|
|
24
24
|
* It renders the `baseIconButton` slot.
|
|
@@ -33,59 +33,20 @@ const _excluded = ["render", "onKeyDown", "onFocus", "disabled", "aria-disabled"
|
|
|
33
33
|
*/
|
|
34
34
|
const ToolbarButton = exports.ToolbarButton = (0, _forwardRef.forwardRef)(function ToolbarButton(props, ref) {
|
|
35
35
|
const {
|
|
36
|
-
render
|
|
37
|
-
onKeyDown,
|
|
38
|
-
onFocus,
|
|
39
|
-
disabled,
|
|
40
|
-
'aria-disabled': ariaDisabled
|
|
36
|
+
render
|
|
41
37
|
} = props,
|
|
42
38
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
43
|
-
const id = (0, _useId.default)();
|
|
44
39
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
45
40
|
const buttonRef = React.useRef(null);
|
|
46
41
|
const handleRef = (0, _useForkRef.default)(buttonRef, ref);
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
onItemFocus,
|
|
53
|
-
onItemDisabled
|
|
54
|
-
} = (0, _ToolbarContext.useToolbarContext)();
|
|
55
|
-
const handleKeyDown = event => {
|
|
56
|
-
onItemKeyDown(event);
|
|
57
|
-
onKeyDown?.(event);
|
|
58
|
-
};
|
|
59
|
-
const handleFocus = event => {
|
|
60
|
-
onItemFocus(id);
|
|
61
|
-
onFocus?.(event);
|
|
62
|
-
};
|
|
63
|
-
React.useEffect(() => {
|
|
64
|
-
registerItem(id, buttonRef);
|
|
65
|
-
return () => unregisterItem(id);
|
|
66
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
67
|
-
}, []);
|
|
68
|
-
const previousDisabled = React.useRef(disabled);
|
|
69
|
-
React.useEffect(() => {
|
|
70
|
-
if (previousDisabled.current !== disabled && disabled === true) {
|
|
71
|
-
onItemDisabled(id, disabled);
|
|
72
|
-
}
|
|
73
|
-
previousDisabled.current = disabled;
|
|
74
|
-
}, [disabled, id, onItemDisabled]);
|
|
75
|
-
const previousAriaDisabled = React.useRef(ariaDisabled);
|
|
76
|
-
React.useEffect(() => {
|
|
77
|
-
if (previousAriaDisabled.current !== ariaDisabled && ariaDisabled === true) {
|
|
78
|
-
onItemDisabled(id, true);
|
|
79
|
-
}
|
|
80
|
-
previousAriaDisabled.current = ariaDisabled;
|
|
81
|
-
}, [ariaDisabled, id, onItemDisabled]);
|
|
42
|
+
const _useRegisterToolbarBu = (0, _ToolbarContext.useRegisterToolbarButton)(props, buttonRef),
|
|
43
|
+
{
|
|
44
|
+
tabIndex
|
|
45
|
+
} = _useRegisterToolbarBu,
|
|
46
|
+
toolbarButtonProps = (0, _objectWithoutPropertiesLoose2.default)(_useRegisterToolbarBu, _excluded2);
|
|
82
47
|
const element = (0, _useComponentRenderer.useComponentRenderer)(rootProps.slots.baseIconButton, render, (0, _extends2.default)({}, rootProps.slotProps?.baseIconButton, {
|
|
83
|
-
tabIndex
|
|
84
|
-
}, other, {
|
|
85
|
-
disabled,
|
|
86
|
-
'aria-disabled': ariaDisabled,
|
|
87
|
-
onKeyDown: handleKeyDown,
|
|
88
|
-
onFocus: handleFocus,
|
|
48
|
+
tabIndex
|
|
49
|
+
}, other, toolbarButtonProps, {
|
|
89
50
|
ref: handleRef
|
|
90
51
|
}));
|
|
91
52
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["render", "onKeyDown", "onFocus", "disabled", "aria-disabled"]
|
|
5
|
+
const _excluded = ["render", "onKeyDown", "onFocus", "onBlur", "disabled", "aria-disabled"],
|
|
6
|
+
_excluded2 = ["tabIndex"];
|
|
6
7
|
import * as React from 'react';
|
|
7
8
|
import PropTypes from 'prop-types';
|
|
8
9
|
import useForkRef from '@mui/utils/useForkRef';
|
|
9
|
-
import useId from '@mui/utils/useId';
|
|
10
10
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
11
11
|
import { useComponentRenderer } from '@mui/x-internals/useComponentRenderer';
|
|
12
|
+
import { useRegisterToolbarButton } from '@mui/x-internals/ToolbarContext';
|
|
12
13
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.mjs";
|
|
13
|
-
import { useToolbarContext } from "./ToolbarContext.mjs";
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
/**
|
|
16
16
|
* A button for performing actions from the toolbar.
|
|
@@ -26,59 +26,20 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
26
26
|
*/
|
|
27
27
|
const ToolbarButton = forwardRef(function ToolbarButton(props, ref) {
|
|
28
28
|
const {
|
|
29
|
-
render
|
|
30
|
-
onKeyDown,
|
|
31
|
-
onFocus,
|
|
32
|
-
disabled,
|
|
33
|
-
'aria-disabled': ariaDisabled
|
|
29
|
+
render
|
|
34
30
|
} = props,
|
|
35
31
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
36
|
-
const id = useId();
|
|
37
32
|
const rootProps = useGridRootProps();
|
|
38
33
|
const buttonRef = React.useRef(null);
|
|
39
34
|
const handleRef = useForkRef(buttonRef, ref);
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
onItemFocus,
|
|
46
|
-
onItemDisabled
|
|
47
|
-
} = useToolbarContext();
|
|
48
|
-
const handleKeyDown = event => {
|
|
49
|
-
onItemKeyDown(event);
|
|
50
|
-
onKeyDown?.(event);
|
|
51
|
-
};
|
|
52
|
-
const handleFocus = event => {
|
|
53
|
-
onItemFocus(id);
|
|
54
|
-
onFocus?.(event);
|
|
55
|
-
};
|
|
56
|
-
React.useEffect(() => {
|
|
57
|
-
registerItem(id, buttonRef);
|
|
58
|
-
return () => unregisterItem(id);
|
|
59
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
|
-
}, []);
|
|
61
|
-
const previousDisabled = React.useRef(disabled);
|
|
62
|
-
React.useEffect(() => {
|
|
63
|
-
if (previousDisabled.current !== disabled && disabled === true) {
|
|
64
|
-
onItemDisabled(id, disabled);
|
|
65
|
-
}
|
|
66
|
-
previousDisabled.current = disabled;
|
|
67
|
-
}, [disabled, id, onItemDisabled]);
|
|
68
|
-
const previousAriaDisabled = React.useRef(ariaDisabled);
|
|
69
|
-
React.useEffect(() => {
|
|
70
|
-
if (previousAriaDisabled.current !== ariaDisabled && ariaDisabled === true) {
|
|
71
|
-
onItemDisabled(id, true);
|
|
72
|
-
}
|
|
73
|
-
previousAriaDisabled.current = ariaDisabled;
|
|
74
|
-
}, [ariaDisabled, id, onItemDisabled]);
|
|
35
|
+
const _useRegisterToolbarBu = useRegisterToolbarButton(props, buttonRef),
|
|
36
|
+
{
|
|
37
|
+
tabIndex
|
|
38
|
+
} = _useRegisterToolbarBu,
|
|
39
|
+
toolbarButtonProps = _objectWithoutPropertiesLoose(_useRegisterToolbarBu, _excluded2);
|
|
75
40
|
const element = useComponentRenderer(rootProps.slots.baseIconButton, render, _extends({}, rootProps.slotProps?.baseIconButton, {
|
|
76
|
-
tabIndex
|
|
77
|
-
}, other, {
|
|
78
|
-
disabled,
|
|
79
|
-
'aria-disabled': ariaDisabled,
|
|
80
|
-
onKeyDown: handleKeyDown,
|
|
81
|
-
onFocus: handleFocus,
|
|
41
|
+
tabIndex
|
|
42
|
+
}, other, toolbarButtonProps, {
|
|
82
43
|
ref: handleRef
|
|
83
44
|
}));
|
|
84
45
|
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
@@ -83,6 +83,18 @@ export interface GridClasses {
|
|
|
83
83
|
* Styles applied to the aggregation row overlay wrapper.
|
|
84
84
|
*/
|
|
85
85
|
aggregationRowOverlayWrapper: string;
|
|
86
|
+
/**
|
|
87
|
+
* Styles applied to the A1-notation column-letter adornment in the column header (Premium formulas).
|
|
88
|
+
*/
|
|
89
|
+
formulaColumnHeaderLetter: string;
|
|
90
|
+
/**
|
|
91
|
+
* Styles applied to the cells of the A1-notation row-number column (Premium formulas).
|
|
92
|
+
*/
|
|
93
|
+
formulaRowNumberCell: string;
|
|
94
|
+
/**
|
|
95
|
+
* Styles applied to the formula bar root element (Premium formulas).
|
|
96
|
+
*/
|
|
97
|
+
formulaBar: string;
|
|
86
98
|
/**
|
|
87
99
|
* Styles applied to the root element if `autoHeight={true}`.
|
|
88
100
|
*/
|
|
@@ -83,6 +83,18 @@ export interface GridClasses {
|
|
|
83
83
|
* Styles applied to the aggregation row overlay wrapper.
|
|
84
84
|
*/
|
|
85
85
|
aggregationRowOverlayWrapper: string;
|
|
86
|
+
/**
|
|
87
|
+
* Styles applied to the A1-notation column-letter adornment in the column header (Premium formulas).
|
|
88
|
+
*/
|
|
89
|
+
formulaColumnHeaderLetter: string;
|
|
90
|
+
/**
|
|
91
|
+
* Styles applied to the cells of the A1-notation row-number column (Premium formulas).
|
|
92
|
+
*/
|
|
93
|
+
formulaRowNumberCell: string;
|
|
94
|
+
/**
|
|
95
|
+
* Styles applied to the formula bar root element (Premium formulas).
|
|
96
|
+
*/
|
|
97
|
+
formulaBar: string;
|
|
86
98
|
/**
|
|
87
99
|
* Styles applied to the root element if `autoHeight={true}`.
|
|
88
100
|
*/
|
package/constants/gridClasses.js
CHANGED
|
@@ -30,4 +30,4 @@ const gridClassesOverrides = exports.gridClassesOverrides = {
|
|
|
30
30
|
// TODO v9: Rename to `cell--dragging`
|
|
31
31
|
'row--dragging', 'row--dynamicHeight', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'rowReorderCell', 'rowReorderCell--draggable', 'rowReorderCellContainer', 'rowReorderCellPlaceholder', 'rowSkeleton', 'scrollbar', 'scrollbar--horizontal', 'scrollbar--vertical', 'scrollbarFiller', 'scrollbarFiller--pinnedRight', 'sortIcon', 'treeDataGroupingCell', 'treeDataGroupingCellLoadingContainer', 'treeDataGroupingCellToggle', 'withBorderColor', 'row--beingDragged']
|
|
32
32
|
};
|
|
33
|
-
const gridClasses = exports.gridClasses = (0, _generateUtilityClasses.default)('MuiDataGrid', [...gridClassesOverrides.root, ...gridClassesOverrides.children, 'aiAssistantPanel', 'aiAssistantPanelHeader', 'aiAssistantPanelTitleContainer', 'aiAssistantPanelTitle', 'aiAssistantPanelBody', 'aiAssistantPanelEmptyText', 'aiAssistantPanelFooter', 'aiAssistantPanelConversation', 'aiAssistantPanelConversationList', 'aiAssistantPanelConversationTitle', 'aiAssistantPanelSuggestions', 'aiAssistantPanelSuggestionsList', 'aiAssistantPanelSuggestionsItem', 'aiAssistantPanelSuggestionsLabel', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'aggregationRowOverlayWrapper', 'mainContent', 'withSidePanel', 'collapsible', 'collapsibleTrigger', 'collapsibleIcon', 'collapsiblePanel', 'columnHeader--filter', 'columnHeaderFilterInput', 'columnHeaderFilterOperatorLabel', 'columnHeaderTitle', 'columnHeaders', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementSearchInput', 'columnsManagementFooter', 'columnsManagementScrollArea', 'columnsManagementEmptyText', 'contentFiller', 'detailPanel', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editInputCell', 'longTextCell', 'longTextCellContent', 'longTextCellExpandButton', 'longTextCellCollapseButton', 'longTextCellPopup', 'longTextCellPopperContent', 'editLongTextCell', 'editLongTextCellValue', 'editLongTextCellPopup', 'editLongTextCellPopperContent', 'editLongTextCellTextarea', 'multiSelectCell', 'multiSelectCellChip', 'multiSelectCellChip--hidden', 'multiSelectCellOverflow', 'multiSelectCellPopup', 'multiSelectCellPopperContent', 'editMultiSelectCell', 'editMultiSelectCellChip', 'editMultiSelectCellChip--hidden', 'editMultiSelectCellOverflow', 'editMultiSelectCellPopup', 'editMultiSelectCellPopperContent', 'filler', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filler--horizontal', 'footerContainer', 'iconButtonContainer', 'main', 'main--hasPinnedRight', 'main--hiddenContent', 'menu', 'overlay', 'overlayWrapper', 'root', 'virtualizer--layoutControlled', 'rowCount', 'rowReorderIcon', 'scrollArea--left', 'scrollArea--right', 'scrollArea--up', 'scrollArea--down', 'scrollArea', 'scrollShadow', 'scrollShadow--vertical', 'scrollShadow--horizontal', 'selectedRowCount', 'sortButton', 'shadowScrollArea', 'sidebar', 'sidebarHeader', 'toolbarContainer', 'toolbar', 'toolbarLabel', 'toolbarDivider', 'toolbarFilterList', 'toolbarQuickFilter', 'toolbarQuickFilterTrigger', 'toolbarQuickFilterControl', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pivotPanelAvailableFields', 'pivotPanelField', 'pivotPanelField--sorted', 'pivotPanelFieldActionContainer', 'pivotPanelFieldCheckbox', 'pivotPanelFieldDragIcon', 'pivotPanelFieldList', 'pivotPanelFieldName', 'pivotPanelHeader', 'pivotPanelPlaceholder', 'pivotPanelScrollArea', 'pivotPanelSearchContainer', 'pivotPanelSection', 'pivotPanelSectionTitle', 'pivotPanelSections', 'pivotPanelSwitch', 'pivotPanelSwitchLabel', 'prompt', 'promptContent', 'promptText', 'promptFeedback', 'promptChangeList', 'promptChangesToggle', 'promptChangesToggleIcon', 'promptIcon', 'promptIconContainer', 'promptError', 'promptAction', 'resizablePanelHandle', 'resizablePanelHandle--horizontal', 'resizablePanelHandle--vertical']);
|
|
33
|
+
const gridClasses = exports.gridClasses = (0, _generateUtilityClasses.default)('MuiDataGrid', [...gridClassesOverrides.root, ...gridClassesOverrides.children, 'aiAssistantPanel', 'aiAssistantPanelHeader', 'aiAssistantPanelTitleContainer', 'aiAssistantPanelTitle', 'aiAssistantPanelBody', 'aiAssistantPanelEmptyText', 'aiAssistantPanelFooter', 'aiAssistantPanelConversation', 'aiAssistantPanelConversationList', 'aiAssistantPanelConversationTitle', 'aiAssistantPanelSuggestions', 'aiAssistantPanelSuggestionsList', 'aiAssistantPanelSuggestionsItem', 'aiAssistantPanelSuggestionsLabel', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'aggregationRowOverlayWrapper', 'formulaColumnHeaderLetter', 'formulaRowNumberCell', 'formulaBar', 'mainContent', 'withSidePanel', 'collapsible', 'collapsibleTrigger', 'collapsibleIcon', 'collapsiblePanel', 'columnHeader--filter', 'columnHeaderFilterInput', 'columnHeaderFilterOperatorLabel', 'columnHeaderTitle', 'columnHeaders', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementSearchInput', 'columnsManagementFooter', 'columnsManagementScrollArea', 'columnsManagementEmptyText', 'contentFiller', 'detailPanel', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editInputCell', 'longTextCell', 'longTextCellContent', 'longTextCellExpandButton', 'longTextCellCollapseButton', 'longTextCellPopup', 'longTextCellPopperContent', 'editLongTextCell', 'editLongTextCellValue', 'editLongTextCellPopup', 'editLongTextCellPopperContent', 'editLongTextCellTextarea', 'multiSelectCell', 'multiSelectCellChip', 'multiSelectCellChip--hidden', 'multiSelectCellOverflow', 'multiSelectCellPopup', 'multiSelectCellPopperContent', 'editMultiSelectCell', 'editMultiSelectCellChip', 'editMultiSelectCellChip--hidden', 'editMultiSelectCellOverflow', 'editMultiSelectCellPopup', 'editMultiSelectCellPopperContent', 'filler', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filler--horizontal', 'footerContainer', 'iconButtonContainer', 'main', 'main--hasPinnedRight', 'main--hiddenContent', 'menu', 'overlay', 'overlayWrapper', 'root', 'virtualizer--layoutControlled', 'rowCount', 'rowReorderIcon', 'scrollArea--left', 'scrollArea--right', 'scrollArea--up', 'scrollArea--down', 'scrollArea', 'scrollShadow', 'scrollShadow--vertical', 'scrollShadow--horizontal', 'selectedRowCount', 'sortButton', 'shadowScrollArea', 'sidebar', 'sidebarHeader', 'toolbarContainer', 'toolbar', 'toolbarLabel', 'toolbarDivider', 'toolbarFilterList', 'toolbarQuickFilter', 'toolbarQuickFilterTrigger', 'toolbarQuickFilterControl', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pivotPanelAvailableFields', 'pivotPanelField', 'pivotPanelField--sorted', 'pivotPanelFieldActionContainer', 'pivotPanelFieldCheckbox', 'pivotPanelFieldDragIcon', 'pivotPanelFieldList', 'pivotPanelFieldName', 'pivotPanelHeader', 'pivotPanelPlaceholder', 'pivotPanelScrollArea', 'pivotPanelSearchContainer', 'pivotPanelSection', 'pivotPanelSectionTitle', 'pivotPanelSections', 'pivotPanelSwitch', 'pivotPanelSwitchLabel', 'prompt', 'promptContent', 'promptText', 'promptFeedback', 'promptChangeList', 'promptChangesToggle', 'promptChangesToggleIcon', 'promptIcon', 'promptIconContainer', 'promptError', 'promptAction', 'resizablePanelHandle', 'resizablePanelHandle--horizontal', 'resizablePanelHandle--vertical']);
|
|
@@ -22,4 +22,4 @@ export const gridClassesOverrides = {
|
|
|
22
22
|
// TODO v9: Rename to `cell--dragging`
|
|
23
23
|
'row--dragging', 'row--dynamicHeight', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'rowReorderCell', 'rowReorderCell--draggable', 'rowReorderCellContainer', 'rowReorderCellPlaceholder', 'rowSkeleton', 'scrollbar', 'scrollbar--horizontal', 'scrollbar--vertical', 'scrollbarFiller', 'scrollbarFiller--pinnedRight', 'sortIcon', 'treeDataGroupingCell', 'treeDataGroupingCellLoadingContainer', 'treeDataGroupingCellToggle', 'withBorderColor', 'row--beingDragged']
|
|
24
24
|
};
|
|
25
|
-
export const gridClasses = generateUtilityClasses('MuiDataGrid', [...gridClassesOverrides.root, ...gridClassesOverrides.children, 'aiAssistantPanel', 'aiAssistantPanelHeader', 'aiAssistantPanelTitleContainer', 'aiAssistantPanelTitle', 'aiAssistantPanelBody', 'aiAssistantPanelEmptyText', 'aiAssistantPanelFooter', 'aiAssistantPanelConversation', 'aiAssistantPanelConversationList', 'aiAssistantPanelConversationTitle', 'aiAssistantPanelSuggestions', 'aiAssistantPanelSuggestionsList', 'aiAssistantPanelSuggestionsItem', 'aiAssistantPanelSuggestionsLabel', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'aggregationRowOverlayWrapper', 'mainContent', 'withSidePanel', 'collapsible', 'collapsibleTrigger', 'collapsibleIcon', 'collapsiblePanel', 'columnHeader--filter', 'columnHeaderFilterInput', 'columnHeaderFilterOperatorLabel', 'columnHeaderTitle', 'columnHeaders', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementSearchInput', 'columnsManagementFooter', 'columnsManagementScrollArea', 'columnsManagementEmptyText', 'contentFiller', 'detailPanel', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editInputCell', 'longTextCell', 'longTextCellContent', 'longTextCellExpandButton', 'longTextCellCollapseButton', 'longTextCellPopup', 'longTextCellPopperContent', 'editLongTextCell', 'editLongTextCellValue', 'editLongTextCellPopup', 'editLongTextCellPopperContent', 'editLongTextCellTextarea', 'multiSelectCell', 'multiSelectCellChip', 'multiSelectCellChip--hidden', 'multiSelectCellOverflow', 'multiSelectCellPopup', 'multiSelectCellPopperContent', 'editMultiSelectCell', 'editMultiSelectCellChip', 'editMultiSelectCellChip--hidden', 'editMultiSelectCellOverflow', 'editMultiSelectCellPopup', 'editMultiSelectCellPopperContent', 'filler', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filler--horizontal', 'footerContainer', 'iconButtonContainer', 'main', 'main--hasPinnedRight', 'main--hiddenContent', 'menu', 'overlay', 'overlayWrapper', 'root', 'virtualizer--layoutControlled', 'rowCount', 'rowReorderIcon', 'scrollArea--left', 'scrollArea--right', 'scrollArea--up', 'scrollArea--down', 'scrollArea', 'scrollShadow', 'scrollShadow--vertical', 'scrollShadow--horizontal', 'selectedRowCount', 'sortButton', 'shadowScrollArea', 'sidebar', 'sidebarHeader', 'toolbarContainer', 'toolbar', 'toolbarLabel', 'toolbarDivider', 'toolbarFilterList', 'toolbarQuickFilter', 'toolbarQuickFilterTrigger', 'toolbarQuickFilterControl', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pivotPanelAvailableFields', 'pivotPanelField', 'pivotPanelField--sorted', 'pivotPanelFieldActionContainer', 'pivotPanelFieldCheckbox', 'pivotPanelFieldDragIcon', 'pivotPanelFieldList', 'pivotPanelFieldName', 'pivotPanelHeader', 'pivotPanelPlaceholder', 'pivotPanelScrollArea', 'pivotPanelSearchContainer', 'pivotPanelSection', 'pivotPanelSectionTitle', 'pivotPanelSections', 'pivotPanelSwitch', 'pivotPanelSwitchLabel', 'prompt', 'promptContent', 'promptText', 'promptFeedback', 'promptChangeList', 'promptChangesToggle', 'promptChangesToggleIcon', 'promptIcon', 'promptIconContainer', 'promptError', 'promptAction', 'resizablePanelHandle', 'resizablePanelHandle--horizontal', 'resizablePanelHandle--vertical']);
|
|
25
|
+
export const gridClasses = generateUtilityClasses('MuiDataGrid', [...gridClassesOverrides.root, ...gridClassesOverrides.children, 'aiAssistantPanel', 'aiAssistantPanelHeader', 'aiAssistantPanelTitleContainer', 'aiAssistantPanelTitle', 'aiAssistantPanelBody', 'aiAssistantPanelEmptyText', 'aiAssistantPanelFooter', 'aiAssistantPanelConversation', 'aiAssistantPanelConversationList', 'aiAssistantPanelConversationTitle', 'aiAssistantPanelSuggestions', 'aiAssistantPanelSuggestionsList', 'aiAssistantPanelSuggestionsItem', 'aiAssistantPanelSuggestionsLabel', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'aggregationRowOverlayWrapper', 'formulaColumnHeaderLetter', 'formulaRowNumberCell', 'formulaBar', 'mainContent', 'withSidePanel', 'collapsible', 'collapsibleTrigger', 'collapsibleIcon', 'collapsiblePanel', 'columnHeader--filter', 'columnHeaderFilterInput', 'columnHeaderFilterOperatorLabel', 'columnHeaderTitle', 'columnHeaders', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementSearchInput', 'columnsManagementFooter', 'columnsManagementScrollArea', 'columnsManagementEmptyText', 'contentFiller', 'detailPanel', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editInputCell', 'longTextCell', 'longTextCellContent', 'longTextCellExpandButton', 'longTextCellCollapseButton', 'longTextCellPopup', 'longTextCellPopperContent', 'editLongTextCell', 'editLongTextCellValue', 'editLongTextCellPopup', 'editLongTextCellPopperContent', 'editLongTextCellTextarea', 'multiSelectCell', 'multiSelectCellChip', 'multiSelectCellChip--hidden', 'multiSelectCellOverflow', 'multiSelectCellPopup', 'multiSelectCellPopperContent', 'editMultiSelectCell', 'editMultiSelectCellChip', 'editMultiSelectCellChip--hidden', 'editMultiSelectCellOverflow', 'editMultiSelectCellPopup', 'editMultiSelectCellPopperContent', 'filler', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filler--horizontal', 'footerContainer', 'iconButtonContainer', 'main', 'main--hasPinnedRight', 'main--hiddenContent', 'menu', 'overlay', 'overlayWrapper', 'root', 'virtualizer--layoutControlled', 'rowCount', 'rowReorderIcon', 'scrollArea--left', 'scrollArea--right', 'scrollArea--up', 'scrollArea--down', 'scrollArea', 'scrollShadow', 'scrollShadow--vertical', 'scrollShadow--horizontal', 'selectedRowCount', 'sortButton', 'shadowScrollArea', 'sidebar', 'sidebarHeader', 'toolbarContainer', 'toolbar', 'toolbarLabel', 'toolbarDivider', 'toolbarFilterList', 'toolbarQuickFilter', 'toolbarQuickFilterTrigger', 'toolbarQuickFilterControl', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pivotPanelAvailableFields', 'pivotPanelField', 'pivotPanelField--sorted', 'pivotPanelFieldActionContainer', 'pivotPanelFieldCheckbox', 'pivotPanelFieldDragIcon', 'pivotPanelFieldList', 'pivotPanelFieldName', 'pivotPanelHeader', 'pivotPanelPlaceholder', 'pivotPanelScrollArea', 'pivotPanelSearchContainer', 'pivotPanelSection', 'pivotPanelSectionTitle', 'pivotPanelSections', 'pivotPanelSwitch', 'pivotPanelSwitchLabel', 'prompt', 'promptContent', 'promptText', 'promptFeedback', 'promptChangeList', 'promptChangesToggle', 'promptChangesToggleIcon', 'promptIcon', 'promptIconContainer', 'promptError', 'promptAction', 'resizablePanelHandle', 'resizablePanelHandle--horizontal', 'resizablePanelHandle--vertical']);
|
|
@@ -47,6 +47,10 @@ const GRID_DEFAULT_LOCALE_TEXT = exports.GRID_DEFAULT_LOCALE_TEXT = {
|
|
|
47
47
|
toolbarCharts: 'Charts',
|
|
48
48
|
// Toolbar AI Assistant button
|
|
49
49
|
toolbarAssistant: 'AI Assistant',
|
|
50
|
+
// Formula bar (Premium formulas)
|
|
51
|
+
formulaBarLabel: 'Formula bar',
|
|
52
|
+
formulaBarInputLabel: 'Formula',
|
|
53
|
+
formulaBarAddressLabel: 'Active cell',
|
|
50
54
|
// Columns management text
|
|
51
55
|
columnsManagementSearchTitle: 'Search',
|
|
52
56
|
columnsManagementNoColumns: 'No columns',
|
|
@@ -41,6 +41,10 @@ export const GRID_DEFAULT_LOCALE_TEXT = {
|
|
|
41
41
|
toolbarCharts: 'Charts',
|
|
42
42
|
// Toolbar AI Assistant button
|
|
43
43
|
toolbarAssistant: 'AI Assistant',
|
|
44
|
+
// Formula bar (Premium formulas)
|
|
45
|
+
formulaBarLabel: 'Formula bar',
|
|
46
|
+
formulaBarInputLabel: 'Formula',
|
|
47
|
+
formulaBarAddressLabel: 'Active cell',
|
|
44
48
|
// Columns management text
|
|
45
49
|
columnsManagementSearchTitle: 'Search',
|
|
46
50
|
columnsManagementNoColumns: 'No columns',
|
|
@@ -12,6 +12,7 @@ var _EventManager = require("@mui/x-internals/EventManager");
|
|
|
12
12
|
var _store = require("@mui/x-internals/store");
|
|
13
13
|
var _useGridApiMethod = require("../utils/useGridApiMethod");
|
|
14
14
|
var _signature = require("../../constants/signature");
|
|
15
|
+
var _getPublicApiRef = require("../../utils/getPublicApiRef");
|
|
15
16
|
const SYMBOL_API_PRIVATE = Symbol('mui.api_private');
|
|
16
17
|
const isSyntheticEvent = event => {
|
|
17
18
|
return event.isPropagationStopped !== undefined;
|
|
@@ -92,8 +93,11 @@ function useGridApiInitialization(inputApiRef, props) {
|
|
|
92
93
|
return;
|
|
93
94
|
}
|
|
94
95
|
const details = props.signature === _signature.GridSignature.DataGridPro || props.signature === _signature.GridSignature.DataGridPremium ? {
|
|
96
|
+
apiRef: (0, _getPublicApiRef.getPublicApiRef)(privateApiRef),
|
|
95
97
|
api: privateApiRef.current.getPublicApi()
|
|
96
|
-
} : {
|
|
98
|
+
} : {
|
|
99
|
+
apiRef: (0, _getPublicApiRef.getPublicApiRef)(privateApiRef)
|
|
100
|
+
};
|
|
97
101
|
privateApiRef.current.eventManager.emit(name, params, event, details);
|
|
98
102
|
}, [privateApiRef, props.signature]);
|
|
99
103
|
const subscribeEvent = React.useCallback((event, handler, options) => {
|