@tarojs/taro-h5 3.5.7 → 3.5.9

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.
@@ -269,7 +269,7 @@ declare const makePhoneCall: typeof Taro.makePhoneCall;
269
269
  // 扫码
270
270
  declare const scanCode: (options?: Partial<{
271
271
  needResult: number;
272
- }>) => Promise<any>;
272
+ }>, ...args: any[]) => Promise<any>;
273
273
  // 屏幕
274
274
  declare const setVisualEffectOnCapture: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
275
275
  declare const setScreenBrightness: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
@@ -318,12 +318,12 @@ declare const startLocationUpdateBackground: (option?: {}, ...args: any[]) => Pr
318
318
  declare const startLocationUpdate: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
319
319
  declare const openLocation: (options?: Partial<{
320
320
  scale: number;
321
- }>) => Promise<any>;
321
+ }>, ...args: any[]) => Promise<any>;
322
322
  declare const onLocationChangeError: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
323
323
  declare const onLocationChange: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
324
324
  declare const offLocationChangeError: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
325
325
  declare const offLocationChange: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
326
- declare const getLocation: (options?: Partial<Taro.getLocation.Option>) => Promise<Taro.getLocation.SuccessCallbackResult>;
326
+ declare const getLocation: (options?: Partial<Taro.getLocation.Option>, ...args: any[]) => Promise<Taro.getLocation.SuccessCallbackResult>;
327
327
  declare const choosePoi: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
328
328
  declare const getFuzzyLocation: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
329
329
  /**
package/dist/index.esm.js CHANGED
@@ -273,7 +273,7 @@ function permanentlyNotSupport(name = '') {
273
273
  }
274
274
  function processOpenApi({ name, defaultOptions, standardMethod, formatOptions = options => options, formatResult = res => res }) {
275
275
  const notSupported = weixinCorpSupport(name);
276
- return (options = {}) => {
276
+ return (options = {}, ...args) => {
277
277
  var _a;
278
278
  // @ts-ignore
279
279
  const targetApi = (_a = window === null || window === void 0 ? void 0 : window.wx) === null || _a === void 0 ? void 0 : _a[name];
@@ -299,7 +299,7 @@ function processOpenApi({ name, defaultOptions, standardMethod, formatOptions =
299
299
  return standardMethod(opts);
300
300
  }
301
301
  else {
302
- return notSupported();
302
+ return notSupported(options, ...args);
303
303
  }
304
304
  };
305
305
  }
@@ -2327,6 +2327,7 @@ const previewImage = (options) => __awaiter(void 0, void 0, void 0, function* ()
2327
2327
  image.style.maxWidth = '100%';
2328
2328
  image.src = url;
2329
2329
  const div = document.createElement('div');
2330
+ div.classList.add('swiper-zoom-container');
2330
2331
  div.style.cssText = 'display:flex;align-items:center;justify-content:center;max-width:100%;min-height:100%;';
2331
2332
  div.appendChild(image);
2332
2333
  item.appendChild(div);
@@ -2357,6 +2358,8 @@ const previewImage = (options) => __awaiter(void 0, void 0, void 0, function* ()
2357
2358
  const swiper = document.createElement('taro-swiper-core');
2358
2359
  // @ts-ignore
2359
2360
  swiper.full = true;
2361
+ // @ts-ignore
2362
+ swiper.zoom = true;
2360
2363
  let children = [];
2361
2364
  try {
2362
2365
  children = yield Promise.all(urls.map(e => loadImage(e, fail)));
@@ -2652,8 +2655,8 @@ const convertObjectUrlToBlob = url => {
2652
2655
  });
2653
2656
  };
2654
2657
 
2655
- const createDownloadTask = ({ url, header, withCredentials = true, success, error }) => {
2656
- let timeout;
2658
+ const createDownloadTask = ({ url, header, withCredentials = true, timeout, success, error }) => {
2659
+ let timeoutInter;
2657
2660
  const apiName = 'downloadFile';
2658
2661
  const xhr = new XMLHttpRequest();
2659
2662
  const callbackManager = {
@@ -2689,7 +2692,7 @@ const createDownloadTask = ({ url, header, withCredentials = true, success, erro
2689
2692
  });
2690
2693
  };
2691
2694
  xhr.onabort = () => {
2692
- clearTimeout(timeout);
2695
+ clearTimeout(timeoutInter);
2693
2696
  error({
2694
2697
  errMsg: `${apiName}:fail abort`
2695
2698
  });
@@ -2707,7 +2710,7 @@ const createDownloadTask = ({ url, header, withCredentials = true, success, erro
2707
2710
  };
2708
2711
  const send = () => {
2709
2712
  xhr.send();
2710
- timeout = setTimeout(() => {
2713
+ timeoutInter = setTimeout(() => {
2711
2714
  xhr.onabort = null;
2712
2715
  xhr.onload = null;
2713
2716
  xhr.onprogress = null;
@@ -2717,7 +2720,7 @@ const createDownloadTask = ({ url, header, withCredentials = true, success, erro
2717
2720
  error({
2718
2721
  errMsg: `${apiName}:fail timeout`
2719
2722
  });
2720
- }, NETWORK_TIMEOUT);
2723
+ }, timeout || NETWORK_TIMEOUT);
2721
2724
  };
2722
2725
  send();
2723
2726
  /**
@@ -2752,13 +2755,14 @@ const createDownloadTask = ({ url, header, withCredentials = true, success, erro
2752
2755
  * 下载文件资源到本地。客户端直接发起一个 HTTPS GET 请求,返回文件的本地临时路径。使用前请注意阅读相关说明。
2753
2756
  * 注意:请在服务端响应的 header 中指定合理的 Content-Type 字段,以保证客户端正确处理文件类型。
2754
2757
  */
2755
- const downloadFile = ({ url, header, withCredentials, success, fail, complete }) => {
2758
+ const downloadFile = ({ url, header, withCredentials, timeout, success, fail, complete }) => {
2756
2759
  let task;
2757
2760
  const result = new Promise((resolve, reject) => {
2758
2761
  task = createDownloadTask({
2759
2762
  url,
2760
2763
  header,
2761
2764
  withCredentials,
2765
+ timeout,
2762
2766
  success: res => {
2763
2767
  success && success(res);
2764
2768
  complete && complete(res);
@@ -3732,8 +3736,8 @@ class ActionSheet {
3732
3736
  this.el.style.opacity = '0';
3733
3737
  this.el.style.transition = 'opacity 0.2s linear';
3734
3738
  // mask
3735
- const mask = document.createElement('div');
3736
- mask.setAttribute('style', inlineStyle(maskStyle));
3739
+ this.mask = document.createElement('div');
3740
+ this.mask.setAttribute('style', inlineStyle(maskStyle));
3737
3741
  // actionSheet
3738
3742
  this.actionSheet = document.createElement('div');
3739
3743
  this.actionSheet.setAttribute('style', inlineStyle(actionSheetStyle));
@@ -3763,14 +3767,14 @@ class ActionSheet {
3763
3767
  this.cells.forEach(item => this.menu.appendChild(item));
3764
3768
  this.actionSheet.appendChild(this.menu);
3765
3769
  this.actionSheet.appendChild(this.cancel);
3766
- this.el.appendChild(mask);
3770
+ this.el.appendChild(this.mask);
3767
3771
  this.el.appendChild(this.actionSheet);
3768
3772
  // callbacks
3769
3773
  const cb = () => {
3770
3774
  this.hide();
3771
3775
  resolve('cancel');
3772
3776
  };
3773
- mask.onclick = cb;
3777
+ this.mask.onclick = cb;
3774
3778
  this.cancel.onclick = cb;
3775
3779
  // show immediately
3776
3780
  document.body.appendChild(this.el);
@@ -3824,6 +3828,13 @@ class ActionSheet {
3824
3828
  }
3825
3829
  this.cells.splice(itemListLen);
3826
3830
  }
3831
+ // callbacks
3832
+ const cb = () => {
3833
+ this.hide();
3834
+ resolve('cancel');
3835
+ };
3836
+ this.mask.onclick = cb;
3837
+ this.cancel.onclick = cb;
3827
3838
  // show
3828
3839
  this.el.style.display = 'block';
3829
3840
  setTimeout(() => {