|
@@ -47,7 +47,7 @@ export class Tree {
|
|
|
// 按照树结构拼装好、排好序的数据。实际只是原始数据进行排序,内部元素跟原始数据内部元素的引用是一致的
|
|
// 按照树结构拼装好、排好序的数据。实际只是原始数据进行排序,内部元素跟原始数据内部元素的引用是一致的
|
|
|
data: TreeNode[];
|
|
data: TreeNode[];
|
|
|
|
|
|
|
|
- readonly rootID: string = '-1';
|
|
|
|
|
|
|
+ rootID: string;
|
|
|
|
|
|
|
|
// 默认初始顺序号。在对树结构进行操作后,没必要保证seq连号,只需保证正确排序就行,以减少需要更新的节点。
|
|
// 默认初始顺序号。在对树结构进行操作后,没必要保证seq连号,只需保证正确排序就行,以减少需要更新的节点。
|
|
|
readonly seqStartIndex = 0;
|
|
readonly seqStartIndex = 0;
|
|
@@ -61,7 +61,8 @@ export class Tree {
|
|
|
// 节点上下文与节点ID映射
|
|
// 节点上下文与节点ID映射
|
|
|
ctxMap: CtxIDMap;
|
|
ctxMap: CtxIDMap;
|
|
|
|
|
|
|
|
- constructor(rawData: TreeRaw[]) {
|
|
|
|
|
|
|
+ constructor(rawData: TreeRaw[], rootID = '-1') {
|
|
|
|
|
+ this.rootID = rootID;
|
|
|
this.rawData = this.genNodeContext(rawData);
|
|
this.rawData = this.genNodeContext(rawData);
|
|
|
this.rawData = Tree.sort(this.rawData);
|
|
this.rawData = Tree.sort(this.rawData);
|
|
|
this.data = [];
|
|
this.data = [];
|