@open-pioneer/selection 1.4.0 → 1.5.0-dev.20260910103330

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +47 -29
  2. package/README.md +28 -9
  3. package/_virtual/hooks.js +1 -1
  4. package/_virtual/source-info.js +1 -1
  5. package/api.d.ts +27 -2
  6. package/i18n/de.yaml +0 -6
  7. package/i18n/en.yaml +0 -6
  8. package/index.d.ts +1 -1
  9. package/index.js +1 -1
  10. package/interactions/ExtentSelectionInteraction.d.ts +12 -0
  11. package/interactions/ExtentSelectionInteraction.js +57 -0
  12. package/interactions/ExtentSelectionInteraction.js.map +1 -0
  13. package/model/SelectionViewModel.d.ts +30 -0
  14. package/model/SelectionViewModel.js +270 -0
  15. package/model/SelectionViewModel.js.map +1 -0
  16. package/model/SelectionViewModelFactory.d.ts +21 -0
  17. package/model/SelectionViewModelFactory.js +43 -0
  18. package/model/SelectionViewModelFactory.js.map +1 -0
  19. package/model/index.d.ts +1 -0
  20. package/model/index.js +2 -0
  21. package/model/index.js.map +1 -0
  22. package/package.json +34 -15
  23. package/services.d.ts +2 -7
  24. package/services.js +2 -17
  25. package/services.js.map +1 -1
  26. package/{VectorSelectionSource.d.ts → sources/VectorSelectionSource.d.ts} +3 -7
  27. package/{VectorSelectionSource.js → sources/VectorSelectionSource.js} +12 -9
  28. package/sources/VectorSelectionSource.js.map +1 -0
  29. package/sources/VectorSelectionSourceFactory.d.ts +7 -0
  30. package/sources/VectorSelectionSourceFactory.js +19 -0
  31. package/sources/VectorSelectionSourceFactory.js.map +1 -0
  32. package/{Selection.d.ts → ui/Selection.d.ts} +1 -1
  33. package/ui/Selection.js +97 -0
  34. package/ui/Selection.js.map +1 -0
  35. package/ui/SelectionSourceItem.d.ts +7 -0
  36. package/ui/SelectionSourceItem.js +38 -0
  37. package/ui/SelectionSourceItem.js.map +1 -0
  38. package/ui/useSelectionSourceId.d.ts +9 -0
  39. package/ui/useSelectionSourceId.js +23 -0
  40. package/ui/useSelectionSourceId.js.map +1 -0
  41. package/ui/useSelectionViewModel.d.ts +11 -0
  42. package/ui/useSelectionViewModel.js +43 -0
  43. package/ui/useSelectionViewModel.js.map +1 -0
  44. package/ui/useSourceStatus.d.ts +8 -0
  45. package/ui/useSourceStatus.js +27 -0
  46. package/ui/useSourceStatus.js.map +1 -0
  47. package/DragController.d.ts +0 -33
  48. package/DragController.js +0 -175
  49. package/DragController.js.map +0 -1
  50. package/Selection.js +0 -232
  51. package/Selection.js.map +0 -1
  52. package/SelectionController.d.ts +0 -20
  53. package/SelectionController.js +0 -58
  54. package/SelectionController.js.map +0 -1
  55. package/VectorSelectionSource.js.map +0 -1
  56. /package/{SelectionTooltipContent.d.ts → ui/SelectionTooltipContent.d.ts} +0 -0
  57. /package/{SelectionTooltipContent.js → ui/SelectionTooltipContent.js} +0 -0
  58. /package/{SelectionTooltipContent.js.map → ui/SelectionTooltipContent.js.map} +0 -0
  59. /package/{selection.css → ui/selection.css} +0 -0
  60. /package/{selection.css.map → ui/selection.css.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @open-pioneer/selection
2
2
 
3
+ ## 1.5.0-dev.20260910103330
4
+
5
+ ### Minor Changes
6
+
7
+ - f790fda: Update to Chakra 3.37.0
8
+ - fab4c36: Add the map model to the context of the selection source's `select` method.
9
+ - fab4c36: Add support for an `id` property on the selection source interface to identify sources. The property remains optional for the time being to preserve backwards compatibility.
10
+
11
+ ### Patch Changes
12
+
13
+ - 3203815: Update code to match new react linting rules from oxlint.
14
+ - fab4c36: Cancel selection requests that are no longer needed.
15
+ If the user starts another selection while a request is still running, the previous request is cancelled
16
+ and only the results of the most recent selection are used.
17
+ - fab4c36: Use `synchronized` to watch the vector layer's visibility.
18
+ - fab4c36: Refactor internal state management.
19
+ - 09ec7c7: Updated dependencies
20
+
3
21
  ## 1.4.0
4
22
 
5
23
  ### Minor Changes
@@ -78,17 +96,17 @@
78
96
  - 193068a: Deprecate the `mapId` property on React components.
79
97
  Use the `MapModel` directly instead to pass a reference to the map.
80
98
 
81
- Example:
99
+ Example:
82
100
 
83
- ```tsx
84
- // Default map for entire component tree
85
- <DefaultMapProvider map={mapModel}>
86
- <Toc />
87
- </DefaultMapProvider>
101
+ ```tsx
102
+ // Default map for entire component tree
103
+ <DefaultMapProvider map={mapModel}>
104
+ <Toc />
105
+ </DefaultMapProvider>
88
106
 
89
- // Map for specific component
90
- <Toc map={mapModel} />
91
- ```
107
+ // Map for specific component
108
+ <Toc map={mapModel} />
109
+ ```
92
110
 
93
111
  ### Patch Changes
94
112
 
@@ -109,33 +127,33 @@
109
127
  - e7978a8: Support reactive changes on the `SelectionSource`'s `status` property using the reactivity API.
110
128
  **Remove** support for the `changed:status"` event on the selection source: use signals instead.
111
129
 
112
- For example, to implement a `SelectionSource` with changing availability:
130
+ For example, to implement a `SelectionSource` with changing availability:
113
131
 
114
- ```ts
115
- class MySelectionSource implements SelectionSource {
116
- private _status = reactive("available");
132
+ ```ts
133
+ class MySelectionSource implements SelectionSource {
134
+ private _status = reactive("available");
117
135
 
118
- label = "My selection source";
136
+ label = "My selection source";
119
137
 
120
- get status() {
121
- return this._status.value;
122
- }
138
+ get status() {
139
+ return this._status.value;
140
+ }
123
141
 
124
- someEventHandler() {
125
- // Change the status by updating the signal's value.
126
- // The UI will update automatically.
127
- this._status.value = "unavailable";
128
- }
142
+ someEventHandler() {
143
+ // Change the status by updating the signal's value.
144
+ // The UI will update automatically.
145
+ this._status.value = "unavailable";
129
146
  }
130
- ```
147
+ }
148
+ ```
131
149
 
132
150
  - b717121: Update from OL 9 to OL 10.
133
151
  - b717121: Adjust the type the property `vectorLayer` of the exported interface `VectorLayerSelectionSourceOptions`.
134
152
  The type is now `VectorLayer<VectorSource, Feature>` instead of `VectorLayer<Feature>`.
135
153
  - 2fa8020: Update trails core package dependencies.
136
- - Also updates Chakra UI to the latest 2.x version and Chakra React Select to version 5.
137
- - Removes any obsolete references to `@chakra-ui/system`.
138
- This dependency seems to be no longer required and may lead to duplicate packages in your dependency tree.
154
+ - Also updates Chakra UI to the latest 2.x version and Chakra React Select to version 5.
155
+ - Removes any obsolete references to `@chakra-ui/system`.
156
+ This dependency seems to be no longer required and may lead to duplicate packages in your dependency tree.
139
157
 
140
158
  ### Patch Changes
141
159
 
@@ -153,7 +171,7 @@
153
171
  - 583f1d6: The `mapId` or `map` properties are now optional on individual components.
154
172
  You can use the `DefaultMapProvider` to configure an implicit default value.
155
173
 
156
- Note that configuring _neither_ a default _nor_ an explicit `map` or `mapId` will trigger a runtime error.
174
+ Note that configuring _neither_ a default _nor_ an explicit `map` or `mapId` will trigger a runtime error.
157
175
 
158
176
  - 583f1d6: All UI components in this project now accept the `mapId` (a `string`) _or_ the `map` (a `MapModel`) directly.
159
177
  - a8b3449: Switch to a new versioning strategy.
@@ -175,8 +193,8 @@
175
193
  - 28e092a: Update dependencies
176
194
  - 28e092a: Adapt to OpenLayers type changes.
177
195
 
178
- When creating a selection source for a `VectorLayer`, the precise type of that vector layer must now be `VectorLayer<Feature>` (instead of `VectorLayer<VectorSource>`).
179
- This is a TypeScript-only change that has no effects on the JavaScript code at runtime.
196
+ When creating a selection source for a `VectorLayer`, the precise type of that vector layer must now be `VectorLayer<Feature>` (instead of `VectorLayer<VectorSource>`).
197
+ This is a TypeScript-only change that has no effects on the JavaScript code at runtime.
180
198
 
181
199
  - 65a14f4: Open select-menu on enter (fixes issue [#320](https://github.com/open-pioneer/trails-openlayers-base-packages/issues/320))
182
200
  - 484ad86: Add tooltip role to tooltip divs (See https://github.com/open-pioneer/trails-openlayers-base-packages/issues/309).
package/README.md CHANGED
@@ -44,22 +44,28 @@ To provide the selection sources that are used by the selection-UI component, im
44
44
  ```tsx
45
45
  import {
46
46
  Selection,
47
+ SelectionKind,
48
+ SelectionOptions,
47
49
  SelectionResult,
48
50
  SelectionSource,
49
51
  SelectionSourceStatus
50
52
  } from "@open-pioneer/selection";
51
- import { MAP_ID } from "./MapConfigProviderImpl";
52
53
 
53
54
  class MySelectionSource implements SelectionSource {
55
+ // The optional id of this source. It must be unique among the sources used by the same
56
+ // selection component and it must not change. If no id is defined, the selection component
57
+ // generates one internally.
58
+ id = "my-sample-rest-service";
59
+
54
60
  // The label of this source, used as a title for this source's results.
55
61
  label = "My sample REST-Service";
56
62
 
57
63
  // The optional status of this source. If there is no status defined, it is assumed that the source is always available.
64
+ // Use the object form (`{ kind: "unavailable", reason: "..." }`) to tell the user why the source is
65
+ // not available; if no reason is given, the i18n value for "sourceNotAvailable" is displayed.
66
+ // This value may be reactive: changes are reflected in the UI.
58
67
  status?: SelectionSourceStatus;
59
68
 
60
- // The reason that the source is not available. If it is not defined, the i18n value for "sourceNotAvailable" will be displayed
61
- unavailableStatusReason?: string;
62
-
63
69
  // Performs a selection with a given selectionKind and returns a list of selection results.
64
70
  // see the API documentation of `SelectionSource`.
65
71
  select(selectionKind: SelectionKind, options: SelectionOptions): Promise<SelectionResult[]> {}
@@ -79,9 +85,8 @@ the provided service `VectorSelectionSourceFactory` can be used to create an ins
79
85
  Key features of this selection source implementation are:
80
86
 
81
87
  - using only the extent as selection kind
82
- - listening to layer visibility changes and updating the status of the source
88
+ - listening to layer visibility changes and updating the reactive `status` of the source accordingly
83
89
  - limiting the number of returned selection results to the corresponding selection option
84
- - throwing an event `changed:status` when the status updates
85
90
 
86
91
  Inject the selection source factory by referencing `"selection.VectorSelectionSourceFactory"`:
87
92
 
@@ -106,13 +111,27 @@ and create a selection source instance:
106
111
  ```ts
107
112
  const vectorSelectionSourceFactory = this._vectorSelectionSourceFactory; // injected
108
113
  const layerSelectionSource = vectorSelectionSourceFactory.createSelectionSource({
114
+ id: "my-vector-layer", // optional, see "Implementing a selection source"
109
115
  vectorLayer: vectorLayer,
110
116
  label: "My Vector Layer Title shown in UI"
111
117
  });
118
+ ```
112
119
 
113
- const eventHandler = layerSelectionSource.on("changed:status", () => {
114
- // do something (e.g. like removing map highlighting if unavailable)
115
- });
120
+ The `status` of the source is reactive: it changes when the visibility of the layer changes.
121
+ To react to those changes, watch the value using the reactivity API:
122
+
123
+ ```ts
124
+ import { watchValue } from "@conterra/reactivity-core";
125
+
126
+ const handle = watchValue(
127
+ () => layerSelectionSource.status,
128
+ (status) => {
129
+ // do something (e.g. like removing map highlighting if unavailable)
130
+ }
131
+ );
132
+
133
+ // later, when you are no longer interested in the status:
134
+ handle.destroy();
116
135
  ```
117
136
 
118
137
  ## License
package/_virtual/hooks.js CHANGED
@@ -1,4 +1,4 @@
1
- import { useIntlInternal, useServiceInternal } from '@open-pioneer/runtime/react-integration';
1
+ import { useServiceInternal, useIntlInternal } 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);
@@ -1,4 +1,4 @@
1
- const sourceId = "@open-pioneer/selection/SelectionController";
1
+ const sourceId = "@open-pioneer/selection/model/SelectionViewModel";
2
2
 
3
3
  export { sourceId };
4
4
  //# sourceMappingURL=source-info.js.map
package/api.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Resource } from "@open-pioneer/core";
2
- import { BaseFeature } from "@open-pioneer/map";
2
+ import { BaseFeature, MapModel } from "@open-pioneer/map";
3
3
  import { DeclaredService } from "@open-pioneer/runtime";
4
4
  import type { Extent } from "ol/extent";
5
5
  import Feature from "ol/Feature";
@@ -52,9 +52,17 @@ export interface SelectionOptions {
52
52
  * Useful to return the selection result's geometry in the suitable projection, should they differ.
53
53
  */
54
54
  mapProjection: Projection;
55
+ /**
56
+ * The map model of the map associated with the selection.
57
+ */
58
+ map: MapModel;
55
59
  /**
56
60
  * The signal can be used to detect cancellation.
57
61
  *
62
+ * The signal is aborted when the results of this selection are no longer needed,
63
+ * for example because the user started another selection in the meantime
64
+ * or because the selection widget has been destroyed.
65
+ *
58
66
  * You can pass this signal to builtin functions like `fetch` that automatically
59
67
  * support cancellation.
60
68
  */
@@ -83,6 +91,15 @@ export type SelectionKind = ExtentSelection;
83
91
  * Developers can create classes that implement this interface for different selection sources.
84
92
  */
85
93
  export interface SelectionSource {
94
+ /**
95
+ * The id of this source.
96
+ *
97
+ * Must be unique across all selection sources used within the same selection component.
98
+ *
99
+ * The id must not change while the source is in use (this value is not reactive).
100
+ * If no id is defined, the selection component generates one internally.
101
+ */
102
+ readonly id?: string;
86
103
  /**
87
104
  * The label of this source.
88
105
  *
@@ -103,6 +120,12 @@ export interface SelectionSource {
103
120
  *
104
121
  * Implementations should return the results ordered by priority (best match first), if possible.
105
122
  *
123
+ * The provided `AbortSignal` in `options.signal` is used to cancel outdated requests.
124
+ *
125
+ * NOTE: If your selection source implements custom error handling (i.e. `try`/`catch`), it is
126
+ * good practice to forward abort errors without modification. This will enable the selection
127
+ * widget to differentiate real errors from cancellations.
128
+ *
106
129
  * @param selectionKind The geometry with which to perform the spatial selection. Currently only
107
130
  * an extent is supported.
108
131
  * @param options see interface documentation {@link SelectionOptions}
@@ -110,10 +133,12 @@ export interface SelectionSource {
110
133
  select(selectionKind: SelectionKind, options: SelectionOptions): Promise<SelectionResult[]>;
111
134
  }
112
135
  export interface VectorLayerSelectionSourceOptions {
136
+ id?: string;
113
137
  vectorLayer: VectorLayer<VectorSource, Feature>;
114
138
  label: string;
115
139
  }
116
- export interface VectorLayerSelectionSource extends Required<SelectionSource>, Resource {
140
+ export interface VectorLayerSelectionSource extends SelectionSource, Resource {
141
+ readonly status: SelectionSourceStatus;
117
142
  }
118
143
  /**
119
144
  * A factory that creates {@link VectorLayerSelectionSource | selection sources} to be used on an
package/i18n/de.yaml CHANGED
@@ -1,9 +1,4 @@
1
1
  messages:
2
- selectMethod: "Methode auswählen"
3
- EXTENT: "Rechteck"
4
- POLYGON: "Polygon"
5
- FREEPOLYGON: "Freies Zeichnen"
6
- CIRCLE: "Kreis"
7
2
  selectSource: "Quelle auswählen"
8
3
  tooltip: "Klicken Sie in die Karte, halten Sie die Maustaste gedrückt und ziehen Sie ein Rechteck auf"
9
4
  disabledTooltip: "Die aktuelle Selektionsquelle ist nicht verfügbar."
@@ -12,4 +7,3 @@ messages:
12
7
  selectionFailed: "Die räumliche Auswahl ist fehlgeschlagen"
13
8
  selectionPlaceholder: "Keine Quelle ausgewählt"
14
9
  layerNotVisibleReason: "Zugehöriger Layer ist nicht sichtbar."
15
- selected: "selektiert"
package/i18n/en.yaml CHANGED
@@ -1,9 +1,4 @@
1
1
  messages:
2
- selectMethod: Select method
3
- EXTENT: "Rechteck"
4
- POLYGON: "Polygon"
5
- FREEPOLYGON: "Freies Zeichnen"
6
- CIRCLE: "Kreis"
7
2
  selectSource: "Select source"
8
3
  tooltip: "Click on the map, hold down the mouse button and draw a rectangle"
9
4
  disabledTooltip: "The current selection source is not available"
@@ -12,4 +7,3 @@ messages:
12
7
  selectionFailed: "Spatial selection failed"
13
8
  selectionPlaceholder: "No source selected"
14
9
  layerNotVisibleReason: "Matching layer is not visible."
15
- selected: "selected"
package/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export * from "./api";
2
- export { Selection, type SelectionProps, type SelectionCompleteEvent, type SelectionSourceChangedEvent } from "./Selection";
2
+ export { Selection, type SelectionCompleteEvent, type SelectionProps, type SelectionSourceChangedEvent } from "./ui/Selection";
package/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { Selection } from './Selection.js';
1
+ export { Selection } from './ui/Selection.js';
2
2
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,12 @@
1
+ import { MapModel } from "@open-pioneer/map";
2
+ import { Geometry } from "ol/geom";
3
+ /**
4
+ * Registers interactions on the map for extent selection.
5
+ *
6
+ * Calls `onSuccess` whenever the user selected an extent.
7
+ */
8
+ export declare class ExtentSelectionInteraction {
9
+ #private;
10
+ constructor(map: MapModel, onSuccess: (geometry: Geometry) => void);
11
+ destroy(): void;
12
+ }
@@ -0,0 +1,57 @@
1
+ import { destroyResources } from '@open-pioneer/core';
2
+ import { mouseActionButton } from 'ol/events/condition.js';
3
+ import { DragBox, DragPan } from 'ol/interaction.js';
4
+
5
+ class ExtentSelectionInteraction {
6
+ #map;
7
+ #onSuccess;
8
+ #resources;
9
+ constructor(map, onSuccess) {
10
+ this.#map = map;
11
+ this.#onSuccess = onSuccess;
12
+ this.#resources = [
13
+ createDragboxInteraction(this.#map, this.#onSuccess),
14
+ createPanningInteraction(this.#map)
15
+ ];
16
+ }
17
+ destroy() {
18
+ destroyResources(this.#resources);
19
+ }
20
+ }
21
+ function createDragboxInteraction(map, onSuccess) {
22
+ const olMap = map.olMap;
23
+ const dragbox = new DragBox({
24
+ className: "selection-drag-box",
25
+ condition: mouseActionButton
26
+ });
27
+ dragbox.on("boxend", function() {
28
+ onSuccess(dragbox.getGeometry());
29
+ });
30
+ olMap.addInteraction(dragbox);
31
+ return {
32
+ destroy() {
33
+ olMap.removeInteraction(dragbox);
34
+ dragbox.dispose();
35
+ }
36
+ };
37
+ }
38
+ function createPanningInteraction(map) {
39
+ const olMap = map.olMap;
40
+ const rightClick = (mapBrowserEvent) => {
41
+ const originalEvent = mapBrowserEvent.originalEvent;
42
+ return "button" in originalEvent && originalEvent.button === 2;
43
+ };
44
+ const drag = new DragPan({
45
+ condition: rightClick
46
+ });
47
+ olMap.addInteraction(drag);
48
+ return {
49
+ destroy() {
50
+ olMap.removeInteraction(drag);
51
+ drag.dispose();
52
+ }
53
+ };
54
+ }
55
+
56
+ export { ExtentSelectionInteraction };
57
+ //# sourceMappingURL=ExtentSelectionInteraction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExtentSelectionInteraction.js","sources":["ExtentSelectionInteraction.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { destroyResources, Resource } from \"@open-pioneer/core\";\nimport { MapModel } from \"@open-pioneer/map\";\nimport { mouseActionButton } from \"ol/events/condition\";\nimport { Geometry } from \"ol/geom\";\nimport { DragBox, DragPan } from \"ol/interaction\";\nimport MapBrowserEvent from \"ol/MapBrowserEvent\";\n\n/**\n * Registers interactions on the map for extent selection.\n *\n * Calls `onSuccess` whenever the user selected an extent.\n */\nexport class ExtentSelectionInteraction {\n #map: MapModel;\n #onSuccess: (geometry: Geometry) => void;\n\n #resources: Resource[];\n\n constructor(map: MapModel, onSuccess: (geometry: Geometry) => void) {\n this.#map = map;\n this.#onSuccess = onSuccess;\n\n this.#resources = [\n createDragboxInteraction(this.#map, this.#onSuccess),\n createPanningInteraction(this.#map)\n ];\n }\n\n destroy() {\n destroyResources(this.#resources);\n }\n}\n\nfunction createDragboxInteraction(\n map: MapModel,\n onSuccess: (geometry: Geometry) => void\n): Resource {\n const olMap = map.olMap;\n const dragbox = new DragBox({\n className: \"selection-drag-box\",\n condition: mouseActionButton\n });\n dragbox.on(\"boxend\", function () {\n onSuccess(dragbox.getGeometry());\n });\n\n olMap.addInteraction(dragbox);\n return {\n destroy() {\n olMap.removeInteraction(dragbox);\n dragbox.dispose();\n }\n };\n}\n\n// For panning using the right mouse button during selection interaction\nfunction createPanningInteraction(map: MapModel): Resource {\n const olMap = map.olMap;\n const rightClick = (mapBrowserEvent: MapBrowserEvent) => {\n const originalEvent = mapBrowserEvent.originalEvent;\n return \"button\" in originalEvent && originalEvent.button === 2;\n };\n const drag = new DragPan({\n condition: rightClick\n });\n\n olMap.addInteraction(drag);\n return {\n destroy() {\n olMap.removeInteraction(drag);\n drag.dispose();\n }\n };\n}\n"],"names":[],"mappings":";;;;AAeO,MAAM,0BAAA,CAA2B;AAAA,EACpC,IAAA;AAAA,EACA,UAAA;AAAA,EAEA,UAAA;AAAA,EAEA,WAAA,CAAY,KAAe,SAAA,EAAyC;AAChE,IAAA,IAAA,CAAK,IAAA,GAAO,GAAA;AACZ,IAAA,IAAA,CAAK,UAAA,GAAa,SAAA;AAElB,IAAA,IAAA,CAAK,UAAA,GAAa;AAAA,MACd,wBAAA,CAAyB,IAAA,CAAK,IAAA,EAAM,IAAA,CAAK,UAAU,CAAA;AAAA,MACnD,wBAAA,CAAyB,KAAK,IAAI;AAAA,KACtC;AAAA,EACJ;AAAA,EAEA,OAAA,GAAU;AACN,IAAA,gBAAA,CAAiB,KAAK,UAAU,CAAA;AAAA,EACpC;AACJ;AAEA,SAAS,wBAAA,CACL,KACA,SAAA,EACQ;AACR,EAAA,MAAM,QAAQ,GAAA,CAAI,KAAA;AAClB,EAAA,MAAM,OAAA,GAAU,IAAI,OAAA,CAAQ;AAAA,IACxB,SAAA,EAAW,oBAAA;AAAA,IACX,SAAA,EAAW;AAAA,GACd,CAAA;AACD,EAAA,OAAA,CAAQ,EAAA,CAAG,UAAU,WAAY;AAC7B,IAAA,SAAA,CAAU,OAAA,CAAQ,aAAa,CAAA;AAAA,EACnC,CAAC,CAAA;AAED,EAAA,KAAA,CAAM,eAAe,OAAO,CAAA;AAC5B,EAAA,OAAO;AAAA,IACH,OAAA,GAAU;AACN,MAAA,KAAA,CAAM,kBAAkB,OAAO,CAAA;AAC/B,MAAA,OAAA,CAAQ,OAAA,EAAQ;AAAA,IACpB;AAAA,GACJ;AACJ;AAGA,SAAS,yBAAyB,GAAA,EAAyB;AACvD,EAAA,MAAM,QAAQ,GAAA,CAAI,KAAA;AAClB,EAAA,MAAM,UAAA,GAAa,CAAC,eAAA,KAAqC;AACrD,IAAA,MAAM,gBAAgB,eAAA,CAAgB,aAAA;AACtC,IAAA,OAAO,QAAA,IAAY,aAAA,IAAiB,aAAA,CAAc,MAAA,KAAW,CAAA;AAAA,EACjE,CAAA;AACA,EAAA,MAAM,IAAA,GAAO,IAAI,OAAA,CAAQ;AAAA,IACrB,SAAA,EAAW;AAAA,GACd,CAAA;AAED,EAAA,KAAA,CAAM,eAAe,IAAI,CAAA;AACzB,EAAA,OAAO;AAAA,IACH,OAAA,GAAU;AACN,MAAA,KAAA,CAAM,kBAAkB,IAAI,CAAA;AAC5B,MAAA,IAAA,CAAK,OAAA,EAAQ;AAAA,IACjB;AAAA,GACJ;AACJ;;;;"}
@@ -0,0 +1,30 @@
1
+ import { MapModel } from "@open-pioneer/map";
2
+ import { SelectionResult, SelectionSource, SelectionSourceStatusObject } from "../api";
3
+ export interface Messages {
4
+ active: string;
5
+ inactive: string;
6
+ noSource: string;
7
+ }
8
+ export declare class SelectionViewModel {
9
+ #private;
10
+ constructor(options: {
11
+ map: MapModel;
12
+ messages: Messages;
13
+ onSelectionComplete: (source: SelectionSource, results: SelectionResult[]) => void;
14
+ onError: () => void;
15
+ maxResults?: number;
16
+ });
17
+ destroy(): void;
18
+ get sources(): SelectionSource[];
19
+ set sources(newSources: SelectionSource[]);
20
+ get currentSource(): SelectionSource | undefined;
21
+ set currentSource(source: SelectionSource | undefined);
22
+ /** Returns true if the selection interaction is currently active. */
23
+ get isInteractionActive(): boolean;
24
+ /** Aria message to represent the current state. Also serves as the tooltip text. */
25
+ get ariaMessage(): string;
26
+ }
27
+ /**
28
+ * Normalizes the source's status into an object.
29
+ */
30
+ export declare function getSourceStatus(source: SelectionSource): SelectionSourceStatusObject;