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.

81 lines
2.0 KiB

import { shortcut, Widget, extend, toPix, Controller, createWidget } from "@/core";
import { ButtonGroup } from "@/base";
@shortcut()
export class Panel extends Widget {
static xtype = "bi.panel"
static EVENT_CHANGE = "EVENT_CHANGE"
_defaultConfig() {
return extend(super._defaultConfig(...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
});
}
8 years ago
render() {
3 years ago
return {
type: "bi.vertical_fill",
rowSize: ["", "fill"],
items: [this._createTitle(), this.options.el],
3 years ago
};
}
8 years ago
_createTitle() {
const o = this.options;
this.text = createWidget({
8 years ago
type: "bi.label",
cls: "panel-title-text",
text: o.title,
height: o.titleHeight,
8 years ago
});
this.button_group = createWidget({
7 years ago
type: "bi.button_group",
8 years ago
items: o.titleButtons,
layouts: [{
type: "bi.center_adapt",
lgap: 10,
}],
8 years ago
});
this.button_group.on(Controller.EVENT_CHANGE, (...args) => {
this.fireEvent(Controller.EVENT_CHANGE, ...args);
8 years ago
});
this.button_group.on(ButtonGroup.EVENT_CHANGE, (value, obj) => {
this.fireEvent(Panel.EVENT_CHANGE, value, obj);
8 years ago
});
return {
3 years ago
// el: {
type: "bi.left_right_vertical_adapt",
cls: "panel-title bi-header-background bi-border-bottom",
height: toPix(o.titleHeight, 1),
3 years ago
items: {
left: [this.text],
right: [this.button_group],
8 years ago
},
3 years ago
lhgap: 10,
rhgap: 10,
3 years ago
// },
// height: toPix(o.titleHeight, 1)
8 years ago
};
}
8 years ago
setTitle(title) {
8 years ago
this.text.setValue(title);
}
}