@tarojs/plugin-platform-harmony-ets 4.0.0-beta.3 → 4.0.0-beta.5

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.
@@ -1,78 +1,14 @@
1
1
  import { eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME, createTaroEvent } from '@tarojs/runtime'
2
2
 
3
- import { getNodeThresholds, shouldBindEvent, getNormalAttributes } from './utils/helper'
3
+ import commonStyleModify from './style'
4
+ import { getNodeThresholds, shouldBindEvent } from './utils/helper'
4
5
 
5
- import type { TaroAny, TaroStyleType, TaroSwitchElement, TaroEvent } from '@tarojs/runtime'
6
+ import type { TaroAny, TaroSwitchElement, TaroEvent } from '@tarojs/runtime'
6
7
 
7
8
  interface SwitchAttrs {
8
9
  selectedColor?: ResourceColor
9
10
  }
10
11
 
11
- @Extend(Toggle)
12
- function styles (style: TaroStyleType) {
13
- .id(style.id)
14
- .key(style.id)
15
- .flexGrow(style.flexGrow)
16
- .flexShrink(style.flexShrink)
17
- .flexBasis(style.flexBasis)
18
- .alignSelf(style.alignSelf)
19
- .padding({
20
- top: style.paddingTop,
21
- right: style.paddingRight,
22
- bottom: style.paddingBottom,
23
- left: style.paddingLeft
24
- })
25
- .margin({
26
- top: style.marginTop,
27
- right: style.marginRight,
28
- bottom: style.marginBottom,
29
- left: style.marginLeft
30
- })
31
- .width(style.width)
32
- .height(style.height)
33
- .constraintSize({
34
- minWidth: style.minWidth,
35
- maxWidth: style.maxWidth,
36
- minHeight: style.minHeight,
37
- maxHeight: style.maxHeight
38
- })
39
- .backgroundColor(style.backgroundColor)
40
- .backgroundImage(style.backgroundImage?.src, style.backgroundRepeat)
41
- .backgroundImageSize(style.backgroundSize)
42
- .backgroundImagePosition(style.backgroundPosition)
43
- .borderStyle({
44
- top: style.borderTopStyle,
45
- right: style.borderRightStyle,
46
- bottom: style.borderBottomStyle,
47
- left: style.borderLeftStyle
48
- })
49
- .borderWidth({
50
- top: style.borderTopWidth,
51
- right: style.borderRightWidth,
52
- bottom: style.borderBottomWidth,
53
- left: style.borderLeftWidth
54
- })
55
- .borderColor({
56
- top: style.borderTopColor,
57
- right: style.borderRightColor,
58
- bottom: style.borderBottomColor,
59
- left: style.borderLeftColor
60
- })
61
- .borderRadius({
62
- topLeft: style.borderTopLeftRadius,
63
- topRight: style.borderTopRightRadius,
64
- bottomLeft: style.borderBottomLeftRadius,
65
- bottomRight: style.borderBottomRightRadius
66
- })
67
- .zIndex(style.zIndex)
68
- .opacity(style.opacity)
69
- .linearGradient(style.linearGradient)
70
- .clip(style.overflow)
71
- .rotate({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y, angle: 0 })
72
- .scale({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y })
73
- .transform(style.transform)
74
- }
75
-
76
12
  @Extend(Toggle)
77
13
  function attrs(attr: SwitchAttrs) {
78
14
  .selectedColor(attr.selectedColor)
@@ -107,7 +43,7 @@ export default struct TaroSwitch {
107
43
  type: this.node._attrs.type !== 'checkbox' ? ToggleType.Switch : ToggleType.Checkbox,
108
44
  isOn: this.node.checked,
109
45
  })
110
- .styles(getNormalAttributes(this.node))
46
+ .attributeModifier(commonStyleModify.setNode(this.node))
111
47
  .attrs(getAttributes(this.node))
112
48
  .themeStyles(!!this.node._attrs.disabled)
113
49
  .onChange((isOn: boolean) => {
@@ -1,76 +1,12 @@
1
1
  import { eventHandler, convertNumber2VP, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME, NodeType } from '@tarojs/runtime'
2
2
 
3
+ import commonStyleModify from './style'
3
4
  import { getButtonColor } from './button'
4
5
  import { BUTTON_THEME_COLOR } from './utils/constant/style'
5
6
  import { getNodeThresholds, getNormalAttributes, getFontAttributes, shouldBindEvent } from './utils/helper'
6
7
 
7
8
  import type { TaroButtonElement, TaroElement, TaroTextElement, TaroAny, TaroTextStyleType, TaroStyleType } from '@tarojs/runtime'
8
9
 
9
- @Extend(Text)
10
- function textNormalStyle (style: TaroStyleType) {
11
- .id(style.id)
12
- .key(style.id)
13
- .flexGrow(style.flexGrow)
14
- .flexShrink(style.flexShrink)
15
- .flexBasis(style.flexBasis)
16
- .alignSelf(style.alignSelf)
17
- .padding({
18
- top: style.paddingTop,
19
- right: style.paddingRight,
20
- bottom: style.paddingBottom,
21
- left: style.paddingLeft
22
- })
23
- .margin({
24
- top: style.marginTop,
25
- right: style.marginRight,
26
- bottom: style.marginBottom,
27
- left: style.marginLeft
28
- })
29
- .width(style.width)
30
- .height(style.height)
31
- .constraintSize({
32
- minWidth: style.minWidth,
33
- maxWidth: style.maxWidth,
34
- minHeight: style.minHeight,
35
- maxHeight: style.maxHeight
36
- })
37
- .backgroundColor(style.backgroundColor)
38
- .backgroundImage(style.backgroundImage?.src, style.backgroundRepeat)
39
- .backgroundImageSize(style.backgroundSize)
40
- .backgroundImagePosition(style.backgroundPosition)
41
- .borderStyle({
42
- top: style.borderTopStyle,
43
- right: style.borderRightStyle,
44
- bottom: style.borderBottomStyle,
45
- left: style.borderLeftStyle
46
- })
47
- .borderWidth({
48
- top: style.borderTopWidth,
49
- right: style.borderRightWidth,
50
- bottom: style.borderBottomWidth,
51
- left: style.borderLeftWidth
52
- })
53
- .borderColor({
54
- top: style.borderTopColor,
55
- right: style.borderRightColor,
56
- bottom: style.borderBottomColor,
57
- left: style.borderLeftColor
58
- })
59
- .borderRadius({
60
- topLeft: style.borderTopLeftRadius,
61
- topRight: style.borderTopRightRadius,
62
- bottomLeft: style.borderBottomLeftRadius,
63
- bottomRight: style.borderBottomRightRadius
64
- })
65
- .zIndex(style.zIndex)
66
- .opacity(style.opacity)
67
- .linearGradient(style.linearGradient)
68
- .clip(style.overflow)
69
- .rotate({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y, angle: 0 })
70
- .scale({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y })
71
- .transform(style.transform)
72
- }
73
-
74
10
  @Extend(Text)
75
11
  function textNormalFontStyle (style: TaroStyleType) {
76
12
  .id(style.id)
@@ -119,7 +55,7 @@ export default function TaroText (node: TaroTextElement) {
119
55
  } else {
120
56
  Text(node.textContent)
121
57
  .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', node), node, ['click']))
122
- .textNormalStyle(getNormalAttributes(node))
58
+ .attributeModifier(commonStyleModify.setNode(node))
123
59
  .textNormalFontStyle(getNormalAttributes(node))
124
60
  .textSpecialFontStyle(getFontAttributes(node))
125
61
  .onVisibleAreaChange(getNodeThresholds(node) || [0.0, 1.0], getComponentEventCallback(node, VISIBLE_CHANGE_EVENT_NAME))
@@ -1,72 +1,12 @@
1
1
  import { eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME, createTaroEvent } from '@tarojs/runtime'
2
2
 
3
+ import commonStyleModify from './style'
3
4
  import { getNodeThresholds, getNormalAttributes, getFontAttributes, shouldBindEvent, parseStyles } from './utils/helper'
4
5
 
5
6
  import type { TaroAny, TaroStyleType, TaroTextStyleType, TaroTextAreaElement, TaroEvent } from '@tarojs/runtime'
6
7
 
7
8
  @Extend(TextArea)
8
9
  function textStyle (style: TaroStyleType) {
9
- .id(style.id)
10
- .key(style.id)
11
- .flexGrow(style.flexGrow)
12
- .flexShrink(style.flexShrink)
13
- .flexBasis(style.flexBasis)
14
- .alignSelf(style.alignSelf)
15
- .padding({
16
- top: style.paddingTop,
17
- right: style.paddingRight,
18
- bottom: style.paddingBottom,
19
- left: style.paddingLeft
20
- })
21
- .margin({
22
- top: style.marginTop,
23
- right: style.marginRight,
24
- bottom: style.marginBottom,
25
- left: style.marginLeft
26
- })
27
- .width(style.width)
28
- .height(style.height)
29
- .constraintSize({
30
- minWidth: style.minWidth,
31
- maxWidth: style.maxWidth,
32
- minHeight: style.minHeight,
33
- maxHeight: style.maxHeight
34
- })
35
- .backgroundColor(style.backgroundColor)
36
- .backgroundImage(style.backgroundImage?.src, style.backgroundRepeat)
37
- .backgroundImageSize(style.backgroundSize)
38
- .backgroundImagePosition(style.backgroundPosition)
39
- .borderStyle({
40
- top: style.borderTopStyle,
41
- right: style.borderRightStyle,
42
- bottom: style.borderBottomStyle,
43
- left: style.borderLeftStyle
44
- })
45
- .borderWidth({
46
- top: style.borderTopWidth,
47
- right: style.borderRightWidth,
48
- bottom: style.borderBottomWidth,
49
- left: style.borderLeftWidth
50
- })
51
- .borderColor({
52
- top: style.borderTopColor,
53
- right: style.borderRightColor,
54
- bottom: style.borderBottomColor,
55
- left: style.borderLeftColor
56
- })
57
- .borderRadius({
58
- topLeft: style.borderTopLeftRadius,
59
- topRight: style.borderTopRightRadius,
60
- bottomLeft: style.borderBottomLeftRadius,
61
- bottomRight: style.borderBottomRightRadius
62
- })
63
- .zIndex(style.zIndex)
64
- .opacity(style.opacity)
65
- .linearGradient(style.linearGradient)
66
- .clip(style.overflow)
67
- .rotate({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y, angle: 0 })
68
- .scale({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y })
69
- .transform(style.transform)
70
10
  .fontColor(style.color)
71
11
  .fontSize(style.fontSize)
72
12
  .fontWeight(style.fontWeight)
@@ -110,6 +50,7 @@ export default struct TaroTextArea {
110
50
  .key(this.node._nid)
111
51
  .maxLength(Number(this.node._attrs?.maxlength) || null)
112
52
  .placeholderColor(getPlaceholderColor(this.node))
53
+ .attributeModifier(commonStyleModify.setNode(this.node))
113
54
  .textStyle(getNormalAttributes(this.node))
114
55
  .textAttr(getFontAttributes(this.node))
115
56
  .onChange((value: string) => {
@@ -1,4 +1,5 @@
1
1
  import type { TaroElement } from '@tarojs/runtime'
2
+ import { isUndefined } from '@tarojs/shared'
2
3
 
3
4
  interface IFlexOptions {
4
5
  direction: FlexDirection,
@@ -39,7 +40,7 @@ class FlexManager {
39
40
  static flexOptions (node: TaroElement): IFlexOptions {
40
41
  const hmStyle = node.hmStyle
41
42
  const isFlex = FlexManager.isFlexNode(node)
42
- const justifyContent: FlexAlign = isFlex ? (hmStyle.justifyContent || FlexAlign.Center) : FlexAlign.Start
43
+ const justifyContent: FlexAlign = isFlex ? (isUndefined(hmStyle.justifyContent) ? FlexAlign.Start : hmStyle.justifyContent) : FlexAlign.Start
43
44
 
44
45
  let flexDirection = hmStyle.flexDirection
45
46
  if (!flexDirection && flexDirection !== 0) {
@@ -26,7 +26,7 @@ export function getFontAttributes (node: TaroElement): TaroTextStyleType {
26
26
  function isMaxWidthView (node: TaroElement) {
27
27
  const parentNode: TaroElement = node.parentNode as TaroElement
28
28
 
29
- return node.tagName === 'VIEW' && parentNode.tagName === 'VIEW' &&
29
+ return node.tagName === 'VIEW' && parentNode && parentNode.tagName === 'VIEW' &&
30
30
  !(FlexManager.isFlexNode(parentNode) && FlexManager.flexOptions(parentNode).direction !== FlexDirection.Column)
31
31
  }
32
32
 
@@ -109,6 +109,7 @@ export function getNormalAttributes (node: TaroElement): TaroStyleType {
109
109
  overflow: hmStyle.overflow,
110
110
  id: _attrs.id || _nid,
111
111
  opacity: hmStyle.opacity,
112
+ zIndex: hmStyle.zIndex
112
113
  // focus: _attrs.focus || false,
113
114
  }
114
115
 
@@ -1,9 +1,10 @@
1
1
  import { AREA_CHANGE_EVENT_NAME, eventHandler, getComponentEventCallback, VISIBLE_CHANGE_EVENT_NAME, createTaroEvent } from '@tarojs/runtime'
2
2
 
3
+ import commonStyleModify from './style'
3
4
  import { TOUCH_EVENT_MAP } from './utils/constant/event'
4
- import { getNormalAttributes, shouldBindEvent, getNodeThresholds } from './utils/helper'
5
+ import { shouldBindEvent, getNodeThresholds } from './utils/helper'
5
6
 
6
- import type { TaroStyleType, TaroAny, TaroVideoElement, TaroEvent } from '@tarojs/runtime'
7
+ import type { TaroAny, TaroVideoElement, TaroEvent } from '@tarojs/runtime'
7
8
 
8
9
  export interface VideoOptions {
9
10
  src?: string | Resource
@@ -21,71 +22,6 @@ export interface VideoUpdateEvent {
21
22
  time: number
22
23
  }
23
24
 
24
- @Extend(Video)
25
- function attrs (style: TaroStyleType) {
26
- .id(style.id)
27
- .key(style.id)
28
- .flexGrow(style.flexGrow)
29
- .flexShrink(style.flexShrink)
30
- .flexBasis(style.flexBasis)
31
- .alignSelf(style.alignSelf)
32
- .padding({
33
- top: style.paddingTop,
34
- right: style.paddingRight,
35
- bottom: style.paddingBottom,
36
- left: style.paddingLeft
37
- })
38
- .margin({
39
- top: style.marginTop,
40
- right: style.marginRight,
41
- bottom: style.marginBottom,
42
- left: style.marginLeft
43
- })
44
- .width(style.width)
45
- .height(style.height)
46
- .constraintSize({
47
- minWidth: style.minWidth,
48
- maxWidth: style.maxWidth,
49
- minHeight: style.minHeight,
50
- maxHeight: style.maxHeight
51
- })
52
- .backgroundColor(style.backgroundColor)
53
- .backgroundImage(style.backgroundImage?.src, style.backgroundRepeat)
54
- .backgroundImageSize(style.backgroundSize)
55
- .backgroundImagePosition(style.backgroundPosition)
56
- .borderStyle({
57
- top: style.borderTopStyle,
58
- right: style.borderRightStyle,
59
- bottom: style.borderBottomStyle,
60
- left: style.borderLeftStyle
61
- })
62
- .borderWidth({
63
- top: style.borderTopWidth,
64
- right: style.borderRightWidth,
65
- bottom: style.borderBottomWidth,
66
- left: style.borderLeftWidth
67
- })
68
- .borderColor({
69
- top: style.borderTopColor,
70
- right: style.borderRightColor,
71
- bottom: style.borderBottomColor,
72
- left: style.borderLeftColor
73
- })
74
- .borderRadius({
75
- topLeft: style.borderTopLeftRadius,
76
- topRight: style.borderTopRightRadius,
77
- bottomLeft: style.borderBottomLeftRadius,
78
- bottomRight: style.borderBottomRightRadius
79
- })
80
- .zIndex(style.zIndex)
81
- .opacity(style.opacity)
82
- .linearGradient(style.linearGradient)
83
- .clip(style.overflow)
84
- .rotate({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y, angle: 0 })
85
- .scale({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y })
86
- .transform(style.transform)
87
- }
88
-
89
25
  @Extend(Video)
90
26
  function props(attr: VideoAttrs) {
91
27
  .muted(attr.muted)
@@ -145,7 +81,7 @@ function handleUpdate (node: TaroVideoElement, e: VideoUpdateEvent) {
145
81
  @Builder
146
82
  export default function TaroVideo (node: TaroVideoElement) {
147
83
  Video(getVideoData(node))
148
- .attrs(getNormalAttributes(node))
84
+ .attributeModifier(commonStyleModify.setNode(node))
149
85
  .props(getVideoProps(node))
150
86
  .aspectRatio(4 / 3)
151
87
  .onStart(shouldBindEvent(() => { emitEvent(node, 'play') }, node, ['play']))
@@ -1,140 +1,31 @@
1
1
  import { eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME } from '@tarojs/runtime'
2
2
 
3
+ import commonStyleModify from './style'
3
4
  import { createLazyChildren } from './render'
4
5
  import { TOUCH_EVENT_MAP } from './utils/constant/event'
5
6
  import { FlexManager } from './utils/FlexManager'
6
7
  import { getNodeThresholds, getNormalAttributes, shouldBindEvent } from './utils/helper'
7
8
 
8
- import type { TaroViewElement, TaroAny, TaroStyleType } from '@tarojs/runtime'
9
+ import type { TaroViewElement, TaroStyleType, TaroAny } from '@tarojs/runtime'
9
10
 
10
- @Extend(Column)
11
- function columnAttrs (style: TaroStyleType) {
12
- .id(style.id)
13
- .key(style.id)
14
- .flexGrow(style.flexGrow)
15
- .flexShrink(style.flexShrink)
16
- .flexBasis(style.flexBasis)
17
- .alignSelf(style.alignSelf)
18
- .padding({
19
- top: style.paddingTop,
20
- right: style.paddingRight,
21
- bottom: style.paddingBottom,
22
- left: style.paddingLeft
23
- })
24
- .margin({
25
- top: style.marginTop,
26
- right: style.marginRight,
27
- bottom: style.marginBottom,
28
- left: style.marginLeft
29
- })
30
- .width(style.width)
31
- .height(style.height)
11
+ @Extend(Row)
12
+ function rowAttrs (style: TaroStyleType) {
32
13
  .constraintSize({
33
- minWidth: style.minWidth,
14
+ minWidth: style.minWidth || style.width,
34
15
  maxWidth: style.maxWidth,
35
16
  minHeight: style.minHeight,
36
17
  maxHeight: style.maxHeight
37
18
  })
38
- .backgroundColor(style.backgroundColor)
39
- .backgroundImage(style.backgroundImage?.src, style.backgroundRepeat)
40
- .backgroundImageSize(style.backgroundSize)
41
- .backgroundImagePosition(style.backgroundPosition)
42
- .borderStyle({
43
- top: style.borderTopStyle,
44
- right: style.borderRightStyle,
45
- bottom: style.borderBottomStyle,
46
- left: style.borderLeftStyle
47
- })
48
- .borderWidth({
49
- top: style.borderTopWidth,
50
- right: style.borderRightWidth,
51
- bottom: style.borderBottomWidth,
52
- left: style.borderLeftWidth
53
- })
54
- .borderColor({
55
- top: style.borderTopColor,
56
- right: style.borderRightColor,
57
- bottom: style.borderBottomColor,
58
- left: style.borderLeftColor
59
- })
60
- .borderRadius({
61
- topLeft: style.borderTopLeftRadius,
62
- topRight: style.borderTopRightRadius,
63
- bottomLeft: style.borderBottomLeftRadius,
64
- bottomRight: style.borderBottomRightRadius
65
- })
66
- .zIndex(style.zIndex)
67
- .opacity(style.opacity)
68
- .linearGradient(style.linearGradient)
69
- .clip(style.overflow)
70
- .rotate({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y, angle: 0 })
71
- .scale({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y })
72
- .transform(style.transform)
73
19
  }
74
20
 
75
- @Extend(Row)
76
- function rowAttrs (style: TaroStyleType) {
77
- .id(style.id)
78
- .key(style.id)
79
- .flexGrow(style.flexGrow)
80
- .flexShrink(style.flexShrink)
81
- .flexBasis(style.flexBasis)
82
- .alignSelf(style.alignSelf)
83
- .padding({
84
- top: style.paddingTop,
85
- right: style.paddingRight,
86
- bottom: style.paddingBottom,
87
- left: style.paddingLeft
88
- })
89
- .margin({
90
- top: style.marginTop,
91
- right: style.marginRight,
92
- bottom: style.marginBottom,
93
- left: style.marginLeft
94
- })
95
- .width(style.width)
96
- .height(style.height)
21
+ @Extend(Column)
22
+ function columnAttrs (style: TaroStyleType) {
97
23
  .constraintSize({
98
24
  minWidth: style.minWidth,
99
25
  maxWidth: style.maxWidth,
100
- minHeight: style.minHeight,
26
+ minHeight: style.minHeight || style.height,
101
27
  maxHeight: style.maxHeight
102
28
  })
103
- .backgroundColor(style.backgroundColor)
104
- .backgroundImage(style.backgroundImage?.src, style.backgroundRepeat)
105
- .backgroundImageSize(style.backgroundSize)
106
- .backgroundImagePosition(style.backgroundPosition)
107
- .borderStyle({
108
- top: style.borderTopStyle,
109
- right: style.borderRightStyle,
110
- bottom: style.borderBottomStyle,
111
- left: style.borderLeftStyle
112
- })
113
- .borderWidth({
114
- top: style.borderTopWidth,
115
- right: style.borderRightWidth,
116
- bottom: style.borderBottomWidth,
117
- left: style.borderLeftWidth
118
- })
119
- .borderColor({
120
- top: style.borderTopColor,
121
- right: style.borderRightColor,
122
- bottom: style.borderBottomColor,
123
- left: style.borderLeftColor
124
- })
125
- .borderRadius({
126
- topLeft: style.borderTopLeftRadius,
127
- topRight: style.borderTopRightRadius,
128
- bottomLeft: style.borderBottomLeftRadius,
129
- bottomRight: style.borderBottomRightRadius
130
- })
131
- .zIndex(style.zIndex)
132
- .opacity(style.opacity)
133
- .linearGradient(style.linearGradient)
134
- .clip(style.overflow)
135
- .rotate({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y, angle: 0 })
136
- .scale({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y })
137
- .transform(style.transform)
138
29
  }
139
30
 
140
31
  @Builder
@@ -143,6 +34,7 @@ export default function TaroView (node: TaroViewElement) {
143
34
  Row() {
144
35
  createLazyChildren(node)
145
36
  }
37
+ .attributeModifier(commonStyleModify.setNode(node))
146
38
  .rowAttrs(getNormalAttributes(node))
147
39
  .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', node), node, ['click']))
148
40
  .onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), node), node, TOUCH_EVENT_MAP.values()))
@@ -156,6 +48,7 @@ export default function TaroView (node: TaroViewElement) {
156
48
  Column() {
157
49
  createLazyChildren(node)
158
50
  }
51
+ .attributeModifier(commonStyleModify.setNode(node))
159
52
  .columnAttrs(getNormalAttributes(node))
160
53
  .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', node), node, ['click']))
161
54
  .onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), node), node, TOUCH_EVENT_MAP.values()))
@@ -1,5 +1,6 @@
1
1
  import { AREA_CHANGE_EVENT_NAME, eventHandler, getComponentEventCallback, VISIBLE_CHANGE_EVENT_NAME, createTaroEvent } from '@tarojs/runtime'
2
2
 
3
+ import commonStyleModify from './style'
3
4
  import { getNormalAttributes, shouldBindEvent, getNodeThresholds } from './utils/helper'
4
5
 
5
6
  import type { TaroAny, TaroWebViewElement, TaroStyleType, TaroEvent } from '@tarojs/runtime'
@@ -13,74 +14,10 @@ interface IError {
13
14
  error: WebResourceError
14
15
  }
15
16
 
16
- @Extend(Web)
17
- function attrs (style: TaroStyleType) {
18
- .id(style.id)
19
- .key(style.id)
20
- .flexGrow(style.flexGrow)
21
- .flexShrink(style.flexShrink)
22
- .flexBasis(style.flexBasis)
23
- .alignSelf(style.alignSelf)
24
- .padding({
25
- top: style.paddingTop,
26
- right: style.paddingRight,
27
- bottom: style.paddingBottom,
28
- left: style.paddingLeft
29
- })
30
- .margin({
31
- top: style.marginTop,
32
- right: style.marginRight,
33
- bottom: style.marginBottom,
34
- left: style.marginLeft
35
- })
36
- .width(style.width)
37
- .height(style.height)
38
- .constraintSize({
39
- minWidth: style.minWidth,
40
- maxWidth: style.maxWidth,
41
- minHeight: style.minHeight,
42
- maxHeight: style.maxHeight
43
- })
44
- .backgroundColor(style.backgroundColor)
45
- .backgroundImage(style.backgroundImage?.src, style.backgroundRepeat)
46
- .backgroundImageSize(style.backgroundSize)
47
- .backgroundImagePosition(style.backgroundPosition)
48
- .borderStyle({
49
- top: style.borderTopStyle,
50
- right: style.borderRightStyle,
51
- bottom: style.borderBottomStyle,
52
- left: style.borderLeftStyle
53
- })
54
- .borderWidth({
55
- top: style.borderTopWidth,
56
- right: style.borderRightWidth,
57
- bottom: style.borderBottomWidth,
58
- left: style.borderLeftWidth
59
- })
60
- .borderColor({
61
- top: style.borderTopColor,
62
- right: style.borderRightColor,
63
- bottom: style.borderBottomColor,
64
- left: style.borderLeftColor
65
- })
66
- .borderRadius({
67
- topLeft: style.borderTopLeftRadius,
68
- topRight: style.borderTopRightRadius,
69
- bottomLeft: style.borderBottomLeftRadius,
70
- bottomRight: style.borderBottomRightRadius
71
- })
72
- .zIndex(style.zIndex)
73
- .opacity(style.opacity)
74
- .clip(style.overflow)
75
- .rotate({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y, angle: 0 })
76
- .scale({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y })
77
- .transform(style.transform)
78
- }
79
-
80
17
  @Builder
81
18
  export default function TaroWebView (node: TaroWebViewElement) {
82
19
  Web({ src: node._attrs.src, controller: node.controller })
83
- .attrs(getNormalAttributes(node))
20
+ .attributeModifier(commonStyleModify.setNode(node))
84
21
  .onPageEnd((e: IPageLoad) => {
85
22
  // 1. 创建消息端口
86
23
  node.ports = node.controller.createWebMessagePorts(true)
package/dist/index.js CHANGED
@@ -244,7 +244,8 @@ class TaroPlatformHarmony extends service.TaroPlatform {
244
244
  FRAMEWORK: JSON.stringify(this.config.framework),
245
245
  TARO_ENV: JSON.stringify(this.platform),
246
246
  TARO_PLATFORM: JSON.stringify(this.platformType),
247
- TARO_VERSION: JSON.stringify(_package.getPkgVersion())
247
+ TARO_VERSION: JSON.stringify(_package.getPkgVersion()),
248
+ SUPPORT_TARO_POLYFILL: 'disabled',
248
249
  },
249
250
  });
250
251
  return Object.assign(Object.assign(Object.assign({}, config), { buildAdapter: config.platform, fileType: this.fileType, platformType: this.platformType, useETS: this.useETS, useJSON5: this.useJSON5 }), extraOptions);