From 26dbb12ed649bfa274f69c26f0fa2a6851499a29 Mon Sep 17 00:00:00 2001 From: Ivan Starkov Date: Thu, 23 Jun 2016 22:40:07 +0300 Subject: [PATCH] small umd and dev fixes (#177) --- develop/GMap.js | 7 ++++++- develop/GMapOptim.js | 7 ++++++- package.json | 4 ++-- src/index_umd.js | 2 ++ 4 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 src/index_umd.js diff --git a/develop/GMap.js b/develop/GMap.js index f225755..d418f1b 100644 --- a/develop/GMap.js +++ b/develop/GMap.js @@ -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, }) => ( ({ + draggable: hoveredMarkerId === -1, + })), withPropsOnChange( ['markers'], ({ markers }) => ({ diff --git a/develop/GMapOptim.js b/develop/GMapOptim.js index e4ccc25..03d67c5 100644 --- a/develop/GMapOptim.js +++ b/develop/GMapOptim.js @@ -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, }) => ( {markers} @@ -88,6 +90,9 @@ export const gMapHOC = compose( : [], }) ), + withProps(({ hoveredMarkerId }) => ({ + draggable: hoveredMarkerId === -1, + })), props2Stream('hoveredMarkerId'), withPropsOnChange( ['markers', 'hoveredMarkerId$'], diff --git a/package.json b/package.json index b8e0008..7a096d9 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/index_umd.js b/src/index_umd.js new file mode 100644 index 0000000..1b8c5a8 --- /dev/null +++ b/src/index_umd.js @@ -0,0 +1,2 @@ +import GoogleMap from './google_map.js'; +module.exports = GoogleMap;