Skip to content

Commit

Permalink
chore(*): update ts file (alibaba-fusion#3089)
Browse files Browse the repository at this point in the history
Co-authored-by: 皆虚 <[email protected]>
  • Loading branch information
jerryyxu and 皆虚 authored Jun 10, 2021
1 parent fe23f1a commit c176281
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 82 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 { Dayjs } from 'dayjs';
import { Dayjs, ConfigType } 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?: ConfigType;

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

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

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

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

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

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

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

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

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

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

export default class DatePicker extends React.Component<PickerProps, any> {
export default class DatePicker extends React.Component<DatePickerProps, any> {
static RangePicker: typeof RangePicker;
static MonthPicker: typeof MonthPicker;
static YearPicker: typeof YearPicker;
static WeekPicker: typeof WeekPicker;
static QuarterPicker: typeof QuarterPicker;
}

export class YearPicker extends React.Component<PickerProps, any> {
export class YearPicker extends React.Component<DatePickerProps, any> {
mode: 'year';
}
export class MonthPicker extends React.Component<PickerProps, any> {
export class MonthPicker extends React.Component<DatePickerProps, any> {
mode: 'month';
}
export class WeekPicker extends React.Component<PickerProps, any> {
export class WeekPicker extends React.Component<DatePickerProps, any> {
mode: 'week';
}
export class QuarterPicker extends React.Component<PickerProps, any> {
export class QuarterPicker extends React.Component<DatePickerProps, any> {
mode: 'quarter';
}
export class RangePicker extends React.Component<RangePickerProps, any> {
Expand All @@ -32,27 +32,28 @@ interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
defaultValue?: any;
onChange?: any;
}
export interface PickerProps extends HTMLAttributesWeak, CommonProps {
export interface DatePickerProps extends HTMLAttributesWeak, CommonProps {
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;
extraFooterRender?: () => React.ReactNode;
value?: ConfigType;
defaultValue?: ConfigType;
defaultPanelValue?: Dayjs;
disabledDate?: (value: Dayjs, mode: 'date' | 'month' | 'week' | 'quarter' | 'year') => boolean;
extraFooterRender?: React.ReactNode | (() => React.ReactNode);
preset?: object | Array<object>;
showTime?: boolean;
showOk?: boolean;
resetTime?: boolean;
timePanelProps?: object;
disabledTime?: (value: typeof Dayjs) => boolean;
disabledTime?: object;

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

format?: string | ((value: typeof Dayjs) => string);
format?: string | ((value: Dayjs) => string);
disabled?: boolean;
state?: 'success' | 'loading' | 'error';
size?: 'small' | 'medium' | 'large';
Expand All @@ -73,54 +74,24 @@ 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: Dayjs) => React.ReactNode;
monthCellRender?: (value: Dayjs) => React.ReactNode;
dateInputAriaLabel?: string;
isPreview?: boolean;
renderPreview?: (value: typeof Dayjs) => React.ReactNode;
renderPreview?: (value: Dayjs) => React.ReactNode;
}

export interface RangePickerProps extends CommonProps {
name?: 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;
export interface RangePickerProps
extends Omit<
DatePickerProps,
'value' | 'placeholder' | 'defaultValue' | 'format' | 'onOk' | 'onChange' | 'dateInputAriaLabel' | 'disabled'
> {
value?: Array<ConfigType>;
defaultValue?: Array<ConfigType>;
format?: string | ((value: Dayjs) => string) | Array<string> | Array<(value: Dayjs) => string>;
onOk?: (value: Array<Dayjs>, strVal: Array<string>) => void;
onChange?: (value: Array<Dayjs>, strVal: Array<string>) => void;
placeholder?: string | Array<string>;
dateInputAriaLabel?: Array<string> | string;
mode?: 'date' | 'month' | 'week' | 'quarter' | 'year';
defaultPanelValue?: typeof Dayjs;
disabledDate?: (value: typeof Dayjs, mode: 'date' | 'month' | 'week' | 'quarter' | 'year') => boolean;
extraFooterRender?: () => React.ReactNode;
preset?: object | Array<object>;
showTime?: boolean;
resetTime?: boolean;
timePanelProps?: object;
disabledTime?: (value: typeof Dayjs) => boolean;
onVisibleChange?: (visible: boolean) => void;
onPanelChange?: (panelValue: typeof Dayjs, mode: 'date' | 'month' | 'week' | 'quarter' | 'year') => void;
disabled?: boolean;
state?: 'success' | 'loading' | 'error';
size?: 'small' | 'medium' | 'large';
hasBorder?: boolean;
inputProps?: InputProps;
inputReadOnly?: boolean;
hasClear?: boolean;
label?: React.ReactNode;
separator?: React.ReactNode;
visible?: boolean;
defaultVisible?: boolean;
popupTriggerType?: 'click' | 'hover';
popupAlign?: string;
popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement);
popupStyle?: React.CSSProperties;
popupClassName?: string;
popupProps?: PopupProps;
followTrigger?: boolean;
popupComponent?: React.Component;
dateCellRender?: (value: typeof Dayjs) => React.ReactNode;
monthCellRender?: (value: typeof Dayjs) => React.ReactNode;
isPreview?: boolean;
renderPreview?: (value: typeof Dayjs) => React.ReactNode;
disabled?: boolean | boolean[];
}
10 changes: 5 additions & 5 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 { Dayjs } from 'dayjs';
import { Dayjs, ConfigType } 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]: (Dayjs)[];
}

export interface TimePickerProps extends HTMLAttributesWeak, CommonProps {
Expand All @@ -42,12 +42,12 @@ export interface TimePickerProps extends HTMLAttributesWeak, CommonProps {
/**
* 时间值(dayjs 对象或时间字符串,受控状态使用)
*/
value?: any;
value?: ConfigType;

/**
* 时间初值(dayjs 对象或时间字符串,非受控状态使用)
*/
defaultValue?: any;
defaultValue?: ConfigType;

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

export default class TimePicker extends React.Component<TimePickerProps, any> {}
28 changes: 23 additions & 5 deletions types/tree-select/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export interface TreeSelectProps extends HTMLAttributesWeak, CommonProps {
* 在搜索框中输入时触发的回调函数
*/
onSearch?: (keyword: string) => void;

onSearchClear?: (actionType: string) => void;
/**
* 无数据时显示内容
*/
Expand Down Expand Up @@ -164,15 +164,33 @@ export interface TreeSelectProps extends HTMLAttributesWeak, CommonProps {
/**
* 下拉框挂载的容器节点
*/
popupContainer?:
| string
| HTMLElement
| ((target: HTMLElement) => HTMLElement);
popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement);

/**
* 透传到 Popup 的属性对象
*/
popupProps?: PopupProps;
/**
* 是否跟随滚动
*/
followTrigger?: boolean;

/**
* 是否为预览态
*/
isPreview?: boolean;

/**
* 预览态模式下渲染的内容
* @param {Array<data>} value 选择值 { label: , value:}
*/
renderPreview?: (data: string | Array<any>, props: any | Array<any>) => React.ReactNode;

/**
* 是否开启虚拟滚动
*/
useVirtual?: boolean;

immutable?: boolean;
}

Expand Down

0 comments on commit c176281

Please sign in to comment.