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.

129 lines
3.2 KiB

/**
* Created by Urthur on 2017/9/4.
*/
Demo.Slider = BI.inherit(BI.Widget, {
7 years ago
props: {
7 years ago
baseCls: "demo-slider",
width: 300,
height: 50,
min: 0,
max: 100
},
7 years ago
7 years ago
render: function () {
7 years ago
var self = this, o = this.options;
7 years ago
var singleSlider = BI.createWidget({
type: "bi.single_slider",
digit: 0,
7 years ago
width: o.width,
height: o.height,
7 years ago
cls: "layout-bg-white"
});
7 years ago
singleSlider.setMinAndMax({
min: 10,
7 years ago
max: o.max
7 years ago
});
singleSlider.setValue(30);
7 years ago
singleSlider.populate();
singleSlider.on(BI.SingleSlider.EVENT_CHANGE, function () {
console.log(this.getValue());
});
7 years ago
var normalSingleSlider = BI.createWidget({
type: "bi.single_slider_normal",
7 years ago
width: o.width,
7 years ago
height: 30,
7 years ago
cls: "layout-bg-white"
7 years ago
});
7 years ago
normalSingleSlider.setMinAndMax({
7 years ago
min: o.min,
max: o.max
7 years ago
});
normalSingleSlider.setValue(10);
7 years ago
normalSingleSlider.populate();
7 years ago
var singleSliderLabel = BI.createWidget({
type: "bi.single_slider_label",
7 years ago
width: o.width,
height: o.height,
digit: 0,
unit: "个",
cls: "layout-bg-white"
});
singleSliderLabel.setMinAndMax({
min: o.min,
max: o.max
});
singleSliderLabel.setValue(10);
singleSliderLabel.populate();
7 years ago
var intervalSlider = BI.createWidget({
type: "bi.interval_slider",
7 years ago
width: o.width,
7 years ago
digit: 0,
7 years ago
cls: "layout-bg-white"
});
intervalSlider.setMinAndMax({
7 years ago
min: o.min,
max: o.max
7 years ago
});
intervalSlider.setValue({
min: 10,
max: 120
});
intervalSlider.populate();
var intervalSliderLabel = BI.createWidget({
7 years ago
type: "bi.interval_slider",
7 years ago
width: o.width,
unit: "px",
cls: "layout-bg-white",
7 years ago
digit: 1
7 years ago
});
intervalSliderLabel.setMinAndMax({
min: 0,
max: 120
});
intervalSliderLabel.setValue({
min: 10,
max: 120
});
intervalSliderLabel.populate();
7 years ago
return {
7 years ago
type: "bi.vertical",
7 years ago
element: this,
items: [{
7 years ago
type: "bi.center_adapt",
items: [{
el: singleSlider
}]
}, {
type: "bi.center_adapt",
items: [{
el: normalSingleSlider
}]
}, {
type: "bi.center_adapt",
items: [{
el: singleSliderLabel
}]
7 years ago
}, {
7 years ago
type: "bi.center_adapt",
items: [{
el: intervalSlider
}]
}, {
7 years ago
type: "bi.center_adapt",
items: [{
el: intervalSliderLabel
}]
7 years ago
}],
7 years ago
vgap: 20
7 years ago
};
}
});
BI.shortcut("demo.slider", Demo.Slider);