@mui/x-data-grid 7.0.0-beta.0 → 7.0.0-beta.2
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 +406 -1
- package/DataGrid/DataGrid.d.ts +1 -1
- package/DataGrid/DataGrid.js +1 -1
- package/DataGrid/useDataGridComponent.js +1 -1
- package/DataGrid/useDataGridProps.js +3 -1
- package/colDef/gridBooleanColDef.js +3 -6
- package/colDef/gridCheckboxSelectionColDef.js +4 -3
- package/colDef/gridDateColDef.d.ts +3 -4
- package/colDef/gridDateColDef.js +10 -16
- package/colDef/gridNumericColDef.js +1 -3
- package/colDef/gridSingleSelectColDef.js +7 -12
- package/components/GridPagination.d.ts +1 -1
- package/components/GridPagination.js +12 -2
- package/components/GridRow.js +7 -5
- package/components/GridScrollbarFillerCell.js +0 -3
- package/components/base/GridFooterPlaceholder.js +1 -1
- package/components/cell/GridActionsCell.js +3 -3
- package/components/cell/GridActionsCellItem.d.ts +13 -1
- package/components/cell/GridActionsCellItem.js +27 -15
- package/components/cell/GridEditInputCell.js +1 -1
- package/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
- package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
- package/components/columnsManagement/GridColumnsManagement.d.ts +7 -0
- package/components/columnsManagement/GridColumnsManagement.js +26 -21
- package/components/columnsManagement/utils.d.ts +1 -1
- package/components/containers/GridRootStyles.js +10 -2
- package/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
- package/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/constants/gridClasses.d.ts +5 -0
- package/constants/gridClasses.js +1 -1
- package/hooks/features/columns/useGridColumnSpanning.js +3 -1
- package/hooks/features/editing/useGridCellEditing.js +2 -5
- package/hooks/features/editing/useGridRowEditing.js +2 -5
- package/hooks/features/filter/gridFilterUtils.js +1 -1
- package/hooks/features/rows/gridRowsUtils.js +1 -1
- package/hooks/features/rows/useGridParamsApi.d.ts +1 -2
- package/hooks/features/rows/useGridParamsApi.js +14 -49
- package/hooks/features/rows/useGridRows.js +2 -2
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +0 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +9 -10
- package/index.js +1 -1
- package/internals/utils/propValidation.js +1 -1
- package/joy/joySlots.js +2 -2
- package/legacy/DataGrid/DataGrid.js +1 -1
- package/legacy/DataGrid/useDataGridComponent.js +1 -1
- package/legacy/DataGrid/useDataGridProps.js +3 -1
- package/legacy/colDef/gridBooleanColDef.js +3 -5
- package/legacy/colDef/gridCheckboxSelectionColDef.js +4 -3
- package/legacy/colDef/gridDateColDef.js +10 -14
- package/legacy/colDef/gridNumericColDef.js +1 -2
- package/legacy/colDef/gridSingleSelectColDef.js +7 -10
- package/legacy/components/GridPagination.js +10 -2
- package/legacy/components/GridRow.js +7 -5
- package/legacy/components/GridScrollbarFillerCell.js +1 -3
- package/legacy/components/base/GridFooterPlaceholder.js +1 -1
- package/legacy/components/cell/GridActionsCell.js +3 -3
- package/legacy/components/cell/GridActionsCellItem.js +30 -17
- package/legacy/components/cell/GridEditInputCell.js +1 -1
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
- package/legacy/components/columnsManagement/GridColumnsManagement.js +38 -31
- package/legacy/components/containers/GridRootStyles.js +9 -3
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/hooks/features/columns/useGridColumnSpanning.js +3 -1
- package/legacy/hooks/features/editing/useGridCellEditing.js +2 -5
- package/legacy/hooks/features/editing/useGridRowEditing.js +2 -5
- package/legacy/hooks/features/filter/gridFilterUtils.js +2 -2
- package/legacy/hooks/features/rows/gridRowsUtils.js +1 -1
- package/legacy/hooks/features/rows/useGridParamsApi.js +14 -47
- package/legacy/hooks/features/rows/useGridRows.js +2 -2
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +9 -10
- package/legacy/index.js +1 -1
- package/legacy/internals/utils/propValidation.js +1 -1
- package/legacy/joy/joySlots.js +2 -2
- package/legacy/locales/daDK.js +12 -12
- package/legacy/locales/heIL.js +7 -8
- package/locales/daDK.js +12 -12
- package/locales/heIL.js +7 -8
- package/models/api/gridApiCommon.d.ts +1 -1
- package/models/api/gridFilterApi.d.ts +1 -1
- package/models/api/gridLocaleTextApi.d.ts +3 -3
- package/models/colDef/gridColDef.d.ts +11 -17
- package/models/colDef/index.d.ts +1 -1
- package/models/events/gridEventLookup.d.ts +1 -1
- package/models/gridSlotsComponent.d.ts +34 -36
- package/models/gridSlotsComponentsProps.d.ts +73 -54
- package/models/params/gridCellParams.d.ts +0 -26
- package/models/props/DataGridProps.d.ts +2 -2
- package/modern/DataGrid/DataGrid.js +1 -1
- package/modern/DataGrid/useDataGridComponent.js +1 -1
- package/modern/DataGrid/useDataGridProps.js +3 -1
- package/modern/colDef/gridBooleanColDef.js +3 -6
- package/modern/colDef/gridCheckboxSelectionColDef.js +4 -3
- package/modern/colDef/gridDateColDef.js +10 -16
- package/modern/colDef/gridNumericColDef.js +1 -3
- package/modern/colDef/gridSingleSelectColDef.js +7 -12
- package/modern/components/GridPagination.js +12 -2
- package/modern/components/GridRow.js +6 -5
- package/modern/components/GridScrollbarFillerCell.js +0 -3
- package/modern/components/base/GridFooterPlaceholder.js +1 -1
- package/modern/components/cell/GridActionsCell.js +3 -3
- package/modern/components/cell/GridActionsCellItem.js +27 -15
- package/modern/components/cell/GridEditInputCell.js +1 -1
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
- package/modern/components/columnsManagement/GridColumnsManagement.js +26 -21
- package/modern/components/containers/GridRootStyles.js +10 -2
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/columns/useGridColumnSpanning.js +3 -1
- package/modern/hooks/features/editing/useGridCellEditing.js +2 -5
- package/modern/hooks/features/editing/useGridRowEditing.js +2 -5
- package/modern/hooks/features/filter/gridFilterUtils.js +1 -1
- package/modern/hooks/features/rows/gridRowsUtils.js +1 -1
- package/modern/hooks/features/rows/useGridParamsApi.js +14 -47
- package/modern/hooks/features/rows/useGridRows.js +2 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +9 -10
- package/modern/index.js +1 -1
- package/modern/internals/utils/propValidation.js +1 -1
- package/modern/joy/joySlots.js +2 -2
- package/modern/locales/daDK.js +12 -12
- package/modern/locales/heIL.js +7 -8
- package/node/DataGrid/DataGrid.js +1 -1
- package/node/DataGrid/useDataGridComponent.js +1 -1
- package/node/DataGrid/useDataGridProps.js +3 -1
- package/node/colDef/gridBooleanColDef.js +3 -6
- package/node/colDef/gridCheckboxSelectionColDef.js +4 -3
- package/node/colDef/gridDateColDef.js +13 -19
- package/node/colDef/gridNumericColDef.js +1 -3
- package/node/colDef/gridSingleSelectColDef.js +7 -12
- package/node/components/GridPagination.js +12 -2
- package/node/components/GridRow.js +6 -5
- package/node/components/GridScrollbarFillerCell.js +0 -3
- package/node/components/base/GridFooterPlaceholder.js +1 -1
- package/node/components/cell/GridActionsCell.js +3 -3
- package/node/components/cell/GridActionsCellItem.js +27 -15
- package/node/components/cell/GridEditInputCell.js +1 -1
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
- package/node/components/columnsManagement/GridColumnsManagement.js +26 -21
- package/node/components/containers/GridRootStyles.js +10 -2
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
- package/node/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/columns/useGridColumnSpanning.js +3 -1
- package/node/hooks/features/editing/useGridCellEditing.js +2 -5
- package/node/hooks/features/editing/useGridRowEditing.js +2 -5
- package/node/hooks/features/filter/gridFilterUtils.js +1 -1
- package/node/hooks/features/rows/gridRowsUtils.js +2 -2
- package/node/hooks/features/rows/useGridParamsApi.js +14 -47
- package/node/hooks/features/rows/useGridRows.js +2 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +9 -10
- package/node/index.js +1 -1
- package/node/internals/utils/propValidation.js +1 -1
- package/node/joy/joySlots.js +2 -2
- package/node/locales/daDK.js +12 -12
- package/node/locales/heIL.js +7 -8
- package/package.json +5 -5
|
@@ -24,6 +24,9 @@ const GridPaginationRoot = styled(TablePagination)(({
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}));
|
|
27
|
+
|
|
28
|
+
// A mutable version of a readonly array.
|
|
29
|
+
|
|
27
30
|
export const GridPagination = /*#__PURE__*/React.forwardRef(function GridPagination(props, ref) {
|
|
28
31
|
const apiRef = useGridApiContext();
|
|
29
32
|
const rootProps = useGridRootProps();
|
|
@@ -33,7 +36,10 @@ export const GridPagination = /*#__PURE__*/React.forwardRef(function GridPaginat
|
|
|
33
36
|
var _ref, _rootProps$rowCount;
|
|
34
37
|
return (_ref = (_rootProps$rowCount = rootProps.rowCount) != null ? _rootProps$rowCount : visibleTopLevelRowCount) != null ? _ref : 0;
|
|
35
38
|
}, [rootProps.rowCount, visibleTopLevelRowCount]);
|
|
36
|
-
const lastPage = React.useMemo(() =>
|
|
39
|
+
const lastPage = React.useMemo(() => {
|
|
40
|
+
const calculatedValue = Math.ceil(rowCount / (paginationModel.pageSize || 1)) - 1;
|
|
41
|
+
return Math.max(0, calculatedValue);
|
|
42
|
+
}, [rowCount, paginationModel.pageSize]);
|
|
37
43
|
const handlePageSizeChange = React.useCallback(event => {
|
|
38
44
|
const pageSize = Number(event.target.value);
|
|
39
45
|
apiRef.current.setPageSize(pageSize);
|
|
@@ -69,7 +75,11 @@ export const GridPagination = /*#__PURE__*/React.forwardRef(function GridPaginat
|
|
|
69
75
|
ref: ref,
|
|
70
76
|
component: "div",
|
|
71
77
|
count: rowCount,
|
|
72
|
-
page: paginationModel.page <= lastPage ? paginationModel.page : lastPage
|
|
78
|
+
page: paginationModel.page <= lastPage ? paginationModel.page : lastPage
|
|
79
|
+
// TODO: Remove the cast once the type is fixed in Material UI and that the min Material UI version
|
|
80
|
+
// for x-data-grid is past the fix.
|
|
81
|
+
// Note that Material UI will not mutate the array, so this is safe.
|
|
82
|
+
,
|
|
73
83
|
rowsPerPageOptions: pageSizeOptions,
|
|
74
84
|
rowsPerPage: paginationModel.pageSize,
|
|
75
85
|
onPageChange: handlePageChange,
|
package/components/GridRow.js
CHANGED
|
@@ -37,9 +37,7 @@ const useUtilityClasses = ownerState => {
|
|
|
37
37
|
classes
|
|
38
38
|
} = ownerState;
|
|
39
39
|
const slots = {
|
|
40
|
-
root: ['row', selected && 'selected', editable && 'row--editable', editing && 'row--editing', isFirstVisible && 'row--firstVisible', isLastVisible && 'row--lastVisible', rowHeight === 'auto' && 'row--dynamicHeight']
|
|
41
|
-
pinnedLeft: ['pinnedLeft'],
|
|
42
|
-
pinnedRight: ['pinnedRight']
|
|
40
|
+
root: ['row', selected && 'selected', editable && 'row--editable', editing && 'row--editing', isFirstVisible && 'row--firstVisible', isLastVisible && 'row--lastVisible', rowHeight === 'auto' && 'row--dynamicHeight']
|
|
43
41
|
};
|
|
44
42
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
45
43
|
};
|
|
@@ -268,6 +266,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
268
266
|
break;
|
|
269
267
|
}
|
|
270
268
|
if ((rowNode == null ? void 0 : rowNode.type) === 'skeletonRow') {
|
|
269
|
+
var _column$align;
|
|
271
270
|
const {
|
|
272
271
|
width
|
|
273
272
|
} = cellColSpanInfo.cellProps;
|
|
@@ -276,7 +275,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
276
275
|
width: width,
|
|
277
276
|
contentWidth: contentWidth,
|
|
278
277
|
field: column.field,
|
|
279
|
-
align: column.align
|
|
278
|
+
align: (_column$align = column.align) != null ? _column$align : 'left'
|
|
280
279
|
}, column.field);
|
|
281
280
|
}
|
|
282
281
|
const {
|
|
@@ -364,7 +363,10 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
364
363
|
"aria-selected": selected,
|
|
365
364
|
style: style
|
|
366
365
|
}, eventHandlers, other, {
|
|
367
|
-
children: [leftCells,
|
|
366
|
+
children: [leftCells, /*#__PURE__*/_jsx("div", {
|
|
367
|
+
className: gridClasses.cellOffsetLeft,
|
|
368
|
+
role: "presentation"
|
|
369
|
+
}), cells, emptyCellWidth > 0 && /*#__PURE__*/_jsx(EmptyCell, {
|
|
368
370
|
width: emptyCellWidth
|
|
369
371
|
}), rightCells.length > 0 && /*#__PURE__*/_jsx("div", {
|
|
370
372
|
role: "presentation",
|
|
@@ -21,9 +21,6 @@ const Style = styled('div')({
|
|
|
21
21
|
[`&.${classes.pinnedRight}:not(.${classes.header})`]: {
|
|
22
22
|
position: 'sticky',
|
|
23
23
|
right: 0
|
|
24
|
-
},
|
|
25
|
-
[`&:not(.${classes.header}):not(.${classes.pinnedRight})`]: {
|
|
26
|
-
transform: 'translate3d(var(--DataGrid-offsetLeft), 0, 0)'
|
|
27
24
|
}
|
|
28
25
|
});
|
|
29
26
|
function GridScrollbarFillerCell({
|
|
@@ -8,5 +8,5 @@ export function GridFooterPlaceholder() {
|
|
|
8
8
|
if (rootProps.hideFooter) {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
|
-
return /*#__PURE__*/_jsx(rootProps.slots.footer, _extends({}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.footer));
|
|
11
|
+
return /*#__PURE__*/_jsx(rootProps.slots.footer, _extends({}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.footer /* FIXME: typing error */));
|
|
12
12
|
}
|
|
@@ -138,7 +138,7 @@ function GridActionsCell(props) {
|
|
|
138
138
|
if (event.key === 'Tab') {
|
|
139
139
|
event.preventDefault();
|
|
140
140
|
}
|
|
141
|
-
if (['Tab', '
|
|
141
|
+
if (['Tab', 'Escape'].includes(event.key)) {
|
|
142
142
|
hideMenu();
|
|
143
143
|
}
|
|
144
144
|
};
|
|
@@ -175,7 +175,6 @@ function GridActionsCell(props) {
|
|
|
175
175
|
target: buttonRef.current,
|
|
176
176
|
position: position,
|
|
177
177
|
onClose: hideMenu,
|
|
178
|
-
onClick: hideMenu,
|
|
179
178
|
children: /*#__PURE__*/_jsx(MenuList, {
|
|
180
179
|
id: menuId,
|
|
181
180
|
className: gridClasses.menuList,
|
|
@@ -184,7 +183,8 @@ function GridActionsCell(props) {
|
|
|
184
183
|
variant: "menu",
|
|
185
184
|
autoFocusItem: true,
|
|
186
185
|
children: menuButtons.map((button, index) => /*#__PURE__*/React.cloneElement(button, {
|
|
187
|
-
key: index
|
|
186
|
+
key: index,
|
|
187
|
+
closeMenu: hideMenu
|
|
188
188
|
}))
|
|
189
189
|
})
|
|
190
190
|
})]
|
|
@@ -11,6 +11,12 @@ export type GridActionsCellItemProps = {
|
|
|
11
11
|
icon: React.ReactElement;
|
|
12
12
|
} & IconButtonProps) | ({
|
|
13
13
|
showInMenu: true;
|
|
14
|
+
/**
|
|
15
|
+
* If false, the menu will not close when this item is clicked.
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
closeMenuOnClick?: boolean;
|
|
19
|
+
closeMenu?: () => void;
|
|
14
20
|
} & MenuItemProps));
|
|
15
21
|
declare const GridActionsCellItem: React.ForwardRefExoticComponent<(Omit<{
|
|
16
22
|
label: string;
|
|
@@ -31,9 +37,15 @@ declare const GridActionsCellItem: React.ForwardRefExoticComponent<(Omit<{
|
|
|
31
37
|
component?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
32
38
|
} & {
|
|
33
39
|
showInMenu: true;
|
|
40
|
+
/**
|
|
41
|
+
* If false, the menu will not close when this item is clicked.
|
|
42
|
+
* @default true
|
|
43
|
+
*/
|
|
44
|
+
closeMenuOnClick?: boolean | undefined;
|
|
45
|
+
closeMenu?: (() => void) | undefined;
|
|
34
46
|
} & import("@mui/material/MenuItem").MenuItemOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & {
|
|
35
47
|
ref?: ((instance: HTMLLIElement | null) => void) | React.RefObject<HTMLLIElement> | null | undefined;
|
|
36
48
|
}, "style" | "dense" | "disabled" | "action" | "selected" | "autoFocus" | "className" | "tabIndex" | "children" | "sx" | "classes" | "disableGutters" | "divider" | "onFocusVisible" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "TouchRippleProps" | "touchRippleRef"> & {
|
|
37
49
|
component?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
38
|
-
}, "ref">) & React.RefAttributes<
|
|
50
|
+
}, "ref">) & React.RefAttributes<HTMLElement>>;
|
|
39
51
|
export { GridActionsCellItem };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["label", "icon", "showInMenu", "onClick"]
|
|
3
|
+
const _excluded = ["label", "icon", "showInMenu", "onClick"],
|
|
4
|
+
_excluded2 = ["label", "icon", "showInMenu", "onClick", "closeMenuOnClick", "closeMenu"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import MenuItem from '@mui/material/MenuItem';
|
|
@@ -9,21 +10,18 @@ import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
12
|
const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
12
|
-
const {
|
|
13
|
-
label,
|
|
14
|
-
icon,
|
|
15
|
-
showInMenu,
|
|
16
|
-
onClick
|
|
17
|
-
} = props,
|
|
18
|
-
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
19
13
|
const rootProps = useGridRootProps();
|
|
20
|
-
|
|
21
|
-
if (onClick) {
|
|
22
|
-
onClick(event);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
if (!showInMenu) {
|
|
14
|
+
if (!props.showInMenu) {
|
|
26
15
|
var _rootProps$slotProps;
|
|
16
|
+
const {
|
|
17
|
+
label,
|
|
18
|
+
icon,
|
|
19
|
+
onClick
|
|
20
|
+
} = props,
|
|
21
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
22
|
+
const handleClick = event => {
|
|
23
|
+
onClick == null || onClick(event);
|
|
24
|
+
};
|
|
27
25
|
return /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
28
26
|
ref: ref,
|
|
29
27
|
size: "small",
|
|
@@ -37,10 +35,24 @@ const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
37
35
|
})
|
|
38
36
|
}));
|
|
39
37
|
}
|
|
38
|
+
const {
|
|
39
|
+
label,
|
|
40
|
+
icon,
|
|
41
|
+
onClick,
|
|
42
|
+
closeMenuOnClick = true,
|
|
43
|
+
closeMenu
|
|
44
|
+
} = props,
|
|
45
|
+
other = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
46
|
+
const handleClick = event => {
|
|
47
|
+
onClick == null || onClick(event);
|
|
48
|
+
if (closeMenuOnClick) {
|
|
49
|
+
closeMenu == null || closeMenu();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
40
52
|
return /*#__PURE__*/_jsxs(MenuItem, _extends({
|
|
41
53
|
ref: ref
|
|
42
54
|
}, other, {
|
|
43
|
-
onClick:
|
|
55
|
+
onClick: handleClick,
|
|
44
56
|
children: [icon && /*#__PURE__*/_jsx(ListItemIcon, {
|
|
45
57
|
children: icon
|
|
46
58
|
}), label]
|
|
@@ -57,7 +57,7 @@ const GridEditInputCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
57
57
|
const column = apiRef.current.getColumn(field);
|
|
58
58
|
let parsedValue = newValue;
|
|
59
59
|
if (column.valueParser) {
|
|
60
|
-
parsedValue = column.valueParser(newValue, apiRef.current.
|
|
60
|
+
parsedValue = column.valueParser(newValue, apiRef.current.getRow(id), column, apiRef);
|
|
61
61
|
}
|
|
62
62
|
setValueState(parsedValue);
|
|
63
63
|
apiRef.current.setEditCellValue({
|
|
@@ -86,7 +86,7 @@ const GridCellCheckboxForwardRef = /*#__PURE__*/React.forwardRef(function GridCe
|
|
|
86
86
|
},
|
|
87
87
|
onKeyDown: handleKeyDown,
|
|
88
88
|
disabled: !isSelectable,
|
|
89
|
-
touchRippleRef: rippleRef
|
|
89
|
+
touchRippleRef: rippleRef /* FIXME: typing error */
|
|
90
90
|
}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseCheckbox, other));
|
|
91
91
|
});
|
|
92
92
|
process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { GridColumnHeaderParams } from '../../models/params/gridColumnHeaderParams';
|
|
3
|
-
declare const GridHeaderCheckbox: React.ForwardRefExoticComponent<GridColumnHeaderParams<import("../../models/gridRows").GridValidRowModel, any, any> & React.RefAttributes<
|
|
3
|
+
declare const GridHeaderCheckbox: React.ForwardRefExoticComponent<GridColumnHeaderParams<import("../../models/gridRows").GridValidRowModel, any, any> & React.RefAttributes<HTMLButtonElement>>;
|
|
4
4
|
export { GridHeaderCheckbox };
|
|
@@ -20,6 +20,13 @@ export interface GridColumnsManagementProps {
|
|
|
20
20
|
* @default false
|
|
21
21
|
*/
|
|
22
22
|
disableResetButton?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Changes the behavior of the `Show/Hide All` toggle when the search field is used:
|
|
25
|
+
* - `all`: Will toggle all columns.
|
|
26
|
+
* - `filteredOnly`: Will only toggle columns that match the search criteria.
|
|
27
|
+
* @default 'all'
|
|
28
|
+
*/
|
|
29
|
+
toggleAllMode?: 'all' | 'filteredOnly';
|
|
23
30
|
/**
|
|
24
31
|
* Returns the list of togglable columns.
|
|
25
32
|
* If used, only those columns will be displayed in the panel
|
|
@@ -43,6 +43,7 @@ function GridColumnsManagement(props) {
|
|
|
43
43
|
autoFocusSearchField = true,
|
|
44
44
|
disableShowHideToggle = false,
|
|
45
45
|
disableResetButton = false,
|
|
46
|
+
toggleAllMode = 'all',
|
|
46
47
|
getTogglableColumns
|
|
47
48
|
} = props;
|
|
48
49
|
const isResetDisabled = React.useMemo(() => checkColumnVisibilityModelsSame(columnVisibilityModel, initialColumnVisibilityModel), [columnVisibilityModel, initialColumnVisibilityModel]);
|
|
@@ -62,11 +63,21 @@ function GridColumnsManagement(props) {
|
|
|
62
63
|
} = event.target;
|
|
63
64
|
apiRef.current.setColumnVisibility(field, columnVisibilityModel[field] === false);
|
|
64
65
|
};
|
|
66
|
+
const currentColumns = React.useMemo(() => {
|
|
67
|
+
const togglableColumns = getTogglableColumns ? getTogglableColumns(sortedColumns) : null;
|
|
68
|
+
const togglableSortedColumns = togglableColumns ? sortedColumns.filter(({
|
|
69
|
+
field
|
|
70
|
+
}) => togglableColumns.includes(field)) : sortedColumns;
|
|
71
|
+
if (!searchValue) {
|
|
72
|
+
return togglableSortedColumns;
|
|
73
|
+
}
|
|
74
|
+
return togglableSortedColumns.filter(column => searchPredicate(column, searchValue.toLowerCase()));
|
|
75
|
+
}, [sortedColumns, searchValue, searchPredicate, getTogglableColumns]);
|
|
65
76
|
const toggleAllColumns = React.useCallback(isVisible => {
|
|
66
77
|
const currentModel = gridColumnVisibilityModelSelector(apiRef);
|
|
67
78
|
const newModel = _extends({}, currentModel);
|
|
68
79
|
const togglableColumns = getTogglableColumns ? getTogglableColumns(columns) : null;
|
|
69
|
-
columns.forEach(col => {
|
|
80
|
+
(toggleAllMode === 'filteredOnly' ? currentColumns : columns).forEach(col => {
|
|
70
81
|
if (col.hideable && (togglableColumns == null || togglableColumns.includes(col.field))) {
|
|
71
82
|
if (isVisible) {
|
|
72
83
|
// delete the key from the model instead of setting it to `true`
|
|
@@ -77,20 +88,10 @@ function GridColumnsManagement(props) {
|
|
|
77
88
|
}
|
|
78
89
|
});
|
|
79
90
|
return apiRef.current.setColumnVisibilityModel(newModel);
|
|
80
|
-
}, [apiRef, columns, getTogglableColumns]);
|
|
91
|
+
}, [apiRef, columns, getTogglableColumns, toggleAllMode, currentColumns]);
|
|
81
92
|
const handleSearchValueChange = React.useCallback(event => {
|
|
82
93
|
setSearchValue(event.target.value);
|
|
83
94
|
}, []);
|
|
84
|
-
const currentColumns = React.useMemo(() => {
|
|
85
|
-
const togglableColumns = getTogglableColumns ? getTogglableColumns(sortedColumns) : null;
|
|
86
|
-
const togglableSortedColumns = togglableColumns ? sortedColumns.filter(({
|
|
87
|
-
field
|
|
88
|
-
}) => togglableColumns.includes(field)) : sortedColumns;
|
|
89
|
-
if (!searchValue) {
|
|
90
|
-
return togglableSortedColumns;
|
|
91
|
-
}
|
|
92
|
-
return togglableSortedColumns.filter(column => searchPredicate(column, searchValue.toLowerCase()));
|
|
93
|
-
}, [sortedColumns, searchValue, searchPredicate, getTogglableColumns]);
|
|
94
95
|
const hideableColumns = React.useMemo(() => currentColumns.filter(col => col.hideable), [currentColumns]);
|
|
95
96
|
const allHideableColumnsVisible = React.useMemo(() => hideableColumns.every(column => columnVisibilityModel[column.field] == null || columnVisibilityModel[column.field] !== false), [columnVisibilityModel, hideableColumns]);
|
|
96
97
|
const allHideableColumnsHidden = React.useMemo(() => hideableColumns.every(column => columnVisibilityModel[column.field] === false), [columnVisibilityModel, hideableColumns]);
|
|
@@ -164,14 +165,11 @@ function GridColumnsManagement(props) {
|
|
|
164
165
|
checked: allHideableColumnsVisible,
|
|
165
166
|
indeterminate: !allHideableColumnsVisible && !allHideableColumnsHidden,
|
|
166
167
|
onClick: () => toggleAllColumns(!allHideableColumnsVisible),
|
|
167
|
-
name: apiRef.current.getLocaleText('columnsManagementShowHideAllText')
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
[`.MuiFormControlLabel-label`]: {
|
|
171
|
-
textTransform: 'uppercase',
|
|
172
|
-
fontSize: '14px'
|
|
168
|
+
name: apiRef.current.getLocaleText('columnsManagementShowHideAllText'),
|
|
169
|
+
sx: {
|
|
170
|
+
p: 0.5
|
|
173
171
|
}
|
|
174
|
-
},
|
|
172
|
+
}, (_rootProps$slotProps3 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps3.baseCheckbox)),
|
|
175
173
|
label: apiRef.current.getLocaleText('columnsManagementShowHideAllText')
|
|
176
174
|
}) : /*#__PURE__*/_jsx("span", {}), !disableResetButton ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
177
175
|
onClick: () => apiRef.current.setColumnVisibilityModel(initialColumnVisibilityModel),
|
|
@@ -213,7 +211,14 @@ process.env.NODE_ENV !== "production" ? GridColumnsManagement.propTypes = {
|
|
|
213
211
|
*/
|
|
214
212
|
getTogglableColumns: PropTypes.func,
|
|
215
213
|
searchPredicate: PropTypes.func,
|
|
216
|
-
sort: PropTypes.oneOf(['asc', 'desc'])
|
|
214
|
+
sort: PropTypes.oneOf(['asc', 'desc']),
|
|
215
|
+
/**
|
|
216
|
+
* Changes the behavior of the `Show/Hide All` toggle when the search field is used:
|
|
217
|
+
* - `all`: Will toggle all columns.
|
|
218
|
+
* - `filteredOnly`: Will only toggle columns that match the search criteria.
|
|
219
|
+
* @default 'all'
|
|
220
|
+
*/
|
|
221
|
+
toggleAllMode: PropTypes.oneOf(['all', 'filteredOnly'])
|
|
217
222
|
} : void 0;
|
|
218
223
|
const GridColumnsManagementBody = styled('div', {
|
|
219
224
|
name: 'MuiDataGrid',
|
|
@@ -246,7 +251,7 @@ const GridColumnsManagementFooter = styled('div', {
|
|
|
246
251
|
})(({
|
|
247
252
|
theme
|
|
248
253
|
}) => ({
|
|
249
|
-
padding: theme.spacing(0.5, 1, 0.5,
|
|
254
|
+
padding: theme.spacing(0.5, 1, 0.5, 3),
|
|
250
255
|
display: 'flex',
|
|
251
256
|
justifyContent: 'space-between',
|
|
252
257
|
borderTop: `1px solid ${theme.palette.divider}`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { GridColumnVisibilityModel } from '../../hooks/features/columns/gridColumnsInterfaces';
|
|
2
|
-
import { GridColumnsManagementProps } from './GridColumnsManagement';
|
|
2
|
+
import type { GridColumnsManagementProps } from './GridColumnsManagement';
|
|
3
3
|
export declare const checkColumnVisibilityModelsSame: (a: GridColumnVisibilityModel, b: GridColumnVisibilityModel) => boolean;
|
|
4
4
|
export declare const defaultSearchPredicate: NonNullable<GridColumnsManagementProps['searchPredicate']>;
|
|
@@ -240,6 +240,12 @@ export const GridRootStyles = styled('div', {
|
|
|
240
240
|
[`& .${c.cell} > *`]: {
|
|
241
241
|
overflow: 'visible !important',
|
|
242
242
|
whiteSpace: 'nowrap'
|
|
243
|
+
},
|
|
244
|
+
[`& .${c.groupingCriteriaCell}`]: {
|
|
245
|
+
width: 'unset'
|
|
246
|
+
},
|
|
247
|
+
[`& .${c.treeDataGroupingCell}`]: {
|
|
248
|
+
width: 'unset'
|
|
243
249
|
}
|
|
244
250
|
},
|
|
245
251
|
[`& .${c.columnHeader}, & .${c.cell}`]: {
|
|
@@ -554,8 +560,10 @@ export const GridRootStyles = styled('div', {
|
|
|
554
560
|
}
|
|
555
561
|
}
|
|
556
562
|
},
|
|
557
|
-
[`& .${c.
|
|
558
|
-
|
|
563
|
+
[`& .${c.cellOffsetLeft}`]: {
|
|
564
|
+
flex: '0 0 auto',
|
|
565
|
+
display: 'inline-block',
|
|
566
|
+
width: 'var(--DataGrid-offsetLeft)'
|
|
559
567
|
},
|
|
560
568
|
[`& .${c.columnHeaderDraggableContainer}`]: {
|
|
561
569
|
display: 'flex',
|
|
@@ -67,7 +67,7 @@ function GridFilterInputBoolean(props) {
|
|
|
67
67
|
ref: focusElementRef,
|
|
68
68
|
tabIndex
|
|
69
69
|
}
|
|
70
|
-
}, others
|
|
70
|
+
}, others /* FIXME: typing error */, baseSelectProps, {
|
|
71
71
|
children: [/*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
72
72
|
native: isSelectNative,
|
|
73
73
|
value: "",
|
|
@@ -107,7 +107,7 @@ function GridFilterInputSingleSelect(props) {
|
|
|
107
107
|
placeholder: placeholder != null ? placeholder : apiRef.current.getLocaleText('filterPanelInputPlaceholder')
|
|
108
108
|
},
|
|
109
109
|
native: isSelectNative
|
|
110
|
-
}, others
|
|
110
|
+
}, others /* FIXME: typing error */, (_rootProps$slotProps3 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps3.baseSelect, {
|
|
111
111
|
children: renderSingleSelectOptions({
|
|
112
112
|
column: resolvedColumn,
|
|
113
113
|
OptionComponent: rootProps.slots.baseSelectOption,
|
|
@@ -134,7 +134,7 @@ const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(p
|
|
|
134
134
|
}
|
|
135
135
|
return apiRef.current.setFilterModel(_extends({}, filterModel, {
|
|
136
136
|
items: readOnlyFilters
|
|
137
|
-
}));
|
|
137
|
+
}), 'removeAllFilterItems');
|
|
138
138
|
}, [apiRef, readOnlyFilters, filterModel, validFilters]);
|
|
139
139
|
React.useEffect(() => {
|
|
140
140
|
if (logicOperators.length > 0 && filterModel.logicOperator && !logicOperators.includes(filterModel.logicOperator)) {
|
|
@@ -107,6 +107,11 @@ export interface GridClasses {
|
|
|
107
107
|
* Styles applied to the skeleton cell element.
|
|
108
108
|
*/
|
|
109
109
|
cellSkeleton: string;
|
|
110
|
+
/**
|
|
111
|
+
* @ignore - do not document.
|
|
112
|
+
* Styles applied to the left offset cell element.
|
|
113
|
+
*/
|
|
114
|
+
cellOffsetLeft: string;
|
|
110
115
|
/**
|
|
111
116
|
* Styles applied to the selection checkbox element.
|
|
112
117
|
*/
|
package/constants/gridClasses.js
CHANGED
|
@@ -2,4 +2,4 @@ import { unstable_generateUtilityClasses as generateUtilityClasses, unstable_gen
|
|
|
2
2
|
export function getDataGridUtilityClass(slot) {
|
|
3
3
|
return generateUtilityClass('MuiDataGrid', slot);
|
|
4
4
|
}
|
|
5
|
-
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellContent', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnGroupHeader', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeader--showColumnBorder', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementFooter', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
5
|
+
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellContent', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnGroupHeader', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeader--showColumnBorder', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementFooter', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
@@ -60,7 +60,9 @@ function calculateCellColSpan(params) {
|
|
|
60
60
|
} = params;
|
|
61
61
|
const columnsLength = columns.length;
|
|
62
62
|
const column = columns[columnIndex];
|
|
63
|
-
const
|
|
63
|
+
const row = apiRef.current.getRow(rowId);
|
|
64
|
+
const value = apiRef.current.getRowValue(row, column);
|
|
65
|
+
const colSpan = typeof column.colSpan === 'function' ? column.colSpan(value, row, column, apiRef) : column.colSpan;
|
|
64
66
|
if (!colSpan || colSpan === 1) {
|
|
65
67
|
setCellColSpanInfo(lookup, rowId, columnIndex, {
|
|
66
68
|
spannedByColSpan: false,
|
|
@@ -335,7 +335,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
335
335
|
const row = apiRef.current.getRow(id);
|
|
336
336
|
let parsedValue = value;
|
|
337
337
|
if (column.valueParser && !skipValueParser) {
|
|
338
|
-
parsedValue = column.valueParser(value,
|
|
338
|
+
parsedValue = column.valueParser(value, row, column, apiRef);
|
|
339
339
|
}
|
|
340
340
|
let editingState = gridEditRowsStateSelector(apiRef.current.state);
|
|
341
341
|
let newProps = _extends({}, editingState[id][field], {
|
|
@@ -383,10 +383,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
383
383
|
const {
|
|
384
384
|
value
|
|
385
385
|
} = editingState[id][field];
|
|
386
|
-
return column.valueSetter ? column.valueSetter({
|
|
387
|
-
value,
|
|
388
|
-
row
|
|
389
|
-
}) : _extends({}, row, {
|
|
386
|
+
return column.valueSetter ? column.valueSetter(value, row, column, apiRef) : _extends({}, row, {
|
|
390
387
|
[field]: value
|
|
391
388
|
});
|
|
392
389
|
}, [apiRef]);
|
|
@@ -410,7 +410,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
410
410
|
const row = apiRef.current.getRow(id);
|
|
411
411
|
let parsedValue = value;
|
|
412
412
|
if (column.valueParser && !skipValueParser) {
|
|
413
|
-
parsedValue = column.valueParser(value,
|
|
413
|
+
parsedValue = column.valueParser(value, row, column, apiRef);
|
|
414
414
|
}
|
|
415
415
|
let editingState = gridEditRowsStateSelector(apiRef.current.state);
|
|
416
416
|
let newProps = _extends({}, editingState[id][field], {
|
|
@@ -510,10 +510,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
510
510
|
Object.entries(editingState[id]).forEach(([field, fieldProps]) => {
|
|
511
511
|
const column = apiRef.current.getColumn(field);
|
|
512
512
|
if (column.valueSetter) {
|
|
513
|
-
rowUpdate = column.valueSetter(
|
|
514
|
-
value: fieldProps.value,
|
|
515
|
-
row: rowUpdate
|
|
516
|
-
});
|
|
513
|
+
rowUpdate = column.valueSetter(fieldProps.value, rowUpdate, column, apiRef);
|
|
517
514
|
} else {
|
|
518
515
|
rowUpdate[field] = fieldProps.value;
|
|
519
516
|
}
|
|
@@ -89,7 +89,7 @@ const getFilterCallbackFromItem = (filterItem, apiRef) => {
|
|
|
89
89
|
if (column.valueParser) {
|
|
90
90
|
var _filterItem$value;
|
|
91
91
|
const parser = column.valueParser;
|
|
92
|
-
parsedValue = Array.isArray(filterItem.value) ? (_filterItem$value = filterItem.value) == null ? void 0 : _filterItem$value.map(x => parser(x)) : parser(filterItem.value);
|
|
92
|
+
parsedValue = Array.isArray(filterItem.value) ? (_filterItem$value = filterItem.value) == null ? void 0 : _filterItem$value.map(x => parser(x, undefined, column, apiRef)) : parser(filterItem.value, undefined, column, apiRef);
|
|
93
93
|
} else {
|
|
94
94
|
parsedValue = filterItem.value;
|
|
95
95
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { gridPinnedRowsSelector } from './gridRowsSelector';
|
|
3
|
-
import { gridDimensionsSelector } from '../dimensions';
|
|
3
|
+
import { gridDimensionsSelector } from '../dimensions/gridDimensionsSelectors';
|
|
4
4
|
export const GRID_ROOT_GROUP_ID = `auto-generated-group-node-root`;
|
|
5
5
|
export const GRID_ID_AUTOGENERATED = Symbol('mui.id_autogenerated');
|
|
6
6
|
export const buildRootGroup = () => ({
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
3
|
-
import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
4
3
|
export declare class MissingRowIdError extends Error {
|
|
5
4
|
}
|
|
6
5
|
/**
|
|
@@ -11,4 +10,4 @@ export declare class MissingRowIdError extends Error {
|
|
|
11
10
|
* TODO: Impossible priority - useGridEditing also needs to be after useGridParamsApi
|
|
12
11
|
* TODO: Impossible priority - useGridFocus also needs to be after useGridParamsApi
|
|
13
12
|
*/
|
|
14
|
-
export declare function useGridParamsApi(apiRef: React.MutableRefObject<GridPrivateApiCommunity
|
|
13
|
+
export declare function useGridParamsApi(apiRef: React.MutableRefObject<GridPrivateApiCommunity>): void;
|