mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-27 10:35:23 +01:00
Handle on change in field
This commit is contained in:
parent
7c7c8b7111
commit
ae0a12dcd8
5 changed files with 25 additions and 8 deletions
|
@ -11,9 +11,13 @@ static propTypes = {
|
|||
doc: React.PropTypes.string,
|
||||
}
|
||||
|
||||
onChange(e) {
|
||||
return this.props.onChange(e.target.value)
|
||||
}
|
||||
|
||||
render() {
|
||||
return <Input
|
||||
onChange={this.props.onChange}
|
||||
onChange={this.onChange.bind(this)}
|
||||
label={this.props.name}
|
||||
name={this.props.name}
|
||||
value={this.props.value}
|
||||
|
|
|
@ -10,12 +10,16 @@ class EnumField extends React.Component {
|
|||
doc: React.PropTypes.string,
|
||||
}
|
||||
|
||||
onChange(e) {
|
||||
return this.props.onChange(e.target.value)
|
||||
}
|
||||
|
||||
render() {
|
||||
const options = this.props.allowedValues.map(val => {
|
||||
return {children: val, value: val}
|
||||
})
|
||||
return <Select
|
||||
onChange={this.props.onChange}
|
||||
onChange={this.onChange.bind(this)}
|
||||
name={this.props.name}
|
||||
options={options}
|
||||
label={this.props.name}
|
||||
|
|
|
@ -14,9 +14,14 @@ class NumberField extends React.Component {
|
|||
doc: React.PropTypes.string,
|
||||
}
|
||||
|
||||
onChange(e) {
|
||||
return this.props.onChange(parseFloat(e.target.value))
|
||||
}
|
||||
|
||||
render() {
|
||||
return <Input type="number"
|
||||
onChange={this.props.onChange}
|
||||
return <Input
|
||||
type="number"
|
||||
onChange={this.onChange.bind(this)}
|
||||
label={this.props.name}
|
||||
name={this.props.name}
|
||||
message={this.props.doc}
|
||||
|
|
|
@ -18,8 +18,8 @@ class SpecField extends React.Component {
|
|||
]).isRequired,
|
||||
}
|
||||
|
||||
onValueChanged(property, e) {
|
||||
return this.props.onChange(property, e.target.value)
|
||||
onValueChanged(property, value) {
|
||||
return this.props.onChange(property, value)
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
|
@ -6,14 +6,18 @@ class StringField extends React.Component {
|
|||
static propTypes = {
|
||||
onChange: React.PropTypes.func.isRequired,
|
||||
name: React.PropTypes.string.isRequired,
|
||||
value: React.PropTypes.number,
|
||||
value: React.PropTypes.string,
|
||||
default: React.PropTypes.number,
|
||||
doc: React.PropTypes.string,
|
||||
}
|
||||
|
||||
onChange(e) {
|
||||
return this.props.onChange(e.target.value)
|
||||
}
|
||||
|
||||
render() {
|
||||
return <Input
|
||||
onChange={this.props.onChange}
|
||||
onChange={this.onChange.bind(this)}
|
||||
label={this.props.name}
|
||||
name={this.props.name}
|
||||
value={this.props.value}
|
||||
|
|
Loading…
Reference in a new issue