diff --git a/bi/base.js b/bi/base.js index 382be5a933..9c789c2538 100644 --- a/bi/base.js +++ b/bi/base.js @@ -881,9 +881,14 @@ BI.BasicButton = BI.inherit(BI.Single, { return this.options.text; }, - setEnable: function (b) { - BI.BasicButton.superclass.setEnable.apply(this, arguments); - if (!b) { + _setEnable: function (enable) { + BI.BasicButton.superclass._setEnable.apply(this, arguments); + if (enable === true) { + this.element.removeClass("base-disabled disabled"); + } else if (enable === false) { + this.element.addClass("base-disabled disabled"); + } + if (!enable) { if (this.options.shadow) { this.$mask && this.$mask.setVisible(false); } @@ -1166,13 +1171,6 @@ BI.ButtonGroup = BI.inherit(BI.Widget, { this.layouts = BI.createWidget(BI.extend({element: this}, this._packageLayout(items))); }, - setEnable: function (b) { - BI.ButtonGroup.superclass.setEnable.apply(this, arguments); - BI.each(this.buttons, function (i, item) { - item.setEnable(b); - }); - }, - setNotSelectedValue: function (v) { v = BI.isArray(v) ? v : [v]; BI.each(this.buttons, function (i, item) { @@ -2511,15 +2509,15 @@ BI.Canvas = BI.inherit(BI.Widget, { } }); BI.shortcut("bi.canvas", BI.Canvas);/** - * Collection + * CollectionView * * Created by GUY on 2016/1/15. - * @class BI.Collection + * @class BI.CollectionView * @extends BI.Widget */ -BI.Collection = BI.inherit(BI.Widget, { +BI.CollectionView = BI.inherit(BI.Widget, { _defaultConfig: function () { - return BI.extend(BI.Collection.superclass._defaultConfig.apply(this, arguments), { + return BI.extend(BI.CollectionView.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-collection", width: 400, height: 300, @@ -2535,7 +2533,7 @@ BI.Collection = BI.inherit(BI.Widget, { }, _init: function () { - BI.Collection.superclass._init.apply(this, arguments); + BI.CollectionView.superclass._init.apply(this, arguments); var self = this, o = this.options; this.renderedCells = []; this.renderedKeys = []; @@ -2554,7 +2552,7 @@ BI.Collection = BI.inherit(BI.Widget, { o.scrollLeft = self.element.scrollLeft(); o.scrollTop = self.element.scrollTop(); self._calculateChildrenToRender(); - self.fireEvent(BI.Collection.EVENT_SCROLL, { + self.fireEvent(BI.CollectionView.EVENT_SCROLL, { scrollLeft: o.scrollLeft, scrollTop: o.scrollTop }); @@ -2639,7 +2637,7 @@ BI.Collection = BI.inherit(BI.Widget, { return; } var childrenToDisplay = this._cellRenderers(bottom - top, right - left, left, top); - var renderedCells = [], renderedKeys = []; + var renderedCells = [], renderedKeys = [], renderedWidgets = {}; //存储所有的left和top var lefts = {}, tops = {}; for (var i = 0, len = childrenToDisplay.length; i < len; i++) { @@ -2722,6 +2720,7 @@ BI.Collection = BI.inherit(BI.Widget, { } renderedKeys.push(datum.index); + renderedWidgets[i] = child; } //已存在的, 需要添加的和需要删除的 var existSet = {}, addSet = {}, deleteArray = []; @@ -2742,13 +2741,17 @@ BI.Collection = BI.inherit(BI.Widget, { deleteArray.push(i); }); BI.each(deleteArray, function (i, index) { - self.renderedCells[index].el.destroy(); + //性能优化,不调用destroy方法防止触发destroy事件 + self.renderedCells[index].el._destroy(); }); var addedItems = []; BI.each(addSet, function (index) { addedItems.push(renderedCells[index]) }); this.container.addItems(addedItems); + //拦截父子级关系 + this.container._children = renderedWidgets; + this.container.attr("items", renderedCells); this.renderedCells = renderedCells; this.renderedKeys = renderedKeys; @@ -2859,8 +2862,8 @@ BI.Collection = BI.inherit(BI.Widget, { this._populate(); } }); -BI.Collection.EVENT_SCROLL = "EVENT_SCROLL"; -BI.shortcut('bi.collection_view', BI.Collection);/** +BI.CollectionView.EVENT_SCROLL = "EVENT_SCROLL"; +BI.shortcut('bi.collection_view', BI.CollectionView);/** * @class BI.Combo * @extends BI.Widget */ @@ -3187,10 +3190,8 @@ BI.Combo = BI.inherit(BI.Widget, { this.combo.populate.apply(this.combo, arguments); }, - setEnable: function (arg) { - BI.Combo.superclass.setEnable.apply(this, arguments); - this.combo && this.combo.setEnable(arg); - this.popupView && this.popupView.setEnable(arg); + _setEnable: function (arg) { + BI.Combo.superclass._setEnable.apply(this, arguments); !arg && this.isViewVisible() && this._hideView(); }, @@ -3299,7 +3300,7 @@ BI.Expander = BI.inherit(BI.Widget, { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Expander.EVENT_EXPAND); } - if(type === BI.Events.COLLAPSE) { + if (type === BI.Events.COLLAPSE) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Expander.EVENT_COLLAPSE); } @@ -3456,11 +3457,9 @@ BI.Expander = BI.inherit(BI.Widget, { this.expander.populate.apply(this.expander, arguments); }, - setEnable: function (arg) { - BI.Expander.superclass.setEnable.apply(this, arguments); - this.expander && this.expander.setEnable(arg); - this.popupView && this.popupView.setEnable(arg); - !arg && this._hideView(); + _setEnable: function (arg) { + BI.Expander.superclass._setEnable.apply(this, arguments); + !arg && this.isViewVisible() && this._hideView(); }, setValue: function (v) { @@ -3620,11 +3619,6 @@ BI.ComboGroup = BI.inherit(BI.Widget, { }) }, - setEnable: function (b) { - BI.ComboGroup.superclass.setEnable.apply(this, arguments); - this.combo && this.combo.setEnable(b); - }, - getValue: function () { return this.combo.getValue(); }, @@ -3915,10 +3909,6 @@ BI.Loader = BI.inherit(BI.Widget, { this.button_group.populate.apply(this.button_group, arguments); }, - setEnable: function (v) { - this.button_group.setEnable(v); - }, - doBehavior: function () { this.button_group.doBehavior.apply(this.button_group, arguments); }, @@ -4624,11 +4614,9 @@ BI.Switcher = BI.inherit(BI.Widget, { this.switcher.populate.apply(this.switcher, arguments); }, - setEnable: function (arg) { - BI.Switcher.superclass.setEnable.apply(this, arguments); - this.switcher && this.switcher.setEnable(arg); - this.popupView && this.popupView.setEnable(arg); - !arg && this._hideView(); + _setEnable: function (arg) { + BI.Switcher.superclass._setEnable.apply(this, arguments); + !arg && this.isViewVisible() && this._hideView(); }, setValue: function (v) { @@ -14646,15 +14634,15 @@ $.extend(BI, { }; }() });/** - * Grid + * GridView * * Created by GUY on 2016/1/11. - * @class BI.Grid + * @class BI.GridView * @extends BI.Widget */ -BI.Grid = BI.inherit(BI.Widget, { +BI.GridView = BI.inherit(BI.Widget, { _defaultConfig: function () { - return BI.extend(BI.Grid.superclass._defaultConfig.apply(this, arguments), { + return BI.extend(BI.GridView.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-grid-view", width: 400, height: 300, @@ -14673,7 +14661,7 @@ BI.Grid = BI.inherit(BI.Widget, { }, _init: function () { - BI.Grid.superclass._init.apply(this, arguments); + BI.GridView.superclass._init.apply(this, arguments); var self = this, o = this.options; this.renderedCells = []; this.renderedKeys = []; @@ -14692,7 +14680,7 @@ BI.Grid = BI.inherit(BI.Widget, { o.scrollLeft = self.element.scrollLeft(); o.scrollTop = self.element.scrollTop(); self._calculateChildrenToRender(); - self.fireEvent(BI.Grid.EVENT_SCROLL, { + self.fireEvent(BI.GridView.EVENT_SCROLL, { scrollLeft: o.scrollLeft, scrollTop: o.scrollTop }); @@ -14768,7 +14756,7 @@ BI.Grid = BI.inherit(BI.Widget, { return; } - var renderedCells = [], renderedKeys = []; + var renderedCells = [], renderedKeys = [], renderedWidgets = {}; var minX = this._getMaxScrollLeft(), minY = this._getMaxScrollTop(), maxX = 0, maxY = 0; for (var rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) { var rowDatum = this._rowSizeAndPositionManager.getSizeAndPositionOfCell(rowIndex); @@ -14819,6 +14807,7 @@ BI.Grid = BI.inherit(BI.Widget, { minY = Math.min(minY, rowDatum.offset + verticalOffsetAdjustment); maxY = Math.max(maxY, rowDatum.offset + verticalOffsetAdjustment + rowDatum.size); renderedKeys.push(key); + renderedWidgets[i] = child; } } //已存在的, 需要添加的和需要删除的 @@ -14840,13 +14829,17 @@ BI.Grid = BI.inherit(BI.Widget, { deleteArray.push(i); }); BI.each(deleteArray, function (i, index) { - self.renderedCells[index].el.destroy(); + //性能优化,不调用destroy方法防止触发destroy事件 + self.renderedCells[index].el._destroy(); }); var addedItems = []; BI.each(addSet, function (index) { addedItems.push(renderedCells[index]) }); this.container.addItems(addedItems); + //拦截父子级关系 + this.container._children = renderedWidgets; + this.container.attr("items", renderedCells); this.renderedCells = renderedCells; this.renderedKeys = renderedKeys; this.renderRange = {minX: minX, minY: minY, maxX: maxX, maxY: maxY}; @@ -14965,8 +14958,8 @@ BI.Grid = BI.inherit(BI.Widget, { this._populate(); } }); -BI.Grid.EVENT_SCROLL = "EVENT_SCROLL"; -BI.shortcut('bi.grid_view', BI.Grid);/** +BI.GridView.EVENT_SCROLL = "EVENT_SCROLL"; +BI.shortcut('bi.grid_view', BI.GridView);/** * floatBox弹出层, * @class BI.FloatBox * @extends BI.Widget @@ -15271,11 +15264,6 @@ BI.PopupView = BI.inherit(BI.Widget, { this.view.element.css({"max-height": (h - tbHeight - tabHeight - toolHeight - 2) + "px"}) }, - setEnable: function (arg) { - BI.PopupView.superclass.setEnable.apply(this, arguments); - this.view && this.view.setEnable(arg); - }, - setValue: function (selectedValues) { this.tab && this.tab.setValue(selectedValues); this.button_group.setValue(selectedValues); @@ -16082,12 +16070,6 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) { } }, - setEnable: function (b) { - BI.Button.superclass.setEnable.apply(this, arguments); - // this.text.setEnable(b); - // this.icon && this.icon.setEnable(b); - }, - doRedMark: function () { this.text.doRedMark.apply(this.text, arguments); }, @@ -17460,8 +17442,8 @@ BI.CodeEditor = BI.inherit(BI.Single, { } }, - setEnable: function (b) { - BI.CodeEditor.superclass.setEnable.apply(this, arguments); + _setEnable: function (b) { + BI.CodeEditor.superclass._setEnable.apply(this, arguments); this.editor.setOption("readOnly", b === true ? false : "nocursor") }, @@ -17832,12 +17814,6 @@ BI.Editor = BI.inherit(BI.Single, { isValid: function () { return this.editor.isValid(); - }, - - setEnable: function (b) { - BI.Editor.superclass.setEnable.apply(this, arguments); - this.editor && this.editor.setEnable(b); - this.watermark && this.watermark.setEnable(b); } }); BI.Editor.EVENT_CHANGE = "EVENT_CHANGE"; @@ -17940,11 +17916,6 @@ BI.MultifileEditor = BI.inherit(BI.Single, { reset: function () { this.file.reset(); - }, - - setEnable: function (enable) { - BI.MultiFile.superclass.setEnable.apply(this, arguments); - this.file.setEnable(enable); } }); BI.MultifileEditor.EVENT_CHANGE = "MultifileEditor.EVENT_CHANGE"; @@ -18107,12 +18078,6 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { BI.TextAreaEditor.superclass.setValid.apply(this, arguments); this.content.setValid(b); this.watermark && this.watermark.setValid(b); - }, - - setEnable: function (b) { - BI.TextAreaEditor.superclass.setEnable.apply(this, arguments); - this.content.setEnable(b); - this.watermark && this.watermark.setEnable(b); } }); BI.TextAreaEditor.EVENT_CHANGE = "EVENT_CHANGE"; @@ -18847,8 +18812,8 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/** this.wrap.attachNum = 0; }, - setEnable: function (enable) { - BI.File.superclass.setEnable.apply(this, arguments); + _setEnable: function (enable) { + BI.File.superclass._setEnable.apply(this, arguments); if (enable === true) { this.element.attr("disabled", "disabled"); } else { @@ -19120,8 +19085,8 @@ BI.Input = BI.inherit(BI.Single, { } }, - setEnable: function (b) { - BI.Input.superclass.setEnable.apply(this, [b]); + _setEnable: function (b) { + BI.Input.superclass._setEnable.apply(this, [b]); this.element[0].disabled = !b; } }); @@ -28603,7 +28568,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, { return self.topLeftItems[index]; } }); - this.topLeftCollection.on(BI.Collection.EVENT_SCROLL, function (scroll) { + this.topLeftCollection.on(BI.CollectionView.EVENT_SCROLL, function (scroll) { self.bottomLeftCollection.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); @@ -28614,7 +28579,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, { return self.topRightItems[index]; } }); - this.topRightCollection.on(BI.Collection.EVENT_SCROLL, function (scroll) { + this.topRightCollection.on(BI.CollectionView.EVENT_SCROLL, function (scroll) { self.bottomRightCollection.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); @@ -28625,7 +28590,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, { return self.bottomLeftItems[index]; } }); - this.bottomLeftCollection.on(BI.Collection.EVENT_SCROLL, function (scroll) { + this.bottomLeftCollection.on(BI.CollectionView.EVENT_SCROLL, function (scroll) { self.bottomRightCollection.setScrollTop(scroll.scrollTop); self.topLeftCollection.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); @@ -28637,7 +28602,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, { return self.bottomRightItems[index]; } }); - this.bottomRightCollection.on(BI.Collection.EVENT_SCROLL, function (scroll) { + this.bottomRightCollection.on(BI.CollectionView.EVENT_SCROLL, function (scroll) { self.bottomLeftCollection.setScrollTop(scroll.scrollTop); self.topRightCollection.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); @@ -29386,7 +29351,7 @@ BI.GridTable = BI.inherit(BI.Widget, { rowHeightGetter: rowHeightGetter, columnWidthGetter: columnLeftWidthGetter, }); - this.topLeftGrid.on(BI.Grid.EVENT_SCROLL, function (scroll) { + this.topLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { self.bottomLeftGrid.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); @@ -29396,7 +29361,7 @@ BI.GridTable = BI.inherit(BI.Widget, { rowHeightGetter: rowHeightGetter, columnWidthGetter: columnRightWidthGetter, }); - this.topRightGrid.on(BI.Grid.EVENT_SCROLL, function (scroll) { + this.topRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { self.bottomRightGrid.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); @@ -29406,7 +29371,7 @@ BI.GridTable = BI.inherit(BI.Widget, { rowHeightGetter: rowHeightGetter, columnWidthGetter: columnLeftWidthGetter, }); - this.bottomLeftGrid.on(BI.Grid.EVENT_SCROLL, function (scroll) { + this.bottomLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { self.bottomRightGrid.setScrollTop(scroll.scrollTop); self.topLeftGrid.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); @@ -29417,7 +29382,7 @@ BI.GridTable = BI.inherit(BI.Widget, { rowHeightGetter: rowHeightGetter, columnWidthGetter: columnRightWidthGetter, }); - this.bottomRightGrid.on(BI.Grid.EVENT_SCROLL, function (scroll) { + this.bottomRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { self.bottomLeftGrid.setScrollTop(scroll.scrollTop); self.topRightGrid.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); @@ -32553,11 +32518,6 @@ BI.CustomTree = BI.inherit(BI.Widget, { this.initTree(this.options.items); }, - setEnable: function (v) { - BI.CustomTree.superclass.setEnable.apply(this, arguments); - this.tree.setEnable(v) - }, - _formatItems: function (nodes) { var self = this, o = this.options; nodes = BI.Tree.transformToTreeFormat(nodes); diff --git a/bi/case.js b/bi/case.js index 039b4873e9..697267ae70 100644 --- a/bi/case.js +++ b/bi/case.js @@ -77,11 +77,6 @@ BI.IconChangeButton = BI.inherit(BI.Single, { this.element.removeClass(o.iconClass).addClass(cls); o.iconClass = cls; } - }, - - setEnable: function (b) { - BI.IconChangeButton.superclass.setEnable.apply(this, arguments); - this.button.setEnable(b); } }); BI.IconChangeButton.EVENT_CHANGE = "IconChangeButton.EVENT_CHANGE"; @@ -197,11 +192,6 @@ BI.MultiSelectItem = BI.inherit(BI.BasicButton, { })))); }, - setEnable: function (v) { - BI.MultiSelectItem.superclass.setEnable.apply(this, arguments); - this.checkbox.setEnable(v); - }, - doRedMark: function () { this.text.doRedMark.apply(this.text, arguments); }, @@ -2373,10 +2363,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, { return this.combo.isViewVisible(); }, - setEnable: function (v) { - this.combo.setEnable(v) - }, - setValue: function (color) { this.combo.setValue(color); }, @@ -3600,10 +3586,6 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { isViewVisible: function () { return this.combo.isViewVisible(); - }, - - setEnable: function (v) { - this.combo.setEnable(!!v); } }); @@ -3799,11 +3781,6 @@ BI.EditorIconCheckCombo = BI.inherit(BI.Widget, { this.editorIconCheckCombo.setValue(v); }, - setEnable: function (v) { - BI.EditorIconCheckCombo.superclass.setEnable.apply(this, arguments); - this.editorIconCheckCombo.setEnable(v); - }, - getValue: function () { return this.trigger.getValue(); }, @@ -4141,11 +4118,6 @@ BI.IconCombo = BI.inherit(BI.Widget, { this.iconCombo.setValue(v); }, - setEnable: function (v) { - BI.IconCombo.superclass.setEnable.apply(this, arguments); - this.iconCombo.setEnable(v); - }, - getValue: function () { return this.iconCombo.getValue(); }, @@ -4431,11 +4403,6 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, { this.textIconCheckCombo.setValue(v); }, - setEnable: function (v) { - BI.TextValueCheckCombo.superclass.setEnable.apply(this, arguments); - this.textIconCheckCombo.setEnable(v); - }, - setWarningTitle: function (title) { this.trigger.setWarningTitle(title); }, @@ -4503,11 +4470,6 @@ BI.SmallTextValueCheckCombo = BI.inherit(BI.Widget, { this.SmallTextIconCheckCombo.setValue(v); }, - setEnable: function (v) { - BI.SmallTextValueCheckCombo.superclass.setEnable.apply(this, arguments); - this.SmallTextIconCheckCombo.setEnable(v); - }, - getValue: function () { return this.SmallTextIconCheckCombo.getValue(); }, @@ -4632,11 +4594,6 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { this.textIconCombo.setValue(v); }, - setEnable: function (v) { - BI.TextValueCombo.superclass.setEnable.apply(this, arguments); - this.textIconCombo.setEnable(v); - }, - getValue: function () { return this.textIconCombo.getValue(); }, @@ -4702,11 +4659,6 @@ BI.SmallTextValueCombo = BI.inherit(BI.Widget, { this.SmallTextValueCombo.setValue(v); }, - setEnable: function (v) { - BI.SmallTextValueCombo.superclass.setEnable.apply(this, arguments); - this.SmallTextValueCombo.setEnable(v); - }, - getValue: function () { return this.SmallTextValueCombo.getValue(); }, @@ -4840,11 +4792,6 @@ BI.TextValueDownListCombo = BI.inherit(BI.Widget, { this.trigger.setValue(v.childValue || v.value); }, - setEnable: function (v) { - BI.TextValueDownListCombo.superclass.setEnable.apply(this, arguments); - this.combo.setEnable(v); - }, - getValue: function () { var v = this.combo.getValue()[0]; return [v.childValue || v.value]; @@ -5248,12 +5195,6 @@ BI.SearchEditor = BI.inherit(BI.Widget, { isValid: function () { return this.editor.isValid(); - }, - - setEnable: function (b) { - BI.Editor.superclass.setEnable.apply(this, arguments); - this.editor && this.editor.setEnable(b); - this.clear.setEnable(b); } }); BI.SearchEditor.EVENT_CHANGE = "EVENT_CHANGE"; @@ -6186,11 +6127,6 @@ BI.StateEditor = BI.inherit(BI.Widget, { this.editor.setValue(k); }, - setEnable: function (v) { - this.text.setEnable(v); - this.editor.setEnable(v); - }, - getValue: function () { return this.editor.getValue(); }, @@ -6464,11 +6400,6 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { this.editor.setValue(k); }, - setEnable: function(v){ - this.text.setEnable(v); - this.editor.setEnable(v); - }, - getValue: function () { return this.editor.getValue(); }, @@ -6666,11 +6597,6 @@ BI.TextEditor = BI.inherit(BI.Widget, { getValue: function () { return this.editor.getValue(); - }, - - setEnable: function (b) { - BI.Editor.superclass.setEnable.apply(this, arguments); - this.editor && this.editor.setEnable(b); } }); BI.TextEditor.EVENT_CHANGE = "EVENT_CHANGE"; @@ -8714,10 +8640,6 @@ BI.Segment = BI.inherit(BI.Widget, { this.buttonGroup.setEnabledValue(v); }, - setEnable: function (v) { - this.buttonGroup.setEnable(v); - }, - getValue: function () { return this.buttonGroup.getValue(); } @@ -10452,13 +10374,6 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, { var isAllChecked = this.options.isAllCheckedBySelectedValue.apply(this, arguments); this.setSelected(isAllChecked); !isAllChecked && this.setHalfSelected(this.options.isHalfCheckedBySelectedValue.apply(this, arguments)); - }, - - setEnable: function (b) { - BI.MultiSelectBar.superclass.setEnable.apply(this, arguments); - this.checkbox.setEnable(b); - this.half.setEnable(b); - this.text.setEnable(b); } }); BI.MultiSelectBar.EVENT_CHANGE = "MultiSelectBar.EVENT_CHANGE"; @@ -11157,12 +11072,6 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { }); }, - setEnable: function (v) { - BI.TextTrigger.superclass.setEnable.apply(this, arguments); - this.trigerButton.setEnable(v); - this.text.setEnable(v); - }, - setValue: function (value) { this.text.setValue(value); this.text.setTitle(value); @@ -11327,12 +11236,6 @@ BI.SmallTextTrigger = BI.inherit(BI.Trigger, { }); }, - setEnable: function (v) { - BI.SmallTextTrigger.superclass.setEnable.apply(this, arguments); - this.trigerButton.setEnable(v); - this.text.setEnable(v); - }, - setValue: function (value) { this.text.setValue(value); }, diff --git a/bi/core.css b/bi/core.css index 25c5635c63..ed35e89657 100644 --- a/bi/core.css +++ b/bi/core.css @@ -3078,8 +3078,8 @@ i { } .bi-z-index-mask { color: #ffffff; - background-color: rgba(26, 26, 26, 0.3); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d1a1a1a,endColorstr=#4d1a1a1a); + background-color: rgba(26, 26, 26, 0.5); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#801a1a1a,endColorstr=#801a1a1a); } .bi-list-item:hover, .bi-list-item.hover { diff --git a/bi/core.js b/bi/core.js index 304ef4664f..3d3ab264a0 100644 --- a/bi/core.js +++ b/bi/core.js @@ -3042,6 +3042,9 @@ if (!window.BI) { } }); })(jQuery);;(function () { + if (!window.BI) { + window.BI = {}; + } function isEmpty(value) { // 判断是否为空值 var result = value === "" || value === null || value === undefined; @@ -3102,124 +3105,6 @@ if (!window.BI) { return text; } - /** - * 把日期对象按照指定格式转化成字符串 - * - * @example - * var date = new Date('Thu Dec 12 2013 00:00:00 GMT+0800'); - * var result = BI.date2Str(date, 'yyyy-MM-dd');//2013-12-12 - * - * @class BI.date2Str - * @param date 日期 - * @param format 日期格式 - * @returns {String} - */ - function date2Str(date, format) { - if (!date) { - return ''; - } - // O(len(format)) - var len = format.length, result = ''; - if (len > 0) { - var flagch = format.charAt(0), start = 0, str = flagch; - for (var i = 1; i < len; i++) { - var ch = format.charAt(i); - if (flagch !== ch) { - result += compileJFmt({ - 'char': flagch, - 'str': str, - 'len': i - start - }, date); - flagch = ch; - start = i; - str = flagch; - } else { - str += ch; - } - } - result += compileJFmt({ - 'char': flagch, - 'str': str, - 'len': len - start - }, date); - } - return result; - - function compileJFmt(jfmt, date) { - var str = jfmt.str, len = jfmt.len, ch = jfmt['char']; - switch (ch) { - case 'E': //星期 - str = Date._DN[date.getDay()]; - break; - case 'y': //年 - if (len <= 3) { - str = (date.getFullYear() + '').slice(2, 4); - } else { - str = date.getFullYear(); - } - break; - case 'M': //月 - if (len > 2) { - str = Date._MN[date.getMonth()]; - } else if (len < 2) { - str = date.getMonth() + 1; - } else { - str = String.leftPad(date.getMonth() + 1 + '', 2, '0'); - } - break; - case 'd': //日 - if (len > 1) { - str = String.leftPad(date.getDate() + '', 2, '0'); - } else { - str = date.getDate(); - } - break; - case 'h': //时(12) - var hour = date.getHours() % 12; - if (hour === 0) { - hour = 12; - } - if (len > 1) { - str = String.leftPad(hour + '', 2, '0'); - } else { - str = hour; - } - break; - case 'H': //时(24) - if (len > 1) { - str = String.leftPad(date.getHours() + '', 2, '0'); - } else { - str = date.getHours(); - } - break; - case 'm': - if (len > 1) { - str = String.leftPad(date.getMinutes() + '', 2, '0'); - } else { - str = date.getMinutes(); - } - break; - case 's': - if (len > 1) { - str = String.leftPad(date.getSeconds() + '', 2, '0'); - } else { - str = date.getSeconds(); - } - break; - case 'a': - str = date.getHours() < 12 ? 'am' : 'pm'; - break; - case 'z': - str = date.getTimezone(); - break; - default: - str = jfmt.str; - break; - } - return str; - } - }; - /** * 数字格式 */ @@ -3262,7 +3147,8 @@ if (!window.BI) { } else { return left + '.' + right; } - }; + } + /** * 处理小数点右边小数部分 * @param tright 右边内容 @@ -3306,7 +3192,7 @@ if (!window.BI) { if (newnum.length > orilen) { newnum = newnum.substr(1); } else { - newnum = BI.leftPad(newnum, orilen, '0'); + newnum = String.leftPad(newnum, orilen, '0'); result.leftPlus = false; } right = right.replace(/^[0-9]+/, newnum); @@ -3567,7 +3453,7 @@ if (!window.BI) { return o; })(jo); - } + }; BI.contentFormat = function (cv, fmt) { if (isEmpty(cv)) { @@ -3609,15 +3495,122 @@ if (!window.BI) { return text; }; - BI.leftPad = function (val, size, ch) { - var result = String(val); - if (!ch) { - ch = " "; + /** + * 把日期对象按照指定格式转化成字符串 + * + * @example + * var date = new Date('Thu Dec 12 2013 00:00:00 GMT+0800'); + * var result = BI.date2Str(date, 'yyyy-MM-dd');//2013-12-12 + * + * @class BI.date2Str + * @param date 日期 + * @param format 日期格式 + * @returns {String} + */ + BI.date2Str = function (date, format) { + if (!date) { + return ''; } - while (result.length < size) { - result = ch + result; + // O(len(format)) + var len = format.length, result = ''; + if (len > 0) { + var flagch = format.charAt(0), start = 0, str = flagch; + for (var i = 1; i < len; i++) { + var ch = format.charAt(i); + if (flagch !== ch) { + result += compileJFmt({ + 'char': flagch, + 'str': str, + 'len': i - start + }, date); + flagch = ch; + start = i; + str = flagch; + } else { + str += ch; + } + } + result += compileJFmt({ + 'char': flagch, + 'str': str, + 'len': len - start + }, date); + } + return result; + + function compileJFmt(jfmt, date) { + var str = jfmt.str, len = jfmt.len, ch = jfmt['char']; + switch (ch) { + case 'E': //星期 + str = Date._DN[date.getDay()]; + break; + case 'y': //年 + if (len <= 3) { + str = (date.getFullYear() + '').slice(2, 4); + } else { + str = date.getFullYear(); + } + break; + case 'M': //月 + if (len > 2) { + str = Date._MN[date.getMonth()]; + } else if (len < 2) { + str = date.getMonth() + 1; + } else { + str = String.leftPad(date.getMonth() + 1 + '', 2, '0'); + } + break; + case 'd': //日 + if (len > 1) { + str = String.leftPad(date.getDate() + '', 2, '0'); + } else { + str = date.getDate(); + } + break; + case 'h': //时(12) + var hour = date.getHours() % 12; + if (hour === 0) { + hour = 12; + } + if (len > 1) { + str = String.leftPad(hour + '', 2, '0'); + } else { + str = hour; + } + break; + case 'H': //时(24) + if (len > 1) { + str = String.leftPad(date.getHours() + '', 2, '0'); + } else { + str = date.getHours(); + } + break; + case 'm': + if (len > 1) { + str = String.leftPad(date.getMinutes() + '', 2, '0'); + } else { + str = date.getMinutes(); + } + break; + case 's': + if (len > 1) { + str = String.leftPad(date.getSeconds() + '', 2, '0'); + } else { + str = date.getSeconds(); + } + break; + case 'a': + str = date.getHours() < 12 ? 'am' : 'pm'; + break; + case 'z': + str = date.getTimezone(); + break; + default: + str = jfmt.str; + break; + } + return str; } - return result.toString(); }; BI.object2Number = function (value) { @@ -4432,17 +4425,18 @@ BI.Widget = BI.inherit(BI.OB, { _initVisualEffects: function () { var o = this.options; if (o.invisible) { - this.element.hide(); + //用display属性做显示和隐藏,否则jquery会在显示时将display设为block会覆盖掉display:flex属性 + this.element.css("display", "none"); } if (o.disabled || o.invalid) { - BI.nextTick(BI.bind(function () { - if (this.options.disabled) { - this.setEnable(false); - } - if (this.options.invalid) { - this.setValid(false); - } - }, this)); + // BI.nextTick(BI.bind(function () { + if (this.options.disabled) { + this.setEnable(false); + } + if (this.options.invalid) { + this.setValid(false); + } + // }, this)); } }, @@ -4490,6 +4484,7 @@ BI.Widget = BI.inherit(BI.OB, { this._isMounted = true; this._mountChildren && this._mountChildren(); BI.each(this._children, function (i, widget) { + !self.isEnabled() && widget._setEnable(false); widget._mount && widget._mount(); }); this.mounted && this.mounted(); @@ -4497,17 +4492,6 @@ BI.Widget = BI.inherit(BI.OB, { _mountChildren: null, - _unMount: function () { - BI.each(this._children, function (i, widget) { - widget._unMount && widget._unMount(); - }); - this._children = {}; - this._parent = null; - this._isMounted = false; - this.purgeListeners(); - this.destroyed && this.destroyed(); - }, - isMounted: function () { return this._isMounted; }, @@ -4522,12 +4506,23 @@ BI.Widget = BI.inherit(BI.OB, { this._initElementHeight(); }, - setEnable: function (enable) { + _setEnable: function (enable) { if (enable === true) { this.options.disabled = false; - this.element.removeClass("base-disabled disabled"); } else if (enable === false) { this.options.disabled = true; + } + //递归将所有子组件使能 + BI.each(this._children, function (i, child) { + child._setEnable && child._setEnable(enable); + }); + }, + + setEnable: function (enable) { + this._setEnable(enable); + if (enable === true) { + this.element.removeClass("base-disabled disabled"); + } else if (enable === false) { this.element.addClass("base-disabled disabled"); } }, @@ -4587,7 +4582,7 @@ BI.Widget = BI.inherit(BI.OB, { }, getWidgetByName: function (name) { - if (!BI.isKey(name) || name == this.getName()) { + if (!BI.isKey(name) || name === this.getName()) { return this; } name = name + ""; @@ -4687,6 +4682,21 @@ BI.Widget = BI.inherit(BI.OB, { this.setVisible(true); }, + __d: function () { + BI.each(this._children, function (i, widget) { + widget._unMount && widget._unMount(); + }); + this._children = {}; + this._parent = null; + this._isMounted = false; + }, + + _unMount: function () { + this.__d(); + this.purgeListeners(); + this.destroyed && this.destroyed(); + }, + isolate: function () { if (this._parent) { this._parent.removeWidget(this); @@ -4702,13 +4712,15 @@ BI.Widget = BI.inherit(BI.OB, { this.element.empty(); }, + _destroy: function () { + this.__d(); + this.destroyed && this.destroyed(); + this.element.destroy(); + this.purgeListeners(); + }, + destroy: function () { - BI.each(this._children, function (i, widget) { - widget._unMount && widget._unMount(); - }); - this._children = {}; - this._parent = null; - this._isMounted = false; + this.__d(); this.destroyed && this.destroyed(); this.element.destroy(); this.fireEvent(BI.Events.DESTROY); @@ -5358,7 +5370,7 @@ BI.View = BI.inherit(BI.V, { BI.each(cardNames, function (i, name) { delete self._cards[name]; }); - this._cardLayouts[key] && this._cardLayouts[key].destroy(); + this._cardLayouts[key] && this._cardLayouts[key]._destroy(); return this; }, @@ -6007,7 +6019,6 @@ Date._QN = ["", BI.i18nText("BI-Quarter_1"), BI.i18nText("BI-Quarter_3"), BI.i18nText("BI-Quarter_4")]; - /** Adds the number of days array to the Date object. */ Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; @@ -6481,7 +6492,8 @@ Date.parseDateTime = function (str, fmt) { return new Date(y, m, d, hr, min, sec); } return today; -};/* +}; +/* * 给jQuery.Event对象添加的工具方法 */ $.extend($.Event.prototype, { @@ -11196,7 +11208,7 @@ BI.Layout = BI.inherit(BI.Widget, { this.options.items = newItems; this._children = newChildren; BI.each(deleted, function (i, c) { - c.destroy(); + c._destroy(); }); }, @@ -11221,7 +11233,7 @@ BI.Layout = BI.inherit(BI.Widget, { } else { w.element.prependTo(this._getWrapper()); } - del.destroy(); + del._destroy(); w._mount(); }, @@ -11308,7 +11320,7 @@ BI.Layout = BI.inherit(BI.Widget, { } o.items.splice(items.length); BI.each(deleted, function (i, w) { - w.destroy(); + w._destroy(); }) } else if (items.length > o.items.length) { for (i = o.items.length; i < items.length; i++) { @@ -13037,7 +13049,7 @@ BI.CardLayout = BI.inherit(BI.Layout, { var child = this._children[cardName]; this._deleteCardByName(cardName); - child && child.destroy(); + child && child._destroy(); }, addCardByName: function (cardName, cardItem) { @@ -16272,7 +16284,8 @@ BI.extend(jQuery, { getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); + var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), + windowBounds = $("body").bounds(); var top, adaptHeight; if ($.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { top = comboOffset.top + extraHeight; @@ -16320,7 +16333,8 @@ BI.extend(jQuery, { getBottomAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); + var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), + windowBounds = $("body").bounds(); var top, adaptHeight; if ($.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { top = comboOffset.top + comboBounds.height - popupBounds.height - extraHeight; @@ -16346,7 +16360,8 @@ BI.extend(jQuery, { getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) { var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); + var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), + windowBounds = $("body").bounds(); if ($.isBottomSpaceEnough(combo, popup, extraHeight)) { return $.getBottomPosition(combo, popup, extraHeight); } @@ -16369,7 +16384,8 @@ BI.extend(jQuery, { getCenterAdaptPosition: function (combo, popup) { var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); + var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), + windowBounds = $("body").bounds(); var left; if (comboOffset.left + comboBounds.width / 2 + popupBounds.width / 2 > windowBounds.width) { left = windowBounds.width - popupBounds.width; @@ -16386,7 +16402,8 @@ BI.extend(jQuery, { getMiddleAdaptPosition: function (combo, popup) { var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); + var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), + windowBounds = $("body").bounds(); var top; if (comboOffset.top + comboBounds.height / 2 + popupBounds.height / 2 > windowBounds.height) { top = windowBounds.height - popupBounds.height; @@ -16582,7 +16599,7 @@ BI.extend(jQuery, { } break; } - if(needAdaptHeight === true) { + if (needAdaptHeight === true) { popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight)); } return position; @@ -16613,6 +16630,7 @@ $(function () { }; } var t, text, py; + keyword = keyword + ""; keyword = BI.toUpperCase(keyword); var matched = isArray ? [] : {}, finded = isArray ? [] : {}; BI.each(items, function (i, item) { diff --git a/bi/widget.js b/bi/widget.js index 42fb0ced59..9ec134e1a4 100644 --- a/bi/widget.js +++ b/bi/widget.js @@ -10048,10 +10048,6 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, { this.button_group.populate.apply(this.button_group, arguments); }, - setEnable: function (arg) { - this.button_group.setEnable(arg); - }, - resetHeight: function (h) { this.button_group.resetHeight(h); }, @@ -10138,10 +10134,6 @@ BI.MultiSelectPopupView = BI.inherit(BI.Widget, { this.popupView.populate.apply(this.popupView, arguments); }, - setEnable: function (arg) { - this.popupView.setEnable(arg); - }, - resetHeight: function (h) { this.popupView.resetHeight(h); }, @@ -10291,10 +10283,6 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, { this.numberCounter.setValue(ob); }, - setEnable: function (v) { - this.searcher.setEnable(v); - }, - getKey: function () { return this.searcher.getKey(); }, @@ -10454,10 +10442,6 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { this.button_group.populate.apply(this.button_group, arguments); }, - setEnable: function (arg) { - this.button_group.setEnable(arg); - }, - resetHeight: function (h) { this.button_group.resetHeight(h); }, @@ -10703,10 +10687,6 @@ BI.MultiSelectEditor = BI.inherit(BI.Widget, { this.editor.setValue(v); }, - setEnable: function(v){ - this.editor.setEnable(v); - }, - getValue: function () { var v = this.editor.getState(); if (BI.isArray(v) && v.length > 0) { @@ -10866,10 +10846,6 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { return this.searcher.getValue(); }, - setEnable: function (v) { - this.editor.setEnable(v); - }, - populate: function (items) { this.searcher.populate.apply(this.searcher, arguments); } @@ -11267,11 +11243,6 @@ BI.MultiStringList = BI.inherit(BI.Widget, { this.trigger.getSearcher().adjustView(); }, - setEnable: function (v) { - this.trigger.setEnable(v); - this.popup.setEnable(v); - }, - setValue: function (v) { this.storeValue = v || {}; this._assertValue(this.storeValue); @@ -11649,10 +11620,6 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { this.combo.hideView(); }, - setEnable: function (v) { - this.combo.setEnable(v); - }, - setValue: function (v) { this.storeValue.value = v || {}; this.combo.setValue({ @@ -11752,10 +11719,6 @@ BI.MultiTreePopup = BI.inherit(BI.Pane, { return this.tree.hasChecked(); }, - setEnable: function (arg) { - this.popupView.setEnable(arg); - }, - resetHeight: function (h) { this.popupView.resetHeight(h); }, @@ -12030,10 +11993,6 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { return this.editor.getValue(); }, - setEnable: function(v){ - this.editor.setEnable(v); - }, - getValue: function () { return this.searcher.getValue(); }, @@ -12200,11 +12159,6 @@ BI.MultiTreeList = BI.inherit(BI.Widget, { this.trigger.getSearcher().adjustView(); }, - setEnable: function (v) { - this.trigger.setEnable(v); - this.popup.setEnable(v); - }, - setValue: function (v) { this.storeValue.value = v || {}; this.popup.setValue({ @@ -12704,13 +12658,6 @@ BI.NumericalInterval = BI.inherit(BI.Single, { return this.options.validation === "valid"; }, - setEnable: function (b) { - this.smallEditor.setEnable(b); - this.smallCombo.setEnable(b); - this.bigEditor.setEnable(b); - this.bigCombo.setEnable(b); - }, - setMinEnable: function (b) { this.smallEditor.setEnable(b); }, diff --git a/docs/base.js b/docs/base.js index 382be5a933..9c789c2538 100644 --- a/docs/base.js +++ b/docs/base.js @@ -881,9 +881,14 @@ BI.BasicButton = BI.inherit(BI.Single, { return this.options.text; }, - setEnable: function (b) { - BI.BasicButton.superclass.setEnable.apply(this, arguments); - if (!b) { + _setEnable: function (enable) { + BI.BasicButton.superclass._setEnable.apply(this, arguments); + if (enable === true) { + this.element.removeClass("base-disabled disabled"); + } else if (enable === false) { + this.element.addClass("base-disabled disabled"); + } + if (!enable) { if (this.options.shadow) { this.$mask && this.$mask.setVisible(false); } @@ -1166,13 +1171,6 @@ BI.ButtonGroup = BI.inherit(BI.Widget, { this.layouts = BI.createWidget(BI.extend({element: this}, this._packageLayout(items))); }, - setEnable: function (b) { - BI.ButtonGroup.superclass.setEnable.apply(this, arguments); - BI.each(this.buttons, function (i, item) { - item.setEnable(b); - }); - }, - setNotSelectedValue: function (v) { v = BI.isArray(v) ? v : [v]; BI.each(this.buttons, function (i, item) { @@ -2511,15 +2509,15 @@ BI.Canvas = BI.inherit(BI.Widget, { } }); BI.shortcut("bi.canvas", BI.Canvas);/** - * Collection + * CollectionView * * Created by GUY on 2016/1/15. - * @class BI.Collection + * @class BI.CollectionView * @extends BI.Widget */ -BI.Collection = BI.inherit(BI.Widget, { +BI.CollectionView = BI.inherit(BI.Widget, { _defaultConfig: function () { - return BI.extend(BI.Collection.superclass._defaultConfig.apply(this, arguments), { + return BI.extend(BI.CollectionView.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-collection", width: 400, height: 300, @@ -2535,7 +2533,7 @@ BI.Collection = BI.inherit(BI.Widget, { }, _init: function () { - BI.Collection.superclass._init.apply(this, arguments); + BI.CollectionView.superclass._init.apply(this, arguments); var self = this, o = this.options; this.renderedCells = []; this.renderedKeys = []; @@ -2554,7 +2552,7 @@ BI.Collection = BI.inherit(BI.Widget, { o.scrollLeft = self.element.scrollLeft(); o.scrollTop = self.element.scrollTop(); self._calculateChildrenToRender(); - self.fireEvent(BI.Collection.EVENT_SCROLL, { + self.fireEvent(BI.CollectionView.EVENT_SCROLL, { scrollLeft: o.scrollLeft, scrollTop: o.scrollTop }); @@ -2639,7 +2637,7 @@ BI.Collection = BI.inherit(BI.Widget, { return; } var childrenToDisplay = this._cellRenderers(bottom - top, right - left, left, top); - var renderedCells = [], renderedKeys = []; + var renderedCells = [], renderedKeys = [], renderedWidgets = {}; //存储所有的left和top var lefts = {}, tops = {}; for (var i = 0, len = childrenToDisplay.length; i < len; i++) { @@ -2722,6 +2720,7 @@ BI.Collection = BI.inherit(BI.Widget, { } renderedKeys.push(datum.index); + renderedWidgets[i] = child; } //已存在的, 需要添加的和需要删除的 var existSet = {}, addSet = {}, deleteArray = []; @@ -2742,13 +2741,17 @@ BI.Collection = BI.inherit(BI.Widget, { deleteArray.push(i); }); BI.each(deleteArray, function (i, index) { - self.renderedCells[index].el.destroy(); + //性能优化,不调用destroy方法防止触发destroy事件 + self.renderedCells[index].el._destroy(); }); var addedItems = []; BI.each(addSet, function (index) { addedItems.push(renderedCells[index]) }); this.container.addItems(addedItems); + //拦截父子级关系 + this.container._children = renderedWidgets; + this.container.attr("items", renderedCells); this.renderedCells = renderedCells; this.renderedKeys = renderedKeys; @@ -2859,8 +2862,8 @@ BI.Collection = BI.inherit(BI.Widget, { this._populate(); } }); -BI.Collection.EVENT_SCROLL = "EVENT_SCROLL"; -BI.shortcut('bi.collection_view', BI.Collection);/** +BI.CollectionView.EVENT_SCROLL = "EVENT_SCROLL"; +BI.shortcut('bi.collection_view', BI.CollectionView);/** * @class BI.Combo * @extends BI.Widget */ @@ -3187,10 +3190,8 @@ BI.Combo = BI.inherit(BI.Widget, { this.combo.populate.apply(this.combo, arguments); }, - setEnable: function (arg) { - BI.Combo.superclass.setEnable.apply(this, arguments); - this.combo && this.combo.setEnable(arg); - this.popupView && this.popupView.setEnable(arg); + _setEnable: function (arg) { + BI.Combo.superclass._setEnable.apply(this, arguments); !arg && this.isViewVisible() && this._hideView(); }, @@ -3299,7 +3300,7 @@ BI.Expander = BI.inherit(BI.Widget, { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Expander.EVENT_EXPAND); } - if(type === BI.Events.COLLAPSE) { + if (type === BI.Events.COLLAPSE) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Expander.EVENT_COLLAPSE); } @@ -3456,11 +3457,9 @@ BI.Expander = BI.inherit(BI.Widget, { this.expander.populate.apply(this.expander, arguments); }, - setEnable: function (arg) { - BI.Expander.superclass.setEnable.apply(this, arguments); - this.expander && this.expander.setEnable(arg); - this.popupView && this.popupView.setEnable(arg); - !arg && this._hideView(); + _setEnable: function (arg) { + BI.Expander.superclass._setEnable.apply(this, arguments); + !arg && this.isViewVisible() && this._hideView(); }, setValue: function (v) { @@ -3620,11 +3619,6 @@ BI.ComboGroup = BI.inherit(BI.Widget, { }) }, - setEnable: function (b) { - BI.ComboGroup.superclass.setEnable.apply(this, arguments); - this.combo && this.combo.setEnable(b); - }, - getValue: function () { return this.combo.getValue(); }, @@ -3915,10 +3909,6 @@ BI.Loader = BI.inherit(BI.Widget, { this.button_group.populate.apply(this.button_group, arguments); }, - setEnable: function (v) { - this.button_group.setEnable(v); - }, - doBehavior: function () { this.button_group.doBehavior.apply(this.button_group, arguments); }, @@ -4624,11 +4614,9 @@ BI.Switcher = BI.inherit(BI.Widget, { this.switcher.populate.apply(this.switcher, arguments); }, - setEnable: function (arg) { - BI.Switcher.superclass.setEnable.apply(this, arguments); - this.switcher && this.switcher.setEnable(arg); - this.popupView && this.popupView.setEnable(arg); - !arg && this._hideView(); + _setEnable: function (arg) { + BI.Switcher.superclass._setEnable.apply(this, arguments); + !arg && this.isViewVisible() && this._hideView(); }, setValue: function (v) { @@ -14646,15 +14634,15 @@ $.extend(BI, { }; }() });/** - * Grid + * GridView * * Created by GUY on 2016/1/11. - * @class BI.Grid + * @class BI.GridView * @extends BI.Widget */ -BI.Grid = BI.inherit(BI.Widget, { +BI.GridView = BI.inherit(BI.Widget, { _defaultConfig: function () { - return BI.extend(BI.Grid.superclass._defaultConfig.apply(this, arguments), { + return BI.extend(BI.GridView.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-grid-view", width: 400, height: 300, @@ -14673,7 +14661,7 @@ BI.Grid = BI.inherit(BI.Widget, { }, _init: function () { - BI.Grid.superclass._init.apply(this, arguments); + BI.GridView.superclass._init.apply(this, arguments); var self = this, o = this.options; this.renderedCells = []; this.renderedKeys = []; @@ -14692,7 +14680,7 @@ BI.Grid = BI.inherit(BI.Widget, { o.scrollLeft = self.element.scrollLeft(); o.scrollTop = self.element.scrollTop(); self._calculateChildrenToRender(); - self.fireEvent(BI.Grid.EVENT_SCROLL, { + self.fireEvent(BI.GridView.EVENT_SCROLL, { scrollLeft: o.scrollLeft, scrollTop: o.scrollTop }); @@ -14768,7 +14756,7 @@ BI.Grid = BI.inherit(BI.Widget, { return; } - var renderedCells = [], renderedKeys = []; + var renderedCells = [], renderedKeys = [], renderedWidgets = {}; var minX = this._getMaxScrollLeft(), minY = this._getMaxScrollTop(), maxX = 0, maxY = 0; for (var rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) { var rowDatum = this._rowSizeAndPositionManager.getSizeAndPositionOfCell(rowIndex); @@ -14819,6 +14807,7 @@ BI.Grid = BI.inherit(BI.Widget, { minY = Math.min(minY, rowDatum.offset + verticalOffsetAdjustment); maxY = Math.max(maxY, rowDatum.offset + verticalOffsetAdjustment + rowDatum.size); renderedKeys.push(key); + renderedWidgets[i] = child; } } //已存在的, 需要添加的和需要删除的 @@ -14840,13 +14829,17 @@ BI.Grid = BI.inherit(BI.Widget, { deleteArray.push(i); }); BI.each(deleteArray, function (i, index) { - self.renderedCells[index].el.destroy(); + //性能优化,不调用destroy方法防止触发destroy事件 + self.renderedCells[index].el._destroy(); }); var addedItems = []; BI.each(addSet, function (index) { addedItems.push(renderedCells[index]) }); this.container.addItems(addedItems); + //拦截父子级关系 + this.container._children = renderedWidgets; + this.container.attr("items", renderedCells); this.renderedCells = renderedCells; this.renderedKeys = renderedKeys; this.renderRange = {minX: minX, minY: minY, maxX: maxX, maxY: maxY}; @@ -14965,8 +14958,8 @@ BI.Grid = BI.inherit(BI.Widget, { this._populate(); } }); -BI.Grid.EVENT_SCROLL = "EVENT_SCROLL"; -BI.shortcut('bi.grid_view', BI.Grid);/** +BI.GridView.EVENT_SCROLL = "EVENT_SCROLL"; +BI.shortcut('bi.grid_view', BI.GridView);/** * floatBox弹出层, * @class BI.FloatBox * @extends BI.Widget @@ -15271,11 +15264,6 @@ BI.PopupView = BI.inherit(BI.Widget, { this.view.element.css({"max-height": (h - tbHeight - tabHeight - toolHeight - 2) + "px"}) }, - setEnable: function (arg) { - BI.PopupView.superclass.setEnable.apply(this, arguments); - this.view && this.view.setEnable(arg); - }, - setValue: function (selectedValues) { this.tab && this.tab.setValue(selectedValues); this.button_group.setValue(selectedValues); @@ -16082,12 +16070,6 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) { } }, - setEnable: function (b) { - BI.Button.superclass.setEnable.apply(this, arguments); - // this.text.setEnable(b); - // this.icon && this.icon.setEnable(b); - }, - doRedMark: function () { this.text.doRedMark.apply(this.text, arguments); }, @@ -17460,8 +17442,8 @@ BI.CodeEditor = BI.inherit(BI.Single, { } }, - setEnable: function (b) { - BI.CodeEditor.superclass.setEnable.apply(this, arguments); + _setEnable: function (b) { + BI.CodeEditor.superclass._setEnable.apply(this, arguments); this.editor.setOption("readOnly", b === true ? false : "nocursor") }, @@ -17832,12 +17814,6 @@ BI.Editor = BI.inherit(BI.Single, { isValid: function () { return this.editor.isValid(); - }, - - setEnable: function (b) { - BI.Editor.superclass.setEnable.apply(this, arguments); - this.editor && this.editor.setEnable(b); - this.watermark && this.watermark.setEnable(b); } }); BI.Editor.EVENT_CHANGE = "EVENT_CHANGE"; @@ -17940,11 +17916,6 @@ BI.MultifileEditor = BI.inherit(BI.Single, { reset: function () { this.file.reset(); - }, - - setEnable: function (enable) { - BI.MultiFile.superclass.setEnable.apply(this, arguments); - this.file.setEnable(enable); } }); BI.MultifileEditor.EVENT_CHANGE = "MultifileEditor.EVENT_CHANGE"; @@ -18107,12 +18078,6 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { BI.TextAreaEditor.superclass.setValid.apply(this, arguments); this.content.setValid(b); this.watermark && this.watermark.setValid(b); - }, - - setEnable: function (b) { - BI.TextAreaEditor.superclass.setEnable.apply(this, arguments); - this.content.setEnable(b); - this.watermark && this.watermark.setEnable(b); } }); BI.TextAreaEditor.EVENT_CHANGE = "EVENT_CHANGE"; @@ -18847,8 +18812,8 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/** this.wrap.attachNum = 0; }, - setEnable: function (enable) { - BI.File.superclass.setEnable.apply(this, arguments); + _setEnable: function (enable) { + BI.File.superclass._setEnable.apply(this, arguments); if (enable === true) { this.element.attr("disabled", "disabled"); } else { @@ -19120,8 +19085,8 @@ BI.Input = BI.inherit(BI.Single, { } }, - setEnable: function (b) { - BI.Input.superclass.setEnable.apply(this, [b]); + _setEnable: function (b) { + BI.Input.superclass._setEnable.apply(this, [b]); this.element[0].disabled = !b; } }); @@ -28603,7 +28568,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, { return self.topLeftItems[index]; } }); - this.topLeftCollection.on(BI.Collection.EVENT_SCROLL, function (scroll) { + this.topLeftCollection.on(BI.CollectionView.EVENT_SCROLL, function (scroll) { self.bottomLeftCollection.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); @@ -28614,7 +28579,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, { return self.topRightItems[index]; } }); - this.topRightCollection.on(BI.Collection.EVENT_SCROLL, function (scroll) { + this.topRightCollection.on(BI.CollectionView.EVENT_SCROLL, function (scroll) { self.bottomRightCollection.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); @@ -28625,7 +28590,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, { return self.bottomLeftItems[index]; } }); - this.bottomLeftCollection.on(BI.Collection.EVENT_SCROLL, function (scroll) { + this.bottomLeftCollection.on(BI.CollectionView.EVENT_SCROLL, function (scroll) { self.bottomRightCollection.setScrollTop(scroll.scrollTop); self.topLeftCollection.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); @@ -28637,7 +28602,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, { return self.bottomRightItems[index]; } }); - this.bottomRightCollection.on(BI.Collection.EVENT_SCROLL, function (scroll) { + this.bottomRightCollection.on(BI.CollectionView.EVENT_SCROLL, function (scroll) { self.bottomLeftCollection.setScrollTop(scroll.scrollTop); self.topRightCollection.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); @@ -29386,7 +29351,7 @@ BI.GridTable = BI.inherit(BI.Widget, { rowHeightGetter: rowHeightGetter, columnWidthGetter: columnLeftWidthGetter, }); - this.topLeftGrid.on(BI.Grid.EVENT_SCROLL, function (scroll) { + this.topLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { self.bottomLeftGrid.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); @@ -29396,7 +29361,7 @@ BI.GridTable = BI.inherit(BI.Widget, { rowHeightGetter: rowHeightGetter, columnWidthGetter: columnRightWidthGetter, }); - this.topRightGrid.on(BI.Grid.EVENT_SCROLL, function (scroll) { + this.topRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { self.bottomRightGrid.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); @@ -29406,7 +29371,7 @@ BI.GridTable = BI.inherit(BI.Widget, { rowHeightGetter: rowHeightGetter, columnWidthGetter: columnLeftWidthGetter, }); - this.bottomLeftGrid.on(BI.Grid.EVENT_SCROLL, function (scroll) { + this.bottomLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { self.bottomRightGrid.setScrollTop(scroll.scrollTop); self.topLeftGrid.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); @@ -29417,7 +29382,7 @@ BI.GridTable = BI.inherit(BI.Widget, { rowHeightGetter: rowHeightGetter, columnWidthGetter: columnRightWidthGetter, }); - this.bottomRightGrid.on(BI.Grid.EVENT_SCROLL, function (scroll) { + this.bottomRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { self.bottomLeftGrid.setScrollTop(scroll.scrollTop); self.topRightGrid.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); @@ -32553,11 +32518,6 @@ BI.CustomTree = BI.inherit(BI.Widget, { this.initTree(this.options.items); }, - setEnable: function (v) { - BI.CustomTree.superclass.setEnable.apply(this, arguments); - this.tree.setEnable(v) - }, - _formatItems: function (nodes) { var self = this, o = this.options; nodes = BI.Tree.transformToTreeFormat(nodes); diff --git a/docs/case.js b/docs/case.js index 039b4873e9..697267ae70 100644 --- a/docs/case.js +++ b/docs/case.js @@ -77,11 +77,6 @@ BI.IconChangeButton = BI.inherit(BI.Single, { this.element.removeClass(o.iconClass).addClass(cls); o.iconClass = cls; } - }, - - setEnable: function (b) { - BI.IconChangeButton.superclass.setEnable.apply(this, arguments); - this.button.setEnable(b); } }); BI.IconChangeButton.EVENT_CHANGE = "IconChangeButton.EVENT_CHANGE"; @@ -197,11 +192,6 @@ BI.MultiSelectItem = BI.inherit(BI.BasicButton, { })))); }, - setEnable: function (v) { - BI.MultiSelectItem.superclass.setEnable.apply(this, arguments); - this.checkbox.setEnable(v); - }, - doRedMark: function () { this.text.doRedMark.apply(this.text, arguments); }, @@ -2373,10 +2363,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, { return this.combo.isViewVisible(); }, - setEnable: function (v) { - this.combo.setEnable(v) - }, - setValue: function (color) { this.combo.setValue(color); }, @@ -3600,10 +3586,6 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { isViewVisible: function () { return this.combo.isViewVisible(); - }, - - setEnable: function (v) { - this.combo.setEnable(!!v); } }); @@ -3799,11 +3781,6 @@ BI.EditorIconCheckCombo = BI.inherit(BI.Widget, { this.editorIconCheckCombo.setValue(v); }, - setEnable: function (v) { - BI.EditorIconCheckCombo.superclass.setEnable.apply(this, arguments); - this.editorIconCheckCombo.setEnable(v); - }, - getValue: function () { return this.trigger.getValue(); }, @@ -4141,11 +4118,6 @@ BI.IconCombo = BI.inherit(BI.Widget, { this.iconCombo.setValue(v); }, - setEnable: function (v) { - BI.IconCombo.superclass.setEnable.apply(this, arguments); - this.iconCombo.setEnable(v); - }, - getValue: function () { return this.iconCombo.getValue(); }, @@ -4431,11 +4403,6 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, { this.textIconCheckCombo.setValue(v); }, - setEnable: function (v) { - BI.TextValueCheckCombo.superclass.setEnable.apply(this, arguments); - this.textIconCheckCombo.setEnable(v); - }, - setWarningTitle: function (title) { this.trigger.setWarningTitle(title); }, @@ -4503,11 +4470,6 @@ BI.SmallTextValueCheckCombo = BI.inherit(BI.Widget, { this.SmallTextIconCheckCombo.setValue(v); }, - setEnable: function (v) { - BI.SmallTextValueCheckCombo.superclass.setEnable.apply(this, arguments); - this.SmallTextIconCheckCombo.setEnable(v); - }, - getValue: function () { return this.SmallTextIconCheckCombo.getValue(); }, @@ -4632,11 +4594,6 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { this.textIconCombo.setValue(v); }, - setEnable: function (v) { - BI.TextValueCombo.superclass.setEnable.apply(this, arguments); - this.textIconCombo.setEnable(v); - }, - getValue: function () { return this.textIconCombo.getValue(); }, @@ -4702,11 +4659,6 @@ BI.SmallTextValueCombo = BI.inherit(BI.Widget, { this.SmallTextValueCombo.setValue(v); }, - setEnable: function (v) { - BI.SmallTextValueCombo.superclass.setEnable.apply(this, arguments); - this.SmallTextValueCombo.setEnable(v); - }, - getValue: function () { return this.SmallTextValueCombo.getValue(); }, @@ -4840,11 +4792,6 @@ BI.TextValueDownListCombo = BI.inherit(BI.Widget, { this.trigger.setValue(v.childValue || v.value); }, - setEnable: function (v) { - BI.TextValueDownListCombo.superclass.setEnable.apply(this, arguments); - this.combo.setEnable(v); - }, - getValue: function () { var v = this.combo.getValue()[0]; return [v.childValue || v.value]; @@ -5248,12 +5195,6 @@ BI.SearchEditor = BI.inherit(BI.Widget, { isValid: function () { return this.editor.isValid(); - }, - - setEnable: function (b) { - BI.Editor.superclass.setEnable.apply(this, arguments); - this.editor && this.editor.setEnable(b); - this.clear.setEnable(b); } }); BI.SearchEditor.EVENT_CHANGE = "EVENT_CHANGE"; @@ -6186,11 +6127,6 @@ BI.StateEditor = BI.inherit(BI.Widget, { this.editor.setValue(k); }, - setEnable: function (v) { - this.text.setEnable(v); - this.editor.setEnable(v); - }, - getValue: function () { return this.editor.getValue(); }, @@ -6464,11 +6400,6 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { this.editor.setValue(k); }, - setEnable: function(v){ - this.text.setEnable(v); - this.editor.setEnable(v); - }, - getValue: function () { return this.editor.getValue(); }, @@ -6666,11 +6597,6 @@ BI.TextEditor = BI.inherit(BI.Widget, { getValue: function () { return this.editor.getValue(); - }, - - setEnable: function (b) { - BI.Editor.superclass.setEnable.apply(this, arguments); - this.editor && this.editor.setEnable(b); } }); BI.TextEditor.EVENT_CHANGE = "EVENT_CHANGE"; @@ -8714,10 +8640,6 @@ BI.Segment = BI.inherit(BI.Widget, { this.buttonGroup.setEnabledValue(v); }, - setEnable: function (v) { - this.buttonGroup.setEnable(v); - }, - getValue: function () { return this.buttonGroup.getValue(); } @@ -10452,13 +10374,6 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, { var isAllChecked = this.options.isAllCheckedBySelectedValue.apply(this, arguments); this.setSelected(isAllChecked); !isAllChecked && this.setHalfSelected(this.options.isHalfCheckedBySelectedValue.apply(this, arguments)); - }, - - setEnable: function (b) { - BI.MultiSelectBar.superclass.setEnable.apply(this, arguments); - this.checkbox.setEnable(b); - this.half.setEnable(b); - this.text.setEnable(b); } }); BI.MultiSelectBar.EVENT_CHANGE = "MultiSelectBar.EVENT_CHANGE"; @@ -11157,12 +11072,6 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { }); }, - setEnable: function (v) { - BI.TextTrigger.superclass.setEnable.apply(this, arguments); - this.trigerButton.setEnable(v); - this.text.setEnable(v); - }, - setValue: function (value) { this.text.setValue(value); this.text.setTitle(value); @@ -11327,12 +11236,6 @@ BI.SmallTextTrigger = BI.inherit(BI.Trigger, { }); }, - setEnable: function (v) { - BI.SmallTextTrigger.superclass.setEnable.apply(this, arguments); - this.trigerButton.setEnable(v); - this.text.setEnable(v); - }, - setValue: function (value) { this.text.setValue(value); }, diff --git a/docs/core.css b/docs/core.css index 25c5635c63..ed35e89657 100644 --- a/docs/core.css +++ b/docs/core.css @@ -3078,8 +3078,8 @@ i { } .bi-z-index-mask { color: #ffffff; - background-color: rgba(26, 26, 26, 0.3); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d1a1a1a,endColorstr=#4d1a1a1a); + background-color: rgba(26, 26, 26, 0.5); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#801a1a1a,endColorstr=#801a1a1a); } .bi-list-item:hover, .bi-list-item.hover { diff --git a/docs/core.js b/docs/core.js index c5b0bd7516..acd8075bc6 100644 --- a/docs/core.js +++ b/docs/core.js @@ -14427,17 +14427,18 @@ BI.Widget = BI.inherit(BI.OB, { _initVisualEffects: function () { var o = this.options; if (o.invisible) { - this.element.hide(); + //用display属性做显示和隐藏,否则jquery会在显示时将display设为block会覆盖掉display:flex属性 + this.element.css("display", "none"); } if (o.disabled || o.invalid) { - BI.nextTick(BI.bind(function () { - if (this.options.disabled) { - this.setEnable(false); - } - if (this.options.invalid) { - this.setValid(false); - } - }, this)); + // BI.nextTick(BI.bind(function () { + if (this.options.disabled) { + this.setEnable(false); + } + if (this.options.invalid) { + this.setValid(false); + } + // }, this)); } }, @@ -14485,6 +14486,7 @@ BI.Widget = BI.inherit(BI.OB, { this._isMounted = true; this._mountChildren && this._mountChildren(); BI.each(this._children, function (i, widget) { + !self.isEnabled() && widget._setEnable(false); widget._mount && widget._mount(); }); this.mounted && this.mounted(); @@ -14492,17 +14494,6 @@ BI.Widget = BI.inherit(BI.OB, { _mountChildren: null, - _unMount: function () { - BI.each(this._children, function (i, widget) { - widget._unMount && widget._unMount(); - }); - this._children = {}; - this._parent = null; - this._isMounted = false; - this.purgeListeners(); - this.destroyed && this.destroyed(); - }, - isMounted: function () { return this._isMounted; }, @@ -14517,12 +14508,23 @@ BI.Widget = BI.inherit(BI.OB, { this._initElementHeight(); }, - setEnable: function (enable) { + _setEnable: function (enable) { if (enable === true) { this.options.disabled = false; - this.element.removeClass("base-disabled disabled"); } else if (enable === false) { this.options.disabled = true; + } + //递归将所有子组件使能 + BI.each(this._children, function (i, child) { + child._setEnable && child._setEnable(enable); + }); + }, + + setEnable: function (enable) { + this._setEnable(enable); + if (enable === true) { + this.element.removeClass("base-disabled disabled"); + } else if (enable === false) { this.element.addClass("base-disabled disabled"); } }, @@ -14582,7 +14584,7 @@ BI.Widget = BI.inherit(BI.OB, { }, getWidgetByName: function (name) { - if (!BI.isKey(name) || name == this.getName()) { + if (!BI.isKey(name) || name === this.getName()) { return this; } name = name + ""; @@ -14682,6 +14684,21 @@ BI.Widget = BI.inherit(BI.OB, { this.setVisible(true); }, + __d: function () { + BI.each(this._children, function (i, widget) { + widget._unMount && widget._unMount(); + }); + this._children = {}; + this._parent = null; + this._isMounted = false; + }, + + _unMount: function () { + this.__d(); + this.purgeListeners(); + this.destroyed && this.destroyed(); + }, + isolate: function () { if (this._parent) { this._parent.removeWidget(this); @@ -14697,13 +14714,15 @@ BI.Widget = BI.inherit(BI.OB, { this.element.empty(); }, + _destroy: function () { + this.__d(); + this.destroyed && this.destroyed(); + this.element.destroy(); + this.purgeListeners(); + }, + destroy: function () { - BI.each(this._children, function (i, widget) { - widget._unMount && widget._unMount(); - }); - this._children = {}; - this._parent = null; - this._isMounted = false; + this.__d(); this.destroyed && this.destroyed(); this.element.destroy(); this.fireEvent(BI.Events.DESTROY); @@ -15353,7 +15372,7 @@ BI.View = BI.inherit(BI.V, { BI.each(cardNames, function (i, name) { delete self._cards[name]; }); - this._cardLayouts[key] && this._cardLayouts[key].destroy(); + this._cardLayouts[key] && this._cardLayouts[key]._destroy(); return this; }, @@ -19581,7 +19600,7 @@ BI.Layout = BI.inherit(BI.Widget, { this.options.items = newItems; this._children = newChildren; BI.each(deleted, function (i, c) { - c.destroy(); + c._destroy(); }); }, @@ -19606,7 +19625,7 @@ BI.Layout = BI.inherit(BI.Widget, { } else { w.element.prependTo(this._getWrapper()); } - del.destroy(); + del._destroy(); w._mount(); }, @@ -19693,7 +19712,7 @@ BI.Layout = BI.inherit(BI.Widget, { } o.items.splice(items.length); BI.each(deleted, function (i, w) { - w.destroy(); + w._destroy(); }) } else if (items.length > o.items.length) { for (i = o.items.length; i < items.length; i++) { @@ -19887,6 +19906,9 @@ BI.PopoverSection = BI.inherit(BI.Widget, { } }); BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";;(function () { + if (!window.BI) { + window.BI = {}; + } function isEmpty(value) { // 判断是否为空值 var result = value === "" || value === null || value === undefined; @@ -19947,124 +19969,6 @@ BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";;(function () { return text; } - /** - * 把日期对象按照指定格式转化成字符串 - * - * @example - * var date = new Date('Thu Dec 12 2013 00:00:00 GMT+0800'); - * var result = BI.date2Str(date, 'yyyy-MM-dd');//2013-12-12 - * - * @class BI.date2Str - * @param date 日期 - * @param format 日期格式 - * @returns {String} - */ - function date2Str(date, format) { - if (!date) { - return ''; - } - // O(len(format)) - var len = format.length, result = ''; - if (len > 0) { - var flagch = format.charAt(0), start = 0, str = flagch; - for (var i = 1; i < len; i++) { - var ch = format.charAt(i); - if (flagch !== ch) { - result += compileJFmt({ - 'char': flagch, - 'str': str, - 'len': i - start - }, date); - flagch = ch; - start = i; - str = flagch; - } else { - str += ch; - } - } - result += compileJFmt({ - 'char': flagch, - 'str': str, - 'len': len - start - }, date); - } - return result; - - function compileJFmt(jfmt, date) { - var str = jfmt.str, len = jfmt.len, ch = jfmt['char']; - switch (ch) { - case 'E': //星期 - str = Date._DN[date.getDay()]; - break; - case 'y': //年 - if (len <= 3) { - str = (date.getFullYear() + '').slice(2, 4); - } else { - str = date.getFullYear(); - } - break; - case 'M': //月 - if (len > 2) { - str = Date._MN[date.getMonth()]; - } else if (len < 2) { - str = date.getMonth() + 1; - } else { - str = String.leftPad(date.getMonth() + 1 + '', 2, '0'); - } - break; - case 'd': //日 - if (len > 1) { - str = String.leftPad(date.getDate() + '', 2, '0'); - } else { - str = date.getDate(); - } - break; - case 'h': //时(12) - var hour = date.getHours() % 12; - if (hour === 0) { - hour = 12; - } - if (len > 1) { - str = String.leftPad(hour + '', 2, '0'); - } else { - str = hour; - } - break; - case 'H': //时(24) - if (len > 1) { - str = String.leftPad(date.getHours() + '', 2, '0'); - } else { - str = date.getHours(); - } - break; - case 'm': - if (len > 1) { - str = String.leftPad(date.getMinutes() + '', 2, '0'); - } else { - str = date.getMinutes(); - } - break; - case 's': - if (len > 1) { - str = String.leftPad(date.getSeconds() + '', 2, '0'); - } else { - str = date.getSeconds(); - } - break; - case 'a': - str = date.getHours() < 12 ? 'am' : 'pm'; - break; - case 'z': - str = date.getTimezone(); - break; - default: - str = jfmt.str; - break; - } - return str; - } - }; - /** * 数字格式 */ @@ -20107,7 +20011,8 @@ BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";;(function () { } else { return left + '.' + right; } - }; + } + /** * 处理小数点右边小数部分 * @param tright 右边内容 @@ -20151,7 +20056,7 @@ BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";;(function () { if (newnum.length > orilen) { newnum = newnum.substr(1); } else { - newnum = BI.leftPad(newnum, orilen, '0'); + newnum = String.leftPad(newnum, orilen, '0'); result.leftPlus = false; } right = right.replace(/^[0-9]+/, newnum); @@ -20412,7 +20317,7 @@ BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";;(function () { return o; })(jo); - } + }; BI.contentFormat = function (cv, fmt) { if (isEmpty(cv)) { @@ -20454,15 +20359,122 @@ BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";;(function () { return text; }; - BI.leftPad = function (val, size, ch) { - var result = String(val); - if (!ch) { - ch = " "; + /** + * 把日期对象按照指定格式转化成字符串 + * + * @example + * var date = new Date('Thu Dec 12 2013 00:00:00 GMT+0800'); + * var result = BI.date2Str(date, 'yyyy-MM-dd');//2013-12-12 + * + * @class BI.date2Str + * @param date 日期 + * @param format 日期格式 + * @returns {String} + */ + BI.date2Str = function (date, format) { + if (!date) { + return ''; } - while (result.length < size) { - result = ch + result; + // O(len(format)) + var len = format.length, result = ''; + if (len > 0) { + var flagch = format.charAt(0), start = 0, str = flagch; + for (var i = 1; i < len; i++) { + var ch = format.charAt(i); + if (flagch !== ch) { + result += compileJFmt({ + 'char': flagch, + 'str': str, + 'len': i - start + }, date); + flagch = ch; + start = i; + str = flagch; + } else { + str += ch; + } + } + result += compileJFmt({ + 'char': flagch, + 'str': str, + 'len': len - start + }, date); + } + return result; + + function compileJFmt(jfmt, date) { + var str = jfmt.str, len = jfmt.len, ch = jfmt['char']; + switch (ch) { + case 'E': //星期 + str = Date._DN[date.getDay()]; + break; + case 'y': //年 + if (len <= 3) { + str = (date.getFullYear() + '').slice(2, 4); + } else { + str = date.getFullYear(); + } + break; + case 'M': //月 + if (len > 2) { + str = Date._MN[date.getMonth()]; + } else if (len < 2) { + str = date.getMonth() + 1; + } else { + str = String.leftPad(date.getMonth() + 1 + '', 2, '0'); + } + break; + case 'd': //日 + if (len > 1) { + str = String.leftPad(date.getDate() + '', 2, '0'); + } else { + str = date.getDate(); + } + break; + case 'h': //时(12) + var hour = date.getHours() % 12; + if (hour === 0) { + hour = 12; + } + if (len > 1) { + str = String.leftPad(hour + '', 2, '0'); + } else { + str = hour; + } + break; + case 'H': //时(24) + if (len > 1) { + str = String.leftPad(date.getHours() + '', 2, '0'); + } else { + str = date.getHours(); + } + break; + case 'm': + if (len > 1) { + str = String.leftPad(date.getMinutes() + '', 2, '0'); + } else { + str = date.getMinutes(); + } + break; + case 's': + if (len > 1) { + str = String.leftPad(date.getSeconds() + '', 2, '0'); + } else { + str = date.getSeconds(); + } + break; + case 'a': + str = date.getHours() < 12 ? 'am' : 'pm'; + break; + case 'z': + str = date.getTimezone(); + break; + default: + str = jfmt.str; + break; + } + return str; } - return result.toString(); }; BI.object2Number = function (value) { @@ -22295,7 +22307,8 @@ BI.extend(jQuery, { getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); + var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), + windowBounds = $("body").bounds(); var top, adaptHeight; if ($.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { top = comboOffset.top + extraHeight; @@ -22343,7 +22356,8 @@ BI.extend(jQuery, { getBottomAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); + var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), + windowBounds = $("body").bounds(); var top, adaptHeight; if ($.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { top = comboOffset.top + comboBounds.height - popupBounds.height - extraHeight; @@ -22369,7 +22383,8 @@ BI.extend(jQuery, { getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) { var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); + var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), + windowBounds = $("body").bounds(); if ($.isBottomSpaceEnough(combo, popup, extraHeight)) { return $.getBottomPosition(combo, popup, extraHeight); } @@ -22392,7 +22407,8 @@ BI.extend(jQuery, { getCenterAdaptPosition: function (combo, popup) { var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); + var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), + windowBounds = $("body").bounds(); var left; if (comboOffset.left + comboBounds.width / 2 + popupBounds.width / 2 > windowBounds.width) { left = windowBounds.width - popupBounds.width; @@ -22409,7 +22425,8 @@ BI.extend(jQuery, { getMiddleAdaptPosition: function (combo, popup) { var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); + var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), + windowBounds = $("body").bounds(); var top; if (comboOffset.top + comboBounds.height / 2 + popupBounds.height / 2 > windowBounds.height) { top = windowBounds.height - popupBounds.height; @@ -22605,7 +22622,7 @@ BI.extend(jQuery, { } break; } - if(needAdaptHeight === true) { + if (needAdaptHeight === true) { popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight)); } return position; @@ -22636,6 +22653,7 @@ $(function () { }; } var t, text, py; + keyword = keyword + ""; keyword = BI.toUpperCase(keyword); var matched = isArray ? [] : {}, finded = isArray ? [] : {}; BI.each(items, function (i, item) { @@ -23503,7 +23521,6 @@ Date._QN = ["", BI.i18nText("BI-Quarter_1"), BI.i18nText("BI-Quarter_3"), BI.i18nText("BI-Quarter_4")]; - /** Adds the number of days array to the Date object. */ Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; @@ -23977,7 +23994,8 @@ Date.parseDateTime = function (str, fmt) { return new Date(y, m, d, hr, min, sec); } return today; -};/* +}; +/* * 给jQuery.Event对象添加的工具方法 */ $.extend($.Event.prototype, { @@ -26545,7 +26563,7 @@ BI.CardLayout = BI.inherit(BI.Layout, { var child = this._children[cardName]; this._deleteCardByName(cardName); - child && child.destroy(); + child && child._destroy(); }, addCardByName: function (cardName, cardItem) { diff --git a/docs/widget.js b/docs/widget.js index 42fb0ced59..9ec134e1a4 100644 --- a/docs/widget.js +++ b/docs/widget.js @@ -10048,10 +10048,6 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, { this.button_group.populate.apply(this.button_group, arguments); }, - setEnable: function (arg) { - this.button_group.setEnable(arg); - }, - resetHeight: function (h) { this.button_group.resetHeight(h); }, @@ -10138,10 +10134,6 @@ BI.MultiSelectPopupView = BI.inherit(BI.Widget, { this.popupView.populate.apply(this.popupView, arguments); }, - setEnable: function (arg) { - this.popupView.setEnable(arg); - }, - resetHeight: function (h) { this.popupView.resetHeight(h); }, @@ -10291,10 +10283,6 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, { this.numberCounter.setValue(ob); }, - setEnable: function (v) { - this.searcher.setEnable(v); - }, - getKey: function () { return this.searcher.getKey(); }, @@ -10454,10 +10442,6 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { this.button_group.populate.apply(this.button_group, arguments); }, - setEnable: function (arg) { - this.button_group.setEnable(arg); - }, - resetHeight: function (h) { this.button_group.resetHeight(h); }, @@ -10703,10 +10687,6 @@ BI.MultiSelectEditor = BI.inherit(BI.Widget, { this.editor.setValue(v); }, - setEnable: function(v){ - this.editor.setEnable(v); - }, - getValue: function () { var v = this.editor.getState(); if (BI.isArray(v) && v.length > 0) { @@ -10866,10 +10846,6 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { return this.searcher.getValue(); }, - setEnable: function (v) { - this.editor.setEnable(v); - }, - populate: function (items) { this.searcher.populate.apply(this.searcher, arguments); } @@ -11267,11 +11243,6 @@ BI.MultiStringList = BI.inherit(BI.Widget, { this.trigger.getSearcher().adjustView(); }, - setEnable: function (v) { - this.trigger.setEnable(v); - this.popup.setEnable(v); - }, - setValue: function (v) { this.storeValue = v || {}; this._assertValue(this.storeValue); @@ -11649,10 +11620,6 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { this.combo.hideView(); }, - setEnable: function (v) { - this.combo.setEnable(v); - }, - setValue: function (v) { this.storeValue.value = v || {}; this.combo.setValue({ @@ -11752,10 +11719,6 @@ BI.MultiTreePopup = BI.inherit(BI.Pane, { return this.tree.hasChecked(); }, - setEnable: function (arg) { - this.popupView.setEnable(arg); - }, - resetHeight: function (h) { this.popupView.resetHeight(h); }, @@ -12030,10 +11993,6 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { return this.editor.getValue(); }, - setEnable: function(v){ - this.editor.setEnable(v); - }, - getValue: function () { return this.searcher.getValue(); }, @@ -12200,11 +12159,6 @@ BI.MultiTreeList = BI.inherit(BI.Widget, { this.trigger.getSearcher().adjustView(); }, - setEnable: function (v) { - this.trigger.setEnable(v); - this.popup.setEnable(v); - }, - setValue: function (v) { this.storeValue.value = v || {}; this.popup.setValue({ @@ -12704,13 +12658,6 @@ BI.NumericalInterval = BI.inherit(BI.Single, { return this.options.validation === "valid"; }, - setEnable: function (b) { - this.smallEditor.setEnable(b); - this.smallCombo.setEnable(b); - this.bigEditor.setEnable(b); - this.bigCombo.setEnable(b); - }, - setMinEnable: function (b) { this.smallEditor.setEnable(b); }, diff --git a/src/base/collection/collection.js b/src/base/collection/collection.js index f830cb050a..111c833e88 100644 --- a/src/base/collection/collection.js +++ b/src/base/collection/collection.js @@ -1,13 +1,13 @@ /** - * Collection + * CollectionView * * Created by GUY on 2016/1/15. - * @class BI.Collection + * @class BI.CollectionView * @extends BI.Widget */ -BI.Collection = BI.inherit(BI.Widget, { +BI.CollectionView = BI.inherit(BI.Widget, { _defaultConfig: function () { - return BI.extend(BI.Collection.superclass._defaultConfig.apply(this, arguments), { + return BI.extend(BI.CollectionView.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-collection", width: 400, height: 300, @@ -23,7 +23,7 @@ BI.Collection = BI.inherit(BI.Widget, { }, _init: function () { - BI.Collection.superclass._init.apply(this, arguments); + BI.CollectionView.superclass._init.apply(this, arguments); var self = this, o = this.options; this.renderedCells = []; this.renderedKeys = []; @@ -42,7 +42,7 @@ BI.Collection = BI.inherit(BI.Widget, { o.scrollLeft = self.element.scrollLeft(); o.scrollTop = self.element.scrollTop(); self._calculateChildrenToRender(); - self.fireEvent(BI.Collection.EVENT_SCROLL, { + self.fireEvent(BI.CollectionView.EVENT_SCROLL, { scrollLeft: o.scrollLeft, scrollTop: o.scrollTop }); @@ -127,7 +127,7 @@ BI.Collection = BI.inherit(BI.Widget, { return; } var childrenToDisplay = this._cellRenderers(bottom - top, right - left, left, top); - var renderedCells = [], renderedKeys = []; + var renderedCells = [], renderedKeys = [], renderedWidgets = {}; //存储所有的left和top var lefts = {}, tops = {}; for (var i = 0, len = childrenToDisplay.length; i < len; i++) { @@ -210,6 +210,7 @@ BI.Collection = BI.inherit(BI.Widget, { } renderedKeys.push(datum.index); + renderedWidgets[i] = child; } //已存在的, 需要添加的和需要删除的 var existSet = {}, addSet = {}, deleteArray = []; @@ -230,13 +231,17 @@ BI.Collection = BI.inherit(BI.Widget, { deleteArray.push(i); }); BI.each(deleteArray, function (i, index) { - self.renderedCells[index].el.destroy(); + //性能优化,不调用destroy方法防止触发destroy事件 + self.renderedCells[index].el._destroy(); }); var addedItems = []; BI.each(addSet, function (index) { addedItems.push(renderedCells[index]) }); this.container.addItems(addedItems); + //拦截父子级关系 + this.container._children = renderedWidgets; + this.container.attr("items", renderedCells); this.renderedCells = renderedCells; this.renderedKeys = renderedKeys; @@ -347,5 +352,5 @@ BI.Collection = BI.inherit(BI.Widget, { this._populate(); } }); -BI.Collection.EVENT_SCROLL = "EVENT_SCROLL"; -BI.shortcut('bi.collection_view', BI.Collection); \ No newline at end of file +BI.CollectionView.EVENT_SCROLL = "EVENT_SCROLL"; +BI.shortcut('bi.collection_view', BI.CollectionView); \ No newline at end of file diff --git a/src/base/combination/combo.js b/src/base/combination/combo.js index fae9df9728..7a43f70703 100644 --- a/src/base/combination/combo.js +++ b/src/base/combination/combo.js @@ -325,10 +325,8 @@ BI.Combo = BI.inherit(BI.Widget, { this.combo.populate.apply(this.combo, arguments); }, - setEnable: function (arg) { - BI.Combo.superclass.setEnable.apply(this, arguments); - this.combo && this.combo.setEnable(arg); - this.popupView && this.popupView.setEnable(arg); + _setEnable: function (arg) { + BI.Combo.superclass._setEnable.apply(this, arguments); !arg && this.isViewVisible() && this._hideView(); }, diff --git a/src/base/combination/expander.js b/src/base/combination/expander.js index 34a7fa7fe5..5bfdb89a16 100644 --- a/src/base/combination/expander.js +++ b/src/base/combination/expander.js @@ -39,7 +39,7 @@ BI.Expander = BI.inherit(BI.Widget, { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Expander.EVENT_EXPAND); } - if(type === BI.Events.COLLAPSE) { + if (type === BI.Events.COLLAPSE) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Expander.EVENT_COLLAPSE); } @@ -196,11 +196,9 @@ BI.Expander = BI.inherit(BI.Widget, { this.expander.populate.apply(this.expander, arguments); }, - setEnable: function (arg) { - BI.Expander.superclass.setEnable.apply(this, arguments); - this.expander && this.expander.setEnable(arg); - this.popupView && this.popupView.setEnable(arg); - !arg && this._hideView(); + _setEnable: function (arg) { + BI.Expander.superclass._setEnable.apply(this, arguments); + !arg && this.isViewVisible() && this._hideView(); }, setValue: function (v) { diff --git a/src/base/combination/group.button.js b/src/base/combination/group.button.js index 2da4ee7fdf..76be065fba 100644 --- a/src/base/combination/group.button.js +++ b/src/base/combination/group.button.js @@ -189,13 +189,6 @@ BI.ButtonGroup = BI.inherit(BI.Widget, { this.layouts = BI.createWidget(BI.extend({element: this}, this._packageLayout(items))); }, - setEnable: function (b) { - BI.ButtonGroup.superclass.setEnable.apply(this, arguments); - BI.each(this.buttons, function (i, item) { - item.setEnable(b); - }); - }, - setNotSelectedValue: function (v) { v = BI.isArray(v) ? v : [v]; BI.each(this.buttons, function (i, item) { diff --git a/src/base/combination/group.combo.js b/src/base/combination/group.combo.js index 2d3314fd39..19339f13f9 100644 --- a/src/base/combination/group.combo.js +++ b/src/base/combination/group.combo.js @@ -83,11 +83,6 @@ BI.ComboGroup = BI.inherit(BI.Widget, { }) }, - setEnable: function (b) { - BI.ComboGroup.superclass.setEnable.apply(this, arguments); - this.combo && this.combo.setEnable(b); - }, - getValue: function () { return this.combo.getValue(); }, diff --git a/src/base/combination/loader.js b/src/base/combination/loader.js index 50ecdc3ffb..ee25cd4ae9 100644 --- a/src/base/combination/loader.js +++ b/src/base/combination/loader.js @@ -195,10 +195,6 @@ BI.Loader = BI.inherit(BI.Widget, { this.button_group.populate.apply(this.button_group, arguments); }, - setEnable: function (v) { - this.button_group.setEnable(v); - }, - doBehavior: function () { this.button_group.doBehavior.apply(this.button_group, arguments); }, diff --git a/src/base/combination/switcher.js b/src/base/combination/switcher.js index c72715b633..f279eaabb4 100644 --- a/src/base/combination/switcher.js +++ b/src/base/combination/switcher.js @@ -186,11 +186,9 @@ BI.Switcher = BI.inherit(BI.Widget, { this.switcher.populate.apply(this.switcher, arguments); }, - setEnable: function (arg) { - BI.Switcher.superclass.setEnable.apply(this, arguments); - this.switcher && this.switcher.setEnable(arg); - this.popupView && this.popupView.setEnable(arg); - !arg && this._hideView(); + _setEnable: function (arg) { + BI.Switcher.superclass._setEnable.apply(this, arguments); + !arg && this.isViewVisible() && this._hideView(); }, setValue: function (v) { diff --git a/src/base/grid/grid.js b/src/base/grid/grid.js index 43fa51746e..82e00bad64 100644 --- a/src/base/grid/grid.js +++ b/src/base/grid/grid.js @@ -1,13 +1,13 @@ /** - * Grid + * GridView * * Created by GUY on 2016/1/11. - * @class BI.Grid + * @class BI.GridView * @extends BI.Widget */ -BI.Grid = BI.inherit(BI.Widget, { +BI.GridView = BI.inherit(BI.Widget, { _defaultConfig: function () { - return BI.extend(BI.Grid.superclass._defaultConfig.apply(this, arguments), { + return BI.extend(BI.GridView.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-grid-view", width: 400, height: 300, @@ -26,7 +26,7 @@ BI.Grid = BI.inherit(BI.Widget, { }, _init: function () { - BI.Grid.superclass._init.apply(this, arguments); + BI.GridView.superclass._init.apply(this, arguments); var self = this, o = this.options; this.renderedCells = []; this.renderedKeys = []; @@ -45,7 +45,7 @@ BI.Grid = BI.inherit(BI.Widget, { o.scrollLeft = self.element.scrollLeft(); o.scrollTop = self.element.scrollTop(); self._calculateChildrenToRender(); - self.fireEvent(BI.Grid.EVENT_SCROLL, { + self.fireEvent(BI.GridView.EVENT_SCROLL, { scrollLeft: o.scrollLeft, scrollTop: o.scrollTop }); @@ -121,7 +121,7 @@ BI.Grid = BI.inherit(BI.Widget, { return; } - var renderedCells = [], renderedKeys = []; + var renderedCells = [], renderedKeys = [], renderedWidgets = {}; var minX = this._getMaxScrollLeft(), minY = this._getMaxScrollTop(), maxX = 0, maxY = 0; for (var rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) { var rowDatum = this._rowSizeAndPositionManager.getSizeAndPositionOfCell(rowIndex); @@ -172,6 +172,7 @@ BI.Grid = BI.inherit(BI.Widget, { minY = Math.min(minY, rowDatum.offset + verticalOffsetAdjustment); maxY = Math.max(maxY, rowDatum.offset + verticalOffsetAdjustment + rowDatum.size); renderedKeys.push(key); + renderedWidgets[i] = child; } } //已存在的, 需要添加的和需要删除的 @@ -193,13 +194,17 @@ BI.Grid = BI.inherit(BI.Widget, { deleteArray.push(i); }); BI.each(deleteArray, function (i, index) { - self.renderedCells[index].el.destroy(); + //性能优化,不调用destroy方法防止触发destroy事件 + self.renderedCells[index].el._destroy(); }); var addedItems = []; BI.each(addSet, function (index) { addedItems.push(renderedCells[index]) }); this.container.addItems(addedItems); + //拦截父子级关系 + this.container._children = renderedWidgets; + this.container.attr("items", renderedCells); this.renderedCells = renderedCells; this.renderedKeys = renderedKeys; this.renderRange = {minX: minX, minY: minY, maxX: maxX, maxY: maxY}; @@ -318,5 +323,5 @@ BI.Grid = BI.inherit(BI.Widget, { this._populate(); } }); -BI.Grid.EVENT_SCROLL = "EVENT_SCROLL"; -BI.shortcut('bi.grid_view', BI.Grid); \ No newline at end of file +BI.GridView.EVENT_SCROLL = "EVENT_SCROLL"; +BI.shortcut('bi.grid_view', BI.GridView); \ No newline at end of file diff --git a/src/base/layer/layer.popup.js b/src/base/layer/layer.popup.js index 2f86dad9a2..1af2125776 100644 --- a/src/base/layer/layer.popup.js +++ b/src/base/layer/layer.popup.js @@ -158,11 +158,6 @@ BI.PopupView = BI.inherit(BI.Widget, { this.view.element.css({"max-height": (h - tbHeight - tabHeight - toolHeight - 2) + "px"}) }, - setEnable: function (arg) { - BI.PopupView.superclass.setEnable.apply(this, arguments); - this.view && this.view.setEnable(arg); - }, - setValue: function (selectedValues) { this.tab && this.tab.setValue(selectedValues); this.button_group.setValue(selectedValues); diff --git a/src/base/single/button/button.basic.js b/src/base/single/button/button.basic.js index 19aa8075d6..80b513862d 100644 --- a/src/base/single/button/button.basic.js +++ b/src/base/single/button/button.basic.js @@ -298,9 +298,14 @@ BI.BasicButton = BI.inherit(BI.Single, { return this.options.text; }, - setEnable: function (b) { - BI.BasicButton.superclass.setEnable.apply(this, arguments); - if (!b) { + _setEnable: function (enable) { + BI.BasicButton.superclass._setEnable.apply(this, arguments); + if (enable === true) { + this.element.removeClass("base-disabled disabled"); + } else if (enable === false) { + this.element.addClass("base-disabled disabled"); + } + if (!enable) { if (this.options.shadow) { this.$mask && this.$mask.setVisible(false); } diff --git a/src/base/single/button/buttons/button.js b/src/base/single/button/buttons/button.js index 51854f5c26..9e02af0481 100644 --- a/src/base/single/button/buttons/button.js +++ b/src/base/single/button/buttons/button.js @@ -119,12 +119,6 @@ } }, - setEnable: function (b) { - BI.Button.superclass.setEnable.apply(this, arguments); - // this.text.setEnable(b); - // this.icon && this.icon.setEnable(b); - }, - doRedMark: function () { this.text.doRedMark.apply(this.text, arguments); }, diff --git a/src/base/single/editor/editor.code.js b/src/base/single/editor/editor.code.js index e8beba8c86..3a8292d0ce 100644 --- a/src/base/single/editor/editor.code.js +++ b/src/base/single/editor/editor.code.js @@ -76,8 +76,8 @@ BI.CodeEditor = BI.inherit(BI.Single, { } }, - setEnable: function (b) { - BI.CodeEditor.superclass.setEnable.apply(this, arguments); + _setEnable: function (b) { + BI.CodeEditor.superclass._setEnable.apply(this, arguments); this.editor.setOption("readOnly", b === true ? false : "nocursor") }, diff --git a/src/base/single/editor/editor.js b/src/base/single/editor/editor.js index 44b7781ec9..b352506e29 100644 --- a/src/base/single/editor/editor.js +++ b/src/base/single/editor/editor.js @@ -303,12 +303,6 @@ BI.Editor = BI.inherit(BI.Single, { isValid: function () { return this.editor.isValid(); - }, - - setEnable: function (b) { - BI.Editor.superclass.setEnable.apply(this, arguments); - this.editor && this.editor.setEnable(b); - this.watermark && this.watermark.setEnable(b); } }); BI.Editor.EVENT_CHANGE = "EVENT_CHANGE"; diff --git a/src/base/single/editor/editor.multifile.js b/src/base/single/editor/editor.multifile.js index b2823a2f14..dd25c7c0e6 100644 --- a/src/base/single/editor/editor.multifile.js +++ b/src/base/single/editor/editor.multifile.js @@ -79,11 +79,6 @@ BI.MultifileEditor = BI.inherit(BI.Single, { reset: function () { this.file.reset(); - }, - - setEnable: function (enable) { - BI.MultiFile.superclass.setEnable.apply(this, arguments); - this.file.setEnable(enable); } }); BI.MultifileEditor.EVENT_CHANGE = "MultifileEditor.EVENT_CHANGE"; diff --git a/src/base/single/editor/editor.textarea.js b/src/base/single/editor/editor.textarea.js index daa12f8a84..15c6bc7a15 100644 --- a/src/base/single/editor/editor.textarea.js +++ b/src/base/single/editor/editor.textarea.js @@ -153,12 +153,6 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { BI.TextAreaEditor.superclass.setValid.apply(this, arguments); this.content.setValid(b); this.watermark && this.watermark.setValid(b); - }, - - setEnable: function (b) { - BI.TextAreaEditor.superclass.setEnable.apply(this, arguments); - this.content.setEnable(b); - this.watermark && this.watermark.setEnable(b); } }); BI.TextAreaEditor.EVENT_CHANGE = "EVENT_CHANGE"; diff --git a/src/base/single/input/file.js b/src/base/single/input/file.js index 6dc191f1a6..8b4d57a11a 100644 --- a/src/base/single/input/file.js +++ b/src/base/single/input/file.js @@ -601,8 +601,8 @@ this.wrap.attachNum = 0; }, - setEnable: function (enable) { - BI.File.superclass.setEnable.apply(this, arguments); + _setEnable: function (enable) { + BI.File.superclass._setEnable.apply(this, arguments); if (enable === true) { this.element.attr("disabled", "disabled"); } else { diff --git a/src/base/single/input/input.js b/src/base/single/input/input.js index af92d1ca42..06d59168ec 100644 --- a/src/base/single/input/input.js +++ b/src/base/single/input/input.js @@ -256,8 +256,8 @@ BI.Input = BI.inherit(BI.Single, { } }, - setEnable: function (b) { - BI.Input.superclass.setEnable.apply(this, [b]); + _setEnable: function (b) { + BI.Input.superclass._setEnable.apply(this, [b]); this.element[0].disabled = !b; } }); diff --git a/src/base/table/table.collection.js b/src/base/table/table.collection.js index c60b8333a8..535b3e1aeb 100644 --- a/src/base/table/table.collection.js +++ b/src/base/table/table.collection.js @@ -34,7 +34,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, { return self.topLeftItems[index]; } }); - this.topLeftCollection.on(BI.Collection.EVENT_SCROLL, function (scroll) { + this.topLeftCollection.on(BI.CollectionView.EVENT_SCROLL, function (scroll) { self.bottomLeftCollection.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); @@ -45,7 +45,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, { return self.topRightItems[index]; } }); - this.topRightCollection.on(BI.Collection.EVENT_SCROLL, function (scroll) { + this.topRightCollection.on(BI.CollectionView.EVENT_SCROLL, function (scroll) { self.bottomRightCollection.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); @@ -56,7 +56,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, { return self.bottomLeftItems[index]; } }); - this.bottomLeftCollection.on(BI.Collection.EVENT_SCROLL, function (scroll) { + this.bottomLeftCollection.on(BI.CollectionView.EVENT_SCROLL, function (scroll) { self.bottomRightCollection.setScrollTop(scroll.scrollTop); self.topLeftCollection.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); @@ -68,7 +68,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, { return self.bottomRightItems[index]; } }); - this.bottomRightCollection.on(BI.Collection.EVENT_SCROLL, function (scroll) { + this.bottomRightCollection.on(BI.CollectionView.EVENT_SCROLL, function (scroll) { self.bottomLeftCollection.setScrollTop(scroll.scrollTop); self.topRightCollection.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); diff --git a/src/base/table/table.grid.js b/src/base/table/table.grid.js index 1ddee09e40..873a581b83 100644 --- a/src/base/table/table.grid.js +++ b/src/base/table/table.grid.js @@ -39,7 +39,7 @@ BI.GridTable = BI.inherit(BI.Widget, { rowHeightGetter: rowHeightGetter, columnWidthGetter: columnLeftWidthGetter, }); - this.topLeftGrid.on(BI.Grid.EVENT_SCROLL, function (scroll) { + this.topLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { self.bottomLeftGrid.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); @@ -49,7 +49,7 @@ BI.GridTable = BI.inherit(BI.Widget, { rowHeightGetter: rowHeightGetter, columnWidthGetter: columnRightWidthGetter, }); - this.topRightGrid.on(BI.Grid.EVENT_SCROLL, function (scroll) { + this.topRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { self.bottomRightGrid.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); @@ -59,7 +59,7 @@ BI.GridTable = BI.inherit(BI.Widget, { rowHeightGetter: rowHeightGetter, columnWidthGetter: columnLeftWidthGetter, }); - this.bottomLeftGrid.on(BI.Grid.EVENT_SCROLL, function (scroll) { + this.bottomLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { self.bottomRightGrid.setScrollTop(scroll.scrollTop); self.topLeftGrid.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); @@ -70,7 +70,7 @@ BI.GridTable = BI.inherit(BI.Widget, { rowHeightGetter: rowHeightGetter, columnWidthGetter: columnRightWidthGetter, }); - this.bottomRightGrid.on(BI.Grid.EVENT_SCROLL, function (scroll) { + this.bottomRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { self.bottomLeftGrid.setScrollTop(scroll.scrollTop); self.topRightGrid.setScrollLeft(scroll.scrollLeft); self._populateScrollbar(); diff --git a/src/base/tree/customtree.js b/src/base/tree/customtree.js index 22e71e64a4..1d5342ae88 100644 --- a/src/base/tree/customtree.js +++ b/src/base/tree/customtree.js @@ -35,11 +35,6 @@ BI.CustomTree = BI.inherit(BI.Widget, { this.initTree(this.options.items); }, - setEnable: function (v) { - BI.CustomTree.superclass.setEnable.apply(this, arguments); - this.tree.setEnable(v) - }, - _formatItems: function (nodes) { var self = this, o = this.options; nodes = BI.Tree.transformToTreeFormat(nodes); diff --git a/src/case/button/icon/icon.change.js b/src/case/button/icon/icon.change.js index 2511072e51..69c050fdbc 100644 --- a/src/case/button/icon/icon.change.js +++ b/src/case/button/icon/icon.change.js @@ -77,11 +77,6 @@ BI.IconChangeButton = BI.inherit(BI.Single, { this.element.removeClass(o.iconClass).addClass(cls); o.iconClass = cls; } - }, - - setEnable: function (b) { - BI.IconChangeButton.superclass.setEnable.apply(this, arguments); - this.button.setEnable(b); } }); BI.IconChangeButton.EVENT_CHANGE = "IconChangeButton.EVENT_CHANGE"; diff --git a/src/case/button/item.multiselect.js b/src/case/button/item.multiselect.js index b7b7eed428..5a6ac20425 100644 --- a/src/case/button/item.multiselect.js +++ b/src/case/button/item.multiselect.js @@ -50,11 +50,6 @@ BI.MultiSelectItem = BI.inherit(BI.BasicButton, { })))); }, - setEnable: function (v) { - BI.MultiSelectItem.superclass.setEnable.apply(this, arguments); - this.checkbox.setEnable(v); - }, - doRedMark: function () { this.text.doRedMark.apply(this.text, arguments); }, diff --git a/src/case/colorchooser/colorchooser.js b/src/case/colorchooser/colorchooser.js index 302a54fb79..af97fa9547 100644 --- a/src/case/colorchooser/colorchooser.js +++ b/src/case/colorchooser/colorchooser.js @@ -70,10 +70,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, { return this.combo.isViewVisible(); }, - setEnable: function (v) { - this.combo.setEnable(v) - }, - setValue: function (color) { this.combo.setValue(color); }, diff --git a/src/case/combo/bubblecombo/combo.bubble.js b/src/case/combo/bubblecombo/combo.bubble.js index 023872a577..8801475f27 100644 --- a/src/case/combo/bubblecombo/combo.bubble.js +++ b/src/case/combo/bubblecombo/combo.bubble.js @@ -201,10 +201,6 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { isViewVisible: function () { return this.combo.isViewVisible(); - }, - - setEnable: function (v) { - this.combo.setEnable(!!v); } }); diff --git a/src/case/combo/editoriconcheckcombo/combo.editoriconcheck.js b/src/case/combo/editoriconcheckcombo/combo.editoriconcheck.js index 1dc5259604..39c5bb11ef 100644 --- a/src/case/combo/editoriconcheckcombo/combo.editoriconcheck.js +++ b/src/case/combo/editoriconcheckcombo/combo.editoriconcheck.js @@ -62,11 +62,6 @@ BI.EditorIconCheckCombo = BI.inherit(BI.Widget, { this.editorIconCheckCombo.setValue(v); }, - setEnable: function (v) { - BI.EditorIconCheckCombo.superclass.setEnable.apply(this, arguments); - this.editorIconCheckCombo.setEnable(v); - }, - getValue: function () { return this.trigger.getValue(); }, diff --git a/src/case/combo/iconcombo/combo.icon.js b/src/case/combo/iconcombo/combo.icon.js index 74ddacdc52..75666fc6ca 100644 --- a/src/case/combo/iconcombo/combo.icon.js +++ b/src/case/combo/iconcombo/combo.icon.js @@ -81,11 +81,6 @@ BI.IconCombo = BI.inherit(BI.Widget, { this.iconCombo.setValue(v); }, - setEnable: function (v) { - BI.IconCombo.superclass.setEnable.apply(this, arguments); - this.iconCombo.setEnable(v); - }, - getValue: function () { return this.iconCombo.getValue(); }, diff --git a/src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js b/src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js index 352c6be785..47608a8caa 100644 --- a/src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js +++ b/src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js @@ -56,11 +56,6 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, { this.textIconCheckCombo.setValue(v); }, - setEnable: function (v) { - BI.TextValueCheckCombo.superclass.setEnable.apply(this, arguments); - this.textIconCheckCombo.setEnable(v); - }, - setWarningTitle: function (title) { this.trigger.setWarningTitle(title); }, diff --git a/src/case/combo/textvaluecheckcombo/combo.textvaluechecksmall.js b/src/case/combo/textvaluecheckcombo/combo.textvaluechecksmall.js index 0de03ef9ed..a5bcdcaa6f 100644 --- a/src/case/combo/textvaluecheckcombo/combo.textvaluechecksmall.js +++ b/src/case/combo/textvaluecheckcombo/combo.textvaluechecksmall.js @@ -51,11 +51,6 @@ BI.SmallTextValueCheckCombo = BI.inherit(BI.Widget, { this.SmallTextIconCheckCombo.setValue(v); }, - setEnable: function (v) { - BI.SmallTextValueCheckCombo.superclass.setEnable.apply(this, arguments); - this.SmallTextIconCheckCombo.setEnable(v); - }, - getValue: function () { return this.SmallTextIconCheckCombo.getValue(); }, diff --git a/src/case/combo/textvaluecombo/combo.textvalue.js b/src/case/combo/textvaluecombo/combo.textvalue.js index 53e7c95942..3e58873df6 100644 --- a/src/case/combo/textvaluecombo/combo.textvalue.js +++ b/src/case/combo/textvaluecombo/combo.textvalue.js @@ -53,11 +53,6 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { this.textIconCombo.setValue(v); }, - setEnable: function (v) { - BI.TextValueCombo.superclass.setEnable.apply(this, arguments); - this.textIconCombo.setEnable(v); - }, - getValue: function () { return this.textIconCombo.getValue(); }, diff --git a/src/case/combo/textvaluecombo/combo.textvaluesmall.js b/src/case/combo/textvaluecombo/combo.textvaluesmall.js index 54e6a9cce7..3a6c86057f 100644 --- a/src/case/combo/textvaluecombo/combo.textvaluesmall.js +++ b/src/case/combo/textvaluecombo/combo.textvaluesmall.js @@ -53,11 +53,6 @@ BI.SmallTextValueCombo = BI.inherit(BI.Widget, { this.SmallTextValueCombo.setValue(v); }, - setEnable: function (v) { - BI.SmallTextValueCombo.superclass.setEnable.apply(this, arguments); - this.SmallTextValueCombo.setEnable(v); - }, - getValue: function () { return this.SmallTextValueCombo.getValue(); }, diff --git a/src/case/combo/textvaluedownlistcombo/combo.textvaluedownlist.js b/src/case/combo/textvaluedownlistcombo/combo.textvaluedownlist.js index 95247087bb..94c69b8d0f 100644 --- a/src/case/combo/textvaluedownlistcombo/combo.textvaluedownlist.js +++ b/src/case/combo/textvaluedownlistcombo/combo.textvaluedownlist.js @@ -64,11 +64,6 @@ BI.TextValueDownListCombo = BI.inherit(BI.Widget, { this.trigger.setValue(v.childValue || v.value); }, - setEnable: function (v) { - BI.TextValueDownListCombo.superclass.setEnable.apply(this, arguments); - this.combo.setEnable(v); - }, - getValue: function () { var v = this.combo.getValue()[0]; return [v.childValue || v.value]; diff --git a/src/case/editor/editor.search.js b/src/case/editor/editor.search.js index f4f5218eb9..1cad5eb312 100644 --- a/src/case/editor/editor.search.js +++ b/src/case/editor/editor.search.js @@ -168,12 +168,6 @@ BI.SearchEditor = BI.inherit(BI.Widget, { isValid: function () { return this.editor.isValid(); - }, - - setEnable: function (b) { - BI.Editor.superclass.setEnable.apply(this, arguments); - this.editor && this.editor.setEnable(b); - this.clear.setEnable(b); } }); BI.SearchEditor.EVENT_CHANGE = "EVENT_CHANGE"; diff --git a/src/case/editor/editor.state.js b/src/case/editor/editor.state.js index 129bd274bc..8156f33444 100644 --- a/src/case/editor/editor.state.js +++ b/src/case/editor/editor.state.js @@ -201,11 +201,6 @@ BI.StateEditor = BI.inherit(BI.Widget, { this.editor.setValue(k); }, - setEnable: function (v) { - this.text.setEnable(v); - this.editor.setEnable(v); - }, - getValue: function () { return this.editor.getValue(); }, diff --git a/src/case/editor/editor.state.simple.js b/src/case/editor/editor.state.simple.js index f343a8cda8..2d89d53ca4 100644 --- a/src/case/editor/editor.state.simple.js +++ b/src/case/editor/editor.state.simple.js @@ -199,11 +199,6 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { this.editor.setValue(k); }, - setEnable: function(v){ - this.text.setEnable(v); - this.editor.setEnable(v); - }, - getValue: function () { return this.editor.getValue(); }, diff --git a/src/case/editor/editor.text.js b/src/case/editor/editor.text.js index ad8cc8789e..d610ab1c2f 100644 --- a/src/case/editor/editor.text.js +++ b/src/case/editor/editor.text.js @@ -141,11 +141,6 @@ BI.TextEditor = BI.inherit(BI.Widget, { getValue: function () { return this.editor.getValue(); - }, - - setEnable: function (b) { - BI.Editor.superclass.setEnable.apply(this, arguments); - this.editor && this.editor.setEnable(b); } }); BI.TextEditor.EVENT_CHANGE = "EVENT_CHANGE"; diff --git a/src/case/segment/segment.js b/src/case/segment/segment.js index 0979baaa09..7a8f1fad0b 100644 --- a/src/case/segment/segment.js +++ b/src/case/segment/segment.js @@ -46,10 +46,6 @@ BI.Segment = BI.inherit(BI.Widget, { this.buttonGroup.setEnabledValue(v); }, - setEnable: function (v) { - this.buttonGroup.setEnable(v); - }, - getValue: function () { return this.buttonGroup.getValue(); } diff --git a/src/case/toolbar/toolbar.multiselect.js b/src/case/toolbar/toolbar.multiselect.js index 262167d246..78c4b049b3 100644 --- a/src/case/toolbar/toolbar.multiselect.js +++ b/src/case/toolbar/toolbar.multiselect.js @@ -121,13 +121,6 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, { var isAllChecked = this.options.isAllCheckedBySelectedValue.apply(this, arguments); this.setSelected(isAllChecked); !isAllChecked && this.setHalfSelected(this.options.isHalfCheckedBySelectedValue.apply(this, arguments)); - }, - - setEnable: function (b) { - BI.MultiSelectBar.superclass.setEnable.apply(this, arguments); - this.checkbox.setEnable(b); - this.half.setEnable(b); - this.text.setEnable(b); } }); BI.MultiSelectBar.EVENT_CHANGE = "MultiSelectBar.EVENT_CHANGE"; diff --git a/src/case/trigger/trigger.text.js b/src/case/trigger/trigger.text.js index 91b73742c0..46681eba90 100644 --- a/src/case/trigger/trigger.text.js +++ b/src/case/trigger/trigger.text.js @@ -48,12 +48,6 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { }); }, - setEnable: function (v) { - BI.TextTrigger.superclass.setEnable.apply(this, arguments); - this.trigerButton.setEnable(v); - this.text.setEnable(v); - }, - setValue: function (value) { this.text.setValue(value); this.text.setTitle(value); diff --git a/src/case/trigger/trigger.text.small.js b/src/case/trigger/trigger.text.small.js index b524e9a6ad..3fb1c39fe9 100644 --- a/src/case/trigger/trigger.text.small.js +++ b/src/case/trigger/trigger.text.small.js @@ -47,12 +47,6 @@ BI.SmallTextTrigger = BI.inherit(BI.Trigger, { }); }, - setEnable: function (v) { - BI.SmallTextTrigger.superclass.setEnable.apply(this, arguments); - this.trigerButton.setEnable(v); - this.text.setEnable(v); - }, - setValue: function (value) { this.text.setValue(value); }, diff --git a/src/core/alias.js b/src/core/alias.js index 0abe30e403..59f7c55422 100644 --- a/src/core/alias.js +++ b/src/core/alias.js @@ -1,4 +1,7 @@ ;(function () { + if (!window.BI) { + window.BI = {}; + } function isEmpty(value) { // 判断是否为空值 var result = value === "" || value === null || value === undefined; @@ -59,124 +62,6 @@ return text; } - /** - * 把日期对象按照指定格式转化成字符串 - * - * @example - * var date = new Date('Thu Dec 12 2013 00:00:00 GMT+0800'); - * var result = BI.date2Str(date, 'yyyy-MM-dd');//2013-12-12 - * - * @class BI.date2Str - * @param date 日期 - * @param format 日期格式 - * @returns {String} - */ - function date2Str(date, format) { - if (!date) { - return ''; - } - // O(len(format)) - var len = format.length, result = ''; - if (len > 0) { - var flagch = format.charAt(0), start = 0, str = flagch; - for (var i = 1; i < len; i++) { - var ch = format.charAt(i); - if (flagch !== ch) { - result += compileJFmt({ - 'char': flagch, - 'str': str, - 'len': i - start - }, date); - flagch = ch; - start = i; - str = flagch; - } else { - str += ch; - } - } - result += compileJFmt({ - 'char': flagch, - 'str': str, - 'len': len - start - }, date); - } - return result; - - function compileJFmt(jfmt, date) { - var str = jfmt.str, len = jfmt.len, ch = jfmt['char']; - switch (ch) { - case 'E': //星期 - str = Date._DN[date.getDay()]; - break; - case 'y': //年 - if (len <= 3) { - str = (date.getFullYear() + '').slice(2, 4); - } else { - str = date.getFullYear(); - } - break; - case 'M': //月 - if (len > 2) { - str = Date._MN[date.getMonth()]; - } else if (len < 2) { - str = date.getMonth() + 1; - } else { - str = String.leftPad(date.getMonth() + 1 + '', 2, '0'); - } - break; - case 'd': //日 - if (len > 1) { - str = String.leftPad(date.getDate() + '', 2, '0'); - } else { - str = date.getDate(); - } - break; - case 'h': //时(12) - var hour = date.getHours() % 12; - if (hour === 0) { - hour = 12; - } - if (len > 1) { - str = String.leftPad(hour + '', 2, '0'); - } else { - str = hour; - } - break; - case 'H': //时(24) - if (len > 1) { - str = String.leftPad(date.getHours() + '', 2, '0'); - } else { - str = date.getHours(); - } - break; - case 'm': - if (len > 1) { - str = String.leftPad(date.getMinutes() + '', 2, '0'); - } else { - str = date.getMinutes(); - } - break; - case 's': - if (len > 1) { - str = String.leftPad(date.getSeconds() + '', 2, '0'); - } else { - str = date.getSeconds(); - } - break; - case 'a': - str = date.getHours() < 12 ? 'am' : 'pm'; - break; - case 'z': - str = date.getTimezone(); - break; - default: - str = jfmt.str; - break; - } - return str; - } - }; - /** * 数字格式 */ @@ -219,7 +104,8 @@ } else { return left + '.' + right; } - }; + } + /** * 处理小数点右边小数部分 * @param tright 右边内容 @@ -263,7 +149,7 @@ if (newnum.length > orilen) { newnum = newnum.substr(1); } else { - newnum = BI.leftPad(newnum, orilen, '0'); + newnum = String.leftPad(newnum, orilen, '0'); result.leftPlus = false; } right = right.replace(/^[0-9]+/, newnum); @@ -524,7 +410,7 @@ return o; })(jo); - } + }; BI.contentFormat = function (cv, fmt) { if (isEmpty(cv)) { @@ -566,15 +452,122 @@ return text; }; - BI.leftPad = function (val, size, ch) { - var result = String(val); - if (!ch) { - ch = " "; + /** + * 把日期对象按照指定格式转化成字符串 + * + * @example + * var date = new Date('Thu Dec 12 2013 00:00:00 GMT+0800'); + * var result = BI.date2Str(date, 'yyyy-MM-dd');//2013-12-12 + * + * @class BI.date2Str + * @param date 日期 + * @param format 日期格式 + * @returns {String} + */ + BI.date2Str = function (date, format) { + if (!date) { + return ''; } - while (result.length < size) { - result = ch + result; + // O(len(format)) + var len = format.length, result = ''; + if (len > 0) { + var flagch = format.charAt(0), start = 0, str = flagch; + for (var i = 1; i < len; i++) { + var ch = format.charAt(i); + if (flagch !== ch) { + result += compileJFmt({ + 'char': flagch, + 'str': str, + 'len': i - start + }, date); + flagch = ch; + start = i; + str = flagch; + } else { + str += ch; + } + } + result += compileJFmt({ + 'char': flagch, + 'str': str, + 'len': len - start + }, date); + } + return result; + + function compileJFmt(jfmt, date) { + var str = jfmt.str, len = jfmt.len, ch = jfmt['char']; + switch (ch) { + case 'E': //星期 + str = Date._DN[date.getDay()]; + break; + case 'y': //年 + if (len <= 3) { + str = (date.getFullYear() + '').slice(2, 4); + } else { + str = date.getFullYear(); + } + break; + case 'M': //月 + if (len > 2) { + str = Date._MN[date.getMonth()]; + } else if (len < 2) { + str = date.getMonth() + 1; + } else { + str = String.leftPad(date.getMonth() + 1 + '', 2, '0'); + } + break; + case 'd': //日 + if (len > 1) { + str = String.leftPad(date.getDate() + '', 2, '0'); + } else { + str = date.getDate(); + } + break; + case 'h': //时(12) + var hour = date.getHours() % 12; + if (hour === 0) { + hour = 12; + } + if (len > 1) { + str = String.leftPad(hour + '', 2, '0'); + } else { + str = hour; + } + break; + case 'H': //时(24) + if (len > 1) { + str = String.leftPad(date.getHours() + '', 2, '0'); + } else { + str = date.getHours(); + } + break; + case 'm': + if (len > 1) { + str = String.leftPad(date.getMinutes() + '', 2, '0'); + } else { + str = date.getMinutes(); + } + break; + case 's': + if (len > 1) { + str = String.leftPad(date.getSeconds() + '', 2, '0'); + } else { + str = date.getSeconds(); + } + break; + case 'a': + str = date.getHours() < 12 ? 'am' : 'pm'; + break; + case 'z': + str = date.getTimezone(); + break; + default: + str = jfmt.str; + break; + } + return str; } - return result.toString(); }; BI.object2Number = function (value) { diff --git a/src/core/func/dom.js b/src/core/func/dom.js index b8c9d6505f..979b7a64bc 100644 --- a/src/core/func/dom.js +++ b/src/core/func/dom.js @@ -267,7 +267,8 @@ BI.extend(jQuery, { getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); + var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), + windowBounds = $("body").bounds(); var top, adaptHeight; if ($.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { top = comboOffset.top + extraHeight; @@ -315,7 +316,8 @@ BI.extend(jQuery, { getBottomAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); + var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), + windowBounds = $("body").bounds(); var top, adaptHeight; if ($.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { top = comboOffset.top + comboBounds.height - popupBounds.height - extraHeight; @@ -341,7 +343,8 @@ BI.extend(jQuery, { getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) { var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); + var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), + windowBounds = $("body").bounds(); if ($.isBottomSpaceEnough(combo, popup, extraHeight)) { return $.getBottomPosition(combo, popup, extraHeight); } @@ -364,7 +367,8 @@ BI.extend(jQuery, { getCenterAdaptPosition: function (combo, popup) { var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); + var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), + windowBounds = $("body").bounds(); var left; if (comboOffset.left + comboBounds.width / 2 + popupBounds.width / 2 > windowBounds.width) { left = windowBounds.width - popupBounds.width; @@ -381,7 +385,8 @@ BI.extend(jQuery, { getMiddleAdaptPosition: function (combo, popup) { var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); + var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), + windowBounds = $("body").bounds(); var top; if (comboOffset.top + comboBounds.height / 2 + popupBounds.height / 2 > windowBounds.height) { top = windowBounds.height - popupBounds.height; @@ -577,7 +582,7 @@ BI.extend(jQuery, { } break; } - if(needAdaptHeight === true) { + if (needAdaptHeight === true) { popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight)); } return position; diff --git a/src/core/proto/date.js b/src/core/proto/date.js index c8292a94dc..ed5eeb3d0b 100644 --- a/src/core/proto/date.js +++ b/src/core/proto/date.js @@ -55,7 +55,6 @@ Date._QN = ["", BI.i18nText("BI-Quarter_1"), BI.i18nText("BI-Quarter_3"), BI.i18nText("BI-Quarter_4")]; - /** Adds the number of days array to the Date object. */ Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; @@ -529,4 +528,4 @@ Date.parseDateTime = function (str, fmt) { return new Date(y, m, d, hr, min, sec); } return today; -}; \ No newline at end of file +}; diff --git a/src/core/view.js b/src/core/view.js index cfeaa5a53d..f5e5f23115 100644 --- a/src/core/view.js +++ b/src/core/view.js @@ -168,7 +168,7 @@ BI.View = BI.inherit(BI.V, { BI.each(cardNames, function (i, name) { delete self._cards[name]; }); - this._cardLayouts[key] && this._cardLayouts[key].destroy(); + this._cardLayouts[key] && this._cardLayouts[key]._destroy(); return this; }, diff --git a/src/core/widget.js b/src/core/widget.js index af3aed4ca5..83e63c84dc 100644 --- a/src/core/widget.js +++ b/src/core/widget.js @@ -105,17 +105,18 @@ BI.Widget = BI.inherit(BI.OB, { _initVisualEffects: function () { var o = this.options; if (o.invisible) { - this.element.hide(); + //用display属性做显示和隐藏,否则jquery会在显示时将display设为block会覆盖掉display:flex属性 + this.element.css("display", "none"); } if (o.disabled || o.invalid) { - BI.nextTick(BI.bind(function () { - if (this.options.disabled) { - this.setEnable(false); - } - if (this.options.invalid) { - this.setValid(false); - } - }, this)); + // BI.nextTick(BI.bind(function () { + if (this.options.disabled) { + this.setEnable(false); + } + if (this.options.invalid) { + this.setValid(false); + } + // }, this)); } }, @@ -163,6 +164,7 @@ BI.Widget = BI.inherit(BI.OB, { this._isMounted = true; this._mountChildren && this._mountChildren(); BI.each(this._children, function (i, widget) { + !self.isEnabled() && widget._setEnable(false); widget._mount && widget._mount(); }); this.mounted && this.mounted(); @@ -170,17 +172,6 @@ BI.Widget = BI.inherit(BI.OB, { _mountChildren: null, - _unMount: function () { - BI.each(this._children, function (i, widget) { - widget._unMount && widget._unMount(); - }); - this._children = {}; - this._parent = null; - this._isMounted = false; - this.purgeListeners(); - this.destroyed && this.destroyed(); - }, - isMounted: function () { return this._isMounted; }, @@ -195,12 +186,23 @@ BI.Widget = BI.inherit(BI.OB, { this._initElementHeight(); }, - setEnable: function (enable) { + _setEnable: function (enable) { if (enable === true) { this.options.disabled = false; - this.element.removeClass("base-disabled disabled"); } else if (enable === false) { this.options.disabled = true; + } + //递归将所有子组件使能 + BI.each(this._children, function (i, child) { + child._setEnable && child._setEnable(enable); + }); + }, + + setEnable: function (enable) { + this._setEnable(enable); + if (enable === true) { + this.element.removeClass("base-disabled disabled"); + } else if (enable === false) { this.element.addClass("base-disabled disabled"); } }, @@ -260,7 +262,7 @@ BI.Widget = BI.inherit(BI.OB, { }, getWidgetByName: function (name) { - if (!BI.isKey(name) || name == this.getName()) { + if (!BI.isKey(name) || name === this.getName()) { return this; } name = name + ""; @@ -360,6 +362,21 @@ BI.Widget = BI.inherit(BI.OB, { this.setVisible(true); }, + __d: function () { + BI.each(this._children, function (i, widget) { + widget._unMount && widget._unMount(); + }); + this._children = {}; + this._parent = null; + this._isMounted = false; + }, + + _unMount: function () { + this.__d(); + this.purgeListeners(); + this.destroyed && this.destroyed(); + }, + isolate: function () { if (this._parent) { this._parent.removeWidget(this); @@ -375,13 +392,15 @@ BI.Widget = BI.inherit(BI.OB, { this.element.empty(); }, + _destroy: function () { + this.__d(); + this.destroyed && this.destroyed(); + this.element.destroy(); + this.purgeListeners(); + }, + destroy: function () { - BI.each(this._children, function (i, widget) { - widget._unMount && widget._unMount(); - }); - this._children = {}; - this._parent = null; - this._isMounted = false; + this.__d(); this.destroyed && this.destroyed(); this.element.destroy(); this.fireEvent(BI.Events.DESTROY); diff --git a/src/core/wrapper/layout.js b/src/core/wrapper/layout.js index abca6b0055..c24c70f806 100644 --- a/src/core/wrapper/layout.js +++ b/src/core/wrapper/layout.js @@ -252,7 +252,7 @@ BI.Layout = BI.inherit(BI.Widget, { this.options.items = newItems; this._children = newChildren; BI.each(deleted, function (i, c) { - c.destroy(); + c._destroy(); }); }, @@ -277,7 +277,7 @@ BI.Layout = BI.inherit(BI.Widget, { } else { w.element.prependTo(this._getWrapper()); } - del.destroy(); + del._destroy(); w._mount(); }, @@ -364,7 +364,7 @@ BI.Layout = BI.inherit(BI.Widget, { } o.items.splice(items.length); BI.each(deleted, function (i, w) { - w.destroy(); + w._destroy(); }) } else if (items.length > o.items.length) { for (i = o.items.length; i < items.length; i++) { diff --git a/src/core/wrapper/layout/layout.card.js b/src/core/wrapper/layout/layout.card.js index 201b3ccbf6..0a8447cadf 100644 --- a/src/core/wrapper/layout/layout.card.js +++ b/src/core/wrapper/layout/layout.card.js @@ -91,7 +91,7 @@ BI.CardLayout = BI.inherit(BI.Layout, { var child = this._children[cardName]; this._deleteCardByName(cardName); - child && child.destroy(); + child && child._destroy(); }, addCardByName: function (cardName, cardItem) { diff --git a/src/css/core/utils/common.css b/src/css/core/utils/common.css index fb4f4a5755..23ca02db36 100644 --- a/src/css/core/utils/common.css +++ b/src/css/core/utils/common.css @@ -125,8 +125,8 @@ } .bi-z-index-mask { color: #ffffff; - background-color: rgba(26, 26, 26, 0.3); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d1a1a1a,endColorstr=#4d1a1a1a); + background-color: rgba(26, 26, 26, 0.5); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#801a1a1a,endColorstr=#801a1a1a); } .bi-list-item:hover, .bi-list-item.hover { diff --git a/src/less/core/utils/common.less b/src/less/core/utils/common.less index 2217968708..6537c9d8e1 100644 --- a/src/less/core/utils/common.less +++ b/src/less/core/utils/common.less @@ -175,7 +175,7 @@ .bi-z-index-mask { color: @color-bi-background-default; - .background-color(@color-bi-background-black, 30%); + .background-color(@color-bi-background-black, 50%); } //只有背景变化 diff --git a/src/widget/multiselect/multiselect.loader.js b/src/widget/multiselect/multiselect.loader.js index a6ccffdd61..febe158009 100644 --- a/src/widget/multiselect/multiselect.loader.js +++ b/src/widget/multiselect/multiselect.loader.js @@ -155,10 +155,6 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, { this.button_group.populate.apply(this.button_group, arguments); }, - setEnable: function (arg) { - this.button_group.setEnable(arg); - }, - resetHeight: function (h) { this.button_group.resetHeight(h); }, diff --git a/src/widget/multiselect/multiselect.popup.view.js b/src/widget/multiselect/multiselect.popup.view.js index ef9789f6b8..cfbd6aca15 100644 --- a/src/widget/multiselect/multiselect.popup.view.js +++ b/src/widget/multiselect/multiselect.popup.view.js @@ -74,10 +74,6 @@ BI.MultiSelectPopupView = BI.inherit(BI.Widget, { this.popupView.populate.apply(this.popupView, arguments); }, - setEnable: function (arg) { - this.popupView.setEnable(arg); - }, - resetHeight: function (h) { this.popupView.resetHeight(h); }, diff --git a/src/widget/multiselect/multiselect.trigger.js b/src/widget/multiselect/multiselect.trigger.js index e9a1dda38f..0da496a64e 100644 --- a/src/widget/multiselect/multiselect.trigger.js +++ b/src/widget/multiselect/multiselect.trigger.js @@ -133,10 +133,6 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, { this.numberCounter.setValue(ob); }, - setEnable: function (v) { - this.searcher.setEnable(v); - }, - getKey: function () { return this.searcher.getKey(); }, diff --git a/src/widget/multiselect/search/multiselect.search.loader.js b/src/widget/multiselect/search/multiselect.search.loader.js index d901487e39..20c74c61a1 100644 --- a/src/widget/multiselect/search/multiselect.search.loader.js +++ b/src/widget/multiselect/search/multiselect.search.loader.js @@ -139,10 +139,6 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { this.button_group.populate.apply(this.button_group, arguments); }, - setEnable: function (arg) { - this.button_group.setEnable(arg); - }, - resetHeight: function (h) { this.button_group.resetHeight(h); }, diff --git a/src/widget/multiselect/trigger/editor.multiselect.js b/src/widget/multiselect/trigger/editor.multiselect.js index 5d35a3a796..368509fa4a 100644 --- a/src/widget/multiselect/trigger/editor.multiselect.js +++ b/src/widget/multiselect/trigger/editor.multiselect.js @@ -56,10 +56,6 @@ BI.MultiSelectEditor = BI.inherit(BI.Widget, { this.editor.setValue(v); }, - setEnable: function(v){ - this.editor.setEnable(v); - }, - getValue: function () { var v = this.editor.getState(); if (BI.isArray(v) && v.length > 0) { diff --git a/src/widget/multiselect/trigger/searcher.multiselect.js b/src/widget/multiselect/trigger/searcher.multiselect.js index 337749a6ee..166b79117c 100644 --- a/src/widget/multiselect/trigger/searcher.multiselect.js +++ b/src/widget/multiselect/trigger/searcher.multiselect.js @@ -134,10 +134,6 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { return this.searcher.getValue(); }, - setEnable: function (v) { - this.editor.setEnable(v); - }, - populate: function (items) { this.searcher.populate.apply(this.searcher, arguments); } diff --git a/src/widget/multistringlist/multistringlist.js b/src/widget/multistringlist/multistringlist.js index c9f39b780f..5ca2696795 100644 --- a/src/widget/multistringlist/multistringlist.js +++ b/src/widget/multistringlist/multistringlist.js @@ -287,11 +287,6 @@ BI.MultiStringList = BI.inherit(BI.Widget, { this.trigger.getSearcher().adjustView(); }, - setEnable: function (v) { - this.trigger.setEnable(v); - this.popup.setEnable(v); - }, - setValue: function (v) { this.storeValue = v || {}; this._assertValue(this.storeValue); diff --git a/src/widget/multitree/multi.tree.combo.js b/src/widget/multitree/multi.tree.combo.js index 7c302e9cd2..d2bd72edf4 100644 --- a/src/widget/multitree/multi.tree.combo.js +++ b/src/widget/multitree/multi.tree.combo.js @@ -236,10 +236,6 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { this.combo.hideView(); }, - setEnable: function (v) { - this.combo.setEnable(v); - }, - setValue: function (v) { this.storeValue.value = v || {}; this.combo.setValue({ diff --git a/src/widget/multitree/multi.tree.popup.js b/src/widget/multitree/multi.tree.popup.js index 542a339b61..e8c5cded0e 100644 --- a/src/widget/multitree/multi.tree.popup.js +++ b/src/widget/multitree/multi.tree.popup.js @@ -79,10 +79,6 @@ BI.MultiTreePopup = BI.inherit(BI.Pane, { return this.tree.hasChecked(); }, - setEnable: function (arg) { - this.popupView.setEnable(arg); - }, - resetHeight: function (h) { this.popupView.resetHeight(h); }, diff --git a/src/widget/multitree/trigger/searcher.multi.tree.js b/src/widget/multitree/trigger/searcher.multi.tree.js index 5c07c576cc..e63eed7cb0 100644 --- a/src/widget/multitree/trigger/searcher.multi.tree.js +++ b/src/widget/multitree/trigger/searcher.multi.tree.js @@ -119,10 +119,6 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { return this.editor.getValue(); }, - setEnable: function(v){ - this.editor.setEnable(v); - }, - getValue: function () { return this.searcher.getValue(); }, diff --git a/src/widget/multitreelist/multitreelist.js b/src/widget/multitreelist/multitreelist.js index d530e20453..52182c0dce 100644 --- a/src/widget/multitreelist/multitreelist.js +++ b/src/widget/multitreelist/multitreelist.js @@ -150,11 +150,6 @@ BI.MultiTreeList = BI.inherit(BI.Widget, { this.trigger.getSearcher().adjustView(); }, - setEnable: function (v) { - this.trigger.setEnable(v); - this.popup.setEnable(v); - }, - setValue: function (v) { this.storeValue.value = v || {}; this.popup.setValue({ diff --git a/src/widget/numericalinterval/numericalinterval.js b/src/widget/numericalinterval/numericalinterval.js index e02ed03b56..f7231708d0 100644 --- a/src/widget/numericalinterval/numericalinterval.js +++ b/src/widget/numericalinterval/numericalinterval.js @@ -430,13 +430,6 @@ BI.NumericalInterval = BI.inherit(BI.Single, { return this.options.validation === "valid"; }, - setEnable: function (b) { - this.smallEditor.setEnable(b); - this.smallCombo.setEnable(b); - this.bigEditor.setEnable(b); - this.bigCombo.setEnable(b); - }, - setMinEnable: function (b) { this.smallEditor.setEnable(b); },