Browse Source

Merge pull request #51 in FUI/fineui from ~GUY/fineui:master to master

* commit 'cf2168d618b73b270bddf1e4559f29d42297aac6': (27 commits)
  add
  表格
  update
  add
  add
  columnresizer
  add
  tree
  add
  add
  add
  add
  add
  add
  add
  add
  setSelectedValue
  update
  update
  add
  ...
es6
guy 8 years ago
parent
commit
f836e7554f
  1. 13
      bi/base.css
  2. 289
      bi/base.js
  3. 40
      bi/case.js
  4. 59
      bi/core.js
  5. 199
      bi/widget.js
  6. 13
      docs/base.css
  7. 289
      docs/base.js
  8. 40
      docs/case.js
  9. 59
      docs/core.js
  10. 26
      docs/resource.css
  11. 199
      docs/widget.js
  12. 28
      src/base/combination/combo.js
  13. 15
      src/base/combination/expander.js
  14. 9
      src/base/combination/switcher.js
  15. 9
      src/base/layer/layer.floatbox.js
  16. 2
      src/base/single/button/button.basic.js
  17. 2
      src/base/single/editor/editor.multifile.js
  18. 2
      src/base/single/input/file.js
  19. 2
      src/base/single/tip/tip.bubble.js
  20. 58
      src/base/table/table.collection.js
  21. 51
      src/base/table/table.grid.js
  22. 22
      src/base/table/table.resizable.cell.js
  23. 14
      src/base/table/table.resizable.js
  24. 22
      src/base/tree/asynctree.js
  25. 37
      src/base/tree/parttree.js
  26. 16
      src/base/tree/treeview.js
  27. 4
      src/case/clipboard/index.js
  28. 34
      src/case/combo/bubblecombo/combo.bubble.js
  29. 2
      src/case/table/table.dynamicsummarylayertree.js
  30. 104
      src/component/treevaluechooser/abstract.treevaluechooser.js
  31. 4
      src/component/treevaluechooser/pane.treevaluechooser.js
  32. 9
      src/core/model.js
  33. 7
      src/core/mvc/fbi.js
  34. 6
      src/core/ob.js
  35. 19
      src/core/view.js
  36. 18
      src/core/widget.js
  37. 7
      src/css/base/combo/combo.bubble.css
  38. 3
      src/css/base/table/table.resizable.cell.css
  39. 3
      src/css/base/table/table.resizable.css
  40. 13
      src/css/resource/app.css
  41. 13
      src/css/resource/font.css
  42. 7
      src/less/base/combo/combo.bubble.less
  43. 5
      src/less/base/table/table.resizable.cell.less
  44. 3
      src/less/base/table/table.resizable.less
  45. 7
      src/less/lib/constant.less
  46. 13
      src/less/resource/app.less
  47. 13
      src/less/resource/font.less
  48. 4
      src/widget/arrangement/arrangement.js
  49. 4
      src/widget/downlist/combo.downlist.js
  50. 26
      src/widget/downlist/item.downlistgroup.js
  51. 42
      src/widget/multiselecttree/multiselecttree.js
  52. 7
      src/widget/multiselecttree/multiselecttree.popup.js
  53. 2
      src/widget/multitree/multi.tree.combo.js
  54. 6
      src/widget/multitree/multi.tree.search.pane.js

13
bi/base.css

@ -32,7 +32,11 @@
/****添加计算宽度的--运算符直接需要space****/ /****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/ /****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/ /**** custom color(自定义颜色,用于特定场景) ****/
.bi-bubble-combo .button-combo-triangle-wrapper {
position: fixed !important;
}
.bi-bubble-combo .bubble-combo-triangle-left { .bi-bubble-combo .bubble-combo-triangle-left {
z-index: 1;
width: 0; width: 0;
height: 0; height: 0;
border-top: 6px solid transparent; border-top: 6px solid transparent;
@ -40,6 +44,7 @@
border-bottom: 6px solid transparent; border-bottom: 6px solid transparent;
} }
.bi-bubble-combo .bubble-combo-triangle-right { .bi-bubble-combo .bubble-combo-triangle-right {
z-index: 1;
width: 0; width: 0;
height: 0; height: 0;
border-top: 6px solid transparent; border-top: 6px solid transparent;
@ -47,6 +52,7 @@
border-bottom: 6px solid transparent; border-bottom: 6px solid transparent;
} }
.bi-bubble-combo .bubble-combo-triangle-top { .bi-bubble-combo .bubble-combo-triangle-top {
z-index: 1;
width: 0; width: 0;
height: 0; height: 0;
border-left: 6px solid transparent; border-left: 6px solid transparent;
@ -54,6 +60,7 @@
border-top: 6px solid #3f8ce8; border-top: 6px solid #3f8ce8;
} }
.bi-bubble-combo .bubble-combo-triangle-bottom { .bi-bubble-combo .bubble-combo-triangle-bottom {
z-index: 1;
width: 0; width: 0;
height: 0; height: 0;
border-left: 6px solid transparent; border-left: 6px solid transparent;
@ -1282,6 +1289,9 @@ li.CodeMirror-hint-active {
.bi-resizable-table-cell .resizable-table-cell-resizer-container.dragging .resizable-table-cell-resizer-knob { .bi-resizable-table-cell .resizable-table-cell-resizer-container.dragging .resizable-table-cell-resizer-knob {
background-color: #3f8ce8; background-color: #3f8ce8;
} }
.bi-resizable-table-cell .resizable-table-cell-resizer-container.suitable .resizable-table-cell-resizer-knob {
background-color: #58cc7d;
}
/****添加计算宽度的--运算符直接需要space****/ /****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/ /****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/ /**** custom color(自定义颜色,用于特定场景) ****/
@ -1290,6 +1300,9 @@ li.CodeMirror-hint-active {
z-index: 1; z-index: 1;
background-color: #3f8ce8; background-color: #3f8ce8;
} }
.bi-resizable-table .resizable-table-resizer.suitable {
background-color: #58cc7d;
}
.bi-resizable-table .resizable-table-region-resizer { .bi-resizable-table .resizable-table-region-resizer {
cursor: ew-resize; cursor: ew-resize;
z-index: 1; z-index: 1;

289
bi/base.js

@ -710,7 +710,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
$(document).bind("mouseup." + self.getName(), function (e) { $(document).bind("mouseup." + self.getName(), function (e) {
// if (e.button === 0) { // if (e.button === 0) {
if (BI.DOM.isExist(self) && !hand.__isMouseInBounds__(e) && mouseDown === true && !selected) { if (BI.DOM.isExist(self) && !hand.__isMouseInBounds__(e) && mouseDown === true && !selected) {
self.setSelected(!self.isSelected()); // self.setSelected(!self.isSelected());
self._trigger(); self._trigger();
} }
mouseDown = false; mouseDown = false;
@ -1717,7 +1717,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
_getNodeValue: function (node) { _getNodeValue: function (node) {
//去除标红 //去除标红
return node.value == null ? node.text.replace(/<[^>]+>/g, "") : node.value; return node.value == null ? node.text.replace(/<[^>]+>/g, "").replaceAll(" ", " ") : node.value;
}, },
//获取半选框值 //获取半选框值
@ -1937,6 +1937,16 @@ BI.TreeView = BI.inherit(BI.Pane, {
}, },
checkAll: function (checked) { checkAll: function (checked) {
function setNode(children) {
BI.each(children, function (i, child) {
child.halfCheck = false;
setNode(child.children);
});
}
BI.each(this.nodes.getNodes(), function (i, node) {
node.halfCheck = false;
setNode(node.children);
});
this.nodes && this.nodes.checkAllNodes(checked); this.nodes && this.nodes.checkAllNodes(checked);
}, },
@ -1946,15 +1956,13 @@ BI.TreeView = BI.inherit(BI.Pane, {
//设置树节点的状态 //设置树节点的状态
setValue: function (value, param) { setValue: function (value, param) {
this.setSelectedValue(value);
this.checkAll(false); this.checkAll(false);
this.updateValue(value, param); this.updateValue(value, param);
this.refresh(); this.refresh();
}, },
setSelectedValue: function (value) { setSelectedValue: function (value) {
this.options.paras.selectedValues = BI.deepClone(value) || {}; this.options.paras.selectedValues = BI.deepClone(value || {});
this.selectedValues = BI.deepClone(value) || {};
}, },
updateValue: function (values, param) { updateValue: function (values, param) {
@ -2106,7 +2114,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
if (treeNode.checked === true) { if (treeNode.checked === true) {
} else { } else {
var tNode = treeNode; var tNode = treeNode;
var pNode = this._getTree(this.selectedValues, parentValues); var pNode = this._getTree(this.options.paras.selectedValues, parentValues);
if (BI.isNotNull(pNode[name])) { if (BI.isNotNull(pNode[name])) {
delete pNode[name]; delete pNode[name];
} }
@ -2114,7 +2122,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
parentValues = parentValues.slice(0, parentValues.length - 1); parentValues = parentValues.slice(0, parentValues.length - 1);
tNode = tNode.getParentNode(); tNode = tNode.getParentNode();
if (tNode != null) { if (tNode != null) {
pNode = this._getTree(this.selectedValues, parentValues); pNode = this._getTree(this.options.paras.selectedValues, parentValues);
name = this._getNodeValue(tNode); name = this._getNodeValue(tNode);
delete pNode[name]; delete pNode[name];
} }
@ -2128,10 +2136,10 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
var self = this, o = this.options; var self = this, o = this.options;
var parentValues = treeNode.parentValues || self._getParentValues(treeNode); var parentValues = treeNode.parentValues || self._getParentValues(treeNode);
var op = BI.extend({}, o.paras, { var op = BI.extend({}, o.paras, {
"id": treeNode.id, id: treeNode.id,
"times": 1, times: 1,
"parentValues": parentValues.concat(this._getNodeValue(treeNode)), parentValues: parentValues.concat(this._getNodeValue(treeNode)),
"checkState": treeNode.getCheckStatus() checkState: treeNode.getCheckStatus()
}); });
var complete = function (d) { var complete = function (d) {
var nodes = d.items || []; var nodes = d.items || [];
@ -2179,7 +2187,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
}, },
hasChecked: function () { hasChecked: function () {
return !BI.isEmpty(this.selectedValues) || BI.AsyncTree.superclass.hasChecked.apply(this, arguments); return !BI.isEmpty(this.options.paras.selectedValues) || BI.AsyncTree.superclass.hasChecked.apply(this, arguments);
}, },
getValue: function () { getValue: function () {
@ -2188,20 +2196,18 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
} }
var checkedValues = this._getSelectedValues(); var checkedValues = this._getSelectedValues();
if (BI.isEmpty(checkedValues)) { if (BI.isEmpty(checkedValues)) {
return BI.deepClone(this.selectedValues); return BI.deepClone(this.options.paras.selectedValues);
} }
if (BI.isEmpty(this.selectedValues)) { if (BI.isEmpty(this.options.paras.selectedValues)) {
return checkedValues; return checkedValues;
} }
return this._join(checkedValues, this.selectedValues); return this._join(checkedValues, this.options.paras.selectedValues);
}, },
//生成树方法 //生成树方法
stroke: function (config) { stroke: function (config) {
delete this.options.keyword; delete this.options.keyword;
BI.extend(this.options.paras, config); BI.extend(this.options.paras, config);
//取消选中时使用
this.selectedValues = BI.deepClone(this.options.paras.selectedValues) || {};
var setting = this._configSetting(); var setting = this._configSetting();
this._initTree(setting); this._initTree(setting);
} }
@ -2249,34 +2255,28 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
_selectTreeNode: function (treeId, treeNode) { _selectTreeNode: function (treeId, treeNode) {
var self = this, o = this.options; var self = this, o = this.options;
var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode)); var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var name = this._getNodeValue(treeNode) var name = this._getNodeValue(treeNode);
// var values = parentValues.concat([name]);
if (treeNode.checked === true) { if (treeNode.checked === true) {
BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments); BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
} else { } else {
//如果选中的值中不存在该值不处理
var t = this.options.paras.selectedValues;
var p = parentValues.concat(name);
for (var i = 0, len = p.length; i < len; i++) {
t = t[p[i]];
if (t == null) {
return;
}
if (BI.isEmpty(t)) {
break;
}
}
o.itemsCreator(BI.extend({}, o.paras, { o.itemsCreator(BI.extend({}, o.paras, {
type: BI.TreeView.REQ_TYPE_SELECT_DATA, type: BI.TreeView.REQ_TYPE_SELECT_DATA,
selectedValues: this.selectedValues,
notSelectedValue: name, notSelectedValue: name,
parentValues: parentValues parentValues: parentValues
}), function (new_values) { }), function (new_values) {
if (BI.isEqual(self.selectedValues, new_values)) { self.options.paras.selectedValues = new_values;
var tNode = treeNode;
var pNode = self._getTree(new_values, parentValues);
if (pNode[name]) {
delete pNode[name];
}
while (tNode != null && BI.isEmpty(pNode)) {
parentValues = parentValues.slice(0, parentValues.length - 1);
tNode = tNode.getParentNode();
if (tNode != null) {
pNode = self._getTree(new_values, parentValues);
name = self._getNodeValue(tNode);
delete pNode[name];
}
}
}
self.selectedValues = new_values;
BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments); BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
}); });
} }
@ -2373,9 +2373,6 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
delete o.paras.keyword; delete o.paras.keyword;
BI.extend(o.paras, config); BI.extend(o.paras, config);
delete o.paras.lastSearchValue; delete o.paras.lastSearchValue;
//取消选中时使用
this.selectedValues = BI.deepClone(o.paras.selectedValues) || {};
//delete this.options.paras.selectedValues;
var setting = this._configSetting(); var setting = this._configSetting();
this._initTree(setting, o.paras.keyword); this._initTree(setting, o.paras.keyword);
} }
@ -2903,6 +2900,7 @@ BI.Combo = BI.inherit(BI.Widget, {
toggle: true, toggle: true,
direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
isDefaultInit: false, isDefaultInit: false,
destroyWhenHide: false,
isNeedAdjustHeight: true,//是否需要高度调整 isNeedAdjustHeight: true,//是否需要高度调整
isNeedAdjustWidth: true, isNeedAdjustWidth: true,
stopEvent: false, stopEvent: false,
@ -2925,17 +2923,21 @@ BI.Combo = BI.inherit(BI.Widget, {
this._initCombo(); this._initCombo();
this._initPullDownAction(); this._initPullDownAction();
this.combo.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.combo.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (self.isEnabled() && this.isEnabled()) { if (self.isEnabled() && self.isValid()) {
if (type === BI.Events.EXPAND) { if (type === BI.Events.EXPAND) {
self._popupView(); self._popupView();
} }
if (type === BI.Events.COLLAPSE) { if (type === BI.Events.COLLAPSE) {
self._hideView(); self._hideView();
} }
if (type === BI.Events.EXPAND || type === BI.Events.COLLAPSE) { if (type === BI.Events.EXPAND) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.fireEvent(BI.Combo.EVENT_EXPAND);
}
if (type === BI.Events.COLLAPSE) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.isViewVisible() && self.fireEvent(BI.Combo.EVENT_COLLAPSE);
} }
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
self.fireEvent(BI.Combo.EVENT_TRIGGER_CHANGE, obj); self.fireEvent(BI.Combo.EVENT_TRIGGER_CHANGE, obj);
} }
@ -2943,12 +2945,12 @@ BI.Combo = BI.inherit(BI.Widget, {
}); });
self.element.on("mouseenter." + self.getName(), function (e) { self.element.on("mouseenter." + self.getName(), function (e) {
if (self.isEnabled() && self.combo.isEnabled()) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
self.element.addClass(o.hoverClass); self.element.addClass(o.hoverClass);
} }
}); });
self.element.on("mouseleave." + self.getName(), function (e) { self.element.on("mouseleave." + self.getName(), function (e) {
if (self.isEnabled() && self.combo.isEnabled()) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
self.element.removeClass(o.hoverClass); self.element.removeClass(o.hoverClass);
} }
}); });
@ -2995,14 +2997,14 @@ BI.Combo = BI.inherit(BI.Widget, {
switch (ev) { switch (ev) {
case "hover": case "hover":
self.element.on("mouseenter." + self.getName(), function (e) { self.element.on("mouseenter." + self.getName(), function (e) {
if (self.isEnabled() && self.combo.isEnabled()) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
self._popupView(); self._popupView();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo);
self.fireEvent(BI.Combo.EVENT_EXPAND); self.fireEvent(BI.Combo.EVENT_EXPAND);
} }
}); });
self.element.on("mouseleave." + self.getName(), function (e) { self.element.on("mouseleave." + self.getName(), function (e) {
if (self.isEnabled() && self.combo.isEnabled() && o.toggle === true) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid() && o.toggle === true) {
self._hideView(); self._hideView();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.combo); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.combo);
self.fireEvent(BI.Combo.EVENT_COLLAPSE); self.fireEvent(BI.Combo.EVENT_COLLAPSE);
@ -3012,7 +3014,7 @@ BI.Combo = BI.inherit(BI.Widget, {
case "click": case "click":
var debounce = BI.debounce(function (e) { var debounce = BI.debounce(function (e) {
if (self.combo.element.__isMouseInBounds__(e)) { if (self.combo.element.__isMouseInBounds__(e)) {
if (self.isEnabled() && self.combo.isEnabled()) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
o.toggle ? self._toggle() : self._popupView(); o.toggle ? self._toggle() : self._popupView();
if (self.isViewVisible()) { if (self.isViewVisible()) {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo);
@ -3088,7 +3090,13 @@ BI.Combo = BI.inherit(BI.Widget, {
_hideView: function () { _hideView: function () {
this.fireEvent(BI.Combo.EVENT_BEFORE_HIDEVIEW); this.fireEvent(BI.Combo.EVENT_BEFORE_HIDEVIEW);
if (this.options.destroyWhenHide === true) {
this.popupView && this.popupView.destroy();
this.popupView = null;
this._rendered = false;
} else {
this.popupView && this.popupView.invisible(); this.popupView && this.popupView.invisible();
}
this.element.removeClass(this.options.comboClass); this.element.removeClass(this.options.comboClass);
$(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); $(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName());
@ -3219,6 +3227,7 @@ BI.Combo = BI.inherit(BI.Widget, {
_setEnable: function (arg) { _setEnable: function (arg) {
BI.Combo.superclass._setEnable.apply(this, arguments); BI.Combo.superclass._setEnable.apply(this, arguments);
!arg && this.element.removeClass(this.options.hoverClass);
!arg && this.isViewVisible() && this._hideView(); !arg && this.isViewVisible() && this._hideView();
}, },
@ -3316,20 +3325,20 @@ BI.Expander = BI.inherit(BI.Widget, {
this._initExpander(); this._initExpander();
this._initPullDownAction(); this._initPullDownAction();
this.expander.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.expander.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (self.isEnabled() && self.isValid()) {
if (type === BI.Events.EXPAND) { if (type === BI.Events.EXPAND) {
self._popupView(); self._popupView();
} }
if (type === BI.Events.COLLAPSE) { if (type === BI.Events.COLLAPSE) {
self._hideView(); self._hideView();
} }
if (self.isEnabled() && this.isEnabled()) {
if (type === BI.Events.EXPAND) { if (type === BI.Events.EXPAND) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.fireEvent(BI.Expander.EVENT_EXPAND); self.fireEvent(BI.Expander.EVENT_EXPAND);
} }
if (type === BI.Events.COLLAPSE) { if (type === BI.Events.COLLAPSE) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.fireEvent(BI.Expander.EVENT_COLLAPSE); self.isViewVisible() && self.fireEvent(BI.Expander.EVENT_COLLAPSE);
} }
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
self.fireEvent(BI.Expander.EVENT_TRIGGER_CHANGE, value, obj); self.fireEvent(BI.Expander.EVENT_TRIGGER_CHANGE, value, obj);
@ -3338,11 +3347,11 @@ BI.Expander = BI.inherit(BI.Widget, {
}); });
this.element.hover(function () { this.element.hover(function () {
if (self.isEnabled() && self.expander.isEnabled()) { if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid()) {
self.element.addClass(o.hoverClass); self.element.addClass(o.hoverClass);
} }
}, function () { }, function () {
if (self.isEnabled() && self.expander.isEnabled()) { if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid()) {
self.element.removeClass(o.hoverClass); self.element.removeClass(o.hoverClass);
} }
}); });
@ -3378,13 +3387,13 @@ BI.Expander = BI.inherit(BI.Widget, {
switch (e) { switch (e) {
case "hover": case "hover":
self.element[e](function (e) { self.element[e](function (e) {
if (self.isEnabled() && self.expander.isEnabled()) { if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid()) {
self._popupView(); self._popupView();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, '', self.expander); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, '', self.expander);
self.fireEvent(BI.Expander.EVENT_EXPAND); self.fireEvent(BI.Expander.EVENT_EXPAND);
} }
}, function () { }, function () {
if (self.isEnabled() && self.expander.isEnabled() && o.toggle) { if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid() && o.toggle) {
self._hideView(); self._hideView();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, '', self.expander); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, '', self.expander);
self.fireEvent(BI.Expander.EVENT_COLLAPSE); self.fireEvent(BI.Expander.EVENT_COLLAPSE);
@ -3395,7 +3404,7 @@ BI.Expander = BI.inherit(BI.Widget, {
if (e) { if (e) {
self.element.off(e + "." + self.getName()).on(e + "." + self.getName(), BI.debounce(function (e) { self.element.off(e + "." + self.getName()).on(e + "." + self.getName(), BI.debounce(function (e) {
if (self.expander.element.__isMouseInBounds__(e)) { if (self.expander.element.__isMouseInBounds__(e)) {
if (self.isEnabled() && self.expander.isEnabled()) { if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid()) {
o.toggle ? self._toggle() : self._popupView(); o.toggle ? self._toggle() : self._popupView();
if (self.isExpanded()) { if (self.isExpanded()) {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.expander); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.expander);
@ -3486,6 +3495,7 @@ BI.Expander = BI.inherit(BI.Widget, {
_setEnable: function (arg) { _setEnable: function (arg) {
BI.Expander.superclass._setEnable.apply(this, arguments); BI.Expander.superclass._setEnable.apply(this, arguments);
!arg && this.element.removeClass(this.options.hoverClass);
!arg && this.isViewVisible() && this._hideView(); !arg && this.isViewVisible() && this._hideView();
}, },
@ -4483,15 +4493,20 @@ BI.Switcher = BI.inherit(BI.Widget, {
this._initSwitcher(); this._initSwitcher();
this._initPullDownAction(); this._initPullDownAction();
this.switcher.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.switcher.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (self.isEnabled() && this.isEnabled()) { if (self.isEnabled() && self.isValid()) {
if (type === BI.Events.EXPAND) { if (type === BI.Events.EXPAND) {
self._popupView(); self._popupView();
} }
if (type === BI.Events.COLLAPSE) { if (type === BI.Events.COLLAPSE) {
self._hideView(); self._hideView();
} }
if (type === BI.Events.EXPAND || type === BI.Events.COLLAPSE) { if (type === BI.Events.EXPAND) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.fireEvent(BI.Switcher.EVENT_EXPAND);
}
if (type === BI.Events.COLLAPSE) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.isViewVisible() && self.fireEvent(BI.Switcher.EVENT_COLLAPSE);
} }
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
self.fireEvent(BI.Switcher.EVENT_TRIGGER_CHANGE, value, obj); self.fireEvent(BI.Switcher.EVENT_TRIGGER_CHANGE, value, obj);
@ -15109,15 +15124,16 @@ BI.FloatBox = BI.inherit(BI.Widget, {
populate: function (sectionProvider) { populate: function (sectionProvider) {
var self = this; var self = this;
if (this.currentSectionProvider && this.currentSectionProvider !== sectionProvider) {
this.currentSectionProvider.destroy();
}
this.currentSectionProvider = sectionProvider; this.currentSectionProvider = sectionProvider;
sectionProvider.rebuildNorth(this._north); sectionProvider.rebuildNorth(this._north);
sectionProvider.rebuildCenter(this._center); sectionProvider.rebuildCenter(this._center);
sectionProvider.rebuildSouth(this._south); sectionProvider.rebuildSouth(this._south);
if (sectionProvider instanceof BI.Widget) {
sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () { sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () {
self.close(); self.close();
}) })
}
}, },
show: function () { show: function () {
@ -15140,6 +15156,10 @@ BI.FloatBox = BI.inherit(BI.Widget, {
setZindex: function (zindex) { setZindex: function (zindex) {
this.element.css({"z-index": zindex}); this.element.css({"z-index": zindex});
},
destroyed: function () {
this.currentSectionProvider && this.currentSectionProvider.destroy();
} }
}); });
@ -18176,7 +18196,7 @@ BI.MultifileEditor = BI.inherit(BI.Single, {
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-multifile-editor", baseCls: (conf.baseCls || "") + " bi-multifile-editor",
multiple: false, multiple: false,
maxSize: 1024 * 1024, maxSize: -1,//1024 * 1024
accept: "", accept: "",
url: "" url: ""
}) })
@ -18937,7 +18957,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
url: "", url: "",
multiple: true, multiple: true,
accept: "", /**'*.jpg; *.zip'**/ accept: "", /**'*.jpg; *.zip'**/
maxSize: 1024 * 1024 maxSize: -1 //1024 * 1024
}) })
}, },
@ -20063,7 +20083,7 @@ BI.Bubble = BI.inherit(BI.Tip, {
_right: function(){ _right: function(){
return BI.createWidget({ return BI.createWidget({
type: "bi.inline", type: "bi.left",
items: [{ items: [{
el: { el: {
type: "bi.layout", type: "bi.layout",
@ -29034,11 +29054,26 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
return this.options.isNeedFreeze ? this.options.freezeCols.length : 0; return this.options.isNeedFreeze ? this.options.freezeCols.length : 0;
}, },
_getFreezeHeaderHeight: function () {
var o = this.options;
if (o.header.length * o.headerRowSize >= this._height) {
return 0;
}
return o.header.length * o.headerRowSize;
},
_getActualItems: function () {
var o = this.options;
if (o.header.length * o.headerRowSize >= this._height) {
return o.header.concat(o.items);
}
return o.items;
},
_populateScrollbar: function () { _populateScrollbar: function () {
var o = this.options; var o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; summaryColumnSizeArray = [];
var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size; totalLeftColumnSize += size;
@ -29052,8 +29087,8 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size; summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size;
} }
}); });
this.topScrollbar.setContentSize(o.items.length * o.rowSize); this.topScrollbar.setContentSize(this._getActualItems().length * o.rowSize);
this.topScrollbar.setSize(this._height - o.header.length * o.headerRowSize); this.topScrollbar.setSize(this._height - this._getFreezeHeaderHeight());
this.topScrollbar.setPosition(this.bottomRightCollection.getScrollTop()); this.topScrollbar.setPosition(this.bottomRightCollection.getScrollTop());
this.topScrollbar.populate(); this.topScrollbar.populate();
@ -29068,7 +29103,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
this.rightScrollbar.populate(); this.rightScrollbar.populate();
var items = this.scrollBarLayout.attr("items"); var items = this.scrollBarLayout.attr("items");
items[0].top = o.header.length * o.headerRowSize; items[0].top = this._getFreezeHeaderHeight();
items[1].top = this._height; items[1].top = this._height;
items[2].top = this._height; items[2].top = this._height;
items[2].left = regionSize; items[2].left = regionSize;
@ -29079,8 +29114,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
_populateTable: function () { _populateTable: function () {
var self = this, o = this.options; var self = this, o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; summaryColumnSizeArray = [];
var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size; totalLeftColumnSize += size;
@ -29096,13 +29130,13 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
}); });
var otlw = regionSize; var otlw = regionSize;
var otlh = o.header.length * o.headerRowSize; var otlh = this._getFreezeHeaderHeight();
var otrw = this._width - regionSize; var otrw = this._width - regionSize;
var otrh = o.header.length * o.headerRowSize; var otrh = this._getFreezeHeaderHeight();
var oblw = regionSize; var oblw = regionSize;
var oblh = this._height - o.header.length * o.headerRowSize; var oblh = this._height - otlh;
var obrw = this._width - regionSize; var obrw = this._width - regionSize;
var obrh = this._height - o.header.length * o.headerRowSize; var obrh = this._height - otrh;
var tlw = otlw + this._scrollBarSize; var tlw = otlw + this._scrollBarSize;
var tlh = otlh + this._scrollBarSize; var tlh = otlh + this._scrollBarSize;
@ -29146,9 +29180,9 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
var items = this.contextLayout.attr("items"); var items = this.contextLayout.attr("items");
items[1].left = regionSize; items[1].left = regionSize;
items[2].top = o.header.length * o.headerRowSize; items[2].top = this._getFreezeHeaderHeight();
items[3].left = regionSize; items[3].left = regionSize;
items[3].top = o.header.length * o.headerRowSize; items[3].top = this._getFreezeHeaderHeight();
this.contextLayout.attr("items", items); this.contextLayout.attr("items", items);
this.contextLayout.resize(); this.contextLayout.resize();
@ -29164,8 +29198,8 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
}; };
run(this.topLeftItems, o.header, leftHeader); run(this.topLeftItems, o.header, leftHeader);
run(this.topRightItems, o.header, rightHeader); run(this.topRightItems, o.header, rightHeader);
run(this.bottomLeftItems, o.items, leftItems); run(this.bottomLeftItems, this._getActualItems(), leftItems);
run(this.bottomRightItems, o.items, rightItems); run(this.bottomRightItems, this._getActualItems(), rightItems);
this.topLeftCollection._populate(leftHeader); this.topLeftCollection._populate(leftHeader);
this.topRightCollection._populate(rightHeader); this.topRightCollection._populate(rightHeader);
@ -29176,13 +29210,23 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
_digest: function () { _digest: function () {
var o = this.options; var o = this.options;
var freezeColLength = this._getFreezeColLength(); var freezeColLength = this._getFreezeColLength();
//如果表头位置不够,取消表头冻结
if (this._getFreezeHeaderHeight() <= 0) {
this.topLeftItems = [];
this.topRightItems = [];
this.bottomLeftItems = this._serialize(this._getActualItems(), 0, freezeColLength, o.rowSize, o.columnSize, o.mergeCols, BI.range(o.header.length));
this.bottomRightItems = this._serialize(this._getActualItems(), freezeColLength, o.columnSize.length, o.rowSize, o.columnSize, o.mergeCols, BI.range(o.header.length));
} else {
this.topLeftItems = this._serialize(o.header, 0, freezeColLength, o.headerRowSize, o.columnSize, o.mergeCols); this.topLeftItems = this._serialize(o.header, 0, freezeColLength, o.headerRowSize, o.columnSize, o.mergeCols);
this.topRightItems = this._serialize(o.header, freezeColLength, o.columnSize.length, o.headerRowSize, o.columnSize, true); this.topRightItems = this._serialize(o.header, freezeColLength, o.columnSize.length, o.headerRowSize, o.columnSize, true);
this.bottomLeftItems = this._serialize(o.items, 0, freezeColLength, o.rowSize, o.columnSize, o.mergeCols); this.bottomLeftItems = this._serialize(o.items, 0, freezeColLength, o.rowSize, o.columnSize, o.mergeCols);
this.bottomRightItems = this._serialize(o.items, freezeColLength, o.columnSize.length, o.rowSize, o.columnSize, o.mergeCols); this.bottomRightItems = this._serialize(o.items, freezeColLength, o.columnSize.length, o.rowSize, o.columnSize, o.mergeCols);
}
}, },
_serialize: function (items, startCol, endCol, rowHeight, columnSize, mergeCols) { _serialize: function (items, startCol, endCol, rowHeight, columnSize, mergeCols, mergeRows) {
mergeCols = mergeCols || [];
mergeRows = mergeRows || [];
var self = this, o = this.options; var self = this, o = this.options;
var result = [], cache = {}, preCol = {}, preRow = {}, map = {}; var result = [], cache = {}, preCol = {}, preRow = {}, map = {};
var summaryColumnSize = []; var summaryColumnSize = [];
@ -29232,7 +29276,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
} }
cache[i][j] = cols[j]; cache[i][j] = cols[j];
map[i][j] = {}; map[i][j] = {};
if (mergeCols === true || mergeCols.indexOf(j) > -1) { if (mergeCols === true || mergeCols.indexOf(j) > -1 || mergeRows === true || mergeRows.indexOf(i) > -1) {
if (i === 0 && j === startCol) { if (i === 0 && j === startCol) {
createOneEl(0, startCol); createOneEl(0, startCol);
} else if (j === startCol && i > 0) { } else if (j === startCol && i > 0) {
@ -29679,7 +29723,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.topLeftGrid = BI.createWidget({ this.topLeftGrid = BI.createWidget({
type: "bi.grid_view", type: "bi.grid_view",
rowHeightGetter: rowHeightGetter, rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnLeftWidthGetter, columnWidthGetter: columnLeftWidthGetter
}); });
this.topLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { this.topLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomLeftGrid.setScrollLeft(scroll.scrollLeft); self.bottomLeftGrid.setScrollLeft(scroll.scrollLeft);
@ -29689,7 +29733,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.topRightGrid = BI.createWidget({ this.topRightGrid = BI.createWidget({
type: "bi.grid_view", type: "bi.grid_view",
rowHeightGetter: rowHeightGetter, rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnRightWidthGetter, columnWidthGetter: columnRightWidthGetter
}); });
this.topRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { this.topRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomRightGrid.setScrollLeft(scroll.scrollLeft); self.bottomRightGrid.setScrollLeft(scroll.scrollLeft);
@ -29699,7 +29743,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.bottomLeftGrid = BI.createWidget({ this.bottomLeftGrid = BI.createWidget({
type: "bi.grid_view", type: "bi.grid_view",
rowHeightGetter: rowHeightGetter, rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnLeftWidthGetter, columnWidthGetter: columnLeftWidthGetter
}); });
this.bottomLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { this.bottomLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomRightGrid.setScrollTop(scroll.scrollTop); self.bottomRightGrid.setScrollTop(scroll.scrollTop);
@ -29710,7 +29754,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.bottomRightGrid = BI.createWidget({ this.bottomRightGrid = BI.createWidget({
type: "bi.grid_view", type: "bi.grid_view",
rowHeightGetter: rowHeightGetter, rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnRightWidthGetter, columnWidthGetter: columnRightWidthGetter
}); });
this.bottomRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { this.bottomRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomLeftGrid.setScrollTop(scroll.scrollTop); self.bottomLeftGrid.setScrollTop(scroll.scrollTop);
@ -29798,7 +29842,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
el: this.leftScrollbar, el: this.leftScrollbar,
left: 0 left: 0
}, { }, {
el: this.rightScrollbar, el: this.rightScrollbar
}] }]
}); });
this._width = o.width - BI.GridTableScrollbar.SIZE; this._width = o.width - BI.GridTableScrollbar.SIZE;
@ -29818,11 +29862,26 @@ BI.GridTable = BI.inherit(BI.Widget, {
return this.options.isNeedFreeze ? this.options.freezeCols.length : 0; return this.options.isNeedFreeze ? this.options.freezeCols.length : 0;
}, },
_getFreezeHeaderHeight: function () {
var o = this.options;
if (o.header.length * o.headerRowSize >= this._height) {
return 0;
}
return o.header.length * o.headerRowSize;
},
_getActualItems: function () {
var o = this.options;
if (o.header.length * o.headerRowSize >= this._height) {
return o.header.concat(o.items);
}
return o.items;
},
_populateScrollbar: function () { _populateScrollbar: function () {
var o = this.options; var o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; summaryColumnSizeArray = [];
var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size; totalLeftColumnSize += size;
@ -29836,8 +29895,8 @@ BI.GridTable = BI.inherit(BI.Widget, {
summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size; summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size;
} }
}); });
this.topScrollbar.setContentSize(o.items.length * o.rowSize); this.topScrollbar.setContentSize(this._getActualItems().length * o.rowSize);
this.topScrollbar.setSize(this._height - o.header.length * o.headerRowSize); this.topScrollbar.setSize(this._height - this._getFreezeHeaderHeight());
this.topScrollbar.setPosition(Math.min(this.bottomLeftGrid.getScrollTop(), this.bottomRightGrid.getScrollTop())); this.topScrollbar.setPosition(Math.min(this.bottomLeftGrid.getScrollTop(), this.bottomRightGrid.getScrollTop()));
this.topScrollbar.populate(); this.topScrollbar.populate();
@ -29852,7 +29911,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.rightScrollbar.populate(); this.rightScrollbar.populate();
var items = this.scrollBarLayout.attr("items"); var items = this.scrollBarLayout.attr("items");
items[0].top = o.header.length * o.headerRowSize; items[0].top = this._getFreezeHeaderHeight();
items[1].top = this._height; items[1].top = this._height;
items[2].top = this._height; items[2].top = this._height;
items[2].left = regionSize; items[2].left = regionSize;
@ -29886,7 +29945,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
var o = this.options; var o = this.options;
var freezeColLength = this._getFreezeColLength(); var freezeColLength = this._getFreezeColLength();
var leftItems = [], rightItems = []; var leftItems = [], rightItems = [];
BI.each(o.items, function (i, cols) { BI.each(this._getActualItems(), function (i, cols) {
leftItems[i] = []; leftItems[i] = [];
rightItems[i] = []; rightItems[i] = [];
BI.each(cols, function (j, col) { BI.each(cols, function (j, col) {
@ -29907,7 +29966,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
_populateTable: function () { _populateTable: function () {
var self = this, o = this.options; var self = this, o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; summaryColumnSizeArray = [];
var freezeColLength = this._getFreezeColLength(); var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
@ -29924,13 +29983,13 @@ BI.GridTable = BI.inherit(BI.Widget, {
}); });
var otlw = regionSize; var otlw = regionSize;
var otlh = o.header.length * o.headerRowSize; var otlh = this._getFreezeHeaderHeight();
var otrw = this._width - regionSize; var otrw = this._width - regionSize;
var otrh = o.header.length * o.headerRowSize; var otrh = this._getFreezeHeaderHeight();
var oblw = regionSize; var oblw = regionSize;
var oblh = this._height - o.header.length * o.headerRowSize; var oblh = this._height - otlh;
var obrw = this._width - regionSize; var obrw = this._width - regionSize;
var obrh = this._height - o.header.length * o.headerRowSize; var obrh = this._height - otrh;
var tlw = otlw + this._scrollBarSize; var tlw = otlw + this._scrollBarSize;
var tlh = otlh + this._scrollBarSize; var tlh = otlh + this._scrollBarSize;
@ -29983,9 +30042,9 @@ BI.GridTable = BI.inherit(BI.Widget, {
var items = this.contextLayout.attr("items"); var items = this.contextLayout.attr("items");
items[1].left = regionSize; items[1].left = regionSize;
items[2].top = o.header.length * o.headerRowSize; items[2].top = this._getFreezeHeaderHeight();
items[3].left = regionSize; items[3].left = regionSize;
items[3].top = o.header.length * o.headerRowSize; items[3].top = this._getFreezeHeaderHeight();
this.contextLayout.attr("items", items); this.contextLayout.attr("items", items);
this.contextLayout.resize(); this.contextLayout.resize();
@ -32383,6 +32442,9 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
return BI.extend(BI.ResizableTableCell.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.ResizableTableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-resizable-table-cell", baseCls: "bi-resizable-table-cell",
cell: {}, cell: {},
minSize: 15,
// suitableSize,
maxSize: Number.MAX_VALUE,
start: BI.emptyFn, start: BI.emptyFn,
resize: BI.emptyFn, resize: BI.emptyFn,
stop: BI.emptyFn stop: BI.emptyFn
@ -32396,22 +32458,37 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
var startDrag = false; var startDrag = false;
var size = 0, offset = 0, defaultSize = o.width; var size = 0, offset = 0, defaultSize = o.width;
function optimizeSize(s) {
var optSize = BI.clamp(s, o.minSize, o.maxSize || Number.MAX_VALUE);
if (o.suitableSize) {
if (Math.abs(o.suitableSize - optSize) < 5) {
optSize = o.suitableSize;
self.handler.element.addClass("suitable");
} else {
self.handler.element.removeClass("suitable");
}
}
return optSize;
}
var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX, deltaY) { var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX, deltaY) {
if (mouseMoveTracker.isDragging()) { if (mouseMoveTracker.isDragging()) {
startDrag = true; startDrag = true;
offset += deltaX; offset += deltaX;
size = BI.clamp(defaultSize + offset, 15, Number.MAX_VALUE); size = optimizeSize(defaultSize + offset);
self.handler.element.addClass("dragging"); self.handler.element.addClass("dragging");
o.resize(size); o.resize(size);
} }
}, function () { }, function () {
if (startDrag === true) { if (startDrag === true) {
size = BI.clamp(size, 15, Number.MAX_VALUE); size = optimizeSize(size);
o.stop(size); o.stop(size);
size = 0; size = 0;
offset = 0; offset = 0;
defaultSize = o.width; defaultSize = o.width;
self.handler.element.removeClass("dragging"); self.handler.element.removeClass("dragging");
self.handler.element.removeClass("suitable");
startDrag = false; startDrag = false;
} }
mouseMoveTracker.releaseMouseMoves(); mouseMoveTracker.releaseMouseMoves();
@ -32489,6 +32566,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
mergeCols: [], mergeCols: [],
mergeRule: BI.emptyFn, mergeRule: BI.emptyFn,
columnSize: [], columnSize: [],
minColumnSize: [],
maxColumnSize: [],
freezeCols: [], freezeCols: [],
header: [], header: [],
items: [], items: [],
@ -32681,7 +32760,13 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
self.resizer.setVisible(true); self.resizer.setVisible(true);
var height = o.headerRowSize + self._getRegionRowSize()[1]; var height = o.headerRowSize + self._getRegionRowSize()[1];
self.resizer.setHeight(height); self.resizer.setHeight(height);
if (o.minColumnSize[j]) {
if (size === o.minColumnSize[j]) {
self.resizer.element.addClass("suitable");
} else {
self.resizer.element.removeClass("suitable");
}
}
self._setResizerPosition(self._getResizerLeft(j) + size, (o.header.length - 1) * o.headerRowSize); self._setResizerPosition(self._getResizerLeft(j) + size, (o.header.length - 1) * o.headerRowSize);
}; };
var stop = function (j, size) { var stop = function (j, size) {
@ -32704,6 +32789,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
result[i][j] = { result[i][j] = {
type: "bi.resizable_table_cell", type: "bi.resizable_table_cell",
cell: col, cell: col,
suitableSize: o.minColumnSize[i],
maxSize: o.maxColumnSize[i],
resize: BI.bind(resize, null, j), resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j) stop: BI.bind(stop, null, j)
}; };
@ -32713,6 +32800,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
result[r - 1][j] = { result[r - 1][j] = {
type: "bi.resizable_table_cell", type: "bi.resizable_table_cell",
cell: result[r - 1][j], cell: result[r - 1][j],
suitableSize: o.minColumnSize[i],
maxSize: o.maxColumnSize[i],
resize: BI.bind(resize, null, j), resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j) stop: BI.bind(stop, null, j)
}; };

40
bi/case.js

@ -3567,9 +3567,7 @@ BI.ClipBoard = BI.inherit(BI.BasicButton, {
return BI.isFunction(o.copy) ? o.copy() : o.copy; return BI.isFunction(o.copy) ? o.copy() : o.copy;
} }
}); });
this.clipboard.on("success", function (e) { this.clipboard.on("success", o.afterCopy)
o.afterCopy();
})
} else { } else {
this.element.zclip({ this.element.zclip({
path: BI.resourceURL + "/ZeroClipboard.swf", path: BI.resourceURL + "/ZeroClipboard.swf",
@ -4763,6 +4761,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
toggle: true, toggle: true,
direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
isDefaultInit: false, isDefaultInit: false,
destroyWhenHide: false,
isNeedAdjustHeight: true,//是否需要高度调整 isNeedAdjustHeight: true,//是否需要高度调整
isNeedAdjustWidth: true, isNeedAdjustWidth: true,
stopPropagation: false, stopPropagation: false,
@ -4785,6 +4784,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
toggle: o.toggle, toggle: o.toggle,
direction: o.direction, direction: o.direction,
isDefaultInit: o.isDefaultInit, isDefaultInit: o.isDefaultInit,
destroyWhenHide: o.destroyWhenHide,
isNeedAdjustHeight: o.isNeedAdjustHeight, isNeedAdjustHeight: o.isNeedAdjustHeight,
isNeedAdjustWidth: o.isNeedAdjustWidth, isNeedAdjustWidth: o.isNeedAdjustWidth,
adjustLength: this._getAdjustLength(), adjustLength: this._getAdjustLength(),
@ -4835,37 +4835,40 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
_createTriangle: function (direction) { _createTriangle: function (direction) {
var pos = {}, op = {}; var pos = {}, op = {};
var adjustLength = this._getAdjustLength(); var adjustLength = this.options.adjustLength;
var offset = this.element.offset();
var left = offset.left, right = offset.left + this.element.outerWidth();
var top = offset.top, bottom = offset.top + this.element.outerHeight();
switch (direction) { switch (direction) {
case "left": case "left":
pos = { pos = {
top: 0, top: top,
bottom: 0, height: this.element.outerHeight(),
left: -adjustLength left: left - adjustLength - this._const.TRIANGLE_LENGTH
}; };
op = {width: this._const.TRIANGLE_LENGTH}; op = {width: this._const.TRIANGLE_LENGTH};
break; break;
case "right": case "right":
pos = { pos = {
top: 0, top: top,
bottom: 0, height: this.element.outerHeight(),
right: -adjustLength left: right + adjustLength
}; };
op = {width: this._const.TRIANGLE_LENGTH}; op = {width: this._const.TRIANGLE_LENGTH};
break; break;
case "top": case "top":
pos = { pos = {
left: 0, left: left,
right: 0, width: this.element.outerWidth(),
top: -adjustLength top: top - adjustLength - this._const.TRIANGLE_LENGTH
}; };
op = {height: this._const.TRIANGLE_LENGTH}; op = {height: this._const.TRIANGLE_LENGTH};
break; break;
case "bottom": case "bottom":
pos = { pos = {
left: 0, left: left,
right: 0, width: this.element.outerWidth(),
bottom: -adjustLength top: bottom + adjustLength
}; };
op = {height: this._const.TRIANGLE_LENGTH}; op = {height: this._const.TRIANGLE_LENGTH};
break; break;
@ -4874,6 +4877,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
} }
this.triangle = BI.createWidget(op, { this.triangle = BI.createWidget(op, {
type: "bi.center_adapt", type: "bi.center_adapt",
cls: "button-combo-triangle-wrapper",
items: [{ items: [{
type: "bi.layout", type: "bi.layout",
cls: "bubble-combo-triangle-" + direction + " bi-high-light-border" cls: "bubble-combo-triangle-" + direction + " bi-high-light-border"
@ -4931,7 +4935,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
_hideTriangle: function () { _hideTriangle: function () {
this.triangle && this.triangle.destroy(); this.triangle && this.triangle.destroy();
this.combo.getView().hideLine(); this.combo.getView() && this.combo.getView().hideLine();
}, },
hideView: function () { hideView: function () {
@ -10391,7 +10395,7 @@ BI.DynamicSummaryLayerTreeTable = BI.inherit(BI.Widget, {
_recomputeColumnSize: function () { _recomputeColumnSize: function () {
var o = this.options; var o = this.options;
o.regionColumnSize = this.table.getRegionColumnSize(); o.regionColumnSize = this.table.getRegionColumnSize();
var columnSize = this.table.getColumnSize(); var columnSize = this.table.getColumnSize().slice();
if (o.freezeCols.length > 1) { if (o.freezeCols.length > 1) {
for (var i = 0; i < o.freezeCols.length - 1; i++) { for (var i = 0; i < o.freezeCols.length - 1; i++) {
columnSize.splice(1, 0, 0); columnSize.splice(1, 0, 0);

59
bi/core.js

@ -351,12 +351,9 @@ BI.Factory = {
return {} return {}
}, },
init: function () {
},
// _init is an empty function by default. Override it with your own // _init is an empty function by default. Override it with your own
// initialization logic. // initialization logic.
_init: function () { _init: function () {
this.init();
}, },
// Return a copy of the model's `attributes` object. // Return a copy of the model's `attributes` object.
@ -1204,9 +1201,9 @@ BI.Factory = {
setVisible: function (visible) { setVisible: function (visible) {
this.options.invisible = !visible; this.options.invisible = !visible;
if (visible) { if (visible) {
this.element.show(); this.element.css("display", "");
} else { } else {
this.element.hide(); this.element.css("display", "none");
} }
}, },
@ -4198,6 +4195,7 @@ BI.OB = function (config) {
$.extend(BI.OB.prototype, { $.extend(BI.OB.prototype, {
props: {}, props: {},
init: null, init: null,
destroyed: null,
_defaultConfig: function (config) { _defaultConfig: function (config) {
return {}; return {};
@ -4317,6 +4315,11 @@ $.extend(BI.OB.prototype, {
} }
} }
return true; return true;
},
destroy: function () {
this.destroyed && this.destroyed();
this.purgeListeners();
} }
});/** });/**
* Widget超类 * Widget超类
@ -4518,7 +4521,7 @@ BI.Widget = BI.inherit(BI.OB, {
} }
//递归将所有子组件使能 //递归将所有子组件使能
BI.each(this._children, function (i, child) { BI.each(this._children, function (i, child) {
child._setEnable && child._setEnable(enable); !child._manualSetEnable && child._setEnable && child._setEnable(enable);
}); });
}, },
@ -4530,11 +4533,20 @@ BI.Widget = BI.inherit(BI.OB, {
} }
//递归将所有子组件使有效 //递归将所有子组件使有效
BI.each(this._children, function (i, child) { BI.each(this._children, function (i, child) {
child._setValid && child._setValid(valid); !child._manualSetValid && child._setValid && child._setValid(valid);
}); });
}, },
_setVisible: function (visible) {
if (visible === true) {
this.options.invisible = false;
} else if (visible === false) {
this.options.invisible = true;
}
},
setEnable: function (enable) { setEnable: function (enable) {
this._manualSetEnable = true;
this._setEnable(enable); this._setEnable(enable);
if (enable === true) { if (enable === true) {
this.element.removeClass("base-disabled disabled"); this.element.removeClass("base-disabled disabled");
@ -4544,20 +4556,19 @@ BI.Widget = BI.inherit(BI.OB, {
}, },
setVisible: function (visible) { setVisible: function (visible) {
this._setVisible(visible);
if (visible === true) { if (visible === true) {
this.options.invisible = false;
//用this.element.show()会把display属性改成block //用this.element.show()会把display属性改成block
this.element.css("display", ""); this.element.css("display", "");
this._mount(); this._mount();
} else if (visible === false) { } else if (visible === false) {
this.options.invisible = true;
this.element.css("display", "none"); this.element.css("display", "none");
} }
this.fireEvent(BI.Events.VIEW, visible); this.fireEvent(BI.Events.VIEW, visible);
}, },
setValid: function (valid) { setValid: function (valid) {
this.options.invalid = !valid; this._manualSetValid = true;
this._setValid(valid); this._setValid(valid);
if (valid === true) { if (valid === true) {
this.element.removeClass("base-invalid invalid"); this.element.removeClass("base-invalid invalid");
@ -4744,11 +4755,15 @@ BI.Widget = BI.inherit(BI.OB, {
this.purgeListeners(); this.purgeListeners();
} }
});BI.Model = BI.inherit(BI.M, { });BI.Model = BI.inherit(BI.M, {
props: {},
init: null,
destroyed: null,
_defaultConfig: function () { _defaultConfig: function () {
return { return BI.extend({
"default": "just a default", "default": "just a default",
"current": void 0 "current": void 0
} }, this.props)
}, },
_static: function () { _static: function () {
@ -4782,6 +4797,7 @@ BI.Widget = BI.inherit(BI.OB, {
this._read = BI.debounce(BI.bind(this.fetch, this), 30); this._read = BI.debounce(BI.bind(this.fetch, this), 30);
this._save = BI.debounce(BI.bind(this.save, this), 30); this._save = BI.debounce(BI.bind(this.save, this), 30);
this._F = []; this._F = [];
this.init && this.init();
}, },
toJSON: function () { toJSON: function () {
@ -5224,8 +5240,16 @@ BI.Widget = BI.inherit(BI.OB, {
*/ */
BI.View = BI.inherit(BI.V, { BI.View = BI.inherit(BI.V, {
//生命周期函数
beforeCreate: null,
created: null,
destroyed: null,
_init: function () { _init: function () {
BI.View.superclass._init.apply(this, arguments); BI.View.superclass._init.apply(this, arguments);
this.beforeCreate && this.beforeCreate();
var self = this; var self = this;
this.listenTo(this.model, "change:current", function (obj, val) { this.listenTo(this.model, "change:current", function (obj, val) {
if (BI.isNotNull(val) && val.length > 0) { if (BI.isNotNull(val) && val.length > 0) {
@ -5269,7 +5293,8 @@ BI.View = BI.inherit(BI.V, {
return f.apply(this, arguments); return f.apply(this, arguments);
}, self); }, self);
} }
}) });
this.created && this.created();
}, },
change: function (changed, prev) { change: function (changed, prev) {
@ -5714,7 +5739,7 @@ BI.View = BI.inherit(BI.V, {
}); });
delete this._cardLayouts; delete this._cardLayouts;
delete this._cards; delete this._cards;
this.destroyed(); this.destroyed && this.destroyed();
this.off(); this.off();
}, },
@ -5724,14 +5749,10 @@ BI.View = BI.inherit(BI.V, {
}); });
delete this._cardLayouts; delete this._cardLayouts;
delete this._cards; delete this._cards;
this.destroyed(); this.destroyed && this.destroyed();
this.remove(); this.remove();
this.trigger(BI.Events.DESTROY); this.trigger(BI.Events.DESTROY);
this.off(); this.off();
},
destroyed: function () {
} }
});(function () { });(function () {

199
bi/widget.js

@ -3742,7 +3742,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
case BI.Arrangement.LAYOUT_TYPE.ADAPTIVE: case BI.Arrangement.LAYOUT_TYPE.ADAPTIVE:
if (this._isArrangeFine()) { if (this._isArrangeFine()) {
var width = this.getClientWidth(), height = this.getClientHeight(); var width = this.getClientWidth(), height = this.getClientHeight();
var isHeightAdjust = height > occupied.top + occupied.height; var isHeightAdjust = height > occupied.height;
var regions = this._cloneRegion(); var regions = this._cloneRegion();
BI.each(regions, function (i, region) { BI.each(regions, function (i, region) {
region.width = region.width / occupied.width * width; region.width = region.width / occupied.width * width;
@ -3924,7 +3924,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
BI.Arrangement.EVENT_SCROLL = "EVENT_SCROLL"; BI.Arrangement.EVENT_SCROLL = "EVENT_SCROLL";
BI.extend(BI.Arrangement, { BI.extend(BI.Arrangement, {
PORTION: 24, PORTION: 24,
GRID_HEIGHT: 50, GRID_HEIGHT: 60,
LAYOUT_TYPE: { LAYOUT_TYPE: {
ADAPTIVE: 0, ADAPTIVE: 0,
FREE: 1, FREE: 1,
@ -5638,6 +5638,10 @@ BI.DownListCombo = BI.inherit(BI.Widget, {
}); });
}, },
hideView: function () {
this.downlistcombo.hideView();
},
populate: function (items) { populate: function (items) {
this.popupview.populate(items); this.popupview.populate(items);
}, },
@ -5788,7 +5792,7 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe
logic: { logic: {
dynamic: false dynamic: false
}, },
invalid: true, // invalid: true,
iconCls1: "dot-e-font", iconCls1: "dot-e-font",
iconCls2: "pull-right-e-font" iconCls2: "pull-right-e-font"
}) })
@ -5804,26 +5808,26 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe
text: o.text, text: o.text,
value: o.value, value: o.value,
height: o.height height: o.height
}) });
this.icon1 = BI.createWidget({ this.icon1 = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
cls: o.iconCls1, cls: o.iconCls1,
width: 25, width: 25,
forceNotSelected: true forceNotSelected: true
}) });
this.icon2 = BI.createWidget({ this.icon2 = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
cls: o.iconCls2, cls: o.iconCls2,
width: 25, width: 25,
forceNotSelected: true forceNotSelected: true
}) });
var blank = BI.createWidget({ var blank = BI.createWidget({
type: "bi.layout", type: "bi.layout",
width: 25 width: 25
}) });
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
@ -5833,7 +5837,7 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe
bottom: 0, bottom: 0,
right: 0 right: 0
}] }]
}) });
BI.createWidget(BI.extend({ BI.createWidget(BI.extend({
element: this element: this
@ -5841,19 +5845,11 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe
items: BI.LogicFactory.createLogicItemsByDirection("left", this.icon1, this.text, blank) items: BI.LogicFactory.createLogicItemsByDirection("left", this.icon1, this.text, blank)
})))); }))));
this.element.on("mouseenter." + this.getName(), function (e) { this.element.hover(function () {
if (self.element.__isMouseInBounds__(e) && self.isEnabled()) { if (self.isEnabled()) {
self.hover(); self.hover();
} else {
self.dishover();
} }
}); }, function () {
this.element.on("mousemove." + this.getName(), function (e) {
if (!self.element.__isMouseInBounds__(e) && self.isEnabled()) {
self.dishover()
}
});
this.element.on("mouseleave." + this.getName(), function () {
if (self.isEnabled()) { if (self.isEnabled()) {
self.dishover() self.dishover()
} }
@ -11318,34 +11314,36 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
itemsCreator: o.itemsCreator itemsCreator: o.itemsCreator
}); });
this.adapter.on(BI.MultiSelectTreePopup.EVENT_CHANGE, function () { this.adapter.on(BI.MultiSelectTreePopup.EVENT_CHANGE, function () {
if (self.trigger.isSearching()) { if (self.searcher.isSearching()) {
self.storeValue = {value: self.searcherPane.getValue()}; self.storeValue = {value: self.searcherPane.getValue()};
} else { } else {
self.storeValue = {value: self.adapter.getValue()}; self.storeValue = {value: self.adapter.getValue()};
} }
self.setSelectedValue(self.storeValue.value);
self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE); self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE);
}); });
this.searcherPane = BI.createWidget({//搜索中的时候用的是parttree,同adapter中的synctree不一样 //搜索中的时候用的是parttree,同adapter中的synctree不一样
this.searcherPane = BI.createWidget({
type: "bi.multi_tree_search_pane", type: "bi.multi_tree_search_pane",
cls: "bi-border-left bi-border-right bi-border-bottom", cls: "bi-border-left bi-border-right bi-border-bottom",
keywordGetter: function () { keywordGetter: function () {
return self.trigger.getKeyword(); return self.searcher.getKeyword();
}, },
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
op.keyword = self.trigger.getKeyword(); op.keyword = self.searcher.getKeyword();
o.itemsCreator(op, callback); o.itemsCreator(op, callback);
} }
}); });
this.searcherPane.setVisible(false); this.searcherPane.setVisible(false);
this.trigger = BI.createWidget({ this.searcher = BI.createWidget({
type: "bi.searcher", type: "bi.searcher",
isAutoSearch: false, isAutoSearch: false,
isAutoSync: false, isAutoSync: false,
onSearch: function (op, callback) { onSearch: function (op, callback) {
callback({ callback({
keyword: self.trigger.getKeyword() keyword: self.searcher.getKeyword()
}); });
}, },
adapter: this.adapter, adapter: this.adapter,
@ -11355,15 +11353,15 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
eventName: BI.Searcher.EVENT_START, eventName: BI.Searcher.EVENT_START,
action: function () { action: function () {
self._showSearcherPane(); self._showSearcherPane();
self.storeValue = {value: self.adapter.getValue()}; // self.storeValue = {value: self.adapter.getValue()};
self.searcherPane.setValue(self.storeValue); // self.searcherPane.setSelectedValue(self.storeValue.value);
} }
}, { }, {
eventName: BI.Searcher.EVENT_STOP, eventName: BI.Searcher.EVENT_STOP,
action: function () { action: function () {
self._showAdapter(); self._showAdapter();
// self.storeValue = {value: self.searcherPane.getValue()}; // self.storeValue = {value: self.searcherPane.getValue()};
self.adapter.setValue(self.storeValue); // self.adapter.setSelectedValue(self.storeValue.value);
BI.nextTick(function () { BI.nextTick(function () {
self.adapter.populate(); self.adapter.populate();
}); });
@ -11371,11 +11369,12 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
}, { }, {
eventName: BI.Searcher.EVENT_CHANGE, eventName: BI.Searcher.EVENT_CHANGE,
action: function () { action: function () {
if (self.trigger.isSearching()) { if (self.searcher.isSearching()) {
self.storeValue = {value: self.searcherPane.getValue()}; self.storeValue = {value: self.searcherPane.getValue()};
} else { } else {
self.storeValue = {value: self.adapter.getValue()}; self.storeValue = {value: self.adapter.getValue()};
} }
self.setSelectedValue(self.storeValue.value);
self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE); self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE);
} }
}, { }, {
@ -11390,7 +11389,7 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
type: "bi.vtape", type: "bi.vtape",
element: this, element: this,
items: [{ items: [{
el: this.trigger, el: this.searcher,
height: 30 height: 30
}, { }, {
el: this.adapter, el: this.adapter,
@ -11425,18 +11424,21 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setSelectedValue: function (v) {
this.storeValue.value = v || {}; this.storeValue.value = v || {};
this.adapter.setValue({ this.adapter.setSelectedValue(v);
value: v || {} this.searcherPane.setSelectedValue(v);
}); this.searcher.setValue({
this.trigger.setValue({
value: v || {} value: v || {}
}); });
}, },
setValue: function (v) {
this.adapter.setValue(v);
},
stopSearch: function () { stopSearch: function () {
this.trigger.stopSearch(); this.searcher.stopSearch();
}, },
updateValue: function (v) { updateValue: function (v) {
@ -11448,7 +11450,7 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
}, },
populate: function () { populate: function () {
this.trigger.populate.apply(this.trigger, arguments); this.searcher.populate.apply(this.searcher, arguments);
this.adapter.populate.apply(this.adapter, arguments); this.adapter.populate.apply(this.adapter, arguments);
} }
}); });
@ -11489,7 +11491,12 @@ BI.MultiSelectTreePopup = BI.inherit(BI.Widget, {
setValue: function (v) { setValue: function (v) {
v || (v = {}); v || (v = {});
this.popup.setValue(v.value); this.popup.setValue(v);
},
setSelectedValue: function (v) {
v || (v = {});
this.popup.setSelectedValue(v);
}, },
updateValue: function (v) { updateValue: function (v) {
@ -11708,7 +11715,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
}, { }, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM, eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,
action: function () { action: function () {
self._defaultState(); self.combo.hideView();
} }
}, { }, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR, eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR,
@ -12016,8 +12023,12 @@ BI.MultiTreeSearchPane = BI.inherit(BI.Pane, {
}, },
setValue: function (v) { setValue: function (v) {
this.setSelectedValue(v.value);
},
setSelectedValue: function (v) {
v || (v = {}); v || (v = {});
this.partTree.setSelectedValue(v.value); this.partTree.setSelectedValue(v);
}, },
getValue: function () { getValue: function () {
@ -17252,7 +17263,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
return; return;
} }
BI.each(selected, function (k) { BI.each(selected, function (k) {
var node = self._getNode(parentValues, k); var node = self._getTreeNode(parentValues, k);
var newParents = BI.clone(parentValues); var newParents = BI.clone(parentValues);
newParents.push(node.value); newParents.push(node.value);
createOneJson(node, BI.last(parentValues), getCount(selected[k], newParents)); createOneJson(node, BI.last(parentValues), getCount(selected[k], newParents));
@ -17284,7 +17295,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
_reqSelectedTreeNode: function (op, callback) { _reqSelectedTreeNode: function (op, callback) {
var self = this; var self = this;
var selectedValues = op.selectedValues; var selectedValues = BI.deepClone(op.selectedValues);
var notSelectedValue = op.notSelectedValue || {}; var notSelectedValue = op.notSelectedValue || {};
var keyword = op.keyword || ""; var keyword = op.keyword || "";
var parentValues = op.parentValues || []; var parentValues = op.parentValues || [];
@ -17299,12 +17310,34 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
function dealWithSelectedValues(selectedValues) { function dealWithSelectedValues(selectedValues) {
var p = BI.clone(parentValues); var p = parentValues.concat(notSelectedValue);
p.push(notSelectedValue); //存储的值中存在这个值就把它删掉
if (canFindKey(selectedValues, p)) {
//如果搜索的值在父亲链中
if (isSearchValueInParent(p)) {
self._deleteNode(selectedValues, p);
} else {
var searched = [];
var finded = search(parentValues, notSelectedValue, [], searched);
if (finded && BI.isNotEmptyArray(searched)) {
BI.each(searched, function (i, arr) {
self._deleteNode(selectedValues, arr);
})
}
}
}
//存储的值中不存在这个值,但父亲节点是全选的情况
if (isChild(selectedValues, p)) { if (isChild(selectedValues, p)) {
var result = []; var result = [], finded = false;
var finded = search(parentValues.length + 1, parentValues, notSelectedValue, result); //如果parentValues中有匹配的值,说明搜索结果不在当前值下
if (isSearchValueInParent(p)) {
finded = true;
} else {
//从当前值开始搜
finded = search(parentValues, notSelectedValue, result);
p = parentValues;
}
if (finded === true) { if (finded === true) {
var next = selectedValues; var next = selectedValues;
@ -17340,10 +17373,11 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
} }
function search(deep, parents, current, result) { function search(parents, current, result, searched) {
var newParents = BI.clone(parents); var newParents = BI.clone(parents);
newParents.push(current); newParents.push(current);
if (self._isMatch(current, keyword)) { if (self._isMatch(current, keyword)) {
searched && searched.push(newParents);
return true; return true;
} }
@ -17353,7 +17387,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
var can = false; var can = false;
BI.each(children, function (i, child) { BI.each(children, function (i, child) {
if (search(deep + 1, newParents, child.value, result)) { if (search(newParents, child.value, result, searched)) {
can = true; can = true;
} else { } else {
notSearch.push(child.value); notSearch.push(child.value);
@ -17369,6 +17403,27 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
return can; return can;
} }
function isSearchValueInParent(parentValues) {
for (var i = 0, len = parentValues.length; i < len; i++) {
if (self._isMatch(parentValues[i], keyword)) {
return true;
}
}
return false;
}
function canFindKey(selectedValues, parents) {
var t = selectedValues;
for (var i = 0; i < parents.length; i++) {
var v = parents[i];
t = t[v];
if (t == null) {
return false;
}
}
return true;
}
function isChild(selectedValues, parents) { function isChild(selectedValues, parents) {
var t = selectedValues; var t = selectedValues;
for (var i = 0; i < parents.length; i++) { for (var i = 0; i < parents.length; i++) {
@ -17377,11 +17432,11 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
return false; return false;
} }
t = t[v]; t = t[v];
if (t == null || BI.isEmpty(t)) { if (BI.isEmpty(t)) {
return true; return true;
} }
} }
return true; return false;
} }
}, },
@ -17505,7 +17560,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
} }
function createOneJson(parentValues, value, isOpen, checked, half, flag, result) { function createOneJson(parentValues, value, isOpen, checked, half, flag, result) {
var node = self._getNode(parentValues, value) var node = self._getTreeNode(parentValues, value)
result.push({ result.push({
id: node.id, id: node.id,
pId: node.pId, pId: node.pId,
@ -17582,11 +17637,11 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
var times = op.times; var times = op.times;
var checkState = op.checkState || {}; var checkState = op.checkState || {};
var parentValues = op.parentValues || []; var parentValues = op.parentValues || [];
var selectedValues = op.selectedValues; var selectedValues = op.selectedValues || {};
var valueMap = {}; var valueMap = {};
if (judgeState(parentValues, selectedValues, checkState)) { // if (judgeState(parentValues, selectedValues, checkState)) {
valueMap = dealWidthSelectedValue(parentValues, selectedValues); valueMap = dealWidthSelectedValue(parentValues, selectedValues);
} // }
var nodes = this._getChildren(parentValues); var nodes = this._getChildren(parentValues);
for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) { for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) {
var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState); var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState);
@ -17619,7 +17674,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
function dealWidthSelectedValue(parentValues, selectedValues) { function dealWidthSelectedValue(parentValues, selectedValues) {
var valueMap = {}; var valueMap = {};
BI.each(parentValues, function (i, v) { BI.each(parentValues, function (i, v) {
selectedValues = selectedValues[v]; selectedValues = selectedValues[v] || {};
}); });
BI.each(selectedValues, function (value, obj) { BI.each(selectedValues, function (value, obj) {
if (BI.isNull(obj)) { if (BI.isNull(obj)) {
@ -17667,6 +17722,32 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
} }
}, },
_getNode: function (selectedValues, parentValues) {
var pNode = selectedValues;
for (var i = 0, len = parentValues.length; i < len; i++) {
if (pNode == null) {
return null;
}
pNode = pNode[parentValues[i]];
}
return pNode;
},
_deleteNode: function (selectedValues, values) {
var name = values[values.length - 1];
var p = values.slice(0, values.length - 1);
var pNode = this._getNode(selectedValues, p);
if (pNode[name]) {
delete pNode[name];
//递归删掉空父节点
while (p.length > 0 && BI.isEmpty(pNode)) {
name = p[p.length - 1];
p = p.slice(0, p.length - 1);
pNode = this._getNode(selectedValues, p);
delete pNode[name];
}
}
},
_buildTree: function (jo, values) { _buildTree: function (jo, values) {
var t = jo; var t = jo;
@ -17683,7 +17764,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
return finded.finded.length > 0 || finded.matched.length > 0; return finded.finded.length > 0 || finded.matched.length > 0;
}, },
_getNode: function (parentValues, v) { _getTreeNode: function (parentValues, v) {
var self = this; var self = this;
var findedParentNode; var findedParentNode;
var index = 0; var index = 0;
@ -17710,7 +17791,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
_getChildren: function (parentValues) { _getChildren: function (parentValues) {
if (parentValues.length > 0) { if (parentValues.length > 0) {
var value = BI.last(parentValues); var value = BI.last(parentValues);
var parent = this._getNode(parentValues.slice(0, parentValues.length - 1), value); var parent = this._getTreeNode(parentValues.slice(0, parentValues.length - 1), value);
} else { } else {
var parent = this.tree.getRoot(); var parent = this.tree.getRoot();
} }
@ -17806,6 +17887,10 @@ BI.TreeValueChooserPane = BI.inherit(BI.AbstractTreeValueChooser, {
} }
}, },
setSelectedValue: function (v) {
this.pane.setSelectedValue(v);
},
setValue: function (v) { setValue: function (v) {
this.pane.setValue(v); this.pane.setValue(v);
}, },

13
docs/base.css

@ -32,7 +32,11 @@
/****添加计算宽度的--运算符直接需要space****/ /****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/ /****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/ /**** custom color(自定义颜色,用于特定场景) ****/
.bi-bubble-combo .button-combo-triangle-wrapper {
position: fixed !important;
}
.bi-bubble-combo .bubble-combo-triangle-left { .bi-bubble-combo .bubble-combo-triangle-left {
z-index: 1;
width: 0; width: 0;
height: 0; height: 0;
border-top: 6px solid transparent; border-top: 6px solid transparent;
@ -40,6 +44,7 @@
border-bottom: 6px solid transparent; border-bottom: 6px solid transparent;
} }
.bi-bubble-combo .bubble-combo-triangle-right { .bi-bubble-combo .bubble-combo-triangle-right {
z-index: 1;
width: 0; width: 0;
height: 0; height: 0;
border-top: 6px solid transparent; border-top: 6px solid transparent;
@ -47,6 +52,7 @@
border-bottom: 6px solid transparent; border-bottom: 6px solid transparent;
} }
.bi-bubble-combo .bubble-combo-triangle-top { .bi-bubble-combo .bubble-combo-triangle-top {
z-index: 1;
width: 0; width: 0;
height: 0; height: 0;
border-left: 6px solid transparent; border-left: 6px solid transparent;
@ -54,6 +60,7 @@
border-top: 6px solid #3f8ce8; border-top: 6px solid #3f8ce8;
} }
.bi-bubble-combo .bubble-combo-triangle-bottom { .bi-bubble-combo .bubble-combo-triangle-bottom {
z-index: 1;
width: 0; width: 0;
height: 0; height: 0;
border-left: 6px solid transparent; border-left: 6px solid transparent;
@ -1282,6 +1289,9 @@ li.CodeMirror-hint-active {
.bi-resizable-table-cell .resizable-table-cell-resizer-container.dragging .resizable-table-cell-resizer-knob { .bi-resizable-table-cell .resizable-table-cell-resizer-container.dragging .resizable-table-cell-resizer-knob {
background-color: #3f8ce8; background-color: #3f8ce8;
} }
.bi-resizable-table-cell .resizable-table-cell-resizer-container.suitable .resizable-table-cell-resizer-knob {
background-color: #58cc7d;
}
/****添加计算宽度的--运算符直接需要space****/ /****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/ /****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/ /**** custom color(自定义颜色,用于特定场景) ****/
@ -1290,6 +1300,9 @@ li.CodeMirror-hint-active {
z-index: 1; z-index: 1;
background-color: #3f8ce8; background-color: #3f8ce8;
} }
.bi-resizable-table .resizable-table-resizer.suitable {
background-color: #58cc7d;
}
.bi-resizable-table .resizable-table-region-resizer { .bi-resizable-table .resizable-table-region-resizer {
cursor: ew-resize; cursor: ew-resize;
z-index: 1; z-index: 1;

289
docs/base.js

@ -710,7 +710,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
$(document).bind("mouseup." + self.getName(), function (e) { $(document).bind("mouseup." + self.getName(), function (e) {
// if (e.button === 0) { // if (e.button === 0) {
if (BI.DOM.isExist(self) && !hand.__isMouseInBounds__(e) && mouseDown === true && !selected) { if (BI.DOM.isExist(self) && !hand.__isMouseInBounds__(e) && mouseDown === true && !selected) {
self.setSelected(!self.isSelected()); // self.setSelected(!self.isSelected());
self._trigger(); self._trigger();
} }
mouseDown = false; mouseDown = false;
@ -1717,7 +1717,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
_getNodeValue: function (node) { _getNodeValue: function (node) {
//去除标红 //去除标红
return node.value == null ? node.text.replace(/<[^>]+>/g, "") : node.value; return node.value == null ? node.text.replace(/<[^>]+>/g, "").replaceAll(" ", " ") : node.value;
}, },
//获取半选框值 //获取半选框值
@ -1937,6 +1937,16 @@ BI.TreeView = BI.inherit(BI.Pane, {
}, },
checkAll: function (checked) { checkAll: function (checked) {
function setNode(children) {
BI.each(children, function (i, child) {
child.halfCheck = false;
setNode(child.children);
});
}
BI.each(this.nodes.getNodes(), function (i, node) {
node.halfCheck = false;
setNode(node.children);
});
this.nodes && this.nodes.checkAllNodes(checked); this.nodes && this.nodes.checkAllNodes(checked);
}, },
@ -1946,15 +1956,13 @@ BI.TreeView = BI.inherit(BI.Pane, {
//设置树节点的状态 //设置树节点的状态
setValue: function (value, param) { setValue: function (value, param) {
this.setSelectedValue(value);
this.checkAll(false); this.checkAll(false);
this.updateValue(value, param); this.updateValue(value, param);
this.refresh(); this.refresh();
}, },
setSelectedValue: function (value) { setSelectedValue: function (value) {
this.options.paras.selectedValues = BI.deepClone(value) || {}; this.options.paras.selectedValues = BI.deepClone(value || {});
this.selectedValues = BI.deepClone(value) || {};
}, },
updateValue: function (values, param) { updateValue: function (values, param) {
@ -2106,7 +2114,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
if (treeNode.checked === true) { if (treeNode.checked === true) {
} else { } else {
var tNode = treeNode; var tNode = treeNode;
var pNode = this._getTree(this.selectedValues, parentValues); var pNode = this._getTree(this.options.paras.selectedValues, parentValues);
if (BI.isNotNull(pNode[name])) { if (BI.isNotNull(pNode[name])) {
delete pNode[name]; delete pNode[name];
} }
@ -2114,7 +2122,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
parentValues = parentValues.slice(0, parentValues.length - 1); parentValues = parentValues.slice(0, parentValues.length - 1);
tNode = tNode.getParentNode(); tNode = tNode.getParentNode();
if (tNode != null) { if (tNode != null) {
pNode = this._getTree(this.selectedValues, parentValues); pNode = this._getTree(this.options.paras.selectedValues, parentValues);
name = this._getNodeValue(tNode); name = this._getNodeValue(tNode);
delete pNode[name]; delete pNode[name];
} }
@ -2128,10 +2136,10 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
var self = this, o = this.options; var self = this, o = this.options;
var parentValues = treeNode.parentValues || self._getParentValues(treeNode); var parentValues = treeNode.parentValues || self._getParentValues(treeNode);
var op = BI.extend({}, o.paras, { var op = BI.extend({}, o.paras, {
"id": treeNode.id, id: treeNode.id,
"times": 1, times: 1,
"parentValues": parentValues.concat(this._getNodeValue(treeNode)), parentValues: parentValues.concat(this._getNodeValue(treeNode)),
"checkState": treeNode.getCheckStatus() checkState: treeNode.getCheckStatus()
}); });
var complete = function (d) { var complete = function (d) {
var nodes = d.items || []; var nodes = d.items || [];
@ -2179,7 +2187,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
}, },
hasChecked: function () { hasChecked: function () {
return !BI.isEmpty(this.selectedValues) || BI.AsyncTree.superclass.hasChecked.apply(this, arguments); return !BI.isEmpty(this.options.paras.selectedValues) || BI.AsyncTree.superclass.hasChecked.apply(this, arguments);
}, },
getValue: function () { getValue: function () {
@ -2188,20 +2196,18 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
} }
var checkedValues = this._getSelectedValues(); var checkedValues = this._getSelectedValues();
if (BI.isEmpty(checkedValues)) { if (BI.isEmpty(checkedValues)) {
return BI.deepClone(this.selectedValues); return BI.deepClone(this.options.paras.selectedValues);
} }
if (BI.isEmpty(this.selectedValues)) { if (BI.isEmpty(this.options.paras.selectedValues)) {
return checkedValues; return checkedValues;
} }
return this._join(checkedValues, this.selectedValues); return this._join(checkedValues, this.options.paras.selectedValues);
}, },
//生成树方法 //生成树方法
stroke: function (config) { stroke: function (config) {
delete this.options.keyword; delete this.options.keyword;
BI.extend(this.options.paras, config); BI.extend(this.options.paras, config);
//取消选中时使用
this.selectedValues = BI.deepClone(this.options.paras.selectedValues) || {};
var setting = this._configSetting(); var setting = this._configSetting();
this._initTree(setting); this._initTree(setting);
} }
@ -2249,34 +2255,28 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
_selectTreeNode: function (treeId, treeNode) { _selectTreeNode: function (treeId, treeNode) {
var self = this, o = this.options; var self = this, o = this.options;
var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode)); var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var name = this._getNodeValue(treeNode) var name = this._getNodeValue(treeNode);
// var values = parentValues.concat([name]);
if (treeNode.checked === true) { if (treeNode.checked === true) {
BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments); BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
} else { } else {
//如果选中的值中不存在该值不处理
var t = this.options.paras.selectedValues;
var p = parentValues.concat(name);
for (var i = 0, len = p.length; i < len; i++) {
t = t[p[i]];
if (t == null) {
return;
}
if (BI.isEmpty(t)) {
break;
}
}
o.itemsCreator(BI.extend({}, o.paras, { o.itemsCreator(BI.extend({}, o.paras, {
type: BI.TreeView.REQ_TYPE_SELECT_DATA, type: BI.TreeView.REQ_TYPE_SELECT_DATA,
selectedValues: this.selectedValues,
notSelectedValue: name, notSelectedValue: name,
parentValues: parentValues parentValues: parentValues
}), function (new_values) { }), function (new_values) {
if (BI.isEqual(self.selectedValues, new_values)) { self.options.paras.selectedValues = new_values;
var tNode = treeNode;
var pNode = self._getTree(new_values, parentValues);
if (pNode[name]) {
delete pNode[name];
}
while (tNode != null && BI.isEmpty(pNode)) {
parentValues = parentValues.slice(0, parentValues.length - 1);
tNode = tNode.getParentNode();
if (tNode != null) {
pNode = self._getTree(new_values, parentValues);
name = self._getNodeValue(tNode);
delete pNode[name];
}
}
}
self.selectedValues = new_values;
BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments); BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
}); });
} }
@ -2373,9 +2373,6 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
delete o.paras.keyword; delete o.paras.keyword;
BI.extend(o.paras, config); BI.extend(o.paras, config);
delete o.paras.lastSearchValue; delete o.paras.lastSearchValue;
//取消选中时使用
this.selectedValues = BI.deepClone(o.paras.selectedValues) || {};
//delete this.options.paras.selectedValues;
var setting = this._configSetting(); var setting = this._configSetting();
this._initTree(setting, o.paras.keyword); this._initTree(setting, o.paras.keyword);
} }
@ -2903,6 +2900,7 @@ BI.Combo = BI.inherit(BI.Widget, {
toggle: true, toggle: true,
direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
isDefaultInit: false, isDefaultInit: false,
destroyWhenHide: false,
isNeedAdjustHeight: true,//是否需要高度调整 isNeedAdjustHeight: true,//是否需要高度调整
isNeedAdjustWidth: true, isNeedAdjustWidth: true,
stopEvent: false, stopEvent: false,
@ -2925,17 +2923,21 @@ BI.Combo = BI.inherit(BI.Widget, {
this._initCombo(); this._initCombo();
this._initPullDownAction(); this._initPullDownAction();
this.combo.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.combo.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (self.isEnabled() && this.isEnabled()) { if (self.isEnabled() && self.isValid()) {
if (type === BI.Events.EXPAND) { if (type === BI.Events.EXPAND) {
self._popupView(); self._popupView();
} }
if (type === BI.Events.COLLAPSE) { if (type === BI.Events.COLLAPSE) {
self._hideView(); self._hideView();
} }
if (type === BI.Events.EXPAND || type === BI.Events.COLLAPSE) { if (type === BI.Events.EXPAND) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.fireEvent(BI.Combo.EVENT_EXPAND);
}
if (type === BI.Events.COLLAPSE) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.isViewVisible() && self.fireEvent(BI.Combo.EVENT_COLLAPSE);
} }
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
self.fireEvent(BI.Combo.EVENT_TRIGGER_CHANGE, obj); self.fireEvent(BI.Combo.EVENT_TRIGGER_CHANGE, obj);
} }
@ -2943,12 +2945,12 @@ BI.Combo = BI.inherit(BI.Widget, {
}); });
self.element.on("mouseenter." + self.getName(), function (e) { self.element.on("mouseenter." + self.getName(), function (e) {
if (self.isEnabled() && self.combo.isEnabled()) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
self.element.addClass(o.hoverClass); self.element.addClass(o.hoverClass);
} }
}); });
self.element.on("mouseleave." + self.getName(), function (e) { self.element.on("mouseleave." + self.getName(), function (e) {
if (self.isEnabled() && self.combo.isEnabled()) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
self.element.removeClass(o.hoverClass); self.element.removeClass(o.hoverClass);
} }
}); });
@ -2995,14 +2997,14 @@ BI.Combo = BI.inherit(BI.Widget, {
switch (ev) { switch (ev) {
case "hover": case "hover":
self.element.on("mouseenter." + self.getName(), function (e) { self.element.on("mouseenter." + self.getName(), function (e) {
if (self.isEnabled() && self.combo.isEnabled()) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
self._popupView(); self._popupView();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo);
self.fireEvent(BI.Combo.EVENT_EXPAND); self.fireEvent(BI.Combo.EVENT_EXPAND);
} }
}); });
self.element.on("mouseleave." + self.getName(), function (e) { self.element.on("mouseleave." + self.getName(), function (e) {
if (self.isEnabled() && self.combo.isEnabled() && o.toggle === true) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid() && o.toggle === true) {
self._hideView(); self._hideView();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.combo); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.combo);
self.fireEvent(BI.Combo.EVENT_COLLAPSE); self.fireEvent(BI.Combo.EVENT_COLLAPSE);
@ -3012,7 +3014,7 @@ BI.Combo = BI.inherit(BI.Widget, {
case "click": case "click":
var debounce = BI.debounce(function (e) { var debounce = BI.debounce(function (e) {
if (self.combo.element.__isMouseInBounds__(e)) { if (self.combo.element.__isMouseInBounds__(e)) {
if (self.isEnabled() && self.combo.isEnabled()) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
o.toggle ? self._toggle() : self._popupView(); o.toggle ? self._toggle() : self._popupView();
if (self.isViewVisible()) { if (self.isViewVisible()) {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo);
@ -3088,7 +3090,13 @@ BI.Combo = BI.inherit(BI.Widget, {
_hideView: function () { _hideView: function () {
this.fireEvent(BI.Combo.EVENT_BEFORE_HIDEVIEW); this.fireEvent(BI.Combo.EVENT_BEFORE_HIDEVIEW);
if (this.options.destroyWhenHide === true) {
this.popupView && this.popupView.destroy();
this.popupView = null;
this._rendered = false;
} else {
this.popupView && this.popupView.invisible(); this.popupView && this.popupView.invisible();
}
this.element.removeClass(this.options.comboClass); this.element.removeClass(this.options.comboClass);
$(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); $(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName());
@ -3219,6 +3227,7 @@ BI.Combo = BI.inherit(BI.Widget, {
_setEnable: function (arg) { _setEnable: function (arg) {
BI.Combo.superclass._setEnable.apply(this, arguments); BI.Combo.superclass._setEnable.apply(this, arguments);
!arg && this.element.removeClass(this.options.hoverClass);
!arg && this.isViewVisible() && this._hideView(); !arg && this.isViewVisible() && this._hideView();
}, },
@ -3316,20 +3325,20 @@ BI.Expander = BI.inherit(BI.Widget, {
this._initExpander(); this._initExpander();
this._initPullDownAction(); this._initPullDownAction();
this.expander.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.expander.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (self.isEnabled() && self.isValid()) {
if (type === BI.Events.EXPAND) { if (type === BI.Events.EXPAND) {
self._popupView(); self._popupView();
} }
if (type === BI.Events.COLLAPSE) { if (type === BI.Events.COLLAPSE) {
self._hideView(); self._hideView();
} }
if (self.isEnabled() && this.isEnabled()) {
if (type === BI.Events.EXPAND) { if (type === BI.Events.EXPAND) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.fireEvent(BI.Expander.EVENT_EXPAND); self.fireEvent(BI.Expander.EVENT_EXPAND);
} }
if (type === BI.Events.COLLAPSE) { if (type === BI.Events.COLLAPSE) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.fireEvent(BI.Expander.EVENT_COLLAPSE); self.isViewVisible() && self.fireEvent(BI.Expander.EVENT_COLLAPSE);
} }
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
self.fireEvent(BI.Expander.EVENT_TRIGGER_CHANGE, value, obj); self.fireEvent(BI.Expander.EVENT_TRIGGER_CHANGE, value, obj);
@ -3338,11 +3347,11 @@ BI.Expander = BI.inherit(BI.Widget, {
}); });
this.element.hover(function () { this.element.hover(function () {
if (self.isEnabled() && self.expander.isEnabled()) { if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid()) {
self.element.addClass(o.hoverClass); self.element.addClass(o.hoverClass);
} }
}, function () { }, function () {
if (self.isEnabled() && self.expander.isEnabled()) { if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid()) {
self.element.removeClass(o.hoverClass); self.element.removeClass(o.hoverClass);
} }
}); });
@ -3378,13 +3387,13 @@ BI.Expander = BI.inherit(BI.Widget, {
switch (e) { switch (e) {
case "hover": case "hover":
self.element[e](function (e) { self.element[e](function (e) {
if (self.isEnabled() && self.expander.isEnabled()) { if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid()) {
self._popupView(); self._popupView();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, '', self.expander); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, '', self.expander);
self.fireEvent(BI.Expander.EVENT_EXPAND); self.fireEvent(BI.Expander.EVENT_EXPAND);
} }
}, function () { }, function () {
if (self.isEnabled() && self.expander.isEnabled() && o.toggle) { if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid() && o.toggle) {
self._hideView(); self._hideView();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, '', self.expander); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, '', self.expander);
self.fireEvent(BI.Expander.EVENT_COLLAPSE); self.fireEvent(BI.Expander.EVENT_COLLAPSE);
@ -3395,7 +3404,7 @@ BI.Expander = BI.inherit(BI.Widget, {
if (e) { if (e) {
self.element.off(e + "." + self.getName()).on(e + "." + self.getName(), BI.debounce(function (e) { self.element.off(e + "." + self.getName()).on(e + "." + self.getName(), BI.debounce(function (e) {
if (self.expander.element.__isMouseInBounds__(e)) { if (self.expander.element.__isMouseInBounds__(e)) {
if (self.isEnabled() && self.expander.isEnabled()) { if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid()) {
o.toggle ? self._toggle() : self._popupView(); o.toggle ? self._toggle() : self._popupView();
if (self.isExpanded()) { if (self.isExpanded()) {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.expander); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.expander);
@ -3486,6 +3495,7 @@ BI.Expander = BI.inherit(BI.Widget, {
_setEnable: function (arg) { _setEnable: function (arg) {
BI.Expander.superclass._setEnable.apply(this, arguments); BI.Expander.superclass._setEnable.apply(this, arguments);
!arg && this.element.removeClass(this.options.hoverClass);
!arg && this.isViewVisible() && this._hideView(); !arg && this.isViewVisible() && this._hideView();
}, },
@ -4483,15 +4493,20 @@ BI.Switcher = BI.inherit(BI.Widget, {
this._initSwitcher(); this._initSwitcher();
this._initPullDownAction(); this._initPullDownAction();
this.switcher.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.switcher.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (self.isEnabled() && this.isEnabled()) { if (self.isEnabled() && self.isValid()) {
if (type === BI.Events.EXPAND) { if (type === BI.Events.EXPAND) {
self._popupView(); self._popupView();
} }
if (type === BI.Events.COLLAPSE) { if (type === BI.Events.COLLAPSE) {
self._hideView(); self._hideView();
} }
if (type === BI.Events.EXPAND || type === BI.Events.COLLAPSE) { if (type === BI.Events.EXPAND) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.fireEvent(BI.Switcher.EVENT_EXPAND);
}
if (type === BI.Events.COLLAPSE) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.isViewVisible() && self.fireEvent(BI.Switcher.EVENT_COLLAPSE);
} }
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
self.fireEvent(BI.Switcher.EVENT_TRIGGER_CHANGE, value, obj); self.fireEvent(BI.Switcher.EVENT_TRIGGER_CHANGE, value, obj);
@ -15109,15 +15124,16 @@ BI.FloatBox = BI.inherit(BI.Widget, {
populate: function (sectionProvider) { populate: function (sectionProvider) {
var self = this; var self = this;
if (this.currentSectionProvider && this.currentSectionProvider !== sectionProvider) {
this.currentSectionProvider.destroy();
}
this.currentSectionProvider = sectionProvider; this.currentSectionProvider = sectionProvider;
sectionProvider.rebuildNorth(this._north); sectionProvider.rebuildNorth(this._north);
sectionProvider.rebuildCenter(this._center); sectionProvider.rebuildCenter(this._center);
sectionProvider.rebuildSouth(this._south); sectionProvider.rebuildSouth(this._south);
if (sectionProvider instanceof BI.Widget) {
sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () { sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () {
self.close(); self.close();
}) })
}
}, },
show: function () { show: function () {
@ -15140,6 +15156,10 @@ BI.FloatBox = BI.inherit(BI.Widget, {
setZindex: function (zindex) { setZindex: function (zindex) {
this.element.css({"z-index": zindex}); this.element.css({"z-index": zindex});
},
destroyed: function () {
this.currentSectionProvider && this.currentSectionProvider.destroy();
} }
}); });
@ -18176,7 +18196,7 @@ BI.MultifileEditor = BI.inherit(BI.Single, {
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-multifile-editor", baseCls: (conf.baseCls || "") + " bi-multifile-editor",
multiple: false, multiple: false,
maxSize: 1024 * 1024, maxSize: -1,//1024 * 1024
accept: "", accept: "",
url: "" url: ""
}) })
@ -18937,7 +18957,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
url: "", url: "",
multiple: true, multiple: true,
accept: "", /**'*.jpg; *.zip'**/ accept: "", /**'*.jpg; *.zip'**/
maxSize: 1024 * 1024 maxSize: -1 //1024 * 1024
}) })
}, },
@ -20063,7 +20083,7 @@ BI.Bubble = BI.inherit(BI.Tip, {
_right: function(){ _right: function(){
return BI.createWidget({ return BI.createWidget({
type: "bi.inline", type: "bi.left",
items: [{ items: [{
el: { el: {
type: "bi.layout", type: "bi.layout",
@ -29034,11 +29054,26 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
return this.options.isNeedFreeze ? this.options.freezeCols.length : 0; return this.options.isNeedFreeze ? this.options.freezeCols.length : 0;
}, },
_getFreezeHeaderHeight: function () {
var o = this.options;
if (o.header.length * o.headerRowSize >= this._height) {
return 0;
}
return o.header.length * o.headerRowSize;
},
_getActualItems: function () {
var o = this.options;
if (o.header.length * o.headerRowSize >= this._height) {
return o.header.concat(o.items);
}
return o.items;
},
_populateScrollbar: function () { _populateScrollbar: function () {
var o = this.options; var o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; summaryColumnSizeArray = [];
var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size; totalLeftColumnSize += size;
@ -29052,8 +29087,8 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size; summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size;
} }
}); });
this.topScrollbar.setContentSize(o.items.length * o.rowSize); this.topScrollbar.setContentSize(this._getActualItems().length * o.rowSize);
this.topScrollbar.setSize(this._height - o.header.length * o.headerRowSize); this.topScrollbar.setSize(this._height - this._getFreezeHeaderHeight());
this.topScrollbar.setPosition(this.bottomRightCollection.getScrollTop()); this.topScrollbar.setPosition(this.bottomRightCollection.getScrollTop());
this.topScrollbar.populate(); this.topScrollbar.populate();
@ -29068,7 +29103,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
this.rightScrollbar.populate(); this.rightScrollbar.populate();
var items = this.scrollBarLayout.attr("items"); var items = this.scrollBarLayout.attr("items");
items[0].top = o.header.length * o.headerRowSize; items[0].top = this._getFreezeHeaderHeight();
items[1].top = this._height; items[1].top = this._height;
items[2].top = this._height; items[2].top = this._height;
items[2].left = regionSize; items[2].left = regionSize;
@ -29079,8 +29114,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
_populateTable: function () { _populateTable: function () {
var self = this, o = this.options; var self = this, o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; summaryColumnSizeArray = [];
var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size; totalLeftColumnSize += size;
@ -29096,13 +29130,13 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
}); });
var otlw = regionSize; var otlw = regionSize;
var otlh = o.header.length * o.headerRowSize; var otlh = this._getFreezeHeaderHeight();
var otrw = this._width - regionSize; var otrw = this._width - regionSize;
var otrh = o.header.length * o.headerRowSize; var otrh = this._getFreezeHeaderHeight();
var oblw = regionSize; var oblw = regionSize;
var oblh = this._height - o.header.length * o.headerRowSize; var oblh = this._height - otlh;
var obrw = this._width - regionSize; var obrw = this._width - regionSize;
var obrh = this._height - o.header.length * o.headerRowSize; var obrh = this._height - otrh;
var tlw = otlw + this._scrollBarSize; var tlw = otlw + this._scrollBarSize;
var tlh = otlh + this._scrollBarSize; var tlh = otlh + this._scrollBarSize;
@ -29146,9 +29180,9 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
var items = this.contextLayout.attr("items"); var items = this.contextLayout.attr("items");
items[1].left = regionSize; items[1].left = regionSize;
items[2].top = o.header.length * o.headerRowSize; items[2].top = this._getFreezeHeaderHeight();
items[3].left = regionSize; items[3].left = regionSize;
items[3].top = o.header.length * o.headerRowSize; items[3].top = this._getFreezeHeaderHeight();
this.contextLayout.attr("items", items); this.contextLayout.attr("items", items);
this.contextLayout.resize(); this.contextLayout.resize();
@ -29164,8 +29198,8 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
}; };
run(this.topLeftItems, o.header, leftHeader); run(this.topLeftItems, o.header, leftHeader);
run(this.topRightItems, o.header, rightHeader); run(this.topRightItems, o.header, rightHeader);
run(this.bottomLeftItems, o.items, leftItems); run(this.bottomLeftItems, this._getActualItems(), leftItems);
run(this.bottomRightItems, o.items, rightItems); run(this.bottomRightItems, this._getActualItems(), rightItems);
this.topLeftCollection._populate(leftHeader); this.topLeftCollection._populate(leftHeader);
this.topRightCollection._populate(rightHeader); this.topRightCollection._populate(rightHeader);
@ -29176,13 +29210,23 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
_digest: function () { _digest: function () {
var o = this.options; var o = this.options;
var freezeColLength = this._getFreezeColLength(); var freezeColLength = this._getFreezeColLength();
//如果表头位置不够,取消表头冻结
if (this._getFreezeHeaderHeight() <= 0) {
this.topLeftItems = [];
this.topRightItems = [];
this.bottomLeftItems = this._serialize(this._getActualItems(), 0, freezeColLength, o.rowSize, o.columnSize, o.mergeCols, BI.range(o.header.length));
this.bottomRightItems = this._serialize(this._getActualItems(), freezeColLength, o.columnSize.length, o.rowSize, o.columnSize, o.mergeCols, BI.range(o.header.length));
} else {
this.topLeftItems = this._serialize(o.header, 0, freezeColLength, o.headerRowSize, o.columnSize, o.mergeCols); this.topLeftItems = this._serialize(o.header, 0, freezeColLength, o.headerRowSize, o.columnSize, o.mergeCols);
this.topRightItems = this._serialize(o.header, freezeColLength, o.columnSize.length, o.headerRowSize, o.columnSize, true); this.topRightItems = this._serialize(o.header, freezeColLength, o.columnSize.length, o.headerRowSize, o.columnSize, true);
this.bottomLeftItems = this._serialize(o.items, 0, freezeColLength, o.rowSize, o.columnSize, o.mergeCols); this.bottomLeftItems = this._serialize(o.items, 0, freezeColLength, o.rowSize, o.columnSize, o.mergeCols);
this.bottomRightItems = this._serialize(o.items, freezeColLength, o.columnSize.length, o.rowSize, o.columnSize, o.mergeCols); this.bottomRightItems = this._serialize(o.items, freezeColLength, o.columnSize.length, o.rowSize, o.columnSize, o.mergeCols);
}
}, },
_serialize: function (items, startCol, endCol, rowHeight, columnSize, mergeCols) { _serialize: function (items, startCol, endCol, rowHeight, columnSize, mergeCols, mergeRows) {
mergeCols = mergeCols || [];
mergeRows = mergeRows || [];
var self = this, o = this.options; var self = this, o = this.options;
var result = [], cache = {}, preCol = {}, preRow = {}, map = {}; var result = [], cache = {}, preCol = {}, preRow = {}, map = {};
var summaryColumnSize = []; var summaryColumnSize = [];
@ -29232,7 +29276,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
} }
cache[i][j] = cols[j]; cache[i][j] = cols[j];
map[i][j] = {}; map[i][j] = {};
if (mergeCols === true || mergeCols.indexOf(j) > -1) { if (mergeCols === true || mergeCols.indexOf(j) > -1 || mergeRows === true || mergeRows.indexOf(i) > -1) {
if (i === 0 && j === startCol) { if (i === 0 && j === startCol) {
createOneEl(0, startCol); createOneEl(0, startCol);
} else if (j === startCol && i > 0) { } else if (j === startCol && i > 0) {
@ -29679,7 +29723,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.topLeftGrid = BI.createWidget({ this.topLeftGrid = BI.createWidget({
type: "bi.grid_view", type: "bi.grid_view",
rowHeightGetter: rowHeightGetter, rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnLeftWidthGetter, columnWidthGetter: columnLeftWidthGetter
}); });
this.topLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { this.topLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomLeftGrid.setScrollLeft(scroll.scrollLeft); self.bottomLeftGrid.setScrollLeft(scroll.scrollLeft);
@ -29689,7 +29733,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.topRightGrid = BI.createWidget({ this.topRightGrid = BI.createWidget({
type: "bi.grid_view", type: "bi.grid_view",
rowHeightGetter: rowHeightGetter, rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnRightWidthGetter, columnWidthGetter: columnRightWidthGetter
}); });
this.topRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { this.topRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomRightGrid.setScrollLeft(scroll.scrollLeft); self.bottomRightGrid.setScrollLeft(scroll.scrollLeft);
@ -29699,7 +29743,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.bottomLeftGrid = BI.createWidget({ this.bottomLeftGrid = BI.createWidget({
type: "bi.grid_view", type: "bi.grid_view",
rowHeightGetter: rowHeightGetter, rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnLeftWidthGetter, columnWidthGetter: columnLeftWidthGetter
}); });
this.bottomLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { this.bottomLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomRightGrid.setScrollTop(scroll.scrollTop); self.bottomRightGrid.setScrollTop(scroll.scrollTop);
@ -29710,7 +29754,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.bottomRightGrid = BI.createWidget({ this.bottomRightGrid = BI.createWidget({
type: "bi.grid_view", type: "bi.grid_view",
rowHeightGetter: rowHeightGetter, rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnRightWidthGetter, columnWidthGetter: columnRightWidthGetter
}); });
this.bottomRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { this.bottomRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomLeftGrid.setScrollTop(scroll.scrollTop); self.bottomLeftGrid.setScrollTop(scroll.scrollTop);
@ -29798,7 +29842,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
el: this.leftScrollbar, el: this.leftScrollbar,
left: 0 left: 0
}, { }, {
el: this.rightScrollbar, el: this.rightScrollbar
}] }]
}); });
this._width = o.width - BI.GridTableScrollbar.SIZE; this._width = o.width - BI.GridTableScrollbar.SIZE;
@ -29818,11 +29862,26 @@ BI.GridTable = BI.inherit(BI.Widget, {
return this.options.isNeedFreeze ? this.options.freezeCols.length : 0; return this.options.isNeedFreeze ? this.options.freezeCols.length : 0;
}, },
_getFreezeHeaderHeight: function () {
var o = this.options;
if (o.header.length * o.headerRowSize >= this._height) {
return 0;
}
return o.header.length * o.headerRowSize;
},
_getActualItems: function () {
var o = this.options;
if (o.header.length * o.headerRowSize >= this._height) {
return o.header.concat(o.items);
}
return o.items;
},
_populateScrollbar: function () { _populateScrollbar: function () {
var o = this.options; var o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; summaryColumnSizeArray = [];
var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size; totalLeftColumnSize += size;
@ -29836,8 +29895,8 @@ BI.GridTable = BI.inherit(BI.Widget, {
summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size; summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size;
} }
}); });
this.topScrollbar.setContentSize(o.items.length * o.rowSize); this.topScrollbar.setContentSize(this._getActualItems().length * o.rowSize);
this.topScrollbar.setSize(this._height - o.header.length * o.headerRowSize); this.topScrollbar.setSize(this._height - this._getFreezeHeaderHeight());
this.topScrollbar.setPosition(Math.min(this.bottomLeftGrid.getScrollTop(), this.bottomRightGrid.getScrollTop())); this.topScrollbar.setPosition(Math.min(this.bottomLeftGrid.getScrollTop(), this.bottomRightGrid.getScrollTop()));
this.topScrollbar.populate(); this.topScrollbar.populate();
@ -29852,7 +29911,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.rightScrollbar.populate(); this.rightScrollbar.populate();
var items = this.scrollBarLayout.attr("items"); var items = this.scrollBarLayout.attr("items");
items[0].top = o.header.length * o.headerRowSize; items[0].top = this._getFreezeHeaderHeight();
items[1].top = this._height; items[1].top = this._height;
items[2].top = this._height; items[2].top = this._height;
items[2].left = regionSize; items[2].left = regionSize;
@ -29886,7 +29945,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
var o = this.options; var o = this.options;
var freezeColLength = this._getFreezeColLength(); var freezeColLength = this._getFreezeColLength();
var leftItems = [], rightItems = []; var leftItems = [], rightItems = [];
BI.each(o.items, function (i, cols) { BI.each(this._getActualItems(), function (i, cols) {
leftItems[i] = []; leftItems[i] = [];
rightItems[i] = []; rightItems[i] = [];
BI.each(cols, function (j, col) { BI.each(cols, function (j, col) {
@ -29907,7 +29966,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
_populateTable: function () { _populateTable: function () {
var self = this, o = this.options; var self = this, o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; summaryColumnSizeArray = [];
var freezeColLength = this._getFreezeColLength(); var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
@ -29924,13 +29983,13 @@ BI.GridTable = BI.inherit(BI.Widget, {
}); });
var otlw = regionSize; var otlw = regionSize;
var otlh = o.header.length * o.headerRowSize; var otlh = this._getFreezeHeaderHeight();
var otrw = this._width - regionSize; var otrw = this._width - regionSize;
var otrh = o.header.length * o.headerRowSize; var otrh = this._getFreezeHeaderHeight();
var oblw = regionSize; var oblw = regionSize;
var oblh = this._height - o.header.length * o.headerRowSize; var oblh = this._height - otlh;
var obrw = this._width - regionSize; var obrw = this._width - regionSize;
var obrh = this._height - o.header.length * o.headerRowSize; var obrh = this._height - otrh;
var tlw = otlw + this._scrollBarSize; var tlw = otlw + this._scrollBarSize;
var tlh = otlh + this._scrollBarSize; var tlh = otlh + this._scrollBarSize;
@ -29983,9 +30042,9 @@ BI.GridTable = BI.inherit(BI.Widget, {
var items = this.contextLayout.attr("items"); var items = this.contextLayout.attr("items");
items[1].left = regionSize; items[1].left = regionSize;
items[2].top = o.header.length * o.headerRowSize; items[2].top = this._getFreezeHeaderHeight();
items[3].left = regionSize; items[3].left = regionSize;
items[3].top = o.header.length * o.headerRowSize; items[3].top = this._getFreezeHeaderHeight();
this.contextLayout.attr("items", items); this.contextLayout.attr("items", items);
this.contextLayout.resize(); this.contextLayout.resize();
@ -32383,6 +32442,9 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
return BI.extend(BI.ResizableTableCell.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.ResizableTableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-resizable-table-cell", baseCls: "bi-resizable-table-cell",
cell: {}, cell: {},
minSize: 15,
// suitableSize,
maxSize: Number.MAX_VALUE,
start: BI.emptyFn, start: BI.emptyFn,
resize: BI.emptyFn, resize: BI.emptyFn,
stop: BI.emptyFn stop: BI.emptyFn
@ -32396,22 +32458,37 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
var startDrag = false; var startDrag = false;
var size = 0, offset = 0, defaultSize = o.width; var size = 0, offset = 0, defaultSize = o.width;
function optimizeSize(s) {
var optSize = BI.clamp(s, o.minSize, o.maxSize || Number.MAX_VALUE);
if (o.suitableSize) {
if (Math.abs(o.suitableSize - optSize) < 5) {
optSize = o.suitableSize;
self.handler.element.addClass("suitable");
} else {
self.handler.element.removeClass("suitable");
}
}
return optSize;
}
var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX, deltaY) { var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX, deltaY) {
if (mouseMoveTracker.isDragging()) { if (mouseMoveTracker.isDragging()) {
startDrag = true; startDrag = true;
offset += deltaX; offset += deltaX;
size = BI.clamp(defaultSize + offset, 15, Number.MAX_VALUE); size = optimizeSize(defaultSize + offset);
self.handler.element.addClass("dragging"); self.handler.element.addClass("dragging");
o.resize(size); o.resize(size);
} }
}, function () { }, function () {
if (startDrag === true) { if (startDrag === true) {
size = BI.clamp(size, 15, Number.MAX_VALUE); size = optimizeSize(size);
o.stop(size); o.stop(size);
size = 0; size = 0;
offset = 0; offset = 0;
defaultSize = o.width; defaultSize = o.width;
self.handler.element.removeClass("dragging"); self.handler.element.removeClass("dragging");
self.handler.element.removeClass("suitable");
startDrag = false; startDrag = false;
} }
mouseMoveTracker.releaseMouseMoves(); mouseMoveTracker.releaseMouseMoves();
@ -32489,6 +32566,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
mergeCols: [], mergeCols: [],
mergeRule: BI.emptyFn, mergeRule: BI.emptyFn,
columnSize: [], columnSize: [],
minColumnSize: [],
maxColumnSize: [],
freezeCols: [], freezeCols: [],
header: [], header: [],
items: [], items: [],
@ -32681,7 +32760,13 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
self.resizer.setVisible(true); self.resizer.setVisible(true);
var height = o.headerRowSize + self._getRegionRowSize()[1]; var height = o.headerRowSize + self._getRegionRowSize()[1];
self.resizer.setHeight(height); self.resizer.setHeight(height);
if (o.minColumnSize[j]) {
if (size === o.minColumnSize[j]) {
self.resizer.element.addClass("suitable");
} else {
self.resizer.element.removeClass("suitable");
}
}
self._setResizerPosition(self._getResizerLeft(j) + size, (o.header.length - 1) * o.headerRowSize); self._setResizerPosition(self._getResizerLeft(j) + size, (o.header.length - 1) * o.headerRowSize);
}; };
var stop = function (j, size) { var stop = function (j, size) {
@ -32704,6 +32789,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
result[i][j] = { result[i][j] = {
type: "bi.resizable_table_cell", type: "bi.resizable_table_cell",
cell: col, cell: col,
suitableSize: o.minColumnSize[i],
maxSize: o.maxColumnSize[i],
resize: BI.bind(resize, null, j), resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j) stop: BI.bind(stop, null, j)
}; };
@ -32713,6 +32800,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
result[r - 1][j] = { result[r - 1][j] = {
type: "bi.resizable_table_cell", type: "bi.resizable_table_cell",
cell: result[r - 1][j], cell: result[r - 1][j],
suitableSize: o.minColumnSize[i],
maxSize: o.maxColumnSize[i],
resize: BI.bind(resize, null, j), resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j) stop: BI.bind(stop, null, j)
}; };

40
docs/case.js

@ -3567,9 +3567,7 @@ BI.ClipBoard = BI.inherit(BI.BasicButton, {
return BI.isFunction(o.copy) ? o.copy() : o.copy; return BI.isFunction(o.copy) ? o.copy() : o.copy;
} }
}); });
this.clipboard.on("success", function (e) { this.clipboard.on("success", o.afterCopy)
o.afterCopy();
})
} else { } else {
this.element.zclip({ this.element.zclip({
path: BI.resourceURL + "/ZeroClipboard.swf", path: BI.resourceURL + "/ZeroClipboard.swf",
@ -4763,6 +4761,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
toggle: true, toggle: true,
direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
isDefaultInit: false, isDefaultInit: false,
destroyWhenHide: false,
isNeedAdjustHeight: true,//是否需要高度调整 isNeedAdjustHeight: true,//是否需要高度调整
isNeedAdjustWidth: true, isNeedAdjustWidth: true,
stopPropagation: false, stopPropagation: false,
@ -4785,6 +4784,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
toggle: o.toggle, toggle: o.toggle,
direction: o.direction, direction: o.direction,
isDefaultInit: o.isDefaultInit, isDefaultInit: o.isDefaultInit,
destroyWhenHide: o.destroyWhenHide,
isNeedAdjustHeight: o.isNeedAdjustHeight, isNeedAdjustHeight: o.isNeedAdjustHeight,
isNeedAdjustWidth: o.isNeedAdjustWidth, isNeedAdjustWidth: o.isNeedAdjustWidth,
adjustLength: this._getAdjustLength(), adjustLength: this._getAdjustLength(),
@ -4835,37 +4835,40 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
_createTriangle: function (direction) { _createTriangle: function (direction) {
var pos = {}, op = {}; var pos = {}, op = {};
var adjustLength = this._getAdjustLength(); var adjustLength = this.options.adjustLength;
var offset = this.element.offset();
var left = offset.left, right = offset.left + this.element.outerWidth();
var top = offset.top, bottom = offset.top + this.element.outerHeight();
switch (direction) { switch (direction) {
case "left": case "left":
pos = { pos = {
top: 0, top: top,
bottom: 0, height: this.element.outerHeight(),
left: -adjustLength left: left - adjustLength - this._const.TRIANGLE_LENGTH
}; };
op = {width: this._const.TRIANGLE_LENGTH}; op = {width: this._const.TRIANGLE_LENGTH};
break; break;
case "right": case "right":
pos = { pos = {
top: 0, top: top,
bottom: 0, height: this.element.outerHeight(),
right: -adjustLength left: right + adjustLength
}; };
op = {width: this._const.TRIANGLE_LENGTH}; op = {width: this._const.TRIANGLE_LENGTH};
break; break;
case "top": case "top":
pos = { pos = {
left: 0, left: left,
right: 0, width: this.element.outerWidth(),
top: -adjustLength top: top - adjustLength - this._const.TRIANGLE_LENGTH
}; };
op = {height: this._const.TRIANGLE_LENGTH}; op = {height: this._const.TRIANGLE_LENGTH};
break; break;
case "bottom": case "bottom":
pos = { pos = {
left: 0, left: left,
right: 0, width: this.element.outerWidth(),
bottom: -adjustLength top: bottom + adjustLength
}; };
op = {height: this._const.TRIANGLE_LENGTH}; op = {height: this._const.TRIANGLE_LENGTH};
break; break;
@ -4874,6 +4877,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
} }
this.triangle = BI.createWidget(op, { this.triangle = BI.createWidget(op, {
type: "bi.center_adapt", type: "bi.center_adapt",
cls: "button-combo-triangle-wrapper",
items: [{ items: [{
type: "bi.layout", type: "bi.layout",
cls: "bubble-combo-triangle-" + direction + " bi-high-light-border" cls: "bubble-combo-triangle-" + direction + " bi-high-light-border"
@ -4931,7 +4935,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
_hideTriangle: function () { _hideTriangle: function () {
this.triangle && this.triangle.destroy(); this.triangle && this.triangle.destroy();
this.combo.getView().hideLine(); this.combo.getView() && this.combo.getView().hideLine();
}, },
hideView: function () { hideView: function () {
@ -10391,7 +10395,7 @@ BI.DynamicSummaryLayerTreeTable = BI.inherit(BI.Widget, {
_recomputeColumnSize: function () { _recomputeColumnSize: function () {
var o = this.options; var o = this.options;
o.regionColumnSize = this.table.getRegionColumnSize(); o.regionColumnSize = this.table.getRegionColumnSize();
var columnSize = this.table.getColumnSize(); var columnSize = this.table.getColumnSize().slice();
if (o.freezeCols.length > 1) { if (o.freezeCols.length > 1) {
for (var i = 0; i < o.freezeCols.length - 1; i++) { for (var i = 0; i < o.freezeCols.length - 1; i++) {
columnSize.splice(1, 0, 0); columnSize.splice(1, 0, 0);

59
docs/core.js

@ -11493,12 +11493,9 @@ BI.Factory = {
return {} return {}
}, },
init: function () {
},
// _init is an empty function by default. Override it with your own // _init is an empty function by default. Override it with your own
// initialization logic. // initialization logic.
_init: function () { _init: function () {
this.init();
}, },
// Return a copy of the model's `attributes` object. // Return a copy of the model's `attributes` object.
@ -12346,9 +12343,9 @@ BI.Factory = {
setVisible: function (visible) { setVisible: function (visible) {
this.options.invisible = !visible; this.options.invisible = !visible;
if (visible) { if (visible) {
this.element.show(); this.element.css("display", "");
} else { } else {
this.element.hide(); this.element.css("display", "none");
} }
}, },
@ -14200,6 +14197,7 @@ BI.OB = function (config) {
$.extend(BI.OB.prototype, { $.extend(BI.OB.prototype, {
props: {}, props: {},
init: null, init: null,
destroyed: null,
_defaultConfig: function (config) { _defaultConfig: function (config) {
return {}; return {};
@ -14319,6 +14317,11 @@ $.extend(BI.OB.prototype, {
} }
} }
return true; return true;
},
destroy: function () {
this.destroyed && this.destroyed();
this.purgeListeners();
} }
});/** });/**
* Widget超类 * Widget超类
@ -14520,7 +14523,7 @@ BI.Widget = BI.inherit(BI.OB, {
} }
//递归将所有子组件使能 //递归将所有子组件使能
BI.each(this._children, function (i, child) { BI.each(this._children, function (i, child) {
child._setEnable && child._setEnable(enable); !child._manualSetEnable && child._setEnable && child._setEnable(enable);
}); });
}, },
@ -14532,11 +14535,20 @@ BI.Widget = BI.inherit(BI.OB, {
} }
//递归将所有子组件使有效 //递归将所有子组件使有效
BI.each(this._children, function (i, child) { BI.each(this._children, function (i, child) {
child._setValid && child._setValid(valid); !child._manualSetValid && child._setValid && child._setValid(valid);
}); });
}, },
_setVisible: function (visible) {
if (visible === true) {
this.options.invisible = false;
} else if (visible === false) {
this.options.invisible = true;
}
},
setEnable: function (enable) { setEnable: function (enable) {
this._manualSetEnable = true;
this._setEnable(enable); this._setEnable(enable);
if (enable === true) { if (enable === true) {
this.element.removeClass("base-disabled disabled"); this.element.removeClass("base-disabled disabled");
@ -14546,20 +14558,19 @@ BI.Widget = BI.inherit(BI.OB, {
}, },
setVisible: function (visible) { setVisible: function (visible) {
this._setVisible(visible);
if (visible === true) { if (visible === true) {
this.options.invisible = false;
//用this.element.show()会把display属性改成block //用this.element.show()会把display属性改成block
this.element.css("display", ""); this.element.css("display", "");
this._mount(); this._mount();
} else if (visible === false) { } else if (visible === false) {
this.options.invisible = true;
this.element.css("display", "none"); this.element.css("display", "none");
} }
this.fireEvent(BI.Events.VIEW, visible); this.fireEvent(BI.Events.VIEW, visible);
}, },
setValid: function (valid) { setValid: function (valid) {
this.options.invalid = !valid; this._manualSetValid = true;
this._setValid(valid); this._setValid(valid);
if (valid === true) { if (valid === true) {
this.element.removeClass("base-invalid invalid"); this.element.removeClass("base-invalid invalid");
@ -14746,11 +14757,15 @@ BI.Widget = BI.inherit(BI.OB, {
this.purgeListeners(); this.purgeListeners();
} }
});BI.Model = BI.inherit(BI.M, { });BI.Model = BI.inherit(BI.M, {
props: {},
init: null,
destroyed: null,
_defaultConfig: function () { _defaultConfig: function () {
return { return BI.extend({
"default": "just a default", "default": "just a default",
"current": void 0 "current": void 0
} }, this.props)
}, },
_static: function () { _static: function () {
@ -14784,6 +14799,7 @@ BI.Widget = BI.inherit(BI.OB, {
this._read = BI.debounce(BI.bind(this.fetch, this), 30); this._read = BI.debounce(BI.bind(this.fetch, this), 30);
this._save = BI.debounce(BI.bind(this.save, this), 30); this._save = BI.debounce(BI.bind(this.save, this), 30);
this._F = []; this._F = [];
this.init && this.init();
}, },
toJSON: function () { toJSON: function () {
@ -15226,8 +15242,16 @@ BI.Widget = BI.inherit(BI.OB, {
*/ */
BI.View = BI.inherit(BI.V, { BI.View = BI.inherit(BI.V, {
//生命周期函数
beforeCreate: null,
created: null,
destroyed: null,
_init: function () { _init: function () {
BI.View.superclass._init.apply(this, arguments); BI.View.superclass._init.apply(this, arguments);
this.beforeCreate && this.beforeCreate();
var self = this; var self = this;
this.listenTo(this.model, "change:current", function (obj, val) { this.listenTo(this.model, "change:current", function (obj, val) {
if (BI.isNotNull(val) && val.length > 0) { if (BI.isNotNull(val) && val.length > 0) {
@ -15271,7 +15295,8 @@ BI.View = BI.inherit(BI.V, {
return f.apply(this, arguments); return f.apply(this, arguments);
}, self); }, self);
} }
}) });
this.created && this.created();
}, },
change: function (changed, prev) { change: function (changed, prev) {
@ -15716,7 +15741,7 @@ BI.View = BI.inherit(BI.V, {
}); });
delete this._cardLayouts; delete this._cardLayouts;
delete this._cards; delete this._cards;
this.destroyed(); this.destroyed && this.destroyed();
this.off(); this.off();
}, },
@ -15726,14 +15751,10 @@ BI.View = BI.inherit(BI.V, {
}); });
delete this._cardLayouts; delete this._cardLayouts;
delete this._cards; delete this._cards;
this.destroyed(); this.destroyed && this.destroyed();
this.remove(); this.remove();
this.trigger(BI.Events.DESTROY); this.trigger(BI.Events.DESTROY);
this.off(); this.off();
},
destroyed: function () {
} }
});(function () { });(function () {

26
docs/resource.css

@ -1,19 +1,6 @@
/****添加计算宽度的--运算符直接需要space****/ /****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/ /****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/ /**** custom color(自定义颜色,用于特定场景) ****/
@font-face {
font-family: 'bi';
src: url('font/iconfont.eot'), /* IE6-IE8 */ url('font/iconfont.woff') format('woff'), /* chrome、firefox */ url('font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('font/iconfont.svg#svgFontName') format('svg');
/* iOS 4.1- */
}
.b-font {
font-family: "bi";
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
html, html,
button, button,
input, input,
@ -140,6 +127,19 @@ textarea::-webkit-scrollbar-thumb:hover {
} }
/****** common color(常用颜色,可用于普遍场景) *****/ /****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/ /**** custom color(自定义颜色,用于特定场景) ****/
@font-face {
font-family: 'bi';
src: url('font/iconfont.eot'), /* IE6-IE8 */ url('font/iconfont.woff') format('woff'), /* chrome、firefox */ url('font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('font/iconfont.svg#svgFontName') format('svg');
/* iOS 4.1- */
}
.b-font {
font-family: "bi";
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
.close-font .b-font { .close-font .b-font {
*zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = '&#xe600'); *zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = '&#xe600');
} }

199
docs/widget.js

@ -3742,7 +3742,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
case BI.Arrangement.LAYOUT_TYPE.ADAPTIVE: case BI.Arrangement.LAYOUT_TYPE.ADAPTIVE:
if (this._isArrangeFine()) { if (this._isArrangeFine()) {
var width = this.getClientWidth(), height = this.getClientHeight(); var width = this.getClientWidth(), height = this.getClientHeight();
var isHeightAdjust = height > occupied.top + occupied.height; var isHeightAdjust = height > occupied.height;
var regions = this._cloneRegion(); var regions = this._cloneRegion();
BI.each(regions, function (i, region) { BI.each(regions, function (i, region) {
region.width = region.width / occupied.width * width; region.width = region.width / occupied.width * width;
@ -3924,7 +3924,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
BI.Arrangement.EVENT_SCROLL = "EVENT_SCROLL"; BI.Arrangement.EVENT_SCROLL = "EVENT_SCROLL";
BI.extend(BI.Arrangement, { BI.extend(BI.Arrangement, {
PORTION: 24, PORTION: 24,
GRID_HEIGHT: 50, GRID_HEIGHT: 60,
LAYOUT_TYPE: { LAYOUT_TYPE: {
ADAPTIVE: 0, ADAPTIVE: 0,
FREE: 1, FREE: 1,
@ -5638,6 +5638,10 @@ BI.DownListCombo = BI.inherit(BI.Widget, {
}); });
}, },
hideView: function () {
this.downlistcombo.hideView();
},
populate: function (items) { populate: function (items) {
this.popupview.populate(items); this.popupview.populate(items);
}, },
@ -5788,7 +5792,7 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe
logic: { logic: {
dynamic: false dynamic: false
}, },
invalid: true, // invalid: true,
iconCls1: "dot-e-font", iconCls1: "dot-e-font",
iconCls2: "pull-right-e-font" iconCls2: "pull-right-e-font"
}) })
@ -5804,26 +5808,26 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe
text: o.text, text: o.text,
value: o.value, value: o.value,
height: o.height height: o.height
}) });
this.icon1 = BI.createWidget({ this.icon1 = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
cls: o.iconCls1, cls: o.iconCls1,
width: 25, width: 25,
forceNotSelected: true forceNotSelected: true
}) });
this.icon2 = BI.createWidget({ this.icon2 = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
cls: o.iconCls2, cls: o.iconCls2,
width: 25, width: 25,
forceNotSelected: true forceNotSelected: true
}) });
var blank = BI.createWidget({ var blank = BI.createWidget({
type: "bi.layout", type: "bi.layout",
width: 25 width: 25
}) });
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
@ -5833,7 +5837,7 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe
bottom: 0, bottom: 0,
right: 0 right: 0
}] }]
}) });
BI.createWidget(BI.extend({ BI.createWidget(BI.extend({
element: this element: this
@ -5841,19 +5845,11 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe
items: BI.LogicFactory.createLogicItemsByDirection("left", this.icon1, this.text, blank) items: BI.LogicFactory.createLogicItemsByDirection("left", this.icon1, this.text, blank)
})))); }))));
this.element.on("mouseenter." + this.getName(), function (e) { this.element.hover(function () {
if (self.element.__isMouseInBounds__(e) && self.isEnabled()) { if (self.isEnabled()) {
self.hover(); self.hover();
} else {
self.dishover();
} }
}); }, function () {
this.element.on("mousemove." + this.getName(), function (e) {
if (!self.element.__isMouseInBounds__(e) && self.isEnabled()) {
self.dishover()
}
});
this.element.on("mouseleave." + this.getName(), function () {
if (self.isEnabled()) { if (self.isEnabled()) {
self.dishover() self.dishover()
} }
@ -11318,34 +11314,36 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
itemsCreator: o.itemsCreator itemsCreator: o.itemsCreator
}); });
this.adapter.on(BI.MultiSelectTreePopup.EVENT_CHANGE, function () { this.adapter.on(BI.MultiSelectTreePopup.EVENT_CHANGE, function () {
if (self.trigger.isSearching()) { if (self.searcher.isSearching()) {
self.storeValue = {value: self.searcherPane.getValue()}; self.storeValue = {value: self.searcherPane.getValue()};
} else { } else {
self.storeValue = {value: self.adapter.getValue()}; self.storeValue = {value: self.adapter.getValue()};
} }
self.setSelectedValue(self.storeValue.value);
self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE); self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE);
}); });
this.searcherPane = BI.createWidget({//搜索中的时候用的是parttree,同adapter中的synctree不一样 //搜索中的时候用的是parttree,同adapter中的synctree不一样
this.searcherPane = BI.createWidget({
type: "bi.multi_tree_search_pane", type: "bi.multi_tree_search_pane",
cls: "bi-border-left bi-border-right bi-border-bottom", cls: "bi-border-left bi-border-right bi-border-bottom",
keywordGetter: function () { keywordGetter: function () {
return self.trigger.getKeyword(); return self.searcher.getKeyword();
}, },
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
op.keyword = self.trigger.getKeyword(); op.keyword = self.searcher.getKeyword();
o.itemsCreator(op, callback); o.itemsCreator(op, callback);
} }
}); });
this.searcherPane.setVisible(false); this.searcherPane.setVisible(false);
this.trigger = BI.createWidget({ this.searcher = BI.createWidget({
type: "bi.searcher", type: "bi.searcher",
isAutoSearch: false, isAutoSearch: false,
isAutoSync: false, isAutoSync: false,
onSearch: function (op, callback) { onSearch: function (op, callback) {
callback({ callback({
keyword: self.trigger.getKeyword() keyword: self.searcher.getKeyword()
}); });
}, },
adapter: this.adapter, adapter: this.adapter,
@ -11355,15 +11353,15 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
eventName: BI.Searcher.EVENT_START, eventName: BI.Searcher.EVENT_START,
action: function () { action: function () {
self._showSearcherPane(); self._showSearcherPane();
self.storeValue = {value: self.adapter.getValue()}; // self.storeValue = {value: self.adapter.getValue()};
self.searcherPane.setValue(self.storeValue); // self.searcherPane.setSelectedValue(self.storeValue.value);
} }
}, { }, {
eventName: BI.Searcher.EVENT_STOP, eventName: BI.Searcher.EVENT_STOP,
action: function () { action: function () {
self._showAdapter(); self._showAdapter();
// self.storeValue = {value: self.searcherPane.getValue()}; // self.storeValue = {value: self.searcherPane.getValue()};
self.adapter.setValue(self.storeValue); // self.adapter.setSelectedValue(self.storeValue.value);
BI.nextTick(function () { BI.nextTick(function () {
self.adapter.populate(); self.adapter.populate();
}); });
@ -11371,11 +11369,12 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
}, { }, {
eventName: BI.Searcher.EVENT_CHANGE, eventName: BI.Searcher.EVENT_CHANGE,
action: function () { action: function () {
if (self.trigger.isSearching()) { if (self.searcher.isSearching()) {
self.storeValue = {value: self.searcherPane.getValue()}; self.storeValue = {value: self.searcherPane.getValue()};
} else { } else {
self.storeValue = {value: self.adapter.getValue()}; self.storeValue = {value: self.adapter.getValue()};
} }
self.setSelectedValue(self.storeValue.value);
self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE); self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE);
} }
}, { }, {
@ -11390,7 +11389,7 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
type: "bi.vtape", type: "bi.vtape",
element: this, element: this,
items: [{ items: [{
el: this.trigger, el: this.searcher,
height: 30 height: 30
}, { }, {
el: this.adapter, el: this.adapter,
@ -11425,18 +11424,21 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setSelectedValue: function (v) {
this.storeValue.value = v || {}; this.storeValue.value = v || {};
this.adapter.setValue({ this.adapter.setSelectedValue(v);
value: v || {} this.searcherPane.setSelectedValue(v);
}); this.searcher.setValue({
this.trigger.setValue({
value: v || {} value: v || {}
}); });
}, },
setValue: function (v) {
this.adapter.setValue(v);
},
stopSearch: function () { stopSearch: function () {
this.trigger.stopSearch(); this.searcher.stopSearch();
}, },
updateValue: function (v) { updateValue: function (v) {
@ -11448,7 +11450,7 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
}, },
populate: function () { populate: function () {
this.trigger.populate.apply(this.trigger, arguments); this.searcher.populate.apply(this.searcher, arguments);
this.adapter.populate.apply(this.adapter, arguments); this.adapter.populate.apply(this.adapter, arguments);
} }
}); });
@ -11489,7 +11491,12 @@ BI.MultiSelectTreePopup = BI.inherit(BI.Widget, {
setValue: function (v) { setValue: function (v) {
v || (v = {}); v || (v = {});
this.popup.setValue(v.value); this.popup.setValue(v);
},
setSelectedValue: function (v) {
v || (v = {});
this.popup.setSelectedValue(v);
}, },
updateValue: function (v) { updateValue: function (v) {
@ -11708,7 +11715,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
}, { }, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM, eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,
action: function () { action: function () {
self._defaultState(); self.combo.hideView();
} }
}, { }, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR, eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR,
@ -12016,8 +12023,12 @@ BI.MultiTreeSearchPane = BI.inherit(BI.Pane, {
}, },
setValue: function (v) { setValue: function (v) {
this.setSelectedValue(v.value);
},
setSelectedValue: function (v) {
v || (v = {}); v || (v = {});
this.partTree.setSelectedValue(v.value); this.partTree.setSelectedValue(v);
}, },
getValue: function () { getValue: function () {
@ -17252,7 +17263,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
return; return;
} }
BI.each(selected, function (k) { BI.each(selected, function (k) {
var node = self._getNode(parentValues, k); var node = self._getTreeNode(parentValues, k);
var newParents = BI.clone(parentValues); var newParents = BI.clone(parentValues);
newParents.push(node.value); newParents.push(node.value);
createOneJson(node, BI.last(parentValues), getCount(selected[k], newParents)); createOneJson(node, BI.last(parentValues), getCount(selected[k], newParents));
@ -17284,7 +17295,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
_reqSelectedTreeNode: function (op, callback) { _reqSelectedTreeNode: function (op, callback) {
var self = this; var self = this;
var selectedValues = op.selectedValues; var selectedValues = BI.deepClone(op.selectedValues);
var notSelectedValue = op.notSelectedValue || {}; var notSelectedValue = op.notSelectedValue || {};
var keyword = op.keyword || ""; var keyword = op.keyword || "";
var parentValues = op.parentValues || []; var parentValues = op.parentValues || [];
@ -17299,12 +17310,34 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
function dealWithSelectedValues(selectedValues) { function dealWithSelectedValues(selectedValues) {
var p = BI.clone(parentValues); var p = parentValues.concat(notSelectedValue);
p.push(notSelectedValue); //存储的值中存在这个值就把它删掉
if (canFindKey(selectedValues, p)) {
//如果搜索的值在父亲链中
if (isSearchValueInParent(p)) {
self._deleteNode(selectedValues, p);
} else {
var searched = [];
var finded = search(parentValues, notSelectedValue, [], searched);
if (finded && BI.isNotEmptyArray(searched)) {
BI.each(searched, function (i, arr) {
self._deleteNode(selectedValues, arr);
})
}
}
}
//存储的值中不存在这个值,但父亲节点是全选的情况
if (isChild(selectedValues, p)) { if (isChild(selectedValues, p)) {
var result = []; var result = [], finded = false;
var finded = search(parentValues.length + 1, parentValues, notSelectedValue, result); //如果parentValues中有匹配的值,说明搜索结果不在当前值下
if (isSearchValueInParent(p)) {
finded = true;
} else {
//从当前值开始搜
finded = search(parentValues, notSelectedValue, result);
p = parentValues;
}
if (finded === true) { if (finded === true) {
var next = selectedValues; var next = selectedValues;
@ -17340,10 +17373,11 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
} }
function search(deep, parents, current, result) { function search(parents, current, result, searched) {
var newParents = BI.clone(parents); var newParents = BI.clone(parents);
newParents.push(current); newParents.push(current);
if (self._isMatch(current, keyword)) { if (self._isMatch(current, keyword)) {
searched && searched.push(newParents);
return true; return true;
} }
@ -17353,7 +17387,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
var can = false; var can = false;
BI.each(children, function (i, child) { BI.each(children, function (i, child) {
if (search(deep + 1, newParents, child.value, result)) { if (search(newParents, child.value, result, searched)) {
can = true; can = true;
} else { } else {
notSearch.push(child.value); notSearch.push(child.value);
@ -17369,6 +17403,27 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
return can; return can;
} }
function isSearchValueInParent(parentValues) {
for (var i = 0, len = parentValues.length; i < len; i++) {
if (self._isMatch(parentValues[i], keyword)) {
return true;
}
}
return false;
}
function canFindKey(selectedValues, parents) {
var t = selectedValues;
for (var i = 0; i < parents.length; i++) {
var v = parents[i];
t = t[v];
if (t == null) {
return false;
}
}
return true;
}
function isChild(selectedValues, parents) { function isChild(selectedValues, parents) {
var t = selectedValues; var t = selectedValues;
for (var i = 0; i < parents.length; i++) { for (var i = 0; i < parents.length; i++) {
@ -17377,11 +17432,11 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
return false; return false;
} }
t = t[v]; t = t[v];
if (t == null || BI.isEmpty(t)) { if (BI.isEmpty(t)) {
return true; return true;
} }
} }
return true; return false;
} }
}, },
@ -17505,7 +17560,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
} }
function createOneJson(parentValues, value, isOpen, checked, half, flag, result) { function createOneJson(parentValues, value, isOpen, checked, half, flag, result) {
var node = self._getNode(parentValues, value) var node = self._getTreeNode(parentValues, value)
result.push({ result.push({
id: node.id, id: node.id,
pId: node.pId, pId: node.pId,
@ -17582,11 +17637,11 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
var times = op.times; var times = op.times;
var checkState = op.checkState || {}; var checkState = op.checkState || {};
var parentValues = op.parentValues || []; var parentValues = op.parentValues || [];
var selectedValues = op.selectedValues; var selectedValues = op.selectedValues || {};
var valueMap = {}; var valueMap = {};
if (judgeState(parentValues, selectedValues, checkState)) { // if (judgeState(parentValues, selectedValues, checkState)) {
valueMap = dealWidthSelectedValue(parentValues, selectedValues); valueMap = dealWidthSelectedValue(parentValues, selectedValues);
} // }
var nodes = this._getChildren(parentValues); var nodes = this._getChildren(parentValues);
for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) { for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) {
var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState); var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState);
@ -17619,7 +17674,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
function dealWidthSelectedValue(parentValues, selectedValues) { function dealWidthSelectedValue(parentValues, selectedValues) {
var valueMap = {}; var valueMap = {};
BI.each(parentValues, function (i, v) { BI.each(parentValues, function (i, v) {
selectedValues = selectedValues[v]; selectedValues = selectedValues[v] || {};
}); });
BI.each(selectedValues, function (value, obj) { BI.each(selectedValues, function (value, obj) {
if (BI.isNull(obj)) { if (BI.isNull(obj)) {
@ -17667,6 +17722,32 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
} }
}, },
_getNode: function (selectedValues, parentValues) {
var pNode = selectedValues;
for (var i = 0, len = parentValues.length; i < len; i++) {
if (pNode == null) {
return null;
}
pNode = pNode[parentValues[i]];
}
return pNode;
},
_deleteNode: function (selectedValues, values) {
var name = values[values.length - 1];
var p = values.slice(0, values.length - 1);
var pNode = this._getNode(selectedValues, p);
if (pNode[name]) {
delete pNode[name];
//递归删掉空父节点
while (p.length > 0 && BI.isEmpty(pNode)) {
name = p[p.length - 1];
p = p.slice(0, p.length - 1);
pNode = this._getNode(selectedValues, p);
delete pNode[name];
}
}
},
_buildTree: function (jo, values) { _buildTree: function (jo, values) {
var t = jo; var t = jo;
@ -17683,7 +17764,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
return finded.finded.length > 0 || finded.matched.length > 0; return finded.finded.length > 0 || finded.matched.length > 0;
}, },
_getNode: function (parentValues, v) { _getTreeNode: function (parentValues, v) {
var self = this; var self = this;
var findedParentNode; var findedParentNode;
var index = 0; var index = 0;
@ -17710,7 +17791,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
_getChildren: function (parentValues) { _getChildren: function (parentValues) {
if (parentValues.length > 0) { if (parentValues.length > 0) {
var value = BI.last(parentValues); var value = BI.last(parentValues);
var parent = this._getNode(parentValues.slice(0, parentValues.length - 1), value); var parent = this._getTreeNode(parentValues.slice(0, parentValues.length - 1), value);
} else { } else {
var parent = this.tree.getRoot(); var parent = this.tree.getRoot();
} }
@ -17806,6 +17887,10 @@ BI.TreeValueChooserPane = BI.inherit(BI.AbstractTreeValueChooser, {
} }
}, },
setSelectedValue: function (v) {
this.pane.setSelectedValue(v);
},
setValue: function (v) { setValue: function (v) {
this.pane.setValue(v); this.pane.setValue(v);
}, },

28
src/base/combination/combo.js

@ -11,6 +11,7 @@ BI.Combo = BI.inherit(BI.Widget, {
toggle: true, toggle: true,
direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
isDefaultInit: false, isDefaultInit: false,
destroyWhenHide: false,
isNeedAdjustHeight: true,//是否需要高度调整 isNeedAdjustHeight: true,//是否需要高度调整
isNeedAdjustWidth: true, isNeedAdjustWidth: true,
stopEvent: false, stopEvent: false,
@ -33,17 +34,21 @@ BI.Combo = BI.inherit(BI.Widget, {
this._initCombo(); this._initCombo();
this._initPullDownAction(); this._initPullDownAction();
this.combo.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.combo.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (self.isEnabled() && this.isEnabled()) { if (self.isEnabled() && self.isValid()) {
if (type === BI.Events.EXPAND) { if (type === BI.Events.EXPAND) {
self._popupView(); self._popupView();
} }
if (type === BI.Events.COLLAPSE) { if (type === BI.Events.COLLAPSE) {
self._hideView(); self._hideView();
} }
if (type === BI.Events.EXPAND || type === BI.Events.COLLAPSE) { if (type === BI.Events.EXPAND) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.fireEvent(BI.Combo.EVENT_EXPAND);
}
if (type === BI.Events.COLLAPSE) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.isViewVisible() && self.fireEvent(BI.Combo.EVENT_COLLAPSE);
} }
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
self.fireEvent(BI.Combo.EVENT_TRIGGER_CHANGE, obj); self.fireEvent(BI.Combo.EVENT_TRIGGER_CHANGE, obj);
} }
@ -51,12 +56,12 @@ BI.Combo = BI.inherit(BI.Widget, {
}); });
self.element.on("mouseenter." + self.getName(), function (e) { self.element.on("mouseenter." + self.getName(), function (e) {
if (self.isEnabled() && self.combo.isEnabled()) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
self.element.addClass(o.hoverClass); self.element.addClass(o.hoverClass);
} }
}); });
self.element.on("mouseleave." + self.getName(), function (e) { self.element.on("mouseleave." + self.getName(), function (e) {
if (self.isEnabled() && self.combo.isEnabled()) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
self.element.removeClass(o.hoverClass); self.element.removeClass(o.hoverClass);
} }
}); });
@ -103,14 +108,14 @@ BI.Combo = BI.inherit(BI.Widget, {
switch (ev) { switch (ev) {
case "hover": case "hover":
self.element.on("mouseenter." + self.getName(), function (e) { self.element.on("mouseenter." + self.getName(), function (e) {
if (self.isEnabled() && self.combo.isEnabled()) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
self._popupView(); self._popupView();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo);
self.fireEvent(BI.Combo.EVENT_EXPAND); self.fireEvent(BI.Combo.EVENT_EXPAND);
} }
}); });
self.element.on("mouseleave." + self.getName(), function (e) { self.element.on("mouseleave." + self.getName(), function (e) {
if (self.isEnabled() && self.combo.isEnabled() && o.toggle === true) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid() && o.toggle === true) {
self._hideView(); self._hideView();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.combo); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.combo);
self.fireEvent(BI.Combo.EVENT_COLLAPSE); self.fireEvent(BI.Combo.EVENT_COLLAPSE);
@ -120,7 +125,7 @@ BI.Combo = BI.inherit(BI.Widget, {
case "click": case "click":
var debounce = BI.debounce(function (e) { var debounce = BI.debounce(function (e) {
if (self.combo.element.__isMouseInBounds__(e)) { if (self.combo.element.__isMouseInBounds__(e)) {
if (self.isEnabled() && self.combo.isEnabled()) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
o.toggle ? self._toggle() : self._popupView(); o.toggle ? self._toggle() : self._popupView();
if (self.isViewVisible()) { if (self.isViewVisible()) {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo);
@ -196,7 +201,13 @@ BI.Combo = BI.inherit(BI.Widget, {
_hideView: function () { _hideView: function () {
this.fireEvent(BI.Combo.EVENT_BEFORE_HIDEVIEW); this.fireEvent(BI.Combo.EVENT_BEFORE_HIDEVIEW);
if (this.options.destroyWhenHide === true) {
this.popupView && this.popupView.destroy();
this.popupView = null;
this._rendered = false;
} else {
this.popupView && this.popupView.invisible(); this.popupView && this.popupView.invisible();
}
this.element.removeClass(this.options.comboClass); this.element.removeClass(this.options.comboClass);
$(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); $(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName());
@ -327,6 +338,7 @@ BI.Combo = BI.inherit(BI.Widget, {
_setEnable: function (arg) { _setEnable: function (arg) {
BI.Combo.superclass._setEnable.apply(this, arguments); BI.Combo.superclass._setEnable.apply(this, arguments);
!arg && this.element.removeClass(this.options.hoverClass);
!arg && this.isViewVisible() && this._hideView(); !arg && this.isViewVisible() && this._hideView();
}, },

15
src/base/combination/expander.js

@ -28,20 +28,20 @@ BI.Expander = BI.inherit(BI.Widget, {
this._initExpander(); this._initExpander();
this._initPullDownAction(); this._initPullDownAction();
this.expander.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.expander.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (self.isEnabled() && self.isValid()) {
if (type === BI.Events.EXPAND) { if (type === BI.Events.EXPAND) {
self._popupView(); self._popupView();
} }
if (type === BI.Events.COLLAPSE) { if (type === BI.Events.COLLAPSE) {
self._hideView(); self._hideView();
} }
if (self.isEnabled() && this.isEnabled()) {
if (type === BI.Events.EXPAND) { if (type === BI.Events.EXPAND) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.fireEvent(BI.Expander.EVENT_EXPAND); self.fireEvent(BI.Expander.EVENT_EXPAND);
} }
if (type === BI.Events.COLLAPSE) { if (type === BI.Events.COLLAPSE) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.fireEvent(BI.Expander.EVENT_COLLAPSE); self.isViewVisible() && self.fireEvent(BI.Expander.EVENT_COLLAPSE);
} }
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
self.fireEvent(BI.Expander.EVENT_TRIGGER_CHANGE, value, obj); self.fireEvent(BI.Expander.EVENT_TRIGGER_CHANGE, value, obj);
@ -50,11 +50,11 @@ BI.Expander = BI.inherit(BI.Widget, {
}); });
this.element.hover(function () { this.element.hover(function () {
if (self.isEnabled() && self.expander.isEnabled()) { if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid()) {
self.element.addClass(o.hoverClass); self.element.addClass(o.hoverClass);
} }
}, function () { }, function () {
if (self.isEnabled() && self.expander.isEnabled()) { if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid()) {
self.element.removeClass(o.hoverClass); self.element.removeClass(o.hoverClass);
} }
}); });
@ -90,13 +90,13 @@ BI.Expander = BI.inherit(BI.Widget, {
switch (e) { switch (e) {
case "hover": case "hover":
self.element[e](function (e) { self.element[e](function (e) {
if (self.isEnabled() && self.expander.isEnabled()) { if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid()) {
self._popupView(); self._popupView();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, '', self.expander); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, '', self.expander);
self.fireEvent(BI.Expander.EVENT_EXPAND); self.fireEvent(BI.Expander.EVENT_EXPAND);
} }
}, function () { }, function () {
if (self.isEnabled() && self.expander.isEnabled() && o.toggle) { if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid() && o.toggle) {
self._hideView(); self._hideView();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, '', self.expander); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, '', self.expander);
self.fireEvent(BI.Expander.EVENT_COLLAPSE); self.fireEvent(BI.Expander.EVENT_COLLAPSE);
@ -107,7 +107,7 @@ BI.Expander = BI.inherit(BI.Widget, {
if (e) { if (e) {
self.element.off(e + "." + self.getName()).on(e + "." + self.getName(), BI.debounce(function (e) { self.element.off(e + "." + self.getName()).on(e + "." + self.getName(), BI.debounce(function (e) {
if (self.expander.element.__isMouseInBounds__(e)) { if (self.expander.element.__isMouseInBounds__(e)) {
if (self.isEnabled() && self.expander.isEnabled()) { if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid()) {
o.toggle ? self._toggle() : self._popupView(); o.toggle ? self._toggle() : self._popupView();
if (self.isExpanded()) { if (self.isExpanded()) {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.expander); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.expander);
@ -198,6 +198,7 @@ BI.Expander = BI.inherit(BI.Widget, {
_setEnable: function (arg) { _setEnable: function (arg) {
BI.Expander.superclass._setEnable.apply(this, arguments); BI.Expander.superclass._setEnable.apply(this, arguments);
!arg && this.element.removeClass(this.options.hoverClass);
!arg && this.isViewVisible() && this._hideView(); !arg && this.isViewVisible() && this._hideView();
}, },

9
src/base/combination/switcher.js

@ -28,15 +28,20 @@ BI.Switcher = BI.inherit(BI.Widget, {
this._initSwitcher(); this._initSwitcher();
this._initPullDownAction(); this._initPullDownAction();
this.switcher.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.switcher.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (self.isEnabled() && this.isEnabled()) { if (self.isEnabled() && self.isValid()) {
if (type === BI.Events.EXPAND) { if (type === BI.Events.EXPAND) {
self._popupView(); self._popupView();
} }
if (type === BI.Events.COLLAPSE) { if (type === BI.Events.COLLAPSE) {
self._hideView(); self._hideView();
} }
if (type === BI.Events.EXPAND || type === BI.Events.COLLAPSE) { if (type === BI.Events.EXPAND) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.fireEvent(BI.Switcher.EVENT_EXPAND);
}
if (type === BI.Events.COLLAPSE) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.isViewVisible() && self.fireEvent(BI.Switcher.EVENT_COLLAPSE);
} }
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
self.fireEvent(BI.Switcher.EVENT_TRIGGER_CHANGE, value, obj); self.fireEvent(BI.Switcher.EVENT_TRIGGER_CHANGE, value, obj);

9
src/base/layer/layer.floatbox.js

@ -105,15 +105,16 @@ BI.FloatBox = BI.inherit(BI.Widget, {
populate: function (sectionProvider) { populate: function (sectionProvider) {
var self = this; var self = this;
if (this.currentSectionProvider && this.currentSectionProvider !== sectionProvider) {
this.currentSectionProvider.destroy();
}
this.currentSectionProvider = sectionProvider; this.currentSectionProvider = sectionProvider;
sectionProvider.rebuildNorth(this._north); sectionProvider.rebuildNorth(this._north);
sectionProvider.rebuildCenter(this._center); sectionProvider.rebuildCenter(this._center);
sectionProvider.rebuildSouth(this._south); sectionProvider.rebuildSouth(this._south);
if (sectionProvider instanceof BI.Widget) {
sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () { sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () {
self.close(); self.close();
}) })
}
}, },
show: function () { show: function () {
@ -136,6 +137,10 @@ BI.FloatBox = BI.inherit(BI.Widget, {
setZindex: function (zindex) { setZindex: function (zindex) {
this.element.css({"z-index": zindex}); this.element.css({"z-index": zindex});
},
destroyed: function () {
this.currentSectionProvider && this.currentSectionProvider.destroy();
} }
}); });

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

@ -127,7 +127,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
$(document).bind("mouseup." + self.getName(), function (e) { $(document).bind("mouseup." + self.getName(), function (e) {
// if (e.button === 0) { // if (e.button === 0) {
if (BI.DOM.isExist(self) && !hand.__isMouseInBounds__(e) && mouseDown === true && !selected) { if (BI.DOM.isExist(self) && !hand.__isMouseInBounds__(e) && mouseDown === true && !selected) {
self.setSelected(!self.isSelected()); // self.setSelected(!self.isSelected());
self._trigger(); self._trigger();
} }
mouseDown = false; mouseDown = false;

2
src/base/single/editor/editor.multifile.js

@ -12,7 +12,7 @@ BI.MultifileEditor = BI.inherit(BI.Single, {
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-multifile-editor", baseCls: (conf.baseCls || "") + " bi-multifile-editor",
multiple: false, multiple: false,
maxSize: 1024 * 1024, maxSize: -1,//1024 * 1024
accept: "", accept: "",
url: "" url: ""
}) })

2
src/base/single/input/file.js

@ -399,7 +399,7 @@
url: "", url: "",
multiple: true, multiple: true,
accept: "", /**'*.jpg; *.zip'**/ accept: "", /**'*.jpg; *.zip'**/
maxSize: 1024 * 1024 maxSize: -1 //1024 * 1024
}) })
}, },

2
src/base/single/tip/tip.bubble.js

@ -86,7 +86,7 @@ BI.Bubble = BI.inherit(BI.Tip, {
_right: function(){ _right: function(){
return BI.createWidget({ return BI.createWidget({
type: "bi.inline", type: "bi.left",
items: [{ items: [{
el: { el: {
type: "bi.layout", type: "bi.layout",

58
src/base/table/table.collection.js

@ -173,11 +173,26 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
return this.options.isNeedFreeze ? this.options.freezeCols.length : 0; return this.options.isNeedFreeze ? this.options.freezeCols.length : 0;
}, },
_getFreezeHeaderHeight: function () {
var o = this.options;
if (o.header.length * o.headerRowSize >= this._height) {
return 0;
}
return o.header.length * o.headerRowSize;
},
_getActualItems: function () {
var o = this.options;
if (o.header.length * o.headerRowSize >= this._height) {
return o.header.concat(o.items);
}
return o.items;
},
_populateScrollbar: function () { _populateScrollbar: function () {
var o = this.options; var o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; summaryColumnSizeArray = [];
var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size; totalLeftColumnSize += size;
@ -191,8 +206,8 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size; summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size;
} }
}); });
this.topScrollbar.setContentSize(o.items.length * o.rowSize); this.topScrollbar.setContentSize(this._getActualItems().length * o.rowSize);
this.topScrollbar.setSize(this._height - o.header.length * o.headerRowSize); this.topScrollbar.setSize(this._height - this._getFreezeHeaderHeight());
this.topScrollbar.setPosition(this.bottomRightCollection.getScrollTop()); this.topScrollbar.setPosition(this.bottomRightCollection.getScrollTop());
this.topScrollbar.populate(); this.topScrollbar.populate();
@ -207,7 +222,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
this.rightScrollbar.populate(); this.rightScrollbar.populate();
var items = this.scrollBarLayout.attr("items"); var items = this.scrollBarLayout.attr("items");
items[0].top = o.header.length * o.headerRowSize; items[0].top = this._getFreezeHeaderHeight();
items[1].top = this._height; items[1].top = this._height;
items[2].top = this._height; items[2].top = this._height;
items[2].left = regionSize; items[2].left = regionSize;
@ -218,8 +233,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
_populateTable: function () { _populateTable: function () {
var self = this, o = this.options; var self = this, o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; summaryColumnSizeArray = [];
var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size; totalLeftColumnSize += size;
@ -235,13 +249,13 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
}); });
var otlw = regionSize; var otlw = regionSize;
var otlh = o.header.length * o.headerRowSize; var otlh = this._getFreezeHeaderHeight();
var otrw = this._width - regionSize; var otrw = this._width - regionSize;
var otrh = o.header.length * o.headerRowSize; var otrh = this._getFreezeHeaderHeight();
var oblw = regionSize; var oblw = regionSize;
var oblh = this._height - o.header.length * o.headerRowSize; var oblh = this._height - otlh;
var obrw = this._width - regionSize; var obrw = this._width - regionSize;
var obrh = this._height - o.header.length * o.headerRowSize; var obrh = this._height - otrh;
var tlw = otlw + this._scrollBarSize; var tlw = otlw + this._scrollBarSize;
var tlh = otlh + this._scrollBarSize; var tlh = otlh + this._scrollBarSize;
@ -285,9 +299,9 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
var items = this.contextLayout.attr("items"); var items = this.contextLayout.attr("items");
items[1].left = regionSize; items[1].left = regionSize;
items[2].top = o.header.length * o.headerRowSize; items[2].top = this._getFreezeHeaderHeight();
items[3].left = regionSize; items[3].left = regionSize;
items[3].top = o.header.length * o.headerRowSize; items[3].top = this._getFreezeHeaderHeight();
this.contextLayout.attr("items", items); this.contextLayout.attr("items", items);
this.contextLayout.resize(); this.contextLayout.resize();
@ -303,8 +317,8 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
}; };
run(this.topLeftItems, o.header, leftHeader); run(this.topLeftItems, o.header, leftHeader);
run(this.topRightItems, o.header, rightHeader); run(this.topRightItems, o.header, rightHeader);
run(this.bottomLeftItems, o.items, leftItems); run(this.bottomLeftItems, this._getActualItems(), leftItems);
run(this.bottomRightItems, o.items, rightItems); run(this.bottomRightItems, this._getActualItems(), rightItems);
this.topLeftCollection._populate(leftHeader); this.topLeftCollection._populate(leftHeader);
this.topRightCollection._populate(rightHeader); this.topRightCollection._populate(rightHeader);
@ -315,13 +329,23 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
_digest: function () { _digest: function () {
var o = this.options; var o = this.options;
var freezeColLength = this._getFreezeColLength(); var freezeColLength = this._getFreezeColLength();
//如果表头位置不够,取消表头冻结
if (this._getFreezeHeaderHeight() <= 0) {
this.topLeftItems = [];
this.topRightItems = [];
this.bottomLeftItems = this._serialize(this._getActualItems(), 0, freezeColLength, o.rowSize, o.columnSize, o.mergeCols, BI.range(o.header.length));
this.bottomRightItems = this._serialize(this._getActualItems(), freezeColLength, o.columnSize.length, o.rowSize, o.columnSize, o.mergeCols, BI.range(o.header.length));
} else {
this.topLeftItems = this._serialize(o.header, 0, freezeColLength, o.headerRowSize, o.columnSize, o.mergeCols); this.topLeftItems = this._serialize(o.header, 0, freezeColLength, o.headerRowSize, o.columnSize, o.mergeCols);
this.topRightItems = this._serialize(o.header, freezeColLength, o.columnSize.length, o.headerRowSize, o.columnSize, true); this.topRightItems = this._serialize(o.header, freezeColLength, o.columnSize.length, o.headerRowSize, o.columnSize, true);
this.bottomLeftItems = this._serialize(o.items, 0, freezeColLength, o.rowSize, o.columnSize, o.mergeCols); this.bottomLeftItems = this._serialize(o.items, 0, freezeColLength, o.rowSize, o.columnSize, o.mergeCols);
this.bottomRightItems = this._serialize(o.items, freezeColLength, o.columnSize.length, o.rowSize, o.columnSize, o.mergeCols); this.bottomRightItems = this._serialize(o.items, freezeColLength, o.columnSize.length, o.rowSize, o.columnSize, o.mergeCols);
}
}, },
_serialize: function (items, startCol, endCol, rowHeight, columnSize, mergeCols) { _serialize: function (items, startCol, endCol, rowHeight, columnSize, mergeCols, mergeRows) {
mergeCols = mergeCols || [];
mergeRows = mergeRows || [];
var self = this, o = this.options; var self = this, o = this.options;
var result = [], cache = {}, preCol = {}, preRow = {}, map = {}; var result = [], cache = {}, preCol = {}, preRow = {}, map = {};
var summaryColumnSize = []; var summaryColumnSize = [];
@ -371,7 +395,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
} }
cache[i][j] = cols[j]; cache[i][j] = cols[j];
map[i][j] = {}; map[i][j] = {};
if (mergeCols === true || mergeCols.indexOf(j) > -1) { if (mergeCols === true || mergeCols.indexOf(j) > -1 || mergeRows === true || mergeRows.indexOf(i) > -1) {
if (i === 0 && j === startCol) { if (i === 0 && j === startCol) {
createOneEl(0, startCol); createOneEl(0, startCol);
} else if (j === startCol && i > 0) { } else if (j === startCol && i > 0) {

51
src/base/table/table.grid.js

@ -37,7 +37,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.topLeftGrid = BI.createWidget({ this.topLeftGrid = BI.createWidget({
type: "bi.grid_view", type: "bi.grid_view",
rowHeightGetter: rowHeightGetter, rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnLeftWidthGetter, columnWidthGetter: columnLeftWidthGetter
}); });
this.topLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { this.topLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomLeftGrid.setScrollLeft(scroll.scrollLeft); self.bottomLeftGrid.setScrollLeft(scroll.scrollLeft);
@ -47,7 +47,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.topRightGrid = BI.createWidget({ this.topRightGrid = BI.createWidget({
type: "bi.grid_view", type: "bi.grid_view",
rowHeightGetter: rowHeightGetter, rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnRightWidthGetter, columnWidthGetter: columnRightWidthGetter
}); });
this.topRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { this.topRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomRightGrid.setScrollLeft(scroll.scrollLeft); self.bottomRightGrid.setScrollLeft(scroll.scrollLeft);
@ -57,7 +57,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.bottomLeftGrid = BI.createWidget({ this.bottomLeftGrid = BI.createWidget({
type: "bi.grid_view", type: "bi.grid_view",
rowHeightGetter: rowHeightGetter, rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnLeftWidthGetter, columnWidthGetter: columnLeftWidthGetter
}); });
this.bottomLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { this.bottomLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomRightGrid.setScrollTop(scroll.scrollTop); self.bottomRightGrid.setScrollTop(scroll.scrollTop);
@ -68,7 +68,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.bottomRightGrid = BI.createWidget({ this.bottomRightGrid = BI.createWidget({
type: "bi.grid_view", type: "bi.grid_view",
rowHeightGetter: rowHeightGetter, rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnRightWidthGetter, columnWidthGetter: columnRightWidthGetter
}); });
this.bottomRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { this.bottomRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomLeftGrid.setScrollTop(scroll.scrollTop); self.bottomLeftGrid.setScrollTop(scroll.scrollTop);
@ -156,7 +156,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
el: this.leftScrollbar, el: this.leftScrollbar,
left: 0 left: 0
}, { }, {
el: this.rightScrollbar, el: this.rightScrollbar
}] }]
}); });
this._width = o.width - BI.GridTableScrollbar.SIZE; this._width = o.width - BI.GridTableScrollbar.SIZE;
@ -176,11 +176,26 @@ BI.GridTable = BI.inherit(BI.Widget, {
return this.options.isNeedFreeze ? this.options.freezeCols.length : 0; return this.options.isNeedFreeze ? this.options.freezeCols.length : 0;
}, },
_getFreezeHeaderHeight: function () {
var o = this.options;
if (o.header.length * o.headerRowSize >= this._height) {
return 0;
}
return o.header.length * o.headerRowSize;
},
_getActualItems: function () {
var o = this.options;
if (o.header.length * o.headerRowSize >= this._height) {
return o.header.concat(o.items);
}
return o.items;
},
_populateScrollbar: function () { _populateScrollbar: function () {
var o = this.options; var o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; summaryColumnSizeArray = [];
var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size; totalLeftColumnSize += size;
@ -194,8 +209,8 @@ BI.GridTable = BI.inherit(BI.Widget, {
summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size; summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size;
} }
}); });
this.topScrollbar.setContentSize(o.items.length * o.rowSize); this.topScrollbar.setContentSize(this._getActualItems().length * o.rowSize);
this.topScrollbar.setSize(this._height - o.header.length * o.headerRowSize); this.topScrollbar.setSize(this._height - this._getFreezeHeaderHeight());
this.topScrollbar.setPosition(Math.min(this.bottomLeftGrid.getScrollTop(), this.bottomRightGrid.getScrollTop())); this.topScrollbar.setPosition(Math.min(this.bottomLeftGrid.getScrollTop(), this.bottomRightGrid.getScrollTop()));
this.topScrollbar.populate(); this.topScrollbar.populate();
@ -210,7 +225,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.rightScrollbar.populate(); this.rightScrollbar.populate();
var items = this.scrollBarLayout.attr("items"); var items = this.scrollBarLayout.attr("items");
items[0].top = o.header.length * o.headerRowSize; items[0].top = this._getFreezeHeaderHeight();
items[1].top = this._height; items[1].top = this._height;
items[2].top = this._height; items[2].top = this._height;
items[2].left = regionSize; items[2].left = regionSize;
@ -244,7 +259,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
var o = this.options; var o = this.options;
var freezeColLength = this._getFreezeColLength(); var freezeColLength = this._getFreezeColLength();
var leftItems = [], rightItems = []; var leftItems = [], rightItems = [];
BI.each(o.items, function (i, cols) { BI.each(this._getActualItems(), function (i, cols) {
leftItems[i] = []; leftItems[i] = [];
rightItems[i] = []; rightItems[i] = [];
BI.each(cols, function (j, col) { BI.each(cols, function (j, col) {
@ -265,7 +280,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
_populateTable: function () { _populateTable: function () {
var self = this, o = this.options; var self = this, o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; summaryColumnSizeArray = [];
var freezeColLength = this._getFreezeColLength(); var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
@ -282,13 +297,13 @@ BI.GridTable = BI.inherit(BI.Widget, {
}); });
var otlw = regionSize; var otlw = regionSize;
var otlh = o.header.length * o.headerRowSize; var otlh = this._getFreezeHeaderHeight();
var otrw = this._width - regionSize; var otrw = this._width - regionSize;
var otrh = o.header.length * o.headerRowSize; var otrh = this._getFreezeHeaderHeight();
var oblw = regionSize; var oblw = regionSize;
var oblh = this._height - o.header.length * o.headerRowSize; var oblh = this._height - otlh;
var obrw = this._width - regionSize; var obrw = this._width - regionSize;
var obrh = this._height - o.header.length * o.headerRowSize; var obrh = this._height - otrh;
var tlw = otlw + this._scrollBarSize; var tlw = otlw + this._scrollBarSize;
var tlh = otlh + this._scrollBarSize; var tlh = otlh + this._scrollBarSize;
@ -341,9 +356,9 @@ BI.GridTable = BI.inherit(BI.Widget, {
var items = this.contextLayout.attr("items"); var items = this.contextLayout.attr("items");
items[1].left = regionSize; items[1].left = regionSize;
items[2].top = o.header.length * o.headerRowSize; items[2].top = this._getFreezeHeaderHeight();
items[3].left = regionSize; items[3].left = regionSize;
items[3].top = o.header.length * o.headerRowSize; items[3].top = this._getFreezeHeaderHeight();
this.contextLayout.attr("items", items); this.contextLayout.attr("items", items);
this.contextLayout.resize(); this.contextLayout.resize();

22
src/base/table/table.resizable.cell.js

@ -11,6 +11,9 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
return BI.extend(BI.ResizableTableCell.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.ResizableTableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-resizable-table-cell", baseCls: "bi-resizable-table-cell",
cell: {}, cell: {},
minSize: 15,
// suitableSize,
maxSize: Number.MAX_VALUE,
start: BI.emptyFn, start: BI.emptyFn,
resize: BI.emptyFn, resize: BI.emptyFn,
stop: BI.emptyFn stop: BI.emptyFn
@ -24,22 +27,37 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
var startDrag = false; var startDrag = false;
var size = 0, offset = 0, defaultSize = o.width; var size = 0, offset = 0, defaultSize = o.width;
function optimizeSize(s) {
var optSize = BI.clamp(s, o.minSize, o.maxSize || Number.MAX_VALUE);
if (o.suitableSize) {
if (Math.abs(o.suitableSize - optSize) < 5) {
optSize = o.suitableSize;
self.handler.element.addClass("suitable");
} else {
self.handler.element.removeClass("suitable");
}
}
return optSize;
}
var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX, deltaY) { var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX, deltaY) {
if (mouseMoveTracker.isDragging()) { if (mouseMoveTracker.isDragging()) {
startDrag = true; startDrag = true;
offset += deltaX; offset += deltaX;
size = BI.clamp(defaultSize + offset, 15, Number.MAX_VALUE); size = optimizeSize(defaultSize + offset);
self.handler.element.addClass("dragging"); self.handler.element.addClass("dragging");
o.resize(size); o.resize(size);
} }
}, function () { }, function () {
if (startDrag === true) { if (startDrag === true) {
size = BI.clamp(size, 15, Number.MAX_VALUE); size = optimizeSize(size);
o.stop(size); o.stop(size);
size = 0; size = 0;
offset = 0; offset = 0;
defaultSize = o.width; defaultSize = o.width;
self.handler.element.removeClass("dragging"); self.handler.element.removeClass("dragging");
self.handler.element.removeClass("suitable");
startDrag = false; startDrag = false;
} }
mouseMoveTracker.releaseMouseMoves(); mouseMoveTracker.releaseMouseMoves();

14
src/base/table/table.resizable.js

@ -22,6 +22,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
mergeCols: [], mergeCols: [],
mergeRule: BI.emptyFn, mergeRule: BI.emptyFn,
columnSize: [], columnSize: [],
minColumnSize: [],
maxColumnSize: [],
freezeCols: [], freezeCols: [],
header: [], header: [],
items: [], items: [],
@ -214,7 +216,13 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
self.resizer.setVisible(true); self.resizer.setVisible(true);
var height = o.headerRowSize + self._getRegionRowSize()[1]; var height = o.headerRowSize + self._getRegionRowSize()[1];
self.resizer.setHeight(height); self.resizer.setHeight(height);
if (o.minColumnSize[j]) {
if (size === o.minColumnSize[j]) {
self.resizer.element.addClass("suitable");
} else {
self.resizer.element.removeClass("suitable");
}
}
self._setResizerPosition(self._getResizerLeft(j) + size, (o.header.length - 1) * o.headerRowSize); self._setResizerPosition(self._getResizerLeft(j) + size, (o.header.length - 1) * o.headerRowSize);
}; };
var stop = function (j, size) { var stop = function (j, size) {
@ -237,6 +245,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
result[i][j] = { result[i][j] = {
type: "bi.resizable_table_cell", type: "bi.resizable_table_cell",
cell: col, cell: col,
suitableSize: o.minColumnSize[i],
maxSize: o.maxColumnSize[i],
resize: BI.bind(resize, null, j), resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j) stop: BI.bind(stop, null, j)
}; };
@ -246,6 +256,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
result[r - 1][j] = { result[r - 1][j] = {
type: "bi.resizable_table_cell", type: "bi.resizable_table_cell",
cell: result[r - 1][j], cell: result[r - 1][j],
suitableSize: o.minColumnSize[i],
maxSize: o.maxColumnSize[i],
resize: BI.bind(resize, null, j), resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j) stop: BI.bind(stop, null, j)
}; };

22
src/base/tree/asynctree.js

@ -105,7 +105,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
if (treeNode.checked === true) { if (treeNode.checked === true) {
} else { } else {
var tNode = treeNode; var tNode = treeNode;
var pNode = this._getTree(this.selectedValues, parentValues); var pNode = this._getTree(this.options.paras.selectedValues, parentValues);
if (BI.isNotNull(pNode[name])) { if (BI.isNotNull(pNode[name])) {
delete pNode[name]; delete pNode[name];
} }
@ -113,7 +113,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
parentValues = parentValues.slice(0, parentValues.length - 1); parentValues = parentValues.slice(0, parentValues.length - 1);
tNode = tNode.getParentNode(); tNode = tNode.getParentNode();
if (tNode != null) { if (tNode != null) {
pNode = this._getTree(this.selectedValues, parentValues); pNode = this._getTree(this.options.paras.selectedValues, parentValues);
name = this._getNodeValue(tNode); name = this._getNodeValue(tNode);
delete pNode[name]; delete pNode[name];
} }
@ -127,10 +127,10 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
var self = this, o = this.options; var self = this, o = this.options;
var parentValues = treeNode.parentValues || self._getParentValues(treeNode); var parentValues = treeNode.parentValues || self._getParentValues(treeNode);
var op = BI.extend({}, o.paras, { var op = BI.extend({}, o.paras, {
"id": treeNode.id, id: treeNode.id,
"times": 1, times: 1,
"parentValues": parentValues.concat(this._getNodeValue(treeNode)), parentValues: parentValues.concat(this._getNodeValue(treeNode)),
"checkState": treeNode.getCheckStatus() checkState: treeNode.getCheckStatus()
}); });
var complete = function (d) { var complete = function (d) {
var nodes = d.items || []; var nodes = d.items || [];
@ -178,7 +178,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
}, },
hasChecked: function () { hasChecked: function () {
return !BI.isEmpty(this.selectedValues) || BI.AsyncTree.superclass.hasChecked.apply(this, arguments); return !BI.isEmpty(this.options.paras.selectedValues) || BI.AsyncTree.superclass.hasChecked.apply(this, arguments);
}, },
getValue: function () { getValue: function () {
@ -187,20 +187,18 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
} }
var checkedValues = this._getSelectedValues(); var checkedValues = this._getSelectedValues();
if (BI.isEmpty(checkedValues)) { if (BI.isEmpty(checkedValues)) {
return BI.deepClone(this.selectedValues); return BI.deepClone(this.options.paras.selectedValues);
} }
if (BI.isEmpty(this.selectedValues)) { if (BI.isEmpty(this.options.paras.selectedValues)) {
return checkedValues; return checkedValues;
} }
return this._join(checkedValues, this.selectedValues); return this._join(checkedValues, this.options.paras.selectedValues);
}, },
//生成树方法 //生成树方法
stroke: function (config) { stroke: function (config) {
delete this.options.keyword; delete this.options.keyword;
BI.extend(this.options.paras, config); BI.extend(this.options.paras, config);
//取消选中时使用
this.selectedValues = BI.deepClone(this.options.paras.selectedValues) || {};
var setting = this._configSetting(); var setting = this._configSetting();
this._initTree(setting); this._initTree(setting);
} }

37
src/base/tree/parttree.js

@ -40,34 +40,28 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
_selectTreeNode: function (treeId, treeNode) { _selectTreeNode: function (treeId, treeNode) {
var self = this, o = this.options; var self = this, o = this.options;
var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode)); var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var name = this._getNodeValue(treeNode) var name = this._getNodeValue(treeNode);
// var values = parentValues.concat([name]);
if (treeNode.checked === true) { if (treeNode.checked === true) {
BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments); BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
} else { } else {
//如果选中的值中不存在该值不处理
var t = this.options.paras.selectedValues;
var p = parentValues.concat(name);
for (var i = 0, len = p.length; i < len; i++) {
t = t[p[i]];
if (t == null) {
return;
}
if (BI.isEmpty(t)) {
break;
}
}
o.itemsCreator(BI.extend({}, o.paras, { o.itemsCreator(BI.extend({}, o.paras, {
type: BI.TreeView.REQ_TYPE_SELECT_DATA, type: BI.TreeView.REQ_TYPE_SELECT_DATA,
selectedValues: this.selectedValues,
notSelectedValue: name, notSelectedValue: name,
parentValues: parentValues parentValues: parentValues
}), function (new_values) { }), function (new_values) {
if (BI.isEqual(self.selectedValues, new_values)) { self.options.paras.selectedValues = new_values;
var tNode = treeNode;
var pNode = self._getTree(new_values, parentValues);
if (pNode[name]) {
delete pNode[name];
}
while (tNode != null && BI.isEmpty(pNode)) {
parentValues = parentValues.slice(0, parentValues.length - 1);
tNode = tNode.getParentNode();
if (tNode != null) {
pNode = self._getTree(new_values, parentValues);
name = self._getNodeValue(tNode);
delete pNode[name];
}
}
}
self.selectedValues = new_values;
BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments); BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
}); });
} }
@ -164,9 +158,6 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
delete o.paras.keyword; delete o.paras.keyword;
BI.extend(o.paras, config); BI.extend(o.paras, config);
delete o.paras.lastSearchValue; delete o.paras.lastSearchValue;
//取消选中时使用
this.selectedValues = BI.deepClone(o.paras.selectedValues) || {};
//delete this.options.paras.selectedValues;
var setting = this._configSetting(); var setting = this._configSetting();
this._initTree(setting, o.paras.keyword); this._initTree(setting, o.paras.keyword);
} }

16
src/base/tree/treeview.js

@ -216,7 +216,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
_getNodeValue: function (node) { _getNodeValue: function (node) {
//去除标红 //去除标红
return node.value == null ? node.text.replace(/<[^>]+>/g, "") : node.value; return node.value == null ? node.text.replace(/<[^>]+>/g, "").replaceAll(" ", " ") : node.value;
}, },
//获取半选框值 //获取半选框值
@ -436,6 +436,16 @@ BI.TreeView = BI.inherit(BI.Pane, {
}, },
checkAll: function (checked) { checkAll: function (checked) {
function setNode(children) {
BI.each(children, function (i, child) {
child.halfCheck = false;
setNode(child.children);
});
}
BI.each(this.nodes.getNodes(), function (i, node) {
node.halfCheck = false;
setNode(node.children);
});
this.nodes && this.nodes.checkAllNodes(checked); this.nodes && this.nodes.checkAllNodes(checked);
}, },
@ -445,15 +455,13 @@ BI.TreeView = BI.inherit(BI.Pane, {
//设置树节点的状态 //设置树节点的状态
setValue: function (value, param) { setValue: function (value, param) {
this.setSelectedValue(value);
this.checkAll(false); this.checkAll(false);
this.updateValue(value, param); this.updateValue(value, param);
this.refresh(); this.refresh();
}, },
setSelectedValue: function (value) { setSelectedValue: function (value) {
this.options.paras.selectedValues = BI.deepClone(value) || {}; this.options.paras.selectedValues = BI.deepClone(value || {});
this.selectedValues = BI.deepClone(value) || {};
}, },
updateValue: function (values, param) { updateValue: function (values, param) {

4
src/case/clipboard/index.js

@ -25,9 +25,7 @@ BI.ClipBoard = BI.inherit(BI.BasicButton, {
return BI.isFunction(o.copy) ? o.copy() : o.copy; return BI.isFunction(o.copy) ? o.copy() : o.copy;
} }
}); });
this.clipboard.on("success", function (e) { this.clipboard.on("success", o.afterCopy)
o.afterCopy();
})
} else { } else {
this.element.zclip({ this.element.zclip({
path: BI.resourceURL + "/ZeroClipboard.swf", path: BI.resourceURL + "/ZeroClipboard.swf",

34
src/case/combo/bubblecombo/combo.bubble.js

@ -15,6 +15,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
toggle: true, toggle: true,
direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
isDefaultInit: false, isDefaultInit: false,
destroyWhenHide: false,
isNeedAdjustHeight: true,//是否需要高度调整 isNeedAdjustHeight: true,//是否需要高度调整
isNeedAdjustWidth: true, isNeedAdjustWidth: true,
stopPropagation: false, stopPropagation: false,
@ -37,6 +38,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
toggle: o.toggle, toggle: o.toggle,
direction: o.direction, direction: o.direction,
isDefaultInit: o.isDefaultInit, isDefaultInit: o.isDefaultInit,
destroyWhenHide: o.destroyWhenHide,
isNeedAdjustHeight: o.isNeedAdjustHeight, isNeedAdjustHeight: o.isNeedAdjustHeight,
isNeedAdjustWidth: o.isNeedAdjustWidth, isNeedAdjustWidth: o.isNeedAdjustWidth,
adjustLength: this._getAdjustLength(), adjustLength: this._getAdjustLength(),
@ -87,37 +89,40 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
_createTriangle: function (direction) { _createTriangle: function (direction) {
var pos = {}, op = {}; var pos = {}, op = {};
var adjustLength = this._getAdjustLength(); var adjustLength = this.options.adjustLength;
var offset = this.element.offset();
var left = offset.left, right = offset.left + this.element.outerWidth();
var top = offset.top, bottom = offset.top + this.element.outerHeight();
switch (direction) { switch (direction) {
case "left": case "left":
pos = { pos = {
top: 0, top: top,
bottom: 0, height: this.element.outerHeight(),
left: -adjustLength left: left - adjustLength - this._const.TRIANGLE_LENGTH
}; };
op = {width: this._const.TRIANGLE_LENGTH}; op = {width: this._const.TRIANGLE_LENGTH};
break; break;
case "right": case "right":
pos = { pos = {
top: 0, top: top,
bottom: 0, height: this.element.outerHeight(),
right: -adjustLength left: right + adjustLength
}; };
op = {width: this._const.TRIANGLE_LENGTH}; op = {width: this._const.TRIANGLE_LENGTH};
break; break;
case "top": case "top":
pos = { pos = {
left: 0, left: left,
right: 0, width: this.element.outerWidth(),
top: -adjustLength top: top - adjustLength - this._const.TRIANGLE_LENGTH
}; };
op = {height: this._const.TRIANGLE_LENGTH}; op = {height: this._const.TRIANGLE_LENGTH};
break; break;
case "bottom": case "bottom":
pos = { pos = {
left: 0, left: left,
right: 0, width: this.element.outerWidth(),
bottom: -adjustLength top: bottom + adjustLength
}; };
op = {height: this._const.TRIANGLE_LENGTH}; op = {height: this._const.TRIANGLE_LENGTH};
break; break;
@ -126,6 +131,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
} }
this.triangle = BI.createWidget(op, { this.triangle = BI.createWidget(op, {
type: "bi.center_adapt", type: "bi.center_adapt",
cls: "button-combo-triangle-wrapper",
items: [{ items: [{
type: "bi.layout", type: "bi.layout",
cls: "bubble-combo-triangle-" + direction + " bi-high-light-border" cls: "bubble-combo-triangle-" + direction + " bi-high-light-border"
@ -183,7 +189,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
_hideTriangle: function () { _hideTriangle: function () {
this.triangle && this.triangle.destroy(); this.triangle && this.triangle.destroy();
this.combo.getView().hideLine(); this.combo.getView() && this.combo.getView().hideLine();
}, },
hideView: function () { hideView: function () {

2
src/case/table/table.dynamicsummarylayertree.js

@ -160,7 +160,7 @@ BI.DynamicSummaryLayerTreeTable = BI.inherit(BI.Widget, {
_recomputeColumnSize: function () { _recomputeColumnSize: function () {
var o = this.options; var o = this.options;
o.regionColumnSize = this.table.getRegionColumnSize(); o.regionColumnSize = this.table.getRegionColumnSize();
var columnSize = this.table.getColumnSize(); var columnSize = this.table.getColumnSize().slice();
if (o.freezeCols.length > 1) { if (o.freezeCols.length > 1) {
for (var i = 0; i < o.freezeCols.length - 1; i++) { for (var i = 0; i < o.freezeCols.length - 1; i++) {
columnSize.splice(1, 0, 0); columnSize.splice(1, 0, 0);

104
src/component/treevaluechooser/abstract.treevaluechooser.js

@ -77,7 +77,7 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
return; return;
} }
BI.each(selected, function (k) { BI.each(selected, function (k) {
var node = self._getNode(parentValues, k); var node = self._getTreeNode(parentValues, k);
var newParents = BI.clone(parentValues); var newParents = BI.clone(parentValues);
newParents.push(node.value); newParents.push(node.value);
createOneJson(node, BI.last(parentValues), getCount(selected[k], newParents)); createOneJson(node, BI.last(parentValues), getCount(selected[k], newParents));
@ -109,7 +109,7 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
_reqSelectedTreeNode: function (op, callback) { _reqSelectedTreeNode: function (op, callback) {
var self = this; var self = this;
var selectedValues = op.selectedValues; var selectedValues = BI.deepClone(op.selectedValues);
var notSelectedValue = op.notSelectedValue || {}; var notSelectedValue = op.notSelectedValue || {};
var keyword = op.keyword || ""; var keyword = op.keyword || "";
var parentValues = op.parentValues || []; var parentValues = op.parentValues || [];
@ -124,12 +124,34 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
function dealWithSelectedValues(selectedValues) { function dealWithSelectedValues(selectedValues) {
var p = BI.clone(parentValues); var p = parentValues.concat(notSelectedValue);
p.push(notSelectedValue); //存储的值中存在这个值就把它删掉
if (canFindKey(selectedValues, p)) {
//如果搜索的值在父亲链中
if (isSearchValueInParent(p)) {
self._deleteNode(selectedValues, p);
} else {
var searched = [];
var finded = search(parentValues, notSelectedValue, [], searched);
if (finded && BI.isNotEmptyArray(searched)) {
BI.each(searched, function (i, arr) {
self._deleteNode(selectedValues, arr);
})
}
}
}
//存储的值中不存在这个值,但父亲节点是全选的情况
if (isChild(selectedValues, p)) { if (isChild(selectedValues, p)) {
var result = []; var result = [], finded = false;
var finded = search(parentValues.length + 1, parentValues, notSelectedValue, result); //如果parentValues中有匹配的值,说明搜索结果不在当前值下
if (isSearchValueInParent(p)) {
finded = true;
} else {
//从当前值开始搜
finded = search(parentValues, notSelectedValue, result);
p = parentValues;
}
if (finded === true) { if (finded === true) {
var next = selectedValues; var next = selectedValues;
@ -165,10 +187,11 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
} }
function search(deep, parents, current, result) { function search(parents, current, result, searched) {
var newParents = BI.clone(parents); var newParents = BI.clone(parents);
newParents.push(current); newParents.push(current);
if (self._isMatch(current, keyword)) { if (self._isMatch(current, keyword)) {
searched && searched.push(newParents);
return true; return true;
} }
@ -178,7 +201,7 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
var can = false; var can = false;
BI.each(children, function (i, child) { BI.each(children, function (i, child) {
if (search(deep + 1, newParents, child.value, result)) { if (search(newParents, child.value, result, searched)) {
can = true; can = true;
} else { } else {
notSearch.push(child.value); notSearch.push(child.value);
@ -194,6 +217,27 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
return can; return can;
} }
function isSearchValueInParent(parentValues) {
for (var i = 0, len = parentValues.length; i < len; i++) {
if (self._isMatch(parentValues[i], keyword)) {
return true;
}
}
return false;
}
function canFindKey(selectedValues, parents) {
var t = selectedValues;
for (var i = 0; i < parents.length; i++) {
var v = parents[i];
t = t[v];
if (t == null) {
return false;
}
}
return true;
}
function isChild(selectedValues, parents) { function isChild(selectedValues, parents) {
var t = selectedValues; var t = selectedValues;
for (var i = 0; i < parents.length; i++) { for (var i = 0; i < parents.length; i++) {
@ -202,11 +246,11 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
return false; return false;
} }
t = t[v]; t = t[v];
if (t == null || BI.isEmpty(t)) { if (BI.isEmpty(t)) {
return true; return true;
} }
} }
return true; return false;
} }
}, },
@ -330,7 +374,7 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
} }
function createOneJson(parentValues, value, isOpen, checked, half, flag, result) { function createOneJson(parentValues, value, isOpen, checked, half, flag, result) {
var node = self._getNode(parentValues, value) var node = self._getTreeNode(parentValues, value)
result.push({ result.push({
id: node.id, id: node.id,
pId: node.pId, pId: node.pId,
@ -407,11 +451,11 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
var times = op.times; var times = op.times;
var checkState = op.checkState || {}; var checkState = op.checkState || {};
var parentValues = op.parentValues || []; var parentValues = op.parentValues || [];
var selectedValues = op.selectedValues; var selectedValues = op.selectedValues || {};
var valueMap = {}; var valueMap = {};
if (judgeState(parentValues, selectedValues, checkState)) { // if (judgeState(parentValues, selectedValues, checkState)) {
valueMap = dealWidthSelectedValue(parentValues, selectedValues); valueMap = dealWidthSelectedValue(parentValues, selectedValues);
} // }
var nodes = this._getChildren(parentValues); var nodes = this._getChildren(parentValues);
for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) { for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) {
var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState); var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState);
@ -444,7 +488,7 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
function dealWidthSelectedValue(parentValues, selectedValues) { function dealWidthSelectedValue(parentValues, selectedValues) {
var valueMap = {}; var valueMap = {};
BI.each(parentValues, function (i, v) { BI.each(parentValues, function (i, v) {
selectedValues = selectedValues[v]; selectedValues = selectedValues[v] || {};
}); });
BI.each(selectedValues, function (value, obj) { BI.each(selectedValues, function (value, obj) {
if (BI.isNull(obj)) { if (BI.isNull(obj)) {
@ -492,6 +536,32 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
} }
}, },
_getNode: function (selectedValues, parentValues) {
var pNode = selectedValues;
for (var i = 0, len = parentValues.length; i < len; i++) {
if (pNode == null) {
return null;
}
pNode = pNode[parentValues[i]];
}
return pNode;
},
_deleteNode: function (selectedValues, values) {
var name = values[values.length - 1];
var p = values.slice(0, values.length - 1);
var pNode = this._getNode(selectedValues, p);
if (pNode[name]) {
delete pNode[name];
//递归删掉空父节点
while (p.length > 0 && BI.isEmpty(pNode)) {
name = p[p.length - 1];
p = p.slice(0, p.length - 1);
pNode = this._getNode(selectedValues, p);
delete pNode[name];
}
}
},
_buildTree: function (jo, values) { _buildTree: function (jo, values) {
var t = jo; var t = jo;
@ -508,7 +578,7 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
return finded.finded.length > 0 || finded.matched.length > 0; return finded.finded.length > 0 || finded.matched.length > 0;
}, },
_getNode: function (parentValues, v) { _getTreeNode: function (parentValues, v) {
var self = this; var self = this;
var findedParentNode; var findedParentNode;
var index = 0; var index = 0;
@ -535,7 +605,7 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
_getChildren: function (parentValues) { _getChildren: function (parentValues) {
if (parentValues.length > 0) { if (parentValues.length > 0) {
var value = BI.last(parentValues); var value = BI.last(parentValues);
var parent = this._getNode(parentValues.slice(0, parentValues.length - 1), value); var parent = this._getTreeNode(parentValues.slice(0, parentValues.length - 1), value);
} else { } else {
var parent = this.tree.getRoot(); var parent = this.tree.getRoot();
} }

4
src/component/treevaluechooser/pane.treevaluechooser.js

@ -33,6 +33,10 @@ BI.TreeValueChooserPane = BI.inherit(BI.AbstractTreeValueChooser, {
} }
}, },
setSelectedValue: function (v) {
this.pane.setSelectedValue(v);
},
setValue: function (v) { setValue: function (v) {
this.pane.setValue(v); this.pane.setValue(v);
}, },

9
src/core/model.js

@ -1,9 +1,13 @@
BI.Model = BI.inherit(BI.M, { BI.Model = BI.inherit(BI.M, {
props: {},
init: null,
destroyed: null,
_defaultConfig: function () { _defaultConfig: function () {
return { return BI.extend({
"default": "just a default", "default": "just a default",
"current": void 0 "current": void 0
} }, this.props)
}, },
_static: function () { _static: function () {
@ -37,6 +41,7 @@ BI.Model = BI.inherit(BI.M, {
this._read = BI.debounce(BI.bind(this.fetch, this), 30); this._read = BI.debounce(BI.bind(this.fetch, this), 30);
this._save = BI.debounce(BI.bind(this.save, this), 30); this._save = BI.debounce(BI.bind(this.save, this), 30);
this._F = []; this._F = [];
this.init && this.init();
}, },
toJSON: function () { toJSON: function () {

7
src/core/mvc/fbi.js

@ -300,12 +300,9 @@
return {} return {}
}, },
init: function () {
},
// _init is an empty function by default. Override it with your own // _init is an empty function by default. Override it with your own
// initialization logic. // initialization logic.
_init: function () { _init: function () {
this.init();
}, },
// Return a copy of the model's `attributes` object. // Return a copy of the model's `attributes` object.
@ -1153,9 +1150,9 @@
setVisible: function (visible) { setVisible: function (visible) {
this.options.invisible = !visible; this.options.invisible = !visible;
if (visible) { if (visible) {
this.element.show(); this.element.css("display", "");
} else { } else {
this.element.hide(); this.element.css("display", "none");
} }
}, },

6
src/core/ob.js

@ -15,6 +15,7 @@ BI.OB = function (config) {
$.extend(BI.OB.prototype, { $.extend(BI.OB.prototype, {
props: {}, props: {},
init: null, init: null,
destroyed: null,
_defaultConfig: function (config) { _defaultConfig: function (config) {
return {}; return {};
@ -134,5 +135,10 @@ $.extend(BI.OB.prototype, {
} }
} }
return true; return true;
},
destroy: function () {
this.destroyed && this.destroyed();
this.purgeListeners();
} }
}); });

19
src/core/view.js

@ -5,8 +5,16 @@
*/ */
BI.View = BI.inherit(BI.V, { BI.View = BI.inherit(BI.V, {
//生命周期函数
beforeCreate: null,
created: null,
destroyed: null,
_init: function () { _init: function () {
BI.View.superclass._init.apply(this, arguments); BI.View.superclass._init.apply(this, arguments);
this.beforeCreate && this.beforeCreate();
var self = this; var self = this;
this.listenTo(this.model, "change:current", function (obj, val) { this.listenTo(this.model, "change:current", function (obj, val) {
if (BI.isNotNull(val) && val.length > 0) { if (BI.isNotNull(val) && val.length > 0) {
@ -50,7 +58,8 @@ BI.View = BI.inherit(BI.V, {
return f.apply(this, arguments); return f.apply(this, arguments);
}, self); }, self);
} }
}) });
this.created && this.created();
}, },
change: function (changed, prev) { change: function (changed, prev) {
@ -495,7 +504,7 @@ BI.View = BI.inherit(BI.V, {
}); });
delete this._cardLayouts; delete this._cardLayouts;
delete this._cards; delete this._cards;
this.destroyed(); this.destroyed && this.destroyed();
this.off(); this.off();
}, },
@ -505,13 +514,9 @@ BI.View = BI.inherit(BI.V, {
}); });
delete this._cardLayouts; delete this._cardLayouts;
delete this._cards; delete this._cards;
this.destroyed(); this.destroyed && this.destroyed();
this.remove(); this.remove();
this.trigger(BI.Events.DESTROY); this.trigger(BI.Events.DESTROY);
this.off(); this.off();
},
destroyed: function () {
} }
}); });

18
src/core/widget.js

@ -198,7 +198,7 @@ BI.Widget = BI.inherit(BI.OB, {
} }
//递归将所有子组件使能 //递归将所有子组件使能
BI.each(this._children, function (i, child) { BI.each(this._children, function (i, child) {
child._setEnable && child._setEnable(enable); !child._manualSetEnable && child._setEnable && child._setEnable(enable);
}); });
}, },
@ -210,11 +210,20 @@ BI.Widget = BI.inherit(BI.OB, {
} }
//递归将所有子组件使有效 //递归将所有子组件使有效
BI.each(this._children, function (i, child) { BI.each(this._children, function (i, child) {
child._setValid && child._setValid(valid); !child._manualSetValid && child._setValid && child._setValid(valid);
}); });
}, },
_setVisible: function (visible) {
if (visible === true) {
this.options.invisible = false;
} else if (visible === false) {
this.options.invisible = true;
}
},
setEnable: function (enable) { setEnable: function (enable) {
this._manualSetEnable = true;
this._setEnable(enable); this._setEnable(enable);
if (enable === true) { if (enable === true) {
this.element.removeClass("base-disabled disabled"); this.element.removeClass("base-disabled disabled");
@ -224,20 +233,19 @@ BI.Widget = BI.inherit(BI.OB, {
}, },
setVisible: function (visible) { setVisible: function (visible) {
this._setVisible(visible);
if (visible === true) { if (visible === true) {
this.options.invisible = false;
//用this.element.show()会把display属性改成block //用this.element.show()会把display属性改成block
this.element.css("display", ""); this.element.css("display", "");
this._mount(); this._mount();
} else if (visible === false) { } else if (visible === false) {
this.options.invisible = true;
this.element.css("display", "none"); this.element.css("display", "none");
} }
this.fireEvent(BI.Events.VIEW, visible); this.fireEvent(BI.Events.VIEW, visible);
}, },
setValid: function (valid) { setValid: function (valid) {
this.options.invalid = !valid; this._manualSetValid = true;
this._setValid(valid); this._setValid(valid);
if (valid === true) { if (valid === true) {
this.element.removeClass("base-invalid invalid"); this.element.removeClass("base-invalid invalid");

7
src/css/base/combo/combo.bubble.css

@ -1,7 +1,11 @@
/****添加计算宽度的--运算符直接需要space****/ /****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/ /****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/ /**** custom color(自定义颜色,用于特定场景) ****/
.bi-bubble-combo .button-combo-triangle-wrapper {
position: fixed !important;
}
.bi-bubble-combo .bubble-combo-triangle-left { .bi-bubble-combo .bubble-combo-triangle-left {
z-index: 1;
width: 0; width: 0;
height: 0; height: 0;
border-top: 6px solid transparent; border-top: 6px solid transparent;
@ -9,6 +13,7 @@
border-bottom: 6px solid transparent; border-bottom: 6px solid transparent;
} }
.bi-bubble-combo .bubble-combo-triangle-right { .bi-bubble-combo .bubble-combo-triangle-right {
z-index: 1;
width: 0; width: 0;
height: 0; height: 0;
border-top: 6px solid transparent; border-top: 6px solid transparent;
@ -16,6 +21,7 @@
border-bottom: 6px solid transparent; border-bottom: 6px solid transparent;
} }
.bi-bubble-combo .bubble-combo-triangle-top { .bi-bubble-combo .bubble-combo-triangle-top {
z-index: 1;
width: 0; width: 0;
height: 0; height: 0;
border-left: 6px solid transparent; border-left: 6px solid transparent;
@ -23,6 +29,7 @@
border-top: 6px solid #3f8ce8; border-top: 6px solid #3f8ce8;
} }
.bi-bubble-combo .bubble-combo-triangle-bottom { .bi-bubble-combo .bubble-combo-triangle-bottom {
z-index: 1;
width: 0; width: 0;
height: 0; height: 0;
border-left: 6px solid transparent; border-left: 6px solid transparent;

3
src/css/base/table/table.resizable.cell.css

@ -9,3 +9,6 @@
.bi-resizable-table-cell .resizable-table-cell-resizer-container.dragging .resizable-table-cell-resizer-knob { .bi-resizable-table-cell .resizable-table-cell-resizer-container.dragging .resizable-table-cell-resizer-knob {
background-color: #3f8ce8; background-color: #3f8ce8;
} }
.bi-resizable-table-cell .resizable-table-cell-resizer-container.suitable .resizable-table-cell-resizer-knob {
background-color: #58cc7d;
}

3
src/css/base/table/table.resizable.css

@ -6,6 +6,9 @@
z-index: 1; z-index: 1;
background-color: #3f8ce8; background-color: #3f8ce8;
} }
.bi-resizable-table .resizable-table-resizer.suitable {
background-color: #58cc7d;
}
.bi-resizable-table .resizable-table-region-resizer { .bi-resizable-table .resizable-table-region-resizer {
cursor: ew-resize; cursor: ew-resize;
z-index: 1; z-index: 1;

13
src/css/resource/app.css

@ -1,19 +1,6 @@
/****添加计算宽度的--运算符直接需要space****/ /****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/ /****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/ /**** custom color(自定义颜色,用于特定场景) ****/
@font-face {
font-family: 'bi';
src: url('font/iconfont.eot'), /* IE6-IE8 */ url('font/iconfont.woff') format('woff'), /* chrome、firefox */ url('font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('font/iconfont.svg#svgFontName') format('svg');
/* iOS 4.1- */
}
.b-font {
font-family: "bi";
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
html, html,
button, button,
input, input,

13
src/css/resource/font.css

@ -1,5 +1,18 @@
/****** common color(常用颜色,可用于普遍场景) *****/ /****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/ /**** custom color(自定义颜色,用于特定场景) ****/
@font-face {
font-family: 'bi';
src: url('font/iconfont.eot'), /* IE6-IE8 */ url('font/iconfont.woff') format('woff'), /* chrome、firefox */ url('font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('font/iconfont.svg#svgFontName') format('svg');
/* iOS 4.1- */
}
.b-font {
font-family: "bi";
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
.close-font .b-font { .close-font .b-font {
*zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = '&#xe600'); *zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = '&#xe600');
} }

7
src/less/base/combo/combo.bubble.less

@ -1,16 +1,23 @@
@import "../../bibase"; @import "../../bibase";
.bi-bubble-combo { .bi-bubble-combo {
& .button-combo-triangle-wrapper {
position: fixed !important;
}
& .bubble-combo-triangle-left { & .bubble-combo-triangle-left {
z-index: 1;
.solid-triangle-right(@color-bi-background-highlight); .solid-triangle-right(@color-bi-background-highlight);
} }
& .bubble-combo-triangle-right { & .bubble-combo-triangle-right {
z-index: 1;
.solid-triangle-left(@color-bi-background-highlight); .solid-triangle-left(@color-bi-background-highlight);
} }
& .bubble-combo-triangle-top { & .bubble-combo-triangle-top {
z-index: 1;
.solid-triangle-down(@color-bi-background-highlight); .solid-triangle-down(@color-bi-background-highlight);
} }
& .bubble-combo-triangle-bottom { & .bubble-combo-triangle-bottom {
z-index: 1;
.solid-triangle-up(@color-bi-background-highlight); .solid-triangle-up(@color-bi-background-highlight);
} }
} }

5
src/less/base/table/table.resizable.cell.less

@ -9,5 +9,10 @@
background-color: @color-bi-background-highlight; background-color: @color-bi-background-highlight;
} }
} }
&.suitable{
& .resizable-table-cell-resizer-knob {
background-color: @color-bi-background-success;
}
}
} }
} }

3
src/less/base/table/table.resizable.less

@ -5,6 +5,9 @@
cursor: ew-resize; cursor: ew-resize;
z-index: 1; z-index: 1;
background-color: @color-bi-background-highlight; background-color: @color-bi-background-highlight;
&.suitable {
background-color: @color-bi-background-success;
}
} }
& .resizable-table-region-resizer { & .resizable-table-region-resizer {
cursor: ew-resize; cursor: ew-resize;

7
src/less/lib/constant.less

@ -26,10 +26,9 @@
@font-color-white: #ffffff;// @font-color-white: #ffffff;//
@font-color-highlight: #3f8ce8; @font-color-highlight: #3f8ce8;
@font-color-success: #0c6d23; @font-color-success: #0c6d23;
@font-color-warning: #e85050; @font-color-warning: #e85050;//
@font-color-light-gray: #7f7f7f; @font-color-redmark: #f07d0a;//
@font-color-redmark: #f07d0a; @font-color-orange: #fbb03b;//
@font-color-orange: #fcc550;
//background color //background color
@background-color-black: #1a1a1a;// @background-color-black: #1a1a1a;//

13
src/less/resource/app.less

@ -1,18 +1,5 @@
@import "../bibase"; @import "../bibase";
@font-face {
font-family: 'bi';
src: url('@{webUrl}font/iconfont.eot'), /* IE6-IE8 */ url('@{webUrl}font/iconfont.woff') format('woff'), /* chrome、firefox */ url('@{webUrl}font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('@{webUrl}font/iconfont.svg#svgFontName') format('svg'); /* iOS 4.1- */
}
.b-font {
font-family: "bi";
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
html, html,
button, button,
input, input,

13
src/less/resource/font.less

@ -2,6 +2,19 @@
@import "../lib/colors"; @import "../lib/colors";
@import "../image"; @import "../image";
@font-face {
font-family: 'bi';
src: url('@{webUrl}font/iconfont.eot'), /* IE6-IE8 */ url('@{webUrl}font/iconfont.woff') format('woff'), /* chrome、firefox */ url('@{webUrl}font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('@{webUrl}font/iconfont.svg#svgFontName') format('svg'); /* iOS 4.1- */
}
.b-font {
font-family: "bi";
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
.font(close-font, @font-cross); .font(close-font, @font-cross);
.font-hover(close-h-font, @font-cross); .font-hover(close-h-font, @font-cross);
.font-hover-active(close-ha-font, @font-cross); .font-hover-active(close-ha-font, @font-cross);

4
src/widget/arrangement/arrangement.js

@ -2752,7 +2752,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
case BI.Arrangement.LAYOUT_TYPE.ADAPTIVE: case BI.Arrangement.LAYOUT_TYPE.ADAPTIVE:
if (this._isArrangeFine()) { if (this._isArrangeFine()) {
var width = this.getClientWidth(), height = this.getClientHeight(); var width = this.getClientWidth(), height = this.getClientHeight();
var isHeightAdjust = height > occupied.top + occupied.height; var isHeightAdjust = height > occupied.height;
var regions = this._cloneRegion(); var regions = this._cloneRegion();
BI.each(regions, function (i, region) { BI.each(regions, function (i, region) {
region.width = region.width / occupied.width * width; region.width = region.width / occupied.width * width;
@ -2934,7 +2934,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
BI.Arrangement.EVENT_SCROLL = "EVENT_SCROLL"; BI.Arrangement.EVENT_SCROLL = "EVENT_SCROLL";
BI.extend(BI.Arrangement, { BI.extend(BI.Arrangement, {
PORTION: 24, PORTION: 24,
GRID_HEIGHT: 50, GRID_HEIGHT: 60,
LAYOUT_TYPE: { LAYOUT_TYPE: {
ADAPTIVE: 0, ADAPTIVE: 0,
FREE: 1, FREE: 1,

4
src/widget/downlist/combo.downlist.js

@ -56,6 +56,10 @@ BI.DownListCombo = BI.inherit(BI.Widget, {
}); });
}, },
hideView: function () {
this.downlistcombo.hideView();
},
populate: function (items) { populate: function (items) {
this.popupview.populate(items); this.popupview.populate(items);
}, },

26
src/widget/downlist/item.downlistgroup.js

@ -6,7 +6,7 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
logic: { logic: {
dynamic: false dynamic: false
}, },
invalid: true, // invalid: true,
iconCls1: "dot-e-font", iconCls1: "dot-e-font",
iconCls2: "pull-right-e-font" iconCls2: "pull-right-e-font"
}) })
@ -22,26 +22,26 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
text: o.text, text: o.text,
value: o.value, value: o.value,
height: o.height height: o.height
}) });
this.icon1 = BI.createWidget({ this.icon1 = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
cls: o.iconCls1, cls: o.iconCls1,
width: 25, width: 25,
forceNotSelected: true forceNotSelected: true
}) });
this.icon2 = BI.createWidget({ this.icon2 = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
cls: o.iconCls2, cls: o.iconCls2,
width: 25, width: 25,
forceNotSelected: true forceNotSelected: true
}) });
var blank = BI.createWidget({ var blank = BI.createWidget({
type: "bi.layout", type: "bi.layout",
width: 25 width: 25
}) });
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
@ -51,7 +51,7 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
bottom: 0, bottom: 0,
right: 0 right: 0
}] }]
}) });
BI.createWidget(BI.extend({ BI.createWidget(BI.extend({
element: this element: this
@ -59,19 +59,11 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
items: BI.LogicFactory.createLogicItemsByDirection("left", this.icon1, this.text, blank) items: BI.LogicFactory.createLogicItemsByDirection("left", this.icon1, this.text, blank)
})))); }))));
this.element.on("mouseenter." + this.getName(), function (e) { this.element.hover(function () {
if (self.element.__isMouseInBounds__(e) && self.isEnabled()) { if (self.isEnabled()) {
self.hover(); self.hover();
} else {
self.dishover();
} }
}); }, function () {
this.element.on("mousemove." + this.getName(), function (e) {
if (!self.element.__isMouseInBounds__(e) && self.isEnabled()) {
self.dishover()
}
});
this.element.on("mouseleave." + this.getName(), function () {
if (self.isEnabled()) { if (self.isEnabled()) {
self.dishover() self.dishover()
} }

42
src/widget/multiselecttree/multiselecttree.js

@ -19,34 +19,36 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
itemsCreator: o.itemsCreator itemsCreator: o.itemsCreator
}); });
this.adapter.on(BI.MultiSelectTreePopup.EVENT_CHANGE, function () { this.adapter.on(BI.MultiSelectTreePopup.EVENT_CHANGE, function () {
if (self.trigger.isSearching()) { if (self.searcher.isSearching()) {
self.storeValue = {value: self.searcherPane.getValue()}; self.storeValue = {value: self.searcherPane.getValue()};
} else { } else {
self.storeValue = {value: self.adapter.getValue()}; self.storeValue = {value: self.adapter.getValue()};
} }
self.setSelectedValue(self.storeValue.value);
self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE); self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE);
}); });
this.searcherPane = BI.createWidget({//搜索中的时候用的是parttree,同adapter中的synctree不一样 //搜索中的时候用的是parttree,同adapter中的synctree不一样
this.searcherPane = BI.createWidget({
type: "bi.multi_tree_search_pane", type: "bi.multi_tree_search_pane",
cls: "bi-border-left bi-border-right bi-border-bottom", cls: "bi-border-left bi-border-right bi-border-bottom",
keywordGetter: function () { keywordGetter: function () {
return self.trigger.getKeyword(); return self.searcher.getKeyword();
}, },
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
op.keyword = self.trigger.getKeyword(); op.keyword = self.searcher.getKeyword();
o.itemsCreator(op, callback); o.itemsCreator(op, callback);
} }
}); });
this.searcherPane.setVisible(false); this.searcherPane.setVisible(false);
this.trigger = BI.createWidget({ this.searcher = BI.createWidget({
type: "bi.searcher", type: "bi.searcher",
isAutoSearch: false, isAutoSearch: false,
isAutoSync: false, isAutoSync: false,
onSearch: function (op, callback) { onSearch: function (op, callback) {
callback({ callback({
keyword: self.trigger.getKeyword() keyword: self.searcher.getKeyword()
}); });
}, },
adapter: this.adapter, adapter: this.adapter,
@ -56,15 +58,15 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
eventName: BI.Searcher.EVENT_START, eventName: BI.Searcher.EVENT_START,
action: function () { action: function () {
self._showSearcherPane(); self._showSearcherPane();
self.storeValue = {value: self.adapter.getValue()}; // self.storeValue = {value: self.adapter.getValue()};
self.searcherPane.setValue(self.storeValue); // self.searcherPane.setSelectedValue(self.storeValue.value);
} }
}, { }, {
eventName: BI.Searcher.EVENT_STOP, eventName: BI.Searcher.EVENT_STOP,
action: function () { action: function () {
self._showAdapter(); self._showAdapter();
// self.storeValue = {value: self.searcherPane.getValue()}; // self.storeValue = {value: self.searcherPane.getValue()};
self.adapter.setValue(self.storeValue); // self.adapter.setSelectedValue(self.storeValue.value);
BI.nextTick(function () { BI.nextTick(function () {
self.adapter.populate(); self.adapter.populate();
}); });
@ -72,11 +74,12 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
}, { }, {
eventName: BI.Searcher.EVENT_CHANGE, eventName: BI.Searcher.EVENT_CHANGE,
action: function () { action: function () {
if (self.trigger.isSearching()) { if (self.searcher.isSearching()) {
self.storeValue = {value: self.searcherPane.getValue()}; self.storeValue = {value: self.searcherPane.getValue()};
} else { } else {
self.storeValue = {value: self.adapter.getValue()}; self.storeValue = {value: self.adapter.getValue()};
} }
self.setSelectedValue(self.storeValue.value);
self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE); self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE);
} }
}, { }, {
@ -91,7 +94,7 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
type: "bi.vtape", type: "bi.vtape",
element: this, element: this,
items: [{ items: [{
el: this.trigger, el: this.searcher,
height: 30 height: 30
}, { }, {
el: this.adapter, el: this.adapter,
@ -126,18 +129,21 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setSelectedValue: function (v) {
this.storeValue.value = v || {}; this.storeValue.value = v || {};
this.adapter.setValue({ this.adapter.setSelectedValue(v);
value: v || {} this.searcherPane.setSelectedValue(v);
}); this.searcher.setValue({
this.trigger.setValue({
value: v || {} value: v || {}
}); });
}, },
setValue: function (v) {
this.adapter.setValue(v);
},
stopSearch: function () { stopSearch: function () {
this.trigger.stopSearch(); this.searcher.stopSearch();
}, },
updateValue: function (v) { updateValue: function (v) {
@ -149,7 +155,7 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
}, },
populate: function () { populate: function () {
this.trigger.populate.apply(this.trigger, arguments); this.searcher.populate.apply(this.searcher, arguments);
this.adapter.populate.apply(this.adapter, arguments); this.adapter.populate.apply(this.adapter, arguments);
} }
}); });

7
src/widget/multiselecttree/multiselecttree.popup.js

@ -34,7 +34,12 @@ BI.MultiSelectTreePopup = BI.inherit(BI.Widget, {
setValue: function (v) { setValue: function (v) {
v || (v = {}); v || (v = {});
this.popup.setValue(v.value); this.popup.setValue(v);
},
setSelectedValue: function (v) {
v || (v = {});
this.popup.setSelectedValue(v);
}, },
updateValue: function (v) { updateValue: function (v) {

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

@ -88,7 +88,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
}, { }, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM, eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,
action: function () { action: function () {
self._defaultState(); self.combo.hideView();
} }
}, { }, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR, eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR,

6
src/widget/multitree/multi.tree.search.pane.js

@ -44,8 +44,12 @@ BI.MultiTreeSearchPane = BI.inherit(BI.Pane, {
}, },
setValue: function (v) { setValue: function (v) {
this.setSelectedValue(v.value);
},
setSelectedValue: function (v) {
v || (v = {}); v || (v = {});
this.partTree.setSelectedValue(v.value); this.partTree.setSelectedValue(v);
}, },
getValue: function () { getValue: function () {

Loading…
Cancel
Save