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. 73
      src/case/combo/bubblecombo/popup.bubble.js

73
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,66 +104,29 @@ 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", type: "bi.label",
primary: o.primary, text: o.text,
showArrow: o.showArrow, whiteSpace: "normal",
minWidth: o.minWidth, textAlign: "left",
maxWidth: o.maxWidth,
minHeight: o.minHeight,
ref: function () { ref: function () {
self.popup = this; self.text = this;
}, }
el: {
type: "bi.label",
text: o.text,
whiteSpace: "normal",
textAlign: "left",
ref: function () {
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