Browse Source

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

* commit 'fde54a49f137cefc43590a2ecc40013f98aa109a':
  add
  add
  给downlistcombo开一些接口
  add
  add
  add
  add
  add
  布局
  add
  add
  给codeeditor添加paramformatter接口,是的可以自定义参数显示值
  codeeditor的水印问题
  bug
master
guy 8 years ago
parent
commit
657a338841
  1. 42
      bi/base.js
  2. 11
      bi/case.js
  3. 19
      bi/core.js
  4. 32
      bi/widget.js
  5. 42
      docs/base.js
  6. 11
      docs/case.js
  7. 19
      docs/core.js
  8. 10
      docs/resource.css
  9. 32
      docs/widget.js
  10. 38
      src/base/single/editor/editor.code.js
  11. 4
      src/base/table/native.scrollbar.js
  12. 1
      src/case/button/treeitem/item.multilayer.icon.treeleaf.js
  13. 10
      src/case/colorchooser/colorchooser.trigger.js
  14. 4
      src/config.js
  15. 15
      src/core/utils/detectElementResize.js
  16. 10
      src/css/resource/background.css
  17. 4
      src/less/base/colorchooser/colorchooser.trigger.less
  18. 4
      src/less/lib/background.less
  19. 16
      src/less/resource/background.less
  20. 26
      src/widget/arrangement/arrangement.js
  21. 6
      src/widget/downlist/combo.downlist.js

42
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());

11
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";

19
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;
}
});

32
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);
},

42
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());

11
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";

19
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;
}
});

10
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');

32
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);
},

38
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 () {

4
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());

1
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,

10
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";

4
src/config.js

@ -87,4 +87,8 @@ $(function () {
return ob;
}
});
//IE8下滚动条用原生的
if (BI.isIE9Below()) {
BI.GridTableScrollbar.SIZE = 18;
}
});

15
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);
}
};

10
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;
}

4
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);
}

4
src/less/lib/background.less

@ -1 +1,3 @@
@background-loading: "icon/loading.gif";
@background-loading: "icon/loading.gif";
@background-auto-color: "background/auto-color.png";
@background-trans-color: "background/trans-color.png";

16
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);
}

26
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);

6
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);
},

Loading…
Cancel
Save