@tarojs/plugin-platform-harmony-ets 4.0.0-beta.36 → 4.0.0-beta.38

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.
Files changed (33) hide show
  1. package/dist/apis/index.ts +2 -1
  2. package/dist/components-harmony-ets/button.ets +30 -32
  3. package/dist/components-harmony-ets/checkbox.ets +52 -56
  4. package/dist/components-harmony-ets/form.ets +25 -27
  5. package/dist/components-harmony-ets/icon.ets +17 -19
  6. package/dist/components-harmony-ets/image.ets +9 -11
  7. package/dist/components-harmony-ets/input.ets +36 -38
  8. package/dist/components-harmony-ets/label.ets +36 -38
  9. package/dist/components-harmony-ets/movableArea.ets +55 -57
  10. package/dist/components-harmony-ets/movableView.ets +44 -46
  11. package/dist/components-harmony-ets/picker.ets +15 -17
  12. package/dist/components-harmony-ets/progress.ets +22 -24
  13. package/dist/components-harmony-ets/radio.ets +54 -58
  14. package/dist/components-harmony-ets/richText.ets +7 -9
  15. package/dist/components-harmony-ets/scrollView.ets +47 -49
  16. package/dist/components-harmony-ets/slider.ets +8 -10
  17. package/dist/components-harmony-ets/style.ets +8 -0
  18. package/dist/components-harmony-ets/swiper.ets +17 -19
  19. package/dist/components-harmony-ets/switch.ets +24 -26
  20. package/dist/components-harmony-ets/text.ets +13 -15
  21. package/dist/components-harmony-ets/textArea.ets +28 -30
  22. package/dist/components-harmony-ets/video.ets +19 -21
  23. package/dist/components-harmony-ets/view.ets +31 -33
  24. package/dist/components-harmony-ets/webView.ets +30 -32
  25. package/dist/runtime-ets/dom/document.ts +2 -0
  26. package/dist/runtime-ets/dom/element/element.ts +45 -1
  27. package/dist/runtime-ets/dom/node.ts +11 -7
  28. package/dist/runtime-ets/dom/stylesheet/type.ts +1 -0
  29. package/dist/runtime-utils.js +5 -46
  30. package/dist/runtime-utils.js.map +1 -1
  31. package/dist/runtime.js +5 -46
  32. package/dist/runtime.js.map +1 -1
  33. package/package.json +9 -9
@@ -17,80 +17,78 @@ export default struct TaroMovableArea {
17
17
  }
18
18
 
19
19
  build() {
20
- if (this.node && this.node.hmStyle?.display !== 'none') {
21
- if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node).direction !== FlexDirection.Column) {
22
- Row() {
23
- this.createLazyChildren(this.node)
24
- }
25
- .attributeModifier(rowModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
26
- .alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
27
- .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
28
- .clip(true)
29
- .onAreaChange((oldValue: Area, newValue: Area) => {
20
+ if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node).direction !== FlexDirection.Column) {
21
+ Row() {
22
+ this.createLazyChildren(this.node)
23
+ }
24
+ .attributeModifier(rowModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
25
+ .alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
26
+ .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
27
+ .clip(true)
28
+ .onAreaChange((oldValue: Area, newValue: Area) => {
29
+ this.node.childNodes.forEach(item => {
30
+ if(item.nodeName === 'MOVABLE-VIEW') {
31
+ ;(item as TaroMovableViewElement).area = {
32
+ w: Number( newValue.width),
33
+ h: Number(newValue.height)
34
+ }
35
+ }
36
+ })
37
+ })
38
+ .gesture(
39
+ PinchGesture({ fingers: 2 }).onActionStart((event: GestureEvent) => {
30
40
  this.node.childNodes.forEach(item => {
31
41
  if(item.nodeName === 'MOVABLE-VIEW') {
32
- ;(item as TaroMovableViewElement).area = {
33
- w: Number( newValue.width),
34
- h: Number(newValue.height)
35
- }
42
+ ;(item as TaroMovableViewElement).startScale()
36
43
  }
37
44
  })
38
- })
39
- .gesture(
40
- PinchGesture({ fingers: 2 }).onActionStart((event: GestureEvent) => {
45
+ }).onActionUpdate((event) => {
46
+ const scaleArea = this.node.getAttribute('scaleArea')
47
+ if (scaleArea) {
41
48
  this.node.childNodes.forEach(item => {
42
49
  if(item.nodeName === 'MOVABLE-VIEW') {
43
- ;(item as TaroMovableViewElement).startScale()
50
+ ;(item as TaroMovableViewElement).doScale(event.scale)
44
51
  }
45
52
  })
46
- }).onActionUpdate((event) => {
47
- const scaleArea = this.node.getAttribute('scaleArea')
48
- if (scaleArea) {
49
- this.node.childNodes.forEach(item => {
50
- if(item.nodeName === 'MOVABLE-VIEW') {
51
- ;(item as TaroMovableViewElement).doScale(event.scale)
52
- }
53
- })
53
+ }
54
+ })
55
+ )
56
+ } else {
57
+ Column() {
58
+ this.createLazyChildren(this.node)
59
+ }
60
+ .attributeModifier(columnModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
61
+ .alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
62
+ .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
63
+ .clip(true)
64
+ .onAreaChange((oldValue: Area, newValue: Area) => {
65
+ this.node.childNodes.forEach(item => {
66
+ if(item.nodeName === 'MOVABLE-VIEW') {
67
+ ;(item as TaroMovableViewElement).area = {
68
+ w: Number( newValue.width),
69
+ h: Number(newValue.height)
54
70
  }
55
- })
56
- )
57
- } else {
58
- Column() {
59
- this.createLazyChildren(this.node)
60
- }
61
- .attributeModifier(columnModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
62
- .alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
63
- .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
64
- .clip(true)
65
- .onAreaChange((oldValue: Area, newValue: Area) => {
71
+ }
72
+ })
73
+ })
74
+ .gesture(
75
+ PinchGesture({ fingers: 2 }).onActionStart((event: GestureEvent) => {
66
76
  this.node.childNodes.forEach(item => {
67
77
  if(item.nodeName === 'MOVABLE-VIEW') {
68
- ;(item as TaroMovableViewElement).area = {
69
- w: Number( newValue.width),
70
- h: Number(newValue.height)
71
- }
78
+ ;(item as TaroMovableViewElement).startScale()
72
79
  }
73
80
  })
74
- })
75
- .gesture(
76
- PinchGesture({ fingers: 2 }).onActionStart((event: GestureEvent) => {
81
+ }).onActionUpdate((event) => {
82
+ const scaleArea = this.node.getAttribute('scaleArea')
83
+ if (scaleArea) {
77
84
  this.node.childNodes.forEach(item => {
78
85
  if(item.nodeName === 'MOVABLE-VIEW') {
79
- ;(item as TaroMovableViewElement).startScale()
86
+ ;(item as TaroMovableViewElement).doScale(event.scale)
80
87
  }
81
88
  })
82
- }).onActionUpdate((event) => {
83
- const scaleArea = this.node.getAttribute('scaleArea')
84
- if (scaleArea) {
85
- this.node.childNodes.forEach(item => {
86
- if(item.nodeName === 'MOVABLE-VIEW') {
87
- ;(item as TaroMovableViewElement).doScale(event.scale)
88
- }
89
- })
90
- }
91
- })
92
- )
93
- }
89
+ }
90
+ })
91
+ )
94
92
  }
95
93
  }
96
94
  }
@@ -18,57 +18,55 @@ export default struct TaroMovableView {
18
18
  }
19
19
 
20
20
  build() {
21
- if (this.node && this.node.hmStyle?.display !== 'none') {
22
- Stack() {
23
- if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node)
24
- .direction !== FlexDirection.Column) {
25
- Row() {
26
- this.createLazyChildren(this.node)
27
- }
28
- .attributeModifier(rowModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
29
- .alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
30
- .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
31
- } else {
32
- Column() {
33
- this.createLazyChildren(this.node)
34
- }
35
- .attributeModifier(columnModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
36
- .alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
37
- .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
21
+ Stack() {
22
+ if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node)
23
+ .direction !== FlexDirection.Column) {
24
+ Row() {
25
+ this.createLazyChildren(this.node)
38
26
  }
27
+ .attributeModifier(rowModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
28
+ .alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
29
+ .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
30
+ } else {
31
+ Column() {
32
+ this.createLazyChildren(this.node)
33
+ }
34
+ .attributeModifier(columnModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
35
+ .alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
36
+ .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
39
37
  }
40
- .translate({ x: this.node.position.x, y: this.node.position.y })
41
- .scale({ x: this.node.scaleValue, y: this.node.scaleValue })
42
- .onAreaChange((oldValue: Area, newValue: Area) => {
43
- this.node.selfSize = {w: Number(newValue.width), h: Number(newValue.height)}
44
- })
45
- .gesture(
46
- GestureGroup(GestureMode.Exclusive,
47
- PanGesture({fingers:1}).onActionStart((e: GestureEvent) => {
48
-
49
- this.node.startMove()
50
- }).onActionUpdate((e: GestureEvent) => {
38
+ }
39
+ .translate({ x: this.node.position.x, y: this.node.position.y })
40
+ .scale({ x: this.node.scaleValue, y: this.node.scaleValue })
41
+ .onAreaChange((oldValue: Area, newValue: Area) => {
42
+ this.node.selfSize = {w: Number(newValue.width), h: Number(newValue.height)}
43
+ })
44
+ .gesture(
45
+ GestureGroup(GestureMode.Exclusive,
46
+ PanGesture({fingers:1}).onActionStart((e: GestureEvent) => {
51
47
 
52
- this.node.doMove({
53
- x: e.offsetX,
54
- y: e.offsetY
55
- })
56
- // 事件处理
57
- const bindchange = this.node.getAttribute('bindchange')
58
- if (typeof bindchange === 'function') {
59
- }
48
+ this.node.startMove()
49
+ }).onActionUpdate((e: GestureEvent) => {
60
50
 
61
- }).onActionEnd(() => {
62
- // this.updatePosition()
63
- this.node.checkPositionBoundary(this.node.position, this.node.scaleValue)
64
- }),
65
- PinchGesture({ fingers: 2 }).onActionStart((event: GestureEvent) => {
66
- this.node.startScale()
67
- }).onActionUpdate((event) => {
68
- this.node.doScale(event.scale)
51
+ this.node.doMove({
52
+ x: e.offsetX,
53
+ y: e.offsetY
69
54
  })
70
- )
55
+ // 事件处理
56
+ const bindchange = this.node.getAttribute('bindchange')
57
+ if (typeof bindchange === 'function') {
58
+ }
59
+
60
+ }).onActionEnd(() => {
61
+ // this.updatePosition()
62
+ this.node.checkPositionBoundary(this.node.position, this.node.scaleValue)
63
+ }),
64
+ PinchGesture({ fingers: 2 }).onActionStart((event: GestureEvent) => {
65
+ this.node.startScale()
66
+ }).onActionUpdate((event) => {
67
+ this.node.doScale(event.scale)
68
+ })
71
69
  )
72
- }
70
+ )
73
71
  }
74
72
  }
@@ -311,24 +311,22 @@ export default struct TaroPicker {
311
311
  }
312
312
 
313
313
  build() {
314
- if (this.node && this.node.hmStyle?.display !== 'none') {
315
- if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node).direction !== FlexDirection.Column) {
316
- Row() {
317
- this.createLazyChildren(this.node)
318
- }
319
- .defaultEvent()
320
- .visibleChangeEvent()
321
- .alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
322
- .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
323
- } else {
324
- Column() {
325
- this.createLazyChildren(this.node)
326
- }
327
- .defaultEvent()
328
- .visibleChangeEvent()
329
- .alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
330
- .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
314
+ if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node).direction !== FlexDirection.Column) {
315
+ Row() {
316
+ this.createLazyChildren(this.node)
317
+ }
318
+ .defaultEvent()
319
+ .visibleChangeEvent()
320
+ .alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
321
+ .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
322
+ } else {
323
+ Column() {
324
+ this.createLazyChildren(this.node)
331
325
  }
326
+ .defaultEvent()
327
+ .visibleChangeEvent()
328
+ .alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
329
+ .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
332
330
  }
333
331
  }
334
332
  }
@@ -21,33 +21,31 @@ export default struct TaroProgress {
21
21
  }
22
22
 
23
23
  build() {
24
- if (this.node && this.node.hmStyle?.display !== 'none') {
25
- Row({ space: 5 }) {
26
- Progress({
27
- value: parseFloat(this.node.getAttribute('percent')),
28
- type: ProgressType.Linear
24
+ Row({ space: 5 }) {
25
+ Progress({
26
+ value: parseFloat(this.node.getAttribute('percent')),
27
+ type: ProgressType.Linear
28
+ })
29
+ .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
30
+ .color(this.node.getAttribute('activeColor') ?? PROGRESS_ACTIVECOLOR)
31
+ .backgroundColor(this.node.getAttribute('backgroundColor') ?? PROGRESS_BACKGROUNDCOLOR)
32
+ .style({
33
+ strokeWidth: this.node.getAttribute('strokeWidth'),
34
+ strokeRadius: parseFloat(this.node.getAttribute('borderRadius')),
35
+ enableSmoothEffect: Boolean(this.node.getAttribute('active')),
29
36
  })
30
- .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
31
- .color(this.node.getAttribute('activeColor') ?? PROGRESS_ACTIVECOLOR)
32
- .backgroundColor(this.node.getAttribute('backgroundColor') ?? PROGRESS_BACKGROUNDCOLOR)
33
- .style({
34
- strokeWidth: this.node.getAttribute('strokeWidth'),
35
- strokeRadius: parseFloat(this.node.getAttribute('borderRadius')),
36
- enableSmoothEffect: Boolean(this.node.getAttribute('active')),
37
- })
38
37
 
39
- .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
40
- .onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
41
- .onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
42
- if (this.node) {
43
- this.node._nodeInfo.areaInfo = res[1]
44
- }
45
- }))
38
+ .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
39
+ .onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
40
+ .onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
41
+ if (this.node) {
42
+ this.node._nodeInfo.areaInfo = res[1]
43
+ }
44
+ }))
46
45
 
47
- if (this.node.getAttribute('showInfo')) {
48
- Text(`${this.node.getAttribute('percent')}%`)
49
- .fontSize(this.node.getAttribute('fontSize') ?? PROGRESS_DEFAULTINFOFONTSIZE)
50
- }
46
+ if (this.node.getAttribute('showInfo')) {
47
+ Text(`${this.node.getAttribute('percent')}%`)
48
+ .fontSize(this.node.getAttribute('fontSize') ?? PROGRESS_DEFAULTINFOFONTSIZE)
51
49
  }
52
50
  }
53
51
  }
@@ -48,49 +48,47 @@ export struct TaroRadio {
48
48
  }
49
49
 
50
50
  build () {
51
- if (this.node && this.node.hmStyle?.display !== 'none') {
52
- Stack() {
53
- Row() {
54
- Radio({
55
- group: this.node.group || this.node.parentNode?._nid || '',
56
- value: this.node.value || '',
57
- })
58
- .checked(this.node.checked)
59
- .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
60
- .radioAttr(getAttributes(this.node))
61
- .onChange((value: boolean) => {
62
- if (this.node) {
63
- if (!!this.node?._attrs.disabled) {
64
- this.node.updateComponent()
65
- } else {
66
- this.node.updateCheckedValue(value)
67
-
68
- if (value) {
69
- const event: TaroEvent = createTaroEvent('change', { detail: { value: this.node?._attrs.value } }, this.node)
70
- eventHandler(event, 'change', this.node)
71
- }
51
+ Stack() {
52
+ Row() {
53
+ Radio({
54
+ group: this.node.group || this.node.parentNode?._nid || '',
55
+ value: this.node.value || '',
56
+ })
57
+ .checked(this.node.checked)
58
+ .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
59
+ .radioAttr(getAttributes(this.node))
60
+ .onChange((value: boolean) => {
61
+ if (this.node) {
62
+ if (!!this.node?._attrs.disabled) {
63
+ this.node.updateComponent()
64
+ } else {
65
+ this.node.updateCheckedValue(value)
66
+
67
+ if (value) {
68
+ const event: TaroEvent = createTaroEvent('change', { detail: { value: this.node?._attrs.value } }, this.node)
69
+ eventHandler(event, 'change', this.node)
72
70
  }
73
71
  }
74
- })
75
- .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
76
- .onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
77
- if (this.node) {
78
- this.node._nodeInfo.areaInfo = res[1]
79
- }
80
- }))
81
- .onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
82
- Text(this.node.textContent)
83
- .textAlign(TextAlign.Center)
84
- .opacity(!!this.node?._attrs.disabled ? 0.4 : 1)
85
- }
86
- .onClick(() => {
87
- if (this.node) {
88
- if (!this.node._checked && !this.node?._attrs.disabled) {
89
- this.node.checked = !this.node.checked
90
72
  }
91
- }
92
- })
73
+ })
74
+ .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
75
+ .onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
76
+ if (this.node) {
77
+ this.node._nodeInfo.areaInfo = res[1]
78
+ }
79
+ }))
80
+ .onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
81
+ Text(this.node.textContent)
82
+ .textAlign(TextAlign.Center)
83
+ .opacity(!!this.node?._attrs.disabled ? 0.4 : 1)
93
84
  }
85
+ .onClick(() => {
86
+ if (this.node) {
87
+ if (!this.node._checked && !this.node?._attrs.disabled) {
88
+ this.node.checked = !this.node.checked
89
+ }
90
+ }
91
+ })
94
92
  }
95
93
  }
96
94
  }
@@ -130,26 +128,24 @@ export struct TaroRadioGroup {
130
128
  }
131
129
 
132
130
  build() {
133
- if (this.node && this.node.hmStyle?.display !== 'none') {
134
- if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node).direction !== FlexDirection.Column) {
135
- Row() {
136
- this.createLazyChildren(this.node)
137
- }
138
- .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
139
- .defaultEvent()
140
- .visibleChangeEvent()
141
- .alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
142
- .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
143
- } else {
144
- Column() {
145
- this.createLazyChildren(this.node)
146
- }
147
- .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
148
- .defaultEvent()
149
- .visibleChangeEvent()
150
- .alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
151
- .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
131
+ if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node).direction !== FlexDirection.Column) {
132
+ Row() {
133
+ this.createLazyChildren(this.node)
134
+ }
135
+ .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
136
+ .defaultEvent()
137
+ .visibleChangeEvent()
138
+ .alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
139
+ .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
140
+ } else {
141
+ Column() {
142
+ this.createLazyChildren(this.node)
152
143
  }
144
+ .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
145
+ .defaultEvent()
146
+ .visibleChangeEvent()
147
+ .alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
148
+ .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
153
149
  }
154
150
  }
155
151
  }
@@ -13,15 +13,13 @@ export default struct TaroRichText {
13
13
  @ObjectLink node: TaroRichTextElement
14
14
 
15
15
  build () {
16
- if (this.node.hmStyle?.display !== 'none') {
17
- RichText(generateText(this.node))
18
- .attributeModifier(commonStyleModify.setNode(this.node))
19
- .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
20
- .onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
21
- this.node._nodeInfo.areaInfo = res[1]
22
- }))
23
- .onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
24
- }
16
+ RichText(generateText(this.node))
17
+ .attributeModifier(commonStyleModify.setNode(this.node))
18
+ .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
19
+ .onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
20
+ this.node._nodeInfo.areaInfo = res[1]
21
+ }))
22
+ .onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
25
23
  }
26
24
  }
27
25
 
@@ -71,59 +71,57 @@ export default struct TaroScrollView {
71
71
  }
72
72
 
73
73
  build () {
74
- if (this.node.hmStyle?.display !== 'none') {
75
- Scroll(this.node.scroller) {
76
- if (this.node._attrs.scrollX) {
77
- Row() {
78
- if (this.node._pseudo_before || this.node._pseudo_after) {
79
- PseduoChildren({ node: this.node, createLazyChildren: this.createLazyChildren })
80
- } else {
81
- this.createLazyChildren(this.node)
82
- }
74
+ Scroll(this.node.scroller) {
75
+ if (this.node._attrs.scrollX) {
76
+ Row() {
77
+ if (this.node._pseudo_before || this.node._pseudo_after) {
78
+ PseduoChildren({ node: this.node, createLazyChildren: this.createLazyChildren })
79
+ } else {
80
+ this.createLazyChildren(this.node)
83
81
  }
84
- .attributeModifier(rowModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
85
- .width(null)
86
- .onAreaChange(shouldBindEvent((_: Area, areaResult: Area) => {
87
- this.node._nodeInfo._scroll = areaResult
88
- }, this.node, ['scroll', 'scrollstart', 'scrollend']))
89
- .alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
90
- .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
91
- .flexGrow(0).flexShrink(0)
92
- } else {
93
- Column() {
94
- if (this.node._pseudo_before || this.node._pseudo_after) {
95
- PseduoChildren({ node: this.node, createLazyChildren: this.createLazyChildren })
96
- } else {
97
- this.createLazyChildren(this.node)
98
- }
82
+ }
83
+ .attributeModifier(rowModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
84
+ .width(null)
85
+ .onAreaChange(shouldBindEvent((_: Area, areaResult: Area) => {
86
+ this.node._nodeInfo._scroll = areaResult
87
+ }, this.node, ['scroll', 'scrollstart', 'scrollend']))
88
+ .alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
89
+ .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
90
+ .flexGrow(0).flexShrink(0)
91
+ } else {
92
+ Column() {
93
+ if (this.node._pseudo_before || this.node._pseudo_after) {
94
+ PseduoChildren({ node: this.node, createLazyChildren: this.createLazyChildren })
95
+ } else {
96
+ this.createLazyChildren(this.node)
99
97
  }
100
- .attributeModifier(columnModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
101
- .height(null)
102
- .alignItems(HorizontalAlign.Start)
103
- .onAreaChange(shouldBindEvent((_: Area, areaResult: Area) => {
104
- this.node._nodeInfo._scroll = areaResult
105
- }, this.node, ['scroll', 'scrollstart', 'scrollend']))
106
- .alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
107
- .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
108
- .flexGrow(0).flexShrink(0)
109
98
  }
99
+ .attributeModifier(columnModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
100
+ .height(null)
101
+ .alignItems(HorizontalAlign.Start)
102
+ .onAreaChange(shouldBindEvent((_: Area, areaResult: Area) => {
103
+ this.node._nodeInfo._scroll = areaResult
104
+ }, this.node, ['scroll', 'scrollstart', 'scrollend']))
105
+ .alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
106
+ .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
107
+ .flexGrow(0).flexShrink(0)
110
108
  }
111
- .width(getStyleAttr(this.node, 'width'))
112
- .height(getStyleAttr(this.node, 'height'))
113
- .flexGrow(this.node.hmStyle?.flexGrow)
114
- .flexShrink(this.node.hmStyle?.flexShrink)
115
- .scrollable(getScrollable(this.node))
116
- .scrollBar(getAttributes(this.node).scrollBar)
117
- .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
118
- .onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
119
- .onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
120
- this.node._nodeInfo.areaInfo = res[1]
121
- }))
122
- .onScroll(shouldBindEvent(() => { handleScrollEvent(this.node, 'scroll') }, this.node, ['scroll']))
123
- .onScrollStart(shouldBindEvent(() => { handleScrollEvent(this.node, 'scrollstart') }, this.node, ['scrollstart']))
124
- .onScrollStop(shouldBindEvent(() => { handleScrollEvent(this.node, 'scrollend') }, this.node, ['scrollend']))
125
- .onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
126
- .onReachEnd(shouldBindEvent(() => { handleScrollEvent(this.node, 'scrolltolower') }, this.node, ['scrolltolower']))
127
109
  }
110
+ .width(getStyleAttr(this.node, 'width'))
111
+ .height(getStyleAttr(this.node, 'height'))
112
+ .flexGrow(this.node.hmStyle?.flexGrow)
113
+ .flexShrink(this.node.hmStyle?.flexShrink)
114
+ .scrollable(getScrollable(this.node))
115
+ .scrollBar(getAttributes(this.node).scrollBar)
116
+ .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
117
+ .onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
118
+ .onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
119
+ this.node._nodeInfo.areaInfo = res[1]
120
+ }))
121
+ .onScroll(shouldBindEvent(() => { handleScrollEvent(this.node, 'scroll') }, this.node, ['scroll']))
122
+ .onScrollStart(shouldBindEvent(() => { handleScrollEvent(this.node, 'scrollstart') }, this.node, ['scrollstart']))
123
+ .onScrollStop(shouldBindEvent(() => { handleScrollEvent(this.node, 'scrollend') }, this.node, ['scrollend']))
124
+ .onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
125
+ .onReachEnd(shouldBindEvent(() => { handleScrollEvent(this.node, 'scrolltolower') }, this.node, ['scrolltolower']))
128
126
  }
129
127
  }
@@ -97,18 +97,16 @@ export default struct TaroSlider {
97
97
  }
98
98
 
99
99
  build() {
100
- if (this.node && this.node.hmStyle?.display !== 'none') {
101
- if (!!this.node._attrs.showValue) {
102
- Row() {
103
- this.createSlider(this.node)
104
- Text(Number(this.value).toFixed(0))
105
- .width('10%')
106
- .textAlign(TextAlign.Center)
107
- .opacity(!!this.node._attrs.disabled ? 0.4 : 1)
108
- }
109
- } else {
100
+ if (!!this.node._attrs.showValue) {
101
+ Row() {
110
102
  this.createSlider(this.node)
103
+ Text(Number(this.value).toFixed(0))
104
+ .width('10%')
105
+ .textAlign(TextAlign.Center)
106
+ .opacity(!!this.node._attrs.disabled ? 0.4 : 1)
111
107
  }
108
+ } else {
109
+ this.createSlider(this.node)
112
110
  }
113
111
  }
114
112
  }
@@ -208,6 +208,14 @@ export function setNormalAttributeIntoInstance(instance: CommonAttribute, style:
208
208
  instance.id(style.id)
209
209
  instance.key(style.id)
210
210
  }
211
+ if (!isUndefined(style.display) || !isUndefined(style.visibility)) {
212
+ instance.visibility(style.display === 'none'
213
+ ? Visibility.None :
214
+ !isUndefined(style.visibility)
215
+ ? (style.visibility === 'hidden' ? Visibility.Hidden : Visibility.Visible)
216
+ : Visibility.Visible
217
+ )
218
+ }
211
219
  if (!isUndefined(style.flexGrow)) {
212
220
  instance.flexGrow(style.flexGrow)
213
221
  }