@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.
Files changed (152) hide show
  1. package/dist/index.js +361 -31
  2. package/dist/index.prod.js +1 -1
  3. package/es/_mixins/index.d.ts +1 -0
  4. package/es/_mixins/index.mjs +1 -0
  5. package/es/_mixins/index.mjs.map +1 -1
  6. package/es/_mixins/use-config.mjs +19 -8
  7. package/es/_mixins/use-config.mjs.map +1 -1
  8. package/es/_mixins/use-map-instance.d.ts +1 -0
  9. package/es/_mixins/use-map-instance.mjs +10 -0
  10. package/es/_mixins/use-map-instance.mjs.map +1 -0
  11. package/es/_utils/call.d.ts +7 -0
  12. package/es/_utils/call.mjs +10 -0
  13. package/es/_utils/call.mjs.map +1 -0
  14. package/es/_utils/index.d.ts +1 -0
  15. package/es/_utils/index.mjs +2 -1
  16. package/es/_utils/index.mjs.map +1 -1
  17. package/es/_utils/map.d.ts +1 -0
  18. package/es/_utils/map.mjs +14 -1
  19. package/es/_utils/map.mjs.map +1 -1
  20. package/es/components.d.ts +4 -0
  21. package/es/components.mjs +7 -0
  22. package/es/components.mjs.map +1 -1
  23. package/es/config-provider/src/config-provider-props.d.ts +10 -1
  24. package/es/config-provider/src/config-provider-props.mjs.map +1 -1
  25. package/es/index.mjs +7 -0
  26. package/es/index.mjs.map +1 -1
  27. package/es/layer/tile/index.d.ts +1 -0
  28. package/es/layer/tile/index.mjs +1 -1
  29. package/es/layer/tile/src/tile.mjs +1 -1
  30. package/es/layer/tile/src/tile.mjs.map +1 -1
  31. package/es/layer/xyz/index.d.ts +3 -0
  32. package/es/layer/xyz/index.mjs +2 -1
  33. package/es/layer/xyz/index.mjs.map +1 -1
  34. package/es/layer/xyz/src/xyz-props.d.ts +16 -0
  35. package/es/layer/xyz/src/xyz-props.mjs +13 -0
  36. package/es/layer/xyz/src/xyz-props.mjs.map +1 -0
  37. package/es/layer/xyz/src/xyz.d.ts +22 -1
  38. package/es/layer/xyz/src/xyz.mjs +62 -4
  39. package/es/layer/xyz/src/xyz.mjs.map +1 -1
  40. package/es/map/index.d.ts +1 -0
  41. package/es/map/index.mjs +1 -0
  42. package/es/map/index.mjs.map +1 -1
  43. package/es/map/src/constants.d.ts +3 -0
  44. package/es/map/src/constants.mjs +4 -0
  45. package/es/map/src/constants.mjs.map +1 -0
  46. package/es/map/src/interface.d.ts +6 -0
  47. package/es/map/src/interface.mjs +2 -0
  48. package/es/map/src/interface.mjs.map +1 -0
  49. package/es/map/src/map-props.d.ts +42 -0
  50. package/es/map/src/map-props.mjs +42 -1
  51. package/es/map/src/map-props.mjs.map +1 -1
  52. package/es/map/src/map.d.ts +91 -0
  53. package/es/map/src/map.mjs +81 -22
  54. package/es/map/src/map.mjs.map +1 -1
  55. package/es/map/src/style/map.module.css.mjs +2 -2
  56. package/es/node_modules/.pnpm/@rollup_plugin-typescript@1_b93953ac7ab797e62adf5212a782f0d9/node_modules/tslib/tslib.es6.mjs +36 -0
  57. package/es/node_modules/.pnpm/@rollup_plugin-typescript@1_b93953ac7ab797e62adf5212a782f0d9/node_modules/tslib/tslib.es6.mjs.map +1 -0
  58. package/es/overlay/polygon/index.d.ts +3 -0
  59. package/es/overlay/polygon/index.mjs +2 -1
  60. package/es/overlay/polygon/index.mjs.map +1 -1
  61. package/es/overlay/polygon/src/polygon-props.d.ts +51 -0
  62. package/es/overlay/polygon/src/polygon-props.mjs +51 -0
  63. package/es/overlay/polygon/src/polygon-props.mjs.map +1 -0
  64. package/es/overlay/polygon/src/polygon.d.ts +108 -0
  65. package/es/overlay/polygon/src/polygon.mjs +63 -0
  66. package/es/overlay/polygon/src/polygon.mjs.map +1 -0
  67. package/es/overlay/sector/index.d.ts +1 -0
  68. package/es/overlay/sector/index.mjs +2 -0
  69. package/es/overlay/sector/index.mjs.map +1 -0
  70. package/es/overlay/sector/src/sector-props.mjs +2 -0
  71. package/es/overlay/sector/src/sector-props.mjs.map +1 -0
  72. package/es/overlay/sector/src/sector.d.ts +2 -0
  73. package/es/overlay/sector/src/sector.mjs +11 -0
  74. package/es/overlay/sector/src/sector.mjs.map +1 -0
  75. package/lib/_mixins/index.d.ts +1 -0
  76. package/lib/_mixins/index.js +2 -0
  77. package/lib/_mixins/index.js.map +1 -1
  78. package/lib/_mixins/use-config.js +19 -8
  79. package/lib/_mixins/use-config.js.map +1 -1
  80. package/lib/_mixins/use-map-instance.d.ts +1 -0
  81. package/lib/_mixins/use-map-instance.js +12 -0
  82. package/lib/_mixins/use-map-instance.js.map +1 -0
  83. package/lib/_utils/call.d.ts +7 -0
  84. package/lib/_utils/call.js +12 -0
  85. package/lib/_utils/call.js.map +1 -0
  86. package/lib/_utils/index.d.ts +1 -0
  87. package/lib/_utils/index.js +3 -0
  88. package/lib/_utils/index.js.map +1 -1
  89. package/lib/_utils/map.d.ts +1 -0
  90. package/lib/_utils/map.js +14 -0
  91. package/lib/_utils/map.js.map +1 -1
  92. package/lib/components.d.ts +4 -0
  93. package/lib/components.js +14 -0
  94. package/lib/components.js.map +1 -1
  95. package/lib/config-provider/src/config-provider-props.d.ts +10 -1
  96. package/lib/config-provider/src/config-provider-props.js.map +1 -1
  97. package/lib/index.js +14 -0
  98. package/lib/index.js.map +1 -1
  99. package/lib/layer/tile/index.d.ts +1 -0
  100. package/lib/layer/tile/index.js +5 -0
  101. package/lib/layer/tile/index.js.map +1 -1
  102. package/lib/layer/tile/src/tile.js +1 -1
  103. package/lib/layer/tile/src/tile.js.map +1 -1
  104. package/lib/layer/xyz/index.d.ts +3 -0
  105. package/lib/layer/xyz/index.js +7 -0
  106. package/lib/layer/xyz/index.js.map +1 -1
  107. package/lib/layer/xyz/src/xyz-props.d.ts +16 -0
  108. package/lib/layer/xyz/src/xyz-props.js +15 -0
  109. package/lib/layer/xyz/src/xyz-props.js.map +1 -0
  110. package/lib/layer/xyz/src/xyz.d.ts +22 -1
  111. package/lib/layer/xyz/src/xyz.js +61 -3
  112. package/lib/layer/xyz/src/xyz.js.map +1 -1
  113. package/lib/map/index.d.ts +1 -0
  114. package/lib/map/index.js +2 -0
  115. package/lib/map/index.js.map +1 -1
  116. package/lib/map/src/constants.d.ts +3 -0
  117. package/lib/map/src/constants.js +6 -0
  118. package/lib/map/src/constants.js.map +1 -0
  119. package/lib/map/src/interface.d.ts +6 -0
  120. package/lib/map/src/interface.js +3 -0
  121. package/lib/map/src/interface.js.map +1 -0
  122. package/lib/map/src/map-props.d.ts +42 -0
  123. package/lib/map/src/map-props.js +42 -1
  124. package/lib/map/src/map-props.js.map +1 -1
  125. package/lib/map/src/map.d.ts +91 -0
  126. package/lib/map/src/map.js +80 -21
  127. package/lib/map/src/map.js.map +1 -1
  128. package/lib/map/src/style/map.module.css.js +2 -2
  129. package/lib/node_modules/.pnpm/@rollup_plugin-typescript@1_b93953ac7ab797e62adf5212a782f0d9/node_modules/tslib/tslib.es6.js +38 -0
  130. package/lib/node_modules/.pnpm/@rollup_plugin-typescript@1_b93953ac7ab797e62adf5212a782f0d9/node_modules/tslib/tslib.es6.js.map +1 -0
  131. package/lib/overlay/polygon/index.d.ts +3 -0
  132. package/lib/overlay/polygon/index.js +7 -0
  133. package/lib/overlay/polygon/index.js.map +1 -1
  134. package/lib/overlay/polygon/src/polygon-props.d.ts +51 -0
  135. package/lib/overlay/polygon/src/polygon-props.js +53 -0
  136. package/lib/overlay/polygon/src/polygon-props.js.map +1 -0
  137. package/lib/overlay/polygon/src/polygon.d.ts +108 -0
  138. package/lib/overlay/polygon/src/polygon.js +65 -0
  139. package/lib/overlay/polygon/src/polygon.js.map +1 -0
  140. package/lib/overlay/sector/index.d.ts +1 -0
  141. package/lib/overlay/sector/index.js +8 -0
  142. package/lib/overlay/sector/index.js.map +1 -0
  143. package/lib/overlay/sector/src/sector-props.js +3 -0
  144. package/lib/overlay/sector/src/sector-props.js.map +1 -0
  145. package/lib/overlay/sector/src/sector.d.ts +2 -0
  146. package/lib/overlay/sector/src/sector.js +13 -0
  147. package/lib/overlay/sector/src/sector.js.map +1 -0
  148. package/package.json +2 -2
  149. package/es/overlay/polygon/src/Polygon.vue.mjs +0 -11
  150. package/es/overlay/polygon/src/Polygon.vue.mjs.map +0 -1
  151. package/lib/overlay/polygon/src/Polygon.vue.js +0 -13
  152. package/lib/overlay/polygon/src/Polygon.vue.js.map +0 -1
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ const xyzLayerProps = {
4
+ visible: {
5
+ type: Boolean,
6
+ default: true
7
+ },
8
+ options: {
9
+ type: Object,
10
+ default: {}
11
+ }
12
+ };
13
+
14
+ exports.xyzLayerProps = xyzLayerProps;
15
+ //# sourceMappingURL=xyz-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xyz-props.js","sources":["../../../../src/layer/xyz/src/file:/D:/workspaces/personal-project/vue3-bmapgl/packages/vue3-bmapgl/src/layer/xyz/src/xyz-props.ts"],"sourcesContent":["import type { PropType } from 'vue'\r\nimport type { ExtractPublicPropTypes } from '../../../_utils'\r\n\r\n// type TemplateFn = (x: number, y: number, z: number) => number\r\n\r\nexport interface XyzLayerOptions extends BMapGL.XYZLayerOptions {\r\n getTile?: (info: any, cb: (image: string | HTMLImageElement | HTMLCanvasElement) => void) => void\r\n}\r\n\r\nexport const xyzLayerProps = {\r\n visible: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n options: {\r\n type: Object as PropType<XyzLayerOptions>,\r\n default: {},\r\n },\r\n} as const\r\n\r\nexport type XyzLayerProps = ExtractPublicPropTypes<typeof xyzLayerProps>\r\n"],"names":[],"mappings":";;AASO,MAAM,aAAA,GAAgB;AAAA,EAC3B,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACV;AAAA,EACD,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,MAAA;AAAA,IACN,SAAS;AAAA;;;;;"}
@@ -1,2 +1,23 @@
1
- declare const _default: import("vue").DefineComponent<{}, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ readonly visible: {
3
+ readonly type: BooleanConstructor;
4
+ readonly default: true;
5
+ };
6
+ readonly options: {
7
+ readonly type: import("vue").PropType<import("./xyz-props").XyzLayerOptions>;
8
+ readonly default: {};
9
+ };
10
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
11
+ readonly visible: {
12
+ readonly type: BooleanConstructor;
13
+ readonly default: true;
14
+ };
15
+ readonly options: {
16
+ readonly type: import("vue").PropType<import("./xyz-props").XyzLayerOptions>;
17
+ readonly default: {};
18
+ };
19
+ }>> & Readonly<{}>, {
20
+ readonly visible: boolean;
21
+ readonly options: import("./xyz-props").XyzLayerOptions;
22
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
23
  export default _default;
@@ -1,11 +1,69 @@
1
1
  'use strict';
2
2
 
3
3
  var vue = require('vue');
4
+ var tslib_es6 = require('../../../node_modules/.pnpm/@rollup_plugin-typescript@1_b93953ac7ab797e62adf5212a782f0d9/node_modules/tslib/tslib.es6.js');
5
+ var xyzProps = require('./xyz-props.js');
6
+ var useMapInstance = require('../../../_mixins/use-map-instance.js');
4
7
 
5
8
  var xyz = /* @__PURE__ */ vue.defineComponent({
6
- name: "XYZ",
7
- setup() {
8
- return () => vue.createVNode("div", null, [vue.createTextVNode("XYZ")]);
9
+ name: "XyzLayer",
10
+ props: xyzProps.xyzLayerProps,
11
+ setup(props) {
12
+ const mapInstance = useMapInstance();
13
+ let layer = null;
14
+ const addTileLayer = (layer2) => {
15
+ const {
16
+ getTile
17
+ } = props.options;
18
+ if (getTile) {
19
+ mapInstance().addTileLayer(layer2);
20
+ layer2.loadRasterTileData = function(tileInfo, callback) {
21
+ const key = this.getTileKey(tileInfo);
22
+ const handleImageLoad = (image) => {
23
+ image.tileInfo = tileInfo;
24
+ callback && callback(image, key);
25
+ };
26
+ const handleError = () => callback && callback(null, key);
27
+ getTile(tileInfo, (img) => {
28
+ if (typeof img === "string" || img instanceof HTMLCanvasElement) {
29
+ const image = new Image();
30
+ image.crossOrigin = "anonymous";
31
+ image.onload = () => handleImageLoad(image);
32
+ image.onerror = handleError;
33
+ image.src = typeof img === "string" ? img : img.toDataURL();
34
+ } else if (img instanceof HTMLImageElement) {
35
+ handleImageLoad(img);
36
+ } else {
37
+ handleError();
38
+ }
39
+ });
40
+ };
41
+ } else {
42
+ mapInstance().addTileLayer(layer2);
43
+ }
44
+ };
45
+ const removeTileLayer = (layer2) => {
46
+ mapInstance().removeTileLayer(layer2);
47
+ };
48
+ const createLayer = () => {
49
+ if (layer) {
50
+ removeTileLayer(layer);
51
+ }
52
+ const _a = props.options, {
53
+ getTile
54
+ } = _a, retProps = tslib_es6.__rest(_a, ["getTile"]);
55
+ layer = new BMapGL.XYZLayer(retProps);
56
+ addTileLayer(layer);
57
+ };
58
+ props.visible && createLayer();
59
+ vue.watch(() => props.visible, (n) => layer && (n ? addTileLayer(layer) : removeTileLayer(layer)));
60
+ vue.watch(() => props.options, () => createLayer());
61
+ vue.onUnmounted(() => {
62
+ if (layer) {
63
+ mapInstance().removeTileLayer(layer);
64
+ }
65
+ });
66
+ return () => vue.createVNode(vue.Fragment, null, null);
9
67
  }
10
68
  });
11
69
 
@@ -1 +1 @@
1
- {"version":3,"file":"xyz.js","sources":["../../../../src/layer/xyz/src/file:/D:/workspaces/personal-project/vue3-bmapgl/packages/vue3-bmapgl/src/layer/xyz/src/xyz.tsx"],"sourcesContent":["import { defineComponent } from \"vue\";\r\n\r\nexport default defineComponent({\r\n name: 'XYZ',\r\n setup() {\r\n return () => <div>XYZ</div>\r\n }\r\n})"],"names":["name","setup","_createVNode","_createTextVNode"],"mappings":";;;;AAEA,8CAA+B;AAAA,EAC7BA,IAAAA,EAAM,KAAA;AAAA,EACNC,KAAAA,GAAK;AACH,IAAA,OAAO,MAAAC,gBAAA,KAAA,EAAA,IAAA,EAAA,CAAAC,mBAAAA,CAAA,KAAA,CAAA,CAAA,CAAA;AAAA,EACT;AACD,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"xyz.js","sources":["../../../../src/layer/xyz/src/file:/D:/workspaces/personal-project/vue3-bmapgl/packages/vue3-bmapgl/src/layer/xyz/src/xyz.tsx"],"sourcesContent":["import { defineComponent, onUnmounted, watch } from 'vue'\r\nimport { useMapInstance } from '../../../_mixins'\r\nimport { xyzLayerProps } from './xyz-props'\r\n\r\nexport default defineComponent({\r\n name: 'XyzLayer',\r\n props: xyzLayerProps,\r\n setup(props) {\r\n const mapInstance = useMapInstance()\r\n\r\n let layer: BMapGL.XYZLayer | null = null\r\n\r\n const addTileLayer = (layer: BMapGL.XYZLayer) => {\r\n const { getTile } = props.options\r\n if (getTile) {\r\n mapInstance().addTileLayer(layer)\r\n ;(layer as any).loadRasterTileData = function (tileInfo: any, callback: any) {\r\n const key = this.getTileKey(tileInfo)\r\n\r\n const handleImageLoad = (image: HTMLImageElement) => {\r\n (image as any).tileInfo = tileInfo\r\n callback && callback(image, key)\r\n }\r\n\r\n const handleError = () => callback && callback(null, key)\r\n\r\n getTile(tileInfo, (img) => {\r\n if (typeof img === 'string' || img instanceof HTMLCanvasElement) {\r\n const image = new Image()\r\n image.crossOrigin = 'anonymous'\r\n\r\n image.onload = () => handleImageLoad(image)\r\n image.onerror = handleError\r\n\r\n image.src = typeof img === 'string' ? img : img.toDataURL()\r\n } else if (img instanceof HTMLImageElement) {\r\n handleImageLoad(img)\r\n } else {\r\n handleError()\r\n }\r\n })\r\n }\r\n } else {\r\n mapInstance().addTileLayer(layer)\r\n }\r\n }\r\n\r\n const removeTileLayer = (layer: BMapGL.XYZLayer) => {\r\n mapInstance().removeTileLayer(layer)\r\n }\r\n\r\n const createLayer = () => {\r\n if (layer) {\r\n removeTileLayer(layer)\r\n }\r\n const { getTile, ...retProps } = props.options\r\n layer = new BMapGL.XYZLayer(retProps)\r\n addTileLayer(layer)\r\n }\r\n\r\n props.visible && createLayer()\r\n\r\n watch(() => props.visible, n => layer && (n ? addTileLayer(layer) : removeTileLayer(layer)))\r\n watch(() => props.options, () => createLayer())\r\n\r\n onUnmounted(() => {\r\n if (layer) {\r\n mapInstance().removeTileLayer(layer)\r\n }\r\n })\r\n\r\n return () => <></>\r\n },\r\n})\r\n"],"names":["name","props","xyzLayerProps","setup","mapInstance","useMapInstance","layer","addTileLayer","getTile","options","loadRasterTileData","tileInfo","callback","key","getTileKey","handleImageLoad","image","handleError","img","HTMLCanvasElement","Image","crossOrigin","onload","onerror","src","toDataURL","HTMLImageElement","removeTileLayer","createLayer","_a","retProps","__rest","BMapGL","XYZLayer","visible","watch","n","onUnmounted","_createVNode","_Fragment"],"mappings":"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"}
@@ -1,3 +1,4 @@
1
+ export { mapInjectionKey } from './src/constants';
1
2
  export { default as BMap } from './src/map';
2
3
  export type { MapProps } from './src/map-props';
3
4
  export { mapProps } from './src/map-props';
package/lib/map/index.js CHANGED
@@ -1,10 +1,12 @@
1
1
  'use strict';
2
2
 
3
+ var constants = require('./src/constants.js');
3
4
  var map = require('./src/map.js');
4
5
  var mapProps = require('./src/map-props.js');
5
6
 
6
7
 
7
8
 
9
+ exports.mapInjectionKey = constants.mapInjectionKey;
8
10
  exports.BMap = map;
9
11
  exports.mapProps = mapProps.mapProps;
10
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
@@ -0,0 +1,3 @@
1
+ import type { InjectionKey } from 'vue';
2
+ import type { MapInjection } from './interface';
3
+ export declare const mapInjectionKey: InjectionKey<MapInjection>;
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ const mapInjectionKey = /* @__PURE__ */ Symbol("b-map");
4
+
5
+ exports.mapInjectionKey = mapInjectionKey;
6
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sources":["../../../src/map/src/file:/D:/workspaces/personal-project/vue3-bmapgl/packages/vue3-bmapgl/src/map/src/constants.ts"],"sourcesContent":["import type { InjectionKey } from 'vue'\r\nimport type { MapInjection } from './interface'\r\n\r\nexport const mapInjectionKey: InjectionKey<MapInjection> = Symbol('b-map')\r\n"],"names":[],"mappings":";;AAGO,MAAM,eAAA,0BAAqD,OAAO;;;;"}
@@ -0,0 +1,6 @@
1
+ export type onInitd = (value: {
2
+ map: BMapGL.Map;
3
+ }) => void;
4
+ export interface MapInjection {
5
+ mapInstance: () => BMapGL.Map;
6
+ }
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+
3
+ //# sourceMappingURL=interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interface.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -1,5 +1,6 @@
1
1
  import type { PropType } from 'vue';
2
2
  import type { ExtractPublicPropTypes } from '../../_utils';
3
+ import type { onInitd } from './interface';
3
4
  export declare const mapProps: {
4
5
  readonly maxZoom: {
5
6
  readonly type: NumberConstructor;
@@ -9,6 +10,10 @@ export declare const mapProps: {
9
10
  readonly type: NumberConstructor;
10
11
  readonly default: 0;
11
12
  };
13
+ readonly heading: {
14
+ readonly type: NumberConstructor;
15
+ readonly default: 0;
16
+ };
12
17
  readonly center: {
13
18
  readonly type: PropType<BMapGL.Point | string | [number, number]>;
14
19
  readonly default: readonly [116.403901, 39.915185];
@@ -18,9 +23,46 @@ export declare const mapProps: {
18
23
  readonly default: 14;
19
24
  };
20
25
  readonly class: StringConstructor;
26
+ readonly contentClass: StringConstructor;
21
27
  readonly enableScrollWheelZoom: {
22
28
  readonly type: BooleanConstructor;
23
29
  readonly default: false;
24
30
  };
31
+ readonly enableDragging: {
32
+ readonly type: BooleanConstructor;
33
+ readonly default: true;
34
+ };
35
+ readonly tilt: {
36
+ readonly type: NumberConstructor;
37
+ readonly default: 0;
38
+ };
39
+ readonly enableTilt: {
40
+ readonly type: BooleanConstructor;
41
+ readonly default: false;
42
+ };
43
+ readonly mapType: {
44
+ readonly type: PropType<BMapGL.MapTypeId>;
45
+ readonly default: "BMAP_NORMAL_MAP";
46
+ };
47
+ readonly enableAutoResize: {
48
+ readonly type: BooleanConstructor;
49
+ readonly default: true;
50
+ };
51
+ readonly enableTiltGestures: {
52
+ readonly type: BooleanConstructor;
53
+ readonly default: false;
54
+ };
55
+ readonly enableRotate: {
56
+ readonly type: BooleanConstructor;
57
+ readonly default: false;
58
+ };
59
+ readonly enableRotateGestures: {
60
+ readonly type: BooleanConstructor;
61
+ readonly default: false;
62
+ };
63
+ readonly displayOptions: {
64
+ readonly type: PropType<BMapGL.displayOptions>;
65
+ };
66
+ readonly onInitd: PropType<onInitd>;
25
67
  };
26
68
  export type MapProps = ExtractPublicPropTypes<typeof mapProps>;
@@ -9,6 +9,10 @@ const mapProps = {
9
9
  type: Number,
10
10
  default: 0
11
11
  },
12
+ heading: {
13
+ type: Number,
14
+ default: 0
15
+ },
12
16
  center: {
13
17
  type: Object,
14
18
  default: [116.403901, 39.915185]
@@ -18,10 +22,47 @@ const mapProps = {
18
22
  default: 14
19
23
  },
20
24
  class: String,
25
+ contentClass: String,
21
26
  enableScrollWheelZoom: {
22
27
  type: Boolean,
23
28
  default: false
24
- }
29
+ },
30
+ enableDragging: {
31
+ type: Boolean,
32
+ default: true
33
+ },
34
+ tilt: {
35
+ type: Number,
36
+ default: 0
37
+ },
38
+ enableTilt: {
39
+ type: Boolean,
40
+ default: false
41
+ },
42
+ mapType: {
43
+ type: String,
44
+ default: "BMAP_NORMAL_MAP"
45
+ },
46
+ enableAutoResize: {
47
+ type: Boolean,
48
+ default: true
49
+ },
50
+ enableTiltGestures: {
51
+ type: Boolean,
52
+ default: false
53
+ },
54
+ enableRotate: {
55
+ type: Boolean,
56
+ default: false
57
+ },
58
+ enableRotateGestures: {
59
+ type: Boolean,
60
+ default: false
61
+ },
62
+ displayOptions: {
63
+ type: Object
64
+ },
65
+ onInitd: Function
25
66
  };
26
67
 
27
68
  exports.mapProps = mapProps;
@@ -1 +1 @@
1
- {"version":3,"file":"map-props.js","sources":["../../../src/map/src/file:/D:/workspaces/personal-project/vue3-bmapgl/packages/vue3-bmapgl/src/map/src/map-props.ts"],"sourcesContent":["import type { PropType } from 'vue'\r\nimport type { ExtractPublicPropTypes } from '../../_utils'\r\n\r\nexport const mapProps = {\r\n maxZoom: {\r\n type: Number,\r\n default: 21,\r\n },\r\n minZoom: {\r\n type: Number,\r\n default: 0,\r\n },\r\n center: {\r\n type: Object as PropType<BMapGL.Point | string | [number, number]>,\r\n default: [116.403901, 39.915185],\r\n },\r\n zoom: {\r\n type: Number,\r\n default: 14,\r\n },\r\n class: String,\r\n enableScrollWheelZoom: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n} as const\r\n\r\nexport type MapProps = ExtractPublicPropTypes<typeof mapProps>\r\n"],"names":[],"mappings":";;AAGO,MAAM,QAAA,GAAW;AAAA,EACtB,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACV;AAAA,EACD,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACV;AAAA,EACD,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS,CAAC,UAAA,EAAY,SAAS;AAAA,GAChC;AAAA,EACD,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACV;AAAA,EACD,KAAA,EAAO,MAAA;AAAA,EACP,qBAAA,EAAuB;AAAA,IACrB,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA;;;;;"}
1
+ {"version":3,"file":"map-props.js","sources":["../../../src/map/src/file:/D:/workspaces/personal-project/vue3-bmapgl/packages/vue3-bmapgl/src/map/src/map-props.ts"],"sourcesContent":["import type { PropType } from 'vue'\r\nimport type { ExtractPublicPropTypes } from '../../_utils'\r\nimport type { onInitd } from './interface'\r\n\r\nexport const mapProps = {\r\n maxZoom: {\r\n type: Number,\r\n default: 21,\r\n },\r\n minZoom: {\r\n type: Number,\r\n default: 0,\r\n },\r\n heading: {\r\n type: Number,\r\n default: 0,\r\n },\r\n center: {\r\n type: Object as PropType<BMapGL.Point | string | [number, number]>,\r\n default: [116.403901, 39.915185],\r\n },\r\n zoom: {\r\n type: Number,\r\n default: 14,\r\n },\r\n class: String,\r\n contentClass: String,\r\n enableScrollWheelZoom: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n enableDragging: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n tilt: {\r\n type: Number,\r\n default: 0,\r\n },\r\n enableTilt: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n mapType: {\r\n type: String as PropType<BMapGL.MapTypeId>,\r\n default: 'BMAP_NORMAL_MAP',\r\n },\r\n enableAutoResize: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n enableTiltGestures: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n enableRotate: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n enableRotateGestures: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n displayOptions: {\r\n type: Object as PropType<BMapGL.displayOptions>,\r\n },\r\n onInitd: Function as PropType<onInitd>,\r\n} as const\r\n\r\nexport type MapProps = ExtractPublicPropTypes<typeof mapProps>\r\n"],"names":[],"mappings":";;AAIO,MAAM,QAAA,GAAW;AAAA,EACtB,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACV;AAAA,EACD,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACV;AAAA,EACD,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACV;AAAA,EACD,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS,CAAC,UAAA,EAAY,SAAS;AAAA,GAChC;AAAA,EACD,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACV;AAAA,EACD,KAAA,EAAO,MAAA;AAAA,EACP,YAAA,EAAc,MAAA;AAAA,EACd,qBAAA,EAAuB;AAAA,IACrB,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACV;AAAA,EACD,cAAA,EAAgB;AAAA,IACd,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACV;AAAA,EACD,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACV;AAAA,EACD,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACV;AAAA,EACD,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACV;AAAA,EACD,gBAAA,EAAkB;AAAA,IAChB,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACV;AAAA,EACD,kBAAA,EAAoB;AAAA,IAClB,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACV;AAAA,EACD,YAAA,EAAc;AAAA,IACZ,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACV;AAAA,EACD,oBAAA,EAAsB;AAAA,IACpB,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACV;AAAA,EACD,cAAA,EAAgB;AAAA,IACd,IAAA,EAAM;AAAA,GACP;AAAA,EACD,OAAA,EAAS;;;;;"}
@@ -13,6 +13,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
13
13
  readonly type: NumberConstructor;
14
14
  readonly default: 0;
15
15
  };
16
+ readonly heading: {
17
+ readonly type: NumberConstructor;
18
+ readonly default: 0;
19
+ };
16
20
  readonly center: {
17
21
  readonly type: import("vue").PropType<BMapGL.Point | string | [number, number]>;
18
22
  readonly default: readonly [116.403901, 39.915185];
@@ -22,10 +26,47 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
22
26
  readonly default: 14;
23
27
  };
24
28
  readonly class: StringConstructor;
29
+ readonly contentClass: StringConstructor;
25
30
  readonly enableScrollWheelZoom: {
26
31
  readonly type: BooleanConstructor;
27
32
  readonly default: false;
28
33
  };
34
+ readonly enableDragging: {
35
+ readonly type: BooleanConstructor;
36
+ readonly default: true;
37
+ };
38
+ readonly tilt: {
39
+ readonly type: NumberConstructor;
40
+ readonly default: 0;
41
+ };
42
+ readonly enableTilt: {
43
+ readonly type: BooleanConstructor;
44
+ readonly default: false;
45
+ };
46
+ readonly mapType: {
47
+ readonly type: import("vue").PropType<BMapGL.MapTypeId>;
48
+ readonly default: "BMAP_NORMAL_MAP";
49
+ };
50
+ readonly enableAutoResize: {
51
+ readonly type: BooleanConstructor;
52
+ readonly default: true;
53
+ };
54
+ readonly enableTiltGestures: {
55
+ readonly type: BooleanConstructor;
56
+ readonly default: false;
57
+ };
58
+ readonly enableRotate: {
59
+ readonly type: BooleanConstructor;
60
+ readonly default: false;
61
+ };
62
+ readonly enableRotateGestures: {
63
+ readonly type: BooleanConstructor;
64
+ readonly default: false;
65
+ };
66
+ readonly displayOptions: {
67
+ readonly type: import("vue").PropType<BMapGL.displayOptions>;
68
+ };
69
+ readonly onInitd: import("vue").PropType<import("./interface").onInitd>;
29
70
  }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
30
71
  readonly maxZoom: {
31
72
  readonly type: NumberConstructor;
@@ -35,6 +76,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
35
76
  readonly type: NumberConstructor;
36
77
  readonly default: 0;
37
78
  };
79
+ readonly heading: {
80
+ readonly type: NumberConstructor;
81
+ readonly default: 0;
82
+ };
38
83
  readonly center: {
39
84
  readonly type: import("vue").PropType<BMapGL.Point | string | [number, number]>;
40
85
  readonly default: readonly [116.403901, 39.915185];
@@ -44,15 +89,61 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
44
89
  readonly default: 14;
45
90
  };
46
91
  readonly class: StringConstructor;
92
+ readonly contentClass: StringConstructor;
47
93
  readonly enableScrollWheelZoom: {
48
94
  readonly type: BooleanConstructor;
49
95
  readonly default: false;
50
96
  };
97
+ readonly enableDragging: {
98
+ readonly type: BooleanConstructor;
99
+ readonly default: true;
100
+ };
101
+ readonly tilt: {
102
+ readonly type: NumberConstructor;
103
+ readonly default: 0;
104
+ };
105
+ readonly enableTilt: {
106
+ readonly type: BooleanConstructor;
107
+ readonly default: false;
108
+ };
109
+ readonly mapType: {
110
+ readonly type: import("vue").PropType<BMapGL.MapTypeId>;
111
+ readonly default: "BMAP_NORMAL_MAP";
112
+ };
113
+ readonly enableAutoResize: {
114
+ readonly type: BooleanConstructor;
115
+ readonly default: true;
116
+ };
117
+ readonly enableTiltGestures: {
118
+ readonly type: BooleanConstructor;
119
+ readonly default: false;
120
+ };
121
+ readonly enableRotate: {
122
+ readonly type: BooleanConstructor;
123
+ readonly default: false;
124
+ };
125
+ readonly enableRotateGestures: {
126
+ readonly type: BooleanConstructor;
127
+ readonly default: false;
128
+ };
129
+ readonly displayOptions: {
130
+ readonly type: import("vue").PropType<BMapGL.displayOptions>;
131
+ };
132
+ readonly onInitd: import("vue").PropType<import("./interface").onInitd>;
51
133
  }>> & Readonly<{}>, {
52
134
  readonly zoom: number;
53
135
  readonly center: string | BMapGL.Point | [number, number];
136
+ readonly heading: number;
54
137
  readonly minZoom: number;
55
138
  readonly maxZoom: number;
56
139
  readonly enableScrollWheelZoom: boolean;
140
+ readonly enableDragging: boolean;
141
+ readonly tilt: number;
142
+ readonly enableTilt: boolean;
143
+ readonly mapType: string;
144
+ readonly enableAutoResize: boolean;
145
+ readonly enableTiltGestures: boolean;
146
+ readonly enableRotate: boolean;
147
+ readonly enableRotateGestures: boolean;
57
148
  }, SlotsType<MapSlots>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
58
149
  export default _default;
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var vue = require('vue');
4
+ var constants = require('./constants.js');
4
5
  var mapProps = require('./map-props.js');
5
6
  var map_module = require('./style/map.module.css.js');
6
7
  var useConfig = require('../../_mixins/use-config.js');
@@ -19,50 +20,106 @@ var map = /* @__PURE__ */ vue.defineComponent({
19
20
  } = useConfig(props);
20
21
  const contentRef = vue.ref();
21
22
  let map = null;
23
+ const initd = vue.ref(false);
24
+ vue.provide(constants.mapInjectionKey, {
25
+ mapInstance: () => map
26
+ });
22
27
  const setCenterAndZoom = (center) => {
23
28
  if (typeof center === "string") {
24
- map.centerAndZoom(center, mergedMapSetRef.value.zoom);
29
+ map === null || map === void 0 ? void 0 : map.centerAndZoom(center, mergedMapSetRef.value.zoom);
25
30
  } else if (Array.isArray(center)) {
26
- map.centerAndZoom(new BMapGL.Point(center[0], center[1]), mergedMapSetRef.value.zoom);
31
+ map === null || map === void 0 ? void 0 : map.centerAndZoom(new BMapGL.Point(center[0], center[1]), mergedMapSetRef.value.zoom);
27
32
  } else {
28
- map.centerAndZoom(new BMapGL.Point(center.lng, center.lat), mergedMapSetRef.value.zoom);
33
+ map === null || map === void 0 ? void 0 : map.centerAndZoom(center, mergedMapSetRef.value.zoom);
29
34
  }
30
35
  };
31
36
  const setScrollWheelZoom = (enableScrollWheelZoom) => {
32
37
  enableScrollWheelZoom ? map.enableScrollWheelZoom() : map.disableScrollWheelZoom();
33
38
  };
34
- const init = () => {
39
+ const setDisplayOptions = (displayOptions) => {
40
+ map === null || map === void 0 ? void 0 : map.setDisplayOptions(displayOptions || {});
41
+ };
42
+ const setTilt = (tilt) => {
43
+ map === null || map === void 0 ? void 0 : map.setTilt(tilt !== null && tilt !== void 0 ? tilt : 0);
44
+ };
45
+ const setHeading = (heading) => {
46
+ map === null || map === void 0 ? void 0 : map.setHeading(heading !== null && heading !== void 0 ? heading : 0);
47
+ };
48
+ const setDragging = (enableDragging) => {
49
+ enableDragging ? map.enableDragging() : map.disableDragging();
50
+ };
51
+ const setMapType = (mapType) => {
52
+ window[mapType] !== void 0 && map.setMapType(window[mapType]);
53
+ };
54
+ const initMapOptions = () => {
35
55
  const {
36
56
  center,
37
- maxZoom,
38
- minZoom,
39
- enableScrollWheelZoom
57
+ heading,
58
+ enableScrollWheelZoom,
59
+ tilt,
60
+ enableDragging
40
61
  } = mergedMapSetRef.value;
41
- map = new BMapGL.Map(contentRef.value, {
42
- maxZoom,
43
- minZoom
44
- });
62
+ setHeading(heading);
45
63
  setCenterAndZoom(center);
46
64
  setScrollWheelZoom(enableScrollWheelZoom);
65
+ setTilt(tilt);
66
+ setDragging(enableDragging);
47
67
  };
48
68
  const startWatchProps = () => {
49
69
  vue.watch(() => mergedMapSetRef.value.center, setCenterAndZoom, {
50
70
  deep: true
51
71
  });
52
72
  vue.watch(() => mergedMapSetRef.value.enableScrollWheelZoom, setScrollWheelZoom);
73
+ vue.watch(() => mergedMapSetRef.value.displayOptions, setDisplayOptions);
74
+ vue.watch(() => mergedMapSetRef.value.tilt, setTilt);
75
+ vue.watch(() => mergedMapSetRef.value.heading, setHeading);
76
+ vue.watch(() => mergedMapSetRef.value.enableDragging, setDragging);
77
+ vue.watch(() => mergedMapSetRef.value.mapType, setMapType);
53
78
  };
54
- vue.watch(() => mergedStatusRef === null || mergedStatusRef === void 0 ? void 0 : mergedStatusRef.value, (value) => {
55
- if (value === "loaded" && !map) {
56
- vue.nextTick(init);
57
- startWatchProps();
58
- }
59
- }, {
60
- immediate: true
79
+ const init = () => {
80
+ const {
81
+ maxZoom,
82
+ minZoom,
83
+ enableTilt,
84
+ mapType,
85
+ enableAutoResize,
86
+ enableTiltGestures,
87
+ enableRotate,
88
+ enableRotateGestures,
89
+ displayOptions
90
+ } = mergedMapSetRef.value;
91
+ map = new BMapGL.Map(contentRef.value, {
92
+ maxZoom,
93
+ minZoom,
94
+ enableTilt,
95
+ mapType: window[mapType],
96
+ enableAutoResize,
97
+ enableTiltGestures,
98
+ enableRotate,
99
+ enableRotateGestures,
100
+ displayOptions
101
+ });
102
+ const {
103
+ onInitd
104
+ } = props;
105
+ initMapOptions();
106
+ startWatchProps();
107
+ onInitd === null || onInitd === void 0 ? void 0 : onInitd({
108
+ map
109
+ });
110
+ initd.value = true;
111
+ };
112
+ vue.onMounted(() => {
113
+ vue.watchEffect(() => {
114
+ if ((mergedStatusRef === null || mergedStatusRef === void 0 ? void 0 : mergedStatusRef.value) === "loaded" && !initd.value) {
115
+ vue.nextTick(init);
116
+ }
117
+ });
61
118
  });
62
119
  vue.onUnmounted(() => {
63
120
  if (map) {
64
121
  try {
65
- map.destroy();
122
+ map === null || map === void 0 ? void 0 : map.destroy();
66
123
  } catch (error) {
67
124
  console.error(`[Vue3 BMapGL]: ${error.message}`);
68
125
  }
@@ -71,13 +128,15 @@ var map = /* @__PURE__ */ vue.defineComponent({
71
128
  return () => {
72
129
  var _a;
73
130
  return vue.createVNode("div", {
131
+ "class": [[map_module["b-map"]], props.class]
132
+ }, [vue.createVNode("div", {
74
133
  "ref": contentRef,
75
- "class": [map_module["b-map-content"], props.class]
134
+ "class": [map_module["b-map-content"], props.contentClass]
76
135
  }, [(mergedStatusRef === null || mergedStatusRef === void 0 ? void 0 : mergedStatusRef.value) === "pending" && resolveSlot.resolveWrappedSlot(slots.loading, () => vue.createVNode("div", {
77
136
  "class": [map_module["b-map-loading"]]
78
137
  }, [vue.createTextVNode("map loading...")])), (mergedStatusRef === null || mergedStatusRef === void 0 ? void 0 : mergedStatusRef.value) === "failed" && resolveSlot.resolveWrappedSlot(slots.failed, () => vue.createVNode("div", {
79
138
  "class": [map_module["b-map-failed"]]
80
- }, [vue.createTextVNode("map failed")])), (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]);
139
+ }, [vue.createTextVNode("map failed")]))]), initd.value && ((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots))]);
81
140
  };
82
141
  }
83
142
  });