@heycar/heycars-map 2.7.2 → 2.8.0

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 (45) hide show
  1. package/dist/v2/api/gaodeDirectionDriving.js +21 -6
  2. package/dist/v2/business-components/BusinessQuotingMap/BusinessQuotingMap.js +6 -4
  3. package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.js +22 -13
  4. package/dist/v2/business-components/DrivingLine/DrivingLine.d.ts +5 -1
  5. package/dist/v2/business-components/DrivingLine/DrivingLine.js +44 -10
  6. package/dist/v2/business-components/DrivingRoute/DrivingRoute.d.ts +2 -1
  7. package/dist/v2/business-components/DrivingRoute/DrivingRoute.js +4 -2
  8. package/dist/v2/business-components/TrafficDrivingLine/TrafficDrivingLine.d.ts +6 -0
  9. package/dist/v2/business-components/TrafficDrivingLine/TrafficDrivingLine.js +93 -0
  10. package/dist/v2/business-components/TrafficDrivingLine/index.d.ts +1 -0
  11. package/dist/v2/business-components/TrafficDrivingLine/index.js +4 -0
  12. package/dist/v2/components/AmapMarker/AmapMarker.js +0 -2
  13. package/dist/v2/hooks/useDeviationCorrectionDrivingRoute.d.ts +2 -0
  14. package/dist/v2/hooks/useDrivingRoute.d.ts +3 -0
  15. package/dist/v2/hooks/useDrivingRoute.js +2 -1
  16. package/dist/v2/hooks/useDrivingTrackCorrection.d.ts +1 -0
  17. package/dist/v2/types/amap/driving.d.ts +2 -1
  18. package/dist/v2/types/interface.d.ts +3 -0
  19. package/dist/v2/utils/compatibleDrivingRoute.js +21 -2
  20. package/dist/v2/utils/log.js +1 -1
  21. package/dist/v2/utils/transform.d.ts +3 -1
  22. package/dist/v2/utils/transform.js +19 -1
  23. package/dist/v3/api/gaodeDirectionDriving.js +21 -6
  24. package/dist/v3/business-components/BusinessQuotingMap/BusinessQuotingMap.js +6 -4
  25. package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.js +22 -13
  26. package/dist/v3/business-components/DrivingLine/DrivingLine.d.ts +5 -1
  27. package/dist/v3/business-components/DrivingLine/DrivingLine.js +44 -10
  28. package/dist/v3/business-components/DrivingRoute/DrivingRoute.d.ts +2 -1
  29. package/dist/v3/business-components/DrivingRoute/DrivingRoute.js +4 -2
  30. package/dist/v3/business-components/TrafficDrivingLine/TrafficDrivingLine.d.ts +8 -0
  31. package/dist/v3/business-components/TrafficDrivingLine/TrafficDrivingLine.js +91 -0
  32. package/dist/v3/business-components/TrafficDrivingLine/index.d.ts +1 -0
  33. package/dist/v3/business-components/TrafficDrivingLine/index.js +4 -0
  34. package/dist/v3/components/AmapMarker/AmapMarker.js +0 -2
  35. package/dist/v3/hooks/useDeviationCorrectionDrivingRoute.d.ts +2 -0
  36. package/dist/v3/hooks/useDrivingRoute.d.ts +3 -0
  37. package/dist/v3/hooks/useDrivingRoute.js +2 -1
  38. package/dist/v3/hooks/useDrivingTrackCorrection.d.ts +1 -0
  39. package/dist/v3/types/amap/driving.d.ts +2 -1
  40. package/dist/v3/types/interface.d.ts +3 -0
  41. package/dist/v3/utils/compatibleDrivingRoute.js +21 -2
  42. package/dist/v3/utils/log.js +1 -1
  43. package/dist/v3/utils/transform.d.ts +3 -1
  44. package/dist/v3/utils/transform.js +19 -1
  45. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /// <reference types="google.maps" />
2
- import type { LngLatLiterial, Place, Point, TrackPoint, Zone } from "../types/interface";
2
+ import type { LngLatLiterial, Place, Point, TrackPoint, TrafficStatus, Zone } from "../types/interface";
3
3
  import type { AlipayMyGetLocationSuccessResponse } from "../types/my";
4
4
  import type { WxGetLocationSuccessResponse } from "../types/wx";
5
5
  import { BRWOSER_PLATFORM } from "./platform";
@@ -9,6 +9,7 @@ export declare const lnglat2point: ({ lng, lat }: {
9
9
  lng: number;
10
10
  lat: number;
11
11
  }) => Point;
12
+ export declare const stringifyPoint: (p: Point) => `${number},${number}`;
12
13
  export declare const googlePointsStringify: (points: Point[]) => string;
13
14
  export declare const gaodePointsStringify: (points: Point[]) => string;
14
15
  export interface AsteriskItem {
@@ -45,4 +46,5 @@ export declare const maybeFunctionToFunction: <T>(value: T) => MaybeFunctionToFu
45
46
  export declare const signal2promise: (signal?: AbortSignal) => Promise<any>;
46
47
  export declare const googleEncodedPolyline2googleLatLng: (value: string) => google.maps.LatLng[];
47
48
  export declare const gaodePolyline2amapLngLat: (value: string) => AMap.LngLat[];
49
+ export declare const amapTraffic2trafficStatus: (value?: AMap.TMC["status"]) => TrafficStatus;
48
50
  export {};
@@ -42,8 +42,9 @@ const vec2lnglat = ([lng, lat]) => ({
42
42
  lat: Number(lat)
43
43
  });
44
44
  const lnglat2point = ({ lng, lat }) => [lng, lat];
45
+ const stringifyPoint = (p) => `${p[0]},${p[1]}`;
45
46
  const googlePointsStringify = (points) => points.map(([lng, lat]) => `${lat},${lng}`).join("|");
46
- const gaodePointsStringify = (points) => points.map(([lng, lat]) => `${lng},${lat}`).join(";");
47
+ const gaodePointsStringify = (points) => points.map(stringifyPoint).join(";");
47
48
  const decodeAsterisk = (encodedValue) => {
48
49
  const result = [];
49
50
  const tokens = encodedValue.split("*");
@@ -287,10 +288,26 @@ const gaodePolyline2amapLngLat = (value) => {
287
288
  return { lng, lat };
288
289
  });
289
290
  };
291
+ const amapTraffic2trafficStatus = (value) => {
292
+ switch (value) {
293
+ case void 0:
294
+ case "未知":
295
+ return "UNKNOWN";
296
+ case "畅通":
297
+ return "NORMAL";
298
+ case "缓行":
299
+ return "SLOW";
300
+ case "拥堵":
301
+ return "TRAFFIC_JAM";
302
+ case "严重拥堵":
303
+ return "HEAVY_TRAFFIC_JAM";
304
+ }
305
+ };
290
306
  export {
291
307
  alipayMyGetLocationError2GeolocationPositionErrorCode,
292
308
  alipayMyGetLocationSuccessResponse2GeolocationPosition,
293
309
  amapPlaceName2DisplayName,
310
+ amapTraffic2trafficStatus,
294
311
  businessCandidatesToAdsorptionPlace,
295
312
  combineHandler,
296
313
  decodeAsterisk,
@@ -316,6 +333,7 @@ export {
316
333
  property2emitEventName,
317
334
  property2mapEventName,
318
335
  signal2promise,
336
+ stringifyPoint,
319
337
  trackPoints2amapGraspRoadPoints,
320
338
  vec2lnglat,
321
339
  wxGetLocationSuccessResponse2GeolocationPosition
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "2.7.2",
3
+ "version": "2.8.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "checkVersion": "./bin/checkVersion.js",