|
|
@ -1,36 +1,61 @@ |
|
|
|
|
|
|
|
import { shortcut, Widget, extend, emptyFn, i18nText, isArray, createWidget, nextTick, Controller, isNotNull, isString, isKey, isFunction, isNumber, isEmpty } from "@/core"; |
|
|
|
|
|
|
|
import { TextButton, Editor } from "@/base"; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* guy |
|
|
|
* guy |
|
|
|
* 记录状态的输入框 |
|
|
|
* 记录状态的输入框 |
|
|
|
* @class BI.StateEditor |
|
|
|
* @class StateEditor |
|
|
|
* @extends BI.Single |
|
|
|
* @extends Single |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
BI.StateEditor = BI.inherit(BI.Widget, { |
|
|
|
@shortcut() |
|
|
|
_defaultConfig: function () { |
|
|
|
export class StateEditor extends Widget { |
|
|
|
var conf = BI.StateEditor.superclass._defaultConfig.apply(this, arguments); |
|
|
|
static xtype = "bi.state_editor" |
|
|
|
return BI.extend(conf, { |
|
|
|
|
|
|
|
baseCls: (conf.baseCls || "") + " bi-state-editor", |
|
|
|
static EVENT_CHANGE = "EVENT_CHANGE" |
|
|
|
|
|
|
|
static EVENT_FOCUS = "EVENT_FOCUS" |
|
|
|
|
|
|
|
static EVENT_BLUR = "EVENT_BLUR" |
|
|
|
|
|
|
|
static EVENT_CLICK = "EVENT_CLICK" |
|
|
|
|
|
|
|
static EVENT_KEY_DOWN = "EVENT_KEY_DOWN" |
|
|
|
|
|
|
|
static EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL" |
|
|
|
|
|
|
|
static EVENT_START = "EVENT_START" |
|
|
|
|
|
|
|
static EVENT_PAUSE = "EVENT_PAUSE" |
|
|
|
|
|
|
|
static EVENT_STOP = "EVENT_STOP" |
|
|
|
|
|
|
|
static EVENT_CONFIRM = "EVENT_CONFIRM" |
|
|
|
|
|
|
|
static EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM" |
|
|
|
|
|
|
|
static EVENT_VALID = "EVENT_VALID" |
|
|
|
|
|
|
|
static EVENT_ERROR = "EVENT_ERROR" |
|
|
|
|
|
|
|
static EVENT_ENTER = "EVENT_ENTER" |
|
|
|
|
|
|
|
static EVENT_RESTRICT = "EVENT_RESTRICT" |
|
|
|
|
|
|
|
static EVENT_SPACE = "EVENT_SPACE" |
|
|
|
|
|
|
|
static EVENT_EMPTY = "EVENT_EMPTY" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_defaultConfig() { |
|
|
|
|
|
|
|
const conf = super._defaultConfig(...arguments); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return extend(conf, { |
|
|
|
|
|
|
|
baseCls: `${conf.baseCls || ""} bi-state-editor`, |
|
|
|
hgap: 4, |
|
|
|
hgap: 4, |
|
|
|
vgap: 2, |
|
|
|
vgap: 2, |
|
|
|
lgap: 0, |
|
|
|
lgap: 0, |
|
|
|
rgap: 0, |
|
|
|
rgap: 0, |
|
|
|
tgap: 0, |
|
|
|
tgap: 0, |
|
|
|
bgap: 0, |
|
|
|
bgap: 0, |
|
|
|
validationChecker: BI.emptyFn, |
|
|
|
validationChecker: emptyFn, |
|
|
|
quitChecker: BI.emptyFn, |
|
|
|
quitChecker: emptyFn, |
|
|
|
allowBlank: true, |
|
|
|
allowBlank: true, |
|
|
|
watermark: "", |
|
|
|
watermark: "", |
|
|
|
errorText: "", |
|
|
|
errorText: "", |
|
|
|
height: 24, |
|
|
|
height: 24, |
|
|
|
defaultText: BI.i18nText("BI-Basic_Unrestricted"), // 默认显示值,默认显示值与显示值的区别是默认显示值标记灰色
|
|
|
|
defaultText: i18nText("BI-Basic_Unrestricted"), // 默认显示值,默认显示值与显示值的区别是默认显示值标记灰色
|
|
|
|
text: "", // 显示值
|
|
|
|
text: "", // 显示值
|
|
|
|
el: {} |
|
|
|
el: {}, |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_init: function () { |
|
|
|
_init() { |
|
|
|
BI.StateEditor.superclass._init.apply(this, arguments); |
|
|
|
super._init(...arguments); |
|
|
|
var self = this, o = this.options; |
|
|
|
const o = this.options; |
|
|
|
this.editor = BI.createWidget(o.el, { |
|
|
|
this.editor = createWidget(o.el, { |
|
|
|
type: "bi.editor", |
|
|
|
type: "bi.editor", |
|
|
|
simple: o.simple, |
|
|
|
simple: o.simple, |
|
|
|
height: o.height, |
|
|
|
height: o.height, |
|
|
@ -48,262 +73,243 @@ BI.StateEditor = BI.inherit(BI.Widget, { |
|
|
|
errorText: o.errorText, |
|
|
|
errorText: o.errorText, |
|
|
|
autoTrim: o.autoTrim, |
|
|
|
autoTrim: o.autoTrim, |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.text = BI.createWidget({ |
|
|
|
this.text = createWidget({ |
|
|
|
type: "bi.text_button", |
|
|
|
type: "bi.text_button", |
|
|
|
cls: "bi-water-mark tip-text-style", |
|
|
|
cls: "bi-water-mark tip-text-style", |
|
|
|
textAlign: "left", |
|
|
|
textAlign: "left", |
|
|
|
height: o.height, |
|
|
|
height: o.height, |
|
|
|
text: o.text, |
|
|
|
text: o.text, |
|
|
|
hgap: o.hgap + 2, |
|
|
|
hgap: o.hgap + 2, |
|
|
|
handler: function () { |
|
|
|
handler: () => { |
|
|
|
self._showInput(); |
|
|
|
this._showInput(); |
|
|
|
self.editor.focus(); |
|
|
|
this.editor.focus(); |
|
|
|
self.editor.setValue(""); |
|
|
|
this.editor.setValue(""); |
|
|
|
}, |
|
|
|
}, |
|
|
|
title: BI.isNotNull(o.tipText) ? o.tipText : function () { |
|
|
|
title: isNotNull(o.tipText) ? o.tipText : () => { |
|
|
|
var title = ""; |
|
|
|
let title = ""; |
|
|
|
if (BI.isString(self.stateValue)) { |
|
|
|
if (isString(this.stateValue)) { |
|
|
|
title = self.stateValue; |
|
|
|
title = this.stateValue; |
|
|
|
} |
|
|
|
} |
|
|
|
if (BI.isArray(self.stateValue) && self.stateValue.length === 1) { |
|
|
|
if (isArray(this.stateValue) && this.stateValue.length === 1) { |
|
|
|
title = self.stateValue[0]; |
|
|
|
title = this.stateValue[0]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return title; |
|
|
|
return title; |
|
|
|
}, |
|
|
|
}, |
|
|
|
warningTitle: o.warningTitle, |
|
|
|
warningTitle: o.warningTitle, |
|
|
|
tipType: o.tipType |
|
|
|
tipType: o.tipType, |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.text.on(BI.TextButton.EVENT_CHANGE, function () { |
|
|
|
this.text.on(TextButton.EVENT_CHANGE, () => { |
|
|
|
BI.nextTick(function () { |
|
|
|
nextTick(() => { |
|
|
|
self.fireEvent(BI.StateEditor.EVENT_CLICK_LABEL); |
|
|
|
this.fireEvent(StateEditor.EVENT_CLICK_LABEL); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.Controller.EVENT_CHANGE, function () { |
|
|
|
this.editor.on(Controller.EVENT_CHANGE, (...args) => { |
|
|
|
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
|
|
|
this.fireEvent(Controller.EVENT_CHANGE, ...args); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.Editor.EVENT_FOCUS, function () { |
|
|
|
this.editor.on(Editor.EVENT_FOCUS, (...args) => { |
|
|
|
self.fireEvent(BI.StateEditor.EVENT_FOCUS, arguments); |
|
|
|
this.fireEvent(StateEditor.EVENT_FOCUS, ...args); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.Editor.EVENT_BLUR, function () { |
|
|
|
this.editor.on(Editor.EVENT_BLUR, (...args) => { |
|
|
|
self.fireEvent(BI.StateEditor.EVENT_BLUR, arguments); |
|
|
|
this.fireEvent(StateEditor.EVENT_BLUR, ...args); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.Editor.EVENT_CLICK, function () { |
|
|
|
this.editor.on(Editor.EVENT_CLICK, (...args) => { |
|
|
|
self.fireEvent(BI.StateEditor.EVENT_CLICK, arguments); |
|
|
|
this.fireEvent(StateEditor.EVENT_CLICK, ...args); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.Editor.EVENT_CHANGE, function () { |
|
|
|
this.editor.on(Editor.EVENT_CHANGE, (...args) => { |
|
|
|
self.fireEvent(BI.StateEditor.EVENT_CHANGE, arguments); |
|
|
|
this.fireEvent(StateEditor.EVENT_CHANGE, ...args); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) { |
|
|
|
this.editor.on(Editor.EVENT_KEY_DOWN, (...args) => { |
|
|
|
self.fireEvent(BI.StateEditor.EVENT_KEY_DOWN, arguments); |
|
|
|
this.fireEvent(StateEditor.EVENT_KEY_DOWN, ...args); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.editor.on(BI.Editor.EVENT_VALID, function () { |
|
|
|
this.editor.on(Editor.EVENT_VALID, (...args) => { |
|
|
|
self.fireEvent(BI.StateEditor.EVENT_VALID, arguments); |
|
|
|
this.fireEvent(StateEditor.EVENT_VALID, ...args); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.Editor.EVENT_CONFIRM, function () { |
|
|
|
this.editor.on(Editor.EVENT_CONFIRM, (...args) => { |
|
|
|
self._showHint(); |
|
|
|
this._showHint(); |
|
|
|
self.fireEvent(BI.StateEditor.EVENT_CONFIRM, arguments); |
|
|
|
this.fireEvent(StateEditor.EVENT_CONFIRM, ...args); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () { |
|
|
|
this.editor.on(Editor.EVENT_CHANGE_CONFIRM, (...args) => { |
|
|
|
self._showHint(); |
|
|
|
this._showHint(); |
|
|
|
self.fireEvent(BI.StateEditor.EVENT_CHANGE_CONFIRM, arguments); |
|
|
|
this.fireEvent(StateEditor.EVENT_CHANGE_CONFIRM, ...args); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.Editor.EVENT_START, function () { |
|
|
|
this.editor.on(Editor.EVENT_START, (...args) => { |
|
|
|
self.fireEvent(BI.StateEditor.EVENT_START, arguments); |
|
|
|
this.fireEvent(StateEditor.EVENT_START, ...args); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.Editor.EVENT_PAUSE, function () { |
|
|
|
this.editor.on(Editor.EVENT_PAUSE, (...args) => { |
|
|
|
self.fireEvent(BI.StateEditor.EVENT_PAUSE, arguments); |
|
|
|
this.fireEvent(StateEditor.EVENT_PAUSE, ...args); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.Editor.EVENT_STOP, function () { |
|
|
|
this.editor.on(Editor.EVENT_STOP, (...args) => { |
|
|
|
self.fireEvent(BI.StateEditor.EVENT_STOP, arguments); |
|
|
|
this.fireEvent(StateEditor.EVENT_STOP, ...args); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.Editor.EVENT_SPACE, function () { |
|
|
|
this.editor.on(Editor.EVENT_SPACE, (...args) => { |
|
|
|
self.fireEvent(BI.StateEditor.EVENT_SPACE, arguments); |
|
|
|
this.fireEvent(StateEditor.EVENT_SPACE, ...args); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.Editor.EVENT_ERROR, function () { |
|
|
|
this.editor.on(Editor.EVENT_ERROR, (...args) => { |
|
|
|
self.fireEvent(BI.StateEditor.EVENT_ERROR, arguments); |
|
|
|
this.fireEvent(StateEditor.EVENT_ERROR, ...args); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.Editor.EVENT_ENTER, function () { |
|
|
|
this.editor.on(Editor.EVENT_ENTER, (...args) => { |
|
|
|
self.fireEvent(BI.StateEditor.EVENT_ENTER, arguments); |
|
|
|
this.fireEvent(StateEditor.EVENT_ENTER, ...args); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.Editor.EVENT_RESTRICT, function () { |
|
|
|
this.editor.on(Editor.EVENT_RESTRICT, (...args) => { |
|
|
|
self.fireEvent(BI.StateEditor.EVENT_RESTRICT, arguments); |
|
|
|
this.fireEvent(StateEditor.EVENT_RESTRICT, ...args); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.Editor.EVENT_EMPTY, function () { |
|
|
|
this.editor.on(Editor.EVENT_EMPTY, (...args) => { |
|
|
|
self.fireEvent(BI.StateEditor.EVENT_EMPTY, arguments); |
|
|
|
this.fireEvent(StateEditor.EVENT_EMPTY, ...args); |
|
|
|
}); |
|
|
|
}); |
|
|
|
BI.createWidget({ |
|
|
|
createWidget({ |
|
|
|
type: "bi.absolute", |
|
|
|
type: "bi.absolute", |
|
|
|
element: this, |
|
|
|
element: this, |
|
|
|
items: [ |
|
|
|
items: [{ |
|
|
|
{ |
|
|
|
|
|
|
|
el: this.text, |
|
|
|
el: this.text, |
|
|
|
inset: 0, |
|
|
|
inset: 0, |
|
|
|
}, { |
|
|
|
}, { |
|
|
|
el: this.editor, |
|
|
|
el: this.editor, |
|
|
|
inset: 0, |
|
|
|
inset: 0, |
|
|
|
} |
|
|
|
}], |
|
|
|
] |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
this._showHint(); |
|
|
|
this._showHint(); |
|
|
|
if (BI.isNotNull(o.text)) { |
|
|
|
if (isNotNull(o.text)) { |
|
|
|
this.setState(o.text); |
|
|
|
this.setState(o.text); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setWaterMark: function (v) { |
|
|
|
setWaterMark(v) { |
|
|
|
this.options.watermark = v; |
|
|
|
this.options.watermark = v; |
|
|
|
this.editor.setWaterMark(v); |
|
|
|
this.editor.setWaterMark(v); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
doRedMark: function () { |
|
|
|
doRedMark() { |
|
|
|
if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) { |
|
|
|
if (this.editor.getValue() === "" && isKey(this.options.watermark)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
this.text.doRedMark.apply(this.text, arguments); |
|
|
|
this.text.doRedMark(...arguments); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
unRedMark: function () { |
|
|
|
unRedMark() { |
|
|
|
this.text.unRedMark.apply(this.text, arguments); |
|
|
|
this.text.unRedMark(...arguments); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
doHighLight: function () { |
|
|
|
doHighLight() { |
|
|
|
if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) { |
|
|
|
if (this.editor.getValue() === "" && isKey(this.options.watermark)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
this.text.doHighLight.apply(this.text, arguments); |
|
|
|
this.text.doHighLight(...arguments); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
unHighLight: function () { |
|
|
|
unHighLight() { |
|
|
|
this.text.unHighLight.apply(this.text, arguments); |
|
|
|
this.text.unHighLight(...arguments); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
focus: function () { |
|
|
|
focus() { |
|
|
|
if (this.options.disabled === false) { |
|
|
|
if (this.options.disabled === false) { |
|
|
|
this._showInput(); |
|
|
|
this._showInput(); |
|
|
|
this.editor.focus(); |
|
|
|
this.editor.focus(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
blur: function () { |
|
|
|
blur() { |
|
|
|
this.editor.blur(); |
|
|
|
this.editor.blur(); |
|
|
|
this._showHint(); |
|
|
|
this._showHint(); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_showInput: function () { |
|
|
|
_showInput() { |
|
|
|
this.editor.visible(); |
|
|
|
this.editor.visible(); |
|
|
|
this.text.invisible(); |
|
|
|
this.text.invisible(); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_showHint: function () { |
|
|
|
_showHint() { |
|
|
|
this.editor.invisible(); |
|
|
|
this.editor.invisible(); |
|
|
|
this.text.visible(); |
|
|
|
this.text.visible(); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_setText: function (v) { |
|
|
|
_setText(v) { |
|
|
|
this.text.setText(v); |
|
|
|
this.text.setText(v); |
|
|
|
this.text.setTitle(v); |
|
|
|
this.text.setTitle(v); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
isValid: function () { |
|
|
|
isValid() { |
|
|
|
return this.editor.isValid(); |
|
|
|
return this.editor.isValid(); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setErrorText: function (text) { |
|
|
|
setErrorText(text) { |
|
|
|
this.editor.setErrorText(text); |
|
|
|
this.editor.setErrorText(text); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getErrorText: function () { |
|
|
|
getErrorText() { |
|
|
|
return this.editor.getErrorText(); |
|
|
|
return this.editor.getErrorText(); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
isEditing: function () { |
|
|
|
isEditing() { |
|
|
|
return this.editor.isEditing(); |
|
|
|
return this.editor.isEditing(); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getLastValidValue: function () { |
|
|
|
getLastValidValue() { |
|
|
|
return this.editor.getLastValidValue(); |
|
|
|
return this.editor.getLastValidValue(); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getLastChangedValue: function () { |
|
|
|
getLastChangedValue() { |
|
|
|
return this.editor.getLastChangedValue(); |
|
|
|
return this.editor.getLastChangedValue(); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setValue: function (k) { |
|
|
|
setValue(k) { |
|
|
|
this.editor.setValue(k); |
|
|
|
this.editor.setValue(k); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getValue: function () { |
|
|
|
getValue() { |
|
|
|
return this.editor.getValue(); |
|
|
|
return this.editor.getValue(); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getState: function () { |
|
|
|
getState() { |
|
|
|
return this.editor.getValue().match(/[^\s]+/g); |
|
|
|
return this.editor.getValue().match(/[^\s]+/g); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setState: function (v) { |
|
|
|
setState(v) { |
|
|
|
var o = this.options; |
|
|
|
const o = this.options; |
|
|
|
var defaultText = BI.isFunction(o.defaultText) ? o.defaultText() : o.defaultText; |
|
|
|
const defaultText = isFunction(o.defaultText) ? o.defaultText() : o.defaultText; |
|
|
|
BI.StateEditor.superclass.setValue.apply(this, arguments); |
|
|
|
super.setValue(...arguments); |
|
|
|
this.stateValue = v; |
|
|
|
this.stateValue = v; |
|
|
|
if (BI.isNumber(v)) { |
|
|
|
if (isNumber(v)) { |
|
|
|
if (v === BI.Selection.All) { |
|
|
|
if (v === Selection.All) { |
|
|
|
this._setText(BI.i18nText("BI-Select_All")); |
|
|
|
this._setText(i18nText("BI-Select_All")); |
|
|
|
this.text.element.removeClass("bi-water-mark"); |
|
|
|
this.text.element.removeClass("bi-water-mark"); |
|
|
|
} else if (v === BI.Selection.Multi) { |
|
|
|
} else if (v === Selection.Multi) { |
|
|
|
this._setText(BI.i18nText("BI-Select_Part")); |
|
|
|
this._setText(i18nText("BI-Select_Part")); |
|
|
|
this.text.element.removeClass("bi-water-mark"); |
|
|
|
this.text.element.removeClass("bi-water-mark"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this._setText(BI.isKey(defaultText) ? defaultText : o.text); |
|
|
|
this._setText(isKey(defaultText) ? defaultText : o.text); |
|
|
|
BI.isKey(defaultText) ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); |
|
|
|
isKey(defaultText) ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (BI.isString(v)) { |
|
|
|
if (isString(v)) { |
|
|
|
this._setText(v); |
|
|
|
this._setText(v); |
|
|
|
// 配置了defaultText才判断标灰,其他情况不标灰
|
|
|
|
// 配置了defaultText才判断标灰,其他情况不标灰
|
|
|
|
(BI.isKey(defaultText) && defaultText === v) ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); |
|
|
|
(isKey(defaultText) && defaultText === v) ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); |
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (BI.isArray(v)) { |
|
|
|
if (isArray(v)) { |
|
|
|
if (BI.isEmpty(v)) { |
|
|
|
if (isEmpty(v)) { |
|
|
|
this._setText(BI.isKey(defaultText) ? defaultText : o.text); |
|
|
|
this._setText(isKey(defaultText) ? defaultText : o.text); |
|
|
|
BI.isKey(defaultText) ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); |
|
|
|
isKey(defaultText) ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); |
|
|
|
} else if (v.length === 1) { |
|
|
|
} else if (v.length === 1) { |
|
|
|
this._setText(v[0]); |
|
|
|
this._setText(v[0]); |
|
|
|
this.text.element.removeClass("bi-water-mark"); |
|
|
|
this.text.element.removeClass("bi-water-mark"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this._setText(BI.i18nText("BI-Select_Part")); |
|
|
|
this._setText(i18nText("BI-Select_Part")); |
|
|
|
this.text.element.removeClass("bi-water-mark"); |
|
|
|
this.text.element.removeClass("bi-water-mark"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setTipType: function (v) { |
|
|
|
setTipType(v) { |
|
|
|
this.text.options.tipType = v; |
|
|
|
this.text.options.tipType = v; |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getText: function () { |
|
|
|
getText() { |
|
|
|
return this.text.getText(); |
|
|
|
return this.text.getText(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
BI.StateEditor.EVENT_CHANGE = "EVENT_CHANGE"; |
|
|
|
|
|
|
|
BI.StateEditor.EVENT_FOCUS = "EVENT_FOCUS"; |
|
|
|
|
|
|
|
BI.StateEditor.EVENT_BLUR = "EVENT_BLUR"; |
|
|
|
|
|
|
|
BI.StateEditor.EVENT_CLICK = "EVENT_CLICK"; |
|
|
|
|
|
|
|
BI.StateEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; |
|
|
|
|
|
|
|
BI.StateEditor.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BI.StateEditor.EVENT_START = "EVENT_START"; |
|
|
|
|
|
|
|
BI.StateEditor.EVENT_PAUSE = "EVENT_PAUSE"; |
|
|
|
|
|
|
|
BI.StateEditor.EVENT_STOP = "EVENT_STOP"; |
|
|
|
|
|
|
|
BI.StateEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; |
|
|
|
|
|
|
|
BI.StateEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM"; |
|
|
|
|
|
|
|
BI.StateEditor.EVENT_VALID = "EVENT_VALID"; |
|
|
|
|
|
|
|
BI.StateEditor.EVENT_ERROR = "EVENT_ERROR"; |
|
|
|
|
|
|
|
BI.StateEditor.EVENT_ENTER = "EVENT_ENTER"; |
|
|
|
|
|
|
|
BI.StateEditor.EVENT_RESTRICT = "EVENT_RESTRICT"; |
|
|
|
|
|
|
|
BI.StateEditor.EVENT_SPACE = "EVENT_SPACE"; |
|
|
|
|
|
|
|
BI.StateEditor.EVENT_EMPTY = "EVENT_EMPTY"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BI.shortcut("bi.state_editor", BI.StateEditor); |
|
|
|
|
|
|
|