Skip to content

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

Merged
merged 2 commits into from
Jul 25, 2022
Merged

Deleting Values #1984

merged 2 commits into from
Jul 25, 2022

Conversation

LukasBoll
Copy link
Contributor

add empty option for enum
empty input now deletes attributes.

closes #1983

@coveralls
Copy link

coveralls commented Jul 21, 2022

Coverage Status

Coverage remained the same at 84.356% when pulling 991bc40 on LukasBoll:deletingValues into f4b51e6 on eclipsesource:master.


function getEmptyLabel(props: OwnPropsOfEnumCell, state: JsonFormsState) {
const t = getTranslator()(state);
return t(getI18nKey(props.schema, props.uischema, props.path, 'empty'), 'empty');
Copy link
Member

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.

@@ -260,6 +260,7 @@ export interface OwnPropsOfLabel extends OwnPropsOfRenderer {

export interface OwnPropsOfEnum {
options?: EnumOption[];
emptyLabel?: string;
Copy link
Member

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)}
Copy link
Member

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.

Copy link
Member

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.

LukasBoll and others added 2 commits July 25, 2022 09:24
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
@sdirix sdirix merged commit 3aeffce into eclipsesource:master Jul 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty inputs should result in attribute being deleted
3 participants