mobility-toolbox-js 2.0.0-beta.1 → 2.0.0-beta.6
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/.babelrc +6 -0
- package/.esdoc.json +17 -0
- package/.eslintignore +1 -0
- package/.github/workflows/conventional-pr-title.yml +21 -0
- package/.github/workflows/cypress.yml +29 -0
- package/.github/workflows/nodejs.yml +28 -0
- package/.husky/commit-msg +4 -0
- package/.husky/post-checkout +4 -0
- package/.husky/post-merge +4 -0
- package/.husky/post-rebase +4 -0
- package/.husky/pre-commit +4 -0
- package/.neutrinorc.js +176 -0
- package/.nvmrc +1 -0
- package/CHANGELOG.md +10 -0
- package/LICENSE +21 -0
- package/Layer.js +2 -0
- package/Layer.js.map +7 -0
- package/README.md +7 -4
- package/__mocks__/mapbox-gl.js +81 -0
- package/__mocks__/maplibre-gl.js +81 -0
- package/commitlint.config.js +1 -0
- package/cypress/fixtures/example.json +5 -0
- package/cypress/integration/examples/api.spec.js +7 -0
- package/cypress/integration/examples/examples.spec.js +7 -0
- package/cypress/integration/examples/navigation.spec.js +29 -0
- package/cypress/plugins/index.js +21 -0
- package/cypress/support/commands.js +25 -0
- package/cypress/support/index.js +20 -0
- package/cypress.json +4 -0
- package/data/fetchRoute.json +292 -0
- package/data/fetchTrajectories.json +18 -0
- package/data/fetchTrajectoryById.json +3 -0
- package/data/fetchTrajectoryStations.json +18 -0
- package/data/stopsSearch.json +15 -0
- package/documentation.yml +4 -0
- package/esdoc/README.md +27 -0
- package/esdoc/plugins/MyPlugin.js +69 -0
- package/esdoc/plugins/dynamic-property-plugin/Plugin.js +50 -0
- package/esdoc/plugins/externals-plugin/Plugin.js +45 -0
- package/esdoc/plugins/externals-plugin/externals.js +96 -0
- package/global-setup.js +3 -0
- package/{ol/README.md → index.html} +0 -0
- package/indexweb.html +49 -0
- package/jest.config.js +5 -0
- package/package.json +34 -13
- package/pull_request_template.md +17 -0
- package/renovate.json +4 -0
- package/scripts/read-pkg-json.js +22 -0
- package/{api → src/api}/index.js +0 -1
- package/{api → src/api}/routing/RoutingAPI.js +0 -0
- package/{api → src/api}/routing/RoutingAPI.test.js +0 -0
- package/{api → src/api}/stops/StopsAPI.js +0 -0
- package/{api → src/api}/stops/StopsAPI.test.js +0 -0
- package/{api → src/api}/tralis/TralisAPI.js +1 -1
- package/{api → src/api}/tralis/TralisAPI.test.js +0 -0
- package/{api → src/api}/tralis/TralisAPIUtils.js +0 -0
- package/{api → src/api}/tralis/WebSocketConnector.js +0 -0
- package/{api → src/api}/tralis/WebSocketConnector.test.js +0 -0
- package/{api → src/api}/tralis/typedefs.js +0 -0
- package/src/assets/Lato-Black.ttf +0 -0
- package/src/assets/Lato-BlackItalic.ttf +0 -0
- package/src/assets/Lato-Bold.ttf +0 -0
- package/src/assets/Lato-BoldItalic.ttf +0 -0
- package/src/assets/Lato-Italic.ttf +0 -0
- package/src/assets/Lato-Light.ttf +0 -0
- package/src/assets/Lato-LightItalic.ttf +0 -0
- package/src/assets/Lato-Regular.ttf +0 -0
- package/src/assets/Lato-Thin.ttf +0 -0
- package/src/assets/Lato-ThinItalic.ttf +0 -0
- package/src/assets/OFL.txt +93 -0
- package/{common → src/common}/Tracker.js +0 -0
- package/{common → src/common}/api/api.js +0 -0
- package/{common → src/common}/api/api.test.js +0 -0
- package/{common → src/common}/controls/Control.js +4 -1
- package/{common → src/common}/controls/Control.test.js +0 -0
- package/{common → src/common}/layers/Layer.js +18 -49
- package/{common → src/common}/layers/Layer.test.js +2 -106
- package/{common → src/common}/mixins/CopyrightMixin.js +0 -0
- package/{common → src/common}/mixins/SearchMixin.js +1 -1
- package/{common/mixins/TrackerLayerMixin.js → src/common/mixins/TralisLayerMixin.js} +380 -195
- package/src/common/styles/index.js +4 -0
- package/{common/utils/delayTrackerStyle.js → src/common/styles/trackerDefaultStyle.js} +8 -8
- package/src/common/styles/trackerDelayStyle.js +17 -0
- package/src/common/styles/trackerSimpleStyle.js +22 -0
- package/{common → src/common}/trackerConfig.js +0 -0
- package/{common → src/common}/trackerConfig.test.js +0 -13
- package/{common → src/common}/typedefs.js +0 -0
- package/{common → src/common}/utils/createTrackerFilters.js +0 -0
- package/{common → src/common}/utils/createTrackerFilters.test.js +0 -0
- package/{common → src/common}/utils/getMapboxMapCopyrights.js +1 -0
- package/{common → src/common}/utils/getMapboxMapCopyrights.test.js +0 -0
- package/{common → src/common}/utils/getMapboxStyleUrl.js +0 -0
- package/{common → src/common}/utils/getVehiclePosition.js +0 -0
- package/{common → src/common}/utils/index.js +2 -3
- package/{common → src/common}/utils/removeDuplicate.js +0 -0
- package/{common → src/common}/utils/removeDuplicate.test.js +0 -0
- package/src/common/utils/sortByDelay.js +23 -0
- package/{common → src/common}/utils/timeUtils.js +0 -0
- package/{common → src/common}/utils/timeUtils.test.js +0 -0
- package/src/doc/App.js +116 -0
- package/src/doc/App.scss +51 -0
- package/src/doc/_redirects +2 -0
- package/src/doc/components/CodeSandboxButton.js +103 -0
- package/src/doc/components/Documentation.js +40 -0
- package/src/doc/components/Esdoc/Anchor.js +57 -0
- package/src/doc/components/Esdoc/ClassDoc.js +272 -0
- package/src/doc/components/Esdoc/DeprecatedHTML.js +16 -0
- package/src/doc/components/Esdoc/DetailDocs.js +281 -0
- package/src/doc/components/Esdoc/DetailHTML.js +33 -0
- package/src/doc/components/Esdoc/DirectSubclassHTML.js +30 -0
- package/src/doc/components/Esdoc/DocBuilderUtils.js +694 -0
- package/src/doc/components/Esdoc/DocLinkHTML.js +62 -0
- package/src/doc/components/Esdoc/DocsLinkHTML.js +38 -0
- package/src/doc/components/Esdoc/Esdoc.js +63 -0
- package/src/doc/components/Esdoc/EsdocContent.js +51 -0
- package/src/doc/components/Esdoc/EsdocNavigation.js +13 -0
- package/src/doc/components/Esdoc/EsdocSearch.js +81 -0
- package/src/doc/components/Esdoc/ExperimentalHTML.js +17 -0
- package/src/doc/components/Esdoc/ExtendsChainHTML.js +32 -0
- package/src/doc/components/Esdoc/FileDocLinkHTML.js +60 -0
- package/src/doc/components/Esdoc/IdentifiersDoc.js +113 -0
- package/src/doc/components/Esdoc/IndirectSubclassHTML.js +30 -0
- package/src/doc/components/Esdoc/InheritedSummaryDoc.js +70 -0
- package/src/doc/components/Esdoc/InheritedSummaryHTML.js +38 -0
- package/src/doc/components/Esdoc/MixinClassesHTML.js +29 -0
- package/src/doc/components/Esdoc/NavDoc.js +112 -0
- package/src/doc/components/Esdoc/OverrideMethod.js +44 -0
- package/src/doc/components/Esdoc/OverrideMethodDescription.js +35 -0
- package/src/doc/components/Esdoc/Properties.js +89 -0
- package/src/doc/components/Esdoc/README.md +45 -0
- package/src/doc/components/Esdoc/SignatureHTML.js +123 -0
- package/src/doc/components/Esdoc/SingleDoc.js +31 -0
- package/src/doc/components/Esdoc/SummaryDoc.js +160 -0
- package/src/doc/components/Esdoc/SummaryHTML.js +96 -0
- package/src/doc/components/Esdoc/TypeDocLinkHTML.js +249 -0
- package/src/doc/components/Esdoc/css/identifiers.css +38 -0
- package/src/doc/components/Esdoc/css/search.css +76 -0
- package/src/doc/components/Esdoc/css/style.css +603 -0
- package/src/doc/components/Esdoc/index.js +7 -0
- package/src/doc/components/Example.js +153 -0
- package/src/doc/components/Examples.js +183 -0
- package/src/doc/components/Home.js +106 -0
- package/src/doc/components/TrackerExample.js +38 -0
- package/src/doc/components/esm.min.js +2 -0
- package/src/doc/components/examples/assets/tralis-live-map/index.js +11 -0
- package/src/doc/components/examples/assets/tralis-live-map/s1kreis.svg +105 -0
- package/src/doc/components/examples/assets/tralis-live-map/s20kreis.svg +101 -0
- package/src/doc/components/examples/assets/tralis-live-map/s2kreis.svg +95 -0
- package/src/doc/components/examples/assets/tralis-live-map/s3kreis.svg +95 -0
- package/src/doc/components/examples/assets/tralis-live-map/s4kreis.svg +95 -0
- package/src/doc/components/examples/assets/tralis-live-map/s6kreis.svg +95 -0
- package/src/doc/components/examples/assets/tralis-live-map/s7kreis.svg +95 -0
- package/src/doc/components/examples/assets/tralis-live-map/s8kreis.svg +93 -0
- package/src/doc/components/examples/assets/tralis-live-map/unknown.svg +107 -0
- package/src/doc/components/examples/mb-copyright.html +26 -0
- package/src/doc/components/examples/mb-copyright.js +37 -0
- package/src/doc/components/examples/mb-tracker.html +1 -0
- package/src/doc/components/examples/mb-tracker.js +39 -0
- package/src/doc/components/examples/mb-tracker.md +1 -0
- package/src/doc/components/examples/mb-tralis.html +1 -0
- package/src/doc/components/examples/mb-tralis.js +34 -0
- package/src/doc/components/examples/ol-copyright.html +26 -0
- package/src/doc/components/examples/ol-copyright.js +43 -0
- package/src/doc/components/examples/ol-mapbox-layer.html +1 -0
- package/src/doc/components/examples/ol-mapbox-layer.js +28 -0
- package/src/doc/components/examples/ol-mapbox-layer.md +0 -0
- package/src/doc/components/examples/ol-mapbox-style-layer.html +12 -0
- package/src/doc/components/examples/ol-mapbox-style-layer.js +44 -0
- package/src/doc/components/examples/ol-query.html +32 -0
- package/src/doc/components/examples/ol-query.js +83 -0
- package/src/doc/components/examples/ol-routing.html +26 -0
- package/src/doc/components/examples/ol-routing.js +59 -0
- package/src/doc/components/examples/ol-routing.md +1 -0
- package/src/doc/components/examples/ol-stop-finder.html +15 -0
- package/src/doc/components/examples/ol-stop-finder.js +31 -0
- package/src/doc/components/examples/ol-stop-finder.md +1 -0
- package/src/doc/components/examples/ol-tracker.html +1 -0
- package/src/doc/components/examples/ol-tracker.js +44 -0
- package/src/doc/components/examples/ol-tracker.md +1 -0
- package/src/doc/components/examples/ol-tralis.html +5 -0
- package/src/doc/components/examples/ol-tralis.js +57 -0
- package/src/doc/components/examples/tralis-live-map.html +1 -0
- package/src/doc/components/examples/tralis-live-map.js +51 -0
- package/src/doc/components/examples/tralis-live-map.md +3 -0
- package/src/doc/examples/assets/tralis-live-map/index.js +11 -0
- package/src/doc/examples/assets/tralis-live-map/s1kreis.svg +105 -0
- package/src/doc/examples/assets/tralis-live-map/s20kreis.svg +101 -0
- package/src/doc/examples/assets/tralis-live-map/s2kreis.svg +95 -0
- package/src/doc/examples/assets/tralis-live-map/s3kreis.svg +95 -0
- package/src/doc/examples/assets/tralis-live-map/s4kreis.svg +95 -0
- package/src/doc/examples/assets/tralis-live-map/s6kreis.svg +95 -0
- package/src/doc/examples/assets/tralis-live-map/s7kreis.svg +95 -0
- package/src/doc/examples/assets/tralis-live-map/s8kreis.svg +93 -0
- package/src/doc/examples/assets/tralis-live-map/unknown.svg +107 -0
- package/src/doc/examples/mb-copyright.html +26 -0
- package/src/doc/examples/mb-copyright.js +37 -0
- package/src/doc/examples/mb-tracker.html +1 -0
- package/src/doc/examples/mb-tracker.js +39 -0
- package/src/doc/examples/mb-tracker.md +1 -0
- package/src/doc/examples/mb-tralis.html +1 -0
- package/src/doc/examples/mb-tralis.js +34 -0
- package/src/doc/examples/ol-copyright.html +26 -0
- package/src/doc/examples/ol-copyright.js +43 -0
- package/src/doc/examples/ol-mapbox-layer.html +1 -0
- package/src/doc/examples/ol-mapbox-layer.js +28 -0
- package/src/doc/examples/ol-mapbox-layer.md +0 -0
- package/src/doc/examples/ol-mapbox-style-layer.html +12 -0
- package/src/doc/examples/ol-mapbox-style-layer.js +44 -0
- package/src/doc/examples/ol-query.html +32 -0
- package/src/doc/examples/ol-query.js +83 -0
- package/src/doc/examples/ol-routing.html +26 -0
- package/src/doc/examples/ol-routing.js +59 -0
- package/src/doc/examples/ol-routing.md +1 -0
- package/src/doc/examples/ol-stop-finder.html +15 -0
- package/src/doc/examples/ol-stop-finder.js +31 -0
- package/src/doc/examples/ol-stop-finder.md +1 -0
- package/src/doc/examples/ol-tracker.html +1 -0
- package/src/doc/examples/ol-tracker.js +44 -0
- package/src/doc/examples/ol-tracker.md +1 -0
- package/src/doc/examples/ol-tralis.html +5 -0
- package/src/doc/examples/ol-tralis.js +57 -0
- package/src/doc/examples/tralis-live-map.html +1 -0
- package/src/doc/examples/tralis-live-map.js +51 -0
- package/src/doc/examples/tralis-live-map.md +3 -0
- package/src/doc/examples.js +107 -0
- package/src/doc/img/examples/live_tracker_mb.jpg +0 -0
- package/src/doc/img/examples/live_tracker_munich.jpg +0 -0
- package/src/doc/img/examples/live_tracker_ol.jpg +0 -0
- package/src/doc/img/examples/mapbox.jpg +0 -0
- package/src/doc/img/examples/mapbox_style.jpg +0 -0
- package/src/doc/img/examples/ol-copyright.png +0 -0
- package/src/doc/img/examples/query_objects.jpg +0 -0
- package/src/doc/img/examples/routing.jpg +0 -0
- package/src/doc/img/examples/simple_map.jpg +0 -0
- package/src/doc/img/examples/stops.jpg +0 -0
- package/src/doc/img/favico.ico +0 -0
- package/src/doc/index.js +21 -0
- package/src/iife.js +7 -0
- package/{module.js → src/index.js} +3 -9
- package/{mapbox → src/mapbox}/controls/CopyrightControl.js +5 -1
- package/{mapbox → src/mapbox}/index.js +0 -2
- package/{mapbox → src/mapbox}/layers/Layer.js +0 -0
- package/{mapbox → src/mapbox}/layers/Layer.test.js +2 -2
- package/{mapbox/layers/TrackerLayer.js → src/mapbox/layers/TralisLayer.js} +71 -24
- package/src/mapbox/layers/TralisLayer.test.js +40 -0
- package/{mapbox → src/mapbox}/utils.js +0 -0
- package/src/ol/README.md +0 -0
- package/{ol → src/ol}/controls/CopyrightControl.js +4 -4
- package/{ol → src/ol}/controls/CopyrightControl.test.js +16 -16
- package/{ol → src/ol}/controls/RoutingControl.js +9 -7
- package/{ol → src/ol}/controls/RoutingControl.test.js +1 -1
- package/{ol → src/ol}/controls/StopFinderControl.js +8 -6
- package/{ol → src/ol}/controls/StopFinderControl.test.js +1 -1
- package/{ol → src/ol}/controls/snapshots/RoutingControlRouteGen10.json +0 -0
- package/{ol → src/ol}/controls/snapshots/RoutingControlRouteGen100.json +0 -0
- package/{ol → src/ol}/controls/snapshots/RoutingControlRouteGen30.json +0 -0
- package/{ol → src/ol}/controls/snapshots/RoutingControlRouteGen5.json +0 -0
- package/{ol → src/ol}/controls/snapshots/RoutingControlRouteOSM.json +0 -0
- package/{ol → src/ol}/controls/snapshots/RoutingControlStation1.json +0 -0
- package/{ol → src/ol}/controls/snapshots/RoutingControlStation2.json +0 -0
- package/{ol → src/ol}/index.js +3 -3
- package/{ol → src/ol}/layers/Layer.js +9 -0
- package/{ol → src/ol}/layers/Layer.test.js +22 -7
- package/{ol → src/ol}/layers/MapboxLayer.js +39 -44
- package/{ol → src/ol}/layers/MapboxLayer.test.js +5 -5
- package/{ol → src/ol}/layers/MapboxStyleLayer.js +0 -6
- package/{ol → src/ol}/layers/MapboxStyleLayer.test.js +22 -6
- package/src/ol/layers/MaplibreLayer.js +280 -0
- package/{ol → src/ol}/layers/RoutingLayer.js +0 -0
- package/{ol → src/ol}/layers/RoutingLayer.test.js +1 -1
- package/{ol/layers/TrackerLayer.js → src/ol/layers/TralisLayer.js} +96 -33
- package/{ol → src/ol}/layers/TralisLayer.test.js +1 -49
- package/{ol → src/ol}/layers/VectorLayer.js +0 -0
- package/{ol → src/ol}/layers/VectorLayer.test.js +1 -1
- package/{ol → src/ol}/layers/WMSLayer.js +0 -0
- package/{ol → src/ol}/layers/WMSLayer.test.js +6 -2
- package/src/ol/styles/fullTrajectoryDelayStyle.js +35 -0
- package/src/ol/styles/fullTrajectoryStyle.js +51 -0
- package/src/ol/styles/index.js +2 -0
- package/src/setupTests.js +15 -0
- package/webpack.config.js +6 -0
- package/api/trajserv/TrajservAPI.js +0 -71
- package/api/trajserv/TrajservAPI.test.js +0 -171
- package/api/trajserv/TrajservAPIUtils.js +0 -191
- package/api/trajserv/TrajservAPIUtils.test.js +0 -40
- package/api/trajserv/typedefs.js +0 -44
- package/common/mixins/MapMixin.js +0 -103
- package/common/mixins/TrajservLayerMixin.js +0 -544
- package/common/mixins/TralisLayerMixin.js +0 -402
- package/common/utils/simpleTrackerStyle.js +0 -18
- package/index.js +0 -2
- package/index.js.map +0 -1
- package/mapbox/Map.js +0 -87
- package/mapbox/layers/TrackerLayer.test.js +0 -68
- package/mapbox/layers/TrajservLayer.js +0 -114
- package/mapbox/layers/TrajservLayer.test.js +0 -90
- package/mapbox/layers/TralisLayer.js +0 -64
- package/ol/Map.js +0 -109
- package/ol/Map.test.js +0 -34
- package/ol/layers/TrackerLayer.test.js +0 -70
- package/ol/layers/TrajservLayer.js +0 -190
- package/ol/layers/TrajservLayer.test.js +0 -113
- package/ol/layers/TralisLayer.js +0 -177
package/indexweb.html
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<title>Parcel Sandbox</title>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link
|
|
6
|
+
rel="stylesheet"
|
|
7
|
+
href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.14.1/css/ol.css"
|
|
8
|
+
type="text/css"
|
|
9
|
+
/>
|
|
10
|
+
<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.14.1/build/ol.js"></script>
|
|
11
|
+
<script src="./build/mbt.js"></script>
|
|
12
|
+
</head>
|
|
13
|
+
|
|
14
|
+
<body>
|
|
15
|
+
<div id="app">
|
|
16
|
+
<div id="map" style="width: 600px; height: 600px"></div>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
const map = new ol.Map({
|
|
21
|
+
target: 'map',
|
|
22
|
+
view: new ol.View({
|
|
23
|
+
center: [831634, 5933959],
|
|
24
|
+
zoom: 13,
|
|
25
|
+
}),
|
|
26
|
+
controls: [],
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const layer = new mbt.ol.MaplibreLayer({
|
|
30
|
+
url: 'https://maps.geops.io/styles/travic_v2/style.json',
|
|
31
|
+
apiKey: '5cc87b12d7c5370001c1d6554840ecb89d2743d2b0aad0588b8ba7eb',
|
|
32
|
+
});
|
|
33
|
+
layer.init(map);
|
|
34
|
+
|
|
35
|
+
const tracker = new mbt.ol.TralisLayer({
|
|
36
|
+
url: 'wss://api.geops.io/tracker-ws/v1/',
|
|
37
|
+
apiKey: '5cc87b12d7c5370001c1d6554840ecb89d2743d2b0aad0588b8ba7eb',
|
|
38
|
+
});
|
|
39
|
+
tracker.init(map);
|
|
40
|
+
|
|
41
|
+
tracker.onClick(([feature]) => {
|
|
42
|
+
if (feature) {
|
|
43
|
+
// eslint-disable-next-line no-console
|
|
44
|
+
console.log(feature.getProperties());
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
</script>
|
|
48
|
+
</body>
|
|
49
|
+
</html>
|
package/jest.config.js
ADDED
package/package.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"name": "mobility-toolbox-js",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"description": "Toolbox for JavaScript applications in the domains of mobility and logistics.",
|
|
5
|
-
"version": "2.0.0-beta.
|
|
5
|
+
"version": "2.0.0-beta.6",
|
|
6
6
|
"main": "index.js",
|
|
7
|
-
"module": "
|
|
7
|
+
"module": "esm.js",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@geops/geops-ui": "0.1.13",
|
|
10
10
|
"@material-ui/core": "4.12.3",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"path": "^0.12.7",
|
|
19
19
|
"prop-types": "15.8.1",
|
|
20
20
|
"query-string": "7.1.0",
|
|
21
|
-
"react": "
|
|
21
|
+
"react": "18",
|
|
22
22
|
"react-app-polyfill": "^1.0.6",
|
|
23
|
-
"react-dom": "
|
|
23
|
+
"react-dom": "18",
|
|
24
24
|
"react-icons": "4.3.1",
|
|
25
25
|
"react-markdown": "8.0.0",
|
|
26
26
|
"react-router-dom": "6",
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
"uuid": "8.3.2"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"
|
|
35
|
+
"mapbox-gl": "^1",
|
|
36
|
+
"maplibre-gl": "^1",
|
|
36
37
|
"ol": "^6"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
@@ -41,6 +42,8 @@
|
|
|
41
42
|
"@babel/plugin-transform-runtime": "7.16.10",
|
|
42
43
|
"@babel/preset-env": "^7.16.11",
|
|
43
44
|
"@babel/preset-react": "7.16.7",
|
|
45
|
+
"@commitlint/cli": "17.0.2",
|
|
46
|
+
"@commitlint/config-conventional": "17.0.2",
|
|
44
47
|
"@neutrinojs/copy": "9.5.0",
|
|
45
48
|
"@neutrinojs/jest": "^9.5.0",
|
|
46
49
|
"@neutrinojs/library": "9.5.0",
|
|
@@ -48,6 +51,7 @@
|
|
|
48
51
|
"autoprefixer": "9.7.6",
|
|
49
52
|
"cypress": "9.4.1",
|
|
50
53
|
"deepmerge": "4.2.2",
|
|
54
|
+
"esbuild": "^0.14.47",
|
|
51
55
|
"esdoc": "1.1.0",
|
|
52
56
|
"esdoc-ecmascript-proposal-plugin": "1.0.0",
|
|
53
57
|
"esdoc-publish-html-plugin": "1.1.2",
|
|
@@ -63,13 +67,14 @@
|
|
|
63
67
|
"eslint-plugin-react": "7.28.0",
|
|
64
68
|
"eslint-plugin-react-hooks": "4.3.0",
|
|
65
69
|
"fixpack": "3.0.6",
|
|
66
|
-
"husky": "
|
|
70
|
+
"husky": "8.0.1",
|
|
67
71
|
"jest": "26.6.3",
|
|
68
72
|
"jest-canvas-mock": "2.3.1",
|
|
69
73
|
"jest-fetch-mock": "3.0.3",
|
|
70
74
|
"jest-serializer-html": "7.1.0",
|
|
71
75
|
"jest-websocket-mock": "2.3.0",
|
|
72
76
|
"lint-staged": "12.3.3",
|
|
77
|
+
"mapbox-gl": "1.13.2",
|
|
73
78
|
"maplibre-gl": "2.1.9",
|
|
74
79
|
"mock-socket": "9.1.2",
|
|
75
80
|
"neutrino": "9.5.0",
|
|
@@ -80,6 +85,7 @@
|
|
|
80
85
|
"sass": "1.52.2",
|
|
81
86
|
"sass-loader": "8.0.2",
|
|
82
87
|
"sort-json": "2.0.0",
|
|
88
|
+
"standard-version": "9.5.0",
|
|
83
89
|
"start-server-and-test": "1.14.0",
|
|
84
90
|
"stylelint": "14.3.0",
|
|
85
91
|
"stylelint-config-recommended-scss": "5.0.2",
|
|
@@ -104,12 +110,30 @@
|
|
|
104
110
|
"lib:dev": "REACT_APP_LIB_MODE=1 webpack --mode development",
|
|
105
111
|
"link2": "cmdToAdd=$(node ./scripts/read-pkg-json.js add) && $cmdToAdd && yarn build && cmdToRemove=$(node ./scripts/read-pkg-json.js remove) && $cmdToRemove && cd build && yarn link",
|
|
106
112
|
"lint": "eslint 'src/**/*.js' && stylelint 'src/**/*.css' 'src/**/*.scss'",
|
|
107
|
-
"publish:beta": "HUSKY=0 yarn publish
|
|
108
|
-
"publish:
|
|
113
|
+
"publish:beta": "HUSKY=0 yarn release -- --prerelease beta --skip.changelog && git push origin HEAD && yarn run esbuild && cd build && git push --tags && HUSKY=0 yarn publish --tag beta",
|
|
114
|
+
"publish:beta:dryrun": "yarn release -- --prerelease beta --dry-run --skip.changelog",
|
|
115
|
+
"publish:public": "yarn release && git push origin HEAD && yarn run esbuild && cd build && git push --tags && yarn publish",
|
|
116
|
+
"publish:public:dryrun": "yarn release --dry-run",
|
|
117
|
+
"release": "standard-version",
|
|
109
118
|
"start": "yarn doc && webpack-dev-server --mode development --open",
|
|
110
119
|
"start:examples": "webpack-dev-server --mode development --open",
|
|
111
120
|
"test": "REACT_APP_LIB_MODE=1 jest",
|
|
112
|
-
"test:watch": "yarn test --watchAll"
|
|
121
|
+
"test:watch": "yarn test --watchAll",
|
|
122
|
+
"esbuild": "yarn esbuild:all && yarn esbuild:esm && yarn esbuild:iife",
|
|
123
|
+
"esbuild:all": "esbuild src/index.js src/**/*.js src/**/**/*.js --target=chrome100 --outdir=build/ --loader:.js=jsx",
|
|
124
|
+
"esbuild:esm": "yarn esbuild:esm:unminify && yarn esbuild:esm:minify",
|
|
125
|
+
"esbuild:esm:base": "esbuild src/index.js --bundle --sourcemap --target=chrome100 --format=esm --external:mapbox-gl --external:ol --external:maplibre-gl",
|
|
126
|
+
"esbuild:esm:unminify": "yarn esbuild:esm:base --outfile=build/esm.js",
|
|
127
|
+
"esbuild:esm:minify": "yarn esbuild:esm:base --minify --outfile=build/esm.min.js ",
|
|
128
|
+
"esbuild:esm:ol": "yarn esbuild:esm:ol:unminify && yarn esbuild:esm:ol:minify",
|
|
129
|
+
"esbuild:esm:ol:base": "esbuild src/ol/index.js --bundle --sourcemap --target=chrome100 --format=esm --external:mapbox-gl --external:ol --external:maplibre-gl",
|
|
130
|
+
"esbuild:esm:ol:unminify": "yarn esbuild:esm:ol:base --outfile=build/esm-ol.js",
|
|
131
|
+
"esbuild:esm:ol:minify": "yarn esbuild:esm:ol:base --minify --outfile=build/esm-ol.min.js ",
|
|
132
|
+
"esbuild:iife": "yarn esbuild:iife:unminify && yarn esbuild:iife:minify",
|
|
133
|
+
"esbuild:iife:base": "esbuild src/iife.js --bundle --sourcemap --target=chrome100",
|
|
134
|
+
"esbuild:iife:minify": "yarn esbuild:iife:base --minify --outfile=build/mbt.min.js",
|
|
135
|
+
"esbuild:iife:unminify": "yarn esbuild:iife:base --outfile=build/mbt.js",
|
|
136
|
+
"esbuild:file": "npx esbuild src/**/*.js src/**/**/*.js --target=chrome100 --outdir=build/ --loader:.js=jsx"
|
|
113
137
|
},
|
|
114
138
|
"browserslist": {
|
|
115
139
|
"production": [
|
|
@@ -164,10 +188,7 @@
|
|
|
164
188
|
},
|
|
165
189
|
"exports": {
|
|
166
190
|
".": "./index.js",
|
|
167
|
-
"./module": "./module.js",
|
|
168
191
|
"./api": "./api/index.js",
|
|
169
|
-
"./common/trackerConfig": "./common/trackerConfig.js",
|
|
170
|
-
"./common/utils": "./common/utils/index.js",
|
|
171
192
|
"./mapbox": "./mapbox/index.js",
|
|
172
193
|
"./ol": "./ol/index.js"
|
|
173
194
|
},
|
|
@@ -183,7 +204,7 @@
|
|
|
183
204
|
"yarn test --bail --findRelatedTests"
|
|
184
205
|
],
|
|
185
206
|
"package.json": [
|
|
186
|
-
"fixpack --sortToTop name --sortToTop license --sortToTop description --sortToTop version --sortToTop author --sortToTop main --sortToTop module --sortToTop files --sortToTop proxy --sortToTop dependencies --sortToTop peerDependencies --sortToTop devDependencies --sortToTop resolutions --sortToTop scripts"
|
|
207
|
+
"fixpack --sortToTop name --sortToTop license --sortToTop description --sortToTop version --sortToTop author --sortToTop main --sortToTop module --sortToTop files --sortToTop exports --sortToTop proxy --sortToTop dependencies --sortToTop peerDependencies --sortToTop devDependencies --sortToTop resolutions --sortToTop scripts"
|
|
187
208
|
],
|
|
188
209
|
"src/**/*.{css,scss}": [
|
|
189
210
|
"stylelint --fix"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# How to
|
|
2
|
+
|
|
3
|
+
<!-- Please provide a test link and quick description how to see the change -->
|
|
4
|
+
|
|
5
|
+
# Others
|
|
6
|
+
|
|
7
|
+
<!-- Thanks for the PR! Feel free to add or remove items if there are not necessary. -->
|
|
8
|
+
|
|
9
|
+
- [ ] It's not a hack or at least an unauthorized hack :).
|
|
10
|
+
- [ ] The images added are optimized.
|
|
11
|
+
- [ ] Everything in ticket description has been fixed.
|
|
12
|
+
- [ ] The author of the MR has made its own review before assigning the reviewer.
|
|
13
|
+
- [ ] The title means something for a human being and follows the [conventional commits](https://www.conventionalcommits.org/) specification.
|
|
14
|
+
- [ ] The title contains [WIP] if it's necessary.
|
|
15
|
+
- [ ] Labels applied. if it's a release? a hotfix?
|
|
16
|
+
- [ ] The new class' members & methods are well documented
|
|
17
|
+
- [ ] Tests added.
|
package/renovate.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
const pjson = require('../package.json');
|
|
3
|
+
|
|
4
|
+
const { peerDependencies } = pjson;
|
|
5
|
+
|
|
6
|
+
const packageKeys = Object.keys(peerDependencies);
|
|
7
|
+
|
|
8
|
+
const arg = process.argv[2];
|
|
9
|
+
|
|
10
|
+
if (arg === 'add') {
|
|
11
|
+
console.log(
|
|
12
|
+
`yarn add ${packageKeys
|
|
13
|
+
.map((p) => `${p}@${peerDependencies[p]}`)
|
|
14
|
+
.join(' ')}`,
|
|
15
|
+
);
|
|
16
|
+
} else if (arg === 'remove') {
|
|
17
|
+
console.log(
|
|
18
|
+
`rm -rf ${packageKeys.map((p) => `node_modules/${p}`).join(' ')}`,
|
|
19
|
+
);
|
|
20
|
+
} else {
|
|
21
|
+
console.log('echo "wrong argument."');
|
|
22
|
+
}
|
package/{api → src/api}/index.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -81,7 +81,7 @@ class TralisAPI {
|
|
|
81
81
|
const conn = new WebSocketConnector();
|
|
82
82
|
|
|
83
83
|
if (apiKey) {
|
|
84
|
-
url = `${url || 'wss://
|
|
84
|
+
url = `${url || 'wss://api.geops.io/tracker-ws/v1/'}?key=${apiKey}`;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
Object.defineProperties(this, {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright (c) 2010-2014 by tyPoland Lukasz Dziedzic (team@latofonts.com) with Reserved Font Name "Lato"
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -74,7 +74,10 @@ class Control extends BaseObject {
|
|
|
74
74
|
|
|
75
75
|
if (this.map) {
|
|
76
76
|
// Add new node
|
|
77
|
-
const targett =
|
|
77
|
+
const targett =
|
|
78
|
+
this.target ||
|
|
79
|
+
(this.map.getTargetElement && this.map.getTargetElement()) ||
|
|
80
|
+
(this.map.getContainer && this.map.getContainer());
|
|
78
81
|
|
|
79
82
|
if (!this.element) {
|
|
80
83
|
this.createDefaultElement();
|
|
File without changes
|
|
@@ -16,7 +16,7 @@ import { v4 as uuid } from 'uuid';
|
|
|
16
16
|
* @classproperty {boolean} isQueryable - Define if the layer can be queried. If false, it will set isHoverActive and isClickActive to false. Read-only.
|
|
17
17
|
* @classproperty {boolean} isClickActive - If true feature information will be queried on user click event. See inherited layers for more informations. Read-only.
|
|
18
18
|
* @classproperty {boolean} isHoverActive - If true feature information will be queried on pointer move event. See inherited layers for more informations. Read-only.
|
|
19
|
-
* @classproperty {boolean}
|
|
19
|
+
* @classproperty {boolean} isMobilityLayer - Custom property for duck typing since `instanceof` is not working when the instance was created on different bundles. Read-only.
|
|
20
20
|
* @classproperty {Layer[]} children - List of children.
|
|
21
21
|
* @classproperty {boolean} visible - Define if the layer is visible or not.
|
|
22
22
|
* @classproperty {number} hitTolerance - Hit-detection tolerance in css pixels. Pixels inside the radius around the given position will be checked for features.
|
|
@@ -109,12 +109,15 @@ export default class Layer extends Observable {
|
|
|
109
109
|
},
|
|
110
110
|
isQueryable: {
|
|
111
111
|
value: !!isQueryable,
|
|
112
|
+
writable: true,
|
|
112
113
|
},
|
|
113
114
|
isClickActive: {
|
|
114
115
|
value: !!isQueryable && !!isClickActive,
|
|
116
|
+
writable: true,
|
|
115
117
|
},
|
|
116
118
|
isHoverActive: {
|
|
117
119
|
value: !!isQueryable && !!isHoverActive,
|
|
120
|
+
writable: true,
|
|
118
121
|
},
|
|
119
122
|
hitTolerance: {
|
|
120
123
|
value: hitTolerance || 5,
|
|
@@ -122,7 +125,7 @@ export default class Layer extends Observable {
|
|
|
122
125
|
},
|
|
123
126
|
// Custom property for duck typing since `instanceof` is not working
|
|
124
127
|
// when the instance was created on different bundles.
|
|
125
|
-
|
|
128
|
+
isMobilityLayer: {
|
|
126
129
|
value: true,
|
|
127
130
|
},
|
|
128
131
|
children: {
|
|
@@ -197,11 +200,13 @@ export default class Layer extends Observable {
|
|
|
197
200
|
* @param {string} value Value.
|
|
198
201
|
*/
|
|
199
202
|
set(name, value) {
|
|
200
|
-
this.properties[name]
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
if (value !== this.properties[name]) {
|
|
204
|
+
this.properties[name] = value;
|
|
205
|
+
this.dispatchEvent({
|
|
206
|
+
type: `change:${name}`,
|
|
207
|
+
target: this,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
205
210
|
}
|
|
206
211
|
|
|
207
212
|
/**
|
|
@@ -250,48 +255,7 @@ export default class Layer extends Observable {
|
|
|
250
255
|
* @deprecated
|
|
251
256
|
*/
|
|
252
257
|
hasVisibleChildren() {
|
|
253
|
-
return !!this.
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Checks whether the layer has any child layers with visible equal to the input parameter
|
|
258
|
-
*
|
|
259
|
-
* @param {boolean} visible The state to check the childlayers against
|
|
260
|
-
* @return {boolean} True if the layer has children with the given visibility
|
|
261
|
-
*/
|
|
262
|
-
hasChildren(visible) {
|
|
263
|
-
return !!this.children.find((child) => child.visible === visible);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* Add a child layer
|
|
268
|
-
*
|
|
269
|
-
* @param {Layer} layer Add a child layer
|
|
270
|
-
*/
|
|
271
|
-
addChild(layer) {
|
|
272
|
-
this.children.unshift(layer);
|
|
273
|
-
this.dispatchEvent({
|
|
274
|
-
type: `change:children`,
|
|
275
|
-
target: this,
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Removes a child layer by layer name
|
|
281
|
-
*
|
|
282
|
-
* @param {string} name Layer's name
|
|
283
|
-
*/
|
|
284
|
-
removeChild(name) {
|
|
285
|
-
for (let i = 0; i < this.children.length; i += 1) {
|
|
286
|
-
if (this.children[i].name === name) {
|
|
287
|
-
this.children.splice(i, 1);
|
|
288
|
-
break;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
this.dispatchEvent({
|
|
292
|
-
type: `change:children`,
|
|
293
|
-
target: this,
|
|
294
|
-
});
|
|
258
|
+
return !!this.children.find((child) => child.visible === true);
|
|
295
259
|
}
|
|
296
260
|
|
|
297
261
|
/**
|
|
@@ -310,6 +274,11 @@ export default class Layer extends Observable {
|
|
|
310
274
|
this.key,
|
|
311
275
|
);
|
|
312
276
|
|
|
277
|
+
// No response so we modify the properties accordingly, to avoid spaming the console.
|
|
278
|
+
this.isQueryable = false;
|
|
279
|
+
// this.isClickActive = false;
|
|
280
|
+
// this.isHoverActive = false;
|
|
281
|
+
|
|
313
282
|
// This layer returns no feature info.
|
|
314
283
|
// The function is implemented by inheriting layers.
|
|
315
284
|
return Promise.resolve({
|
|
@@ -27,7 +27,7 @@ describe('Layer', () => {
|
|
|
27
27
|
expect(layer.isClickActive).toBe(true);
|
|
28
28
|
expect(layer.isHoverActive).toBe(true);
|
|
29
29
|
expect(layer.hitTolerance).toBe(5);
|
|
30
|
-
expect(layer.
|
|
30
|
+
expect(layer.isMobilityLayer).toBe(true);
|
|
31
31
|
expect(layer.copyrights).toBe();
|
|
32
32
|
expect(layer.visible).toBe(true);
|
|
33
33
|
expect(layer.properties).toEqual({});
|
|
@@ -115,19 +115,6 @@ describe('Layer', () => {
|
|
|
115
115
|
});
|
|
116
116
|
expect(layer.getVisibleChildren().length).toBe(1);
|
|
117
117
|
expect(layer.hasVisibleChildren()).toBe(true);
|
|
118
|
-
expect(layer.hasChildren(false)).toBe(true);
|
|
119
|
-
|
|
120
|
-
layer.addChild(
|
|
121
|
-
new Layer({
|
|
122
|
-
name: 'bla',
|
|
123
|
-
}),
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
expect(layer.getVisibleChildren().length).toBe(2);
|
|
127
|
-
|
|
128
|
-
layer.removeChild('bla');
|
|
129
|
-
|
|
130
|
-
expect(layer.getVisibleChildren().length).toBe(1);
|
|
131
118
|
});
|
|
132
119
|
|
|
133
120
|
test('should set onClick using constructor.', () => {
|
|
@@ -292,97 +279,6 @@ describe('Layer', () => {
|
|
|
292
279
|
});
|
|
293
280
|
});
|
|
294
281
|
|
|
295
|
-
describe('#hasVisibleChildren()', () => {
|
|
296
|
-
test('should return true for visible children.', () => {
|
|
297
|
-
const layerVisible = { visible: true };
|
|
298
|
-
const layerVisible2 = { visible: true };
|
|
299
|
-
const layerHidden = { visible: false };
|
|
300
|
-
const layer = new Layer({
|
|
301
|
-
name: 'Layer',
|
|
302
|
-
visible: false,
|
|
303
|
-
olLayer,
|
|
304
|
-
children: [layerVisible, layerHidden, layerVisible2],
|
|
305
|
-
});
|
|
306
|
-
expect(layer.hasChildren(true)).toEqual(true);
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
test('should return true with hidden children.', () => {
|
|
310
|
-
const layerVisible = { visible: true };
|
|
311
|
-
const layerVisible2 = { visible: true };
|
|
312
|
-
const layerHidden = { visible: false };
|
|
313
|
-
const layer = new Layer({
|
|
314
|
-
name: 'Layer',
|
|
315
|
-
visible: false,
|
|
316
|
-
olLayer,
|
|
317
|
-
children: [layerVisible, layerHidden, layerVisible2],
|
|
318
|
-
});
|
|
319
|
-
expect(layer.hasChildren(false)).toEqual(true);
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
test('should return false with hidden children.', () => {
|
|
323
|
-
const layerVisible = { visible: true };
|
|
324
|
-
const layerVisible2 = { visible: true };
|
|
325
|
-
const layer = new Layer({
|
|
326
|
-
name: 'Layer',
|
|
327
|
-
visible: false,
|
|
328
|
-
olLayer,
|
|
329
|
-
children: [layerVisible, layerVisible2],
|
|
330
|
-
});
|
|
331
|
-
expect(layer.hasChildren(false)).toEqual(false);
|
|
332
|
-
});
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
describe('#addChild()', () => {
|
|
336
|
-
test('add a child.', () => {
|
|
337
|
-
const layerVisible = { visible: true };
|
|
338
|
-
const layerHidden = { visible: false };
|
|
339
|
-
const layer = new Layer({
|
|
340
|
-
name: 'Layer',
|
|
341
|
-
visible: false,
|
|
342
|
-
olLayer,
|
|
343
|
-
});
|
|
344
|
-
const spy = jest.spyOn(layer, 'dispatchEvent');
|
|
345
|
-
expect(layer.children).toEqual([]);
|
|
346
|
-
layer.addChild(layerVisible);
|
|
347
|
-
expect(layer.children).toEqual([layerVisible]);
|
|
348
|
-
expect(spy).toHaveBeenCalledTimes(1);
|
|
349
|
-
expect(spy).toHaveBeenCalledWith({
|
|
350
|
-
type: 'change:children',
|
|
351
|
-
target: layer,
|
|
352
|
-
});
|
|
353
|
-
spy.mockReset();
|
|
354
|
-
layer.addChild(layerHidden);
|
|
355
|
-
expect(layer.children).toEqual([layerHidden, layerVisible]);
|
|
356
|
-
expect(spy).toHaveBeenCalledTimes(1);
|
|
357
|
-
expect(spy).toHaveBeenCalledWith({
|
|
358
|
-
type: 'change:children',
|
|
359
|
-
target: layer,
|
|
360
|
-
});
|
|
361
|
-
});
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
describe('#removeChild()', () => {
|
|
365
|
-
test('removes a child using the name', () => {
|
|
366
|
-
const layerVisible = { name: 'foo', visible: true };
|
|
367
|
-
const layerHidden = { name: 'bar', visible: false };
|
|
368
|
-
const layer = new Layer({
|
|
369
|
-
name: 'Layer',
|
|
370
|
-
visible: false,
|
|
371
|
-
olLayer,
|
|
372
|
-
children: [layerVisible, layerHidden],
|
|
373
|
-
});
|
|
374
|
-
const spy = jest.spyOn(layer, 'dispatchEvent');
|
|
375
|
-
expect(layer.children).toEqual([layerVisible, layerHidden]);
|
|
376
|
-
layer.removeChild('foo');
|
|
377
|
-
expect(layer.children).toEqual([layerHidden]);
|
|
378
|
-
expect(spy).toHaveBeenCalledTimes(1);
|
|
379
|
-
expect(spy).toHaveBeenCalledWith({
|
|
380
|
-
type: 'change:children',
|
|
381
|
-
target: layer,
|
|
382
|
-
});
|
|
383
|
-
});
|
|
384
|
-
});
|
|
385
|
-
|
|
386
282
|
describe('#getFeatureInfoAtCoordinate()', () => {
|
|
387
283
|
test('return an empty fetaureInfo object and display an error message', (done) => {
|
|
388
284
|
// eslint-disable-next-line no-console
|
|
@@ -575,7 +471,7 @@ describe('Layer', () => {
|
|
|
575
471
|
});
|
|
576
472
|
|
|
577
473
|
describe('#unHover()', () => {
|
|
578
|
-
test
|
|
474
|
+
test('removes function from clickCallbacks array', () => {
|
|
579
475
|
const layer = new Layer({
|
|
580
476
|
name: 'Layer',
|
|
581
477
|
olLayer,
|
|
File without changes
|