@tarojs/plugin-platform-harmony-ets 4.0.0-alpha.22 → 4.0.0-alpha.24
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/button.ets +4 -4
- package/dist/components-harmony-ets/checkbox.ets +7 -7
- package/dist/components-harmony-ets/form.ets +10 -10
- package/dist/components-harmony-ets/icon.ets +3 -3
- package/dist/components-harmony-ets/image.ets +3 -3
- package/dist/components-harmony-ets/input.ets +16 -3
- package/dist/components-harmony-ets/label.ets +10 -10
- package/dist/components-harmony-ets/listView.ets +7 -2
- package/dist/components-harmony-ets/movableArea.ets +4 -4
- package/dist/components-harmony-ets/movableView.ets +4 -4
- package/dist/components-harmony-ets/navigationBar.ets +6 -6
- package/dist/components-harmony-ets/pageMeta.ets +6 -6
- package/dist/components-harmony-ets/picker.ets +4 -4
- package/dist/components-harmony-ets/progress.ets +2 -2
- package/dist/components-harmony-ets/pseudo.ets +2 -2
- package/dist/components-harmony-ets/radio.ets +11 -11
- package/dist/components-harmony-ets/richText.ets +2 -2
- package/dist/components-harmony-ets/scrollList.ets +13 -4
- package/dist/components-harmony-ets/scrollView.ets +5 -5
- package/dist/components-harmony-ets/slider.ets +2 -2
- package/dist/components-harmony-ets/stickySection.ets +3 -3
- package/dist/components-harmony-ets/swiper.ets +3 -3
- package/dist/components-harmony-ets/switch.ets +2 -2
- package/dist/components-harmony-ets/text.ets +33 -57
- package/dist/components-harmony-ets/textArea.ets +3 -3
- package/dist/components-harmony-ets/utils/AttributeManager.ets +1 -1
- package/dist/components-harmony-ets/utils/helper.ets +3 -4
- package/dist/components-harmony-ets/utils/styles.ets +1 -1
- package/dist/components-harmony-ets/video.ets +2 -2
- package/dist/components-harmony-ets/view.ets +10 -10
- package/dist/components-harmony-ets/webView.ets +2 -2
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/current.ts +2 -1
- package/dist/runtime-ets/dom/element/element.ts +10 -10
- package/dist/runtime-ets/dom/event.ts +1 -1
- package/dist/runtime-ets/dom/node.ts +11 -3
- package/dist/runtime-ets/utils/index.ts +1 -0
- package/dist/runtime-framework/react/app.ts +6 -6
- 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 +7 -3
- package/dist/runtime-framework/solid/page.ts +1 -1
- package/dist/runtime-framework/solid/utils/index.ts +3 -3
- package/package.json +9 -9
|
@@ -111,7 +111,7 @@ function getButtonMinHeight (node: TaroButtonElement): string | number | undefin
|
|
|
111
111
|
@Component
|
|
112
112
|
export default struct TaroButton {
|
|
113
113
|
@Builder customBuilder() {}
|
|
114
|
-
@BuilderParam createLazyChildren: (node: TaroButtonElement) => void = this.customBuilder
|
|
114
|
+
@BuilderParam createLazyChildren: (node: TaroButtonElement, layer?: number) => void = this.customBuilder
|
|
115
115
|
@ObjectLink node: TaroButtonElement
|
|
116
116
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
117
117
|
|
|
@@ -128,10 +128,10 @@ export default struct TaroButton {
|
|
|
128
128
|
LoadingProgress()
|
|
129
129
|
.width(20).height(20)
|
|
130
130
|
.color(getThemeAttributes(this.node).color)
|
|
131
|
-
this.createLazyChildren(this.node)
|
|
131
|
+
this.createLazyChildren(this.node, 0)
|
|
132
132
|
}
|
|
133
133
|
} else {
|
|
134
|
-
this.createLazyChildren(this.node)
|
|
134
|
+
this.createLazyChildren(this.node, 0)
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
.themeStyles(getThemeAttributes(this.node))
|
|
@@ -152,7 +152,7 @@ export default struct TaroButton {
|
|
|
152
152
|
}
|
|
153
153
|
eventHandler(e, 'click', this.node)
|
|
154
154
|
})
|
|
155
|
-
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
155
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => { eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node) }, this.node, TOUCH_EVENT_MAP.values()))
|
|
156
156
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
157
157
|
this.node._nodeInfo.areaInfo = res[1]
|
|
158
158
|
}))
|
|
@@ -40,7 +40,7 @@ function getOptions (node: TaroCheckboxElement): CheckboxOptions {
|
|
|
40
40
|
@Component
|
|
41
41
|
export struct TaroCheckbox {
|
|
42
42
|
@Builder customBuilder() {}
|
|
43
|
-
@BuilderParam createLazyChildren: (node: TaroCheckboxElement) => void = this.customBuilder
|
|
43
|
+
@BuilderParam createLazyChildren: (node: TaroCheckboxElement, layer?: number) => void = this.customBuilder
|
|
44
44
|
@ObjectLink node: TaroCheckboxElement
|
|
45
45
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
46
46
|
|
|
@@ -74,7 +74,7 @@ export struct TaroCheckbox {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
})
|
|
77
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
77
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
78
78
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
79
79
|
if (this.node) {
|
|
80
80
|
this.node._nodeInfo.areaInfo = res[1]
|
|
@@ -101,7 +101,7 @@ interface ChangeEventDetail { value: string[] }
|
|
|
101
101
|
@Component
|
|
102
102
|
export struct TaroCheckboxGroup {
|
|
103
103
|
@Builder customBuilder() {}
|
|
104
|
-
@BuilderParam createLazyChildren: (node: TaroCheckboxGroupElement) => void = this.customBuilder
|
|
104
|
+
@BuilderParam createLazyChildren: (node: TaroCheckboxGroupElement, layer?: number) => void = this.customBuilder
|
|
105
105
|
@ObjectLink node: TaroCheckboxGroupElement
|
|
106
106
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
107
107
|
|
|
@@ -121,7 +121,7 @@ export struct TaroCheckboxGroup {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
@Styles defaultEvent () {
|
|
124
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
124
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
125
125
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
126
126
|
if (this.node) {
|
|
127
127
|
this.node._nodeInfo.areaInfo = res[1]
|
|
@@ -132,21 +132,21 @@ export struct TaroCheckboxGroup {
|
|
|
132
132
|
build() {
|
|
133
133
|
if (FlexManager.useFlexLayout(this.node)) {
|
|
134
134
|
Flex(FlexManager.flexOptions(this.node)) {
|
|
135
|
-
this.createLazyChildren(this.node)
|
|
135
|
+
this.createLazyChildren(this.node, 0)
|
|
136
136
|
}
|
|
137
137
|
.attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
138
138
|
.defaultEvent()
|
|
139
139
|
.visibleChangeEvent()
|
|
140
140
|
} else if (FlexManager.isFlexNode(this.node) && FlexManager.direction(this.node) !== FlexDirection.Column) {
|
|
141
141
|
Row() {
|
|
142
|
-
this.createLazyChildren(this.node)
|
|
142
|
+
this.createLazyChildren(this.node, 0)
|
|
143
143
|
}
|
|
144
144
|
.attributeModifier(rowModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
145
145
|
.defaultEvent()
|
|
146
146
|
.visibleChangeEvent()
|
|
147
147
|
} else {
|
|
148
148
|
Column() {
|
|
149
|
-
this.createLazyChildren(this.node)
|
|
149
|
+
this.createLazyChildren(this.node, 0)
|
|
150
150
|
}
|
|
151
151
|
.attributeModifier(columnModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
152
152
|
.defaultEvent()
|
|
@@ -12,7 +12,7 @@ import { isUndefined } from '@tarojs/shared'
|
|
|
12
12
|
@Component
|
|
13
13
|
export default struct TaroForm {
|
|
14
14
|
@Builder customBuilder() {}
|
|
15
|
-
@BuilderParam createLazyChildren: (node: TaroFormElement) => void = this.customBuilder
|
|
15
|
+
@BuilderParam createLazyChildren: (node: TaroFormElement, layer?: number) => void = this.customBuilder
|
|
16
16
|
@ObjectLink node: TaroFormElement
|
|
17
17
|
|
|
18
18
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
@@ -26,33 +26,33 @@ export default struct TaroForm {
|
|
|
26
26
|
build() {
|
|
27
27
|
if (FlexManager.useFlexLayout(this.node)) {
|
|
28
28
|
Flex(FlexManager.flexOptions(this.node)) {
|
|
29
|
-
this.createLazyChildren(this.node)
|
|
29
|
+
this.createLazyChildren(this.node, 0)
|
|
30
30
|
}
|
|
31
31
|
.attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
32
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
33
|
-
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
32
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
33
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => { eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node) }, this.node, TOUCH_EVENT_MAP.values()))
|
|
34
34
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
35
35
|
this.node._nodeInfo.areaInfo = res[1]
|
|
36
36
|
}))
|
|
37
37
|
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
38
38
|
} else if (FlexManager.isFlexNode(this.node) && FlexManager.direction(this.node) !== FlexDirection.Column) {
|
|
39
39
|
Row() {
|
|
40
|
-
this.createLazyChildren(this.node)
|
|
40
|
+
this.createLazyChildren(this.node, 0)
|
|
41
41
|
}
|
|
42
42
|
.attributeModifier(rowModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
43
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
44
|
-
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
43
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
44
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => { eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node) }, this.node, TOUCH_EVENT_MAP.values()))
|
|
45
45
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
46
46
|
this.node._nodeInfo.areaInfo = res[1]
|
|
47
47
|
}))
|
|
48
48
|
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
49
49
|
} else {
|
|
50
50
|
Column() {
|
|
51
|
-
this.createLazyChildren(this.node)
|
|
51
|
+
this.createLazyChildren(this.node, 0)
|
|
52
52
|
}
|
|
53
53
|
.attributeModifier(columnModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
54
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
55
|
-
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
54
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
55
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => { eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node) }, this.node, TOUCH_EVENT_MAP.values()))
|
|
56
56
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
57
57
|
this.node._nodeInfo.areaInfo = res[1]
|
|
58
58
|
}))
|
|
@@ -51,7 +51,7 @@ function getIconData (node: TaroIconElement): Resource | null {
|
|
|
51
51
|
@Component
|
|
52
52
|
export default struct TaroIcon {
|
|
53
53
|
@Builder customBuilder() {}
|
|
54
|
-
@BuilderParam createLazyChildren: (node: TaroIconElement) => void = this.customBuilder
|
|
54
|
+
@BuilderParam createLazyChildren: (node: TaroIconElement, layer?: number) => void = this.customBuilder
|
|
55
55
|
@ObjectLink node: TaroIconElement
|
|
56
56
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
57
57
|
|
|
@@ -70,8 +70,8 @@ export default struct TaroIcon {
|
|
|
70
70
|
width: Number(this.node._attrs.size) || 23,
|
|
71
71
|
height: Number(this.node._attrs.size) || 23
|
|
72
72
|
})
|
|
73
|
-
.onComplete(e => eventHandler(e, 'complete', this.node))
|
|
74
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
73
|
+
.onComplete(e => { eventHandler(e, 'complete', this.node) })
|
|
74
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
75
75
|
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
76
76
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
77
77
|
this.node._nodeInfo.areaInfo = res[1]
|
|
@@ -19,7 +19,7 @@ export function getImageMode (mode: string): ImageFit {
|
|
|
19
19
|
@Component
|
|
20
20
|
export default struct TaroImage {
|
|
21
21
|
@Builder customBuilder() {}
|
|
22
|
-
@BuilderParam createLazyChildren: (node: TaroImageElement) => void = this.customBuilder
|
|
22
|
+
@BuilderParam createLazyChildren: (node: TaroImageElement, layer?: number) => void = this.customBuilder
|
|
23
23
|
@ObjectLink node: TaroImageElement
|
|
24
24
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
25
25
|
|
|
@@ -31,13 +31,13 @@ export default struct TaroImage {
|
|
|
31
31
|
|
|
32
32
|
build() {
|
|
33
33
|
Image(this.node.getAttribute('src'))
|
|
34
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
34
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
35
35
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
36
36
|
this.node._nodeInfo.areaInfo = res[1]
|
|
37
37
|
}))
|
|
38
38
|
.objectFit(getImageMode(this.node.getAttribute('mode')))
|
|
39
39
|
.attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
40
|
-
.onComplete(e => eventHandler(e, 'complete', this.node))
|
|
40
|
+
.onComplete(e => { eventHandler(e, 'complete', this.node) })
|
|
41
41
|
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
42
42
|
// TODO: 临时改为申明式,后续等鸿蒙修复modify设置失败的bug后删除该申明
|
|
43
43
|
.borderRadius({
|
|
@@ -49,12 +49,24 @@ function getPlaceholderColor (node: TaroInputElement): string {
|
|
|
49
49
|
return placeholderTextColor || parseStyles(placeholderStyle)?.color
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
function getPlaceholderFont(node: TaroInputElement): Font {
|
|
53
|
+
const placeholderStyle: string = node._attrs.placeholderStyle || ''
|
|
54
|
+
const styles = parseStyles(placeholderStyle);
|
|
55
|
+
if (styles) {
|
|
56
|
+
return {
|
|
57
|
+
size: styles.fontSize,
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return {}
|
|
62
|
+
}
|
|
63
|
+
|
|
52
64
|
@Component
|
|
53
65
|
export default struct TaroInput {
|
|
54
66
|
@State value: string = ''
|
|
55
67
|
|
|
56
68
|
@Builder customBuilder() {}
|
|
57
|
-
@BuilderParam createLazyChildren: (node: TaroInputElement) => void = this.customBuilder
|
|
69
|
+
@BuilderParam createLazyChildren: (node: TaroInputElement, layer?: number) => void = this.customBuilder
|
|
58
70
|
@ObjectLink node: TaroInputElement
|
|
59
71
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
60
72
|
|
|
@@ -72,10 +84,11 @@ export default struct TaroInput {
|
|
|
72
84
|
|
|
73
85
|
build () {
|
|
74
86
|
TextInput({ text: this.value, placeholder: this.node._attrs?.placeholder || '', controller: this.node.controller })
|
|
75
|
-
.key(this.node._nid)
|
|
87
|
+
.key(this.node._nid.toString())
|
|
76
88
|
.type(getInputType(this.node))
|
|
77
89
|
.maxLength(Number(this.node._attrs?.maxlength) || null)
|
|
78
90
|
.placeholderColor(getPlaceholderColor(this.node))
|
|
91
|
+
.placeholderFont(getPlaceholderFont(this.node))
|
|
79
92
|
.enterKeyType(INPUT_CONFIRM_MAP.get(this.node._attrs?.confirmType) || EnterKeyType.Done)
|
|
80
93
|
.padding(0) // Note: 移出 Input 默认 padding 设置
|
|
81
94
|
.backgroundColor(getStyleAttr(this.node, "backgroundColor"))//
|
|
@@ -93,7 +106,7 @@ export default struct TaroInput {
|
|
|
93
106
|
const event: TaroEvent = createTaroEvent('confirm', { detail: { value: this.value } }, this.node)
|
|
94
107
|
eventHandler(event, 'confirm', this.node)
|
|
95
108
|
})
|
|
96
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
109
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
97
110
|
.onBlur(() => {
|
|
98
111
|
const event: TaroEvent = createTaroEvent('blur', { detail: { value: this.value } }, this.node)
|
|
99
112
|
eventHandler(event, 'blur', this.node)
|
|
@@ -38,7 +38,7 @@ function handleTargetChange (id: string) {
|
|
|
38
38
|
@Component
|
|
39
39
|
export default struct TaroLabel {
|
|
40
40
|
@Builder customBuilder() {}
|
|
41
|
-
@BuilderParam createLazyChildren: (node: TaroLabelElement) => void = this.customBuilder
|
|
41
|
+
@BuilderParam createLazyChildren: (node: TaroLabelElement, layer?: number) => void = this.customBuilder
|
|
42
42
|
@ObjectLink node: TaroLabelElement
|
|
43
43
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
44
44
|
|
|
@@ -51,51 +51,51 @@ export default struct TaroLabel {
|
|
|
51
51
|
build() {
|
|
52
52
|
if (FlexManager.useFlexLayout(this.node)) {
|
|
53
53
|
Flex(FlexManager.flexOptions(this.node)) {
|
|
54
|
-
this.createLazyChildren(this.node)
|
|
54
|
+
this.createLazyChildren(this.node, 0)
|
|
55
55
|
}
|
|
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)
|
|
63
63
|
})
|
|
64
|
-
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
64
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => { eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node) }, this.node, TOUCH_EVENT_MAP.values()))
|
|
65
65
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
66
66
|
this.node._nodeInfo.areaInfo = res[1]
|
|
67
67
|
}))
|
|
68
68
|
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
69
69
|
} else if (FlexManager.isFlexNode(this.node) && FlexManager.direction(this.node) !== FlexDirection.Column) {
|
|
70
70
|
Row() {
|
|
71
|
-
this.createLazyChildren(this.node)
|
|
71
|
+
this.createLazyChildren(this.node, 0)
|
|
72
72
|
}
|
|
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)
|
|
80
80
|
})
|
|
81
|
-
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
81
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => { eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node) }, this.node, TOUCH_EVENT_MAP.values()))
|
|
82
82
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
83
83
|
this.node._nodeInfo.areaInfo = res[1]
|
|
84
84
|
}))
|
|
85
85
|
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
86
86
|
} else {
|
|
87
87
|
Column() {
|
|
88
|
-
this.createLazyChildren(this.node)
|
|
88
|
+
this.createLazyChildren(this.node, 0)
|
|
89
89
|
}
|
|
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)
|
|
97
97
|
})
|
|
98
|
-
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
98
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => { eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node) }, this.node, TOUCH_EVENT_MAP.values()))
|
|
99
99
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
100
100
|
this.node._nodeInfo.areaInfo = res[1]
|
|
101
101
|
}))
|
|
@@ -2,10 +2,11 @@ import commonStyleModify from './style'
|
|
|
2
2
|
|
|
3
3
|
import type { TaroViewElement, TaroAny } from '@tarojs/runtime'
|
|
4
4
|
|
|
5
|
+
@Reusable
|
|
5
6
|
@Component
|
|
6
7
|
export default struct TaroListView {
|
|
7
8
|
@Builder customBuilder() {}
|
|
8
|
-
@BuilderParam createLazyChildren: (node: TaroViewElement) => void = this.customBuilder
|
|
9
|
+
@BuilderParam createLazyChildren: (node: TaroViewElement, layer?: number) => void = this.customBuilder
|
|
9
10
|
@ObjectLink node: TaroViewElement
|
|
10
11
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
11
12
|
|
|
@@ -15,10 +16,14 @@ export default struct TaroListView {
|
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
|
|
19
|
+
aboutToReuse(params: TaroAny): void {
|
|
20
|
+
// this.node = params.node;
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
build() {
|
|
19
24
|
ListItem() {
|
|
20
25
|
Stack() {
|
|
21
|
-
this.createLazyChildren(this.node)
|
|
26
|
+
this.createLazyChildren(this.node, 0)
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
29
|
.attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
@@ -11,7 +11,7 @@ export default struct TaroMovableArea {
|
|
|
11
11
|
customBuilder() {
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
@BuilderParam createLazyChildren: (node: TaroMovableAreaElement) => void = this.customBuilder
|
|
14
|
+
@BuilderParam createLazyChildren: (node: TaroMovableAreaElement, layer?: number) => void = this.customBuilder
|
|
15
15
|
@ObjectLink node: TaroMovableAreaElement
|
|
16
16
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
17
17
|
|
|
@@ -28,7 +28,7 @@ export default struct TaroMovableArea {
|
|
|
28
28
|
build() {
|
|
29
29
|
if (FlexManager.useFlexLayout(this.node)) {
|
|
30
30
|
Flex(FlexManager.flexOptions(this.node)) {
|
|
31
|
-
this.createLazyChildren(this.node)
|
|
31
|
+
this.createLazyChildren(this.node, 0)
|
|
32
32
|
}
|
|
33
33
|
.attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
34
34
|
.clip(true)
|
|
@@ -55,7 +55,7 @@ export default struct TaroMovableArea {
|
|
|
55
55
|
)
|
|
56
56
|
} else if (FlexManager.isFlexNode(this.node) && FlexManager.direction(this.node) !== FlexDirection.Column) {
|
|
57
57
|
Row() {
|
|
58
|
-
this.createLazyChildren(this.node)
|
|
58
|
+
this.createLazyChildren(this.node, 0)
|
|
59
59
|
}
|
|
60
60
|
.attributeModifier(rowModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
61
61
|
.clip(true)
|
|
@@ -82,7 +82,7 @@ export default struct TaroMovableArea {
|
|
|
82
82
|
)
|
|
83
83
|
} else {
|
|
84
84
|
Column() {
|
|
85
|
-
this.createLazyChildren(this.node)
|
|
85
|
+
this.createLazyChildren(this.node, 0)
|
|
86
86
|
}
|
|
87
87
|
.attributeModifier(columnModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
88
88
|
.clip(true)
|
|
@@ -9,7 +9,7 @@ import { FlexManager } from './utils/flexManager'
|
|
|
9
9
|
@Component
|
|
10
10
|
export default struct TaroMovableView {
|
|
11
11
|
@Builder customBuilder() {}
|
|
12
|
-
@BuilderParam createLazyChildren: (node: TaroMovableViewElement) => void = this.customBuilder
|
|
12
|
+
@BuilderParam createLazyChildren: (node: TaroMovableViewElement, layer?: number) => void = this.customBuilder
|
|
13
13
|
@ObjectLink node: TaroMovableViewElement
|
|
14
14
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
15
15
|
|
|
@@ -24,17 +24,17 @@ export default struct TaroMovableView {
|
|
|
24
24
|
Stack() {
|
|
25
25
|
if (FlexManager.useFlexLayout(this.node)) {
|
|
26
26
|
Flex(FlexManager.flexOptions(this.node)) {
|
|
27
|
-
this.createLazyChildren(this.node)
|
|
27
|
+
this.createLazyChildren(this.node, 0)
|
|
28
28
|
}
|
|
29
29
|
.attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
30
30
|
} else if (FlexManager.isFlexNode(this.node) && FlexManager.direction(this.node) !== FlexDirection.Column) {
|
|
31
31
|
Row() {
|
|
32
|
-
this.createLazyChildren(this.node)
|
|
32
|
+
this.createLazyChildren(this.node, 0)
|
|
33
33
|
}
|
|
34
34
|
.attributeModifier(rowModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
35
35
|
} else {
|
|
36
36
|
Column() {
|
|
37
|
-
this.createLazyChildren(this.node)
|
|
37
|
+
this.createLazyChildren(this.node, 0)
|
|
38
38
|
}
|
|
39
39
|
.attributeModifier(columnModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
40
40
|
}
|
|
@@ -8,7 +8,7 @@ import type { IComponentAttributeUpdateEvents } from './pageMeta'
|
|
|
8
8
|
@Component
|
|
9
9
|
export default struct TaroNavigationBar {
|
|
10
10
|
@Builder customBuilder() {}
|
|
11
|
-
@BuilderParam createLazyChildren: (node: TaroNavigationBarElement) => void = this.customBuilder
|
|
11
|
+
@BuilderParam createLazyChildren: (node: TaroNavigationBarElement, layer?: number) => void = this.customBuilder
|
|
12
12
|
@ObjectLink node: TaroNavigationBarElement
|
|
13
13
|
|
|
14
14
|
aboutToAppear(): void {
|
|
@@ -20,16 +20,16 @@ export default struct TaroNavigationBar {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
// FIXME 在 Harmony 提供 @Watch 文档后,根据 node 实际使用更细粒度的监听
|
|
23
|
-
eventCenter
|
|
23
|
+
eventCenter?.on('__taroComponentAttributeUpdate', this.handleAttributeUpdate)
|
|
24
24
|
this.handleAttributes(this.node._attrs)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
aboutToDisappear(): void {
|
|
28
|
-
eventCenter
|
|
28
|
+
eventCenter?.off('__taroComponentAttributeUpdate', this.handleAttributeUpdate)
|
|
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)
|
|
@@ -51,7 +51,7 @@ export default struct TaroNavigationBar {
|
|
|
51
51
|
if (attrs.frontColor) {
|
|
52
52
|
options.frontColor = attrs.frontColor
|
|
53
53
|
}
|
|
54
|
-
eventCenter
|
|
54
|
+
eventCenter?.trigger('__taroNavigationStyle', options)
|
|
55
55
|
// FIXME: 以下属性暂时不支持
|
|
56
56
|
// attrs.colorAnimationDuration
|
|
57
57
|
// attrs.colorAnimationTimingFunc
|
|
@@ -59,7 +59,7 @@ export default struct TaroNavigationBar {
|
|
|
59
59
|
|
|
60
60
|
build() {
|
|
61
61
|
if (true) {
|
|
62
|
-
this.createLazyChildren(this.node)
|
|
62
|
+
this.createLazyChildren(this.node, 0)
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -15,7 +15,7 @@ export interface IComponentAttributeUpdateEvents {
|
|
|
15
15
|
@Component
|
|
16
16
|
export default struct TaroPageMeta {
|
|
17
17
|
@Builder customBuilder() {}
|
|
18
|
-
@BuilderParam createLazyChildren: (node: TaroPageMetaElement) => void = this.customBuilder
|
|
18
|
+
@BuilderParam createLazyChildren: (node: TaroPageMetaElement, layer?: number) => void = this.customBuilder
|
|
19
19
|
@ObjectLink node: TaroPageMetaElement
|
|
20
20
|
|
|
21
21
|
page: TaroAny = {}
|
|
@@ -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
|
|
@@ -88,7 +88,7 @@ export default struct TaroPageMeta {
|
|
|
88
88
|
|
|
89
89
|
build() {
|
|
90
90
|
if (true) {
|
|
91
|
-
this.createLazyChildren(this.node)
|
|
91
|
+
this.createLazyChildren(this.node, 0)
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -226,7 +226,7 @@ export struct PickerView {
|
|
|
226
226
|
@Component
|
|
227
227
|
export default struct TaroPicker {
|
|
228
228
|
@Builder customBuilder() {}
|
|
229
|
-
@BuilderParam createLazyChildren: (node: TaroPickerElement) => void = this.customBuilder
|
|
229
|
+
@BuilderParam createLazyChildren: (node: TaroPickerElement, layer?: number) => void = this.customBuilder
|
|
230
230
|
@ObjectLink node: TaroPickerElement
|
|
231
231
|
|
|
232
232
|
aboutToAppear () {
|
|
@@ -298,7 +298,7 @@ export default struct TaroPicker {
|
|
|
298
298
|
.onClick((e: ClickEvent) => {
|
|
299
299
|
eventHandler(e, 'click', this.node)
|
|
300
300
|
})
|
|
301
|
-
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
301
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => { eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node) }, this.node, TOUCH_EVENT_MAP.values()))
|
|
302
302
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
303
303
|
if (this.node) {
|
|
304
304
|
this.node._nodeInfo.areaInfo = res[1]
|
|
@@ -313,7 +313,7 @@ export default struct TaroPicker {
|
|
|
313
313
|
build() {
|
|
314
314
|
if (FlexManager.isFlexNode(this.node) && FlexManager.direction(this.node) !== FlexDirection.Column) {
|
|
315
315
|
Row() {
|
|
316
|
-
this.createLazyChildren(this.node)
|
|
316
|
+
this.createLazyChildren(this.node, 0)
|
|
317
317
|
}
|
|
318
318
|
.defaultEvent()
|
|
319
319
|
.visibleChangeEvent()
|
|
@@ -321,7 +321,7 @@ export default struct TaroPicker {
|
|
|
321
321
|
.justifyContent(FlexManager.justifyContent(this.node))
|
|
322
322
|
} else {
|
|
323
323
|
Column() {
|
|
324
|
-
this.createLazyChildren(this.node)
|
|
324
|
+
this.createLazyChildren(this.node, 0)
|
|
325
325
|
}
|
|
326
326
|
.defaultEvent()
|
|
327
327
|
.visibleChangeEvent()
|
|
@@ -10,7 +10,7 @@ const PROGRESS_DEFAULTINFOFONTSIZE = 16
|
|
|
10
10
|
@Component
|
|
11
11
|
export default struct TaroProgress {
|
|
12
12
|
@Builder customBuilder() {}
|
|
13
|
-
@BuilderParam createLazyChildren: (node: TaroProgressElement) => void = this.customBuilder
|
|
13
|
+
@BuilderParam createLazyChildren: (node: TaroProgressElement, layer?: number) => void = this.customBuilder
|
|
14
14
|
@ObjectLink node: TaroProgressElement
|
|
15
15
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
16
16
|
|
|
@@ -35,7 +35,7 @@ export default struct TaroProgress {
|
|
|
35
35
|
enableSmoothEffect: Boolean(this.node.getAttribute('active')),
|
|
36
36
|
})
|
|
37
37
|
|
|
38
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
38
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
39
39
|
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
40
40
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
41
41
|
if (this.node) {
|
|
@@ -43,7 +43,7 @@ function textSpecialFontStyle(attr: TaroTextStyleType) {
|
|
|
43
43
|
@Component
|
|
44
44
|
export default struct PseduoChildren {
|
|
45
45
|
@Builder customBuilder() {}
|
|
46
|
-
@BuilderParam createLazyChildren: (node: TaroAny) => void = this.customBuilder
|
|
46
|
+
@BuilderParam createLazyChildren: (node: TaroAny, layer?: number) => void = this.customBuilder
|
|
47
47
|
@ObjectLink node: TaroViewElement
|
|
48
48
|
|
|
49
49
|
build () {
|
|
@@ -61,7 +61,7 @@ export default struct PseduoChildren {
|
|
|
61
61
|
.flexAttrs(this.node._pseudo_before.hmStyle || {})
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
this.createLazyChildren(this.node)
|
|
64
|
+
this.createLazyChildren(this.node, 0)
|
|
65
65
|
// 伪类::After
|
|
66
66
|
if (this.node._pseudo_after) {
|
|
67
67
|
if (this.node._pseudo_after?.hmStyle.content) {
|