mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-02 07:39:36 +08:00
46 lines
1.0 KiB
TypeScript
46 lines
1.0 KiB
TypeScript
import React from 'react';
|
|
import { PropTypes } from 'react';
|
|
import RcSlider from 'rc-slider';
|
|
|
|
export interface SliderMarks {
|
|
[key: number]: React.ReactNode | {
|
|
style: React.CSSProperties,
|
|
label: React.ReactNode,
|
|
};
|
|
}
|
|
|
|
export type SliderValue = number | [number, number];
|
|
|
|
export interface SliderProps {
|
|
range?: boolean;
|
|
min?: number;
|
|
max?: number;
|
|
step?: number | void;
|
|
marks?: SliderMarks;
|
|
dots?: boolean;
|
|
value?: SliderValue;
|
|
defaultValue?: SliderValue;
|
|
included?: boolean;
|
|
disabled?: boolean;
|
|
onChange?: (value: SliderValue) => void;
|
|
onAfterChange?: (value: SliderValue) => void;
|
|
tipFormatter?: void | ((value: number) => React.ReactNode);
|
|
}
|
|
|
|
export default class Slider extends React.Component<SliderProps, any> {
|
|
static defaultProps = {
|
|
prefixCls: 'ant-slider',
|
|
tooltipPrefixCls: 'ant-tooltip',
|
|
tipTransitionName: 'zoom-down',
|
|
};
|
|
|
|
static propTypes = {
|
|
prefixCls: PropTypes.string,
|
|
tipTransitionName: PropTypes.string,
|
|
};
|
|
|
|
render() {
|
|
return <RcSlider {...this.props} />;
|
|
}
|
|
}
|