Merge branch 'master' into antd-3.0

This commit is contained in:
nikogu 2017-09-28 17:56:36 +08:00
commit 09addde73c
3 changed files with 35 additions and 4 deletions

View File

@ -21,7 +21,7 @@ A carousel component. Scales with its container.
| vertical | Whether to use a vertical display | boolean | `false` |
| autoplay | Whether to scroll automatically | boolean | `false` |
| easing | Transition interpolation function name | string | `linear` |
| beforeChange | Callback function called before the current index changes | function(from, to) |
| afterChange | Callback function called after the current index changes | function(current) |
| beforeChange | Callback function called before the current index changes | function(from, to) | - |
| afterChange | Callback function called after the current index changes | function(current) | - |
For more info on the parameters, refer to the https://github.com/akiran/react-slick

View File

@ -22,7 +22,7 @@ subtitle: 走马灯
| vertical | 垂直显示 | boolean | false |
| autoplay | 是否自动切换 | boolean | false |
| easing | 动画效果 | string | linear |
| beforeChange | 切换面板的回调 | function(from, to) | 无
| afterChange | 切换面板的回调 | function(current) | 无
| beforeChange | 切换面板的回调 | function(from, to) | 无 |
| afterChange | 切换面板的回调 | function(current) | 无 |
更多参数可参考https://github.com/akiran/react-slick

View File

@ -1,9 +1,33 @@
// matchMedia polyfill for
// https://github.com/WickyNilliams/enquire.js/issues/82
if (typeof window !== 'undefined') {
const matchMediaPolyfill = (mediaQuery: string): MediaQueryList => {
return {
media: mediaQuery,
matches: false,
addListener() {
},
removeListener() {
},
};
};
window.matchMedia = window.matchMedia || matchMediaPolyfill;
}
import React from 'react';
import classNames from 'classnames';
import omit from 'omit.js';
import PropTypes from 'prop-types';
import Icon from '../icon';
const dimensionMap = {
xs: '480px',
sm: '768px',
md: '992px',
lg: '1200px',
xl: '1600px',
};
export interface SiderProps {
style?: React.CSSProperties;
prefixCls?: string;
@ -40,6 +64,13 @@ export default class Sider extends React.Component<SiderProps, any> {
constructor(props) {
super(props);
let matchMedia;
if (typeof window !== 'undefined') {
matchMedia = window.matchMedia;
}
if (matchMedia && props.breakpoint && props.breakpoint in dimensionMap) {
this.mql = matchMedia(`(max-width: ${dimensionMap[props.breakpoint]})`);
}
let collapsed;
if ('collapsed' in props) {
collapsed = props.collapsed;