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.

68 lines
1.8 KiB

8 years ago
/**
* Created by zcf on 2016/9/22.
*/
8 years ago
BI.SliderIconButton = BI.inherit(BI.Widget, {
7 years ago
props: {
baseCls: "bi-single-slider-button"
8 years ago
},
7 years ago
constants: {
LARGE_SIZE: 16,
NORMAL_SIZE: 12,
LARGE_OFFSET: 4,
NORMAL_OFFSET: 6
},
render: function () {
var self = this;
return {
8 years ago
type: "bi.absolute",
7 years ago
ref: function () {
self.wrapper = this;
},
8 years ago
items: [{
7 years ago
el: {
type: "bi.text_button",
cls: "slider-button",
height: this.constants.NORMAL_SIZE,
width: this.constants.NORMAL_SIZE,
ref: function () {
self.slider = this;
}
},
top: this.constants.NORMAL_OFFSET,
left: -8
8 years ago
}],
width: 0,
7 years ago
height: this.constants.NORMAL_SIZE
};
},
mounted: function () {
var self = this;
this.slider.element.hover(function () {
self._enlarge();
}, function () {
self._normalize();
8 years ago
});
7 years ago
},
_enlarge: function () {
this.slider.setWidth(this.constants.LARGE_SIZE);
this.slider.setHeight(this.constants.LARGE_SIZE);
this.wrapper.attr("items")[0].top = this.constants.LARGE_OFFSET;
this.wrapper.attr("items")[0].left = -10;
this.wrapper.resize();
},
_normalize: function () {
this.slider.setWidth(this.constants.NORMAL_SIZE);
this.slider.setHeight(this.constants.NORMAL_SIZE);
this.wrapper.attr("items")[0].top = this.constants.NORMAL_OFFSET;
this.wrapper.attr("items")[0].left = -8;
this.wrapper.resize();
8 years ago
}
});
8 years ago
BI.shortcut("bi.single_slider_button", BI.SliderIconButton);