Merge remote-tracking branch 'upstream/master' into fix/remove-componentWillUpdate

Conflicts:
	src/components/map/MapboxGlMap.jsx
	src/components/modals/ExportModal.jsx
This commit is contained in:
orangemug
2018-09-10 14:46:52 +01:00
43 changed files with 277 additions and 502 deletions

View File

@@ -14,18 +14,15 @@ class AutocompleteInput extends React.Component {
keepMenuWithinWindowBounds: PropTypes.bool
}
state = {
maxHeight: MAX_HEIGHT
}
static defaultProps = {
onChange: () => {},
options: [],
}
constructor(props) {
super(props);
this.state = {
maxHeight: MAX_HEIGHT
};
}
calcMaxHeight() {
if(this.props.keepMenuWithinWindowBounds) {
const maxHeight = window.innerHeight - this.autocompleteMenuEl.getBoundingClientRect().top;
@@ -38,6 +35,7 @@ class AutocompleteInput extends React.Component {
}
}
}
componentDidMount() {
this.calcMaxHeight();
}

View File

@@ -27,14 +27,13 @@ class DynamicArrayInput extends React.Component {
return this.props.value || this.props.default || []
}
addValue() {
addValue = () => {
const values = this.values.slice(0)
if (this.props.type === 'number') {
values.push(0)
} else {
values.push("")
}
this.props.onChange(values)
}
@@ -77,7 +76,7 @@ class DynamicArrayInput extends React.Component {
{inputs}
<Button
className="maputnik-array-add-value"
onClick={this.addValue.bind(this)}
onClick={this.addValue}
>
Add value
</Button>

View File

@@ -51,7 +51,7 @@ class NumberInput extends React.Component {
return true
}
resetValue() {
resetValue = () => {
// Reset explicitly to default value if value has been cleared
if(this.state.value === "") {
return this.changeValue(this.props.default)
@@ -74,7 +74,7 @@ class NumberInput extends React.Component {
placeholder={this.props.default}
value={this.state.value}
onChange={e => this.changeValue(e.target.value)}
onBlur={this.resetValue.bind(this)}
onBlur={this.resetValue}
/>
}
}