|
@@ -139,6 +139,12 @@ export default class TreeStore {
|
|
|
const key = this.key;
|
|
|
if (!key || !node || !node.data) return;
|
|
|
|
|
|
+ const childNodes = node.childNodes;
|
|
|
+ for (let i = 0, j = childNodes.length; i < j; i++) {
|
|
|
+ const child = childNodes[i];
|
|
|
+ this.deregisterNode(child);
|
|
|
+ }
|
|
|
+
|
|
|
delete this.nodesMap[node.key];
|
|
|
}
|
|
|
|
|
@@ -187,6 +193,20 @@ export default class TreeStore {
|
|
|
return allNodes;
|
|
|
}
|
|
|
|
|
|
+ updateChildren(key, data) {
|
|
|
+ const node = this.nodesMap[key];
|
|
|
+ if (!node) return;
|
|
|
+ const childNodes = node.childNodes;
|
|
|
+ for (let i = 0, j = childNodes.length; i < j; i++) {
|
|
|
+ const child = childNodes[i];
|
|
|
+ this.remove(child.data);
|
|
|
+ }
|
|
|
+ for (let i = 0, j = data.length; i < j; i++) {
|
|
|
+ const child = data[i];
|
|
|
+ this.append(child, node.data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
_setCheckedKeys(key, leafOnly = false, checkedKeys) {
|
|
|
const allNodes = this._getAllNodes().sort((a, b) => b.level - a.level);
|
|
|
const cache = Object.create(null);
|