mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
chore: remove deprecated code (#2920)
* chore: remove deprecated code * chore: add warning for Breadcrumb
This commit is contained in:
parent
77a45f0b00
commit
14fb2c78ba
@ -2,7 +2,6 @@ import * as React from 'react';
|
|||||||
import * as ReactDOM from 'react-dom';
|
import * as ReactDOM from 'react-dom';
|
||||||
import addEventListener from 'rc-util/lib/Dom/addEventListener';
|
import addEventListener from 'rc-util/lib/Dom/addEventListener';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import warning from 'warning';
|
|
||||||
import assign from 'object-assign';
|
import assign from 'object-assign';
|
||||||
import shallowequal from 'shallowequal';
|
import shallowequal from 'shallowequal';
|
||||||
|
|
||||||
@ -182,8 +181,6 @@ export default class Affix extends React.Component<AffixProps, any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
warning(!('offset' in this.props), '`offset` prop of Affix is deprecated, use `offsetTop` instead.');
|
|
||||||
|
|
||||||
const target = this.props.target;
|
const target = this.props.target;
|
||||||
this.setTargetEventListeners(target);
|
this.setTargetEventListeners(target);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { cloneElement } from 'react';
|
import { cloneElement } from 'react';
|
||||||
|
import warning from 'warning';
|
||||||
import BreadcrumbItem from './BreadcrumbItem';
|
import BreadcrumbItem from './BreadcrumbItem';
|
||||||
|
|
||||||
export interface BreadcrumbProps {
|
export interface BreadcrumbProps {
|
||||||
@ -50,6 +51,15 @@ export default class Breadcrumb extends React.Component<BreadcrumbProps, any> {
|
|||||||
nameRender: React.PropTypes.func,
|
nameRender: React.PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
warning(
|
||||||
|
!('linkRender' in props || 'nameRender' in props),
|
||||||
|
'`linkRender` and `nameRender` is removed, please use `itemRender` instead.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let crumbs;
|
let crumbs;
|
||||||
const { separator, prefixCls, routes, params, children, itemRender } = this.props;
|
const { separator, prefixCls, routes, params, children, itemRender } = this.props;
|
||||||
|
@ -81,7 +81,7 @@ let Demo = React.createClass({
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<Form horizontal form={this.props.form}>
|
<Form horizontal>
|
||||||
{formItems}
|
{formItems}
|
||||||
<Form.Item wrapperCol={{ span: 18, offset: 6 }}>
|
<Form.Item wrapperCol={{ span: 18, offset: 6 }}>
|
||||||
<Button onClick={this.add} style={{ marginRight: 8 }}>add good friend</Button>
|
<Button onClick={this.add} style={{ marginRight: 8 }}>add good friend</Button>
|
||||||
|
@ -47,7 +47,7 @@ let Demo = React.createClass({
|
|||||||
<div>
|
<div>
|
||||||
<Button type="primary" onClick={this.showModal}>点击有惊喜</Button>
|
<Button type="primary" onClick={this.showModal}>点击有惊喜</Button>
|
||||||
<Modal title="login" visible={this.state.visible} onOk={this.handleSubmit} onCancel={this.hideModal}>
|
<Modal title="login" visible={this.state.visible} onOk={this.handleSubmit} onCancel={this.hideModal}>
|
||||||
<Form horizontal form={this.props.form}>
|
<Form horizontal>
|
||||||
<FormItem
|
<FormItem
|
||||||
{...formItemLayout}
|
{...formItemLayout}
|
||||||
label="User name"
|
label="User name"
|
||||||
|
@ -78,7 +78,7 @@ let BasicDemo = React.createClass({
|
|||||||
wrapperCol: { span: 12 },
|
wrapperCol: { span: 12 },
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<Form horizontal form={this.props.form}>
|
<Form horizontal>
|
||||||
<FormItem
|
<FormItem
|
||||||
{...formItemLayout}
|
{...formItemLayout}
|
||||||
label="User name"
|
label="User name"
|
||||||
|
@ -125,7 +125,7 @@ let Demo = React.createClass({
|
|||||||
const { getFieldDecorator } = this.props.form;
|
const { getFieldDecorator } = this.props.form;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Form vertical style={{ maxWidth: 600 }} form={this.props.form}>
|
<Form vertical style={{ maxWidth: 600 }}>
|
||||||
<Row type="flex" align="middle">
|
<Row type="flex" align="middle">
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<FormItem label="Password">
|
<FormItem label="Password">
|
||||||
|
@ -77,7 +77,7 @@ let Demo = React.createClass({
|
|||||||
wrapperCol: { span: 12 },
|
wrapperCol: { span: 12 },
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<Form horizontal form={this.props.form}>
|
<Form horizontal>
|
||||||
<FormItem
|
<FormItem
|
||||||
{...formItemLayout}
|
{...formItemLayout}
|
||||||
label="Country"
|
label="Country"
|
||||||
|
@ -47,26 +47,26 @@ let App = React.createClass({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
const { getFieldProps, getFieldValue } = this.props.form;
|
const { getFieldDecorator, getFieldValue } = this.props.form;
|
||||||
const mentionProps = getFieldProps('mention', {
|
|
||||||
rules: [
|
|
||||||
{ validator: this.checkMention },
|
|
||||||
],
|
|
||||||
initialValue: this.state.initValue,
|
|
||||||
});
|
|
||||||
console.log('>> render', getFieldValue('mention') === this.state.initValue);
|
console.log('>> render', getFieldValue('mention') === this.state.initValue);
|
||||||
return (
|
return (
|
||||||
<Form horizontal form={this.props.form}>
|
<Form horizontal>
|
||||||
<FormItem
|
<FormItem
|
||||||
id="control-mention"
|
id="control-mention"
|
||||||
label="最帅的码农"
|
label="最帅的码农"
|
||||||
labelCol={{ span: 6 }}
|
labelCol={{ span: 6 }}
|
||||||
wrapperCol={{ span: 14 }}
|
wrapperCol={{ span: 14 }}
|
||||||
>
|
>
|
||||||
|
{getFieldDecorator('mention', {
|
||||||
|
rules: [
|
||||||
|
{ validator: this.checkMention },
|
||||||
|
],
|
||||||
|
initialValue: this.state.initValue,
|
||||||
|
})(
|
||||||
<Mention
|
<Mention
|
||||||
{...mentionProps}
|
|
||||||
suggestions={['afc163', 'benjycui', 'yiminghe', 'RaoHai', '中文', 'にほんご']}
|
suggestions={['afc163', 'benjycui', 'yiminghe', 'RaoHai', '中文', 'にほんご']}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem wrapperCol={{ span: 14, offset: 6 }}>
|
<FormItem wrapperCol={{ span: 14, offset: 6 }}>
|
||||||
<Button type="primary" onClick={this.handleSubmit}>确定</Button>
|
<Button type="primary" onClick={this.handleSubmit}>确定</Button>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
category: Components
|
category: Components
|
||||||
type: Views
|
type: Views
|
||||||
noinstant: true
|
noinstant: true
|
||||||
english: -tification
|
title: Notification
|
||||||
---
|
---
|
||||||
|
|
||||||
To display a notification message globally.
|
To display a notification message globally.
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
category: Components
|
category: Components
|
||||||
chinese: 通知提醒框
|
|
||||||
type: Views
|
type: Views
|
||||||
noinstant: true
|
noinstant: true
|
||||||
english: Notification
|
title: Notification
|
||||||
|
subtitle: 通知提醒框
|
||||||
---
|
---
|
||||||
|
|
||||||
全局展示通知提醒信息。
|
全局展示通知提醒信息。
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import Tooltip from '../tooltip';
|
import Tooltip from '../tooltip';
|
||||||
import getPlacements from './placements';
|
import getPlacements from './placements';
|
||||||
import warning from 'warning';
|
|
||||||
|
|
||||||
const placements = getPlacements();
|
const placements = getPlacements();
|
||||||
|
|
||||||
@ -29,8 +28,6 @@ export interface PopoverProps {
|
|||||||
getTooltipContainer?: (triggerNode: React.ReactNode) => React.ReactNode;
|
getTooltipContainer?: (triggerNode: React.ReactNode) => React.ReactNode;
|
||||||
/** content of popup-container */
|
/** content of popup-container */
|
||||||
content?: React.ReactNode;
|
content?: React.ReactNode;
|
||||||
/** keep overlay for compatibility */
|
|
||||||
overlay?: React.ReactNode;
|
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
transitionName?: string;
|
transitionName?: string;
|
||||||
}
|
}
|
||||||
@ -63,22 +60,14 @@ export default class Popover extends React.Component<PopoverProps, any> {
|
|||||||
return (this.refs as any).tooltip.getPopupDomNode();
|
return (this.refs as any).tooltip.getPopupDomNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
if ('overlay' in this.props) {
|
|
||||||
warning(false, '`overlay` prop of Popover is deprecated, use `content` instead.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getOverlay() {
|
getOverlay() {
|
||||||
// use content replace overlay
|
const { title, prefixCls, content } = this.props;
|
||||||
// keep overlay for compatibility
|
|
||||||
const { title, prefixCls, overlay, content } = this.props;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{title && <div className={`${prefixCls}-title`}>{title}</div>}
|
{title && <div className={`${prefixCls}-title`}>{title}</div>}
|
||||||
<div className={`${prefixCls}-inner-content`}>
|
<div className={`${prefixCls}-inner-content`}>
|
||||||
{content || overlay}
|
{content}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -1,17 +1,3 @@
|
|||||||
import * as React from 'react';
|
|
||||||
import Progress from './progress';
|
import Progress from './progress';
|
||||||
import warning from 'warning';
|
|
||||||
|
|
||||||
const AntProgress = Progress;
|
export default Progress;
|
||||||
|
|
||||||
// For downward compatibility
|
|
||||||
AntProgress.Line = (props) => {
|
|
||||||
warning(false, '<Progress.Line /> is deprecated, use <Progress type="line" /> instead.');
|
|
||||||
return <Progress {...props} type="line" />;
|
|
||||||
};
|
|
||||||
AntProgress.Circle = (props) => {
|
|
||||||
warning(false, '<Progress.Circle /> is deprecated, use <Progress type="circle" /> instead.');
|
|
||||||
return <Progress {...props} type="circle" />;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default AntProgress;
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { PropTypes } from 'react';
|
import { PropTypes } from 'react';
|
||||||
import RcSlider from 'rc-slider';
|
import RcSlider from 'rc-slider';
|
||||||
import splitObject from '../_util/splitObject';
|
|
||||||
|
|
||||||
interface SliderMarks {
|
interface SliderMarks {
|
||||||
[key: number]: React.ReactNode | {
|
[key: number]: React.ReactNode | {
|
||||||
@ -23,8 +22,8 @@ export interface SliderProps {
|
|||||||
defaultValue?: SliderValue;
|
defaultValue?: SliderValue;
|
||||||
included?: boolean;
|
included?: boolean;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
onChange?: (value: SliderValue) => any;
|
onChange?: (value: SliderValue) => void;
|
||||||
onAfterChange?: (value: SliderValue) => any;
|
onAfterChange?: (value: SliderValue) => void;
|
||||||
tipFormatter?: void | ((value: number) => React.ReactNode);
|
tipFormatter?: void | ((value: number) => React.ReactNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,40 +36,9 @@ export default class Slider extends React.Component<SliderProps, any> {
|
|||||||
static propTypes = {
|
static propTypes = {
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
tipTransitionName: PropTypes.string,
|
tipTransitionName: PropTypes.string,
|
||||||
included: PropTypes.bool,
|
|
||||||
marks: PropTypes.object,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const [{isIncluded, marks, index, defaultIndex}, others] = splitObject(this.props,
|
return <RcSlider {...this.props} />;
|
||||||
['isIncluded', 'marks', 'index', 'defaultIndex']);
|
|
||||||
|
|
||||||
if (isIncluded !== undefined) {
|
|
||||||
// 兼容 `isIncluded`
|
|
||||||
others.included = isIncluded;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Array.isArray(marks)) {
|
|
||||||
// 兼容当 marks 为数组的情况
|
|
||||||
others.min = 0;
|
|
||||||
others.max = marks.length - 1;
|
|
||||||
others.step = 1;
|
|
||||||
|
|
||||||
if (index !== undefined) {
|
|
||||||
others.value = index;
|
|
||||||
}
|
|
||||||
if (defaultIndex !== undefined) {
|
|
||||||
others.defaultValue = defaultIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
others.marks = {};
|
|
||||||
marks.forEach((val, idx) => {
|
|
||||||
others.marks[idx] = val;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
others.marks = marks;
|
|
||||||
}
|
|
||||||
|
|
||||||
return <RcSlider {...others} />;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ import { PropTypes } from 'react';
|
|||||||
import { findDOMNode } from 'react-dom';
|
import { findDOMNode } from 'react-dom';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import isCssAnimationSupported from '../_util/isCssAnimationSupported';
|
import isCssAnimationSupported from '../_util/isCssAnimationSupported';
|
||||||
import warning from 'warning';
|
|
||||||
import splitObject from '../_util/splitObject';
|
import splitObject from '../_util/splitObject';
|
||||||
import omit from 'object.omit';
|
import omit from 'object.omit';
|
||||||
|
|
||||||
@ -33,7 +32,7 @@ export default class Spin extends React.Component<SpinProps, any> {
|
|||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
const spinning = this.getSpinning(props);
|
const spinning = props.spinning;
|
||||||
this.state = {
|
this.state = {
|
||||||
spinning,
|
spinning,
|
||||||
};
|
};
|
||||||
@ -44,7 +43,6 @@ export default class Spin extends React.Component<SpinProps, any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
warning(!('spining' in this.props), '`spining` property of Popover is a spell mistake, use `spinning` instead.');
|
|
||||||
if (!isCssAnimationSupported()) {
|
if (!isCssAnimationSupported()) {
|
||||||
// Show text in IE8/9
|
// Show text in IE8/9
|
||||||
findDOMNode(this).className += ` ${this.props.prefixCls}-show-text`;
|
findDOMNode(this).className += ` ${this.props.prefixCls}-show-text`;
|
||||||
@ -57,18 +55,9 @@ export default class Spin extends React.Component<SpinProps, any> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getSpinning(props) {
|
|
||||||
// Backwards support
|
|
||||||
if ('spining' in props) {
|
|
||||||
warning(false, '`spining` property of Spin is a spell mistake, use `spinning` instead.');
|
|
||||||
return props.spining;
|
|
||||||
}
|
|
||||||
return props.spinning;
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
const currentSpinning = this.getSpinning(this.props);
|
const currentSpinning = this.props.spinning;
|
||||||
const spinning = this.getSpinning(nextProps);
|
const spinning = nextProps.spinning;
|
||||||
if (this.debounceTimeout) {
|
if (this.debounceTimeout) {
|
||||||
clearTimeout(this.debounceTimeout);
|
clearTimeout(this.debounceTimeout);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user