|
|
@ -17365,22 +17365,34 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree |
|
|
|
function dealWithSelectedValues(selectedValues) { |
|
|
|
function dealWithSelectedValues(selectedValues) { |
|
|
|
var p = parentValues.concat(notSelectedValue); |
|
|
|
var p = parentValues.concat(notSelectedValue); |
|
|
|
//存储的值中存在这个值就把它删掉
|
|
|
|
//存储的值中存在这个值就把它删掉
|
|
|
|
|
|
|
|
//例如选中了中国-江苏-南京, 取消中国或江苏或南京
|
|
|
|
if (canFindKey(selectedValues, p)) { |
|
|
|
if (canFindKey(selectedValues, p)) { |
|
|
|
//如果搜索的值在父亲链中
|
|
|
|
//如果搜索的值在父亲链中
|
|
|
|
if (isSearchValueInParent(p)) { |
|
|
|
if (isSearchValueInParent(p)) { |
|
|
|
|
|
|
|
//例如选中了 中国-江苏, 搜索江苏, 取消江苏
|
|
|
|
|
|
|
|
//例如选中了 中国-江苏, 搜索江苏, 取消中国
|
|
|
|
self._deleteNode(selectedValues, p); |
|
|
|
self._deleteNode(selectedValues, p); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
var searched = []; |
|
|
|
var searched = []; |
|
|
|
var finded = search(parentValues, notSelectedValue, [], searched); |
|
|
|
var finded = search(parentValues, notSelectedValue, [], searched); |
|
|
|
if (finded && BI.isNotEmptyArray(searched)) { |
|
|
|
if (finded && BI.isNotEmptyArray(searched)) { |
|
|
|
BI.each(searched, function (i, arr) { |
|
|
|
BI.each(searched, function (i, arr) { |
|
|
|
self._deleteNode(selectedValues, arr); |
|
|
|
var node = self._getNode(selectedValues, arr); |
|
|
|
|
|
|
|
if (node) { |
|
|
|
|
|
|
|
//例如选中了 中国-江苏-南京,搜索南京,取消中国
|
|
|
|
|
|
|
|
self._deleteNode(selectedValues, arr); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
//例如选中了 中国-江苏,搜索南京,取消中国
|
|
|
|
|
|
|
|
expandSelectedValue(selectedValues, arr, BI.last(arr)); |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//存储的值中不存在这个值,但父亲节点是全选的情况
|
|
|
|
//存储的值中不存在这个值,但父亲节点是全选的情况
|
|
|
|
|
|
|
|
//例如选中了中国-江苏,取消南京
|
|
|
|
|
|
|
|
//important 选中了中国-江苏,取消了江苏,但是搜索的是南京
|
|
|
|
if (isChild(selectedValues, p)) { |
|
|
|
if (isChild(selectedValues, p)) { |
|
|
|
var result = [], finded = false; |
|
|
|
var result = [], finded = false; |
|
|
|
//如果parentValues中有匹配的值,说明搜索结果不在当前值下
|
|
|
|
//如果parentValues中有匹配的值,说明搜索结果不在当前值下
|
|
|
@ -17393,29 +17405,9 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (finded === true) { |
|
|
|
if (finded === true) { |
|
|
|
var next = selectedValues; |
|
|
|
//去掉点击的节点之后的结果集
|
|
|
|
BI.each(p, function (i, v) { |
|
|
|
expandSelectedValue(selectedValues, p, notSelectedValue); |
|
|
|
var t = next[v]; |
|
|
|
//添加去掉搜索的结果集
|
|
|
|
if (t == null) { |
|
|
|
|
|
|
|
if (BI.isEmpty(next)) { |
|
|
|
|
|
|
|
var split = p.slice(0, i); |
|
|
|
|
|
|
|
var expanded = self._getChildren(split); |
|
|
|
|
|
|
|
BI.each(expanded, function (m, child) { |
|
|
|
|
|
|
|
if (i === p.length - 1 && child.value === notSelectedValue) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
next[child.value] = {}; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
next = next[v]; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
next = {}; |
|
|
|
|
|
|
|
next[v] = {}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
next = t; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result.length > 0) { |
|
|
|
if (result.length > 0) { |
|
|
|
BI.each(result, function (i, strs) { |
|
|
|
BI.each(result, function (i, strs) { |
|
|
|
self._buildTree(selectedValues, strs); |
|
|
|
self._buildTree(selectedValues, strs); |
|
|
@ -17426,6 +17418,32 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function expandSelectedValue(selectedValues, parents, notSelectedValue) { |
|
|
|
|
|
|
|
var next = selectedValues; |
|
|
|
|
|
|
|
//去掉点击的节点之后的结果集
|
|
|
|
|
|
|
|
BI.each(parents, function (i, v) { |
|
|
|
|
|
|
|
var t = next[v]; |
|
|
|
|
|
|
|
if (t == null) { |
|
|
|
|
|
|
|
if (BI.isEmpty(next)) { |
|
|
|
|
|
|
|
var split = parents.slice(0, i); |
|
|
|
|
|
|
|
var expanded = self._getChildren(split); |
|
|
|
|
|
|
|
BI.each(expanded, function (m, child) { |
|
|
|
|
|
|
|
if (i === parents.length - 1 && child.value === notSelectedValue) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
next[child.value] = {}; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
next = next[v]; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
next = {}; |
|
|
|
|
|
|
|
next[v] = {}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
next = t; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function search(parents, current, result, searched) { |
|
|
|
function search(parents, current, result, searched) { |
|
|
|
var newParents = BI.clone(parents); |
|
|
|
var newParents = BI.clone(parents); |
|
|
|
newParents.push(current); |
|
|
|
newParents.push(current); |
|
|
|