mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 20:49:53 +08:00
fix: some tsc errors (#2804)
This commit is contained in:
parent
5d39bd9c54
commit
5dcce12c2c
@ -3,7 +3,7 @@ import Select, { Option, OptGroup } from '../select';
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
export interface AutoCompleteProps {
|
export interface AutoCompleteProps {
|
||||||
size?: string;
|
size?: 'large' | 'small' | 'default';
|
||||||
className?: string;
|
className?: string;
|
||||||
notFoundContent?: Element;
|
notFoundContent?: Element;
|
||||||
dataSource: Array<any>;
|
dataSource: Array<any>;
|
||||||
|
@ -35,6 +35,7 @@ interface ButtonProps {
|
|||||||
shape?: ButtonShape;
|
shape?: ButtonShape;
|
||||||
size?: ButtonSize;
|
size?: ButtonSize;
|
||||||
onClick?: React.FormEventHandler;
|
onClick?: React.FormEventHandler;
|
||||||
|
onMouseUp?: React.FormEventHandler;
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
|
@ -1 +1,2 @@
|
|||||||
module.exports = require('../../date-picker/locale/en_US');
|
import en_US from '../../date-picker/locale/en_US';
|
||||||
|
export default en_US;
|
||||||
|
@ -1 +1,2 @@
|
|||||||
module.exports = require('../../date-picker/locale/ru_RU');
|
import ru_RU from '../../date-picker/locale/ru_RU';
|
||||||
|
export default ru_RU;
|
||||||
|
@ -1 +1,2 @@
|
|||||||
module.exports = require('../../date-picker/locale/zh_CN');
|
import zh_CN from '../../date-picker/locale/zh_CN';
|
||||||
|
export default zh_CN;
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
// https://github.com/WickyNilliams/enquire.js/issues/82
|
// https://github.com/WickyNilliams/enquire.js/issues/82
|
||||||
import assign from 'object-assign';
|
import assign from 'object-assign';
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
const matchMediaPolyfill = function matchMediaPolyfill() {
|
const matchMediaPolyfill = function matchMediaPolyfill(mediaQuery: string): MediaQueryList {
|
||||||
return {
|
return {
|
||||||
|
media: mediaQuery,
|
||||||
matches: false,
|
matches: false,
|
||||||
addListener() {
|
addListener() {
|
||||||
},
|
},
|
||||||
@ -23,7 +24,7 @@ export interface CarouselProps {
|
|||||||
/** 动画效果函数,可取 scrollx, fade */
|
/** 动画效果函数,可取 scrollx, fade */
|
||||||
effect?: CarouselEffect;
|
effect?: CarouselEffect;
|
||||||
/** 是否显示面板指示点 */
|
/** 是否显示面板指示点 */
|
||||||
dots?: SlickCarouselboolean;
|
dots?: boolean;
|
||||||
/** 垂直显示 */
|
/** 垂直显示 */
|
||||||
vertical?: boolean;
|
vertical?: boolean;
|
||||||
/** 是否自动切换 */
|
/** 是否自动切换 */
|
||||||
|
@ -59,6 +59,7 @@ export default class CheckboxGroup extends React.Component<CheckboxGroupProps, C
|
|||||||
}
|
}
|
||||||
getOptions() {
|
getOptions() {
|
||||||
const { options } = this.props;
|
const { options } = this.props;
|
||||||
|
// https://github.com/Microsoft/TypeScript/issues/7960
|
||||||
return options.map(option => {
|
return options.map(option => {
|
||||||
if (typeof option === 'string') {
|
if (typeof option === 'string') {
|
||||||
return {
|
return {
|
||||||
|
@ -60,10 +60,10 @@ export default function createPicker(TheCalendar) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 需要选择时间时,点击 ok 时才触发 onChange
|
// 需要选择时间时,点击 ok 时才触发 onChange
|
||||||
let pickerChangeHandler = {
|
let pickerChangeHandler: Object = {
|
||||||
onChange: this.handleChange,
|
onChange: this.handleChange,
|
||||||
};
|
};
|
||||||
let calendarHandler = {
|
let calendarHandler: Object = {
|
||||||
onOk: this.handleChange,
|
onOk: this.handleChange,
|
||||||
// fix https://github.com/ant-design/ant-design/issues/1902
|
// fix https://github.com/ant-design/ant-design/issues/1902
|
||||||
onSelect: (value, cause) => {
|
onSelect: (value, cause) => {
|
||||||
@ -95,7 +95,7 @@ export default function createPicker(TheCalendar) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// default width for showTime
|
// default width for showTime
|
||||||
const pickerStyle = {};
|
const pickerStyle = { width: undefined };
|
||||||
if (props.showTime) {
|
if (props.showTime) {
|
||||||
pickerStyle.width = 180;
|
pickerStyle.width = 180;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ export default function wrapPicker(Picker, defaultFormat?) {
|
|||||||
|
|
||||||
getFormatter() {
|
getFormatter() {
|
||||||
const format = this.props.format;
|
const format = this.props.format;
|
||||||
const formatter = new DateTimeFormat(format, this.getLocale().lang.format);
|
const formatter = new DateTimeFormat(format as string, this.getLocale().lang.format);
|
||||||
return formatter;
|
return formatter;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -28,31 +28,31 @@ export interface FormProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// function create
|
// function create
|
||||||
export type CreateFormOptions = {
|
export type WrappedFormUtils = {
|
||||||
/** 获取一组输入控件的值,如不传入参数,则获取全部组件的值*/
|
/** 获取一组输入控件的值,如不传入参数,则获取全部组件的值*/
|
||||||
getFieldsValue(): (fieldNames?: Array<string>) => any;
|
getFieldsValue(fieldNames?: Array<string>): Object;
|
||||||
/** 获取一个输入控件的值*/
|
/** 获取一个输入控件的值*/
|
||||||
getFieldValue(): (fieldName: string) => any;
|
getFieldValue(fieldName: string): any;
|
||||||
/** 设置一组输入控件的值*/
|
/** 设置一组输入控件的值*/
|
||||||
setFieldsValue(): (obj: Object) => void;
|
setFieldsValue(obj: Object): void;
|
||||||
/** 设置一组输入控件的值*/
|
/** 设置一组输入控件的值*/
|
||||||
setFields(): (obj: Object) => void;
|
setFields(obj: Object): void;
|
||||||
/** 校验并获取一组输入域的值与 Error*/
|
/** 校验并获取一组输入域的值与 Error*/
|
||||||
validateFields(): (fieldNames?: Array<string>, options?: Object, callback?: (erros: any, values: any) => void) => any;
|
validateFields(fieldNames?: Array<string>, options?: Object, callback?: (erros: any, values: any) => void): any;
|
||||||
/** 与 `validateFields` 相似,但校验完后,如果校验不通过的菜单域不在可见范围内,则自动滚动进可见范围 */
|
/** 与 `validateFields` 相似,但校验完后,如果校验不通过的菜单域不在可见范围内,则自动滚动进可见范围 */
|
||||||
validateFieldsAndScroll(): (
|
validateFieldsAndScroll(
|
||||||
fieldNames?: Array<string>,
|
fieldNames?: Array<string>,
|
||||||
options?: Object,
|
options?: Object,
|
||||||
callback?: (erros: any, values: any) => void
|
callback?: (erros: any, values: any) => void
|
||||||
) => any;
|
): void;
|
||||||
/** 获取某个输入控件的 Error */
|
/** 获取某个输入控件的 Error */
|
||||||
getFieldError(): (name: string) => Object;
|
getFieldError(name: string): Object[];
|
||||||
/** 判断一个输入控件是否在校验状态*/
|
/** 判断一个输入控件是否在校验状态*/
|
||||||
isFieldValidating(): (name: string) => Object;
|
isFieldValidating(name: string): boolean;
|
||||||
/**重置一组输入控件的值与状态,如不传入参数,则重置所有组件*/
|
/**重置一组输入控件的值与状态,如不传入参数,则重置所有组件*/
|
||||||
resetFields(): (names?: Array<string>) => void;
|
resetFields(names?: Array<string>): void;
|
||||||
|
|
||||||
getFieldsValue(): (id: string, options: {
|
getFieldProps(id: string, options: {
|
||||||
/** 子节点的值的属性,如 Checkbox 的是 'checked'*/
|
/** 子节点的值的属性,如 Checkbox 的是 'checked'*/
|
||||||
valuePropName?: string;
|
valuePropName?: string;
|
||||||
/** 子节点的初始值,类型、可选值均由子节点决定*/
|
/** 子节点的初始值,类型、可选值均由子节点决定*/
|
||||||
@ -65,11 +65,11 @@ export type CreateFormOptions = {
|
|||||||
rules?: Array<any>;
|
rules?: Array<any>;
|
||||||
/** 必填输入控件唯一标志*/
|
/** 必填输入控件唯一标志*/
|
||||||
id?: string;
|
id?: string;
|
||||||
}) => Array<any>;
|
}): Array<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FormComponentProps {
|
export interface FormComponentProps {
|
||||||
form: CreateFormOptions;
|
form: WrappedFormUtils;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FormComponent extends React.Component<FormComponentProps, {}> {
|
export class FormComponent extends React.Component<FormComponentProps, {}> {
|
||||||
|
@ -3,6 +3,7 @@ import classNames from 'classnames';
|
|||||||
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
||||||
import Row from '../row';
|
import Row from '../row';
|
||||||
import Col from '../col';
|
import Col from '../col';
|
||||||
|
import { WrappedFormUtils } from './Form';
|
||||||
import { FIELD_META_PROP } from './constants';
|
import { FIELD_META_PROP } from './constants';
|
||||||
|
|
||||||
export interface FormItemLabelColOption {
|
export interface FormItemLabelColOption {
|
||||||
@ -12,7 +13,8 @@ export interface FormItemLabelColOption {
|
|||||||
|
|
||||||
export interface FormItemProps {
|
export interface FormItemProps {
|
||||||
prefixCls?: string;
|
prefixCls?: string;
|
||||||
label?: React.ReactNode;
|
id?: string;
|
||||||
|
label?: string;
|
||||||
labelCol?: FormItemLabelColOption;
|
labelCol?: FormItemLabelColOption;
|
||||||
wrapperCol?: FormItemLabelColOption;
|
wrapperCol?: FormItemLabelColOption;
|
||||||
help?: React.ReactNode;
|
help?: React.ReactNode;
|
||||||
@ -22,6 +24,11 @@ export interface FormItemProps {
|
|||||||
className?: string;
|
className?: string;
|
||||||
required?: boolean;
|
required?: boolean;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
|
colon?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FormItemContext {
|
||||||
|
form: WrappedFormUtils;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class FormItem extends React.Component<FormItemProps, any> {
|
export default class FormItem extends React.Component<FormItemProps, any> {
|
||||||
@ -33,7 +40,7 @@ export default class FormItem extends React.Component<FormItemProps, any> {
|
|||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
prefixCls: React.PropTypes.string,
|
prefixCls: React.PropTypes.string,
|
||||||
label: React.PropTypes.node,
|
label: React.PropTypes.string,
|
||||||
labelCol: React.PropTypes.object,
|
labelCol: React.PropTypes.object,
|
||||||
help: React.PropTypes.oneOfType([React.PropTypes.node, React.PropTypes.bool]),
|
help: React.PropTypes.oneOfType([React.PropTypes.node, React.PropTypes.bool]),
|
||||||
validateStatus: React.PropTypes.oneOf(['', 'success', 'warning', 'error', 'validating']),
|
validateStatus: React.PropTypes.oneOf(['', 'success', 'warning', 'error', 'validating']),
|
||||||
@ -49,6 +56,8 @@ export default class FormItem extends React.Component<FormItemProps, any> {
|
|||||||
form: React.PropTypes.object,
|
form: React.PropTypes.object,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
context: FormItemContext;
|
||||||
|
|
||||||
shouldComponentUpdate(...args) {
|
shouldComponentUpdate(...args) {
|
||||||
return PureRenderMixin.shouldComponentUpdate.apply(this, args);
|
return PureRenderMixin.shouldComponentUpdate.apply(this, args);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import React, { PropTypes } from 'react';
|
import * as React from 'react';
|
||||||
|
import { PropTypes } from 'react';
|
||||||
import createDOMForm from 'rc-form/lib/createDOMForm';
|
import createDOMForm from 'rc-form/lib/createDOMForm';
|
||||||
import Form from './Form';
|
import Form from './Form';
|
||||||
import FormItem from './FormItem';
|
import FormItem from './FormItem';
|
||||||
|
@ -3,6 +3,7 @@ import * as React from 'react';
|
|||||||
export interface IconProps {
|
export interface IconProps {
|
||||||
type: string;
|
type: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
|
title?: string;
|
||||||
onClick?: (e) => void;
|
onClick?: (e) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,13 +2,13 @@ import * as React from 'react';
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
export interface GroupProps {
|
export interface GroupProps {
|
||||||
size?: 'large' | 'small' | 'default';
|
|
||||||
className?: string;
|
className?: string;
|
||||||
|
size?: 'large' | 'small' | 'default';
|
||||||
children?: any;
|
children?: any;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Group(props: GroupProps) {
|
const Group: React.StatelessComponent<GroupProps> = (props) => {
|
||||||
const className = classNames({
|
const className = classNames({
|
||||||
'ant-input-group': true,
|
'ant-input-group': true,
|
||||||
'ant-input-group-lg': props.size === 'large',
|
'ant-input-group-lg': props.size === 'large',
|
||||||
@ -20,8 +20,10 @@ export default function Group(props: GroupProps) {
|
|||||||
{props.children}
|
{props.children}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
Group.propTypes = {
|
Group.propTypes = {
|
||||||
children: React.PropTypes.any,
|
children: React.PropTypes.any,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default Group;
|
||||||
|
@ -34,21 +34,25 @@ interface AutoSizeType {
|
|||||||
|
|
||||||
export interface InputProps {
|
export interface InputProps {
|
||||||
prefixCls?: string;
|
prefixCls?: string;
|
||||||
|
className?: string;
|
||||||
type: string;
|
type: string;
|
||||||
id?: number | string;
|
id?: number | string;
|
||||||
value?: any;
|
value?: any;
|
||||||
defaultValue?: any;
|
defaultValue?: any;
|
||||||
|
placeholder?: string;
|
||||||
size?: 'large' | 'default' | 'small';
|
size?: 'large' | 'default' | 'small';
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
|
readOnly?: boolean;
|
||||||
addonBefore?: React.ReactNode;
|
addonBefore?: React.ReactNode;
|
||||||
addonAfter?: React.ReactNode;
|
addonAfter?: React.ReactNode;
|
||||||
onPressEnter?: (e) => any;
|
onPressEnter?: React.FormEventHandler;
|
||||||
onKeyDown?: (e) => any;
|
onKeyDown?: React.FormEventHandler;
|
||||||
onChange?: (e) => any;
|
onChange?: React.FormEventHandler;
|
||||||
autosize?: boolean | AutoSizeType;
|
autosize?: boolean | AutoSizeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Input extends Component<InputProps, any> {
|
export default class Input extends Component<InputProps, any> {
|
||||||
|
static Group: any;
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
defaultValue: '',
|
defaultValue: '',
|
||||||
disabled: false,
|
disabled: false,
|
||||||
@ -121,8 +125,8 @@ export default class Input extends Component<InputProps, any> {
|
|||||||
if (type !== 'textarea' || !autosize || !this.refs.input) {
|
if (type !== 'textarea' || !autosize || !this.refs.input) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const minRows = autosize ? autosize.minRows : null;
|
const minRows = autosize ? (autosize as AutoSizeType).minRows : null;
|
||||||
const maxRows = autosize ? autosize.maxRows : null;
|
const maxRows = autosize ? (autosize as AutoSizeType).maxRows : null;
|
||||||
const textareaStyles = calculateNodeHeight(this.refs.input, false, minRows, maxRows);
|
const textareaStyles = calculateNodeHeight(this.refs.input, false, minRows, maxRows);
|
||||||
this.setState({ textareaStyles });
|
this.setState({ textareaStyles });
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,11 @@ title:
|
|||||||
en-US: Search box
|
en-US: Search box
|
||||||
---
|
---
|
||||||
|
|
||||||
## zh-CN:
|
## zh-CN
|
||||||
|
|
||||||
带有搜索按钮的输入框。
|
带有搜索按钮的输入框。
|
||||||
|
|
||||||
## en-US:
|
## en-US
|
||||||
|
|
||||||
Example of creating a search box by grouping a standard input with a search button.
|
Example of creating a search box by grouping a standard input with a search button.
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { PropTypes } from 'react';
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import { PropTypes } from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import assign from 'object-assign';
|
import assign from 'object-assign';
|
||||||
|
import splitObject from '../_util/splitObject';
|
||||||
|
|
||||||
const stringOrNumber = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
|
const stringOrNumber = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
|
||||||
const objectOrNumber = PropTypes.oneOfType([PropTypes.object, PropTypes.number]);
|
const objectOrNumber = PropTypes.oneOfType([PropTypes.object, PropTypes.number]);
|
||||||
import splitObject from '../_util/splitObject';
|
|
||||||
|
|
||||||
interface ColSize {
|
interface ColSize {
|
||||||
span?: number;
|
span?: number;
|
||||||
@ -15,6 +16,7 @@ interface ColSize {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ColProps {
|
export interface ColProps {
|
||||||
|
className?: string;
|
||||||
span?: number;
|
span?: number;
|
||||||
order?: number;
|
order?: number;
|
||||||
offset?: number;
|
offset?: number;
|
||||||
@ -26,7 +28,7 @@ export interface ColProps {
|
|||||||
lg?: ColSize;
|
lg?: ColSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Col(props: ColProps) {
|
const Col: React.StatelessComponent<ColProps> = (props) => {
|
||||||
const [{ span, order, offset, push, pull, className, children }, others] = splitObject(props,
|
const [{ span, order, offset, push, pull, className, children }, others] = splitObject(props,
|
||||||
['span', 'order', 'offset', 'push', 'pull', 'className', 'children']);
|
['span', 'order', 'offset', 'push', 'pull', 'className', 'children']);
|
||||||
let sizeClassObj = {};
|
let sizeClassObj = {};
|
||||||
@ -58,7 +60,7 @@ export default function Col(props: ColProps) {
|
|||||||
}, sizeClassObj));
|
}, sizeClassObj));
|
||||||
|
|
||||||
return <div {...others} className={classes}>{children}</div>;
|
return <div {...others} className={classes}>{children}</div>;
|
||||||
}
|
};
|
||||||
|
|
||||||
Col.propTypes = {
|
Col.propTypes = {
|
||||||
span: stringOrNumber,
|
span: stringOrNumber,
|
||||||
@ -73,3 +75,5 @@ Col.propTypes = {
|
|||||||
md: objectOrNumber,
|
md: objectOrNumber,
|
||||||
lg: objectOrNumber,
|
lg: objectOrNumber,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default Col;
|
||||||
|
@ -5,10 +5,12 @@ import assign from 'object-assign';
|
|||||||
import splitObject from '../_util/splitObject';
|
import splitObject from '../_util/splitObject';
|
||||||
|
|
||||||
export interface RowProps {
|
export interface RowProps {
|
||||||
|
className?: string;
|
||||||
gutter?: number;
|
gutter?: number;
|
||||||
type?: 'flex';
|
type?: 'flex';
|
||||||
align?: 'top' | 'middle' | 'bottom';
|
align?: 'top' | 'middle' | 'bottom';
|
||||||
justify?: 'start' | 'end' | 'center' | 'space-around' | 'space-between';
|
justify?: 'start' | 'end' | 'center' | 'space-around' | 'space-between';
|
||||||
|
style?: React.CSSProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Row extends React.Component<RowProps, any> {
|
export default class Row extends React.Component<RowProps, any> {
|
||||||
@ -37,7 +39,7 @@ export default class Row extends React.Component<RowProps, any> {
|
|||||||
marginLeft: gutter / -2,
|
marginLeft: gutter / -2,
|
||||||
marginRight: gutter / -2,
|
marginRight: gutter / -2,
|
||||||
}, style) : style;
|
}, style) : style;
|
||||||
const cols = Children.map(children, col => {
|
const cols = Children.map(children, (col) => {
|
||||||
if (!col) {
|
if (!col) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,12 @@ import classNames from 'classnames';
|
|||||||
import { getConfirmLocale } from './locale';
|
import { getConfirmLocale } from './locale';
|
||||||
import assign from 'object-assign';
|
import assign from 'object-assign';
|
||||||
|
|
||||||
class ActionButton extends React.Component {
|
export interface ActionButtonProps {
|
||||||
|
type: 'primary' | 'ghost' | 'dashed';
|
||||||
|
actionFn: Function;
|
||||||
|
closeModal: Function;
|
||||||
|
}
|
||||||
|
class ActionButton extends React.Component<ActionButtonProps, any> {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
|
@ -1 +1,2 @@
|
|||||||
module.exports = require('rc-pagination/lib/locale/en_US');
|
import en_US from 'rc-pagination/lib/locale/en_US';
|
||||||
|
export default en_US;
|
||||||
|
@ -1 +1,2 @@
|
|||||||
module.exports = require('rc-pagination/lib/locale/zh_CN');
|
import zh_CN from 'rc-pagination/lib/locale/zh_CN';
|
||||||
|
export default zh_CN;
|
||||||
|
@ -42,6 +42,8 @@ export interface SelectContext {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export { Option, OptGroup }
|
||||||
|
|
||||||
export default class Select extends React.Component<SelectProps, any> {
|
export default class Select extends React.Component<SelectProps, any> {
|
||||||
static Option = Option;
|
static Option = Option;
|
||||||
static OptGroup = OptGroup;
|
static OptGroup = OptGroup;
|
||||||
|
@ -5,7 +5,11 @@ import Icon from '../icon';
|
|||||||
import Checkbox from '../checkbox';
|
import Checkbox from '../checkbox';
|
||||||
import Radio from '../radio';
|
import Radio from '../radio';
|
||||||
|
|
||||||
const FilterDropdownMenuWrapper = ({ onClick, children }) => (
|
export interface FilterDropdownMenuWrapperProps {
|
||||||
|
onClick?: Function;
|
||||||
|
children?: any;
|
||||||
|
}
|
||||||
|
const FilterDropdownMenuWrapper: React.StatelessComponent<FilterDropdownMenuWrapperProps> = ({ onClick, children }) => (
|
||||||
<div className="ant-table-filter-dropdown" onClick={onClick}>{children}</div>
|
<div className="ant-table-filter-dropdown" onClick={onClick}>{children}</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import * as ReactDOM from 'react-dom';
|
||||||
import Animate from 'rc-animate';
|
import Animate from 'rc-animate';
|
||||||
import Icon from '../icon';
|
import Icon from '../icon';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
@ -8,6 +8,7 @@ import assign from 'object-assign';
|
|||||||
|
|
||||||
// TimePicker
|
// TimePicker
|
||||||
export interface TimePickerProps {
|
export interface TimePickerProps {
|
||||||
|
size: 'large' | 'default' | 'small';
|
||||||
/** 默认时间 */
|
/** 默认时间 */
|
||||||
value?: string | Date;
|
value?: string | Date;
|
||||||
/** 初始默认时间 */
|
/** 初始默认时间 */
|
||||||
@ -15,7 +16,7 @@ export interface TimePickerProps {
|
|||||||
/** 展示的时间格式 : "HH:mm:ss"、"HH:mm"、"mm:ss" */
|
/** 展示的时间格式 : "HH:mm:ss"、"HH:mm"、"mm:ss" */
|
||||||
format?: string;
|
format?: string;
|
||||||
/** 时间发生变化的回调 */
|
/** 时间发生变化的回调 */
|
||||||
onChange?: (Date: Date) => void;
|
onChange?: (date: Date, dateString: string) => void;
|
||||||
/** 禁用全部操作 */
|
/** 禁用全部操作 */
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
/** 没有值的时候显示的内容 */
|
/** 没有值的时候显示的内容 */
|
||||||
@ -33,6 +34,13 @@ export interface TimePickerProps {
|
|||||||
|
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface TimePickerContext {
|
||||||
|
antLocale?: {
|
||||||
|
TimePicker?: any,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export default class TimePicker extends React.Component<TimePickerProps, any> {
|
export default class TimePicker extends React.Component<TimePickerProps, any> {
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
format: 'HH:mm:ss',
|
format: 'HH:mm:ss',
|
||||||
@ -56,8 +64,10 @@ export default class TimePicker extends React.Component<TimePickerProps, any> {
|
|||||||
antLocale: React.PropTypes.object,
|
antLocale: React.PropTypes.object,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
context: TimePickerContext;
|
||||||
|
|
||||||
getFormatter() {
|
getFormatter() {
|
||||||
return new DateTimeFormat(this.props.format, this.getLocale().format);
|
return new DateTimeFormat(this.props.format as string, this.getLocale().format);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -95,7 +105,7 @@ export default class TimePicker extends React.Component<TimePickerProps, any> {
|
|||||||
handleChange = (value) => {
|
handleChange = (value) => {
|
||||||
this.props.onChange(
|
this.props.onChange(
|
||||||
value ? new Date(value.getTime()) : null,
|
value ? new Date(value.getTime()) : null,
|
||||||
value ? this.getFormatter().format(value) : '',
|
value ? this.getFormatter().format(value) : ''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ export interface TimeLineItemProps {
|
|||||||
/** 指定圆圈颜色 */
|
/** 指定圆圈颜色 */
|
||||||
color?: string;
|
color?: string;
|
||||||
dot?: React.ReactNode;
|
dot?: React.ReactNode;
|
||||||
|
pending?: boolean;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ export interface TooltipProps {
|
|||||||
visible?: boolean;
|
visible?: boolean;
|
||||||
trigger?: 'hover' | 'focus' | 'click';
|
trigger?: 'hover' | 'focus' | 'click';
|
||||||
overlay?: React.ReactNode;
|
overlay?: React.ReactNode;
|
||||||
|
openClassName?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Tooltip extends React.Component<TooltipProps, any> {
|
export default class Tooltip extends React.Component<TooltipProps, any> {
|
||||||
|
33
custom-typings.d.ts
vendored
33
custom-typings.d.ts
vendored
@ -8,7 +8,7 @@ declare module 'react-addons-pure-render-mixin' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module 'gregorian-calendar-format' {
|
declare module 'gregorian-calendar-format' {
|
||||||
export default function({}): string;
|
export default function(format: string, localeFormat: Object): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'gregorian-calendar' {
|
declare module 'gregorian-calendar' {
|
||||||
@ -127,7 +127,7 @@ declare module 'rc-cascader' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module 'array-tree-filter' {
|
declare module 'array-tree-filter' {
|
||||||
export default function(): any;
|
export default function(tree: any, filter: any): any;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'rc-checkbox' {
|
declare module 'rc-checkbox' {
|
||||||
@ -143,16 +143,25 @@ declare module 'rc-dropdown' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module 'rc-editor-mention' {
|
declare module 'rc-editor-mention' {
|
||||||
export default function(): any;
|
export const Nav: any;
|
||||||
|
export const toString: any;
|
||||||
|
export const toEditorState: any;
|
||||||
|
export const getMentions: any;
|
||||||
|
const exports: any;
|
||||||
|
export default exports;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'rc-progress' {
|
declare module 'rc-progress' {
|
||||||
export default function(): any;
|
export const Circle: any;
|
||||||
|
const exports: any;
|
||||||
|
export default exports;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'rc-menu' {
|
declare module 'rc-menu' {
|
||||||
export const SubMenu: any;
|
export const SubMenu: any;
|
||||||
export const Item: any;
|
export const Item: any;
|
||||||
|
export const Divider: any;
|
||||||
|
export const ItemGroup: any;
|
||||||
export default function(): any;
|
export default function(): any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,11 +187,19 @@ declare module 'rc-input-number' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module 'rc-pagination' {
|
declare module 'rc-pagination' {
|
||||||
export default function(): any;
|
const exports: any;
|
||||||
|
export default exports;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'rc-pagination/lib/locale/zh_CN' {
|
||||||
|
const exports: any;
|
||||||
|
export default exports;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'rc-notification' {
|
declare module 'rc-notification' {
|
||||||
export default function(): any;
|
export function newInstance(config: Object): any;
|
||||||
|
const exports: any;
|
||||||
|
export default exports;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'rc-dialog' {
|
declare module 'rc-dialog' {
|
||||||
@ -228,7 +245,9 @@ declare module 'rc-upload' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module 'rc-collapse' {
|
declare module 'rc-collapse' {
|
||||||
export default function(): any;
|
export const Panel: any;
|
||||||
|
const exports: any;
|
||||||
|
export default exports;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'rc-form/lib/createDOMForm' {
|
declare module 'rc-form/lib/createDOMForm' {
|
||||||
|
@ -141,6 +141,7 @@
|
|||||||
"eslint-fix": "eslint --fix components test site scripts ./*.js --ext '.js,.jsx' && eslint-tinker ./components/*/demo/*.md",
|
"eslint-fix": "eslint --fix components test site scripts ./*.js --ext '.js,.jsx' && eslint-tinker ./components/*/demo/*.md",
|
||||||
"test": "npm run lint && npm run dist",
|
"test": "npm run lint && npm run dist",
|
||||||
"jest": "jest",
|
"jest": "jest",
|
||||||
|
"postinstall": "typings install",
|
||||||
"pre-publish": "node ./scripts/prepub",
|
"pre-publish": "node ./scripts/prepub",
|
||||||
"prepublish": "antd-tools run guard",
|
"prepublish": "antd-tools run guard",
|
||||||
"pub": "antd-tools run update-self && antd-tools run pub",
|
"pub": "antd-tools run update-self && antd-tools run pub",
|
||||||
|
Loading…
Reference in New Issue
Block a user