@tarojs/plugin-platform-harmony-ets 4.0.0-beta.0 → 4.0.0-beta.10
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/memory.ts +10 -3
- package/dist/apis/index.ts +2 -0
- package/dist/apis/media/video/VideoContext.ts +56 -7
- package/dist/apis/media/video/index.ts +3 -2
- package/dist/apis/network/request.ts +5 -5
- package/dist/apis/route/index.ts +15 -0
- package/dist/apis/storage/index.ts +124 -60
- package/dist/apis/wxml/index.ts +2 -0
- package/dist/components-harmony-ets/button.ets +26 -40
- package/dist/components-harmony-ets/checkbox.ets +70 -99
- package/dist/components-harmony-ets/form.ets +29 -42
- package/dist/components-harmony-ets/icon.ets +6 -34
- package/dist/components-harmony-ets/image.ets +2 -32
- package/dist/components-harmony-ets/innerHtml.ets +2 -2
- package/dist/components-harmony-ets/input.ets +7 -27
- package/dist/components-harmony-ets/label.ets +40 -47
- package/dist/components-harmony-ets/picker.ets +66 -73
- package/dist/components-harmony-ets/radio.ets +72 -101
- package/dist/components-harmony-ets/richText.ets +4 -36
- package/dist/components-harmony-ets/scrollView.ets +34 -74
- package/dist/components-harmony-ets/slider.ets +9 -34
- package/dist/components-harmony-ets/style.ets +154 -0
- package/dist/components-harmony-ets/swiper.ets +4 -34
- package/dist/components-harmony-ets/switch.ets +43 -56
- package/dist/components-harmony-ets/text.ets +7 -34
- package/dist/components-harmony-ets/textArea.ets +8 -28
- package/dist/components-harmony-ets/utils/DynamicCenter.ts +2 -11
- package/dist/components-harmony-ets/utils/flexManager.ets +45 -7
- package/dist/components-harmony-ets/utils/helper.ets +2 -2
- package/dist/components-harmony-ets/utils/styles.ets +58 -20
- package/dist/components-harmony-ets/video.ets +4 -34
- package/dist/components-harmony-ets/view.ets +25 -67
- package/dist/components-harmony-ets/webView.ets +50 -0
- package/dist/index.js +103 -5
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/bom/window.ts +2 -2
- package/dist/runtime-ets/dom/cssStyleDeclaration.ts +30 -6
- package/dist/runtime-ets/dom/document.ts +21 -4
- package/dist/runtime-ets/dom/element/element.ts +1 -0
- package/dist/runtime-ets/dom/element/form.ts +11 -2
- package/dist/runtime-ets/dom/element/index.ts +4 -1
- package/dist/runtime-ets/dom/element/normal.ts +1 -0
- package/dist/runtime-ets/dom/element/webView.ts +61 -0
- package/dist/runtime-ets/dom/node.ts +29 -16
- package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +624 -0
- package/dist/runtime-ets/dom/stylesheet/index.ts +216 -354
- package/dist/runtime-ets/dom/stylesheet/type.ts +46 -11
- package/dist/runtime-ets/dom/stylesheet/util.ts +58 -6
- package/dist/runtime-ets/index.ts +1 -2
- package/dist/runtime-ets/interface/event.ts +2 -1
- package/dist/runtime-ets/utils/index.ts +6 -1
- package/dist/runtime-ets/utils/info.ts +3 -1
- package/dist/runtime-framework/react/app.ts +12 -22
- package/dist/runtime-framework/react/hooks.ts +3 -3
- package/dist/runtime-framework/react/index.ts +1 -0
- package/dist/runtime-framework/react/native-page.ts +344 -0
- package/dist/runtime-framework/react/page.ts +2 -2
- package/dist/runtime-framework/solid/hooks.ts +3 -3
- package/dist/runtime-utils.js +181 -80
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +181 -80
- package/dist/runtime.js.map +1 -1
- package/package.json +12 -11
- package/static/media/cancel.svg +1 -0
- package/static/media/circle.svg +1 -0
- package/static/media/clear.svg +1 -0
- package/static/media/download.svg +1 -0
- package/static/media/info.svg +1 -0
- package/static/media/info_circle.svg +1 -0
- package/static/media/search.svg +1 -0
- package/static/media/success.svg +1 -0
- package/static/media/success_no_circle.svg +1 -0
- package/static/media/taro_arrow_left.svg +1 -0
- package/static/media/taro_home.svg +1 -0
- package/static/media/waiting.svg +1 -0
- package/static/media/warn.svg +1 -0
- package/types/runtime.d.ts +2 -0
- package/dist/runtime-ets/utils/bind.ts +0 -24
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import business_error from '@ohos.base'
|
|
2
|
+
import web_webview from '@ohos.web.webview'
|
|
3
|
+
|
|
4
|
+
import { TaroElement } from './element'
|
|
5
|
+
|
|
6
|
+
import type { WebViewProps } from '@tarojs/components/types'
|
|
7
|
+
|
|
8
|
+
export class TaroWebViewElement extends TaroElement<WebViewProps>{
|
|
9
|
+
ports: web_webview.WebMessagePort[] = []
|
|
10
|
+
|
|
11
|
+
nativePort: web_webview.WebMessagePort | null = null
|
|
12
|
+
|
|
13
|
+
message: web_webview.WebMessageExt = new web_webview.WebMessageExt()
|
|
14
|
+
|
|
15
|
+
controller: web_webview.WebviewController = new web_webview.WebviewController()
|
|
16
|
+
|
|
17
|
+
constructor() {
|
|
18
|
+
super('WebView')
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
postMessage (value: string) {
|
|
22
|
+
if (!this.nativePort) return
|
|
23
|
+
|
|
24
|
+
this.message.setString(value)
|
|
25
|
+
this.nativePort.postMessageEventExt(this.message)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
handleMessageFromWeb (result: web_webview.WebMessageExt) {
|
|
29
|
+
try {
|
|
30
|
+
const type = result.getType()
|
|
31
|
+
switch (type) {
|
|
32
|
+
case web_webview.WebMessageType.STRING: {
|
|
33
|
+
return result.getString()
|
|
34
|
+
}
|
|
35
|
+
case web_webview.WebMessageType.NUMBER: {
|
|
36
|
+
return result.getNumber()
|
|
37
|
+
}
|
|
38
|
+
case web_webview.WebMessageType.BOOLEAN: {
|
|
39
|
+
return result.getBoolean()
|
|
40
|
+
}
|
|
41
|
+
case web_webview.WebMessageType.ARRAY_BUFFER: {
|
|
42
|
+
return result.getArrayBuffer()
|
|
43
|
+
}
|
|
44
|
+
case web_webview.WebMessageType.ARRAY: {
|
|
45
|
+
return result.getArray()
|
|
46
|
+
}
|
|
47
|
+
case web_webview.WebMessageType.ERROR: {
|
|
48
|
+
return result.getError()
|
|
49
|
+
}
|
|
50
|
+
default: {
|
|
51
|
+
return null
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
const e: business_error.BusinessError = error as business_error.BusinessError
|
|
57
|
+
|
|
58
|
+
console.error(`ErrorCode: ${e.code}, Message: ${e.message}`)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -31,16 +31,18 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
31
31
|
public childNodes: TaroNode[] = []
|
|
32
32
|
public parentNode: TaroNode | null = null
|
|
33
33
|
public _nid: string = genId()
|
|
34
|
-
|
|
35
34
|
public _doc: TaroDocument | null = null
|
|
35
|
+
|
|
36
|
+
private _textContent = ''
|
|
37
|
+
|
|
38
|
+
// 以下属性为半编译模式下才会赋值和使用的属性
|
|
39
|
+
// 半编译节点更新触发器
|
|
40
|
+
public _updateTrigger = 0
|
|
36
41
|
// 是否为半编译模板下的节点
|
|
37
42
|
public _isCompileMode = false
|
|
38
43
|
// 是否为半编译模板下拥有自主更新权的节点
|
|
39
44
|
public _isDynamicNode = false
|
|
40
45
|
|
|
41
|
-
public _updateTrigger = 0
|
|
42
|
-
private _textContent = ''
|
|
43
|
-
|
|
44
46
|
constructor(nodeName: string, nodeType = NodeType.ELEMENT_NODE) {
|
|
45
47
|
super()
|
|
46
48
|
|
|
@@ -63,15 +65,25 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
63
65
|
|
|
64
66
|
// 更新对应的 ArkUI 组件
|
|
65
67
|
public updateComponent () {
|
|
66
|
-
if (!this.parentNode || !this.parentNode.listeners?.length) return
|
|
68
|
+
if (!this._isCompileMode && (!this.parentNode || !this.parentNode.listeners?.length)) return
|
|
67
69
|
|
|
68
70
|
const idx = this.parentNode.findIndex(this)
|
|
69
|
-
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
this.
|
|
71
|
+
|
|
72
|
+
if (this._isCompileMode) {
|
|
73
|
+
// 半编译模式下走 @State 的更新模式
|
|
74
|
+
if (this._isDynamicNode) {
|
|
75
|
+
this._updateTrigger++
|
|
76
|
+
} else {
|
|
77
|
+
this.parentNode.updateComponent()
|
|
78
|
+
}
|
|
73
79
|
} else {
|
|
74
|
-
|
|
80
|
+
// 非半编译模式下走 LazyForEach 的更新模式
|
|
81
|
+
if (idx >= 0) {
|
|
82
|
+
this._updateTrigger++
|
|
83
|
+
this.parentNode.notifyDataChange(idx)
|
|
84
|
+
} else {
|
|
85
|
+
this.parentNode.notifyDataReload()
|
|
86
|
+
}
|
|
75
87
|
}
|
|
76
88
|
}
|
|
77
89
|
|
|
@@ -232,14 +244,15 @@ export class TaroTextNode extends TaroNode {
|
|
|
232
244
|
}
|
|
233
245
|
}
|
|
234
246
|
|
|
235
|
-
function checkIsCompileModeAndInstallAfterDOMAction (
|
|
236
|
-
|
|
247
|
+
function checkIsCompileModeAndInstallAfterDOMAction (node: TaroNode, parentNode: TaroNode) {
|
|
248
|
+
if (!parentNode._isCompileMode || !parentNode._instance) return
|
|
237
249
|
|
|
238
|
-
|
|
250
|
+
parentNode._instance.dynamicCenter?.install?.(node, parentNode)
|
|
251
|
+
node.updateComponent()
|
|
239
252
|
}
|
|
240
253
|
|
|
241
|
-
function checkIsCompileModeAndUninstallAfterDOMAction (
|
|
242
|
-
|
|
254
|
+
function checkIsCompileModeAndUninstallAfterDOMAction (node: TaroNode) {
|
|
255
|
+
if (!node._isCompileMode || !parentNode._instance) return
|
|
243
256
|
|
|
244
|
-
|
|
257
|
+
node._instance.dynamicCenter?.uninstall?.(node)
|
|
245
258
|
}
|