Browse Source

树控件

es6
guy 8 years ago
parent
commit
97fe12f17d
  1. 15
      bi/widget.js
  2. 15
      docs/widget.js
  3. 15
      src/component/treevaluechooser/abstract.treevaluechooser.js

15
bi/widget.js

@ -17420,6 +17420,8 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
function expandSelectedValue(selectedValues, parents, notSelectedValue) { function expandSelectedValue(selectedValues, parents, notSelectedValue) {
var next = selectedValues; var next = selectedValues;
var childrenCount = [];
var path = [];
//去掉点击的节点之后的结果集 //去掉点击的节点之后的结果集
BI.some(parents, function (i, v) { BI.some(parents, function (i, v) {
var t = next[v]; var t = next[v];
@ -17430,12 +17432,25 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
if (BI.isEmpty(next)) { if (BI.isEmpty(next)) {
var split = parents.slice(0, i); var split = parents.slice(0, i);
var expanded = self._getChildren(split); var expanded = self._getChildren(split);
path.push(split);
childrenCount.push(expanded.length);
//如果只有一个值且取消的就是这个值
if (i === parents.length - 1 && expanded.length === 1 && expanded[0] === notSelectedValue) {
for (var j = childrenCount.length - 1; j >= 0; j--) {
if (childrenCount[j] === 1) {
self._deleteNode(selectedValues, path[j]);
} else {
break;
}
}
} else {
BI.each(expanded, function (m, child) { BI.each(expanded, function (m, child) {
if (i === parents.length - 1 && child.value === notSelectedValue) { if (i === parents.length - 1 && child.value === notSelectedValue) {
return true; return true;
} }
next[child.value] = {}; next[child.value] = {};
}); });
}
next = next[v]; next = next[v];
} else { } else {
return true; return true;

15
docs/widget.js

@ -17420,6 +17420,8 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
function expandSelectedValue(selectedValues, parents, notSelectedValue) { function expandSelectedValue(selectedValues, parents, notSelectedValue) {
var next = selectedValues; var next = selectedValues;
var childrenCount = [];
var path = [];
//去掉点击的节点之后的结果集 //去掉点击的节点之后的结果集
BI.some(parents, function (i, v) { BI.some(parents, function (i, v) {
var t = next[v]; var t = next[v];
@ -17430,12 +17432,25 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
if (BI.isEmpty(next)) { if (BI.isEmpty(next)) {
var split = parents.slice(0, i); var split = parents.slice(0, i);
var expanded = self._getChildren(split); var expanded = self._getChildren(split);
path.push(split);
childrenCount.push(expanded.length);
//如果只有一个值且取消的就是这个值
if (i === parents.length - 1 && expanded.length === 1 && expanded[0] === notSelectedValue) {
for (var j = childrenCount.length - 1; j >= 0; j--) {
if (childrenCount[j] === 1) {
self._deleteNode(selectedValues, path[j]);
} else {
break;
}
}
} else {
BI.each(expanded, function (m, child) { BI.each(expanded, function (m, child) {
if (i === parents.length - 1 && child.value === notSelectedValue) { if (i === parents.length - 1 && child.value === notSelectedValue) {
return true; return true;
} }
next[child.value] = {}; next[child.value] = {};
}); });
}
next = next[v]; next = next[v];
} else { } else {
return true; return true;

15
src/component/treevaluechooser/abstract.treevaluechooser.js

@ -181,6 +181,8 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
function expandSelectedValue(selectedValues, parents, notSelectedValue) { function expandSelectedValue(selectedValues, parents, notSelectedValue) {
var next = selectedValues; var next = selectedValues;
var childrenCount = [];
var path = [];
//去掉点击的节点之后的结果集 //去掉点击的节点之后的结果集
BI.some(parents, function (i, v) { BI.some(parents, function (i, v) {
var t = next[v]; var t = next[v];
@ -191,12 +193,25 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
if (BI.isEmpty(next)) { if (BI.isEmpty(next)) {
var split = parents.slice(0, i); var split = parents.slice(0, i);
var expanded = self._getChildren(split); var expanded = self._getChildren(split);
path.push(split);
childrenCount.push(expanded.length);
//如果只有一个值且取消的就是这个值
if (i === parents.length - 1 && expanded.length === 1 && expanded[0] === notSelectedValue) {
for (var j = childrenCount.length - 1; j >= 0; j--) {
if (childrenCount[j] === 1) {
self._deleteNode(selectedValues, path[j]);
} else {
break;
}
}
} else {
BI.each(expanded, function (m, child) { BI.each(expanded, function (m, child) {
if (i === parents.length - 1 && child.value === notSelectedValue) { if (i === parents.length - 1 && child.value === notSelectedValue) {
return true; return true;
} }
next[child.value] = {}; next[child.value] = {};
}); });
}
next = next[v]; next = next[v];
} else { } else {
return true; return true;

Loading…
Cancel
Save