From db2ef44617d69b2ddc1d7200e4ecb173eeba2859 Mon Sep 17 00:00:00 2001 From: zhangpc Date: Thu, 14 Jan 2016 09:26:20 +0800 Subject: [PATCH 01/23] remove href attributes of tag --- CHANGELOG.md | 1 + components/tag/demo/basic.md | 2 +- components/tag/index.jsx | 2 +- components/tag/index.md | 1 - 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0798b10025..86a0f4c1bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - 修复 TimePicker 受控模式点选即关闭面板的问题。[#818](https://github.com/ant-design/ant-design/issues/818) - 修复一个两栏的 TimePicker 点击右边空白处无法关闭面板的问题。[#826](https://github.com/ant-design/ant-design/issues/826) - 修复 Table `pagination.onChange` 指定无效的问题。[#824](https://github.com/ant-design/ant-design/issues/824) +- 移除 Tag `href` 属性。[#862](https://github.com/ant-design/ant-design/issues/862) ## 0.11.2 `2015-01-03` diff --git a/components/tag/demo/basic.md b/components/tag/demo/basic.md index aec4cb6067..cd1a87cb90 100644 --- a/components/tag/demo/basic.md +++ b/components/tag/demo/basic.md @@ -17,6 +17,6 @@ ReactDOM.render(
标签一 标签二 标签三 - 标签四(链接) + 标签四(链接)
, mountNode); ```` diff --git a/components/tag/index.jsx b/components/tag/index.jsx index f88e8b3f91..f7d2dfc4ba 100644 --- a/components/tag/index.jsx +++ b/components/tag/index.jsx @@ -45,7 +45,7 @@ class AntTag extends React.Component { transitionName={this.props.prefixCls + '-zoom'} onEnd={this.animationEnd.bind(this)}>
- + {close}
diff --git a/components/tag/index.md b/components/tag/index.md index eaf307d7e8..062bb0b12c 100644 --- a/components/tag/index.md +++ b/components/tag/index.md @@ -17,7 +17,6 @@ | 参数 | 说明 | 类型 | 可选值 | 默认值 | |----------------|--------------------------------|------------|---------|--------| -| href | 链接的地址,会传给 a 标签 | string | | false | | closable | 标签是否可以关闭 | boolean | | false | | onClose | 组合时根据此项判定checked | function | | 无 | | color | 标签的色彩 | string | blue green yellow red | 无 | From 9e2d1be3d6b373e9127ebbb56418aff792f59e5f Mon Sep 17 00:00:00 2001 From: Guan Hao Date: Thu, 14 Jan 2016 11:08:57 +0800 Subject: [PATCH 02/23] fix typo in layout demo code --- docs/spec/layout/demo/aside.md | 2 +- docs/spec/layout/demo/top.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/spec/layout/demo/aside.md b/docs/spec/layout/demo/aside.md index 06764f0ad2..302d52e856 100644 --- a/docs/spec/layout/demo/aside.md +++ b/docs/spec/layout/demo/aside.md @@ -115,7 +115,7 @@ ReactDOM.render( } .ant-layout-aside .ant-layout-footer { - height; 64px; + height: 64px; line-height: 64px; text-align: center; font-size: 12px; diff --git a/docs/spec/layout/demo/top.md b/docs/spec/layout/demo/top.md index a2d6163b48..d31adb56b6 100644 --- a/docs/spec/layout/demo/top.md +++ b/docs/spec/layout/demo/top.md @@ -99,7 +99,7 @@ ReactDOM.render( } .ant-layout-top .ant-layout-footer { - height; 64px; + height: 64px; line-height: 64px; text-align: center; font-size: 12px; From 56a0baddede28960a2a0284c54b943f9c3821dba Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 14 Jan 2016 11:08:25 +0800 Subject: [PATCH 03/23] fix links --- README-zh_CN.md | 2 +- README.md | 2 +- docs/spec/introduce.md | 2 +- site/templates/home.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README-zh_CN.md b/README-zh_CN.md index 4a7679bf9e..a964b6d968 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -44,7 +44,7 @@ import 'antd/lib/index.css'; // or 'antd/style/index.less' ## 链接 - [首页](http://ant.design/) -- [React UI 库](http://ant.design/docs/introduce) +- [React UI 库](http://ant.design/docs/react/introduce) - [修改记录](CHANGELOG.md) - [开发脚手架](https://github.com/ant-design/antd-init/) - [本地调试工具集](https://github.com/dora-js/dora/) diff --git a/README.md b/README.md index 6138edae90..d6205b3428 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Normal browsers and Internet Explorer 8+. ## Links - [Home page](http://ant.design/) -- [React UI library](http://ant.design/docs/introduce) +- [React UI library](http://ant.design/docs/react/introduce) - [ChangeLog](CHANGELOG.md) - [Scaffold tool](https://github.com/ant-design/antd-init/) - [Debug tools set](https://github.com/dora-js/dora) diff --git a/docs/spec/introduce.md b/docs/spec/introduce.md index 6122120c0c..7eeb1c3905 100644 --- a/docs/spec/introduce.md +++ b/docs/spec/introduce.md @@ -24,7 +24,7 @@ Ant Design 源自蚂蚁金服体验技术部的后台产品开发,我们的设 我们采用 [React](http://facebook.github.io/react/) 封装了一套 Ant Design 的组件库,也欢迎社区其他框架的实现版本。 -- [Ant Design of React](/docs/introduce)(官方实现) +- [Ant Design of React](/docs/react/introduce)(官方实现) - [vue-antd](https://github.com/okoala/vue-antd) ## 如何贡献 diff --git a/site/templates/home.html b/site/templates/home.html index 56168554e4..9e4a63d9b6 100644 --- a/site/templates/home.html +++ b/site/templates/home.html @@ -55,7 +55,7 @@ position: relative; height: 100%; width: 100%; - background: url("https://t.alipayobjects.com/images/T1OhFkXfpgXXXXXXXX.png") no-repeat center / cover; + background: url("https://os.alipayobjects.com/rmsportal/GhjqstwSgxBXrZS.png") no-repeat center / cover; } .banner-text-wrapper { From 11353c7a60a187684b28d54e32ffb677183f8a94 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 14 Jan 2016 11:54:46 +0800 Subject: [PATCH 04/23] reset menu link color, fix #872 --- components/menu/demo/sider.md | 2 +- style/components/menu.less | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/components/menu/demo/sider.md b/components/menu/demo/sider.md index c233c76848..c2de994506 100644 --- a/components/menu/demo/sider.md +++ b/components/menu/demo/sider.md @@ -35,7 +35,7 @@ const Sider = React.createClass({ 选项2 - 选项3 + 选项3 选项4 diff --git a/style/components/menu.less b/style/components/menu.less index dae84f1dc7..723d59ec1f 100644 --- a/style/components/menu.less +++ b/style/components/menu.less @@ -35,6 +35,14 @@ transition: all 0.3s ease; } + &-item > a { + display: block; + color: @text-color; + &:hover { + color: @text-color; + } + } + &-item-active, &-submenu-title:hover { background-color: tint(@primary-color, 90%); @@ -58,7 +66,7 @@ &-vertical { border-right: 1px solid #e9e9e9; .@{menu-prefix-cls}-item { - border-right: 2px solid transparent; + border-right: 1px solid #e9e9e9; margin-left: -1px; left: 1px; position: relative; From f1ff04a1ceaed74e47fc551e872d7cd7248dd406 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 14 Jan 2016 13:59:12 +0800 Subject: [PATCH 05/23] Docs: fix markdown and remove console --- docs/practice/cases.md | 1 - site/static/style.css | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/practice/cases.md b/docs/practice/cases.md index bdb1086f6d..c3aaa35fe7 100644 --- a/docs/practice/cases.md +++ b/docs/practice/cases.md @@ -107,7 +107,6 @@ AntV 将数据图形小组近几年在探索数据可视化过程中取得的成 }; img.src = url; setTimeout(function() { - console.log('timeout'); finish('timeout'); }, 1500); } diff --git a/site/static/style.css b/site/static/style.css index 518624b9f5..782219855f 100644 --- a/site/static/style.css +++ b/site/static/style.css @@ -548,7 +548,7 @@ footer ul li > a { width: 80%; } -.markdown ul li { +.markdown ul > li { list-style: circle; } @@ -563,7 +563,7 @@ footer ul li > a { margin: 0.6em 0; } -.markdown ol li { +.markdown ol > li { list-style: decimal; } From f22eeb179b9d045763592350307ccf0812c8a812 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 14 Jan 2016 14:19:12 +0800 Subject: [PATCH 06/23] update resource link --- docs/resource/download.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/resource/download.md b/docs/resource/download.md index 46412e8688..4516547c2f 100644 --- a/docs/resource/download.md +++ b/docs/resource/download.md @@ -14,7 +14,7 @@ 一套强大的 Ant Design 的 Axure 部件库 - + Axure Box From 1405600919f7a4c8dab4c43888c809f0d43cad69 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 14 Jan 2016 14:29:30 +0800 Subject: [PATCH 07/23] Add IE8 issues link --- README-zh_CN.md | 2 ++ README.md | 1 + docs/react/introduce.md | 2 ++ 3 files changed, 5 insertions(+) diff --git a/README-zh_CN.md b/README-zh_CN.md index a964b6d968..186ce4a121 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -41,6 +41,8 @@ import 'antd/lib/index.css'; // or 'antd/style/index.less' 现代浏览器和 IE8 及以上。 +> [IE8 issues](https://github.com/xcatliu/react-ie8) + ## 链接 - [首页](http://ant.design/) diff --git a/README.md b/README.md index d6205b3428..c5d5699b4d 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ Use components on demand by writing as `import DatePicker from 'antd/lib/date-pi Normal browsers and Internet Explorer 8+. +> [IE8 issues](https://github.com/xcatliu/react-ie8) ## Links diff --git a/docs/react/introduce.md b/docs/react/introduce.md index 8e7dcbfc37..56759c61c5 100644 --- a/docs/react/introduce.md +++ b/docs/react/introduce.md @@ -57,6 +57,8 @@ import 'antd/lib/index.css'; // or 'antd/style/index.less' 现代浏览器和 IE8 及以上。 +> [IE8 issues](https://github.com/xcatliu/react-ie8) + ## 链接 - [首页](http://ant.design/) From 413e816c98f16bba420fd5a93e9996dcd4c50ba3 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 14 Jan 2016 15:24:54 +0800 Subject: [PATCH 08/23] update button doc --- components/button/index.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/button/index.md b/components/button/index.md index 380a648be5..d869c820b7 100644 --- a/components/button/index.md +++ b/components/button/index.md @@ -21,12 +21,12 @@ 属性 | 说明 | 类型 | 默认值 -----|-----|-----|------ -type | 设置按钮类型,可选值为 `primary` `ghost` 或者不设 | Enum | undefined -htmlType | 设置 `button` 原生的 `type` 值,可选值请参考 HTML标准 | Enum | `button` -shape | 设置按钮形状,可选值为 `circle` `circle-outline` 或者不设 | Enum | undefined -size | 设置按钮大小,可选值为 `small` `large` 或者不设 | Enum | undefined -loading | 设置按钮载入状态,存在为 `true`,不存在为 `false`,或直接设置值,如:`loading="true"` | Bool | false -onClick | `click` 事件的 handler | Function | `function() {}` +type | 设置按钮类型,可选值为 `primary` `ghost` 或者不设 | string | - +htmlType | 设置 `button` 原生的 `type` 值,可选值请参考 HTML标准 | string | `button` +shape | 设置按钮形状,可选值为 `circle` `circle-outline` 或者不设 | string | 无 +size | 设置按钮大小,可选值为 `small` `large` 或者不设 | string | `default` +loading | 设置按钮载入状态 | boolean | false +onClick | `click` 事件的 handler | function | `function() {}` - `` 最终会被渲染为 ``,并且除了上表中的属性,其它属性都会直接传到 `` From efcc8c5cb259ab844b649280687d1621a7e3bf58 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 14 Jan 2016 15:55:42 +0800 Subject: [PATCH 09/23] fix popover API table --- components/popover/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/popover/index.md b/components/popover/index.md index 7018cd1358..c64b6532ad 100644 --- a/components/popover/index.md +++ b/components/popover/index.md @@ -20,7 +20,7 @@ | 参数 | 说明 | 类型 | 默认值 | |-----------|------------------------------------------|---------------|--------| | trigger | 触发行为,可选 `hover/focus/click` | string | hover | -| placement | 气泡框位置,可选 `top/left/right/bottom/topLeft/topRight/bottomLeft/bottomRight/leftTop/leftBottom/rightTop/rightBottom` | string | top | +| placement | 气泡框位置,可选 `top/left/right/bottom` `topLeft/topRight/bottomLeft/bottomRight` `leftTop/leftBottom/rightTop/rightBottom` | string | top | | title | 卡片标题 | React.Element | 无 | | overlay | 卡片内容 | React.Element | 无 | | prefixCls | 浮层的类名 | string | ant-popover | From fd1312803fd49586ded9af39d923457540c515cc Mon Sep 17 00:00:00 2001 From: yiminghe Date: Thu, 14 Jan 2016 16:38:37 +0800 Subject: [PATCH 10/23] upgrade calendar/timePicker. Fixes #822 --- components/time-picker/index.jsx | 13 ++++++------- components/time-picker/locale/en_US.js | 14 ++++---------- components/time-picker/locale/zh_CN.js | 14 ++++---------- package.json | 4 ++-- 4 files changed, 16 insertions(+), 29 deletions(-) diff --git a/components/time-picker/index.jsx b/components/time-picker/index.jsx index 750485201c..d0098dc379 100644 --- a/components/time-picker/index.jsx +++ b/components/time-picker/index.jsx @@ -10,7 +10,8 @@ const AntTimePicker = React.createClass({ return { format: 'HH:mm:ss', prefixCls: 'ant-time-picker', - onChange() {}, + onChange() { + }, locale: {}, align: { offset: [0, -2], @@ -49,7 +50,7 @@ const AntTimePicker = React.createClass({ parseTimeFromValue(value) { if (value) { return this.getFormatter().parse(value, { - locale: this.getLocale(), + locale: this.getLocale().calendar, obeyCount: true, }); } @@ -62,15 +63,13 @@ const AntTimePicker = React.createClass({ getLocale() { // 统一合并为完整的 Locale - let locale = objectAssign({}, defaultLocale, this.props.locale); - locale.lang = objectAssign({}, defaultLocale.lang, this.props.locale.lang); - return locale; + return objectAssign({}, defaultLocale, this.props.locale); }, render() { const props = objectAssign({}, this.props); props.placeholder = ('placeholder' in this.props) - ? props.placeholder : this.getLocale().lang.placeholder; + ? props.placeholder : this.getLocale().placeholder; if (props.defaultValue) { props.defaultValue = this.parseTimeFromValue(props.defaultValue); } else { @@ -96,7 +95,7 @@ const AntTimePicker = React.createClass({ diff --git a/components/time-picker/locale/en_US.js b/components/time-picker/locale/en_US.js index 7abd8877d0..2566680873 100644 --- a/components/time-picker/locale/en_US.js +++ b/components/time-picker/locale/en_US.js @@ -1,14 +1,8 @@ -import objectAssign from 'object-assign'; -import GregorianCalendarLocale from 'gregorian-calendar/lib/locale/en_US'; import TimepickerLocale from 'rc-time-picker/lib/locale/en_US'; -// 统一合并为完整的 Locale -let locale = objectAssign({}, GregorianCalendarLocale); -locale.lang = objectAssign({ - placeholder: 'Select a time' -}, TimepickerLocale); - -// All settings at: -// https://github.com/ant-design/ant-design/issues/424 +const locale = { + placeholder: 'Select a time', + ... TimepickerLocale, +}; export default locale; diff --git a/components/time-picker/locale/zh_CN.js b/components/time-picker/locale/zh_CN.js index 4560232f2a..4db90bf0c6 100644 --- a/components/time-picker/locale/zh_CN.js +++ b/components/time-picker/locale/zh_CN.js @@ -1,14 +1,8 @@ -import objectAssign from 'object-assign'; -import GregorianCalendarLocale from 'gregorian-calendar/lib/locale/zh_CN'; import TimepickerLocale from 'rc-time-picker/lib/locale/zh_CN'; -// 统一合并为完整的 Locale -let locale = objectAssign({}, GregorianCalendarLocale); -locale.lang = objectAssign({ - placeholder: '请选择时间' -}, TimepickerLocale); - -// All settings at: -// https://github.com/ant-design/ant-design/issues/424 +const locale = { + placeholder: '请选择时间', + ... TimepickerLocale, +}; export default locale; diff --git a/package.json b/package.json index 35d80f4458..1de69345a4 100644 --- a/package.json +++ b/package.json @@ -59,10 +59,10 @@ "rc-switch": "~1.3.1", "rc-table": "~3.8.0", "rc-tabs": "~5.6.0", - "rc-time-picker": "~1.0.0", + "rc-time-picker": "~1.1.0", "rc-tooltip": "~3.3.0", "rc-tree": "~0.26.1", - "rc-tree-select": "^0.3.3", + "rc-tree-select": "~0.3.3", "rc-trigger": "~1.0.6", "rc-upload": "~1.7.0", "rc-util": "~3.0.1", From 772eea09c7ef1012c91efc066259b75dbde965b3 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 14 Jan 2016 16:43:48 +0800 Subject: [PATCH 11/23] support pending timeline node, ref #708 --- components/timeline/demo/pending.md | 4 +- components/timeline/index.jsx | 70 ++++++++++++++++------------- components/timeline/index.md | 2 +- style/components/timeline.less | 12 +++-- 4 files changed, 50 insertions(+), 38 deletions(-) diff --git a/components/timeline/demo/pending.md b/components/timeline/demo/pending.md index a373023a73..91ed9c6cea 100644 --- a/components/timeline/demo/pending.md +++ b/components/timeline/demo/pending.md @@ -2,7 +2,7 @@ - order: 2 -在最后位置添加一个幽灵节点,表示时间轴未完成,还在记录过程中。 +在最后位置添加一个幽灵节点,表示时间轴未完成,还在记录过程中。可以指定 `pending={true}` 或者 `pending={一个 React 元素}`。 --- @@ -10,7 +10,7 @@ import { Timeline } from 'antd'; ReactDOM.render( - +查看更多}> 创建服务现场 2015-09-01 初步排除网络异常 2015-09-01 技术测试异常 2015-09-01 diff --git a/components/timeline/index.jsx b/components/timeline/index.jsx index d609ba9724..41e14811db 100644 --- a/components/timeline/index.jsx +++ b/components/timeline/index.jsx @@ -1,56 +1,62 @@ import React from 'react'; +import classNames from 'classnames'; -let Timeline = React.createClass({ +const TimelineItem = React.createClass({ getDefaultProps() { return { - prefixCls: 'ant-timeline' + prefixCls: 'ant-timeline', + color: 'blue', + last: false, + pending: false, }; }, render() { - let children = this.props.children; + const { prefixCls, color, last, children, pending } = this.props; + const itemClassName = classNames({ + [prefixCls + '-item']: true, + [prefixCls + '-item-last']: last, + [prefixCls + '-item-pending']: pending, + }); return ( -
    - {React.Children.map(children, function (ele, idx) { - let np = { - timelineLast: idx === children.length - 1, - pending: this.props.pending - }; - return React.cloneElement(ele, np); - }, this)} -
+
  • +
    +
    +
    {children}
    +
  • ); } }); -Timeline.Item = React.createClass({ +const Timeline = React.createClass({ getDefaultProps() { return { prefixCls: 'ant-timeline', - color: 'blue', - pending: false }; }, render() { - let props = this.props; - let prefixCls = props.prefixCls; - let color = props.color; - let pending = props.pending; - let timelineLast = props.timelineLast; - let endCls = pending && timelineLast ? prefixCls + '-item-last' : ''; - let last = pending && timelineLast ? -
    : - null; - let lastTailShow = (timelineLast && !pending) ? 'none' : 'block'; - + const { prefixCls, children, pending } = this.props; + const pendingNode = typeof pending === 'boolean' ? null : pending; + const className = classNames({ + [prefixCls]: true, + [prefixCls + '-pending']: !!pending, + }); return ( -
  • -
    -
    -
    {props.children}
    - {last} -
  • +
      + { + React.Children.map(children, (ele, idx) => + React.cloneElement(ele, { + last: idx === children.length - 1, + }) + ) + } + {(!!pending) + ? {pendingNode} + : null} +
    ); } }); +Timeline.Item = TimelineItem; + export default Timeline; diff --git a/components/timeline/index.md b/components/timeline/index.md index cdfb8d24dd..e8c8ac7b63 100644 --- a/components/timeline/index.md +++ b/components/timeline/index.md @@ -30,7 +30,7 @@ | 参数 | 说明 | 类型 | 可选值 |默认值 | |-----------|------------------------------------------|------------|-------|--------| -| pending | 指定最后一个幽灵节点。 | boolean | 无 | false | +| pending | 指定最后一个幽灵节点是否存在或内容 | boolean or React.Element | 无 | false | ### Timeline.Item diff --git a/style/components/timeline.less b/style/components/timeline.less index 2ef3f6c58f..3d1318ef39 100644 --- a/style/components/timeline.less +++ b/style/components/timeline.less @@ -17,6 +17,10 @@ border-left: 2px solid @timeline-color; } + &-pending &-tail { + display: none; + } + &-head { position: absolute; width: 12px; @@ -32,9 +36,6 @@ &-green { border: 2px solid @success-color; } - &-end { - border: 2px solid @timeline-color; - } } &-content { @@ -47,10 +48,15 @@ &-last { .@{timeline-prefix-cls}-item-tail { border-left: 2px dotted @timeline-color; + display: none; } .@{timeline-prefix-cls}-item-content { min-height: 48px; } } } + + &&-pending &-item-last &-item-tail { + display: block; + } } From 41ed04e977406af3d482bc4a22f06296389cae24 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Thu, 14 Jan 2016 16:46:38 +0800 Subject: [PATCH 12/23] style: update code style to please lint --- components/breadcrumb/index.jsx | 4 ++-- components/calendar/index.jsx | 4 ++-- components/message/index.jsx | 4 ++-- components/popconfirm/index.jsx | 2 +- components/upload/index.jsx | 4 ++-- components/upload/uploadList.jsx | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/components/breadcrumb/index.jsx b/components/breadcrumb/index.jsx index 657a477b77..f5be6064ce 100644 --- a/components/breadcrumb/index.jsx +++ b/components/breadcrumb/index.jsx @@ -53,11 +53,11 @@ const Breadcrumb = React.createClass({ const ReactRouter = router; if (routes && routes.length > 0 && ReactRouter) { let Link = ReactRouter.Link; - crumbs = routes.map(function(route, i) { + crumbs = routes.map(function (route, i) { if (!route.breadcrumbName) { return null; } - const name = route.breadcrumbName.replace(/\:(.*)/g, function(replacement, key) { + const name = route.breadcrumbName.replace(/\:(.*)/g, function (replacement, key) { return params[key] || replacement; }); let link; diff --git a/components/calendar/index.jsx b/components/calendar/index.jsx index 9e4615ce85..e1dd790b14 100644 --- a/components/calendar/index.jsx +++ b/components/calendar/index.jsx @@ -5,9 +5,9 @@ import FullCalendar from 'rc-calendar/lib/FullCalendar'; import { PREFIX_CLS } from './Constants'; import Header from './Header'; -function noop () { return null; } +function noop() { return null; } -function zerofixed (v) { +function zerofixed(v) { if (v < 10) return '0' + v; return v + ''; } diff --git a/components/message/index.jsx b/components/message/index.jsx index d539c69e98..4228ff949f 100644 --- a/components/message/index.jsx +++ b/components/message/index.jsx @@ -46,9 +46,9 @@ function notice(content, duration = defaultDuration, type, onClose) { , onClose }); - return (function() { + return (function () { let target = key++; - return function() { + return function () { instance.removeNotice(target); }; })(); diff --git a/components/popconfirm/index.jsx b/components/popconfirm/index.jsx index 8af14010bf..c16db5945d 100644 --- a/components/popconfirm/index.jsx +++ b/components/popconfirm/index.jsx @@ -4,7 +4,7 @@ import Icon from '../icon'; import Button from '../button'; const prefixCls = 'ant-popover'; -const noop = function() {}; +const noop = function () {}; const transitionNames = { top: 'zoom-down', bottom: 'zoom-up', diff --git a/components/upload/index.jsx b/components/upload/index.jsx index ad376c9176..c3b380ef2b 100644 --- a/components/upload/index.jsx +++ b/components/upload/index.jsx @@ -37,7 +37,7 @@ function genPercentAdd() { let k = 0.1; const i = 0.01; const end = 0.98; - return function(s) { + return function (s) { let start = s; if (start >= end) { return start; @@ -65,7 +65,7 @@ const AntUpload = React.createClass({ let targetItem; let nextFileList = this.state.fileList.concat(); if (file.length > 0) { - targetItem = file.map(function(f) { + targetItem = file.map(function (f) { const fileObject = fileToObject(f); fileObject.status = 'uploading'; return fileObject; diff --git a/components/upload/uploadList.jsx b/components/upload/uploadList.jsx index 8aa606e208..0a6af8cedb 100644 --- a/components/upload/uploadList.jsx +++ b/components/upload/uploadList.jsx @@ -6,9 +6,9 @@ import { Line } from '../progress'; import classNames from 'classnames'; // https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL -const previewFile = function(file, callback) { +const previewFile = function (file, callback) { const reader = new FileReader(); - reader.onloadend = function() { + reader.onloadend = function () { callback(reader.result); }; reader.readAsDataURL(file); From a145a3ec32725bbfc135ff5d9a28533380fad177 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Thu, 14 Jan 2016 16:47:01 +0800 Subject: [PATCH 13/23] chore: update package.json --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1de69345a4..3eae53fd8c 100644 --- a/package.json +++ b/package.json @@ -122,8 +122,9 @@ "site": "npm run clean && webpack --config webpack.deploy.config.js && webpack --config webpack.antd.config.js && NODE_ENV=PRODUCTION nico build", "deploy": "rm -rf node_modules && node scripts/install.js && npm run just-deploy", "just-deploy": "npm run site && node scripts/deploy.js", - "lint": "eslint components test index.js --ext '.js,.jsx' && npm run mdlint && npm run lesshint", - "mdlint": "eslint components/*/demo/*.md --ext '.md' --global 'React,ReactDOM,mountNode' --rule 'no-console: 0'", + "lint": "npm run srclint && npm run mdlint && npm run lesshint", + "srclint": "eslint --fix components test index.js --ext '.js,.jsx'", + "mdlint": "eslint --fix components/*/demo/*.md --ext '.md' --global 'React,ReactDOM,mountNode' --rule 'no-console: 0'", "lesshint": "lesshint style/ -e 'style/+(core|mixins)/+(base|iconfont|normalize|layouts|compatibility|grid).less'", "test": "npm run lint && webpack && npm run jest", "jest": "jest", From dc3b34510bd460ad41845cbba4430bb11581deab Mon Sep 17 00:00:00 2001 From: yiminghe Date: Thu, 14 Jan 2016 19:15:21 +0800 Subject: [PATCH 14/23] compatible with rc-form --- components/checkbox/Group.jsx | 5 +++-- components/date-picker/PickerMixin.jsx | 4 +--- components/time-picker/index.jsx | 19 ++++++++++++------- package.json | 7 ++++--- scripts/demo.js | 1 + 5 files changed, 21 insertions(+), 15 deletions(-) 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'); From 1afb9b543d327c02644ad469d337c2ecd5fb2c62 Mon Sep 17 00:00:00 2001 From: yiminghe Date: Thu, 14 Jan 2016 19:23:25 +0800 Subject: [PATCH 15/23] fix scripts --- package.json | 2 +- scripts/prenpm.js | 2 +- scripts/publish.sh | 2 +- webpack.antd.config.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index cb6062364b..eca5ef7729 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "0.12.0-beta9", + "version": "0.12.0-beta10", "title": "Ant Design", "description": "一个 UI 设计语言", "homepage": "http://ant.design/", diff --git a/scripts/prenpm.js b/scripts/prenpm.js index a9882a228a..3bca6f91f6 100644 --- a/scripts/prenpm.js +++ b/scripts/prenpm.js @@ -13,7 +13,7 @@ fs.writeFileSync( "module.exports = " + JSON.stringify(require('../package.json')) + ";", 'utf-8' ); -var antdCss = path.join(cwd, 'dist/index.css'); +var antdCss = path.join(cwd, 'dist/antd.css'); fs.createReadStream(antdCss) .pipe(fs.createWriteStream(path.join(cwd, 'lib/index.css'))); console.log('prenpm done'); diff --git a/scripts/publish.sh b/scripts/publish.sh index 9545576efe..f7544f8bda 100644 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -1,6 +1,6 @@ npm run babel rm -rf dist -webpack +webpack --config webpack.antd.config.js node scripts/prenpm.js npm publish $1 $2 rm -rf lib diff --git a/webpack.antd.config.js b/webpack.antd.config.js index 877ab9d096..cbc66bb90a 100644 --- a/webpack.antd.config.js +++ b/webpack.antd.config.js @@ -1,6 +1,6 @@ var config = require('./webpack.config'); config.entry = { - 'antd': ['./index.js'] + 'antd': ['./index.js', './style/index.less'] }; config.externals = { 'react': { From 6a6cc8228a5edfd4880cba0c994cc5114b665122 Mon Sep 17 00:00:00 2001 From: yiminghe Date: Thu, 14 Jan 2016 19:38:07 +0800 Subject: [PATCH 16/23] update index --- index.js | 9 +++++---- scripts/prenpm.js | 10 +--------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/index.js b/index.js index 20c18196c6..f88b5647ff 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,6 @@ -import React from 'react'; +// this file is not used if use https://github.com/ant-design/babel-plugin-antd + +const React = require('react'); const antd = { Affix: require('./components/affix'), @@ -47,10 +49,9 @@ const antd = { Cascader: require('./components/cascader'), }; -antd.version = require('./package.json').version; - -const ReactVersion = React.version; if (process.env.NODE_ENV !== 'production') { + antd.version = require('./package.json').version; + const ReactVersion = React.version; const warning = require('warning'); const semver = require('semver'); const reactVersionInDeps = require('./package.json').devDependencies.react; diff --git a/scripts/prenpm.js b/scripts/prenpm.js index 3bca6f91f6..ce17cdae54 100644 --- a/scripts/prenpm.js +++ b/scripts/prenpm.js @@ -1,18 +1,10 @@ var fs = require('fs'); var cwd = process.cwd(); var path = require('path'); -var pkg = require('../package'); - var originalIndex = fs.readFileSync(path.join(cwd, 'lib/index.js'), 'utf-8'); var newIndex = originalIndex - .replace(/\/components\//g, '/') - .replace(/require\(\'\.\/package.json\'\)/g, "require('./package')"); + .replace(/\/components\//g, '/'); fs.writeFileSync(path.join(cwd, 'lib/index.js'), newIndex, 'utf-8'); -fs.writeFileSync( - path.join(cwd, 'lib/package.js'), - "module.exports = " + JSON.stringify(require('../package.json')) + ";", - 'utf-8' -); var antdCss = path.join(cwd, 'dist/antd.css'); fs.createReadStream(antdCss) .pipe(fs.createWriteStream(path.join(cwd, 'lib/index.css'))); From e924c57296da68c38dc019b58e8ef172b785f2b6 Mon Sep 17 00:00:00 2001 From: yiminghe Date: Thu, 14 Jan 2016 19:23:25 +0800 Subject: [PATCH 17/23] fix scripts Conflicts: package.json --- scripts/prenpm.js | 2 +- scripts/publish.sh | 2 +- webpack.antd.config.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/prenpm.js b/scripts/prenpm.js index a9882a228a..3bca6f91f6 100644 --- a/scripts/prenpm.js +++ b/scripts/prenpm.js @@ -13,7 +13,7 @@ fs.writeFileSync( "module.exports = " + JSON.stringify(require('../package.json')) + ";", 'utf-8' ); -var antdCss = path.join(cwd, 'dist/index.css'); +var antdCss = path.join(cwd, 'dist/antd.css'); fs.createReadStream(antdCss) .pipe(fs.createWriteStream(path.join(cwd, 'lib/index.css'))); console.log('prenpm done'); diff --git a/scripts/publish.sh b/scripts/publish.sh index 9545576efe..f7544f8bda 100644 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -1,6 +1,6 @@ npm run babel rm -rf dist -webpack +webpack --config webpack.antd.config.js node scripts/prenpm.js npm publish $1 $2 rm -rf lib diff --git a/webpack.antd.config.js b/webpack.antd.config.js index 877ab9d096..cbc66bb90a 100644 --- a/webpack.antd.config.js +++ b/webpack.antd.config.js @@ -1,6 +1,6 @@ var config = require('./webpack.config'); config.entry = { - 'antd': ['./index.js'] + 'antd': ['./index.js', './style/index.less'] }; config.externals = { 'react': { From 229b0de3c6d22b9a2b1ccbbd51c90321b74a3b65 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 14 Jan 2016 21:15:25 +0800 Subject: [PATCH 18/23] upgrade rc-upload to 1.8.0, close #677 --- components/upload/index.md | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/components/upload/index.md b/components/upload/index.md index bcbbcbf73e..6fba743b8f 100644 --- a/components/upload/index.md +++ b/components/upload/index.md @@ -23,6 +23,7 @@ | name | 可选参数, 上传的文件 | String | file | | action | 必选参数, 上传的地址 | String | 无 | | data | 可选参数, 上传所需参数 | Object | 无 | +| headers | 可选参数, 设置上传的请求头部,IE10 以上有效 | Object | 无 | | showUploadList | 可选参数, 是否展示 uploadList, 默认开启 | Boolean | true | | multiple | 可选参数, 是否支持多选文件,`ie10+` 支持。开启后按住 ctrl 可选择多个文件。 | Boolean | false | | accept | 可选参数, 接受上传的文件类型, 详见 input accept Attribute | String | 无 | diff --git a/package.json b/package.json index eca5ef7729..edfbee4fc7 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "rc-tree": "~0.26.1", "rc-tree-select": "~0.3.3", "rc-trigger": "~1.0.6", - "rc-upload": "~1.7.0", + "rc-upload": "~1.8.0", "rc-util": "~3.0.1", "react-slick": "~0.9.1", "semver": "~5.1.0", From 71c84a2a44d49aed5ca9e84c99322d6f2762a579 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 14 Jan 2016 21:34:55 +0800 Subject: [PATCH 19/23] Style: fix upload picture long filename bug --- style/components/upload.less | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/style/components/upload.less b/style/components/upload.less index abd3dc1836..f435efe77e 100644 --- a/style/components/upload.less +++ b/style/components/upload.less @@ -158,9 +158,9 @@ &-picture &-item-thumbnail { width: 48px; height: 48px; - display: inline-block; - overflow: hidden; - vertical-align: middle; + position: absolute; + top: 8px; + left: 8px; } &-picture &-item-thumbnail img { @@ -182,6 +182,11 @@ margin: 0 0 0 8px; line-height: 42px; transition: all 0.3s ease; + padding-left: 48px; + padding-right: 8px; + max-width: 100%; + display: inline-block; + box-sizing: border-box; } &-picture &-item-uploading &-item-name { From 1514d28dc45b853a1db5656ba528a330ede2a2ad Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 14 Jan 2016 21:42:02 +0800 Subject: [PATCH 20/23] update tree select doc --- components/tree-select/index.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/tree-select/index.md b/components/tree-select/index.md index c6c940ce86..ccb576b230 100644 --- a/components/tree-select/index.md +++ b/components/tree-select/index.md @@ -1,14 +1,16 @@ # TreeSelect - category: Components -- chinese: 树选择控件 +- chinese: 树选择 - type: 表单 --- +树型选择控件。 + ## 何时使用 -当需要从树控件中灵活地筛选数据时 +类似 Select 的选择控件,可选择的数据结构是一个树形结构时,可以使用 TreeSelect,例如公司层级、学科系统、分类目录等等。 ## API From dab82feb78d461f8123742891a4a7d509e3c4dad Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 14 Jan 2016 21:44:35 +0800 Subject: [PATCH 21/23] auto eslint fix in scripts --- components/alert/index.jsx | 28 ++++++++++++++-------------- components/input/index.jsx | 16 ++++++++-------- components/menu/index.jsx | 20 ++++++++++---------- components/notification/index.jsx | 28 ++++++++++++++-------------- 4 files changed, 46 insertions(+), 46 deletions(-) diff --git a/components/alert/index.jsx b/components/alert/index.jsx index a5cf1fa569..91c0f8ad23 100644 --- a/components/alert/index.jsx +++ b/components/alert/index.jsx @@ -44,20 +44,20 @@ export default React.createClass({ let iconType = ''; switch (type) { - case 'success': - iconType = 'check-circle'; - break; - case 'info': - iconType = 'info-circle'; - break; - case 'error': - iconType = 'exclamation-circle'; - break; - case 'warn': - iconType = 'exclamation-circle'; - break; - default: - iconType = 'default'; + case 'success': + iconType = 'check-circle'; + break; + case 'info': + iconType = 'info-circle'; + break; + case 'error': + iconType = 'exclamation-circle'; + break; + case 'warn': + iconType = 'exclamation-circle'; + break; + default: + iconType = 'default'; } // use outline icon in alert with description diff --git a/components/input/index.jsx b/components/input/index.jsx index 1d5c4d8bde..9bb54870bd 100644 --- a/components/input/index.jsx +++ b/components/input/index.jsx @@ -72,9 +72,9 @@ class Input extends React.Component { } switch (props.size) { - case 'small': inputClassName = prefixClsFn(prefixCls, 'input', 'input-sm'); break; - case 'large': inputClassName = prefixClsFn(prefixCls, 'input', 'input-lg'); break; - default: + case 'small': inputClassName = prefixClsFn(prefixCls, 'input', 'input-sm'); break; + case 'large': inputClassName = prefixClsFn(prefixCls, 'input', 'input-lg'); break; + default: } let placeholder = props.placeholder; if (placeholder && ieGT9()) { @@ -84,14 +84,14 @@ class Input extends React.Component { props.value = fixControlledValue(props.value); } switch (props.type) { - case 'textarea': - return ( + case 'textarea': + return (