|
@ -2,7 +2,7 @@ import * as React from 'react'; |
|
|
import RcSlider from 'rc-slider/lib/Slider'; |
|
|
import RcSlider from 'rc-slider/lib/Slider'; |
|
|
import RcRange from 'rc-slider/lib/Range'; |
|
|
import RcRange from 'rc-slider/lib/Range'; |
|
|
import RcHandle from 'rc-slider/lib/Handle'; |
|
|
import RcHandle from 'rc-slider/lib/Handle'; |
|
|
import Tooltip from '../tooltip'; |
|
|
import Tooltip, { TooltipPlacement } from '../tooltip'; |
|
|
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider'; |
|
|
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider'; |
|
|
|
|
|
|
|
|
export interface SliderMarks { |
|
|
export interface SliderMarks { |
|
@ -48,6 +48,7 @@ export interface SliderProps { |
|
|
id?: string; |
|
|
id?: string; |
|
|
style?: React.CSSProperties; |
|
|
style?: React.CSSProperties; |
|
|
tooltipVisible?: boolean; |
|
|
tooltipVisible?: boolean; |
|
|
|
|
|
tooltipPlacement?: TooltipPlacement; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export interface SliderState { |
|
|
export interface SliderState { |
|
@ -82,7 +83,7 @@ export default class Slider extends React.Component<SliderProps, SliderState> { |
|
|
tooltipPrefixCls: string, |
|
|
tooltipPrefixCls: string, |
|
|
{ value, dragging, index, ...restProps }, |
|
|
{ value, dragging, index, ...restProps }, |
|
|
) => { |
|
|
) => { |
|
|
const { tipFormatter, tooltipVisible } = this.props; |
|
|
const { tipFormatter, tooltipVisible, tooltipPlacement } = this.props; |
|
|
const { visibles } = this.state; |
|
|
const { visibles } = this.state; |
|
|
const isTipFormatter = tipFormatter ? visibles[index] || dragging : false; |
|
|
const isTipFormatter = tipFormatter ? visibles[index] || dragging : false; |
|
|
const visible = tooltipVisible || (tooltipVisible === undefined && isTipFormatter); |
|
|
const visible = tooltipVisible || (tooltipVisible === undefined && isTipFormatter); |
|
@ -91,7 +92,7 @@ export default class Slider extends React.Component<SliderProps, SliderState> { |
|
|
prefixCls={tooltipPrefixCls} |
|
|
prefixCls={tooltipPrefixCls} |
|
|
title={tipFormatter ? tipFormatter(value) : ''} |
|
|
title={tipFormatter ? tipFormatter(value) : ''} |
|
|
visible={visible} |
|
|
visible={visible} |
|
|
placement="top" |
|
|
placement={tooltipPlacement || 'top'} |
|
|
transitionName="zoom-down" |
|
|
transitionName="zoom-down" |
|
|
key={index} |
|
|
key={index} |
|
|
> |
|
|
> |
|
|