@tarojs/taro 3.6.7-alpha.0 → 3.6.7-alpha.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/taro",
3
- "version": "3.6.7-alpha.0",
3
+ "version": "3.6.7-alpha.1",
4
4
  "description": "Taro framework",
5
5
  "homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
6
6
  "main": "index.js",
@@ -21,11 +21,11 @@
21
21
  "author": "O2Team",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@tarojs/api": "3.6.7-alpha.0",
25
- "@tarojs/runtime": "3.6.7-alpha.0"
24
+ "@tarojs/api": "3.6.7-alpha.1",
25
+ "@tarojs/runtime": "3.6.7-alpha.1"
26
26
  },
27
27
  "devDependencies": {
28
- "@tarojs/helper": "3.6.7-alpha.0"
28
+ "@tarojs/helper": "3.6.7-alpha.1"
29
29
  },
30
30
  "peerDependenciesMeta": {
31
31
  "@types/react": {
@@ -259,7 +259,7 @@ declare module '../../../index' {
259
259
  */
260
260
  offAppHide(
261
261
  /** 小程序切后台事件的回调函数 */
262
- callback: (res: onAppHide.CallbackResult) => void,
262
+ callback: (res: onAppShow.CallbackResult) => void,
263
263
  ): void
264
264
  }
265
265
  }
@@ -75,12 +75,12 @@ declare module '../../index' {
75
75
 
76
76
  interface TaroStatic {
77
77
  /** 向系统日历添加重复事件
78
- * @supported weapp
78
+ * @supported weapp, h5
79
79
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneRepeatCalendar.html
80
80
  */
81
81
  addPhoneRepeatCalendar(option: addPhoneRepeatCalendar.Option): Promise<TaroGeneral.CallbackResult>
82
82
  /** 向系统日历添加事件
83
- * @supported weapp, tt
83
+ * @supported weapp, tt, h5
84
84
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneCalendar.html
85
85
  */
86
86
  addPhoneCalendar(option: addPhoneCalendar.Option): Promise<TaroGeneral.CallbackResult>
@@ -127,19 +127,30 @@ declare module '../../index' {
127
127
 
128
128
  namespace chooseImage {
129
129
  interface Option {
130
+ /** 最多可以选择的图片张数
131
+ * @default 9
132
+ * @supported weapp, alipay, swan, tt, h5, rn
133
+ */
134
+ count?: number
135
+ /** 所选的图片的尺寸
136
+ * @default ['original', 'compressed']
137
+ * @supported weapp, alipay, swan, tt, rn
138
+ */
139
+ sizeType?: Array<keyof sizeType>
140
+ /** 选择图片的来源
141
+ * @default ['album', 'camera']
142
+ * @supported weapp, alipay, swan, tt, h5, rn
143
+ */
144
+ sourceType?: Array<keyof sourceType>
130
145
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
131
146
  complete?: (res: TaroGeneral.CallbackResult) => void
132
- /** 最多可以选择的图片张数 */
133
- count?: number
134
147
  /** 接口调用失败的回调函数 */
135
148
  fail?: (res: TaroGeneral.CallbackResult) => void
136
- /** 所选的图片的尺寸 */
137
- sizeType?: Array<keyof sizeType>
138
- /** 选择图片的来源 */
139
- sourceType?: Array<keyof sourceType>
140
149
  /** 接口调用成功的回调函数 */
141
150
  success?: (result: SuccessCallbackResult) => void
142
- /** 用来上传的input元素ID(仅h5端)@supported h5 */
151
+ /** 用来上传的input元素ID(仅h5
152
+ * @supported h5
153
+ */
143
154
  imageId?: string
144
155
  }
145
156
  /** 图片的尺寸 */
@@ -301,7 +312,7 @@ declare module '../../index' {
301
312
 
302
313
  interface TaroStatic {
303
314
  /** 保存图片到系统相册。需要[用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.writePhotosAlbum
304
- * @supported weapp, rn, alipay, swan, tt
315
+ * @supported weapp, alipay, swan, tt, h5, rn
305
316
  * @example
306
317
  * ```tsx
307
318
  * Taro.saveImageToPhotosAlbum({
@@ -325,7 +336,7 @@ declare module '../../index' {
325
336
  previewMedia(option: previewMedia.Option): Promise<TaroGeneral.CallbackResult>
326
337
 
327
338
  /** 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
328
- * @supported weapp, h5, rn, alipay, swan, tt
339
+ * @supported weapp, alipay, swan, tt, h5, rn
329
340
  * @example
330
341
  * ```tsx
331
342
  * Taro.previewImage({
@@ -338,7 +349,7 @@ declare module '../../index' {
338
349
  previewImage(option: previewImage.Option): Promise<TaroGeneral.CallbackResult>
339
350
 
340
351
  /** 获取图片信息。网络图片需先配置download域名才能生效。
341
- * @supported weapp, h5, rn, alipay, swan, tt
352
+ * @supported weapp, alipay, swan, tt, h5, rn
342
353
  * @example
343
354
  * ```tsx
344
355
  * Taro.getImageInfo({
@@ -377,7 +388,7 @@ declare module '../../index' {
377
388
  editImage(option: editImage.Option): Promise<editImage.SuccessCallbackResult>
378
389
 
379
390
  /** 压缩图片接口,可选压缩质量
380
- * @supported weapp, rn, tt
391
+ * @supported weapp, tt, rn
381
392
  * @example
382
393
  * ```tsx
383
394
  * Taro.compressImage({
@@ -408,7 +419,7 @@ declare module '../../index' {
408
419
 
409
420
  /**
410
421
  * 从本地相册选择图片或使用相机拍照。
411
- * @supported weapp, h5, rn, alipay, swan, tt
422
+ * @supported weapp, alipay, swan, tt, h5, rn
412
423
  * @example
413
424
  * ```tsx
414
425
  * Taro.chooseImage({
@@ -233,30 +233,42 @@ declare module '../../index' {
233
233
 
234
234
  namespace chooseVideo {
235
235
  interface Option {
236
- /** 默认拉起的是前置或者后置摄像头。部分 Android 手机下由于系统 ROM 不支持无法生效 */
236
+ /** 默认拉起的是前置或者后置摄像头。部分 Android 手机下由于系统 ROM 不支持无法生效
237
+ * @default "back"
238
+ * @supported weapp, h5
239
+ */
237
240
  camera?: keyof Camera
241
+ /** 是否压缩所选择的视频文件
242
+ * @default true
243
+ * @supported weapp
244
+ */
245
+ compressed?: boolean
246
+ /** 拍摄视频最长拍摄时间,单位秒
247
+ * @default 60
248
+ * @supported weapp
249
+ */
250
+ maxDuration?: number
251
+ /** 视频选择的来源
252
+ * @default ['album', 'camera']
253
+ * @supported weapp, h5
254
+ */
255
+ sourceType?: Array<keyof sourceType>
238
256
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
239
257
  complete?: (res: TaroGeneral.CallbackResult) => void
240
- /** 是否压缩所选择的视频文件 */
241
- compressed?: boolean
242
258
  /** 接口调用失败的回调函数 */
243
259
  fail?: (res: TaroGeneral.CallbackResult) => void
244
- /** 拍摄视频最长拍摄时间,单位秒 */
245
- maxDuration?: number
246
- /** 视频选择的来源 */
247
- sourceType?: Array<keyof sourceType>
248
260
  /** 接口调用成功的回调函数 */
249
261
  success?: (result: SuccessCallbackResult) => void
250
262
  }
251
263
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
264
+ /** 选定视频的临时文件路径 */
265
+ tempFilePath: string
252
266
  /** 选定视频的时间长度 */
253
267
  duration: number
254
- /** 返回选定视频的高度 */
255
- height: number
256
268
  /** 选定视频的数据量大小 */
257
269
  size: number
258
- /** 选定视频的临时文件路径 */
259
- tempFilePath: string
270
+ /** 返回选定视频的高度 */
271
+ height: number
260
272
  /** 返回选定视频的宽度 */
261
273
  width: number
262
274
  /** 调用结果 */
@@ -276,30 +288,53 @@ declare module '../../index' {
276
288
  }
277
289
  }
278
290
 
279
-
280
291
  namespace chooseMedia {
281
292
  interface Option {
282
- /** 最多可以选择的文件个数 */
293
+ /** 最多可以选择的文件个数
294
+ * @default 9
295
+ * @supported weapp, h5
296
+ */
283
297
  count?: number
284
- /** 文件类型 */
298
+ /** 文件类型
299
+ * @default ['image', 'video']
300
+ * @supported weapp, h5
301
+ */
285
302
  mediaType?: Array<keyof mediaType>
286
- /** 图片和视频选择的来源 */
303
+ /** 图片和视频选择的来源
304
+ * @default ['album', 'camera']
305
+ * @supported weapp, h5
306
+ */
287
307
  sourceType?: Array<keyof sourceType>
288
- /** 拍摄视频最长拍摄时间,单位秒。时间范围为 3s 至 30s 之间 */
308
+ /** 拍摄视频最长拍摄时间,单位秒。时间范围为 3s 至 60s 之间
309
+ * @default 10
310
+ * @supported weapp
311
+ */
289
312
  maxDuration?: number
290
- /** 仅对 mediaType 为 image 时有效,是否压缩所选文件 */
313
+ /** 是否压缩所选文件
314
+ * @default ['original', 'compressed']
315
+ * @supported weapp
316
+ */
291
317
  sizeType?: Array<'original' | 'compressed'>
292
- /** 仅在 sourceType 为 camera 时生效,使用前置或后置摄像头 */
318
+ /** 仅在 sourceType 为 camera 时生效,使用前置或后置摄像头
319
+ * @default "back"
320
+ * @supported weapp, h5
321
+ */
293
322
  camera?: string
323
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
324
+ complete?: (res: TaroGeneral.CallbackResult) => void
294
325
  /** 接口调用失败的回调函数 */
295
326
  fail?: (res: TaroGeneral.CallbackResult) => void
296
327
  /** 接口调用成功的回调函数 */
297
328
  success?: (result: SuccessCallbackResult) => void
329
+ /** 用来上传的input元素ID
330
+ * @supported h5
331
+ */
332
+ mediaId?: string
298
333
  }
299
334
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
300
335
  /** 本地临时文件列表 */
301
336
  tempFiles: ChooseMedia[]
302
- /** 文件类型,有效值有 image 、video */
337
+ /** 文件类型,有效值有 image 、video、mix */
303
338
  type: string
304
339
  }
305
340
  /** 本地临时文件列表 */
@@ -316,6 +351,12 @@ declare module '../../index' {
316
351
  width: number
317
352
  /** 视频缩略图临时文件路径 */
318
353
  thumbTempFilePath: string
354
+ /** 选择的文件的类型 */
355
+ fileType: string
356
+ /** 原始的浏览器 File 对象
357
+ * @supported h5
358
+ */
359
+ originalFileObj?: File
319
360
  }
320
361
  interface mediaType {
321
362
  /** 只能拍摄视频或从相册选择视频 */
@@ -346,11 +387,11 @@ declare module '../../index' {
346
387
  * **Bug & Tip:**
347
388
  *
348
389
  * 1. `tip`: camera 参数在部分 Android 手机下由于系统 ROM 不支持无法生效
349
- * @supported weapp, rn
390
+ * @supported weapp, h5, rn
350
391
  * @example
351
392
  ```tsx
352
393
  * Taro.saveVideoToPhotosAlbum({
353
- * filePath: 'wxfile://xxx',
394
+ * filePath: 'file://xxx',
354
395
  * success: function (res) {
355
396
  * console.log(res.errMsg)
356
397
  * }
@@ -447,7 +488,7 @@ declare module '../../index' {
447
488
  compressVideo(option: compressVideo.Option): Promise<compressVideo.SuccessCallbackResult>
448
489
 
449
490
  /** 拍摄视频或从手机相册中选视频。
450
- * @supported weapp, rn
491
+ * @supported weapp, h5, rn
451
492
  * @example
452
493
  * ```tsx
453
494
  * Taro.chooseVideo({
@@ -464,7 +505,7 @@ declare module '../../index' {
464
505
  chooseVideo(option: chooseVideo.Option): Promise<chooseVideo.SuccessCallbackResult>
465
506
 
466
507
  /** 拍摄或从手机相册中选择图片或视频。
467
- * @supported weapp
508
+ * @supported weapp, h5
468
509
  * @example
469
510
  * ```tsx
470
511
  * Taro.chooseMedia({
@@ -360,7 +360,9 @@ declare module './index' {
360
360
  * @default false
361
361
  * @since 2.1.0
362
362
  */
363
- functionalPages?: boolean
363
+ functionalPages?: boolean | {
364
+ independent?: boolean
365
+ }
364
366
  /** 分包结构配置
365
367
  * @example
366
368
  * ```json