diff --git a/components/affix/index.tsx b/components/affix/index.tsx index d1db87e862..e99ca533b8 100644 --- a/components/affix/index.tsx +++ b/components/affix/index.tsx @@ -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; } diff --git a/components/auto-complete/index.tsx b/components/auto-complete/index.tsx index 8e92ccd1be..e408b9a0c7 100644 --- a/components/auto-complete/index.tsx +++ b/components/auto-complete/index.tsx @@ -2,6 +2,11 @@ import * as React from 'react'; import Select, { Option, OptGroup } from '../select'; import classNames from 'classnames'; +export 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 | SelectedValue | Array; + value?: string | Array | SelectedValue | Array; + allowClear?: boolean; + onChange?: (value) => void; + disabled?: boolean; } export default class AutoComplete extends React.Component { diff --git a/components/back-top/index.tsx b/components/back-top/index.tsx index c9feded350..23eb5eae86 100644 --- a/components/back-top/index.tsx +++ b/components/back-top/index.tsx @@ -53,6 +53,7 @@ export interface BackTopProps { target?: () => HTMLElement | Window; prefixCls?: string; className?: string; + style?: React.CSSProperties; } export default class BackTop extends React.Component { diff --git a/components/button/button.tsx b/components/button/button.tsx index 4228a26904..c2d77a9820 100644 --- a/components/button/button.tsx +++ b/components/button/button.tsx @@ -40,6 +40,7 @@ export interface ButtonProps { disabled?: boolean; style?: React.CSSProperties; prefixCls?: string; + className?: string; } export default class Button extends React.Component { diff --git a/components/date-picker/index.tsx b/components/date-picker/index.tsx index 5d4342129d..c98e71eb71 100644 --- a/components/date-picker/index.tsx +++ b/components/date-picker/index.tsx @@ -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; @@ -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, { diff --git a/components/dropdown/dropdown.tsx b/components/dropdown/dropdown.tsx index 53b6e5f576..1fd570ea74 100644 --- a/components/dropdown/dropdown.tsx +++ b/components/dropdown/dropdown.tsx @@ -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 { diff --git a/components/index.tsx b/components/index.tsx index 9a66fa252d..b78b105085 100644 --- a/components/index.tsx +++ b/components/index.tsx @@ -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 }; diff --git a/components/input-number/index.tsx b/components/input-number/index.tsx index fe0739a747..287649b7d9 100644 --- a/components/input-number/index.tsx +++ b/components/input-number/index.tsx @@ -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 { diff --git a/components/input/Input.tsx b/components/input/Input.tsx index 459fe0e4df..35aad743df 100644 --- a/components/input/Input.tsx +++ b/components/input/Input.tsx @@ -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 { diff --git a/components/layout/col.tsx b/components/layout/col.tsx index 92c4d66dc3..b45d7946d4 100644 --- a/components/layout/col.tsx +++ b/components/layout/col.tsx @@ -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; } diff --git a/components/mention/index.tsx b/components/mention/index.tsx index 1a995ef854..a401a271ca 100644 --- a/components/mention/index.tsx +++ b/components/mention/index.tsx @@ -11,7 +11,8 @@ export interface MentionProps { notFoundContent?: any; loading?: Boolean; style?: Object; - defaultValue?: string; + defaultValue?: any; + value?: any; className?: string; multiLines?: Boolean; } diff --git a/components/message/index.tsx b/components/message/index.tsx index 3d831ebc75..e65d72e7ba 100644 --- a/components/message/index.tsx +++ b/components/message/index.tsx @@ -53,7 +53,7 @@ function notice( }()); } -type ConfigContent = React.ReactNode; +type ConfigContent = React.ReactNode | string; type ConfigDuration = number; type ConfigOnClose = () => void; diff --git a/components/modal/Modal.tsx b/components/modal/Modal.tsx index 47b9e60279..97b68b0811 100644 --- a/components/modal/Modal.tsx +++ b/components/modal/Modal.tsx @@ -15,7 +15,7 @@ export interface ModalProps { /** 确定按钮 loading*/ confirmLoading?: boolean; /** 标题*/ - title?: React.ReactNode; + title?: React.ReactNode | string; /** 是否显示右上角的关闭按钮*/ closable?: boolean; /** 点击确定回调*/ diff --git a/components/modal/index.tsx b/components/modal/index.tsx index 15c355862c..ad333ef18f 100644 --- a/components/modal/index.tsx +++ b/components/modal/index.tsx @@ -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({}, { diff --git a/components/notification/index.tsx b/components/notification/index.tsx index e04f9a23e2..62186a03d7 100644 --- a/components/notification/index.tsx +++ b/components/notification/index.tsx @@ -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; } diff --git a/components/pagination/index.tsx b/components/pagination/index.tsx index 9ed530b1f6..864565605a 100644 --- a/components/pagination/index.tsx +++ b/components/pagination/index.tsx @@ -1,3 +1,4 @@ import Pagination from './Pagination'; +export { PaginationProps } from './Pagination'; export default Pagination; diff --git a/components/popconfirm/index.tsx b/components/popconfirm/index.tsx index 8a1b2c4004..bad50778a8 100644 --- a/components/popconfirm/index.tsx +++ b/components/popconfirm/index.tsx @@ -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 { diff --git a/components/popover/index.tsx b/components/popover/index.tsx index a2a2e5bed5..faecf6d59e 100644 --- a/components/popover/index.tsx +++ b/components/popover/index.tsx @@ -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 { diff --git a/components/select/index.tsx b/components/select/index.tsx index 738fb4bdeb..a41a59a354 100644 --- a/components/select/index.tsx +++ b/components/select/index.tsx @@ -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; diff --git a/components/table/Table.tsx b/components/table/Table.tsx index 4ffbb92df6..5f560e6846 100644 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -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 { } // 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 { 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, }); diff --git a/components/time-picker/index.tsx b/components/time-picker/index.tsx index eecffd1c60..5c524b08a7 100644 --- a/components/time-picker/index.tsx +++ b/components/time-picker/index.tsx @@ -31,6 +31,7 @@ export interface TimePickerProps { disabledSeconds?: Function; style?: React.CSSProperties; + getPopupContainer?: (trigger: any) => any; } export interface TimePickerContext { diff --git a/components/tooltip/index.tsx b/components/tooltip/index.tsx index 9601cf1de7..bf633400a1 100644 --- a/components/tooltip/index.tsx +++ b/components/tooltip/index.tsx @@ -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 { diff --git a/components/transfer/index.tsx b/components/transfer/index.tsx index 79e3148273..9da81af168 100644 --- a/components/transfer/index.tsx +++ b/components/transfer/index.tsx @@ -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 { diff --git a/components/tree-select/interface.tsx b/components/tree-select/interface.tsx index ca17c1b302..89ec41f69f 100644 --- a/components/tree-select/interface.tsx +++ b/components/tree-select/interface.tsx @@ -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; - 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 { diff --git a/components/tree/index.tsx b/components/tree/index.tsx index b1e9a93525..22c1de6e07 100644 --- a/components/tree/index.tsx +++ b/components/tree/index.tsx @@ -48,7 +48,7 @@ export interface TreeProps { /** (受控)展开指定的树节点 */ expandedKeys?: Array; /** (受控)选中复选框的树节点 */ - checkedKeys?: Array; + checkedKeys?: Array | { checked: Array, halfChecked: Array }; /** 默认选中复选框的树节点 */ defaultCheckedKeys?: Array; /** (受控)设置选中的树节点 */ @@ -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 { diff --git a/components/upload/interface.tsx b/components/upload/interface.tsx index 9b58bb2ff2..9e76fb1498 100644 --- a/components/upload/interface.tsx +++ b/components/upload/interface.tsx @@ -30,7 +30,7 @@ export interface UploadProps { defaultFileList?: Array; fileList?: Array; action: string; - data?: Object; + data?: Object | ((File) => any); headers?: HttpRequestHeader; showUploadList?: boolean; multiple?: boolean; diff --git a/package.json b/package.json index a070bdf187..f32bb67c70 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "2.0.0-beta.6", + "version": "2.0.0-beta.7", "title": "Ant Design", "description": "An enterprise-class UI design language and React-based implementation", "homepage": "http://ant.design/",