mirror of
https://github.com/zhigang1992/react.git
synced 2026-04-24 04:15:54 +08:00
feat: export all types related to components (#562)
* feat: export all types related to components fix(tooltip): fix the vertical offset of the arrow * refactor: optimize events of all popup related components * test: append testcases for popup base component * test: add testcase for visible events * test: update snapshots
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import Slider from './slider'
|
||||
|
||||
export type { SliderProps, SliderTypes } from './slider'
|
||||
export default Slider
|
||||
|
||||
@@ -15,10 +15,11 @@ import { getColors } from './styles'
|
||||
import { NormalTypes } from '../utils/prop-types'
|
||||
import useScaleable, { withScaleable } from '../use-scaleable'
|
||||
|
||||
export type SliderTypes = NormalTypes
|
||||
interface Props {
|
||||
hideValue?: boolean
|
||||
value?: number
|
||||
type?: NormalTypes
|
||||
type?: SliderTypes
|
||||
initialValue?: number
|
||||
step?: number
|
||||
max?: number
|
||||
@@ -31,7 +32,7 @@ interface Props {
|
||||
|
||||
const defaultProps = {
|
||||
hideValue: false,
|
||||
type: 'default' as NormalTypes,
|
||||
type: 'default' as SliderTypes,
|
||||
initialValue: 0,
|
||||
step: 1,
|
||||
min: 0,
|
||||
@@ -92,11 +93,10 @@ const SliderComponent: React.FC<React.PropsWithChildren<SliderProps>> = ({
|
||||
const sliderRef = useRef<HTMLDivElement>(null)
|
||||
const dotRef = useRef<HTMLDivElement>(null)
|
||||
|
||||
const currentRatio = useMemo(() => ((value - min) / (max - min)) * 100, [
|
||||
value,
|
||||
max,
|
||||
min,
|
||||
])
|
||||
const currentRatio = useMemo(
|
||||
() => ((value - min) / (max - min)) * 100,
|
||||
[value, max, min],
|
||||
)
|
||||
|
||||
const setLastOffsetManually = (val: number) => {
|
||||
const width = getRefWidth(sliderRef)
|
||||
|
||||
Reference in New Issue
Block a user