From c66714494306238abd4f0abd9a12d153bb369f62 Mon Sep 17 00:00:00 2001 From: yiminghe Date: Thu, 7 Jul 2016 16:59:47 +0800 Subject: [PATCH] fix form warning Conflicts: components/cascader/index.jsx components/form/index.jsx --- components/cascader/index.jsx | 1 + components/form/FormItem.jsx | 5 ++-- components/form/constants.js | 1 + components/form/demo/horizontal-form.md | 6 ++-- components/form/index.jsx | 3 +- package.json | 38 ++++++++++++------------- 6 files changed, 29 insertions(+), 25 deletions(-) create mode 100644 components/form/constants.js diff --git a/components/cascader/index.jsx b/components/cascader/index.jsx index 6a79779736..94e4ae4d84 100644 --- a/components/cascader/index.jsx +++ b/components/cascader/index.jsx @@ -74,6 +74,7 @@ export default class Cascader extends React.Component { const props = this.props; const { prefixCls, children, placeholder, size, disabled, className, style, allowClear, ...otherProps } = props; + const sizeCls = classNames({ 'ant-input-lg': size === 'large', 'ant-input-sm': size === 'small', diff --git a/components/form/FormItem.jsx b/components/form/FormItem.jsx index 6e78012a78..5c64abb2bb 100644 --- a/components/form/FormItem.jsx +++ b/components/form/FormItem.jsx @@ -1,6 +1,7 @@ import React from 'react'; import classNames from 'classnames'; import PureRenderMixin from 'react-addons-pure-render-mixin'; +import { FIELD_META_PROP } from './constants'; export default class FormItem extends React.Component { static defaultProps = { @@ -52,7 +53,7 @@ export default class FormItem extends React.Component { getOnlyControl() { const children = React.Children.toArray(this.props.children); const child = children.filter((c) => { - return c.props && '__meta' in c.props; + return c.props && FIELD_META_PROP in c.props; })[0]; return child !== undefined ? child : null; } @@ -67,7 +68,7 @@ export default class FormItem extends React.Component { } getMeta() { - return this.getChildProp('__meta'); + return this.getChildProp(FIELD_META_PROP); } renderHelp() { diff --git a/components/form/constants.js b/components/form/constants.js new file mode 100644 index 0000000000..27b32ad273 --- /dev/null +++ b/components/form/constants.js @@ -0,0 +1 @@ +export const FIELD_META_PROP = 'data-__meta'; diff --git a/components/form/demo/horizontal-form.md b/components/form/demo/horizontal-form.md index 4bfffdcd29..fd2b9c915d 100644 --- a/components/form/demo/horizontal-form.md +++ b/components/form/demo/horizontal-form.md @@ -34,7 +34,7 @@ let Demo = React.createClass({ {...formItemLayout} label="密码" > - + - + 卖身华府 } > - 同意 + 同意 diff --git a/components/form/index.jsx b/components/form/index.jsx index ff86226759..86f6ba7864 100644 --- a/components/form/index.jsx +++ b/components/form/index.jsx @@ -2,12 +2,13 @@ import Form from './Form'; import FormItem from './FormItem'; import ValueMixin from './ValueMixin'; import createDOMForm from 'rc-form/lib/createDOMForm'; +import { FIELD_META_PROP } from './constants'; Form.create = (o = {}) => { const options = { ...o, fieldNameProp: 'id', - fieldMetaProp: '__meta', + fieldMetaProp: FIELD_META_PROP, }; return createDOMForm(options); diff --git a/package.json b/package.json index 31cd952198..3d48aee767 100644 --- a/package.json +++ b/package.json @@ -42,32 +42,32 @@ "object.omit": "^2.0.0", "rc-animate": "~2.3.0", "rc-calendar": "~5.6.2", - "rc-cascader": "~0.9.9", + "rc-cascader": "~0.9.10", "rc-checkbox": "~1.4.0", "rc-collapse": "~1.6.3", - "rc-dialog": "~6.1.0", + "rc-dialog": "~6.1.1", "rc-dropdown": "~1.4.8", "rc-form": "~0.17.1", - "rc-input-number": "~2.5.10", - "rc-menu": "~4.12.3", + "rc-input-number": "~2.5.12", + "rc-menu": "~4.12.4", "rc-notification": "~1.3.4", "rc-pagination": "~1.5.3", "rc-progress": "~1.0.4", - "rc-queue-anim": "~0.11.9", + "rc-queue-anim": "~0.11.12", "rc-radio": "~2.0.0", - "rc-rate": "~1.1.1", - "rc-select": "~6.4.0", - "rc-slider": "~3.7.0", - "rc-steps": "~2.1.3", + "rc-rate": "~1.1.2", + "rc-select": "~6.4.6", + "rc-slider": "~3.7.3", + "rc-steps": "~2.1.5", "rc-switch": "~1.4.2", - "rc-table": "~4.3.2", - "rc-tabs": "~5.9.1", - "rc-time-picker": "~1.1.4", - "rc-tooltip": "~3.3.2", - "rc-tree": "~1.3.1", - "rc-tree-select": "~1.7.2", - "rc-upload": "~1.13.0", - "rc-util": "~3.1.3", + "rc-table": "~4.3.5", + "rc-tabs": "~5.9.2", + "rc-time-picker": "~1.1.5", + "rc-tooltip": "~3.4.1", + "rc-tree": "~1.3.5", + "rc-tree-select": "~1.7.5", + "rc-upload": "~1.13.3", + "rc-util": "~3.2.1", "react-addons-pure-render-mixin": "~15.1.0", "react-slick": "~0.12.0", "warning": "~3.0.0" @@ -106,8 +106,8 @@ "pre-commit": "1.x", "querystring": "^0.2.0", "ramda": "^0.21.0", - "rc-scroll-anim": "~0.2.8", - "rc-tween-one": "~0.3.0", + "rc-scroll-anim": "~0.2.11", + "rc-tween-one": "~0.6.20", "react": "^15.0.0", "react-addons-test-utils": "^15.0.0", "react-copy-to-clipboard": "^4.0.1",