diff --git a/.eslintrc.json b/.eslintrc.json index 4dc11c0d65..8f4f68036b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -28,5 +28,8 @@ ], "rules": { "no-self-assign": "off" + }, + "globals": { + "GeolocationPositionError": true } } diff --git a/packages/builder/src/components/design/AppPreview/componentStructure.json b/packages/builder/src/components/design/AppPreview/componentStructure.json index cacd70a89b..6873ae547d 100644 --- a/packages/builder/src/components/design/AppPreview/componentStructure.json +++ b/packages/builder/src/components/design/AppPreview/componentStructure.json @@ -82,7 +82,8 @@ "link", "icon", "embed", - "markdownviewer" + "markdownviewer", + "embeddedmap" ] } ] diff --git a/packages/client/manifest.json b/packages/client/manifest.json index d8e589588f..11c927700e 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -2474,6 +2474,82 @@ } ] }, + "embeddedmap": { + "name": "Embedded Map", + "icon": "Location", + "styles": ["size"], + "editable": true, + "draggable": false, + "illegalChildren": [ + "section" + ], + "settings": [ + { + "type": "dataProvider", + "label": "Provider", + "key": "dataProvider" + }, + { + "type": "select", + "label": "Map Type", + "key": "mapType", + "options": [ + "Roadmap", + "Terrain", + "Satellite", + "Hybrid" + ], + "defaultValue": "Roadmap" + }, + { + "type": "boolean", + "label": "Enable Fullscreen", + "key": "fullScreenEnabled", + "defaultValue": true + }, + { + "type": "boolean", + "label": "Enabled Location", + "key": "locationEnabled", + "defaultValue": false + }, + { + "type": "boolean", + "label": "Enable Zoom", + "key": "zoomEnabled", + "defaultValue": true + }, + { + "type": "number", + "label": "Zoom Level (0-100)", + "key": "zoomLevel", + "defaultValue": 72, + "max" : 100, + "min" : 0 + }, + { + "type": "field", + "label": "Latitude Key", + "key": "latitudeKey" + }, + { + "type": "field", + "label": "Longitude Key", + "key": "longitudeKey" + }, + { + "type": "field", + "label": "Title Key", + "key": "titleKey" + }, + { + "type": "text", + "label": "Tile URL", + "key": "tileURL", + "defaultValue": "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" + } + ] + }, "attachmentfield": { "name": "Attachment", "icon": "Attach", diff --git a/packages/client/package.json b/packages/client/package.json index 8772b9135f..16a2f34c8e 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -32,8 +32,10 @@ "@spectrum-css/vars": "^3.0.1", "apexcharts": "^3.22.1", "dayjs": "^1.10.5", + "leaflet": "^1.7.1", "regexparam": "^1.3.0", "rollup-plugin-polyfill-node": "^0.8.0", + "screenfull": "^6.0.1", "shortid": "^2.2.15", "svelte": "^3.38.2", "svelte-apexcharts": "^1.0.2", diff --git a/packages/client/src/components/Component.svelte b/packages/client/src/components/Component.svelte index 78fff52426..e4176587ee 100644 --- a/packages/client/src/components/Component.svelte +++ b/packages/client/src/components/Component.svelte @@ -103,7 +103,12 @@ ($builderStore.previewType === "layout" || insideScreenslot) && !isBlock $: editing = editable && selected && $builderStore.editMode - $: draggable = !inDragPath && interactive && !isLayout && !isScreen + $: draggable = + !inDragPath && + interactive && + !isLayout && + !isScreen && + definition?.draggable !== false $: droppable = interactive && !isLayout && !isScreen // Empty components are those which accept children but do not have any. diff --git a/packages/client/src/components/app/EmbeddedMap.svelte b/packages/client/src/components/app/EmbeddedMap.svelte new file mode 100644 index 0000000000..63b98ba651 --- /dev/null +++ b/packages/client/src/components/app/EmbeddedMap.svelte @@ -0,0 +1,266 @@ + + +
+ + diff --git a/packages/client/src/components/app/EmbeddedMapControls.js b/packages/client/src/components/app/EmbeddedMapControls.js new file mode 100644 index 0000000000..ca1b1ed22a --- /dev/null +++ b/packages/client/src/components/app/EmbeddedMapControls.js @@ -0,0 +1,192 @@ +import L from "leaflet" +import screenfull from "screenfull" + +const createButton = function (html, title, className, container, fn) { + let link = L.DomUtil.create("a", className, container) + link.innerHTML = html + link.href = "#" + link.title = title + + link.setAttribute("role", "button") + link.setAttribute("aria-label", title) + + L.DomEvent.disableClickPropagation(link) + L.DomEvent.on(link, "click", L.DomEvent.stop) + L.DomEvent.on(link, "click", fn, this) + L.DomEvent.on(link, "click", this._refocusOnMap, this) + + return link +} + +// Full Screen Control + +const FullScreenControl = L.Control.extend({ + options: { + position: "topright", + fullScreenContent: + '