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.

107 lines
2.6 KiB

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