react-spatial 1.5.4 → 1.5.5
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/components/BaseLayerSwitcher/BaseLayerSwitcher.js +94 -63
- package/components/BaseLayerSwitcher/BaseLayerSwitcher.js.map +1 -1
- package/components/BaseLayerSwitcher/index.js.map +1 -1
- package/components/BasicMap/BasicMap.js +60 -15
- package/components/BasicMap/BasicMap.js.map +2 -2
- package/components/BasicMap/index.js.map +1 -1
- package/components/CanvasSaveButton/CanvasSaveButton.js +93 -11
- package/components/CanvasSaveButton/CanvasSaveButton.js.map +1 -1
- package/components/CanvasSaveButton/index.js.map +1 -1
- package/components/Copyright/Copyright.js +19 -5
- package/components/Copyright/Copyright.js.map +1 -1
- package/components/Copyright/index.js.map +1 -1
- package/components/FeatureExportButton/FeatureExportButton.js +30 -12
- package/components/FeatureExportButton/FeatureExportButton.js.map +1 -1
- package/components/FeatureExportButton/index.js.map +1 -1
- package/components/FitExtent/FitExtent.js +24 -8
- package/components/FitExtent/FitExtent.js.map +1 -1
- package/components/FitExtent/index.js.map +1 -1
- package/components/Geolocation/Geolocation.js +47 -14
- package/components/Geolocation/Geolocation.js.map +1 -1
- package/components/Geolocation/index.js.map +1 -1
- package/components/LayerTree/LayerTree.js +155 -46
- package/components/LayerTree/LayerTree.js.map +1 -1
- package/components/LayerTree/index.js.map +1 -1
- package/components/MousePosition/MousePosition.js +48 -16
- package/components/MousePosition/MousePosition.js.map +1 -1
- package/components/MousePosition/index.js.map +1 -1
- package/components/NorthArrow/NorthArrow.js +21 -5
- package/components/NorthArrow/NorthArrow.js.map +1 -1
- package/components/NorthArrow/index.js.map +1 -1
- package/components/Overlay/Overlay.js +72 -44
- package/components/Overlay/Overlay.js.map +1 -1
- package/components/Overlay/index.js.map +1 -1
- package/components/Permalink/Permalink.js +37 -0
- package/components/Permalink/Permalink.js.map +1 -1
- package/components/Permalink/index.js.map +1 -1
- package/components/Popup/Popup.js +84 -33
- package/components/Popup/Popup.js.map +1 -1
- package/components/Popup/index.js.map +1 -1
- package/components/ResizeHandler/ResizeHandler.js +1 -0
- package/components/ResizeHandler/ResizeHandler.js.map +1 -1
- package/components/ResizeHandler/index.js.map +1 -1
- package/components/RouteSchedule/RouteSchedule.js +121 -76
- package/components/RouteSchedule/RouteSchedule.js.map +2 -2
- package/components/RouteSchedule/index.js.map +1 -1
- package/components/ScaleLine/ScaleLine.js +8 -5
- package/components/ScaleLine/ScaleLine.js.map +1 -1
- package/components/ScaleLine/index.js.map +1 -1
- package/components/StopsFinder/StopsFinder.js +96 -51
- package/components/StopsFinder/StopsFinder.js.map +1 -1
- package/components/StopsFinder/StopsFinderOption.js +2 -9
- package/components/StopsFinder/StopsFinderOption.js.map +1 -1
- package/components/StopsFinder/index.js.map +1 -1
- package/components/Zoom/Zoom.js +48 -29
- package/components/Zoom/Zoom.js.map +1 -1
- package/components/Zoom/index.js.map +1 -1
- package/package.json +32 -31
- package/propTypes.js +19 -1
- package/propTypes.js.map +2 -2
- package/utils/KML.js +8 -0
- package/utils/KML.js.map +1 -1
- package/utils/KMLFormat.js +32 -4
- package/utils/KMLFormat.js.map +1 -1
- package/utils/getPolygonPattern.js.map +1 -1
- package/utils/timeUtils.js.map +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import {
|
|
4
4
|
RealtimeLayer as TrackerLayer,
|
|
@@ -54,13 +54,9 @@ const defaultRenderStationImg = (stations, index, isStationPassed, isNotStation)
|
|
|
54
54
|
} else if (isNotStation) {
|
|
55
55
|
src = line.src || line;
|
|
56
56
|
}
|
|
57
|
-
return /* @__PURE__ */ React.createElement("img", {
|
|
58
|
-
src,
|
|
59
|
-
alt: "routeScheduleLine",
|
|
60
|
-
className: "rt-route-icon"
|
|
61
|
-
});
|
|
57
|
+
return /* @__PURE__ */ React.createElement("img", { src, alt: "routeScheduleLine", className: "rt-route-icon" });
|
|
62
58
|
};
|
|
63
|
-
const
|
|
59
|
+
const RouteStop = ({
|
|
64
60
|
lineInfos,
|
|
65
61
|
onStationClick,
|
|
66
62
|
trackerLayer,
|
|
@@ -69,11 +65,8 @@ const defaultRenderStation = ({
|
|
|
69
65
|
idx
|
|
70
66
|
}) => {
|
|
71
67
|
const {
|
|
72
|
-
stationId,
|
|
73
68
|
arrivalDelay,
|
|
74
69
|
departureDelay,
|
|
75
|
-
arrivalTime,
|
|
76
|
-
departureTime,
|
|
77
70
|
state,
|
|
78
71
|
stationName,
|
|
79
72
|
aimedArrivalTime,
|
|
@@ -83,42 +76,81 @@ const defaultRenderStation = ({
|
|
|
83
76
|
const { stations } = lineInfos;
|
|
84
77
|
const isFirstStation = idx === 0;
|
|
85
78
|
const isLastStation = idx === stations.length - 1;
|
|
86
|
-
const isStationPassed = isPassed(stop, trackerLayer.time, stations, idx);
|
|
87
79
|
const isNotStation = isNotStop(stop);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
80
|
+
const [isStationPassed, setIsStationPassed] = useState(
|
|
81
|
+
isPassed(stop, trackerLayer.time, stations, idx)
|
|
82
|
+
);
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
let timeout = null;
|
|
85
|
+
if (!isStationPassed && stop.state === "TIME_BASED") {
|
|
86
|
+
timeout = setInterval(() => {
|
|
87
|
+
setIsStationPassed(isPassed(stop, trackerLayer.time, stations, idx));
|
|
88
|
+
}, 2e4);
|
|
89
|
+
}
|
|
90
|
+
return () => {
|
|
91
|
+
clearInterval(timeout);
|
|
92
|
+
};
|
|
93
|
+
}, [stop, isStationPassed, trackerLayer, stations, idx]);
|
|
94
|
+
return /* @__PURE__ */ React.createElement(
|
|
95
|
+
"div",
|
|
96
|
+
{
|
|
97
|
+
role: "button",
|
|
98
|
+
className: [
|
|
99
|
+
"rt-route-station",
|
|
100
|
+
isStationPassed ? " rt-passed" : "",
|
|
101
|
+
isNotStation ? " rt-no-stop" : ""
|
|
102
|
+
].join(""),
|
|
103
|
+
onClick: (e) => {
|
|
104
|
+
return onStationClick(stop, e);
|
|
105
|
+
},
|
|
106
|
+
tabIndex: 0,
|
|
107
|
+
onKeyPress: (e) => {
|
|
108
|
+
return e.which === 13 && onStationClick(stop, e);
|
|
109
|
+
}
|
|
98
110
|
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
111
|
+
/* @__PURE__ */ React.createElement("div", { className: "rt-route-delay" }, typeof arrivalDelay === "undefined" || isFirstStation || cancelled ? "" : /* @__PURE__ */ React.createElement(
|
|
112
|
+
"span",
|
|
113
|
+
{
|
|
114
|
+
className: `rt-route-delay-arrival${` ${getDelayColor(
|
|
115
|
+
arrivalDelay
|
|
116
|
+
)}`}`
|
|
117
|
+
},
|
|
118
|
+
`+${getDelayString(arrivalDelay)}`
|
|
119
|
+
), typeof departureDelay === "undefined" || isLastStation || cancelled ? "" : /* @__PURE__ */ React.createElement(
|
|
120
|
+
"span",
|
|
121
|
+
{
|
|
122
|
+
className: `rt-route-delay-departure${` ${getDelayColor(
|
|
123
|
+
departureDelay
|
|
124
|
+
)}`}`
|
|
125
|
+
},
|
|
126
|
+
`+${getDelayString(departureDelay)}`
|
|
127
|
+
)),
|
|
128
|
+
/* @__PURE__ */ React.createElement("div", { className: "rt-route-times" }, /* @__PURE__ */ React.createElement(
|
|
129
|
+
"span",
|
|
130
|
+
{
|
|
131
|
+
className: `rt-route-time-arrival ${cancelled ? "rt-route-cancelled" : ""}`
|
|
132
|
+
},
|
|
133
|
+
getHoursAndMinutes(aimedArrivalTime)
|
|
134
|
+
), /* @__PURE__ */ React.createElement(
|
|
135
|
+
"span",
|
|
136
|
+
{
|
|
137
|
+
className: `rt-route-time-departure ${cancelled ? "rt-route-cancelled" : ""}`
|
|
138
|
+
},
|
|
139
|
+
getHoursAndMinutes(aimedDepartureTime)
|
|
140
|
+
)),
|
|
141
|
+
renderStationImg(stations, idx, isStationPassed, isNotStation),
|
|
142
|
+
/* @__PURE__ */ React.createElement("div", { className: cancelled ? "rt-route-cancelled" : "" }, stationName)
|
|
143
|
+
);
|
|
144
|
+
};
|
|
145
|
+
const defaultRenderStation = (props) => {
|
|
146
|
+
const { stationId, arrivalTime, departureTime, stationName } = props.stop;
|
|
147
|
+
return /* @__PURE__ */ React.createElement(
|
|
148
|
+
RouteStop,
|
|
149
|
+
{
|
|
150
|
+
key: (stationId || stationName) + arrivalTime + departureTime,
|
|
151
|
+
...props
|
|
102
152
|
}
|
|
103
|
-
|
|
104
|
-
className: "rt-route-delay"
|
|
105
|
-
}, typeof arrivalDelay === "undefined" || isFirstStation || cancelled ? "" : /* @__PURE__ */ React.createElement("span", {
|
|
106
|
-
className: `rt-route-delay-arrival${` ${getDelayColor(
|
|
107
|
-
arrivalDelay
|
|
108
|
-
)}`}`
|
|
109
|
-
}, `+${getDelayString(arrivalDelay)}`), typeof departureDelay === "undefined" || isLastStation || cancelled ? "" : /* @__PURE__ */ React.createElement("span", {
|
|
110
|
-
className: `rt-route-delay-departure${` ${getDelayColor(
|
|
111
|
-
departureDelay
|
|
112
|
-
)}`}`
|
|
113
|
-
}, `+${getDelayString(departureDelay)}`)), /* @__PURE__ */ React.createElement("div", {
|
|
114
|
-
className: "rt-route-times"
|
|
115
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
116
|
-
className: `rt-route-time-arrival ${cancelled ? "rt-route-cancelled" : ""}`
|
|
117
|
-
}, getHoursAndMinutes(aimedArrivalTime)), /* @__PURE__ */ React.createElement("span", {
|
|
118
|
-
className: `rt-route-time-departure ${cancelled ? "rt-route-cancelled" : ""}`
|
|
119
|
-
}, getHoursAndMinutes(aimedDepartureTime))), renderStationImg(stations, idx, isStationPassed, isNotStation), /* @__PURE__ */ React.createElement("div", {
|
|
120
|
-
className: cancelled ? "rt-route-cancelled" : ""
|
|
121
|
-
}, stationName));
|
|
153
|
+
);
|
|
122
154
|
};
|
|
123
155
|
const renderRouteIdentifier = ({ routeIdentifier, longName }) => {
|
|
124
156
|
if (routeIdentifier) {
|
|
@@ -140,55 +172,72 @@ const defaultRenderHeader = ({ lineInfos, renderHeaderButtons }) => {
|
|
|
140
172
|
routeIdentifier,
|
|
141
173
|
text_color: textColor
|
|
142
174
|
} = lineInfos;
|
|
143
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}, destination), /* @__PURE__ */ React.createElement("span", null, longName, renderRouteIdentifier(lineInfos))), /* @__PURE__ */ React.createElement("div", {
|
|
156
|
-
className: "rt-route-buttons"
|
|
157
|
-
}, renderHeaderButtons(routeIdentifier)));
|
|
175
|
+
return /* @__PURE__ */ React.createElement("div", { className: "rt-route-header" }, /* @__PURE__ */ React.createElement(
|
|
176
|
+
"span",
|
|
177
|
+
{
|
|
178
|
+
className: "rt-route-icon",
|
|
179
|
+
style: {
|
|
180
|
+
/* stylelint-disable-next-line value-keyword-case */
|
|
181
|
+
backgroundColor: stroke || getBgColor(type || vehicleType),
|
|
182
|
+
color: textColor || "black"
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
shortName
|
|
186
|
+
), /* @__PURE__ */ React.createElement("div", { className: "rt-route-title" }, /* @__PURE__ */ React.createElement("span", { className: "rt-route-name" }, destination), /* @__PURE__ */ React.createElement("span", null, longName, renderRouteIdentifier(lineInfos))), /* @__PURE__ */ React.createElement("div", { className: "rt-route-buttons" }, renderHeaderButtons(routeIdentifier)));
|
|
158
187
|
};
|
|
159
188
|
const defaultRenderFooter = (props) => {
|
|
160
189
|
const { lineInfos, renderCopyright } = props;
|
|
161
190
|
if (!lineInfos.operator && !lineInfos.publisher) {
|
|
162
191
|
return null;
|
|
163
192
|
}
|
|
164
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
165
|
-
className: "rt-route-footer"
|
|
166
|
-
}, renderCopyright({ ...props }));
|
|
193
|
+
return /* @__PURE__ */ React.createElement("div", { className: "rt-route-footer" }, renderCopyright({ ...props }));
|
|
167
194
|
};
|
|
168
195
|
const defaultRenderLink = (text, url) => {
|
|
169
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
170
|
-
className: "rt-route-copyright-link"
|
|
171
|
-
}, url ? /* @__PURE__ */ React.createElement("a", {
|
|
172
|
-
href: url,
|
|
173
|
-
target: "_blank",
|
|
174
|
-
rel: "noreferrer"
|
|
175
|
-
}, text) : /* @__PURE__ */ React.createElement(React.Fragment, null, text));
|
|
196
|
+
return /* @__PURE__ */ React.createElement("div", { className: "rt-route-copyright-link" }, url ? /* @__PURE__ */ React.createElement("a", { href: url, target: "_blank", rel: "noreferrer" }, text) : /* @__PURE__ */ React.createElement(React.Fragment, null, text));
|
|
176
197
|
};
|
|
177
198
|
const defaultRenderCopyright = ({ lineInfos }) => {
|
|
178
|
-
return /* @__PURE__ */ React.createElement("span", {
|
|
179
|
-
className: "rt-route-copyright"
|
|
180
|
-
}, lineInfos.operator && defaultRenderLink(lineInfos.operator, lineInfos.operatorUrl), lineInfos.operator && lineInfos.publisher && /* @__PURE__ */ React.createElement("span", null, "\xA0-\xA0"), lineInfos.publisher && defaultRenderLink(lineInfos.publisher, lineInfos.publisherUrl), lineInfos.license && /* @__PURE__ */ React.createElement("span", null, "\xA0("), lineInfos.license && defaultRenderLink(lineInfos.license, lineInfos.licenseUrl), lineInfos.license && ")");
|
|
199
|
+
return /* @__PURE__ */ React.createElement("span", { className: "rt-route-copyright" }, lineInfos.operator && defaultRenderLink(lineInfos.operator, lineInfos.operatorUrl), lineInfos.operator && lineInfos.publisher && /* @__PURE__ */ React.createElement("span", null, "\xA0-\xA0"), lineInfos.publisher && defaultRenderLink(lineInfos.publisher, lineInfos.publisherUrl), lineInfos.license && /* @__PURE__ */ React.createElement("span", null, "\xA0("), lineInfos.license && defaultRenderLink(lineInfos.license, lineInfos.licenseUrl), lineInfos.license && ")");
|
|
181
200
|
};
|
|
182
201
|
const propTypes = {
|
|
202
|
+
/**
|
|
203
|
+
* CSS class of the route schedule wrapper.
|
|
204
|
+
*/
|
|
183
205
|
className: PropTypes.string,
|
|
206
|
+
/**
|
|
207
|
+
* Trajectory stations informations.
|
|
208
|
+
*/
|
|
184
209
|
lineInfos: ReactTransitPropTypes.lineInfos,
|
|
210
|
+
/**
|
|
211
|
+
* Trackerlayer.
|
|
212
|
+
*/
|
|
185
213
|
trackerLayer: PropTypes.instanceOf(TrackerLayer).isRequired,
|
|
214
|
+
/**
|
|
215
|
+
* Render Header of the route scheduler.
|
|
216
|
+
*/
|
|
186
217
|
renderHeader: PropTypes.func,
|
|
218
|
+
/**
|
|
219
|
+
* Render Footer of the route scheduler.
|
|
220
|
+
*/
|
|
187
221
|
renderFooter: PropTypes.func,
|
|
222
|
+
/**
|
|
223
|
+
* Render Copyright of the route scheduler.
|
|
224
|
+
*/
|
|
188
225
|
renderCopyright: PropTypes.func,
|
|
226
|
+
/**
|
|
227
|
+
* Render the status of the station image.
|
|
228
|
+
*/
|
|
189
229
|
renderStationImg: PropTypes.func,
|
|
230
|
+
/**
|
|
231
|
+
* Render a station.
|
|
232
|
+
*/
|
|
190
233
|
renderStation: PropTypes.func,
|
|
234
|
+
/**
|
|
235
|
+
* Function triggered on station's click event.
|
|
236
|
+
*/
|
|
191
237
|
onStationClick: PropTypes.func,
|
|
238
|
+
/**
|
|
239
|
+
* Function to render header buttons.
|
|
240
|
+
*/
|
|
192
241
|
renderHeaderButtons: PropTypes.func
|
|
193
242
|
};
|
|
194
243
|
const defaultProps = {
|
|
@@ -210,11 +259,7 @@ function RouteSchedule(props) {
|
|
|
210
259
|
if (!lineInfos) {
|
|
211
260
|
return null;
|
|
212
261
|
}
|
|
213
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
214
|
-
className
|
|
215
|
-
}, renderHeader({ ...props }), /* @__PURE__ */ React.createElement("div", {
|
|
216
|
-
className: "rt-route-body"
|
|
217
|
-
}, lineInfos.stations.map((stop, idx) => {
|
|
262
|
+
return /* @__PURE__ */ React.createElement("div", { className }, renderHeader({ ...props }), /* @__PURE__ */ React.createElement("div", { className: "rt-route-body" }, lineInfos.stations.map((stop, idx) => {
|
|
218
263
|
return renderStation({ ...props, stop, idx });
|
|
219
264
|
})), renderFooter({ ...props }));
|
|
220
265
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/RouteSchedule/RouteSchedule.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable react/no-unused-prop-types */\n/* eslint-disable react/prop-types */\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport {\n RealtimeLayer as TrackerLayer,\n realtimeConfig,\n} from 'mobility-toolbox-js/ol';\nimport { getHoursAndMinutes, getDelayString } from '../../utils/timeUtils';\nimport ReactTransitPropTypes from '../../propTypes';\nimport firstStation from '../../images/RouteSchedule/firstStation.png';\nimport station from '../../images/RouteSchedule/station.png';\nimport lastStation from '../../images/RouteSchedule/lastStation.png';\nimport line from '../../images/RouteSchedule/line.png';\n\nconst { getBgColor } = realtimeConfig;\n\n/**\n * Returns a color class to display the delay.\n * @param {Number} time Delay time in milliseconds.\n */\nconst getDelayColor = (time) => {\n const secs = Math.round(((time / 1800 / 2) * 3600) / 1000);\n if (secs >= 3600) {\n return 'dark-red';\n }\n if (secs >= 500) {\n return 'middle-red';\n }\n if (secs >= 300) {\n return 'light-red';\n }\n if (secs >= 180) {\n return 'orange';\n }\n return 'green';\n};\n\n/**\n * Returns true if the train doesn't stop to the station.\n * @param {Object} stop Station information.\n */\nconst isNotStop = (stop) => {\n return !stop.arrivalTime && !stop.departureTime;\n};\n\n/**\n * Returns if the station has already been passed by the vehicule.\n * @param {Object} stop Station information.\n * @param {number} time The current time to test in ms.\n * @param {Array<Object>} stops the list of all stops of the train.\n * @param {idx} idx The index of the stop object in the stops array.\n */\nconst isPassed = (stop, time, stops, idx) => {\n // If the train doesn't stop to the stop object, we test if the stop just before has been passed or not.\n // if yes the current stop is considered as passed.\n if (isNotStop(stop)) {\n if (stops[idx - 1] && idx > 0) {\n return isPassed(stops[idx - 1], time, stops, idx);\n }\n return true;\n }\n\n // Sometimes stop.departureDelay is undefined.\n const timeToCompare = stop.aimedDepartureTime || stop.aimedArrivalTime || 0;\n let delayToCompare = stop.departureDelay || stop.arrivalDelay || 0;\n\n // It could happens that the delay is negative we simply ignores it.\n if (delayToCompare < 0) {\n delayToCompare = 0;\n }\n\n return timeToCompare + delayToCompare <= time;\n};\n\n/**\n * Returns an image for first, middle or last stations.\n * @param {Number} stations The stations list.\n * @param {Number} index Index of the station in the list.\n * @param {Boolean} isStationPassed If the train is already passed at this station.\n * @param {Boolean} isNotStation If the train doesn't stop to this station.\n */\nconst defaultRenderStationImg = (\n stations,\n index,\n isStationPassed,\n isNotStation,\n) => {\n const { length } = stations;\n let src = station.src || station;\n if (index === 0) {\n src = firstStation.src || firstStation;\n } else if (index === length - 1) {\n src = lastStation.src || lastStation;\n } else if (isNotStation) {\n src = line.src || line;\n }\n return <img src={src} alt=\"routeScheduleLine\" className=\"rt-route-icon\" />;\n};\n\nconst defaultRenderStation = ({\n lineInfos,\n onStationClick,\n trackerLayer,\n renderStationImg,\n stop,\n idx,\n}) => {\n const {\n stationId,\n arrivalDelay,\n departureDelay,\n arrivalTime,\n departureTime,\n state,\n stationName,\n aimedArrivalTime,\n aimedDepartureTime,\n } = stop;\n const cancelled = state === 'JOURNEY_CANCELLED' || state === 'STOP_CANCELLED';\n const { stations } = lineInfos;\n const isFirstStation = idx === 0;\n const isLastStation = idx === stations.length - 1;\n const isStationPassed = isPassed(stop, trackerLayer.time, stations, idx);\n const isNotStation = isNotStop(stop);\n return (\n <div\n // Train line can go in circle so begin and end have the same id,\n // using the time in the key should fix the issue.\n key={(stationId || stationName) + arrivalTime + departureTime}\n role=\"button\"\n className={[\n 'rt-route-station',\n isStationPassed ? ' rt-passed' : '',\n isNotStation ? ' rt-no-stop' : '',\n ].join('')}\n onClick={(e) => {\n return onStationClick(stop, e);\n }}\n tabIndex={0}\n onKeyPress={(e) => {\n return e.which === 13 && onStationClick(stop, e);\n }}\n >\n <div className=\"rt-route-delay\">\n {typeof arrivalDelay === 'undefined' || isFirstStation || cancelled ? (\n ''\n ) : (\n <span\n className={`rt-route-delay-arrival${` ${getDelayColor(\n arrivalDelay,\n )}`}`}\n >\n {`+${getDelayString(arrivalDelay)}`}\n </span>\n )}\n {typeof departureDelay === 'undefined' || isLastStation || cancelled ? (\n ''\n ) : (\n <span\n className={`rt-route-delay-departure${` ${getDelayColor(\n departureDelay,\n )}`}`}\n >\n {`+${getDelayString(departureDelay)}`}\n </span>\n )}\n </div>\n <div className=\"rt-route-times\">\n <span\n className={`rt-route-time-arrival ${\n cancelled ? 'rt-route-cancelled' : ''\n }`}\n >\n {getHoursAndMinutes(aimedArrivalTime)}\n </span>\n <span\n className={`rt-route-time-departure ${\n cancelled ? 'rt-route-cancelled' : ''\n }`}\n >\n {getHoursAndMinutes(aimedDepartureTime)}\n </span>\n </div>\n {renderStationImg(stations, idx, isStationPassed, isNotStation)}\n <div className={cancelled ? 'rt-route-cancelled' : ''}>{stationName}</div>\n </div>\n );\n};\n\nconst renderRouteIdentifier = ({ routeIdentifier, longName }) => {\n if (routeIdentifier) {\n // first part of the id, without leading zeros.\n const id = parseInt(routeIdentifier.split('.')[0], 10);\n if (!longName.includes(id)) {\n return ` (${id})`;\n }\n }\n return null;\n};\n\nconst defaultRenderHeader = ({ lineInfos, renderHeaderButtons }) => {\n const {\n type,\n vehicleType,\n shortName,\n longName,\n stroke,\n destination,\n routeIdentifier,\n text_color: textColor,\n } = lineInfos;\n return (\n <div className=\"rt-route-header\">\n <span\n className=\"rt-route-icon\"\n style={{\n /* stylelint-disable-next-line value-keyword-case */\n backgroundColor: stroke || getBgColor(type || vehicleType),\n color: textColor || 'black',\n }}\n >\n {shortName}\n </span>\n <div className=\"rt-route-title\">\n <span className=\"rt-route-name\">{destination}</span>\n <span>\n {longName}\n {renderRouteIdentifier(lineInfos)}\n </span>\n </div>\n <div className=\"rt-route-buttons\">\n {renderHeaderButtons(routeIdentifier)}\n </div>\n </div>\n );\n};\n\nconst defaultRenderFooter = (props) => {\n const { lineInfos, renderCopyright } = props;\n if (!lineInfos.operator && !lineInfos.publisher) {\n return null;\n }\n return <div className=\"rt-route-footer\">{renderCopyright({ ...props })}</div>;\n};\n\nconst defaultRenderLink = (text, url) => {\n return (\n <div className=\"rt-route-copyright-link\">\n {url ? (\n <a href={url} target=\"_blank\" rel=\"noreferrer\">\n {text}\n </a>\n ) : (\n <>{text}</>\n )}\n </div>\n );\n};\n\nconst defaultRenderCopyright = ({ lineInfos }) => {\n return (\n <span className=\"rt-route-copyright\">\n {lineInfos.operator &&\n defaultRenderLink(lineInfos.operator, lineInfos.operatorUrl)}\n {lineInfos.operator && lineInfos.publisher && <span> - </span>}\n {lineInfos.publisher &&\n defaultRenderLink(lineInfos.publisher, lineInfos.publisherUrl)}\n {lineInfos.license && <span> (</span>}\n {lineInfos.license &&\n defaultRenderLink(lineInfos.license, lineInfos.licenseUrl)}\n {lineInfos.license && ')'}\n </span>\n );\n};\n\nconst propTypes = {\n /**\n * CSS class of the route schedule wrapper.\n */\n className: PropTypes.string,\n\n /**\n * Trajectory stations informations.\n */\n lineInfos: ReactTransitPropTypes.lineInfos,\n\n /**\n * Trackerlayer.\n */\n trackerLayer: PropTypes.instanceOf(TrackerLayer).isRequired,\n\n /**\n * Render Header of the route scheduler.\n */\n renderHeader: PropTypes.func,\n\n /**\n * Render Footer of the route scheduler.\n */\n renderFooter: PropTypes.func,\n\n /**\n * Render Copyright of the route scheduler.\n */\n renderCopyright: PropTypes.func,\n\n /**\n * Render the status of the station image.\n */\n renderStationImg: PropTypes.func,\n\n /**\n * Render a station.\n */\n renderStation: PropTypes.func,\n\n /**\n * Function triggered on station's click event.\n */\n onStationClick: PropTypes.func,\n\n /**\n * Function to render header buttons.\n */\n renderHeaderButtons: PropTypes.func,\n};\n\nconst defaultProps = {\n className: 'rt-route-schedule',\n lineInfos: null,\n renderHeader: defaultRenderHeader,\n renderStation: defaultRenderStation,\n renderStationImg: defaultRenderStationImg,\n renderCopyright: defaultRenderCopyright,\n renderFooter: defaultRenderFooter,\n renderHeaderButtons: () => {\n return null;\n },\n onStationClick: () => {},\n};\n\n/**\n * RouteSchedule displays information, stops and punctuality about the clicked route.\n */\nfunction RouteSchedule(props) {\n const { lineInfos, className, renderStation, renderHeader, renderFooter } =\n props;\n\n if (!lineInfos) {\n return null;\n }\n\n return (\n <div className={className}>\n {renderHeader({ ...props })}\n <div className=\"rt-route-body\">\n {lineInfos.stations.map((stop, idx) => {\n return renderStation({ ...props, stop, idx });\n })}\n </div>\n {renderFooter({ ...props })}\n </div>\n );\n}\n\nRouteSchedule.propTypes = propTypes;\nRouteSchedule.defaultProps = defaultProps;\n\nexport default React.memo(RouteSchedule);\n"],
|
|
5
|
-
"mappings": "AAEA,OAAO,WAAW;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react/no-unused-prop-types */\n/* eslint-disable react/prop-types */\nimport React, { useEffect, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport {\n RealtimeLayer as TrackerLayer,\n realtimeConfig,\n} from 'mobility-toolbox-js/ol';\nimport { getHoursAndMinutes, getDelayString } from '../../utils/timeUtils';\nimport ReactTransitPropTypes from '../../propTypes';\nimport firstStation from '../../images/RouteSchedule/firstStation.png';\nimport station from '../../images/RouteSchedule/station.png';\nimport lastStation from '../../images/RouteSchedule/lastStation.png';\nimport line from '../../images/RouteSchedule/line.png';\n\nconst { getBgColor } = realtimeConfig;\n\n/**\n * Returns a color class to display the delay.\n * @param {Number} time Delay time in milliseconds.\n */\nconst getDelayColor = (time) => {\n const secs = Math.round(((time / 1800 / 2) * 3600) / 1000);\n if (secs >= 3600) {\n return 'dark-red';\n }\n if (secs >= 500) {\n return 'middle-red';\n }\n if (secs >= 300) {\n return 'light-red';\n }\n if (secs >= 180) {\n return 'orange';\n }\n return 'green';\n};\n\n/**\n * Returns true if the train doesn't stop to the station.\n * @param {Object} stop Station information.\n */\nconst isNotStop = (stop) => {\n return !stop.arrivalTime && !stop.departureTime;\n};\n\n/**\n * Returns if the station has already been passed by the vehicule.\n * @param {Object} stop Station information.\n * @param {number} time The current time to test in ms.\n * @param {Array<Object>} stops the list of all stops of the train.\n * @param {idx} idx The index of the stop object in the stops array.\n */\nconst isPassed = (stop, time, stops, idx) => {\n // If the train doesn't stop to the stop object, we test if the stop just before has been passed or not.\n // if yes the current stop is considered as passed.\n if (isNotStop(stop)) {\n if (stops[idx - 1] && idx > 0) {\n return isPassed(stops[idx - 1], time, stops, idx);\n }\n return true;\n }\n\n // Sometimes stop.departureDelay is undefined.\n const timeToCompare = stop.aimedDepartureTime || stop.aimedArrivalTime || 0;\n let delayToCompare = stop.departureDelay || stop.arrivalDelay || 0;\n\n // It could happens that the delay is negative we simply ignores it.\n if (delayToCompare < 0) {\n delayToCompare = 0;\n }\n\n return timeToCompare + delayToCompare <= time;\n};\n\n/**\n * Returns an image for first, middle or last stations.\n * @param {Number} stations The stations list.\n * @param {Number} index Index of the station in the list.\n * @param {Boolean} isStationPassed If the train is already passed at this station.\n * @param {Boolean} isNotStation If the train doesn't stop to this station.\n */\nconst defaultRenderStationImg = (\n stations,\n index,\n isStationPassed,\n isNotStation,\n) => {\n const { length } = stations;\n let src = station.src || station;\n if (index === 0) {\n src = firstStation.src || firstStation;\n } else if (index === length - 1) {\n src = lastStation.src || lastStation;\n } else if (isNotStation) {\n src = line.src || line;\n }\n return <img src={src} alt=\"routeScheduleLine\" className=\"rt-route-icon\" />;\n};\n\nconst RouteStop = ({\n lineInfos,\n onStationClick,\n trackerLayer,\n renderStationImg,\n stop,\n idx,\n}) => {\n const {\n arrivalDelay,\n departureDelay,\n state,\n stationName,\n aimedArrivalTime,\n aimedDepartureTime,\n } = stop;\n const cancelled = state === 'JOURNEY_CANCELLED' || state === 'STOP_CANCELLED';\n const { stations } = lineInfos;\n const isFirstStation = idx === 0;\n const isLastStation = idx === stations.length - 1;\n const isNotStation = isNotStop(stop);\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const [isStationPassed, setIsStationPassed] = useState(\n isPassed(stop, trackerLayer.time, stations, idx),\n );\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n let timeout = null;\n // We have to refresh the stop when the state it's time_based\n if (!isStationPassed && stop.state === 'TIME_BASED') {\n timeout = setInterval(() => {\n setIsStationPassed(isPassed(stop, trackerLayer.time, stations, idx));\n }, 20000);\n }\n return () => {\n clearInterval(timeout);\n };\n }, [stop, isStationPassed, trackerLayer, stations, idx]);\n\n return (\n <div\n role=\"button\"\n className={[\n 'rt-route-station',\n isStationPassed ? ' rt-passed' : '',\n isNotStation ? ' rt-no-stop' : '',\n ].join('')}\n onClick={(e) => {\n return onStationClick(stop, e);\n }}\n tabIndex={0}\n onKeyPress={(e) => {\n return e.which === 13 && onStationClick(stop, e);\n }}\n >\n <div className=\"rt-route-delay\">\n {typeof arrivalDelay === 'undefined' || isFirstStation || cancelled ? (\n ''\n ) : (\n <span\n className={`rt-route-delay-arrival${` ${getDelayColor(\n arrivalDelay,\n )}`}`}\n >\n {`+${getDelayString(arrivalDelay)}`}\n </span>\n )}\n {typeof departureDelay === 'undefined' || isLastStation || cancelled ? (\n ''\n ) : (\n <span\n className={`rt-route-delay-departure${` ${getDelayColor(\n departureDelay,\n )}`}`}\n >\n {`+${getDelayString(departureDelay)}`}\n </span>\n )}\n </div>\n <div className=\"rt-route-times\">\n <span\n className={`rt-route-time-arrival ${\n cancelled ? 'rt-route-cancelled' : ''\n }`}\n >\n {getHoursAndMinutes(aimedArrivalTime)}\n </span>\n <span\n className={`rt-route-time-departure ${\n cancelled ? 'rt-route-cancelled' : ''\n }`}\n >\n {getHoursAndMinutes(aimedDepartureTime)}\n </span>\n </div>\n {renderStationImg(stations, idx, isStationPassed, isNotStation)}\n <div className={cancelled ? 'rt-route-cancelled' : ''}>{stationName}</div>\n </div>\n );\n};\n\nconst defaultRenderStation = (props) => {\n const { stationId, arrivalTime, departureTime, stationName } = props.stop;\n // eslint-disable-next-line react/jsx-props-no-spreading\n return (\n <RouteStop\n // Train line can go in circle so begin and end have the same id,\n // using the time in the key should fix the issue.\n key={(stationId || stationName) + arrivalTime + departureTime}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n />\n );\n};\n\nconst renderRouteIdentifier = ({ routeIdentifier, longName }) => {\n if (routeIdentifier) {\n // first part of the id, without leading zeros.\n const id = parseInt(routeIdentifier.split('.')[0], 10);\n if (!longName.includes(id)) {\n return ` (${id})`;\n }\n }\n return null;\n};\n\nconst defaultRenderHeader = ({ lineInfos, renderHeaderButtons }) => {\n const {\n type,\n vehicleType,\n shortName,\n longName,\n stroke,\n destination,\n routeIdentifier,\n text_color: textColor,\n } = lineInfos;\n return (\n <div className=\"rt-route-header\">\n <span\n className=\"rt-route-icon\"\n style={{\n /* stylelint-disable-next-line value-keyword-case */\n backgroundColor: stroke || getBgColor(type || vehicleType),\n color: textColor || 'black',\n }}\n >\n {shortName}\n </span>\n <div className=\"rt-route-title\">\n <span className=\"rt-route-name\">{destination}</span>\n <span>\n {longName}\n {renderRouteIdentifier(lineInfos)}\n </span>\n </div>\n <div className=\"rt-route-buttons\">\n {renderHeaderButtons(routeIdentifier)}\n </div>\n </div>\n );\n};\n\nconst defaultRenderFooter = (props) => {\n const { lineInfos, renderCopyright } = props;\n if (!lineInfos.operator && !lineInfos.publisher) {\n return null;\n }\n return <div className=\"rt-route-footer\">{renderCopyright({ ...props })}</div>;\n};\n\nconst defaultRenderLink = (text, url) => {\n return (\n <div className=\"rt-route-copyright-link\">\n {url ? (\n <a href={url} target=\"_blank\" rel=\"noreferrer\">\n {text}\n </a>\n ) : (\n <>{text}</>\n )}\n </div>\n );\n};\n\nconst defaultRenderCopyright = ({ lineInfos }) => {\n return (\n <span className=\"rt-route-copyright\">\n {lineInfos.operator &&\n defaultRenderLink(lineInfos.operator, lineInfos.operatorUrl)}\n {lineInfos.operator && lineInfos.publisher && <span> - </span>}\n {lineInfos.publisher &&\n defaultRenderLink(lineInfos.publisher, lineInfos.publisherUrl)}\n {lineInfos.license && <span> (</span>}\n {lineInfos.license &&\n defaultRenderLink(lineInfos.license, lineInfos.licenseUrl)}\n {lineInfos.license && ')'}\n </span>\n );\n};\n\nconst propTypes = {\n /**\n * CSS class of the route schedule wrapper.\n */\n className: PropTypes.string,\n\n /**\n * Trajectory stations informations.\n */\n lineInfos: ReactTransitPropTypes.lineInfos,\n\n /**\n * Trackerlayer.\n */\n trackerLayer: PropTypes.instanceOf(TrackerLayer).isRequired,\n\n /**\n * Render Header of the route scheduler.\n */\n renderHeader: PropTypes.func,\n\n /**\n * Render Footer of the route scheduler.\n */\n renderFooter: PropTypes.func,\n\n /**\n * Render Copyright of the route scheduler.\n */\n renderCopyright: PropTypes.func,\n\n /**\n * Render the status of the station image.\n */\n renderStationImg: PropTypes.func,\n\n /**\n * Render a station.\n */\n renderStation: PropTypes.func,\n\n /**\n * Function triggered on station's click event.\n */\n onStationClick: PropTypes.func,\n\n /**\n * Function to render header buttons.\n */\n renderHeaderButtons: PropTypes.func,\n};\n\nconst defaultProps = {\n className: 'rt-route-schedule',\n lineInfos: null,\n renderHeader: defaultRenderHeader,\n renderStation: defaultRenderStation,\n renderStationImg: defaultRenderStationImg,\n renderCopyright: defaultRenderCopyright,\n renderFooter: defaultRenderFooter,\n renderHeaderButtons: () => {\n return null;\n },\n onStationClick: () => {},\n};\n\n/**\n * RouteSchedule displays information, stops and punctuality about the clicked route.\n */\nfunction RouteSchedule(props) {\n const { lineInfos, className, renderStation, renderHeader, renderFooter } =\n props;\n\n if (!lineInfos) {\n return null;\n }\n\n return (\n <div className={className}>\n {renderHeader({ ...props })}\n <div className=\"rt-route-body\">\n {lineInfos.stations.map((stop, idx) => {\n return renderStation({ ...props, stop, idx });\n })}\n </div>\n {renderFooter({ ...props })}\n </div>\n );\n}\n\nRouteSchedule.propTypes = propTypes;\nRouteSchedule.defaultProps = defaultProps;\n\nexport default React.memo(RouteSchedule);\n"],
|
|
5
|
+
"mappings": "AAEA,OAAO,SAAS,WAAW,gBAAgB;AAC3C,OAAO,eAAe;AACtB;AAAA,EACE,iBAAiB;AAAA,EACjB;AAAA,OACK;AACP,SAAS,oBAAoB,sBAAsB;AACnD,OAAO,2BAA2B;AAClC,OAAO,kBAAkB;AACzB,OAAO,aAAa;AACpB,OAAO,iBAAiB;AACxB,OAAO,UAAU;AAEjB,MAAM,EAAE,WAAW,IAAI;AAMvB,MAAM,gBAAgB,CAAC,SAAS;AAC9B,QAAM,OAAO,KAAK,MAAQ,OAAO,OAAO,IAAK,OAAQ,GAAI;AACzD,MAAI,QAAQ,MAAM;AAChB,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,KAAK;AACf,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,KAAK;AACf,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,KAAK;AACf,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAMA,MAAM,YAAY,CAAC,SAAS;AAC1B,SAAO,CAAC,KAAK,eAAe,CAAC,KAAK;AACpC;AASA,MAAM,WAAW,CAAC,MAAM,MAAM,OAAO,QAAQ;AAG3C,MAAI,UAAU,IAAI,GAAG;AACnB,QAAI,MAAM,MAAM,CAAC,KAAK,MAAM,GAAG;AAC7B,aAAO,SAAS,MAAM,MAAM,CAAC,GAAG,MAAM,OAAO,GAAG;AAAA,IAClD;AACA,WAAO;AAAA,EACT;AAGA,QAAM,gBAAgB,KAAK,sBAAsB,KAAK,oBAAoB;AAC1E,MAAI,iBAAiB,KAAK,kBAAkB,KAAK,gBAAgB;AAGjE,MAAI,iBAAiB,GAAG;AACtB,qBAAiB;AAAA,E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GAAG,MAAM,CAAC,GAC1B,oCAAC,SAAI,WAAU,mBACZ,UAAU,SAAS,IAAI,CAAC,MAAM,QAAQ;AACrC,WAAO,cAAc,EAAE,GAAG,OAAO,MAAM,IAAI,CAAC;AAAA,EAC9C,CAAC,CACH,GACC,aAAa,EAAE,GAAG,MAAM,CAAC,CAC5B;AAEJ;AAEA,cAAc,YAAY;AAC1B,cAAc,eAAe;AAE7B,eAAe,MAAM,KAAK,aAAa;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,7 +3,14 @@ import PropTypes from "prop-types";
|
|
|
3
3
|
import OLScaleLine from "ol/control/ScaleLine";
|
|
4
4
|
import OLMap from "ol/Map";
|
|
5
5
|
const propTypes = {
|
|
6
|
+
/**
|
|
7
|
+
* ol/map.
|
|
8
|
+
*/
|
|
6
9
|
map: PropTypes.instanceOf(OLMap).isRequired,
|
|
10
|
+
/**
|
|
11
|
+
* Options for ol/control/ScaleLine.
|
|
12
|
+
* See https://openlayers.org/en/latest/apidoc/module-ol_control_ScaleLine-ScaleLine.html
|
|
13
|
+
*/
|
|
7
14
|
options: PropTypes.object
|
|
8
15
|
};
|
|
9
16
|
const defaultProps = {
|
|
@@ -21,11 +28,7 @@ function ScaleLine({ map, options, ...other }) {
|
|
|
21
28
|
map.removeControl(control);
|
|
22
29
|
};
|
|
23
30
|
}, [map, options]);
|
|
24
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
25
|
-
className: "rs-scale-line",
|
|
26
|
-
ref,
|
|
27
|
-
...other
|
|
28
|
-
});
|
|
31
|
+
return /* @__PURE__ */ React.createElement("div", { className: "rs-scale-line", ref, ...other });
|
|
29
32
|
}
|
|
30
33
|
ScaleLine.propTypes = propTypes;
|
|
31
34
|
ScaleLine.defaultProps = defaultProps;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/ScaleLine/ScaleLine.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useRef, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport OLScaleLine from 'ol/control/ScaleLine';\nimport OLMap from 'ol/Map';\n\nconst propTypes = {\n /**\n * ol/map.\n */\n map: PropTypes.instanceOf(OLMap).isRequired,\n\n /**\n * Options for ol/control/ScaleLine.\n * See https://openlayers.org/en/latest/apidoc/module-ol_control_ScaleLine-ScaleLine.html\n */\n options: PropTypes.object,\n};\n\nconst defaultProps = {\n options: {},\n};\n\n/**\n * The ScaleLine component creates an\n * [ol/control/ScaleLine](https://openlayers.org/en/latest/apidoc/module-ol_control_ScaleLine-ScaleLine.html)\n * for an [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\nfunction ScaleLine({ map, options, ...other }) {\n const ref = useRef();\n\n useEffect(() => {\n const control = new OLScaleLine({\n ...options,\n ...{ target: ref.current },\n });\n\n map.addControl(control);\n return () => {\n map.removeControl(control);\n };\n }, [map, options]);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return <div className=\"rs-scale-line\" ref={ref} {...other} />;\n}\n\nScaleLine.propTypes = propTypes;\nScaleLine.defaultProps = defaultProps;\n\nexport default React.memo(ScaleLine);\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,SAAS,QAAQ,iBAAiB;AACzC,OAAO,eAAe;AACtB,OAAO,iBAAiB;AACxB,OAAO,WAAW;AAElB,MAAM,YAAY;AAAA,EAIhB,KAAK,UAAU,WAAW,KAAK,EAAE;AAAA,EAMjC,SAAS,UAAU;AACrB;AAEA,MAAM,eAAe;AAAA,EACnB,SAAS,CAAC;AACZ;AAOA,SAAS,UAAU,EAAE,KAAK,
|
|
5
|
+
"mappings": "AAAA,OAAO,SAAS,QAAQ,iBAAiB;AACzC,OAAO,eAAe;AACtB,OAAO,iBAAiB;AACxB,OAAO,WAAW;AAElB,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA,EAIhB,KAAK,UAAU,WAAW,KAAK,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA,EAMjC,SAAS,UAAU;AACrB;AAEA,MAAM,eAAe;AAAA,EACnB,SAAS,CAAC;AACZ;AAOA,SAAS,UAAU,EAAE,KAAK,SAAS,GAAG,MAAM,GAAG;AAC7C,QAAM,MAAM,OAAO;AAEnB,YAAU,MAAM;AACd,UAAM,UAAU,IAAI,YAAY;AAAA,MAC9B,GAAG;AAAA,MACH,GAAG,EAAE,QAAQ,IAAI,QAAQ;AAAA,IAC3B,CAAC;AAED,QAAI,WAAW,OAAO;AACtB,WAAO,MAAM;AACX,UAAI,cAAc,OAAO;AAAA,IAC3B;AAAA,EACF,GAAG,CAAC,KAAK,OAAO,CAAC;AAGjB,SAAO,oCAAC,SAAI,WAAU,iBAAgB,KAAW,GAAG,OAAO;AAC7D;AAEA,UAAU,YAAY;AACtB,UAAU,eAAe;AAEzB,eAAe,MAAM,KAAK,SAAS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -109,88 +109,133 @@ function StopsFinder({
|
|
|
109
109
|
};
|
|
110
110
|
const autocProps = { ...autocompleteProps };
|
|
111
111
|
delete autocProps.textFieldProps;
|
|
112
|
-
return /* @__PURE__ */ React.createElement(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
popupIcon: /* @__PURE__ */ React.createElement(FaSearch, {
|
|
126
|
-
focusable: false,
|
|
127
|
-
size: 15
|
|
128
|
-
}),
|
|
129
|
-
renderInput: (params) => {
|
|
130
|
-
return /* @__PURE__ */ React.createElement(TextField, {
|
|
131
|
-
label: "Search stops",
|
|
132
|
-
...{
|
|
133
|
-
...params,
|
|
134
|
-
...textFieldProps
|
|
135
|
-
},
|
|
136
|
-
InputProps: {
|
|
137
|
-
...params.InputProps,
|
|
138
|
-
endAdornment: /* @__PURE__ */ React.createElement(React.Fragment, null, isLoading && /* @__PURE__ */ React.createElement(CircularProgress, {
|
|
139
|
-
size: 20
|
|
140
|
-
}), params.InputProps.endAdornment)
|
|
112
|
+
return /* @__PURE__ */ React.createElement(
|
|
113
|
+
Autocomplete,
|
|
114
|
+
{
|
|
115
|
+
fullWidth: true,
|
|
116
|
+
autoComplete: true,
|
|
117
|
+
autoHighlight: true,
|
|
118
|
+
selectOnFocus: true,
|
|
119
|
+
getOptionLabel: (option) => {
|
|
120
|
+
return option.properties.name;
|
|
121
|
+
},
|
|
122
|
+
onChange: (evt, value, reason) => {
|
|
123
|
+
if (onSelect && reason === "select-option") {
|
|
124
|
+
onSelect(value, evt);
|
|
141
125
|
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
126
|
+
},
|
|
127
|
+
popupIcon: /* @__PURE__ */ React.createElement(FaSearch, { focusable: false, size: 15 }),
|
|
128
|
+
renderInput: (params) => {
|
|
129
|
+
return /* @__PURE__ */ React.createElement(
|
|
130
|
+
TextField,
|
|
131
|
+
{
|
|
132
|
+
label: "Search stops",
|
|
133
|
+
...{
|
|
134
|
+
...params,
|
|
135
|
+
...textFieldProps
|
|
136
|
+
},
|
|
137
|
+
InputProps: {
|
|
138
|
+
...params.InputProps,
|
|
139
|
+
endAdornment: /* @__PURE__ */ React.createElement(React.Fragment, null, isLoading && /* @__PURE__ */ React.createElement(CircularProgress, { size: 20 }), params.InputProps.endAdornment)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
},
|
|
144
|
+
renderOption: (option) => {
|
|
145
|
+
return /* @__PURE__ */ React.createElement(StopsFinderOptions, { option });
|
|
146
|
+
},
|
|
147
|
+
...autocProps,
|
|
148
|
+
classes: { ...classes, ...autocompleteProps.classes },
|
|
149
|
+
inputValue,
|
|
150
|
+
open: isOpen,
|
|
151
|
+
options: suggestions,
|
|
152
|
+
loading: isLoading,
|
|
153
|
+
onOpen: () => {
|
|
154
|
+
setOpen(true);
|
|
155
|
+
},
|
|
156
|
+
onClose: () => {
|
|
157
|
+
setOpen(false);
|
|
158
|
+
},
|
|
159
|
+
onInputChange: (evt, val) => {
|
|
160
|
+
setInputValue(val);
|
|
161
|
+
}
|
|
163
162
|
}
|
|
164
|
-
|
|
163
|
+
);
|
|
165
164
|
}
|
|
166
165
|
StopsFinder.propTypes = {
|
|
166
|
+
/**
|
|
167
|
+
* Array or a comma separated list of agencies which should be available.
|
|
168
|
+
* Order of these agencies chooses which agency will be preferred.
|
|
169
|
+
* Available values : sbb, db
|
|
170
|
+
*/
|
|
167
171
|
agencies: PropTypes.oneOfType([
|
|
168
172
|
PropTypes.string,
|
|
169
173
|
PropTypes.arrayOf(PropTypes.string)
|
|
170
174
|
]),
|
|
175
|
+
/**
|
|
176
|
+
* geOps api key to access the StopsFinder service.
|
|
177
|
+
*/
|
|
171
178
|
apiKey: PropTypes.string,
|
|
179
|
+
/**
|
|
180
|
+
* Properties apply to the default [MUI Autocomplete component](https://material-ui.com/api/autocomplete/).
|
|
181
|
+
* We add a custom properties textFieldProps for the default [MUI TextField component](https://material-ui.com/api/text-field/) used by the Autocomplete.
|
|
182
|
+
*/
|
|
172
183
|
autocompleteProps: PropTypes.object,
|
|
184
|
+
/**
|
|
185
|
+
* minX,minY,maxX,maxY coordinates in WGS84 wherein the station should lie.
|
|
186
|
+
*/
|
|
173
187
|
bbox: PropTypes.oneOfType([
|
|
174
188
|
PropTypes.string,
|
|
175
189
|
PropTypes.arrayOf(PropTypes.number)
|
|
176
190
|
]),
|
|
191
|
+
/**
|
|
192
|
+
* Array or a comma separated list of fields which should be used for look up.
|
|
193
|
+
* Available values : id, name, coords
|
|
194
|
+
*/
|
|
177
195
|
field: PropTypes.oneOfType([
|
|
178
196
|
PropTypes.string,
|
|
179
197
|
PropTypes.arrayOf(PropTypes.string)
|
|
180
198
|
]),
|
|
199
|
+
/**
|
|
200
|
+
* Control how many matches will be returned.
|
|
201
|
+
*/
|
|
181
202
|
limit: PropTypes.number,
|
|
203
|
+
/**
|
|
204
|
+
* A map.
|
|
205
|
+
*/
|
|
182
206
|
map: PropTypes.instanceOf(Map).isRequired,
|
|
207
|
+
/**
|
|
208
|
+
* Array or a comma separated list of mode of transpaorts which should be available.
|
|
209
|
+
* Available values : bus, ferry, gondola, tram, rail, funicular, cable_car, subway
|
|
210
|
+
*/
|
|
183
211
|
mots: PropTypes.oneOfType([
|
|
184
212
|
PropTypes.string,
|
|
185
213
|
PropTypes.arrayOf(PropTypes.string)
|
|
186
214
|
]),
|
|
215
|
+
/**
|
|
216
|
+
* Function called when a suggestion is selected.
|
|
217
|
+
*/
|
|
187
218
|
onSelect: PropTypes.func,
|
|
219
|
+
/**
|
|
220
|
+
* Radius around refLocation in meters that is most relevant.
|
|
221
|
+
* Used as granularity for location rank.
|
|
222
|
+
*/
|
|
188
223
|
radius: PropTypes.number,
|
|
224
|
+
/**
|
|
225
|
+
* Coordinates in WGS84 (in lat,lon order) used to rank stops close to this position higher.
|
|
226
|
+
* Available values : id, name, coords
|
|
227
|
+
*/
|
|
189
228
|
refLocation: PropTypes.oneOfType([
|
|
190
229
|
PropTypes.string,
|
|
191
230
|
PropTypes.arrayOf(PropTypes.number)
|
|
192
231
|
]),
|
|
232
|
+
/**
|
|
233
|
+
* Function to render a different autocomplete input than the default one.
|
|
234
|
+
*/
|
|
193
235
|
renderAutocomplete: PropTypes.func,
|
|
236
|
+
/**
|
|
237
|
+
* Url of the geOps StopsFinder service.
|
|
238
|
+
*/
|
|
194
239
|
url: PropTypes.string
|
|
195
240
|
};
|
|
196
241
|
StopsFinder.defaultProps = {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/StopsFinder/StopsFinder.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useMemo, useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { Autocomplete } from '@material-ui/lab';\nimport { FaSearch } from 'react-icons/fa';\nimport TextField from '@material-ui/core/TextField';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport { StopFinderControl } from 'mobility-toolbox-js/ol';\nimport { Map } from 'ol';\nimport { makeStyles } from '@material-ui/core';\nimport StopsFinderOptions from './StopsFinderOption';\n\nconst useStyles = makeStyles(() => {\n return {\n popupIndicatorOpen: {\n transform: 'rotate(0)',\n },\n };\n});\n\nfunction StopsFinder({\n agencies,\n apiKey,\n autocompleteProps,\n bbox,\n field,\n limit,\n map,\n mots,\n onSelect,\n radius,\n refLocation,\n renderAutocomplete,\n url,\n}) {\n const classes = useStyles();\n const [inputValue, setInputValue] = useState('');\n const [suggestions, setSuggestions] = useState([]);\n const [isLoading, setLoading] = useState(false);\n const [isOpen, setOpen] = useState(false);\n\n const control = useMemo(() => {\n return new StopFinderControl({\n url,\n apiKey,\n target: document.createElement('div'),\n element: document.createElement('div'),\n render(newSuggestions = { features: [] }) {\n setSuggestions(newSuggestions.features);\n setLoading(false);\n },\n });\n }, [apiKey, url]);\n\n useEffect(() => {\n if (!inputValue) {\n setSuggestions([]);\n setLoading(false);\n return () => {};\n }\n const abortController = new AbortController();\n setLoading(true);\n control.apiParams = {\n prefAgencies: agencies && agencies.toString(),\n bbox: bbox && bbox.toString(),\n field: field && field.toString(),\n limit,\n mots: mots && mots.toString(),\n radius,\n ref_location: refLocation && refLocation.toString(),\n };\n control.search(inputValue, abortController);\n return () => {\n abortController.abort();\n };\n }, [\n agencies,\n bbox,\n control,\n field,\n inputValue,\n limit,\n mots,\n radius,\n refLocation,\n ]);\n\n // Ensure the control is not associated to the wrong map\n useEffect(() => {\n if (!control) {\n return () => {};\n }\n\n control.map = map;\n\n return () => {\n control.map = null;\n };\n }, [map, control]);\n\n if (!control) {\n return null;\n }\n\n if (renderAutocomplete) {\n return renderAutocomplete(\n suggestions,\n inputValue,\n setInputValue,\n isOpen,\n setOpen,\n isLoading,\n setLoading,\n );\n }\n const textFieldProps = {\n ...((autocompleteProps || {}).textFieldProps || {}),\n };\n const autocProps = { ...autocompleteProps };\n delete autocProps.textFieldProps;\n\n return (\n <Autocomplete\n fullWidth\n autoComplete\n autoHighlight\n selectOnFocus\n getOptionLabel={(option) => {\n return option.properties.name;\n }}\n onChange={(evt, value, reason) => {\n if (onSelect && reason === 'select-option') {\n onSelect(value, evt);\n }\n }}\n popupIcon={<FaSearch focusable={false} size={15} />}\n renderInput={(params) => {\n return (\n <TextField\n label=\"Search stops\"\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...{\n ...params,\n ...textFieldProps,\n }}\n InputProps={{\n ...params.InputProps,\n endAdornment: (\n <>\n {isLoading && <CircularProgress size={20} />}\n {params.InputProps.endAdornment}\n </>\n ),\n }}\n />\n );\n }}\n renderOption={(option) => {\n return <StopsFinderOptions option={option} />;\n }}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...autocProps}\n classes={{ ...classes, ...autocompleteProps.classes }}\n inputValue={inputValue}\n open={isOpen}\n options={suggestions}\n loading={isLoading}\n onOpen={() => {\n setOpen(true);\n }}\n onClose={() => {\n setOpen(false);\n }}\n onInputChange={(evt, val) => {\n setInputValue(val);\n }}\n />\n );\n}\n\nStopsFinder.propTypes = {\n /**\n * Array or a comma separated list of agencies which should be available.\n * Order of these agencies chooses which agency will be preferred.\n * Available values : sbb, db\n */\n agencies: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.arrayOf(PropTypes.string),\n ]),\n\n /**\n * geOps api key to access the StopsFinder service.\n */\n apiKey: PropTypes.string,\n\n /**\n * Properties apply to the default [MUI Autocomplete component](https://material-ui.com/api/autocomplete/).\n * We add a custom properties textFieldProps for the default [MUI TextField component](https://material-ui.com/api/text-field/) used by the Autocomplete.\n */\n autocompleteProps: PropTypes.object,\n\n /**\n * minX,minY,maxX,maxY coordinates in WGS84 wherein the station should lie.\n */\n bbox: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.arrayOf(PropTypes.number),\n ]),\n\n /**\n * Array or a comma separated list of fields which should be used for look up.\n * Available values : id, name, coords\n */\n field: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.arrayOf(PropTypes.string),\n ]),\n\n /**\n * Control how many matches will be returned.\n */\n limit: PropTypes.number,\n\n /**\n * A map.\n */\n map: PropTypes.instanceOf(Map).isRequired,\n\n /**\n * Array or a comma separated list of mode of transpaorts which should be available.\n * Available values : bus, ferry, gondola, tram, rail, funicular, cable_car, subway\n */\n mots: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.arrayOf(PropTypes.string),\n ]),\n\n /**\n * Function called when a suggestion is selected.\n */\n onSelect: PropTypes.func,\n\n /**\n * Radius around refLocation in meters that is most relevant.\n * Used as granularity for location rank.\n */\n radius: PropTypes.number,\n\n /**\n * Coordinates in WGS84 (in lat,lon order) used to rank stops close to this position higher.\n * Available values : id, name, coords\n */\n refLocation: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.arrayOf(PropTypes.number),\n ]),\n\n /**\n * Function to render a different autocomplete input than the default one.\n */\n renderAutocomplete: PropTypes.func,\n\n /**\n * Url of the geOps StopsFinder service.\n */\n url: PropTypes.string,\n};\n\nStopsFinder.defaultProps = {\n agencies: null,\n apiKey: null,\n autocompleteProps: {},\n bbox: null,\n field: null,\n limit: null,\n mots: null,\n onSelect: null,\n radius: null,\n refLocation: null,\n url: null,\n renderAutocomplete: null,\n};\n\nexport default StopsFinder;\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,SAAS,SAAS,UAAU,iBAAiB;AACpD,OAAO,eAAe;AACtB,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AACzB,OAAO,eAAe;AACtB,OAAO,sBAAsB;AAC7B,SAAS,yBAAyB;AAClC,SAAS,WAAW;AACpB,SAAS,kBAAkB;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