@tarojs/plugin-platform-harmony-ets 3.7.0-alpha.27 → 4.0.0-alpha.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/apis.ts +6 -2
- package/dist/apis/base/crypto.ts +4 -0
- package/dist/apis/base/debug.ts +5 -0
- package/dist/apis/base/index.ts +9 -1
- package/dist/apis/base/performance.ts +8 -0
- package/dist/apis/base/system.ts +74 -21
- package/dist/apis/base/update.ts +5 -0
- package/dist/apis/base/weapp/app-event.ts +75 -0
- package/dist/apis/base/weapp/life-cycle.ts +21 -0
- package/dist/apis/canvas/index.ts +27 -0
- package/dist/apis/data-analysis/index.ts +6 -0
- package/dist/apis/device/accelerometer.ts +2 -1
- package/dist/apis/device/accessibility.ts +4 -0
- package/dist/apis/device/battery.ts +2 -2
- package/dist/apis/device/bluetooth-ble.ts +19 -0
- package/dist/apis/device/bluetooth-peripheral.ts +6 -0
- package/dist/apis/device/bluetooth.ts +16 -0
- package/dist/apis/device/calendar.ts +5 -0
- package/dist/apis/device/clipboard.ts +17 -9
- package/dist/apis/device/compass.ts +21 -0
- package/dist/apis/device/contact.ts +5 -0
- package/dist/apis/device/crypto.ts +4 -0
- package/dist/apis/device/gyroscope.ts +7 -0
- package/dist/apis/device/iBeacon.ts +10 -0
- package/dist/apis/device/index.ts +15 -0
- package/dist/apis/device/keyboard.ts +2 -1
- package/dist/apis/device/memory.ts +10 -3
- package/dist/apis/device/motion.ts +6 -0
- package/dist/apis/device/network.ts +26 -9
- package/dist/apis/device/nfc.ts +10 -0
- package/dist/apis/device/phone.ts +2 -1
- package/dist/apis/device/scan.ts +4 -0
- package/dist/apis/device/screen.ts +2 -1
- package/dist/apis/device/sms.ts +4 -0
- package/dist/apis/device/vibrate.ts +19 -11
- package/dist/apis/device/wifi.ts +15 -0
- package/dist/apis/ext/index.ts +5 -0
- package/dist/apis/files/index.ts +2 -1
- package/dist/apis/files/manager.ts +2 -1
- package/dist/apis/framework/index.ts +3 -8
- package/dist/apis/index.ts +27 -17
- package/dist/apis/location/index.ts +61 -68
- package/dist/apis/media/EditorContext.ts +32 -0
- package/dist/apis/media/audio/index.ts +18 -0
- package/dist/apis/media/background-audio/index.ts +16 -0
- package/dist/apis/media/camera.ts +16 -0
- package/dist/apis/media/common.ts +2 -1
- package/dist/apis/media/{image.ts → image/index.ts} +4 -3
- package/dist/apis/media/index.ts +10 -0
- package/dist/apis/media/live.ts +5 -0
- package/dist/apis/media/map.ts +4 -0
- package/dist/apis/media/media-recorder.ts +4 -0
- package/dist/apis/media/recorder.ts +6 -0
- package/dist/apis/media/video/VideoContext.ts +68 -0
- package/dist/apis/media/{video.ts → video/index.ts} +13 -2
- package/dist/apis/media/video-decoder.ts +4 -0
- package/dist/apis/media/video-processing.ts +4 -0
- package/dist/apis/media/voip.ts +19 -0
- package/dist/apis/network/index.ts +3 -0
- package/dist/apis/network/mdns.ts +13 -0
- package/dist/apis/network/request.ts +7 -6
- package/dist/apis/network/tcp.ts +4 -0
- package/dist/apis/network/udp.ts +4 -0
- package/dist/apis/network/webSocket.ts +2 -6
- package/dist/apis/open-api/account.ts +4 -0
- package/dist/apis/open-api/address.ts +4 -0
- package/dist/apis/open-api/authorize.ts +5 -0
- package/dist/apis/open-api/card.ts +5 -0
- package/dist/apis/open-api/channels-live.ts +11 -0
- package/dist/apis/open-api/customer-service.ts +4 -0
- package/dist/apis/open-api/device-voip.ts +5 -0
- package/dist/apis/open-api/facial.ts +7 -0
- package/dist/apis/open-api/favorites.ts +5 -0
- package/dist/apis/open-api/group.ts +4 -0
- package/dist/apis/open-api/index.ts +20 -6
- package/dist/apis/open-api/invoice.ts +5 -0
- package/dist/apis/open-api/license-plate.ts +4 -0
- package/dist/apis/open-api/login.ts +6 -0
- package/dist/apis/open-api/my-miniprogram.ts +4 -0
- package/dist/apis/open-api/privacy.ts +7 -0
- package/dist/apis/open-api/red-package.ts +4 -0
- package/dist/apis/open-api/settings.ts +5 -0
- package/dist/apis/open-api/soter.ts +6 -0
- package/dist/apis/open-api/subscribe-message.ts +6 -0
- package/dist/apis/open-api/{user-info/index.ts → user-info.ts} +1 -16
- package/dist/apis/open-api/werun.ts +5 -0
- package/dist/apis/payment/index.ts +6 -0
- package/dist/apis/route/index.ts +19 -28
- package/dist/apis/share/index.ts +33 -0
- package/dist/apis/storage/background-fetch.ts +7 -0
- package/dist/apis/storage/cache-manager.ts +4 -0
- package/dist/apis/storage/index.ts +158 -88
- package/dist/apis/ui/{animation.ts → animation/animation.ts} +73 -31
- package/dist/apis/ui/animation/index.ts +7 -0
- package/dist/apis/ui/background.ts +4 -19
- package/dist/apis/ui/custom-component.ts +8 -0
- package/dist/apis/ui/fonts.ts +4 -0
- package/dist/apis/ui/index.ts +8 -10
- package/dist/apis/ui/interaction/index.ts +45 -59
- package/dist/apis/ui/menu.ts +4 -0
- package/dist/apis/ui/navigation-bar/index.ts +60 -21
- package/dist/apis/ui/pull-down-refresh.ts +10 -4
- package/dist/apis/{page → ui/scroll}/index.ts +32 -27
- package/dist/apis/ui/sticky.ts +4 -0
- package/dist/apis/{tabbar/index.ts → ui/tab-bar.ts} +6 -8
- package/dist/apis/ui/window.ts +20 -0
- package/dist/apis/utils/handler.ts +4 -4
- package/dist/apis/utils/index.ts +1 -1
- package/dist/apis/worker/index.ts +4 -0
- package/dist/apis/wxml/IntersectionObserver.ts +24 -25
- package/dist/apis/wxml/index.ts +7 -2
- package/dist/apis/wxml/nodesRef.ts +2 -2
- package/dist/apis/wxml/selectorQuery.ts +29 -17
- package/dist/components-harmony-ets/button.ets +106 -80
- package/dist/components-harmony-ets/canvas.ets +51 -0
- package/dist/components-harmony-ets/checkbox.ets +82 -148
- package/dist/components-harmony-ets/form.ets +45 -132
- package/dist/components-harmony-ets/icon.ets +66 -69
- package/dist/components-harmony-ets/image.ets +26 -61
- package/dist/components-harmony-ets/index.ets +92 -0
- package/dist/components-harmony-ets/innerHtml.ets +7 -70
- package/dist/components-harmony-ets/input.ets +60 -146
- package/dist/components-harmony-ets/label.ets +86 -92
- package/dist/components-harmony-ets/listView.ets +26 -0
- package/dist/components-harmony-ets/movableArea.ets +124 -0
- package/dist/components-harmony-ets/movableView.ets +93 -0
- package/dist/components-harmony-ets/navigationBar.ets +65 -0
- package/dist/components-harmony-ets/pageMeta.ets +94 -0
- package/dist/components-harmony-ets/picker.ets +172 -198
- package/dist/components-harmony-ets/progress.ets +52 -0
- package/dist/components-harmony-ets/pseudo.ets +80 -0
- package/dist/components-harmony-ets/radio.ets +85 -155
- package/dist/components-harmony-ets/richText.ets +15 -87
- package/dist/components-harmony-ets/scrollList.ets +94 -0
- package/dist/components-harmony-ets/scrollView.ets +81 -149
- package/dist/components-harmony-ets/slider.ets +47 -94
- package/dist/components-harmony-ets/stickySection.ets +42 -0
- package/dist/components-harmony-ets/style.ets +396 -0
- package/dist/components-harmony-ets/swiper.ets +51 -151
- package/dist/components-harmony-ets/switch.ets +35 -76
- package/dist/components-harmony-ets/{index.ts → tag.ts} +6 -0
- package/dist/components-harmony-ets/text.ets +131 -76
- package/dist/components-harmony-ets/textArea.ets +64 -140
- package/dist/components-harmony-ets/utils/AttributeManager.ets +1 -1
- package/dist/components-harmony-ets/utils/DynamicCenter.ts +4 -13
- package/dist/components-harmony-ets/utils/constant/style.ets +9 -6
- package/dist/components-harmony-ets/utils/flexManager.ets +68 -85
- package/dist/components-harmony-ets/utils/helper.ets +18 -65
- package/dist/components-harmony-ets/utils/htmlParser/HarmonyHTMLParser.ts +1 -2
- package/dist/components-harmony-ets/utils/htmlParser/index.ts +1 -1
- package/dist/components-harmony-ets/utils/index.ts +55 -51
- package/dist/components-harmony-ets/utils/styles.ets +177 -65
- package/dist/components-harmony-ets/video.ets +70 -116
- package/dist/components-harmony-ets/view.ets +58 -64
- package/dist/components-harmony-ets/webView.ets +56 -0
- package/dist/index.d.ts +152 -0
- package/dist/index.js +230 -60
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/bom/document.ts +6 -4
- package/dist/runtime-ets/bom/getComputedStyle.ts +2 -2
- package/dist/runtime-ets/bom/window.ts +9 -2
- package/dist/runtime-ets/current.ts +3 -0
- package/dist/runtime-ets/dom/bind.ts +96 -0
- package/dist/runtime-ets/dom/class-list.ts +4 -6
- package/dist/runtime-ets/dom/comment.ts +1 -2
- package/dist/runtime-ets/dom/cssNesting.ts +409 -0
- package/dist/runtime-ets/dom/cssStyleDeclaration.ts +30 -20
- package/dist/runtime-ets/dom/dataSource.ts +64 -0
- package/dist/runtime-ets/dom/document.ts +36 -51
- package/dist/runtime-ets/dom/element/canvas.ts +136 -0
- package/dist/runtime-ets/dom/element/element.ts +439 -0
- package/dist/runtime-ets/dom/element/form.ts +403 -0
- package/dist/runtime-ets/dom/element/index.ts +120 -0
- package/dist/runtime-ets/dom/element/movableArea.ts +11 -0
- package/dist/runtime-ets/dom/element/movableView.ts +242 -0
- package/dist/runtime-ets/dom/element/normal.ts +103 -0
- package/dist/runtime-ets/dom/element/progress.ts +11 -0
- package/dist/runtime-ets/dom/element/scrollView.ts +15 -0
- package/dist/runtime-ets/dom/element/text.ts +10 -0
- package/dist/runtime-ets/dom/element/video.ts +50 -0
- package/dist/runtime-ets/dom/element/webView.ts +68 -0
- package/dist/runtime-ets/dom/event.ts +26 -5
- package/dist/runtime-ets/dom/eventTarget.ts +3 -3
- package/dist/runtime-ets/dom/node.ts +114 -49
- package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +805 -0
- package/dist/runtime-ets/dom/stylesheet/index.ts +122 -429
- package/dist/runtime-ets/dom/stylesheet/type.ts +93 -17
- package/dist/runtime-ets/dom/stylesheet/util.ts +145 -17
- package/dist/runtime-ets/index.ts +2 -3
- package/dist/runtime-ets/interface/event.ts +3 -2
- package/dist/runtime-ets/utils/index.ts +87 -17
- package/dist/runtime-ets/utils/info.ts +21 -47
- package/dist/runtime-framework/react/app.ts +20 -28
- package/dist/runtime-framework/react/hooks.ts +3 -4
- package/dist/runtime-framework/react/index.ts +1 -2
- package/dist/runtime-framework/react/native-page.ts +421 -0
- package/dist/runtime-framework/react/page.ts +5 -17
- package/dist/runtime-framework/solid/app.ts +25 -45
- package/dist/runtime-framework/solid/connect.ts +21 -3
- package/dist/runtime-framework/solid/hooks.ts +17 -12
- package/dist/runtime-framework/solid/index.ts +6 -2
- package/dist/runtime-framework/solid/page.ts +84 -36
- package/dist/runtime-framework/solid/reconciler/props.ts +70 -25
- package/dist/runtime-framework/solid/reconciler/render.ts +16 -6
- 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 +827 -0
- package/dist/runtime-utils.js +1633 -549
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +1633 -549
- package/dist/runtime.js.map +1 -1
- package/index.js +3 -1
- package/package.json +14 -15
- 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/harmony.d.ts +4 -0
- package/types/index.d.ts +4 -0
- package/types/runtime.d.ts +7 -1
- package/LICENSE +0 -160
- package/dist/components-harmony-ets/base.ets +0 -63
- package/dist/components-harmony-ets/element.ets +0 -223
- package/dist/components-harmony-ets/utils/constant/icon.ts +0 -19
- package/dist/runtime-ets/dom/element.ts +0 -457
- package/dist/runtime-ets/dom/text.ts +0 -19
- package/dist/runtime-ets/utils/bind.ts +0 -35
- package/types/api.d.ts +0 -4
- /package/dist/runtime-framework/solid/{contant.ts → constant.ts} +0 -0
|
@@ -1,91 +1,203 @@
|
|
|
1
|
+
import { isUndefined } from '@tarojs/shared'
|
|
1
2
|
import { ObjectAssign } from '@tarojs/runtime'
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
-
import { TEXT_DEFAULT_STYLE } from './constant/style'
|
|
4
|
+
import { FlexManager } from './flexManager'
|
|
5
5
|
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
6
|
+
import type { StandardProps, TextProps } from '@tarojs/components/types'
|
|
7
|
+
import type { TaroAny, TaroElement, TaroStyleType, TaroTextStyleType, HarmonyStyle } from '@tarojs/runtime'
|
|
8
8
|
|
|
9
9
|
export function getFontAttributes (node: TaroElement): TaroTextStyleType {
|
|
10
|
-
|
|
10
|
+
let hmStyle = getNormalAttributes(node)
|
|
11
|
+
const attrs: TextProps = node._attrs || {}
|
|
12
|
+
|
|
13
|
+
if (!hmStyle) return {}
|
|
14
|
+
|
|
15
|
+
let lineHeight = hmStyle.lineHeight
|
|
16
|
+
if (!isUndefined(hmStyle.verticalAlign)) {
|
|
17
|
+
lineHeight = 0
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let WebkitLineClamp = attrs.maxLines || hmStyle.WebkitLineClamp || Infinity
|
|
21
|
+
if (hmStyle.textOverflow && !isUndefined(hmStyle.textOverflow.overflow)) {
|
|
22
|
+
switch (hmStyle.textOverflow.overflow) {
|
|
23
|
+
case TextOverflow.Clip:
|
|
24
|
+
case TextOverflow.Ellipsis:
|
|
25
|
+
case TextOverflow.None: WebkitLineClamp = WebkitLineClamp || 1; break
|
|
26
|
+
default: break
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const isFlexText = hmStyle.display === 'flex'
|
|
31
|
+
let textAlign = hmStyle.textAlign
|
|
32
|
+
let verticalAlign = hmStyle.verticalAlign
|
|
33
|
+
|
|
34
|
+
// 按照 w3c 规范,一旦设置了 display: flex,textAlign 和 verticalAlign 都会直接失效
|
|
35
|
+
// 需要使用 justifyContent 和 alignItems
|
|
36
|
+
if (isFlexText) {
|
|
37
|
+
switch (hmStyle.justifyContent) {
|
|
38
|
+
case FlexAlign.Start:
|
|
39
|
+
textAlign = TextAlign.Start
|
|
40
|
+
break
|
|
41
|
+
case FlexAlign.Center:
|
|
42
|
+
textAlign = TextAlign.Center
|
|
43
|
+
break
|
|
44
|
+
case FlexAlign.End:
|
|
45
|
+
textAlign = TextAlign.End
|
|
46
|
+
break
|
|
47
|
+
case FlexAlign.SpaceBetween:
|
|
48
|
+
case FlexAlign.SpaceAround:
|
|
49
|
+
textAlign = TextAlign.JUSTIFY
|
|
50
|
+
break
|
|
51
|
+
default:
|
|
52
|
+
textAlign = TextAlign.Start
|
|
53
|
+
break
|
|
54
|
+
}
|
|
55
|
+
switch (hmStyle.alignItems) {
|
|
56
|
+
case ItemAlign.Start:
|
|
57
|
+
verticalAlign = Alignment.Top
|
|
58
|
+
break
|
|
59
|
+
case ItemAlign.Center:
|
|
60
|
+
verticalAlign = Alignment.Center
|
|
61
|
+
break
|
|
62
|
+
case ItemAlign.End:
|
|
63
|
+
verticalAlign = Alignment.End
|
|
64
|
+
break
|
|
65
|
+
default:
|
|
66
|
+
verticalAlign = Alignment.Top
|
|
67
|
+
break
|
|
68
|
+
}
|
|
69
|
+
}
|
|
11
70
|
|
|
12
71
|
const attributes: TaroAny = {
|
|
13
|
-
|
|
72
|
+
textAlign,
|
|
73
|
+
verticalAlign,
|
|
74
|
+
WebkitLineClamp: WebkitLineClamp,
|
|
14
75
|
// 已做处理的属性
|
|
15
76
|
letterSpacing: hmStyle.letterSpacing,
|
|
16
|
-
|
|
17
|
-
|
|
77
|
+
textOverflow: hmStyle.textOverflow,
|
|
78
|
+
lineHeight: lineHeight
|
|
18
79
|
}
|
|
19
80
|
|
|
20
81
|
return attributes
|
|
21
82
|
}
|
|
22
83
|
|
|
23
|
-
|
|
84
|
+
// 模拟 div 自动撑满父元素的情况
|
|
85
|
+
export function isMaxWidthView (node: TaroElement) {
|
|
86
|
+
const parentNode: TaroElement = node.parentNode as TaroElement
|
|
87
|
+
|
|
88
|
+
return node.tagName === 'VIEW' && parentNode && parentNode.tagName === 'VIEW' && !FlexManager.isFlexNode(parentNode)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function getNormalAttributes (node: TaroElement, initStyle?: HarmonyStyle): HarmonyStyle {
|
|
24
92
|
const hmStyle = node.hmStyle
|
|
93
|
+
|
|
94
|
+
if (!hmStyle) return {}
|
|
25
95
|
|
|
26
96
|
const _nid = node._nid
|
|
27
97
|
const _attrs: StandardProps = node._attrs || {}
|
|
28
98
|
|
|
29
|
-
|
|
30
|
-
const transformRotate: HarmonyType.Transform.Rotate = transform?.rotate?.[0]
|
|
31
|
-
const transformTranslate: HarmonyType.Transform.Translate = transform?.translate?.[0]
|
|
32
|
-
const transformScale: HarmonyType.Transform.Scale = transform?.scale?.[0]
|
|
33
|
-
const transformTransform: HarmonyType.Transform.Transform = transform?.transform?.[0]
|
|
34
|
-
|
|
35
|
-
let normalAttributes: HarmonyStyle = {
|
|
36
|
-
// Flex相关
|
|
37
|
-
flexBasis: hmStyle.flexBasis,
|
|
38
|
-
flexGrow: hmStyle.flexGrow,
|
|
39
|
-
flexShrink: hmStyle.flexShrink,
|
|
40
|
-
alignSelf: hmStyle.alignSelf,
|
|
41
|
-
// 尺寸相关
|
|
42
|
-
width: hmStyle.width,
|
|
43
|
-
height: hmStyle.height,
|
|
44
|
-
constraintSize: hmStyle.constraintSize,
|
|
45
|
-
margin: hmStyle.margin,
|
|
46
|
-
padding: hmStyle.padding,
|
|
47
|
-
// 边框相关
|
|
48
|
-
borderStyle: hmStyle.borderStyle,
|
|
49
|
-
borderWidth: hmStyle.borderWidth,
|
|
50
|
-
borderColor: hmStyle.borderColor,
|
|
51
|
-
borderRadius: hmStyle.borderRadius,
|
|
52
|
-
// 背景相关
|
|
53
|
-
backgroundColor: hmStyle.backgroundColor,
|
|
54
|
-
backgroundImage: hmStyle.backgroundImage,
|
|
55
|
-
backgroundImageSize: hmStyle.backgroundImageSize,
|
|
56
|
-
backgroundRepeat: hmStyle.backgroundRepeat,
|
|
57
|
-
linearGradient: hmStyle.linearGradient,
|
|
58
|
-
// 变换相关
|
|
59
|
-
rotate: transformRotate,
|
|
60
|
-
translate: transformTranslate,
|
|
61
|
-
scale: transformScale,
|
|
62
|
-
transform: transformTransform,
|
|
63
|
-
// 通用文本相关
|
|
64
|
-
color: hmStyle.color,
|
|
65
|
-
fontSize: hmStyle.fontSize,
|
|
66
|
-
fontStyle: hmStyle.fontStyle,
|
|
67
|
-
fontWeight: hmStyle.fontWeight,
|
|
68
|
-
fontFamily: hmStyle.fontFamily || TEXT_DEFAULT_STYLE.FONT_FAMILY,
|
|
69
|
-
lineHeight: hmStyle.lineHeight,
|
|
70
|
-
decoration: hmStyle.decoration,
|
|
71
|
-
// 其他
|
|
72
|
-
clip: hmStyle.clip,
|
|
73
|
-
id: _attrs.id || _nid,
|
|
74
|
-
// focus: _attrs.focus || false,
|
|
75
|
-
}
|
|
99
|
+
let normalAttributes = hmStyle
|
|
76
100
|
|
|
101
|
+
// 覆盖属性
|
|
102
|
+
normalAttributes.id = _attrs.id || _nid
|
|
77
103
|
|
|
78
|
-
|
|
79
|
-
|
|
104
|
+
let pseudoStylesheet = getPseudoClass(node)
|
|
105
|
+
if (pseudoStylesheet) {
|
|
106
|
+
normalAttributes = ObjectAssign({}, normalAttributes, pseudoStylesheet)
|
|
107
|
+
}
|
|
80
108
|
|
|
81
|
-
//
|
|
82
|
-
if (
|
|
83
|
-
|
|
109
|
+
// 初始化默认的值
|
|
110
|
+
if (initStyle) {
|
|
111
|
+
normalAttributes = ObjectAssign({}, initStyle, normalAttributes)
|
|
112
|
+
}
|
|
113
|
+
return normalAttributes
|
|
114
|
+
}
|
|
84
115
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
116
|
+
// 应用伪类样式
|
|
117
|
+
function getPseudoClass (node: TaroElement): HarmonyStyle | null {
|
|
118
|
+
// 伪类
|
|
119
|
+
const _pseudo_class = Object.keys(node._pseudo_class)
|
|
120
|
+
if (_pseudo_class.length) {
|
|
121
|
+
for (let i = 0; i < _pseudo_class.length; i++) {
|
|
122
|
+
const pseudoKey = _pseudo_class[i]
|
|
123
|
+
const pseudoStylesheet = node._pseudo_class[pseudoKey]
|
|
124
|
+
if (!pseudoStylesheet) continue
|
|
125
|
+
switch(pseudoKey) {
|
|
126
|
+
case "::first-child": {
|
|
127
|
+
if (node.parentNode?.firstChild?._nid === node._nid) {
|
|
128
|
+
return pseudoStylesheet.hmStyle
|
|
129
|
+
}
|
|
130
|
+
break
|
|
131
|
+
}
|
|
132
|
+
case "::last-child": {
|
|
133
|
+
if (node.parentNode?.lastChild?._nid === node._nid) {
|
|
134
|
+
return pseudoStylesheet.hmStyle
|
|
135
|
+
}
|
|
136
|
+
break
|
|
137
|
+
}
|
|
138
|
+
case "::empty": {
|
|
139
|
+
if (node.children?.length === 0) {
|
|
140
|
+
return pseudoStylesheet.hmStyle
|
|
141
|
+
}
|
|
142
|
+
break
|
|
143
|
+
}
|
|
144
|
+
default: {
|
|
145
|
+
// 解析nth-child()
|
|
146
|
+
// 找出当前节点在父节点中的位置
|
|
147
|
+
// 公式
|
|
148
|
+
let matchs: [number, number] | null = null
|
|
149
|
+
if (pseudoKey === '::nth-child(odd)') {
|
|
150
|
+
matchs = [2, 1]
|
|
151
|
+
} else if (pseudoKey === '::nth-child(even)') {
|
|
152
|
+
matchs = [2, 0]
|
|
153
|
+
} else {
|
|
154
|
+
matchs = parseNthChild(pseudoKey)
|
|
155
|
+
}
|
|
156
|
+
if (matchs) {
|
|
157
|
+
let index = node.parentNode?.childNodes.findIndex((child) => child._nid === node._nid)
|
|
158
|
+
if (isUndefined(index)) return null
|
|
159
|
+
else {
|
|
160
|
+
index = index + 1
|
|
161
|
+
if (matchs[0] === 0) {
|
|
162
|
+
if (index === matchs[1]) {
|
|
163
|
+
return pseudoStylesheet.hmStyle
|
|
164
|
+
}
|
|
165
|
+
} else {
|
|
166
|
+
if ((index - matchs[1]) % matchs[0] === 0) {
|
|
167
|
+
return pseudoStylesheet.hmStyle
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
88
174
|
}
|
|
89
175
|
}
|
|
90
|
-
return
|
|
176
|
+
return null
|
|
91
177
|
}
|
|
178
|
+
|
|
179
|
+
// 正则匹配nth-child
|
|
180
|
+
function parseNthChild(selector: string): [number, number] | null {
|
|
181
|
+
const regex = /nth-child\((?:(-?\d*)n\s*)?([+-]?\s*\d+)?\)/;
|
|
182
|
+
const match = selector.match(regex);
|
|
183
|
+
|
|
184
|
+
if (match) {
|
|
185
|
+
const a = match[1] ? parseInt(match[1]) : 0;
|
|
186
|
+
const b = match[2] ? parseInt(match[2]) : 0;
|
|
187
|
+
return [a, b];
|
|
188
|
+
} else {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
export function getStyleAttr(node: TaroElement | null, key: string): TaroAny {
|
|
195
|
+
if (!node) return null
|
|
196
|
+
const hmStyle = node.hmStyle
|
|
197
|
+
if (!hmStyle) return null
|
|
198
|
+
// 覆盖属性
|
|
199
|
+
if (key === 'width') {
|
|
200
|
+
return isMaxWidthView(node) && isUndefined(hmStyle.width) ? '100%' : hmStyle.width
|
|
201
|
+
}
|
|
202
|
+
return hmStyle[key]
|
|
203
|
+
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TaroEvent, TaroAny } from '@tarojs/runtime'
|
|
1
|
+
import { AREA_CHANGE_EVENT_NAME, eventHandler, getComponentEventCallback, VISIBLE_CHANGE_EVENT_NAME, createTaroEvent } from '@tarojs/runtime'
|
|
3
2
|
|
|
4
|
-
import
|
|
3
|
+
import commonStyleModify from './style'
|
|
5
4
|
import { TOUCH_EVENT_MAP } from './utils/constant/event'
|
|
6
|
-
import {
|
|
7
|
-
import { getNormalAttributes, shouldBindEvent, getNodeThresholds, bindAnimation } from './utils/helper'
|
|
5
|
+
import { shouldBindEvent, getNodeThresholds } from './utils/helper'
|
|
8
6
|
|
|
9
|
-
import type { TaroVideoElement } from '
|
|
10
|
-
import type { TaroStyleType } from '@tarojs/runtime'
|
|
7
|
+
import type { TaroAny, TaroVideoElement, TaroEvent } from '@tarojs/runtime'
|
|
11
8
|
|
|
12
9
|
export interface VideoOptions {
|
|
13
10
|
src?: string | Resource
|
|
@@ -25,137 +22,94 @@ export interface VideoUpdateEvent {
|
|
|
25
22
|
time: number
|
|
26
23
|
}
|
|
27
24
|
|
|
28
|
-
@Extend(Video)
|
|
29
|
-
function attrs (style: TaroStyleType) {
|
|
30
|
-
.id(style.id)
|
|
31
|
-
.key(style.id)
|
|
32
|
-
.padding(style.padding)
|
|
33
|
-
.margin(style.margin)
|
|
34
|
-
.width(style.width)
|
|
35
|
-
.height(style.height)
|
|
36
|
-
.constraintSize(style.constraintSize)
|
|
37
|
-
.flexGrow(style.flexGrow)
|
|
38
|
-
.flexShrink(style.flexShrink)
|
|
39
|
-
.flexBasis(style.flexBasis)
|
|
40
|
-
.alignSelf(style.alignSelf)
|
|
41
|
-
.backgroundColor(style.backgroundColor)
|
|
42
|
-
.backgroundImage(style.backgroundImage, style.backgroundRepeat)
|
|
43
|
-
.backgroundImageSize(style.backgroundImageSize)
|
|
44
|
-
.rotate(style.rotate)
|
|
45
|
-
.scale(style.scale)
|
|
46
|
-
.translate(style.translate)
|
|
47
|
-
.transform(style.transform)
|
|
48
|
-
.borderStyle(style.borderStyle)
|
|
49
|
-
.borderWidth(style.borderWidth)
|
|
50
|
-
.borderColor(style.borderColor)
|
|
51
|
-
.borderRadius(style.borderRadius)
|
|
52
|
-
.linearGradient(style.linearGradient)
|
|
53
|
-
.zIndex(style.zIndex)
|
|
54
|
-
.opacity(style.opacity)
|
|
55
|
-
.clip(style.clip)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
25
|
@Extend(Video)
|
|
59
26
|
function props(attr: VideoAttrs) {
|
|
60
27
|
.muted(attr.muted)
|
|
61
28
|
.autoPlay(attr.autoPlay)
|
|
62
29
|
.controls(attr.controls)
|
|
63
30
|
.objectFit(attr.objectFit)
|
|
64
|
-
.loop(attr.loop)
|
|
31
|
+
.loop(attr.loop || false)
|
|
65
32
|
}
|
|
66
33
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
nodeInfoMap: TaroAny = {}
|
|
70
|
-
|
|
71
|
-
@Styles visibleChangeEvent () {
|
|
72
|
-
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
73
|
-
}
|
|
34
|
+
function emitEvent (node: TaroVideoElement, type: string, detail?: TaroAny) {
|
|
35
|
+
const event: TaroEvent = createTaroEvent(type, { detail }, node)
|
|
74
36
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
37
|
+
event.stopPropagation()
|
|
38
|
+
eventHandler(event, type, node)
|
|
39
|
+
}
|
|
78
40
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
41
|
+
function getVideoData (node: TaroVideoElement): VideoOptions {
|
|
42
|
+
const src = node._attrs.src
|
|
43
|
+
const poster = node._attrs.poster
|
|
44
|
+
return {
|
|
45
|
+
src,
|
|
46
|
+
previewUri: poster,
|
|
47
|
+
controller: node.controller
|
|
84
48
|
}
|
|
49
|
+
}
|
|
85
50
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const eventResult: TaroAny = res.eventResult
|
|
93
|
-
this.nodeInfoMap[this.node._nid].areaInfo = eventResult[1]
|
|
94
|
-
}))
|
|
51
|
+
function getObjectFit (node: TaroVideoElement) {
|
|
52
|
+
switch (node._attrs.objectFit) {
|
|
53
|
+
case 'contain': return ImageFit.Contain
|
|
54
|
+
case 'cover': return ImageFit.Cover
|
|
55
|
+
case 'fill': return ImageFit.Fill
|
|
56
|
+
default: return ImageFit.Contain
|
|
95
57
|
}
|
|
58
|
+
}
|
|
96
59
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
60
|
+
function getVideoProps (node: TaroVideoElement): VideoAttrs {
|
|
61
|
+
const muted: boolean = node._attrs.muted || false
|
|
62
|
+
const autoPlay: boolean = node._attrs.autoplay || false
|
|
63
|
+
const controls: boolean = node._attrs.controls || false
|
|
64
|
+
const objectFit: ImageFit = getObjectFit(node)
|
|
65
|
+
const loop: boolean = node._attrs.loop || false
|
|
66
|
+
return {
|
|
67
|
+
muted,
|
|
68
|
+
controls,
|
|
69
|
+
objectFit,
|
|
70
|
+
loop,
|
|
71
|
+
autoPlay
|
|
101
72
|
}
|
|
73
|
+
}
|
|
102
74
|
|
|
75
|
+
function handleUpdate (node: TaroVideoElement, e: VideoUpdateEvent) {
|
|
76
|
+
node._nodeInfo._currentTime = e.time
|
|
103
77
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const poster = this.node._attrs.poster
|
|
107
|
-
return {
|
|
108
|
-
src,
|
|
109
|
-
previewUri: poster,
|
|
110
|
-
controller: this.controller
|
|
111
|
-
}
|
|
112
|
-
}
|
|
78
|
+
emitEvent(node, 'timeUpdate', { currentTime: e.time})
|
|
79
|
+
}
|
|
113
80
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
}
|
|
81
|
+
@Component
|
|
82
|
+
export default struct TaroVideo {
|
|
83
|
+
@Builder customBuilder() {}
|
|
84
|
+
@BuilderParam createLazyChildren: (node: TaroVideoElement) => void = this.customBuilder
|
|
85
|
+
@ObjectLink node: TaroVideoElement
|
|
86
|
+
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
122
87
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const controls: boolean = this.node._attrs.controls || false
|
|
127
|
-
const objectFit: ImageFit = this.getObjectFit()
|
|
128
|
-
const loop: boolean = this.node._attrs.loop || false
|
|
129
|
-
return {
|
|
130
|
-
muted,
|
|
131
|
-
controls,
|
|
132
|
-
objectFit,
|
|
133
|
-
loop,
|
|
134
|
-
autoPlay
|
|
88
|
+
aboutToAppear(): void {
|
|
89
|
+
if (this.node) {
|
|
90
|
+
this.node._instance = this
|
|
135
91
|
}
|
|
136
92
|
}
|
|
137
93
|
|
|
138
|
-
|
|
139
|
-
this.
|
|
140
|
-
this.
|
|
94
|
+
build () {
|
|
95
|
+
Video(getVideoData(this.node))
|
|
96
|
+
.attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
97
|
+
.props(getVideoProps(this.node))
|
|
98
|
+
.onStart(shouldBindEvent(() => { emitEvent(this.node, 'play') }, this.node, ['play']))
|
|
99
|
+
.onPause(shouldBindEvent(() => { emitEvent(this.node, 'pause') }, this.node, ['pause']))
|
|
100
|
+
.onFinish(shouldBindEvent(() => { emitEvent(this.node, 'ended') }, this.node, ['ended']))
|
|
101
|
+
.onError(shouldBindEvent(() => { emitEvent(this.node, 'error') }, this.node, ['error']))
|
|
102
|
+
.onUpdate((e) => { handleUpdate(this.node, e) })
|
|
103
|
+
.onPrepared(shouldBindEvent((e: TaroAny) => { emitEvent(this.node, 'loadedMetaData', { duration: e.duration }) }, this.node, ['loadedmetadata']))
|
|
104
|
+
.onSeeking(shouldBindEvent((e: TaroAny) => { emitEvent(this.node, 'seeking', { duration: e.time }) }, this.node, ['seeking']))
|
|
105
|
+
.onSeeked(shouldBindEvent(() => { emitEvent(this.node, 'seeked') }, this.node, ['seeked']))
|
|
106
|
+
.onFullscreenChange(shouldBindEvent((e: TaroAny) => { emitEvent(this.node, 'fullScreenChange', { fullScreen: e.fullscreen}) }, this.node, ['fullscreenchange']))
|
|
107
|
+
.onClick((e: ClickEvent) => { eventHandler(e, 'click', this.node) })
|
|
108
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
109
|
+
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
110
|
+
this.node._nodeInfo.areaInfo = res[1]
|
|
111
|
+
}))
|
|
112
|
+
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
141
113
|
}
|
|
142
114
|
|
|
143
|
-
build() {
|
|
144
|
-
TaroComponentWrapper({ node: this.node }) {
|
|
145
|
-
Video(this.getVideoData())
|
|
146
|
-
.attrs(getNormalAttributes(this.node))
|
|
147
|
-
.props(this.getVideoProps())
|
|
148
|
-
.defaultEvent()
|
|
149
|
-
.visibleChangeEvent()
|
|
150
|
-
.onStart(shouldBindEvent(() => { this.emitEvent('play') }, this.node, ['play']))
|
|
151
|
-
.onPause(shouldBindEvent(() => { this.emitEvent('pause') }, this.node, ['pause']))
|
|
152
|
-
.onFinish(shouldBindEvent(() => { this.emitEvent('ended') }, this.node, ['ended']))
|
|
153
|
-
.onError(shouldBindEvent(() => { this.emitEvent('error') }, this.node, ['error']))
|
|
154
|
-
.onUpdate((e) => { this.handleUpdate(e) })
|
|
155
|
-
.onPrepared(shouldBindEvent((e: TaroAny) => { this.emitEvent('loadedMetaData', { duration: e.duration }) }, this.node, ['loadedmetadata']))
|
|
156
|
-
.onSeeking(shouldBindEvent((e: TaroAny) => { this.emitEvent('seeking', { duration: e.time }) }, this.node, ['seeking']))
|
|
157
|
-
.onSeeked(shouldBindEvent(() => { this.emitEvent('seeked') }, this.node, ['seeked']))
|
|
158
|
-
.onFullscreenChange(shouldBindEvent((e: TaroAny) => { this.emitEvent('fullScreenChange', { fullScreen: e.fullscreen}) }, this.node, ['fullscreenchange']))
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
115
|
}
|
|
@@ -1,79 +1,73 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME } from '@tarojs/runtime'
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import commonStyleModify, { rowModify, columnModify } from './style'
|
|
4
|
+
import PseduoChildren from './pseudo'
|
|
5
5
|
import { TOUCH_EVENT_MAP } from './utils/constant/event'
|
|
6
|
-
import { FlexManager } from './utils/
|
|
7
|
-
import { getNodeThresholds,
|
|
6
|
+
import { FlexManager } from './utils/flexManager'
|
|
7
|
+
import { getNodeThresholds, shouldBindEvent } from './utils/helper'
|
|
8
8
|
|
|
9
|
-
import type { TaroViewElement,
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
@Extend(Flex)
|
|
13
|
-
function attrs (style: TaroStyleType) {
|
|
14
|
-
.id(style.id)
|
|
15
|
-
.key(style.id)
|
|
16
|
-
.padding(style.padding)
|
|
17
|
-
.margin(style.margin)
|
|
18
|
-
.width(style.width)
|
|
19
|
-
.height(style.height)
|
|
20
|
-
.constraintSize(style.constraintSize)
|
|
21
|
-
.flexGrow(style.flexGrow)
|
|
22
|
-
.flexShrink(style.flexShrink)
|
|
23
|
-
.flexBasis(style.flexBasis)
|
|
24
|
-
.alignSelf(style.alignSelf)
|
|
25
|
-
.backgroundColor(style.backgroundColor)
|
|
26
|
-
.backgroundImage(style.backgroundImage, style.backgroundRepeat)
|
|
27
|
-
.backgroundImageSize(style.backgroundImageSize)
|
|
28
|
-
.rotate(style.rotate)
|
|
29
|
-
.scale(style.scale)
|
|
30
|
-
.translate(style.translate)
|
|
31
|
-
.transform(style.transform)
|
|
32
|
-
.borderStyle(style.borderStyle)
|
|
33
|
-
.borderWidth(style.borderWidth)
|
|
34
|
-
.borderColor(style.borderColor)
|
|
35
|
-
.borderRadius(style.borderRadius)
|
|
36
|
-
.linearGradient(style.linearGradient)
|
|
37
|
-
.zIndex(style.zIndex)
|
|
38
|
-
.opacity(style.opacity)
|
|
39
|
-
.clip(style.clip)
|
|
40
|
-
}
|
|
9
|
+
import type { TaroViewElement, TaroAny } from '@tarojs/runtime'
|
|
10
|
+
import { isUndefined } from '@tarojs/shared'
|
|
41
11
|
|
|
42
12
|
@Component
|
|
43
13
|
export default struct TaroView {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
@Styles visibleChangeEvent () {
|
|
47
|
-
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
48
|
-
}
|
|
49
|
-
|
|
14
|
+
@Builder customBuilder() {}
|
|
15
|
+
@BuilderParam createLazyChildren: (node: TaroViewElement) => void = this.customBuilder
|
|
50
16
|
@ObjectLink node: TaroViewElement
|
|
17
|
+
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
51
18
|
|
|
52
|
-
aboutToAppear
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
bindAnimation(this.node)
|
|
19
|
+
aboutToAppear(): void {
|
|
20
|
+
if (this.node) {
|
|
21
|
+
this.node._instance = this
|
|
22
|
+
}
|
|
57
23
|
}
|
|
58
24
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
62
|
-
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, res => {
|
|
63
|
-
const eventResult: TaroAny = res.eventResult
|
|
64
|
-
this.nodeInfoMap[this.node._nid].areaInfo = eventResult[1]
|
|
65
|
-
}))
|
|
66
|
-
}
|
|
67
|
-
build() {
|
|
68
|
-
TaroComponentWrapper({ node: this.node }) {
|
|
25
|
+
build () {
|
|
26
|
+
if (FlexManager.useFlexLayout(this.node)) {
|
|
69
27
|
Flex(FlexManager.flexOptions(this.node)) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
28
|
+
if (this.node._pseudo_before || this.node._pseudo_after) {
|
|
29
|
+
PseduoChildren({ node: this.node, createLazyChildren: this.createLazyChildren })
|
|
30
|
+
} else {
|
|
31
|
+
this.createLazyChildren(this.node)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
.attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
35
|
+
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
36
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
37
|
+
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
38
|
+
this.node._nodeInfo.areaInfo = res[1]
|
|
39
|
+
}))
|
|
40
|
+
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
41
|
+
} else if (FlexManager.isFlexNode(this.node) && FlexManager.direction(this.node) !== FlexDirection.Column) {
|
|
42
|
+
Row() {
|
|
43
|
+
if (this.node._pseudo_before || this.node._pseudo_after) {
|
|
44
|
+
PseduoChildren({ node: this.node, createLazyChildren: this.createLazyChildren })
|
|
45
|
+
} else {
|
|
46
|
+
this.createLazyChildren(this.node)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
.attributeModifier(rowModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
50
|
+
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
51
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
52
|
+
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
53
|
+
this.node._nodeInfo.areaInfo = res[1]
|
|
54
|
+
}))
|
|
55
|
+
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
56
|
+
} else {
|
|
57
|
+
Column() {
|
|
58
|
+
if (this.node._pseudo_before || this.node._pseudo_after) {
|
|
59
|
+
PseduoChildren({ node: this.node, createLazyChildren: this.createLazyChildren })
|
|
60
|
+
} else {
|
|
61
|
+
this.createLazyChildren(this.node)
|
|
62
|
+
}
|
|
73
63
|
}
|
|
74
|
-
.
|
|
75
|
-
.
|
|
76
|
-
.
|
|
64
|
+
.attributeModifier(columnModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
65
|
+
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
66
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
67
|
+
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
68
|
+
this.node._nodeInfo.areaInfo = res[1]
|
|
69
|
+
}))
|
|
70
|
+
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
77
71
|
}
|
|
78
72
|
}
|
|
79
73
|
}
|