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.
 
 
 

85 lines
2.5 KiB

/**
* 月份下拉框
*
* Created by GUY on 2015/8/28.
* @class BI.MonthCombo
* @extends BI.Trigger
*/
BI.MonthCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MonthCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-month-combo",
behaviors: {},
height: 25
});
},
_init: function () {
BI.MonthCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.month_trigger"
});
this.trigger.on(BI.MonthTrigger.EVENT_CONFIRM, function (v) {
if (self.combo.isViewVisible()) {
return;
}
if (this.getKey() && this.getKey() !== self.storeValue) {
self.setValue(this.getValue());
} else if (!this.getKey()) {
self.setValue();
}
self.fireEvent(BI.MonthCombo.EVENT_CONFIRM);
});
this.trigger.on(BI.MonthTrigger.EVENT_FOCUS, function () {
self.storeValue = this.getKey();
});
this.trigger.on(BI.MonthTrigger.EVENT_START, function () {
self.combo.hideView();
});
this.trigger.on(BI.MonthTrigger.EVENT_STOP, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.popup = BI.createWidget({
type: "bi.month_popup",
behaviors: o.behaviors
});
this.popup.on(BI.MonthPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.MonthCombo.EVENT_CONFIRM);
});
this.combo = BI.createWidget({
type: "bi.combo",
element: this,
isNeedAdjustHeight: false,
isNeedAdjustWidth: false,
el: this.trigger,
popup: {
minWidth: 85,
el: this.popup
}
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.MonthCombo.EVENT_BEFORE_POPUPVIEW);
});
},
setValue: function (v) {
this.trigger.setValue(v);
this.popup.setValue(v);
},
getValue: function () {
return this.popup.getValue();
}
});
BI.MonthCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.MonthCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut('bi.month_combo', BI.MonthCombo);