Skip to content

Commit fe39d0f

Browse files
committed
[5702] Improve table cell rendering
Bug: #5702 Signed-off-by: Florian ROUËNÉ <[email protected]>
1 parent a8904d2 commit fe39d0f

File tree

7 files changed

+49
-49
lines changed

7 files changed

+49
-49
lines changed

CHANGELOG.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
=== Improvements
4646

4747
- https://github.com/eclipse-sirius/sirius-web/issues/5608[#5608] [diagram] Hide empty sections on the palette
48-
48+
- https://github.com/eclipse-sirius/sirius-web/issues/5702[#5702] [table] Improve the rendering of components used in table cells
4949

5050

5151
== 2025.10.0

packages/tables/frontend/sirius-components-tables/src/cells/Cell.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ const isIconLabelCell = (cell: GQLCell): cell is GQLIconLabelCell => cell.__type
4141

4242
const useStyles = makeStyles()((theme) => ({
4343
wrapper: {
44-
padding: theme.spacing(2),
44+
paddingRight: theme.spacing(1),
45+
paddingLeft: theme.spacing(1),
4546
height: '100%',
4647
width: '100%',
4748
cursor: 'pointer',

packages/tables/frontend/sirius-components-tables/src/cells/IconLabelCell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const IconLabelCell = ({ cell }: IconLabelCellProps) => {
2020
const theme = useTheme();
2121

2222
return (
23-
<Box display="flex" alignItems="center" gap={theme.spacing(1)}>
23+
<Box display="flex" alignItems="center" gap={theme.spacing(1)} sx={{ height: '100%' }}>
2424
<IconOverlay iconURL={cell.iconURLs} alt={cell.label} />
2525
{cell.label}
2626
</Box>

packages/tables/frontend/sirius-components-tables/src/cells/MultiSelectCell.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ export const MultiSelectCell = ({
5353
disabled={disabled || loading}
5454
multiple
5555
size="small"
56-
fullWidth>
56+
disableUnderline={true}
57+
fullWidth
58+
variant="standard"
59+
sx={{ height: '100%' }}>
5760
{cell.options.map((option) => {
5861
return (
5962
<MenuItem key={option.id} value={option.id}>

packages/tables/frontend/sirius-components-tables/src/cells/SelectCell.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,15 @@ export const SelectCell = ({ editingContextId, representationId, tableId, cell,
2525
};
2626

2727
return (
28-
<Select value={cell.value} onChange={handleChange} disabled={disabled || loading} size="small" fullWidth>
28+
<Select
29+
value={cell.value}
30+
onChange={handleChange}
31+
disabled={disabled || loading}
32+
size="small"
33+
fullWidth
34+
disableUnderline={true}
35+
variant="standard"
36+
sx={{ height: '100%' }}>
2937
{cell.options.map((option) => {
3038
return (
3139
<MenuItem key={option.id} value={option.id}>

packages/tables/frontend/sirius-components-tables/src/cells/TextareaCell.tsx

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,10 @@
1212
*******************************************************************************/
1313
import TextField from '@mui/material/TextField';
1414
import React, { useEffect, useState } from 'react';
15-
import { makeStyles } from 'tss-react/mui';
1615
import { TextareaCellProps, TextareaCellState } from './TextareaCell.types';
1716
import { useEditTextareaCell } from './useEditTextareaCell';
1817

19-
const useTextareaCellStyles = makeStyles()(() => ({
20-
wrapper: {
21-
overflow: 'auto',
22-
width: '100%',
23-
height: '100%',
24-
},
25-
}));
26-
2718
export const TextareaCell = ({ editingContextId, representationId, tableId, cell, disabled }: TextareaCellProps) => {
28-
const { classes } = useTextareaCellStyles();
2919
const [state, setState] = useState<TextareaCellState>({
3020
value: cell.stringValue,
3121
});
@@ -46,29 +36,31 @@ export const TextareaCell = ({ editingContextId, representationId, tableId, cell
4636
};
4737

4838
return (
49-
<div className={classes.wrapper}>
50-
<TextField
51-
multiline
52-
value={state.value}
53-
onChange={handleChange}
54-
onBlur={handleBlur}
55-
disabled={disabled || loading}
56-
size="small"
57-
fullWidth
58-
variant="standard"
59-
InputProps={{
39+
<TextField
40+
multiline
41+
value={state.value}
42+
onChange={handleChange}
43+
onBlur={handleBlur}
44+
disabled={disabled || loading}
45+
size="small"
46+
fullWidth
47+
variant="standard"
48+
sx={{
49+
height: '100%',
50+
overflow: 'auto',
51+
}}
52+
slotProps={{
53+
input: {
6054
disableUnderline: true,
61-
sx: {
62-
marginBottom: 0,
63-
padding: '0px',
64-
},
65-
}}
66-
inputProps={{
67-
sx: {
68-
padding: '0px',
55+
sx: { height: '100%' },
56+
inputProps: {
57+
sx: {
58+
maxHeight: '100%',
59+
overflow: 'auto !important',
60+
},
6961
},
70-
}}
71-
/>
72-
</div>
62+
},
63+
}}
64+
/>
7365
);
7466
};

packages/tables/frontend/sirius-components-tables/src/cells/TextfieldCell.tsx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,14 @@ export const TextfieldCell = ({ editingContextId, representationId, tableId, cel
5353
fullWidth
5454
variant="standard"
5555
sx={{ height: '100%' }}
56-
InputProps={{
57-
disableUnderline: true,
58-
sx: {
59-
marginBottom: 0,
60-
padding: '0px',
61-
height: '100%',
62-
},
63-
}}
64-
inputProps={{
65-
sx: {
66-
padding: '0px',
67-
height: '100%',
56+
slotProps={{
57+
input: {
58+
disableUnderline: true,
59+
sx: {
60+
marginBottom: 0,
61+
padding: '0px',
62+
height: '100%',
63+
},
6864
},
6965
}}
7066
/>

0 commit comments

Comments
 (0)