@tarojs/plugin-platform-harmony-ets 4.0.0-alpha.34 → 4.0.0-alpha.36
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/base/weapp/life-cycle.ts +1 -1
- package/dist/apis/framework/index.ts +1 -1
- package/dist/apis/media/image/index.ts +124 -135
- package/dist/apis/route/index.ts +1 -2
- package/dist/apis/ui/background.ts +1 -1
- package/dist/apis/ui/navigation-bar/index.ts +1 -1
- package/dist/apis/ui/tab-bar.ts +1 -2
- package/dist/components-harmony-ets/button.ets +1 -1
- package/dist/components-harmony-ets/checkbox.ets +1 -2
- package/dist/components-harmony-ets/form.ets +0 -1
- package/dist/components-harmony-ets/index.ets +37 -90
- package/dist/components-harmony-ets/input.ets +2 -2
- package/dist/components-harmony-ets/label.ets +1 -2
- package/dist/components-harmony-ets/listView.ets +1 -1
- package/dist/components-harmony-ets/movableArea.ets +3 -3
- package/dist/components-harmony-ets/navigationBar.ets +1 -1
- package/dist/components-harmony-ets/pageMeta.ets +1 -1
- package/dist/components-harmony-ets/pseudo.ets +1 -1
- package/dist/components-harmony-ets/radio.ets +2 -3
- package/dist/components-harmony-ets/scrollList.ets +2 -2
- package/dist/components-harmony-ets/scrollView.ets +1 -1
- package/dist/components-harmony-ets/slider.ets +1 -1
- package/dist/components-harmony-ets/style.ets +7 -6
- package/dist/components-harmony-ets/swiper.ets +1 -1
- package/dist/components-harmony-ets/switch.ets +1 -1
- package/dist/components-harmony-ets/text.ets +2 -2
- package/dist/components-harmony-ets/utils/helper.ets +2 -2
- package/dist/components-harmony-ets/utils/styles.ets +5 -6
- package/dist/components-harmony-ets/video.ets +1 -1
- package/dist/components-harmony-ets/view.ets +1 -2
- package/dist/components-harmony-ets/webView.ets +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/bom/URL.ts +2 -0
- package/dist/runtime-ets/bom/document.ts +1 -2
- package/dist/runtime-ets/bom/getComputedStyle.ts +1 -2
- package/dist/runtime-ets/bom/history.ts +1 -0
- package/dist/runtime-ets/bom/location.ts +1 -0
- package/dist/runtime-ets/bom/navigator.ts +1 -21
- package/dist/runtime-ets/bom/raf.ts +1 -37
- package/dist/runtime-ets/bom/window.ts +4 -5
- package/dist/runtime-ets/constant.ts +17 -10
- package/dist/runtime-ets/current.ts +0 -1
- package/dist/runtime-ets/dom/document.ts +1 -1
- package/dist/runtime-ets/dom/element/canvas.ts +3 -2
- package/dist/runtime-ets/dom/element/element.ts +6 -5
- package/dist/runtime-ets/dom/element/movableView.ts +12 -8
- package/dist/runtime-ets/dom/event-source.ts +1 -0
- package/dist/runtime-ets/dom/eventTarget.ts +1 -1
- package/dist/runtime-ets/dom/node.ts +2 -3
- package/dist/runtime-ets/emitter/emitter.ts +1 -0
- package/dist/runtime-ets/env.ts +1 -0
- package/dist/runtime-ets/index.ts +21 -7
- package/dist/runtime-ets/interface/index.ts +6 -0
- package/dist/runtime-ets/utils/index.ts +4 -6
- package/dist/runtime-ets/utils/router.ts +9 -0
- package/dist/runtime-framework/react/app.ts +1 -2
- package/dist/runtime-framework/react/hooks.ts +1 -1
- package/dist/runtime-framework/react/native-page.ts +44 -15
- package/dist/runtime-framework/react/page.ts +1 -2
- package/dist/runtime-framework/solid/app.ts +1 -2
- package/dist/runtime-framework/solid/hooks.ts +1 -1
- package/dist/runtime-framework/solid/page.ts +1 -2
- package/dist/runtime-utils.js +134 -166
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +134 -166
- package/dist/runtime.js.map +1 -1
- package/package.json +9 -9
package/dist/runtime-utils.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { isFunction, isString, isArray, isObject, isNull, isNumber, isUndefined, queryToJson, PLATFORM_TYPE, singleQuote, internalComponents } from '@tarojs/shared';
|
|
2
2
|
import _display from '@ohos.display';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import { eventCenter, Current, window, eventSource, hooks, document as document$1, getPageScrollerOrNode, findChildNodeWithDFS, setNodeEventCallbackAndTriggerComponentUpdate, AREA_CHANGE_EVENT_NAME, disconnectEvent, VISIBLE_CHANGE_EVENT_NAME, Events, History, getCurrentInstance } from '@tarojs/runtime';
|
|
4
|
+
import '@ohos.abilityAccessCtrl';
|
|
5
5
|
import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant';
|
|
6
6
|
import deviceInfo from '@ohos.deviceInfo';
|
|
7
7
|
import i18n from '@ohos.i18n';
|
|
8
8
|
import errorManager from '@ohos.app.ability.errorManager';
|
|
9
|
-
import { eventCenter as eventCenter$1, Events, History } from '@tarojs/runtime/dist/runtime.esm';
|
|
10
9
|
import sensor from '@ohos.sensor';
|
|
11
10
|
import batteryInfo, { BatteryChargeState } from '@ohos.batteryInfo';
|
|
12
11
|
import pasteboard from '@ohos.pasteboard';
|
|
@@ -176,21 +175,6 @@ const validateParams = function (name, params, schema) {
|
|
|
176
175
|
}
|
|
177
176
|
};
|
|
178
177
|
|
|
179
|
-
function requestPermissions(permissions) {
|
|
180
|
-
return new Promise((resolve, reject) => {
|
|
181
|
-
const context = getContext(Current === null || Current === void 0 ? void 0 : Current.page);
|
|
182
|
-
const atManager = abilityAccessCtrl.createAtManager();
|
|
183
|
-
atManager.requestPermissionsFromUser(context, permissions, (err, _) => {
|
|
184
|
-
if (err) {
|
|
185
|
-
// eslint-disable-next-line prefer-promise-reject-errors
|
|
186
|
-
reject(`[Taro] 请求用户授权 ${permissions.join('、')} 失败:${JSON.stringify(err)}`);
|
|
187
|
-
}
|
|
188
|
-
else {
|
|
189
|
-
resolve();
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
178
|
function object2String(obj) {
|
|
195
179
|
let str = '';
|
|
196
180
|
for (const item in obj) {
|
|
@@ -463,7 +447,7 @@ const launchOptions = {
|
|
|
463
447
|
function initLaunchOptions(options = {}) {
|
|
464
448
|
Object.assign(launchOptions, options);
|
|
465
449
|
}
|
|
466
|
-
eventCenter
|
|
450
|
+
eventCenter.once('__taroRouterLaunch', initLaunchOptions);
|
|
467
451
|
// 生命周期
|
|
468
452
|
const getLaunchOptionsSync = () => launchOptions;
|
|
469
453
|
const getEnterOptionsSync = () => launchOptions;
|
|
@@ -2279,12 +2263,6 @@ const chooseMedia = function (options) {
|
|
|
2279
2263
|
});
|
|
2280
2264
|
};
|
|
2281
2265
|
|
|
2282
|
-
const READ_IMAGEVIDEO_PERMISSIONS = 'ohos.permission.READ_IMAGEVIDEO';
|
|
2283
|
-
const READ_MEDIA_PERMISSIONS = 'ohos.permission.READ_MEDIA';
|
|
2284
|
-
const WRITE_MEDIA_PERMISSIONS = 'ohos.permission.WRITE_MEDIA';
|
|
2285
|
-
const MEDIA_LOCATION_PERMISSIONS = 'ohos.permission.MEDIA_LOCATION';
|
|
2286
|
-
const IMAGE_PERMISSION = [READ_IMAGEVIDEO_PERMISSIONS, READ_MEDIA_PERMISSIONS, WRITE_MEDIA_PERMISSIONS, MEDIA_LOCATION_PERMISSIONS];
|
|
2287
|
-
|
|
2288
2266
|
// HarmonyOS 图片模块首批接口从API version 7开始支持。
|
|
2289
2267
|
// HarmonyOS 文档链接:https://developer.harmonyos.com/cn/docs/documentation/doc-references/js-apis-image-0000001122977382
|
|
2290
2268
|
// WX 文档链接:https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.saveImageToPhotosAlbum.html
|
|
@@ -2360,153 +2338,143 @@ function saveImage(compressedImageData, compressedImageUri) {
|
|
|
2360
2338
|
}
|
|
2361
2339
|
const compressImage = function (options) {
|
|
2362
2340
|
return new Promise((resolve, reject) => {
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2341
|
+
try {
|
|
2342
|
+
validateParams('compressImage', options, compressImageSchema);
|
|
2343
|
+
}
|
|
2344
|
+
catch (error) {
|
|
2345
|
+
const res = { errMsg: error.message };
|
|
2346
|
+
return callAsyncFail(reject, res, options);
|
|
2347
|
+
}
|
|
2348
|
+
const { src, quality = 80, compressedWidth, compressedHeight } = options;
|
|
2349
|
+
const srcAfterCompress = src.includes('_after_compress') ? src : src.split('.').join('_after_compress.');
|
|
2350
|
+
const file = fs.openSync(src, fs.OpenMode.READ_ONLY);
|
|
2351
|
+
// const stat = fs.statSync(file.fd)
|
|
2352
|
+
// console.log('[Taro] 压缩前图片的大小为:', stat.size)
|
|
2353
|
+
const source = image.createImageSource(file.fd);
|
|
2354
|
+
if (isNull(source)) {
|
|
2355
|
+
const createImageSourceError = { errMsg: 'compressImage fail: createImageSource has failed.' };
|
|
2356
|
+
callAsyncFail(reject, createImageSourceError, options);
|
|
2357
|
+
return;
|
|
2358
|
+
}
|
|
2359
|
+
const width = source.getImageInfoSync().size.width;
|
|
2360
|
+
const height = source.getImageInfoSync().size.height;
|
|
2361
|
+
let wantWidth = compressedWidth || compressedHeight || 0;
|
|
2362
|
+
let wantHeight = compressedHeight || compressedWidth || 0;
|
|
2363
|
+
if (width > wantWidth || height > wantHeight) {
|
|
2364
|
+
const heightRatio = height / wantHeight;
|
|
2365
|
+
const widthRatio = width / wantWidth;
|
|
2366
|
+
const finalRatio = heightRatio < widthRatio ? heightRatio : widthRatio;
|
|
2367
|
+
wantWidth = Math.round(width / finalRatio);
|
|
2368
|
+
wantHeight = Math.round(height / finalRatio);
|
|
2369
|
+
}
|
|
2370
|
+
const decodingOptions = {
|
|
2371
|
+
editable: true,
|
|
2372
|
+
desiredPixelFormat: image.PixelMapFormat.RGBA_8888,
|
|
2373
|
+
desiredSize: { width: wantWidth, height: wantHeight }
|
|
2374
|
+
};
|
|
2375
|
+
source.createPixelMap(decodingOptions, (error, pixelMap) => {
|
|
2376
|
+
if (error !== undefined) {
|
|
2377
|
+
fs.closeSync(file);
|
|
2378
|
+
const res = { errMsg: error };
|
|
2379
|
+
callAsyncFail(reject, res, options);
|
|
2392
2380
|
}
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
desiredSize: { width: wantWidth, height: wantHeight }
|
|
2397
|
-
};
|
|
2398
|
-
source.createPixelMap(decodingOptions, (error, pixelMap) => {
|
|
2399
|
-
if (error !== undefined) {
|
|
2381
|
+
else {
|
|
2382
|
+
const packer = image.createImagePacker(file.fd);
|
|
2383
|
+
if (isNull(packer)) {
|
|
2400
2384
|
fs.closeSync(file);
|
|
2401
|
-
const
|
|
2402
|
-
callAsyncFail(reject,
|
|
2385
|
+
const createImagePackerError = { errMsg: 'compressImage fail: createImagePacker has failed.' };
|
|
2386
|
+
callAsyncFail(reject, createImagePackerError, options);
|
|
2387
|
+
return;
|
|
2403
2388
|
}
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
const packingOptionsOHOS = {
|
|
2414
|
-
format: isPNG ? 'image/png' : 'image/jpeg',
|
|
2415
|
-
quality: quality
|
|
2416
|
-
};
|
|
2417
|
-
packer.packing(pixelMap, packingOptionsOHOS).then((value) => {
|
|
2418
|
-
fs.closeSync(file);
|
|
2419
|
-
saveImage(value, srcAfterCompress).then(result => {
|
|
2420
|
-
callAsyncSuccess(resolve, { tempFilePath: result.imageUri }, options);
|
|
2421
|
-
});
|
|
2422
|
-
}).catch((error) => {
|
|
2423
|
-
fs.closeSync(file);
|
|
2424
|
-
callAsyncFail(reject, error, options);
|
|
2389
|
+
const isPNG = src.endsWith('.png');
|
|
2390
|
+
const packingOptionsOHOS = {
|
|
2391
|
+
format: isPNG ? 'image/png' : 'image/jpeg',
|
|
2392
|
+
quality: quality
|
|
2393
|
+
};
|
|
2394
|
+
packer.packing(pixelMap, packingOptionsOHOS).then((value) => {
|
|
2395
|
+
fs.closeSync(file);
|
|
2396
|
+
saveImage(value, srcAfterCompress).then(result => {
|
|
2397
|
+
callAsyncSuccess(resolve, { tempFilePath: result.imageUri }, options);
|
|
2425
2398
|
});
|
|
2426
|
-
}
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2399
|
+
}).catch((error) => {
|
|
2400
|
+
fs.closeSync(file);
|
|
2401
|
+
callAsyncFail(reject, error, options);
|
|
2402
|
+
});
|
|
2403
|
+
}
|
|
2431
2404
|
});
|
|
2432
2405
|
});
|
|
2433
2406
|
};
|
|
2434
2407
|
const chooseImage = function (options) {
|
|
2435
2408
|
return new Promise((resolve, reject) => {
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2409
|
+
try {
|
|
2410
|
+
validateParams('chooseImage', options, chooseImageSchema);
|
|
2411
|
+
}
|
|
2412
|
+
catch (error) {
|
|
2413
|
+
const res = { errMsg: error.message };
|
|
2414
|
+
return callAsyncFail(reject, res, options);
|
|
2415
|
+
}
|
|
2416
|
+
const { count = 9 } = options;
|
|
2417
|
+
const photoViewPicker = new picker.PhotoViewPicker();
|
|
2418
|
+
let sizeType = options.sizeType;
|
|
2419
|
+
if (!sizeType || !sizeType.length) {
|
|
2420
|
+
sizeType = ['compressed', 'original'];
|
|
2421
|
+
}
|
|
2422
|
+
photoSelectOptions.maxSelectNumber = count; // 选择媒体文件的最大数目
|
|
2423
|
+
photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; // 过滤选择媒体文件类型为IMAGE
|
|
2424
|
+
photoViewPicker.select(photoSelectOptions).then((photoSelectResult) => {
|
|
2425
|
+
const result = {};
|
|
2426
|
+
const isOrigin = photoSelectResult.isOriginalPhoto;
|
|
2427
|
+
if (isOrigin) {
|
|
2428
|
+
const tempFilePaths = [];
|
|
2429
|
+
const tempFiles = photoSelectResult.photoUris.map(uri => {
|
|
2430
|
+
const file = fs.openSync(uri, fs.OpenMode.READ_ONLY);
|
|
2431
|
+
const stat = fs.statSync(file.fd);
|
|
2432
|
+
const size = stat.size;
|
|
2433
|
+
fs.closeSync(file);
|
|
2434
|
+
tempFilePaths.push(uri);
|
|
2435
|
+
return {
|
|
2436
|
+
size,
|
|
2437
|
+
path: uri,
|
|
2438
|
+
};
|
|
2439
|
+
});
|
|
2440
|
+
result.tempFiles = tempFiles;
|
|
2441
|
+
result.tempFilePaths = tempFilePaths;
|
|
2442
|
+
callAsyncSuccess(resolve, result, options);
|
|
2449
2443
|
}
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2444
|
+
else {
|
|
2445
|
+
const actions = photoSelectResult.photoUris.map(uri => {
|
|
2446
|
+
return new Promise(resolve => {
|
|
2447
|
+
compressImage({
|
|
2448
|
+
src: uri,
|
|
2449
|
+
compressedWidth: getSystemInfoSync().screenWidth / 2,
|
|
2450
|
+
compressedHeight: getSystemInfoSync().screenHeight / 2,
|
|
2451
|
+
success: (compressResult) => {
|
|
2452
|
+
resolve(compressResult.tempFilePath);
|
|
2453
|
+
}
|
|
2454
|
+
});
|
|
2455
|
+
});
|
|
2456
|
+
});
|
|
2457
|
+
Promise.all(actions).then(tempFilePaths => {
|
|
2458
|
+
const tempFiles = tempFilePaths.map(uri => {
|
|
2458
2459
|
const file = fs.openSync(uri, fs.OpenMode.READ_ONLY);
|
|
2459
2460
|
const stat = fs.statSync(file.fd);
|
|
2460
2461
|
const size = stat.size;
|
|
2461
2462
|
fs.closeSync(file);
|
|
2462
|
-
tempFilePaths.push(uri);
|
|
2463
2463
|
return {
|
|
2464
2464
|
size,
|
|
2465
2465
|
path: uri,
|
|
2466
2466
|
};
|
|
2467
2467
|
});
|
|
2468
|
-
result.tempFiles = tempFiles;
|
|
2469
2468
|
result.tempFilePaths = tempFilePaths;
|
|
2469
|
+
result.tempFiles = tempFiles;
|
|
2470
2470
|
callAsyncSuccess(resolve, result, options);
|
|
2471
|
-
}
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
compressedHeight: getSystemInfoSync().screenHeight / 2,
|
|
2479
|
-
success: (compressResult) => {
|
|
2480
|
-
resolve(compressResult.tempFilePath);
|
|
2481
|
-
}
|
|
2482
|
-
});
|
|
2483
|
-
});
|
|
2484
|
-
});
|
|
2485
|
-
Promise.all(actions).then(tempFilePaths => {
|
|
2486
|
-
const tempFiles = tempFilePaths.map(uri => {
|
|
2487
|
-
const file = fs.openSync(uri, fs.OpenMode.READ_ONLY);
|
|
2488
|
-
const stat = fs.statSync(file.fd);
|
|
2489
|
-
const size = stat.size;
|
|
2490
|
-
fs.closeSync(file);
|
|
2491
|
-
return {
|
|
2492
|
-
size,
|
|
2493
|
-
path: uri,
|
|
2494
|
-
};
|
|
2495
|
-
});
|
|
2496
|
-
result.tempFilePaths = tempFilePaths;
|
|
2497
|
-
result.tempFiles = tempFiles;
|
|
2498
|
-
callAsyncSuccess(resolve, result, options);
|
|
2499
|
-
}).catch(error => {
|
|
2500
|
-
const res = { errMsg: error };
|
|
2501
|
-
return callAsyncFail(reject, res, options);
|
|
2502
|
-
});
|
|
2503
|
-
}
|
|
2504
|
-
}).catch((error) => {
|
|
2505
|
-
callAsyncFail(reject, error, options);
|
|
2506
|
-
});
|
|
2507
|
-
}, (error) => {
|
|
2508
|
-
const res = { errMsg: error };
|
|
2509
|
-
return callAsyncFail(reject, res, options);
|
|
2471
|
+
}).catch(error => {
|
|
2472
|
+
const res = { errMsg: error };
|
|
2473
|
+
return callAsyncFail(reject, res, options);
|
|
2474
|
+
});
|
|
2475
|
+
}
|
|
2476
|
+
}).catch((error) => {
|
|
2477
|
+
callAsyncFail(reject, error, options);
|
|
2510
2478
|
});
|
|
2511
2479
|
});
|
|
2512
2480
|
};
|
|
@@ -3347,7 +3315,7 @@ const switchTab = (options) => {
|
|
|
3347
3315
|
}
|
|
3348
3316
|
if (((_a = stack[stack.length - 1]) === null || _a === void 0 ? void 0 : _a.path) === url) {
|
|
3349
3317
|
// Note: 当前为 Tab 页时,触发 switch 事件
|
|
3350
|
-
eventCenter
|
|
3318
|
+
eventCenter.trigger('__taroSwitchTab', { url, params });
|
|
3351
3319
|
router.getLength() > 1 && router.clear();
|
|
3352
3320
|
}
|
|
3353
3321
|
else if (stack.some(item => item.path === url)) {
|
|
@@ -3772,7 +3740,7 @@ function setBackgroundColor(options) {
|
|
|
3772
3740
|
const { success, fail, complete } = options || {};
|
|
3773
3741
|
const handle = new MethodHandler({ name: 'setBackgroundColor', success, fail, complete });
|
|
3774
3742
|
return new Promise((resolve, reject) => {
|
|
3775
|
-
eventCenter
|
|
3743
|
+
eventCenter.trigger('__taroPageStyle', {
|
|
3776
3744
|
backgroundColor: options.backgroundColorBottom || options.backgroundColor,
|
|
3777
3745
|
backgroundColorContext: options.backgroundColorTop || options.backgroundColor
|
|
3778
3746
|
});
|
|
@@ -3919,7 +3887,7 @@ const setNavigationBarTitle = function (options) {
|
|
|
3919
3887
|
const { success, fail, complete } = options || {};
|
|
3920
3888
|
const handle = new MethodHandler({ name: 'setNavigationBarTitle', success, fail, complete });
|
|
3921
3889
|
return new Promise((resolve, reject) => {
|
|
3922
|
-
eventCenter
|
|
3890
|
+
eventCenter.trigger('__taroNavigationStyle', {
|
|
3923
3891
|
title: options.title,
|
|
3924
3892
|
});
|
|
3925
3893
|
return handle.success({}, { resolve, reject });
|
|
@@ -3929,7 +3897,7 @@ const setNavigationBarColor = function (options) {
|
|
|
3929
3897
|
const { success, fail, complete } = options || {};
|
|
3930
3898
|
const handle = new MethodHandler({ name: 'setNavigationBarColor', success, fail, complete });
|
|
3931
3899
|
return new Promise((resolve, reject) => {
|
|
3932
|
-
eventCenter
|
|
3900
|
+
eventCenter.trigger('__taroNavigationStyle', {
|
|
3933
3901
|
animation: options.animation,
|
|
3934
3902
|
backgroundColor: options.backgroundColor,
|
|
3935
3903
|
frontColor: options.frontColor,
|
|
@@ -3941,7 +3909,7 @@ const showNavigationBarLoading = function (options) {
|
|
|
3941
3909
|
const { success, fail, complete } = options || {};
|
|
3942
3910
|
const handle = new MethodHandler({ name: 'showNavigationBarLoading', success, fail, complete });
|
|
3943
3911
|
return new Promise((resolve, reject) => {
|
|
3944
|
-
eventCenter
|
|
3912
|
+
eventCenter.trigger('__taroNavigationStyle', {
|
|
3945
3913
|
loading: true,
|
|
3946
3914
|
});
|
|
3947
3915
|
return handle.success({}, { resolve, reject });
|
|
@@ -3951,7 +3919,7 @@ const hideNavigationBarLoading = function (options) {
|
|
|
3951
3919
|
const { success, fail, complete } = options || {};
|
|
3952
3920
|
const handle = new MethodHandler({ name: 'hideNavigationBarLoading', success, fail, complete });
|
|
3953
3921
|
return new Promise((resolve, reject) => {
|
|
3954
|
-
eventCenter
|
|
3922
|
+
eventCenter.trigger('__taroNavigationStyle', {
|
|
3955
3923
|
loading: false,
|
|
3956
3924
|
});
|
|
3957
3925
|
return handle.success({}, { resolve, reject });
|
|
@@ -3961,7 +3929,7 @@ const hideHomeButton = function (options) {
|
|
|
3961
3929
|
const { success, fail, complete } = options || {};
|
|
3962
3930
|
const handle = new MethodHandler({ name: 'hideHomeButton', success, fail, complete });
|
|
3963
3931
|
return new Promise((resolve, reject) => {
|
|
3964
|
-
eventCenter
|
|
3932
|
+
eventCenter.trigger('__taroNavigationStyle', {
|
|
3965
3933
|
home: false,
|
|
3966
3934
|
});
|
|
3967
3935
|
return handle.success({}, { resolve, reject });
|
|
@@ -4100,7 +4068,7 @@ const toggleTabBar = function (type) {
|
|
|
4100
4068
|
else {
|
|
4101
4069
|
const isShow = type === 'show';
|
|
4102
4070
|
const event = isShow ? '__taroShowTabBar' : '__taroHideTabBar';
|
|
4103
|
-
eventCenter
|
|
4071
|
+
eventCenter.trigger(event, {
|
|
4104
4072
|
animation: options === null || options === void 0 ? void 0 : options.animation,
|
|
4105
4073
|
});
|
|
4106
4074
|
(_b = page.$set) === null || _b === void 0 ? void 0 : _b.call(page, 'isShowTaroTabBar', isShow);
|
|
@@ -4132,7 +4100,7 @@ const setTabBarStyle = function (options = {}) {
|
|
|
4132
4100
|
data.backgroundColor = options.backgroundColor;
|
|
4133
4101
|
if (options.borderStyle)
|
|
4134
4102
|
data.borderStyle = options.borderStyle;
|
|
4135
|
-
eventCenter
|
|
4103
|
+
eventCenter.trigger('__taroSetTabBarStyle', options);
|
|
4136
4104
|
(_b = page.$set) === null || _b === void 0 ? void 0 : _b.call(page, 'taroTabBar', data);
|
|
4137
4105
|
callAsyncSuccess(resolve, res, options);
|
|
4138
4106
|
}
|
|
@@ -4164,7 +4132,7 @@ const setTabBarItem = function (options) {
|
|
|
4164
4132
|
...currentData.list.slice(index + 1)
|
|
4165
4133
|
];
|
|
4166
4134
|
const data = Object.assign({}, currentData, { list });
|
|
4167
|
-
eventCenter
|
|
4135
|
+
eventCenter.trigger('__taroSetTabBarItem', options);
|
|
4168
4136
|
(_b = page.$set) === null || _b === void 0 ? void 0 : _b.call(page, 'taroTabBar', data);
|
|
4169
4137
|
callAsyncSuccess(resolve, res, options);
|
|
4170
4138
|
}
|
|
@@ -4173,7 +4141,7 @@ const setTabBarItem = function (options) {
|
|
|
4173
4141
|
function showTabBarRedDot(options) {
|
|
4174
4142
|
const res = { errMsg: 'showTabBarRedDot:ok' };
|
|
4175
4143
|
return new Promise((resolve) => {
|
|
4176
|
-
eventCenter
|
|
4144
|
+
eventCenter.trigger('__taroShowTabBarRedDotHandler', {
|
|
4177
4145
|
index: (options === null || options === void 0 ? void 0 : options.index) || 0,
|
|
4178
4146
|
});
|
|
4179
4147
|
callAsyncSuccess(resolve, res, options);
|
|
@@ -4182,7 +4150,7 @@ function showTabBarRedDot(options) {
|
|
|
4182
4150
|
function hideTabBarRedDot(options) {
|
|
4183
4151
|
const res = { errMsg: 'hideTabBarRedDot:ok' };
|
|
4184
4152
|
return new Promise((resolve) => {
|
|
4185
|
-
eventCenter
|
|
4153
|
+
eventCenter.trigger('__taroHideTabBarRedDotHandler', {
|
|
4186
4154
|
index: (options === null || options === void 0 ? void 0 : options.index) || 0,
|
|
4187
4155
|
});
|
|
4188
4156
|
callAsyncSuccess(resolve, res, options);
|
|
@@ -4192,7 +4160,7 @@ function setTabBarBadge(options) {
|
|
|
4192
4160
|
const res = { errMsg: 'setTabBarBadge:ok' };
|
|
4193
4161
|
return new Promise((resolve) => {
|
|
4194
4162
|
const text = (options === null || options === void 0 ? void 0 : options.text) || '';
|
|
4195
|
-
eventCenter
|
|
4163
|
+
eventCenter.trigger('__taroSetTabBarBadge', {
|
|
4196
4164
|
index: (options === null || options === void 0 ? void 0 : options.index) || 0,
|
|
4197
4165
|
text: text.replace(/[\u0391-\uFFE5]/g, 'aa').length > 4 ? '...' : text,
|
|
4198
4166
|
});
|
|
@@ -4202,7 +4170,7 @@ function setTabBarBadge(options) {
|
|
|
4202
4170
|
function removeTabBarBadge(options) {
|
|
4203
4171
|
const res = { errMsg: 'removeTabBarBadge:ok' };
|
|
4204
4172
|
return new Promise((resolve) => {
|
|
4205
|
-
eventCenter
|
|
4173
|
+
eventCenter.trigger('__taroRemoveTabBarBadge', {
|
|
4206
4174
|
index: (options === null || options === void 0 ? void 0 : options.index) || 0,
|
|
4207
4175
|
});
|
|
4208
4176
|
callAsyncSuccess(resolve, res, options);
|
|
@@ -4698,7 +4666,7 @@ var apis = /*#__PURE__*/Object.freeze({
|
|
|
4698
4666
|
disableAlertBeforeUnload: disableAlertBeforeUnload,
|
|
4699
4667
|
downloadFile: downloadFile,
|
|
4700
4668
|
enableAlertBeforeUnload: enableAlertBeforeUnload,
|
|
4701
|
-
eventCenter: eventCenter
|
|
4669
|
+
eventCenter: eventCenter,
|
|
4702
4670
|
exitMiniProgram: exitMiniProgram,
|
|
4703
4671
|
exitVoIPChat: exitVoIPChat,
|
|
4704
4672
|
faceVerifyForPay: faceVerifyForPay,
|