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