@mapcomponents/react-maplibre 0.1.62 → 0.1.64
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 +21 -2
- package/.editorconfig +1 -1
- package/.eslintrc.js +11 -1
- package/.github/workflows/check-catalogue-metadata-schema.yml +19 -0
- package/.storybook/main.js +0 -1
- package/.storybook/preview.js +0 -2
- package/CHANGELOG.md +43 -0
- package/coverage/clover.xml +864 -1037
- package/coverage/coverage-final.json +32 -21
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +170 -95
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +24 -24
- package/coverage/lcov-report/src/components/MapLibreMap/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCenterPosition/MlCenterPosition.tsx.html +5 -5
- package/coverage/lcov-report/src/components/MlCenterPosition/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx.html +2 -2
- package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.cy.tsx.html +148 -0
- package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfForm/index.html +22 -7
- package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.tsx.html +72 -42
- package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +15 -15
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlFollowGps/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +86 -35
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/{MlSpatialElevationProfile/MlSpatialElevationProfile.js.html → MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.js.html} +215 -320
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.js.html +649 -0
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.tsx.html +112 -0
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.tsx.html +115 -0
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/index.html +161 -0
- package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGpxViewer/MlGpxViewer.tsx.html +394 -0
- package/coverage/lcov-report/src/components/MlGpxViewer/index.html +116 -0
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx.html +63 -285
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +21 -21
- package/coverage/lcov-report/src/components/MlLayer/MlLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.tsx.html +58 -76
- package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +58 -61
- package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +11 -11
- package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +30 -21
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +1 -1
- package/coverage/lcov-report/src/components/MlMarker/MlMarker.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlMarker/index.html +1 -1
- package/coverage/lcov-report/src/components/MlMeasureTool/MlMeasureTool.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlMeasureTool/index.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationTools/index.html +1 -1
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +1 -1
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.stories_.js.html +1 -1
- package/coverage/lcov-report/src/components/MlOsmLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.js.html +1 -1
- package/coverage/lcov-report/src/components/MlScaleReference/index.html +1 -1
- package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.js.html +1 -1
- package/coverage/lcov-report/src/components/MlShareMapState/index.html +1 -1
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/ColorPicker.tsx.html +214 -0
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerList.tsx.html +121 -0
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerListItem.tsx.html +412 -0
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx.html +463 -0
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/index.html +161 -0
- package/coverage/lcov-report/src/components/{MlGPXViewer/MlGPXViewer.tsx.html → MlSketchTool/MlSketchTool.tsx.html} +271 -589
- package/coverage/lcov-report/src/components/{MlGPXViewer → MlSketchTool}/index.html +22 -37
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.tsx.html +514 -0
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +21 -21
- package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +1 -1
- package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx.html +20 -206
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +1 -1
- package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +1 -1
- package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx.html +10 -7
- package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +5 -5
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.tsx.html +111 -57
- package/coverage/lcov-report/src/components/MlWmsLayer/index.html +19 -19
- package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.tsx.html +201 -144
- package/coverage/lcov-report/src/components/MlWmsLoader/index.html +9 -9
- package/coverage/lcov-report/src/contexts/MapContext.tsx.html +23 -23
- package/coverage/lcov-report/src/contexts/SimpleDataContext.js.html +1 -1
- package/coverage/lcov-report/src/contexts/SimpleDataProvider.js.html +1 -1
- package/coverage/lcov-report/src/contexts/index.html +1 -1
- package/coverage/lcov-report/src/hooks/index.html +50 -50
- package/coverage/lcov-report/src/hooks/useCameraFollowPath/index.html +1 -1
- package/coverage/lcov-report/src/hooks/useCameraFollowPath/useCameraFollowPath.tsx.html +1 -1
- package/coverage/lcov-report/src/hooks/useExportMap/index.html +1 -1
- package/coverage/lcov-report/src/hooks/useExportMap/index.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useExportMap/lib.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useGpx/index.html +116 -0
- package/coverage/lcov-report/src/hooks/useGpx/useGpx.tsx.html +295 -0
- package/coverage/lcov-report/src/hooks/useLayer.ts.html +132 -66
- package/coverage/lcov-report/src/hooks/useLayerEvent.js.html +1 -1
- package/coverage/lcov-report/src/hooks/useLayerHoverPopup/index.html +116 -0
- package/coverage/lcov-report/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx.html +331 -0
- package/coverage/lcov-report/src/hooks/useMap.ts.html +47 -47
- package/coverage/lcov-report/src/hooks/useMapState.ts.html +54 -54
- package/coverage/lcov-report/src/hooks/useSource.ts.html +57 -57
- package/coverage/lcov-report/src/hooks/{useWms.js.html → useWms.ts.html} +54 -15
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/index.ts.html +6 -6
- package/coverage/lcov.info +1724 -1974
- package/cypress/support/commands.ts +37 -0
- package/cypress/support/component-index.html +12 -0
- package/cypress/support/component.ts +46 -0
- package/cypress.config.ts +101 -0
- package/dist/components/MapLibreMap/MapLibreMap.d.ts +1 -1
- package/dist/components/MapLibreMap/lib/MapLibreGlWrapper.d.ts +53 -27
- package/dist/components/MlCenterPosition/MlCenterPosition.d.ts +3 -2
- package/dist/components/MlCenterPosition/MlCenterPosition.stories.d.ts +35 -16
- package/dist/components/MlComponentTemplate/MlComponentTemplate.d.ts +1 -1
- package/dist/components/MlComponentTemplate/MlComponentTemplate.stories.d.ts +12 -9
- package/dist/components/MlCreatePdfButton/MlCreatePdfButton.d.ts +1 -1
- package/dist/components/MlCreatePdfButton/MlCreatePdfButton.stories.d.ts +12 -9
- package/dist/components/MlCreatePdfForm/MlCreatePdfForm.cy.d.ts +1 -0
- package/dist/components/MlCreatePdfForm/lib/PdfPreview.d.ts +1 -1
- package/dist/components/MlFeatureEditor/MlFeatureEditor.d.ts +10 -4
- package/dist/components/MlFeatureEditor/lib/double_click_zoom.d.ts +0 -2
- package/dist/components/MlFeatureEditor/lib/theme.d.ts +1 -1
- package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.d.ts +23 -12
- package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.d.ts +12 -11
- package/dist/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.d.ts +2 -0
- package/dist/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.d.ts +2 -0
- package/dist/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.d.ts +3 -0
- package/dist/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.d.ts +3 -0
- package/dist/components/MlGpxViewer/MlGpxViewer.d.ts +30 -0
- package/dist/components/MlGpxViewer/MlGpxViewer.stories.d.ts +17 -0
- package/dist/components/MlGpxViewer/MlGpxViewer.test.d.ts +1 -0
- package/dist/components/MlGpxViewer/util/GeoJsonContext.d.ts +10 -0
- package/dist/components/MlGpxViewer/util/GeoJsonProvider.d.ts +4 -0
- package/dist/components/MlGpxViewer/util/MetadataDrawer.d.ts +7 -0
- package/dist/components/MlGpxViewer/util/MlGpxDemoLoader.d.ts +10 -0
- package/dist/components/MlGpxViewer/util/MlGpxViewerInstructions.d.ts +3 -0
- package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.d.ts +11 -2
- package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.d.ts +7 -9
- package/dist/components/MlLayerMagnify/MlLayerMagnify.d.ts +8 -2
- package/dist/components/MlLayerMagnify/MlLayerMagnify.stories.d.ts +13 -9
- package/dist/components/MlLayerSwipe/MlLayerSwipe.d.ts +13 -3
- package/dist/components/MlLayerSwipe/MlLayerSwipe.stories.d.ts +12 -10
- package/dist/components/MlSketchTool/LayerList/ColorPicker.d.ts +9 -0
- package/dist/components/MlSketchTool/LayerList/LayerList.d.ts +5 -0
- package/dist/components/MlSketchTool/LayerList/LayerListItem.d.ts +11 -0
- package/dist/components/MlSketchTool/LayerList/LayerPropertyForm.d.ts +9 -0
- package/dist/components/MlSketchTool/MlSketchTool.d.ts +29 -0
- package/dist/components/MlSketchTool/MlSketchTool.stories.d.ts +10 -0
- package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.d.ts +33 -14
- package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.d.ts +18 -15
- package/dist/components/MlSpatialElevationProfile/util/getElevationData.d.ts +14 -0
- package/dist/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.d.ts +3 -67
- package/dist/components/MlWmsLayer/MlWmsLayer.d.ts +7 -4
- package/dist/components/MlWmsLoader/MlWmsLoader.d.ts +17 -10
- package/dist/components/MlWmsLoader/MlWmsLoader.stories.d.ts +23 -12
- package/dist/components/MlWmsLoader/utils/MlWmsLoaderInstructions.d.ts +3 -0
- package/dist/components/MlWmsLoader/utils/WMSLinks.d.ts +6 -0
- package/dist/contexts/SimpleDataProvider.d.ts +1 -1
- package/dist/custom.d.d.ts +1 -1
- package/dist/decorators/ThemeWrapper.d.ts +3 -1
- package/dist/hooks/useGpx/lib/gpxConverter.d.ts +11 -0
- package/dist/hooks/useGpx/useGpx.d.ts +26 -0
- package/dist/hooks/useGpx/useGpx.stories.d.ts +10 -0
- package/dist/hooks/useLayer.d.ts +14 -8
- package/dist/hooks/useLayerHoverPopup/useLayerHoverPopup.d.ts +23 -0
- package/dist/hooks/useLayerHoverPopup/useLayerHoverPopup.stories.d.ts +10 -0
- package/dist/hooks/useMap.d.ts +2 -2
- package/dist/hooks/useMap.test.d.ts +1 -0
- package/dist/hooks/useMapState.d.ts +3 -3
- package/dist/hooks/useSource.d.ts +3 -3
- package/dist/hooks/useWms.d.ts +24 -16
- package/dist/index.d.ts +5 -5
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +9327 -14844
- package/dist/index.esm.js.map +1 -1
- package/dist/setupTests.d.ts +6 -5
- package/dist/ui_components/Dropzone.d.ts +5 -0
- package/dist/ui_components/ImageLoader.d.ts +8 -1
- package/dist/ui_components/LoadingOverlayContext.d.ts +11 -11
- package/dist/ui_components/Sidebar.d.ts +10 -1
- package/dist/ui_components/Tooltip.d.ts +1 -1
- package/dist/ui_components/TopToolbar.d.ts +7 -1
- package/dist/ui_components/UploadButton.d.ts +6 -0
- package/dist/util/BubbleForInstructions.d.ts +2 -0
- package/dist/util/Instructions.d.ts +13 -0
- package/package.json +195 -185
- package/public/assets/sample1.gpx +3003 -0
- package/public/assets/sample2.gpx +1264 -0
- package/public/assets/sample3.gpx +912 -0
- package/{src/components/MlImageMarkerLayer → public}/assets/wg-marker.png +0 -0
- package/public/index.html +0 -4
- package/public/thumbnails/MlSketchTool.png +0 -0
- package/public/thumbnails/useCameraFollowPath.png +0 -0
- package/scripts/build-catalogue-meta.js +35 -11
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.ts +230 -188
- package/src/components/MlCenterPosition/MlCenterPosition.meta_.json +1 -2
- package/src/components/MlCenterPosition/MlCenterPosition.stories.tsx +20 -0
- package/src/components/MlCenterPosition/MlCenterPosition.tsx +4 -4
- package/src/components/MlComponentTemplate/MlComponentTemplate.meta_.json +1 -2
- package/src/components/MlComponentTemplate/{MlComponentTemplate.stories.js → MlComponentTemplate.stories.tsx} +2 -2
- package/src/components/MlComponentTemplate/MlComponentTemplate.tsx +1 -1
- package/src/components/MlCreatePdfButton/MlCreatePdfButton.meta_.json +1 -2
- package/src/components/MlCreatePdfButton/{MlCreatePdfButton.stories.js → MlCreatePdfButton.stories.tsx} +1 -1
- package/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx +1 -1
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.cy.tsx +21 -0
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.meta.json +1 -2
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.stories.tsx +1 -3
- package/src/components/MlCreatePdfForm/lib/PdfForm.tsx +25 -2
- package/src/components/MlFeatureEditor/MlFeatureEditor.meta.json +2 -3
- package/src/components/MlFeatureEditor/MlFeatureEditor.tsx +39 -29
- package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.meta.json +1 -2
- package/src/components/MlFollowGps/MlFollowGps.meta.json +1 -2
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.meta.json +1 -2
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.tsx +191 -0
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx +47 -30
- package/src/components/MlGeoJsonLayer/assets/earthquake.json +109937 -0
- package/src/components/MlGeoJsonLayer/assets/sample_1.json +138 -24
- package/src/components/MlGeoJsonLayer/assets/sample_2.json +140 -20
- package/src/components/MlGeoJsonLayer/assets/wg_locations.json +65 -0
- package/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.js +189 -0
- package/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.js +188 -0
- package/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.tsx +9 -0
- package/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.tsx +10 -0
- package/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.meta_.json +1 -2
- package/src/components/{MlGPXViewer/MlGPXViewer.doc.de.md → MlGpxViewer/MlGpxViewer.doc.de.md} +0 -0
- package/src/components/{MlGPXViewer/MlGPXViewer.doc.en.md → MlGpxViewer/MlGpxViewer.doc.en.md} +0 -0
- package/src/components/{MlGPXViewer/MlGPXViewer.meta.json → MlGpxViewer/MlGpxViewer.meta.json} +2 -3
- package/src/components/MlGpxViewer/MlGpxViewer.stories.tsx +109 -0
- package/src/components/MlGpxViewer/MlGpxViewer.test.js +53 -0
- package/src/components/MlGpxViewer/MlGpxViewer.tsx +103 -0
- package/src/components/{MlGPXViewer → MlGpxViewer}/util/GeoJsonContext.ts +0 -0
- package/src/components/{MlGPXViewer → MlGpxViewer}/util/GeoJsonProvider.tsx +0 -0
- package/src/components/MlGpxViewer/util/MetadataDrawer.tsx +38 -0
- package/src/components/MlGpxViewer/util/MlGpxDemoLoader.tsx +128 -0
- package/src/components/MlGpxViewer/util/MlGpxViewerInstructions.tsx +68 -0
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.meta_.json +1 -2
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.tsx +41 -0
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.test.js +27 -8
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx +41 -115
- package/src/components/MlLayer/MlLayer.meta_.json +1 -2
- package/src/components/MlLayerMagnify/MlLayerMagnify.meta.json +1 -2
- package/src/components/MlLayerMagnify/MlLayerMagnify.stories.tsx +44 -0
- package/src/components/MlLayerMagnify/{MlLayerMagnify.test.js → MlLayerMagnify.test.tsx} +15 -18
- package/src/components/MlLayerMagnify/MlLayerMagnify.tsx +55 -61
- package/src/components/MlLayerSwipe/MlLayerSwipe.meta.json +1 -2
- package/src/components/MlLayerSwipe/{MlLayerSwipe.stories.js → MlLayerSwipe.stories.tsx} +9 -11
- package/src/components/MlLayerSwipe/MlLayerSwipe.tsx +47 -48
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.meta_.json +1 -2
- package/src/components/MlLayerSwitcher/components/LayerBox.js +22 -19
- package/src/components/MlMarker/MlMarker.meta_.json +1 -2
- package/src/components/MlMeasureTool/MlMeasureTool.meta.json +1 -2
- package/src/components/MlNavigationCompass/MlNavigationCompass.meta.json +1 -2
- package/src/components/MlNavigationTools/MlNavigationTools.meta.json +1 -2
- package/src/components/MlScaleReference/MlScaleReference.meta.json +1 -2
- package/src/components/MlShareMapState/MlShareMapState.meta_.json +1 -2
- package/src/components/MlSketchTool/LayerList/ColorPicker.tsx +43 -0
- package/src/components/MlSketchTool/LayerList/LayerList.tsx +12 -0
- package/src/components/MlSketchTool/LayerList/LayerListItem.tsx +109 -0
- package/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx +126 -0
- package/src/components/MlSketchTool/MlSketchTool.doc.de.md +3 -0
- package/src/components/MlSketchTool/MlSketchTool.meta.json +14 -0
- package/src/components/MlSketchTool/MlSketchTool.stories.js +26 -0
- package/src/components/MlSketchTool/MlSketchTool.tsx +271 -0
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.meta.json +1 -2
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.tsx +121 -0
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.test.js +30 -1
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.tsx +143 -0
- package/src/components/MlSpatialElevationProfile/util/getElevationData.tsx +103 -0
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.meta.json +1 -2
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.meta.json +3 -4
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.stories.js +2 -3
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx +17 -79
- package/src/components/MlUseMapDebugger/MlUseMapDebugger.meta_.json +1 -2
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.meta.json +1 -2
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx +3 -2
- package/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.meta_.json +1 -2
- package/src/components/MlWmsLayer/MlWmsLayer.tsx +59 -41
- package/src/components/MlWmsLoader/MlWmsLoader.meta.json +1 -2
- package/src/components/MlWmsLoader/MlWmsLoader.stories.tsx +89 -0
- package/src/components/MlWmsLoader/MlWmsLoader.tsx +141 -122
- package/src/components/MlWmsLoader/utils/MlWmsLoaderInstructions.tsx +50 -0
- package/src/components/MlWmsLoader/utils/WMSLinks.tsx +128 -0
- package/src/decorators/MapContextDecorator.js +1 -1
- package/src/decorators/MapContextDecoratorHooks.js +1 -1
- package/src/decorators/ThemeWrapper.tsx +9 -0
- package/src/hooks/useCameraFollowPath/useCameraFollowPath.meta.json +1 -2
- package/src/{components/MlGPXViewer → hooks/useGpx/lib}/gpxConverter.js +1 -0
- package/src/hooks/useGpx/useGpx.doc.de.md +3 -0
- package/src/hooks/useGpx/useGpx.meta_.json +15 -0
- package/src/{components/MlCenterPosition/MlCenterPosition.stories.js → hooks/useGpx/useGpx.stories.js} +4 -5
- package/src/hooks/useGpx/useGpx.tsx +70 -0
- package/src/hooks/useLayer.ts +32 -10
- package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.doc.de.md +3 -0
- package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.meta_.json +15 -0
- package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.stories.js +20 -0
- package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx +82 -0
- package/src/hooks/useMap.test.tsx +48 -0
- package/src/hooks/useMap.ts +8 -8
- package/src/hooks/useSource.ts +4 -4
- package/src/hooks/{useWms.js → useWms.ts} +24 -11
- package/src/index.ts +5 -5
- package/src/setupTests.js +18 -15
- package/src/ui_components/Dropzone.tsx +104 -0
- package/src/ui_components/{ImageLoader.js → ImageLoader.tsx} +30 -25
- package/src/ui_components/{LoadingOverlayContext.js → LoadingOverlayContext.tsx} +12 -15
- package/src/ui_components/Sidebar.tsx +82 -0
- package/src/ui_components/Tooltip.tsx +17 -0
- package/src/ui_components/TopToolbar.tsx +26 -0
- package/src/ui_components/UploadButton.tsx +57 -0
- package/src/util/BubbleForInstructions.js +46 -0
- package/src/util/Instructions.tsx +60 -0
- package/tsconfig.json +39 -58
- package/config/getHttpsConfig.js +0 -66
- package/config/modules.js +0 -134
- package/config/pnpTs.js +0 -35
- package/config/webpack.config.js +0 -757
- package/config/webpackDevServer.config.js +0 -130
- package/coverage/lcov-report/src/components/MlGPXViewer/gpxConverter.js.html +0 -1645
- package/scripts/start.js +0 -166
- package/src/components/MlGPXViewer/MlGPXViewer.stories.js +0 -31
- package/src/components/MlGPXViewer/MlGPXViewer.test.js +0 -28
- package/src/components/MlGPXViewer/MlGPXViewer.tsx +0 -377
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.js +0 -66
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.js +0 -45
- package/src/components/MlLayerMagnify/MlLayerMagnify.stories.js +0 -41
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js +0 -224
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.js +0 -57
- package/src/components/MlWmsLoader/MlWmsLoader.stories.js +0 -47
- package/src/decorators/ThemeWrapper.jsx +0 -9
- package/src/ui_components/Legend.js +0 -44
- package/src/ui_components/LoadingOverlay.js +0 -41
- package/src/ui_components/Sidebar.js +0 -100
- package/src/ui_components/Tooltip.js +0 -21
- package/src/ui_components/TopToolbar.js +0 -29
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import React, { useRef, useEffect, useState } from 'react';
|
|
2
|
+
import Typography from '@mui/material/Typography';
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
setData: (data: string) => void;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const stopDefault = (event: DragEvent) => {
|
|
9
|
+
event.preventDefault();
|
|
10
|
+
event.stopPropagation();
|
|
11
|
+
};
|
|
12
|
+
export default function Dropzone(props: Props) {
|
|
13
|
+
const [zIndex, setZIndex] = useState(0);
|
|
14
|
+
const dropZone = useRef<HTMLDivElement>(null);
|
|
15
|
+
const dropHandler = (event: DragEvent) => {
|
|
16
|
+
event.preventDefault();
|
|
17
|
+
|
|
18
|
+
if (event?.dataTransfer?.items) {
|
|
19
|
+
if (event.dataTransfer.items.length > 1) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
// If dropped items aren't files, reject them
|
|
23
|
+
if (event.dataTransfer.items[0].kind === 'file') {
|
|
24
|
+
const reader = new FileReader();
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
+
reader.onload = (payload: any) => {
|
|
27
|
+
if (!payload?.currentTarget?.result) return;
|
|
28
|
+
|
|
29
|
+
if (typeof props.setData === 'function') {
|
|
30
|
+
props.setData(payload.currentTarget.result);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const file = event.dataTransfer.items[0].getAsFile();
|
|
34
|
+
if (file) {
|
|
35
|
+
reader.readAsText(file);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
// Use DataTransfer interface to access the file(s)
|
|
40
|
+
}
|
|
41
|
+
return;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
const _dropZone = dropZone.current;
|
|
46
|
+
const raiseDropZoneAndStopDefault = (event: DragEvent) => {
|
|
47
|
+
setZIndex(1000);
|
|
48
|
+
stopDefault(event);
|
|
49
|
+
};
|
|
50
|
+
const lowerDropZone = () => {
|
|
51
|
+
setZIndex(0);
|
|
52
|
+
};
|
|
53
|
+
const lowerDropZoneAndStopDefault = (event: DragEvent) => {
|
|
54
|
+
setZIndex(0);
|
|
55
|
+
stopDefault(event);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
window.addEventListener('dragenter', raiseDropZoneAndStopDefault);
|
|
59
|
+
window.addEventListener('dragover', stopDefault);
|
|
60
|
+
|
|
61
|
+
_dropZone?.addEventListener('dragleave', lowerDropZone);
|
|
62
|
+
|
|
63
|
+
window.addEventListener('drop', lowerDropZoneAndStopDefault);
|
|
64
|
+
|
|
65
|
+
return () => {
|
|
66
|
+
window.removeEventListener('dragenter', raiseDropZoneAndStopDefault);
|
|
67
|
+
window.removeEventListener('dragover', stopDefault);
|
|
68
|
+
_dropZone?.removeEventListener('dragleave', lowerDropZone);
|
|
69
|
+
window.removeEventListener('drop', lowerDropZoneAndStopDefault);
|
|
70
|
+
};
|
|
71
|
+
}, []);
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<div
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
76
|
+
// @ts-ignore
|
|
77
|
+
onDrop={dropHandler}
|
|
78
|
+
ref={dropZone}
|
|
79
|
+
style={{
|
|
80
|
+
position: 'absolute',
|
|
81
|
+
left: '0',
|
|
82
|
+
top: '0',
|
|
83
|
+
backgroundColor: 'rgba(255,255,255,0.5)',
|
|
84
|
+
width: '100%',
|
|
85
|
+
height: '100%',
|
|
86
|
+
zIndex: zIndex,
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
<Typography
|
|
90
|
+
variant="h6"
|
|
91
|
+
style={{
|
|
92
|
+
top: '50%',
|
|
93
|
+
position: 'absolute',
|
|
94
|
+
left: '50%',
|
|
95
|
+
msTransform: 'translate(-50%, -50%)',
|
|
96
|
+
transform: ' translate(-50%, -50%)',
|
|
97
|
+
}}
|
|
98
|
+
noWrap
|
|
99
|
+
>
|
|
100
|
+
Datei ablegen
|
|
101
|
+
</Typography>
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
@@ -1,43 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
import { useEffect, useState } from "react"
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
3
2
|
import CircularProgress from '@mui/material/CircularProgress';
|
|
4
|
-
|
|
5
3
|
import ErrorIcon from '@mui/icons-material/Error';
|
|
6
|
-
import { Box } from
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { Box } from '@mui/system';
|
|
5
|
+
import { SxProps } from '@mui/material';
|
|
6
|
+
|
|
7
|
+
interface ImageLoaderProps {
|
|
8
|
+
src: string;
|
|
9
|
+
alt?: string;
|
|
10
|
+
sx?: SxProps;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const ImageLoader = (props: ImageLoaderProps) => {
|
|
15
|
+
const [state, setState] = useState('loading');
|
|
9
16
|
|
|
10
17
|
useEffect(() => {
|
|
11
18
|
if (!props.src) {
|
|
12
|
-
setState(
|
|
19
|
+
setState('error');
|
|
13
20
|
return;
|
|
14
21
|
}
|
|
15
22
|
fetch(props.src)
|
|
16
23
|
.then(({ ok }) => {
|
|
17
24
|
if (ok) {
|
|
18
|
-
setState(
|
|
25
|
+
setState('ready');
|
|
19
26
|
} else {
|
|
20
|
-
setState(
|
|
27
|
+
setState('error');
|
|
21
28
|
}
|
|
22
29
|
})
|
|
23
30
|
.catch((e) => {
|
|
24
31
|
console.error(e);
|
|
25
|
-
setState(
|
|
32
|
+
setState('error');
|
|
26
33
|
});
|
|
27
34
|
}, [props.src]);
|
|
28
35
|
|
|
29
36
|
const boxStyle = {
|
|
30
|
-
width: "100%",
|
|
31
|
-
height: "100%",
|
|
32
37
|
border: 2,
|
|
33
|
-
borderRadius:
|
|
34
|
-
|
|
35
|
-
display: "flex",
|
|
38
|
+
borderRadius: '8px',
|
|
39
|
+
display: 'flex',
|
|
36
40
|
};
|
|
37
41
|
|
|
38
42
|
const LoadingImage = () => {
|
|
39
43
|
return (
|
|
40
|
-
<Box className={props.className} sx={{ ...boxStyle, ...props.
|
|
44
|
+
<Box className={props.className} sx={{ ...boxStyle, ...props.sx }}>
|
|
41
45
|
<CircularProgress />
|
|
42
46
|
</Box>
|
|
43
47
|
);
|
|
@@ -45,27 +49,28 @@ const ImageLoader = (props) => {
|
|
|
45
49
|
|
|
46
50
|
const ReadyImage = () => {
|
|
47
51
|
return (
|
|
48
|
-
<
|
|
52
|
+
<Box
|
|
53
|
+
component={'img'}
|
|
49
54
|
className={props.className}
|
|
50
|
-
|
|
55
|
+
sx={{ ...boxStyle, ...props.sx }}
|
|
51
56
|
src={props.src}
|
|
52
|
-
alt={props.alt ||
|
|
57
|
+
alt={props.alt || ''}
|
|
53
58
|
/>
|
|
54
59
|
);
|
|
55
60
|
};
|
|
56
61
|
const ErrorImage = () => {
|
|
57
62
|
return (
|
|
58
|
-
<Box className={props.className} sx={{ boxStyle, ...props.
|
|
59
|
-
<ErrorIcon sx={{ display:
|
|
63
|
+
<Box className={props.className} sx={{ ...boxStyle, ...props.sx }}>
|
|
64
|
+
<ErrorIcon sx={{ display: 'block', margin: 'auto' }} />
|
|
60
65
|
</Box>
|
|
61
66
|
);
|
|
62
67
|
};
|
|
63
68
|
|
|
64
|
-
const renderImage = (state) => {
|
|
69
|
+
const renderImage = (state: string) => {
|
|
65
70
|
switch (state) {
|
|
66
|
-
case
|
|
71
|
+
case 'ready':
|
|
67
72
|
return <ReadyImage />;
|
|
68
|
-
case
|
|
73
|
+
case 'error':
|
|
69
74
|
return <ErrorImage />;
|
|
70
75
|
default:
|
|
71
76
|
return <LoadingImage />;
|
|
@@ -75,4 +80,4 @@ const ImageLoader = (props) => {
|
|
|
75
80
|
return <>{renderImage(state)}</>;
|
|
76
81
|
};
|
|
77
82
|
|
|
78
|
-
export default ImageLoader
|
|
83
|
+
export default ImageLoader;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import React, { useState, useEffect, useContext, useRef } from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import { MapContext } from
|
|
1
|
+
import React, { useState, useEffect, useContext, useRef } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { MapContext } from '../index';
|
|
4
|
+
import { JsxChildren } from 'typedoc/dist/lib/utils/jsx.elements';
|
|
4
5
|
|
|
5
6
|
const LoadingOverlayContext = React.createContext({});
|
|
6
7
|
const LoadingOverlayContextProvider = LoadingOverlayContext.Provider;
|
|
7
8
|
|
|
8
|
-
const LoadingOverlayProvider = (
|
|
9
|
+
const LoadingOverlayProvider = (children: JsxChildren) => {
|
|
9
10
|
const mapContext = useContext(MapContext);
|
|
10
11
|
|
|
11
12
|
const [controlled, setControlled] = useState(false);
|
|
@@ -15,7 +16,7 @@ const LoadingOverlayProvider = ({ children }) => {
|
|
|
15
16
|
const mapJobsRef = useRef({});
|
|
16
17
|
const [checkIdleTrigger, setCheckIdleTrigger] = useState(0);
|
|
17
18
|
|
|
18
|
-
const createOnMapIdleFunction = (mapId) => () => {
|
|
19
|
+
const createOnMapIdleFunction = (mapId: string) => () => {
|
|
19
20
|
mapJobsRef.current[mapId] = true;
|
|
20
21
|
setCheckIdleTrigger(Math.random());
|
|
21
22
|
};
|
|
@@ -33,7 +34,7 @@ const LoadingOverlayProvider = ({ children }) => {
|
|
|
33
34
|
useEffect(() => {
|
|
34
35
|
if (!mapContext.map || controlled) return;
|
|
35
36
|
|
|
36
|
-
for (
|
|
37
|
+
for (const key in mapJobsRef.current) {
|
|
37
38
|
if (!mapJobsRef.current[key]) return;
|
|
38
39
|
}
|
|
39
40
|
|
|
@@ -41,14 +42,14 @@ const LoadingOverlayProvider = ({ children }) => {
|
|
|
41
42
|
}, [checkIdleTrigger, controlled, mapContext]);
|
|
42
43
|
|
|
43
44
|
useEffect(() => {
|
|
44
|
-
for (
|
|
45
|
-
if (Object.keys(mapJobsRef.current).indexOf(mapContext.mapIds[i]) === -1) {
|
|
46
|
-
|
|
45
|
+
for (let i = 0, len = mapContext.mapIds.length; i < len; i++) {
|
|
46
|
+
if (Object.keys(mapJobsRef.current).indexOf(mapContext.mapIds[i] as string) === -1) {
|
|
47
|
+
const mapId = mapContext.mapIds[i] + '';
|
|
47
48
|
|
|
48
49
|
if (mapContext.getMap(mapId)) {
|
|
49
50
|
mapJobsRef.current[mapId] = false;
|
|
50
51
|
|
|
51
|
-
mapContext.getMap(mapId).on(
|
|
52
|
+
mapContext.getMap(mapId).on('idle', createOnMapIdleFunction(mapId));
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
}
|
|
@@ -68,11 +69,7 @@ const LoadingOverlayProvider = ({ children }) => {
|
|
|
68
69
|
setLoadingDone,
|
|
69
70
|
};
|
|
70
71
|
|
|
71
|
-
return
|
|
72
|
-
<LoadingOverlayContextProvider value={value}>
|
|
73
|
-
{children}
|
|
74
|
-
</LoadingOverlayContextProvider>
|
|
75
|
-
);
|
|
72
|
+
return <LoadingOverlayContextProvider value={value}>{children}</LoadingOverlayContextProvider>;
|
|
76
73
|
};
|
|
77
74
|
|
|
78
75
|
LoadingOverlayProvider.propTypes = {
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
import ChevronLeftIcon from '@mui/icons-material/ChevronLeft';
|
|
4
|
+
import MenuIcon from '@mui/icons-material/Menu';
|
|
5
|
+
import { Drawer, IconButton, PaperProps, SxProps, DrawerProps} from '@mui/material';
|
|
6
|
+
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
7
|
+
import Box from '@mui/material/Box';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const DrawerHeader = styled('div')(() => ({
|
|
12
|
+
display: 'flex',
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
interface SidebarProps {
|
|
17
|
+
drawerPaperProps?: PaperProps;
|
|
18
|
+
drawerHeaderProps?: Headers;
|
|
19
|
+
drawerButtonStyle?: SxProps | undefined;
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default function Sidebar({ drawerPaperProps, drawerHeaderProps, drawerButtonStyle, ...props }: SidebarProps & DrawerProps) {
|
|
24
|
+
const mediaIsMobile = useMediaQuery('(max-width:900px)');
|
|
25
|
+
|
|
26
|
+
const [drawerOpen, setDrawerOpen] = useState(true);
|
|
27
|
+
|
|
28
|
+
const handleDrawerOpen = () => {
|
|
29
|
+
setDrawerOpen(true);
|
|
30
|
+
};
|
|
31
|
+
const handleDrawerClose = () => {
|
|
32
|
+
setDrawerOpen(false);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
<IconButton
|
|
38
|
+
onClick={handleDrawerOpen}
|
|
39
|
+
sx={{
|
|
40
|
+
zIndex: 101,
|
|
41
|
+
position: 'relative',
|
|
42
|
+
padding: '20px',
|
|
43
|
+
...drawerButtonStyle
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
<MenuIcon />
|
|
47
|
+
</IconButton>
|
|
48
|
+
<Drawer
|
|
49
|
+
transitionDuration={0}
|
|
50
|
+
variant="persistent"
|
|
51
|
+
anchor="left"
|
|
52
|
+
open={drawerOpen}
|
|
53
|
+
PaperProps={{
|
|
54
|
+
sx: {
|
|
55
|
+
maxWidth: '20%',
|
|
56
|
+
padding: '40px'
|
|
57
|
+
},
|
|
58
|
+
...drawerPaperProps,
|
|
59
|
+
}}
|
|
60
|
+
sx={{
|
|
61
|
+
flexGrow: 1,
|
|
62
|
+
zIndex: 105,
|
|
63
|
+
position: 'absolute',
|
|
64
|
+
top: 0,
|
|
65
|
+
backgroundColor: '#fafafa',
|
|
66
|
+
display: 'flex',
|
|
67
|
+
flexDirection: 'column',
|
|
68
|
+
maxWidth: mediaIsMobile ? '90vw' : '20vw',
|
|
69
|
+
...(drawerOpen ? {} : { left: mediaIsMobile ? '-90vw' : '-20vw' }),
|
|
70
|
+
}}
|
|
71
|
+
{...props}
|
|
72
|
+
>
|
|
73
|
+
<DrawerHeader {...drawerHeaderProps}>
|
|
74
|
+
<IconButton onClick={handleDrawerClose}>
|
|
75
|
+
<ChevronLeftIcon />
|
|
76
|
+
</IconButton>
|
|
77
|
+
</DrawerHeader>
|
|
78
|
+
<Box>{props.children}</Box>
|
|
79
|
+
</Drawer>
|
|
80
|
+
</>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import makeStyles from '@mui/styles/makeStyles';
|
|
3
|
+
|
|
4
|
+
const useStyles = makeStyles(() => ({
|
|
5
|
+
tooltip: {
|
|
6
|
+
position: 'fixed',
|
|
7
|
+
top: '100px',
|
|
8
|
+
left: '100px',
|
|
9
|
+
zIndex: 100000,
|
|
10
|
+
},
|
|
11
|
+
}));
|
|
12
|
+
|
|
13
|
+
export default function Legend() {
|
|
14
|
+
const classes = useStyles();
|
|
15
|
+
|
|
16
|
+
return <div className={classes.tooltip}>tooltip</div>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import AppBar from '@mui/material/AppBar';
|
|
3
|
+
import { Toolbar, AppBarProps, ToolbarProps, SxProps } from '@mui/material';
|
|
4
|
+
|
|
5
|
+
interface TopToolbarProps extends AppBarProps {
|
|
6
|
+
toolbarProps?: ToolbarProps;
|
|
7
|
+
appBarStyle?: SxProps
|
|
8
|
+
}
|
|
9
|
+
export default function TopToolbar({ toolbarProps, appBarStyle, ...props }: TopToolbarProps) {
|
|
10
|
+
return (
|
|
11
|
+
<AppBar
|
|
12
|
+
sx={{
|
|
13
|
+
minHeight: '62px',
|
|
14
|
+
backgroundColor: '#f1f1f1',
|
|
15
|
+
position: 'absolute',
|
|
16
|
+
zIndex: 120,
|
|
17
|
+
...appBarStyle
|
|
18
|
+
}}
|
|
19
|
+
color="primary"
|
|
20
|
+
position="static"
|
|
21
|
+
{...props}
|
|
22
|
+
>
|
|
23
|
+
<Toolbar {...toolbarProps}>{props.children}</Toolbar>
|
|
24
|
+
</AppBar>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import FileCopy from '@mui/icons-material/FileCopy';
|
|
3
|
+
import { Button } from '@mui/material';
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
setData: (data: string) => void;
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
+
buttonComponent: any;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default function UploadButton(props: Props) {
|
|
12
|
+
const fileupload = useRef<HTMLInputElement>(null);
|
|
13
|
+
const fileUploadOnChange = () => {
|
|
14
|
+
if (!fileupload.current) return false;
|
|
15
|
+
|
|
16
|
+
const file = fileupload.current?.files?.[0];
|
|
17
|
+
if (!file) return false;
|
|
18
|
+
const reader = new FileReader();
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
+
reader.onload = (payload: any) => {
|
|
21
|
+
if (!payload) return;
|
|
22
|
+
|
|
23
|
+
if (typeof props.setData === 'function') {
|
|
24
|
+
props.setData(payload.currentTarget?.result);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
reader.readAsText(file);
|
|
29
|
+
|
|
30
|
+
return;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const upload = () => {
|
|
34
|
+
if (!fileupload.current) return;
|
|
35
|
+
|
|
36
|
+
fileupload.current.click();
|
|
37
|
+
};
|
|
38
|
+
return (
|
|
39
|
+
<>
|
|
40
|
+
{props.buttonComponent ? (
|
|
41
|
+
React.cloneElement(props.buttonComponent, { onClick: upload })
|
|
42
|
+
) : (
|
|
43
|
+
<Button onClick={upload}>
|
|
44
|
+
<FileCopy />
|
|
45
|
+
</Button>
|
|
46
|
+
)}
|
|
47
|
+
<input
|
|
48
|
+
ref={fileupload}
|
|
49
|
+
onChange={fileUploadOnChange}
|
|
50
|
+
type="file"
|
|
51
|
+
id="input"
|
|
52
|
+
multiple
|
|
53
|
+
style={{ display: 'none' }}
|
|
54
|
+
></input>
|
|
55
|
+
</>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReplyAllIcon from '@mui/icons-material/ReplyAll';
|
|
3
|
+
|
|
4
|
+
function BubbleForInstruction(props) {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<div
|
|
8
|
+
style={{
|
|
9
|
+
width: '475px',
|
|
10
|
+
height: '475px',
|
|
11
|
+
position: 'fixed',
|
|
12
|
+
display: 'block',
|
|
13
|
+
borderRadius: '360px',
|
|
14
|
+
backgroundColor: 'steelblue',
|
|
15
|
+
right: props.bubbleRight,
|
|
16
|
+
bottom: props.bubbleBottom,
|
|
17
|
+
left: props.bubbleLeft,
|
|
18
|
+
top: props.bubbleTop,
|
|
19
|
+
zIndex: props.zIndex
|
|
20
|
+
}}
|
|
21
|
+
>
|
|
22
|
+
<h2
|
|
23
|
+
style={{
|
|
24
|
+
marginTop: props.textMarginTop,
|
|
25
|
+
marginLeft: props.textMarginLeft,
|
|
26
|
+
color: 'white',
|
|
27
|
+
textAlign: 'left',
|
|
28
|
+
}}
|
|
29
|
+
>
|
|
30
|
+
{props.children}
|
|
31
|
+
</h2>
|
|
32
|
+
<ReplyAllIcon
|
|
33
|
+
style={{
|
|
34
|
+
color: 'white',
|
|
35
|
+
fontSize: '80px',
|
|
36
|
+
position: 'absolute',
|
|
37
|
+
transform: props.iconTransform,
|
|
38
|
+
marginTop: props.iconMarginTop,
|
|
39
|
+
marginLeft: props.iconMarginLeft,
|
|
40
|
+
}}
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
</>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
export default BubbleForInstruction;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
+
import {Fade, SxProps} from '@mui/material';
|
|
3
|
+
import BubbleStyle from './BubbleForInstructions';
|
|
4
|
+
|
|
5
|
+
interface StepObject {
|
|
6
|
+
duration: number;
|
|
7
|
+
props: SxProps;
|
|
8
|
+
content: JSX.Element;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface InstructionProps {
|
|
12
|
+
steps: Array<StepObject>;
|
|
13
|
+
open: boolean;
|
|
14
|
+
callback?: () => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const Instructions = (props: InstructionProps) => {
|
|
18
|
+
const [activeStep, setActiveStep] = useState<number>();
|
|
19
|
+
const initializedRef = useRef(false);
|
|
20
|
+
|
|
21
|
+
const activateStep = (stepId?: number | undefined) => {
|
|
22
|
+
let _nextStep: number | undefined = typeof stepId === 'undefined' ? 0 : stepId + 1;
|
|
23
|
+
if (typeof _nextStep !== 'undefined') {
|
|
24
|
+
if (_nextStep > props.steps.length + 1) {
|
|
25
|
+
_nextStep = undefined;
|
|
26
|
+
} else {
|
|
27
|
+
setTimeout(() => {
|
|
28
|
+
activateStep(_nextStep);
|
|
29
|
+
}, props.steps[_nextStep].duration);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
setActiveStep(_nextStep);
|
|
33
|
+
};
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (props.open && !initializedRef.current) {
|
|
36
|
+
initializedRef.current = true;
|
|
37
|
+
activateStep();
|
|
38
|
+
}
|
|
39
|
+
if (!props.open) {
|
|
40
|
+
initializedRef.current = false;
|
|
41
|
+
setActiveStep(undefined);
|
|
42
|
+
}
|
|
43
|
+
}, [props.open]);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<>
|
|
47
|
+
{typeof activeStep !== 'undefined' && (
|
|
48
|
+
<Fade in={true} timeout={150}>
|
|
49
|
+
<div>
|
|
50
|
+
<BubbleStyle {...props.steps[activeStep].props}>
|
|
51
|
+
{props.steps[activeStep].content}
|
|
52
|
+
</BubbleStyle>
|
|
53
|
+
</div>
|
|
54
|
+
</Fade>
|
|
55
|
+
)}
|
|
56
|
+
</>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default Instructions;
|
package/tsconfig.json
CHANGED
|
@@ -1,59 +1,40 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"node_modules/maplibre-gl"
|
|
42
|
-
] // This mapping is relative to "baseUrl"
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"include": [
|
|
46
|
-
"src",
|
|
47
|
-
"src/custom.d.tsx"
|
|
48
|
-
],
|
|
49
|
-
"exclude": [
|
|
50
|
-
"node_modules",
|
|
51
|
-
"lib"
|
|
52
|
-
],
|
|
53
|
-
"typedocOptions": {
|
|
54
|
-
"entryPoints": [
|
|
55
|
-
"src/index.ts"
|
|
56
|
-
],
|
|
57
|
-
"out": "docs",
|
|
58
|
-
}
|
|
59
|
-
}
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"checkJs": false,
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"importHelpers": false,
|
|
6
|
+
"isolatedModules": true,
|
|
7
|
+
"resolveJsonModule": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"strict": false,
|
|
11
|
+
"types": ["node", "jest", "geojson", "cypress"],
|
|
12
|
+
"outDir": "build/esm",
|
|
13
|
+
"module": "esnext",
|
|
14
|
+
"target": "es5",
|
|
15
|
+
"lib": ["es6", "dom", "es2016", "es2017"],
|
|
16
|
+
"jsx": "react",
|
|
17
|
+
"declaration": true,
|
|
18
|
+
"declarationDir": "./dist",
|
|
19
|
+
"moduleResolution": "node",
|
|
20
|
+
"noUnusedLocals": true,
|
|
21
|
+
"noUnusedParameters": true,
|
|
22
|
+
"noImplicitReturns": true,
|
|
23
|
+
"noImplicitThis": true,
|
|
24
|
+
"noImplicitAny": true,
|
|
25
|
+
"strictNullChecks": true,
|
|
26
|
+
"suppressImplicitAnyIndexErrors": true,
|
|
27
|
+
"allowSyntheticDefaultImports": true,
|
|
28
|
+
"allowJs": true,
|
|
29
|
+
"baseUrl": ".",
|
|
30
|
+
"paths": {
|
|
31
|
+
"!maplibre-gl": ["node_modules/maplibre-gl"] // This mapping is relative to "baseUrl"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"include": ["src", "src/custom.d.tsx"],
|
|
35
|
+
"exclude": ["node_modules", "lib"],
|
|
36
|
+
"typedocOptions": {
|
|
37
|
+
"entryPoints": ["src/index.ts"],
|
|
38
|
+
"out": "docs"
|
|
39
|
+
}
|
|
40
|
+
}
|