@progress/kendo-react-map 9.0.0-develop.1 → 9.0.0-develop.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -22
- package/dist/cdn/js/kendo-react-map.js +1 -1
- package/package-metadata.mjs +1 -1
- package/package.json +5 -5
- package/store/reducer.js +1 -1
- package/store/reducer.mjs +5 -5
- package/tooltip/MapTooltip.js +1 -1
- package/tooltip/MapTooltip.mjs +7 -15
- package/utils/index.js +1 -1
- package/utils/index.mjs +5 -7
package/README.md
CHANGED
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
# KendoReact Map Library for React
|
|
6
6
|
|
|
7
7
|
> **Important**
|
|
8
|
-
>
|
|
9
|
-
>
|
|
10
|
-
>
|
|
11
|
-
>
|
|
8
|
+
>
|
|
9
|
+
> - This package is а part of [KendoReact](https://www.telerik.com/kendo-react-ui?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map)—a commercial UI library.
|
|
10
|
+
> - You will need to install a license key when adding the package to your project. For more information, please refer to the [KendoReact My License page](https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map).
|
|
11
|
+
> - To receive a license key, you need to either [purchase a license](https://www.telerik.com/kendo-react-ui/pricing?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map) or register for a [free trial](https://www.telerik.com/try/kendo-react-ui?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map). Doing so indicates that you [accept the KendoReact License Agreement](https://www.telerik.com/purchase/license-agreement/progress-kendoreact?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map).
|
|
12
|
+
> - The 30-day free trial gives you access to all the KendoReact components and their full functionality. Additionally, for the period of your license, you get access to our legendary technical support provided directly by the KendoReact dev team!
|
|
12
13
|
>
|
|
13
14
|
> [Start using KendoReact](https://www.telerik.com/try/kendo-react-ui?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map) and speed up your development process!
|
|
14
15
|
|
|
@@ -18,34 +19,34 @@ The [React Map](https://www.telerik.com/kendo-react-ui/map), part of KendoReact,
|
|
|
18
19
|
|
|
19
20
|
[The React Map component](https://www.telerik.com/kendo-react-ui/components/map/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map) found in KendoReact is a powerful data visualization tool that can fit into any application. This one component includes 4 different types of map layer types. Available layer types include:
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
- [Tile Layer](https://www.telerik.com/kendo-react-ui/components/map/layers/tile/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map)
|
|
23
|
+
- [Shape (GeoJSON) Layer](https://www.telerik.com/kendo-react-ui/components/map/layers/shape/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map)
|
|
24
|
+
- [Bubble Map Layer](https://www.telerik.com/kendo-react-ui/components/map/layers/bubble/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map)
|
|
25
|
+
- [Marker Layer](https://www.telerik.com/kendo-react-ui/components/map/layers/marker/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map)
|
|
25
26
|
|
|
26
27
|
## Support Options
|
|
27
28
|
|
|
28
29
|
For any issues you might encounter while working with the KendoReact Map, use any of the available support channels:
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
- Industry-leading technical support—KendoReact paid license holders and users with an active (free) trial license can take advantage of our outstanding customer support. To submit a ticket, use [the dedicated KendoReact support system](https://www.telerik.com/account/support-tickets?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map).
|
|
32
|
+
- Product forums—The [KendoReact forums](https://www.telerik.com/forums/kendo-ui-react?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map) are part of the free support you can get from the community and from the KendoReact team.
|
|
33
|
+
- Feedback portal—The [KendoReact feedback portal](https://feedback.telerik.com/kendo-react-ui?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map) is where you can request and vote for new features to be added.
|
|
33
34
|
|
|
34
35
|
## Resources
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
- [Getting Started with KendoReact](https://www.telerik.com/kendo-react-ui/components/getting-started/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map)
|
|
38
|
+
- [Getting Started with the KendoReact Map](https://www.telerik.com/kendo-react-ui/components/map/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map)
|
|
39
|
+
- [API Reference of the KendoReact Map](https://www.telerik.com/kendo-react-ui/components/map/api/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map)
|
|
40
|
+
- [KendoReact Roadmap](https://www.telerik.com/support/whats-new/kendo-react-ui/roadmap?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map)
|
|
41
|
+
- [Blogs](https://www.telerik.com/blogs/tag/kendoreact?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map)
|
|
42
|
+
- [Demos, documentation, and component reference](https://www.telerik.com/kendo-react-ui/components/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map)
|
|
43
|
+
- [KendoReact pricing and licensing](https://www.telerik.com/kendo-react-ui/pricing?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map)
|
|
44
|
+
- [Changelog](https://www.telerik.com/kendo-react-ui/components/changelogs/ui-for-react/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-map)
|
|
44
45
|
|
|
45
46
|
High-level component overview pages
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
- [React Map Component](https://www.telerik.com/kendo-react-ui/map)
|
|
48
49
|
|
|
49
|
-
|
|
50
|
+
_Copyright © 2024 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved._
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
_Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries._
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@progress/kendo-react-common"),require("prop-types"),require("@progress/kendo-charts"),require("@progress/kendo-react-popup"),require("@progress/kendo-svg-icons")):"function"==typeof define&&define.amd?define(["exports","react","@progress/kendo-react-common","prop-types","@progress/kendo-charts","@progress/kendo-react-popup","@progress/kendo-svg-icons"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactMap={},e.React,e.KendoReactCommon,e.PropTypes,e.KendoCharts,e.KendoReactPopup,e.KendoSvgIcons)}(this,(function(e,t,n,r,o,s,a){"use strict";function i(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var p=i(t);const c=p.createContext(null);c.displayName="MapContext";const l=class extends p.Component{constructor(e,t){super(e,t),this.optionsStore=t.optionsStore}renderChildren(e,t){const{children:n}=e.props,{_mapKey:r,_parentStore:o}=this.props,s={...e.props,_mapCollectionIdxKey:`${r}_${t}`,_parentStore:o};return p.cloneElement(e,s,n)}render(){const{_mapKey:e,_parentStore:t,children:n}=this.props;return(t||this.optionsStore).dispatch({mapKey:e,payload:[]}),p.Children.map(n,((e,t)=>p.isValidElement(e)?this.renderChildren(e,t):e))}};l.contextType=c;let h=l;const u=e=>{let t,r=[];const o=o=>{t=e(t,o),n.canUseDOM&&r.forEach((e=>e()))};return o({}),{getState:()=>t,dispatch:o,subscribe:e=>(r.push(e),()=>r=r.filter((t=>t!==e)))}},d=(e,t)=>t.mapCollectionIdxKey?v.collectionConfigurationItem(e,t):t.mapKey?v.configurationItem(e,t):{},m=(e,t)=>{if(!t.type)return[];switch(t.type){case"add":return[...e,t.payload];case"remove":return e.filter((e=>e!==t.payload));default:return e}},v={configurationItem:(e,t)=>Object.assign(e,{[t.mapKey]:t.payload}),collectionConfigurationItem(e,t){let n=!1;const[r,o]=t.mapCollectionIdxKey.split("_"),s=e[r].map(((e,r)=>parseInt(o,10)===r?(n=!0,t.payload):e));return!1===n&&s.splice(parseInt(o,10),0,t.payload),Object.assign(e,{[r]:s})},themeItem(e,t){let n={},r=Object.assign(n,e);const{field:o,value:s}=t.payload,a=o.split(".");let i=a.shift();for(;a.length>0;)n=n[i]=n[i]||{},i=a.shift();return n[i]=s,r}},y=class extends p.Component{constructor(e,t){super(e,t),this.optionsStore=t.optionsStore,this.childStore=u(d)}render(){const{children:e}=this.props;return void 0!==e?p.Children.map(e,(e=>p.isValidElement(e)?this.renderChildren(e):e)):null}componentDidMount(){this.dispatch()}componentDidUpdate(){this.dispatch()}dispatch(){const{_mapKey:e,_mapCollectionIdxKey:t,_parentStore:n,children:r,...o}=this.props;(n||this.optionsStore).dispatch({mapKey:e,mapCollectionIdxKey:t,payload:Object.assign({},o,this.childStore.getState())})}renderChildren(e){const{children:t}=e.props,n={...e.props,_parentStore:this.childStore};return p.cloneElement(e,n,t)}};y.contextType=c;let g=y,f=class{constructor(e){this.target=e}},I=class extends f{constructor(e,t){super(t)}},b=class extends f{constructor(e,t){super(t),this.location=e.location,this.originalEvent=e.originalEvent}},E=class extends f{constructor(e,t){super(t),this.marker=e.marker,this.layer=e.layer}};class S extends f{constructor(e,t){super(t),this.marker=e.marker,this.layer=e.layer}}let M=class extends f{constructor(){super(...arguments),this.prevented=!1}preventDefault(){this.prevented=!0}isDefaultPrevented(){return this.prevented}},k=class extends M{constructor(e,t){super(t),this.marker=e.marker,this.layer=e.layer}},x=class extends f{constructor(e,t){super(t),this.origin=e.origin,this.center=e.center,this.originalEvent=e.originalEvent}},C=class extends f{constructor(e,t){super(t),this.origin=e.origin,this.center=e.center,this.originalEvent=e.originalEvent}},T=class extends f{constructor(e,t){super(t)}},O=class extends f{constructor(e,t){super(t),this.layer=e.layer,this.shape=e.shape,this.originalEvent=e.originalEvent}},w=class extends f{constructor(e,t){super(t),this.layer=e.layer,this.shape=e.shape,this.location=null,e.shape&&(this.dataItem=e.shape.dataItem,this.location=e.shape.location)}},L=class extends f{constructor(e,t){super(t),this.dataItem=e.dataItem,this.layer=e.layer,this.group=e.group,this.properties=e.properties}},A=class extends f{constructor(e,t){super(t),this.layer=e.layer,this.shape=e.shape,this.originalEvent=e.originalEvent}},K=class extends f{constructor(e,t){super(t),this.layer=e.layer,this.shape=e.shape,this.originalEvent=e.originalEvent}},_=class extends f{constructor(e,t){super(t),this.originalEvent=e.originalEvent}},D=class extends M{constructor(e,t){super(t),this.originalEvent=e.originalEvent}};const N={beforeReset:I,mapClick:b,markerActivate:E,markerClick:S,markerCreated:k,panEnd:x,pan:C,reset:T,shapeClick:O,shapeCreated:w,shapeFeatureCreated:L,shapeMouseEnter:A,shapeMouseLeave:K,zoomEnd:_,zoomStart:D};function P(e,t,n,r){const o=e[t];if(o&&Array.isArray(o))for(let e of o)if(!e.type||e.type!==r)return new Error(`${n} children should be Array of type ${r.displayName}.`);return null}const R={horizontal:"fit",vertical:"fit"},U=["k-tooltip","k-map-tooltip"],j=class extends p.Component{constructor(e,t){super(e,t),this.context=null,this.element=null,this.onMapMouseLeave=e=>{const{syntheticEvent:t}=e;return!!function(e,t){let n=e;for(;n&&n!==t;)n=n.parentNode;return!!n}(t.relatedTarget,this.element)},this.mapObserver=new o.InstanceObserver(this,{onMouseLeave:"onMapMouseLeave"}),t.observersStore.dispatch({type:"add",payload:this.mapObserver})}render(){const{popupShown:e,popupAlign:t,popupOffset:n,popupStyles:r,popupContent:o,className:a}=this.props,i=[...U,a].join(" ").trim();return p.createElement(s.Popup,{animate:!0,popupAlign:t,offset:n,show:e,collision:R,className:"k-tooltip-wrapper"},p.createElement("div",{className:i,style:r,ref:e=>this.element=e},o()))}componentWillUnmount(){this.context.observersStore.dispatch({type:"remove",payload:this.mapObserver})}};j.contextType=c;let z=j;const V=class extends p.Component{constructor(){super(...arguments),this.context=null,this.state={popupShown:!1}}componentDidMount(){this.mapObserver=new o.InstanceObserver(this,{showTooltip:"onShowTooltip",hideTooltip:"onHideTooltip"}),this.context.observersStore.dispatch({type:"add",payload:this.mapObserver})}render(){const{popupContext:e,shared:t,className:n,...r}=this.state;if(!e||!this.state.popupShown)return null;const o=e.layerIndex,s=this.findRenderFunctionByLayer(o);if(!s)return null;const a=`k-map-${e.type}-tooltip`;return p.createElement(z,{...r,popupContent:()=>p.createElement("div",{className:"k-tooltip-content"},s(e)),className:a})}componentWillUnmount(){this.context.observersStore.dispatch({type:"remove",payload:this.mapObserver})}onShowTooltip(e){const{anchor:t,className:n}=e;let r=this.createTooltipContext(e);this.setState({popupShown:!0,popupAlign:{vertical:"bottom",horizontal:"center"},popupOffset:t,popupContext:r,popupStyles:{position:"relative"},className:n})}onHideTooltip(){this.setState({popupShown:!1,popupStyles:{},className:void 0})}createTooltipContext(e){return e}findRenderFunctionByLayer(e){const t=this.context.optionsStore.getState().layers;return void 0!==t&&Array.isArray(t)&&void 0!==t[e]&&t[e].hasOwnProperty("tooltip")&&t[e].tooltip.hasOwnProperty("render")?t[e].tooltip.render:null}};V.contextType=c;let q=V;const B={name:"@progress/kendo-react-map",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:1651750998,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"};class Z{constructor(e,t){this.sender=e,this.syntheticEvent=t}}function F(e,t){return new Z(e,t)}const $={mapMarkerTargetIcon:a.mapMarkerTargetIcon,mapMarkerIcon:a.mapMarkerIcon,plusIcon:a.plusIcon,minusIcon:a.minusIcon,caretAltUpIcon:a.caretAltUpIcon,caretAltDownIcon:a.caretAltDownIcon,caretAltLeftIcon:a.caretAltLeftIcon,caretAltRightIcon:a.caretAltRightIcon},H=class extends p.Component{constructor(e){super(e),this.mapInstance=null,this._element=null,this.optionsStore={},this.optionsUnsubscriber=Function.prototype,this.observersStore={},this.iconsType="svg",this.svgIcons=$,this.onInit=e=>{this.mapInstance=e.sender},this.onRender=e=>{null!==this.mapInstance&&this.trigger("render",e)},this.onMapMouseLeave=e=>{const t=F(this,e);this.triggerDomEvent("onMouseLeave",t)?e.preventDefault():null!==this.mapInstance&&this.mapInstance.hideTooltip()},n.validatePackage(B),this.optionsStore=u(d),this.observersStore=u(m),this.childrenObserver=new o.InstanceObserver(this,{onMouseLeave:"onChildMouseLeave"}),this.contextValue={optionsStore:this.optionsStore,observersStore:this.observersStore,childrenObserver:this.childrenObserver},this.mapObserver=new o.InstanceObserver(this,{init:"onInit"})}get element(){return this._element}componentDidMount(){this.instantiateCoreMap(),this.optionsUnsubscriber=this.optionsStore.subscribe(this.refresh.bind(this))}componentWillUnmount(){this.optionsUnsubscriber(),null!==this.mapInstance&&(this.mapInstance.destroy(),this.mapInstance=null)}componentDidUpdate(e){const{dir:t,children:n,...r}=this.props;null!==this.mapInstance&&(Object.entries(e).filter((e=>"dir"!==e[0]&&"children"!==e[0])).some((e=>{const[t,n]=e;return!(r.hasOwnProperty(t)&&r[t]===n)}))&&this.refresh(),e.dir)}render(){const{style:e={},className:t,children:r}=this.props,o=Object.assign({},e,{position:"relative"}),s=p.createElement("div",{className:t,style:o,key:"mapElement"},p.createElement("div",{ref:e=>this._element=e,className:"k-map",onMouseLeave:this.onMapMouseLeave},r));return p.createElement(n.IconsContext.Consumer,null,(e=>p.createElement(c.Provider,{value:this.contextValue},p.createElement(q,{key:"tooltip"}),s,this.setIcons(e))))}getMapOptions(){const{center:e,controls:t,minZoom:n,maxZoom:r,minSize:o,pannable:s,wraparound:a,zoom:i,zoomable:p}=this.props;let c={center:e,controls:t,minZoom:n,maxZoom:r,minSize:o,pannable:s,wraparound:a,zoom:i,zoomable:p,icons:{type:this.iconsType,svgIcons:this.svgIcons}};return c=Object.assign(c,this.optionsStore.getState()),c}get layers(){var e;return null==(e=this.mapInstance)?void 0:e.layers}get extent(){var e;return null==(e=this.mapInstance)?void 0:e.extent()}set extent(e){var t;null==(t=this.mapInstance)||t.extent(e)}resize(){}viewSize(){var e;return null==(e=this.mapInstance)?void 0:e.viewSize()}eventOffset(e){var t;return null==(t=this.mapInstance)?void 0:t.eventOffset(e)}eventToLayer(e){var t;return null==(t=this.mapInstance)?void 0:t.eventToLayer(e)}eventToLocation(e){var t;return null==(t=this.mapInstance)?void 0:t.eventToLocation(e)}eventToView(e){var t;return null==(t=this.mapInstance)?void 0:t.eventToView(e)}layerToLocation(e,t){var n;return null==(n=this.mapInstance)?void 0:n.layerToLocation(e,t)}locationToLayer(e,t){var n;return null==(n=this.mapInstance)?void 0:n.locationToLayer(e,t)}locationToView(e){var t;return null==(t=this.mapInstance)?void 0:t.locationToView(e)}viewToLocation(e,t){var n;return null==(n=this.mapInstance)?void 0:n.viewToLocation(e,t)}loadMarkers(e){const t=this.mapInstance.markers;t&&t._load(e)}refresh(){if(null!==this.mapInstance){const e=this.getMapOptions();this.props.onRefresh?this.props.onRefresh.call(void 0,e,this.mapInstance):this.mapInstance.setOptions(e)}}instantiateCoreMap(){const e=this.getMapOptions();this.mapInstance=new o.Map(this.element,e,{},{observer:this.mapObserver,sender:this})}trigger(e,t){const n="click"===e?"mapClick":e,r=function(e,t,n){if(N[e])return new N[e](t,n)}(n,t,this),o="on"+n.charAt(0).toUpperCase()+n.slice(1),s=this.observersStore.getState();let a=!1;for(let e=0;e<s.length;e++)s[e].trigger(n,t)&&(a=!0);return!1===a&&r&&this.props.hasOwnProperty(o)?(this.props[o].call(void 0,r),r.isDefaultPrevented&&r.isDefaultPrevented()):a}requiresHandlers(e){for(let t=0;t<e.length;t++){const n=e[t],r="on"+n.charAt(0).toUpperCase()+n.slice(1);if(this.props.hasOwnProperty(r))return!0}return!1}triggerDomEvent(e,t){const n=this.observersStore.getState();let r=!1;for(let o=0;o<n.length;o++)n[o].trigger(e,t)&&(r=!0);return r}setIcons(e){const{type:t,icons:n={}}=e,r={...$},o={mapMarkerTargetIcon:n.mapMarkerTargetIcon,mapMarkerIcon:n.mapMarkerIcon,plusIcon:n.plusIcon,minusIcon:n.minusIcon,caretAltUpIcon:n.caretAltUpIcon,caretAltDownIcon:n.caretAltDownIcon,caretAltLeftIcon:n.caretAltLeftIcon,caretAltRightIcon:n.caretAltRightIcon};let s;for(s in o)if(o[s]){const e=o[s];e&&"string"!=typeof e&&(r[s]=e)}return this.svgIcons=r,this.iconsType=t||"svg",null}};H.propTypes={dir:r.string},H.defaultProps={};let W=H;const G=e=>p.createElement(h,{...e,_mapKey:"layers"});G.propTypes={children:r.node};const J=e=>p.createElement(g,{...e,_mapKey:"tooltip"}),Q=e=>p.createElement(g,{type:"shape",...e});Q.displayName="MapShapeLayer",Q.propTypes={children:function(e,t,n){return P(e,t,n,J)}};const X=e=>p.createElement(g,{type:"tile",...e});X.displayName="MapTileLayer";const Y=e=>p.createElement(g,{...e,_mapKey:"tooltip"}),ee=e=>p.createElement(g,{type:"bubble",...e});ee.displayName="MapBubbleLayer",ee.propTypes={children:function(e,t,n){return P(e,t,n,Y)}};const te=e=>p.createElement(g,{...e,_mapKey:"tooltip"}),ne=e=>p.createElement(g,{type:"marker",...e});ne.displayName="MapMarkerLayer",ne.propTypes={children:function(e,t,n){return P(e,t,n,te)}},Object.defineProperty(e,"Extent",{enumerable:!0,get:function(){return o.Extent}}),Object.defineProperty(e,"Location",{enumerable:!0,get:function(){return o.Location}}),e.BeforeResetEvent=I,e.CollectionConfigurationComponent=h,e.ConfigurationComponent=g,e.Map=W,e.MapBubbleLayer=ee,e.MapBubbleLayerTooltip=Y,e.MapClickEvent=b,e.MapLayers=G,e.MapMarkerLayer=ne,e.MapMarkerLayerTooltip=te,e.MapShapeLayer=Q,e.MapShapeLayerTooltip=J,e.MapTileLayer=X,e.MapTooltip=q,e.MarkerActivateEvent=E,e.MarkerClickEvent=S,e.MarkerCreatedEvent=k,e.PanEndEvent=x,e.PanEvent=C,e.ResetEvent=T,e.ShapeClickEvent=O,e.ShapeCreatedEvent=w,e.ShapeFeatureCreatedEvent=L,e.ShapeMouseEnterEvent=A,e.ShapeMouseLeaveEvent=K,e.ZoomEndEvent=_,e.ZoomStartEvent=D}));
|
|
8
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@progress/kendo-react-common"),require("prop-types"),require("@progress/kendo-charts"),require("@progress/kendo-react-popup"),require("@progress/kendo-svg-icons")):"function"==typeof define&&define.amd?define(["exports","react","@progress/kendo-react-common","prop-types","@progress/kendo-charts","@progress/kendo-react-popup","@progress/kendo-svg-icons"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactMap={},e.React,e.KendoReactCommon,e.PropTypes,e.KendoCharts,e.KendoReactPopup,e.KendoSvgIcons)}(this,(function(e,t,n,r,o,s,a){"use strict";function i(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var p=i(t);const c=p.createContext(null);c.displayName="MapContext";const l=class extends p.Component{constructor(e,t){super(e,t),this.optionsStore=t.optionsStore}renderChildren(e,t){const{children:n}=e.props,{_mapKey:r,_parentStore:o}=this.props,s={...e.props,_mapCollectionIdxKey:`${r}_${t}`,_parentStore:o};return p.cloneElement(e,s,n)}render(){const{_mapKey:e,_parentStore:t,children:n}=this.props;return(t||this.optionsStore).dispatch({mapKey:e,payload:[]}),p.Children.map(n,((e,t)=>p.isValidElement(e)?this.renderChildren(e,t):e))}};l.contextType=c;let h=l;const u=e=>{let t,r=[];const o=o=>{t=e(t,o),n.canUseDOM&&r.forEach((e=>e()))};return o({}),{getState:()=>t,dispatch:o,subscribe:e=>(r.push(e),()=>r=r.filter((t=>t!==e)))}},d=(e,t)=>t.mapCollectionIdxKey?v.collectionConfigurationItem(e,t):t.mapKey?v.configurationItem(e,t):{},m=(e,t)=>{if(!t.type)return[];switch(t.type){case"add":return[...e,t.payload];case"remove":return e.filter((e=>e!==t.payload));default:return e}},v={configurationItem:(e,t)=>Object.assign(e,{[t.mapKey]:t.payload}),collectionConfigurationItem(e,t){let n=!1;const[r,o]=t.mapCollectionIdxKey.split("_"),s=e[r].map(((e,r)=>parseInt(o,10)===r?(n=!0,t.payload):e));return!1===n&&s.splice(parseInt(o,10),0,t.payload),Object.assign(e,{[r]:s})},themeItem(e,t){let n={};const r=Object.assign(n,e),{field:o,value:s}=t.payload,a=o.split(".");let i=a.shift();for(;a.length>0;)n=n[i]=n[i]||{},i=a.shift();return n[i]=s,r}},y=class extends p.Component{constructor(e,t){super(e,t),this.optionsStore=t.optionsStore,this.childStore=u(d)}render(){const{children:e}=this.props;return void 0!==e?p.Children.map(e,(e=>p.isValidElement(e)?this.renderChildren(e):e)):null}componentDidMount(){this.dispatch()}componentDidUpdate(){this.dispatch()}dispatch(){const{_mapKey:e,_mapCollectionIdxKey:t,_parentStore:n,children:r,...o}=this.props;(n||this.optionsStore).dispatch({mapKey:e,mapCollectionIdxKey:t,payload:Object.assign({},o,this.childStore.getState())})}renderChildren(e){const{children:t}=e.props,n={...e.props,_parentStore:this.childStore};return p.cloneElement(e,n,t)}};y.contextType=c;let g=y,f=class{constructor(e){this.target=e}},I=class extends f{constructor(e,t){super(t)}},b=class extends f{constructor(e,t){super(t),this.location=e.location,this.originalEvent=e.originalEvent}},E=class extends f{constructor(e,t){super(t),this.marker=e.marker,this.layer=e.layer}};class S extends f{constructor(e,t){super(t),this.marker=e.marker,this.layer=e.layer}}let M=class extends f{constructor(){super(...arguments),this.prevented=!1}preventDefault(){this.prevented=!0}isDefaultPrevented(){return this.prevented}},k=class extends M{constructor(e,t){super(t),this.marker=e.marker,this.layer=e.layer}},x=class extends f{constructor(e,t){super(t),this.origin=e.origin,this.center=e.center,this.originalEvent=e.originalEvent}},C=class extends f{constructor(e,t){super(t),this.origin=e.origin,this.center=e.center,this.originalEvent=e.originalEvent}},T=class extends f{constructor(e,t){super(t)}},O=class extends f{constructor(e,t){super(t),this.layer=e.layer,this.shape=e.shape,this.originalEvent=e.originalEvent}},w=class extends f{constructor(e,t){super(t),this.layer=e.layer,this.shape=e.shape,this.location=null,e.shape&&(this.dataItem=e.shape.dataItem,this.location=e.shape.location)}},L=class extends f{constructor(e,t){super(t),this.dataItem=e.dataItem,this.layer=e.layer,this.group=e.group,this.properties=e.properties}},A=class extends f{constructor(e,t){super(t),this.layer=e.layer,this.shape=e.shape,this.originalEvent=e.originalEvent}},K=class extends f{constructor(e,t){super(t),this.layer=e.layer,this.shape=e.shape,this.originalEvent=e.originalEvent}},_=class extends f{constructor(e,t){super(t),this.originalEvent=e.originalEvent}},D=class extends M{constructor(e,t){super(t),this.originalEvent=e.originalEvent}};const N={beforeReset:I,mapClick:b,markerActivate:E,markerClick:S,markerCreated:k,panEnd:x,pan:C,reset:T,shapeClick:O,shapeCreated:w,shapeFeatureCreated:L,shapeMouseEnter:A,shapeMouseLeave:K,zoomEnd:_,zoomStart:D};function P(e,t,n,r){const o=e[t];if(o&&Array.isArray(o))for(const e of o)if(!e.type||e.type!==r)return new Error(`${n} children should be Array of type ${r.displayName}.`);return null}const R={horizontal:"fit",vertical:"fit"},U=["k-tooltip","k-map-tooltip"],j=class extends p.Component{constructor(e,t){super(e,t),this.context=null,this.element=null,this.onMapMouseLeave=e=>{const{syntheticEvent:t}=e;return!!function(e,t){let n=e;for(;n&&n!==t;)n=n.parentNode;return!!n}(t.relatedTarget,this.element)},this.mapObserver=new o.InstanceObserver(this,{onMouseLeave:"onMapMouseLeave"}),t.observersStore.dispatch({type:"add",payload:this.mapObserver})}render(){const{popupShown:e,popupAlign:t,popupOffset:n,popupStyles:r,popupContent:o,className:a}=this.props,i=[...U,a].join(" ").trim();return p.createElement(s.Popup,{animate:!0,popupAlign:t,offset:n,show:e,collision:R,className:"k-tooltip-wrapper"},p.createElement("div",{className:i,style:r,ref:e=>this.element=e},o()))}componentWillUnmount(){this.context.observersStore.dispatch({type:"remove",payload:this.mapObserver})}};j.contextType=c;let z=j;const V=class extends p.Component{constructor(){super(...arguments),this.context=null,this.state={popupShown:!1}}componentDidMount(){this.mapObserver=new o.InstanceObserver(this,{showTooltip:"onShowTooltip",hideTooltip:"onHideTooltip"}),this.context.observersStore.dispatch({type:"add",payload:this.mapObserver})}render(){const{popupContext:e,shared:t,className:n,...r}=this.state;if(!e||!this.state.popupShown)return null;const o=e.layerIndex,s=this.findRenderFunctionByLayer(o);if(!s)return null;const a=`k-map-${e.type}-tooltip`;return p.createElement(z,{...r,popupContent:()=>p.createElement("div",{className:"k-tooltip-content"},s(e)),className:a})}componentWillUnmount(){this.context.observersStore.dispatch({type:"remove",payload:this.mapObserver})}onShowTooltip(e){const{anchor:t,className:n}=e,r=this.createTooltipContext(e);this.setState({popupShown:!0,popupAlign:{vertical:"bottom",horizontal:"center"},popupOffset:t,popupContext:r,popupStyles:{position:"relative"},className:n})}onHideTooltip(){this.setState({popupShown:!1,popupStyles:{},className:void 0})}createTooltipContext(e){return e}findRenderFunctionByLayer(e){const t=this.context.optionsStore.getState().layers;return void 0!==t&&Array.isArray(t)&&void 0!==t[e]&&t[e].hasOwnProperty("tooltip")&&t[e].tooltip.hasOwnProperty("render")?t[e].tooltip.render:null}};V.contextType=c;let q=V;const B={name:"@progress/kendo-react-map",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:1651750998,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"};class Z{constructor(e,t){this.sender=e,this.syntheticEvent=t}}function F(e,t){return new Z(e,t)}const $={mapMarkerTargetIcon:a.mapMarkerTargetIcon,mapMarkerIcon:a.mapMarkerIcon,plusIcon:a.plusIcon,minusIcon:a.minusIcon,caretAltUpIcon:a.caretAltUpIcon,caretAltDownIcon:a.caretAltDownIcon,caretAltLeftIcon:a.caretAltLeftIcon,caretAltRightIcon:a.caretAltRightIcon},H=class extends p.Component{constructor(e){super(e),this.mapInstance=null,this._element=null,this.optionsStore={},this.optionsUnsubscriber=Function.prototype,this.observersStore={},this.iconsType="svg",this.svgIcons=$,this.onInit=e=>{this.mapInstance=e.sender},this.onRender=e=>{null!==this.mapInstance&&this.trigger("render",e)},this.onMapMouseLeave=e=>{const t=F(this,e);this.triggerDomEvent("onMouseLeave",t)?e.preventDefault():null!==this.mapInstance&&this.mapInstance.hideTooltip()},n.validatePackage(B),this.optionsStore=u(d),this.observersStore=u(m),this.childrenObserver=new o.InstanceObserver(this,{onMouseLeave:"onChildMouseLeave"}),this.contextValue={optionsStore:this.optionsStore,observersStore:this.observersStore,childrenObserver:this.childrenObserver},this.mapObserver=new o.InstanceObserver(this,{init:"onInit"})}get element(){return this._element}componentDidMount(){this.instantiateCoreMap(),this.optionsUnsubscriber=this.optionsStore.subscribe(this.refresh.bind(this))}componentWillUnmount(){this.optionsUnsubscriber(),null!==this.mapInstance&&(this.mapInstance.destroy(),this.mapInstance=null)}componentDidUpdate(e){const{dir:t,children:n,...r}=this.props;null!==this.mapInstance&&(Object.entries(e).filter((e=>"dir"!==e[0]&&"children"!==e[0])).some((e=>{const[t,n]=e;return!(r.hasOwnProperty(t)&&r[t]===n)}))&&this.refresh(),e.dir)}render(){const{style:e={},className:t,children:r}=this.props,o=Object.assign({},e,{position:"relative"}),s=p.createElement("div",{className:t,style:o,key:"mapElement"},p.createElement("div",{ref:e=>this._element=e,className:"k-map",onMouseLeave:this.onMapMouseLeave},r));return p.createElement(n.IconsContext.Consumer,null,(e=>p.createElement(c.Provider,{value:this.contextValue},p.createElement(q,{key:"tooltip"}),s,this.setIcons(e))))}getMapOptions(){const{center:e,controls:t,minZoom:n,maxZoom:r,minSize:o,pannable:s,wraparound:a,zoom:i,zoomable:p}=this.props;let c={center:e,controls:t,minZoom:n,maxZoom:r,minSize:o,pannable:s,wraparound:a,zoom:i,zoomable:p,icons:{type:this.iconsType,svgIcons:this.svgIcons}};return c=Object.assign(c,this.optionsStore.getState()),c}get layers(){var e;return null==(e=this.mapInstance)?void 0:e.layers}get extent(){var e;return null==(e=this.mapInstance)?void 0:e.extent()}set extent(e){var t;null==(t=this.mapInstance)||t.extent(e)}resize(){}viewSize(){var e;return null==(e=this.mapInstance)?void 0:e.viewSize()}eventOffset(e){var t;return null==(t=this.mapInstance)?void 0:t.eventOffset(e)}eventToLayer(e){var t;return null==(t=this.mapInstance)?void 0:t.eventToLayer(e)}eventToLocation(e){var t;return null==(t=this.mapInstance)?void 0:t.eventToLocation(e)}eventToView(e){var t;return null==(t=this.mapInstance)?void 0:t.eventToView(e)}layerToLocation(e,t){var n;return null==(n=this.mapInstance)?void 0:n.layerToLocation(e,t)}locationToLayer(e,t){var n;return null==(n=this.mapInstance)?void 0:n.locationToLayer(e,t)}locationToView(e){var t;return null==(t=this.mapInstance)?void 0:t.locationToView(e)}viewToLocation(e,t){var n;return null==(n=this.mapInstance)?void 0:n.viewToLocation(e,t)}loadMarkers(e){const t=this.mapInstance.markers;t&&t._load(e)}refresh(){if(null!==this.mapInstance){const e=this.getMapOptions();this.props.onRefresh?this.props.onRefresh.call(void 0,e,this.mapInstance):this.mapInstance.setOptions(e)}}instantiateCoreMap(){const e=this.getMapOptions();this.mapInstance=new o.Map(this.element,e,{},{observer:this.mapObserver,sender:this})}trigger(e,t){const n="click"===e?"mapClick":e,r=function(e,t,n){if(N[e])return new N[e](t,n)}(n,t,this),o="on"+n.charAt(0).toUpperCase()+n.slice(1),s=this.observersStore.getState();let a=!1;for(let e=0;e<s.length;e++)s[e].trigger(n,t)&&(a=!0);return!1===a&&r&&this.props.hasOwnProperty(o)?(this.props[o].call(void 0,r),r.isDefaultPrevented&&r.isDefaultPrevented()):a}requiresHandlers(e){for(let t=0;t<e.length;t++){const n=e[t],r="on"+n.charAt(0).toUpperCase()+n.slice(1);if(this.props.hasOwnProperty(r))return!0}return!1}triggerDomEvent(e,t){const n=this.observersStore.getState();let r=!1;for(let o=0;o<n.length;o++)n[o].trigger(e,t)&&(r=!0);return r}setIcons(e){const{type:t,icons:n={}}=e,r={...$},o={mapMarkerTargetIcon:n.mapMarkerTargetIcon,mapMarkerIcon:n.mapMarkerIcon,plusIcon:n.plusIcon,minusIcon:n.minusIcon,caretAltUpIcon:n.caretAltUpIcon,caretAltDownIcon:n.caretAltDownIcon,caretAltLeftIcon:n.caretAltLeftIcon,caretAltRightIcon:n.caretAltRightIcon};let s;for(s in o)if(o[s]){const e=o[s];e&&"string"!=typeof e&&(r[s]=e)}return this.svgIcons=r,this.iconsType=t||"svg",null}};H.propTypes={dir:r.string},H.defaultProps={};let W=H;const G=e=>p.createElement(h,{...e,_mapKey:"layers"});G.propTypes={children:r.node};const J=e=>p.createElement(g,{...e,_mapKey:"tooltip"}),Q=e=>p.createElement(g,{type:"shape",...e});Q.displayName="MapShapeLayer",Q.propTypes={children:function(e,t,n){return P(e,t,n,J)}};const X=e=>p.createElement(g,{type:"tile",...e});X.displayName="MapTileLayer";const Y=e=>p.createElement(g,{...e,_mapKey:"tooltip"}),ee=e=>p.createElement(g,{type:"bubble",...e});ee.displayName="MapBubbleLayer",ee.propTypes={children:function(e,t,n){return P(e,t,n,Y)}};const te=e=>p.createElement(g,{...e,_mapKey:"tooltip"}),ne=e=>p.createElement(g,{type:"marker",...e});ne.displayName="MapMarkerLayer",ne.propTypes={children:function(e,t,n){return P(e,t,n,te)}},Object.defineProperty(e,"Extent",{enumerable:!0,get:function(){return o.Extent}}),Object.defineProperty(e,"Location",{enumerable:!0,get:function(){return o.Location}}),e.BeforeResetEvent=I,e.CollectionConfigurationComponent=h,e.ConfigurationComponent=g,e.Map=W,e.MapBubbleLayer=ee,e.MapBubbleLayerTooltip=Y,e.MapClickEvent=b,e.MapLayers=G,e.MapMarkerLayer=ne,e.MapMarkerLayerTooltip=te,e.MapShapeLayer=Q,e.MapShapeLayerTooltip=J,e.MapTileLayer=X,e.MapTooltip=q,e.MarkerActivateEvent=E,e.MarkerClickEvent=S,e.MarkerCreatedEvent=k,e.PanEndEvent=x,e.PanEvent=C,e.ResetEvent=T,e.ShapeClickEvent=O,e.ShapeCreatedEvent=w,e.ShapeFeatureCreatedEvent=L,e.ShapeMouseEnterEvent=A,e.ShapeMouseLeaveEvent=K,e.ZoomEndEvent=_,e.ZoomStartEvent=D}));
|
package/package-metadata.mjs
CHANGED
|
@@ -10,7 +10,7 @@ const e = {
|
|
|
10
10
|
name: "@progress/kendo-react-map",
|
|
11
11
|
productName: "KendoReact",
|
|
12
12
|
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
13
|
-
publishDate:
|
|
13
|
+
publishDate: 1730217609,
|
|
14
14
|
version: "",
|
|
15
15
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"
|
|
16
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-map",
|
|
3
|
-
"version": "9.0.0-develop.
|
|
3
|
+
"version": "9.0.0-develop.10",
|
|
4
4
|
"description": "KendoReact Map package",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
},
|
|
23
23
|
"sideEffects": false,
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@progress/kendo-drawing": "^1.
|
|
25
|
+
"@progress/kendo-drawing": "^1.21.1",
|
|
26
26
|
"@progress/kendo-licensing": "^1.3.4",
|
|
27
|
-
"@progress/kendo-react-common": "9.0.0-develop.
|
|
28
|
-
"@progress/kendo-react-popup": "9.0.0-develop.
|
|
27
|
+
"@progress/kendo-react-common": "9.0.0-develop.10",
|
|
28
|
+
"@progress/kendo-react-popup": "9.0.0-develop.10",
|
|
29
29
|
"@progress/kendo-svg-icons": "^3.0.0",
|
|
30
30
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
|
31
31
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@progress/kendo-charts": "2.
|
|
34
|
+
"@progress/kendo-charts": "2.6.1",
|
|
35
35
|
"prop-types": "^15.6.0"
|
|
36
36
|
},
|
|
37
37
|
"keywords": [
|
package/store/reducer.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=(t,e)=>e.mapCollectionIdxKey?c.collectionConfigurationItem(t,e):e.mapKey?c.configurationItem(t,e):{},u=(t,e)=>{if(e.type)switch(e.type){case"add":return[...t,e.payload];case"remove":return t.filter(l=>l!==e.payload);default:return t}else return[]},c={configurationItem(t,e){return Object.assign(t,{[e.mapKey]:e.payload})},collectionConfigurationItem(t,e){let l=!1;const[s,n]=e.mapCollectionIdxKey.split("_"),i=t[s].map((r,o)=>parseInt(n,10)===o?(l=!0,e.payload):r);return l===!1&&i.splice(parseInt(n,10),0,e.payload),Object.assign(t,{[s]:i})},themeItem(t,e){let l={};const s=Object.assign(l,t),{field:n,value:i}=e.payload,r=n.split(".");let o=r.shift();for(;r.length>0;)l=l[o]=l[o]||{},o=r.shift();return l[o]=i,s}};exports.observersReducer=u;exports.optionsReducer=a;
|
package/store/reducer.mjs
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
const
|
|
9
|
+
const c = (t, e) => e.mapCollectionIdxKey ? a.collectionConfigurationItem(t, e) : e.mapKey ? a.configurationItem(t, e) : {}, p = (t, e) => {
|
|
10
10
|
if (e.type)
|
|
11
11
|
switch (e.type) {
|
|
12
12
|
case "add":
|
|
@@ -32,8 +32,8 @@ const p = (t, e) => e.mapCollectionIdxKey ? a.collectionConfigurationItem(t, e)
|
|
|
32
32
|
});
|
|
33
33
|
},
|
|
34
34
|
themeItem(t, e) {
|
|
35
|
-
let l = {}
|
|
36
|
-
const { field: n, value: i } = e.payload, r = n.split(".");
|
|
35
|
+
let l = {};
|
|
36
|
+
const s = Object.assign(l, t), { field: n, value: i } = e.payload, r = n.split(".");
|
|
37
37
|
let o = r.shift();
|
|
38
38
|
for (; r.length > 0; )
|
|
39
39
|
l = l[o] = l[o] || {}, o = r.shift();
|
|
@@ -41,6 +41,6 @@ const p = (t, e) => e.mapCollectionIdxKey ? a.collectionConfigurationItem(t, e)
|
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
export {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
p as observersReducer,
|
|
45
|
+
c as optionsReducer
|
|
46
46
|
};
|
package/tooltip/MapTooltip.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react"),d=require("@progress/kendo-charts"),m=require("./Popup.js"),y=require("../MapContext.js");function f(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const s=f(h),i=class i extends s.Component{constructor(){super(...arguments),this.context=null,this.state={popupShown:!1}}componentDidMount(){this.mapObserver=new d.InstanceObserver(this,{showTooltip:"onShowTooltip",hideTooltip:"onHideTooltip"}),this.context.observersStore.dispatch({type:"add",payload:this.mapObserver})}render(){const{popupContext:t,shared:e,className:n,...r}=this.state;if(!t||!this.state.popupShown)return null;const c=t.layerIndex,a=this.findRenderFunctionByLayer(c);if(!a)return null;const l=()=>s.createElement("div",{className:"k-tooltip-content"},a(t)),u=`k-map-${t.type}-tooltip`;return s.createElement(m.TooltipPopup,{...r,popupContent:l,className:u})}componentWillUnmount(){this.context.observersStore.dispatch({type:"remove",payload:this.mapObserver})}onShowTooltip(t){const{anchor:e,className:n}=t
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react"),d=require("@progress/kendo-charts"),m=require("./Popup.js"),y=require("../MapContext.js");function f(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const s=f(h),i=class i extends s.Component{constructor(){super(...arguments),this.context=null,this.state={popupShown:!1}}componentDidMount(){this.mapObserver=new d.InstanceObserver(this,{showTooltip:"onShowTooltip",hideTooltip:"onHideTooltip"}),this.context.observersStore.dispatch({type:"add",payload:this.mapObserver})}render(){const{popupContext:t,shared:e,className:n,...r}=this.state;if(!t||!this.state.popupShown)return null;const c=t.layerIndex,a=this.findRenderFunctionByLayer(c);if(!a)return null;const l=()=>s.createElement("div",{className:"k-tooltip-content"},a(t)),u=`k-map-${t.type}-tooltip`;return s.createElement(m.TooltipPopup,{...r,popupContent:l,className:u})}componentWillUnmount(){this.context.observersStore.dispatch({type:"remove",payload:this.mapObserver})}onShowTooltip(t){const{anchor:e,className:n}=t,r=this.createTooltipContext(t);this.setState({popupShown:!0,popupAlign:{vertical:"bottom",horizontal:"center"},popupOffset:e,popupContext:r,popupStyles:{position:"relative"},className:n})}onHideTooltip(){this.setState({popupShown:!1,popupStyles:{},className:void 0})}createTooltipContext(t){return t}findRenderFunctionByLayer(t){const e=this.context.optionsStore.getState().layers;return e!==void 0&&Array.isArray(e)&&e[t]!==void 0&&e[t].hasOwnProperty("tooltip")&&e[t].tooltip.hasOwnProperty("render")?e[t].tooltip.render:null}};i.contextType=y.MapContext;let p=i;exports.MapTooltip=p;
|
package/tooltip/MapTooltip.mjs
CHANGED
|
@@ -26,21 +26,14 @@ const p = class p extends n.Component {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
render() {
|
|
29
|
-
const { popupContext: t, shared: o, className:
|
|
29
|
+
const { popupContext: t, shared: o, className: s, ...e } = this.state;
|
|
30
30
|
if (!t || !this.state.popupShown)
|
|
31
31
|
return null;
|
|
32
|
-
const a = t.layerIndex,
|
|
33
|
-
if (!
|
|
32
|
+
const a = t.layerIndex, r = this.findRenderFunctionByLayer(a);
|
|
33
|
+
if (!r)
|
|
34
34
|
return null;
|
|
35
|
-
const l = () => /* @__PURE__ */ n.createElement("div", { className: "k-tooltip-content" },
|
|
36
|
-
return /* @__PURE__ */ n.createElement(
|
|
37
|
-
h,
|
|
38
|
-
{
|
|
39
|
-
...e,
|
|
40
|
-
popupContent: l,
|
|
41
|
-
className: c
|
|
42
|
-
}
|
|
43
|
-
);
|
|
35
|
+
const l = () => /* @__PURE__ */ n.createElement("div", { className: "k-tooltip-content" }, r(t)), c = `k-map-${t.type}-tooltip`;
|
|
36
|
+
return /* @__PURE__ */ n.createElement(h, { ...e, popupContent: l, className: c });
|
|
44
37
|
}
|
|
45
38
|
componentWillUnmount() {
|
|
46
39
|
this.context.observersStore.dispatch({
|
|
@@ -49,15 +42,14 @@ const p = class p extends n.Component {
|
|
|
49
42
|
});
|
|
50
43
|
}
|
|
51
44
|
onShowTooltip(t) {
|
|
52
|
-
const { anchor: o, className:
|
|
53
|
-
let e = this.createTooltipContext(t);
|
|
45
|
+
const { anchor: o, className: s } = t, e = this.createTooltipContext(t);
|
|
54
46
|
this.setState({
|
|
55
47
|
popupShown: !0,
|
|
56
48
|
popupAlign: { vertical: "bottom", horizontal: "center" },
|
|
57
49
|
popupOffset: o,
|
|
58
50
|
popupContext: e,
|
|
59
51
|
popupStyles: { position: "relative" },
|
|
60
|
-
className:
|
|
52
|
+
className: s
|
|
61
53
|
});
|
|
62
54
|
}
|
|
63
55
|
onHideTooltip() {
|
package/utils/index.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function l(r,t){let e=r;for(;e&&e!==t;)e=e.parentNode;return!!e}function o(r,t,e,a){const n=r[t];if(n&&Array.isArray(n)){for(const i of n)if(!i.type||i.type!==a)return new Error(`${e} children should be Array of type ${a.displayName}.`)}return null}exports.hasParent=l;exports.validateChildren=o;
|
package/utils/index.mjs
CHANGED
|
@@ -12,18 +12,16 @@ function i(e, t) {
|
|
|
12
12
|
r = r.parentNode;
|
|
13
13
|
return !!r;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function l(e, t, r, a) {
|
|
16
16
|
const n = e[t];
|
|
17
17
|
if (n && Array.isArray(n)) {
|
|
18
|
-
for (
|
|
19
|
-
if (!
|
|
20
|
-
return new Error(
|
|
21
|
-
`${r} children should be Array of type ${a.displayName}.`
|
|
22
|
-
);
|
|
18
|
+
for (const o of n)
|
|
19
|
+
if (!o.type || o.type !== a)
|
|
20
|
+
return new Error(`${r} children should be Array of type ${a.displayName}.`);
|
|
23
21
|
}
|
|
24
22
|
return null;
|
|
25
23
|
}
|
|
26
24
|
export {
|
|
27
25
|
i as hasParent,
|
|
28
|
-
|
|
26
|
+
l as validateChildren
|
|
29
27
|
};
|