@progress/kendo-react-map 7.0.3-develop.9 → 7.1.0-develop.2
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/dist/cdn/js/kendo-react-map.js +1 -1
- package/index.mjs +1 -1
- package/package.json +4 -4
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
(function(o,y){typeof exports=="object"&&typeof module<"u"?y(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")):typeof define=="function"&&define.amd?define(["exports","react","@progress/kendo-react-common","prop-types","@progress/kendo-charts","@progress/kendo-react-popup","@progress/kendo-svg-icons"],y):(o=typeof globalThis<"u"?globalThis:o||self,y(o.KendoReactMap={},o.React,o.KendoReactCommon,o.PropTypes,o.KendoCharts,o.KendoReactPopup,o.KendoSvgIcons))})(this,function(o,y,f,k,d,ne,m){"use strict";"use client";function re(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const p=re(y),v=p.createContext(null);v.displayName="MapContext";class g extends p.Component{constructor(e,t){super(e,t),this.optionsStore=t.optionsStore}renderChildren(e,t){const{children:r}=e.props,{_mapKey:s,_parentStore:i}=this.props,a={...e.props,_mapCollectionIdxKey:`${s}_${t}`,_parentStore:i};return p.cloneElement(e,a,r)}render(){const{_mapKey:e,_parentStore:t,children:r}=this.props;return(t||this.optionsStore).dispatch({mapKey:e,payload:[]}),p.Children.map(r,(i,a)=>p.isValidElement(i)?this.renderChildren(i,a):i)}}g.contextType=v;const E=n=>{let e,t=[];const r=()=>e,s=a=>{e=n(e,a),f.canUseDOM&&t.forEach(c=>c())},i=a=>(t.push(a),()=>t=t.filter(c=>c!==a));return s({}),{getState:r,dispatch:s,subscribe:i}},w=(n,e)=>e.mapCollectionIdxKey?P.collectionConfigurationItem(n,e):e.mapKey?P.configurationItem(n,e):{},se=(n,e)=>{if(e.type)switch(e.type){case"add":return[...n,e.payload];case"remove":return n.filter(t=>t!==e.payload);default:return n}else return[]},P={configurationItem(n,e){return Object.assign(n,{[e.mapKey]:e.payload})},collectionConfigurationItem(n,e){let t=!1;const[r,s]=e.mapCollectionIdxKey.split("_"),i=n[r].map((a,c)=>parseInt(s,10)===c?(t=!0,e.payload):a);return t===!1&&i.splice(parseInt(s,10),0,e.payload),Object.assign(n,{[r]:i})},themeItem(n,e){let t={},r=Object.assign(t,n);const{field:s,value:i}=e.payload,a=s.split(".");let c=a.shift();for(;a.length>0;)t=t[c]=t[c]||{},c=a.shift();return t[c]=i,r}};class h extends p.Component{constructor(e,t){super(e,t),this.optionsStore=t.optionsStore,this.childStore=E(w)}render(){const{children:e}=this.props;return e!==void 0?p.Children.map(e,t=>p.isValidElement(t)?this.renderChildren(t):t):null}componentDidMount(){this.dispatch()}componentDidUpdate(){this.dispatch()}dispatch(){const{_mapKey:e,_mapCollectionIdxKey:t,_parentStore:r,children:s,...i}=this.props;(r||this.optionsStore).dispatch({mapKey:e,mapCollectionIdxKey:t,payload:Object.assign({},i,this.childStore.getState())})}renderChildren(e){const{children:t}=e.props,r={...e.props,_parentStore:this.childStore};return p.cloneElement(e,r,t)}}h.contextType=v;class l{constructor(e){this.target=e}}class A extends l{constructor(e,t){super(t)}}class _ extends l{constructor(e,t){super(t),this.location=e.location,this.originalEvent=e.originalEvent}}class x extends l{constructor(e,t){super(t),this.marker=e.marker,this.layer=e.layer}}class D extends l{constructor(e,t){super(t),this.marker=e.marker,this.layer=e.layer}}class N extends l{constructor(){super(...arguments),this.prevented=!1}preventDefault(){this.prevented=!0}isDefaultPrevented(){return this.prevented}}class K extends N{constructor(e,t){super(t),this.marker=e.marker,this.layer=e.layer}}class R extends l{constructor(e,t){super(t),this.origin=e.origin,this.center=e.center,this.originalEvent=e.originalEvent}}class U extends l{constructor(e,t){super(t),this.origin=e.origin,this.center=e.center,this.originalEvent=e.originalEvent}}class j extends l{constructor(e,t){super(t)}}class z extends l{constructor(e,t){super(t),this.layer=e.layer,this.shape=e.shape,this.originalEvent=e.originalEvent}}class B extends l{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)}}class V extends l{constructor(e,t){super(t),this.dataItem=e.dataItem,this.layer=e.layer,this.group=e.group,this.properties=e.properties}}class q extends l{constructor(e,t){super(t),this.layer=e.layer,this.shape=e.shape,this.originalEvent=e.originalEvent}}class F extends l{constructor(e,t){super(t),this.layer=e.layer,this.shape=e.shape,this.originalEvent=e.originalEvent}}class Z extends l{constructor(e,t){super(t),this.originalEvent=e.originalEvent}}class $ extends N{constructor(e,t){super(t),this.originalEvent=e.originalEvent}}const W={beforeReset:A,mapClick:_,markerActivate:x,markerClick:D,markerCreated:K,panEnd:R,pan:U,reset:j,shapeClick:z,shapeCreated:B,shapeFeatureCreated:V,shapeMouseEnter:q,shapeMouseLeave:F,zoomEnd:Z,zoomStart:$};function oe(n,e,t){if(W[n])return new W[n](e,t)}function ae(n,e){let t=n;for(;t&&t!==e;)t=t.parentNode;return!!t}function I(n,e,t,r){const s=n[e];if(s&&Array.isArray(s)){for(let i of s)if(!i.type||i.type!==r)return new Error(`${t} children should be Array of type ${r.displayName}.`)}return null}const ie={horizontal:"fit",vertical:"fit"},pe=["k-tooltip","k-map-tooltip"],ce="k-tooltip-wrapper";class H extends p.Component{constructor(e,t){super(e,t),this.context=null,this.element=null,this.onMapMouseLeave=r=>{const{syntheticEvent:s}=r;return!!ae(s.relatedTarget,this.element)},this.mapObserver=new d.InstanceObserver(this,{onMouseLeave:"onMapMouseLeave"}),t.observersStore.dispatch({type:"add",payload:this.mapObserver})}render(){const{popupShown:e,popupAlign:t,popupOffset:r,popupStyles:s,popupContent:i,className:a}=this.props,c=[...pe,a].join(" ").trim();return p.createElement(ne.Popup,{animate:!0,popupAlign:t,offset:r,show:e,collision:ie,className:ce},p.createElement("div",{className:c,style:s,ref:L=>this.element=L},i()))}componentWillUnmount(){this.context.observersStore.dispatch({type:"remove",payload:this.mapObserver})}}H.contextType=v;class M extends p.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:e,shared:t,className:r,...s}=this.state;if(!e||!this.state.popupShown)return null;const i=e.layerIndex,a=this.findRenderFunctionByLayer(i);if(!a)return null;const c=()=>p.createElement("div",{className:"k-tooltip-content"},a(e)),u=`k-map-${e.type}-tooltip`;return p.createElement(H,{...s,popupContent:c,className:u})}componentWillUnmount(){this.context.observersStore.dispatch({type:"remove",payload:this.mapObserver})}onShowTooltip(e){const{anchor:t,className:r}=e;let s=this.createTooltipContext(e);this.setState({popupShown:!0,popupAlign:{vertical:"bottom",horizontal:"center"},popupOffset:t,popupContext:s,popupStyles:{position:"relative"},className:r})}onHideTooltip(){this.setState({popupShown:!1,popupStyles:{},className:void 0})}createTooltipContext(e){return e}findRenderFunctionByLayer(e){const t=this.context.optionsStore.getState().layers;return t!==void 0&&Array.isArray(t)&&t[e]!==void 0&&t[e].hasOwnProperty("tooltip")&&t[e].tooltip.hasOwnProperty("render")?t[e].tooltip.render:null}}M.contextType=v;const le={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 ue{constructor(e,t){this.sender=e,this.syntheticEvent=t}}function he(n,e){return new ue(n,e)}const G={mapMarkerTargetIcon:m.mapMarkerTargetIcon,mapMarkerIcon:m.mapMarkerIcon,plusIcon:m.plusIcon,minusIcon:m.minusIcon,caretAltUpIcon:m.caretAltUpIcon,caretAltDownIcon:m.caretAltDownIcon,caretAltLeftIcon:m.caretAltLeftIcon,caretAltRightIcon:m.caretAltRightIcon},J="svg";class b extends p.Component{constructor(e){super(e),this.mapInstance=null,this._element=null,this.optionsStore={},this.optionsUnsubscriber=Function.prototype,this.observersStore={},this.iconsType=J,this.svgIcons=G,this.onInit=t=>{this.mapInstance=t.sender},this.onRender=t=>{this.mapInstance!==null&&this.trigger("render",t)},this.onMapMouseLeave=t=>{const r=he(this,t);this.triggerDomEvent("onMouseLeave",r)?t.preventDefault():this.mapInstance!==null&&this.mapInstance.hideTooltip()},f.validatePackage(le),this.optionsStore=E(w),this.observersStore=E(se),this.childrenObserver=new d.InstanceObserver(this,{onMouseLeave:"onChildMouseLeave"}),this.contextValue={optionsStore:this.optionsStore,observersStore:this.observersStore,childrenObserver:this.childrenObserver},this.mapObserver=new d.InstanceObserver(this,{init:"onInit"})}get element(){return this._element}componentDidMount(){this.instantiateCoreMap(),this.optionsUnsubscriber=this.optionsStore.subscribe(this.refresh.bind(this))}componentWillUnmount(){this.optionsUnsubscriber(),this.mapInstance!==null&&(this.mapInstance.destroy(),this.mapInstance=null)}componentDidUpdate(e){const{dir:t,children:r,...s}=this.props;this.mapInstance!==null&&(Object.entries(e).filter(a=>a[0]!=="dir"&&a[0]!=="children").some(a=>{const[c,u]=a;return!(s.hasOwnProperty(c)&&s[c]===u)})&&this.refresh(),e.dir)}render(){const{style:e={},className:t,children:r}=this.props,s=Object.assign({},e,{position:"relative"}),i=p.createElement("div",{className:t,style:s,key:"mapElement"},p.createElement("div",{ref:a=>this._element=a,className:"k-map",onMouseLeave:this.onMapMouseLeave},r));return p.createElement(f.IconsContext.Consumer,null,a=>p.createElement(v.Provider,{value:this.contextValue},p.createElement(M,{key:"tooltip"}),i,this.setIcons(a)))}getMapOptions(){const{center:e,controls:t,minZoom:r,maxZoom:s,minSize:i,pannable:a,wraparound:c,zoom:u,zoomable:L}=this.props;let O={center:e,controls:t,minZoom:r,maxZoom:s,minSize:i,pannable:a,wraparound:c,zoom:u,zoomable:L,icons:{type:this.iconsType,svgIcons:this.svgIcons}};return O=Object.assign(O,this.optionsStore.getState()),O}get layers(){var e;return(e=this.mapInstance)==null?void 0:e.layers}get extent(){var e;return(e=this.mapInstance)==null?void 0:e.extent()}set extent(e){var t;(t=this.mapInstance)==null||t.extent(e)}resize(){}viewSize(){var e;return(e=this.mapInstance)==null?void 0:e.viewSize()}eventOffset(e){var t;return(t=this.mapInstance)==null?void 0:t.eventOffset(e)}eventToLayer(e){var t;return(t=this.mapInstance)==null?void 0:t.eventToLayer(e)}eventToLocation(e){var t;return(t=this.mapInstance)==null?void 0:t.eventToLocation(e)}eventToView(e){var t;return(t=this.mapInstance)==null?void 0:t.eventToView(e)}layerToLocation(e,t){var r;return(r=this.mapInstance)==null?void 0:r.layerToLocation(e,t)}locationToLayer(e,t){var r;return(r=this.mapInstance)==null?void 0:r.locationToLayer(e,t)}locationToView(e){var t;return(t=this.mapInstance)==null?void 0:t.locationToView(e)}viewToLocation(e,t){var r;return(r=this.mapInstance)==null?void 0:r.viewToLocation(e,t)}loadMarkers(e){const t=this.mapInstance.markers;t&&t._load(e)}refresh(){if(this.mapInstance!==null){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 d.Map(this.element,e,{},{observer:this.mapObserver,sender:this})}trigger(e,t){const r=e==="click"?"mapClick":e,s=oe(r,t,this),i="on"+r.charAt(0).toUpperCase()+r.slice(1),a=this.observersStore.getState();let c=!1;for(let u=0;u<a.length;u++)a[u].trigger(r,t)&&(c=!0);return c===!1&&s&&this.props.hasOwnProperty(i)?(this.props[i].call(void 0,s),s.isDefaultPrevented&&s.isDefaultPrevented()):c}requiresHandlers(e){for(let t=0;t<e.length;t++){const r=e[t],s="on"+r.charAt(0).toUpperCase()+r.slice(1);if(this.props.hasOwnProperty(s))return!0}return!1}triggerDomEvent(e,t){const r=this.observersStore.getState();let s=!1;for(let i=0;i<r.length;i++)r[i].trigger(e,t)&&(s=!0);return s}setIcons(e){const{type:t,icons:r={}}=e,s={...G},i={mapMarkerTargetIcon:r.mapMarkerTargetIcon,mapMarkerIcon:r.mapMarkerIcon,plusIcon:r.plusIcon,minusIcon:r.minusIcon,caretAltUpIcon:r.caretAltUpIcon,caretAltDownIcon:r.caretAltDownIcon,caretAltLeftIcon:r.caretAltLeftIcon,caretAltRightIcon:r.caretAltRightIcon};let a;for(a in i)if(i[a]){const c=i[a];c&&typeof c!="string"&&(s[a]=c)}return this.svgIcons=s,this.iconsType=t||J,null}}b.propTypes={dir:k.string},b.defaultProps={};const Q=n=>p.createElement(g,{...n,_mapKey:"layers"});Q.propTypes={children:k.node};const X=n=>p.createElement(h,{...n,_mapKey:"tooltip"}),S=n=>p.createElement(h,{type:"shape",...n});S.displayName="MapShapeLayer",S.propTypes={children:function(n,e,t){return I(n,e,t,X)}};const Y=n=>p.createElement(h,{type:"tile",...n});Y.displayName="MapTileLayer";const ee=n=>p.createElement(h,{...n,_mapKey:"tooltip"}),C=n=>p.createElement(h,{type:"bubble",...n});C.displayName="MapBubbleLayer",C.propTypes={children:function(n,e,t){return I(n,e,t,ee)}};const te=n=>p.createElement(h,{...n,_mapKey:"tooltip"}),T=n=>p.createElement(h,{type:"marker",...n});T.displayName="MapMarkerLayer",T.propTypes={children:function(n,e,t){return I(n,e,t,te)}},Object.defineProperty(o,"Extent",{enumerable:!0,get:()=>d.Extent}),Object.defineProperty(o,"Location",{enumerable:!0,get:()=>d.Location}),o.BeforeResetEvent=A,o.CollectionConfigurationComponent=g,o.ConfigurationComponent=h,o.Map=b,o.MapBubbleLayer=C,o.MapBubbleLayerTooltip=ee,o.MapClickEvent=_,o.MapLayers=Q,o.MapMarkerLayer=T,o.MapMarkerLayerTooltip=te,o.MapShapeLayer=S,o.MapShapeLayerTooltip=X,o.MapTileLayer=Y,o.MapTooltip=M,o.MarkerActivateEvent=x,o.MarkerClickEvent=D,o.MarkerCreatedEvent=K,o.PanEndEvent=R,o.PanEvent=U,o.ResetEvent=j,o.ShapeClickEvent=z,o.ShapeCreatedEvent=B,o.ShapeFeatureCreatedEvent=V,o.ShapeMouseEnterEvent=q,o.ShapeMouseLeaveEvent=F,o.ZoomEndEvent=Z,o.ZoomStartEvent=$,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
5
|
+
(function(o,y){typeof exports=="object"&&typeof module!="undefined"?y(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")):typeof define=="function"&&define.amd?define(["exports","react","@progress/kendo-react-common","prop-types","@progress/kendo-charts","@progress/kendo-react-popup","@progress/kendo-svg-icons"],y):(o=typeof globalThis!="undefined"?globalThis:o||self,y(o.KendoReactMap={},o.React,o.KendoReactCommon,o.PropTypes,o.KendoCharts,o.KendoReactPopup,o.KendoSvgIcons))})(this,function(o,y,f,k,d,ne,m){"use strict";"use client";function re(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const p=re(y),v=p.createContext(null);v.displayName="MapContext";class g extends p.Component{constructor(e,t){super(e,t),this.optionsStore=t.optionsStore}renderChildren(e,t){const{children:r}=e.props,{_mapKey:s,_parentStore:i}=this.props,a={...e.props,_mapCollectionIdxKey:`${s}_${t}`,_parentStore:i};return p.cloneElement(e,a,r)}render(){const{_mapKey:e,_parentStore:t,children:r}=this.props;return(t||this.optionsStore).dispatch({mapKey:e,payload:[]}),p.Children.map(r,(i,a)=>p.isValidElement(i)?this.renderChildren(i,a):i)}}g.contextType=v;const E=n=>{let e,t=[];const r=()=>e,s=a=>{e=n(e,a),f.canUseDOM&&t.forEach(c=>c())},i=a=>(t.push(a),()=>t=t.filter(c=>c!==a));return s({}),{getState:r,dispatch:s,subscribe:i}},w=(n,e)=>e.mapCollectionIdxKey?P.collectionConfigurationItem(n,e):e.mapKey?P.configurationItem(n,e):{},se=(n,e)=>{if(e.type)switch(e.type){case"add":return[...n,e.payload];case"remove":return n.filter(t=>t!==e.payload);default:return n}else return[]},P={configurationItem(n,e){return Object.assign(n,{[e.mapKey]:e.payload})},collectionConfigurationItem(n,e){let t=!1;const[r,s]=e.mapCollectionIdxKey.split("_"),i=n[r].map((a,c)=>parseInt(s,10)===c?(t=!0,e.payload):a);return t===!1&&i.splice(parseInt(s,10),0,e.payload),Object.assign(n,{[r]:i})},themeItem(n,e){let t={},r=Object.assign(t,n);const{field:s,value:i}=e.payload,a=s.split(".");let c=a.shift();for(;a.length>0;)t=t[c]=t[c]||{},c=a.shift();return t[c]=i,r}};class h extends p.Component{constructor(e,t){super(e,t),this.optionsStore=t.optionsStore,this.childStore=E(w)}render(){const{children:e}=this.props;return e!==void 0?p.Children.map(e,t=>p.isValidElement(t)?this.renderChildren(t):t):null}componentDidMount(){this.dispatch()}componentDidUpdate(){this.dispatch()}dispatch(){const{_mapKey:e,_mapCollectionIdxKey:t,_parentStore:r,children:s,...i}=this.props;(r||this.optionsStore).dispatch({mapKey:e,mapCollectionIdxKey:t,payload:Object.assign({},i,this.childStore.getState())})}renderChildren(e){const{children:t}=e.props,r={...e.props,_parentStore:this.childStore};return p.cloneElement(e,r,t)}}h.contextType=v;class l{constructor(e){this.target=e}}class A extends l{constructor(e,t){super(t)}}class _ extends l{constructor(e,t){super(t),this.location=e.location,this.originalEvent=e.originalEvent}}class x extends l{constructor(e,t){super(t),this.marker=e.marker,this.layer=e.layer}}class D extends l{constructor(e,t){super(t),this.marker=e.marker,this.layer=e.layer}}class N extends l{constructor(){super(...arguments),this.prevented=!1}preventDefault(){this.prevented=!0}isDefaultPrevented(){return this.prevented}}class K extends N{constructor(e,t){super(t),this.marker=e.marker,this.layer=e.layer}}class R extends l{constructor(e,t){super(t),this.origin=e.origin,this.center=e.center,this.originalEvent=e.originalEvent}}class U extends l{constructor(e,t){super(t),this.origin=e.origin,this.center=e.center,this.originalEvent=e.originalEvent}}class j extends l{constructor(e,t){super(t)}}class z extends l{constructor(e,t){super(t),this.layer=e.layer,this.shape=e.shape,this.originalEvent=e.originalEvent}}class B extends l{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)}}class V extends l{constructor(e,t){super(t),this.dataItem=e.dataItem,this.layer=e.layer,this.group=e.group,this.properties=e.properties}}class q extends l{constructor(e,t){super(t),this.layer=e.layer,this.shape=e.shape,this.originalEvent=e.originalEvent}}class F extends l{constructor(e,t){super(t),this.layer=e.layer,this.shape=e.shape,this.originalEvent=e.originalEvent}}class Z extends l{constructor(e,t){super(t),this.originalEvent=e.originalEvent}}class $ extends N{constructor(e,t){super(t),this.originalEvent=e.originalEvent}}const W={beforeReset:A,mapClick:_,markerActivate:x,markerClick:D,markerCreated:K,panEnd:R,pan:U,reset:j,shapeClick:z,shapeCreated:B,shapeFeatureCreated:V,shapeMouseEnter:q,shapeMouseLeave:F,zoomEnd:Z,zoomStart:$};function oe(n,e,t){if(W[n])return new W[n](e,t)}function ae(n,e){let t=n;for(;t&&t!==e;)t=t.parentNode;return!!t}function I(n,e,t,r){const s=n[e];if(s&&Array.isArray(s)){for(let i of s)if(!i.type||i.type!==r)return new Error(`${t} children should be Array of type ${r.displayName}.`)}return null}const ie={horizontal:"fit",vertical:"fit"},pe=["k-tooltip","k-map-tooltip"],ce="k-tooltip-wrapper";class H extends p.Component{constructor(e,t){super(e,t),this.context=null,this.element=null,this.onMapMouseLeave=r=>{const{syntheticEvent:s}=r;return!!ae(s.relatedTarget,this.element)},this.mapObserver=new d.InstanceObserver(this,{onMouseLeave:"onMapMouseLeave"}),t.observersStore.dispatch({type:"add",payload:this.mapObserver})}render(){const{popupShown:e,popupAlign:t,popupOffset:r,popupStyles:s,popupContent:i,className:a}=this.props,c=[...pe,a].join(" ").trim();return p.createElement(ne.Popup,{animate:!0,popupAlign:t,offset:r,show:e,collision:ie,className:ce},p.createElement("div",{className:c,style:s,ref:L=>this.element=L},i()))}componentWillUnmount(){this.context.observersStore.dispatch({type:"remove",payload:this.mapObserver})}}H.contextType=v;class M extends p.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:e,shared:t,className:r,...s}=this.state;if(!e||!this.state.popupShown)return null;const i=e.layerIndex,a=this.findRenderFunctionByLayer(i);if(!a)return null;const c=()=>p.createElement("div",{className:"k-tooltip-content"},a(e)),u=`k-map-${e.type}-tooltip`;return p.createElement(H,{...s,popupContent:c,className:u})}componentWillUnmount(){this.context.observersStore.dispatch({type:"remove",payload:this.mapObserver})}onShowTooltip(e){const{anchor:t,className:r}=e;let s=this.createTooltipContext(e);this.setState({popupShown:!0,popupAlign:{vertical:"bottom",horizontal:"center"},popupOffset:t,popupContext:s,popupStyles:{position:"relative"},className:r})}onHideTooltip(){this.setState({popupShown:!1,popupStyles:{},className:void 0})}createTooltipContext(e){return e}findRenderFunctionByLayer(e){const t=this.context.optionsStore.getState().layers;return t!==void 0&&Array.isArray(t)&&t[e]!==void 0&&t[e].hasOwnProperty("tooltip")&&t[e].tooltip.hasOwnProperty("render")?t[e].tooltip.render:null}}M.contextType=v;const le={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 ue{constructor(e,t){this.sender=e,this.syntheticEvent=t}}function he(n,e){return new ue(n,e)}const G={mapMarkerTargetIcon:m.mapMarkerTargetIcon,mapMarkerIcon:m.mapMarkerIcon,plusIcon:m.plusIcon,minusIcon:m.minusIcon,caretAltUpIcon:m.caretAltUpIcon,caretAltDownIcon:m.caretAltDownIcon,caretAltLeftIcon:m.caretAltLeftIcon,caretAltRightIcon:m.caretAltRightIcon},J="svg";class b extends p.Component{constructor(e){super(e),this.mapInstance=null,this._element=null,this.optionsStore={},this.optionsUnsubscriber=Function.prototype,this.observersStore={},this.iconsType=J,this.svgIcons=G,this.onInit=t=>{this.mapInstance=t.sender},this.onRender=t=>{this.mapInstance!==null&&this.trigger("render",t)},this.onMapMouseLeave=t=>{const r=he(this,t);this.triggerDomEvent("onMouseLeave",r)?t.preventDefault():this.mapInstance!==null&&this.mapInstance.hideTooltip()},f.validatePackage(le),this.optionsStore=E(w),this.observersStore=E(se),this.childrenObserver=new d.InstanceObserver(this,{onMouseLeave:"onChildMouseLeave"}),this.contextValue={optionsStore:this.optionsStore,observersStore:this.observersStore,childrenObserver:this.childrenObserver},this.mapObserver=new d.InstanceObserver(this,{init:"onInit"})}get element(){return this._element}componentDidMount(){this.instantiateCoreMap(),this.optionsUnsubscriber=this.optionsStore.subscribe(this.refresh.bind(this))}componentWillUnmount(){this.optionsUnsubscriber(),this.mapInstance!==null&&(this.mapInstance.destroy(),this.mapInstance=null)}componentDidUpdate(e){const{dir:t,children:r,...s}=this.props;this.mapInstance!==null&&(Object.entries(e).filter(a=>a[0]!=="dir"&&a[0]!=="children").some(a=>{const[c,u]=a;return!(s.hasOwnProperty(c)&&s[c]===u)})&&this.refresh(),e.dir)}render(){const{style:e={},className:t,children:r}=this.props,s=Object.assign({},e,{position:"relative"}),i=p.createElement("div",{className:t,style:s,key:"mapElement"},p.createElement("div",{ref:a=>this._element=a,className:"k-map",onMouseLeave:this.onMapMouseLeave},r));return p.createElement(f.IconsContext.Consumer,null,a=>p.createElement(v.Provider,{value:this.contextValue},p.createElement(M,{key:"tooltip"}),i,this.setIcons(a)))}getMapOptions(){const{center:e,controls:t,minZoom:r,maxZoom:s,minSize:i,pannable:a,wraparound:c,zoom:u,zoomable:L}=this.props;let O={center:e,controls:t,minZoom:r,maxZoom:s,minSize:i,pannable:a,wraparound:c,zoom:u,zoomable:L,icons:{type:this.iconsType,svgIcons:this.svgIcons}};return O=Object.assign(O,this.optionsStore.getState()),O}get layers(){var e;return(e=this.mapInstance)==null?void 0:e.layers}get extent(){var e;return(e=this.mapInstance)==null?void 0:e.extent()}set extent(e){var t;(t=this.mapInstance)==null||t.extent(e)}resize(){}viewSize(){var e;return(e=this.mapInstance)==null?void 0:e.viewSize()}eventOffset(e){var t;return(t=this.mapInstance)==null?void 0:t.eventOffset(e)}eventToLayer(e){var t;return(t=this.mapInstance)==null?void 0:t.eventToLayer(e)}eventToLocation(e){var t;return(t=this.mapInstance)==null?void 0:t.eventToLocation(e)}eventToView(e){var t;return(t=this.mapInstance)==null?void 0:t.eventToView(e)}layerToLocation(e,t){var r;return(r=this.mapInstance)==null?void 0:r.layerToLocation(e,t)}locationToLayer(e,t){var r;return(r=this.mapInstance)==null?void 0:r.locationToLayer(e,t)}locationToView(e){var t;return(t=this.mapInstance)==null?void 0:t.locationToView(e)}viewToLocation(e,t){var r;return(r=this.mapInstance)==null?void 0:r.viewToLocation(e,t)}loadMarkers(e){const t=this.mapInstance.markers;t&&t._load(e)}refresh(){if(this.mapInstance!==null){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 d.Map(this.element,e,{},{observer:this.mapObserver,sender:this})}trigger(e,t){const r=e==="click"?"mapClick":e,s=oe(r,t,this),i="on"+r.charAt(0).toUpperCase()+r.slice(1),a=this.observersStore.getState();let c=!1;for(let u=0;u<a.length;u++)a[u].trigger(r,t)&&(c=!0);return c===!1&&s&&this.props.hasOwnProperty(i)?(this.props[i].call(void 0,s),s.isDefaultPrevented&&s.isDefaultPrevented()):c}requiresHandlers(e){for(let t=0;t<e.length;t++){const r=e[t],s="on"+r.charAt(0).toUpperCase()+r.slice(1);if(this.props.hasOwnProperty(s))return!0}return!1}triggerDomEvent(e,t){const r=this.observersStore.getState();let s=!1;for(let i=0;i<r.length;i++)r[i].trigger(e,t)&&(s=!0);return s}setIcons(e){const{type:t,icons:r={}}=e,s={...G},i={mapMarkerTargetIcon:r.mapMarkerTargetIcon,mapMarkerIcon:r.mapMarkerIcon,plusIcon:r.plusIcon,minusIcon:r.minusIcon,caretAltUpIcon:r.caretAltUpIcon,caretAltDownIcon:r.caretAltDownIcon,caretAltLeftIcon:r.caretAltLeftIcon,caretAltRightIcon:r.caretAltRightIcon};let a;for(a in i)if(i[a]){const c=i[a];c&&typeof c!="string"&&(s[a]=c)}return this.svgIcons=s,this.iconsType=t||J,null}}b.propTypes={dir:k.string},b.defaultProps={};const Q=n=>p.createElement(g,{...n,_mapKey:"layers"});Q.propTypes={children:k.node};const X=n=>p.createElement(h,{...n,_mapKey:"tooltip"}),S=n=>p.createElement(h,{type:"shape",...n});S.displayName="MapShapeLayer",S.propTypes={children:function(n,e,t){return I(n,e,t,X)}};const Y=n=>p.createElement(h,{type:"tile",...n});Y.displayName="MapTileLayer";const ee=n=>p.createElement(h,{...n,_mapKey:"tooltip"}),C=n=>p.createElement(h,{type:"bubble",...n});C.displayName="MapBubbleLayer",C.propTypes={children:function(n,e,t){return I(n,e,t,ee)}};const te=n=>p.createElement(h,{...n,_mapKey:"tooltip"}),T=n=>p.createElement(h,{type:"marker",...n});T.displayName="MapMarkerLayer",T.propTypes={children:function(n,e,t){return I(n,e,t,te)}},Object.defineProperty(o,"Extent",{enumerable:!0,get:()=>d.Extent}),Object.defineProperty(o,"Location",{enumerable:!0,get:()=>d.Location}),o.BeforeResetEvent=A,o.CollectionConfigurationComponent=g,o.ConfigurationComponent=h,o.Map=b,o.MapBubbleLayer=C,o.MapBubbleLayerTooltip=ee,o.MapClickEvent=_,o.MapLayers=Q,o.MapMarkerLayer=T,o.MapMarkerLayerTooltip=te,o.MapShapeLayer=S,o.MapShapeLayerTooltip=X,o.MapTileLayer=Y,o.MapTooltip=M,o.MarkerActivateEvent=x,o.MarkerClickEvent=D,o.MarkerCreatedEvent=K,o.PanEndEvent=R,o.PanEvent=U,o.ResetEvent=j,o.ShapeClickEvent=z,o.ShapeCreatedEvent=B,o.ShapeFeatureCreatedEvent=V,o.ShapeMouseEnterEvent=q,o.ShapeMouseLeaveEvent=F,o.ZoomEndEvent=Z,o.ZoomStartEvent=$,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
package/index.mjs
CHANGED
|
@@ -405,7 +405,7 @@ const me = {
|
|
|
405
405
|
name: "@progress/kendo-react-map",
|
|
406
406
|
productName: "KendoReact",
|
|
407
407
|
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
408
|
-
publishDate:
|
|
408
|
+
publishDate: 1705399048,
|
|
409
409
|
version: "",
|
|
410
410
|
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"
|
|
411
411
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-map",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.1.0-develop.2",
|
|
4
4
|
"description": "KendoReact Map package",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@progress/kendo-drawing": "^1.19.0",
|
|
26
26
|
"@progress/kendo-licensing": "^1.3.4",
|
|
27
|
-
"@progress/kendo-react-common": "7.0
|
|
28
|
-
"@progress/kendo-react-popup": "7.0
|
|
27
|
+
"@progress/kendo-react-common": "7.1.0-develop.2",
|
|
28
|
+
"@progress/kendo-react-popup": "7.1.0-develop.2",
|
|
29
29
|
"@progress/kendo-svg-icons": "^2.1.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": "
|
|
34
|
+
"@progress/kendo-charts": "2.0.0",
|
|
35
35
|
"prop-types": "^15.6.0"
|
|
36
36
|
},
|
|
37
37
|
"keywords": [
|