Browse Source

chore: 优化一下

es6
guy 3 years ago
parent
commit
77c20346c7
  1. 52
      src/case/combo/bubblecombo/popup.bubble.js

52
src/case/combo/bubblecombo/popup.bubble.js

@ -39,9 +39,7 @@ BI.BubblePopupBarView = BI.inherit(BI.BubblePopupView, {
}] }]
}); });
}, },
_init: function () {
BI.BubblePopupBarView.superclass._init.apply(this, arguments);
},
_createToolBar: function () { _createToolBar: function () {
var o = this.options, self = this; var o = this.options, self = this;
@ -74,12 +72,16 @@ BI.BubblePopupBarView = BI.inherit(BI.BubblePopupView, {
}); });
}, },
_createContent: function () {
return this.options.el;
},
_createView: function () { _createView: function () {
var o = this.options; var o = this.options;
var button = BI.createWidget({ var button = BI.createWidget({
type: "bi.button_group", type: "bi.button_group",
items: [o.el], items: [this._createContent()],
layouts: [{ layouts: [{
type: "bi.vertical", type: "bi.vertical",
cls: "bar-popup-container", cls: "bar-popup-container",
@ -102,51 +104,18 @@ BI.shortcut("bi.bubble_bar_popup_view", BI.BubblePopupBarView);
* @class BI.TextBubblePopupBarView * @class BI.TextBubblePopupBarView
* @extends BI.BubblePopupView * @extends BI.BubblePopupView
*/ */
BI.TextBubblePopupBarView = BI.inherit(BI.Widget, { BI.TextBubblePopupBarView = BI.inherit(BI.BubblePopupBarView, {
props: function () { props: function () {
return { return {
baseCls: "bi-text-bubble-bar-popup-view", baseCls: "bi-text-bubble-bar-popup-view",
text: "", text: "",
buttons: [{
level: "ignore",
value: false,
stopPropagation: true,
text: BI.i18nText("BI-Basic_Cancel")
}, {
value: true,
stopPropagation: true,
text: BI.i18nText("BI-Basic_OK")
}]
}; };
}, },
render: function () { _createContent: function () {
var self = this, o = this.options; var self = this, o = this.options;
var buttons = BI.map(o.buttons, function (index, buttonOpt) {
if (BI.isWidget(buttonOpt)) {
return buttonOpt;
}
return BI.extend({
type: "bi.button",
height: 24,
handler: function (v) {
self.fireEvent(BI.TextBubblePopupBarView.EVENT_CHANGE, v);
}
}, buttonOpt);
});
return { return {
type: "bi.bubble_bar_popup_view",
primary: o.primary,
showArrow: o.showArrow,
minWidth: o.minWidth,
maxWidth: o.maxWidth,
minHeight: o.minHeight,
ref: function () {
self.popup = this;
},
el: {
type: "bi.label", type: "bi.label",
text: o.text, text: o.text,
whiteSpace: "normal", whiteSpace: "normal",
@ -154,14 +123,9 @@ BI.TextBubblePopupBarView = BI.inherit(BI.Widget, {
ref: function () { ref: function () {
self.text = this; self.text = this;
} }
},
buttons: buttons
}; };
}, },
setDirection: function (direction, position) {
this.popup.setDirection(direction, position);
},
populate: function (v) { populate: function (v) {
this.text.setText(v || this.options.text); this.text.setText(v || this.options.text);
} }

Loading…
Cancel
Save