react-google-maps
Advanced tools
Comparing version 4.7.0 to 4.7.1
@@ -0,1 +1,11 @@ | ||
<a name="4.7.1"></a> | ||
## [4.7.1](https://github.com/tomchentw/react-google-maps/compare/v4.7.0...v4.7.1) (2015-12-30) | ||
### Bug Fixes | ||
* **utils:** should use contentElement ([76abbfc](https://github.com/tomchentw/react-google-maps/commit/76abbfc)) | ||
<a name="4.7.0"></a> | ||
@@ -2,0 +12,0 @@ # [4.7.0](https://github.com/tomchentw/react-google-maps/compare/v4.6.2...v4.7.0) (2015-12-07) |
@@ -10,8 +10,2 @@ "use strict"; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _expect = require("expect"); | ||
var _expect2 = _interopRequireDefault(_expect); | ||
function addListener(inst, name, callback) {} | ||
@@ -18,0 +12,0 @@ |
@@ -11,10 +11,4 @@ "use strict"; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var _expect = require("expect"); | ||
var _expect2 = _interopRequireDefault(_expect); | ||
var _googleMapsEventMock = require("./google.maps.event.mock"); | ||
@@ -21,0 +15,0 @@ |
@@ -21,6 +21,2 @@ 'use strict'; | ||
var _invariant = require('invariant'); | ||
var _invariant2 = _interopRequireDefault(_invariant); | ||
var _addonsEventListsMarkerClustererEventList = require('../addonsEventLists/MarkerClustererEventList'); | ||
@@ -182,3 +178,3 @@ | ||
if (0 < _react.Children.count(children)) { | ||
if (_react.Children.count(children) > 0) { | ||
return _react2['default'].createElement( | ||
@@ -185,0 +181,0 @@ 'div', |
@@ -63,3 +63,3 @@ "use strict"; | ||
return null != this.props.containerElement && undefined === containerTagName && undefined === containerProps; | ||
return this.props.containerElement !== undefined && this.props.containerElement !== null && containerTagName === undefined && containerProps === undefined; | ||
} | ||
@@ -71,3 +71,3 @@ }, { | ||
(0, _warning2["default"])(this.shouldUseNewBehavior(), "\"async/ScriptjsLoader\" is now rendering \"GoogleMapLoader\". Migrate to use \"GoogleMapLoader\" instead. \nThe old behavior will be removed in next major release (5.0.0). \nSee https://github.com/tomchentw/react-google-maps/pull/157 for more details."); | ||
(0, _warning2["default"])(this.shouldUseNewBehavior(), "\"async/ScriptjsLoader\" is now rendering \"GoogleMapLoader\". Migrate to use \"GoogleMapLoader\" instead.\nThe old behavior will be removed in next major release (5.0.0).\nSee https://github.com/tomchentw/react-google-maps/pull/157 for more details."); | ||
if (!_canUseDom2["default"]) { | ||
@@ -102,3 +102,3 @@ return; | ||
(0, _warning2["default"])(0 === changedKeys.length, "ScriptjsLoader doesn't support mutating url related props after initial render. Changed props: %s", "[" + changedKeys.join(", ") + "]"); | ||
(0, _warning2["default"])(changedKeys.length === 0, "ScriptjsLoader doesn't support mutating url related props after initial render. Changed props: %s", "[" + changedKeys.join(", ") + "]"); | ||
} | ||
@@ -123,3 +123,3 @@ } | ||
} else { | ||
//------------ Deprecated ------------ | ||
// ------------ Deprecated ------------ | ||
return this.props.googleMapElement; | ||
@@ -126,0 +126,0 @@ } |
@@ -93,3 +93,3 @@ "use strict"; | ||
if (0 < _react.Children.count(children)) { | ||
if (_react.Children.count(children) > 0) { | ||
return _react2["default"].createElement( | ||
@@ -96,0 +96,0 @@ "div", |
@@ -105,3 +105,3 @@ "use strict"; | ||
if (0 < _react.Children.count(children)) { | ||
if (_react.Children.count(children) > 0) { | ||
// TODO: take a look at DirectionsRendererOptions#infoWindow and DirectionsRendererOptions#markerOptions ? | ||
@@ -108,0 +108,0 @@ return _react2["default"].createElement( |
@@ -161,3 +161,3 @@ "use strict"; | ||
if (0 < _react.Children.count(children)) { | ||
if (_react.Children.count(children) > 0) { | ||
return _react2["default"].createElement( | ||
@@ -164,0 +164,0 @@ "div", |
@@ -97,4 +97,2 @@ "use strict"; | ||
value: function _createOverlayView(overlayViewProps) { | ||
var mapHolderRef = overlayViewProps.mapHolderRef; | ||
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#OverlayView | ||
@@ -104,3 +102,3 @@ var overlayView = new google.maps.OverlayView(); | ||
overlayView.onAdd = function () { | ||
overlayView.onAdd = function onAdd() { | ||
this._containerElement = document.createElement("div"); | ||
@@ -110,3 +108,3 @@ this._containerElement.style.position = "absolute"; | ||
overlayView.draw = function () { | ||
overlayView.draw = function draw() { | ||
this._renderContent(); | ||
@@ -117,3 +115,3 @@ this._mountContainerToPane(); | ||
overlayView.onRemove = function () { | ||
overlayView.onRemove = function onRemove() { | ||
(0, _reactDom.unmountComponentAtNode)(this._containerElement); | ||
@@ -124,3 +122,3 @@ this._unmountContainerFromPane(); | ||
overlayView._redraw = function (mapPaneNameChanged) { | ||
overlayView._redraw = function _redraw(mapPaneNameChanged) { | ||
this._renderContent(); | ||
@@ -134,7 +132,7 @@ if (mapPaneNameChanged) { | ||
overlayView._renderContent = function () { | ||
overlayView._renderContent = function _renderContent() { | ||
(0, _reactDom.render)(_react.Children.only(this.get("children")), this._containerElement); | ||
}; | ||
overlayView._mountContainerToPane = function () { | ||
overlayView._mountContainerToPane = function _mountContainerToPane() { | ||
var mapPaneName = this.get("mapPaneName"); | ||
@@ -146,9 +144,9 @@ (0, _invariant2["default"])(!!mapPaneName, "OverlayView requires a mapPaneName/defaultMapPaneName in your props instead of %s", mapPaneName); | ||
overlayView._unmountContainerFromPane = function () { | ||
overlayView._unmountContainerFromPane = function _unmountContainerFromPane() { | ||
this._containerElement.parentNode.removeChild(this._containerElement); | ||
}; | ||
overlayView._positionContainerElement = function () { | ||
var left = undefined, | ||
top = undefined; | ||
overlayView._positionContainerElement = function _positionContainerElement() { | ||
var left = undefined; | ||
var top = undefined; | ||
var position = this._getPixelPosition(); | ||
@@ -171,3 +169,3 @@ if (position) { | ||
overlayView._getPixelPosition = function () { | ||
overlayView._getPixelPosition = function _getPixelPosition() { | ||
var projection = this.getProjection(); | ||
@@ -185,3 +183,3 @@ var position = this.get("position"); | ||
overlayView._getOffset = function () { | ||
overlayView._getOffset = function _getOffset() { | ||
// Allows the component to control the visual position of the OverlayView | ||
@@ -201,2 +199,3 @@ // relative to the LatLng pixel position. | ||
mapHolderRef: _react.PropTypes.instanceOf(_GoogleMapHolder2["default"]).isRequired, | ||
mapPaneName: _react.PropTypes.string, | ||
overlayView: _react.PropTypes.object.isRequired | ||
@@ -203,0 +202,0 @@ }, |
@@ -142,3 +142,3 @@ "use strict"; | ||
(0, _warning2["default"])(isUsingNewBehavior, "\"GoogleMap\" with containerTagName is deprecated now and will be removed in next major release (5.0.0). \nUse \"GoogleMapLoader\" instead. See https://github.com/tomchentw/react-google-maps/pull/157 for more details."); | ||
(0, _warning2["default"])(isUsingNewBehavior, "\"GoogleMap\" with containerTagName is deprecated now and will be removed in next major release (5.0.0).\nUse \"GoogleMapLoader\" instead. See https://github.com/tomchentw/react-google-maps/pull/157 for more details."); | ||
} | ||
@@ -165,4 +165,4 @@ }, { | ||
} else { | ||
//------------ Deprecated ------------ | ||
var realContainerTagName = null == containerTagName ? "div" : containerTagName; | ||
// ------------ Deprecated ------------ | ||
var realContainerTagName = containerTagName === undefined || containerTagName === null ? "div" : containerTagName; | ||
@@ -169,0 +169,0 @@ return _react2["default"].createElement(_GoogleMapLoader2["default"], { |
@@ -23,6 +23,2 @@ "use strict"; | ||
var _reactPropTypesElementOfType = require("react-prop-types-element-of-type"); | ||
var _reactPropTypesElementOfType2 = _interopRequireDefault(_reactPropTypesElementOfType); | ||
var _creatorsGoogleMapHolder = require("./creators/GoogleMapHolder"); | ||
@@ -81,3 +77,3 @@ | ||
map: this.state.map, | ||
//------------ Deprecated ------------ | ||
// ------------ Deprecated ------------ | ||
containerTagName: USE_NEW_BEHAVIOR_TAG_NAME | ||
@@ -84,0 +80,0 @@ }); |
@@ -35,3 +35,3 @@ "use strict"; | ||
* Original author: @eyebraus | ||
* Original PR: https://github.com/tomchentw/react-google-maps/pull/110 | ||
* Original PR: https://github.com/tomchentw/react-google-maps/pull/110 | ||
*/ | ||
@@ -38,0 +38,0 @@ |
@@ -19,3 +19,4 @@ "use strict"; | ||
function __getInstance(component) { | ||
function __getInstance(componentOrLoader) { | ||
var component = componentOrLoader; | ||
var _component = component; | ||
@@ -22,0 +23,0 @@ var constructor = _component.constructor; |
@@ -16,3 +16,4 @@ "use strict"; | ||
function renderElement(contentElement, prevContent) { | ||
function renderElement(contentElement, possiblePrevContent) { | ||
var prevContent = possiblePrevContent; | ||
if ("[object HTMLDivElement]" !== Object.prototype.toString.call(prevContent)) { | ||
@@ -31,3 +32,3 @@ prevContent = document.createElement("div"); | ||
var domEl = renderElement(contentOptionalReactElement, prevContent); | ||
var domEl = renderElement(contentElement, prevContent); | ||
infoWindowLikeInstance.setContent(domEl); | ||
@@ -34,0 +35,0 @@ } else { |
{ | ||
"__template__gist__": "https://gist.github.com/tomchentw/368a93bb748ad9d576f1#file-package-json", | ||
"name": "react-google-maps", | ||
"version": "4.7.0", | ||
"version": "4.7.1", | ||
"description": "React.js Google Maps integration component", | ||
@@ -71,4 +71,5 @@ "main": "lib/index.js", | ||
"codeclimate-test-reporter": "^0.1.1", | ||
"eslint": "^1.6.0", | ||
"eslint-plugin-react": "^3.5.1", | ||
"eslint": "^1.10.3", | ||
"eslint-config-airbnb": "^2.1.1", | ||
"eslint-plugin-react": "^3.12.0", | ||
"expect": "^1.12.1", | ||
@@ -75,0 +76,0 @@ "isparta": "^3.1.0", |
@@ -12,3 +12,3 @@ # react-google-maps | ||
```js | ||
import {GoogleMap, Marker} from "react-google-maps"; | ||
import {GoogleMapLoader, GoogleMap, Marker} from "react-google-maps"; | ||
@@ -18,19 +18,27 @@ export default function SimpleMap (props) { | ||
<section style={{height: "100%"}}> | ||
<GoogleMap containerProps={{ | ||
style: { | ||
height: "100%", | ||
}, | ||
}} | ||
defaultZoom={3} | ||
defaultCenter={{lat: -25.363882, lng: 131.044922}} | ||
onClick={props.onMapClick} | ||
> | ||
{props.markers.map((marker, index) => { | ||
return ( | ||
<Marker | ||
{...marker} | ||
onRightclick={() => props.onMarkerRightclick(index)} /> | ||
); | ||
})} | ||
</GoogleMap> | ||
<GoogleMapLoader | ||
containerElement={ | ||
<div | ||
{...this.props} | ||
style={{ | ||
height: "100%", | ||
}} | ||
/> | ||
} | ||
googleMapElement={ | ||
<GoogleMap | ||
ref={(map) => console.log(map)} | ||
defaultZoom={3} | ||
defaultCenter={{lat: -25.363882, lng: 131.044922}} | ||
onClick={::this.handleMapClick}> | ||
{this.state.markers.map((marker, index) => { | ||
return ( | ||
<Marker | ||
{...marker} | ||
onRightclick={this.handleMarkerRightclick.bind(this, index)} /> | ||
); | ||
})} | ||
</GoogleMap> | ||
} | ||
/> | ||
</section> | ||
@@ -129,2 +137,7 @@ ); | ||
## Changelog | ||
The changelog is automatically generated via [conventional-changelog][conventional-changelog] and [can be found in project root](https://github.com/tomchentw/react-google-maps/blob/master/CHANGELOG.md) as well as npm tarball. | ||
## Development | ||
@@ -216,1 +229,2 @@ | ||
[webpack]: http://webpack.github.io/docs/tutorials/getting-started/ | ||
[conventional-changelog]: https://github.com/ajoslin/conventional-changelog |
@@ -1,12 +0,8 @@ | ||
import { | ||
default as expect, | ||
} from "expect"; | ||
export function addListener (inst, name, callback) { | ||
export function addListener(inst, name, callback) { | ||
} | ||
export function removeListener (id) { | ||
export function removeListener(id) { | ||
} | ||
export function trigger (instance, ...args) { | ||
export function trigger(instance, ...args) { | ||
} |
@@ -1,18 +0,14 @@ | ||
import { | ||
default as expect, | ||
} from "expect"; | ||
import * as event from "./google.maps.event.mock"; | ||
export class Map { | ||
constructor (domEl, options) { | ||
constructor(domEl, options) { | ||
} | ||
setOptions (nextOptions) { | ||
setOptions(nextOptions) { | ||
} | ||
setZoom (nextZoom) { | ||
setZoom(nextZoom) { | ||
} | ||
} | ||
export {event}; | ||
export { event }; |
@@ -5,8 +5,4 @@ import { | ||
import { | ||
default as React, | ||
Children, | ||
PropTypes, | ||
Component, | ||
} from "react"; | ||
@@ -27,3 +23,3 @@ | ||
before(() => { | ||
global.google = {maps}; | ||
global.google = { maps }; | ||
}); | ||
@@ -30,0 +26,0 @@ |
@@ -21,4 +21,4 @@ import { | ||
describe("index", () => { | ||
it("should be exported", () => { | ||
describe(`index`, () => { | ||
it(`should be exported`, () => { | ||
expect(GoogleMapLoader).toExist(); | ||
@@ -25,0 +25,0 @@ expect(GoogleMap).toExist(); |
@@ -32,3 +32,3 @@ import { | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }).filter(function(it){ return it.match(/^get/) && !it.match(/^getMap/); }) | ||
getAnimation () { return this.state.skeleton.getAnimation(); } | ||
getAnimation() { return this.state.skeleton.getAnimation(); } | ||
// END - Public APIs | ||
@@ -41,3 +41,3 @@ // | ||
componentWillMount () { | ||
componentWillMount() { | ||
if (!canUseDOM) { | ||
@@ -51,3 +51,3 @@ return; | ||
render () { | ||
render() { | ||
if (this.state.skeleton) { | ||
@@ -54,0 +54,0 @@ return ( |
@@ -7,10 +7,10 @@ import { | ||
import {default as InfoBoxEventList} from "../addonsEventLists/InfoBoxEventList"; | ||
import {default as eventHandlerCreator} from "../../utils/eventHandlerCreator"; | ||
import {default as defaultPropsCreator} from "../../utils/defaultPropsCreator"; | ||
import {default as composeOptions} from "../../utils/composeOptions"; | ||
import {default as setContentForOptionalReactElement} from "../../utils/setContentForOptionalReactElement"; | ||
import {default as componentLifecycleDecorator} from "../../utils/componentLifecycleDecorator"; | ||
import { default as InfoBoxEventList } from "../addonsEventLists/InfoBoxEventList"; | ||
import { default as eventHandlerCreator } from "../../utils/eventHandlerCreator"; | ||
import { default as defaultPropsCreator } from "../../utils/defaultPropsCreator"; | ||
import { default as composeOptions } from "../../utils/composeOptions"; | ||
import { default as setContentForOptionalReactElement } from "../../utils/setContentForOptionalReactElement"; | ||
import { default as componentLifecycleDecorator } from "../../utils/componentLifecycleDecorator"; | ||
import {default as GoogleMapHolder} from "../../creators/GoogleMapHolder"; | ||
import { default as GoogleMapHolder } from "../../creators/GoogleMapHolder"; | ||
@@ -33,11 +33,11 @@ export const infoBoxControlledPropTypes = { | ||
const infoBoxUpdaters = { | ||
children (children, component) { setContentForOptionalReactElement(children, component.getInfoBox()); }, | ||
content (content, component) { component.getInfoBox().setContent(content); }, | ||
options (options, component) { component.getInfoBox().setOptions(options); }, | ||
position (position, component) { component.getInfoBox().setPosition(position); }, | ||
visible (visible, component) { component.getInfoBox().setVisible(visible); }, | ||
zIndex (zIndex, component) { component.getInfoBox().setZIndex(zIndex); }, | ||
children(children, component) { setContentForOptionalReactElement(children, component.getInfoBox()); }, | ||
content(content, component) { component.getInfoBox().setContent(content); }, | ||
options(options, component) { component.getInfoBox().setOptions(options); }, | ||
position(position, component) { component.getInfoBox().setPosition(position); }, | ||
visible(visible, component) { component.getInfoBox().setVisible(visible); }, | ||
zIndex(zIndex, component) { component.getInfoBox().setZIndex(zIndex); }, | ||
}; | ||
const {eventPropTypes, registerEvents} = eventHandlerCreator(InfoBoxEventList); | ||
const { eventPropTypes, registerEvents } = eventHandlerCreator(InfoBoxEventList); | ||
@@ -48,3 +48,3 @@ export const infoBoxEventPropTypes = eventPropTypes; | ||
registerEvents, | ||
instanceMethodName: "getInfoBox", | ||
instanceMethodName: `getInfoBox`, | ||
updaters: infoBoxUpdaters, | ||
@@ -59,4 +59,4 @@ }) | ||
static _createInfoBox (infoBoxProps) { | ||
const {mapHolderRef, anchorHolderRef} = infoBoxProps; | ||
static _createInfoBox(infoBoxProps) { | ||
const { mapHolderRef, anchorHolderRef } = infoBoxProps; | ||
// "google-maps-infobox" uses "google" as a global variable. Since we don't | ||
@@ -66,3 +66,3 @@ // have "google" on the server, we can not use it in server-side rendering. | ||
// a isomorphic server. | ||
const GoogleMapsInfobox = require("google-maps-infobox"); | ||
const GoogleMapsInfobox = require(`google-maps-infobox`); | ||
// http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/reference.html | ||
@@ -83,9 +83,9 @@ const infoBox = new GoogleMapsInfobox(composeOptions(infoBoxProps, infoBoxControlledPropTypes)); | ||
getInfoBox () { | ||
getInfoBox() { | ||
return this.props.infoBox; | ||
} | ||
render () { | ||
render() { | ||
return (<noscript />); | ||
} | ||
} |
@@ -7,3 +7,2 @@ import { | ||
} from 'react'; | ||
import { default as invariant } from 'invariant'; | ||
@@ -74,3 +73,3 @@ import { default as MarkerClustererEventList } from '../addonsEventLists/MarkerClustererEventList'; | ||
registerEvents, | ||
instanceMethodName: 'getMarkerClusterer', | ||
instanceMethodName: `getMarkerClusterer`, | ||
updaters: markerClustererUpdaters, | ||
@@ -85,3 +84,3 @@ }) | ||
static _createMarkerClusterer(mapHolderRef, markerClustererProps) { | ||
const GoogleMarkerClusterer = require('marker-clusterer-plus'); | ||
const GoogleMarkerClusterer = require(`marker-clusterer-plus`); | ||
@@ -111,3 +110,3 @@ // http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclustererplus/docs/reference.html#events | ||
getAnchorType() { | ||
return 'MarkerClusterer'; | ||
return `MarkerClusterer`; | ||
} | ||
@@ -118,3 +117,3 @@ | ||
if (0 < Children.count(children)) { | ||
if (Children.count(children) > 0) { | ||
return ( | ||
@@ -121,0 +120,0 @@ <div> |
// http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/reference.html | ||
export default [ | ||
"closeclick", | ||
"content_changed", | ||
"domready", | ||
"position_changed", | ||
"zindex_changed", | ||
`closeclick`, | ||
`content_changed`, | ||
`domready`, | ||
`position_changed`, | ||
`zindex_changed`, | ||
]; |
// http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclustererplus/docs/reference.html | ||
export default [ | ||
"click", | ||
"clusteringbegin", | ||
"clusteringend", | ||
"mouseout", | ||
"mouseover", | ||
`click`, | ||
`clusteringbegin`, | ||
`clusteringend`, | ||
`mouseout`, | ||
`mouseover`, | ||
]; |
@@ -34,9 +34,9 @@ import { | ||
// http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/reference.html | ||
getContent () { /* TODO: children */ } | ||
getContent() { /* TODO: children */ } | ||
getPosition () { return this.state.infoBox.getPosition(); } | ||
getPosition() { return this.state.infoBox.getPosition(); } | ||
getVisible () { return this.state.infoBox.getVisible(); } | ||
getVisible() { return this.state.infoBox.getVisible(); } | ||
getZIndex () { return this.state.infoBox.getZIndex(); } | ||
getZIndex() { return this.state.infoBox.getZIndex(); } | ||
// END - Public APIs | ||
@@ -49,3 +49,3 @@ // | ||
componentWillMount () { | ||
componentWillMount() { | ||
if (!canUseDOM) { | ||
@@ -59,3 +59,3 @@ return; | ||
render () { | ||
render() { | ||
if (this.state.infoBox) { | ||
@@ -62,0 +62,0 @@ return ( |
import { | ||
default as React, | ||
PropTypes, | ||
Component, | ||
@@ -5,0 +4,0 @@ } from 'react'; |
@@ -20,3 +20,3 @@ import { | ||
componentWillMount () { | ||
componentWillMount() { | ||
warning(false, | ||
@@ -28,4 +28,4 @@ `"async/ScriptjsGoogleMap" is deprecated now and will be removed in next major release (5.0.0). Use "async/ScriptjsLoader" instead. | ||
render () { | ||
const {protocol, hostname, port, pathname, query, loadingElement, children, ...restProps} = this.props; | ||
render() { | ||
const { protocol, hostname, port, pathname, query, loadingElement, children, ...restProps } = this.props; | ||
@@ -46,4 +46,4 @@ return ( | ||
/> | ||
) | ||
); | ||
} | ||
} |
@@ -46,15 +46,16 @@ import { | ||
shouldUseNewBehavior () { | ||
const {containerTagName, containerProps} = this.props.googleMapElement.props; | ||
shouldUseNewBehavior() { | ||
const { containerTagName, containerProps } = this.props.googleMapElement.props; | ||
return ( | ||
null != this.props.containerElement && | ||
undefined === containerTagName && | ||
undefined === containerProps | ||
this.props.containerElement !== undefined && | ||
this.props.containerElement !== null && | ||
containerTagName === undefined && | ||
containerProps === undefined | ||
); | ||
} | ||
componentWillMount () { | ||
componentWillMount() { | ||
warning(this.shouldUseNewBehavior(), | ||
`"async/ScriptjsLoader" is now rendering "GoogleMapLoader". Migrate to use "GoogleMapLoader" instead. | ||
The old behavior will be removed in next major release (5.0.0). | ||
`"async/ScriptjsLoader" is now rendering "GoogleMapLoader". Migrate to use "GoogleMapLoader" instead. | ||
The old behavior will be removed in next major release (5.0.0). | ||
See https://github.com/tomchentw/react-google-maps/pull/157 for more details.` | ||
@@ -68,8 +69,8 @@ ); | ||
*/ | ||
const scriptjs = require("scriptjs"); | ||
const scriptjs = require(`scriptjs`); | ||
/* | ||
* External commonjs require dependency -- end | ||
*/ | ||
const {protocol, hostname, port, pathname, query} = this.props; | ||
const urlObj = {protocol, hostname, port, pathname, query}; | ||
const { protocol, hostname, port, pathname, query } = this.props; | ||
const urlObj = { protocol, hostname, port, pathname, query }; | ||
const url = makeUrl(urlObj); | ||
@@ -79,13 +80,13 @@ scriptjs(url, () => this.setState({ isLoaded: true })); | ||
componentWillReceiveProps (nextProps) { | ||
if ("production" !== process.env.NODE_ENV) { | ||
componentWillReceiveProps(nextProps) { | ||
if (`production` !== process.env.NODE_ENV) { | ||
const changedKeys = getUrlObjChangedKeys(this.props, nextProps); | ||
warning(0 === changedKeys.length, `ScriptjsLoader doesn't support mutating url related props after initial render. Changed props: %s`, `[${ changedKeys.join(", ") }]`); | ||
warning(changedKeys.length === 0, `ScriptjsLoader doesn't support mutating url related props after initial render. Changed props: %s`, `[${ changedKeys.join(`, `) }]`); | ||
} | ||
} | ||
render () { | ||
render() { | ||
if (this.state.isLoaded) { | ||
const {protocol, hostname, port, pathname, query, loadingElement, ...restProps} = this.props; | ||
const { protocol, hostname, port, pathname, query, loadingElement, ...restProps } = this.props; | ||
@@ -96,3 +97,3 @@ if (this.shouldUseNewBehavior()) { | ||
); | ||
} else {//------------ Deprecated ------------ | ||
} else {// ------------ Deprecated ------------ | ||
return this.props.googleMapElement; | ||
@@ -99,0 +100,0 @@ } |
@@ -32,15 +32,15 @@ import { | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }).filter(function(it){ return it.match(/^get/) && !it.match(/^getMap/); }) | ||
getBounds () { return this.state.circle.getBounds(); } | ||
getBounds() { return this.state.circle.getBounds(); } | ||
getCenter () { return this.state.circle.getCenter(); } | ||
getCenter() { return this.state.circle.getCenter(); } | ||
getDraggable () { return this.state.circle.getDraggable(); } | ||
getDraggable() { return this.state.circle.getDraggable(); } | ||
getEditable () { return this.state.circle.getEditable(); } | ||
getEditable() { return this.state.circle.getEditable(); } | ||
getMap () { return this.state.circle.getMap(); } | ||
getMap() { return this.state.circle.getMap(); } | ||
getRadius () { return this.state.circle.getRadius(); } | ||
getRadius() { return this.state.circle.getRadius(); } | ||
getVisible () { return this.state.circle.getVisible(); } | ||
getVisible() { return this.state.circle.getVisible(); } | ||
// END - Public APIs | ||
@@ -53,3 +53,3 @@ // | ||
componentWillMount () { | ||
componentWillMount() { | ||
if (!canUseDOM) { | ||
@@ -63,3 +63,3 @@ return; | ||
render () { | ||
render() { | ||
if (this.state.circle) { | ||
@@ -66,0 +66,0 @@ return ( |
@@ -8,9 +8,9 @@ import { | ||
import {default as SkeletonEventList} from "../eventLists/SkeletonEventList"; | ||
import {default as eventHandlerCreator} from "../utils/eventHandlerCreator"; | ||
import {default as defaultPropsCreator} from "../utils/defaultPropsCreator"; | ||
import {default as composeOptions} from "../utils/composeOptions"; | ||
import {default as componentLifecycleDecorator} from "../utils/componentLifecycleDecorator"; | ||
import { default as SkeletonEventList } from "../eventLists/SkeletonEventList"; | ||
import { default as eventHandlerCreator } from "../utils/eventHandlerCreator"; | ||
import { default as defaultPropsCreator } from "../utils/defaultPropsCreator"; | ||
import { default as composeOptions } from "../utils/composeOptions"; | ||
import { default as componentLifecycleDecorator } from "../utils/componentLifecycleDecorator"; | ||
import {default as GoogleMapHolder} from "./GoogleMapHolder"; | ||
import { default as GoogleMapHolder } from "./GoogleMapHolder"; | ||
@@ -31,6 +31,6 @@ export const skeletonControlledPropTypes = { | ||
const skeletonUpdaters = { | ||
animation (animation, component) { component.getSkeleton().setAnimation(animation); }, | ||
animation(animation, component) { component.getSkeleton().setAnimation(animation); }, | ||
}; | ||
const {eventPropTypes, registerEvents} = eventHandlerCreator(SkeletonEventList); | ||
const { eventPropTypes, registerEvents } = eventHandlerCreator(SkeletonEventList); | ||
@@ -41,3 +41,3 @@ export const skeletonEventPropTypes = eventPropTypes; | ||
registerEvents, | ||
instanceMethodName: "getSkeleton", | ||
instanceMethodName: `getSkeleton`, | ||
updaters: skeletonUpdaters, | ||
@@ -52,4 +52,4 @@ }) | ||
static _createSkeleton (skeletonProps) { | ||
const {mapHolderRef} = skeletonProps; | ||
static _createSkeleton(skeletonProps) { | ||
const { mapHolderRef } = skeletonProps; | ||
// https://developers.google.com/maps/documentation/javascript/3.exp/reference | ||
@@ -63,10 +63,10 @@ const skeleton = new google.maps.Skeleton(composeOptions(skeletonProps, skeletonControlledPropTypes)); | ||
getSkeleton () { | ||
getSkeleton() { | ||
return this.props.skeleton; | ||
} | ||
render () { | ||
const {children} = this.props; | ||
render() { | ||
const { children } = this.props; | ||
if (0 < Children.count(children)) { | ||
if (Children.count(children) > 0) { | ||
return ( | ||
@@ -73,0 +73,0 @@ <div>{children}</div> |
@@ -7,9 +7,9 @@ import { | ||
import {default as CircleEventList} from "../eventLists/CircleEventList"; | ||
import {default as eventHandlerCreator} from "../utils/eventHandlerCreator"; | ||
import {default as defaultPropsCreator} from "../utils/defaultPropsCreator"; | ||
import {default as composeOptions} from "../utils/composeOptions"; | ||
import {default as componentLifecycleDecorator} from "../utils/componentLifecycleDecorator"; | ||
import { default as CircleEventList } from "../eventLists/CircleEventList"; | ||
import { default as eventHandlerCreator } from "../utils/eventHandlerCreator"; | ||
import { default as defaultPropsCreator } from "../utils/defaultPropsCreator"; | ||
import { default as composeOptions } from "../utils/composeOptions"; | ||
import { default as componentLifecycleDecorator } from "../utils/componentLifecycleDecorator"; | ||
import {default as GoogleMapHolder} from "./GoogleMapHolder"; | ||
import { default as GoogleMapHolder } from "./GoogleMapHolder"; | ||
@@ -35,11 +35,11 @@ export const circleControlledPropTypes = { | ||
const circleUpdaters = { | ||
center (center, component) { component.getCircle().setCenter(center); }, | ||
draggable (draggable, component) { component.getCircle().setDraggable(draggable); }, | ||
editable (editable, component) { component.getCircle().setEditable(editable); }, | ||
options (options, component) { component.getCircle().setOptions(options); }, | ||
radius (radius, component) { component.getCircle().setRadius(radius); }, | ||
visible (visible, component) { component.getCircle().setVisible(visible); }, | ||
center(center, component) { component.getCircle().setCenter(center); }, | ||
draggable(draggable, component) { component.getCircle().setDraggable(draggable); }, | ||
editable(editable, component) { component.getCircle().setEditable(editable); }, | ||
options(options, component) { component.getCircle().setOptions(options); }, | ||
radius(radius, component) { component.getCircle().setRadius(radius); }, | ||
visible(visible, component) { component.getCircle().setVisible(visible); }, | ||
}; | ||
const {eventPropTypes, registerEvents} = eventHandlerCreator(CircleEventList); | ||
const { eventPropTypes, registerEvents } = eventHandlerCreator(CircleEventList); | ||
@@ -50,3 +50,3 @@ export const circleEventPropTypes = eventPropTypes; | ||
registerEvents, | ||
instanceMethodName: "getCircle", | ||
instanceMethodName: `getCircle`, | ||
updaters: circleUpdaters, | ||
@@ -61,4 +61,4 @@ }) | ||
static _createCircle (circleProps) { | ||
const {mapHolderRef} = circleProps; | ||
static _createCircle(circleProps) { | ||
const { mapHolderRef } = circleProps; | ||
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#Circle | ||
@@ -72,9 +72,9 @@ const circle = new google.maps.Circle(composeOptions(circleProps, circleControlledPropTypes)); | ||
getCircle () { | ||
getCircle() { | ||
return this.props.circle; | ||
} | ||
render () { | ||
render() { | ||
return (<noscript />); | ||
} | ||
} |
@@ -8,9 +8,9 @@ import { | ||
import {default as DirectionsRendererEventList} from "../eventLists/DirectionsRendererEventList"; | ||
import {default as eventHandlerCreator} from "../utils/eventHandlerCreator"; | ||
import {default as defaultPropsCreator} from "../utils/defaultPropsCreator"; | ||
import {default as composeOptions} from "../utils/composeOptions"; | ||
import {default as componentLifecycleDecorator} from "../utils/componentLifecycleDecorator"; | ||
import { default as DirectionsRendererEventList } from "../eventLists/DirectionsRendererEventList"; | ||
import { default as eventHandlerCreator } from "../utils/eventHandlerCreator"; | ||
import { default as defaultPropsCreator } from "../utils/defaultPropsCreator"; | ||
import { default as composeOptions } from "../utils/composeOptions"; | ||
import { default as componentLifecycleDecorator } from "../utils/componentLifecycleDecorator"; | ||
import {default as GoogleMapHolder} from "./GoogleMapHolder"; | ||
import { default as GoogleMapHolder } from "./GoogleMapHolder"; | ||
@@ -34,9 +34,9 @@ export const directionsRendererControlledPropTypes = { | ||
const directionsRendererUpdaters = { | ||
directions (directions, component) { component.getDirectionsRenderer().setDirections(directions); }, | ||
options (options, component) { component.getDirectionsRenderer().setOptions(options); }, | ||
panel (panel, component) { component.getDirectionsRenderer().setPanel(panel); }, | ||
routeIndex (routeIndex, component) { component.getDirectionsRenderer().setRouteIndex(routeIndex); }, | ||
directions(directions, component) { component.getDirectionsRenderer().setDirections(directions); }, | ||
options(options, component) { component.getDirectionsRenderer().setOptions(options); }, | ||
panel(panel, component) { component.getDirectionsRenderer().setPanel(panel); }, | ||
routeIndex(routeIndex, component) { component.getDirectionsRenderer().setRouteIndex(routeIndex); }, | ||
}; | ||
const {eventPropTypes, registerEvents} = eventHandlerCreator(DirectionsRendererEventList); | ||
const { eventPropTypes, registerEvents } = eventHandlerCreator(DirectionsRendererEventList); | ||
@@ -47,3 +47,3 @@ export const directionsRendererEventPropTypes = eventPropTypes; | ||
registerEvents, | ||
instanceMethodName: "getDirectionsRenderer", | ||
instanceMethodName: `getDirectionsRenderer`, | ||
updaters: directionsRendererUpdaters, | ||
@@ -58,4 +58,4 @@ }) | ||
static _createDirectionsRenderer (directionsRendererProps) { | ||
const {mapHolderRef} = directionsRendererProps; | ||
static _createDirectionsRenderer(directionsRendererProps) { | ||
const { mapHolderRef } = directionsRendererProps; | ||
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#DirectionsRenderer | ||
@@ -69,10 +69,10 @@ const directionsRenderer = new google.maps.DirectionsRenderer(composeOptions(directionsRendererProps, directionsRendererControlledPropTypes)); | ||
getDirectionsRenderer () { | ||
getDirectionsRenderer() { | ||
return this.props.directionsRenderer; | ||
} | ||
render () { | ||
const {children} = this.props; | ||
render() { | ||
const { children } = this.props; | ||
if (0 < Children.count(children)) { | ||
if (Children.count(children) > 0) { | ||
// TODO: take a look at DirectionsRendererOptions#infoWindow and DirectionsRendererOptions#markerOptions ? | ||
@@ -79,0 +79,0 @@ return ( |
@@ -7,9 +7,9 @@ import { | ||
import {default as DrawingManagerEventList} from "../eventLists/DrawingManagerEventList"; | ||
import {default as eventHandlerCreator} from "../utils/eventHandlerCreator"; | ||
import {default as defaultPropsCreator} from "../utils/defaultPropsCreator"; | ||
import {default as composeOptions} from "../utils/composeOptions"; | ||
import {default as componentLifecycleDecorator} from "../utils/componentLifecycleDecorator"; | ||
import { default as DrawingManagerEventList } from "../eventLists/DrawingManagerEventList"; | ||
import { default as eventHandlerCreator } from "../utils/eventHandlerCreator"; | ||
import { default as defaultPropsCreator } from "../utils/defaultPropsCreator"; | ||
import { default as composeOptions } from "../utils/composeOptions"; | ||
import { default as componentLifecycleDecorator } from "../utils/componentLifecycleDecorator"; | ||
import {default as GoogleMapHolder} from "./GoogleMapHolder"; | ||
import { default as GoogleMapHolder } from "./GoogleMapHolder"; | ||
@@ -31,7 +31,7 @@ export const drawingManagerControlledPropTypes = { | ||
const drawingManagerUpdaters = { | ||
drawingMode (drawingMode, component) { component.getDrawingManager().setDrawingMode(drawingMode); }, | ||
options (options, component) { component.getDrawingManager().setOptions(options); }, | ||
drawingMode(drawingMode, component) { component.getDrawingManager().setDrawingMode(drawingMode); }, | ||
options(options, component) { component.getDrawingManager().setOptions(options); }, | ||
}; | ||
const {eventPropTypes, registerEvents} = eventHandlerCreator(DrawingManagerEventList); | ||
const { eventPropTypes, registerEvents } = eventHandlerCreator(DrawingManagerEventList); | ||
@@ -42,3 +42,3 @@ export const drawingManagerEventPropTypes = eventPropTypes; | ||
registerEvents, | ||
instanceMethodName: "getDrawingManager", | ||
instanceMethodName: `getDrawingManager`, | ||
updaters: drawingManagerUpdaters, | ||
@@ -53,4 +53,4 @@ }) | ||
static _createDrawingManager (drawingManagerProps) { | ||
const {mapHolderRef} = drawingManagerProps; | ||
static _createDrawingManager(drawingManagerProps) { | ||
const { mapHolderRef } = drawingManagerProps; | ||
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#DrawingManager | ||
@@ -64,9 +64,9 @@ const drawingManager = new google.maps.drawing.DrawingManager(composeOptions(drawingManagerProps, drawingManagerControlledPropTypes)); | ||
getDrawingManager () { | ||
getDrawingManager() { | ||
return this.props.drawingManager; | ||
} | ||
render () { | ||
render() { | ||
return (<noscript />); | ||
} | ||
} |
@@ -12,7 +12,7 @@ import { | ||
import {default as GoogleMapEventList} from "../eventLists/GoogleMapEventList"; | ||
import {default as eventHandlerCreator} from "../utils/eventHandlerCreator"; | ||
import {default as defaultPropsCreator} from "../utils/defaultPropsCreator"; | ||
import {default as composeOptions} from "../utils/composeOptions"; | ||
import {default as componentLifecycleDecorator} from "../utils/componentLifecycleDecorator"; | ||
import { default as GoogleMapEventList } from "../eventLists/GoogleMapEventList"; | ||
import { default as eventHandlerCreator } from "../utils/eventHandlerCreator"; | ||
import { default as defaultPropsCreator } from "../utils/defaultPropsCreator"; | ||
import { default as composeOptions } from "../utils/composeOptions"; | ||
import { default as componentLifecycleDecorator } from "../utils/componentLifecycleDecorator"; | ||
@@ -39,12 +39,12 @@ export const mapControlledPropTypes = { | ||
const mapUpdaters = { | ||
center (center, component) { component.getMap().setCenter(center); }, | ||
heading (heading, component) { component.getMap().setHeading(heading); }, | ||
mapTypeId (mapTypeId, component) { component.getMap().setMapTypeId(mapTypeId); }, | ||
options (options, component) { component.getMap().setOptions(options); }, | ||
streetView (streetView, component) { component.getMap().setStreetView(streetView); }, | ||
tilt (tilt, component) { component.getMap().setTilt(tilt); }, | ||
zoom (zoom, component) { component.getMap().setZoom(zoom); }, | ||
center(center, component) { component.getMap().setCenter(center); }, | ||
heading(heading, component) { component.getMap().setHeading(heading); }, | ||
mapTypeId(mapTypeId, component) { component.getMap().setMapTypeId(mapTypeId); }, | ||
options(options, component) { component.getMap().setOptions(options); }, | ||
streetView(streetView, component) { component.getMap().setStreetView(streetView); }, | ||
tilt(tilt, component) { component.getMap().setTilt(tilt); }, | ||
zoom(zoom, component) { component.getMap().setZoom(zoom); }, | ||
}; | ||
const {eventPropTypes, registerEvents} = eventHandlerCreator(GoogleMapEventList); | ||
const { eventPropTypes, registerEvents } = eventHandlerCreator(GoogleMapEventList); | ||
@@ -55,3 +55,3 @@ export const mapEventPropTypes = eventPropTypes; | ||
registerEvents, | ||
instanceMethodName: "getMap", | ||
instanceMethodName: `getMap`, | ||
updaters: mapUpdaters, | ||
@@ -65,3 +65,3 @@ }) | ||
static _createMap (domEl, mapProps) { | ||
static _createMap(domEl, mapProps) { | ||
warning(`undefined` !== typeof google, | ||
@@ -76,7 +76,7 @@ `Make sure you've put a <script> tag in your <head> element to load Google Maps JavaScript API v3. | ||
getMap () { | ||
getMap() { | ||
return this.props.map; | ||
} | ||
render () { | ||
render() { | ||
return ( | ||
@@ -83,0 +83,0 @@ <div> |
@@ -7,10 +7,10 @@ import { | ||
import {default as InfoWindowEventList} from "../eventLists/InfoWindowEventList"; | ||
import {default as eventHandlerCreator} from "../utils/eventHandlerCreator"; | ||
import {default as defaultPropsCreator} from "../utils/defaultPropsCreator"; | ||
import {default as composeOptions} from "../utils/composeOptions"; | ||
import {default as setContentForOptionalReactElement} from "../utils/setContentForOptionalReactElement"; | ||
import {default as componentLifecycleDecorator} from "../utils/componentLifecycleDecorator"; | ||
import { default as InfoWindowEventList } from "../eventLists/InfoWindowEventList"; | ||
import { default as eventHandlerCreator } from "../utils/eventHandlerCreator"; | ||
import { default as defaultPropsCreator } from "../utils/defaultPropsCreator"; | ||
import { default as composeOptions } from "../utils/composeOptions"; | ||
import { default as setContentForOptionalReactElement } from "../utils/setContentForOptionalReactElement"; | ||
import { default as componentLifecycleDecorator } from "../utils/componentLifecycleDecorator"; | ||
import {default as GoogleMapHolder} from "./GoogleMapHolder"; | ||
import { default as GoogleMapHolder } from "./GoogleMapHolder"; | ||
@@ -34,10 +34,10 @@ export const infoWindowControlledPropTypes = { | ||
const infoWindowUpdaters = { | ||
children (children, component) { setContentForOptionalReactElement(children, component.getInfoWindow()); }, | ||
content (content, component) { component.getInfoWindow().setContent(content); }, | ||
options (options, component) { component.getInfoWindow().setOptions(options); }, | ||
position (position, component) { component.getInfoWindow().setPosition(position); }, | ||
zIndex (zIndex, component) { component.getInfoWindow().setZIndex(zIndex); }, | ||
children(children, component) { setContentForOptionalReactElement(children, component.getInfoWindow()); }, | ||
content(content, component) { component.getInfoWindow().setContent(content); }, | ||
options(options, component) { component.getInfoWindow().setOptions(options); }, | ||
position(position, component) { component.getInfoWindow().setPosition(position); }, | ||
zIndex(zIndex, component) { component.getInfoWindow().setZIndex(zIndex); }, | ||
}; | ||
const {eventPropTypes, registerEvents} = eventHandlerCreator(InfoWindowEventList); | ||
const { eventPropTypes, registerEvents } = eventHandlerCreator(InfoWindowEventList); | ||
@@ -48,3 +48,3 @@ export const infoWindowEventPropTypes = eventPropTypes; | ||
registerEvents, | ||
instanceMethodName: "getInfoWindow", | ||
instanceMethodName: `getInfoWindow`, | ||
updaters: infoWindowUpdaters, | ||
@@ -60,4 +60,4 @@ }) | ||
static _createInfoWindow (infoWindowProps) { | ||
const {mapHolderRef, anchorHolderRef} = infoWindowProps; | ||
static _createInfoWindow(infoWindowProps) { | ||
const { mapHolderRef, anchorHolderRef } = infoWindowProps; | ||
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#InfoWindow | ||
@@ -79,9 +79,9 @@ const infoWindow = new google.maps.InfoWindow(composeOptions(infoWindowProps, infoWindowControlledPropTypes)); | ||
getInfoWindow () { | ||
getInfoWindow() { | ||
return this.props.infoWindow; | ||
} | ||
render () { | ||
render() { | ||
return (<noscript />); | ||
} | ||
} |
@@ -8,9 +8,9 @@ import { | ||
import {default as MarkerEventList} from "../eventLists/MarkerEventList"; | ||
import {default as eventHandlerCreator} from "../utils/eventHandlerCreator"; | ||
import {default as defaultPropsCreator} from "../utils/defaultPropsCreator"; | ||
import {default as composeOptions} from "../utils/composeOptions"; | ||
import {default as componentLifecycleDecorator} from "../utils/componentLifecycleDecorator"; | ||
import { default as MarkerEventList } from "../eventLists/MarkerEventList"; | ||
import { default as eventHandlerCreator } from "../utils/eventHandlerCreator"; | ||
import { default as defaultPropsCreator } from "../utils/defaultPropsCreator"; | ||
import { default as composeOptions } from "../utils/composeOptions"; | ||
import { default as componentLifecycleDecorator } from "../utils/componentLifecycleDecorator"; | ||
import {default as GoogleMapHolder} from "./GoogleMapHolder"; | ||
import { default as GoogleMapHolder } from "./GoogleMapHolder"; | ||
@@ -45,20 +45,20 @@ export const markerControlledPropTypes = { | ||
const markerUpdaters = { | ||
animation (animation, component) { component.getMarker().setAnimation(animation); }, | ||
attribution (attribution, component) { component.getMarker().setAttribution(attribution); }, | ||
clickable (clickable, component) { component.getMarker().setClickable(clickable); }, | ||
cursor (cursor, component) { component.getMarker().setCursor(cursor); }, | ||
draggable (draggable, component) { component.getMarker().setDraggable(draggable); }, | ||
icon (icon, component) { component.getMarker().setIcon(icon); }, | ||
label (label, component) { component.getMarker().setLabel(label); }, | ||
opacity (opacity, component) { component.getMarker().setOpacity(opacity); }, | ||
options (options, component) { component.getMarker().setOptions(options); }, | ||
place (place, component) { component.getMarker().setPlace(place); }, | ||
position (position, component) { component.getMarker().setPosition(position); }, | ||
shape (shape, component) { component.getMarker().setShape(shape); }, | ||
title (title, component) { component.getMarker().setTitle(title); }, | ||
visible (visible, component) { component.getMarker().setVisible(visible); }, | ||
zIndex (zIndex, component) { component.getMarker().setZIndex(zIndex); }, | ||
animation(animation, component) { component.getMarker().setAnimation(animation); }, | ||
attribution(attribution, component) { component.getMarker().setAttribution(attribution); }, | ||
clickable(clickable, component) { component.getMarker().setClickable(clickable); }, | ||
cursor(cursor, component) { component.getMarker().setCursor(cursor); }, | ||
draggable(draggable, component) { component.getMarker().setDraggable(draggable); }, | ||
icon(icon, component) { component.getMarker().setIcon(icon); }, | ||
label(label, component) { component.getMarker().setLabel(label); }, | ||
opacity(opacity, component) { component.getMarker().setOpacity(opacity); }, | ||
options(options, component) { component.getMarker().setOptions(options); }, | ||
place(place, component) { component.getMarker().setPlace(place); }, | ||
position(position, component) { component.getMarker().setPosition(position); }, | ||
shape(shape, component) { component.getMarker().setShape(shape); }, | ||
title(title, component) { component.getMarker().setTitle(title); }, | ||
visible(visible, component) { component.getMarker().setVisible(visible); }, | ||
zIndex(zIndex, component) { component.getMarker().setZIndex(zIndex); }, | ||
}; | ||
const {eventPropTypes, registerEvents} = eventHandlerCreator(MarkerEventList); | ||
const { eventPropTypes, registerEvents } = eventHandlerCreator(MarkerEventList); | ||
@@ -69,3 +69,3 @@ export const markerEventPropTypes = eventPropTypes; | ||
registerEvents, | ||
instanceMethodName: "getMarker", | ||
instanceMethodName: `getMarker`, | ||
updaters: markerUpdaters, | ||
@@ -80,4 +80,4 @@ }) | ||
static _createMarker (markerProps) { | ||
const {mapHolderRef, anchorHolderRef} = markerProps; | ||
static _createMarker(markerProps) { | ||
const { mapHolderRef, anchorHolderRef } = markerProps; | ||
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#Marker | ||
@@ -87,3 +87,3 @@ const marker = new google.maps.Marker(composeOptions(markerProps, markerControlledPropTypes)); | ||
if (anchorHolderRef) { | ||
if ("MarkerClusterer" === anchorHolderRef.getAnchorType()) { | ||
if (`MarkerClusterer` === anchorHolderRef.getAnchorType()) { | ||
anchorHolderRef.getAnchor().addMarker(marker); | ||
@@ -98,3 +98,3 @@ } | ||
getMarker () { | ||
getMarker() { | ||
return this.props.marker; | ||
@@ -105,10 +105,10 @@ } | ||
// In the core API, the only anchor is the Marker class. | ||
getAnchor () { | ||
getAnchor() { | ||
return this.props.marker; | ||
} | ||
render () { | ||
const {mapHolderRef, children} = this.props; | ||
render() { | ||
const { mapHolderRef, children } = this.props; | ||
if (0 < Children.count(children)) { | ||
if (Children.count(children) > 0) { | ||
return ( | ||
@@ -115,0 +115,0 @@ <div>{Children.map(children, childElement => |
@@ -13,8 +13,8 @@ import { | ||
import {default as invariant} from "invariant"; | ||
import { default as invariant } from "invariant"; | ||
import {default as defaultPropsCreator} from "../utils/defaultPropsCreator"; | ||
import {default as composeOptions} from "../utils/composeOptions"; | ||
import { default as defaultPropsCreator } from "../utils/defaultPropsCreator"; | ||
import { default as composeOptions } from "../utils/composeOptions"; | ||
import {default as GoogleMapHolder} from "./GoogleMapHolder"; | ||
import { default as GoogleMapHolder } from "./GoogleMapHolder"; | ||
@@ -42,7 +42,7 @@ export const overlayViewControlledPropTypes = { | ||
mapHolderRef: PropTypes.instanceOf(GoogleMapHolder).isRequired, | ||
mapPaneName: PropTypes.string, | ||
overlayView: PropTypes.object.isRequired, | ||
} | ||
static _createOverlayView (overlayViewProps) { | ||
const {mapHolderRef} = overlayViewProps; | ||
static _createOverlayView(overlayViewProps) { | ||
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#OverlayView | ||
@@ -52,8 +52,8 @@ const overlayView = new google.maps.OverlayView(); | ||
overlayView.onAdd = function () { | ||
this._containerElement = document.createElement("div"); | ||
this._containerElement.style.position = "absolute"; | ||
overlayView.onAdd = function onAdd() { | ||
this._containerElement = document.createElement(`div`); | ||
this._containerElement.style.position = `absolute`; | ||
}; | ||
overlayView.draw = function () { | ||
overlayView.draw = function draw() { | ||
this._renderContent(); | ||
@@ -64,3 +64,3 @@ this._mountContainerToPane(); | ||
overlayView.onRemove = function () { | ||
overlayView.onRemove = function onRemove() { | ||
unmountComponentAtNode(this._containerElement); | ||
@@ -71,3 +71,3 @@ this._unmountContainerFromPane(); | ||
overlayView._redraw = function (mapPaneNameChanged) { | ||
overlayView._redraw = function _redraw(mapPaneNameChanged) { | ||
this._renderContent(); | ||
@@ -81,5 +81,5 @@ if (mapPaneNameChanged) { | ||
overlayView._renderContent = function () { | ||
overlayView._renderContent = function _renderContent() { | ||
render( | ||
Children.only(this.get("children")), | ||
Children.only(this.get(`children`)), | ||
this._containerElement | ||
@@ -89,5 +89,5 @@ ); | ||
overlayView._mountContainerToPane = function () { | ||
const mapPaneName = this.get("mapPaneName"); | ||
invariant(!!mapPaneName, "OverlayView requires a mapPaneName/defaultMapPaneName in your props instead of %s", mapPaneName); | ||
overlayView._mountContainerToPane = function _mountContainerToPane() { | ||
const mapPaneName = this.get(`mapPaneName`); | ||
invariant(!!mapPaneName, `OverlayView requires a mapPaneName/defaultMapPaneName in your props instead of %s`, mapPaneName); | ||
@@ -97,12 +97,13 @@ this.getPanes()[mapPaneName].appendChild(this._containerElement); | ||
overlayView._unmountContainerFromPane = function () { | ||
overlayView._unmountContainerFromPane = function _unmountContainerFromPane() { | ||
this._containerElement.parentNode.removeChild(this._containerElement); | ||
}; | ||
overlayView._positionContainerElement = function () { | ||
let left, top; | ||
let position = this._getPixelPosition(); | ||
overlayView._positionContainerElement = function _positionContainerElement() { | ||
let left; | ||
let top; | ||
const position = this._getPixelPosition(); | ||
if (position) { | ||
let {x, y} = position; | ||
let offset = this._getOffset(); | ||
let { x, y } = position; | ||
const offset = this._getOffset(); | ||
if (offset) { | ||
@@ -112,4 +113,4 @@ x += offset.x; | ||
} | ||
left = x + "px"; | ||
top = y + "px"; | ||
left = x + `px`; | ||
top = y + `px`; | ||
} | ||
@@ -120,6 +121,6 @@ this._containerElement.style.left = left; | ||
overlayView._getPixelPosition = function () { | ||
let projection = this.getProjection(); | ||
let position = this.get("position"); | ||
invariant(!!position, "OverlayView requires a position/defaultPosition in your props instead of %s", position); | ||
overlayView._getPixelPosition = function _getPixelPosition() { | ||
const projection = this.getProjection(); | ||
let position = this.get(`position`); | ||
invariant(!!position, `OverlayView requires a position/defaultPosition in your props instead of %s`, position); | ||
@@ -134,6 +135,6 @@ if (projection && position) { | ||
overlayView._getOffset = function () { | ||
overlayView._getOffset = function _getOffset() { | ||
// Allows the component to control the visual position of the OverlayView | ||
// relative to the LatLng pixel position. | ||
let getPixelPositionOffset = this.get("getPixelPositionOffset"); | ||
const getPixelPositionOffset = this.get(`getPixelPositionOffset`); | ||
if (getPixelPositionOffset) { | ||
@@ -150,11 +151,11 @@ return getPixelPositionOffset( | ||
getOverlayView () { | ||
getOverlayView() { | ||
return this.props.overlayView; | ||
} | ||
componentDidMount () { | ||
componentDidMount() { | ||
this.getOverlayView().setMap(this.props.mapHolderRef.getMap()); | ||
} | ||
componentDidUpdate (prevProps) { | ||
componentDidUpdate(prevProps) { | ||
this.getOverlayView().setValues(this.props); | ||
@@ -164,9 +165,9 @@ this.getOverlayView()._redraw(this.props.mapPaneName !== prevProps.mapPaneName); | ||
componentWillUnmount () { | ||
componentWillUnmount() { | ||
this.getOverlayView().setMap(null); | ||
} | ||
render () { | ||
render() { | ||
return (<noscript />); | ||
} | ||
} |
@@ -7,9 +7,9 @@ import { | ||
import {default as PolygonEventList} from "../eventLists/PolygonEventList"; | ||
import {default as eventHandlerCreator} from "../utils/eventHandlerCreator"; | ||
import {default as defaultPropsCreator} from "../utils/defaultPropsCreator"; | ||
import {default as composeOptions} from "../utils/composeOptions"; | ||
import {default as componentLifecycleDecorator} from "../utils/componentLifecycleDecorator"; | ||
import { default as PolygonEventList } from "../eventLists/PolygonEventList"; | ||
import { default as eventHandlerCreator } from "../utils/eventHandlerCreator"; | ||
import { default as defaultPropsCreator } from "../utils/defaultPropsCreator"; | ||
import { default as composeOptions } from "../utils/composeOptions"; | ||
import { default as componentLifecycleDecorator } from "../utils/componentLifecycleDecorator"; | ||
import {default as GoogleMapHolder} from "./GoogleMapHolder"; | ||
import { default as GoogleMapHolder } from "./GoogleMapHolder"; | ||
@@ -35,11 +35,11 @@ export const polygonControlledPropTypes = { | ||
const polygonUpdaters = { | ||
draggable (draggable, component) { component.getPolygon().setDraggable(draggable); }, | ||
editable (editable, component) { component.getPolygon().setEditable(editable); }, | ||
options (options, component) { component.getPolygon().setOptions(options); }, | ||
path (path, component) { component.getPolygon().setPath(path); }, | ||
paths (paths, component) { component.getPolygon().setPaths(paths); }, | ||
visible (visible, component) { component.getPolygon().setVisible(visible); }, | ||
draggable(draggable, component) { component.getPolygon().setDraggable(draggable); }, | ||
editable(editable, component) { component.getPolygon().setEditable(editable); }, | ||
options(options, component) { component.getPolygon().setOptions(options); }, | ||
path(path, component) { component.getPolygon().setPath(path); }, | ||
paths(paths, component) { component.getPolygon().setPaths(paths); }, | ||
visible(visible, component) { component.getPolygon().setVisible(visible); }, | ||
}; | ||
const {eventPropTypes, registerEvents} = eventHandlerCreator(PolygonEventList); | ||
const { eventPropTypes, registerEvents } = eventHandlerCreator(PolygonEventList); | ||
@@ -50,3 +50,3 @@ export const polygonEventPropTypes = eventPropTypes; | ||
registerEvents, | ||
instanceMethodName: "getPolygon", | ||
instanceMethodName: `getPolygon`, | ||
updaters: polygonUpdaters, | ||
@@ -61,4 +61,4 @@ }) | ||
static _createPolygon (polygonProps) { | ||
const {mapHolderRef} = polygonProps; | ||
static _createPolygon(polygonProps) { | ||
const { mapHolderRef } = polygonProps; | ||
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#Polygon | ||
@@ -72,9 +72,9 @@ const polygon = new google.maps.Polygon(composeOptions(polygonProps, polygonControlledPropTypes)); | ||
getPolygon () { | ||
getPolygon() { | ||
return this.props.polygon; | ||
} | ||
render () { | ||
render() { | ||
return (<noscript />); | ||
} | ||
} |
@@ -7,9 +7,9 @@ import { | ||
import {default as PolylineEventList} from "../eventLists/PolylineEventList"; | ||
import {default as eventHandlerCreator} from "../utils/eventHandlerCreator"; | ||
import {default as defaultPropsCreator} from "../utils/defaultPropsCreator"; | ||
import {default as composeOptions} from "../utils/composeOptions"; | ||
import {default as componentLifecycleDecorator} from "../utils/componentLifecycleDecorator"; | ||
import { default as PolylineEventList } from "../eventLists/PolylineEventList"; | ||
import { default as eventHandlerCreator } from "../utils/eventHandlerCreator"; | ||
import { default as defaultPropsCreator } from "../utils/defaultPropsCreator"; | ||
import { default as composeOptions } from "../utils/composeOptions"; | ||
import { default as componentLifecycleDecorator } from "../utils/componentLifecycleDecorator"; | ||
import {default as GoogleMapHolder} from "./GoogleMapHolder"; | ||
import { default as GoogleMapHolder } from "./GoogleMapHolder"; | ||
@@ -34,10 +34,10 @@ export const polylineControlledPropTypes = { | ||
const polylineUpdaters = { | ||
draggable (draggable, component) { component.getPolyline().setDraggable(draggable); }, | ||
editable (editable, component) { component.getPolyline().setEditable(editable); }, | ||
options (options, component) { component.getPolyline().setOptions(options); }, | ||
path (path, component) { component.getPolyline().setPath(path); }, | ||
visible (visible, component) { component.getPolyline().setVisible(visible); }, | ||
draggable(draggable, component) { component.getPolyline().setDraggable(draggable); }, | ||
editable(editable, component) { component.getPolyline().setEditable(editable); }, | ||
options(options, component) { component.getPolyline().setOptions(options); }, | ||
path(path, component) { component.getPolyline().setPath(path); }, | ||
visible(visible, component) { component.getPolyline().setVisible(visible); }, | ||
}; | ||
const {eventPropTypes, registerEvents} = eventHandlerCreator(PolylineEventList); | ||
const { eventPropTypes, registerEvents } = eventHandlerCreator(PolylineEventList); | ||
@@ -48,3 +48,3 @@ export const polylineEventPropTypes = eventPropTypes; | ||
registerEvents, | ||
instanceMethodName: "getPolyline", | ||
instanceMethodName: `getPolyline`, | ||
updaters: polylineUpdaters, | ||
@@ -59,4 +59,4 @@ }) | ||
static _createPolyline (polylineProps) { | ||
const {mapHolderRef} = polylineProps; | ||
static _createPolyline(polylineProps) { | ||
const { mapHolderRef } = polylineProps; | ||
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#Polyline | ||
@@ -70,9 +70,9 @@ const polyline = new google.maps.Polyline(composeOptions(polylineProps, polylineControlledPropTypes)); | ||
getPolyline () { | ||
getPolyline() { | ||
return this.props.polyline; | ||
} | ||
render () { | ||
render() { | ||
return (<noscript />); | ||
} | ||
} |
@@ -5,12 +5,11 @@ import { | ||
Component, | ||
Children, | ||
} from "react"; | ||
import {default as RectangleEventList} from "../eventLists/RectangleEventList"; | ||
import {default as eventHandlerCreator} from "../utils/eventHandlerCreator"; | ||
import {default as defaultPropsCreator} from "../utils/defaultPropsCreator"; | ||
import {default as composeOptions} from "../utils/composeOptions"; | ||
import {default as componentLifecycleDecorator} from "../utils/componentLifecycleDecorator"; | ||
import { default as RectangleEventList } from "../eventLists/RectangleEventList"; | ||
import { default as eventHandlerCreator } from "../utils/eventHandlerCreator"; | ||
import { default as defaultPropsCreator } from "../utils/defaultPropsCreator"; | ||
import { default as composeOptions } from "../utils/composeOptions"; | ||
import { default as componentLifecycleDecorator } from "../utils/componentLifecycleDecorator"; | ||
import {default as GoogleMapHolder} from "./GoogleMapHolder"; | ||
import { default as GoogleMapHolder } from "./GoogleMapHolder"; | ||
@@ -35,10 +34,10 @@ export const rectangleControlledPropTypes = { | ||
const rectangleUpdaters = { | ||
bounds (bounds, component) { component.getRectangle().setBounds(bounds); }, | ||
draggable (draggable, component) { component.getRectangle().setDraggable(draggable); }, | ||
editable (editable, component) { component.getRectangle().setEditable(editable); }, | ||
options (options, component) { component.getRectangle().setOptions(options); }, | ||
visible (visible, component) { component.getRectangle().setVisible(visible); }, | ||
bounds(bounds, component) { component.getRectangle().setBounds(bounds); }, | ||
draggable(draggable, component) { component.getRectangle().setDraggable(draggable); }, | ||
editable(editable, component) { component.getRectangle().setEditable(editable); }, | ||
options(options, component) { component.getRectangle().setOptions(options); }, | ||
visible(visible, component) { component.getRectangle().setVisible(visible); }, | ||
}; | ||
const {eventPropTypes, registerEvents} = eventHandlerCreator(RectangleEventList); | ||
const { eventPropTypes, registerEvents } = eventHandlerCreator(RectangleEventList); | ||
@@ -49,3 +48,3 @@ export const rectangleEventPropTypes = eventPropTypes; | ||
registerEvents, | ||
instanceMethodName: "getRectangle", | ||
instanceMethodName: `getRectangle`, | ||
updaters: rectangleUpdaters, | ||
@@ -60,4 +59,4 @@ }) | ||
static _createRectangle (rectangleProps) { | ||
const {mapHolderRef} = rectangleProps; | ||
static _createRectangle(rectangleProps) { | ||
const { mapHolderRef } = rectangleProps; | ||
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#Rectangle | ||
@@ -71,9 +70,9 @@ const rectangle = new google.maps.Rectangle(composeOptions(rectangleProps, rectangleControlledPropTypes)); | ||
getRectangle () { | ||
getRectangle() { | ||
return this.props.rectangle; | ||
} | ||
render () { | ||
render() { | ||
return (<noscript />); | ||
} | ||
} |
@@ -7,9 +7,9 @@ import { | ||
import {default as SearchBoxEventList} from "../eventLists/SearchBoxEventList"; | ||
import {default as eventHandlerCreator} from "../utils/eventHandlerCreator"; | ||
import {default as defaultPropsCreator} from "../utils/defaultPropsCreator"; | ||
import {default as composeOptions} from "../utils/composeOptions"; | ||
import {default as componentLifecycleDecorator} from "../utils/componentLifecycleDecorator"; | ||
import { default as SearchBoxEventList } from "../eventLists/SearchBoxEventList"; | ||
import { default as eventHandlerCreator } from "../utils/eventHandlerCreator"; | ||
import { default as defaultPropsCreator } from "../utils/defaultPropsCreator"; | ||
import { default as composeOptions } from "../utils/composeOptions"; | ||
import { default as componentLifecycleDecorator } from "../utils/componentLifecycleDecorator"; | ||
import {default as GoogleMapHolder} from "./GoogleMapHolder"; | ||
import { default as GoogleMapHolder } from "./GoogleMapHolder"; | ||
@@ -27,6 +27,6 @@ export const searchBoxControlledPropTypes = { | ||
const searchBoxUpdaters = { | ||
bounds (bounds, component) { component.getSearchBox().setBounds(bounds); }, | ||
bounds(bounds, component) { component.getSearchBox().setBounds(bounds); }, | ||
}; | ||
const {eventPropTypes, registerEvents} = eventHandlerCreator(SearchBoxEventList); | ||
const { eventPropTypes, registerEvents } = eventHandlerCreator(SearchBoxEventList); | ||
@@ -37,3 +37,3 @@ export const searchBoxEventPropTypes = eventPropTypes; | ||
registerEvents, | ||
instanceMethodName: "getSearchBox", | ||
instanceMethodName: `getSearchBox`, | ||
updaters: searchBoxUpdaters, | ||
@@ -48,3 +48,3 @@ }) | ||
static _createSearchBox (inputElement, searchBoxProps) { | ||
static _createSearchBox(inputElement, searchBoxProps) { | ||
const searchBox = new google.maps.places.SearchBox(inputElement, composeOptions(searchBoxProps, searchBoxControlledPropTypes)); | ||
@@ -55,7 +55,7 @@ | ||
componentDidMount () { | ||
componentDidMount() { | ||
this._mountComponentToMap(this.props.controlPosition); | ||
} | ||
componentDidUpdate (prevProps) { | ||
componentDidUpdate(prevProps) { | ||
if (this.props.controlPosition !== prevProps.controlPosition) { | ||
@@ -67,8 +67,8 @@ this._unmountComponentFromMap(prevProps.controlPosition); | ||
componentWillUnmount () { | ||
componentWillUnmount() { | ||
this._unmountComponentFromMap(this.props.controlPosition); | ||
} | ||
_mountComponentToMap (controlPosition) { | ||
const {mapHolderRef, inputElement} = this.props; | ||
_mountComponentToMap(controlPosition) { | ||
const { mapHolderRef, inputElement } = this.props; | ||
@@ -78,4 +78,4 @@ mapHolderRef.getMap().controls[controlPosition].push(inputElement); | ||
_unmountComponentFromMap (controlPosition) { | ||
const {mapHolderRef, inputElement} = this.props; | ||
_unmountComponentFromMap(controlPosition) { | ||
const { mapHolderRef, inputElement } = this.props; | ||
@@ -86,9 +86,9 @@ const index = mapHolderRef.getMap().controls[controlPosition].getArray().indexOf(inputElement); | ||
getSearchBox () { | ||
getSearchBox() { | ||
return this.props.searchBox; | ||
} | ||
render () { | ||
render() { | ||
return (<noscript />); | ||
} | ||
} |
@@ -36,7 +36,7 @@ import { | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }).filter(function(it){ return it.match(/^get/) && !it.match(/^getMap/); }) | ||
getDirections () { return this.state.directionsRenderer.getDirections(); } | ||
getDirections() { return this.state.directionsRenderer.getDirections(); } | ||
getPanel () { return this.state.directionsRenderer.getPanel(); } | ||
getPanel() { return this.state.directionsRenderer.getPanel(); } | ||
getRouteIndex () { return this.state.directionsRenderer.getRouteIndex(); } | ||
getRouteIndex() { return this.state.directionsRenderer.getRouteIndex(); } | ||
// END - Public APIs | ||
@@ -49,3 +49,3 @@ // | ||
componentWillMount () { | ||
componentWillMount() { | ||
if (!canUseDOM) { | ||
@@ -59,3 +59,3 @@ return; | ||
render () { | ||
render() { | ||
if (this.state.directionsRenderer) { | ||
@@ -62,0 +62,0 @@ return ( |
@@ -36,3 +36,3 @@ import { | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }).filter(function(it){ return it.match(/^get/) && !it.match(/^getMap/); }) | ||
getDrawingMode () { return this.state.drawingManager.getDrawingMode(); } | ||
getDrawingMode() { return this.state.drawingManager.getDrawingMode(); } | ||
// END - Public APIs | ||
@@ -45,3 +45,3 @@ // | ||
componentWillMount () { | ||
componentWillMount() { | ||
if (!canUseDOM) { | ||
@@ -55,3 +55,3 @@ return; | ||
render () { | ||
render() { | ||
if (this.state.drawingManager) { | ||
@@ -58,0 +58,0 @@ return ( |
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#Circle | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }) | ||
export default [ | ||
"center_changed", | ||
"click", | ||
"dblclick", | ||
"drag", | ||
"dragend", | ||
"dragstart", | ||
"mousedown", | ||
"mousemove", | ||
"mouseout", | ||
"mouseover", | ||
"mouseup", | ||
"radius_changed", | ||
"rightclick", | ||
`center_changed`, | ||
`click`, | ||
`dblclick`, | ||
`drag`, | ||
`dragend`, | ||
`dragstart`, | ||
`mousedown`, | ||
`mousemove`, | ||
`mouseout`, | ||
`mouseover`, | ||
`mouseup`, | ||
`radius_changed`, | ||
`rightclick`, | ||
]; |
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#DirectionsRenderer | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }) | ||
export default [ | ||
"directions_changed", | ||
`directions_changed`, | ||
]; |
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#DrawingManager | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }) | ||
export default [ | ||
"circlecomplete", | ||
"markercomplete", | ||
"overlaycomplete", | ||
"polygoncomplete", | ||
"polylinecomplete", | ||
"rectanglecomplete", | ||
`circlecomplete`, | ||
`markercomplete`, | ||
`overlaycomplete`, | ||
`polygoncomplete`, | ||
`polylinecomplete`, | ||
`rectanglecomplete`, | ||
]; |
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#Map | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }) | ||
export default [ | ||
"bounds_changed", | ||
"center_changed", | ||
"click", | ||
"dblclick", | ||
"drag", | ||
"dragend", | ||
"dragstart", | ||
"heading_changed", | ||
"idle", | ||
"maptypeid_changed", | ||
"mousemove", | ||
"mouseout", | ||
"mouseover", | ||
"projection_changed", | ||
"resize", | ||
"rightclick", | ||
"tilesloaded", | ||
"tilt_changed", | ||
"zoom_changed", | ||
`bounds_changed`, | ||
`center_changed`, | ||
`click`, | ||
`dblclick`, | ||
`drag`, | ||
`dragend`, | ||
`dragstart`, | ||
`heading_changed`, | ||
`idle`, | ||
`maptypeid_changed`, | ||
`mousemove`, | ||
`mouseout`, | ||
`mouseover`, | ||
`projection_changed`, | ||
`resize`, | ||
`rightclick`, | ||
`tilesloaded`, | ||
`tilt_changed`, | ||
`zoom_changed`, | ||
]; |
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#InfoWindow | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }) | ||
export default [ | ||
"closeclick", | ||
"content_changed", | ||
"domready", | ||
"position_changed", | ||
"zindex_changed", | ||
`closeclick`, | ||
`content_changed`, | ||
`domready`, | ||
`position_changed`, | ||
`zindex_changed`, | ||
]; |
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#Marker | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }) | ||
export default [ | ||
"animation_changed", | ||
"click", | ||
"clickable_changed", | ||
"cursor_changed", | ||
"dblclick", | ||
"drag", | ||
"dragend", | ||
"draggable_changed", | ||
"dragstart", | ||
"flat_changed", | ||
"icon_changed", | ||
"mousedown", | ||
"mouseout", | ||
"mouseover", | ||
"mouseup", | ||
"position_changed", | ||
"rightclick", | ||
"shape_changed", | ||
"title_changed", | ||
"visible_changed", | ||
"zindex_changed", | ||
`animation_changed`, | ||
`click`, | ||
`clickable_changed`, | ||
`cursor_changed`, | ||
`dblclick`, | ||
`drag`, | ||
`dragend`, | ||
`draggable_changed`, | ||
`dragstart`, | ||
`flat_changed`, | ||
`icon_changed`, | ||
`mousedown`, | ||
`mouseout`, | ||
`mouseover`, | ||
`mouseup`, | ||
`position_changed`, | ||
`rightclick`, | ||
`shape_changed`, | ||
`title_changed`, | ||
`visible_changed`, | ||
`zindex_changed`, | ||
]; |
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#Polygon | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }) | ||
export default [ | ||
"click", | ||
"dblclick", | ||
"drag", | ||
"dragend", | ||
"dragstart", | ||
"mousedown", | ||
"mousemove", | ||
"mouseout", | ||
"mouseover", | ||
"mouseup", | ||
"rightclick", | ||
`click`, | ||
`dblclick`, | ||
`drag`, | ||
`dragend`, | ||
`dragstart`, | ||
`mousedown`, | ||
`mousemove`, | ||
`mouseout`, | ||
`mouseover`, | ||
`mouseup`, | ||
`rightclick`, | ||
]; |
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#Polyline | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }) | ||
export default [ | ||
"click", | ||
"dblclick", | ||
"drag", | ||
"dragend", | ||
"dragstart", | ||
"mousedown", | ||
"mousemove", | ||
"mouseout", | ||
"mouseover", | ||
"mouseup", | ||
"rightclick", | ||
`click`, | ||
`dblclick`, | ||
`drag`, | ||
`dragend`, | ||
`dragstart`, | ||
`mousedown`, | ||
`mousemove`, | ||
`mouseout`, | ||
`mouseover`, | ||
`mouseup`, | ||
`rightclick`, | ||
]; |
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#Rectangle | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }) | ||
export default [ | ||
"bounds_changed", | ||
"click", | ||
"dblclick", | ||
"drag", | ||
"dragend", | ||
"dragstart", | ||
"mousedown", | ||
"mousemove", | ||
"mouseout", | ||
"mouseover", | ||
"mouseup", | ||
"rightclick", | ||
`bounds_changed`, | ||
`click`, | ||
`dblclick`, | ||
`drag`, | ||
`dragend`, | ||
`dragstart`, | ||
`mousedown`, | ||
`mousemove`, | ||
`mouseout`, | ||
`mouseover`, | ||
`mouseup`, | ||
`rightclick`, | ||
]; |
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#SearchBox | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }) | ||
export default [ | ||
"places_changed", | ||
`places_changed`, | ||
]; |
@@ -42,19 +42,19 @@ import { | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }).filter(function(it){ return it.match(/^get/) && !it.match(/Map$/); }) | ||
getBounds () { return (this.props.map || this.refs.delegate).getBounds(); } | ||
getBounds() { return (this.props.map || this.refs.delegate).getBounds(); } | ||
getCenter () { return (this.props.map || this.refs.delegate).getCenter(); } | ||
getCenter() { return (this.props.map || this.refs.delegate).getCenter(); } | ||
getDiv () { return (this.props.map || this.refs.delegate).getDiv(); } | ||
getDiv() { return (this.props.map || this.refs.delegate).getDiv(); } | ||
getHeading () { return (this.props.map || this.refs.delegate).getHeading(); } | ||
getHeading() { return (this.props.map || this.refs.delegate).getHeading(); } | ||
getMapTypeId () { return (this.props.map || this.refs.delegate).getMapTypeId(); } | ||
getMapTypeId() { return (this.props.map || this.refs.delegate).getMapTypeId(); } | ||
getProjection () { return (this.props.map || this.refs.delegate).getProjection(); } | ||
getProjection() { return (this.props.map || this.refs.delegate).getProjection(); } | ||
getStreetView () { return (this.props.map || this.refs.delegate).getStreetView(); } | ||
getStreetView() { return (this.props.map || this.refs.delegate).getStreetView(); } | ||
getTilt () { return (this.props.map || this.refs.delegate).getTilt(); } | ||
getTilt() { return (this.props.map || this.refs.delegate).getTilt(); } | ||
getZoom () { return (this.props.map || this.refs.delegate).getZoom(); } | ||
getZoom() { return (this.props.map || this.refs.delegate).getZoom(); } | ||
// END - Public APIs | ||
@@ -70,9 +70,9 @@ // | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }).filter(function(it){ return !it.match(/^get/) && !it.match(/^set/) && !it.match(/Map$/); }) | ||
fitBounds (bounds) { return (this.props.map || this.refs.delegate).fitBounds(bounds); } | ||
fitBounds(bounds) { return (this.props.map || this.refs.delegate).fitBounds(bounds); } | ||
panBy (x, y) { return (this.props.map || this.refs.delegate).panBy(x, y); } | ||
panBy(x, y) { return (this.props.map || this.refs.delegate).panBy(x, y); } | ||
panTo (latLng) { return (this.props.map || this.refs.delegate).panTo(latLng); } | ||
panTo(latLng) { return (this.props.map || this.refs.delegate).panTo(latLng); } | ||
panToBounds (latLngBounds) { return (this.props.map || this.refs.delegate).panToBounds(latLngBounds); } | ||
panToBounds(latLngBounds) { return (this.props.map || this.refs.delegate).panToBounds(latLngBounds); } | ||
// END - Public APIs - Use this carefully | ||
@@ -82,8 +82,8 @@ // | ||
componentWillMount () { | ||
const {containerTagName} = this.props; | ||
componentWillMount() { | ||
const { containerTagName } = this.props; | ||
const isUsingNewBehavior = USE_NEW_BEHAVIOR_TAG_NAME === containerTagName; | ||
warning(isUsingNewBehavior, | ||
`"GoogleMap" with containerTagName is deprecated now and will be removed in next major release (5.0.0). | ||
`"GoogleMap" with containerTagName is deprecated now and will be removed in next major release (5.0.0). | ||
Use "GoogleMapLoader" instead. See https://github.com/tomchentw/react-google-maps/pull/157 for more details.` | ||
@@ -93,4 +93,4 @@ ); | ||
render () { | ||
const {containerTagName, containerProps = {}, children, ...mapProps} = this.props; | ||
render() { | ||
const { containerTagName, containerProps = {}, children, ...mapProps } = this.props; | ||
const isUsingNewBehavior = USE_NEW_BEHAVIOR_TAG_NAME === containerTagName; | ||
@@ -104,4 +104,4 @@ | ||
); | ||
} else {//------------ Deprecated ------------ | ||
const realContainerTagName = null == containerTagName ? `div` : containerTagName; | ||
} else {// ------------ Deprecated ------------ | ||
const realContainerTagName = (containerTagName === undefined || containerTagName === null) ? `div` : containerTagName; | ||
@@ -108,0 +108,0 @@ return ( |
@@ -8,6 +8,2 @@ import { | ||
import { | ||
default as propTypesElementOfType, | ||
} from "react-prop-types-element-of-type"; | ||
import { | ||
default as GoogleMapHolder, | ||
@@ -21,3 +17,3 @@ } from "./creators/GoogleMapHolder"; | ||
containerElement: PropTypes.node.isRequired, | ||
googleMapElement: PropTypes.element.isRequired,/* CIRCULAR_DEPENDENCY. Uncomment when 5.0.0 comes: propTypesElementOfType(GoogleMap).isRequired, */ | ||
googleMapElement: PropTypes.element.isRequired, /* CIRCULAR_DEPENDENCY. Uncomment when 5.0.0 comes: propTypesElementOfType(GoogleMap).isRequired, */ | ||
}; | ||
@@ -33,7 +29,7 @@ | ||
mountGoogleMap (domEl) { | ||
mountGoogleMap(domEl) { | ||
if (this.state.map) { | ||
return; | ||
} | ||
const {children, ...mapProps} = this.props.googleMapElement.props; | ||
const { children, ...mapProps } = this.props.googleMapElement.props; | ||
// | ||
@@ -47,3 +43,3 @@ // Create google.maps.Map instance so that dom is initialized before | ||
renderChild () { | ||
renderChild() { | ||
if (this.state.map) { | ||
@@ -62,3 +58,3 @@ // Notice: implementation details | ||
map: this.state.map, | ||
//------------ Deprecated ------------ | ||
// ------------ Deprecated ------------ | ||
containerTagName: USE_NEW_BEHAVIOR_TAG_NAME, | ||
@@ -69,3 +65,3 @@ }); | ||
render () { | ||
render() { | ||
return React.cloneElement(this.props.containerElement, { | ||
@@ -72,0 +68,0 @@ ref: ::this.mountGoogleMap, |
@@ -1,13 +0,13 @@ | ||
export {default as GoogleMapLoader} from "./GoogleMapLoader"; | ||
export { default as GoogleMapLoader } from "./GoogleMapLoader"; | ||
export {default as GoogleMap} from "./GoogleMap"; | ||
export {default as Circle} from "./Circle"; | ||
export {default as DirectionsRenderer} from "./DirectionsRenderer"; | ||
export {default as DrawingManager} from "./DrawingManager"; | ||
export {default as InfoWindow} from "./InfoWindow"; | ||
export {default as Marker} from "./Marker"; | ||
export {default as OverlayView} from "./OverlayView"; | ||
export {default as Polygon} from "./Polygon"; | ||
export {default as Polyline} from "./Polyline"; | ||
export {default as Rectangle} from "./Rectangle"; | ||
export {default as SearchBox} from "./SearchBox"; | ||
export { default as GoogleMap } from "./GoogleMap"; | ||
export { default as Circle } from "./Circle"; | ||
export { default as DirectionsRenderer } from "./DirectionsRenderer"; | ||
export { default as DrawingManager } from "./DrawingManager"; | ||
export { default as InfoWindow } from "./InfoWindow"; | ||
export { default as Marker } from "./Marker"; | ||
export { default as OverlayView } from "./OverlayView"; | ||
export { default as Polygon } from "./Polygon"; | ||
export { default as Polyline } from "./Polyline"; | ||
export { default as Rectangle } from "./Rectangle"; | ||
export { default as SearchBox } from "./SearchBox"; |
@@ -32,7 +32,7 @@ import { | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }).filter(function(it){ return it.match(/^get/) && !it.match(/^getMap/); }) | ||
getContent () { /* TODO: children */ } | ||
getContent() { /* TODO: children */ } | ||
getPosition () { return this.state.infoWindow.getPosition(); } | ||
getPosition() { return this.state.infoWindow.getPosition(); } | ||
getZIndex () { return this.state.infoWindow.getZIndex(); } | ||
getZIndex() { return this.state.infoWindow.getZIndex(); } | ||
// END - Public APIs | ||
@@ -45,3 +45,3 @@ // | ||
componentWillMount () { | ||
componentWillMount() { | ||
if (!canUseDOM) { | ||
@@ -55,3 +55,3 @@ return; | ||
render () { | ||
render() { | ||
if (this.state.infoWindow) { | ||
@@ -58,0 +58,0 @@ return ( |
@@ -32,29 +32,29 @@ import { | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }).filter(function(it){ return it.match(/^get/) && !it.match(/Map$/); }) | ||
getAnimation () { return this.state.marker.getAnimation(); } | ||
getAnimation() { return this.state.marker.getAnimation(); } | ||
getAttribution () { return this.state.marker.getAttribution(); } | ||
getAttribution() { return this.state.marker.getAttribution(); } | ||
getClickable () { return this.state.marker.getClickable(); } | ||
getClickable() { return this.state.marker.getClickable(); } | ||
getCursor () { return this.state.marker.getCursor(); } | ||
getCursor() { return this.state.marker.getCursor(); } | ||
getDraggable () { return this.state.marker.getDraggable(); } | ||
getDraggable() { return this.state.marker.getDraggable(); } | ||
getIcon () { return this.state.marker.getIcon(); } | ||
getIcon() { return this.state.marker.getIcon(); } | ||
getLabel () { return this.state.marker.getLabel(); } | ||
getLabel() { return this.state.marker.getLabel(); } | ||
getOpacity () { return this.state.marker.getOpacity(); } | ||
getOpacity() { return this.state.marker.getOpacity(); } | ||
getPlace () { return this.state.marker.getPlace(); } | ||
getPlace() { return this.state.marker.getPlace(); } | ||
getPosition () { return this.state.marker.getPosition(); } | ||
getPosition() { return this.state.marker.getPosition(); } | ||
getShape () { return this.state.marker.getShape(); } | ||
getShape() { return this.state.marker.getShape(); } | ||
getTitle () { return this.state.marker.getTitle(); } | ||
getTitle() { return this.state.marker.getTitle(); } | ||
getVisible () { return this.state.marker.getVisible(); } | ||
getVisible() { return this.state.marker.getVisible(); } | ||
getZIndex () { return this.state.marker.getZIndex(); } | ||
getZIndex() { return this.state.marker.getZIndex(); } | ||
// END - Public APIs | ||
@@ -67,3 +67,3 @@ // | ||
componentWillMount () { | ||
componentWillMount() { | ||
if (!canUseDOM) { | ||
@@ -77,3 +77,3 @@ return; | ||
componentWillUnmount () { | ||
componentWillUnmount() { | ||
if (!canUseDOM) { | ||
@@ -83,8 +83,8 @@ return; | ||
const {anchorHolderRef} = this.props; | ||
const {marker} = this.state; | ||
const { anchorHolderRef } = this.props; | ||
const { marker } = this.state; | ||
if (anchorHolderRef) { | ||
if ("MarkerClusterer" === anchorHolderRef.getAnchorType()) { | ||
if (`MarkerClusterer` === anchorHolderRef.getAnchorType()) { | ||
anchorHolderRef.getAnchor().removeMarker(marker); | ||
@@ -95,3 +95,3 @@ } | ||
render () { | ||
render() { | ||
if (this.state.marker) { | ||
@@ -98,0 +98,0 @@ return ( |
@@ -22,7 +22,7 @@ import { | ||
static FLOAT_PANE = "floatPane" | ||
static MAP_PANE = "mapPane" | ||
static MARKER_LAYER = "markerLayer" | ||
static OVERLAY_LAYER = "overlayLayer" | ||
static OVERLAY_MOUSE_TARGET = "overlayMouseTarget" | ||
static FLOAT_PANE = `floatPane` | ||
static MAP_PANE = `mapPane` | ||
static MARKER_LAYER = `markerLayer` | ||
static OVERLAY_LAYER = `overlayLayer` | ||
static OVERLAY_MOUSE_TARGET = `overlayMouseTarget` | ||
@@ -45,5 +45,5 @@ static propTypes = { | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }).filter(function(it){ return it.match(/^get/) && !it.match(/^getMap/); }) | ||
getPanes () { return this.state.overlayView.getPanes(); } | ||
getPanes() { return this.state.overlayView.getPanes(); } | ||
getProjection () { return this.state.overlayView.getProjection(); } | ||
getProjection() { return this.state.overlayView.getProjection(); } | ||
// END - Public APIs | ||
@@ -56,3 +56,3 @@ // | ||
componentWillMount () { | ||
componentWillMount() { | ||
if (!canUseDOM) { | ||
@@ -66,3 +66,3 @@ return; | ||
render () { | ||
render() { | ||
if (this.state.overlayView) { | ||
@@ -69,0 +69,0 @@ return ( |
@@ -32,11 +32,11 @@ import { | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }).filter(function(it){ return it.match(/^get/) && !it.match(/^getMap/); }) | ||
getDraggable () { return this.state.polygon.getDraggable(); } | ||
getDraggable() { return this.state.polygon.getDraggable(); } | ||
getEditable () { return this.state.polygon.getEditable(); } | ||
getEditable() { return this.state.polygon.getEditable(); } | ||
getPath () { return this.state.polygon.getPath(); } | ||
getPath() { return this.state.polygon.getPath(); } | ||
getPaths () { return this.state.polygon.getPaths(); } | ||
getPaths() { return this.state.polygon.getPaths(); } | ||
getVisible () { return this.state.polygon.getVisible(); } | ||
getVisible() { return this.state.polygon.getVisible(); } | ||
// END - Public APIs | ||
@@ -49,3 +49,3 @@ // | ||
componentWillMount () { | ||
componentWillMount() { | ||
if (!canUseDOM) { | ||
@@ -59,3 +59,3 @@ return; | ||
render () { | ||
render() { | ||
if (this.state.polygon) { | ||
@@ -62,0 +62,0 @@ return ( |
@@ -32,9 +32,9 @@ import { | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }).filter(function(it){ return it.match(/^get/) && !it.match(/^getMap/); }) | ||
getDraggable () { return this.state.polyline.getDraggable(); } | ||
getDraggable() { return this.state.polyline.getDraggable(); } | ||
getEditable () { return this.state.polyline.getEditable(); } | ||
getEditable() { return this.state.polyline.getEditable(); } | ||
getPath () { return this.state.polyline.getPath(); } | ||
getPath() { return this.state.polyline.getPath(); } | ||
getVisible () { return this.state.polyline.getVisible(); } | ||
getVisible() { return this.state.polyline.getVisible(); } | ||
// END - Public APIs | ||
@@ -47,3 +47,3 @@ // | ||
componentWillMount () { | ||
componentWillMount() { | ||
if (!canUseDOM) { | ||
@@ -57,3 +57,3 @@ return; | ||
render () { | ||
render() { | ||
if (this.state.polyline) { | ||
@@ -60,0 +60,0 @@ return ( |
@@ -36,9 +36,9 @@ import { | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }).filter(function(it){ return it.match(/^get/) && !it.match(/^getMap/); }) | ||
getBounds () { return this.state.rectangle.getBounds(); } | ||
getBounds() { return this.state.rectangle.getBounds(); } | ||
getDraggable () { return this.state.rectangle.getDraggable(); } | ||
getDraggable() { return this.state.rectangle.getDraggable(); } | ||
getEditable () { return this.state.rectangle.getEditable(); } | ||
getEditable() { return this.state.rectangle.getEditable(); } | ||
getVisible () { return this.state.rectangle.getVisible(); } | ||
getVisible() { return this.state.rectangle.getVisible(); } | ||
// END - Public APIs | ||
@@ -51,3 +51,3 @@ // | ||
componentWillMount () { | ||
componentWillMount() { | ||
if (!canUseDOM) { | ||
@@ -61,3 +61,3 @@ return; | ||
render () { | ||
render() { | ||
if (this.state.rectangle) { | ||
@@ -64,0 +64,0 @@ return ( |
@@ -19,3 +19,3 @@ import { | ||
* Original author: @eyebraus | ||
* Original PR: https://github.com/tomchentw/react-google-maps/pull/110 | ||
* Original PR: https://github.com/tomchentw/react-google-maps/pull/110 | ||
*/ | ||
@@ -37,5 +37,5 @@ export default class SearchBox extends Component { | ||
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }).filter(function(it){ return it.match(/^get/) && !it.match(/Map$/); }) | ||
getBounds () { return this.state.searchBox.getBounds(); } | ||
getBounds() { return this.state.searchBox.getBounds(); } | ||
getPlaces () { return this.state.searchBox.getPlaces(); } | ||
getPlaces() { return this.state.searchBox.getPlaces(); } | ||
// END - Public APIs | ||
@@ -47,16 +47,16 @@ // | ||
componentWillMount () { | ||
componentWillMount() { | ||
if (!canUseDOM) { | ||
return; | ||
} | ||
const {mapHolderRef, classes, style, placeholder, ...searchBoxProps} = this.props; | ||
const { mapHolderRef, classes, style, placeholder, ...searchBoxProps } = this.props; | ||
// Cannot create input via component - Google Maps will mess with React's internal state by detaching/attaching. | ||
// Allow developers to style the "hidden element" via inputClasses. | ||
let domEl = document.createElement("input"); | ||
const domEl = document.createElement(`input`); | ||
domEl.className = classes; | ||
domEl.type = "text"; | ||
domEl.type = `text`; | ||
domEl.placeholder = placeholder; | ||
for (var propKey in style) { | ||
for (const propKey in style) { | ||
if (style.hasOwnProperty(propKey)) { | ||
@@ -71,8 +71,8 @@ domEl.style[propKey] = style[propKey]; | ||
inputElement: domEl, | ||
searchBox: searchBox, | ||
searchBox, | ||
}); | ||
} | ||
render () { | ||
const {mapHolderRef, controlPosition} = this.props; | ||
render() { | ||
const { mapHolderRef, controlPosition } = this.props; | ||
@@ -79,0 +79,0 @@ return this.state.searchBox ? ( |
@@ -7,9 +7,5 @@ import { | ||
default as React, | ||
Children, | ||
PropTypes, | ||
Component, | ||
} from "react"; | ||
import { | ||
unmountComponentAtNode, | ||
render, | ||
@@ -23,13 +19,2 @@ } from "react-dom"; | ||
GoogleMap, | ||
Circle, | ||
DirectionsRenderer, | ||
DrawingManager, | ||
InfoWindow, | ||
Marker, | ||
OverlayView, | ||
Polygon, | ||
Polyline, | ||
Rectangle, | ||
SearchBox, | ||
} from "../../index"; | ||
@@ -44,3 +29,3 @@ | ||
before(() => { | ||
global.google = {maps}; | ||
global.google = { maps }; | ||
}); | ||
@@ -57,3 +42,3 @@ | ||
function ref (component) { | ||
function ref(component) { | ||
triggerEvent(component, `resize`); | ||
@@ -65,3 +50,3 @@ expect(triggerSpy).toHaveBeenCalled(); | ||
} | ||
render(( | ||
@@ -68,0 +53,0 @@ <GoogleMapLoader |
@@ -1,3 +0,3 @@ | ||
export default function addDefaultPrefix (name) { | ||
export default function addDefaultPrefix(name) { | ||
return `default${ name[0].toUpperCase() + name.slice(1) }`; | ||
} |
@@ -1,5 +0,5 @@ | ||
export default function componentLifecycleDecorator ({registerEvents, instanceMethodName, updaters}) { | ||
export default function componentLifecycleDecorator({ registerEvents, instanceMethodName, updaters }) { | ||
// This modify the Component.prototype directly | ||
return (Component) => { | ||
function register () { | ||
function register() { | ||
this._unregisterEvents = registerEvents( | ||
@@ -12,3 +12,3 @@ google.maps.event, | ||
function unregister () { | ||
function unregister() { | ||
this._unregisterEvents(); | ||
@@ -18,14 +18,14 @@ this._unregisterEvents = null; | ||
function noop () {} | ||
function noop() {} | ||
// Stash component's own lifecycle methods to be invoked later | ||
const componentDidMount = Component.prototype.hasOwnProperty("componentDidMount") ? Component.prototype.componentDidMount : noop; | ||
const componentDidUpdate = Component.prototype.hasOwnProperty("componentDidUpdate") ? Component.prototype.componentDidUpdate : noop; | ||
const componentWillUnmount = Component.prototype.hasOwnProperty("componentWillUnmount") ? Component.prototype.componentWillUnmount : noop; | ||
const componentDidMount = Component.prototype.hasOwnProperty(`componentDidMount`) ? Component.prototype.componentDidMount : noop; | ||
const componentDidUpdate = Component.prototype.hasOwnProperty(`componentDidUpdate`) ? Component.prototype.componentDidUpdate : noop; | ||
const componentWillUnmount = Component.prototype.hasOwnProperty(`componentWillUnmount`) ? Component.prototype.componentWillUnmount : noop; | ||
Object.defineProperty(Component.prototype, "componentDidMount", { | ||
Object.defineProperty(Component.prototype, `componentDidMount`, { | ||
enumerable: false, | ||
configurable: true, | ||
writable: true, | ||
value: function () { | ||
value() { | ||
// Hook into client's implementation, if it has any | ||
@@ -38,7 +38,7 @@ componentDidMount.call(this); | ||
Object.defineProperty(Component.prototype, "componentDidUpdate", { | ||
Object.defineProperty(Component.prototype, `componentDidUpdate`, { | ||
enumerable: false, | ||
configurable: true, | ||
writable: true, | ||
value (prevProps) { | ||
value(prevProps) { | ||
unregister.call(this); | ||
@@ -59,7 +59,7 @@ | ||
Object.defineProperty(Component.prototype, "componentWillUnmount", { | ||
Object.defineProperty(Component.prototype, `componentWillUnmount`, { | ||
enumerable: false, | ||
configurable: true, | ||
writable: true, | ||
value () { | ||
value() { | ||
// Hook into client's implementation, if it has any | ||
@@ -70,3 +70,3 @@ componentWillUnmount.call(this); | ||
const instance = this[instanceMethodName](); | ||
if ("setMap" in instance) { | ||
if (`setMap` in instance) { | ||
instance.setMap(null); | ||
@@ -73,0 +73,0 @@ } |
@@ -1,4 +0,4 @@ | ||
import {default as controlledOrDefault} from "./controlledOrDefault"; | ||
import { default as controlledOrDefault } from "./controlledOrDefault"; | ||
export default function composeOptions (props, controlledPropTypes) { | ||
export default function composeOptions(props, controlledPropTypes) { | ||
const optionNameList = Object.keys(controlledPropTypes); | ||
@@ -10,5 +10,5 @@ const getter = controlledOrDefault(props); | ||
return optionNameList.reduce((acc, optionName) => { | ||
if ("options" !== optionName) { | ||
if (`options` !== optionName) { | ||
const value = getter(optionName); | ||
if ("undefined" !== typeof value) { | ||
if (`undefined` !== typeof value) { | ||
acc[optionName] = value; | ||
@@ -19,4 +19,4 @@ } | ||
}, { | ||
...getter("options"), | ||
...getter(`options`), | ||
}); | ||
} |
@@ -1,4 +0,4 @@ | ||
import {default as addDefaultPrefix} from "./addDefaultPrefix"; | ||
import { default as addDefaultPrefix } from "./addDefaultPrefix"; | ||
export default function controlledOrDefault (props) { | ||
export default function controlledOrDefault(props) { | ||
return (name) => { | ||
@@ -5,0 +5,0 @@ if (Object.prototype.hasOwnProperty.call(props, name)) { |
@@ -1,4 +0,4 @@ | ||
import {default as addDefaultPrefix} from "./addDefaultPrefix"; | ||
import { default as addDefaultPrefix } from "./addDefaultPrefix"; | ||
export default function defaultPropsCreator (propTypes) { | ||
export default function defaultPropsCreator(propTypes) { | ||
return Object.keys(propTypes).reduce((acc, name) => { | ||
@@ -5,0 +5,0 @@ acc[addDefaultPrefix(name)] = propTypes[name]; |
import { PropTypes } from "react"; | ||
function groupToUpperCase (match, group) { | ||
function groupToUpperCase(match, group) { | ||
return group.toUpperCase(); | ||
@@ -13,3 +13,3 @@ } | ||
export default function eventHandlerCreator (rawNameList) { | ||
export default function eventHandlerCreator(rawNameList) { | ||
const eventPropTypes = {}; | ||
@@ -24,3 +24,3 @@ const onEventNameByRawName = {}; | ||
function registerEvents (event, props, googleMapInstance) { | ||
function registerEvents(event, props, googleMapInstance) { | ||
const registered = rawNameList.reduce((acc, rawName) => { | ||
@@ -27,0 +27,0 @@ const onEventName = onEventNameByRawName[rawName]; |
@@ -9,4 +9,5 @@ import { | ||
export function __getInstance (component) { | ||
const {constructor} = component; | ||
export function __getInstance(componentOrLoader) { | ||
let component = componentOrLoader; | ||
const { constructor } = component; | ||
if (GoogleMap === constructor) { | ||
@@ -25,3 +26,3 @@ if (component.props.map) { | ||
export function triggerEvent (component, ...args) { | ||
export function triggerEvent(component, ...args) { | ||
const instance = __getInstance(component); | ||
@@ -28,0 +29,0 @@ invariant(instance, |
@@ -13,3 +13,3 @@ import { | ||
export default function makeUrl (urlObj) { | ||
export default function makeUrl(urlObj) { | ||
return formatUrlObj({ | ||
@@ -34,5 +34,5 @@ protocol: urlObj.protocol, | ||
export function getUrlObjChangedKeys (urlObj, nextUrlObj) { | ||
export function getUrlObjChangedKeys(urlObj, nextUrlObj) { | ||
return Object.keys(urlObjDefinition) | ||
.filter(key => !isEqual(urlObj[key], nextUrlObj[key])); | ||
} |
@@ -10,8 +10,9 @@ import { | ||
function renderElement ( | ||
function renderElement( | ||
contentElement, | ||
prevContent | ||
possiblePrevContent | ||
) { | ||
if ("[object HTMLDivElement]" !== Object.prototype.toString.call(prevContent)) { | ||
prevContent = document.createElement("div"); | ||
let prevContent = possiblePrevContent; | ||
if (`[object HTMLDivElement]` !== Object.prototype.toString.call(prevContent)) { | ||
prevContent = document.createElement(`div`); | ||
} | ||
@@ -23,3 +24,3 @@ | ||
export default function setContentForOptionalReactElement ( | ||
export default function setContentForOptionalReactElement( | ||
contentOptionalReactElement, | ||
@@ -32,5 +33,4 @@ infoWindowLikeInstance | ||
const domEl = renderElement(contentOptionalReactElement, prevContent); | ||
const domEl = renderElement(contentElement, prevContent); | ||
infoWindowLikeInstance.setContent(domEl); | ||
} else { | ||
@@ -37,0 +37,0 @@ infoWindowLikeInstance.setContent(contentOptionalReactElement); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
353906
227
16
6725
5