@open-pioneer/selection 0.2.2 → 0.2.4
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 +28 -0
- package/DragController.d.ts +1 -1
- package/DragController.js +19 -22
- package/DragController.js.map +1 -1
- package/Selection.d.ts +0 -9
- package/Selection.js +98 -99
- package/Selection.js.map +1 -1
- package/api.d.ts +2 -2
- package/i18n/de.yaml +2 -0
- package/i18n/en.yaml +2 -0
- package/package.json +13 -13
- package/selectionSources.d.ts +2 -2
- package/selectionSources.js +2 -2
- package/selectionSources.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @open-pioneer/selection
|
|
2
2
|
|
|
3
|
+
## 0.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 291ccb6: Automatically select initial selection-source.
|
|
8
|
+
- b152428: Update trails dependencies
|
|
9
|
+
- da18bda: The `onSelectionSourceChange` event is no longer thrown if user selects the currently selected source again.
|
|
10
|
+
- Updated dependencies [b152428]
|
|
11
|
+
- Updated dependencies [291ccb6]
|
|
12
|
+
- @open-pioneer/map@0.6.1
|
|
13
|
+
|
|
14
|
+
## 0.2.3
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 28e092a: Update dependencies
|
|
19
|
+
- 28e092a: Adapt to OpenLayers type changes.
|
|
20
|
+
|
|
21
|
+
When creating a selection source for a `VectorLayer`, the precise type of that vector layer must now be `VectorLayer<Feature>` (instead of `VectorLayer<VectorSource>`).
|
|
22
|
+
This is a TypeScript-only change that has no effects on the JavaScript code at runtime.
|
|
23
|
+
|
|
24
|
+
- 65a14f4: Open select-menu on enter (fixes issue [#320](https://github.com/open-pioneer/trails-openlayers-base-packages/issues/320))
|
|
25
|
+
- 484ad86: Add tooltip role to tooltip divs (See https://github.com/open-pioneer/trails-openlayers-base-packages/issues/309).
|
|
26
|
+
- Updated dependencies [28e092a]
|
|
27
|
+
- Updated dependencies [0d51d2f]
|
|
28
|
+
- Updated dependencies [76f8863]
|
|
29
|
+
- @open-pioneer/map@0.6.0
|
|
30
|
+
|
|
3
31
|
## 0.2.2
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/DragController.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare class DragController {
|
|
|
12
12
|
private isActive;
|
|
13
13
|
private tooltipMessage;
|
|
14
14
|
private tooltipDisabledMessage;
|
|
15
|
-
constructor(olMap: OlMap,
|
|
15
|
+
constructor(olMap: OlMap, tooltipMessage: string, tooltipDisabledMessage: string, onExtentSelected: (geometry: Geometry) => void);
|
|
16
16
|
initViewport(olMap: OlMap): HTMLElement;
|
|
17
17
|
/**
|
|
18
18
|
* Method for destroying the controller when it is no longer needed
|
package/DragController.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { unByKey } from 'ol/Observable';
|
|
2
|
-
import Overlay from 'ol/Overlay';
|
|
3
|
-
import { mouseActionButton } from 'ol/events/condition';
|
|
4
|
-
import {
|
|
5
|
-
import { DragBox, DragPan } from 'ol/interaction';
|
|
1
|
+
import { unByKey } from 'ol/Observable.js';
|
|
2
|
+
import Overlay from 'ol/Overlay.js';
|
|
3
|
+
import { mouseActionButton } from 'ol/events/condition.js';
|
|
4
|
+
import { DragBox, DragPan } from 'ol/interaction.js';
|
|
6
5
|
|
|
7
6
|
const ACTIVE_CLASS = "selection-active";
|
|
8
7
|
const INACTIVE_CLASS = "selection-inactive";
|
|
@@ -13,20 +12,12 @@ class DragController {
|
|
|
13
12
|
isActive = true;
|
|
14
13
|
tooltipMessage;
|
|
15
14
|
tooltipDisabledMessage;
|
|
16
|
-
constructor(olMap,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
this.interactionResources.push(
|
|
23
|
-
this.createDragBox(olMap, onExtentSelected, viewPort, this.interactionResources)
|
|
24
|
-
);
|
|
25
|
-
this.interactionResources.push(
|
|
26
|
-
this.createDrag(olMap, viewPort, this.interactionResources)
|
|
27
|
-
);
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
15
|
+
constructor(olMap, tooltipMessage, tooltipDisabledMessage, onExtentSelected) {
|
|
16
|
+
const viewPort = this.initViewport(olMap);
|
|
17
|
+
this.interactionResources.push(
|
|
18
|
+
this.createDragBox(olMap, onExtentSelected, viewPort, this.interactionResources)
|
|
19
|
+
);
|
|
20
|
+
this.interactionResources.push(this.createDrag(olMap, viewPort, this.interactionResources));
|
|
30
21
|
this.tooltip = this.createHelpTooltip(olMap, tooltipMessage);
|
|
31
22
|
this.olMap = olMap;
|
|
32
23
|
this.tooltipMessage = tooltipMessage;
|
|
@@ -57,7 +48,7 @@ class DragController {
|
|
|
57
48
|
this.interactionResources.forEach(
|
|
58
49
|
(interaction) => this.olMap.addInteraction(interaction.interaction)
|
|
59
50
|
);
|
|
60
|
-
this.tooltip.
|
|
51
|
+
this.tooltip.setText(this.tooltipMessage);
|
|
61
52
|
viewPort.classList.remove(INACTIVE_CLASS);
|
|
62
53
|
viewPort.classList.add(ACTIVE_CLASS);
|
|
63
54
|
this.isActive = true;
|
|
@@ -65,7 +56,7 @@ class DragController {
|
|
|
65
56
|
this.interactionResources.forEach(
|
|
66
57
|
(interaction) => this.olMap.removeInteraction(interaction.interaction)
|
|
67
58
|
);
|
|
68
|
-
this.tooltip.
|
|
59
|
+
this.tooltip.setText(this.tooltipDisabledMessage);
|
|
69
60
|
viewPort.classList.remove(ACTIVE_CLASS);
|
|
70
61
|
viewPort.classList.add(INACTIVE_CLASS);
|
|
71
62
|
this.isActive = false;
|
|
@@ -130,7 +121,10 @@ class DragController {
|
|
|
130
121
|
createHelpTooltip(olMap, message) {
|
|
131
122
|
const element = document.createElement("div");
|
|
132
123
|
element.className = "selection-tooltip printing-hide";
|
|
133
|
-
element.
|
|
124
|
+
element.role = "tooltip";
|
|
125
|
+
const content = document.createElement("span");
|
|
126
|
+
content.textContent = message;
|
|
127
|
+
element.appendChild(content);
|
|
134
128
|
const overlay = new Overlay({
|
|
135
129
|
element,
|
|
136
130
|
offset: [15, 0],
|
|
@@ -147,6 +141,9 @@ class DragController {
|
|
|
147
141
|
olMap.removeOverlay(overlay);
|
|
148
142
|
overlay.dispose();
|
|
149
143
|
unByKey(pointHandler);
|
|
144
|
+
},
|
|
145
|
+
setText(value) {
|
|
146
|
+
content.textContent = value;
|
|
150
147
|
}
|
|
151
148
|
};
|
|
152
149
|
}
|
package/DragController.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragController.js","sources":["DragController.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Resource } from \"@open-pioneer/core\";\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 { SelectionMethods } from \"./Selection\";\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}\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: boolean = true;\n private tooltipMessage: string;\n private tooltipDisabledMessage: string;\n\n constructor(\n olMap: OlMap,\n selectMethode: string,\n tooltipMessage: string,\n tooltipDisabledMessage: string,\n onExtentSelected: (geometry: Geometry) => void\n ) {\n let viewPort;\n /**\n * Notice for Projectdeveloper\n * Add cases for more Selectionmethods\n */\n switch (selectMethode) {\n case SelectionMethods.extent:\n default:\n viewPort = this.initViewport(olMap);\n this.interactionResources.push(\n this.createDragBox(olMap, onExtentSelected, viewPort, this.interactionResources)\n );\n this.interactionResources.push(\n this.createDrag(olMap, viewPort, this.interactionResources)\n );\n break;\n }\n\n this.tooltip = this.createHelpTooltip(olMap, tooltipMessage);\n this.olMap = olMap;\n this.tooltipMessage = tooltipMessage;\n this.tooltipDisabledMessage = tooltipDisabledMessage;\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.tooltip.destroy();\n this.interactionResources.forEach((interaction) => {\n interaction.destroy();\n });\n }\n\n setActive(isActive: boolean) {\n if (this.isActive === isActive) return;\n const viewPort = this.olMap.getViewport();\n if (isActive) {\n this.interactionResources.forEach((interaction) =>\n this.olMap.addInteraction(interaction.interaction)\n );\n this.tooltip.element.textContent = this.tooltipMessage;\n viewPort.classList.remove(INACTIVE_CLASS);\n viewPort.classList.add(ACTIVE_CLASS);\n this.isActive = true;\n } else {\n this.interactionResources.forEach((interaction) =>\n this.olMap.removeInteraction(interaction.interaction)\n );\n this.tooltip.element.textContent = this.tooltipDisabledMessage;\n viewPort.classList.remove(ACTIVE_CLASS);\n viewPort.classList.add(INACTIVE_CLASS);\n this.isActive = 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: {\n originalEvent: MouseEvent;\n dragging: unknown;\n }) {\n const originalEvent = /** @type {MouseEvent} */ mapBrowserEvent.originalEvent;\n return 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) {\n const element = document.createElement(\"div\");\n element.className = \"selection-tooltip printing-hide\";\n element.textContent = message;\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 };\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}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,MACd,WAAa,EAAA,aAAA;AAAA,KAChB,CAAA,CAAA;AAED,IAAA,MAAM,YAAe,GAAA,KAAA,CAAM,EAAG,CAAA,aAAA,EAAe,CAAC,GAAQ,KAAA;AAClD,MAAQ,OAAA,CAAA,WAAA,CAAY,IAAI,UAAU,CAAA,CAAA;AAAA,KACrC,CAAA,CAAA;AAED,IAAA,KAAA,CAAM,WAAW,OAAO,CAAA,CAAA;AACxB,IAAO,OAAA;AAAA,MACH,OAAA;AAAA,MACA,OAAA;AAAA,MACA,OAAU,GAAA;AACN,QAAA,KAAA,CAAM,cAAc,OAAO,CAAA,CAAA;AAC3B,QAAA,OAAA,CAAQ,OAAQ,EAAA,CAAA;AAChB,QAAA,OAAA,CAAQ,YAAY,CAAA,CAAA;AAAA,OACxB;AAAA,KACJ,CAAA;AAAA,GACJ;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,qBAAwB,GAAA;AACpB,IAAA,OAAO,KAAK,oBAAqB,CAAA,IAAA;AAAA,MAC7B,CAAC,mBAAwB,KAAA,mBAAA,CAAoB,WAAuB,YAAA,OAAA;AAAA,KACxE,CAAA;AAAA,GACJ;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,qBAAwB,GAAA;AACpB,IAAA,OAAO,KAAK,oBAAqB,CAAA,IAAA;AAAA,MAC7B,CAAC,mBAAwB,KAAA,mBAAA,CAAoB,WAAuB,YAAA,OAAA;AAAA,KACxE,CAAA;AAAA,GACJ;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"DragController.js","sources":["DragController.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Resource } from \"@open-pioneer/core\";\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: boolean = true;\n private tooltipMessage: string;\n private tooltipDisabledMessage: string;\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\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.tooltip.destroy();\n this.interactionResources.forEach((interaction) => {\n interaction.destroy();\n });\n }\n\n setActive(isActive: boolean) {\n if (this.isActive === isActive) return;\n const viewPort = this.olMap.getViewport();\n if (isActive) {\n this.interactionResources.forEach((interaction) =>\n this.olMap.addInteraction(interaction.interaction)\n );\n this.tooltip.setText(this.tooltipMessage);\n viewPort.classList.remove(INACTIVE_CLASS);\n viewPort.classList.add(ACTIVE_CLASS);\n this.isActive = true;\n } else {\n this.interactionResources.forEach((interaction) =>\n this.olMap.removeInteraction(interaction.interaction)\n );\n this.tooltip.setText(this.tooltipDisabledMessage);\n viewPort.classList.remove(ACTIVE_CLASS);\n viewPort.classList.add(INACTIVE_CLASS);\n this.isActive = 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: {\n originalEvent: MouseEvent;\n dragging: unknown;\n }) {\n const originalEvent = /** @type {MouseEvent} */ mapBrowserEvent.originalEvent;\n return 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":";;;;;AAqBA,MAAM,YAAe,GAAA,kBAAA,CAAA;AACrB,MAAM,cAAiB,GAAA,oBAAA,CAAA;AAEhB,MAAM,cAAe,CAAA;AAAA,EAChB,OAAA,CAAA;AAAA,EACA,uBAA8C,EAAC,CAAA;AAAA,EAC/C,KAAA,CAAA;AAAA,EACA,QAAoB,GAAA,IAAA,CAAA;AAAA,EACpB,cAAA,CAAA;AAAA,EACA,sBAAA,CAAA;AAAA,EAER,WACI,CAAA,KAAA,EACA,cACA,EAAA,sBAAA,EACA,gBACF,EAAA;AACE,IAAM,MAAA,QAAA,GAAW,IAAK,CAAA,YAAA,CAAa,KAAK,CAAA,CAAA;AACxC,IAAA,IAAA,CAAK,oBAAqB,CAAA,IAAA;AAAA,MACtB,KAAK,aAAc,CAAA,KAAA,EAAO,gBAAkB,EAAA,QAAA,EAAU,KAAK,oBAAoB,CAAA;AAAA,KACnF,CAAA;AACA,IAAK,IAAA,CAAA,oBAAA,CAAqB,KAAK,IAAK,CAAA,UAAA,CAAW,OAAO,QAAU,EAAA,IAAA,CAAK,oBAAoB,CAAC,CAAA,CAAA;AAE1F,IAAA,IAAA,CAAK,OAAU,GAAA,IAAA,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,mBAAA,CAAoB,WAAuB,YAAA,OAAA;AAAA,KACxE,CAAA;AAAA,GACJ;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,qBAAwB,GAAA;AACpB,IAAA,OAAO,KAAK,oBAAqB,CAAA,IAAA;AAAA,MAC7B,CAAC,mBAAwB,KAAA,mBAAA,CAAoB,WAAuB,YAAA,OAAA;AAAA,KACxE,CAAA;AAAA,GACJ;AACJ;;;;"}
|
package/Selection.d.ts
CHANGED
|
@@ -33,15 +33,6 @@ export interface SelectionSourceChangedEvent {
|
|
|
33
33
|
/** The new selected source */
|
|
34
34
|
source: SelectionSource | undefined;
|
|
35
35
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Supported selection methods
|
|
38
|
-
*/
|
|
39
|
-
export declare enum SelectionMethods {
|
|
40
|
-
extent = "EXTENT",
|
|
41
|
-
polygon = "POLYGON",
|
|
42
|
-
free = "FREEPOLYGON",
|
|
43
|
-
circle = "CIRCLE"
|
|
44
|
-
}
|
|
45
36
|
/**
|
|
46
37
|
* A component that allows the user to perform a spatial selection on a given set of {@link SelectionSource}.
|
|
47
38
|
*/
|
package/Selection.js
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { VStack, FormControl, FormLabel, Flex, Box, Tooltip, chakra, Icon, useToken } from '@open-pioneer/chakra-integration';
|
|
3
3
|
import { useMapModel } from '@open-pioneer/map';
|
|
4
4
|
import { useCommonComponentProps, useEvent } from '@open-pioneer/react-utils';
|
|
5
5
|
import { Select, chakraComponents } from 'chakra-react-select';
|
|
6
6
|
import { useIntl, useService } from './_virtual/_virtual-pioneer-module_react-hooks.js';
|
|
7
|
-
import { useState,
|
|
7
|
+
import { useState, useMemo, useEffect, useRef } from 'react';
|
|
8
8
|
import { FiAlertTriangle } from 'react-icons/fi';
|
|
9
9
|
import { DragController } from './DragController.js';
|
|
10
10
|
import { SelectionController } from './SelectionController.js';
|
|
11
11
|
|
|
12
|
-
var SelectionMethods = /* @__PURE__ */ ((SelectionMethods2) => {
|
|
13
|
-
SelectionMethods2["extent"] = "EXTENT";
|
|
14
|
-
SelectionMethods2["polygon"] = "POLYGON";
|
|
15
|
-
SelectionMethods2["free"] = "FREEPOLYGON";
|
|
16
|
-
SelectionMethods2["circle"] = "CIRCLE";
|
|
17
|
-
return SelectionMethods2;
|
|
18
|
-
})(SelectionMethods || {});
|
|
19
12
|
const COMMON_SELECT_PROPS = {
|
|
20
13
|
classNamePrefix: "react-select",
|
|
21
14
|
menuPosition: "fixed",
|
|
@@ -26,9 +19,12 @@ const Selection = (props) => {
|
|
|
26
19
|
const intl = useIntl();
|
|
27
20
|
const { mapId, sources, onSelectionComplete, onSelectionSourceChanged } = props;
|
|
28
21
|
const { containerProps } = useCommonComponentProps("selection", props);
|
|
29
|
-
const
|
|
30
|
-
|
|
22
|
+
const defaultNotAvailableMessage = intl.formatMessage({ id: "sourceNotAvailable" });
|
|
23
|
+
const [currentSource, setCurrentSource] = useCurrentSelectionSource(
|
|
24
|
+
sources,
|
|
25
|
+
onSelectionSourceChanged
|
|
31
26
|
);
|
|
27
|
+
const currentSourceStatus = useSourceStatus(currentSource, defaultNotAvailableMessage);
|
|
32
28
|
const mapState = useMapModel(mapId);
|
|
33
29
|
const { onExtentSelected } = useSelectionController(
|
|
34
30
|
mapState.map,
|
|
@@ -37,92 +33,74 @@ const Selection = (props) => {
|
|
|
37
33
|
onSelectionComplete
|
|
38
34
|
);
|
|
39
35
|
const chakraStyles = useChakraStyles();
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
});
|
|
48
|
-
if (objects.length === 0) throw new Error("methods does not contain valid values");
|
|
49
|
-
return objects;
|
|
50
|
-
},
|
|
51
|
-
[intl]
|
|
36
|
+
const [isOpenSelect, setIsOpenSelect] = useState(false);
|
|
37
|
+
useDragSelection(
|
|
38
|
+
mapState.map,
|
|
39
|
+
intl,
|
|
40
|
+
onExtentSelected,
|
|
41
|
+
currentSourceStatus.kind === "available",
|
|
42
|
+
!!currentSource
|
|
52
43
|
);
|
|
53
|
-
const methodOptions = buildMethodOptions(void 0);
|
|
54
|
-
const [selectedMethod, setSelectedMethod] = useState(methodOptions[0]);
|
|
55
|
-
const onMethodeOptionChance = useEvent((newValue) => {
|
|
56
|
-
setSelectedMethod(newValue);
|
|
57
|
-
});
|
|
58
|
-
const [dragControllerActive, setDragControllerActive] = useState(true);
|
|
59
|
-
useDragSelection(mapState.map, selectedMethod, intl, onExtentSelected, dragControllerActive);
|
|
60
44
|
const sourceOptions = useMemo(
|
|
61
45
|
() => sources.map((source) => {
|
|
62
46
|
return { label: source.label, value: source };
|
|
63
47
|
}),
|
|
64
48
|
[sources]
|
|
65
49
|
);
|
|
66
|
-
const currentSourceOption = useMemo(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
50
|
+
const currentSourceOption = useMemo(() => {
|
|
51
|
+
const foundOption = sourceOptions.find(
|
|
52
|
+
(option) => option.value === currentSource
|
|
53
|
+
);
|
|
54
|
+
return foundOption || null;
|
|
55
|
+
}, [sourceOptions, currentSource]);
|
|
70
56
|
const onSourceOptionChanged = useEvent((newValue) => {
|
|
71
57
|
setCurrentSource(newValue?.value);
|
|
72
|
-
onSelectionSourceChanged && onSelectionSourceChanged({ source: newValue?.value });
|
|
73
58
|
});
|
|
74
|
-
|
|
75
|
-
if (!
|
|
76
|
-
|
|
77
|
-
return;
|
|
59
|
+
const keyDown = useEvent((event) => {
|
|
60
|
+
if (!isOpenSelect && event.key === "Enter") {
|
|
61
|
+
setIsOpenSelect(true);
|
|
78
62
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
{
|
|
109
|
-
className: "selection-source react-select",
|
|
110
|
-
...COMMON_SELECT_PROPS,
|
|
111
|
-
options: sourceOptions,
|
|
112
|
-
placeholder: intl.formatMessage({ id: "selectionPlaceholder" }),
|
|
113
|
-
value: currentSourceOption,
|
|
114
|
-
onChange: onSourceOptionChanged,
|
|
115
|
-
components: {
|
|
116
|
-
Option: SourceSelectOption,
|
|
117
|
-
SingleValue: SourceSelectValue
|
|
63
|
+
});
|
|
64
|
+
return /* @__PURE__ */ jsx(VStack, { ...containerProps, spacing: 2, children: /* @__PURE__ */ jsxs(FormControl, { children: [
|
|
65
|
+
/* @__PURE__ */ jsx(FormLabel, { children: intl.formatMessage({ id: "selectSource" }) }),
|
|
66
|
+
/* @__PURE__ */ jsx(
|
|
67
|
+
Select,
|
|
68
|
+
{
|
|
69
|
+
className: "selection-source react-select",
|
|
70
|
+
...COMMON_SELECT_PROPS,
|
|
71
|
+
options: sourceOptions,
|
|
72
|
+
placeholder: intl.formatMessage({ id: "selectionPlaceholder" }),
|
|
73
|
+
value: currentSourceOption,
|
|
74
|
+
onChange: onSourceOptionChanged,
|
|
75
|
+
components: {
|
|
76
|
+
Option: SourceSelectOption,
|
|
77
|
+
SingleValue: SourceSelectValue
|
|
78
|
+
},
|
|
79
|
+
isOptionDisabled: () => false,
|
|
80
|
+
getOptionLabel: (option) => {
|
|
81
|
+
const label = option.label;
|
|
82
|
+
const status = getSourceStatus(option.value, defaultNotAvailableMessage);
|
|
83
|
+
if (status.kind == "available") return label;
|
|
84
|
+
return label + " " + status.reason;
|
|
85
|
+
},
|
|
86
|
+
ariaLiveMessages: {
|
|
87
|
+
guidance: () => "",
|
|
88
|
+
onChange: (props2) => {
|
|
89
|
+
if (props2.action == "select-option" || props2.action == "initial-input-focus")
|
|
90
|
+
return props2.label + " " + intl.formatMessage({ id: "selected" });
|
|
91
|
+
else return "";
|
|
118
92
|
},
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
93
|
+
onFilter: () => "",
|
|
94
|
+
onFocus: () => ""
|
|
95
|
+
},
|
|
96
|
+
chakraStyles,
|
|
97
|
+
onKeyDown: keyDown,
|
|
98
|
+
menuIsOpen: isOpenSelect,
|
|
99
|
+
onMenuOpen: () => setIsOpenSelect(true),
|
|
100
|
+
onMenuClose: () => setIsOpenSelect(false)
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
] }) });
|
|
126
104
|
};
|
|
127
105
|
function SourceSelectOption(props) {
|
|
128
106
|
const { value } = props.data;
|
|
@@ -143,9 +121,29 @@ function SourceSelectValue(props) {
|
|
|
143
121
|
const clazz = isAvailable ? "selection-source-value" : "selection-source-value selection-source-value--disabled";
|
|
144
122
|
return /* @__PURE__ */ jsx(chakraComponents.SingleValue, { ...props, isDisabled: !isAvailable, className: clazz, children: content });
|
|
145
123
|
}
|
|
124
|
+
function useCurrentSelectionSource(sources, onSourceChanged) {
|
|
125
|
+
const [currentSource, setCurrentSource] = useState(
|
|
126
|
+
() => sources[0]
|
|
127
|
+
);
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
if (currentSource && !sources.includes(currentSource)) {
|
|
130
|
+
setCurrentSource(void 0);
|
|
131
|
+
}
|
|
132
|
+
}, [sources, currentSource]);
|
|
133
|
+
const prevSelectedSource = useRef(void 0);
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
if (currentSource !== prevSelectedSource.current) {
|
|
136
|
+
prevSelectedSource.current = currentSource;
|
|
137
|
+
onSourceChanged?.({ source: currentSource });
|
|
138
|
+
}
|
|
139
|
+
}, [currentSource, onSourceChanged]);
|
|
140
|
+
return [currentSource, setCurrentSource];
|
|
141
|
+
}
|
|
146
142
|
function useSourceItem(source, isSelected) {
|
|
143
|
+
const intl = useIntl();
|
|
147
144
|
const label = source?.label;
|
|
148
|
-
const
|
|
145
|
+
const defaultNotAvailableMessage = intl.formatMessage({ id: "sourceNotAvailable" });
|
|
146
|
+
const status = useSourceStatus(source, defaultNotAvailableMessage);
|
|
149
147
|
return {
|
|
150
148
|
isAvailable: status.kind === "available",
|
|
151
149
|
content: /* @__PURE__ */ jsxs(Flex, { direction: "row", alignItems: "center", grow: 1, children: [
|
|
@@ -211,40 +209,41 @@ function getSourceStatus(source, sourceNotAvailableReason) {
|
|
|
211
209
|
reason: current.reason ?? sourceNotAvailableReason
|
|
212
210
|
};
|
|
213
211
|
}
|
|
214
|
-
function useSourceStatus(source) {
|
|
215
|
-
const
|
|
216
|
-
|
|
212
|
+
function useSourceStatus(source, defaultNotAvailableMessage) {
|
|
213
|
+
const [status, setStatus] = useState(() => ({
|
|
214
|
+
kind: "unavailable",
|
|
215
|
+
reason: defaultNotAvailableMessage
|
|
216
|
+
}));
|
|
217
217
|
useEffect(() => {
|
|
218
218
|
if (!source) {
|
|
219
|
-
setStatus({ kind: "
|
|
219
|
+
setStatus({ kind: "unavailable", reason: defaultNotAvailableMessage });
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
|
-
|
|
223
|
-
setStatus(getSourceStatus(source, sourceNotAvailableReason));
|
|
222
|
+
setStatus(getSourceStatus(source, defaultNotAvailableMessage));
|
|
224
223
|
const resource = source.on?.("changed:status", () => {
|
|
225
|
-
setStatus(getSourceStatus(source,
|
|
224
|
+
setStatus(getSourceStatus(source, defaultNotAvailableMessage));
|
|
226
225
|
});
|
|
227
226
|
return () => resource?.destroy();
|
|
228
|
-
}, [source,
|
|
227
|
+
}, [source, defaultNotAvailableMessage]);
|
|
229
228
|
return status;
|
|
230
229
|
}
|
|
231
|
-
function useDragSelection(map,
|
|
230
|
+
function useDragSelection(map, intl, onExtentSelected, isActive, hasSelectedSource) {
|
|
232
231
|
useEffect(() => {
|
|
233
232
|
if (!map) {
|
|
234
233
|
return;
|
|
235
234
|
}
|
|
235
|
+
const disabledMessage = hasSelectedSource ? intl.formatMessage({ id: "disabledTooltip" }) : intl.formatMessage({ id: "noSourceTooltip" });
|
|
236
236
|
const dragController = new DragController(
|
|
237
237
|
map.olMap,
|
|
238
|
-
selectMethode.value,
|
|
239
238
|
intl.formatMessage({ id: "tooltip" }),
|
|
240
|
-
|
|
239
|
+
disabledMessage,
|
|
241
240
|
onExtentSelected
|
|
242
241
|
);
|
|
243
242
|
dragController.setActive(isActive);
|
|
244
243
|
return () => {
|
|
245
244
|
dragController?.destroy();
|
|
246
245
|
};
|
|
247
|
-
}, [map,
|
|
246
|
+
}, [map, intl, onExtentSelected, isActive, hasSelectedSource]);
|
|
248
247
|
}
|
|
249
248
|
function useChakraStyles() {
|
|
250
249
|
const [dropDownBackground, borderColor] = useToken(
|
|
@@ -268,5 +267,5 @@ function useChakraStyles() {
|
|
|
268
267
|
}, [dropDownBackground, borderColor]);
|
|
269
268
|
}
|
|
270
269
|
|
|
271
|
-
export { Selection
|
|
270
|
+
export { Selection };
|
|
272
271
|
//# sourceMappingURL=Selection.js.map
|
package/Selection.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Selection.js","sources":["Selection.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport {\n Box,\n Flex,\n FormControl,\n FormLabel,\n Icon,\n Tooltip,\n VStack,\n chakra,\n useToken\n} from \"@open-pioneer/chakra-integration\";\nimport { MapModel, useMapModel } from \"@open-pioneer/map\";\nimport { NotificationService } from \"@open-pioneer/notifier\";\nimport { CommonComponentProps, useCommonComponentProps, useEvent } from \"@open-pioneer/react-utils\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport {\n OptionProps,\n Select,\n Props as SelectProps,\n SingleValueProps,\n chakraComponents,\n type SingleValue,\n ChakraStylesConfig,\n GroupBase\n} from \"chakra-react-select\";\nimport { Geometry } from \"ol/geom\";\nimport { useIntl, useService } from \"open-pioneer:react-hooks\";\nimport { FC, useCallback, useEffect, useMemo, 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 {\n /**\n * The id of the map.\n */\n mapId: string;\n\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 * Properties for single select options.\n */\ninterface SelectionOption {\n /**\n * The label of the selection source option.\n */\n label: string;\n\n /**\n * The value (SelectionSource) of the selection source option.\n */\n value: SelectionSource | undefined;\n}\n\n/**\n * Properties for single selection method options.\n */\ninterface MethodOption {\n /**\n * The label of the select method option.\n */\n label: string;\n\n /**\n * The value of the select method option.\n */\n value: string;\n}\n\n/**\n * Supported selection methods\n */\nexport enum SelectionMethods {\n extent = \"EXTENT\",\n polygon = \"POLYGON\",\n free = \"FREEPOLYGON\",\n circle = \"CIRCLE\"\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst COMMON_SELECT_PROPS: SelectProps<any, any, any> = {\n classNamePrefix: \"react-select\",\n menuPosition: \"fixed\",\n isSearchable: false,\n isClearable: false\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 { mapId, sources, onSelectionComplete, onSelectionSourceChanged } = props;\n const { containerProps } = useCommonComponentProps(\"selection\", props);\n const [currentSource, setCurrentSource] = useState<SelectionSource | undefined>(() =>\n sources.find((s) => (s.status ?? \"available\") === \"available\")\n );\n const mapState = useMapModel(mapId);\n const { onExtentSelected } = useSelectionController(\n mapState.map,\n sources,\n currentSource,\n onSelectionComplete\n );\n const chakraStyles = useChakraStyles();\n\n /**\n * Method to build Option-Array from the supported selection methods for the selection-method react-select\n * If there is no configuration => Default selection method: EXTENT\n */\n const buildMethodOptions = useCallback(\n (methods: string[] | undefined) => {\n const objects: MethodOption[] = [];\n if (!methods) methods = [SelectionMethods.extent];\n methods.forEach((item) => {\n if (Object.values(SelectionMethods as unknown as string[]).includes(item))\n objects.push({ label: intl.formatMessage({ id: item }), value: item });\n });\n if (objects.length === 0) throw new Error(\"methods does not contain valid values\");\n return objects;\n },\n [intl]\n );\n\n const methodOptions: MethodOption[] = buildMethodOptions(undefined);\n const [selectedMethod, setSelectedMethod] = useState(methodOptions[0] as MethodOption);\n\n /**\n * Method to change used selectmethod\n */\n const onMethodeOptionChance = useEvent((newValue: MethodOption) => {\n setSelectedMethod(newValue);\n });\n\n const [dragControllerActive, setDragControllerActive] = useState<boolean>(true);\n useDragSelection(mapState.map, selectedMethod, intl, onExtentSelected, dragControllerActive);\n\n /**\n * Method to build Option-Array from sources for the selection-source react-select\n */\n const sourceOptions = useMemo(\n () =>\n sources.map<SelectionOption>((source) => {\n return { label: source.label, value: source };\n }),\n [sources]\n );\n const currentSourceOption = useMemo(\n () => sourceOptions.find((option) => option.value === currentSource),\n [sourceOptions, currentSource]\n );\n\n /**\n * Method to change used source\n */\n const onSourceOptionChanged = useEvent((newValue: SingleValue<SelectionOption>) => {\n setCurrentSource(newValue?.value);\n onSelectionSourceChanged && onSelectionSourceChanged({ source: newValue?.value });\n });\n\n useEffect(() => {\n if (!currentSource) {\n setDragControllerActive(false);\n return;\n }\n\n const sourceNotAvailableReason = intl.formatMessage({ id: \"sourceNotAvailable\" });\n const isCurrentSourceAvailable = () => {\n return (\n currentSource &&\n getSourceStatus(currentSource, sourceNotAvailableReason).kind === \"available\"\n );\n };\n\n setDragControllerActive(isCurrentSourceAvailable());\n // Why can this be undefined after test above?!\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const handle = currentSource.on(\"changed:status\", () => {\n setDragControllerActive(isCurrentSourceAvailable());\n });\n return () => handle.destroy();\n }, [currentSource, setDragControllerActive, intl]);\n\n return (\n <VStack {...containerProps} spacing={2}>\n {methodOptions.length > 1 && (\n <FormControl>\n <FormLabel>{intl.formatMessage({ id: \"selectMethod\" })}</FormLabel>\n <Select\n className=\"selection-method react-select\"\n {...COMMON_SELECT_PROPS}\n options={methodOptions}\n onChange={onMethodeOptionChance}\n value={selectedMethod}\n chakraStyles={chakraStyles}\n />\n </FormControl>\n )}\n <FormControl>\n <FormLabel>{intl.formatMessage({ id: \"selectSource\" })}</FormLabel>\n <Select<SelectionOption>\n className=\"selection-source react-select\"\n {...COMMON_SELECT_PROPS}\n options={sourceOptions}\n placeholder={intl.formatMessage({ id: \"selectionPlaceholder\" })}\n value={currentSourceOption}\n onChange={onSourceOptionChanged}\n components={{\n Option: SourceSelectOption,\n SingleValue: SourceSelectValue\n }}\n isOptionDisabled={(option) =>\n option.value === undefined || option.value.status === \"unavailable\"\n }\n // optionLabel is used by screenreaders\n getOptionLabel={(option) =>\n option.label +\n (option.value === undefined || option.value.status === \"unavailable\"\n ? \" \" + intl.formatMessage({ id: \"sourceNotAvailable\" })\n : \"\")\n }\n chakraStyles={chakraStyles}\n />\n </FormControl>\n </VStack>\n );\n};\n\nfunction SourceSelectOption(props: OptionProps<SelectionOption>): JSX.Element {\n const { value } = props.data;\n const { isAvailable, content } = useSourceItem(value, false);\n\n return (\n <chakraComponents.Option\n {...props}\n isDisabled={!isAvailable}\n className=\"selection-source-option\"\n >\n {content}\n </chakraComponents.Option>\n );\n}\n\nfunction SourceSelectValue(props: SingleValueProps<SelectionOption>): JSX.Element {\n const { value } = props.data;\n const { isAvailable, content } = useSourceItem(value, true);\n const clazz = isAvailable\n ? \"selection-source-value\"\n : \"selection-source-value selection-source-value--disabled\";\n\n return (\n <chakraComponents.SingleValue {...props} isDisabled={!isAvailable} className={clazz}>\n {content}\n </chakraComponents.SingleValue>\n );\n}\n\n/**\n * Hook to manage source option in selection-source react-select\n */\nfunction useSourceItem(source: SelectionSource | undefined, isSelected: boolean) {\n const label: string | undefined = source?.label;\n const status = useSourceStatus(source);\n\n return {\n isAvailable: status.kind === \"available\",\n content: (\n <Flex direction=\"row\" alignItems=\"center\" grow={1}>\n {!isSelected && <Flex grow={1}>{label}</Flex>}\n {status.kind === \"unavailable\" && (\n <Box ml={2}>\n <Tooltip label={status.reason} placement=\"right\" openDelay={500}>\n <chakra.span>\n <Icon\n as={FiAlertTriangle}\n color=\"red\"\n className=\"warning-icon\"\n aria-label={status.reason}\n />\n </chakra.span>\n </Tooltip>\n </Box>\n )}\n {isSelected && label}\n </Flex>\n )\n };\n}\n\n/**\n * Hook to manage selection sources\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 [status, setStatus] = useState<SimpleStatus>(() => ({ kind: \"available\" }));\n useEffect(() => {\n if (!source) {\n setStatus({ kind: \"available\" });\n return;\n }\n const sourceNotAvailableReason = intl.formatMessage({ id: \"sourceNotAvailable\" });\n setStatus(getSourceStatus(source, sourceNotAvailableReason));\n const resource = source.on?.(\"changed:status\", () => {\n setStatus(getSourceStatus(source, sourceNotAvailableReason));\n });\n return () => resource?.destroy();\n }, [source, intl]);\n return status;\n}\n\n/**\n * Hook to manage map controls and tooltip\n */\nfunction useDragSelection(\n map: MapModel | undefined,\n selectMethode: MethodOption,\n intl: PackageIntl,\n onExtentSelected: (geometry: Geometry) => void,\n isActive: boolean\n) {\n useEffect(() => {\n if (!map) {\n return;\n }\n\n const dragController = new DragController(\n map.olMap,\n selectMethode.value,\n intl.formatMessage({ id: \"tooltip\" }),\n intl.formatMessage({ id: \"disabledTooltip\" }),\n onExtentSelected\n );\n dragController.setActive(isActive);\n\n return () => {\n dragController?.destroy();\n };\n }, [map, selectMethode, intl, onExtentSelected, isActive]);\n}\n\n/**\n * Customizes components styles within the select component.\n */\nfunction useChakraStyles() {\n const [dropDownBackground, borderColor] = useToken(\n \"colors\",\n [\"background_body\", \"border\"],\n [\"#ffffff\", \"#ffffff\"]\n );\n return useMemo(() => {\n const chakraStyles: ChakraStylesConfig<\n SelectionOption,\n false,\n GroupBase<SelectionOption>\n > = {\n control: (styles) => ({ ...styles, cursor: \"pointer\" }),\n indicatorSeparator: (styles) => ({\n ...styles,\n borderColor: borderColor\n }),\n dropdownIndicator: (provided) => ({\n ...provided,\n backgroundColor: dropDownBackground\n })\n };\n return chakraStyles;\n }, [dropDownBackground, borderColor]);\n}\n"],"names":["SelectionMethods","controller"],"mappings":";;;;;;;;;;;AA2GY,IAAA,gBAAA,qBAAAA,iBAAL,KAAA;AACH,EAAAA,kBAAA,QAAS,CAAA,GAAA,QAAA,CAAA;AACT,EAAAA,kBAAA,SAAU,CAAA,GAAA,SAAA,CAAA;AACV,EAAAA,kBAAA,MAAO,CAAA,GAAA,aAAA,CAAA;AACP,EAAAA,kBAAA,QAAS,CAAA,GAAA,QAAA,CAAA;AAJD,EAAAA,OAAAA,iBAAAA,CAAAA;AAAA,CAAA,EAAA,gBAAA,IAAA,EAAA,EAAA;AAQZ,MAAM,mBAAkD,GAAA;AAAA,EACpD,eAAiB,EAAA,cAAA;AAAA,EACjB,YAAc,EAAA,OAAA;AAAA,EACd,YAAc,EAAA,KAAA;AAAA,EACd,WAAa,EAAA,KAAA;AACjB,CAAA,CAAA;AAKa,MAAA,SAAA,GAAgC,CAAC,KAAU,KAAA;AACpD,EAAA,MAAM,OAAO,OAAQ,EAAA,CAAA;AACrB,EAAA,MAAM,EAAE,KAAA,EAAO,OAAS,EAAA,mBAAA,EAAqB,0BAA6B,GAAA,KAAA,CAAA;AAC1E,EAAA,MAAM,EAAE,cAAA,EAAmB,GAAA,uBAAA,CAAwB,aAAa,KAAK,CAAA,CAAA;AACrE,EAAM,MAAA,CAAC,aAAe,EAAA,gBAAgB,CAAI,GAAA,QAAA;AAAA,IAAsC,MAC5E,QAAQ,IAAK,CAAA,CAAC,OAAO,CAAE,CAAA,MAAA,IAAU,iBAAiB,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AA,MACA,iBAAA,EAAmB,CAAC,QAAc,MAAA;AAAA,QAC9B,GAAG,QAAA;AAAA,QACH,eAAiB,EAAA,kBAAA;AAAA,OACrB,CAAA;AAAA,KACJ,CAAA;AACA,IAAO,OAAA,YAAA,CAAA;AAAA,GACR,EAAA,CAAC,kBAAoB,EAAA,WAAW,CAAC,CAAA,CAAA;AACxC;;;;"}
|
|
1
|
+
{"version":3,"file":"Selection.js","sources":["Selection.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport {\n Box,\n Flex,\n FormControl,\n FormLabel,\n Icon,\n Tooltip,\n VStack,\n chakra,\n useToken\n} from \"@open-pioneer/chakra-integration\";\nimport { MapModel, useMapModel } from \"@open-pioneer/map\";\nimport { NotificationService } from \"@open-pioneer/notifier\";\nimport { CommonComponentProps, useCommonComponentProps, useEvent } from \"@open-pioneer/react-utils\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport {\n ChakraStylesConfig,\n GroupBase,\n OptionProps,\n Select,\n Props as SelectProps,\n SingleValueProps,\n chakraComponents,\n type SingleValue\n} from \"chakra-react-select\";\nimport { Geometry } from \"ol/geom\";\nimport { useIntl, useService } from \"open-pioneer:react-hooks\";\nimport { FC, KeyboardEvent, useEffect, useMemo, 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 {\n /**\n * The id of the map.\n */\n mapId: string;\n\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 * Properties for single select options.\n */\ninterface SelectionOption {\n /**\n * The label of the selection source option.\n */\n label: string;\n\n /**\n * The value (SelectionSource) of the selection source option.\n */\n value: SelectionSource;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst COMMON_SELECT_PROPS: SelectProps<any, any, any> = {\n classNamePrefix: \"react-select\",\n menuPosition: \"fixed\",\n isSearchable: false,\n isClearable: false\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 { mapId, sources, onSelectionComplete, onSelectionSourceChanged } = props;\n const { containerProps } = useCommonComponentProps(\"selection\", props);\n const defaultNotAvailableMessage = intl.formatMessage({ id: \"sourceNotAvailable\" });\n\n const [currentSource, setCurrentSource] = useCurrentSelectionSource(\n sources,\n onSelectionSourceChanged\n );\n\n const currentSourceStatus = useSourceStatus(currentSource, defaultNotAvailableMessage);\n\n const mapState = useMapModel(mapId);\n const { onExtentSelected } = useSelectionController(\n mapState.map,\n sources,\n currentSource,\n onSelectionComplete\n );\n const chakraStyles = useChakraStyles();\n const [isOpenSelect, setIsOpenSelect] = useState(false);\n\n useDragSelection(\n mapState.map,\n intl,\n onExtentSelected,\n currentSourceStatus.kind === \"available\",\n !!currentSource\n );\n\n const sourceOptions = useMemo(\n () =>\n sources.map<SelectionOption>((source) => {\n return { label: source.label, value: source };\n }),\n [sources]\n );\n const currentSourceOption = useMemo(() => {\n const foundOption: SelectionOption | undefined = sourceOptions.find(\n (option) => option.value === currentSource\n );\n return foundOption || null;\n }, [sourceOptions, currentSource]);\n\n const onSourceOptionChanged = useEvent((newValue: SingleValue<SelectionOption>) => {\n setCurrentSource(newValue?.value);\n });\n\n const keyDown = useEvent((event: KeyboardEvent<HTMLDivElement>) => {\n //if the menu is already open, do noting\n if (!isOpenSelect && event.key === \"Enter\") {\n setIsOpenSelect(true);\n }\n });\n\n return (\n <VStack {...containerProps} spacing={2}>\n <FormControl>\n <FormLabel>{intl.formatMessage({ id: \"selectSource\" })}</FormLabel>\n <Select<SelectionOption>\n className=\"selection-source react-select\"\n {...COMMON_SELECT_PROPS}\n options={sourceOptions}\n placeholder={intl.formatMessage({ id: \"selectionPlaceholder\" })}\n value={currentSourceOption}\n onChange={onSourceOptionChanged}\n components={{\n Option: SourceSelectOption,\n SingleValue: SourceSelectValue\n }}\n isOptionDisabled={() => false} // allow to select disabled options; optical disabling is done in option\n // optionLabel is used by screenreaders\n getOptionLabel={(option) => {\n const label = option.label;\n const status = getSourceStatus(option.value, defaultNotAvailableMessage);\n if (status.kind == \"available\") return label;\n return label + \" \" + status.reason;\n }}\n ariaLiveMessages={{\n guidance: () => \"\",\n onChange: (props) => {\n if (\n props.action == \"select-option\" ||\n props.action == \"initial-input-focus\"\n )\n return props.label + \" \" + intl.formatMessage({ id: \"selected\" });\n else return \"\";\n },\n onFilter: () => \"\",\n onFocus: () => \"\"\n }}\n chakraStyles={chakraStyles}\n onKeyDown={keyDown}\n menuIsOpen={isOpenSelect}\n onMenuOpen={() => setIsOpenSelect(true)}\n onMenuClose={() => setIsOpenSelect(false)}\n />\n </FormControl>\n </VStack>\n );\n};\n\nfunction SourceSelectOption(props: OptionProps<SelectionOption>): JSX.Element {\n const { value } = props.data;\n const { isAvailable, content } = useSourceItem(value, false);\n\n return (\n <chakraComponents.Option\n {...props}\n isDisabled={!isAvailable}\n className=\"selection-source-option\"\n >\n {content}\n </chakraComponents.Option>\n );\n}\n\nfunction SourceSelectValue(props: SingleValueProps<SelectionOption>): JSX.Element {\n const { value } = props.data;\n const { isAvailable, content } = useSourceItem(value, true);\n const clazz = isAvailable\n ? \"selection-source-value\"\n : \"selection-source-value selection-source-value--disabled\";\n\n return (\n <chakraComponents.SingleValue {...props} isDisabled={!isAvailable} className={clazz}>\n {content}\n </chakraComponents.SingleValue>\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 useSourceItem(source: SelectionSource | undefined, isSelected: boolean) {\n const intl = useIntl();\n const label: string | undefined = source?.label;\n const defaultNotAvailableMessage = intl.formatMessage({ id: \"sourceNotAvailable\" });\n const status = useSourceStatus(source, defaultNotAvailableMessage);\n\n return {\n isAvailable: status.kind === \"available\",\n content: (\n <Flex direction=\"row\" alignItems=\"center\" grow={1}>\n {!isSelected && <Flex grow={1}>{label}</Flex>}\n {status.kind === \"unavailable\" && (\n <Box ml={2}>\n <Tooltip label={status.reason} placement=\"right\" openDelay={500}>\n <chakra.span>\n <Icon\n as={FiAlertTriangle}\n color=\"red\"\n className=\"warning-icon\"\n aria-label={status.reason}\n />\n </chakra.span>\n </Tooltip>\n </Box>\n )}\n {isSelected && label}\n </Flex>\n )\n };\n}\n\n/**\n * Hook to manage selection sources\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(\n source: SelectionSource | undefined,\n defaultNotAvailableMessage: string\n): SimpleStatus {\n const [status, setStatus] = useState<SimpleStatus>(() => ({\n kind: \"unavailable\",\n reason: defaultNotAvailableMessage\n }));\n useEffect(() => {\n if (!source) {\n setStatus({ kind: \"unavailable\", reason: defaultNotAvailableMessage });\n return;\n }\n setStatus(getSourceStatus(source, defaultNotAvailableMessage));\n const resource = source.on?.(\"changed:status\", () => {\n setStatus(getSourceStatus(source, defaultNotAvailableMessage));\n });\n return () => resource?.destroy();\n }, [source, defaultNotAvailableMessage]);\n return status;\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) {\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 return () => {\n dragController?.destroy();\n };\n }, [map, intl, onExtentSelected, isActive, hasSelectedSource]);\n}\n\n/**\n * Customizes components styles within the select component.\n */\nfunction useChakraStyles() {\n const [dropDownBackground, borderColor] = useToken(\n \"colors\",\n [\"background_body\", \"border\"],\n [\"#ffffff\", \"#ffffff\"]\n );\n return useMemo(() => {\n const chakraStyles: ChakraStylesConfig<\n SelectionOption,\n false,\n GroupBase<SelectionOption>\n > = {\n control: (styles) => ({ ...styles, cursor: \"pointer\" }),\n indicatorSeparator: (styles) => ({\n ...styles,\n borderColor: borderColor\n }),\n dropdownIndicator: (provided) => ({\n ...provided,\n backgroundColor: dropDownBackground\n })\n };\n return chakraStyles;\n }, [dropDownBackground, borderColor]);\n}\n"],"names":["props","controller"],"mappings":";;;;;;;;;;;AA0FA,MAAM,mBAAkD,GAAA;AAAA,EACpD,eAAiB,EAAA,cAAA;AAAA,EACjB,YAAc,EAAA,OAAA;AAAA,EACd,YAAc,EAAA,KAAA;AAAA,EACd,WAAa,EAAA,KAAA;AACjB,CAAA,CAAA;AAKa,MAAA,SAAA,GAAgC,CAAC,KAAU,KAAA;AACpD,EAAA,MAAM,OAAO,OAAQ,EAAA,CAAA;AACrB,EAAA,MAAM,EAAE,KAAA,EAAO,OAAS,EAAA,mBAAA,EAAqB,0BAA6B,GAAA,KAAA,CAAA;AAC1E,EAAA,MAAM,EAAE,cAAA,EAAmB,GAAA,uBAAA,CAAwB,aAAa,KAAK,CAAA,CAAA;AACrE,EAAA,MAAM,6BAA6B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EAAA,kBAAA;AAAA,OACrB,CAAA;AAAA,KACJ,CAAA;AACA,IAAO,OAAA,YAAA,CAAA;AAAA,GACR,EAAA,CAAC,kBAAoB,EAAA,WAAW,CAAC,CAAA,CAAA;AACxC;;;;"}
|
package/api.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { EventSource, Resource } from "@open-pioneer/core";
|
|
|
5
5
|
import { BaseFeature } from "@open-pioneer/map";
|
|
6
6
|
import { DeclaredService } from "@open-pioneer/runtime";
|
|
7
7
|
import VectorLayer from "ol/layer/Vector";
|
|
8
|
-
import
|
|
8
|
+
import Feature from "ol/Feature";
|
|
9
9
|
/**
|
|
10
10
|
* The status of a selection source.
|
|
11
11
|
*
|
|
@@ -115,7 +115,7 @@ export interface SelectionSource extends Partial<SelectionSourceEventBase> {
|
|
|
115
115
|
select(selectionKind: SelectionKind, options: SelectionOptions): Promise<SelectionResult[]>;
|
|
116
116
|
}
|
|
117
117
|
export interface VectorLayerSelectionSourceOptions {
|
|
118
|
-
vectorLayer: VectorLayer<
|
|
118
|
+
vectorLayer: VectorLayer<Feature>;
|
|
119
119
|
label: string;
|
|
120
120
|
}
|
|
121
121
|
export interface VectorLayerSelectionSource extends Required<SelectionSource>, Resource {
|
package/i18n/de.yaml
CHANGED
|
@@ -7,7 +7,9 @@ messages:
|
|
|
7
7
|
selectSource: "Quelle auswählen"
|
|
8
8
|
tooltip: "Klicken Sie in die Karte, halten Sie die Maustaste gedrückt und ziehen Sie ein Rechteck auf"
|
|
9
9
|
disabledTooltip: "Die aktuelle Selektionsquelle ist nicht verfügbar."
|
|
10
|
+
noSourceTooltip: "Es ist keine Selektionsquelle ausgewählt. Zum Starten bitte Selektionsquelle auswählen."
|
|
10
11
|
sourceNotAvailable: "Quelle nicht verfügbar"
|
|
11
12
|
selectionFailed: "Die räumliche Auswahl ist fehlgeschlagen"
|
|
12
13
|
selectionPlaceholder: "Keine Quelle ausgewählt"
|
|
13
14
|
layerNotVisibleReason: "Zugehöriger Layer ist nicht sichtbar."
|
|
15
|
+
selected: "selektiert"
|
package/i18n/en.yaml
CHANGED
|
@@ -7,7 +7,9 @@ messages:
|
|
|
7
7
|
selectSource: "Select source"
|
|
8
8
|
tooltip: "Click on the map, hold down the mouse button and draw a rectangle"
|
|
9
9
|
disabledTooltip: "The current selection source is not available"
|
|
10
|
+
noSourceTooltip: "No selection source selected. Please choose a selection source to start."
|
|
10
11
|
sourceNotAvailable: "Source not available"
|
|
11
12
|
selectionFailed: "Spatial selection failed"
|
|
12
13
|
selectionPlaceholder: "No source selected"
|
|
13
14
|
layerNotVisibleReason: "Matching layer is not visible."
|
|
15
|
+
selected: "selected"
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@open-pioneer/selection",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.4",
|
|
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,21 +14,21 @@
|
|
|
14
14
|
"directory": "src/packages/selection"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
17
|
+
"classnames": "^2.3.2",
|
|
18
|
+
"uuid": "^10.0.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@open-pioneer/chakra-integration": "^1.1.3",
|
|
22
|
-
"@open-pioneer/runtime": "^2.1.5",
|
|
23
|
-
"@open-pioneer/core": "^1.2.3",
|
|
24
|
-
"@open-pioneer/notifier": "^0.3.4",
|
|
25
|
-
"ol": "^9.0.0",
|
|
26
|
-
"react": "^18.3.1",
|
|
27
|
-
"chakra-react-select": "^4.7.6",
|
|
28
21
|
"@chakra-ui/icons": "^2.1.1",
|
|
29
|
-
"
|
|
30
|
-
"@open-pioneer/
|
|
31
|
-
"@open-pioneer/
|
|
22
|
+
"@open-pioneer/chakra-integration": "^1.1.4",
|
|
23
|
+
"@open-pioneer/core": "^1.3.0",
|
|
24
|
+
"@open-pioneer/notifier": "^0.3.6",
|
|
25
|
+
"@open-pioneer/react-utils": "^1.0.1",
|
|
26
|
+
"@open-pioneer/runtime": "^2.1.7",
|
|
27
|
+
"chakra-react-select": "^4.7.6",
|
|
28
|
+
"ol": "^9.2.4",
|
|
29
|
+
"react": "^18.3.1",
|
|
30
|
+
"react-icons": "^5.2.1",
|
|
31
|
+
"@open-pioneer/map": "^0.6.1"
|
|
32
32
|
},
|
|
33
33
|
"exports": {
|
|
34
34
|
"./package.json": "./package.json",
|
package/selectionSources.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SelectionSource, SelectionResult, SelectionOptions, SelectionSourceStatus, SelectionSourceEvents, SelectionKind, VectorLayerSelectionSource } from "./api";
|
|
2
2
|
import { Point } from "ol/geom";
|
|
3
3
|
import { EventEmitter } from "@open-pioneer/core";
|
|
4
|
-
import VectorSource from "ol/source/Vector";
|
|
5
4
|
import VectorLayer from "ol/layer/Vector";
|
|
5
|
+
import Feature from "ol/Feature";
|
|
6
6
|
export declare const fakeSelectedPointFeatures: Point[];
|
|
7
7
|
export declare class FakePointSelectionSource extends EventEmitter<SelectionSourceEvents> implements SelectionSource {
|
|
8
8
|
#private;
|
|
@@ -23,7 +23,7 @@ export declare class FakePointSelectionSource extends EventEmitter<SelectionSour
|
|
|
23
23
|
export declare class VectorLayerSelectionSourceImpl extends EventEmitter<SelectionSourceEvents> implements VectorLayerSelectionSource {
|
|
24
24
|
#private;
|
|
25
25
|
readonly label: string;
|
|
26
|
-
constructor(vectorLayer: VectorLayer<
|
|
26
|
+
constructor(vectorLayer: VectorLayer<Feature>, label: string, layerNotVisibleReason: string);
|
|
27
27
|
destroy(): void;
|
|
28
28
|
get status(): import("./api").SelectionSourceStatusObject;
|
|
29
29
|
select(selectionKind: SelectionKind, options: SelectionOptions): Promise<SelectionResult[]>;
|
package/selectionSources.js
CHANGED
package/selectionSources.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectionSources.js","sources":["selectionSources.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport {\n SelectionSource,\n SelectionResult,\n SelectionOptions,\n SelectionSourceStatus,\n SelectionSourceEvents,\n SelectionKind,\n VectorLayerSelectionSource\n} from \"./api\";\nimport { Point } from \"ol/geom\";\nimport { EventEmitter } from \"@open-pioneer/core\";\nimport
|
|
1
|
+
{"version":3,"file":"selectionSources.js","sources":["selectionSources.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport {\n SelectionSource,\n SelectionResult,\n SelectionOptions,\n SelectionSourceStatus,\n SelectionSourceEvents,\n SelectionKind,\n VectorLayerSelectionSource\n} from \"./api\";\nimport { Point } from \"ol/geom\";\nimport { EventEmitter } from \"@open-pioneer/core\";\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\";\n\nexport const fakeSelectedPointFeatures = [\n new Point([407354, 5754673]), // con terra (Bottom Right)\n new Point([404740, 5757893]) // Schloss (Top Left)\n];\n\nlet count = 0;\n\nexport class FakePointSelectionSource\n extends EventEmitter<SelectionSourceEvents>\n implements SelectionSource\n{\n readonly label = `Fake Selection Source #${++count}`;\n #timeout: number;\n #status: SelectionSourceStatus;\n #pointFeatures: Point[];\n\n constructor(\n timeout?: number,\n status?: SelectionSourceStatus,\n pointFeatures: Point[] = fakeSelectedPointFeatures\n ) {\n super();\n this.#timeout = timeout || 0;\n this.#status = status || \"unavailable\";\n this.#pointFeatures = pointFeatures;\n }\n\n get status(): SelectionSourceStatus {\n return this.#status;\n }\n\n set status(value: SelectionSourceStatus) {\n if (value !== this.#status) {\n this.#status = value;\n this.emit(\"changed:status\");\n }\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 !== \"available\") return [];\n\n await new Promise((resolve) => setTimeout(resolve, this.#timeout));\n\n const allPoints = this.#pointFeatures.map((point, index) => {\n const result: SelectionResult = {\n id: index,\n geometry: point\n };\n if (!point.intersectsExtent(selectionKind.extent)) {\n return undefined;\n }\n return result;\n });\n\n const selectedPoints = allPoints.filter((s): s is SelectionResult => s != null);\n const limitedResults =\n selectedPoints.length > options.maxResults\n ? selectedPoints.slice(0, options.maxResults)\n : selectedPoints;\n return limitedResults;\n }\n}\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\n extends EventEmitter<SelectionSourceEvents>\n implements VectorLayerSelectionSource\n{\n readonly label: string;\n #status: Exclude<SelectionSourceStatus, string> = { kind: \"available\" };\n #vectorLayer: VectorLayer<Feature>;\n #eventHandler: EventsKey;\n #layerNotVisibleReason: string;\n\n constructor(vectorLayer: VectorLayer<Feature>, label: string, layerNotVisibleReason: string) {\n super();\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;\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.kind !== \"available\" || this.#vectorLayer.getSource() === null) 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.kind) {\n this.#status = newStatus;\n this.emit(\"changed:status\");\n }\n }\n}\n\n/**\n * For testing purposes only\n */\nexport class NoStatusSelectionSource\n extends EventEmitter<SelectionSourceEvents>\n implements SelectionSource\n{\n readonly label: string = \"Testlabel\";\n\n async select(_: SelectionKind, __: SelectionOptions): Promise<SelectionResult[]> {\n const allPoints = fakeSelectedPointFeatures.map((point, index) => {\n const result: SelectionResult = {\n id: index,\n geometry: point\n };\n return result;\n });\n return allPoints;\n }\n}\n"],"names":["uuid4v"],"mappings":";;;;;AAmByC;AAAA,EACrC,IAAI,KAAA,CAAM,CAAC,MAAA,EAAQ,OAAO,CAAC,CAAA;AAAA;AAAA,EAC3B,IAAI,KAAA,CAAM,CAAC,MAAA,EAAQ,OAAO,CAAC,CAAA;AAAA;AAC/B,EAAA;AA2EO,MAAM,uCACD,YAEZ,CAAA;AAAA,EACa,KAAA,CAAA;AAAA,EACT,O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