google-react-maps
Advanced tools
Comparing version 1.4.4 to 1.5.0
@@ -29,21 +29,46 @@ 'use strict'; | ||
var SearchBox = function (_React$Component) { | ||
_inherits(SearchBox, _React$Component); | ||
var DefaultInput = function (_React$Component) { | ||
_inherits(DefaultInput, _React$Component); | ||
function DefaultInput() { | ||
_classCallCheck(this, DefaultInput); | ||
return _possibleConstructorReturn(this, (DefaultInput.__proto__ || Object.getPrototypeOf(DefaultInput)).apply(this, arguments)); | ||
} | ||
_createClass(DefaultInput, [{ | ||
key: 'render', | ||
value: function render() { | ||
var _props = this.props, | ||
inputRef = _props.inputRef, | ||
className = _props.className, | ||
placeholder = _props.placeholder, | ||
style = _props.style; | ||
return _react2.default.createElement('input', { ref: inputRef, className: className, placeholder: placeholder, style: style }); | ||
} | ||
}]); | ||
return DefaultInput; | ||
}(_react2.default.Component); | ||
var SearchBox = function (_React$Component2) { | ||
_inherits(SearchBox, _React$Component2); | ||
function SearchBox(props) { | ||
_classCallCheck(this, SearchBox); | ||
var _this = _possibleConstructorReturn(this, (SearchBox.__proto__ || Object.getPrototypeOf(SearchBox)).call(this, props)); | ||
var _this2 = _possibleConstructorReturn(this, (SearchBox.__proto__ || Object.getPrototypeOf(SearchBox)).call(this, props)); | ||
_this.displayName = 'SearchBox'; | ||
_this.state = { | ||
_this2.displayName = 'SearchBox'; | ||
_this2.state = { | ||
searchBox: null, | ||
internalPosition: -1 | ||
}; | ||
_this.postRender = _this.postRender.bind(_this); | ||
_this.ref = _this.ref.bind(_this); | ||
_this.boundsListener = null; | ||
_this.placesListener = null; | ||
_this.timer = null; | ||
return _this; | ||
_this2.postRender = _this2.postRender.bind(_this2); | ||
_this2.ref = _this2.ref.bind(_this2); | ||
_this2.boundsListener = null; | ||
_this2.placesListener = null; | ||
_this2.timer = null; | ||
return _this2; | ||
} | ||
@@ -59,7 +84,7 @@ | ||
value: function postRender() { | ||
var _this2 = this; | ||
var _this3 = this; | ||
var _props = this.props, | ||
map = _props.map, | ||
maps = _props.maps; | ||
var _props2 = this.props, | ||
map = _props2.map, | ||
maps = _props2.maps; | ||
var position = this.props.position; | ||
@@ -83,12 +108,12 @@ | ||
this.boundsListener = map.addListener('bounds_changed', function () { | ||
if (_this2.props.autoRefreshPlaces) { | ||
if (_this2.timer) { | ||
clearTimeout(_this2.timer); | ||
if (_this3.props.autoRefreshPlaces) { | ||
if (_this3.timer) { | ||
clearTimeout(_this3.timer); | ||
} | ||
_this2.timer = setTimeout(function () { | ||
_this3.timer = setTimeout(function () { | ||
var map_bounds = map.getBounds(); | ||
searchBox.setBounds(map_bounds); | ||
if (typeof _this2.props.onPlacesChanged === 'function' && _this2.input) { | ||
var query = _this2.input.value; | ||
if (typeof _this3.props.onPlacesChanged === 'function' && _this3.input) { | ||
var query = _this3.input.value; | ||
var service = new maps.places.PlacesService(map); | ||
@@ -100,3 +125,3 @@ query ? service.textSearch({ | ||
if (status == maps.places.PlacesServiceStatus.OK) { | ||
_this2.props.onPlacesChanged(places); | ||
_this3.props.onPlacesChanged(places); | ||
} | ||
@@ -110,4 +135,4 @@ }) : ''; | ||
this.placesListener = searchBox.addListener('places_changed', function () { | ||
if (typeof _this2.props.onPlacesChanged === 'function') { | ||
_this2.props.onPlacesChanged(searchBox.getPlaces()); | ||
if (typeof _this3.props.onPlacesChanged === 'function') { | ||
_this3.props.onPlacesChanged(searchBox.getPlaces()); | ||
} | ||
@@ -140,6 +165,6 @@ }); | ||
value: function ref(name) { | ||
var _this3 = this; | ||
var _this4 = this; | ||
return function (item) { | ||
_this3[name] = item; | ||
_this4[name] = item; | ||
}; | ||
@@ -162,6 +187,6 @@ } | ||
value: function componentWillUnmount() { | ||
var _props2 = this.props, | ||
map = _props2.map, | ||
maps = _props2.maps, | ||
position = _props2.position; | ||
var _props3 = this.props, | ||
map = _props3.map, | ||
maps = _props3.maps, | ||
position = _props3.position; | ||
@@ -176,2 +201,3 @@ if (this.state.internalPosition >= 0) { | ||
var Wrapper = this.props.wrapper; | ||
var Input = this.props.inputComponent || DefaultInput; | ||
if (Wrapper) { | ||
@@ -187,3 +213,9 @@ return _react2.default.createElement( | ||
null, | ||
_react2.default.createElement('input', { type: 'text', ref: this.ref('input'), placeholder: this.props.placeholder, style: this.props.style, className: this.props.className }) | ||
_react2.default.createElement(Input, { | ||
type: 'text', | ||
inputRef: this.ref('input'), | ||
placeholder: this.props.placeholder, | ||
style: this.props.style, | ||
className: this.props.className | ||
}) | ||
) | ||
@@ -199,3 +231,9 @@ ) | ||
{ ref: this.ref('child') }, | ||
_react2.default.createElement('input', { type: 'text', ref: this.ref('input'), placeholder: this.props.placeholder, style: this.props.style, className: this.props.className }) | ||
_react2.default.createElement(Input, { | ||
type: 'text', | ||
inputRef: this.ref('input'), | ||
placeholder: this.props.placeholder, | ||
style: this.props.style, | ||
className: this.props.className | ||
}) | ||
) | ||
@@ -202,0 +240,0 @@ ); |
{ | ||
"name": "google-react-maps", | ||
"version": "1.4.4", | ||
"version": "1.5.0", | ||
"description": "A more powerfully custom version of the Google Maps Javascript API built for React. Multiple Datalayer support. GEOJSON Enabled.", | ||
@@ -5,0 +5,0 @@ "main": "dist/components/index.js", |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
4640345
108
133832
3