@tarojs/plugin-platform-harmony-ets 4.0.0-beta.4 → 4.0.0-beta.5
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/components-harmony-ets/scrollView.ets +33 -3
- package/dist/components-harmony-ets/utils/flexManager.ets +2 -1
- package/dist/components-harmony-ets/utils/styles.ets +1 -0
- package/dist/components-harmony-ets/view.ets +24 -2
- package/package.json +8 -8
- package/dist/runtime-ets/utils/bind.ts +0 -24
|
@@ -2,10 +2,11 @@ import { eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBL
|
|
|
2
2
|
|
|
3
3
|
import commonStyleModify from './style'
|
|
4
4
|
import { createLazyChildren } from './render'
|
|
5
|
+
import { FlexManager } from './utils/FlexManager'
|
|
5
6
|
import { TOUCH_EVENT_MAP } from './utils/constant/event'
|
|
6
7
|
import { getNodeThresholds, getNormalAttributes, shouldBindEvent } from './utils/helper'
|
|
7
8
|
|
|
8
|
-
import type { TaroAny, TaroScrollViewElement, TaroEvent } from '@tarojs/runtime'
|
|
9
|
+
import type { TaroAny, TaroStyleType, TaroScrollViewElement, TaroEvent } from '@tarojs/runtime'
|
|
9
10
|
|
|
10
11
|
interface ScrollViewAttrs {
|
|
11
12
|
scrollBar: BarState
|
|
@@ -56,6 +57,26 @@ function handleScrollEvent (node: TaroScrollViewElement, eventName = 'scroll', x
|
|
|
56
57
|
eventHandler(event, eventName, node)
|
|
57
58
|
}
|
|
58
59
|
|
|
60
|
+
@Extend(Row)
|
|
61
|
+
function rowAttrs (style: TaroStyleType) {
|
|
62
|
+
.constraintSize({
|
|
63
|
+
minWidth: style.minWidth || style.width,
|
|
64
|
+
maxWidth: style.maxWidth,
|
|
65
|
+
minHeight: style.minHeight,
|
|
66
|
+
maxHeight: style.maxHeight
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@Extend(Column)
|
|
71
|
+
function columnAttrs (style: TaroStyleType) {
|
|
72
|
+
.constraintSize({
|
|
73
|
+
minWidth: style.minWidth,
|
|
74
|
+
maxWidth: style.maxWidth,
|
|
75
|
+
minHeight: style.minHeight || style.height,
|
|
76
|
+
maxHeight: style.maxHeight
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
|
|
59
80
|
@Builder
|
|
60
81
|
export default function TaroScrollView (node: TaroScrollViewElement) {
|
|
61
82
|
Scroll(node.scroller) {
|
|
@@ -63,26 +84,35 @@ export default function TaroScrollView (node: TaroScrollViewElement) {
|
|
|
63
84
|
Row() {
|
|
64
85
|
createLazyChildren(node)
|
|
65
86
|
}
|
|
66
|
-
.width(null)
|
|
67
87
|
.attributeModifier(commonStyleModify.setNode(node))
|
|
88
|
+
.rowAttrs(getNormalAttributes(node))
|
|
89
|
+
.width(null)
|
|
68
90
|
.onAreaChange(shouldBindEvent((_: Area, areaResult: Area) => {
|
|
69
91
|
node._scroll = areaResult
|
|
70
92
|
}, node, ['scroll', 'scrollstart', 'scrollend']))
|
|
93
|
+
.alignItems(FlexManager.flexOptions(node).alignItems as VerticalAlign)
|
|
94
|
+
.justifyContent(FlexManager.flexOptions(node).justifyContent)
|
|
95
|
+
.flexGrow(0).flexShrink(0)
|
|
71
96
|
} else {
|
|
72
97
|
Column() {
|
|
73
98
|
createLazyChildren(node)
|
|
74
99
|
}
|
|
75
|
-
.height(null)
|
|
76
100
|
.attributeModifier(commonStyleModify.setNode(node))
|
|
101
|
+
.columnAttrs(getNormalAttributes(node))
|
|
102
|
+
.height(null)
|
|
77
103
|
.alignItems(HorizontalAlign.Start)
|
|
78
104
|
.onAreaChange(shouldBindEvent((_: Area, areaResult: Area) => {
|
|
79
105
|
node._scroll = areaResult
|
|
80
106
|
}, node, ['scroll', 'scrollstart', 'scrollend']))
|
|
107
|
+
.alignItems(FlexManager.flexOptions(node).alignItems as HorizontalAlign)
|
|
108
|
+
.justifyContent(FlexManager.flexOptions(node).justifyContent)
|
|
109
|
+
.flexGrow(0).flexShrink(0)
|
|
81
110
|
}
|
|
82
111
|
}
|
|
83
112
|
.width(getNormalAttributes(node).width)
|
|
84
113
|
.height(getNormalAttributes(node).height)
|
|
85
114
|
.flexGrow(getNormalAttributes(node).flexGrow)
|
|
115
|
+
.flexShrink(getNormalAttributes(node).flexShrink)
|
|
86
116
|
.scrollable(getScrollable(node))
|
|
87
117
|
.scrollBar(getAttributes(node).scrollBar)
|
|
88
118
|
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', node), node, ['click']))
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TaroElement } from '@tarojs/runtime'
|
|
2
|
+
import { isUndefined } from '@tarojs/shared'
|
|
2
3
|
|
|
3
4
|
interface IFlexOptions {
|
|
4
5
|
direction: FlexDirection,
|
|
@@ -39,7 +40,7 @@ class FlexManager {
|
|
|
39
40
|
static flexOptions (node: TaroElement): IFlexOptions {
|
|
40
41
|
const hmStyle = node.hmStyle
|
|
41
42
|
const isFlex = FlexManager.isFlexNode(node)
|
|
42
|
-
const justifyContent: FlexAlign = isFlex ? (hmStyle.justifyContent
|
|
43
|
+
const justifyContent: FlexAlign = isFlex ? (isUndefined(hmStyle.justifyContent) ? FlexAlign.Start : hmStyle.justifyContent) : FlexAlign.Start
|
|
43
44
|
|
|
44
45
|
let flexDirection = hmStyle.flexDirection
|
|
45
46
|
if (!flexDirection && flexDirection !== 0) {
|
|
@@ -4,9 +4,29 @@ import commonStyleModify from './style'
|
|
|
4
4
|
import { createLazyChildren } from './render'
|
|
5
5
|
import { TOUCH_EVENT_MAP } from './utils/constant/event'
|
|
6
6
|
import { FlexManager } from './utils/FlexManager'
|
|
7
|
-
import { getNodeThresholds, shouldBindEvent } from './utils/helper'
|
|
7
|
+
import { getNodeThresholds, getNormalAttributes, shouldBindEvent } from './utils/helper'
|
|
8
8
|
|
|
9
|
-
import type { TaroViewElement, TaroAny } from '@tarojs/runtime'
|
|
9
|
+
import type { TaroViewElement, TaroStyleType, TaroAny } from '@tarojs/runtime'
|
|
10
|
+
|
|
11
|
+
@Extend(Row)
|
|
12
|
+
function rowAttrs (style: TaroStyleType) {
|
|
13
|
+
.constraintSize({
|
|
14
|
+
minWidth: style.minWidth || style.width,
|
|
15
|
+
maxWidth: style.maxWidth,
|
|
16
|
+
minHeight: style.minHeight,
|
|
17
|
+
maxHeight: style.maxHeight
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@Extend(Column)
|
|
22
|
+
function columnAttrs (style: TaroStyleType) {
|
|
23
|
+
.constraintSize({
|
|
24
|
+
minWidth: style.minWidth,
|
|
25
|
+
maxWidth: style.maxWidth,
|
|
26
|
+
minHeight: style.minHeight || style.height,
|
|
27
|
+
maxHeight: style.maxHeight
|
|
28
|
+
})
|
|
29
|
+
}
|
|
10
30
|
|
|
11
31
|
@Builder
|
|
12
32
|
export default function TaroView (node: TaroViewElement) {
|
|
@@ -15,6 +35,7 @@ export default function TaroView (node: TaroViewElement) {
|
|
|
15
35
|
createLazyChildren(node)
|
|
16
36
|
}
|
|
17
37
|
.attributeModifier(commonStyleModify.setNode(node))
|
|
38
|
+
.rowAttrs(getNormalAttributes(node))
|
|
18
39
|
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', node), node, ['click']))
|
|
19
40
|
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), node), node, TOUCH_EVENT_MAP.values()))
|
|
20
41
|
.onAreaChange(getComponentEventCallback(node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
@@ -28,6 +49,7 @@ export default function TaroView (node: TaroViewElement) {
|
|
|
28
49
|
createLazyChildren(node)
|
|
29
50
|
}
|
|
30
51
|
.attributeModifier(commonStyleModify.setNode(node))
|
|
52
|
+
.columnAttrs(getNormalAttributes(node))
|
|
31
53
|
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', node), node, ['click']))
|
|
32
54
|
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), node), node, TOUCH_EVENT_MAP.values()))
|
|
33
55
|
.onAreaChange(getComponentEventCallback(node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/plugin-platform-harmony-ets",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.5",
|
|
4
4
|
"description": "OpenHarmony & 鸿蒙系统插件",
|
|
5
5
|
"author": "O2Team",
|
|
6
6
|
"homepage": "https://gitee.com/openharmony-sig/taro",
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"webpack-sources": "^3.2.3",
|
|
28
|
-
"@tarojs/
|
|
29
|
-
"@tarojs/
|
|
30
|
-
"@tarojs/
|
|
31
|
-
"@tarojs/
|
|
32
|
-
"@tarojs/
|
|
33
|
-
"@tarojs/
|
|
34
|
-
"@tarojs/
|
|
28
|
+
"@tarojs/helper": "4.0.0-beta.5",
|
|
29
|
+
"@tarojs/runner-utils": "4.0.0-beta.5",
|
|
30
|
+
"@tarojs/service": "4.0.0-beta.5",
|
|
31
|
+
"@tarojs/shared": "4.0.0-beta.5",
|
|
32
|
+
"@tarojs/runtime": "4.0.0-beta.5",
|
|
33
|
+
"@tarojs/taro": "4.0.0-beta.5",
|
|
34
|
+
"@tarojs/components": "4.0.0-beta.5"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@rollup/plugin-commonjs": "^20.0.0",
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { bindAttributesCallback } from './info'
|
|
2
|
-
|
|
3
|
-
import type { TaroElement } from '../dom/element/element'
|
|
4
|
-
|
|
5
|
-
// function convertToCamelCase(str) {
|
|
6
|
-
// return str.replace(/-(.)/g, (_, char) => char.toUpperCase()).replace(/^\w/, firstChar => firstChar.toUpperCase())
|
|
7
|
-
// }
|
|
8
|
-
|
|
9
|
-
export function bindScrollTo (node: TaroElement) {
|
|
10
|
-
bindAttributesCallback(node, 'scrollTo', () => {
|
|
11
|
-
node.scroller.scrollTo({
|
|
12
|
-
xOffset: node._attrs.scrollLeft || 0,
|
|
13
|
-
yOffset: node._attrs.scrollTop || 0,
|
|
14
|
-
})
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function bindFocus (node: TaroElement) {
|
|
19
|
-
bindAttributesCallback(node, 'focus', () => {
|
|
20
|
-
// TODO: ETS转TS
|
|
21
|
-
// focusControl.requestFocus(node._nid)
|
|
22
|
-
})
|
|
23
|
-
}
|
|
24
|
-
|