guy 7 years ago
parent
commit
aeb4aa3d22
  1. 101
      bi/base.js
  2. 185
      bi/widget.js
  3. 4
      demo/dist/demo.js
  4. 4
      demo/js/widget/demo.multiselectcombo.js
  5. 101
      docs/base.js
  6. 4
      docs/demo.js
  7. 185
      docs/widget.js
  8. 14
      src/base/single/button/button.basic.js
  9. 6
      src/base/table/table.grid.js
  10. 4
      src/base/table/table.grid.quick.js
  11. 32
      src/base/tree/parttree.js
  12. 24
      src/base/tree/synctree.js
  13. 21
      src/base/tree/treeview.js
  14. 4
      src/component/allvaluechooser/combo.allvaluechooser.js
  15. 158
      src/component/treevaluechooser/combo.treevaluechooser.js
  16. 4
      src/component/valuechooser/combo.valuechooser.js
  17. 2
      src/widget/multiselect/check/multiselect.check.pane.js
  18. 2
      src/widget/multiselect/multiselect.loader.js
  19. 2
      src/widget/multiselect/search/multiselect.search.loader.js
  20. 4
      src/widget/multiselect/trigger/searcher.multiselect.js
  21. 4
      src/widget/multitree/check/multi.tree.check.pane.js
  22. 2
      src/widget/multitree/multi.tree.popup.js
  23. 3
      src/widget/sequencetable/listnumber.sequencetable.js

101
bi/base.js

@ -767,12 +767,14 @@ BI.BasicButton = BI.inherit(BI.Single, {
});
break;
default:
hand.mousedown(function (e) {
ev(e);
});
hand.mouseup(function (e) {
ev(e);
});
if (o.stopEvent || o.stopPropagation) {
hand.mousedown(function (e) {
ev(e);
});
hand.mouseup(function (e) {
ev(e);
});
}
hand.click(clk);
break;
}
@ -1596,8 +1598,8 @@ BI.TreeView = BI.inherit(BI.Pane, {
treeNode.times = treeNode.times || 1;
var param = "id=" + treeNode.id
+ "&times=" + (treeNode.times++)
+ "&parent_values= " + window.encodeURIComponent(BI.jsonEncode(parentNode))
+ "&check_state=" + window.encodeURIComponent(BI.jsonEncode(treeNode.getCheckStatus()));
+ "&parentValues= " + window.encodeURIComponent(BI.jsonEncode(parentNode))
+ "&checkState=" + window.encodeURIComponent(BI.jsonEncode(treeNode.getCheckStatus()));
return BI.servletURL + '?op=' + self.options.op + '&cmd=' + self.options.cmd + "&" + param;
}
@ -1728,7 +1730,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
this._buildTree(map, path);
return;
}
var storeValues = BI.deepClone(this.options.paras.selected_values);
var storeValues = BI.deepClone(this.options.paras.selectedValues);
var treeNode = this._getTree(storeValues, path);
this._addTreeNode(map, parent, this._getNodeValue(node), treeNode);
},
@ -1844,8 +1846,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
self.nodes = $.fn.zTree.init(tree.element, setting, nodes);
};
var op = BI.extend({}, o.paras, {
times: 1,
type: BI.TreeView.REQ_TYPE_INIT_DATA
times: 1
});
o.itemsCreator(op, function (res) {
@ -1938,8 +1939,8 @@ BI.TreeView = BI.inherit(BI.Pane, {
},
setSelectedValue: function (value) {
this.options.paras.selected_values = value || {};
this.selected_values = BI.deepClone(value) || {};
this.options.paras.selectedValues = value || {};
this.selectedValues = BI.deepClone(value) || {};
},
updateValue: function (values, param) {
@ -1979,10 +1980,10 @@ BI.TreeView = BI.inherit(BI.Pane, {
}
});
BI.extend(BI.TreeView, {
REQ_TYPE_INIT_DATA: 0,
REQ_TYPE_ADJUST_DATA: 1,
REQ_TYPE_CALCULATE_SELECT_DATA: 2,
REQ_TYPE_SELECTED_DATA: 3
REQ_TYPE_INIT_DATA: 1,
REQ_TYPE_ADJUST_DATA: 2,
REQ_TYPE_SELECT_DATA: 3,
REQ_TYPE_GET_SELECTED_DATA: 4
});
BI.TreeView.EVENT_CHANGE = "EVENT_CHANGE";
@ -2090,21 +2091,21 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
_selectTreeNode: function (treeId, treeNode) {
var self = this, o = this.options;
var parent_values = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var name = this._getNodeValue(treeNode)
// var values = parent_values.concat([name]);
// var values = parentValues.concat([name]);
if (treeNode.checked === true) {
} else {
var tNode = treeNode;
var pNode = this._getTree(this.selected_values, parent_values);
var pNode = this._getTree(this.selectedValues, parentValues);
if (BI.isNotNull(pNode[name])) {
delete pNode[name];
}
while (tNode != null && BI.isEmpty(pNode)) {
parent_values = parent_values.slice(0, parent_values.length - 1);
parentValues = parentValues.slice(0, parentValues.length - 1);
tNode = tNode.getParentNode();
if (tNode != null) {
pNode = this._getTree(this.selected_values, parent_values);
pNode = this._getTree(this.selectedValues, parentValues);
name = this._getNodeValue(tNode);
delete pNode[name];
}
@ -2120,8 +2121,8 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
var op = BI.extend({}, o.paras, {
"id": treeNode.id,
"times": 1,
"parent_values": parentValues.concat(this._getNodeValue(treeNode)),
"check_state": treeNode.getCheckStatus()
"parentValues": parentValues.concat(this._getNodeValue(treeNode)),
"checkState": treeNode.getCheckStatus()
});
var complete = function (d) {
var nodes = d.items || [];
@ -2169,7 +2170,7 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
},
hasChecked: function () {
return !BI.isEmpty(this.selected_values) || BI.SyncTree.superclass.hasChecked.apply(this, arguments);
return !BI.isEmpty(this.selectedValues) || BI.SyncTree.superclass.hasChecked.apply(this, arguments);
},
getValue: function () {
@ -2178,12 +2179,12 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
}
var checkedValues = this._getSelectedValues();
if (BI.isEmpty(checkedValues)) {
return this.selected_values;
return this.selectedValues;
}
if (BI.isEmpty(this.selected_values)) {
if (BI.isEmpty(this.selectedValues)) {
return checkedValues;
}
return this._join(checkedValues, this.selected_values);
return this._join(checkedValues, this.selectedValues);
},
//生成树方法
@ -2191,7 +2192,7 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
delete this.options.keyword;
BI.extend(this.options.paras, config);
//取消选中时使用
this.selected_values = BI.deepClone(this.options.paras.selected_values) || {};
this.selectedValues = BI.deepClone(this.options.paras.selectedValues) || {};
var setting = this._configSetting();
this._initTree(setting);
}
@ -2221,7 +2222,7 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
this.tip.setLoading();
o.itemsCreator(op, function (d) {
var hasNext = !!d.hasNext, nodes = d.items || [];
o.paras.last_search_value = d.last_search_value;
o.paras.lastSearchValue = d.lastSearchValue;
if (self._stop === true) {
return;
}
@ -2238,35 +2239,35 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
_selectTreeNode: function (treeId, treeNode) {
var self = this, o = this.options;
var parent_values = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var name = this._getNodeValue(treeNode)
// var values = parent_values.concat([name]);
// var values = parentValues.concat([name]);
if (treeNode.checked === true) {
BI.SyncTree.superclass._selectTreeNode.apply(self, arguments);
} else {
o.itemsCreator(BI.extend({}, o.paras, {
type: BI.TreeView.REQ_TYPE_CALCULATE_SELECT_DATA,
selected_values: this.selected_values,
not_selected_value: name,
parent_values: parent_values
selectedValues: this.selectedValues,
notSelectedValue: name,
parentValues: parentValues
}), function (new_values) {
if (BI.isEqual(self.selected_values, new_values)) {
if (BI.isEqual(self.selectedValues, new_values)) {
var tNode = treeNode;
var pNode = self._getTree(new_values, parent_values);
var pNode = self._getTree(new_values, parentValues);
if (pNode[name]) {
delete pNode[name];
}
while (tNode != null && BI.isEmpty(pNode)) {
parent_values = parent_values.slice(0, parent_values.length - 1);
parentValues = parentValues.slice(0, parentValues.length - 1);
tNode = tNode.getParentNode();
if (tNode != null) {
pNode = self._getTree(new_values, parent_values);
pNode = self._getTree(new_values, parentValues);
name = self._getNodeValue(tNode);
delete pNode[name];
}
}
}
self.selected_values = new_values;
self.selectedValues = new_values;
BI.SyncTree.superclass._selectTreeNode.apply(self, arguments);
});
}
@ -2319,7 +2320,7 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
return;
}
var hasNext = !!d.hasNext, nodes = d.items || [];
o.paras.last_search_value = d.last_search_value;
o.paras.lastSearchValue = d.lastSearchValue;
if (nodes.length > 0) {
callback(self._dealWidthNodes(nodes));
}
@ -2350,7 +2351,7 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
var result = BI.PartTree.superclass.getValue.apply(this, arguments);
o.itemsCreator({
type: BI.TreeView.REQ_TYPE_ADJUST_DATA,
selected_values: result
selectedValues: result
}, function (res) {
result = res;
});
@ -2362,10 +2363,10 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
var o = this.options;
delete o.paras.keyword;
BI.extend(o.paras, config);
delete o.paras.last_search_value;
delete o.paras.lastSearchValue;
//取消选中时使用
this.selected_values = BI.deepClone(o.paras.selected_values) || {};
//delete this.options.paras.selected_values;
this.selectedValues = BI.deepClone(o.paras.selectedValues) || {};
//delete this.options.paras.selectedValues;
var setting = this._configSetting();
this._initTree(setting, o.paras.keyword);
}
@ -29340,7 +29341,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
var trh = otrh + this._scrollBarSize;
var blw = oblw + this._scrollBarSize;
var blh = oblh + this._scrollBarSize;
var brw = obrw+ this._scrollBarSize;
var brw = obrw + this._scrollBarSize;
var brh = obrh + this._scrollBarSize;
var digest = function (el) {
@ -29376,11 +29377,11 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.topLeftGrid.setEstimatedColumnSize(freezeColLength > 0 ? totalLeftColumnSize / freezeColLength : 0);
this.topLeftGrid.setEstimatedRowSize(o.headerRowSize);
this.topRightGrid.setEstimatedColumnSize(totalRightColumnSize / (o.columnSize.length - freezeColLength));
this.topRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.topRightGrid.setEstimatedRowSize(o.headerRowSize);
this.bottomLeftGrid.setEstimatedColumnSize(freezeColLength > 0 ? totalLeftColumnSize / freezeColLength : 0);
this.bottomLeftGrid.setEstimatedRowSize(o.rowSize);
this.bottomRightGrid.setEstimatedColumnSize(totalRightColumnSize / (o.columnSize.length - freezeColLength));
this.bottomRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.bottomRightGrid.setEstimatedRowSize(o.rowSize);
var items = this.contextLayout.attr("items");
@ -29614,11 +29615,11 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, {
this.topLeftGrid.setEstimatedColumnSize(freezeColLength > 0 ? totalLeftColumnSize / freezeColLength : 0);
this.topLeftGrid.setEstimatedRowSize(o.headerRowSize);
this.topRightGrid.setEstimatedColumnSize(totalRightColumnSize / (o.columnSize.length - freezeColLength));
this.topRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.topRightGrid.setEstimatedRowSize(o.headerRowSize);
this.bottomLeftGrid.setEstimatedColumnSize(freezeColLength > 0 ? totalLeftColumnSize / freezeColLength : 0);
this.bottomLeftGrid.setEstimatedRowSize(o.rowSize);
this.bottomRightGrid.setEstimatedColumnSize(totalRightColumnSize / (o.columnSize.length - freezeColLength));
this.bottomRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.bottomRightGrid.setEstimatedRowSize(o.rowSize);
var items = this.contextLayout.attr("items");

185
bi/widget.js

@ -9365,7 +9365,7 @@ BI.MultiSelectCheckPane = BI.inherit(BI.Widget, {
items: opts.items,
itemsCreator: function (op, callback) {
op = BI.extend(op || {}, {
selected_values: self.storeValue.value
selectedValues: self.storeValue.value
});
if (self.storeValue.type === BI.Selection.Multi) {
callback({
@ -9928,7 +9928,7 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, {
itemsCreator: function (op, callback) {
var startValue = self._startValue;
self.storeValue && (op = BI.extend(op || {}, {
selected_values: BI.isKey(startValue) && self.storeValue.type === BI.Selection.Multi
selectedValues: BI.isKey(startValue) && self.storeValue.type === BI.Selection.Multi
? self.storeValue.value.concat(startValue) : self.storeValue.value
}));
opts.itemsCreator(op, function (ob) {
@ -10340,7 +10340,7 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, {
},
itemsCreator: function (op, callback) {
self.storeValue && (op = BI.extend(op || {}, {
selected_values: self.storeValue.value
selectedValues: self.storeValue.value
}));
opts.itemsCreator(op, function (ob) {
var keyword = ob.keyword = opts.keywordGetter();
@ -10810,13 +10810,13 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
ob.value || (ob.value = []);
if (ob.type === BI.Selection.All) {
if (BI.size(ob.assist) === 1) {
this.editor.setState(o.valueFormatter(ob.assist[0] + "") || ob.assist[0] + "");
this.editor.setState(o.valueFormatter(ob.assist[0] + "") || (ob.assist[0] + ""));
} else {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.All);
}
} else {
if (BI.size(ob.value) === 1) {
this.editor.setState(o.valueFormatter(ob.value[0] + "" || ob.value[0] + ""));
this.editor.setState(o.valueFormatter(ob.value[0] + "") || (ob.value[0] + ""));
} else {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.None);
}
@ -11288,7 +11288,7 @@ BI.MultiTreeCheckPane = BI.inherit(BI.Pane, {
var self = this, opts = this.options;
this.selected_values = {};
this.selectedValues = {};
var continueSelect = BI.createWidget({
type: 'bi.text_button',
@ -11325,7 +11325,7 @@ BI.MultiTreeCheckPane = BI.inherit(BI.Pane, {
type: "bi.display_tree",
cls: "bi-multi-tree-display",
itemsCreator: function (op, callback) {
op.type = BI.TreeView.REQ_TYPE_SELECTED_DATA;
op.type = BI.TreeView.REQ_TYPE_GET_SELECTED_DATA;
opts.itemsCreator(op, callback);
}
});
@ -11650,7 +11650,7 @@ BI.MultiTreePopup = BI.inherit(BI.Pane, {
var self = this, opts = this.options;
this.selected_values = {};
this.selectedValues = {};
this.tree = BI.createWidget({
type: "bi.sync_tree",
@ -15913,7 +15913,8 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
},
_populate: function () {
this.header.populate();
this.headerContainer.empty();
this._createHeader();
this._layout();
this._calculateChildrenToRender();
},
@ -17001,8 +17002,8 @@ BI.AllValueChooserCombo = BI.inherit(BI.Widget, {
var search = BI.Func.getSearchResult(items, kw);
items = search.matched.concat(search.finded);
});
if (options.selected_values) {//过滤
var filter = BI.makeObject(options.selected_values, true);
if (options.selectedValues) {//过滤
var filter = BI.makeObject(options.selectedValues, true);
items = BI.filter(items, function (i, ob) {
return !filter[ob.value];
});
@ -17129,10 +17130,10 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
case BI.TreeView.REQ_TYPE_ADJUST_DATA:
self._reqAdjustTreeNode(options, callback);
break;
case BI.TreeView.REQ_TYPE_CALCULATE_SELECT_DATA:
case BI.TreeView.REQ_TYPE_SELECT_DATA:
self._reqSelectedTreeNode(options, callback);
break;
case BI.TreeView.REQ_TYPE_SELECTED_DATA:
case BI.TreeView.REQ_TYPE_GET_SELECTED_DATA:
self._reqDisplayTreeNode(options, callback);
break;
default :
@ -17145,27 +17146,27 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
_reqDisplayTreeNode: function (op, callback) {
var self = this;
var result = [];
var selected_values = op.selected_values;
var selectedValues = op.selectedValues;
if (selected_values == null || BI.isEmpty(selected_values)) {
if (selectedValues == null || BI.isEmpty(selectedValues)) {
callback({});
return;
}
doCheck(0, [], selected_values);
doCheck(0, [], selectedValues);
callback({
items: result
});
function doCheck(floor, parent_values, selected) {
function doCheck(floor, parentValues, selected) {
if (floor >= self.floors) {
return;
}
if (selected == null || BI.isEmpty(selected)) {
var children = self._getChildren(parent_values);
var children = self._getChildren(parentValues);
BI.each(children, function (i, child) {
var newParents = BI.clone(parent_values);
var newParents = BI.clone(parentValues);
newParents.push(child.value);
var llen = self._getChildCount(newParents);
createOneJson(child, llen);
@ -17175,19 +17176,19 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
}
BI.each(selected, function (k) {
var node = self._getNode(k);
var newParents = BI.clone(parent_values);
var newParents = BI.clone(parentValues);
newParents.push(node.value);
createOneJson(node, getCount(selected[k], newParents));
doCheck(floor + 1, newParents, selected[k]);
})
}
function getCount(jo, parent_values) {
function getCount(jo, parentValues) {
if (jo == null) {
return 0;
}
if (BI.isEmpty(jo)) {
return self._getChildCount(parent_values);
return self._getChildCount(parentValues);
}
return BI.size(jo);
@ -17206,30 +17207,30 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
_reqSelectedTreeNode: function (op, callback) {
var self = this;
var selected_values = op.selected_values;
var not_selected_value = op.not_selected_value || {};
var selectedValues = op.selectedValues;
var notSelectedValue = op.notSelectedValue || {};
var keyword = op.keyword || "";
var parent_values = op.parent_values || [];
var parentValues = op.parentValues || [];
if (selected_values == null || BI.isEmpty(selected_values)) {
if (selectedValues == null || BI.isEmpty(selectedValues)) {
callback({});
return;
}
dealWithSelectedValues(selected_values);
callback(selected_values);
dealWithSelectedValues(selectedValues);
callback(selectedValues);
function dealWithSelectedValues(selected_values) {
var p = BI.clone(parent_values);
p.push(not_selected_value);
function dealWithSelectedValues(selectedValues) {
var p = BI.clone(parentValues);
p.push(notSelectedValue);
if (isChild(selected_values, p)) {
if (isChild(selectedValues, p)) {
var result = [];
var finded = search(parent_values.length + 1, parent_values, not_selected_value, result);
var finded = search(parentValues.length + 1, parentValues, notSelectedValue, result);
if (finded === true) {
var next = selected_values;
var next = selectedValues;
BI.each(p, function (i, v) {
var t = next[v];
if (t == null) {
@ -17237,7 +17238,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
var split = p.slice(0, i);
var expanded = self._getChildren(split);
BI.each(expanded, function (m, child) {
if (i === p.length - 1 && child.value === not_selected_value) {
if (i === p.length - 1 && child.value === notSelectedValue) {
return true;
}
next[child.value] = {};
@ -17254,7 +17255,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
if (result.length > 0) {
BI.each(result, function (i, strs) {
self._buildTree(selected_values, strs);
self._buildTree(selectedValues, strs);
})
}
}
@ -17294,8 +17295,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return can;
}
function isChild(selected_values, parents) {
var t = selected_values;
function isChild(selectedValues, parents) {
var t = selectedValues;
for (var i = 0; i < parents.length; i++) {
var v = parents[i];
if (!BI.has(t, v)) {
@ -17313,16 +17314,16 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
_reqAdjustTreeNode: function (op, callback) {
var self = this;
var result = [];
var selected_values = op.selected_values;
if (selected_values == null || BI.isEmpty(selected_values)) {
var selectedValues = op.selectedValues;
if (selectedValues == null || BI.isEmpty(selectedValues)) {
callback({});
return;
}
BI.each(selected_values, function (k, v) {
BI.each(selectedValues, function (k, v) {
result.push([k]);
});
dealWithSelectedValues(selected_values, []);
dealWithSelectedValues(selectedValues, []);
var jo = {};
BI.each(result, function (i, strs) {
@ -17359,23 +17360,23 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
var self = this;
var result = [];
var keyword = op.keyword || "";
var selected_values = op.selected_values;
var last_search_value = op.last_search_value || "";
var selectedValues = op.selectedValues;
var lastSearchValue = op.lastSearchValue || "";
var output = search();
BI.nextTick(function () {
callback({
hasNext: output.length > self._const.perPage,
items: result,
last_search_value: BI.last(output)
lastSearchValue: BI.last(output)
})
});
function search() {
var children = self._getChildren([]);
var start = children.length;
if (last_search_value !== "") {
if (lastSearchValue !== "") {
for (var j = 0, len = start; j < len; j++) {
if (children[j].value === last_search_value) {
if (children[j].value === lastSearchValue) {
start = j + 1;
break;
}
@ -17400,22 +17401,22 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return output;
}
function nodeSearch(deep, parent_values, current, isAllSelect, result) {
function nodeSearch(deep, parentValues, current, isAllSelect, result) {
if (self._isMatch(current, keyword)) {
var checked = isAllSelect || isSelected(parent_values, current);
createOneJson(parent_values, current, false, checked, !isAllSelect && isHalf(parent_values, current), true, result);
var checked = isAllSelect || isSelected(parentValues, current);
createOneJson(parentValues, current, false, checked, !isAllSelect && isHalf(parentValues, current), true, result);
return [true, checked];
}
if (deep >= self.floors) {
return [false, false];
}
var newParents = BI.clone(parent_values);
var newParents = BI.clone(parentValues);
newParents.push(current);
var children = self._getChildren(newParents);
var can = false, checked = false;
var isCurAllSelected = isAllSelect || isAllSelected(parent_values, current);
var isCurAllSelected = isAllSelect || isAllSelected(parentValues, current);
BI.each(children, function (i, child) {
var state = nodeSearch(deep + 1, newParents, child.value, isCurAllSelected, result);
if (state[1] === true) {
@ -17426,13 +17427,13 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
}
});
if (can === true) {
checked = isCurAllSelected || (isSelected(parent_values, current) && checked);
createOneJson(parent_values, current, true, checked, false, false, result);
checked = isCurAllSelected || (isSelected(parentValues, current) && checked);
createOneJson(parentValues, current, true, checked, false, false, result);
}
return [can, checked];
}
function createOneJson(parent_values, value, isOpen, checked, half, flag, result) {
function createOneJson(parentValues, value, isOpen, checked, half, flag, result) {
var node = self.map[value];
result.push({
id: node.id,
@ -17440,7 +17441,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
text: node.text,
value: node.value,
title: node.title,
isParent: parent_values.length + 1 < self.floors,
isParent: parentValues.length + 1 < self.floors,
open: isOpen,
checked: checked,
halfCheck: half,
@ -17448,8 +17449,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
});
}
function isHalf(parent_values, value) {
var find = findSelectedObj(parent_values);
function isHalf(parentValues, value) {
var find = findSelectedObj(parentValues);
if (find == null) {
return null;
}
@ -17462,8 +17463,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
});
}
function isAllSelected(parent_values, value) {
var find = findSelectedObj(parent_values);
function isAllSelected(parentValues, value) {
var find = findSelectedObj(parentValues);
if (find == null) {
return null;
}
@ -17476,8 +17477,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
});
}
function isSelected(parent_values, value) {
var find = findSelectedObj(parent_values);
function isSelected(parentValues, value) {
var find = findSelectedObj(parentValues);
if (find == null) {
return false;
}
@ -17488,12 +17489,12 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
});
}
function findSelectedObj(parent_values) {
var find = selected_values;
function findSelectedObj(parentValues) {
var find = selectedValues;
if (find == null) {
return null;
}
BI.every(parent_values, function (i, v) {
BI.every(parentValues, function (i, v) {
find = find[v];
if (find == null) {
return false;
@ -17508,23 +17509,23 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
var self = this;
var result = [];
var times = op.times;
var check_state = op.check_state || {};
var parent_values = op.parent_values || [];
var selected_values = op.selected_values;
var checkState = op.checkState || {};
var parentValues = op.parentValues || [];
var selectedValues = op.selectedValues;
var valueMap = {};
if (judgeState(parent_values, selected_values, check_state)) {
valueMap = dealWidthSelectedValue(parent_values, selected_values);
if (judgeState(parentValues, selectedValues, checkState)) {
valueMap = dealWidthSelectedValue(parentValues, selectedValues);
}
var nodes = this._getChildren(parent_values);
var nodes = this._getChildren(parentValues);
for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) {
var state = getCheckState(nodes[i].value, parent_values, valueMap, check_state);
var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState);
result.push({
id: nodes[i].id,
pId: nodes[i].pId,
value: nodes[i].value,
text: nodes[i].text,
times: 1,
isParent: parent_values.length + 1 < this.floors,
isParent: parentValues.length + 1 < this.floors,
checked: state[0],
halfCheck: state[1]
})
@ -17536,20 +17537,20 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
});
});
function judgeState(parent_values, selected_value, check_state) {
var checked = check_state.checked, half = check_state.half;
if (parent_values.length > 0 && !checked) {
function judgeState(parentValues, selected_value, checkState) {
var checked = checkState.checked, half = checkState.half;
if (parentValues.length > 0 && !checked) {
return false;
}
return (parent_values.length === 0 || (checked && half) && !BI.isEmpty(selected_value));
return (parentValues.length === 0 || (checked && half) && !BI.isEmpty(selected_value));
}
function dealWidthSelectedValue(parent_values, selected_values) {
function dealWidthSelectedValue(parentValues, selectedValues) {
var valueMap = {};
BI.each(parent_values, function (i, v) {
selected_values = selected_values[v];
BI.each(parentValues, function (i, v) {
selectedValues = selectedValues[v];
});
BI.each(selected_values, function (value, obj) {
BI.each(selectedValues, function (value, obj) {
if (BI.isNull(obj)) {
valueMap[value] = [0, 0];
return;
@ -17569,14 +17570,14 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return valueMap;
}
function getCheckState(current, parent_values, valueMap, check_state) {
var checked = check_state.checked, half = check_state.half;
var hasChild = parent_values.length + 1 < self.floors;
function getCheckState(current, parentValues, valueMap, checkState) {
var checked = checkState.checked, half = checkState.half;
var hasChild = parentValues.length + 1 < self.floors;
var tempCheck = false, halfCheck = false;
if (BI.has(valueMap, current)) {
//可能是半选
if (valueMap[current][0] === 1) {
var values = BI.clone(parent_values);
var values = BI.clone(parentValues);
values.push(current);
if (hasChild && self._getChildCount(values) != valueMap[current][1]) {
halfCheck = true;
@ -17615,9 +17616,9 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return this.tree.search(v, "value");
},
_getChildren: function (parent_values) {
if (parent_values.length > 0) {
var value = BI.last(parent_values);
_getChildren: function (parentValues) {
if (parentValues.length > 0) {
var value = BI.last(parentValues);
var parent = this.tree.search(value, "value");
} else {
var parent = this.tree.getRoot();
@ -17625,8 +17626,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return parent.getChildren();
},
_getChildCount: function (parent_values) {
return this._getChildren(parent_values).length;
_getChildCount: function (parentValues) {
return this._getChildren(parentValues).length;
},
setValue: function (v) {
@ -17728,8 +17729,8 @@ BI.ValueChooserCombo = BI.inherit(BI.Widget, {
var search = BI.Func.getSearchResult(items, kw);
items = search.matched.concat(search.finded);
});
if (options.selected_values) {//过滤
var filter = BI.makeObject(options.selected_values, true);
if (options.selectedValues) {//过滤
var filter = BI.makeObject(options.selectedValues, true);
items = BI.filter(items, function (i, ob) {
return !filter[ob.value];
});

4
demo/dist/demo.js vendored

@ -4703,8 +4703,8 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
var search = BI.Func.getSearchResult(items, kw);
items = search.matched.concat(search.finded);
});
if (options.selected_values) {//过滤
var filter = BI.makeObject(options.selected_values, true);
if (options.selectedValues) {//过滤
var filter = BI.makeObject(options.selectedValues, true);
items = BI.filter(items, function (i, ob) {
return !filter[ob.value];
});

4
demo/js/widget/demo.multiselectcombo.js

@ -44,8 +44,8 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
var search = BI.Func.getSearchResult(items, kw);
items = search.matched.concat(search.finded);
});
if (options.selected_values) {//过滤
var filter = BI.makeObject(options.selected_values, true);
if (options.selectedValues) {//过滤
var filter = BI.makeObject(options.selectedValues, true);
items = BI.filter(items, function (i, ob) {
return !filter[ob.value];
});

101
docs/base.js

@ -767,12 +767,14 @@ BI.BasicButton = BI.inherit(BI.Single, {
});
break;
default:
hand.mousedown(function (e) {
ev(e);
});
hand.mouseup(function (e) {
ev(e);
});
if (o.stopEvent || o.stopPropagation) {
hand.mousedown(function (e) {
ev(e);
});
hand.mouseup(function (e) {
ev(e);
});
}
hand.click(clk);
break;
}
@ -1596,8 +1598,8 @@ BI.TreeView = BI.inherit(BI.Pane, {
treeNode.times = treeNode.times || 1;
var param = "id=" + treeNode.id
+ "&times=" + (treeNode.times++)
+ "&parent_values= " + window.encodeURIComponent(BI.jsonEncode(parentNode))
+ "&check_state=" + window.encodeURIComponent(BI.jsonEncode(treeNode.getCheckStatus()));
+ "&parentValues= " + window.encodeURIComponent(BI.jsonEncode(parentNode))
+ "&checkState=" + window.encodeURIComponent(BI.jsonEncode(treeNode.getCheckStatus()));
return BI.servletURL + '?op=' + self.options.op + '&cmd=' + self.options.cmd + "&" + param;
}
@ -1728,7 +1730,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
this._buildTree(map, path);
return;
}
var storeValues = BI.deepClone(this.options.paras.selected_values);
var storeValues = BI.deepClone(this.options.paras.selectedValues);
var treeNode = this._getTree(storeValues, path);
this._addTreeNode(map, parent, this._getNodeValue(node), treeNode);
},
@ -1844,8 +1846,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
self.nodes = $.fn.zTree.init(tree.element, setting, nodes);
};
var op = BI.extend({}, o.paras, {
times: 1,
type: BI.TreeView.REQ_TYPE_INIT_DATA
times: 1
});
o.itemsCreator(op, function (res) {
@ -1938,8 +1939,8 @@ BI.TreeView = BI.inherit(BI.Pane, {
},
setSelectedValue: function (value) {
this.options.paras.selected_values = value || {};
this.selected_values = BI.deepClone(value) || {};
this.options.paras.selectedValues = value || {};
this.selectedValues = BI.deepClone(value) || {};
},
updateValue: function (values, param) {
@ -1979,10 +1980,10 @@ BI.TreeView = BI.inherit(BI.Pane, {
}
});
BI.extend(BI.TreeView, {
REQ_TYPE_INIT_DATA: 0,
REQ_TYPE_ADJUST_DATA: 1,
REQ_TYPE_CALCULATE_SELECT_DATA: 2,
REQ_TYPE_SELECTED_DATA: 3
REQ_TYPE_INIT_DATA: 1,
REQ_TYPE_ADJUST_DATA: 2,
REQ_TYPE_SELECT_DATA: 3,
REQ_TYPE_GET_SELECTED_DATA: 4
});
BI.TreeView.EVENT_CHANGE = "EVENT_CHANGE";
@ -2090,21 +2091,21 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
_selectTreeNode: function (treeId, treeNode) {
var self = this, o = this.options;
var parent_values = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var name = this._getNodeValue(treeNode)
// var values = parent_values.concat([name]);
// var values = parentValues.concat([name]);
if (treeNode.checked === true) {
} else {
var tNode = treeNode;
var pNode = this._getTree(this.selected_values, parent_values);
var pNode = this._getTree(this.selectedValues, parentValues);
if (BI.isNotNull(pNode[name])) {
delete pNode[name];
}
while (tNode != null && BI.isEmpty(pNode)) {
parent_values = parent_values.slice(0, parent_values.length - 1);
parentValues = parentValues.slice(0, parentValues.length - 1);
tNode = tNode.getParentNode();
if (tNode != null) {
pNode = this._getTree(this.selected_values, parent_values);
pNode = this._getTree(this.selectedValues, parentValues);
name = this._getNodeValue(tNode);
delete pNode[name];
}
@ -2120,8 +2121,8 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
var op = BI.extend({}, o.paras, {
"id": treeNode.id,
"times": 1,
"parent_values": parentValues.concat(this._getNodeValue(treeNode)),
"check_state": treeNode.getCheckStatus()
"parentValues": parentValues.concat(this._getNodeValue(treeNode)),
"checkState": treeNode.getCheckStatus()
});
var complete = function (d) {
var nodes = d.items || [];
@ -2169,7 +2170,7 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
},
hasChecked: function () {
return !BI.isEmpty(this.selected_values) || BI.SyncTree.superclass.hasChecked.apply(this, arguments);
return !BI.isEmpty(this.selectedValues) || BI.SyncTree.superclass.hasChecked.apply(this, arguments);
},
getValue: function () {
@ -2178,12 +2179,12 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
}
var checkedValues = this._getSelectedValues();
if (BI.isEmpty(checkedValues)) {
return this.selected_values;
return this.selectedValues;
}
if (BI.isEmpty(this.selected_values)) {
if (BI.isEmpty(this.selectedValues)) {
return checkedValues;
}
return this._join(checkedValues, this.selected_values);
return this._join(checkedValues, this.selectedValues);
},
//生成树方法
@ -2191,7 +2192,7 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
delete this.options.keyword;
BI.extend(this.options.paras, config);
//取消选中时使用
this.selected_values = BI.deepClone(this.options.paras.selected_values) || {};
this.selectedValues = BI.deepClone(this.options.paras.selectedValues) || {};
var setting = this._configSetting();
this._initTree(setting);
}
@ -2221,7 +2222,7 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
this.tip.setLoading();
o.itemsCreator(op, function (d) {
var hasNext = !!d.hasNext, nodes = d.items || [];
o.paras.last_search_value = d.last_search_value;
o.paras.lastSearchValue = d.lastSearchValue;
if (self._stop === true) {
return;
}
@ -2238,35 +2239,35 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
_selectTreeNode: function (treeId, treeNode) {
var self = this, o = this.options;
var parent_values = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var name = this._getNodeValue(treeNode)
// var values = parent_values.concat([name]);
// var values = parentValues.concat([name]);
if (treeNode.checked === true) {
BI.SyncTree.superclass._selectTreeNode.apply(self, arguments);
} else {
o.itemsCreator(BI.extend({}, o.paras, {
type: BI.TreeView.REQ_TYPE_CALCULATE_SELECT_DATA,
selected_values: this.selected_values,
not_selected_value: name,
parent_values: parent_values
selectedValues: this.selectedValues,
notSelectedValue: name,
parentValues: parentValues
}), function (new_values) {
if (BI.isEqual(self.selected_values, new_values)) {
if (BI.isEqual(self.selectedValues, new_values)) {
var tNode = treeNode;
var pNode = self._getTree(new_values, parent_values);
var pNode = self._getTree(new_values, parentValues);
if (pNode[name]) {
delete pNode[name];
}
while (tNode != null && BI.isEmpty(pNode)) {
parent_values = parent_values.slice(0, parent_values.length - 1);
parentValues = parentValues.slice(0, parentValues.length - 1);
tNode = tNode.getParentNode();
if (tNode != null) {
pNode = self._getTree(new_values, parent_values);
pNode = self._getTree(new_values, parentValues);
name = self._getNodeValue(tNode);
delete pNode[name];
}
}
}
self.selected_values = new_values;
self.selectedValues = new_values;
BI.SyncTree.superclass._selectTreeNode.apply(self, arguments);
});
}
@ -2319,7 +2320,7 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
return;
}
var hasNext = !!d.hasNext, nodes = d.items || [];
o.paras.last_search_value = d.last_search_value;
o.paras.lastSearchValue = d.lastSearchValue;
if (nodes.length > 0) {
callback(self._dealWidthNodes(nodes));
}
@ -2350,7 +2351,7 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
var result = BI.PartTree.superclass.getValue.apply(this, arguments);
o.itemsCreator({
type: BI.TreeView.REQ_TYPE_ADJUST_DATA,
selected_values: result
selectedValues: result
}, function (res) {
result = res;
});
@ -2362,10 +2363,10 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
var o = this.options;
delete o.paras.keyword;
BI.extend(o.paras, config);
delete o.paras.last_search_value;
delete o.paras.lastSearchValue;
//取消选中时使用
this.selected_values = BI.deepClone(o.paras.selected_values) || {};
//delete this.options.paras.selected_values;
this.selectedValues = BI.deepClone(o.paras.selectedValues) || {};
//delete this.options.paras.selectedValues;
var setting = this._configSetting();
this._initTree(setting, o.paras.keyword);
}
@ -29340,7 +29341,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
var trh = otrh + this._scrollBarSize;
var blw = oblw + this._scrollBarSize;
var blh = oblh + this._scrollBarSize;
var brw = obrw+ this._scrollBarSize;
var brw = obrw + this._scrollBarSize;
var brh = obrh + this._scrollBarSize;
var digest = function (el) {
@ -29376,11 +29377,11 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.topLeftGrid.setEstimatedColumnSize(freezeColLength > 0 ? totalLeftColumnSize / freezeColLength : 0);
this.topLeftGrid.setEstimatedRowSize(o.headerRowSize);
this.topRightGrid.setEstimatedColumnSize(totalRightColumnSize / (o.columnSize.length - freezeColLength));
this.topRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.topRightGrid.setEstimatedRowSize(o.headerRowSize);
this.bottomLeftGrid.setEstimatedColumnSize(freezeColLength > 0 ? totalLeftColumnSize / freezeColLength : 0);
this.bottomLeftGrid.setEstimatedRowSize(o.rowSize);
this.bottomRightGrid.setEstimatedColumnSize(totalRightColumnSize / (o.columnSize.length - freezeColLength));
this.bottomRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.bottomRightGrid.setEstimatedRowSize(o.rowSize);
var items = this.contextLayout.attr("items");
@ -29614,11 +29615,11 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, {
this.topLeftGrid.setEstimatedColumnSize(freezeColLength > 0 ? totalLeftColumnSize / freezeColLength : 0);
this.topLeftGrid.setEstimatedRowSize(o.headerRowSize);
this.topRightGrid.setEstimatedColumnSize(totalRightColumnSize / (o.columnSize.length - freezeColLength));
this.topRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.topRightGrid.setEstimatedRowSize(o.headerRowSize);
this.bottomLeftGrid.setEstimatedColumnSize(freezeColLength > 0 ? totalLeftColumnSize / freezeColLength : 0);
this.bottomLeftGrid.setEstimatedRowSize(o.rowSize);
this.bottomRightGrid.setEstimatedColumnSize(totalRightColumnSize / (o.columnSize.length - freezeColLength));
this.bottomRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.bottomRightGrid.setEstimatedRowSize(o.rowSize);
var items = this.contextLayout.attr("items");

4
docs/demo.js

@ -5434,8 +5434,8 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
var search = BI.Func.getSearchResult(items, kw);
items = search.matched.concat(search.finded);
});
if (options.selected_values) {//过滤
var filter = BI.makeObject(options.selected_values, true);
if (options.selectedValues) {//过滤
var filter = BI.makeObject(options.selectedValues, true);
items = BI.filter(items, function (i, ob) {
return !filter[ob.value];
});

185
docs/widget.js

@ -9365,7 +9365,7 @@ BI.MultiSelectCheckPane = BI.inherit(BI.Widget, {
items: opts.items,
itemsCreator: function (op, callback) {
op = BI.extend(op || {}, {
selected_values: self.storeValue.value
selectedValues: self.storeValue.value
});
if (self.storeValue.type === BI.Selection.Multi) {
callback({
@ -9928,7 +9928,7 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, {
itemsCreator: function (op, callback) {
var startValue = self._startValue;
self.storeValue && (op = BI.extend(op || {}, {
selected_values: BI.isKey(startValue) && self.storeValue.type === BI.Selection.Multi
selectedValues: BI.isKey(startValue) && self.storeValue.type === BI.Selection.Multi
? self.storeValue.value.concat(startValue) : self.storeValue.value
}));
opts.itemsCreator(op, function (ob) {
@ -10340,7 +10340,7 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, {
},
itemsCreator: function (op, callback) {
self.storeValue && (op = BI.extend(op || {}, {
selected_values: self.storeValue.value
selectedValues: self.storeValue.value
}));
opts.itemsCreator(op, function (ob) {
var keyword = ob.keyword = opts.keywordGetter();
@ -10810,13 +10810,13 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
ob.value || (ob.value = []);
if (ob.type === BI.Selection.All) {
if (BI.size(ob.assist) === 1) {
this.editor.setState(o.valueFormatter(ob.assist[0] + "") || ob.assist[0] + "");
this.editor.setState(o.valueFormatter(ob.assist[0] + "") || (ob.assist[0] + ""));
} else {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.All);
}
} else {
if (BI.size(ob.value) === 1) {
this.editor.setState(o.valueFormatter(ob.value[0] + "" || ob.value[0] + ""));
this.editor.setState(o.valueFormatter(ob.value[0] + "") || (ob.value[0] + ""));
} else {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.None);
}
@ -11288,7 +11288,7 @@ BI.MultiTreeCheckPane = BI.inherit(BI.Pane, {
var self = this, opts = this.options;
this.selected_values = {};
this.selectedValues = {};
var continueSelect = BI.createWidget({
type: 'bi.text_button',
@ -11325,7 +11325,7 @@ BI.MultiTreeCheckPane = BI.inherit(BI.Pane, {
type: "bi.display_tree",
cls: "bi-multi-tree-display",
itemsCreator: function (op, callback) {
op.type = BI.TreeView.REQ_TYPE_SELECTED_DATA;
op.type = BI.TreeView.REQ_TYPE_GET_SELECTED_DATA;
opts.itemsCreator(op, callback);
}
});
@ -11650,7 +11650,7 @@ BI.MultiTreePopup = BI.inherit(BI.Pane, {
var self = this, opts = this.options;
this.selected_values = {};
this.selectedValues = {};
this.tree = BI.createWidget({
type: "bi.sync_tree",
@ -15913,7 +15913,8 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
},
_populate: function () {
this.header.populate();
this.headerContainer.empty();
this._createHeader();
this._layout();
this._calculateChildrenToRender();
},
@ -17001,8 +17002,8 @@ BI.AllValueChooserCombo = BI.inherit(BI.Widget, {
var search = BI.Func.getSearchResult(items, kw);
items = search.matched.concat(search.finded);
});
if (options.selected_values) {//过滤
var filter = BI.makeObject(options.selected_values, true);
if (options.selectedValues) {//过滤
var filter = BI.makeObject(options.selectedValues, true);
items = BI.filter(items, function (i, ob) {
return !filter[ob.value];
});
@ -17129,10 +17130,10 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
case BI.TreeView.REQ_TYPE_ADJUST_DATA:
self._reqAdjustTreeNode(options, callback);
break;
case BI.TreeView.REQ_TYPE_CALCULATE_SELECT_DATA:
case BI.TreeView.REQ_TYPE_SELECT_DATA:
self._reqSelectedTreeNode(options, callback);
break;
case BI.TreeView.REQ_TYPE_SELECTED_DATA:
case BI.TreeView.REQ_TYPE_GET_SELECTED_DATA:
self._reqDisplayTreeNode(options, callback);
break;
default :
@ -17145,27 +17146,27 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
_reqDisplayTreeNode: function (op, callback) {
var self = this;
var result = [];
var selected_values = op.selected_values;
var selectedValues = op.selectedValues;
if (selected_values == null || BI.isEmpty(selected_values)) {
if (selectedValues == null || BI.isEmpty(selectedValues)) {
callback({});
return;
}
doCheck(0, [], selected_values);
doCheck(0, [], selectedValues);
callback({
items: result
});
function doCheck(floor, parent_values, selected) {
function doCheck(floor, parentValues, selected) {
if (floor >= self.floors) {
return;
}
if (selected == null || BI.isEmpty(selected)) {
var children = self._getChildren(parent_values);
var children = self._getChildren(parentValues);
BI.each(children, function (i, child) {
var newParents = BI.clone(parent_values);
var newParents = BI.clone(parentValues);
newParents.push(child.value);
var llen = self._getChildCount(newParents);
createOneJson(child, llen);
@ -17175,19 +17176,19 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
}
BI.each(selected, function (k) {
var node = self._getNode(k);
var newParents = BI.clone(parent_values);
var newParents = BI.clone(parentValues);
newParents.push(node.value);
createOneJson(node, getCount(selected[k], newParents));
doCheck(floor + 1, newParents, selected[k]);
})
}
function getCount(jo, parent_values) {
function getCount(jo, parentValues) {
if (jo == null) {
return 0;
}
if (BI.isEmpty(jo)) {
return self._getChildCount(parent_values);
return self._getChildCount(parentValues);
}
return BI.size(jo);
@ -17206,30 +17207,30 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
_reqSelectedTreeNode: function (op, callback) {
var self = this;
var selected_values = op.selected_values;
var not_selected_value = op.not_selected_value || {};
var selectedValues = op.selectedValues;
var notSelectedValue = op.notSelectedValue || {};
var keyword = op.keyword || "";
var parent_values = op.parent_values || [];
var parentValues = op.parentValues || [];
if (selected_values == null || BI.isEmpty(selected_values)) {
if (selectedValues == null || BI.isEmpty(selectedValues)) {
callback({});
return;
}
dealWithSelectedValues(selected_values);
callback(selected_values);
dealWithSelectedValues(selectedValues);
callback(selectedValues);
function dealWithSelectedValues(selected_values) {
var p = BI.clone(parent_values);
p.push(not_selected_value);
function dealWithSelectedValues(selectedValues) {
var p = BI.clone(parentValues);
p.push(notSelectedValue);
if (isChild(selected_values, p)) {
if (isChild(selectedValues, p)) {
var result = [];
var finded = search(parent_values.length + 1, parent_values, not_selected_value, result);
var finded = search(parentValues.length + 1, parentValues, notSelectedValue, result);
if (finded === true) {
var next = selected_values;
var next = selectedValues;
BI.each(p, function (i, v) {
var t = next[v];
if (t == null) {
@ -17237,7 +17238,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
var split = p.slice(0, i);
var expanded = self._getChildren(split);
BI.each(expanded, function (m, child) {
if (i === p.length - 1 && child.value === not_selected_value) {
if (i === p.length - 1 && child.value === notSelectedValue) {
return true;
}
next[child.value] = {};
@ -17254,7 +17255,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
if (result.length > 0) {
BI.each(result, function (i, strs) {
self._buildTree(selected_values, strs);
self._buildTree(selectedValues, strs);
})
}
}
@ -17294,8 +17295,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return can;
}
function isChild(selected_values, parents) {
var t = selected_values;
function isChild(selectedValues, parents) {
var t = selectedValues;
for (var i = 0; i < parents.length; i++) {
var v = parents[i];
if (!BI.has(t, v)) {
@ -17313,16 +17314,16 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
_reqAdjustTreeNode: function (op, callback) {
var self = this;
var result = [];
var selected_values = op.selected_values;
if (selected_values == null || BI.isEmpty(selected_values)) {
var selectedValues = op.selectedValues;
if (selectedValues == null || BI.isEmpty(selectedValues)) {
callback({});
return;
}
BI.each(selected_values, function (k, v) {
BI.each(selectedValues, function (k, v) {
result.push([k]);
});
dealWithSelectedValues(selected_values, []);
dealWithSelectedValues(selectedValues, []);
var jo = {};
BI.each(result, function (i, strs) {
@ -17359,23 +17360,23 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
var self = this;
var result = [];
var keyword = op.keyword || "";
var selected_values = op.selected_values;
var last_search_value = op.last_search_value || "";
var selectedValues = op.selectedValues;
var lastSearchValue = op.lastSearchValue || "";
var output = search();
BI.nextTick(function () {
callback({
hasNext: output.length > self._const.perPage,
items: result,
last_search_value: BI.last(output)
lastSearchValue: BI.last(output)
})
});
function search() {
var children = self._getChildren([]);
var start = children.length;
if (last_search_value !== "") {
if (lastSearchValue !== "") {
for (var j = 0, len = start; j < len; j++) {
if (children[j].value === last_search_value) {
if (children[j].value === lastSearchValue) {
start = j + 1;
break;
}
@ -17400,22 +17401,22 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return output;
}
function nodeSearch(deep, parent_values, current, isAllSelect, result) {
function nodeSearch(deep, parentValues, current, isAllSelect, result) {
if (self._isMatch(current, keyword)) {
var checked = isAllSelect || isSelected(parent_values, current);
createOneJson(parent_values, current, false, checked, !isAllSelect && isHalf(parent_values, current), true, result);
var checked = isAllSelect || isSelected(parentValues, current);
createOneJson(parentValues, current, false, checked, !isAllSelect && isHalf(parentValues, current), true, result);
return [true, checked];
}
if (deep >= self.floors) {
return [false, false];
}
var newParents = BI.clone(parent_values);
var newParents = BI.clone(parentValues);
newParents.push(current);
var children = self._getChildren(newParents);
var can = false, checked = false;
var isCurAllSelected = isAllSelect || isAllSelected(parent_values, current);
var isCurAllSelected = isAllSelect || isAllSelected(parentValues, current);
BI.each(children, function (i, child) {
var state = nodeSearch(deep + 1, newParents, child.value, isCurAllSelected, result);
if (state[1] === true) {
@ -17426,13 +17427,13 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
}
});
if (can === true) {
checked = isCurAllSelected || (isSelected(parent_values, current) && checked);
createOneJson(parent_values, current, true, checked, false, false, result);
checked = isCurAllSelected || (isSelected(parentValues, current) && checked);
createOneJson(parentValues, current, true, checked, false, false, result);
}
return [can, checked];
}
function createOneJson(parent_values, value, isOpen, checked, half, flag, result) {
function createOneJson(parentValues, value, isOpen, checked, half, flag, result) {
var node = self.map[value];
result.push({
id: node.id,
@ -17440,7 +17441,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
text: node.text,
value: node.value,
title: node.title,
isParent: parent_values.length + 1 < self.floors,
isParent: parentValues.length + 1 < self.floors,
open: isOpen,
checked: checked,
halfCheck: half,
@ -17448,8 +17449,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
});
}
function isHalf(parent_values, value) {
var find = findSelectedObj(parent_values);
function isHalf(parentValues, value) {
var find = findSelectedObj(parentValues);
if (find == null) {
return null;
}
@ -17462,8 +17463,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
});
}
function isAllSelected(parent_values, value) {
var find = findSelectedObj(parent_values);
function isAllSelected(parentValues, value) {
var find = findSelectedObj(parentValues);
if (find == null) {
return null;
}
@ -17476,8 +17477,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
});
}
function isSelected(parent_values, value) {
var find = findSelectedObj(parent_values);
function isSelected(parentValues, value) {
var find = findSelectedObj(parentValues);
if (find == null) {
return false;
}
@ -17488,12 +17489,12 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
});
}
function findSelectedObj(parent_values) {
var find = selected_values;
function findSelectedObj(parentValues) {
var find = selectedValues;
if (find == null) {
return null;
}
BI.every(parent_values, function (i, v) {
BI.every(parentValues, function (i, v) {
find = find[v];
if (find == null) {
return false;
@ -17508,23 +17509,23 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
var self = this;
var result = [];
var times = op.times;
var check_state = op.check_state || {};
var parent_values = op.parent_values || [];
var selected_values = op.selected_values;
var checkState = op.checkState || {};
var parentValues = op.parentValues || [];
var selectedValues = op.selectedValues;
var valueMap = {};
if (judgeState(parent_values, selected_values, check_state)) {
valueMap = dealWidthSelectedValue(parent_values, selected_values);
if (judgeState(parentValues, selectedValues, checkState)) {
valueMap = dealWidthSelectedValue(parentValues, selectedValues);
}
var nodes = this._getChildren(parent_values);
var nodes = this._getChildren(parentValues);
for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) {
var state = getCheckState(nodes[i].value, parent_values, valueMap, check_state);
var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState);
result.push({
id: nodes[i].id,
pId: nodes[i].pId,
value: nodes[i].value,
text: nodes[i].text,
times: 1,
isParent: parent_values.length + 1 < this.floors,
isParent: parentValues.length + 1 < this.floors,
checked: state[0],
halfCheck: state[1]
})
@ -17536,20 +17537,20 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
});
});
function judgeState(parent_values, selected_value, check_state) {
var checked = check_state.checked, half = check_state.half;
if (parent_values.length > 0 && !checked) {
function judgeState(parentValues, selected_value, checkState) {
var checked = checkState.checked, half = checkState.half;
if (parentValues.length > 0 && !checked) {
return false;
}
return (parent_values.length === 0 || (checked && half) && !BI.isEmpty(selected_value));
return (parentValues.length === 0 || (checked && half) && !BI.isEmpty(selected_value));
}
function dealWidthSelectedValue(parent_values, selected_values) {
function dealWidthSelectedValue(parentValues, selectedValues) {
var valueMap = {};
BI.each(parent_values, function (i, v) {
selected_values = selected_values[v];
BI.each(parentValues, function (i, v) {
selectedValues = selectedValues[v];
});
BI.each(selected_values, function (value, obj) {
BI.each(selectedValues, function (value, obj) {
if (BI.isNull(obj)) {
valueMap[value] = [0, 0];
return;
@ -17569,14 +17570,14 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return valueMap;
}
function getCheckState(current, parent_values, valueMap, check_state) {
var checked = check_state.checked, half = check_state.half;
var hasChild = parent_values.length + 1 < self.floors;
function getCheckState(current, parentValues, valueMap, checkState) {
var checked = checkState.checked, half = checkState.half;
var hasChild = parentValues.length + 1 < self.floors;
var tempCheck = false, halfCheck = false;
if (BI.has(valueMap, current)) {
//可能是半选
if (valueMap[current][0] === 1) {
var values = BI.clone(parent_values);
var values = BI.clone(parentValues);
values.push(current);
if (hasChild && self._getChildCount(values) != valueMap[current][1]) {
halfCheck = true;
@ -17615,9 +17616,9 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return this.tree.search(v, "value");
},
_getChildren: function (parent_values) {
if (parent_values.length > 0) {
var value = BI.last(parent_values);
_getChildren: function (parentValues) {
if (parentValues.length > 0) {
var value = BI.last(parentValues);
var parent = this.tree.search(value, "value");
} else {
var parent = this.tree.getRoot();
@ -17625,8 +17626,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return parent.getChildren();
},
_getChildCount: function (parent_values) {
return this._getChildren(parent_values).length;
_getChildCount: function (parentValues) {
return this._getChildren(parentValues).length;
},
setValue: function (v) {
@ -17728,8 +17729,8 @@ BI.ValueChooserCombo = BI.inherit(BI.Widget, {
var search = BI.Func.getSearchResult(items, kw);
items = search.matched.concat(search.finded);
});
if (options.selected_values) {//过滤
var filter = BI.makeObject(options.selected_values, true);
if (options.selectedValues) {//过滤
var filter = BI.makeObject(options.selectedValues, true);
items = BI.filter(items, function (i, ob) {
return !filter[ob.value];
});

14
src/base/single/button/button.basic.js

@ -184,12 +184,14 @@ BI.BasicButton = BI.inherit(BI.Single, {
});
break;
default:
hand.mousedown(function (e) {
ev(e);
});
hand.mouseup(function (e) {
ev(e);
});
if (o.stopEvent || o.stopPropagation) {
hand.mousedown(function (e) {
ev(e);
});
hand.mouseup(function (e) {
ev(e);
});
}
hand.click(clk);
break;
}

6
src/base/table/table.grid.js

@ -294,7 +294,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
var trh = otrh + this._scrollBarSize;
var blw = oblw + this._scrollBarSize;
var blh = oblh + this._scrollBarSize;
var brw = obrw+ this._scrollBarSize;
var brw = obrw + this._scrollBarSize;
var brh = obrh + this._scrollBarSize;
var digest = function (el) {
@ -330,11 +330,11 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.topLeftGrid.setEstimatedColumnSize(freezeColLength > 0 ? totalLeftColumnSize / freezeColLength : 0);
this.topLeftGrid.setEstimatedRowSize(o.headerRowSize);
this.topRightGrid.setEstimatedColumnSize(totalRightColumnSize / (o.columnSize.length - freezeColLength));
this.topRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.topRightGrid.setEstimatedRowSize(o.headerRowSize);
this.bottomLeftGrid.setEstimatedColumnSize(freezeColLength > 0 ? totalLeftColumnSize / freezeColLength : 0);
this.bottomLeftGrid.setEstimatedRowSize(o.rowSize);
this.bottomRightGrid.setEstimatedColumnSize(totalRightColumnSize / (o.columnSize.length - freezeColLength));
this.bottomRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.bottomRightGrid.setEstimatedRowSize(o.rowSize);
var items = this.contextLayout.attr("items");

4
src/base/table/table.grid.quick.js

@ -115,11 +115,11 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, {
this.topLeftGrid.setEstimatedColumnSize(freezeColLength > 0 ? totalLeftColumnSize / freezeColLength : 0);
this.topLeftGrid.setEstimatedRowSize(o.headerRowSize);
this.topRightGrid.setEstimatedColumnSize(totalRightColumnSize / (o.columnSize.length - freezeColLength));
this.topRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.topRightGrid.setEstimatedRowSize(o.headerRowSize);
this.bottomLeftGrid.setEstimatedColumnSize(freezeColLength > 0 ? totalLeftColumnSize / freezeColLength : 0);
this.bottomLeftGrid.setEstimatedRowSize(o.rowSize);
this.bottomRightGrid.setEstimatedColumnSize(totalRightColumnSize / (o.columnSize.length - freezeColLength));
this.bottomRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.bottomRightGrid.setEstimatedRowSize(o.rowSize);
var items = this.contextLayout.attr("items");

32
src/base/tree/parttree.js

@ -22,7 +22,7 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
this.tip.setLoading();
o.itemsCreator(op, function (d) {
var hasNext = !!d.hasNext, nodes = d.items || [];
o.paras.last_search_value = d.last_search_value;
o.paras.lastSearchValue = d.lastSearchValue;
if (self._stop === true) {
return;
}
@ -39,35 +39,35 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
_selectTreeNode: function (treeId, treeNode) {
var self = this, o = this.options;
var parent_values = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var name = this._getNodeValue(treeNode)
// var values = parent_values.concat([name]);
// var values = parentValues.concat([name]);
if (treeNode.checked === true) {
BI.SyncTree.superclass._selectTreeNode.apply(self, arguments);
} else {
o.itemsCreator(BI.extend({}, o.paras, {
type: BI.TreeView.REQ_TYPE_CALCULATE_SELECT_DATA,
selected_values: this.selected_values,
not_selected_value: name,
parent_values: parent_values
selectedValues: this.selectedValues,
notSelectedValue: name,
parentValues: parentValues
}), function (new_values) {
if (BI.isEqual(self.selected_values, new_values)) {
if (BI.isEqual(self.selectedValues, new_values)) {
var tNode = treeNode;
var pNode = self._getTree(new_values, parent_values);
var pNode = self._getTree(new_values, parentValues);
if (pNode[name]) {
delete pNode[name];
}
while (tNode != null && BI.isEmpty(pNode)) {
parent_values = parent_values.slice(0, parent_values.length - 1);
parentValues = parentValues.slice(0, parentValues.length - 1);
tNode = tNode.getParentNode();
if (tNode != null) {
pNode = self._getTree(new_values, parent_values);
pNode = self._getTree(new_values, parentValues);
name = self._getNodeValue(tNode);
delete pNode[name];
}
}
}
self.selected_values = new_values;
self.selectedValues = new_values;
BI.SyncTree.superclass._selectTreeNode.apply(self, arguments);
});
}
@ -120,7 +120,7 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
return;
}
var hasNext = !!d.hasNext, nodes = d.items || [];
o.paras.last_search_value = d.last_search_value;
o.paras.lastSearchValue = d.lastSearchValue;
if (nodes.length > 0) {
callback(self._dealWidthNodes(nodes));
}
@ -151,7 +151,7 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
var result = BI.PartTree.superclass.getValue.apply(this, arguments);
o.itemsCreator({
type: BI.TreeView.REQ_TYPE_ADJUST_DATA,
selected_values: result
selectedValues: result
}, function (res) {
result = res;
});
@ -163,10 +163,10 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
var o = this.options;
delete o.paras.keyword;
BI.extend(o.paras, config);
delete o.paras.last_search_value;
delete o.paras.lastSearchValue;
//取消选中时使用
this.selected_values = BI.deepClone(o.paras.selected_values) || {};
//delete this.options.paras.selected_values;
this.selectedValues = BI.deepClone(o.paras.selectedValues) || {};
//delete this.options.paras.selectedValues;
var setting = this._configSetting();
this._initTree(setting, o.paras.keyword);
}

24
src/base/tree/synctree.js

@ -99,21 +99,21 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
_selectTreeNode: function (treeId, treeNode) {
var self = this, o = this.options;
var parent_values = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var name = this._getNodeValue(treeNode)
// var values = parent_values.concat([name]);
// var values = parentValues.concat([name]);
if (treeNode.checked === true) {
} else {
var tNode = treeNode;
var pNode = this._getTree(this.selected_values, parent_values);
var pNode = this._getTree(this.selectedValues, parentValues);
if (BI.isNotNull(pNode[name])) {
delete pNode[name];
}
while (tNode != null && BI.isEmpty(pNode)) {
parent_values = parent_values.slice(0, parent_values.length - 1);
parentValues = parentValues.slice(0, parentValues.length - 1);
tNode = tNode.getParentNode();
if (tNode != null) {
pNode = this._getTree(this.selected_values, parent_values);
pNode = this._getTree(this.selectedValues, parentValues);
name = this._getNodeValue(tNode);
delete pNode[name];
}
@ -129,8 +129,8 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
var op = BI.extend({}, o.paras, {
"id": treeNode.id,
"times": 1,
"parent_values": parentValues.concat(this._getNodeValue(treeNode)),
"check_state": treeNode.getCheckStatus()
"parentValues": parentValues.concat(this._getNodeValue(treeNode)),
"checkState": treeNode.getCheckStatus()
});
var complete = function (d) {
var nodes = d.items || [];
@ -178,7 +178,7 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
},
hasChecked: function () {
return !BI.isEmpty(this.selected_values) || BI.SyncTree.superclass.hasChecked.apply(this, arguments);
return !BI.isEmpty(this.selectedValues) || BI.SyncTree.superclass.hasChecked.apply(this, arguments);
},
getValue: function () {
@ -187,12 +187,12 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
}
var checkedValues = this._getSelectedValues();
if (BI.isEmpty(checkedValues)) {
return this.selected_values;
return this.selectedValues;
}
if (BI.isEmpty(this.selected_values)) {
if (BI.isEmpty(this.selectedValues)) {
return checkedValues;
}
return this._join(checkedValues, this.selected_values);
return this._join(checkedValues, this.selectedValues);
},
//生成树方法
@ -200,7 +200,7 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
delete this.options.keyword;
BI.extend(this.options.paras, config);
//取消选中时使用
this.selected_values = BI.deepClone(this.options.paras.selected_values) || {};
this.selectedValues = BI.deepClone(this.options.paras.selectedValues) || {};
var setting = this._configSetting();
this._initTree(setting);
}

21
src/base/tree/treeview.js

@ -109,8 +109,8 @@ BI.TreeView = BI.inherit(BI.Pane, {
treeNode.times = treeNode.times || 1;
var param = "id=" + treeNode.id
+ "&times=" + (treeNode.times++)
+ "&parent_values= " + window.encodeURIComponent(BI.jsonEncode(parentNode))
+ "&check_state=" + window.encodeURIComponent(BI.jsonEncode(treeNode.getCheckStatus()));
+ "&parentValues= " + window.encodeURIComponent(BI.jsonEncode(parentNode))
+ "&checkState=" + window.encodeURIComponent(BI.jsonEncode(treeNode.getCheckStatus()));
return BI.servletURL + '?op=' + self.options.op + '&cmd=' + self.options.cmd + "&" + param;
}
@ -241,7 +241,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
this._buildTree(map, path);
return;
}
var storeValues = BI.deepClone(this.options.paras.selected_values);
var storeValues = BI.deepClone(this.options.paras.selectedValues);
var treeNode = this._getTree(storeValues, path);
this._addTreeNode(map, parent, this._getNodeValue(node), treeNode);
},
@ -357,8 +357,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
self.nodes = $.fn.zTree.init(tree.element, setting, nodes);
};
var op = BI.extend({}, o.paras, {
times: 1,
type: BI.TreeView.REQ_TYPE_INIT_DATA
times: 1
});
o.itemsCreator(op, function (res) {
@ -451,8 +450,8 @@ BI.TreeView = BI.inherit(BI.Pane, {
},
setSelectedValue: function (value) {
this.options.paras.selected_values = value || {};
this.selected_values = BI.deepClone(value) || {};
this.options.paras.selectedValues = value || {};
this.selectedValues = BI.deepClone(value) || {};
},
updateValue: function (values, param) {
@ -492,10 +491,10 @@ BI.TreeView = BI.inherit(BI.Pane, {
}
});
BI.extend(BI.TreeView, {
REQ_TYPE_INIT_DATA: 0,
REQ_TYPE_ADJUST_DATA: 1,
REQ_TYPE_CALCULATE_SELECT_DATA: 2,
REQ_TYPE_SELECTED_DATA: 3
REQ_TYPE_INIT_DATA: 1,
REQ_TYPE_ADJUST_DATA: 2,
REQ_TYPE_SELECT_DATA: 3,
REQ_TYPE_GET_SELECTED_DATA: 4
});
BI.TreeView.EVENT_CHANGE = "EVENT_CHANGE";

4
src/component/allvaluechooser/combo.allvaluechooser.js

@ -72,8 +72,8 @@ BI.AllValueChooserCombo = BI.inherit(BI.Widget, {
var search = BI.Func.getSearchResult(items, kw);
items = search.matched.concat(search.finded);
});
if (options.selected_values) {//过滤
var filter = BI.makeObject(options.selected_values, true);
if (options.selectedValues) {//过滤
var filter = BI.makeObject(options.selectedValues, true);
items = BI.filter(items, function (i, ob) {
return !filter[ob.value];
});

158
src/component/treevaluechooser/combo.treevaluechooser.js

@ -83,10 +83,10 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
case BI.TreeView.REQ_TYPE_ADJUST_DATA:
self._reqAdjustTreeNode(options, callback);
break;
case BI.TreeView.REQ_TYPE_CALCULATE_SELECT_DATA:
case BI.TreeView.REQ_TYPE_SELECT_DATA:
self._reqSelectedTreeNode(options, callback);
break;
case BI.TreeView.REQ_TYPE_SELECTED_DATA:
case BI.TreeView.REQ_TYPE_GET_SELECTED_DATA:
self._reqDisplayTreeNode(options, callback);
break;
default :
@ -99,27 +99,27 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
_reqDisplayTreeNode: function (op, callback) {
var self = this;
var result = [];
var selected_values = op.selected_values;
var selectedValues = op.selectedValues;
if (selected_values == null || BI.isEmpty(selected_values)) {
if (selectedValues == null || BI.isEmpty(selectedValues)) {
callback({});
return;
}
doCheck(0, [], selected_values);
doCheck(0, [], selectedValues);
callback({
items: result
});
function doCheck(floor, parent_values, selected) {
function doCheck(floor, parentValues, selected) {
if (floor >= self.floors) {
return;
}
if (selected == null || BI.isEmpty(selected)) {
var children = self._getChildren(parent_values);
var children = self._getChildren(parentValues);
BI.each(children, function (i, child) {
var newParents = BI.clone(parent_values);
var newParents = BI.clone(parentValues);
newParents.push(child.value);
var llen = self._getChildCount(newParents);
createOneJson(child, llen);
@ -129,19 +129,19 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
}
BI.each(selected, function (k) {
var node = self._getNode(k);
var newParents = BI.clone(parent_values);
var newParents = BI.clone(parentValues);
newParents.push(node.value);
createOneJson(node, getCount(selected[k], newParents));
doCheck(floor + 1, newParents, selected[k]);
})
}
function getCount(jo, parent_values) {
function getCount(jo, parentValues) {
if (jo == null) {
return 0;
}
if (BI.isEmpty(jo)) {
return self._getChildCount(parent_values);
return self._getChildCount(parentValues);
}
return BI.size(jo);
@ -160,30 +160,30 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
_reqSelectedTreeNode: function (op, callback) {
var self = this;
var selected_values = op.selected_values;
var not_selected_value = op.not_selected_value || {};
var selectedValues = op.selectedValues;
var notSelectedValue = op.notSelectedValue || {};
var keyword = op.keyword || "";
var parent_values = op.parent_values || [];
var parentValues = op.parentValues || [];
if (selected_values == null || BI.isEmpty(selected_values)) {
if (selectedValues == null || BI.isEmpty(selectedValues)) {
callback({});
return;
}
dealWithSelectedValues(selected_values);
callback(selected_values);
dealWithSelectedValues(selectedValues);
callback(selectedValues);
function dealWithSelectedValues(selected_values) {
var p = BI.clone(parent_values);
p.push(not_selected_value);
function dealWithSelectedValues(selectedValues) {
var p = BI.clone(parentValues);
p.push(notSelectedValue);
if (isChild(selected_values, p)) {
if (isChild(selectedValues, p)) {
var result = [];
var finded = search(parent_values.length + 1, parent_values, not_selected_value, result);
var finded = search(parentValues.length + 1, parentValues, notSelectedValue, result);
if (finded === true) {
var next = selected_values;
var next = selectedValues;
BI.each(p, function (i, v) {
var t = next[v];
if (t == null) {
@ -191,7 +191,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
var split = p.slice(0, i);
var expanded = self._getChildren(split);
BI.each(expanded, function (m, child) {
if (i === p.length - 1 && child.value === not_selected_value) {
if (i === p.length - 1 && child.value === notSelectedValue) {
return true;
}
next[child.value] = {};
@ -208,7 +208,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
if (result.length > 0) {
BI.each(result, function (i, strs) {
self._buildTree(selected_values, strs);
self._buildTree(selectedValues, strs);
})
}
}
@ -248,8 +248,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return can;
}
function isChild(selected_values, parents) {
var t = selected_values;
function isChild(selectedValues, parents) {
var t = selectedValues;
for (var i = 0; i < parents.length; i++) {
var v = parents[i];
if (!BI.has(t, v)) {
@ -267,16 +267,16 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
_reqAdjustTreeNode: function (op, callback) {
var self = this;
var result = [];
var selected_values = op.selected_values;
if (selected_values == null || BI.isEmpty(selected_values)) {
var selectedValues = op.selectedValues;
if (selectedValues == null || BI.isEmpty(selectedValues)) {
callback({});
return;
}
BI.each(selected_values, function (k, v) {
BI.each(selectedValues, function (k, v) {
result.push([k]);
});
dealWithSelectedValues(selected_values, []);
dealWithSelectedValues(selectedValues, []);
var jo = {};
BI.each(result, function (i, strs) {
@ -313,23 +313,23 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
var self = this;
var result = [];
var keyword = op.keyword || "";
var selected_values = op.selected_values;
var last_search_value = op.last_search_value || "";
var selectedValues = op.selectedValues;
var lastSearchValue = op.lastSearchValue || "";
var output = search();
BI.nextTick(function () {
callback({
hasNext: output.length > self._const.perPage,
items: result,
last_search_value: BI.last(output)
lastSearchValue: BI.last(output)
})
});
function search() {
var children = self._getChildren([]);
var start = children.length;
if (last_search_value !== "") {
if (lastSearchValue !== "") {
for (var j = 0, len = start; j < len; j++) {
if (children[j].value === last_search_value) {
if (children[j].value === lastSearchValue) {
start = j + 1;
break;
}
@ -354,22 +354,22 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return output;
}
function nodeSearch(deep, parent_values, current, isAllSelect, result) {
function nodeSearch(deep, parentValues, current, isAllSelect, result) {
if (self._isMatch(current, keyword)) {
var checked = isAllSelect || isSelected(parent_values, current);
createOneJson(parent_values, current, false, checked, !isAllSelect && isHalf(parent_values, current), true, result);
var checked = isAllSelect || isSelected(parentValues, current);
createOneJson(parentValues, current, false, checked, !isAllSelect && isHalf(parentValues, current), true, result);
return [true, checked];
}
if (deep >= self.floors) {
return [false, false];
}
var newParents = BI.clone(parent_values);
var newParents = BI.clone(parentValues);
newParents.push(current);
var children = self._getChildren(newParents);
var can = false, checked = false;
var isCurAllSelected = isAllSelect || isAllSelected(parent_values, current);
var isCurAllSelected = isAllSelect || isAllSelected(parentValues, current);
BI.each(children, function (i, child) {
var state = nodeSearch(deep + 1, newParents, child.value, isCurAllSelected, result);
if (state[1] === true) {
@ -380,13 +380,13 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
}
});
if (can === true) {
checked = isCurAllSelected || (isSelected(parent_values, current) && checked);
createOneJson(parent_values, current, true, checked, false, false, result);
checked = isCurAllSelected || (isSelected(parentValues, current) && checked);
createOneJson(parentValues, current, true, checked, false, false, result);
}
return [can, checked];
}
function createOneJson(parent_values, value, isOpen, checked, half, flag, result) {
function createOneJson(parentValues, value, isOpen, checked, half, flag, result) {
var node = self.map[value];
result.push({
id: node.id,
@ -394,7 +394,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
text: node.text,
value: node.value,
title: node.title,
isParent: parent_values.length + 1 < self.floors,
isParent: parentValues.length + 1 < self.floors,
open: isOpen,
checked: checked,
halfCheck: half,
@ -402,8 +402,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
});
}
function isHalf(parent_values, value) {
var find = findSelectedObj(parent_values);
function isHalf(parentValues, value) {
var find = findSelectedObj(parentValues);
if (find == null) {
return null;
}
@ -416,8 +416,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
});
}
function isAllSelected(parent_values, value) {
var find = findSelectedObj(parent_values);
function isAllSelected(parentValues, value) {
var find = findSelectedObj(parentValues);
if (find == null) {
return null;
}
@ -430,8 +430,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
});
}
function isSelected(parent_values, value) {
var find = findSelectedObj(parent_values);
function isSelected(parentValues, value) {
var find = findSelectedObj(parentValues);
if (find == null) {
return false;
}
@ -442,12 +442,12 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
});
}
function findSelectedObj(parent_values) {
var find = selected_values;
function findSelectedObj(parentValues) {
var find = selectedValues;
if (find == null) {
return null;
}
BI.every(parent_values, function (i, v) {
BI.every(parentValues, function (i, v) {
find = find[v];
if (find == null) {
return false;
@ -462,23 +462,23 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
var self = this;
var result = [];
var times = op.times;
var check_state = op.check_state || {};
var parent_values = op.parent_values || [];
var selected_values = op.selected_values;
var checkState = op.checkState || {};
var parentValues = op.parentValues || [];
var selectedValues = op.selectedValues;
var valueMap = {};
if (judgeState(parent_values, selected_values, check_state)) {
valueMap = dealWidthSelectedValue(parent_values, selected_values);
if (judgeState(parentValues, selectedValues, checkState)) {
valueMap = dealWidthSelectedValue(parentValues, selectedValues);
}
var nodes = this._getChildren(parent_values);
var nodes = this._getChildren(parentValues);
for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) {
var state = getCheckState(nodes[i].value, parent_values, valueMap, check_state);
var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState);
result.push({
id: nodes[i].id,
pId: nodes[i].pId,
value: nodes[i].value,
text: nodes[i].text,
times: 1,
isParent: parent_values.length + 1 < this.floors,
isParent: parentValues.length + 1 < this.floors,
checked: state[0],
halfCheck: state[1]
})
@ -490,20 +490,20 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
});
});
function judgeState(parent_values, selected_value, check_state) {
var checked = check_state.checked, half = check_state.half;
if (parent_values.length > 0 && !checked) {
function judgeState(parentValues, selected_value, checkState) {
var checked = checkState.checked, half = checkState.half;
if (parentValues.length > 0 && !checked) {
return false;
}
return (parent_values.length === 0 || (checked && half) && !BI.isEmpty(selected_value));
return (parentValues.length === 0 || (checked && half) && !BI.isEmpty(selected_value));
}
function dealWidthSelectedValue(parent_values, selected_values) {
function dealWidthSelectedValue(parentValues, selectedValues) {
var valueMap = {};
BI.each(parent_values, function (i, v) {
selected_values = selected_values[v];
BI.each(parentValues, function (i, v) {
selectedValues = selectedValues[v];
});
BI.each(selected_values, function (value, obj) {
BI.each(selectedValues, function (value, obj) {
if (BI.isNull(obj)) {
valueMap[value] = [0, 0];
return;
@ -523,14 +523,14 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return valueMap;
}
function getCheckState(current, parent_values, valueMap, check_state) {
var checked = check_state.checked, half = check_state.half;
var hasChild = parent_values.length + 1 < self.floors;
function getCheckState(current, parentValues, valueMap, checkState) {
var checked = checkState.checked, half = checkState.half;
var hasChild = parentValues.length + 1 < self.floors;
var tempCheck = false, halfCheck = false;
if (BI.has(valueMap, current)) {
//可能是半选
if (valueMap[current][0] === 1) {
var values = BI.clone(parent_values);
var values = BI.clone(parentValues);
values.push(current);
if (hasChild && self._getChildCount(values) != valueMap[current][1]) {
halfCheck = true;
@ -569,9 +569,9 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return this.tree.search(v, "value");
},
_getChildren: function (parent_values) {
if (parent_values.length > 0) {
var value = BI.last(parent_values);
_getChildren: function (parentValues) {
if (parentValues.length > 0) {
var value = BI.last(parentValues);
var parent = this.tree.search(value, "value");
} else {
var parent = this.tree.getRoot();
@ -579,8 +579,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return parent.getChildren();
},
_getChildCount: function (parent_values) {
return this._getChildren(parent_values).length;
_getChildCount: function (parentValues) {
return this._getChildren(parentValues).length;
},
setValue: function (v) {

4
src/component/valuechooser/combo.valuechooser.js

@ -84,8 +84,8 @@ BI.ValueChooserCombo = BI.inherit(BI.Widget, {
var search = BI.Func.getSearchResult(items, kw);
items = search.matched.concat(search.finded);
});
if (options.selected_values) {//过滤
var filter = BI.makeObject(options.selected_values, true);
if (options.selectedValues) {//过滤
var filter = BI.makeObject(options.selectedValues, true);
items = BI.filter(items, function (i, ob) {
return !filter[ob.value];
});

2
src/widget/multiselect/check/multiselect.check.pane.js

@ -32,7 +32,7 @@ BI.MultiSelectCheckPane = BI.inherit(BI.Widget, {
items: opts.items,
itemsCreator: function (op, callback) {
op = BI.extend(op || {}, {
selected_values: self.storeValue.value
selectedValues: self.storeValue.value
});
if (self.storeValue.type === BI.Selection.Multi) {
callback({

2
src/widget/multiselect/multiselect.loader.js

@ -56,7 +56,7 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, {
itemsCreator: function (op, callback) {
var startValue = self._startValue;
self.storeValue && (op = BI.extend(op || {}, {
selected_values: BI.isKey(startValue) && self.storeValue.type === BI.Selection.Multi
selectedValues: BI.isKey(startValue) && self.storeValue.type === BI.Selection.Multi
? self.storeValue.value.concat(startValue) : self.storeValue.value
}));
opts.itemsCreator(op, function (ob) {

2
src/widget/multiselect/search/multiselect.search.loader.js

@ -51,7 +51,7 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, {
},
itemsCreator: function (op, callback) {
self.storeValue && (op = BI.extend(op || {}, {
selected_values: self.storeValue.value
selectedValues: self.storeValue.value
}));
opts.itemsCreator(op, function (ob) {
var keyword = ob.keyword = opts.keywordGetter();

4
src/widget/multiselect/trigger/searcher.multiselect.js

@ -104,13 +104,13 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
ob.value || (ob.value = []);
if (ob.type === BI.Selection.All) {
if (BI.size(ob.assist) === 1) {
this.editor.setState(o.valueFormatter(ob.assist[0] + "") || ob.assist[0] + "");
this.editor.setState(o.valueFormatter(ob.assist[0] + "") || (ob.assist[0] + ""));
} else {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.All);
}
} else {
if (BI.size(ob.value) === 1) {
this.editor.setState(o.valueFormatter(ob.value[0] + "" || ob.value[0] + ""));
this.editor.setState(o.valueFormatter(ob.value[0] + "") || (ob.value[0] + ""));
} else {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.None);
}

4
src/widget/multitree/check/multi.tree.check.pane.js

@ -23,7 +23,7 @@ BI.MultiTreeCheckPane = BI.inherit(BI.Pane, {
var self = this, opts = this.options;
this.selected_values = {};
this.selectedValues = {};
var continueSelect = BI.createWidget({
type: 'bi.text_button',
@ -60,7 +60,7 @@ BI.MultiTreeCheckPane = BI.inherit(BI.Pane, {
type: "bi.display_tree",
cls: "bi-multi-tree-display",
itemsCreator: function (op, callback) {
op.type = BI.TreeView.REQ_TYPE_SELECTED_DATA;
op.type = BI.TreeView.REQ_TYPE_GET_SELECTED_DATA;
opts.itemsCreator(op, callback);
}
});

2
src/widget/multitree/multi.tree.popup.js

@ -20,7 +20,7 @@ BI.MultiTreePopup = BI.inherit(BI.Pane, {
var self = this, opts = this.options;
this.selected_values = {};
this.selectedValues = {};
this.tree = BI.createWidget({
type: "bi.sync_tree",

3
src/widget/sequencetable/listnumber.sequencetable.js

@ -180,7 +180,8 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
},
_populate: function () {
this.header.populate();
this.headerContainer.empty();
this._createHeader();
this._layout();
this._calculateChildrenToRender();
},

Loading…
Cancel
Save