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.

128 lines
3.4 KiB

import { shortcut, Widget, createWidget } from "@/core";
import { SingleSlider, SingleSliderNormal } from "@/widget";
7 years ago
@shortcut()
export class Slider extends Widget {
static xtype = "demo.slider";
props = { baseCls: "demo-slider", width: 300, height: 50, min: 0, max: 100 };
render() {
const self = this,
o = this.options;
const singleSlider = createWidget({
7 years ago
type: "bi.single_slider",
digit: 0,
7 years ago
width: o.width,
height: o.height,
cls: "layout-bg-white",
value: 30,
7 years ago
min: 10,
max: 100,
7 years ago
});
singleSlider.on(SingleSlider.EVENT_CHANGE, function () {
console.log(this.getValue());
});
7 years ago
const normalSingleSlider = createWidget({
7 years ago
type: "bi.single_slider_normal",
7 years ago
width: o.width,
7 years ago
height: 30,
cls: "layout-bg-white",
7 years ago
min: o.min,
max: o.max,
value: 30,
});
normalSingleSlider.on(SingleSliderNormal.EVENT_DRAG, function () {
console.log(this.getValue());
7 years ago
});
7 years ago
const singleSliderLabel = createWidget({
type: "bi.single_slider_label",
7 years ago
width: o.width,
height: o.height,
digit: 0,
unit: "个",
cls: "layout-bg-white",
7 years ago
min: o.min,
max: o.max,
value: 10,
7 years ago
});
7 years ago
const intervalSlider = createWidget({
7 years ago
type: "bi.interval_slider",
7 years ago
width: o.width,
7 years ago
digit: 0,
cls: "layout-bg-white",
7 years ago
min: o.min,
max: o.max,
value: {
min: 10,
max: 70,
},
7 years ago
});
const intervalSliderLabel = createWidget({
7 years ago
type: "bi.interval_slider",
7 years ago
width: o.width,
unit: "px",
cls: "layout-bg-white",
digit: 1,
7 years ago
min: 0,
max: 120,
value: {
min: 60,
max: 120,
},
7 years ago
});
7 years ago
return {
7 years ago
type: "bi.vertical",
7 years ago
element: this,
items: [
{
type: "bi.center_adapt",
items: [
{
el: singleSlider,
}
],
},
{
type: "bi.center_adapt",
items: [
{
el: normalSingleSlider,
}
],
},
{
type: "bi.center_adapt",
items: [
{
el: singleSliderLabel,
}
],
},
{
type: "bi.center_adapt",
items: [
{
el: intervalSlider,
}
],
},
{
type: "bi.center_adapt",
items: [
{
el: intervalSliderLabel,
}
],
}
],
vgap: 20,
7 years ago
};
}
}