Skip to content

Commit 1a2975c

Browse files
committed
[2287] Use a plain label to display Expressions in the Details view
Bug: #2287 Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
1 parent b5e8cdb commit 1a2975c

3 files changed

Lines changed: 10 additions & 42 deletions

File tree

CHANGELOG.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Now, the choice is restricted to the _timeslice/snapshot_ type that match the gr
4444
- https://github.com/eclipse-syson/syson/issues/2270[#2270] [diagram] Add dedicated tools to diagram elements palette to create/edit/delete expressions.
4545
- https://github.com/eclipse-syson/syson/issues/2269[#2269] [diagram] When using direct edit on feature elements which have a value expression (e.g. an `Attribute` with a default value defined), the expression part (after the `=` sign) is no longer part of the initial direct edit value, and will be ignored if supplied in the new text value.
4646
Users should use the dedicated tools to edit expressions instead, as they ensure only valid expressions (with all names resolving) are accepted.
47+
- https://github.com/eclipse-syson/syson/issues/2287[#2287] [details] Use a label instead of a text field to display Expressions in the Details view
4748

4849
=== New features
4950

3.19 KB
Loading

frontend/syson-components/src/extensions/expressions/ExpressionPropertySection.tsx

Lines changed: 9 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ import {
2020
PropertySectionLabel,
2121
TextfieldStyleProps,
2222
} from '@eclipse-sirius/sirius-components-forms';
23+
import Typography from '@mui/material/Typography';
2324

2425
import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
2526
import IconButton from '@mui/material/IconButton';
26-
import InputAdornment from '@mui/material/InputAdornment';
27-
import TextField from '@mui/material/TextField';
2827
import Tooltip from '@mui/material/Tooltip';
2928
import { useState } from 'react';
3029
import { makeStyles } from 'tss-react/mui';
@@ -141,46 +140,14 @@ export const ExpressionPropertySection: PropertySectionComponent<GQLTextfield |
141140
<div className={classes.propertySectionLabel}>
142141
<PropertySectionLabel editingContextId={editingContextId} formId={formId} widget={widgetForLabel} />
143142
</div>
144-
<TextField
145-
name={labelOverride}
146-
placeholder={labelOverride}
147-
variant="standard"
148-
value={widget.stringValue}
149-
spellCheck={false}
150-
margin="dense"
151-
multiline={true}
152-
maxRows={4}
153-
fullWidth
154-
data-testid={labelOverride}
155-
disabled={true}
156-
error={widget.diagnostics.length > 0}
157-
helperText={widget.diagnostics[0]?.message}
158-
className={classes.textfield}
159-
InputProps={
160-
widget.style
161-
? {
162-
className: classes.style,
163-
}
164-
: {}
165-
}
166-
inputProps={{
167-
'data-testid': `input-${labelOverride}`,
168-
className: classes.input,
169-
}}
170-
slotProps={{
171-
input: {
172-
endAdornment: (
173-
<InputAdornment position="end">
174-
<Tooltip title={'Edit'}>
175-
<IconButton size="small" onClick={onEditExpression}>
176-
<MoreHorizIcon />
177-
</IconButton>
178-
</Tooltip>
179-
</InputAdornment>
180-
),
181-
},
182-
}}
183-
/>
143+
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between' }}>
144+
<Typography>{widget.stringValue}</Typography>
145+
<Tooltip title={'Edit'}>
146+
<IconButton size="small" onClick={onEditExpression}>
147+
<MoreHorizIcon />
148+
</IconButton>
149+
</Tooltip>
150+
</div>
184151
{modalElement}
185152
</div>
186153
);

0 commit comments

Comments
 (0)