diff --git a/components/checkbox/Group.jsx b/components/checkbox/Group.jsx index b0e795c7d4..7071094228 100644 --- a/components/checkbox/Group.jsx +++ b/components/checkbox/Group.jsx @@ -5,6 +5,7 @@ export default React.createClass({ getDefaultProps() { return { options: [], + defaultValue: [], onChange() {}, }; }, @@ -17,13 +18,13 @@ export default React.createClass({ getInitialState() { const { value, defaultValue } = this.props; return { - value: value || defaultValue || [], + value: value || defaultValue, }; }, componentWillReceiveProps(nextProps) { if ('value' in nextProps) { this.setState({ - value: nextProps.value, + value: nextProps.value || [], }); } }, diff --git a/components/date-picker/PickerMixin.jsx b/components/date-picker/PickerMixin.jsx index aa567b6c6e..9951fa9858 100644 --- a/components/date-picker/PickerMixin.jsx +++ b/components/date-picker/PickerMixin.jsx @@ -30,10 +30,8 @@ export default { date.setTime(+value); return date; } - } else if (value === null) { - return value; } - return undefined; + return value; }, // remove input readonly warning diff --git a/components/time-picker/index.jsx b/components/time-picker/index.jsx index d0098dc379..567321e385 100644 --- a/components/time-picker/index.jsx +++ b/components/time-picker/index.jsx @@ -4,6 +4,7 @@ import TimePicker from 'rc-time-picker/lib/TimePicker'; import objectAssign from 'object-assign'; import defaultLocale from './locale/zh_CN'; import classNames from 'classnames'; +import GregorianCalendar from 'gregorian-calendar'; const AntTimePicker = React.createClass({ getDefaultProps() { @@ -49,12 +50,18 @@ const AntTimePicker = React.createClass({ */ parseTimeFromValue(value) { if (value) { - return this.getFormatter().parse(value, { - locale: this.getLocale().calendar, - obeyCount: true, - }); + if (typeof value === 'string') { + return this.getFormatter().parse(value, { + locale: this.getLocale().calendar, + obeyCount: true, + }); + } else if (value instanceof Date) { + let date = new GregorianCalendar(this.getLocale().calendar); + date.setTime(+value); + return date; + } } - return undefined; + return value; }, handleChange(value) { @@ -77,8 +84,6 @@ const AntTimePicker = React.createClass({ } if (props.value) { props.value = this.parseTimeFromValue(props.value); - } else { - delete props.value; } let className = classNames({ [props.className]: !!props.className, diff --git a/package.json b/package.json index 3eae53fd8c..cb6062364b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "0.12.0-beta8", + "version": "0.12.0-beta9", "title": "Ant Design", "description": "一个 UI 设计语言", "homepage": "http://ant.design/", @@ -73,8 +73,6 @@ "warning": "~2.1.0" }, "devDependencies": { - "rc-scroll-anim": "0.0.5", - "rc-tween-one": "0.1.5", "autoprefixer-loader": "^3.1.0", "babel-cli": "^6.2.0", "babel-core": "^6.2.1", @@ -104,6 +102,9 @@ "lodash": "^3.10.0", "nico-jsx": "~0.7.0", "pre-commit": "1.x", + "rc-form": "^0.8.0", + "rc-scroll-anim": "0.0.5", + "rc-tween-one": "0.1.5", "react": "0.14.x", "react-addons-test-utils": "0.14.x", "react-copy-to-clipboard": "^3.0.4", diff --git a/scripts/demo.js b/scripts/demo.js index 284d8359f9..9d0bd5a921 100644 --- a/scripts/demo.js +++ b/scripts/demo.js @@ -25,6 +25,7 @@ window.require = function (path) { require('../style/index.less'); window['css-animation'] = require('css-animation'); window['react-router'] = require('react-router'); +window['rc-form'] = require('rc-form'); window.CopyToClipboard = require('react-copy-to-clipboard'); var antd = require('../index'); var React = require('react');