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.

88 lines
2.8 KiB

/**
* 季度下拉框
*
* Created by GUY on 2015/8/28.
* @class BI.QuarterCombo
* @extends BI.Widget
*/
BI.QuarterCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.QuarterCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-quarter-combo",
8 years ago
behaviors: {},
height: 25
});
},
_init: function () {
BI.QuarterCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.storeValue = "";
this.trigger = BI.createWidget({
type: "bi.quarter_trigger"
});
this.trigger.on(BI.QuarterTrigger.EVENT_FOCUS, function () {
self.storeValue = this.getKey();
});
this.trigger.on(BI.QuarterTrigger.EVENT_CHANGE, function () {
self.combo.isViewVisible() && self.combo.hideView();
});
this.trigger.on(BI.QuarterTrigger.EVENT_START, function () {
self.combo.isViewVisible() && self.combo.hideView();
});
8 years ago
this.trigger.on(BI.QuarterTrigger.EVENT_STOP, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.trigger.on(BI.QuarterTrigger.EVENT_CONFIRM, function () {
8 years ago
if (self.combo.isViewVisible()) {
return;
}
8 years ago
if (this.getKey() && this.getKey() !== self.storeValue) {
self.setValue(this.getKey());
8 years ago
} else if (!this.getKey()) {
self.setValue();
}
self.fireEvent(BI.QuarterCombo.EVENT_CONFIRM);
});
this.popup = BI.createWidget({
8 years ago
type: "bi.quarter_popup",
behaviors: o.behaviors
});
this.popup.on(BI.QuarterPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.QuarterCombo.EVENT_CONFIRM);
});
this.combo = BI.createWidget({
type: "bi.combo",
element: this,
isNeedAdjustHeight: false,
isNeedAdjustWidth: false,
el: this.trigger,
popup: {
minWidth: 85,
el: this.popup
}
});
8 years ago
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW);
});
},
setValue: function (v) {
this.trigger.setValue(v);
this.popup.setValue(v);
},
getValue: function () {
return this.popup.getValue() || "";
}
});
BI.QuarterCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
8 years ago
BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
8 years ago
BI.shortcut('bi.quarter_combo', BI.QuarterCombo);