fix: complete loss declaration (#3068)

* complete loss declaration

* fix error in ts-lint

* fix Icon name error
This commit is contained in:
feng zhi hao 2016-09-19 10:17:07 +08:00 committed by Benjy Cui
parent 9a7b644295
commit cad2d19be2
26 changed files with 113 additions and 33 deletions

View File

@ -51,9 +51,12 @@ export interface AffixProps {
*/
offsetTop?: number;
offset?: number;
/** 距离窗口底部达到指定偏移量后触发 */
offsetBottom?: number;
style?: React.CSSProperties;
/** 固定状态改变时触发的回调函数 */
onChange?: (affixed?: boolean) => any;
/** 设置 Affix 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 */
target?: () => Window | HTMLElement;
prefixCls?: string;
}

View File

@ -2,6 +2,11 @@ import * as React from 'react';
import Select, { Option, OptGroup } from '../select';
import classNames from 'classnames';
interface SelectedValue {
key: string;
label: React.ReactNode;
}
export interface AutoCompleteProps {
size?: 'large' | 'small' | 'default';
className?: string;
@ -12,6 +17,11 @@ export interface AutoCompleteProps {
optionLabelProp?: string;
choiceTransitionName?: string;
showSearch?: boolean;
defaultValue?: string | Array<any> | SelectedValue | Array<SelectedValue>;
value?: string | Array<any> | SelectedValue | Array<SelectedValue>;
allowClear?: boolean;
onChange?: (value) => void;
disabled?: boolean;
}
export default class AutoComplete extends React.Component<AutoCompleteProps, any> {

View File

@ -53,6 +53,7 @@ export interface BackTopProps {
target?: () => HTMLElement | Window;
prefixCls?: string;
className?: string;
style?: React.CSSProperties;
}
export default class BackTop extends React.Component<BackTopProps, any> {

View File

@ -40,6 +40,7 @@ export interface ButtonProps {
disabled?: boolean;
style?: React.CSSProperties;
prefixCls?: string;
className?: string;
}
export default class Button extends React.Component<ButtonProps, any> {

View File

@ -29,7 +29,9 @@ export interface SinglePickerProps {
}
export interface DatePickerProps extends PickerProps, SinglePickerProps {
showTime?: TimePickerProps;
showTime?: TimePickerProps | boolean;
open?: boolean;
toggleOpen?: (e: {open: boolean}) => void;
}
const DatePicker = wrapPicker(createPicker(RcCalendar)) as React.ClassicComponentClass<DatePickerProps>;
@ -42,7 +44,7 @@ export interface RangePickerProps extends PickerProps {
defaultValue?: [moment.Moment, moment.Moment];
defaultPickerValue?: [moment.Moment, moment.Moment];
onChange?: (dates: [moment.Moment, moment.Moment], dateStrings: [string, string]) => void;
showTime?: TimePickerProps;
showTime?: TimePickerProps | boolean;
}
assign(DatePicker, {

View File

@ -5,9 +5,10 @@ export interface DropDownProps {
trigger?: Array<'click' | 'hover'>;
overlay: React.ReactNode;
style?: React.CSSProperties;
onVisibleChange?: (visible: boolean) => void;
onVisibleChange?: (e: {visible: boolean}) => void;
visible?: boolean;
align?: Object;
getPopupContainer?: () => HTMLElement;
}
export default class Dropdown extends React.Component<DropDownProps, any> {

View File

@ -19,6 +19,9 @@ export { Breadcrumb };
import Button from './button';
export { Button };
import Calendar from './calendar';
export { Calendar };
import Card from './card';
export { Card };
@ -31,6 +34,30 @@ export { Carousel };
import Cascader from './cascader';
export { Cascader };
import Checkbox from './checkbox';
export { Checkbox };
import Col from './col';
export { Col };
import DatePicker from './date-picker';
export { DatePicker };
import Dropdown from './dropdown';
export { Dropdown };
import Form from './form';
export { Form };
import Icon from './icon';
export { Icon };
import Input from './input';
export { Input };
import InputNumber from './input-number';
export { InputNumber };
import LocaleProvider from './locale-provider';
export { LocaleProvider };
@ -64,6 +91,9 @@ export { Radio };
import Rate from './rate';
export { Rate };
import Row from './row';
export { Row };
import Select from './select';
export { Select };
@ -79,12 +109,18 @@ export { Steps };
import Switch from './switch';
export { Switch };
import Table from './table';
export { Table };
import Transfer from './transfer';
export { Transfer };
import Tree from './tree';
export { Tree };
import TreeSelect from './tree-select';
export { TreeSelect };
import Tabs from './tabs';
export { Tabs }
@ -102,3 +138,6 @@ export { Tooltip }
import Mention from './mention';
export { Mention };
import Uplaod from './upload';
export { Uplaod };

View File

@ -13,6 +13,7 @@ export interface InputNumberProps {
onChange?: (value: number) => void;
disabled?: boolean;
size?: 'large' | 'small' | 'default';
placeholder?: string;
}
export default class InputNumber extends React.Component<InputNumberProps, any> {

View File

@ -51,6 +51,7 @@ export interface InputProps {
onClick?: React.FormEventHandler;
onBlur?: React.FormEventHandler;
autosize?: boolean | AutoSizeType;
autoComplete?: 'on' | 'off';
}
export default class Input extends Component<InputProps, any> {

View File

@ -22,10 +22,10 @@ export interface ColProps {
offset?: number;
push?: number;
pull?: number;
xs?: ColSize;
sm?: ColSize;
md?: ColSize;
lg?: ColSize;
xs?: number | ColSize;
sm?: number | ColSize;
md?: number | ColSize;
lg?: number | ColSize;
prefixCls?: string;
}

View File

@ -11,7 +11,8 @@ export interface MentionProps {
notFoundContent?: any;
loading?: Boolean;
style?: Object;
defaultValue?: string;
defaultValue?: any;
value?: any;
className?: string;
multiLines?: Boolean;
}

View File

@ -53,7 +53,7 @@ function notice(
}());
}
type ConfigContent = React.ReactNode;
type ConfigContent = React.ReactNode | string;
type ConfigDuration = number;
type ConfigOnClose = () => void;

View File

@ -15,7 +15,7 @@ export interface ModalProps {
/** 确定按钮 loading*/
confirmLoading?: boolean;
/** 标题*/
title?: React.ReactNode;
title?: React.ReactNode | string;
/** 是否显示右上角的关闭按钮*/
closable?: boolean;
/** 点击确定回调*/

View File

@ -5,14 +5,15 @@ import assign from 'object-assign';
export interface ModalFuncProps {
visible?: boolean;
title?: React.ReactNode;
content?: React.ReactNode;
title?: React.ReactNode | string;
content?: React.ReactNode | string;
onOk?: (func: Function) => any;
onCancel?: (func: Function) => any;
width?: string | number;
iconClassName?: string;
okText?: string;
cancelText?: string;
iconType?: string;
}
Modal.info = function (props: ModalFuncProps) {
const config = assign({}, {

View File

@ -7,8 +7,8 @@ let notificationInstance;
let defaultDuration = 4.5;
export interface ArgsProps {
message: React.ReactNode;
description: React.ReactNode;
message: React.ReactNode | string;
description: React.ReactNode | string;
btn?: React.ReactNode;
key?: string;
onClose?: () => void;
@ -16,6 +16,11 @@ export interface ArgsProps {
icon?: React.ReactNode;
}
export interface ConfigProps {
top?: number;
duration?: number;
}
function getNotificationInstance(prefixCls) {
if (notificationInstance) {
return notificationInstance;
@ -96,7 +101,7 @@ const api = {
notificationInstance.removeNotice(key);
}
},
config(options) {
config(options: ConfigProps) {
if ('top' in options) {
defaultTop = options.top;
}

View File

@ -1,3 +1,4 @@
import Pagination from './Pagination';
export { PaginationProps } from './Pagination';
export default Pagination;

View File

@ -11,9 +11,10 @@ export interface PopconfirmProps {
/**
* Position of popup-container, options:`top`, `left`, `right`, `bottom`
*/
placement?: 'top' | 'left' | 'right' | 'bottom';
placement?: 'top' | 'left' | 'right' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' |
'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
/** Description of Popconfirm */
title: React.ReactNode;
title: React.ReactNode | string;
/** Callback when confirm */
onConfirm?: () => void;
/** Callback when cancel */
@ -30,6 +31,8 @@ export interface PopconfirmProps {
/** Style of overlay */
overlayStyle?: React.CSSProperties;
prefixCls?: string;
openClassName?: string;
arrowPointAtCenter?: boolean;
}
export interface PopconfirmContext {

View File

@ -14,7 +14,7 @@ export interface PopoverProps {
placement?: 'top' | 'left' | 'right' | 'bottom' | 'topLeft' | 'topRight' |
'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
/** title of popup-container */
title?: React.ReactNode;
title?: React.ReactNode | string;
/** classname of popup-container */
overlayClassName?: string;
/** Style of overlay */
@ -25,11 +25,13 @@ export interface PopoverProps {
/** callback when visible change */
onVisibleChange?: (visible: boolean) => void;
/** specify wrapper of popup-container */
getTooltipContainer?: (triggerNode: React.ReactNode) => React.ReactNode;
getTooltipContainer?: (triggerNode: React.ReactNode) => HTMLElement;
/** content of popup-container */
content?: React.ReactNode;
content?: React.ReactNode | string;
style?: React.CSSProperties;
transitionName?: string;
openClassName?: string;
arrowPointAtCenter?: boolean;
}
export default class Popover extends React.Component<PopoverProps, any> {

View File

@ -3,7 +3,8 @@ import { PropTypes } from 'react';
import RcSelect, { Option, OptGroup } from 'rc-select';
import classNames from 'classnames';
export type SelectValue = string | string[] | Array<{ key: string, label: React.ReactNode }>;
export type SelectValue = string | any[] | { key: string, label: React.ReactNode } |
Array<{ key: string, label: React.ReactNode }>;
export interface SelectProps {
prefixCls?: string;
@ -12,7 +13,7 @@ export interface SelectProps {
defaultValue?: SelectValue;
size?: 'default' | 'large' | 'small';
combobox?: boolean;
notFoundContent?: React.ReactNode;
notFoundContent?: React.ReactNode | string;
showSearch?: boolean;
transitionName?: string;
choiceTransitionName?: string;
@ -30,7 +31,7 @@ export interface SelectProps {
disabled?: boolean;
defaultActiveFirstOption?: boolean;
labelInValue?: boolean;
getPopupContainer?: (triggerNode: React.ReactNode) => React.ReactNode;
getPopupContainer?: (triggerNode: React.ReactNode) => React.ReactNode | HTMLElement;
style?: React.CSSProperties;
dropdownMenuStyle?: React.CSSProperties;
onChange?: (value) => void;

View File

@ -3,7 +3,7 @@ import RcTable from 'rc-table';
import Checkbox from '../checkbox';
import Radio from '../radio';
import FilterDropdown from './filterDropdown';
import Pagination from '../pagination';
import Pagination, { PaginationProps } from '../pagination';
import Icon from '../icon';
import Spin from '../spin';
import classNames from 'classnames';
@ -65,7 +65,7 @@ export interface TableProps {
prefixCls?: string;
dropdownPrefixCls?: string;
rowSelection?: TableRowSelection;
pagination?: any; // 等 Pagination 的 interface以便直接引用
pagination?: PaginationProps | boolean;
size?: 'default' | 'small';
dataSource?: Object[];
columns?: TableColumnConfig[];
@ -75,7 +75,7 @@ export interface TableProps {
defaultExpandedRowKeys?: string[];
expandedRowKeys?: string[];
expandIconAsCell?: boolean;
onChange?: (pagination: any, filters: string[], sorter: Object) => any;
onChange?: (pagination: PaginationProps | boolean, filters: string[], sorter: Object) => any;
loading?: boolean;
locale?: Object;
indentSize?: number;
@ -399,7 +399,7 @@ export default class Table extends React.Component<TableProps, any> {
}
// Controlled current prop will not respond user interaction
if (props.pagination && 'current' in props.pagination) {
if (props.pagination && 'current' in (props.pagination as Object)) {
newState.pagination = assign({}, pagination, {
current: this.state.pagination.current,
});
@ -501,7 +501,7 @@ export default class Table extends React.Component<TableProps, any> {
pagination,
};
// Controlled current prop will not respond user interaction
if (props.pagination && 'current' in props.pagination) {
if (props.pagination && 'current' in (props.pagination as Object)) {
newState.pagination = assign({}, pagination, {
current: this.state.pagination.current,
});

View File

@ -31,6 +31,7 @@ export interface TimePickerProps {
disabledSeconds?: Function;
style?: React.CSSProperties;
getPopupContainer?: (trigger: any) => any;
}
export interface TimePickerContext {

View File

@ -31,6 +31,7 @@ export interface TooltipProps {
overlay?: React.ReactNode;
openClassName?: string;
arrowPointAtCenter?: boolean;
getTooltipContainer: (triggerNode: React.ReactNode) => HTMLElement;
}
export default class Tooltip extends React.Component<TooltipProps, any> {

View File

@ -32,8 +32,9 @@ export interface TransferProps {
notFoundContent?: React.ReactNode | string;
footer?: (props: any) => any;
style?: React.CSSProperties;
filterOption: (filterText: any, item: any) => boolean;
filterOption: (inputValue: any, item: any) => boolean;
body?: (props: any) => any;
rowKey?: (record: any) => string;
}
export default class Transfer extends React.Component<TransferProps, any> {

View File

@ -27,16 +27,19 @@ export interface TreeSelectProps {
disabled?: boolean;
treeDefaultExpandAll?: boolean;
treeCheckable?: boolean | React.ReactNode;
filterTreeNode?: (treeNode: any) => boolean;
filterTreeNode?: (inputValue: string, treeNode: any) => boolean | boolean;
treeNodeFilterProp?: string;
treeNodeLabelProp?: string;
treeData?: Array<TreeData>;
treeDataSimpleMode?: boolean;
treeDataSimpleMode?: boolean | Object;
loadData?: (node: any) => void;
showCheckedStrategy?: 'SHOW_ALL' | 'SHOW_PARENT' | 'SHOW_CHILD';
className?: string;
prefixCls?: string;
notFoundContent?: React.ReactNode;
labelInValue?: boolean;
treeCheckStrictly?: boolean;
getPopupContainer?: (triggerNode: React.ReactNode) => HTMLElement;
}
export interface TreeSelectContext {

View File

@ -48,7 +48,7 @@ export interface TreeProps {
/** (受控)展开指定的树节点 */
expandedKeys?: Array<string>;
/** (受控)选中复选框的树节点 */
checkedKeys?: Array<string>;
checkedKeys?: Array<string> | { checked: Array<string>, halfChecked: Array<string> };
/** 默认选中复选框的树节点 */
defaultCheckedKeys?: Array<string>;
/** (受控)设置选中的树节点 */
@ -81,6 +81,7 @@ export interface TreeProps {
onDrop?: (options: AntTreeNodeMouseEvent) => void;
style?: React.CSSProperties;
prefixCls?: string;
filterTreeNode?: (node: AntTreeNode) => boolean;
}
export default class Tree extends React.Component<TreeProps, any> {

View File

@ -30,7 +30,7 @@ export interface UploadProps {
defaultFileList?: Array<File>;
fileList?: Array<File>;
action: string;
data?: Object;
data?: Object | ((File) => any);
headers?: HttpRequestHeader;
showUploadList?: boolean;
multiple?: boolean;