@tarojs/plugin-platform-harmony-ets 4.0.0-beta.46 → 4.0.0-beta.48
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/device/clipboard.ts +4 -0
- package/dist/apis/index.ts +0 -5
- package/dist/apis/storage/index.ts +1 -1
- package/dist/apis/ui/interaction/index.ts +39 -48
- package/dist/components-harmony-ets/icon.ets +3 -6
- package/dist/components-harmony-ets/index.ets +8 -3
- package/dist/components-harmony-ets/style.ets +8 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/dom/cssNesting.ts +1 -1
- package/dist/runtime-ets/dom/cssStyleDeclaration.ts +15 -1
- package/dist/runtime-ets/dom/element/element.ts +37 -19
- package/dist/runtime-ets/dom/stylesheet/type.ts +10 -0
- package/dist/runtime-ets/utils/index.ts +25 -11
- package/dist/runtime-utils.js +23 -30
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +23 -30
- package/dist/runtime.js.map +1 -1
- package/package.json +9 -9
- 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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// 从 API Version 6 开始支持
|
|
2
2
|
import pasteboard from '@ohos.pasteboard'
|
|
3
|
+
import promptAction from '@ohos.promptAction'
|
|
3
4
|
import { isString } from '@tarojs/shared'
|
|
4
5
|
|
|
5
6
|
import { callAsyncFail, getParameterError, object2String } from '../utils'
|
|
@@ -38,6 +39,9 @@ export const setClipboardData: typeof Taro.setClipboardData = function (options)
|
|
|
38
39
|
}
|
|
39
40
|
callAsyncFail(reject, res, options)
|
|
40
41
|
} else {
|
|
42
|
+
|
|
43
|
+
promptAction.showToast({ message: '内容已复制' })
|
|
44
|
+
|
|
41
45
|
return handle.success({
|
|
42
46
|
data,
|
|
43
47
|
}, { resolve, reject })
|
package/dist/apis/index.ts
CHANGED
|
@@ -62,7 +62,6 @@ let displayWidth = display.width
|
|
|
62
62
|
let ratioCache: number | false = false
|
|
63
63
|
let designWidthFunc: (input: number) => number
|
|
64
64
|
let designWidth = defaultDesignWidth
|
|
65
|
-
let deviceRatio = defaultDesignRatio
|
|
66
65
|
function getRatio (value: number) {
|
|
67
66
|
// Note: 提前调用 display 可能无法获取正确值
|
|
68
67
|
if (ratioCache === false || displayWidth !== display.width) {
|
|
@@ -72,10 +71,6 @@ function getRatio (value: number) {
|
|
|
72
71
|
? config.designWidth
|
|
73
72
|
: () => config.designWidth
|
|
74
73
|
designWidth = designWidthFunc(value) || defaultDesignWidth
|
|
75
|
-
deviceRatio = config.deviceRatio || defaultDesignRatio
|
|
76
|
-
if (!(designWidth in deviceRatio)) {
|
|
77
|
-
throw new Error(`deviceRatio 配置中不存在 ${designWidth} 的设置!`)
|
|
78
|
-
}
|
|
79
74
|
}
|
|
80
75
|
displayWidth = display.width
|
|
81
76
|
ratioCache = Math.min(display.width, display.height) / designWidth
|
|
@@ -193,7 +193,7 @@ export const batchSetStorage = /* @__PURE__ */ temporarilyNotSupport('batchSetSt
|
|
|
193
193
|
export const batchGetStorageSync = /* @__PURE__ */ temporarilyNotSupport('batchGetStorageSync')
|
|
194
194
|
export const batchGetStorage = /* @__PURE__ */ temporarilyNotSupport('batchGetStorage')
|
|
195
195
|
|
|
196
|
-
export const clearStorage = temporarilyNotSupport('
|
|
196
|
+
export const clearStorage = temporarilyNotSupport('clearStorage')
|
|
197
197
|
export const getStorageSync = temporarilyNotSupport('getStorageSync', 'getStorage')
|
|
198
198
|
export const setStorageSync = temporarilyNotSupport('setStorageSync', 'setStorage')
|
|
199
199
|
export const clearStorageSync = temporarilyNotSupport('clearStorageSync', 'clearStorage')
|
|
@@ -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,7 +29,7 @@ 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
35
|
bottom: options.bottom
|
|
@@ -72,37 +72,20 @@ export function showModal (options) {
|
|
|
72
72
|
})
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
return new Promise(resolve => {
|
|
75
|
+
return new Promise((resolve, reject) => {
|
|
76
76
|
const modalOptions = {
|
|
77
77
|
title,
|
|
78
78
|
message: content,
|
|
79
79
|
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: (_) => {
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
promptAction.showDialog(modalOptions, (error, data) => {
|
|
83
|
+
if (error) {
|
|
84
|
+
const res = { errMsg: error }
|
|
85
|
+
callAsyncFail(reject, res, options)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (data.index === 0 && showCancel) {
|
|
106
89
|
callAsyncSuccess(
|
|
107
90
|
resolve,
|
|
108
91
|
{
|
|
@@ -112,10 +95,19 @@ export function showModal (options) {
|
|
|
112
95
|
},
|
|
113
96
|
options
|
|
114
97
|
)
|
|
98
|
+
} else {
|
|
99
|
+
callAsyncSuccess(
|
|
100
|
+
resolve,
|
|
101
|
+
{
|
|
102
|
+
...resCallback('showModal'),
|
|
103
|
+
confirm: true,
|
|
104
|
+
cancel: false,
|
|
105
|
+
content: null
|
|
106
|
+
},
|
|
107
|
+
options
|
|
108
|
+
)
|
|
115
109
|
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
prompt.showDialog(modalOptions)
|
|
110
|
+
})
|
|
119
111
|
})
|
|
120
112
|
}
|
|
121
113
|
|
|
@@ -152,19 +144,11 @@ export function showActionSheet (options) {
|
|
|
152
144
|
|
|
153
145
|
const actionSheetOptions = {
|
|
154
146
|
title,
|
|
155
|
-
buttons
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
...data,
|
|
161
|
-
...resCallback('showActionSheet')
|
|
162
|
-
},
|
|
163
|
-
options
|
|
164
|
-
)
|
|
165
|
-
},
|
|
166
|
-
// 取消方法,并非失败
|
|
167
|
-
fail: (data) => {
|
|
147
|
+
buttons
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
promptAction.showActionMenu(actionSheetOptions, (error, data) => {
|
|
151
|
+
if (error) {
|
|
168
152
|
callAsyncFail(
|
|
169
153
|
reject,
|
|
170
154
|
{
|
|
@@ -174,15 +158,22 @@ export function showActionSheet (options) {
|
|
|
174
158
|
options
|
|
175
159
|
)
|
|
176
160
|
}
|
|
177
|
-
}
|
|
178
161
|
|
|
179
|
-
|
|
162
|
+
callAsyncSuccess(
|
|
163
|
+
resolve,
|
|
164
|
+
{
|
|
165
|
+
...data,
|
|
166
|
+
...resCallback('showActionSheet')
|
|
167
|
+
},
|
|
168
|
+
options
|
|
169
|
+
)
|
|
170
|
+
})
|
|
180
171
|
})
|
|
181
172
|
}
|
|
182
173
|
|
|
183
174
|
export function hideToast (options) {
|
|
184
175
|
return new Promise(resolve => {
|
|
185
|
-
|
|
176
|
+
promptAction.showToast({
|
|
186
177
|
message: '关闭中',
|
|
187
178
|
duration: 10,
|
|
188
179
|
bottom: '9999px'
|
|
@@ -65,13 +65,10 @@ export default struct TaroIcon {
|
|
|
65
65
|
Image(getIconData(this.node))
|
|
66
66
|
.objectFit(ImageFit.Contain)
|
|
67
67
|
.fillColor(this.node._attrs.color || ICON_COLOR_MAP[this.node._attrs.type] || Color.Black)
|
|
68
|
-
.attributeModifier(commonStyleModify.setNode(this.node
|
|
69
|
-
width: convertNumber2PX(23),
|
|
70
|
-
height: convertNumber2PX(23)
|
|
71
|
-
}).setAnimationStyle(this.overwriteStyle))
|
|
68
|
+
.attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
72
69
|
.size({
|
|
73
|
-
width:
|
|
74
|
-
height:
|
|
70
|
+
width: Number(this.node._attrs.size) || 23,
|
|
71
|
+
height: Number(this.node._attrs.size) || 23
|
|
75
72
|
})
|
|
76
73
|
.onComplete(e => eventHandler(e, 'complete', this.node))
|
|
77
74
|
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import TaroImage from './image'
|
|
1
|
+
import TaroImage, { getImageMode } from './image'
|
|
2
2
|
import TaroText from './text'
|
|
3
3
|
import TaroView from './view'
|
|
4
4
|
import TaroIcon from './icon'
|
|
@@ -23,15 +23,18 @@ import TaroMovableView from './movableView'
|
|
|
23
23
|
import { TaroRadio, TaroRadioGroup } from './radio'
|
|
24
24
|
import { TaroCheckboxGroup, TaroCheckbox } from './checkbox'
|
|
25
25
|
|
|
26
|
-
import commonStyleModify, { rowModify, columnModify } from './style'
|
|
26
|
+
import commonStyleModify, { rowModify, columnModify, textModify, setNormalTextAttributeIntoInstance } from './style'
|
|
27
27
|
import { getButtonColor } from './button'
|
|
28
28
|
import { FlexManager } from './utils/flexManager'
|
|
29
29
|
import { DynamicCenter } from './utils/DynamicCenter'
|
|
30
30
|
import { TOUCH_EVENT_MAP } from './utils/constant/event'
|
|
31
31
|
import { BUTTON_THEME_COLOR } from './utils/constant/style'
|
|
32
|
+
import { getStyleAttr } from './utils/styles'
|
|
32
33
|
import { shouldBindEvent, getNodeThresholds, getNormalAttributes, getFontAttributes } from './utils/helper'
|
|
33
34
|
|
|
34
35
|
export {
|
|
36
|
+
textModify,
|
|
37
|
+
getStyleAttr,
|
|
35
38
|
FlexManager,
|
|
36
39
|
DynamicCenter,
|
|
37
40
|
getButtonColor,
|
|
@@ -44,6 +47,8 @@ export {
|
|
|
44
47
|
getNodeThresholds,
|
|
45
48
|
BUTTON_THEME_COLOR,
|
|
46
49
|
getNormalAttributes,
|
|
50
|
+
setNormalTextAttributeIntoInstance,
|
|
51
|
+
getImageMode,
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
export {
|
|
@@ -72,5 +77,5 @@ export {
|
|
|
72
77
|
TaroRadio,
|
|
73
78
|
TaroRadioGroup,
|
|
74
79
|
TaroCheckboxGroup,
|
|
75
|
-
TaroCheckbox
|
|
80
|
+
TaroCheckbox,
|
|
76
81
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TaroAny, HarmonyStyle, TaroElement, TaroStyleType, TaroTextElement } from '@tarojs/runtime'
|
|
2
|
+
import { ObjectAssign } from '@tarojs/runtime'
|
|
2
3
|
import { isUndefined } from '@tarojs/shared'
|
|
3
4
|
import { computeBackgroundPosition } from './utils'
|
|
4
5
|
import { getNormalAttributes } from './utils/helper'
|
|
@@ -36,7 +37,9 @@ class TextStyleModify implements AttributeModifier<TextAttribute> {
|
|
|
36
37
|
|
|
37
38
|
setAnimationStyle (overwriteStyle: Record<string, TaroAny>) {
|
|
38
39
|
this.overwriteStyle = overwriteStyle
|
|
39
|
-
if (this.style && this.overwriteStyle) {
|
|
40
|
+
if (this.style && this.overwriteStyle && Object.keys(this.overwriteStyle).length) {
|
|
41
|
+
// 防止污染原始样式
|
|
42
|
+
this.style = ObjectAssign({}, this.style)
|
|
40
43
|
Object.keys(this.overwriteStyle).forEach(key => {
|
|
41
44
|
this.style![key] = this.overwriteStyle[key]
|
|
42
45
|
})
|
|
@@ -81,7 +84,9 @@ class CommonStyleModify implements AttributeModifier<CommonAttribute> {
|
|
|
81
84
|
|
|
82
85
|
setAnimationStyle (overwriteStyle: Record<string, TaroAny>) {
|
|
83
86
|
this.overwriteStyle = overwriteStyle
|
|
84
|
-
if (this.style && this.overwriteStyle) {
|
|
87
|
+
if (this.style && this.overwriteStyle && Object.keys(this.overwriteStyle).length) {
|
|
88
|
+
// 防止污染原始样式
|
|
89
|
+
this.style = ObjectAssign({}, this.style)
|
|
85
90
|
Object.keys(this.overwriteStyle).forEach(key => {
|
|
86
91
|
this.style![key] = this.overwriteStyle[key]
|
|
87
92
|
})
|
|
@@ -226,6 +231,7 @@ export function setSpecialTextAttributeIntoInstance(instance: TextAttribute, sty
|
|
|
226
231
|
}
|
|
227
232
|
|
|
228
233
|
export function setNormalAttributeIntoInstance(instance: CommonAttribute, style: TaroStyleType, node?: TaroElement | null) {
|
|
234
|
+
instance.renderFit(RenderFit.RESIZE_FILL)
|
|
229
235
|
if (!isUndefined(style.id)) {
|
|
230
236
|
instance.id(style.id)
|
|
231
237
|
instance.key(style.id)
|
package/dist/index.js
CHANGED
|
@@ -247,7 +247,7 @@ class TaroPlatformHarmony extends service.TaroPlatform {
|
|
|
247
247
|
SUPPORT_TARO_POLYFILL: 'disabled',
|
|
248
248
|
},
|
|
249
249
|
});
|
|
250
|
-
return Object.assign(Object.assign(Object.assign({}, config), { buildAdapter: config.platform, fileType: this.fileType, platformType: this.platformType, useETS: this.useETS,
|
|
250
|
+
return Object.assign(Object.assign(Object.assign({}, config), { buildAdapter: config.platform, fileType: this.fileType, platformType: this.platformType, useETS: this.useETS, useJSON5: this.useJSON5 }), extraOptions);
|
|
251
251
|
}
|
|
252
252
|
/**
|
|
253
253
|
* 调用 runner 开始编译
|
|
@@ -507,7 +507,7 @@ let Harmony$1 = class Harmony extends TaroPlatformHarmony {
|
|
|
507
507
|
define.global = 'globalThis';
|
|
508
508
|
}
|
|
509
509
|
const ext = path__namespace.extname(target);
|
|
510
|
-
if (![/d\.e?tsx?$/, /\.(json|md)$/].some(e => e.test(target))) {
|
|
510
|
+
if (![/d\.e?tsx?$/, /\.(json|map|md)$/].some(e => e.test(target))) {
|
|
511
511
|
code = this.replaceDefineValue(code, define, ext);
|
|
512
512
|
}
|
|
513
513
|
if (['.ts'].includes(ext)) {
|