react-spatial 1.2.2 → 1.2.3-beta.3

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 (186) hide show
  1. package/LayerService.js +128 -184
  2. package/LayerService.js.map +7 -1
  3. package/components/BaseLayerSwitcher/BaseLayerSwitcher.js +163 -221
  4. package/components/BaseLayerSwitcher/BaseLayerSwitcher.js.map +7 -1
  5. package/components/BaseLayerSwitcher/index.js +1 -3
  6. package/components/BaseLayerSwitcher/index.js.map +7 -1
  7. package/components/BasicMap/BasicMap.js +147 -285
  8. package/components/BasicMap/BasicMap.js.map +7 -1
  9. package/components/BasicMap/index.js +1 -3
  10. package/components/BasicMap/index.js.map +7 -1
  11. package/components/CanvasSaveButton/CanvasSaveButton.js +165 -419
  12. package/components/CanvasSaveButton/CanvasSaveButton.js.map +7 -1
  13. package/components/CanvasSaveButton/index.js +1 -3
  14. package/components/CanvasSaveButton/index.js.map +7 -1
  15. package/components/Copyright/Copyright.js +29 -70
  16. package/components/Copyright/Copyright.js.map +7 -1
  17. package/components/Copyright/index.js +1 -3
  18. package/components/Copyright/index.js.map +7 -1
  19. package/components/FeatureExportButton/FeatureExportButton.js +40 -106
  20. package/components/FeatureExportButton/FeatureExportButton.js.map +7 -1
  21. package/components/FeatureExportButton/index.js +1 -3
  22. package/components/FeatureExportButton/index.js.map +7 -1
  23. package/components/FilterButton/FilterButton.js +41 -106
  24. package/components/FilterButton/FilterButton.js.map +7 -1
  25. package/components/FilterButton/index.js +1 -3
  26. package/components/FilterButton/index.js.map +7 -1
  27. package/components/FitExtent/FitExtent.js +17 -50
  28. package/components/FitExtent/FitExtent.js.map +7 -1
  29. package/components/FitExtent/index.js +1 -3
  30. package/components/FitExtent/index.js.map +7 -1
  31. package/components/FollowButton/FollowButton.js +41 -111
  32. package/components/FollowButton/FollowButton.js.map +7 -1
  33. package/components/FollowButton/index.js +1 -3
  34. package/components/FollowButton/index.js.map +7 -1
  35. package/components/Geolocation/Geolocation.js +104 -213
  36. package/components/Geolocation/Geolocation.js.map +7 -1
  37. package/components/Geolocation/index.js +1 -3
  38. package/components/Geolocation/index.js.map +7 -1
  39. package/components/LayerTree/LayerTree.js +204 -410
  40. package/components/LayerTree/LayerTree.js.map +7 -1
  41. package/components/LayerTree/index.js +1 -3
  42. package/components/LayerTree/index.js.map +7 -1
  43. package/components/MousePosition/MousePosition.js +61 -130
  44. package/components/MousePosition/MousePosition.js.map +7 -1
  45. package/components/MousePosition/index.js +1 -3
  46. package/components/MousePosition/index.js.map +7 -1
  47. package/components/NorthArrow/NorthArrow.js +22 -62
  48. package/components/NorthArrow/NorthArrow.js.map +7 -1
  49. package/components/NorthArrow/index.js +1 -3
  50. package/components/NorthArrow/index.js.map +7 -1
  51. package/components/Overlay/Overlay.js +83 -130
  52. package/components/Overlay/Overlay.js.map +7 -1
  53. package/components/Overlay/index.js +1 -3
  54. package/components/Overlay/index.js.map +7 -1
  55. package/components/Permalink/Permalink.js +150 -244
  56. package/components/Permalink/Permalink.js.map +7 -1
  57. package/components/Permalink/index.js +1 -3
  58. package/components/Permalink/index.js.map +7 -1
  59. package/components/Popup/Popup.js +106 -233
  60. package/components/Popup/Popup.js.map +7 -1
  61. package/components/Popup/index.js +1 -3
  62. package/components/Popup/index.js.map +7 -1
  63. package/components/ResizeHandler/ResizeHandler.js +58 -113
  64. package/components/ResizeHandler/ResizeHandler.js.map +7 -1
  65. package/components/ResizeHandler/index.js +1 -3
  66. package/components/ResizeHandler/index.js.map +7 -1
  67. package/components/RouteSchedule/RouteSchedule.js +150 -283
  68. package/components/RouteSchedule/RouteSchedule.js.map +7 -1
  69. package/components/RouteSchedule/index.js +1 -3
  70. package/components/RouteSchedule/index.js.map +7 -1
  71. package/components/ScaleLine/ScaleLine.js +21 -45
  72. package/components/ScaleLine/ScaleLine.js.map +7 -1
  73. package/components/ScaleLine/index.js +1 -3
  74. package/components/ScaleLine/index.js.map +7 -1
  75. package/components/Search/Search.js +122 -186
  76. package/components/Search/Search.js.map +7 -1
  77. package/components/Search/SearchService.js +45 -69
  78. package/components/Search/SearchService.js.map +7 -1
  79. package/components/Search/engines/Engine.js +18 -25
  80. package/components/Search/engines/Engine.js.map +7 -1
  81. package/components/Search/engines/StopFinder.js +21 -38
  82. package/components/Search/engines/StopFinder.js.map +7 -1
  83. package/components/Search/index.js +3 -6
  84. package/components/Search/index.js.map +7 -1
  85. package/components/StopsFinder/StopsFinder.js +123 -174
  86. package/components/StopsFinder/StopsFinder.js.map +7 -1
  87. package/components/StopsFinder/StopsFinderOption.js +37 -54
  88. package/components/StopsFinder/StopsFinderOption.js.map +7 -1
  89. package/components/StopsFinder/index.js +1 -3
  90. package/components/StopsFinder/index.js.map +7 -1
  91. package/components/TrackerControl/TrackerControl.js +73 -128
  92. package/components/TrackerControl/TrackerControl.js.map +7 -1
  93. package/components/TrackerControl/index.js +1 -3
  94. package/components/TrackerControl/index.js.map +7 -1
  95. package/components/Zoom/Zoom.js +69 -112
  96. package/components/Zoom/Zoom.js.map +7 -1
  97. package/components/Zoom/index.js +1 -3
  98. package/components/Zoom/index.js.map +7 -1
  99. package/package.json +10 -5
  100. package/propTypes.js +17 -23
  101. package/propTypes.js.map +7 -1
  102. package/setupTests.js +2 -4
  103. package/setupTests.js.map +7 -1
  104. package/themes/README.md +26 -0
  105. package/themes/default/components.scss +0 -1
  106. package/themes/default/examples.scss +0 -1
  107. package/utils/GlobalsForOle.js +63 -64
  108. package/utils/GlobalsForOle.js.map +7 -1
  109. package/utils/KML.js +178 -364
  110. package/utils/KML.js.map +7 -1
  111. package/utils/KMLFormat.js +37 -73
  112. package/utils/KMLFormat.js.map +7 -1
  113. package/utils/Styles.js +24 -32
  114. package/utils/Styles.js.map +7 -1
  115. package/utils/getPolygonPattern.js +11 -44
  116. package/utils/getPolygonPattern.js.map +7 -1
  117. package/utils/timeUtils.js +16 -35
  118. package/utils/timeUtils.js.map +7 -1
  119. package/LayerService.test.js +0 -160
  120. package/LayerService.test.js.map +0 -1
  121. package/Projections.js +0 -16
  122. package/Projections.js.map +0 -1
  123. package/components/BaseLayerSwitcher/BaseLayerSwitcher.test.js +0 -88
  124. package/components/BaseLayerSwitcher/BaseLayerSwitcher.test.js.map +0 -1
  125. package/components/BaseLayerToggler/BaseLayerToggler.js +0 -490
  126. package/components/BaseLayerToggler/BaseLayerToggler.js.map +0 -1
  127. package/components/BaseLayerToggler/BaseLayerToggler.md.scss +0 -9
  128. package/components/BaseLayerToggler/BaseLayerToggler.scss +0 -49
  129. package/components/BaseLayerToggler/BaseLayerToggler.test.js +0 -127
  130. package/components/BaseLayerToggler/BaseLayerToggler.test.js.map +0 -1
  131. package/components/BaseLayerToggler/index.js +0 -3
  132. package/components/BaseLayerToggler/index.js.map +0 -1
  133. package/components/BasicMap/BasicMap.test.js +0 -288
  134. package/components/BasicMap/BasicMap.test.js.map +0 -1
  135. package/components/CanvasSaveButton/CanvasSaveButton.test.js +0 -173
  136. package/components/CanvasSaveButton/CanvasSaveButton.test.js.map +0 -1
  137. package/components/Copyright/Copyright.test.js +0 -133
  138. package/components/Copyright/Copyright.test.js.map +0 -1
  139. package/components/FeatureExportButton/FeatureExportButton.test.js +0 -407
  140. package/components/FeatureExportButton/FeatureExportButton.test.js.map +0 -1
  141. package/components/FilterButton/FilterButton.test.js +0 -48
  142. package/components/FilterButton/FilterButton.test.js.map +0 -1
  143. package/components/FitExtent/FitExtent.test.js +0 -44
  144. package/components/FitExtent/FitExtent.test.js.map +0 -1
  145. package/components/FollowButton/FollowButton.test.js +0 -57
  146. package/components/FollowButton/FollowButton.test.js.map +0 -1
  147. package/components/Geolocation/Geolocation.test.js +0 -263
  148. package/components/Geolocation/Geolocation.test.js.map +0 -1
  149. package/components/LayerTree/LayerTree.test.js +0 -323
  150. package/components/LayerTree/LayerTree.test.js.map +0 -1
  151. package/components/MousePosition/MousePosition.test.js +0 -125
  152. package/components/MousePosition/MousePosition.test.js.map +0 -1
  153. package/components/NorthArrow/NorthArrow.test.js +0 -106
  154. package/components/NorthArrow/NorthArrow.test.js.map +0 -1
  155. package/components/Overlay/Overlay.test.js +0 -145
  156. package/components/Overlay/Overlay.test.js.map +0 -1
  157. package/components/Permalink/Permalink.test.js +0 -267
  158. package/components/Permalink/Permalink.test.js.map +0 -1
  159. package/components/Popup/Popup.test.js +0 -291
  160. package/components/Popup/Popup.test.js.map +0 -1
  161. package/components/ResizeHandler/ResizeHandler.test.js +0 -410
  162. package/components/ResizeHandler/ResizeHandler.test.js.map +0 -1
  163. package/components/RouteSchedule/RouteSchedule.test.js +0 -102
  164. package/components/RouteSchedule/RouteSchedule.test.js.map +0 -1
  165. package/components/ScaleLine/ScaleLine.test.js +0 -32
  166. package/components/ScaleLine/ScaleLine.test.js.map +0 -1
  167. package/components/Search/Search.test.js +0 -15
  168. package/components/Search/Search.test.js.map +0 -1
  169. package/components/StopsFinder/StopsFinder.test.js +0 -19
  170. package/components/StopsFinder/StopsFinder.test.js.map +0 -1
  171. package/components/TrackerControl/TrackerControl.test.js +0 -17
  172. package/components/TrackerControl/TrackerControl.test.js.map +0 -1
  173. package/components/Zoom/Zoom.test.js +0 -150
  174. package/components/Zoom/Zoom.test.js.map +0 -1
  175. package/styleguidist/ComponentsList.js +0 -52
  176. package/styleguidist/ComponentsList.js.map +0 -1
  177. package/styleguidist/StyleGuide.js +0 -253
  178. package/styleguidist/StyleGuide.js.map +0 -1
  179. package/utils/KML.test.js +0 -163
  180. package/utils/KML.test.js.map +0 -1
  181. package/utils/KMLFormat.test.js +0 -22
  182. package/utils/KMLFormat.test.js.map +0 -1
  183. package/utils/getPolygonPattern.test.js +0 -66
  184. package/utils/getPolygonPattern.test.js.map +0 -1
  185. package/utils/timeUtils.test.js +0 -32
  186. package/utils/timeUtils.test.js.map +0 -1
@@ -1,131 +1,66 @@
1
- import React, { PureComponent } from 'react';
2
- import qs from 'query-string';
3
- import PropTypes from 'prop-types';
4
- import { TrackerLayer } from 'mobility-toolbox-js/ol';
5
-
6
- var propTypes = {
7
- /**
8
- * CSS class of the filter button.
9
- */
1
+ import React, { PureComponent } from "react";
2
+ import qs from "query-string";
3
+ import PropTypes from "prop-types";
4
+ import { RealtimeLayer as TrackerLayer } from "mobility-toolbox-js/ol";
5
+ const propTypes = {
10
6
  className: PropTypes.string,
11
-
12
- /**
13
- * Title.
14
- */
15
7
  title: PropTypes.string,
16
-
17
- /**
18
- * Line info route identifer.
19
- */
20
8
  routeIdentifier: PropTypes.string.isRequired,
21
-
22
- /**
23
- * Button is active.
24
- */
25
9
  active: PropTypes.bool.isRequired,
26
-
27
- /**
28
- * Function triggered on button click.
29
- */
30
10
  onClick: PropTypes.func.isRequired,
31
-
32
- /**
33
- * Trackerlayer.
34
- */
35
11
  trackerLayer: PropTypes.instanceOf(TrackerLayer).isRequired,
36
-
37
- /**
38
- * Children content of the button.
39
- */
40
- children: PropTypes.element.isRequired,
12
+ children: PropTypes.element.isRequired
41
13
  };
42
-
43
- var defaultProps = {
44
- className: 'rt-route-filter',
45
- title: 'Filter',
14
+ const defaultProps = {
15
+ className: "rt-route-filter",
16
+ title: "Filter"
46
17
  };
47
-
48
- /**
49
- * Button enables the filtering of a selected train.
50
- */
51
- var FilterButton = /*@__PURE__*/(function (PureComponent) {
52
- function FilterButton () {
53
- PureComponent.apply(this, arguments);
54
- }
55
-
56
- if ( PureComponent ) FilterButton.__proto__ = PureComponent;
57
- FilterButton.prototype = Object.create( PureComponent && PureComponent.prototype );
58
- FilterButton.prototype.constructor = FilterButton;
59
-
60
- FilterButton.prototype.updatePermalink = function updatePermalink (isRemoving) {
61
- var ref = this.props;
62
- var routeIdentifier = ref.routeIdentifier;
63
-
64
- var parameters = qs.parse(window.location.search.toLowerCase());
18
+ class FilterButton extends PureComponent {
19
+ updatePermalink(isRemoving) {
20
+ const { routeIdentifier } = this.props;
21
+ const parameters = qs.parse(window.location.search.toLowerCase());
65
22
  if (isRemoving) {
66
23
  delete parameters.tripnumber;
67
24
  } else {
68
- parameters.tripnumber = parseInt(routeIdentifier.split('.')[0], 10);
25
+ parameters.tripnumber = parseInt(routeIdentifier.split(".")[0], 10);
69
26
  }
70
-
71
- var qStr = qs.stringify(parameters, { encode: false });
72
- var search = "?" + qStr;
73
- var ref$1 = window.location;
74
- var hash = ref$1.hash;
75
- window.history.replaceState(undefined, undefined, ("" + search + (hash || '')));
76
- };
77
-
78
- FilterButton.prototype.toggleFilter = function toggleFilter (routeIdentifier) {
79
- var assign;
80
-
81
- var ref = this.props;
82
- var trackerLayer = ref.trackerLayer;
83
- var active = ref.active;
84
- var onClick = ref.onClick;
85
- var activated = !active;
86
-
27
+ const qStr = qs.stringify(parameters, { encode: false });
28
+ const search = `?${qStr}`;
29
+ const { hash } = window.location;
30
+ window.history.replaceState(void 0, void 0, `${search}${hash || ""}`);
31
+ }
32
+ toggleFilter(routeIdentifier) {
33
+ const { trackerLayer, active, onClick } = this.props;
34
+ const activated = !active;
87
35
  if (trackerLayer) {
88
36
  if (activated) {
89
37
  this.updatePermalink(false);
90
- (assign = routeIdentifier.split('.'), trackerLayer.tripNumber = assign[0]);
38
+ [trackerLayer.tripNumber] = routeIdentifier.split(".");
91
39
  } else {
92
40
  this.updatePermalink(true);
93
41
  trackerLayer.tripNumber = null;
94
42
  }
95
43
  }
96
-
97
44
  onClick(activated);
98
- };
99
-
100
- FilterButton.prototype.render = function render () {
101
- var this$1 = this;
102
-
103
- var ref = this.props;
104
- var className = ref.className;
105
- var title = ref.title;
106
- var routeIdentifier = ref.routeIdentifier;
107
- var active = ref.active;
108
- var children = ref.children;
109
- var toggle = function () {
110
- return this$1.toggleFilter(routeIdentifier);
45
+ }
46
+ render() {
47
+ const { className, title, routeIdentifier, active, children } = this.props;
48
+ const toggle = () => {
49
+ return this.toggleFilter(routeIdentifier);
111
50
  };
112
-
113
- return (
114
- React.createElement( 'div', {
115
- 'aria-label': title, className: ("" + className + (active ? ' rt-active' : '')), title: title, onClick: toggle, onKeyPress: function (e) {
116
- return e.which === 13 && toggle();
117
- }, role: "button", tabIndex: 0 },
118
- children
119
- )
120
- );
121
- };
122
-
123
- return FilterButton;
124
- }(PureComponent));
125
-
51
+ return /* @__PURE__ */ React.createElement("div", {
52
+ "aria-label": title,
53
+ className: `${className}${active ? " rt-active" : ""}`,
54
+ title,
55
+ onClick: toggle,
56
+ onKeyPress: (e) => {
57
+ return e.which === 13 && toggle();
58
+ },
59
+ role: "button",
60
+ tabIndex: 0
61
+ }, children);
62
+ }
63
+ }
126
64
  FilterButton.propTypes = propTypes;
127
65
  FilterButton.defaultProps = defaultProps;
128
-
129
66
  export default FilterButton;
130
-
131
- //# sourceMappingURL=FilterButton.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"FilterButton.js","sources":["../../../src/components/FilterButton/FilterButton.js"],"sourcesContent":["import React, { PureComponent } from 'react';\nimport qs from 'query-string';\nimport PropTypes from 'prop-types';\nimport { TrackerLayer } from 'mobility-toolbox-js/ol';\n\nconst propTypes = {\n /**\n * CSS class of the filter button.\n */\n className: PropTypes.string,\n\n /**\n * Title.\n */\n title: PropTypes.string,\n\n /**\n * Line info route identifer.\n */\n routeIdentifier: PropTypes.string.isRequired,\n\n /**\n * Button is active.\n */\n active: PropTypes.bool.isRequired,\n\n /**\n * Function triggered on button click.\n */\n onClick: PropTypes.func.isRequired,\n\n /**\n * Trackerlayer.\n */\n trackerLayer: PropTypes.instanceOf(TrackerLayer).isRequired,\n\n /**\n * Children content of the button.\n */\n children: PropTypes.element.isRequired,\n};\n\nconst defaultProps = {\n className: 'rt-route-filter',\n title: 'Filter',\n};\n\n/**\n * Button enables the filtering of a selected train.\n */\nclass FilterButton extends PureComponent {\n updatePermalink(isRemoving) {\n const { routeIdentifier } = this.props;\n\n const parameters = qs.parse(window.location.search.toLowerCase());\n if (isRemoving) {\n delete parameters.tripnumber;\n } else {\n parameters.tripnumber = parseInt(routeIdentifier.split('.')[0], 10);\n }\n\n const qStr = qs.stringify(parameters, { encode: false });\n const search = `?${qStr}`;\n const { hash } = window.location;\n window.history.replaceState(undefined, undefined, `${search}${hash || ''}`);\n }\n\n toggleFilter(routeIdentifier) {\n const { trackerLayer, active, onClick } = this.props;\n const activated = !active;\n\n if (trackerLayer) {\n if (activated) {\n this.updatePermalink(false);\n [trackerLayer.tripNumber] = routeIdentifier.split('.');\n } else {\n this.updatePermalink(true);\n trackerLayer.tripNumber = null;\n }\n }\n\n onClick(activated);\n }\n\n render() {\n const { className, title, routeIdentifier, active, children } = this.props;\n const toggle = () => {\n return this.toggleFilter(routeIdentifier);\n };\n\n return (\n <div\n aria-label={title}\n className={`${className}${active ? ' rt-active' : ''}`}\n title={title}\n onClick={toggle}\n onKeyPress={(e) => {\n return e.which === 13 && toggle();\n }}\n role=\"button\"\n tabIndex={0}\n >\n {children}\n </div>\n );\n }\n}\n\nFilterButton.propTypes = propTypes;\nFilterButton.defaultProps = defaultProps;\n\nexport default FilterButton;\n"],"names":["const","this"],"mappings":"AAAA,OAAO,KAAK,IAAI,aAAa,QAAQ,OAAO,CAAC;AAC7C,OAAO,EAAE,MAAM,cAAc,CAAC;AAC9B,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,SAAS,YAAY,QAAQ,wBAAwB,CAAC;AACtD;AACAA,GAAK,CAAC,SAAS,GAAG;AAClB;AACA;AACA;AACA,EAAE,SAAS,EAAE,SAAS,CAAC,MAAM;AAC7B;AACA;AACA;AACA;AACA,EAAE,KAAK,EAAE,SAAS,CAAC,MAAM;AACzB;AACA;AACA;AACA;AACA,EAAE,eAAe,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;AAC9C;AACA;AACA;AACA;AACA,EAAE,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;AACnC;AACA;AACA;AACA;AACA,EAAE,OAAO,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;AACpC;AACA;AACA;AACA;AACA,EAAE,YAAY,EAAE,SAAS,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,UAAU;AAC7D;AACA;AACA;AACA;AACA,EAAE,QAAQ,EAAE,S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EAAE;AACrB,QAAQ,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;AACpC,eAAiC,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,GAApD,YAAY,CAAC,uBAAwC,CAAC;AAC/D,OAAO,MAAM;AACb,QAAQ,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AACnC,QAAQ,YAAY,CAAC,UAAU,GAAG,IAAI,CAAC;AACvC,OAAO;AACP,KAAK;AACL;AACA,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;AACvB,IAAG;AACH;AACA,yBAAE,yBAAM,GAAG;;AAAC;AACZ,WAAiE,GAAG,IAAI,CAAC;IAA7D;IAAW;IAAO;IAAiB;IAAQ,4BAAwB;AAC/E,IAAIA,GAAK,CAAC,MAAM,YAAG,GAAM;AACzB,MAAM,OAAOC,MAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;AAChD,KAAK,CAAC;AACN;AACA,IAAI,OAAO;AACX,MAAM,sBAAC,OAAG;AACV,QAAQ,cAAY,KAAM,EAClB,WAAW,MAAG,aAAY,MAAM,GAAG,YAAY,GAAG,IAAK,EACvD,OAAO,KAAM,EACb,SAAS,MAAO,EAChB,qBAAY,CAAC,CAAC,EAAK;AAC3B,UAAU,OAAO,CAAC,CAAC,KAAK,KAAK,EAAE,IAAI,MAAM,EAAE,CAAC;AAC5C,SAAU,EACF,MAAK,QAAQ,EACb,UAAU,IACX;AACP,QAAS,QAAS;AAClB,MAAM,CAAM;AACZ,KAAK,CAAC;AACN;;;EAvD2B,gBAwD1B;AACD;AACA,YAAY,CAAC,SAAS,GAAG,SAAS,CAAC;AACnC,YAAY,CAAC,YAAY,GAAG,YAAY,CAAC;AACzC;AACA,eAAe,YAAY,CAAC;"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/FilterButton/FilterButton.js"],
4
+ "sourcesContent": ["import React, { PureComponent } from 'react';\nimport qs from 'query-string';\nimport PropTypes from 'prop-types';\nimport { RealtimeLayer as TrackerLayer } from 'mobility-toolbox-js/ol';\n\nconst propTypes = {\n /**\n * CSS class of the filter button.\n */\n className: PropTypes.string,\n\n /**\n * Title.\n */\n title: PropTypes.string,\n\n /**\n * Line info route identifer.\n */\n routeIdentifier: PropTypes.string.isRequired,\n\n /**\n * Button is active.\n */\n active: PropTypes.bool.isRequired,\n\n /**\n * Function triggered on button click.\n */\n onClick: PropTypes.func.isRequired,\n\n /**\n * Trackerlayer.\n */\n trackerLayer: PropTypes.instanceOf(TrackerLayer).isRequired,\n\n /**\n * Children content of the button.\n */\n children: PropTypes.element.isRequired,\n};\n\nconst defaultProps = {\n className: 'rt-route-filter',\n title: 'Filter',\n};\n\n/**\n * Button enables the filtering of a selected train.\n */\nclass FilterButton extends PureComponent {\n updatePermalink(isRemoving) {\n const { routeIdentifier } = this.props;\n\n const parameters = qs.parse(window.location.search.toLowerCase());\n if (isRemoving) {\n delete parameters.tripnumber;\n } else {\n parameters.tripnumber = parseInt(routeIdentifier.split('.')[0], 10);\n }\n\n const qStr = qs.stringify(parameters, { encode: false });\n const search = `?${qStr}`;\n const { hash } = window.location;\n window.history.replaceState(undefined, undefined, `${search}${hash || ''}`);\n }\n\n toggleFilter(routeIdentifier) {\n const { trackerLayer, active, onClick } = this.props;\n const activated = !active;\n\n if (trackerLayer) {\n if (activated) {\n this.updatePermalink(false);\n [trackerLayer.tripNumber] = routeIdentifier.split('.');\n } else {\n this.updatePermalink(true);\n trackerLayer.tripNumber = null;\n }\n }\n\n onClick(activated);\n }\n\n render() {\n const { className, title, routeIdentifier, active, children } = this.props;\n const toggle = () => {\n return this.toggleFilter(routeIdentifier);\n };\n\n return (\n <div\n aria-label={title}\n className={`${className}${active ? ' rt-active' : ''}`}\n title={title}\n onClick={toggle}\n onKeyPress={(e) => {\n return e.which === 13 && toggle();\n }}\n role=\"button\"\n tabIndex={0}\n >\n {children}\n </div>\n );\n }\n}\n\nFilterButton.propTypes = propTypes;\nFilterButton.defaultProps = defaultProps;\n\n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AAA,EACnB;AAAA,EAEA,SAAS;AACP,UAAM,EAAE,WAAW,OAAO,iBAAiB,QAAQ,SAAS,IAAI,KAAK;AACrE,UAAM,SAAS,MAAM;AACnB,aAAO,KAAK,aAAa,eAAe;AAAA,IAC1C;AAEA,WACE,oCAAC;AAAA,MACC,cAAY;AAAA,MACZ,WAAW,GAAG,YAAY,SAAS,eAAe;AAAA,MAClD;AAAA,MACA,SAAS;AAAA,MACT,YAAY,CAAC,MAAM;AACjB,eAAO,EAAE,UAAU,MAAM,OAAO;AAAA,MAClC;AAAA,MACA,MAAK;AAAA,MACL,UAAU;AAAA,OAET,QACH;AAAA,EAEJ;AACF;AAEA,aAAa,YAAY;AACzB,aAAa,eAAe;AAE5B,eAAe;",
6
+ "names": []
7
+ }
@@ -1,3 +1 @@
1
- export { default } from './FilterButton';
2
-
3
- //# sourceMappingURL=index.js.map
1
+ export { default } from "./FilterButton";
@@ -1 +1,7 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/FilterButton/index.js"],"sourcesContent":["export { default } from './FilterButton';\n"],"names":[],"mappings":"AAAA,SAAS,OAAO,QAAQ,gBAAgB,CAAC;"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/FilterButton/index.js"],
4
+ "sourcesContent": ["export { default } from './FilterButton';\n"],
5
+ "mappings": "AAAA,wBAAwB;",
6
+ "names": []
7
+ }
@@ -1,65 +1,32 @@
1
- function objectWithoutProperties (obj, exclude) { var target = {}; for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k) && exclude.indexOf(k) === -1) target[k] = obj[k]; return target; }
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- import OLMap from 'ol/Map';
5
-
6
- var propTypes = {
7
- /**
8
- * An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).
9
- */
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import OLMap from "ol/Map";
4
+ const propTypes = {
10
5
  map: PropTypes.instanceOf(OLMap).isRequired,
11
-
12
- /**
13
- * The extent to be zoomed.
14
- */
15
6
  extent: PropTypes.arrayOf(PropTypes.number).isRequired,
16
-
17
- /**
18
- * CSS class for the fitExtent button.
19
- */
20
7
  className: PropTypes.string,
21
-
22
- /**
23
- * Button content.
24
- */
25
- children: PropTypes.node.isRequired,
8
+ children: PropTypes.node.isRequired
26
9
  };
27
-
28
- var defaultProps = {
29
- className: 'rs-fit-extent',
10
+ const defaultProps = {
11
+ className: "rs-fit-extent"
30
12
  };
31
-
32
- /**
33
- * The FitExtent component creates a button that updates the current extent of
34
- * an [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).
35
- */
36
- function FitExtent(ref) {
37
- var map = ref.map;
38
- var extent = ref.extent;
39
- var className = ref.className;
40
- var children = ref.children;
41
- var rest = objectWithoutProperties( ref, ["map", "extent", "className", "children"] );
42
- var other = rest;
43
-
44
- var fit = function (evt) {
13
+ function FitExtent({ map, extent, className, children, ...other }) {
14
+ const fit = (evt) => {
45
15
  if (evt.which && evt.which !== 13) {
46
16
  return;
47
17
  }
48
18
  map.getView().cancelAnimations();
49
19
  map.getView().fit(extent, map.getSize());
50
20
  };
51
-
52
- return (
53
- React.createElement( 'div', Object.assign({},
54
- { className: className, role: "button", tabIndex: "0", onClick: fit, onKeyPress: fit }, other),
55
- children
56
- )
57
- );
21
+ return /* @__PURE__ */ React.createElement("div", {
22
+ className,
23
+ role: "button",
24
+ tabIndex: "0",
25
+ onClick: fit,
26
+ onKeyPress: fit,
27
+ ...other
28
+ }, children);
58
29
  }
59
-
60
30
  FitExtent.propTypes = propTypes;
61
31
  FitExtent.defaultProps = defaultProps;
62
-
63
32
  export default FitExtent;
64
-
65
- //# sourceMappingURL=FitExtent.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"FitExtent.js","sources":["../../../src/components/FitExtent/FitExtent.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport OLMap from 'ol/Map';\n\nconst propTypes = {\n /**\n * An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\n map: PropTypes.instanceOf(OLMap).isRequired,\n\n /**\n * The extent to be zoomed.\n */\n extent: PropTypes.arrayOf(PropTypes.number).isRequired,\n\n /**\n * CSS class for the fitExtent button.\n */\n className: PropTypes.string,\n\n /**\n * Button content.\n */\n children: PropTypes.node.isRequired,\n};\n\nconst defaultProps = {\n className: 'rs-fit-extent',\n};\n\n/**\n * The FitExtent component creates a button that updates the current extent of\n * an [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\nfunction FitExtent({ map, extent, className, children, ...other }) {\n const fit = (evt) => {\n if (evt.which && evt.which !== 13) {\n return;\n }\n map.getView().cancelAnimations();\n map.getView().fit(extent, map.getSize());\n };\n\n return (\n <div\n className={className}\n role=\"button\"\n tabIndex=\"0\"\n onClick={fit}\n onKeyPress={fit}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...other}\n >\n {children}\n </div>\n );\n}\n\nFitExtent.propTypes = propTypes;\nFitExtent.defaultProps = defaultProps;\n\nexport default FitExtent;\n"],"names":["const"],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,MAAM,QAAQ,CAAC;AAC3B;AACAA,GAAK,CAAC,SAAS,GAAG;AAClB;AACA;AACA;AACA,EAAE,GAAG,EAAE,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,UAAU;AAC7C;AACA;AACA;AACA;AACA,EAAE,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,UAAU;AACxD;AACA;AACA;AACA;AACA,EAAE,SAAS,EAAE,SAAS,CAAC,MAAM;AAC7B;AACA;AACA;AACA;AACA,EAAE,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;AACrC,CAAC,CAAC;AACF;AACAA,GAAK,CAAC,YAAY,GAAG;AACrB,EAAE,SAAS,EAAE,eAAe;AAC5B,CAAC,CAAC;AACF;AACA;AACA;AACA;AACA;AACA,SAAS,SAAS,IAA+C,EAAE,CAA9C;oBAAK;0BAAQ;gCAAW;8BAAU;wFAAG;;AAAU;AACpE,EAAEA,GAAK,CAAC,GAAG,YAAG,CAAC,GAAG,EAAK;AACvB,IAAI,IAAI,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,KAAK,KAAK,EAAE,EAAE;AACvC,MAAM,OAAO;AACb,KAAK;AACL,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,gBAAgB,EAAE,CAAC;AACrC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;AAC7C,GAAG,CAAC;AACJ;AACA,EAAE,OAAO;AACT,IAAI,sBAAC,uBAAG;AACR,QAAM,WAAW,SAAU,EACrB,MAAK,QAAQ,EACb,UAAS,GAAG,EACZ,SAAS,GAAI,EACb,YAAY,KAAI,EAEZ,OACL;AACL,MAAO,QAAS;AAChB,IAAI,CAAM;AACV,GAAG,CAAC;AACJ,CAAC;AACD;AACA,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC;AAChC,SAAS,CAAC,YAAY,GAAG,YAAY,CAAC;AACtC;AACA,eAAe,SAAS,CAAC;"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/FitExtent/FitExtent.js"],
4
+ "sourcesContent": ["import React from 'react';\nimport PropTypes from 'prop-types';\nimport OLMap from 'ol/Map';\n\nconst propTypes = {\n /**\n * An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\n map: PropTypes.instanceOf(OLMap).isRequired,\n\n /**\n * The extent to be zoomed.\n */\n extent: PropTypes.arrayOf(PropTypes.number).isRequired,\n\n /**\n * CSS class for the fitExtent button.\n */\n className: PropTypes.string,\n\n /**\n * Button content.\n */\n children: PropTypes.node.isRequired,\n};\n\nconst defaultProps = {\n className: 'rs-fit-extent',\n};\n\n/**\n * The FitExtent component creates a button that updates the current extent of\n * an [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\nfunction FitExtent({ map, extent, className, children, ...other }) {\n const fit = (evt) => {\n if (evt.which && evt.which !== 13) {\n return;\n }\n map.getView().cancelAnimations();\n map.getView().fit(extent, map.getSize());\n };\n\n return (\n <div\n className={className}\n role=\"button\"\n tabIndex=\"0\"\n onClick={fit}\n onKeyPress={fit}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...other}\n >\n {children}\n </div>\n );\n}\n\nFitExtent.propTypes = propTypes;\nFitExtent.defaultProps = defaultProps;\n\nexport default FitExtent;\n"],
5
+ "mappings": "AAAA,OAAO,WAAW;AAClB,OAAO,eAAe;AACtB,OAAO,WAAW;AAElB,MAAM,YAAY;AAAA,EAIhB,KAAK,UAAU,WAAW,KAAK,EAAE;AAAA,EAKjC,QAAQ,UAAU,QAAQ,UAAU,MAAM,EAAE;AAAA,EAK5C,WAAW,UAAU;AAAA,EAKrB,UAAU,UAAU,KAAK;AAC3B;AAEA,MAAM,eAAe;AAAA,EACnB,WAAW;AACb;AAMA,SAAS,UAAU,EAAE,KAAK,QAAQ,WAAW,aAAa,MAAM,GAAG;AACjE,QAAM,MAAM,CAAC,QAAQ;AACnB,QAAI,IAAI,SAAS,IAAI,UAAU,IAAI;AACjC;AAAA,IACF;AACA,QAAI,QAAQ,EAAE,iBAAiB;AAC/B,QAAI,QAAQ,EAAE,IAAI,QAAQ,IAAI,QAAQ,CAAC;AAAA,EACzC;AAEA,SACE,oCAAC;AAAA,IACC;AAAA,IACA,MAAK;AAAA,IACL,UAAS;AAAA,IACT,SAAS;AAAA,IACT,YAAY;AAAA,IAEX,GAAG;AAAA,KAEH,QACH;AAEJ;AAEA,UAAU,YAAY;AACtB,UAAU,eAAe;AAEzB,eAAe;",
6
+ "names": []
7
+ }
@@ -1,3 +1 @@
1
- export { default } from './FitExtent';
2
-
3
- //# sourceMappingURL=index.js.map
1
+ export { default } from "./FitExtent";
@@ -1 +1,7 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/FitExtent/index.js"],"sourcesContent":["export { default } from './FitExtent';\n"],"names":[],"mappings":"AAAA,SAAS,OAAO,QAAQ,aAAa,CAAC;"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/FitExtent/index.js"],
4
+ "sourcesContent": ["export { default } from './FitExtent';\n"],
5
+ "mappings": "AAAA,wBAAwB;",
6
+ "names": []
7
+ }
@@ -1,143 +1,73 @@
1
- import React, { PureComponent } from 'react';
2
- import PropTypes from 'prop-types';
3
- import { TrackerLayer } from 'mobility-toolbox-js/ol';
4
-
5
- var propTypes = {
6
- /**
7
- * CSS class of the follow button.
8
- */
1
+ import React, { PureComponent } from "react";
2
+ import PropTypes from "prop-types";
3
+ import { RealtimeLayer as TrackerLayer } from "mobility-toolbox-js/ol";
4
+ const propTypes = {
9
5
  className: PropTypes.string,
10
-
11
- /**
12
- * Title.
13
- */
14
6
  title: PropTypes.string,
15
-
16
- /**
17
- * Line info route identifer.
18
- */
19
7
  routeIdentifier: PropTypes.string.isRequired,
20
-
21
- /**
22
- * Button is active.
23
- */
24
8
  active: PropTypes.bool.isRequired,
25
-
26
- /**
27
- * Function triggered on button click.
28
- */
29
9
  onClick: PropTypes.func.isRequired,
30
-
31
- /**
32
- * Trackerlayer.
33
- */
34
10
  trackerLayer: PropTypes.instanceOf(TrackerLayer).isRequired,
35
-
36
- /**
37
- * Function to set the map center, Used to follow a train.
38
- */
39
11
  setCenter: PropTypes.func.isRequired,
40
-
41
- /**
42
- * Children content of the button.
43
- */
44
- children: PropTypes.element.isRequired,
12
+ children: PropTypes.element.isRequired
45
13
  };
46
-
47
- var defaultProps = {
48
- className: 'rt-route-follow',
49
- title: 'Follow',
14
+ const defaultProps = {
15
+ className: "rt-route-follow",
16
+ title: "Follow"
50
17
  };
51
-
52
- /**
53
- * Button enables the follow of a selected train.
54
- */
55
- var FollowButton = /*@__PURE__*/(function (PureComponent) {
56
- function FollowButton() {
57
- PureComponent.call(this);
18
+ class FollowButton extends PureComponent {
19
+ constructor() {
20
+ super();
58
21
  this.onClick = this.onClick.bind(this);
59
22
  }
60
-
61
- if ( PureComponent ) FollowButton.__proto__ = PureComponent;
62
- FollowButton.prototype = Object.create( PureComponent && PureComponent.prototype );
63
- FollowButton.prototype.constructor = FollowButton;
64
-
65
- FollowButton.prototype.componentDidUpdate = function componentDidUpdate (prevProps) {
66
- var this$1 = this;
67
-
68
- var ref = this.props;
69
- var routeIdentifier = ref.routeIdentifier;
70
- var active = ref.active;
71
- var trackerLayer = ref.trackerLayer;
72
- var onClick = ref.onClick;
73
-
23
+ componentDidUpdate(prevProps) {
24
+ const { routeIdentifier, active, trackerLayer, onClick } = this.props;
74
25
  if (routeIdentifier !== prevProps.routeIdentifier) {
75
26
  onClick(false);
76
27
  }
77
-
78
28
  if (active !== prevProps.active) {
79
29
  if (active && trackerLayer) {
80
30
  this.centerOnTrajectory(routeIdentifier);
81
- this.updateInterval = window.setInterval(function () {
82
- this$1.centerOnTrajectory(routeIdentifier);
31
+ this.updateInterval = window.setInterval(() => {
32
+ this.centerOnTrajectory(routeIdentifier);
83
33
  }, 50);
84
34
  } else {
85
35
  clearInterval(this.updateInterval);
86
36
  }
87
37
  }
88
- };
89
-
90
- FollowButton.prototype.componentWillUnmount = function componentWillUnmount () {
38
+ }
39
+ componentWillUnmount() {
91
40
  clearInterval(this.updateInterval);
92
- };
93
-
94
- FollowButton.prototype.onClick = function onClick () {
95
- var ref = this.props;
96
- var active = ref.active;
97
- var onClick = ref.onClick;
41
+ }
42
+ onClick() {
43
+ const { active, onClick } = this.props;
98
44
  onClick(!active);
99
- };
100
-
101
- FollowButton.prototype.centerOnTrajectory = function centerOnTrajectory (routeIdentifier) {
102
- var ref = this.props;
103
- var trackerLayer = ref.trackerLayer;
104
- var setCenter = ref.setCenter;
105
-
106
- var ref$1 = trackerLayer.getVehicle(function (r) {
45
+ }
46
+ centerOnTrajectory(routeIdentifier) {
47
+ const { trackerLayer, setCenter } = this.props;
48
+ const [trajectory] = trackerLayer.getVehicle((r) => {
107
49
  return r.routeIdentifier === routeIdentifier;
108
50
  });
109
- var trajectory = ref$1[0];
110
- var firstCoord = trajectory && trajectory.coordinate;
51
+ const firstCoord = trajectory && trajectory.coordinate;
111
52
  if (firstCoord) {
112
53
  setCenter(firstCoord);
113
54
  }
114
- };
115
-
116
- FollowButton.prototype.render = function render () {
117
- var this$1 = this;
118
-
119
- var ref = this.props;
120
- var className = ref.className;
121
- var title = ref.title;
122
- var active = ref.active;
123
- var children = ref.children;
124
-
125
- return (
126
- React.createElement( 'div', {
127
- 'aria-label': title, className: ("" + className + (active ? ' rt-active' : '')), title: title, onClick: this.onClick, onKeyPress: function (e) {
128
- return e.which === 13 && this$1.onClick;
129
- }, role: "button", tabIndex: 0 },
130
- children
131
- )
132
- );
133
- };
134
-
135
- return FollowButton;
136
- }(PureComponent));
137
-
55
+ }
56
+ render() {
57
+ const { className, title, active, children } = this.props;
58
+ return /* @__PURE__ */ React.createElement("div", {
59
+ "aria-label": title,
60
+ className: `${className}${active ? " rt-active" : ""}`,
61
+ title,
62
+ onClick: this.onClick,
63
+ onKeyPress: (e) => {
64
+ return e.which === 13 && this.onClick;
65
+ },
66
+ role: "button",
67
+ tabIndex: 0
68
+ }, children);
69
+ }
70
+ }
138
71
  FollowButton.propTypes = propTypes;
139
72
  FollowButton.defaultProps = defaultProps;
140
-
141
73
  export default FollowButton;
142
-
143
- //# sourceMappingURL=FollowButton.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"FollowButton.js","sources":["../../../src/components/FollowButton/FollowButton.js"],"sourcesContent":["import React, { PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport { TrackerLayer } from 'mobility-toolbox-js/ol';\n\nconst propTypes = {\n /**\n * CSS class of the follow button.\n */\n className: PropTypes.string,\n\n /**\n * Title.\n */\n title: PropTypes.string,\n\n /**\n * Line info route identifer.\n */\n routeIdentifier: PropTypes.string.isRequired,\n\n /**\n * Button is active.\n */\n active: PropTypes.bool.isRequired,\n\n /**\n * Function triggered on button click.\n */\n onClick: PropTypes.func.isRequired,\n\n /**\n * Trackerlayer.\n */\n trackerLayer: PropTypes.instanceOf(TrackerLayer).isRequired,\n\n /**\n * Function to set the map center, Used to follow a train.\n */\n setCenter: PropTypes.func.isRequired,\n\n /**\n * Children content of the button.\n */\n children: PropTypes.element.isRequired,\n};\n\nconst defaultProps = {\n className: 'rt-route-follow',\n title: 'Follow',\n};\n\n/**\n * Button enables the follow of a selected train.\n */\nclass FollowButton extends PureComponent {\n constructor() {\n super();\n this.onClick = this.onClick.bind(this);\n }\n\n componentDidUpdate(prevProps) {\n const { routeIdentifier, active, trackerLayer, onClick } = this.props;\n\n if (routeIdentifier !== prevProps.routeIdentifier) {\n onClick(false);\n }\n\n if (active !== prevProps.active) {\n if (active && trackerLayer) {\n this.centerOnTrajectory(routeIdentifier);\n this.updateInterval = window.setInterval(() => {\n this.centerOnTrajectory(routeIdentifier);\n }, 50);\n } else {\n clearInterval(this.updateInterval);\n }\n }\n }\n\n componentWillUnmount() {\n clearInterval(this.updateInterval);\n }\n\n onClick() {\n const { active, onClick } = this.props;\n onClick(!active);\n }\n\n centerOnTrajectory(routeIdentifier) {\n const { trackerLayer, setCenter } = this.props;\n\n const [trajectory] = trackerLayer.getVehicle((r) => {\n return r.routeIdentifier === routeIdentifier;\n });\n const firstCoord = trajectory && trajectory.coordinate;\n if (firstCoord) {\n setCenter(firstCoord);\n }\n }\n\n render() {\n const { className, title, active, children } = this.props;\n\n return (\n <div\n aria-label={title}\n className={`${className}${active ? ' rt-active' : ''}`}\n title={title}\n onClick={this.onClick}\n onKeyPress={(e) => {\n return e.which === 13 && this.onClick;\n }}\n role=\"button\"\n tabIndex={0}\n >\n {children}\n </div>\n );\n }\n}\n\nFollowButton.propTypes = propTypes;\nFollowButton.defaultProps = defaultProps;\n\nexport default FollowButton;\n"],"names":["const","super","this"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G,IAAI,CAAC;IAA5C;IAAW;IAAO;IAAQ,4BAAwB;AAC9D;AACA,IAAI,OAAO;AACX,MAAM,sBAAC,OAAG;AACV,QAAQ,cAAY,KAAM,EAClB,WAAW,MAAG,aAAY,MAAM,GAAG,YAAY,GAAG,IAAK,EACvD,OAAO,KAAM,EACb,SAAS,IAAI,CAAC,OAAQ,EACtB,qBAAY,CAAC,CAAC,EAAK;AAC3B,UAAU,OAAO,CAAC,CAAC,KAAK,KAAK,EAAE,IAAIE,MAAI,CAAC,OAAO,CAAC;AAChD,SAAU,EACF,MAAK,QAAQ,EACb,UAAU,IACX;AACP,QAAS,QAAS;AAClB,MAAM,CAAM;AACZ,KAAK,CAAC;AACN;;;EAhE2B,gBAiE1B;AACD;AACA,YAAY,CAAC,SAAS,GAAG,SAAS,CAAC;AACnC,YAAY,CAAC,YAAY,GAAG,YAAY,CAAC;AACzC;AACA,eAAe,YAAY,CAAC;"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/FollowButton/FollowButton.js"],
4
+ "sourcesContent": ["import React, { PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport { RealtimeLayer as TrackerLayer } from 'mobility-toolbox-js/ol';\n\nconst propTypes = {\n /**\n * CSS class of the follow button.\n */\n className: PropTypes.string,\n\n /**\n * Title.\n */\n title: PropTypes.string,\n\n /**\n * Line info route identifer.\n */\n routeIdentifier: PropTypes.string.isRequired,\n\n /**\n * Button is active.\n */\n active: PropTypes.bool.isRequired,\n\n /**\n * Function triggered on button click.\n */\n onClick: PropTypes.func.isRequired,\n\n /**\n * Trackerlayer.\n */\n trackerLayer: PropTypes.instanceOf(TrackerLayer).isRequired,\n\n /**\n * Function to set the map center, Used to follow a train.\n */\n setCenter: PropTypes.func.isRequired,\n\n /**\n * Children content of the button.\n */\n children: PropTypes.element.isRequired,\n};\n\nconst defaultProps = {\n className: 'rt-route-follow',\n title: 'Follow',\n};\n\n/**\n * Button enables the follow of a selected train.\n */\nclass FollowButton extends PureComponent {\n constructor() {\n super();\n this.onClick = this.onClick.bind(this);\n }\n\n componentDidUpdate(prevProps) {\n const { routeIdentifier, active, trackerLayer, onClick } = this.props;\n\n if (routeIdentifier !== prevProps.routeIdentifier) {\n onClick(false);\n }\n\n if (active !== prevProps.active) {\n if (active && trackerLayer) {\n this.centerOnTrajectory(routeIdentifier);\n this.updateInterval = window.setInterval(() => {\n this.centerOnTrajectory(routeIdentifier);\n }, 50);\n } else {\n clearInterval(this.updateInterval);\n }\n }\n }\n\n componentWillUnmount() {\n clearInterval(this.updateInterval);\n }\n\n onClick() {\n const { active, onClick } = this.props;\n onClick(!active);\n }\n\n centerOnTrajectory(routeIdentifier) {\n const { trackerLayer, setCenter } = this.props;\n\n const [trajectory] = trackerLayer.getVehicle((r) => {\n return r.routeIdentifier === routeIdentifier;\n });\n const firstCoord = trajectory && trajectory.coordinate;\n if (firstCoord) {\n setCenter(firstCoord);\n }\n }\n\n render() {\n const { className, title, active, children } = this.props;\n\n return (\n <div\n aria-label={title}\n className={`${className}${active ? ' rt-active' : ''}`}\n title={title}\n onClick={this.onClick}\n onKeyPress={(e) => {\n return e.which === 13 && this.onClick;\n }}\n role=\"button\"\n tabIndex={0}\n >\n {children}\n </div>\n );\n }\n}\n\nFollowButton.propTypes = propTypes;\nFollowButton.defaultProps = defaultProps;\n\nexport default FollowButton;\n"],
5
+ "mappings": "AAAA,OAAO,SAAS,qBAAqB;AACrC,OAAO,eAAe;AACtB,SAAS,iBAAiB,oBAAoB;AAE9C,MAAM,YAAY;AAAA,EAIhB,WAAW,UAAU;AAAA,EAKrB,OAAO,UAAU;AAAA,EAKjB,iBAAiB,UAAU,OAAO;AAAA,EAKlC,QAAQ,UAAU,KAAK;AAAA,EAKvB,SAAS,UAAU,KAAK;AAAA,EAKxB,cAAc,UAAU,WAAW,YAAY,EAAE;AAAA,EAKjD,WAAW,UAAU,KAAK;AAAA,EAK1B,UAAU,UAAU,QAAQ;AAC9B;AAEA,MAAM,eAAe;AAAA,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MACA,MAAK;AAAA,MACL,UAAU;AAAA,OAET,QACH;AAAA,EAEJ;AACF;AAEA,aAAa,YAAY;AACzB,aAAa,eAAe;AAE5B,eAAe;",
6
+ "names": []
7
+ }
@@ -1,3 +1 @@
1
- export { default } from './FollowButton';
2
-
3
- //# sourceMappingURL=index.js.map
1
+ export { default } from "./FollowButton";
@@ -1 +1,7 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/FollowButton/index.js"],"sourcesContent":["export { default } from './FollowButton';\n"],"names":[],"mappings":"AAAA,SAAS,OAAO,QAAQ,gBAAgB,CAAC;"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/FollowButton/index.js"],
4
+ "sourcesContent": ["export { default } from './FollowButton';\n"],
5
+ "mappings": "AAAA,wBAAwB;",
6
+ "names": []
7
+ }