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.

77 lines
2.0 KiB

8 years ago
/**
* 带有标题栏的pane
* @class BI.Panel
* @extends BI.Widget
*/
7 years ago
BI.Panel = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.Panel.superclass._defaultConfig.apply(this, arguments), {
8 years ago
baseCls: "bi-panel bi-border",
7 years ago
title: "",
titleHeight: 30,
7 years ago
titleButtons: [],
el: {},
3 years ago
// logic: {
// dynamic: false
// }
8 years ago
});
},
3 years ago
render: function () {
return {
type: "bi.vertical_fill",
rowSize: ["", "fill"],
items: [this._createTitle(), this.options.el]
};
8 years ago
},
7 years ago
_createTitle: function () {
8 years ago
var self = this, o = this.options;
this.text = BI.createWidget({
type: "bi.label",
cls: "panel-title-text",
text: o.title,
height: o.titleHeight
8 years ago
});
this.button_group = BI.createWidget({
7 years ago
type: "bi.button_group",
8 years ago
items: o.titleButtons,
layouts: [{
type: "bi.center_adapt",
7 years ago
lgap: 10
8 years ago
}]
});
7 years ago
this.button_group.on(BI.Controller.EVENT_CHANGE, function () {
8 years ago
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
7 years ago
this.button_group.on(BI.ButtonGroup.EVENT_CHANGE, function (value, obj) {
8 years ago
self.fireEvent(BI.Panel.EVENT_CHANGE, value, obj);
});
return {
3 years ago
// el: {
type: "bi.left_right_vertical_adapt",
cls: "panel-title bi-header-background bi-border-bottom",
height: BI.toPix(o.titleHeight, 1),
items: {
left: [this.text],
right: [this.button_group]
8 years ago
},
3 years ago
lhgap: 10,
rhgap: 10
// },
// height: BI.toPix(o.titleHeight, 1)
8 years ago
};
},
7 years ago
setTitle: function (title) {
8 years ago
this.text.setValue(title);
}
});
BI.Panel.EVENT_CHANGE = "EVENT_CHANGE";
8 years ago
7 years ago
BI.shortcut("bi.panel", BI.Panel);