@tarojs/plugin-platform-harmony-ets 4.0.0-beta.65 → 4.0.0-beta.67

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.
@@ -3,19 +3,8 @@ import type { TaroAny, TaroMovableViewElement, TaroElement } from '@tarojs/runti
3
3
  import commonStyleModify, { rowModify, columnModify } from './style'
4
4
 
5
5
  import { FlexManager } from './utils/flexManager'
6
- import { isUndefined } from '@tarojs/shared'
7
6
 
8
- function callTouchEventFnFromGesture(node: TaroElement, eventName: string, gestureEvent: GestureEvent) {
9
- const touchFns = (node?.__listeners?.[eventName] || []) as Function[]
10
- touchFns.forEach(fn => {
11
- fn({
12
- changedTouches: gestureEvent.fingerList.map(finger => ({
13
- clientX: finger.globalX,
14
- clientY: finger.globalY
15
- }))
16
- })
17
- })
18
- }
7
+
19
8
 
20
9
  @Component
21
10
  export default struct TaroMovableView {
@@ -29,8 +18,8 @@ export default struct TaroMovableView {
29
18
  this.node._instance = this
30
19
 
31
20
  setTimeout(() => {
32
- const x = this.node.getAttribute('x') ? +this.node.getAttribute('x') : 0
33
- const y = this.node.getAttribute('y') ? +this.node.getAttribute('y') : 0
21
+ const x = this.node.getAttribute('x') ? Number(this.node.getAttribute('x')) : 0
22
+ const y = this.node.getAttribute('y') ? Number(this.node.getAttribute('y')) : 0
34
23
  this.node.checkPositionBoundary({ x, y }, this.node.scaleValue)
35
24
  }, 0)
36
25
  }
@@ -58,23 +47,23 @@ export default struct TaroMovableView {
58
47
  .translate({ x: this.node.position.x, y: this.node.position.y })
59
48
  .scale({ x: this.node.scaleValue, y: this.node.scaleValue })
60
49
  .onAreaChange((oldValue: Area, newValue: Area) => {
61
- this.node.selfSize = {w: Number(newValue.width), h: Number(newValue.height)}
50
+ this.node.selfSize = { w: Number(newValue.width), h: Number(newValue.height) }
62
51
  })
63
52
  .gesture(
64
53
  GestureGroup(GestureMode.Exclusive,
65
- PanGesture({fingers:1}).onActionStart((e: GestureEvent) => {
54
+ PanGesture({ fingers: 1 }).onActionStart((e: GestureEvent) => {
66
55
 
67
56
  this.node.startMove()
68
- callTouchEventFnFromGesture(this.node, 'touchstart', e)
57
+ this.node.callTouchEventFnFromGesture('touchstart', e)
69
58
  }).onActionUpdate((e: GestureEvent) => {
70
- callTouchEventFnFromGesture(this.node, 'touchmove', e)
59
+ this.node.callTouchEventFnFromGesture('touchmove', e)
71
60
  this.node.doMove({
72
61
  x: e.offsetX,
73
62
  y: e.offsetY
74
63
  })
75
64
 
76
- }).onActionEnd(() => {
77
- callTouchEventFnFromGesture(this.node, 'touchend', e)
65
+ }).onActionEnd((e: GestureEvent) => {
66
+ this.node.callTouchEventFnFromGesture('touchend', e)
78
67
  this.node.checkPositionBoundary(this.node.position, this.node.scaleValue)
79
68
  }),
80
69
  PinchGesture({ fingers: 2 }).onActionStart((event: GestureEvent) => {
@@ -95,7 +95,6 @@ export default struct TaroVideo {
95
95
  Video(getVideoData(this.node))
96
96
  .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
97
97
  .props(getVideoProps(this.node))
98
- .aspectRatio(4 / 3)
99
98
  .onStart(shouldBindEvent(() => { emitEvent(this.node, 'play') }, this.node, ['play']))
100
99
  .onPause(shouldBindEvent(() => { emitEvent(this.node, 'pause') }, this.node, ['pause']))
101
100
  .onFinish(shouldBindEvent(() => { emitEvent(this.node, 'ended') }, this.node, ['ended']))
@@ -194,4 +194,16 @@ export class TaroMovableViewElement extends TaroElement<MovableViewProps & { ani
194
194
 
195
195
  super.setAttribute(name, value)
196
196
  }
197
+
198
+ public callTouchEventFnFromGesture(eventName: string, gestureEvent: GestureEvent) {
199
+ const touchFns = (this?.__listeners?.[eventName] || []) as Function[]
200
+ touchFns.forEach(fn => {
201
+ fn({
202
+ changedTouches: gestureEvent.fingerList.map(finger => ({
203
+ clientX: finger.globalX,
204
+ clientY: finger.globalY
205
+ }))
206
+ })
207
+ })
208
+ }
197
209
  }
@@ -86,7 +86,6 @@ function stopOrTriggerPropagation (event: TaroEvent, node: TaroElement) {
86
86
 
87
87
  // eslint-disable-next-line no-unmodified-loop-condition
88
88
  while ((target = target.parentNode as TaroElement)) {
89
- event.currentTarget = target
90
89
  const listeners = target.__listeners[event.type]
91
90
 
92
91
  if (!Array.isArray(listeners) || target._attrs?.disabled) {
@@ -43,6 +43,8 @@ class TaroEventTarget extends Events {
43
43
  }
44
44
 
45
45
  public dispatchEvent (event: TaroEvent) {
46
+ // @ts-ignore
47
+ event.currentTarget = this
46
48
  const cancelable = event.cancelable
47
49
  const listeners = this.__listeners[event.type]
48
50
 
@@ -32,6 +32,7 @@ export class TaroNode extends TaroDataSourceElement {
32
32
  public parentNode: TaroNode | null = null
33
33
  public _nid: string = genId()
34
34
  public _doc: TaroDocument | null = null
35
+ public _instance?: TaroAny
35
36
 
36
37
  private _textContent = ''
37
38
 
@@ -78,7 +79,7 @@ export class TaroNode extends TaroDataSourceElement {
78
79
  // 更新对应的 ArkUI 组件
79
80
  public updateComponent () {
80
81
  // 非半编译模式或者半编译模式下拥有自主更新权力的节点走 @State 的更新模式
81
- if (this._isDynamicNode || !this._isCompileMode) {
82
+ if (this._isDynamicNode || (!this._isCompileMode && this._instance)) {
82
83
  this._updateTrigger++
83
84
  } else {
84
85
  this.parentNode?.updateComponent()
@@ -131,6 +132,9 @@ export class TaroNode extends TaroDataSourceElement {
131
132
  public set textContent (value: string) {
132
133
  if (this.nodeType === NodeType.TEXT_NODE) {
133
134
  this._textContent = value
135
+ if (!this._instance) {
136
+ this.updateComponent()
137
+ }
134
138
  } else if (this.nodeType === NodeType.ELEMENT_NODE) {
135
139
  const node = new TaroTextNode(value)
136
140
  node._doc = this.ownerDocument
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/plugin-platform-harmony-ets",
3
- "version": "4.0.0-beta.65",
3
+ "version": "4.0.0-beta.67",
4
4
  "description": "OpenHarmony & 鸿蒙系统插件",
5
5
  "author": "O2Team",
6
6
  "homepage": "https://gitee.com/openharmony-sig/taro",
@@ -25,13 +25,13 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "webpack-sources": "^3.2.3",
28
- "@tarojs/components": "4.0.0-beta.65",
29
- "@tarojs/helper": "4.0.0-beta.65",
30
- "@tarojs/runner-utils": "4.0.0-beta.65",
31
- "@tarojs/runtime": "4.0.0-beta.65",
32
- "@tarojs/shared": "4.0.0-beta.65",
33
- "@tarojs/taro": "4.0.0-beta.65",
34
- "@tarojs/service": "4.0.0-beta.65"
28
+ "@tarojs/components": "4.0.0-beta.67",
29
+ "@tarojs/runner-utils": "4.0.0-beta.67",
30
+ "@tarojs/helper": "4.0.0-beta.67",
31
+ "@tarojs/runtime": "4.0.0-beta.67",
32
+ "@tarojs/service": "4.0.0-beta.67",
33
+ "@tarojs/shared": "4.0.0-beta.67",
34
+ "@tarojs/taro": "4.0.0-beta.67"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@rollup/plugin-commonjs": "^25.0.7",
@@ -44,7 +44,7 @@
44
44
  "solid-js": "^1.8.16",
45
45
  "tslib": "^2.4.0",
46
46
  "typescript": "^4.8.2",
47
- "rollup-plugin-copy": "4.0.0-beta.65"
47
+ "rollup-plugin-copy": "4.0.0-beta.67"
48
48
  },
49
49
  "scripts": {
50
50
  "prebuild": "rimraf ./dist",