@tarojs/plugin-platform-harmony-ets 4.0.0-beta.53 → 4.0.0-beta.54
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TaroAny, HarmonyStyle, TaroElement, TaroStyleType, TaroTextElement } from '@tarojs/runtime'
|
|
2
2
|
import { ObjectAssign } from '@tarojs/runtime'
|
|
3
3
|
import { isUndefined } from '@tarojs/shared'
|
|
4
|
-
import { computeBackgroundPosition } from './utils'
|
|
4
|
+
import { computeBackgroundPosition, convertVp2Px } from './utils'
|
|
5
5
|
import { getNormalAttributes } from './utils/helper'
|
|
6
6
|
import { isMaxWidthView } from './utils/styles'
|
|
7
7
|
import { FlexManager } from './utils/flexManager.ets'
|
|
@@ -376,34 +376,15 @@ export function setNormalAttributeIntoInstance(instance: CommonAttribute, style:
|
|
|
376
376
|
// 为了适应position不设置z-index也能高于同层级组件,估且让设置了z-index的会更高一级
|
|
377
377
|
instance.zIndex(style.zIndex + 1)
|
|
378
378
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
// instance.scale({
|
|
389
|
-
// x: style.transform.Scale.x || 0,
|
|
390
|
-
// y: style.transform.Scale.y || 0,
|
|
391
|
-
// z: style.transform.Scale.z || 0,
|
|
392
|
-
// centerX: style.transformOrigin?.x || 0,
|
|
393
|
-
// centerY: style.transformOrigin?.y || 0,
|
|
394
|
-
// })
|
|
395
|
-
// }
|
|
396
|
-
// if (style.transform.Rotate) {
|
|
397
|
-
// instance.rotate({
|
|
398
|
-
// x: style.transform.Rotate.x || 0,
|
|
399
|
-
// y: style.transform.Rotate.y || 0,
|
|
400
|
-
// z: style.transform.Rotate.z || 0,
|
|
401
|
-
// centerX: style.transformOrigin?.x || 0,
|
|
402
|
-
// centerY: style.transformOrigin?.y || 0,
|
|
403
|
-
// angle: style.transform.Rotate.angle
|
|
404
|
-
// })
|
|
405
|
-
// }
|
|
406
|
-
// }
|
|
379
|
+
if (!isUndefined(style.boxShadow)) {
|
|
380
|
+
instance.shadow({
|
|
381
|
+
radius: convertVp2Px(style.boxShadow.radius),
|
|
382
|
+
color: style.boxShadow.color,
|
|
383
|
+
offsetX: convertVp2Px(style.boxShadow.offsetX),
|
|
384
|
+
offsetY: convertVp2Px(style.boxShadow.offsetY),
|
|
385
|
+
fill: style.boxShadow.fill,
|
|
386
|
+
})
|
|
387
|
+
}
|
|
407
388
|
}
|
|
408
389
|
|
|
409
390
|
export const pseudoModify = new PseudoStyleModify()
|
|
@@ -77,5 +77,28 @@ export default struct TaroSwiper {
|
|
|
77
77
|
this.node._nodeInfo.areaInfo = res[1]
|
|
78
78
|
}))
|
|
79
79
|
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
80
|
+
.onGestureSwipe(shouldBindEvent((index: number, extraInfo: SwiperAnimationEvent) => {
|
|
81
|
+
const currentOffset = extraInfo.currentOffset || 0
|
|
82
|
+
// 判断设置的滚动方向
|
|
83
|
+
const isVertical = this.node._attrs.vertical || false
|
|
84
|
+
let event: TaroEvent
|
|
85
|
+
if (isVertical) {
|
|
86
|
+
event = createTaroEvent('transition', { detail: { dx: 0, dy: currentOffset } }, this.node)
|
|
87
|
+
} else {
|
|
88
|
+
event = createTaroEvent('transition', { detail: { dx: currentOffset, dy: 0 } }, this.node)
|
|
89
|
+
}
|
|
90
|
+
eventHandler(event, 'transition', this.node)
|
|
91
|
+
}, this.node, ['transition']))
|
|
92
|
+
.onTouch(shouldBindEvent((event: TouchEvent) => {
|
|
93
|
+
if (event.type === TouchType.Down) {
|
|
94
|
+
eventHandler(event, 'touchStart', this.node)
|
|
95
|
+
}
|
|
96
|
+
if (event.type === TouchType.Up) {
|
|
97
|
+
eventHandler(event, 'touchEnd', this.node)
|
|
98
|
+
}
|
|
99
|
+
if (event.type === TouchType.Move) {
|
|
100
|
+
eventHandler(event, 'touchMove', this.node)
|
|
101
|
+
}
|
|
102
|
+
}, this.node, ['touchstart', 'touchmove', 'touchend']))
|
|
80
103
|
}
|
|
81
104
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isString } from '@tarojs/shared'
|
|
2
2
|
import { eventHandler, convertNumber2VP, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME, NodeType } from '@tarojs/runtime'
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import { textModify, setNormalTextAttributeIntoInstance } from './style'
|
|
5
5
|
import { getButtonColor } from './button'
|
|
6
6
|
import { getImageMode } from './image'
|
|
7
7
|
import { BUTTON_THEME_COLOR } from './utils/constant/style'
|
|
@@ -78,9 +78,32 @@ export default struct TaroText {
|
|
|
78
78
|
function createTextChildNode (item: TaroElement, align: ImageSpanAlignment) {
|
|
79
79
|
if (item.tagName === 'IMAGE') {
|
|
80
80
|
ImageSpan(item.getAttribute('src'))
|
|
81
|
-
.attributeModifier(commonStyleModify.setNode(item))
|
|
81
|
+
// .attributeModifier(commonStyleModify.setNode(item))
|
|
82
82
|
.objectFit(getImageMode(item.getAttribute('mode')))
|
|
83
83
|
.verticalAlign(align)
|
|
84
|
+
.width(item._st.hmStyle.width)
|
|
85
|
+
.height(item._st.hmStyle.height)
|
|
86
|
+
.margin({
|
|
87
|
+
top: item._st.hmStyle.marginTop,
|
|
88
|
+
left: item._st.hmStyle.marginLeft,
|
|
89
|
+
right: item._st.hmStyle.marginRight,
|
|
90
|
+
bottom: item._st.hmStyle.marginBottom,
|
|
91
|
+
})
|
|
92
|
+
.padding({
|
|
93
|
+
top: item._st.hmStyle.paddingTop,
|
|
94
|
+
left: item._st.hmStyle.paddingLeft,
|
|
95
|
+
right: item._st.hmStyle.paddingRight,
|
|
96
|
+
bottom: item._st.hmStyle.paddingBottom,
|
|
97
|
+
})
|
|
98
|
+
.textBackgroundStyle({
|
|
99
|
+
color: item._st.hmStyle.backgroundColor,
|
|
100
|
+
radius: {
|
|
101
|
+
topLeft: item._st.hmStyle.borderTopLeftRadius,
|
|
102
|
+
topRight: item._st.hmStyle.borderTopRightRadius,
|
|
103
|
+
bottomLeft: item._st.hmStyle.borderBottomLeftRadius,
|
|
104
|
+
bottomRight: item._st.hmStyle.borderBottomRightRadius,
|
|
105
|
+
}
|
|
106
|
+
})
|
|
84
107
|
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', item), item, ['click']))
|
|
85
108
|
} else if (item.nodeType === NodeType.TEXT_NODE) {
|
|
86
109
|
Span(item.textContent)
|
|
@@ -88,6 +111,15 @@ function createTextChildNode (item: TaroElement, align: ImageSpanAlignment) {
|
|
|
88
111
|
Span(item.textContent)
|
|
89
112
|
.attributeModifier(spanModify.setNode(item))
|
|
90
113
|
.letterSpacing(item._st.hmStyle.letterSpacing)
|
|
114
|
+
.textBackgroundStyle({
|
|
115
|
+
color: item._st.hmStyle.backgroundColor,
|
|
116
|
+
radius: {
|
|
117
|
+
topLeft: item._st.hmStyle.borderTopLeftRadius,
|
|
118
|
+
topRight: item._st.hmStyle.borderTopRightRadius,
|
|
119
|
+
bottomLeft: item._st.hmStyle.borderBottomLeftRadius,
|
|
120
|
+
bottomRight: item._st.hmStyle.borderBottomRightRadius,
|
|
121
|
+
}
|
|
122
|
+
})
|
|
91
123
|
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', item), item, ['click']))
|
|
92
124
|
}
|
|
93
125
|
}
|
|
@@ -113,6 +113,15 @@ export interface TaroStyleType {
|
|
|
113
113
|
animationDelay?: number
|
|
114
114
|
animationIterationCount?: number
|
|
115
115
|
|
|
116
|
+
// shadow
|
|
117
|
+
boxShadow?: {
|
|
118
|
+
radius: number
|
|
119
|
+
color?: string
|
|
120
|
+
offsetX?: number
|
|
121
|
+
offsetY?: number
|
|
122
|
+
fill?: boolean
|
|
123
|
+
}
|
|
124
|
+
|
|
116
125
|
// other
|
|
117
126
|
opacity?: number | Resource
|
|
118
127
|
zIndex?: number
|
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.54",
|
|
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/components": "4.0.0-beta.
|
|
29
|
-
"@tarojs/
|
|
30
|
-
"@tarojs/
|
|
31
|
-
"@tarojs/
|
|
32
|
-
"@tarojs/
|
|
33
|
-
"@tarojs/
|
|
34
|
-
"@tarojs/
|
|
28
|
+
"@tarojs/components": "4.0.0-beta.54",
|
|
29
|
+
"@tarojs/runner-utils": "4.0.0-beta.54",
|
|
30
|
+
"@tarojs/helper": "4.0.0-beta.54",
|
|
31
|
+
"@tarojs/runtime": "4.0.0-beta.54",
|
|
32
|
+
"@tarojs/service": "4.0.0-beta.54",
|
|
33
|
+
"@tarojs/shared": "4.0.0-beta.54",
|
|
34
|
+
"@tarojs/taro": "4.0.0-beta.54"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"solid-js": "^1.8.16",
|
|
45
45
|
"tslib": "^2.4.0",
|
|
46
46
|
"typescript": "^4.8.2",
|
|
47
|
-
"rollup-plugin-copy": "4.0.0-beta.
|
|
47
|
+
"rollup-plugin-copy": "4.0.0-beta.54"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"prebuild": "rimraf ./dist",
|