diff --git a/bi/base.css b/bi/base.css index 1ced609f6..5d30a881e 100644 --- a/bi/base.css +++ b/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; diff --git a/bi/base.js b/bi/base.js index 9f79c10d1..c5c7353c3 100644 --- a/bi/base.js +++ b/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) }; diff --git a/bi/case.js b/bi/case.js index b70256eb6..7090b6ee8 100644 --- a/bi/case.js +++ b/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); diff --git a/bi/core.js b/bi/core.js index 2e88efc9b..87cdaf46e 100644 --- a/bi/core.js +++ b/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 () { diff --git a/bi/widget.js b/bi/widget.js index 37afe2e44..dd99f936f 100644 --- a/bi/widget.js +++ b/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); }, diff --git a/docs/base.css b/docs/base.css index 1ced609f6..5d30a881e 100644 --- a/docs/base.css +++ b/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; diff --git a/docs/base.js b/docs/base.js index 9f79c10d1..c5c7353c3 100644 --- a/docs/base.js +++ b/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) }; diff --git a/docs/case.js b/docs/case.js index b70256eb6..7090b6ee8 100644 --- a/docs/case.js +++ b/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); diff --git a/docs/core.js b/docs/core.js index 854962a55..b89a7f08d 100644 --- a/docs/core.js +++ b/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 () { diff --git a/docs/resource.css b/docs/resource.css index 0e32ac8cc..534b4c244 100644 --- a/docs/resource.css +++ b/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 = ''); } diff --git a/docs/widget.js b/docs/widget.js index 37afe2e44..dd99f936f 100644 --- a/docs/widget.js +++ b/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); }, diff --git a/src/base/combination/combo.js b/src/base/combination/combo.js index 7a43f7070..2f79b2930 100644 --- a/src/base/combination/combo.js +++ b/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(); }, diff --git a/src/base/combination/expander.js b/src/base/combination/expander.js index 5bfdb89a1..8c57326af 100644 --- a/src/base/combination/expander.js +++ b/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(); }, diff --git a/src/base/combination/switcher.js b/src/base/combination/switcher.js index f279eaabb..a4edaec70 100644 --- a/src/base/combination/switcher.js +++ b/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); diff --git a/src/base/layer/layer.floatbox.js b/src/base/layer/layer.floatbox.js index c015e76eb..8f4b7002a 100644 --- a/src/base/layer/layer.floatbox.js +++ b/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(); } }); diff --git a/src/base/single/button/button.basic.js b/src/base/single/button/button.basic.js index c5de615f5..db0e4b3ab 100644 --- a/src/base/single/button/button.basic.js +++ b/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; diff --git a/src/base/single/editor/editor.multifile.js b/src/base/single/editor/editor.multifile.js index dd25c7c0e..b004217ec 100644 --- a/src/base/single/editor/editor.multifile.js +++ b/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: "" }) diff --git a/src/base/single/input/file.js b/src/base/single/input/file.js index 8b4d57a11..8f4c75f83 100644 --- a/src/base/single/input/file.js +++ b/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 = []; diff --git a/src/base/single/tip/tip.bubble.js b/src/base/single/tip/tip.bubble.js index 715d60231..425578a00 100644 --- a/src/base/single/tip/tip.bubble.js +++ b/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", diff --git a/src/base/table/table.collection.cell.js b/src/base/table/table.collection.cell.js index 7a1ebae85..5c5105399 100644 --- a/src/base/table/table.collection.cell.js +++ b/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 })); diff --git a/src/base/table/table.collection.js b/src/base/table/table.collection.js index 63da1b991..ee5aea9aa 100644 --- a/src/base/table/table.collection.js +++ b/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) { diff --git a/src/base/table/table.grid.js b/src/base/table/table.grid.js index 7454fafd2..1eae8487b 100644 --- a/src/base/table/table.grid.js +++ b/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(); diff --git a/src/base/table/table.resizable.cell.js b/src/base/table/table.resizable.cell.js index ad8c08a03..cd1d565c8 100644 --- a/src/base/table/table.resizable.cell.js +++ b/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(); diff --git a/src/base/table/table.resizable.js b/src/base/table/table.resizable.js index 1055ef37a..bca89e215 100644 --- a/src/base/table/table.resizable.js +++ b/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) }; diff --git a/src/base/tree/asynctree.js b/src/base/tree/asynctree.js index 301b59963..62bdcae61 100644 --- a/src/base/tree/asynctree.js +++ b/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); } diff --git a/src/base/tree/parttree.js b/src/base/tree/parttree.js index d628cd72c..adc7088dc 100644 --- a/src/base/tree/parttree.js +++ b/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); } diff --git a/src/base/tree/treeview.js b/src/base/tree/treeview.js index 0326b38ae..6ada95083 100644 --- a/src/base/tree/treeview.js +++ b/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) { diff --git a/src/case/clipboard/index.js b/src/case/clipboard/index.js index 1b9327d08..314cf2e5e 100644 --- a/src/case/clipboard/index.js +++ b/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", diff --git a/src/case/combo/bubblecombo/combo.bubble.js b/src/case/combo/bubblecombo/combo.bubble.js index 8801475f2..55fcd60d3 100644 --- a/src/case/combo/bubblecombo/combo.bubble.js +++ b/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 () { diff --git a/src/case/table/table.dynamicsummarylayertree.js b/src/case/table/table.dynamicsummarylayertree.js index da02b8c14..7377c8956 100644 --- a/src/case/table/table.dynamicsummarylayertree.js +++ b/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); diff --git a/src/component/treevaluechooser/abstract.treevaluechooser.js b/src/component/treevaluechooser/abstract.treevaluechooser.js index 41699b41e..e32b1fdd1 100644 --- a/src/component/treevaluechooser/abstract.treevaluechooser.js +++ b/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(); } diff --git a/src/component/treevaluechooser/pane.treevaluechooser.js b/src/component/treevaluechooser/pane.treevaluechooser.js index dd924c925..c0ebb8f32 100644 --- a/src/component/treevaluechooser/pane.treevaluechooser.js +++ b/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); }, diff --git a/src/core/model.js b/src/core/model.js index 7c8ced029..a45cfb5e1 100644 --- a/src/core/model.js +++ b/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 () { diff --git a/src/core/mvc/fbi.js b/src/core/mvc/fbi.js index a00ec13c7..948b2b143 100644 --- a/src/core/mvc/fbi.js +++ b/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"); } }, diff --git a/src/core/ob.js b/src/core/ob.js index bb71c3874..51848c34f 100644 --- a/src/core/ob.js +++ b/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(); } }); \ No newline at end of file diff --git a/src/core/view.js b/src/core/view.js index f5e5f2311..5912819cd 100644 --- a/src/core/view.js +++ b/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 () { - } }); \ No newline at end of file diff --git a/src/core/widget.js b/src/core/widget.js index dd9f56b3c..610b38492 100644 --- a/src/core/widget.js +++ b/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"); diff --git a/src/css/base/combo/combo.bubble.css b/src/css/base/combo/combo.bubble.css index 88aaf0f0e..bb4e3c4db 100644 --- a/src/css/base/combo/combo.bubble.css +++ b/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; diff --git a/src/css/base/table/table.resizable.cell.css b/src/css/base/table/table.resizable.cell.css index d080f2994..214340d95 100644 --- a/src/css/base/table/table.resizable.cell.css +++ b/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; +} diff --git a/src/css/base/table/table.resizable.css b/src/css/base/table/table.resizable.css index 71921f5f6..fc7321608 100644 --- a/src/css/base/table/table.resizable.css +++ b/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; diff --git a/src/css/resource/app.css b/src/css/resource/app.css index 76b863206..bdc9f44d8 100644 --- a/src/css/resource/app.css +++ b/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, diff --git a/src/css/resource/font.css b/src/css/resource/font.css index 9015e9501..27409046b 100644 --- a/src/css/resource/font.css +++ b/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 = ''); } diff --git a/src/less/base/combo/combo.bubble.less b/src/less/base/combo/combo.bubble.less index 8eac71cea..da74aef0c 100644 --- a/src/less/base/combo/combo.bubble.less +++ b/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); } } \ No newline at end of file diff --git a/src/less/base/table/table.resizable.cell.less b/src/less/base/table/table.resizable.cell.less index ea7ca49fb..63d67d400 100644 --- a/src/less/base/table/table.resizable.cell.less +++ b/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; + } + } } } \ No newline at end of file diff --git a/src/less/base/table/table.resizable.less b/src/less/base/table/table.resizable.less index 737a5e8db..d9ad74635 100644 --- a/src/less/base/table/table.resizable.less +++ b/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; diff --git a/src/less/lib/constant.less b/src/less/lib/constant.less index 81c5fa713..77b403fb1 100644 --- a/src/less/lib/constant.less +++ b/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;// diff --git a/src/less/resource/app.less b/src/less/resource/app.less index 2d73ca063..f9e045636 100644 --- a/src/less/resource/app.less +++ b/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, diff --git a/src/less/resource/font.less b/src/less/resource/font.less index 1d63e9402..603ef3fef 100644 --- a/src/less/resource/font.less +++ b/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); diff --git a/src/widget/arrangement/arrangement.js b/src/widget/arrangement/arrangement.js index a4fbcba47..96514ce62 100644 --- a/src/widget/arrangement/arrangement.js +++ b/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, diff --git a/src/widget/downlist/combo.downlist.js b/src/widget/downlist/combo.downlist.js index ed37eb40c..2481a8ba7 100644 --- a/src/widget/downlist/combo.downlist.js +++ b/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); }, diff --git a/src/widget/downlist/item.downlistgroup.js b/src/widget/downlist/item.downlistgroup.js index 59a301e1d..8d55da9f4 100644 --- a/src/widget/downlist/item.downlistgroup.js +++ b/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); } }) diff --git a/src/widget/multiselecttree/multiselecttree.js b/src/widget/multiselecttree/multiselecttree.js index 320036436..54653c10f 100644 --- a/src/widget/multiselecttree/multiselecttree.js +++ b/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); } }); diff --git a/src/widget/multiselecttree/multiselecttree.popup.js b/src/widget/multiselecttree/multiselecttree.popup.js index 2ccdd977e..b6e3e55a2 100644 --- a/src/widget/multiselecttree/multiselecttree.popup.js +++ b/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) { diff --git a/src/widget/multitree/multi.tree.combo.js b/src/widget/multitree/multi.tree.combo.js index d2bd72edf..3c98f2c52 100644 --- a/src/widget/multitree/multi.tree.combo.js +++ b/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, diff --git a/src/widget/multitree/multi.tree.search.pane.js b/src/widget/multitree/multi.tree.search.pane.js index 07e663a87..b02dcb94a 100644 --- a/src/widget/multitree/multi.tree.search.pane.js +++ b/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 () {