@tarojs/plugin-platform-harmony-ets 4.0.0-beta.45 → 4.0.0-beta.47
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/storage/index.ts +61 -51
- package/dist/apis/ui/interaction/index.ts +39 -48
- package/dist/components-harmony-ets/checkbox.ets +1 -1
- package/dist/components-harmony-ets/form.ets +1 -1
- package/dist/components-harmony-ets/index.ets +8 -3
- package/dist/components-harmony-ets/label.ets +1 -1
- package/dist/components-harmony-ets/movableArea.ets +1 -1
- package/dist/components-harmony-ets/movableView.ets +1 -1
- package/dist/components-harmony-ets/radio.ets +1 -1
- package/dist/components-harmony-ets/style.ets +31 -21
- package/dist/components-harmony-ets/utils/flexManager.ets +5 -0
- package/dist/components-harmony-ets/view.ets +1 -1
- 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 +43 -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 +80 -72
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +80 -72
- package/dist/runtime.js.map +1 -1
- package/package.json +9 -9
|
@@ -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 })
|
|
@@ -14,6 +14,7 @@ import type Taro from '@tarojs/taro/types'
|
|
|
14
14
|
let context
|
|
15
15
|
let kvManager: distributedKVStore.KVManager
|
|
16
16
|
let kvStore: distributedKVStore.SingleKVStore
|
|
17
|
+
let kvStorePromise: Promise<void>
|
|
17
18
|
|
|
18
19
|
(Current as any).contextPromise.then((ctx) => {
|
|
19
20
|
context = ctx
|
|
@@ -38,13 +39,16 @@ let kvStore: distributedKVStore.SingleKVStore
|
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
const data = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
+
})
|
|
48
52
|
})
|
|
49
53
|
} catch (e) {
|
|
50
54
|
console.error(`Failed to create KVManager. Code:${e.code},message:${e.message}`)
|
|
@@ -58,7 +62,7 @@ const storageSchema = {
|
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
function checkContextExist (api: string, isAsync = false) {
|
|
61
|
-
if (!context
|
|
65
|
+
if (!context) {
|
|
62
66
|
const message = `${api} 调用失败,Taro 不支持过早地调用 ${api},请确保页面已经渲染完成再调用此 API`
|
|
63
67
|
if (isAsync) {
|
|
64
68
|
return {
|
|
@@ -91,21 +95,23 @@ export function getStorage<T = any> (options: Taro.getStorage.Option<T>) {
|
|
|
91
95
|
const handle = new MethodHandler<{data: any}>({ name, success, fail, complete })
|
|
92
96
|
|
|
93
97
|
return new Promise((resolve, reject) => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
kvStore = kvStore as distributedKVStore.SingleKVStore
|
|
102
|
-
kvStore.get(key, (err, data) => {
|
|
103
|
-
if (err) {
|
|
104
|
-
handle.fail({ errMsg: `Failed to get data. Code:${err.code},message:${err.message}` }, { resolve, reject })
|
|
105
|
-
return
|
|
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 })
|
|
106
104
|
}
|
|
107
|
-
|
|
108
|
-
|
|
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
|
+
})
|
|
109
115
|
})
|
|
110
116
|
})
|
|
111
117
|
}
|
|
@@ -122,21 +128,23 @@ export function setStorage (options: Taro.setStorage.Option) {
|
|
|
122
128
|
const handle = new MethodHandler({ name, success, fail, complete })
|
|
123
129
|
|
|
124
130
|
return new Promise((resolve, reject) => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
kvStore = kvStore as distributedKVStore.SingleKVStore
|
|
133
|
-
kvStore.put(key, data, (err) => {
|
|
134
|
-
if (err) {
|
|
135
|
-
handle.fail({ errMsg: `Failed to put data. Code:${err.code},message:${err.message}` }, { resolve, reject })
|
|
136
|
-
return
|
|
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
137
|
}
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
|
|
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
|
+
}
|
|
145
|
+
|
|
146
|
+
handle.success({}, { resolve, reject })
|
|
147
|
+
})
|
|
140
148
|
})
|
|
141
149
|
})
|
|
142
150
|
}
|
|
@@ -153,21 +161,23 @@ export function removeStorage (options: Taro.removeStorage.Option) {
|
|
|
153
161
|
const handle = new MethodHandler({ name, success, fail, complete })
|
|
154
162
|
|
|
155
163
|
return new Promise((resolve, reject) => {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
kvStore = kvStore as distributedKVStore.SingleKVStore
|
|
164
|
-
kvStore.delete(key, (err) => {
|
|
165
|
-
if (err) {
|
|
166
|
-
handle.fail({ errMsg: `Failed to delete data. Code:${err.code},message:${err.message}` }, { resolve, reject })
|
|
167
|
-
return
|
|
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 })
|
|
168
170
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
+
|
|
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
|
+
}
|
|
178
|
+
|
|
179
|
+
handle.success({}, { resolve, reject })
|
|
180
|
+
})
|
|
171
181
|
})
|
|
172
182
|
})
|
|
173
183
|
}
|
|
@@ -183,7 +193,7 @@ export const batchSetStorage = /* @__PURE__ */ temporarilyNotSupport('batchSetSt
|
|
|
183
193
|
export const batchGetStorageSync = /* @__PURE__ */ temporarilyNotSupport('batchGetStorageSync')
|
|
184
194
|
export const batchGetStorage = /* @__PURE__ */ temporarilyNotSupport('batchGetStorage')
|
|
185
195
|
|
|
186
|
-
export const clearStorage = temporarilyNotSupport('
|
|
196
|
+
export const clearStorage = temporarilyNotSupport('clearStorage')
|
|
187
197
|
export const getStorageSync = temporarilyNotSupport('getStorageSync', 'getStorage')
|
|
188
198
|
export const setStorageSync = temporarilyNotSupport('setStorageSync', 'setStorage')
|
|
189
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'
|
|
@@ -127,7 +127,7 @@ export struct TaroCheckboxGroup {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
build() {
|
|
130
|
-
if (
|
|
130
|
+
if (FlexManager.useFlexLayout(this.node)) {
|
|
131
131
|
Flex(FlexManager.flexOptions(this.node)) {
|
|
132
132
|
this.createLazyChildren(this.node)
|
|
133
133
|
}
|
|
@@ -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,6 +37,13 @@ class TextStyleModify implements AttributeModifier<TextAttribute> {
|
|
|
36
37
|
|
|
37
38
|
setAnimationStyle (overwriteStyle: Record<string, TaroAny>) {
|
|
38
39
|
this.overwriteStyle = overwriteStyle
|
|
40
|
+
if (this.style && this.overwriteStyle && Object.keys(this.overwriteStyle).length) {
|
|
41
|
+
// 防止污染原始样式
|
|
42
|
+
this.style = ObjectAssign({}, this.style)
|
|
43
|
+
Object.keys(this.overwriteStyle).forEach(key => {
|
|
44
|
+
this.style![key] = this.overwriteStyle[key]
|
|
45
|
+
})
|
|
46
|
+
}
|
|
39
47
|
return this
|
|
40
48
|
}
|
|
41
49
|
|
|
@@ -43,12 +51,12 @@ class TextStyleModify implements AttributeModifier<TextAttribute> {
|
|
|
43
51
|
if (this.node && this.style) {
|
|
44
52
|
if (this.withNormal) {
|
|
45
53
|
setNormalAttributeIntoInstance(instance, this.style, this.node)
|
|
54
|
+
setTransformAttributeIntoInstance(instance, this.style || {})
|
|
46
55
|
}
|
|
47
56
|
setNormalTextAttributeIntoInstance(instance, this.style, this.node)
|
|
48
57
|
setSpecialTextAttributeIntoInstance(instance, this.style, this.node)
|
|
49
58
|
}
|
|
50
59
|
|
|
51
|
-
setAnimationAttributeIntoInstance(instance, this.overwriteStyle, this.style || {})
|
|
52
60
|
}
|
|
53
61
|
}
|
|
54
62
|
|
|
@@ -76,7 +84,9 @@ class CommonStyleModify implements AttributeModifier<CommonAttribute> {
|
|
|
76
84
|
|
|
77
85
|
setAnimationStyle (overwriteStyle: Record<string, TaroAny>) {
|
|
78
86
|
this.overwriteStyle = overwriteStyle
|
|
79
|
-
if (this.style && this.overwriteStyle) {
|
|
87
|
+
if (this.style && this.overwriteStyle && Object.keys(this.overwriteStyle).length) {
|
|
88
|
+
// 防止污染原始样式
|
|
89
|
+
this.style = ObjectAssign({}, this.style)
|
|
80
90
|
Object.keys(this.overwriteStyle).forEach(key => {
|
|
81
91
|
this.style![key] = this.overwriteStyle[key]
|
|
82
92
|
})
|
|
@@ -87,9 +97,8 @@ class CommonStyleModify implements AttributeModifier<CommonAttribute> {
|
|
|
87
97
|
applyNormalAttribute(instance: CommonAttribute): void {
|
|
88
98
|
if (this.node && this.style) {
|
|
89
99
|
setNormalAttributeIntoInstance(instance, this.style, this.node)
|
|
100
|
+
setTransformAttributeIntoInstance(instance, this.style || {})
|
|
90
101
|
}
|
|
91
|
-
|
|
92
|
-
setAnimationAttributeIntoInstance(instance, this.overwriteStyle, this.style || {})
|
|
93
102
|
}
|
|
94
103
|
}
|
|
95
104
|
|
|
@@ -123,9 +132,9 @@ class RowStyleModify extends CommonStyleModify {
|
|
|
123
132
|
instance.alignItems(FlexManager.alignItems<VerticalAlign>(this.node))
|
|
124
133
|
instance.justifyContent(FlexManager.justifyContent(this.node))
|
|
125
134
|
}
|
|
135
|
+
setTransformAttributeIntoInstance(instance, this.style || {})
|
|
126
136
|
}
|
|
127
137
|
|
|
128
|
-
setAnimationAttributeIntoInstance(instance, this.overwriteStyle, this.style || {})
|
|
129
138
|
}
|
|
130
139
|
}
|
|
131
140
|
|
|
@@ -143,33 +152,33 @@ class ColumnStyleModify extends CommonStyleModify {
|
|
|
143
152
|
instance.alignItems(FlexManager.alignItems<HorizontalAlign>(this.node))
|
|
144
153
|
instance.justifyContent(FlexManager.justifyContent(this.node))
|
|
145
154
|
}
|
|
155
|
+
setTransformAttributeIntoInstance(instance, this.style || {})
|
|
146
156
|
}
|
|
147
157
|
|
|
148
|
-
setAnimationAttributeIntoInstance(instance, this.overwriteStyle, this.style || {})
|
|
149
158
|
}
|
|
150
159
|
}
|
|
151
160
|
|
|
152
|
-
export function
|
|
161
|
+
export function setTransformAttributeIntoInstance(instance: CommonAttribute, style: TaroStyleType) {
|
|
153
162
|
// Animation 需要提前和 @State 变量绑定才能产生动画效果,因此不能做 if else 判断
|
|
154
163
|
instance.translate({
|
|
155
|
-
x:
|
|
156
|
-
y:
|
|
157
|
-
z:
|
|
164
|
+
x: style.transform?.Translate?.x,
|
|
165
|
+
y: style.transform?.Translate?.y,
|
|
166
|
+
z: style.transform?.Translate?.z,
|
|
158
167
|
})
|
|
159
168
|
instance.scale({
|
|
160
|
-
x:
|
|
161
|
-
y:
|
|
162
|
-
z:
|
|
163
|
-
centerX:
|
|
164
|
-
centerY:
|
|
169
|
+
x: style.transform?.Scale?.x,
|
|
170
|
+
y: style.transform?.Scale?.y,
|
|
171
|
+
z: style.transform?.Scale?.z,
|
|
172
|
+
centerX: style.transformOrigin?.x || 0,
|
|
173
|
+
centerY: style.transformOrigin?.y || 0,
|
|
165
174
|
})
|
|
166
175
|
instance.rotate({
|
|
167
|
-
x:
|
|
168
|
-
y:
|
|
169
|
-
z:
|
|
170
|
-
centerX:
|
|
171
|
-
centerY:
|
|
172
|
-
angle:
|
|
176
|
+
x: style.transform?.Rotate?.x,
|
|
177
|
+
y: style.transform?.Rotate?.y,
|
|
178
|
+
z: style.transform?.Rotate?.z,
|
|
179
|
+
centerX: style.transformOrigin?.x || 0,
|
|
180
|
+
centerY: style.transformOrigin?.y || 0,
|
|
181
|
+
angle: style.transform?.Rotate?.angle || 0,
|
|
173
182
|
})
|
|
174
183
|
}
|
|
175
184
|
|
|
@@ -222,6 +231,7 @@ export function setSpecialTextAttributeIntoInstance(instance: TextAttribute, sty
|
|
|
222
231
|
}
|
|
223
232
|
|
|
224
233
|
export function setNormalAttributeIntoInstance(instance: CommonAttribute, style: TaroStyleType, node?: TaroElement | null) {
|
|
234
|
+
instance.renderFit(RenderFit.RESIZE_FILL)
|
|
225
235
|
if (!isUndefined(style.id)) {
|
|
226
236
|
instance.id(style.id)
|
|
227
237
|
instance.key(style.id)
|
|
@@ -37,6 +37,11 @@ class FlexManager {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
static useFlexLayout (node: TaroElement): boolean {
|
|
41
|
+
const hmStyle: HarmonyStyle = getNormalAttributes(node) || {}
|
|
42
|
+
return !isUndefined(hmStyle.flexWrap) || [ItemAlign.Stretch, ItemAlign.Baseline].indexOf(hmStyle.alignItems!) !== -1
|
|
43
|
+
}
|
|
44
|
+
|
|
40
45
|
static flexOptions (node: TaroElement): IFlexOptions {
|
|
41
46
|
const hmStyle: HarmonyStyle = getNormalAttributes(node) || {}
|
|
42
47
|
const isFlex = FlexManager.isFlexNode(node)
|
|
@@ -23,7 +23,7 @@ export default struct TaroView {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
build () {
|
|
26
|
-
if (
|
|
26
|
+
if (FlexManager.useFlexLayout(this.node)) {
|
|
27
27
|
Flex(FlexManager.flexOptions(this.node)) {
|
|
28
28
|
if (this.node._pseudo_before || this.node._pseudo_after) {
|
|
29
29
|
PseduoChildren({ node: this.node, createLazyChildren: this.createLazyChildren })
|
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)) {
|