mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-16 00:00:03 +01:00
NumberInput: unit now optional, #193
This commit is contained in:
parent
30f80ecdee
commit
958e1f78e1
3 changed files with 7 additions and 1 deletions
|
@ -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>
|
||||
|
|
Loading…
Add table
Reference in a new issue