@tarojs/plugin-platform-harmony-ets 4.0.0-beta.46 → 4.0.0-beta.48

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/runtime.js CHANGED
@@ -9,6 +9,7 @@ import errorManager from '@ohos.app.ability.errorManager';
9
9
  import sensor from '@ohos.sensor';
10
10
  import batteryInfo, { BatteryChargeState } from '@ohos.batteryInfo';
11
11
  import pasteboard from '@ohos.pasteboard';
12
+ import promptAction from '@ohos.promptAction';
12
13
  import inputMethodEngine from '@ohos.inputMethodEngine';
13
14
  import network from '@system.network';
14
15
  import call from '@ohos.telephony.call';
@@ -30,7 +31,6 @@ import router from '@ohos.router';
30
31
  import bundleManager from '@ohos.bundle.bundleManager';
31
32
  import distributedKVStore from '@ohos.data.distributedKVStore';
32
33
  import matrix4 from '@ohos.matrix4';
33
- import prompt from '@ohos.prompt';
34
34
  import { pxTransformHelper as pxTransformHelper$1 } from '@tarojs/taro';
35
35
 
36
36
  class MethodHandler {
@@ -656,6 +656,7 @@ const setClipboardData = function (options) {
656
656
  callAsyncFail(reject, res, options);
657
657
  }
658
658
  else {
659
+ promptAction.showToast({ message: '内容已复制' });
659
660
  return handle.success({
660
661
  data,
661
662
  }, { resolve, reject });
@@ -3389,7 +3390,7 @@ const batchSetStorageSync = /* @__PURE__ */ temporarilyNotSupport('batchSetStora
3389
3390
  const batchSetStorage = /* @__PURE__ */ temporarilyNotSupport('batchSetStorage');
3390
3391
  const batchGetStorageSync = /* @__PURE__ */ temporarilyNotSupport('batchGetStorageSync');
3391
3392
  const batchGetStorage = /* @__PURE__ */ temporarilyNotSupport('batchGetStorage');
3392
- const clearStorage = temporarilyNotSupport('removeStorageSync');
3393
+ const clearStorage = temporarilyNotSupport('clearStorage');
3393
3394
  const getStorageSync = temporarilyNotSupport('getStorageSync', 'getStorage');
3394
3395
  const setStorageSync = temporarilyNotSupport('setStorageSync', 'setStorage');
3395
3396
  const clearStorageSync = temporarilyNotSupport('clearStorageSync', 'clearStorage');
@@ -3639,7 +3640,7 @@ function showToast(options) {
3639
3640
  const res = { errMsg: error.message };
3640
3641
  return callAsyncFail(reject, res, options);
3641
3642
  }
3642
- prompt.showToast({
3643
+ promptAction.showToast({
3643
3644
  message: options.title,
3644
3645
  duration: options.duration,
3645
3646
  bottom: options.bottom
@@ -3672,25 +3673,24 @@ function showModal(options) {
3672
3673
  color: confirmColor
3673
3674
  });
3674
3675
  }
3675
- return new Promise(resolve => {
3676
+ return new Promise((resolve, reject) => {
3676
3677
  const modalOptions = {
3677
3678
  title,
3678
3679
  message: content,
3679
3680
  buttons: buttons,
3680
- success: (data) => {
3681
- if (data.index === 1 || !showCancel) {
3682
- callAsyncSuccess(resolve, Object.assign(Object.assign({}, resCallback('showModal')), { confirm: true, cancel: false, content: null }), options);
3683
- }
3684
- else {
3685
- callAsyncSuccess(resolve, Object.assign(Object.assign({}, resCallback('showModal')), { confirm: false, cancel: true }), options);
3686
- }
3687
- },
3688
- // 鸿蒙没有失败方法,只有取消
3689
- cancel: (_) => {
3681
+ };
3682
+ promptAction.showDialog(modalOptions, (error, data) => {
3683
+ if (error) {
3684
+ const res = { errMsg: error };
3685
+ callAsyncFail(reject, res, options);
3686
+ }
3687
+ if (data.index === 0 && showCancel) {
3690
3688
  callAsyncSuccess(resolve, Object.assign(Object.assign({}, resCallback('showModal')), { confirm: false, cancel: true }), options);
3691
3689
  }
3692
- };
3693
- prompt.showDialog(modalOptions);
3690
+ else {
3691
+ callAsyncSuccess(resolve, Object.assign(Object.assign({}, resCallback('showModal')), { confirm: true, cancel: false, content: null }), options);
3692
+ }
3693
+ });
3694
3694
  });
3695
3695
  }
3696
3696
  const showActionSheetSchema = {
@@ -3721,21 +3721,19 @@ function showActionSheet(options) {
3721
3721
  });
3722
3722
  const actionSheetOptions = {
3723
3723
  title,
3724
- buttons,
3725
- success: (data) => {
3726
- callAsyncSuccess(resolve, Object.assign(Object.assign({}, data), resCallback('showActionSheet')), options);
3727
- },
3728
- // 取消方法,并非失败
3729
- fail: (data) => {
3724
+ buttons
3725
+ };
3726
+ promptAction.showActionMenu(actionSheetOptions, (error, data) => {
3727
+ if (error) {
3730
3728
  callAsyncFail(reject, Object.assign(Object.assign({}, data), { errMsg: data.errMsg.replace('showActionMenu', 'showActionSheet') }), options);
3731
3729
  }
3732
- };
3733
- prompt.showActionMenu(actionSheetOptions);
3730
+ callAsyncSuccess(resolve, Object.assign(Object.assign({}, data), resCallback('showActionSheet')), options);
3731
+ });
3734
3732
  });
3735
3733
  }
3736
3734
  function hideToast(options) {
3737
3735
  return new Promise(resolve => {
3738
- prompt.showToast({
3736
+ promptAction.showToast({
3739
3737
  message: '关闭中',
3740
3738
  duration: 10,
3741
3739
  bottom: '9999px'
@@ -4885,7 +4883,6 @@ let displayWidth = display.width;
4885
4883
  let ratioCache = false;
4886
4884
  let designWidthFunc;
4887
4885
  let designWidth = defaultDesignWidth;
4888
- let deviceRatio = defaultDesignRatio;
4889
4886
  function getRatio(value) {
4890
4887
  var _a;
4891
4888
  // Note: 提前调用 display 可能无法获取正确值
@@ -4896,10 +4893,6 @@ function getRatio(value) {
4896
4893
  ? config.designWidth
4897
4894
  : () => config.designWidth;
4898
4895
  designWidth = designWidthFunc(value) || defaultDesignWidth;
4899
- deviceRatio = config.deviceRatio || defaultDesignRatio;
4900
- if (!(designWidth in deviceRatio)) {
4901
- throw new Error(`deviceRatio 配置中不存在 ${designWidth} 的设置!`);
4902
- }
4903
4896
  }
4904
4897
  displayWidth = display.width;
4905
4898
  ratioCache = Math.min(display.width, display.height) / designWidth;