@zhongguo168a/yxeditor-common 0.0.175 → 0.0.178

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/index.d.ts CHANGED
@@ -462,7 +462,7 @@ declare class TreeNode<T = any> {
462
462
  * @param mode
463
463
  * @returns
464
464
  */
465
- toArray(mode: "BFS" | "DFS"): TreeNode[];
465
+ toArray(mode?: "BFS" | "DFS"): TreeNode[];
466
466
  /**
467
467
  * 广度优先遍历(BFS):从当前节点开始,逐层遍历子树
468
468
  * @param f - 节点处理函数,返回 false 表示停止遍历
@@ -651,10 +651,10 @@ declare class List<T = any> {
651
651
  clear(useIter?: boolean): void;
652
652
  /**
653
653
  * 克隆自身所有项到【target】对象,并返回【target】对象
654
- * @param target
654
+ * @param target 如果为空,则创建一个List
655
655
  * @param useIter 使用遍历的方式可以触发onSet
656
656
  */
657
- clone(target: this, useIter?: boolean): this;
657
+ clone(target?: List, useIter?: boolean): this;
658
658
  get length(): number;
659
659
  insertAt(index: number, ...item: T[]): void;
660
660
  /**
@@ -1154,6 +1154,15 @@ declare class MapUtil {
1154
1154
  unflat(object: {
1155
1155
  [key: string]: any;
1156
1156
  }, split?: string): any;
1157
+ /**
1158
+ *
1159
+ * @param object
1160
+ * @param split
1161
+ * @returns
1162
+ */
1163
+ combine(...list: {
1164
+ [key: string]: any;
1165
+ }[]): any;
1157
1166
  /**
1158
1167
  * 返回键值相同的对象,只遍历一层,比较前使用flag展开
1159
1168
  * @param a
@@ -1319,7 +1328,8 @@ declare const viewhistorys: ViewHistory;
1319
1328
 
1320
1329
  declare class ViewModelComponent extends Component {
1321
1330
  /**
1322
- * 往上追踪,返回第一个包含 RouteComponent 的节点, 返回节点中的 RouteView
1331
+ * 往上追踪,返回第一个包含 RouteComponent 的节点, 返回节点中的 RouteView
1332
+ * 对于非同一个父节点的视图(例如对话框通常在canvas节点),需要打开对话框的时候,把视图模型传递给对话框
1323
1333
  * @param node
1324
1334
  */
1325
1335
  static tailNode(node: Node): ViewModel;
package/dist/index.esm.js CHANGED
@@ -1557,6 +1557,22 @@ class MapUtil {
1557
1557
  }
1558
1558
  return result;
1559
1559
  }
1560
+ /**
1561
+ *
1562
+ * @param object
1563
+ * @param split
1564
+ * @returns
1565
+ */
1566
+ combine(...list) {
1567
+ let result = {};
1568
+ for (let i = 0; i < list.length; i++) {
1569
+ let dict = list[i];
1570
+ for (const key in dict) {
1571
+ result[key] = dict[key];
1572
+ }
1573
+ }
1574
+ return result;
1575
+ }
1560
1576
  /**
1561
1577
  * 返回键值相同的对象,只遍历一层,比较前使用flag展开
1562
1578
  * @param a
@@ -2077,7 +2093,7 @@ class TreeNode {
2077
2093
  * @param mode
2078
2094
  * @returns
2079
2095
  */
2080
- toArray(mode) {
2096
+ toArray(mode = "BFS") {
2081
2097
  let result = [];
2082
2098
  switch (mode) {
2083
2099
  case "BFS":
@@ -2821,10 +2837,13 @@ class List {
2821
2837
  }
2822
2838
  /**
2823
2839
  * 克隆自身所有项到【target】对象,并返回【target】对象
2824
- * @param target
2840
+ * @param target 如果为空,则创建一个List
2825
2841
  * @param useIter 使用遍历的方式可以触发onSet
2826
2842
  */
2827
2843
  clone(target, useIter = true) {
2844
+ if (!target) {
2845
+ target = new List();
2846
+ }
2828
2847
  let data = this._array;
2829
2848
  if (useIter) {
2830
2849
  for (let i = 0; i < data.length; i++) {
@@ -4359,7 +4378,8 @@ var ViewModelComponent_1;
4359
4378
  const { ccclass, property, menu } = _decorator;
4360
4379
  let ViewModelComponent = ViewModelComponent_1 = class ViewModelComponent extends Component {
4361
4380
  /**
4362
- * 往上追踪,返回第一个包含 RouteComponent 的节点, 返回节点中的 RouteView
4381
+ * 往上追踪,返回第一个包含 RouteComponent 的节点, 返回节点中的 RouteView
4382
+ * 对于非同一个父节点的视图(例如对话框通常在canvas节点),需要打开对话框的时候,把视图模型传递给对话框
4363
4383
  * @param node
4364
4384
  */
4365
4385
  static tailNode(node) {