-
Notifications
You must be signed in to change notification settings - Fork 391
Deleting Values #1984
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
Deleting Values #1984
Conversation
packages/core/src/util/cell.ts
Outdated
|
||
function getEmptyLabel(props: OwnPropsOfEnumCell, state: JsonFormsState) { | ||
const t = getTranslator()(state); | ||
return t(getI18nKey(props.schema, props.uischema, props.path, 'empty'), 'empty'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer None
over Empty
.
packages/core/src/util/renderer.ts
Outdated
@@ -260,6 +260,7 @@ export interface OwnPropsOfLabel extends OwnPropsOfRenderer { | |||
|
|||
export interface OwnPropsOfEnum { | |||
options?: EnumOption[]; | |||
emptyLabel?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I don't think we should handle this via the props. For me this seems like more a decision on the renderer side whether they want to offer a None
option.
@@ -49,11 +50,11 @@ export const MuiSelect = React.memo((props: EnumCellProps & WithClassname) => { | |||
disabled={!enabled} | |||
autoFocus={appliedUiSchemaOptions.focus} | |||
value={data !== undefined ? data : ''} | |||
onChange={ev => handleChange(path, ev.target.value)} | |||
onChange={ev =>handleChange(path, ev.target.value === '' ? undefined : ev.target.value)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will delete values which are empty on purpose. We really need to check whether this was our None
entry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On further inspection it seems it's not straightforward to get this information out of Material UI's Select
.
empty input now delete attributes closes eclipsesource#1983 Signed-off-by: Lukas Boll lukas-bool@web.de
- determine label in renderers - adapt angular material controls for consistency - adapt vue vanilla controls for consistency
add empty option for enum
empty input now deletes attributes.
closes #1983