diff --git a/bi/base.js b/bi/base.js index 9562d00b5..7fd86def7 100644 --- a/bi/base.js +++ b/bi/base.js @@ -17727,7 +17727,11 @@ BI.CodeEditor = BI.inherit(BI.Single, { value: '', watermark: "", lineHeight: 2, - readOnly: false + readOnly: false, + //参数显示值构造函数 + paramFormatter: function (v) { + return v; + } }); }, _init: function () { @@ -17747,12 +17751,12 @@ BI.CodeEditor = BI.inherit(BI.Single, { }); this.editor.on("focus", function () { - watermark.setVisible(false); + self.watermark.setVisible(false); self.fireEvent(BI.CodeEditor.EVENT_FOCUS); }); this.editor.on("blur", function () { - watermark.setVisible(BI.isEmptyString(self.getValue())); + self.watermark.setVisible(BI.isEmptyString(self.getValue())); self.fireEvent(BI.CodeEditor.EVENT_BLUR); }); @@ -17761,21 +17765,21 @@ BI.CodeEditor = BI.inherit(BI.Single, { // }); //水印 - var watermark = BI.createWidget({ + this.watermark = BI.createWidget({ type: "bi.label", text: o.watermark, cls: "bi-water-mark", whiteSpace: "nowrap", textAlign: "left" }); - watermark.element.bind( + this.watermark.element.bind( "mousedown", function (e) { self.insertString(""); self.editor.focus(); e.stopEvent(); } ); - watermark.element.bind("click", function (e) { + this.watermark.element.bind("click", function (e) { self.editor.focus(); e.stopEvent(); }); @@ -17783,7 +17787,7 @@ BI.CodeEditor = BI.inherit(BI.Single, { type: "bi.absolute", element: this, items: [{ - el: watermark, + el: this.watermark, top: 0, left: 5 }] @@ -17801,7 +17805,18 @@ BI.CodeEditor = BI.inherit(BI.Single, { this.editor.setOption("readOnly", b === true ? false : "nocursor") }, + _checkWaterMark: function () { + var o = this.options; + if (BI.isEmptyString(this.editor.getValue()) && BI.isKey(o.watermark)) { + this.watermark && this.watermark.visible(); + } else { + this.watermark && this.watermark.invisible(); + } + }, + insertParam: function (param) { + var value = param; + param = this.options.paramFormatter(param); var from = this.editor.getCursor(); this.editor.replaceSelection(param); var to = this.editor.getCursor(); @@ -17809,6 +17824,7 @@ BI.CodeEditor = BI.inherit(BI.Single, { if (BI.isNotNull(param.match(/^$/))) { options.className = 'error-param'; } + options.value = value; this.editor.markText(from, to, options); this.editor.replaceSelection(" "); this.editor.focus(); @@ -17828,8 +17844,11 @@ BI.CodeEditor = BI.inherit(BI.Single, { case "param": case "error-param": var fieldNameLength = i.to - i.from; - value = value.substr(0, i.from + num) + "$\{" + value.substr(i.from + num, fieldNameLength) + "\}" + value.substr(i.to + num, value.length); + value = value.substr(0, i.from + num) + "$\{" + i.marker.value + "\}" + value.substr(i.to + num, value.length); + //加上${}的偏移 num += 3; + //加上实际值和显示值的长度差的偏移 + num += (i.marker.value.length - fieldNameLength); break; } }); @@ -17855,7 +17874,8 @@ BI.CodeEditor = BI.inherit(BI.Single, { } else { self.insertString(item); } - }) + }); + this._checkWaterMark(); }, focus: function () { @@ -28685,7 +28705,7 @@ BI.NativeTableScrollbar = BI.inherit(BI.Widget, { render: function () { var self = this, o = this.options; //把滚动台size改掉 - BI.GridTableScrollbar.SIZE = 16; + this.element.width(36); var throttle = BI.throttle(function () { self.fireEvent(BI.NativeTableScrollbar.EVENT_SCROLL, self.element.scrollTop()); @@ -28761,7 +28781,7 @@ BI.NativeTableHorizontalScrollbar = BI.inherit(BI.Widget, { render: function () { var self = this, o = this.options; //把滚动台size改掉 - BI.GridTableScrollbar.SIZE = 16; + this.element.height(36); var throttle = BI.throttle(function () { self.fireEvent(BI.NativeTableScrollbar.EVENT_SCROLL, self.element.scrollLeft()); diff --git a/bi/case.js b/bi/case.js index f32acbb04..ca2452851 100644 --- a/bi/case.js +++ b/bi/case.js @@ -1477,6 +1477,7 @@ BI.MultiLayerIconTreeLeafItem = BI.inherit(BI.BasicButton, { var self = this, o = this.options; this.item = BI.createWidget({ type: "bi.icon_tree_leaf_item", + cls: "bi-list-item-none", iconCls: o.iconCls, id: o.id, pId: o.pId, @@ -3949,7 +3950,7 @@ BI.ColorChooserTrigger = BI.inherit(BI.Trigger, { BI.ColorChooserTrigger.superclass._init.apply(this, arguments); this.colorContainer = BI.createWidget({ type: "bi.layout", - cls: "bi-card" + cls: "bi-card color-chooser-trigger-content" }); var down = BI.createWidget({ @@ -3982,7 +3983,13 @@ BI.ColorChooserTrigger = BI.inherit(BI.Trigger, { setValue: function (color) { BI.ColorChooserTrigger.superclass.setValue.apply(this, arguments); - this.colorContainer.element.css("background-color", color); + if (color === "") { + this.colorContainer.element.css("background-color", "").removeClass("trans-color-background").addClass("auto-color-background"); + } else if (color === "transparent") { + this.colorContainer.element.css("background-color", "").removeClass("auto-color-background").addClass("trans-color-background") + } else { + this.colorContainer.element.css({"background-color": color}).removeClass("auto-color-background").removeClass("trans-color-background"); + } } }); BI.ColorChooserTrigger.EVENT_CHANGE = "ColorChooserTrigger.EVENT_CHANGE"; diff --git a/bi/core.js b/bi/core.js index 80620d72c..5f2871d01 100644 --- a/bi/core.js +++ b/bi/core.js @@ -8104,10 +8104,10 @@ BI.ScalingCellSizeAndPositionManager.prototype = { _window = this } - var attachEvent = typeof document !== 'undefined' && document.attachEvent; + var addEventListener = typeof document !== 'undefined' && document.addEventListener; var stylesCreated = false; - if (!attachEvent) { + if (addEventListener) { var requestFrame = (function () { var raf = _window.requestAnimationFrame || _window.mozRequestAnimationFrame || _window.webkitRequestAnimationFrame || function (fn) { @@ -8214,8 +8214,7 @@ BI.ScalingCellSizeAndPositionManager.prototype = { } var addResizeListener = function (element, fn) { - if (attachEvent) element.attachEvent('onresize', fn); - else { + if (addEventListener){ if (!element.__resizeTriggers__) { if (getComputedStyle(element).position === 'static') element.style.position = 'relative'; createStyles(); @@ -8235,17 +8234,21 @@ BI.ScalingCellSizeAndPositionManager.prototype = { }); } element.__resizeListeners__.push(fn); + + } else { + element.attachEvent('onresize', fn); } }; var removeResizeListener = function (element, fn) { - if (attachEvent) element.detachEvent('onresize', fn); - else { + if (addEventListener) { element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1); if (!element.__resizeListeners__.length) { element.removeEventListener('scroll', scrollListener, true); element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__); } + } else { + element.detachEvent('onresize', fn); } }; @@ -17527,4 +17530,8 @@ $(function () { return ob; } }); + //IE8下滚动条用原生的 + if (BI.isIE9Below()) { + BI.GridTableScrollbar.SIZE = 18; + } }); \ No newline at end of file diff --git a/bi/widget.js b/bi/widget.js index ad4163ffd..781c34b2a 100644 --- a/bi/widget.js +++ b/bi/widget.js @@ -983,9 +983,9 @@ BI.Arrangement = BI.inherit(BI.Widget, { case BI.Arrangement.LAYOUT_TYPE.FREE: return true; case BI.Arrangement.LAYOUT_TYPE.GRID: - if (this._isRegionOverlay()) { - return false; - } + // if (this._isRegionOverlay()) { + // return false; + // } } return true; }, @@ -1093,14 +1093,6 @@ BI.Arrangement = BI.inherit(BI.Widget, { return this.scrollContainer.element[0].clientHeight; }, - getContainerSize: function () { - return this.container.element.bounds(); - }, - - setContainerSize: function (bounds) { - return this.container.element.bounds(bounds); - }, - _applyContainer: function () { //先掩藏后显示能够明确滚动条是否出现 this.scrollContainer.element.css("overflow", "hidden"); @@ -1416,9 +1408,10 @@ BI.Arrangement = BI.inherit(BI.Widget, { }, _start: function () { - this.arrangement.setVisible(true); if (this.options.layoutType === BI.Arrangement.LAYOUT_TYPE.GRID) { this.block.setVisible(true); + } else { + this.arrangement.setVisible(true); } }, @@ -1718,6 +1711,15 @@ BI.Arrangement = BI.inherit(BI.Widget, { region.width = region.width * xRatio; region.top = region.top * yRatio; region.height = region.height * yRatio; + //做一下自适应布局到网格布局的兼容 + var perWidth = self._getOneWidthPortion(); + var widthPortion = Math.round(region.width / perWidth); + var leftPortion = Math.round(region.left / perWidth); + var comparePortion = Math.round((region.width + region.left) / perWidth); + if (leftPortion + widthPortion !== comparePortion) { + region.left = leftPortion * perWidth; + region.width = comparePortion * perWidth - region.left; + } }); if (this._test(regions)) { var layout = this._getLayoutsByRegions(regions); @@ -3494,6 +3496,7 @@ BI.DownListCombo = BI.inherit(BI.Widget, { height: 25, items: [], adjustLength: 0, + direction: "bottom", el: {} }) }, @@ -3523,6 +3526,7 @@ BI.DownListCombo = BI.inherit(BI.Widget, { type: 'bi.combo', isNeedAdjustWidth: false, adjustLength: o.adjustLength, + direction: o.direction, el: BI.createWidget(o.el, { type: "bi.icon_trigger", extraCls: o.iconCls ? o.iconCls : "pull-down-font", @@ -3545,6 +3549,10 @@ BI.DownListCombo = BI.inherit(BI.Widget, { this.downlistcombo.hideView(); }, + showView: function () { + this.downlistcombo.showView(); + }, + populate: function (items) { this.popupview.populate(items); }, diff --git a/docs/base.js b/docs/base.js index 9562d00b5..7fd86def7 100644 --- a/docs/base.js +++ b/docs/base.js @@ -17727,7 +17727,11 @@ BI.CodeEditor = BI.inherit(BI.Single, { value: '', watermark: "", lineHeight: 2, - readOnly: false + readOnly: false, + //参数显示值构造函数 + paramFormatter: function (v) { + return v; + } }); }, _init: function () { @@ -17747,12 +17751,12 @@ BI.CodeEditor = BI.inherit(BI.Single, { }); this.editor.on("focus", function () { - watermark.setVisible(false); + self.watermark.setVisible(false); self.fireEvent(BI.CodeEditor.EVENT_FOCUS); }); this.editor.on("blur", function () { - watermark.setVisible(BI.isEmptyString(self.getValue())); + self.watermark.setVisible(BI.isEmptyString(self.getValue())); self.fireEvent(BI.CodeEditor.EVENT_BLUR); }); @@ -17761,21 +17765,21 @@ BI.CodeEditor = BI.inherit(BI.Single, { // }); //水印 - var watermark = BI.createWidget({ + this.watermark = BI.createWidget({ type: "bi.label", text: o.watermark, cls: "bi-water-mark", whiteSpace: "nowrap", textAlign: "left" }); - watermark.element.bind( + this.watermark.element.bind( "mousedown", function (e) { self.insertString(""); self.editor.focus(); e.stopEvent(); } ); - watermark.element.bind("click", function (e) { + this.watermark.element.bind("click", function (e) { self.editor.focus(); e.stopEvent(); }); @@ -17783,7 +17787,7 @@ BI.CodeEditor = BI.inherit(BI.Single, { type: "bi.absolute", element: this, items: [{ - el: watermark, + el: this.watermark, top: 0, left: 5 }] @@ -17801,7 +17805,18 @@ BI.CodeEditor = BI.inherit(BI.Single, { this.editor.setOption("readOnly", b === true ? false : "nocursor") }, + _checkWaterMark: function () { + var o = this.options; + if (BI.isEmptyString(this.editor.getValue()) && BI.isKey(o.watermark)) { + this.watermark && this.watermark.visible(); + } else { + this.watermark && this.watermark.invisible(); + } + }, + insertParam: function (param) { + var value = param; + param = this.options.paramFormatter(param); var from = this.editor.getCursor(); this.editor.replaceSelection(param); var to = this.editor.getCursor(); @@ -17809,6 +17824,7 @@ BI.CodeEditor = BI.inherit(BI.Single, { if (BI.isNotNull(param.match(/^$/))) { options.className = 'error-param'; } + options.value = value; this.editor.markText(from, to, options); this.editor.replaceSelection(" "); this.editor.focus(); @@ -17828,8 +17844,11 @@ BI.CodeEditor = BI.inherit(BI.Single, { case "param": case "error-param": var fieldNameLength = i.to - i.from; - value = value.substr(0, i.from + num) + "$\{" + value.substr(i.from + num, fieldNameLength) + "\}" + value.substr(i.to + num, value.length); + value = value.substr(0, i.from + num) + "$\{" + i.marker.value + "\}" + value.substr(i.to + num, value.length); + //加上${}的偏移 num += 3; + //加上实际值和显示值的长度差的偏移 + num += (i.marker.value.length - fieldNameLength); break; } }); @@ -17855,7 +17874,8 @@ BI.CodeEditor = BI.inherit(BI.Single, { } else { self.insertString(item); } - }) + }); + this._checkWaterMark(); }, focus: function () { @@ -28685,7 +28705,7 @@ BI.NativeTableScrollbar = BI.inherit(BI.Widget, { render: function () { var self = this, o = this.options; //把滚动台size改掉 - BI.GridTableScrollbar.SIZE = 16; + this.element.width(36); var throttle = BI.throttle(function () { self.fireEvent(BI.NativeTableScrollbar.EVENT_SCROLL, self.element.scrollTop()); @@ -28761,7 +28781,7 @@ BI.NativeTableHorizontalScrollbar = BI.inherit(BI.Widget, { render: function () { var self = this, o = this.options; //把滚动台size改掉 - BI.GridTableScrollbar.SIZE = 16; + this.element.height(36); var throttle = BI.throttle(function () { self.fireEvent(BI.NativeTableScrollbar.EVENT_SCROLL, self.element.scrollLeft()); diff --git a/docs/case.js b/docs/case.js index f32acbb04..ca2452851 100644 --- a/docs/case.js +++ b/docs/case.js @@ -1477,6 +1477,7 @@ BI.MultiLayerIconTreeLeafItem = BI.inherit(BI.BasicButton, { var self = this, o = this.options; this.item = BI.createWidget({ type: "bi.icon_tree_leaf_item", + cls: "bi-list-item-none", iconCls: o.iconCls, id: o.id, pId: o.pId, @@ -3949,7 +3950,7 @@ BI.ColorChooserTrigger = BI.inherit(BI.Trigger, { BI.ColorChooserTrigger.superclass._init.apply(this, arguments); this.colorContainer = BI.createWidget({ type: "bi.layout", - cls: "bi-card" + cls: "bi-card color-chooser-trigger-content" }); var down = BI.createWidget({ @@ -3982,7 +3983,13 @@ BI.ColorChooserTrigger = BI.inherit(BI.Trigger, { setValue: function (color) { BI.ColorChooserTrigger.superclass.setValue.apply(this, arguments); - this.colorContainer.element.css("background-color", color); + if (color === "") { + this.colorContainer.element.css("background-color", "").removeClass("trans-color-background").addClass("auto-color-background"); + } else if (color === "transparent") { + this.colorContainer.element.css("background-color", "").removeClass("auto-color-background").addClass("trans-color-background") + } else { + this.colorContainer.element.css({"background-color": color}).removeClass("auto-color-background").removeClass("trans-color-background"); + } } }); BI.ColorChooserTrigger.EVENT_CHANGE = "ColorChooserTrigger.EVENT_CHANGE"; diff --git a/docs/core.js b/docs/core.js index c27a5c615..ad9eafb62 100644 --- a/docs/core.js +++ b/docs/core.js @@ -16841,10 +16841,10 @@ BI.ScalingCellSizeAndPositionManager.prototype = { _window = this } - var attachEvent = typeof document !== 'undefined' && document.attachEvent; + var addEventListener = typeof document !== 'undefined' && document.addEventListener; var stylesCreated = false; - if (!attachEvent) { + if (addEventListener) { var requestFrame = (function () { var raf = _window.requestAnimationFrame || _window.mozRequestAnimationFrame || _window.webkitRequestAnimationFrame || function (fn) { @@ -16951,8 +16951,7 @@ BI.ScalingCellSizeAndPositionManager.prototype = { } var addResizeListener = function (element, fn) { - if (attachEvent) element.attachEvent('onresize', fn); - else { + if (addEventListener){ if (!element.__resizeTriggers__) { if (getComputedStyle(element).position === 'static') element.style.position = 'relative'; createStyles(); @@ -16972,17 +16971,21 @@ BI.ScalingCellSizeAndPositionManager.prototype = { }); } element.__resizeListeners__.push(fn); + + } else { + element.attachEvent('onresize', fn); } }; var removeResizeListener = function (element, fn) { - if (attachEvent) element.detachEvent('onresize', fn); - else { + if (addEventListener) { element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1); if (!element.__resizeListeners__.length) { element.removeEventListener('scroll', scrollListener, true); element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__); } + } else { + element.detachEvent('onresize', fn); } }; @@ -28669,4 +28672,8 @@ $(function () { return ob; } }); + //IE8下滚动条用原生的 + if (BI.isIE9Below()) { + BI.GridTableScrollbar.SIZE = 18; + } }); \ No newline at end of file diff --git a/docs/resource.css b/docs/resource.css index 394cd8231..dfc438363 100644 --- a/docs/resource.css +++ b/docs/resource.css @@ -122,6 +122,16 @@ textarea::-webkit-scrollbar-thumb:hover { _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='icon/loading.gif'); _background: none; } +.auto-color-background { + background: url('background/auto-color.png') no-repeat center center; + _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='background/auto-color.png'); + _background: none; +} +.trans-color-background { + background: url('background/trans-color.png') no-repeat center center; + _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='background/trans-color.png'); + _background: none; +} @font-face { font-family: 'bi'; src: url('font/iconfont.eot'), /* IE6-IE8 */ url('font/iconfont.woff') format('woff'), /* chrome、firefox */ url('font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('font/iconfont.svg#svgFontName') format('svg'); diff --git a/docs/widget.js b/docs/widget.js index ad4163ffd..781c34b2a 100644 --- a/docs/widget.js +++ b/docs/widget.js @@ -983,9 +983,9 @@ BI.Arrangement = BI.inherit(BI.Widget, { case BI.Arrangement.LAYOUT_TYPE.FREE: return true; case BI.Arrangement.LAYOUT_TYPE.GRID: - if (this._isRegionOverlay()) { - return false; - } + // if (this._isRegionOverlay()) { + // return false; + // } } return true; }, @@ -1093,14 +1093,6 @@ BI.Arrangement = BI.inherit(BI.Widget, { return this.scrollContainer.element[0].clientHeight; }, - getContainerSize: function () { - return this.container.element.bounds(); - }, - - setContainerSize: function (bounds) { - return this.container.element.bounds(bounds); - }, - _applyContainer: function () { //先掩藏后显示能够明确滚动条是否出现 this.scrollContainer.element.css("overflow", "hidden"); @@ -1416,9 +1408,10 @@ BI.Arrangement = BI.inherit(BI.Widget, { }, _start: function () { - this.arrangement.setVisible(true); if (this.options.layoutType === BI.Arrangement.LAYOUT_TYPE.GRID) { this.block.setVisible(true); + } else { + this.arrangement.setVisible(true); } }, @@ -1718,6 +1711,15 @@ BI.Arrangement = BI.inherit(BI.Widget, { region.width = region.width * xRatio; region.top = region.top * yRatio; region.height = region.height * yRatio; + //做一下自适应布局到网格布局的兼容 + var perWidth = self._getOneWidthPortion(); + var widthPortion = Math.round(region.width / perWidth); + var leftPortion = Math.round(region.left / perWidth); + var comparePortion = Math.round((region.width + region.left) / perWidth); + if (leftPortion + widthPortion !== comparePortion) { + region.left = leftPortion * perWidth; + region.width = comparePortion * perWidth - region.left; + } }); if (this._test(regions)) { var layout = this._getLayoutsByRegions(regions); @@ -3494,6 +3496,7 @@ BI.DownListCombo = BI.inherit(BI.Widget, { height: 25, items: [], adjustLength: 0, + direction: "bottom", el: {} }) }, @@ -3523,6 +3526,7 @@ BI.DownListCombo = BI.inherit(BI.Widget, { type: 'bi.combo', isNeedAdjustWidth: false, adjustLength: o.adjustLength, + direction: o.direction, el: BI.createWidget(o.el, { type: "bi.icon_trigger", extraCls: o.iconCls ? o.iconCls : "pull-down-font", @@ -3545,6 +3549,10 @@ BI.DownListCombo = BI.inherit(BI.Widget, { this.downlistcombo.hideView(); }, + showView: function () { + this.downlistcombo.showView(); + }, + populate: function (items) { this.popupview.populate(items); }, diff --git a/src/base/single/editor/editor.code.js b/src/base/single/editor/editor.code.js index b82b0d29e..dcc648ec8 100644 --- a/src/base/single/editor/editor.code.js +++ b/src/base/single/editor/editor.code.js @@ -11,7 +11,11 @@ BI.CodeEditor = BI.inherit(BI.Single, { value: '', watermark: "", lineHeight: 2, - readOnly: false + readOnly: false, + //参数显示值构造函数 + paramFormatter: function (v) { + return v; + } }); }, _init: function () { @@ -31,12 +35,12 @@ BI.CodeEditor = BI.inherit(BI.Single, { }); this.editor.on("focus", function () { - watermark.setVisible(false); + self.watermark.setVisible(false); self.fireEvent(BI.CodeEditor.EVENT_FOCUS); }); this.editor.on("blur", function () { - watermark.setVisible(BI.isEmptyString(self.getValue())); + self.watermark.setVisible(BI.isEmptyString(self.getValue())); self.fireEvent(BI.CodeEditor.EVENT_BLUR); }); @@ -45,21 +49,21 @@ BI.CodeEditor = BI.inherit(BI.Single, { // }); //水印 - var watermark = BI.createWidget({ + this.watermark = BI.createWidget({ type: "bi.label", text: o.watermark, cls: "bi-water-mark", whiteSpace: "nowrap", textAlign: "left" }); - watermark.element.bind( + this.watermark.element.bind( "mousedown", function (e) { self.insertString(""); self.editor.focus(); e.stopEvent(); } ); - watermark.element.bind("click", function (e) { + this.watermark.element.bind("click", function (e) { self.editor.focus(); e.stopEvent(); }); @@ -67,7 +71,7 @@ BI.CodeEditor = BI.inherit(BI.Single, { type: "bi.absolute", element: this, items: [{ - el: watermark, + el: this.watermark, top: 0, left: 5 }] @@ -85,7 +89,18 @@ BI.CodeEditor = BI.inherit(BI.Single, { this.editor.setOption("readOnly", b === true ? false : "nocursor") }, + _checkWaterMark: function () { + var o = this.options; + if (BI.isEmptyString(this.editor.getValue()) && BI.isKey(o.watermark)) { + this.watermark && this.watermark.visible(); + } else { + this.watermark && this.watermark.invisible(); + } + }, + insertParam: function (param) { + var value = param; + param = this.options.paramFormatter(param); var from = this.editor.getCursor(); this.editor.replaceSelection(param); var to = this.editor.getCursor(); @@ -93,6 +108,7 @@ BI.CodeEditor = BI.inherit(BI.Single, { if (BI.isNotNull(param.match(/^$/))) { options.className = 'error-param'; } + options.value = value; this.editor.markText(from, to, options); this.editor.replaceSelection(" "); this.editor.focus(); @@ -112,8 +128,11 @@ BI.CodeEditor = BI.inherit(BI.Single, { case "param": case "error-param": var fieldNameLength = i.to - i.from; - value = value.substr(0, i.from + num) + "$\{" + value.substr(i.from + num, fieldNameLength) + "\}" + value.substr(i.to + num, value.length); + value = value.substr(0, i.from + num) + "$\{" + i.marker.value + "\}" + value.substr(i.to + num, value.length); + //加上${}的偏移 num += 3; + //加上实际值和显示值的长度差的偏移 + num += (i.marker.value.length - fieldNameLength); break; } }); @@ -139,7 +158,8 @@ BI.CodeEditor = BI.inherit(BI.Single, { } else { self.insertString(item); } - }) + }); + this._checkWaterMark(); }, focus: function () { diff --git a/src/base/table/native.scrollbar.js b/src/base/table/native.scrollbar.js index b584d2b3c..ac629be71 100644 --- a/src/base/table/native.scrollbar.js +++ b/src/base/table/native.scrollbar.js @@ -22,7 +22,7 @@ BI.NativeTableScrollbar = BI.inherit(BI.Widget, { render: function () { var self = this, o = this.options; //把滚动台size改掉 - BI.GridTableScrollbar.SIZE = 16; + this.element.width(36); var throttle = BI.throttle(function () { self.fireEvent(BI.NativeTableScrollbar.EVENT_SCROLL, self.element.scrollTop()); @@ -98,7 +98,7 @@ BI.NativeTableHorizontalScrollbar = BI.inherit(BI.Widget, { render: function () { var self = this, o = this.options; //把滚动台size改掉 - BI.GridTableScrollbar.SIZE = 16; + this.element.height(36); var throttle = BI.throttle(function () { self.fireEvent(BI.NativeTableScrollbar.EVENT_SCROLL, self.element.scrollLeft()); diff --git a/src/case/button/treeitem/item.multilayer.icon.treeleaf.js b/src/case/button/treeitem/item.multilayer.icon.treeleaf.js index ad1847532..02ffa959f 100644 --- a/src/case/button/treeitem/item.multilayer.icon.treeleaf.js +++ b/src/case/button/treeitem/item.multilayer.icon.treeleaf.js @@ -18,6 +18,7 @@ BI.MultiLayerIconTreeLeafItem = BI.inherit(BI.BasicButton, { var self = this, o = this.options; this.item = BI.createWidget({ type: "bi.icon_tree_leaf_item", + cls: "bi-list-item-none", iconCls: o.iconCls, id: o.id, pId: o.pId, diff --git a/src/case/colorchooser/colorchooser.trigger.js b/src/case/colorchooser/colorchooser.trigger.js index 93e1c3583..55213bc7f 100644 --- a/src/case/colorchooser/colorchooser.trigger.js +++ b/src/case/colorchooser/colorchooser.trigger.js @@ -19,7 +19,7 @@ BI.ColorChooserTrigger = BI.inherit(BI.Trigger, { BI.ColorChooserTrigger.superclass._init.apply(this, arguments); this.colorContainer = BI.createWidget({ type: "bi.layout", - cls: "bi-card" + cls: "bi-card color-chooser-trigger-content" }); var down = BI.createWidget({ @@ -52,7 +52,13 @@ BI.ColorChooserTrigger = BI.inherit(BI.Trigger, { setValue: function (color) { BI.ColorChooserTrigger.superclass.setValue.apply(this, arguments); - this.colorContainer.element.css("background-color", color); + if (color === "") { + this.colorContainer.element.css("background-color", "").removeClass("trans-color-background").addClass("auto-color-background"); + } else if (color === "transparent") { + this.colorContainer.element.css("background-color", "").removeClass("auto-color-background").addClass("trans-color-background") + } else { + this.colorContainer.element.css({"background-color": color}).removeClass("auto-color-background").removeClass("trans-color-background"); + } } }); BI.ColorChooserTrigger.EVENT_CHANGE = "ColorChooserTrigger.EVENT_CHANGE"; diff --git a/src/config.js b/src/config.js index 31b55260e..94d73454d 100644 --- a/src/config.js +++ b/src/config.js @@ -87,4 +87,8 @@ $(function () { return ob; } }); + //IE8下滚动条用原生的 + if (BI.isIE9Below()) { + BI.GridTableScrollbar.SIZE = 18; + } }); \ No newline at end of file diff --git a/src/core/utils/detectElementResize.js b/src/core/utils/detectElementResize.js index 18a5a39d6..6686ed1b0 100644 --- a/src/core/utils/detectElementResize.js +++ b/src/core/utils/detectElementResize.js @@ -18,10 +18,10 @@ _window = this } - var attachEvent = typeof document !== 'undefined' && document.attachEvent; + var addEventListener = typeof document !== 'undefined' && document.addEventListener; var stylesCreated = false; - if (!attachEvent) { + if (addEventListener) { var requestFrame = (function () { var raf = _window.requestAnimationFrame || _window.mozRequestAnimationFrame || _window.webkitRequestAnimationFrame || function (fn) { @@ -128,8 +128,7 @@ } var addResizeListener = function (element, fn) { - if (attachEvent) element.attachEvent('onresize', fn); - else { + if (addEventListener){ if (!element.__resizeTriggers__) { if (getComputedStyle(element).position === 'static') element.style.position = 'relative'; createStyles(); @@ -149,17 +148,21 @@ }); } element.__resizeListeners__.push(fn); + + } else { + element.attachEvent('onresize', fn); } }; var removeResizeListener = function (element, fn) { - if (attachEvent) element.detachEvent('onresize', fn); - else { + if (addEventListener) { element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1); if (!element.__resizeListeners__.length) { element.removeEventListener('scroll', scrollListener, true); element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__); } + } else { + element.detachEvent('onresize', fn); } }; diff --git a/src/css/resource/background.css b/src/css/resource/background.css index bfd6d7b48..02905d3d9 100644 --- a/src/css/resource/background.css +++ b/src/css/resource/background.css @@ -43,3 +43,13 @@ _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='icon/loading.gif'); _background: none; } +.auto-color-background { + background: url('background/auto-color.png') no-repeat center center; + _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='background/auto-color.png'); + _background: none; +} +.trans-color-background { + background: url('background/trans-color.png') no-repeat center center; + _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='background/trans-color.png'); + _background: none; +} diff --git a/src/less/base/colorchooser/colorchooser.trigger.less b/src/less/base/colorchooser/colorchooser.trigger.less index 7823f5ee0..e948a5f87 100644 --- a/src/less/base/colorchooser/colorchooser.trigger.less +++ b/src/less/base/colorchooser/colorchooser.trigger.less @@ -1,6 +1,6 @@ @import "../../bibase"; -.bi-color-chooser-trigger{ +.bi-color-chooser-trigger { .border-radius(2px); - .box-shadow(0px,0px,2px,1px, @color-bi-background-dark, inset); + .box-shadow(0px, 0px, 2px, 1px, @color-bi-background-dark, inset); } \ No newline at end of file diff --git a/src/less/lib/background.less b/src/less/lib/background.less index dc3aee3b8..9d3e92afa 100644 --- a/src/less/lib/background.less +++ b/src/less/lib/background.less @@ -1 +1,3 @@ -@background-loading: "icon/loading.gif"; \ No newline at end of file +@background-loading: "icon/loading.gif"; +@background-auto-color: "background/auto-color.png"; +@background-trans-color: "background/trans-color.png"; \ No newline at end of file diff --git a/src/less/resource/background.less b/src/less/resource/background.less index eb14dc752..9196c4ce8 100644 --- a/src/less/resource/background.less +++ b/src/less/resource/background.less @@ -6,7 +6,7 @@ .imagePath(@icon-tree-vertical-line-1, 0, 0, repeat-y); } -.bi-theme-dark{ +.bi-theme-dark { .base-line-conn-background { .imagePath(@icon-tree-vertical-line-1-theme-dark, 0, 0, repeat-y); } @@ -16,7 +16,7 @@ .imagePath(@icon-tree-vertical-line-2); } -.bi-theme-dark{ +.bi-theme-dark { .first-line-conn-background { .imagePath(@icon-tree-vertical-line-2-theme-dark); } @@ -26,7 +26,7 @@ .imagePath(@icon-tree-vertical-line-3); } -.bi-theme-dark{ +.bi-theme-dark { .mid-line-conn-background { .imagePath(@icon-tree-vertical-line-3-theme-dark); } @@ -36,7 +36,7 @@ .imagePath(@icon-tree-vertical-line-4); } -.bi-theme-dark{ +.bi-theme-dark { .last-line-conn-background { .imagePath(@icon-tree-vertical-line-4-theme-dark); } @@ -45,3 +45,11 @@ .loading-background { .imagePath(@icon-loading); } + +.auto-color-background { + .imagePath(@background-auto-color); +} + +.trans-color-background { + .imagePath(@background-trans-color); +} \ No newline at end of file diff --git a/src/widget/arrangement/arrangement.js b/src/widget/arrangement/arrangement.js index 57cc8db5b..25d23394a 100644 --- a/src/widget/arrangement/arrangement.js +++ b/src/widget/arrangement/arrangement.js @@ -189,9 +189,9 @@ BI.Arrangement = BI.inherit(BI.Widget, { case BI.Arrangement.LAYOUT_TYPE.FREE: return true; case BI.Arrangement.LAYOUT_TYPE.GRID: - if (this._isRegionOverlay()) { - return false; - } + // if (this._isRegionOverlay()) { + // return false; + // } } return true; }, @@ -299,14 +299,6 @@ BI.Arrangement = BI.inherit(BI.Widget, { return this.scrollContainer.element[0].clientHeight; }, - getContainerSize: function () { - return this.container.element.bounds(); - }, - - setContainerSize: function (bounds) { - return this.container.element.bounds(bounds); - }, - _applyContainer: function () { //先掩藏后显示能够明确滚动条是否出现 this.scrollContainer.element.css("overflow", "hidden"); @@ -622,9 +614,10 @@ BI.Arrangement = BI.inherit(BI.Widget, { }, _start: function () { - this.arrangement.setVisible(true); if (this.options.layoutType === BI.Arrangement.LAYOUT_TYPE.GRID) { this.block.setVisible(true); + } else { + this.arrangement.setVisible(true); } }, @@ -924,6 +917,15 @@ BI.Arrangement = BI.inherit(BI.Widget, { region.width = region.width * xRatio; region.top = region.top * yRatio; region.height = region.height * yRatio; + //做一下自适应布局到网格布局的兼容 + var perWidth = self._getOneWidthPortion(); + var widthPortion = Math.round(region.width / perWidth); + var leftPortion = Math.round(region.left / perWidth); + var comparePortion = Math.round((region.width + region.left) / perWidth); + if (leftPortion + widthPortion !== comparePortion) { + region.left = leftPortion * perWidth; + region.width = comparePortion * perWidth - region.left; + } }); if (this._test(regions)) { var layout = this._getLayoutsByRegions(regions); diff --git a/src/widget/downlist/combo.downlist.js b/src/widget/downlist/combo.downlist.js index 2481a8ba7..5f6a6b854 100644 --- a/src/widget/downlist/combo.downlist.js +++ b/src/widget/downlist/combo.downlist.js @@ -9,6 +9,7 @@ BI.DownListCombo = BI.inherit(BI.Widget, { height: 25, items: [], adjustLength: 0, + direction: "bottom", el: {} }) }, @@ -38,6 +39,7 @@ BI.DownListCombo = BI.inherit(BI.Widget, { type: 'bi.combo', isNeedAdjustWidth: false, adjustLength: o.adjustLength, + direction: o.direction, el: BI.createWidget(o.el, { type: "bi.icon_trigger", extraCls: o.iconCls ? o.iconCls : "pull-down-font", @@ -60,6 +62,10 @@ BI.DownListCombo = BI.inherit(BI.Widget, { this.downlistcombo.hideView(); }, + showView: function () { + this.downlistcombo.showView(); + }, + populate: function (items) { this.popupview.populate(items); },