From 67e8d96f4de25a9929809c732135c48b67dc99cb Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Fri, 2 Feb 2018 14:47:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E8=8C=83=E5=B8=A6text=E7=9A=84bubble?= =?UTF-8?q?=5Fpopup=5Fview?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/js/case/combo/demo.bubble_combo.js | 29 ++++----- dist/bundle.js | 72 +++++++++++++++++++++- dist/case.js | 72 +++++++++++++++++++++- dist/demo.js | 29 ++++----- dist/fineui.js | 72 +++++++++++++++++++++- src/case/combo/bubblecombo/popup.bubble.js | 72 +++++++++++++++++++++- 6 files changed, 310 insertions(+), 36 deletions(-) diff --git a/demo/js/case/combo/demo.bubble_combo.js b/demo/js/case/combo/demo.bubble_combo.js index 4fd1dc7c6..c314e0724 100644 --- a/demo/js/case/combo/demo.bubble_combo.js +++ b/demo/js/case/combo/demo.bubble_combo.js @@ -4,7 +4,7 @@ Demo.Func = BI.inherit(BI.Widget, { }, render: function () { - var self = this; + var self = this, count = 1; var combo1 = BI.createWidget({ type: "bi.bubble_combo", trigger: "click,hover", @@ -36,21 +36,18 @@ Demo.Func = BI.inherit(BI.Widget, { height: 25 }, popup: { - type: "bi.bubble_bar_popup_view", - el: { - type: "bi.button_group", - items: BI.makeArray(100, { - type: "bi.text_item", - height: 25, - text: "item" - }), - layouts: [{ - type: "bi.vertical" - }] - }, - maxHeight: 200, - minWidth: 600 - } + type: "bi.text_bubble_bar_popup_view", + text: "我有很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字", + ref: function () { + self.popup = this; + } + }, + listeners: [{ + eventName: BI.BubbleCombo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.popup.populate((count++) % 2 === 1 ? "我的文字变少了" : "我有很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字"); + } + }] }); BI.createWidget({ type: "bi.absolute", diff --git a/dist/bundle.js b/dist/bundle.js index f1dc9bdf0..30d4e2feb 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -67645,7 +67645,77 @@ BI.BubblePopupBarView = BI.inherit(BI.BubblePopupView, { } }); BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON = "EVENT_CLICK_TOOLBAR_BUTTON"; -BI.shortcut("bi.bubble_bar_popup_view", BI.BubblePopupBarView);/** +BI.shortcut("bi.bubble_bar_popup_view", BI.BubblePopupBarView); + +/** + * Created by Windy on 2018/2/2. + * + * @class BI.TextBubblePopupBarView + * @extends BI.BubblePopupView + */ +BI.TextBubblePopupBarView = BI.inherit(BI.Widget, { + + props: { + baseCls: "bi-text-bubble-bar-popup-view", + text: "", + width: 250 + }, + + render: function(){ + var self = this, o = this.options; + return { + type: "bi.bubble_bar_popup_view", + ref: function () { + self.popup = this; + }, + el: { + type: "bi.vertical", + items: [{ + type: "bi.label", + text: o.text, + whiteSpace: "normal", + textAlign: "left", + ref: function () { + self.text = this; + } + }], + hgap: 10, + tgap: 25, + bgap: 10 + }, + buttons: [{ + type: "bi.button", + value: BI.i18nText("BI-Basic_Sure"), + height: 24, + handler: function () { + self.fireEvent(BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, true); + } + }, { + type: "bi.button", + value: BI.i18nText("BI-Basic_Cancel"), + level: "ignore", + height: 24, + handler: function () { + self.fireEvent(BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, false); + } + }] + } + }, + + populate: function (v) { + this.text.setText(v || this.options.text); + }, + + showLine: function (direction) { + this.popup.showLine(direction); + }, + + hideLine: function () { + this.popup.hideLine(); + } +}); +BI.TextBubblePopupBarView.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.text_bubble_bar_popup_view", BI.TextBubblePopupBarView);/** * Created by Young's on 2016/4/28. */ BI.EditorIconCheckCombo = BI.inherit(BI.Widget, { diff --git a/dist/case.js b/dist/case.js index 6cce5be11..ca10b94ba 100644 --- a/dist/case.js +++ b/dist/case.js @@ -5076,7 +5076,77 @@ BI.BubblePopupBarView = BI.inherit(BI.BubblePopupView, { } }); BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON = "EVENT_CLICK_TOOLBAR_BUTTON"; -BI.shortcut("bi.bubble_bar_popup_view", BI.BubblePopupBarView);/** +BI.shortcut("bi.bubble_bar_popup_view", BI.BubblePopupBarView); + +/** + * Created by Windy on 2018/2/2. + * + * @class BI.TextBubblePopupBarView + * @extends BI.BubblePopupView + */ +BI.TextBubblePopupBarView = BI.inherit(BI.Widget, { + + props: { + baseCls: "bi-text-bubble-bar-popup-view", + text: "", + width: 250 + }, + + render: function(){ + var self = this, o = this.options; + return { + type: "bi.bubble_bar_popup_view", + ref: function () { + self.popup = this; + }, + el: { + type: "bi.vertical", + items: [{ + type: "bi.label", + text: o.text, + whiteSpace: "normal", + textAlign: "left", + ref: function () { + self.text = this; + } + }], + hgap: 10, + tgap: 25, + bgap: 10 + }, + buttons: [{ + type: "bi.button", + value: BI.i18nText("BI-Basic_Sure"), + height: 24, + handler: function () { + self.fireEvent(BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, true); + } + }, { + type: "bi.button", + value: BI.i18nText("BI-Basic_Cancel"), + level: "ignore", + height: 24, + handler: function () { + self.fireEvent(BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, false); + } + }] + } + }, + + populate: function (v) { + this.text.setText(v || this.options.text); + }, + + showLine: function (direction) { + this.popup.showLine(direction); + }, + + hideLine: function () { + this.popup.hideLine(); + } +}); +BI.TextBubblePopupBarView.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.text_bubble_bar_popup_view", BI.TextBubblePopupBarView);/** * Created by Young's on 2016/4/28. */ BI.EditorIconCheckCombo = BI.inherit(BI.Widget, { diff --git a/dist/demo.js b/dist/demo.js index 51f869c04..74a5ed21c 100644 --- a/dist/demo.js +++ b/dist/demo.js @@ -1766,7 +1766,7 @@ BI.shortcut("demo.tree_view", Demo.Func);Demo.Func = BI.inherit(BI.Widget, { }, render: function () { - var self = this; + var self = this, count = 1; var combo1 = BI.createWidget({ type: "bi.bubble_combo", trigger: "click,hover", @@ -1798,21 +1798,18 @@ BI.shortcut("demo.tree_view", Demo.Func);Demo.Func = BI.inherit(BI.Widget, { height: 25 }, popup: { - type: "bi.bubble_bar_popup_view", - el: { - type: "bi.button_group", - items: BI.makeArray(100, { - type: "bi.text_item", - height: 25, - text: "item" - }), - layouts: [{ - type: "bi.vertical" - }] - }, - maxHeight: 200, - minWidth: 600 - } + type: "bi.text_bubble_bar_popup_view", + text: "我有很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字", + ref: function () { + self.popup = this; + } + }, + listeners: [{ + eventName: BI.BubbleCombo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.popup.populate((count++) % 2 === 1 ? "我的文字变少了" : "我有很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字"); + } + }] }); BI.createWidget({ type: "bi.absolute", diff --git a/dist/fineui.js b/dist/fineui.js index fcaa5762e..3ec68aadc 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -69409,7 +69409,77 @@ BI.BubblePopupBarView = BI.inherit(BI.BubblePopupView, { } }); BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON = "EVENT_CLICK_TOOLBAR_BUTTON"; -BI.shortcut("bi.bubble_bar_popup_view", BI.BubblePopupBarView);/** +BI.shortcut("bi.bubble_bar_popup_view", BI.BubblePopupBarView); + +/** + * Created by Windy on 2018/2/2. + * + * @class BI.TextBubblePopupBarView + * @extends BI.BubblePopupView + */ +BI.TextBubblePopupBarView = BI.inherit(BI.Widget, { + + props: { + baseCls: "bi-text-bubble-bar-popup-view", + text: "", + width: 250 + }, + + render: function(){ + var self = this, o = this.options; + return { + type: "bi.bubble_bar_popup_view", + ref: function () { + self.popup = this; + }, + el: { + type: "bi.vertical", + items: [{ + type: "bi.label", + text: o.text, + whiteSpace: "normal", + textAlign: "left", + ref: function () { + self.text = this; + } + }], + hgap: 10, + tgap: 25, + bgap: 10 + }, + buttons: [{ + type: "bi.button", + value: BI.i18nText("BI-Basic_Sure"), + height: 24, + handler: function () { + self.fireEvent(BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, true); + } + }, { + type: "bi.button", + value: BI.i18nText("BI-Basic_Cancel"), + level: "ignore", + height: 24, + handler: function () { + self.fireEvent(BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, false); + } + }] + } + }, + + populate: function (v) { + this.text.setText(v || this.options.text); + }, + + showLine: function (direction) { + this.popup.showLine(direction); + }, + + hideLine: function () { + this.popup.hideLine(); + } +}); +BI.TextBubblePopupBarView.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.text_bubble_bar_popup_view", BI.TextBubblePopupBarView);/** * Created by Young's on 2016/4/28. */ BI.EditorIconCheckCombo = BI.inherit(BI.Widget, { diff --git a/src/case/combo/bubblecombo/popup.bubble.js b/src/case/combo/bubblecombo/popup.bubble.js index ca729c76b..eacf3e5f1 100644 --- a/src/case/combo/bubblecombo/popup.bubble.js +++ b/src/case/combo/bubblecombo/popup.bubble.js @@ -115,4 +115,74 @@ BI.BubblePopupBarView = BI.inherit(BI.BubblePopupView, { } }); BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON = "EVENT_CLICK_TOOLBAR_BUTTON"; -BI.shortcut("bi.bubble_bar_popup_view", BI.BubblePopupBarView); \ No newline at end of file +BI.shortcut("bi.bubble_bar_popup_view", BI.BubblePopupBarView); + +/** + * Created by Windy on 2018/2/2. + * + * @class BI.TextBubblePopupBarView + * @extends BI.BubblePopupView + */ +BI.TextBubblePopupBarView = BI.inherit(BI.Widget, { + + props: { + baseCls: "bi-text-bubble-bar-popup-view", + text: "", + width: 250 + }, + + render: function(){ + var self = this, o = this.options; + return { + type: "bi.bubble_bar_popup_view", + ref: function () { + self.popup = this; + }, + el: { + type: "bi.vertical", + items: [{ + type: "bi.label", + text: o.text, + whiteSpace: "normal", + textAlign: "left", + ref: function () { + self.text = this; + } + }], + hgap: 10, + tgap: 25, + bgap: 10 + }, + buttons: [{ + type: "bi.button", + value: BI.i18nText("BI-Basic_Sure"), + height: 24, + handler: function () { + self.fireEvent(BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, true); + } + }, { + type: "bi.button", + value: BI.i18nText("BI-Basic_Cancel"), + level: "ignore", + height: 24, + handler: function () { + self.fireEvent(BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, false); + } + }] + } + }, + + populate: function (v) { + this.text.setText(v || this.options.text); + }, + + showLine: function (direction) { + this.popup.showLine(direction); + }, + + hideLine: function () { + this.popup.hideLine(); + } +}); +BI.TextBubblePopupBarView.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.text_bubble_bar_popup_view", BI.TextBubblePopupBarView); \ No newline at end of file