@heycar/heycars-map 0.3.7 → 0.3.9

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 (176) hide show
  1. package/dist/Demo/DemoBusinessRecomendPlace.d.ts +9 -0
  2. package/dist/business-components/AbsoluteAddressBox/AbsoluteAddressBox.d.ts +1 -2
  3. package/dist/business-components/AddressBox/AddressBox.d.ts +1 -2
  4. package/dist/business-components/BusinessQuotingMap/BusinessQuotingMap.d.ts +2 -0
  5. package/dist/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +2 -2
  6. package/dist/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +1 -2
  7. package/dist/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +2 -8
  8. package/dist/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.d.ts +46 -0
  9. package/dist/business-components/DrivingLine/DrivingLine.d.ts +1 -2
  10. package/dist/business-components/DrivingRoute/DrivingRoute.d.ts +1 -2
  11. package/dist/business-components/PassengerCircle/PassengerCircle.d.ts +1 -2
  12. package/dist/business-components/PickupPoints/PickupPoints.d.ts +1 -2
  13. package/dist/business-components/PlaceCircle/PlaceCircle.d.ts +1 -2
  14. package/dist/business-components/StartEndPoint/StartEndPoint.d.ts +1 -2
  15. package/dist/business-components/TaxiCar/TaxiCar.d.ts +1 -2
  16. package/dist/business-components/WalkingLine/WalkingLine.d.ts +1 -2
  17. package/dist/business-components/WalkingRoute/WalkingRoute.d.ts +1 -2
  18. package/dist/business-components/WaveCircle/WaveCircle.d.ts +1 -2
  19. package/dist/components/Gmap/Gmap.d.ts +0 -2
  20. package/dist/components/MapProvider/MapProvider.d.ts +1 -4
  21. package/dist/hooks/useMapAutoComplete.d.ts +1 -2
  22. package/dist/hooks-business/useBusinessMapAutoComplete.d.ts +1 -2
  23. package/dist/index.cjs +54 -54
  24. package/dist/index.js +1867 -1959
  25. package/package.json +2 -3
  26. package/todo.md +27 -4
  27. package/dist/Demo/CityBound/SearchDemo.d.ts +0 -1
  28. package/dist/Demo/CityBound/country.d.ts +0 -5
  29. package/dist/Demo/CityBound/searchResult.d.ts +0 -8
  30. package/dist/hooks/useMapLog.d.ts +0 -5
  31. package/src/App.tsx +0 -27
  32. package/src/Demo/CityBound/SearchDemo.tsx +0 -142
  33. package/src/Demo/CityBound/country.ts +0 -4179
  34. package/src/Demo/CityBound/searchResult.ts +0 -21122
  35. package/src/Demo/Demo.css.ts +0 -6
  36. package/src/Demo/Demo.tsx +0 -97
  37. package/src/Demo/DemoBusinessQuoting.tsx +0 -18
  38. package/src/Demo/DemoBusinessRecomendPlace.tsx +0 -89
  39. package/src/Demo/DemoBusinessTaxiEnd.tsx +0 -38
  40. package/src/Demo/DemoBusinessTaxiService.tsx +0 -58
  41. package/src/Demo/sample.json +0 -793
  42. package/src/api/contants.ts +0 -3
  43. package/src/api/driving.ts +0 -87
  44. package/src/api/geocoder.ts +0 -88
  45. package/src/api/geometry.ts +0 -44
  46. package/src/api/place.ts +0 -105
  47. package/src/assets/icons/svg/address-locator.svg +0 -1
  48. package/src/assets/icons/svg/arrow-right.svg +0 -1
  49. package/src/assets/icons/svg/end-point.svg +0 -1
  50. package/src/assets/icons/svg/passenger-circle.svg +0 -1
  51. package/src/assets/icons/svg/place-circle.svg +0 -22
  52. package/src/assets/icons/svg/start-point.svg +0 -1
  53. package/src/assets/icons/svg/taxi-car.svg +0 -1
  54. package/src/assets/icons/svg/wave-circle.svg +0 -1
  55. package/src/business-components/AbsoluteAddressBox/AbsoluteAddressBox.css.ts +0 -68
  56. package/src/business-components/AbsoluteAddressBox/AbsoluteAddressBox.tsx +0 -50
  57. package/src/business-components/AbsoluteAddressBox/index.ts +0 -1
  58. package/src/business-components/AddressBox/AddressBox.css.ts +0 -55
  59. package/src/business-components/AddressBox/AddressBox.tsx +0 -76
  60. package/src/business-components/AddressBox/index.ts +0 -1
  61. package/src/business-components/AddressLocator/AddressLocator.css.ts +0 -7
  62. package/src/business-components/AddressLocator/AddressLocator.tsx +0 -40
  63. package/src/business-components/AddressLocator/index.ts +0 -1
  64. package/src/business-components/BusinessQuotingMap/BusinessQuotingMap.tsx +0 -49
  65. package/src/business-components/BusinessQuotingMap/index.ts +0 -1
  66. package/src/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.tsx +0 -218
  67. package/src/business-components/BusinessRecomendPlaceMap/index.ts +0 -1
  68. package/src/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.tsx +0 -43
  69. package/src/business-components/BusinessTaxiEndMap/index.ts +0 -1
  70. package/src/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.tsx +0 -453
  71. package/src/business-components/BusinessTaxiServiceMap/index.ts +0 -1
  72. package/src/business-components/DrivingLine/DrivingLine.css.ts +0 -10
  73. package/src/business-components/DrivingLine/DrivingLine.tsx +0 -135
  74. package/src/business-components/DrivingLine/index.ts +0 -1
  75. package/src/business-components/DrivingRoute/DrivingRoute.tsx +0 -52
  76. package/src/business-components/DrivingRoute/index.ts +0 -1
  77. package/src/business-components/FitView/FitView.tsx +0 -22
  78. package/src/business-components/FitView/index.ts +0 -1
  79. package/src/business-components/PassengerCircle/PassengerCircle.css.ts +0 -21
  80. package/src/business-components/PassengerCircle/PassengerCircle.tsx +0 -69
  81. package/src/business-components/PassengerCircle/index.ts +0 -1
  82. package/src/business-components/PickupPoints/PickupPoints.tsx +0 -38
  83. package/src/business-components/PickupPoints/index.ts +0 -1
  84. package/src/business-components/PlaceCircle/PlaceCircle.css.ts +0 -76
  85. package/src/business-components/PlaceCircle/PlaceCircle.tsx +0 -110
  86. package/src/business-components/PlaceCircle/index.ts +0 -1
  87. package/src/business-components/StartEndPoint/StartEndPoint.css.ts +0 -70
  88. package/src/business-components/StartEndPoint/StartEndPoint.tsx +0 -122
  89. package/src/business-components/StartEndPoint/index.ts +0 -1
  90. package/src/business-components/TaxiCar/TaxiCar.css.ts +0 -16
  91. package/src/business-components/TaxiCar/TaxiCar.tsx +0 -93
  92. package/src/business-components/TaxiCar/index.ts +0 -1
  93. package/src/business-components/WalkingLine/WalkingLine.tsx +0 -80
  94. package/src/business-components/WalkingLine/index.ts +0 -1
  95. package/src/business-components/WalkingRoute/WalkingRoute.tsx +0 -43
  96. package/src/business-components/WalkingRoute/index.ts +0 -1
  97. package/src/business-components/WaveCircle/WaveCircle.css.ts +0 -54
  98. package/src/business-components/WaveCircle/WaveCircle.tsx +0 -59
  99. package/src/business-components/WaveCircle/index.ts +0 -1
  100. package/src/components/Amap/Amap.css.ts +0 -5
  101. package/src/components/Amap/Amap.ts +0 -76
  102. package/src/components/Amap/index.ts +0 -1
  103. package/src/components/AmapInfoWindow/AmapInfoWindow.ts +0 -45
  104. package/src/components/AmapInfoWindow/index.ts +0 -1
  105. package/src/components/AmapLoader/AmapLoader.ts +0 -20
  106. package/src/components/AmapLoader/index.ts +0 -1
  107. package/src/components/AmapMarker/AmapMarker.ts +0 -48
  108. package/src/components/AmapMarker/index.ts +0 -1
  109. package/src/components/AmapPolygon/AmapPolygon.ts +0 -41
  110. package/src/components/AmapPolygon/index.ts +0 -1
  111. package/src/components/AmapPolyline/AmapPolyline.ts +0 -40
  112. package/src/components/AmapPolyline/index.ts +0 -1
  113. package/src/components/AmapText/AmapText.ts +0 -39
  114. package/src/components/AmapText/index.ts +0 -1
  115. package/src/components/Gmap/Gmap.css.ts +0 -10
  116. package/src/components/Gmap/Gmap.ts +0 -54
  117. package/src/components/Gmap/index.ts +0 -1
  118. package/src/components/GmapAdvancedMarkerView/GmapAdvancedMarkerView.ts +0 -63
  119. package/src/components/GmapAdvancedMarkerView/index.ts +0 -1
  120. package/src/components/GmapInfoWindow/GmapInfoWindow.ts +0 -38
  121. package/src/components/GmapInfoWindow/index.ts +0 -1
  122. package/src/components/GmapLoader/GmapLoader.ts +0 -21
  123. package/src/components/GmapLoader/index.ts +0 -1
  124. package/src/components/GmapMarker/GmapMarker.ts +0 -34
  125. package/src/components/GmapMarker/index.ts +0 -1
  126. package/src/components/GmapPolygon/GmapPolygon.ts +0 -29
  127. package/src/components/GmapPolygon/index.ts +0 -1
  128. package/src/components/GmapPolyline/GmapPolyline.ts +0 -29
  129. package/src/components/GmapPolyline/index.ts +0 -1
  130. package/src/components/MapProvider/MapProvider.tsx +0 -83
  131. package/src/components/MapProvider/index.ts +0 -1
  132. package/src/hooks/useDrivingRoute.ts +0 -106
  133. package/src/hooks/useGeoLocation.ts +0 -70
  134. package/src/hooks/useHeycarMap.ts +0 -28
  135. package/src/hooks/useMap.ts +0 -43
  136. package/src/hooks/useMapAngle.ts +0 -42
  137. package/src/hooks/useMapAutoComplete.ts +0 -130
  138. package/src/hooks/useMapCityBound.ts +0 -64
  139. package/src/hooks/useMapDrag.ts +0 -72
  140. package/src/hooks/useMapEventSource.ts +0 -20
  141. package/src/hooks/useMapFitView.ts +0 -135
  142. package/src/hooks/useMapGeometry.ts +0 -27
  143. package/src/hooks/useMapLngLatToVw.ts +0 -31
  144. package/src/hooks/useMapLoader.ts +0 -164
  145. package/src/hooks/useMapLog.ts +0 -24
  146. package/src/hooks/useMapPlace.ts +0 -138
  147. package/src/hooks/useMapRecomendPlace.ts +0 -150
  148. package/src/hooks/useMapSupplier.ts +0 -16
  149. package/src/hooks/useOverlay.ts +0 -23
  150. package/src/hooks/usePlacesLabelDirection.ts +0 -61
  151. package/src/hooks/useUdate.ts +0 -9
  152. package/src/hooks/useWaitTimer.ts +0 -25
  153. package/src/hooks/useWalkingRoute.ts +0 -87
  154. package/src/hooks-business/useBusinessMapAutoComplete.ts +0 -22
  155. package/src/hooks-business/useBusinessQuotingMap.ts +0 -11
  156. package/src/hooks-business/useBusinessRecomendPlaceMap.ts +0 -45
  157. package/src/hooks-business/useBusinessTaxiServiceMap.ts +0 -12
  158. package/src/index.ts +0 -33
  159. package/src/main.ts +0 -6
  160. package/src/style.css +0 -0
  161. package/src/types/amap/autocomplete.d.ts +0 -64
  162. package/src/types/amap/driving.d.ts +0 -170
  163. package/src/types/amap/geocoder.d.ts +0 -217
  164. package/src/types/amap/marker.ts +0 -11
  165. package/src/types/amap/place.d.ts +0 -114
  166. package/src/types/amap/plugin.d.ts +0 -27
  167. package/src/types/amap/walking.d.ts +0 -78
  168. package/src/types/global.d.ts +0 -10
  169. package/src/types/helper.ts +0 -172
  170. package/src/types/interface.ts +0 -62
  171. package/src/types/mapHelper.ts +0 -1
  172. package/src/utils/compare.ts +0 -189
  173. package/src/utils/dom.ts +0 -14
  174. package/src/utils/helper.ts +0 -5
  175. package/src/utils/transform.ts +0 -68
  176. package/src/vite-env.d.ts +0 -12
@@ -1,80 +0,0 @@
1
- import { computed } from "vue-demi";
2
- import { AmapPolyline } from "../../components/AmapPolyline";
3
- import { GmapPolyline } from "../../components/GmapPolyline";
4
- import { MapLogProps, useMapLog } from "../../hooks/useMapLog";
5
- import { useMapSupplier } from "../../hooks/useMapSupplier";
6
- import { createElement, defineSetup } from "../../types/helper";
7
- import { vec2lnglat } from "../../utils/transform";
8
-
9
- export interface WalkingLineProps extends MapLogProps {
10
- path: [number, number][];
11
- }
12
- export const AWalkingLine = defineSetup(function AWalkingLine(props: WalkingLineProps) {
13
- useMapLog(props, "AWalkingLine");
14
- return () => {
15
- const { path } = props;
16
- if (path.length === 0) return null;
17
- const vw = window.innerWidth * 0.01;
18
- const strokeWidth = 2 * vw;
19
- return (
20
- <AmapPolyline
21
- path={path}
22
- strokeWeight={strokeWidth}
23
- strokeOpacity={1}
24
- strokeColor={"#38A3FE"}
25
- strokeStyle="dashed"
26
- strokeDasharray={[strokeWidth, strokeWidth * 1.5]}
27
- lineJoin={"round"}
28
- lineCap={"round"}
29
- />
30
- );
31
- };
32
- });
33
-
34
- export const GWalkingLine = defineSetup(function GWalkingLine(props: WalkingLineProps) {
35
- useMapLog(props, "GWalkingLine");
36
- const pathRef = computed(() => props.path.map(vec2lnglat));
37
- return () => {
38
- const path = pathRef.value;
39
- if (path.length === 0) return null;
40
- const vw = window.innerWidth * 0.01;
41
- const strokeWidth = 2 * vw;
42
- const r = strokeWidth / 4;
43
- return (
44
- <GmapPolyline
45
- path={path}
46
- strokeWeight={strokeWidth}
47
- strokeOpacity={1}
48
- strokeColor={"transparent"}
49
- icons={[
50
- {
51
- icon: {
52
- path: `
53
- M ${r}, ${r}
54
- m -${r}, 0
55
- a ${r},${r} 0 1,0 ${2 * r},0
56
- a ${r},${r} 0 1,0 -${2 * r},0
57
- `,
58
- strokeColor: "#38A3FE",
59
- fillColor: "#38A3FE",
60
- fillOpacity: 1,
61
- strokeOpacity: 1,
62
- strokeWeight: strokeWidth / 2,
63
- scale: 1,
64
- },
65
- repeat: `${strokeWidth * 2}px`,
66
- },
67
- ]}
68
- />
69
- );
70
- };
71
- });
72
-
73
- export const WalkingLine = defineSetup(function WalkingLine(props: WalkingLineProps) {
74
- const payload = useMapSupplier();
75
- return () => {
76
- return createElement(payload.supplier === "gmap" ? GWalkingLine : AWalkingLine, {
77
- attrs: props,
78
- });
79
- };
80
- });
@@ -1 +0,0 @@
1
- export * from "./WalkingLine";
@@ -1,43 +0,0 @@
1
- import { reactive, VNodeData } from "vue-demi";
2
- import { MapLogProps, useMapLog } from "../../hooks/useMapLog";
3
- import { useMapSupplier } from "../../hooks/useMapSupplier";
4
- import {
5
- useAWalkingRoute,
6
- useGWalkingRoute,
7
- UseWalkingRouteProps,
8
- } from "../../hooks/useWalkingRoute";
9
- import { createElement, defineSetup, VNodeChild } from "../../types/helper";
10
- import type { Point } from "../../types/interface";
11
-
12
- export type WalkingRouteRenderProps = {
13
- path: Point[];
14
- };
15
- export interface WalkingRouteProps extends UseWalkingRouteProps, MapLogProps {
16
- render?: (props: WalkingRouteRenderProps) => VNodeChild;
17
- }
18
- export const AWalkingRoute = defineSetup(function WalkingRoute(
19
- props: WalkingRouteProps,
20
- { slots }
21
- ) {
22
- useMapLog(props, "AWalkingRoute");
23
- const path = useAWalkingRoute(props);
24
- return () => <div>{slots.render?.(reactive({ path }))}</div>;
25
- });
26
-
27
- export const GWalkingRoute = defineSetup(function WalkingRoute(
28
- props: WalkingRouteProps,
29
- { slots }
30
- ) {
31
- useMapLog(props, "GWalkingRoute");
32
- const path = useGWalkingRoute(props);
33
- return () => <div>{slots.render?.(reactive({ path }))}</div>;
34
- });
35
-
36
- export const WalkingRoute = defineSetup(function WalkingRoute(props: WalkingRouteProps, { slots }) {
37
- const { supplier } = useMapSupplier();
38
- return () =>
39
- createElement(supplier === "gmap" ? GWalkingRoute : AWalkingRoute, {
40
- attrs: props,
41
- scopedSlots: slots as VNodeData["scopedSlots"],
42
- });
43
- });
@@ -1 +0,0 @@
1
- export * from "./WalkingRoute";
@@ -1,54 +0,0 @@
1
- import { keyframes, style } from "@vanilla-extract/css";
2
-
3
- export const waveAnimationFirst = keyframes({
4
- "0%": {
5
- transform: "scale(0)",
6
- opacity: 1,
7
- },
8
- "33.33%": {
9
- transform: "scale(0.5)",
10
- opacity: 1,
11
- },
12
- "66.66%": {
13
- transform: "scale(1)",
14
- opacity: 0,
15
- },
16
- "100%": {
17
- transform: "scale(1)",
18
- opacity: 0,
19
- },
20
- });
21
-
22
- export const waveAnimationSecond = keyframes({
23
- "0%": {
24
- transform: "scale(0)",
25
- opacity: 0,
26
- },
27
- "33.33%": {
28
- transform: "scale(0)",
29
- opacity: 1,
30
- },
31
- "66.66%": {
32
- transform: "scale(0.5)",
33
- opacity: 1,
34
- },
35
- "100%": {
36
- transform: "scale(1)",
37
- opacity: 0,
38
- },
39
- });
40
-
41
- export const waveCircle = style({
42
- display: "flex",
43
- marginBottom: "-30.935vw",
44
- width: "61.87vw",
45
- height: "61.87vw",
46
- animationName: waveAnimationFirst,
47
- animationDuration: "3s",
48
- animationIterationCount: "infinite",
49
- animationTimingFunction: "linear",
50
- });
51
-
52
- export const secondCircle = style({
53
- animationName: waveAnimationSecond,
54
- });
@@ -1,59 +0,0 @@
1
- import { computed } from "vue-demi";
2
- import imgWaveCircle from "../../assets/icons/svg/wave-circle.svg";
3
- import { AmapMarker } from "../../components/AmapMarker";
4
- import { GmapAdvancedMarkerView } from "../../components/GmapAdvancedMarkerView";
5
- import { MapLogProps, useMapLog } from "../../hooks/useMapLog";
6
- import { useMapSupplier } from "../../hooks/useMapSupplier";
7
- import { createElement, defineSetup } from "../../types/helper";
8
- import { createDom } from "../../utils/dom";
9
- import { vec2lnglat } from "../../utils/transform";
10
- import * as css from "./WaveCircle.css";
11
-
12
- export interface WaveCircleProps extends MapLogProps {
13
- position: [number, number];
14
- }
15
- export const AWaveCircle = defineSetup(function AWaveCircle(props: WaveCircleProps) {
16
- useMapLog(props, "AWaveCircle");
17
- const contentRef = computed(() => `<img src="${imgWaveCircle}" class="${css.waveCircle}">`);
18
- const contentAnotherRef = computed(
19
- () => `<img src="${imgWaveCircle}" class="${css.waveCircle} ${css.secondCircle}">`
20
- );
21
- return () => (
22
- <div>
23
- <AmapMarker position={props.position} anchor="bottom-center" content={contentRef.value} />
24
- <AmapMarker
25
- position={props.position}
26
- anchor="bottom-center"
27
- content={contentAnotherRef.value}
28
- />
29
- </div>
30
- );
31
- });
32
-
33
- export const GWaveCircle = defineSetup(function AWaveCircle(props: WaveCircleProps) {
34
- useMapLog(props, "GWaveCircle");
35
- const contentRef = computed(() =>
36
- createDom("img", { class: css.waveCircle, src: imgWaveCircle })
37
- );
38
- const contentAnotherRef = computed(() =>
39
- createDom("img", { class: `${css.waveCircle} ${css.secondCircle}`, src: imgWaveCircle })
40
- );
41
- return () => {
42
- const position = vec2lnglat(props.position);
43
- return (
44
- <div>
45
- <GmapAdvancedMarkerView position={position} content={contentRef.value} />
46
- <GmapAdvancedMarkerView position={position} content={contentAnotherRef.value} />
47
- </div>
48
- );
49
- };
50
- });
51
-
52
- export const WaveCircle = defineSetup(function WaveCircle(props: WaveCircleProps) {
53
- const payload = useMapSupplier();
54
- return () => {
55
- return createElement(payload.supplier === "gmap" ? GWaveCircle : AWaveCircle, {
56
- attrs: props,
57
- });
58
- };
59
- });
@@ -1 +0,0 @@
1
- export * from "./WaveCircle";
@@ -1,5 +0,0 @@
1
- import { style } from "@vanilla-extract/css";
2
-
3
- export const amap = style({
4
- position: "relative",
5
- });
@@ -1,76 +0,0 @@
1
- import { computed, h, shallowRef, watchPostEffect } from "vue-demi";
2
- import type { SetMap } from "../../hooks/useHeycarMap";
3
- import { provideAmap } from "../../hooks/useMap";
4
- import { defineSetup } from "../../types/helper";
5
- import type { MapEventHandler } from "../../types/mapHelper";
6
- import {
7
- watchNoneImmediatePostEffectForDeepOption,
8
- watchNoneImmediatePostEffectForMapProperty,
9
- watchPostEffectForAMapEvent,
10
- } from "../../utils/compare";
11
- import type { VectorMapForeign } from "../../utils/transform";
12
- import * as css from "./Amap.css";
13
-
14
- export interface AmapProps extends Omit<AMap.MapOptions, "vectorMapForeign"> {
15
- vectorMapForeign?: VectorMapForeign;
16
- mapRef?: SetMap<AMap.Map>;
17
- onDragStart?: MapEventHandler<AMap.Map>;
18
- onDragEnd?: MapEventHandler<AMap.Map>;
19
- }
20
-
21
- export const Amap = defineSetup(function Amap(props: AmapProps, { slots, emit }) {
22
- const {
23
- onDragStart,
24
- onDragEnd,
25
- mapRef: setMap,
26
- vectorMapForeign = "style_zh_cn",
27
- ...defaultOptions
28
- } = props;
29
- const statusOptions = computed(() => {
30
- return {
31
- dragEnable: !!props.dragEnable,
32
- zoomEnable: !!props.zoomEnable,
33
- jogEnable: !!props.jogEnable,
34
- pitchEnable: !!props.pitchEnable,
35
- rotateEnable: !!props.rotateEnable,
36
- animateEnable: !!props.animateEnable,
37
- keyboardEnable: !!props.keyboardEnable,
38
- };
39
- });
40
- const elementRef = shallowRef();
41
- const mapRef = shallowRef<AMap.Map>();
42
- provideAmap(mapRef);
43
- watchPostEffect(() => {
44
- // todo 这里是否会因为 mapRef 的赋值导致不停运行?
45
- if (mapRef.value || !elementRef.value) return;
46
- const map = new AMap.Map(elementRef.value, {
47
- ...defaultOptions,
48
- vectorMapForeign: vectorMapForeign as any,
49
- mapStyle: "amap://styles/95498a904992a4c0b866a3e4d7729682",
50
- });
51
- mapRef.value = map;
52
- setMap?.(map);
53
- });
54
- watchNoneImmediatePostEffectForDeepOption(
55
- () => statusOptions.value,
56
- (statusOptions) => {
57
- mapRef.value?.setStatus(statusOptions);
58
- }
59
- );
60
- watchNoneImmediatePostEffectForMapProperty(mapRef, props, [
61
- { name: "center", defaultValue: [0, 0] },
62
- { name: "zooms", defaultValue: [0, 0] },
63
- { name: "zoom", defaultValue: 0 },
64
- { name: "layers", defaultValue: [] },
65
- { name: "limitBounds", defaultValue: [] },
66
- { name: "rotation", defaultValue: 0 },
67
- { name: "defaultCursor", defaultValue: "" },
68
- { name: "mapStyle", defaultValue: "" },
69
- { name: "features", defaultValue: [] },
70
- { name: "pitch", defaultValue: 0 },
71
- { name: "mask", defaultValue: [] },
72
- { name: "labelRejectMask", defaultValue: false },
73
- ]);
74
- watchPostEffectForAMapEvent(mapRef, props, emit, ["onDragStart", "onDragEnd"]);
75
- return () => h("div", { ref: elementRef, class: css.amap }, slots.default?.());
76
- });
@@ -1 +0,0 @@
1
- export * from "./Amap";
@@ -1,45 +0,0 @@
1
- import { computed, onMounted, onUnmounted, shallowRef, watchPostEffect } from "vue-demi";
2
- import { useAmap } from "../../hooks/useMap";
3
- import { defineSetup } from "../../types/helper";
4
- import { watchNoneImmediatePostEffectForMapProperty } from "../../utils/compare";
5
-
6
- export interface AmapInfoWindowProps extends AMap.InfoOptions {
7
- visible: boolean;
8
- }
9
-
10
- export const AmapInfoWindow = defineSetup(function AmapInfoWindow(props: AmapInfoWindowProps) {
11
- const options = computed(() => {
12
- const { visible, ...options } = props;
13
- return options;
14
- });
15
- const defaultOptions = options.value;
16
- const infoWindowRef = shallowRef<AMap.InfoWindow>();
17
- const mapRef = useAmap();
18
- onMounted(() => {
19
- infoWindowRef.value = new AMap.InfoWindow({ ...defaultOptions });
20
- });
21
- onUnmounted(() => {
22
- infoWindowRef.value?.close();
23
- });
24
- watchPostEffect(() => {
25
- const { visible } = props;
26
- const infoWindow = infoWindowRef.value;
27
- const map = mapRef?.value;
28
- if (!map || !infoWindow) return;
29
- const position = infoWindow.getPosition();
30
- if (!position) return;
31
- visible ? infoWindow.open(map, [position.lng, position.lat]) : infoWindow.close();
32
- });
33
- watchNoneImmediatePostEffectForMapProperty(infoWindowRef, props, [
34
- { name: "anchor", defaultValue: undefined },
35
- { name: "angle", defaultValue: undefined },
36
- { name: "content", defaultValue: undefined },
37
- { name: "extData", defaultValue: undefined },
38
- { name: "offset", defaultValue: undefined },
39
- { name: "orientation", defaultValue: undefined },
40
- { name: "position", defaultValue: undefined },
41
- { name: "size", defaultValue: undefined },
42
- { name: "zIndex", defaultValue: undefined },
43
- ]);
44
- return () => null;
45
- });
@@ -1 +0,0 @@
1
- export * from "./AmapInfoWindow";
@@ -1,20 +0,0 @@
1
- import { AmapLoaderProps, Status, useAmapLoader } from "../../hooks/useMapLoader";
2
- import { defineSetup, VueNode } from "../../types/helper";
3
- /**
4
- * Deprcated
5
- */
6
- export const AmapLoader = defineSetup(function AmapLoader(props: AmapLoaderProps, { slots }) {
7
- const { statusRef } = useAmapLoader(props);
8
- return () => {
9
- switch (statusRef.value) {
10
- case Status.SUCCESS:
11
- return slots.default?.() as VueNode;
12
- case Status.LOADING:
13
- return slots.loading?.();
14
- case Status.FAILURE:
15
- return slots.fallback?.();
16
- default:
17
- throw new Error("MyError: unknown loader status");
18
- }
19
- };
20
- });
@@ -1 +0,0 @@
1
- export * from "./AmapLoader";
@@ -1,48 +0,0 @@
1
- import { onMounted, onUnmounted, shallowRef, watchPostEffect } from "vue-demi";
2
- import { useAmap } from "../../hooks/useMap";
3
- import { AmapOverlay, MapRegisterOverlayProps, useMapOverlay } from "../../hooks/useOverlay";
4
- import { defineSetup } from "../../types/helper";
5
- import type { MapEventHandler } from "../../types/mapHelper";
6
- import {
7
- watchNoneImmediatePostEffectForMapProperty,
8
- watchPostEffectForAMapEvent,
9
- } from "../../utils/compare";
10
-
11
- export interface AmapMarkerProps extends AMap.MarkerOptions, MapRegisterOverlayProps<AmapOverlay> {
12
- onClick?: MapEventHandler<AMap.Marker>;
13
- }
14
-
15
- export const AmapMarker = defineSetup(function AmapMarker(props: AmapMarkerProps, { emit }) {
16
- const { registerOverlay } = props;
17
- const markerRef = shallowRef<AMap.Marker>();
18
- const mapRef = useAmap();
19
- onMounted(() => {
20
- markerRef.value = new AMap.Marker({ ...props });
21
- });
22
- onUnmounted(() => {
23
- markerRef.value?.setMap(null);
24
- });
25
- useMapOverlay({ registerOverlay, overlayRef: markerRef });
26
- watchPostEffect(() => {
27
- const map = mapRef?.value;
28
- if (!map) return;
29
- markerRef.value?.setMap(map);
30
- });
31
- watchNoneImmediatePostEffectForMapProperty(markerRef, props, [
32
- { name: "anchor", defaultValue: "" },
33
- { name: "offset", defaultValue: [0, 0] },
34
- { name: "clickable", defaultValue: false },
35
- { name: "position", defaultValue: [0, 0] },
36
- { name: "angle", defaultValue: 0 },
37
- { name: "label", defaultValue: undefined },
38
- { name: "zIndex", defaultValue: 0 },
39
- { name: "icon", defaultValue: "" },
40
- { name: "draggable", defaultValue: false },
41
- { name: "cursor", defaultValue: "" },
42
- { name: "content", defaultValue: "" },
43
- { name: "title", defaultValue: "" },
44
- { name: "extData", defaultValue: "" },
45
- ]);
46
- watchPostEffectForAMapEvent(markerRef, props, emit, ["onClick"]);
47
- return () => null;
48
- });
@@ -1 +0,0 @@
1
- export * from "./AmapMarker";
@@ -1,41 +0,0 @@
1
- import { onMounted, onUnmounted, shallowRef, watchPostEffect } from "vue-demi";
2
- import { useAmap } from "../../hooks/useMap";
3
- import { defineSetup } from "../../types/helper";
4
- import {
5
- watchNoneImmediatePostEffectForDeepOption,
6
- watchNoneImmediatePostEffectForMapProperty,
7
- } from "../../utils/compare";
8
-
9
- export type AmapPolygonProps = AMap.PolygonOptions;
10
-
11
- export const AmapPolygon = defineSetup(function AmapPolygon(props: AmapPolygonProps) {
12
- const polygonRef = shallowRef<AMap.Polygon>();
13
- const mapRef = useAmap();
14
- onMounted(() => {
15
- polygonRef.value = new AMap.Polygon();
16
- polygonRef.value.setOptions(props);
17
- });
18
- onUnmounted(() => {
19
- polygonRef.value?.setMap(null);
20
- });
21
- watchPostEffect(() => {
22
- const map = mapRef?.value;
23
- if (!map) return;
24
- polygonRef.value?.setMap(map);
25
- });
26
- watchNoneImmediatePostEffectForMapProperty(polygonRef, props, [
27
- { name: "path", defaultValue: [[0, 0]] },
28
- { name: "extData", defaultValue: undefined },
29
- { name: "draggable", defaultValue: false },
30
- ]);
31
- watchNoneImmediatePostEffectForDeepOption(
32
- () => {
33
- const { path, extData, draggable, ...otherOptions } = props;
34
- return otherOptions;
35
- },
36
- (otherOptions) => {
37
- polygonRef.value?.setOptions({ ...otherOptions });
38
- }
39
- );
40
- return () => null;
41
- });
@@ -1 +0,0 @@
1
- export * from "./AmapPolygon";
@@ -1,40 +0,0 @@
1
- import { onMounted, onUnmounted, shallowRef, watchPostEffect } from "vue-demi";
2
- import { useAmap } from "../../hooks/useMap";
3
- import { defineSetup } from "../../types/helper";
4
- import {
5
- watchNoneImmediatePostEffectForDeepOption,
6
- watchNoneImmediatePostEffectForMapProperty,
7
- } from "../../utils/compare";
8
-
9
- export type AmapPolylineProps = AMap.PolylineOptions;
10
-
11
- export const AmapPolyline = defineSetup(function AmapPolyline(props: AmapPolylineProps) {
12
- const polylineRef = shallowRef<AMap.Polyline>();
13
- const mapRef = useAmap();
14
- onMounted(() => {
15
- polylineRef.value = new AMap.Polyline({ ...props });
16
- });
17
- onUnmounted(() => {
18
- polylineRef.value?.setMap(null);
19
- });
20
- watchPostEffect(() => {
21
- const map = mapRef?.value;
22
- if (!map) return;
23
- polylineRef.value?.setMap(map);
24
- });
25
- watchNoneImmediatePostEffectForMapProperty(polylineRef, props, [
26
- { name: "path", defaultValue: [[0, 0]] },
27
- { name: "extData", defaultValue: undefined },
28
- { name: "draggable", defaultValue: false },
29
- ]);
30
- watchNoneImmediatePostEffectForDeepOption(
31
- () => {
32
- const { path, extData, draggable, ...otherOptions } = props;
33
- return otherOptions;
34
- },
35
- (otherOptions) => {
36
- polylineRef.value?.setOptions({ ...otherOptions });
37
- }
38
- );
39
- return () => null;
40
- });
@@ -1 +0,0 @@
1
- export * from "./AmapPolyline";
@@ -1,39 +0,0 @@
1
- import { onMounted, onUnmounted, shallowRef, watchPostEffect } from "vue-demi";
2
- import { useAmap } from "../../hooks/useMap";
3
- import { defineSetup } from "../../types/helper";
4
- import { watchNoneImmediatePostEffectForMapProperty } from "../../utils/compare";
5
-
6
- export type AmapTextProps = AMap.TextOptions;
7
-
8
- export const AmapText = defineSetup(function AmapText(props: AmapTextProps) {
9
- const textRef = shallowRef<AMap.Text>();
10
- const mapRef = useAmap();
11
- onMounted(() => {
12
- textRef.value = new AMap.Text({ ...props });
13
- });
14
- onUnmounted(() => {
15
- textRef.value?.setMap(null);
16
- });
17
- watchPostEffect(() => {
18
- const map = mapRef?.value;
19
- if (!map) return;
20
- textRef.value?.setMap(map);
21
- });
22
- watchNoneImmediatePostEffectForMapProperty(textRef, props, [
23
- { name: "anchor", defaultValue: "" },
24
- { name: "offset", defaultValue: [0, 0] },
25
- { name: "clickable", defaultValue: false },
26
- { name: "position", defaultValue: [0, 0] },
27
- { name: "angle", defaultValue: 0 },
28
- { name: "label", defaultValue: undefined },
29
- { name: "zIndex", defaultValue: 0 },
30
- { name: "icon", defaultValue: "" },
31
- { name: "draggable", defaultValue: false },
32
- { name: "cursor", defaultValue: "" },
33
- { name: "content", defaultValue: "" },
34
- { name: "title", defaultValue: "" },
35
- { name: "extData", defaultValue: "" },
36
- { name: "style", defaultValue: undefined },
37
- ]);
38
- return () => null;
39
- });
@@ -1 +0,0 @@
1
- export * from "./AmapText";
@@ -1,10 +0,0 @@
1
- import { style } from "@vanilla-extract/css";
2
-
3
- export const gmap = style({
4
- height: "inherit",
5
- width: "inherit",
6
- });
7
-
8
- export const gmapLayout = style({
9
- position: "relative",
10
- });
@@ -1,54 +0,0 @@
1
- import { computed, h, shallowRef, watchPostEffect } from "vue-demi";
2
- import type { SetMap } from "../../hooks/useHeycarMap";
3
- import { provideGmap } from "../../hooks/useMap";
4
- import { useMapEventSource } from "../../hooks/useMapEventSource";
5
- import { defineSetup, VueNode } from "../../types/helper";
6
- import type { MapEventHandler } from "../../types/mapHelper";
7
- import {
8
- watchNoneImmediatePostEffectForDeepOption,
9
- watchPostEffectForGMapEvent,
10
- } from "../../utils/compare";
11
- import * as css from "./Gmap.css";
12
-
13
- export interface GmapProps extends google.maps.MapOptions {
14
- mapRef?: SetMap<google.maps.Map>;
15
- onDragStart?: MapEventHandler<google.maps.Map>;
16
- onDragEnd?: MapEventHandler<google.maps.Map>;
17
- renderOverlay?: () => VueNode;
18
- }
19
-
20
- export const Gmap = defineSetup(function Gmap(props: GmapProps, { slots, emit }) {
21
- const setMap = props.mapRef;
22
- const options = computed(() => {
23
- const { renderOverlay, mapRef, onDragStart, onDragEnd, ...options } = props;
24
- return options;
25
- });
26
- const defaultOptions = options.value;
27
- const elementRef = shallowRef();
28
- const mapRef = shallowRef<google.maps.Map>();
29
- const { executeMapApi } = useMapEventSource();
30
- const handleDrag: typeof emit = (name) => emit(name as any, { target: mapRef.value! });
31
- provideGmap(mapRef);
32
- watchPostEffect(() => {
33
- // todo 这里是否会因为 mapRef 的赋值导致不停运行?
34
- if (mapRef.value || !elementRef.value) return;
35
- let map: google.maps.Map;
36
- executeMapApi(() => {
37
- map = new google.maps.Map(elementRef.value, { ...defaultOptions });
38
- });
39
- mapRef.value = map!;
40
- setMap?.(map!);
41
- });
42
- watchNoneImmediatePostEffectForDeepOption(
43
- () => options.value,
44
- (options) => {
45
- executeMapApi(() => mapRef.value?.setOptions({ ...options }));
46
- }
47
- );
48
- watchPostEffectForGMapEvent(mapRef, props, handleDrag, ["onDragStart", "onDragEnd"]);
49
- return () =>
50
- h("div", { class: css.gmapLayout }, [
51
- props.renderOverlay?.(),
52
- h("div", { ref: elementRef, class: css.gmap }, slots.default?.()),
53
- ]);
54
- });
@@ -1 +0,0 @@
1
- export * from "./Gmap";