@tarojs/plugin-platform-harmony-ets 4.0.0-beta.2 → 4.0.0-beta.21
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.
- package/dist/apis/base/system.ts +53 -20
- package/dist/apis/framework/index.ts +1 -5
- package/dist/apis/index.ts +3 -1
- package/dist/apis/network/request.ts +5 -5
- package/dist/apis/route/index.ts +15 -0
- package/dist/apis/storage/index.ts +124 -60
- package/dist/apis/wxml/IntersectionObserver.ts +5 -3
- package/dist/apis/wxml/index.ts +2 -0
- package/dist/components-harmony-ets/button.ets +41 -78
- package/dist/components-harmony-ets/checkbox.ets +19 -209
- package/dist/components-harmony-ets/form.ets +38 -160
- package/dist/components-harmony-ets/icon.ets +31 -83
- package/dist/components-harmony-ets/image.ets +22 -78
- package/dist/components-harmony-ets/innerHtml.ets +11 -6
- package/dist/components-harmony-ets/input.ets +10 -67
- package/dist/components-harmony-ets/label.ets +52 -173
- package/dist/components-harmony-ets/movableArea.ets +89 -0
- package/dist/components-harmony-ets/movableView.ets +67 -0
- package/dist/components-harmony-ets/picker.ets +32 -147
- package/dist/components-harmony-ets/progress.ets +47 -0
- package/dist/components-harmony-ets/pseudo.ets +80 -0
- package/dist/components-harmony-ets/radio.ets +19 -210
- package/dist/components-harmony-ets/richText.ets +22 -102
- package/dist/components-harmony-ets/scrollView.ets +66 -169
- package/dist/components-harmony-ets/slider.ets +10 -72
- package/dist/components-harmony-ets/style.ets +244 -0
- package/dist/components-harmony-ets/swiper.ets +30 -87
- package/dist/components-harmony-ets/switch.ets +9 -71
- package/dist/components-harmony-ets/text.ets +38 -89
- package/dist/components-harmony-ets/textArea.ets +10 -67
- package/dist/components-harmony-ets/utils/AttributeManager.ets +1 -1
- package/dist/components-harmony-ets/utils/DynamicCenter.ts +1 -1
- package/dist/components-harmony-ets/utils/flexManager.ets +8 -7
- package/dist/components-harmony-ets/utils/helper.ets +5 -4
- package/dist/components-harmony-ets/utils/htmlParser/HarmonyHTMLParser.ts +1 -2
- package/dist/components-harmony-ets/utils/index.ts +55 -2
- package/dist/components-harmony-ets/utils/styles.ets +45 -85
- package/dist/components-harmony-ets/video.ets +33 -88
- package/dist/components-harmony-ets/view.ets +47 -160
- package/dist/components-harmony-ets/webView.ets +44 -99
- package/dist/index.d.ts +151 -0
- package/dist/index.js +58 -29
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/bom/window.ts +4 -2
- package/dist/runtime-ets/current.ts +2 -0
- package/dist/runtime-ets/dom/bind.ts +0 -1
- package/dist/runtime-ets/dom/cssNesting.ts +311 -0
- package/dist/runtime-ets/dom/cssStyleDeclaration.ts +15 -40
- package/dist/runtime-ets/dom/document.ts +21 -8
- package/dist/runtime-ets/dom/element/element.ts +53 -9
- package/dist/runtime-ets/dom/element/form.ts +11 -4
- package/dist/runtime-ets/dom/element/index.ts +12 -1
- package/dist/runtime-ets/dom/element/movableArea.ts +12 -0
- package/dist/runtime-ets/dom/element/movableView.ts +193 -0
- package/dist/runtime-ets/dom/element/normal.ts +8 -3
- package/dist/runtime-ets/dom/element/progress.ts +13 -0
- package/dist/runtime-ets/dom/element/scrollView.ts +1 -0
- package/dist/runtime-ets/dom/element/text.ts +1 -0
- package/dist/runtime-ets/dom/element/video.ts +1 -0
- package/dist/runtime-ets/dom/element/webView.ts +8 -0
- package/dist/runtime-ets/dom/event.ts +0 -1
- package/dist/runtime-ets/dom/eventTarget.ts +0 -3
- package/dist/runtime-ets/dom/node.ts +18 -17
- package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +184 -207
- package/dist/runtime-ets/dom/stylesheet/index.ts +28 -308
- package/dist/runtime-ets/dom/stylesheet/type.ts +18 -6
- package/dist/runtime-ets/dom/stylesheet/util.ts +19 -15
- package/dist/runtime-ets/index.ts +2 -2
- package/dist/runtime-ets/interface/event.ts +1 -1
- package/dist/runtime-ets/utils/index.ts +24 -9
- package/dist/runtime-framework/react/app.ts +5 -1
- package/dist/runtime-framework/react/hooks.ts +3 -3
- package/dist/runtime-framework/react/native-page.ts +14 -9
- package/dist/runtime-framework/react/page.ts +1 -0
- package/dist/runtime-framework/solid/hooks.ts +3 -3
- package/dist/runtime-framework/solid/reconciler/use.ts +0 -1
- package/dist/runtime-framework/solid/utils/index.ts +0 -2
- package/dist/runtime-utils.d.ts +825 -0
- package/dist/runtime-utils.js +185 -91
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +185 -91
- package/dist/runtime.js.map +1 -1
- package/index.js +3 -1
- package/package.json +10 -10
- package/types/index.d.ts +4 -0
- package/dist/runtime-ets/utils/bind.ts +0 -24
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createTaroEvent, eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME } from '@tarojs/runtime'
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import { FlexManager } from './utils/
|
|
5
|
-
import { shouldBindEvent,
|
|
3
|
+
import commonStyleModify from './style'
|
|
4
|
+
import { FlexManager } from './utils/flexManager'
|
|
5
|
+
import { shouldBindEvent, getNodeThresholds } from './utils/helper'
|
|
6
6
|
|
|
7
|
-
import type {
|
|
7
|
+
import type { TaroAny, TaroEvent, TaroCheckboxElement, TaroCheckboxGroupElement } from '@tarojs/runtime'
|
|
8
8
|
|
|
9
9
|
interface CheckboxOptions {
|
|
10
10
|
name?: string
|
|
@@ -14,71 +14,6 @@ interface CheckboxAttrs {
|
|
|
14
14
|
selectedColor?: ResourceColor
|
|
15
15
|
}
|
|
16
16
|
|
|
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
17
|
@Extend(Checkbox)
|
|
83
18
|
function checkboxAttr(attr: CheckboxAttrs) {
|
|
84
19
|
.selectedColor(attr.selectedColor)
|
|
@@ -97,9 +32,12 @@ function getOptions (node: TaroCheckboxElement): CheckboxOptions {
|
|
|
97
32
|
}
|
|
98
33
|
}
|
|
99
34
|
|
|
35
|
+
|
|
100
36
|
@Component
|
|
101
37
|
export struct TaroCheckbox {
|
|
102
|
-
|
|
38
|
+
@Builder customBuilder() {}
|
|
39
|
+
@BuilderParam createLazyChildren: (node: TaroCheckboxElement) => void = this.customBuilder
|
|
40
|
+
@ObjectLink node: TaroCheckboxElement
|
|
103
41
|
|
|
104
42
|
aboutToAppear () {
|
|
105
43
|
if (this.node && !this.node._isInit) {
|
|
@@ -109,11 +47,11 @@ export struct TaroCheckbox {
|
|
|
109
47
|
}
|
|
110
48
|
|
|
111
49
|
build () {
|
|
112
|
-
if (this.node) {
|
|
50
|
+
if (this.node && this.node?.hmStyle?.display !== 'none') {
|
|
113
51
|
Stack() {
|
|
114
52
|
Row() {
|
|
115
53
|
Checkbox(getOptions(this.node))
|
|
116
|
-
.
|
|
54
|
+
.attributeModifier(commonStyleModify.setNode(this.node))
|
|
117
55
|
.checkboxAttr(getAttributes(this.node))
|
|
118
56
|
.opacity(!!this.node._attrs.disabled ? 0.4 : 1)
|
|
119
57
|
.select(this.node.checked)
|
|
@@ -123,7 +61,7 @@ export struct TaroCheckbox {
|
|
|
123
61
|
this.node.updateComponent()
|
|
124
62
|
} else {
|
|
125
63
|
this.node.updateCheckedValue(value)
|
|
126
|
-
|
|
64
|
+
|
|
127
65
|
if (value) {
|
|
128
66
|
const event: TaroEvent = createTaroEvent('change', { detail: { value: this.node?._attrs.value } }, this.node)
|
|
129
67
|
eventHandler(event, 'change', this.node)
|
|
@@ -154,141 +92,13 @@ export struct TaroCheckbox {
|
|
|
154
92
|
}
|
|
155
93
|
}
|
|
156
94
|
|
|
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
95
|
interface ChangeEventDetail { value: string[] }
|
|
288
96
|
|
|
289
97
|
@Component
|
|
290
98
|
export struct TaroCheckboxGroup {
|
|
291
|
-
|
|
99
|
+
@Builder customBuilder() {}
|
|
100
|
+
@BuilderParam createLazyChildren: (node: TaroCheckboxGroupElement) => void = this.customBuilder
|
|
101
|
+
@ObjectLink node: TaroCheckboxGroupElement
|
|
292
102
|
|
|
293
103
|
@Styles visibleChangeEvent () {
|
|
294
104
|
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
@@ -314,21 +124,21 @@ export struct TaroCheckboxGroup {
|
|
|
314
124
|
}
|
|
315
125
|
|
|
316
126
|
build() {
|
|
317
|
-
if (this.node) {
|
|
127
|
+
if (this.node && this.node?.hmStyle?.display !== 'none') {
|
|
318
128
|
if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node).direction !== FlexDirection.Column) {
|
|
319
129
|
Row() {
|
|
320
|
-
createLazyChildren(this.node)
|
|
130
|
+
this.createLazyChildren(this.node)
|
|
321
131
|
}
|
|
322
|
-
.
|
|
132
|
+
.attributeModifier(commonStyleModify.setNode(this.node))
|
|
323
133
|
.defaultEvent()
|
|
324
134
|
.visibleChangeEvent()
|
|
325
135
|
.alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
|
|
326
136
|
.justifyContent(FlexManager.flexOptions(this.node).justifyContent)
|
|
327
137
|
} else {
|
|
328
138
|
Column() {
|
|
329
|
-
createLazyChildren(this.node)
|
|
139
|
+
this.createLazyChildren(this.node)
|
|
330
140
|
}
|
|
331
|
-
.
|
|
141
|
+
.attributeModifier(commonStyleModify.setNode(this.node))
|
|
332
142
|
.defaultEvent()
|
|
333
143
|
.visibleChangeEvent()
|
|
334
144
|
.alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
|
|
@@ -1,169 +1,47 @@
|
|
|
1
1
|
import { AREA_CHANGE_EVENT_NAME, eventHandler, getComponentEventCallback, VISIBLE_CHANGE_EVENT_NAME } from '@tarojs/runtime'
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import commonStyleModify from './style'
|
|
4
4
|
import { TOUCH_EVENT_MAP } from './utils/constant/event'
|
|
5
|
-
import { FlexManager } from './utils/
|
|
6
|
-
import {
|
|
5
|
+
import { FlexManager } from './utils/flexManager'
|
|
6
|
+
import { shouldBindEvent, getNodeThresholds } from './utils/helper'
|
|
7
7
|
|
|
8
|
-
import type { TaroAny, TaroFormElement
|
|
8
|
+
import type { TaroAny, TaroFormElement } from '@tarojs/runtime'
|
|
9
9
|
|
|
10
|
-
@
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
}
|
|
10
|
+
@Component
|
|
11
|
+
export default struct TaroForm {
|
|
12
|
+
@Builder customBuilder() {}
|
|
13
|
+
@BuilderParam createLazyChildren: (node: TaroFormElement) => void = this.customBuilder
|
|
14
|
+
@ObjectLink node: TaroFormElement
|
|
139
15
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
16
|
+
build() {
|
|
17
|
+
if (this.node?.hmStyle?.display !== 'none') {
|
|
18
|
+
if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node).direction !== FlexDirection.Column) {
|
|
19
|
+
Row() {
|
|
20
|
+
this.createLazyChildren(this.node)
|
|
21
|
+
}
|
|
22
|
+
.attributeModifier(commonStyleModify.setNode(this.node))
|
|
23
|
+
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
24
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
25
|
+
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
26
|
+
this.node._nodeInfo.areaInfo = res[1]
|
|
27
|
+
}))
|
|
28
|
+
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
29
|
+
.alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
|
|
30
|
+
.justifyContent(FlexManager.flexOptions(this.node).justifyContent)
|
|
31
|
+
} else {
|
|
32
|
+
Column() {
|
|
33
|
+
this.createLazyChildren(this.node)
|
|
34
|
+
}
|
|
35
|
+
.attributeModifier(commonStyleModify.setNode(this.node))
|
|
36
|
+
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
37
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
38
|
+
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
39
|
+
this.node._nodeInfo.areaInfo = res[1]
|
|
40
|
+
}))
|
|
41
|
+
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
42
|
+
.alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
|
|
43
|
+
.justifyContent(FlexManager.flexOptions(this.node).justifyContent)
|
|
44
|
+
}
|
|
158
45
|
}
|
|
159
|
-
.columnAttrs(getNormalAttributes(node))
|
|
160
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', node), node, ['click']))
|
|
161
|
-
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), node), node, TOUCH_EVENT_MAP.values()))
|
|
162
|
-
.onAreaChange(getComponentEventCallback(node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
163
|
-
node._nodeInfo.areaInfo = res[1]
|
|
164
|
-
}))
|
|
165
|
-
.onVisibleAreaChange(getNodeThresholds(node) || [0.0, 1.0], getComponentEventCallback(node, VISIBLE_CHANGE_EVENT_NAME))
|
|
166
|
-
.alignItems(FlexManager.flexOptions(node).alignItems as HorizontalAlign)
|
|
167
|
-
.justifyContent(FlexManager.flexOptions(node).justifyContent)
|
|
168
46
|
}
|
|
169
47
|
}
|
|
@@ -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
|
|
3
|
+
import commonStyleModify from './style'
|
|
4
|
+
import { shouldBindEvent, getNodeThresholds } from './utils/helper'
|
|
4
5
|
|
|
5
|
-
import type { TaroIconElement, TaroAny
|
|
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,
|
|
@@ -112,20 +48,32 @@ function getIconData (node: TaroIconElement): Resource | null {
|
|
|
112
48
|
}
|
|
113
49
|
}
|
|
114
50
|
|
|
115
|
-
@
|
|
116
|
-
export default
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
51
|
+
@Component
|
|
52
|
+
export default struct TaroIcon {
|
|
53
|
+
@Builder customBuilder() {}
|
|
54
|
+
@BuilderParam createLazyChildren: (node: TaroIconElement) => void = this.customBuilder
|
|
55
|
+
@ObjectLink node: TaroIconElement
|
|
56
|
+
|
|
57
|
+
build() {
|
|
58
|
+
if (this.node?.hmStyle?.display !== 'none') {
|
|
59
|
+
Image(getIconData(this.node))
|
|
60
|
+
.objectFit(ImageFit.Contain)
|
|
61
|
+
.fillColor(this.node._attrs.color || ICON_COLOR_MAP[this.node._attrs.type] || Color.Black)
|
|
62
|
+
.attributeModifier(commonStyleModify.setNode(this.node, {
|
|
63
|
+
width: convertNumber2PX(23),
|
|
64
|
+
height: convertNumber2PX(23)
|
|
65
|
+
}))
|
|
66
|
+
.size({
|
|
67
|
+
width: convertNumber2VP(Number(this.node._attrs.size) || 23),
|
|
68
|
+
height: convertNumber2VP(Number(this.node._attrs.size) || 23),
|
|
69
|
+
})
|
|
70
|
+
.onComplete(e => eventHandler(e, 'complete', this.node))
|
|
71
|
+
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
72
|
+
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
73
|
+
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
74
|
+
this.node._nodeInfo.areaInfo = res[1]
|
|
75
|
+
}))
|
|
76
|
+
}
|
|
77
|
+
}
|
|
131
78
|
}
|
|
79
|
+
|