diff --git a/components/badge/ScrollNumber.jsx b/components/badge/ScrollNumber.jsx index 9b91e788a3..27a2fd19d5 100644 --- a/components/badge/ScrollNumber.jsx +++ b/components/badge/ScrollNumber.jsx @@ -76,6 +76,7 @@ class AntScrollNumber extends React.Component { className: `${this.props.prefixCls}-only`, style: { transition: removeTransition && 'none', + WebkitTransform: `translate3d(0, ${-position * height}px, 0)`, transform: `translate3d(0, ${-position * height}px, 0)`, height, }, diff --git a/components/date-picker/index.jsx b/components/date-picker/index.jsx index 85670591ec..b6dd9fb69a 100644 --- a/components/date-picker/index.jsx +++ b/components/date-picker/index.jsx @@ -115,7 +115,7 @@ function createPicker(TheCalendar, defaultFormat) { pickerClass += ' ant-calendar-picker-open'; } return ( - + diff --git a/components/dropdown/dropdown.jsx b/components/dropdown/dropdown.jsx index 8cb236f885..8c0dfe0b31 100644 --- a/components/dropdown/dropdown.jsx +++ b/components/dropdown/dropdown.jsx @@ -6,6 +6,8 @@ export default React.createClass({ return { transitionName: 'slide-up', prefixCls: 'ant-dropdown', + mouseEnterDelay: 0.15, + mouseLeaveDelay: 0.1, }; }, render() { diff --git a/components/menu/index.md b/components/menu/index.md index 28fa33bfae..5f6e8ea9c0 100644 --- a/components/menu/index.md +++ b/components/menu/index.md @@ -17,9 +17,9 @@ ```html - 菜单项 + 菜单项 - 子菜单项 + 子菜单项 ``` diff --git a/components/popconfirm/index.jsx b/components/popconfirm/index.jsx index 79e21f0747..ad1dbb5de1 100644 --- a/components/popconfirm/index.jsx +++ b/components/popconfirm/index.jsx @@ -2,7 +2,9 @@ import React from 'react'; import Tooltip from 'rc-tooltip'; import Icon from '../icon'; import Button from '../button'; +import getPlacements from '../popover/placements'; +const placements = getPlacements(); const prefixCls = 'ant-popover'; const noop = function () {}; const transitionNames = { @@ -66,10 +68,10 @@ export default React.createClass({ const overlay = (
-

+

- {title} -

+
{title}
+
@@ -81,7 +83,9 @@ export default React.createClass({ const transitionName = transitionNames[placement]; return ( - diff --git a/components/popover/placements.js b/components/popover/placements.js new file mode 100644 index 0000000000..0b971f160d --- /dev/null +++ b/components/popover/placements.js @@ -0,0 +1,84 @@ +const autoAdjustOverflow = { + adjustX: 1, + adjustY: 1, +}; + +const targetOffset = [0, 0]; + +export default function getPlacements(config = {}) { + const { arrowWidth = 5, horizontalArrowShift = 16, verticalArrowShift = 12 } = config; + return { + left: { + points: ['cr', 'cl'], + overflow: autoAdjustOverflow, + offset: [-4, 0], + targetOffset, + }, + right: { + points: ['cl', 'cr'], + overflow: autoAdjustOverflow, + offset: [4, 0], + targetOffset, + }, + top: { + points: ['bc', 'tc'], + overflow: autoAdjustOverflow, + offset: [0, -4], + targetOffset, + }, + bottom: { + points: ['tc', 'bc'], + overflow: autoAdjustOverflow, + offset: [0, 4], + targetOffset, + }, + topLeft: { + points: ['bl', 'tc'], + overflow: autoAdjustOverflow, + offset: [-(horizontalArrowShift + arrowWidth), -4], + targetOffset, + }, + leftTop: { + points: ['tr', 'cl'], + overflow: autoAdjustOverflow, + offset: [-4, -(verticalArrowShift + arrowWidth)], + targetOffset, + }, + topRight: { + points: ['br', 'tc'], + overflow: autoAdjustOverflow, + offset: [horizontalArrowShift + arrowWidth, -4], + targetOffset, + }, + rightTop: { + points: ['tl', 'cr'], + overflow: autoAdjustOverflow, + offset: [4, -(verticalArrowShift + arrowWidth)], + targetOffset, + }, + bottomRight: { + points: ['tr', 'bc'], + overflow: autoAdjustOverflow, + offset: [horizontalArrowShift + arrowWidth, 4], + targetOffset, + }, + rightBottom: { + points: ['bl', 'cr'], + overflow: autoAdjustOverflow, + offset: [4, verticalArrowShift + arrowWidth], + targetOffset, + }, + bottomLeft: { + points: ['tl', 'bc'], + overflow: autoAdjustOverflow, + offset: [-(horizontalArrowShift + arrowWidth), 4], + targetOffset, + }, + leftBottom: { + points: ['br', 'cl'], + overflow: autoAdjustOverflow, + offset: [-4, verticalArrowShift + arrowWidth], + targetOffset, + }, + }; +} diff --git a/components/table/demo/row-selection-and-operation.md b/components/table/demo/row-selection-and-operation.md index 5f2244cd90..d303aa96cf 100644 --- a/components/table/demo/row-selection-and-operation.md +++ b/components/table/demo/row-selection-and-operation.md @@ -33,7 +33,7 @@ for (let i = 0; i < 46; i++) { const App = React.createClass({ getInitialState() { return { - selectedRowKeys: [], + selectedRowKeys: [], // 这里配置默认勾选列 loading: false, }; }, diff --git a/components/table/demo/row-selection-props.md b/components/table/demo/row-selection-props.md index ed3af7d2b2..3f52c18deb 100644 --- a/components/table/demo/row-selection-props.md +++ b/components/table/demo/row-selection-props.md @@ -12,9 +12,7 @@ import { Table } from 'antd'; const columns = [{ title: '姓名', dataIndex: 'name', - render(text) { - return {text}; - } + render: text => {text}, }, { title: '年龄', dataIndex: 'age' @@ -43,19 +41,9 @@ const data = [{ const rowSelection = { getCheckboxProps(record) { return { - defaultChecked: record.name === '李大嘴', // 配置默认勾选的列 disabled: record.name === '胡彦祖' // 配置无法勾选的列 }; }, - onChange(selectedRowKeys) { - console.log(`selectedRowKeys changed: ${selectedRowKeys}`); - }, - onSelect(record, selected, selectedRows) { - console.log(record, selected, selectedRows); - }, - onSelectAll(selected, selectedRows) { - console.log(selected, selectedRows); - }, }; ReactDOM.render( diff --git a/components/table/index.jsx b/components/table/index.jsx index 32ffc4d205..72648e2f2d 100644 --- a/components/table/index.jsx +++ b/components/table/index.jsx @@ -86,7 +86,7 @@ let AntTable = React.createClass({ componentWillReceiveProps(nextProps) { if (('pagination' in nextProps) && nextProps.pagination !== false) { this.setState({ - pagination: objectAssign({}, this.state.pagination, nextProps.pagination) + pagination: objectAssign({}, defaultPagination, this.state.pagination, nextProps.pagination) }); } // dataSource 的变化会清空选中项 diff --git a/components/tooltip/index.jsx b/components/tooltip/index.jsx index bb66a0f015..cb0dfb02da 100644 --- a/components/tooltip/index.jsx +++ b/components/tooltip/index.jsx @@ -1,5 +1,10 @@ import React from 'react'; import Tooltip from 'rc-tooltip'; +import getPlacements from '../popover/placements'; + +const placements = getPlacements({ + verticalArrowShift: 8, +}); export default React.createClass({ getDefaultProps() { @@ -42,6 +47,7 @@ export default React.createClass({ return ( - + diff --git a/package.json b/package.json index 416565f6d6..6d769c3157 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ "warning": "~2.1.0" }, "devDependencies": { + "autoprefixer": "^6.3.3", "babel-cli": "^6.2.0", "babel-core": "^6.2.1", "babel-jest": "^6.0.1", diff --git a/scripts/demo.js b/scripts/demo.js index e29b6bee0e..6f8a71a0f6 100644 --- a/scripts/demo.js +++ b/scripts/demo.js @@ -394,7 +394,7 @@ InstantClickChangeFns.push(function() { navMenu.removeClass('nav-hide').addClass('nav-show'); }); - $('body').on('click', function (e) { + $('body').on('click touchstart', function (e) { if (e.target !== $('.nav-phone-icon')[0] && !navMenu[0].contains(e.target) && navMenu.hasClass('nav-show')) { diff --git a/site/templates/layout.html b/site/templates/layout.html index 28ddc69da8..1629b3cb0d 100644 --- a/site/templates/layout.html +++ b/site/templates/layout.html @@ -13,7 +13,7 @@ {% block styles %}{% endblock %} - +