@tarojs/plugin-platform-harmony-ets 4.0.0-beta.1 → 4.0.0-beta.10
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/index.ts +2 -0
- 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/index.ts +2 -0
- package/dist/components-harmony-ets/button.ets +22 -71
- package/dist/components-harmony-ets/checkbox.ets +22 -138
- package/dist/components-harmony-ets/form.ets +29 -76
- package/dist/components-harmony-ets/icon.ets +5 -67
- package/dist/components-harmony-ets/image.ets +2 -66
- package/dist/components-harmony-ets/innerHtml.ets +2 -2
- package/dist/components-harmony-ets/input.ets +2 -61
- package/dist/components-harmony-ets/label.ets +40 -81
- package/dist/components-harmony-ets/picker.ets +31 -140
- package/dist/components-harmony-ets/radio.ets +22 -138
- package/dist/components-harmony-ets/richText.ets +4 -70
- package/dist/components-harmony-ets/scrollView.ets +34 -132
- package/dist/components-harmony-ets/slider.ets +4 -68
- package/dist/components-harmony-ets/style.ets +154 -0
- package/dist/components-harmony-ets/swiper.ets +4 -68
- package/dist/components-harmony-ets/switch.ets +4 -68
- package/dist/components-harmony-ets/text.ets +5 -69
- package/dist/components-harmony-ets/textArea.ets +2 -61
- package/dist/components-harmony-ets/utils/flexManager.ets +44 -6
- package/dist/components-harmony-ets/utils/helper.ets +2 -2
- package/dist/components-harmony-ets/utils/styles.ets +12 -1
- package/dist/components-harmony-ets/video.ets +4 -68
- package/dist/components-harmony-ets/view.ets +15 -125
- package/dist/components-harmony-ets/webView.ets +50 -0
- package/dist/index.js +87 -2
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/bom/window.ts +2 -2
- package/dist/runtime-ets/dom/cssStyleDeclaration.ts +23 -3
- package/dist/runtime-ets/dom/document.ts +21 -4
- 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/stylesheet/covertWeb2Hm.ts +73 -0
- package/dist/runtime-ets/dom/stylesheet/util.ts +3 -1
- package/dist/runtime-ets/index.ts +1 -2
- package/dist/runtime-ets/utils/index.ts +4 -1
- package/dist/runtime-framework/react/app.ts +12 -22
- package/dist/runtime-framework/react/hooks.ts +3 -3
- 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-framework/solid/hooks.ts +3 -3
- package/dist/runtime-utils.js +134 -68
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +134 -68
- package/dist/runtime.js.map +1 -1
- package/package.json +10 -10
- package/types/runtime.d.ts +2 -0
- package/dist/runtime-ets/utils/bind.ts +0 -24
|
@@ -1,87 +1,40 @@
|
|
|
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 {
|
|
7
|
+
import { shouldBindEvent, getNodeThresholds } from './utils/helper'
|
|
7
8
|
|
|
8
|
-
import type { TaroAny, TaroFormElement
|
|
9
|
-
|
|
10
|
-
@Extend(Flex)
|
|
11
|
-
function attrs (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
|
-
}
|
|
9
|
+
import type { TaroAny, TaroFormElement } from '@tarojs/runtime'
|
|
74
10
|
|
|
75
11
|
@Builder
|
|
76
12
|
export default function TaroForm (node: TaroFormElement) {
|
|
77
|
-
|
|
78
|
-
|
|
13
|
+
if (FlexManager.isFlexNode(node) && FlexManager.flexOptions(node).direction !== FlexDirection.Column) {
|
|
14
|
+
Row() {
|
|
15
|
+
createLazyChildren(node)
|
|
16
|
+
}
|
|
17
|
+
.attributeModifier(commonStyleModify.setNode(node))
|
|
18
|
+
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', node), node, ['click']))
|
|
19
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), node), node, TOUCH_EVENT_MAP.values()))
|
|
20
|
+
.onAreaChange(getComponentEventCallback(node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
21
|
+
node._nodeInfo.areaInfo = res[1]
|
|
22
|
+
}))
|
|
23
|
+
.onVisibleAreaChange(getNodeThresholds(node) || [0.0, 1.0], getComponentEventCallback(node, VISIBLE_CHANGE_EVENT_NAME))
|
|
24
|
+
.alignItems(FlexManager.flexOptions(node).alignItems as VerticalAlign)
|
|
25
|
+
.justifyContent(FlexManager.flexOptions(node).justifyContent)
|
|
26
|
+
} else {
|
|
27
|
+
Column() {
|
|
28
|
+
createLazyChildren(node)
|
|
29
|
+
}
|
|
30
|
+
.attributeModifier(commonStyleModify.setNode(node))
|
|
31
|
+
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', node), node, ['click']))
|
|
32
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), node), node, TOUCH_EVENT_MAP.values()))
|
|
33
|
+
.onAreaChange(getComponentEventCallback(node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
34
|
+
node._nodeInfo.areaInfo = res[1]
|
|
35
|
+
}))
|
|
36
|
+
.onVisibleAreaChange(getNodeThresholds(node) || [0.0, 1.0], getComponentEventCallback(node, VISIBLE_CHANGE_EVENT_NAME))
|
|
37
|
+
.alignItems(FlexManager.flexOptions(node).alignItems as HorizontalAlign)
|
|
38
|
+
.justifyContent(FlexManager.flexOptions(node).justifyContent)
|
|
79
39
|
}
|
|
80
|
-
.attrs(getNormalAttributes(node))
|
|
81
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', node), node, ['click']))
|
|
82
|
-
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), node), node, TOUCH_EVENT_MAP.values()))
|
|
83
|
-
.onVisibleAreaChange(getNodeThresholds(node) || [0.0, 1.0], getComponentEventCallback(node, VISIBLE_CHANGE_EVENT_NAME))
|
|
84
|
-
.onAreaChange(getComponentEventCallback(node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
85
|
-
node._nodeInfo.areaInfo = res[1]
|
|
86
|
-
}))
|
|
87
40
|
}
|
|
@@ -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
|
|
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
|
-
.
|
|
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
|
-
.
|
|
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 {
|
|
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
|
-
|
|
9
|
+
createChildItem(htmlParser(node.innerHTML))
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME, createTaroEvent } from '@tarojs/runtime'
|
|
2
2
|
|
|
3
|
+
import commonStyleModify from './style'
|
|
3
4
|
import { getNormalAttributes, parseStyles, shouldBindEvent, getNodeThresholds } from './utils/helper'
|
|
4
5
|
import { INPUT_TYPE_MAP, INPUT_CONFIRM_MAP } from './utils/constant/style'
|
|
5
6
|
|
|
@@ -11,67 +12,6 @@ interface InputAttrs {
|
|
|
11
12
|
|
|
12
13
|
@Extend(TextInput)
|
|
13
14
|
function styles (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)
|
|
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)
|
|
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
15
|
.fontColor(style.color)
|
|
76
16
|
.fontSize(style.fontSize)
|
|
77
17
|
.fontWeight(style.fontWeight)
|
|
@@ -130,6 +70,7 @@ export default struct TaroInput {
|
|
|
130
70
|
.maxLength(Number(this.node._attrs?.maxlength) || null)
|
|
131
71
|
.placeholderColor(getPlaceholderColor(this.node))
|
|
132
72
|
.enterKeyType(INPUT_CONFIRM_MAP.get(this.node._attrs?.confirmType) || EnterKeyType.Done)
|
|
73
|
+
.attributeModifier(commonStyleModify.setNode(this.node))
|
|
133
74
|
.styles(getNormalAttributes(this.node))
|
|
134
75
|
.attrs(getAttributes(this.node))
|
|
135
76
|
.onChange((value: string) => {
|
|
@@ -1,76 +1,12 @@
|
|
|
1
1
|
import { Current, eventHandler, getComponentEventCallback, VISIBLE_CHANGE_EVENT_NAME, getPageScrollerOrNode, AREA_CHANGE_EVENT_NAME } from '@tarojs/runtime'
|
|
2
2
|
|
|
3
|
+
import commonStyleModify from './style'
|
|
3
4
|
import { createLazyChildren } from './render'
|
|
4
5
|
import { TOUCH_EVENT_MAP } from './utils/constant/event'
|
|
5
6
|
import { FlexManager } from './utils/FlexManager'
|
|
6
7
|
import { getNormalAttributes, shouldBindEvent, getNodeThresholds } from './utils/helper'
|
|
7
8
|
|
|
8
|
-
import type {
|
|
9
|
-
|
|
10
|
-
@Extend(Flex)
|
|
11
|
-
function attrs (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
|
-
}
|
|
9
|
+
import type { TaroLabelElement, TaroElement, TaroAny, TaroRadioElement, TaroCheckboxElement } from '@tarojs/runtime'
|
|
74
10
|
|
|
75
11
|
function handleTargetChange (id: string) {
|
|
76
12
|
const taro: TaroAny = Current.taro
|
|
@@ -100,20 +36,43 @@ function handleTargetChange (id: string) {
|
|
|
100
36
|
|
|
101
37
|
@Builder
|
|
102
38
|
export default function TaroLabel (node: TaroLabelElement) {
|
|
103
|
-
|
|
104
|
-
|
|
39
|
+
if (FlexManager.isFlexNode(node) && FlexManager.flexOptions(node).direction !== FlexDirection.Column) {
|
|
40
|
+
Row() {
|
|
41
|
+
createLazyChildren(node)
|
|
42
|
+
}
|
|
43
|
+
.attributeModifier(commonStyleModify.setNode(node))
|
|
44
|
+
.onClick((e: ClickEvent) => {
|
|
45
|
+
const firstChild: TaroElement | null = node.childNodes[0] as TaroElement | null
|
|
46
|
+
const id: string = node._attrs.for || firstChild?._attrs.id || firstChild?._nid || ''
|
|
47
|
+
|
|
48
|
+
handleTargetChange(id)
|
|
49
|
+
eventHandler(e, 'click', node)
|
|
50
|
+
})
|
|
51
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), node), node, TOUCH_EVENT_MAP.values()))
|
|
52
|
+
.onAreaChange(getComponentEventCallback(node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
53
|
+
node._nodeInfo.areaInfo = res[1]
|
|
54
|
+
}))
|
|
55
|
+
.onVisibleAreaChange(getNodeThresholds(node) || [0.0, 1.0], getComponentEventCallback(node, VISIBLE_CHANGE_EVENT_NAME))
|
|
56
|
+
.alignItems(FlexManager.flexOptions(node).alignItems as VerticalAlign)
|
|
57
|
+
.justifyContent(FlexManager.flexOptions(node).justifyContent)
|
|
58
|
+
} else {
|
|
59
|
+
Column() {
|
|
60
|
+
createLazyChildren(node)
|
|
61
|
+
}
|
|
62
|
+
.attributeModifier(commonStyleModify.setNode(node))
|
|
63
|
+
.onClick((e: ClickEvent) => {
|
|
64
|
+
const firstChild: TaroElement | null = node.childNodes[0] as TaroElement | null
|
|
65
|
+
const id: string = node._attrs.for || firstChild?._attrs.id || firstChild?._nid || ''
|
|
66
|
+
|
|
67
|
+
handleTargetChange(id)
|
|
68
|
+
eventHandler(e, 'click', node)
|
|
69
|
+
})
|
|
70
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), node), node, TOUCH_EVENT_MAP.values()))
|
|
71
|
+
.onAreaChange(getComponentEventCallback(node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
72
|
+
node._nodeInfo.areaInfo = res[1]
|
|
73
|
+
}))
|
|
74
|
+
.onVisibleAreaChange(getNodeThresholds(node) || [0.0, 1.0], getComponentEventCallback(node, VISIBLE_CHANGE_EVENT_NAME))
|
|
75
|
+
.alignItems(FlexManager.flexOptions(node).alignItems as HorizontalAlign)
|
|
76
|
+
.justifyContent(FlexManager.flexOptions(node).justifyContent)
|
|
105
77
|
}
|
|
106
|
-
.attrs(getNormalAttributes(node))
|
|
107
|
-
.onClick((e: ClickEvent) => {
|
|
108
|
-
const firstChild: TaroElement | null = node.childNodes[0] as TaroElement | null
|
|
109
|
-
const id: string = node._attrs.for || firstChild?._attrs.id || firstChild?._nid || ''
|
|
110
|
-
|
|
111
|
-
handleTargetChange(id)
|
|
112
|
-
eventHandler(e, 'click', node)
|
|
113
|
-
})
|
|
114
|
-
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), node), node, TOUCH_EVENT_MAP.values()))
|
|
115
|
-
.onAreaChange(getComponentEventCallback(node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
116
|
-
node._nodeInfo.areaInfo = res[1]
|
|
117
|
-
}))
|
|
118
|
-
.onVisibleAreaChange(getNodeThresholds(node) || [0.0, 1.0], getComponentEventCallback(node, VISIBLE_CHANGE_EVENT_NAME))
|
|
119
78
|
}
|