@tarojs/plugin-platform-harmony-ets 4.0.0-beta.74 → 4.0.0-beta.75
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/media/image/index.ts +1 -1
- package/dist/apis/ui/pull-down-refresh.ts +9 -3
- package/dist/apis/ui/scroll/index.ts +5 -5
- package/dist/apis/ui/tab-bar.ts +3 -3
- package/dist/apis/wxml/selectorQuery.ts +2 -2
- package/dist/components-harmony-ets/label.ets +2 -2
- package/dist/components-harmony-ets/movableView.ets +19 -1
- package/dist/runtime-ets/dom/document.ts +3 -3
- package/dist/runtime-utils.js +18 -12
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +18 -12
- package/dist/runtime.js.map +1 -1
- package/package.json +9 -9
|
@@ -112,7 +112,7 @@ export const chooseImage: typeof Taro.chooseImage = function (options) {
|
|
|
112
112
|
photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE // 过滤选择媒体文件类型为IMAGE
|
|
113
113
|
|
|
114
114
|
photoViewPicker.select(photoSelectOptions).then((photoSelectResult) => {
|
|
115
|
-
callAsyncSuccess(resolve, { tempFilePaths: photoSelectResult.photoUris })
|
|
115
|
+
callAsyncSuccess(resolve, { tempFilePaths: photoSelectResult.photoUris }, options)
|
|
116
116
|
}).catch((error) => {
|
|
117
117
|
callAsyncFail(reject, error, options)
|
|
118
118
|
})
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { Current } from '@tarojs/runtime'
|
|
2
2
|
|
|
3
|
-
import { callAsyncSuccess } from '../utils'
|
|
3
|
+
import { callAsyncFail, callAsyncSuccess } from '../utils'
|
|
4
4
|
|
|
5
5
|
import type Taro from '@tarojs/taro/types'
|
|
6
6
|
|
|
7
7
|
export const startPullDownRefresh: typeof Taro.startPullDownRefresh = function (options) {
|
|
8
|
-
return new Promise(resolve => {
|
|
8
|
+
return new Promise((resolve, reject) => {
|
|
9
9
|
const taro = (Current as any).taro
|
|
10
10
|
const page = taro.getCurrentInstance().page
|
|
11
11
|
|
|
12
|
+
if (!page) {
|
|
13
|
+
return callAsyncFail(reject, { errMsg: 'stopPullDownRefresh:fail' }, options)
|
|
14
|
+
}
|
|
12
15
|
if (page.isRefreshing instanceof Array) {
|
|
13
16
|
const index = page.tabBarCurrentIndex || 0
|
|
14
17
|
page.isRefreshing[index] = true
|
|
@@ -23,10 +26,13 @@ export const startPullDownRefresh: typeof Taro.startPullDownRefresh = function (
|
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
export const stopPullDownRefresh: typeof Taro.stopPullDownRefresh = function (options) {
|
|
26
|
-
return new Promise(resolve => {
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
27
30
|
const taro = (Current as any).taro
|
|
28
31
|
const page = taro.getCurrentInstance().page
|
|
29
32
|
|
|
33
|
+
if (!page) {
|
|
34
|
+
return callAsyncFail(reject, { errMsg: 'stopPullDownRefresh:fail' }, options)
|
|
35
|
+
}
|
|
30
36
|
if (page.isRefreshing instanceof Array) {
|
|
31
37
|
const index = page.tabBarCurrentIndex || 0
|
|
32
38
|
page.isRefreshing[index] = false
|
|
@@ -34,8 +34,8 @@ export const pageScrollTo: typeof Taro.pageScrollTo = (options) => {
|
|
|
34
34
|
const page = taro.getCurrentInstance().page
|
|
35
35
|
|
|
36
36
|
let scrollValue = -1
|
|
37
|
-
let scroller = getPageScrollerOrNode(page
|
|
38
|
-
const currentPageNode = getPageScrollerOrNode(page
|
|
37
|
+
let scroller = getPageScrollerOrNode(page?.scroller, page)
|
|
38
|
+
const currentPageNode = getPageScrollerOrNode(page?.node, page)
|
|
39
39
|
|
|
40
40
|
if (scrollTop || typeof scrollTop === 'number') {
|
|
41
41
|
scrollValue = scrollTop
|
|
@@ -66,14 +66,14 @@ export const pageScrollTo: typeof Taro.pageScrollTo = (options) => {
|
|
|
66
66
|
scrollValue = areaInfo.globalPosition.y + yOffset + pxTransformHelper(offsetTop, 'px', true)
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (scrollValue === -1) {
|
|
69
|
+
if (!scroller || scrollValue === -1) {
|
|
72
70
|
return handle.fail({
|
|
73
71
|
errMsg: '请检查传入的 scrollTop 或 selector 是否合法'
|
|
74
72
|
}, { resolve, reject })
|
|
75
73
|
}
|
|
76
74
|
|
|
75
|
+
const { xOffset } = scroller.currentOffset()
|
|
76
|
+
|
|
77
77
|
try {
|
|
78
78
|
scroller.scrollTo({
|
|
79
79
|
xOffset,
|
package/dist/apis/ui/tab-bar.ts
CHANGED
|
@@ -22,7 +22,7 @@ const toggleTabBar = function<T extends ToggleAPIs['type']> (type: T): Extract<T
|
|
|
22
22
|
return new Promise((resolve, reject) => {
|
|
23
23
|
const taro = (Current as any).taro
|
|
24
24
|
const page = taro.getCurrentInstance().page
|
|
25
|
-
const currentData = page
|
|
25
|
+
const currentData = page?._data?.taroTabBar || page?.tabBar
|
|
26
26
|
const res = { errMsg: `${type}TabBar:ok` }
|
|
27
27
|
const error = { errMsg: `${type}TabBar:fail not TabBar page` }
|
|
28
28
|
|
|
@@ -49,7 +49,7 @@ export const setTabBarStyle: typeof Taro.setTabBarStyle = function (options = {}
|
|
|
49
49
|
return new Promise((resolve, reject) => {
|
|
50
50
|
const taro = (Current as any).taro
|
|
51
51
|
const page = taro.getCurrentInstance().page
|
|
52
|
-
const currentData = page
|
|
52
|
+
const currentData = page?._data?.taroTabBar || page?.tabBar
|
|
53
53
|
const res = { errMsg: 'setTabBarStyle:ok' }
|
|
54
54
|
const error = { errMsg: 'setTabBarStyle:fail not TabBar page' }
|
|
55
55
|
|
|
@@ -74,7 +74,7 @@ export const setTabBarItem: typeof Taro.setTabBarItem = function (options) {
|
|
|
74
74
|
return new Promise((resolve, reject) => {
|
|
75
75
|
const taro = (Current as any).taro
|
|
76
76
|
const page = taro.getCurrentInstance().page
|
|
77
|
-
const currentData = page
|
|
77
|
+
const currentData = page?._data?.taroTabBar || page?.tabBar
|
|
78
78
|
const res = { errMsg: 'setTabBarItem:ok' }
|
|
79
79
|
const error = { errMsg: 'setTabBarItem:fail not TabBar page' }
|
|
80
80
|
|
|
@@ -192,9 +192,9 @@ function queryBat (queue, cb) {
|
|
|
192
192
|
const result: any = []
|
|
193
193
|
const taro = (Current as any).taro
|
|
194
194
|
const page = taro.getCurrentInstance().page
|
|
195
|
-
const element = getPageScrollerOrNode(page
|
|
195
|
+
const element = getPageScrollerOrNode(page?.node, page)
|
|
196
196
|
|
|
197
|
-
if (element
|
|
197
|
+
if (!element) return null
|
|
198
198
|
|
|
199
199
|
arr = []
|
|
200
200
|
traversalDFSDom(element)
|
|
@@ -12,8 +12,8 @@ import { isUndefined } from '@tarojs/shared'
|
|
|
12
12
|
function handleTargetChange (id: string) {
|
|
13
13
|
const taro: TaroAny = Current.taro
|
|
14
14
|
const page: TaroAny = taro.getCurrentInstance().page
|
|
15
|
-
const currentPageNode: TaroElement = getPageScrollerOrNode(page
|
|
16
|
-
const node: TaroElement | null = currentPageNode
|
|
15
|
+
const currentPageNode: TaroElement = getPageScrollerOrNode(page?.node, page)
|
|
16
|
+
const node: TaroElement | null = currentPageNode?.getElementById(id)
|
|
17
17
|
|
|
18
18
|
if (!node) return
|
|
19
19
|
|
|
@@ -47,7 +47,7 @@ export default struct TaroMovableView {
|
|
|
47
47
|
.visibility(this.node.visibility)
|
|
48
48
|
.gesture(
|
|
49
49
|
GestureGroup(GestureMode.Parallel,
|
|
50
|
-
PanGesture(
|
|
50
|
+
PanGesture(getPanOption(this.node)).onActionStart((e: GestureEvent) => {
|
|
51
51
|
|
|
52
52
|
this.node.startMove()
|
|
53
53
|
this.node.callTouchEventFnFromGesture('touchstart', e)
|
|
@@ -71,3 +71,21 @@ export default struct TaroMovableView {
|
|
|
71
71
|
)
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
function getPanOption(node: TaroMovableViewElement) {
|
|
77
|
+
const attrDirection = node.getAttribute('direction')
|
|
78
|
+
let panDirection = PanDirection.All
|
|
79
|
+
|
|
80
|
+
if(node.getAttribute('disabled')) {
|
|
81
|
+
panDirection = PanDirection.None
|
|
82
|
+
} else if(attrDirection === 'horizontal') {
|
|
83
|
+
panDirection = PanDirection.Horizontal
|
|
84
|
+
} else if (attrDirection === 'vertical') {
|
|
85
|
+
panDirection = PanDirection.Vertical
|
|
86
|
+
}
|
|
87
|
+
return new PanGestureOptions({
|
|
88
|
+
direction: panDirection,
|
|
89
|
+
fingers: 1
|
|
90
|
+
})
|
|
91
|
+
}
|
|
@@ -69,9 +69,9 @@ class TaroDocument extends TaroNode {
|
|
|
69
69
|
public querySelector (selectors: string): TaroElement | null {
|
|
70
70
|
const taro = (Current as any).taro
|
|
71
71
|
const page = taro.getCurrentInstance().page
|
|
72
|
-
const element = getPageScrollerOrNode(page
|
|
72
|
+
const element = getPageScrollerOrNode(page?.node, page)
|
|
73
73
|
|
|
74
|
-
if (element
|
|
74
|
+
if (!element) return null
|
|
75
75
|
|
|
76
76
|
return findChildNodeWithDFS(element, selectors)
|
|
77
77
|
}
|
|
@@ -79,7 +79,7 @@ class TaroDocument extends TaroNode {
|
|
|
79
79
|
public querySelectorAll (selectors: string): TaroElement[] {
|
|
80
80
|
const taro = (Current as any).taro
|
|
81
81
|
const page = taro.getCurrentInstance().page
|
|
82
|
-
const element = getPageScrollerOrNode(page
|
|
82
|
+
const element = getPageScrollerOrNode(page?.node, page)
|
|
83
83
|
|
|
84
84
|
if (element == null) return []
|
|
85
85
|
|
package/dist/runtime-utils.js
CHANGED
|
@@ -2352,7 +2352,7 @@ const chooseImage = function (options) {
|
|
|
2352
2352
|
photoSelectOptions.maxSelectNumber = count; // 选择媒体文件的最大数目
|
|
2353
2353
|
photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; // 过滤选择媒体文件类型为IMAGE
|
|
2354
2354
|
photoViewPicker.select(photoSelectOptions).then((photoSelectResult) => {
|
|
2355
|
-
callAsyncSuccess(resolve, { tempFilePaths: photoSelectResult.photoUris });
|
|
2355
|
+
callAsyncSuccess(resolve, { tempFilePaths: photoSelectResult.photoUris }, options);
|
|
2356
2356
|
}).catch((error) => {
|
|
2357
2357
|
callAsyncFail(reject, error, options);
|
|
2358
2358
|
});
|
|
@@ -3817,10 +3817,13 @@ const hideHomeButton = function (options) {
|
|
|
3817
3817
|
};
|
|
3818
3818
|
|
|
3819
3819
|
const startPullDownRefresh = function (options) {
|
|
3820
|
-
return new Promise(resolve => {
|
|
3820
|
+
return new Promise((resolve, reject) => {
|
|
3821
3821
|
var _a;
|
|
3822
3822
|
const taro = Current.taro;
|
|
3823
3823
|
const page = taro.getCurrentInstance().page;
|
|
3824
|
+
if (!page) {
|
|
3825
|
+
return callAsyncFail(reject, { errMsg: 'stopPullDownRefresh:fail' }, options);
|
|
3826
|
+
}
|
|
3824
3827
|
if (page.isRefreshing instanceof Array) {
|
|
3825
3828
|
const index = page.tabBarCurrentIndex || 0;
|
|
3826
3829
|
page.isRefreshing[index] = true;
|
|
@@ -3834,10 +3837,13 @@ const startPullDownRefresh = function (options) {
|
|
|
3834
3837
|
});
|
|
3835
3838
|
};
|
|
3836
3839
|
const stopPullDownRefresh = function (options) {
|
|
3837
|
-
return new Promise(resolve => {
|
|
3840
|
+
return new Promise((resolve, reject) => {
|
|
3838
3841
|
var _a;
|
|
3839
3842
|
const taro = Current.taro;
|
|
3840
3843
|
const page = taro.getCurrentInstance().page;
|
|
3844
|
+
if (!page) {
|
|
3845
|
+
return callAsyncFail(reject, { errMsg: 'stopPullDownRefresh:fail' }, options);
|
|
3846
|
+
}
|
|
3841
3847
|
if (page.isRefreshing instanceof Array) {
|
|
3842
3848
|
const index = page.tabBarCurrentIndex || 0;
|
|
3843
3849
|
page.isRefreshing[index] = false;
|
|
@@ -3870,8 +3876,8 @@ const pageScrollTo = (options) => {
|
|
|
3870
3876
|
const taro = Current.taro;
|
|
3871
3877
|
const page = taro.getCurrentInstance().page;
|
|
3872
3878
|
let scrollValue = -1;
|
|
3873
|
-
let scroller = getPageScrollerOrNode(page.scroller, page);
|
|
3874
|
-
const currentPageNode = getPageScrollerOrNode(page.node, page);
|
|
3879
|
+
let scroller = getPageScrollerOrNode(page === null || page === void 0 ? void 0 : page.scroller, page);
|
|
3880
|
+
const currentPageNode = getPageScrollerOrNode(page === null || page === void 0 ? void 0 : page.node, page);
|
|
3875
3881
|
if (scrollTop || typeof scrollTop === 'number') {
|
|
3876
3882
|
scrollValue = scrollTop;
|
|
3877
3883
|
}
|
|
@@ -3896,12 +3902,12 @@ const pageScrollTo = (options) => {
|
|
|
3896
3902
|
scrollValue = areaInfo.globalPosition.y + yOffset + pxTransformHelper$1(offsetTop, 'px', true);
|
|
3897
3903
|
}
|
|
3898
3904
|
}
|
|
3899
|
-
|
|
3900
|
-
if (scrollValue === -1) {
|
|
3905
|
+
if (!scroller || scrollValue === -1) {
|
|
3901
3906
|
return handle.fail({
|
|
3902
3907
|
errMsg: '请检查传入的 scrollTop 或 selector 是否合法'
|
|
3903
3908
|
}, { resolve, reject });
|
|
3904
3909
|
}
|
|
3910
|
+
const { xOffset } = scroller.currentOffset();
|
|
3905
3911
|
try {
|
|
3906
3912
|
scroller.scrollTo({
|
|
3907
3913
|
xOffset,
|
|
@@ -3933,7 +3939,7 @@ const toggleTabBar = function (type) {
|
|
|
3933
3939
|
var _a, _b;
|
|
3934
3940
|
const taro = Current.taro;
|
|
3935
3941
|
const page = taro.getCurrentInstance().page;
|
|
3936
|
-
const currentData = ((_a = page._data) === null || _a === void 0 ? void 0 : _a.taroTabBar) || page.tabBar;
|
|
3942
|
+
const currentData = ((_a = page === null || page === void 0 ? void 0 : page._data) === null || _a === void 0 ? void 0 : _a.taroTabBar) || (page === null || page === void 0 ? void 0 : page.tabBar);
|
|
3937
3943
|
const res = { errMsg: `${type}TabBar:ok` };
|
|
3938
3944
|
const error = { errMsg: `${type}TabBar:fail not TabBar page` };
|
|
3939
3945
|
if (!currentData) {
|
|
@@ -3958,7 +3964,7 @@ const setTabBarStyle = function (options = {}) {
|
|
|
3958
3964
|
var _a, _b;
|
|
3959
3965
|
const taro = Current.taro;
|
|
3960
3966
|
const page = taro.getCurrentInstance().page;
|
|
3961
|
-
const currentData = ((_a = page._data) === null || _a === void 0 ? void 0 : _a.taroTabBar) || page.tabBar;
|
|
3967
|
+
const currentData = ((_a = page === null || page === void 0 ? void 0 : page._data) === null || _a === void 0 ? void 0 : _a.taroTabBar) || (page === null || page === void 0 ? void 0 : page.tabBar);
|
|
3962
3968
|
const res = { errMsg: 'setTabBarStyle:ok' };
|
|
3963
3969
|
const error = { errMsg: 'setTabBarStyle:fail not TabBar page' };
|
|
3964
3970
|
if (!currentData) {
|
|
@@ -3985,7 +3991,7 @@ const setTabBarItem = function (options) {
|
|
|
3985
3991
|
var _a, _b;
|
|
3986
3992
|
const taro = Current.taro;
|
|
3987
3993
|
const page = taro.getCurrentInstance().page;
|
|
3988
|
-
const currentData = ((_a = page._data) === null || _a === void 0 ? void 0 : _a.taroTabBar) || page.tabBar;
|
|
3994
|
+
const currentData = ((_a = page === null || page === void 0 ? void 0 : page._data) === null || _a === void 0 ? void 0 : _a.taroTabBar) || (page === null || page === void 0 ? void 0 : page.tabBar);
|
|
3989
3995
|
const res = { errMsg: 'setTabBarItem:ok' };
|
|
3990
3996
|
const error = { errMsg: 'setTabBarItem:fail not TabBar page' };
|
|
3991
3997
|
if (!currentData) {
|
|
@@ -4361,8 +4367,8 @@ function queryBat(queue, cb) {
|
|
|
4361
4367
|
const result = [];
|
|
4362
4368
|
const taro = Current.taro;
|
|
4363
4369
|
const page = taro.getCurrentInstance().page;
|
|
4364
|
-
const element = getPageScrollerOrNode(page.node, page);
|
|
4365
|
-
if (element
|
|
4370
|
+
const element = getPageScrollerOrNode(page === null || page === void 0 ? void 0 : page.node, page);
|
|
4371
|
+
if (!element)
|
|
4366
4372
|
return null;
|
|
4367
4373
|
arr = [];
|
|
4368
4374
|
traversalDFSDom(element);
|