@tarojs/plugin-platform-harmony-ets 4.0.0-beta.0 → 4.0.0-beta.2
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/device/memory.ts +10 -3
- package/dist/apis/media/video/VideoContext.ts +56 -7
- package/dist/apis/media/video/index.ts +3 -2
- package/dist/components-harmony-ets/button.ets +57 -27
- package/dist/components-harmony-ets/checkbox.ets +237 -72
- package/dist/components-harmony-ets/form.ets +143 -27
- package/dist/components-harmony-ets/icon.ets +53 -19
- package/dist/components-harmony-ets/image.ets +53 -19
- package/dist/components-harmony-ets/input.ets +57 -18
- package/dist/components-harmony-ets/label.ets +155 -33
- package/dist/components-harmony-ets/picker.ets +155 -41
- package/dist/components-harmony-ets/radio.ets +240 -75
- package/dist/components-harmony-ets/richText.ets +52 -18
- package/dist/components-harmony-ets/scrollView.ets +103 -45
- package/dist/components-harmony-ets/slider.ets +57 -18
- package/dist/components-harmony-ets/swiper.ets +52 -18
- package/dist/components-harmony-ets/switch.ets +92 -41
- package/dist/components-harmony-ets/text.ets +60 -23
- package/dist/components-harmony-ets/textArea.ets +58 -19
- package/dist/components-harmony-ets/utils/DynamicCenter.ts +2 -11
- package/dist/components-harmony-ets/utils/flexManager.ets +44 -7
- package/dist/components-harmony-ets/utils/helper.ets +1 -1
- package/dist/components-harmony-ets/utils/styles.ets +57 -20
- package/dist/components-harmony-ets/video.ets +52 -18
- package/dist/components-harmony-ets/view.ets +111 -46
- package/dist/components-harmony-ets/webView.ets +113 -0
- package/dist/index.js +101 -4
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/dom/cssStyleDeclaration.ts +30 -6
- package/dist/runtime-ets/dom/element/element.ts +1 -0
- package/dist/runtime-ets/dom/element/form.ts +11 -2
- package/dist/runtime-ets/dom/element/index.ts +4 -1
- package/dist/runtime-ets/dom/element/normal.ts +1 -0
- package/dist/runtime-ets/dom/element/webView.ts +61 -0
- package/dist/runtime-ets/dom/node.ts +29 -16
- package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +624 -0
- package/dist/runtime-ets/dom/stylesheet/index.ts +216 -354
- package/dist/runtime-ets/dom/stylesheet/type.ts +46 -11
- package/dist/runtime-ets/dom/stylesheet/util.ts +58 -6
- package/dist/runtime-ets/interface/event.ts +2 -1
- package/dist/runtime-ets/utils/index.ts +6 -1
- package/dist/runtime-ets/utils/info.ts +3 -1
- package/dist/runtime-framework/react/app.ts +12 -22
- package/dist/runtime-framework/react/index.ts +1 -0
- package/dist/runtime-framework/react/native-page.ts +344 -0
- package/dist/runtime-framework/react/page.ts +2 -2
- package/dist/runtime-utils.js +56 -15
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +56 -15
- package/dist/runtime.js.map +1 -1
- package/package.json +10 -9
- package/static/media/cancel.svg +1 -0
- package/static/media/circle.svg +1 -0
- package/static/media/clear.svg +1 -0
- package/static/media/download.svg +1 -0
- package/static/media/info.svg +1 -0
- package/static/media/info_circle.svg +1 -0
- package/static/media/search.svg +1 -0
- package/static/media/success.svg +1 -0
- package/static/media/success_no_circle.svg +1 -0
- package/static/media/taro_arrow_left.svg +1 -0
- package/static/media/taro_home.svg +1 -0
- package/static/media/waiting.svg +1 -0
- package/static/media/warn.svg +1 -0
- package/types/runtime.d.ts +2 -0
|
@@ -26,70 +26,128 @@ interface ScrollViewEvent {
|
|
|
26
26
|
function rowAttrs (style: TaroStyleType) {
|
|
27
27
|
.id(style.id)
|
|
28
28
|
.key(style.id)
|
|
29
|
-
.padding(style.padding)
|
|
30
|
-
.margin(style.margin)
|
|
31
|
-
.height(style.height)
|
|
32
|
-
.constraintSize({
|
|
33
|
-
minWidth: style?.constraintSize?.minWidth || style.width,
|
|
34
|
-
minHeight: style?.constraintSize?.minHeight,
|
|
35
|
-
maxWidth: style?.constraintSize?.maxWidth,
|
|
36
|
-
maxHeight: style?.constraintSize?.maxHeight,
|
|
37
|
-
})
|
|
38
29
|
.flexGrow(style.flexGrow)
|
|
39
30
|
.flexShrink(style.flexShrink)
|
|
40
31
|
.flexBasis(style.flexBasis)
|
|
41
32
|
.alignSelf(style.alignSelf)
|
|
33
|
+
.padding({
|
|
34
|
+
top: style.paddingTop,
|
|
35
|
+
right: style.paddingRight,
|
|
36
|
+
bottom: style.paddingBottom,
|
|
37
|
+
left: style.paddingLeft
|
|
38
|
+
})
|
|
39
|
+
.margin({
|
|
40
|
+
top: style.marginTop,
|
|
41
|
+
right: style.marginRight,
|
|
42
|
+
bottom: style.marginBottom,
|
|
43
|
+
left: style.marginLeft
|
|
44
|
+
})
|
|
45
|
+
.height(style.height)
|
|
46
|
+
.constraintSize({
|
|
47
|
+
minWidth: style.minWidth || style.width,
|
|
48
|
+
maxWidth: style.maxWidth,
|
|
49
|
+
minHeight: style.minHeight,
|
|
50
|
+
maxHeight: style.maxHeight
|
|
51
|
+
})
|
|
42
52
|
.backgroundColor(style.backgroundColor)
|
|
43
|
-
.backgroundImage(style.backgroundImage, style.backgroundRepeat)
|
|
44
|
-
.backgroundImageSize(style.
|
|
45
|
-
.backgroundImagePosition(style.
|
|
46
|
-
.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
.
|
|
53
|
-
|
|
54
|
-
|
|
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
|
+
})
|
|
55
80
|
.zIndex(style.zIndex)
|
|
56
81
|
.opacity(style.opacity)
|
|
57
|
-
.
|
|
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)
|
|
58
87
|
}
|
|
59
88
|
|
|
60
89
|
@Extend(Column)
|
|
61
90
|
function columnAttrs (style: TaroStyleType) {
|
|
62
91
|
.id(style.id)
|
|
63
92
|
.key(style.id)
|
|
64
|
-
.padding(style.padding)
|
|
65
|
-
.margin(style.margin)
|
|
66
|
-
.width(style.width)
|
|
67
|
-
.constraintSize({
|
|
68
|
-
minWidth: style?.constraintSize?.minWidth,
|
|
69
|
-
minHeight: style?.constraintSize?.minHeight || style.height,
|
|
70
|
-
maxWidth: style?.constraintSize?.maxWidth,
|
|
71
|
-
maxHeight: style?.constraintSize?.maxHeight,
|
|
72
|
-
})
|
|
73
93
|
.flexGrow(style.flexGrow)
|
|
74
94
|
.flexShrink(style.flexShrink)
|
|
75
95
|
.flexBasis(style.flexBasis)
|
|
76
96
|
.alignSelf(style.alignSelf)
|
|
97
|
+
.padding({
|
|
98
|
+
top: style.paddingTop,
|
|
99
|
+
right: style.paddingRight,
|
|
100
|
+
bottom: style.paddingBottom,
|
|
101
|
+
left: style.paddingLeft
|
|
102
|
+
})
|
|
103
|
+
.margin({
|
|
104
|
+
top: style.marginTop,
|
|
105
|
+
right: style.marginRight,
|
|
106
|
+
bottom: style.marginBottom,
|
|
107
|
+
left: style.marginLeft
|
|
108
|
+
})
|
|
109
|
+
.width(style.width)
|
|
110
|
+
.constraintSize({
|
|
111
|
+
minWidth: style.minWidth,
|
|
112
|
+
maxWidth: style.maxWidth,
|
|
113
|
+
minHeight: style.minHeight || style.height,
|
|
114
|
+
maxHeight: style.maxHeight
|
|
115
|
+
})
|
|
77
116
|
.backgroundColor(style.backgroundColor)
|
|
78
|
-
.backgroundImage(style.backgroundImage, style.backgroundRepeat)
|
|
79
|
-
.backgroundImageSize(style.
|
|
80
|
-
.backgroundImagePosition(style.
|
|
81
|
-
.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
.
|
|
88
|
-
|
|
89
|
-
|
|
117
|
+
.backgroundImage(style.backgroundImage?.src, style.backgroundRepeat)
|
|
118
|
+
.backgroundImageSize(style.backgroundSize)
|
|
119
|
+
.backgroundImagePosition(style.backgroundPosition)
|
|
120
|
+
.borderStyle({
|
|
121
|
+
top: style.borderTopStyle,
|
|
122
|
+
right: style.borderRightStyle,
|
|
123
|
+
bottom: style.borderBottomStyle,
|
|
124
|
+
left: style.borderLeftStyle
|
|
125
|
+
})
|
|
126
|
+
.borderWidth({
|
|
127
|
+
top: style.borderTopWidth,
|
|
128
|
+
right: style.borderRightWidth,
|
|
129
|
+
bottom: style.borderBottomWidth,
|
|
130
|
+
left: style.borderLeftWidth
|
|
131
|
+
})
|
|
132
|
+
.borderColor({
|
|
133
|
+
top: style.borderTopColor,
|
|
134
|
+
right: style.borderRightColor,
|
|
135
|
+
bottom: style.borderBottomColor,
|
|
136
|
+
left: style.borderLeftColor
|
|
137
|
+
})
|
|
138
|
+
.borderRadius({
|
|
139
|
+
topLeft: style.borderTopLeftRadius,
|
|
140
|
+
topRight: style.borderTopRightRadius,
|
|
141
|
+
bottomLeft: style.borderBottomLeftRadius,
|
|
142
|
+
bottomRight: style.borderBottomRightRadius
|
|
143
|
+
})
|
|
90
144
|
.zIndex(style.zIndex)
|
|
91
145
|
.opacity(style.opacity)
|
|
92
|
-
.
|
|
146
|
+
.linearGradient(style.linearGradient)
|
|
147
|
+
.clip(style.overflow)
|
|
148
|
+
.rotate({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y, angle: 0 })
|
|
149
|
+
.scale({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y })
|
|
150
|
+
.transform(style.transform)
|
|
93
151
|
}
|
|
94
152
|
|
|
95
153
|
|
|
@@ -110,7 +168,7 @@ function getScrollable (node: TaroScrollViewElement) {
|
|
|
110
168
|
}
|
|
111
169
|
|
|
112
170
|
function handleScrollEvent (node: TaroScrollViewElement, eventName = 'scroll', xOffset?: number, yOffset?: number) {
|
|
113
|
-
const currentOffset
|
|
171
|
+
const currentOffset = node.scroller.currentOffset() as ScrollViewCurrentOffset
|
|
114
172
|
const currentXOffset = currentOffset.xOffset
|
|
115
173
|
const currentYOffset = currentOffset.yOffset
|
|
116
174
|
const value: ScrollViewEvent = {
|
|
@@ -15,31 +15,65 @@ interface SliderAttrs {
|
|
|
15
15
|
function style (style: TaroStyleType) {
|
|
16
16
|
.id(style.id)
|
|
17
17
|
.key(style.id)
|
|
18
|
-
.padding(style.padding)
|
|
19
|
-
.margin(style.margin)
|
|
20
|
-
.width(style.width)
|
|
21
|
-
.height(style.height)
|
|
22
|
-
.constraintSize(style.constraintSize)
|
|
23
18
|
.flexGrow(style.flexGrow)
|
|
24
19
|
.flexShrink(style.flexShrink)
|
|
25
20
|
.flexBasis(style.flexBasis)
|
|
26
21
|
.alignSelf(style.alignSelf)
|
|
22
|
+
.padding({
|
|
23
|
+
top: style.paddingTop,
|
|
24
|
+
right: style.paddingRight,
|
|
25
|
+
bottom: style.paddingBottom,
|
|
26
|
+
left: style.paddingLeft
|
|
27
|
+
})
|
|
28
|
+
.margin({
|
|
29
|
+
top: style.marginTop,
|
|
30
|
+
right: style.marginRight,
|
|
31
|
+
bottom: style.marginBottom,
|
|
32
|
+
left: style.marginLeft
|
|
33
|
+
})
|
|
34
|
+
.width(style.width)
|
|
35
|
+
.height(style.height)
|
|
36
|
+
.constraintSize({
|
|
37
|
+
minWidth: style.minWidth,
|
|
38
|
+
maxWidth: style.maxWidth,
|
|
39
|
+
minHeight: style.minHeight,
|
|
40
|
+
maxHeight: style.maxHeight
|
|
41
|
+
})
|
|
27
42
|
.backgroundColor(style.backgroundColor)
|
|
28
|
-
.backgroundImage(style.backgroundImage, style.backgroundRepeat)
|
|
29
|
-
.backgroundImageSize(style.
|
|
30
|
-
.backgroundImagePosition(style.
|
|
31
|
-
.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
.backgroundImage(style.backgroundImage?.src, style.backgroundRepeat)
|
|
44
|
+
.backgroundImageSize(style.backgroundSize)
|
|
45
|
+
.backgroundImagePosition(style.backgroundPosition)
|
|
46
|
+
.borderStyle({
|
|
47
|
+
top: style.borderTopStyle,
|
|
48
|
+
right: style.borderRightStyle,
|
|
49
|
+
bottom: style.borderBottomStyle,
|
|
50
|
+
left: style.borderLeftStyle
|
|
51
|
+
})
|
|
52
|
+
.borderWidth({
|
|
53
|
+
top: style.borderTopWidth,
|
|
54
|
+
right: style.borderRightWidth,
|
|
55
|
+
bottom: style.borderBottomWidth,
|
|
56
|
+
left: style.borderLeftWidth
|
|
57
|
+
})
|
|
58
|
+
.borderColor({
|
|
59
|
+
top: style.borderTopColor,
|
|
60
|
+
right: style.borderRightColor,
|
|
61
|
+
bottom: style.borderBottomColor,
|
|
62
|
+
left: style.borderLeftColor
|
|
63
|
+
})
|
|
64
|
+
.borderRadius({
|
|
65
|
+
topLeft: style.borderTopLeftRadius,
|
|
66
|
+
topRight: style.borderTopRightRadius,
|
|
67
|
+
bottomLeft: style.borderBottomLeftRadius,
|
|
68
|
+
bottomRight: style.borderBottomRightRadius
|
|
69
|
+
})
|
|
40
70
|
.zIndex(style.zIndex)
|
|
41
71
|
.opacity(style.opacity)
|
|
42
|
-
.
|
|
72
|
+
.linearGradient(style.linearGradient)
|
|
73
|
+
.clip(style.overflow)
|
|
74
|
+
.rotate({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y, angle: 0 })
|
|
75
|
+
.scale({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y })
|
|
76
|
+
.transform(style.transform)
|
|
43
77
|
}
|
|
44
78
|
|
|
45
79
|
@Extend(Slider)
|
|
@@ -75,6 +109,11 @@ export default struct TaroSlider {
|
|
|
75
109
|
if (this.node) {
|
|
76
110
|
this.value = this.node.value
|
|
77
111
|
this.node._instance = this
|
|
112
|
+
|
|
113
|
+
if (!this.node._isInit) {
|
|
114
|
+
this.node._isInit = true
|
|
115
|
+
this.node._reset = this.node.value || 0
|
|
116
|
+
}
|
|
78
117
|
}
|
|
79
118
|
}
|
|
80
119
|
|
|
@@ -19,31 +19,65 @@ interface SwiperAttrs {
|
|
|
19
19
|
function swiperStyle (style: TaroStyleType) {
|
|
20
20
|
.id(style.id)
|
|
21
21
|
.key(style.id)
|
|
22
|
-
.padding(style.padding)
|
|
23
|
-
.margin(style.margin)
|
|
24
|
-
.width(style.width)
|
|
25
|
-
.height(style.height)
|
|
26
|
-
.constraintSize(style.constraintSize)
|
|
27
22
|
.flexGrow(style.flexGrow)
|
|
28
23
|
.flexShrink(style.flexShrink)
|
|
29
24
|
.flexBasis(style.flexBasis)
|
|
30
25
|
.alignSelf(style.alignSelf)
|
|
26
|
+
.padding({
|
|
27
|
+
top: style.paddingTop,
|
|
28
|
+
right: style.paddingRight,
|
|
29
|
+
bottom: style.paddingBottom,
|
|
30
|
+
left: style.paddingLeft
|
|
31
|
+
})
|
|
32
|
+
.margin({
|
|
33
|
+
top: style.marginTop,
|
|
34
|
+
right: style.marginRight,
|
|
35
|
+
bottom: style.marginBottom,
|
|
36
|
+
left: style.marginLeft
|
|
37
|
+
})
|
|
38
|
+
.width(style.width)
|
|
39
|
+
.height(style.height)
|
|
40
|
+
.constraintSize({
|
|
41
|
+
minWidth: style.minWidth,
|
|
42
|
+
maxWidth: style.maxWidth,
|
|
43
|
+
minHeight: style.minHeight,
|
|
44
|
+
maxHeight: style.maxHeight
|
|
45
|
+
})
|
|
31
46
|
.backgroundColor(style.backgroundColor)
|
|
32
|
-
.backgroundImage(style.backgroundImage, style.backgroundRepeat)
|
|
33
|
-
.backgroundImageSize(style.
|
|
34
|
-
.backgroundImagePosition(style.
|
|
35
|
-
.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
.
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
.backgroundImage(style.backgroundImage?.src, style.backgroundRepeat)
|
|
48
|
+
.backgroundImageSize(style.backgroundSize)
|
|
49
|
+
.backgroundImagePosition(style.backgroundPosition)
|
|
50
|
+
.borderStyle({
|
|
51
|
+
top: style.borderTopStyle,
|
|
52
|
+
right: style.borderRightStyle,
|
|
53
|
+
bottom: style.borderBottomStyle,
|
|
54
|
+
left: style.borderLeftStyle
|
|
55
|
+
})
|
|
56
|
+
.borderWidth({
|
|
57
|
+
top: style.borderTopWidth,
|
|
58
|
+
right: style.borderRightWidth,
|
|
59
|
+
bottom: style.borderBottomWidth,
|
|
60
|
+
left: style.borderLeftWidth
|
|
61
|
+
})
|
|
62
|
+
.borderColor({
|
|
63
|
+
top: style.borderTopColor,
|
|
64
|
+
right: style.borderRightColor,
|
|
65
|
+
bottom: style.borderBottomColor,
|
|
66
|
+
left: style.borderLeftColor
|
|
67
|
+
})
|
|
68
|
+
.borderRadius({
|
|
69
|
+
topLeft: style.borderTopLeftRadius,
|
|
70
|
+
topRight: style.borderTopRightRadius,
|
|
71
|
+
bottomLeft: style.borderBottomLeftRadius,
|
|
72
|
+
bottomRight: style.borderBottomRightRadius
|
|
73
|
+
})
|
|
44
74
|
.zIndex(style.zIndex)
|
|
45
75
|
.opacity(style.opacity)
|
|
46
|
-
.
|
|
76
|
+
.linearGradient(style.linearGradient)
|
|
77
|
+
.clip(style.overflow)
|
|
78
|
+
.rotate({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y, angle: 0 })
|
|
79
|
+
.scale({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y })
|
|
80
|
+
.transform(style.transform)
|
|
47
81
|
}
|
|
48
82
|
|
|
49
83
|
@Extend(Swiper)
|
|
@@ -12,31 +12,65 @@ interface SwitchAttrs {
|
|
|
12
12
|
function styles (style: TaroStyleType) {
|
|
13
13
|
.id(style.id)
|
|
14
14
|
.key(style.id)
|
|
15
|
-
.padding(style.padding)
|
|
16
|
-
.margin(style.margin)
|
|
17
|
-
.width(style.width)
|
|
18
|
-
.height(style.height)
|
|
19
|
-
.constraintSize(style.constraintSize)
|
|
20
15
|
.flexGrow(style.flexGrow)
|
|
21
16
|
.flexShrink(style.flexShrink)
|
|
22
17
|
.flexBasis(style.flexBasis)
|
|
23
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
|
+
})
|
|
24
39
|
.backgroundColor(style.backgroundColor)
|
|
25
|
-
.backgroundImage(style.backgroundImage, style.backgroundRepeat)
|
|
26
|
-
.backgroundImageSize(style.
|
|
27
|
-
.backgroundImagePosition(style.
|
|
28
|
-
.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
.
|
|
35
|
-
|
|
36
|
-
|
|
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
|
+
})
|
|
37
67
|
.zIndex(style.zIndex)
|
|
38
68
|
.opacity(style.opacity)
|
|
39
|
-
.
|
|
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)
|
|
40
74
|
}
|
|
41
75
|
|
|
42
76
|
@Extend(Toggle)
|
|
@@ -56,28 +90,45 @@ function themeStyles(isDisabled: boolean) {
|
|
|
56
90
|
.opacity(isDisabled ? 0.4 : 1)
|
|
57
91
|
}
|
|
58
92
|
|
|
59
|
-
@
|
|
60
|
-
export default
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (!node?._attrs.disabled) {
|
|
70
|
-
const event: TaroEvent = createTaroEvent('change', { detail: { value: isOn } }, node)
|
|
93
|
+
@Component
|
|
94
|
+
export default struct TaroSwitch {
|
|
95
|
+
node: TaroSwitchElement | null = null
|
|
96
|
+
|
|
97
|
+
aboutToAppear () {
|
|
98
|
+
if (this.node && !this.node._isInit) {
|
|
99
|
+
this.node._isInit = true
|
|
100
|
+
this.node._reset = this.node.checked || false
|
|
101
|
+
}
|
|
102
|
+
}
|
|
71
103
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
node.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
104
|
+
build () {
|
|
105
|
+
if (this.node) {
|
|
106
|
+
Toggle({
|
|
107
|
+
type: this.node._attrs.type !== 'checkbox' ? ToggleType.Switch : ToggleType.Checkbox,
|
|
108
|
+
isOn: this.node.checked,
|
|
109
|
+
})
|
|
110
|
+
.styles(getNormalAttributes(this.node))
|
|
111
|
+
.attrs(getAttributes(this.node))
|
|
112
|
+
.themeStyles(!!this.node._attrs.disabled)
|
|
113
|
+
.onChange((isOn: boolean) => {
|
|
114
|
+
if (this.node) {
|
|
115
|
+
if (!this.node?._attrs.disabled) {
|
|
116
|
+
const event: TaroEvent = createTaroEvent('change', { detail: { value: isOn } }, this.node)
|
|
117
|
+
|
|
118
|
+
this.node.updateCheckedValue(isOn)
|
|
119
|
+
eventHandler(event, 'change', this.node)
|
|
120
|
+
} else {
|
|
121
|
+
this.node.updateComponent()
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
126
|
+
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
127
|
+
if (this.node) {
|
|
128
|
+
this.node._nodeInfo.areaInfo = res[1]
|
|
129
|
+
}
|
|
130
|
+
}))
|
|
131
|
+
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
132
|
+
}
|
|
133
|
+
}
|
|
83
134
|
}
|
|
@@ -8,30 +8,67 @@ import type { TaroButtonElement, TaroElement, TaroTextElement, TaroAny, TaroText
|
|
|
8
8
|
|
|
9
9
|
@Extend(Text)
|
|
10
10
|
function textNormalStyle (style: TaroStyleType) {
|
|
11
|
-
.
|
|
12
|
-
.
|
|
13
|
-
.width(style.width)
|
|
14
|
-
.height(style.height)
|
|
15
|
-
.constraintSize(style.constraintSize)
|
|
11
|
+
.id(style.id)
|
|
12
|
+
.key(style.id)
|
|
16
13
|
.flexGrow(style.flexGrow)
|
|
17
14
|
.flexShrink(style.flexShrink)
|
|
18
15
|
.flexBasis(style.flexBasis)
|
|
19
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
|
+
})
|
|
20
37
|
.backgroundColor(style.backgroundColor)
|
|
21
|
-
.backgroundImage(style.backgroundImage, style.backgroundRepeat)
|
|
22
|
-
.backgroundImageSize(style.
|
|
23
|
-
.backgroundImagePosition(style.
|
|
24
|
-
.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
.
|
|
31
|
-
|
|
32
|
-
|
|
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
|
+
})
|
|
33
65
|
.zIndex(style.zIndex)
|
|
34
|
-
.
|
|
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)
|
|
35
72
|
}
|
|
36
73
|
|
|
37
74
|
@Extend(Text)
|
|
@@ -46,7 +83,7 @@ function textNormalFontStyle (style: TaroStyleType) {
|
|
|
46
83
|
.fontFamily(style.fontFamily)
|
|
47
84
|
.lineHeight(style.lineHeight)
|
|
48
85
|
.decoration({
|
|
49
|
-
type: style.
|
|
86
|
+
type: style.textDecoration,
|
|
50
87
|
color: style.color
|
|
51
88
|
})
|
|
52
89
|
}
|
|
@@ -55,7 +92,7 @@ function textNormalFontStyle (style: TaroStyleType) {
|
|
|
55
92
|
function textSpecialFontStyle(attr: TaroTextStyleType) {
|
|
56
93
|
.textAlign(attr.textAlign)
|
|
57
94
|
.textOverflow(attr.textOverflow)
|
|
58
|
-
.maxLines(attr.
|
|
95
|
+
.maxLines(attr.WebkitLineClamp)
|
|
59
96
|
.letterSpacing(attr.letterSpacing)
|
|
60
97
|
}
|
|
61
98
|
|
|
@@ -82,12 +119,12 @@ export default function TaroText (node: TaroTextElement) {
|
|
|
82
119
|
} else {
|
|
83
120
|
Text(node.textContent)
|
|
84
121
|
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', node), node, ['click']))
|
|
85
|
-
.onAreaChange(getComponentEventCallback(node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
86
|
-
node._nodeInfo.areaInfo = res[1]
|
|
87
|
-
}))
|
|
88
122
|
.textNormalStyle(getNormalAttributes(node))
|
|
89
123
|
.textNormalFontStyle(getNormalAttributes(node))
|
|
90
124
|
.textSpecialFontStyle(getFontAttributes(node))
|
|
91
125
|
.onVisibleAreaChange(getNodeThresholds(node) || [0.0, 1.0], getComponentEventCallback(node, VISIBLE_CHANGE_EVENT_NAME))
|
|
126
|
+
.onAreaChange(getComponentEventCallback(node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
127
|
+
node._nodeInfo.areaInfo = res[1]
|
|
128
|
+
}))
|
|
92
129
|
}
|
|
93
130
|
}
|