|
|
@ -851,6 +851,35 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, { |
|
|
|
return this._getChildren(parentValues).length; |
|
|
|
return this._getChildren(parentValues).length; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertSelectedValue: function (selectedValues, items = []) { |
|
|
|
|
|
|
|
if (BI.isPlainObject(selectedValues)) { |
|
|
|
|
|
|
|
return selectedValues; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var tree = BI.Tree.transformToTreeFormat(items); |
|
|
|
|
|
|
|
var value2ParentMap = {}; |
|
|
|
|
|
|
|
BI.Tree.traversal(tree, function (index, node, pNode) { |
|
|
|
|
|
|
|
value2ParentMap[node.value] = pNode; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var result = {}; |
|
|
|
|
|
|
|
BI.each(selectedValues, function (index, value) { |
|
|
|
|
|
|
|
var curr = value; |
|
|
|
|
|
|
|
var parentPath = []; |
|
|
|
|
|
|
|
while (curr) { |
|
|
|
|
|
|
|
parentPath.unshift(curr); |
|
|
|
|
|
|
|
curr = value2ParentMap[curr]?.value; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
BI.each(parentPath, function (index) { |
|
|
|
|
|
|
|
if (BI.isNull(BI.get(result, parentPath.slice(0, index + 1)))) { |
|
|
|
|
|
|
|
BI.set(result, parentPath.slice(0, index + 1), {}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
buildCompleteTree: function (selectedValues) { |
|
|
|
buildCompleteTree: function (selectedValues) { |
|
|
|
var self = this; |
|
|
|
var self = this; |
|
|
|
var result = {}; |
|
|
|
var result = {}; |
|
|
|