@heycar/heycars-map 0.3.0 → 0.3.2

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 (31) hide show
  1. package/README.md +1 -1
  2. package/dist/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +3 -1
  3. package/dist/hooks/useMapAutoComplete.d.ts +10 -6
  4. package/dist/hooks/useMapCityBound.d.ts +5 -5
  5. package/dist/hooks/useMapLog.d.ts +2 -1
  6. package/dist/hooks/useMapPlace.d.ts +13 -2
  7. package/dist/hooks/useMapRecomendPlace.d.ts +12 -2
  8. package/dist/hooks-business/useBusinessMapAutoComplete.d.ts +4 -2
  9. package/dist/hooks-business/useBusinessRecomendPlaceMap.d.ts +4 -2
  10. package/dist/index.cjs +52 -52
  11. package/dist/index.js +1095 -1064
  12. package/dist/style.css +1 -1
  13. package/dist/types/interface.d.ts +2 -1
  14. package/package.json +1 -1
  15. package/src/Demo/DemoBusinessRecomendPlace.tsx +16 -8
  16. package/src/Demo/sample.json +793 -0
  17. package/src/business-components/AbsoluteAddressBox/AbsoluteAddressBox.css.ts +2 -0
  18. package/src/business-components/AbsoluteAddressBox/AbsoluteAddressBox.tsx +5 -3
  19. package/src/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.tsx +26 -22
  20. package/src/hooks/useGeoLocation.ts +6 -2
  21. package/src/hooks/useMapAutoComplete.ts +7 -5
  22. package/src/hooks/useMapCityBound.ts +5 -5
  23. package/src/hooks/useMapDrag.ts +7 -2
  24. package/src/hooks/useMapLog.ts +14 -2
  25. package/src/hooks/useMapPlace.ts +39 -16
  26. package/src/hooks/useMapRecomendPlace.ts +17 -4
  27. package/src/hooks-business/useBusinessMapAutoComplete.ts +3 -2
  28. package/src/hooks-business/useBusinessRecomendPlaceMap.ts +5 -5
  29. package/src/types/interface.ts +2 -1
  30. package/dist/hooks-business/useLagecyMapRecomendPlace.d.ts +0 -55
  31. package/src/hooks-business/useLagecyMapRecomendPlace.ts +0 -152
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .n8tgem0{position:absolute;bottom:50%;left:0;right:0;margin-left:auto;margin-right:auto;display:flex;flex-direction:column;align-items:center;z-index:1}.n8tgem1{padding:2.67vw 4.27vw;background:linear-gradient(90deg,#79AFFF 0%,#5C8DFF 32%,#507FFF 75%,#4471FF 100%);border-radius:3.2vw;display:flex;align-items:center}.n8tgem2{padding-right:2.67vw;max-width:41.33vw}.n8tgem3{display:-webkit-box;font-size:3.47vw;font-family:PingFangSC-Semibold,PingFang SC;font-weight:600;color:#fff;line-height:4.8vw;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.n8tgem4{margin-top:.53vw;font-size:2.93vw;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;color:#fff;line-height:4.27vw;opacity:.8}.n8tgem5{width:1.758vw;height:2.93vw}.n8tgem6{width:.8vw;height:4vw;background:#4C80FF;border-radius:0vw 0vw 26.67vw 26.67vw}.n8tgem7{width:6.9355vw;height:10.67vw}.rgf09w0{width:7.1045vw;height:10.93vw;display:flex}._15rq2xn0{display:flex;flex-direction:column;align-items:center;margin-bottom:-1.6vw}._15rq2xn1{padding:2.13vw 4.5vw 2.67vw 4.27vw;display:flex;align-items:center;background:linear-gradient(90deg,#79AFFF 0%,#5C8DFF 32%,#507FFF 75%,#4471FF 100%);border-radius:3.2vw}._15rq2xn2{font-size:3.47vw;font-family:PingFangSC-Semibold,PingFang SC;font-weight:600;color:#fff;line-height:4.8vw;white-space:nowrap}._15rq2xn3{font-size:2.93vw;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;color:#eafaf8;line-height:4.27vw;white-space:nowrap;opacity:.8}._15rq2xn4{margin-left:3.2vw;width:1.44vw;height:2.4vw}._15rq2xn5{width:.8vw;height:4vw;background:#4C80FF;border-radius:0vw 0vw 26.67vw 26.67vw;z-index:1}._15rq2xn6{margin-top:-1.5vw;width:3.2vw;height:3.2vw}._1d8ur7t0,._7anfuo0{position:relative}._4a4ovk0{margin-bottom:-.4vw;display:flex;flex-direction:column;align-items:center}._4a4ovk1{padding:1.07vw 2.4vw 1.6vw 2.67vw;background:#FFFFFF;box-shadow:0 .53vw 2.4vw #3f3f3f33;border-radius:2.13vw}._4a4ovk2{padding:2.67vw 2.67vw 2.4vw 3.2vw;background:#FFFFFF;box-shadow:0 0 2.67vw #4e556c26;border-radius:4.8vw;font-size:3.2vw;font-family:PingFangSC-Medium,PingFang SC;font-weight:500;color:#1e1e1e;line-height:4.53vw;white-space:nowrap}._4a4ovk3{font-size:3.2vw;font-family:PingFangSC-Medium,PingFang SC;font-weight:500;color:#1e1e1e;line-height:4.53vw;white-space:nowrap}._4a4ovk4{font-size:2.4vw;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;color:#7e7e7e;line-height:3.47vw;white-space:nowrap}._4a4ovk5{color:#4471ff;font-family:PingFangSC-Medium,PingFang SC;font-weight:500}._4a4ovk6{margin-top:1.33vw;width:6.192vw;height:7.998vw}._4a4ovk7{margin-top:2.4vw;width:6.192vw;height:7.998vw}._1l6offo0{display:flex}._1l6offo1{width:4.53vw;height:4.53vw;margin-bottom:-2.265vw}._1l6offo2{width:16.27vw;height:16.27vw;margin-bottom:-8.135vw}.fhyw80{display:flex;align-items:center}.fhyw81{flex-direction:row-reverse}.fhyw83{margin-right:-2.265vw}.fhyw84{margin-left:-2.265vw}.fhyw85{margin-bottom:-2.265vw}.fhyw86{margin-right:calc(50% - 2.265vw)}.fhyw87{margin-left:calc(50% - 2.265vw)}.fhyw88{display:flex;width:4.53vw;height:4.53vw}.fhyw89{opacity:0}.fhyw8b{font-size:3.47vw;font-family:PingFangSC-Semibold,PingFang SC;font-weight:600;color:#243e66;line-height:4.53vw;white-space:nowrap}._65j3sr1{margin-top:1.87vw;margin-bottom:-5.5vw;width:6vw;height:11vw}@keyframes rrvp0y0{0%{transform:scale(0);opacity:1}33.33%{transform:scale(.5);opacity:1}66.66%{transform:scale(1);opacity:0}to{transform:scale(1);opacity:0}}@keyframes rrvp0y1{0%{transform:scale(0);opacity:0}33.33%{transform:scale(0);opacity:1}66.66%{transform:scale(.5);opacity:1}to{transform:scale(1);opacity:0}}.rrvp0y2{display:flex;margin-bottom:-30.935vw;width:61.87vw;height:61.87vw;animation-name:rrvp0y0;animation-duration:3s;animation-iteration-count:infinite;animation-timing-function:linear}.rrvp0y3{animation-name:rrvp0y1}
1
+ .n8tgem0{pointer-events:none;position:absolute;bottom:50%;left:0;right:0;margin-left:auto;margin-right:auto;display:flex;flex-direction:column;align-items:center;z-index:1}.n8tgem1{pointer-events:auto;padding:2.67vw 4.27vw;background:linear-gradient(90deg,#79AFFF 0%,#5C8DFF 32%,#507FFF 75%,#4471FF 100%);border-radius:3.2vw;display:flex;align-items:center}.n8tgem2{padding-right:2.67vw;max-width:41.33vw}.n8tgem3{display:-webkit-box;font-size:3.47vw;font-family:PingFangSC-Semibold,PingFang SC;font-weight:600;color:#fff;line-height:4.8vw;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.n8tgem4{margin-top:.53vw;font-size:2.93vw;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;color:#fff;line-height:4.27vw;opacity:.8}.n8tgem5{width:1.758vw;height:2.93vw}.n8tgem6{width:.8vw;height:4vw;background:#4C80FF;border-radius:0vw 0vw 26.67vw 26.67vw}.n8tgem7{width:6.9355vw;height:10.67vw}.rgf09w0{width:7.1045vw;height:10.93vw;display:flex}._15rq2xn0{display:flex;flex-direction:column;align-items:center;margin-bottom:-1.6vw}._15rq2xn1{padding:2.13vw 4.5vw 2.67vw 4.27vw;display:flex;align-items:center;background:linear-gradient(90deg,#79AFFF 0%,#5C8DFF 32%,#507FFF 75%,#4471FF 100%);border-radius:3.2vw}._15rq2xn2{font-size:3.47vw;font-family:PingFangSC-Semibold,PingFang SC;font-weight:600;color:#fff;line-height:4.8vw;white-space:nowrap}._15rq2xn3{font-size:2.93vw;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;color:#eafaf8;line-height:4.27vw;white-space:nowrap;opacity:.8}._15rq2xn4{margin-left:3.2vw;width:1.44vw;height:2.4vw}._15rq2xn5{width:.8vw;height:4vw;background:#4C80FF;border-radius:0vw 0vw 26.67vw 26.67vw;z-index:1}._15rq2xn6{margin-top:-1.5vw;width:3.2vw;height:3.2vw}._1d8ur7t0,._7anfuo0{position:relative}._4a4ovk0{margin-bottom:-.4vw;display:flex;flex-direction:column;align-items:center}._4a4ovk1{padding:1.07vw 2.4vw 1.6vw 2.67vw;background:#FFFFFF;box-shadow:0 .53vw 2.4vw #3f3f3f33;border-radius:2.13vw}._4a4ovk2{padding:2.67vw 2.67vw 2.4vw 3.2vw;background:#FFFFFF;box-shadow:0 0 2.67vw #4e556c26;border-radius:4.8vw;font-size:3.2vw;font-family:PingFangSC-Medium,PingFang SC;font-weight:500;color:#1e1e1e;line-height:4.53vw;white-space:nowrap}._4a4ovk3{font-size:3.2vw;font-family:PingFangSC-Medium,PingFang SC;font-weight:500;color:#1e1e1e;line-height:4.53vw;white-space:nowrap}._4a4ovk4{font-size:2.4vw;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;color:#7e7e7e;line-height:3.47vw;white-space:nowrap}._4a4ovk5{color:#4471ff;font-family:PingFangSC-Medium,PingFang SC;font-weight:500}._4a4ovk6{margin-top:1.33vw;width:6.192vw;height:7.998vw}._4a4ovk7{margin-top:2.4vw;width:6.192vw;height:7.998vw}._1l6offo0{display:flex}._1l6offo1{width:4.53vw;height:4.53vw;margin-bottom:-2.265vw}._1l6offo2{width:16.27vw;height:16.27vw;margin-bottom:-8.135vw}.fhyw80{display:flex;align-items:center}.fhyw81{flex-direction:row-reverse}.fhyw83{margin-right:-2.265vw}.fhyw84{margin-left:-2.265vw}.fhyw85{margin-bottom:-2.265vw}.fhyw86{margin-right:calc(50% - 2.265vw)}.fhyw87{margin-left:calc(50% - 2.265vw)}.fhyw88{display:flex;width:4.53vw;height:4.53vw}.fhyw89{opacity:0}.fhyw8b{font-size:3.47vw;font-family:PingFangSC-Semibold,PingFang SC;font-weight:600;color:#243e66;line-height:4.53vw;white-space:nowrap}._65j3sr1{margin-top:1.87vw;margin-bottom:-5.5vw;width:6vw;height:11vw}@keyframes rrvp0y0{0%{transform:scale(0);opacity:1}33.33%{transform:scale(.5);opacity:1}66.66%{transform:scale(1);opacity:0}to{transform:scale(1);opacity:0}}@keyframes rrvp0y1{0%{transform:scale(0);opacity:0}33.33%{transform:scale(0);opacity:1}66.66%{transform:scale(.5);opacity:1}to{transform:scale(1);opacity:0}}.rrvp0y2{display:flex;margin-bottom:-30.935vw;width:61.87vw;height:61.87vw;animation-name:rrvp0y0;animation-duration:3s;animation-iteration-count:infinite;animation-timing-function:linear}.rrvp0y3{animation-name:rrvp0y1}
@@ -7,13 +7,14 @@ export type Place = {
7
7
  lat: number;
8
8
  name: string;
9
9
  cityName?: string;
10
+ cityParentName?: string;
10
11
  countryName?: string;
11
12
  };
12
13
  export interface AutoCompletePlace extends Place {
13
14
  placeId?: string;
14
15
  description: string;
15
16
  }
16
- export type City = {
17
+ export type Region = {
17
18
  bound?: {
18
19
  east: number;
19
20
  north: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite -c vite.config.dev.ts",
@@ -1,4 +1,4 @@
1
- import { computed } from "vue-demi";
1
+ import { computed, reactive } from "vue-demi";
2
2
  import {
3
3
  BusinessRecomendPlaceMap,
4
4
  BusinessRecomendPlaceMapProps,
@@ -6,11 +6,13 @@ import {
6
6
  import { useBusinessMapAutoComplete } from "../hooks-business/useBusinessMapAutoComplete";
7
7
  import { useBusinessRecomendPlaceMap } from "../hooks-business/useBusinessRecomendPlaceMap";
8
8
  import { defineSetup } from "../types/helper";
9
+ import type { Region } from "../types/interface";
9
10
  import * as css from "./Demo.css";
10
11
 
11
12
  const SomeAutoComplete = defineSetup(function SomeAutoComplete(props: { cityName: string }) {
12
13
  const { autoCompletePlaces, handleKeywordInput, setCity } = useBusinessMapAutoComplete({
13
14
  cityNameRef: computed(() => props.cityName),
15
+ log: true,
14
16
  });
15
17
  (window as any).setCity = setCity;
16
18
  return () => {
@@ -31,6 +33,8 @@ const SomeAutoComplete = defineSetup(function SomeAutoComplete(props: { cityName
31
33
  });
32
34
 
33
35
  export const DemoBusinessRecomendPlace = defineSetup(function DemoBusinessRecomendPlace() {
36
+ const city = reactive<Region>({ name: "" });
37
+ const cityParent = reactive<Region>({ name: "" });
34
38
  const getRecomendPlace: BusinessRecomendPlaceMapProps["getRecomendPlace"] = async (
35
39
  place,
36
40
  context
@@ -45,30 +49,34 @@ export const DemoBusinessRecomendPlace = defineSetup(function DemoBusinessRecome
45
49
  const {
46
50
  centerPlace,
47
51
  placeCandidates,
48
- setCenterPlaceByRecomand,
52
+ setCenterPlaceByUserSpecified,
49
53
  mapContext,
50
- apiMapDistance,
51
54
  panToGeoPositionByRecomend,
52
55
  } = useBusinessRecomendPlaceMap();
53
- (window as any).setCenterPlaceByRecomand = setCenterPlaceByRecomand;
56
+ (window as any).setCenterPlaceByUserSpecified = setCenterPlaceByUserSpecified;
54
57
  (window as any).panToGeoPositionByRecomend = panToGeoPositionByRecomend;
55
58
  return () => {
56
59
  return (
57
60
  <div>
58
61
  placeCandidates: {placeCandidates} <br />
59
- centerPlace: {centerPlace.lng} | {centerPlace.lat} | {centerPlace.name} |{" "}
60
- {centerPlace.cityName} | {centerPlace.countryName} <br />
61
- <SomeAutoComplete cityName="Taiwan"></SomeAutoComplete>
62
+ centerPlace: {centerPlace.lng} | {centerPlace.lat} | {centerPlace.name} | {city.name} |{" "}
63
+ {cityParent.name} <br />
64
+ <SomeAutoComplete cityName="Shinjuku-ku"></SomeAutoComplete>
62
65
  <BusinessRecomendPlaceMap
63
66
  class={css.demo}
67
+ geoLoadingTitle={"正在读取GPS位置信息..."}
64
68
  unavailableTitle={"当前区域暂未开通服务"}
65
69
  noRecomendDescription={"附近无推荐上车地点"}
66
70
  recomendDescription={"最佳上车地点"}
67
- geoDefaultPosition={[103.771994, 1.296648]}
71
+ geoDefaultPosition={[139.728287, 35.661007]}
68
72
  getRecomendPlace={getRecomendPlace}
69
73
  mapContext={mapContext}
70
74
  onGeoError={(e) => console.log("onGeoError e = ", e)}
71
75
  onClickLocator={() => alert("hi")}
76
+ onChangeCity={({ cityName, cityParentName }) => {
77
+ city.name = cityName ?? "";
78
+ cityParent.name = cityParentName ?? "";
79
+ }}
72
80
  />
73
81
  </div>
74
82
  );