@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
|
@@ -305,7 +305,7 @@ DataGridRaw.propTypes = {
|
|
|
305
305
|
loading: PropTypes.bool,
|
|
306
306
|
/**
|
|
307
307
|
* Set the locale text of the Data Grid.
|
|
308
|
-
* You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/HEAD/packages/
|
|
308
|
+
* You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/HEAD/packages/x-data-grid/src/constants/localeTextConstants.ts) in the GitHub repository.
|
|
309
309
|
*/
|
|
310
310
|
localeText: PropTypes.object,
|
|
311
311
|
/**
|
|
@@ -57,7 +57,7 @@ export const useDataGridComponent = (inputApiRef, props) => {
|
|
|
57
57
|
useGridRowSelection(apiRef, props);
|
|
58
58
|
useGridColumns(apiRef, props);
|
|
59
59
|
useGridRows(apiRef, props);
|
|
60
|
-
useGridParamsApi(apiRef
|
|
60
|
+
useGridParamsApi(apiRef);
|
|
61
61
|
useGridColumnSpanning(apiRef);
|
|
62
62
|
useGridColumnGrouping(apiRef, props);
|
|
63
63
|
useGridEditing(apiRef, props);
|
|
@@ -74,7 +74,9 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
74
74
|
};
|
|
75
75
|
const defaultSlots = DATA_GRID_DEFAULT_SLOTS_COMPONENTS;
|
|
76
76
|
export const useDataGridProps = inProps => {
|
|
77
|
-
const themedProps = useProps(
|
|
77
|
+
const themedProps = useProps(
|
|
78
|
+
// eslint-disable-next-line material-ui/mui-name-matches-component-name
|
|
79
|
+
useThemeProps({
|
|
78
80
|
props: inProps,
|
|
79
81
|
name: 'MuiDataGrid'
|
|
80
82
|
}));
|
|
@@ -4,12 +4,9 @@ import { renderBooleanCell } from '../components/cell/GridBooleanCell';
|
|
|
4
4
|
import { renderEditBooleanCell } from '../components/cell/GridEditBooleanCell';
|
|
5
5
|
import { gridNumberComparator } from '../hooks/features/sorting/gridSortingUtils';
|
|
6
6
|
import { getGridBooleanOperators } from './gridBooleanOperators';
|
|
7
|
-
|
|
8
|
-
value
|
|
9
|
-
|
|
10
|
-
}) {
|
|
11
|
-
return value ? api.getLocaleText('booleanCellTrueLabel') : api.getLocaleText('booleanCellFalseLabel');
|
|
12
|
-
}
|
|
7
|
+
const gridBooleanFormatter = (value, row, column, apiRef) => {
|
|
8
|
+
return value ? apiRef.current.getLocaleText('booleanCellTrueLabel') : apiRef.current.getLocaleText('booleanCellFalseLabel');
|
|
9
|
+
};
|
|
13
10
|
const stringToBoolean = value => {
|
|
14
11
|
switch (value.toLowerCase().trim()) {
|
|
15
12
|
case 'true':
|
|
@@ -19,9 +19,10 @@ export const GRID_CHECKBOX_SELECTION_COL_DEF = _extends({}, GRID_BOOLEAN_COL_DEF
|
|
|
19
19
|
disableReorder: true,
|
|
20
20
|
disableExport: true,
|
|
21
21
|
getApplyQuickFilterFn: undefined,
|
|
22
|
-
valueGetter:
|
|
23
|
-
const selectionLookup = selectedIdsLookupSelector(
|
|
24
|
-
|
|
22
|
+
valueGetter: (value, row, column, apiRef) => {
|
|
23
|
+
const selectionLookup = selectedIdsLookupSelector(apiRef);
|
|
24
|
+
const rowId = apiRef.current.getRowId(row);
|
|
25
|
+
return selectionLookup[rowId] !== undefined;
|
|
25
26
|
},
|
|
26
27
|
renderHeader: params => /*#__PURE__*/_jsx(GridHeaderCheckbox, _extends({}, params)),
|
|
27
28
|
renderCell: params => /*#__PURE__*/_jsx(GridCellCheckboxRenderer, _extends({}, params))
|
|
@@ -13,38 +13,32 @@ function throwIfNotDateObject({
|
|
|
13
13
|
throw new Error([`MUI X: \`${columnType}\` column type only accepts \`Date\` objects as values.`, 'Use `valueGetter` to transform the value into a `Date` object.', `Row ID: ${rowId}, field: "${field}".`].join('\n'));
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
export
|
|
17
|
-
value,
|
|
18
|
-
field,
|
|
19
|
-
id
|
|
20
|
-
}) {
|
|
16
|
+
export const gridDateFormatter = (value, row, column, apiRef) => {
|
|
21
17
|
if (!value) {
|
|
22
18
|
return '';
|
|
23
19
|
}
|
|
20
|
+
const rowId = apiRef.current.getRowId(row);
|
|
24
21
|
throwIfNotDateObject({
|
|
25
22
|
value,
|
|
26
23
|
columnType: 'date',
|
|
27
|
-
rowId
|
|
28
|
-
field
|
|
24
|
+
rowId,
|
|
25
|
+
field: column.field
|
|
29
26
|
});
|
|
30
27
|
return value.toLocaleDateString();
|
|
31
|
-
}
|
|
32
|
-
export
|
|
33
|
-
value,
|
|
34
|
-
field,
|
|
35
|
-
id
|
|
36
|
-
}) {
|
|
28
|
+
};
|
|
29
|
+
export const gridDateTimeFormatter = (value, row, column, apiRef) => {
|
|
37
30
|
if (!value) {
|
|
38
31
|
return '';
|
|
39
32
|
}
|
|
33
|
+
const rowId = apiRef.current.getRowId(row);
|
|
40
34
|
throwIfNotDateObject({
|
|
41
35
|
value,
|
|
42
36
|
columnType: 'dateTime',
|
|
43
|
-
rowId
|
|
44
|
-
field
|
|
37
|
+
rowId,
|
|
38
|
+
field: column.field
|
|
45
39
|
});
|
|
46
40
|
return value.toLocaleString();
|
|
47
|
-
}
|
|
41
|
+
};
|
|
48
42
|
export const GRID_DATE_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
49
43
|
type: 'date',
|
|
50
44
|
sortComparator: gridDateComparator,
|
|
@@ -9,9 +9,7 @@ export const GRID_NUMERIC_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
9
9
|
headerAlign: 'right',
|
|
10
10
|
sortComparator: gridNumberComparator,
|
|
11
11
|
valueParser: value => value === '' ? null : Number(value),
|
|
12
|
-
valueFormatter: (
|
|
13
|
-
value
|
|
14
|
-
}) => isNumber(value) ? value.toLocaleString() : value || '',
|
|
12
|
+
valueFormatter: value => isNumber(value) ? value.toLocaleString() : value || '',
|
|
15
13
|
filterOperators: getGridNumericOperators(),
|
|
16
14
|
getApplyQuickFilterFn: getGridNumericQuickFilterFn
|
|
17
15
|
});
|
|
@@ -17,20 +17,15 @@ export const GRID_SINGLE_SELECT_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
17
17
|
type: 'singleSelect',
|
|
18
18
|
getOptionLabel: defaultGetOptionLabel,
|
|
19
19
|
getOptionValue: defaultGetOptionValue,
|
|
20
|
-
valueFormatter(
|
|
21
|
-
const {
|
|
22
|
-
|
|
23
|
-
field,
|
|
24
|
-
value,
|
|
25
|
-
api
|
|
26
|
-
} = params;
|
|
27
|
-
const colDef = params.api.getColumn(field);
|
|
20
|
+
valueFormatter(value, row, colDef, apiRef) {
|
|
21
|
+
// const { id, field, value, api } = params;
|
|
22
|
+
const rowId = apiRef.current.getRowId(row);
|
|
28
23
|
if (!isSingleSelectColDef(colDef)) {
|
|
29
24
|
return '';
|
|
30
25
|
}
|
|
31
26
|
const valueOptions = getValueOptions(colDef, {
|
|
32
|
-
id,
|
|
33
|
-
row
|
|
27
|
+
id: rowId,
|
|
28
|
+
row
|
|
34
29
|
});
|
|
35
30
|
if (value == null) {
|
|
36
31
|
return '';
|
|
@@ -47,8 +42,8 @@ export const GRID_SINGLE_SELECT_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
47
42
|
renderEditCell: renderEditSingleSelectCell,
|
|
48
43
|
filterOperators: getGridSingleSelectOperators(),
|
|
49
44
|
// @ts-ignore
|
|
50
|
-
pastedValueParser: (value,
|
|
51
|
-
const colDef =
|
|
45
|
+
pastedValueParser: (value, row, column) => {
|
|
46
|
+
const colDef = column;
|
|
52
47
|
const valueOptions = getValueOptions(colDef) || [];
|
|
53
48
|
const getOptionValue = colDef.getOptionValue;
|
|
54
49
|
const valueOption = valueOptions.find(option => {
|
|
@@ -24,13 +24,19 @@ 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();
|
|
30
33
|
const paginationModel = useGridSelector(apiRef, gridPaginationModelSelector);
|
|
31
34
|
const visibleTopLevelRowCount = useGridSelector(apiRef, gridFilteredTopLevelRowCountSelector);
|
|
32
35
|
const rowCount = React.useMemo(() => rootProps.rowCount ?? visibleTopLevelRowCount ?? 0, [rootProps.rowCount, visibleTopLevelRowCount]);
|
|
33
|
-
const lastPage = React.useMemo(() =>
|
|
36
|
+
const lastPage = React.useMemo(() => {
|
|
37
|
+
const calculatedValue = Math.ceil(rowCount / (paginationModel.pageSize || 1)) - 1;
|
|
38
|
+
return Math.max(0, calculatedValue);
|
|
39
|
+
}, [rowCount, paginationModel.pageSize]);
|
|
34
40
|
const handlePageSizeChange = React.useCallback(event => {
|
|
35
41
|
const pageSize = Number(event.target.value);
|
|
36
42
|
apiRef.current.setPageSize(pageSize);
|
|
@@ -65,7 +71,11 @@ export const GridPagination = /*#__PURE__*/React.forwardRef(function GridPaginat
|
|
|
65
71
|
ref: ref,
|
|
66
72
|
component: "div",
|
|
67
73
|
count: rowCount,
|
|
68
|
-
page: paginationModel.page <= lastPage ? paginationModel.page : lastPage
|
|
74
|
+
page: paginationModel.page <= lastPage ? paginationModel.page : lastPage
|
|
75
|
+
// TODO: Remove the cast once the type is fixed in Material UI and that the min Material UI version
|
|
76
|
+
// for x-data-grid is past the fix.
|
|
77
|
+
// Note that Material UI will not mutate the array, so this is safe.
|
|
78
|
+
,
|
|
69
79
|
rowsPerPageOptions: pageSizeOptions,
|
|
70
80
|
rowsPerPage: paginationModel.pageSize,
|
|
71
81
|
onPageChange: handlePageChange,
|
|
@@ -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
|
};
|
|
@@ -273,7 +271,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
273
271
|
width: width,
|
|
274
272
|
contentWidth: contentWidth,
|
|
275
273
|
field: column.field,
|
|
276
|
-
align: column.align
|
|
274
|
+
align: column.align ?? 'left'
|
|
277
275
|
}, column.field);
|
|
278
276
|
}
|
|
279
277
|
const {
|
|
@@ -361,7 +359,10 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
361
359
|
"aria-selected": selected,
|
|
362
360
|
style: style
|
|
363
361
|
}, eventHandlers, other, {
|
|
364
|
-
children: [leftCells,
|
|
362
|
+
children: [leftCells, /*#__PURE__*/_jsx("div", {
|
|
363
|
+
className: gridClasses.cellOffsetLeft,
|
|
364
|
+
role: "presentation"
|
|
365
|
+
}), cells, emptyCellWidth > 0 && /*#__PURE__*/_jsx(EmptyCell, {
|
|
365
366
|
width: emptyCellWidth
|
|
366
367
|
}), rightCells.length > 0 && /*#__PURE__*/_jsx("div", {
|
|
367
368
|
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({
|
|
@@ -7,5 +7,5 @@ export function GridFooterPlaceholder() {
|
|
|
7
7
|
if (rootProps.hideFooter) {
|
|
8
8
|
return null;
|
|
9
9
|
}
|
|
10
|
-
return /*#__PURE__*/_jsx(rootProps.slots.footer, _extends({}, rootProps.slotProps?.footer));
|
|
10
|
+
return /*#__PURE__*/_jsx(rootProps.slots.footer, _extends({}, rootProps.slotProps?.footer /* FIXME: typing error */));
|
|
11
11
|
}
|
|
@@ -136,7 +136,7 @@ function GridActionsCell(props) {
|
|
|
136
136
|
if (event.key === 'Tab') {
|
|
137
137
|
event.preventDefault();
|
|
138
138
|
}
|
|
139
|
-
if (['Tab', '
|
|
139
|
+
if (['Tab', 'Escape'].includes(event.key)) {
|
|
140
140
|
hideMenu();
|
|
141
141
|
}
|
|
142
142
|
};
|
|
@@ -173,7 +173,6 @@ function GridActionsCell(props) {
|
|
|
173
173
|
target: buttonRef.current,
|
|
174
174
|
position: position,
|
|
175
175
|
onClose: hideMenu,
|
|
176
|
-
onClick: hideMenu,
|
|
177
176
|
children: /*#__PURE__*/_jsx(MenuList, {
|
|
178
177
|
id: menuId,
|
|
179
178
|
className: gridClasses.menuList,
|
|
@@ -182,7 +181,8 @@ function GridActionsCell(props) {
|
|
|
182
181
|
variant: "menu",
|
|
183
182
|
autoFocusItem: true,
|
|
184
183
|
children: menuButtons.map((button, index) => /*#__PURE__*/React.cloneElement(button, {
|
|
185
|
-
key: index
|
|
184
|
+
key: index,
|
|
185
|
+
closeMenu: hideMenu
|
|
186
186
|
}))
|
|
187
187
|
})
|
|
188
188
|
})]
|
|
@@ -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,20 +10,17 @@ 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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
if (!props.showInMenu) {
|
|
15
|
+
const {
|
|
16
|
+
label,
|
|
17
|
+
icon,
|
|
18
|
+
onClick
|
|
19
|
+
} = props,
|
|
20
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
21
|
+
const handleClick = event => {
|
|
22
|
+
onClick?.(event);
|
|
23
|
+
};
|
|
26
24
|
return /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
27
25
|
ref: ref,
|
|
28
26
|
size: "small",
|
|
@@ -36,10 +34,24 @@ const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
36
34
|
})
|
|
37
35
|
}));
|
|
38
36
|
}
|
|
37
|
+
const {
|
|
38
|
+
label,
|
|
39
|
+
icon,
|
|
40
|
+
onClick,
|
|
41
|
+
closeMenuOnClick = true,
|
|
42
|
+
closeMenu
|
|
43
|
+
} = props,
|
|
44
|
+
other = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
45
|
+
const handleClick = event => {
|
|
46
|
+
onClick?.(event);
|
|
47
|
+
if (closeMenuOnClick) {
|
|
48
|
+
closeMenu?.();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
39
51
|
return /*#__PURE__*/_jsxs(MenuItem, _extends({
|
|
40
52
|
ref: ref
|
|
41
53
|
}, other, {
|
|
42
|
-
onClick:
|
|
54
|
+
onClick: handleClick,
|
|
43
55
|
children: [icon && /*#__PURE__*/_jsx(ListItemIcon, {
|
|
44
56
|
children: icon
|
|
45
57
|
}), 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({
|
|
@@ -84,7 +84,7 @@ const GridCellCheckboxForwardRef = /*#__PURE__*/React.forwardRef(function GridCe
|
|
|
84
84
|
},
|
|
85
85
|
onKeyDown: handleKeyDown,
|
|
86
86
|
disabled: !isSelectable,
|
|
87
|
-
touchRippleRef: rippleRef
|
|
87
|
+
touchRippleRef: rippleRef /* FIXME: typing error */
|
|
88
88
|
}, rootProps.slotProps?.baseCheckbox, other));
|
|
89
89
|
});
|
|
90
90
|
process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
|
|
@@ -42,6 +42,7 @@ function GridColumnsManagement(props) {
|
|
|
42
42
|
autoFocusSearchField = true,
|
|
43
43
|
disableShowHideToggle = false,
|
|
44
44
|
disableResetButton = false,
|
|
45
|
+
toggleAllMode = 'all',
|
|
45
46
|
getTogglableColumns
|
|
46
47
|
} = props;
|
|
47
48
|
const isResetDisabled = React.useMemo(() => checkColumnVisibilityModelsSame(columnVisibilityModel, initialColumnVisibilityModel), [columnVisibilityModel, initialColumnVisibilityModel]);
|
|
@@ -61,11 +62,21 @@ function GridColumnsManagement(props) {
|
|
|
61
62
|
} = event.target;
|
|
62
63
|
apiRef.current.setColumnVisibility(field, columnVisibilityModel[field] === false);
|
|
63
64
|
};
|
|
65
|
+
const currentColumns = React.useMemo(() => {
|
|
66
|
+
const togglableColumns = getTogglableColumns ? getTogglableColumns(sortedColumns) : null;
|
|
67
|
+
const togglableSortedColumns = togglableColumns ? sortedColumns.filter(({
|
|
68
|
+
field
|
|
69
|
+
}) => togglableColumns.includes(field)) : sortedColumns;
|
|
70
|
+
if (!searchValue) {
|
|
71
|
+
return togglableSortedColumns;
|
|
72
|
+
}
|
|
73
|
+
return togglableSortedColumns.filter(column => searchPredicate(column, searchValue.toLowerCase()));
|
|
74
|
+
}, [sortedColumns, searchValue, searchPredicate, getTogglableColumns]);
|
|
64
75
|
const toggleAllColumns = React.useCallback(isVisible => {
|
|
65
76
|
const currentModel = gridColumnVisibilityModelSelector(apiRef);
|
|
66
77
|
const newModel = _extends({}, currentModel);
|
|
67
78
|
const togglableColumns = getTogglableColumns ? getTogglableColumns(columns) : null;
|
|
68
|
-
columns.forEach(col => {
|
|
79
|
+
(toggleAllMode === 'filteredOnly' ? currentColumns : columns).forEach(col => {
|
|
69
80
|
if (col.hideable && (togglableColumns == null || togglableColumns.includes(col.field))) {
|
|
70
81
|
if (isVisible) {
|
|
71
82
|
// delete the key from the model instead of setting it to `true`
|
|
@@ -76,20 +87,10 @@ function GridColumnsManagement(props) {
|
|
|
76
87
|
}
|
|
77
88
|
});
|
|
78
89
|
return apiRef.current.setColumnVisibilityModel(newModel);
|
|
79
|
-
}, [apiRef, columns, getTogglableColumns]);
|
|
90
|
+
}, [apiRef, columns, getTogglableColumns, toggleAllMode, currentColumns]);
|
|
80
91
|
const handleSearchValueChange = React.useCallback(event => {
|
|
81
92
|
setSearchValue(event.target.value);
|
|
82
93
|
}, []);
|
|
83
|
-
const currentColumns = React.useMemo(() => {
|
|
84
|
-
const togglableColumns = getTogglableColumns ? getTogglableColumns(sortedColumns) : null;
|
|
85
|
-
const togglableSortedColumns = togglableColumns ? sortedColumns.filter(({
|
|
86
|
-
field
|
|
87
|
-
}) => togglableColumns.includes(field)) : sortedColumns;
|
|
88
|
-
if (!searchValue) {
|
|
89
|
-
return togglableSortedColumns;
|
|
90
|
-
}
|
|
91
|
-
return togglableSortedColumns.filter(column => searchPredicate(column, searchValue.toLowerCase()));
|
|
92
|
-
}, [sortedColumns, searchValue, searchPredicate, getTogglableColumns]);
|
|
93
94
|
const hideableColumns = React.useMemo(() => currentColumns.filter(col => col.hideable), [currentColumns]);
|
|
94
95
|
const allHideableColumnsVisible = React.useMemo(() => hideableColumns.every(column => columnVisibilityModel[column.field] == null || columnVisibilityModel[column.field] !== false), [columnVisibilityModel, hideableColumns]);
|
|
95
96
|
const allHideableColumnsHidden = React.useMemo(() => hideableColumns.every(column => columnVisibilityModel[column.field] === false), [columnVisibilityModel, hideableColumns]);
|
|
@@ -160,14 +161,11 @@ function GridColumnsManagement(props) {
|
|
|
160
161
|
checked: allHideableColumnsVisible,
|
|
161
162
|
indeterminate: !allHideableColumnsVisible && !allHideableColumnsHidden,
|
|
162
163
|
onClick: () => toggleAllColumns(!allHideableColumnsVisible),
|
|
163
|
-
name: apiRef.current.getLocaleText('columnsManagementShowHideAllText')
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
[`.MuiFormControlLabel-label`]: {
|
|
167
|
-
textTransform: 'uppercase',
|
|
168
|
-
fontSize: '14px'
|
|
164
|
+
name: apiRef.current.getLocaleText('columnsManagementShowHideAllText'),
|
|
165
|
+
sx: {
|
|
166
|
+
p: 0.5
|
|
169
167
|
}
|
|
170
|
-
},
|
|
168
|
+
}, rootProps.slotProps?.baseCheckbox)),
|
|
171
169
|
label: apiRef.current.getLocaleText('columnsManagementShowHideAllText')
|
|
172
170
|
}) : /*#__PURE__*/_jsx("span", {}), !disableResetButton ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
173
171
|
onClick: () => apiRef.current.setColumnVisibilityModel(initialColumnVisibilityModel),
|
|
@@ -209,7 +207,14 @@ process.env.NODE_ENV !== "production" ? GridColumnsManagement.propTypes = {
|
|
|
209
207
|
*/
|
|
210
208
|
getTogglableColumns: PropTypes.func,
|
|
211
209
|
searchPredicate: PropTypes.func,
|
|
212
|
-
sort: PropTypes.oneOf(['asc', 'desc'])
|
|
210
|
+
sort: PropTypes.oneOf(['asc', 'desc']),
|
|
211
|
+
/**
|
|
212
|
+
* Changes the behavior of the `Show/Hide All` toggle when the search field is used:
|
|
213
|
+
* - `all`: Will toggle all columns.
|
|
214
|
+
* - `filteredOnly`: Will only toggle columns that match the search criteria.
|
|
215
|
+
* @default 'all'
|
|
216
|
+
*/
|
|
217
|
+
toggleAllMode: PropTypes.oneOf(['all', 'filteredOnly'])
|
|
213
218
|
} : void 0;
|
|
214
219
|
const GridColumnsManagementBody = styled('div', {
|
|
215
220
|
name: 'MuiDataGrid',
|
|
@@ -242,7 +247,7 @@ const GridColumnsManagementFooter = styled('div', {
|
|
|
242
247
|
})(({
|
|
243
248
|
theme
|
|
244
249
|
}) => ({
|
|
245
|
-
padding: theme.spacing(0.5, 1, 0.5,
|
|
250
|
+
padding: theme.spacing(0.5, 1, 0.5, 3),
|
|
246
251
|
display: 'flex',
|
|
247
252
|
justifyContent: 'space-between',
|
|
248
253
|
borderTop: `1px solid ${theme.palette.divider}`
|
|
@@ -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',
|
|
@@ -66,7 +66,7 @@ function GridFilterInputBoolean(props) {
|
|
|
66
66
|
ref: focusElementRef,
|
|
67
67
|
tabIndex
|
|
68
68
|
}
|
|
69
|
-
}, others
|
|
69
|
+
}, others /* FIXME: typing error */, baseSelectProps, {
|
|
70
70
|
children: [/*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
71
71
|
native: isSelectNative,
|
|
72
72
|
value: "",
|
|
@@ -106,7 +106,7 @@ function GridFilterInputSingleSelect(props) {
|
|
|
106
106
|
placeholder: placeholder ?? apiRef.current.getLocaleText('filterPanelInputPlaceholder')
|
|
107
107
|
},
|
|
108
108
|
native: isSelectNative
|
|
109
|
-
}, others
|
|
109
|
+
}, others /* FIXME: typing error */, rootProps.slotProps?.baseSelect, {
|
|
110
110
|
children: renderSingleSelectOptions({
|
|
111
111
|
column: resolvedColumn,
|
|
112
112
|
OptionComponent: rootProps.slots.baseSelectOption,
|
|
@@ -130,7 +130,7 @@ const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(p
|
|
|
130
130
|
}
|
|
131
131
|
return apiRef.current.setFilterModel(_extends({}, filterModel, {
|
|
132
132
|
items: readOnlyFilters
|
|
133
|
-
}));
|
|
133
|
+
}), 'removeAllFilterItems');
|
|
134
134
|
}, [apiRef, readOnlyFilters, filterModel, validFilters]);
|
|
135
135
|
React.useEffect(() => {
|
|
136
136
|
if (logicOperators.length > 0 && filterModel.logicOperator && !logicOperators.includes(filterModel.logicOperator)) {
|
|
@@ -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']);
|
|
@@ -59,7 +59,9 @@ function calculateCellColSpan(params) {
|
|
|
59
59
|
} = params;
|
|
60
60
|
const columnsLength = columns.length;
|
|
61
61
|
const column = columns[columnIndex];
|
|
62
|
-
const
|
|
62
|
+
const row = apiRef.current.getRow(rowId);
|
|
63
|
+
const value = apiRef.current.getRowValue(row, column);
|
|
64
|
+
const colSpan = typeof column.colSpan === 'function' ? column.colSpan(value, row, column, apiRef) : column.colSpan;
|
|
63
65
|
if (!colSpan || colSpan === 1) {
|
|
64
66
|
setCellColSpanInfo(lookup, rowId, columnIndex, {
|
|
65
67
|
spannedByColSpan: false,
|
|
@@ -334,7 +334,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
334
334
|
const row = apiRef.current.getRow(id);
|
|
335
335
|
let parsedValue = value;
|
|
336
336
|
if (column.valueParser && !skipValueParser) {
|
|
337
|
-
parsedValue = column.valueParser(value,
|
|
337
|
+
parsedValue = column.valueParser(value, row, column, apiRef);
|
|
338
338
|
}
|
|
339
339
|
let editingState = gridEditRowsStateSelector(apiRef.current.state);
|
|
340
340
|
let newProps = _extends({}, editingState[id][field], {
|
|
@@ -382,10 +382,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
382
382
|
const {
|
|
383
383
|
value
|
|
384
384
|
} = editingState[id][field];
|
|
385
|
-
return column.valueSetter ? column.valueSetter({
|
|
386
|
-
value,
|
|
387
|
-
row
|
|
388
|
-
}) : _extends({}, row, {
|
|
385
|
+
return column.valueSetter ? column.valueSetter(value, row, column, apiRef) : _extends({}, row, {
|
|
389
386
|
[field]: value
|
|
390
387
|
});
|
|
391
388
|
}, [apiRef]);
|
|
@@ -409,7 +409,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
409
409
|
const row = apiRef.current.getRow(id);
|
|
410
410
|
let parsedValue = value;
|
|
411
411
|
if (column.valueParser && !skipValueParser) {
|
|
412
|
-
parsedValue = column.valueParser(value,
|
|
412
|
+
parsedValue = column.valueParser(value, row, column, apiRef);
|
|
413
413
|
}
|
|
414
414
|
let editingState = gridEditRowsStateSelector(apiRef.current.state);
|
|
415
415
|
let newProps = _extends({}, editingState[id][field], {
|
|
@@ -509,10 +509,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
509
509
|
Object.entries(editingState[id]).forEach(([field, fieldProps]) => {
|
|
510
510
|
const column = apiRef.current.getColumn(field);
|
|
511
511
|
if (column.valueSetter) {
|
|
512
|
-
rowUpdate = column.valueSetter(
|
|
513
|
-
value: fieldProps.value,
|
|
514
|
-
row: rowUpdate
|
|
515
|
-
});
|
|
512
|
+
rowUpdate = column.valueSetter(fieldProps.value, rowUpdate, column, apiRef);
|
|
516
513
|
} else {
|
|
517
514
|
rowUpdate[field] = fieldProps.value;
|
|
518
515
|
}
|
|
@@ -88,7 +88,7 @@ const getFilterCallbackFromItem = (filterItem, apiRef) => {
|
|
|
88
88
|
let parsedValue;
|
|
89
89
|
if (column.valueParser) {
|
|
90
90
|
const parser = column.valueParser;
|
|
91
|
-
parsedValue = Array.isArray(filterItem.value) ? filterItem.value?.map(x => parser(x)) : parser(filterItem.value);
|
|
91
|
+
parsedValue = Array.isArray(filterItem.value) ? filterItem.value?.map(x => parser(x, undefined, column, apiRef)) : parser(filterItem.value, undefined, column, apiRef);
|
|
92
92
|
} else {
|
|
93
93
|
parsedValue = filterItem.value;
|
|
94
94
|
}
|
|
@@ -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 = () => ({
|