@tarojs/plugin-platform-harmony-ets 4.0.0-beta.45 → 4.0.0-beta.47
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/apis/device/clipboard.ts +4 -0
- package/dist/apis/storage/index.ts +61 -51
- package/dist/apis/ui/interaction/index.ts +39 -48
- package/dist/components-harmony-ets/checkbox.ets +1 -1
- package/dist/components-harmony-ets/form.ets +1 -1
- package/dist/components-harmony-ets/index.ets +8 -3
- package/dist/components-harmony-ets/label.ets +1 -1
- package/dist/components-harmony-ets/movableArea.ets +1 -1
- package/dist/components-harmony-ets/movableView.ets +1 -1
- package/dist/components-harmony-ets/radio.ets +1 -1
- package/dist/components-harmony-ets/style.ets +31 -21
- package/dist/components-harmony-ets/utils/flexManager.ets +5 -0
- package/dist/components-harmony-ets/view.ets +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/dom/cssNesting.ts +1 -1
- package/dist/runtime-ets/dom/cssStyleDeclaration.ts +15 -1
- package/dist/runtime-ets/dom/element/element.ts +43 -19
- package/dist/runtime-ets/dom/stylesheet/type.ts +10 -0
- package/dist/runtime-ets/utils/index.ts +25 -11
- package/dist/runtime-utils.js +80 -72
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +80 -72
- package/dist/runtime.js.map +1 -1
- package/package.json +9 -9
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 });
|
|
@@ -3235,6 +3236,7 @@ const createCacheManager = /* @__PURE__ */ temporarilyNotSupport('createCacheMan
|
|
|
3235
3236
|
let context;
|
|
3236
3237
|
let kvManager;
|
|
3237
3238
|
let kvStore;
|
|
3239
|
+
let kvStorePromise;
|
|
3238
3240
|
Current.contextPromise.then((ctx) => {
|
|
3239
3241
|
context = ctx;
|
|
3240
3242
|
const kvManagerConfig = {
|
|
@@ -3256,13 +3258,16 @@ Current.contextPromise.then((ctx) => {
|
|
|
3256
3258
|
securityLevel: distributedKVStore.SecurityLevel.S1
|
|
3257
3259
|
};
|
|
3258
3260
|
const data = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3261
|
+
kvStorePromise = new Promise(resolve => {
|
|
3262
|
+
kvManager.getKVStore(`${data.appInfo.uid}Store`, options, (err, store) => {
|
|
3263
|
+
if (err) {
|
|
3264
|
+
console.error(`Failed to get KVStore: Code:${err.code},message:${err.message}`);
|
|
3265
|
+
return;
|
|
3266
|
+
}
|
|
3267
|
+
kvStore = store;
|
|
3268
|
+
// 请确保获取到键值数据库实例后,再进行相关数据操作
|
|
3269
|
+
resolve();
|
|
3270
|
+
});
|
|
3266
3271
|
});
|
|
3267
3272
|
}
|
|
3268
3273
|
catch (e) {
|
|
@@ -3274,7 +3279,7 @@ const storageSchema = {
|
|
|
3274
3279
|
key: 'String'
|
|
3275
3280
|
};
|
|
3276
3281
|
function checkContextExist(api, isAsync = false) {
|
|
3277
|
-
if (!context
|
|
3282
|
+
if (!context) {
|
|
3278
3283
|
const message = `${api} 调用失败,Taro 不支持过早地调用 ${api},请确保页面已经渲染完成再调用此 API`;
|
|
3279
3284
|
if (isAsync) {
|
|
3280
3285
|
return {
|
|
@@ -3302,20 +3307,22 @@ function getStorage(options) {
|
|
|
3302
3307
|
const { key, success, fail, complete } = options || {};
|
|
3303
3308
|
const handle = new MethodHandler({ name, success, fail, complete });
|
|
3304
3309
|
return new Promise((resolve, reject) => {
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
catch (error) {
|
|
3309
|
-
const res = { errMsg: error.message };
|
|
3310
|
-
return handle.fail(res, { resolve, reject });
|
|
3311
|
-
}
|
|
3312
|
-
kvStore = kvStore;
|
|
3313
|
-
kvStore.get(key, (err, data) => {
|
|
3314
|
-
if (err) {
|
|
3315
|
-
handle.fail({ errMsg: `Failed to get data. Code:${err.code},message:${err.message}` }, { resolve, reject });
|
|
3316
|
-
return;
|
|
3310
|
+
kvStorePromise.then(() => {
|
|
3311
|
+
try {
|
|
3312
|
+
validateParams(name, options, storageSchema);
|
|
3317
3313
|
}
|
|
3318
|
-
|
|
3314
|
+
catch (error) {
|
|
3315
|
+
const res = { errMsg: error.message };
|
|
3316
|
+
return handle.fail(res, { resolve, reject });
|
|
3317
|
+
}
|
|
3318
|
+
kvStore = kvStore;
|
|
3319
|
+
kvStore.get(key, (err, data) => {
|
|
3320
|
+
if (err) {
|
|
3321
|
+
handle.fail({ errMsg: `Failed to get data. Code:${err.code},message:${err.message}` }, { resolve, reject });
|
|
3322
|
+
return;
|
|
3323
|
+
}
|
|
3324
|
+
handle.success({ data }, { resolve, reject });
|
|
3325
|
+
});
|
|
3319
3326
|
});
|
|
3320
3327
|
});
|
|
3321
3328
|
}
|
|
@@ -3328,20 +3335,22 @@ function setStorage(options) {
|
|
|
3328
3335
|
const { key, data, success, fail, complete } = options || {};
|
|
3329
3336
|
const handle = new MethodHandler({ name, success, fail, complete });
|
|
3330
3337
|
return new Promise((resolve, reject) => {
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
kvStore = kvStore;
|
|
3339
|
-
kvStore.put(key, data, (err) => {
|
|
3340
|
-
if (err) {
|
|
3341
|
-
handle.fail({ errMsg: `Failed to put data. Code:${err.code},message:${err.message}` }, { resolve, reject });
|
|
3342
|
-
return;
|
|
3338
|
+
kvStorePromise.then(() => {
|
|
3339
|
+
try {
|
|
3340
|
+
validateParams(name, options, storageSchema);
|
|
3341
|
+
}
|
|
3342
|
+
catch (error) {
|
|
3343
|
+
const res = { errMsg: error.message };
|
|
3344
|
+
return handle.fail(res, { resolve, reject });
|
|
3343
3345
|
}
|
|
3344
|
-
|
|
3346
|
+
kvStore = kvStore;
|
|
3347
|
+
kvStore.put(key, data, (err) => {
|
|
3348
|
+
if (err) {
|
|
3349
|
+
handle.fail({ errMsg: `Failed to put data. Code:${err.code},message:${err.message}` }, { resolve, reject });
|
|
3350
|
+
return;
|
|
3351
|
+
}
|
|
3352
|
+
handle.success({}, { resolve, reject });
|
|
3353
|
+
});
|
|
3345
3354
|
});
|
|
3346
3355
|
});
|
|
3347
3356
|
}
|
|
@@ -3354,20 +3363,22 @@ function removeStorage(options) {
|
|
|
3354
3363
|
const { key, success, fail, complete } = options || {};
|
|
3355
3364
|
const handle = new MethodHandler({ name, success, fail, complete });
|
|
3356
3365
|
return new Promise((resolve, reject) => {
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
catch (error) {
|
|
3361
|
-
const res = { errMsg: error.message };
|
|
3362
|
-
return handle.fail(res, { resolve, reject });
|
|
3363
|
-
}
|
|
3364
|
-
kvStore = kvStore;
|
|
3365
|
-
kvStore.delete(key, (err) => {
|
|
3366
|
-
if (err) {
|
|
3367
|
-
handle.fail({ errMsg: `Failed to delete data. Code:${err.code},message:${err.message}` }, { resolve, reject });
|
|
3368
|
-
return;
|
|
3366
|
+
kvStorePromise.then(() => {
|
|
3367
|
+
try {
|
|
3368
|
+
validateParams(name, options, storageSchema);
|
|
3369
3369
|
}
|
|
3370
|
-
|
|
3370
|
+
catch (error) {
|
|
3371
|
+
const res = { errMsg: error.message };
|
|
3372
|
+
return handle.fail(res, { resolve, reject });
|
|
3373
|
+
}
|
|
3374
|
+
kvStore = kvStore;
|
|
3375
|
+
kvStore.delete(key, (err) => {
|
|
3376
|
+
if (err) {
|
|
3377
|
+
handle.fail({ errMsg: `Failed to delete data. Code:${err.code},message:${err.message}` }, { resolve, reject });
|
|
3378
|
+
return;
|
|
3379
|
+
}
|
|
3380
|
+
handle.success({}, { resolve, reject });
|
|
3381
|
+
});
|
|
3371
3382
|
});
|
|
3372
3383
|
});
|
|
3373
3384
|
}
|
|
@@ -3379,7 +3390,7 @@ const batchSetStorageSync = /* @__PURE__ */ temporarilyNotSupport('batchSetStora
|
|
|
3379
3390
|
const batchSetStorage = /* @__PURE__ */ temporarilyNotSupport('batchSetStorage');
|
|
3380
3391
|
const batchGetStorageSync = /* @__PURE__ */ temporarilyNotSupport('batchGetStorageSync');
|
|
3381
3392
|
const batchGetStorage = /* @__PURE__ */ temporarilyNotSupport('batchGetStorage');
|
|
3382
|
-
const clearStorage = temporarilyNotSupport('
|
|
3393
|
+
const clearStorage = temporarilyNotSupport('clearStorage');
|
|
3383
3394
|
const getStorageSync = temporarilyNotSupport('getStorageSync', 'getStorage');
|
|
3384
3395
|
const setStorageSync = temporarilyNotSupport('setStorageSync', 'setStorage');
|
|
3385
3396
|
const clearStorageSync = temporarilyNotSupport('clearStorageSync', 'clearStorage');
|
|
@@ -3629,7 +3640,7 @@ function showToast(options) {
|
|
|
3629
3640
|
const res = { errMsg: error.message };
|
|
3630
3641
|
return callAsyncFail(reject, res, options);
|
|
3631
3642
|
}
|
|
3632
|
-
|
|
3643
|
+
promptAction.showToast({
|
|
3633
3644
|
message: options.title,
|
|
3634
3645
|
duration: options.duration,
|
|
3635
3646
|
bottom: options.bottom
|
|
@@ -3662,25 +3673,24 @@ function showModal(options) {
|
|
|
3662
3673
|
color: confirmColor
|
|
3663
3674
|
});
|
|
3664
3675
|
}
|
|
3665
|
-
return new Promise(resolve => {
|
|
3676
|
+
return new Promise((resolve, reject) => {
|
|
3666
3677
|
const modalOptions = {
|
|
3667
3678
|
title,
|
|
3668
3679
|
message: content,
|
|
3669
3680
|
buttons: buttons,
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
}
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
},
|
|
3678
|
-
// 鸿蒙没有失败方法,只有取消
|
|
3679
|
-
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) {
|
|
3680
3688
|
callAsyncSuccess(resolve, Object.assign(Object.assign({}, resCallback('showModal')), { confirm: false, cancel: true }), options);
|
|
3681
3689
|
}
|
|
3682
|
-
|
|
3683
|
-
|
|
3690
|
+
else {
|
|
3691
|
+
callAsyncSuccess(resolve, Object.assign(Object.assign({}, resCallback('showModal')), { confirm: true, cancel: false, content: null }), options);
|
|
3692
|
+
}
|
|
3693
|
+
});
|
|
3684
3694
|
});
|
|
3685
3695
|
}
|
|
3686
3696
|
const showActionSheetSchema = {
|
|
@@ -3711,21 +3721,19 @@ function showActionSheet(options) {
|
|
|
3711
3721
|
});
|
|
3712
3722
|
const actionSheetOptions = {
|
|
3713
3723
|
title,
|
|
3714
|
-
buttons
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
// 取消方法,并非失败
|
|
3719
|
-
fail: (data) => {
|
|
3724
|
+
buttons
|
|
3725
|
+
};
|
|
3726
|
+
promptAction.showActionMenu(actionSheetOptions, (error, data) => {
|
|
3727
|
+
if (error) {
|
|
3720
3728
|
callAsyncFail(reject, Object.assign(Object.assign({}, data), { errMsg: data.errMsg.replace('showActionMenu', 'showActionSheet') }), options);
|
|
3721
3729
|
}
|
|
3722
|
-
|
|
3723
|
-
|
|
3730
|
+
callAsyncSuccess(resolve, Object.assign(Object.assign({}, data), resCallback('showActionSheet')), options);
|
|
3731
|
+
});
|
|
3724
3732
|
});
|
|
3725
3733
|
}
|
|
3726
3734
|
function hideToast(options) {
|
|
3727
3735
|
return new Promise(resolve => {
|
|
3728
|
-
|
|
3736
|
+
promptAction.showToast({
|
|
3729
3737
|
message: '关闭中',
|
|
3730
3738
|
duration: 10,
|
|
3731
3739
|
bottom: '9999px'
|