Skip to content

Commit

Permalink
Merge pull request alibaba-fusion#1261 from youluna/fix-warning
Browse files Browse the repository at this point in the history
Fix warning
  • Loading branch information
myronliu347 authored Oct 24, 2019
2 parents 077f9a4 + 3f1e86e commit 0c9cc03
Show file tree
Hide file tree
Showing 24 changed files with 75 additions and 43 deletions.
9 changes: 8 additions & 1 deletion src/button/view/button.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { Component, Children } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import ConfigProvider from '../../config-provider';
import { obj } from '../../util';

function mapIconSize(size) {
return {
Expand All @@ -13,6 +15,7 @@ function mapIconSize(size) {
/** Button */
export default class Button extends Component {
static propTypes = {
...ConfigProvider.propTypes,
prefix: PropTypes.string,
rtl: PropTypes.bool,
/**
Expand Down Expand Up @@ -113,6 +116,8 @@ export default class Button extends Component {
ghost,
component,
iconSize,
disabled,
onClick,
children,
rtl,
...others
Expand Down Expand Up @@ -157,8 +162,10 @@ export default class Button extends Component {

const TagName = component;
const tagAttrs = {
...others,
...obj.pickOthers(Object.keys(Button.propTypes), others),
type: htmlType,
disabled: disabled,
onClick: onClick,
className: btnCls,
};

Expand Down
1 change: 1 addition & 0 deletions src/button/view/group.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ConfigProvider from '../../config-provider';
*/
class ButtonGroup extends Component {
static propTypes = {
...ConfigProvider.propTypes,
rtl: PropTypes.bool,
prefix: PropTypes.string,
/**
Expand Down
2 changes: 2 additions & 0 deletions src/calendar/calendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import moment from 'moment';
import classnames from 'classnames';
import ConfigProvider from '../config-provider';
import nextLocale from '../locale/zh-cn';
import { func, obj } from '../util';
import CardHeader from './head/card-header';
Expand All @@ -26,6 +27,7 @@ import {
/** Calendar */
class Calendar extends Component {
static propTypes = {
...ConfigProvider.propTypes,
prefix: PropTypes.string,
rtl: PropTypes.bool,
/**
Expand Down
1 change: 1 addition & 0 deletions src/calendar/range-calendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {

class RangeCalendar extends React.Component {
static propTypes = {
...ConfigProvider.propTypes,
/**
* 样式前缀
*/
Expand Down
2 changes: 2 additions & 0 deletions src/card/card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import ConfigProvider from '../config-provider';
import BulletHeader from './bullet-header';
import CollapseContent from './collapse-content';
import CardMedia from './media';
Expand All @@ -18,6 +19,7 @@ export default class Card extends React.Component {
static displayName = 'Card';

static propTypes = {
...ConfigProvider.propTypes,
prefix: PropTypes.string,
rtl: PropTypes.bool,
/**
Expand Down
1 change: 1 addition & 0 deletions src/checkbox/checkbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function isChecked(selectedValue, value) {
class Checkbox extends UIState {
static displayName = 'Checkbox';
static propTypes = {
...ConfigProvider.propTypes,
prefix: PropTypes.string,
rtl: PropTypes.bool,
/**
Expand Down
2 changes: 1 addition & 1 deletion src/config-provider/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ConfigProvider extends Component {
/**
* 组件树
*/
children: PropTypes.element,
children: PropTypes.any,
/**
* 指定浮层渲染的父节点, 可以为节点id的字符串,也可以返回节点的函数
*/
Expand Down
4 changes: 3 additions & 1 deletion src/date-picker/date-picker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import moment from 'moment';
import ConfigProvider from '../config-provider';
import Overlay from '../overlay';
import Input from '../input';
import Calendar from '../calendar';
Expand All @@ -27,6 +28,7 @@ const { Popup } = Overlay;
*/
export default class DatePicker extends Component {
static propTypes = {
...ConfigProvider.propTypes,
prefix: PropTypes.string,
rtl: PropTypes.bool,
/**
Expand Down Expand Up @@ -128,7 +130,7 @@ export default class DatePicker extends Component {
* @param {Element} target 目标元素
* @return {Element} 弹层的容器元素
*/
popupContainer: PropTypes.func,
popupContainer: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
/**
* 弹层自定义样式
*/
Expand Down
4 changes: 3 additions & 1 deletion src/date-picker/month-picker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import moment from 'moment';
import ConfigProvider from '../config-provider';
import Overlay from '../overlay';
import Input from '../input';
import Calendar from '../calendar';
Expand All @@ -16,6 +17,7 @@ const { Popup } = Overlay;
*/
class MonthPicker extends Component {
static propTypes = {
...ConfigProvider.propTypes,
prefix: PropTypes.string,
rtl: PropTypes.bool,
/**
Expand Down Expand Up @@ -103,7 +105,7 @@ class MonthPicker extends Component {
* @param {Element} target 目标元素
* @return {Element} 弹层的容器元素
*/
popupContainer: PropTypes.func,
popupContainer: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
/**
* 弹层自定义样式
*/
Expand Down
4 changes: 3 additions & 1 deletion src/date-picker/range-picker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import moment from 'moment';
import ConfigProvider from '../config-provider';
import Overlay from '../overlay';
import Input from '../input';
import RangeCalendar from '../calendar/range-calendar';
Expand Down Expand Up @@ -53,6 +54,7 @@ function getFormatValues(values, format) {
*/
export default class RangePicker extends Component {
static propTypes = {
...ConfigProvider.propTypes,
prefix: PropTypes.string,
rtl: PropTypes.bool,
/**
Expand Down Expand Up @@ -150,7 +152,7 @@ export default class RangePicker extends Component {
* @param {Element} target 目标元素
* @return {Element} 弹层的容器元素
*/
popupContainer: PropTypes.func,
popupContainer: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
/**
* 弹层自定义样式
*/
Expand Down
16 changes: 10 additions & 6 deletions src/icon/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import ConfigProvider from '../config-provider';

import { obj } from '../util';
/**
* Icon
*/
class Icon extends Component {
static propTypes = {
prefix: PropTypes.string,
rtl: PropTypes.bool,
...ConfigProvider.propTypes,
/**
* 指定显示哪种图标
*/
Expand Down Expand Up @@ -40,7 +39,12 @@ class Icon extends Component {

render() {
/* eslint-disable no-unused-vars*/
const { prefix, type, size, className, rtl, ...other } = this.props;
const { prefix, type, size, className, rtl } = this.props;

const others = obj.pickOthers(
Object.assign({}, Icon.propTypes),
this.props
);

const classes = cx({
[`${prefix}icon`]: true,
Expand All @@ -62,10 +66,10 @@ class Icon extends Component {
'ascending',
].indexOf(type) !== -1
) {
other.dir = 'rtl';
others.dir = 'rtl';
}

return <i {...other} className={classes} />;
return <i {...others} className={classes} />;
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/input/base.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import PropTypes from 'prop-types';
import classNames from 'classnames';
import { polyfill } from 'react-lifecycles-compat';

import ConfigProvider from '../config-provider';
import { func } from '../util';
import zhCN from '../locale/zh-cn';

class Base extends React.Component {
static propTypes = {
prefix: PropTypes.string,
...ConfigProvider.propTypes,
/**
* 当前值
*/
Expand Down
2 changes: 2 additions & 0 deletions src/menu/view/menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { findDOMNode } from 'react-dom';
import PropTypes from 'prop-types';
import cx from 'classnames';
import SubMenu from './sub-menu';
import ConfigProvider from '../../config-provider';
import { func, obj, dom, events, KEYCODE } from '../../util';
import { getWidth } from './util';

Expand All @@ -18,6 +19,7 @@ export default class Menu extends Component {
static isNextMenu = true;

static propTypes = {
...ConfigProvider.propTypes,
prefix: PropTypes.string,
pure: PropTypes.bool,
rtl: PropTypes.bool,
Expand Down
8 changes: 6 additions & 2 deletions src/pagination/pagination.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Icon from '../icon';
import Button from '../button';
import Input from '../input';
import Select from '../select';
import { KEYCODE, str } from '../util';
import { KEYCODE, str, obj } from '../util';
import zhCN from '../locale/zh-cn.js';

const { Option } = Select;
Expand All @@ -17,6 +17,7 @@ const noop = () => {};
*/
class Pagination extends Component {
static propTypes = {
...ConfigProvider.propTypes,
prefix: PropTypes.string,
pure: PropTypes.bool,
rtl: PropTypes.bool,
Expand Down Expand Up @@ -630,7 +631,10 @@ class Pagination extends Component {
}

const buildComponent = (...coms) => (
<div className={classes} {...others}>
<div
className={classes}
{...obj.pickOthers(Object.keys(Pagination.propTypes), others)}
>
{isStart && sizeSelector}
{totalRender ? this.renderPageTotal() : null}
<div className={`${prefix}pagination-pages`}>
Expand Down
2 changes: 1 addition & 1 deletion src/radio/radio-group.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ const { pickOthers } = obj;
*/
class RadioGroup extends Component {
static propTypes = {
...ConfigProvider.propTypes,
/**
* 样式类名的品牌前缀
*/
prefix: PropTypes.string,
rtl: PropTypes.bool,
/**
* 自定义类名
*/
Expand Down
3 changes: 1 addition & 2 deletions src/radio/radio.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ const { makeChain, noop } = func;
class Radio extends UIState {
static displayName = 'Radio';
static propTypes = {
prefix: PropTypes.string,
rtl: PropTypes.bool,
...ConfigProvider.propTypes,
/**
* 自定义类名
*/
Expand Down
15 changes: 5 additions & 10 deletions src/shell/base.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default function Base(props) {
static _typeMark = `Shell_${componentName}`;

static propTypes = {
...ConfigProvider.propTypes,
prefix: PropTypes.string,
collapse: PropTypes.bool,
miniable: PropTypes.bool,
Expand All @@ -35,10 +36,6 @@ export default function Base(props) {
isCollapse: PropTypes.bool,
};

static contextTypes = {
shellPrefix: PropTypes.string,
};

getChildContext() {
const { collapse } = this.props;

Expand All @@ -62,21 +59,19 @@ export default function Base(props) {
...others
} = this.props;

const basePrefix = this.context.prefix || prefix;

let Tag = component;

const cls = classnames({
[`${basePrefix}shell-${componentName.toLowerCase()}`]: true,
[`${basePrefix}shell-collapse`]: !!collapse,
[`${basePrefix}shell-mini`]: miniable,
[`${prefix}shell-${componentName.toLowerCase()}`]: true,
[`${prefix}shell-collapse`]: !!collapse,
[`${prefix}shell-mini`]: miniable,
[className]: !!className,
});

let newChildren = children;
if (componentName === 'Content') {
newChildren = (
<div className={`${basePrefix}shell-content-inner`}>
<div className={`${prefix}shell-content-inner`}>
{children}
</div>
);
Expand Down
8 changes: 5 additions & 3 deletions src/shell/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ const Shell = ShellBase({
});
});

Shell.Page = ShellBase({
componentName: 'Page',
});
Shell.Page = ConfigProvider.config(
ShellBase({
componentName: 'Page',
})
);

export default ConfigProvider.config(Shell, {
transform: /* istanbul ignore next */ (props, deprecated) => {
Expand Down
Loading

0 comments on commit 0c9cc03

Please sign in to comment.