mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Merge pull request #27872 from Deanna2/rc-slider
Add more specific types to rc-slider.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
This package contains type definitions for rc-slider (https://github.com/react-component/slider).
|
||||
|
||||
Additional Details
|
||||
* Last updated: Fri, 15 Dec 2017
|
||||
* Last updated: Sun, 04 Aug 2018
|
||||
* Dependencies: react
|
||||
* Global values: none
|
||||
|
||||
|
||||
Vendored
+29
-13
@@ -1,9 +1,10 @@
|
||||
// Type definitions for rc-slider 8.2
|
||||
// Type definitions for rc-slider 8.6
|
||||
// Project: https://github.com/react-component/slider
|
||||
// Definitions by: Marcinkus Mantas <https://github.com/mantasmarcinkus>
|
||||
// Alexander Mattoni <https://github.com/mattoni>
|
||||
// Austin Turner <https://github.com/paustint>
|
||||
// Jacob Froman <https://github.com/j-fro>
|
||||
// Deanna Veale <https://github.com/Deanna2>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -68,18 +69,6 @@ export interface CommonApiProps {
|
||||
* @default false
|
||||
*/
|
||||
dots?: boolean;
|
||||
/**
|
||||
* onBeforeChange will be triggered when ontouchstart or onmousedown is triggered.
|
||||
*/
|
||||
onBeforeChange?(value: any): any | undefined;
|
||||
/**
|
||||
* onChange will be triggered while the value of Slider changing.
|
||||
*/
|
||||
onChange?(value: any): any | undefined;
|
||||
/**
|
||||
* onAfterChange will be triggered when ontouchend or onmouseup is triggered.
|
||||
*/
|
||||
onAfterChange?(value: any): any | undefined;
|
||||
|
||||
/**
|
||||
* @deprecated in version ^6.0.0. Use rc-tooltip
|
||||
@@ -125,6 +114,18 @@ export interface CommonApiProps {
|
||||
}
|
||||
|
||||
export interface SliderProps extends CommonApiProps {
|
||||
/**
|
||||
* onBeforeChange will be triggered when ontouchstart or onmousedown is triggered.
|
||||
*/
|
||||
onBeforeChange?(value: number): void;
|
||||
/**
|
||||
* onChange will be triggered while the value of Slider changing.
|
||||
*/
|
||||
onChange?(value: number): void;
|
||||
/**
|
||||
* onAfterChange will be triggered when ontouchend or onmouseup is triggered.
|
||||
*/
|
||||
onAfterChange?(value: number): void;
|
||||
/**
|
||||
* Set initial value of slider.
|
||||
* @default 0
|
||||
@@ -137,6 +138,21 @@ export interface SliderProps extends CommonApiProps {
|
||||
}
|
||||
|
||||
export interface RangeProps extends CommonApiProps {
|
||||
/**
|
||||
* onBeforeChange will be triggered when ontouchstart or onmousedown is triggered.
|
||||
* For prop (count = -1) type returned is [number, undefined]. Bug raised in rc-slider https://github.com/react-component/slider/issues/457
|
||||
*/
|
||||
onBeforeChange?(value: number[]): void;
|
||||
/**
|
||||
* onChange will be triggered while the value of Slider changing.
|
||||
* For prop (count = -1) type returned is [number, undefined]. Bug raised in rc-slider https://github.com/react-component/slider/issues/457
|
||||
*/
|
||||
onChange?(value: number[]): void;
|
||||
/**
|
||||
* onAfterChange will be triggered when ontouchend or onmouseup is triggered.
|
||||
* For prop (count = -1) type returned is [number, undefined]. Bug raised in rc-slider https://github.com/react-component/slider/issues/457
|
||||
*/
|
||||
onAfterChange?(value: number[]): void;
|
||||
/**
|
||||
* Set initial positions of handles.
|
||||
* @default [0,0]
|
||||
|
||||
@@ -18,6 +18,11 @@ ReactDOM.render(
|
||||
/>,
|
||||
document.querySelector('.another-app')
|
||||
);
|
||||
|
||||
const onChangeFunc1 = (string: number) => {};
|
||||
|
||||
const onChangeFunc2 = (string: number[]) => {};
|
||||
|
||||
ReactDOM.render(
|
||||
<Slider
|
||||
className="bottomRight"
|
||||
@@ -30,9 +35,9 @@ ReactDOM.render(
|
||||
included={true}
|
||||
disabled={false}
|
||||
dots={true}
|
||||
onBeforeChange={() => { }}
|
||||
onChange={() => { }}
|
||||
onAfterChange={() => { }}
|
||||
onBeforeChange={onChangeFunc1}
|
||||
onChange={onChangeFunc1}
|
||||
onAfterChange={onChangeFunc1}
|
||||
defaultValue={0.1}
|
||||
value={0.1}
|
||||
style={{backgroundColor: 'plum'}}
|
||||
@@ -49,6 +54,9 @@ ReactDOM.render(
|
||||
count={3}
|
||||
allowCross={false}
|
||||
pushable={true}
|
||||
onChange={onChangeFunc2}
|
||||
onAfterChange={onChangeFunc2}
|
||||
onBeforeChange={onChangeFunc2}
|
||||
/>,
|
||||
document.querySelector('.app')
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user