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. 321
      bi/base.js
  3. 40
      bi/case.js
  4. 59
      bi/core.js
  5. 207
      bi/widget.js
  6. 13
      docs/base.css
  7. 321
      docs/base.js
  8. 40
      docs/case.js
  9. 59
      docs/core.js
  10. 26
      docs/resource.css
  11. 207
      docs/widget.js
  12. 30
      src/base/combination/combo.js
  13. 27
      src/base/combination/expander.js
  14. 9
      src/base/combination/switcher.js
  15. 15
      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. 4
      src/base/single/input/file.js
  19. 2
      src/base/single/tip/tip.bubble.js
  20. 2
      src/base/table/table.collection.cell.js
  21. 66
      src/base/table/table.collection.js
  22. 51
      src/base/table/table.grid.js
  23. 22
      src/base/table/table.resizable.cell.js
  24. 14
      src/base/table/table.resizable.js
  25. 22
      src/base/tree/asynctree.js
  26. 37
      src/base/tree/parttree.js
  27. 16
      src/base/tree/treeview.js
  28. 4
      src/case/clipboard/index.js
  29. 34
      src/case/combo/bubblecombo/combo.bubble.js
  30. 2
      src/case/table/table.dynamicsummarylayertree.js
  31. 106
      src/component/treevaluechooser/abstract.treevaluechooser.js
  32. 4
      src/component/treevaluechooser/pane.treevaluechooser.js
  33. 9
      src/core/model.js
  34. 7
      src/core/mvc/fbi.js
  35. 6
      src/core/ob.js
  36. 19
      src/core/view.js
  37. 18
      src/core/widget.js
  38. 7
      src/css/base/combo/combo.bubble.css
  39. 3
      src/css/base/table/table.resizable.cell.css
  40. 3
      src/css/base/table/table.resizable.css
  41. 13
      src/css/resource/app.css
  42. 13
      src/css/resource/font.css
  43. 7
      src/less/base/combo/combo.bubble.less
  44. 5
      src/less/base/table/table.resizable.cell.less
  45. 5
      src/less/base/table/table.resizable.less
  46. 7
      src/less/lib/constant.less
  47. 13
      src/less/resource/app.less
  48. 13
      src/less/resource/font.less
  49. 4
      src/widget/arrangement/arrangement.js
  50. 4
      src/widget/downlist/combo.downlist.js
  51. 32
      src/widget/downlist/item.downlistgroup.js
  52. 42
      src/widget/multiselecttree/multiselecttree.js
  53. 7
      src/widget/multiselecttree/multiselecttree.popup.js
  54. 2
      src/widget/multitree/multi.tree.combo.js
  55. 6
      src/widget/multitree/multi.tree.search.pane.js

13
bi/base.css

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

321
bi/base.js

@ -710,7 +710,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
$(document).bind("mouseup." + self.getName(), function (e) {
// if (e.button === 0) {
if (BI.DOM.isExist(self) && !hand.__isMouseInBounds__(e) && mouseDown === true && !selected) {
self.setSelected(!self.isSelected());
// self.setSelected(!self.isSelected());
self._trigger();
}
mouseDown = false;
@ -1717,7 +1717,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
_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) {
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);
},
@ -1946,15 +1956,13 @@ BI.TreeView = BI.inherit(BI.Pane, {
//设置树节点的状态
setValue: function (value, param) {
this.setSelectedValue(value);
this.checkAll(false);
this.updateValue(value, param);
this.refresh();
},
setSelectedValue: function (value) {
this.options.paras.selectedValues = BI.deepClone(value) || {};
this.selectedValues = BI.deepClone(value) || {};
this.options.paras.selectedValues = BI.deepClone(value || {});
},
updateValue: function (values, param) {
@ -2106,7 +2114,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
if (treeNode.checked === true) {
} else {
var tNode = treeNode;
var pNode = this._getTree(this.selectedValues, parentValues);
var pNode = this._getTree(this.options.paras.selectedValues, parentValues);
if (BI.isNotNull(pNode[name])) {
delete pNode[name];
}
@ -2114,7 +2122,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
parentValues = parentValues.slice(0, parentValues.length - 1);
tNode = tNode.getParentNode();
if (tNode != null) {
pNode = this._getTree(this.selectedValues, parentValues);
pNode = this._getTree(this.options.paras.selectedValues, parentValues);
name = this._getNodeValue(tNode);
delete pNode[name];
}
@ -2128,10 +2136,10 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
var self = this, o = this.options;
var parentValues = treeNode.parentValues || self._getParentValues(treeNode);
var op = BI.extend({}, o.paras, {
"id": treeNode.id,
"times": 1,
"parentValues": parentValues.concat(this._getNodeValue(treeNode)),
"checkState": treeNode.getCheckStatus()
id: treeNode.id,
times: 1,
parentValues: parentValues.concat(this._getNodeValue(treeNode)),
checkState: treeNode.getCheckStatus()
});
var complete = function (d) {
var nodes = d.items || [];
@ -2179,7 +2187,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
},
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 () {
@ -2188,20 +2196,18 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
}
var checkedValues = this._getSelectedValues();
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 this._join(checkedValues, this.selectedValues);
return this._join(checkedValues, this.options.paras.selectedValues);
},
//生成树方法
stroke: function (config) {
delete this.options.keyword;
BI.extend(this.options.paras, config);
//取消选中时使用
this.selectedValues = BI.deepClone(this.options.paras.selectedValues) || {};
var setting = this._configSetting();
this._initTree(setting);
}
@ -2249,34 +2255,28 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
_selectTreeNode: function (treeId, treeNode) {
var self = this, o = this.options;
var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var name = this._getNodeValue(treeNode)
// var values = parentValues.concat([name]);
var name = this._getNodeValue(treeNode);
if (treeNode.checked === true) {
BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
} 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, {
type: BI.TreeView.REQ_TYPE_SELECT_DATA,
selectedValues: this.selectedValues,
notSelectedValue: name,
parentValues: parentValues
}), function (new_values) {
if (BI.isEqual(self.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;
self.options.paras.selectedValues = new_values;
BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
});
}
@ -2373,9 +2373,6 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
delete o.paras.keyword;
BI.extend(o.paras, config);
delete o.paras.lastSearchValue;
//取消选中时使用
this.selectedValues = BI.deepClone(o.paras.selectedValues) || {};
//delete this.options.paras.selectedValues;
var setting = this._configSetting();
this._initTree(setting, o.paras.keyword);
}
@ -2903,6 +2900,7 @@ BI.Combo = BI.inherit(BI.Widget, {
toggle: true,
direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
isDefaultInit: false,
destroyWhenHide: false,
isNeedAdjustHeight: true,//是否需要高度调整
isNeedAdjustWidth: true,
stopEvent: false,
@ -2925,17 +2923,21 @@ BI.Combo = BI.inherit(BI.Widget, {
this._initCombo();
this._initPullDownAction();
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) {
self._popupView();
}
if (type === BI.Events.COLLAPSE) {
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.isViewVisible() && self.fireEvent(BI.Combo.EVENT_COLLAPSE);
}
if (type === BI.Events.CLICK) {
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) {
if (self.isEnabled() && self.combo.isEnabled()) {
if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
self.element.addClass(o.hoverClass);
}
});
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);
}
});
@ -2995,14 +2997,14 @@ BI.Combo = BI.inherit(BI.Widget, {
switch (ev) {
case "hover":
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.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo);
self.fireEvent(BI.Combo.EVENT_EXPAND);
}
});
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.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.combo);
self.fireEvent(BI.Combo.EVENT_COLLAPSE);
@ -3012,7 +3014,7 @@ BI.Combo = BI.inherit(BI.Widget, {
case "click":
var debounce = BI.debounce(function (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();
if (self.isViewVisible()) {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo);
@ -3088,7 +3090,13 @@ BI.Combo = BI.inherit(BI.Widget, {
_hideView: function () {
this.fireEvent(BI.Combo.EVENT_BEFORE_HIDEVIEW);
this.popupView && this.popupView.invisible();
if (this.options.destroyWhenHide === true) {
this.popupView && this.popupView.destroy();
this.popupView = null;
this._rendered = false;
} else {
this.popupView && this.popupView.invisible();
}
this.element.removeClass(this.options.comboClass);
$(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName());
@ -3219,6 +3227,7 @@ BI.Combo = BI.inherit(BI.Widget, {
_setEnable: function (arg) {
BI.Combo.superclass._setEnable.apply(this, arguments);
!arg && this.element.removeClass(this.options.hoverClass);
!arg && this.isViewVisible() && this._hideView();
},
@ -3316,20 +3325,20 @@ BI.Expander = BI.inherit(BI.Widget, {
this._initExpander();
this._initPullDownAction();
this.expander.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (type === BI.Events.EXPAND) {
self._popupView();
}
if (type === BI.Events.COLLAPSE) {
self._hideView();
}
if (self.isEnabled() && this.isEnabled()) {
if (self.isEnabled() && self.isValid()) {
if (type === BI.Events.EXPAND) {
self._popupView();
}
if (type === BI.Events.COLLAPSE) {
self._hideView();
}
if (type === BI.Events.EXPAND) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.fireEvent(BI.Expander.EVENT_EXPAND);
}
if (type === BI.Events.COLLAPSE) {
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) {
self.fireEvent(BI.Expander.EVENT_TRIGGER_CHANGE, value, obj);
@ -3338,11 +3347,11 @@ BI.Expander = BI.inherit(BI.Widget, {
});
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);
}
}, function () {
if (self.isEnabled() && self.expander.isEnabled()) {
if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid()) {
self.element.removeClass(o.hoverClass);
}
});
@ -3378,13 +3387,13 @@ BI.Expander = BI.inherit(BI.Widget, {
switch (e) {
case "hover":
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.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, '', self.expander);
self.fireEvent(BI.Expander.EVENT_EXPAND);
}
}, 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.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, '', self.expander);
self.fireEvent(BI.Expander.EVENT_COLLAPSE);
@ -3395,7 +3404,7 @@ BI.Expander = BI.inherit(BI.Widget, {
if (e) {
self.element.off(e + "." + self.getName()).on(e + "." + self.getName(), BI.debounce(function (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();
if (self.isExpanded()) {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.expander);
@ -3486,6 +3495,7 @@ BI.Expander = BI.inherit(BI.Widget, {
_setEnable: function (arg) {
BI.Expander.superclass._setEnable.apply(this, arguments);
!arg && this.element.removeClass(this.options.hoverClass);
!arg && this.isViewVisible() && this._hideView();
},
@ -4483,15 +4493,20 @@ BI.Switcher = BI.inherit(BI.Widget, {
this._initSwitcher();
this._initPullDownAction();
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) {
self._popupView();
}
if (type === BI.Events.COLLAPSE) {
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.isViewVisible() && self.fireEvent(BI.Switcher.EVENT_COLLAPSE);
}
if (type === BI.Events.CLICK) {
self.fireEvent(BI.Switcher.EVENT_TRIGGER_CHANGE, value, obj);
@ -15109,15 +15124,16 @@ BI.FloatBox = BI.inherit(BI.Widget, {
populate: function (sectionProvider) {
var self = this;
if (this.currentSectionProvider && this.currentSectionProvider !== sectionProvider) {
this.currentSectionProvider.destroy();
}
this.currentSectionProvider = sectionProvider;
sectionProvider.rebuildNorth(this._north);
sectionProvider.rebuildCenter(this._center);
sectionProvider.rebuildSouth(this._south);
if (sectionProvider instanceof BI.Widget) {
sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () {
self.close();
})
}
sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () {
self.close();
})
},
show: function () {
@ -15140,6 +15156,10 @@ BI.FloatBox = BI.inherit(BI.Widget, {
setZindex: function (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, {
baseCls: (conf.baseCls || "") + " bi-multifile-editor",
multiple: false,
maxSize: 1024 * 1024,
maxSize: -1,//1024 * 1024
accept: "",
url: ""
})
@ -18937,7 +18957,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
url: "",
multiple: true,
accept: "", /**'*.jpg; *.zip'**/
maxSize: 1024 * 1024
maxSize: -1 //1024 * 1024
})
},
@ -19013,7 +19033,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
}, 1000);
};
_wrap.url = o.url ? o.url : BI.servletURL
+ '?op=fr_attach&cmd=ah_upload';
+ '?op=fr_attach&cmd=ah_upload';
_wrap.fileType = o.accept; //文件类型限制
_wrap.attach_array = [];
_wrap.attach_names = [];
@ -20063,7 +20083,7 @@ BI.Bubble = BI.inherit(BI.Tip, {
_right: function(){
return BI.createWidget({
type: "bi.inline",
type: "bi.left",
items: [{
el: {
type: "bi.layout",
@ -28829,7 +28849,7 @@ BI.CollectionTableCell = BI.inherit(BI.Widget, {
this.cell = BI.createWidget(BI.extend({
type: "bi.label"
}, o.cell, {
cls: (o.cell.cls || "") + "collection-table-cell-wrapper",
cls: (o.cell.cls || "") + " collection-table-cell-wrapper",
width: o.width - (o._left === 0 ? 1 : 0) - 1,
height: o.height - (o._top === 0 ? 1 : 0) - 1
}));
@ -29034,11 +29054,26 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
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 () {
var o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize;
var freezeColLength = this._getFreezeColLength();
summaryColumnSizeArray = [];
BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size;
@ -29052,8 +29087,8 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size;
}
});
this.topScrollbar.setContentSize(o.items.length * o.rowSize);
this.topScrollbar.setSize(this._height - o.header.length * o.headerRowSize);
this.topScrollbar.setContentSize(this._getActualItems().length * o.rowSize);
this.topScrollbar.setSize(this._height - this._getFreezeHeaderHeight());
this.topScrollbar.setPosition(this.bottomRightCollection.getScrollTop());
this.topScrollbar.populate();
@ -29068,7 +29103,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
this.rightScrollbar.populate();
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[2].top = this._height;
items[2].left = regionSize;
@ -29079,8 +29114,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
_populateTable: function () {
var self = this, o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize;
var freezeColLength = this._getFreezeColLength();
summaryColumnSizeArray = [];
BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size;
@ -29096,13 +29130,13 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
});
var otlw = regionSize;
var otlh = o.header.length * o.headerRowSize;
var otlh = this._getFreezeHeaderHeight();
var otrw = this._width - regionSize;
var otrh = o.header.length * o.headerRowSize;
var otrh = this._getFreezeHeaderHeight();
var oblw = regionSize;
var oblh = this._height - o.header.length * o.headerRowSize;
var oblh = this._height - otlh;
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 tlh = otlh + this._scrollBarSize;
@ -29146,9 +29180,9 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
var items = this.contextLayout.attr("items");
items[1].left = regionSize;
items[2].top = o.header.length * o.headerRowSize;
items[2].top = this._getFreezeHeaderHeight();
items[3].left = regionSize;
items[3].top = o.header.length * o.headerRowSize;
items[3].top = this._getFreezeHeaderHeight();
this.contextLayout.attr("items", items);
this.contextLayout.resize();
@ -29164,8 +29198,8 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
};
run(this.topLeftItems, o.header, leftHeader);
run(this.topRightItems, o.header, rightHeader);
run(this.bottomLeftItems, o.items, leftItems);
run(this.bottomRightItems, o.items, rightItems);
run(this.bottomLeftItems, this._getActualItems(), leftItems);
run(this.bottomRightItems, this._getActualItems(), rightItems);
this.topLeftCollection._populate(leftHeader);
this.topRightCollection._populate(rightHeader);
@ -29176,13 +29210,23 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
_digest: function () {
var o = this.options;
var freezeColLength = this._getFreezeColLength();
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.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);
//如果表头位置不够,取消表头冻结
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.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.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 result = [], cache = {}, preCol = {}, preRow = {}, map = {};
var summaryColumnSize = [];
@ -29232,7 +29276,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
}
cache[i][j] = cols[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) {
createOneEl(0, startCol);
} else if (j === startCol && i > 0) {
@ -29679,7 +29723,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.topLeftGrid = BI.createWidget({
type: "bi.grid_view",
rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnLeftWidthGetter,
columnWidthGetter: columnLeftWidthGetter
});
this.topLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomLeftGrid.setScrollLeft(scroll.scrollLeft);
@ -29689,7 +29733,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.topRightGrid = BI.createWidget({
type: "bi.grid_view",
rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnRightWidthGetter,
columnWidthGetter: columnRightWidthGetter
});
this.topRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomRightGrid.setScrollLeft(scroll.scrollLeft);
@ -29699,7 +29743,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.bottomLeftGrid = BI.createWidget({
type: "bi.grid_view",
rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnLeftWidthGetter,
columnWidthGetter: columnLeftWidthGetter
});
this.bottomLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomRightGrid.setScrollTop(scroll.scrollTop);
@ -29710,7 +29754,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.bottomRightGrid = BI.createWidget({
type: "bi.grid_view",
rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnRightWidthGetter,
columnWidthGetter: columnRightWidthGetter
});
this.bottomRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomLeftGrid.setScrollTop(scroll.scrollTop);
@ -29798,7 +29842,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
el: this.leftScrollbar,
left: 0
}, {
el: this.rightScrollbar,
el: this.rightScrollbar
}]
});
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;
},
_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 () {
var o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize;
var freezeColLength = this._getFreezeColLength();
summaryColumnSizeArray = [];
BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size;
@ -29836,8 +29895,8 @@ BI.GridTable = BI.inherit(BI.Widget, {
summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size;
}
});
this.topScrollbar.setContentSize(o.items.length * o.rowSize);
this.topScrollbar.setSize(this._height - o.header.length * o.headerRowSize);
this.topScrollbar.setContentSize(this._getActualItems().length * o.rowSize);
this.topScrollbar.setSize(this._height - this._getFreezeHeaderHeight());
this.topScrollbar.setPosition(Math.min(this.bottomLeftGrid.getScrollTop(), this.bottomRightGrid.getScrollTop()));
this.topScrollbar.populate();
@ -29852,7 +29911,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.rightScrollbar.populate();
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[2].top = this._height;
items[2].left = regionSize;
@ -29886,7 +29945,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
var o = this.options;
var freezeColLength = this._getFreezeColLength();
var leftItems = [], rightItems = [];
BI.each(o.items, function (i, cols) {
BI.each(this._getActualItems(), function (i, cols) {
leftItems[i] = [];
rightItems[i] = [];
BI.each(cols, function (j, col) {
@ -29907,7 +29966,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
_populateTable: function () {
var self = this, o = this.options;
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) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
@ -29924,13 +29983,13 @@ BI.GridTable = BI.inherit(BI.Widget, {
});
var otlw = regionSize;
var otlh = o.header.length * o.headerRowSize;
var otlh = this._getFreezeHeaderHeight();
var otrw = this._width - regionSize;
var otrh = o.header.length * o.headerRowSize;
var otrh = this._getFreezeHeaderHeight();
var oblw = regionSize;
var oblh = this._height - o.header.length * o.headerRowSize;
var oblh = this._height - otlh;
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 tlh = otlh + this._scrollBarSize;
@ -29983,9 +30042,9 @@ BI.GridTable = BI.inherit(BI.Widget, {
var items = this.contextLayout.attr("items");
items[1].left = regionSize;
items[2].top = o.header.length * o.headerRowSize;
items[2].top = this._getFreezeHeaderHeight();
items[3].left = regionSize;
items[3].top = o.header.length * o.headerRowSize;
items[3].top = this._getFreezeHeaderHeight();
this.contextLayout.attr("items", items);
this.contextLayout.resize();
@ -32383,6 +32442,9 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
return BI.extend(BI.ResizableTableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-resizable-table-cell",
cell: {},
minSize: 15,
// suitableSize,
maxSize: Number.MAX_VALUE,
start: BI.emptyFn,
resize: BI.emptyFn,
stop: BI.emptyFn
@ -32396,22 +32458,37 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
var startDrag = false;
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) {
if (mouseMoveTracker.isDragging()) {
startDrag = true;
offset += deltaX;
size = BI.clamp(defaultSize + offset, 15, Number.MAX_VALUE);
size = optimizeSize(defaultSize + offset);
self.handler.element.addClass("dragging");
o.resize(size);
}
}, function () {
if (startDrag === true) {
size = BI.clamp(size, 15, Number.MAX_VALUE);
size = optimizeSize(size);
o.stop(size);
size = 0;
offset = 0;
defaultSize = o.width;
self.handler.element.removeClass("dragging");
self.handler.element.removeClass("suitable");
startDrag = false;
}
mouseMoveTracker.releaseMouseMoves();
@ -32489,6 +32566,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
mergeCols: [],
mergeRule: BI.emptyFn,
columnSize: [],
minColumnSize: [],
maxColumnSize: [],
freezeCols: [],
header: [],
items: [],
@ -32681,7 +32760,13 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
self.resizer.setVisible(true);
var height = o.headerRowSize + self._getRegionRowSize()[1];
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);
};
var stop = function (j, size) {
@ -32704,6 +32789,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
result[i][j] = {
type: "bi.resizable_table_cell",
cell: col,
suitableSize: o.minColumnSize[i],
maxSize: o.maxColumnSize[i],
resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j)
};
@ -32713,6 +32800,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
result[r - 1][j] = {
type: "bi.resizable_table_cell",
cell: result[r - 1][j],
suitableSize: o.minColumnSize[i],
maxSize: o.maxColumnSize[i],
resize: BI.bind(resize, 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;
}
});
this.clipboard.on("success", function (e) {
o.afterCopy();
})
this.clipboard.on("success", o.afterCopy)
} else {
this.element.zclip({
path: BI.resourceURL + "/ZeroClipboard.swf",
@ -4763,6 +4761,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
toggle: true,
direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
isDefaultInit: false,
destroyWhenHide: false,
isNeedAdjustHeight: true,//是否需要高度调整
isNeedAdjustWidth: true,
stopPropagation: false,
@ -4785,6 +4784,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
toggle: o.toggle,
direction: o.direction,
isDefaultInit: o.isDefaultInit,
destroyWhenHide: o.destroyWhenHide,
isNeedAdjustHeight: o.isNeedAdjustHeight,
isNeedAdjustWidth: o.isNeedAdjustWidth,
adjustLength: this._getAdjustLength(),
@ -4835,37 +4835,40 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
_createTriangle: function (direction) {
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) {
case "left":
pos = {
top: 0,
bottom: 0,
left: -adjustLength
top: top,
height: this.element.outerHeight(),
left: left - adjustLength - this._const.TRIANGLE_LENGTH
};
op = {width: this._const.TRIANGLE_LENGTH};
break;
case "right":
pos = {
top: 0,
bottom: 0,
right: -adjustLength
top: top,
height: this.element.outerHeight(),
left: right + adjustLength
};
op = {width: this._const.TRIANGLE_LENGTH};
break;
case "top":
pos = {
left: 0,
right: 0,
top: -adjustLength
left: left,
width: this.element.outerWidth(),
top: top - adjustLength - this._const.TRIANGLE_LENGTH
};
op = {height: this._const.TRIANGLE_LENGTH};
break;
case "bottom":
pos = {
left: 0,
right: 0,
bottom: -adjustLength
left: left,
width: this.element.outerWidth(),
top: bottom + adjustLength
};
op = {height: this._const.TRIANGLE_LENGTH};
break;
@ -4874,6 +4877,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
}
this.triangle = BI.createWidget(op, {
type: "bi.center_adapt",
cls: "button-combo-triangle-wrapper",
items: [{
type: "bi.layout",
cls: "bubble-combo-triangle-" + direction + " bi-high-light-border"
@ -4931,7 +4935,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
_hideTriangle: function () {
this.triangle && this.triangle.destroy();
this.combo.getView().hideLine();
this.combo.getView() && this.combo.getView().hideLine();
},
hideView: function () {
@ -10391,7 +10395,7 @@ BI.DynamicSummaryLayerTreeTable = BI.inherit(BI.Widget, {
_recomputeColumnSize: function () {
var o = this.options;
o.regionColumnSize = this.table.getRegionColumnSize();
var columnSize = this.table.getColumnSize();
var columnSize = this.table.getColumnSize().slice();
if (o.freezeCols.length > 1) {
for (var i = 0; i < o.freezeCols.length - 1; i++) {
columnSize.splice(1, 0, 0);

59
bi/core.js

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

207
bi/widget.js

@ -3742,7 +3742,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
case BI.Arrangement.LAYOUT_TYPE.ADAPTIVE:
if (this._isArrangeFine()) {
var width = this.getClientWidth(), height = this.getClientHeight();
var isHeightAdjust = height > occupied.top + occupied.height;
var isHeightAdjust = height > occupied.height;
var regions = this._cloneRegion();
BI.each(regions, function (i, region) {
region.width = region.width / occupied.width * width;
@ -3924,7 +3924,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
BI.Arrangement.EVENT_SCROLL = "EVENT_SCROLL";
BI.extend(BI.Arrangement, {
PORTION: 24,
GRID_HEIGHT: 50,
GRID_HEIGHT: 60,
LAYOUT_TYPE: {
ADAPTIVE: 0,
FREE: 1,
@ -5638,6 +5638,10 @@ BI.DownListCombo = BI.inherit(BI.Widget, {
});
},
hideView: function () {
this.downlistcombo.hideView();
},
populate: function (items) {
this.popupview.populate(items);
},
@ -5788,7 +5792,7 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe
logic: {
dynamic: false
},
invalid: true,
// invalid: true,
iconCls1: "dot-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,
value: o.value,
height: o.height
})
});
this.icon1 = BI.createWidget({
type: "bi.icon_button",
cls: o.iconCls1,
width: 25,
forceNotSelected: true
})
});
this.icon2 = BI.createWidget({
type: "bi.icon_button",
cls: o.iconCls2,
width: 25,
forceNotSelected: true
})
});
var blank = BI.createWidget({
type: "bi.layout",
width: 25
})
});
BI.createWidget({
type: "bi.absolute",
element: this,
@ -5833,7 +5837,7 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe
bottom: 0,
right: 0
}]
})
});
BI.createWidget(BI.extend({
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)
}))));
this.element.on("mouseenter." + this.getName(), function (e) {
if (self.element.__isMouseInBounds__(e) && self.isEnabled()) {
this.element.hover(function () {
if (self.isEnabled()) {
self.hover();
} else {
self.dishover();
}
});
this.element.on("mousemove." + this.getName(), function (e) {
if (!self.element.__isMouseInBounds__(e) && self.isEnabled()) {
self.dishover()
}
});
this.element.on("mouseleave." + this.getName(), function () {
}, function () {
if (self.isEnabled()) {
self.dishover()
}
@ -5891,11 +5887,11 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe
setValue: function (v) {
var self = this, o = this.options;
v = BI.isArray(v) ? v : [v];
BI.find(v, function(idx, value){
if(BI.contains(o.childValues, value)){
BI.find(v, function (idx, value) {
if (BI.contains(o.childValues, value)) {
self.icon1.setSelected(true);
return true;
}else{
} else {
self.icon1.setSelected(false);
}
})
@ -11318,34 +11314,36 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
itemsCreator: o.itemsCreator
});
this.adapter.on(BI.MultiSelectTreePopup.EVENT_CHANGE, function () {
if (self.trigger.isSearching()) {
if (self.searcher.isSearching()) {
self.storeValue = {value: self.searcherPane.getValue()};
} else {
self.storeValue = {value: self.adapter.getValue()};
}
self.setSelectedValue(self.storeValue.value);
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",
cls: "bi-border-left bi-border-right bi-border-bottom",
keywordGetter: function () {
return self.trigger.getKeyword();
return self.searcher.getKeyword();
},
itemsCreator: function (op, callback) {
op.keyword = self.trigger.getKeyword();
op.keyword = self.searcher.getKeyword();
o.itemsCreator(op, callback);
}
});
this.searcherPane.setVisible(false);
this.trigger = BI.createWidget({
this.searcher = BI.createWidget({
type: "bi.searcher",
isAutoSearch: false,
isAutoSync: false,
onSearch: function (op, callback) {
callback({
keyword: self.trigger.getKeyword()
keyword: self.searcher.getKeyword()
});
},
adapter: this.adapter,
@ -11355,15 +11353,15 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
eventName: BI.Searcher.EVENT_START,
action: function () {
self._showSearcherPane();
self.storeValue = {value: self.adapter.getValue()};
self.searcherPane.setValue(self.storeValue);
// self.storeValue = {value: self.adapter.getValue()};
// self.searcherPane.setSelectedValue(self.storeValue.value);
}
}, {
eventName: BI.Searcher.EVENT_STOP,
action: function () {
self._showAdapter();
// self.storeValue = {value: self.searcherPane.getValue()};
self.adapter.setValue(self.storeValue);
// self.adapter.setSelectedValue(self.storeValue.value);
BI.nextTick(function () {
self.adapter.populate();
});
@ -11371,11 +11369,12 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
}, {
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
if (self.trigger.isSearching()) {
if (self.searcher.isSearching()) {
self.storeValue = {value: self.searcherPane.getValue()};
} else {
self.storeValue = {value: self.adapter.getValue()};
}
self.setSelectedValue(self.storeValue.value);
self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE);
}
}, {
@ -11390,7 +11389,7 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
type: "bi.vtape",
element: this,
items: [{
el: this.trigger,
el: this.searcher,
height: 30
}, {
el: this.adapter,
@ -11425,18 +11424,21 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
},
setValue: function (v) {
setSelectedValue: function (v) {
this.storeValue.value = v || {};
this.adapter.setValue({
value: v || {}
});
this.trigger.setValue({
this.adapter.setSelectedValue(v);
this.searcherPane.setSelectedValue(v);
this.searcher.setValue({
value: v || {}
});
},
setValue: function (v) {
this.adapter.setValue(v);
},
stopSearch: function () {
this.trigger.stopSearch();
this.searcher.stopSearch();
},
updateValue: function (v) {
@ -11448,7 +11450,7 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
},
populate: function () {
this.trigger.populate.apply(this.trigger, arguments);
this.searcher.populate.apply(this.searcher, arguments);
this.adapter.populate.apply(this.adapter, arguments);
}
});
@ -11489,7 +11491,12 @@ BI.MultiSelectTreePopup = BI.inherit(BI.Widget, {
setValue: function (v) {
v || (v = {});
this.popup.setValue(v.value);
this.popup.setValue(v);
},
setSelectedValue: function (v) {
v || (v = {});
this.popup.setSelectedValue(v);
},
updateValue: function (v) {
@ -11708,7 +11715,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,
action: function () {
self._defaultState();
self.combo.hideView();
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR,
@ -12016,8 +12023,12 @@ BI.MultiTreeSearchPane = BI.inherit(BI.Pane, {
},
setValue: function (v) {
this.setSelectedValue(v.value);
},
setSelectedValue: function (v) {
v || (v = {});
this.partTree.setSelectedValue(v.value);
this.partTree.setSelectedValue(v);
},
getValue: function () {
@ -17252,7 +17263,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
return;
}
BI.each(selected, function (k) {
var node = self._getNode(parentValues, k);
var node = self._getTreeNode(parentValues, k);
var newParents = BI.clone(parentValues);
newParents.push(node.value);
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) {
var self = this;
var selectedValues = op.selectedValues;
var selectedValues = BI.deepClone(op.selectedValues);
var notSelectedValue = op.notSelectedValue || {};
var keyword = op.keyword || "";
var parentValues = op.parentValues || [];
@ -17299,12 +17310,34 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
function dealWithSelectedValues(selectedValues) {
var p = BI.clone(parentValues);
p.push(notSelectedValue);
var p = parentValues.concat(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)) {
var result = [];
var finded = search(parentValues.length + 1, parentValues, notSelectedValue, result);
var result = [], finded = false;
//如果parentValues中有匹配的值,说明搜索结果不在当前值下
if (isSearchValueInParent(p)) {
finded = true;
} else {
//从当前值开始搜
finded = search(parentValues, notSelectedValue, result);
p = parentValues;
}
if (finded === true) {
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);
newParents.push(current);
if (self._isMatch(current, keyword)) {
searched && searched.push(newParents);
return true;
}
@ -17353,7 +17387,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
var can = false;
BI.each(children, function (i, child) {
if (search(deep + 1, newParents, child.value, result)) {
if (search(newParents, child.value, result, searched)) {
can = true;
} else {
notSearch.push(child.value);
@ -17369,6 +17403,27 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
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) {
var t = selectedValues;
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;
}
t = t[v];
if (t == null || BI.isEmpty(t)) {
if (BI.isEmpty(t)) {
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) {
var node = self._getNode(parentValues, value)
var node = self._getTreeNode(parentValues, value)
result.push({
id: node.id,
pId: node.pId,
@ -17582,11 +17637,11 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
var times = op.times;
var checkState = op.checkState || {};
var parentValues = op.parentValues || [];
var selectedValues = op.selectedValues;
var selectedValues = op.selectedValues || {};
var valueMap = {};
if (judgeState(parentValues, selectedValues, checkState)) {
valueMap = dealWidthSelectedValue(parentValues, selectedValues);
}
// if (judgeState(parentValues, selectedValues, checkState)) {
valueMap = dealWidthSelectedValue(parentValues, selectedValues);
// }
var nodes = this._getChildren(parentValues);
for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) {
var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState);
@ -17619,7 +17674,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
function dealWidthSelectedValue(parentValues, selectedValues) {
var valueMap = {};
BI.each(parentValues, function (i, v) {
selectedValues = selectedValues[v];
selectedValues = selectedValues[v] || {};
});
BI.each(selectedValues, function (value, 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) {
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;
},
_getNode: function (parentValues, v) {
_getTreeNode: function (parentValues, v) {
var self = this;
var findedParentNode;
var index = 0;
@ -17710,7 +17791,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
_getChildren: function (parentValues) {
if (parentValues.length > 0) {
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 {
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) {
this.pane.setValue(v);
},

13
docs/base.css

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

321
docs/base.js

@ -710,7 +710,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
$(document).bind("mouseup." + self.getName(), function (e) {
// if (e.button === 0) {
if (BI.DOM.isExist(self) && !hand.__isMouseInBounds__(e) && mouseDown === true && !selected) {
self.setSelected(!self.isSelected());
// self.setSelected(!self.isSelected());
self._trigger();
}
mouseDown = false;
@ -1717,7 +1717,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
_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) {
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);
},
@ -1946,15 +1956,13 @@ BI.TreeView = BI.inherit(BI.Pane, {
//设置树节点的状态
setValue: function (value, param) {
this.setSelectedValue(value);
this.checkAll(false);
this.updateValue(value, param);
this.refresh();
},
setSelectedValue: function (value) {
this.options.paras.selectedValues = BI.deepClone(value) || {};
this.selectedValues = BI.deepClone(value) || {};
this.options.paras.selectedValues = BI.deepClone(value || {});
},
updateValue: function (values, param) {
@ -2106,7 +2114,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
if (treeNode.checked === true) {
} else {
var tNode = treeNode;
var pNode = this._getTree(this.selectedValues, parentValues);
var pNode = this._getTree(this.options.paras.selectedValues, parentValues);
if (BI.isNotNull(pNode[name])) {
delete pNode[name];
}
@ -2114,7 +2122,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
parentValues = parentValues.slice(0, parentValues.length - 1);
tNode = tNode.getParentNode();
if (tNode != null) {
pNode = this._getTree(this.selectedValues, parentValues);
pNode = this._getTree(this.options.paras.selectedValues, parentValues);
name = this._getNodeValue(tNode);
delete pNode[name];
}
@ -2128,10 +2136,10 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
var self = this, o = this.options;
var parentValues = treeNode.parentValues || self._getParentValues(treeNode);
var op = BI.extend({}, o.paras, {
"id": treeNode.id,
"times": 1,
"parentValues": parentValues.concat(this._getNodeValue(treeNode)),
"checkState": treeNode.getCheckStatus()
id: treeNode.id,
times: 1,
parentValues: parentValues.concat(this._getNodeValue(treeNode)),
checkState: treeNode.getCheckStatus()
});
var complete = function (d) {
var nodes = d.items || [];
@ -2179,7 +2187,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
},
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 () {
@ -2188,20 +2196,18 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
}
var checkedValues = this._getSelectedValues();
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 this._join(checkedValues, this.selectedValues);
return this._join(checkedValues, this.options.paras.selectedValues);
},
//生成树方法
stroke: function (config) {
delete this.options.keyword;
BI.extend(this.options.paras, config);
//取消选中时使用
this.selectedValues = BI.deepClone(this.options.paras.selectedValues) || {};
var setting = this._configSetting();
this._initTree(setting);
}
@ -2249,34 +2255,28 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
_selectTreeNode: function (treeId, treeNode) {
var self = this, o = this.options;
var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var name = this._getNodeValue(treeNode)
// var values = parentValues.concat([name]);
var name = this._getNodeValue(treeNode);
if (treeNode.checked === true) {
BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
} 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, {
type: BI.TreeView.REQ_TYPE_SELECT_DATA,
selectedValues: this.selectedValues,
notSelectedValue: name,
parentValues: parentValues
}), function (new_values) {
if (BI.isEqual(self.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;
self.options.paras.selectedValues = new_values;
BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
});
}
@ -2373,9 +2373,6 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
delete o.paras.keyword;
BI.extend(o.paras, config);
delete o.paras.lastSearchValue;
//取消选中时使用
this.selectedValues = BI.deepClone(o.paras.selectedValues) || {};
//delete this.options.paras.selectedValues;
var setting = this._configSetting();
this._initTree(setting, o.paras.keyword);
}
@ -2903,6 +2900,7 @@ BI.Combo = BI.inherit(BI.Widget, {
toggle: true,
direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
isDefaultInit: false,
destroyWhenHide: false,
isNeedAdjustHeight: true,//是否需要高度调整
isNeedAdjustWidth: true,
stopEvent: false,
@ -2925,17 +2923,21 @@ BI.Combo = BI.inherit(BI.Widget, {
this._initCombo();
this._initPullDownAction();
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) {
self._popupView();
}
if (type === BI.Events.COLLAPSE) {
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.isViewVisible() && self.fireEvent(BI.Combo.EVENT_COLLAPSE);
}
if (type === BI.Events.CLICK) {
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) {
if (self.isEnabled() && self.combo.isEnabled()) {
if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
self.element.addClass(o.hoverClass);
}
});
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);
}
});
@ -2995,14 +2997,14 @@ BI.Combo = BI.inherit(BI.Widget, {
switch (ev) {
case "hover":
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.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo);
self.fireEvent(BI.Combo.EVENT_EXPAND);
}
});
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.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.combo);
self.fireEvent(BI.Combo.EVENT_COLLAPSE);
@ -3012,7 +3014,7 @@ BI.Combo = BI.inherit(BI.Widget, {
case "click":
var debounce = BI.debounce(function (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();
if (self.isViewVisible()) {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo);
@ -3088,7 +3090,13 @@ BI.Combo = BI.inherit(BI.Widget, {
_hideView: function () {
this.fireEvent(BI.Combo.EVENT_BEFORE_HIDEVIEW);
this.popupView && this.popupView.invisible();
if (this.options.destroyWhenHide === true) {
this.popupView && this.popupView.destroy();
this.popupView = null;
this._rendered = false;
} else {
this.popupView && this.popupView.invisible();
}
this.element.removeClass(this.options.comboClass);
$(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName());
@ -3219,6 +3227,7 @@ BI.Combo = BI.inherit(BI.Widget, {
_setEnable: function (arg) {
BI.Combo.superclass._setEnable.apply(this, arguments);
!arg && this.element.removeClass(this.options.hoverClass);
!arg && this.isViewVisible() && this._hideView();
},
@ -3316,20 +3325,20 @@ BI.Expander = BI.inherit(BI.Widget, {
this._initExpander();
this._initPullDownAction();
this.expander.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (type === BI.Events.EXPAND) {
self._popupView();
}
if (type === BI.Events.COLLAPSE) {
self._hideView();
}
if (self.isEnabled() && this.isEnabled()) {
if (self.isEnabled() && self.isValid()) {
if (type === BI.Events.EXPAND) {
self._popupView();
}
if (type === BI.Events.COLLAPSE) {
self._hideView();
}
if (type === BI.Events.EXPAND) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.fireEvent(BI.Expander.EVENT_EXPAND);
}
if (type === BI.Events.COLLAPSE) {
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) {
self.fireEvent(BI.Expander.EVENT_TRIGGER_CHANGE, value, obj);
@ -3338,11 +3347,11 @@ BI.Expander = BI.inherit(BI.Widget, {
});
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);
}
}, function () {
if (self.isEnabled() && self.expander.isEnabled()) {
if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid()) {
self.element.removeClass(o.hoverClass);
}
});
@ -3378,13 +3387,13 @@ BI.Expander = BI.inherit(BI.Widget, {
switch (e) {
case "hover":
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.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, '', self.expander);
self.fireEvent(BI.Expander.EVENT_EXPAND);
}
}, 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.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, '', self.expander);
self.fireEvent(BI.Expander.EVENT_COLLAPSE);
@ -3395,7 +3404,7 @@ BI.Expander = BI.inherit(BI.Widget, {
if (e) {
self.element.off(e + "." + self.getName()).on(e + "." + self.getName(), BI.debounce(function (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();
if (self.isExpanded()) {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.expander);
@ -3486,6 +3495,7 @@ BI.Expander = BI.inherit(BI.Widget, {
_setEnable: function (arg) {
BI.Expander.superclass._setEnable.apply(this, arguments);
!arg && this.element.removeClass(this.options.hoverClass);
!arg && this.isViewVisible() && this._hideView();
},
@ -4483,15 +4493,20 @@ BI.Switcher = BI.inherit(BI.Widget, {
this._initSwitcher();
this._initPullDownAction();
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) {
self._popupView();
}
if (type === BI.Events.COLLAPSE) {
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.isViewVisible() && self.fireEvent(BI.Switcher.EVENT_COLLAPSE);
}
if (type === BI.Events.CLICK) {
self.fireEvent(BI.Switcher.EVENT_TRIGGER_CHANGE, value, obj);
@ -15109,15 +15124,16 @@ BI.FloatBox = BI.inherit(BI.Widget, {
populate: function (sectionProvider) {
var self = this;
if (this.currentSectionProvider && this.currentSectionProvider !== sectionProvider) {
this.currentSectionProvider.destroy();
}
this.currentSectionProvider = sectionProvider;
sectionProvider.rebuildNorth(this._north);
sectionProvider.rebuildCenter(this._center);
sectionProvider.rebuildSouth(this._south);
if (sectionProvider instanceof BI.Widget) {
sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () {
self.close();
})
}
sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () {
self.close();
})
},
show: function () {
@ -15140,6 +15156,10 @@ BI.FloatBox = BI.inherit(BI.Widget, {
setZindex: function (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, {
baseCls: (conf.baseCls || "") + " bi-multifile-editor",
multiple: false,
maxSize: 1024 * 1024,
maxSize: -1,//1024 * 1024
accept: "",
url: ""
})
@ -18937,7 +18957,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
url: "",
multiple: true,
accept: "", /**'*.jpg; *.zip'**/
maxSize: 1024 * 1024
maxSize: -1 //1024 * 1024
})
},
@ -19013,7 +19033,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
}, 1000);
};
_wrap.url = o.url ? o.url : BI.servletURL
+ '?op=fr_attach&cmd=ah_upload';
+ '?op=fr_attach&cmd=ah_upload';
_wrap.fileType = o.accept; //文件类型限制
_wrap.attach_array = [];
_wrap.attach_names = [];
@ -20063,7 +20083,7 @@ BI.Bubble = BI.inherit(BI.Tip, {
_right: function(){
return BI.createWidget({
type: "bi.inline",
type: "bi.left",
items: [{
el: {
type: "bi.layout",
@ -28829,7 +28849,7 @@ BI.CollectionTableCell = BI.inherit(BI.Widget, {
this.cell = BI.createWidget(BI.extend({
type: "bi.label"
}, o.cell, {
cls: (o.cell.cls || "") + "collection-table-cell-wrapper",
cls: (o.cell.cls || "") + " collection-table-cell-wrapper",
width: o.width - (o._left === 0 ? 1 : 0) - 1,
height: o.height - (o._top === 0 ? 1 : 0) - 1
}));
@ -29034,11 +29054,26 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
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 () {
var o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize;
var freezeColLength = this._getFreezeColLength();
summaryColumnSizeArray = [];
BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size;
@ -29052,8 +29087,8 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size;
}
});
this.topScrollbar.setContentSize(o.items.length * o.rowSize);
this.topScrollbar.setSize(this._height - o.header.length * o.headerRowSize);
this.topScrollbar.setContentSize(this._getActualItems().length * o.rowSize);
this.topScrollbar.setSize(this._height - this._getFreezeHeaderHeight());
this.topScrollbar.setPosition(this.bottomRightCollection.getScrollTop());
this.topScrollbar.populate();
@ -29068,7 +29103,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
this.rightScrollbar.populate();
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[2].top = this._height;
items[2].left = regionSize;
@ -29079,8 +29114,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
_populateTable: function () {
var self = this, o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize;
var freezeColLength = this._getFreezeColLength();
summaryColumnSizeArray = [];
BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size;
@ -29096,13 +29130,13 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
});
var otlw = regionSize;
var otlh = o.header.length * o.headerRowSize;
var otlh = this._getFreezeHeaderHeight();
var otrw = this._width - regionSize;
var otrh = o.header.length * o.headerRowSize;
var otrh = this._getFreezeHeaderHeight();
var oblw = regionSize;
var oblh = this._height - o.header.length * o.headerRowSize;
var oblh = this._height - otlh;
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 tlh = otlh + this._scrollBarSize;
@ -29146,9 +29180,9 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
var items = this.contextLayout.attr("items");
items[1].left = regionSize;
items[2].top = o.header.length * o.headerRowSize;
items[2].top = this._getFreezeHeaderHeight();
items[3].left = regionSize;
items[3].top = o.header.length * o.headerRowSize;
items[3].top = this._getFreezeHeaderHeight();
this.contextLayout.attr("items", items);
this.contextLayout.resize();
@ -29164,8 +29198,8 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
};
run(this.topLeftItems, o.header, leftHeader);
run(this.topRightItems, o.header, rightHeader);
run(this.bottomLeftItems, o.items, leftItems);
run(this.bottomRightItems, o.items, rightItems);
run(this.bottomLeftItems, this._getActualItems(), leftItems);
run(this.bottomRightItems, this._getActualItems(), rightItems);
this.topLeftCollection._populate(leftHeader);
this.topRightCollection._populate(rightHeader);
@ -29176,13 +29210,23 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
_digest: function () {
var o = this.options;
var freezeColLength = this._getFreezeColLength();
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.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);
//如果表头位置不够,取消表头冻结
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.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.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 result = [], cache = {}, preCol = {}, preRow = {}, map = {};
var summaryColumnSize = [];
@ -29232,7 +29276,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
}
cache[i][j] = cols[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) {
createOneEl(0, startCol);
} else if (j === startCol && i > 0) {
@ -29679,7 +29723,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.topLeftGrid = BI.createWidget({
type: "bi.grid_view",
rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnLeftWidthGetter,
columnWidthGetter: columnLeftWidthGetter
});
this.topLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomLeftGrid.setScrollLeft(scroll.scrollLeft);
@ -29689,7 +29733,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.topRightGrid = BI.createWidget({
type: "bi.grid_view",
rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnRightWidthGetter,
columnWidthGetter: columnRightWidthGetter
});
this.topRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomRightGrid.setScrollLeft(scroll.scrollLeft);
@ -29699,7 +29743,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.bottomLeftGrid = BI.createWidget({
type: "bi.grid_view",
rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnLeftWidthGetter,
columnWidthGetter: columnLeftWidthGetter
});
this.bottomLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomRightGrid.setScrollTop(scroll.scrollTop);
@ -29710,7 +29754,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.bottomRightGrid = BI.createWidget({
type: "bi.grid_view",
rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnRightWidthGetter,
columnWidthGetter: columnRightWidthGetter
});
this.bottomRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomLeftGrid.setScrollTop(scroll.scrollTop);
@ -29798,7 +29842,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
el: this.leftScrollbar,
left: 0
}, {
el: this.rightScrollbar,
el: this.rightScrollbar
}]
});
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;
},
_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 () {
var o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize;
var freezeColLength = this._getFreezeColLength();
summaryColumnSizeArray = [];
BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size;
@ -29836,8 +29895,8 @@ BI.GridTable = BI.inherit(BI.Widget, {
summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size;
}
});
this.topScrollbar.setContentSize(o.items.length * o.rowSize);
this.topScrollbar.setSize(this._height - o.header.length * o.headerRowSize);
this.topScrollbar.setContentSize(this._getActualItems().length * o.rowSize);
this.topScrollbar.setSize(this._height - this._getFreezeHeaderHeight());
this.topScrollbar.setPosition(Math.min(this.bottomLeftGrid.getScrollTop(), this.bottomRightGrid.getScrollTop()));
this.topScrollbar.populate();
@ -29852,7 +29911,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.rightScrollbar.populate();
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[2].top = this._height;
items[2].left = regionSize;
@ -29886,7 +29945,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
var o = this.options;
var freezeColLength = this._getFreezeColLength();
var leftItems = [], rightItems = [];
BI.each(o.items, function (i, cols) {
BI.each(this._getActualItems(), function (i, cols) {
leftItems[i] = [];
rightItems[i] = [];
BI.each(cols, function (j, col) {
@ -29907,7 +29966,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
_populateTable: function () {
var self = this, o = this.options;
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) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
@ -29924,13 +29983,13 @@ BI.GridTable = BI.inherit(BI.Widget, {
});
var otlw = regionSize;
var otlh = o.header.length * o.headerRowSize;
var otlh = this._getFreezeHeaderHeight();
var otrw = this._width - regionSize;
var otrh = o.header.length * o.headerRowSize;
var otrh = this._getFreezeHeaderHeight();
var oblw = regionSize;
var oblh = this._height - o.header.length * o.headerRowSize;
var oblh = this._height - otlh;
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 tlh = otlh + this._scrollBarSize;
@ -29983,9 +30042,9 @@ BI.GridTable = BI.inherit(BI.Widget, {
var items = this.contextLayout.attr("items");
items[1].left = regionSize;
items[2].top = o.header.length * o.headerRowSize;
items[2].top = this._getFreezeHeaderHeight();
items[3].left = regionSize;
items[3].top = o.header.length * o.headerRowSize;
items[3].top = this._getFreezeHeaderHeight();
this.contextLayout.attr("items", items);
this.contextLayout.resize();
@ -32383,6 +32442,9 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
return BI.extend(BI.ResizableTableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-resizable-table-cell",
cell: {},
minSize: 15,
// suitableSize,
maxSize: Number.MAX_VALUE,
start: BI.emptyFn,
resize: BI.emptyFn,
stop: BI.emptyFn
@ -32396,22 +32458,37 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
var startDrag = false;
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) {
if (mouseMoveTracker.isDragging()) {
startDrag = true;
offset += deltaX;
size = BI.clamp(defaultSize + offset, 15, Number.MAX_VALUE);
size = optimizeSize(defaultSize + offset);
self.handler.element.addClass("dragging");
o.resize(size);
}
}, function () {
if (startDrag === true) {
size = BI.clamp(size, 15, Number.MAX_VALUE);
size = optimizeSize(size);
o.stop(size);
size = 0;
offset = 0;
defaultSize = o.width;
self.handler.element.removeClass("dragging");
self.handler.element.removeClass("suitable");
startDrag = false;
}
mouseMoveTracker.releaseMouseMoves();
@ -32489,6 +32566,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
mergeCols: [],
mergeRule: BI.emptyFn,
columnSize: [],
minColumnSize: [],
maxColumnSize: [],
freezeCols: [],
header: [],
items: [],
@ -32681,7 +32760,13 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
self.resizer.setVisible(true);
var height = o.headerRowSize + self._getRegionRowSize()[1];
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);
};
var stop = function (j, size) {
@ -32704,6 +32789,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
result[i][j] = {
type: "bi.resizable_table_cell",
cell: col,
suitableSize: o.minColumnSize[i],
maxSize: o.maxColumnSize[i],
resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j)
};
@ -32713,6 +32800,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
result[r - 1][j] = {
type: "bi.resizable_table_cell",
cell: result[r - 1][j],
suitableSize: o.minColumnSize[i],
maxSize: o.maxColumnSize[i],
resize: BI.bind(resize, 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;
}
});
this.clipboard.on("success", function (e) {
o.afterCopy();
})
this.clipboard.on("success", o.afterCopy)
} else {
this.element.zclip({
path: BI.resourceURL + "/ZeroClipboard.swf",
@ -4763,6 +4761,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
toggle: true,
direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
isDefaultInit: false,
destroyWhenHide: false,
isNeedAdjustHeight: true,//是否需要高度调整
isNeedAdjustWidth: true,
stopPropagation: false,
@ -4785,6 +4784,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
toggle: o.toggle,
direction: o.direction,
isDefaultInit: o.isDefaultInit,
destroyWhenHide: o.destroyWhenHide,
isNeedAdjustHeight: o.isNeedAdjustHeight,
isNeedAdjustWidth: o.isNeedAdjustWidth,
adjustLength: this._getAdjustLength(),
@ -4835,37 +4835,40 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
_createTriangle: function (direction) {
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) {
case "left":
pos = {
top: 0,
bottom: 0,
left: -adjustLength
top: top,
height: this.element.outerHeight(),
left: left - adjustLength - this._const.TRIANGLE_LENGTH
};
op = {width: this._const.TRIANGLE_LENGTH};
break;
case "right":
pos = {
top: 0,
bottom: 0,
right: -adjustLength
top: top,
height: this.element.outerHeight(),
left: right + adjustLength
};
op = {width: this._const.TRIANGLE_LENGTH};
break;
case "top":
pos = {
left: 0,
right: 0,
top: -adjustLength
left: left,
width: this.element.outerWidth(),
top: top - adjustLength - this._const.TRIANGLE_LENGTH
};
op = {height: this._const.TRIANGLE_LENGTH};
break;
case "bottom":
pos = {
left: 0,
right: 0,
bottom: -adjustLength
left: left,
width: this.element.outerWidth(),
top: bottom + adjustLength
};
op = {height: this._const.TRIANGLE_LENGTH};
break;
@ -4874,6 +4877,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
}
this.triangle = BI.createWidget(op, {
type: "bi.center_adapt",
cls: "button-combo-triangle-wrapper",
items: [{
type: "bi.layout",
cls: "bubble-combo-triangle-" + direction + " bi-high-light-border"
@ -4931,7 +4935,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
_hideTriangle: function () {
this.triangle && this.triangle.destroy();
this.combo.getView().hideLine();
this.combo.getView() && this.combo.getView().hideLine();
},
hideView: function () {
@ -10391,7 +10395,7 @@ BI.DynamicSummaryLayerTreeTable = BI.inherit(BI.Widget, {
_recomputeColumnSize: function () {
var o = this.options;
o.regionColumnSize = this.table.getRegionColumnSize();
var columnSize = this.table.getColumnSize();
var columnSize = this.table.getColumnSize().slice();
if (o.freezeCols.length > 1) {
for (var i = 0; i < o.freezeCols.length - 1; i++) {
columnSize.splice(1, 0, 0);

59
docs/core.js

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

26
docs/resource.css

@ -1,19 +1,6 @@
/****添加计算宽度的--运算符直接需要space****/
/****** common 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,
button,
input,
@ -140,6 +127,19 @@ textarea::-webkit-scrollbar-thumb:hover {
}
/****** common 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 {
*zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = '&#xe600');
}

207
docs/widget.js

@ -3742,7 +3742,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
case BI.Arrangement.LAYOUT_TYPE.ADAPTIVE:
if (this._isArrangeFine()) {
var width = this.getClientWidth(), height = this.getClientHeight();
var isHeightAdjust = height > occupied.top + occupied.height;
var isHeightAdjust = height > occupied.height;
var regions = this._cloneRegion();
BI.each(regions, function (i, region) {
region.width = region.width / occupied.width * width;
@ -3924,7 +3924,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
BI.Arrangement.EVENT_SCROLL = "EVENT_SCROLL";
BI.extend(BI.Arrangement, {
PORTION: 24,
GRID_HEIGHT: 50,
GRID_HEIGHT: 60,
LAYOUT_TYPE: {
ADAPTIVE: 0,
FREE: 1,
@ -5638,6 +5638,10 @@ BI.DownListCombo = BI.inherit(BI.Widget, {
});
},
hideView: function () {
this.downlistcombo.hideView();
},
populate: function (items) {
this.popupview.populate(items);
},
@ -5788,7 +5792,7 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe
logic: {
dynamic: false
},
invalid: true,
// invalid: true,
iconCls1: "dot-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,
value: o.value,
height: o.height
})
});
this.icon1 = BI.createWidget({
type: "bi.icon_button",
cls: o.iconCls1,
width: 25,
forceNotSelected: true
})
});
this.icon2 = BI.createWidget({
type: "bi.icon_button",
cls: o.iconCls2,
width: 25,
forceNotSelected: true
})
});
var blank = BI.createWidget({
type: "bi.layout",
width: 25
})
});
BI.createWidget({
type: "bi.absolute",
element: this,
@ -5833,7 +5837,7 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe
bottom: 0,
right: 0
}]
})
});
BI.createWidget(BI.extend({
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)
}))));
this.element.on("mouseenter." + this.getName(), function (e) {
if (self.element.__isMouseInBounds__(e) && self.isEnabled()) {
this.element.hover(function () {
if (self.isEnabled()) {
self.hover();
} else {
self.dishover();
}
});
this.element.on("mousemove." + this.getName(), function (e) {
if (!self.element.__isMouseInBounds__(e) && self.isEnabled()) {
self.dishover()
}
});
this.element.on("mouseleave." + this.getName(), function () {
}, function () {
if (self.isEnabled()) {
self.dishover()
}
@ -5891,11 +5887,11 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe
setValue: function (v) {
var self = this, o = this.options;
v = BI.isArray(v) ? v : [v];
BI.find(v, function(idx, value){
if(BI.contains(o.childValues, value)){
BI.find(v, function (idx, value) {
if (BI.contains(o.childValues, value)) {
self.icon1.setSelected(true);
return true;
}else{
} else {
self.icon1.setSelected(false);
}
})
@ -11318,34 +11314,36 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
itemsCreator: o.itemsCreator
});
this.adapter.on(BI.MultiSelectTreePopup.EVENT_CHANGE, function () {
if (self.trigger.isSearching()) {
if (self.searcher.isSearching()) {
self.storeValue = {value: self.searcherPane.getValue()};
} else {
self.storeValue = {value: self.adapter.getValue()};
}
self.setSelectedValue(self.storeValue.value);
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",
cls: "bi-border-left bi-border-right bi-border-bottom",
keywordGetter: function () {
return self.trigger.getKeyword();
return self.searcher.getKeyword();
},
itemsCreator: function (op, callback) {
op.keyword = self.trigger.getKeyword();
op.keyword = self.searcher.getKeyword();
o.itemsCreator(op, callback);
}
});
this.searcherPane.setVisible(false);
this.trigger = BI.createWidget({
this.searcher = BI.createWidget({
type: "bi.searcher",
isAutoSearch: false,
isAutoSync: false,
onSearch: function (op, callback) {
callback({
keyword: self.trigger.getKeyword()
keyword: self.searcher.getKeyword()
});
},
adapter: this.adapter,
@ -11355,15 +11353,15 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
eventName: BI.Searcher.EVENT_START,
action: function () {
self._showSearcherPane();
self.storeValue = {value: self.adapter.getValue()};
self.searcherPane.setValue(self.storeValue);
// self.storeValue = {value: self.adapter.getValue()};
// self.searcherPane.setSelectedValue(self.storeValue.value);
}
}, {
eventName: BI.Searcher.EVENT_STOP,
action: function () {
self._showAdapter();
// self.storeValue = {value: self.searcherPane.getValue()};
self.adapter.setValue(self.storeValue);
// self.adapter.setSelectedValue(self.storeValue.value);
BI.nextTick(function () {
self.adapter.populate();
});
@ -11371,11 +11369,12 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
}, {
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
if (self.trigger.isSearching()) {
if (self.searcher.isSearching()) {
self.storeValue = {value: self.searcherPane.getValue()};
} else {
self.storeValue = {value: self.adapter.getValue()};
}
self.setSelectedValue(self.storeValue.value);
self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE);
}
}, {
@ -11390,7 +11389,7 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
type: "bi.vtape",
element: this,
items: [{
el: this.trigger,
el: this.searcher,
height: 30
}, {
el: this.adapter,
@ -11425,18 +11424,21 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
},
setValue: function (v) {
setSelectedValue: function (v) {
this.storeValue.value = v || {};
this.adapter.setValue({
value: v || {}
});
this.trigger.setValue({
this.adapter.setSelectedValue(v);
this.searcherPane.setSelectedValue(v);
this.searcher.setValue({
value: v || {}
});
},
setValue: function (v) {
this.adapter.setValue(v);
},
stopSearch: function () {
this.trigger.stopSearch();
this.searcher.stopSearch();
},
updateValue: function (v) {
@ -11448,7 +11450,7 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
},
populate: function () {
this.trigger.populate.apply(this.trigger, arguments);
this.searcher.populate.apply(this.searcher, arguments);
this.adapter.populate.apply(this.adapter, arguments);
}
});
@ -11489,7 +11491,12 @@ BI.MultiSelectTreePopup = BI.inherit(BI.Widget, {
setValue: function (v) {
v || (v = {});
this.popup.setValue(v.value);
this.popup.setValue(v);
},
setSelectedValue: function (v) {
v || (v = {});
this.popup.setSelectedValue(v);
},
updateValue: function (v) {
@ -11708,7 +11715,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,
action: function () {
self._defaultState();
self.combo.hideView();
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR,
@ -12016,8 +12023,12 @@ BI.MultiTreeSearchPane = BI.inherit(BI.Pane, {
},
setValue: function (v) {
this.setSelectedValue(v.value);
},
setSelectedValue: function (v) {
v || (v = {});
this.partTree.setSelectedValue(v.value);
this.partTree.setSelectedValue(v);
},
getValue: function () {
@ -17252,7 +17263,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
return;
}
BI.each(selected, function (k) {
var node = self._getNode(parentValues, k);
var node = self._getTreeNode(parentValues, k);
var newParents = BI.clone(parentValues);
newParents.push(node.value);
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) {
var self = this;
var selectedValues = op.selectedValues;
var selectedValues = BI.deepClone(op.selectedValues);
var notSelectedValue = op.notSelectedValue || {};
var keyword = op.keyword || "";
var parentValues = op.parentValues || [];
@ -17299,12 +17310,34 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
function dealWithSelectedValues(selectedValues) {
var p = BI.clone(parentValues);
p.push(notSelectedValue);
var p = parentValues.concat(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)) {
var result = [];
var finded = search(parentValues.length + 1, parentValues, notSelectedValue, result);
var result = [], finded = false;
//如果parentValues中有匹配的值,说明搜索结果不在当前值下
if (isSearchValueInParent(p)) {
finded = true;
} else {
//从当前值开始搜
finded = search(parentValues, notSelectedValue, result);
p = parentValues;
}
if (finded === true) {
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);
newParents.push(current);
if (self._isMatch(current, keyword)) {
searched && searched.push(newParents);
return true;
}
@ -17353,7 +17387,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
var can = false;
BI.each(children, function (i, child) {
if (search(deep + 1, newParents, child.value, result)) {
if (search(newParents, child.value, result, searched)) {
can = true;
} else {
notSearch.push(child.value);
@ -17369,6 +17403,27 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
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) {
var t = selectedValues;
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;
}
t = t[v];
if (t == null || BI.isEmpty(t)) {
if (BI.isEmpty(t)) {
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) {
var node = self._getNode(parentValues, value)
var node = self._getTreeNode(parentValues, value)
result.push({
id: node.id,
pId: node.pId,
@ -17582,11 +17637,11 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
var times = op.times;
var checkState = op.checkState || {};
var parentValues = op.parentValues || [];
var selectedValues = op.selectedValues;
var selectedValues = op.selectedValues || {};
var valueMap = {};
if (judgeState(parentValues, selectedValues, checkState)) {
valueMap = dealWidthSelectedValue(parentValues, selectedValues);
}
// if (judgeState(parentValues, selectedValues, checkState)) {
valueMap = dealWidthSelectedValue(parentValues, selectedValues);
// }
var nodes = this._getChildren(parentValues);
for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) {
var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState);
@ -17619,7 +17674,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
function dealWidthSelectedValue(parentValues, selectedValues) {
var valueMap = {};
BI.each(parentValues, function (i, v) {
selectedValues = selectedValues[v];
selectedValues = selectedValues[v] || {};
});
BI.each(selectedValues, function (value, 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) {
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;
},
_getNode: function (parentValues, v) {
_getTreeNode: function (parentValues, v) {
var self = this;
var findedParentNode;
var index = 0;
@ -17710,7 +17791,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
_getChildren: function (parentValues) {
if (parentValues.length > 0) {
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 {
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) {
this.pane.setValue(v);
},

30
src/base/combination/combo.js

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

27
src/base/combination/expander.js

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

9
src/base/combination/switcher.js

@ -28,15 +28,20 @@ BI.Switcher = BI.inherit(BI.Widget, {
this._initSwitcher();
this._initPullDownAction();
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) {
self._popupView();
}
if (type === BI.Events.COLLAPSE) {
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.isViewVisible() && self.fireEvent(BI.Switcher.EVENT_COLLAPSE);
}
if (type === BI.Events.CLICK) {
self.fireEvent(BI.Switcher.EVENT_TRIGGER_CHANGE, value, obj);

15
src/base/layer/layer.floatbox.js

@ -105,15 +105,16 @@ BI.FloatBox = BI.inherit(BI.Widget, {
populate: function (sectionProvider) {
var self = this;
if (this.currentSectionProvider && this.currentSectionProvider !== sectionProvider) {
this.currentSectionProvider.destroy();
}
this.currentSectionProvider = sectionProvider;
sectionProvider.rebuildNorth(this._north);
sectionProvider.rebuildCenter(this._center);
sectionProvider.rebuildSouth(this._south);
if (sectionProvider instanceof BI.Widget) {
sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () {
self.close();
})
}
sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () {
self.close();
})
},
show: function () {
@ -136,6 +137,10 @@ BI.FloatBox = BI.inherit(BI.Widget, {
setZindex: function (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) {
// if (e.button === 0) {
if (BI.DOM.isExist(self) && !hand.__isMouseInBounds__(e) && mouseDown === true && !selected) {
self.setSelected(!self.isSelected());
// self.setSelected(!self.isSelected());
self._trigger();
}
mouseDown = false;

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

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

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

@ -399,7 +399,7 @@
url: "",
multiple: true,
accept: "", /**'*.jpg; *.zip'**/
maxSize: 1024 * 1024
maxSize: -1 //1024 * 1024
})
},
@ -475,7 +475,7 @@
}, 1000);
};
_wrap.url = o.url ? o.url : BI.servletURL
+ '?op=fr_attach&cmd=ah_upload';
+ '?op=fr_attach&cmd=ah_upload';
_wrap.fileType = o.accept; //文件类型限制
_wrap.attach_array = [];
_wrap.attach_names = [];

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

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

2
src/base/table/table.collection.cell.js

@ -24,7 +24,7 @@ BI.CollectionTableCell = BI.inherit(BI.Widget, {
this.cell = BI.createWidget(BI.extend({
type: "bi.label"
}, o.cell, {
cls: (o.cell.cls || "") + "collection-table-cell-wrapper",
cls: (o.cell.cls || "") + " collection-table-cell-wrapper",
width: o.width - (o._left === 0 ? 1 : 0) - 1,
height: o.height - (o._top === 0 ? 1 : 0) - 1
}));

66
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;
},
_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 () {
var o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize;
var freezeColLength = this._getFreezeColLength();
summaryColumnSizeArray = [];
BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size;
@ -191,8 +206,8 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size;
}
});
this.topScrollbar.setContentSize(o.items.length * o.rowSize);
this.topScrollbar.setSize(this._height - o.header.length * o.headerRowSize);
this.topScrollbar.setContentSize(this._getActualItems().length * o.rowSize);
this.topScrollbar.setSize(this._height - this._getFreezeHeaderHeight());
this.topScrollbar.setPosition(this.bottomRightCollection.getScrollTop());
this.topScrollbar.populate();
@ -207,7 +222,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
this.rightScrollbar.populate();
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[2].top = this._height;
items[2].left = regionSize;
@ -218,8 +233,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
_populateTable: function () {
var self = this, o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize;
var freezeColLength = this._getFreezeColLength();
summaryColumnSizeArray = [];
BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size;
@ -235,13 +249,13 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
});
var otlw = regionSize;
var otlh = o.header.length * o.headerRowSize;
var otlh = this._getFreezeHeaderHeight();
var otrw = this._width - regionSize;
var otrh = o.header.length * o.headerRowSize;
var otrh = this._getFreezeHeaderHeight();
var oblw = regionSize;
var oblh = this._height - o.header.length * o.headerRowSize;
var oblh = this._height - otlh;
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 tlh = otlh + this._scrollBarSize;
@ -285,9 +299,9 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
var items = this.contextLayout.attr("items");
items[1].left = regionSize;
items[2].top = o.header.length * o.headerRowSize;
items[2].top = this._getFreezeHeaderHeight();
items[3].left = regionSize;
items[3].top = o.header.length * o.headerRowSize;
items[3].top = this._getFreezeHeaderHeight();
this.contextLayout.attr("items", items);
this.contextLayout.resize();
@ -303,8 +317,8 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
};
run(this.topLeftItems, o.header, leftHeader);
run(this.topRightItems, o.header, rightHeader);
run(this.bottomLeftItems, o.items, leftItems);
run(this.bottomRightItems, o.items, rightItems);
run(this.bottomLeftItems, this._getActualItems(), leftItems);
run(this.bottomRightItems, this._getActualItems(), rightItems);
this.topLeftCollection._populate(leftHeader);
this.topRightCollection._populate(rightHeader);
@ -315,13 +329,23 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
_digest: function () {
var o = this.options;
var freezeColLength = this._getFreezeColLength();
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.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);
//如果表头位置不够,取消表头冻结
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.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.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 result = [], cache = {}, preCol = {}, preRow = {}, map = {};
var summaryColumnSize = [];
@ -371,7 +395,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
}
cache[i][j] = cols[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) {
createOneEl(0, startCol);
} 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({
type: "bi.grid_view",
rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnLeftWidthGetter,
columnWidthGetter: columnLeftWidthGetter
});
this.topLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomLeftGrid.setScrollLeft(scroll.scrollLeft);
@ -47,7 +47,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.topRightGrid = BI.createWidget({
type: "bi.grid_view",
rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnRightWidthGetter,
columnWidthGetter: columnRightWidthGetter
});
this.topRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomRightGrid.setScrollLeft(scroll.scrollLeft);
@ -57,7 +57,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.bottomLeftGrid = BI.createWidget({
type: "bi.grid_view",
rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnLeftWidthGetter,
columnWidthGetter: columnLeftWidthGetter
});
this.bottomLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomRightGrid.setScrollTop(scroll.scrollTop);
@ -68,7 +68,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.bottomRightGrid = BI.createWidget({
type: "bi.grid_view",
rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnRightWidthGetter,
columnWidthGetter: columnRightWidthGetter
});
this.bottomRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomLeftGrid.setScrollTop(scroll.scrollTop);
@ -156,7 +156,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
el: this.leftScrollbar,
left: 0
}, {
el: this.rightScrollbar,
el: this.rightScrollbar
}]
});
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;
},
_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 () {
var o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize;
var freezeColLength = this._getFreezeColLength();
summaryColumnSizeArray = [];
BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size;
@ -194,8 +209,8 @@ BI.GridTable = BI.inherit(BI.Widget, {
summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size;
}
});
this.topScrollbar.setContentSize(o.items.length * o.rowSize);
this.topScrollbar.setSize(this._height - o.header.length * o.headerRowSize);
this.topScrollbar.setContentSize(this._getActualItems().length * o.rowSize);
this.topScrollbar.setSize(this._height - this._getFreezeHeaderHeight());
this.topScrollbar.setPosition(Math.min(this.bottomLeftGrid.getScrollTop(), this.bottomRightGrid.getScrollTop()));
this.topScrollbar.populate();
@ -210,7 +225,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.rightScrollbar.populate();
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[2].top = this._height;
items[2].left = regionSize;
@ -244,7 +259,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
var o = this.options;
var freezeColLength = this._getFreezeColLength();
var leftItems = [], rightItems = [];
BI.each(o.items, function (i, cols) {
BI.each(this._getActualItems(), function (i, cols) {
leftItems[i] = [];
rightItems[i] = [];
BI.each(cols, function (j, col) {
@ -265,7 +280,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
_populateTable: function () {
var self = this, o = this.options;
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) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
@ -282,13 +297,13 @@ BI.GridTable = BI.inherit(BI.Widget, {
});
var otlw = regionSize;
var otlh = o.header.length * o.headerRowSize;
var otlh = this._getFreezeHeaderHeight();
var otrw = this._width - regionSize;
var otrh = o.header.length * o.headerRowSize;
var otrh = this._getFreezeHeaderHeight();
var oblw = regionSize;
var oblh = this._height - o.header.length * o.headerRowSize;
var oblh = this._height - otlh;
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 tlh = otlh + this._scrollBarSize;
@ -341,9 +356,9 @@ BI.GridTable = BI.inherit(BI.Widget, {
var items = this.contextLayout.attr("items");
items[1].left = regionSize;
items[2].top = o.header.length * o.headerRowSize;
items[2].top = this._getFreezeHeaderHeight();
items[3].left = regionSize;
items[3].top = o.header.length * o.headerRowSize;
items[3].top = this._getFreezeHeaderHeight();
this.contextLayout.attr("items", items);
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), {
baseCls: "bi-resizable-table-cell",
cell: {},
minSize: 15,
// suitableSize,
maxSize: Number.MAX_VALUE,
start: BI.emptyFn,
resize: BI.emptyFn,
stop: BI.emptyFn
@ -24,22 +27,37 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
var startDrag = false;
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) {
if (mouseMoveTracker.isDragging()) {
startDrag = true;
offset += deltaX;
size = BI.clamp(defaultSize + offset, 15, Number.MAX_VALUE);
size = optimizeSize(defaultSize + offset);
self.handler.element.addClass("dragging");
o.resize(size);
}
}, function () {
if (startDrag === true) {
size = BI.clamp(size, 15, Number.MAX_VALUE);
size = optimizeSize(size);
o.stop(size);
size = 0;
offset = 0;
defaultSize = o.width;
self.handler.element.removeClass("dragging");
self.handler.element.removeClass("suitable");
startDrag = false;
}
mouseMoveTracker.releaseMouseMoves();

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

@ -22,6 +22,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
mergeCols: [],
mergeRule: BI.emptyFn,
columnSize: [],
minColumnSize: [],
maxColumnSize: [],
freezeCols: [],
header: [],
items: [],
@ -214,7 +216,13 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
self.resizer.setVisible(true);
var height = o.headerRowSize + self._getRegionRowSize()[1];
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);
};
var stop = function (j, size) {
@ -237,6 +245,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
result[i][j] = {
type: "bi.resizable_table_cell",
cell: col,
suitableSize: o.minColumnSize[i],
maxSize: o.maxColumnSize[i],
resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j)
};
@ -246,6 +256,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
result[r - 1][j] = {
type: "bi.resizable_table_cell",
cell: result[r - 1][j],
suitableSize: o.minColumnSize[i],
maxSize: o.maxColumnSize[i],
resize: BI.bind(resize, 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) {
} else {
var tNode = treeNode;
var pNode = this._getTree(this.selectedValues, parentValues);
var pNode = this._getTree(this.options.paras.selectedValues, parentValues);
if (BI.isNotNull(pNode[name])) {
delete pNode[name];
}
@ -113,7 +113,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
parentValues = parentValues.slice(0, parentValues.length - 1);
tNode = tNode.getParentNode();
if (tNode != null) {
pNode = this._getTree(this.selectedValues, parentValues);
pNode = this._getTree(this.options.paras.selectedValues, parentValues);
name = this._getNodeValue(tNode);
delete pNode[name];
}
@ -127,10 +127,10 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
var self = this, o = this.options;
var parentValues = treeNode.parentValues || self._getParentValues(treeNode);
var op = BI.extend({}, o.paras, {
"id": treeNode.id,
"times": 1,
"parentValues": parentValues.concat(this._getNodeValue(treeNode)),
"checkState": treeNode.getCheckStatus()
id: treeNode.id,
times: 1,
parentValues: parentValues.concat(this._getNodeValue(treeNode)),
checkState: treeNode.getCheckStatus()
});
var complete = function (d) {
var nodes = d.items || [];
@ -178,7 +178,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
},
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 () {
@ -187,20 +187,18 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
}
var checkedValues = this._getSelectedValues();
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 this._join(checkedValues, this.selectedValues);
return this._join(checkedValues, this.options.paras.selectedValues);
},
//生成树方法
stroke: function (config) {
delete this.options.keyword;
BI.extend(this.options.paras, config);
//取消选中时使用
this.selectedValues = BI.deepClone(this.options.paras.selectedValues) || {};
var setting = this._configSetting();
this._initTree(setting);
}

37
src/base/tree/parttree.js

@ -40,34 +40,28 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
_selectTreeNode: function (treeId, treeNode) {
var self = this, o = this.options;
var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var name = this._getNodeValue(treeNode)
// var values = parentValues.concat([name]);
var name = this._getNodeValue(treeNode);
if (treeNode.checked === true) {
BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
} 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, {
type: BI.TreeView.REQ_TYPE_SELECT_DATA,
selectedValues: this.selectedValues,
notSelectedValue: name,
parentValues: parentValues
}), function (new_values) {
if (BI.isEqual(self.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;
self.options.paras.selectedValues = new_values;
BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
});
}
@ -164,9 +158,6 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
delete o.paras.keyword;
BI.extend(o.paras, config);
delete o.paras.lastSearchValue;
//取消选中时使用
this.selectedValues = BI.deepClone(o.paras.selectedValues) || {};
//delete this.options.paras.selectedValues;
var setting = this._configSetting();
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) {
//去除标红
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) {
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);
},
@ -445,15 +455,13 @@ BI.TreeView = BI.inherit(BI.Pane, {
//设置树节点的状态
setValue: function (value, param) {
this.setSelectedValue(value);
this.checkAll(false);
this.updateValue(value, param);
this.refresh();
},
setSelectedValue: function (value) {
this.options.paras.selectedValues = BI.deepClone(value) || {};
this.selectedValues = BI.deepClone(value) || {};
this.options.paras.selectedValues = BI.deepClone(value || {});
},
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;
}
});
this.clipboard.on("success", function (e) {
o.afterCopy();
})
this.clipboard.on("success", o.afterCopy)
} else {
this.element.zclip({
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,
direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
isDefaultInit: false,
destroyWhenHide: false,
isNeedAdjustHeight: true,//是否需要高度调整
isNeedAdjustWidth: true,
stopPropagation: false,
@ -37,6 +38,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
toggle: o.toggle,
direction: o.direction,
isDefaultInit: o.isDefaultInit,
destroyWhenHide: o.destroyWhenHide,
isNeedAdjustHeight: o.isNeedAdjustHeight,
isNeedAdjustWidth: o.isNeedAdjustWidth,
adjustLength: this._getAdjustLength(),
@ -87,37 +89,40 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
_createTriangle: function (direction) {
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) {
case "left":
pos = {
top: 0,
bottom: 0,
left: -adjustLength
top: top,
height: this.element.outerHeight(),
left: left - adjustLength - this._const.TRIANGLE_LENGTH
};
op = {width: this._const.TRIANGLE_LENGTH};
break;
case "right":
pos = {
top: 0,
bottom: 0,
right: -adjustLength
top: top,
height: this.element.outerHeight(),
left: right + adjustLength
};
op = {width: this._const.TRIANGLE_LENGTH};
break;
case "top":
pos = {
left: 0,
right: 0,
top: -adjustLength
left: left,
width: this.element.outerWidth(),
top: top - adjustLength - this._const.TRIANGLE_LENGTH
};
op = {height: this._const.TRIANGLE_LENGTH};
break;
case "bottom":
pos = {
left: 0,
right: 0,
bottom: -adjustLength
left: left,
width: this.element.outerWidth(),
top: bottom + adjustLength
};
op = {height: this._const.TRIANGLE_LENGTH};
break;
@ -126,6 +131,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
}
this.triangle = BI.createWidget(op, {
type: "bi.center_adapt",
cls: "button-combo-triangle-wrapper",
items: [{
type: "bi.layout",
cls: "bubble-combo-triangle-" + direction + " bi-high-light-border"
@ -183,7 +189,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
_hideTriangle: function () {
this.triangle && this.triangle.destroy();
this.combo.getView().hideLine();
this.combo.getView() && this.combo.getView().hideLine();
},
hideView: function () {

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

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

106
src/component/treevaluechooser/abstract.treevaluechooser.js

@ -77,7 +77,7 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
return;
}
BI.each(selected, function (k) {
var node = self._getNode(parentValues, k);
var node = self._getTreeNode(parentValues, k);
var newParents = BI.clone(parentValues);
newParents.push(node.value);
createOneJson(node, BI.last(parentValues), getCount(selected[k], newParents));
@ -109,7 +109,7 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
_reqSelectedTreeNode: function (op, callback) {
var self = this;
var selectedValues = op.selectedValues;
var selectedValues = BI.deepClone(op.selectedValues);
var notSelectedValue = op.notSelectedValue || {};
var keyword = op.keyword || "";
var parentValues = op.parentValues || [];
@ -124,12 +124,34 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
function dealWithSelectedValues(selectedValues) {
var p = BI.clone(parentValues);
p.push(notSelectedValue);
var p = parentValues.concat(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)) {
var result = [];
var finded = search(parentValues.length + 1, parentValues, notSelectedValue, result);
var result = [], finded = false;
//如果parentValues中有匹配的值,说明搜索结果不在当前值下
if (isSearchValueInParent(p)) {
finded = true;
} else {
//从当前值开始搜
finded = search(parentValues, notSelectedValue, result);
p = parentValues;
}
if (finded === true) {
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);
newParents.push(current);
if (self._isMatch(current, keyword)) {
searched && searched.push(newParents);
return true;
}
@ -178,7 +201,7 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
var can = false;
BI.each(children, function (i, child) {
if (search(deep + 1, newParents, child.value, result)) {
if (search(newParents, child.value, result, searched)) {
can = true;
} else {
notSearch.push(child.value);
@ -194,6 +217,27 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
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) {
var t = selectedValues;
for (var i = 0; i < parents.length; i++) {
@ -202,11 +246,11 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
return false;
}
t = t[v];
if (t == null || BI.isEmpty(t)) {
if (BI.isEmpty(t)) {
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) {
var node = self._getNode(parentValues, value)
var node = self._getTreeNode(parentValues, value)
result.push({
id: node.id,
pId: node.pId,
@ -407,11 +451,11 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
var times = op.times;
var checkState = op.checkState || {};
var parentValues = op.parentValues || [];
var selectedValues = op.selectedValues;
var selectedValues = op.selectedValues || {};
var valueMap = {};
if (judgeState(parentValues, selectedValues, checkState)) {
valueMap = dealWidthSelectedValue(parentValues, selectedValues);
}
// if (judgeState(parentValues, selectedValues, checkState)) {
valueMap = dealWidthSelectedValue(parentValues, selectedValues);
// }
var nodes = this._getChildren(parentValues);
for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) {
var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState);
@ -444,7 +488,7 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
function dealWidthSelectedValue(parentValues, selectedValues) {
var valueMap = {};
BI.each(parentValues, function (i, v) {
selectedValues = selectedValues[v];
selectedValues = selectedValues[v] || {};
});
BI.each(selectedValues, function (value, 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) {
var t = jo;
@ -508,7 +578,7 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
return finded.finded.length > 0 || finded.matched.length > 0;
},
_getNode: function (parentValues, v) {
_getTreeNode: function (parentValues, v) {
var self = this;
var findedParentNode;
var index = 0;
@ -535,7 +605,7 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
_getChildren: function (parentValues) {
if (parentValues.length > 0) {
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 {
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) {
this.pane.setValue(v);
},

9
src/core/model.js

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

7
src/core/mvc/fbi.js

@ -300,12 +300,9 @@
return {}
},
init: function () {
},
// _init is an empty function by default. Override it with your own
// initialization logic.
_init: function () {
this.init();
},
// Return a copy of the model's `attributes` object.
@ -1153,9 +1150,9 @@
setVisible: function (visible) {
this.options.invisible = !visible;
if (visible) {
this.element.show();
this.element.css("display", "");
} 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, {
props: {},
init: null,
destroyed: null,
_defaultConfig: function (config) {
return {};
@ -134,5 +135,10 @@ $.extend(BI.OB.prototype, {
}
}
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, {
//生命周期函数
beforeCreate: null,
created: null,
destroyed: null,
_init: function () {
BI.View.superclass._init.apply(this, arguments);
this.beforeCreate && this.beforeCreate();
var self = this;
this.listenTo(this.model, "change:current", function (obj, val) {
if (BI.isNotNull(val) && val.length > 0) {
@ -50,7 +58,8 @@ BI.View = BI.inherit(BI.V, {
return f.apply(this, arguments);
}, self);
}
})
});
this.created && this.created();
},
change: function (changed, prev) {
@ -495,7 +504,7 @@ BI.View = BI.inherit(BI.V, {
});
delete this._cardLayouts;
delete this._cards;
this.destroyed();
this.destroyed && this.destroyed();
this.off();
},
@ -505,13 +514,9 @@ BI.View = BI.inherit(BI.V, {
});
delete this._cardLayouts;
delete this._cards;
this.destroyed();
this.destroyed && this.destroyed();
this.remove();
this.trigger(BI.Events.DESTROY);
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) {
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) {
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) {
this._manualSetEnable = true;
this._setEnable(enable);
if (enable === true) {
this.element.removeClass("base-disabled disabled");
@ -224,20 +233,19 @@ BI.Widget = BI.inherit(BI.OB, {
},
setVisible: function (visible) {
this._setVisible(visible);
if (visible === true) {
this.options.invisible = false;
//用this.element.show()会把display属性改成block
this.element.css("display", "");
this._mount();
} else if (visible === false) {
this.options.invisible = true;
this.element.css("display", "none");
}
this.fireEvent(BI.Events.VIEW, visible);
},
setValid: function (valid) {
this.options.invalid = !valid;
this._manualSetValid = true;
this._setValid(valid);
if (valid === true) {
this.element.removeClass("base-invalid invalid");

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

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

13
src/css/resource/app.css

@ -1,19 +1,6 @@
/****添加计算宽度的--运算符直接需要space****/
/****** common 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,
button,
input,

13
src/css/resource/font.css

@ -1,5 +1,18 @@
/****** common 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 {
*zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = '&#xe600');
}

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

@ -1,16 +1,23 @@
@import "../../bibase";
.bi-bubble-combo {
& .button-combo-triangle-wrapper {
position: fixed !important;
}
& .bubble-combo-triangle-left {
z-index: 1;
.solid-triangle-right(@color-bi-background-highlight);
}
& .bubble-combo-triangle-right {
z-index: 1;
.solid-triangle-left(@color-bi-background-highlight);
}
& .bubble-combo-triangle-top {
z-index: 1;
.solid-triangle-down(@color-bi-background-highlight);
}
& .bubble-combo-triangle-bottom {
z-index: 1;
.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;
}
}
&.suitable{
& .resizable-table-cell-resizer-knob {
background-color: @color-bi-background-success;
}
}
}
}

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

@ -1,10 +1,13 @@
@import "../../bibase";
.bi-resizable-table {
& .resizable-table-resizer{
& .resizable-table-resizer {
cursor: ew-resize;
z-index: 1;
background-color: @color-bi-background-highlight;
&.suitable {
background-color: @color-bi-background-success;
}
}
& .resizable-table-region-resizer {
cursor: ew-resize;

7
src/less/lib/constant.less

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

13
src/less/resource/app.less

@ -1,18 +1,5 @@
@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,
button,
input,

13
src/less/resource/font.less

@ -2,6 +2,19 @@
@import "../lib/colors";
@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-hover(close-h-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:
if (this._isArrangeFine()) {
var width = this.getClientWidth(), height = this.getClientHeight();
var isHeightAdjust = height > occupied.top + occupied.height;
var isHeightAdjust = height > occupied.height;
var regions = this._cloneRegion();
BI.each(regions, function (i, region) {
region.width = region.width / occupied.width * width;
@ -2934,7 +2934,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
BI.Arrangement.EVENT_SCROLL = "EVENT_SCROLL";
BI.extend(BI.Arrangement, {
PORTION: 24,
GRID_HEIGHT: 50,
GRID_HEIGHT: 60,
LAYOUT_TYPE: {
ADAPTIVE: 0,
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) {
this.popupview.populate(items);
},

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

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

42
src/widget/multiselecttree/multiselecttree.js

@ -19,34 +19,36 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
itemsCreator: o.itemsCreator
});
this.adapter.on(BI.MultiSelectTreePopup.EVENT_CHANGE, function () {
if (self.trigger.isSearching()) {
if (self.searcher.isSearching()) {
self.storeValue = {value: self.searcherPane.getValue()};
} else {
self.storeValue = {value: self.adapter.getValue()};
}
self.setSelectedValue(self.storeValue.value);
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",
cls: "bi-border-left bi-border-right bi-border-bottom",
keywordGetter: function () {
return self.trigger.getKeyword();
return self.searcher.getKeyword();
},
itemsCreator: function (op, callback) {
op.keyword = self.trigger.getKeyword();
op.keyword = self.searcher.getKeyword();
o.itemsCreator(op, callback);
}
});
this.searcherPane.setVisible(false);
this.trigger = BI.createWidget({
this.searcher = BI.createWidget({
type: "bi.searcher",
isAutoSearch: false,
isAutoSync: false,
onSearch: function (op, callback) {
callback({
keyword: self.trigger.getKeyword()
keyword: self.searcher.getKeyword()
});
},
adapter: this.adapter,
@ -56,15 +58,15 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
eventName: BI.Searcher.EVENT_START,
action: function () {
self._showSearcherPane();
self.storeValue = {value: self.adapter.getValue()};
self.searcherPane.setValue(self.storeValue);
// self.storeValue = {value: self.adapter.getValue()};
// self.searcherPane.setSelectedValue(self.storeValue.value);
}
}, {
eventName: BI.Searcher.EVENT_STOP,
action: function () {
self._showAdapter();
// self.storeValue = {value: self.searcherPane.getValue()};
self.adapter.setValue(self.storeValue);
// self.adapter.setSelectedValue(self.storeValue.value);
BI.nextTick(function () {
self.adapter.populate();
});
@ -72,11 +74,12 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
}, {
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
if (self.trigger.isSearching()) {
if (self.searcher.isSearching()) {
self.storeValue = {value: self.searcherPane.getValue()};
} else {
self.storeValue = {value: self.adapter.getValue()};
}
self.setSelectedValue(self.storeValue.value);
self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE);
}
}, {
@ -91,7 +94,7 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
type: "bi.vtape",
element: this,
items: [{
el: this.trigger,
el: this.searcher,
height: 30
}, {
el: this.adapter,
@ -126,18 +129,21 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
},
setValue: function (v) {
setSelectedValue: function (v) {
this.storeValue.value = v || {};
this.adapter.setValue({
value: v || {}
});
this.trigger.setValue({
this.adapter.setSelectedValue(v);
this.searcherPane.setSelectedValue(v);
this.searcher.setValue({
value: v || {}
});
},
setValue: function (v) {
this.adapter.setValue(v);
},
stopSearch: function () {
this.trigger.stopSearch();
this.searcher.stopSearch();
},
updateValue: function (v) {
@ -149,7 +155,7 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
},
populate: function () {
this.trigger.populate.apply(this.trigger, arguments);
this.searcher.populate.apply(this.searcher, 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) {
v || (v = {});
this.popup.setValue(v.value);
this.popup.setValue(v);
},
setSelectedValue: function (v) {
v || (v = {});
this.popup.setSelectedValue(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,
action: function () {
self._defaultState();
self.combo.hideView();
}
}, {
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) {
this.setSelectedValue(v.value);
},
setSelectedValue: function (v) {
v || (v = {});
this.partTree.setSelectedValue(v.value);
this.partTree.setSelectedValue(v);
},
getValue: function () {

Loading…
Cancel
Save