Commit 958e1f78 authored by Laura Fuentes Grau's avatar Laura Fuentes Grau

NumberInput: unit now optional, #193

parent 30f80ecd
......@@ -155,7 +155,8 @@ export default function CreateControls(widgetType = null, widget = null, session
case 'NumberInput':
DialogControls.push(
<EditWidgetTextControl key={0} widget={widget} controlId={'name'} label={'Text'} placeholder={'Enter text'} handleChange={e => handleChange(e)} />,
<EditWidgetSignalControl key={2} widget={widget} controlId={'signalIDs'} input signals={signals} handleChange={(e) => handleChange(e)} />
<EditWidgetSignalControl key={2} widget={widget} controlId={'signalIDs'} input signals={signals} handleChange={(e) => handleChange(e)} />,
<EditWidgetCheckboxControl key={1} widget={widget} controlId={'customProperties.showUnit'} input text="Show unit" handleChange={e => handleChange(e)} />
);
break;
......
......@@ -137,6 +137,7 @@ class WidgetFactory {
widget.minHeight = 50;
widget.width = 200;
widget.height = 50;
widget.customProperties.showUnit = false;
break;
case 'Slider':
widget.minWidth = 380;
......
......@@ -84,9 +84,13 @@ class WidgetInput extends Component {
<Col>
<InputGroup>
<FormControl type="number" step="any" disabled={ this.props.editing } onKeyPress={ (e) => this.handleKeyPress(e) } onBlur={ (e) => this.valueChanged(this.state.value) } onChange={ (e) => this.valueIsChanging(e.target.value) } placeholder="Enter value" value={ this.state.value } />
{this.props.widget.customProperties.showUnit? (
<InputGroup.Append>
<InputGroup.Text>{this.state.unit}</InputGroup.Text>
</InputGroup.Append>
):(
<div></div>
)}
</InputGroup>
</Col>
</FormGroup>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment