Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
fix: correctly update enum values
Browse files Browse the repository at this point in the history
  • Loading branch information
marionebl committed May 24, 2018
1 parent 3c3e49a commit 9c14974
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/container/property-list/property-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ class PropertyViewContainer extends React.Component<PropertyViewContainerProps>
this.props.property.setValue(target.checked);
}

private handleEnumChange(e: React.ChangeEvent<HTMLSelectElement>): void {
const patternProperty = this.props.property.getPatternProperty() as PatternEnumProperty;
const selectedOption = patternProperty.getOptionById(e.target.value);
const selectedValue = selectedOption ? selectedOption.getValue() : undefined;
this.props.property.setValue(selectedValue);
}

private handleInputChange(e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement>): void {
this.props.property.setValue(e.target.value);
}
Expand Down Expand Up @@ -98,7 +105,7 @@ class PropertyViewContainer extends React.Component<PropertyViewContainerProps>
id: option.getId(),
name: option.getName()
}))}
onChange={e => this.handleInputChange(e)}
onChange={e => this.handleEnumChange(e)}
/>
);
}
Expand Down

0 comments on commit 9c14974

Please sign in to comment.