@open-pioneer/selection 0.9.0-dev.20250220091855 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,20 +1,29 @@
1
1
  # @open-pioneer/selection
2
2
 
3
- ## 0.9.0-dev.20250220091855
3
+ ## 0.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - cb94c75: update dependencies
4
8
 
5
9
  ### Patch Changes
6
10
 
7
- - Updated dependencies [f327eec]
8
- - Updated dependencies [f327eec]
9
- - Updated dependencies [209eb8e]
10
- - @open-pioneer/map@0.9.0-dev.20250220091855
11
+ - Updated dependencies [e7fdc5d]
12
+ - Updated dependencies [cb94c75]
13
+ - Updated dependencies [37cd707]
14
+ - Updated dependencies [32ed2cd]
15
+ - Updated dependencies [f327eec]
16
+ - Updated dependencies [f327eec]
17
+ - Updated dependencies [209eb8e]
18
+ - Updated dependencies [d72e42c]
19
+ - @open-pioneer/map@0.9.0
11
20
 
12
21
  ## 0.8.0
13
22
 
14
23
  ### Minor Changes
15
24
 
16
- - e7978a8: Support reactive changes on the `SelectionSource`'s `status` property using the reactivity API.
17
- **Remove** support for the `changed:status"` event on the selection source: use signals instead.
25
+ - e7978a8: Support reactive changes on the `SelectionSource`'s `status` property using the reactivity API.
26
+ **Remove** support for the `changed:status"` event on the selection source: use signals instead.
18
27
 
19
28
  For example, to implement a `SelectionSource` with changing availability:
20
29
 
@@ -36,160 +45,160 @@
36
45
  }
37
46
  ```
38
47
 
39
- - b717121: Update from OL 9 to OL 10.
40
- - b717121: Adjust the type the property `vectorLayer` of the exported interface `VectorLayerSelectionSourceOptions`.
41
- The type is now `VectorLayer<VectorSource, Feature>` instead of `VectorLayer<Feature>`.
42
- - 2fa8020: Update trails core package dependencies.
48
+ - b717121: Update from OL 9 to OL 10.
49
+ - b717121: Adjust the type the property `vectorLayer` of the exported interface `VectorLayerSelectionSourceOptions`.
50
+ The type is now `VectorLayer<VectorSource, Feature>` instead of `VectorLayer<Feature>`.
51
+ - 2fa8020: Update trails core package dependencies.
43
52
 
44
- - Also updates Chakra UI to the latest 2.x version and Chakra React Select to version 5.
45
- - Removes any obsolete references to `@chakra-ui/system`.
46
- This dependency seems to be no longer required and may lead to duplicate packages in your dependency tree.
53
+ - Also updates Chakra UI to the latest 2.x version and Chakra React Select to version 5.
54
+ - Removes any obsolete references to `@chakra-ui/system`.
55
+ This dependency seems to be no longer required and may lead to duplicate packages in your dependency tree.
47
56
 
48
57
  ### Patch Changes
49
58
 
50
- - 49f0207: Update trails core packages to version 2.4.0
51
- - Updated dependencies [b717121]
52
- - Updated dependencies [e7978a8]
53
- - Updated dependencies [7a5f1e1]
54
- - Updated dependencies [7ae9f90]
55
- - Updated dependencies [d8337a6]
56
- - Updated dependencies [49f0207]
57
- - Updated dependencies [b2127df]
58
- - Updated dependencies [2fa8020]
59
- - Updated dependencies [7ae9f90]
60
- - Updated dependencies [d8337a6]
61
- - @open-pioneer/map@0.8.0
59
+ - 49f0207: Update trails core packages to version 2.4.0
60
+ - Updated dependencies [b717121]
61
+ - Updated dependencies [e7978a8]
62
+ - Updated dependencies [7a5f1e1]
63
+ - Updated dependencies [7ae9f90]
64
+ - Updated dependencies [d8337a6]
65
+ - Updated dependencies [49f0207]
66
+ - Updated dependencies [b2127df]
67
+ - Updated dependencies [2fa8020]
68
+ - Updated dependencies [7ae9f90]
69
+ - Updated dependencies [d8337a6]
70
+ - @open-pioneer/map@0.8.0
62
71
 
63
72
  ## 0.7.0
64
73
 
65
74
  ### Minor Changes
66
75
 
67
- - 310800c: Switch from `peerDependencies` to normal `dependencies`. Peer dependencies have some usability problems when used at scale.
76
+ - 310800c: Switch from `peerDependencies` to normal `dependencies`. Peer dependencies have some usability problems when used at scale.
68
77
 
69
78
  ### Patch Changes
70
79
 
71
- - 310800c: Update core packages version.
72
- - 583f1d6: The `mapId` or `map` properties are now optional on individual components.
73
- You can use the `DefaultMapProvider` to configure an implicit default value.
80
+ - 310800c: Update core packages version.
81
+ - 583f1d6: The `mapId` or `map` properties are now optional on individual components.
82
+ You can use the `DefaultMapProvider` to configure an implicit default value.
74
83
 
75
84
  Note that configuring _neither_ a default _nor_ an explicit `map` or `mapId` will trigger a runtime error.
76
85
 
77
- - 583f1d6: All UI components in this project now accept the `mapId` (a `string`) _or_ the `map` (a `MapModel`) directly.
78
- - a8b3449: Switch to a new versioning strategy.
79
- From now on, packages released by this repository share a common version number.
80
- - 900eb11: Update dependencies.
81
- - Updated dependencies [310800c]
82
- - Updated dependencies [2502050]
83
- - Updated dependencies [583f1d6]
84
- - Updated dependencies [583f1d6]
85
- - Updated dependencies [397d617]
86
- - Updated dependencies [a8b3449]
87
- - Updated dependencies [310800c]
88
- - Updated dependencies [900eb11]
89
- - Updated dependencies [583f1d6]
90
- - Updated dependencies [397d617]
91
- - @open-pioneer/map@0.7.0
86
+ - 583f1d6: All UI components in this project now accept the `mapId` (a `string`) _or_ the `map` (a `MapModel`) directly.
87
+ - a8b3449: Switch to a new versioning strategy.
88
+ From now on, packages released by this repository share a common version number.
89
+ - 900eb11: Update dependencies.
90
+ - Updated dependencies [310800c]
91
+ - Updated dependencies [2502050]
92
+ - Updated dependencies [583f1d6]
93
+ - Updated dependencies [583f1d6]
94
+ - Updated dependencies [397d617]
95
+ - Updated dependencies [a8b3449]
96
+ - Updated dependencies [310800c]
97
+ - Updated dependencies [900eb11]
98
+ - Updated dependencies [583f1d6]
99
+ - Updated dependencies [397d617]
100
+ - @open-pioneer/map@0.7.0
92
101
 
93
102
  ## 0.2.4
94
103
 
95
104
  ### Patch Changes
96
105
 
97
- - 291ccb6: Automatically select initial selection-source.
98
- - b152428: Update trails dependencies
99
- - da18bda: The `onSelectionSourceChange` event is no longer thrown if user selects the currently selected source again.
100
- - Updated dependencies [b152428]
101
- - Updated dependencies [291ccb6]
102
- - @open-pioneer/map@0.6.1
106
+ - 291ccb6: Automatically select initial selection-source.
107
+ - b152428: Update trails dependencies
108
+ - da18bda: The `onSelectionSourceChange` event is no longer thrown if user selects the currently selected source again.
109
+ - Updated dependencies [b152428]
110
+ - Updated dependencies [291ccb6]
111
+ - @open-pioneer/map@0.6.1
103
112
 
104
113
  ## 0.2.3
105
114
 
106
115
  ### Patch Changes
107
116
 
108
- - 28e092a: Update dependencies
109
- - 28e092a: Adapt to OpenLayers type changes.
117
+ - 28e092a: Update dependencies
118
+ - 28e092a: Adapt to OpenLayers type changes.
110
119
 
111
120
  When creating a selection source for a `VectorLayer`, the precise type of that vector layer must now be `VectorLayer<Feature>` (instead of `VectorLayer<VectorSource>`).
112
121
  This is a TypeScript-only change that has no effects on the JavaScript code at runtime.
113
122
 
114
- - 65a14f4: Open select-menu on enter (fixes issue [#320](https://github.com/open-pioneer/trails-openlayers-base-packages/issues/320))
115
- - 484ad86: Add tooltip role to tooltip divs (See https://github.com/open-pioneer/trails-openlayers-base-packages/issues/309).
116
- - Updated dependencies [28e092a]
117
- - Updated dependencies [0d51d2f]
118
- - Updated dependencies [76f8863]
119
- - @open-pioneer/map@0.6.0
123
+ - 65a14f4: Open select-menu on enter (fixes issue [#320](https://github.com/open-pioneer/trails-openlayers-base-packages/issues/320))
124
+ - 484ad86: Add tooltip role to tooltip divs (See https://github.com/open-pioneer/trails-openlayers-base-packages/issues/309).
125
+ - Updated dependencies [28e092a]
126
+ - Updated dependencies [0d51d2f]
127
+ - Updated dependencies [76f8863]
128
+ - @open-pioneer/map@0.6.0
120
129
 
121
130
  ## 0.2.2
122
131
 
123
132
  ### Patch Changes
124
133
 
125
- - 4140646: Fix imports.
126
- - 4140646: Update trails dependencies
127
- - 4140646: Update to react 18.3.1
128
- - 81bc7da: Update trails dependencies
129
- - 2c092dc: Update dependencies
130
- - Updated dependencies [4140646]
131
- - Updated dependencies [4140646]
132
- - Updated dependencies [b5bb7a1]
133
- - Updated dependencies [81bc7da]
134
- - Updated dependencies [2c092dc]
135
- - Updated dependencies [4140646]
136
- - @open-pioneer/react-utils@0.2.3
137
- - @open-pioneer/map@0.5.1
134
+ - 4140646: Fix imports.
135
+ - 4140646: Update trails dependencies
136
+ - 4140646: Update to react 18.3.1
137
+ - 81bc7da: Update trails dependencies
138
+ - 2c092dc: Update dependencies
139
+ - Updated dependencies [4140646]
140
+ - Updated dependencies [4140646]
141
+ - Updated dependencies [b5bb7a1]
142
+ - Updated dependencies [81bc7da]
143
+ - Updated dependencies [2c092dc]
144
+ - Updated dependencies [4140646]
145
+ - @open-pioneer/react-utils@0.2.3
146
+ - @open-pioneer/map@0.5.1
138
147
 
139
148
  ## 0.2.1
140
149
 
141
150
  ### Patch Changes
142
151
 
143
- - Updated dependencies [520a97b]
144
- - @open-pioneer/map@0.5.0
152
+ - Updated dependencies [520a97b]
153
+ - @open-pioneer/map@0.5.0
145
154
 
146
155
  ## 0.2.0
147
156
 
148
157
  ### Minor Changes
149
158
 
150
- - 9334e81: Update to OpenLayers 9
159
+ - 9334e81: Update to OpenLayers 9
151
160
 
152
161
  ### Patch Changes
153
162
 
154
- - 13ea342: `VectorLayerSelectionSource`: Use a UUID as a fallback if a found feature has no id.
155
- - 1a8ad89: Update package.json metadata
156
- - 13ea342: Fix import of internal module of another package.
157
- - a0d8882: hide help texts during map export
158
- - 6162979: Update versions of core packages
159
- - Updated dependencies [1a8ad89]
160
- - Updated dependencies [a11bf72]
161
- - Updated dependencies [fc6bf82]
162
- - Updated dependencies [a0d8882]
163
- - Updated dependencies [6162979]
164
- - Updated dependencies [9334e81]
165
- - Updated dependencies [ac7fdd1]
166
- - Updated dependencies [13ea342]
167
- - @open-pioneer/react-utils@0.2.2
168
- - @open-pioneer/map@0.4.0
163
+ - 13ea342: `VectorLayerSelectionSource`: Use a UUID as a fallback if a found feature has no id.
164
+ - 1a8ad89: Update package.json metadata
165
+ - 13ea342: Fix import of internal module of another package.
166
+ - a0d8882: hide help texts during map export
167
+ - 6162979: Update versions of core packages
168
+ - Updated dependencies [1a8ad89]
169
+ - Updated dependencies [a11bf72]
170
+ - Updated dependencies [fc6bf82]
171
+ - Updated dependencies [a0d8882]
172
+ - Updated dependencies [6162979]
173
+ - Updated dependencies [9334e81]
174
+ - Updated dependencies [ac7fdd1]
175
+ - Updated dependencies [13ea342]
176
+ - @open-pioneer/react-utils@0.2.2
177
+ - @open-pioneer/map@0.4.0
169
178
 
170
179
  ## 0.1.1
171
180
 
172
181
  ### Patch Changes
173
182
 
174
- - 611ddb9: Export interface `BaseFeature` from Map API and use it correctly in base packages `selection` and `search`.
175
- - Updated dependencies [611ddb9]
176
- - @open-pioneer/map@0.3.1
183
+ - 611ddb9: Export interface `BaseFeature` from Map API and use it correctly in base packages `selection` and `search`.
184
+ - Updated dependencies [611ddb9]
185
+ - @open-pioneer/map@0.3.1
177
186
 
178
187
  ## 0.1.0
179
188
 
180
189
  ### Minor Changes
181
190
 
182
- - ee7c2d4: Update runtime version.
183
- - 61d3e0e: Initial release.
184
- - 0456500: Add interface `BaseFeature` to Map API.
185
- - 35be8ef: Introduction of `SelectionSourceFactory` for creating selection sources of an OpenLayers VectorLayer.
191
+ - ee7c2d4: Update runtime version.
192
+ - 61d3e0e: Initial release.
193
+ - 0456500: Add interface `BaseFeature` to Map API.
194
+ - 35be8ef: Introduction of `SelectionSourceFactory` for creating selection sources of an OpenLayers VectorLayer.
186
195
 
187
196
  ### Patch Changes
188
197
 
189
- - Updated dependencies [ee7c2d4]
190
- - Updated dependencies [a582e5e]
191
- - Updated dependencies [0456500]
192
- - Updated dependencies [762e7b9]
193
- - @open-pioneer/map@0.3.0
194
- - @open-pioneer/notifier@0.3.0
195
- - @open-pioneer/react-utils@0.2.1
198
+ - Updated dependencies [ee7c2d4]
199
+ - Updated dependencies [a582e5e]
200
+ - Updated dependencies [0456500]
201
+ - Updated dependencies [762e7b9]
202
+ - @open-pioneer/map@0.3.0
203
+ - @open-pioneer/notifier@0.3.0
204
+ - @open-pioneer/react-utils@0.2.1
@@ -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 { 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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B;AAAA,MACA,QAAQ,KAAO,EAAA;AACX,QAAA,OAAA,CAAQ,WAAc,GAAA,KAAA,CAAA;AAAA,OAC1B;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-2025 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;AACrB,MAAM,cAAiB,GAAA,oBAAA;AAEhB,MAAM,cAAe,CAAA;AAAA,EAChB,OAAA;AAAA,EACA,uBAA8C,EAAC;AAAA,EAC/C,KAAA;AAAA,EACA,QAAoB,GAAA,IAAA;AAAA,EACpB,cAAA;AAAA,EACA,sBAAA;AAAA,EAER,WACI,CAAA,KAAA,EACA,cACA,EAAA,sBAAA,EACA,gBACF,EAAA;AACE,IAAM,MAAA,QAAA,GAAW,IAAK,CAAA,YAAA,CAAa,KAAK,CAAA;AACxC,IAAA,IAAA,CAAK,oBAAqB,CAAA,IAAA;AAAA,MACtB,KAAK,aAAc,CAAA,KAAA,EAAO,gBAAkB,EAAA,QAAA,EAAU,KAAK,oBAAoB;AAAA,KACnF;AACA,IAAK,IAAA,CAAA,oBAAA,CAAqB,KAAK,IAAK,CAAA,UAAA,CAAW,OAAO,QAAU,EAAA,IAAA,CAAK,oBAAoB,CAAC,CAAA;AAE1F,IAAA,IAAA,CAAK,OAAU,GAAA,IAAA,CAAK,iBAAkB,CAAA,KAAA,EAAO,cAAc,CAAA;AAC3D,IAAA,IAAA,CAAK,KAAQ,GAAA,KAAA;AACb,IAAA,IAAA,CAAK,cAAiB,GAAA,cAAA;AACtB,IAAA,IAAA,CAAK,sBAAyB,GAAA,sBAAA;AAAA;AAClC,EAEA,aAAa,KAAc,EAAA;AACvB,IAAM,MAAA,QAAA,GAAW,MAAM,WAAY,EAAA;AACnC,IAAS,QAAA,CAAA,SAAA,CAAU,IAAI,YAAY,CAAA;AAEnC,IAAS,QAAA,CAAA,aAAA,GAAgB,CAAC,CAAM,KAAA;AAC5B,MAAA,CAAA,CAAE,cAAe,EAAA;AACjB,MAAO,OAAA,KAAA;AAAA,KACX;AACA,IAAO,OAAA,QAAA;AA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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;;;;"}
package/README.md CHANGED
@@ -75,10 +75,10 @@ the provided service `VectorSelectionSourceFactory` can be used to create an ins
75
75
 
76
76
  Key features of this selection source implementation are:
77
77
 
78
- - using only the extent as selection kind
79
- - listening to layer visibility changes and updating the status of the source
80
- - limiting the number of returned selection results to the corresponding selection option
81
- - throwing an event `changed:status` when the status updates
78
+ - using only the extent as selection kind
79
+ - listening to layer visibility changes and updating the status of the source
80
+ - limiting the number of returned selection results to the corresponding selection option
81
+ - throwing an event `changed:status` when the status updates
82
82
 
83
83
  Inject the selection source factory by referencing `"selection.VectorSelectionSourceFactory"`:
84
84
 
package/Selection.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { VStack, FormControl, FormLabel, Flex, Box, Tooltip, chakra, Icon, useToken } from '@open-pioneer/chakra-integration';
2
+ import { VStack, FormControl, FormLabel, useToken, Flex, Box, Tooltip, chakra, Icon } 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';
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, MapModelProps, 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 { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\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 * 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 { 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(props);\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 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) {\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":";;;;;;;;;;;;AAsFA,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,OAAA,EAAS,mBAAqB,EAAA,wBAAA,EAA6B,GAAA,KAAA,CAAA;AACnE,EAAA,MAAM,EAAE,cAAA,EAAmB,GAAA,uBAAA,CAAwB,aAAa,KAAK,CAAA,CAAA;AACrE,EAAA,MAAM,6BAA6B,IAAK,CAAA,aAAA,CAAc,EAAE,EAAA,EAAI,sBAAsB,CAAA,CAAA;AAElF,EAAM,MAAA,CAAC,aAAe,EAAA,gBAAgB,CAAI,GAAA,yBAAA;AAAA,IACtC,OAAA;AAAA,IACA,wBAAA;AAAA,GACJ,CAAA;AAEA,EAAM,MAAA,mBAAA,GAAsB,eAAgB,CAAA,aAAA,EAAe,0BAA0B,CAAA,CAAA;AAErF,EAAM,MAAA,QAAA,GAAW,YAAY,KAAK,CAAA,CAAA;AAClC,EAAM,MAAA,EAAE,kBAAqB,GAAA,sBAAA;AAA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GAAA,QAAA;AAAA,IACtC,QAAA;AAAA,IACA,CAAC,mBAAmB,QAAQ,CAAA;AAAA,IAC5B,CAAC,WAAW,SAAS,CAAA;AAAA,GACzB,CAAA;AACA,EAAA,OAAO,QAAQ,MAAM;AACjB,IAAA,MAAM,YAIF,GAAA;AAAA,MACA,SAAS,CAAC,MAAA,MAAY,EAAE,GAAG,MAAA,EAAQ,QAAQ,SAAU,EAAA,CAAA;AAAA,MACrD,kBAAA,EAAoB,CAAC,MAAY,MAAA;AAAA,QAC7B,GAAG,MAAA;AAAA,QACH,WAAA;AAAA,OACJ,CAAA;AAAA,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-2025 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, MapModelProps, 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, ReactNode, useEffect, useMemo, useRef, useState } from \"react\";\nimport { FiAlertTriangle } from \"react-icons/fi\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\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 * 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 { 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(props);\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>): ReactNode {\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>): ReactNode {\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 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) {\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":";;;;;;;;;;;;AAsFA,MAAM,mBAAkD,GAAA;AAAA,EACpD,eAAiB,EAAA,cAAA;AAAA,EACjB,YAAc,EAAA,OAAA;AAAA,EACd,YAAc,EAAA,KAAA;AAAA,EACd,WAAa,EAAA;AACjB,CAAA;AAKa,MAAA,SAAA,GAAgC,CAAC,KAAU,KA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,QAAQ,MAAM;AACjB,IAAA,MAAM,YAIF,GAAA;AAAA,MACA,SAAS,CAAC,MAAA,MAAY,EAAE,GAAG,MAAA,EAAQ,QAAQ,SAAU,EAAA,CAAA;AAAA,MACrD,kBAAA,EAAoB,CAAC,MAAY,MAAA;AAAA,QAC7B,GAAG,MAAA;AAAA,QACH;AAAA,OACJ,CAAA;AAAA,MACA,iBAAA,EAAmB,CAAC,QAAc,MAAA;AAAA,QAC9B,GAAG,QAAA;AAAA,QACH,eAAiB,EAAA;AAAA,OACrB;AAAA,KACJ;AACA,IAAO,OAAA,YAAA;AAAA,GACR,EAAA,CAAC,kBAAoB,EAAA,WAAW,CAAC,CAAA;AACxC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionController.js","sources":["SelectionController.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 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,CAAA;AAUxD,MAAM,mBAAsB,GAAA,GAAA,CAAA;AAErB,MAAM,mBAAoB,CAAA;AAAA,EAC7B,SAAA,CAAA;AAAA;AAAA;AAAA;AAAA,EAKS,WAAA,CAAA;AAAA;AAAA;AAAA;AAAA,EAKA,QAAA,CAAA;AAAA,EAET,YAAY,OAA2E,EAAA;AACnF,IAAA,MAAM,EAAE,QAAA,EAAU,OAAS,EAAA,UAAA,GAAa,qBAAwB,GAAA,OAAA,CAAA;AAChE,IAAA,IAAA,CAAK,SAAY,GAAA,QAAA,CAAA;AACjB,IAAA,IAAA,CAAK,WAAc,GAAA,UAAA,CAAA;AACnB,IAAA,IAAA,CAAK,QAAW,GAAA,OAAA,CAAA;AAAA,GACpB;AAAA,EAEA,OAAU,GAAA;AAAA,GAAC;AAAA,EAEX,MAAM,MACF,CAAA,MAAA,EACA,MAC2C,EAAA;AAC3C,IAAA,IAAI,CAAC,MAAQ,EAAA;AACT,MAAO,OAAA,KAAA,CAAA,CAAA;AAAA,KACX;AAEA,IAAA,OAAO,MAAM,IAAA,CAAK,iBAAkB,CAAA,MAAA,EAAQ,MAAM,CAAA,CAAA;AAAA,GACtD;AAAA,EAEA,MAAM,iBACF,CAAA,MAAA,EACA,MAC2C,EAAA;AAC3C,IAAA,MAAM,aAAa,IAAK,CAAA,SAAA,CAAU,KAAM,CAAA,OAAA,GAAU,aAAc,EAAA,CAAA;AAChE,IAAI,IAAA;AACA,MAAA,GAAA,CAAI,KAAM,CAAA,CAAA,8BAAA,EAAiC,MAAO,CAAA,KAAK,CAAG,CAAA,CAAA,CAAA,CAAA;AAE1D,MAAA,MAAM,aAAa,IAAK,CAAA,WAAA,CAAA;AACxB,MAAI,IAAA,OAAA,GAAU,MAAM,MAAO,CAAA,MAAA;AAAA,QACvB,EAAE,IAAM,EAAA,QAAA,EAAU,MAAO,EAAA;AAAA,QACzB;AAAA,UACI,UAAA;AAAA,UACA,aAAe,EAAA,UAAA;AAAA,UACf,MAAA,EAAQ,IAAI,eAAA,EAAkB,CAAA,MAAA;AAAA;AAAA,SAClC;AAAA,OACJ,CAAA;AACA,MAAI,IAAA,OAAA,CAAQ,SAAS,UAAY,EAAA;AAC7B,QAAU,OAAA,GAAA,OAAA,CAAQ,KAAM,CAAA,CAAA,EAAG,UAAU,CAAA,CAAA;AAAA,OACzC;AAEA,MAAA,GAAA,CAAI,MAAM,CAAS,MAAA,EAAA,OAAA,CAAQ,MAAM,CAAuB,oBAAA,EAAA,MAAA,CAAO,KAAK,CAAG,CAAA,CAAA,CAAA,CAAA;AACvE,MAAO,OAAA,EAAE,QAAgB,OAAiB,EAAA,CAAA;AAAA,aACrC,CAAG,EAAA;AACR,MAAA,GAAA,CAAI,KAAM,CAAA,CAAA,sBAAA,EAAyB,MAAO,CAAA,KAAK,WAAW,CAAC,CAAA,CAAA;AAC3D,MAAA,IAAA,CAAK,QAAS,EAAA,CAAA;AACd,MAAO,OAAA,KAAA,CAAA,CAAA;AAAA,KACX;AAAA,GACJ;AACJ;;;;"}
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,mBAAsB,GAAA,GAAA;AAErB,MAAM,mBAAoB,CAAA;AAAA,EAC7B,SAAA;AAAA;AAAA;AAAA;AAAA,EAKS,WAAA;AAAA;AAAA;AAAA;AAAA,EAKA,QAAA;AAAA,EAET,Y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AAK,CAAG,CAAA,CAAA,CAAA;AACvE,MAAO,OAAA,EAAE,QAAgB,OAAiB,EAAA;AAAA,aACrC,CAAG,EAAA;AACR,MAAA,GAAA,CAAI,KAAM,CAAA,CAAA,sBAAA,EAAyB,MAAO,CAAA,KAAK,WAAW,CAAC,CAAA;AAC3D,MAAA,IAAA,CAAK,QAAS,EAAA;AACd,MAAO,OAAA,MAAA;AAAA;AACX;AAER;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"VectorSelectionSource.js","sources":["VectorSelectionSource.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 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,8BAAqE,CAAA;AAAA,EACrE,KAAA,CAAA;AAAA,EACT,OAAU,GAAA,QAAA,CAAsC,EAAE,IAAA,EAAM,aAAa,CAAA,CAAA;AAAA,EACrE,YAAA,CAAA;AAAA,EACA,aAAA,CAAA;AAAA,EACA,sBAAA,CAAA;AAAA,EAEA,WAAA,CACI,WACA,EAAA,KAAA,EACA,qBACF,EAAA;AACE,IAAA,IAAA,CAAK,KAAQ,GAAA,KAAA,CAAA;AACb,I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AA,QAAA,MAAcA,EAAO,EAAA;AAAA,QAC1C,QAAA,EAAU,QAAQ,WAAY,EAAA;AAAA,QAC9B,UAAY,EAAA,kBAAA;AAAA,OAChB,CAAA;AAEA,MAAA,UAAA,CAAW,KAAK,MAAM,CAAA,CAAA;AAAA,KACzB,CAAA,CAAA;AACL,IAAA,MAAM,mBAAmB,UAAW,CAAA,MAAA,CAAO,CAAC,CAAA,KAA4B,KAAK,IAAI,CAAA,CAAA;AACjF,IAAM,MAAA,eAAA,GACF,gBAAiB,CAAA,MAAA,GAAS,OAAQ,CAAA,UAAA,GAC5B,iBAAiB,KAAM,CAAA,CAAA,EAAG,OAAQ,CAAA,UAAU,CAC5C,GAAA,gBAAA,CAAA;AACV,IAAO,OAAA,eAAA,CAAA;AAAA,GACX;AAAA,EAEA,aAAgB,GAAA;AACZ,IAAM,MAAA,cAAA,GAAiB,IAAK,CAAA,YAAA,CAAa,UAAW,EAAA,CAAA;AACpD,IAAM,MAAA,SAAA,GAAmC,cACnC,GAAA,EAAE,IAAM,EAAA,WAAA,EACR,GAAA,EAAE,IAAM,EAAA,aAAA,EAAe,MAAQ,EAAA,IAAA,CAAK,sBAAuB,EAAA,CAAA;AACjE,IAAA,IAAI,SAAU,CAAA,IAAA,KAAS,IAAK,CAAA,OAAA,CAAQ,MAAM,IAAM,EAAA;AAC5C,MAAA,IAAA,CAAK,QAAQ,KAAQ,GAAA,SAAA,CAAA;AAAA,KACzB;AAAA,GACJ;AACJ;;;;"}
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,8BAAqE,CAAA;AAAA,EACrE,KAAA;AAAA,EACT,OAAU,GAAA,QAAA,CAAsC,EAAE,IAAA,EAAM,aAAa,CAAA;AAAA,EACrE,YAAA;AAAA,EACA,aAAA;AAAA,EACA,sBAAA;AAAA,EAEA,WAAA,CACI,WACA,EAAA,KAAA,EACA,qBACF,EAAA;AACE,IAAA,IAAA,CAAK,KAAQ,GAAA,KAAA;AACb,IAAA,IAAA,CAAK,YAAe,GAAA,WAAA;AACpB,IAAA,IAAA,CAAK,sBAAyB,GAAA,qBAAA;AAC9B,IAAA,IAAA,CAAK,aAAc,EAAA;AACnB,IAAA,IAAA,CAAK,aAAgB,GAAA,IAAA,CAAK,YAAa,CAAA,EAAA,CAAG,kBAAkB,MAAM;AAC9D,MAAA,IAAA,CAAK,aAAc,EAAA;AAAA,KACtB,CAAA;AAAA;AACL,EAEA,OAAU,GAAA;AACN,IAAA,OAAA,CAAQ,KAAK,aAAa,CAAA;AAAA;AAC9B,EAEA,IAAI,MAAS,GAAA;AACT,IAAA,OAAO,KAAK,OAAQ,CAAA,KAAA;AAAA;AACxB,EAEA,MAAM,MACF,CAAA,aAAA,EACA,OAC0B,EAAA;AAC1B,IAAI,IAAA,aAAA,CAAc,SAAS,QAAU,EAAA;AACjC,MAAA,MAAM,IAAI,KAAA,CAAM,CAA+B,4BAAA,EAAA,aAAA,CAAc,IAAI,CAAE,CAAA,CAAA;AAAA;AAGvE,IA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AAA,OAAA,CAAQ,MAAM,IAAM,EAAA;AAC5C,MAAA,IAAA,CAAK,QAAQ,KAAQ,GAAA,SAAA;AAAA;AACzB;AAER;;;;"}
@@ -1,4 +1,4 @@
1
- import { useServiceInternal, useIntlInternal } from '@open-pioneer/runtime/react-integration';
1
+ import { useIntlInternal, useServiceInternal } from '@open-pioneer/runtime/react-integration';
2
2
 
3
3
  const PACKAGE_NAME = "@open-pioneer/selection";
4
4
  const useService = /*@__PURE__*/ useServiceInternal.bind(undefined, PACKAGE_NAME);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@open-pioneer/selection",
4
- "version": "0.9.0-dev.20250220091855",
4
+ "version": "0.9.0",
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"
@@ -15,20 +15,20 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@chakra-ui/icons": "^2.2.4",
18
- "@open-pioneer/chakra-integration": "^2.4.0",
19
- "@open-pioneer/core": "^2.4.0",
20
- "@open-pioneer/notifier": "^2.4.0",
21
- "@open-pioneer/react-utils": "^2.4.0",
22
- "@open-pioneer/runtime": "^2.4.0",
18
+ "@open-pioneer/chakra-integration": "^3.0.0",
19
+ "@open-pioneer/core": "^3.0.0",
20
+ "@open-pioneer/notifier": "^3.0.0",
21
+ "@open-pioneer/react-utils": "^3.0.0",
22
+ "@open-pioneer/runtime": "^3.0.0",
23
23
  "classnames": "^2.3.2",
24
- "chakra-react-select": "^5.0.2",
25
- "ol": "^10.3.0",
26
- "react": "^18.3.1",
24
+ "chakra-react-select": "^5.0.4",
25
+ "ol": "^10.4.0",
26
+ "react": "^19.0.0",
27
27
  "react-icons": "^5.3.0",
28
- "uuid": "^10.0.0",
28
+ "uuid": "^11.1.0",
29
29
  "@conterra/reactivity-core": "^0.4.3",
30
- "@open-pioneer/reactivity": "^2.4.0",
31
- "@open-pioneer/map": "^0.9.0-dev.20250220091855"
30
+ "@open-pioneer/reactivity": "^3.0.0",
31
+ "@open-pioneer/map": "^0.9.0"
32
32
  },
33
33
  "exports": {
34
34
  "./package.json": "./package.json",
package/services.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"services.js","sources":["services.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 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,4BAA0E,CAAA;AAAA,EACnF,KAAA,CAAA;AAAA,EAEA,WAAA,CAAY,EAAE,IAAA,EAAqC,EAAA;AAC/C,IAAA,IAAA,CAAK,KAAQ,GAAA,IAAA,CAAA;AAAA,GACjB;AAAA,EACA,sBAAsB,OAAwE,EAAA;AAC1F,IAAA,OAAO,IAAI,8BAAA;AAAA,MACP,OAAQ,CAAA,WAAA;AAAA,MACR,OAAQ,CAAA,KAAA;AAAA,MACR,KAAK,KAAM,CAAA,aAAA,CAAc,EAAE,EAAA,EAAI,yBAAyB,CAAA;AAAA,KAC5D,CAAA;AAAA,GACJ;AACJ;;;;"}
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,4BAA0E,CAAA;AAAA,EACnF,KAAA;AAAA,EAEA,WAAA,CAAY,EAAE,IAAA,EAAqC,EAAA;AAC/C,IAAA,IAAA,CAAK,KAAQ,GAAA,IAAA;AAAA;AACjB,EACA,sBAAsB,OAAwE,EAAA;AAC1F,IAAA,OAAO,IAAI,8BAAA;AAAA,MACP,OAAQ,CAAA,WAAA;AAAA,MACR,OAAQ,CAAA,KAAA;AAAA,MACR,KAAK,KAAM,CAAA,aAAA,CAAc,EAAE,EAAA,EAAI,yBAAyB;AAAA,KAC5D;AAAA;AAER;;;;"}