Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump MUI X to 7.0.0 (major) #3310

Merged
merged 15 commits into from
Mar 28, 2024
Prev Previous commit
Next Next commit
id column align
Janpot committed Mar 27, 2024
commit 32ab65dabaa70a404a786eaf0fc211caabbb6d05
13 changes: 8 additions & 5 deletions packages/toolpad-studio-components/src/DataGrid.tsx
Original file line number Diff line number Diff line change
@@ -469,13 +469,18 @@ export function inferColumns(rows: GridRowsProp): SerializableGridColumns {
});
}

function getNarrowedColType(type?: string): GridColType | undefined {
return (type && type in DEFAULT_COLUMN_TYPES ? type : undefined) as GridColType | undefined;
}

export function parseColumns(columns: SerializableGridColumns): GridColDef[] {
return columns.map(({ type: colType, ...column }) => {
const isIdColumn = column.field === 'id';

if (isIdColumn) {
return {
...column,
type: getNarrowedColType(colType),
editable: false,
hide: true,
renderCell: ({ row, value }) => (row[DRAFT_ROW_MARKER] ? '' : value),
@@ -524,11 +529,7 @@ export function parseColumns(columns: SerializableGridColumns): GridColDef[] {
};
}

const type = (colType && colType in DEFAULT_COLUMN_TYPES ? colType : undefined) as
| GridColType
| undefined;

return { ...baseColumn, ...column, type };
return { ...baseColumn, ...column, type: getNarrowedColType(colType) };
});
}

@@ -1269,6 +1270,8 @@ const DataGridComponent = React.forwardRef(function DataGridComponent(
return result;
}, [columns, getProviderActions]);

console.log(renderedColumns);

return (
<LicenseInfoProvider info={LICENSE_INFO}>
<Box ref={ref} sx={{ ...sx, width: '100%', height: '100%', position: 'relative' }}>