@tarojs/plugin-platform-harmony-ets 4.0.0-beta.33 → 4.0.0-beta.35
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/wxml/selectorQuery.ts +18 -9
- package/dist/components-harmony-ets/index.ets +2 -1
- package/dist/components-harmony-ets/style.ets +8 -3
- package/dist/index.js +3 -5
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/bom/document.ts +4 -0
- package/dist/runtime-ets/dom/document.ts +4 -0
- package/dist/runtime-ets/dom/element/element.ts +25 -1
- package/dist/runtime-ets/dom/element/normal.ts +10 -1
- package/dist/runtime-ets/dom/node.ts +12 -0
- package/dist/runtime-utils.js +16 -6
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +16 -6
- package/dist/runtime.js.map +1 -1
- package/package.json +9 -9
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { eventSource } from '@tarojs/runtime/dist/runtime.esm'
|
|
2
2
|
import { EMPTY_OBJ, toCamelCase } from '@tarojs/shared'
|
|
3
3
|
|
|
4
|
+
import { document } from '../../bom/document'
|
|
4
5
|
import { ATTRIBUTES_CALLBACK_TRIGGER_MAP, ID } from '../../constant'
|
|
5
6
|
import { findChildNodeWithDFS } from '../../utils'
|
|
6
7
|
import { initComponentNodeInfo, triggerAttributesCallback } from '../../utils/info'
|
|
@@ -27,7 +28,10 @@ export class TaroElement<
|
|
|
27
28
|
> extends TaroNode {
|
|
28
29
|
public _innerHTML = ''
|
|
29
30
|
public _instance: TaroAny
|
|
30
|
-
public _nodeInfo: TaroAny = {
|
|
31
|
+
public _nodeInfo: TaroAny = {
|
|
32
|
+
layer: 0 // 渲染层级
|
|
33
|
+
}
|
|
34
|
+
|
|
31
35
|
public readonly tagName: string
|
|
32
36
|
public dataset: Record<string, unknown> = EMPTY_OBJ
|
|
33
37
|
public _attrs: T & TaroExtraProps = {} as T & TaroExtraProps
|
|
@@ -237,4 +241,24 @@ export class TaroElement<
|
|
|
237
241
|
this._pseudo_class[name] = null
|
|
238
242
|
}
|
|
239
243
|
}
|
|
244
|
+
|
|
245
|
+
// 设置渲染层级,0为正常层级,大于0为固定层级
|
|
246
|
+
public setLayer (value: number) {
|
|
247
|
+
this._nodeInfo.layer = value
|
|
248
|
+
|
|
249
|
+
if (value > 0) {
|
|
250
|
+
// 插入到root层
|
|
251
|
+
document.fixedLayer.childNodes.push(this)
|
|
252
|
+
document.fixedLayer.notifyDataAdd(document.fixedLayer.childNodes.length - 1)
|
|
253
|
+
} else {
|
|
254
|
+
const idx = document.fixedLayer.childNodes.findIndex(n => n._nid === this._nid)
|
|
255
|
+
document.fixedLayer.childNodes.splice(idx, 1)
|
|
256
|
+
document.fixedLayer.notifyDataDelete(idx)
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (this.parentNode) {
|
|
260
|
+
this.parentNode.notifyDataChange(this.parentNode.findIndex(this))
|
|
261
|
+
this.updateComponent()
|
|
262
|
+
}
|
|
263
|
+
}
|
|
240
264
|
}
|
|
@@ -69,7 +69,16 @@ class TaroSwiperItemElement extends TaroElement<SwiperItemProps>{
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
// Fixed浮层节点树
|
|
73
|
+
@Observed
|
|
74
|
+
class FixedLayer extends TaroElement {
|
|
75
|
+
constructor() {
|
|
76
|
+
super('View')
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
72
80
|
export {
|
|
81
|
+
FixedLayer,
|
|
73
82
|
TaroButtonElement,
|
|
74
83
|
TaroIconElement,
|
|
75
84
|
TaroImageElement,
|
|
@@ -77,5 +86,5 @@ export {
|
|
|
77
86
|
TaroRichTextElement,
|
|
78
87
|
TaroSwiperElement,
|
|
79
88
|
TaroSwiperItemElement,
|
|
80
|
-
TaroViewElement
|
|
89
|
+
TaroViewElement
|
|
81
90
|
}
|
|
@@ -85,6 +85,11 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
// 提供唯一标识,方便与小程序一致,能根据uid获取到对应的节点
|
|
89
|
+
public get uid (): string {
|
|
90
|
+
return this._nid
|
|
91
|
+
}
|
|
92
|
+
|
|
88
93
|
public get firstChild (): TaroNode | null{
|
|
89
94
|
return this.childNodes[0] || null
|
|
90
95
|
}
|
|
@@ -215,6 +220,13 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
215
220
|
const idx = this.findIndex(child)
|
|
216
221
|
if (idx < 0) throw new Error('TaroNode:removeChild NotFoundError')
|
|
217
222
|
|
|
223
|
+
// 渲染,层级大于0的节点需要让其回到正常层级,然后删掉
|
|
224
|
+
// @ts-ignore
|
|
225
|
+
if (child._nodeInfo?.layer > 0) {
|
|
226
|
+
// @ts-ignore
|
|
227
|
+
child.setLayer(0) // 删除固定层级上的节点
|
|
228
|
+
}
|
|
229
|
+
|
|
218
230
|
this.childNodes.splice(idx, 1)
|
|
219
231
|
child.dispose()
|
|
220
232
|
this.notifyDataDelete(idx)
|
package/dist/runtime-utils.js
CHANGED
|
@@ -4350,19 +4350,29 @@ function queryBat(queue, cb) {
|
|
|
4350
4350
|
return null;
|
|
4351
4351
|
arr = [];
|
|
4352
4352
|
traversalDFSDom(element);
|
|
4353
|
-
queue.forEach(item => {
|
|
4353
|
+
queue.forEach((item) => {
|
|
4354
4354
|
const { selector, single, fields } = item;
|
|
4355
|
-
|
|
4356
|
-
|
|
4355
|
+
if (single) {
|
|
4356
|
+
const dom = querySelector(selector, !single)[0];
|
|
4357
4357
|
// eslint-disable-next-line no-async-promise-executor
|
|
4358
|
-
|
|
4358
|
+
result.push(new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
4359
4359
|
yield setNodeEventCallbackAndTriggerComponentUpdate(dom, AREA_CHANGE_EVENT_NAME, null, true);
|
|
4360
4360
|
resolve(filter(fields, dom));
|
|
4361
|
+
})));
|
|
4362
|
+
}
|
|
4363
|
+
else {
|
|
4364
|
+
const nodeList = querySelector(selector, !single);
|
|
4365
|
+
result.push(nodeList.map(dom => {
|
|
4366
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
4367
|
+
return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
4368
|
+
yield setNodeEventCallbackAndTriggerComponentUpdate(dom, AREA_CHANGE_EVENT_NAME, null, true);
|
|
4369
|
+
resolve(filter(fields, dom));
|
|
4370
|
+
}));
|
|
4361
4371
|
}));
|
|
4362
|
-
}
|
|
4372
|
+
}
|
|
4363
4373
|
});
|
|
4364
4374
|
Promise.all(result.map(item => {
|
|
4365
|
-
return Promise.all(item);
|
|
4375
|
+
return item instanceof Array ? Promise.all(item) : item;
|
|
4366
4376
|
})).then(data => {
|
|
4367
4377
|
cb(data);
|
|
4368
4378
|
});
|