2016-09-21 11:54:53 +08:00
|
|
|
import React from 'react';
|
2016-08-10 09:46:56 +08:00
|
|
|
import { PropTypes } from 'react';
|
2016-03-21 09:22:14 +08:00
|
|
|
import RcSlider from 'rc-slider';
|
2016-08-10 09:46:56 +08:00
|
|
|
|
2016-09-13 15:31:29 +08:00
|
|
|
export interface SliderMarks {
|
2016-08-10 09:46:56 +08:00
|
|
|
[key: number]: React.ReactNode | {
|
|
|
|
style: React.CSSProperties,
|
|
|
|
label: React.ReactNode,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-09-13 15:31:29 +08:00
|
|
|
export type SliderValue = number | [number, number];
|
2016-08-10 09:46:56 +08:00
|
|
|
|
|
|
|
export interface SliderProps {
|
|
|
|
range?: boolean;
|
|
|
|
min?: number;
|
|
|
|
max?: number;
|
|
|
|
step?: number | void;
|
|
|
|
marks?: SliderMarks;
|
|
|
|
dots?: boolean;
|
|
|
|
value?: SliderValue;
|
|
|
|
defaultValue?: SliderValue;
|
|
|
|
included?: boolean;
|
|
|
|
disabled?: boolean;
|
2016-09-09 13:55:46 +08:00
|
|
|
onChange?: (value: SliderValue) => void;
|
|
|
|
onAfterChange?: (value: SliderValue) => void;
|
2016-08-10 09:46:56 +08:00
|
|
|
tipFormatter?: void | ((value: number) => React.ReactNode);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default class Slider extends React.Component<SliderProps, any> {
|
2016-03-29 14:01:10 +08:00
|
|
|
static defaultProps = {
|
|
|
|
prefixCls: 'ant-slider',
|
2016-09-18 10:12:21 +08:00
|
|
|
tooltipPrefixCls: 'ant-tooltip',
|
2016-05-11 09:32:33 +08:00
|
|
|
tipTransitionName: 'zoom-down',
|
2016-07-13 11:14:24 +08:00
|
|
|
};
|
2016-03-29 14:01:10 +08:00
|
|
|
|
2016-08-10 09:46:56 +08:00
|
|
|
static propTypes = {
|
|
|
|
prefixCls: PropTypes.string,
|
|
|
|
tipTransitionName: PropTypes.string,
|
|
|
|
};
|
|
|
|
|
2015-07-13 08:00:31 +08:00
|
|
|
render() {
|
2016-09-09 13:55:46 +08:00
|
|
|
return <RcSlider {...this.props} />;
|
2015-07-13 08:00:31 +08:00
|
|
|
}
|
2016-03-21 09:22:14 +08:00
|
|
|
}
|