From aff26190231610461cc42305ef89c9e5c2db9f1d Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 12 May 2017 10:32:24 +0800 Subject: [PATCH] editor --- bi/case.js | 203 ++++--------------------- bi/widget.js | 2 +- docs/case.js | 203 ++++--------------------- docs/widget.js | 2 +- src/case/editor/editor.adapt.js | 162 -------------------- src/case/editor/editor.search.js | 2 +- src/case/editor/editor.shelter.js | 15 +- src/case/editor/editor.sign.initial.js | 2 +- src/case/editor/editor.sign.js | 17 ++- src/case/editor/editor.state.js | 2 +- src/case/editor/editor.state.simple.js | 2 +- src/case/editor/editor.text.js | 2 +- src/widget/year/trigger.year.js | 2 +- 13 files changed, 99 insertions(+), 517 deletions(-) delete mode 100644 src/case/editor/editor.adapt.js diff --git a/bi/case.js b/bi/case.js index cdf0cbe36..7b4c962e3 100644 --- a/bi/case.js +++ b/bi/case.js @@ -4903,167 +4903,6 @@ BI.DownListSelectTextTrigger = BI.inherit(BI.Trigger, { } }); BI.shortcut("bi.down_list_select_text_trigger", BI.DownListSelectTextTrigger);/** - * 根据内容自适应长度的输入框 - * @class BI.AdaptiveEditor - * @extends BI.Single - */ -BI.AdaptiveEditor = BI.inherit(BI.Single, { - _defaultConfig: function () { - var conf = BI.AdaptiveEditor.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - baseCls: (conf.baseCls || "") + " bi-adapt-editor", - hgap: 4, - vgap: 2, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0, - validationChecker: BI.emptyFn, - quitChecker: BI.emptyFn, - mouseOut: false, - allowBlank: true, - watermark: "", - errorText: "", - height: 30 - }) - }, - - _init: function () { - BI.AdaptiveEditor.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.editor = BI.createWidget({ - type: "bi.sign_editor", - element: this, - height: o.height, - hgap: o.hgap, - vgap: o.vgap, - lgap: o.lgap, - rgap: o.rgap, - tgap: o.tgap, - bgap: o.bgap, - value: o.value, - validationChecker: o.validationChecker, - quitChecker: o.quitChecker, - mouseOut: o.mouseOut, - allowBlank: o.allowBlank, - watermark: o.watermark, - errorText: o.errorText - }); - - this.editor.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.editor.on(BI.SignEditor.EVENT_FOCUS, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_FOCUS); - }); - this.editor.on(BI.SignEditor.EVENT_BLUR, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_BLUR); - }); - this.editor.on(BI.SignEditor.EVENT_CLICK, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_CLICK); - }); - this.editor.on(BI.SignEditor.EVENT_CHANGE, function () { - self._checkEditorLength(); - self.fireEvent(BI.AdaptiveEditor.EVENT_CHANGE); - }); - this.editor.on(BI.SignEditor.EVENT_KEY_DOWN, function (v) { - self.fireEvent(BI.AdaptiveEditor.EVENT_KEY_DOWN); - }); - - this.editor.on(BI.SignEditor.EVENT_VALID, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_VALID); - }); - this.editor.on(BI.SignEditor.EVENT_CONFIRM, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_CONFIRM); - }); - this.editor.on(BI.SignEditor.EVENT_START, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_START); - }); - this.editor.on(BI.SignEditor.EVENT_PAUSE, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_PAUSE); - }); - this.editor.on(BI.Editor.EVENT_STOP, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_STOP); - }); - this.editor.on(BI.SignEditor.EVENT_SPACE, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_SPACE); - }); - this.editor.on(BI.SignEditor.EVENT_ERROR, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_ERROR); - }); - this.editor.on(BI.SignEditor.EVENT_ENTER, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_ENTER); - }); - this.editor.on(BI.SignEditor.EVENT_RESTRICT, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_RESTRICT); - }); - this.editor.on(BI.SignEditor.EVENT_EMPTY, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_EMPTY); - }); - this._checkEditorLength(); - }, - - _checkEditorLength: function () { - var o = this.options; - this.element.width(BI.DOM.getTextSizeWidth(this.getValue(), 14) + 2 * o.hgap + o.lgap + o.rgap); - }, - - focus: function () { - this.editor.focus(); - }, - - blur: function () { - this.editor.blur(); - }, - - isValid: function () { - return this.editor.isValid(); - }, - - setErrorText: function (text) { - this.editor.setErrorText(text); - }, - - getErrorText: function () { - return this.editor.getErrorText(); - }, - - setValue: function (k) { - this.editor.setValue(k); - this._checkEditorLength(); - }, - - getValue: function () { - return this.editor.getValue(); - }, - - getState: function () { - return this.editor.getState(); - }, - - setState: function (v) { - - } -}); -BI.AdaptiveEditor.EVENT_CHANGE = "EVENT_CHANGE"; -BI.AdaptiveEditor.EVENT_FOCUS = "EVENT_FOCUS"; -BI.AdaptiveEditor.EVENT_BLUR = "EVENT_BLUR"; -BI.AdaptiveEditor.EVENT_CLICK = "EVENT_CLICK"; -BI.AdaptiveEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; -BI.AdaptiveEditor.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL"; - -BI.AdaptiveEditor.EVENT_START = "EVENT_START"; -BI.AdaptiveEditor.EVENT_PAUSE = "EVENT_PAUSE"; -BI.AdaptiveEditor.EVENT_STOP = "EVENT_STOP"; -BI.AdaptiveEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; -BI.AdaptiveEditor.EVENT_VALID = "EVENT_VALID"; -BI.AdaptiveEditor.EVENT_ERROR = "EVENT_ERROR"; -BI.AdaptiveEditor.EVENT_ENTER = "EVENT_ENTER"; -BI.AdaptiveEditor.EVENT_RESTRICT = "EVENT_RESTRICT"; -BI.AdaptiveEditor.EVENT_SPACE = "EVENT_SPACE"; -BI.AdaptiveEditor.EVENT_EMPTY = "EVENT_EMPTY"; - -BI.shortcut("bi.adapt_editor", BI.AdaptiveEditor);/** * 有清楚按钮的文本框 * Created by GUY on 2015/9/29. * @class BI.SmallTextEditor @@ -5406,7 +5245,7 @@ BI.SearchEditor = BI.inherit(BI.Widget, { setEnable: function (b) { BI.Editor.superclass.setEnable.apply(this, arguments); this.editor && this.editor.setEnable(b); - this.clear.setEnabled(b); + this.clear.setEnable(b); } }); BI.SearchEditor.EVENT_CHANGE = "EVENT_CHANGE"; @@ -5451,9 +5290,9 @@ BI.shortcut("bi.small_search_editor", BI.SmallSearchEditor);/** * 带标记的文本框 * Created by GUY on 2016/1/25. * @class BI.ShelterEditor - * @extends BI.Single + * @extends BI.Widget */ -BI.ShelterEditor = BI.inherit(BI.Single, { +BI.ShelterEditor = BI.inherit(BI.Widget, { _defaultConfig: function () { var conf = BI.ShelterEditor.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { @@ -5498,6 +5337,9 @@ BI.ShelterEditor = BI.inherit(BI.Single, { this.text = BI.createWidget({ type: "bi.text_button", cls: "shelter-editor-text", + title: o.title, + warningTitle: o.warningTitle, + tipType: o.tipType, textAlign: o.textAlign, height: o.height, hgap: 4 @@ -5603,6 +5445,14 @@ BI.ShelterEditor = BI.inherit(BI.Single, { this.text.visible(); }, + setTitle: function (title) { + this.text.setTitle(title); + }, + + setWarningTitle: function (title) { + this.text.setWarningTitle(title); + }, + focus: function () { this._showInput(); this.editor.focus(); @@ -5701,7 +5551,7 @@ BI.shortcut("bi.shelter_editor", BI.ShelterEditor);/** * @class BI.SignInitialEditor * @extends BI.Single */ -BI.SignInitialEditor = BI.inherit(BI.Single, { +BI.SignInitialEditor = BI.inherit(BI.Widget, { _defaultConfig: function () { var conf = BI.SignInitialEditor.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { @@ -5864,9 +5714,9 @@ BI.shortcut("bi.sign_initial_editor", BI.SignInitialEditor);/** * 带标记的文本框 * Created by GUY on 2015/8/28. * @class BI.SignEditor - * @extends BI.Single + * @extends BI.Widget */ -BI.SignEditor = BI.inherit(BI.Single, { +BI.SignEditor = BI.inherit(BI.Widget, { _defaultConfig: function () { var conf = BI.SignEditor.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { @@ -5910,6 +5760,9 @@ BI.SignEditor = BI.inherit(BI.Single, { this.text = BI.createWidget({ type: "bi.text_button", cls: "sign-editor-text", + title: o.title, + warningTitle: o.warningTitle, + tipType: o.tipType, textAlign: "left", height: o.height, hgap: 4, @@ -6020,6 +5873,14 @@ BI.SignEditor = BI.inherit(BI.Single, { this.text.visible(); }, + setTitle: function (title) { + this.text.setTitle(title); + }, + + setWarningTitle: function (title) { + this.text.setWarningTitle(title); + }, + focus: function () { this._showInput(); this.editor.focus(); @@ -6057,7 +5918,7 @@ BI.SignEditor = BI.inherit(BI.Single, { return this.editor.isValid(); }, - setValid: function(v){ + setValid: function (v) { BI.SignEditor.superclass.setValid.apply(this, arguments); this.editor.setValid(v); }, @@ -6120,7 +5981,7 @@ BI.shortcut("bi.sign_editor", BI.SignEditor);/** * @class BI.StateEditor * @extends BI.Single */ -BI.StateEditor = BI.inherit(BI.Single, { +BI.StateEditor = BI.inherit(BI.Widget, { _defaultConfig: function () { var conf = BI.StateEditor.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { @@ -6400,7 +6261,7 @@ BI.shortcut("bi.state_editor", BI.StateEditor);/** * @class BI.SimpleStateEditor * @extends BI.Single */ -BI.SimpleStateEditor = BI.inherit(BI.Single, { +BI.SimpleStateEditor = BI.inherit(BI.Widget, { _defaultConfig: function () { var conf = BI.SimpleStateEditor.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { @@ -6659,7 +6520,7 @@ BI.shortcut("bi.simple_state_editor", BI.SimpleStateEditor);/** * @class BI.TextEditor * @extends BI.Single */ -BI.TextEditor = BI.inherit(BI.Single, { +BI.TextEditor = BI.inherit(BI.Widget, { _defaultConfig: function () { var conf = BI.TextEditor.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { diff --git a/bi/widget.js b/bi/widget.js index be01e50de..949ebc2b8 100644 --- a/bi/widget.js +++ b/bi/widget.js @@ -16811,7 +16811,7 @@ BI.YearTrigger = BI.inherit(BI.Trigger, { self.editor.setTitle(value); } self.fireEvent(BI.YearTrigger.EVENT_CONFIRM); - }) + }); this.editor.on(BI.SignEditor.EVENT_SPACE, function () { if (self.editor.isValid()) { self.editor.blur(); diff --git a/docs/case.js b/docs/case.js index cdf0cbe36..7b4c962e3 100644 --- a/docs/case.js +++ b/docs/case.js @@ -4903,167 +4903,6 @@ BI.DownListSelectTextTrigger = BI.inherit(BI.Trigger, { } }); BI.shortcut("bi.down_list_select_text_trigger", BI.DownListSelectTextTrigger);/** - * 根据内容自适应长度的输入框 - * @class BI.AdaptiveEditor - * @extends BI.Single - */ -BI.AdaptiveEditor = BI.inherit(BI.Single, { - _defaultConfig: function () { - var conf = BI.AdaptiveEditor.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - baseCls: (conf.baseCls || "") + " bi-adapt-editor", - hgap: 4, - vgap: 2, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0, - validationChecker: BI.emptyFn, - quitChecker: BI.emptyFn, - mouseOut: false, - allowBlank: true, - watermark: "", - errorText: "", - height: 30 - }) - }, - - _init: function () { - BI.AdaptiveEditor.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.editor = BI.createWidget({ - type: "bi.sign_editor", - element: this, - height: o.height, - hgap: o.hgap, - vgap: o.vgap, - lgap: o.lgap, - rgap: o.rgap, - tgap: o.tgap, - bgap: o.bgap, - value: o.value, - validationChecker: o.validationChecker, - quitChecker: o.quitChecker, - mouseOut: o.mouseOut, - allowBlank: o.allowBlank, - watermark: o.watermark, - errorText: o.errorText - }); - - this.editor.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.editor.on(BI.SignEditor.EVENT_FOCUS, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_FOCUS); - }); - this.editor.on(BI.SignEditor.EVENT_BLUR, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_BLUR); - }); - this.editor.on(BI.SignEditor.EVENT_CLICK, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_CLICK); - }); - this.editor.on(BI.SignEditor.EVENT_CHANGE, function () { - self._checkEditorLength(); - self.fireEvent(BI.AdaptiveEditor.EVENT_CHANGE); - }); - this.editor.on(BI.SignEditor.EVENT_KEY_DOWN, function (v) { - self.fireEvent(BI.AdaptiveEditor.EVENT_KEY_DOWN); - }); - - this.editor.on(BI.SignEditor.EVENT_VALID, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_VALID); - }); - this.editor.on(BI.SignEditor.EVENT_CONFIRM, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_CONFIRM); - }); - this.editor.on(BI.SignEditor.EVENT_START, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_START); - }); - this.editor.on(BI.SignEditor.EVENT_PAUSE, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_PAUSE); - }); - this.editor.on(BI.Editor.EVENT_STOP, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_STOP); - }); - this.editor.on(BI.SignEditor.EVENT_SPACE, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_SPACE); - }); - this.editor.on(BI.SignEditor.EVENT_ERROR, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_ERROR); - }); - this.editor.on(BI.SignEditor.EVENT_ENTER, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_ENTER); - }); - this.editor.on(BI.SignEditor.EVENT_RESTRICT, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_RESTRICT); - }); - this.editor.on(BI.SignEditor.EVENT_EMPTY, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_EMPTY); - }); - this._checkEditorLength(); - }, - - _checkEditorLength: function () { - var o = this.options; - this.element.width(BI.DOM.getTextSizeWidth(this.getValue(), 14) + 2 * o.hgap + o.lgap + o.rgap); - }, - - focus: function () { - this.editor.focus(); - }, - - blur: function () { - this.editor.blur(); - }, - - isValid: function () { - return this.editor.isValid(); - }, - - setErrorText: function (text) { - this.editor.setErrorText(text); - }, - - getErrorText: function () { - return this.editor.getErrorText(); - }, - - setValue: function (k) { - this.editor.setValue(k); - this._checkEditorLength(); - }, - - getValue: function () { - return this.editor.getValue(); - }, - - getState: function () { - return this.editor.getState(); - }, - - setState: function (v) { - - } -}); -BI.AdaptiveEditor.EVENT_CHANGE = "EVENT_CHANGE"; -BI.AdaptiveEditor.EVENT_FOCUS = "EVENT_FOCUS"; -BI.AdaptiveEditor.EVENT_BLUR = "EVENT_BLUR"; -BI.AdaptiveEditor.EVENT_CLICK = "EVENT_CLICK"; -BI.AdaptiveEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; -BI.AdaptiveEditor.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL"; - -BI.AdaptiveEditor.EVENT_START = "EVENT_START"; -BI.AdaptiveEditor.EVENT_PAUSE = "EVENT_PAUSE"; -BI.AdaptiveEditor.EVENT_STOP = "EVENT_STOP"; -BI.AdaptiveEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; -BI.AdaptiveEditor.EVENT_VALID = "EVENT_VALID"; -BI.AdaptiveEditor.EVENT_ERROR = "EVENT_ERROR"; -BI.AdaptiveEditor.EVENT_ENTER = "EVENT_ENTER"; -BI.AdaptiveEditor.EVENT_RESTRICT = "EVENT_RESTRICT"; -BI.AdaptiveEditor.EVENT_SPACE = "EVENT_SPACE"; -BI.AdaptiveEditor.EVENT_EMPTY = "EVENT_EMPTY"; - -BI.shortcut("bi.adapt_editor", BI.AdaptiveEditor);/** * 有清楚按钮的文本框 * Created by GUY on 2015/9/29. * @class BI.SmallTextEditor @@ -5406,7 +5245,7 @@ BI.SearchEditor = BI.inherit(BI.Widget, { setEnable: function (b) { BI.Editor.superclass.setEnable.apply(this, arguments); this.editor && this.editor.setEnable(b); - this.clear.setEnabled(b); + this.clear.setEnable(b); } }); BI.SearchEditor.EVENT_CHANGE = "EVENT_CHANGE"; @@ -5451,9 +5290,9 @@ BI.shortcut("bi.small_search_editor", BI.SmallSearchEditor);/** * 带标记的文本框 * Created by GUY on 2016/1/25. * @class BI.ShelterEditor - * @extends BI.Single + * @extends BI.Widget */ -BI.ShelterEditor = BI.inherit(BI.Single, { +BI.ShelterEditor = BI.inherit(BI.Widget, { _defaultConfig: function () { var conf = BI.ShelterEditor.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { @@ -5498,6 +5337,9 @@ BI.ShelterEditor = BI.inherit(BI.Single, { this.text = BI.createWidget({ type: "bi.text_button", cls: "shelter-editor-text", + title: o.title, + warningTitle: o.warningTitle, + tipType: o.tipType, textAlign: o.textAlign, height: o.height, hgap: 4 @@ -5603,6 +5445,14 @@ BI.ShelterEditor = BI.inherit(BI.Single, { this.text.visible(); }, + setTitle: function (title) { + this.text.setTitle(title); + }, + + setWarningTitle: function (title) { + this.text.setWarningTitle(title); + }, + focus: function () { this._showInput(); this.editor.focus(); @@ -5701,7 +5551,7 @@ BI.shortcut("bi.shelter_editor", BI.ShelterEditor);/** * @class BI.SignInitialEditor * @extends BI.Single */ -BI.SignInitialEditor = BI.inherit(BI.Single, { +BI.SignInitialEditor = BI.inherit(BI.Widget, { _defaultConfig: function () { var conf = BI.SignInitialEditor.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { @@ -5864,9 +5714,9 @@ BI.shortcut("bi.sign_initial_editor", BI.SignInitialEditor);/** * 带标记的文本框 * Created by GUY on 2015/8/28. * @class BI.SignEditor - * @extends BI.Single + * @extends BI.Widget */ -BI.SignEditor = BI.inherit(BI.Single, { +BI.SignEditor = BI.inherit(BI.Widget, { _defaultConfig: function () { var conf = BI.SignEditor.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { @@ -5910,6 +5760,9 @@ BI.SignEditor = BI.inherit(BI.Single, { this.text = BI.createWidget({ type: "bi.text_button", cls: "sign-editor-text", + title: o.title, + warningTitle: o.warningTitle, + tipType: o.tipType, textAlign: "left", height: o.height, hgap: 4, @@ -6020,6 +5873,14 @@ BI.SignEditor = BI.inherit(BI.Single, { this.text.visible(); }, + setTitle: function (title) { + this.text.setTitle(title); + }, + + setWarningTitle: function (title) { + this.text.setWarningTitle(title); + }, + focus: function () { this._showInput(); this.editor.focus(); @@ -6057,7 +5918,7 @@ BI.SignEditor = BI.inherit(BI.Single, { return this.editor.isValid(); }, - setValid: function(v){ + setValid: function (v) { BI.SignEditor.superclass.setValid.apply(this, arguments); this.editor.setValid(v); }, @@ -6120,7 +5981,7 @@ BI.shortcut("bi.sign_editor", BI.SignEditor);/** * @class BI.StateEditor * @extends BI.Single */ -BI.StateEditor = BI.inherit(BI.Single, { +BI.StateEditor = BI.inherit(BI.Widget, { _defaultConfig: function () { var conf = BI.StateEditor.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { @@ -6400,7 +6261,7 @@ BI.shortcut("bi.state_editor", BI.StateEditor);/** * @class BI.SimpleStateEditor * @extends BI.Single */ -BI.SimpleStateEditor = BI.inherit(BI.Single, { +BI.SimpleStateEditor = BI.inherit(BI.Widget, { _defaultConfig: function () { var conf = BI.SimpleStateEditor.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { @@ -6659,7 +6520,7 @@ BI.shortcut("bi.simple_state_editor", BI.SimpleStateEditor);/** * @class BI.TextEditor * @extends BI.Single */ -BI.TextEditor = BI.inherit(BI.Single, { +BI.TextEditor = BI.inherit(BI.Widget, { _defaultConfig: function () { var conf = BI.TextEditor.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { diff --git a/docs/widget.js b/docs/widget.js index be01e50de..949ebc2b8 100644 --- a/docs/widget.js +++ b/docs/widget.js @@ -16811,7 +16811,7 @@ BI.YearTrigger = BI.inherit(BI.Trigger, { self.editor.setTitle(value); } self.fireEvent(BI.YearTrigger.EVENT_CONFIRM); - }) + }); this.editor.on(BI.SignEditor.EVENT_SPACE, function () { if (self.editor.isValid()) { self.editor.blur(); diff --git a/src/case/editor/editor.adapt.js b/src/case/editor/editor.adapt.js deleted file mode 100644 index 5a358d261..000000000 --- a/src/case/editor/editor.adapt.js +++ /dev/null @@ -1,162 +0,0 @@ -/** - * 根据内容自适应长度的输入框 - * @class BI.AdaptiveEditor - * @extends BI.Single - */ -BI.AdaptiveEditor = BI.inherit(BI.Single, { - _defaultConfig: function () { - var conf = BI.AdaptiveEditor.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - baseCls: (conf.baseCls || "") + " bi-adapt-editor", - hgap: 4, - vgap: 2, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0, - validationChecker: BI.emptyFn, - quitChecker: BI.emptyFn, - mouseOut: false, - allowBlank: true, - watermark: "", - errorText: "", - height: 30 - }) - }, - - _init: function () { - BI.AdaptiveEditor.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.editor = BI.createWidget({ - type: "bi.sign_editor", - element: this, - height: o.height, - hgap: o.hgap, - vgap: o.vgap, - lgap: o.lgap, - rgap: o.rgap, - tgap: o.tgap, - bgap: o.bgap, - value: o.value, - validationChecker: o.validationChecker, - quitChecker: o.quitChecker, - mouseOut: o.mouseOut, - allowBlank: o.allowBlank, - watermark: o.watermark, - errorText: o.errorText - }); - - this.editor.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.editor.on(BI.SignEditor.EVENT_FOCUS, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_FOCUS); - }); - this.editor.on(BI.SignEditor.EVENT_BLUR, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_BLUR); - }); - this.editor.on(BI.SignEditor.EVENT_CLICK, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_CLICK); - }); - this.editor.on(BI.SignEditor.EVENT_CHANGE, function () { - self._checkEditorLength(); - self.fireEvent(BI.AdaptiveEditor.EVENT_CHANGE); - }); - this.editor.on(BI.SignEditor.EVENT_KEY_DOWN, function (v) { - self.fireEvent(BI.AdaptiveEditor.EVENT_KEY_DOWN); - }); - - this.editor.on(BI.SignEditor.EVENT_VALID, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_VALID); - }); - this.editor.on(BI.SignEditor.EVENT_CONFIRM, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_CONFIRM); - }); - this.editor.on(BI.SignEditor.EVENT_START, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_START); - }); - this.editor.on(BI.SignEditor.EVENT_PAUSE, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_PAUSE); - }); - this.editor.on(BI.Editor.EVENT_STOP, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_STOP); - }); - this.editor.on(BI.SignEditor.EVENT_SPACE, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_SPACE); - }); - this.editor.on(BI.SignEditor.EVENT_ERROR, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_ERROR); - }); - this.editor.on(BI.SignEditor.EVENT_ENTER, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_ENTER); - }); - this.editor.on(BI.SignEditor.EVENT_RESTRICT, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_RESTRICT); - }); - this.editor.on(BI.SignEditor.EVENT_EMPTY, function () { - self.fireEvent(BI.AdaptiveEditor.EVENT_EMPTY); - }); - this._checkEditorLength(); - }, - - _checkEditorLength: function () { - var o = this.options; - this.element.width(BI.DOM.getTextSizeWidth(this.getValue(), 14) + 2 * o.hgap + o.lgap + o.rgap); - }, - - focus: function () { - this.editor.focus(); - }, - - blur: function () { - this.editor.blur(); - }, - - isValid: function () { - return this.editor.isValid(); - }, - - setErrorText: function (text) { - this.editor.setErrorText(text); - }, - - getErrorText: function () { - return this.editor.getErrorText(); - }, - - setValue: function (k) { - this.editor.setValue(k); - this._checkEditorLength(); - }, - - getValue: function () { - return this.editor.getValue(); - }, - - getState: function () { - return this.editor.getState(); - }, - - setState: function (v) { - - } -}); -BI.AdaptiveEditor.EVENT_CHANGE = "EVENT_CHANGE"; -BI.AdaptiveEditor.EVENT_FOCUS = "EVENT_FOCUS"; -BI.AdaptiveEditor.EVENT_BLUR = "EVENT_BLUR"; -BI.AdaptiveEditor.EVENT_CLICK = "EVENT_CLICK"; -BI.AdaptiveEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; -BI.AdaptiveEditor.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL"; - -BI.AdaptiveEditor.EVENT_START = "EVENT_START"; -BI.AdaptiveEditor.EVENT_PAUSE = "EVENT_PAUSE"; -BI.AdaptiveEditor.EVENT_STOP = "EVENT_STOP"; -BI.AdaptiveEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; -BI.AdaptiveEditor.EVENT_VALID = "EVENT_VALID"; -BI.AdaptiveEditor.EVENT_ERROR = "EVENT_ERROR"; -BI.AdaptiveEditor.EVENT_ENTER = "EVENT_ENTER"; -BI.AdaptiveEditor.EVENT_RESTRICT = "EVENT_RESTRICT"; -BI.AdaptiveEditor.EVENT_SPACE = "EVENT_SPACE"; -BI.AdaptiveEditor.EVENT_EMPTY = "EVENT_EMPTY"; - -BI.shortcut("bi.adapt_editor", BI.AdaptiveEditor); \ No newline at end of file diff --git a/src/case/editor/editor.search.js b/src/case/editor/editor.search.js index d952ece8b..f4f5218eb 100644 --- a/src/case/editor/editor.search.js +++ b/src/case/editor/editor.search.js @@ -173,7 +173,7 @@ BI.SearchEditor = BI.inherit(BI.Widget, { setEnable: function (b) { BI.Editor.superclass.setEnable.apply(this, arguments); this.editor && this.editor.setEnable(b); - this.clear.setEnabled(b); + this.clear.setEnable(b); } }); BI.SearchEditor.EVENT_CHANGE = "EVENT_CHANGE"; diff --git a/src/case/editor/editor.shelter.js b/src/case/editor/editor.shelter.js index 6e79a6198..2990219a0 100644 --- a/src/case/editor/editor.shelter.js +++ b/src/case/editor/editor.shelter.js @@ -2,9 +2,9 @@ * 带标记的文本框 * Created by GUY on 2016/1/25. * @class BI.ShelterEditor - * @extends BI.Single + * @extends BI.Widget */ -BI.ShelterEditor = BI.inherit(BI.Single, { +BI.ShelterEditor = BI.inherit(BI.Widget, { _defaultConfig: function () { var conf = BI.ShelterEditor.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { @@ -49,6 +49,9 @@ BI.ShelterEditor = BI.inherit(BI.Single, { this.text = BI.createWidget({ type: "bi.text_button", cls: "shelter-editor-text", + title: o.title, + warningTitle: o.warningTitle, + tipType: o.tipType, textAlign: o.textAlign, height: o.height, hgap: 4 @@ -154,6 +157,14 @@ BI.ShelterEditor = BI.inherit(BI.Single, { this.text.visible(); }, + setTitle: function (title) { + this.text.setTitle(title); + }, + + setWarningTitle: function (title) { + this.text.setWarningTitle(title); + }, + focus: function () { this._showInput(); this.editor.focus(); diff --git a/src/case/editor/editor.sign.initial.js b/src/case/editor/editor.sign.initial.js index 9729e217f..fd73ca179 100644 --- a/src/case/editor/editor.sign.initial.js +++ b/src/case/editor/editor.sign.initial.js @@ -3,7 +3,7 @@ * @class BI.SignInitialEditor * @extends BI.Single */ -BI.SignInitialEditor = BI.inherit(BI.Single, { +BI.SignInitialEditor = BI.inherit(BI.Widget, { _defaultConfig: function () { var conf = BI.SignInitialEditor.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { diff --git a/src/case/editor/editor.sign.js b/src/case/editor/editor.sign.js index cad205dce..13e39bc73 100644 --- a/src/case/editor/editor.sign.js +++ b/src/case/editor/editor.sign.js @@ -2,9 +2,9 @@ * 带标记的文本框 * Created by GUY on 2015/8/28. * @class BI.SignEditor - * @extends BI.Single + * @extends BI.Widget */ -BI.SignEditor = BI.inherit(BI.Single, { +BI.SignEditor = BI.inherit(BI.Widget, { _defaultConfig: function () { var conf = BI.SignEditor.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { @@ -48,6 +48,9 @@ BI.SignEditor = BI.inherit(BI.Single, { this.text = BI.createWidget({ type: "bi.text_button", cls: "sign-editor-text", + title: o.title, + warningTitle: o.warningTitle, + tipType: o.tipType, textAlign: "left", height: o.height, hgap: 4, @@ -158,6 +161,14 @@ BI.SignEditor = BI.inherit(BI.Single, { this.text.visible(); }, + setTitle: function (title) { + this.text.setTitle(title); + }, + + setWarningTitle: function (title) { + this.text.setWarningTitle(title); + }, + focus: function () { this._showInput(); this.editor.focus(); @@ -195,7 +206,7 @@ BI.SignEditor = BI.inherit(BI.Single, { return this.editor.isValid(); }, - setValid: function(v){ + setValid: function (v) { BI.SignEditor.superclass.setValid.apply(this, arguments); this.editor.setValid(v); }, diff --git a/src/case/editor/editor.state.js b/src/case/editor/editor.state.js index f3f003673..129bd274b 100644 --- a/src/case/editor/editor.state.js +++ b/src/case/editor/editor.state.js @@ -4,7 +4,7 @@ * @class BI.StateEditor * @extends BI.Single */ -BI.StateEditor = BI.inherit(BI.Single, { +BI.StateEditor = BI.inherit(BI.Widget, { _defaultConfig: function () { var conf = BI.StateEditor.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { diff --git a/src/case/editor/editor.state.simple.js b/src/case/editor/editor.state.simple.js index 522f1c740..f343a8cda 100644 --- a/src/case/editor/editor.state.simple.js +++ b/src/case/editor/editor.state.simple.js @@ -4,7 +4,7 @@ * @class BI.SimpleStateEditor * @extends BI.Single */ -BI.SimpleStateEditor = BI.inherit(BI.Single, { +BI.SimpleStateEditor = BI.inherit(BI.Widget, { _defaultConfig: function () { var conf = BI.SimpleStateEditor.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { diff --git a/src/case/editor/editor.text.js b/src/case/editor/editor.text.js index 4a6194c93..ad8cc8789 100644 --- a/src/case/editor/editor.text.js +++ b/src/case/editor/editor.text.js @@ -3,7 +3,7 @@ * @class BI.TextEditor * @extends BI.Single */ -BI.TextEditor = BI.inherit(BI.Single, { +BI.TextEditor = BI.inherit(BI.Widget, { _defaultConfig: function () { var conf = BI.TextEditor.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { diff --git a/src/widget/year/trigger.year.js b/src/widget/year/trigger.year.js index e7ab93c22..38cd15fa6 100644 --- a/src/widget/year/trigger.year.js +++ b/src/widget/year/trigger.year.js @@ -53,7 +53,7 @@ BI.YearTrigger = BI.inherit(BI.Trigger, { self.editor.setTitle(value); } self.fireEvent(BI.YearTrigger.EVENT_CONFIRM); - }) + }); this.editor.on(BI.SignEditor.EVENT_SPACE, function () { if (self.editor.isValid()) { self.editor.blur();