@zhongguo168a/yxeditor-common 0.0.174 → 0.0.175
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 +1 -1
- package/dist/index.esm.js +9 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -592,7 +592,7 @@ declare class TreeRoot<NODE = any> extends EventDispatcher {
|
|
|
592
592
|
clone(): TreeRoot;
|
|
593
593
|
toString(): string;
|
|
594
594
|
createNode(id: string, isLeaf?: boolean): TreeNode;
|
|
595
|
-
flat(mode
|
|
595
|
+
flat(mode?: "BFS" | "DFS"): {
|
|
596
596
|
[key: string]: any;
|
|
597
597
|
};
|
|
598
598
|
unflag(object: {
|
package/dist/index.esm.js
CHANGED
|
@@ -1533,7 +1533,7 @@ class MapUtil {
|
|
|
1533
1533
|
for (let key in obj) {
|
|
1534
1534
|
let val = obj[key];
|
|
1535
1535
|
let type = typeof val;
|
|
1536
|
-
let id = path + split + key;
|
|
1536
|
+
let id = path ? path + split + key : key;
|
|
1537
1537
|
switch (type) {
|
|
1538
1538
|
case "object":
|
|
1539
1539
|
this._flat(val, result, id, split);
|
|
@@ -1546,7 +1546,13 @@ class MapUtil {
|
|
|
1546
1546
|
unflat(object, split = "/") {
|
|
1547
1547
|
let result = {};
|
|
1548
1548
|
for (let key in object) {
|
|
1549
|
-
let path
|
|
1549
|
+
let path;
|
|
1550
|
+
if (split != "/") {
|
|
1551
|
+
key.replace(split, "/");
|
|
1552
|
+
}
|
|
1553
|
+
else {
|
|
1554
|
+
path = key;
|
|
1555
|
+
}
|
|
1550
1556
|
this.setByPath(result, "/" + path, object[key]);
|
|
1551
1557
|
}
|
|
1552
1558
|
return result;
|
|
@@ -2585,7 +2591,7 @@ class TreeRoot extends EventDispatcher {
|
|
|
2585
2591
|
node.setRoot(this);
|
|
2586
2592
|
return node;
|
|
2587
2593
|
}
|
|
2588
|
-
flat(mode) {
|
|
2594
|
+
flat(mode = "BFS") {
|
|
2589
2595
|
let result = {};
|
|
2590
2596
|
switch (mode) {
|
|
2591
2597
|
case "BFS":
|