zzz-pc-view 0.0.60 → 0.0.61
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/package.json +1 -1
- package/src/index.es.js +28 -11
- package/src/index.umd.js +1 -1
- package/src/utils/class/bind.d.ts +12 -10
package/package.json
CHANGED
package/src/index.es.js
CHANGED
|
@@ -84,19 +84,23 @@ class WithPrototype {
|
|
|
84
84
|
* @param data - 要绑定原型的对象。
|
|
85
85
|
* @returns 一个新的对象,绑定了当前类的原型。
|
|
86
86
|
*/
|
|
87
|
-
static bindObject(data) {
|
|
87
|
+
static bindObject(data, ...extras) {
|
|
88
88
|
return Object.setPrototypeOf(data, this.prototype);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
class WithNew extends WithPrototype {
|
|
92
92
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* @
|
|
93
|
+
* 静态方法,用于创建一个新的对象实例,并将传入的数据和额外参数传递给构造函数。
|
|
94
|
+
* 此方法会调用当前类的构造函数来创建新实例,从而确保对象的初始化。
|
|
95
|
+
*
|
|
96
|
+
* @template Class 类的类型,必须是继承自 WithNew 且符合 CombineClass 接口的类。
|
|
97
|
+
* @param this 当前类的引用。
|
|
98
|
+
* @param data 要绑定原型的对象。
|
|
99
|
+
* @param {...any[]} extras 传递给构造函数的额外参数。
|
|
100
|
+
* @returns 一个新的对象实例,绑定了当前类的原型。
|
|
97
101
|
*/
|
|
98
|
-
static bindObject(data) {
|
|
99
|
-
return new this(data);
|
|
102
|
+
static bindObject(data, ...extras) {
|
|
103
|
+
return new this(data, ...extras);
|
|
100
104
|
}
|
|
101
105
|
}
|
|
102
106
|
const encrypt = (secretKey, str) => CryptoJS.DES.encrypt(str, CryptoJS.enc.Utf8.parse(secretKey), {
|
|
@@ -3084,10 +3088,23 @@ const setList = (config, list2) => {
|
|
|
3084
3088
|
if (list2.length > 0 && !(list2[0] instanceof target)) {
|
|
3085
3089
|
const { childrenKey } = config;
|
|
3086
3090
|
if (childrenKey) {
|
|
3087
|
-
const
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
+
const buildList = [[object, list2]];
|
|
3092
|
+
for (
|
|
3093
|
+
let itemList;
|
|
3094
|
+
// 从构建列表中取出一个元素,并赋值给 itemList,如果构建列表为空,则赋值为 undefined
|
|
3095
|
+
itemList = buildList.shift();
|
|
3096
|
+
) {
|
|
3097
|
+
const [parent, nodes] = itemList;
|
|
3098
|
+
const nodesLen = nodes.length;
|
|
3099
|
+
for (let i = 0; i < nodesLen; i++) {
|
|
3100
|
+
const node = nodes[i];
|
|
3101
|
+
nodes[i] = target.bindObject(node, parent);
|
|
3102
|
+
const children = node[childrenKey];
|
|
3103
|
+
if (Array.isArray(children) && children.length > 0) {
|
|
3104
|
+
buildList.push([node, children]);
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3107
|
+
}
|
|
3091
3108
|
} else {
|
|
3092
3109
|
list2 = target.bindList(list2);
|
|
3093
3110
|
}
|