@tarojs/plugin-platform-harmony-ets 4.0.0-alpha.3 → 4.0.0-alpha.31
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/base/system.ts +73 -20
- package/dist/apis/canvas/index.ts +10 -1
- package/dist/apis/device/clipboard.ts +16 -8
- package/dist/apis/framework/index.ts +1 -5
- package/dist/apis/index.ts +25 -17
- package/dist/apis/media/image/index.ts +207 -44
- package/dist/apis/storage/index.ts +146 -78
- package/dist/apis/ui/animation/animation.ts +71 -29
- package/dist/apis/ui/background.ts +2 -1
- package/dist/apis/ui/interaction/index.ts +42 -59
- package/dist/apis/ui/navigation-bar/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/utils/index.ts +20 -2
- package/dist/apis/utils/permissions.ts +6 -0
- package/dist/apis/wxml/IntersectionObserver.ts +18 -10
- package/dist/apis/wxml/selectorQuery.ts +26 -13
- package/dist/components-harmony-ets/button.ets +64 -34
- package/dist/components-harmony-ets/canvas.ets +51 -0
- package/dist/components-harmony-ets/checkbox.ets +73 -62
- package/dist/components-harmony-ets/form.ets +51 -29
- package/dist/components-harmony-ets/icon.ets +31 -19
- package/dist/components-harmony-ets/image.ets +34 -14
- package/dist/components-harmony-ets/index.ets +92 -0
- package/dist/components-harmony-ets/innerHtml.ets +11 -6
- package/dist/components-harmony-ets/input.ets +63 -41
- package/dist/components-harmony-ets/label.ets +71 -44
- package/dist/components-harmony-ets/listView.ets +31 -0
- package/dist/components-harmony-ets/movableArea.ets +126 -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 +43 -39
- 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 +78 -68
- package/dist/components-harmony-ets/richText.ets +14 -30
- package/dist/components-harmony-ets/scrollList.ets +103 -0
- package/dist/components-harmony-ets/scrollView.ets +61 -57
- package/dist/components-harmony-ets/slider.ets +19 -15
- package/dist/components-harmony-ets/stickySection.ets +42 -0
- package/dist/components-harmony-ets/style.ets +386 -130
- package/dist/components-harmony-ets/swiper.ets +61 -20
- package/dist/components-harmony-ets/switch.ets +36 -32
- package/dist/components-harmony-ets/{index.ts → tag.ts} +6 -0
- package/dist/components-harmony-ets/text.ets +112 -50
- package/dist/components-harmony-ets/textArea.ets +50 -35
- package/dist/components-harmony-ets/utils/AttributeManager.ets +2 -2
- package/dist/components-harmony-ets/utils/DynamicCenter.ts +2 -2
- package/dist/components-harmony-ets/utils/flexManager.ets +49 -19
- package/dist/components-harmony-ets/utils/helper.ets +20 -8
- 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 +54 -50
- package/dist/components-harmony-ets/utils/styles.ets +172 -93
- package/dist/components-harmony-ets/video.ets +34 -21
- package/dist/components-harmony-ets/view.ets +63 -52
- package/dist/components-harmony-ets/webView.ets +40 -34
- package/dist/index.d.ts +152 -0
- package/dist/index.js +102 -56
- 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 +7 -0
- package/dist/runtime-ets/current.ts +5 -1
- package/dist/runtime-ets/dom/bind.ts +28 -12
- package/dist/runtime-ets/dom/class-list.ts +2 -2
- package/dist/runtime-ets/dom/cssNesting.ts +419 -0
- package/dist/runtime-ets/dom/cssStyleDeclaration.ts +28 -42
- package/dist/runtime-ets/dom/document.ts +8 -11
- package/dist/runtime-ets/dom/element/canvas.ts +136 -0
- package/dist/runtime-ets/dom/element/element.ts +376 -57
- package/dist/runtime-ets/dom/element/form.ts +31 -26
- package/dist/runtime-ets/dom/element/index.ts +30 -2
- package/dist/runtime-ets/dom/element/movableArea.ts +11 -0
- package/dist/runtime-ets/dom/element/movableView.ts +244 -0
- package/dist/runtime-ets/dom/element/normal.ts +35 -8
- package/dist/runtime-ets/dom/element/progress.ts +11 -0
- package/dist/runtime-ets/dom/element/scrollView.ts +1 -0
- package/dist/runtime-ets/dom/element/text.ts +1 -8
- package/dist/runtime-ets/dom/element/video.ts +5 -4
- package/dist/runtime-ets/dom/element/webView.ts +12 -5
- package/dist/runtime-ets/dom/event.ts +3 -5
- package/dist/runtime-ets/dom/eventTarget.ts +2 -3
- package/dist/runtime-ets/dom/node.ts +65 -32
- package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +418 -237
- package/dist/runtime-ets/dom/stylesheet/index.ts +29 -311
- package/dist/runtime-ets/dom/stylesheet/type.ts +53 -11
- package/dist/runtime-ets/dom/stylesheet/util.ts +33 -27
- package/dist/runtime-ets/index.ts +2 -1
- package/dist/runtime-ets/interface/event.ts +1 -1
- package/dist/runtime-ets/utils/index.ts +74 -13
- package/dist/runtime-ets/utils/info.ts +2 -2
- package/dist/runtime-framework/react/app.ts +15 -10
- package/dist/runtime-framework/react/hooks.ts +0 -1
- package/dist/runtime-framework/react/index.ts +0 -2
- package/dist/runtime-framework/react/native-page.ts +185 -78
- package/dist/runtime-framework/react/page.ts +4 -9
- package/dist/runtime-framework/react/utils/index.ts +3 -3
- package/dist/runtime-framework/solid/app.ts +30 -46
- package/dist/runtime-framework/solid/connect.ts +21 -3
- package/dist/runtime-framework/solid/hooks.ts +16 -11
- package/dist/runtime-framework/solid/index.ts +6 -2
- package/dist/runtime-framework/solid/page.ts +85 -31
- 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 +3 -5
- package/dist/runtime-utils.d.ts +827 -0
- package/dist/runtime-utils.js +652 -283
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +652 -283
- package/dist/runtime.js.map +1 -1
- package/index.js +3 -1
- package/package.json +14 -15
- package/static/media/cancel.svg +1 -1
- package/static/media/circle.svg +1 -1
- package/static/media/clear.svg +1 -1
- package/static/media/download.svg +1 -1
- package/static/media/info.svg +1 -1
- package/static/media/info_circle.svg +1 -1
- package/static/media/search.svg +1 -1
- package/static/media/success.svg +1 -1
- package/static/media/success_no_circle.svg +1 -1
- package/static/media/warn.svg +1 -1
- package/types/harmony.d.ts +5 -0
- package/types/index.d.ts +4 -0
- package/types/runtime.d.ts +1 -1
- /package/dist/runtime-framework/solid/{contant.ts → constant.ts} +0 -0
|
@@ -3,114 +3,181 @@
|
|
|
3
3
|
* https://developer.harmonyos.com/cn/docs/documentation/doc-references-V3/js-apis-data-preferences-0000001427745052-V3
|
|
4
4
|
*/
|
|
5
5
|
import bundleManager from '@ohos.bundle.bundleManager'
|
|
6
|
-
import
|
|
7
|
-
import hilog from '@ohos.hilog'
|
|
6
|
+
import distributedKVStore from '@ohos.data.distributedKVStore'
|
|
8
7
|
import { Current } from '@tarojs/runtime'
|
|
9
8
|
|
|
10
|
-
import {
|
|
9
|
+
import { temporarilyNotSupport, validateParams } from '../utils'
|
|
10
|
+
import { MethodHandler } from '../utils/handler'
|
|
11
11
|
|
|
12
12
|
import type Taro from '@tarojs/taro/types'
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})
|
|
14
|
+
let context
|
|
15
|
+
let kvManager: distributedKVStore.KVManager
|
|
16
|
+
let kvStore: distributedKVStore.SingleKVStore
|
|
17
|
+
let kvStorePromise: Promise<void>
|
|
18
|
+
|
|
19
|
+
(Current as any).contextPromise.then((ctx) => {
|
|
20
|
+
context = ctx
|
|
21
|
+
const kvManagerConfig: distributedKVStore.KVManagerConfig = {
|
|
22
|
+
context: context,
|
|
23
|
+
bundleName: 'com.example.taro'
|
|
24
|
+
}
|
|
26
25
|
|
|
27
|
-
async function getItem (key: string): Promise<{ result: boolean, data?: number | string | boolean }> {
|
|
28
26
|
try {
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
// 创建KVManager实例
|
|
28
|
+
kvManager = distributedKVStore.createKVManager(kvManagerConfig)
|
|
29
|
+
// 继续创建获取数据库
|
|
30
|
+
const options: distributedKVStore.Options = {
|
|
31
|
+
createIfMissing: true,
|
|
32
|
+
encrypt: false,
|
|
33
|
+
backup: false,
|
|
34
|
+
autoSync: false,
|
|
35
|
+
// kvStoreType不填时,默认创建多设备协同数据库
|
|
36
|
+
kvStoreType: distributedKVStore.KVStoreType.SINGLE_VERSION,
|
|
37
|
+
// 多设备协同数据库:kvStoreType: distributedKVStore.KVStoreType.DEVICE_COLLABORATION,
|
|
38
|
+
securityLevel: distributedKVStore.SecurityLevel.S1
|
|
39
|
+
}
|
|
31
40
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
const data = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION)
|
|
42
|
+
kvStorePromise = new Promise(resolve => {
|
|
43
|
+
kvManager.getKVStore<distributedKVStore.SingleKVStore>(`${data.appInfo.uid}Store`, options, (err, store: distributedKVStore.SingleKVStore) => {
|
|
44
|
+
if (err) {
|
|
45
|
+
console.error(`Failed to get KVStore: Code:${err.code},message:${err.message}`)
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
kvStore = store
|
|
49
|
+
// 请确保获取到键值数据库实例后,再进行相关数据操作
|
|
50
|
+
resolve()
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
} catch (e) {
|
|
54
|
+
console.error(`Failed to create KVManager. Code:${e.code},message:${e.message}`)
|
|
35
55
|
}
|
|
36
|
-
|
|
56
|
+
|
|
57
|
+
return context
|
|
58
|
+
})
|
|
37
59
|
|
|
38
60
|
const storageSchema = {
|
|
39
61
|
key: 'String'
|
|
40
62
|
}
|
|
41
63
|
|
|
64
|
+
function checkContextExist (api: string, isAsync = false) {
|
|
65
|
+
if (!context) {
|
|
66
|
+
const message = `${api} 调用失败,Taro 不支持过早地调用 ${api},请确保页面已经渲染完成再调用此 API`
|
|
67
|
+
if (isAsync) {
|
|
68
|
+
return {
|
|
69
|
+
isExist: false,
|
|
70
|
+
error: Promise.reject(new Error(message))
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
console.warn(message)
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
isExist: false,
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
isExist: true,
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
42
86
|
export function getStorage<T = any> (options: Taro.getStorage.Option<T>) {
|
|
87
|
+
const name = 'getStorage'
|
|
88
|
+
const { isExist, error } = checkContextExist(name, true)
|
|
89
|
+
|
|
90
|
+
if (!isExist) {
|
|
91
|
+
return error
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const { key, success, fail, complete } = options || {}
|
|
95
|
+
const handle = new MethodHandler<{data: any}>({ name, success, fail, complete })
|
|
96
|
+
|
|
43
97
|
return new Promise((resolve, reject) => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
getItem(options.key).then(({ result, data }) => {
|
|
51
|
-
const res: Record<string, any> = { errMsg: 'getStorage:ok' }
|
|
52
|
-
|
|
53
|
-
if (result) {
|
|
54
|
-
res.data = data
|
|
55
|
-
callAsyncSuccess(resolve, res, options)
|
|
56
|
-
} else {
|
|
57
|
-
res.errMsg = 'getStorage:fail data not found'
|
|
58
|
-
callAsyncFail(reject, res, options)
|
|
98
|
+
kvStorePromise.then(() => {
|
|
99
|
+
try {
|
|
100
|
+
validateParams(name, options, storageSchema)
|
|
101
|
+
} catch (error) {
|
|
102
|
+
const res = { errMsg: error.message }
|
|
103
|
+
return handle.fail(res, { resolve, reject })
|
|
59
104
|
}
|
|
105
|
+
|
|
106
|
+
kvStore = kvStore as distributedKVStore.SingleKVStore
|
|
107
|
+
kvStore.get(key, (err, data) => {
|
|
108
|
+
if (err) {
|
|
109
|
+
handle.fail({ errMsg: `Failed to get data. Code:${err.code},message:${err.message}` }, { resolve, reject })
|
|
110
|
+
return
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
handle.success({ data }, { resolve, reject })
|
|
114
|
+
})
|
|
60
115
|
})
|
|
61
116
|
})
|
|
62
117
|
}
|
|
63
118
|
|
|
64
119
|
export function setStorage (options: Taro.setStorage.Option) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
120
|
+
const name = 'setStorage'
|
|
121
|
+
const { isExist, error } = checkContextExist(name, true)
|
|
122
|
+
|
|
123
|
+
if (!isExist) {
|
|
124
|
+
return error
|
|
125
|
+
}
|
|
72
126
|
|
|
73
|
-
|
|
74
|
-
|
|
127
|
+
const { key, data, success, fail, complete } = options || {}
|
|
128
|
+
const handle = new MethodHandler({ name, success, fail, complete })
|
|
129
|
+
|
|
130
|
+
return new Promise((resolve, reject) => {
|
|
131
|
+
kvStorePromise.then(() => {
|
|
132
|
+
try {
|
|
133
|
+
validateParams(name, options, storageSchema)
|
|
134
|
+
} catch (error) {
|
|
135
|
+
const res = { errMsg: error.message }
|
|
136
|
+
return handle.fail(res, { resolve, reject })
|
|
137
|
+
}
|
|
75
138
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
139
|
+
kvStore = kvStore as distributedKVStore.SingleKVStore
|
|
140
|
+
kvStore.put(key, data, (err) => {
|
|
141
|
+
if (err) {
|
|
142
|
+
handle.fail({ errMsg: `Failed to put data. Code:${err.code},message:${err.message}` }, { resolve, reject })
|
|
143
|
+
return
|
|
144
|
+
}
|
|
79
145
|
|
|
80
|
-
|
|
146
|
+
handle.success({}, { resolve, reject })
|
|
147
|
+
})
|
|
81
148
|
})
|
|
82
149
|
})
|
|
83
150
|
}
|
|
84
151
|
|
|
85
152
|
export function removeStorage (options: Taro.removeStorage.Option) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
validateParams('removeStorage', options, storageSchema)
|
|
89
|
-
} catch (error) {
|
|
90
|
-
const res = { errMsg: error.message }
|
|
91
|
-
return callAsyncFail(reject, res, options)
|
|
92
|
-
}
|
|
153
|
+
const name = 'removeStorage'
|
|
154
|
+
const { isExist, error } = checkContextExist(name, true)
|
|
93
155
|
|
|
94
|
-
|
|
156
|
+
if (!isExist) {
|
|
157
|
+
return error
|
|
158
|
+
}
|
|
95
159
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
await preferences.flush()
|
|
160
|
+
const { key, success, fail, complete } = options || {}
|
|
161
|
+
const handle = new MethodHandler({ name, success, fail, complete })
|
|
99
162
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
163
|
+
return new Promise((resolve, reject) => {
|
|
164
|
+
kvStorePromise.then(() => {
|
|
165
|
+
try {
|
|
166
|
+
validateParams(name, options, storageSchema)
|
|
167
|
+
} catch (error) {
|
|
168
|
+
const res = { errMsg: error.message }
|
|
169
|
+
return handle.fail(res, { resolve, reject })
|
|
170
|
+
}
|
|
105
171
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
172
|
+
kvStore = kvStore as distributedKVStore.SingleKVStore
|
|
173
|
+
kvStore.delete(key, (err) => {
|
|
174
|
+
if (err) {
|
|
175
|
+
handle.fail({ errMsg: `Failed to delete data. Code:${err.code},message:${err.message}` }, { resolve, reject })
|
|
176
|
+
return
|
|
177
|
+
}
|
|
111
178
|
|
|
112
|
-
|
|
113
|
-
|
|
179
|
+
handle.success({}, { resolve, reject })
|
|
180
|
+
})
|
|
114
181
|
})
|
|
115
182
|
})
|
|
116
183
|
}
|
|
@@ -118,11 +185,6 @@ export function clearStorage (options: Taro.clearStorage.Option) {
|
|
|
118
185
|
export const getStorageInfoSync = temporarilyNotSupport('getStorageInfoSync')
|
|
119
186
|
export const getStorageInfo = temporarilyNotSupport('getStorageInfo')
|
|
120
187
|
|
|
121
|
-
export const getStorageSync = temporarilyNotSupport('getStorageSync', 'getStorage')
|
|
122
|
-
export const setStorageSync = temporarilyNotSupport('setStorageSync', 'setStorage')
|
|
123
|
-
export const clearStorageSync = temporarilyNotSupport('clearStorageSync', 'clearStorage')
|
|
124
|
-
export const removeStorageSync = temporarilyNotSupport('removeStorageSync', 'removeStorage')
|
|
125
|
-
|
|
126
188
|
export const createBufferURL = /* @__PURE__ */ temporarilyNotSupport('createBufferURL')
|
|
127
189
|
export const revokeBufferURL = /* @__PURE__ */ temporarilyNotSupport('revokeBufferURL')
|
|
128
190
|
|
|
@@ -131,5 +193,11 @@ export const batchSetStorage = /* @__PURE__ */ temporarilyNotSupport('batchSetSt
|
|
|
131
193
|
export const batchGetStorageSync = /* @__PURE__ */ temporarilyNotSupport('batchGetStorageSync')
|
|
132
194
|
export const batchGetStorage = /* @__PURE__ */ temporarilyNotSupport('batchGetStorage')
|
|
133
195
|
|
|
196
|
+
export const clearStorage = temporarilyNotSupport('clearStorage')
|
|
197
|
+
export const getStorageSync = temporarilyNotSupport('getStorageSync', 'getStorage')
|
|
198
|
+
export const setStorageSync = temporarilyNotSupport('setStorageSync', 'setStorage')
|
|
199
|
+
export const clearStorageSync = temporarilyNotSupport('clearStorageSync', 'clearStorage')
|
|
200
|
+
export const removeStorageSync = temporarilyNotSupport('removeStorageSync', 'removeStorage')
|
|
201
|
+
|
|
134
202
|
export * from './background-fetch'
|
|
135
203
|
export * from './cache-manager'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import matrix4 from '@ohos.matrix4'
|
|
2
|
+
import { isUndefined } from '@tarojs/shared'
|
|
2
3
|
|
|
3
4
|
import { temporarilyNotSupport } from '../../utils'
|
|
4
5
|
|
|
@@ -22,7 +23,6 @@ type TStep = {
|
|
|
22
23
|
type TRule = Record<string, any>
|
|
23
24
|
|
|
24
25
|
export class Animation implements Taro.Animation {
|
|
25
|
-
|
|
26
26
|
unit: string
|
|
27
27
|
DEFAULT: IAnimationAttr
|
|
28
28
|
|
|
@@ -71,6 +71,9 @@ export class Animation implements Taro.Animation {
|
|
|
71
71
|
transformOrigin,
|
|
72
72
|
rule: Object.assign({}, this.rule)
|
|
73
73
|
})
|
|
74
|
+
if (this.rule.transform) {
|
|
75
|
+
this.rule.transform = Object.assign({}, this.rule.transform)
|
|
76
|
+
}
|
|
74
77
|
return this
|
|
75
78
|
}
|
|
76
79
|
|
|
@@ -85,92 +88,137 @@ export class Animation implements Taro.Animation {
|
|
|
85
88
|
}
|
|
86
89
|
|
|
87
90
|
rotate (angle: number): Taro.Animation {
|
|
88
|
-
this.rule.
|
|
91
|
+
if (!this.rule.transform) {
|
|
92
|
+
this.rule.transform = {}
|
|
93
|
+
}
|
|
94
|
+
this.rule.transform.Rotate = { x: 0, y: 0, z: 1, angle }
|
|
89
95
|
return this
|
|
90
96
|
}
|
|
91
97
|
|
|
92
98
|
rotate3d (x: number, y?: number | undefined, z?: number | undefined, angle?: number | undefined): Taro.Animation {
|
|
93
|
-
this.rule.
|
|
99
|
+
if (!this.rule.transform) {
|
|
100
|
+
this.rule.transform = {}
|
|
101
|
+
}
|
|
102
|
+
this.rule.transform.Rotate = { x, y, z, angle }
|
|
94
103
|
return this
|
|
95
104
|
}
|
|
96
105
|
|
|
97
106
|
rotateX (angle: number): Taro.Animation {
|
|
98
|
-
this.rule.
|
|
107
|
+
if (!this.rule.transform) {
|
|
108
|
+
this.rule.transform = {}
|
|
109
|
+
}
|
|
110
|
+
this.rule.transform.Rotate = { x: 1, y: 0, z: 0, angle }
|
|
99
111
|
return this
|
|
100
112
|
}
|
|
101
113
|
|
|
102
114
|
rotateY (angle: number): Taro.Animation {
|
|
103
|
-
this.rule.
|
|
115
|
+
if (!this.rule.transform) {
|
|
116
|
+
this.rule.transform = {}
|
|
117
|
+
}
|
|
118
|
+
this.rule.transform.Rotate = { x: 0, y: 1, z: 0, angle }
|
|
104
119
|
return this
|
|
105
120
|
}
|
|
106
121
|
|
|
107
122
|
rotateZ (angle: number): Taro.Animation {
|
|
108
|
-
this.rule.
|
|
123
|
+
if (!this.rule.transform) {
|
|
124
|
+
this.rule.transform = {}
|
|
125
|
+
}
|
|
126
|
+
this.rule.transform.Rotate = { x: 0, y: 0, z: 1, angle }
|
|
109
127
|
return this
|
|
110
128
|
}
|
|
111
129
|
|
|
112
130
|
scale (sx: number, sy?: number | undefined): Taro.Animation {
|
|
113
|
-
this.rule.
|
|
131
|
+
if (!this.rule.transform) {
|
|
132
|
+
this.rule.transform = {}
|
|
133
|
+
}
|
|
134
|
+
this.rule.transform.Scale = { x: sx, y: isUndefined(sy) ? sx : sy }
|
|
114
135
|
return this
|
|
115
136
|
}
|
|
116
137
|
|
|
117
138
|
scale3d (sx: number, sy: number, sz: number): Taro.Animation {
|
|
118
|
-
this.rule.
|
|
139
|
+
if (!this.rule.transform) {
|
|
140
|
+
this.rule.transform = {}
|
|
141
|
+
}
|
|
142
|
+
this.rule.transform.Scale = { x: sx, y: sy, z: sz }
|
|
119
143
|
return this
|
|
120
144
|
}
|
|
121
145
|
|
|
122
146
|
scaleX (scale: number): Taro.Animation {
|
|
123
|
-
this.rule.
|
|
147
|
+
if (!this.rule.transform) {
|
|
148
|
+
this.rule.transform = {}
|
|
149
|
+
}
|
|
150
|
+
this.rule.transform.Scale = { x: scale }
|
|
124
151
|
return this
|
|
125
152
|
}
|
|
126
153
|
|
|
127
154
|
scaleY (scale: number): Taro.Animation {
|
|
128
|
-
this.rule.
|
|
155
|
+
if (!this.rule.transform) {
|
|
156
|
+
this.rule.transform = {}
|
|
157
|
+
}
|
|
158
|
+
this.rule.transform.Scale = { y: scale }
|
|
129
159
|
return this
|
|
130
160
|
}
|
|
131
161
|
|
|
132
162
|
scaleZ (scale: number): Taro.Animation {
|
|
133
|
-
this.rule.
|
|
163
|
+
if (!this.rule.transform) {
|
|
164
|
+
this.rule.transform = {}
|
|
165
|
+
}
|
|
166
|
+
this.rule.transform.Scale = { z: scale }
|
|
134
167
|
return this
|
|
135
168
|
}
|
|
136
169
|
|
|
137
170
|
skew (ax: number, ay: number): Taro.Animation {
|
|
138
|
-
|
|
171
|
+
temporarilyNotSupport('animation.skew:' + `${ax}, ${ay}`)(ax, ay)
|
|
139
172
|
return this
|
|
140
173
|
}
|
|
141
174
|
|
|
142
175
|
skewX (angle: number): Taro.Animation {
|
|
143
|
-
|
|
176
|
+
temporarilyNotSupport('animation.skewX:' + angle)(angle)
|
|
144
177
|
return this
|
|
145
178
|
}
|
|
146
179
|
|
|
147
180
|
skewY (angle: number): Taro.Animation {
|
|
148
|
-
|
|
181
|
+
temporarilyNotSupport('animation.skewY:' + angle)(angle)
|
|
149
182
|
return this
|
|
150
183
|
}
|
|
151
184
|
|
|
152
185
|
translate (tx?: number | undefined, ty?: number | undefined): Taro.Animation {
|
|
153
|
-
this.rule.
|
|
186
|
+
if (!this.rule.transform) {
|
|
187
|
+
this.rule.transform = {}
|
|
188
|
+
}
|
|
189
|
+
this.rule.transform.Translate = { x: tx, y: ty }
|
|
154
190
|
return this
|
|
155
191
|
}
|
|
156
192
|
|
|
157
193
|
translate3d (tx?: number | undefined, ty?: number | undefined, tz?: number | undefined): Taro.Animation {
|
|
158
|
-
this.rule.
|
|
194
|
+
if (!this.rule.transform) {
|
|
195
|
+
this.rule.transform = {}
|
|
196
|
+
}
|
|
197
|
+
this.rule.transform.Translate = { x: tx, y: ty, z: tz }
|
|
159
198
|
return this
|
|
160
199
|
}
|
|
161
200
|
|
|
162
201
|
translateX (translation: number): Taro.Animation {
|
|
163
|
-
this.rule.
|
|
202
|
+
if (!this.rule.transform) {
|
|
203
|
+
this.rule.transform = {}
|
|
204
|
+
}
|
|
205
|
+
this.rule.transform.Translate = { x: translation }
|
|
164
206
|
return this
|
|
165
207
|
}
|
|
166
208
|
|
|
167
209
|
translateY (translation: number): Taro.Animation {
|
|
168
|
-
this.rule.
|
|
210
|
+
if (!this.rule.transform) {
|
|
211
|
+
this.rule.transform = {}
|
|
212
|
+
}
|
|
213
|
+
this.rule.transform.Translate = { y: translation }
|
|
169
214
|
return this
|
|
170
215
|
}
|
|
171
216
|
|
|
172
217
|
translateZ (translation: number): Taro.Animation {
|
|
173
|
-
this.rule.
|
|
218
|
+
if (!this.rule.transform) {
|
|
219
|
+
this.rule.transform = {}
|
|
220
|
+
}
|
|
221
|
+
this.rule.transform.Translate = { z: translation }
|
|
174
222
|
return this
|
|
175
223
|
}
|
|
176
224
|
|
|
@@ -185,23 +233,17 @@ export class Animation implements Taro.Animation {
|
|
|
185
233
|
}
|
|
186
234
|
|
|
187
235
|
width (value: string | number): Taro.Animation {
|
|
188
|
-
this.rule.
|
|
189
|
-
...this.rule.size,
|
|
190
|
-
width: value
|
|
191
|
-
}
|
|
236
|
+
this.rule.width = value
|
|
192
237
|
return this
|
|
193
238
|
}
|
|
194
239
|
|
|
195
240
|
height (value: string | number): Taro.Animation {
|
|
196
|
-
this.rule.
|
|
197
|
-
...this.rule.size,
|
|
198
|
-
height: value
|
|
199
|
-
}
|
|
241
|
+
this.rule.height = value
|
|
200
242
|
return this
|
|
201
243
|
}
|
|
202
244
|
|
|
203
245
|
left (value: string | number): Taro.Animation {
|
|
204
|
-
|
|
246
|
+
this.rule.left = value
|
|
205
247
|
return this
|
|
206
248
|
}
|
|
207
249
|
|
|
@@ -211,7 +253,7 @@ export class Animation implements Taro.Animation {
|
|
|
211
253
|
}
|
|
212
254
|
|
|
213
255
|
top (value: string | number): Taro.Animation {
|
|
214
|
-
|
|
256
|
+
this.rule.top = value
|
|
215
257
|
return this
|
|
216
258
|
}
|
|
217
259
|
|
|
@@ -11,7 +11,8 @@ export function setBackgroundColor(options: Taro.setBackgroundColor.Option) {
|
|
|
11
11
|
|
|
12
12
|
return new Promise((resolve, reject) => {
|
|
13
13
|
eventCenter.trigger('__taroPageStyle', {
|
|
14
|
-
backgroundColor: options.
|
|
14
|
+
backgroundColor: options.backgroundColorBottom || options.backgroundColor,
|
|
15
|
+
backgroundColorContext: options.backgroundColorTop || options.backgroundColor
|
|
15
16
|
})
|
|
16
17
|
|
|
17
18
|
return handle.success({}, { resolve, reject })
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import promptAction from '@ohos.promptAction'
|
|
2
2
|
|
|
3
3
|
import { callAsyncFail, callAsyncSuccess, temporarilyNotSupport, validateParams } from '../../utils'
|
|
4
4
|
|
|
@@ -29,10 +29,11 @@ export function showToast (options) {
|
|
|
29
29
|
return callAsyncFail(reject, res, options)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
promptAction.showToast({
|
|
33
33
|
message: options.title,
|
|
34
34
|
duration: options.duration,
|
|
35
|
-
bottom: options.bottom
|
|
35
|
+
bottom: options.bottom,
|
|
36
|
+
showMode: 1 // 设置弹窗显示模式,显示在应用之上。
|
|
36
37
|
})
|
|
37
38
|
callAsyncSuccess(resolve, resCallback('showToast'), options)
|
|
38
39
|
})
|
|
@@ -72,37 +73,20 @@ export function showModal (options) {
|
|
|
72
73
|
})
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
return new Promise(resolve => {
|
|
76
|
+
return new Promise((resolve, reject) => {
|
|
76
77
|
const modalOptions = {
|
|
77
78
|
title,
|
|
78
79
|
message: content,
|
|
79
80
|
buttons: buttons,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
},
|
|
90
|
-
options
|
|
91
|
-
)
|
|
92
|
-
} else {
|
|
93
|
-
callAsyncSuccess(
|
|
94
|
-
resolve,
|
|
95
|
-
{
|
|
96
|
-
...resCallback('showModal'),
|
|
97
|
-
confirm: false,
|
|
98
|
-
cancel: true
|
|
99
|
-
},
|
|
100
|
-
options
|
|
101
|
-
)
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
// 鸿蒙没有失败方法,只有取消
|
|
105
|
-
cancel: (_) => {
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
promptAction.showDialog(modalOptions, (error, data) => {
|
|
84
|
+
if (error) {
|
|
85
|
+
const res = { errMsg: error }
|
|
86
|
+
callAsyncFail(reject, res, options)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (data.index === 0 && showCancel) {
|
|
106
90
|
callAsyncSuccess(
|
|
107
91
|
resolve,
|
|
108
92
|
{
|
|
@@ -112,10 +96,19 @@ export function showModal (options) {
|
|
|
112
96
|
},
|
|
113
97
|
options
|
|
114
98
|
)
|
|
99
|
+
} else {
|
|
100
|
+
callAsyncSuccess(
|
|
101
|
+
resolve,
|
|
102
|
+
{
|
|
103
|
+
...resCallback('showModal'),
|
|
104
|
+
confirm: true,
|
|
105
|
+
cancel: false,
|
|
106
|
+
content: null
|
|
107
|
+
},
|
|
108
|
+
options
|
|
109
|
+
)
|
|
115
110
|
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
prompt.showDialog(modalOptions)
|
|
111
|
+
})
|
|
119
112
|
})
|
|
120
113
|
}
|
|
121
114
|
|
|
@@ -152,45 +145,35 @@ export function showActionSheet (options) {
|
|
|
152
145
|
|
|
153
146
|
const actionSheetOptions = {
|
|
154
147
|
title,
|
|
155
|
-
buttons
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
...data,
|
|
161
|
-
...resCallback('showActionSheet')
|
|
162
|
-
},
|
|
163
|
-
options
|
|
164
|
-
)
|
|
165
|
-
},
|
|
166
|
-
// 取消方法,并非失败
|
|
167
|
-
fail: (data) => {
|
|
148
|
+
buttons
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
promptAction.showActionMenu(actionSheetOptions, (error, data) => {
|
|
152
|
+
if (error) {
|
|
168
153
|
callAsyncFail(
|
|
169
154
|
reject,
|
|
170
155
|
{
|
|
171
156
|
...data,
|
|
172
|
-
errMsg: data.errMsg
|
|
157
|
+
errMsg: data.errMsg?.replace('showActionMenu', 'showActionSheet')
|
|
173
158
|
},
|
|
174
159
|
options
|
|
175
160
|
)
|
|
176
161
|
}
|
|
177
|
-
}
|
|
178
162
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
duration: 10,
|
|
188
|
-
bottom: '9999px'
|
|
163
|
+
callAsyncSuccess(
|
|
164
|
+
resolve,
|
|
165
|
+
{
|
|
166
|
+
...data,
|
|
167
|
+
...resCallback('showActionSheet')
|
|
168
|
+
},
|
|
169
|
+
options
|
|
170
|
+
)
|
|
189
171
|
})
|
|
190
|
-
callAsyncSuccess(resolve, resCallback('hideToast'), options)
|
|
191
172
|
})
|
|
192
173
|
}
|
|
193
174
|
|
|
175
|
+
export const hideToast = /* @__PURE__ */ temporarilyNotSupport('hideToast')
|
|
176
|
+
|
|
194
177
|
export const showLoading = temporarilyNotSupport('showLoading')
|
|
195
178
|
export const hideLoading = temporarilyNotSupport('hideLoading')
|
|
196
179
|
|
|
@@ -19,7 +19,7 @@ export const setNavigationBarTitle: typeof Taro.setNavigationBarTitle = function
|
|
|
19
19
|
|
|
20
20
|
export const setNavigationBarColor: typeof Taro.setNavigationBarColor = function (options) {
|
|
21
21
|
const { success, fail, complete } = options || {}
|
|
22
|
-
const handle = new MethodHandler({ name: '
|
|
22
|
+
const handle = new MethodHandler({ name: 'setNavigationBarColor', success, fail, complete })
|
|
23
23
|
|
|
24
24
|
return new Promise((resolve, reject) => {
|
|
25
25
|
eventCenter.trigger('__taroNavigationStyle', {
|