@heycar/heycars-map 0.9.9 → 0.9.11

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.cjs CHANGED
@@ -9,7 +9,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
9
9
  const Vue = require("vue");
10
10
  const style_css_ts_vanilla = "";
11
11
  const name = "@heycar/heycars-map";
12
- const version = "0.9.9";
12
+ const version = "0.9.11";
13
13
  const type = "module";
14
14
  const bin = {
15
15
  checkVersion: "./bin/checkVersion.js"
@@ -1162,6 +1162,17 @@ const pausableSleep = (milliSeconds) => {
1162
1162
  };
1163
1163
  return { sleepPromise: sleepDefered, pause, restart };
1164
1164
  };
1165
+ const createRunOnce = (fn) => {
1166
+ let isExcuted = false;
1167
+ let result;
1168
+ return function runOnce(...args) {
1169
+ if (isExcuted)
1170
+ return result;
1171
+ isExcuted = true;
1172
+ result = fn(...args);
1173
+ return result;
1174
+ };
1175
+ };
1165
1176
  const MAX_ANIMATION_DISTANCE_VW = 300;
1166
1177
  const MIN_ANIMATION_DURATION = 300;
1167
1178
  const ANIMATION_DURATION_FOR_100VW = 200;
@@ -6984,12 +6995,12 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
6984
6995
  slots
6985
6996
  }) {
6986
6997
  const {
6987
- getRecomendPlace,
6988
6998
  mapContext,
6989
6999
  disableLocator,
6990
7000
  defaultPlace = {
6991
7001
  ...emptyPlace
6992
- }
7002
+ },
7003
+ getRecomendPlace
6993
7004
  } = props;
6994
7005
  const pipedGetRecomendPlace = pipeOnlyLastEffect(getRecomendPlace);
6995
7006
  const {
@@ -7018,6 +7029,10 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
7018
7029
  centerSource.source = "api";
7019
7030
  updatePlace(point);
7020
7031
  };
7032
+ const setCenterPlaceDisplayNameOnce = createRunOnce((input) => {
7033
+ if (input)
7034
+ centerPlace.displayName = String(input);
7035
+ });
7021
7036
  const setCenterPlaceByUserSpecified = async (input) => {
7022
7037
  centerSource.source = "api";
7023
7038
  const place = toPlaceType(input);
@@ -7071,6 +7086,7 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
7071
7086
  geoDefaultPosition: place2point(defaultPlace),
7072
7087
  onError: (e) => emit("geoError", e)
7073
7088
  });
7089
+ mapContext.setCenterPlaceDisplayNameOnce = setCenterPlaceDisplayNameOnce;
7074
7090
  mapContext.setCenterPlaceByUserSpecified = setCenterPlaceByUserSpecified;
7075
7091
  mapContext.setCenterPlaceByUserSpecifiedInZone = setCenterPlaceByUserSpecifiedInZone;
7076
7092
  mapContext.panToGeoPositionByRecomend = () => {
@@ -8352,12 +8368,16 @@ const useBusinessRecomendPlaceMap = () => {
8352
8368
  const { apiMapDistance } = useMapGeometry();
8353
8369
  const { inChina } = useMapInChina();
8354
8370
  const panToGeoPositionByRecomend = (value) => mapContext.panToGeoPositionByRecomend(value);
8371
+ const setCenterPlaceDisplayNameOnce = (value) => mapContext.setCenterPlaceDisplayNameOnce(value);
8355
8372
  const setCenterPlaceByUserSpecified = (value) => mapContext.setCenterPlaceByUserSpecified(value);
8356
8373
  const setCenterPlaceByUserSpecifiedInZone = (value) => mapContext.setCenterPlaceByUserSpecifiedInZone(value);
8357
8374
  const mapContext = {
8358
8375
  panToGeoPositionByRecomend: () => {
8359
8376
  throw new Error("MyError: panToGeoPositionByRecomend used before assigned");
8360
8377
  },
8378
+ setCenterPlaceDisplayNameOnce: () => {
8379
+ throw new Error("MyError: setCenterPlaceDisplayName used before assigned");
8380
+ },
8361
8381
  setCenterPlaceByUserSpecified: () => {
8362
8382
  throw new Error("MyError: setCenterPlaceByRecomand used before assigned");
8363
8383
  },
@@ -8376,6 +8396,7 @@ const useBusinessRecomendPlaceMap = () => {
8376
8396
  centerPlace,
8377
8397
  placeCandidates,
8378
8398
  panToGeoPositionByRecomend,
8399
+ setCenterPlaceDisplayNameOnce,
8379
8400
  setCenterPlaceByUserSpecified,
8380
8401
  setCenterPlaceByUserSpecifiedInZone,
8381
8402
  apiMapDistance,
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ var __publicField = (obj, key, value) => {
7
7
  import Vue, { defineComponent, h, computed, inject, provide, watch, onMounted, onUnmounted, watchPostEffect, shallowRef, ref, watchEffect, reactive, toRefs, toRef } from "vue";
8
8
  const style_css_ts_vanilla = "";
9
9
  const name = "@heycar/heycars-map";
10
- const version = "0.9.9";
10
+ const version = "0.9.11";
11
11
  const type = "module";
12
12
  const bin = {
13
13
  checkVersion: "./bin/checkVersion.js"
@@ -1160,6 +1160,17 @@ const pausableSleep = (milliSeconds) => {
1160
1160
  };
1161
1161
  return { sleepPromise: sleepDefered, pause, restart };
1162
1162
  };
1163
+ const createRunOnce = (fn) => {
1164
+ let isExcuted = false;
1165
+ let result;
1166
+ return function runOnce(...args) {
1167
+ if (isExcuted)
1168
+ return result;
1169
+ isExcuted = true;
1170
+ result = fn(...args);
1171
+ return result;
1172
+ };
1173
+ };
1163
1174
  const MAX_ANIMATION_DISTANCE_VW = 300;
1164
1175
  const MIN_ANIMATION_DURATION = 300;
1165
1176
  const ANIMATION_DURATION_FOR_100VW = 200;
@@ -6982,12 +6993,12 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
6982
6993
  slots
6983
6994
  }) {
6984
6995
  const {
6985
- getRecomendPlace,
6986
6996
  mapContext,
6987
6997
  disableLocator,
6988
6998
  defaultPlace = {
6989
6999
  ...emptyPlace
6990
- }
7000
+ },
7001
+ getRecomendPlace
6991
7002
  } = props;
6992
7003
  const pipedGetRecomendPlace = pipeOnlyLastEffect(getRecomendPlace);
6993
7004
  const {
@@ -7016,6 +7027,10 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
7016
7027
  centerSource.source = "api";
7017
7028
  updatePlace(point);
7018
7029
  };
7030
+ const setCenterPlaceDisplayNameOnce = createRunOnce((input) => {
7031
+ if (input)
7032
+ centerPlace.displayName = String(input);
7033
+ });
7019
7034
  const setCenterPlaceByUserSpecified = async (input) => {
7020
7035
  centerSource.source = "api";
7021
7036
  const place = toPlaceType(input);
@@ -7069,6 +7084,7 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
7069
7084
  geoDefaultPosition: place2point(defaultPlace),
7070
7085
  onError: (e) => emit("geoError", e)
7071
7086
  });
7087
+ mapContext.setCenterPlaceDisplayNameOnce = setCenterPlaceDisplayNameOnce;
7072
7088
  mapContext.setCenterPlaceByUserSpecified = setCenterPlaceByUserSpecified;
7073
7089
  mapContext.setCenterPlaceByUserSpecifiedInZone = setCenterPlaceByUserSpecifiedInZone;
7074
7090
  mapContext.panToGeoPositionByRecomend = () => {
@@ -8350,12 +8366,16 @@ const useBusinessRecomendPlaceMap = () => {
8350
8366
  const { apiMapDistance } = useMapGeometry();
8351
8367
  const { inChina } = useMapInChina();
8352
8368
  const panToGeoPositionByRecomend = (value) => mapContext.panToGeoPositionByRecomend(value);
8369
+ const setCenterPlaceDisplayNameOnce = (value) => mapContext.setCenterPlaceDisplayNameOnce(value);
8353
8370
  const setCenterPlaceByUserSpecified = (value) => mapContext.setCenterPlaceByUserSpecified(value);
8354
8371
  const setCenterPlaceByUserSpecifiedInZone = (value) => mapContext.setCenterPlaceByUserSpecifiedInZone(value);
8355
8372
  const mapContext = {
8356
8373
  panToGeoPositionByRecomend: () => {
8357
8374
  throw new Error("MyError: panToGeoPositionByRecomend used before assigned");
8358
8375
  },
8376
+ setCenterPlaceDisplayNameOnce: () => {
8377
+ throw new Error("MyError: setCenterPlaceDisplayName used before assigned");
8378
+ },
8359
8379
  setCenterPlaceByUserSpecified: () => {
8360
8380
  throw new Error("MyError: setCenterPlaceByRecomand used before assigned");
8361
8381
  },
@@ -8374,6 +8394,7 @@ const useBusinessRecomendPlaceMap = () => {
8374
8394
  centerPlace,
8375
8395
  placeCandidates,
8376
8396
  panToGeoPositionByRecomend,
8397
+ setCenterPlaceDisplayNameOnce,
8377
8398
  setCenterPlaceByUserSpecified,
8378
8399
  setCenterPlaceByUserSpecifiedInZone,
8379
8400
  apiMapDistance,
@@ -5,6 +5,7 @@ export interface SetCenterPlaceByUserSpecifiedInZoneProps {
5
5
  }
6
6
  export interface BusinessRecomendPlaceContext {
7
7
  panToGeoPositionByRecomend: (value: Point) => void;
8
+ setCenterPlaceDisplayNameOnce: (value: string) => void;
8
9
  setCenterPlaceByUserSpecified: (value: Place) => void;
9
10
  setCenterPlaceByUserSpecifiedInZone: (value: SetCenterPlaceByUserSpecifiedInZoneProps) => void;
10
11
  onChangeCenterPlace: (value: Place) => void;
@@ -25,6 +26,7 @@ export declare const useBusinessRecomendPlaceMap: () => {
25
26
  displayName: string;
26
27
  }[]>;
27
28
  panToGeoPositionByRecomend: (value: Point) => void;
29
+ setCenterPlaceDisplayNameOnce: (value: string) => void;
28
30
  setCenterPlaceByUserSpecified: (value: Place) => void;
29
31
  setCenterPlaceByUserSpecifiedInZone: (value: SetCenterPlaceByUserSpecifiedInZoneProps) => void;
30
32
  apiMapDistance: (from: Point, to: Point) => number | undefined;
@@ -13,6 +13,7 @@ export declare const useBusinessReselectPlaceMap: () => {
13
13
  displayName: string;
14
14
  }[]>;
15
15
  panToGeoPositionByRecomend: (value: import("..").Point) => void;
16
+ setCenterPlaceDisplayNameOnce: (value: string) => void;
16
17
  setCenterPlaceByUserSpecified: (value: import("..").Place) => void;
17
18
  setCenterPlaceByUserSpecifiedInZone: (value: import("./useBusinessRecomendPlaceMap").SetCenterPlaceByUserSpecifiedInZoneProps) => void;
18
19
  apiMapDistance: (from: import("..").Point, to: import("..").Point) => number | undefined;
@@ -20,4 +20,5 @@ export declare const pausableSleep: (milliSeconds: number) => {
20
20
  pause: () => void;
21
21
  restart: () => void;
22
22
  };
23
+ export declare const createRunOnce: <P extends any[], R>(fn: (...args: P) => R) => (...args: P) => R;
23
24
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "0.9.9",
3
+ "version": "0.9.11",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "checkVersion": "./bin/checkVersion.js"