@tarojs/plugin-platform-harmony-ets 4.0.0-canary.8 → 4.0.0

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 (135) hide show
  1. package/dist/apis/base/system.ts +73 -20
  2. package/dist/apis/canvas/index.ts +10 -1
  3. package/dist/apis/device/clipboard.ts +23 -8
  4. package/dist/apis/framework/index.ts +1 -5
  5. package/dist/apis/index.ts +27 -17
  6. package/dist/apis/media/image/index.ts +169 -17
  7. package/dist/apis/network/request.ts +5 -5
  8. package/dist/apis/route/index.ts +15 -0
  9. package/dist/apis/storage/index.ts +146 -78
  10. package/dist/apis/ui/animation/animation.ts +71 -29
  11. package/dist/apis/ui/background.ts +2 -1
  12. package/dist/apis/ui/interaction/index.ts +58 -59
  13. package/dist/apis/ui/navigation-bar/index.ts +1 -1
  14. package/dist/apis/ui/pull-down-refresh.ts +9 -3
  15. package/dist/apis/ui/scroll/index.ts +5 -5
  16. package/dist/apis/ui/tab-bar.ts +3 -3
  17. package/dist/apis/utils/index.ts +21 -2
  18. package/dist/apis/utils/permissions.ts +6 -0
  19. package/dist/apis/wxml/IntersectionObserver.ts +18 -10
  20. package/dist/apis/wxml/index.ts +2 -0
  21. package/dist/apis/wxml/selectorQuery.ts +26 -13
  22. package/dist/components-harmony-ets/button.ets +63 -77
  23. package/dist/components-harmony-ets/canvas.ets +51 -0
  24. package/dist/components-harmony-ets/checkbox.ets +75 -258
  25. package/dist/components-harmony-ets/form.ets +51 -158
  26. package/dist/components-harmony-ets/icon.ets +33 -83
  27. package/dist/components-harmony-ets/image.ets +35 -79
  28. package/dist/components-harmony-ets/index.ets +92 -0
  29. package/dist/components-harmony-ets/innerHtml.ets +11 -6
  30. package/dist/components-harmony-ets/input.ets +64 -101
  31. package/dist/components-harmony-ets/label.ets +72 -174
  32. package/dist/components-harmony-ets/listView.ets +31 -0
  33. package/dist/components-harmony-ets/movableArea.ets +126 -0
  34. package/dist/components-harmony-ets/movableView.ets +93 -0
  35. package/dist/components-harmony-ets/navigationBar.ets +65 -0
  36. package/dist/components-harmony-ets/pageMeta.ets +94 -0
  37. package/dist/components-harmony-ets/picker.ets +46 -163
  38. package/dist/components-harmony-ets/progress.ets +52 -0
  39. package/dist/components-harmony-ets/pseudo.ets +80 -0
  40. package/dist/components-harmony-ets/radio.ets +80 -264
  41. package/dist/components-harmony-ets/richText.ets +20 -102
  42. package/dist/components-harmony-ets/scrollList.ets +108 -0
  43. package/dist/components-harmony-ets/scrollView.ets +71 -160
  44. package/dist/components-harmony-ets/slider.ets +22 -82
  45. package/dist/components-harmony-ets/stickySection.ets +42 -0
  46. package/dist/components-harmony-ets/style.ets +410 -0
  47. package/dist/components-harmony-ets/swiper.ets +64 -87
  48. package/dist/components-harmony-ets/switch.ets +39 -99
  49. package/dist/components-harmony-ets/{index.ts → tag.ts} +6 -0
  50. package/dist/components-harmony-ets/text.ets +111 -113
  51. package/dist/components-harmony-ets/textArea.ets +51 -95
  52. package/dist/components-harmony-ets/utils/AttributeManager.ets +2 -2
  53. package/dist/components-harmony-ets/utils/DynamicCenter.ts +2 -2
  54. package/dist/components-harmony-ets/utils/flexManager.ets +50 -19
  55. package/dist/components-harmony-ets/utils/helper.ets +20 -8
  56. package/dist/components-harmony-ets/utils/htmlParser/HarmonyHTMLParser.ts +1 -2
  57. package/dist/components-harmony-ets/utils/htmlParser/index.ts +1 -1
  58. package/dist/components-harmony-ets/utils/index.ts +54 -50
  59. package/dist/components-harmony-ets/utils/styles.ets +172 -92
  60. package/dist/components-harmony-ets/video.ets +37 -88
  61. package/dist/components-harmony-ets/view.ets +63 -159
  62. package/dist/components-harmony-ets/webView.ets +41 -98
  63. package/dist/index.d.ts +152 -0
  64. package/dist/index.js +187 -56
  65. package/dist/index.js.map +1 -1
  66. package/dist/runtime-ets/bom/document.ts +6 -4
  67. package/dist/runtime-ets/bom/getComputedStyle.ts +2 -2
  68. package/dist/runtime-ets/bom/window.ts +9 -2
  69. package/dist/runtime-ets/current.ts +5 -1
  70. package/dist/runtime-ets/dom/bind.ts +28 -12
  71. package/dist/runtime-ets/dom/class-list.ts +2 -2
  72. package/dist/runtime-ets/dom/cssNesting.ts +419 -0
  73. package/dist/runtime-ets/dom/cssStyleDeclaration.ts +28 -42
  74. package/dist/runtime-ets/dom/document.ts +22 -8
  75. package/dist/runtime-ets/dom/element/canvas.ts +136 -0
  76. package/dist/runtime-ets/dom/element/element.ts +376 -57
  77. package/dist/runtime-ets/dom/element/form.ts +31 -26
  78. package/dist/runtime-ets/dom/element/index.ts +30 -2
  79. package/dist/runtime-ets/dom/element/movableArea.ts +11 -0
  80. package/dist/runtime-ets/dom/element/movableView.ts +248 -0
  81. package/dist/runtime-ets/dom/element/normal.ts +35 -8
  82. package/dist/runtime-ets/dom/element/progress.ts +11 -0
  83. package/dist/runtime-ets/dom/element/scrollView.ts +1 -0
  84. package/dist/runtime-ets/dom/element/text.ts +1 -8
  85. package/dist/runtime-ets/dom/element/video.ts +5 -4
  86. package/dist/runtime-ets/dom/element/webView.ts +12 -5
  87. package/dist/runtime-ets/dom/event.ts +3 -5
  88. package/dist/runtime-ets/dom/eventTarget.ts +2 -3
  89. package/dist/runtime-ets/dom/node.ts +65 -32
  90. package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +418 -237
  91. package/dist/runtime-ets/dom/stylesheet/index.ts +29 -311
  92. package/dist/runtime-ets/dom/stylesheet/type.ts +53 -11
  93. package/dist/runtime-ets/dom/stylesheet/util.ts +33 -27
  94. package/dist/runtime-ets/index.ts +2 -2
  95. package/dist/runtime-ets/interface/event.ts +1 -1
  96. package/dist/runtime-ets/utils/index.ts +74 -13
  97. package/dist/runtime-ets/utils/info.ts +2 -2
  98. package/dist/runtime-framework/react/app.ts +25 -30
  99. package/dist/runtime-framework/react/hooks.ts +3 -4
  100. package/dist/runtime-framework/react/index.ts +0 -2
  101. package/dist/runtime-framework/react/native-page.ts +219 -82
  102. package/dist/runtime-framework/react/page.ts +6 -10
  103. package/dist/runtime-framework/react/utils/index.ts +3 -3
  104. package/dist/runtime-framework/solid/app.ts +30 -46
  105. package/dist/runtime-framework/solid/connect.ts +21 -3
  106. package/dist/runtime-framework/solid/hooks.ts +17 -12
  107. package/dist/runtime-framework/solid/index.ts +6 -2
  108. package/dist/runtime-framework/solid/page.ts +85 -31
  109. package/dist/runtime-framework/solid/reconciler/props.ts +70 -25
  110. package/dist/runtime-framework/solid/reconciler/render.ts +16 -6
  111. package/dist/runtime-framework/solid/reconciler/use.ts +0 -1
  112. package/dist/runtime-framework/solid/utils/index.ts +3 -5
  113. package/dist/runtime-utils.d.ts +827 -0
  114. package/dist/runtime-utils.js +618 -245
  115. package/dist/runtime-utils.js.map +1 -1
  116. package/dist/runtime.d.ts +1 -0
  117. package/dist/runtime.js +618 -245
  118. package/dist/runtime.js.map +1 -1
  119. package/index.js +3 -1
  120. package/package.json +14 -15
  121. package/static/media/cancel.svg +1 -1
  122. package/static/media/circle.svg +1 -1
  123. package/static/media/clear.svg +1 -1
  124. package/static/media/download.svg +1 -1
  125. package/static/media/info.svg +1 -1
  126. package/static/media/info_circle.svg +1 -1
  127. package/static/media/search.svg +1 -1
  128. package/static/media/success.svg +1 -1
  129. package/static/media/success_no_circle.svg +1 -1
  130. package/static/media/warn.svg +1 -1
  131. package/types/harmony.d.ts +5 -0
  132. package/types/index.d.ts +4 -0
  133. package/types/runtime.d.ts +3 -1
  134. package/dist/runtime-ets/utils/bind.ts +0 -24
  135. /package/dist/runtime-framework/solid/{contant.ts → constant.ts} +0 -0
@@ -1,143 +1,13 @@
1
1
  import { AREA_CHANGE_EVENT_NAME, eventHandler, getComponentEventCallback, VISIBLE_CHANGE_EVENT_NAME, TaroPickerElement, createTaroEvent } from '@tarojs/runtime'
2
- import { createLazyChildren } from './render'
2
+ import commonStyleModify from './style'
3
3
  import { getSingleSelector, getMultiSelector } from './utils'
4
4
  import { TOUCH_EVENT_MAP } from './utils/constant/event'
5
- import { FlexManager } from './utils/FlexManager'
6
- import { getNormalAttributes, shouldBindEvent, getNodeThresholds } from './utils/helper'
5
+ import { FlexManager } from './utils/flexManager'
6
+ import { shouldBindEvent, getNodeThresholds } from './utils/helper'
7
7
 
8
- import type { TaroAny, TaroStyleType, TaroEvent } from '@tarojs/runtime'
8
+ import type { TaroAny, TaroEvent } from '@tarojs/runtime'
9
9
 
10
- import { PickerDateProps, PickerMultiSelectorProps, PickerSelectorProps, PickerTimeProps } from './types'
11
-
12
- @Extend(TextPicker)
13
- function textPickerAttrs (style: TaroStyleType) {
14
- .id(style.id)
15
- .key(style.id)
16
- .flexGrow(style.flexGrow)
17
- .flexShrink(style.flexShrink)
18
- .flexBasis(style.flexBasis)
19
- .alignSelf(style.alignSelf)
20
- .padding({
21
- top: style.paddingTop,
22
- right: style.paddingRight,
23
- bottom: style.paddingBottom,
24
- left: style.paddingLeft
25
- })
26
- .margin({
27
- top: style.marginTop,
28
- right: style.marginRight,
29
- bottom: style.marginBottom,
30
- left: style.marginLeft
31
- })
32
- .width(style.width || '100%')
33
- .height(style.height)
34
- .constraintSize({
35
- minWidth: style.minWidth,
36
- maxWidth: style.maxWidth,
37
- minHeight: style.minHeight,
38
- maxHeight: style.maxHeight
39
- })
40
- .backgroundColor(style.backgroundColor || '#fff')
41
- .backgroundImage(style.backgroundImage?.src, style.backgroundRepeat)
42
- .backgroundImageSize(style.backgroundSize)
43
- .backgroundImagePosition(style.backgroundPosition)
44
- .borderStyle({
45
- top: style.borderTopStyle,
46
- right: style.borderRightStyle,
47
- bottom: style.borderBottomStyle,
48
- left: style.borderLeftStyle
49
- })
50
- .borderWidth({
51
- top: style.borderTopWidth,
52
- right: style.borderRightWidth,
53
- bottom: style.borderBottomWidth,
54
- left: style.borderLeftWidth
55
- })
56
- .borderColor({
57
- top: style.borderTopColor,
58
- right: style.borderRightColor,
59
- bottom: style.borderBottomColor,
60
- left: style.borderLeftColor
61
- })
62
- .borderRadius({
63
- topLeft: style.borderTopLeftRadius,
64
- topRight: style.borderTopRightRadius,
65
- bottomLeft: style.borderBottomLeftRadius,
66
- bottomRight: style.borderBottomRightRadius
67
- })
68
- .zIndex(style.zIndex)
69
- .opacity(style.opacity)
70
- .linearGradient(style.linearGradient)
71
- .clip(style.overflow)
72
- .rotate({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y, angle: 0 })
73
- .scale({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y })
74
- .transform(style.transform)
75
- }
76
-
77
- @Extend(DatePicker)
78
- function datePickerAttrs (style: TaroStyleType) {
79
- .id(style.id)
80
- .key(style.id)
81
- .flexGrow(style.flexGrow)
82
- .flexShrink(style.flexShrink)
83
- .flexBasis(style.flexBasis)
84
- .alignSelf(style.alignSelf)
85
- .padding({
86
- top: style.paddingTop,
87
- right: style.paddingRight,
88
- bottom: style.paddingBottom,
89
- left: style.paddingLeft
90
- })
91
- .margin({
92
- top: style.marginTop,
93
- right: style.marginRight,
94
- bottom: style.marginBottom,
95
- left: style.marginLeft
96
- })
97
- .width(style.width || '100%')
98
- .height(style.height)
99
- .constraintSize({
100
- minWidth: style.minWidth,
101
- maxWidth: style.maxWidth,
102
- minHeight: style.minHeight,
103
- maxHeight: style.maxHeight
104
- })
105
- .backgroundColor(style.backgroundColor || '#fff')
106
- .backgroundImage(style.backgroundImage?.src, style.backgroundRepeat)
107
- .backgroundImageSize(style.backgroundSize)
108
- .backgroundImagePosition(style.backgroundPosition)
109
- .borderStyle({
110
- top: style.borderTopStyle,
111
- right: style.borderRightStyle,
112
- bottom: style.borderBottomStyle,
113
- left: style.borderLeftStyle
114
- })
115
- .borderWidth({
116
- top: style.borderTopWidth,
117
- right: style.borderRightWidth,
118
- bottom: style.borderBottomWidth,
119
- left: style.borderLeftWidth
120
- })
121
- .borderColor({
122
- top: style.borderTopColor,
123
- right: style.borderRightColor,
124
- bottom: style.borderBottomColor,
125
- left: style.borderLeftColor
126
- })
127
- .borderRadius({
128
- topLeft: style.borderTopLeftRadius,
129
- topRight: style.borderTopRightRadius,
130
- bottomLeft: style.borderBottomLeftRadius,
131
- bottomRight: style.borderBottomRightRadius
132
- })
133
- .zIndex(style.zIndex)
134
- .opacity(style.opacity)
135
- .linearGradient(style.linearGradient)
136
- .clip(style.overflow)
137
- .rotate({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y, angle: 0 })
138
- .scale({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y })
139
- .transform(style.transform)
140
- }
10
+ import { PickerDateProps, PickerMultiSelectorProps, PickerSelectorProps, PickerTimeProps } from '@tarojs/components/types'
141
11
 
142
12
  interface TimeRange {
143
13
  startHH: number
@@ -197,7 +67,7 @@ export struct PickerView {
197
67
  const left = generateNumberArray(timeRange.startHH, timeRange.endHH)
198
68
  const right = generateNumberArray(timeRange.startMM, timeRange.endMM)
199
69
  const range = [left, right]
200
- const _selected = _attrs.value.split(':')
70
+ const _selected = _attrs.value?.split(':') as string[]
201
71
  return {
202
72
  range: range,
203
73
  selected: [left.findIndex(i => parseInt(_selected[0]) === Number(i)), right.findIndex(i => parseInt(_selected[1]) === Number(i))],
@@ -275,7 +145,10 @@ export struct PickerView {
275
145
  color: '#000'
276
146
  })
277
147
  .canLoop(false)
278
- .textPickerAttrs(getNormalAttributes(this.node))
148
+ .attributeModifier(commonStyleModify.setNode(this.node, {
149
+ width: '100%',
150
+ backgroundColor: '#fff'
151
+ }))
279
152
  .onChange((_, index) => {
280
153
  this.node?.updateFormWidgetValue(index)
281
154
  })
@@ -285,7 +158,10 @@ export struct PickerView {
285
158
  color: '#000'
286
159
  })
287
160
  .canLoop(false)
288
- .textPickerAttrs(getNormalAttributes(this.node))
161
+ .attributeModifier(commonStyleModify.setNode(this.node, {
162
+ width: '100%',
163
+ backgroundColor: '#fff'
164
+ }))
289
165
  .onChange((_, index) => {
290
166
  if (index instanceof Array) {
291
167
  this.node?.updateFormWidgetValue(index)
@@ -312,7 +188,10 @@ export struct PickerView {
312
188
  .selectedTextStyle({
313
189
  color: '#000'
314
190
  })
315
- .datePickerAttrs(getNormalAttributes(this.node))
191
+ .attributeModifier(commonStyleModify.setNode(this.node, {
192
+ width: '100%',
193
+ backgroundColor: '#fff'
194
+ }))
316
195
  .onDateChange(value => {
317
196
  const data = value.toLocaleDateString().split('/')
318
197
  const day = data[1]
@@ -326,7 +205,10 @@ export struct PickerView {
326
205
  color: '#000'
327
206
  })
328
207
  .canLoop(false)
329
- .textPickerAttrs(getNormalAttributes(this.node))
208
+ .attributeModifier(commonStyleModify.setNode(this.node, {
209
+ width: '100%',
210
+ backgroundColor: '#fff'
211
+ }))
330
212
  .onChange((value) => {
331
213
  this.node?.updateFormWidgetValue(`${('00'+value[0]).slice(-2)}:${('00'+value[1]).slice(-2)}`)
332
214
  })
@@ -340,9 +222,12 @@ export struct PickerView {
340
222
  }
341
223
  }
342
224
 
225
+
343
226
  @Component
344
227
  export default struct TaroPicker {
345
- node: TaroPickerElement | null = null
228
+ @Builder customBuilder() {}
229
+ @BuilderParam createLazyChildren: (node: TaroPickerElement, layer?: number) => void = this.customBuilder
230
+ @ObjectLink node: TaroPickerElement
346
231
 
347
232
  aboutToAppear () {
348
233
  this.node?.addEventListener('click', this.handleClick)
@@ -358,8 +243,8 @@ export default struct TaroPicker {
358
243
  break
359
244
  case 'time': {
360
245
  const hour = new Date().getHours()
361
- const minute = new Date().getMinutes()
362
-
246
+ const minute = new Date().getMinutes()
247
+
363
248
  defaultResetValue = `${('00'+hour).slice(-2)}:${('00'+minute).slice(-2)}`
364
249
  break
365
250
  }
@@ -368,7 +253,7 @@ export default struct TaroPicker {
368
253
  const day = data[1]
369
254
  const month = data[0]
370
255
  const year = data[2]
371
-
256
+
372
257
  defaultResetValue = `${year}-${month}-${day}`
373
258
  break
374
259
  }
@@ -376,7 +261,7 @@ export default struct TaroPicker {
376
261
  defaultResetValue = ''
377
262
  break
378
263
  }
379
-
264
+
380
265
  this.node._isInit = true
381
266
  this.node._reset = this.node.value || defaultResetValue
382
267
  }
@@ -413,7 +298,7 @@ export default struct TaroPicker {
413
298
  .onClick((e: ClickEvent) => {
414
299
  eventHandler(e, 'click', this.node)
415
300
  })
416
- .onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
301
+ .onTouch(shouldBindEvent((e: TouchEvent) => { eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node) }, this.node, TOUCH_EVENT_MAP.values()))
417
302
  .onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
418
303
  if (this.node) {
419
304
  this.node._nodeInfo.areaInfo = res[1]
@@ -426,24 +311,22 @@ export default struct TaroPicker {
426
311
  }
427
312
 
428
313
  build() {
429
- if (this.node) {
430
- if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node).direction !== FlexDirection.Column) {
431
- Row() {
432
- createLazyChildren(this.node)
433
- }
434
- .defaultEvent()
435
- .visibleChangeEvent()
436
- .alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
437
- .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
438
- } else {
439
- Column() {
440
- createLazyChildren(this.node)
441
- }
442
- .defaultEvent()
443
- .visibleChangeEvent()
444
- .alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
445
- .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
314
+ if (FlexManager.isFlexNode(this.node) && FlexManager.direction(this.node) !== FlexDirection.Column) {
315
+ Row() {
316
+ this.createLazyChildren(this.node, 0)
317
+ }
318
+ .defaultEvent()
319
+ .visibleChangeEvent()
320
+ .alignItems(FlexManager.alignItems<VerticalAlign>(this.node))
321
+ .justifyContent(FlexManager.justifyContent(this.node))
322
+ } else {
323
+ Column() {
324
+ this.createLazyChildren(this.node, 0)
446
325
  }
326
+ .defaultEvent()
327
+ .visibleChangeEvent()
328
+ .alignItems(FlexManager.alignItems<HorizontalAlign>(this.node))
329
+ .justifyContent(FlexManager.justifyContent(this.node))
447
330
  }
448
331
  }
449
332
  }
@@ -0,0 +1,52 @@
1
+ import type { TaroProgressElement, TaroAny } from '@tarojs/runtime'
2
+ import commonStyleModify from './style'
3
+ import { shouldBindEvent, getNodeThresholds } from './utils/helper'
4
+ import { eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME } from '@tarojs/runtime'
5
+
6
+ const PROGRESS_ACTIVECOLOR = '#09BB07'
7
+ const PROGRESS_BACKGROUNDCOLOR = '#EBEBEB'
8
+ const PROGRESS_DEFAULTINFOFONTSIZE = 16
9
+
10
+ @Component
11
+ export default struct TaroProgress {
12
+ @Builder customBuilder() {}
13
+ @BuilderParam createLazyChildren: (node: TaroProgressElement, layer?: number) => void = this.customBuilder
14
+ @ObjectLink node: TaroProgressElement
15
+ @State overwriteStyle: Record<string, TaroAny> = {}
16
+
17
+ aboutToAppear(): void {
18
+ if (this.node) {
19
+ this.node._instance = this
20
+ }
21
+ }
22
+
23
+ build() {
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')),
36
+ })
37
+
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
+ }))
45
+
46
+ if (this.node.getAttribute('showInfo')) {
47
+ Text(`${this.node.getAttribute('percent')}%`)
48
+ .fontSize(this.node.getAttribute('fontSize') ?? PROGRESS_DEFAULTINFOFONTSIZE)
49
+ }
50
+ }
51
+ }
52
+ }
@@ -0,0 +1,80 @@
1
+ import { getFontAttributes } from './utils/helper'
2
+ import { pseudoModify } from './style'
3
+
4
+ import type { TaroViewElement, TaroStyleType, TaroTextStyleType, TaroAny } from '@tarojs/runtime'
5
+
6
+ @Extend(Flex)
7
+ function flexAttrs (style: TaroStyleType) {
8
+ .constraintSize({
9
+ minWidth: style.minWidth,
10
+ maxWidth: style.maxWidth,
11
+ minHeight: style.minHeight || style.height,
12
+ maxHeight: style.maxHeight
13
+ })
14
+ }
15
+
16
+
17
+ @Extend(Text)
18
+ function textNormalFontStyle (style: TaroStyleType) {
19
+ .id(style.id)
20
+ .key(style.id)
21
+ .opacity(style.opacity)
22
+ .fontColor(style.color)
23
+ .fontSize(style.fontSize)
24
+ .fontWeight(style.fontWeight)
25
+ .fontStyle(style.fontStyle)
26
+ .fontFamily(style.fontFamily)
27
+ .decoration({
28
+ type: style.textDecoration?.type || TextDecorationType.None,
29
+ color: style.color
30
+ })
31
+ }
32
+
33
+ @Extend(Text)
34
+ function textSpecialFontStyle(attr: TaroTextStyleType) {
35
+ .textAlign(attr.textAlign)
36
+ .align(attr.verticalAlign)
37
+ .textOverflow(attr.textOverflow)
38
+ .maxLines(attr.WebkitLineClamp)
39
+ .letterSpacing(attr.letterSpacing)
40
+ .lineHeight(attr.lineHeight)
41
+ }
42
+
43
+ @Component
44
+ export default struct PseduoChildren {
45
+ @Builder customBuilder() {}
46
+ @BuilderParam createLazyChildren: (node: TaroAny, layer?: number) => 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, 0)
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
+ }
78
+ }
79
+ }
80
+ }