@tarojs/plugin-platform-harmony-ets 4.0.0-beta.96 → 4.0.0-beta.98
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/components-harmony-ets/input.ets +1 -1
- package/dist/components-harmony-ets/label.ets +3 -3
- package/dist/components-harmony-ets/navigationBar.ets +1 -1
- package/dist/components-harmony-ets/pageMeta.ets +4 -4
- package/dist/components-harmony-ets/radio.ets +3 -3
- package/dist/components-harmony-ets/textArea.ets +1 -1
- package/dist/components-harmony-ets/utils/styles.ets +1 -1
- package/dist/runtime-ets/current.ts +2 -1
- package/dist/runtime-ets/dom/node.ts +3 -3
- package/dist/runtime-framework/react/app.ts +4 -4
- package/dist/runtime-framework/react/native-page.ts +1 -1
- package/dist/runtime-framework/react/page.ts +1 -1
- package/dist/runtime-framework/react/utils/index.ts +3 -3
- package/dist/runtime-framework/solid/app.ts +1 -1
- package/dist/runtime-framework/solid/page.ts +1 -1
- package/dist/runtime-framework/solid/utils/index.ts +3 -3
- package/package.json +9 -9
|
@@ -72,7 +72,7 @@ export default struct TaroInput {
|
|
|
72
72
|
|
|
73
73
|
build () {
|
|
74
74
|
TextInput({ text: this.value, placeholder: this.node._attrs?.placeholder || '', controller: this.node.controller })
|
|
75
|
-
.key(this.node._nid)
|
|
75
|
+
.key(this.node._nid.toString())
|
|
76
76
|
.type(getInputType(this.node))
|
|
77
77
|
.maxLength(Number(this.node._attrs?.maxlength) || null)
|
|
78
78
|
.placeholderColor(getPlaceholderColor(this.node))
|
|
@@ -56,7 +56,7 @@ export default struct TaroLabel {
|
|
|
56
56
|
.attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
57
57
|
.onClick((e: ClickEvent) => {
|
|
58
58
|
const firstChild: TaroElement | null = this.node.childNodes[0] as TaroElement | null
|
|
59
|
-
const id: string = this.node._attrs.for || firstChild?._attrs.id || firstChild?._nid || ''
|
|
59
|
+
const id: string = this.node._attrs.for || firstChild?._attrs.id || firstChild?._nid.toString() || ''
|
|
60
60
|
|
|
61
61
|
handleTargetChange(id)
|
|
62
62
|
eventHandler(e, 'click', this.node)
|
|
@@ -73,7 +73,7 @@ export default struct TaroLabel {
|
|
|
73
73
|
.attributeModifier(rowModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
74
74
|
.onClick((e: ClickEvent) => {
|
|
75
75
|
const firstChild: TaroElement | null = this.node.childNodes[0] as TaroElement | null
|
|
76
|
-
const id: string = this.node._attrs.for || firstChild?._attrs.id || firstChild?._nid || ''
|
|
76
|
+
const id: string = this.node._attrs.for || firstChild?._attrs.id || firstChild?._nid.toString() || ''
|
|
77
77
|
|
|
78
78
|
handleTargetChange(id)
|
|
79
79
|
eventHandler(e, 'click', this.node)
|
|
@@ -90,7 +90,7 @@ export default struct TaroLabel {
|
|
|
90
90
|
.attributeModifier(columnModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
91
91
|
.onClick((e: ClickEvent) => {
|
|
92
92
|
const firstChild: TaroElement | null = this.node.childNodes[0] as TaroElement | null
|
|
93
|
-
const id: string = this.node._attrs.for || firstChild?._attrs.id || firstChild?._nid || ''
|
|
93
|
+
const id: string = this.node._attrs.for || firstChild?._attrs.id || firstChild?._nid.toString() || ''
|
|
94
94
|
|
|
95
95
|
handleTargetChange(id)
|
|
96
96
|
eventHandler(e, 'click', this.node)
|
|
@@ -29,7 +29,7 @@ export default struct TaroNavigationBar {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
handleAttributeUpdate = (opt: IComponentAttributeUpdateEvents) => {
|
|
32
|
-
if (opt.id === this.node._nid && opt.tagName === 'NAVIGATION-BAR') {
|
|
32
|
+
if (opt.id === this.node._nid.toString() && opt.tagName === 'NAVIGATION-BAR') {
|
|
33
33
|
const attrs: Record<string, TaroAny> = {}
|
|
34
34
|
attrs[opt.attribute] = opt.value
|
|
35
35
|
this.handleAttributes(attrs)
|
|
@@ -32,16 +32,16 @@ export default struct TaroPageMeta {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// FIXME 在 Harmony 提供 @Watch 文档后,根据 node 实际使用更细粒度的监听
|
|
35
|
-
eventCenter
|
|
35
|
+
eventCenter?.on('__taroComponentAttributeUpdate', this.handleAttributeUpdate)
|
|
36
36
|
this.handleAttributes(this.node._attrs)
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
aboutToDisappear(): void {
|
|
40
|
-
eventCenter
|
|
40
|
+
eventCenter?.off('__taroComponentAttributeUpdate', this.handleAttributeUpdate)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
handleAttributeUpdate = (opt: IComponentAttributeUpdateEvents) => {
|
|
44
|
-
if (opt.id === this.node._nid && opt.tagName === 'PAGE-META') {
|
|
44
|
+
if (opt.id === this.node._nid.toString() && opt.tagName === 'PAGE-META') {
|
|
45
45
|
const attrs: Record<string, TaroAny> = {}
|
|
46
46
|
attrs[opt.attribute] = opt.value
|
|
47
47
|
this.handleAttributes(attrs)
|
|
@@ -79,7 +79,7 @@ export default struct TaroPageMeta {
|
|
|
79
79
|
// pageFontSize
|
|
80
80
|
// pageOrientation
|
|
81
81
|
if (triggerStyleEvent) {
|
|
82
|
-
eventCenter
|
|
82
|
+
eventCenter?.trigger('__taroPageStyle', options)
|
|
83
83
|
}
|
|
84
84
|
// onResize
|
|
85
85
|
// onScroll
|
|
@@ -17,7 +17,7 @@ interface RadioAttrs {
|
|
|
17
17
|
@Extend(Radio)
|
|
18
18
|
function radioAttr (attr: RadioAttrs) {
|
|
19
19
|
.radioStyle(attr.radioStyle)
|
|
20
|
-
.themeStyles(attr.themeStyles)
|
|
20
|
+
.themeStyles(attr.themeStyles || false)
|
|
21
21
|
.enabled(!attr.disabled)
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -55,7 +55,7 @@ export struct TaroRadio {
|
|
|
55
55
|
Stack() {
|
|
56
56
|
Row() {
|
|
57
57
|
Radio({
|
|
58
|
-
group: this.node.group || this.node.parentNode?._nid || '',
|
|
58
|
+
group: this.node.group || this.node.parentNode?._nid.toString() || '',
|
|
59
59
|
value: this.node.value || '',
|
|
60
60
|
})
|
|
61
61
|
.checked(this.node.checked)
|
|
@@ -114,7 +114,7 @@ export struct TaroRadioGroup {
|
|
|
114
114
|
this.node._instance = this
|
|
115
115
|
const childList = this.node.getElementsByTagName<TaroRadioElement>('RADIO')
|
|
116
116
|
childList.forEach(element => {
|
|
117
|
-
element.group = this.node?._attrs.name || this.node?._nid
|
|
117
|
+
element.group = this.node?._attrs.name || this.node?._nid.toString()
|
|
118
118
|
})
|
|
119
119
|
// 阻止事件冒泡传递上去
|
|
120
120
|
this.node.addEventListener('change', (e: TaroEvent) => e.stopPropagation())
|
|
@@ -63,7 +63,7 @@ export default struct TaroTextArea {
|
|
|
63
63
|
|
|
64
64
|
build () {
|
|
65
65
|
TextArea({ text: this.value, placeholder: this.node._attrs?.placeholder || '', controller: this.node.controller })
|
|
66
|
-
.key(this.node._nid)
|
|
66
|
+
.key(this.node._nid.toString())
|
|
67
67
|
.maxLength(Number(this.node._attrs?.maxlength) || null)
|
|
68
68
|
.placeholderColor(getPlaceholderColor(this.node))
|
|
69
69
|
.attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
@@ -99,7 +99,7 @@ export function getNormalAttributes (node: TaroElement, initStyle?: HarmonyStyle
|
|
|
99
99
|
let normalAttributes = hmStyle
|
|
100
100
|
|
|
101
101
|
// 覆盖属性
|
|
102
|
-
normalAttributes.id =
|
|
102
|
+
normalAttributes.id = _attrs.id || _nid.toString()
|
|
103
103
|
|
|
104
104
|
let pseudoStylesheet = getPseudoClass(node)
|
|
105
105
|
if (pseudoStylesheet) {
|
|
@@ -21,8 +21,8 @@ export enum NodeType {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
let _id = 0
|
|
24
|
-
function genId ():
|
|
25
|
-
return
|
|
24
|
+
function genId (): number {
|
|
25
|
+
return ++_id
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export class TaroNode extends TaroDataSourceElement {
|
|
@@ -30,7 +30,7 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
30
30
|
public readonly nodeType: NodeType
|
|
31
31
|
public childNodes: TaroNode[] = []
|
|
32
32
|
public parentNode: TaroNode | null = null
|
|
33
|
-
public _nid:
|
|
33
|
+
public _nid: number = genId()
|
|
34
34
|
public _doc: TaroDocument | null = null
|
|
35
35
|
public _instance?: TaroAny
|
|
36
36
|
|
|
@@ -23,7 +23,7 @@ export const ReactMeta: IReactMeta = {
|
|
|
23
23
|
PageContext: EMPTY_OBJ
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
const pageKeyId = incrementId()
|
|
26
|
+
const pageKeyId = incrementId(1)
|
|
27
27
|
|
|
28
28
|
export function connectReactPage (
|
|
29
29
|
R: typeof React,
|
|
@@ -85,7 +85,7 @@ export function createReactApp (
|
|
|
85
85
|
App,
|
|
86
86
|
react,
|
|
87
87
|
dom,
|
|
88
|
-
|
|
88
|
+
config?: any
|
|
89
89
|
) {
|
|
90
90
|
ReactMeta.R = react
|
|
91
91
|
h = react.createElement
|
|
@@ -107,7 +107,7 @@ export function createReactApp (
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
function renderReactRoot () {
|
|
110
|
-
const appId = 'app'
|
|
110
|
+
const appId = config?.appId || 'app'
|
|
111
111
|
|
|
112
112
|
if (ReactMeta.Container === EMPTY_OBJ) {
|
|
113
113
|
const Container = document.createElement('view')
|
|
@@ -132,7 +132,7 @@ export function createReactApp (
|
|
|
132
132
|
|
|
133
133
|
public mount (pageComponent: any, id: string, getCtx: () => any, cb: () => void) {
|
|
134
134
|
const pageWrapper = connectReactPage(react, id, getCtx)(pageComponent)
|
|
135
|
-
const key = id
|
|
135
|
+
const key = `${id}_${pageKeyId()}`
|
|
136
136
|
const page = () => h(pageWrapper, { key, tid: id })
|
|
137
137
|
this.pages.push(page)
|
|
138
138
|
this.forceUpdate(cb)
|
|
@@ -19,7 +19,7 @@ import { EMPTY_OBJ, incrementId, isClassComponent } from './utils'
|
|
|
19
19
|
import type { AppInstance } from '@tarojs/taro'
|
|
20
20
|
import type * as React from 'react'
|
|
21
21
|
|
|
22
|
-
const getNativeCompId = incrementId()
|
|
22
|
+
const getNativeCompId = incrementId(1)
|
|
23
23
|
let h: typeof React.createElement
|
|
24
24
|
let ReactDOM
|
|
25
25
|
let nativeComponentApp: AppInstance
|
|
@@ -8,7 +8,7 @@ import { incrementId } from './utils'
|
|
|
8
8
|
import type { PageConfig } from '@tarojs/taro'
|
|
9
9
|
|
|
10
10
|
const instances = new Map<string, any>()
|
|
11
|
-
const pageId = incrementId()
|
|
11
|
+
const pageId = incrementId(1)
|
|
12
12
|
|
|
13
13
|
export function injectPageInstance (inst: any, id: string) {
|
|
14
14
|
hooks.call('mergePageInstance', instances.get(id), inst)
|
|
@@ -7,9 +7,9 @@ export function capitalize (s: string) {
|
|
|
7
7
|
return s.charAt(0).toUpperCase() + s.slice(1)
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const incrementId = () => {
|
|
11
|
-
let n =
|
|
12
|
-
return () =>
|
|
10
|
+
export const incrementId = (init = 0) => {
|
|
11
|
+
let n = init
|
|
12
|
+
return () => n++
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function ensureIsArray<T> (item: T | T[]): T[] {
|
|
@@ -31,7 +31,7 @@ export function createSolidApp(App: SolidComponent, config: AppConfig) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
function renderReactRoot() {
|
|
34
|
-
const appId = 'app'
|
|
34
|
+
const appId = config?.appId || 'app'
|
|
35
35
|
|
|
36
36
|
if (ReactMeta.Container === EMPTY_OBJ) {
|
|
37
37
|
const Container = document.createElement('view')
|
|
@@ -8,7 +8,7 @@ import { incrementId } from './utils'
|
|
|
8
8
|
import type { PageConfig } from '@tarojs/taro'
|
|
9
9
|
|
|
10
10
|
const instances = new Map<string, any>()
|
|
11
|
-
const pageId = incrementId()
|
|
11
|
+
const pageId = incrementId(1)
|
|
12
12
|
|
|
13
13
|
export function injectPageInstance (inst: any, id: string) {
|
|
14
14
|
hooks.call('mergePageInstance', instances.get(id), inst)
|
|
@@ -9,9 +9,9 @@ export function capitalize (s: string) {
|
|
|
9
9
|
return s.charAt(0).toUpperCase() + s.slice(1)
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export const incrementId = () => {
|
|
13
|
-
let n =
|
|
14
|
-
return () =>
|
|
12
|
+
export const incrementId = (init = 0) => {
|
|
13
|
+
let n = init
|
|
14
|
+
return () => n++
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export const EMPTY_OBJ: any = {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/plugin-platform-harmony-ets",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.98",
|
|
4
4
|
"description": "OpenHarmony & 鸿蒙系统插件",
|
|
5
5
|
"author": "O2Team",
|
|
6
6
|
"homepage": "https://gitee.com/openharmony-sig/taro",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"webpack-sources": "^3.2.3",
|
|
28
28
|
"@babel/preset-react": "^7.24.1",
|
|
29
29
|
"webpack": "5.91.0",
|
|
30
|
-
"@tarojs/components": "4.0.0-beta.
|
|
31
|
-
"@tarojs/
|
|
32
|
-
"@tarojs/
|
|
33
|
-
"@tarojs/
|
|
34
|
-
"@tarojs/shared": "4.0.0-beta.
|
|
35
|
-
"@tarojs/
|
|
36
|
-
"@tarojs/
|
|
30
|
+
"@tarojs/components": "4.0.0-beta.98",
|
|
31
|
+
"@tarojs/helper": "4.0.0-beta.98",
|
|
32
|
+
"@tarojs/runner-utils": "4.0.0-beta.98",
|
|
33
|
+
"@tarojs/service": "4.0.0-beta.98",
|
|
34
|
+
"@tarojs/shared": "4.0.0-beta.98",
|
|
35
|
+
"@tarojs/runtime": "4.0.0-beta.98",
|
|
36
|
+
"@tarojs/taro": "4.0.0-beta.98"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"fast-glob": "^3.3.1",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"rollup-plugin-ts": "^3.0.2",
|
|
43
43
|
"solid-js": "^1.8.16",
|
|
44
44
|
"tslib": "^2.4.0",
|
|
45
|
-
"rollup-plugin-copy": "4.0.0-beta.
|
|
45
|
+
"rollup-plugin-copy": "4.0.0-beta.98"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"prod": "pnpm run build",
|