fineui是帆软报表和BI产品线所使用的前端框架。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
2.6 KiB

8 years ago
/**
* guy
* 气泡提示
* @class BI.Bubble
* @extends BI.Tip
* @type {*|void|Object}
*/
BI.Bubble = BI.inherit(BI.Tip, {
7 years ago
_defaultConfig: function () {
8 years ago
return BI.extend(BI.Bubble.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-bubble",
direction: "top",
text: "",
level: "error",
8 years ago
height: 35
7 years ago
});
8 years ago
},
7 years ago
_init: function () {
8 years ago
BI.Bubble.superclass._init.apply(this, arguments);
var fn = function (e) {
e.stopPropagation();
e.stopEvent();
return false;
};
7 years ago
this.element.bind({click: fn, mousedown: fn, mouseup: fn, mouseover: fn, mouseenter: fn, mouseleave: fn, mousemove: fn});
8 years ago
BI.createWidget({
type: "bi.left",
8 years ago
element: this,
8 years ago
items: [this["_" + this.options.direction]()]
7 years ago
});
8 years ago
},
7 years ago
_createBubbleText: function () {
var o = this.options;
8 years ago
return (this.text = BI.createWidget({
type: "bi.label",
cls: "bubble-text" + (" bubble-" + o.level),
text: o.text,
8 years ago
hgap: 10,
height: 30
}));
},
7 years ago
_top: function () {
8 years ago
return BI.createWidget({
type: "bi.vertical",
items: [{
el: this._createBubbleText(),
height: 30
}, {
el: {
type: "bi.layout"
},
height: 3
}]
7 years ago
});
8 years ago
},
7 years ago
_bottom: function () {
8 years ago
return BI.createWidget({
type: "bi.vertical",
items: [{
el: {
type: "bi.layout"
},
height: 3
}, {
el: this._createBubbleText(),
height: 30
}]
7 years ago
});
8 years ago
},
7 years ago
_left: function () {
8 years ago
return BI.createWidget({
type: "bi.right",
items: [{
el: {
type: "bi.layout",
width: 3,
height: 30
}
}, {
el: this._createBubbleText()
}]
7 years ago
});
8 years ago
},
7 years ago
_right: function () {
8 years ago
return BI.createWidget({
8 years ago
type: "bi.left",
8 years ago
items: [{
el: {
type: "bi.layout",
width: 3,
height: 30
}
}, {
el: this._createBubbleText()
}]
7 years ago
});
8 years ago
},
7 years ago
setText: function (text) {
8 years ago
this.text.setText(text);
}
});
8 years ago
BI.shortcut("bi.bubble", BI.Bubble);