@open-pioneer/selection 0.11.0 → 0.12.0-dev.20250905090001
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -1
- package/DragController.js.map +1 -1
- package/Selection.js +6 -12
- package/Selection.js.map +1 -1
- package/SelectionController.js.map +1 -1
- package/VectorSelectionSource.js.map +1 -1
- package/package.json +5 -5
- package/services.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @open-pioneer/selection
|
|
2
2
|
|
|
3
|
+
## 0.12.0-dev.20250905090001
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2732052: Icons have been changed to unify the appearance of the components. Preferably, Lucide react-icons are used.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 10d2fe7: Update dependencies
|
|
12
|
+
- da6a410: Update dependencies
|
|
13
|
+
- Updated dependencies [29a10df]
|
|
14
|
+
- Updated dependencies [10d2fe7]
|
|
15
|
+
- Updated dependencies [2702df4]
|
|
16
|
+
- Updated dependencies [12561fe]
|
|
17
|
+
- Updated dependencies [5df900f]
|
|
18
|
+
- Updated dependencies [8986b3b]
|
|
19
|
+
- Updated dependencies [aeb9000]
|
|
20
|
+
- Updated dependencies [5df900f]
|
|
21
|
+
- Updated dependencies [f1f69f2]
|
|
22
|
+
- Updated dependencies [da6a410]
|
|
23
|
+
- @open-pioneer/map@0.12.0-dev.20250905090001
|
|
24
|
+
|
|
3
25
|
## 0.11.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
|
@@ -98,7 +120,6 @@
|
|
|
98
120
|
- b717121: Adjust the type the property `vectorLayer` of the exported interface `VectorLayerSelectionSourceOptions`.
|
|
99
121
|
The type is now `VectorLayer<VectorSource, Feature>` instead of `VectorLayer<Feature>`.
|
|
100
122
|
- 2fa8020: Update trails core package dependencies.
|
|
101
|
-
|
|
102
123
|
- Also updates Chakra UI to the latest 2.x version and Chakra React Select to version 5.
|
|
103
124
|
- Removes any obsolete references to `@chakra-ui/system`.
|
|
104
125
|
This dependency seems to be no longer required and may lead to duplicate packages in your dependency tree.
|
package/DragController.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragController.js","sources":["DragController.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { reactive, watch } from \"@conterra/reactivity-core\";\nimport { Resource } from \"@open-pioneer/core\";\nimport { MapBrowserEvent } from \"ol\";\nimport OlMap from \"ol/Map\";\nimport { unByKey } from \"ol/Observable\";\nimport Overlay from \"ol/Overlay\";\nimport { mouseActionButton } from \"ol/events/condition\";\nimport Geometry from \"ol/geom/Geometry\";\nimport { DragBox, DragPan } from \"ol/interaction\";\nimport PointerInteraction from \"ol/interaction/Pointer\";\n\ninterface InteractionResource extends Resource {\n interaction: PointerInteraction;\n}\n/** Represents a tooltip rendered on the OpenLayers map. */\ninterface Tooltip extends Resource {\n overlay: Overlay;\n element: HTMLDivElement;\n setText(value: string): void;\n}\n\nconst ACTIVE_CLASS = \"selection-active\";\nconst INACTIVE_CLASS = \"selection-inactive\";\n\nexport class DragController {\n private tooltip: Tooltip;\n private interactionResources: InteractionResource[] = [];\n private olMap: OlMap;\n private isActive = reactive(true);\n private tooltipMessage: string;\n private tooltipDisabledMessage: string;\n private tooltipSync: Resource | undefined;\n\n constructor(\n olMap: OlMap,\n tooltipMessage: string,\n tooltipDisabledMessage: string,\n onExtentSelected: (geometry: Geometry) => void\n ) {\n const viewPort = this.initViewport(olMap);\n this.interactionResources.push(\n this.createDragBox(olMap, onExtentSelected, viewPort, this.interactionResources)\n );\n this.interactionResources.push(this.createDrag(olMap, viewPort, this.interactionResources));\n\n this.tooltip = this.createHelpTooltip(olMap, tooltipMessage);\n this.olMap = olMap;\n this.tooltipMessage = tooltipMessage;\n this.tooltipDisabledMessage = tooltipDisabledMessage;\n\n this.tooltipSync = watch(\n () => [this.isActive.value, this.tooltipText],\n ([isActive, tooltipText]) => {\n this.tooltip.setText(tooltipText);\n viewPort.classList.toggle(ACTIVE_CLASS, isActive);\n viewPort.classList.toggle(INACTIVE_CLASS, !isActive);\n },\n {\n immediate: true\n }\n );\n }\n\n initViewport(olMap: OlMap) {\n const viewPort = olMap.getViewport();\n viewPort.classList.add(ACTIVE_CLASS);\n\n viewPort.oncontextmenu = (e) => {\n e.preventDefault();\n return false;\n };\n return viewPort;\n }\n\n /**\n * Method for destroying the controller when it is no longer needed\n */\n destroy() {\n this.tooltipSync?.destroy();\n this.tooltipSync = undefined;\n\n this.tooltip.destroy();\n this.interactionResources.forEach((interaction) => {\n interaction.destroy();\n });\n }\n\n /**\n * The current tooltip text shown to the user.\n */\n get tooltipText(): string {\n const isActive = this.isActive.value;\n return isActive ? this.tooltipMessage : this.tooltipDisabledMessage;\n }\n\n setActive(isActive: boolean) {\n if (this.isActive.value === isActive) {\n return;\n }\n\n if (isActive) {\n this.interactionResources.forEach((interaction) =>\n this.olMap.addInteraction(interaction.interaction)\n );\n this.isActive.value = true;\n } else {\n this.interactionResources.forEach((interaction) =>\n this.olMap.removeInteraction(interaction.interaction)\n );\n this.isActive.value = false;\n }\n }\n\n /**\n * Method to create a simple extent-selection\n */\n private createDragBox(\n olMap: OlMap,\n onExtentSelected: (geometry: Geometry) => void,\n viewPort: HTMLElement,\n interactionResources: InteractionResource[]\n ): InteractionResource {\n const dragBox = new DragBox({\n className: \"selection-drag-box\",\n condition: mouseActionButton\n });\n\n olMap.addInteraction(dragBox);\n dragBox.on(\"boxend\", function () {\n onExtentSelected(dragBox.getGeometry());\n });\n\n const interactionResource: InteractionResource = {\n interaction: dragBox,\n destroy() {\n olMap.removeInteraction(dragBox);\n interactionResources.splice(interactionResources.indexOf(this));\n dragBox.dispose();\n viewPort.classList.remove(ACTIVE_CLASS);\n viewPort.classList.remove(INACTIVE_CLASS);\n viewPort.oncontextmenu = null;\n }\n };\n return interactionResource;\n }\n\n /**\n * Method to activate pan with right-mouse-click\n */\n private createDrag(\n olMap: OlMap,\n viewPort: HTMLElement,\n interactionResources: InteractionResource[]\n ): InteractionResource {\n const condition = function (mapBrowserEvent: MapBrowserEvent) {\n const originalEvent = mapBrowserEvent.originalEvent;\n return \"button\" in originalEvent && originalEvent.button == 2;\n };\n const drag = new DragPan({\n condition: condition\n });\n\n olMap.addInteraction(drag);\n\n const interactionResource: InteractionResource = {\n interaction: drag,\n destroy() {\n olMap.removeInteraction(drag);\n interactionResources.splice(interactionResources.indexOf(this));\n drag.dispose();\n viewPort.classList.remove(ACTIVE_CLASS);\n viewPort.classList.remove(INACTIVE_CLASS);\n viewPort.oncontextmenu = null;\n }\n };\n\n return interactionResource;\n }\n\n /**\n * Method to generate a tooltip on the mouse cursor\n */\n private createHelpTooltip(olMap: OlMap, message: string): Tooltip {\n const element = document.createElement(\"div\");\n element.className = \"selection-tooltip printing-hide\";\n element.role = \"tooltip\";\n\n const content = document.createElement(\"span\");\n content.textContent = message;\n element.appendChild(content);\n\n const overlay = new Overlay({\n element: element,\n offset: [15, 0],\n positioning: \"center-left\"\n });\n\n const pointHandler = olMap.on(\"pointermove\", (evt) => {\n overlay.setPosition(evt.coordinate);\n });\n\n olMap.addOverlay(overlay);\n return {\n overlay,\n element,\n destroy() {\n olMap.removeOverlay(overlay);\n overlay.dispose();\n unByKey(pointHandler);\n },\n setText(value) {\n content.textContent = value;\n }\n };\n }\n\n /**\n * Method for testing purposes only\n * @returns InteractionResource of class DragBox\n */\n getDragboxInteraction() {\n return this.interactionResources.find(\n (interactionResource) => interactionResource.interaction instanceof DragBox\n );\n }\n\n /**\n * Method for testing purposes only\n * @returns InteractionResource of class DragPan\n */\n getDragPanInteraction() {\n return this.interactionResources.find(\n (interactionResource) => interactionResource.interaction instanceof DragPan\n );\n }\n}\n"],"names":[],"mappings":";;;;;;AAuBA,MAAM,YAA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A,WAAA,CAAY,IAAI,UAAU,CAAA;AAAA,KACrC,CAAA;AAED,IAAA,KAAA,CAAM,WAAW,OAAO,CAAA;AACxB,IAAO,OAAA;AAAA,MACH,OAAA;AAAA,MACA,OAAA;AAAA,MACA,OAAU,GAAA;AACN,QAAA,KAAA,CAAM,cAAc,OAAO,CAAA;AAC3B,QAAA,OAAA,CAAQ,OAAQ,EAAA;AAChB,QAAA,OAAA,CAAQ,YAAY,CAAA;AAAA,OACxB;AAAA,MACA,QAAQ,KAAO,EAAA;AACX,QAAA,OAAA,CAAQ,WAAc,GAAA,KAAA;AAAA;AAC1B,KACJ;AAAA;AACJ;AAAA;AAAA;AAAA;AAAA,EAMA,qBAAwB,GAAA;AACpB,IAAA,OAAO,KAAK,oBAAqB,CAAA,IAAA;AAAA,MAC7B,CAAC,mBAAwB,KAAA,mBAAA,CAAoB,WAAuB,YAAA;AAAA,KACxE;AAAA;AACJ;AAAA;AAAA;AAAA;AAAA,EAMA,qBAAwB,GAAA;AACpB,IAAA,OAAO,KAAK,oBAAqB,CAAA,IAAA;AAAA,MAC7B,CAAC,mBAAwB,KAAA,mBAAA,CAAoB,WAAuB,YAAA;AAAA,KACxE;AAAA;AAER;;;;"}
|
|
1
|
+
{"version":3,"file":"DragController.js","sources":["DragController.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { reactive, watch } from \"@conterra/reactivity-core\";\nimport { Resource } from \"@open-pioneer/core\";\nimport { MapBrowserEvent } from \"ol\";\nimport OlMap from \"ol/Map\";\nimport { unByKey } from \"ol/Observable\";\nimport Overlay from \"ol/Overlay\";\nimport { mouseActionButton } from \"ol/events/condition\";\nimport Geometry from \"ol/geom/Geometry\";\nimport { DragBox, DragPan } from \"ol/interaction\";\nimport PointerInteraction from \"ol/interaction/Pointer\";\n\ninterface InteractionResource extends Resource {\n interaction: PointerInteraction;\n}\n/** Represents a tooltip rendered on the OpenLayers map. */\ninterface Tooltip extends Resource {\n overlay: Overlay;\n element: HTMLDivElement;\n setText(value: string): void;\n}\n\nconst ACTIVE_CLASS = \"selection-active\";\nconst INACTIVE_CLASS = \"selection-inactive\";\n\nexport class DragController {\n private tooltip: Tooltip;\n private interactionResources: InteractionResource[] = [];\n private olMap: OlMap;\n private isActive = reactive(true);\n private tooltipMessage: string;\n private tooltipDisabledMessage: string;\n private tooltipSync: Resource | undefined;\n\n constructor(\n olMap: OlMap,\n tooltipMessage: string,\n tooltipDisabledMessage: string,\n onExtentSelected: (geometry: Geometry) => void\n ) {\n const viewPort = this.initViewport(olMap);\n this.interactionResources.push(\n this.createDragBox(olMap, onExtentSelected, viewPort, this.interactionResources)\n );\n this.interactionResources.push(this.createDrag(olMap, viewPort, this.interactionResources));\n\n this.tooltip = this.createHelpTooltip(olMap, tooltipMessage);\n this.olMap = olMap;\n this.tooltipMessage = tooltipMessage;\n this.tooltipDisabledMessage = tooltipDisabledMessage;\n\n this.tooltipSync = watch(\n () => [this.isActive.value, this.tooltipText],\n ([isActive, tooltipText]) => {\n this.tooltip.setText(tooltipText);\n viewPort.classList.toggle(ACTIVE_CLASS, isActive);\n viewPort.classList.toggle(INACTIVE_CLASS, !isActive);\n },\n {\n immediate: true\n }\n );\n }\n\n initViewport(olMap: OlMap) {\n const viewPort = olMap.getViewport();\n viewPort.classList.add(ACTIVE_CLASS);\n\n viewPort.oncontextmenu = (e) => {\n e.preventDefault();\n return false;\n };\n return viewPort;\n }\n\n /**\n * Method for destroying the controller when it is no longer needed\n */\n destroy() {\n this.tooltipSync?.destroy();\n this.tooltipSync = undefined;\n\n this.tooltip.destroy();\n this.interactionResources.forEach((interaction) => {\n interaction.destroy();\n });\n }\n\n /**\n * The current tooltip text shown to the user.\n */\n get tooltipText(): string {\n const isActive = this.isActive.value;\n return isActive ? this.tooltipMessage : this.tooltipDisabledMessage;\n }\n\n setActive(isActive: boolean) {\n if (this.isActive.value === isActive) {\n return;\n }\n\n if (isActive) {\n this.interactionResources.forEach((interaction) =>\n this.olMap.addInteraction(interaction.interaction)\n );\n this.isActive.value = true;\n } else {\n this.interactionResources.forEach((interaction) =>\n this.olMap.removeInteraction(interaction.interaction)\n );\n this.isActive.value = false;\n }\n }\n\n /**\n * Method to create a simple extent-selection\n */\n private createDragBox(\n olMap: OlMap,\n onExtentSelected: (geometry: Geometry) => void,\n viewPort: HTMLElement,\n interactionResources: InteractionResource[]\n ): InteractionResource {\n const dragBox = new DragBox({\n className: \"selection-drag-box\",\n condition: mouseActionButton\n });\n\n olMap.addInteraction(dragBox);\n dragBox.on(\"boxend\", function () {\n onExtentSelected(dragBox.getGeometry());\n });\n\n const interactionResource: InteractionResource = {\n interaction: dragBox,\n destroy() {\n olMap.removeInteraction(dragBox);\n interactionResources.splice(interactionResources.indexOf(this));\n dragBox.dispose();\n viewPort.classList.remove(ACTIVE_CLASS);\n viewPort.classList.remove(INACTIVE_CLASS);\n viewPort.oncontextmenu = null;\n }\n };\n return interactionResource;\n }\n\n /**\n * Method to activate pan with right-mouse-click\n */\n private createDrag(\n olMap: OlMap,\n viewPort: HTMLElement,\n interactionResources: InteractionResource[]\n ): InteractionResource {\n const condition = function (mapBrowserEvent: MapBrowserEvent) {\n const originalEvent = mapBrowserEvent.originalEvent;\n return \"button\" in originalEvent && originalEvent.button == 2;\n };\n const drag = new DragPan({\n condition: condition\n });\n\n olMap.addInteraction(drag);\n\n const interactionResource: InteractionResource = {\n interaction: drag,\n destroy() {\n olMap.removeInteraction(drag);\n interactionResources.splice(interactionResources.indexOf(this));\n drag.dispose();\n viewPort.classList.remove(ACTIVE_CLASS);\n viewPort.classList.remove(INACTIVE_CLASS);\n viewPort.oncontextmenu = null;\n }\n };\n\n return interactionResource;\n }\n\n /**\n * Method to generate a tooltip on the mouse cursor\n */\n private createHelpTooltip(olMap: OlMap, message: string): Tooltip {\n const element = document.createElement(\"div\");\n element.className = \"selection-tooltip printing-hide\";\n element.role = \"tooltip\";\n\n const content = document.createElement(\"span\");\n content.textContent = message;\n element.appendChild(content);\n\n const overlay = new Overlay({\n element: element,\n offset: [15, 0],\n positioning: \"center-left\"\n });\n\n const pointHandler = olMap.on(\"pointermove\", (evt) => {\n overlay.setPosition(evt.coordinate);\n });\n\n olMap.addOverlay(overlay);\n return {\n overlay,\n element,\n destroy() {\n olMap.removeOverlay(overlay);\n overlay.dispose();\n unByKey(pointHandler);\n },\n setText(value) {\n content.textContent = value;\n }\n };\n }\n\n /**\n * Method for testing purposes only\n * @returns InteractionResource of class DragBox\n */\n getDragboxInteraction() {\n return this.interactionResources.find(\n (interactionResource) => interactionResource.interaction instanceof DragBox\n );\n }\n\n /**\n * Method for testing purposes only\n * @returns InteractionResource of class DragPan\n */\n getDragPanInteraction() {\n return this.interactionResources.find(\n (interactionResource) => interactionResource.interaction instanceof DragPan\n );\n }\n}\n"],"names":[],"mappings":";;;;;;AAuBA,MAAM,YAAA,GAAe,kBAAA;AACrB,MAAM,cAAA,GAAiB,oBAAA;AAEhB,MAAM,cAAA,CAAe;AAAA,EAChB,OAAA;AAAA,EACA,uBAA8C,EAAC;AAAA,EAC/C,KAAA;AAAA,EACA,QAAA,GAAW,SAAS,IAAI,CAAA;AAAA,EACxB,cAAA;AAAA,EACA,sBAAA;AAAA,EACA,WAAA;AAAA,EAER,WAAA,CACI,KAAA,EACA,cAAA,EACA,sBAAA,EACA,gBAAA,EACF;AACE,IAAA,MAAM,QAAA,GAAW,IAAA,CAAK,YAAA,CAAa,KAAK,CAAA;AACxC,IAAA,IAAA,CAAK,oBAAA,CAAqB,IAAA;AAAA,MACtB,KAAK,aAAA,CAAc,KAAA,EAAO,gBAAA,EAAkB,QAAA,EAAU,KAAK,oBAAoB;AAAA,KACnF;AACA,IAAA,IAAA,CAAK,oBAAA,CAAqB,KAAK,IAAA,CAAK,UAAA,CAAW,OAAO,QAAA,EAAU,IAAA,CAAK,oBAAoB,CAAC,CAAA;AAE1F,IAAA,IAAA,CAAK,OAAA,GAAU,IAAA,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,WAAA,YAAuB;AAAA,KACxE;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,qBAAA,GAAwB;AACpB,IAAA,OAAO,KAAK,oBAAA,CAAqB,IAAA;AAAA,MAC7B,CAAC,mBAAA,KAAwB,mBAAA,CAAoB,WAAA,YAAuB;AAAA,KACxE;AAAA,EACJ;AACJ;;;;"}
|
package/Selection.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { createListCollection, VStack, Select, Portal, Flex, Box, chakra, Icon } from '@chakra-ui/react';
|
|
3
3
|
import { Tooltip } from '@open-pioneer/chakra-snippets/tooltip';
|
|
4
|
-
import {
|
|
4
|
+
import { useMapModelValue } from '@open-pioneer/map';
|
|
5
5
|
import { useCommonComponentProps, useEvent } from '@open-pioneer/react-utils';
|
|
6
6
|
import { useReactiveSnapshot } from '@open-pioneer/reactivity';
|
|
7
7
|
import { useIntl, useService } from './_virtual/_virtual-pioneer-module_react-hooks.js';
|
|
8
8
|
import { useState, useEffect, useRef, useCallback } from 'react';
|
|
9
|
-
import {
|
|
9
|
+
import { LuTriangleAlert } from 'react-icons/lu';
|
|
10
10
|
import { DragController } from './DragController.js';
|
|
11
11
|
import { SelectionController } from './SelectionController.js';
|
|
12
12
|
|
|
@@ -19,9 +19,9 @@ const Selection = (props) => {
|
|
|
19
19
|
onSelectionSourceChanged
|
|
20
20
|
);
|
|
21
21
|
const currentSourceStatus = useSourceStatus(currentSource);
|
|
22
|
-
const
|
|
22
|
+
const map = useMapModelValue(props);
|
|
23
23
|
const { onExtentSelected } = useSelectionController(
|
|
24
|
-
|
|
24
|
+
map,
|
|
25
25
|
sources,
|
|
26
26
|
currentSource,
|
|
27
27
|
onSelectionComplete
|
|
@@ -29,7 +29,7 @@ const Selection = (props) => {
|
|
|
29
29
|
const isActive = currentSourceStatus.kind === "available";
|
|
30
30
|
const hasSelectedSource = !!currentSource;
|
|
31
31
|
const dragController = useDragSelection(
|
|
32
|
-
|
|
32
|
+
map,
|
|
33
33
|
intl,
|
|
34
34
|
onExtentSelected,
|
|
35
35
|
isActive,
|
|
@@ -145,7 +145,7 @@ function SelectionSourceItem(props) {
|
|
|
145
145
|
className: "warning-icon",
|
|
146
146
|
"aria-label": status.reason,
|
|
147
147
|
"aria-hidden": void 0,
|
|
148
|
-
children: /* @__PURE__ */ jsx(
|
|
148
|
+
children: /* @__PURE__ */ jsx(LuTriangleAlert, {})
|
|
149
149
|
}
|
|
150
150
|
) })
|
|
151
151
|
}
|
|
@@ -157,9 +157,6 @@ function useSelectionController(mapModel, sources, currentSource, onSelectionCom
|
|
|
157
157
|
const intl = useIntl();
|
|
158
158
|
const [controller, setController] = useState(void 0);
|
|
159
159
|
useEffect(() => {
|
|
160
|
-
if (!mapModel) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
160
|
const controller2 = new SelectionController({
|
|
164
161
|
mapModel,
|
|
165
162
|
onError() {
|
|
@@ -214,9 +211,6 @@ function useSourceStatus(source) {
|
|
|
214
211
|
function useDragSelection(map, intl, onExtentSelected, isActive, hasSelectedSource) {
|
|
215
212
|
const [controller, setController] = useState();
|
|
216
213
|
useEffect(() => {
|
|
217
|
-
if (!map) {
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
214
|
const disabledMessage = hasSelectedSource ? intl.formatMessage({ id: "disabledTooltip" }) : intl.formatMessage({ id: "noSourceTooltip" });
|
|
221
215
|
const dragController = new DragController(
|
|
222
216
|
map.olMap,
|
package/Selection.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Selection.js","sources":["Selection.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport {\n Box,\n chakra,\n createListCollection,\n Flex,\n Icon,\n Portal,\n Select,\n VStack\n} from \"@chakra-ui/react\";\nimport { Tooltip } from \"@open-pioneer/chakra-snippets/tooltip\";\nimport { MapModel, MapModelProps, useMapModel } from \"@open-pioneer/map\";\nimport { NotificationService } from \"@open-pioneer/notifier\";\nimport { CommonComponentProps, useCommonComponentProps, useEvent } from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport { Geometry } from \"ol/geom\";\nimport { useIntl, useService } from \"open-pioneer:react-hooks\";\nimport { FC, useCallback, useEffect, useRef, useState } from \"react\";\nimport { FiAlertTriangle } from \"react-icons/fi\";\nimport { DragController } from \"./DragController\";\nimport { SelectionController } from \"./SelectionController\";\nimport { SelectionResult, SelectionSource, SelectionSourceStatusObject } from \"./api\";\n\n/**\n * Properties supported by the {@link Selection} component.\n */\nexport interface SelectionProps extends CommonComponentProps, MapModelProps {\n /**\n * Array of selection sources available for spatial selection.\n */\n sources: SelectionSource[];\n\n /**\n * This handler is called whenever the user has successfully selected\n * some items.\n */\n onSelectionComplete?(event: SelectionCompleteEvent): void;\n\n /**\n * This handler is called whenever the user has changed the selected source\n */\n onSelectionSourceChanged?(event: SelectionSourceChangedEvent): void;\n}\n\nexport interface SelectionCompleteEvent {\n /** The source that returned the {@link results}. */\n source: SelectionSource;\n\n /** Results selected by the user. */\n results: SelectionResult[];\n}\n\nexport interface SelectionSourceChangedEvent {\n /** The new selected source */\n source: SelectionSource | undefined;\n}\n\n/**\n * A component that allows the user to perform a spatial selection on a given set of {@link SelectionSource}.\n */\nexport const Selection: FC<SelectionProps> = (props) => {\n const intl = useIntl();\n const { sources, onSelectionComplete, onSelectionSourceChanged } = props;\n const { containerProps } = useCommonComponentProps(\"selection\", props);\n\n const [currentSource, setCurrentSource] = useCurrentSelectionSource(\n sources,\n onSelectionSourceChanged\n );\n\n const currentSourceStatus = useSourceStatus(currentSource);\n\n const mapState = useMapModel(props);\n const { onExtentSelected } = useSelectionController(\n mapState.map,\n sources,\n currentSource,\n onSelectionComplete\n );\n\n const isActive = currentSourceStatus.kind === \"available\";\n const hasSelectedSource = !!currentSource;\n\n const dragController = useDragSelection(\n mapState.map,\n intl,\n onExtentSelected,\n isActive,\n hasSelectedSource\n );\n const dragTooltip = useReactiveSnapshot(() => dragController?.tooltipText, [dragController]);\n\n const getId = useSelectionSourceId();\n\n const sourceOptionsCollection = createListCollection({\n items: sources,\n isItemDisabled: () => {\n return false;\n },\n itemToString: (item) => item.label,\n itemToValue: (item) => getId(item)\n });\n\n let triggerItem;\n if (currentSource) {\n triggerItem = <SelectionSourceItem source={currentSource} />;\n } else {\n triggerItem = null;\n }\n\n return (\n <VStack {...containerProps} gap={2}>\n <Select.Root\n className=\"selection-source\"\n collection={sourceOptionsCollection}\n value={currentSource ? [getId(currentSource)] : undefined}\n onValueChange={(option) => option && setCurrentSource(option.items[0])}\n lazyMount={true}\n unmountOnExit={true}\n >\n <Select.Label>{intl.formatMessage({ id: \"selectSource\" })}</Select.Label>\n\n <Select.Control>\n <Select.Trigger aria-description={dragTooltip}>\n <Select.ValueText\n placeholder={intl.formatMessage({ id: \"selectionPlaceholder\" })}\n >\n {triggerItem}\n </Select.ValueText>\n </Select.Trigger>\n <Select.IndicatorGroup>\n <Select.Indicator />\n </Select.IndicatorGroup>\n </Select.Control>\n\n <Portal>\n <Select.Positioner>\n <Select.Content className=\"selection-source-options\">\n {sourceOptionsCollection.items.map((item) => (\n <SelectionSourceItemContent item={item} key={getId(item)} />\n ))}\n </Select.Content>\n </Select.Positioner>\n </Portal>\n </Select.Root>\n </VStack>\n );\n};\n\ntype GetSelectionSourceId = (selectionSource: SelectionSource) => string;\n\n/**\n * Assigns unique IDs to selection sources.\n */\nfunction useSelectionSourceId(): GetSelectionSourceId {\n const sourceIds = useRef<WeakMap<SelectionSource, string>>(undefined);\n const counter = useRef(0);\n if (!sourceIds.current) {\n sourceIds.current = new WeakMap();\n }\n\n return useCallback((selectionSource: SelectionSource) => {\n const ids = sourceIds.current!;\n if (!ids.has(selectionSource)) {\n ids.set(selectionSource, `source-${counter.current++}`);\n }\n return ids.get(selectionSource)!;\n }, []);\n}\n\nfunction SelectionSourceItemContent(props: { item: SelectionSource }) {\n const { item } = props;\n\n const isDisabled = useSourceStatus(item).kind === \"unavailable\";\n\n return (\n <Select.Item\n className=\"selection-source-option\"\n item={item}\n justifyContent=\"flex-start\"\n // Override pointer-events: none rule for disabled items; we want to show the tooltip on hover\n pointerEvents=\"auto\"\n aria-disabled={isDisabled ? \"true\" : undefined}\n >\n <SelectionSourceItem source={item} />\n </Select.Item>\n );\n}\n\nfunction useCurrentSelectionSource(\n sources: SelectionSource[],\n onSourceChanged: ((event: SelectionSourceChangedEvent) => void) | undefined\n): [SelectionSource | undefined, (source: SelectionSource | undefined) => void] {\n const [currentSource, setCurrentSource] = useState<SelectionSource | undefined>(\n () => sources[0]\n );\n\n // Reset to undefined if the current source is not in the list of sources\n useEffect(() => {\n if (currentSource && !sources.includes(currentSource)) {\n setCurrentSource(undefined);\n }\n }, [sources, currentSource]);\n\n // Track the current source and notify the parent component if it changes\n const prevSelectedSource = useRef<SelectionSource | undefined>(undefined);\n useEffect(() => {\n if (currentSource !== prevSelectedSource.current) {\n prevSelectedSource.current = currentSource;\n onSourceChanged?.({ source: currentSource });\n }\n }, [currentSource, onSourceChanged]);\n return [currentSource, setCurrentSource];\n}\n\n/**\n * Hook to manage source option in selection-source react-select\n */\nfunction SelectionSourceItem(props: { source: SelectionSource | undefined }) {\n const source = props.source;\n const label: string | undefined = source?.label;\n const status = useSourceStatus(source);\n const isAvailable = status.kind === \"available\";\n const clazz = isAvailable\n ? \"selection-source-value\"\n : \"selection-source-value selection-source-value--disabled\";\n\n return (\n <Flex className={clazz} direction=\"row\" alignItems=\"center\" grow={1}>\n {label}\n {status.kind === \"unavailable\" && (\n <Box ml={2}>\n <Tooltip\n content={status.reason}\n positioning={{ placement: \"right\" }}\n openDelay={500}\n >\n <chakra.span>\n <Icon\n color=\"red\"\n className=\"warning-icon\"\n aria-label={status.reason}\n aria-hidden={undefined} // Overwrite icon default so the label gets read\n >\n <FiAlertTriangle />\n </Icon>\n </chakra.span>\n </Tooltip>\n </Box>\n )}\n </Flex>\n );\n}\n\n/**\n * Hook to manage selection controller\n */\nfunction useSelectionController(\n mapModel: MapModel | undefined,\n sources: SelectionSource[],\n currentSource: SelectionSource | undefined,\n onSelectionComplete: ((event: SelectionCompleteEvent) => void) | undefined\n) {\n const notifier = useService<NotificationService>(\"notifier.NotificationService\");\n const intl = useIntl();\n const [controller, setController] = useState<SelectionController | undefined>(undefined);\n useEffect(() => {\n if (!mapModel) {\n return;\n }\n const controller = new SelectionController({\n mapModel,\n onError() {\n notifier.notify({\n level: \"error\",\n message: intl.formatMessage({ id: \"selectionFailed\" })\n });\n }\n });\n setController(controller);\n return () => {\n controller.destroy();\n };\n }, [mapModel, notifier, sources, intl]);\n\n const onExtentSelected = useEvent(async (geometry: Geometry) => {\n if (!controller || !currentSource) {\n return;\n }\n\n const selectionResult = await controller.select(currentSource, geometry.getExtent());\n if (!selectionResult) {\n return;\n }\n\n onSelectionComplete?.(selectionResult);\n });\n return {\n controller,\n onExtentSelected\n };\n}\n\ntype SimpleStatus =\n | {\n kind: \"available\";\n }\n | {\n kind: \"unavailable\";\n reason: string;\n };\n\nfunction getSourceStatus(source: SelectionSource, sourceNotAvailableReason: string): SimpleStatus {\n const rawCurrent = source.status ?? \"available\";\n const current: SelectionSourceStatusObject =\n typeof rawCurrent === \"string\" ? { kind: rawCurrent } : rawCurrent;\n if (current.kind === \"available\") {\n return current;\n }\n\n return {\n kind: \"unavailable\",\n reason: current.reason ?? sourceNotAvailableReason\n };\n}\n\n/**\n * Hook to manage source status\n */\nfunction useSourceStatus(source: SelectionSource | undefined): SimpleStatus {\n const intl = useIntl();\n const defaultNotAvailableMessage = intl.formatMessage({ id: \"sourceNotAvailable\" });\n const sourceStatus = useReactiveSnapshot((): SimpleStatus => {\n if (!source) {\n return { kind: \"unavailable\", reason: defaultNotAvailableMessage };\n }\n return getSourceStatus(source, defaultNotAvailableMessage);\n }, [source, defaultNotAvailableMessage]);\n return sourceStatus;\n}\n\n/**\n * Hook to manage map controls and tooltip\n */\nfunction useDragSelection(\n map: MapModel | undefined,\n intl: PackageIntl,\n onExtentSelected: (geometry: Geometry) => void,\n isActive: boolean,\n hasSelectedSource: boolean\n): DragController | undefined {\n const [controller, setController] = useState<DragController | undefined>();\n useEffect(() => {\n if (!map) {\n return;\n }\n\n const disabledMessage = hasSelectedSource\n ? intl.formatMessage({ id: \"disabledTooltip\" })\n : intl.formatMessage({ id: \"noSourceTooltip\" });\n\n const dragController = new DragController(\n map.olMap,\n intl.formatMessage({ id: \"tooltip\" }),\n disabledMessage,\n onExtentSelected\n );\n\n dragController.setActive(isActive);\n setController(dragController);\n return () => {\n setController(undefined);\n dragController.destroy();\n };\n }, [map, intl, onExtentSelected, isActive, hasSelectedSource]);\n return controller;\n}\n"],"names":["controller"],"mappings":";;;;;;;;;;;;AA+Da,MAAA,SAAA,GAAgC,CAAC,KAAU,KAAA;AACpD,EAAA,MAAM,OAAO,OAAQ,EAAA;AACrB,EAAA,MAAM,EAAE,OAAA,EAAS,mBAAqB,EAAA,wBAAA,EAA6B,GAAA,KAAA;AACnE,EAAA,MAAM,EAAE,cAAA,EAAmB,GAAA,uBAAA,CAAwB,aAAa,KAAK,CAAA;AAErE,EAAM,MAAA,CAAC,aAAe,EAAA,gBAAgB,CAAI,GAAA,yBAAA;AAAA,IACtC,OAAA;AAAA,IACA;AAAA,GACJ;AAEA,EAAM,MAAA,mBAAA,GAAsB,gBAAgB,aAAa,CAAA;AAEzD,EAAM,MAAA,QAAA,GAAW,YAAY,KAAK,CAAA;AAClC,EAAM,MAAA,EAAE,kBAAqB,GAAA,sBAAA;AAAA,IACzB,QAAS,CAAA,GAAA;AAAA,IACT,OAAA;AAAA,IACA,aAAA;AAAA,IACA;AAAA,GACJ;AAEA,EAAM,MAAA,QAAA,GAAW,oBAAoB,IAAS,KAAA,WAAA;AAC9C,EAAM,MAAA,iBAAA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AAK,CAAA,aAAA,CAAc,EAAE,EAAA,EAAI,mBAAmB,CAAA;AAElD,IAAA,MAAM,iBAAiB,IAAI,cAAA;AAAA,MACvB,GAAI,CAAA,KAAA;AAAA,MACJ,IAAK,CAAA,aAAA,CAAc,EAAE,EAAA,EAAI,WAAW,CAAA;AAAA,MACpC,eAAA;AAAA,MACA;AAAA,KACJ;AAEA,IAAA,cAAA,CAAe,UAAU,QAAQ,CAAA;AACjC,IAAA,aAAA,CAAc,cAAc,CAAA;AAC5B,IAAA,OAAO,MAAM;AACT,MAAA,aAAA,CAAc,MAAS,CAAA;AACvB,MAAA,cAAA,CAAe,OAAQ,EAAA;AAAA,KAC3B;AAAA,KACD,CAAC,GAAA,EAAK,MAAM,gBAAkB,EAAA,QAAA,EAAU,iBAAiB,CAAC,CAAA;AAC7D,EAAO,OAAA,UAAA;AACX;;;;"}
|
|
1
|
+
{"version":3,"file":"Selection.js","sources":["Selection.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport {\n Box,\n chakra,\n createListCollection,\n Flex,\n Icon,\n Portal,\n Select,\n VStack\n} from \"@chakra-ui/react\";\nimport { Tooltip } from \"@open-pioneer/chakra-snippets/tooltip\";\nimport { MapModel, MapModelProps, useMapModelValue } from \"@open-pioneer/map\";\nimport { NotificationService } from \"@open-pioneer/notifier\";\nimport { CommonComponentProps, useCommonComponentProps, useEvent } from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport { Geometry } from \"ol/geom\";\nimport { useIntl, useService } from \"open-pioneer:react-hooks\";\nimport { FC, useCallback, useEffect, useRef, useState } from \"react\";\nimport { LuTriangleAlert } from \"react-icons/lu\";\nimport { DragController } from \"./DragController\";\nimport { SelectionController } from \"./SelectionController\";\nimport { SelectionResult, SelectionSource, SelectionSourceStatusObject } from \"./api\";\n\n/**\n * Properties supported by the {@link Selection} component.\n */\nexport interface SelectionProps extends CommonComponentProps, MapModelProps {\n /**\n * Array of selection sources available for spatial selection.\n */\n sources: SelectionSource[];\n\n /**\n * This handler is called whenever the user has successfully selected\n * some items.\n */\n onSelectionComplete?(event: SelectionCompleteEvent): void;\n\n /**\n * This handler is called whenever the user has changed the selected source\n */\n onSelectionSourceChanged?(event: SelectionSourceChangedEvent): void;\n}\n\nexport interface SelectionCompleteEvent {\n /** The source that returned the {@link results}. */\n source: SelectionSource;\n\n /** Results selected by the user. */\n results: SelectionResult[];\n}\n\nexport interface SelectionSourceChangedEvent {\n /** The new selected source */\n source: SelectionSource | undefined;\n}\n\n/**\n * A component that allows the user to perform a spatial selection on a given set of {@link SelectionSource}.\n */\nexport const Selection: FC<SelectionProps> = (props) => {\n const intl = useIntl();\n const { sources, onSelectionComplete, onSelectionSourceChanged } = props;\n const { containerProps } = useCommonComponentProps(\"selection\", props);\n\n const [currentSource, setCurrentSource] = useCurrentSelectionSource(\n sources,\n onSelectionSourceChanged\n );\n\n const currentSourceStatus = useSourceStatus(currentSource);\n\n const map = useMapModelValue(props);\n const { onExtentSelected } = useSelectionController(\n map,\n sources,\n currentSource,\n onSelectionComplete\n );\n\n const isActive = currentSourceStatus.kind === \"available\";\n const hasSelectedSource = !!currentSource;\n\n const dragController = useDragSelection(\n map,\n intl,\n onExtentSelected,\n isActive,\n hasSelectedSource\n );\n const dragTooltip = useReactiveSnapshot(() => dragController?.tooltipText, [dragController]);\n\n const getId = useSelectionSourceId();\n\n const sourceOptionsCollection = createListCollection({\n items: sources,\n isItemDisabled: () => {\n return false;\n },\n itemToString: (item) => item.label,\n itemToValue: (item) => getId(item)\n });\n\n let triggerItem;\n if (currentSource) {\n triggerItem = <SelectionSourceItem source={currentSource} />;\n } else {\n triggerItem = null;\n }\n\n return (\n <VStack {...containerProps} gap={2}>\n <Select.Root\n className=\"selection-source\"\n collection={sourceOptionsCollection}\n value={currentSource ? [getId(currentSource)] : undefined}\n onValueChange={(option) => option && setCurrentSource(option.items[0])}\n lazyMount={true}\n unmountOnExit={true}\n >\n <Select.Label>{intl.formatMessage({ id: \"selectSource\" })}</Select.Label>\n\n <Select.Control>\n <Select.Trigger aria-description={dragTooltip}>\n <Select.ValueText\n placeholder={intl.formatMessage({ id: \"selectionPlaceholder\" })}\n >\n {triggerItem}\n </Select.ValueText>\n </Select.Trigger>\n <Select.IndicatorGroup>\n <Select.Indicator />\n </Select.IndicatorGroup>\n </Select.Control>\n\n <Portal>\n <Select.Positioner>\n <Select.Content className=\"selection-source-options\">\n {sourceOptionsCollection.items.map((item) => (\n <SelectionSourceItemContent item={item} key={getId(item)} />\n ))}\n </Select.Content>\n </Select.Positioner>\n </Portal>\n </Select.Root>\n </VStack>\n );\n};\n\ntype GetSelectionSourceId = (selectionSource: SelectionSource) => string;\n\n/**\n * Assigns unique IDs to selection sources.\n */\nfunction useSelectionSourceId(): GetSelectionSourceId {\n const sourceIds = useRef<WeakMap<SelectionSource, string>>(undefined);\n const counter = useRef(0);\n if (!sourceIds.current) {\n sourceIds.current = new WeakMap();\n }\n\n return useCallback((selectionSource: SelectionSource) => {\n const ids = sourceIds.current!;\n if (!ids.has(selectionSource)) {\n ids.set(selectionSource, `source-${counter.current++}`);\n }\n return ids.get(selectionSource)!;\n }, []);\n}\n\nfunction SelectionSourceItemContent(props: { item: SelectionSource }) {\n const { item } = props;\n\n const isDisabled = useSourceStatus(item).kind === \"unavailable\";\n\n return (\n <Select.Item\n className=\"selection-source-option\"\n item={item}\n justifyContent=\"flex-start\"\n // Override pointer-events: none rule for disabled items; we want to show the tooltip on hover\n pointerEvents=\"auto\"\n aria-disabled={isDisabled ? \"true\" : undefined}\n >\n <SelectionSourceItem source={item} />\n </Select.Item>\n );\n}\n\nfunction useCurrentSelectionSource(\n sources: SelectionSource[],\n onSourceChanged: ((event: SelectionSourceChangedEvent) => void) | undefined\n): [SelectionSource | undefined, (source: SelectionSource | undefined) => void] {\n const [currentSource, setCurrentSource] = useState<SelectionSource | undefined>(\n () => sources[0]\n );\n\n // Reset to undefined if the current source is not in the list of sources\n useEffect(() => {\n if (currentSource && !sources.includes(currentSource)) {\n setCurrentSource(undefined);\n }\n }, [sources, currentSource]);\n\n // Track the current source and notify the parent component if it changes\n const prevSelectedSource = useRef<SelectionSource | undefined>(undefined);\n useEffect(() => {\n if (currentSource !== prevSelectedSource.current) {\n prevSelectedSource.current = currentSource;\n onSourceChanged?.({ source: currentSource });\n }\n }, [currentSource, onSourceChanged]);\n return [currentSource, setCurrentSource];\n}\n\n/**\n * Hook to manage source option in selection-source react-select\n */\nfunction SelectionSourceItem(props: { source: SelectionSource | undefined }) {\n const source = props.source;\n const label: string | undefined = source?.label;\n const status = useSourceStatus(source);\n const isAvailable = status.kind === \"available\";\n const clazz = isAvailable\n ? \"selection-source-value\"\n : \"selection-source-value selection-source-value--disabled\";\n\n return (\n <Flex className={clazz} direction=\"row\" alignItems=\"center\" grow={1}>\n {label}\n {status.kind === \"unavailable\" && (\n <Box ml={2}>\n <Tooltip\n content={status.reason}\n positioning={{ placement: \"right\" }}\n openDelay={500}\n >\n <chakra.span>\n <Icon\n color=\"red\"\n className=\"warning-icon\"\n aria-label={status.reason}\n aria-hidden={undefined} // Overwrite icon default so the label gets read\n >\n <LuTriangleAlert />\n </Icon>\n </chakra.span>\n </Tooltip>\n </Box>\n )}\n </Flex>\n );\n}\n\n/**\n * Hook to manage selection controller\n */\nfunction useSelectionController(\n mapModel: MapModel,\n sources: SelectionSource[],\n currentSource: SelectionSource | undefined,\n onSelectionComplete: ((event: SelectionCompleteEvent) => void) | undefined\n) {\n const notifier = useService<NotificationService>(\"notifier.NotificationService\");\n const intl = useIntl();\n const [controller, setController] = useState<SelectionController | undefined>(undefined);\n useEffect(() => {\n const controller = new SelectionController({\n mapModel,\n onError() {\n notifier.notify({\n level: \"error\",\n message: intl.formatMessage({ id: \"selectionFailed\" })\n });\n }\n });\n setController(controller);\n return () => {\n controller.destroy();\n };\n }, [mapModel, notifier, sources, intl]);\n\n const onExtentSelected = useEvent(async (geometry: Geometry) => {\n if (!controller || !currentSource) {\n return;\n }\n\n const selectionResult = await controller.select(currentSource, geometry.getExtent());\n if (!selectionResult) {\n return;\n }\n\n onSelectionComplete?.(selectionResult);\n });\n return {\n controller,\n onExtentSelected\n };\n}\n\ntype SimpleStatus =\n | {\n kind: \"available\";\n }\n | {\n kind: \"unavailable\";\n reason: string;\n };\n\nfunction getSourceStatus(source: SelectionSource, sourceNotAvailableReason: string): SimpleStatus {\n const rawCurrent = source.status ?? \"available\";\n const current: SelectionSourceStatusObject =\n typeof rawCurrent === \"string\" ? { kind: rawCurrent } : rawCurrent;\n if (current.kind === \"available\") {\n return current;\n }\n\n return {\n kind: \"unavailable\",\n reason: current.reason ?? sourceNotAvailableReason\n };\n}\n\n/**\n * Hook to manage source status\n */\nfunction useSourceStatus(source: SelectionSource | undefined): SimpleStatus {\n const intl = useIntl();\n const defaultNotAvailableMessage = intl.formatMessage({ id: \"sourceNotAvailable\" });\n const sourceStatus = useReactiveSnapshot((): SimpleStatus => {\n if (!source) {\n return { kind: \"unavailable\", reason: defaultNotAvailableMessage };\n }\n return getSourceStatus(source, defaultNotAvailableMessage);\n }, [source, defaultNotAvailableMessage]);\n return sourceStatus;\n}\n\n/**\n * Hook to manage map controls and tooltip\n */\nfunction useDragSelection(\n map: MapModel,\n intl: PackageIntl,\n onExtentSelected: (geometry: Geometry) => void,\n isActive: boolean,\n hasSelectedSource: boolean\n): DragController | undefined {\n const [controller, setController] = useState<DragController | undefined>();\n useEffect(() => {\n const disabledMessage = hasSelectedSource\n ? intl.formatMessage({ id: \"disabledTooltip\" })\n : intl.formatMessage({ id: \"noSourceTooltip\" });\n\n const dragController = new DragController(\n map.olMap,\n intl.formatMessage({ id: \"tooltip\" }),\n disabledMessage,\n onExtentSelected\n );\n\n dragController.setActive(isActive);\n setController(dragController);\n return () => {\n setController(undefined);\n dragController.destroy();\n };\n }, [map, intl, onExt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,OAAO,UAAA;AACX;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionController.js","sources":["SelectionController.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { createLogger } from \"@open-pioneer/core\";\nimport type { SelectionSource, SelectionResult } from \"./api\";\nimport { MapModel } from \"@open-pioneer/map\";\nimport { Extent } from \"ol/extent\";\n\nconst LOG = createLogger(\"selection:SelectionController\");\n\n/**\n * All results returned from one source.\n */\nexport interface SelectionSourceResults {\n source: SelectionSource;\n results: SelectionResult[];\n}\n\nconst DEFAULT_MAX_RESULTS = 10000;\n\nexport class SelectionController {\n #mapModel: MapModel;\n\n /**\n * Limits the number of results.\n */\n readonly #maxResults: number;\n\n /**\n * Called whenever an error happens.\n */\n readonly #onError: () => void;\n\n constructor(options: { mapModel: MapModel; onError: () => void; maxResults?: number }) {\n const { mapModel, onError, maxResults = DEFAULT_MAX_RESULTS } = options;\n this.#mapModel = mapModel;\n this.#maxResults = maxResults;\n this.#onError = onError;\n }\n\n destroy() {}\n\n async select(\n source: SelectionSource,\n extent: Extent\n ): Promise<SelectionSourceResults | undefined> {\n if (!extent) {\n return undefined;\n }\n\n return await this.#selectFromSource(source, extent);\n }\n\n async #selectFromSource(\n source: SelectionSource,\n extent: Extent\n ): Promise<SelectionSourceResults | undefined> {\n const projection = this.#mapModel.olMap.getView().getProjection();\n try {\n LOG.debug(`Starting selection on source '${source.label}'`);\n\n const maxResults = this.#maxResults;\n let results = await source.select(\n { type: \"extent\", extent },\n {\n maxResults,\n mapProjection: projection,\n signal: new AbortController().signal // currently not used\n }\n );\n if (results.length > maxResults) {\n results = results.slice(0, maxResults);\n }\n\n LOG.debug(`Found ${results.length} results on source '${source.label}'`);\n return { source: source, results: results };\n } catch (e) {\n LOG.error(`selection from source ${source.label} failed`, e);\n this.#onError();\n return undefined;\n }\n }\n}\n"],"names":[],"mappings":";;AAOA,MAAM,GAAA,GAAM,aAAa,+BAA+B,CAAA;AAUxD,MAAM,
|
|
1
|
+
{"version":3,"file":"SelectionController.js","sources":["SelectionController.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { createLogger } from \"@open-pioneer/core\";\nimport type { SelectionSource, SelectionResult } from \"./api\";\nimport { MapModel } from \"@open-pioneer/map\";\nimport { Extent } from \"ol/extent\";\n\nconst LOG = createLogger(\"selection:SelectionController\");\n\n/**\n * All results returned from one source.\n */\nexport interface SelectionSourceResults {\n source: SelectionSource;\n results: SelectionResult[];\n}\n\nconst DEFAULT_MAX_RESULTS = 10000;\n\nexport class SelectionController {\n #mapModel: MapModel;\n\n /**\n * Limits the number of results.\n */\n readonly #maxResults: number;\n\n /**\n * Called whenever an error happens.\n */\n readonly #onError: () => void;\n\n constructor(options: { mapModel: MapModel; onError: () => void; maxResults?: number }) {\n const { mapModel, onError, maxResults = DEFAULT_MAX_RESULTS } = options;\n this.#mapModel = mapModel;\n this.#maxResults = maxResults;\n this.#onError = onError;\n }\n\n destroy() {}\n\n async select(\n source: SelectionSource,\n extent: Extent\n ): Promise<SelectionSourceResults | undefined> {\n if (!extent) {\n return undefined;\n }\n\n return await this.#selectFromSource(source, extent);\n }\n\n async #selectFromSource(\n source: SelectionSource,\n extent: Extent\n ): Promise<SelectionSourceResults | undefined> {\n const projection = this.#mapModel.olMap.getView().getProjection();\n try {\n LOG.debug(`Starting selection on source '${source.label}'`);\n\n const maxResults = this.#maxResults;\n let results = await source.select(\n { type: \"extent\", extent },\n {\n maxResults,\n mapProjection: projection,\n signal: new AbortController().signal // currently not used\n }\n );\n if (results.length > maxResults) {\n results = results.slice(0, maxResults);\n }\n\n LOG.debug(`Found ${results.length} results on source '${source.label}'`);\n return { source: source, results: results };\n } catch (e) {\n LOG.error(`selection from source ${source.label} failed`, e);\n this.#onError();\n return undefined;\n }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E;AAAA;AAAA;AAClC,OACJ;AACA,MAAA,IAAI,OAAA,CAAQ,SAAS,UAAA,EAAY;AAC7B,QAAA,OAAA,GAAU,OAAA,CAAQ,KAAA,CAAM,CAAA,EAAG,UAAU,CAAA;AAAA,MACzC;AAEA,MAAA,GAAA,CAAI,MAAM,CAAA,MAAA,EAAS,OAAA,CAAQ,MAAM,CAAA,oBAAA,EAAuB,MAAA,CAAO,KAAK,CAAA,CAAA,CAAG,CAAA;AACvE,MAAA,OAAO,EAAE,QAAgB,OAAA,EAAiB;AAAA,IAC9C,SAAS,CAAA,EAAG;AACR,MAAA,GAAA,CAAI,KAAA,CAAM,CAAA,sBAAA,EAAyB,MAAA,CAAO,KAAK,WAAW,CAAC,CAAA;AAC3D,MAAA,IAAA,CAAK,QAAA,EAAS;AACd,MAAA,OAAO,MAAA;AAAA,IACX;AAAA,EACJ;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorSelectionSource.js","sources":["VectorSelectionSource.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport {\n SelectionResult,\n SelectionOptions,\n SelectionSourceStatus,\n SelectionKind,\n VectorLayerSelectionSource,\n SelectionSourceStatusObject\n} from \"./api\";\nimport VectorLayer from \"ol/layer/Vector\";\nimport { EventsKey } from \"ol/events\";\nimport { unByKey } from \"ol/Observable\";\nimport { v4 as uuid4v } from \"uuid\";\nimport Feature from \"ol/Feature\";\nimport { reactive } from \"@conterra/reactivity-core\";\nimport VectorSource from \"ol/source/Vector\";\n\n/**\n * A SelectionSource to use an OpenLayers VectorLayer with an OpenLayers VectorSource (e.g. layer of the map).\n * Features are:\n * - using only the extent as selection kind\n * - listening to layer visibility changes and updating the status of the source\n * - limiting the number of returned selection results to the corresponding selection option\n * - throwing an event `changed:status` when the status updates\n */\nexport class VectorLayerSelectionSourceImpl implements VectorLayerSelectionSource {\n readonly label: string;\n #status = reactive<SelectionSourceStatusObject>({ kind: \"available\" });\n #vectorLayer: VectorLayer<VectorSource, Feature>;\n #eventHandler: EventsKey;\n #layerNotVisibleReason: string;\n\n constructor(\n vectorLayer: VectorLayer<VectorSource, Feature>,\n label: string,\n layerNotVisibleReason: string\n ) {\n this.label = label;\n this.#vectorLayer = vectorLayer;\n this.#layerNotVisibleReason = layerNotVisibleReason;\n this.#updateStatus();\n this.#eventHandler = this.#vectorLayer.on(\"change:visible\", () => {\n this.#updateStatus();\n });\n }\n\n destroy() {\n unByKey(this.#eventHandler);\n }\n\n get status() {\n return this.#status.value;\n }\n\n async select(\n selectionKind: SelectionKind,\n options: SelectionOptions\n ): Promise<SelectionResult[]> {\n if (selectionKind.type !== \"extent\") {\n throw new Error(`Unsupported selection kind: ${selectionKind.type}`);\n }\n\n if (this.#status.value.kind !== \"available\" || this.#vectorLayer.getSource() === null)\n return [];\n\n const allResults: SelectionResult[] = [];\n this.#vectorLayer\n .getSource()!\n .forEachFeatureIntersectingExtent(selectionKind.extent, (feature) => {\n if (!feature.getGeometry()) return;\n\n // TODO: Think about where to implement Date-Formatting, if the dates are already\n // encoded as Strings...\n\n const filteredProperties = { ...feature.getProperties() };\n delete filteredProperties.geometries;\n\n const result: SelectionResult = {\n id: feature.getId()?.toString() || uuid4v(),\n geometry: feature.getGeometry()!,\n properties: filteredProperties\n };\n\n allResults.push(result);\n });\n const selectedFeatures = allResults.filter((s): s is SelectionResult => s != null);\n const limitedFeatures =\n selectedFeatures.length > options.maxResults\n ? selectedFeatures.slice(0, options.maxResults)\n : selectedFeatures;\n return limitedFeatures;\n }\n\n #updateStatus() {\n const layerIsVisible = this.#vectorLayer.getVisible();\n const newStatus: SelectionSourceStatus = layerIsVisible\n ? { kind: \"available\" }\n : { kind: \"unavailable\", reason: this.#layerNotVisibleReason };\n if (newStatus.kind !== this.#status.value.kind) {\n this.#status.value = newStatus;\n }\n }\n}\n"],"names":["uuid4v"],"mappings":";;;;AA0BO,MAAM,
|
|
1
|
+
{"version":3,"file":"VectorSelectionSource.js","sources":["VectorSelectionSource.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport {\n SelectionResult,\n SelectionOptions,\n SelectionSourceStatus,\n SelectionKind,\n VectorLayerSelectionSource,\n SelectionSourceStatusObject\n} from \"./api\";\nimport VectorLayer from \"ol/layer/Vector\";\nimport { EventsKey } from \"ol/events\";\nimport { unByKey } from \"ol/Observable\";\nimport { v4 as uuid4v } from \"uuid\";\nimport Feature from \"ol/Feature\";\nimport { reactive } from \"@conterra/reactivity-core\";\nimport VectorSource from \"ol/source/Vector\";\n\n/**\n * A SelectionSource to use an OpenLayers VectorLayer with an OpenLayers VectorSource (e.g. layer of the map).\n * Features are:\n * - using only the extent as selection kind\n * - listening to layer visibility changes and updating the status of the source\n * - limiting the number of returned selection results to the corresponding selection option\n * - throwing an event `changed:status` when the status updates\n */\nexport class VectorLayerSelectionSourceImpl implements VectorLayerSelectionSource {\n readonly label: string;\n #status = reactive<SelectionSourceStatusObject>({ kind: \"available\" });\n #vectorLayer: VectorLayer<VectorSource, Feature>;\n #eventHandler: EventsKey;\n #layerNotVisibleReason: string;\n\n constructor(\n vectorLayer: VectorLayer<VectorSource, Feature>,\n label: string,\n layerNotVisibleReason: string\n ) {\n this.label = label;\n this.#vectorLayer = vectorLayer;\n this.#layerNotVisibleReason = layerNotVisibleReason;\n this.#updateStatus();\n this.#eventHandler = this.#vectorLayer.on(\"change:visible\", () => {\n this.#updateStatus();\n });\n }\n\n destroy() {\n unByKey(this.#eventHandler);\n }\n\n get status() {\n return this.#status.value;\n }\n\n async select(\n selectionKind: SelectionKind,\n options: SelectionOptions\n ): Promise<SelectionResult[]> {\n if (selectionKind.type !== \"extent\") {\n throw new Error(`Unsupported selection kind: ${selectionKind.type}`);\n }\n\n if (this.#status.value.kind !== \"available\" || this.#vectorLayer.getSource() === null)\n return [];\n\n const allResults: SelectionResult[] = [];\n this.#vectorLayer\n .getSource()!\n .forEachFeatureIntersectingExtent(selectionKind.extent, (feature) => {\n if (!feature.getGeometry()) return;\n\n // TODO: Think about where to implement Date-Formatting, if the dates are already\n // encoded as Strings...\n\n const filteredProperties = { ...feature.getProperties() };\n delete filteredProperties.geometries;\n\n const result: SelectionResult = {\n id: feature.getId()?.toString() || uuid4v(),\n geometry: feature.getGeometry()!,\n properties: filteredProperties\n };\n\n allResults.push(result);\n });\n const selectedFeatures = allResults.filter((s): s is SelectionResult => s != null);\n const limitedFeatures =\n selectedFeatures.length > options.maxResults\n ? selectedFeatures.slice(0, options.maxResults)\n : selectedFeatures;\n return limitedFeatures;\n }\n\n #updateStatus() {\n const layerIsVisible = this.#vectorLayer.getVisible();\n const newStatus: SelectionSourceStatus = layerIsVisible\n ? { kind: \"available\" }\n : { kind: \"unavailable\", reason: this.#layerNotVisibleReason };\n if (newStatus.kind !== this.#status.value.kind) {\n this.#status.value = newStatus;\n }\n }\n}\n"],"names":["uuid4v"],"mappings":";;;;AA0BO,MAAM,8BAAA,CAAqE;AAAA,EACrE,KAAA;AAAA,EACT,OAAA,GAAU,QAAA,CAAsC,EAAE,IAAA,EAAM,aAAa,CAAA;AAAA,EACrE,YAAA;AAAA,EACA,aAAA;AAAA,EACA,sBAAA;AAAA,EAEA,WAAA,CACI,WAAA,EACA,KAAA,EACA,qBAAA,EACF;AACE,IAAA,IAAA,CAAK,KAAA,GAAQ,KAAA;AACb,IAAA,IAAA,CAAK,YAAA,GAAe,WAAA;AACpB,IAAA,IAAA,CAAK,sBAAA,GAAyB,qBAAA;AAC9B,IAAA,IAAA,CAAK,aAAA,EAAc;AACnB,IAAA,IAAA,CAAK,aAAA,GAAgB,IAAA,CAAK,YAAA,CAAa,EAAA,CAAG,kBAAkB,MAAM;AAC9D,MAAA,IAAA,CAAK,aAAA,EAAc;AAAA,IACvB,CAAC,CAAA;AAAA,EACL;AAAA,EAEA,OAAA,GAA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AAG,OAAA,CAAQ,UAAU,CAAA,GAC5C,gBAAA;AACV,IAAA,OAAO,eAAA;AAAA,EACX;AAAA,EAEA,aAAA,GAAgB;AACZ,IAAA,MAAM,cAAA,GAAiB,IAAA,CAAK,YAAA,CAAa,UAAA,EAAW;AACpD,IAAA,MAAM,SAAA,GAAmC,cAAA,GACnC,EAAE,IAAA,EAAM,WAAA,EAAY,GACpB,EAAE,IAAA,EAAM,aAAA,EAAe,MAAA,EAAQ,IAAA,CAAK,sBAAA,EAAuB;AACjE,IAAA,IAAI,SAAA,CAAU,IAAA,KAAS,IAAA,CAAK,OAAA,CAAQ,MAAM,IAAA,EAAM;AAC5C,MAAA,IAAA,CAAK,QAAQ,KAAA,GAAQ,SAAA;AAAA,IACzB;AAAA,EACJ;AACJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@open-pioneer/selection",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.0-dev.20250905090001",
|
|
5
5
|
"description": "This package provides a UI component to perform a selection on given selection sources from the map.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"open-pioneer-trails"
|
|
@@ -14,20 +14,20 @@
|
|
|
14
14
|
"directory": "src/packages/selection"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@chakra-ui/react": "^3.
|
|
17
|
+
"@chakra-ui/react": "^3.24.2",
|
|
18
18
|
"@open-pioneer/core": "^4.0.0",
|
|
19
19
|
"@open-pioneer/notifier": "^4.0.0",
|
|
20
20
|
"@open-pioneer/react-utils": "^4.0.0",
|
|
21
21
|
"@open-pioneer/runtime": "^4.0.0",
|
|
22
22
|
"classnames": "^2.5.1",
|
|
23
|
-
"ol": "^10.
|
|
24
|
-
"react": "^19.1.
|
|
23
|
+
"ol": "^10.6.1",
|
|
24
|
+
"react": "^19.1.1",
|
|
25
25
|
"react-icons": "^5.5.0",
|
|
26
26
|
"uuid": "^11.1.0",
|
|
27
27
|
"@conterra/reactivity-core": "^0.7.0",
|
|
28
28
|
"@open-pioneer/reactivity": "^4.0.0",
|
|
29
29
|
"@open-pioneer/chakra-snippets": "^4.0.0",
|
|
30
|
-
"@open-pioneer/map": "
|
|
30
|
+
"@open-pioneer/map": "0.12.0-dev.20250905090001"
|
|
31
31
|
},
|
|
32
32
|
"exports": {
|
|
33
33
|
"./package.json": "./package.json",
|
package/services.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.js","sources":["services.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { type PackageIntl, ServiceOptions } from \"@open-pioneer/runtime\";\nimport { VectorLayerSelectionSourceImpl } from \"./VectorSelectionSource\";\nimport {\n VectorLayerSelectionSource,\n VectorLayerSelectionSourceFactory,\n VectorLayerSelectionSourceOptions\n} from \"./api\";\n\nexport class VectorSelectionSourceFactory implements VectorLayerSelectionSourceFactory {\n #intl: PackageIntl;\n\n constructor({ intl }: ServiceOptions<PackageIntl>) {\n this.#intl = intl;\n }\n createSelectionSource(options: VectorLayerSelectionSourceOptions): VectorLayerSelectionSource {\n return new VectorLayerSelectionSourceImpl(\n options.vectorLayer,\n options.label,\n this.#intl.formatMessage({ id: \"layerNotVisibleReason\" })\n );\n }\n}\n"],"names":[],"mappings":";;AAUO,MAAM,
|
|
1
|
+
{"version":3,"file":"services.js","sources":["services.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { type PackageIntl, ServiceOptions } from \"@open-pioneer/runtime\";\nimport { VectorLayerSelectionSourceImpl } from \"./VectorSelectionSource\";\nimport {\n VectorLayerSelectionSource,\n VectorLayerSelectionSourceFactory,\n VectorLayerSelectionSourceOptions\n} from \"./api\";\n\nexport class VectorSelectionSourceFactory implements VectorLayerSelectionSourceFactory {\n #intl: PackageIntl;\n\n constructor({ intl }: ServiceOptions<PackageIntl>) {\n this.#intl = intl;\n }\n createSelectionSource(options: VectorLayerSelectionSourceOptions): VectorLayerSelectionSource {\n return new VectorLayerSelectionSourceImpl(\n options.vectorLayer,\n options.label,\n this.#intl.formatMessage({ id: \"layerNotVisibleReason\" })\n );\n }\n}\n"],"names":[],"mappings":";;AAUO,MAAM,4BAAA,CAA0E;AAAA,EACnF,KAAA;AAAA,EAEA,WAAA,CAAY,EAAE,IAAA,EAAK,EAAgC;AAC/C,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAA;AAAA,EACjB;AAAA,EACA,sBAAsB,OAAA,EAAwE;AAC1F,IAAA,OAAO,IAAI,8BAAA;AAAA,MACP,OAAA,CAAQ,WAAA;AAAA,MACR,OAAA,CAAQ,KAAA;AAAA,MACR,KAAK,KAAA,CAAM,aAAA,CAAc,EAAE,EAAA,EAAI,yBAAyB;AAAA,KAC5D;AAAA,EACJ;AACJ;;;;"}
|