@tarojs/plugin-platform-harmony-ets 4.0.0-beta.27 → 4.0.0-beta.29
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/wxml/IntersectionObserver.ts +4 -4
- package/dist/components-harmony-ets/button.ets +4 -2
- package/dist/runtime-ets/dom/document.ts +1 -0
- package/dist/runtime-ets/dom/element/element.ts +19 -1
- package/dist/runtime-ets/utils/index.ts +0 -19
- package/dist/runtime-utils.js +4 -8
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +4 -8
- package/dist/runtime.js.map +1 -1
- package/package.json +9 -9
|
@@ -30,14 +30,14 @@ export class IntersectionObserver implements Taro.IntersectionObserver {
|
|
|
30
30
|
this._observerNodes.forEach((n: TaroElement & any) => {
|
|
31
31
|
disconnectEvent(n, VISIBLE_CHANGE_EVENT_NAME)
|
|
32
32
|
// @ts-ignore
|
|
33
|
-
n._nodeInfo
|
|
33
|
+
n._nodeInfo.thresholds = null
|
|
34
34
|
})
|
|
35
35
|
} else {
|
|
36
36
|
disconnectEvent(this._observerNodes, VISIBLE_CHANGE_EVENT_NAME)
|
|
37
37
|
// @ts-ignore
|
|
38
38
|
if (this._observerNodes._nodeInfo) {
|
|
39
39
|
// @ts-ignore
|
|
40
|
-
this._observerNodes._nodeInfo
|
|
40
|
+
this._observerNodes._nodeInfo.thresholds = null
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -54,7 +54,7 @@ export class IntersectionObserver implements Taro.IntersectionObserver {
|
|
|
54
54
|
if (node instanceof Array) {
|
|
55
55
|
node.forEach(n => {
|
|
56
56
|
// @ts-ignore
|
|
57
|
-
n._nodeInfo
|
|
57
|
+
n._nodeInfo.thresholds = thresholds
|
|
58
58
|
|
|
59
59
|
setNodeEventCallbackAndTriggerComponentUpdate(n, VISIBLE_CHANGE_EVENT_NAME, (isVisible: boolean, currentRatio: number) => {
|
|
60
60
|
callback(this.handleResult(isVisible, currentRatio, n))
|
|
@@ -62,7 +62,7 @@ export class IntersectionObserver implements Taro.IntersectionObserver {
|
|
|
62
62
|
})
|
|
63
63
|
} else {
|
|
64
64
|
// @ts-ignore
|
|
65
|
-
node._nodeInfo
|
|
65
|
+
node._nodeInfo.thresholds = thresholds
|
|
66
66
|
|
|
67
67
|
setNodeEventCallbackAndTriggerComponentUpdate(node, VISIBLE_CHANGE_EVENT_NAME, (isVisible: boolean, currentRatio: number) => {
|
|
68
68
|
callback(this.handleResult(isVisible, currentRatio, node))
|
|
@@ -109,12 +109,14 @@ export default struct TaroButton {
|
|
|
109
109
|
build() {
|
|
110
110
|
if (this.node?.hmStyle?.display !== 'none') {
|
|
111
111
|
Button({ stateEffect: !this.node._attrs.disabled }) {
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
if (this.node._attrs.loading) {
|
|
113
|
+
Row() {
|
|
114
114
|
LoadingProgress()
|
|
115
115
|
.width(20).height(20)
|
|
116
116
|
.color(getThemeAttributes(this.node).color)
|
|
117
|
+
this.createLazyChildren(this.node)
|
|
117
118
|
}
|
|
119
|
+
} else {
|
|
118
120
|
this.createLazyChildren(this.node)
|
|
119
121
|
}
|
|
120
122
|
}
|
|
@@ -188,7 +188,7 @@ export class TaroElement<
|
|
|
188
188
|
return this._style
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
//
|
|
191
|
+
// 伪元素,不存在style动态设置,均已被转换为鸿蒙样式
|
|
192
192
|
// 可根据实际情况,迁移到具体的组件中,如View、ScrollView中,Text\Image其实是不需要的
|
|
193
193
|
public _pseudo_before: StyleSheet | null = null
|
|
194
194
|
|
|
@@ -219,4 +219,22 @@ export class TaroElement<
|
|
|
219
219
|
this._pseudo_after = null
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
+
|
|
223
|
+
// 伪类,在获取的时候根据dom和parent的关系,动态设置
|
|
224
|
+
public _pseudo_class: Record<string, StyleSheet | null> = {
|
|
225
|
+
// ["::first-child"]: new StyleSheet(),
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
public set_pseudo_class(name: string, value: HarmonyStyle | null) {
|
|
229
|
+
if (value) {
|
|
230
|
+
if (!this._pseudo_class[name]) {
|
|
231
|
+
this._pseudo_class[name] = new StyleSheet()
|
|
232
|
+
}
|
|
233
|
+
Object.keys(value).forEach(key => {
|
|
234
|
+
this._pseudo_class[name]!.hmStyle[key] = value[key]
|
|
235
|
+
})
|
|
236
|
+
} else {
|
|
237
|
+
this._pseudo_class[name] = null
|
|
238
|
+
}
|
|
239
|
+
}
|
|
222
240
|
}
|
|
@@ -38,25 +38,6 @@ export function convertNumber2PX (value: number) {
|
|
|
38
38
|
return pxTransformHelper(value, 'vp')
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
// 全局的变量内容
|
|
42
|
-
export const globalCss = {
|
|
43
|
-
map: {}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Css变量的var方法
|
|
47
|
-
export function __var_fn(value: string | (() => string), ...rest: any[]) {
|
|
48
|
-
if (typeof value === 'function') {
|
|
49
|
-
const res = value()
|
|
50
|
-
return typeof res !== 'undefined' ? res : (rest && (rest instanceof Array ? __var_fn.apply(null, rest) : __var_fn(rest)))
|
|
51
|
-
}
|
|
52
|
-
return typeof value !== 'undefined' ? value: (rest && (rest instanceof Array ? __var_fn.apply(null, rest) : __var_fn(rest)))
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Css变量的var方法,延迟获取变量
|
|
56
|
-
export function __lazy_var_fn(fn, ...rest: any[]) {
|
|
57
|
-
return () => (fn() || __var_fn.apply(null, rest))
|
|
58
|
-
}
|
|
59
|
-
|
|
60
41
|
export function convertNumber2VP (value: number, unit = 'px') {
|
|
61
42
|
if (unit === 'vw' || unit === 'vh') {
|
|
62
43
|
return (value / 100 * (unit === 'vw' ? display.width: display.height)) + 'px'
|
package/dist/runtime-utils.js
CHANGED
|
@@ -4009,14 +4009,12 @@ class IntersectionObserver {
|
|
|
4009
4009
|
Object.assign(this._options, options);
|
|
4010
4010
|
}
|
|
4011
4011
|
disconnect() {
|
|
4012
|
-
var _a;
|
|
4013
4012
|
if (this._observerNodes && this._component) {
|
|
4014
4013
|
if (this._observerNodes instanceof Array) {
|
|
4015
4014
|
this._observerNodes.forEach((n) => {
|
|
4016
|
-
var _a;
|
|
4017
4015
|
disconnectEvent(n, VISIBLE_CHANGE_EVENT_NAME);
|
|
4018
4016
|
// @ts-ignore
|
|
4019
|
-
|
|
4017
|
+
n._nodeInfo.thresholds = null;
|
|
4020
4018
|
});
|
|
4021
4019
|
}
|
|
4022
4020
|
else {
|
|
@@ -4024,13 +4022,12 @@ class IntersectionObserver {
|
|
|
4024
4022
|
// @ts-ignore
|
|
4025
4023
|
if (this._observerNodes._nodeInfo) {
|
|
4026
4024
|
// @ts-ignore
|
|
4027
|
-
|
|
4025
|
+
this._observerNodes._nodeInfo.thresholds = null;
|
|
4028
4026
|
}
|
|
4029
4027
|
}
|
|
4030
4028
|
}
|
|
4031
4029
|
}
|
|
4032
4030
|
observe(targetSelector, callback) {
|
|
4033
|
-
var _a;
|
|
4034
4031
|
if (!this._component)
|
|
4035
4032
|
return;
|
|
4036
4033
|
const { observeAll, thresholds } = this._options;
|
|
@@ -4039,9 +4036,8 @@ class IntersectionObserver {
|
|
|
4039
4036
|
if (node) {
|
|
4040
4037
|
if (node instanceof Array) {
|
|
4041
4038
|
node.forEach(n => {
|
|
4042
|
-
var _a;
|
|
4043
4039
|
// @ts-ignore
|
|
4044
|
-
|
|
4040
|
+
n._nodeInfo.thresholds = thresholds;
|
|
4045
4041
|
setNodeEventCallbackAndTriggerComponentUpdate(n, VISIBLE_CHANGE_EVENT_NAME, (isVisible, currentRatio) => {
|
|
4046
4042
|
callback(this.handleResult(isVisible, currentRatio, n));
|
|
4047
4043
|
});
|
|
@@ -4049,7 +4045,7 @@ class IntersectionObserver {
|
|
|
4049
4045
|
}
|
|
4050
4046
|
else {
|
|
4051
4047
|
// @ts-ignore
|
|
4052
|
-
|
|
4048
|
+
node._nodeInfo.thresholds = thresholds;
|
|
4053
4049
|
setNodeEventCallbackAndTriggerComponentUpdate(node, VISIBLE_CHANGE_EVENT_NAME, (isVisible, currentRatio) => {
|
|
4054
4050
|
callback(this.handleResult(isVisible, currentRatio, node));
|
|
4055
4051
|
});
|