@spuermomonga/vue3-bmapgl 0.0.4 → 0.0.6
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 +361 -31
- package/dist/index.prod.js +1 -1
- package/es/_mixins/index.d.ts +1 -0
- package/es/_mixins/index.mjs +1 -0
- package/es/_mixins/index.mjs.map +1 -1
- package/es/_mixins/use-config.mjs +19 -8
- package/es/_mixins/use-config.mjs.map +1 -1
- package/es/_mixins/use-map-instance.d.ts +1 -0
- package/es/_mixins/use-map-instance.mjs +10 -0
- package/es/_mixins/use-map-instance.mjs.map +1 -0
- package/es/_utils/call.d.ts +7 -0
- package/es/_utils/call.mjs +10 -0
- package/es/_utils/call.mjs.map +1 -0
- package/es/_utils/index.d.ts +1 -0
- package/es/_utils/index.mjs +2 -1
- package/es/_utils/index.mjs.map +1 -1
- package/es/_utils/map.d.ts +1 -0
- package/es/_utils/map.mjs +14 -1
- package/es/_utils/map.mjs.map +1 -1
- package/es/components.d.ts +4 -0
- package/es/components.mjs +7 -0
- package/es/components.mjs.map +1 -1
- package/es/config-provider/src/config-provider-props.d.ts +10 -1
- package/es/config-provider/src/config-provider-props.mjs.map +1 -1
- package/es/index.mjs +7 -0
- package/es/index.mjs.map +1 -1
- package/es/layer/tile/index.d.ts +1 -0
- package/es/layer/tile/index.mjs +1 -1
- package/es/layer/tile/src/tile.mjs +1 -1
- package/es/layer/tile/src/tile.mjs.map +1 -1
- package/es/layer/xyz/index.d.ts +3 -0
- package/es/layer/xyz/index.mjs +2 -1
- package/es/layer/xyz/index.mjs.map +1 -1
- package/es/layer/xyz/src/xyz-props.d.ts +16 -0
- package/es/layer/xyz/src/xyz-props.mjs +13 -0
- package/es/layer/xyz/src/xyz-props.mjs.map +1 -0
- package/es/layer/xyz/src/xyz.d.ts +22 -1
- package/es/layer/xyz/src/xyz.mjs +62 -4
- package/es/layer/xyz/src/xyz.mjs.map +1 -1
- package/es/map/index.d.ts +1 -0
- package/es/map/index.mjs +1 -0
- package/es/map/index.mjs.map +1 -1
- package/es/map/src/constants.d.ts +3 -0
- package/es/map/src/constants.mjs +4 -0
- package/es/map/src/constants.mjs.map +1 -0
- package/es/map/src/interface.d.ts +6 -0
- package/es/map/src/interface.mjs +2 -0
- package/es/map/src/interface.mjs.map +1 -0
- package/es/map/src/map-props.d.ts +42 -0
- package/es/map/src/map-props.mjs +42 -1
- package/es/map/src/map-props.mjs.map +1 -1
- package/es/map/src/map.d.ts +91 -0
- package/es/map/src/map.mjs +81 -22
- package/es/map/src/map.mjs.map +1 -1
- package/es/map/src/style/map.module.css.mjs +2 -2
- package/es/node_modules/.pnpm/@rollup_plugin-typescript@1_b93953ac7ab797e62adf5212a782f0d9/node_modules/tslib/tslib.es6.mjs +36 -0
- package/es/node_modules/.pnpm/@rollup_plugin-typescript@1_b93953ac7ab797e62adf5212a782f0d9/node_modules/tslib/tslib.es6.mjs.map +1 -0
- package/es/overlay/polygon/index.d.ts +3 -0
- package/es/overlay/polygon/index.mjs +2 -1
- package/es/overlay/polygon/index.mjs.map +1 -1
- package/es/overlay/polygon/src/polygon-props.d.ts +51 -0
- package/es/overlay/polygon/src/polygon-props.mjs +51 -0
- package/es/overlay/polygon/src/polygon-props.mjs.map +1 -0
- package/es/overlay/polygon/src/polygon.d.ts +108 -0
- package/es/overlay/polygon/src/polygon.mjs +63 -0
- package/es/overlay/polygon/src/polygon.mjs.map +1 -0
- package/es/overlay/sector/index.d.ts +1 -0
- package/es/overlay/sector/index.mjs +2 -0
- package/es/overlay/sector/index.mjs.map +1 -0
- package/es/overlay/sector/src/sector-props.mjs +2 -0
- package/es/overlay/sector/src/sector-props.mjs.map +1 -0
- package/es/overlay/sector/src/sector.d.ts +2 -0
- package/es/overlay/sector/src/sector.mjs +11 -0
- package/es/overlay/sector/src/sector.mjs.map +1 -0
- package/lib/_mixins/index.d.ts +1 -0
- package/lib/_mixins/index.js +2 -0
- package/lib/_mixins/index.js.map +1 -1
- package/lib/_mixins/use-config.js +19 -8
- package/lib/_mixins/use-config.js.map +1 -1
- package/lib/_mixins/use-map-instance.d.ts +1 -0
- package/lib/_mixins/use-map-instance.js +12 -0
- package/lib/_mixins/use-map-instance.js.map +1 -0
- package/lib/_utils/call.d.ts +7 -0
- package/lib/_utils/call.js +12 -0
- package/lib/_utils/call.js.map +1 -0
- package/lib/_utils/index.d.ts +1 -0
- package/lib/_utils/index.js +3 -0
- package/lib/_utils/index.js.map +1 -1
- package/lib/_utils/map.d.ts +1 -0
- package/lib/_utils/map.js +14 -0
- package/lib/_utils/map.js.map +1 -1
- package/lib/components.d.ts +4 -0
- package/lib/components.js +14 -0
- package/lib/components.js.map +1 -1
- package/lib/config-provider/src/config-provider-props.d.ts +10 -1
- package/lib/config-provider/src/config-provider-props.js.map +1 -1
- package/lib/index.js +14 -0
- package/lib/index.js.map +1 -1
- package/lib/layer/tile/index.d.ts +1 -0
- package/lib/layer/tile/index.js +5 -0
- package/lib/layer/tile/index.js.map +1 -1
- package/lib/layer/tile/src/tile.js +1 -1
- package/lib/layer/tile/src/tile.js.map +1 -1
- package/lib/layer/xyz/index.d.ts +3 -0
- package/lib/layer/xyz/index.js +7 -0
- package/lib/layer/xyz/index.js.map +1 -1
- package/lib/layer/xyz/src/xyz-props.d.ts +16 -0
- package/lib/layer/xyz/src/xyz-props.js +15 -0
- package/lib/layer/xyz/src/xyz-props.js.map +1 -0
- package/lib/layer/xyz/src/xyz.d.ts +22 -1
- package/lib/layer/xyz/src/xyz.js +61 -3
- package/lib/layer/xyz/src/xyz.js.map +1 -1
- package/lib/map/index.d.ts +1 -0
- package/lib/map/index.js +2 -0
- package/lib/map/index.js.map +1 -1
- package/lib/map/src/constants.d.ts +3 -0
- package/lib/map/src/constants.js +6 -0
- package/lib/map/src/constants.js.map +1 -0
- package/lib/map/src/interface.d.ts +6 -0
- package/lib/map/src/interface.js +3 -0
- package/lib/map/src/interface.js.map +1 -0
- package/lib/map/src/map-props.d.ts +42 -0
- package/lib/map/src/map-props.js +42 -1
- package/lib/map/src/map-props.js.map +1 -1
- package/lib/map/src/map.d.ts +91 -0
- package/lib/map/src/map.js +80 -21
- package/lib/map/src/map.js.map +1 -1
- package/lib/map/src/style/map.module.css.js +2 -2
- package/lib/node_modules/.pnpm/@rollup_plugin-typescript@1_b93953ac7ab797e62adf5212a782f0d9/node_modules/tslib/tslib.es6.js +38 -0
- package/lib/node_modules/.pnpm/@rollup_plugin-typescript@1_b93953ac7ab797e62adf5212a782f0d9/node_modules/tslib/tslib.es6.js.map +1 -0
- package/lib/overlay/polygon/index.d.ts +3 -0
- package/lib/overlay/polygon/index.js +7 -0
- package/lib/overlay/polygon/index.js.map +1 -1
- package/lib/overlay/polygon/src/polygon-props.d.ts +51 -0
- package/lib/overlay/polygon/src/polygon-props.js +53 -0
- package/lib/overlay/polygon/src/polygon-props.js.map +1 -0
- package/lib/overlay/polygon/src/polygon.d.ts +108 -0
- package/lib/overlay/polygon/src/polygon.js +65 -0
- package/lib/overlay/polygon/src/polygon.js.map +1 -0
- package/lib/overlay/sector/index.d.ts +1 -0
- package/lib/overlay/sector/index.js +8 -0
- package/lib/overlay/sector/index.js.map +1 -0
- package/lib/overlay/sector/src/sector-props.js +3 -0
- package/lib/overlay/sector/src/sector-props.js.map +1 -0
- package/lib/overlay/sector/src/sector.d.ts +2 -0
- package/lib/overlay/sector/src/sector.js +13 -0
- package/lib/overlay/sector/src/sector.js.map +1 -0
- package/package.json +2 -2
- package/es/overlay/polygon/src/Polygon.vue.mjs +0 -11
- package/es/overlay/polygon/src/Polygon.vue.mjs.map +0 -1
- package/lib/overlay/polygon/src/Polygon.vue.js +0 -13
- package/lib/overlay/polygon/src/Polygon.vue.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -50,6 +50,19 @@
|
|
|
50
50
|
document.body.appendChild(script);
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
+
function listToMapPoints(points) {
|
|
54
|
+
if (!points || points.length === 0) {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
const first = points[0];
|
|
58
|
+
if (Array.isArray(first)) {
|
|
59
|
+
return points.map(([lng, lat]) => new BMapGL.Point(lng, lat));
|
|
60
|
+
}
|
|
61
|
+
if (typeof first === "string") {
|
|
62
|
+
return points;
|
|
63
|
+
}
|
|
64
|
+
return points;
|
|
65
|
+
}
|
|
53
66
|
|
|
54
67
|
function ensureValidVNode(vnodes) {
|
|
55
68
|
return vnodes.some((child) => {
|
|
@@ -101,22 +114,42 @@
|
|
|
101
114
|
}
|
|
102
115
|
});
|
|
103
116
|
|
|
117
|
+
var tile = /* @__PURE__ */ vue.defineComponent({
|
|
118
|
+
name: "TileLayer",
|
|
119
|
+
setup() {
|
|
120
|
+
return () => vue.createVNode("div", null, [vue.createTextVNode("Tile")]);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
|
|
104
124
|
function useConfig(props = {}) {
|
|
105
|
-
const
|
|
125
|
+
const BConfigProvider = vue.inject(configProviderInjectionKey, null);
|
|
106
126
|
return {
|
|
107
|
-
mergedStatusRef:
|
|
127
|
+
mergedStatusRef: BConfigProvider?.mergedStatusRef,
|
|
108
128
|
mergedMapSetRef: vue.computed(() => {
|
|
109
|
-
const { zoom, center, minZoom, maxZoom } = props;
|
|
129
|
+
const { zoom, center, heading, minZoom, maxZoom, enableScrollWheelZoom, enableDragging, tilt, enableTilt, mapType, enableAutoResize, enableTiltGestures, enableRotate, enableRotateGestures, displayOptions } = props;
|
|
110
130
|
return {
|
|
111
|
-
zoom: zoom ??
|
|
112
|
-
center: center ??
|
|
113
|
-
|
|
114
|
-
|
|
131
|
+
zoom: zoom ?? BConfigProvider?.mergedMapSetRef.value?.zoom,
|
|
132
|
+
center: center ?? BConfigProvider?.mergedMapSetRef.value?.center,
|
|
133
|
+
heading: heading ?? BConfigProvider?.mergedMapSetRef.value?.heading,
|
|
134
|
+
minZoom: minZoom ?? BConfigProvider?.mergedMapSetRef.value?.minZoom,
|
|
135
|
+
maxZoom: maxZoom ?? BConfigProvider?.mergedMapSetRef.value?.maxZoom,
|
|
136
|
+
enableScrollWheelZoom: enableScrollWheelZoom ?? BConfigProvider?.mergedMapSetRef.value?.enableScrollWheelZoom,
|
|
137
|
+
enableDragging: enableDragging ?? BConfigProvider?.mergedMapSetRef.value?.enableDragging,
|
|
138
|
+
tilt: tilt ?? BConfigProvider?.mergedMapSetRef.value?.tilt,
|
|
139
|
+
enableTilt: enableTilt ?? BConfigProvider?.mergedMapSetRef.value?.enableTilt,
|
|
140
|
+
mapType: mapType ?? BConfigProvider?.mergedMapSetRef.value?.mapType,
|
|
141
|
+
enableAutoResize: enableAutoResize ?? BConfigProvider?.mergedMapSetRef.value?.enableAutoResize,
|
|
142
|
+
enableTiltGestures: enableTiltGestures ?? BConfigProvider?.mergedMapSetRef.value?.enableTiltGestures,
|
|
143
|
+
enableRotate: enableRotate ?? BConfigProvider?.mergedMapSetRef.value?.enableRotate,
|
|
144
|
+
enableRotateGestures: enableRotateGestures ?? BConfigProvider?.mergedMapSetRef.value?.enableRotateGestures,
|
|
145
|
+
displayOptions: displayOptions ?? BConfigProvider?.mergedMapSetRef.value?.displayOptions
|
|
115
146
|
};
|
|
116
147
|
})
|
|
117
148
|
};
|
|
118
149
|
}
|
|
119
150
|
|
|
151
|
+
const mapInjectionKey = /* @__PURE__ */ Symbol("b-map");
|
|
152
|
+
|
|
120
153
|
const mapProps = {
|
|
121
154
|
maxZoom: {
|
|
122
155
|
type: Number,
|
|
@@ -126,6 +159,10 @@
|
|
|
126
159
|
type: Number,
|
|
127
160
|
default: 0
|
|
128
161
|
},
|
|
162
|
+
heading: {
|
|
163
|
+
type: Number,
|
|
164
|
+
default: 0
|
|
165
|
+
},
|
|
129
166
|
center: {
|
|
130
167
|
type: Object,
|
|
131
168
|
default: [116.403901, 39.915185]
|
|
@@ -135,10 +172,47 @@
|
|
|
135
172
|
default: 14
|
|
136
173
|
},
|
|
137
174
|
class: String,
|
|
175
|
+
contentClass: String,
|
|
138
176
|
enableScrollWheelZoom: {
|
|
139
177
|
type: Boolean,
|
|
140
178
|
default: false
|
|
141
|
-
}
|
|
179
|
+
},
|
|
180
|
+
enableDragging: {
|
|
181
|
+
type: Boolean,
|
|
182
|
+
default: true
|
|
183
|
+
},
|
|
184
|
+
tilt: {
|
|
185
|
+
type: Number,
|
|
186
|
+
default: 0
|
|
187
|
+
},
|
|
188
|
+
enableTilt: {
|
|
189
|
+
type: Boolean,
|
|
190
|
+
default: false
|
|
191
|
+
},
|
|
192
|
+
mapType: {
|
|
193
|
+
type: String,
|
|
194
|
+
default: "BMAP_NORMAL_MAP"
|
|
195
|
+
},
|
|
196
|
+
enableAutoResize: {
|
|
197
|
+
type: Boolean,
|
|
198
|
+
default: true
|
|
199
|
+
},
|
|
200
|
+
enableTiltGestures: {
|
|
201
|
+
type: Boolean,
|
|
202
|
+
default: false
|
|
203
|
+
},
|
|
204
|
+
enableRotate: {
|
|
205
|
+
type: Boolean,
|
|
206
|
+
default: false
|
|
207
|
+
},
|
|
208
|
+
enableRotateGestures: {
|
|
209
|
+
type: Boolean,
|
|
210
|
+
default: false
|
|
211
|
+
},
|
|
212
|
+
displayOptions: {
|
|
213
|
+
type: Object
|
|
214
|
+
},
|
|
215
|
+
onInitd: Function
|
|
142
216
|
};
|
|
143
217
|
|
|
144
218
|
function styleInject(css, ref) {
|
|
@@ -168,8 +242,8 @@
|
|
|
168
242
|
}
|
|
169
243
|
}
|
|
170
244
|
|
|
171
|
-
var css_248z = ".map-module_b-map-content__sMaJG{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%)}";
|
|
172
|
-
var styles = {"b-map-content":"map-module_b-map-content__sMaJG","b-map-loading":"map-module_b-map-loading__qc4a8","b-map-failed":"map-module_b-map-failed__-w-tX"};
|
|
245
|
+
var css_248z = ".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%)}";
|
|
246
|
+
var styles = {"b-map":"map-module_b-map__29r3m","b-map-content":"map-module_b-map-content__sMaJG","b-map-loading":"map-module_b-map-loading__qc4a8","b-map-failed":"map-module_b-map-failed__-w-tX"};
|
|
173
247
|
styleInject(css_248z);
|
|
174
248
|
|
|
175
249
|
var map = /* @__PURE__ */ vue.defineComponent({
|
|
@@ -185,63 +259,312 @@
|
|
|
185
259
|
} = useConfig(props);
|
|
186
260
|
const contentRef = vue.ref();
|
|
187
261
|
let map = null;
|
|
262
|
+
const initd = vue.ref(false);
|
|
263
|
+
vue.provide(mapInjectionKey, {
|
|
264
|
+
mapInstance: () => map
|
|
265
|
+
});
|
|
188
266
|
const setCenterAndZoom = (center) => {
|
|
189
267
|
if (typeof center === "string") {
|
|
190
|
-
map
|
|
268
|
+
map?.centerAndZoom(center, mergedMapSetRef.value.zoom);
|
|
191
269
|
} else if (Array.isArray(center)) {
|
|
192
|
-
map
|
|
270
|
+
map?.centerAndZoom(new BMapGL.Point(center[0], center[1]), mergedMapSetRef.value.zoom);
|
|
193
271
|
} else {
|
|
194
|
-
map
|
|
272
|
+
map?.centerAndZoom(center, mergedMapSetRef.value.zoom);
|
|
195
273
|
}
|
|
196
274
|
};
|
|
197
275
|
const setScrollWheelZoom = (enableScrollWheelZoom) => {
|
|
198
276
|
enableScrollWheelZoom ? map.enableScrollWheelZoom() : map.disableScrollWheelZoom();
|
|
199
277
|
};
|
|
200
|
-
const
|
|
278
|
+
const setDisplayOptions = (displayOptions) => {
|
|
279
|
+
map?.setDisplayOptions(displayOptions || {});
|
|
280
|
+
};
|
|
281
|
+
const setTilt = (tilt) => {
|
|
282
|
+
map?.setTilt(tilt ?? 0);
|
|
283
|
+
};
|
|
284
|
+
const setHeading = (heading) => {
|
|
285
|
+
map?.setHeading(heading ?? 0);
|
|
286
|
+
};
|
|
287
|
+
const setDragging = (enableDragging) => {
|
|
288
|
+
enableDragging ? map.enableDragging() : map.disableDragging();
|
|
289
|
+
};
|
|
290
|
+
const setMapType = (mapType) => {
|
|
291
|
+
window[mapType] !== void 0 && map.setMapType(window[mapType]);
|
|
292
|
+
};
|
|
293
|
+
const initMapOptions = () => {
|
|
201
294
|
const {
|
|
202
295
|
center,
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
296
|
+
heading,
|
|
297
|
+
enableScrollWheelZoom,
|
|
298
|
+
tilt,
|
|
299
|
+
enableDragging
|
|
206
300
|
} = mergedMapSetRef.value;
|
|
207
|
-
|
|
208
|
-
maxZoom,
|
|
209
|
-
minZoom
|
|
210
|
-
});
|
|
301
|
+
setHeading(heading);
|
|
211
302
|
setCenterAndZoom(center);
|
|
212
303
|
setScrollWheelZoom(enableScrollWheelZoom);
|
|
304
|
+
setTilt(tilt);
|
|
305
|
+
setDragging(enableDragging);
|
|
213
306
|
};
|
|
214
307
|
const startWatchProps = () => {
|
|
215
308
|
vue.watch(() => mergedMapSetRef.value.center, setCenterAndZoom, {
|
|
216
309
|
deep: true
|
|
217
310
|
});
|
|
218
311
|
vue.watch(() => mergedMapSetRef.value.enableScrollWheelZoom, setScrollWheelZoom);
|
|
312
|
+
vue.watch(() => mergedMapSetRef.value.displayOptions, setDisplayOptions);
|
|
313
|
+
vue.watch(() => mergedMapSetRef.value.tilt, setTilt);
|
|
314
|
+
vue.watch(() => mergedMapSetRef.value.heading, setHeading);
|
|
315
|
+
vue.watch(() => mergedMapSetRef.value.enableDragging, setDragging);
|
|
316
|
+
vue.watch(() => mergedMapSetRef.value.mapType, setMapType);
|
|
219
317
|
};
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
318
|
+
const init = () => {
|
|
319
|
+
const {
|
|
320
|
+
maxZoom,
|
|
321
|
+
minZoom,
|
|
322
|
+
enableTilt,
|
|
323
|
+
mapType,
|
|
324
|
+
enableAutoResize,
|
|
325
|
+
enableTiltGestures,
|
|
326
|
+
enableRotate,
|
|
327
|
+
enableRotateGestures,
|
|
328
|
+
displayOptions
|
|
329
|
+
} = mergedMapSetRef.value;
|
|
330
|
+
map = new BMapGL.Map(contentRef.value, {
|
|
331
|
+
maxZoom,
|
|
332
|
+
minZoom,
|
|
333
|
+
enableTilt,
|
|
334
|
+
mapType: window[mapType],
|
|
335
|
+
enableAutoResize,
|
|
336
|
+
enableTiltGestures,
|
|
337
|
+
enableRotate,
|
|
338
|
+
enableRotateGestures,
|
|
339
|
+
displayOptions
|
|
340
|
+
});
|
|
341
|
+
const {
|
|
342
|
+
onInitd
|
|
343
|
+
} = props;
|
|
344
|
+
initMapOptions();
|
|
345
|
+
startWatchProps();
|
|
346
|
+
onInitd?.({
|
|
347
|
+
map
|
|
348
|
+
});
|
|
349
|
+
initd.value = true;
|
|
350
|
+
};
|
|
351
|
+
vue.onMounted(() => {
|
|
352
|
+
vue.watchEffect(() => {
|
|
353
|
+
if (mergedStatusRef?.value === "loaded" && !initd.value) {
|
|
354
|
+
vue.nextTick(init);
|
|
355
|
+
}
|
|
356
|
+
});
|
|
227
357
|
});
|
|
228
358
|
vue.onUnmounted(() => {
|
|
229
359
|
if (map) {
|
|
230
360
|
try {
|
|
231
|
-
map
|
|
361
|
+
map?.destroy();
|
|
232
362
|
} catch (error) {
|
|
233
363
|
console.error(`[Vue3 BMapGL]: ${error.message}`);
|
|
234
364
|
}
|
|
235
365
|
}
|
|
236
366
|
});
|
|
237
367
|
return () => vue.createVNode("div", {
|
|
368
|
+
"class": [[styles["b-map"]], props.class]
|
|
369
|
+
}, [vue.createVNode("div", {
|
|
238
370
|
"ref": contentRef,
|
|
239
|
-
"class": [styles["b-map-content"], props.
|
|
371
|
+
"class": [styles["b-map-content"], props.contentClass]
|
|
240
372
|
}, [mergedStatusRef?.value === "pending" && resolveWrappedSlot(slots.loading, () => vue.createVNode("div", {
|
|
241
373
|
"class": [styles["b-map-loading"]]
|
|
242
374
|
}, [vue.createTextVNode("map loading...")])), mergedStatusRef?.value === "failed" && resolveWrappedSlot(slots.failed, () => vue.createVNode("div", {
|
|
243
375
|
"class": [styles["b-map-failed"]]
|
|
244
|
-
}, [vue.createTextVNode("map failed")])), slots.default?.()]);
|
|
376
|
+
}, [vue.createTextVNode("map failed")]))]), initd.value && slots.default?.()]);
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
function useMapInstance() {
|
|
381
|
+
const BMap = vue.inject(mapInjectionKey, null);
|
|
382
|
+
return BMap.mapInstance;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
const xyzLayerProps = {
|
|
386
|
+
visible: {
|
|
387
|
+
type: Boolean,
|
|
388
|
+
default: true
|
|
389
|
+
},
|
|
390
|
+
options: {
|
|
391
|
+
type: Object,
|
|
392
|
+
default: {}
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
var xyz = /* @__PURE__ */ vue.defineComponent({
|
|
397
|
+
name: "XyzLayer",
|
|
398
|
+
props: xyzLayerProps,
|
|
399
|
+
setup(props) {
|
|
400
|
+
const mapInstance = useMapInstance();
|
|
401
|
+
let layer = null;
|
|
402
|
+
const addTileLayer = (layer2) => {
|
|
403
|
+
const {
|
|
404
|
+
getTile
|
|
405
|
+
} = props.options;
|
|
406
|
+
if (getTile) {
|
|
407
|
+
mapInstance().addTileLayer(layer2);
|
|
408
|
+
layer2.loadRasterTileData = function(tileInfo, callback) {
|
|
409
|
+
const key = this.getTileKey(tileInfo);
|
|
410
|
+
const handleImageLoad = (image) => {
|
|
411
|
+
image.tileInfo = tileInfo;
|
|
412
|
+
callback && callback(image, key);
|
|
413
|
+
};
|
|
414
|
+
const handleError = () => callback && callback(null, key);
|
|
415
|
+
getTile(tileInfo, (img) => {
|
|
416
|
+
if (typeof img === "string" || img instanceof HTMLCanvasElement) {
|
|
417
|
+
const image = new Image();
|
|
418
|
+
image.crossOrigin = "anonymous";
|
|
419
|
+
image.onload = () => handleImageLoad(image);
|
|
420
|
+
image.onerror = handleError;
|
|
421
|
+
image.src = typeof img === "string" ? img : img.toDataURL();
|
|
422
|
+
} else if (img instanceof HTMLImageElement) {
|
|
423
|
+
handleImageLoad(img);
|
|
424
|
+
} else {
|
|
425
|
+
handleError();
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
};
|
|
429
|
+
} else {
|
|
430
|
+
mapInstance().addTileLayer(layer2);
|
|
431
|
+
}
|
|
432
|
+
};
|
|
433
|
+
const removeTileLayer = (layer2) => {
|
|
434
|
+
mapInstance().removeTileLayer(layer2);
|
|
435
|
+
};
|
|
436
|
+
const createLayer = () => {
|
|
437
|
+
if (layer) {
|
|
438
|
+
removeTileLayer(layer);
|
|
439
|
+
}
|
|
440
|
+
const {
|
|
441
|
+
getTile,
|
|
442
|
+
...retProps
|
|
443
|
+
} = props.options;
|
|
444
|
+
layer = new BMapGL.XYZLayer(retProps);
|
|
445
|
+
addTileLayer(layer);
|
|
446
|
+
};
|
|
447
|
+
props.visible && createLayer();
|
|
448
|
+
vue.watch(() => props.visible, (n) => layer && (n ? addTileLayer(layer) : removeTileLayer(layer)));
|
|
449
|
+
vue.watch(() => props.options, () => createLayer());
|
|
450
|
+
vue.onUnmounted(() => {
|
|
451
|
+
if (layer) {
|
|
452
|
+
mapInstance().removeTileLayer(layer);
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
return () => vue.createVNode(vue.Fragment, null, null);
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
const polygonProps = {
|
|
460
|
+
visible: {
|
|
461
|
+
type: Boolean,
|
|
462
|
+
default: true
|
|
463
|
+
},
|
|
464
|
+
points: {
|
|
465
|
+
type: Array
|
|
466
|
+
},
|
|
467
|
+
strokeColor: {
|
|
468
|
+
type: String,
|
|
469
|
+
default: "#000"
|
|
470
|
+
},
|
|
471
|
+
fillColor: {
|
|
472
|
+
type: String,
|
|
473
|
+
default: "#fff"
|
|
474
|
+
},
|
|
475
|
+
strokeWeight: {
|
|
476
|
+
type: Number,
|
|
477
|
+
default: 2
|
|
478
|
+
},
|
|
479
|
+
strokeOpacity: {
|
|
480
|
+
type: Number,
|
|
481
|
+
default: 1
|
|
482
|
+
},
|
|
483
|
+
fillOpacity: {
|
|
484
|
+
type: Number,
|
|
485
|
+
default: 0.3
|
|
486
|
+
},
|
|
487
|
+
strokeStyle: {
|
|
488
|
+
type: String,
|
|
489
|
+
default: "solid"
|
|
490
|
+
},
|
|
491
|
+
enableMassClear: {
|
|
492
|
+
type: Boolean,
|
|
493
|
+
default: true
|
|
494
|
+
},
|
|
495
|
+
enableEditing: {
|
|
496
|
+
type: Boolean,
|
|
497
|
+
default: false
|
|
498
|
+
},
|
|
499
|
+
isBoundary: {
|
|
500
|
+
type: Boolean
|
|
501
|
+
},
|
|
502
|
+
enableClicking: {
|
|
503
|
+
type: Boolean,
|
|
504
|
+
default: true
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
var polygon = /* @__PURE__ */ vue.defineComponent({
|
|
509
|
+
name: "Polygon",
|
|
510
|
+
props: polygonProps,
|
|
511
|
+
setup: (props) => {
|
|
512
|
+
const mapInstance = useMapInstance();
|
|
513
|
+
let overlay = null;
|
|
514
|
+
const setStrokeColor = (color) => {
|
|
515
|
+
overlay && overlay.setStrokeColor(color);
|
|
516
|
+
};
|
|
517
|
+
const startWatchProps = () => {
|
|
518
|
+
vue.watch(() => props.strokeColor, setStrokeColor);
|
|
519
|
+
vue.watch(() => props.visible, (n) => {
|
|
520
|
+
mapInstance()[n ? "addOverlay" : "removeOverlay"](overlay);
|
|
521
|
+
});
|
|
522
|
+
};
|
|
523
|
+
const init = () => {
|
|
524
|
+
const {
|
|
525
|
+
points,
|
|
526
|
+
visible,
|
|
527
|
+
strokeColor,
|
|
528
|
+
fillColor,
|
|
529
|
+
strokeWeight,
|
|
530
|
+
strokeOpacity,
|
|
531
|
+
fillOpacity,
|
|
532
|
+
strokeStyle,
|
|
533
|
+
enableMassClear,
|
|
534
|
+
enableEditing,
|
|
535
|
+
enableClicking
|
|
536
|
+
} = props;
|
|
537
|
+
if (!points || !points.length) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
overlay = new BMapGL.Polygon(listToMapPoints(points), {
|
|
541
|
+
strokeColor,
|
|
542
|
+
fillColor,
|
|
543
|
+
strokeWeight,
|
|
544
|
+
strokeOpacity,
|
|
545
|
+
fillOpacity,
|
|
546
|
+
strokeStyle,
|
|
547
|
+
enableMassClear,
|
|
548
|
+
enableEditing,
|
|
549
|
+
enableClicking
|
|
550
|
+
});
|
|
551
|
+
visible && mapInstance().addOverlay(overlay);
|
|
552
|
+
startWatchProps();
|
|
553
|
+
};
|
|
554
|
+
init();
|
|
555
|
+
vue.onUnmounted(() => {
|
|
556
|
+
if (overlay) {
|
|
557
|
+
mapInstance().removeOverlay(overlay);
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
return () => vue.createVNode(vue.Fragment, null, null);
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
|
|
564
|
+
var sector = /* @__PURE__ */ vue.defineComponent({
|
|
565
|
+
name: "Sector",
|
|
566
|
+
setup: () => {
|
|
567
|
+
return () => vue.createVNode(vue.Fragment, null, null);
|
|
245
568
|
}
|
|
246
569
|
});
|
|
247
570
|
|
|
@@ -281,9 +604,16 @@
|
|
|
281
604
|
|
|
282
605
|
exports.BConfigProvider = configProvider;
|
|
283
606
|
exports.BMap = map;
|
|
607
|
+
exports.BPolygon = polygon;
|
|
608
|
+
exports.BSector = sector;
|
|
609
|
+
exports.BTileLayer = tile;
|
|
610
|
+
exports.BXyzLayer = xyz;
|
|
284
611
|
exports.configProviderInjectionKey = configProviderInjectionKey;
|
|
285
612
|
exports.configProviderProps = configProviderProps;
|
|
286
613
|
exports.create = create;
|
|
614
|
+
exports.mapInjectionKey = mapInjectionKey;
|
|
287
615
|
exports.mapProps = mapProps;
|
|
616
|
+
exports.polygonProps = polygonProps;
|
|
617
|
+
exports.xyzLayerProps = xyzLayerProps;
|
|
288
618
|
|
|
289
619
|
}));
|
package/dist/index.prod.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,
|
|
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 a=!1;function o(e){return e.some(e=>!t.isVNode(e)||e.type!==Comment&&!(e.type===t.Fragment&&!o(e.children)))?e:null}function n(e,t){return t(e&&o(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:o}){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:o,addCalToWindow:n=!0,timeout:l=1e4}=e;return a&&window.BMapGL?Promise.resolve():new Promise((e,r)=>{const i=document.createElement("script");i.src=o,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: ${o}`))},l),d=()=>{clearTimeout(p),a=!0,s(),e()};n?window[t]=d:i.onload=d,i.onerror=()=>{clearTimeout(p),s(),r(new Error(`Failed to load script: ${o}`))},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(o,"default")}}),s=t.defineComponent({name:"TileLayer",setup:()=>()=>t.createVNode("div",null,[t.createTextVNode("Tile")])});const p=Symbol("b-map"),d={maxZoom:{type:Number,default:21},minZoom:{type:Number,default:0},heading:{type:Number,default:0},center:{type:Object,default:[116.403901,39.915185]},zoom:{type:Number,default:14},class:String,contentClass:String,enableScrollWheelZoom:{type:Boolean,default:!1},enableDragging:{type:Boolean,default:!0},tilt:{type:Number,default:0},enableTilt:{type:Boolean,default:!1},mapType:{type:String,default:"BMAP_NORMAL_MAP"},enableAutoResize:{type:Boolean,default:!0},enableTiltGestures:{type:Boolean,default:!1},enableRotate:{type:Boolean,default:!1},enableRotateGestures:{type:Boolean,default:!1},displayOptions:{type:Object},onInitd:Function};var u="map-module_b-map__29r3m",m="map-module_b-map-content__sMaJG",c="map-module_b-map-loading__qc4a8",f="map-module_b-map-failed__-w-tX";!function(e,t){void 0===t&&(t={});var a=t.insertAt;if("undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===a&&o.firstChild?o.insertBefore(n,o.firstChild):o.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:d,slots:Object,setup(e,{slots:a}){const{mergedMapSetRef:o,mergedStatusRef:l}=function(e={}){const a=t.inject(r,null);return{mergedStatusRef:a?.mergedStatusRef,mergedMapSetRef:t.computed(()=>{const{zoom:t,center:o,heading:n,minZoom:l,maxZoom:r,enableScrollWheelZoom:i,enableDragging:s,tilt:p,enableTilt:d,mapType:u,enableAutoResize:m,enableTiltGestures:c,enableRotate:f,enableRotateGestures:y,displayOptions:g}=e;return{zoom:t??a?.mergedMapSetRef.value?.zoom,center:o??a?.mergedMapSetRef.value?.center,heading:n??a?.mergedMapSetRef.value?.heading,minZoom:l??a?.mergedMapSetRef.value?.minZoom,maxZoom:r??a?.mergedMapSetRef.value?.maxZoom,enableScrollWheelZoom:i??a?.mergedMapSetRef.value?.enableScrollWheelZoom,enableDragging:s??a?.mergedMapSetRef.value?.enableDragging,tilt:p??a?.mergedMapSetRef.value?.tilt,enableTilt:d??a?.mergedMapSetRef.value?.enableTilt,mapType:u??a?.mergedMapSetRef.value?.mapType,enableAutoResize:m??a?.mergedMapSetRef.value?.enableAutoResize,enableTiltGestures:c??a?.mergedMapSetRef.value?.enableTiltGestures,enableRotate:f??a?.mergedMapSetRef.value?.enableRotate,enableRotateGestures:y??a?.mergedMapSetRef.value?.enableRotateGestures,displayOptions:g??a?.mergedMapSetRef.value?.displayOptions}})}}(e),i=t.ref();let s=null;const d=t.ref(!1);t.provide(p,{mapInstance:()=>s});const y=e=>{"string"==typeof e?s?.centerAndZoom(e,o.value.zoom):Array.isArray(e)?s?.centerAndZoom(new BMapGL.Point(e[0],e[1]),o.value.zoom):s?.centerAndZoom(e,o.value.zoom)},g=e=>{e?s.enableScrollWheelZoom():s.disableScrollWheelZoom()},b=e=>{s?.setDisplayOptions(e||{})},v=e=>{s?.setTilt(e??0)},h=e=>{s?.setHeading(e??0)},S=e=>{e?s.enableDragging():s.disableDragging()},T=e=>{void 0!==window[e]&&s.setMapType(window[e])},R=()=>{const{maxZoom:a,minZoom:n,enableTilt:l,mapType:r,enableAutoResize:p,enableTiltGestures:u,enableRotate:m,enableRotateGestures:c,displayOptions:f}=o.value;s=new BMapGL.Map(i.value,{maxZoom:a,minZoom:n,enableTilt:l,mapType:window[r],enableAutoResize:p,enableTiltGestures:u,enableRotate:m,enableRotateGestures:c,displayOptions:f});const{onInitd:R}=e;(()=>{const{center:e,heading:t,enableScrollWheelZoom:a,tilt:n,enableDragging:l}=o.value;h(t),y(e),g(a),v(n),S(l)})(),t.watch(()=>o.value.center,y,{deep:!0}),t.watch(()=>o.value.enableScrollWheelZoom,g),t.watch(()=>o.value.displayOptions,b),t.watch(()=>o.value.tilt,v),t.watch(()=>o.value.heading,h),t.watch(()=>o.value.enableDragging,S),t.watch(()=>o.value.mapType,T),R?.({map:s}),d.value=!0};return t.onMounted(()=>{t.watchEffect(()=>{"loaded"!==l?.value||d.value||t.nextTick(R)})}),t.onUnmounted(()=>{if(s)try{s?.destroy()}catch(e){console.error(`[Vue3 BMapGL]: ${e.message}`)}}),()=>t.createVNode("div",{class:[[u],e.class]},[t.createVNode("div",{ref:i,class:[m,e.contentClass]},["pending"===l?.value&&n(a.loading,()=>t.createVNode("div",{class:[c]},[t.createTextVNode("map loading...")])),"failed"===l?.value&&n(a.failed,()=>t.createVNode("div",{class:[f]},[t.createTextVNode("map failed")]))]),d.value&&a.default?.()])}});function g(){return t.inject(p,null).mapInstance}const b={visible:{type:Boolean,default:!0},options:{type:Object,default:{}}};var v=t.defineComponent({name:"XyzLayer",props:b,setup(e){const a=g();let o=null;const n=t=>{const{getTile:o}=e.options;o?(a().addTileLayer(t),t.loadRasterTileData=function(e,t){const a=this.getTileKey(e),n=o=>{o.tileInfo=e,t&&t(o,a)},l=()=>t&&t(null,a);o(e,e=>{if("string"==typeof e||e instanceof HTMLCanvasElement){const t=new Image;t.crossOrigin="anonymous",t.onload=()=>n(t),t.onerror=l,t.src="string"==typeof e?e:e.toDataURL()}else e instanceof HTMLImageElement?n(e):l()})}):a().addTileLayer(t)},l=e=>{a().removeTileLayer(e)},r=()=>{o&&l(o);const{getTile:t,...a}=e.options;o=new BMapGL.XYZLayer(a),n(o)};return e.visible&&r(),t.watch(()=>e.visible,e=>o&&(e?n(o):l(o))),t.watch(()=>e.options,()=>r()),t.onUnmounted(()=>{o&&a().removeTileLayer(o)}),()=>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 a=g();let o=null;const n=e=>{o&&o.setStrokeColor(e)};return(()=>{const{points:l,visible:r,strokeColor:i,fillColor:s,strokeWeight:p,strokeOpacity:d,fillOpacity:u,strokeStyle:m,enableMassClear:c,enableEditing:f,enableClicking:y}=e;l&&l.length&&(o=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:u,strokeStyle:m,enableMassClear:c,enableEditing:f,enableClicking:y}),r&&a().addOverlay(o),t.watch(()=>e.strokeColor,n),t.watch(()=>e.visible,e=>{a()[e?"addOverlay":"removeOverlay"](o)}))})(),t.onUnmounted(()=>{o&&a().removeOverlay(o)}),()=>t.createVNode(t.Fragment,null,null)}}),T=t.defineComponent({name:"Sector",setup:()=>()=>t.createVNode(t.Fragment,null,null)});e.BConfigProvider=i,e.BMap=y,e.BPolygon=S,e.BSector=T,e.BTileLayer=s,e.BXyzLayer=v,e.configProviderInjectionKey=r,e.configProviderProps=l,e.create=function({componentPrefix:e="B",components:t=[]}={}){const a=[];function o(t,a,o){t.component(e+a)||t.component(e+a,o)}return{componentPrefix:e,install:function(e){a.includes(e)||(a.push(e),t.forEach(t=>{const{name:a,alias:n}=t;o(e,a,t),n&&n.forEach(a=>{o(e,a,t)})}))}}},e.mapInjectionKey=p,e.mapProps=d,e.polygonProps=h,e.xyzLayerProps=b});
|
package/es/_mixins/index.d.ts
CHANGED
package/es/_mixins/index.mjs
CHANGED
package/es/_mixins/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -2,17 +2,28 @@ import { inject, computed } from 'vue';
|
|
|
2
2
|
import { configProviderInjectionKey } from '../config-provider/src/constants.mjs';
|
|
3
3
|
|
|
4
4
|
function useConfig(props = {}) {
|
|
5
|
-
const
|
|
5
|
+
const BConfigProvider = inject(configProviderInjectionKey, null);
|
|
6
6
|
return {
|
|
7
|
-
mergedStatusRef:
|
|
7
|
+
mergedStatusRef: BConfigProvider === null || BConfigProvider === void 0 ? void 0 : BConfigProvider.mergedStatusRef,
|
|
8
8
|
mergedMapSetRef: computed(() => {
|
|
9
|
-
var _a, _b, _c, _d;
|
|
10
|
-
const { zoom, center, minZoom, maxZoom } = props;
|
|
9
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
10
|
+
const { zoom, center, heading, minZoom, maxZoom, enableScrollWheelZoom, enableDragging, tilt, enableTilt, mapType, enableAutoResize, enableTiltGestures, enableRotate, enableRotateGestures, displayOptions } = props;
|
|
11
11
|
return {
|
|
12
|
-
zoom: zoom !== null && zoom !== void 0 ? zoom : (_a =
|
|
13
|
-
center: center !== null && center !== void 0 ? center : (_b =
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
zoom: zoom !== null && zoom !== void 0 ? zoom : (_a = BConfigProvider === null || BConfigProvider === void 0 ? void 0 : BConfigProvider.mergedMapSetRef.value) === null || _a === void 0 ? void 0 : _a.zoom,
|
|
13
|
+
center: center !== null && center !== void 0 ? center : (_b = BConfigProvider === null || BConfigProvider === void 0 ? void 0 : BConfigProvider.mergedMapSetRef.value) === null || _b === void 0 ? void 0 : _b.center,
|
|
14
|
+
heading: heading !== null && heading !== void 0 ? heading : (_c = BConfigProvider === null || BConfigProvider === void 0 ? void 0 : BConfigProvider.mergedMapSetRef.value) === null || _c === void 0 ? void 0 : _c.heading,
|
|
15
|
+
minZoom: minZoom !== null && minZoom !== void 0 ? minZoom : (_d = BConfigProvider === null || BConfigProvider === void 0 ? void 0 : BConfigProvider.mergedMapSetRef.value) === null || _d === void 0 ? void 0 : _d.minZoom,
|
|
16
|
+
maxZoom: maxZoom !== null && maxZoom !== void 0 ? maxZoom : (_e = BConfigProvider === null || BConfigProvider === void 0 ? void 0 : BConfigProvider.mergedMapSetRef.value) === null || _e === void 0 ? void 0 : _e.maxZoom,
|
|
17
|
+
enableScrollWheelZoom: enableScrollWheelZoom !== null && enableScrollWheelZoom !== void 0 ? enableScrollWheelZoom : (_f = BConfigProvider === null || BConfigProvider === void 0 ? void 0 : BConfigProvider.mergedMapSetRef.value) === null || _f === void 0 ? void 0 : _f.enableScrollWheelZoom,
|
|
18
|
+
enableDragging: enableDragging !== null && enableDragging !== void 0 ? enableDragging : (_g = BConfigProvider === null || BConfigProvider === void 0 ? void 0 : BConfigProvider.mergedMapSetRef.value) === null || _g === void 0 ? void 0 : _g.enableDragging,
|
|
19
|
+
tilt: tilt !== null && tilt !== void 0 ? tilt : (_h = BConfigProvider === null || BConfigProvider === void 0 ? void 0 : BConfigProvider.mergedMapSetRef.value) === null || _h === void 0 ? void 0 : _h.tilt,
|
|
20
|
+
enableTilt: enableTilt !== null && enableTilt !== void 0 ? enableTilt : (_j = BConfigProvider === null || BConfigProvider === void 0 ? void 0 : BConfigProvider.mergedMapSetRef.value) === null || _j === void 0 ? void 0 : _j.enableTilt,
|
|
21
|
+
mapType: mapType !== null && mapType !== void 0 ? mapType : (_k = BConfigProvider === null || BConfigProvider === void 0 ? void 0 : BConfigProvider.mergedMapSetRef.value) === null || _k === void 0 ? void 0 : _k.mapType,
|
|
22
|
+
enableAutoResize: enableAutoResize !== null && enableAutoResize !== void 0 ? enableAutoResize : (_l = BConfigProvider === null || BConfigProvider === void 0 ? void 0 : BConfigProvider.mergedMapSetRef.value) === null || _l === void 0 ? void 0 : _l.enableAutoResize,
|
|
23
|
+
enableTiltGestures: enableTiltGestures !== null && enableTiltGestures !== void 0 ? enableTiltGestures : (_m = BConfigProvider === null || BConfigProvider === void 0 ? void 0 : BConfigProvider.mergedMapSetRef.value) === null || _m === void 0 ? void 0 : _m.enableTiltGestures,
|
|
24
|
+
enableRotate: enableRotate !== null && enableRotate !== void 0 ? enableRotate : (_o = BConfigProvider === null || BConfigProvider === void 0 ? void 0 : BConfigProvider.mergedMapSetRef.value) === null || _o === void 0 ? void 0 : _o.enableRotate,
|
|
25
|
+
enableRotateGestures: enableRotateGestures !== null && enableRotateGestures !== void 0 ? enableRotateGestures : (_p = BConfigProvider === null || BConfigProvider === void 0 ? void 0 : BConfigProvider.mergedMapSetRef.value) === null || _p === void 0 ? void 0 : _p.enableRotateGestures,
|
|
26
|
+
displayOptions: displayOptions !== null && displayOptions !== void 0 ? displayOptions : (_q = BConfigProvider === null || BConfigProvider === void 0 ? void 0 : BConfigProvider.mergedMapSetRef.value) === null || _q === void 0 ? void 0 : _q.displayOptions
|
|
16
27
|
};
|
|
17
28
|
})
|
|
18
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-config.mjs","sources":["../../src/_mixins/file:/D:/workspaces/personal-project/vue3-bmapgl/packages/vue3-bmapgl/src/_mixins/use-config.ts"],"sourcesContent":["import type { Ref } from 'vue'\r\nimport type { MapConfig } from '../config-provider/src/config-provider-props'\r\nimport type { LoadStatus } from '../config-provider/src/internal-interface'\r\nimport { computed, inject } from 'vue'\r\nimport { configProviderInjectionKey } from '../config-provider'\r\n\r\ntype UseConfigProps = Readonly<{\r\n bordered?: boolean\r\n [key: string]: unknown\r\n}>\r\n\r\nexport default function useConfig(props: UseConfigProps = {}): {\r\n mergedStatusRef: Ref<LoadStatus> | undefined\r\n mergedMapSetRef: Ref<MapConfig>\r\n} {\r\n const
|
|
1
|
+
{"version":3,"file":"use-config.mjs","sources":["../../src/_mixins/file:/D:/workspaces/personal-project/vue3-bmapgl/packages/vue3-bmapgl/src/_mixins/use-config.ts"],"sourcesContent":["import type { Ref } from 'vue'\r\nimport type { MapConfig } from '../config-provider/src/config-provider-props'\r\nimport type { LoadStatus } from '../config-provider/src/internal-interface'\r\nimport { computed, inject } from 'vue'\r\nimport { configProviderInjectionKey } from '../config-provider'\r\n\r\ntype UseConfigProps = Readonly<{\r\n bordered?: boolean\r\n [key: string]: unknown\r\n}>\r\n\r\nexport default function useConfig(props: UseConfigProps = {}): {\r\n mergedStatusRef: Ref<LoadStatus> | undefined\r\n mergedMapSetRef: Ref<MapConfig>\r\n} {\r\n const BConfigProvider = inject(configProviderInjectionKey, null)\r\n return {\r\n mergedStatusRef: BConfigProvider?.mergedStatusRef,\r\n mergedMapSetRef: computed(() => {\r\n const { zoom, center, heading, minZoom, maxZoom, enableScrollWheelZoom, enableDragging, tilt, enableTilt, mapType, enableAutoResize, enableTiltGestures, enableRotate, enableRotateGestures, displayOptions } = props\r\n return {\r\n zoom: zoom ?? BConfigProvider?.mergedMapSetRef.value?.zoom,\r\n center: center ?? BConfigProvider?.mergedMapSetRef.value?.center,\r\n heading: heading ?? BConfigProvider?.mergedMapSetRef.value?.heading,\r\n minZoom: minZoom ?? BConfigProvider?.mergedMapSetRef.value?.minZoom,\r\n maxZoom: maxZoom ?? BConfigProvider?.mergedMapSetRef.value?.maxZoom,\r\n enableScrollWheelZoom: enableScrollWheelZoom ?? BConfigProvider?.mergedMapSetRef.value?.enableScrollWheelZoom,\r\n enableDragging: enableDragging ?? BConfigProvider?.mergedMapSetRef.value?.enableDragging,\r\n tilt: tilt ?? BConfigProvider?.mergedMapSetRef.value?.tilt,\r\n enableTilt: enableTilt ?? BConfigProvider?.mergedMapSetRef.value?.enableTilt,\r\n mapType: mapType ?? BConfigProvider?.mergedMapSetRef.value?.mapType,\r\n enableAutoResize: enableAutoResize ?? BConfigProvider?.mergedMapSetRef.value?.enableAutoResize,\r\n enableTiltGestures: enableTiltGestures ?? BConfigProvider?.mergedMapSetRef.value?.enableTiltGestures,\r\n enableRotate: enableRotate ?? BConfigProvider?.mergedMapSetRef.value?.enableRotate,\r\n enableRotateGestures: enableRotateGestures ?? BConfigProvider?.mergedMapSetRef.value?.enableRotateGestures,\r\n displayOptions: displayOptions ?? BConfigProvider?.mergedMapSetRef.value?.displayOptions,\r\n } as MapConfig\r\n }),\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAWA,SAAwB,SAAA,CAAU,KAAA,GAAwB,EAAA,EAAE;AAI1D,EAAA,MAAM,eAAA,GAAkB,MAAA,CAAO,0BAAA,EAA4B,IAAI,CAAA;AAC/D,EAAA,OAAO;AAAA,IACL,iBAAiB,eAAA,KAAe,IAAA,IAAf,eAAA,KAAe,MAAA,GAAA,SAAf,eAAA,CAAiB,eAAA;AAAA,IAClC,eAAA,EAAiB,SAAS,MAAK;;AAC7B,MAAA,MAAM,EAAE,IAAA,EAAM,MAAA,EAAQ,OAAA,EAAS,OAAA,EAAS,SAAS,qBAAA,EAAuB,cAAA,EAAgB,IAAA,EAAM,UAAA,EAAY,SAAS,gBAAA,EAAkB,kBAAA,EAAoB,YAAA,EAAc,oBAAA,EAAsB,gBAAc,GAAK,KAAA;AAChN,MAAA,OAAO;AAAA,QACL,MAAM,IAAA,KAAI,IAAA,IAAJ,SAAI,MAAA,GAAJ,IAAA,GAAA,CAAQ,KAAA,eAAA,KAAe,IAAA,IAAf,sCAAA,gBAAiB,eAAA,CAAgB,KAAA,0CAAO,IAAA;AAAA,QACtD,QAAQ,MAAA,KAAM,IAAA,IAAN,WAAM,MAAA,GAAN,MAAA,GAAA,CAAU,KAAA,eAAA,KAAe,IAAA,IAAf,sCAAA,gBAAiB,eAAA,CAAgB,KAAA,0CAAO,MAAA;AAAA,QAC1D,SAAS,OAAA,KAAO,IAAA,IAAP,YAAO,MAAA,GAAP,OAAA,GAAA,CAAW,KAAA,eAAA,KAAe,IAAA,IAAf,sCAAA,gBAAiB,eAAA,CAAgB,KAAA,0CAAO,OAAA;AAAA,QAC5D,SAAS,OAAA,KAAO,IAAA,IAAP,YAAO,MAAA,GAAP,OAAA,GAAA,CAAW,KAAA,eAAA,KAAe,IAAA,IAAf,sCAAA,gBAAiB,eAAA,CAAgB,KAAA,0CAAO,OAAA;AAAA,QAC5D,SAAS,OAAA,KAAO,IAAA,IAAP,YAAO,MAAA,GAAP,OAAA,GAAA,CAAW,KAAA,eAAA,KAAe,IAAA,IAAf,sCAAA,gBAAiB,eAAA,CAAgB,KAAA,0CAAO,OAAA;AAAA,QAC5D,uBAAuB,qBAAA,KAAqB,IAAA,IAArB,0BAAqB,MAAA,GAArB,qBAAA,GAAA,CAAyB,KAAA,eAAA,KAAe,IAAA,IAAf,sCAAA,gBAAiB,eAAA,CAAgB,KAAA,0CAAO,qBAAA;AAAA,QACxF,gBAAgB,cAAA,KAAc,IAAA,IAAd,mBAAc,MAAA,GAAd,cAAA,GAAA,CAAkB,KAAA,eAAA,KAAe,IAAA,IAAf,sCAAA,gBAAiB,eAAA,CAAgB,KAAA,0CAAO,cAAA;AAAA,QAC1E,MAAM,IAAA,KAAI,IAAA,IAAJ,SAAI,MAAA,GAAJ,IAAA,GAAA,CAAQ,KAAA,eAAA,KAAe,IAAA,IAAf,sCAAA,gBAAiB,eAAA,CAAgB,KAAA,0CAAO,IAAA;AAAA,QACtD,YAAY,UAAA,KAAU,IAAA,IAAV,eAAU,MAAA,GAAV,UAAA,GAAA,CAAc,KAAA,eAAA,KAAe,IAAA,IAAf,sCAAA,gBAAiB,eAAA,CAAgB,KAAA,0CAAO,UAAA;AAAA,QAClE,SAAS,OAAA,KAAO,IAAA,IAAP,YAAO,MAAA,GAAP,OAAA,GAAA,CAAW,KAAA,eAAA,KAAe,IAAA,IAAf,sCAAA,gBAAiB,eAAA,CAAgB,KAAA,0CAAO,OAAA;AAAA,QAC5D,kBAAkB,gBAAA,KAAgB,IAAA,IAAhB,qBAAgB,MAAA,GAAhB,gBAAA,GAAA,CAAoB,KAAA,eAAA,KAAe,IAAA,IAAf,sCAAA,gBAAiB,eAAA,CAAgB,KAAA,0CAAO,gBAAA;AAAA,QAC9E,oBAAoB,kBAAA,KAAkB,IAAA,IAAlB,uBAAkB,MAAA,GAAlB,kBAAA,GAAA,CAAsB,KAAA,eAAA,KAAe,IAAA,IAAf,sCAAA,gBAAiB,eAAA,CAAgB,KAAA,0CAAO,kBAAA;AAAA,QAClF,cAAc,YAAA,KAAY,IAAA,IAAZ,iBAAY,MAAA,GAAZ,YAAA,GAAA,CAAgB,KAAA,eAAA,KAAe,IAAA,IAAf,sCAAA,gBAAiB,eAAA,CAAgB,KAAA,0CAAO,YAAA;AAAA,QACtE,sBAAsB,oBAAA,KAAoB,IAAA,IAApB,yBAAoB,MAAA,GAApB,oBAAA,GAAA,CAAwB,KAAA,eAAA,KAAe,IAAA,IAAf,sCAAA,gBAAiB,eAAA,CAAgB,KAAA,0CAAO,oBAAA;AAAA,QACtF,gBAAgB,cAAA,KAAc,IAAA,IAAd,mBAAc,MAAA,GAAd,cAAA,GAAA,CAAkB,KAAA,eAAA,KAAe,IAAA,IAAf,sCAAA,gBAAiB,eAAA,CAAgB,KAAA,0CAAO;AAAA;IAE9E,CAAC;AAAA;AAEL;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useMapInstance(): () => BMapGL.Map;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { inject } from 'vue';
|
|
2
|
+
import { mapInjectionKey } from '../map/src/constants.mjs';
|
|
3
|
+
|
|
4
|
+
function useMapInstance() {
|
|
5
|
+
const BMap = inject(mapInjectionKey, null);
|
|
6
|
+
return BMap.mapInstance;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { useMapInstance as default };
|
|
10
|
+
//# sourceMappingURL=use-map-instance.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-map-instance.mjs","sources":["../../src/_mixins/file:/D:/workspaces/personal-project/vue3-bmapgl/packages/vue3-bmapgl/src/_mixins/use-map-instance.ts"],"sourcesContent":["import { inject } from 'vue'\r\nimport { mapInjectionKey } from '../map'\r\n\r\nexport default function useMapInstance() {\r\n const BMap = inject(mapInjectionKey, null)\r\n return BMap!.mapInstance\r\n}\r\n"],"names":[],"mappings":";;;AAGA,SAAwB,cAAA,GAAc;AACpC,EAAA,MAAM,IAAA,GAAO,MAAA,CAAO,eAAA,EAAiB,IAAI,CAAA;AACzC,EAAA,OAAO,IAAA,CAAM,WAAA;AACf;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare function call(funcs: MaybeArray<() => void>): void;
|
|
2
|
+
declare function call<A1>(funcs: MaybeArray<(a1: A1) => void>, a1: A1): void;
|
|
3
|
+
declare function call<A1, A2>(funcs: MaybeArray<(a1: A1, a2: A2) => void>, a1: A1, a2: A2): void;
|
|
4
|
+
declare function call<A1, A2, A3>(funcs: MaybeArray<(a1: A1, a2: A2, a3: A3) => void>, a1: A1, a2: A2, a3: A3): void;
|
|
5
|
+
declare function call<A1, A2, A3, A4>(funcs: MaybeArray<(a1: A1, a2: A2, a3: A3, a4: A4) => void>, a1: A1, a2: A2, a3: A3, a4: A4): void;
|
|
6
|
+
export { call };
|
|
7
|
+
export type MaybeArray<T> = T | T[];
|
|
@@ -0,0 +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;;;;"}
|
package/es/_utils/index.d.ts
CHANGED