@maptiler/geocoding-control 2.0.0 → 2.1.0-rc1
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/MapLibreBasedGeocodingControl.d.ts +3027 -27
- package/icons/10pin.svg +4 -1
- package/icons/9pin.svg +4 -1
- package/icons/alcohol.svg +1 -1
- package/icons/alpine_hut.svg +1 -1
- package/icons/apartment.svg +4 -1
- package/icons/area.svg +1 -5
- package/icons/artwork.svg +4 -1
- package/icons/beauty.svg +14 -1
- package/icons/bicycle_repair_station.svg +18 -1
- package/icons/biergarten.svg +4 -1
- package/icons/books.svg +14 -1
- package/icons/bowl.svg +4 -1
- package/icons/bowling_alley.svg +4 -1
- package/icons/bus_station.svg +1 -1
- package/icons/camping.svg +1 -1
- package/icons/car_repair.svg +14 -1
- package/icons/car_wash.svg +19 -1
- package/icons/cave_entrance.svg +15 -1
- package/icons/chalet.svg +1 -1
- package/icons/chemist.svg +14 -1
- package/icons/church.svg +4 -1
- package/icons/community_centre.svg +20 -1
- package/icons/firestation.svg +4 -1
- package/icons/guest_house.svg +29 -8
- package/icons/hotel.svg +1 -1
- package/icons/housenumber.svg +19 -14
- package/icons/hut.svg +1 -4
- package/icons/medical_supply.svg +20 -1
- package/icons/memorial.svg +14 -1
- package/icons/motel.svg +19 -1
- package/icons/post.svg +1 -1
- package/icons/post_office.svg +1 -1
- package/icons/postal_code.svg +1 -23
- package/icons/public_bookcase.svg +14 -1
- package/icons/public_building.svg +4 -1
- package/icons/shintoist.svg +1 -1
- package/icons/street.svg +11 -14
- package/icons/vehicle_inspection.svg +18 -1
- package/icons/wilderness_hut.svg +1 -1
- package/leaflet-controller.d.ts +1 -1
- package/leaflet-controller.js +113 -110
- package/leaflet-controller.js.map +1 -1
- package/leaflet-controller.umd.js +2 -2
- package/leaflet-controller.umd.js.map +1 -1
- package/leaflet.d.ts +58 -5
- package/leaflet.js +1438 -1265
- package/leaflet.js.map +1 -1
- package/leaflet.umd.js +3 -3
- package/leaflet.umd.js.map +1 -1
- package/maplibregl-controller.d.ts +1 -1
- package/maplibregl-controller.js +483 -469
- package/maplibregl-controller.js.map +1 -1
- package/maplibregl-controller.umd.js +3 -3
- package/maplibregl-controller.umd.js.map +1 -1
- package/maplibregl.d.ts +2499 -13
- package/maplibregl.js +2435 -2139
- package/maplibregl.js.map +1 -1
- package/maplibregl.umd.js +3 -3
- package/maplibregl.umd.js.map +1 -1
- package/maptilersdk.d.ts +2499 -13
- package/maptilersdk.js +2432 -2139
- package/maptilersdk.js.map +1 -1
- package/maptilersdk.umd.js +3 -3
- package/maptilersdk.umd.js.map +1 -1
- package/openlayers-controller.d.ts +1 -1
- package/openlayers-controller.js +66 -63
- package/openlayers-controller.js.map +1 -1
- package/openlayers-controller.umd.js +2 -2
- package/openlayers-controller.umd.js.map +1 -1
- package/openlayers.d.ts +53 -1
- package/openlayers.js +2046 -1902
- package/openlayers.js.map +1 -1
- package/openlayers.umd.js +3 -3
- package/openlayers.umd.js.map +1 -1
- package/package.json +28 -28
- package/react.d.ts +31 -5
- package/react.js +1252 -1096
- package/react.js.map +1 -1
- package/react.umd.js +1 -1
- package/react.umd.js.map +1 -1
- package/style.css +1 -1
- package/svelte/FeatureItem.svelte +60 -13
- package/svelte/FeatureItem.svelte.d.ts +4 -4
- package/svelte/GeocodingControl.svelte +166 -98
- package/svelte/GeocodingControl.svelte.d.ts +36 -16
- package/svelte/MapLibreBasedGeocodingControl.d.ts +3027 -27
- package/svelte/MapLibreBasedGeocodingControl.js +154 -21
- package/svelte/leaflet-controller.d.ts +1 -1
- package/svelte/leaflet-controller.js +6 -3
- package/svelte/leaflet.d.ts +58 -5
- package/svelte/leaflet.js +52 -21
- package/svelte/maplibregl-controller.d.ts +1 -1
- package/svelte/maplibregl-controller.js +47 -38
- package/svelte/maplibregl.d.ts +2499 -13
- package/svelte/maplibregl.js +11 -3
- package/svelte/maptilersdk.d.ts +2499 -13
- package/svelte/maptilersdk.js +11 -3
- package/svelte/openlayers-controller.d.ts +1 -1
- package/svelte/openlayers-controller.js +7 -4
- package/svelte/openlayers.d.ts +53 -1
- package/svelte/openlayers.js +66 -48
- package/svelte/react.d.ts +31 -5
- package/svelte/react.js +21 -9
- package/svelte/types.d.ts +106 -35
- package/svelte/vanilla.d.ts +46 -2
- package/svelte/vanilla.js +66 -10
- package/types.d.ts +106 -35
- package/vanilla.d.ts +46 -2
- package/vanilla.js +1260 -1057
- package/vanilla.js.map +1 -1
- package/vanilla.umd.js +1 -1
- package/vanilla.umd.js.map +1 -1
- package/icons/aerodrome.12.svg +0 -1
- package/icons/bus_stop.12.svg +0 -1
- package/icons/elevator.12.svg +0 -1
- /package/icons/{helipad.16.svg → helipad.svg} +0 -0
- /package/icons/{traffic_light.13.svg → traffic_light.svg} +0 -0
package/svelte/maptilersdk.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as maptilersdk from "@maptiler/sdk";
|
|
2
|
-
import {
|
|
2
|
+
import { crateClasses, } from "./MapLibreBasedGeocodingControl";
|
|
3
3
|
export { createMapLibreGlMapController } from "./maplibregl-controller";
|
|
4
|
-
const
|
|
4
|
+
const { MapLibreBasedGeocodingControl, events } = crateClasses(maptilersdk.Evented, maptilersdk, (map, div) => {
|
|
5
5
|
const sdkConfig = {};
|
|
6
6
|
if (!("getSdkConfig" in map && typeof map.getSdkConfig === "function")) {
|
|
7
7
|
throw new Error("MapTiler SDK not detected");
|
|
@@ -15,8 +15,16 @@ const Base = crateBaseClass(maptilersdk.Evented, maptilersdk, (map, div) => {
|
|
|
15
15
|
div.className += " maptiler-ctrl";
|
|
16
16
|
return sdkConfig;
|
|
17
17
|
});
|
|
18
|
-
export class GeocodingControl extends
|
|
18
|
+
export class GeocodingControl extends MapLibreBasedGeocodingControl {
|
|
19
19
|
onAdd(map) {
|
|
20
20
|
return super.onAddInt(map);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
export const SelectEvent = events.SelectEvent;
|
|
24
|
+
export const FeaturesListedEvent = events.FeaturesListedEvent;
|
|
25
|
+
export const FeaturesMarkedEvent = events.FeaturesMarkedEvent;
|
|
26
|
+
export const OptionsVisibilityChangeEvent = events.OptionsVisibilityChangeEvent;
|
|
27
|
+
export const PickEvent = events.PickEvent;
|
|
28
|
+
export const QueryChangeEvent = events.QueryChangeEvent;
|
|
29
|
+
export const ResponseEvent = events.ResponseEvent;
|
|
30
|
+
export const ReverseToggleEvent = events.ReverseToggleEvent;
|
|
@@ -9,7 +9,7 @@ export declare function createOpenLayersMapController(map: Map, flyToOptions?: A
|
|
|
9
9
|
fitBounds(bbox: BBox, padding: number, maxZoom: number): void;
|
|
10
10
|
indicateReverse(reverse: boolean): void;
|
|
11
11
|
setReverseMarker(coordinates?: Position): void;
|
|
12
|
-
|
|
12
|
+
setFeatures(markedFeatures: FeatureType[] | undefined, picked: FeatureType | undefined, showPolygonMarker: boolean): void;
|
|
13
13
|
setSelectedMarker(index: number): void;
|
|
14
14
|
getCenterAndZoom(): [number, x: number, y: number] | undefined;
|
|
15
15
|
};
|
|
@@ -167,7 +167,7 @@ export function createOpenLayersMapController(map, flyToOptions = {}, flyToBound
|
|
|
167
167
|
source.addFeature(reverseMarker);
|
|
168
168
|
}
|
|
169
169
|
},
|
|
170
|
-
|
|
170
|
+
setFeatures(markedFeatures, picked, showPolygonMarker) {
|
|
171
171
|
function setData(data) {
|
|
172
172
|
if (!data) {
|
|
173
173
|
return;
|
|
@@ -191,7 +191,7 @@ export function createOpenLayersMapController(map, flyToOptions = {}, flyToBound
|
|
|
191
191
|
if (reverseMarker) {
|
|
192
192
|
source.addFeature(reverseMarker);
|
|
193
193
|
}
|
|
194
|
-
if (picked) {
|
|
194
|
+
block: if (picked) {
|
|
195
195
|
let handled = false;
|
|
196
196
|
if (picked.geometry.type === "GeometryCollection") {
|
|
197
197
|
const geoms = picked.geometry.geometries
|
|
@@ -229,11 +229,14 @@ export function createOpenLayersMapController(map, flyToOptions = {}, flyToBound
|
|
|
229
229
|
}
|
|
230
230
|
else if (picked.geometry.type === "LineString") {
|
|
231
231
|
source.addFeature(new OlFeature(fromWgs84(new OlLineString(picked.geometry.coordinates))));
|
|
232
|
-
|
|
232
|
+
break block; // no pin for (multi)linestrings
|
|
233
233
|
}
|
|
234
234
|
else if (picked.geometry.type === "MultiLineString") {
|
|
235
235
|
source.addFeature(new OlFeature(fromWgs84(new OlMultiLineString(picked.geometry.coordinates))));
|
|
236
|
-
|
|
236
|
+
break block; // no pin for (multi)linestrings
|
|
237
|
+
}
|
|
238
|
+
if (!showPolygonMarker && picked.geometry.type !== "Point") {
|
|
239
|
+
break block;
|
|
237
240
|
}
|
|
238
241
|
source.addFeature(new OlFeature(fromWgs84(new OlPoint(picked.center))));
|
|
239
242
|
}
|
package/svelte/openlayers.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { Map } from "ol";
|
|
2
|
+
import type { ObjectEvent } from "ol/Object";
|
|
3
|
+
import type { CombinedOnSignature, EventTypes } from "ol/Observable";
|
|
2
4
|
import type { AnimationOptions, FitOptions } from "ol/View";
|
|
3
5
|
import { Control } from "ol/control";
|
|
4
6
|
import type { Options } from "ol/control/Control";
|
|
7
|
+
import type { EventsKey } from "ol/events";
|
|
5
8
|
import BaseEvent from "ol/events/Event";
|
|
6
9
|
import type { StyleLike } from "ol/style/Style";
|
|
7
10
|
import type { FlatStyleLike } from "ol/style/flat";
|
|
@@ -11,15 +14,64 @@ type OpenLayersControlOptions = ControlOptions & Options & {
|
|
|
11
14
|
flyTo?: boolean | (AnimationOptions & FitOptions);
|
|
12
15
|
fullGeometryStyle?: StyleLike | FlatStyleLike;
|
|
13
16
|
};
|
|
17
|
+
type CustomEventMap = {
|
|
18
|
+
select: SelectEvent;
|
|
19
|
+
featureslisted: FeaturesListedEvent;
|
|
20
|
+
featuresmarked: FeaturesMarkedEvent;
|
|
21
|
+
optionsvisibilitychange: OptionsVisibilityChangeEvent;
|
|
22
|
+
pick: PickEvent;
|
|
23
|
+
querychange: QueryChangeEvent;
|
|
24
|
+
response: ResponseEvent;
|
|
25
|
+
reversetoggle: ReverseToggleEvent;
|
|
26
|
+
};
|
|
27
|
+
type CustomObjectOnSignature<ReturnType> = {
|
|
28
|
+
<K extends keyof CustomEventMap>(type: K, listener: (evt: CustomEventMap[K]) => void): ReturnType;
|
|
29
|
+
} & {
|
|
30
|
+
(type: "propertychange", listener: (evt: ObjectEvent) => void): ReturnType;
|
|
31
|
+
} & CombinedOnSignature<EventTypes | "propertychange" | keyof CustomEventMap, ReturnType>;
|
|
14
32
|
export declare class GeocodingControl extends Control {
|
|
15
33
|
#private;
|
|
34
|
+
on: CustomObjectOnSignature<EventsKey>;
|
|
35
|
+
once: CustomObjectOnSignature<EventsKey>;
|
|
36
|
+
un: CustomObjectOnSignature<EventsKey>;
|
|
16
37
|
constructor(options: OpenLayersControlOptions);
|
|
17
38
|
setMap(map: Map | null): void;
|
|
39
|
+
/**
|
|
40
|
+
* Update the control options.
|
|
41
|
+
*
|
|
42
|
+
* @param options options to update
|
|
43
|
+
*/
|
|
18
44
|
setOptions(options: OpenLayersControlOptions): void;
|
|
45
|
+
/**
|
|
46
|
+
* Set the content of search input box.
|
|
47
|
+
*
|
|
48
|
+
* @param value text to set
|
|
49
|
+
* @param submit perform the search
|
|
50
|
+
*/
|
|
19
51
|
setQuery(value: string, submit?: boolean): void;
|
|
52
|
+
/**
|
|
53
|
+
* Clear geocoding search results from the map.
|
|
54
|
+
*/
|
|
20
55
|
clearMap(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Clear search result list.
|
|
58
|
+
*/
|
|
21
59
|
clearList(): void;
|
|
22
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Set reverse geocoding mode.
|
|
62
|
+
*
|
|
63
|
+
* @param reverseActive reverse geocoding active
|
|
64
|
+
*/
|
|
65
|
+
setReverseMode(reverseActive: boolean): void;
|
|
66
|
+
/**
|
|
67
|
+
* Focus the search input box.
|
|
68
|
+
*
|
|
69
|
+
* @param options [FocusOptions](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#options)
|
|
70
|
+
*/
|
|
71
|
+
focus(options?: FocusOptions): void;
|
|
72
|
+
/**
|
|
73
|
+
* Blur the search input box.
|
|
74
|
+
*/
|
|
23
75
|
blur(): void;
|
|
24
76
|
}
|
|
25
77
|
export declare class SelectEvent extends BaseEvent {
|
package/svelte/openlayers.js
CHANGED
|
@@ -21,45 +21,30 @@ export class GeocodingControl extends Control {
|
|
|
21
21
|
...restOptions,
|
|
22
22
|
},
|
|
23
23
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
this
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
case "pick":
|
|
49
|
-
this.dispatchEvent(new PickEvent(event.detail));
|
|
50
|
-
break;
|
|
51
|
-
case "queryChange":
|
|
52
|
-
this.dispatchEvent(new QueryChangeEvent(event.detail));
|
|
53
|
-
break;
|
|
54
|
-
case "response":
|
|
55
|
-
this.dispatchEvent(new ResponseEvent(event.detail.url, event.detail.featureCollection));
|
|
56
|
-
break;
|
|
57
|
-
case "reverseToggle":
|
|
58
|
-
this.dispatchEvent(new ReverseToggleEvent(event.detail));
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
24
|
+
this.#gc.$on("select", (event) => {
|
|
25
|
+
this.dispatchEvent(new SelectEvent(event.detail.feature));
|
|
26
|
+
});
|
|
27
|
+
this.#gc.$on("pick", (event) => {
|
|
28
|
+
this.dispatchEvent(new PickEvent(event.detail.feature));
|
|
29
|
+
});
|
|
30
|
+
this.#gc.$on("featureslisted", (event) => {
|
|
31
|
+
this.dispatchEvent(new FeaturesListedEvent(event.detail.features));
|
|
32
|
+
});
|
|
33
|
+
this.#gc.$on("featuresmarked", (event) => {
|
|
34
|
+
this.dispatchEvent(new FeaturesMarkedEvent(event.detail.features));
|
|
35
|
+
});
|
|
36
|
+
this.#gc.$on("response", (event) => {
|
|
37
|
+
this.dispatchEvent(new ResponseEvent(event.detail.url, event.detail.featureCollection));
|
|
38
|
+
});
|
|
39
|
+
this.#gc.$on("optionsvisibilitychange", (event) => {
|
|
40
|
+
this.dispatchEvent(new OptionsVisibilityChangeEvent(event.detail.optionsVisible));
|
|
41
|
+
});
|
|
42
|
+
this.#gc.$on("reversetoggle", (event) => {
|
|
43
|
+
this.dispatchEvent(new ReverseToggleEvent(event.detail.reverse));
|
|
44
|
+
});
|
|
45
|
+
this.#gc.$on("querychange", (event) => {
|
|
46
|
+
this.dispatchEvent(new QueryChangeEvent(event.detail.query));
|
|
47
|
+
});
|
|
63
48
|
this.#options = options;
|
|
64
49
|
}
|
|
65
50
|
setMap(map) {
|
|
@@ -76,26 +61,59 @@ export class GeocodingControl extends Control {
|
|
|
76
61
|
this.#gc?.$set({ mapController });
|
|
77
62
|
}
|
|
78
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Update the control options.
|
|
66
|
+
*
|
|
67
|
+
* @param options options to update
|
|
68
|
+
*/
|
|
79
69
|
setOptions(options) {
|
|
80
|
-
this.#options
|
|
70
|
+
Object.assign(this.#options, options);
|
|
81
71
|
const { flyTo, fullGeometryStyle, ...restOptions } = this.#options;
|
|
82
72
|
this.#gc?.$set({
|
|
83
73
|
...restOptions,
|
|
84
74
|
flyTo: flyTo === undefined ? true : !!flyTo,
|
|
85
75
|
});
|
|
86
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Set the content of search input box.
|
|
79
|
+
*
|
|
80
|
+
* @param value text to set
|
|
81
|
+
* @param submit perform the search
|
|
82
|
+
*/
|
|
87
83
|
setQuery(value, submit = true) {
|
|
88
84
|
this.#gc?.setQuery(value, submit);
|
|
89
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Clear geocoding search results from the map.
|
|
88
|
+
*/
|
|
90
89
|
clearMap() {
|
|
91
90
|
this.#gc?.clearMap();
|
|
92
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Clear search result list.
|
|
94
|
+
*/
|
|
93
95
|
clearList() {
|
|
94
96
|
this.#gc?.clearList();
|
|
95
97
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Set reverse geocoding mode.
|
|
100
|
+
*
|
|
101
|
+
* @param reverseActive reverse geocoding active
|
|
102
|
+
*/
|
|
103
|
+
setReverseMode(reverseActive) {
|
|
104
|
+
this.#gc?.$set({ reverseActive });
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Focus the search input box.
|
|
108
|
+
*
|
|
109
|
+
* @param options [FocusOptions](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#options)
|
|
110
|
+
*/
|
|
111
|
+
focus(options) {
|
|
112
|
+
this.#gc?.focus(options);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Blur the search input box.
|
|
116
|
+
*/
|
|
99
117
|
blur() {
|
|
100
118
|
this.#gc?.blur();
|
|
101
119
|
}
|
|
@@ -110,21 +128,21 @@ export class SelectEvent extends BaseEvent {
|
|
|
110
128
|
export class FeaturesListedEvent extends BaseEvent {
|
|
111
129
|
features;
|
|
112
130
|
constructor(features) {
|
|
113
|
-
super("
|
|
131
|
+
super("featureslisted");
|
|
114
132
|
this.features = features;
|
|
115
133
|
}
|
|
116
134
|
}
|
|
117
135
|
export class FeaturesMarkedEvent extends BaseEvent {
|
|
118
136
|
features;
|
|
119
137
|
constructor(features) {
|
|
120
|
-
super("
|
|
138
|
+
super("featuresmarked");
|
|
121
139
|
this.features = features;
|
|
122
140
|
}
|
|
123
141
|
}
|
|
124
142
|
export class OptionsVisibilityChangeEvent extends BaseEvent {
|
|
125
143
|
optionsVisible;
|
|
126
144
|
constructor(optionsVisible) {
|
|
127
|
-
super("
|
|
145
|
+
super("optionsvisibilitychange");
|
|
128
146
|
this.optionsVisible = optionsVisible;
|
|
129
147
|
}
|
|
130
148
|
}
|
|
@@ -138,7 +156,7 @@ export class PickEvent extends BaseEvent {
|
|
|
138
156
|
export class QueryChangeEvent extends BaseEvent {
|
|
139
157
|
query;
|
|
140
158
|
constructor(query) {
|
|
141
|
-
super("
|
|
159
|
+
super("querychange");
|
|
142
160
|
this.query = query;
|
|
143
161
|
}
|
|
144
162
|
}
|
|
@@ -154,7 +172,7 @@ export class ResponseEvent extends BaseEvent {
|
|
|
154
172
|
export class ReverseToggleEvent extends BaseEvent {
|
|
155
173
|
reverse;
|
|
156
174
|
constructor(reverse) {
|
|
157
|
-
super("
|
|
175
|
+
super("reversetoggle");
|
|
158
176
|
this.reverse = reverse;
|
|
159
177
|
}
|
|
160
178
|
}
|
package/svelte/react.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ControlOptions,
|
|
2
|
-
type EventNames = keyof
|
|
1
|
+
import type { ControlOptions, DispatcherTypeCC, MapController } from "./types";
|
|
2
|
+
type EventNames = keyof DispatcherTypeCC;
|
|
3
3
|
type EventHandlerFnName<T extends EventNames> = `on${Capitalize<T>}`;
|
|
4
4
|
type CallbackProperties<T> = {
|
|
5
5
|
[K in keyof T as EventHandlerFnName<Extract<K, EventNames>>]?: (event: T[K]) => void;
|
|
@@ -7,13 +7,39 @@ type CallbackProperties<T> = {
|
|
|
7
7
|
type MapControllerProp = {
|
|
8
8
|
mapController?: MapController;
|
|
9
9
|
};
|
|
10
|
-
export type Props = ControlOptions & CallbackProperties<
|
|
10
|
+
export type Props = ControlOptions & CallbackProperties<DispatcherTypeCC> & MapControllerProp;
|
|
11
11
|
export type Methods = {
|
|
12
|
+
/**
|
|
13
|
+
* Blur the search input box.
|
|
14
|
+
*/
|
|
12
15
|
blur(): void;
|
|
13
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Focus the search input box.
|
|
18
|
+
*
|
|
19
|
+
* @param options [FocusOptions](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#options)
|
|
20
|
+
*/
|
|
21
|
+
focus(options?: FocusOptions): void;
|
|
22
|
+
/**
|
|
23
|
+
* Set the content of search input box.
|
|
24
|
+
*
|
|
25
|
+
* @param value text to set
|
|
26
|
+
* @param submit perform the search
|
|
27
|
+
*/
|
|
14
28
|
setQuery(value: string, submit?: boolean): void;
|
|
29
|
+
/**
|
|
30
|
+
* Clear geocoding search results from the map.
|
|
31
|
+
*/
|
|
15
32
|
clearMap(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Clear search result list.
|
|
35
|
+
*/
|
|
16
36
|
clearList(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Set reverse geocoding mode.
|
|
39
|
+
*
|
|
40
|
+
* @param reverseActive reverse geocoding active
|
|
41
|
+
*/
|
|
42
|
+
setReverseMode(reverseActive: boolean): void;
|
|
17
43
|
};
|
|
18
|
-
declare const ReactGeocodingControl: import("react").ForwardRefExoticComponent<ControlOptions & CallbackProperties<
|
|
44
|
+
declare const ReactGeocodingControl: import("react").ForwardRefExoticComponent<ControlOptions & CallbackProperties<DispatcherTypeCC> & MapControllerProp & import("react").RefAttributes<Methods>>;
|
|
19
45
|
export { ReactGeocodingControl as GeocodingControl };
|
package/svelte/react.js
CHANGED
|
@@ -11,33 +11,44 @@ const eventNames = [
|
|
|
11
11
|
"select",
|
|
12
12
|
];
|
|
13
13
|
const propertyNames = [
|
|
14
|
+
"adjustUrlQuery",
|
|
15
|
+
"adjustUrl",
|
|
14
16
|
"apiKey",
|
|
17
|
+
"apiUrl",
|
|
15
18
|
"bbox",
|
|
19
|
+
"class",
|
|
16
20
|
"clearButtonTitle",
|
|
21
|
+
"clearListOnPick",
|
|
17
22
|
"clearOnBlur",
|
|
18
23
|
"collapsed",
|
|
19
24
|
"country",
|
|
20
25
|
"debounceSearch",
|
|
21
26
|
"enableReverse",
|
|
22
|
-
"reverseActive",
|
|
23
27
|
"errorMessage",
|
|
28
|
+
"excludeTypes",
|
|
29
|
+
"exhaustiveReverseGeocoding",
|
|
30
|
+
"fetchParameters",
|
|
24
31
|
"filter",
|
|
32
|
+
"flyToSelected",
|
|
25
33
|
"fuzzyMatch",
|
|
34
|
+
"iconsBaseUrl",
|
|
35
|
+
"keepListOpen",
|
|
26
36
|
"language",
|
|
27
37
|
"limit",
|
|
38
|
+
"mapController",
|
|
39
|
+
"markerOnSelected",
|
|
28
40
|
"minLength",
|
|
29
41
|
"noResultsMessage",
|
|
42
|
+
"pickedResultStyle",
|
|
30
43
|
"placeholder",
|
|
31
44
|
"proximity",
|
|
45
|
+
"reverseActive",
|
|
32
46
|
"reverseButtonTitle",
|
|
33
|
-
"
|
|
47
|
+
"selectFirst",
|
|
34
48
|
"showPlaceType",
|
|
35
49
|
"showResultsWhileTyping",
|
|
36
|
-
"adjustUrlQuery",
|
|
37
50
|
"types",
|
|
38
|
-
"excludeTypes",
|
|
39
51
|
"zoom",
|
|
40
|
-
"mapController",
|
|
41
52
|
];
|
|
42
53
|
function getEventFnName(name) {
|
|
43
54
|
return ("on" +
|
|
@@ -45,8 +56,8 @@ function getEventFnName(name) {
|
|
|
45
56
|
name.slice(1));
|
|
46
57
|
}
|
|
47
58
|
const ReactGeocodingControl = forwardRef(function ReactGeocodingControl(props, ref) {
|
|
48
|
-
const divRef = useRef();
|
|
49
|
-
const controlRef = useRef();
|
|
59
|
+
const divRef = useRef(undefined);
|
|
60
|
+
const controlRef = useRef(undefined);
|
|
50
61
|
const options = { ...props };
|
|
51
62
|
for (const eventName of eventNames) {
|
|
52
63
|
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
@@ -75,7 +86,7 @@ const ReactGeocodingControl = forwardRef(function ReactGeocodingControl(props, r
|
|
|
75
86
|
for (const eventName of eventNames) {
|
|
76
87
|
const eventHandlerFn = props[getEventFnName(eventName)];
|
|
77
88
|
useEffect(() => eventHandlerFn &&
|
|
78
|
-
controlRef.current?.$on(eventName, (e) => {
|
|
89
|
+
controlRef.current?.$on(eventName.toLowerCase(), (e) => {
|
|
79
90
|
eventHandlerFn(e.detail);
|
|
80
91
|
}), [eventHandlerFn]);
|
|
81
92
|
}
|
|
@@ -83,8 +94,9 @@ const ReactGeocodingControl = forwardRef(function ReactGeocodingControl(props, r
|
|
|
83
94
|
setQuery: (value, submit = true) => controlRef.current?.setQuery(value, submit),
|
|
84
95
|
clearMap: () => controlRef.current?.clearMap(),
|
|
85
96
|
clearList: () => controlRef.current?.clearList(),
|
|
86
|
-
focus: () => controlRef.current?.focus(),
|
|
97
|
+
focus: (options) => controlRef.current?.focus(options),
|
|
87
98
|
blur: () => controlRef.current?.blur(),
|
|
99
|
+
setReverseMode: (reverseActive) => controlRef.current?.$set({ reverseActive }),
|
|
88
100
|
}));
|
|
89
101
|
return createElement("div", { ref: divRef });
|
|
90
102
|
});
|