Browse Source

Fix ts definition of Table & RangePicker

close https://segmentfault.com/q/1010000008423156
pull/5021/head
afc163 8 years ago
parent
commit
a7c6c027ce
  1. 14
      components/date-picker/index.tsx
  2. 2
      components/table/Table.tsx

14
components/date-picker/index.tsx

@ -22,6 +22,7 @@ export interface PickerProps {
getCalendarContainer?: (trigger: any) => React.ReactNode;
open?: boolean;
onOpenChange?: (status: boolean) => void;
disabledDate?: (current: moment.Moment) => boolean;
}
export interface SinglePickerProps {
@ -36,14 +37,17 @@ export interface DatePickerProps extends PickerProps, SinglePickerProps {
showToday?: boolean;
open?: boolean;
toggleOpen?: (e: {open: boolean}) => void;
disabledDate?: (current: moment.Moment) => boolean;
disabledTime?: (current: moment.Moment) => {
disabledHours?: () => [number, number],
disabledMinutes?: () => [number, number],
disabledSeconds?: () => [number, number],
};
onOpenChange?: (status: boolean) => void;
placeholder?: string;
}
const DatePicker = wrapPicker(createPicker(RcCalendar)) as React.ClassicComponentClass<DatePickerProps>;
export interface MonthPickerProps extends PickerProps, SinglePickerProps {
disabledDate?: (current: moment.Moment) => boolean;
placeholder?: string;
}
const MonthPicker = wrapPicker(createPicker(MonthCalendar), 'YYYY-MM');
@ -57,6 +61,12 @@ export interface RangePickerProps extends PickerProps {
ranges?: {
[range: string]: moment.Moment[],
};
placeholder?: [string, string],
disabledTime?: (current: moment.Moment, type: string) => {
disabledHours?: () => [number, number],
disabledMinutes?: () => [number, number],
disabledSeconds?: () => [number, number],
};
}
assign(DatePicker, {

2
components/table/Table.tsx

@ -62,6 +62,8 @@ export interface TableProps<T> {
expandedRowKeys?: string[];
expandIconAsCell?: boolean;
expandIconColumnIndex?: number;
onExpandedRowsChange?: (expandedRowKeys: string[]) => void;
onExpand?: (expanded: boolean, record: T) => void;
onChange?: (pagination: PaginationProps | boolean, filters: string[], sorter: Object) => any;
loading?: boolean;
locale?: Object;

Loading…
Cancel
Save