mrxy-yk 1.2.7 → 1.2.8

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.
@@ -11,16 +11,16 @@ type __VLS_Props = {
11
11
  };
12
12
  declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
13
13
  change: (...args: any[]) => void;
14
+ open: (...args: any[]) => void;
14
15
  "update:modelValue": (...args: any[]) => void;
15
16
  "update:lnglat": (...args: any[]) => void;
16
17
  "update:address": (...args: any[]) => void;
17
- open: (...args: any[]) => void;
18
18
  }, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
19
19
  onChange?: (...args: any[]) => any;
20
+ onOpen?: (...args: any[]) => any;
20
21
  "onUpdate:modelValue"?: (...args: any[]) => any;
21
22
  "onUpdate:lnglat"?: (...args: any[]) => any;
22
23
  "onUpdate:address"?: (...args: any[]) => any;
23
- onOpen?: (...args: any[]) => any;
24
24
  }>, {
25
25
  regeocodeRequired: boolean;
26
26
  }, {}, {}, {}, string, ComponentProvideOptions, false, {
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import { useEmptyHooks } from "./components/empty/hooks/index.js";
7
7
  import { MatchUnit } from "./utils/match-unit/index.js";
8
8
  import { TransitionFade } from "./utils/transition-fade/index.js";
9
9
  import { echarts } from "./utils/echarts/index.js";
10
- import { AMapLoader, useAMapLoader, useAMapMap, useAMapMarkerCluster } from "./utils/amap/index.js";
10
+ import { AMapLoader, newAMapInfoWindow, newAMapMap, newAMapMarkerCluster, useAMapLoader } from "./utils/amap/index.js";
11
11
  import { Pages } from "./entity/Pages.js";
12
12
  import { BigFloat } from "./entity/BigFloat.js";
13
13
  import { RejectError } from "./entity/RejectError.js";
@@ -83,6 +83,9 @@ export {
83
83
  integerTag,
84
84
  ipRule,
85
85
  ipTag,
86
+ newAMapInfoWindow,
87
+ newAMapMap,
88
+ newAMapMarkerCluster,
86
89
  numberRule,
87
90
  numberTag,
88
91
  passwordRule,
@@ -97,8 +100,6 @@ export {
97
100
  positiveNumberTag,
98
101
  required,
99
102
  useAMapLoader,
100
- useAMapMap,
101
- useAMapMarkerCluster,
102
103
  useEChartsRef,
103
104
  useEcBarOption,
104
105
  useEcBasicOption,
@@ -1 +1 @@
1
- .yk-position-anchor{position:absolute;width:0;height:0;display:flex}.yk-position-anchor.position-anchor--center{justify-content:center;align-items:center}.yk-position-anchor.position-anchor--top-left{justify-content:left;align-items:flex-start}.yk-position-anchor.position-anchor--top-right{justify-content:right;align-items:flex-start}.yk-position-anchor.position-anchor--bottom-left{justify-content:left;align-items:flex-end}.yk-position-anchor.position-anchor--bottom-right{justify-content:right;align-items:flex-end}.yk-position-anchor.position-anchor--bottom{justify-content:center;align-items:flex-end}.yk-position-anchor.position-anchor--top{justify-content:center;align-items:flex-start}.yk-position-anchor.position-anchor--right{justify-content:flex-end;align-items:center}.yk-position-anchor.position-anchor--left{justify-content:flex-start;align-items:center}.yk-progress-ring{display:block}.yk-progress-ring circle{transform-box:fill-box;transform-origin:center;transition:all var(--duration) ease-in-out}.yk-adaptive-box .adaptive-box__body{overflow:hidden;margin-left:auto;margin-right:auto}.yk-adaptive-box .adaptive-box__content{transform-origin:left top;width:fit-content;--adaptive-height: initial}.yk-coordinate-pickup-autocomplete li{margin-bottom:8px}.yk-coordinate-pickup-autocomplete .autocomplete-subtitle{font-size:12px;color:var(--el-text-color-secondary);line-height:12px}.yk-coordinate-pickup-form .el-form-item{margin-right:16px}.coordinate-pickup{height:50vh;min-height:400px;max-height:920px}.amap-content-body,.amap-content-body .amap-lib-infowindow{background:inherit}.yk-drag-drop-box{position:absolute}.yk-drag-drop-container .drag-drop-content{width:fit-content;height:fit-content}.yk-progress-bar{position:relative;display:flex;align-items:center}.yk-progress-bar .progress-dot{width:0;display:flex;justify-content:center;align-items:center;position:absolute;transition:all .5s}.yk-ys-video .icon--replay{display:flex;align-items:center;justify-content:center;font-size:20px;margin-top:4px}.yk-ys-video .icon--replay .icon--btn{color:#fff}.yk-ys-video .icon--replay .icon--btn.is-active{color:#157edf}.yk-ys-video{overflow:hidden;width:100%;height:100%;position:relative}.yk-ys-video .video-container{width:100%;height:100%}.yk-ys-video .icon--replay{position:absolute;top:0;right:64px}.yk-ys-video .header-controls div:nth-child(2) .theme-icon-item{width:32px!important;display:flex;justify-content:center;align-items:center;padding-top:6px}.yk-ys-video .header-controls div:nth-child(2) .theme-icon-item svg{height:48px!important;width:48px!important}.yk-ys-video .header-controls div:nth-child(2) .theme-icon-item:last-child{padding-left:16px}.yk-ys-video .play-mask{position:absolute;width:100%;height:100%;display:flex;align-items:center;justify-content:center;background-color:#626365;background-repeat:no-repeat;background-size:100% 100%;top:0;left:0}.yk-ys-video .play-mask .header{position:absolute;height:20%;inset:0 auto auto 0;min-height:48px;background:linear-gradient(to bottom,#0008 0,#0006 30%,#0003 50%,#0000);padding:10px 8px;width:100%}.yk-ys-video .play-mask .header .title-box{max-width:50%;height:48px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#fff}.yk-ys-video .play-mask .play-btn{cursor:pointer}.yk-show-log{background:#fff;border-radius:5px;padding:10px;-webkit-user-select:none;user-select:none;box-shadow:0 2px 4px #ccc;min-width:150px}.yk-show-log.is-min{overflow:hidden}.yk-show-log .show-log__header{display:flex;align-items:center;justify-content:space-between}.yk-show-log .show-log--icon{cursor:pointer}.yk-empty{position:relative;--yk-empty-description-font-size: var(--el-font-size-base, 14px);--yk-empty-description-color: var(--el-text-color-secondary, #909399);--yk-empty-description-margin-top: var(--el-empty-description-margin-top, 20px);--yk-empty-bottom-margin-top: var(--el-empty-bottom-margin-top, 20px);--yk-empty-image-opacity: 1;--yk-empty-image-hue-rotate: 0deg}.yk-empty .empty_content{width:100%;height:100%}.yk-empty .empty_content.is-hide{opacity:0}.yk-empty .empty_error{width:100%;height:100%;position:absolute;z-index:5;display:flex;flex-direction:column;justify-content:center;align-items:center}.yk-empty .empty_error .empty__image{background-repeat:no-repeat;background-position:center;background-size:contain;width:var(--yk-empty-image-size);height:var(--yk-empty-image-size);opacity:var(--yk-empty-image-opacity);filter:hue-rotate(var(--yk-empty-image-hue-rotate))}.yk-empty .empty_error .empty__description{font-size:var(--yk-empty-description-font-size);color:var(--yk-empty-description-color);margin-top:var(--yk-empty-description-margin-top)}.yk-empty .empty_error .empty__bottom{margin-top:var(--yk-empty-bottom-margin-top)}.yk-echarts-canvas{position:relative;container-type:size}.yk-echarts-canvas .echarts-empty{position:absolute;width:100%;height:100%;z-index:999}.yk-echarts-canvas .echarts-slot-default{position:absolute;width:100%;height:100%;top:0}.yk-echarts-canvas .echarts-canvas__inner{width:100%;height:100%;position:absolute;z-index:2}.yk-echarts-canvas .echarts-canvas__inner.is-empty{opacity:0}.yk-scroll-container{overflow:auto}.yk-scroll-container::-webkit-scrollbar{width:0;height:0}.yk-scroll-container .scroll-inner{display:flex;width:100%;flex-direction:column}.yk-pagination{padding:16px 0 8px}.yk-pagination .el-pagination{--el-pagination-bg-color: transparent;--el-pagination-button-disabled-bg-color: transparent}.yk-upload-image{margin-bottom:-8px}.yk-upload-image.limit_is-max .el-upload-list--picture-card .el-upload--picture-card{display:none}.yk-upload-image .el-upload-list--picture-card .el-upload-list__item{width:var(--upload-size-w);height:var(--upload-size-h)}.yk-upload-image .el-upload-list--picture-card .el-upload-list__item.is-success:focus:not(:hover) .el-icon--close-tip{display:none!important}.yk-upload-image .el-upload-list--picture-card .el-upload-list__item.is-success:focus .el-upload-list__item-status-label{display:inline-flex;opacity:1}.yk-upload-image .el-upload-list--picture-card .el-upload--picture-card{margin-bottom:8px;width:var(--upload-size-w);height:var(--upload-size-h)}.yk-upload-files .el-upload.is-drag{width:var(--upload-size-w);height:var(--upload-size-h)}.yk-upload-files .el-upload .el-upload-dragger{padding:unset;height:100%;display:flex;justify-content:center;align-items:center;flex-direction:column}.yk-upload-files .el-upload-list{margin:unset}.yk-upload-files .drag-default{display:flex;justify-content:center;align-items:center;flex-direction:column;width:100%;height:100%}.yk-upload-files .drag-default .tip-text{font-size:12px}.yk-upload-file :deep(.el-upload-list){margin:unset}.yk-images{display:flex;flex-wrap:wrap;gap:8px}.yk-images :deep(.el-image){width:var(--size-w);height:var(--size-h)}
1
+ .yk-position-anchor{position:absolute;width:0;height:0;display:flex}.yk-position-anchor.position-anchor--center{justify-content:center;align-items:center}.yk-position-anchor.position-anchor--top-left{justify-content:left;align-items:flex-start}.yk-position-anchor.position-anchor--top-right{justify-content:right;align-items:flex-start}.yk-position-anchor.position-anchor--bottom-left{justify-content:left;align-items:flex-end}.yk-position-anchor.position-anchor--bottom-right{justify-content:right;align-items:flex-end}.yk-position-anchor.position-anchor--bottom{justify-content:center;align-items:flex-end}.yk-position-anchor.position-anchor--top{justify-content:center;align-items:flex-start}.yk-position-anchor.position-anchor--right{justify-content:flex-end;align-items:center}.yk-position-anchor.position-anchor--left{justify-content:flex-start;align-items:center}.yk-progress-ring{display:block}.yk-progress-ring circle{transform-box:fill-box;transform-origin:center;transition:all var(--duration) ease-in-out}.yk-adaptive-box .adaptive-box__body{overflow:hidden;margin-left:auto;margin-right:auto}.yk-adaptive-box .adaptive-box__content{transform-origin:left top;width:fit-content;--adaptive-height: initial}.yk-coordinate-pickup-autocomplete li{margin-bottom:8px}.yk-coordinate-pickup-autocomplete .autocomplete-subtitle{font-size:12px;color:var(--el-text-color-secondary);line-height:12px}.yk-coordinate-pickup-form .el-form-item{margin-right:16px}.coordinate-pickup{height:50vh;min-height:400px;max-height:920px}.amap-content-body,.amap-content-body .amap-lib-infowindow{background:inherit}.yk-drag-drop-box{position:absolute}.yk-drag-drop-container .drag-drop-content{width:fit-content;height:fit-content}.yk-progress-bar{position:relative;display:flex;align-items:center}.yk-progress-bar .progress-dot{width:0;display:flex;justify-content:center;align-items:center;position:absolute;transition:all .5s}.yk-ys-video .icon--replay{display:flex;align-items:center;justify-content:center;font-size:20px;margin-top:4px}.yk-ys-video .icon--replay .icon--btn{color:#fff}.yk-ys-video .icon--replay .icon--btn.is-active{color:#157edf}.yk-ys-video{overflow:hidden;width:100%;height:100%;position:relative}.yk-ys-video .video-container{width:100%;height:100%}.yk-ys-video .icon--replay{position:absolute;top:0;right:64px}.yk-ys-video .header-controls div:nth-child(2) .theme-icon-item{width:32px!important;display:flex;justify-content:center;align-items:center;padding-top:6px}.yk-ys-video .header-controls div:nth-child(2) .theme-icon-item svg{height:48px!important;width:48px!important}.yk-ys-video .header-controls div:nth-child(2) .theme-icon-item:last-child{padding-left:16px}.yk-ys-video .play-mask{position:absolute;width:100%;height:100%;display:flex;align-items:center;justify-content:center;background-color:#626365;background-repeat:no-repeat;background-size:100% 100%;top:0;left:0}.yk-ys-video .play-mask .header{position:absolute;height:20%;inset:0 auto auto 0;min-height:48px;background:linear-gradient(to bottom,#0008 0,#0006 30%,#0003 50%,#0000);padding:10px 8px;width:100%}.yk-ys-video .play-mask .header .title-box{max-width:50%;height:48px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#fff}.yk-ys-video .play-mask .play-btn{cursor:pointer}.yk-show-log{background:#fff;border-radius:5px;padding:10px;-webkit-user-select:none;user-select:none;box-shadow:0 2px 4px #ccc;min-width:150px}.yk-show-log.is-min{overflow:hidden}.yk-show-log .show-log__header{display:flex;align-items:center;justify-content:space-between}.yk-show-log .show-log--icon{cursor:pointer}.yk-empty{position:relative;--yk-empty-description-font-size: var(--el-font-size-base, 14px);--yk-empty-description-color: var(--el-text-color-secondary, #909399);--yk-empty-description-margin-top: var(--el-empty-description-margin-top, 20px);--yk-empty-bottom-margin-top: var(--el-empty-bottom-margin-top, 20px);--yk-empty-image-opacity: 1;--yk-empty-image-hue-rotate: 0deg}.yk-empty .empty_content{width:100%;height:100%}.yk-empty .empty_content.is-hide{opacity:0}.yk-empty .empty_error{width:100%;height:100%;position:absolute;z-index:5;display:flex;flex-direction:column;justify-content:center;align-items:center}.yk-empty .empty_error .empty__image{background-repeat:no-repeat;background-position:center;background-size:contain;width:var(--yk-empty-image-size);height:var(--yk-empty-image-size);opacity:var(--yk-empty-image-opacity);filter:hue-rotate(var(--yk-empty-image-hue-rotate))}.yk-empty .empty_error .empty__description{font-size:var(--yk-empty-description-font-size);color:var(--yk-empty-description-color);margin-top:var(--yk-empty-description-margin-top)}.yk-empty .empty_error .empty__bottom{margin-top:var(--yk-empty-bottom-margin-top)}.yk-echarts-canvas{position:relative;container-type:size}.yk-echarts-canvas .echarts-empty{position:absolute;width:100%;height:100%;z-index:999}.yk-echarts-canvas .echarts-slot-default{position:absolute;width:100%;height:100%;top:0}.yk-echarts-canvas .echarts-canvas__inner{width:100%;height:100%;position:absolute;z-index:2}.yk-echarts-canvas .echarts-canvas__inner.is-empty{opacity:0}.yk-scroll-container{overflow:auto}.yk-scroll-container::-webkit-scrollbar{width:0;height:0}.yk-scroll-container .scroll-inner{display:flex;width:100%;flex-direction:column}.yk-pagination{padding:16px 0 8px}.yk-pagination .el-pagination{--el-pagination-bg-color: transparent;--el-pagination-button-disabled-bg-color: transparent}.yk-upload-image{margin-bottom:-8px}.yk-upload-image.limit_is-max .el-upload-list--picture-card .el-upload--picture-card{display:none}.yk-upload-image .el-upload-list--picture-card .el-upload-list__item{width:var(--upload-size-w);height:var(--upload-size-h)}.yk-upload-image .el-upload-list--picture-card .el-upload-list__item.is-success:focus:not(:hover) .el-icon--close-tip{display:none!important}.yk-upload-image .el-upload-list--picture-card .el-upload-list__item.is-success:focus .el-upload-list__item-status-label{display:inline-flex;opacity:1}.yk-upload-image .el-upload-list--picture-card .el-upload--picture-card{margin-bottom:8px;width:var(--upload-size-w);height:var(--upload-size-h)}.yk-upload-files .el-upload.is-drag{width:var(--upload-size-w);height:var(--upload-size-h)}.yk-upload-files .el-upload .el-upload-dragger{padding:unset;height:100%;display:flex;justify-content:center;align-items:center;flex-direction:column}.yk-upload-files .el-upload-list{margin:unset}.yk-upload-files .drag-default{display:flex;justify-content:center;align-items:center;flex-direction:column;width:100%;height:100%}.yk-upload-files .drag-default .tip-text{font-size:12px}.yk-upload-file .el-upload-list{margin:unset}.yk-images{display:flex;flex-wrap:wrap;gap:8px}.yk-images .el-image{width:var(--size-w);height:var(--size-h)}
@@ -9,6 +9,7 @@ import { InfoWindow as _InfoWindow } from './InfoWindow';
9
9
  import { Icon as _Icon } from './Icon';
10
10
  import { MarkerCluster as _MarkerCluster } from './MarkerCluster';
11
11
  import { Polyline as _Polyline } from './Polyline';
12
+ import { Weather as _Weather } from './Weather';
12
13
  export namespace AMap {
13
14
  export class Map extends _Map {}
14
15
  export class LngLat extends _LngLat {}
@@ -21,5 +22,6 @@ export namespace AMap {
21
22
  export class Icon extends _Icon {}
22
23
  export class MarkerCluster extends _MarkerCluster {}
23
24
  export class Polyline extends _Polyline {}
25
+ export class Weather extends _Weather {}
24
26
  }
25
27
  export type AMap = typeof AMap
@@ -56,7 +56,7 @@ interface MarkerClusterEvent {
56
56
  click: { cluster: any, target: any, lnglat: AMap.LngLat, markers: AMap.Marker }
57
57
  }
58
58
 
59
- interface RenderMarkerCallbackParams {
59
+ export interface RenderMarkerCallbackParams {
60
60
  count: number,
61
61
  marker: AMap.Marker,
62
62
  data: {
@@ -0,0 +1,57 @@
1
+ import { AMap } from './AMap';
2
+ import { Event } from './Event';
3
+ export class Weather extends Event<WeatherEvent> {
4
+ getLive(city: string, callback: (result: WeatherLiveResult) => void): void
5
+
6
+ getForecast(city: string, callback: (result: WeatherForecastResult) => void): void
7
+ }
8
+
9
+ interface WeatherLiveResult {
10
+ err: any
11
+ LiveData : LiveData
12
+ }
13
+
14
+ interface LiveData {
15
+ info: string
16
+ province: string
17
+ city: string
18
+ adcode: string
19
+ weather: string
20
+ temperature: string
21
+ windDirection: string
22
+ windPower: string
23
+ humidity: string
24
+ reportTime: string
25
+ }
26
+
27
+ interface WeatherForecastResult {
28
+ err: any
29
+ ForecastData : ForecastData
30
+ }
31
+
32
+ interface ForecastData {
33
+ info: string
34
+ province: string
35
+ city: string
36
+ adcode: string
37
+ reportTime: string
38
+ forecast: Forecast[]
39
+ }
40
+
41
+ interface Forecast {
42
+ date: string
43
+ week: string
44
+ dayWeather: string
45
+ nightWeather: string
46
+ dayTemp: string
47
+ nightTemp: string
48
+ dayWindDir: string
49
+ dayWindPower: string
50
+ nightWindPower: string
51
+ }
52
+
53
+ // region Event
54
+ type WeatherEventType = 'error' | 'complete'
55
+
56
+ type WeatherEvent = Record<WeatherEventType, unknown>
57
+ // endregion
@@ -1,15 +1,38 @@
1
- import { AMapClassProxy, AMapResolve, LoaderOptions, LoaderOptions1 } from './type';
2
- import { AMap } from './@type';
1
+ import { AMapClassProxy, LoaderOptions, LoaderOptions1, AMapResolve } from './type';
2
+ import { AMap } from './@type/index';
3
+ import { TemplateRef, ShallowRef } from 'vue';
3
4
  export * from './utils';
4
- export declare function useAMapLoader(options: LoaderOptions): Promise<AMap>;
5
- export declare function useAMapMap(options: {
6
- el: string | HTMLDivElement;
5
+ export declare function useAMapLoader(options?: LoaderOptions): Promise<AMap>;
6
+ /**
7
+ * 可以在`AMap`不存在的时候先预创建`AMap.Map`对象,
8
+ * 当`AMapLoader`加载完成获取到`AMap`后调用`setAMap`函数将预创建对象更新成实例对象;
9
+ * 里面可能对默认配置进行常用性调整;
10
+ * @param options
11
+ * @param AMap { AMap } AMap存在时可以传入跳过`setAMap`过程
12
+ */
13
+ export declare function newAMapMap(options: {
14
+ el: string | HTMLDivElement | ShallowRef<HTMLDivElement> | TemplateRef<HTMLDivElement>;
7
15
  mapStyle?: string;
8
16
  opts?: ConstructorParameters<typeof AMap.Map>[1];
9
- }): AMapClassProxy<AMap.Map>;
10
- export declare function useAMapMarkerCluster(options: {
17
+ }, AMap?: AMap): AMapClassProxy<AMap.Map>;
18
+ /**
19
+ * 可以在`AMap`不存在的时候先预创建`AMap.MarkerCluster`对象,
20
+ * 当`AMapLoader`加载完成获取到`AMap`后调用`setAMap`函数将预创建对象更新成实例对象;
21
+ * 里面可能对默认配置进行常用性调整;
22
+ * @param options
23
+ * @param AMap { AMap } AMap存在时可以传入跳过`setAMap`过程
24
+ */
25
+ export declare function newAMapMarkerCluster(options: {
11
26
  map: AMap.Map;
12
27
  dataOptions?: ConstructorParameters<typeof AMap.MarkerCluster>[1];
13
28
  markerClusterOptions?: ConstructorParameters<typeof AMap.MarkerCluster>[2];
14
- }): AMapClassProxy<AMap.MarkerCluster>;
29
+ }, AMap?: AMap): AMapClassProxy<AMap.MarkerCluster>;
30
+ /**
31
+ * 可以在`AMap`不存在的时候先预创建`AMap.InfoWindow`对象,
32
+ * 当`AMapLoader`加载完成获取到`AMap`后调用`setAMap`函数将预创建对象更新成实例对象;
33
+ * 里面可能对默认配置进行常用性调整;
34
+ * @param options
35
+ * @param AMap { AMap } AMap存在时可以传入跳过`setAMap`过程
36
+ */
37
+ export declare function newAMapInfoWindow(options: ConstructorParameters<typeof AMap.InfoWindow>[0], AMap?: AMap): AMapClassProxy<AMap.InfoWindow>;
15
38
  export declare function AMapLoader(options: LoaderOptions1): Promise<AMapResolve>;
@@ -1,7 +1,8 @@
1
1
  import _AMapLoader from "@amap/amap-jsapi-loader";
2
2
  import { AMapConfig } from "../../config/index.js";
3
+ import { toValue } from "vue";
3
4
  async function useAMapLoader(options) {
4
- const o = options;
5
+ const o = options || {};
5
6
  const win = window;
6
7
  win._AMapSecurityConfig = { securityJsCode: o.secret || AMapConfig.mapSecret };
7
8
  return await _AMapLoader.load({
@@ -11,12 +12,12 @@ async function useAMapLoader(options) {
11
12
  ...o.loadOption
12
13
  });
13
14
  }
14
- function proxyAMapClass(createAMapClass) {
15
- let proxy = null;
15
+ function createAMapClassProxy(createAMapClass, AMap) {
16
+ let proxy = AMap ? createAMapClass(AMap) : null;
16
17
  return new Proxy({
17
- setAMap(AMap) {
18
+ setAMap(AMap2) {
18
19
  if (!proxy) {
19
- proxy = createAMapClass(AMap);
20
+ proxy = createAMapClass(AMap2);
20
21
  }
21
22
  }
22
23
  }, {
@@ -26,29 +27,40 @@ function proxyAMapClass(createAMapClass) {
26
27
  set(target, prop, newValue, receiver) {
27
28
  proxy[prop] = newValue;
28
29
  return true;
30
+ },
31
+ getPrototypeOf(target) {
32
+ return proxy ? proxy.constructor.prototype : null;
29
33
  }
30
34
  });
31
35
  }
32
- function useAMapMap(options) {
36
+ function newAMapMap(options, AMap) {
33
37
  const o = options;
34
- return proxyAMapClass((AMap) => {
35
- return new AMap.Map(options.el, {
38
+ return createAMapClassProxy((AMap2) => {
39
+ return new AMap2.Map(toValue(o.el), {
36
40
  mapStyle: o.mapStyle,
37
41
  ...o.opts
38
42
  });
39
- });
43
+ }, AMap);
40
44
  }
41
- function useAMapMarkerCluster(options) {
45
+ function newAMapMarkerCluster(options, AMap) {
42
46
  const o = options;
43
47
  const markerClusterOptions = Object.assign({
44
48
  gridSize: 50,
45
49
  maxZoom: 13
46
50
  }, o.markerClusterOptions);
47
- return proxyAMapClass((AMap) => {
48
- return new AMap.MarkerCluster(o.map, o.dataOptions || [], {
51
+ return createAMapClassProxy((AMap2) => {
52
+ return new AMap2.MarkerCluster(o.map, o.dataOptions || [], {
49
53
  ...markerClusterOptions
50
54
  });
51
- });
55
+ }, AMap);
56
+ }
57
+ function newAMapInfoWindow(options, AMap) {
58
+ const o = Object.assign({
59
+ closeWhenClickMap: true
60
+ }, options);
61
+ return createAMapClassProxy((AMap2) => {
62
+ return new AMap2.InfoWindow(o);
63
+ }, AMap);
52
64
  }
53
65
  async function AMapLoader(options) {
54
66
  const o = options;
@@ -68,7 +80,8 @@ async function AMapLoader(options) {
68
80
  }
69
81
  export {
70
82
  AMapLoader,
71
- useAMapLoader,
72
- useAMapMap,
73
- useAMapMarkerCluster
83
+ newAMapInfoWindow,
84
+ newAMapMap,
85
+ newAMapMarkerCluster,
86
+ useAMapLoader
74
87
  };
@@ -1,19 +1,41 @@
1
1
  import { AMap, AMapType } from './@type/AMap';
2
2
  import { LoadOption } from './@type';
3
3
  import { MapOptions } from './@type/Map';
4
+ import { RenderMarkerCallbackParams } from './@type/MarkerCluster';
5
+ type PluginsType = 'AMap.MarkerCluster' | 'AMap.Weather' | string
6
+
4
7
  export type LoaderOptions = {
5
8
  // key 高德地图key(缺省使用全局配置)
6
- key?: string,
9
+ key?: string
7
10
  // secret 高德地图secret(缺省使用全局配置)
8
- secret?: string,
11
+ secret?: string
9
12
  // plugins 插件列表
10
- plugins?: string[],
13
+ plugins?: PluginsType[]
11
14
  // loadOption 加载选项
12
- loadOption?: LoadOption,
15
+ loadOption?: LoadOption
13
16
  }
14
17
 
15
18
  export type AMapClassProxy<T> = T & { setAMap (AMap: AMap): void }
16
19
 
20
+ // region useAMapHook
21
+ export type UseAMapHookOptions = {
22
+ el: ShallowRef<HTMLDivElement>
23
+ mapStyle?: string
24
+ renderMarker? (e: RenderMarkerCallbackParams): void
25
+ renderClusterMarker? (count: number, marker: AMap.Marker): void
26
+ infoWindowContent: ShallowRef<HTMLDivElement>
27
+ mapOpts?: ConstructorParameters<typeof AMap.Map>[1]
28
+ markerClusterOpts?: ConstructorParameters<typeof AMap.MarkerCluster>[2]
29
+ }
30
+
31
+ export type UseAMapHookExample = {
32
+ map: AMap.Map
33
+ markerCluster: AMap.MarkerCluster
34
+ infoWindow: AMap.InfoWindow
35
+ AMap: AMap
36
+ }
37
+ // endregion
38
+
17
39
  export type LoaderOptions1 = {
18
40
  // key 高德地图key(缺省使用全局配置)
19
41
  key?: string,
@@ -11,10 +11,10 @@ export declare class FnBatchPeriodically {
11
11
  /**
12
12
  * 运行周期任务
13
13
  * @param key
14
- * @param rightRun
14
+ * @param immediate 缺省值 true
15
15
  * @param arg
16
16
  */
17
- run(key?: any, rightRun?: boolean, arg?: any[]): void;
17
+ run(key?: any, immediate?: boolean, arg?: any[]): void;
18
18
  /**
19
19
  * 停止周期任务
20
20
  * @param key
@@ -25,14 +25,14 @@ class FnBatchPeriodically {
25
25
  /**
26
26
  * 运行周期任务
27
27
  * @param key
28
- * @param rightRun
28
+ * @param immediate 缺省值 true
29
29
  * @param arg
30
30
  */
31
- run(key, rightRun = true, arg) {
31
+ run(key, immediate = true, arg) {
32
32
  if (key === void 0) {
33
- this.fnPeriodicallyMap.forEach((item) => item.run(rightRun, arg));
33
+ this.fnPeriodicallyMap.forEach((item) => item.run(immediate, arg));
34
34
  } else {
35
- this.fnPeriodicallyMap.get(key).run(rightRun, arg);
35
+ this.fnPeriodicallyMap.get(key).run(immediate, arg);
36
36
  }
37
37
  }
38
38
  /**
@@ -24,6 +24,11 @@ export declare class FnPeriodically {
24
24
  * @param arg
25
25
  */
26
26
  private runId;
27
+ /**
28
+ * 手动运行函数,循环周期的起点
29
+ * @param immediate 是否立即执行 缺省值 true
30
+ * @param arg
31
+ */
27
32
  run(immediate?: boolean, arg?: any[]): void;
28
33
  /**
29
34
  * 停止周期执行
@@ -51,6 +51,11 @@ class FnPeriodically {
51
51
  */
52
52
  // 每次运行的唯一标识,保证异步运行的时能够准确找到运行次序
53
53
  runId = 0;
54
+ /**
55
+ * 手动运行函数,循环周期的起点
56
+ * @param immediate 是否立即执行 缺省值 true
57
+ * @param arg
58
+ */
54
59
  run(immediate = true, arg) {
55
60
  this.arg = arg || [];
56
61
  this.state = 1;
@@ -9,13 +9,13 @@ export namespace FnPeriodicallyNamespace {
9
9
  fn(params?: FnCallbackParams, ...arg: any[]): Promise<unknown>,
10
10
  // 每次运行间隔
11
11
  delay: number
12
- // 立即运行,不等待,否则先等待(timeout)再执行
12
+ // 立即运行,不等待,否则先等待(timeout)再执行,缺省值:true
13
13
  immediate?: boolean
14
- // 开始运行
14
+ // 启动循环,缺省值:false
15
15
  run?: boolean
16
16
  // 向fn传递的参数
17
17
  arg?: any[]
18
- // Vue中在onBeforeUnmount事件中销毁
18
+ // Vue中在onBeforeUnmount事件中销毁,缺省值:false
19
19
  isUnmountStop?: boolean
20
20
  }
21
21
  }
@@ -24,7 +24,7 @@ export namespace FnBatchPeriodicallyNamespace {
24
24
  export type AddOption = (FnPeriodically.ConstructorOption & { key?: string })
25
25
  export type FnPeriodicallyOptions = FnBatchPeriodicallyNamespace.AddOption[]
26
26
  export type ConstructorOption = {
27
- // Vue中在onBeforeUnmount事件中销毁
27
+ // Vue中在onBeforeUnmount事件中销毁,缺省值:false
28
28
  isUnmountStop?: boolean
29
29
  }
30
30
  }
@@ -13,7 +13,7 @@ export type MatchStrLenOption = {
13
13
  desiredLen: number,
14
14
  // 保留的小数点位数
15
15
  fractionDigits: number,
16
- // 是否包含符号,如".","-"
16
+ // 是否包含符号,如".","-"。缺省值:false
17
17
  containsSymbol?: boolean
18
18
  }
19
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mrxy-yk",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "A collection of Vue 3 components and utilities",
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "mrxy-yk",
4
- "version": "1.2.7",
4
+ "version": "1.2.8",
5
5
  "js-types-syntax": "typescript",
6
6
  "contributions": {
7
7
  "html": {