Merge pull request #191 from orangemug/fix/console-errors

Fixed startup errors/warnings
This commit is contained in:
Orange Mug 2017-11-07 15:05:16 +00:00 committed by GitHub
commit 616f45c586
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 269 additions and 218 deletions

View file

@ -23,7 +23,11 @@ module.exports = {
extensions: ['', '.js', '.jsx'] extensions: ['', '.js', '.jsx']
}, },
module: { module: {
loaders noParse: [
/mapbox-gl\/dist\/mapbox-gl.js/,
/openlayers\/dist\/ol.js/
],
loaders: loaders
}, },
node: { node: {
fs: "empty", fs: "empty",

View file

@ -38,10 +38,11 @@
"mousetrap": "^1.6.0", "mousetrap": "^1.6.0",
"ol-mapbox-style": "1.0.1", "ol-mapbox-style": "1.0.1",
"openlayers": "^3.19.1", "openlayers": "^3.19.1",
"prop-types": "^15.6.0",
"react": "^15.4.0", "react": "^15.4.0",
"react-addons-pure-render-mixin": "^15.4.0", "react-addons-pure-render-mixin": "^15.4.0",
"react-autocomplete": "^1.4.0", "react-autocomplete": "^1.4.0",
"react-codemirror": "^0.3.0", "react-codemirror": "^1.0.0",
"react-collapse": "^4.0.3", "react-collapse": "^4.0.3",
"react-color": "^2.10.0", "react-color": "^2.10.0",
"react-copy-to-clipboard": "^5.0.1", "react-copy-to-clipboard": "^5.0.1",
@ -51,7 +52,7 @@
"react-icon-base": "^2.0.4", "react-icon-base": "^2.0.4",
"react-icons": "^2.2.1", "react-icons": "^2.2.1",
"react-motion": "^0.4.7", "react-motion": "^0.4.7",
"react-sortable-hoc": "^0.4.5", "react-sortable-hoc": "^0.6.8",
"reconnecting-websocket": "^3.0.3", "reconnecting-websocket": "^3.0.3",
"request": "^2.79.0", "request": "^2.79.0",
"url": "^0.11.0" "url": "^0.11.0"

View file

@ -1,17 +1,18 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import ScrollContainer from './ScrollContainer' import ScrollContainer from './ScrollContainer'
class AppLayout extends React.Component { class AppLayout extends React.Component {
static propTypes = { static propTypes = {
toolbar: React.PropTypes.element.isRequired, toolbar: PropTypes.element.isRequired,
layerList: React.PropTypes.element.isRequired, layerList: PropTypes.element.isRequired,
layerEditor: React.PropTypes.element, layerEditor: PropTypes.element,
map: React.PropTypes.element.isRequired, map: PropTypes.element.isRequired,
bottom: React.PropTypes.element, bottom: PropTypes.element,
} }
static childContextTypes = { static childContextTypes = {
reactIconBase: React.PropTypes.object reactIconBase: PropTypes.object
} }
getChildContext() { getChildContext() {

View file

@ -1,11 +1,12 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames' import classnames from 'classnames'
class Button extends React.Component { class Button extends React.Component {
static propTypes = { static propTypes = {
onClick: React.PropTypes.func, onClick: PropTypes.func,
style: React.PropTypes.object, style: PropTypes.object,
className: React.PropTypes.string, className: PropTypes.string,
} }
render() { render() {

View file

@ -1,9 +1,10 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
class MessagePanel extends React.Component { class MessagePanel extends React.Component {
static propTypes = { static propTypes = {
errors: React.PropTypes.array, errors: PropTypes.array,
infos: React.PropTypes.array, infos: PropTypes.array,
} }
render() { render() {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import FileReaderInput from 'react-file-reader-input' import FileReaderInput from 'react-file-reader-input'
import classnames from 'classnames' import classnames from 'classnames'
@ -50,14 +51,14 @@ function ToolbarAction(props) {
export default class Toolbar extends React.Component { export default class Toolbar extends React.Component {
static propTypes = { static propTypes = {
mapStyle: React.PropTypes.object.isRequired, mapStyle: PropTypes.object.isRequired,
inspectModeEnabled: React.PropTypes.bool.isRequired, inspectModeEnabled: PropTypes.bool.isRequired,
onStyleChanged: React.PropTypes.func.isRequired, onStyleChanged: PropTypes.func.isRequired,
// A new style has been uploaded // A new style has been uploaded
onStyleOpen: React.PropTypes.func.isRequired, onStyleOpen: PropTypes.func.isRequired,
// A dict of source id's and the available source layers // A dict of source id's and the available source layers
sources: React.PropTypes.object.isRequired, sources: PropTypes.object.isRequired,
onInspectModeToggle: React.PropTypes.func.isRequired onInspectModeToggle: PropTypes.func.isRequired
} }
constructor(props) { constructor(props) {

View file

@ -1,6 +1,7 @@
import React from 'react' import React from 'react'
import Color from 'color' import Color from 'color'
import ChromePicker from 'react-color/lib/components/chrome/Chrome' import ChromePicker from 'react-color/lib/components/chrome/Chrome'
import PropTypes from 'prop-types'
function formatColor(color) { function formatColor(color) {
const rgb = color.rgb const rgb = color.rgb
@ -10,12 +11,12 @@ function formatColor(color) {
/*** Number fields with support for min, max and units and documentation*/ /*** Number fields with support for min, max and units and documentation*/
class ColorField extends React.Component { class ColorField extends React.Component {
static propTypes = { static propTypes = {
onChange: React.PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
name: React.PropTypes.string.isRequired, name: PropTypes.string.isRequired,
value: React.PropTypes.string, value: PropTypes.string,
doc: React.PropTypes.string, doc: PropTypes.string,
style: React.PropTypes.object, style: PropTypes.object,
default: React.PropTypes.string, default: PropTypes.string,
} }
constructor(props) { constructor(props) {
@ -37,7 +38,6 @@ class ColorField extends React.Component {
left: pos.left + 196, left: pos.left + 196,
} }
} else { } else {
console.warn('Color field has no element to adjust position')
return { return {
top: 160, top: 160,
left: 555, left: 555,

View file

@ -1,12 +1,13 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
export default class DocLabel extends React.Component { export default class DocLabel extends React.Component {
static propTypes = { static propTypes = {
label: React.PropTypes.oneOfType([ label: PropTypes.oneOfType([
React.PropTypes.object, PropTypes.object,
React.PropTypes.string PropTypes.string
]).isRequired, ]).isRequired,
doc: React.PropTypes.string.isRequired, doc: PropTypes.string.isRequired,
} }
render() { render() {

View file

@ -14,6 +14,7 @@ import DeleteIcon from 'react-icons/lib/md/delete'
import FunctionIcon from 'react-icons/lib/md/functions' import FunctionIcon from 'react-icons/lib/md/functions'
import MdInsertChart from 'react-icons/lib/md/insert-chart' import MdInsertChart from 'react-icons/lib/md/insert-chart'
import PropTypes from 'prop-types'
import capitalize from 'lodash.capitalize' import capitalize from 'lodash.capitalize'
function isZoomField(value) { function isZoomField(value) {
@ -29,16 +30,16 @@ function isDataField(value) {
*/ */
export default class FunctionSpecProperty extends React.Component { export default class FunctionSpecProperty extends React.Component {
static propTypes = { static propTypes = {
onChange: React.PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
fieldName: React.PropTypes.string.isRequired, fieldName: PropTypes.string.isRequired,
fieldSpec: React.PropTypes.object.isRequired, fieldSpec: PropTypes.object.isRequired,
value: React.PropTypes.oneOfType([ value: PropTypes.oneOfType([
React.PropTypes.object, PropTypes.object,
React.PropTypes.string, PropTypes.string,
React.PropTypes.number, PropTypes.number,
React.PropTypes.bool, PropTypes.bool,
React.PropTypes.array PropTypes.array
]), ]),
} }

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import FunctionSpecField from './FunctionSpecField' import FunctionSpecField from './FunctionSpecField'
const iconProperties = ['background-pattern', 'fill-pattern', 'line-pattern', 'fill-extrusion-pattern', 'icon-image'] const iconProperties = ['background-pattern', 'fill-pattern', 'line-pattern', 'fill-extrusion-pattern', 'icon-image']
@ -35,10 +36,10 @@ function getGroupName(spec, layerType, fieldName) {
export default class PropertyGroup extends React.Component { export default class PropertyGroup extends React.Component {
static propTypes = { static propTypes = {
layer: React.PropTypes.object.isRequired, layer: PropTypes.object.isRequired,
groupFields: React.PropTypes.array.isRequired, groupFields: PropTypes.array.isRequired,
onChange: React.PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
spec: React.PropTypes.object.isRequired, spec: PropTypes.object.isRequired,
} }
onPropertyChange(property, newValue) { onPropertyChange(property, newValue) {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import color from 'color' import color from 'color'
import ColorField from './ColorField' import ColorField from './ColorField'
@ -36,17 +37,17 @@ function optionsLabelLength(options) {
* to display @{value}. */ * to display @{value}. */
export default class SpecField extends React.Component { export default class SpecField extends React.Component {
static propTypes = { static propTypes = {
onChange: React.PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
fieldName: React.PropTypes.string.isRequired, fieldName: PropTypes.string.isRequired,
fieldSpec: React.PropTypes.object.isRequired, fieldSpec: PropTypes.object.isRequired,
value: React.PropTypes.oneOfType([ value: PropTypes.oneOfType([
React.PropTypes.string, PropTypes.string,
React.PropTypes.number, PropTypes.number,
React.PropTypes.array, PropTypes.array,
React.PropTypes.bool PropTypes.bool
]), ]),
/** Override the style of the field */ /** Override the style of the field */
style: React.PropTypes.object, style: PropTypes.object,
} }
render() { render() {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import { combiningFilterOps } from '../../libs/filterops.js' import { combiningFilterOps } from '../../libs/filterops.js'
import styleSpec from '@mapbox/mapbox-gl-style-spec' import styleSpec from '@mapbox/mapbox-gl-style-spec'
@ -26,9 +27,9 @@ function hasNestedCombiningFilter(filter) {
export default class CombiningFilterEditor extends React.Component { export default class CombiningFilterEditor extends React.Component {
static propTypes = { static propTypes = {
/** Properties of the vector layer and the available fields */ /** Properties of the vector layer and the available fields */
properties: React.PropTypes.object, properties: PropTypes.object,
filter: React.PropTypes.array, filter: PropTypes.array,
onChange: React.PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
} }
// Convert filter to combining filter // Convert filter to combining filter

View file

@ -1,11 +1,12 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import Button from '../Button' import Button from '../Button'
import DeleteIcon from 'react-icons/lib/md/delete' import DeleteIcon from 'react-icons/lib/md/delete'
class FilterEditorBlock extends React.Component { class FilterEditorBlock extends React.Component {
static propTypes = { static propTypes = {
onDelete: React.PropTypes.func.isRequired, onDelete: PropTypes.func.isRequired,
children: React.PropTypes.element.isRequired, children: PropTypes.element.isRequired,
} }
render() { render() {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import { otherFilterOps } from '../../libs/filterops.js' import { otherFilterOps } from '../../libs/filterops.js'
import StringInput from '../inputs/StringInput' import StringInput from '../inputs/StringInput'
@ -36,9 +37,9 @@ function parseFilter(v) {
class SingleFilterEditor extends React.Component { class SingleFilterEditor extends React.Component {
static propTypes = { static propTypes = {
filter: React.PropTypes.array.isRequired, filter: PropTypes.array.isRequired,
onChange: React.PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
properties: React.PropTypes.object, properties: PropTypes.object,
} }
static defaultProps = { static defaultProps = {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import LineIcon from './LineIcon.jsx' import LineIcon from './LineIcon.jsx'
import FillIcon from './FillIcon.jsx' import FillIcon from './FillIcon.jsx'
@ -8,8 +9,8 @@ import CircleIcon from './CircleIcon.jsx'
class LayerIcon extends React.Component { class LayerIcon extends React.Component {
static propTypes = { static propTypes = {
type: React.PropTypes.string.isRequired, type: PropTypes.string.isRequired,
style: React.PropTypes.object, style: PropTypes.object,
} }
render() { render() {

View file

@ -1,14 +1,15 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import StringInput from './StringInput' import StringInput from './StringInput'
import NumberInput from './NumberInput' import NumberInput from './NumberInput'
class ArrayInput extends React.Component { class ArrayInput extends React.Component {
static propTypes = { static propTypes = {
value: React.PropTypes.array, value: PropTypes.array,
type: React.PropTypes.string, type: PropTypes.string,
length: React.PropTypes.number, length: PropTypes.number,
default: React.PropTypes.array, default: PropTypes.array,
onChange: React.PropTypes.func, onChange: PropTypes.func,
} }
changeValue(idx, newValue) { changeValue(idx, newValue) {

View file

@ -1,13 +1,14 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames' import classnames from 'classnames'
import Autocomplete from 'react-autocomplete' import Autocomplete from 'react-autocomplete'
class AutocompleteInput extends React.Component { class AutocompleteInput extends React.Component {
static propTypes = { static propTypes = {
value: React.PropTypes.string, value: PropTypes.string,
options: React.PropTypes.array, options: PropTypes.array,
onChange: React.PropTypes.func, onChange: PropTypes.func,
} }
static defaultProps = { static defaultProps = {

View file

@ -1,10 +1,11 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
class CheckboxInput extends React.Component { class CheckboxInput extends React.Component {
static propTypes = { static propTypes = {
value: React.PropTypes.bool.isRequired, value: PropTypes.bool.isRequired,
style: React.PropTypes.object, style: PropTypes.object,
onChange: React.PropTypes.func, onChange: PropTypes.func,
} }
render() { render() {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import StringInput from './StringInput' import StringInput from './StringInput'
import NumberInput from './NumberInput' import NumberInput from './NumberInput'
import Button from '../Button' import Button from '../Button'
@ -8,10 +9,10 @@ import DocLabel from '../fields/DocLabel'
class DynamicArrayInput extends React.Component { class DynamicArrayInput extends React.Component {
static propTypes = { static propTypes = {
value: React.PropTypes.array, value: PropTypes.array,
type: React.PropTypes.string, type: PropTypes.string,
default: React.PropTypes.array, default: PropTypes.array,
onChange: React.PropTypes.func, onChange: PropTypes.func,
} }
changeValue(idx, newValue) { changeValue(idx, newValue) {

View file

@ -1,12 +1,13 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import AutocompleteInput from './AutocompleteInput' import AutocompleteInput from './AutocompleteInput'
class FontInput extends React.Component { class FontInput extends React.Component {
static propTypes = { static propTypes = {
value: React.PropTypes.array.isRequired, value: PropTypes.array.isRequired,
fonts: React.PropTypes.array, fonts: PropTypes.array,
style: React.PropTypes.object, style: PropTypes.object,
onChange: React.PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
} }
static defaultProps = { static defaultProps = {

View file

@ -1,13 +1,14 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import AutocompleteInput from './AutocompleteInput' import AutocompleteInput from './AutocompleteInput'
class IconInput extends React.Component { class IconInput extends React.Component {
static propTypes = { static propTypes = {
value: React.PropTypes.array, value: PropTypes.array,
icons: React.PropTypes.array, icons: PropTypes.array,
style: React.PropTypes.object, style: PropTypes.object,
onChange: React.PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
} }
static defaultProps = { static defaultProps = {

View file

@ -1,18 +1,19 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames' import classnames from 'classnames'
import DocLabel from '../fields/DocLabel' import DocLabel from '../fields/DocLabel'
/** Wrap a component with a label */ /** Wrap a component with a label */
class InputBlock extends React.Component { class InputBlock extends React.Component {
static propTypes = { static propTypes = {
label: React.PropTypes.oneOfType([ label: PropTypes.oneOfType([
React.PropTypes.string, PropTypes.string,
React.PropTypes.element, PropTypes.element,
]).isRequired, ]).isRequired,
doc: React.PropTypes.string, doc: PropTypes.string,
action: React.PropTypes.element, action: PropTypes.element,
children: React.PropTypes.element.isRequired, children: PropTypes.element.isRequired,
style: React.PropTypes.object, style: PropTypes.object,
} }
onChange(e) { onChange(e) {

View file

@ -1,12 +1,13 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames' import classnames from 'classnames'
import Button from '../Button' import Button from '../Button'
class MultiButtonInput extends React.Component { class MultiButtonInput extends React.Component {
static propTypes = { static propTypes = {
value: React.PropTypes.string.isRequired, value: PropTypes.string.isRequired,
options: React.PropTypes.array.isRequired, options: PropTypes.array.isRequired,
onChange: React.PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
} }
render() { render() {

View file

@ -1,12 +1,13 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
class NumberInput extends React.Component { class NumberInput extends React.Component {
static propTypes = { static propTypes = {
value: React.PropTypes.number, value: PropTypes.number,
default: React.PropTypes.number, default: PropTypes.number,
min: React.PropTypes.number, min: PropTypes.number,
max: React.PropTypes.number, max: PropTypes.number,
onChange: React.PropTypes.func, onChange: PropTypes.func,
} }
constructor(props) { constructor(props) {

View file

@ -1,11 +1,12 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
class SelectInput extends React.Component { class SelectInput extends React.Component {
static propTypes = { static propTypes = {
value: React.PropTypes.string.isRequired, value: PropTypes.string.isRequired,
options: React.PropTypes.array.isRequired, options: PropTypes.array.isRequired,
style: React.PropTypes.object, style: PropTypes.object,
onChange: React.PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
} }

View file

@ -1,11 +1,12 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
class StringInput extends React.Component { class StringInput extends React.Component {
static propTypes = { static propTypes = {
value: React.PropTypes.string, value: PropTypes.string,
style: React.PropTypes.object, style: PropTypes.object,
default: React.PropTypes.string, default: PropTypes.string,
onChange: React.PropTypes.func, onChange: PropTypes.func,
} }
constructor(props) { constructor(props) {

View file

@ -1,11 +1,12 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import CollapseOpenIcon from 'react-icons/lib/md/arrow-drop-down' import CollapseOpenIcon from 'react-icons/lib/md/arrow-drop-down'
import CollapseCloseIcon from 'react-icons/lib/md/arrow-drop-up' import CollapseCloseIcon from 'react-icons/lib/md/arrow-drop-up'
export default class Collapser extends React.Component { export default class Collapser extends React.Component {
static propTypes = { static propTypes = {
isCollapsed: React.PropTypes.bool.isRequired, isCollapsed: PropTypes.bool.isRequired,
style: React.PropTypes.object, style: PropTypes.object,
} }
render() { render() {

View file

@ -1,12 +1,13 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import InputBlock from '../inputs/InputBlock' import InputBlock from '../inputs/InputBlock'
import StringInput from '../inputs/StringInput' import StringInput from '../inputs/StringInput'
class MetadataBlock extends React.Component { class MetadataBlock extends React.Component {
static propTypes = { static propTypes = {
value: React.PropTypes.string, value: PropTypes.string,
onChange: React.PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
} }
render() { render() {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import CodeMirror from 'react-codemirror' import CodeMirror from 'react-codemirror'
import InputBlock from '../inputs/InputBlock' import InputBlock from '../inputs/InputBlock'
@ -18,8 +19,8 @@ import '../../vendor/codemirror/addon/lint/json-lint'
class JSONEditor extends React.Component { class JSONEditor extends React.Component {
static propTypes = { static propTypes = {
layer: React.PropTypes.object.isRequired, layer: PropTypes.object.isRequired,
onChange: React.PropTypes.func, onChange: PropTypes.func,
} }
constructor(props) { constructor(props) {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import JSONEditor from './JSONEditor' import JSONEditor from './JSONEditor'
import FilterEditor from '../filter/FilterEditor' import FilterEditor from '../filter/FilterEditor'
@ -43,12 +44,12 @@ function layoutGroups(layerType) {
/** Layer editor supporting multiple types of layers. */ /** Layer editor supporting multiple types of layers. */
export default class LayerEditor extends React.Component { export default class LayerEditor extends React.Component {
static propTypes = { static propTypes = {
layer: React.PropTypes.object.isRequired, layer: PropTypes.object.isRequired,
sources: React.PropTypes.object, sources: PropTypes.object,
vectorLayers: React.PropTypes.object, vectorLayers: PropTypes.object,
spec: React.PropTypes.object.isRequired, spec: PropTypes.object.isRequired,
onLayerChanged: React.PropTypes.func, onLayerChanged: PropTypes.func,
onLayerIdChange: React.PropTypes.func, onLayerIdChange: PropTypes.func,
} }
static defaultProps = { static defaultProps = {
@ -58,7 +59,7 @@ export default class LayerEditor extends React.Component {
} }
static childContextTypes = { static childContextTypes = {
reactIconBase: React.PropTypes.object reactIconBase: PropTypes.object
} }
constructor(props) { constructor(props) {

View file

@ -1,13 +1,14 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import Collapse from 'react-collapse' import Collapse from 'react-collapse'
import Collapser from './Collapser' import Collapser from './Collapser'
export default class LayerEditorGroup extends React.Component { export default class LayerEditorGroup extends React.Component {
static propTypes = { static propTypes = {
title: React.PropTypes.string.isRequired, title: PropTypes.string.isRequired,
isActive: React.PropTypes.bool.isRequired, isActive: PropTypes.bool.isRequired,
children: React.PropTypes.element.isRequired, children: PropTypes.element.isRequired,
onActiveToggle: React.PropTypes.func.isRequired onActiveToggle: PropTypes.func.isRequired
} }
render() { render() {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import styleSpec from '@mapbox/mapbox-gl-style-spec' import styleSpec from '@mapbox/mapbox-gl-style-spec'
import InputBlock from '../inputs/InputBlock' import InputBlock from '../inputs/InputBlock'
@ -6,8 +7,8 @@ import StringInput from '../inputs/StringInput'
class LayerIdBlock extends React.Component { class LayerIdBlock extends React.Component {
static propTypes = { static propTypes = {
value: React.PropTypes.string.isRequired, value: PropTypes.string.isRequired,
onChange: React.PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
} }
render() { render() {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames' import classnames from 'classnames'
import cloneDeep from 'lodash.clonedeep' import cloneDeep from 'lodash.clonedeep'
@ -12,11 +13,11 @@ import style from '../../libs/style.js'
import {SortableContainer, SortableHandle, arrayMove} from 'react-sortable-hoc'; import {SortableContainer, SortableHandle, arrayMove} from 'react-sortable-hoc';
const layerListPropTypes = { const layerListPropTypes = {
layers: React.PropTypes.array.isRequired, layers: PropTypes.array.isRequired,
selectedLayerIndex: React.PropTypes.number.isRequired, selectedLayerIndex: PropTypes.number.isRequired,
onLayersChange: React.PropTypes.func.isRequired, onLayersChange: PropTypes.func.isRequired,
onLayerSelect: React.PropTypes.func, onLayerSelect: PropTypes.func,
sources: React.PropTypes.object.isRequired, sources: PropTypes.object.isRequired,
} }
function layerPrefix(name) { function layerPrefix(name) {

View file

@ -1,12 +1,12 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import Collapser from './Collapser' import Collapser from './Collapser'
export default class LayerEditorGroup extends React.Component { export default class LayerListGroup extends React.Component {
static propTypes = { static propTypes = {
title: React.PropTypes.string.isRequired, title: PropTypes.string.isRequired,
children: React.PropTypes.element.isRequired, isActive: PropTypes.bool.isRequired,
isActive: React.PropTypes.bool.isRequired, onActiveToggle: PropTypes.func.isRequired
onActiveToggle: React.PropTypes.func.isRequired
} }
render() { render() {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import Color from 'color' import Color from 'color'
import classnames from 'classnames' import classnames from 'classnames'
@ -30,8 +31,8 @@ class LayerTypeDragHandle extends React.Component {
class IconAction extends React.Component { class IconAction extends React.Component {
static propTypes = { static propTypes = {
action: React.PropTypes.string.isRequired, action: PropTypes.string.isRequired,
onClick: React.PropTypes.func.isRequired, onClick: PropTypes.func.isRequired,
} }
renderIcon() { renderIcon() {
@ -57,16 +58,16 @@ class IconAction extends React.Component {
@SortableElement @SortableElement
class LayerListItem extends React.Component { class LayerListItem extends React.Component {
static propTypes = { static propTypes = {
layerId: React.PropTypes.string.isRequired, layerId: PropTypes.string.isRequired,
layerType: React.PropTypes.string.isRequired, layerType: PropTypes.string.isRequired,
isSelected: React.PropTypes.bool, isSelected: PropTypes.bool,
visibility: React.PropTypes.string, visibility: PropTypes.string,
className: React.PropTypes.string, className: PropTypes.string,
onLayerSelect: React.PropTypes.func.isRequired, onLayerSelect: PropTypes.func.isRequired,
onLayerCopy: React.PropTypes.func, onLayerCopy: PropTypes.func,
onLayerDestroy: React.PropTypes.func, onLayerDestroy: PropTypes.func,
onLayerVisibilityToggle: React.PropTypes.func, onLayerVisibilityToggle: PropTypes.func,
} }
static defaultProps = { static defaultProps = {
@ -78,7 +79,7 @@ class LayerListItem extends React.Component {
} }
static childContextTypes = { static childContextTypes = {
reactIconBase: React.PropTypes.object reactIconBase: PropTypes.object
} }
getChildContext() { getChildContext() {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import styleSpec from '@mapbox/mapbox-gl-style-spec' import styleSpec from '@mapbox/mapbox-gl-style-spec'
import InputBlock from '../inputs/InputBlock' import InputBlock from '../inputs/InputBlock'
@ -8,9 +9,9 @@ import AutocompleteInput from '../inputs/AutocompleteInput'
class LayerSourceBlock extends React.Component { class LayerSourceBlock extends React.Component {
static propTypes = { static propTypes = {
value: React.PropTypes.string, value: PropTypes.string,
onChange: React.PropTypes.func, onChange: PropTypes.func,
sourceIds: React.PropTypes.array, sourceIds: PropTypes.array,
} }
static defaultProps = { static defaultProps = {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import styleSpec from '@mapbox/mapbox-gl-style-spec' import styleSpec from '@mapbox/mapbox-gl-style-spec'
import InputBlock from '../inputs/InputBlock' import InputBlock from '../inputs/InputBlock'
@ -8,9 +9,9 @@ import AutocompleteInput from '../inputs/AutocompleteInput'
class LayerSourceLayer extends React.Component { class LayerSourceLayer extends React.Component {
static propTypes = { static propTypes = {
value: React.PropTypes.string, value: PropTypes.string,
onChange: React.PropTypes.func, onChange: PropTypes.func,
sourceLayerIds: React.PropTypes.array, sourceLayerIds: PropTypes.array,
} }
static defaultProps = { static defaultProps = {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import styleSpec from '@mapbox/mapbox-gl-style-spec' import styleSpec from '@mapbox/mapbox-gl-style-spec'
import InputBlock from '../inputs/InputBlock' import InputBlock from '../inputs/InputBlock'
@ -6,8 +7,8 @@ import SelectInput from '../inputs/SelectInput'
class LayerTypeBlock extends React.Component { class LayerTypeBlock extends React.Component {
static propTypes = { static propTypes = {
value: React.PropTypes.string.isRequired, value: PropTypes.string.isRequired,
onChange: React.PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
} }
render() { render() {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import styleSpec from '@mapbox/mapbox-gl-style-spec' import styleSpec from '@mapbox/mapbox-gl-style-spec'
import InputBlock from '../inputs/InputBlock' import InputBlock from '../inputs/InputBlock'
@ -6,8 +7,8 @@ import NumberInput from '../inputs/NumberInput'
class MaxZoomBlock extends React.Component { class MaxZoomBlock extends React.Component {
static propTypes = { static propTypes = {
value: React.PropTypes.number.isRequired, value: PropTypes.number,
onChange: React.PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
} }
render() { render() {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import styleSpec from '@mapbox/mapbox-gl-style-spec' import styleSpec from '@mapbox/mapbox-gl-style-spec'
import InputBlock from '../inputs/InputBlock' import InputBlock from '../inputs/InputBlock'
@ -6,8 +7,8 @@ import NumberInput from '../inputs/NumberInput'
class MinZoomBlock extends React.Component { class MinZoomBlock extends React.Component {
static propTypes = { static propTypes = {
value: React.PropTypes.number.isRequired, value: PropTypes.number,
onChange: React.PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
} }
render() { render() {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom'
import MapboxGl from 'mapbox-gl' import MapboxGl from 'mapbox-gl'
import MapboxInspect from 'mapbox-gl-inspect' import MapboxInspect from 'mapbox-gl-inspect'
@ -58,10 +59,10 @@ function buildInspectStyle(originalMapStyle, coloredLayers, highlightedLayer) {
export default class MapboxGlMap extends React.Component { export default class MapboxGlMap extends React.Component {
static propTypes = { static propTypes = {
onDataChange: React.PropTypes.func, onDataChange: PropTypes.func,
mapStyle: React.PropTypes.object.isRequired, mapStyle: PropTypes.object.isRequired,
inspectModeEnabled: React.PropTypes.bool.isRequired, inspectModeEnabled: PropTypes.bool.isRequired,
highlightedLayer: React.PropTypes.object, highlightedLayer: PropTypes.object,
} }
static defaultProps = { static defaultProps = {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import style from '../../libs/style.js' import style from '../../libs/style.js'
import isEqual from 'lodash.isequal' import isEqual from 'lodash.isequal'
import { loadJSON } from '../../libs/urlopen' import { loadJSON } from '../../libs/urlopen'
@ -65,9 +66,9 @@ function sourceFromTileJSON(url, cb) {
class OpenLayers3Map extends React.Component { class OpenLayers3Map extends React.Component {
static propTypes = { static propTypes = {
onDataChange: React.PropTypes.func, onDataChange: PropTypes.func,
mapStyle: React.PropTypes.object.isRequired, mapStyle: PropTypes.object.isRequired,
accessToken: React.PropTypes.string, accessToken: PropTypes.string,
} }
static defaultProps = { static defaultProps = {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import Button from '../Button' import Button from '../Button'
import InputBlock from '../inputs/InputBlock' import InputBlock from '../inputs/InputBlock'
@ -13,13 +14,13 @@ import LayerSourceLayerBlock from '../layers/LayerSourceLayerBlock'
class AddModal extends React.Component { class AddModal extends React.Component {
static propTypes = { static propTypes = {
layers: React.PropTypes.array.isRequired, layers: PropTypes.array.isRequired,
onLayersChange: React.PropTypes.func.isRequired, onLayersChange: PropTypes.func.isRequired,
isOpen: React.PropTypes.bool.isRequired, isOpen: PropTypes.bool.isRequired,
onOpenToggle: React.PropTypes.func.isRequired, onOpenToggle: PropTypes.func.isRequired,
// A dict of source id's and the available source layers // A dict of source id's and the available source layers
sources: React.PropTypes.object.isRequired, sources: PropTypes.object.isRequired,
} }
addLayer() { addLayer() {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import { saveAs } from 'file-saver' import { saveAs } from 'file-saver'
import styleSpec from '@mapbox/mapbox-gl-style-spec' import styleSpec from '@mapbox/mapbox-gl-style-spec'
@ -17,8 +18,8 @@ import { CopyToClipboard } from 'react-copy-to-clipboard'
class Gist extends React.Component { class Gist extends React.Component {
static propTypes = { static propTypes = {
mapStyle: React.PropTypes.object.isRequired, mapStyle: PropTypes.object.isRequired,
onStyleChanged: React.PropTypes.func.isRequired, onStyleChanged: PropTypes.func.isRequired,
} }
constructor(props) { constructor(props) {
@ -197,10 +198,10 @@ function stripAccessTokens(mapStyle) {
class ExportModal extends React.Component { class ExportModal extends React.Component {
static propTypes = { static propTypes = {
mapStyle: React.PropTypes.object.isRequired, mapStyle: PropTypes.object.isRequired,
onStyleChanged: React.PropTypes.func.isRequired, onStyleChanged: PropTypes.func.isRequired,
isOpen: React.PropTypes.bool.isRequired, isOpen: PropTypes.bool.isRequired,
onOpenToggle: React.PropTypes.func.isRequired, onOpenToggle: PropTypes.func.isRequired,
} }
constructor(props) { constructor(props) {

View file

@ -1,12 +1,13 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import CloseIcon from 'react-icons/lib/md/close' import CloseIcon from 'react-icons/lib/md/close'
import Overlay from './Overlay' import Overlay from './Overlay'
class Modal extends React.Component { class Modal extends React.Component {
static propTypes = { static propTypes = {
isOpen: React.PropTypes.bool.isRequired, isOpen: PropTypes.bool.isRequired,
title: React.PropTypes.string.isRequired, title: PropTypes.string.isRequired,
onOpenToggle: React.PropTypes.func.isRequired, onOpenToggle: PropTypes.func.isRequired,
} }
render() { render() {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import Modal from './Modal' import Modal from './Modal'
import Button from '../Button' import Button from '../Button'
import FileReaderInput from 'react-file-reader-input' import FileReaderInput from 'react-file-reader-input'
@ -12,10 +13,10 @@ import publicStyles from '../../config/styles.json'
class PublicStyle extends React.Component { class PublicStyle extends React.Component {
static propTypes = { static propTypes = {
url: React.PropTypes.string.isRequired, url: PropTypes.string.isRequired,
thumbnailUrl: React.PropTypes.string.isRequired, thumbnailUrl: PropTypes.string.isRequired,
title: React.PropTypes.string.isRequired, title: PropTypes.string.isRequired,
onSelect: React.PropTypes.func.isRequired, onSelect: PropTypes.func.isRequired,
} }
render() { render() {
@ -41,9 +42,9 @@ class PublicStyle extends React.Component {
class OpenModal extends React.Component { class OpenModal extends React.Component {
static propTypes = { static propTypes = {
isOpen: React.PropTypes.bool.isRequired, isOpen: PropTypes.bool.isRequired,
onOpenToggle: React.PropTypes.func.isRequired, onOpenToggle: PropTypes.func.isRequired,
onStyleOpen: React.PropTypes.func.isRequired, onStyleOpen: PropTypes.func.isRequired,
} }
constructor(props) { constructor(props) {

View file

@ -1,10 +1,11 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
class Overlay extends React.Component { class Overlay extends React.Component {
static propTypes = { static propTypes = {
isOpen: React.PropTypes.bool.isRequired, isOpen: PropTypes.bool.isRequired,
children: React.PropTypes.element.isRequired children: PropTypes.element.isRequired
} }
render() { render() {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import styleSpec from '@mapbox/mapbox-gl-style-spec' import styleSpec from '@mapbox/mapbox-gl-style-spec'
import InputBlock from '../inputs/InputBlock' import InputBlock from '../inputs/InputBlock'
@ -8,10 +9,10 @@ import Modal from './Modal'
class SettingsModal extends React.Component { class SettingsModal extends React.Component {
static propTypes = { static propTypes = {
mapStyle: React.PropTypes.object.isRequired, mapStyle: PropTypes.object.isRequired,
onStyleChanged: React.PropTypes.func.isRequired, onStyleChanged: PropTypes.func.isRequired,
isOpen: React.PropTypes.bool.isRequired, isOpen: PropTypes.bool.isRequired,
onOpenToggle: React.PropTypes.func.isRequired, onOpenToggle: PropTypes.func.isRequired,
} }
constructor(props) { constructor(props) {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import styleSpec from '@mapbox/mapbox-gl-style-spec' import styleSpec from '@mapbox/mapbox-gl-style-spec'
import Modal from './Modal' import Modal from './Modal'
import Button from '../Button' import Button from '../Button'
@ -16,10 +17,10 @@ import DeleteIcon from 'react-icons/lib/md/delete'
class PublicSource extends React.Component { class PublicSource extends React.Component {
static propTypes = { static propTypes = {
id: React.PropTypes.string.isRequired, id: PropTypes.string.isRequired,
type: React.PropTypes.string.isRequired, type: PropTypes.string.isRequired,
title: React.PropTypes.string.isRequired, title: PropTypes.string.isRequired,
onSelect: React.PropTypes.func.isRequired, onSelect: PropTypes.func.isRequired,
} }
render() { render() {
@ -54,10 +55,10 @@ function editorMode(source) {
class ActiveSourceTypeEditor extends React.Component { class ActiveSourceTypeEditor extends React.Component {
static propTypes = { static propTypes = {
sourceId: React.PropTypes.string.isRequired, sourceId: PropTypes.string.isRequired,
source: React.PropTypes.object.isRequired, source: PropTypes.object.isRequired,
onDelete: React.PropTypes.func.isRequired, onDelete: PropTypes.func.isRequired,
onChange: React.PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
} }
render() { render() {
@ -87,7 +88,7 @@ class ActiveSourceTypeEditor extends React.Component {
class AddSource extends React.Component { class AddSource extends React.Component {
static propTypes = { static propTypes = {
onAdd: React.PropTypes.func.isRequired, onAdd: PropTypes.func.isRequired,
} }
constructor(props) { constructor(props) {
@ -167,10 +168,10 @@ class AddSource extends React.Component {
class SourcesModal extends React.Component { class SourcesModal extends React.Component {
static propTypes = { static propTypes = {
mapStyle: React.PropTypes.object.isRequired, mapStyle: PropTypes.object.isRequired,
isOpen: React.PropTypes.bool.isRequired, isOpen: PropTypes.bool.isRequired,
onOpenToggle: React.PropTypes.func.isRequired, onOpenToggle: PropTypes.func.isRequired,
onStyleChanged: React.PropTypes.func.isRequired, onStyleChanged: PropTypes.func.isRequired,
} }
stripTitle(source) { stripTitle(source) {

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
import styleSpec from '@mapbox/mapbox-gl-style-spec' import styleSpec from '@mapbox/mapbox-gl-style-spec'
import InputBlock from '../inputs/InputBlock' import InputBlock from '../inputs/InputBlock'
import StringInput from '../inputs/StringInput' import StringInput from '../inputs/StringInput'
@ -6,8 +7,8 @@ import NumberInput from '../inputs/NumberInput'
class TileJSONSourceEditor extends React.Component { class TileJSONSourceEditor extends React.Component {
static propTypes = { static propTypes = {
source: React.PropTypes.object.isRequired, source: PropTypes.object.isRequired,
onChange: React.PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
} }
render() { render() {
@ -25,8 +26,8 @@ class TileJSONSourceEditor extends React.Component {
class TileURLSourceEditor extends React.Component { class TileURLSourceEditor extends React.Component {
static propTypes = { static propTypes = {
source: React.PropTypes.object.isRequired, source: PropTypes.object.isRequired,
onChange: React.PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
} }
changeTileUrl(idx, value) { changeTileUrl(idx, value) {
@ -79,8 +80,8 @@ class TileURLSourceEditor extends React.Component {
class GeoJSONSourceEditor extends React.Component { class GeoJSONSourceEditor extends React.Component {
static propTypes = { static propTypes = {
source: React.PropTypes.object.isRequired, source: PropTypes.object.isRequired,
onChange: React.PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
} }
render() { render() {
@ -98,9 +99,9 @@ class GeoJSONSourceEditor extends React.Component {
class SourceTypeEditor extends React.Component { class SourceTypeEditor extends React.Component {
static propTypes = { static propTypes = {
mode: React.PropTypes.string.isRequired, mode: PropTypes.string.isRequired,
source: React.PropTypes.object.isRequired, source: PropTypes.object.isRequired,
onChange: React.PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
} }
render() { render() {