|
|
@ -6903,9 +6903,7 @@ BI.ShelterEditor.EVENT_SPACE = "EVENT_SPACE"; |
|
|
|
BI.ShelterEditor.EVENT_EMPTY = "EVENT_EMPTY"; |
|
|
|
BI.ShelterEditor.EVENT_EMPTY = "EVENT_EMPTY"; |
|
|
|
|
|
|
|
|
|
|
|
BI.shortcut("bi.shelter_editor", BI.ShelterEditor);/** |
|
|
|
BI.shortcut("bi.shelter_editor", BI.ShelterEditor);/** |
|
|
|
* sign是新值(初始value值)形式的自适应宽度的输入框 |
|
|
|
* Created by User on 2017/7/28. |
|
|
|
* @class BI.SignInitialEditor |
|
|
|
|
|
|
|
* @extends BI.Single |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
BI.SignInitialEditor = BI.inherit(BI.Widget, { |
|
|
|
BI.SignInitialEditor = BI.inherit(BI.Widget, { |
|
|
|
_defaultConfig: function () { |
|
|
|
_defaultConfig: function () { |
|
|
@ -6934,8 +6932,7 @@ BI.SignInitialEditor = BI.inherit(BI.Widget, { |
|
|
|
BI.SignInitialEditor.superclass._init.apply(this, arguments); |
|
|
|
BI.SignInitialEditor.superclass._init.apply(this, arguments); |
|
|
|
var self = this, o = this.options; |
|
|
|
var self = this, o = this.options; |
|
|
|
this.editor = BI.createWidget({ |
|
|
|
this.editor = BI.createWidget({ |
|
|
|
type: "bi.sign_editor", |
|
|
|
type: "bi.editor", |
|
|
|
element: this, |
|
|
|
|
|
|
|
height: o.height, |
|
|
|
height: o.height, |
|
|
|
hgap: o.hgap, |
|
|
|
hgap: o.hgap, |
|
|
|
vgap: o.vgap, |
|
|
|
vgap: o.vgap, |
|
|
@ -6943,89 +6940,175 @@ BI.SignInitialEditor = BI.inherit(BI.Widget, { |
|
|
|
rgap: o.rgap, |
|
|
|
rgap: o.rgap, |
|
|
|
tgap: o.tgap, |
|
|
|
tgap: o.tgap, |
|
|
|
bgap: o.bgap, |
|
|
|
bgap: o.bgap, |
|
|
|
value: o.value || o.text, |
|
|
|
value: o.value, |
|
|
|
validationChecker: o.validationChecker, |
|
|
|
validationChecker: o.validationChecker, |
|
|
|
quitChecker: o.quitChecker, |
|
|
|
quitChecker: o.quitChecker, |
|
|
|
title: o.title, |
|
|
|
|
|
|
|
warningTitle: o.warningTitle, |
|
|
|
|
|
|
|
mouseOut: o.mouseOut, |
|
|
|
mouseOut: o.mouseOut, |
|
|
|
allowBlank: o.allowBlank, |
|
|
|
allowBlank: o.allowBlank, |
|
|
|
watermark: o.watermark, |
|
|
|
watermark: o.watermark, |
|
|
|
errorText: o.errorText |
|
|
|
errorText: o.errorText |
|
|
|
}); |
|
|
|
}); |
|
|
|
if(BI.isNotNull(o.value)){ |
|
|
|
this.text = BI.createWidget({ |
|
|
|
this.setState(o.value); |
|
|
|
type: "bi.text_button", |
|
|
|
|
|
|
|
cls: "sign-editor-text", |
|
|
|
|
|
|
|
title: o.title, |
|
|
|
|
|
|
|
warningTitle: o.warningTitle, |
|
|
|
|
|
|
|
tipType: o.tipType, |
|
|
|
|
|
|
|
textAlign: "left", |
|
|
|
|
|
|
|
height: o.height, |
|
|
|
|
|
|
|
hgap: 4, |
|
|
|
|
|
|
|
handler: function () { |
|
|
|
|
|
|
|
self._showInput(); |
|
|
|
|
|
|
|
self.editor.focus(); |
|
|
|
|
|
|
|
self.editor.selectAll(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.text.on(BI.TextButton.EVENT_CHANGE, function () { |
|
|
|
|
|
|
|
BI.nextTick(function () { |
|
|
|
|
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_CLICK_LABEL) |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
BI.createWidget({ |
|
|
|
|
|
|
|
type: "bi.absolute", |
|
|
|
|
|
|
|
element: this, |
|
|
|
|
|
|
|
items: [{ |
|
|
|
|
|
|
|
el: this.text, |
|
|
|
|
|
|
|
left: 0, |
|
|
|
|
|
|
|
right: 0, |
|
|
|
|
|
|
|
top: 0, |
|
|
|
|
|
|
|
bottom: 0 |
|
|
|
|
|
|
|
}] |
|
|
|
|
|
|
|
}); |
|
|
|
this.editor.on(BI.Controller.EVENT_CHANGE, function () { |
|
|
|
this.editor.on(BI.Controller.EVENT_CHANGE, function () { |
|
|
|
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
|
|
|
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.SignEditor.EVENT_FOCUS, function () { |
|
|
|
this.editor.on(BI.Editor.EVENT_FOCUS, function () { |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_FOCUS); |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_FOCUS, arguments); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.SignEditor.EVENT_BLUR, function () { |
|
|
|
this.editor.on(BI.Editor.EVENT_BLUR, function () { |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_BLUR); |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_BLUR, arguments); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.SignEditor.EVENT_CLICK, function () { |
|
|
|
this.editor.on(BI.Editor.EVENT_CLICK, function () { |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_CLICK); |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_CLICK, arguments); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.SignEditor.EVENT_CHANGE, function () { |
|
|
|
this.editor.on(BI.Editor.EVENT_CHANGE, function () { |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_CHANGE); |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_CHANGE, arguments); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.SignEditor.EVENT_KEY_DOWN, function (v) { |
|
|
|
this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) { |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_KEY_DOWN); |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_KEY_DOWN, arguments); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.editor.on(BI.SignEditor.EVENT_VALID, function () { |
|
|
|
this.editor.on(BI.Editor.EVENT_VALID, function () { |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_VALID); |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_VALID, arguments); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.SignEditor.EVENT_CONFIRM, function () { |
|
|
|
this.editor.on(BI.Editor.EVENT_CONFIRM, function () { |
|
|
|
self.setState(self.editor.getValue()); |
|
|
|
self._showHint(); |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_CONFIRM); |
|
|
|
self._checkText(); |
|
|
|
|
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_CONFIRM, arguments); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.editor.on(BI.Editor.EVENT_START, function () { |
|
|
|
|
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_START, arguments); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.SignEditor.EVENT_START, function () { |
|
|
|
this.editor.on(BI.Editor.EVENT_PAUSE, function () { |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_START); |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_PAUSE, arguments); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.SignEditor.EVENT_PAUSE, function () { |
|
|
|
this.editor.on(BI.Editor.EVENT_STOP, function () { |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_PAUSE); |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_STOP, arguments); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.SignEditor.EVENT_STOP, function () { |
|
|
|
this.editor.on(BI.Editor.EVENT_SPACE, function () { |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_STOP); |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_SPACE, arguments); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.SignEditor.EVENT_SPACE, function () { |
|
|
|
this.editor.on(BI.Editor.EVENT_ERROR, function () { |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_SPACE); |
|
|
|
self._checkText(); |
|
|
|
|
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_ERROR, arguments); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.SignEditor.EVENT_ERROR, function () { |
|
|
|
this.editor.on(BI.Editor.EVENT_ENTER, function () { |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_ERROR); |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_ENTER, arguments); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.SignEditor.EVENT_ENTER, function () { |
|
|
|
this.editor.on(BI.Editor.EVENT_RESTRICT, function () { |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_ENTER); |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_RESTRICT, arguments); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.SignEditor.EVENT_RESTRICT, function () { |
|
|
|
this.editor.on(BI.Editor.EVENT_EMPTY, function () { |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_RESTRICT); |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_EMPTY, arguments); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.SignEditor.EVENT_EMPTY, function () { |
|
|
|
BI.createWidget({ |
|
|
|
self.fireEvent(BI.SignInitialEditor.EVENT_EMPTY); |
|
|
|
type: "bi.vertical", |
|
|
|
|
|
|
|
scrolly: false, |
|
|
|
|
|
|
|
element: this, |
|
|
|
|
|
|
|
items: [this.editor] |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
this._showHint(); |
|
|
|
|
|
|
|
self._checkText(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_checkText: function () { |
|
|
|
|
|
|
|
var o = this.options; |
|
|
|
|
|
|
|
BI.nextTick(BI.bind(function () { |
|
|
|
|
|
|
|
if (this.editor.getValue() === "") { |
|
|
|
|
|
|
|
this.text.setValue(o.watermark || ""); |
|
|
|
|
|
|
|
this.text.element.addClass("bi-water-mark"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
var v = this.editor.getValue(); |
|
|
|
|
|
|
|
v = (BI.isEmpty(v) || v == o.text) ? o.text : v + "(" + o.text + ")"; |
|
|
|
|
|
|
|
this.text.setValue(v); |
|
|
|
|
|
|
|
this.text.element.removeClass("bi-water-mark"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, this)); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_showInput: function () { |
|
|
|
|
|
|
|
this.editor.visible(); |
|
|
|
|
|
|
|
this.text.invisible(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_showHint: function () { |
|
|
|
|
|
|
|
this.editor.invisible(); |
|
|
|
|
|
|
|
this.text.visible(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setTitle: function (title) { |
|
|
|
|
|
|
|
this.text.setTitle(title); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setWarningTitle: function (title) { |
|
|
|
|
|
|
|
this.text.setWarningTitle(title); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
focus: function () { |
|
|
|
focus: function () { |
|
|
|
|
|
|
|
this._showInput(); |
|
|
|
this.editor.focus(); |
|
|
|
this.editor.focus(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
blur: function () { |
|
|
|
blur: function () { |
|
|
|
this.editor.blur(); |
|
|
|
this.editor.blur(); |
|
|
|
|
|
|
|
this._showHint(); |
|
|
|
|
|
|
|
this._checkText(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
isValid: function () { |
|
|
|
doRedMark: function () { |
|
|
|
return this.editor.isValid(); |
|
|
|
if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.text.doRedMark.apply(this.text, arguments); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setTitle: function (title) { |
|
|
|
unRedMark: function () { |
|
|
|
this.editor.setTitle(title); |
|
|
|
this.text.unRedMark.apply(this.text, arguments); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setWarningTitle: function (title) { |
|
|
|
doHighLight: function () { |
|
|
|
this.editor.setWarningTitle(title); |
|
|
|
if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.text.doHighLight.apply(this.text, arguments); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unHighLight: function () { |
|
|
|
|
|
|
|
this.text.unHighLight.apply(this.text, arguments); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isValid: function () { |
|
|
|
|
|
|
|
return this.editor.isValid(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setErrorText: function (text) { |
|
|
|
setErrorText: function (text) { |
|
|
@ -7036,9 +7119,19 @@ BI.SignInitialEditor = BI.inherit(BI.Widget, { |
|
|
|
return this.editor.getErrorText(); |
|
|
|
return this.editor.getErrorText(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isEditing: function () { |
|
|
|
|
|
|
|
return this.editor.isEditing(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getLastValidValue: function () { |
|
|
|
|
|
|
|
return this.editor.getLastValidValue(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setValue: function (v) { |
|
|
|
setValue: function (v) { |
|
|
|
|
|
|
|
var o = this.options; |
|
|
|
this.editor.setValue(v.value); |
|
|
|
this.editor.setValue(v.value); |
|
|
|
this.setState(v.value); |
|
|
|
o.text = v.text || o.text; |
|
|
|
|
|
|
|
this._checkText(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getValue: function () { |
|
|
|
getValue: function () { |
|
|
@ -7049,13 +7142,13 @@ BI.SignInitialEditor = BI.inherit(BI.Widget, { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getState: function () { |
|
|
|
getState: function () { |
|
|
|
return this.editor.getState(); |
|
|
|
return this.text.getValue(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setState: function (v) { |
|
|
|
setState: function (v) { |
|
|
|
var o = this.options; |
|
|
|
this._showHint(); |
|
|
|
v = (BI.isEmpty(v) || v == o.text) ? o.text : v + "(" + o.text + ")"; |
|
|
|
v = (BI.isEmpty(v) || v == o.text) ? o.text : v + "(" + o.text + ")"; |
|
|
|
this.editor.setState(v); |
|
|
|
this.text.setValue(v); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
BI.SignInitialEditor.EVENT_CHANGE = "EVENT_CHANGE"; |
|
|
|
BI.SignInitialEditor.EVENT_CHANGE = "EVENT_CHANGE"; |
|
|
|