@spuermomonga/vue3-bmapgl 0.0.12 → 0.0.14
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/dist/index.js +241 -1
- package/dist/index.prod.js +1 -1
- package/es/_utils/call.d.ts +1 -0
- package/es/_utils/call.mjs.map +1 -1
- package/es/_utils/index.mjs +1 -1
- package/es/_utils/map.d.ts +1 -0
- package/es/_utils/map.mjs +16 -1
- package/es/_utils/map.mjs.map +1 -1
- package/es/components.d.ts +3 -0
- package/es/components.mjs +6 -0
- package/es/components.mjs.map +1 -1
- package/es/control/custom/index.d.ts +3 -0
- package/es/control/custom/index.mjs +3 -0
- package/es/control/custom/index.mjs.map +1 -0
- package/es/control/custom/src/custom-props.d.ts +23 -0
- package/es/control/custom/src/custom-props.mjs +17 -0
- package/es/control/custom/src/custom-props.mjs.map +1 -0
- package/es/control/custom/src/custom.d.ts +47 -0
- package/es/control/custom/src/custom.mjs +49 -0
- package/es/control/custom/src/custom.mjs.map +1 -0
- package/es/control/scale/index.d.ts +1 -0
- package/es/control/scale/index.mjs +1 -1
- package/es/control/zoom/index.d.ts +1 -0
- package/es/control/zoom/index.mjs +1 -1
- package/es/index.mjs +6 -0
- package/es/index.mjs.map +1 -1
- package/es/layer/xyz/src/xyz.d.ts +2 -2
- package/es/map/src/map-props.d.ts +4 -1
- package/es/map/src/map-props.mjs +4 -1
- package/es/map/src/map-props.mjs.map +1 -1
- package/es/map/src/map.d.ts +6 -0
- package/es/map/src/map.mjs +4 -0
- package/es/map/src/map.mjs.map +1 -1
- package/es/overlay/info-window/index.d.ts +3 -0
- package/es/overlay/info-window/index.mjs +2 -1
- package/es/overlay/info-window/index.mjs.map +1 -1
- package/es/overlay/info-window/src/info-window-props.d.ts +35 -0
- package/es/overlay/info-window/src/info-window-props.mjs +29 -0
- package/es/overlay/info-window/src/info-window-props.mjs.map +1 -0
- package/es/overlay/info-window/src/info-window.d.ts +74 -0
- package/es/overlay/info-window/src/info-window.mjs +132 -0
- package/es/overlay/info-window/src/info-window.mjs.map +1 -0
- package/es/overlay/label/index.d.ts +1 -0
- package/es/overlay/label/index.mjs +1 -1
- package/es/overlay/label/src/label-props.mjs +2 -0
- package/es/overlay/label/src/label-props.mjs.map +1 -0
- package/es/overlay/label/src/label.d.ts +2 -0
- package/es/overlay/label/src/label.mjs +11 -0
- package/es/overlay/label/src/label.mjs.map +1 -0
- package/es/overlay/marker/index.d.ts +3 -0
- package/es/overlay/marker/index.mjs +2 -1
- package/es/overlay/marker/index.mjs.map +1 -1
- package/es/overlay/marker/src/marker-props.d.ts +8 -0
- package/es/overlay/marker/src/marker-props.mjs +9 -0
- package/es/overlay/marker/src/marker-props.mjs.map +1 -0
- package/es/overlay/marker/src/marker.d.ts +14 -0
- package/es/overlay/marker/src/marker.mjs +13 -0
- package/es/overlay/marker/src/marker.mjs.map +1 -0
- package/lib/_utils/call.d.ts +1 -0
- package/lib/_utils/call.js.map +1 -1
- package/lib/_utils/index.js +1 -0
- package/lib/_utils/index.js.map +1 -1
- package/lib/_utils/map.d.ts +1 -0
- package/lib/_utils/map.js +16 -0
- package/lib/_utils/map.js.map +1 -1
- package/lib/components.d.ts +3 -0
- package/lib/components.js +12 -0
- package/lib/components.js.map +1 -1
- package/lib/control/custom/index.d.ts +3 -0
- package/lib/control/custom/index.js +10 -0
- package/lib/control/custom/index.js.map +1 -0
- package/lib/control/custom/src/custom-props.d.ts +23 -0
- package/lib/control/custom/src/custom-props.js +19 -0
- package/lib/control/custom/src/custom-props.js.map +1 -0
- package/lib/control/custom/src/custom.d.ts +47 -0
- package/lib/control/custom/src/custom.js +51 -0
- package/lib/control/custom/src/custom.js.map +1 -0
- package/lib/control/scale/index.d.ts +1 -0
- package/lib/control/scale/index.js +5 -0
- package/lib/control/scale/index.js.map +1 -1
- package/lib/control/zoom/index.d.ts +1 -0
- package/lib/control/zoom/index.js +5 -0
- package/lib/control/zoom/index.js.map +1 -1
- package/lib/index.js +12 -0
- package/lib/index.js.map +1 -1
- package/lib/layer/xyz/src/xyz.d.ts +2 -2
- package/lib/map/src/map-props.d.ts +4 -1
- package/lib/map/src/map-props.js +4 -1
- package/lib/map/src/map-props.js.map +1 -1
- package/lib/map/src/map.d.ts +6 -0
- package/lib/map/src/map.js +4 -0
- package/lib/map/src/map.js.map +1 -1
- package/lib/overlay/info-window/index.d.ts +3 -0
- package/lib/overlay/info-window/index.js +7 -0
- package/lib/overlay/info-window/index.js.map +1 -1
- package/lib/overlay/info-window/src/info-window-props.d.ts +35 -0
- package/lib/overlay/info-window/src/info-window-props.js +31 -0
- package/lib/overlay/info-window/src/info-window-props.js.map +1 -0
- package/lib/overlay/info-window/src/info-window.d.ts +74 -0
- package/lib/overlay/info-window/src/info-window.js +134 -0
- package/lib/overlay/info-window/src/info-window.js.map +1 -0
- package/lib/overlay/label/index.d.ts +1 -0
- package/lib/overlay/label/index.js +5 -0
- package/lib/overlay/label/index.js.map +1 -1
- package/lib/overlay/label/src/label-props.js +3 -0
- package/lib/overlay/label/src/label-props.js.map +1 -0
- package/lib/overlay/label/src/label.d.ts +2 -0
- package/lib/overlay/label/src/label.js +13 -0
- package/lib/overlay/label/src/label.js.map +1 -0
- package/lib/overlay/marker/index.d.ts +3 -0
- package/lib/overlay/marker/index.js +7 -0
- package/lib/overlay/marker/index.js.map +1 -1
- package/lib/overlay/marker/src/marker-props.d.ts +8 -0
- package/lib/overlay/marker/src/marker-props.js +11 -0
- package/lib/overlay/marker/src/marker-props.js.map +1 -0
- package/lib/overlay/marker/src/marker.d.ts +14 -0
- package/lib/overlay/marker/src/marker.js +15 -0
- package/lib/overlay/marker/src/marker.js.map +1 -0
- package/package.json +1 -1
- package/es/_virtual/_plugin-vue_export-helper.mjs +0 -10
- package/es/_virtual/_plugin-vue_export-helper.mjs.map +0 -1
- package/es/overlay/info-window/src/InfoWindow.vue.mjs +0 -11
- package/es/overlay/info-window/src/InfoWindow.vue.mjs.map +0 -1
- package/es/overlay/label/src/Label.vue.mjs +0 -11
- package/es/overlay/label/src/Label.vue.mjs.map +0 -1
- package/es/overlay/marker/src/Marker.vue.mjs +0 -11
- package/es/overlay/marker/src/Marker.vue.mjs.map +0 -1
- package/lib/_virtual/_plugin-vue_export-helper.js +0 -12
- package/lib/_virtual/_plugin-vue_export-helper.js.map +0 -1
- package/lib/overlay/info-window/src/InfoWindow.vue.js +0 -13
- package/lib/overlay/info-window/src/InfoWindow.vue.js.map +0 -1
- package/lib/overlay/label/src/Label.vue.js +0 -13
- package/lib/overlay/label/src/Label.vue.js.map +0 -1
- package/lib/overlay/marker/src/Marker.vue.js +0 -13
- package/lib/overlay/marker/src/Marker.vue.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -63,6 +63,20 @@
|
|
|
63
63
|
}
|
|
64
64
|
return points;
|
|
65
65
|
}
|
|
66
|
+
function setupMapEvents(map, props) {
|
|
67
|
+
const cleanup = Object.keys(props).filter((key) => key.startsWith("on") && typeof props[key] === "function").map((propName) => {
|
|
68
|
+
const eventName = propName.slice(2).toLowerCase();
|
|
69
|
+
const handler = props[propName];
|
|
70
|
+
const wrapper = (e) => {
|
|
71
|
+
e.preventDefault?.() || e.domEvent?.preventDefault?.();
|
|
72
|
+
e.stopPropagation?.() || e.domEvent?.stopPropagation?.();
|
|
73
|
+
handler(e);
|
|
74
|
+
};
|
|
75
|
+
map.addEventListener(eventName, wrapper);
|
|
76
|
+
return () => map.removeEventListener(eventName, wrapper);
|
|
77
|
+
});
|
|
78
|
+
return () => cleanup.forEach((fn) => fn());
|
|
79
|
+
}
|
|
66
80
|
|
|
67
81
|
function ensureValidVNode(vnodes) {
|
|
68
82
|
return vnodes.some((child) => {
|
|
@@ -182,7 +196,10 @@
|
|
|
182
196
|
default: void 0
|
|
183
197
|
},
|
|
184
198
|
displayOptions: Object,
|
|
185
|
-
onInitd: Function
|
|
199
|
+
onInitd: Function,
|
|
200
|
+
onClick: Function,
|
|
201
|
+
onDblclick: Function,
|
|
202
|
+
onMousemove: Function
|
|
186
203
|
};
|
|
187
204
|
|
|
188
205
|
function styleInject(css, ref) {
|
|
@@ -229,6 +246,7 @@
|
|
|
229
246
|
} = useConfig(props);
|
|
230
247
|
const contentRef = vue.ref();
|
|
231
248
|
let map = null;
|
|
249
|
+
let cleanup;
|
|
232
250
|
const initd = vue.ref(false);
|
|
233
251
|
vue.provide(mapInjectionKey, {
|
|
234
252
|
mapInstance: () => map
|
|
@@ -316,6 +334,7 @@
|
|
|
316
334
|
onInitd?.({
|
|
317
335
|
map
|
|
318
336
|
});
|
|
337
|
+
cleanup = setupMapEvents(map, props);
|
|
319
338
|
initd.value = true;
|
|
320
339
|
};
|
|
321
340
|
vue.onMounted(() => {
|
|
@@ -328,6 +347,7 @@
|
|
|
328
347
|
vue.onUnmounted(() => {
|
|
329
348
|
if (map) {
|
|
330
349
|
try {
|
|
350
|
+
cleanup?.();
|
|
331
351
|
map?.destroy();
|
|
332
352
|
} catch (error) {
|
|
333
353
|
console.error(`[Vue3 BMapGL]: ${error.message}`);
|
|
@@ -352,6 +372,61 @@
|
|
|
352
372
|
return BMap.mapInstance;
|
|
353
373
|
}
|
|
354
374
|
|
|
375
|
+
const customControlProps = {
|
|
376
|
+
anchor: {
|
|
377
|
+
type: String,
|
|
378
|
+
default: "BMAP_ANCHOR_TOP_RIGHT"
|
|
379
|
+
},
|
|
380
|
+
offset: {
|
|
381
|
+
type: Object,
|
|
382
|
+
default: { x: 0, y: 0 }
|
|
383
|
+
},
|
|
384
|
+
visible: {
|
|
385
|
+
type: Boolean,
|
|
386
|
+
default: true
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
var custom = /* @__PURE__ */ vue.defineComponent({
|
|
391
|
+
name: "CustomControl",
|
|
392
|
+
props: customControlProps,
|
|
393
|
+
setup(props, {
|
|
394
|
+
attrs,
|
|
395
|
+
slots
|
|
396
|
+
}) {
|
|
397
|
+
const mapInstance = useMapInstance();
|
|
398
|
+
const controlContentRef = vue.ref();
|
|
399
|
+
let control = null;
|
|
400
|
+
vue.onMounted(() => {
|
|
401
|
+
const {
|
|
402
|
+
offset,
|
|
403
|
+
anchor,
|
|
404
|
+
visible
|
|
405
|
+
} = props;
|
|
406
|
+
control = new BMapGL.Control();
|
|
407
|
+
control.defaultAnchor = window[anchor];
|
|
408
|
+
control.defaultOffset = new BMapGL.Size(offset.x, offset.y);
|
|
409
|
+
control.initialize = (_map) => {
|
|
410
|
+
return _map.getContainer().appendChild(controlContentRef.value);
|
|
411
|
+
};
|
|
412
|
+
visible && mapInstance().addControl(control);
|
|
413
|
+
vue.watch(() => props.visible, (n) => {
|
|
414
|
+
if (control) mapInstance()[n ? "addControl" : "removeControl"](control);
|
|
415
|
+
});
|
|
416
|
+
});
|
|
417
|
+
vue.onUnmounted(() => {
|
|
418
|
+
if (control) {
|
|
419
|
+
mapInstance().removeControl(control);
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
return () => vue.createVNode("div", {
|
|
423
|
+
"style": "display: none"
|
|
424
|
+
}, [vue.withDirectives(vue.createVNode("div", {
|
|
425
|
+
"ref": controlContentRef
|
|
426
|
+
}, [slots.default?.()]), [[vue.resolveDirective("bind"), attrs]])]);
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
|
|
355
430
|
const tileLayerProps = {
|
|
356
431
|
visible: {
|
|
357
432
|
type: Boolean,
|
|
@@ -765,6 +840,165 @@
|
|
|
765
840
|
}
|
|
766
841
|
});
|
|
767
842
|
|
|
843
|
+
const infoWindowProps = {
|
|
844
|
+
"show": Boolean,
|
|
845
|
+
"offset": {
|
|
846
|
+
type: Object,
|
|
847
|
+
default: { x: 0, y: 0 }
|
|
848
|
+
},
|
|
849
|
+
"width": {
|
|
850
|
+
type: Number,
|
|
851
|
+
default: 0
|
|
852
|
+
},
|
|
853
|
+
"height": {
|
|
854
|
+
type: Number,
|
|
855
|
+
default: 0
|
|
856
|
+
},
|
|
857
|
+
"maxWidth": Number,
|
|
858
|
+
"position": Object,
|
|
859
|
+
"enableAutoPan": {
|
|
860
|
+
type: Boolean,
|
|
861
|
+
default: true
|
|
862
|
+
},
|
|
863
|
+
"enableCloseOnClick": {
|
|
864
|
+
type: Boolean,
|
|
865
|
+
default: true
|
|
866
|
+
},
|
|
867
|
+
"onUpdate:show": Function
|
|
868
|
+
};
|
|
869
|
+
|
|
870
|
+
var infoWindow = /* @__PURE__ */ vue.defineComponent({
|
|
871
|
+
name: "InfoWindow",
|
|
872
|
+
props: infoWindowProps,
|
|
873
|
+
setup(props, {
|
|
874
|
+
slots,
|
|
875
|
+
attrs
|
|
876
|
+
}) {
|
|
877
|
+
const mapInstance = useMapInstance();
|
|
878
|
+
const infoWindowContentRef = vue.ref();
|
|
879
|
+
let infoWindow = null;
|
|
880
|
+
const visible = vue.computed({
|
|
881
|
+
get: () => props.show,
|
|
882
|
+
set: (value) => props["onUpdate:show"]?.(value)
|
|
883
|
+
});
|
|
884
|
+
const openInfoWindow = () => {
|
|
885
|
+
const {
|
|
886
|
+
position
|
|
887
|
+
} = props;
|
|
888
|
+
if (!position || !infoWindow) return;
|
|
889
|
+
const point = Array.isArray(position) ? new BMapGL.Point(position[0], position[1]) : position;
|
|
890
|
+
mapInstance().openInfoWindow(infoWindow, point);
|
|
891
|
+
visible.value = true;
|
|
892
|
+
};
|
|
893
|
+
const closeInfoWindow = () => {
|
|
894
|
+
if (!infoWindow) return;
|
|
895
|
+
infoWindow?.hide?.();
|
|
896
|
+
visible.value = false;
|
|
897
|
+
};
|
|
898
|
+
const setPosition = (position) => {
|
|
899
|
+
openInfoWindow();
|
|
900
|
+
const point = Array.isArray(position) ? new BMapGL.Point(position[0], position[1]) : position;
|
|
901
|
+
infoWindow?.setPosition(point);
|
|
902
|
+
if (!visible.value) closeInfoWindow();
|
|
903
|
+
};
|
|
904
|
+
const redraw = () => {
|
|
905
|
+
infoWindow?.redraw();
|
|
906
|
+
Array.prototype.forEach.call(infoWindowContentRef.value?.querySelectorAll("img") ?? [], (imgEl) => {
|
|
907
|
+
imgEl.onload = () => {
|
|
908
|
+
infoWindow?.redraw();
|
|
909
|
+
};
|
|
910
|
+
});
|
|
911
|
+
};
|
|
912
|
+
const setContent = (content) => {
|
|
913
|
+
infoWindow?.setContent(content);
|
|
914
|
+
};
|
|
915
|
+
const setWidth = (width) => {
|
|
916
|
+
infoWindow?.setWidth(width);
|
|
917
|
+
};
|
|
918
|
+
const setHeight = (height) => {
|
|
919
|
+
infoWindow?.setHeight(height);
|
|
920
|
+
};
|
|
921
|
+
const startWatchProps = () => {
|
|
922
|
+
vue.watch(() => props.position, setPosition, {
|
|
923
|
+
deep: true
|
|
924
|
+
});
|
|
925
|
+
vue.watch(() => props.width, setWidth);
|
|
926
|
+
vue.watch(() => props.height, setHeight);
|
|
927
|
+
vue.watch(() => props.show, () => props.show ? openInfoWindow() : closeInfoWindow());
|
|
928
|
+
};
|
|
929
|
+
vue.onMounted(() => {
|
|
930
|
+
const {
|
|
931
|
+
width,
|
|
932
|
+
height,
|
|
933
|
+
maxWidth,
|
|
934
|
+
offset,
|
|
935
|
+
enableAutoPan,
|
|
936
|
+
enableCloseOnClick
|
|
937
|
+
} = props;
|
|
938
|
+
infoWindow = new BMapGL.InfoWindow(infoWindowContentRef.value, {
|
|
939
|
+
width,
|
|
940
|
+
height,
|
|
941
|
+
maxWidth,
|
|
942
|
+
offset: new BMapGL.Size(offset.x, offset.y),
|
|
943
|
+
enableAutoPan,
|
|
944
|
+
enableCloseOnClick
|
|
945
|
+
});
|
|
946
|
+
infoWindow.addEventListener("close", () => {
|
|
947
|
+
if (props.show) visible.value = false;
|
|
948
|
+
});
|
|
949
|
+
infoWindow.addEventListener("open", () => {
|
|
950
|
+
if (!props.show) visible.value = true;
|
|
951
|
+
});
|
|
952
|
+
mapInstance().addOverlay(infoWindow);
|
|
953
|
+
redraw();
|
|
954
|
+
if (props.show) {
|
|
955
|
+
vue.nextTick(() => {
|
|
956
|
+
openInfoWindow();
|
|
957
|
+
vue.nextTick(() => {
|
|
958
|
+
if (infoWindow && "_visible" in infoWindow) {
|
|
959
|
+
!infoWindow._visible && (visible.value = false);
|
|
960
|
+
} else {
|
|
961
|
+
!infoWindow?.isOpen() && (visible.value = false);
|
|
962
|
+
}
|
|
963
|
+
});
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
startWatchProps();
|
|
967
|
+
});
|
|
968
|
+
vue.onUpdated(() => {
|
|
969
|
+
if (infoWindow && infoWindow.isOpen()) {
|
|
970
|
+
setContent(infoWindowContentRef.value ?? "");
|
|
971
|
+
}
|
|
972
|
+
});
|
|
973
|
+
vue.onUnmounted(() => {
|
|
974
|
+
if (infoWindow) {
|
|
975
|
+
mapInstance().removeOverlay(infoWindow);
|
|
976
|
+
redraw();
|
|
977
|
+
}
|
|
978
|
+
});
|
|
979
|
+
return () => vue.createVNode("div", {
|
|
980
|
+
"style": "display: none"
|
|
981
|
+
}, [vue.withDirectives(vue.createVNode("div", {
|
|
982
|
+
"ref": infoWindowContentRef
|
|
983
|
+
}, [slots.default?.()]), [[vue.resolveDirective("bind"), attrs]])]);
|
|
984
|
+
}
|
|
985
|
+
});
|
|
986
|
+
|
|
987
|
+
const markerProps = {
|
|
988
|
+
visible: {
|
|
989
|
+
type: Boolean,
|
|
990
|
+
default: true
|
|
991
|
+
}
|
|
992
|
+
};
|
|
993
|
+
|
|
994
|
+
var marker = /* @__PURE__ */ vue.defineComponent({
|
|
995
|
+
name: "Marker",
|
|
996
|
+
props: markerProps,
|
|
997
|
+
setup() {
|
|
998
|
+
return () => vue.createVNode(vue.Fragment, null, null);
|
|
999
|
+
}
|
|
1000
|
+
});
|
|
1001
|
+
|
|
768
1002
|
const polygonProps = {
|
|
769
1003
|
visible: {
|
|
770
1004
|
type: Boolean,
|
|
@@ -912,7 +1146,10 @@
|
|
|
912
1146
|
}
|
|
913
1147
|
|
|
914
1148
|
exports.BConfigProvider = configProvider;
|
|
1149
|
+
exports.BCustomControl = custom;
|
|
1150
|
+
exports.BInfoWindow = infoWindow;
|
|
915
1151
|
exports.BMap = map;
|
|
1152
|
+
exports.BMarker = marker;
|
|
916
1153
|
exports.BPolygon = polygon;
|
|
917
1154
|
exports.BSector = sector;
|
|
918
1155
|
exports.BTileLayer = tile;
|
|
@@ -920,8 +1157,11 @@
|
|
|
920
1157
|
exports.configProviderInjectionKey = configProviderInjectionKey;
|
|
921
1158
|
exports.configProviderProps = configProviderProps;
|
|
922
1159
|
exports.create = create;
|
|
1160
|
+
exports.customControlProps = customControlProps;
|
|
1161
|
+
exports.infoWindowProps = infoWindowProps;
|
|
923
1162
|
exports.mapInjectionKey = mapInjectionKey;
|
|
924
1163
|
exports.mapProps = mapProps;
|
|
1164
|
+
exports.markerProps = markerProps;
|
|
925
1165
|
exports.polygonProps = polygonProps;
|
|
926
1166
|
exports.tileLayerProps = tileLayerProps;
|
|
927
1167
|
exports.xyzLayerProps = xyzLayerProps;
|
package/dist/index.prod.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Vue3Bmapgl={},e.vue)}(this,function(e,t){"use strict";let o=!1;function a(e){return e.some(e=>!t.isVNode(e)||e.type!==Comment&&!(e.type===t.Fragment&&!a(e.children)))?e:null}function n(e,t){return t(e&&a(e())||null)}const l={ak:String,apiUrl:String,plugins:Array,mapConfig:Object},r=Symbol("b-config-provider");var i=t.defineComponent({name:"ConfigProvider",props:l,setup(e,{slots:a}){const n=t.ref("notload"),l=e.apiUrl?"_initBMap_":`_initBMap_${e.ak}`,i=e.apiUrl?`${e.apiUrl.replace(/&$/,"")}&callback=${l}`:`//api.map.baidu.com/api?type=webgl&v=1.0&ak=${e.ak}&callback=${l}`;n.value="pending",function(e){const{key:t,src:a,addCalToWindow:n=!0,timeout:l=1e4}=e;return o&&window.BMapGL?Promise.resolve():new Promise((e,r)=>{const i=document.createElement("script");i.src=a,i.type="text/javascript",i.defer=!0;const s=()=>{i.onload=null,i.onerror=null,document.body.contains(i)&&document.body.removeChild(i)},p=setTimeout(()=>{s(),r(new Error(`Script load timeout: ${a}`))},l),d=()=>{clearTimeout(p),o=!0,s(),e()};n?window[t]=d:i.onload=d,i.onerror=()=>{clearTimeout(p),s(),r(new Error(`Failed to load script: ${a}`))},document.body.appendChild(i)})}({key:l,src:i}).then(()=>{n.value="loaded"}).catch(()=>{n.value="failed"});const s=t.computed(()=>{const{mapConfig:t}=e;return t??{}});return t.provide(r,{mergedStatusRef:n,mergedMapSetRef:s}),()=>t.renderSlot(a,"default")}});const s=Symbol("b-map"),p={maxZoom:Number,minZoom:Number,heading:Number,center:Object,zoom:Number,class:String,contentClass:String,enableScrollWheelZoom:{type:Boolean,default:void 0},enableDragging:{type:Boolean,default:void 0},tilt:Number,enableTilt:{type:Boolean,default:void 0},mapType:String,enableAutoResize:{type:Boolean,default:void 0},enableTiltGestures:{type:Boolean,default:void 0},enableRotate:{type:Boolean,default:void 0},enableRotateGestures:{type:Boolean,default:void 0},displayOptions:Object,onInitd:Function};var d="map-module_b-map__29r3m",m="map-module_b-map-content__sMaJG",u="map-module_b-map-loading__qc4a8",c="map-module_b-map-failed__-w-tX";!function(e,t){void 0===t&&(t={});var o=t.insertAt;if("undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===o&&a.firstChild?a.insertBefore(n,a.firstChild):a.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}(".map-module_b-map-content__sMaJG,.map-module_b-map__29r3m{height:100%;overflow:hidden;position:relative;width:100%}.map-module_b-map-failed__-w-tX,.map-module_b-map-loading__qc4a8{color:#999;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}");var y=t.defineComponent({name:"Map",props:p,slots:Object,setup(e,{slots:o}){const{mergedMapSetRef:a,mergedStatusRef:l}=function(e={}){const o=t.inject(r,null);return{mergedStatusRef:o?.mergedStatusRef,mergedMapSetRef:t.computed(()=>{const{zoom:t,center:a,heading:n,minZoom:l,maxZoom:r,enableScrollWheelZoom:i,enableDragging:s,tilt:p,enableTilt:d,mapType:m,enableAutoResize:u,enableTiltGestures:c,enableRotate:y,enableRotateGestures:f,displayOptions:g}=e;return{zoom:t??o?.mergedMapSetRef.value?.zoom??14,center:a??o?.mergedMapSetRef.value?.center??[116.403901,39.915185],heading:n??o?.mergedMapSetRef.value?.heading??0,minZoom:l??o?.mergedMapSetRef.value?.minZoom??0,maxZoom:r??o?.mergedMapSetRef.value?.maxZoom??21,enableScrollWheelZoom:i??o?.mergedMapSetRef.value?.enableScrollWheelZoom??!1,enableDragging:s??o?.mergedMapSetRef.value?.enableDragging??!0,tilt:p??o?.mergedMapSetRef.value?.tilt??0,enableTilt:d??o?.mergedMapSetRef.value?.enableTilt??!1,mapType:m??o?.mergedMapSetRef.value?.mapType??"BMAP_NORMAL_MAP",enableAutoResize:u??o?.mergedMapSetRef.value?.enableAutoResize??!0,enableTiltGestures:c??o?.mergedMapSetRef.value?.enableTiltGestures??!1,enableRotate:y??o?.mergedMapSetRef.value?.enableRotate??!1,enableRotateGestures:f??o?.mergedMapSetRef.value?.enableRotateGestures??!1,displayOptions:g??o?.mergedMapSetRef.value?.displayOptions}})}}(e),i=t.ref();let p=null;const y=t.ref(!1);t.provide(s,{mapInstance:()=>p});const f=e=>{"string"==typeof e?p?.centerAndZoom(e,a.value.zoom):Array.isArray(e)?p?.centerAndZoom(new BMapGL.Point(e[0],e[1]),a.value.zoom):p?.centerAndZoom(e,a.value.zoom)},g=e=>{e?p.enableScrollWheelZoom():p.disableScrollWheelZoom()},b=e=>{p?.setDisplayOptions(e||{})},T=e=>{p?.setTilt(e??0)},v=e=>{p?.setHeading(e??0)},h=e=>{e?p.enableDragging():p.disableDragging()},S=e=>{void 0!==window[e]&&p.setMapType(window[e])},R=()=>{const{maxZoom:o,minZoom:n,enableTilt:l,mapType:r,enableAutoResize:s,enableTiltGestures:d,enableRotate:m,enableRotateGestures:u,displayOptions:c}=a.value;p=new BMapGL.Map(i.value,{maxZoom:o,minZoom:n,enableTilt:l,mapType:window[r],enableAutoResize:s,enableTiltGestures:d,enableRotate:m,enableRotateGestures:u,displayOptions:c});const{onInitd:R}=e;(()=>{const{center:e,heading:t,enableScrollWheelZoom:o,tilt:n,enableDragging:l}=a.value;v(t),f(e),g(o),T(n),h(l)})(),t.watch(()=>a.value.center,f,{deep:!0}),t.watch(()=>a.value.enableScrollWheelZoom,g),t.watch(()=>a.value.displayOptions,b),t.watch(()=>a.value.tilt,T),t.watch(()=>a.value.heading,v),t.watch(()=>a.value.enableDragging,h),t.watch(()=>a.value.mapType,S),R?.({map:p}),y.value=!0};return t.onMounted(()=>{t.watchEffect(()=>{"loaded"!==l?.value||y.value||t.nextTick(R)})}),t.onUnmounted(()=>{if(p)try{p?.destroy()}catch(e){console.error(`[Vue3 BMapGL]: ${e.message}`)}}),()=>t.createVNode("div",{class:[[d],e.class]},[t.createVNode("div",{ref:i,class:[m,e.contentClass]},["pending"===l?.value&&n(o.loading,()=>t.createVNode("div",{class:[u]},[t.createTextVNode("map loading...")])),"failed"===l?.value&&n(o.failed,()=>t.createVNode("div",{class:[c]},[t.createTextVNode("map failed")]))]),y.value&&o.default?.()])}});function f(){return t.inject(s,null).mapInstance}const g={visible:{type:Boolean,default:!0},transform:Object,png8:Boolean,height:Number,retry:{type:Boolean,default:void 0},retryTime:Number,transparentPng:{type:Boolean,default:!0},dataType:Number,spanLevel:{type:Number,default:0},tileTypeName:String,cacheSize:{type:Number,default:256},customLayer:{type:Boolean,default:void 0},clipTile:{type:Boolean,default:void 0},isTop:Boolean,opacity:{type:Number,default:1},isLowText:Boolean,boundary:Array,showRegion:String,useThumbData:Boolean,zIndex:Number,zIndexTop:Boolean,tileUrlTemplate:String,getTileUrl:Function,getTilesUrl:Function};var b=t.defineComponent({name:"TileLayer",props:g,setup(e){const o=f();let a,n=[],l=null;const r=e=>{l?.setZIndex(e)},i=e=>{e?l?.addBoundary(e):l?.clearBoundary()},s=e=>{l?.setTop(e)},p=(e,t)=>{const o=t=>{t.tileInfo=e.tileInfo,e.cb(t,e.key)},a=()=>e.cb(null,e.key);if("string"==typeof t||t instanceof HTMLCanvasElement){const e=new Image;e.crossOrigin="anonymous",e.onload=()=>o(e),e.onerror=a,e.src="string"==typeof t?t:t.toDataURL()}else t instanceof HTMLImageElement?o(t):a()},d=t=>{const o=n.find(e=>e.key===t.key);o?(o.cb(null,t.key),o.cb=t.cb):n.push(t),a&&clearTimeout(a),a=setTimeout(()=>(()=>{if(0===n.length)return;const{getTilesUrl:t}=e,o=[...n];n=[];const a=o.map(({key:e,tile:t,boundRange:o})=>({key:e,tile:t,boundRange:o}));t(a,e=>{for(const t of e){const e=o.findIndex(e=>e.key===t.key);if(-1!==e){const a=o[e];p(a,t.img),o.splice(e,1)}}o.forEach(e=>{e.cb(null,e.key)})})})(),50)},m=()=>{const{getTileUrl:t,getTilesUrl:a}=e;l&&(t?(o().addTileLayer(l),l.loadRasterTileData=function(e,o){const a=this.getTileKey(e),n=BMapGL.Projection.tileToBoundRange({col:e.col,row:e.row,baseTileSize:e.baseTileSize,zoom:e.zoom});t({x:e.col,y:e.row,z:e.zoom},n,t=>{p({cb:o,boundRange:n,key:a,tileInfo:e},t)})}):a?(o().addTileLayer(l),l.loadRasterTileData=function(e,t){const o=this.getTileKey(e),a={x:e.col,y:e.row,z:e.zoom},n=BMapGL.Projection.tileToBoundRange({col:e.col,row:e.row,baseTileSize:e.baseTileSize,zoom:e.zoom});d({key:o,tile:a,boundRange:n,cb:t,tileInfo:e})}):o().addTileLayer(l))};return(()=>{const{visible:a,transform:n,png8:p,height:d,retry:u,retryTime:c,transparentPng:y,dataType:f,spanLevel:g,tileTypeName:b,cacheSize:T,customLayer:v,clipTile:h,isTop:S,opacity:R,isLowText:B,showRegion:w,useThumbData:x,tileUrlTemplate:M}=e;l=new BMapGL.TileLayer({transform:n,png8:p,height:d,retry:u,retryTime:c,transparentPng:y,dataType:f,spanLevel:g,tileTypeName:b,cacheSize:T,customLayer:v,clipTile:h,isTop:S,opacity:R,isLowText:B,showRegion:w,useThumbData:x,tileUrlTemplate:M}),(()=>{const{zIndex:t,boundary:o}=e;i(o),r(t)})(),a&&m(),t.watch(()=>e.zIndex,r),t.watch(()=>e.boundary,i),t.watch(()=>e.zIndexTop,s),t.watch(()=>e.visible,e=>e?m():o().removeTileLayer(l))})(),t.onUnmounted(()=>{l&&o().removeTileLayer(l)}),()=>t.createVNode(t.Fragment,null,null)}});const T={visible:{type:Boolean,default:!0},getTile:{type:Function},useThumbData:{type:Boolean,default:!1},xTemplate:{type:Function},yTemplate:{type:Function},zTemplate:{type:Function},bTemplate:{type:Function},minZoom:{type:Number,default:3},maxZoom:{type:Number,default:23},extent:{type:Array},extentCRSIsWGS84:{type:Boolean,default:!1},boundary:{type:Array},zIndex:{type:Number,default:1},zIndexTop:{type:Boolean,default:!1},tms:{type:Boolean,default:!1}};var v=t.defineComponent({name:"XyzLayer",props:T,setup(e){const o=f();let a=null;const n=e=>{a?.setZIndex(e)},l=e=>{e&&!e.length?a?.addBoundary(e):a?.clearBoundary()},r=()=>{const{zIndex:t,zIndexTop:o}=e;n(t),(e=>{e&&a?.setZIndexTop()})(o)};return(()=>{const{visible:i,getTile:s,xTemplate:p,yTemplate:d,zTemplate:m,bTemplate:u,minZoom:c,maxZoom:y,extent:f,extentCRSIsWGS84:g,boundary:b,useThumbData:T,tms:v}=e;a=new BMapGL.XYZLayer({xTemplate:p,yTemplate:d,zTemplate:m,bTemplate:u,minZoom:c,maxZoom:y,extent:f,extentCRSIsWGS84:g,boundary:b,useThumbData:T,tms:v}),r(),i&&(s?(o().addTileLayer(a),a.loadRasterTileData=function(e,t){const o=this.getTileKey(e),a=a=>{a.tileInfo=e,t&&t(a,o)},n=()=>t&&t(null,o),l=BMapGL.XYZProjection.getTileRangeExtent([e.zoom,e.col,e.row]);s({x:e.col,y:e.row,z:e.zoom},l,e=>{if("string"==typeof e||e instanceof HTMLCanvasElement){const t=new Image;t.crossOrigin="anonymous",t.onload=()=>a(t),t.onerror=n,t.src="string"==typeof e?e:e.toDataURL()}else e instanceof HTMLImageElement?a(e):n()})}):o().addTileLayer(a)),t.watch(()=>e.zIndex,n),t.watch(()=>e.boundary,l)})(),t.onUnmounted(()=>{a&&o().removeTileLayer(a)}),()=>t.createVNode(t.Fragment,null,null)}});const h={visible:{type:Boolean,default:!0},points:{type:Array},strokeColor:{type:String,default:"#000"},fillColor:{type:String,default:"#fff"},strokeWeight:{type:Number,default:2},strokeOpacity:{type:Number,default:1},fillOpacity:{type:Number,default:.3},strokeStyle:{type:String,default:"solid"},enableMassClear:{type:Boolean,default:!0},enableEditing:{type:Boolean,default:!1},isBoundary:{type:Boolean},enableClicking:{type:Boolean,default:!0}};var S=t.defineComponent({name:"Polygon",props:h,setup:e=>{const o=f();let a=null;const n=e=>{a&&a.setStrokeColor(e)};return(()=>{const{points:l,visible:r,strokeColor:i,fillColor:s,strokeWeight:p,strokeOpacity:d,fillOpacity:m,strokeStyle:u,enableMassClear:c,enableEditing:y,enableClicking:f}=e;l&&l.length&&(a=new BMapGL.Polygon(function(e){if(!e||0===e.length)return[];const t=e[0];return Array.isArray(t)?e.map(([e,t])=>new BMapGL.Point(e,t)):e}(l),{strokeColor:i,fillColor:s,strokeWeight:p,strokeOpacity:d,fillOpacity:m,strokeStyle:u,enableMassClear:c,enableEditing:y,enableClicking:f}),r&&o().addOverlay(a),t.watch(()=>e.strokeColor,n),t.watch(()=>e.visible,e=>{o()[e?"addOverlay":"removeOverlay"](a)}))})(),t.onUnmounted(()=>{a&&o().removeOverlay(a)}),()=>t.createVNode(t.Fragment,null,null)}}),R=t.defineComponent({name:"Sector",setup:()=>()=>t.createVNode(t.Fragment,null,null)});e.BConfigProvider=i,e.BMap=y,e.BPolygon=S,e.BSector=R,e.BTileLayer=b,e.BXyzLayer=v,e.configProviderInjectionKey=r,e.configProviderProps=l,e.create=function({componentPrefix:e="B",components:t=[]}={}){const o=[];function a(t,o,a){t.component(e+o)||t.component(e+o,a)}return{componentPrefix:e,install:function(e){o.includes(e)||(o.push(e),t.forEach(t=>{const{name:o,alias:n}=t;a(e,o,t),n&&n.forEach(o=>{a(e,o,t)})}))}}},e.mapInjectionKey=s,e.mapProps=p,e.polygonProps=h,e.tileLayerProps=g,e.xyzLayerProps=T});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Vue3Bmapgl={},e.vue)}(this,function(e,t){"use strict";let o=!1;function n(e){return e.some(e=>!t.isVNode(e)||e.type!==Comment&&!(e.type===t.Fragment&&!n(e.children)))?e:null}function a(e,t){return t(e&&n(e())||null)}const l={ak:String,apiUrl:String,plugins:Array,mapConfig:Object},i=Symbol("b-config-provider");var r=t.defineComponent({name:"ConfigProvider",props:l,setup(e,{slots:n}){const a=t.ref("notload"),l=e.apiUrl?"_initBMap_":`_initBMap_${e.ak}`,r=e.apiUrl?`${e.apiUrl.replace(/&$/,"")}&callback=${l}`:`//api.map.baidu.com/api?type=webgl&v=1.0&ak=${e.ak}&callback=${l}`;a.value="pending",function(e){const{key:t,src:n,addCalToWindow:a=!0,timeout:l=1e4}=e;return o&&window.BMapGL?Promise.resolve():new Promise((e,i)=>{const r=document.createElement("script");r.src=n,r.type="text/javascript",r.defer=!0;const s=()=>{r.onload=null,r.onerror=null,document.body.contains(r)&&document.body.removeChild(r)},d=setTimeout(()=>{s(),i(new Error(`Script load timeout: ${n}`))},l),p=()=>{clearTimeout(d),o=!0,s(),e()};a?window[t]=p:r.onload=p,r.onerror=()=>{clearTimeout(d),s(),i(new Error(`Failed to load script: ${n}`))},document.body.appendChild(r)})}({key:l,src:r}).then(()=>{a.value="loaded"}).catch(()=>{a.value="failed"});const s=t.computed(()=>{const{mapConfig:t}=e;return t??{}});return t.provide(i,{mergedStatusRef:a,mergedMapSetRef:s}),()=>t.renderSlot(n,"default")}});const s=Symbol("b-map"),d={maxZoom:Number,minZoom:Number,heading:Number,center:Object,zoom:Number,class:String,contentClass:String,enableScrollWheelZoom:{type:Boolean,default:void 0},enableDragging:{type:Boolean,default:void 0},tilt:Number,enableTilt:{type:Boolean,default:void 0},mapType:String,enableAutoResize:{type:Boolean,default:void 0},enableTiltGestures:{type:Boolean,default:void 0},enableRotate:{type:Boolean,default:void 0},enableRotateGestures:{type:Boolean,default:void 0},displayOptions:Object,onInitd:Function,onClick:Function,onDblclick:Function,onMousemove:Function};var p="map-module_b-map__29r3m",u="map-module_b-map-content__sMaJG",c="map-module_b-map-loading__qc4a8",m="map-module_b-map-failed__-w-tX";!function(e,t){void 0===t&&(t={});var o=t.insertAt;if("undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===o&&n.firstChild?n.insertBefore(a,n.firstChild):n.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}(".map-module_b-map-content__sMaJG,.map-module_b-map__29r3m{height:100%;overflow:hidden;position:relative;width:100%}.map-module_b-map-failed__-w-tX,.map-module_b-map-loading__qc4a8{color:#999;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}");var y=t.defineComponent({name:"Map",props:d,slots:Object,setup(e,{slots:o}){const{mergedMapSetRef:n,mergedStatusRef:l}=function(e={}){const o=t.inject(i,null);return{mergedStatusRef:o?.mergedStatusRef,mergedMapSetRef:t.computed(()=>{const{zoom:t,center:n,heading:a,minZoom:l,maxZoom:i,enableScrollWheelZoom:r,enableDragging:s,tilt:d,enableTilt:p,mapType:u,enableAutoResize:c,enableTiltGestures:m,enableRotate:y,enableRotateGestures:f,displayOptions:b}=e;return{zoom:t??o?.mergedMapSetRef.value?.zoom??14,center:n??o?.mergedMapSetRef.value?.center??[116.403901,39.915185],heading:a??o?.mergedMapSetRef.value?.heading??0,minZoom:l??o?.mergedMapSetRef.value?.minZoom??0,maxZoom:i??o?.mergedMapSetRef.value?.maxZoom??21,enableScrollWheelZoom:r??o?.mergedMapSetRef.value?.enableScrollWheelZoom??!1,enableDragging:s??o?.mergedMapSetRef.value?.enableDragging??!0,tilt:d??o?.mergedMapSetRef.value?.tilt??0,enableTilt:p??o?.mergedMapSetRef.value?.enableTilt??!1,mapType:u??o?.mergedMapSetRef.value?.mapType??"BMAP_NORMAL_MAP",enableAutoResize:c??o?.mergedMapSetRef.value?.enableAutoResize??!0,enableTiltGestures:m??o?.mergedMapSetRef.value?.enableTiltGestures??!1,enableRotate:y??o?.mergedMapSetRef.value?.enableRotate??!1,enableRotateGestures:f??o?.mergedMapSetRef.value?.enableRotateGestures??!1,displayOptions:b??o?.mergedMapSetRef.value?.displayOptions}})}}(e),r=t.ref();let d,y=null;const f=t.ref(!1);t.provide(s,{mapInstance:()=>y});const b=e=>{"string"==typeof e?y?.centerAndZoom(e,n.value.zoom):Array.isArray(e)?y?.centerAndZoom(new BMapGL.Point(e[0],e[1]),n.value.zoom):y?.centerAndZoom(e,n.value.zoom)},g=e=>{e?y.enableScrollWheelZoom():y.disableScrollWheelZoom()},v=e=>{y?.setDisplayOptions(e||{})},h=e=>{y?.setTilt(e??0)},T=e=>{y?.setHeading(e??0)},w=e=>{e?y.enableDragging():y.disableDragging()},B=e=>{void 0!==window[e]&&y.setMapType(window[e])},S=()=>{const{maxZoom:o,minZoom:a,enableTilt:l,mapType:i,enableAutoResize:s,enableTiltGestures:p,enableRotate:u,enableRotateGestures:c,displayOptions:m}=n.value;y=new BMapGL.Map(r.value,{maxZoom:o,minZoom:a,enableTilt:l,mapType:window[i],enableAutoResize:s,enableTiltGestures:p,enableRotate:u,enableRotateGestures:c,displayOptions:m});const{onInitd:S}=e;(()=>{const{center:e,heading:t,enableScrollWheelZoom:o,tilt:a,enableDragging:l}=n.value;T(t),b(e),g(o),h(a),w(l)})(),t.watch(()=>n.value.center,b,{deep:!0}),t.watch(()=>n.value.enableScrollWheelZoom,g),t.watch(()=>n.value.displayOptions,v),t.watch(()=>n.value.tilt,h),t.watch(()=>n.value.heading,T),t.watch(()=>n.value.enableDragging,w),t.watch(()=>n.value.mapType,B),S?.({map:y}),d=function(e,t){const o=Object.keys(t).filter(e=>e.startsWith("on")&&"function"==typeof t[e]).map(o=>{const n=o.slice(2).toLowerCase(),a=t[o],l=e=>{e.preventDefault?.()||e.domEvent?.preventDefault?.(),e.stopPropagation?.()||e.domEvent?.stopPropagation?.(),a(e)};return e.addEventListener(n,l),()=>e.removeEventListener(n,l)});return()=>o.forEach(e=>e())}(y,e),f.value=!0};return t.onMounted(()=>{t.watchEffect(()=>{"loaded"!==l?.value||f.value||t.nextTick(S)})}),t.onUnmounted(()=>{if(y)try{d?.(),y?.destroy()}catch(e){console.error(`[Vue3 BMapGL]: ${e.message}`)}}),()=>t.createVNode("div",{class:[[p],e.class]},[t.createVNode("div",{ref:r,class:[u,e.contentClass]},["pending"===l?.value&&a(o.loading,()=>t.createVNode("div",{class:[c]},[t.createTextVNode("map loading...")])),"failed"===l?.value&&a(o.failed,()=>t.createVNode("div",{class:[m]},[t.createTextVNode("map failed")]))]),f.value&&o.default?.()])}});function f(){return t.inject(s,null).mapInstance}const b={anchor:{type:String,default:"BMAP_ANCHOR_TOP_RIGHT"},offset:{type:Object,default:{x:0,y:0}},visible:{type:Boolean,default:!0}};var g=t.defineComponent({name:"CustomControl",props:b,setup(e,{attrs:o,slots:n}){const a=f(),l=t.ref();let i=null;return t.onMounted(()=>{const{offset:o,anchor:n,visible:r}=e;i=new BMapGL.Control,i.defaultAnchor=window[n],i.defaultOffset=new BMapGL.Size(o.x,o.y),i.initialize=e=>e.getContainer().appendChild(l.value),r&&a().addControl(i),t.watch(()=>e.visible,e=>{i&&a()[e?"addControl":"removeControl"](i)})}),t.onUnmounted(()=>{i&&a().removeControl(i)}),()=>t.createVNode("div",{style:"display: none"},[t.withDirectives(t.createVNode("div",{ref:l},[n.default?.()]),[[t.resolveDirective("bind"),o]])])}});const v={visible:{type:Boolean,default:!0},transform:Object,png8:Boolean,height:Number,retry:{type:Boolean,default:void 0},retryTime:Number,transparentPng:{type:Boolean,default:!0},dataType:Number,spanLevel:{type:Number,default:0},tileTypeName:String,cacheSize:{type:Number,default:256},customLayer:{type:Boolean,default:void 0},clipTile:{type:Boolean,default:void 0},isTop:Boolean,opacity:{type:Number,default:1},isLowText:Boolean,boundary:Array,showRegion:String,useThumbData:Boolean,zIndex:Number,zIndexTop:Boolean,tileUrlTemplate:String,getTileUrl:Function,getTilesUrl:Function};var h=t.defineComponent({name:"TileLayer",props:v,setup(e){const o=f();let n,a=[],l=null;const i=e=>{l?.setZIndex(e)},r=e=>{e?l?.addBoundary(e):l?.clearBoundary()},s=e=>{l?.setTop(e)},d=(e,t)=>{const o=t=>{t.tileInfo=e.tileInfo,e.cb(t,e.key)},n=()=>e.cb(null,e.key);if("string"==typeof t||t instanceof HTMLCanvasElement){const e=new Image;e.crossOrigin="anonymous",e.onload=()=>o(e),e.onerror=n,e.src="string"==typeof t?t:t.toDataURL()}else t instanceof HTMLImageElement?o(t):n()},p=t=>{const o=a.find(e=>e.key===t.key);o?(o.cb(null,t.key),o.cb=t.cb):a.push(t),n&&clearTimeout(n),n=setTimeout(()=>(()=>{if(0===a.length)return;const{getTilesUrl:t}=e,o=[...a];a=[];const n=o.map(({key:e,tile:t,boundRange:o})=>({key:e,tile:t,boundRange:o}));t(n,e=>{for(const t of e){const e=o.findIndex(e=>e.key===t.key);if(-1!==e){const n=o[e];d(n,t.img),o.splice(e,1)}}o.forEach(e=>{e.cb(null,e.key)})})})(),50)},u=()=>{const{getTileUrl:t,getTilesUrl:n}=e;l&&(t?(o().addTileLayer(l),l.loadRasterTileData=function(e,o){const n=this.getTileKey(e),a=BMapGL.Projection.tileToBoundRange({col:e.col,row:e.row,baseTileSize:e.baseTileSize,zoom:e.zoom});t({x:e.col,y:e.row,z:e.zoom},a,t=>{d({cb:o,boundRange:a,key:n,tileInfo:e},t)})}):n?(o().addTileLayer(l),l.loadRasterTileData=function(e,t){const o=this.getTileKey(e),n={x:e.col,y:e.row,z:e.zoom},a=BMapGL.Projection.tileToBoundRange({col:e.col,row:e.row,baseTileSize:e.baseTileSize,zoom:e.zoom});p({key:o,tile:n,boundRange:a,cb:t,tileInfo:e})}):o().addTileLayer(l))};return(()=>{const{visible:n,transform:a,png8:d,height:p,retry:c,retryTime:m,transparentPng:y,dataType:f,spanLevel:b,tileTypeName:g,cacheSize:v,customLayer:h,clipTile:T,isTop:w,opacity:B,isLowText:S,showRegion:C,useThumbData:x,tileUrlTemplate:R}=e;l=new BMapGL.TileLayer({transform:a,png8:d,height:p,retry:c,retryTime:m,transparentPng:y,dataType:f,spanLevel:b,tileTypeName:g,cacheSize:v,customLayer:h,clipTile:T,isTop:w,opacity:B,isLowText:S,showRegion:C,useThumbData:x,tileUrlTemplate:R}),(()=>{const{zIndex:t,boundary:o}=e;r(o),i(t)})(),n&&u(),t.watch(()=>e.zIndex,i),t.watch(()=>e.boundary,r),t.watch(()=>e.zIndexTop,s),t.watch(()=>e.visible,e=>e?u():o().removeTileLayer(l))})(),t.onUnmounted(()=>{l&&o().removeTileLayer(l)}),()=>t.createVNode(t.Fragment,null,null)}});const T={visible:{type:Boolean,default:!0},getTile:{type:Function},useThumbData:{type:Boolean,default:!1},xTemplate:{type:Function},yTemplate:{type:Function},zTemplate:{type:Function},bTemplate:{type:Function},minZoom:{type:Number,default:3},maxZoom:{type:Number,default:23},extent:{type:Array},extentCRSIsWGS84:{type:Boolean,default:!1},boundary:{type:Array},zIndex:{type:Number,default:1},zIndexTop:{type:Boolean,default:!1},tms:{type:Boolean,default:!1}};var w=t.defineComponent({name:"XyzLayer",props:T,setup(e){const o=f();let n=null;const a=e=>{n?.setZIndex(e)},l=e=>{e&&!e.length?n?.addBoundary(e):n?.clearBoundary()},i=()=>{const{zIndex:t,zIndexTop:o}=e;a(t),(e=>{e&&n?.setZIndexTop()})(o)};return(()=>{const{visible:r,getTile:s,xTemplate:d,yTemplate:p,zTemplate:u,bTemplate:c,minZoom:m,maxZoom:y,extent:f,extentCRSIsWGS84:b,boundary:g,useThumbData:v,tms:h}=e;n=new BMapGL.XYZLayer({xTemplate:d,yTemplate:p,zTemplate:u,bTemplate:c,minZoom:m,maxZoom:y,extent:f,extentCRSIsWGS84:b,boundary:g,useThumbData:v,tms:h}),i(),r&&(s?(o().addTileLayer(n),n.loadRasterTileData=function(e,t){const o=this.getTileKey(e),n=n=>{n.tileInfo=e,t&&t(n,o)},a=()=>t&&t(null,o),l=BMapGL.XYZProjection.getTileRangeExtent([e.zoom,e.col,e.row]);s({x:e.col,y:e.row,z:e.zoom},l,e=>{if("string"==typeof e||e instanceof HTMLCanvasElement){const t=new Image;t.crossOrigin="anonymous",t.onload=()=>n(t),t.onerror=a,t.src="string"==typeof e?e:e.toDataURL()}else e instanceof HTMLImageElement?n(e):a()})}):o().addTileLayer(n)),t.watch(()=>e.zIndex,a),t.watch(()=>e.boundary,l)})(),t.onUnmounted(()=>{n&&o().removeTileLayer(n)}),()=>t.createVNode(t.Fragment,null,null)}});const B={show:Boolean,offset:{type:Object,default:{x:0,y:0}},width:{type:Number,default:0},height:{type:Number,default:0},maxWidth:Number,position:Object,enableAutoPan:{type:Boolean,default:!0},enableCloseOnClick:{type:Boolean,default:!0},"onUpdate:show":Function};var S=t.defineComponent({name:"InfoWindow",props:B,setup(e,{slots:o,attrs:n}){const a=f(),l=t.ref();let i=null;const r=t.computed({get:()=>e.show,set:t=>e["onUpdate:show"]?.(t)}),s=()=>{const{position:t}=e;if(!t||!i)return;const o=Array.isArray(t)?new BMapGL.Point(t[0],t[1]):t;a().openInfoWindow(i,o),r.value=!0},d=()=>{i&&(i?.hide?.(),r.value=!1)},p=e=>{s();const t=Array.isArray(e)?new BMapGL.Point(e[0],e[1]):e;i?.setPosition(t),r.value||d()},u=()=>{i?.redraw(),Array.prototype.forEach.call(l.value?.querySelectorAll("img")??[],e=>{e.onload=()=>{i?.redraw()}})},c=e=>{i?.setWidth(e)},m=e=>{i?.setHeight(e)};return t.onMounted(()=>{const{width:o,height:n,maxWidth:y,offset:f,enableAutoPan:b,enableCloseOnClick:g}=e;i=new BMapGL.InfoWindow(l.value,{width:o,height:n,maxWidth:y,offset:new BMapGL.Size(f.x,f.y),enableAutoPan:b,enableCloseOnClick:g}),i.addEventListener("close",()=>{e.show&&(r.value=!1)}),i.addEventListener("open",()=>{e.show||(r.value=!0)}),a().addOverlay(i),u(),e.show&&t.nextTick(()=>{s(),t.nextTick(()=>{i&&"_visible"in i?!i._visible&&(r.value=!1):!i?.isOpen()&&(r.value=!1)})}),t.watch(()=>e.position,p,{deep:!0}),t.watch(()=>e.width,c),t.watch(()=>e.height,m),t.watch(()=>e.show,()=>e.show?s():d())}),t.onUpdated(()=>{var e;i&&i.isOpen()&&(e=l.value??"",i?.setContent(e))}),t.onUnmounted(()=>{i&&(a().removeOverlay(i),u())}),()=>t.createVNode("div",{style:"display: none"},[t.withDirectives(t.createVNode("div",{ref:l},[o.default?.()]),[[t.resolveDirective("bind"),n]])])}});const C={visible:{type:Boolean,default:!0}};var x=t.defineComponent({name:"Marker",props:C,setup:()=>()=>t.createVNode(t.Fragment,null,null)});const R={visible:{type:Boolean,default:!0},points:{type:Array},strokeColor:{type:String,default:"#000"},fillColor:{type:String,default:"#fff"},strokeWeight:{type:Number,default:2},strokeOpacity:{type:Number,default:1},fillOpacity:{type:Number,default:.3},strokeStyle:{type:String,default:"solid"},enableMassClear:{type:Boolean,default:!0},enableEditing:{type:Boolean,default:!1},isBoundary:{type:Boolean},enableClicking:{type:Boolean,default:!0}};var M=t.defineComponent({name:"Polygon",props:R,setup:e=>{const o=f();let n=null;const a=e=>{n&&n.setStrokeColor(e)};return(()=>{const{points:l,visible:i,strokeColor:r,fillColor:s,strokeWeight:d,strokeOpacity:p,fillOpacity:u,strokeStyle:c,enableMassClear:m,enableEditing:y,enableClicking:f}=e;l&&l.length&&(n=new BMapGL.Polygon(function(e){if(!e||0===e.length)return[];const t=e[0];return Array.isArray(t)?e.map(([e,t])=>new BMapGL.Point(e,t)):e}(l),{strokeColor:r,fillColor:s,strokeWeight:d,strokeOpacity:p,fillOpacity:u,strokeStyle:c,enableMassClear:m,enableEditing:y,enableClicking:f}),i&&o().addOverlay(n),t.watch(()=>e.strokeColor,a),t.watch(()=>e.visible,e=>{o()[e?"addOverlay":"removeOverlay"](n)}))})(),t.onUnmounted(()=>{n&&o().removeOverlay(n)}),()=>t.createVNode(t.Fragment,null,null)}}),L=t.defineComponent({name:"Sector",setup:()=>()=>t.createVNode(t.Fragment,null,null)});e.BConfigProvider=r,e.BCustomControl=g,e.BInfoWindow=S,e.BMap=y,e.BMarker=x,e.BPolygon=M,e.BSector=L,e.BTileLayer=h,e.BXyzLayer=w,e.configProviderInjectionKey=i,e.configProviderProps=l,e.create=function({componentPrefix:e="B",components:t=[]}={}){const o=[];function n(t,o,n){t.component(e+o)||t.component(e+o,n)}return{componentPrefix:e,install:function(e){o.includes(e)||(o.push(e),t.forEach(t=>{const{name:o,alias:a}=t;n(e,o,t),a&&a.forEach(o=>{n(e,o,t)})}))}}},e.customControlProps=b,e.infoWindowProps=B,e.mapInjectionKey=s,e.mapProps=d,e.markerProps=C,e.polygonProps=R,e.tileLayerProps=v,e.xyzLayerProps=T});
|
package/es/_utils/call.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type AnyFunction = (...args: any[]) => any;
|
|
1
2
|
declare function call(funcs: MaybeArray<() => void>): void;
|
|
2
3
|
declare function call<A1>(funcs: MaybeArray<(a1: A1) => void>, a1: A1): void;
|
|
3
4
|
declare function call<A1, A2>(funcs: MaybeArray<(a1: A1, a2: A2) => void>, a1: A1, a2: A2): void;
|
package/es/_utils/call.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call.mjs","sources":["../../src/_utils/file:/D:/workspaces/personal-project/vue3-bmapgl/packages/vue3-bmapgl/src/_utils/call.ts"],"sourcesContent":["type AnyFunction = (...args: any[]) => any\r\n\r\nfunction call(funcs: MaybeArray<() => void>): void\r\nfunction call<A1>(funcs: MaybeArray<(a1: A1) => void>, a1: A1): void\r\nfunction call<A1, A2>(\r\n funcs: MaybeArray<(a1: A1, a2: A2) => void>,\r\n a1: A1,\r\n a2: A2,\r\n): void\r\nfunction call<A1, A2, A3>(\r\n funcs: MaybeArray<(a1: A1, a2: A2, a3: A3) => void>,\r\n a1: A1,\r\n a2: A2,\r\n a3: A3,\r\n): void\r\nfunction call<A1, A2, A3, A4>(\r\n funcs: MaybeArray<(a1: A1, a2: A2, a3: A3, a4: A4) => void>,\r\n a1: A1,\r\n a2: A2,\r\n a3: A3,\r\n a4: A4,\r\n): void\r\nfunction call<A extends any[]>(\r\n funcs: AnyFunction[] | AnyFunction,\r\n ...args: A\r\n): void {\r\n if (Array.isArray(funcs)) {\r\n funcs.forEach(func => (call as any)(func, ...args))\r\n } else {\r\n return funcs(...args)\r\n }\r\n}\r\n\r\nexport { call }\r\n\r\nexport type MaybeArray<T> = T | T[]\r\n"],"names":[],"mappings":"AAsBA,SAAS,IAAA,CACP,UACG,IAAA,EAAO;AAEV,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AACxB,IAAA,KAAA,CAAM,QAAQ,CAAA,IAAA,KAAS,IAAA,CAAa,IAAA,EAAM,GAAG,IAAI,CAAC,CAAA;AAAA,EACpD,CAAA,MAAO;AACL,IAAA,OAAO,KAAA,CAAM,GAAG,IAAI,CAAA;AAAA,EACtB;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"call.mjs","sources":["../../src/_utils/file:/D:/workspaces/personal-project/vue3-bmapgl/packages/vue3-bmapgl/src/_utils/call.ts"],"sourcesContent":["export type AnyFunction = (...args: any[]) => any\r\n\r\nfunction call(funcs: MaybeArray<() => void>): void\r\nfunction call<A1>(funcs: MaybeArray<(a1: A1) => void>, a1: A1): void\r\nfunction call<A1, A2>(\r\n funcs: MaybeArray<(a1: A1, a2: A2) => void>,\r\n a1: A1,\r\n a2: A2,\r\n): void\r\nfunction call<A1, A2, A3>(\r\n funcs: MaybeArray<(a1: A1, a2: A2, a3: A3) => void>,\r\n a1: A1,\r\n a2: A2,\r\n a3: A3,\r\n): void\r\nfunction call<A1, A2, A3, A4>(\r\n funcs: MaybeArray<(a1: A1, a2: A2, a3: A3, a4: A4) => void>,\r\n a1: A1,\r\n a2: A2,\r\n a3: A3,\r\n a4: A4,\r\n): void\r\nfunction call<A extends any[]>(\r\n funcs: AnyFunction[] | AnyFunction,\r\n ...args: A\r\n): void {\r\n if (Array.isArray(funcs)) {\r\n funcs.forEach(func => (call as any)(func, ...args))\r\n } else {\r\n return funcs(...args)\r\n }\r\n}\r\n\r\nexport { call }\r\n\r\nexport type MaybeArray<T> = T | T[]\r\n"],"names":[],"mappings":"AAsBA,SAAS,IAAA,CACP,UACG,IAAA,EAAO;AAEV,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AACxB,IAAA,KAAA,CAAM,QAAQ,CAAA,IAAA,KAAS,IAAA,CAAa,IAAA,EAAM,GAAG,IAAI,CAAC,CAAA;AAAA,EACpD,CAAA,MAAO;AACL,IAAA,OAAO,KAAA,CAAM,GAAG,IAAI,CAAA;AAAA,EACtB;AACF;;;;"}
|
package/es/_utils/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { call } from './call.mjs';
|
|
2
|
-
export { listToMapPoints, loader } from './map.mjs';
|
|
2
|
+
export { listToMapPoints, loader, setupMapEvents } from './map.mjs';
|
|
3
3
|
export { ensureValidVNode, resolveWrappedSlot } from './resolve-slot.mjs';
|
|
4
4
|
//# sourceMappingURL=index.mjs.map
|
package/es/_utils/map.d.ts
CHANGED
|
@@ -6,3 +6,4 @@ export interface LoaderOptions {
|
|
|
6
6
|
}
|
|
7
7
|
export declare function loader(options: LoaderOptions): Promise<void>;
|
|
8
8
|
export declare function listToMapPoints(points?: BMapGL.Point[] | number[][] | string[]): BMapGL.Point[];
|
|
9
|
+
export declare function setupMapEvents(map: any, props: Record<string, any>): () => void;
|
package/es/_utils/map.mjs
CHANGED
|
@@ -52,6 +52,21 @@ function listToMapPoints(points) {
|
|
|
52
52
|
}
|
|
53
53
|
return points;
|
|
54
54
|
}
|
|
55
|
+
function setupMapEvents(map, props) {
|
|
56
|
+
const cleanup = Object.keys(props).filter((key) => key.startsWith("on") && typeof props[key] === "function").map((propName) => {
|
|
57
|
+
const eventName = propName.slice(2).toLowerCase();
|
|
58
|
+
const handler = props[propName];
|
|
59
|
+
const wrapper = (e) => {
|
|
60
|
+
var _a, _b, _c, _d, _e, _f;
|
|
61
|
+
((_a = e.preventDefault) === null || _a === void 0 ? void 0 : _a.call(e)) || ((_c = (_b = e.domEvent) === null || _b === void 0 ? void 0 : _b.preventDefault) === null || _c === void 0 ? void 0 : _c.call(_b));
|
|
62
|
+
((_d = e.stopPropagation) === null || _d === void 0 ? void 0 : _d.call(e)) || ((_f = (_e = e.domEvent) === null || _e === void 0 ? void 0 : _e.stopPropagation) === null || _f === void 0 ? void 0 : _f.call(_e));
|
|
63
|
+
handler(e);
|
|
64
|
+
};
|
|
65
|
+
map.addEventListener(eventName, wrapper);
|
|
66
|
+
return () => map.removeEventListener(eventName, wrapper);
|
|
67
|
+
});
|
|
68
|
+
return () => cleanup.forEach((fn) => fn());
|
|
69
|
+
}
|
|
55
70
|
|
|
56
|
-
export { listToMapPoints, loader };
|
|
71
|
+
export { listToMapPoints, loader, setupMapEvents };
|
|
57
72
|
//# sourceMappingURL=map.mjs.map
|
package/es/_utils/map.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.mjs","sources":["../../src/_utils/file:/D:/workspaces/personal-project/vue3-bmapgl/packages/vue3-bmapgl/src/_utils/map.ts"],"sourcesContent":["export interface LoaderOptions {\r\n key: string\r\n src: string\r\n addCalToWindow?: boolean\r\n timeout?: number\r\n}\r\n\r\nlet isScriptLoaded = false\r\n\r\nexport function loader(options: LoaderOptions): Promise<void> {\r\n const {\r\n key,\r\n src,\r\n addCalToWindow = true,\r\n timeout = 10000,\r\n } = options\r\n\r\n if (isScriptLoaded && window.BMapGL) {\r\n return Promise.resolve()\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const script = document.createElement('script')\r\n script.src = src\r\n script.type = 'text/javascript'\r\n script.defer = true\r\n\r\n const cleanup = () => {\r\n script.onload = null\r\n script.onerror = null\r\n if (document.body.contains(script)) {\r\n document.body.removeChild(script)\r\n }\r\n }\r\n\r\n const timer = setTimeout(() => {\r\n cleanup()\r\n reject(new Error(`Script load timeout: ${src}`))\r\n }, timeout)\r\n\r\n const handleLoad = () => {\r\n clearTimeout(timer)\r\n isScriptLoaded = true\r\n cleanup()\r\n resolve()\r\n }\r\n\r\n if (addCalToWindow) {\r\n (window as any)[key] = handleLoad\r\n } else {\r\n script.onload = handleLoad\r\n }\r\n\r\n script.onerror = () => {\r\n clearTimeout(timer)\r\n cleanup()\r\n reject(new Error(`Failed to load script: ${src}`))\r\n }\r\n\r\n document.body.appendChild(script)\r\n })\r\n}\r\n\r\nexport function listToMapPoints(points?: BMapGL.Point[] | number[][] | string[]): BMapGL.Point[] {\r\n if (!points || points.length === 0) {\r\n return []\r\n }\r\n\r\n const first = points[0]\r\n\r\n if (Array.isArray(first)) {\r\n return (points as number[][]).map(([lng, lat]) => new BMapGL.Point(lng, lat))\r\n }\r\n\r\n if (typeof first === 'string') {\r\n return points as BMapGL.Point[]\r\n }\r\n\r\n return points as BMapGL.Point[]\r\n}\r\n"],"names":[],"mappings":"AAOA,IAAI,cAAA,GAAiB,KAAA;AAEf,SAAU,OAAO,OAAA,EAAsB;AAC3C,EAAA,MAAM,EACJ,GAAA,EACA,GAAA,EACA,iBAAiB,IAAA,EACjB,OAAA,GAAU,KAAK,GACb,OAAA;AAEJ,EAAA,IAAI,cAAA,IAAkB,OAAO,MAAA,EAAQ;AACnC,IAAA,OAAO,QAAQ,OAAA,EAAO;AAAA,EACxB;AAEA,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,OAAA,EAAS,MAAA,KAAU;AACrC,IAAA,MAAM,MAAA,GAAS,QAAA,CAAS,aAAA,CAAc,QAAQ,CAAA;AAC9C,IAAA,MAAA,CAAO,GAAA,GAAM,GAAA;AACb,IAAA,MAAA,CAAO,IAAA,GAAO,iBAAA;AACd,IAAA,MAAA,CAAO,KAAA,GAAQ,IAAA;AAEf,IAAA,MAAM,UAAU,MAAK;AACnB,MAAA,MAAA,CAAO,MAAA,GAAS,IAAA;AAChB,MAAA,MAAA,CAAO,OAAA,GAAU,IAAA;AACjB,MAAA,IAAI,QAAA,CAAS,IAAA,CAAK,QAAA,CAAS,MAAM,CAAA,EAAG;AAClC,QAAA,QAAA,CAAS,IAAA,CAAK,YAAY,MAAM,CAAA;AAAA,MAClC;AAAA,IACF,CAAA;AAEA,IAAA,MAAM,KAAA,GAAQ,WAAW,MAAK;AAC5B,MAAA,OAAA;AACA,MAAA,MAAA,CAAO,IAAI,KAAA,CAAM,CAAA,qBAAA,EAAwB,GAAG,EAAE,CAAC,CAAA;AAAA,IACjD,GAAG,OAAO,CAAA;AAEV,IAAA,MAAM,aAAa,MAAK;AACtB,MAAA,YAAA,CAAa,KAAK,CAAA;AAClB,MAAA,cAAA,GAAiB,IAAA;AACjB,MAAA,OAAA;AACA,MAAA,OAAA;IACF,CAAA;AAEA,IAAA,IAAI,cAAA,EAAgB;AACjB,MAAA,MAAA,CAAe,GAAG,CAAA,GAAI,UAAA;AAAA,IACzB,CAAA,MAAO;AACL,MAAA,MAAA,CAAO,MAAA,GAAS,UAAA;AAAA,IAClB;AAEA,IAAA,MAAA,CAAO,UAAU,MAAK;AACpB,MAAA,YAAA,CAAa,KAAK,CAAA;AAClB,MAAA,OAAA;AACA,MAAA,MAAA,CAAO,IAAI,KAAA,CAAM,CAAA,uBAAA,EAA0B,GAAG,EAAE,CAAC,CAAA;AAAA,IACnD,CAAA;AAEA,IAAA,QAAA,CAAS,IAAA,CAAK,YAAY,MAAM,CAAA;AAAA,EAClC,CAAC,CAAA;AACH;AAEM,SAAU,gBAAgB,MAAA,EAA+C;AAC7E,EAAA,IAAI,CAAC,MAAA,IAAU,MAAA,CAAO,MAAA,KAAW,CAAA,EAAG;AAClC,IAAA,OAAO;EACT;AAEA,EAAA,MAAM,KAAA,GAAQ,OAAO,CAAC,CAAA;AAEtB,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AACxB,IAAA,OAAQ,MAAA,CAAsB,GAAA,CAAI,CAAC,CAAC,GAAA,EAAK,GAAG,CAAA,KAAM,IAAI,MAAA,CAAO,KAAA,CAAM,GAAA,EAAK,GAAG,CAAC,CAAA;AAAA,EAC9E;AAEA,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,OAAO,MAAA;AACT;;;;"}
|
|
1
|
+
{"version":3,"file":"map.mjs","sources":["../../src/_utils/file:/D:/workspaces/personal-project/vue3-bmapgl/packages/vue3-bmapgl/src/_utils/map.ts"],"sourcesContent":["export interface LoaderOptions {\r\n key: string\r\n src: string\r\n addCalToWindow?: boolean\r\n timeout?: number\r\n}\r\n\r\nlet isScriptLoaded = false\r\n\r\nexport function loader(options: LoaderOptions): Promise<void> {\r\n const {\r\n key,\r\n src,\r\n addCalToWindow = true,\r\n timeout = 10000,\r\n } = options\r\n\r\n if (isScriptLoaded && window.BMapGL) {\r\n return Promise.resolve()\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const script = document.createElement('script')\r\n script.src = src\r\n script.type = 'text/javascript'\r\n script.defer = true\r\n\r\n const cleanup = () => {\r\n script.onload = null\r\n script.onerror = null\r\n if (document.body.contains(script)) {\r\n document.body.removeChild(script)\r\n }\r\n }\r\n\r\n const timer = setTimeout(() => {\r\n cleanup()\r\n reject(new Error(`Script load timeout: ${src}`))\r\n }, timeout)\r\n\r\n const handleLoad = () => {\r\n clearTimeout(timer)\r\n isScriptLoaded = true\r\n cleanup()\r\n resolve()\r\n }\r\n\r\n if (addCalToWindow) {\r\n (window as any)[key] = handleLoad\r\n } else {\r\n script.onload = handleLoad\r\n }\r\n\r\n script.onerror = () => {\r\n clearTimeout(timer)\r\n cleanup()\r\n reject(new Error(`Failed to load script: ${src}`))\r\n }\r\n\r\n document.body.appendChild(script)\r\n })\r\n}\r\n\r\nexport function listToMapPoints(points?: BMapGL.Point[] | number[][] | string[]): BMapGL.Point[] {\r\n if (!points || points.length === 0) {\r\n return []\r\n }\r\n\r\n const first = points[0]\r\n\r\n if (Array.isArray(first)) {\r\n return (points as number[][]).map(([lng, lat]) => new BMapGL.Point(lng, lat))\r\n }\r\n\r\n if (typeof first === 'string') {\r\n return points as BMapGL.Point[]\r\n }\r\n\r\n return points as BMapGL.Point[]\r\n}\r\n\r\nexport function setupMapEvents(map: any, props: Record<string, any>) {\r\n const cleanup = Object.keys(props)\r\n .filter(key => key.startsWith('on') && typeof props[key] === 'function')\r\n .map((propName) => {\r\n const eventName = propName.slice(2).toLowerCase()\r\n const handler = props[propName]\r\n\r\n const wrapper = (e: any) => {\r\n e.preventDefault?.() || e.domEvent?.preventDefault?.()\r\n e.stopPropagation?.() || e.domEvent?.stopPropagation?.()\r\n handler(e)\r\n }\r\n\r\n map.addEventListener(eventName, wrapper)\r\n return () => map.removeEventListener(eventName, wrapper)\r\n })\r\n\r\n return () => cleanup.forEach(fn => fn())\r\n}\r\n"],"names":[],"mappings":"AAOA,IAAI,cAAA,GAAiB,KAAA;AAEf,SAAU,OAAO,OAAA,EAAsB;AAC3C,EAAA,MAAM,EACJ,GAAA,EACA,GAAA,EACA,iBAAiB,IAAA,EACjB,OAAA,GAAU,KAAK,GACb,OAAA;AAEJ,EAAA,IAAI,cAAA,IAAkB,OAAO,MAAA,EAAQ;AACnC,IAAA,OAAO,QAAQ,OAAA,EAAO;AAAA,EACxB;AAEA,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,OAAA,EAAS,MAAA,KAAU;AACrC,IAAA,MAAM,MAAA,GAAS,QAAA,CAAS,aAAA,CAAc,QAAQ,CAAA;AAC9C,IAAA,MAAA,CAAO,GAAA,GAAM,GAAA;AACb,IAAA,MAAA,CAAO,IAAA,GAAO,iBAAA;AACd,IAAA,MAAA,CAAO,KAAA,GAAQ,IAAA;AAEf,IAAA,MAAM,UAAU,MAAK;AACnB,MAAA,MAAA,CAAO,MAAA,GAAS,IAAA;AAChB,MAAA,MAAA,CAAO,OAAA,GAAU,IAAA;AACjB,MAAA,IAAI,QAAA,CAAS,IAAA,CAAK,QAAA,CAAS,MAAM,CAAA,EAAG;AAClC,QAAA,QAAA,CAAS,IAAA,CAAK,YAAY,MAAM,CAAA;AAAA,MAClC;AAAA,IACF,CAAA;AAEA,IAAA,MAAM,KAAA,GAAQ,WAAW,MAAK;AAC5B,MAAA,OAAA;AACA,MAAA,MAAA,CAAO,IAAI,KAAA,CAAM,CAAA,qBAAA,EAAwB,GAAG,EAAE,CAAC,CAAA;AAAA,IACjD,GAAG,OAAO,CAAA;AAEV,IAAA,MAAM,aAAa,MAAK;AACtB,MAAA,YAAA,CAAa,KAAK,CAAA;AAClB,MAAA,cAAA,GAAiB,IAAA;AACjB,MAAA,OAAA;AACA,MAAA,OAAA;IACF,CAAA;AAEA,IAAA,IAAI,cAAA,EAAgB;AACjB,MAAA,MAAA,CAAe,GAAG,CAAA,GAAI,UAAA;AAAA,IACzB,CAAA,MAAO;AACL,MAAA,MAAA,CAAO,MAAA,GAAS,UAAA;AAAA,IAClB;AAEA,IAAA,MAAA,CAAO,UAAU,MAAK;AACpB,MAAA,YAAA,CAAa,KAAK,CAAA;AAClB,MAAA,OAAA;AACA,MAAA,MAAA,CAAO,IAAI,KAAA,CAAM,CAAA,uBAAA,EAA0B,GAAG,EAAE,CAAC,CAAA;AAAA,IACnD,CAAA;AAEA,IAAA,QAAA,CAAS,IAAA,CAAK,YAAY,MAAM,CAAA;AAAA,EAClC,CAAC,CAAA;AACH;AAEM,SAAU,gBAAgB,MAAA,EAA+C;AAC7E,EAAA,IAAI,CAAC,MAAA,IAAU,MAAA,CAAO,MAAA,KAAW,CAAA,EAAG;AAClC,IAAA,OAAO;EACT;AAEA,EAAA,MAAM,KAAA,GAAQ,OAAO,CAAC,CAAA;AAEtB,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AACxB,IAAA,OAAQ,MAAA,CAAsB,GAAA,CAAI,CAAC,CAAC,GAAA,EAAK,GAAG,CAAA,KAAM,IAAI,MAAA,CAAO,KAAA,CAAM,GAAA,EAAK,GAAG,CAAC,CAAA;AAAA,EAC9E;AAEA,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,OAAO,MAAA;AACT;AAEM,SAAU,cAAA,CAAe,KAAU,KAAA,EAA0B;AACjE,EAAA,MAAM,UAAU,MAAA,CAAO,IAAA,CAAK,KAAK,CAAA,CAC9B,MAAA,CAAO,SAAO,GAAA,CAAI,UAAA,CAAW,IAAI,CAAA,IAAK,OAAO,MAAM,GAAG,CAAA,KAAM,UAAU,CAAA,CACtE,GAAA,CAAI,CAAC,QAAA,KAAY;AAChB,IAAA,MAAM,SAAA,GAAY,QAAA,CAAS,KAAA,CAAM,CAAC,EAAE,WAAA,EAAW;AAC/C,IAAA,MAAM,OAAA,GAAU,MAAM,QAAQ,CAAA;AAE9B,IAAA,MAAM,OAAA,GAAU,CAAC,CAAA,KAAU;;AACzB,MAAA,CAAA,CAAA,EAAA,GAAA,CAAA,CAAE,cAAA,wDAAsB,EAAA,GAAA,CAAA,EAAA,GAAA,CAAA,CAAE,QAAA,MAAQ,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,cAAA,MAAc,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA;AAClD,MAAA,CAAA,CAAA,EAAA,GAAA,CAAA,CAAE,eAAA,wDAAuB,EAAA,GAAA,CAAA,EAAA,GAAA,CAAA,CAAE,QAAA,MAAQ,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,eAAA,MAAe,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA;AACpD,MAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACX,CAAA;AAEA,IAAA,GAAA,CAAI,gBAAA,CAAiB,WAAW,OAAO,CAAA;AACvC,IAAA,OAAO,MAAM,GAAA,CAAI,mBAAA,CAAoB,SAAA,EAAW,OAAO,CAAA;AAAA,EACzD,CAAC,CAAA;AAEH,EAAA,OAAO,MAAM,OAAA,CAAQ,OAAA,CAAQ,CAAA,EAAA,KAAM,IAAI,CAAA;AACzC;;;;"}
|
package/es/components.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * from './config-provider';
|
|
2
|
+
export * from './control/custom';
|
|
2
3
|
export * from './layer/tile';
|
|
3
4
|
export * from './layer/xyz';
|
|
4
5
|
export * from './map';
|
|
6
|
+
export * from './overlay/info-window';
|
|
7
|
+
export * from './overlay/marker';
|
|
5
8
|
export * from './overlay/polygon';
|
|
6
9
|
export * from './overlay/sector';
|
package/es/components.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { default as BConfigProvider } from './config-provider/src/config-provider.mjs';
|
|
2
2
|
export { configProviderProps } from './config-provider/src/config-provider-props.mjs';
|
|
3
3
|
export { configProviderInjectionKey } from './config-provider/src/constants.mjs';
|
|
4
|
+
export { default as BCustomControl } from './control/custom/src/custom.mjs';
|
|
5
|
+
export { customControlProps } from './control/custom/src/custom-props.mjs';
|
|
4
6
|
export { default as BTileLayer } from './layer/tile/src/tile.mjs';
|
|
5
7
|
export { tileLayerProps } from './layer/tile/src/tile-props.mjs';
|
|
6
8
|
export { default as BXyzLayer } from './layer/xyz/src/xyz.mjs';
|
|
@@ -8,6 +10,10 @@ export { xyzLayerProps } from './layer/xyz/src/xyz-props.mjs';
|
|
|
8
10
|
export { mapInjectionKey } from './map/src/constants.mjs';
|
|
9
11
|
export { default as BMap } from './map/src/map.mjs';
|
|
10
12
|
export { mapProps } from './map/src/map-props.mjs';
|
|
13
|
+
export { default as BInfoWindow } from './overlay/info-window/src/info-window.mjs';
|
|
14
|
+
export { infoWindowProps } from './overlay/info-window/src/info-window-props.mjs';
|
|
15
|
+
export { default as BMarker } from './overlay/marker/src/marker.mjs';
|
|
16
|
+
export { markerProps } from './overlay/marker/src/marker-props.mjs';
|
|
11
17
|
export { default as BPolygon } from './overlay/polygon/src/polygon.mjs';
|
|
12
18
|
export { polygonProps } from './overlay/polygon/src/polygon-props.mjs';
|
|
13
19
|
export { default as BSector } from './overlay/sector/src/sector.mjs';
|
package/es/components.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
import type { ExtractPublicPropTypes } from '../../../_utils';
|
|
3
|
+
export declare const customControlProps: {
|
|
4
|
+
readonly anchor: {
|
|
5
|
+
readonly type: StringConstructor;
|
|
6
|
+
readonly default: "BMAP_ANCHOR_TOP_RIGHT";
|
|
7
|
+
};
|
|
8
|
+
readonly offset: {
|
|
9
|
+
readonly type: PropType<{
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
}>;
|
|
13
|
+
readonly default: {
|
|
14
|
+
readonly x: 0;
|
|
15
|
+
readonly y: 0;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
readonly visible: {
|
|
19
|
+
readonly type: BooleanConstructor;
|
|
20
|
+
readonly default: true;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export type CustomControlProps = ExtractPublicPropTypes<typeof customControlProps>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const customControlProps = {
|
|
2
|
+
anchor: {
|
|
3
|
+
type: String,
|
|
4
|
+
default: "BMAP_ANCHOR_TOP_RIGHT"
|
|
5
|
+
},
|
|
6
|
+
offset: {
|
|
7
|
+
type: Object,
|
|
8
|
+
default: { x: 0, y: 0 }
|
|
9
|
+
},
|
|
10
|
+
visible: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: true
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { customControlProps };
|
|
17
|
+
//# sourceMappingURL=custom-props.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-props.mjs","sources":["../../../../src/control/custom/src/file:/D:/workspaces/personal-project/vue3-bmapgl/packages/vue3-bmapgl/src/control/custom/src/custom-props.ts"],"sourcesContent":["import type { PropType } from 'vue'\r\nimport type { ExtractPublicPropTypes } from '../../../_utils'\r\n\r\nexport const customControlProps = {\r\n anchor: {\r\n type: String,\r\n default: 'BMAP_ANCHOR_TOP_RIGHT',\r\n },\r\n offset: {\r\n type: Object as PropType<{ x: number, y: number }>,\r\n default: { x: 0, y: 0 },\r\n },\r\n visible: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n} as const\r\n\r\nexport type CustomControlProps = ExtractPublicPropTypes<typeof customControlProps>\r\n"],"names":[],"mappings":"AAGO,MAAM,kBAAA,GAAqB;AAAA,EAChC,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACV;AAAA,EACD,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS,EAAE,CAAA,EAAG,CAAA,EAAG,GAAG,CAAA;AAAC,GACtB;AAAA,EACD,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA;;;;;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
readonly anchor: {
|
|
3
|
+
readonly type: StringConstructor;
|
|
4
|
+
readonly default: "BMAP_ANCHOR_TOP_RIGHT";
|
|
5
|
+
};
|
|
6
|
+
readonly offset: {
|
|
7
|
+
readonly type: import("vue").PropType<{
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
}>;
|
|
11
|
+
readonly default: {
|
|
12
|
+
readonly x: 0;
|
|
13
|
+
readonly y: 0;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
readonly visible: {
|
|
17
|
+
readonly type: BooleanConstructor;
|
|
18
|
+
readonly default: true;
|
|
19
|
+
};
|
|
20
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
21
|
+
readonly anchor: {
|
|
22
|
+
readonly type: StringConstructor;
|
|
23
|
+
readonly default: "BMAP_ANCHOR_TOP_RIGHT";
|
|
24
|
+
};
|
|
25
|
+
readonly offset: {
|
|
26
|
+
readonly type: import("vue").PropType<{
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
}>;
|
|
30
|
+
readonly default: {
|
|
31
|
+
readonly x: 0;
|
|
32
|
+
readonly y: 0;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
readonly visible: {
|
|
36
|
+
readonly type: BooleanConstructor;
|
|
37
|
+
readonly default: true;
|
|
38
|
+
};
|
|
39
|
+
}>> & Readonly<{}>, {
|
|
40
|
+
readonly anchor: string;
|
|
41
|
+
readonly offset: {
|
|
42
|
+
x: number;
|
|
43
|
+
y: number;
|
|
44
|
+
};
|
|
45
|
+
readonly visible: boolean;
|
|
46
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
47
|
+
export default _default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { defineComponent, ref, onMounted, watch, onUnmounted, createVNode, withDirectives, resolveDirective } from 'vue';
|
|
2
|
+
import { customControlProps } from './custom-props.mjs';
|
|
3
|
+
import useMapInstance from '../../../_mixins/use-map-instance.mjs';
|
|
4
|
+
|
|
5
|
+
var custom = /* @__PURE__ */ defineComponent({
|
|
6
|
+
name: "CustomControl",
|
|
7
|
+
props: customControlProps,
|
|
8
|
+
setup(props, {
|
|
9
|
+
attrs,
|
|
10
|
+
slots
|
|
11
|
+
}) {
|
|
12
|
+
const mapInstance = useMapInstance();
|
|
13
|
+
const controlContentRef = ref();
|
|
14
|
+
let control = null;
|
|
15
|
+
onMounted(() => {
|
|
16
|
+
const {
|
|
17
|
+
offset,
|
|
18
|
+
anchor,
|
|
19
|
+
visible
|
|
20
|
+
} = props;
|
|
21
|
+
control = new BMapGL.Control();
|
|
22
|
+
control.defaultAnchor = window[anchor];
|
|
23
|
+
control.defaultOffset = new BMapGL.Size(offset.x, offset.y);
|
|
24
|
+
control.initialize = (_map) => {
|
|
25
|
+
return _map.getContainer().appendChild(controlContentRef.value);
|
|
26
|
+
};
|
|
27
|
+
visible && mapInstance().addControl(control);
|
|
28
|
+
watch(() => props.visible, (n) => {
|
|
29
|
+
if (control) mapInstance()[n ? "addControl" : "removeControl"](control);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
onUnmounted(() => {
|
|
33
|
+
if (control) {
|
|
34
|
+
mapInstance().removeControl(control);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return () => {
|
|
38
|
+
var _a;
|
|
39
|
+
return createVNode("div", {
|
|
40
|
+
"style": "display: none"
|
|
41
|
+
}, [withDirectives(createVNode("div", {
|
|
42
|
+
"ref": controlContentRef
|
|
43
|
+
}, [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]), [[resolveDirective("bind"), attrs]])]);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export { custom as default };
|
|
49
|
+
//# sourceMappingURL=custom.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom.mjs","sources":["../../../../src/control/custom/src/file:/D:/workspaces/personal-project/vue3-bmapgl/packages/vue3-bmapgl/src/control/custom/src/custom.tsx"],"sourcesContent":["import { defineComponent, onMounted, onUnmounted, ref, watch } from 'vue'\r\nimport { useMapInstance } from '../../../_mixins'\r\nimport { customControlProps } from './custom-props'\r\n\r\nexport default defineComponent({\r\n name: 'CustomControl',\r\n props: customControlProps,\r\n setup(props, { attrs, slots }) {\r\n const mapInstance = useMapInstance()\r\n\r\n const controlContentRef = ref<HTMLDivElement>()\r\n\r\n let control: BMapGL.Control | null = null\r\n\r\n onMounted(() => {\r\n const { offset, anchor, visible } = props\r\n control = new BMapGL.Control()\r\n control.defaultAnchor = (window as any)[anchor]\r\n control.defaultOffset = new BMapGL.Size(offset.x, offset.y)\r\n control.initialize = (_map: BMapGL.Map) => {\r\n return _map.getContainer().appendChild(controlContentRef.value as Node) as HTMLElement\r\n }\r\n visible && mapInstance().addControl(control)\r\n watch(\r\n () => props.visible,\r\n (n) => {\r\n if (control)\r\n mapInstance()[n ? 'addControl' : 'removeControl'](control)\r\n },\r\n )\r\n })\r\n\r\n onUnmounted(() => {\r\n if (control) {\r\n mapInstance().removeControl(control)\r\n }\r\n })\r\n\r\n return () => (\r\n <div style=\"display: none\">\r\n <div ref={controlContentRef} v-bind={attrs}>{slots.default?.()}</div>\r\n </div>\r\n )\r\n },\r\n})\r\n"],"names":["name","props","customControlProps","setup","attrs","slots","mapInstance","useMapInstance","controlContentRef","ref","control","onMounted","offset","anchor","visible","BMapGL","Control","defaultAnchor","window","defaultOffset","Size","x","y","initialize","_map","getContainer","appendChild","value","addControl","watch","n","onUnmounted","removeControl","_createVNode","_withDirectives","_a","default","call","_resolveDirective"],"mappings":";;;;AAIA,6CAA+B;AAAA,EAC7BA,IAAAA,EAAM,eAAA;AAAA,EACNC,KAAAA,EAAOC,kBAAAA;AAAAA,EACPC,MAAMF,KAAAA,EAAO;AAAA,IAAEG,KAAAA;AAAAA,IAAOC;AAAAA,GAAK,EAAE;AAC3B,IAAA,MAAMC,cAAcC,cAAAA,EAAc;AAElC,IAAA,MAAMC,oBAAoBC,GAAAA,EAAG;AAE7B,IAAA,IAAIC,OAAAA,GAAiC,IAAA;AAErCC,IAAAA,SAAAA,CAAU,MAAK;AACb,MAAA,MAAM;AAAA,QAAEC,MAAAA;AAAAA,QAAQC,MAAAA;AAAAA,QAAQC;AAAAA,OAAO,GAAKb,KAAAA;AACpCS,MAAAA,OAAAA,GAAU,IAAIK,OAAOC,OAAAA;AACrBN,MAAAA,OAAAA,CAAQO,aAAAA,GAAiBC,OAAeL,MAAM,CAAA;AAC9CH,MAAAA,OAAAA,CAAQS,gBAAgB,IAAIJ,MAAAA,CAAOK,KAAKR,MAAAA,CAAOS,CAAAA,EAAGT,OAAOU,CAAC,CAAA;AAC1DZ,MAAAA,OAAAA,CAAQa,aAAcC,CAAAA,IAAAA,KAAoB;AACxC,QAAA,OAAOA,IAAAA,CAAKC,YAAAA,EAAY,CAAGC,WAAAA,CAAYlB,kBAAkBmB,KAAa,CAAA;AAAA,MACxE,CAAA;AACAb,MAAAA,OAAAA,IAAWR,WAAAA,EAAW,CAAGsB,UAAAA,CAAWlB,OAAO,CAAA;AAC3CmB,MAAAA,KAAAA,CACE,MAAM5B,KAAAA,CAAMa,OAAAA,EACXgB,CAAAA,CAAAA,KAAK;AACJ,QAAA,IAAIpB,SACFJ,WAAAA,EAAW,CAAGwB,IAAI,YAAA,GAAe,eAAe,EAAEpB,OAAO,CAAA;AAAA,MAC7D,CAAC,CAAA;AAAA,IAEL,CAAC,CAAA;AAEDqB,IAAAA,WAAAA,CAAY,MAAK;AACf,MAAA,IAAIrB,OAAAA,EAAS;AACXJ,QAAAA,WAAAA,GAAc0B,cAActB,OAAO,CAAA;AAAA,MACrC;AAAA,IACF,CAAC,CAAA;AAED,IAAA,OAAO,MAAK;;AAAC,MAAA,OAAAuB,YAAA,KAAA,EAAA;AAAA,QAAA,OAAA,EAAA;AAAA,OAAA,EAAA,CAAAC,cAAAA,CAAAD,WAAAA,CAAA,KAAA,EAAA;AAAA,QAAA,KAAA,EAECzB;AAAAA,OAAiB,EAAA,CAAA,CAAkB2B,EAAAA,GAAA9B,KAAAA,CAAM+B,OAAAA,MAAO,QAAAD,EAAAA,KAAA,MAAA,GAAA,MAAA,GAAAA,EAAAA,CAAAE,IAAAA,CAAAhC,KAAA,CAAI,CAAA,CAAA,EAAA,CAAA,CAAAiC,gBAAAA,CAAA,MAAA,GAAzBlC,KAAK,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA;EAGhD;AACD,CAAA,CAAA;;;;"}
|