@progress/kendo-react-map 5.4.0-dev.202206200646 → 5.5.0-dev.202206231330

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.
Files changed (75) hide show
  1. package/dist/cdn/js/kendo-react-map.js +1 -1
  2. package/dist/es/Map.d.ts +9 -0
  3. package/dist/es/Map.js +32 -2
  4. package/dist/es/components/BubbleLayer.d.ts +2 -1
  5. package/dist/es/components/BubbleLayer.js +7 -0
  6. package/dist/es/components/BubbleLayerTooltip.d.ts +15 -0
  7. package/dist/es/components/BubbleLayerTooltip.js +18 -0
  8. package/dist/es/components/Layers.js +1 -1
  9. package/dist/es/components/MarkerLayer.d.ts +2 -1
  10. package/dist/es/components/MarkerLayer.js +7 -0
  11. package/dist/es/components/MarkerLayerTooltip.d.ts +15 -0
  12. package/dist/es/components/MarkerLayerTooltip.js +18 -0
  13. package/dist/es/components/ShapeLayer.d.ts +2 -1
  14. package/dist/es/components/ShapeLayer.js +7 -0
  15. package/dist/es/components/ShapeLayerTooltip.d.ts +15 -0
  16. package/dist/es/components/ShapeLayerTooltip.js +18 -0
  17. package/dist/es/components/main.d.ts +4 -1
  18. package/dist/es/components/main.js +4 -1
  19. package/dist/es/events/dom-event.d.ts +23 -0
  20. package/dist/es/events/dom-event.js +21 -0
  21. package/dist/es/main.d.ts +3 -3
  22. package/dist/es/main.js +2 -2
  23. package/dist/es/package-metadata.js +1 -1
  24. package/dist/es/tooltip/BubbleTooltipContext.d.ts +22 -0
  25. package/dist/es/tooltip/BubbleTooltipContext.js +1 -0
  26. package/dist/es/tooltip/MapTooltip.d.ts +37 -0
  27. package/dist/es/tooltip/MapTooltip.js +123 -0
  28. package/dist/es/tooltip/MarkerTooltipContext.d.ts +22 -0
  29. package/dist/es/tooltip/MarkerTooltipContext.js +1 -0
  30. package/dist/es/tooltip/Popup.d.ts +29 -0
  31. package/dist/es/tooltip/Popup.js +76 -0
  32. package/dist/es/tooltip/ShapeTooltipContext.d.ts +18 -0
  33. package/dist/es/tooltip/ShapeTooltipContext.js +1 -0
  34. package/dist/es/tooltip/main.d.ts +5 -0
  35. package/dist/es/tooltip/main.js +2 -0
  36. package/dist/es/utils/main.d.ts +10 -0
  37. package/dist/es/utils/main.js +28 -0
  38. package/dist/npm/Map.d.ts +9 -0
  39. package/dist/npm/Map.js +32 -2
  40. package/dist/npm/components/BubbleLayer.d.ts +2 -1
  41. package/dist/npm/components/BubbleLayer.js +7 -0
  42. package/dist/npm/components/BubbleLayerTooltip.d.ts +15 -0
  43. package/dist/npm/components/BubbleLayerTooltip.js +21 -0
  44. package/dist/npm/components/Layers.js +1 -1
  45. package/dist/npm/components/MarkerLayer.d.ts +2 -1
  46. package/dist/npm/components/MarkerLayer.js +7 -0
  47. package/dist/npm/components/MarkerLayerTooltip.d.ts +15 -0
  48. package/dist/npm/components/MarkerLayerTooltip.js +21 -0
  49. package/dist/npm/components/ShapeLayer.d.ts +2 -1
  50. package/dist/npm/components/ShapeLayer.js +7 -0
  51. package/dist/npm/components/ShapeLayerTooltip.d.ts +15 -0
  52. package/dist/npm/components/ShapeLayerTooltip.js +21 -0
  53. package/dist/npm/components/main.d.ts +4 -1
  54. package/dist/npm/components/main.js +7 -1
  55. package/dist/npm/events/dom-event.d.ts +23 -0
  56. package/dist/npm/events/dom-event.js +24 -0
  57. package/dist/npm/main.d.ts +3 -3
  58. package/dist/npm/main.js +1 -0
  59. package/dist/npm/package-metadata.js +1 -1
  60. package/dist/npm/tooltip/BubbleTooltipContext.d.ts +22 -0
  61. package/dist/npm/tooltip/BubbleTooltipContext.js +2 -0
  62. package/dist/npm/tooltip/MapTooltip.d.ts +37 -0
  63. package/dist/npm/tooltip/MapTooltip.js +126 -0
  64. package/dist/npm/tooltip/MarkerTooltipContext.d.ts +22 -0
  65. package/dist/npm/tooltip/MarkerTooltipContext.js +2 -0
  66. package/dist/npm/tooltip/Popup.d.ts +29 -0
  67. package/dist/npm/tooltip/Popup.js +79 -0
  68. package/dist/npm/tooltip/ShapeTooltipContext.d.ts +18 -0
  69. package/dist/npm/tooltip/ShapeTooltipContext.js +2 -0
  70. package/dist/npm/tooltip/main.d.ts +5 -0
  71. package/dist/npm/tooltip/main.js +5 -0
  72. package/dist/npm/utils/main.d.ts +10 -0
  73. package/dist/npm/utils/main.js +32 -0
  74. package/dist/systemjs/kendo-react-map.js +1 -1
  75. package/package.json +2 -2
package/dist/es/Map.d.ts CHANGED
@@ -4,6 +4,7 @@ import { InstanceObserver, Map as KendoMap } from '@progress/kendo-charts';
4
4
  import './defaults';
5
5
  import { MapProps } from './MapProps';
6
6
  import { MapContextType } from './MapContext';
7
+ import { DomEvent } from './events/dom-event';
7
8
  /**
8
9
  * Represents the [KendoReact Map component]({% slug overview_map %}).
9
10
  */
@@ -70,10 +71,18 @@ export declare class Map extends React.Component<MapProps, {}> {
70
71
  * @hidden
71
72
  */
72
73
  requiresHandlers(names: string[]): boolean;
74
+ /**
75
+ * @hidden
76
+ */
77
+ triggerDomEvent<T>(name: string, e: DomEvent<T>): boolean;
73
78
  /**
74
79
  * @hidden
75
80
  */
76
81
  onRender: (e: any) => void;
82
+ /**
83
+ * @hidden
84
+ */
85
+ onMapMouseLeave: (e: React.MouseEvent<HTMLDivElement>) => void;
77
86
  /**
78
87
  * @hidden
79
88
  */
package/dist/es/Map.js CHANGED
@@ -32,8 +32,10 @@ import createStore from './store/store';
32
32
  import { optionsReducer, observersReducer } from './store/reducer';
33
33
  import './defaults';
34
34
  import { MapContext } from './MapContext';
35
+ import { MapTooltip } from './tooltip/MapTooltip';
35
36
  import { validatePackage } from '@progress/kendo-react-common';
36
37
  import { packageMetadata } from './package-metadata';
38
+ import { toDomEvent } from './events/dom-event';
37
39
  /**
38
40
  * Represents the [KendoReact Map component]({% slug overview_map %}).
39
41
  */
@@ -59,6 +61,19 @@ var Map = /** @class */ (function (_super) {
59
61
  }
60
62
  };
61
63
  /* Dom event handlers */
64
+ /**
65
+ * @hidden
66
+ */
67
+ _this.onMapMouseLeave = function (e) {
68
+ var domEvent = toDomEvent(_this, e);
69
+ var isDefaultPrevented = _this.triggerDomEvent('onMouseLeave', domEvent);
70
+ if (isDefaultPrevented) {
71
+ e.preventDefault();
72
+ }
73
+ else if (_this.mapInstance !== null) {
74
+ _this.mapInstance.hideTooltip();
75
+ }
76
+ };
62
77
  /**
63
78
  * @hidden
64
79
  */
@@ -142,8 +157,10 @@ var Map = /** @class */ (function (_super) {
142
157
  className: className,
143
158
  style: mapStyles,
144
159
  key: 'mapElement'
145
- }, (React.createElement("div", { ref: function (el) { return _this._element = el; }, className: "k-map" }, children)));
146
- return (React.createElement(MapContext.Provider, { value: this.contextValue }, content));
160
+ }, (React.createElement("div", { ref: function (el) { return _this._element = el; }, className: "k-map", onMouseLeave: this.onMapMouseLeave }, children)));
161
+ return (React.createElement(MapContext.Provider, { value: this.contextValue },
162
+ React.createElement(MapTooltip, { key: "tooltip" }),
163
+ content));
147
164
  };
148
165
  /**
149
166
  * @hidden
@@ -224,6 +241,19 @@ var Map = /** @class */ (function (_super) {
224
241
  }
225
242
  return false;
226
243
  };
244
+ /**
245
+ * @hidden
246
+ */
247
+ Map.prototype.triggerDomEvent = function (name, e) {
248
+ var observers = this.observersStore.getState();
249
+ var isDefaultPrevented = false;
250
+ for (var idx = 0; idx < observers.length; idx++) {
251
+ if (observers[idx].trigger(name, e)) {
252
+ isDefaultPrevented = true;
253
+ }
254
+ }
255
+ return isDefaultPrevented;
256
+ };
227
257
  /**
228
258
  * @hidden
229
259
  */
@@ -1,9 +1,10 @@
1
- import * as React from 'react';
2
1
  import { BubbleLayerOptions } from '@progress/kendo-charts';
2
+ import * as React from 'react';
3
3
  /**
4
4
  * Represents the props of the KendoReact MapBubbleLayer component.
5
5
  */
6
6
  export interface MapBubbleLayerProps extends BubbleLayerOptions {
7
+ children?: React.ReactNode;
7
8
  }
8
9
  declare const MapBubbleLayer: React.FunctionComponent<MapBubbleLayerProps>;
9
10
  export { MapBubbleLayer };
@@ -10,9 +10,16 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import * as React from 'react';
13
+ import { validateChildren } from '../utils/main';
13
14
  import ConfigurationComponent from './base/ConfigurationComponent';
15
+ import { MapBubbleLayerTooltip } from './BubbleLayerTooltip';
14
16
  var MapBubbleLayer = function (props) {
15
17
  return (React.createElement(ConfigurationComponent, __assign({ type: "bubble" }, props)));
16
18
  };
17
19
  MapBubbleLayer.displayName = 'MapBubbleLayer';
20
+ MapBubbleLayer.propTypes = {
21
+ children: function (props, propName, componentName) {
22
+ return validateChildren(props, propName, componentName, MapBubbleLayerTooltip);
23
+ }
24
+ };
18
25
  export { MapBubbleLayer };
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ import { BubbleTooltipContext } from '../tooltip/BubbleTooltipContext';
3
+ /**
4
+ * Represents the props of the KendoReact BubbleTooltip component.
5
+ */
6
+ export interface MapBubbleLayerTooltipProps {
7
+ /**
8
+ * The renderer for the bubble layer tooltip.
9
+ *
10
+ * @return the content of the tooltip.
11
+ */
12
+ render?: (props: BubbleTooltipContext) => React.ReactNode;
13
+ }
14
+ declare const MapBubbleLayerTooltip: React.FunctionComponent<MapBubbleLayerTooltipProps>;
15
+ export { MapBubbleLayerTooltip };
@@ -0,0 +1,18 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import * as React from 'react';
13
+ import ConfigurationComponent from './base/ConfigurationComponent';
14
+ var MapBubbleLayerTooltip = function (props) {
15
+ return (React.createElement(ConfigurationComponent, __assign({}, props, { _mapKey: "tooltip" })));
16
+ };
17
+ MapBubbleLayerTooltip.defaultProps = {};
18
+ export { MapBubbleLayerTooltip };
@@ -16,6 +16,6 @@ var MapLayers = function (props) {
16
16
  return (React.createElement(CollectionConfigurationComponent, __assign({}, props, { _mapKey: "layers" })));
17
17
  };
18
18
  MapLayers.propTypes = {
19
- children: PropTypes.array
19
+ children: PropTypes.node
20
20
  };
21
21
  export { MapLayers };
@@ -1,9 +1,10 @@
1
- import * as React from 'react';
2
1
  import { MarkerLayerOptions } from '@progress/kendo-charts';
2
+ import * as React from 'react';
3
3
  /**
4
4
  * Represents the props of the KendoReact MapMarkerLayer component.
5
5
  */
6
6
  export interface MapMarkerLayerProps extends MarkerLayerOptions {
7
+ children?: React.ReactNode;
7
8
  }
8
9
  declare const MapMarkerLayer: React.FunctionComponent<MapMarkerLayerProps>;
9
10
  export { MapMarkerLayer };
@@ -10,9 +10,16 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import * as React from 'react';
13
+ import { validateChildren } from '../utils/main';
13
14
  import ConfigurationComponent from './base/ConfigurationComponent';
15
+ import { MapMarkerLayerTooltip } from './MarkerLayerTooltip';
14
16
  var MapMarkerLayer = function (props) {
15
17
  return (React.createElement(ConfigurationComponent, __assign({ type: "marker" }, props)));
16
18
  };
17
19
  MapMarkerLayer.displayName = 'MapMarkerLayer';
20
+ MapMarkerLayer.propTypes = {
21
+ children: function (props, propName, componentName) {
22
+ return validateChildren(props, propName, componentName, MapMarkerLayerTooltip);
23
+ }
24
+ };
18
25
  export { MapMarkerLayer };
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ import { MarkerTooltipContext } from '../tooltip/MarkerTooltipContext';
3
+ /**
4
+ * Represents the props of the KendoReact MapMarkerLayerTooltip component.
5
+ */
6
+ export interface MapMarkerLayerTooltipProps {
7
+ /**
8
+ * The renderer for the marker layer tooltip.
9
+ *
10
+ * @return the content of the tooltip.
11
+ */
12
+ render?: (props: MarkerTooltipContext) => React.ReactNode;
13
+ }
14
+ declare const MapMarkerLayerTooltip: React.FunctionComponent<MapMarkerLayerTooltipProps>;
15
+ export { MapMarkerLayerTooltip };
@@ -0,0 +1,18 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import * as React from 'react';
13
+ import ConfigurationComponent from './base/ConfigurationComponent';
14
+ var MapMarkerLayerTooltip = function (props) {
15
+ return (React.createElement(ConfigurationComponent, __assign({}, props, { _mapKey: "tooltip" })));
16
+ };
17
+ MapMarkerLayerTooltip.defaultProps = {};
18
+ export { MapMarkerLayerTooltip };
@@ -1,9 +1,10 @@
1
- import * as React from 'react';
2
1
  import { ShapeLayerOptions } from '@progress/kendo-charts';
2
+ import * as React from 'react';
3
3
  /**
4
4
  * Represents the props of the KendoReact MapShapeLayer component.
5
5
  */
6
6
  export interface MapShapeLayerProps extends ShapeLayerOptions {
7
+ children?: React.ReactNode;
7
8
  }
8
9
  declare const MapShapeLayer: React.FunctionComponent<MapShapeLayerProps>;
9
10
  export { MapShapeLayer };
@@ -10,9 +10,16 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import * as React from 'react';
13
+ import { validateChildren } from '../utils/main';
13
14
  import ConfigurationComponent from './base/ConfigurationComponent';
15
+ import { MapShapeLayerTooltip } from './ShapeLayerTooltip';
14
16
  var MapShapeLayer = function (props) {
15
17
  return (React.createElement(ConfigurationComponent, __assign({ type: "shape" }, props)));
16
18
  };
17
19
  MapShapeLayer.displayName = 'MapShapeLayer';
20
+ MapShapeLayer.propTypes = {
21
+ children: function (props, propName, componentName) {
22
+ return validateChildren(props, propName, componentName, MapShapeLayerTooltip);
23
+ }
24
+ };
18
25
  export { MapShapeLayer };
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ import { ShapeTooltipContext } from '../tooltip/ShapeTooltipContext';
3
+ /**
4
+ * Represents the props of the KendoReact ShapeTooltip component.
5
+ */
6
+ export interface MapShapeLayerTooltipProps {
7
+ /**
8
+ * The renderer for the shape layer tooltip.
9
+ *
10
+ * @return the content of the tooltip.
11
+ */
12
+ render?: (props: ShapeTooltipContext) => React.ReactNode;
13
+ }
14
+ declare const MapShapeLayerTooltip: React.FunctionComponent<MapShapeLayerTooltipProps>;
15
+ export { MapShapeLayerTooltip };
@@ -0,0 +1,18 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import * as React from 'react';
13
+ import ConfigurationComponent from './base/ConfigurationComponent';
14
+ var MapShapeLayerTooltip = function (props) {
15
+ return (React.createElement(ConfigurationComponent, __assign({}, props, { _mapKey: "tooltip" })));
16
+ };
17
+ MapShapeLayerTooltip.defaultProps = {};
18
+ export { MapShapeLayerTooltip };
@@ -1,6 +1,9 @@
1
1
  import { MapLayers, MapLayersProps } from './Layers';
2
2
  import { MapShapeLayer, MapShapeLayerProps } from './ShapeLayer';
3
+ import { MapShapeLayerTooltip, MapShapeLayerTooltipProps } from './ShapeLayerTooltip';
3
4
  import { MapTileLayer, MapTileLayerProps } from './TileLayer';
4
5
  import { MapBubbleLayer, MapBubbleLayerProps } from './BubbleLayer';
6
+ import { MapBubbleLayerTooltip, MapBubbleLayerTooltipProps } from './BubbleLayerTooltip';
5
7
  import { MapMarkerLayer, MapMarkerLayerProps } from './MarkerLayer';
6
- export { MapLayers, MapLayersProps, MapShapeLayer, MapShapeLayerProps, MapTileLayer, MapTileLayerProps, MapBubbleLayer, MapBubbleLayerProps, MapMarkerLayer, MapMarkerLayerProps };
8
+ import { MapMarkerLayerTooltip, MapMarkerLayerTooltipProps } from './MarkerLayerTooltip';
9
+ export { MapLayers, MapLayersProps, MapShapeLayer, MapShapeLayerProps, MapShapeLayerTooltip, MapShapeLayerTooltipProps, MapTileLayer, MapTileLayerProps, MapBubbleLayer, MapBubbleLayerProps, MapBubbleLayerTooltip, MapBubbleLayerTooltipProps, MapMarkerLayer, MapMarkerLayerProps, MapMarkerLayerTooltip, MapMarkerLayerTooltipProps };
@@ -1,6 +1,9 @@
1
1
  import { MapLayers } from './Layers';
2
2
  import { MapShapeLayer } from './ShapeLayer';
3
+ import { MapShapeLayerTooltip } from './ShapeLayerTooltip';
3
4
  import { MapTileLayer } from './TileLayer';
4
5
  import { MapBubbleLayer } from './BubbleLayer';
6
+ import { MapBubbleLayerTooltip } from './BubbleLayerTooltip';
5
7
  import { MapMarkerLayer } from './MarkerLayer';
6
- export { MapLayers, MapShapeLayer, MapTileLayer, MapBubbleLayer, MapMarkerLayer };
8
+ import { MapMarkerLayerTooltip } from './MarkerLayerTooltip';
9
+ export { MapLayers, MapShapeLayer, MapShapeLayerTooltip, MapTileLayer, MapBubbleLayer, MapBubbleLayerTooltip, MapMarkerLayer, MapMarkerLayerTooltip };
@@ -0,0 +1,23 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * @hidden
4
+ */
5
+ export declare class DomEvent<T> {
6
+ /**
7
+ * The `Map` component that triggered the event.
8
+ */
9
+ sender: React.Component;
10
+ /**
11
+ * The syntheticEvent
12
+ */
13
+ syntheticEvent: T;
14
+ /**
15
+ * @hidden
16
+ */
17
+ constructor(sender: React.Component, e: T);
18
+ }
19
+ /**
20
+ * @hidden
21
+ */
22
+ declare function toDomEvent<T>(sender: React.Component, e: T): DomEvent<T>;
23
+ export { toDomEvent };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @hidden
3
+ */
4
+ var DomEvent = /** @class */ (function () {
5
+ /**
6
+ * @hidden
7
+ */
8
+ function DomEvent(sender, e) {
9
+ this.sender = sender;
10
+ this.syntheticEvent = e;
11
+ }
12
+ return DomEvent;
13
+ }());
14
+ export { DomEvent };
15
+ /**
16
+ * @hidden
17
+ */
18
+ function toDomEvent(sender, e) {
19
+ return new DomEvent(sender, e);
20
+ }
21
+ export { toDomEvent };
package/dist/es/main.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Map } from './Map';
2
- import { MapProps } from './MapProps';
1
+ export { Map } from './Map';
2
+ export { MapProps } from './MapProps';
3
3
  export * from './components/main';
4
4
  export * from './common/map-types';
5
5
  export * from './common/events';
6
- export { Map, MapProps };
6
+ export * from './tooltip/main';
package/dist/es/main.js CHANGED
@@ -1,5 +1,5 @@
1
- import { Map } from './Map';
1
+ export { Map } from './Map';
2
2
  export * from './components/main';
3
3
  export * from './common/map-types';
4
4
  export * from './common/events';
5
- export { Map };
5
+ export * from './tooltip/main';
@@ -5,7 +5,7 @@ export var packageMetadata = {
5
5
  name: '@progress/kendo-react-map',
6
6
  productName: 'KendoReact',
7
7
  productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
8
- publishDate: 1655707095,
8
+ publishDate: 1655990476,
9
9
  version: '',
10
10
  licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
11
11
  };
@@ -0,0 +1,22 @@
1
+ import { Location } from '../main';
2
+ /**
3
+ * Context object for bubble layer tooltips.
4
+ */
5
+ export interface BubbleTooltipContext {
6
+ /**
7
+ * The original data item used to create the bubble.
8
+ */
9
+ dataItem: any;
10
+ /**
11
+ * The index of the bubble layer in the map.
12
+ */
13
+ layerIndex: number;
14
+ /**
15
+ * The location of the bubble.
16
+ */
17
+ location: Location;
18
+ /**
19
+ * The numerical value of the bubble
20
+ */
21
+ value: number;
22
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,37 @@
1
+ import * as React from 'react';
2
+ import { Align, Offset } from '@progress/kendo-react-popup';
3
+ import { InstanceObserver } from '@progress/kendo-charts';
4
+ import { MarkerTooltipContext } from './MarkerTooltipContext';
5
+ import { ShapeTooltipContext } from './ShapeTooltipContext';
6
+ import { BubbleTooltipContext } from './BubbleTooltipContext';
7
+ import { MapContext } from '../MapContext';
8
+ declare type TooltipContext = MarkerTooltipContext | ShapeTooltipContext | BubbleTooltipContext;
9
+ /**
10
+ * @hidden
11
+ */
12
+ export interface MapTooltipState {
13
+ className?: string | undefined;
14
+ popupShown: boolean;
15
+ popupAlign?: Align;
16
+ popupOffset?: Offset;
17
+ popupStyles?: any;
18
+ popupContext?: TooltipContext;
19
+ shared?: boolean;
20
+ }
21
+ /**
22
+ * @hidden
23
+ */
24
+ export declare class MapTooltip extends React.Component<{}, MapTooltipState> {
25
+ static contextType: React.Context<import("../MapContext").MapContextType | null>;
26
+ context: React.ContextType<typeof MapContext>;
27
+ readonly state: MapTooltipState;
28
+ mapObserver?: InstanceObserver;
29
+ componentDidMount(): void;
30
+ render(): JSX.Element | null;
31
+ componentWillUnmount(): void;
32
+ onShowTooltip(e: any): void;
33
+ onHideTooltip(): void;
34
+ createTooltipContext(e: any): TooltipContext;
35
+ findRenderFunctionByLayer(layerIndex: number): any;
36
+ }
37
+ export {};
@@ -0,0 +1,123 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ var __assign = (this && this.__assign) || function () {
17
+ __assign = Object.assign || function(t) {
18
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
19
+ s = arguments[i];
20
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
+ t[p] = s[p];
22
+ }
23
+ return t;
24
+ };
25
+ return __assign.apply(this, arguments);
26
+ };
27
+ var __rest = (this && this.__rest) || function (s, e) {
28
+ var t = {};
29
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
30
+ t[p] = s[p];
31
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
32
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
33
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
34
+ t[p[i]] = s[p[i]];
35
+ }
36
+ return t;
37
+ };
38
+ import * as React from 'react';
39
+ import { InstanceObserver } from '@progress/kendo-charts';
40
+ import { TooltipPopup } from './Popup';
41
+ import { MapContext } from '../MapContext';
42
+ /**
43
+ * @hidden
44
+ */
45
+ var MapTooltip = /** @class */ (function (_super) {
46
+ __extends(MapTooltip, _super);
47
+ function MapTooltip() {
48
+ var _this = _super !== null && _super.apply(this, arguments) || this;
49
+ _this.context = null;
50
+ _this.state = {
51
+ popupShown: false
52
+ };
53
+ return _this;
54
+ }
55
+ MapTooltip.prototype.componentDidMount = function () {
56
+ this.mapObserver = new InstanceObserver(this, {
57
+ showTooltip: 'onShowTooltip',
58
+ hideTooltip: 'onHideTooltip'
59
+ });
60
+ this.context.observersStore.dispatch({
61
+ type: 'add',
62
+ payload: this.mapObserver
63
+ });
64
+ };
65
+ MapTooltip.prototype.render = function () {
66
+ var _a = this.state, popupContext = _a.popupContext, shared = _a.shared, className = _a.className, tooltipProps = __rest(_a, ["popupContext", "shared", "className"]);
67
+ if (!popupContext || !this.state.popupShown) {
68
+ // Popup closed.
69
+ return null;
70
+ }
71
+ var layerIndex = popupContext.layerIndex;
72
+ var render = this.findRenderFunctionByLayer(layerIndex);
73
+ if (!render) {
74
+ // No renderer set for layer tooltip.
75
+ return null;
76
+ }
77
+ var tooltipContent = function () { return (React.createElement("div", { className: "k-tooltip-content" }, render(popupContext))); };
78
+ var popupContainerClassName = "k-map-".concat(popupContext.type, "-tooltip");
79
+ return (React.createElement(TooltipPopup, __assign({}, tooltipProps, { popupContent: tooltipContent, className: popupContainerClassName })));
80
+ };
81
+ MapTooltip.prototype.componentWillUnmount = function () {
82
+ this.context.observersStore.dispatch({
83
+ type: 'remove',
84
+ payload: this.mapObserver
85
+ });
86
+ };
87
+ MapTooltip.prototype.onShowTooltip = function (e) {
88
+ var anchor = e.anchor, className = e.className;
89
+ var context = this.createTooltipContext(e);
90
+ this.setState({
91
+ popupShown: true,
92
+ popupAlign: { vertical: 'bottom', horizontal: 'center' },
93
+ popupOffset: anchor,
94
+ popupContext: context,
95
+ popupStyles: { position: 'relative' },
96
+ className: className
97
+ });
98
+ };
99
+ MapTooltip.prototype.onHideTooltip = function () {
100
+ this.setState({
101
+ popupShown: false,
102
+ popupStyles: {},
103
+ className: undefined
104
+ });
105
+ };
106
+ MapTooltip.prototype.createTooltipContext = function (e) {
107
+ return e;
108
+ };
109
+ MapTooltip.prototype.findRenderFunctionByLayer = function (layerIndex) {
110
+ var layers = this.context.optionsStore.getState().layers;
111
+ if (layers !== undefined
112
+ && Array.isArray(layers)
113
+ && layers[layerIndex] !== undefined
114
+ && layers[layerIndex].hasOwnProperty('tooltip')
115
+ && layers[layerIndex].tooltip.hasOwnProperty('render')) {
116
+ return layers[layerIndex].tooltip.render;
117
+ }
118
+ return null;
119
+ };
120
+ MapTooltip.contextType = MapContext;
121
+ return MapTooltip;
122
+ }(React.Component));
123
+ export { MapTooltip };
@@ -0,0 +1,22 @@
1
+ import { Location } from '../main';
2
+ /**
3
+ * Context object for marker tooltips.
4
+ */
5
+ export interface MarkerTooltipContext {
6
+ /**
7
+ * The original data item used to create the marker.
8
+ */
9
+ dataItem: any;
10
+ /**
11
+ * The index of the marker layer in the map.
12
+ */
13
+ layerIndex: number;
14
+ /**
15
+ * The location of the marker.
16
+ */
17
+ location: Location;
18
+ /**
19
+ * The title of the marker.
20
+ */
21
+ title: string;
22
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+ import { InstanceObserver } from '@progress/kendo-charts';
3
+ import { DomEvent } from './../events/dom-event';
4
+ import { Align, Offset } from '@progress/kendo-react-popup';
5
+ import { MapContext } from '../MapContext';
6
+ /**
7
+ * @hidden
8
+ */
9
+ export interface TooltipPopupProps {
10
+ className?: string | undefined;
11
+ popupShown: boolean;
12
+ popupAlign?: Align;
13
+ popupOffset?: Offset;
14
+ popupStyles?: any;
15
+ popupContent: Function;
16
+ }
17
+ /**
18
+ * @hidden
19
+ */
20
+ export declare class TooltipPopup extends React.Component<TooltipPopupProps, {}> {
21
+ static contextType: React.Context<import("../MapContext").MapContextType | null>;
22
+ context: React.ContextType<typeof MapContext>;
23
+ mapObserver: InstanceObserver;
24
+ element: HTMLDivElement | null;
25
+ constructor(props: TooltipPopupProps, context: any);
26
+ render(): JSX.Element;
27
+ componentWillUnmount(): void;
28
+ onMapMouseLeave: (e: DomEvent<React.MouseEvent<HTMLDivElement>>) => boolean;
29
+ }