@eightshift/frontend-libs-tailwind 1.0.0
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/.gitattributes +37 -0
- package/.github/CODEOWNERS +1 -0
- package/.github/CONTRIBUTING.md +17 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +10 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +10 -0
- package/.github/ISSUE_TEMPLATE/question.md +10 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +11 -0
- package/.github/workflows/ci.yml +31 -0
- package/.husky/pre-commit +1 -0
- package/.prettierrc +14 -0
- package/.stylelintrc +4 -0
- package/CHANGELOG.md +13 -0
- package/CODE_OF_CONDUCT.md +76 -0
- package/LICENSE +21 -0
- package/README.md +24 -0
- package/blocks/init/assets/application-admin.js +10 -0
- package/blocks/init/assets/application.js +13 -0
- package/blocks/init/assets/images/index.js +5 -0
- package/blocks/init/assets/scripts/application-admin.js +7 -0
- package/blocks/init/assets/scripts/application.js +3 -0
- package/blocks/init/assets/scripts/theme-colors.js +39 -0
- package/blocks/init/assets/styles/application-admin.css +6 -0
- package/blocks/init/assets/styles/application.css +3 -0
- package/blocks/init/src/Blocks/assets/application-blocks-editor.js +14 -0
- package/blocks/init/src/Blocks/assets/application-blocks-frontend.js +13 -0
- package/blocks/init/src/Blocks/assets/application-blocks.js +9 -0
- package/blocks/init/src/Blocks/assets/scripts/application-blocks-editor.js +65 -0
- package/blocks/init/src/Blocks/assets/scripts/application-blocks-frontend.js +24 -0
- package/blocks/init/src/Blocks/assets/scripts/link-section-editor.js +258 -0
- package/blocks/init/src/Blocks/assets/scripts/shared.js +25 -0
- package/blocks/init/src/Blocks/assets/styles/application-blocks-editor.css +15 -0
- package/blocks/init/src/Blocks/assets/styles/application-blocks-frontend.css +12 -0
- package/blocks/init/src/Blocks/assets/styles/application-blocks.css +0 -0
- package/blocks/init/src/Blocks/assets/styles/editor/editor-overrides.css +15 -0
- package/blocks/init/src/Blocks/assets/styles/tailwind.css +34 -0
- package/blocks/init/src/Blocks/components/admin-theme-options/admin-theme-options.php +20 -0
- package/blocks/init/src/Blocks/components/admin-theme-options/assets-admin/index.js +36 -0
- package/blocks/init/src/Blocks/components/admin-theme-options/assets-admin/pages/parts.js +55 -0
- package/blocks/init/src/Blocks/components/admin-theme-options/manifest.json +5 -0
- package/blocks/init/src/Blocks/components/button/assets/index.js +22 -0
- package/blocks/init/src/Blocks/components/button/button.php +77 -0
- package/blocks/init/src/Blocks/components/button/components/button-editor.js +40 -0
- package/blocks/init/src/Blocks/components/button/components/button-options.js +135 -0
- package/blocks/init/src/Blocks/components/button/manifest.json +299 -0
- package/blocks/init/src/Blocks/components/card/card.php +42 -0
- package/blocks/init/src/Blocks/components/card/components/card-editor.js +39 -0
- package/blocks/init/src/Blocks/components/card/components/card-options.js +56 -0
- package/blocks/init/src/Blocks/components/card/manifest.json +111 -0
- package/blocks/init/src/Blocks/components/head/head.php +52 -0
- package/blocks/init/src/Blocks/components/head/manifest.json +17 -0
- package/blocks/init/src/Blocks/components/heading/components/heading-editor.js +30 -0
- package/blocks/init/src/Blocks/components/heading/components/heading-options.js +62 -0
- package/blocks/init/src/Blocks/components/heading/heading.php +45 -0
- package/blocks/init/src/Blocks/components/heading/manifest.json +76 -0
- package/blocks/init/src/Blocks/components/hero/components/hero-editor.js +42 -0
- package/blocks/init/src/Blocks/components/hero/components/hero-options.js +100 -0
- package/blocks/init/src/Blocks/components/hero/hero.php +45 -0
- package/blocks/init/src/Blocks/components/hero/manifest.json +96 -0
- package/blocks/init/src/Blocks/components/icon/components/icon-editor.js +23 -0
- package/blocks/init/src/Blocks/components/icon/components/icon-options.js +65 -0
- package/blocks/init/src/Blocks/components/icon/icon.php +34 -0
- package/blocks/init/src/Blocks/components/icon/manifest.json +1234 -0
- package/blocks/init/src/Blocks/components/image/components/image-editor.js +65 -0
- package/blocks/init/src/Blocks/components/image/components/image-options.js +111 -0
- package/blocks/init/src/Blocks/components/image/image.php +62 -0
- package/blocks/init/src/Blocks/components/image/manifest.json +125 -0
- package/blocks/init/src/Blocks/components/list/components/list-editor.js +30 -0
- package/blocks/init/src/Blocks/components/list/components/list-options.js +62 -0
- package/blocks/init/src/Blocks/components/list/list.php +32 -0
- package/blocks/init/src/Blocks/components/list/manifest.json +127 -0
- package/blocks/init/src/Blocks/components/load-more/assets/index.js +19 -0
- package/blocks/init/src/Blocks/components/load-more/assets/load-more.js +147 -0
- package/blocks/init/src/Blocks/components/load-more/components/load-more-editor.js +14 -0
- package/blocks/init/src/Blocks/components/load-more/components/load-more-options.js +18 -0
- package/blocks/init/src/Blocks/components/load-more/load-more.php +47 -0
- package/blocks/init/src/Blocks/components/load-more/manifest.json +39 -0
- package/blocks/init/src/Blocks/components/modal/assets/index.js +27 -0
- package/blocks/init/src/Blocks/components/modal/manifest.json +48 -0
- package/blocks/init/src/Blocks/components/modal/modal.php +46 -0
- package/blocks/init/src/Blocks/components/paragraph/components/paragraph-editor.js +40 -0
- package/blocks/init/src/Blocks/components/paragraph/components/paragraph-options.js +48 -0
- package/blocks/init/src/Blocks/components/paragraph/manifest.json +83 -0
- package/blocks/init/src/Blocks/components/paragraph/paragraph.php +33 -0
- package/blocks/init/src/Blocks/components/post-header/manifest.json +5 -0
- package/blocks/init/src/Blocks/components/post-header/post-header.php +24 -0
- package/blocks/init/src/Blocks/components/quote/components/quote-editor.js +53 -0
- package/blocks/init/src/Blocks/components/quote/components/quote-options.js +29 -0
- package/blocks/init/src/Blocks/components/quote/manifest.json +47 -0
- package/blocks/init/src/Blocks/components/quote/quote.php +49 -0
- package/blocks/init/src/Blocks/components/share/assets/index.js +39 -0
- package/blocks/init/src/Blocks/components/share/components/share-editor.js +25 -0
- package/blocks/init/src/Blocks/components/share/components/share-options.js +112 -0
- package/blocks/init/src/Blocks/components/share/manifest.json +72 -0
- package/blocks/init/src/Blocks/components/share/share.php +66 -0
- package/blocks/init/src/Blocks/components/tracking-before-body-end/manifest.json +5 -0
- package/blocks/init/src/Blocks/components/tracking-before-body-end/tracking-before-body-end.php +9 -0
- package/blocks/init/src/Blocks/components/tracking-head/manifest.json +5 -0
- package/blocks/init/src/Blocks/components/tracking-head/tracking-head.php +9 -0
- package/blocks/init/src/Blocks/components/video/components/video-editor.js +74 -0
- package/blocks/init/src/Blocks/components/video/components/video-options.js +280 -0
- package/blocks/init/src/Blocks/components/video/manifest.json +116 -0
- package/blocks/init/src/Blocks/components/video/video.php +72 -0
- package/blocks/init/src/Blocks/custom/accordion/accordion-block.js +15 -0
- package/blocks/init/src/Blocks/custom/accordion/accordion.php +28 -0
- package/blocks/init/src/Blocks/custom/accordion/assets/index.js +37 -0
- package/blocks/init/src/Blocks/custom/accordion/components/accordion-editor.js +17 -0
- package/blocks/init/src/Blocks/custom/accordion/components/accordion-options.js +18 -0
- package/blocks/init/src/Blocks/custom/accordion/manifest.json +32 -0
- package/blocks/init/src/Blocks/custom/accordion-item/accordion-item-block.js +19 -0
- package/blocks/init/src/Blocks/custom/accordion-item/accordion-item.php +46 -0
- package/blocks/init/src/Blocks/custom/accordion-item/components/accordion-item-editor.js +60 -0
- package/blocks/init/src/Blocks/custom/accordion-item/manifest.json +69 -0
- package/blocks/init/src/Blocks/custom/button/button-block.js +13 -0
- package/blocks/init/src/Blocks/custom/button/button.php +11 -0
- package/blocks/init/src/Blocks/custom/button/components/button-editor.js +12 -0
- package/blocks/init/src/Blocks/custom/button/components/button-options.js +12 -0
- package/blocks/init/src/Blocks/custom/button/manifest.json +18 -0
- package/blocks/init/src/Blocks/custom/card/card-block.js +13 -0
- package/blocks/init/src/Blocks/custom/card/card.php +11 -0
- package/blocks/init/src/Blocks/custom/card/components/card-editor.js +12 -0
- package/blocks/init/src/Blocks/custom/card/components/card-options.js +15 -0
- package/blocks/init/src/Blocks/custom/card/manifest.json +18 -0
- package/blocks/init/src/Blocks/custom/carousel/assets/index.js +46 -0
- package/blocks/init/src/Blocks/custom/carousel/assets/navigation.js +31 -0
- package/blocks/init/src/Blocks/custom/carousel/assets/pagination.js +39 -0
- package/blocks/init/src/Blocks/custom/carousel/carousel-block.js +21 -0
- package/blocks/init/src/Blocks/custom/carousel/carousel.php +61 -0
- package/blocks/init/src/Blocks/custom/carousel/components/carousel-editor.js +25 -0
- package/blocks/init/src/Blocks/custom/carousel/components/carousel-options.js +47 -0
- package/blocks/init/src/Blocks/custom/carousel/manifest.json +130 -0
- package/blocks/init/src/Blocks/custom/column/column-block.js +21 -0
- package/blocks/init/src/Blocks/custom/column/column-hooks.js +32 -0
- package/blocks/init/src/Blocks/custom/column/column.php +21 -0
- package/blocks/init/src/Blocks/custom/column/components/column-editor.js +19 -0
- package/blocks/init/src/Blocks/custom/column/components/column-options.js +579 -0
- package/blocks/init/src/Blocks/custom/column/manifest.json +625 -0
- package/blocks/init/src/Blocks/custom/columns/columns-block.js +20 -0
- package/blocks/init/src/Blocks/custom/columns/columns.php +21 -0
- package/blocks/init/src/Blocks/custom/columns/components/columns-editor.js +81 -0
- package/blocks/init/src/Blocks/custom/columns/components/columns-options.js +104 -0
- package/blocks/init/src/Blocks/custom/columns/manifest.json +555 -0
- package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-editor.js +28 -0
- package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-options.js +239 -0
- package/blocks/init/src/Blocks/custom/featured-content/featured-content-block.js +13 -0
- package/blocks/init/src/Blocks/custom/featured-content/featured-content.php +139 -0
- package/blocks/init/src/Blocks/custom/featured-content/manifest.json +131 -0
- package/blocks/init/src/Blocks/custom/featured-content/partials/cards.php +39 -0
- package/blocks/init/src/Blocks/custom/group/components/group-editor.js +8 -0
- package/blocks/init/src/Blocks/custom/group/group-block.js +14 -0
- package/blocks/init/src/Blocks/custom/group/group.php +10 -0
- package/blocks/init/src/Blocks/custom/group/manifest.json +32 -0
- package/blocks/init/src/Blocks/custom/heading/components/heading-editor.js +15 -0
- package/blocks/init/src/Blocks/custom/heading/components/heading-options.js +38 -0
- package/blocks/init/src/Blocks/custom/heading/heading-block.js +13 -0
- package/blocks/init/src/Blocks/custom/heading/heading-transforms.js +25 -0
- package/blocks/init/src/Blocks/custom/heading/heading.php +15 -0
- package/blocks/init/src/Blocks/custom/heading/manifest.json +79 -0
- package/blocks/init/src/Blocks/custom/hero/components/hero-editor.js +12 -0
- package/blocks/init/src/Blocks/custom/hero/components/hero-options.js +14 -0
- package/blocks/init/src/Blocks/custom/hero/hero-block.js +13 -0
- package/blocks/init/src/Blocks/custom/hero/hero.php +11 -0
- package/blocks/init/src/Blocks/custom/hero/manifest.json +17 -0
- package/blocks/init/src/Blocks/custom/image/components/image-editor.js +12 -0
- package/blocks/init/src/Blocks/custom/image/components/image-options.js +14 -0
- package/blocks/init/src/Blocks/custom/image/image-block.js +13 -0
- package/blocks/init/src/Blocks/custom/image/image.php +11 -0
- package/blocks/init/src/Blocks/custom/image/manifest.json +105 -0
- package/blocks/init/src/Blocks/custom/list/components/list-editor.js +14 -0
- package/blocks/init/src/Blocks/custom/list/components/list-options.js +39 -0
- package/blocks/init/src/Blocks/custom/list/list-block.js +13 -0
- package/blocks/init/src/Blocks/custom/list/list.php +15 -0
- package/blocks/init/src/Blocks/custom/list/manifest.json +58 -0
- package/blocks/init/src/Blocks/custom/map/assets/index.js +20 -0
- package/blocks/init/src/Blocks/custom/map/assets/map-controller.js +42 -0
- package/blocks/init/src/Blocks/custom/map/assets/utils.js +161 -0
- package/blocks/init/src/Blocks/custom/map/components/map-components.js +403 -0
- package/blocks/init/src/Blocks/custom/map/components/map-editor.js +56 -0
- package/blocks/init/src/Blocks/custom/map/components/map-options.js +557 -0
- package/blocks/init/src/Blocks/custom/map/manifest.json +79 -0
- package/blocks/init/src/Blocks/custom/map/map-block.js +13 -0
- package/blocks/init/src/Blocks/custom/map/map.php +52 -0
- package/blocks/init/src/Blocks/custom/map/styles.css +2 -0
- package/blocks/init/src/Blocks/custom/modal/components/modal-editor.js +90 -0
- package/blocks/init/src/Blocks/custom/modal/manifest.json +51 -0
- package/blocks/init/src/Blocks/custom/modal/modal-block.js +14 -0
- package/blocks/init/src/Blocks/custom/modal/modal.php +20 -0
- package/blocks/init/src/Blocks/custom/paragraph/components/paragraph-editor.js +41 -0
- package/blocks/init/src/Blocks/custom/paragraph/components/paragraph-options.js +38 -0
- package/blocks/init/src/Blocks/custom/paragraph/manifest.json +79 -0
- package/blocks/init/src/Blocks/custom/paragraph/paragraph-block.js +13 -0
- package/blocks/init/src/Blocks/custom/paragraph/paragraph-transforms.js +45 -0
- package/blocks/init/src/Blocks/custom/paragraph/paragraph.php +15 -0
- package/blocks/init/src/Blocks/custom/quote/components/quote-editor.js +12 -0
- package/blocks/init/src/Blocks/custom/quote/components/quote-options.js +14 -0
- package/blocks/init/src/Blocks/custom/quote/manifest.json +17 -0
- package/blocks/init/src/Blocks/custom/quote/quote-block.js +13 -0
- package/blocks/init/src/Blocks/custom/quote/quote.php +13 -0
- package/blocks/init/src/Blocks/custom/share/components/share-editor.js +6 -0
- package/blocks/init/src/Blocks/custom/share/components/share-options.js +12 -0
- package/blocks/init/src/Blocks/custom/share/manifest.json +19 -0
- package/blocks/init/src/Blocks/custom/share/share-block.js +13 -0
- package/blocks/init/src/Blocks/custom/share/share.php +11 -0
- package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-editor.js +57 -0
- package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-options.js +106 -0
- package/blocks/init/src/Blocks/custom/site-footer/manifest.json +73 -0
- package/blocks/init/src/Blocks/custom/site-footer/site-footer-block.js +13 -0
- package/blocks/init/src/Blocks/custom/site-footer/site-footer.php +72 -0
- package/blocks/init/src/Blocks/custom/site-navigation/assets/index.js +9 -0
- package/blocks/init/src/Blocks/custom/site-navigation/components/site-navigation-editor.js +42 -0
- package/blocks/init/src/Blocks/custom/site-navigation/components/site-navigation-options.js +73 -0
- package/blocks/init/src/Blocks/custom/site-navigation/manifest.json +77 -0
- package/blocks/init/src/Blocks/custom/site-navigation/site-navigation-block.js +13 -0
- package/blocks/init/src/Blocks/custom/site-navigation/site-navigation.php +99 -0
- package/blocks/init/src/Blocks/custom/table-of-contents/assets/index.js +58 -0
- package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-editor.js +38 -0
- package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-options.js +32 -0
- package/blocks/init/src/Blocks/custom/table-of-contents/manifest.json +48 -0
- package/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents-block.js +13 -0
- package/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents.php +31 -0
- package/blocks/init/src/Blocks/custom/video/components/video-editor.js +6 -0
- package/blocks/init/src/Blocks/custom/video/components/video-options.js +12 -0
- package/blocks/init/src/Blocks/custom/video/manifest.json +105 -0
- package/blocks/init/src/Blocks/custom/video/video-block.js +13 -0
- package/blocks/init/src/Blocks/custom/video/video.php +22 -0
- package/blocks/init/src/Blocks/manifest.json +14 -0
- package/blocks/init/src/Blocks/variations/card-simple/manifest.json +17 -0
- package/blocks/init/src/Blocks/wrapper/components/wrapper-editor.js +12 -0
- package/blocks/init/src/Blocks/wrapper/components/wrapper-options.js +348 -0
- package/blocks/init/src/Blocks/wrapper/manifest.json +450 -0
- package/blocks/init/src/Blocks/wrapper/styles-editor.css +13 -0
- package/blocks/init/src/Blocks/wrapper/styles.css +19 -0
- package/blocks/init/src/Blocks/wrapper/wrapper.js +30 -0
- package/blocks/init/src/Blocks/wrapper/wrapper.php +34 -0
- package/eslint.config.mjs +3 -0
- package/linters/base.config.mjs +81 -0
- package/linters/eslint.config.mjs +4 -0
- package/linters/ignore-gitignored.mjs +9 -0
- package/linters/stylelint.config.js +146 -0
- package/package.json +93 -0
- package/readme/packages.md +74 -0
- package/schemas/block.json +302 -0
- package/schemas/component.json +240 -0
- package/schemas/globalManifest.json +73 -0
- package/schemas/variation.json +83 -0
- package/scripts/components/block-inserter.js +70 -0
- package/scripts/components/file-picker.js +243 -0
- package/scripts/components/index.js +6 -0
- package/scripts/components/link-section-editor.js +319 -0
- package/scripts/components/media-picker.js +86 -0
- package/scripts/components/server-side-render.js +37 -0
- package/scripts/components/settings/settings.js +48 -0
- package/scripts/components/settings/use-theme-options.js +52 -0
- package/scripts/editor/attributes.js +304 -0
- package/scripts/editor/colors.js +64 -0
- package/scripts/editor/editor.js +139 -0
- package/scripts/editor/fetch.js +102 -0
- package/scripts/editor/hooks.js +44 -0
- package/scripts/editor/index.js +11 -0
- package/scripts/editor/options.js +152 -0
- package/scripts/editor/registration.js +901 -0
- package/scripts/editor/store.js +213 -0
- package/scripts/editor/tailwindcss.js +224 -0
- package/scripts/editor/utility.js +47 -0
- package/scripts/helpers/breakpoints.js +48 -0
- package/scripts/helpers/cookies.js +65 -0
- package/scripts/helpers/dynamic-import.js +19 -0
- package/scripts/helpers/index.js +11 -0
- package/scripts/index.js +22 -0
- package/scripts/plugins/index.js +3 -0
- package/scripts/plugins/yoast-seo.js +70 -0
- package/webpack/base.mjs +138 -0
- package/webpack/helpers.mjs +67 -0
- package/webpack/index.mjs +52 -0
- package/webpack/production.mjs +60 -0
- package/webpack/project.mjs +55 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { OSM, Vector as VectorSource, VectorTile as VectorTileSource, XYZ, TileJSON } from 'ol/source';
|
|
2
|
+
import { Tile as TileLayer, Vector as VectorLayer, VectorTile as VectorTileLayer } from 'ol/layer';
|
|
3
|
+
import { MapboxVectorLayer } from 'ol-mapbox-style';
|
|
4
|
+
import OLVectorTileLayer from 'ol/layer/VectorTile';
|
|
5
|
+
import { MVT, GeoJSON } from 'ol/format';
|
|
6
|
+
|
|
7
|
+
import OLAttribution from 'ol/control/Attribution.js';
|
|
8
|
+
import OLFullScreen from 'ol/control/FullScreen.js';
|
|
9
|
+
import OLMousePosition from 'ol/control/MousePosition.js';
|
|
10
|
+
import OLOverviewMap from 'ol/control/OverviewMap.js';
|
|
11
|
+
import OLRotate from 'ol/control/Rotate.js';
|
|
12
|
+
import OLScaleLine from 'ol/control/ScaleLine.js';
|
|
13
|
+
import OLZoomSlider from 'ol/control/ZoomSlider.js';
|
|
14
|
+
import OLZoomToExtent from 'ol/control/ZoomToExtent.js';
|
|
15
|
+
import OLZoom from 'ol/control/Zoom.js';
|
|
16
|
+
|
|
17
|
+
import { applyStyle as OLMBStyleApply } from 'ol-mapbox-style';
|
|
18
|
+
|
|
19
|
+
import { Style, Fill, Stroke, Icon } from 'ol/style';
|
|
20
|
+
|
|
21
|
+
import manifest from '../manifest.json';
|
|
22
|
+
|
|
23
|
+
export const processMapInteraction = (type, options = {}) => {
|
|
24
|
+
switch (type) {
|
|
25
|
+
case 'attribution':
|
|
26
|
+
return new OLAttribution(options);
|
|
27
|
+
case 'fullScreen':
|
|
28
|
+
return new OLFullScreen(options);
|
|
29
|
+
case 'mousePosition':
|
|
30
|
+
return new OLMousePosition(options);
|
|
31
|
+
case 'overviewMap':
|
|
32
|
+
return new OLOverviewMap(
|
|
33
|
+
Object.keys(options).length > 0
|
|
34
|
+
? options
|
|
35
|
+
: {
|
|
36
|
+
layers: [new TileLayer({ source: new OSM() })],
|
|
37
|
+
mapOptions: {
|
|
38
|
+
maxResolution: 0.0015,
|
|
39
|
+
numZoomLevels: 2,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
case 'rotate':
|
|
44
|
+
return new OLRotate(options);
|
|
45
|
+
case 'scaleLine':
|
|
46
|
+
return new OLScaleLine(options);
|
|
47
|
+
case 'zoomSlider':
|
|
48
|
+
return new OLZoomSlider(options);
|
|
49
|
+
case 'zoomToExtent':
|
|
50
|
+
return new OLZoomToExtent(options);
|
|
51
|
+
case 'zoom':
|
|
52
|
+
return new OLZoom(options);
|
|
53
|
+
default:
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const processMapLayer = (layer) => {
|
|
59
|
+
if (layer?.type === 'vectorJson') {
|
|
60
|
+
const mapLayer = new OLVectorTileLayer({ declutter: true });
|
|
61
|
+
OLMBStyleApply(mapLayer, layer?.styleUrl, { accessToken: layer?.apiKey });
|
|
62
|
+
|
|
63
|
+
return mapLayer;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
switch (layer?.type) {
|
|
67
|
+
case 'openStreetMap':
|
|
68
|
+
return new TileLayer({
|
|
69
|
+
source: new OSM(),
|
|
70
|
+
});
|
|
71
|
+
case 'mapBoxVector':
|
|
72
|
+
if (!layer?.apiKey) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return new MapboxVectorLayer({
|
|
77
|
+
styleUrl: layer?.styleUrl,
|
|
78
|
+
accessToken: layer?.apiKey,
|
|
79
|
+
});
|
|
80
|
+
case 'mapBoxRaster':
|
|
81
|
+
if (!layer?.apiKey) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return new TileLayer({
|
|
86
|
+
source: new XYZ({
|
|
87
|
+
url: layer?.styleUrl,
|
|
88
|
+
}),
|
|
89
|
+
});
|
|
90
|
+
case 'mapTilerVector':
|
|
91
|
+
if (!layer?.apiKey) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return new VectorTileLayer({
|
|
96
|
+
source: new VectorTileSource({
|
|
97
|
+
format: new MVT(),
|
|
98
|
+
url: layer?.styleUrl,
|
|
99
|
+
}),
|
|
100
|
+
});
|
|
101
|
+
case 'mapTilerRasterXyz':
|
|
102
|
+
if (!layer?.apiKey) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return new TileLayer({
|
|
107
|
+
source: new XYZ({
|
|
108
|
+
url: layer?.styleUrl,
|
|
109
|
+
}),
|
|
110
|
+
});
|
|
111
|
+
case 'mapTilerRasterJson':
|
|
112
|
+
if (!layer?.apiKey) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return new TileLayer({
|
|
117
|
+
source: new TileJSON({
|
|
118
|
+
url: layer?.styleUrl,
|
|
119
|
+
}),
|
|
120
|
+
});
|
|
121
|
+
case 'geoJson':
|
|
122
|
+
if (!layer?.geoJsonUrl) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return new VectorLayer({
|
|
127
|
+
source: new VectorSource({
|
|
128
|
+
format: new GeoJSON(),
|
|
129
|
+
url: layer?.geoJsonUrl,
|
|
130
|
+
}),
|
|
131
|
+
// Stylize GeoJSON features based on type.
|
|
132
|
+
style: (feature, resolution) => {
|
|
133
|
+
const name = feature.getGeometry().getType();
|
|
134
|
+
|
|
135
|
+
if (name === 'Point') {
|
|
136
|
+
return new Style({
|
|
137
|
+
image: new Icon({
|
|
138
|
+
src: manifest.resources.markerIcon,
|
|
139
|
+
scale: 2 / Math.pow(resolution, 1 / 4),
|
|
140
|
+
displacement: [0, 15 / Math.pow(resolution, 1 / 4)],
|
|
141
|
+
}),
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return new Style({
|
|
146
|
+
fill: new Fill({
|
|
147
|
+
color: 'rgb(58 102 168 / 0.25)',
|
|
148
|
+
}),
|
|
149
|
+
stroke: new Stroke({
|
|
150
|
+
color: '#3A66A8',
|
|
151
|
+
lineJoin: 'round',
|
|
152
|
+
lineCap: 'round',
|
|
153
|
+
width: 2.5,
|
|
154
|
+
}),
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return null;
|
|
161
|
+
};
|
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
/* eslint-disable consistent-return */
|
|
2
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
3
|
+
|
|
4
|
+
import React, { createContext, useRef, useState, useEffect, useContext } from 'react';
|
|
5
|
+
import { Map as OLMap, View } from 'ol';
|
|
6
|
+
import { OSM, Vector as VectorSource, VectorTile as VectorTileSource, XYZ, TileJSON } from 'ol/source';
|
|
7
|
+
import { Tile as OLTileLayer, Vector as OLVectorLayer, VectorTile as OLVectorTile } from 'ol/layer';
|
|
8
|
+
import { MapboxVectorLayer } from 'ol-mapbox-style';
|
|
9
|
+
import OLVectorTileLayer from 'ol/layer/VectorTile';
|
|
10
|
+
import { useGeographic } from 'ol/proj';
|
|
11
|
+
import { MVT, GeoJSON } from 'ol/format';
|
|
12
|
+
import { defaults as OLDefaultInteractions } from 'ol/interaction/defaults';
|
|
13
|
+
import { defaults as OLDefaultControls } from 'ol/control/defaults';
|
|
14
|
+
|
|
15
|
+
import OLAttribution from 'ol/control/Attribution.js';
|
|
16
|
+
import OLFullScreen from 'ol/control/FullScreen.js';
|
|
17
|
+
import OLMousePosition from 'ol/control/MousePosition.js';
|
|
18
|
+
import OLOverviewMap from 'ol/control/OverviewMap.js';
|
|
19
|
+
import OLRotate from 'ol/control/Rotate.js';
|
|
20
|
+
import OLScaleLine from 'ol/control/ScaleLine.js';
|
|
21
|
+
import OLZoomSlider from 'ol/control/ZoomSlider.js';
|
|
22
|
+
import OLZoomToExtent from 'ol/control/ZoomToExtent.js';
|
|
23
|
+
import OLZoom from 'ol/control/Zoom.js';
|
|
24
|
+
|
|
25
|
+
import { applyStyle as OLMBStyleApply } from 'ol-mapbox-style';
|
|
26
|
+
|
|
27
|
+
import { Style, Fill, Stroke, Icon } from 'ol/style';
|
|
28
|
+
|
|
29
|
+
import manifest from '../manifest.json';
|
|
30
|
+
import { getTwClasses } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
31
|
+
|
|
32
|
+
export const MapContext = new createContext();
|
|
33
|
+
|
|
34
|
+
export const OpenLayersMap = ({ children, zoom, center, attributes, manifest }) => {
|
|
35
|
+
const mapRef = useRef();
|
|
36
|
+
const [map, setMap] = useState(null);
|
|
37
|
+
|
|
38
|
+
// Map init.
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
useGeographic();
|
|
41
|
+
|
|
42
|
+
let options = {
|
|
43
|
+
view: new View({ zoom, center }),
|
|
44
|
+
layers: [],
|
|
45
|
+
interactions: [],
|
|
46
|
+
controls: [],
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const mapObject = new OLMap(options);
|
|
50
|
+
mapObject.setTarget(mapRef.current);
|
|
51
|
+
setMap(mapObject);
|
|
52
|
+
|
|
53
|
+
return () => mapObject.setTarget(undefined);
|
|
54
|
+
}, []);
|
|
55
|
+
|
|
56
|
+
// Default zoom level change.
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (!map) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
map.getView().setZoom(zoom);
|
|
63
|
+
}, [zoom]);
|
|
64
|
+
|
|
65
|
+
// Default center point change.
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (!map) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
map.getView().setCenter(center);
|
|
72
|
+
}, [center]);
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<MapContext.Provider value={{ map }}>
|
|
76
|
+
<div
|
|
77
|
+
ref={mapRef}
|
|
78
|
+
className={getTwClasses(attributes, manifest)}
|
|
79
|
+
>
|
|
80
|
+
{children}
|
|
81
|
+
</div>
|
|
82
|
+
</MapContext.Provider>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const Layers = ({ children }) => children;
|
|
87
|
+
export const Interactions = ({ children }) => children;
|
|
88
|
+
export const Overlays = ({ children }) => children;
|
|
89
|
+
export const Controls = ({ children }) => children;
|
|
90
|
+
|
|
91
|
+
export const MapLayer = (props) => {
|
|
92
|
+
const { type = 'tile', source, accessToken, styleUrl, style } = props;
|
|
93
|
+
|
|
94
|
+
const { map } = useContext(MapContext);
|
|
95
|
+
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (!map) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
let tileLayer;
|
|
102
|
+
|
|
103
|
+
switch (type) {
|
|
104
|
+
case 'mapboxVector':
|
|
105
|
+
tileLayer = new MapboxVectorLayer({
|
|
106
|
+
styleUrl,
|
|
107
|
+
accessToken,
|
|
108
|
+
});
|
|
109
|
+
break;
|
|
110
|
+
case 'vectorJson':
|
|
111
|
+
tileLayer = new OLVectorTileLayer({ declutter: true });
|
|
112
|
+
break;
|
|
113
|
+
case 'vectorTile':
|
|
114
|
+
tileLayer = new OLVectorTile({
|
|
115
|
+
source,
|
|
116
|
+
});
|
|
117
|
+
break;
|
|
118
|
+
case 'vector':
|
|
119
|
+
tileLayer = new OLVectorLayer({
|
|
120
|
+
source,
|
|
121
|
+
style,
|
|
122
|
+
});
|
|
123
|
+
break;
|
|
124
|
+
default:
|
|
125
|
+
tileLayer = new OLTileLayer({
|
|
126
|
+
source,
|
|
127
|
+
});
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (type === 'vectorJson') {
|
|
132
|
+
OLMBStyleApply(tileLayer, styleUrl, { accessToken: accessToken });
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
map.addLayer(tileLayer);
|
|
136
|
+
|
|
137
|
+
return () => {
|
|
138
|
+
if (map) {
|
|
139
|
+
map.removeLayer(tileLayer);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}, [map]);
|
|
143
|
+
return null;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const MapInteraction = (props) => {
|
|
147
|
+
const { type = 'defaults', options = {} } = props;
|
|
148
|
+
|
|
149
|
+
const { map } = useContext(MapContext);
|
|
150
|
+
|
|
151
|
+
useEffect(() => {
|
|
152
|
+
if (!map) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
let interaction;
|
|
157
|
+
|
|
158
|
+
switch (type) {
|
|
159
|
+
default:
|
|
160
|
+
interaction = OLDefaultInteractions(options).getArray();
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (Array.isArray(interaction)) {
|
|
165
|
+
interaction.forEach((i) => map.addInteraction(i));
|
|
166
|
+
} else {
|
|
167
|
+
map.addInteraction(interaction);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return () => {
|
|
171
|
+
if (map) {
|
|
172
|
+
if (Array.isArray(interaction)) {
|
|
173
|
+
interaction.forEach((i) => map.removeInteraction(i));
|
|
174
|
+
} else {
|
|
175
|
+
map.removeInteraction(interaction);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
}, [map]);
|
|
180
|
+
return null;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export const MapControl = (props) => {
|
|
184
|
+
const { type = 'defaults', options = {} } = props;
|
|
185
|
+
|
|
186
|
+
const { map } = useContext(MapContext);
|
|
187
|
+
|
|
188
|
+
useEffect(() => {
|
|
189
|
+
if (!map) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
let control;
|
|
194
|
+
|
|
195
|
+
switch (type) {
|
|
196
|
+
case 'attribution':
|
|
197
|
+
control = new OLAttribution(options);
|
|
198
|
+
break;
|
|
199
|
+
case 'fullScreen':
|
|
200
|
+
control = new OLFullScreen(options);
|
|
201
|
+
break;
|
|
202
|
+
case 'mousePosition':
|
|
203
|
+
control = new OLMousePosition(options);
|
|
204
|
+
break;
|
|
205
|
+
case 'overviewMap':
|
|
206
|
+
control = new OLOverviewMap(
|
|
207
|
+
Object.keys(options).length > 0
|
|
208
|
+
? options
|
|
209
|
+
: {
|
|
210
|
+
layers: [new OLTileLayer({ source: new OSM() })],
|
|
211
|
+
mapOptions: {
|
|
212
|
+
maxResolution: 0.0015,
|
|
213
|
+
numZoomLevels: 2,
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
);
|
|
217
|
+
break;
|
|
218
|
+
case 'rotate':
|
|
219
|
+
control = new OLRotate(options);
|
|
220
|
+
break;
|
|
221
|
+
case 'scaleLine':
|
|
222
|
+
control = new OLScaleLine(options);
|
|
223
|
+
break;
|
|
224
|
+
case 'zoomSlider':
|
|
225
|
+
control = new OLZoomSlider(options);
|
|
226
|
+
break;
|
|
227
|
+
case 'zoomToExtent':
|
|
228
|
+
control = new OLZoomToExtent(options);
|
|
229
|
+
break;
|
|
230
|
+
case 'zoom':
|
|
231
|
+
control = new OLZoom(options);
|
|
232
|
+
break;
|
|
233
|
+
default:
|
|
234
|
+
control = OLDefaultControls(options).getArray();
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (Array.isArray(control)) {
|
|
239
|
+
control.forEach((i) => map.addControl(i));
|
|
240
|
+
} else {
|
|
241
|
+
map.addControl(control);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return () => {
|
|
245
|
+
if (map) {
|
|
246
|
+
if (Array.isArray(control)) {
|
|
247
|
+
control.forEach((i) => map.removeControl(i));
|
|
248
|
+
} else {
|
|
249
|
+
map.removeControl(control);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
}, [map]);
|
|
254
|
+
return null;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
export const processMapLayer = (layer) => {
|
|
258
|
+
if (layer?.hidden) {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
switch (layer?.type) {
|
|
263
|
+
case 'openStreetMap':
|
|
264
|
+
return <MapLayer source={new OSM()} />;
|
|
265
|
+
case 'mapBoxVector':
|
|
266
|
+
if (!layer?.apiKey || layer?.styleUrl?.length < 1) {
|
|
267
|
+
return null;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return (
|
|
271
|
+
<MapLayer
|
|
272
|
+
key={layer?.id ?? Math.random()}
|
|
273
|
+
type='mapboxVector'
|
|
274
|
+
styleUrl={layer?.styleUrl}
|
|
275
|
+
accessToken={layer?.apiKey}
|
|
276
|
+
/>
|
|
277
|
+
);
|
|
278
|
+
case 'mapBoxRaster':
|
|
279
|
+
if (!layer?.apiKey || layer?.styleUrl?.length < 1) {
|
|
280
|
+
return null;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return (
|
|
284
|
+
<MapLayer
|
|
285
|
+
key={layer?.id ?? Math.random()}
|
|
286
|
+
source={
|
|
287
|
+
new XYZ({
|
|
288
|
+
url: layer?.styleUrl,
|
|
289
|
+
})
|
|
290
|
+
}
|
|
291
|
+
/>
|
|
292
|
+
);
|
|
293
|
+
case 'mapTilerVector':
|
|
294
|
+
if (!layer?.apiKey || layer?.styleUrl?.length < 1) {
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
return (
|
|
299
|
+
<MapLayer
|
|
300
|
+
key={layer?.id ?? Math.random()}
|
|
301
|
+
type='vectorTile'
|
|
302
|
+
source={
|
|
303
|
+
new VectorTileSource({
|
|
304
|
+
format: new MVT(),
|
|
305
|
+
url: layer?.styleUrl,
|
|
306
|
+
})
|
|
307
|
+
}
|
|
308
|
+
/>
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
case 'vectorJson':
|
|
312
|
+
if (!layer?.apiKey || layer?.styleUrl?.length < 1) {
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return (
|
|
317
|
+
<MapLayer
|
|
318
|
+
key={layer?.id ?? Math.random()}
|
|
319
|
+
type='vectorJson'
|
|
320
|
+
styleUrl={layer?.styleUrl}
|
|
321
|
+
accessToken={layer?.apiKey}
|
|
322
|
+
/>
|
|
323
|
+
);
|
|
324
|
+
|
|
325
|
+
case 'mapTilerRasterXyz':
|
|
326
|
+
if (!layer?.apiKey || layer?.styleUrl?.length < 1) {
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
return (
|
|
331
|
+
<MapLayer
|
|
332
|
+
key={layer?.id ?? Math.random()}
|
|
333
|
+
source={
|
|
334
|
+
new XYZ({
|
|
335
|
+
url: layer?.styleUrl,
|
|
336
|
+
})
|
|
337
|
+
}
|
|
338
|
+
/>
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
case 'mapTilerRasterJson':
|
|
342
|
+
if (!layer?.apiKey) {
|
|
343
|
+
return null;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return (
|
|
347
|
+
<MapLayer
|
|
348
|
+
key={layer?.id ?? Math.random()}
|
|
349
|
+
source={
|
|
350
|
+
new TileJSON({
|
|
351
|
+
url: layer?.styleUrl,
|
|
352
|
+
})
|
|
353
|
+
}
|
|
354
|
+
/>
|
|
355
|
+
);
|
|
356
|
+
|
|
357
|
+
case 'geoJson':
|
|
358
|
+
if (!layer?.geoJsonUrl) {
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
return (
|
|
363
|
+
<MapLayer
|
|
364
|
+
key={layer?.id ?? Math.random()}
|
|
365
|
+
type='vector'
|
|
366
|
+
source={
|
|
367
|
+
new VectorSource({
|
|
368
|
+
format: new GeoJSON(),
|
|
369
|
+
url: layer?.geoJsonUrl,
|
|
370
|
+
})
|
|
371
|
+
}
|
|
372
|
+
// Stylize GeoJSON features based on type.
|
|
373
|
+
style={(feature, resolution) => {
|
|
374
|
+
const name = feature.getGeometry().getType();
|
|
375
|
+
|
|
376
|
+
if (name === 'Point') {
|
|
377
|
+
return new Style({
|
|
378
|
+
image: new Icon({
|
|
379
|
+
src: manifest.resources.markerIcon,
|
|
380
|
+
scale: 2 / Math.pow(resolution, 1 / 4),
|
|
381
|
+
displacement: [0, 15 / Math.pow(resolution, 1 / 4)],
|
|
382
|
+
}),
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
return new Style({
|
|
387
|
+
fill: new Fill({
|
|
388
|
+
color: 'rgb(58 102 168 / 0.25)',
|
|
389
|
+
}),
|
|
390
|
+
stroke: new Stroke({
|
|
391
|
+
color: '#3A66A8',
|
|
392
|
+
lineJoin: 'round',
|
|
393
|
+
lineCap: 'round',
|
|
394
|
+
width: 2.5,
|
|
395
|
+
}),
|
|
396
|
+
});
|
|
397
|
+
}}
|
|
398
|
+
/>
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
return null;
|
|
403
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { checkAttr } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
2
|
+
import {
|
|
3
|
+
Interactions,
|
|
4
|
+
Layers,
|
|
5
|
+
MapInteraction,
|
|
6
|
+
OpenLayersMap,
|
|
7
|
+
Controls,
|
|
8
|
+
MapControl,
|
|
9
|
+
processMapLayer,
|
|
10
|
+
} from './map-components';
|
|
11
|
+
import manifest from '../manifest.json';
|
|
12
|
+
|
|
13
|
+
export const MapEditor = ({ attributes }) => {
|
|
14
|
+
const mapLayers = checkAttr('mapLayers', attributes, manifest);
|
|
15
|
+
const mapCenterLat = checkAttr('mapCenterLat', attributes, manifest, true);
|
|
16
|
+
const mapCenterLon = checkAttr('mapCenterLon', attributes, manifest, true);
|
|
17
|
+
const mapZoom = checkAttr('mapZoom', attributes, manifest);
|
|
18
|
+
const mapInteractions = checkAttr('mapInteractions', attributes, manifest);
|
|
19
|
+
const mapControls = checkAttr('mapControls', attributes, manifest);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<OpenLayersMap
|
|
23
|
+
attributes={attributes}
|
|
24
|
+
manifest={manifest}
|
|
25
|
+
center={[mapCenterLon ?? 16.352532, mapCenterLat ?? 46.314045]}
|
|
26
|
+
zoom={mapZoom}
|
|
27
|
+
>
|
|
28
|
+
<Layers key={mapLayers.map(({ id, type }) => `${id}-${type}`).join(',')}>
|
|
29
|
+
{[...mapLayers].reverse().map((layer) => processMapLayer(layer))}
|
|
30
|
+
</Layers>
|
|
31
|
+
|
|
32
|
+
<Interactions>
|
|
33
|
+
<MapInteraction
|
|
34
|
+
key={Math.random()}
|
|
35
|
+
type='defaults'
|
|
36
|
+
options={mapInteractions}
|
|
37
|
+
/>
|
|
38
|
+
</Interactions>
|
|
39
|
+
|
|
40
|
+
<Controls>
|
|
41
|
+
{Object.entries(mapControls).map(([type, use]) => {
|
|
42
|
+
if (!use) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<MapControl
|
|
48
|
+
key={Math.random()}
|
|
49
|
+
type={type}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
})}
|
|
53
|
+
</Controls>
|
|
54
|
+
</OpenLayersMap>
|
|
55
|
+
);
|
|
56
|
+
};
|