@geops/rvf-mobility-web-component 0.1.10 → 0.1.12
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/CHANGELOG.md +52 -0
- package/docutils.js +198 -0
- package/index.html +48 -217
- package/index.js +680 -87
- package/input.css +11 -1
- package/jest-setup.js +3 -2
- package/package.json +4 -3
- package/scripts/build.mjs +3 -2
- package/scripts/dev.mjs +2 -1
- package/search.html +38 -69
- package/src/BaseLayer/BaseLayer.tsx +20 -12
- package/src/FloatingMenu/FloatingMenu.tsx +42 -0
- package/src/FloatingMenu/index.tsx +1 -0
- package/src/GeolocationButton/GeolocationButton.tsx +6 -5
- package/src/Map/Map.tsx +1 -0
- package/src/MobilityMap/MobilityMap.tsx +10 -9
- package/src/MobilityMap/index.css +0 -13
- package/src/RealtimeLayer/RealtimeLayer.tsx +2 -3
- package/src/RvfButton/RvfButton.tsx +28 -21
- package/src/RvfCheckbox/RvfCheckbox.tsx +24 -0
- package/src/RvfCheckbox/index.tsx +1 -0
- package/src/RvfExportMenu/RvfExportMenu.tsx +103 -0
- package/src/RvfExportMenu/index.tsx +1 -0
- package/src/RvfExportMenuButton/RvfExportMenuButton.tsx +27 -0
- package/src/RvfExportMenuButton/index.tsx +1 -0
- package/src/RvfFeatureDetails/RvfFeatureDetails.tsx +29 -0
- package/src/RvfFeatureDetails/index.tsx +1 -0
- package/src/RvfFloatingMenu/RvfFloatingMenu.tsx +44 -0
- package/src/RvfFloatingMenu/index.tsx +1 -0
- package/src/RvfIconButton/RvfIconButton.tsx +35 -0
- package/src/RvfIconButton/index.tsx +1 -0
- package/src/RvfLayerTree/RvfLayerTree.tsx +41 -0
- package/src/RvfLayerTree/TreeItem/TreeItem.tsx +120 -0
- package/src/RvfLayerTree/TreeItem/index.tsx +1 -0
- package/src/RvfLayerTree/index.tsx +1 -0
- package/src/RvfLayerTree/layersTreeContext.ts +4 -0
- package/src/RvfLayerTree/layersTreeReducer.ts +152 -0
- package/src/RvfLineNetworkPlanLayer/RvfLineNetworkPlanLayer.tsx +42 -0
- package/src/RvfLineNetworkPlanLayer/index.tsx +1 -0
- package/src/RvfMobilityMap/RvfMobilityMap.tsx +122 -83
- package/src/RvfMobilityMap/index.css +0 -13
- package/src/RvfModal/RvfModal.tsx +52 -0
- package/src/RvfModal/index.tsx +1 -0
- package/src/RvfPoisLayer/RvfPoisLayer.tsx +39 -0
- package/src/RvfPoisLayer/index.tsx +1 -0
- package/src/RvfRadioButton/RvfRadioButton.tsx +16 -0
- package/src/RvfRadioButton/index.tsx +1 -0
- package/src/RvfSelect/RvfSelect.tsx +22 -0
- package/src/RvfSelect/index.tsx +1 -0
- package/src/RvfSellingPointsLayer/RvfSellingPointsLayer.tsx +41 -0
- package/src/RvfSellingPointsLayer/index.tsx +1 -0
- package/src/RvfSharedMobilityLayerGroup/RvfSharedMobilityLayerGroup.tsx +100 -0
- package/src/RvfSharedMobilityLayerGroup/index.tsx +1 -0
- package/src/RvfSingleClickListener/RvfSingleClickListener.tsx +146 -0
- package/src/RvfSingleClickListener/index.tsx +1 -0
- package/src/RvfTarifZonenLayer/RvfTarifZonenLayer.tsx +41 -0
- package/src/RvfTarifZonenLayer/index.tsx +1 -0
- package/src/RvfTopics/RvfTopics.tsx +47 -0
- package/src/RvfTopics/index.tsx +1 -0
- package/src/RvfZoomButtons/RvfZoomButtons.tsx +36 -29
- package/src/Search/Search.tsx +11 -9
- package/src/SingleClickListener/index.tsx +1 -1
- package/src/StationsLayer/StationsLayer.tsx +0 -1
- package/src/StopsSearch/StopsSearch.tsx +38 -6
- package/src/icons/ArrowDown/ArrowDown.tsx +22 -0
- package/src/icons/ArrowDown/down-open.svg +7 -0
- package/src/icons/ArrowDown/index.tsx +1 -0
- package/src/icons/ArrowUp/ArrowUp.tsx +22 -0
- package/src/icons/ArrowUp/index.tsx +1 -0
- package/src/icons/ArrowUp/up-open.svg +7 -0
- package/src/icons/Bicycle/verkehrstraeger-rad-2px-white.svg +19 -0
- package/src/icons/Cancel/Cancel.tsx +21 -0
- package/src/icons/Cancel/cancel.svg +7 -0
- package/src/icons/Cancel/index.tsx +1 -0
- package/src/icons/Car/verkehrstraeger-auto-2px-white.svg +14 -0
- package/src/icons/CargoBicycle/verkehrstraeger-lastenrad-2px-white.svg +27 -0
- package/src/icons/DownOpen/DownOpen.tsx +24 -0
- package/src/icons/DownOpen/down-open.svg +7 -0
- package/src/icons/DownOpen/index.tsx +1 -0
- package/src/icons/Download/Download.tsx +20 -0
- package/src/icons/Download/download.svg +15 -0
- package/src/icons/Download/index.tsx +1 -0
- package/src/icons/Elevator/Elevator.tsx +1 -1
- package/src/icons/Menu/Menu.tsx +32 -0
- package/src/icons/Menu/index.tsx +1 -0
- package/src/icons/Menu/menu.svg +9 -0
- package/src/icons/Ok/ok-grey.svg +7 -0
- package/src/icons/Ok/ok.svg +4 -0
- package/src/icons/Scooter/scooter.svg +10 -0
- package/src/utils/constants.ts +9 -0
- package/src/utils/createMobiDataBwWfsLayer.ts +120 -0
- package/src/utils/createSharedMobilityLayer.ts +165 -0
- package/src/utils/exportPdf.ts +657 -0
- package/src/utils/hooks/useRvfContext.tsx +37 -0
- package/src/utils/hooks/useUpdatePermalink.tsx +2 -9
- package/tailwind.config.mjs +41 -19
- package/src/RvfSharedMobilityLayer/RvfSharedMobilityLayer.tsx +0 -147
- package/src/RvfSharedMobilityLayer/index.tsx +0 -1
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { Map } from "ol";
|
|
2
2
|
import { unByKey } from "ol/Observable";
|
|
3
|
-
import { useEffect
|
|
3
|
+
import { useEffect } from "preact/hooks";
|
|
4
4
|
|
|
5
5
|
const useUpdatePermalink = (map: Map, permalink: boolean) => {
|
|
6
|
-
const [x, setX] = useState<string>(null);
|
|
7
|
-
const [y, setY] = useState<string>(null);
|
|
8
|
-
const [z, setZ] = useState<string>(null);
|
|
9
|
-
|
|
10
6
|
useEffect(() => {
|
|
11
7
|
let listener;
|
|
12
8
|
if (map && permalink) {
|
|
@@ -15,11 +11,8 @@ const useUpdatePermalink = (map: Map, permalink: boolean) => {
|
|
|
15
11
|
const newX = map.getView().getCenter()[0].toFixed(2);
|
|
16
12
|
const newY = map.getView().getCenter()[1].toFixed(2);
|
|
17
13
|
const newZ = map.getView().getZoom().toFixed(1);
|
|
18
|
-
setX(newX);
|
|
19
14
|
urlParams.set("x", newX);
|
|
20
|
-
setY(newY);
|
|
21
15
|
urlParams.set("y", newY);
|
|
22
|
-
setZ(newZ);
|
|
23
16
|
urlParams.set("z", newZ);
|
|
24
17
|
window.history.replaceState(null, null, `?${urlParams.toString()}`);
|
|
25
18
|
});
|
|
@@ -28,6 +21,6 @@ const useUpdatePermalink = (map: Map, permalink: boolean) => {
|
|
|
28
21
|
unByKey(listener);
|
|
29
22
|
};
|
|
30
23
|
}, [map, permalink]);
|
|
31
|
-
return
|
|
24
|
+
return null;
|
|
32
25
|
};
|
|
33
26
|
export default useUpdatePermalink;
|
package/tailwind.config.mjs
CHANGED
|
@@ -28,6 +28,46 @@ const getClamp = (min, max) => {
|
|
|
28
28
|
export default {
|
|
29
29
|
plugins: [containerQueries],
|
|
30
30
|
theme: {
|
|
31
|
+
extend: {
|
|
32
|
+
colors: {
|
|
33
|
+
darkgray: "#464646", // dark grey
|
|
34
|
+
darkred: "#AF050D", // rvf drk red (ex: button primary hover)
|
|
35
|
+
grey: "#7C7C7C", // grey
|
|
36
|
+
lightgrey: "#D0D0D0", // light grey
|
|
37
|
+
lightred: "#FF5961", //rvf light red (ex:active button)
|
|
38
|
+
red: "#E3000B", // rvf rot
|
|
39
|
+
ultradarkgray: "#2D2D2C", // another grey with no name
|
|
40
|
+
ultralightgrey: "#F5F5F5", // ultralight grey
|
|
41
|
+
},
|
|
42
|
+
height: {
|
|
43
|
+
innerControl: "12px",
|
|
44
|
+
inputControl: "20px",
|
|
45
|
+
},
|
|
46
|
+
margin: {
|
|
47
|
+
"4px": "4px",
|
|
48
|
+
"7px": "7px",
|
|
49
|
+
},
|
|
50
|
+
maxHeight: {
|
|
51
|
+
button: "40px",
|
|
52
|
+
},
|
|
53
|
+
maxWidth: {
|
|
54
|
+
button: "40px",
|
|
55
|
+
},
|
|
56
|
+
padding: {
|
|
57
|
+
1.75: "7px",
|
|
58
|
+
},
|
|
59
|
+
screens: {
|
|
60
|
+
large: "993px",
|
|
61
|
+
medium: "577px",
|
|
62
|
+
},
|
|
63
|
+
width: {
|
|
64
|
+
check: "6px",
|
|
65
|
+
innerControl: "12px",
|
|
66
|
+
inputControl: "20px",
|
|
67
|
+
largeMenu: "350px",
|
|
68
|
+
mediumMenu: "300px",
|
|
69
|
+
},
|
|
70
|
+
},
|
|
31
71
|
fontFamily: {
|
|
32
72
|
sans: [
|
|
33
73
|
"'Source Sans Pro'",
|
|
@@ -40,28 +80,10 @@ export default {
|
|
|
40
80
|
"2xl": getClamp(29, 39), // h2
|
|
41
81
|
"3xl": getClamp(35, 48), // h1
|
|
42
82
|
base: getClamp(16, 20), // p
|
|
83
|
+
button: getClamp(14, 18), // button
|
|
43
84
|
lg: getClamp(19, 25), // H4
|
|
44
85
|
sm: getClamp(13, 15), // small
|
|
45
86
|
xl: getClamp(24, 31), // h3
|
|
46
87
|
},
|
|
47
|
-
extend: {
|
|
48
|
-
colors: {
|
|
49
|
-
darkgray: "#464646", // dark grey
|
|
50
|
-
grey: "#7C7C7C", // grey
|
|
51
|
-
lightgrey: "#D0D0D0", // light grey
|
|
52
|
-
red: "#E3000B", // rvf rot
|
|
53
|
-
ultradarkgray: "#2D2D2C", // another grey with no name
|
|
54
|
-
ultralightgrey: "#F5F5F5", // ultralight grey
|
|
55
|
-
},
|
|
56
|
-
maxWidth: {
|
|
57
|
-
'button': '40px'
|
|
58
|
-
},
|
|
59
|
-
maxHeight: {
|
|
60
|
-
'button': '40px'
|
|
61
|
-
},
|
|
62
|
-
padding: {
|
|
63
|
-
'1.75': '7px'
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
88
|
},
|
|
67
89
|
};
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { getUid } from "ol";
|
|
2
|
-
import { GeoJSON } from "ol/format";
|
|
3
|
-
import VectorLayer from "ol/layer/Vector";
|
|
4
|
-
import { bbox as bboxStrategy } from "ol/loadingstrategy.js";
|
|
5
|
-
import { Vector } from "ol/source";
|
|
6
|
-
import { Circle, Fill, Stroke, Style, Text } from "ol/style";
|
|
7
|
-
import { useEffect, useMemo } from "preact/hooks";
|
|
8
|
-
|
|
9
|
-
import useMapContext from "../utils/hooks/useMapContext";
|
|
10
|
-
|
|
11
|
-
export default function RvfSharedMobilityLayer({
|
|
12
|
-
color,
|
|
13
|
-
minZoom = 16.999,
|
|
14
|
-
name,
|
|
15
|
-
url,
|
|
16
|
-
}: {
|
|
17
|
-
color: string;
|
|
18
|
-
minZoom?: number;
|
|
19
|
-
name: string;
|
|
20
|
-
url: string;
|
|
21
|
-
}) {
|
|
22
|
-
const { map } = useMapContext();
|
|
23
|
-
|
|
24
|
-
const layer = useMemo(() => {
|
|
25
|
-
if (!name || !url) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
const source = new Vector({
|
|
29
|
-
format: new GeoJSON(),
|
|
30
|
-
strategy: bboxStrategy,
|
|
31
|
-
url: function (extent) {
|
|
32
|
-
return (
|
|
33
|
-
url +
|
|
34
|
-
"?service=WFS&" +
|
|
35
|
-
"version=1.1.0&request=GetFeature&typename=" +
|
|
36
|
-
name +
|
|
37
|
-
"&" +
|
|
38
|
-
"outputFormat=application/json&srsname=EPSG:3857&" +
|
|
39
|
-
"bbox=" +
|
|
40
|
-
extent.join(",") +
|
|
41
|
-
",EPSG:3857"
|
|
42
|
-
);
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
const style = new Style({
|
|
46
|
-
image: new Circle({
|
|
47
|
-
declutterMode: "declutter",
|
|
48
|
-
fill: new Fill({
|
|
49
|
-
color: "white",
|
|
50
|
-
}),
|
|
51
|
-
radius: 10,
|
|
52
|
-
stroke: new Stroke({
|
|
53
|
-
color: color,
|
|
54
|
-
width: 2,
|
|
55
|
-
}),
|
|
56
|
-
}),
|
|
57
|
-
text: new Text({
|
|
58
|
-
declutterMode: "declutter",
|
|
59
|
-
|
|
60
|
-
fill: new Fill({
|
|
61
|
-
color: color,
|
|
62
|
-
}),
|
|
63
|
-
font: "bold 12px inherit",
|
|
64
|
-
// text: ["to-string", ["get", "num_vehicles_available"]],
|
|
65
|
-
}),
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
const styleFunction = (feature) => {
|
|
69
|
-
const clone = style.clone();
|
|
70
|
-
clone
|
|
71
|
-
.getText()
|
|
72
|
-
.setText(feature.get("num_vehicles_available")?.toString());
|
|
73
|
-
const isFreeFloat = !feature.get("num_vehicles_available")?.toString();
|
|
74
|
-
if (isFreeFloat) {
|
|
75
|
-
(clone.getImage() as Circle).setRadius(6);
|
|
76
|
-
}
|
|
77
|
-
clone.setZIndex(parseInt(getUid(feature), 10));
|
|
78
|
-
return clone;
|
|
79
|
-
};
|
|
80
|
-
const layer = new VectorLayer({
|
|
81
|
-
// declutter: true,
|
|
82
|
-
minZoom: minZoom,
|
|
83
|
-
source: source,
|
|
84
|
-
// style: (feature) => {
|
|
85
|
-
// console.log("feature", feature);
|
|
86
|
-
// style
|
|
87
|
-
// .getText()
|
|
88
|
-
// .setText(feature.get("num_vehicles_available").toString());
|
|
89
|
-
// return style;
|
|
90
|
-
// },
|
|
91
|
-
|
|
92
|
-
// style: {
|
|
93
|
-
// "circle-fill-color": "white",
|
|
94
|
-
// "circle-radius": 15,
|
|
95
|
-
// "circle-stroke-color": color,
|
|
96
|
-
// "circle-stroke-width": 2,
|
|
97
|
-
// // "fill-color": "rgba(100,100,100,0.25)",
|
|
98
|
-
// // "stroke-color": "white",
|
|
99
|
-
// // "stroke-width": 0.75,
|
|
100
|
-
// // "text-background-fill-color": "black",
|
|
101
|
-
// "text-fill-color": color,
|
|
102
|
-
// "text-font": "bold 12px sans-serif",
|
|
103
|
-
// "text-stroke-color": color,
|
|
104
|
-
// "text-value": ["to-string", ["get", "num_vehicles_available"]],
|
|
105
|
-
// },
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
source.on("addfeature", function (event) {
|
|
109
|
-
const feature = event.feature;
|
|
110
|
-
feature.setStyle(styleFunction);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
return layer;
|
|
114
|
-
}, [color, minZoom, name, url]);
|
|
115
|
-
|
|
116
|
-
// Reload features every minutes
|
|
117
|
-
useEffect(() => {
|
|
118
|
-
const interval = window.setInterval(() => {
|
|
119
|
-
// @ts-expect-error - private property
|
|
120
|
-
layer.getSource().loadedExtentsRtree_.clear();
|
|
121
|
-
// vectorSource.clear(true);
|
|
122
|
-
layer.getSource().changed();
|
|
123
|
-
}, 60000);
|
|
124
|
-
return () => {
|
|
125
|
-
window.clearInterval(interval);
|
|
126
|
-
};
|
|
127
|
-
}, [layer]);
|
|
128
|
-
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
if (!map || !layer) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
map.on("moveend", () => {
|
|
134
|
-
console.log("ZOOM", map.getView().getZoom());
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
// map.addLayer(layer);
|
|
138
|
-
layer.setMap(map);
|
|
139
|
-
|
|
140
|
-
return () => {
|
|
141
|
-
// map.removeLayer(layer);
|
|
142
|
-
layer.setMap(null);
|
|
143
|
-
};
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
return null;
|
|
147
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./RvfSharedMobilityLayer";
|