small umd and dev fixes (#177)

This commit is contained in:
Ivan Starkov 2016-06-23 22:40:07 +03:00 committed by GitHub
parent 00e9af4796
commit 26dbb12ed6
4 changed files with 16 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import defaultProps from 'recompose/defaultProps';
import withStateSelector from './utils/withStateSelector';
import withHandlers from 'recompose/withHandlers';
import withState from 'recompose/withState';
import withProps from 'recompose/withProps';
import withPropsOnChange from 'recompose/withPropsOnChange';
import ptInBounds from './utils/ptInBounds';
import GoogleMapReact from '../src';
@ -15,9 +16,10 @@ export const gMap = ({
style, hoverDistance, options,
mapParams: { center, zoom },
onChange, onChildMouseEnter, onChildMouseLeave,
markers, // hoveredMarkerId,
markers, draggable, // hoveredMarkerId,
}) => (
<GoogleMapReact
draggable={draggable}
style={style}
options={options}
hoverDistance={hoverDistance}
@ -80,6 +82,9 @@ export const gMapHOC = compose(
: [],
})
),
withProps(({ hoveredMarkerId }) => ({
draggable: hoveredMarkerId === -1,
})),
withPropsOnChange(
['markers'],
({ markers }) => ({

View File

@ -12,6 +12,7 @@ import withStateSelector from './utils/withStateSelector';
import withHandlers from 'recompose/withHandlers';
import withState from 'recompose/withState';
import withPropsOnChange from 'recompose/withPropsOnChange';
import withProps from 'recompose/withProps';
import ptInBounds from './utils/ptInBounds';
import GoogleMapReact from '../src';
// import SimpleMarker from './markers/SimpleMarker';
@ -24,7 +25,7 @@ export const gMap = ({
style, hoverDistance, options,
mapParams: { center, zoom },
onChange, onChildMouseEnter, onChildMouseLeave,
markers,
markers, draggable,
}) => (
<GoogleMapReact
style={style}
@ -35,6 +36,7 @@ export const gMap = ({
onChange={onChange}
onChildMouseEnter={onChildMouseEnter}
onChildMouseLeave={onChildMouseLeave}
draggable={draggable}
experimental
>
{markers}
@ -88,6 +90,9 @@ export const gMapHOC = compose(
: [],
})
),
withProps(({ hoveredMarkerId }) => ({
draggable: hoveredMarkerId === -1,
})),
props2Stream('hoveredMarkerId'),
withPropsOnChange(
['markers', 'hoveredMarkerId$'],

View File

@ -5,8 +5,8 @@
"main": "lib/index",
"scripts": {
"build:lib": "babel ./src -d lib",
"build:umd": "webpack src/index.js dist/GoogleMapReact.js --config webpack.config.dev.js",
"build:umd:min": "webpack src/index.js dist/GoogleMapReact.min.js --config webpack.config.prod.js",
"build:umd": "webpack src/index_umd.js dist/GoogleMapReact.js --config webpack.config.dev.js",
"build:umd:min": "webpack src/index_umd.js dist/GoogleMapReact.min.js --config webpack.config.prod.js",
"build": "npm run build:lib && npm run build:umd && npm run build:umd:min",
"clean": "rimraf lib dist",
"prepublish": "npm run clean && npm run build",

2
src/index_umd.js Normal file
View File

@ -0,0 +1,2 @@
import GoogleMap from './google_map.js';
module.exports = GoogleMap;