mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-30 22:39:34 +08:00
[WIP] upgrade deps (#5455)
* upgrade deps * autofix some tslint problems * Fix tslint problems manually
This commit is contained in:
parent
ab6e521ea2
commit
674255bd14
@ -34,7 +34,7 @@ export function cancelRequestAnimationFrame(id) {
|
||||
return window.cancelAnimationFrame(id);
|
||||
}
|
||||
const prefix = availablePrefixs.filter(key =>
|
||||
`${key}CancelAnimationFrame` in window || `${key}CancelRequestAnimationFrame` in window
|
||||
`${key}CancelAnimationFrame` in window || `${key}CancelRequestAnimationFrame` in window,
|
||||
)[0];
|
||||
|
||||
return prefix ?
|
||||
|
@ -171,7 +171,7 @@ export default class Affix extends React.Component<AffixProps, any> {
|
||||
} else {
|
||||
const { affixStyle } = this.state;
|
||||
if (e.type === 'resize' && affixStyle && affixStyle.position === 'fixed' && affixNode.offsetWidth) {
|
||||
this.setAffixStyle(e, {...affixStyle, width: affixNode.offsetWidth });
|
||||
this.setAffixStyle(e, { ...affixStyle, width: affixNode.offsetWidth });
|
||||
} else {
|
||||
this.setAffixStyle(e, null);
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ export default class ScrollNumber extends Component<ScrollNumberProps, any> {
|
||||
return createElement(
|
||||
this.props.component || 'sup',
|
||||
props,
|
||||
this.renderNumberElement()
|
||||
this.renderNumberElement(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ export default class Badge extends React.Component<BadgeProps, any> {
|
||||
|
||||
warning(
|
||||
!(children && status),
|
||||
'`Badge[children]` and `Badge[status]` cannot be used at the same time.'
|
||||
'`Badge[children]` and `Badge[status]` cannot be used at the same time.',
|
||||
);
|
||||
// <Badge status="success" />
|
||||
if (!children && status) {
|
||||
|
@ -21,7 +21,7 @@ function getBreadcrumbName(route, params) {
|
||||
const paramsKeys = Object.keys(params).join('|');
|
||||
const name = route.breadcrumbName.replace(
|
||||
new RegExp(`:(${paramsKeys})`, 'g'),
|
||||
(replacement, key) => params[key] || replacement
|
||||
(replacement, key) => params[key] || replacement,
|
||||
);
|
||||
return name;
|
||||
}
|
||||
@ -56,7 +56,7 @@ export default class Breadcrumb extends React.Component<BreadcrumbProps, any> {
|
||||
warning(
|
||||
!('linkRender' in props || 'nameRender' in props),
|
||||
'`linkRender` and `nameRender` are removed, please use `itemRender` instead, ' +
|
||||
'see: http://u.ant.design/item-render.'
|
||||
'see: http://u.ant.design/item-render.',
|
||||
);
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ export default class Breadcrumb extends React.Component<BreadcrumbProps, any> {
|
||||
}
|
||||
warning(
|
||||
element.type && element.type.__ANT_BREADCRUMB_ITEM,
|
||||
'Breadcrumb only accepts Breadcrumb.Item as it\'s children'
|
||||
'Breadcrumb only accepts Breadcrumb.Item as it\'s children',
|
||||
);
|
||||
return cloneElement(element, {
|
||||
separator,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
|
||||
export type ButtonSize = 'small' | 'large'
|
||||
export type ButtonSize = 'small' | 'large';
|
||||
|
||||
export interface ButtonGroupProps {
|
||||
size?: ButtonSize;
|
||||
|
@ -25,9 +25,9 @@ function insertSpace(child) {
|
||||
return child;
|
||||
}
|
||||
|
||||
export type ButtonType = 'primary' | 'ghost' | 'dashed' | 'danger'
|
||||
export type ButtonShape = 'circle' | 'circle-outline'
|
||||
export type ButtonSize = 'small' | 'large'
|
||||
export type ButtonType = 'primary' | 'ghost' | 'dashed' | 'danger';
|
||||
export type ButtonShape = 'circle' | 'circle-outline';
|
||||
export type ButtonSize = 'small' | 'large';
|
||||
|
||||
export interface ButtonProps {
|
||||
type?: ButtonType;
|
||||
|
@ -18,7 +18,7 @@ function zerofixed(v) {
|
||||
|
||||
export interface CalendarContext {
|
||||
antLocale?: {
|
||||
Calendar?: any
|
||||
Calendar?: any,
|
||||
};
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ export default class Calendar extends React.Component<CalendarProps, CalendarSta
|
||||
if (!moment.isMoment(value)) {
|
||||
throw new Error(
|
||||
'The value/defaultValue of Calendar must be a moment object after `antd@2.0`, ' +
|
||||
'see: http://u.ant.design/calendar-value'
|
||||
'see: http://u.ant.design/calendar-value',
|
||||
);
|
||||
}
|
||||
this.state = {
|
||||
|
@ -20,7 +20,7 @@ if (typeof window !== 'undefined') {
|
||||
import SlickCarousel from 'react-slick';
|
||||
import React from 'react';
|
||||
|
||||
export type CarouselEffect = 'scrollx' | 'fade'
|
||||
export type CarouselEffect = 'scrollx' | 'fade';
|
||||
// Carousel
|
||||
export interface CarouselProps {
|
||||
/** 动画效果函数,可取 scrollx, fade */
|
||||
|
@ -13,7 +13,7 @@ export interface CascaderOptionType {
|
||||
children?: Array<CascaderOptionType>;
|
||||
}
|
||||
|
||||
export type CascaderExpandTrigger = 'click' | 'hover'
|
||||
export type CascaderExpandTrigger = 'click' | 'hover';
|
||||
|
||||
export interface ShowSearchType {
|
||||
filter?: (inputValue: string, path: CascaderOptionType[]) => boolean;
|
||||
@ -109,7 +109,7 @@ export default class Cascader extends React.Component<CascaderProps, any> {
|
||||
refs: {
|
||||
[key: string]: any;
|
||||
input: {
|
||||
refs: { input: HTMLElement }
|
||||
refs: { input: HTMLElement },
|
||||
};
|
||||
};
|
||||
|
||||
@ -258,12 +258,13 @@ export default class Cascader extends React.Component<CascaderProps, any> {
|
||||
[`${inputPrefixCls}-lg`]: size === 'large',
|
||||
[`${inputPrefixCls}-sm`]: size === 'small',
|
||||
});
|
||||
const clearIcon = (allowClear && !disabled && value.length > 0) || state.inputValue ?
|
||||
const clearIcon = (allowClear && !disabled && value.length > 0) || state.inputValue ? (
|
||||
<Icon
|
||||
type="cross-circle"
|
||||
className={`${prefixCls}-picker-clear`}
|
||||
onClick={this.clearSelection}
|
||||
/> : null;
|
||||
/>
|
||||
) : null;
|
||||
const arrowCls = classNames({
|
||||
[`${prefixCls}-picker-arrow`]: true,
|
||||
[`${prefixCls}-picker-arrow-expand`]: state.popupVisible,
|
||||
|
@ -86,7 +86,7 @@ export default class CheckboxGroup extends React.Component<CheckboxGroupProps, C
|
||||
}
|
||||
render() {
|
||||
const { prefixCls, className } = this.props;
|
||||
const options = this.getOptions().map(option =>
|
||||
const options = this.getOptions().map(option => (
|
||||
<Checkbox
|
||||
disabled={'disabled' in option ? option.disabled : this.props.disabled}
|
||||
checked={this.state.value.indexOf(option.value) !== -1}
|
||||
@ -96,7 +96,7 @@ export default class CheckboxGroup extends React.Component<CheckboxGroupProps, C
|
||||
>
|
||||
{option.label}
|
||||
</Checkbox>
|
||||
);
|
||||
));
|
||||
|
||||
const classString = classNames(prefixCls, className);
|
||||
return (
|
||||
|
@ -27,7 +27,7 @@ export default class RangePicker extends React.Component<any, any> {
|
||||
) {
|
||||
throw new Error(
|
||||
'The value/defaultValue of RangePicker must be a moment object array after `antd@2.0`, ' +
|
||||
'see: http://u.ant.design/date-picker-value'
|
||||
'see: http://u.ant.design/date-picker-value',
|
||||
);
|
||||
}
|
||||
this.state = {
|
||||
@ -76,7 +76,7 @@ export default class RangePicker extends React.Component<any, any> {
|
||||
}
|
||||
}
|
||||
|
||||
handleShowDateChange = showDate => this.setState({ showDate })
|
||||
handleShowDateChange = showDate => this.setState({ showDate });
|
||||
|
||||
setValue(value) {
|
||||
this.handleChange(value);
|
||||
@ -170,12 +170,13 @@ export default class RangePicker extends React.Component<any, any> {
|
||||
pickerStyle.width = (style && style.width) || 300;
|
||||
}
|
||||
|
||||
const clearIcon = (!props.disabled && props.allowClear && value && (value[0] || value[1]))
|
||||
? <Icon
|
||||
const clearIcon = (!props.disabled && props.allowClear && value && (value[0] || value[1])) ? (
|
||||
<Icon
|
||||
type="cross-circle"
|
||||
className={`${prefixCls}-picker-clear`}
|
||||
onClick={this.clearSelection}
|
||||
/> : null;
|
||||
/>
|
||||
) : null;
|
||||
|
||||
const input = ({ value: inputValue }) => {
|
||||
const start = inputValue[0];
|
||||
|
@ -34,7 +34,7 @@ export default function createPicker(TheCalendar) {
|
||||
if (value && !moment.isMoment(value)) {
|
||||
throw new Error(
|
||||
'The value/defaultValue of DatePicker or MonthPicker must be ' +
|
||||
'a moment object after `antd@2.0`, see: http://u.ant.design/date-picker-value'
|
||||
'a moment object after `antd@2.0`, see: http://u.ant.design/date-picker-value',
|
||||
);
|
||||
}
|
||||
return {
|
||||
@ -117,12 +117,13 @@ export default function createPicker(TheCalendar) {
|
||||
pickerStyle.width = (props.style && props.style.width) || 154;
|
||||
}
|
||||
|
||||
const clearIcon = (!props.disabled && props.allowClear && value) ?
|
||||
const clearIcon = (!props.disabled && props.allowClear && value) ? (
|
||||
<Icon
|
||||
type="cross-circle"
|
||||
className={`${prefixCls}-picker-clear`}
|
||||
onClick={this.clearSelection}
|
||||
/> : null;
|
||||
/>
|
||||
) : null;
|
||||
|
||||
const input = ({ value: inputValue }) => (
|
||||
<span>
|
||||
|
@ -54,9 +54,9 @@ export default function wrapPicker(Picker, defaultFormat?) {
|
||||
warning(
|
||||
false,
|
||||
'`toggleOpen` is deprecated and will be removed in the future, ' +
|
||||
'please use `onOpenChange` instead, see: http://u.ant.design/date-picker-on-open-change'
|
||||
'please use `onOpenChange` instead, see: http://u.ant.design/date-picker-on-open-change',
|
||||
);
|
||||
toggleOpen({open});
|
||||
toggleOpen({ open });
|
||||
}
|
||||
},
|
||||
|
||||
@ -75,7 +75,7 @@ export default function wrapPicker(Picker, defaultFormat?) {
|
||||
|
||||
const locale = getComponentLocale(
|
||||
props, this.context, 'DatePicker',
|
||||
() => require('./locale/zh_CN')
|
||||
() => require('./locale/zh_CN'),
|
||||
);
|
||||
|
||||
const timeFormat = (props.showTime && props.showTime.format) || 'HH:mm:ss';
|
||||
|
@ -72,7 +72,7 @@ export type WrappedFormUtils = {
|
||||
/** 是否和其他控件互斥,特别用于 Radio 单选控件 */
|
||||
exclusive?: boolean;
|
||||
}): (node: React.ReactNode) => React.ReactNode;
|
||||
}
|
||||
};
|
||||
|
||||
export interface FormComponentProps {
|
||||
form?: WrappedFormUtils;
|
||||
@ -136,7 +136,7 @@ export default class Form extends React.Component<FormProps, any> {
|
||||
warning(
|
||||
false,
|
||||
'`getFieldProps` is not recommended, please use `getFieldDecorator` instead, ' +
|
||||
'see: http://u.ant.design/get-field-decorator'
|
||||
'see: http://u.ant.design/get-field-decorator',
|
||||
);
|
||||
return this.__getFieldProps(name, option);
|
||||
},
|
||||
@ -150,7 +150,7 @@ export default class Form extends React.Component<FormProps, any> {
|
||||
return <Component {...this.props} {...withRef} />;
|
||||
},
|
||||
}));
|
||||
};
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
@ -177,7 +177,7 @@ export default class Form extends React.Component<FormProps, any> {
|
||||
} = this.props;
|
||||
warning(
|
||||
!inline && !horizontal && !vertical,
|
||||
'`Form[inline|horizontal|vertical]` is deprecated, please use `Form[layout]` instead.'
|
||||
'`Form[inline|horizontal|vertical]` is deprecated, please use `Form[layout]` instead.',
|
||||
);
|
||||
const formClassName = classNames(prefixCls, {
|
||||
[`${prefixCls}-horizontal`]: (!inline && !vertical && layout === 'horizontal') || horizontal,
|
||||
|
@ -65,7 +65,7 @@ export default class FormItem extends React.Component<FormItemProps, any> {
|
||||
warning(
|
||||
this.getControls(this.props.children, true).length <= 1,
|
||||
'`Form.Item` cannot generate `validateStatus` and `help` automatically, ' +
|
||||
'while there are more than one `getFieldDecorator` in it.'
|
||||
'while there are more than one `getFieldDecorator` in it.',
|
||||
);
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ export default class FormItem extends React.Component<FormItemProps, any> {
|
||||
'has-warning': validateStatus === 'warning',
|
||||
'has-error': validateStatus === 'error',
|
||||
'is-validating': validateStatus === 'validating',
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
return (
|
||||
@ -256,8 +256,8 @@ export default class FormItem extends React.Component<FormItemProps, any> {
|
||||
this.renderValidateWrapper(
|
||||
children,
|
||||
this.renderHelp(),
|
||||
this.renderExtra()
|
||||
)
|
||||
this.renderExtra(),
|
||||
),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ if (ENV !== 'production' && ENV !== 'test') {
|
||||
warning(
|
||||
false,
|
||||
'You are using a whole package of antd,' +
|
||||
'please use https://www.npmjs.com/package/babel-plugin-import to reduce app bundle size.'
|
||||
'please use https://www.npmjs.com/package/babel-plugin-import to reduce app bundle size.',
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ export default class Input extends Component<InputProps, any> {
|
||||
className={inputClassName}
|
||||
onKeyDown={this.handleKeyDown}
|
||||
ref="input"
|
||||
/>
|
||||
/>,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ export default function calculateNodeHeight(
|
||||
uiTextNode,
|
||||
useCache = false,
|
||||
minRows: number | null = null,
|
||||
maxRows: number | null = null
|
||||
maxRows: number | null = null,
|
||||
) {
|
||||
if (!hiddenTextarea) {
|
||||
hiddenTextarea = document.createElement('textarea');
|
||||
|
@ -136,10 +136,11 @@ export default class Sider extends React.Component<SiderProps, any> {
|
||||
'defaultCollapsed', 'onCollapse', 'breakpoint']);
|
||||
const siderWidth = this.state.collapsed ? collapsedWidth : width;
|
||||
// special trigger when collapsedWidth == 0
|
||||
const zeroWidthTrigger = collapsedWidth === 0 || collapsedWidth === '0' ?
|
||||
(<span onClick={this.toggle} className={`${prefixCls}-zero-width-trigger`}>
|
||||
const zeroWidthTrigger = collapsedWidth === 0 || collapsedWidth === '0' ? (
|
||||
<span onClick={this.toggle} className={`${prefixCls}-zero-width-trigger`}>
|
||||
<Icon type="bars" />
|
||||
</span>) : null;
|
||||
</span>
|
||||
) : null;
|
||||
const iconObj = {
|
||||
'expanded': reverseArrow ? <Icon type="right" /> : <Icon type="left" />,
|
||||
'collapsed': reverseArrow ? <Icon type="left" /> : <Icon type="right" />,
|
||||
@ -148,11 +149,11 @@ export default class Sider extends React.Component<SiderProps, any> {
|
||||
const defaultTrigger = iconObj[status];
|
||||
const triggerDom = (
|
||||
trigger !== null ?
|
||||
zeroWidthTrigger ||
|
||||
(<div className={`${prefixCls}-trigger`} onClick={this.toggle}>
|
||||
{trigger || defaultTrigger}
|
||||
</div>)
|
||||
: null
|
||||
zeroWidthTrigger || (
|
||||
<div className={`${prefixCls}-trigger`} onClick={this.toggle}>
|
||||
{trigger || defaultTrigger}
|
||||
</div>
|
||||
) : null
|
||||
);
|
||||
const divStyle = {
|
||||
...style,
|
||||
|
@ -72,7 +72,7 @@ export default class Mention extends React.Component<MentionProps, MentionState>
|
||||
defaultSearchChange(value: String): void {
|
||||
const searchValue = value.toLowerCase();
|
||||
const filteredSuggestions = (this.props.suggestions || []).filter(
|
||||
suggestion => suggestion.toLowerCase().indexOf(searchValue) !== -1
|
||||
suggestion => suggestion.toLowerCase().indexOf(searchValue) !== -1,
|
||||
);
|
||||
this.setState({
|
||||
suggestions: filteredSuggestions,
|
||||
|
@ -57,7 +57,7 @@ export default class Menu extends React.Component<MenuProps, any> {
|
||||
warning(
|
||||
!('onOpen' in props || 'onClose' in props),
|
||||
'`onOpen` and `onClose` are removed, please use `onOpenChange` instead, ' +
|
||||
'see: http://u.ant.design/menu-on-open-change.'
|
||||
'see: http://u.ant.design/menu-on-open-change.',
|
||||
);
|
||||
|
||||
let openKeys;
|
||||
|
@ -57,8 +57,8 @@ export interface ModalFuncProps {
|
||||
iconType?: string;
|
||||
}
|
||||
export type ModalFunc = (props: ModalFuncProps) => {
|
||||
destroy: () => void
|
||||
}
|
||||
destroy: () => void,
|
||||
};
|
||||
|
||||
export default class Modal extends React.Component<ModalProps, any> {
|
||||
static info: ModalFunc;
|
||||
@ -138,14 +138,15 @@ export default class Modal extends React.Component<ModalProps, any> {
|
||||
cancelText = cancelText || this.context.antLocale.Modal.cancelText;
|
||||
}
|
||||
|
||||
const defaultFooter = [
|
||||
const defaultFooter = [(
|
||||
<Button
|
||||
key="cancel"
|
||||
size="large"
|
||||
onClick={this.handleCancel}
|
||||
>
|
||||
{cancelText || '取消'}
|
||||
</Button>,
|
||||
</Button>
|
||||
), (
|
||||
<Button
|
||||
key="confirm"
|
||||
type="primary"
|
||||
@ -154,8 +155,8 @@ export default class Modal extends React.Component<ModalProps, any> {
|
||||
onClick={this.handleOk}
|
||||
>
|
||||
{okText || '确定'}
|
||||
</Button>,
|
||||
];
|
||||
</Button>
|
||||
)];
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
|
@ -33,7 +33,7 @@ export default class Popover extends React.Component<PopoverProps, any> {
|
||||
warning(
|
||||
!('overlay' in this.props),
|
||||
'Popover[overlay] is removed, please use Popover[content] instead, ' +
|
||||
'see: http://u.ant.design/popover-content'
|
||||
'see: http://u.ant.design/popover-content',
|
||||
);
|
||||
return (
|
||||
<div>
|
||||
|
@ -141,7 +141,7 @@ export default class SelectionCheckboxAll extends React.Component<SelectionCheck
|
||||
key={selection.key || index}
|
||||
>
|
||||
<div
|
||||
onClick={() => {this.props.onSelect(selection.key, index, selection.onSelect);}}
|
||||
onClick={() => {this.props.onSelect(selection.key, index, selection.onSelect); }}
|
||||
>
|
||||
{selection.text}
|
||||
</div>
|
||||
|
@ -149,7 +149,7 @@ export default class Table<T> extends React.Component<TableProps<T>, any> {
|
||||
warning(
|
||||
!('columnsPageRange' in props || 'columnsPageSize' in props),
|
||||
'`columnsPageRange` and `columnsPageSize` are removed, please use ' +
|
||||
'fixed columns instead, see: http://u.ant.design/fixed-columns.'
|
||||
'fixed columns instead, see: http://u.ant.design/fixed-columns.',
|
||||
);
|
||||
|
||||
this.columns = props.columns || normalizeColumns(props.children);
|
||||
@ -269,7 +269,7 @@ export default class Table<T> extends React.Component<TableProps<T>, any> {
|
||||
return;
|
||||
}
|
||||
const selectedRows = data.filter(
|
||||
(row, i) => selectedRowKeys.indexOf(this.getRecordKey(row, i)) >= 0
|
||||
(row, i) => selectedRowKeys.indexOf(this.getRecordKey(row, i)) >= 0,
|
||||
);
|
||||
if (rowSelection.onChange) {
|
||||
rowSelection.onChange(selectedRowKeys, selectedRows);
|
||||
@ -278,7 +278,7 @@ export default class Table<T> extends React.Component<TableProps<T>, any> {
|
||||
rowSelection.onSelect(record, checked, selectedRows);
|
||||
} else if (selectWay === 'onSelectAll' && rowSelection.onSelectAll) {
|
||||
const changeRows = data.filter(
|
||||
(row, i) => changeRowKeys.indexOf(this.getRecordKey(row, i)) >= 0
|
||||
(row, i) => changeRowKeys.indexOf(this.getRecordKey(row, i)) >= 0,
|
||||
);
|
||||
rowSelection.onSelectAll(checked, selectedRows, changeRows);
|
||||
} else if (selectWay === 'onSelectInvert' && rowSelection.onSelectInvert) {
|
||||
@ -609,7 +609,7 @@ export default class Table<T> extends React.Component<TableProps<T>, any> {
|
||||
rowKey(record, index) : record[rowKey as string];
|
||||
warning(recordKey !== undefined,
|
||||
'Each record in dataSource of table should have a unique `key` prop, or set `rowKey` to an unique primary key,' +
|
||||
'see http://u.ant.design/table-row-key'
|
||||
'see http://u.ant.design/table-row-key',
|
||||
);
|
||||
return recordKey === undefined ? index : recordKey;
|
||||
}
|
||||
@ -766,7 +766,7 @@ export default class Table<T> extends React.Component<TableProps<T>, any> {
|
||||
size = 'small';
|
||||
}
|
||||
let total = pagination.total || this.getLocalData().length;
|
||||
return (total > 0) ?
|
||||
return (total > 0) ? (
|
||||
<Pagination
|
||||
key="pagination"
|
||||
{...pagination}
|
||||
@ -776,7 +776,8 @@ export default class Table<T> extends React.Component<TableProps<T>, any> {
|
||||
size={size}
|
||||
current={this.getMaxCurrent(total)}
|
||||
onShowSizeChange={this.handleShowSizeChange}
|
||||
/> : null;
|
||||
/>
|
||||
) : null;
|
||||
}
|
||||
|
||||
// Get pagination, filters, sorter
|
||||
@ -846,7 +847,7 @@ export default class Table<T> extends React.Component<TableProps<T>, any> {
|
||||
{},
|
||||
item, {
|
||||
[childrenColumnName]: this.recursiveSort(item[childrenColumnName], sorterFn),
|
||||
}
|
||||
},
|
||||
) : item));
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ export default class FilterMenu extends React.Component<FilterMenuProps, any> {
|
||||
if (item.children && item.children.length > 0) {
|
||||
const { keyPathOfSelectedItem } = this.state;
|
||||
const containSelected = Object.keys(keyPathOfSelectedItem).some(
|
||||
key => keyPathOfSelectedItem[key].indexOf(item.value) >= 0
|
||||
key => keyPathOfSelectedItem[key].indexOf(item.value) >= 0,
|
||||
);
|
||||
const subMenuCls = containSelected ? `${this.props.dropdownPrefixCls}-submenu-contain-selected` : '';
|
||||
return (
|
||||
|
@ -9,7 +9,7 @@ import Icon from '../icon';
|
||||
import warning from '../_util/warning';
|
||||
import isFlexSupported from '../_util/isFlexSupported';
|
||||
|
||||
export type TabsType = 'line' | 'card' | 'editable-card'
|
||||
export type TabsType = 'line' | 'card' | 'editable-card';
|
||||
export type TabsPosition = 'top' | 'right' | 'bottom' | 'left';
|
||||
|
||||
export interface TabsProps {
|
||||
@ -99,7 +99,7 @@ export default class Tabs extends React.Component<TabsProps, any> {
|
||||
} = this.props;
|
||||
warning(
|
||||
!(type.indexOf('card') >= 0 && size === 'small'),
|
||||
'Tabs[type=card|editable-card] doesn\'t have small size, it\'s by designed.'
|
||||
'Tabs[type=card|editable-card] doesn\'t have small size, it\'s by designed.',
|
||||
);
|
||||
let cls = classNames(className, {
|
||||
[`${prefixCls}-mini`]: size === 'small' || size as string === 'mini',
|
||||
|
@ -47,7 +47,7 @@ abstract class TimePicker extends React.Component<TimePickerProps, any> {
|
||||
if (value && !moment.isMoment(value)) {
|
||||
throw new Error(
|
||||
'The value/defaultValue of TimePicker must be a moment object after `antd@2.0`, ' +
|
||||
'see: http://u.ant.design/time-picker-value'
|
||||
'see: http://u.ant.design/time-picker-value',
|
||||
);
|
||||
}
|
||||
this.state = {
|
||||
|
@ -25,7 +25,7 @@ export default class Timeline extends React.Component<TimelineProps, any> {
|
||||
const items = React.Children.map(children, (ele: React.ReactElement<any>, idx) =>
|
||||
React.cloneElement(ele, {
|
||||
last: idx === (children as { length: number }).length - 1,
|
||||
})
|
||||
}),
|
||||
);
|
||||
const pendingItem = (!!pending) ? (
|
||||
<TimelineItem pending={!!pending}>{pendingNode}</TimelineItem>
|
||||
|
@ -155,7 +155,7 @@ export default class Tooltip extends React.Component<TooltipProps, any> {
|
||||
key => (
|
||||
placements[key].points[0] === align.points[0] &&
|
||||
placements[key].points[1] === align.points[1]
|
||||
)
|
||||
),
|
||||
)[0];
|
||||
if (!placement) {
|
||||
return;
|
||||
@ -190,7 +190,7 @@ export default class Tooltip extends React.Component<TooltipProps, any> {
|
||||
}
|
||||
|
||||
const child = this.getDisabledCompatibleChildren(
|
||||
React.isValidElement(children) ? children : <span>{children}</span>
|
||||
React.isValidElement(children) ? children : <span>{children}</span>,
|
||||
);
|
||||
const childProps = child.props;
|
||||
const childCls = classNames(childProps.className, {
|
||||
|
@ -169,8 +169,8 @@ abstract class Transfer extends React.Component<TransferProps, any> {
|
||||
}
|
||||
}
|
||||
|
||||
moveToLeft = () => this.moveTo('left')
|
||||
moveToRight = () => this.moveTo('right')
|
||||
moveToLeft = () => this.moveTo('left');
|
||||
moveToRight = () => this.moveTo('right');
|
||||
|
||||
handleSelectChange(direction: string, holder: string[]) {
|
||||
const { sourceSelectedKeys, targetSelectedKeys } = this.state;
|
||||
@ -199,10 +199,10 @@ abstract class Transfer extends React.Component<TransferProps, any> {
|
||||
|
||||
handleLeftSelectAll = (filteredDataSource, checkAll) => (
|
||||
this.handleSelectAll('left', filteredDataSource, checkAll)
|
||||
)
|
||||
);
|
||||
handleRightSelectAll = (filteredDataSource, checkAll) => (
|
||||
this.handleSelectAll('right', filteredDataSource, checkAll)
|
||||
)
|
||||
);
|
||||
|
||||
handleFilter = (direction, e) => {
|
||||
this.setState({
|
||||
@ -214,8 +214,8 @@ abstract class Transfer extends React.Component<TransferProps, any> {
|
||||
}
|
||||
}
|
||||
|
||||
handleLeftFilter = (e) => this.handleFilter('left', e)
|
||||
handleRightFilter = (e) => this.handleFilter('right', e)
|
||||
handleLeftFilter = (e) => this.handleFilter('left', e);
|
||||
handleRightFilter = (e) => this.handleFilter('right', e);
|
||||
|
||||
handleClear = (direction) => {
|
||||
this.setState({
|
||||
@ -223,8 +223,8 @@ abstract class Transfer extends React.Component<TransferProps, any> {
|
||||
});
|
||||
}
|
||||
|
||||
handleLeftClear = () => this.handleClear('left')
|
||||
handleRightClear = () => this.handleClear('right')
|
||||
handleLeftClear = () => this.handleClear('left');
|
||||
handleRightClear = () => this.handleClear('right');
|
||||
|
||||
handleSelect = (direction, selectedItem, checked) => {
|
||||
const { sourceSelectedKeys, targetSelectedKeys } = this.state;
|
||||
|
@ -100,7 +100,7 @@ export default class Tree extends React.Component<TreeProps, any> {
|
||||
return (
|
||||
<RcTree
|
||||
{...props}
|
||||
checkable={checkable ? (<span className={`${props.prefixCls}-checkbox-inner`} />) : checkable }
|
||||
checkable={checkable ? (<span className={`${props.prefixCls}-checkbox-inner`} />) : checkable}
|
||||
>
|
||||
{this.props.children}
|
||||
</RcTree>
|
||||
|
@ -276,7 +276,7 @@ export default class Upload extends React.Component<UploadProps, any> {
|
||||
});
|
||||
|
||||
const uploadButton = (
|
||||
<div className={uploadButtonCls} style={{ display: children ? '' : 'none'}}>
|
||||
<div className={uploadButtonCls} style={{ display: children ? '' : 'none' }}>
|
||||
<RcUpload {...rcUploadProps} ref="upload" />
|
||||
</div>
|
||||
);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
export type UploadFileStatus = 'error' | 'success' | 'done' | 'uploading' | 'removed'
|
||||
export type UploadFileStatus = 'error' | 'success' | 'done' | 'uploading' | 'removed';
|
||||
|
||||
export interface HttpRequestHeader {
|
||||
[key: string]: string;
|
||||
|
11
package.json
11
package.json
@ -79,7 +79,7 @@
|
||||
"@types/react": "^15.0.8",
|
||||
"@types/react-dom": "~0.14.18",
|
||||
"antd-demo-jest": "^1.0.5",
|
||||
"antd-tools": "~0.18.0",
|
||||
"antd-tools": "~0.19.1",
|
||||
"babel-cli": "^6.18.0",
|
||||
"babel-eslint": "^7.1.0",
|
||||
"babel-jest": "^19.0.0",
|
||||
@ -105,7 +105,7 @@
|
||||
"eslint-config-airbnb": "latest",
|
||||
"eslint-plugin-babel": "^4.0.0",
|
||||
"eslint-plugin-import": "^2.1.0",
|
||||
"eslint-plugin-jsx-a11y": "^3.0.2",
|
||||
"eslint-plugin-jsx-a11y": "^4.0.0",
|
||||
"eslint-plugin-markdown": "1.0.0-beta.4",
|
||||
"eslint-plugin-react": "^6.10.3",
|
||||
"eslint-tinker": "^0.4.0",
|
||||
@ -118,9 +118,9 @@
|
||||
"moment-timezone": "^0.5.5",
|
||||
"pre-commit": "^1.2.2",
|
||||
"querystring": "^0.2.0",
|
||||
"rc-queue-anim": "~0.13.2",
|
||||
"rc-scroll-anim": "~0.6.5",
|
||||
"rc-tween-one": "~1.1.2",
|
||||
"rc-queue-anim": "^0.13.2",
|
||||
"rc-scroll-anim": "^1.0.3",
|
||||
"rc-tween-one": "^1.1.2",
|
||||
"react": "^15.0.0",
|
||||
"react-addons-test-utils": "^15.0.0",
|
||||
"react-color-standalone": "^2.4.2-1",
|
||||
@ -148,6 +148,7 @@
|
||||
"lint:es": "eslint tests site scripts components ./.eslintrc.js ./webpack.config.js --ext '.js,.jsx'",
|
||||
"lint:demo": "cross-env RUN_ENV=DEMO eslint components/*/demo/*.md --ext '.md'",
|
||||
"lint:style": "stylelint \"{site,components}/**/*.less\" --syntax less",
|
||||
"lint-fix:ts": "npm run tsc && antd-tools run ts-lint-fix",
|
||||
"lint-fix": "npm run lint-fix:code && npm run lint-fix:demo",
|
||||
"lint-fix:code": "eslint --fix tests site scripts components ./.eslintrc.js ./webpack.config.js --ext '.js,.jsx'",
|
||||
"lint-fix:demo": "eslint-tinker ./components/*/demo/*.md",
|
||||
|
Loading…
Reference in New Issue
Block a user