mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-28 18:41:16 +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,
|
doc: React.PropTypes.string,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onChange(e) {
|
||||||
|
return this.props.onChange(e.target.value)
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <Input
|
return <Input
|
||||||
onChange={this.props.onChange}
|
onChange={this.onChange.bind(this)}
|
||||||
label={this.props.name}
|
label={this.props.name}
|
||||||
name={this.props.name}
|
name={this.props.name}
|
||||||
value={this.props.value}
|
value={this.props.value}
|
||||||
|
|
|
@ -10,12 +10,16 @@ class EnumField extends React.Component {
|
||||||
doc: React.PropTypes.string,
|
doc: React.PropTypes.string,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onChange(e) {
|
||||||
|
return this.props.onChange(e.target.value)
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const options = this.props.allowedValues.map(val => {
|
const options = this.props.allowedValues.map(val => {
|
||||||
return {children: val, value: val}
|
return {children: val, value: val}
|
||||||
})
|
})
|
||||||
return <Select
|
return <Select
|
||||||
onChange={this.props.onChange}
|
onChange={this.onChange.bind(this)}
|
||||||
name={this.props.name}
|
name={this.props.name}
|
||||||
options={options}
|
options={options}
|
||||||
label={this.props.name}
|
label={this.props.name}
|
||||||
|
|
|
@ -14,9 +14,14 @@ class NumberField extends React.Component {
|
||||||
doc: React.PropTypes.string,
|
doc: React.PropTypes.string,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onChange(e) {
|
||||||
|
return this.props.onChange(parseFloat(e.target.value))
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <Input type="number"
|
return <Input
|
||||||
onChange={this.props.onChange}
|
type="number"
|
||||||
|
onChange={this.onChange.bind(this)}
|
||||||
label={this.props.name}
|
label={this.props.name}
|
||||||
name={this.props.name}
|
name={this.props.name}
|
||||||
message={this.props.doc}
|
message={this.props.doc}
|
||||||
|
|
|
@ -18,8 +18,8 @@ class SpecField extends React.Component {
|
||||||
]).isRequired,
|
]).isRequired,
|
||||||
}
|
}
|
||||||
|
|
||||||
onValueChanged(property, e) {
|
onValueChanged(property, value) {
|
||||||
return this.props.onChange(property, e.target.value)
|
return this.props.onChange(property, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -6,14 +6,18 @@ class StringField extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
onChange: React.PropTypes.func.isRequired,
|
onChange: React.PropTypes.func.isRequired,
|
||||||
name: React.PropTypes.string.isRequired,
|
name: React.PropTypes.string.isRequired,
|
||||||
value: React.PropTypes.number,
|
value: React.PropTypes.string,
|
||||||
default: React.PropTypes.number,
|
default: React.PropTypes.number,
|
||||||
doc: React.PropTypes.string,
|
doc: React.PropTypes.string,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onChange(e) {
|
||||||
|
return this.props.onChange(e.target.value)
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <Input
|
return <Input
|
||||||
onChange={this.props.onChange}
|
onChange={this.onChange.bind(this)}
|
||||||
label={this.props.name}
|
label={this.props.name}
|
||||||
name={this.props.name}
|
name={this.props.name}
|
||||||
value={this.props.value}
|
value={this.props.value}
|
||||||
|
|
Loading…
Reference in a new issue