Browse Source

Merge branch 'master' into antd-3.0

pull/7971/merge
afc163 7 years ago
parent
commit
ef443ad047
  1. 4
      components/auto-complete/style/index.less
  2. 12
      components/breadcrumb/index.en-US.md
  3. 12
      components/breadcrumb/index.zh-CN.md
  4. 2
      components/button/button-group.tsx
  5. 6
      components/button/button.tsx
  6. 3
      components/cascader/index.tsx
  7. 2
      components/form/Form.tsx
  8. 5
      components/form/style/index.less
  9. 16
      components/input/style/mixin.less
  10. 8
      components/notification/__tests__/index.test.js
  11. 2
      components/select/demo/size.md
  12. 4
      components/style/themes/default.less

4
components/auto-complete/style/index.less

@ -21,8 +21,8 @@
line-height: @input-height-base;
}
&__placeholder {
margin-left: (@input-padding-horizontal + 1px);
margin-right: (@input-padding-horizontal + 1px);
margin-left: (@input-padding-horizontal-base + 1px);
margin-right: (@input-padding-horizontal-base + 1px);
}
&--single {

12
components/breadcrumb/index.en-US.md

@ -31,10 +31,20 @@ The link of Breadcrumb item targets `#` by default, you can use `itemRender` to
```jsx
import { Link } from 'react-router';
const routes = [{
path: 'index',
 breadcrumbName: 'home'
}, {
path: 'first',
breadcrumbName: 'first'
}, {
path: 'second',
breadcrumbName: 'second'
}];
function itemRender(route, params, routes, paths) {
const last = routes.indexOf(route) === routes.length - 1;
return last ? <span>{route.breadcrumbName}</span> : <Link to={paths.join('/')}>{route.breadcrumbName}</Link>;
}
return <Breadcrumb itemRender={itemRender} />;
return <Breadcrumb itemRender={itemRender} routes={routes} />;
```

12
components/breadcrumb/index.zh-CN.md

@ -31,10 +31,20 @@ title: Breadcrumb
```jsx
import { Link } from 'react-router';
const routes = [{
path: 'index',
breadcrumbName: '首页'
}, {
path: 'first',
breadcrumbName: '一级面包屑'
}, {
path: 'second',
breadcrumbName: '当前页面'
}];
function itemRender(route, params, routes, paths) {
const last = routes.indexOf(route) === routes.length - 1;
return last ? <span>{route.breadcrumbName}</span> : <Link to={paths.join('/')}>{route.breadcrumbName}</Link>;
}
return <Breadcrumb itemRender={itemRender} />;
return <Breadcrumb itemRender={itemRender} routes={routes}/>;
```

2
components/button/button-group.tsx

@ -10,7 +10,7 @@ export interface ButtonGroupProps {
}
const ButtonGroup: React.SFC<ButtonGroupProps> = (props) => {
const { prefixCls = 'ant-btn-group', size = '', className, ...others } = props;
const { prefixCls = 'ant-btn-group', size, className, ...others } = props;
// large => lg
// small => sm

6
components/button/button.tsx

@ -61,7 +61,6 @@ export default class Button extends React.Component<ButtonProps, any> {
static defaultProps = {
prefixCls: 'ant-btn',
loading: false,
clicked: false,
ghost: false,
};
@ -83,6 +82,7 @@ export default class Button extends React.Component<ButtonProps, any> {
super(props);
this.state = {
loading: props.loading,
clicked: false,
};
}
@ -124,7 +124,7 @@ export default class Button extends React.Component<ButtonProps, any> {
render() {
const {
type, shape, size = '', className, htmlType, children, icon, prefixCls, ghost, ...others,
type, shape, size, className, htmlType, children, icon, prefixCls, ghost, ...others,
} = this.props;
const { loading, clicked } = this.state;
@ -159,7 +159,7 @@ export default class Button extends React.Component<ButtonProps, any> {
return (
<button
{...omit(others, ['loading', 'clicked'])}
{...omit(others, ['loading'])}
type={htmlType || 'button'}
className={classes}
onClick={this.handleClick}

3
components/cascader/index.tsx

@ -146,7 +146,7 @@ export default class Cascader extends React.Component<CascaderProps, any> {
popupVisible,
inputFocused: popupVisible,
inputValue: popupVisible ? this.state.inputValue : '',
});
});
const onPopupVisibleChange = this.props.onPopupVisibleChange;
if (onPopupVisibleChange) {
@ -337,6 +337,7 @@ export default class Cascader extends React.Component<CascaderProps, any> {
<Input
{...inputProps}
ref={this.saveInput}
prefixCls={inputPrefixCls}
placeholder={value && value.length > 0 ? undefined : placeholder}
className={`${prefixCls}-input ${sizeCls}`}
value={state.inputValue}

2
components/form/Form.tsx

@ -54,7 +54,7 @@ export type ValidationRule = {
validator?: (rule: any, value: any, callback: any, source?: any, options?: any) => any;
};
export type ValidateCallback = (erros: any, values: any) => void;
export type ValidateCallback = (errors: any, values: any) => void;
export type GetFieldDecoratorOptions = {
/** 子节点的值的属性,如 Checkbox 的是 'checked' */

5
components/form/style/index.less

@ -75,7 +75,7 @@ input[type="checkbox"] {
transition: margin .15s steps(1);
// nested FormItem
& > &,
& > &:last-child,
& :not(.@{form-prefix-cls}) > & {
margin-bottom: -@form-item-margin-bottom;
}
@ -294,7 +294,8 @@ form {
// Form layout
//== Vertical Form
.make-vertical-layout-label() {
padding: 0 0 8px;
padding: @form-vertical-label-padding;
margin: @form-vertical-label-margin;
display: block;
text-align: left;
line-height: @line-height-base;

16
components/input/style/mixin.less

@ -5,7 +5,7 @@
// size mixins for input
.input-lg() {
padding: @input-padding-vertical-lg @input-padding-horizontal;
padding: @input-padding-vertical-lg @input-padding-horizontal-lg;
height: @input-height-lg;
}
@ -41,7 +41,7 @@
.input() {
position: relative;
display: inline-block;
padding: @input-padding-vertical-base @input-padding-horizontal;
padding: @input-padding-vertical-base @input-padding-horizontal-base;
width: 100%;
height: @input-height-base;
font-size: @font-size-base;
@ -137,7 +137,7 @@
}
&-addon {
padding: @input-padding-vertical-base @input-padding-horizontal;
padding: @input-padding-vertical-base @input-padding-horizontal-base;
font-size: @font-size-base;
font-weight: normal;
line-height: 1;
@ -151,7 +151,7 @@
// Reset Select's style in addon
.@{ant-prefix}-select {
margin: -(@input-padding-vertical-base + 1px) (-@input-padding-horizontal); // lesshint spaceAroundOperator: false
margin: -(@input-padding-vertical-base + 1px) (-@input-padding-horizontal-base); // lesshint spaceAroundOperator: false
.@{ant-prefix}-select-selection {
background-color: inherit;
@ -328,18 +328,18 @@
}
.@{inputClass}-prefix {
left: @padding-xs;
left: @input-padding-horizontal-base + 1px;
}
.@{inputClass}-suffix {
right: @padding-xs;
right: @input-padding-horizontal-base + 1px;
}
.@{inputClass}:not(:first-child) {
padding-left: @input-padding-horizontal + @input-affix-width;
padding-left: @input-padding-horizontal-base + @input-affix-width;
}
.@{inputClass}:not(:last-child) {
padding-right: @input-padding-horizontal + @input-affix-width;
padding-right: @input-padding-horizontal-base + @input-affix-width;
}
}

8
components/notification/__tests__/index.test.js

@ -1,13 +1,13 @@
import notification from '..';
const delay = timeout => new Promise(resolve => setTimeout(resolve, timeout));
jest.useFakeTimers();
describe('notification', () => {
afterEach(() => {
notification.destroy();
});
it('should be able to hide manually', async () => {
it('should be able to hide manually', () => {
notification.open({
message: 'Notification Title',
duration: 0,
@ -20,10 +20,10 @@ describe('notification', () => {
});
expect(document.querySelectorAll('.ant-notification-notice').length).toBe(2);
notification.close('1');
await delay(300);
jest.runAllTimers();
expect(document.querySelectorAll('.ant-notification-notice').length).toBe(1);
notification.close('2');
await delay(300);
jest.runAllTimers();
expect(document.querySelectorAll('.ant-notification-notice').length).toBe(0);
});

2
components/select/demo/size.md

@ -11,7 +11,7 @@ title:
## en-US
The height of the inpub field for the select defaults to 32px. If size is set to large, the height will be 40px, and if set to small, 24px.
The height of the input field for the select defaults to 32px. If size is set to large, the height will be 40px, and if set to small, 24px.
````jsx
import { Select, Radio } from 'antd';

4
components/style/themes/default.less

@ -236,6 +236,8 @@
@label-color : @heading-color;
@form-item-margin-bottom : 32px;
@form-item-trailing-colon : true;
@form-vertical-label-padding : 0 0 8px;
@form-vertical-label-margin : 0;
// Input
// ---
@ -243,7 +245,9 @@
@input-height-lg : 40px;
@input-height-sm : 24px;
@input-padding-horizontal : @control-padding-horizontal - 1px;
@input-padding-horizontal-base: @input-padding-horizontal;
@input-padding-horizontal-sm : @control-padding-horizontal-sm - 1px;
@input-padding-horizontal-lg : @input-padding-horizontal;
@input-padding-vertical-base : 4px;
@input-padding-vertical-sm : 1px;
@input-padding-vertical-lg : 6px;

Loading…
Cancel
Save