From f99bbf5c2e5258cd700445acc9644f7061a91bb8 Mon Sep 17 00:00:00 2001 From: yiminghe Date: Mon, 30 Nov 2015 14:41:01 +0800 Subject: [PATCH 1/2] add month picker --- components/datepicker/demo/month-picker.md | 15 +++++++++++ components/datepicker/index.jsx | 6 ++--- scripts/demo.js | 31 ++++++++++++++++------ 3 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 components/datepicker/demo/month-picker.md diff --git a/components/datepicker/demo/month-picker.md b/components/datepicker/demo/month-picker.md new file mode 100644 index 000000000..47e72827b --- /dev/null +++ b/components/datepicker/demo/month-picker.md @@ -0,0 +1,15 @@ +# 月选择器 + +- order: 9 + +使用 MonthPicker 实现月选择器. + +--- + +````jsx +import { Datepicker } from 'antd'; +const MonthPicker = Datepicker.MonthPicker; +ReactDOM.render( + +, document.getElementById('components-datepicker-demo-month-picker')); +```` diff --git a/components/datepicker/index.jsx b/components/datepicker/index.jsx index 3cbc77446..d0ca23241 100644 --- a/components/datepicker/index.jsx +++ b/components/datepicker/index.jsx @@ -8,11 +8,11 @@ import CalendarLocale from 'rc-calendar/lib/locale/zh_CN'; import DateTimeFormat from 'gregorian-calendar-format'; import objectAssign from 'object-assign'; -function createPicker(TheCalendar) { +function createPicker(TheCalendar, defaultFormat) { return React.createClass({ getDefaultProps() { return { - format: 'yyyy-MM-dd', + format: defaultFormat || 'yyyy-MM-dd', transitionName: 'slide-up', popupStyle: {}, onSelect: null, // 向前兼容 @@ -154,7 +154,7 @@ function createPicker(TheCalendar) { } const AntDatePicker = createPicker(Calendar); -const AntMonthPicker = createPicker(MonthCalendar); +const AntMonthPicker = createPicker(MonthCalendar, 'yyyy-MM'); const AntCalendar = React.createClass({ getDefaultProps() { diff --git a/scripts/demo.js b/scripts/demo.js index 82c91e8d9..d2a4d5d16 100644 --- a/scripts/demo.js +++ b/scripts/demo.js @@ -1,10 +1,25 @@ -window.require = function(path) { - if (path in window) { - return window[path]; - } else { - throw 'There should not have modules here: ' + path; - } +function capitalizeFirstLetter(string) { + return string.charAt(0).toUpperCase() + string.slice(1); +} + +window.require = function (path) { + var result = window; + var namespaces = path.split('/'); + namespaces.forEach(function (key, i) { + if (i === 2) { + key = capitalizeFirstLetter(key); + } + if (key !== 'lib') { + if (result[key]) { + result = result[key]; + } else { + throw 'There should not have modules here: ' + path; + } + } + }); + return result; }; + window['css-animation'] = require('css-animation'); window['react-router'] = require('react-router'); window.Clip = require('./clip'); @@ -101,7 +116,7 @@ InstantClickChangeFns.push(function () { ReactDOM.render( - , document.getElementById('versions-select')); + , document.getElementById('versions-select')); }); window.BrowserDemo = React.createClass({ @@ -114,7 +129,7 @@ window.BrowserDemo = React.createClass({
- +
{this.props.children} From 3cc00cb8344dd02a3bba72a69db31b2098bd1e50 Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 30 Nov 2015 15:03:23 +0800 Subject: [PATCH 2/2] fix filter link position --- style/components/table.less | 1 + 1 file changed, 1 insertion(+) diff --git a/style/components/table.less b/style/components/table.less index 70d59a090..e24197a22 100644 --- a/style/components/table.less +++ b/style/components/table.less @@ -238,6 +238,7 @@ } &.clear { float: right; + margin-right: -32px; } } }