Merge branch 'master' of https://github.com/vueComponent/ant-design
						commit
						1f09801ef9
					
				| 
						 | 
				
			
			@ -0,0 +1,54 @@
 | 
			
		|||
import Slider from '../index'
 | 
			
		||||
import Tooltip from '../../vc-tooltip'
 | 
			
		||||
import '../assets/index.less'
 | 
			
		||||
import '../../vc-tooltip/assets/bootstrap.less'
 | 
			
		||||
 | 
			
		||||
const { createSliderWithTooltip, Handle } = Slider
 | 
			
		||||
const Range = createSliderWithTooltip(Slider.Range)
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  data () {
 | 
			
		||||
    return {
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  render () {
 | 
			
		||||
    const handle = (props) => {
 | 
			
		||||
      const { value, dragging, index, refStr, ...restProps } = props
 | 
			
		||||
      const handleProps = {
 | 
			
		||||
        props: {
 | 
			
		||||
          ...restProps,
 | 
			
		||||
          value,
 | 
			
		||||
        },
 | 
			
		||||
        attrs: {
 | 
			
		||||
          refStr,
 | 
			
		||||
        },
 | 
			
		||||
        key: index,
 | 
			
		||||
      }
 | 
			
		||||
      return (
 | 
			
		||||
        <Tooltip
 | 
			
		||||
          prefixCls='rc-slider-tooltip'
 | 
			
		||||
          overlay={value}
 | 
			
		||||
          visible={dragging}
 | 
			
		||||
          placement='top'
 | 
			
		||||
          key={index}
 | 
			
		||||
        >
 | 
			
		||||
          <Handle {...handleProps} />
 | 
			
		||||
        </Tooltip>
 | 
			
		||||
      )
 | 
			
		||||
    }
 | 
			
		||||
    const wrapperStyle = 'width: 400px; margin: 50px'
 | 
			
		||||
 | 
			
		||||
    return (
 | 
			
		||||
      <div>
 | 
			
		||||
        <div style={wrapperStyle}>
 | 
			
		||||
          <p>Slider with custom handle</p>
 | 
			
		||||
          <Slider min={0} max={20} defaultValue={3} handle={handle} />
 | 
			
		||||
        </div>
 | 
			
		||||
        {/* <div style={wrapperStyle}>
 | 
			
		||||
          <p>Range with custom handle</p>
 | 
			
		||||
          <Range min={0} max={20} defaultValue={[3, 10]} tipFormatter={value => `${value}%`} />
 | 
			
		||||
        </div> */}
 | 
			
		||||
      </div>
 | 
			
		||||
    )
 | 
			
		||||
  },
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
import Slider from './src/'
 | 
			
		||||
export default Slider
 | 
			
		||||
| 
						 | 
				
			
			@ -1,8 +1,6 @@
 | 
			
		|||
 | 
			
		||||
import classNames from 'classnames'
 | 
			
		||||
import PropTypes from '../../../_util/vue-types'
 | 
			
		||||
import addEventListener from '../../../_util/Dom/addEventListener'
 | 
			
		||||
import BaseMixin from '../../../_util/BaseMixin'
 | 
			
		||||
import PropTypes from '../../_util/vue-types'
 | 
			
		||||
import addEventListener from '../../_util/Dom/addEventListener'
 | 
			
		||||
import BaseMixin from '../../_util/BaseMixin'
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  mixins: [BaseMixin],
 | 
			
		||||
| 
						 | 
				
			
			@ -15,6 +13,7 @@ export default {
 | 
			
		|||
    max: PropTypes.number,
 | 
			
		||||
    value: PropTypes.number,
 | 
			
		||||
    tabIndex: PropTypes.number,
 | 
			
		||||
    refStr: PropTypes.any,
 | 
			
		||||
  },
 | 
			
		||||
  data () {
 | 
			
		||||
    return {
 | 
			
		||||
| 
						 | 
				
			
			@ -24,6 +23,7 @@ export default {
 | 
			
		|||
  mounted () {
 | 
			
		||||
    this.$nextTick(() => {
 | 
			
		||||
      this.onMouseUpListener = addEventListener(document, 'mouseup', this.handleMouseUp)
 | 
			
		||||
      this.refStr = this.$props.refStr
 | 
			
		||||
    })
 | 
			
		||||
  },
 | 
			
		||||
  beforeDestroy () {
 | 
			
		||||
| 
						 | 
				
			
			@ -61,14 +61,13 @@ export default {
 | 
			
		|||
  },
 | 
			
		||||
  render () {
 | 
			
		||||
    const {
 | 
			
		||||
      prefixCls, vertical, offset, disabled, min, max, value, tabIndex, ...restProps
 | 
			
		||||
      prefixCls, vertical, offset, disabled, min, max, value, tabIndex, refStr, ...restProps
 | 
			
		||||
    } = this.$props
 | 
			
		||||
 | 
			
		||||
    const className = classNames(
 | 
			
		||||
      {
 | 
			
		||||
        [`${prefixCls}-handle-click-focused`]: this.clickFocused,
 | 
			
		||||
      }
 | 
			
		||||
    )
 | 
			
		||||
    const className = {
 | 
			
		||||
      [`${prefixCls}-handle`]: true,
 | 
			
		||||
      [`${prefixCls}-handle-click-focused`]: this.clickFocused,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const postionStyle = vertical ? { bottom: `${offset}%` } : { left: `${offset}%` }
 | 
			
		||||
    const elStyle = {
 | 
			
		||||
| 
						 | 
				
			
			@ -84,18 +83,25 @@ export default {
 | 
			
		|||
        'aria-disabled': !!disabled,
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const handleProps = {
 | 
			
		||||
      attrs: {
 | 
			
		||||
        role: 'slider',
 | 
			
		||||
        tabIndex: disabled ? null : (tabIndex || 0),
 | 
			
		||||
        refStr,
 | 
			
		||||
        ...ariaProps,
 | 
			
		||||
        ...restProps,
 | 
			
		||||
      },
 | 
			
		||||
      style: elStyle,
 | 
			
		||||
      class: className,
 | 
			
		||||
      on: {
 | 
			
		||||
        blur: this.handleBlur,
 | 
			
		||||
        keydown: this.handleKeyDown,
 | 
			
		||||
      },
 | 
			
		||||
      ref: 'handle',
 | 
			
		||||
    }
 | 
			
		||||
    return (
 | 
			
		||||
      <div
 | 
			
		||||
        ref='handle'
 | 
			
		||||
        role='slider'
 | 
			
		||||
        tabIndex= {disabled ? null : (tabIndex || 0)}
 | 
			
		||||
        {...ariaProps}
 | 
			
		||||
        {...restProps}
 | 
			
		||||
        class={className}
 | 
			
		||||
        style={elStyle}
 | 
			
		||||
        onBlur={this.handleBlur}
 | 
			
		||||
        onKeydown={this.handleKeyDown}
 | 
			
		||||
        {...handleProps}
 | 
			
		||||
      />
 | 
			
		||||
    )
 | 
			
		||||
  },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
import classNames from 'classnames'
 | 
			
		||||
import PropTypes from '../../../_util/vue-types'
 | 
			
		||||
import BaseMixin from '../../../_util/BaseMixin'
 | 
			
		||||
import { initDefaultProps, hasProp } from '../../../_util/props-util'
 | 
			
		||||
import PropTypes from '../../_util/vue-types'
 | 
			
		||||
import BaseMixin from '../../_util/BaseMixin'
 | 
			
		||||
import { initDefaultProps, hasProp } from '../../_util/props-util'
 | 
			
		||||
import Track from './common/Track'
 | 
			
		||||
import createSlider from './common/createSlider'
 | 
			
		||||
import * as utils from './utils'
 | 
			
		||||
| 
						 | 
				
			
			@ -334,7 +334,7 @@ const Range = {
 | 
			
		|||
      max,
 | 
			
		||||
      disabled,
 | 
			
		||||
      style: handleStyle[i],
 | 
			
		||||
      ref: h => this.saveHandle(i, h),
 | 
			
		||||
      refStr: 'handleRef' + i,
 | 
			
		||||
    }))
 | 
			
		||||
 | 
			
		||||
    const tracks = bounds.slice(0, -1).map((_, index) => {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
import PropTypes from '../../../_util/vue-types'
 | 
			
		||||
import warning from '../../../_util/warning'
 | 
			
		||||
import BaseMixin from '../../../_util/BaseMixin'
 | 
			
		||||
import { hasProp } from '../../../_util/props-util'
 | 
			
		||||
import PropTypes from '../../_util/vue-types'
 | 
			
		||||
import warning from '../../_util/warning'
 | 
			
		||||
import BaseMixin from '../../_util/BaseMixin'
 | 
			
		||||
import { hasProp } from '../../_util/props-util'
 | 
			
		||||
import Track from './common/Track'
 | 
			
		||||
import createSlider from './common/createSlider'
 | 
			
		||||
import * as utils from './utils'
 | 
			
		||||
| 
						 | 
				
			
			@ -136,6 +136,21 @@ const Slider = {
 | 
			
		|||
      const val = utils.ensureValueInRange(v, mergedProps)
 | 
			
		||||
      return utils.ensureValuePrecision(val, mergedProps)
 | 
			
		||||
    },
 | 
			
		||||
    getTrack ({ prefixCls, vertical, included, offset, minimumTrackStyle, _trackStyle }) {
 | 
			
		||||
      return (
 | 
			
		||||
        <Track
 | 
			
		||||
          class={`${prefixCls}-track`}
 | 
			
		||||
          vertical={vertical}
 | 
			
		||||
          included={included}
 | 
			
		||||
          offset={0}
 | 
			
		||||
          length={offset}
 | 
			
		||||
          style={{
 | 
			
		||||
            ...minimumTrackStyle,
 | 
			
		||||
            ..._trackStyle,
 | 
			
		||||
          }}
 | 
			
		||||
        />
 | 
			
		||||
      )
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  render () {
 | 
			
		||||
    const {
 | 
			
		||||
| 
						 | 
				
			
			@ -151,14 +166,13 @@ const Slider = {
 | 
			
		|||
      max,
 | 
			
		||||
      handle: handleGenerator,
 | 
			
		||||
    } = this
 | 
			
		||||
    const { value, dragging } = this.state
 | 
			
		||||
    const offset = this.calcOffset(value)
 | 
			
		||||
    const { sValue, dragging } = this
 | 
			
		||||
    const offset = this.calcOffset(sValue)
 | 
			
		||||
    const handle = handleGenerator({
 | 
			
		||||
      className: `${prefixCls}-handle`,
 | 
			
		||||
      prefixCls,
 | 
			
		||||
      vertical,
 | 
			
		||||
      offset,
 | 
			
		||||
      value,
 | 
			
		||||
      value: sValue,
 | 
			
		||||
      dragging,
 | 
			
		||||
      disabled,
 | 
			
		||||
      min,
 | 
			
		||||
| 
						 | 
				
			
			@ -166,24 +180,14 @@ const Slider = {
 | 
			
		|||
      index: 0,
 | 
			
		||||
      tabIndex,
 | 
			
		||||
      style: handleStyle[0] || handleStyle,
 | 
			
		||||
      ref: h => this.saveHandle(0, h),
 | 
			
		||||
      refStr: 'handleRef0',
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    const _trackStyle = trackStyle[0] || trackStyle
 | 
			
		||||
    const track = (
 | 
			
		||||
      <Track
 | 
			
		||||
        class={`${prefixCls}-track`}
 | 
			
		||||
        vertical={vertical}
 | 
			
		||||
        included={included}
 | 
			
		||||
        offset={0}
 | 
			
		||||
        length={offset}
 | 
			
		||||
        style={{
 | 
			
		||||
          ...minimumTrackStyle,
 | 
			
		||||
          ..._trackStyle,
 | 
			
		||||
        }}
 | 
			
		||||
      />
 | 
			
		||||
    )
 | 
			
		||||
    return { tracks: track, handles: handle }
 | 
			
		||||
    return {
 | 
			
		||||
      tracks: this.getTrack({ prefixCls, vertical, included, offset, minimumTrackStyle, _trackStyle }),
 | 
			
		||||
      handles: handle,
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,7 +20,7 @@ const Steps = {
 | 
			
		|||
  functional: true,
 | 
			
		||||
  render (createElement, context) {
 | 
			
		||||
    const { prefixCls, vertical, marks, dots, step, included,
 | 
			
		||||
      lowerBound, upperBound, max, min, dotStyle, activeDotStyle } = context.data
 | 
			
		||||
      lowerBound, upperBound, max, min, dotStyle, activeDotStyle } = context.props
 | 
			
		||||
    const range = max - min
 | 
			
		||||
    const elements = calcPoints(vertical, marks, dots, step, min, max).map((point) => {
 | 
			
		||||
      const offset = `${Math.abs(point - min) / range * 100}%`
 | 
			
		||||
| 
						 | 
				
			
			@ -37,10 +37,10 @@ const Steps = {
 | 
			
		|||
        [`${prefixCls}-dot-active`]: isActived,
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
      return <span className={pointClassName} style={style} key={point} />
 | 
			
		||||
      return <span class={pointClassName} style={style} key={point} />
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    return <div className={`${prefixCls}-step`}>{elements}</div>
 | 
			
		||||
    return <div class={`${prefixCls}-step`}>{elements}</div>
 | 
			
		||||
  },
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,8 @@
 | 
			
		|||
const Track = {
 | 
			
		||||
  functional: true,
 | 
			
		||||
  render (createElement, context) {
 | 
			
		||||
    const { included, vertical, offset, length, style } = context.data
 | 
			
		||||
    const { included, vertical, offset, length } = context.props
 | 
			
		||||
    const { style, class: className } = context.data
 | 
			
		||||
 | 
			
		||||
    const positonStyle = vertical ? {
 | 
			
		||||
      bottom: `${offset}%`,
 | 
			
		||||
| 
						 | 
				
			
			@ -12,11 +13,11 @@ const Track = {
 | 
			
		|||
      width: `${length}%`,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    context.data.style = {
 | 
			
		||||
    const elStyle = {
 | 
			
		||||
      ...style,
 | 
			
		||||
      ...positonStyle,
 | 
			
		||||
    }
 | 
			
		||||
    return included ? createElement('div', context.data, context.children) : null
 | 
			
		||||
    return included ? <div class={className} style={elStyle} /> : null
 | 
			
		||||
  },
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,6 +34,7 @@ export default function createSlider (Component) {
 | 
			
		|||
    autoFocus: PropTypes.bool,
 | 
			
		||||
  }
 | 
			
		||||
  return {
 | 
			
		||||
    mixins: [Component],
 | 
			
		||||
    props: initDefaultProps(propTypes, {
 | 
			
		||||
      ...Component.defaultProps,
 | 
			
		||||
      prefixCls: 'rc-slider',
 | 
			
		||||
| 
						 | 
				
			
			@ -41,9 +42,18 @@ export default function createSlider (Component) {
 | 
			
		|||
      max: 100,
 | 
			
		||||
      step: 1,
 | 
			
		||||
      marks: {},
 | 
			
		||||
      handle ({ index, ...restProps }) {
 | 
			
		||||
      handle ({ index, refStr, ...restProps }) {
 | 
			
		||||
        delete restProps.dragging
 | 
			
		||||
        return <Handle {...restProps} key={index} />
 | 
			
		||||
        const handleProps = {
 | 
			
		||||
          props: {
 | 
			
		||||
            ...restProps,
 | 
			
		||||
          },
 | 
			
		||||
          attrs: {
 | 
			
		||||
            refStr,
 | 
			
		||||
          },
 | 
			
		||||
          key: index,
 | 
			
		||||
        }
 | 
			
		||||
        return <Handle {...handleProps} />
 | 
			
		||||
      },
 | 
			
		||||
      included: true,
 | 
			
		||||
      disabled: false,
 | 
			
		||||
| 
						 | 
				
			
			@ -65,7 +75,7 @@ export default function createSlider (Component) {
 | 
			
		|||
          step
 | 
			
		||||
        )
 | 
			
		||||
      }
 | 
			
		||||
      this.handlesRefs = {}
 | 
			
		||||
      this.handlesRefs = []
 | 
			
		||||
      return {}
 | 
			
		||||
    },
 | 
			
		||||
    beforeDestroy () {
 | 
			
		||||
| 
						 | 
				
			
			@ -78,9 +88,21 @@ export default function createSlider (Component) {
 | 
			
		|||
      this.$nextTick(() => {
 | 
			
		||||
        // Snapshot testing cannot handle refs, so be sure to null-check this.
 | 
			
		||||
        this.document = this.$refs.sliderRef && this.$refs.sliderRef.ownerDocument
 | 
			
		||||
        this.setHandleRefs()
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    methods: {
 | 
			
		||||
      setHandleRefs () {
 | 
			
		||||
        const refs = this.$refs.handleRef
 | 
			
		||||
        const children = Array.prototype.slice.call(refs.children)
 | 
			
		||||
        children.map((item) => {
 | 
			
		||||
          const refStr = item.getAttribute('refStr')
 | 
			
		||||
          if (refStr.indexOf('handleRef') > -1) {
 | 
			
		||||
            const handleArr = refStr.split('handleRef')
 | 
			
		||||
            this.handlesRefs[handleArr[1]] = item
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
      },
 | 
			
		||||
      onMouseDown (e) {
 | 
			
		||||
        if (e.button !== 0) { return }
 | 
			
		||||
        const isVertical = this.vertical
 | 
			
		||||
| 
						 | 
				
			
			@ -208,13 +230,10 @@ export default function createSlider (Component) {
 | 
			
		|||
        return nextValue
 | 
			
		||||
      },
 | 
			
		||||
      calcOffset (value) {
 | 
			
		||||
        const { min, max } = this.props
 | 
			
		||||
        const { min, max } = this
 | 
			
		||||
        const ratio = (value - min) / (max - min)
 | 
			
		||||
        return ratio * 100
 | 
			
		||||
      },
 | 
			
		||||
      saveHandle (index, handle) {
 | 
			
		||||
        this.handlesRefs[index] = handle
 | 
			
		||||
      },
 | 
			
		||||
      onClickMarkLabel (e, value) {
 | 
			
		||||
        e.stopPropagation()
 | 
			
		||||
        this.$emit('change', { value })
 | 
			
		||||
| 
						 | 
				
			
			@ -236,7 +255,7 @@ export default function createSlider (Component) {
 | 
			
		|||
        dotStyle,
 | 
			
		||||
        activeDotStyle,
 | 
			
		||||
      } = this
 | 
			
		||||
      const { tracks, handles } = super.render()
 | 
			
		||||
      const { tracks, handles } = Component.render.call(this)
 | 
			
		||||
 | 
			
		||||
      const sliderClassName = classNames(prefixCls, {
 | 
			
		||||
        [`${prefixCls}-with-marks`]: Object.keys(marks).length,
 | 
			
		||||
| 
						 | 
				
			
			@ -262,10 +281,10 @@ export default function createSlider (Component) {
 | 
			
		|||
        <div
 | 
			
		||||
          ref='sliderRef'
 | 
			
		||||
          class={sliderClassName}
 | 
			
		||||
          onTouchStart={disabled ? noop : this.onTouchStart}
 | 
			
		||||
          onMouseDown={disabled ? noop : this.onMouseDown}
 | 
			
		||||
          onMouseUp={disabled ? noop : this.onMouseUp}
 | 
			
		||||
          onKeyDown={disabled ? noop : this.onKeyDown}
 | 
			
		||||
          onTouchstart={disabled ? noop : this.onTouchStart}
 | 
			
		||||
          onMousedown={disabled ? noop : this.onMouseDown}
 | 
			
		||||
          onMouseup={disabled ? noop : this.onMouseUp}
 | 
			
		||||
          onKeydown={disabled ? noop : this.onKeyDown}
 | 
			
		||||
          onFocus={disabled ? noop : this.onFocus}
 | 
			
		||||
          onBlur={disabled ? noop : this.onBlur}
 | 
			
		||||
        >
 | 
			
		||||
| 
						 | 
				
			
			@ -291,7 +310,9 @@ export default function createSlider (Component) {
 | 
			
		|||
            dotStyle={dotStyle}
 | 
			
		||||
            activeDotStyle={activeDotStyle}
 | 
			
		||||
          />
 | 
			
		||||
          {handles}
 | 
			
		||||
          <div ref='handleRef'>
 | 
			
		||||
            {handles}
 | 
			
		||||
          </div>
 | 
			
		||||
          <Marks
 | 
			
		||||
            {...markProps}
 | 
			
		||||
          />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
import PropTypes from '../../../_util/vue-types'
 | 
			
		||||
import BaseMixin from '../../../_util/BaseMixin'
 | 
			
		||||
import PropTypes from '../../_util/vue-types'
 | 
			
		||||
import BaseMixin from '../../_util/BaseMixin'
 | 
			
		||||
import Tooltip from '../../vc-tooltip'
 | 
			
		||||
import Handle from './Handle'
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
import PropTypes from '../_util/vue-types'
 | 
			
		||||
import Trigger from '../trigger'
 | 
			
		||||
import { placements } from './placements'
 | 
			
		||||
import { hasProp, getComponentFromProp } from '../_util/props-util'
 | 
			
		||||
import { hasProp, getComponentFromProp, getOptionProps } from '../_util/props-util'
 | 
			
		||||
function noop () {}
 | 
			
		||||
export default {
 | 
			
		||||
  props: {
 | 
			
		||||
| 
						 | 
				
			
			@ -57,7 +57,7 @@ export default {
 | 
			
		|||
      destroyTooltipOnHide,
 | 
			
		||||
      defaultVisible, getTooltipContainer,
 | 
			
		||||
      ...restProps
 | 
			
		||||
    } = this.$props
 | 
			
		||||
    } = getOptionProps(this)
 | 
			
		||||
    const extraProps = { ...restProps }
 | 
			
		||||
    if (hasProp(this, 'visible')) {
 | 
			
		||||
      extraProps.popupVisible = this.$props.visible
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,58 @@
 | 
			
		|||
.@{tooltip-prefix-cls} {
 | 
			
		||||
  .effect() {
 | 
			
		||||
    animation-duration: 0.3s;
 | 
			
		||||
    animation-fill-mode: both;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &&-zoom-enter, &&-zoom-leave {
 | 
			
		||||
    display: block;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-zoom-enter, &-zoom-appear {
 | 
			
		||||
    opacity: 0;
 | 
			
		||||
    .effect();
 | 
			
		||||
    animation-timing-function: cubic-bezier(0.18, 0.89, 0.32, 1.28);
 | 
			
		||||
    animation-play-state: paused;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-zoom-leave {
 | 
			
		||||
    .effect();
 | 
			
		||||
    animation-timing-function: cubic-bezier(0.6, -0.3, 0.74, 0.05);
 | 
			
		||||
    animation-play-state: paused;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-zoom-enter&-zoom-enter-active, &-zoom-appear&-zoom-appear-active {
 | 
			
		||||
    animation-name: rcToolTipZoomIn;
 | 
			
		||||
    animation-play-state: running;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-zoom-leave&-zoom-leave-active {
 | 
			
		||||
    animation-name: rcToolTipZoomOut;
 | 
			
		||||
    animation-play-state: running;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @keyframes rcToolTipZoomIn {
 | 
			
		||||
    0% {
 | 
			
		||||
      opacity: 0;
 | 
			
		||||
      transform-origin: 50% 50%;
 | 
			
		||||
      transform: scale(0, 0);
 | 
			
		||||
    }
 | 
			
		||||
    100% {
 | 
			
		||||
      opacity: 1;
 | 
			
		||||
      transform-origin: 50% 50%;
 | 
			
		||||
      transform: scale(1, 1);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  @keyframes rcToolTipZoomOut {
 | 
			
		||||
    0% {
 | 
			
		||||
      opacity: 1;
 | 
			
		||||
      transform-origin: 50% 50%;
 | 
			
		||||
      transform: scale(1, 1);
 | 
			
		||||
    }
 | 
			
		||||
    100% {
 | 
			
		||||
      opacity: 0;
 | 
			
		||||
      transform-origin: 50% 50%;
 | 
			
		||||
      transform: scale(0, 0);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,164 @@
 | 
			
		|||
@import "boostrap/anim.less";
 | 
			
		||||
 | 
			
		||||
@tooltip-prefix-cls: rc-tooltip;
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Tooltips
 | 
			
		||||
// --------------------------------------------------
 | 
			
		||||
@font-size-base         : 12px;
 | 
			
		||||
@line-height-base       : 1.5;
 | 
			
		||||
@border-radius-base     : 6px;
 | 
			
		||||
@overlay-shadow              : 0 0 4px rgba(0, 0, 0, 0.17);
 | 
			
		||||
//** Tooltip text color
 | 
			
		||||
@tooltip-color: #fff;
 | 
			
		||||
//** Tooltip background color
 | 
			
		||||
@tooltip-bg: #373737;
 | 
			
		||||
@tooltip-opacity: 0.9;
 | 
			
		||||
 | 
			
		||||
//** Tooltip arrow width
 | 
			
		||||
@tooltip-arrow-width: 5px;
 | 
			
		||||
//** Tooltip distance with trigger
 | 
			
		||||
@tooltip-distance: @tooltip-arrow-width + 4;
 | 
			
		||||
//** Tooltip arrow color
 | 
			
		||||
@tooltip-arrow-color: @tooltip-bg;
 | 
			
		||||
 | 
			
		||||
// Base class
 | 
			
		||||
.@{tooltip-prefix-cls} {
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  z-index: 1070;
 | 
			
		||||
  display: block;
 | 
			
		||||
  visibility: visible;
 | 
			
		||||
  // remove left/top by yiminghe
 | 
			
		||||
  // left: -9999px;
 | 
			
		||||
  // top: -9999px;
 | 
			
		||||
  font-size: @font-size-base;
 | 
			
		||||
  line-height: @line-height-base;
 | 
			
		||||
  opacity: @tooltip-opacity;
 | 
			
		||||
 | 
			
		||||
  &-hidden {
 | 
			
		||||
    display: none;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-top, &-placement-topLeft, &-placement-topRight {
 | 
			
		||||
    padding: @tooltip-arrow-width 0 @tooltip-distance 0;
 | 
			
		||||
  }
 | 
			
		||||
  &-placement-right, &-placement-rightTop, &-placement-rightBottom {
 | 
			
		||||
    padding: 0 @tooltip-arrow-width 0 @tooltip-distance;
 | 
			
		||||
  }
 | 
			
		||||
  &-placement-bottom, &-placement-bottomLeft, &-placement-bottomRight {
 | 
			
		||||
    padding: @tooltip-distance 0 @tooltip-arrow-width 0;
 | 
			
		||||
  }
 | 
			
		||||
  &-placement-left, &-placement-leftTop, &-placement-leftBottom {
 | 
			
		||||
    padding: 0 @tooltip-distance 0 @tooltip-arrow-width;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Wrapper for the tooltip content
 | 
			
		||||
.@{tooltip-prefix-cls}-inner {
 | 
			
		||||
  padding: 8px 10px;
 | 
			
		||||
  color: @tooltip-color;
 | 
			
		||||
  text-align: left;
 | 
			
		||||
  text-decoration: none;
 | 
			
		||||
  background-color: @tooltip-bg;
 | 
			
		||||
  border-radius: @border-radius-base;
 | 
			
		||||
  box-shadow: @overlay-shadow;
 | 
			
		||||
  min-height: 34px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Arrows
 | 
			
		||||
.@{tooltip-prefix-cls}-arrow {
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  width: 0;
 | 
			
		||||
  height: 0;
 | 
			
		||||
  border-color: transparent;
 | 
			
		||||
  border-style: solid;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.@{tooltip-prefix-cls} {
 | 
			
		||||
  &-placement-top &-arrow,
 | 
			
		||||
  &-placement-topLeft &-arrow,
 | 
			
		||||
  &-placement-topRight &-arrow {
 | 
			
		||||
    bottom: @tooltip-distance - @tooltip-arrow-width;
 | 
			
		||||
    margin-left: -@tooltip-arrow-width;
 | 
			
		||||
    border-width: @tooltip-arrow-width @tooltip-arrow-width 0;
 | 
			
		||||
    border-top-color: @tooltip-arrow-color;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-top &-arrow {
 | 
			
		||||
    left: 50%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-topLeft &-arrow {
 | 
			
		||||
    left: 15%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-topRight &-arrow {
 | 
			
		||||
    right: 15%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-right &-arrow,
 | 
			
		||||
  &-placement-rightTop &-arrow,
 | 
			
		||||
  &-placement-rightBottom &-arrow {
 | 
			
		||||
    left: @tooltip-distance - @tooltip-arrow-width;
 | 
			
		||||
    margin-top: -@tooltip-arrow-width;
 | 
			
		||||
    border-width: @tooltip-arrow-width @tooltip-arrow-width @tooltip-arrow-width 0;
 | 
			
		||||
    border-right-color: @tooltip-arrow-color;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-right &-arrow {
 | 
			
		||||
    top: 50%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-rightTop &-arrow {
 | 
			
		||||
    top: 15%;
 | 
			
		||||
    margin-top: 0;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-rightBottom &-arrow {
 | 
			
		||||
    bottom: 15%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-left &-arrow,
 | 
			
		||||
  &-placement-leftTop &-arrow,
 | 
			
		||||
  &-placement-leftBottom &-arrow {
 | 
			
		||||
    right: @tooltip-distance - @tooltip-arrow-width;
 | 
			
		||||
    margin-top: -@tooltip-arrow-width;
 | 
			
		||||
    border-width: @tooltip-arrow-width 0 @tooltip-arrow-width @tooltip-arrow-width;
 | 
			
		||||
    border-left-color: @tooltip-arrow-color;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-left &-arrow {
 | 
			
		||||
    top: 50%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-leftTop &-arrow {
 | 
			
		||||
    top: 15%;
 | 
			
		||||
    margin-top: 0;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-leftBottom &-arrow {
 | 
			
		||||
    bottom: 15%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-bottom &-arrow,
 | 
			
		||||
  &-placement-bottomLeft &-arrow,
 | 
			
		||||
  &-placement-bottomRight &-arrow {
 | 
			
		||||
    top: @tooltip-distance - @tooltip-arrow-width;
 | 
			
		||||
    margin-left: -@tooltip-arrow-width;
 | 
			
		||||
    border-width: 0 @tooltip-arrow-width @tooltip-arrow-width;
 | 
			
		||||
    border-bottom-color: @tooltip-arrow-color;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-bottom &-arrow {
 | 
			
		||||
    left: 50%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-bottomLeft &-arrow {
 | 
			
		||||
    left: 15%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-bottomRight &-arrow {
 | 
			
		||||
    right: 15%;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,190 @@
 | 
			
		|||
@import "boostrap/anim.less";
 | 
			
		||||
 | 
			
		||||
@tooltip-prefix-cls: rc-tooltip;
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Tooltips
 | 
			
		||||
// --------------------------------------------------
 | 
			
		||||
@font-size-base         : 12px;
 | 
			
		||||
@line-height-base       : 1.5;
 | 
			
		||||
@border-radius-base     : 3px;
 | 
			
		||||
@overlay-shadow              : 0 0 4px rgba(0, 0, 0, 0.17);
 | 
			
		||||
//** Tooltip text color
 | 
			
		||||
@tooltip-color: #333333;
 | 
			
		||||
//** Tooltip background color
 | 
			
		||||
@tooltip-bg: #ffffff;
 | 
			
		||||
@tooltip-opacity: 0.9;
 | 
			
		||||
 | 
			
		||||
@tooltip-border-width: 1px;
 | 
			
		||||
@tooltip-border-color: #b1b1b1;
 | 
			
		||||
@tooltip-shadow-width: 1px;
 | 
			
		||||
 | 
			
		||||
//** Tooltip arrow width
 | 
			
		||||
@tooltip-arrow-width: 6px;
 | 
			
		||||
//** Tooltip distance with trigger
 | 
			
		||||
//** Tooltip arrow color
 | 
			
		||||
@tooltip-arrow-color: @tooltip-border-color;
 | 
			
		||||
@tooltip-arrow-inner-color: @tooltip-bg;
 | 
			
		||||
 | 
			
		||||
// Base class
 | 
			
		||||
.@{tooltip-prefix-cls} {
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  z-index: 1070;
 | 
			
		||||
  display: block;
 | 
			
		||||
  visibility: visible;
 | 
			
		||||
  line-height: @line-height-base;
 | 
			
		||||
  font-size: @font-size-base;
 | 
			
		||||
  background-color:rgba(0, 0, 0, 0.05);
 | 
			
		||||
  padding: @tooltip-shadow-width;
 | 
			
		||||
  opacity: @tooltip-opacity;
 | 
			
		||||
 | 
			
		||||
  &-hidden {
 | 
			
		||||
    display: none;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Wrapper for the tooltip content
 | 
			
		||||
.@{tooltip-prefix-cls}-inner {
 | 
			
		||||
  padding: 8px 10px;
 | 
			
		||||
  color: @tooltip-color;
 | 
			
		||||
  text-align: left;
 | 
			
		||||
  text-decoration: none;
 | 
			
		||||
  background-color: @tooltip-bg;
 | 
			
		||||
  border-radius: @border-radius-base;
 | 
			
		||||
  min-height: 34px;
 | 
			
		||||
  border:@tooltip-border-width solid @tooltip-border-color;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Arrows
 | 
			
		||||
.@{tooltip-prefix-cls}-arrow,
 | 
			
		||||
.@{tooltip-prefix-cls}-arrow-inner{
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  width: 0;
 | 
			
		||||
  height: 0;
 | 
			
		||||
  border-color: transparent;
 | 
			
		||||
  border-style: solid;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.@{tooltip-prefix-cls} {
 | 
			
		||||
  &-placement-top &-arrow,
 | 
			
		||||
  &-placement-topLeft &-arrow,
 | 
			
		||||
  &-placement-topRight &-arrow{
 | 
			
		||||
    bottom: -@tooltip-arrow-width + @tooltip-shadow-width;
 | 
			
		||||
    margin-left: -@tooltip-arrow-width;
 | 
			
		||||
    border-width: @tooltip-arrow-width @tooltip-arrow-width 0;
 | 
			
		||||
    border-top-color: @tooltip-arrow-color;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-top &-arrow-inner,
 | 
			
		||||
  &-placement-topLeft &-arrow-inner,
 | 
			
		||||
  &-placement-topRight &-arrow-inner{
 | 
			
		||||
    bottom: @tooltip-border-width;
 | 
			
		||||
    margin-left: -@tooltip-arrow-width;
 | 
			
		||||
    border-width: @tooltip-arrow-width @tooltip-arrow-width 0;
 | 
			
		||||
    border-top-color: @tooltip-arrow-inner-color;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-top &-arrow {
 | 
			
		||||
    left: 50%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-topLeft &-arrow {
 | 
			
		||||
    left: 15%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-topRight &-arrow {
 | 
			
		||||
    right: 15%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-right &-arrow,
 | 
			
		||||
  &-placement-rightTop &-arrow,
 | 
			
		||||
  &-placement-rightBottom &-arrow {
 | 
			
		||||
    left: -@tooltip-arrow-width + @tooltip-shadow-width;
 | 
			
		||||
    margin-top: -@tooltip-arrow-width;
 | 
			
		||||
    border-width: @tooltip-arrow-width @tooltip-arrow-width @tooltip-arrow-width 0;
 | 
			
		||||
    border-right-color: @tooltip-arrow-color;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-right &-arrow-inner,
 | 
			
		||||
  &-placement-rightTop &-arrow-inner,
 | 
			
		||||
  &-placement-rightBottom &-arrow-inner {
 | 
			
		||||
    left: @tooltip-border-width;
 | 
			
		||||
    margin-top: -@tooltip-arrow-width;
 | 
			
		||||
    border-width: @tooltip-arrow-width @tooltip-arrow-width @tooltip-arrow-width 0;
 | 
			
		||||
    border-right-color: @tooltip-arrow-inner-color;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-right &-arrow {
 | 
			
		||||
    top: 50%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-rightTop &-arrow {
 | 
			
		||||
    top: 15%;
 | 
			
		||||
    margin-top: 0;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-rightBottom &-arrow {
 | 
			
		||||
    bottom: 15%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-left &-arrow,
 | 
			
		||||
  &-placement-leftTop &-arrow,
 | 
			
		||||
  &-placement-leftBottom &-arrow {
 | 
			
		||||
    right: -@tooltip-arrow-width + @tooltip-shadow-width;
 | 
			
		||||
    margin-top: -@tooltip-arrow-width;
 | 
			
		||||
    border-width: @tooltip-arrow-width 0 @tooltip-arrow-width @tooltip-arrow-width;
 | 
			
		||||
    border-left-color: @tooltip-arrow-color;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-left &-arrow-inner,
 | 
			
		||||
  &-placement-leftTop &-arrow-inner,
 | 
			
		||||
  &-placement-leftBottom &-arrow-inner {
 | 
			
		||||
    right: @tooltip-border-width;
 | 
			
		||||
    margin-top: -@tooltip-arrow-width;
 | 
			
		||||
    border-width: @tooltip-arrow-width 0 @tooltip-arrow-width @tooltip-arrow-width;
 | 
			
		||||
    border-left-color: @tooltip-arrow-inner-color;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-left &-arrow {
 | 
			
		||||
    top: 50%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-leftTop &-arrow {
 | 
			
		||||
    top: 15%;
 | 
			
		||||
    margin-top: 0;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-leftBottom &-arrow {
 | 
			
		||||
    bottom: 15%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-bottom &-arrow,
 | 
			
		||||
  &-placement-bottomLeft &-arrow,
 | 
			
		||||
  &-placement-bottomRight &-arrow {
 | 
			
		||||
    top: -@tooltip-arrow-width + @tooltip-shadow-width;;
 | 
			
		||||
    margin-left: -@tooltip-arrow-width;
 | 
			
		||||
    border-width: 0 @tooltip-arrow-width @tooltip-arrow-width;
 | 
			
		||||
    border-bottom-color: @tooltip-arrow-color;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-bottom &-arrow-inner,
 | 
			
		||||
  &-placement-bottomLeft &-arrow-inner,
 | 
			
		||||
  &-placement-bottomRight &-arrow-inner {
 | 
			
		||||
    top: @tooltip-border-width;
 | 
			
		||||
    margin-left: -@tooltip-arrow-width;
 | 
			
		||||
    border-width: 0 @tooltip-arrow-width @tooltip-arrow-width;
 | 
			
		||||
    border-bottom-color: @tooltip-arrow-inner-color;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-bottom &-arrow {
 | 
			
		||||
    left: 50%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-bottomLeft &-arrow {
 | 
			
		||||
    left: 15%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &-placement-bottomRight &-arrow {
 | 
			
		||||
    right: 15%;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -55,12 +55,3 @@ Slider
 | 
			
		|||
Table
 | 
			
		||||
Timeline
 | 
			
		||||
Transfer
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@ const AsyncComp = () => {
 | 
			
		|||
  const hashs = window.location.hash.split('/')
 | 
			
		||||
  const d = hashs[hashs.length - 1]
 | 
			
		||||
  return {
 | 
			
		||||
    component: import(`../components/vc-table/demo/${d}`),
 | 
			
		||||
    component: import(`../components/vc-slider/demo/${d}`),
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
export default [
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue