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.

60 lines
1.4 KiB

import { BasicButton } from "./button.basic";
import { shortcut, extend, Controller } from "../../../core";
8 years ago
/**
* 表示一个可以展开的节点, 不仅有选中状态而且有展开状态
*
* Created by GUY on 2015/9/9.
* @class NodeButton
* @extends BasicButton
8 years ago
* @abstract
*/
@shortcut()
export class NodeButton extends BasicButton {
static xtype = "bi.node_button";
_defaultConfig() {
const conf = super._defaultConfig(arguments);
return extend(conf, {
_baseCls: `${conf._baseCls || ""} bi-node`,
open: false,
once: false,
7 years ago
});
}
8 years ago
_initRef() {
3 years ago
if (this.isOpened()) {
this.setOpened(this.isOpened());
}
super._initRef(...arguments);
}
8 years ago
doClick() {
super.doClick(...arguments);
8 years ago
this.setOpened(!this.isOpened());
}
8 years ago
isOpened() {
8 years ago
return !!this.options.open;
}
8 years ago
setOpened(b) {
8 years ago
this.options.open = !!b;
}
8 years ago
triggerCollapse() {
3 years ago
if (this.isOpened()) {
8 years ago
this.setOpened(false);
this.fireEvent(Controller.EVENT_CHANGE, BI.Events.COLLAPSE, this.getValue(), this);
8 years ago
}
}
8 years ago
triggerExpand() {
3 years ago
if (!this.isOpened()) {
8 years ago
this.setOpened(true);
this.fireEvent(Controller.EVENT_CHANGE, BI.Events.EXPAND, this.getValue(), this);
8 years ago
}
}
}