2016-12-29 14:44:46 +01:00
|
|
|
import React from 'react'
|
2017-11-06 16:32:04 +01:00
|
|
|
import PropTypes from 'prop-types'
|
2016-12-29 14:44:46 +01:00
|
|
|
|
2017-11-07 11:21:39 +01:00
|
|
|
import styleSpec from '@mapbox/mapbox-gl-style-spec/style-spec'
|
2016-12-29 14:44:46 +01:00
|
|
|
import InputBlock from '../inputs/InputBlock'
|
|
|
|
import StringInput from '../inputs/StringInput'
|
|
|
|
import SelectInput from '../inputs/SelectInput'
|
2016-12-30 20:38:50 +01:00
|
|
|
import AutocompleteInput from '../inputs/AutocompleteInput'
|
2016-12-29 14:44:46 +01:00
|
|
|
|
|
|
|
class LayerSourceBlock extends React.Component {
|
|
|
|
static propTypes = {
|
2017-11-06 16:32:04 +01:00
|
|
|
value: PropTypes.string,
|
|
|
|
onChange: PropTypes.func,
|
|
|
|
sourceIds: PropTypes.array,
|
2016-12-31 10:39:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static defaultProps = {
|
|
|
|
onChange: () => {},
|
|
|
|
sourceIds: [],
|
2016-12-29 14:44:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2017-04-10 14:29:57 +02:00
|
|
|
return <InputBlock label={"Source"} doc={styleSpec.latest.layer.source.doc}>
|
2016-12-30 20:38:50 +01:00
|
|
|
<AutocompleteInput
|
2016-12-29 14:44:46 +01:00
|
|
|
value={this.props.value}
|
|
|
|
onChange={this.props.onChange}
|
2016-12-30 20:38:50 +01:00
|
|
|
options={this.props.sourceIds.map(src => [src, src])}
|
2016-12-29 14:44:46 +01:00
|
|
|
/>
|
|
|
|
</InputBlock>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default LayerSourceBlock
|