Skip to content

Commit

Permalink
fix(DatePicker2): fix typeof Dayjs
Browse files Browse the repository at this point in the history
  • Loading branch information
皆虚 committed Apr 13, 2021
1 parent de5adef commit 68e6da5
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 40 deletions.
22 changes: 11 additions & 11 deletions types/calendar2/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import * as React from 'react';
import CommonProps from '../util';
import * as dayjs from 'dayjs';
import { Dayjs } from 'dayjs';

interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
defaultValue?: any;
Expand All @@ -15,17 +15,17 @@ export interface CalendarProps extends HTMLAttributesWeak, CommonProps {
/**
* 默认选中的日期(dayjs 对象)
*/
defaultValue?: string | number | typeof dayjs;
defaultValue?: string | number | typeof Dayjs;

/**
* 选中的日期值 (dayjs 对象)
*/
value?: string | number | typeof dayjs;
value?: string | number | typeof Dayjs;

/**
* 面板默认显示的日期
*/
defaultPanelValue?: string | number | typeof dayjs;
defaultPanelValue?: string | number | typeof Dayjs;

/**
* 展现形态
Expand All @@ -35,17 +35,17 @@ export interface CalendarProps extends HTMLAttributesWeak, CommonProps {
/**
* 选择日期单元格时的回调
*/
onSelect?: (value: typeof dayjs, strVal: string) => void;
onSelect?: (value: typeof Dayjs, strVal: string) => void;

/**
* 值改变时的回调
*/
onChange?: (value: typeof dayjs, strVal: string) => void;
onChange?: (value: typeof Dayjs, strVal: string) => void;

/**
* 日期面板变化回调
*/
onPanelChange?: (value: typeof dayjs, mode: string) => void;
onPanelChange?: (value: typeof Dayjs, mode: string) => void;

/**
* 自定义样式类
Expand All @@ -55,22 +55,22 @@ export interface CalendarProps extends HTMLAttributesWeak, CommonProps {
/**
* 自定义日期渲染
*/
dateCellRender?: (value: typeof dayjs) => React.ReactNode;
dateCellRender?: (value: typeof Dayjs) => React.ReactNode;

/**
* 自定义月份渲染函数
*/
monthCellRender?: (value: typeof dayjs) => React.ReactNode;
monthCellRender?: (value: typeof Dayjs) => React.ReactNode;

/**
* 自定义年份渲染函数
*/
yearCellRender?: (value: typeof dayjs) => React.ReactNode;
yearCellRender?: (value: typeof Dayjs) => React.ReactNode;

/**
* 不可选择的日期
*/
disabledDate?: (value: typeof dayjs, mode: string) => boolean;
disabledDate?: (value: typeof Dayjs, mode: string) => boolean;
}

export default class Calendar extends React.Component<CalendarProps, any> {}
52 changes: 26 additions & 26 deletions types/date-picker2/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// <reference types="react" />
import * as React from 'react';
import CommonProps from '../util';
import * as dayjs from 'dayjs';
import { Dayjs } from 'dayjs';
import { PopupProps } from '../overlay';
import { InputProps } from '../input';

Expand All @@ -27,44 +27,44 @@ export class QuarterPicker extends React.Component<PickerProps, any> {
}
export class RangePicker extends React.Component<RangePickerProps, any> {
type: 'range';
value?: Array<number> | Array<string> | Array<typeof dayjs>;
defaultValue?: Array<number> | Array<string> | Array<typeof dayjs>;
format?: string | ((value: typeof dayjs) => string) | Array<string> | Array<(value: typeof dayjs) => string>;
onOk?: (value: Array<typeof dayjs>, strVal: Array<string>) => void;
onChange?: (value: Array<typeof dayjs>, strVal: Array<string>) => void;
placeholder: string | Array<string>;
dateInputAriaLabel: Array<string> | string;
value?: Array<number> | Array<string> | Array<typeof Dayjs>;
defaultValue?: Array<number> | Array<string> | Array<typeof Dayjs>;
format?: string | ((value: typeof Dayjs) => string) | Array<string> | Array<(value: typeof Dayjs) => string>;
onOk?: (value: Array<typeof Dayjs>, strVal: Array<string>) => void;
onChange?: (value: Array<typeof Dayjs>, strVal: Array<string>) => void;
placeholder?: string | Array<string>;
dateInputAriaLabel?: Array<string> | string;
}

interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
defaultValue?: any;
onChange?: any;
}
export interface PickerProps extends HTMLAttributesWeak, CommonProps {
type: 'date' | 'range';
type?: 'date' | 'range';
name?: string;
mode: 'date' | 'month' | 'week' | 'quarter' | 'year';
value?: string | number | typeof dayjs;
defaultValue?: string | number | typeof dayjs;
defaultPanelValue?: typeof dayjs;
disabledDate?: (value: typeof dayjs, mode: 'date' | 'month' | 'week' | 'quarter' | 'year') => boolean;
mode?: 'date' | 'month' | 'week' | 'quarter' | 'year';
value?: string | number | typeof Dayjs;
defaultValue?: string | number | typeof Dayjs;
defaultPanelValue?: typeof Dayjs;
disabledDate?: (value: typeof Dayjs, mode: 'date' | 'month' | 'week' | 'quarter' | 'year') => boolean;
extraFooterRender?: () => React.ReactNode;
preset: object | Array<object>;
preset?: object | Array<object>;
showTime?: boolean;
resetTime?: boolean;
timePanelProps: object;
disabledTime: (value: typeof dayjs) => boolean;
timePanelProps?: object;
disabledTime?: (value: typeof Dayjs) => boolean;

onOk?: (value: typeof dayjs, strVal: string) => void;
onChange?: (value: typeof dayjs, strVal: string) => void;
onOk?: (value: typeof Dayjs, strVal: string) => void;
onChange?: (value: typeof Dayjs, strVal: string) => void;
onVisibleChange?: (visible: boolean) => void;
onPanelChange?: (panelValue: typeof dayjs, mode: 'date' | 'month' | 'week' | 'quarter' | 'year') => void;
onPanelChange?: (panelValue: typeof Dayjs, mode: 'date' | 'month' | 'week' | 'quarter' | 'year') => void;

format?: string | ((value: typeof dayjs) => string);
format?: string | ((value: typeof Dayjs) => string);
disabled?: boolean;
state?: 'success' | 'loading' | 'error';
size?: 'small' | 'medium' | 'large';
hasBorder: boolean;
hasBorder?: boolean;
inputProps?: InputProps;
inputReadOnly?: boolean;
hasClear?: boolean;
Expand All @@ -80,11 +80,11 @@ export interface PickerProps extends HTMLAttributesWeak, CommonProps {
popupProps?: PopupProps;
followTrigger?: boolean;
popupComponent?: React.Component;
dateCellRender?: (value: typeof dayjs) => React.ReactNode;
monthCellRender?: (value: typeof dayjs) => React.ReactNode;
dateCellRender?: (value: typeof Dayjs) => React.ReactNode;
monthCellRender?: (value: typeof Dayjs) => React.ReactNode;
dateInputAriaLabel?: string;
isPreview: boolean;
renderPreview: (value: typeof dayjs) => React.ReactNode;
isPreview?: boolean;
renderPreview?: (value: typeof Dayjs) => React.ReactNode;
}

export interface RangePickerProps extends HTMLAttributesWeak, CommonProps {}
6 changes: 3 additions & 3 deletions types/time-picker2/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import CommonProps from '../util';
import { PopupProps } from '../overlay';
import { InputProps } from '../input';
import { ButtonProps } from '../button';
import * as dayjs from 'dayjs';
import { Dayjs } from 'dayjs';

interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
defaultValue?: any;
Expand All @@ -19,7 +19,7 @@ export interface DatePreset extends ButtonProps {
}

export interface RangePreset {
[propName: string]: (typeof dayjs)[];
[propName: string]: (typeof Dayjs)[];
}

export interface TimePickerProps extends HTMLAttributesWeak, CommonProps {
Expand Down Expand Up @@ -163,7 +163,7 @@ export interface TimePickerProps extends HTMLAttributesWeak, CommonProps {
/**
* 时间值改变时的回调
*/
onChange?: (date: typeof dayjs, dateString: string) => void;
onChange?: (date: typeof Dayjs, dateString: string) => void;
}

export default class TimePicker extends React.Component<TimePickerProps, any> {}

0 comments on commit 68e6da5

Please sign in to comment.