@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
|
@@ -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
|
|
|
@@ -39,7 +39,7 @@ function themeStyles(isDisabled: boolean) {
|
|
|
39
39
|
@Component
|
|
40
40
|
export struct TaroRadio {
|
|
41
41
|
@Builder customBuilder() {}
|
|
42
|
-
@BuilderParam createLazyChildren: (node: TaroRadioElement) => void = this.customBuilder
|
|
42
|
+
@BuilderParam createLazyChildren: (node: TaroRadioElement, layer?: number) => void = this.customBuilder
|
|
43
43
|
@ObjectLink node: TaroRadioElement
|
|
44
44
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
45
45
|
|
|
@@ -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)
|
|
@@ -75,7 +75,7 @@ export struct TaroRadio {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
})
|
|
78
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
78
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
79
79
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
80
80
|
if (this.node) {
|
|
81
81
|
this.node._nodeInfo.areaInfo = res[1]
|
|
@@ -101,7 +101,7 @@ export struct TaroRadio {
|
|
|
101
101
|
@Component
|
|
102
102
|
export struct TaroRadioGroup {
|
|
103
103
|
@Builder customBuilder() {}
|
|
104
|
-
@BuilderParam createLazyChildren: (node: TaroRadioGroupElement) => void = this.customBuilder
|
|
104
|
+
@BuilderParam createLazyChildren: (node: TaroRadioGroupElement, layer?: number) => void = this.customBuilder
|
|
105
105
|
@ObjectLink node: TaroRadioGroupElement
|
|
106
106
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
107
107
|
|
|
@@ -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())
|
|
@@ -122,8 +122,8 @@ export struct TaroRadioGroup {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
@Styles defaultEvent () {
|
|
125
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
126
|
-
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
125
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
126
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => { eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node) }, this.node, TOUCH_EVENT_MAP.values()))
|
|
127
127
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
128
128
|
if (this.node) {
|
|
129
129
|
this.node._nodeInfo.areaInfo = res[1]
|
|
@@ -134,21 +134,21 @@ export struct TaroRadioGroup {
|
|
|
134
134
|
build() {
|
|
135
135
|
if (FlexManager.useFlexLayout(this.node)) {
|
|
136
136
|
Flex(FlexManager.flexOptions(this.node)) {
|
|
137
|
-
this.createLazyChildren(this.node)
|
|
137
|
+
this.createLazyChildren(this.node, 0)
|
|
138
138
|
}
|
|
139
139
|
.attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
140
140
|
.defaultEvent()
|
|
141
141
|
.visibleChangeEvent()
|
|
142
142
|
} else if (FlexManager.isFlexNode(this.node) && FlexManager.direction(this.node) !== FlexDirection.Column) {
|
|
143
143
|
Row() {
|
|
144
|
-
this.createLazyChildren(this.node)
|
|
144
|
+
this.createLazyChildren(this.node, 0)
|
|
145
145
|
}
|
|
146
146
|
.attributeModifier(rowModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
147
147
|
.defaultEvent()
|
|
148
148
|
.visibleChangeEvent()
|
|
149
149
|
} else {
|
|
150
150
|
Column() {
|
|
151
|
-
this.createLazyChildren(this.node)
|
|
151
|
+
this.createLazyChildren(this.node, 0)
|
|
152
152
|
}
|
|
153
153
|
.attributeModifier(columnModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
154
154
|
.defaultEvent()
|
|
@@ -9,13 +9,13 @@ import type { TaroAny, TaroRichTextElement } from '@tarojs/runtime'
|
|
|
9
9
|
@Component
|
|
10
10
|
export default struct TaroRichText {
|
|
11
11
|
@Builder customBuilder() {}
|
|
12
|
-
@BuilderParam createLazyChildren: (node: TaroRichTextElement) => void = this.customBuilder
|
|
12
|
+
@BuilderParam createLazyChildren: (node: TaroRichTextElement, layer?: number) => void = this.customBuilder
|
|
13
13
|
@ObjectLink node: TaroRichTextElement
|
|
14
14
|
|
|
15
15
|
build () {
|
|
16
16
|
RichText(generateText(this.node))
|
|
17
17
|
.attributeModifier(commonStyleModify.setNode(this.node))
|
|
18
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
18
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
19
19
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
20
20
|
this.node._nodeInfo.areaInfo = res[1]
|
|
21
21
|
}))
|
|
@@ -52,7 +52,7 @@ function handleScrollEvent (node: TaroScrollViewElement, eventName = 'scroll', s
|
|
|
52
52
|
@Component
|
|
53
53
|
export default struct TaroScrollList {
|
|
54
54
|
@Builder customBuilder() {}
|
|
55
|
-
@BuilderParam createLazyChildren: (node: TaroScrollViewElement) => void = this.customBuilder
|
|
55
|
+
@BuilderParam createLazyChildren: (node: TaroScrollViewElement, layer?: number) => void = this.customBuilder
|
|
56
56
|
@ObjectLink node: TaroScrollViewElement
|
|
57
57
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
58
58
|
|
|
@@ -70,7 +70,7 @@ export default struct TaroScrollList {
|
|
|
70
70
|
List({
|
|
71
71
|
scroller: this.node.scroller
|
|
72
72
|
}) {
|
|
73
|
-
this.createLazyChildren(this.node)
|
|
73
|
+
this.createLazyChildren(this.node, 0)
|
|
74
74
|
}
|
|
75
75
|
.attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
76
76
|
.sticky(StickyStyle.Header)
|
|
@@ -78,8 +78,17 @@ export default struct TaroScrollList {
|
|
|
78
78
|
.align(Alignment.TopStart)
|
|
79
79
|
.clip(true)
|
|
80
80
|
.scrollBar(getAttributes(this.node).scrollBar)
|
|
81
|
-
.
|
|
82
|
-
|
|
81
|
+
.onScrollIndex((first: number, last: number) => {
|
|
82
|
+
const scrollindexfns = (this.node?.__listeners?.['scrollindex'] || []) as Function[]
|
|
83
|
+
scrollindexfns.forEach(fn => {
|
|
84
|
+
fn({
|
|
85
|
+
first,
|
|
86
|
+
last
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
91
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => { eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node) }, this.node, TOUCH_EVENT_MAP.values()))
|
|
83
92
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
84
93
|
this.node._nodeInfo.areaInfo = res[1]
|
|
85
94
|
}))
|
|
@@ -60,7 +60,7 @@ function handleScrollEvent (node: TaroScrollViewElement, eventName = 'scroll', x
|
|
|
60
60
|
@Component
|
|
61
61
|
export default struct TaroScrollView {
|
|
62
62
|
@Builder customBuilder() {}
|
|
63
|
-
@BuilderParam createLazyChildren: (node: TaroScrollViewElement) => void = this.customBuilder
|
|
63
|
+
@BuilderParam createLazyChildren: (node: TaroScrollViewElement, layer?: number) => void = this.customBuilder
|
|
64
64
|
@ObjectLink node: TaroScrollViewElement
|
|
65
65
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
66
66
|
|
|
@@ -81,7 +81,7 @@ export default struct TaroScrollView {
|
|
|
81
81
|
if (this.node._pseudo_before || this.node._pseudo_after) {
|
|
82
82
|
PseduoChildren({ node: this.node, createLazyChildren: this.createLazyChildren })
|
|
83
83
|
} else {
|
|
84
|
-
this.createLazyChildren(this.node)
|
|
84
|
+
this.createLazyChildren(this.node, 0)
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
.alignItems(FlexManager.alignItems<VerticalAlign>(this.node))
|
|
@@ -97,7 +97,7 @@ export default struct TaroScrollView {
|
|
|
97
97
|
if (this.node._pseudo_before || this.node._pseudo_after) {
|
|
98
98
|
PseduoChildren({ node: this.node, createLazyChildren: this.createLazyChildren })
|
|
99
99
|
} else {
|
|
100
|
-
this.createLazyChildren(this.node)
|
|
100
|
+
this.createLazyChildren(this.node, 0)
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
.alignItems(FlexManager.alignItems<HorizontalAlign>(this.node))
|
|
@@ -117,8 +117,8 @@ export default struct TaroScrollView {
|
|
|
117
117
|
.clip(true)
|
|
118
118
|
.scrollable(getScrollable(this.node))
|
|
119
119
|
.scrollBar(getAttributes(this.node).scrollBar)
|
|
120
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
121
|
-
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
120
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
121
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => { eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node) }, this.node, TOUCH_EVENT_MAP.values()))
|
|
122
122
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
123
123
|
this.node._nodeInfo.areaInfo = res[1]
|
|
124
124
|
}))
|
|
@@ -41,7 +41,7 @@ function themeStyles(isDisabled: boolean) {
|
|
|
41
41
|
@Component
|
|
42
42
|
export default struct TaroSlider {
|
|
43
43
|
@Builder customBuilder() {}
|
|
44
|
-
@BuilderParam createLazyChildren: (node: TaroSliderElement) => void = this.customBuilder
|
|
44
|
+
@BuilderParam createLazyChildren: (node: TaroSliderElement, layer?: number) => void = this.customBuilder
|
|
45
45
|
@ObjectLink node: TaroSliderElement
|
|
46
46
|
|
|
47
47
|
@State value: number = 0
|
|
@@ -90,7 +90,7 @@ export default struct TaroSlider {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
})
|
|
93
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
93
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
94
94
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
95
95
|
if (this.node) {
|
|
96
96
|
this.node._nodeInfo.areaInfo = res[1]
|
|
@@ -5,7 +5,7 @@ import type { TaroViewElement, TaroElement, TaroAny } from '@tarojs/runtime'
|
|
|
5
5
|
@Component
|
|
6
6
|
export default struct TaroStickySection {
|
|
7
7
|
@Builder customBuilder() {}
|
|
8
|
-
@BuilderParam createLazyChildren: (node: TaroViewElement) => void = this.customBuilder
|
|
8
|
+
@BuilderParam createLazyChildren: (node: TaroViewElement, layer?: number) => void = this.customBuilder
|
|
9
9
|
@ObjectLink node: TaroViewElement
|
|
10
10
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
11
11
|
|
|
@@ -20,7 +20,7 @@ export default struct TaroStickySection {
|
|
|
20
20
|
Stack() {
|
|
21
21
|
LazyForEach(header, (item: TaroElement) => {
|
|
22
22
|
if (item.tagName === 'STICKY-HEADER') {
|
|
23
|
-
this.createLazyChildren(item as TaroViewElement)
|
|
23
|
+
this.createLazyChildren(item as TaroViewElement, 0)
|
|
24
24
|
}
|
|
25
25
|
}, (item: TaroElement) => `${item._nid}-${item._nodeInfo?.layer || 0}`)
|
|
26
26
|
}
|
|
@@ -32,7 +32,7 @@ export default struct TaroStickySection {
|
|
|
32
32
|
}) {
|
|
33
33
|
ForEach(this.node.children, (item: TaroElement) => {
|
|
34
34
|
if (item.tagName === 'LIST-VIEW') {
|
|
35
|
-
this.createLazyChildren(item as TaroViewElement)
|
|
35
|
+
this.createLazyChildren(item as TaroViewElement, 0)
|
|
36
36
|
}
|
|
37
37
|
}, (item: TaroElement) => `${item._nid}-${item._nodeInfo?.layer || 0}`)
|
|
38
38
|
|
|
@@ -48,7 +48,7 @@ function getSwiperAttributes (node: TaroSwiperElement): SwiperAttrs {
|
|
|
48
48
|
@Component
|
|
49
49
|
export default struct TaroSwiper {
|
|
50
50
|
@Builder customBuilder() {}
|
|
51
|
-
@BuilderParam createLazyChildren: (node: TaroSwiperElement) => void = this.customBuilder
|
|
51
|
+
@BuilderParam createLazyChildren: (node: TaroSwiperElement, layer?: number) => void = this.customBuilder
|
|
52
52
|
@ObjectLink node: TaroSwiperElement
|
|
53
53
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
54
54
|
|
|
@@ -60,7 +60,7 @@ export default struct TaroSwiper {
|
|
|
60
60
|
|
|
61
61
|
build () {
|
|
62
62
|
Swiper(this.node.controller) {
|
|
63
|
-
this.createLazyChildren(this.node)
|
|
63
|
+
this.createLazyChildren(this.node, 0)
|
|
64
64
|
}
|
|
65
65
|
.attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
66
66
|
.swiperAttr(getSwiperAttributes(this.node))
|
|
@@ -72,7 +72,7 @@ export default struct TaroSwiper {
|
|
|
72
72
|
const event: TaroEvent = createTaroEvent('change', { detail: { current: index } }, this.node)
|
|
73
73
|
eventHandler(event, 'change', this.node)
|
|
74
74
|
})
|
|
75
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
75
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
76
76
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
77
77
|
this.node._nodeInfo.areaInfo = res[1]
|
|
78
78
|
}))
|
|
@@ -31,7 +31,7 @@ function themeStyles(isDisabled: boolean) {
|
|
|
31
31
|
@Component
|
|
32
32
|
export default struct TaroSwitch {
|
|
33
33
|
@Builder customBuilder() {}
|
|
34
|
-
@BuilderParam createLazyChildren: (node: TaroSwitchElement) => void = this.customBuilder
|
|
34
|
+
@BuilderParam createLazyChildren: (node: TaroSwitchElement, layer?: number) => void = this.customBuilder
|
|
35
35
|
@ObjectLink node: TaroSwitchElement
|
|
36
36
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
37
37
|
|
|
@@ -63,7 +63,7 @@ export default struct TaroSwitch {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
})
|
|
66
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
66
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
67
67
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
68
68
|
if (this.node) {
|
|
69
69
|
this.node._nodeInfo.areaInfo = res[1]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isString } from '@tarojs/shared'
|
|
2
2
|
import { eventHandler, convertNumber2VP, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME, NodeType } from '@tarojs/runtime'
|
|
3
3
|
|
|
4
|
-
import { textModify, setNormalTextAttributeIntoInstance } from './style'
|
|
4
|
+
import commonStyleModify, { textModify, setNormalTextAttributeIntoInstance } from './style'
|
|
5
5
|
import { getButtonColor } from './button'
|
|
6
6
|
import { getImageMode } from './image'
|
|
7
7
|
import { BUTTON_THEME_COLOR } from './utils/constant/style'
|
|
@@ -30,7 +30,7 @@ function getTextInViewWidth (node: TaroElement | null): TaroAny {
|
|
|
30
30
|
@Component
|
|
31
31
|
export default struct TaroText {
|
|
32
32
|
@Builder customBuilder() {}
|
|
33
|
-
@BuilderParam createLazyChildren: (node: TaroTextElement) => void = this.customBuilder
|
|
33
|
+
@BuilderParam createLazyChildren: (node: TaroTextElement, layer?: number) => void = this.customBuilder
|
|
34
34
|
@ObjectLink node: TaroTextElement
|
|
35
35
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
36
36
|
|
|
@@ -60,11 +60,33 @@ export default struct TaroText {
|
|
|
60
60
|
// text 下还有标签
|
|
61
61
|
if (this.node.childNodes.length > 1 || ((this.node.childNodes[0] && this.node.childNodes[0] as TaroElement)?.nodeType === NodeType.ELEMENT_NODE)) {
|
|
62
62
|
ForEach(this.node.childNodes, (item: TaroElement) => {
|
|
63
|
-
|
|
63
|
+
if (item.tagName === 'IMAGE') {
|
|
64
|
+
ImageSpan(item.getAttribute('src'))
|
|
65
|
+
.attributeModifier(commonStyleModify.setNode(item))
|
|
66
|
+
.objectFit(getImageMode(item.getAttribute('mode')))
|
|
67
|
+
.verticalAlign(getImageSpanAlignment(this.node?.hmStyle?.verticalAlign))
|
|
68
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', item) }, item, ['click']))
|
|
69
|
+
} else if (item.nodeType === NodeType.TEXT_NODE) {
|
|
70
|
+
Span(item.textContent)
|
|
71
|
+
} else if (item.tagName === 'TEXT') {
|
|
72
|
+
Span(item.textContent)
|
|
73
|
+
.attributeModifier(spanModify.setNode(item))
|
|
74
|
+
.letterSpacing(item._st.hmStyle.letterSpacing)
|
|
75
|
+
.textBackgroundStyle({
|
|
76
|
+
color: item._st.hmStyle.backgroundColor,
|
|
77
|
+
radius: {
|
|
78
|
+
topLeft: item._st.hmStyle.borderTopLeftRadius,
|
|
79
|
+
topRight: item._st.hmStyle.borderTopRightRadius,
|
|
80
|
+
bottomLeft: item._st.hmStyle.borderBottomLeftRadius,
|
|
81
|
+
bottomRight: item._st.hmStyle.borderBottomRightRadius,
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', item) }, item, ['click']))
|
|
85
|
+
}
|
|
64
86
|
}, (item: TaroElement) => `${item._nid}${this.node._updateTrigger}`)
|
|
65
87
|
}
|
|
66
88
|
}
|
|
67
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
89
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
68
90
|
.attributeModifier(textModify.setNode(this.node).withNormalStyle().setAnimationStyle(this.overwriteStyle))
|
|
69
91
|
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
70
92
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
@@ -74,59 +96,13 @@ export default struct TaroText {
|
|
|
74
96
|
}
|
|
75
97
|
}
|
|
76
98
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
.width(item._st.hmStyle.width)
|
|
85
|
-
.height(item._st.hmStyle.height)
|
|
86
|
-
.margin({
|
|
87
|
-
top: item._st.hmStyle.marginTop,
|
|
88
|
-
left: item._st.hmStyle.marginLeft,
|
|
89
|
-
right: item._st.hmStyle.marginRight,
|
|
90
|
-
bottom: item._st.hmStyle.marginBottom,
|
|
91
|
-
})
|
|
92
|
-
.padding({
|
|
93
|
-
top: item._st.hmStyle.paddingTop,
|
|
94
|
-
left: item._st.hmStyle.paddingLeft,
|
|
95
|
-
right: item._st.hmStyle.paddingRight,
|
|
96
|
-
bottom: item._st.hmStyle.paddingBottom,
|
|
97
|
-
})
|
|
98
|
-
.textBackgroundStyle({
|
|
99
|
-
color: item._st.hmStyle.backgroundColor,
|
|
100
|
-
radius: {
|
|
101
|
-
topLeft: item._st.hmStyle.borderTopLeftRadius,
|
|
102
|
-
topRight: item._st.hmStyle.borderTopRightRadius,
|
|
103
|
-
bottomLeft: item._st.hmStyle.borderBottomLeftRadius,
|
|
104
|
-
bottomRight: item._st.hmStyle.borderBottomRightRadius,
|
|
105
|
-
}
|
|
106
|
-
})
|
|
107
|
-
.borderRadius({
|
|
108
|
-
topLeft: item._st.hmStyle.borderTopLeftRadius,
|
|
109
|
-
topRight: item._st.hmStyle.borderTopRightRadius,
|
|
110
|
-
bottomLeft: item._st.hmStyle.borderBottomLeftRadius,
|
|
111
|
-
bottomRight: item._st.hmStyle.borderBottomRightRadius
|
|
112
|
-
})
|
|
113
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', item), item, ['click']))
|
|
114
|
-
} else if (item.nodeType === NodeType.TEXT_NODE) {
|
|
115
|
-
Span(item.textContent)
|
|
116
|
-
} else if (item.tagName === 'TEXT') {
|
|
117
|
-
Span(item.textContent)
|
|
118
|
-
.attributeModifier(spanModify.setNode(item))
|
|
119
|
-
.letterSpacing(item._st.hmStyle.letterSpacing)
|
|
120
|
-
.textBackgroundStyle({
|
|
121
|
-
color: item._st.hmStyle.backgroundColor,
|
|
122
|
-
radius: {
|
|
123
|
-
topLeft: item._st.hmStyle.borderTopLeftRadius,
|
|
124
|
-
topRight: item._st.hmStyle.borderTopRightRadius,
|
|
125
|
-
bottomLeft: item._st.hmStyle.borderBottomLeftRadius,
|
|
126
|
-
bottomRight: item._st.hmStyle.borderBottomRightRadius,
|
|
127
|
-
}
|
|
128
|
-
})
|
|
129
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', item), item, ['click']))
|
|
99
|
+
function getImageSpanAlignment (align: TaroAny): TaroAny {
|
|
100
|
+
if (align === Alignment.Top) {
|
|
101
|
+
return ImageSpanAlignment.TOP
|
|
102
|
+
} else if (align === Alignment.Bottom) {
|
|
103
|
+
return ImageSpanAlignment.BOTTOM
|
|
104
|
+
} else if (align === Alignment.Center) {
|
|
105
|
+
return ImageSpanAlignment.CENTER
|
|
130
106
|
}
|
|
131
107
|
}
|
|
132
108
|
|
|
@@ -45,7 +45,7 @@ export default struct TaroTextArea {
|
|
|
45
45
|
@State value: string = ''
|
|
46
46
|
|
|
47
47
|
@Builder customBuilder() {}
|
|
48
|
-
@BuilderParam createLazyChildren: (node: TaroTextAreaElement) => void = this.customBuilder
|
|
48
|
+
@BuilderParam createLazyChildren: (node: TaroTextAreaElement, layer?: number) => void = this.customBuilder
|
|
49
49
|
@ObjectLink node: TaroTextAreaElement
|
|
50
50
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
51
51
|
|
|
@@ -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))
|
|
@@ -76,7 +76,7 @@ export default struct TaroTextArea {
|
|
|
76
76
|
this.node?.updateFormWidgetValue(value)
|
|
77
77
|
eventHandler(event, 'input', this.node)
|
|
78
78
|
})
|
|
79
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
79
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
80
80
|
.onBlur(() => {
|
|
81
81
|
const event: TaroEvent = createTaroEvent('blur', { detail: { value: this.value } }, this.node)
|
|
82
82
|
eventHandler(event, 'blur', this.node)
|
|
@@ -140,7 +140,7 @@ class AttributeManager {
|
|
|
140
140
|
}
|
|
141
141
|
let resultTransform: matrix4.Matrix4Transit
|
|
142
142
|
|
|
143
|
-
const matches = transform.match(new RegExp("/(\w+)\(([^)]+)\)/g")) || [];
|
|
143
|
+
const matches: string[] = transform.match(new RegExp("/(\w+)\(([^)]+)\)/g")) || [];
|
|
144
144
|
|
|
145
145
|
// 处理matrix
|
|
146
146
|
|
|
@@ -2,8 +2,7 @@ import { VIEW } from '@tarojs/runtime/dist/runtime.esm'
|
|
|
2
2
|
|
|
3
3
|
import { getNormalAttributes, getFontAttributes, getStyleAttr } from './styles'
|
|
4
4
|
|
|
5
|
-
import type {
|
|
6
|
-
import type { TaroElement, TaroNode } from '@tarojs/runtime'
|
|
5
|
+
import type { TaroElement, TaroNode, TaroAny } from '@tarojs/runtime'
|
|
7
6
|
|
|
8
7
|
export const parseStyles = (styles = ''): Record<string, string> => {
|
|
9
8
|
const styleObj: Record<string, string> = {}
|
|
@@ -11,7 +10,7 @@ export const parseStyles = (styles = ''): Record<string, string> => {
|
|
|
11
10
|
.split(';')
|
|
12
11
|
.filter((style) => style.split(':').length === 2)
|
|
13
12
|
.map((style) => [
|
|
14
|
-
style.split(':')[0].trim().replace(new RegExp("
|
|
13
|
+
style.split(':')[0].trim().replace(new RegExp("-([a-z])", "g"), (_, letter: string): string => letter.toUpperCase()),
|
|
15
14
|
style.split(':')[1].trim()
|
|
16
15
|
])
|
|
17
16
|
.forEach((style) => {
|
|
@@ -22,7 +21,7 @@ export const parseStyles = (styles = ''): Record<string, string> => {
|
|
|
22
21
|
return styleObj
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
export function shouldBindEvent (cb:
|
|
24
|
+
export function shouldBindEvent (cb: TaroAny, node: TaroElement | null, eventNames: string[], disabled = false): TaroAny {
|
|
26
25
|
if (!node || node._attrs?.disabled || disabled) return null
|
|
27
26
|
if (!node.__listeners) {
|
|
28
27
|
return null
|
|
@@ -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) {
|
|
@@ -81,7 +81,7 @@ function handleUpdate (node: TaroVideoElement, e: VideoUpdateEvent) {
|
|
|
81
81
|
@Component
|
|
82
82
|
export default struct TaroVideo {
|
|
83
83
|
@Builder customBuilder() {}
|
|
84
|
-
@BuilderParam createLazyChildren: (node: TaroVideoElement) => void = this.customBuilder
|
|
84
|
+
@BuilderParam createLazyChildren: (node: TaroVideoElement, layer?: number) => void = this.customBuilder
|
|
85
85
|
@ObjectLink node: TaroVideoElement
|
|
86
86
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
87
87
|
|
|
@@ -105,7 +105,7 @@ export default struct TaroVideo {
|
|
|
105
105
|
.onSeeked(shouldBindEvent(() => { emitEvent(this.node, 'seeked') }, this.node, ['seeked']))
|
|
106
106
|
.onFullscreenChange(shouldBindEvent((e: TaroAny) => { emitEvent(this.node, 'fullScreenChange', { fullScreen: e.fullscreen}) }, this.node, ['fullscreenchange']))
|
|
107
107
|
.onClick((e: ClickEvent) => { eventHandler(e, 'click', this.node) })
|
|
108
|
-
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
108
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => { eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node) }, this.node, TOUCH_EVENT_MAP.values()))
|
|
109
109
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
110
110
|
this.node._nodeInfo.areaInfo = res[1]
|
|
111
111
|
}))
|
|
@@ -12,7 +12,7 @@ import { isUndefined } from '@tarojs/shared'
|
|
|
12
12
|
@Component
|
|
13
13
|
export default struct TaroView {
|
|
14
14
|
@Builder customBuilder() {}
|
|
15
|
-
@BuilderParam createLazyChildren: (node: TaroViewElement) => void = this.customBuilder
|
|
15
|
+
@BuilderParam createLazyChildren: (node: TaroViewElement, layer?: number) => void = this.customBuilder
|
|
16
16
|
@ObjectLink node: TaroViewElement
|
|
17
17
|
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
18
18
|
|
|
@@ -28,12 +28,12 @@ export default struct TaroView {
|
|
|
28
28
|
if (this.node._pseudo_before || this.node._pseudo_after) {
|
|
29
29
|
PseduoChildren({ node: this.node, createLazyChildren: this.createLazyChildren })
|
|
30
30
|
} else {
|
|
31
|
-
this.createLazyChildren(this.node)
|
|
31
|
+
this.createLazyChildren(this.node, 0)
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
.attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
35
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
36
|
-
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
35
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
36
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => { eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node) }, this.node, TOUCH_EVENT_MAP.values()))
|
|
37
37
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
38
38
|
this.node._nodeInfo.areaInfo = res[1]
|
|
39
39
|
}))
|
|
@@ -43,12 +43,12 @@ export default struct TaroView {
|
|
|
43
43
|
if (this.node._pseudo_before || this.node._pseudo_after) {
|
|
44
44
|
PseduoChildren({ node: this.node, createLazyChildren: this.createLazyChildren })
|
|
45
45
|
} else {
|
|
46
|
-
this.createLazyChildren(this.node)
|
|
46
|
+
this.createLazyChildren(this.node, 0)
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
.attributeModifier(rowModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
50
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
51
|
-
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
50
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
51
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => { eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node) }, this.node, TOUCH_EVENT_MAP.values()))
|
|
52
52
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
53
53
|
this.node._nodeInfo.areaInfo = res[1]
|
|
54
54
|
}))
|
|
@@ -58,12 +58,12 @@ export default struct TaroView {
|
|
|
58
58
|
if (this.node._pseudo_before || this.node._pseudo_after) {
|
|
59
59
|
PseduoChildren({ node: this.node, createLazyChildren: this.createLazyChildren })
|
|
60
60
|
} else {
|
|
61
|
-
this.createLazyChildren(this.node)
|
|
61
|
+
this.createLazyChildren(this.node, 0)
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
.attributeModifier(columnModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
65
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
66
|
-
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
65
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
66
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => { eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node) }, this.node, TOUCH_EVENT_MAP.values()))
|
|
67
67
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
68
68
|
this.node._nodeInfo.areaInfo = res[1]
|
|
69
69
|
}))
|
|
@@ -17,7 +17,7 @@ interface IError {
|
|
|
17
17
|
@Component
|
|
18
18
|
export default struct TaroWebView {
|
|
19
19
|
@Builder customBuilder() {}
|
|
20
|
-
@BuilderParam createLazyChildren: (node: TaroWebViewElement) => void = this.customBuilder
|
|
20
|
+
@BuilderParam createLazyChildren: (node: TaroWebViewElement, layer?: number) => void = this.customBuilder
|
|
21
21
|
@ObjectLink node: TaroWebViewElement
|
|
22
22
|
|
|
23
23
|
build () {
|
|
@@ -47,7 +47,7 @@ export default struct TaroWebView {
|
|
|
47
47
|
|
|
48
48
|
eventHandler(event, 'error', this.node)
|
|
49
49
|
}, this.node, ['error']))
|
|
50
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
50
|
+
.onClick(shouldBindEvent((e: ClickEvent) => { eventHandler(e, 'click', this.node) }, this.node, ['click']))
|
|
51
51
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
52
52
|
this.node._nodeInfo.areaInfo = res[1]
|
|
53
53
|
}))
|
package/dist/index.js
CHANGED
|
@@ -487,7 +487,9 @@ let Harmony$1 = class Harmony extends TaroPlatformHarmony {
|
|
|
487
487
|
}
|
|
488
488
|
if (this.extensions.includes(path__namespace.extname(lib))) {
|
|
489
489
|
// Note: 查询 externals 内的依赖,并将它们添加到 externalDeps 中
|
|
490
|
-
code = code.replace(/(?:import\s|from\s|require\()['"]([^\\/.][^'"\s]+)['"]\)?/g, (src, p1) => {
|
|
490
|
+
code = code.replace(/(?:import\s|from\s|require\()['"]([^\\/.][^'"\s]+)['"]\)?/g, (src, p1 = '') => {
|
|
491
|
+
if (p1.startsWith('node:') || p1.endsWith('.so'))
|
|
492
|
+
return src;
|
|
491
493
|
const { outputRoot } = this.ctx.runOpts.config;
|
|
492
494
|
const targetPath = path__namespace.join(outputRoot, helper.NODE_MODULES, p1);
|
|
493
495
|
const relativePath = parseRelativePath(path__namespace.dirname(target), targetPath);
|
|
@@ -595,7 +597,7 @@ declare global {
|
|
|
595
597
|
const chorePkgRgx = new RegExp(`^${(chorePackagePrefix || '').replace(/[\\/]+/g, '[\\\\/]+').replace(/[-^$*?.|]/g, '\\$&')}`);
|
|
596
598
|
const externals = Object.keys(ohPackage.dependencies || []).concat(Object.keys(ohPackage.devDependencies || []));
|
|
597
599
|
function modifyResolveId({ source = '', name = 'modifyResolveId' }) {
|
|
598
|
-
if (externals.includes(source) || chorePkgRgx.test(source)) {
|
|
600
|
+
if (externals.includes(source) || (chorePackagePrefix && chorePkgRgx.test(source))) {
|
|
599
601
|
return {
|
|
600
602
|
external: true,
|
|
601
603
|
id: source,
|