Compare commits

...

13 Commits
3.7.2 ... 3.7.3

Author SHA1 Message Date
Wei Zhu
4a906137b8 Add testUrl
https://github.com/jsdom/jsdom/issues/2304
2018-07-28 17:45:21 +08:00
Wei Zhu
855b613ce9 Bump 3.7.3 2018-07-28 17:36:37 +08:00
Wei Zhu
d1ba62e50b Add 3.7.3 changelog (#11494) 2018-07-28 16:27:01 +08:00
qliu
c6518b92aa fix: get label should use childrenKeyName for arrayTreeFilter when us… (#11311)
* fix: get label should use childrenKeyName for arrayTreeFilter when use customer fieldNames otherwise It can not get correct label array

* feat: add fieldNames test case in Cascader

* fix: cli fail

* fix: cil fail again
2018-07-28 13:29:39 +08:00
Eric Turriff
1bbf59bb1d fixed typo in InputNumber docs 2018-07-28 13:03:37 +08:00
Ilan Hasanov
68ce09be4e 🐛 fix icons page 100% cpu usage 2018-07-28 02:05:02 +08:00
yoyo837
5ca7d75c0d fix doc 2018-07-28 02:04:49 +08:00
yoyo837
ce24f278cf docs 2018-07-28 02:04:49 +08:00
yoyo837
6ae02a9ab7 progress-dot 2018-07-28 02:04:49 +08:00
yoyo837
a0a0d88b78 Fix content without vertical alignment icon when using vertical label mode; And description text-align: center; 2018-07-28 02:04:49 +08:00
This JJ
2e7d08e98f Add id to Select props (#11189)
* Can set id to props on Select

* Update index.tsx
2018-07-27 16:47:07 +08:00
dependabot[bot]
45f1ff5bf7 build(deps-dev): update stylelint requirement to 9.4.0
Updates the requirements on [stylelint](https://github.com/stylelint/stylelint) to permit the latest version.
- [Release notes](https://github.com/stylelint/stylelint/releases)
- [Changelog](https://github.com/stylelint/stylelint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stylelint/stylelint/commits/9.4.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-27 15:39:16 +08:00
Grant Klinsing
fd06d7b8b1 Update Pagination Typescript definition to include "role" (#11474)
* Add data-, aria- and role prop types to match rc-pagination

* Remove data- and aria- definitions since they are allowed already
2018-07-27 15:14:20 +08:00
15 changed files with 109 additions and 40 deletions

View File

@@ -48,4 +48,5 @@ module.exports = {
tsConfigFile: './tsconfig.test.json',
}
},
testURL: 'http://localhost',
};

View File

@@ -15,6 +15,16 @@ timeline: true
---
## 3.7.3
`2018-07-28`
- 🐞 Fix issue resulting in title not vertical align with icon when setting `labelPlacement` to `vertical` in Steps. [#11426](https://github.com/ant-design/ant-design/pull/11426) [@yoyo837](https://github.com/yoyo837)
- 🐞 Fix issue resulting in the children field specified in `fieldName` could not be read correctly in Cascader. [#11311](https://github.com/ant-design/ant-design/pull/11311) [@405go](https://github.com/405go)
- TypeScript
- 🐞 Fix type definition of Pagination. [#11474](https://github.com/ant-design/ant-design/pull/11474) [@kagd](https://github.com/kagd)
- 🐞 Fix type definition of Select. [#11189](https://github.com/ant-design/ant-design/pull/11189<Paste>) [@thisJJ](https://github.com/thisJJ)
## 3.7.2
`2018-07-25`

View File

@@ -15,6 +15,16 @@ timeline: true
---
## 3.7.3
`2018-07-28`
- 🐞 修复 Steps 在 `labelPlacement``vertical` 时标题与图标不对齐的问题。[#11426](https://github.com/ant-design/ant-design/pull/11426) [@yoyo837](https://github.com/yoyo837)
- 🐞 修复 Cascader 设置 `fieldNames` 时不能正确读取子节点的问题。[#11311](https://github.com/ant-design/ant-design/pull/11311) [@405go](https://github.com/405go)
- TypeScript
- 🐞 修复 Pagination 类型定义。[#11474](https://github.com/ant-design/ant-design/pull/11474) [@kagd](https://github.com/kagd)
- 🐞 修复 Select 类型定义。[#11189](https://github.com/ant-design/ant-design/pull/11189<Paste>) [@thisJJ](https://github.com/thisJJ)
## 3.7.2
`2018-07-25`

View File

@@ -190,4 +190,40 @@ describe('Cascader', () => {
wrapper.setProps({ options: [options[0]] });
expect(wrapper.find('.ant-cascader-menu-item').length).toBe(1);
});
it('can use fieldNames', () => {
const customerOptions = [{
code: 'zhejiang',
name: 'Zhejiang',
items: [{
code: 'hangzhou',
name: 'Hangzhou',
items: [{
code: 'xihu',
name: 'West Lake',
}],
}],
}, {
code: 'jiangsu',
name: 'Jiangsu',
items: [{
code: 'nanjing',
name: 'Nanjing',
items: [{
code: 'zhonghuamen',
name: 'Zhong Hua Men',
}],
}],
}];
const wrapper = mount(<Cascader
options={customerOptions}
fieldNames={{
children: 'items',
label: 'name',
value: 'code',
}}
/>);
wrapper.instance().handleChange(['zhejiang', 'hangzhou', 'xihu'], customerOptions);
expect(wrapper.find('.ant-cascader-picker-label').text().split('/').length).toBe(3);
});
});

View File

@@ -253,6 +253,7 @@ export default class Cascader extends React.Component<CascaderProps, CascaderSta
const unwrappedValue = Array.isArray(value[0]) ? value[0] : value;
const selectedOptions: CascaderOptionType[] = arrayTreeFilter(options,
(o: CascaderOptionType, level: number) => o[names.value] === unwrappedValue[level],
{ childrenKeyName: names.children },
);
const label = selectedOptions.map(o => o[names.label]);
return displayRender(label, selectedOptions);

View File

@@ -18,7 +18,7 @@ When a numeric value needs to be provided.
| defaultValue | initial value | number | |
| disabled | disable the input | boolean | false |
| formatter | Specifies the format of the value presented | function(value: number \| string): string | - |
| max | max vale | number | Infinity |
| max | max value | number | Infinity |
| min | min value | number | -Infinity |
| parser | Specifies the value extracted from formatter | function( string): number | - |
| precision | precision of input value | number | - |

View File

@@ -27,6 +27,7 @@ export interface PaginationProps {
prefixCls?: string;
selectPrefixCls?: string;
itemRender?: (page: number, type: 'page' | 'prev' | 'next' | 'jump-prev' | 'jump-next') => React.ReactNode;
role?: string;
}
export interface PaginationConfig extends PaginationProps {

View File

@@ -27,6 +27,7 @@ export interface AbstractSelectProps {
dropdownMatchSelectWidth?: boolean;
onSearch?: (value: string) => any;
filterOption?: boolean | ((inputValue: string, option: React.ReactElement<OptionProps>) => any);
id?: string;
}
export interface LabeledValue {
@@ -85,6 +86,7 @@ const SelectPropTypes = {
optionLabelProp: PropTypes.string,
transitionName: PropTypes.string,
choiceTransitionName: PropTypes.string,
id: PropTypes.string,
};
// => It is needless to export the declaration of below two inner components.

View File

@@ -29,7 +29,8 @@ The whole of the step bar.
| -------- | ----------- | ---- | ------- |
| current | to set the current step, counting from 0. You can overwrite this state by using `status` of `Step` | number | 0 |
| direction | to specify the direction of the step bar, `horizontal` and `vertical` are currently supported | string | `horizontal` |
| progressDot | Steps with progress dot style, customize the progress dot by setting it to a function | Boolean or (iconDot, {index, status, title, description}) => ReactNode | false |
| labelPlacement | support vertial title and description | string | `horizontal` |
| progressDot | Steps with progress dot style, customize the progress dot by setting it to a function. labelPlacement will be `vertical` | Boolean or (iconDot, {index, status, title, description}) => ReactNode | false |
| size | to specify the size of the step bar, `default` and `small` are currently supported | string | `default` |
| status | to specify the status of current step, can be set to one of the following values: `wait` `process` `finish` `error` | string | `process` |

View File

@@ -30,7 +30,8 @@ title: Steps
| --- | --- | --- | --- |
| current | 指定当前步骤,从 0 开始记数。在子 Step 元素中,可以通过 `status` 属性覆盖状态 | number | 0 |
| direction | 指定步骤条方向。目前支持水平(`horizontal`)和竖直(`vertical`)两种方向 | string | horizontal |
| progressDot | 点状步骤条,可以设置为一个 function | Boolean or (iconDot, {index, status, title, description}) => ReactNode | false |
| labelPlacement | 指定标签放置位置,默认水平放图标右侧,可选`vertical`放图标下方 | string | `horizontal` |
| progressDot | 点状步骤条,可以设置为一个 function,labelPlacement 将强制为`vertical` | Boolean or (iconDot, {index, status, title, description}) => ReactNode | false |
| size | 指定大小,目前支持普通(`default`)和迷你(`small` | string | default |
| status | 指定当前步骤的状态,可选 `wait` `process` `finish` `error` | string | process |

View File

@@ -9,7 +9,8 @@
display: block;
text-align: center;
margin-top: 8px;
width: @steps-desciption-max-width;
// icon左边距离+一半icon宽度是content一半的宽度垂直对齐icon
width: (@steps-icon-size / 2 + 36px) * 2;
}
&-icon {
display: inline-block;
@@ -21,8 +22,5 @@
display: none;
}
}
&-description {
text-align: left;
}
}
}

View File

@@ -44,6 +44,9 @@
}
}
}
&-content {
width: @steps-desciption-max-width;
}
&-process .@{steps-prefix-cls}-item-icon {
width: @steps-current-dot-size;
height: @steps-current-dot-size;

View File

@@ -1,6 +1,6 @@
{
"name": "antd",
"version": "3.7.2",
"version": "3.7.3",
"title": "Ant Design",
"description": "An enterprise-class UI design language and React-based implementation",
"homepage": "http://ant.design/",
@@ -168,7 +168,7 @@
"reqwest": "^2.0.5",
"rimraf": "^2.5.4",
"scrollama": "^1.4.1",
"stylelint": "9.3.0",
"stylelint": "9.4.0",
"stylelint-config-standard": "^18.0.0",
"typescript": "~2.9.1",
"unified": "^7.0.0",

View File

@@ -2,34 +2,20 @@ import React from 'react';
import CopyToClipboard from 'react-copy-to-clipboard';
import { Icon, Badge } from 'antd';
export default class CopyableIcon extends React.Component {
state = {
justCopied: false,
};
const CopyableIcon = ({ type, isNew, justCopied, onCopied }) => (
<CopyToClipboard
text={`<Icon type="${type}" />`}
onCopy={() => onCopied(type)}
>
<li className={justCopied === type ? 'copied' : ''}>
<Icon type={type} />
<span className="anticon-class">
<Badge dot={isNew}>
{type}
</Badge>
</span>
</li>
</CopyToClipboard>
);
onCopied = () => {
this.setState({ justCopied: true }, () => {
setTimeout(() => {
this.setState({ justCopied: false });
}, 2000);
});
}
render() {
const { type, isNew } = this.props;
const { justCopied } = this.state;
const text = `<Icon type="${type}" />`;
return (
<CopyToClipboard text={text} onCopy={this.onCopied}>
<li className={justCopied ? 'copied' : ''}>
<Icon type={type} />
<span className="anticon-class">
<Badge dot={isNew}>
{type}
</Badge>
</span>
</li>
</CopyToClipboard>
);
}
}
export default CopyableIcon;

View File

@@ -7,6 +7,18 @@ export default class IconSet extends React.Component {
icons: [],
}
state = {
justCopied: null,
};
onCopied = (type) => {
this.setState({ justCopied: type }, () => {
setTimeout(() => {
this.setState({ justCopied: null });
}, 2000);
});
}
icons = {
direction: ['step-backward', 'step-forward', 'fast-backward', 'fast-forward', 'shrink', 'arrows-alt', 'down', 'up', 'left', 'right', 'caret-up', 'caret-down', 'caret-left', 'caret-right', 'up-circle', 'down-circle', 'left-circle', 'right-circle', 'up-circle-o', 'down-circle-o', 'right-circle-o', 'left-circle-o', 'double-right', 'double-left', 'verticle-left', 'verticle-right', 'forward', 'backward', 'rollback', 'enter', 'retweet', 'swap', 'swap-left', 'swap-right', 'arrow-up', 'arrow-down', 'arrow-left', 'arrow-right', 'play-circle', 'play-circle-o', 'up-square', 'down-square', 'left-square', 'right-square', 'up-square-o', 'down-square-o', 'left-square-o', 'right-square-o', 'login', 'logout', 'menu-fold', 'menu-unfold'],
suggestion: ['question', 'question-circle-o', 'question-circle', 'plus', 'plus-circle-o', 'plus-circle', 'pause', 'pause-circle-o', 'pause-circle', 'minus', 'minus-circle-o', 'minus-circle', 'plus-square', 'plus-square-o', 'minus-square', 'minus-square-o', 'info', 'info-circle-o', 'info-circle', 'exclamation', 'exclamation-circle-o', 'exclamation-circle', 'close', 'close-circle', 'close-circle-o', 'close-square', 'close-square-o', 'check', 'check-circle', 'check-circle-o', 'check-square', 'check-square-o', 'clock-circle-o', 'clock-circle', 'warning'],
@@ -24,6 +36,7 @@ export default class IconSet extends React.Component {
];
render() {
const { justCopied } = this.state;
const { className, catigory } = this.props;
const listClassName = classNames({
'anticons-list': true,
@@ -33,7 +46,13 @@ export default class IconSet extends React.Component {
return (
<ul className={listClassName}>
{this.icons[catigory].map(type => (
<CopyableIcon key={type} type={type} isNew={this.newIcons.indexOf(type) >= 0} />
<CopyableIcon
key={type}
type={type}
isNew={this.newIcons.indexOf(type) >= 0}
justCopied={justCopied}
onCopied={this.onCopied}
/>
))}
</ul>
);