From 62378c2b700f1309a339c11ec84b85bb3c29592d Mon Sep 17 00:00:00 2001 From: Paul Le Cam Date: Thu, 20 Oct 2016 21:47:46 +0100 Subject: [PATCH] Support WMSTileLayer dynamic parameters --- CHANGELOG.md | 6 ++++ dist/react-leaflet.js | 10 ++++++ dist/react-leaflet.min.js | 4 +-- docs/Components.md | 52 ++++++++++++++++------------ example/components/index.js | 3 ++ example/components/wms-tile-layer.js | 35 +++++++++++++++++++ lib/WMSTileLayer.js | 10 ++++++ package.json | 8 ++--- src/WMSTileLayer.js | 7 ++++ 9 files changed, 106 insertions(+), 29 deletions(-) create mode 100644 example/components/wms-tile-layer.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cd2d7e2..34f054ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v1.0.0-rc.2 (2016-10-20) + +- Added `Pane` component introduced in Leaflet v1. ([PR #227](https://github.com/PaulLeCam/react-leaflet/pull/227) by *rjdestigter*). +- Added support for IE9 and IE10 ([PR #235](https://github.com/PaulLeCam/react-leaflet/pull/235) by *dettier*). +- Updated `WMSTileLayer` to support dynamic parameters. + ## v1.0.0-rc.1 (2016-09-28) - [BREAKING] Removed `setIconDefaultImagePath()` helper, set `Leaflet.Icon.Default.imagePath` directly using Leaflet if you need. diff --git a/dist/react-leaflet.js b/dist/react-leaflet.js index d181256e..c53f2904 100644 --- a/dist/react-leaflet.js +++ b/dist/react-leaflet.js @@ -5930,6 +5930,10 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; + var _isEqual2 = __webpack_require__(24); + + var _isEqual3 = _interopRequireDefault(_isEqual2); + var _leaflet = __webpack_require__(4); var _react = __webpack_require__(3); @@ -5969,6 +5973,12 @@ return /******/ (function(modules) { // webpackBootstrap this.leafletElement = _leaflet.tileLayer.wms(url, this.getOptions(props)); }; + WMSTileLayer.prototype.componentDidUpdate = function componentDidUpdate(prevProps) { + if (!(0, _isEqual3.default)(this.props, prevProps)) { + this.leafletElement.setParams(this.props); + } + }; + return WMSTileLayer; }(_GridLayer3.default); diff --git a/dist/react-leaflet.min.js b/dist/react-leaflet.min.js index e1bbf54a..cd3c6f1e 100644 --- a/dist/react-leaflet.min.js +++ b/dist/react-leaflet.min.js @@ -1,3 +1,3 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("leaflet"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","leaflet","react-dom"],e):"object"==typeof exports?exports.ReactLeaflet=e(require("react"),require("leaflet"),require("react-dom")):t.ReactLeaflet=e(t.React,t.L,t.ReactDOM)}(this,function(t,e,n){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return t[o].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}e.__esModule=!0,e.ZoomControl=e.WMSTileLayer=e.Tooltip=e.TileLayer=e.ScaleControl=e.Rectangle=e.Popup=e.Polyline=e.Polygon=e.Path=e.Pane=e.Marker=e.MapLayer=e.MapControl=e.MapComponent=e.Map=e.LayersControl=e.LayerGroup=e.ImageOverlay=e.GridLayer=e.GeoJSON=e.FeatureGroup=e.CircleMarker=e.Circle=e.AttributionControl=e.PropTypes=void 0;var i=n(1),p=r(i),u=n(11),a=o(u),s=n(13),c=o(s),l=n(108),f=o(l),y=n(109),h=o(y),d=n(110),b=o(d),v=n(111),m=o(v),O=n(112),g=o(O),P=n(113),w=o(P),j=n(114),_=o(j),x=n(115),T=o(x),E=n(76),C=o(E),M=n(12),L=o(M),R=n(75),S=o(R),W=n(127),D=o(W),N=n(128),U=o(N),z=n(14),A=o(z),k=n(132),I=o(k),B=n(133),q=o(B),F=n(134),G=o(F),Z=n(136),J=o(Z),V=n(137),$=o(V),H=n(138),K=o(H),Q=n(139),X=o(Q),Y=n(140),tt=o(Y),et=n(141),nt=o(et);e.PropTypes=p,e.AttributionControl=a["default"],e.Circle=c["default"],e.CircleMarker=f["default"],e.FeatureGroup=h["default"],e.GeoJSON=b["default"],e.GridLayer=m["default"],e.ImageOverlay=g["default"],e.LayerGroup=w["default"],e.LayersControl=_["default"],e.Map=T["default"],e.MapComponent=C["default"],e.MapControl=L["default"],e.MapLayer=S["default"],e.Marker=D["default"],e.Pane=U["default"],e.Path=A["default"],e.Polygon=I["default"],e.Polyline=q["default"],e.Popup=G["default"],e.Rectangle=J["default"],e.ScaleControl=$["default"],e.TileLayer=K["default"],e.Tooltip=X["default"],e.WMSTileLayer=tt["default"],e.ZoomControl=nt["default"]},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0,e.map=e.layerContainer=e.latlngList=e.latlng=e.controlPosition=e.children=e.bounds=void 0;var r=n(2),i=o(r),p=n(7),u=o(p),a=n(8),s=o(a),c=n(6),l=o(c),f=n(5),y=o(f),h=n(9),d=o(h),b=n(10),v=o(b);e.bounds=i["default"],e.children=u["default"],e.controlPosition=s["default"],e.latlng=l["default"],e.latlngList=y["default"],e.layerContainer=d["default"],e.map=v["default"]},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var r=n(3),i=n(4),p=n(5),u=o(p);e["default"]=r.PropTypes.oneOfType([r.PropTypes.instanceOf(i.LatLngBounds),u["default"]])},function(e,n){e.exports=t},function(t,n){t.exports=e},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var r=n(3),i=n(6),p=o(i);e["default"]=r.PropTypes.arrayOf(p["default"])},function(t,e,n){"use strict";e.__esModule=!0;var o=n(3);e["default"]=o.PropTypes.oneOfType([o.PropTypes.arrayOf(o.PropTypes.number),o.PropTypes.shape({lat:o.PropTypes.number,lng:o.PropTypes.number}),o.PropTypes.shape({lat:o.PropTypes.number,lon:o.PropTypes.number})])},function(t,e,n){"use strict";e.__esModule=!0;var o=n(3);e["default"]=o.PropTypes.oneOfType([o.PropTypes.arrayOf(o.PropTypes.node),o.PropTypes.node])},function(t,e,n){"use strict";e.__esModule=!0;var o=n(3);e["default"]=o.PropTypes.oneOf(["topleft","topright","bottomleft","bottomright"])},function(t,e,n){"use strict";e.__esModule=!0;var o=n(3);e["default"]=o.PropTypes.shape({addLayer:o.PropTypes.func.isRequired,removeLayer:o.PropTypes.func.isRequired})},function(t,e,n){"use strict";e.__esModule=!0;var o=n(4),r=n(3);e["default"]=r.PropTypes.instanceOf(o.Map)},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){for(var n=Object.getOwnPropertyNames(e),o=0;o=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):r(t,e))}e.__esModule=!0;var s=n(4),c=n(3),l=n(6),f=o(l),y=n(14),h=o(y),d=function(t){function e(){return p(this,e),u(this,t.apply(this,arguments))}return a(e,t),e.prototype.componentWillMount=function(){t.prototype.componentWillMount.call(this);var e=this.props,n=e.center,o=e.radius,r=i(e,["center","radius"]);this.leafletElement=(0,s.circle)(n,o,this.getOptions(r))},e.prototype.componentDidUpdate=function(t){this.props.center!==t.center&&this.leafletElement.setLatLng(this.props.center),this.props.radius!==t.radius&&this.leafletElement.setRadius(this.props.radius),this.setStyleIfChanged(t,this.props)},e}(h["default"]);d.propTypes={center:f["default"].isRequired,radius:c.PropTypes.number.isRequired},e["default"]=d},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){for(var n=Object.getOwnPropertyNames(e),o=0;o0&&void 0!==arguments[0]?arguments[0]:{};this.leafletElement.setStyle(t)},e.prototype.setStyleIfChanged=function(t,e){var n=this.getPathOptions(e);(0,l["default"])(n,this.getPathOptions(t))||this.setStyle(n)},e}(h["default"]);b.childContextTypes={popupContainer:f.PropTypes.object},e["default"]=b},function(t,e,n){var o=n(16),r=n(17),i=n(22),p=n(23),u=i(function(t,e){return null==t?{}:r(t,o(e,p))});t.exports=u},function(t,e){function n(t,e){for(var n=-1,o=t?t.length:0,r=Array(o);++n-1}var r=n(31);t.exports=o},function(t,e,n){function o(t,e){var n=this.__data__,o=r(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this}var r=n(31);t.exports=o},function(t,e,n){function o(){this.__data__=new r,this.size=0}var r=n(28);t.exports=o},function(t,e){function n(t){var e=this.__data__,n=e["delete"](t);return this.size=e.size,n}t.exports=n},function(t,e){function n(t){return this.__data__.get(t)}t.exports=n},function(t,e){function n(t){return this.__data__.has(t)}t.exports=n},function(t,e,n){function o(t,e){var n=this.__data__;if(n instanceof r){var o=n.__data__;if(!i||o.lengthf))return!1;var h=c.get(t);if(h&&c.get(e))return h==e;var d=-1,b=!0,v=s&u?new r:void 0;for(c.set(t,e),c.set(e,t);++d0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.leafletElement;if(!n||!n.on)return{};var o=(0,d["default"])(e);return(0,y["default"])(e,function(e,r){t[r]&&e===t[r]||(delete o[r],n.off(r,e))}),(0,y["default"])(t,function(t,r){e[r]&&t===e[r]||(o[r]=t,n.on(r,t))}),o},e.prototype.fireLeafletEvent=function(t,e){var n=this.leafletElement;n&&n.fire(t,e)},e.prototype.getOptions=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.pane||this.context.pane;return e?b({},t,{pane:e}):t},e}(v.Component);e["default"]=O},function(t,e,n){function o(t,e,n){var o=a(t)?r:u,s=arguments.length<3;return o(t,p(e,4),n,s,i)}var r=n(78),i=n(79),p=n(87),u=n(88),a=n(70);t.exports=o},function(t,e){function n(t,e,n,o){var r=-1,i=t?t.length:0;for(o&&i&&(n=t[++r]);++r-1&&t%1==0&&t<=o}var o=9007199254740991;t.exports=n},function(t,e){function n(t){return t}t.exports=n},function(t,e){function n(t,e,n,o,r){return r(t,function(t,r,i){n=o?(o=!1,t):e(n,t,r,i)}),n}t.exports=n},function(t,e,n){function o(t,e){var n=u(t)?r:i;return n(t,p(e,3))}var r=n(90),i=n(79),p=n(87),u=n(70);t.exports=o},function(t,e){function n(t,e){for(var n=-1,o=t?t.length:0;++n=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):r(t,e))}e.__esModule=!0;var s=n(4),c=n(3),l=n(6),f=o(l),y=n(14),h=o(y),d=function(t){function e(){return p(this,e),u(this,t.apply(this,arguments))}return a(e,t),e.prototype.componentWillMount=function(){t.prototype.componentWillMount.call(this);var e=this.props,n=e.center,o=i(e,["center"]);this.leafletElement=(0,s.circleMarker)(n,this.getOptions(o))},e.prototype.componentDidUpdate=function(t){this.props.center!==t.center&&this.leafletElement.setLatLng(this.props.center),this.props.radius!==t.radius&&this.leafletElement.setRadius(this.props.radius),this.setStyleIfChanged(t,this.props)},e}(h["default"]);d.propTypes={center:f["default"].isRequired,radius:c.PropTypes.number},e["default"]=d},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){for(var n=Object.getOwnPropertyNames(e),o=0;o=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):r(t,e)); +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("leaflet"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","leaflet","react-dom"],e):"object"==typeof exports?exports.ReactLeaflet=e(require("react"),require("leaflet"),require("react-dom")):t.ReactLeaflet=e(t.React,t.L,t.ReactDOM)}(this,function(t,e,n){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return t[o].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}e.__esModule=!0,e.ZoomControl=e.WMSTileLayer=e.Tooltip=e.TileLayer=e.ScaleControl=e.Rectangle=e.Popup=e.Polyline=e.Polygon=e.Path=e.Pane=e.Marker=e.MapLayer=e.MapControl=e.MapComponent=e.Map=e.LayersControl=e.LayerGroup=e.ImageOverlay=e.GridLayer=e.GeoJSON=e.FeatureGroup=e.CircleMarker=e.Circle=e.AttributionControl=e.PropTypes=void 0;var i=n(1),p=r(i),u=n(11),a=o(u),s=n(13),c=o(s),l=n(108),f=o(l),y=n(109),h=o(y),d=n(110),b=o(d),v=n(111),m=o(v),O=n(112),g=o(O),P=n(113),w=o(P),j=n(114),_=o(j),x=n(115),T=o(x),E=n(76),C=o(E),M=n(12),L=o(M),D=n(75),R=o(D),S=n(127),W=o(S),N=n(128),U=o(N),z=n(14),A=o(z),k=n(132),I=o(k),B=n(133),q=o(B),F=n(134),G=o(F),Z=n(136),J=o(Z),V=n(137),$=o(V),H=n(138),K=o(H),Q=n(139),X=o(Q),Y=n(140),tt=o(Y),et=n(141),nt=o(et);e.PropTypes=p,e.AttributionControl=a["default"],e.Circle=c["default"],e.CircleMarker=f["default"],e.FeatureGroup=h["default"],e.GeoJSON=b["default"],e.GridLayer=m["default"],e.ImageOverlay=g["default"],e.LayerGroup=w["default"],e.LayersControl=_["default"],e.Map=T["default"],e.MapComponent=C["default"],e.MapControl=L["default"],e.MapLayer=R["default"],e.Marker=W["default"],e.Pane=U["default"],e.Path=A["default"],e.Polygon=I["default"],e.Polyline=q["default"],e.Popup=G["default"],e.Rectangle=J["default"],e.ScaleControl=$["default"],e.TileLayer=K["default"],e.Tooltip=X["default"],e.WMSTileLayer=tt["default"],e.ZoomControl=nt["default"]},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0,e.map=e.layerContainer=e.latlngList=e.latlng=e.controlPosition=e.children=e.bounds=void 0;var r=n(2),i=o(r),p=n(7),u=o(p),a=n(8),s=o(a),c=n(6),l=o(c),f=n(5),y=o(f),h=n(9),d=o(h),b=n(10),v=o(b);e.bounds=i["default"],e.children=u["default"],e.controlPosition=s["default"],e.latlng=l["default"],e.latlngList=y["default"],e.layerContainer=d["default"],e.map=v["default"]},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var r=n(3),i=n(4),p=n(5),u=o(p);e["default"]=r.PropTypes.oneOfType([r.PropTypes.instanceOf(i.LatLngBounds),u["default"]])},function(e,n){e.exports=t},function(t,n){t.exports=e},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var r=n(3),i=n(6),p=o(i);e["default"]=r.PropTypes.arrayOf(p["default"])},function(t,e,n){"use strict";e.__esModule=!0;var o=n(3);e["default"]=o.PropTypes.oneOfType([o.PropTypes.arrayOf(o.PropTypes.number),o.PropTypes.shape({lat:o.PropTypes.number,lng:o.PropTypes.number}),o.PropTypes.shape({lat:o.PropTypes.number,lon:o.PropTypes.number})])},function(t,e,n){"use strict";e.__esModule=!0;var o=n(3);e["default"]=o.PropTypes.oneOfType([o.PropTypes.arrayOf(o.PropTypes.node),o.PropTypes.node])},function(t,e,n){"use strict";e.__esModule=!0;var o=n(3);e["default"]=o.PropTypes.oneOf(["topleft","topright","bottomleft","bottomright"])},function(t,e,n){"use strict";e.__esModule=!0;var o=n(3);e["default"]=o.PropTypes.shape({addLayer:o.PropTypes.func.isRequired,removeLayer:o.PropTypes.func.isRequired})},function(t,e,n){"use strict";e.__esModule=!0;var o=n(4),r=n(3);e["default"]=r.PropTypes.instanceOf(o.Map)},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){for(var n=Object.getOwnPropertyNames(e),o=0;o=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):r(t,e))}e.__esModule=!0;var s=n(4),c=n(3),l=n(6),f=o(l),y=n(14),h=o(y),d=function(t){function e(){return p(this,e),u(this,t.apply(this,arguments))}return a(e,t),e.prototype.componentWillMount=function(){t.prototype.componentWillMount.call(this);var e=this.props,n=e.center,o=e.radius,r=i(e,["center","radius"]);this.leafletElement=(0,s.circle)(n,o,this.getOptions(r))},e.prototype.componentDidUpdate=function(t){this.props.center!==t.center&&this.leafletElement.setLatLng(this.props.center),this.props.radius!==t.radius&&this.leafletElement.setRadius(this.props.radius),this.setStyleIfChanged(t,this.props)},e}(h["default"]);d.propTypes={center:f["default"].isRequired,radius:c.PropTypes.number.isRequired},e["default"]=d},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){for(var n=Object.getOwnPropertyNames(e),o=0;o0&&void 0!==arguments[0]?arguments[0]:{};this.leafletElement.setStyle(t)},e.prototype.setStyleIfChanged=function(t,e){var n=this.getPathOptions(e);(0,l["default"])(n,this.getPathOptions(t))||this.setStyle(n)},e}(h["default"]);b.childContextTypes={popupContainer:f.PropTypes.object},e["default"]=b},function(t,e,n){var o=n(16),r=n(17),i=n(22),p=n(23),u=i(function(t,e){return null==t?{}:r(t,o(e,p))});t.exports=u},function(t,e){function n(t,e){for(var n=-1,o=t?t.length:0,r=Array(o);++n-1}var r=n(31);t.exports=o},function(t,e,n){function o(t,e){var n=this.__data__,o=r(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this}var r=n(31);t.exports=o},function(t,e,n){function o(){this.__data__=new r,this.size=0}var r=n(28);t.exports=o},function(t,e){function n(t){var e=this.__data__,n=e["delete"](t);return this.size=e.size,n}t.exports=n},function(t,e){function n(t){return this.__data__.get(t)}t.exports=n},function(t,e){function n(t){return this.__data__.has(t)}t.exports=n},function(t,e,n){function o(t,e){var n=this.__data__;if(n instanceof r){var o=n.__data__;if(!i||o.lengthf))return!1;var h=c.get(t);if(h&&c.get(e))return h==e;var d=-1,b=!0,v=s&u?new r:void 0;for(c.set(t,e),c.set(e,t);++d0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.leafletElement;if(!n||!n.on)return{};var o=(0,d["default"])(e);return(0,y["default"])(e,function(e,r){t[r]&&e===t[r]||(delete o[r],n.off(r,e))}),(0,y["default"])(t,function(t,r){e[r]&&t===e[r]||(o[r]=t,n.on(r,t))}),o},e.prototype.fireLeafletEvent=function(t,e){var n=this.leafletElement;n&&n.fire(t,e)},e.prototype.getOptions=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.pane||this.context.pane;return e?b({},t,{pane:e}):t},e}(v.Component);e["default"]=O},function(t,e,n){function o(t,e,n){var o=a(t)?r:u,s=arguments.length<3;return o(t,p(e,4),n,s,i)}var r=n(78),i=n(79),p=n(87),u=n(88),a=n(70);t.exports=o},function(t,e){function n(t,e,n,o){var r=-1,i=t?t.length:0;for(o&&i&&(n=t[++r]);++r-1&&t%1==0&&t<=o}var o=9007199254740991;t.exports=n},function(t,e){function n(t){return t}t.exports=n},function(t,e){function n(t,e,n,o,r){return r(t,function(t,r,i){n=o?(o=!1,t):e(n,t,r,i)}),n}t.exports=n},function(t,e,n){function o(t,e){var n=u(t)?r:i;return n(t,p(e,3))}var r=n(90),i=n(79),p=n(87),u=n(70);t.exports=o},function(t,e){function n(t,e){for(var n=-1,o=t?t.length:0;++n=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):r(t,e))}e.__esModule=!0;var s=n(4),c=n(3),l=n(6),f=o(l),y=n(14),h=o(y),d=function(t){function e(){return p(this,e),u(this,t.apply(this,arguments))}return a(e,t),e.prototype.componentWillMount=function(){t.prototype.componentWillMount.call(this);var e=this.props,n=e.center,o=i(e,["center"]);this.leafletElement=(0,s.circleMarker)(n,this.getOptions(o))},e.prototype.componentDidUpdate=function(t){this.props.center!==t.center&&this.leafletElement.setLatLng(this.props.center),this.props.radius!==t.radius&&this.leafletElement.setRadius(this.props.radius),this.setStyleIfChanged(t,this.props)},e}(h["default"]);d.propTypes={center:f["default"].isRequired,radius:c.PropTypes.number},e["default"]=d},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){for(var n=Object.getOwnPropertyNames(e),o=0;o=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):r(t,e)); }e.__esModule=!0;var s=n(85),c=o(s),l=n(4),f=n(3),y=n(14),h=o(y),d=function(t){function e(){return p(this,e),u(this,t.apply(this,arguments))}return a(e,t),e.prototype.componentWillMount=function(){t.prototype.componentWillMount.call(this);var e=this.props,n=e.data,o=i(e,["data"]);this.leafletElement=(0,l.geoJSON)(n,this.getOptions(o))},e.prototype.componentDidUpdate=function(t){(0,c["default"])(this.props.style)?this.setStyle(this.props.style):this.setStyleIfChanged(t,this.props)},e}(h["default"]);d.propTypes={data:f.PropTypes.oneOfType([f.PropTypes.array,f.PropTypes.object]).isRequired},e["default"]=d},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){for(var n=Object.getOwnPropertyNames(e),o=0;o=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):r(t,e))}e.__esModule=!0;var s=n(4),c=n(3),l=n(2),f=o(l),y=n(75),h=o(y),d=function(t){function e(){return p(this,e),u(this,t.apply(this,arguments))}return a(e,t),e.prototype.componentWillMount=function(){t.prototype.componentWillMount.call(this);var e=this.props,n=e.bounds,o=e.url,r=i(e,["bounds","url"]);this.leafletElement=(0,s.imageOverlay)(o,n,this.getOptions(r))},e.prototype.componentDidUpdate=function(t){this.props.url!==t.url&&this.leafletElement.setUrl(this.props.url),this.props.opacity!==t.opacity&&this.leafletElement.setOpacity(this.props.opacity)},e.prototype.render=function(){return null},e}(h["default"]);d.propTypes={attribution:c.PropTypes.string,bounds:f["default"].isRequired,opacity:c.PropTypes.number,url:c.PropTypes.string.isRequired},e["default"]=d},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){for(var n=Object.getOwnPropertyNames(e),o=0;o=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function i(t,e){for(var n=Object.getOwnPropertyNames(e),o=0;o2&&void 0!==arguments[2]&&arguments[2];n&&this.context.map.addLayer(t),this.leafletElement.addBaseLayer(t,e)},e.prototype.addOverlay=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n&&this.context.map.addLayer(t),this.leafletElement.addOverlay(t,e)},e.prototype.removeLayer=function(t){this.context.map.removeLayer(t)},e.prototype.removeLayerControl=function(t){this.leafletElement.removeLayer(t)},e.prototype.render=function(){var t=this,e=c.Children.map(this.props.children,function(e){return e?(0,c.cloneElement)(e,t.controlProps):null});return l["default"].createElement("div",{style:{display:"none"}},e)},e}(O["default"]);_.propTypes={baseLayers:c.PropTypes.object,children:y["default"],overlays:c.PropTypes.object},_.contextTypes={layerContainer:d["default"],map:v["default"]},e["default"]=_,_.BaseLayer=w,_.Overlay=j},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){for(var n=Object.getOwnPropertyNames(e),o=0;o=c&&(f=s,y=!1,e=new r(e));t:for(;++l-1}var r=n(119);t.exports=o},function(t,e,n){function o(t,e,n){return e===e?p(t,e,n):r(t,i,n)}var r=n(120),i=n(121),p=n(122);t.exports=o},function(t,e){function n(t,e,n,o){for(var r=t.length,i=n+(o?1:-1);o?i--:++i=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):r(t,e))}e.__esModule=!0;var s=n(4),c=n(3),l=n(6),f=o(l),y=n(75),h=o(y),d=function(t){function e(){return p(this,e),u(this,t.apply(this,arguments))}return a(e,t),e.prototype.getChildContext=function(){return{popupContainer:this.leafletElement}},e.prototype.componentWillMount=function(){t.prototype.componentWillMount.call(this);var e=this.props,n=e.position,o=i(e,["position"]);this.leafletElement=(0,s.marker)(n,this.getOptions(o))},e.prototype.componentDidUpdate=function(t){this.props.position!==t.position&&this.leafletElement.setLatLng(this.props.position),this.props.icon!==t.icon&&this.leafletElement.setIcon(this.props.icon),this.props.zIndexOffset!==t.zIndexOffset&&this.leafletElement.setZIndexOffset(this.props.zIndexOffset),this.props.opacity!==t.opacity&&this.leafletElement.setOpacity(this.props.opacity),this.props.draggable!==t.draggable&&(this.props.draggable?this.leafletElement.dragging.enable():this.leafletElement.dragging.disable())},e.prototype.render=function(){return this.props.children||null},e}(h["default"]);d.propTypes={icon:c.PropTypes.instanceOf(s.Icon),opacity:c.PropTypes.number,position:f["default"].isRequired,zIndexOffset:c.PropTypes.number},d.childContextTypes={popupContainer:c.PropTypes.object},e["default"]=d},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){for(var n=Object.getOwnPropertyNames(e),o=0;o0&&void 0!==arguments[0]?arguments[0]:o.props,e=t.style,n=t.className,r=o.getPane(o.state.name);r&&(n&&r.classList.add(n),e&&(0,y["default"])(e,function(t,e){r.style[e]=t}))},r=n,p(o,r)}return u(e,t),e.prototype.getChildContext=function(){return{pane:this.state.name}},e.prototype.componentDidMount=function(){this.createPane(this.props)},e.prototype.componentWillReceiveProps=function(t){if(this.state.name)if(t.name!==this.props.name)this.removePane(),this.createPane(t);else{if(this.props.className&&t.className!==this.props.className){var e=this.getPane();e&&e.classList.remove(this.props.className)}this.setStyle(t)}},e.prototype.componentWillUnmount=function(){this.removePane()},e.prototype.createPane=function(t){var e=this.context.map,n=t.name||"pane-"+(0,s["default"])();if(e&&e.createPane){var o=w(n),r=o||this.getPane(n);if(r);else e.createPane(n,this.getParentPane());this.setState({name:n},this.setStyle)}},e.prototype.removePane=function(){var t=this.state.name;if(t){var e=this.getPane(t);e&&e.remove&&e.remove();var n=this.context.map;n&&n._panes&&(n._panes=(0,l["default"])(n._panes,t),n._paneRenderers=(0,l["default"])(n._paneRenderers,t)),this.setState({name:void 0})}},e.prototype.getParentPane=function(){return this.getPane(this.props.pane||this.context.pane)},e.prototype.getPane=function(t){return t?this.context.map.getPane(t):void 0},e.prototype.render=function(){return this.state.name?d["default"].createElement("div",{style:j},this.props.children):null},e}(h.Component);_.propTypes={name:h.PropTypes.string,children:m["default"],map:g["default"],className:h.PropTypes.string,style:h.PropTypes.object,pane:h.PropTypes.string},_.contextTypes={map:g["default"],pane:h.PropTypes.string},_.childContextTypes={pane:h.PropTypes.string},e["default"]=_},function(t,e,n){function o(t){var e=++i;return r(t)+e}var r=n(130),i=0;t.exports=o},function(t,e){function n(t){return t}t.exports=n},function(t,e,n){"use strict";var o=function(){};t.exports=o},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){for(var n=Object.getOwnPropertyNames(e),o=0;o=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):r(t,e))}e.__esModule=!0;var s=n(4),c=n(3),l=n(5),f=o(l),y=n(14),h=o(y),d=c.PropTypes.arrayOf(f["default"]),b=function(t){function e(){return p(this,e),u(this,t.apply(this,arguments))}return a(e,t),e.prototype.componentWillMount=function(){t.prototype.componentWillMount.call(this);var e=this.props,n=e.positions,o=i(e,["positions"]);this.leafletElement=(0,s.polygon)(n,this.getOptions(o))},e.prototype.componentDidUpdate=function(t){this.props.positions!==t.positions&&this.leafletElement.setLatLngs(this.props.positions),this.setStyleIfChanged(t,this.props)},e}(h["default"]);b.propTypes={positions:c.PropTypes.oneOfType([f["default"],d,c.PropTypes.arrayOf(d)]).isRequired},e["default"]=b},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){for(var n=Object.getOwnPropertyNames(e),o=0;o=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):r(t,e))}e.__esModule=!0;var s=n(4),c=n(3),l=n(5),f=o(l),y=n(14),h=o(y),d=function(t){function e(){return p(this,e),u(this,t.apply(this,arguments))}return a(e,t),e.prototype.componentWillMount=function(){t.prototype.componentWillMount.call(this);var e=this.props,n=e.positions,o=i(e,["positions"]);this.leafletElement=(0,s.polyline)(n,this.getOptions(o))},e.prototype.componentDidUpdate=function(t){this.props.positions!==t.positions&&this.leafletElement.setLatLngs(this.props.positions),this.setStyleIfChanged(t,this.props)},e}(h["default"]);d.propTypes={positions:c.PropTypes.oneOfType([f["default"],c.PropTypes.arrayOf(f["default"])]).isRequired},e["default"]=d},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){for(var n=Object.getOwnPropertyNames(e),o=0;o=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):r(t,e))}e.__esModule=!0;var s=n(4),c=n(3),l=n(135),f=n(6),y=o(f),h=n(10),d=o(h),b=n(76),v=o(b),m=function(t){function e(){var n,o,r;p(this,e);for(var i=arguments.length,a=Array(i),s=0;s=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):r(t,e))}e.__esModule=!0;var s=n(4),c=n(2),l=o(c),f=n(14),y=o(f),h=function(t){function e(){return p(this,e),u(this,t.apply(this,arguments))}return a(e,t),e.prototype.componentWillMount=function(){t.prototype.componentWillMount.call(this);var e=this.props,n=e.bounds,o=i(e,["bounds"]);this.leafletElement=(0,s.rectangle)(n,this.getOptions(o))},e.prototype.componentDidUpdate=function(t){this.props.bounds!==t.bounds&&this.leafletElement.setBounds(this.props.bounds),this.setStyleIfChanged(t,this.props)},e}(y["default"]);h.propTypes={bounds:l["default"].isRequired},e["default"]=h},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){for(var n=Object.getOwnPropertyNames(e),o=0;o=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):r(t,e))}e.__esModule=!0;var s=n(4),c=n(3),l=n(111),f=o(l),y=function(t){function e(){return p(this,e),u(this,t.apply(this,arguments))}return a(e,t),e.prototype.componentWillMount=function(){t.prototype.componentWillMount.call(this);var e=this.props,n=e.url,o=i(e,["url"]);this.leafletElement=(0,s.tileLayer)(n,this.getOptions(o))},e.prototype.componentDidUpdate=function(e){t.prototype.componentDidUpdate.call(this,e);var n=this.props.url;n!==e.url&&this.leafletElement.setUrl(n)},e}(f["default"]);y.propTypes={url:c.PropTypes.string.isRequired},e["default"]=y},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){for(var n=Object.getOwnPropertyNames(e),o=0;o=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):r(t,e))}e.__esModule=!0;var s=n(4),c=n(3),l=n(135),f=n(10),y=o(f),h=n(76),d=o(h),b=function(t){function e(){var n,o,r;p(this,e);for(var i=arguments.length,a=Array(i),s=0;s=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):r(t,e))}e.__esModule=!0;var s=n(4),c=n(3),l=n(111),f=o(l),y=function(t){function e(){return p(this,e),u(this,t.apply(this,arguments))}return a(e,t),e.prototype.componentWillMount=function(){t.prototype.componentWillMount.call(this);var e=this.props,n=e.url,o=i(e,["url"]);this.leafletElement=s.tileLayer.wms(n,this.getOptions(o))},e}(f["default"]);y.propTypes={url:c.PropTypes.string.isRequired},e["default"]=y},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){for(var n=Object.getOwnPropertyNames(e),o=0;o=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):r(t,e))}e.__esModule=!0;var s=n(24),c=o(s),l=n(4),f=n(3),y=n(111),h=o(y),d=function(t){function e(){return p(this,e),u(this,t.apply(this,arguments))}return a(e,t),e.prototype.componentWillMount=function(){t.prototype.componentWillMount.call(this);var e=this.props,n=e.url,o=i(e,["url"]);this.leafletElement=l.tileLayer.wms(n,this.getOptions(o))},e.prototype.componentDidUpdate=function(t){(0,c["default"])(this.props,t)||this.leafletElement.setParams(this.props)},e}(h["default"]);d.propTypes={url:f.PropTypes.string.isRequired},e["default"]=d},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){for(var n=Object.getOwnPropertyNames(e),o=0;o` container for the map. If you don't provide it, a unique one will be created. ## Pane + +[Leaflet reference](http://leafletjs.com/reference-1.0.0.html#map-pane) + **Dynamic properties** -- `name: string` (optional): Names of default leaflet panes are blacklisted. +- `name: string` (optional): Unique name for the pane. Existing Leaflet panes are blacklisted. - `style: object` (optional): style property of the pane's `
` - `className: string` (optional): className property of the pane's `
` -[Leaflet reference](http://leafletjs.com/examples/map-panes.html) - ## UI Layers ### Marker -[Leaflet reference](http://leafletjs.com/reference.html#marker) +[Leaflet reference](http://leafletjs.com/reference-1.0.0.html#marker) **Dynamic properties** - `position: latLng` (required) @@ -105,7 +106,7 @@ This is the top-level component that must be mounted for children ones to be ren ### Popup -[Leaflet reference](http://leafletjs.com/reference.html#popup) +[Leaflet reference](http://leafletjs.com/reference-1.0.0.html#popup) The Popup children will be rendered using `ReactDOM.render()`, they must be valid React elements. @@ -122,7 +123,7 @@ The Tooltip children will be rendered using `ReactDOM.render()`, they must be va ### TileLayer -[Leaflet reference](http://leafletjs.com/reference.html#tilelayer) +[Leaflet reference](http://leafletjs.com/reference-1.0.0.html#tilelayer) **Dynamic properties** - `url: string` (required) @@ -131,7 +132,7 @@ The Tooltip children will be rendered using `ReactDOM.render()`, they must be va ### ImageOverlay -[Leaflet reference](http://leafletjs.com/reference.html#imageoverlay) +[Leaflet reference](http://leafletjs.com/reference-1.0.0.html#imageoverlay) **Dynamic properties** - `url: string` (required) @@ -139,15 +140,20 @@ The Tooltip children will be rendered using `ReactDOM.render()`, they must be va ### WMSTileLayer -[Leaflet reference](http://leafletjs.com/reference.html#tilelayer-wms) +[Leaflet reference](http://leafletjs.com/reference-1.0.0.html#tilelayer-wms) + +**Properties** +- `url: string` (required) + +All other properties are passed as parameters and dynamic, they will cause the layer to redraw if they change. ## Vector Layers -All vector layers extend the **Path** component and therefore accept dynamic [Path options](http://leafletjs.com/reference.html#path-options) properties. +All vector layers extend the **Path** component and therefore accept dynamic [Path options](http://leafletjs.com/reference-1.0.0.html#path-options) properties. ### Circle -[Leaflet reference](http://leafletjs.com/reference.html#circle) +[Leaflet reference](http://leafletjs.com/reference-1.0.0.html#circle) **Dynamic properties** - `center: latLng` (required) @@ -155,7 +161,7 @@ All vector layers extend the **Path** component and therefore accept dynamic [Pa ### CircleMarker -[Leaflet reference](http://leafletjs.com/reference.html#circlemarker) +[Leaflet reference](http://leafletjs.com/reference-1.0.0.html#circlemarker) **Dynamic properties** - `center: latLng` (required) @@ -163,21 +169,21 @@ All vector layers extend the **Path** component and therefore accept dynamic [Pa ### Polyline -[Leaflet reference](http://leafletjs.com/reference.html#polyline) +[Leaflet reference](http://leafletjs.com/reference-1.0.0.html#polyline) **Dynamic properties** - `positions: latLngList | latLngList[]` (required) ### Polygon -[Leaflet reference](http://leafletjs.com/reference.html#polygon) +[Leaflet reference](http://leafletjs.com/reference-1.0.0.html#polygon) **Dynamic properties** - `positions: latLngList | latLngList[] | latLngList[][]` (required) ### Rectangle -[Leaflet reference](http://leafletjs.com/reference.html#rectangle) +[Leaflet reference](http://leafletjs.com/reference-1.0.0.html#rectangle) **Dynamic properties** - `bounds: bounds` (required) @@ -190,7 +196,7 @@ Extended `LayerGroup` supporting a `Popup` child. ### GeoJson -[Leaflet reference](http://leafletjs.com/reference.html#geojson) +[Leaflet reference](http://leafletjs.com/reference-1.0.0.html#geojson) **Properties** - `data: GeoJSON` (required). This property will *not* be updated if it is changed after the component is mounted. @@ -211,14 +217,14 @@ Use the `LayerGroup` wrapper component to group children layers together. ### AttributionControl -[Leaflet reference](http://leafletjs.com/reference.html#control-attribution) +[Leaflet reference](http://leafletjs.com/reference-1.0.0.html#control-attribution) **Dynamic properties** - `position: controlPosition` (optional) ### LayersControl -[Leaflet reference](http://leafletjs.com/reference.html#control-layers) +[Leaflet reference](http://leafletjs.com/reference-1.0.0.html#control-layers) **Dynamic properties** - `position: controlPosition` (optional) @@ -277,14 +283,14 @@ Example usage: ### ScaleControl -[Leaflet reference](http://leafletjs.com/reference.html#control-scale) +[Leaflet reference](http://leafletjs.com/reference-1.0.0.html#control-scale) **Dynamic properties** - `position: controlPosition` (optional) ### ZoomControl -[Leaflet reference](http://leafletjs.com/reference.html#control-zoom) +[Leaflet reference](http://leafletjs.com/reference-1.0.0.html#control-zoom) **Dynamic properties** - `position: controlPosition` (optional) diff --git a/example/components/index.js b/example/components/index.js index 9ee75315..adf85517 100644 --- a/example/components/index.js +++ b/example/components/index.js @@ -14,6 +14,7 @@ import CustomComponentExample from './custom-component' import AnimateExample from './animate' import TooltipExample from './tooltip' import PaneExample from './pane' +import WMSTileLayerExample from './wms-tile-layer' Leaflet.Icon.Default.imagePath = '//cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0/images/' @@ -47,6 +48,8 @@ const examples = (

Animate

Click the map to move to the location

+

WMS tile layer

+
) diff --git a/example/components/wms-tile-layer.js b/example/components/wms-tile-layer.js new file mode 100644 index 00000000..147f77cf --- /dev/null +++ b/example/components/wms-tile-layer.js @@ -0,0 +1,35 @@ +import React, { Component } from 'react' +import { Map, TileLayer, WMSTileLayer } from '../../src' + +export default class WMSTileLayerExample extends Component { + state = { + lat: 51.505, + lng: -0.09, + zoom: 5, + bluemarble: false, + } + + onClick = () => { + this.setState({ + bluemarble: !this.state.bluemarble, + }) + } + + render () { + return ( + + + + + ) + } +} diff --git a/lib/WMSTileLayer.js b/lib/WMSTileLayer.js index 9d727dd9..45e2b4b6 100644 --- a/lib/WMSTileLayer.js +++ b/lib/WMSTileLayer.js @@ -2,6 +2,10 @@ exports.__esModule = true; +var _isEqual2 = require('lodash/isEqual'); + +var _isEqual3 = _interopRequireDefault(_isEqual2); + var _leaflet = require('leaflet'); var _react = require('react'); @@ -41,6 +45,12 @@ var WMSTileLayer = function (_GridLayer) { this.leafletElement = _leaflet.tileLayer.wms(url, this.getOptions(props)); }; + WMSTileLayer.prototype.componentDidUpdate = function componentDidUpdate(prevProps) { + if (!(0, _isEqual3.default)(this.props, prevProps)) { + this.leafletElement.setParams(this.props); + } + }; + return WMSTileLayer; }(_GridLayer3.default); diff --git a/package.json b/package.json index 6b454d33..d7e2b69d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-leaflet", - "version": "1.0.0-rc.1", + "version": "1.0.0-rc.2", "description": "React components for Leaflet maps", "main": "lib/index.js", "scripts": { @@ -57,15 +57,15 @@ "babel-preset-es2015": "^6.14.0", "babel-preset-react": "^6.11.1", "babel-preset-stage-0": "^6.5.0", - "eslint": "^3.8.0", + "eslint": "^3.8.1", "eslint-config-standard": "^6.1.0", "eslint-config-standard-jsx": "^3.1.0", "eslint-config-standard-react": "^4.1.0", - "eslint-plugin-promise": "^3.0.0", + "eslint-plugin-promise": "^3.2.0", "eslint-plugin-react": "^6.3.0", "eslint-plugin-standard": "^2.0.1", "flow-bin": "^0.33.0", - "jest-cli": "^16.0.1", + "jest-cli": "^16.0.2", "leaflet": "^1.0.0", "lodash-webpack-plugin": "^0.10.1", "react": "^15.3.2", diff --git a/src/WMSTileLayer.js b/src/WMSTileLayer.js index af390608..7fbf0590 100644 --- a/src/WMSTileLayer.js +++ b/src/WMSTileLayer.js @@ -1,6 +1,7 @@ /* @flow */ import { tileLayer } from 'leaflet' +import { isEqual } from 'lodash' import { PropTypes } from 'react' import GridLayer from './GridLayer' @@ -15,4 +16,10 @@ export default class WMSTileLayer extends GridLayer { const { url, ...props } = this.props this.leafletElement = tileLayer.wms(url, this.getOptions(props)) } + + componentDidUpdate (prevProps: Object) { + if (!isEqual(this.props, prevProps)) { + this.leafletElement.setParams(this.props) + } + } }