@tarojs/plugin-platform-harmony-ets 4.0.0-beta.2 → 4.0.0-beta.4

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 (30) hide show
  1. package/dist/components-harmony-ets/button.ets +3 -47
  2. package/dist/components-harmony-ets/checkbox.ets +6 -200
  3. package/dist/components-harmony-ets/form.ets +5 -134
  4. package/dist/components-harmony-ets/icon.ets +5 -67
  5. package/dist/components-harmony-ets/image.ets +2 -66
  6. package/dist/components-harmony-ets/innerHtml.ets +2 -2
  7. package/dist/components-harmony-ets/input.ets +2 -61
  8. package/dist/components-harmony-ets/label.ets +4 -133
  9. package/dist/components-harmony-ets/picker.ets +15 -136
  10. package/dist/components-harmony-ets/radio.ets +6 -200
  11. package/dist/components-harmony-ets/richText.ets +4 -70
  12. package/dist/components-harmony-ets/scrollView.ets +4 -132
  13. package/dist/components-harmony-ets/slider.ets +4 -68
  14. package/dist/components-harmony-ets/style.ets +154 -0
  15. package/dist/components-harmony-ets/swiper.ets +4 -68
  16. package/dist/components-harmony-ets/switch.ets +4 -68
  17. package/dist/components-harmony-ets/text.ets +2 -66
  18. package/dist/components-harmony-ets/textArea.ets +2 -61
  19. package/dist/components-harmony-ets/utils/helper.ets +2 -2
  20. package/dist/components-harmony-ets/utils/styles.ets +1 -1
  21. package/dist/components-harmony-ets/video.ets +4 -68
  22. package/dist/components-harmony-ets/view.ets +5 -134
  23. package/dist/components-harmony-ets/webView.ets +2 -65
  24. package/dist/index.js +3 -2
  25. package/dist/index.js.map +1 -1
  26. package/dist/runtime-ets/bom/window.ts +2 -2
  27. package/dist/runtime-framework/react/hooks.ts +3 -3
  28. package/dist/runtime-framework/react/native-page.ts +3 -3
  29. package/dist/runtime-framework/solid/hooks.ts +3 -3
  30. package/package.json +8 -8
@@ -1,56 +1,12 @@
1
1
  import { eventHandler, createTaroEvent, convertNumber2VP, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME } from '@tarojs/runtime'
2
2
  import { createLazyChildren } from './render'
3
+ import commonStyleModify from './style'
3
4
  import { BUTTON_THEME_COLOR } from './utils/constant/style'
4
5
  import { TOUCH_EVENT_MAP } from './utils/constant/event'
5
- import { getNormalAttributes, shouldBindEvent, getNodeThresholds } from './utils/helper'
6
+ import { shouldBindEvent, getNodeThresholds } from './utils/helper'
6
7
 
7
8
  import type { TaroAny, TaroEvent, TaroButtonElement, TaroStyleType } from '@tarojs/runtime'
8
9
 
9
- @Extend(Button)
10
- function attrs (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 || 10,
20
- bottom: style.paddingBottom,
21
- left: style.paddingLeft || 10
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
- .backgroundImage(style.backgroundImage?.src, style.backgroundRepeat)
38
- .backgroundImageSize(style.backgroundSize)
39
- .backgroundImagePosition(style.backgroundPosition)
40
- .borderStyle({
41
- top: style.borderTopStyle,
42
- right: style.borderRightStyle,
43
- bottom: style.borderBottomStyle,
44
- left: style.borderLeftStyle
45
- })
46
- .zIndex(style.zIndex)
47
- .linearGradient(style.linearGradient)
48
- .clip(style.overflow)
49
- .rotate({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y, angle: 0 })
50
- .scale({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y })
51
- .transform(style.transform)
52
- }
53
-
54
10
  @Extend(Button)
55
11
  function themeStyles(style: TaroStyleType) {
56
12
  .fontColor(style.color)
@@ -151,7 +107,7 @@ export default function TaroButton (node: TaroButtonElement) {
151
107
  }
152
108
  }
153
109
  .themeStyles(getThemeAttributes(node))
154
- .attrs(getNormalAttributes(node))
110
+ .attributeModifier(commonStyleModify.setNode(node))
155
111
  .constraintSize({
156
112
  minWidth: node.hmStyle?.minWidth || getButtonMinWidth(node),
157
113
  minHeight: node.hmStyle?.minHeight || getButtonMinHeight(node),
@@ -1,10 +1,11 @@
1
1
  import { createTaroEvent, 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 { FlexManager } from './utils/FlexManager'
5
- import { shouldBindEvent, getNormalAttributes, getNodeThresholds } from './utils/helper'
6
+ import { shouldBindEvent, getNodeThresholds } from './utils/helper'
6
7
 
7
- import type { TaroStyleType, TaroAny, TaroEvent, TaroCheckboxElement, TaroCheckboxGroupElement } from '@tarojs/runtime'
8
+ import type { TaroAny, TaroEvent, TaroCheckboxElement, TaroCheckboxGroupElement } from '@tarojs/runtime'
8
9
 
9
10
  interface CheckboxOptions {
10
11
  name?: string
@@ -14,71 +15,6 @@ interface CheckboxAttrs {
14
15
  selectedColor?: ResourceColor
15
16
  }
16
17
 
17
- @Extend(Checkbox)
18
- function checkboxStyle (style: TaroStyleType) {
19
- .id(style.id)
20
- .key(style.id)
21
- .flexGrow(style.flexGrow)
22
- .flexShrink(style.flexShrink)
23
- .flexBasis(style.flexBasis)
24
- .alignSelf(style.alignSelf)
25
- .padding({
26
- top: style.paddingTop,
27
- right: style.paddingRight,
28
- bottom: style.paddingBottom,
29
- left: style.paddingLeft
30
- })
31
- .margin({
32
- top: style.marginTop,
33
- right: style.marginRight,
34
- bottom: style.marginBottom,
35
- left: style.marginLeft
36
- })
37
- .width(style.width)
38
- .height(style.height)
39
- .constraintSize({
40
- minWidth: style.minWidth,
41
- maxWidth: style.maxWidth,
42
- minHeight: style.minHeight,
43
- maxHeight: style.maxHeight
44
- })
45
- .backgroundColor(style.backgroundColor)
46
- .backgroundImage(style.backgroundImage?.src, style.backgroundRepeat)
47
- .backgroundImageSize(style.backgroundSize)
48
- .backgroundImagePosition(style.backgroundPosition)
49
- .borderStyle({
50
- top: style.borderTopStyle,
51
- right: style.borderRightStyle,
52
- bottom: style.borderBottomStyle,
53
- left: style.borderLeftStyle
54
- })
55
- .borderWidth({
56
- top: style.borderTopWidth,
57
- right: style.borderRightWidth,
58
- bottom: style.borderBottomWidth,
59
- left: style.borderLeftWidth
60
- })
61
- .borderColor({
62
- top: style.borderTopColor,
63
- right: style.borderRightColor,
64
- bottom: style.borderBottomColor,
65
- left: style.borderLeftColor
66
- })
67
- .borderRadius({
68
- topLeft: style.borderTopLeftRadius,
69
- topRight: style.borderTopRightRadius,
70
- bottomLeft: style.borderBottomLeftRadius,
71
- bottomRight: style.borderBottomRightRadius
72
- })
73
- .zIndex(style.zIndex)
74
- .opacity(style.opacity)
75
- .linearGradient(style.linearGradient)
76
- .clip(style.overflow)
77
- .rotate({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y, angle: 0 })
78
- .scale({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y })
79
- .transform(style.transform)
80
- }
81
-
82
18
  @Extend(Checkbox)
83
19
  function checkboxAttr(attr: CheckboxAttrs) {
84
20
  .selectedColor(attr.selectedColor)
@@ -113,7 +49,7 @@ export struct TaroCheckbox {
113
49
  Stack() {
114
50
  Row() {
115
51
  Checkbox(getOptions(this.node))
116
- .checkboxStyle(getNormalAttributes(this.node))
52
+ .attributeModifier(commonStyleModify.setNode(this.node))
117
53
  .checkboxAttr(getAttributes(this.node))
118
54
  .opacity(!!this.node._attrs.disabled ? 0.4 : 1)
119
55
  .select(this.node.checked)
@@ -154,136 +90,6 @@ export struct TaroCheckbox {
154
90
  }
155
91
  }
156
92
 
157
- @Extend(Column)
158
- function checkboxGroupColumnAttrs (style: TaroStyleType) {
159
- .id(style.id)
160
- .key(style.id)
161
- .flexGrow(style.flexGrow)
162
- .flexShrink(style.flexShrink)
163
- .flexBasis(style.flexBasis)
164
- .alignSelf(style.alignSelf)
165
- .padding({
166
- top: style.paddingTop,
167
- right: style.paddingRight,
168
- bottom: style.paddingBottom,
169
- left: style.paddingLeft
170
- })
171
- .margin({
172
- top: style.marginTop,
173
- right: style.marginRight,
174
- bottom: style.marginBottom,
175
- left: style.marginLeft
176
- })
177
- .width(style.width)
178
- .height(style.height)
179
- .constraintSize({
180
- minWidth: style.minWidth,
181
- maxWidth: style.maxWidth,
182
- minHeight: style.minHeight,
183
- maxHeight: style.maxHeight
184
- })
185
- .backgroundColor(style.backgroundColor)
186
- .backgroundImage(style.backgroundImage?.src, style.backgroundRepeat)
187
- .backgroundImageSize(style.backgroundSize)
188
- .backgroundImagePosition(style.backgroundPosition)
189
- .borderStyle({
190
- top: style.borderTopStyle,
191
- right: style.borderRightStyle,
192
- bottom: style.borderBottomStyle,
193
- left: style.borderLeftStyle
194
- })
195
- .borderWidth({
196
- top: style.borderTopWidth,
197
- right: style.borderRightWidth,
198
- bottom: style.borderBottomWidth,
199
- left: style.borderLeftWidth
200
- })
201
- .borderColor({
202
- top: style.borderTopColor,
203
- right: style.borderRightColor,
204
- bottom: style.borderBottomColor,
205
- left: style.borderLeftColor
206
- })
207
- .borderRadius({
208
- topLeft: style.borderTopLeftRadius,
209
- topRight: style.borderTopRightRadius,
210
- bottomLeft: style.borderBottomLeftRadius,
211
- bottomRight: style.borderBottomRightRadius
212
- })
213
- .zIndex(style.zIndex)
214
- .opacity(style.opacity)
215
- .linearGradient(style.linearGradient)
216
- .clip(style.overflow)
217
- .rotate({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y, angle: 0 })
218
- .scale({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y })
219
- .transform(style.transform)
220
- }
221
-
222
- @Extend(Row)
223
- function checkboxGroupRowAttrs (style: TaroStyleType) {
224
- .id(style.id)
225
- .key(style.id)
226
- .flexGrow(style.flexGrow)
227
- .flexShrink(style.flexShrink)
228
- .flexBasis(style.flexBasis)
229
- .alignSelf(style.alignSelf)
230
- .padding({
231
- top: style.paddingTop,
232
- right: style.paddingRight,
233
- bottom: style.paddingBottom,
234
- left: style.paddingLeft
235
- })
236
- .margin({
237
- top: style.marginTop,
238
- right: style.marginRight,
239
- bottom: style.marginBottom,
240
- left: style.marginLeft
241
- })
242
- .width(style.width)
243
- .height(style.height)
244
- .constraintSize({
245
- minWidth: style.minWidth,
246
- maxWidth: style.maxWidth,
247
- minHeight: style.minHeight,
248
- maxHeight: style.maxHeight
249
- })
250
- .backgroundColor(style.backgroundColor)
251
- .backgroundImage(style.backgroundImage?.src, style.backgroundRepeat)
252
- .backgroundImageSize(style.backgroundSize)
253
- .backgroundImagePosition(style.backgroundPosition)
254
- .borderStyle({
255
- top: style.borderTopStyle,
256
- right: style.borderRightStyle,
257
- bottom: style.borderBottomStyle,
258
- left: style.borderLeftStyle
259
- })
260
- .borderWidth({
261
- top: style.borderTopWidth,
262
- right: style.borderRightWidth,
263
- bottom: style.borderBottomWidth,
264
- left: style.borderLeftWidth
265
- })
266
- .borderColor({
267
- top: style.borderTopColor,
268
- right: style.borderRightColor,
269
- bottom: style.borderBottomColor,
270
- left: style.borderLeftColor
271
- })
272
- .borderRadius({
273
- topLeft: style.borderTopLeftRadius,
274
- topRight: style.borderTopRightRadius,
275
- bottomLeft: style.borderBottomLeftRadius,
276
- bottomRight: style.borderBottomRightRadius
277
- })
278
- .zIndex(style.zIndex)
279
- .opacity(style.opacity)
280
- .linearGradient(style.linearGradient)
281
- .clip(style.overflow)
282
- .rotate({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y, angle: 0 })
283
- .scale({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y })
284
- .transform(style.transform)
285
- }
286
-
287
93
  interface ChangeEventDetail { value: string[] }
288
94
 
289
95
  @Component
@@ -319,7 +125,7 @@ export struct TaroCheckboxGroup {
319
125
  Row() {
320
126
  createLazyChildren(this.node)
321
127
  }
322
- .checkboxGroupRowAttrs(getNormalAttributes(this.node))
128
+ .attributeModifier(commonStyleModify.setNode(this.node))
323
129
  .defaultEvent()
324
130
  .visibleChangeEvent()
325
131
  .alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
@@ -328,7 +134,7 @@ export struct TaroCheckboxGroup {
328
134
  Column() {
329
135
  createLazyChildren(this.node)
330
136
  }
331
- .checkboxGroupColumnAttrs(getNormalAttributes(this.node))
137
+ .attributeModifier(commonStyleModify.setNode(this.node))
332
138
  .defaultEvent()
333
139
  .visibleChangeEvent()
334
140
  .alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
@@ -1,141 +1,12 @@
1
1
  import { AREA_CHANGE_EVENT_NAME, eventHandler, getComponentEventCallback, 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
- import { getNormalAttributes, shouldBindEvent, getNodeThresholds } from './utils/helper'
7
+ import { shouldBindEvent, getNodeThresholds } from './utils/helper'
7
8
 
8
- import type { TaroAny, TaroFormElement, TaroStyleType } from '@tarojs/runtime'
9
-
10
- @Extend(Row)
11
- function rowAttrs (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)
32
- .constraintSize({
33
- minWidth: style.minWidth,
34
- maxWidth: style.maxWidth,
35
- minHeight: style.minHeight,
36
- maxHeight: style.maxHeight
37
- })
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
- }
74
-
75
- @Extend(Column)
76
- function columnAttrs (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)
97
- .constraintSize({
98
- minWidth: style.minWidth,
99
- maxWidth: style.maxWidth,
100
- minHeight: style.minHeight,
101
- maxHeight: style.maxHeight
102
- })
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
- }
9
+ import type { TaroAny, TaroFormElement } from '@tarojs/runtime'
139
10
 
140
11
  @Builder
141
12
  export default function TaroForm (node: TaroFormElement) {
@@ -143,7 +14,7 @@ export default function TaroForm (node: TaroFormElement) {
143
14
  Row() {
144
15
  createLazyChildren(node)
145
16
  }
146
- .rowAttrs(getNormalAttributes(node))
17
+ .attributeModifier(commonStyleModify.setNode(node))
147
18
  .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', node), node, ['click']))
148
19
  .onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), node), node, TOUCH_EVENT_MAP.values()))
149
20
  .onAreaChange(getComponentEventCallback(node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
@@ -156,7 +27,7 @@ export default function TaroForm (node: TaroFormElement) {
156
27
  Column() {
157
28
  createLazyChildren(node)
158
29
  }
159
- .columnAttrs(getNormalAttributes(node))
30
+ .attributeModifier(commonStyleModify.setNode(node))
160
31
  .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', node), node, ['click']))
161
32
  .onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), node), node, TOUCH_EVENT_MAP.values()))
162
33
  .onAreaChange(getComponentEventCallback(node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
@@ -1,73 +1,9 @@
1
1
  import { eventHandler, convertNumber2VP, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME, convertNumber2PX } from '@tarojs/runtime'
2
2
 
3
+ import commonStyleModify from './style'
3
4
  import { getNormalAttributes, shouldBindEvent, getNodeThresholds } from './utils/helper'
4
5
 
5
- import type { TaroIconElement, TaroAny, TaroStyleType } from '@tarojs/runtime'
6
-
7
- @Extend(Image)
8
- function attrs (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 || convertNumber2PX(23))
28
- .height(style.height || convertNumber2PX(23))
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
- }
6
+ import type { TaroIconElement, TaroAny } from '@tarojs/runtime'
71
7
 
72
8
  const ICON_COLOR_MAP: TaroAny = {
73
9
  success: Color.Green,
@@ -117,11 +53,13 @@ export default function TaroIcon (node: TaroIconElement) {
117
53
  Image(getIconData(node))
118
54
  .objectFit(ImageFit.Contain)
119
55
  .fillColor(node._attrs.color || ICON_COLOR_MAP[node._attrs.type] || Color.Black)
120
- .attrs(getNormalAttributes(node))
56
+ .attributeModifier(commonStyleModify.setNode(node))
121
57
  .size({
122
58
  width: convertNumber2VP(Number(node._attrs.size) || 23),
123
59
  height: convertNumber2VP(Number(node._attrs.size) || 23),
124
60
  })
61
+ .width(getNormalAttributes(node).width || convertNumber2PX(23))
62
+ .height(getNormalAttributes(node).height || convertNumber2PX(23))
125
63
  .onComplete(e => eventHandler(e, 'complete', node))
126
64
  .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', node), node, ['click']))
127
65
  .onVisibleAreaChange(getNodeThresholds(node) || [0.0, 1.0], getComponentEventCallback(node, VISIBLE_CHANGE_EVENT_NAME))
@@ -1,74 +1,10 @@
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 { getNormalAttributes, shouldBindEvent, getNodeThresholds } from './utils/helper'
4
5
 
5
6
  import type { TaroImageElement, TaroAny, TaroStyleType } from '@tarojs/runtime'
6
7
 
7
- @Extend(Image)
8
- function attrs (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
- }
71
-
72
8
  function getImageMode (mode: string): ImageFit {
73
9
  switch (mode) {
74
10
  case 'aspectFit': return ImageFit.Contain
@@ -88,7 +24,7 @@ export default function TaroImage (node: TaroImageElement) {
88
24
  node._nodeInfo.areaInfo = res[1]
89
25
  }))
90
26
  .objectFit(getImageMode(node.getAttribute('mode')))
91
- .attrs(getNormalAttributes(node))
27
+ .attributeModifier(commonStyleModify.setNode(node))
92
28
  .onComplete(e => eventHandler(e, 'complete', node))
93
29
  .onVisibleAreaChange(getNodeThresholds(node) || [0.0, 1.0], getComponentEventCallback(node, VISIBLE_CHANGE_EVENT_NAME))
94
30
  }
@@ -1,11 +1,11 @@
1
1
  import htmlParser from './utils/htmlParser'
2
- import { createChildItemWithPosition } from './render'
2
+ import { createChildItem } from './render'
3
3
 
4
4
  import type { TaroElement } from '@tarojs/runtime'
5
5
 
6
6
  @Builder
7
7
  export default function TaroInnerHtml (node: TaroElement) {
8
8
  if (node.innerHTML) {
9
- createChildItemWithPosition(htmlParser(node.innerHTML))
9
+ createChildItem(htmlParser(node.innerHTML))
10
10
  }
11
11
  }