From 9c1497457b18089aed8132afbd8e4591fa0c57fb Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Sat, 19 May 2018 23:28:21 +0200 Subject: [PATCH] fix: correctly update enum values --- src/container/property-list/property-list.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/container/property-list/property-list.tsx b/src/container/property-list/property-list.tsx index 49dacaa48..d8f497e42 100644 --- a/src/container/property-list/property-list.tsx +++ b/src/container/property-list/property-list.tsx @@ -37,6 +37,13 @@ class PropertyViewContainer extends React.Component this.props.property.setValue(target.checked); } + private handleEnumChange(e: React.ChangeEvent): 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): void { this.props.property.setValue(e.target.value); } @@ -98,7 +105,7 @@ class PropertyViewContainer extends React.Component id: option.getId(), name: option.getName() }))} - onChange={e => this.handleInputChange(e)} + onChange={e => this.handleEnumChange(e)} /> ); }