@tarojs/plugin-platform-harmony-ets 4.0.0-beta.19 → 4.0.0-beta.20

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 (46) hide show
  1. package/dist/apis/wxml/IntersectionObserver.ts +5 -3
  2. package/dist/components-harmony-ets/button.ets +3 -2
  3. package/dist/components-harmony-ets/checkbox.ets +6 -3
  4. package/dist/components-harmony-ets/form.ets +5 -4
  5. package/dist/components-harmony-ets/icon.ets +8 -4
  6. package/dist/components-harmony-ets/image.ets +2 -0
  7. package/dist/components-harmony-ets/innerHtml.ets +5 -4
  8. package/dist/components-harmony-ets/input.ets +6 -4
  9. package/dist/components-harmony-ets/label.ets +5 -4
  10. package/dist/components-harmony-ets/movableArea.ets +8 -31
  11. package/dist/components-harmony-ets/movableView.ets +8 -31
  12. package/dist/components-harmony-ets/picker.ets +21 -16
  13. package/dist/components-harmony-ets/progress.ets +2 -0
  14. package/dist/components-harmony-ets/pseudo.ets +38 -31
  15. package/dist/components-harmony-ets/radio.ets +6 -3
  16. package/dist/components-harmony-ets/richText.ets +3 -1
  17. package/dist/components-harmony-ets/scrollView.ets +15 -36
  18. package/dist/components-harmony-ets/slider.ets +4 -2
  19. package/dist/components-harmony-ets/style.ets +62 -27
  20. package/dist/components-harmony-ets/swiper.ets +3 -2
  21. package/dist/components-harmony-ets/switch.ets +3 -1
  22. package/dist/components-harmony-ets/text.ets +10 -8
  23. package/dist/components-harmony-ets/textArea.ets +6 -4
  24. package/dist/components-harmony-ets/utils/helper.ets +3 -2
  25. package/dist/components-harmony-ets/utils/styles.ets +25 -93
  26. package/dist/components-harmony-ets/video.ets +2 -0
  27. package/dist/components-harmony-ets/view.ets +11 -32
  28. package/dist/components-harmony-ets/webView.ets +3 -1
  29. package/dist/index.d.ts +2 -0
  30. package/dist/index.js +10 -10
  31. package/dist/index.js.map +1 -1
  32. package/dist/runtime-ets/dom/cssNesting.ts +36 -10
  33. package/dist/runtime-ets/dom/cssStyleDeclaration.ts +15 -40
  34. package/dist/runtime-ets/dom/document.ts +0 -3
  35. package/dist/runtime-ets/dom/element/element.ts +6 -5
  36. package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +152 -217
  37. package/dist/runtime-ets/dom/stylesheet/index.ts +17 -315
  38. package/dist/runtime-ets/dom/stylesheet/type.ts +6 -2
  39. package/dist/runtime-ets/index.ts +1 -1
  40. package/dist/runtime-ets/utils/index.ts +24 -8
  41. package/dist/runtime-framework/react/native-page.ts +6 -4
  42. package/dist/runtime-utils.js +4 -3
  43. package/dist/runtime-utils.js.map +1 -1
  44. package/dist/runtime.js +4 -3
  45. package/dist/runtime.js.map +1 -1
  46. package/package.json +8 -8
@@ -19,13 +19,13 @@ export class IntersectionObserver implements Taro.IntersectionObserver {
19
19
  constructor(component: any, options: Taro.createIntersectionObserver.Option = {}) {
20
20
  const taro = (Current as any).taro
21
21
  const page = taro.getCurrentInstance().page
22
- const currentPage = getPageScrollerOrNode(page.node, page)
23
- this._component = component || currentPage
22
+
23
+ this._component = component || getPageScrollerOrNode(page?.node, page)
24
24
  Object.assign(this._options, options)
25
25
  }
26
26
 
27
27
  public disconnect (): void {
28
- if (this._observerNodes) {
28
+ if (this._observerNodes && this._component) {
29
29
  if (this._observerNodes instanceof Array) {
30
30
  this._observerNodes.forEach((n: TaroElement & any) => {
31
31
  disconnectEvent(n, VISIBLE_CHANGE_EVENT_NAME)
@@ -44,6 +44,8 @@ export class IntersectionObserver implements Taro.IntersectionObserver {
44
44
  }
45
45
 
46
46
  public observe (targetSelector: string, callback: Taro.IntersectionObserver.ObserveCallback): void {
47
+ if (!this._component) return
48
+
47
49
  const { observeAll, thresholds } = this._options
48
50
  const node = findChildNodeWithDFS(this._component, targetSelector, observeAll)
49
51
  this._observerNodes = node
@@ -1,5 +1,4 @@
1
1
  import { eventHandler, createTaroEvent, convertNumber2VP, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME } from '@tarojs/runtime'
2
- import { createLazyChildren } from './render'
3
2
  import commonStyleModify from './style'
4
3
  import { BUTTON_THEME_COLOR } from './utils/constant/style'
5
4
  import { TOUCH_EVENT_MAP } from './utils/constant/event'
@@ -96,6 +95,8 @@ function getButtonMinHeight (node: TaroButtonElement): string | number | undefin
96
95
 
97
96
  @Component
98
97
  export default struct TaroButton {
98
+ @Builder customBuilder() {}
99
+ @BuilderParam createLazyChildren: (node: TaroButtonElement) => void = this.customBuilder
99
100
  @ObjectLink node: TaroButtonElement
100
101
 
101
102
  build() {
@@ -107,7 +108,7 @@ export default struct TaroButton {
107
108
  .width(20).height(20)
108
109
  .color(getThemeAttributes(this.node).color)
109
110
  }
110
- createLazyChildren(this.node)
111
+ this.createLazyChildren(this.node)
111
112
  }
112
113
  }
113
114
  .themeStyles(getThemeAttributes(this.node))
@@ -1,7 +1,6 @@
1
1
  import { createTaroEvent, eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME } from '@tarojs/runtime'
2
2
 
3
3
  import commonStyleModify from './style'
4
- import { createLazyChildren } from './render'
5
4
  import { FlexManager } from './utils/flexManager'
6
5
  import { shouldBindEvent, getNodeThresholds } from './utils/helper'
7
6
 
@@ -36,6 +35,8 @@ function getOptions (node: TaroCheckboxElement): CheckboxOptions {
36
35
 
37
36
  @Component
38
37
  export struct TaroCheckbox {
38
+ @Builder customBuilder() {}
39
+ @BuilderParam createLazyChildren: (node: TaroCheckboxElement) => void = this.customBuilder
39
40
  @ObjectLink node: TaroCheckboxElement
40
41
 
41
42
  aboutToAppear () {
@@ -95,6 +96,8 @@ interface ChangeEventDetail { value: string[] }
95
96
 
96
97
  @Component
97
98
  export struct TaroCheckboxGroup {
99
+ @Builder customBuilder() {}
100
+ @BuilderParam createLazyChildren: (node: TaroCheckboxGroupElement) => void = this.customBuilder
98
101
  @ObjectLink node: TaroCheckboxGroupElement
99
102
 
100
103
  @Styles visibleChangeEvent () {
@@ -124,7 +127,7 @@ export struct TaroCheckboxGroup {
124
127
  if (this.node && this.node?.hmStyle?.display !== 'none') {
125
128
  if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node).direction !== FlexDirection.Column) {
126
129
  Row() {
127
- createLazyChildren(this.node)
130
+ this.createLazyChildren(this.node)
128
131
  }
129
132
  .attributeModifier(commonStyleModify.setNode(this.node))
130
133
  .defaultEvent()
@@ -133,7 +136,7 @@ export struct TaroCheckboxGroup {
133
136
  .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
134
137
  } else {
135
138
  Column() {
136
- createLazyChildren(this.node)
139
+ this.createLazyChildren(this.node)
137
140
  }
138
141
  .attributeModifier(commonStyleModify.setNode(this.node))
139
142
  .defaultEvent()
@@ -1,7 +1,6 @@
1
1
  import { AREA_CHANGE_EVENT_NAME, eventHandler, getComponentEventCallback, VISIBLE_CHANGE_EVENT_NAME } from '@tarojs/runtime'
2
2
 
3
3
  import commonStyleModify from './style'
4
- import { createLazyChildren } from './render'
5
4
  import { TOUCH_EVENT_MAP } from './utils/constant/event'
6
5
  import { FlexManager } from './utils/flexManager'
7
6
  import { shouldBindEvent, getNodeThresholds } from './utils/helper'
@@ -10,13 +9,15 @@ import type { TaroAny, TaroFormElement } from '@tarojs/runtime'
10
9
 
11
10
  @Component
12
11
  export default struct TaroForm {
12
+ @Builder customBuilder() {}
13
+ @BuilderParam createLazyChildren: (node: TaroFormElement) => void = this.customBuilder
13
14
  @ObjectLink node: TaroFormElement
14
-
15
+
15
16
  build() {
16
17
  if (this.node?.hmStyle?.display !== 'none') {
17
18
  if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node).direction !== FlexDirection.Column) {
18
19
  Row() {
19
- createLazyChildren(this.node)
20
+ this.createLazyChildren(this.node)
20
21
  }
21
22
  .attributeModifier(commonStyleModify.setNode(this.node))
22
23
  .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
@@ -29,7 +30,7 @@ export default struct TaroForm {
29
30
  .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
30
31
  } else {
31
32
  Column() {
32
- createLazyChildren(this.node)
33
+ this.createLazyChildren(this.node)
33
34
  }
34
35
  .attributeModifier(commonStyleModify.setNode(this.node))
35
36
  .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
@@ -1,7 +1,7 @@
1
1
  import { eventHandler, convertNumber2VP, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME, convertNumber2PX } from '@tarojs/runtime'
2
2
 
3
3
  import commonStyleModify from './style'
4
- import { getNormalAttributes, shouldBindEvent, getNodeThresholds } from './utils/helper'
4
+ import { shouldBindEvent, getNodeThresholds } from './utils/helper'
5
5
 
6
6
  import type { TaroIconElement, TaroAny } from '@tarojs/runtime'
7
7
 
@@ -50,19 +50,23 @@ function getIconData (node: TaroIconElement): Resource | null {
50
50
 
51
51
  @Component
52
52
  export default struct TaroIcon {
53
+ @Builder customBuilder() {}
54
+ @BuilderParam createLazyChildren: (node: TaroIconElement) => void = this.customBuilder
53
55
  @ObjectLink node: TaroIconElement
56
+
54
57
  build() {
55
58
  if (this.node?.hmStyle?.display !== 'none') {
56
59
  Image(getIconData(this.node))
57
60
  .objectFit(ImageFit.Contain)
58
61
  .fillColor(this.node._attrs.color || ICON_COLOR_MAP[this.node._attrs.type] || Color.Black)
59
- .attributeModifier(commonStyleModify.setNode(this.node))
62
+ .attributeModifier(commonStyleModify.setNode(this.node, {
63
+ width: convertNumber2PX(23),
64
+ height: convertNumber2PX(23)
65
+ }))
60
66
  .size({
61
67
  width: convertNumber2VP(Number(this.node._attrs.size) || 23),
62
68
  height: convertNumber2VP(Number(this.node._attrs.size) || 23),
63
69
  })
64
- .width(getNormalAttributes(this.node).width || convertNumber2PX(23))
65
- .height(getNormalAttributes(this.node).height || convertNumber2PX(23))
66
70
  .onComplete(e => eventHandler(e, 'complete', this.node))
67
71
  .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
68
72
  .onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
@@ -18,6 +18,8 @@ function getImageMode (mode: string): ImageFit {
18
18
 
19
19
  @Component
20
20
  export default struct TaroImage {
21
+ @Builder customBuilder() {}
22
+ @BuilderParam createLazyChildren: (node: TaroImageElement) => void = this.customBuilder
21
23
  @ObjectLink node: TaroImageElement
22
24
 
23
25
  build() {
@@ -1,15 +1,16 @@
1
1
  import htmlParser from './utils/htmlParser'
2
- import { createChildItem } from './render'
3
2
 
4
- import type { TaroInnerHtmlElement } from '@tarojs/runtime'
3
+ import type { TaroElement, TaroInnerHtmlElement } from '@tarojs/runtime'
5
4
 
6
5
  @Component
7
6
  export default struct TaroInnerHtml {
7
+ @Builder customBuilder() {}
8
+ @BuilderParam createChildItem: (node: TaroElement, callback?: (node: TaroElement) => void) => void = this.customBuilder
8
9
  @ObjectLink node: TaroInnerHtmlElement
9
-
10
+
10
11
  build() {
11
12
  if (this.node?.hmStyle?.display !== 'none' && this.node.innerHTML) {
12
- createChildItem(htmlParser(this.node.innerHTML))
13
+ this.createChildItem(htmlParser(this.node.innerHTML))
13
14
  }
14
15
  }
15
16
  }
@@ -1,7 +1,7 @@
1
1
  import { eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME, createTaroEvent } from '@tarojs/runtime'
2
2
 
3
3
  import commonStyleModify from './style'
4
- import { getNormalAttributes, parseStyles, shouldBindEvent, getNodeThresholds } from './utils/helper'
4
+ import { parseStyles, shouldBindEvent, getNodeThresholds } from './utils/helper'
5
5
  import { INPUT_TYPE_MAP, INPUT_CONFIRM_MAP } from './utils/constant/style'
6
6
 
7
7
  import type { TaroStyleType, TaroAny, TaroInputElement, TaroEvent } from '@tarojs/runtime'
@@ -48,6 +48,8 @@ function getPlaceholderColor (node: TaroInputElement): string {
48
48
  export default struct TaroInput {
49
49
  @State value: string = ''
50
50
 
51
+ @Builder customBuilder() {}
52
+ @BuilderParam createLazyChildren: (node: TaroInputElement) => void = this.customBuilder
51
53
  @ObjectLink node: TaroInputElement
52
54
 
53
55
  aboutToAppear () {
@@ -71,11 +73,11 @@ export default struct TaroInput {
71
73
  .placeholderColor(getPlaceholderColor(this.node))
72
74
  .enterKeyType(INPUT_CONFIRM_MAP.get(this.node._attrs?.confirmType) || EnterKeyType.Done)
73
75
  .attributeModifier(commonStyleModify.setNode(this.node))
74
- .styles(getNormalAttributes(this.node))
76
+ .styles(this.node?.hmStyle)
75
77
  .attrs(getAttributes(this.node))
76
78
  .onChange((value: string) => {
77
79
  const event: TaroEvent = createTaroEvent('input', { detail: { value } }, this.node)
78
-
80
+
79
81
  this.value = value
80
82
  this.node?.updateFormWidgetValue(value)
81
83
  eventHandler(event, 'input', this.node)
@@ -91,7 +93,7 @@ export default struct TaroInput {
91
93
  })
92
94
  .onFocus(() => {
93
95
  const event: TaroEvent = createTaroEvent('focus', { detail: { value: this.value, height: this.node?._height } }, this.node)
94
-
96
+
95
97
  eventHandler(event, 'focus', this.node)
96
98
  })
97
99
  .onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
@@ -1,10 +1,9 @@
1
1
  import { Current, eventHandler, getComponentEventCallback, VISIBLE_CHANGE_EVENT_NAME, getPageScrollerOrNode, AREA_CHANGE_EVENT_NAME } from '@tarojs/runtime'
2
2
 
3
3
  import commonStyleModify from './style'
4
- import { createLazyChildren } from './render'
5
4
  import { TOUCH_EVENT_MAP } from './utils/constant/event'
6
5
  import { FlexManager } from './utils/flexManager'
7
- import { getNormalAttributes, shouldBindEvent, getNodeThresholds } from './utils/helper'
6
+ import { shouldBindEvent, getNodeThresholds } from './utils/helper'
8
7
 
9
8
  import type { TaroLabelElement, TaroElement, TaroAny, TaroRadioElement, TaroCheckboxElement } from '@tarojs/runtime'
10
9
 
@@ -37,13 +36,15 @@ function handleTargetChange (id: string) {
37
36
 
38
37
  @Component
39
38
  export default struct TaroLabel {
39
+ @Builder customBuilder() {}
40
+ @BuilderParam createLazyChildren: (node:TaroLabelElement) => void = this.customBuilder
40
41
  @ObjectLink node:TaroLabelElement
41
42
 
42
43
  build() {
43
44
  if (this.node?.hmStyle?.display !== 'none') {
44
45
  if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node).direction !== FlexDirection.Column) {
45
46
  Row() {
46
- createLazyChildren(this.node)
47
+ this.createLazyChildren(this.node)
47
48
  }
48
49
  .attributeModifier(commonStyleModify.setNode(this.node))
49
50
  .onClick((e: ClickEvent) => {
@@ -62,7 +63,7 @@ export default struct TaroLabel {
62
63
  .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
63
64
  } else {
64
65
  Column() {
65
- createLazyChildren(this.node)
66
+ this.createLazyChildren(this.node)
66
67
  }
67
68
  .attributeModifier(commonStyleModify.setNode(this.node))
68
69
  .onClick((e: ClickEvent) => {
@@ -1,43 +1,21 @@
1
- import type { TaroMovableAreaElement, TaroStyleType, TaroMovableViewElement} from '@tarojs/runtime'
2
- import commonStyleModify from './style'
3
- import { createLazyChildren } from './render'
1
+ import type { TaroMovableAreaElement, TaroMovableViewElement} from '@tarojs/runtime'
2
+ import { rowModify, columnModify } from './style'
4
3
 
5
4
  import { FlexManager } from './utils/flexManager'
6
- import { getNormalAttributes } from './utils/helper'
7
-
8
-
9
- @Extend(Row)
10
- function rowAttrs(style: TaroStyleType) {
11
- .constraintSize({
12
- minWidth: style.minWidth || style.width,
13
- maxWidth: style.maxWidth,
14
- minHeight: style.minHeight,
15
- maxHeight: style.maxHeight
16
- })
17
- }
18
-
19
- @Extend(Column)
20
- function columnAttrs(style: TaroStyleType) {
21
- .constraintSize({
22
- minWidth: style.minWidth,
23
- maxWidth: style.maxWidth,
24
- minHeight: style.minHeight || style.height,
25
- maxHeight: style.maxHeight
26
- })
27
- }
28
5
 
29
6
  @Component
30
7
  export default struct TaroMovableArea {
8
+ @Builder customBuilder() {}
9
+ @BuilderParam createLazyChildren: (node: TaroMovableAreaElement) => void = this.customBuilder
31
10
  @ObjectLink node: TaroMovableAreaElement
32
11
 
33
12
  build() {
34
13
  if (this.node && this.node.hmStyle?.display !== 'none') {
35
14
  if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node).direction !== FlexDirection.Column) {
36
15
  Row() {
37
- createLazyChildren(this.node)
16
+ this.createLazyChildren(this.node)
38
17
  }
39
- .attributeModifier(commonStyleModify.setNode(this.node))
40
- .rowAttrs(getNormalAttributes(this.node))
18
+ .attributeModifier(rowModify.setNode(this.node))
41
19
  .alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
42
20
  .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
43
21
  .clip(true)
@@ -71,10 +49,9 @@ export default struct TaroMovableArea {
71
49
  )
72
50
  } else {
73
51
  Column() {
74
- createLazyChildren(this.node)
52
+ this.createLazyChildren(this.node)
75
53
  }
76
- .attributeModifier(commonStyleModify.setNode(this.node))
77
- .columnAttrs(getNormalAttributes(this.node))
54
+ .attributeModifier(columnModify.setNode(this.node))
78
55
  .alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
79
56
  .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
80
57
  .clip(true)
@@ -1,34 +1,13 @@
1
- import type { TaroMovableViewElement, TaroStyleType, TaroAny } from '@tarojs/runtime'
1
+ import type { TaroMovableViewElement } from '@tarojs/runtime'
2
2
 
3
- import commonStyleModify from './style'
4
- import { createLazyChildren } from './render'
3
+ import { rowModify, columnModify } from './style'
5
4
 
6
5
  import { FlexManager } from './utils/flexManager'
7
- import { getNormalAttributes, } from './utils/helper'
8
-
9
- @Extend(Row)
10
- function rowAttrs(style: TaroStyleType) {
11
- .constraintSize({
12
- minWidth: style.minWidth || style.width,
13
- maxWidth: style.maxWidth,
14
- minHeight: style.minHeight,
15
- maxHeight: style.maxHeight
16
- })
17
- }
18
-
19
- @Extend(Column)
20
- function columnAttrs(style: TaroStyleType) {
21
- .constraintSize({
22
- minWidth: style.minWidth,
23
- maxWidth: style.maxWidth,
24
- minHeight: style.minHeight || style.height,
25
- maxHeight: style.maxHeight
26
- })
27
- }
28
-
29
6
 
30
7
  @Component
31
8
  export default struct TaroMovableView {
9
+ @Builder customBuilder() {}
10
+ @BuilderParam createLazyChildren: (node: TaroMovableViewElement) => void = this.customBuilder
32
11
  @ObjectLink node: TaroMovableViewElement
33
12
 
34
13
  build() {
@@ -37,18 +16,16 @@ export default struct TaroMovableView {
37
16
  if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node)
38
17
  .direction !== FlexDirection.Column) {
39
18
  Row() {
40
- createLazyChildren(this.node)
19
+ this.createLazyChildren(this.node)
41
20
  }
42
- .attributeModifier(commonStyleModify.setNode(this.node))
43
- .rowAttrs(getNormalAttributes(this.node))
21
+ .attributeModifier(rowModify.setNode(this.node))
44
22
  .alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
45
23
  .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
46
24
  } else {
47
25
  Column() {
48
- createLazyChildren(this.node)
26
+ this.createLazyChildren(this.node)
49
27
  }
50
- .attributeModifier(commonStyleModify.setNode(this.node))
51
- .columnAttrs(getNormalAttributes(this.node))
28
+ .attributeModifier(columnModify.setNode(this.node))
52
29
  .alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
53
30
  .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
54
31
  }
@@ -1,10 +1,9 @@
1
1
  import { AREA_CHANGE_EVENT_NAME, eventHandler, getComponentEventCallback, VISIBLE_CHANGE_EVENT_NAME, TaroPickerElement, createTaroEvent } from '@tarojs/runtime'
2
- import { createLazyChildren } from './render'
3
2
  import commonStyleModify from './style'
4
3
  import { getSingleSelector, getMultiSelector } from './utils'
5
4
  import { TOUCH_EVENT_MAP } from './utils/constant/event'
6
5
  import { FlexManager } from './utils/flexManager'
7
- import { getNormalAttributes, shouldBindEvent, getNodeThresholds } from './utils/helper'
6
+ import { shouldBindEvent, getNodeThresholds } from './utils/helper'
8
7
 
9
8
  import type { TaroAny, TaroEvent } from '@tarojs/runtime'
10
9
 
@@ -146,9 +145,10 @@ export struct PickerView {
146
145
  color: '#000'
147
146
  })
148
147
  .canLoop(false)
149
- .attributeModifier(commonStyleModify.setNode(this.node))
150
- .width(getNormalAttributes(this.node).width || '100%')
151
- .backgroundColor(getNormalAttributes(this.node).backgroundColor || '#fff')
148
+ .attributeModifier(commonStyleModify.setNode(this.node, {
149
+ width: '100%',
150
+ backgroundColor: '#fff'
151
+ }))
152
152
  .onChange((_, index) => {
153
153
  this.node?.updateFormWidgetValue(index)
154
154
  })
@@ -158,9 +158,10 @@ export struct PickerView {
158
158
  color: '#000'
159
159
  })
160
160
  .canLoop(false)
161
- .attributeModifier(commonStyleModify.setNode(this.node))
162
- .width(getNormalAttributes(this.node).width || '100%')
163
- .backgroundColor(getNormalAttributes(this.node).backgroundColor || '#fff')
161
+ .attributeModifier(commonStyleModify.setNode(this.node, {
162
+ width: '100%',
163
+ backgroundColor: '#fff'
164
+ }))
164
165
  .onChange((_, index) => {
165
166
  if (index instanceof Array) {
166
167
  this.node?.updateFormWidgetValue(index)
@@ -187,9 +188,10 @@ export struct PickerView {
187
188
  .selectedTextStyle({
188
189
  color: '#000'
189
190
  })
190
- .attributeModifier(commonStyleModify.setNode(this.node))
191
- .width(getNormalAttributes(this.node).width || '100%')
192
- .backgroundColor(getNormalAttributes(this.node).backgroundColor || '#fff')
191
+ .attributeModifier(commonStyleModify.setNode(this.node, {
192
+ width: '100%',
193
+ backgroundColor: '#fff'
194
+ }))
193
195
  .onDateChange(value => {
194
196
  const data = value.toLocaleDateString().split('/')
195
197
  const day = data[1]
@@ -203,9 +205,10 @@ export struct PickerView {
203
205
  color: '#000'
204
206
  })
205
207
  .canLoop(false)
206
- .attributeModifier(commonStyleModify.setNode(this.node))
207
- .width(getNormalAttributes(this.node).width || '100%')
208
- .backgroundColor(getNormalAttributes(this.node).backgroundColor || '#fff')
208
+ .attributeModifier(commonStyleModify.setNode(this.node, {
209
+ width: '100%',
210
+ backgroundColor: '#fff'
211
+ }))
209
212
  .onChange((value) => {
210
213
  this.node?.updateFormWidgetValue(`${('00'+value[0]).slice(-2)}:${('00'+value[1]).slice(-2)}`)
211
214
  })
@@ -222,6 +225,8 @@ export struct PickerView {
222
225
 
223
226
  @Component
224
227
  export default struct TaroPicker {
228
+ @Builder customBuilder() {}
229
+ @BuilderParam createLazyChildren: (node: TaroPickerElement) => void = this.customBuilder
225
230
  @ObjectLink node: TaroPickerElement
226
231
 
227
232
  aboutToAppear () {
@@ -309,7 +314,7 @@ export default struct TaroPicker {
309
314
  if (this.node && this.node.hmStyle?.display !== 'none') {
310
315
  if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node).direction !== FlexDirection.Column) {
311
316
  Row() {
312
- createLazyChildren(this.node)
317
+ this.createLazyChildren(this.node)
313
318
  }
314
319
  .defaultEvent()
315
320
  .visibleChangeEvent()
@@ -317,7 +322,7 @@ export default struct TaroPicker {
317
322
  .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
318
323
  } else {
319
324
  Column() {
320
- createLazyChildren(this.node)
325
+ this.createLazyChildren(this.node)
321
326
  }
322
327
  .defaultEvent()
323
328
  .visibleChangeEvent()
@@ -9,6 +9,8 @@ const PROGRESS_DEFAULTINFOFONTSIZE = 16
9
9
 
10
10
  @Component
11
11
  export default struct TaroProgress {
12
+ @Builder customBuilder() {}
13
+ @BuilderParam createLazyChildren: (node: TaroProgressElement) => void = this.customBuilder
12
14
  @ObjectLink node: TaroProgressElement
13
15
 
14
16
  build() {
@@ -1,8 +1,7 @@
1
- import { getFontAttributes, getStyle } from './utils/helper'
1
+ import { getFontAttributes } from './utils/helper'
2
2
  import { pseudoModify } from './style'
3
- import { createLazyChildren } from './render'
4
3
 
5
- import type { TaroViewElement, TaroStyleType, TaroTextStyleType } from '@tarojs/runtime'
4
+ import type { TaroViewElement, TaroStyleType, TaroTextStyleType, TaroAny } from '@tarojs/runtime'
6
5
 
7
6
  @Extend(Flex)
8
7
  function flexAttrs (style: TaroStyleType) {
@@ -41,33 +40,41 @@ function textSpecialFontStyle(attr: TaroTextStyleType) {
41
40
  .lineHeight(attr.lineHeight)
42
41
  }
43
42
 
44
- @Builder
45
- export default function PseduoChildren (node: TaroViewElement) {
46
- // 伪类::Before
47
- if (node._pseudo_before) {
48
- if (node._pseudo_before?.hmStyle.content) {
49
- Text(node._pseudo_before.hmStyle.content)
50
- .attributeModifier(pseudoModify.setStyle(node._pseudo_before.hmStyle))
51
- .textNormalFontStyle(getStyle(node._pseudo_before.hmStyle || {}))
52
- .textSpecialFontStyle(getFontAttributes(node))
53
- } else {
54
- Flex() {}
55
- .attributeModifier(pseudoModify.setStyle(node._pseudo_before.hmStyle || {}))
56
- .flexAttrs(getStyle(node._pseudo_before.hmStyle || {}))
57
- }
58
- }
59
- createLazyChildren(node)
60
- // 伪类::After
61
- if (node._pseudo_after) {
62
- if (node._pseudo_after?.hmStyle.content) {
63
- Text(node._pseudo_after.hmStyle.content)
64
- .attributeModifier(pseudoModify.setStyle(node._pseudo_after.hmStyle))
65
- .textNormalFontStyle(getStyle(node._pseudo_after.hmStyle || {}))
66
- .textSpecialFontStyle(getFontAttributes(node))
67
- } else {
68
- Flex() {}
69
- .attributeModifier(pseudoModify.setStyle(node._pseudo_after.hmStyle || {}))
70
- .flexAttrs(getStyle(node._pseudo_after.hmStyle || {}))
43
+ @Component
44
+ export default struct PseduoChildren {
45
+ @Builder customBuilder() {}
46
+ @BuilderParam createLazyChildren: (node: TaroAny) => void = this.customBuilder
47
+ @ObjectLink node: TaroViewElement
48
+
49
+ build () {
50
+ if (true) {
51
+ // 伪类::Before
52
+ if (this.node._pseudo_before) {
53
+ if (this.node._pseudo_before?.hmStyle.content) {
54
+ Text(this.node._pseudo_before.hmStyle.content)
55
+ .attributeModifier(pseudoModify.setStyle(this.node._pseudo_before.hmStyle))
56
+ .textNormalFontStyle(this.node._pseudo_before.hmStyle || {})
57
+ .textSpecialFontStyle(getFontAttributes(this.node))
58
+ } else {
59
+ Flex() {}
60
+ .attributeModifier(pseudoModify.setStyle(this.node._pseudo_before.hmStyle || {}))
61
+ .flexAttrs(this.node._pseudo_before.hmStyle || {})
62
+ }
63
+ }
64
+ this.createLazyChildren(this.node)
65
+ // 伪类::After
66
+ if (this.node._pseudo_after) {
67
+ if (this.node._pseudo_after?.hmStyle.content) {
68
+ Text(this.node._pseudo_after.hmStyle.content)
69
+ .attributeModifier(pseudoModify.setStyle(this.node._pseudo_after.hmStyle))
70
+ .textNormalFontStyle(this.node._pseudo_after.hmStyle || {})
71
+ .textSpecialFontStyle(getFontAttributes(this.node))
72
+ } else {
73
+ Flex() {}
74
+ .attributeModifier(pseudoModify.setStyle(this.node._pseudo_after.hmStyle || {}))
75
+ .flexAttrs(this.node._pseudo_after.hmStyle || {})
76
+ }
77
+ }
71
78
  }
72
79
  }
73
- }
80
+ }
@@ -1,7 +1,6 @@
1
1
  import { eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME, createTaroEvent } from '@tarojs/runtime'
2
2
 
3
3
  import commonStyleModify from './style'
4
- import { createLazyChildren } from './render'
5
4
  import { TOUCH_EVENT_MAP } from './utils/constant/event'
6
5
  import { FlexManager } from './utils/flexManager'
7
6
  import { shouldBindEvent, getNodeThresholds } from './utils/helper'
@@ -35,6 +34,8 @@ function themeStyles(isDisabled: boolean) {
35
34
 
36
35
  @Component
37
36
  export struct TaroRadio {
37
+ @Builder customBuilder() {}
38
+ @BuilderParam createLazyChildren: (node: TaroRadioElement) => void = this.customBuilder
38
39
  @ObjectLink node: TaroRadioElement
39
40
 
40
41
  aboutToAppear () {
@@ -95,6 +96,8 @@ export struct TaroRadio {
95
96
 
96
97
  @Component
97
98
  export struct TaroRadioGroup {
99
+ @Builder customBuilder() {}
100
+ @BuilderParam createLazyChildren: (node: TaroRadioGroupElement) => void = this.customBuilder
98
101
  @ObjectLink node: TaroRadioGroupElement
99
102
 
100
103
  @Styles visibleChangeEvent () {
@@ -126,7 +129,7 @@ export struct TaroRadioGroup {
126
129
  if (this.node && this.node.hmStyle?.display !== 'none') {
127
130
  if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node).direction !== FlexDirection.Column) {
128
131
  Row() {
129
- createLazyChildren(this.node)
132
+ this.createLazyChildren(this.node)
130
133
  }
131
134
  .attributeModifier(commonStyleModify.setNode(this.node))
132
135
  .defaultEvent()
@@ -135,7 +138,7 @@ export struct TaroRadioGroup {
135
138
  .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
136
139
  } else {
137
140
  Column() {
138
- createLazyChildren(this.node)
141
+ this.createLazyChildren(this.node)
139
142
  }
140
143
  .attributeModifier(commonStyleModify.setNode(this.node))
141
144
  .defaultEvent()
@@ -1,13 +1,15 @@
1
1
  import { eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME } from '@tarojs/runtime'
2
2
 
3
3
  import commonStyleModify from './style'
4
- import { generateText } from './utils'
4
+ import { generateText } from './utils'
5
5
  import { getNodeThresholds, shouldBindEvent } from './utils/helper'
6
6
 
7
7
  import type { TaroAny, TaroRichTextElement } from '@tarojs/runtime'
8
8
 
9
9
  @Component
10
10
  export default struct TaroRichText {
11
+ @Builder customBuilder() {}
12
+ @BuilderParam createLazyChildren: (node: TaroRichTextElement) => void = this.customBuilder
11
13
  @ObjectLink node: TaroRichTextElement
12
14
 
13
15
  build () {