@spcsn/taro 0.1.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 (140) hide show
  1. package/README.md +12 -0
  2. package/dist/index.js +147 -0
  3. package/dist/index.js.map +1 -0
  4. package/index.js +9 -0
  5. package/package.json +86 -0
  6. package/types/api/ad/index.d.ts +197 -0
  7. package/types/api/ai/face.d.ts +133 -0
  8. package/types/api/ai/inference.d.ts +129 -0
  9. package/types/api/ai/visionkit.d.ts +874 -0
  10. package/types/api/alipay/index.d.ts +69 -0
  11. package/types/api/base/crypto.d.ts +104 -0
  12. package/types/api/base/debug.d.ts +329 -0
  13. package/types/api/base/env.d.ts +19 -0
  14. package/types/api/base/index.d.ts +102 -0
  15. package/types/api/base/performance.d.ts +258 -0
  16. package/types/api/base/system.d.ts +742 -0
  17. package/types/api/base/update.d.ts +130 -0
  18. package/types/api/base/weapp/app-event.d.ts +265 -0
  19. package/types/api/base/weapp/life-cycle.d.ts +155 -0
  20. package/types/api/canvas/index.d.ts +2162 -0
  21. package/types/api/cloud/index.d.ts +2622 -0
  22. package/types/api/data-analysis/index.d.ts +122 -0
  23. package/types/api/device/accelerometer.d.ts +102 -0
  24. package/types/api/device/accessibility.d.ts +26 -0
  25. package/types/api/device/battery.d.ts +46 -0
  26. package/types/api/device/bluetooth-ble.d.ts +601 -0
  27. package/types/api/device/bluetooth-peripheral.d.ts +430 -0
  28. package/types/api/device/bluetooth.d.ts +463 -0
  29. package/types/api/device/calendar.d.ts +98 -0
  30. package/types/api/device/clipboard.d.ts +81 -0
  31. package/types/api/device/compass.d.ts +105 -0
  32. package/types/api/device/contact.d.ts +110 -0
  33. package/types/api/device/gyroscope.d.ts +85 -0
  34. package/types/api/device/iBeacon.d.ts +168 -0
  35. package/types/api/device/keyboard.d.ts +97 -0
  36. package/types/api/device/memory.d.ts +52 -0
  37. package/types/api/device/motion.d.ts +88 -0
  38. package/types/api/device/network.d.ts +172 -0
  39. package/types/api/device/nfc.d.ts +1238 -0
  40. package/types/api/device/phone.d.ts +30 -0
  41. package/types/api/device/scan.d.ts +111 -0
  42. package/types/api/device/screen.d.ts +217 -0
  43. package/types/api/device/sms.d.ts +26 -0
  44. package/types/api/device/vibrate.d.ts +51 -0
  45. package/types/api/device/wifi.d.ts +301 -0
  46. package/types/api/ext/index.d.ts +64 -0
  47. package/types/api/files/index.d.ts +1472 -0
  48. package/types/api/framework/index.d.ts +51 -0
  49. package/types/api/location/index.d.ts +517 -0
  50. package/types/api/media/audio.d.ts +1013 -0
  51. package/types/api/media/background-audio.d.ts +291 -0
  52. package/types/api/media/camera.d.ts +207 -0
  53. package/types/api/media/editor.d.ts +239 -0
  54. package/types/api/media/image.d.ts +469 -0
  55. package/types/api/media/live.d.ts +461 -0
  56. package/types/api/media/map.d.ts +638 -0
  57. package/types/api/media/media-recorder.d.ts +117 -0
  58. package/types/api/media/recorder.d.ts +317 -0
  59. package/types/api/media/video-decoder.d.ts +117 -0
  60. package/types/api/media/video-processing.d.ts +84 -0
  61. package/types/api/media/video.d.ts +527 -0
  62. package/types/api/media/voip.d.ts +393 -0
  63. package/types/api/navigate/index.d.ts +327 -0
  64. package/types/api/network/download.d.ts +173 -0
  65. package/types/api/network/mdns.d.ts +191 -0
  66. package/types/api/network/request.d.ts +480 -0
  67. package/types/api/network/tcp.d.ts +181 -0
  68. package/types/api/network/udp.d.ts +218 -0
  69. package/types/api/network/upload.d.ts +201 -0
  70. package/types/api/network/websocket.d.ts +383 -0
  71. package/types/api/open-api/account.d.ts +51 -0
  72. package/types/api/open-api/address.d.ts +68 -0
  73. package/types/api/open-api/authorize.d.ts +80 -0
  74. package/types/api/open-api/card.d.ts +110 -0
  75. package/types/api/open-api/channels.d.ts +225 -0
  76. package/types/api/open-api/customer-service.d.ts +45 -0
  77. package/types/api/open-api/device-voip.d.ts +103 -0
  78. package/types/api/open-api/facial.d.ts +98 -0
  79. package/types/api/open-api/favorites.d.ts +101 -0
  80. package/types/api/open-api/group.d.ts +59 -0
  81. package/types/api/open-api/invoice.d.ts +87 -0
  82. package/types/api/open-api/license-plate.d.ts +27 -0
  83. package/types/api/open-api/login.d.ts +115 -0
  84. package/types/api/open-api/my-miniprogram.d.ts +28 -0
  85. package/types/api/open-api/privacy.d.ts +107 -0
  86. package/types/api/open-api/redpackage.d.ts +24 -0
  87. package/types/api/open-api/settings.d.ts +174 -0
  88. package/types/api/open-api/soter.d.ts +184 -0
  89. package/types/api/open-api/sticker.d.ts +83 -0
  90. package/types/api/open-api/subscribe-message.d.ts +305 -0
  91. package/types/api/open-api/user-info.d.ts +182 -0
  92. package/types/api/open-api/werun.d.ts +101 -0
  93. package/types/api/payment/index.d.ts +119 -0
  94. package/types/api/qq/index.d.ts +354 -0
  95. package/types/api/route/index.d.ts +324 -0
  96. package/types/api/share/index.d.ts +354 -0
  97. package/types/api/skyline/index.d.ts +345 -0
  98. package/types/api/storage/background-fetch.d.ts +131 -0
  99. package/types/api/storage/cache-manager.d.ts +249 -0
  100. package/types/api/storage/index.d.ts +405 -0
  101. package/types/api/swan/bookshelf.d.ts +307 -0
  102. package/types/api/swan/download-package.d.ts +80 -0
  103. package/types/api/swan/index.d.ts +251 -0
  104. package/types/api/swan/pay.d.ts +139 -0
  105. package/types/api/taro.extend.d.ts +233 -0
  106. package/types/api/taro.hooks.d.ts +148 -0
  107. package/types/api/ui/animation.d.ts +427 -0
  108. package/types/api/ui/background.d.ts +69 -0
  109. package/types/api/ui/custom-component.d.ts +23 -0
  110. package/types/api/ui/fonts.d.ts +77 -0
  111. package/types/api/ui/interaction.d.ts +281 -0
  112. package/types/api/ui/menu.d.ts +29 -0
  113. package/types/api/ui/navigation-bar.d.ts +130 -0
  114. package/types/api/ui/pull-down-refresh.d.ts +50 -0
  115. package/types/api/ui/scroll.d.ts +114 -0
  116. package/types/api/ui/sticky.d.ts +32 -0
  117. package/types/api/ui/tab-bar.d.ts +196 -0
  118. package/types/api/ui/window.d.ts +71 -0
  119. package/types/api/worker/index.d.ts +83 -0
  120. package/types/api/wxml/index.d.ts +540 -0
  121. package/types/compile/compiler.d.ts +32 -0
  122. package/types/compile/config/h5.d.ts +134 -0
  123. package/types/compile/config/harmony.d.ts +118 -0
  124. package/types/compile/config/index.d.ts +8 -0
  125. package/types/compile/config/manifest.d.ts +155 -0
  126. package/types/compile/config/mini.d.ts +118 -0
  127. package/types/compile/config/plugin.d.ts +34 -0
  128. package/types/compile/config/project.d.ts +338 -0
  129. package/types/compile/config/rn.d.ts +85 -0
  130. package/types/compile/config/util.d.ts +179 -0
  131. package/types/compile/hooks.d.ts +13 -0
  132. package/types/compile/index.d.ts +11 -0
  133. package/types/compile/viteCompilerContext.d.ts +167 -0
  134. package/types/global.d.ts +428 -0
  135. package/types/index.d.ts +190 -0
  136. package/types/taro.api.d.ts +130 -0
  137. package/types/taro.component.d.ts +168 -0
  138. package/types/taro.config.d.ts +712 -0
  139. package/types/taro.lifecycle.d.ts +220 -0
  140. package/types/taro.runtime.d.ts +9 -0
@@ -0,0 +1,638 @@
1
+ import { MapProps } from '@spcsn/taro-components';
2
+ import Taro from '../../index'
3
+
4
+ declare module '../../index' {
5
+ /** `MapContext` 实例,可通过 [Taro.createMapContext](./createMapContext) 获取。
6
+ * `MapContext` 通过 id 跟一个 map 组件绑定,操作对应的 map 组件。
7
+ * @supported weapp, tt
8
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.html
9
+ */
10
+ interface MapContext {
11
+ /** 获取当前地图中心的经纬度。返回的是 gcj02 坐标系,可以用于 [Taro.openLocation()](/docs/apis/location/openLocation)
12
+ * @supported weapp, tt
13
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getCenterLocation.html
14
+ */
15
+ getCenterLocation(option?: MapContext.GetCenterLocationOption): Promise<MapContext.GetCenterLocationSuccessCallbackResult>
16
+
17
+ /** 设置定位点图标,支持网络路径、本地路径、代码包路径
18
+ * @supported weapp, tt
19
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.setLocMarkerIcon.html
20
+ */
21
+ setLocMarkerIcon(option?: MapContext.SetLocMarkerIconOption): Promise<TaroGeneral.CallbackResult>
22
+
23
+ /** 将地图中心移置当前定位点,此时需设置地图组件 show-location 为true。
24
+ * @supported weapp, tt
25
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.moveToLocation.html
26
+ */
27
+ moveToLocation(option: MapContext.MoveToLocationOption): Promise<TaroGeneral.CallbackResult>
28
+
29
+ /** 平移marker,带动画
30
+ * @supported weapp, tt
31
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.translateMarker.html
32
+ */
33
+ translateMarker(option: MapContext.TranslateMarkerOption): Promise<TaroGeneral.CallbackResult>
34
+
35
+ /** 沿指定路径移动 marker,用于轨迹回放等场景。动画完成时触发回调事件,若动画进行中,对同一 marker 再次调用 moveAlong 方法,前一次的动画将被打断。 */
36
+ moveAlong(object)
37
+
38
+ /** 缩放视野展示所有经纬度
39
+ * @supported weapp, tt
40
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.includePoints.html
41
+ */
42
+ includePoints(option: MapContext.IncludePointsOption): Promise<TaroGeneral.CallbackResult>
43
+
44
+ /** 获取当前地图的视野范围
45
+ * @supported weapp, tt
46
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getRegion.html
47
+ */
48
+ getRegion(option?: MapContext.GetRegionOption): Promise<MapContext.GetRegionSuccessCallbackResult>
49
+
50
+ /** 获取当前地图的旋转角
51
+ * @supported weapp, tt
52
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getRotate.html
53
+ */
54
+ getRotate(option?: MapContext.GetRotateOption): Promise<MapContext.GetRotateSuccessCallbackResult>
55
+
56
+ /** 获取当前地图的倾斜角
57
+ * @supported weapp, tt
58
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getSkew.html
59
+ */
60
+ getSkew(option?: MapContext.GetSkewOption): Promise<MapContext.GetSkewSuccessCallbackResult>
61
+
62
+ /** 获取当前地图的缩放级别
63
+ * @supported weapp, tt
64
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getScale.html
65
+ */
66
+ getScale(option?: MapContext.GetScaleOption): Promise<MapContext.GetScaleSuccessCallbackResult>
67
+
68
+ /** 设置地图中心点偏移,向后向下为增长,屏幕比例范围(0.25~0.75),默认偏移为[0.5, 0.5]
69
+ * @supported weapp, tt
70
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.setCenterOffset.html
71
+ */
72
+ setCenterOffset(option: MapContext.SetCenterOffsetOption): Promise<TaroGeneral.CallbackResult>
73
+
74
+ /** 移除个性化图层。
75
+ * @supported weapp
76
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeCustomLayer.html
77
+ */
78
+ removeCustomLayer(option: MapContext.RemoveCustomLayerOption): Promise<TaroGeneral.CallbackResult>
79
+
80
+ /** 添加个性化图层。图层创建参考文档
81
+ * @supported weapp
82
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addCustomLayer.html
83
+ */
84
+ addCustomLayer(option: MapContext.AddCustomLayerOption): Promise<TaroGeneral.CallbackResult>
85
+
86
+ /** 创建自定义图片图层,图片会随着地图缩放而缩放。
87
+ * @supported weapp, tt
88
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addGroundOverlay.html
89
+ */
90
+ addGroundOverlay(option: MapContext.AddGroundLayerOption): Promise<TaroGeneral.CallbackResult>
91
+
92
+ /** 添加可视化图层。需要刷新时,interval 可设置的最小值为 15 s。
93
+ * @supported weapp
94
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addVisualLayer.html
95
+ */
96
+ addVisualLayer(option: MapContext.AddVisualLayerOption): Promise<TaroGeneral.CallbackResult>
97
+
98
+ /** 移除可视化图层。
99
+ * @supported weapp
100
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeVisualLayer.html
101
+ */
102
+ removeVisualLayer(option: MapContext.RemoveVisualLayerOption): Promise<TaroGeneral.CallbackResult>
103
+
104
+ /** 添加弧线,途经点与夹角必须设置一个。途经点必须在起终点有效坐标范围内,否则不能生成正确的弧线,同时设置夹角角度时,以夹角角度为准。夹角定义为起点到终点,与起点外切线逆时针旋转的角度。
105
+ * @supported weapp
106
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addArc.html
107
+ */
108
+ addArc(option: MapContext.AddArcOption): Promise<TaroGeneral.CallbackResult>
109
+
110
+ /** 删除弧线。
111
+ * @supported weapp
112
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeArc.html
113
+ */
114
+ removeArc(option: MapContext.RemoveArcOption): Promise<TaroGeneral.CallbackResult>
115
+
116
+ /** 限制地图的显示范围。此接口同时会限制地图的最小缩放整数级别。
117
+ * @supported weapp
118
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.setBoundary.html
119
+ */
120
+ setBoundary(option: MapContext.SetBoundaryOption): Promise<TaroGeneral.CallbackResult>
121
+
122
+ /** 更新自定义图片图层。
123
+ * @supported weapp, tt
124
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.updateGroundOverlay.html
125
+ */
126
+ updateGroundOverlay(option: MapContext.UpdateGroundOverlayOption): Promise<TaroGeneral.CallbackResult>
127
+
128
+ /** 移除自定义图片图层。
129
+ * @supported weapp, tt
130
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeGroundOverlay.html
131
+ */
132
+ removeGroundOverlay(option: MapContext.RemoveGroundOverlayOption): Promise<TaroGeneral.CallbackResult>
133
+
134
+ /** 获取经纬度对应的屏幕坐标,坐标原点为地图左上角。
135
+ * @supported weapp
136
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.toScreenLocation.html
137
+ */
138
+ toScreenLocation(option: MapContext.ToScreenLocationOption): Promise<TaroGeneral.CallbackResult>
139
+
140
+ /** 获取屏幕上的点对应的经纬度,坐标原点为地图左上角。
141
+ * @supported weapp
142
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.fromScreenLocation.html
143
+ */
144
+ fromScreenLocation(option: MapContext.FromScreenLocationOption): Promise<TaroGeneral.CallbackResult>
145
+
146
+ /** 拉起地图APP选择导航。
147
+ * @supported weapp
148
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.openMapApp.html
149
+ */
150
+ openMapApp(option: MapContext.OpenMapAppOption): Promise<TaroGeneral.CallbackResult>
151
+
152
+ /** 添加 marker。
153
+ * @supported weapp
154
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addMarkers.html
155
+ */
156
+ addMarkers(option: MapContext.AddMarkersOption): Promise<TaroGeneral.CallbackResult>
157
+
158
+ /** 移除 marker。
159
+ * @supported weapp
160
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeMarkers.html
161
+ */
162
+ removeMarkers(option: MapContext.RemoveMarkersOption): Promise<TaroGeneral.CallbackResult>
163
+
164
+ /** 初始化点聚合的配置,未调用时采用默认配置。
165
+ * @supported weapp
166
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.initMarkerCluster.html
167
+ */
168
+ initMarkerCluster(option?: MapContext.InitMarkerClusterOption): Promise<TaroGeneral.CallbackResult>
169
+
170
+ /** 监听地图事件。
171
+ * @supported weapp
172
+ * @example
173
+ * ```tsx
174
+ * MapContext.on('markerClusterCreate', (res) => {})
175
+ * MapContext.on('markerClusterClick', (res) => {})
176
+ * ```
177
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.on.html
178
+ */
179
+ on(
180
+ /** 事件名 */
181
+ event: keyof MapContext.MapEvent,
182
+ /** 事件的回调函数 */
183
+ callback: (res: MapContext.MapEvent[keyof MapContext.MapEvent]) => void
184
+ ): void
185
+ }
186
+ namespace MapContext {
187
+ interface GetCenterLocationOption {
188
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
189
+ complete?: (res: TaroGeneral.CallbackResult) => void
190
+ /** 接口调用失败的回调函数 */
191
+ fail?: (res: TaroGeneral.CallbackResult) => void
192
+ /** 接口调用成功的回调函数 */
193
+ success?: (
194
+ result: GetCenterLocationSuccessCallbackResult,
195
+ ) => void
196
+ }
197
+ interface GetCenterLocationSuccessCallbackResult extends TaroGeneral.CallbackResult {
198
+ /** 纬度 */
199
+ latitude: number
200
+ /** 经度 */
201
+ longitude: number
202
+ /** 调用结果 */
203
+ errMsg: string
204
+ }
205
+ interface SetLocMarkerIconOption {
206
+ /** 图标路径,支持网络路径、本地路径、代码包路径 */
207
+ iconPath: string
208
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
209
+ complete?: (res: TaroGeneral.CallbackResult) => void
210
+ /** 接口调用失败的回调函数 */
211
+ fail?: (res: TaroGeneral.CallbackResult) => void
212
+ /** 接口调用成功的回调函数 */
213
+ success?: (res: TaroGeneral.CallbackResult) => void
214
+ }
215
+ interface GetRegionOption {
216
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
217
+ complete?: (res: TaroGeneral.CallbackResult) => void
218
+ /** 接口调用失败的回调函数 */
219
+ fail?: (res: TaroGeneral.CallbackResult) => void
220
+ /** 接口调用成功的回调函数 */
221
+ success?: (
222
+ result: GetRegionSuccessCallbackResult,
223
+ ) => void
224
+ }
225
+ interface GetRegionSuccessCallbackResult extends TaroGeneral.CallbackResult {
226
+ /** 东北角经纬度 */
227
+ northeast: MapPosition
228
+ /** 西南角经纬度 */
229
+ southwest: MapPosition
230
+ }
231
+ interface GetRotateOption {
232
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
233
+ complete?: (res: TaroGeneral.CallbackResult) => void
234
+ /** 接口调用失败的回调函数 */
235
+ fail?: (res: TaroGeneral.CallbackResult) => void
236
+ /** 接口调用成功的回调函数 */
237
+ success?: (
238
+ result: GetRotateSuccessCallbackResult,
239
+ ) => void
240
+ }
241
+ interface GetRotateSuccessCallbackResult extends TaroGeneral.CallbackResult {
242
+ /** 旋转角 */
243
+ rotate: number
244
+ /** 调用结果 */
245
+ errMsg: string
246
+ }
247
+ interface GetScaleOption {
248
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
249
+ complete?: (res: TaroGeneral.CallbackResult) => void
250
+ /** 接口调用失败的回调函数 */
251
+ fail?: (res: TaroGeneral.CallbackResult) => void
252
+ /** 接口调用成功的回调函数 */
253
+ success?: (
254
+ result: GetScaleSuccessCallbackResult,
255
+ ) => void
256
+ }
257
+ interface GetScaleSuccessCallbackResult extends TaroGeneral.CallbackResult {
258
+ /** 缩放值 */
259
+ scale: number
260
+ /** 调用结果 */
261
+ errMsg: string
262
+ }
263
+ interface GetSkewOption {
264
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
265
+ complete?: (res: TaroGeneral.CallbackResult) => void
266
+ /** 接口调用失败的回调函数 */
267
+ fail?: (res: TaroGeneral.CallbackResult) => void
268
+ /** 接口调用成功的回调函数 */
269
+ success?: (result: GetSkewSuccessCallbackResult) => void
270
+ }
271
+ interface GetSkewSuccessCallbackResult extends TaroGeneral.CallbackResult {
272
+ /** 倾斜角 */
273
+ skew: number
274
+ /** 调用结果 */
275
+ errMsg: string
276
+ }
277
+ interface IncludePointsOption {
278
+ /** 要显示在可视区域内的坐标点列表 */
279
+ points: MapPosition[]
280
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
281
+ complete?: (res: TaroGeneral.CallbackResult) => void
282
+ /** 接口调用失败的回调函数 */
283
+ fail?: (res: TaroGeneral.CallbackResult) => void
284
+ /** 坐标点形成的矩形边缘到地图边缘的距离,单位像素。格式为[上,右,下,左],安卓上只能识别数组第一项,上下左右的padding一致。开发者工具暂不支持padding参数。 */
285
+ padding?: number[]
286
+ /** 接口调用成功的回调函数 */
287
+ success?: (res: TaroGeneral.CallbackResult) => void
288
+ }
289
+ /** 坐标点 */
290
+ interface MapPosition {
291
+ /** 纬度 */
292
+ latitude: number
293
+ /** 经度 */
294
+ longitude: number
295
+ }
296
+ /** 经纬度范围 */
297
+ interface MapBoundary {
298
+ /** 西南角经纬度 */
299
+ southwest: MapPosition
300
+ /** 东北角经纬度 */
301
+ northeast: MapPosition
302
+ }
303
+ interface MoveToLocationOption {
304
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
305
+ complete?: (res: TaroGeneral.CallbackResult) => void
306
+ /** 接口调用失败的回调函数 */
307
+ fail?: (res: TaroGeneral.CallbackResult) => void
308
+ /** 纬度 */
309
+ latitude?: number
310
+ /** 经度 */
311
+ longitude?: number
312
+ /** 接口调用成功的回调函数 */
313
+ success?: (res: TaroGeneral.CallbackResult) => void
314
+ }
315
+ interface TranslateMarkerOption {
316
+ /** 移动过程中是否自动旋转 marker */
317
+ autoRotate: boolean
318
+ /** 指定 marker 移动到的目标点 */
319
+ destination: MapPosition
320
+ /** 指定 marker */
321
+ markerId: number
322
+ /** marker 的旋转角度 */
323
+ rotate: number
324
+ /** 动画结束回调函数 */
325
+ animationEnd?: (...args: any[]) => any
326
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
327
+ complete?: (res: TaroGeneral.CallbackResult) => void
328
+ /** 动画持续时长,平移与旋转分别计算 */
329
+ duration?: number
330
+ /** 接口调用失败的回调函数 */
331
+ fail?: (res: TaroGeneral.CallbackResult) => void
332
+ /** 接口调用成功的回调函数 */
333
+ success?: (res: TaroGeneral.CallbackResult) => void
334
+ }
335
+ interface SetCenterOffsetOption {
336
+ /** 偏移量,两位数组 */
337
+ offset: number[]
338
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
339
+ complete?: (res: TaroGeneral.CallbackResult) => void
340
+ /** 接口调用失败的回调函数 */
341
+ fail?: (res: TaroGeneral.CallbackResult) => void
342
+ /** 接口调用成功的回调函数 */
343
+ success?: (res: TaroGeneral.CallbackResult) => void
344
+ }
345
+ interface RemoveCustomLayerOption {
346
+ /** 个性化图层id */
347
+ layerId: number
348
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
349
+ complete?: (res: TaroGeneral.CallbackResult) => void
350
+ /** 接口调用失败的回调函数 */
351
+ fail?: (res: TaroGeneral.CallbackResult) => void
352
+ /** 接口调用成功的回调函数 */
353
+ success?: (res: TaroGeneral.CallbackResult) => void
354
+ }
355
+ interface AddCustomLayerOption {
356
+ /** 个性化图层id */
357
+ layerId: number
358
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
359
+ complete?: (res: TaroGeneral.CallbackResult) => void
360
+ /** 接口调用失败的回调函数 */
361
+ fail?: (res: TaroGeneral.CallbackResult) => void
362
+ /** 接口调用成功的回调函数 */
363
+ success?: (res: TaroGeneral.CallbackResult) => void
364
+ }
365
+ interface AddGroundLayerOption {
366
+ /** 图片图层 id */
367
+ id: number
368
+ /** 图片路径,支持网络图片、临时路径、代码包路径 */
369
+ src: string
370
+ /** 图片覆盖的经纬度范围 */
371
+ bounds: MapBoundary
372
+ /** 是否可见
373
+ * @default true
374
+ */
375
+ visible?: boolean
376
+ /** 图层绘制顺序
377
+ * @default 1
378
+ */
379
+ zIndex?: number
380
+ /** 图层透明度
381
+ * @default 1
382
+ */
383
+ opacity?: number
384
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
385
+ complete?: (res: TaroGeneral.CallbackResult) => void
386
+ /** 接口调用失败的回调函数 */
387
+ fail?: (res: TaroGeneral.CallbackResult) => void
388
+ /** 接口调用成功的回调函数 */
389
+ success?: (res: TaroGeneral.CallbackResult) => void
390
+ }
391
+ interface AddVisualLayerOption {
392
+ /** 个性化图层id([创建图层指引](https://lbs.qq.com/dev/console/layers/layerEdit)) */
393
+ layerId: number
394
+ /** 刷新周期,单位秒
395
+ * @default 0
396
+ */
397
+ interval?: number
398
+ /** 图层绘制顺序
399
+ * @default 1
400
+ */
401
+ zIndex?: number
402
+ /** 图层透明度
403
+ * @default 1
404
+ */
405
+ opacity?: number
406
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
407
+ complete?: (res: TaroGeneral.CallbackResult) => void
408
+ /** 接口调用失败的回调函数 */
409
+ fail?: (res: TaroGeneral.CallbackResult) => void
410
+ /** 接口调用成功的回调函数 */
411
+ success?: (res: TaroGeneral.CallbackResult) => void
412
+ }
413
+ interface RemoveVisualLayerOption {
414
+ /** 可视化图层 id */
415
+ layerId: number
416
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
417
+ complete?: (res: TaroGeneral.CallbackResult) => void
418
+ /** 接口调用失败的回调函数 */
419
+ fail?: (res: TaroGeneral.CallbackResult) => void
420
+ /** 接口调用成功的回调函数 */
421
+ success?: (res: TaroGeneral.CallbackResult) => void
422
+ }
423
+ interface AddArcOption {
424
+ /** 圆弧 id */
425
+ id: number
426
+ /** 起始点 */
427
+ start: MapPosition
428
+ /** 终点 */
429
+ end: MapPosition
430
+ /** 途经点 */
431
+ pass?: MapPosition
432
+ /** 夹角角度
433
+ * @default 0
434
+ */
435
+ angle?: number
436
+ /** 线宽
437
+ * @default 5
438
+ */
439
+ width?: number
440
+ /** 线的颜色
441
+ * @default "#000000"
442
+ */
443
+ color?: string
444
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
445
+ complete?: (res: TaroGeneral.CallbackResult) => void
446
+ /** 接口调用失败的回调函数 */
447
+ fail?: (res: TaroGeneral.CallbackResult) => void
448
+ /** 接口调用成功的回调函数 */
449
+ success?: (res: TaroGeneral.CallbackResult) => void
450
+ }
451
+ interface RemoveArcOption {
452
+ /** 圆弧 id */
453
+ id: number
454
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
455
+ complete?: (res: TaroGeneral.CallbackResult) => void
456
+ /** 接口调用失败的回调函数 */
457
+ fail?: (res: TaroGeneral.CallbackResult) => void
458
+ /** 接口调用成功的回调函数 */
459
+ success?: (res: TaroGeneral.CallbackResult) => void
460
+ }
461
+ interface SetBoundaryOption {
462
+ /** 西南角经纬度 */
463
+ southwest: MapPosition
464
+ /** 东北角经纬度 */
465
+ northeast: MapPosition
466
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
467
+ complete?: (res: TaroGeneral.CallbackResult) => void
468
+ /** 接口调用失败的回调函数 */
469
+ fail?: (res: TaroGeneral.CallbackResult) => void
470
+ /** 接口调用成功的回调函数 */
471
+ success?: (res: TaroGeneral.CallbackResult) => void
472
+ }
473
+ interface UpdateGroundOverlayOption {
474
+ /** 图片图层 id */
475
+ id: number
476
+ /** 图片路径,支持网络图片、临时路径、代码包路径 */
477
+ src: string
478
+ /** 图片覆盖的经纬度范围 */
479
+ bounds: MapBoundary
480
+ /** 是否可见
481
+ * @default true
482
+ */
483
+ visible?: boolean
484
+ /** 图层绘制顺序
485
+ * @default 1
486
+ */
487
+ zIndex?: number
488
+ /** 图层透明度
489
+ * @default 1
490
+ */
491
+ opacity?: number
492
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
493
+ complete?: (res: TaroGeneral.CallbackResult) => void
494
+ /** 接口调用失败的回调函数 */
495
+ fail?: (res: TaroGeneral.CallbackResult) => void
496
+ /** 接口调用成功的回调函数 */
497
+ success?: (res: TaroGeneral.CallbackResult) => void
498
+ }
499
+ interface RemoveGroundOverlayOption {
500
+ /** 图片图层 id */
501
+ id: number
502
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
503
+ complete?: (res: TaroGeneral.CallbackResult) => void
504
+ /** 接口调用失败的回调函数 */
505
+ fail?: (res: TaroGeneral.CallbackResult) => void
506
+ /** 接口调用成功的回调函数 */
507
+ success?: (res: TaroGeneral.CallbackResult) => void
508
+ }
509
+ interface ToScreenLocationOption {
510
+ /** 纬度 */
511
+ latitude: number
512
+ /** 经度 */
513
+ longitude: number
514
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
515
+ complete?: (res: TaroGeneral.CallbackResult) => void
516
+ /** 接口调用失败的回调函数 */
517
+ fail?: (res: TaroGeneral.CallbackResult) => void
518
+ /** 接口调用成功的回调函数 */
519
+ success?: (res: TaroGeneral.CallbackResult) => void
520
+ }
521
+ interface FromScreenLocationOption {
522
+ /** x 坐标值 */
523
+ x: number
524
+ /** y 坐标值 */
525
+ y: number
526
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
527
+ complete?: (res: TaroGeneral.CallbackResult) => void
528
+ /** 接口调用失败的回调函数 */
529
+ fail?: (res: TaroGeneral.CallbackResult) => void
530
+ /** 接口调用成功的回调函数 */
531
+ success?: (res: TaroGeneral.CallbackResult) => void
532
+ }
533
+ interface OpenMapAppOption {
534
+ /** 目的地经度 */
535
+ longitude: number
536
+ /** 目的地纬度 */
537
+ latitude: number
538
+ /** 目的地名称 */
539
+ destination: string
540
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
541
+ complete?: (res: TaroGeneral.CallbackResult) => void
542
+ /** 接口调用失败的回调函数 */
543
+ fail?: (res: TaroGeneral.CallbackResult) => void
544
+ /** 接口调用成功的回调函数 */
545
+ success?: (res: TaroGeneral.CallbackResult) => void
546
+ }
547
+ interface AddMarkersOption {
548
+ /** 同传入 map 组件的 marker 属性 */
549
+ markers: MapProps.marker[]
550
+ /** 是否先清空地图上所有 marker
551
+ * @default false
552
+ */
553
+ clear?: boolean
554
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
555
+ complete?: (res: TaroGeneral.CallbackResult) => void
556
+ /** 接口调用失败的回调函数 */
557
+ fail?: (res: TaroGeneral.CallbackResult) => void
558
+ /** 接口调用成功的回调函数 */
559
+ success?: (res: TaroGeneral.CallbackResult) => void
560
+ }
561
+ interface RemoveMarkersOption {
562
+ /** marker 的 id 集合。 */
563
+ markerIds: number[]
564
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
565
+ complete?: (res: TaroGeneral.CallbackResult) => void
566
+ /** 接口调用失败的回调函数 */
567
+ fail?: (res: TaroGeneral.CallbackResult) => void
568
+ /** 接口调用成功的回调函数 */
569
+ success?: (res: TaroGeneral.CallbackResult) => void
570
+ }
571
+ interface InitMarkerClusterOption {
572
+ /** 启用默认的聚合样式
573
+ * @default true
574
+ */
575
+ enableDefaultStyle?: boolean
576
+ /** 点击已经聚合的标记点时是否实现聚合分离
577
+ * @default true
578
+ */
579
+ zoomOnClick?: boolean
580
+ /** 聚合算法的可聚合距离,即距离小于该值的点会聚合至一起,以像素为单位
581
+ * @default 60
582
+ */
583
+ gridSize?: number
584
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
585
+ complete?: (res: TaroGeneral.CallbackResult) => void
586
+ /** 接口调用失败的回调函数 */
587
+ fail?: (res: TaroGeneral.CallbackResult) => void
588
+ /** 接口调用成功的回调函数 */
589
+ success?: (res: TaroGeneral.CallbackResult) => void
590
+ }
591
+ /** event 的合法值 */
592
+ interface MapEvent {
593
+ /** 缩放或拖动导致新的聚合簇产生时触发,仅返回新创建的聚合簇信息 */
594
+ markerClusterCreate: MapEventMarkerClusterCreate
595
+ /** 聚合簇的点击事件 */
596
+ markerClusterClick: MapEventMarkerClusterClick
597
+ }
598
+ interface MapEventMarkerClusterCreate {
599
+ /** 聚合簇数据 */
600
+ clusters: ClusterInfo[]
601
+ }
602
+ interface MapEventMarkerClusterClick {
603
+ /** 聚合簇 */
604
+ cluster: ClusterInfo
605
+ }
606
+ interface ClusterInfo {
607
+ /** 聚合簇的 id */
608
+ clusterId: number
609
+ /** 聚合簇的坐标 */
610
+ center: LatLng
611
+ /** 该聚合簇内的点标记数据数组 */
612
+ markerIds: number[]
613
+ }
614
+ interface LatLng {
615
+ /** 纬度值 */
616
+ lat: number
617
+ /** 经度值 */
618
+ lng: number
619
+ }
620
+ }
621
+
622
+ interface TaroStatic {
623
+ /** 创建 [map](/docs/components/maps/map) 上下文 [MapContext](/docs/apis/media/map/MapContext) 对象。
624
+ * @supported weapp, tt
625
+ * @example
626
+ * ```tsx
627
+ * const mapCtx = Taro.createMapContext('myMap')
628
+ * ```
629
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/wx.createMapContext.html
630
+ */
631
+ createMapContext(
632
+ /** Map 组件的 id */
633
+ mapId: string,
634
+ /** 在自定义组件下,当前组件实例的this,以操作组件内 Map 组件 */
635
+ component?: TaroGeneral.IAnyObject,
636
+ ): MapContext
637
+ }
638
+ }