Browse Source

Pull request #2505: 无JIRA任务 chore: 优化一下

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit '4924f09d15d06c90198428de8bfaddb5fae4a2a4':
  chore: 优化一下
  chore: 优化一下
es6
guy 3 years ago
parent
commit
c6851ec4a9
  1. 61
      src/case/combo/bubblecombo/popup.bubble.js

61
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,19 @@ 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 () { _defaultConfig: function () {
return { var config = BI.TextBubblePopupBarView.superclass._defaultConfig.apply(this, arguments);
baseCls: "bi-text-bubble-bar-popup-view", return BI.extend(config, {
baseCls: config.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 +124,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