react-spatial 1.12.0 → 1.12.1
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 +51 -51
- package/components/BaseLayerSwitcher/BaseLayerSwitcher.js.map +2 -2
- package/components/BasicMap/BasicMap.js +80 -80
- package/components/BasicMap/BasicMap.js.map +2 -2
- package/components/CanvasSaveButton/CanvasSaveButton.js +68 -68
- package/components/CanvasSaveButton/CanvasSaveButton.js.map +2 -2
- package/components/Copyright/Copyright.js +12 -12
- package/components/Copyright/Copyright.js.map +2 -2
- package/components/FeatureExportButton/FeatureExportButton.js +5 -5
- package/components/FeatureExportButton/FeatureExportButton.js.map +2 -2
- package/components/FitExtent/FitExtent.js +15 -15
- package/components/FitExtent/FitExtent.js.map +2 -2
- package/components/Geolocation/Geolocation.js +96 -96
- package/components/Geolocation/Geolocation.js.map +2 -2
- package/components/LayerTree/LayerTree.js +172 -172
- package/components/LayerTree/LayerTree.js.map +2 -2
- package/components/MousePosition/MousePosition.js +27 -27
- package/components/MousePosition/MousePosition.js.map +2 -2
- package/components/NorthArrow/NorthArrow.js +13 -13
- package/components/NorthArrow/NorthArrow.js.map +2 -2
- package/components/Overlay/Overlay.js +49 -49
- package/components/Overlay/Overlay.js.map +2 -2
- package/components/Permalink/Permalink.js +70 -70
- package/components/Permalink/Permalink.js.map +2 -2
- package/components/Popup/Popup.js +73 -73
- package/components/Popup/Popup.js.map +2 -2
- package/components/ResizeHandler/ResizeHandler.js +51 -49
- package/components/ResizeHandler/ResizeHandler.js.map +2 -2
- package/components/RouteSchedule/RouteSchedule.js +86 -74
- package/components/RouteSchedule/RouteSchedule.js.map +2 -2
- package/components/RouteSchedule/RouteSchedule.scss +0 -20
- package/components/ScaleLine/ScaleLine.js +2 -2
- package/components/ScaleLine/ScaleLine.js.map +2 -2
- package/components/StopsFinder/StopsFinder.js +21 -21
- package/components/StopsFinder/StopsFinder.js.map +2 -2
- package/components/StopsFinder/StopsFinderOption.js +3 -3
- package/components/StopsFinder/StopsFinderOption.js.map +2 -2
- package/components/Zoom/Zoom.js +35 -35
- package/components/Zoom/Zoom.js.map +2 -2
- package/package.json +33 -29
- package/propTypes.js +10 -10
- package/propTypes.js.map +2 -2
- package/utils/GlobalsForOle.js +57 -57
- package/utils/GlobalsForOle.js.map +2 -2
- package/utils/KML.js +32 -32
- package/utils/KML.js.map +2 -2
- package/utils/Styles.js +7 -7
- package/utils/Styles.js.map +2 -2
- package/utils/timeUtils.js +6 -6
- package/utils/timeUtils.js.map +2 -2
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import { PureComponent, Component } from "react";
|
|
2
1
|
import PropTypes from "prop-types";
|
|
2
|
+
import { Component, PureComponent } from "react";
|
|
3
3
|
import ResizeObserver from "resize-observer-polyfill";
|
|
4
4
|
const propTypes = {
|
|
5
|
+
// This property is used to re-apply the classes, for example when the className of the observed node changes.
|
|
6
|
+
forceUpdate: PropTypes.oneOfType([
|
|
7
|
+
PropTypes.string,
|
|
8
|
+
PropTypes.number,
|
|
9
|
+
PropTypes.bool
|
|
10
|
+
]),
|
|
11
|
+
maxHeightBrkpts: PropTypes.objectOf(PropTypes.number),
|
|
12
|
+
maxWidthBrkpts: PropTypes.objectOf(PropTypes.number),
|
|
5
13
|
observe: PropTypes.oneOfType([
|
|
6
14
|
PropTypes.string,
|
|
7
15
|
PropTypes.node,
|
|
@@ -9,19 +17,12 @@ const propTypes = {
|
|
|
9
17
|
PropTypes.shape({ current: PropTypes.node }),
|
|
10
18
|
PropTypes.shape({ current: PropTypes.instanceOf(Component) })
|
|
11
19
|
]),
|
|
12
|
-
maxHeightBrkpts: PropTypes.objectOf(PropTypes.number),
|
|
13
|
-
maxWidthBrkpts: PropTypes.objectOf(PropTypes.number),
|
|
14
|
-
stylePropHeight: PropTypes.string,
|
|
15
20
|
onResize: PropTypes.func,
|
|
16
|
-
|
|
17
|
-
forceUpdate: PropTypes.oneOfType([
|
|
18
|
-
PropTypes.string,
|
|
19
|
-
PropTypes.number,
|
|
20
|
-
PropTypes.bool
|
|
21
|
-
])
|
|
21
|
+
stylePropHeight: PropTypes.string
|
|
22
22
|
};
|
|
23
23
|
const defaultProps = {
|
|
24
|
-
|
|
24
|
+
forceUpdate: null,
|
|
25
|
+
/* eslint-disable perfectionist/sort-objects */
|
|
25
26
|
maxHeightBrkpts: {
|
|
26
27
|
xs: 576,
|
|
27
28
|
s: 768,
|
|
@@ -36,11 +37,19 @@ const defaultProps = {
|
|
|
36
37
|
l: 1200,
|
|
37
38
|
xl: Infinity
|
|
38
39
|
},
|
|
39
|
-
|
|
40
|
+
/* eslint-enable perfectionist/sort-objects */
|
|
41
|
+
observe: null,
|
|
40
42
|
onResize: null,
|
|
41
|
-
|
|
43
|
+
stylePropHeight: null
|
|
42
44
|
};
|
|
43
45
|
class ResizeHandler extends PureComponent {
|
|
46
|
+
constructor(props) {
|
|
47
|
+
super(props);
|
|
48
|
+
this.observer = new ResizeObserver((entries) => {
|
|
49
|
+
return this.onResize(entries);
|
|
50
|
+
});
|
|
51
|
+
this.nodes = [];
|
|
52
|
+
}
|
|
44
53
|
static applyBreakpoints(entry, breakpoints, size, direction) {
|
|
45
54
|
let found = false;
|
|
46
55
|
let screenSize;
|
|
@@ -55,18 +64,11 @@ class ResizeHandler extends PureComponent {
|
|
|
55
64
|
});
|
|
56
65
|
return screenSize;
|
|
57
66
|
}
|
|
58
|
-
constructor(props) {
|
|
59
|
-
super(props);
|
|
60
|
-
this.observer = new ResizeObserver((entries) => {
|
|
61
|
-
return this.onResize(entries);
|
|
62
|
-
});
|
|
63
|
-
this.nodes = [];
|
|
64
|
-
}
|
|
65
67
|
componentDidMount() {
|
|
66
68
|
this.observe();
|
|
67
69
|
}
|
|
68
70
|
componentDidUpdate(prevProps) {
|
|
69
|
-
const {
|
|
71
|
+
const { forceUpdate, observe } = this.props;
|
|
70
72
|
if (observe !== prevProps.observe || forceUpdate !== prevProps.forceUpdate) {
|
|
71
73
|
this.observe();
|
|
72
74
|
}
|
|
@@ -74,8 +76,35 @@ class ResizeHandler extends PureComponent {
|
|
|
74
76
|
componentWillUnmount() {
|
|
75
77
|
this.observer.disconnect();
|
|
76
78
|
}
|
|
79
|
+
observe() {
|
|
80
|
+
this.observer.disconnect();
|
|
81
|
+
const { observe } = this.props;
|
|
82
|
+
if (!observe) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (typeof observe === "string" || observe instanceof String) {
|
|
86
|
+
this.nodes = document.querySelectorAll(observe);
|
|
87
|
+
} else if (observe instanceof Component) {
|
|
88
|
+
console.warn(
|
|
89
|
+
"observe attribute as a Component is deprecated: Please use React.createRef() or React.useRef() instead of a React component."
|
|
90
|
+
);
|
|
91
|
+
} else if (observe instanceof Element) {
|
|
92
|
+
this.nodes.push(observe);
|
|
93
|
+
} else if (observe.current instanceof Element) {
|
|
94
|
+
this.nodes.push(observe.current);
|
|
95
|
+
} else if (observe.current instanceof Component) {
|
|
96
|
+
console.warn(
|
|
97
|
+
"observe attribute as a ref to Component is deprecated: Please use React.createRef() or React.useRef() instead of a React component."
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
if (this.nodes.length) {
|
|
101
|
+
this.nodes.forEach((node) => {
|
|
102
|
+
return this.observer.observe(node);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
77
106
|
onResize(entries) {
|
|
78
|
-
const { maxHeightBrkpts, maxWidthBrkpts,
|
|
107
|
+
const { maxHeightBrkpts, maxWidthBrkpts, onResize, stylePropHeight } = this.props;
|
|
79
108
|
if (stylePropHeight) {
|
|
80
109
|
const vh = window.innerHeight * 0.01;
|
|
81
110
|
document.documentElement.style.setProperty(stylePropHeight, `${vh}px`);
|
|
@@ -111,33 +140,6 @@ class ResizeHandler extends PureComponent {
|
|
|
111
140
|
onResize(entries, newScreenWidth, newScreenHeight);
|
|
112
141
|
}
|
|
113
142
|
}
|
|
114
|
-
observe() {
|
|
115
|
-
this.observer.disconnect();
|
|
116
|
-
const { observe } = this.props;
|
|
117
|
-
if (!observe) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
if (typeof observe === "string" || observe instanceof String) {
|
|
121
|
-
this.nodes = document.querySelectorAll(observe);
|
|
122
|
-
} else if (observe instanceof Component) {
|
|
123
|
-
console.warn(
|
|
124
|
-
"observe attribute as a Component is deprecated: Please use React.createRef() or React.useRef() instead of a React component."
|
|
125
|
-
);
|
|
126
|
-
} else if (observe instanceof Element) {
|
|
127
|
-
this.nodes.push(observe);
|
|
128
|
-
} else if (observe.current instanceof Element) {
|
|
129
|
-
this.nodes.push(observe.current);
|
|
130
|
-
} else if (observe.current instanceof Component) {
|
|
131
|
-
console.warn(
|
|
132
|
-
"observe attribute as a ref to Component is deprecated: Please use React.createRef() or React.useRef() instead of a React component."
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
if (this.nodes.length) {
|
|
136
|
-
this.nodes.forEach((node) => {
|
|
137
|
-
return this.observer.observe(node);
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
143
|
render() {
|
|
142
144
|
return null;
|
|
143
145
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/ResizeHandler/ResizeHandler.js"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["import PropTypes from \"prop-types\";\nimport { Component, PureComponent } from \"react\";\nimport ResizeObserver from \"resize-observer-polyfill\";\n\nconst propTypes = {\n // This property is used to re-apply the classes, for example when the className of the observed node changes.\n forceUpdate: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.number,\n PropTypes.bool,\n ]),\n maxHeightBrkpts: PropTypes.objectOf(PropTypes.number),\n maxWidthBrkpts: PropTypes.objectOf(PropTypes.number),\n observe: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.node,\n PropTypes.instanceOf(Component),\n PropTypes.shape({ current: PropTypes.node }),\n PropTypes.shape({ current: PropTypes.instanceOf(Component) }),\n ]),\n onResize: PropTypes.func,\n\n stylePropHeight: PropTypes.string,\n};\n\n// Same as bootstrap\nconst defaultProps = {\n forceUpdate: null,\n /* eslint-disable perfectionist/sort-objects */\n maxHeightBrkpts: {\n xs: 576,\n s: 768,\n m: 992,\n l: 1200,\n xl: Infinity,\n },\n maxWidthBrkpts: {\n xs: 576,\n s: 768,\n m: 992,\n l: 1200,\n xl: Infinity,\n },\n /* eslint-enable perfectionist/sort-objects */\n observe: null,\n onResize: null,\n stylePropHeight: null,\n};\n/**\n * This component adds css class to an element depending on his size.\n */\nclass ResizeHandler extends PureComponent {\n constructor(props) {\n super(props);\n this.observer = new ResizeObserver((entries) => {\n return this.onResize(entries);\n });\n this.nodes = [];\n }\n\n static applyBreakpoints(entry, breakpoints, size, direction) {\n let found = false;\n let screenSize;\n Object.entries(breakpoints).forEach((brkpt) => {\n const cssClass = `rs-${direction}-${brkpt[0]}`;\n entry.target.classList.remove(cssClass);\n if (!found && size <= brkpt[1]) {\n found = true;\n [screenSize] = brkpt;\n entry.target.classList.add(cssClass);\n }\n });\n return screenSize;\n }\n\n componentDidMount() {\n this.observe();\n }\n\n componentDidUpdate(prevProps) {\n const { forceUpdate, observe } = this.props;\n\n if (\n observe !== prevProps.observe ||\n forceUpdate !== prevProps.forceUpdate\n ) {\n this.observe();\n }\n }\n\n componentWillUnmount() {\n this.observer.disconnect();\n }\n\n observe() {\n this.observer.disconnect();\n const { observe } = this.props;\n\n if (!observe) {\n return;\n }\n\n if (typeof observe === \"string\" || observe instanceof String) {\n this.nodes = document.querySelectorAll(observe);\n } else if (observe instanceof Component) {\n // eslint-disable-next-line no-console\n console.warn(\n \"observe attribute as a Component is deprecated: Please use React.createRef() or React.useRef() instead of a React component.\",\n );\n // eslint-disable-next-line react/no-find-dom-node\n // this.nodes.push(ReactDOM.findDOMNode(observe));\n } else if (observe instanceof Element) {\n this.nodes.push(observe);\n } else if (observe.current instanceof Element) {\n // observe value created with React.createRef() on a html node.\n this.nodes.push(observe.current);\n } else if (observe.current instanceof Component) {\n // eslint-disable-next-line no-console\n console.warn(\n \"observe attribute as a ref to Component is deprecated: Please use React.createRef() or React.useRef() instead of a React component.\",\n );\n // observe value created with React.createRef() on a React component.\n // eslint-disable-next-line react/no-find-dom-node\n // this.nodes.push(ReactDOM.findDOMNode(observe.current));\n }\n\n if (this.nodes.length) {\n this.nodes.forEach((node) => {\n return this.observer.observe(node);\n });\n }\n }\n\n onResize(entries) {\n const { maxHeightBrkpts, maxWidthBrkpts, onResize, stylePropHeight } =\n this.props;\n\n if (stylePropHeight) {\n const vh = window.innerHeight * 0.01;\n document.documentElement.style.setProperty(stylePropHeight, `${vh}px`);\n }\n\n if (!maxWidthBrkpts && !maxHeightBrkpts) {\n onResize(entries);\n return;\n }\n\n let newScreenWidth;\n let newScreenHeight;\n\n for (let i = 0; i < entries.length; i += 1) {\n const entry = entries[i];\n const rect = entry.contentRect;\n const { height, width } = rect;\n\n if (maxWidthBrkpts) {\n newScreenWidth = ResizeHandler.applyBreakpoints(\n entry,\n maxWidthBrkpts,\n width,\n \"w\",\n );\n }\n if (maxHeightBrkpts) {\n newScreenHeight = ResizeHandler.applyBreakpoints(\n entry,\n maxHeightBrkpts,\n height,\n \"h\",\n );\n }\n }\n\n if (onResize) {\n onResize(entries, newScreenWidth, newScreenHeight);\n }\n }\n\n render() {\n return null;\n }\n}\n\nResizeHandler.propTypes = propTypes;\nResizeHandler.defaultProps = defaultProps;\n\nexport default ResizeHandler;\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,eAAe;AACtB,SAAS,WAAW,qBAAqB;AACzC,OAAO,oBAAoB;AAE3B,MAAM,YAAY;AAAA;AAAA,EAEhB,aAAa,UAAU,UAAU;AAAA,IAC/B,UAAU;AAAA,IACV,UAAU;AAAA,IACV,UAAU;AAAA,EACZ,CAAC;AAAA,EACD,i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CAAC,iBAAiB;AACvC,eAAS,OAAO;AAChB;AAAA,IACF;AAEA,QAAI;AACJ,QAAI;AAEJ,aAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK,GAAG;AAC1C,YAAM,QAAQ,QAAQ,CAAC;AACvB,YAAM,OAAO,MAAM;AACnB,YAAM,EAAE,QAAQ,MAAM,IAAI;AAE1B,UAAI,gBAAgB;AAClB,yBAAiB,cAAc;AAAA,UAC7B;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF;AACA,UAAI,iBAAiB;AACnB,0BAAkB,cAAc;AAAA,UAC9B;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,QAAI,UAAU;AACZ,eAAS,SAAS,gBAAgB,eAAe;AAAA,IACnD;AAAA,EACF;AAAA,EAEA,SAAS;AACP,WAAO;AAAA,EACT;AACF;AAEA,cAAc,YAAY;AAC1B,cAAc,eAAe;AAE7B,eAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
1
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
realtimeConfig,
|
|
3
|
+
RealtimeLayer as TrackerLayer
|
|
6
4
|
} from "mobility-toolbox-js/ol";
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
getDelayString as defaultGetDelayString
|
|
10
|
-
} from "../../utils/timeUtils";
|
|
11
|
-
import ReactTransitPropTypes from "../../propTypes";
|
|
5
|
+
import PropTypes from "prop-types";
|
|
6
|
+
import React, { useEffect, useState } from "react";
|
|
12
7
|
import firstStation from "../../images/RouteSchedule/firstStation.png";
|
|
13
|
-
import station from "../../images/RouteSchedule/station.png";
|
|
14
8
|
import lastStation from "../../images/RouteSchedule/lastStation.png";
|
|
15
9
|
import line from "../../images/RouteSchedule/line.png";
|
|
10
|
+
import station from "../../images/RouteSchedule/station.png";
|
|
11
|
+
import ReactTransitPropTypes from "../../propTypes";
|
|
12
|
+
import {
|
|
13
|
+
getDelayString as defaultGetDelayString,
|
|
14
|
+
getHoursAndMinutes
|
|
15
|
+
} from "../../utils/timeUtils";
|
|
16
16
|
const { getBgColor } = realtimeConfig;
|
|
17
|
-
const
|
|
17
|
+
const defaultGetDelayColor = (time) => {
|
|
18
18
|
const secs = Math.round(time / 1800 / 2 * 3600 / 1e3);
|
|
19
19
|
if (secs >= 3600) {
|
|
20
|
-
return "
|
|
20
|
+
return "rgb(237 0 76)";
|
|
21
21
|
}
|
|
22
22
|
if (secs >= 500) {
|
|
23
|
-
return "
|
|
23
|
+
return "rgb(232 0 0)";
|
|
24
24
|
}
|
|
25
25
|
if (secs >= 300) {
|
|
26
|
-
return "
|
|
26
|
+
return "rgb(255 74 0)";
|
|
27
27
|
}
|
|
28
28
|
if (secs >= 180) {
|
|
29
|
-
return "
|
|
29
|
+
return "rgb(247 191 0)";
|
|
30
30
|
}
|
|
31
|
-
return "
|
|
31
|
+
return "rgb(0 160 12)";
|
|
32
32
|
};
|
|
33
33
|
const isNotStop = (stop) => {
|
|
34
34
|
return !stop.arrivalTime && !stop.departureTime;
|
|
@@ -57,30 +57,36 @@ const defaultRenderStationImg = (stations, index, isStationPassed, isNotStation)
|
|
|
57
57
|
} else if (isNotStation) {
|
|
58
58
|
src = line.src || line;
|
|
59
59
|
}
|
|
60
|
-
return /* @__PURE__ */ React.createElement("img", {
|
|
60
|
+
return /* @__PURE__ */ React.createElement("img", { alt: "routeScheduleLine", className: "rt-route-icon", src });
|
|
61
61
|
};
|
|
62
62
|
const defaultRenderStationName = (stations, index, cancelled) => {
|
|
63
63
|
const { stationName } = stations[index];
|
|
64
64
|
return /* @__PURE__ */ React.createElement("div", { className: cancelled ? "rt-route-cancelled" : "" }, stationName);
|
|
65
65
|
};
|
|
66
|
+
const defaultRenderDelay = (delay, stop, getDelayString, getDelayColor) => {
|
|
67
|
+
return /* @__PURE__ */ React.createElement("span", { style: { color: getDelayColor?.(delay, stop) || "inherit" } }, `${getDelayString?.(delay, stop) || ""}`);
|
|
68
|
+
};
|
|
66
69
|
const emptyFunc = () => {
|
|
67
70
|
};
|
|
68
71
|
function RouteStop({
|
|
72
|
+
getDelayColor = defaultGetDelayColor,
|
|
73
|
+
getDelayString = defaultGetDelayString,
|
|
74
|
+
idx,
|
|
69
75
|
lineInfos,
|
|
70
76
|
onStationClick = emptyFunc,
|
|
71
|
-
|
|
77
|
+
renderArrivalDelay = defaultRenderDelay,
|
|
78
|
+
renderDepartureDelay = defaultRenderDelay,
|
|
72
79
|
renderStationImg = defaultRenderStationImg,
|
|
73
80
|
renderStationName = defaultRenderStationName,
|
|
74
|
-
getDelayString = defaultGetDelayString,
|
|
75
81
|
stop,
|
|
76
|
-
|
|
82
|
+
trackerLayer
|
|
77
83
|
}) {
|
|
78
84
|
const {
|
|
85
|
+
aimedArrivalTime,
|
|
86
|
+
aimedDepartureTime,
|
|
79
87
|
arrivalDelay,
|
|
80
88
|
departureDelay,
|
|
81
|
-
state
|
|
82
|
-
aimedArrivalTime,
|
|
83
|
-
aimedDepartureTime
|
|
89
|
+
state
|
|
84
90
|
} = stop;
|
|
85
91
|
const cancelled = state === "JOURNEY_CANCELLED" || state === "STOP_CANCELLED";
|
|
86
92
|
const { stations } = lineInfos;
|
|
@@ -104,7 +110,6 @@ function RouteStop({
|
|
|
104
110
|
return /* @__PURE__ */ React.createElement(
|
|
105
111
|
"div",
|
|
106
112
|
{
|
|
107
|
-
role: "button",
|
|
108
113
|
className: [
|
|
109
114
|
"rt-route-station",
|
|
110
115
|
isStationPassed ? " rt-passed" : "",
|
|
@@ -113,27 +118,22 @@ function RouteStop({
|
|
|
113
118
|
onClick: (e) => {
|
|
114
119
|
return onStationClick(stop, e);
|
|
115
120
|
},
|
|
116
|
-
tabIndex: 0,
|
|
117
121
|
onKeyPress: (e) => {
|
|
118
122
|
return e.which === 13 && onStationClick(stop, e);
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
/* @__PURE__ */ React.createElement("div", { className: "rt-route-delay" }, arrivalDelay === void 0 || arrivalDelay === null || isFirstStation || cancelled ? "" : /* @__PURE__ */ React.createElement(
|
|
122
|
-
"span",
|
|
123
|
-
{
|
|
124
|
-
className: `rt-route-delay-arrival${` ${getDelayColor(
|
|
125
|
-
arrivalDelay
|
|
126
|
-
)}`}`
|
|
127
123
|
},
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
124
|
+
role: "button",
|
|
125
|
+
tabIndex: 0
|
|
126
|
+
},
|
|
127
|
+
/* @__PURE__ */ React.createElement("div", { className: "rt-route-delay" }, arrivalDelay === void 0 || arrivalDelay === null || isFirstStation || cancelled ? "" : renderArrivalDelay(
|
|
128
|
+
arrivalDelay,
|
|
129
|
+
stop,
|
|
130
|
+
getDelayString,
|
|
131
|
+
getDelayColor
|
|
132
|
+
), departureDelay === void 0 || departureDelay === null || isLastStation || cancelled ? "" : renderDepartureDelay(
|
|
133
|
+
departureDelay,
|
|
134
|
+
stop,
|
|
135
|
+
getDelayString,
|
|
136
|
+
getDelayColor
|
|
137
137
|
)),
|
|
138
138
|
/* @__PURE__ */ React.createElement("div", { className: "rt-route-times" }, /* @__PURE__ */ React.createElement(
|
|
139
139
|
"span",
|
|
@@ -153,7 +153,7 @@ function RouteStop({
|
|
|
153
153
|
);
|
|
154
154
|
}
|
|
155
155
|
const defaultRenderStation = (props) => {
|
|
156
|
-
const {
|
|
156
|
+
const { arrivalTime, departureTime, stationId, stationName } = props.stop;
|
|
157
157
|
return /* @__PURE__ */ React.createElement(
|
|
158
158
|
RouteStop,
|
|
159
159
|
{
|
|
@@ -162,7 +162,7 @@ const defaultRenderStation = (props) => {
|
|
|
162
162
|
}
|
|
163
163
|
);
|
|
164
164
|
};
|
|
165
|
-
const defaultRenderRouteIdentifier = ({
|
|
165
|
+
const defaultRenderRouteIdentifier = ({ longName, routeIdentifier }) => {
|
|
166
166
|
if (routeIdentifier) {
|
|
167
167
|
const id = parseInt(routeIdentifier.split(".")[0], 10);
|
|
168
168
|
if (!longName.includes(id) && !Number.isNaN(id)) {
|
|
@@ -180,14 +180,14 @@ const defaultRenderHeader = ({
|
|
|
180
180
|
renderRouteIdentifier = defaultRenderRouteIdentifier
|
|
181
181
|
}) => {
|
|
182
182
|
const {
|
|
183
|
-
type,
|
|
184
|
-
vehicleType,
|
|
185
|
-
shortName,
|
|
186
|
-
longName,
|
|
187
|
-
stroke,
|
|
188
183
|
destination,
|
|
184
|
+
longName,
|
|
189
185
|
routeIdentifier,
|
|
190
|
-
|
|
186
|
+
shortName,
|
|
187
|
+
stroke,
|
|
188
|
+
text_color: textColor,
|
|
189
|
+
type,
|
|
190
|
+
vehicleType
|
|
191
191
|
} = lineInfos;
|
|
192
192
|
return /* @__PURE__ */ React.createElement("div", { className: "rt-route-header" }, /* @__PURE__ */ React.createElement(
|
|
193
193
|
"span",
|
|
@@ -203,7 +203,7 @@ const defaultRenderHeader = ({
|
|
|
203
203
|
), /* @__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)));
|
|
204
204
|
};
|
|
205
205
|
const defaultRenderLink = (text, url) => {
|
|
206
|
-
return /* @__PURE__ */ React.createElement("div", { className: "rt-route-copyright-link" }, url ? /* @__PURE__ */ React.createElement("a", { href: url,
|
|
206
|
+
return /* @__PURE__ */ React.createElement("div", { className: "rt-route-copyright-link" }, url ? /* @__PURE__ */ React.createElement("a", { href: url, rel: "noreferrer", target: "_blank" }, text) : text);
|
|
207
207
|
};
|
|
208
208
|
const defaultRenderCopyright = ({ lineInfos }) => {
|
|
209
209
|
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 && ")");
|
|
@@ -220,60 +220,72 @@ const propTypes = {
|
|
|
220
220
|
* CSS class of the route schedule wrapper.
|
|
221
221
|
*/
|
|
222
222
|
className: PropTypes.string,
|
|
223
|
+
/**
|
|
224
|
+
* Function to get the delay color.
|
|
225
|
+
*/
|
|
226
|
+
getDelayColor: PropTypes.func,
|
|
227
|
+
/**
|
|
228
|
+
* Function to get the delay string for stations.
|
|
229
|
+
*/
|
|
230
|
+
getDelayString: PropTypes.func,
|
|
223
231
|
/**
|
|
224
232
|
* Trajectory stations informations.
|
|
225
233
|
*/
|
|
226
234
|
lineInfos: ReactTransitPropTypes.lineInfos,
|
|
227
235
|
/**
|
|
228
|
-
*
|
|
236
|
+
* Function triggered on station's click event.
|
|
229
237
|
*/
|
|
230
|
-
|
|
238
|
+
onStationClick: PropTypes.func,
|
|
231
239
|
/**
|
|
232
|
-
* Render
|
|
240
|
+
* Render delay for arrival.
|
|
233
241
|
*/
|
|
234
|
-
|
|
242
|
+
renderArrivalDelay: PropTypes.func,
|
|
243
|
+
/**
|
|
244
|
+
* Render Copyright of the route scheduler.
|
|
245
|
+
*/
|
|
246
|
+
renderCopyright: PropTypes.func,
|
|
247
|
+
/**
|
|
248
|
+
* Render delay for departure.
|
|
249
|
+
*/
|
|
250
|
+
renderDepartureDelay: PropTypes.func,
|
|
235
251
|
/**
|
|
236
252
|
* Render Footer of the route scheduler.
|
|
237
253
|
*/
|
|
238
254
|
renderFooter: PropTypes.func,
|
|
239
255
|
/**
|
|
240
|
-
* Render
|
|
256
|
+
* Render Header of the route scheduler.
|
|
241
257
|
*/
|
|
242
|
-
|
|
258
|
+
renderHeader: PropTypes.func,
|
|
243
259
|
/**
|
|
244
|
-
*
|
|
260
|
+
* Function to render header buttons.
|
|
245
261
|
*/
|
|
246
|
-
|
|
262
|
+
renderHeaderButtons: PropTypes.func,
|
|
247
263
|
/**
|
|
248
|
-
* Render the
|
|
264
|
+
* Render the route identifier in the header
|
|
249
265
|
*/
|
|
250
|
-
|
|
266
|
+
renderRouteIdentifier: PropTypes.func,
|
|
251
267
|
/**
|
|
252
268
|
* Render a station.
|
|
253
269
|
*/
|
|
254
270
|
renderStation: PropTypes.func,
|
|
255
271
|
/**
|
|
256
|
-
* Render
|
|
257
|
-
*/
|
|
258
|
-
renderStationName: PropTypes.func,
|
|
259
|
-
/**
|
|
260
|
-
* Function triggered on station's click event.
|
|
272
|
+
* Render the status of the station image.
|
|
261
273
|
*/
|
|
262
|
-
|
|
274
|
+
renderStationImg: PropTypes.func,
|
|
263
275
|
/**
|
|
264
|
-
*
|
|
276
|
+
* Render a station name.
|
|
265
277
|
*/
|
|
266
|
-
|
|
278
|
+
renderStationName: PropTypes.func,
|
|
267
279
|
/**
|
|
268
|
-
*
|
|
280
|
+
* Trackerlayer.
|
|
269
281
|
*/
|
|
270
|
-
|
|
282
|
+
trackerLayer: PropTypes.instanceOf(TrackerLayer).isRequired
|
|
271
283
|
};
|
|
272
284
|
function RouteSchedule({
|
|
273
285
|
className = "rt-route-schedule",
|
|
274
|
-
renderStation = defaultRenderStation,
|
|
275
|
-
renderHeader = defaultRenderHeader,
|
|
276
286
|
renderFooter = defaultRenderFooter,
|
|
287
|
+
renderHeader = defaultRenderHeader,
|
|
288
|
+
renderStation = defaultRenderStation,
|
|
277
289
|
...props
|
|
278
290
|
}) {
|
|
279
291
|
const { lineInfos } = props;
|
|
@@ -281,7 +293,7 @@ function RouteSchedule({
|
|
|
281
293
|
return null;
|
|
282
294
|
}
|
|
283
295
|
return /* @__PURE__ */ React.createElement("div", { className }, renderHeader({ ...props }), /* @__PURE__ */ React.createElement("div", { className: "rt-route-body" }, lineInfos.stations.map((stop, idx) => {
|
|
284
|
-
return renderStation({ ...props,
|
|
296
|
+
return renderStation({ ...props, idx, stop });
|
|
285
297
|
})), renderFooter({ ...props }));
|
|
286
298
|
}
|
|
287
299
|
RouteSchedule.propTypes = propTypes;
|
|
@@ -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, { useEffect, useState } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n RealtimeLayer as TrackerLayer,\n realtimeConfig,\n} from \"mobility-toolbox-js/ol\";\nimport {\n getHoursAndMinutes,\n getDelayString as defaultGetDelayString,\n} 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\n/**\n * Returns an text.\n * @param {Number} stations The stations list.\n * @param {Number} index Index of the station in the list.\n * @param {Boolean} cancelled If the station is cancelled\n */\nconst defaultRenderStationName = (stations, index, cancelled) => {\n const { stationName } = stations[index];\n return (\n <div className={cancelled ? \"rt-route-cancelled\" : \"\"}>{stationName}</div>\n );\n};\nconst emptyFunc = () => {};\n\nfunction RouteStop({\n lineInfos,\n onStationClick = emptyFunc,\n trackerLayer,\n renderStationImg = defaultRenderStationImg,\n renderStationName = defaultRenderStationName,\n getDelayString = defaultGetDelayString,\n stop,\n idx,\n}) {\n const {\n arrivalDelay,\n departureDelay,\n state,\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 const [isStationPassed, setIsStationPassed] = useState(false);\n\n useEffect(() => {\n let timeout = null;\n\n const isStopPassed = isPassed(stop, trackerLayer.time, stations, idx);\n setIsStationPassed(isStopPassed);\n\n // We have to refresh the stop when the state it's time_based\n if (stop.state === \"TIME_BASED\" && !isStopPassed) {\n timeout = setInterval(() => {\n setIsStationPassed(isPassed(stop, trackerLayer.time, stations, idx));\n }, 20000);\n }\n return () => {\n clearInterval(timeout);\n };\n }, [stop, 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 {arrivalDelay === undefined ||\n arrivalDelay === null ||\n isFirstStation ||\n cancelled ? (\n \"\"\n ) : (\n <span\n className={`rt-route-delay-arrival${` ${getDelayColor(\n arrivalDelay,\n )}`}`}\n >\n {`+${getDelayString(arrivalDelay)}`}\n </span>\n )}\n {departureDelay === undefined ||\n departureDelay === null ||\n isLastStation ||\n 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 {renderStationName(stations, idx, cancelled)}\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 defaultRenderRouteIdentifier = ({ 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) && !Number.isNaN(id)) {\n return ` (${id})`;\n }\n }\n return null;\n};\nconst defaultRenderHeaderButtons = () => {\n return null;\n};\n\nconst defaultRenderHeader = ({\n lineInfos,\n renderHeaderButtons = defaultRenderHeaderButtons,\n renderRouteIdentifier = defaultRenderRouteIdentifier,\n}) => {\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 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 defaultRenderFooter = (props) => {\n const { lineInfos, renderCopyright = defaultRenderCopyright } = props;\n if (!lineInfos.operator && !lineInfos.publisher) {\n return null;\n }\n return <div className=\"rt-route-footer\">{renderCopyright({ ...props })}</div>;\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 route identifier in the header\n */\n renderRouteIdentifier: 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 * Render a station name.\n */\n renderStationName: 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 /**\n * Function to get the delay string for stations.\n */\n getDelayString: PropTypes.func,\n};\n\n/**\n * RouteSchedule displays information, stops and punctuality about the clicked route.\n */\nfunction RouteSchedule({\n className = \"rt-route-schedule\",\n renderStation = defaultRenderStation,\n renderHeader = defaultRenderHeader,\n renderFooter = defaultRenderFooter,\n ...props\n}) {\n const { lineInfos } = 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;\n\nexport default React.memo(RouteSchedule);\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react/no-unused-prop-types */\nimport {\n realtimeConfig,\n RealtimeLayer as TrackerLayer,\n} from \"mobility-toolbox-js/ol\";\nimport PropTypes from \"prop-types\";\n/* eslint-disable react/prop-types */\nimport React, { useEffect, useState } from \"react\";\n\nimport firstStation from \"../../images/RouteSchedule/firstStation.png\";\nimport lastStation from \"../../images/RouteSchedule/lastStation.png\";\nimport line from \"../../images/RouteSchedule/line.png\";\nimport station from \"../../images/RouteSchedule/station.png\";\nimport ReactTransitPropTypes from \"../../propTypes\";\nimport {\n getDelayString as defaultGetDelayString,\n getHoursAndMinutes,\n} from \"../../utils/timeUtils\";\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 defaultGetDelayColor = (time) => {\n const secs = Math.round(((time / 1800 / 2) * 3600) / 1000);\n if (secs >= 3600) {\n return \"rgb(237 0 76)\";\n }\n if (secs >= 500) {\n return \"rgb(232 0 0)\";\n }\n if (secs >= 300) {\n return \"rgb(255 74 0)\";\n }\n if (secs >= 180) {\n return \"rgb(247 191 0)\";\n }\n return \"rgb(0 160 12)\";\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 alt=\"routeScheduleLine\" className=\"rt-route-icon\" src={src} />;\n};\n\n/**\n * Returns an text.\n * @param {Number} stations The stations list.\n * @param {Number} index Index of the station in the list.\n * @param {Boolean} cancelled If the station is cancelled\n */\nconst defaultRenderStationName = (stations, index, cancelled) => {\n const { stationName } = stations[index];\n return (\n <div className={cancelled ? \"rt-route-cancelled\" : \"\"}>{stationName}</div>\n );\n};\n\n/**\n * Render a delay string.\n * @param {Number} delay The delay in ms to display.\n * @param {Boolean} stop The current stop object.\n * @param {Function} getDelayString Function to get string to display.\n * @param {Function} getColor Define the css color to use.\n *\n */\nconst defaultRenderDelay = (delay, stop, getDelayString, getDelayColor) => {\n return (\n <span style={{ color: getDelayColor?.(delay, stop) || \"inherit\" }}>\n {`${getDelayString?.(delay, stop) || \"\"}`}\n </span>\n );\n};\n\nconst emptyFunc = () => {};\n\nfunction RouteStop({\n getDelayColor = defaultGetDelayColor,\n getDelayString = defaultGetDelayString,\n idx,\n lineInfos,\n onStationClick = emptyFunc,\n renderArrivalDelay = defaultRenderDelay,\n renderDepartureDelay = defaultRenderDelay,\n renderStationImg = defaultRenderStationImg,\n renderStationName = defaultRenderStationName,\n stop,\n trackerLayer,\n}) {\n const {\n aimedArrivalTime,\n aimedDepartureTime,\n arrivalDelay,\n departureDelay,\n state,\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 const [isStationPassed, setIsStationPassed] = useState(false);\n\n useEffect(() => {\n let timeout = null;\n\n const isStopPassed = isPassed(stop, trackerLayer.time, stations, idx);\n setIsStationPassed(isStopPassed);\n\n // We have to refresh the stop when the state it's time_based\n if (stop.state === \"TIME_BASED\" && !isStopPassed) {\n timeout = setInterval(() => {\n setIsStationPassed(isPassed(stop, trackerLayer.time, stations, idx));\n }, 20000);\n }\n return () => {\n clearInterval(timeout);\n };\n }, [stop, trackerLayer, stations, idx]);\n\n return (\n <div\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 onKeyPress={(e) => {\n return e.which === 13 && onStationClick(stop, e);\n }}\n role=\"button\"\n tabIndex={0}\n >\n <div className=\"rt-route-delay\">\n {arrivalDelay === undefined ||\n arrivalDelay === null ||\n isFirstStation ||\n cancelled\n ? \"\"\n : renderArrivalDelay(\n arrivalDelay,\n stop,\n getDelayString,\n getDelayColor,\n )}\n {departureDelay === undefined ||\n departureDelay === null ||\n isLastStation ||\n cancelled\n ? \"\"\n : renderDepartureDelay(\n departureDelay,\n stop,\n getDelayString,\n getDelayColor,\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 {renderStationName(stations, idx, cancelled)}\n </div>\n );\n}\n\nconst defaultRenderStation = (props) => {\n const { arrivalTime, departureTime, stationId, 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 defaultRenderRouteIdentifier = ({ longName, routeIdentifier }) => {\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) && !Number.isNaN(id)) {\n return ` (${id})`;\n }\n }\n return null;\n};\nconst defaultRenderHeaderButtons = () => {\n return null;\n};\n\nconst defaultRenderHeader = ({\n lineInfos,\n renderHeaderButtons = defaultRenderHeaderButtons,\n renderRouteIdentifier = defaultRenderRouteIdentifier,\n}) => {\n const {\n destination,\n longName,\n routeIdentifier,\n shortName,\n stroke,\n text_color: textColor,\n type,\n vehicleType,\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 defaultRenderLink = (text, url) => {\n return (\n <div className=\"rt-route-copyright-link\">\n {url ? (\n <a href={url} rel=\"noreferrer\" target=\"_blank\">\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 defaultRenderFooter = (props) => {\n const { lineInfos, renderCopyright = defaultRenderCopyright } = props;\n if (!lineInfos.operator && !lineInfos.publisher) {\n return null;\n }\n return <div className=\"rt-route-footer\">{renderCopyright({ ...props })}</div>;\n};\n\nconst propTypes = {\n /**\n * CSS class of the route schedule wrapper.\n */\n className: PropTypes.string,\n\n /**\n * Function to get the delay color.\n */\n getDelayColor: PropTypes.func,\n\n /**\n * Function to get the delay string for stations.\n */\n getDelayString: PropTypes.func,\n\n /**\n * Trajectory stations informations.\n */\n lineInfos: ReactTransitPropTypes.lineInfos,\n\n /**\n * Function triggered on station's click event.\n */\n onStationClick: PropTypes.func,\n\n /**\n * Render delay for arrival.\n */\n renderArrivalDelay: PropTypes.func,\n\n /**\n * Render Copyright of the route scheduler.\n */\n renderCopyright: PropTypes.func,\n\n /**\n * Render delay for departure.\n */\n renderDepartureDelay: PropTypes.func,\n\n /**\n * Render Footer of the route scheduler.\n */\n renderFooter: PropTypes.func,\n\n /**\n * Render Header of the route scheduler.\n */\n renderHeader: PropTypes.func,\n\n /**\n * Function to render header buttons.\n */\n renderHeaderButtons: PropTypes.func,\n\n /**\n * Render the route identifier in the header\n */\n renderRouteIdentifier: PropTypes.func,\n\n /**\n * Render a station.\n */\n renderStation: PropTypes.func,\n\n /**\n * Render the status of the station image.\n */\n renderStationImg: PropTypes.func,\n\n /**\n * Render a station name.\n */\n renderStationName: PropTypes.func,\n\n /**\n * Trackerlayer.\n */\n trackerLayer: PropTypes.instanceOf(TrackerLayer).isRequired,\n};\n\n/**\n * RouteSchedule displays information, stops and punctuality about the clicked route.\n */\nfunction RouteSchedule({\n className = \"rt-route-schedule\",\n renderFooter = defaultRenderFooter,\n renderHeader = defaultRenderHeader,\n renderStation = defaultRenderStation,\n ...props\n}) {\n const { lineInfos } = 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, idx, stop });\n })}\n </div>\n {renderFooter({ ...props })}\n </div>\n );\n}\n\nRouteSchedule.propTypes = propTypes;\n\nexport default React.memo(RouteSchedule);\n"],
|
|
5
|
+
"mappings": "AACA;AAAA,EACE;AAAA,EACA,iBAAiB;AAAA,OACZ;AACP,OAAO,eAAe;AAEtB,OAAO,SAAS,WAAW,gBAAgB;AAE3C,OAAO,kBAAkB;AACzB,OAAO,iBAAiB;AACxB,OAAO,UAAU;AACjB,OAAO,aAAa;AACpB,OAAO,2BAA2B;AAClC;AAAA,EACE,kBAAkB;AAAA,EAClB;AAAA,OACK;AAEP,MAAM,EAAE,WAAW,IAAI;AAMvB,MAAM,uBAAuB,CAAC,SAAS;AACrC,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,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-85,26 +85,6 @@
|
|
|
85
85
|
width: 40px;
|
|
86
86
|
min-width: 40px;
|
|
87
87
|
padding: 0 3px;
|
|
88
|
-
|
|
89
|
-
.green {
|
|
90
|
-
color: rgb(0 160 12);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.orange {
|
|
94
|
-
color: rgb(247 191 0);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.light-red {
|
|
98
|
-
color: rgb(255 74 0);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.middle-red {
|
|
102
|
-
color: rgb(232 0 0);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.dark-red {
|
|
106
|
-
color: rgb(237 0 76);
|
|
107
|
-
}
|
|
108
88
|
}
|
|
109
89
|
}
|
|
110
90
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { useRef, useEffect } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
1
|
import OLScaleLine from "ol/control/ScaleLine";
|
|
4
2
|
import OLMap from "ol/Map";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import React, { useEffect, useRef } from "react";
|
|
5
5
|
const propTypes = {
|
|
6
6
|
/**
|
|
7
7
|
* ol/map.
|