@tarojs/plugin-platform-harmony-ets 4.0.0-beta.10 → 4.0.0-beta.12
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/system.ts +40 -22
- package/dist/components-harmony-ets/button.ets +34 -31
- package/dist/components-harmony-ets/checkbox.ets +5 -4
- package/dist/components-harmony-ets/form.ets +31 -28
- package/dist/components-harmony-ets/icon.ets +22 -18
- package/dist/components-harmony-ets/image.ets +15 -11
- package/dist/components-harmony-ets/innerHtml.ets +9 -5
- package/dist/components-harmony-ets/input.ets +1 -1
- package/dist/components-harmony-ets/label.ets +44 -40
- package/dist/components-harmony-ets/movableArea.ets +67 -0
- package/dist/components-harmony-ets/movableView.ets +66 -0
- package/dist/components-harmony-ets/picker.ets +7 -6
- package/dist/components-harmony-ets/progress.ets +45 -0
- package/dist/components-harmony-ets/radio.ets +5 -5
- package/dist/components-harmony-ets/richText.ets +14 -9
- package/dist/components-harmony-ets/scrollView.ets +40 -35
- package/dist/components-harmony-ets/slider.ets +1 -1
- package/dist/components-harmony-ets/swiper.ets +23 -19
- package/dist/components-harmony-ets/switch.ets +1 -1
- package/dist/components-harmony-ets/text.ets +28 -22
- package/dist/components-harmony-ets/textArea.ets +1 -1
- package/dist/components-harmony-ets/utils/styles.ets +2 -2
- package/dist/components-harmony-ets/video.ets +26 -21
- package/dist/components-harmony-ets/view.ets +34 -30
- package/dist/components-harmony-ets/webView.ets +37 -32
- package/dist/index.js +36 -16
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/dom/element/element.ts +0 -4
- package/dist/runtime-ets/dom/element/form.ts +11 -4
- package/dist/runtime-ets/dom/element/index.ts +9 -1
- package/dist/runtime-ets/dom/element/movableArea.ts +12 -0
- package/dist/runtime-ets/dom/element/movableView.ts +12 -0
- package/dist/runtime-ets/dom/element/normal.ts +8 -2
- package/dist/runtime-ets/dom/element/progress.ts +13 -0
- package/dist/runtime-ets/dom/element/scrollView.ts +1 -0
- package/dist/runtime-ets/dom/element/text.ts +1 -0
- package/dist/runtime-ets/dom/element/video.ts +1 -0
- package/dist/runtime-ets/dom/element/webView.ts +8 -0
- package/dist/runtime-ets/dom/node.ts +18 -17
- package/dist/runtime-utils.js +43 -21
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +43 -21
- package/dist/runtime.js.map +1 -1
- package/package.json +8 -8
|
@@ -12,43 +12,48 @@ import type {
|
|
|
12
12
|
ViewProps
|
|
13
13
|
} from '@tarojs/components/types'
|
|
14
14
|
|
|
15
|
+
@Observed
|
|
15
16
|
class TaroViewElement extends TaroElement<ViewProps> {
|
|
16
17
|
constructor() {
|
|
17
18
|
super('View')
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
@Observed
|
|
21
23
|
class TaroImageElement extends TaroElement<ImageProps> {
|
|
22
24
|
constructor() {
|
|
23
25
|
super('Image')
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
28
|
|
|
29
|
+
@Observed
|
|
27
30
|
class TaroButtonElement extends TaroElement<ButtonProps> {
|
|
28
31
|
constructor() {
|
|
29
32
|
super('Button')
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
@Observed
|
|
34
37
|
class TaroIconElement extends TaroElement<IconProps>{
|
|
35
38
|
constructor() {
|
|
36
39
|
super('Icon')
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
|
-
|
|
42
|
+
@Observed
|
|
40
43
|
class TaroLabelElement extends TaroElement<LabelProps>{
|
|
41
44
|
constructor() {
|
|
42
45
|
super('Label')
|
|
43
46
|
}
|
|
44
47
|
}
|
|
45
48
|
|
|
49
|
+
@Observed
|
|
46
50
|
class TaroRichTextElement extends TaroElement<RichTextProps>{
|
|
47
51
|
constructor() {
|
|
48
52
|
super('RichText')
|
|
49
53
|
}
|
|
50
54
|
}
|
|
51
55
|
|
|
56
|
+
@Observed
|
|
52
57
|
class TaroSwiperElement extends TaroElement<SwiperProps>{
|
|
53
58
|
controller: SwiperController = new SwiperController()
|
|
54
59
|
|
|
@@ -57,6 +62,7 @@ class TaroSwiperElement extends TaroElement<SwiperProps>{
|
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
64
|
|
|
65
|
+
@Observed
|
|
60
66
|
class TaroSwiperItemElement extends TaroElement<SwiperItemProps>{
|
|
61
67
|
constructor() {
|
|
62
68
|
super('SwiperItem')
|
|
@@ -5,6 +5,14 @@ import { TaroElement } from './element'
|
|
|
5
5
|
|
|
6
6
|
import type { WebViewProps } from '@tarojs/components/types'
|
|
7
7
|
|
|
8
|
+
@Observed
|
|
9
|
+
export class TaroInnerHtmlElement extends TaroElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super('InnerHtml')
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@Observed
|
|
8
16
|
export class TaroWebViewElement extends TaroElement<WebViewProps>{
|
|
9
17
|
ports: web_webview.WebMessagePort[] = []
|
|
10
18
|
|
|
@@ -63,27 +63,27 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
63
63
|
return this.childNodes.findIndex(node => node._nid === refChild._nid)
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
public updateTextNode () {
|
|
67
|
+
// @ts-ignore
|
|
68
|
+
if (this.childNodes.length <= 0 || this.tagName !== 'VIEW') return
|
|
69
|
+
|
|
70
|
+
// TextNode 不具备 props 更新能力,需要由父节点来进行触发
|
|
71
|
+
this.childNodes.forEach(item => {
|
|
72
|
+
if (item.nodeType !== NodeType.TEXT_NODE) return
|
|
73
|
+
|
|
74
|
+
item._updateTrigger++
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
|
|
66
78
|
// 更新对应的 ArkUI 组件
|
|
67
79
|
public updateComponent () {
|
|
68
|
-
if (!this._isCompileMode
|
|
69
|
-
|
|
70
|
-
const idx = this.parentNode.findIndex(this)
|
|
80
|
+
if (!this._isCompileMode) return
|
|
71
81
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
this._updateTrigger++
|
|
76
|
-
} else {
|
|
77
|
-
this.parentNode.updateComponent()
|
|
78
|
-
}
|
|
82
|
+
// 半编译模式下走 @State 的更新模式
|
|
83
|
+
if (this._isDynamicNode) {
|
|
84
|
+
this._updateTrigger++
|
|
79
85
|
} else {
|
|
80
|
-
|
|
81
|
-
if (idx >= 0) {
|
|
82
|
-
this._updateTrigger++
|
|
83
|
-
this.parentNode.notifyDataChange(idx)
|
|
84
|
-
} else {
|
|
85
|
-
this.parentNode.notifyDataReload()
|
|
86
|
-
}
|
|
86
|
+
this.parentNode.updateComponent()
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -229,6 +229,7 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
+
@Observed
|
|
232
233
|
export class TaroTextNode extends TaroNode {
|
|
233
234
|
constructor(value = '', nodeName = '#text', nodeType: NodeType = NodeType.TEXT_NODE) {
|
|
234
235
|
super(nodeName, nodeType)
|
package/dist/runtime-utils.js
CHANGED
|
@@ -2,9 +2,9 @@ import { isFunction, isString, isArray, isObject, isNull, isNumber, isUndefined,
|
|
|
2
2
|
import _display from '@ohos.display';
|
|
3
3
|
import { Current, window, hooks, document as document$1, getPageScrollerOrNode, findChildNodeWithDFS, setNodeEventCallbackAndTriggerComponentUpdate, AREA_CHANGE_EVENT_NAME, disconnectEvent, VISIBLE_CHANGE_EVENT_NAME } from '@tarojs/runtime';
|
|
4
4
|
import { eventCenter, Events, History } from '@tarojs/runtime/dist/runtime.esm';
|
|
5
|
+
import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant';
|
|
5
6
|
import deviceInfo from '@ohos.deviceInfo';
|
|
6
7
|
import i18n from '@ohos.i18n';
|
|
7
|
-
import deviceMethod from '@system.device';
|
|
8
8
|
import errorManager from '@ohos.app.ability.errorManager';
|
|
9
9
|
import sensor from '@ohos.sensor';
|
|
10
10
|
import batteryInfo, { BatteryChargeState } from '@ohos.batteryInfo';
|
|
@@ -266,16 +266,37 @@ const preloadWebview = /* @__PURE__ */ temporarilyNotSupport('preloadWebview');
|
|
|
266
266
|
const preloadSkylineView = /* @__PURE__ */ temporarilyNotSupport('preloadSkylineView');
|
|
267
267
|
const preloadAssets = /* @__PURE__ */ temporarilyNotSupport('preloadAssets');
|
|
268
268
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
269
|
+
let display;
|
|
270
|
+
let safeArea = null;
|
|
271
|
+
try {
|
|
272
|
+
display = _display.getDefaultDisplaySync();
|
|
273
|
+
// @ts-ignore
|
|
274
|
+
display.getCutoutInfo((err, { boundingRects = [], waterfallDisplayAreaRects = {} } = {}) => {
|
|
275
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
276
|
+
if (err === null || err === void 0 ? void 0 : err.code) {
|
|
277
|
+
console.error('Failed to get cutout info', JSON.stringify(err));
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
const top = Math.max(...boundingRects.map(rect => rect.top * 2 + rect.height), ((_a = waterfallDisplayAreaRects.top) === null || _a === void 0 ? void 0 : _a.top) + ((_b = waterfallDisplayAreaRects.top) === null || _b === void 0 ? void 0 : _b.height));
|
|
281
|
+
const bottom = (((_c = waterfallDisplayAreaRects.bottom) === null || _c === void 0 ? void 0 : _c.top) + ((_d = waterfallDisplayAreaRects.bottom) === null || _d === void 0 ? void 0 : _d.height)) || display.height;
|
|
282
|
+
const left = ((_e = waterfallDisplayAreaRects.left) === null || _e === void 0 ? void 0 : _e.left) + ((_f = waterfallDisplayAreaRects.left) === null || _f === void 0 ? void 0 : _f.width);
|
|
283
|
+
const right = (((_g = waterfallDisplayAreaRects.right) === null || _g === void 0 ? void 0 : _g.left) + ((_h = waterfallDisplayAreaRects.right) === null || _h === void 0 ? void 0 : _h.width)) || display.width;
|
|
284
|
+
safeArea = {
|
|
285
|
+
top,
|
|
286
|
+
bottom,
|
|
287
|
+
left,
|
|
288
|
+
right,
|
|
289
|
+
height: bottom - top,
|
|
290
|
+
width: right - left,
|
|
291
|
+
};
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
catch (e) {
|
|
295
|
+
console.error('Failed to get display', e);
|
|
296
|
+
}
|
|
277
297
|
/* 同步版本 */
|
|
278
298
|
const getSystemInfoSync = function () {
|
|
299
|
+
var _a, _b;
|
|
279
300
|
const res = {};
|
|
280
301
|
res.SDKVersion = deviceInfo && deviceInfo.sdkApiVersion; // 客户端基础库版本 string
|
|
281
302
|
res.albumAuthorized = false; // 允许使用相册的开关(仅 iOS 有效) boolean
|
|
@@ -285,7 +306,7 @@ const getSystemInfoSync = function () {
|
|
|
285
306
|
res.cameraAuthorized = null; // 允许使用摄像头的开关 boolean
|
|
286
307
|
res.enableDebug = null; // 是否已打开调试 boolean
|
|
287
308
|
res.fontSizeSetting = null; // 用户字体大小(单位px) number
|
|
288
|
-
res.language = i18n
|
|
309
|
+
res.language = (_a = i18n === null || i18n === void 0 ? void 0 : i18n.getSystemLanguage) === null || _a === void 0 ? void 0 : _a.call(i18n); // string
|
|
289
310
|
res.locationAuthorized = null; // 定位的开关 boolean
|
|
290
311
|
res.locationEnabled = null; // 地理位置的系统开关 boolean
|
|
291
312
|
res.microphoneAuthorized = null; // 麦克风的开关 boolean
|
|
@@ -296,17 +317,18 @@ const getSystemInfoSync = function () {
|
|
|
296
317
|
res.notificationSoundAuthorized = false; // 通知带有声音的开关(仅 iOS 有效)boolean
|
|
297
318
|
res.phoneCalendarAuthorized = null; // 使用日历的开关 boolean
|
|
298
319
|
res.wifiEnabled = false; // Wi-Fi 的系统开关 boolean
|
|
299
|
-
res.pixelRatio =
|
|
300
|
-
res.platform = '
|
|
301
|
-
res.safeArea =
|
|
302
|
-
res.screenHeight = display
|
|
303
|
-
res.screenWidth = display
|
|
304
|
-
res.statusBarHeight = null; // 状态栏的高度,单位px number
|
|
305
|
-
res.system = deviceInfo
|
|
306
|
-
|
|
307
|
-
res.
|
|
308
|
-
res.windowHeight =
|
|
309
|
-
res.
|
|
320
|
+
res.pixelRatio = display && (Math.round(display.xDPI / display.width * 100) / 100); // 设备像素比,number
|
|
321
|
+
res.platform = 'harmony'; // 客户端平台 string
|
|
322
|
+
res.safeArea = safeArea; // 在竖屏正方向下的安全区域 General.SafeAreaResult
|
|
323
|
+
res.screenHeight = display === null || display === void 0 ? void 0 : display.height; // 屏幕高度,单位px number
|
|
324
|
+
res.screenWidth = display === null || display === void 0 ? void 0 : display.width; // 屏幕宽度,单位px number
|
|
325
|
+
res.statusBarHeight = safeArea === null || safeArea === void 0 ? void 0 : safeArea.top; // 状态栏的高度,单位px number
|
|
326
|
+
res.system = deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.osFullName; // 操作系统及版本 string
|
|
327
|
+
// Note: 更新配置时才能记录
|
|
328
|
+
res.theme = ((_b = AppStorage.get('__TARO_APP_CONFIG')) === null || _b === void 0 ? void 0 : _b.colorMode) === ConfigurationConstant.ColorMode.COLOR_MODE_DARK ? 'dark' : 'light'; // 系统当前主题,取值为light或dark 'light' | 'dark'
|
|
329
|
+
res.windowHeight = display === null || display === void 0 ? void 0 : display.height; // 可使用窗口高度,单位px number
|
|
330
|
+
res.windowWidth = display === null || display === void 0 ? void 0 : display.width; // 可使用窗口宽度,单位px number
|
|
331
|
+
res.version = deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.displayVersion; // 版本号 string
|
|
310
332
|
return res;
|
|
311
333
|
};
|
|
312
334
|
/* 异步版本 */
|