diff --git a/components/_util/splitObject.tsx b/components/_util/splitObject.tsx index 58884b0188..d1061f40b4 100644 --- a/components/_util/splitObject.tsx +++ b/components/_util/splitObject.tsx @@ -1,7 +1,7 @@ -export default function splitObject(obj, parts) : Array{ +export default function splitObject(obj, parts): Array { let left = {}; let right = {}; - Object.keys(obj).forEach((k)=> { + Object.keys(obj).forEach((k) => { if (parts.indexOf(k) !== -1) { left[k] = obj[k]; } else { @@ -9,4 +9,4 @@ export default function splitObject(obj, parts) : Array{ } }); return [left, right]; -} \ No newline at end of file +} diff --git a/components/affix/index.tsx b/components/affix/index.tsx index a54a8999cf..89318e86dc 100644 --- a/components/affix/index.tsx +++ b/components/affix/index.tsx @@ -40,11 +40,11 @@ export interface AffixProps { /** * 距离窗口顶部达到指定偏移量后触发 */ - offsetTop?: number, - offset?: number, - offsetBottom?: number, - style?: React.CSSProperties, - onChange?: (affixed?: boolean) => any, + offsetTop?: number; + offset?: number; + offsetBottom?: number; + style?: React.CSSProperties; + onChange?: (affixed?: boolean) => any; } export default class Affix extends React.Component { @@ -52,16 +52,16 @@ export default class Affix extends React.Component { resizeEvent: any; refs: { fixedNode: any; - } + }; static propTypes = { offsetTop: React.PropTypes.number, offsetBottom: React.PropTypes.number, - } + }; static defaultProps = { onChange() {}, - } + }; constructor(props) { super(props); diff --git a/components/alert/index.tsx b/components/alert/index.tsx index cd48e2dd8a..6a4f8464b6 100644 --- a/components/alert/index.tsx +++ b/components/alert/index.tsx @@ -10,7 +10,7 @@ export default class Alert extends React.Component { showIcon: false, onClose() {}, type: 'info', - } + }; constructor(props) { super(props); this.state = { diff --git a/components/badge/ScrollNumber.tsx b/components/badge/ScrollNumber.tsx index 7a5fd6d6bd..2d733fe2f1 100644 --- a/components/badge/ScrollNumber.tsx +++ b/components/badge/ScrollNumber.tsx @@ -20,7 +20,7 @@ export default class ScrollNumber extends React.Component { onAnimated() { }, height: 18, - } + }; static propTypes = { count: React.PropTypes.oneOfType([ @@ -30,7 +30,7 @@ export default class ScrollNumber extends React.Component { component: React.PropTypes.string, onAnimated: React.PropTypes.func, height: React.PropTypes.number, - } + }; constructor(props) { super(props); diff --git a/components/badge/index.tsx b/components/badge/index.tsx index d517db29e8..50a8d4cccb 100644 --- a/components/badge/index.tsx +++ b/components/badge/index.tsx @@ -9,7 +9,7 @@ export default class Badge extends React.Component { count: null, dot: false, overflowCount: 99, - } + }; static propTypes = { count: React.PropTypes.oneOfType([ @@ -18,7 +18,7 @@ export default class Badge extends React.Component { ]), dot: React.PropTypes.bool, overflowCount: React.PropTypes.number, - } + }; render() { let { count, prefixCls, overflowCount, className, style, children, dot } = this.props; diff --git a/components/breadcrumb/Breadcrumb.tsx b/components/breadcrumb/Breadcrumb.tsx index 0dbf4540fd..414ef8967a 100644 --- a/components/breadcrumb/Breadcrumb.tsx +++ b/components/breadcrumb/Breadcrumb.tsx @@ -19,7 +19,7 @@ export default class Breadcrumb extends React.Component { separator: '/', linkRender: (href, name) => {name}, nameRender: defaultNameRender, - } + }; static propTypes = { prefixCls: React.PropTypes.string, @@ -31,7 +31,7 @@ export default class Breadcrumb extends React.Component { params: React.PropTypes.object, linkRender: React.PropTypes.func, nameRender: React.PropTypes.func, - } + }; render() { let crumbs; diff --git a/components/breadcrumb/BreadcrumbItem.tsx b/components/breadcrumb/BreadcrumbItem.tsx index c51824ff21..4ea82e56b5 100644 --- a/components/breadcrumb/BreadcrumbItem.tsx +++ b/components/breadcrumb/BreadcrumbItem.tsx @@ -5,7 +5,7 @@ export default class BreadcrumbItem extends React.Component { static defaultProps = { prefixCls: 'ant-breadcrumb', separator: '/', - } + }; static propTypes = { prefixCls: React.PropTypes.string, @@ -14,10 +14,10 @@ export default class BreadcrumbItem extends React.Component { React.PropTypes.element, ]), href: React.PropTypes.string, - } + }; render() { - const [{prefixCls, separator, children},restProps] = splitObject(this.props, ['prefixCls', 'separator', 'children']); + const [{ prefixCls, separator, children }, restProps] = splitObject(this.props, ['prefixCls', 'separator', 'children']); let link; if ('href' in this.props) { link = {children}; diff --git a/components/button/button-group.tsx b/components/button/button-group.tsx index 7b98a1a8ab..ee445ea6a5 100644 --- a/components/button/button-group.tsx +++ b/components/button/button-group.tsx @@ -5,7 +5,7 @@ import splitObject from '../_util/splitObject'; const prefix = 'ant-btn-group-'; export default function ButtonGroup(props) { - const [{size, className},others] = splitObject(props, ['size', 'className']); + const [{ size, className }, others] = splitObject(props, ['size', 'className']); // large => lg // small => sm diff --git a/components/button/button.tsx b/components/button/button.tsx index aa8d74cd66..b6f32e5db5 100644 --- a/components/button/button.tsx +++ b/components/button/button.tsx @@ -29,7 +29,7 @@ export default class Button extends React.Component { prefixCls: 'ant-btn', onClick() {}, loading: false, - } + }; static propTypes = { type: React.PropTypes.string, @@ -40,7 +40,7 @@ export default class Button extends React.Component { loading: React.PropTypes.bool, className: React.PropTypes.string, icon: React.PropTypes.string, - } + }; componentWillUnmount() { if (this.clickedTimeout) { @@ -76,8 +76,8 @@ export default class Button extends React.Component { render() { const props = this.props; - const [{type, shape, size, className, htmlType, children, icon, loading, prefixCls}, others] = splitObject(props, - ['type', 'shape','size', 'className','htmlType', 'children','icon','loading','prefixCls']); + const [{ type, shape, size, className, htmlType, children, icon, loading, prefixCls }, others] = splitObject(props, + ['type', 'shape', 'size', 'className', 'htmlType', 'children', 'icon', 'loading', 'prefixCls']); // large => lg // small => sm diff --git a/components/calendar/Header.tsx b/components/calendar/Header.tsx index 1d51e7915f..f2f3a4d9d4 100644 --- a/components/calendar/Header.tsx +++ b/components/calendar/Header.tsx @@ -14,7 +14,7 @@ export default class Header extends React.Component { yearSelectTotal: 20, onValueChange: noop, onTypeChange: noop, - } + }; static propTypes = { value: PropTypes.object, @@ -26,7 +26,7 @@ export default class Header extends React.Component { prefixCls: PropTypes.string, selectPrefixCls: PropTypes.string, type: PropTypes.string, - } + }; getYearSelectElement(year) { const { yearSelectOffset, yearSelectTotal, locale, prefixCls, fullscreen } = this.props; diff --git a/components/calendar/index.tsx b/components/calendar/index.tsx index 15713f7f7e..677977aaab 100644 --- a/components/calendar/index.tsx +++ b/components/calendar/index.tsx @@ -10,7 +10,9 @@ import assign from 'object-assign'; function noop() { return null; } function zerofixed(v) { - if (v < 10) return `0${v}`; + if (v < 10) { + return `0${v}`; + } return `${v}`; } @@ -23,7 +25,7 @@ export default class Calendar extends React.Component { prefixCls: PREFIX_CLS, onPanelChange: noop, mode: 'month', - } + }; static propTypes = { monthCellRender: PropTypes.func, @@ -35,11 +37,11 @@ export default class Calendar extends React.Component { style: PropTypes.object, onPanelChange: PropTypes.func, value: PropTypes.instanceOf(Date), - } + }; static contextTypes = { antLocale: PropTypes.object, - } + }; constructor(props) { super(props); @@ -72,7 +74,7 @@ export default class Calendar extends React.Component { } // 统一合并为完整的 Locale const result = assign({}, locale, props.locale); - result.lang = assign({}, locale.lang,props.locale.lang); + result.lang = assign({}, locale.lang, props.locale.lang); return result; } diff --git a/components/carousel/index.tsx b/components/carousel/index.tsx index abbd8ea21c..5b75964cef 100644 --- a/components/carousel/index.tsx +++ b/components/carousel/index.tsx @@ -20,29 +20,29 @@ import * as React from 'react'; export type CarouselEffect = 'scrollx' | 'fade' // Carousel export interface CarouselProps { - /** 动画效果函数,可取 scrollx, fade*/ - effect?:CarouselEffect, - /** 是否显示面板指示点*/ - dots?:boolean, - /** 垂直显示*/ - vertical?:boolean, - /** 是否自动切换*/ - autoplay?:boolean, - /** 动画效果*/ - easing?:string, - /** 切换面板的回调*/ - beforeChange?:(from:number, to:number) => void, - /** 切换面板的回调*/ - afterChange?:(current:number) => void, + /** 动画效果函数,可取 scrollx, fade */ + effect?: CarouselEffect; + /** 是否显示面板指示点 */ + dots?: SlickCarouselboolean; + /** 垂直显示 */ + vertical?: boolean; + /** 是否自动切换 */ + autoplay?: boolean; + /** 动画效果 */ + easing?: string; + /** 切换面板的回调 */ + beforeChange?: (from: number, to: number) => void; + /** 切换面板的回调 */ + afterChange?: (current:number) => void; /** 行内样式 */ - style?:React.CSSProperties + style?: React.CSSProperties; } export default class Carousel extends React.Component { static defaultProps = { dots: true, arrows: false, - } + }; render() { let props = assign({}, this.props); diff --git a/components/cascader/index.tsx b/components/cascader/index.tsx index 82953a6e82..a6f37eecaf 100644 --- a/components/cascader/index.tsx +++ b/components/cascader/index.tsx @@ -8,47 +8,46 @@ import splitObject from '../_util/splitObject'; import omit from 'object.omit'; export interface CascaderOptionType { - value:string, - label:string, - disabled?:boolean, - children?:Array + value: string; + label: string; + disabled?: boolean; + children?: Array; } export type CascaderExpandTrigger = 'click' | 'hover' export interface CascaderProps { - /** 可选项数据源*/ - options:Array, - /** 默认的选中项*/ - defaultValue?:Array, - /** 指定选中项*/ - value?:Array, - /** 选择完成后的回调*/ - onChange?:(value:string, selectedOptions?:Array) => void, - /** 选择后展示的渲染函数*/ - displayRender?:(label:Array, selectedOptions?:Array) => React.ReactNode, - /** 自定义样式*/ - style?:React.CSSProperties, - /** 自定义类名*/ - className?:string, - /** 自定义浮层类名*/ - popupClassName?:string, + /** 可选项数据源 */ + options: Array; + /** 默认的选中项 */ + defaultValue?: Array; + /** 指定选中项 */ + value?: Array; + /** 选择完成后的回调 */ + onChange?: (value:string, selectedOptions?:Array) => void; + /** 选择后展示的渲染函数 */ + displayRender?: (label:Array, selectedOptions?:Array) => React.ReactNode; + /** 自定义样式 */ + style?: React.CSSProperties; + /** 自定义类名 */ + className?: string; + /** 自定义浮层类名 */ + popupClassName?: string; /** 浮层预设位置:`bottomLeft` `bottomRight` `topLeft` `topRight` */ - popupPlacement?:string, + popupPlacement?: string; /** 输入框占位文本*/ - placeholder?:string, + placeholder?: string; /** 输入框大小,可选 `large` `default` `small` */ - size?:string, + size?: string; /** 禁用*/ - disabled?:boolean, + disabled?: boolean; /** 是否支持清除*/ - allowClear?:boolean, + allowClear?: boolean; /** 次级菜单的展开方式,可选 'click' 和 'hover' */ - expandTrigger?:CascaderExpandTrigger, + expandTrigger?: CascaderExpandTrigger; /** 当此项为 true 时,点选每级菜单选项值都会发生变化 */ - changeOnSelect?:boolean, + changeOnSelect?: boolean; /** 浮层可见变化时回调 */ - onPopupVisibleChange?: (popupVisible: boolean) => void - + onPopupVisibleChange?: (popupVisible: boolean) => void; } export default class Cascader extends React.Component { @@ -63,7 +62,7 @@ export default class Cascader extends React.Component { disabled: false, allowClear: true, onPopupVisibleChange() {}, - } + }; constructor(props) { super(props); @@ -117,9 +116,9 @@ export default class Cascader extends React.Component { render() { const props = this.props; - const [{prefixCls, children, placeholder, size, disabled, - className, style, allowClear}, otherProps] = splitObject(props, - ['prefixCls', 'children','placeholder', 'size','disabled', 'className','style','allowClear']); + const [{ prefixCls, children, placeholder, size, disabled, + className, style, allowClear }, otherProps] = splitObject(props, + ['prefixCls', 'children', 'placeholder', 'size', 'disabled', 'className', 'style', 'allowClear']); const sizeCls = classNames({ 'ant-input-lg': size === 'large', diff --git a/components/checkbox/Group.tsx b/components/checkbox/Group.tsx index 50bedacceb..6fbd368210 100644 --- a/components/checkbox/Group.tsx +++ b/components/checkbox/Group.tsx @@ -4,24 +4,22 @@ import PureRenderMixin from 'react-addons-pure-render-mixin'; import assign from 'object-assign'; export interface CheckboxOptionType { - label:string, - value:string, - disabled?:boolean + label: string; + value: string; + disabled?: boolean; } export interface CheckboxGroupProps { - /** 默认选中的选项*/ - defaultValue?:Array, - /** 指定选中的选项*/ - value?:Array, - /** 指定可选项*/ - options?:Array | Array, - /** 变化时回调函数*/ - onChange?:(checkedValue:Array) => void, - - disabled?:boolean, - - style?:React.CSSProperties + /** 默认选中的选项 */ + defaultValue?: Array; + /** 指定选中的选项 */ + value?: Array; + /** 指定可选项 */ + options?: Array | Array; + /** 变化时回调函数 */ + onChange?: (checkedValue: Array) => void; + disabled?: boolean; + style?: React.CSSProperties; } export interface CheckboxGroupState { @@ -33,13 +31,13 @@ export default class CheckboxGroup extends React.Component { static Group = CheckboxGroup; static defaultProps = { prefixCls: 'ant-checkbox', - } + }; shouldComponentUpdate(...args) { return PureRenderMixin.shouldComponentUpdate.apply(this, args); } render() { - const [{ prefixCls, style, children, className },restProps] = splitObject(this.props, ['prefixCls', 'style', 'children', 'className']); + const [{ prefixCls, style, children, className }, restProps] = splitObject(this.props, ['prefixCls', 'style', 'children', 'className']); const classString = classNames({ [className]: !!className, [`${prefixCls}-wrapper`]: true, diff --git a/components/collapse/index.tsx b/components/collapse/index.tsx index 94f97e665e..18cbd5e2f7 100644 --- a/components/collapse/index.tsx +++ b/components/collapse/index.tsx @@ -2,24 +2,22 @@ import RcCollapse from 'rc-collapse'; import * as React from 'react'; export interface CollapseProps { - activeKey?:Array | string, + activeKey?: Array | string; /** 初始化选中面板的key */ - defaultActiveKey?:Array, + defaultActiveKey?: Array; /** accordion 为 true 的时候,一次只可以打开一个面板 */ - accordion?:boolean, - /** 切换面板的回调*/ - onChange?:(key:string) => void, - - style?:React.CSSProperties + accordion?:boolean; + /** 切换面板的回调 */ + onChange?: (key:string) => void; + style?: React.CSSProperties; } export interface CollapsePanelProps { /** 对应 activeKey */ - key:string, - /** 面板头内容*/ - header:React.ReactNode, - - style?:React.CSSProperties + key: string; + /** 面板头内容 */ + header: React.ReactNode; + style?: React.CSSProperties; } export class CollapsePanel extends React.Component { @@ -31,7 +29,7 @@ export default class Collapse extends React.Component { static defaultProps = { prefixCls: 'ant-collapse', - } + }; render() { return ; diff --git a/components/date-picker/Calendar.tsx b/components/date-picker/Calendar.tsx index 697f129010..ce7939bad1 100644 --- a/components/date-picker/Calendar.tsx +++ b/components/date-picker/Calendar.tsx @@ -6,7 +6,7 @@ export default class Calendar extends React.Component { static defaultProps = { locale: CalendarLocale, prefixCls: 'ant-calendar', - } + }; render() { return ; diff --git a/components/date-picker/RangePicker.tsx b/components/date-picker/RangePicker.tsx index 3389358370..fdb079fe36 100644 --- a/components/date-picker/RangePicker.tsx +++ b/components/date-picker/RangePicker.tsx @@ -8,7 +8,7 @@ import Icon from '../icon'; export default class RangePicker extends React.Component { static defaultProps = { defaultValue: [], - } + }; constructor(props) { super(props); diff --git a/components/date-picker/locale/en_US.tsx b/components/date-picker/locale/en_US.tsx index fb94a32939..345128852d 100644 --- a/components/date-picker/locale/en_US.tsx +++ b/components/date-picker/locale/en_US.tsx @@ -7,7 +7,7 @@ const locale = assign({}, GregorianCalendarLocale); locale.lang = assign({ placeholder: 'Select date', rangePlaceholder: ['Start date', 'End date'], -},CalendarLocale); +}, CalendarLocale); locale.timePickerLocale = assign({}, TimePickerLocale); diff --git a/components/date-picker/locale/ru_RU.tsx b/components/date-picker/locale/ru_RU.tsx index c6b233288c..80a46415fc 100644 --- a/components/date-picker/locale/ru_RU.tsx +++ b/components/date-picker/locale/ru_RU.tsx @@ -10,7 +10,7 @@ const locale = assign({}, GregorianCalendarLocale); locale.lang = assign({ placeholder: 'Выберите дату', rangePlaceholder: ['Начальная дата', 'Конечная дата'], -},CalendarLocale); +}, CalendarLocale); locale.timePickerLocale = assign({}, TimePickerLocale); diff --git a/components/dropdown/dropdown-button.tsx b/components/dropdown/dropdown-button.tsx index ebcef5b75e..acdacad89b 100644 --- a/components/dropdown/dropdown-button.tsx +++ b/components/dropdown/dropdown-button.tsx @@ -17,10 +17,10 @@ export default class DropdownButton extends React.Component { targetOffset: [0, 0], }, type: 'default', - } + }; render() { - const [{ type, overlay, trigger, align, children, className, onClick },restProps] = splitObject(this.props, + const [{ type, overlay, trigger, align, children, className, onClick }, restProps] = splitObject(this.props, ['type', 'overlay', 'trigger', 'align', 'children', 'className', 'onClick']); const cls = classNames({ 'ant-dropdown-button': true, diff --git a/components/dropdown/dropdown.tsx b/components/dropdown/dropdown.tsx index 36d6b74fb9..5c5b63baaa 100644 --- a/components/dropdown/dropdown.tsx +++ b/components/dropdown/dropdown.tsx @@ -8,12 +8,10 @@ export default class Dropdown extends React.Component { prefixCls: 'ant-dropdown', mouseEnterDelay: 0.15, mouseLeaveDelay: 0.1, - } + }; render() { - const [{overlay}, others] = splitObject(this.props, - ['overlay']); - + const [{ overlay }, others] = splitObject(this.props, ['overlay']); const menu = React.cloneElement(overlay, { openTransitionName: 'zoom-big', }); diff --git a/components/form/Form.tsx b/components/form/Form.tsx index e9eaa74abe..3436307e88 100644 --- a/components/form/Form.tsx +++ b/components/form/Form.tsx @@ -9,7 +9,7 @@ export default class Form extends React.Component { onSubmit(e) { e.preventDefault(); }, - } + }; static propTypes = { prefixCls: React.PropTypes.string, @@ -18,11 +18,11 @@ export default class Form extends React.Component { form: React.PropTypes.object, children: React.PropTypes.any, onSubmit: React.PropTypes.func, - } + }; static childContextTypes = { form: React.PropTypes.object, - } + }; shouldComponentUpdate(...args) { return PureRenderMixin.shouldComponentUpdate.apply(this, args); diff --git a/components/form/FormItem.tsx b/components/form/FormItem.tsx index f32edcefb7..7b9a9bf432 100644 --- a/components/form/FormItem.tsx +++ b/components/form/FormItem.tsx @@ -9,7 +9,7 @@ export default class FormItem extends React.Component { static defaultProps = { hasFeedback: false, prefixCls: 'ant-form', - } + }; static propTypes = { prefixCls: React.PropTypes.string, @@ -23,11 +23,11 @@ export default class FormItem extends React.Component { id: React.PropTypes.string, children: React.PropTypes.node, colon: React.PropTypes.bool - } + }; static contextTypes = { form: React.PropTypes.object, - } + }; shouldComponentUpdate(...args) { return PureRenderMixin.shouldComponentUpdate.apply(this, args); diff --git a/components/icon/index.tsx b/components/icon/index.tsx index 5dd177401b..54f5cee4ff 100644 --- a/components/icon/index.tsx +++ b/components/icon/index.tsx @@ -2,5 +2,5 @@ import * as React from 'react'; export default props => { const { type, className = '' } = props; - return + return ; }; diff --git a/components/input-number/index.tsx b/components/input-number/index.tsx index e5a64695b6..973026df01 100644 --- a/components/input-number/index.tsx +++ b/components/input-number/index.tsx @@ -7,11 +7,11 @@ export default class InputNumber extends React.Component { static defaultProps = { prefixCls: 'ant-input-number', step: 1, - } + }; render() { - const [{className, size}, others] = splitObject(this.props, - ['size','className']); + const [{ className, size }, others] = splitObject(this.props, + ['size', 'className']); const inputNumberClass = classNames({ [`${this.props.prefixCls}-lg`]: size === 'large', [`${this.props.prefixCls}-sm`]: size === 'small', diff --git a/components/input/Input.tsx b/components/input/Input.tsx index 4b736dbca5..e2fa35b90f 100644 --- a/components/input/Input.tsx +++ b/components/input/Input.tsx @@ -35,7 +35,7 @@ export default class Input extends Component { onPressEnter() {}, onKeyDown() {}, autosize: false, - } + }; static propTypes = { type: PropTypes.string, @@ -54,7 +54,7 @@ export default class Input extends Component { autosize: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]), onPressEnter: PropTypes.func, onKeyDown: PropTypes.func, - } + }; constructor(props) { super(props); diff --git a/components/layout/col.tsx b/components/layout/col.tsx index abf4370081..482dfb0231 100644 --- a/components/layout/col.tsx +++ b/components/layout/col.tsx @@ -5,9 +5,10 @@ import assign from 'object-assign'; const stringOrNumber = PropTypes.oneOfType([PropTypes.string, PropTypes.number]); const objectOrNumber = PropTypes.oneOfType([PropTypes.object, PropTypes.number]); import splitObject from '../_util/splitObject'; + export default function Col(props) { - const [{span, order, offset, push, pull, className, children}, others] = splitObject(props, - ['span', 'order','offset', 'push','pull', 'className','children']); + const [{ span, order, offset, push, pull, className, children }, others] = splitObject(props, + ['span', 'order', 'offset', 'push', 'pull', 'className', 'children']); let sizeClassObj = {}; ['xs', 'sm', 'md', 'lg'].forEach(size => { let sizeProps = {}; @@ -16,7 +17,7 @@ export default function Col(props) { } else if (typeof props[size] === 'object') { sizeProps = props[size] || {}; } - + delete others[size]; sizeClassObj = assign({}, sizeClassObj, { @@ -34,7 +35,7 @@ export default function Col(props) { [`ant-col-push-${push}`]: push, [`ant-col-pull-${pull}`]: pull, [className]: !!className, - },sizeClassObj)); + }, sizeClassObj)); return
{children}
; } diff --git a/components/layout/row.tsx b/components/layout/row.tsx index f745767ea4..25c215f424 100644 --- a/components/layout/row.tsx +++ b/components/layout/row.tsx @@ -5,7 +5,7 @@ import splitObject from '../_util/splitObject'; export default class Row extends React.Component { static defaultProps = { gutter: 0, - } + }; static propTypes = { type: React.PropTypes.string, align: React.PropTypes.string, @@ -13,10 +13,10 @@ export default class Row extends React.Component { className: React.PropTypes.string, children: React.PropTypes.node, gutter: React.PropTypes.number, - } + }; render() { - const [{type, justify, align, className, gutter, style, children}, others] = splitObject(this.props, - ['type', 'justify','align', 'className','gutter', 'style','children']); + const [{ type, justify, align, className, gutter, style, children }, others] = splitObject(this.props, + ['type', 'justify', 'align', 'className', 'gutter', 'style', 'children']); const classes = classNames({ 'ant-row': !type, [`ant-row-${type}`]: type, @@ -27,9 +27,11 @@ export default class Row extends React.Component { const rowStyle = gutter > 0 ? assign({}, { marginLeft: gutter / -2, marginRight: gutter / -2, - },style) : style; + }, style) : style; const cols = Children.map(children, col => { - if (!col) return null; + if (!col) { + return null; + } return cloneElement(col, { style: gutter > 0 ? assign({}, { diff --git a/components/locale-provider/index.tsx b/components/locale-provider/index.tsx index 84bed4978d..35a3c7636a 100644 --- a/components/locale-provider/index.tsx +++ b/components/locale-provider/index.tsx @@ -4,11 +4,11 @@ import { changeConfirmLocale } from '../modal/locale'; export default class LocaleProvider extends React.Component { static propTypes = { locale: React.PropTypes.object, - } + }; static childContextTypes = { antLocale: React.PropTypes.object, - } + }; getChildContext() { return { diff --git a/components/menu/index.tsx b/components/menu/index.tsx index 9c108efbc6..980e031b38 100644 --- a/components/menu/index.tsx +++ b/components/menu/index.tsx @@ -17,7 +17,7 @@ export default class Menu extends React.Component { onClose: noop, className: '', theme: 'light', // or dark - } + }; constructor(props) { super(props); this.state = { diff --git a/components/modal/Modal.tsx b/components/modal/Modal.tsx index 41dcdd1dcb..76578f06de 100644 --- a/components/modal/Modal.tsx +++ b/components/modal/Modal.tsx @@ -19,7 +19,7 @@ export default class Modal extends React.Component { maskTransitionName: 'fade', confirmLoading: false, visible: false, - } + }; static propTypes = { prefixCls: PropTypes.string, @@ -34,11 +34,11 @@ export default class Modal extends React.Component { footer: PropTypes.node, title: PropTypes.node, closable: PropTypes.bool, - } + }; static contextTypes = { antLocale: React.PropTypes.object, - } + }; handleCancel = (e) => { this.props.onCancel(e); diff --git a/components/notification/index.tsx b/components/notification/index.tsx index c4c0802d34..7c00dd8540 100644 --- a/components/notification/index.tsx +++ b/components/notification/index.tsx @@ -91,7 +91,7 @@ const api = { }; ['success', 'info', 'warning', 'error'].forEach((type) => { - api[type] = (args) => api.open(assign({}, args,{ icon: type })); + api[type] = (args) => api.open(assign({}, args, { icon: type })); }); api.warn = api.warning; diff --git a/components/pagination/Pagination.tsx b/components/pagination/Pagination.tsx index 5ee41c7c6f..496ada416c 100644 --- a/components/pagination/Pagination.tsx +++ b/components/pagination/Pagination.tsx @@ -9,11 +9,11 @@ export default class Pagination extends React.Component { locale: zhCN, className: '', prefixCls: 'ant-pagination', - } + }; static contextTypes = { antLocale: React.PropTypes.object, - } + }; render() { let className = this.props.className; diff --git a/components/popconfirm/index.tsx b/components/popconfirm/index.tsx index 899ebf4f9c..da820bba35 100644 --- a/components/popconfirm/index.tsx +++ b/components/popconfirm/index.tsx @@ -17,11 +17,11 @@ export default class Popconfirm extends React.Component { onConfirm: noop, onCancel: noop, onVisibleChange: noop, - } + }; static contextTypes = { antLocale: React.PropTypes.object, - } + }; constructor(props) { super(props); @@ -58,7 +58,7 @@ export default class Popconfirm extends React.Component { } render() { - const [{ title, placement, overlayStyle, trigger },restProps] = splitObject(this.props, + const [{ title, placement, overlayStyle, trigger }, restProps] = splitObject(this.props, ['title', 'placement', 'overlayStyle', 'trigger']); let { okText, cancelText } = this.props; if (this.context.antLocale && this.context.antLocale.Popconfirm) { diff --git a/components/popover/index.tsx b/components/popover/index.tsx index acfd153c6d..1bd9f52310 100644 --- a/components/popover/index.tsx +++ b/components/popover/index.tsx @@ -14,7 +14,7 @@ export default class Popover extends React.Component { mouseEnterDelay: 0.1, mouseLeaveDelay: 0.1, overlayStyle: {}, - } + }; render() { return ( diff --git a/components/progress/progress.tsx b/components/progress/progress.tsx index 68e182d523..068c2e7650 100644 --- a/components/progress/progress.tsx +++ b/components/progress/progress.tsx @@ -17,7 +17,7 @@ export default class Line extends React.Component { showInfo: true, trailColor: '#f3f3f3', prefixCls: 'ant-progress', - } + }; static propTypes = { status: PropTypes.oneOf(['normal', 'exception', 'active', 'success']), @@ -28,13 +28,13 @@ export default class Line extends React.Component { strokeWidth: PropTypes.number, trailColor: PropTypes.string, format: PropTypes.func, - } + }; render() { const [{ prefixCls, status, format, percent, trailColor, type, strokeWidth, width, className, showInfo - },restProps] = splitObject(this.props, + }, restProps] = splitObject(this.props, ['prefixCls', 'status', 'format', 'percent', 'trailColor', 'type', 'strokeWidth', 'width', 'className', 'showInfo']); const progressStatus = (parseInt(percent, 10) >= 100 && !('status' in this.props)) diff --git a/components/radio/group.tsx b/components/radio/group.tsx index b897201f49..dd2b8a8994 100644 --- a/components/radio/group.tsx +++ b/components/radio/group.tsx @@ -22,7 +22,7 @@ export default class RadioGroup extends React.Component { disabled: false, onChange() { }, - } + }; constructor(props) { super(props); let value; diff --git a/components/radio/radio.tsx b/components/radio/radio.tsx index 249260dfdb..42973900e2 100644 --- a/components/radio/radio.tsx +++ b/components/radio/radio.tsx @@ -6,7 +6,7 @@ import PureRenderMixin from 'react-addons-pure-render-mixin'; export default class Radio extends React.Component { static defaultProps = { prefixCls: 'ant-radio', - } + }; shouldComponentUpdate(...args) { return PureRenderMixin.shouldComponentUpdate.apply(this, args); } diff --git a/components/radio/radioButton.tsx b/components/radio/radioButton.tsx index f65a83f046..00256e9e74 100644 --- a/components/radio/radioButton.tsx +++ b/components/radio/radioButton.tsx @@ -4,7 +4,7 @@ import Radio from './radio'; export default class RadioButton extends React.Component { static defaultProps = { prefixCls: 'ant-radio-button', - } + }; render() { return ( diff --git a/components/select/index.tsx b/components/select/index.tsx index 375ad6fb60..6f098e1535 100644 --- a/components/select/index.tsx +++ b/components/select/index.tsx @@ -11,11 +11,11 @@ export default class Select extends React.Component { transitionName: 'slide-up', choiceTransitionName: 'zoom', showSearch: false, - } + }; static contextTypes = { antLocale: React.PropTypes.object, - } + }; render() { let { diff --git a/components/slider/index.tsx b/components/slider/index.tsx index 41c758d9e4..53290832e0 100644 --- a/components/slider/index.tsx +++ b/components/slider/index.tsx @@ -5,12 +5,12 @@ export default class Slider extends React.Component { static defaultProps = { prefixCls: 'ant-slider', tipTransitionName: 'zoom-down', - } + }; render() { const [{isIncluded, marks, index, defaultIndex}, others] = splitObject(this.props, ['isIncluded', 'marks', 'index', 'defaultIndex']); - + if (isIncluded !== undefined) { // 兼容 `isIncluded` others.included = isIncluded; diff --git a/components/spin/index.tsx b/components/spin/index.tsx index 611593a586..771fb5f870 100644 --- a/components/spin/index.tsx +++ b/components/spin/index.tsx @@ -10,7 +10,7 @@ export default class Spin extends React.Component { static defaultProps = { prefixCls: 'ant-spin', spinning: true, - } + }; constructor(props) { super(props); @@ -23,7 +23,7 @@ export default class Spin extends React.Component { static propTypes = { className: React.PropTypes.string, size: React.PropTypes.oneOf(['small', 'default', 'large']), - } + }; isNestedPattern() { return !!(this.props && this.props.children); @@ -67,7 +67,7 @@ export default class Spin extends React.Component { render() { const [{ className, size, prefixCls, tip - },restProps] = splitObject(this.props, + }, restProps] = splitObject(this.props, ['className', 'size', 'prefixCls', 'tip']); const { spinning } = this.state; diff --git a/components/steps/index.tsx b/components/steps/index.tsx index 22ccee353d..ecb7492364 100644 --- a/components/steps/index.tsx +++ b/components/steps/index.tsx @@ -8,7 +8,7 @@ export default class Steps extends React.Component { prefixCls: 'ant-steps', iconPrefix: 'ant', current: 0, - } + }; render() { return ( diff --git a/components/switch/index.tsx b/components/switch/index.tsx index 39a1d0ec3b..412c3e03b1 100644 --- a/components/switch/index.tsx +++ b/components/switch/index.tsx @@ -5,7 +5,7 @@ import classNames from 'classnames'; export default class Switch extends React.Component { static defaultProps = { prefixCls: 'ant-switch', - } + }; render() { const { prefixCls, size, className } = this.props; diff --git a/components/table/Table.tsx b/components/table/Table.tsx index 5669605688..8572972004 100644 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -44,7 +44,7 @@ export default class Table extends React.Component { bordered: React.PropTypes.bool, onChange: React.PropTypes.func, locale: React.PropTypes.object, - } + }; static defaultProps = { dataSource: [], @@ -58,11 +58,11 @@ export default class Table extends React.Component { indentSize: 20, onChange: noop, locale: {}, - } + }; static contextTypes = { antLocale: React.PropTypes.object, - } + }; constructor(props) { super(props); @@ -730,8 +730,7 @@ export default class Table extends React.Component { render() { const [{ style, className - },restProps] = splitObject(this.props, - ['style', 'className']); + }, restProps] = splitObject(this.props, ['style', 'className']); const data = this.getCurrentPageData(); let columns = this.renderRowSelection(); const expandIconAsCell = this.props.expandedRowRender && this.props.expandIconAsCell !== false; diff --git a/components/table/filterDropdown.tsx b/components/table/filterDropdown.tsx index 48197ac6b4..ac2274f339 100644 --- a/components/table/filterDropdown.tsx +++ b/components/table/filterDropdown.tsx @@ -9,7 +9,7 @@ export default class FilterMenu extends React.Component { static defaultProps = { handleFilter() {}, column: null, - } + }; constructor(props) { super(props); diff --git a/components/tag/index.tsx b/components/tag/index.tsx index 85c9574ad9..4702445508 100644 --- a/components/tag/index.tsx +++ b/components/tag/index.tsx @@ -7,24 +7,24 @@ import splitObject from '../_util/splitObject'; import omit from 'object.omit'; export interface TagProps { - /** 标签是否可以关闭*/ - closable?: boolean, - /** 关闭时的回调*/ - onClose?: Function, - /** 动画关闭后的回调*/ - afterClose?: Function, - /** 标签的色彩*/ - color?: string, - - style?: React.CSSProperties + /** 标签是否可以关闭 */ + closable?: boolean; + /** 关闭时的回调 */ + onClose?: Function; + /** 动画关闭后的回调 */ + afterClose?: Function; + /** 标签的色彩 */ + color?: string; + style?: React.CSSProperties; } + export default class Tag extends React.Component { static defaultProps = { prefixCls: 'ant-tag', closable: false, onClose() { }, afterClose() { }, - } + }; constructor(props) { super(props); @@ -37,7 +37,9 @@ export default class Tag extends React.Component { close = (e) => { this.props.onClose(e); - if (e.defaultPrevented) return; + if (e.defaultPrevented) { + return; + } const dom = ReactDOM.findDOMNode(this); dom.style.width = `${dom.getBoundingClientRect().width}px`; // It's Magic Code, don't know why @@ -62,7 +64,7 @@ export default class Tag extends React.Component { prefixCls, closable, color, className, children }, otherProps] = splitObject( this.props, - ['prefixCls', 'closable', 'color','className','children'] + ['prefixCls', 'closable', 'color', 'className', 'children'] ); const closeIcon = closable ? : ''; const classString = classNames({ diff --git a/components/time-picker/index.tsx b/components/time-picker/index.tsx index 45ec32fd0e..aafee077f5 100644 --- a/components/time-picker/index.tsx +++ b/components/time-picker/index.tsx @@ -8,30 +8,30 @@ import assign from 'object-assign'; // TimePicker export interface TimePickerProps { - /** 默认时间*/ - value?: string | Date, - /** 初始默认时间*/ - defaultValue?: string | Date, + /** 默认时间 */ + value?: string | Date; + /** 初始默认时间 */ + defaultValue?: string | Date; /** 展示的时间格式 : "HH:mm:ss"、"HH:mm"、"mm:ss" */ - format?: string, - /** 时间发生变化的回调*/ - onChange?: (Date: Date) => void, - /** 禁用全部操作*/ - disabled?: boolean, - /** 没有值的时候显示的内容*/ - placeholder?: string, - /** 国际化配置*/ - locale?: Object, - /** 隐藏禁止选择的选项*/ - hideDisabledOptions?: boolean, - /** 禁止选择部分小时选项*/ - disabledHours?: Function, - /** 禁止选择部分分钟选项*/ - disabledMinutes?: Function, - /** 禁止选择部分秒选项*/ - disabledSeconds?: Function, + format?: string; + /** 时间发生变化的回调 */ + onChange?: (Date: Date) => void; + /** 禁用全部操作 */ + disabled?: boolean; + /** 没有值的时候显示的内容 */ + placeholder?: string; + /** 国际化配置 */ + locale?: Object; + /** 隐藏禁止选择的选项 */ + hideDisabledOptions?: boolean; + /** 禁止选择部分小时选项 */ + disabledHours?: Function; + /** 禁止选择部分分钟选项 */ + disabledMinutes?: Function; + /** 禁止选择部分秒选项 */ + disabledSeconds?: Function; - style?: React.CSSProperties + style?: React.CSSProperties; } export default class TimePicker extends React.Component { static defaultProps = { @@ -50,11 +50,11 @@ export default class TimePicker extends React.Component { hideDisabledOptions: false, placement: 'bottomLeft', transitionName: 'slide-up', - } + }; static contextTypes = { antLocale: React.PropTypes.object, - } + }; getFormatter() { return new DateTimeFormat(this.props.format, this.getLocale().format); diff --git a/components/timeline/Timeline.tsx b/components/timeline/Timeline.tsx index 23c7cb4273..4cba0bb4db 100644 --- a/components/timeline/Timeline.tsx +++ b/components/timeline/Timeline.tsx @@ -4,15 +4,14 @@ import TimelineItem from './TimelineItem'; import splitObject from '../_util/splitObject'; export interface TimelineProps { - /** 指定最后一个幽灵节点是否存在或内容*/ - pending?: boolean | React.ReactNode, - - style?: React.CSSProperties + /** 指定最后一个幽灵节点是否存在或内容 */ + pending?: boolean | React.ReactNode; + style?: React.CSSProperties; } export default class Timeline extends React.Component { static defaultProps = { prefixCls: 'ant-timeline', - } + }; render() { const [{ diff --git a/components/timeline/TimelineItem.tsx b/components/timeline/TimelineItem.tsx index d6e16fc46f..16529c2f22 100644 --- a/components/timeline/TimelineItem.tsx +++ b/components/timeline/TimelineItem.tsx @@ -4,18 +4,19 @@ import splitObject from '../_util/splitObject'; // Timeline export interface TimeLineItemProps { - /** 指定圆圈颜色。*/ - color?: string, - dot?: React.ReactNode, - style?: React.CSSProperties + /** 指定圆圈颜色 */ + color?: string; + dot?: React.ReactNode; + style?: React.CSSProperties; } + export default class TimelineItem extends React.Component { static defaultProps = { prefixCls: 'ant-timeline', color: 'blue', last: false, pending: false, - } + }; render() { const [{ diff --git a/components/tooltip/index.tsx b/components/tooltip/index.tsx index 52c31e4d5d..21cfcddfc8 100644 --- a/components/tooltip/index.tsx +++ b/components/tooltip/index.tsx @@ -6,17 +6,18 @@ import getPlacements from '../popover/placements'; const placements = getPlacements({ verticalArrowShift: 8, }); + type PopoverPlacement = 'top' | 'left' | 'right' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom' // Tooltip export interface TooltipProps { /** 气泡框位置,可选 `top` `left` `right` `bottom` `topLeft` `topRight` `bottomLeft` `bottomRight` `leftTop` `leftBottom` `rightTop` `rightBottom`*/ - placement?: PopoverPlacement, - /** 提示文字*/ - title?: string | React.ReactNode, - - style?: React.CSSProperties + placement?: PopoverPlacement; + /** 提示文字 */ + title?: string | React.ReactNode; + style?: React.CSSProperties; } + export default class Tooltip extends React.Component { static defaultProps = { prefixCls: 'ant-tooltip', @@ -24,8 +25,8 @@ export default class Tooltip extends React.Component { transitionName: 'zoom-big', mouseEnterDelay: 0.1, mouseLeaveDelay: 0.1, - onVisibleChange() { }, - } + onVisibleChange() {}, + }; constructor(props) { super(props); diff --git a/components/transfer/index.tsx b/components/transfer/index.tsx index b284a95783..5ab41a672f 100644 --- a/components/transfer/index.tsx +++ b/components/transfer/index.tsx @@ -3,46 +3,44 @@ import List from './list'; import Operation from './operation'; import Search from './search'; import classNames from 'classnames'; -import assign from 'object-assign'; function noop() { } export interface TransferItem { - key:number | string, - title:string, - description?:string, - chosen:boolean, + key: number | string; + title: string; + description?: string; + chosen: boolean; } // Transfer export interface TransferProps { - /** 数据源*/ - dataSource:Array, - /** 每行数据渲染函数*/ - render?:(record:TransferItem) => any, - /** 显示在右侧框数据的key集合*/ - targetKeys:Array, - /** 变化时回调函数*/ - onChange?:(targetKeys:Array, direction:string, moveKeys:any) => void, - /** 两个穿梭框的自定义样式*/ - listStyle?:React.CSSProperties, + /** 数据源 */ + dataSource: Array; + /** 每行数据渲染函数 */ + render?: (record:TransferItem) => any; + /** 显示在右侧框数据的key集合 */ + targetKeys: Array; + /** 变化时回调函数 */ + onChange?: (targetKeys:Array, direction:string, moveKeys:any) => void; + /** 两个穿梭框的自定义样式 */ + listStyle?: React.CSSProperties; /** 自定义类*/ - className?:string, - /** 标题集合,顺序从左至右*/ - titles?:Array, - /** 操作文案集合,顺序从上至下*/ - operations?:Array, - /** 是否显示搜索框*/ - showSearch?:boolean, - /** 搜索框的默认值*/ - searchPlaceholder?:string, - /** 当列表为空时显示的内容*/ - notFoundContent?:React.ReactNode | string - /** 底部渲染函数*/ - footer?:(props:any) => any, - - style?:React.CSSProperties + className?: string; + /** 标题集合,顺序从左至右 */ + titles?: Array; + /** 操作文案集合,顺序从上至下 */ + operations?: Array; + /** 是否显示搜索框 */ + showSearch?: boolean; + /** 搜索框的默认值 */ + searchPlaceholder?: string; + /** 当列表为空时显示的内容 */ + notFoundContent?: React.ReactNode | string; + /** 底部渲染函数 */ + footer?: (props:any) => any; + style?: React.CSSProperties; } export default class Transfer extends React.Component { diff --git a/components/transfer/list.tsx b/components/transfer/list.tsx index 8993336e9d..fb65f2cb02 100644 --- a/components/transfer/list.tsx +++ b/components/transfer/list.tsx @@ -16,32 +16,32 @@ export function isRenderResultPlainObject(result) { } export interface TransferListProps { - prefixCls?: string, - /** 数据源 */ - dataSource: Array, - filter?: TransferItem, - /** 是否显示搜索框 */ - showSearch?: boolean, - /** 搜索框的默认值 */ - searchPlaceholder?: string, - /** 标题 */ - titleText?: string, - style?: React.CSSProperties, - handleFilter?: Function, - handleSelect?: Function, - handleSelectAll?: Function, - handleClear?: Function, - /** 每行渲染函数 */ - render?: Function, - /** 主体渲染函数 */ - body?: Function, - /** 底部渲染函数 */ - footer?: Function, - /** 选中项 */ - checkedKeys?: Array; - checkStatus?: boolean, - position?: string, - notFoundContent?: React.ReactNode | string, + prefixCls?: string; + /** 数据源 */ + dataSource: Array; + filter?: TransferItem; + /** 是否显示搜索框 */ + showSearch?: boolean; + /** 搜索框的默认值 */ + searchPlaceholder?: string; + /** 标题 */ + titleText?: string; + style?: React.CSSProperties; + handleFilter?: Function; + handleSelect?: Function; + handleSelectAll?: Function; + handleClear?: Function; + /** 每行渲染函数 */ + render?: Function; + /** 主体渲染函数 */ + body?: Function; + /** 底部渲染函数 */ + footer?: Function; + /** 选中项 */ + checkedKeys?: Array; + checkStatus?: boolean; + position?: string; + notFoundContent?: React.ReactNode | string; } export default class TransferList extends React.Component { diff --git a/components/transfer/operation.tsx b/components/transfer/operation.tsx index 77137803ad..64b70ed8b7 100644 --- a/components/transfer/operation.tsx +++ b/components/transfer/operation.tsx @@ -6,13 +6,13 @@ function noop() { } export interface TransferOperationProps { - className?: string, - leftArrowText?: string, - rightArrowText?: string, - moveToLeft?: Function, - moveToRight?: Function, - leftActive?: boolean, - rightActive?: boolean + className?: string; + leftArrowText?: string; + rightArrowText?: string; + moveToLeft?: Function; + moveToRight?: Function; + leftActive?: boolean; + rightActive?: boolean; } export default class TransferOperation extends React.Component { @@ -21,7 +21,7 @@ export default class TransferOperation extends React.Component void, - handleClear?: (e: React.MouseEvent) => void + prefixCls?: string; + placeholder?: string; + onChange?: (e: React.FormEvent) => void; + handleClear?: (e: React.MouseEvent) => void; value?: any; } @@ -16,7 +16,7 @@ export default class Search extends React.Component { placeholder: '', onChange: noop, handleClear: noop, - } + }; handleChange = (e) => { this.props.onChange(e); diff --git a/components/tree-select/index.tsx b/components/tree-select/index.tsx index c1e254af77..ea7bd86ab1 100644 --- a/components/tree-select/index.tsx +++ b/components/tree-select/index.tsx @@ -14,11 +14,11 @@ export default class TreeSelect extends React.Component { choiceTransitionName: 'zoom', showSearch: false, dropdownClassName: 'ant-select-tree-dropdown', - } + }; static contextTypes = { antLocale: React.PropTypes.object, - } + }; render() { const props = this.props; diff --git a/components/tree/index.tsx b/components/tree/index.tsx index 1fe50e238b..4053d9fef7 100644 --- a/components/tree/index.tsx +++ b/components/tree/index.tsx @@ -3,85 +3,81 @@ import RcTree from 'rc-tree'; import animation from '../_util/openAnimation'; export interface TreeNodeProps { - disabled?:boolean, - disableCheckbox?:boolean, - title?:string | React.ReactNode, - key?:string, - isLeaf?:boolean + disabled?: boolean; + disableCheckbox?: boolean; + title?: string | React.ReactNode; + key?: string; + isLeaf?: boolean; } export class TreeNode extends React.Component { } export interface TreeNodeEvent { - event:'check' | 'select', - node:TreeNode, - - checked?:boolean, - checkedNodes?:Array, - - selected?:boolean, - selectedNodes?:Array, + event: 'check' | 'select'; + node: TreeNode; + checked?: boolean; + checkedNodes?: Array; + selected?: boolean; + selectedNodes?: Array; } export interface TreeNodeMouseEvent { - node:TreeNode, - event:React.MouseEventHandler, + node: TreeNode; + event: React.MouseEventHandler; } export interface TreeProps { - showLine?:boolean, - className?:string, - /** 是否支持多选*/ - multiple?:boolean, + showLine?: boolean; + className?:string; + /** 是否支持多选 */ + multiple?:boolean; /**是否自动展开父节点 */ - autoExpandParent?:boolean, + autoExpandParent?: boolean; /**checkable状态下节点选择完全受控(父子节点选中状态不再关联)*/ - checkStrictly?:boolean, - /** 是否支持选中*/ - checkable?:boolean, - /** 默认展开所有树节点*/ - defaultExpandAll?:boolean, - /** 默认展开指定的树节点*/ - defaultExpandedKeys?:Array, - /** (受控)展开指定的树节点*/ - expandedKeys?:Array, - /** (受控)选中复选框的树节点*/ - checkedKeys?:Array, - /** 默认选中复选框的树节点*/ - defaultCheckedKeys?:Array, - /** (受控)设置选中的树节点*/ - selectedKeys?:Array, - /** 默认选中的树节点*/ - defaultSelectedKeys?:Array, + checkStrictly?: boolean; + /** 是否支持选中 */ + checkable?: boolean; + /** 默认展开所有树节点 */ + defaultExpandAll?: boolean; + /** 默认展开指定的树节点 */ + defaultExpandedKeys?: Array; + /** (受控)展开指定的树节点 */ + expandedKeys?: Array; + /** (受控)选中复选框的树节点 */ + checkedKeys?: Array; + /** 默认选中复选框的树节点 */ + defaultCheckedKeys?: Array; + /** (受控)设置选中的树节点 */ + selectedKeys?: Array; + /** 默认选中的树节点 */ + defaultSelectedKeys?: Array; /** 展开/收起节点时触发 */ - onExpand?:(expandedKeys:Array, {node: TreeNode, expanded: boolean}) => void | PromiseLike, - /** 点击复选框触发*/ - onCheck?:(checkedKeys:Array, e:TreeNodeEvent) => void, - /** 点击树节点触发*/ - onSelect?:(selectedKeys:Array, e:TreeNodeEvent) => void, + onExpand?: (expandedKeys: Array, {node: TreeNode, expanded: boolean}) => void | PromiseLike; + /** 点击复选框触发 */ + onCheck?: (checkedKeys: Array, e: TreeNodeEvent) => void; + /** 点击树节点触发 */ + onSelect?: (selectedKeys: Array, e: TreeNodeEvent) => void; /** filter some treeNodes as you need. it should return true */ - filterTreeNode?:(node:TreeNode) => boolean, - /** 异步加载数据*/ - loadData?:(node:TreeNode) => PromiseLike, - /** 响应右键点击*/ - onRightClick?:(options:TreeNodeMouseEvent) => void, + filterTreeNode?: (node: TreeNode) => boolean; + /** 异步加载数据 */ + loadData?: (node: TreeNode) => PromiseLike; + /** 响应右键点击 */ + onRightClick?: (options: TreeNodeMouseEvent) => void; /** 设置节点可拖拽(IE>8)*/ - draggable?:boolean, - /** 开始拖拽时调用*/ - onDragStart?:(options:TreeNodeMouseEvent) => void, - /** dragenter 触发时调用*/ - onDragEnter?:(options:TreeNodeMouseEvent) => void, + draggable?: boolean; + /** 开始拖拽时调用 */ + onDragStart?: (options:TreeNodeMouseEvent) => void; + /** dragenter 触发时调用 */ + onDragEnter?: (options:TreeNodeMouseEvent) => void; /** dragover 触发时调用 */ - onDragOver?:(options:TreeNodeMouseEvent) => void, - /** dragleave 触发时调用*/ - onDragLeave?:(options:TreeNodeMouseEvent) => void, - /** drop 触发时调用*/ - onDrop?:(options:TreeNodeMouseEvent) => void, - - style?:React.CSSProperties, - - prefixCls?: string + onDragOver?: (options:TreeNodeMouseEvent) => void; + /** dragleave 触发时调用 */ + onDragLeave?: (options:TreeNodeMouseEvent) => void; + /** drop 触发时调用 */ + onDrop?: (options:TreeNodeMouseEvent) => void; + style?: React.CSSProperties; + prefixCls?: string; } export default class Tree extends React.Component { @@ -92,13 +88,13 @@ export default class Tree extends React.Component { checkable: false, showIcon: false, openAnimation: animation, - } + }; render() { const props = this.props; let checkable = props.checkable; return ( - ) : checkable }> {this.props.children} diff --git a/components/upload/index.tsx b/components/upload/index.tsx index 4f848c8137..dcefba8600 100644 --- a/components/upload/index.tsx +++ b/components/upload/index.tsx @@ -72,7 +72,7 @@ export default class Upload extends React.Component { showUploadList: true, listType: 'text', // or pictrue className: '', - } + }; constructor(props) { super(props); @@ -83,7 +83,9 @@ export default class Upload extends React.Component { } onStart = (file) => { - if (this.recentUploadStatus === false) return; + if (this.recentUploadStatus === false) { + return; + } let targetItem; let nextFileList = this.state.fileList.concat(); diff --git a/package.json b/package.json index c0cbabea21..386e647175 100644 --- a/package.json +++ b/package.json @@ -132,7 +132,7 @@ "pre-deploy": "mkdir -p _site && cp CNAME _site", "deploy": "tnpm run clean && tnpm i && tnpm run just-deploy", "just-deploy": "tnpm run pre-deploy && bisheng gh-pages -c ./site/bisheng.config.js", - "lint": "npm run srclint && npm run demolint && npm run lesshint", + "lint": "npm run ts-lint && npm run demolint && npm run lesshint", "srclint": "RUN_ENV=SRC eslint test site scripts ./*.js --ext '.js,.jsx'", "ts-lint": "antd-tools run ts-lint", "demolint": "RUN_ENV=DEMO eslint components/*/demo/*.md --ext '.md'",