From b935fcf5a6a5010220dae09d987e4a842dc42924 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 20 Apr 2017 17:16:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0image.button.href?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bi/widget.js | 64 ++++++++++++++++++ docs/widget.js | 64 ++++++++++++++++++ .../image/button/href/image.button.href.js | 65 +++++++++++++++++++ 3 files changed, 193 insertions(+) create mode 100644 src/widget/image/button/href/image.button.href.js diff --git a/bi/widget.js b/bi/widget.js index 979eb7808..5e956c4aa 100644 --- a/bi/widget.js +++ b/bi/widget.js @@ -7121,6 +7121,70 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, { }); BI.FineTuningNumberEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.shortcut("bi.fine_tuning_number_editor", BI.FineTuningNumberEditor);/** + * Created by GameJian on 2016/1/28. + */ +BI.ImageButtonHref = BI.inherit(BI.Single, { + + _defaultConfig: function () { + return BI.extend(BI.ImageButtonHref.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-image-button-href", + title: BI.i18nText("BI-Add_Href") + }) + }, + + _init: function () { + BI.ImageButtonHref.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget({ + type: "bi.icon_button", + cls: "img-href-font", + title: o.title, + height: 24, + width: 24 + }); + + this.input = BI.createWidget({ + type: "bi.clear_editor", + watermark: BI.i18nText("BI-Input_Href"), + width: 255, + height: 30 + }); + this.input.on(BI.ClearEditor.EVENT_CONFIRM, function () { + self.combo.hideView(); + }); + + this.combo = BI.createWidget({ + type: "bi.combo", + element: this, + direction: "bottom,left", + adjustYOffset: 3, + el: this.trigger, + popup: { + el: this.input, + stopPropagation: false, + minWidth: 255 + } + }); + + this.combo.on(BI.Combo.EVENT_AFTER_POPUPVIEW, function () { + self.input.focus() + }); + + this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () { + self.fireEvent(BI.ImageButtonHref.EVENT_CHANGE, arguments) + }) + }, + + getValue: function () { + return this.input.getValue(); + }, + + setValue: function (url) { + this.input.setValue(url) + } +}); +BI.ImageButtonHref.EVENT_CHANGE = "BI.ImageButtonHref.EVENT_CHANGE"; +BI.shortcut("bi.image_button_href", BI.ImageButtonHref);/** * 交互行为布局 * * diff --git a/docs/widget.js b/docs/widget.js index 979eb7808..5e956c4aa 100644 --- a/docs/widget.js +++ b/docs/widget.js @@ -7121,6 +7121,70 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, { }); BI.FineTuningNumberEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.shortcut("bi.fine_tuning_number_editor", BI.FineTuningNumberEditor);/** + * Created by GameJian on 2016/1/28. + */ +BI.ImageButtonHref = BI.inherit(BI.Single, { + + _defaultConfig: function () { + return BI.extend(BI.ImageButtonHref.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-image-button-href", + title: BI.i18nText("BI-Add_Href") + }) + }, + + _init: function () { + BI.ImageButtonHref.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget({ + type: "bi.icon_button", + cls: "img-href-font", + title: o.title, + height: 24, + width: 24 + }); + + this.input = BI.createWidget({ + type: "bi.clear_editor", + watermark: BI.i18nText("BI-Input_Href"), + width: 255, + height: 30 + }); + this.input.on(BI.ClearEditor.EVENT_CONFIRM, function () { + self.combo.hideView(); + }); + + this.combo = BI.createWidget({ + type: "bi.combo", + element: this, + direction: "bottom,left", + adjustYOffset: 3, + el: this.trigger, + popup: { + el: this.input, + stopPropagation: false, + minWidth: 255 + } + }); + + this.combo.on(BI.Combo.EVENT_AFTER_POPUPVIEW, function () { + self.input.focus() + }); + + this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () { + self.fireEvent(BI.ImageButtonHref.EVENT_CHANGE, arguments) + }) + }, + + getValue: function () { + return this.input.getValue(); + }, + + setValue: function (url) { + this.input.setValue(url) + } +}); +BI.ImageButtonHref.EVENT_CHANGE = "BI.ImageButtonHref.EVENT_CHANGE"; +BI.shortcut("bi.image_button_href", BI.ImageButtonHref);/** * 交互行为布局 * * diff --git a/src/widget/image/button/href/image.button.href.js b/src/widget/image/button/href/image.button.href.js new file mode 100644 index 000000000..41d44369d --- /dev/null +++ b/src/widget/image/button/href/image.button.href.js @@ -0,0 +1,65 @@ +/** + * Created by GameJian on 2016/1/28. + */ +BI.ImageButtonHref = BI.inherit(BI.Single, { + + _defaultConfig: function () { + return BI.extend(BI.ImageButtonHref.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-image-button-href", + title: BI.i18nText("BI-Add_Href") + }) + }, + + _init: function () { + BI.ImageButtonHref.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget({ + type: "bi.icon_button", + cls: "img-href-font", + title: o.title, + height: 24, + width: 24 + }); + + this.input = BI.createWidget({ + type: "bi.clear_editor", + watermark: BI.i18nText("BI-Input_Href"), + width: 255, + height: 30 + }); + this.input.on(BI.ClearEditor.EVENT_CONFIRM, function () { + self.combo.hideView(); + }); + + this.combo = BI.createWidget({ + type: "bi.combo", + element: this, + direction: "bottom,left", + adjustYOffset: 3, + el: this.trigger, + popup: { + el: this.input, + stopPropagation: false, + minWidth: 255 + } + }); + + this.combo.on(BI.Combo.EVENT_AFTER_POPUPVIEW, function () { + self.input.focus() + }); + + this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () { + self.fireEvent(BI.ImageButtonHref.EVENT_CHANGE, arguments) + }) + }, + + getValue: function () { + return this.input.getValue(); + }, + + setValue: function (url) { + this.input.setValue(url) + } +}); +BI.ImageButtonHref.EVENT_CHANGE = "BI.ImageButtonHref.EVENT_CHANGE"; +BI.shortcut("bi.image_button_href", BI.ImageButtonHref); \ No newline at end of file