@tarojs/plugin-platform-harmony-ets 3.7.0-alpha.27 → 4.0.0-alpha.10
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/apis.ts +6 -2
- package/dist/apis/base/crypto.ts +4 -0
- package/dist/apis/base/debug.ts +5 -0
- package/dist/apis/base/index.ts +9 -1
- package/dist/apis/base/performance.ts +8 -0
- package/dist/apis/base/system.ts +74 -21
- package/dist/apis/base/update.ts +5 -0
- package/dist/apis/base/weapp/app-event.ts +75 -0
- package/dist/apis/base/weapp/life-cycle.ts +21 -0
- package/dist/apis/canvas/index.ts +27 -0
- package/dist/apis/data-analysis/index.ts +6 -0
- package/dist/apis/device/accelerometer.ts +2 -1
- package/dist/apis/device/accessibility.ts +4 -0
- package/dist/apis/device/battery.ts +2 -2
- package/dist/apis/device/bluetooth-ble.ts +19 -0
- package/dist/apis/device/bluetooth-peripheral.ts +6 -0
- package/dist/apis/device/bluetooth.ts +16 -0
- package/dist/apis/device/calendar.ts +5 -0
- package/dist/apis/device/clipboard.ts +17 -9
- package/dist/apis/device/compass.ts +21 -0
- package/dist/apis/device/contact.ts +5 -0
- package/dist/apis/device/crypto.ts +4 -0
- package/dist/apis/device/gyroscope.ts +7 -0
- package/dist/apis/device/iBeacon.ts +10 -0
- package/dist/apis/device/index.ts +15 -0
- package/dist/apis/device/keyboard.ts +2 -1
- package/dist/apis/device/memory.ts +10 -3
- package/dist/apis/device/motion.ts +6 -0
- package/dist/apis/device/network.ts +26 -9
- package/dist/apis/device/nfc.ts +10 -0
- package/dist/apis/device/phone.ts +2 -1
- package/dist/apis/device/scan.ts +4 -0
- package/dist/apis/device/screen.ts +2 -1
- package/dist/apis/device/sms.ts +4 -0
- package/dist/apis/device/vibrate.ts +19 -11
- package/dist/apis/device/wifi.ts +15 -0
- package/dist/apis/ext/index.ts +5 -0
- package/dist/apis/files/index.ts +2 -1
- package/dist/apis/files/manager.ts +2 -1
- package/dist/apis/framework/index.ts +3 -8
- package/dist/apis/index.ts +27 -17
- package/dist/apis/location/index.ts +61 -68
- package/dist/apis/media/EditorContext.ts +32 -0
- package/dist/apis/media/audio/index.ts +18 -0
- package/dist/apis/media/background-audio/index.ts +16 -0
- package/dist/apis/media/camera.ts +16 -0
- package/dist/apis/media/common.ts +2 -1
- package/dist/apis/media/{image.ts → image/index.ts} +4 -3
- package/dist/apis/media/index.ts +10 -0
- package/dist/apis/media/live.ts +5 -0
- package/dist/apis/media/map.ts +4 -0
- package/dist/apis/media/media-recorder.ts +4 -0
- package/dist/apis/media/recorder.ts +6 -0
- package/dist/apis/media/video/VideoContext.ts +68 -0
- package/dist/apis/media/{video.ts → video/index.ts} +13 -2
- package/dist/apis/media/video-decoder.ts +4 -0
- package/dist/apis/media/video-processing.ts +4 -0
- package/dist/apis/media/voip.ts +19 -0
- package/dist/apis/network/index.ts +3 -0
- package/dist/apis/network/mdns.ts +13 -0
- package/dist/apis/network/request.ts +7 -6
- package/dist/apis/network/tcp.ts +4 -0
- package/dist/apis/network/udp.ts +4 -0
- package/dist/apis/network/webSocket.ts +2 -6
- package/dist/apis/open-api/account.ts +4 -0
- package/dist/apis/open-api/address.ts +4 -0
- package/dist/apis/open-api/authorize.ts +5 -0
- package/dist/apis/open-api/card.ts +5 -0
- package/dist/apis/open-api/channels-live.ts +11 -0
- package/dist/apis/open-api/customer-service.ts +4 -0
- package/dist/apis/open-api/device-voip.ts +5 -0
- package/dist/apis/open-api/facial.ts +7 -0
- package/dist/apis/open-api/favorites.ts +5 -0
- package/dist/apis/open-api/group.ts +4 -0
- package/dist/apis/open-api/index.ts +20 -6
- package/dist/apis/open-api/invoice.ts +5 -0
- package/dist/apis/open-api/license-plate.ts +4 -0
- package/dist/apis/open-api/login.ts +6 -0
- package/dist/apis/open-api/my-miniprogram.ts +4 -0
- package/dist/apis/open-api/privacy.ts +7 -0
- package/dist/apis/open-api/red-package.ts +4 -0
- package/dist/apis/open-api/settings.ts +5 -0
- package/dist/apis/open-api/soter.ts +6 -0
- package/dist/apis/open-api/subscribe-message.ts +6 -0
- package/dist/apis/open-api/{user-info/index.ts → user-info.ts} +1 -16
- package/dist/apis/open-api/werun.ts +5 -0
- package/dist/apis/payment/index.ts +6 -0
- package/dist/apis/route/index.ts +19 -28
- package/dist/apis/share/index.ts +33 -0
- package/dist/apis/storage/background-fetch.ts +7 -0
- package/dist/apis/storage/cache-manager.ts +4 -0
- package/dist/apis/storage/index.ts +158 -88
- package/dist/apis/ui/{animation.ts → animation/animation.ts} +73 -31
- package/dist/apis/ui/animation/index.ts +7 -0
- package/dist/apis/ui/background.ts +4 -19
- package/dist/apis/ui/custom-component.ts +8 -0
- package/dist/apis/ui/fonts.ts +4 -0
- package/dist/apis/ui/index.ts +8 -10
- package/dist/apis/ui/interaction/index.ts +45 -59
- package/dist/apis/ui/menu.ts +4 -0
- package/dist/apis/ui/navigation-bar/index.ts +60 -21
- package/dist/apis/ui/pull-down-refresh.ts +10 -4
- package/dist/apis/{page → ui/scroll}/index.ts +32 -27
- package/dist/apis/ui/sticky.ts +4 -0
- package/dist/apis/{tabbar/index.ts → ui/tab-bar.ts} +6 -8
- package/dist/apis/ui/window.ts +20 -0
- package/dist/apis/utils/handler.ts +4 -4
- package/dist/apis/utils/index.ts +1 -1
- package/dist/apis/worker/index.ts +4 -0
- package/dist/apis/wxml/IntersectionObserver.ts +24 -25
- package/dist/apis/wxml/index.ts +7 -2
- package/dist/apis/wxml/nodesRef.ts +2 -2
- package/dist/apis/wxml/selectorQuery.ts +29 -17
- package/dist/components-harmony-ets/button.ets +106 -80
- package/dist/components-harmony-ets/canvas.ets +51 -0
- package/dist/components-harmony-ets/checkbox.ets +82 -148
- package/dist/components-harmony-ets/form.ets +45 -132
- package/dist/components-harmony-ets/icon.ets +66 -69
- package/dist/components-harmony-ets/image.ets +26 -61
- package/dist/components-harmony-ets/index.ets +92 -0
- package/dist/components-harmony-ets/innerHtml.ets +7 -70
- package/dist/components-harmony-ets/input.ets +60 -146
- package/dist/components-harmony-ets/label.ets +86 -92
- package/dist/components-harmony-ets/listView.ets +26 -0
- package/dist/components-harmony-ets/movableArea.ets +124 -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 +172 -198
- 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 +85 -155
- package/dist/components-harmony-ets/richText.ets +15 -87
- package/dist/components-harmony-ets/scrollList.ets +94 -0
- package/dist/components-harmony-ets/scrollView.ets +81 -149
- package/dist/components-harmony-ets/slider.ets +47 -94
- package/dist/components-harmony-ets/stickySection.ets +42 -0
- package/dist/components-harmony-ets/style.ets +396 -0
- package/dist/components-harmony-ets/swiper.ets +51 -151
- package/dist/components-harmony-ets/switch.ets +35 -76
- package/dist/components-harmony-ets/{index.ts → tag.ts} +6 -0
- package/dist/components-harmony-ets/text.ets +131 -76
- package/dist/components-harmony-ets/textArea.ets +64 -140
- package/dist/components-harmony-ets/utils/AttributeManager.ets +1 -1
- package/dist/components-harmony-ets/utils/DynamicCenter.ts +4 -13
- package/dist/components-harmony-ets/utils/constant/style.ets +9 -6
- package/dist/components-harmony-ets/utils/flexManager.ets +68 -85
- package/dist/components-harmony-ets/utils/helper.ets +18 -65
- 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 +55 -51
- package/dist/components-harmony-ets/utils/styles.ets +177 -65
- package/dist/components-harmony-ets/video.ets +70 -116
- package/dist/components-harmony-ets/view.ets +58 -64
- package/dist/components-harmony-ets/webView.ets +56 -0
- package/dist/index.d.ts +152 -0
- package/dist/index.js +230 -60
- 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 +9 -2
- package/dist/runtime-ets/current.ts +3 -0
- package/dist/runtime-ets/dom/bind.ts +96 -0
- package/dist/runtime-ets/dom/class-list.ts +4 -6
- package/dist/runtime-ets/dom/comment.ts +1 -2
- package/dist/runtime-ets/dom/cssNesting.ts +409 -0
- package/dist/runtime-ets/dom/cssStyleDeclaration.ts +30 -20
- package/dist/runtime-ets/dom/dataSource.ts +64 -0
- package/dist/runtime-ets/dom/document.ts +36 -51
- package/dist/runtime-ets/dom/element/canvas.ts +136 -0
- package/dist/runtime-ets/dom/element/element.ts +439 -0
- package/dist/runtime-ets/dom/element/form.ts +403 -0
- package/dist/runtime-ets/dom/element/index.ts +120 -0
- package/dist/runtime-ets/dom/element/movableArea.ts +11 -0
- package/dist/runtime-ets/dom/element/movableView.ts +242 -0
- package/dist/runtime-ets/dom/element/normal.ts +103 -0
- package/dist/runtime-ets/dom/element/progress.ts +11 -0
- package/dist/runtime-ets/dom/element/scrollView.ts +15 -0
- package/dist/runtime-ets/dom/element/text.ts +10 -0
- package/dist/runtime-ets/dom/element/video.ts +50 -0
- package/dist/runtime-ets/dom/element/webView.ts +68 -0
- package/dist/runtime-ets/dom/event.ts +26 -5
- package/dist/runtime-ets/dom/eventTarget.ts +3 -3
- package/dist/runtime-ets/dom/node.ts +114 -49
- package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +805 -0
- package/dist/runtime-ets/dom/stylesheet/index.ts +122 -429
- package/dist/runtime-ets/dom/stylesheet/type.ts +93 -17
- package/dist/runtime-ets/dom/stylesheet/util.ts +145 -17
- package/dist/runtime-ets/index.ts +2 -3
- package/dist/runtime-ets/interface/event.ts +3 -2
- package/dist/runtime-ets/utils/index.ts +87 -17
- package/dist/runtime-ets/utils/info.ts +21 -47
- package/dist/runtime-framework/react/app.ts +20 -28
- package/dist/runtime-framework/react/hooks.ts +3 -4
- package/dist/runtime-framework/react/index.ts +1 -2
- package/dist/runtime-framework/react/native-page.ts +421 -0
- package/dist/runtime-framework/react/page.ts +5 -17
- package/dist/runtime-framework/solid/app.ts +25 -45
- package/dist/runtime-framework/solid/connect.ts +21 -3
- package/dist/runtime-framework/solid/hooks.ts +17 -12
- package/dist/runtime-framework/solid/index.ts +6 -2
- package/dist/runtime-framework/solid/page.ts +84 -36
- 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 +0 -2
- package/dist/runtime-utils.d.ts +827 -0
- package/dist/runtime-utils.js +1633 -549
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +1633 -549
- package/dist/runtime.js.map +1 -1
- package/index.js +3 -1
- package/package.json +14 -15
- 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
- package/types/harmony.d.ts +4 -0
- package/types/index.d.ts +4 -0
- package/types/runtime.d.ts +7 -1
- package/LICENSE +0 -160
- package/dist/components-harmony-ets/base.ets +0 -63
- package/dist/components-harmony-ets/element.ets +0 -223
- package/dist/components-harmony-ets/utils/constant/icon.ts +0 -19
- package/dist/runtime-ets/dom/element.ts +0 -457
- package/dist/runtime-ets/dom/text.ts +0 -19
- package/dist/runtime-ets/utils/bind.ts +0 -35
- package/types/api.d.ts +0 -4
- /package/dist/runtime-framework/solid/{contant.ts → constant.ts} +0 -0
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { eventSource } from '@tarojs/runtime/dist/runtime.esm'
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import TaroDataSourceElement from './dataSource'
|
|
4
4
|
|
|
5
|
+
import type { StandardProps } from '@tarojs/components/types'
|
|
6
|
+
import type { TaroAny } from '../utils'
|
|
5
7
|
import type { TaroDocument } from './document'
|
|
6
|
-
import type { TaroElement } from './element'
|
|
8
|
+
import type { TaroElement } from './element/element'
|
|
7
9
|
|
|
8
10
|
export enum NodeType {
|
|
9
11
|
ELEMENT_NODE = 1,
|
|
@@ -23,45 +25,73 @@ function genId (): string {
|
|
|
23
25
|
return `_n_${_id++}`
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
export class TaroNode extends
|
|
28
|
+
export class TaroNode extends TaroDataSourceElement {
|
|
27
29
|
public readonly nodeName: string
|
|
28
30
|
public readonly nodeType: NodeType
|
|
29
31
|
public childNodes: TaroNode[] = []
|
|
30
32
|
public parentNode: TaroNode | null = null
|
|
31
33
|
public _nid: string = genId()
|
|
34
|
+
public _doc: TaroDocument | null = null
|
|
35
|
+
public _instance?: TaroAny
|
|
32
36
|
|
|
33
|
-
|
|
37
|
+
private _textContent = ''
|
|
38
|
+
|
|
39
|
+
// 以下属性为半编译模式下才会赋值和使用的属性
|
|
40
|
+
// 半编译节点更新触发器
|
|
41
|
+
public _updateTrigger = 0
|
|
34
42
|
// 是否为半编译模板下的节点
|
|
35
43
|
public _isCompileMode = false
|
|
36
44
|
// 是否为半编译模板下拥有自主更新权的节点
|
|
37
45
|
public _isDynamicNode = false
|
|
38
|
-
public _instance: any
|
|
39
46
|
|
|
40
|
-
|
|
41
|
-
private _textContent = ''
|
|
42
|
-
|
|
43
|
-
constructor(nodeName, nodeType = NodeType.ELEMENT_NODE) {
|
|
47
|
+
constructor(nodeName: string, nodeType = NodeType.ELEMENT_NODE) {
|
|
44
48
|
super()
|
|
49
|
+
|
|
45
50
|
this.nodeType = nodeType
|
|
46
51
|
this.nodeName = nodeName
|
|
47
|
-
eventSource.set(this._nid, this as
|
|
52
|
+
eventSource.set(this._nid, this as TaroAny)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
totalCount(): number {
|
|
56
|
+
return this.childNodes?.length || 0
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
getData(index: number): TaroElement<StandardProps> {
|
|
60
|
+
return this.childNodes[index] as TaroElement
|
|
48
61
|
}
|
|
49
62
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
63
|
+
public findIndex (refChild?: TaroNode): number {
|
|
64
|
+
return this.childNodes.findIndex(node => node._nid === refChild?._nid)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public updateTextNode () {
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
if (this.childNodes.length <= 0 || this.tagName !== 'VIEW') return
|
|
70
|
+
|
|
71
|
+
// TextNode 不具备 props 更新能力,需要由父节点来进行触发
|
|
72
|
+
this.childNodes.forEach(item => {
|
|
73
|
+
if (item.nodeType !== NodeType.TEXT_NODE) return
|
|
74
|
+
|
|
75
|
+
item._updateTrigger++
|
|
76
|
+
})
|
|
53
77
|
}
|
|
54
78
|
|
|
55
79
|
// 更新对应的 ArkUI 组件
|
|
56
80
|
public updateComponent () {
|
|
57
|
-
|
|
58
|
-
|
|
81
|
+
// 非半编译模式或者半编译模式下拥有自主更新权力的节点走 @State 的更新模式
|
|
82
|
+
if (this._isDynamicNode || (!this._isCompileMode && this._instance)) {
|
|
83
|
+
this._updateTrigger++
|
|
59
84
|
} else {
|
|
60
85
|
this.parentNode?.updateComponent()
|
|
61
86
|
}
|
|
62
87
|
}
|
|
63
88
|
|
|
64
|
-
|
|
89
|
+
// 提供唯一标识,方便与小程序一致,能根据uid获取到对应的节点
|
|
90
|
+
public get uid (): string {
|
|
91
|
+
return this._nid
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
public get firstChild (): TaroNode | null {
|
|
65
95
|
return this.childNodes[0] || null
|
|
66
96
|
}
|
|
67
97
|
|
|
@@ -102,15 +132,15 @@ export class TaroNode extends TaroEventTarget {
|
|
|
102
132
|
public set textContent (value: string) {
|
|
103
133
|
if (this.nodeType === NodeType.TEXT_NODE) {
|
|
104
134
|
this._textContent = value
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
// } else {
|
|
109
|
-
// this._textContent = value
|
|
110
|
-
// }
|
|
135
|
+
if (!this._instance) {
|
|
136
|
+
this.updateComponent()
|
|
137
|
+
}
|
|
111
138
|
} else if (this.nodeType === NodeType.ELEMENT_NODE) {
|
|
112
|
-
const
|
|
113
|
-
|
|
139
|
+
const node = new TaroTextNode(value)
|
|
140
|
+
node._doc = this.ownerDocument
|
|
141
|
+
node.parentNode = this
|
|
142
|
+
this.childNodes.length = 0
|
|
143
|
+
this.childNodes.push(node)
|
|
114
144
|
}
|
|
115
145
|
}
|
|
116
146
|
|
|
@@ -125,13 +155,13 @@ export class TaroNode extends TaroEventTarget {
|
|
|
125
155
|
}
|
|
126
156
|
}
|
|
127
157
|
|
|
128
|
-
public set nodeValue (value: string) {
|
|
129
|
-
if (this.nodeType === NodeType.TEXT_NODE) {
|
|
158
|
+
public set nodeValue (value: string | null) {
|
|
159
|
+
if (this.nodeType === NodeType.TEXT_NODE && value) {
|
|
130
160
|
this.textContent = value
|
|
131
161
|
}
|
|
132
162
|
}
|
|
133
163
|
|
|
134
|
-
public get ownerDocument (): TaroDocument {
|
|
164
|
+
public get ownerDocument (): TaroDocument | null {
|
|
135
165
|
return this._doc
|
|
136
166
|
}
|
|
137
167
|
|
|
@@ -140,29 +170,37 @@ export class TaroNode extends TaroEventTarget {
|
|
|
140
170
|
}
|
|
141
171
|
|
|
142
172
|
// TODO cloneNode()、contains()
|
|
143
|
-
|
|
144
|
-
public appendChild (child: TaroNode): TaroNode {
|
|
173
|
+
public connectParentNode (child: TaroNode) {
|
|
145
174
|
child.parentNode?.removeChild(child)
|
|
146
175
|
child.parentNode = this
|
|
147
|
-
|
|
148
|
-
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
public appendChild (child: TaroNode): TaroNode {
|
|
179
|
+
this.connectParentNode(child)
|
|
180
|
+
this.childNodes.push(child)
|
|
181
|
+
this.notifyDataAdd(this.childNodes.length - 1)
|
|
182
|
+
|
|
183
|
+
// @ts-ignore
|
|
184
|
+
child.toggleLayer?.(true)
|
|
149
185
|
|
|
150
186
|
checkIsCompileModeAndInstallAfterDOMAction(child, this)
|
|
151
187
|
return child
|
|
152
188
|
}
|
|
153
189
|
|
|
154
|
-
public insertBefore (newNode: TaroNode, referenceNode
|
|
190
|
+
public insertBefore (newNode: TaroNode, referenceNode?: TaroNode): TaroNode {
|
|
155
191
|
newNode.parentNode?.removeChild(newNode)
|
|
156
192
|
|
|
157
|
-
if (referenceNode
|
|
193
|
+
if (!referenceNode) {
|
|
158
194
|
this.appendChild(newNode)
|
|
159
195
|
} else {
|
|
160
196
|
const idxOfRef = this.findIndex(referenceNode)
|
|
161
|
-
this.childNodes
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
197
|
+
this.childNodes.splice(idxOfRef, 0, newNode)
|
|
198
|
+
this.connectParentNode(newNode)
|
|
199
|
+
// TODO: 优化
|
|
200
|
+
this.notifyDataReload()
|
|
201
|
+
|
|
202
|
+
// @ts-ignore
|
|
203
|
+
newNode.toggleLayer?.(true)
|
|
166
204
|
}
|
|
167
205
|
|
|
168
206
|
checkIsCompileModeAndInstallAfterDOMAction(newNode, this)
|
|
@@ -177,12 +215,11 @@ export class TaroNode extends TaroEventTarget {
|
|
|
177
215
|
|
|
178
216
|
if (idxOfRef < 0) throw new Error('TaroNode:replaceChild NotFoundError')
|
|
179
217
|
|
|
180
|
-
this.childNodes =
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
...this.childNodes.slice(idxOfRef + 1)
|
|
184
|
-
]
|
|
218
|
+
this.childNodes[idxOfRef] = newChild
|
|
219
|
+
oldChild.dispose()
|
|
220
|
+
this.notifyDataChange(idxOfRef)
|
|
185
221
|
|
|
222
|
+
checkIsCompileModeAndUninstallAfterDOMAction(oldChild)
|
|
186
223
|
checkIsCompileModeAndInstallAfterDOMAction(newChild, this)
|
|
187
224
|
|
|
188
225
|
return oldChild
|
|
@@ -194,22 +231,50 @@ export class TaroNode extends TaroEventTarget {
|
|
|
194
231
|
const idx = this.findIndex(child)
|
|
195
232
|
if (idx < 0) throw new Error('TaroNode:removeChild NotFoundError')
|
|
196
233
|
|
|
197
|
-
this.childNodes
|
|
234
|
+
this.childNodes.splice(idx, 1)
|
|
235
|
+
child.dispose()
|
|
236
|
+
this.notifyDataDelete(idx)
|
|
198
237
|
|
|
199
238
|
checkIsCompileModeAndUninstallAfterDOMAction(child)
|
|
200
239
|
|
|
201
240
|
return child
|
|
202
241
|
}
|
|
242
|
+
|
|
243
|
+
public dispose () {
|
|
244
|
+
// 渲染,层级大于0的节点需要让其回到正常层级,然后删掉
|
|
245
|
+
// @ts-ignore
|
|
246
|
+
this.toggleLayer?.(false)
|
|
247
|
+
|
|
248
|
+
this.parentNode = null
|
|
249
|
+
this.childNodes = []
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
@Observed
|
|
254
|
+
export class TaroTextNode extends TaroNode {
|
|
255
|
+
constructor(value = '', nodeName = '#text', nodeType: NodeType = NodeType.TEXT_NODE) {
|
|
256
|
+
super(nodeName, nodeType)
|
|
257
|
+
this.textContent = value
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
public get data (): string {
|
|
261
|
+
return this.textContent
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
public set data (value: string) {
|
|
265
|
+
this.textContent = value
|
|
266
|
+
}
|
|
203
267
|
}
|
|
204
268
|
|
|
205
269
|
function checkIsCompileModeAndInstallAfterDOMAction (node: TaroNode, parentNode: TaroNode) {
|
|
206
|
-
if (!parentNode._isCompileMode) return
|
|
270
|
+
if (!parentNode._isCompileMode || !parentNode._instance) return
|
|
207
271
|
|
|
208
|
-
parentNode._instance
|
|
272
|
+
parentNode._instance.dynamicCenter?.install?.(node, parentNode)
|
|
273
|
+
node.updateComponent()
|
|
209
274
|
}
|
|
210
275
|
|
|
211
276
|
function checkIsCompileModeAndUninstallAfterDOMAction (node: TaroNode) {
|
|
212
|
-
if (!node._isCompileMode) return
|
|
277
|
+
if (!node._isCompileMode || !node?._instance) return
|
|
213
278
|
|
|
214
|
-
node._instance
|
|
215
|
-
}
|
|
279
|
+
node._instance.dynamicCenter?.uninstall?.(node)
|
|
280
|
+
}
|