@tarojs/plugin-platform-harmony-ets 4.0.0-alpha.0 → 4.0.0-beta.1
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/video/VideoContext.ts +56 -7
- package/dist/apis/media/video/index.ts +3 -2
- package/dist/components-harmony-ets/button.ets +58 -23
- package/dist/components-harmony-ets/checkbox.ets +154 -67
- package/dist/components-harmony-ets/form.ets +52 -18
- package/dist/components-harmony-ets/icon.ets +53 -19
- package/dist/components-harmony-ets/image.ets +53 -19
- package/dist/components-harmony-ets/input.ets +57 -18
- package/dist/components-harmony-ets/label.ets +52 -18
- package/dist/components-harmony-ets/picker.ets +139 -37
- package/dist/components-harmony-ets/radio.ets +157 -70
- package/dist/components-harmony-ets/richText.ets +52 -18
- package/dist/components-harmony-ets/scrollView.ets +102 -44
- package/dist/components-harmony-ets/slider.ets +57 -18
- package/dist/components-harmony-ets/swiper.ets +52 -18
- package/dist/components-harmony-ets/switch.ets +92 -41
- package/dist/components-harmony-ets/text.ets +57 -20
- package/dist/components-harmony-ets/textArea.ets +58 -19
- package/dist/components-harmony-ets/utils/DynamicCenter.ts +2 -11
- package/dist/components-harmony-ets/utils/flexManager.ets +1 -1
- package/dist/components-harmony-ets/utils/styles.ets +46 -19
- package/dist/components-harmony-ets/video.ets +52 -18
- package/dist/components-harmony-ets/view.ets +100 -32
- package/dist/index.js +17 -4
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/dom/cssStyleDeclaration.ts +7 -3
- package/dist/runtime-ets/dom/element/element.ts +1 -0
- package/dist/runtime-ets/dom/element/form.ts +11 -2
- package/dist/runtime-ets/dom/node.ts +29 -16
- package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +551 -0
- package/dist/runtime-ets/dom/stylesheet/index.ts +216 -354
- package/dist/runtime-ets/dom/stylesheet/type.ts +46 -11
- package/dist/runtime-ets/dom/stylesheet/util.ts +55 -5
- package/dist/runtime-ets/interface/event.ts +2 -1
- package/dist/runtime-ets/utils/index.ts +3 -1
- package/dist/runtime-ets/utils/info.ts +3 -1
- package/dist/runtime-utils.js +48 -13
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +48 -13
- package/dist/runtime.js.map +1 -1
- package/package.json +10 -9
- package/static/media/cancel.svg +1 -0
- package/static/media/circle.svg +1 -0
- package/static/media/clear.svg +1 -0
- package/static/media/download.svg +1 -0
- package/static/media/info.svg +1 -0
- package/static/media/info_circle.svg +1 -0
- package/static/media/search.svg +1 -0
- package/static/media/success.svg +1 -0
- package/static/media/success_no_circle.svg +1 -0
- package/static/media/taro_arrow_left.svg +1 -0
- package/static/media/taro_home.svg +1 -0
- package/static/media/waiting.svg +1 -0
- package/static/media/warn.svg +1 -0
|
@@ -1,20 +1,33 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
import matrix4 from '@ohos.matrix4'
|
|
2
3
|
|
|
3
4
|
export interface HarmonyStyle extends TaroStyleType {
|
|
4
5
|
textAlign?: TextAlign
|
|
5
6
|
textOverflow?: HarmonyType.Overflow
|
|
6
|
-
|
|
7
|
+
WebkitLineClamp?: number
|
|
7
8
|
letterSpacing?: number | string
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export interface TaroStyleType {
|
|
11
12
|
id?: string
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
paddingTop?: Length
|
|
15
|
+
paddingRight?: Length
|
|
16
|
+
paddingBottom?: Length
|
|
17
|
+
paddingLeft?: Length
|
|
18
|
+
|
|
19
|
+
marginTop?: Length
|
|
20
|
+
marginRight?: Length
|
|
21
|
+
marginBottom?: Length
|
|
22
|
+
marginLeft?: Length
|
|
23
|
+
|
|
15
24
|
width?: Length
|
|
16
25
|
height?: Length
|
|
17
|
-
|
|
26
|
+
|
|
27
|
+
minHeight?: Length
|
|
28
|
+
maxHeight?: Length
|
|
29
|
+
minWidth?: Length
|
|
30
|
+
maxWidth?: Length
|
|
18
31
|
|
|
19
32
|
display?: 'flex' | 'block' | 'none'
|
|
20
33
|
|
|
@@ -28,7 +41,7 @@ export interface TaroStyleType {
|
|
|
28
41
|
flexGrow?: number
|
|
29
42
|
flexShrink?: number
|
|
30
43
|
alignSelf?: ItemAlign
|
|
31
|
-
|
|
44
|
+
flexDirection?: FlexDirection
|
|
32
45
|
justifyContent?: FlexAlign
|
|
33
46
|
alignItems?: ItemAlign
|
|
34
47
|
flexWrap?: FlexWrap
|
|
@@ -36,22 +49,39 @@ export interface TaroStyleType {
|
|
|
36
49
|
|
|
37
50
|
// background
|
|
38
51
|
backgroundColor?: ResourceColor
|
|
39
|
-
backgroundImage?:
|
|
52
|
+
backgroundImage?: HarmonyType.Background.BackgroundImage
|
|
40
53
|
backgroundRepeat?: ImageRepeat
|
|
41
|
-
|
|
42
|
-
|
|
54
|
+
backgroundSize?: SizeOptions | ImageSize
|
|
55
|
+
backgroundPosition?: Position | Alignment
|
|
43
56
|
|
|
44
57
|
// transform
|
|
45
58
|
rotate?: HarmonyType.Transform.Rotate
|
|
46
59
|
translate?: HarmonyType.Transform.Translate
|
|
47
60
|
scale?: HarmonyType.Transform.Scale
|
|
48
61
|
transform?: HarmonyType.Transform.Transform
|
|
62
|
+
transformOrigin?: HarmonyType.Transform.Origin
|
|
49
63
|
|
|
50
64
|
// border
|
|
51
65
|
borderWidth?: Length | EdgeWidths
|
|
66
|
+
borderLeftWidth?: Length
|
|
67
|
+
borderRightWidth?: Length
|
|
68
|
+
borderTopWidth?: Length
|
|
69
|
+
borderBottomWidth?: Length
|
|
52
70
|
borderColor?: ResourceColor | EdgeColors
|
|
71
|
+
borderLeftColor?: ResourceColor
|
|
72
|
+
borderRightColor?: ResourceColor
|
|
73
|
+
borderTopColor?: ResourceColor
|
|
74
|
+
borderBottomColor?: ResourceColor
|
|
53
75
|
borderStyle?: BorderStyle | EdgeStyles
|
|
76
|
+
borderLeftStyle?: BorderStyle
|
|
77
|
+
borderRightStyle?: BorderStyle
|
|
78
|
+
borderTopStyle?: BorderStyle
|
|
79
|
+
borderBottomStyle?: BorderStyle
|
|
54
80
|
borderRadius?: Length | BorderRadiuses
|
|
81
|
+
borderTopLeftRadius?: Length
|
|
82
|
+
borderTopRightRadius?: Length
|
|
83
|
+
borderBottomLeftRadius?: Length
|
|
84
|
+
borderBottomRightRadius?: Length
|
|
55
85
|
|
|
56
86
|
// text
|
|
57
87
|
color?: ResourceColor
|
|
@@ -60,7 +90,7 @@ export interface TaroStyleType {
|
|
|
60
90
|
fontWeight?: number | FontWeight | string
|
|
61
91
|
fontFamily?: string | Resource
|
|
62
92
|
lineHeight?: string | number | Resource
|
|
63
|
-
|
|
93
|
+
textDecoration?: TextDecorationType
|
|
64
94
|
|
|
65
95
|
// gradient
|
|
66
96
|
linearGradient?: HarmonyType.LinearGradient
|
|
@@ -68,14 +98,14 @@ export interface TaroStyleType {
|
|
|
68
98
|
// other
|
|
69
99
|
opacity?: number | Resource
|
|
70
100
|
zIndex?: number
|
|
71
|
-
|
|
101
|
+
overflow?: boolean
|
|
72
102
|
focus?: boolean
|
|
73
103
|
}
|
|
74
104
|
|
|
75
105
|
export interface TaroTextStyleType {
|
|
76
106
|
textAlign?: TextAlign
|
|
77
107
|
textOverflow?: HarmonyType.Overflow
|
|
78
|
-
|
|
108
|
+
WebkitLineClamp?: number
|
|
79
109
|
letterSpacing?: number | string
|
|
80
110
|
}
|
|
81
111
|
|
|
@@ -104,11 +134,16 @@ export namespace HarmonyType {
|
|
|
104
134
|
export interface backgroundImage {
|
|
105
135
|
src: ResourceStr
|
|
106
136
|
repeat?: ImageRepeat
|
|
137
|
+
colors?: Array<[ResourceColor, number]>
|
|
107
138
|
}
|
|
108
139
|
export type backgroundImageSize = SizeOptions | ImageSize
|
|
109
140
|
export type backgroundImagePosition = Position | Alignment
|
|
110
141
|
}
|
|
111
142
|
export namespace Transform {
|
|
143
|
+
export interface Origin {
|
|
144
|
+
x?: number
|
|
145
|
+
y?: number
|
|
146
|
+
}
|
|
112
147
|
export interface Rotate {
|
|
113
148
|
x?: number
|
|
114
149
|
y?: number
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
+
import matrix4 from '@ohos.matrix4'
|
|
2
3
|
import { isNumber } from '@tarojs/shared'
|
|
3
4
|
|
|
4
5
|
import { convertNumber2VP } from '../../'
|
|
@@ -163,6 +164,32 @@ export class FlexManager {
|
|
|
163
164
|
}
|
|
164
165
|
}
|
|
165
166
|
|
|
167
|
+
|
|
168
|
+
export class BORDER_STYLE_MAP {
|
|
169
|
+
static solid = BorderStyle.Solid
|
|
170
|
+
static dotted = BorderStyle.Dotted
|
|
171
|
+
static dashed = BorderStyle.Dashed
|
|
172
|
+
|
|
173
|
+
static get(type: string): BorderStyle {
|
|
174
|
+
switch (type) {
|
|
175
|
+
case 'dotted': return BorderStyle.Dotted
|
|
176
|
+
case 'dashed': return BorderStyle.Dashed
|
|
177
|
+
default: return BorderStyle.Solid
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
static reverse(type: BorderStyle): string {
|
|
182
|
+
switch (type) {
|
|
183
|
+
case BorderStyle.Dotted: return 'dotted'
|
|
184
|
+
case BorderStyle.Dashed: return 'dashed'
|
|
185
|
+
case BorderStyle.Solid: return 'solid'
|
|
186
|
+
default: return ''
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
|
|
166
193
|
export function getNodeMarginOrPaddingData (dataValue: string) {
|
|
167
194
|
let res: any = {}
|
|
168
195
|
if (dataValue) {
|
|
@@ -184,10 +211,7 @@ export function getNodeMarginOrPaddingData (dataValue: string) {
|
|
|
184
211
|
break
|
|
185
212
|
}
|
|
186
213
|
Object.keys(res).forEach(key => {
|
|
187
|
-
|
|
188
|
-
if (exec && values.length > 1) {
|
|
189
|
-
res[key] = getUnit(+exec[1])
|
|
190
|
-
}
|
|
214
|
+
res[key] = getUnit(res[key]) || 0
|
|
191
215
|
})
|
|
192
216
|
}
|
|
193
217
|
return res
|
|
@@ -197,8 +221,34 @@ export function getNodeMarginOrPaddingData (dataValue: string) {
|
|
|
197
221
|
export function getUnit (val) {
|
|
198
222
|
if (/\d+(vp)$/.test(val)) {
|
|
199
223
|
return val
|
|
200
|
-
} else if (isNumber(val)
|
|
224
|
+
} else if (isNumber(val)) {
|
|
201
225
|
return convertNumber2VP(parseFloat(val))
|
|
202
226
|
}
|
|
227
|
+
if (val) {
|
|
228
|
+
// 匹配vw\vh
|
|
229
|
+
const exec = val.match(/(\d+)(vw|vh|px)$/)
|
|
230
|
+
if (exec) {
|
|
231
|
+
const [, num, unit] = exec
|
|
232
|
+
return convertNumber2VP(parseFloat(num), unit)
|
|
233
|
+
}
|
|
234
|
+
}
|
|
203
235
|
return val
|
|
204
236
|
}
|
|
237
|
+
|
|
238
|
+
export function getTransform(transform) {
|
|
239
|
+
if (transform) {
|
|
240
|
+
return transform.reduce((res, item) => {
|
|
241
|
+
switch (item.type) {
|
|
242
|
+
case 'Translate': return res.translate(item.value)
|
|
243
|
+
case 'Scale': return res.scale(item.value)
|
|
244
|
+
case 'Rotate': return res.rotate(item.value)
|
|
245
|
+
case 'Matrix': return res.combine(matrix4.init(item.value))
|
|
246
|
+
}
|
|
247
|
+
return res
|
|
248
|
+
}, matrix4.identity())
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export function capitalizeFirstLetter (str: string) {
|
|
253
|
+
return str.charAt(0).toUpperCase() + str.slice(1)
|
|
254
|
+
}
|
|
@@ -2,6 +2,7 @@ import _display from '@ohos.display'
|
|
|
2
2
|
import { pxTransformHelper } from '@tarojs/taro'
|
|
3
3
|
|
|
4
4
|
import { NodeType } from '../dom/node'
|
|
5
|
+
import convertWebStyle2HmStyle from '../dom/stylesheet/covertWeb2Hm'
|
|
5
6
|
|
|
6
7
|
import type { CSSProperties } from 'react'
|
|
7
8
|
import type { TaroElement } from '../dom/element/element'
|
|
@@ -53,7 +54,8 @@ export function calcDynamicStyle (styleSheet: Record<string, CSSProperties>, cla
|
|
|
53
54
|
obj.push(styleSheet[className])
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
obj.push(style)
|
|
57
|
+
obj.push(convertWebStyle2HmStyle(style))
|
|
58
|
+
|
|
57
59
|
return Object.assign.apply(null, [{}].concat(obj))
|
|
58
60
|
}
|
|
59
61
|
|
|
@@ -50,7 +50,9 @@ function tapCallbackToNodeAndUpdate (node: TaroElement, eventName: string, callb
|
|
|
50
50
|
callback && callback(...eventResult)
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
node.
|
|
53
|
+
if (!node._isDynamicNode || !node._isCompileMode) {
|
|
54
|
+
node.updateComponent()
|
|
55
|
+
}
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
package/dist/runtime-utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isFunction, isString, isArray, isObject, isNull, isNumber, isUndefined, queryToJson, PLATFORM_TYPE, singleQuote, internalComponents } from '@tarojs/shared';
|
|
2
2
|
import _display from '@ohos.display';
|
|
3
|
-
import { Current, window, getPageScrollerOrNode, findChildNodeWithDFS, setNodeEventCallbackAndTriggerComponentUpdate, AREA_CHANGE_EVENT_NAME, disconnectEvent, VISIBLE_CHANGE_EVENT_NAME, hooks } from '@tarojs/runtime';
|
|
3
|
+
import { Current, window, document as document$1, getPageScrollerOrNode, findChildNodeWithDFS, setNodeEventCallbackAndTriggerComponentUpdate, AREA_CHANGE_EVENT_NAME, disconnectEvent, VISIBLE_CHANGE_EVENT_NAME, hooks } from '@tarojs/runtime';
|
|
4
4
|
import { eventCenter, Events, History } from '@tarojs/runtime/dist/runtime.esm';
|
|
5
5
|
import deviceInfo from '@ohos.deviceInfo';
|
|
6
6
|
import i18n from '@ohos.i18n';
|
|
@@ -509,7 +509,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
509
509
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
510
510
|
PERFORMANCE OF THIS SOFTWARE.
|
|
511
511
|
***************************************************************************** */
|
|
512
|
-
/* global Reflect, Promise */
|
|
512
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
513
513
|
|
|
514
514
|
|
|
515
515
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
@@ -520,7 +520,12 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
520
520
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
521
521
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
522
522
|
});
|
|
523
|
-
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
526
|
+
var e = new Error(message);
|
|
527
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
528
|
+
};
|
|
524
529
|
|
|
525
530
|
// 电量
|
|
526
531
|
const getBatteryInfoSync = () => ({
|
|
@@ -2306,21 +2311,51 @@ const stopRecord = /* @__PURE__ */ temporarilyNotSupport('stopRecord');
|
|
|
2306
2311
|
const startRecord = /* @__PURE__ */ temporarilyNotSupport('startRecord');
|
|
2307
2312
|
const getRecorderManager = /* @__PURE__ */ temporarilyNotSupport('getRecorderManager');
|
|
2308
2313
|
|
|
2314
|
+
// @ts-nocheck
|
|
2309
2315
|
class VideoContext {
|
|
2310
|
-
constructor() {
|
|
2316
|
+
constructor(id) {
|
|
2317
|
+
this.requestBackgroundPlayback = temporarilyNotSupport('VideoContext.requestBackgroundPlayback');
|
|
2311
2318
|
this.exitBackgroundPlayback = temporarilyNotSupport('VideoContext.exitBackgroundPlayback');
|
|
2312
|
-
this.exitFullScreen = temporarilyNotSupport('VideoContext.exitFullScreen');
|
|
2313
2319
|
this.exitPictureInPicture = temporarilyNotSupport('VideoContext.exitPictureInPicture');
|
|
2314
2320
|
this.hideStatusBar = temporarilyNotSupport('VideoContext.hideStatusBar');
|
|
2315
|
-
this.pause = temporarilyNotSupport('VideoContext.pause');
|
|
2316
|
-
this.play = temporarilyNotSupport('VideoContext.play');
|
|
2317
2321
|
this.playbackRate = temporarilyNotSupport('VideoContext.playbackRate');
|
|
2318
|
-
this.requestBackgroundPlayback = temporarilyNotSupport('VideoContext.requestBackgroundPlayback');
|
|
2319
|
-
this.requestFullScreen = temporarilyNotSupport('VideoContext.requestFullScreen');
|
|
2320
|
-
this.seek = temporarilyNotSupport('VideoContext.seek');
|
|
2321
2322
|
this.sendDanmu = temporarilyNotSupport('VideoContext.sendDanmu');
|
|
2322
2323
|
this.showStatusBar = temporarilyNotSupport('VideoContext.showStatusBar');
|
|
2323
|
-
this.
|
|
2324
|
+
this.id = id;
|
|
2325
|
+
this.video = document$1.getElementById(id);
|
|
2326
|
+
if (this.video) {
|
|
2327
|
+
this.controller = this.video.controller;
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
play() {
|
|
2331
|
+
if (!this.controller)
|
|
2332
|
+
return;
|
|
2333
|
+
this.controller.play();
|
|
2334
|
+
}
|
|
2335
|
+
pause() {
|
|
2336
|
+
if (!this.controller)
|
|
2337
|
+
return;
|
|
2338
|
+
this.controller.pause();
|
|
2339
|
+
}
|
|
2340
|
+
stop() {
|
|
2341
|
+
if (!this.controller)
|
|
2342
|
+
return;
|
|
2343
|
+
this.controller.stop();
|
|
2344
|
+
}
|
|
2345
|
+
seek(position) {
|
|
2346
|
+
if (!this.controller)
|
|
2347
|
+
return;
|
|
2348
|
+
this.controller.setCurrentTime(position);
|
|
2349
|
+
}
|
|
2350
|
+
requestFullScreen() {
|
|
2351
|
+
if (!this.controller)
|
|
2352
|
+
return;
|
|
2353
|
+
this.controller.requestFullscreen(true);
|
|
2354
|
+
}
|
|
2355
|
+
exitFullScreen() {
|
|
2356
|
+
if (!this.controller)
|
|
2357
|
+
return;
|
|
2358
|
+
this.controller.exitFullscreen();
|
|
2324
2359
|
}
|
|
2325
2360
|
}
|
|
2326
2361
|
|
|
@@ -2349,8 +2384,8 @@ class VideoContext {
|
|
|
2349
2384
|
const saveVideoToPhotosAlbumSchema = {
|
|
2350
2385
|
filePath: 'String'
|
|
2351
2386
|
};
|
|
2352
|
-
const createVideoContext = () => {
|
|
2353
|
-
return new VideoContext();
|
|
2387
|
+
const createVideoContext = (id, _) => {
|
|
2388
|
+
return new VideoContext(id);
|
|
2354
2389
|
};
|
|
2355
2390
|
// TODO: 1.返回属性补全
|
|
2356
2391
|
// TODO: 2.只支持从相册选择,补充摄像头拍摄功能,需要HarmonyOS提供选择组件
|