fix: slider, time-picker typo (#2726)

pull/2730/head
言肆 2020-08-19 23:03:32 +08:00 committed by GitHub
parent 941ebc2b66
commit 63e87471d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 294 additions and 223 deletions

203
types/slider.d.ts vendored
View File

@ -3,108 +3,137 @@
// Definitions: https://github.com/vueComponent/ant-design-vue/types // Definitions: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent } from './component'; import { AntdComponent } from './component';
import { VNode } from 'vue'; import { VNodeChild } from 'vue';
export declare class Slider extends AntdComponent { export declare class Slider extends AntdComponent {
/** $props: {
* get focus when component mounted /**
* @default false * get focus when component mounted
* @type boolean * @default false
*/ * @type boolean
autofocus: boolean; */
autofocus?: boolean;
/** /**
* The default value of slider. When range is false, use number, otherwise, use [number, number] * The default value of slider. When range is false, use number, otherwise, use [number, number]
* @default 0 | [0, 0] * @default 0 | [0, 0]
* @type number | number[] * @type number | number[]
*/ */
defaultValue: number | number[]; defaultValue?: number | number[];
/** /**
* If true, the slider will not be interactable. * If true, the slider will not be interactable.
* @default false * @default false
* @type boolean * @type boolean
*/ */
disabled: boolean; disabled?: boolean;
/** /**
* Whether the thumb can drag over tick only. * Whether the thumb can drag over tick only.
* @default false * @default false
* @type boolean * @type boolean
*/ */
dots: boolean; dots?: boolean;
/** /**
* Make effect when marks not nulltrue means containment and false means coordinative * Make effect when marks not nulltrue means containment and false means coordinative
* @default true * @default true
* @type boolean * @type boolean
*/ */
included: boolean; included?: boolean;
/** /**
* Tick mark of Slider, type of key must be number, and must in closed interval [min, max] each mark can declare its own style. * Tick mark of Slider, type of key must be number, and must in closed interval [min, max] each mark can declare its own style.
* @default { number: string|VNode } | { number: { style: object, label: string|VNode } } | { number: () => VNode } * @default { number: string|VNode } | { number: { style: object, label: string|VNode } } | { number: () => VNode }
* @type object * @type object
*/ */
marks: { marks?: {
[key: number]: string | VNode | { style: object; label: string | VNode } | Function; [key: number]: string
}; | VNodeChild
| { style: object; label: string | VNodeChild }
| Function;
};
/** /**
* The maximum value the slider can slide to * The maximum value the slider can slide to
* @default 100 * @default 100
* @type number * @type number
*/ */
max: number; max?: number;
/** /**
* The minimum value the slider can slide to. * The minimum value the slider can slide to.
* @default 0 * @default 0
* @type number * @type number
*/ */
min: number; min?: number;
/** /**
* dual thumb mode * dual thumb mode
* @default false * @default false
* @type boolean * @type boolean
*/ */
range: boolean; range?: boolean;
/** /**
* The granularity the slider can step through values. * The granularity the slider can step through values.
* Must greater than 0, and be divided by (max - min) . When marks no null, step can be null. * Must greater than 0, and be divided by (max - min) . When marks no null, step can be null.
* @default 1 * @default 1
* @type number | null * @type number | null
*/ */
step: number | null; step?: number | null;
/** /**
* Slider will pass its value to tipFormatter, and display its value in Tooltip, and hide Tooltip when return value is null. * Slider will pass its value to tipFormatter, and display its value in Tooltip, and hide Tooltip when return value is null.
* @default IDENTITY * @default IDENTITY
* @type Function | null * @type Function | null
*/ */
tipFormatter: Function | null; tipFormatter?: Function | null;
/** /**
* The value of slider. When range is false, use number, otherwise, use [number, number] * The value of slider. When range is false, use number, otherwise, use [number, number]
* @type number | number[] * @type number | number[]
*/ */
value: number | number[]; value?: number | number[];
/** /**
* If true, the slider will be vertical. * If true, the slider will be vertical.
* @default false * @default false
* @type boolean * @type boolean
*/ */
vertical: boolean; vertical?: boolean;
/** /**
* If true, Tooltip will show always, or it will not show anyway, even if dragging or hovering. * If true, Tooltip will show always, or it will not show anyway, even if dragging or hovering.
* @default false * @default false
* @type boolean * @type boolean
*/ */
tooltipVisible: boolean; tooltipVisible?: boolean;
/**
* Set Tooltip display position. Ref Tooltip
* @see https://antdv.com/components/tooltip/
*/
tooltipPlacement?: string;
/**
* The DOM container of the Tooltip,
* the default behavior is to create a div element in body.
*/
getTooltipPopupContainer?: Function;
/**
* Fire when mouseup is fired.
* @param value
*/
onAfterChange?: (value?: any) => void;
/**
* Callback function that is fired when the user changes the slider's value.
* @param value
*/
onChange?: (value?: any) => void;
}
/** /**
* remove focus * remove focus

314
types/time-picker.d.ts vendored
View File

@ -4,168 +4,210 @@
import { AntdComponent } from './component'; import { AntdComponent } from './component';
import { Moment } from 'moment'; import { Moment } from 'moment';
import { VNodeChild } from 'vue';
export declare class TimePicker extends AntdComponent { export declare class TimePicker extends AntdComponent {
/** $props: {
* some addon to timepicker panel bottom /**
* @type any (slot | slot-scope) * some addon to timepicker panel bottom
*/ * @type any (slot | slot-scope)
addon: any; */
addon?: VNodeChild | JSX.Element;
/** /**
* allow clearing text * allow clearing text
* @default true * @default true
* @type boolean * @type boolean
*/ */
allowClear: boolean; allowClear?: boolean;
/** /**
* get focus when component mounted * get focus when component mounted
* @default false * @default false
* @type boolean * @type boolean
*/ */
autofocus: boolean; autofocus?: boolean;
/** /**
* clear tooltip of icon * clear tooltip of icon
* @default 'clear' * @default 'clear'
* @type string * @type string
*/ */
clearText: string; clearText?: string;
/** /**
* default open panel value, used to set utcOffset,locale if value/defaultValue absent * default open panel value, used to set utcOffset,locale if value/defaultValue absent
* @default Moment * @default Moment
* @type Moment * @type Moment
*/ */
defaultOpenValue: Moment; defaultOpenValue?: Moment;
/** /**
* to set default time * to set default time
* @type Moment * @type Moment
*/ */
defaultValue: Moment | string; defaultValue?: Moment | string;
/** /**
* determine whether the TimePicker is disabled * determine whether the TimePicker is disabled
* @default false * @default false
* @type boolean * @type boolean
*/ */
disabled: boolean; disabled?: boolean;
/** /**
* to specify the hours that cannot be selected * to specify the hours that cannot be selected
* @type Function * @type Function
*/ */
disabledHours: () => any; disabledHours?: () => any;
/** /**
* to specify the minutes that cannot be selected * to specify the minutes that cannot be selected
* @type Function * @type Function
*/ */
disabledMinutes: (selectedHour: any) => any; disabledMinutes?: (selectedHour?: any) => any;
/** /**
* to specify the seconds that cannot be selected * to specify the seconds that cannot be selected
* @type Function * @type Function
*/ */
disabledSeconds: (selectedHour: any, selectedMinute: any) => any; disabledSeconds?: (selectedHour?: any, selectedMinute?: any) => any;
/** /**
* to set the time format * to set the time format
* @default "HH:mm:ss" * @default "HH:mm:ss"
* @type string * @type string
*/ */
format: string; format?: string;
/** /**
* to set the container of the floating layer, while the default is to create a div element in body * to set the container of the floating layer, while the default is to create a div element in body
* @type Function * @type Function
*/ */
getPopupContainer: (trigger: any) => any; getPopupContainer?: (trigger?: any) => any;
/** /**
* hide the options that can not be selected * hide the options that can not be selected
* @default false * @default false
* @type boolean * @type boolean
*/ */
hideDisabledOptions: boolean; hideDisabledOptions?: boolean;
/** /**
* interval between hours in picker * interval between hours in picker
* @default 1 * @default 1
* @type number * @type number
*/ */
hourStep: number; hourStep?: number;
/** /**
* Set the readonly attribute of the input tag (avoids virtual keyboard on touch devices) * Set the readonly attribute of the input tag (avoids virtual keyboard on touch devices)
* @default false * @default false
* @type boolean * @type boolean
*/ */
inputReadOnly: boolean; inputReadOnly?: boolean;
/** /**
* interval between minutes in picker * interval between minutes in picker
* @default 1 * @default 1
* @type number * @type number
*/ */
minuteStep: number; minuteStep?: number;
/** /**
* whether to popup panel * whether to popup panel
* @default false * @default false
* @type boolean * @type boolean
*/ */
open: boolean; open?: boolean;
/** /**
* display when there's no value * display when there's no value
* @default "Select a time" * @default "Select a time"
* @type string * @type string
*/ */
placeholder: string; placeholder?: string;
/** /**
* className of panel * className of panel
* @type string * @type string
*/ */
popupClassName: string; popupClassName?: string;
popupStyle: object; /**
* style of panel
*/
popupStyle?: object;
/** /**
* interval between seconds in picker * interval between seconds in picker
* @default 1 * @default 1
* @type number * @type number
*/ */
secondStep: number; secondStep?: number;
/** /**
* The custom suffix icon * The custom suffix icon
* @type any (string | VNode | slot) * @type any (string | VNode | slot)
*/ */
suffixIcon: any; suffixIcon?: string | VNodeChild | JSX.Element;
/** /**
* display as 12 hours format, with default format h:mm:ss a * The custom clear icon
* @default false * @type string | VNodeChild | JSX.Element
* @type boolean * @version 1.5.0
*/ */
use12Hours: boolean; clearIcon?: string | VNodeChild | JSX.Element;
/** /**
* to set time * display as 12 hours format, with default format h:mm:ss a
* @type Moment * @default false
*/ * @type boolean
value: Moment | string; */
use12Hours?: boolean;
/** /**
* Time picker size * to set time
* @default 'default' * @type Moment
* @type string */
*/ value?: Moment | string;
size: 'large' | 'default' | 'small';
/**
* Time picker size
* @default 'default'
* @type string
*/
size?: 'large' | 'default' | 'small';
/**
* this value will be merged into placement's config,
* please refer to the settings dom-align
* @see https://github.com/yiminghe/dom-align
* @version 1.5.4
*/
align?: object;
/**
* optional, format of binding value. If not specified,
* the binding value will be a Date object
* @see https://momentjs.com/docs/#/displaying/format/
* @version 1.5.4
*/
valueFormat?: any;
/**
* a callback function, can be executed when the selected time is changing
* @param time
* @param timeString
*/
onChange?: (time?: Moment | string, timeString?: string) => void;
/**
* a callback function which will be called while panel opening/closing
* @param open
*/
onOpenChange?: (open?: boolean) => void;
}
/** /**
* remove focus * remove focus