Compare commits

...

30 Commits

Author SHA1 Message Date
诸岳
a1c733ad07 Bump 3.26.9 2020-02-08 21:27:25 +08:00
诸岳
9918140695 docs: Add the changelog of 3.26.9 (#21289) 2020-02-08 21:25:53 +08:00
Chiciuc Nicușor
87cbe0168f Explicitly add children prop to Timeline. (#21265) 2020-02-08 19:16:09 +08:00
偏右
eea0b028c9 🐛 Typography editable should focus at the end (#21268)
close #21261
2020-02-07 13:15:53 +08:00
偏右
88bed67368 🐛 Fix Steps style when size="small" and labelPlacement="vertical" (#21258)
close #21257
2020-02-06 17:28:47 +08:00
Han
f7e7ce9d4f fix: Minor fix on ValidationRule to match AsyncValidator (#21250)
* Minor fix on ValidationRule to match AsyncValidator

* update doc
2020-02-06 10:44:49 +08:00
二货机器人
ae7666f8fa fix badge (#21237) 2020-02-05 14:23:21 +08:00
Jirka-Lhotka
3fb7325a21 Fix wrong event type of AntTreeNodeMouseEvent (#21200) 2020-02-03 20:31:27 +08:00
偏右
59c29a400d release 3.26.8 (#21187) 2020-02-03 12:45:28 +08:00
偏右
d3102bb2db 🐛 fix site menu affix bug (#21188)
close #21128
2020-02-03 12:35:04 +08:00
afc163
e036e4c9a3 site: 📣 promote g2plot 2020-02-03 11:38:44 +08:00
Chiciuc Nicușor
da3540bd59 Replace NativeButtonProps with ButtonProps for okButtonProps and cancelButtonProps. (#21165) 2020-01-31 22:09:49 +08:00
Teng YANG
bba87d4125 update display names for layout components (#21124)
(cherry picked from commit 286e0e97f8)
2020-01-28 15:26:55 +08:00
Teng YANG
6de8522894 fix: card actions font-size issue (#21106)
Fix card component action font-size not controlled by theme variable.
2020-01-26 11:40:06 +08:00
信鑫-King
674074ce93 fix: 3.x deploy site (#20682) 2020-01-17 12:31:56 +08:00
Amumu
c68f4463d3 fix error docs (#20926) 2020-01-16 15:58:24 +08:00
偏右
a96a95ccb8 🐛 Fix List item flex layout (#20897)
close #20648
2020-01-15 10:35:45 +08:00
偏右
b112378de3 🐛 Fix Tooltip title 0 is not shown (#20894)
close #20891
2020-01-14 17:55:40 +08:00
Amumu
db4bec92be version 3.23.0 (#20890) 2020-01-14 15:50:16 +08:00
信鑫-King
b6fc0168db chore: check commit (#20880) 2020-01-14 09:41:57 +08:00
信鑫-King
92fe411961 docs: 3.26.7 changelog (#20873)
* upd: version

* 📝 changelog

* 📝 docs
2020-01-14 07:40:32 +08:00
zefeng
ab29ecb377 fix: better approach to solve not show overflow content when in elastic (#20821) 2020-01-13 20:43:03 +08:00
afc163
23d5a856c0 🎬 improve Tag demo 2020-01-08 15:09:24 +08:00
偏右
6e4fa95d0f 🐛 fix Tree switcherIcon shown in leaf node (#20753)
close #20511
2020-01-08 13:17:49 +08:00
afc163
2753ce91c9 🐛 tweak @zindex-badge for table fixed column
close #20750
close #13930
2020-01-08 11:43:10 +08:00
偏右
057f5b8526 🐛 Fix Cascader search bug when fieldNames existed (#20720)
and label/value have same field name

close #20619
2020-01-08 10:38:36 +08:00
Amumu
d3eea22097 fix: correct the collapse-borderless class variable (#20718) (#20721)
Co-authored-by: Kuitos <kuitos.lau@gmail.com>
2020-01-07 15:39:42 +08:00
骗你是小猫咪
da2f54a18a refactor: improve digital input in tooltip demo (#20702) (#20717)
* refactor: improve digital input in tooltip demo

* fix lint
2020-01-07 12:02:21 +08:00
afc163
e5dd231aaa site: 📣 promote yuque activity 2020-01-06 18:03:04 +08:00
偏右
c6eafe8380 🐛 fix Input.Group 1px bug in vertical layout form (#20685)
close #20616
2020-01-06 14:26:11 +08:00
49 changed files with 1146 additions and 948 deletions

View File

@@ -3,7 +3,7 @@ on:
release:
types: [published]
branches:
- master
- 3.x-stable
jobs:
build-and-deploy:

View File

@@ -15,6 +15,38 @@ timeline: true
---
## 3.26.9
`2020-02-08`
- 🐞 Fix Badge that count is not align when wrapped by Typography. [#21237](https://github.com/ant-design/ant-design/pull/21237)
- 🐞 Fix Steps that icon is not align when `size="small"` and `labelPlacement="vertical"`. [#21258](https://github.com/ant-design/ant-design/pull/21258)
- 🐞 Fix Typography not focus at the end of textarea when `editable` is true. [#21268](https://github.com/ant-design/ant-design/pull/21268)
- TypeScript
- 💄 Improve type definition of validation rule's type for Form. [#21250](https://github.com/ant-design/ant-design/pull/21250) [@hansololai](https://github.com/hansololai)
- 🐞 Fix type definition of `event` for Tree. [#21200](https://github.com/ant-design/ant-design/pull/21200) [@Jirka-Lhotka](https://github.com/Jirka-Lhotka)
## 3.26.8
`2020-02-03`
- 🐞 Fix Tooltip hidden when `title` is `0`. [#20894](https://github.com/ant-design/ant-design/pull/20894)
- 🐞 Fix List `actions` inconsistent position. [#20897](https://github.com/ant-design/ant-design/pull/20897)
- 🐞 Fix Card `font-size` of `actions` not in less theme variables. [#21106](https://github.com/ant-design/ant-design/pull/21106)
- 🐞 Fix Layout components `displayName`. [#21124](https://github.com/ant-design/ant-design/pull/21124)
- 🐞 Fix Modal.confirm `okButtonProps` and `cancelButtonProps` interface. [#21165](https://github.com/ant-design/ant-design/pull/21165)
## 3.26.7
`2020-01-13`
- 💄 Optimize Table fixed columns blank problem in some case. [#20821](https://github.com/ant-design/ant-design/pull/20821) [@AshoneA](https://github.com/AshoneA)
- 🐞 Fix Tree `switcherIcon` shown in leaf node problem. [#20753](https://github.com/ant-design/ant-design/pull/20753)
- 🐞 Fix Badge `z-index` higher than Table fixed columns. [#20751](https://github.com/ant-design/ant-design/pull/20751)
- 🐞 Fix Cascader search bug when `fieldNames` is existed and label/value share same name. [#20720](https://github.com/ant-design/ant-design/pull/20720)
- 🐞 Fix Collapse background color with wrong less variable. [#20718](https://github.com/ant-design/ant-design/pull/20718) [@kuitos](https://github.com/kuitos)
- 🐞 Fix Input.Group inside `<Form layout="vertical" >` 1px bug. [#20685](https://github.com/ant-design/ant-design/pull/20685)
## 3.26.6
`2020-01-03`

View File

@@ -15,6 +15,36 @@ timeline: true
---
`2020-02-08`
- 🐞 修复 Badge 在 Typography 下数字错位的问题。[#21237](https://github.com/ant-design/ant-design/pull/21237)
- 🐞 修复 Steps 在 `size="small"``labelPlacement="vertical"` 时图标没有对齐的问题。[#21258](https://github.com/ant-design/ant-design/pull/21258)
- 🐞 修复 Typography 在可编辑状态时光标没有在输入框末位的问题。[#21268](https://github.com/ant-design/ant-design/pull/21268)
- TypeScript
- 💄 完善 Form 中校验规则类型的类型定义。[#21250](https://github.com/ant-design/ant-design/pull/21250) [@hansololai](https://github.com/hansololai)
- 🐞 修复 Tree 中事件类型定义不正确的问题。[#21200](https://github.com/ant-design/ant-design/pull/21200) [@Jirka-Lhotka](https://github.com/Jirka-Lhotka)
## 3.26.8
`2020-02-03`
- 🐞 修复 Tooltip `title``0` 时没有显示的问题。[#20894](https://github.com/ant-design/ant-design/pull/20894)
- 🐞 修复 List `actions` 位置不在右边的问题。[#20897](https://github.com/ant-design/ant-design/pull/20897)
- 🐞 修复 Card `actions` 字体大小不受 less 变量影响的问题。[#21106](https://github.com/ant-design/ant-design/pull/21106)
- 🐞 修正 Layout 各组件的 `displayName`。[#21124](https://github.com/ant-design/ant-design/pull/21124)
- 🐞 优化 Modal.confirm 的 `okButtonProps``cancelButtonProps` 的 TypeScript 类型。[#21165](https://github.com/ant-design/ant-design/pull/21165)
## 3.26.7
`2020-01-13`
- 💄 优化 Table 固定列在某些情况下出现空白间隔的问题。[#20821](https://github.com/ant-design/ant-design/pull/20821) [@AshoneA](https://github.com/AshoneA)
- 🐞 修复 Tree `switcherIcon` 在叶子节点上展示的问题。[#20753](https://github.com/ant-design/ant-design/pull/20753)
- 🐞 修复 Badge 在 Table 固定列中穿透的问题。[#20751](https://github.com/ant-design/ant-design/pull/20751)
- 🐞 修复 Cascader `fieldNames` 中 label 和 value 共用一个值时搜索功能失效的问题。[#20720](https://github.com/ant-design/ant-design/pull/20720)
- 🐞 修复 Collapse 背景使用错误的 less 变量。[#20718](https://github.com/ant-design/ant-design/pull/20718) [@kuitos](https://github.com/kuitos)
- 🐞 修复 `<Form layout="vertical" >` 内 Input.Group 偏上一像素的问题。[#20685](https://github.com/ant-design/ant-design/pull/20685)
## 3.26.6
`2020-01-03`

View File

@@ -41,152 +41,152 @@ exports[`renders ./components/avatar/demo/badge.md correctly 1`] = `
style="transition:none;-ms-transform:translateY(-1100%);-webkit-transform:translateY(-1100%);transform:translateY(-1100%)"
>
<p
class=""
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
5
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
9
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class="current"
class="ant-scroll-number-only-unit current"
>
1
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
5
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
9
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
5
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
9
</p>

View File

@@ -17,12 +17,16 @@ function getNumberArray(num: string | number | undefined | null) {
: [];
}
function renderNumberList(position: number) {
function renderNumberList(position: number, className: string) {
const childrenToReturn: React.ReactElement<any>[] = [];
for (let i = 0; i < 30; i++) {
const currentClassName = position === i ? 'current' : '';
childrenToReturn.push(
<p key={i.toString()} className={currentClassName}>
<p
key={i.toString()}
className={classNames(className, {
current: position === i,
})}
>
{i % 10}
</p>,
);
@@ -138,7 +142,7 @@ class ScrollNumber extends React.Component<ScrollNumberProps, ScrollNumberState>
},
key: i,
},
renderNumberList(position),
renderNumberList(position, `${prefixCls}-only-unit`),
);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -159,7 +159,7 @@
display: inline-block;
height: @badge-height;
transition: all 0.3s @ease-in-out;
> p {
> p.@{number-prefix-cls}-only-unit {
height: @badge-height;
margin: 0;
}

View File

@@ -32,7 +32,7 @@ A card can be used to display content related to a single subject. The content c
| hoverable | Lift up when hovering card | boolean | false | |
| loading | Shows a loading indicator while the contents of the card are being fetched | boolean | false | |
| tabList | List of TabPane's head. | Array&lt;{key: string, tab: ReactNode}> | - | |
| tabBarExtraContent | Extra content in tab bar | React.ReactNode | - | |
| tabBarExtraContent | Extra content in tab bar | React.ReactNode | - | 3.23.0 |
| size | Size of card | `default` \| `small` | `default` | 3.12.0 |
| title | Card title | string\|ReactNode | - | |
| type | Card style type, can be set to `inner` or not set | string | - | |

View File

@@ -33,7 +33,7 @@ cols: 1
| hoverable | 鼠标移过时可浮起 | boolean | false | |
| loading | 当卡片内容还在加载中时,可以用 loading 展示一个占位 | boolean | false | |
| tabList | 页签标题列表 | Array&lt;{key: string, tab: ReactNode}> | - | |
| tabBarExtraContent | tab bar 上额外的元素 | React.ReactNode | 无 | |
| tabBarExtraContent | tab bar 上额外的元素 | React.ReactNode | 无 | 3.23.0 |
| size | card 的尺寸 | `default` \| `small` | `default` | 3.12.0 |
| title | 卡片标题 | string\|ReactNode | - | |
| type | 卡片类型,可设置为 `inner` 或 不设置 | string | - | |

View File

@@ -144,7 +144,7 @@
position: relative;
display: block;
min-width: 32px;
font-size: 14px;
font-size: @font-size-base;
line-height: 22px;
cursor: pointer;

View File

@@ -839,6 +839,7 @@ exports[`Cascader should highlight keyword and filter when search in Cascader 1`
Object {
"__IS_FILTERED_OPTION": true,
"disabled": false,
"isEmptyNode": true,
"label": Array [
"Jiangsu",
Array [
@@ -891,6 +892,7 @@ exports[`Cascader should highlight keyword and filter when search in Cascader 1`
Object {
"__IS_FILTERED_OPTION": true,
"disabled": false,
"isEmptyNode": true,
"label": Array [
"Zhejiang",
Array [
@@ -1025,6 +1027,49 @@ exports[`Cascader should highlight keyword and filter when search in Cascader 1`
</Popup>
`;
exports[`Cascader should highlight keyword and filter when search in Cascader with same field name of label and value 1`] = `
<div>
<div
class="ant-cascader-menus ant-cascader-menus-placement-bottomLeft slide-up-appear"
style="left: -999px; top: -995px;"
>
<div>
<ul
class="ant-cascader-menu"
style="width: 0px;"
>
<li
class="ant-cascader-menu-item"
role="menuitem"
title=""
>
Zhejiang / Hang
<span
class="ant-cascader-menu-item-keyword"
>
z
</span>
hou / West Lake
</li>
<li
class="ant-cascader-menu-item ant-cascader-menu-item-disabled"
role="menuitem"
title=""
>
Zhejiang / Hang
<span
class="ant-cascader-menu-item-keyword"
>
z
</span>
hou / Xia Sha
</li>
</ul>
</div>
</div>
</div>
`;
exports[`Cascader should render not found content 1`] = `
<Popup
action={
@@ -1242,6 +1287,7 @@ exports[`Cascader should render not found content 1`] = `
Array [
Object {
"disabled": true,
"isEmptyNode": true,
"label": <Context.Consumer>
[Function]
</Context.Consumer>,
@@ -1569,6 +1615,7 @@ exports[`Cascader should show not found content when options.length is 0 1`] = `
Array [
Object {
"disabled": true,
"isEmptyNode": true,
"label": <Context.Consumer>
[Function]
</Context.Consumer>,

View File

@@ -205,6 +205,52 @@ describe('Cascader', () => {
expect(popupWrapper).toMatchSnapshot();
});
it('should highlight keyword and filter when search in Cascader with same field name of label and value', () => {
const customOptions = [
{
name: 'Zhejiang',
value: 'Zhejiang',
children: [
{
name: 'Hangzhou',
value: 'Hangzhou',
children: [
{
name: 'West Lake',
value: 'West Lake',
},
{
name: 'Xia Sha',
value: 'Xia Sha',
disabled: true,
},
],
},
],
},
];
function customFilter(inputValue, path) {
return path.some(option => option.name.toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
}
const wrapper = mount(
<Cascader
options={customOptions}
fieldNames={{ label: 'name', value: 'name' }}
showSearch={{ filter: customFilter }}
/>,
);
wrapper.find('input').simulate('click');
wrapper.find('input').simulate('change', { target: { value: 'z' } });
expect(wrapper.state('inputValue')).toBe('z');
const popupWrapper = mount(
wrapper
.find('Trigger')
.instance()
.getComponent(),
);
expect(popupWrapper.render()).toMatchSnapshot();
});
it('should render not found content', () => {
const wrapper = mount(<Cascader options={options} showSearch={{ filter }} />);
wrapper.find('input').simulate('click');

View File

@@ -397,17 +397,19 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
return {
__IS_FILTERED_OPTION: true,
path,
[names.label]: render(inputValue, path, prefixCls, names),
[names.value]: path.map((o: CascaderOptionType) => o[names.value]),
[names.label]: render(inputValue, path, prefixCls, names),
disabled: path.some((o: CascaderOptionType) => !!o.disabled),
isEmptyNode: true,
} as CascaderOptionType;
});
}
return [
{
[names.label]: notFoundContent || renderEmpty('Cascader'),
[names.value]: 'ANT_CASCADER_NOT_FOUND',
[names.label]: notFoundContent || renderEmpty('Cascader'),
disabled: true,
isEmptyNode: true,
},
];
}
@@ -503,9 +505,10 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
} else {
options = [
{
[names.label]: notFoundContent || renderEmpty('Cascader'),
[names.value]: 'ANT_CASCADER_NOT_FOUND',
[names.label]: notFoundContent || renderEmpty('Cascader'),
disabled: true,
isEmptyNode: true,
},
];
}
@@ -517,8 +520,7 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
}
const dropdownMenuColumnStyle: { width?: number; height?: string } = {};
const isNotFound =
(options || []).length === 1 && options[0][names.value] === 'ANT_CASCADER_NOT_FOUND';
const isNotFound = (options || []).length === 1 && options[0].isEmptyNode;
if (isNotFound) {
dropdownMenuColumnStyle.height = 'auto'; // Height of one row.
}

View File

@@ -102,7 +102,7 @@
}
&-borderless {
background-color: @component-background;
background-color: @collapse-header-bg;
border: 0;
}

View File

@@ -445,152 +445,152 @@ exports[`ConfigProvider components Badge configProvider 1`] = `
style="transition:none;-ms-transform:translateY(-1500%);-webkit-transform:translateY(-1500%);transform:translateY(-1500%)"
>
<p
class=""
class="config-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
4
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
5
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
9
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
4
</p>
<p
class="current"
class="config-scroll-number-only-unit current"
>
5
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
9
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
4
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
5
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
9
</p>
@@ -625,152 +625,152 @@ exports[`ConfigProvider components Badge normal 1`] = `
style="transition:none;-ms-transform:translateY(-1500%);-webkit-transform:translateY(-1500%);transform:translateY(-1500%)"
>
<p
class=""
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
5
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
9
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class="current"
class="ant-scroll-number-only-unit current"
>
5
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
9
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
5
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
9
</p>
@@ -805,152 +805,152 @@ exports[`ConfigProvider components Badge prefixCls 1`] = `
style="transition:none;-ms-transform:translateY(-1500%);-webkit-transform:translateY(-1500%);transform:translateY(-1500%)"
>
<p
class=""
class="prefix-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
4
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
5
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
9
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
4
</p>
<p
class="current"
class="prefix-scroll-number-only-unit current"
>
5
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
9
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
4
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
5
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
9
</p>

View File

@@ -127,7 +127,7 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker, WeekPicke
| showTime | to provide an additional time selection | object\|boolean | [TimePicker Options](/components/time-picker/#API) | |
| showTime.defaultValue | to set default time of selected date, [demo](#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/)\[] | \[moment(), moment()] | |
| value | to set date | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - | |
| onCalendarChange | a callback function, can be executed when the start time or the end time of the range is changing | function(dates: \[moment, moment], dateStrings: \[string, string]) | - | 3.10.9 |
| onCalendarChange | a callback function, can be executed when the start time or the end time of the range is changing | function(dates: \[moment, moment]) | - | 3.0.0 |
| onChange | a callback function, can be executed when the selected time is changing | function(dates: \[moment, moment], dateStrings: \[string, string]) | - | |
| onOk | callback when click ok button | function(dates: [moment](http://momentjs.com/)\[]) | - | |

View File

@@ -129,7 +129,7 @@ moment.locale('zh-cn');
| showTime | 增加时间选择功能 | Object\|boolean | [TimePicker Options](/components/time-picker/#API) | |
| showTime.defaultValue | 设置用户选择日期时默认的时分秒,[例子](#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/)\[] | \[moment(), moment()] | |
| value | 日期 | [moment](http://momentjs.com/)\[] | 无 | |
| onCalendarChange | 待选日期发生变化的回调 | function(dates: \[moment, moment\], dateStrings: \[string, string\]) | 无 | |
| onCalendarChange | 待选日期发生变化的回调 | function(dates: \[moment, moment\]) | 无 | 3.0.0 |
| onChange | 日期范围发生变化的回调 | function(dates: \[moment, moment\], dateStrings: \[string, string\]) | 无 | |
| onOk | 点击确定按钮的回调 | function(dates: [moment](http://momentjs.com/)\[]) | - | |

View File

@@ -29,7 +29,7 @@ export interface FormCreateOption<T> {
}
const FormLayouts = tuple('horizontal', 'inline', 'vertical');
export type FormLayout = (typeof FormLayouts)[number];
export type FormLayout = typeof FormLayouts[number];
export interface FormProps extends React.FormHTMLAttributes<HTMLFormElement> {
layout?: FormLayout;
@@ -51,11 +51,28 @@ export interface FormProps extends React.FormHTMLAttributes<HTMLFormElement> {
labelAlign?: FormLabelAlign;
}
export type ValidationRuleType =
| 'string'
| 'number'
| 'boolean'
| 'method'
| 'regexp'
| 'integer'
| 'float'
| 'array'
| 'object'
| 'enum'
| 'date'
| 'url'
| 'hex'
| 'email'
| 'any';
export type ValidationRule = {
/** validation error message */
message?: React.ReactNode;
/** built-in validation type, available options: https://github.com/yiminghe/async-validator#type */
type?: string;
type?: ValidationRuleType;
/** indicates whether field is required */
required?: boolean;
/** treat required fields that only contain whitespace as errors */
@@ -67,7 +84,7 @@ export type ValidationRule = {
/** validate the max length of a field */
max?: number;
/** validate the value from a list of possible values */
enum?: string | string[];
enum?: (string | number | boolean)[];
/** validate from a regular expression */
pattern?: RegExp;
/** transform a value before validation */

View File

@@ -210,7 +210,7 @@ Note: if Form.Item has multiple children that had been decorated by `getFieldDec
| Property | Description | Type | Default Value | Version |
| --- | --- | --- | --- | --- |
| enum | validate a value from a list of possible values | string | - | |
| enum | validate a value from a list of possible values | string[] | - | |
| len | validate an exact length of a field | number | - | |
| max | validate a max length of a field | number | - | |
| message | validation error message | string\|ReactNode | - | |

View File

@@ -212,7 +212,7 @@ validateFields(['field1', 'field2'], options, (errors, values) => {
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- |
| enum | 枚举类型 | string | - | |
| enum | 枚举类型 | string[] | - | |
| len | 字段长度 | number | - | |
| max | 最大长度 | number | - | |
| message | 校验文案 | string\|ReactNode | - | |

View File

@@ -262,11 +262,18 @@ form {
// fix input with addon position. https://github.com/ant-design/ant-design/issues/8243
:not(.@{ant-prefix}-input-group-wrapper) > .@{ant-prefix}-input-group,
.@{ant-prefix}-input-group-wrapper {
position: relative;
top: -1px;
display: inline-block;
vertical-align: middle;
}
// https://github.com/ant-design/ant-design/issues/20616
&:not(.@{form-prefix-cls}-vertical) {
:not(.@{ant-prefix}-input-group-wrapper) > .@{ant-prefix}-input-group,
.@{ant-prefix}-input-group-wrapper {
position: relative;
top: -1px;
}
}
}
// Form layout

View File

@@ -35,7 +35,7 @@ function formatNumber(value) {
class NumericInput extends React.Component {
onChange = e => {
const { value } = e.target;
const reg = /^-?(0|[1-9][0-9]*)(\.[0-9]*)?$/;
const reg = /^-?[0-9]*(\.[0-9]*)?$/;
if ((!isNaN(value) && reg.test(value)) || value === '' || value === '-') {
this.props.onChange(value);
}
@@ -44,9 +44,11 @@ class NumericInput extends React.Component {
// '.' at the end or only '-' in the input box.
onBlur = () => {
const { value, onBlur, onChange } = this.props;
let valueTemp = value;
if (value.charAt(value.length - 1) === '.' || value === '-') {
onChange(value.slice(0, -1));
valueTemp = value.slice(0, -1);
}
onChange(valueTemp.replace(/0*(\d+)/, '$1'));
if (onBlur) {
onBlur();
}

View File

@@ -7,6 +7,7 @@ import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
export interface GeneratorProps {
suffixCls: string;
tagName: 'header' | 'footer' | 'main' | 'section';
displayName: string;
}
export interface BasicProps extends React.HTMLAttributes<HTMLDivElement> {
prefixCls?: string;
@@ -30,9 +31,11 @@ interface BasicPropsWithTagName extends BasicProps {
tagName: 'header' | 'footer' | 'main' | 'section';
}
function generator({ suffixCls, tagName }: GeneratorProps) {
function generator({ suffixCls, tagName, displayName }: GeneratorProps) {
return (BasicComponent: any) => {
return class Adapter extends React.Component<BasicProps, any> {
static displayName: string = displayName;
static Header: any;
static Footer: any;
@@ -108,21 +111,25 @@ const Layout: React.ComponentClass<BasicProps> & {
} = generator({
suffixCls: 'layout',
tagName: 'section',
displayName: 'Layout',
})(BasicLayout);
const Header = generator({
suffixCls: 'layout-header',
tagName: 'header',
displayName: 'Header',
})(Basic);
const Footer = generator({
suffixCls: 'layout-footer',
tagName: 'footer',
displayName: 'Footer',
})(Basic);
const Content = generator({
suffixCls: 'layout-content',
tagName: 'main',
displayName: 'Content',
})(Basic);
Layout.Header = Header;

View File

@@ -72,7 +72,7 @@ export default class Item extends React.Component<ListItemProps, any> {
context: any;
isItemContainsTextNode() {
isItemContainsTextNodeAndNotSingular() {
const { children } = this.props;
let result;
React.Children.forEach(children, (element: React.ReactElement<any>) => {
@@ -80,7 +80,7 @@ export default class Item extends React.Component<ListItemProps, any> {
result = true;
}
});
return result;
return result && React.Children.count(children) > 1;
}
isFlexMode() {
@@ -89,7 +89,7 @@ export default class Item extends React.Component<ListItemProps, any> {
if (itemLayout === 'vertical') {
return !!extra;
}
return !this.isItemContainsTextNode();
return !this.isItemContainsTextNodeAndNotSingular();
}
renderItem = ({ getPrefixCls }: ConfigConsumerProps) => {

View File

@@ -763,27 +763,27 @@ exports[`renders ./components/list/demo/simple.md correctly 1`] = `
class="ant-list-items"
>
<li
class="ant-list-item ant-list-item-no-flex"
class="ant-list-item"
>
Racing car sprays burning fuel into crowd.
</li>
<li
class="ant-list-item ant-list-item-no-flex"
class="ant-list-item"
>
Japanese princess to wed commoner.
</li>
<li
class="ant-list-item ant-list-item-no-flex"
class="ant-list-item"
>
Australian walks 100km after outback crash.
</li>
<li
class="ant-list-item ant-list-item-no-flex"
class="ant-list-item"
>
Man charged over missing wedding girl.
</li>
<li
class="ant-list-item ant-list-item-no-flex"
class="ant-list-item"
>
Los Angeles battles huge wildfires.
</li>
@@ -823,27 +823,27 @@ exports[`renders ./components/list/demo/simple.md correctly 1`] = `
class="ant-list-items"
>
<li
class="ant-list-item ant-list-item-no-flex"
class="ant-list-item"
>
Racing car sprays burning fuel into crowd.
</li>
<li
class="ant-list-item ant-list-item-no-flex"
class="ant-list-item"
>
Japanese princess to wed commoner.
</li>
<li
class="ant-list-item ant-list-item-no-flex"
class="ant-list-item"
>
Australian walks 100km after outback crash.
</li>
<li
class="ant-list-item ant-list-item-no-flex"
class="ant-list-item"
>
Man charged over missing wedding girl.
</li>
<li
class="ant-list-item ant-list-item-no-flex"
class="ant-list-item"
>
Los Angeles battles huge wildfires.
</li>

View File

@@ -52,6 +52,7 @@
&-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: @list-item-padding;
&-content {

View File

@@ -1,14 +1,14 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import Button from '../button';
import { ButtonType, NativeButtonProps } from '../button/button';
import { ButtonType, ButtonProps } from '../button/button';
export interface ActionButtonProps {
type?: ButtonType;
actionFn?: (...args: any[]) => any | PromiseLike<any>;
closeModal: Function;
autoFocus?: boolean;
buttonProps?: NativeButtonProps;
buttonProps?: ButtonProps;
}
export interface ActionButtonState {

View File

@@ -6,7 +6,7 @@ import addEventListener from 'rc-util/lib/Dom/addEventListener';
import { getConfirmLocale } from './locale';
import Icon from '../icon';
import Button from '../button';
import { ButtonType, NativeButtonProps } from '../button/button';
import { ButtonType, ButtonProps } from '../button/button';
import LocaleReceiver from '../locale-provider/LocaleReceiver';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
@@ -60,8 +60,8 @@ export interface ModalProps {
maskClosable?: boolean;
/** 强制渲染 Modal */
forceRender?: boolean;
okButtonProps?: NativeButtonProps;
cancelButtonProps?: NativeButtonProps;
okButtonProps?: ButtonProps;
cancelButtonProps?: ButtonProps;
destroyOnClose?: boolean;
style?: React.CSSProperties;
wrapClassName?: string;
@@ -90,8 +90,8 @@ export interface ModalFuncProps {
// TODO: find out exact types
onOk?: (...args: any[]) => any;
onCancel?: (...args: any[]) => any;
okButtonProps?: NativeButtonProps;
cancelButtonProps?: NativeButtonProps;
okButtonProps?: ButtonProps;
cancelButtonProps?: ButtonProps;
centered?: boolean;
width?: string | number;
iconClassName?: string;

View File

@@ -31,7 +31,7 @@
&.@{steps-prefix-cls}-small:not(.@{steps-prefix-cls}-dot) {
.@{steps-prefix-cls}-item {
&-icon {
margin-left: 40px;
margin-left: 47px;
}
}
}

View File

@@ -265,10 +265,10 @@
@layout-trigger-color-light: @text-color;
// z-index list, order by `z-index`
@zindex-badge: auto;
@zindex-table-fixed: auto;
@zindex-affix: 10;
@zindex-back-top: 10;
@zindex-badge: 10;
@zindex-picker-panel: 10;
@zindex-popup-close: 10;
@zindex-modal: 1000;

View File

@@ -623,7 +623,10 @@
// https://github.com/ant-design/ant-design/issues/14545
// https://github.com/ant-design/ant-design/issues/19491
.@{table-prefix-cls}-fixed-columns-in-body:not([colspan]) {
visibility: hidden;
color: transparent;
& > * {
visibility: hidden;
}
}
}
}

View File

@@ -442,11 +442,11 @@ exports[`renders ./components/tag/demo/controlled.md correctly 1`] = `
exports[`renders ./components/tag/demo/hot-tags.md correctly 1`] = `
<div>
<h6
style="margin-right:8px;display:inline"
<span
style="margin-right:8px"
>
Categories:
</h6>
</span>
<span
class="ant-tag ant-tag-checkable"
>

View File

@@ -36,7 +36,7 @@ class HotTags extends React.Component {
const { selectedTags } = this.state;
return (
<div>
<h6 style={{ marginRight: 8, display: 'inline' }}>Categories:</h6>
<span style={{ marginRight: 8 }}>Categories:</span>
{tagsFromServer.map(tag => (
<CheckableTag
key={tag}

View File

@@ -13,6 +13,7 @@ export interface TimelineProps {
style?: React.CSSProperties;
reverse?: boolean;
mode?: 'left' | 'alternate' | 'right';
children?: React.ReactNode;
}
export default class Timeline extends React.Component<TimelineProps, any> {

View File

@@ -11,6 +11,7 @@ export interface TimeLineItemProps {
pending?: boolean;
position?: string;
style?: React.CSSProperties;
children?: React.ReactNode;
}
const TimelineItem: React.SFC<TimeLineItemProps> = props => (

View File

@@ -241,4 +241,14 @@ describe('Tooltip', () => {
expect(onVisibleChange).toHaveBeenCalledWith(false);
expect(wrapper.instance().tooltip.props.visible).toBe(false);
});
// https://github.com/ant-design/ant-design/issues/20891
it('should display zero', async () => {
const wrapper = mount(
<Tooltip title={0} visible>
<div />
</Tooltip>,
);
expect(wrapper.find('.ant-tooltip-inner').getDOMNode().innerHTML).toBe('0');
});
});

View File

@@ -226,7 +226,15 @@ class Tooltip extends React.Component<TooltipProps, any> {
isNoTitle() {
const { title, overlay } = this.props;
return !title && !overlay; // overlay for old version compatibility
return !title && !overlay && title !== 0; // overlay for old version compatibility
}
getOverlay() {
const { title, overlay } = this.props;
if (title === 0) {
return title;
}
return overlay || title || '';
}
renderTooltip = ({
@@ -236,8 +244,6 @@ class Tooltip extends React.Component<TooltipProps, any> {
const { props, state } = this;
const {
prefixCls: customizePrefixCls,
title,
overlay,
openClassName,
getPopupContainer,
getTooltipContainer,
@@ -266,7 +272,7 @@ class Tooltip extends React.Component<TooltipProps, any> {
getTooltipContainer={getPopupContainer || getTooltipContainer || getContextPopupContainer}
ref={this.saveTooltip}
builtinPlacements={this.getPlacements()}
overlay={overlay || title || ''}
overlay={this.getOverlay()}
visible={visible}
onVisibleChange={this.onVisibleChange}
onPopupAlign={this.onPopupAlign}

View File

@@ -70,7 +70,7 @@ export interface AntTreeNodeExpandedEvent extends AntTreeNodeBaseEvent {
export interface AntTreeNodeMouseEvent {
node: AntTreeNode;
event: React.MouseEvent<HTMLElement>;
event: React.DragEvent<HTMLElement>;
}
export interface AntTreeNodeDragEnterEvent extends AntTreeNodeMouseEvent {
@@ -194,15 +194,15 @@ export default class Tree extends React.Component<TreeProps, any> {
if (loading) {
return <Icon type="loading" className={`${prefixCls}-switcher-loading-icon`} />;
}
if (isLeaf) {
return showLine ? <Icon type="file" className={`${prefixCls}-switcher-line-icon`} /> : null;
}
const switcherCls = `${prefixCls}-switcher-icon`;
if (switcherIcon) {
return React.cloneElement(switcherIcon, {
className: classNames(switcherIcon.props.className || '', switcherCls),
});
}
if (isLeaf) {
return showLine ? <Icon type="file" className={`${prefixCls}-switcher-line-icon`} /> : null;
}
return showLine ? (
<Icon
type={expanded ? 'minus-square' : 'plus-square'}

View File

@@ -725,27 +725,7 @@ exports[`renders ./components/tree/demo/customized-icon.md correctly 1`] = `
>
<span
class="ant-tree-switcher ant-tree-switcher-noop"
>
<i
aria-label="icon: down"
class="anticon anticon-down ant-tree-switcher-icon"
>
<svg
aria-hidden="true"
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
/>
</svg>
</i>
</span>
/>
<span
class="ant-tree-node-content-wrapper ant-tree-node-content-wrapper-normal ant-tree-node-selected"
title="leaf"
@@ -786,27 +766,7 @@ exports[`renders ./components/tree/demo/customized-icon.md correctly 1`] = `
>
<span
class="ant-tree-switcher ant-tree-switcher-noop"
>
<i
aria-label="icon: down"
class="anticon anticon-down ant-tree-switcher-icon"
>
<svg
aria-hidden="true"
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
/>
</svg>
</i>
</span>
/>
<span
class="ant-tree-node-content-wrapper ant-tree-node-content-wrapper-normal"
title="leaf"
@@ -2249,13 +2209,13 @@ exports[`renders ./components/tree/demo/switcher-icon.md correctly 1`] = `
class="ant-tree-switcher ant-tree-switcher-noop"
>
<i
aria-label="icon: down"
class="anticon anticon-down ant-tree-switcher-icon"
aria-label="icon: file"
class="anticon anticon-file ant-tree-switcher-line-icon"
>
<svg
aria-hidden="true"
class=""
data-icon="down"
data-icon="file"
fill="currentColor"
focusable="false"
height="1em"
@@ -2263,7 +2223,7 @@ exports[`renders ./components/tree/demo/switcher-icon.md correctly 1`] = `
width="1em"
>
<path
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
d="M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z"
/>
</svg>
</i>
@@ -2287,13 +2247,13 @@ exports[`renders ./components/tree/demo/switcher-icon.md correctly 1`] = `
class="ant-tree-switcher ant-tree-switcher-noop"
>
<i
aria-label="icon: down"
class="anticon anticon-down ant-tree-switcher-icon"
aria-label="icon: file"
class="anticon anticon-file ant-tree-switcher-line-icon"
>
<svg
aria-hidden="true"
class=""
data-icon="down"
data-icon="file"
fill="currentColor"
focusable="false"
height="1em"
@@ -2301,7 +2261,7 @@ exports[`renders ./components/tree/demo/switcher-icon.md correctly 1`] = `
width="1em"
>
<path
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
d="M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z"
/>
</svg>
</i>
@@ -2325,13 +2285,13 @@ exports[`renders ./components/tree/demo/switcher-icon.md correctly 1`] = `
class="ant-tree-switcher ant-tree-switcher-noop"
>
<i
aria-label="icon: down"
class="anticon anticon-down ant-tree-switcher-icon"
aria-label="icon: file"
class="anticon anticon-file ant-tree-switcher-line-icon"
>
<svg
aria-hidden="true"
class=""
data-icon="down"
data-icon="file"
fill="currentColor"
focusable="false"
height="1em"
@@ -2339,7 +2299,7 @@ exports[`renders ./components/tree/demo/switcher-icon.md correctly 1`] = `
width="1em"
>
<path
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
d="M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z"
/>
</svg>
</i>

View File

@@ -30,4 +30,16 @@ describe('Tree', () => {
);
expect(wrapper.render()).toMatchSnapshot();
});
it('switcherIcon in Tree should not render at leaf nodes', () => {
const wrapper = mount(
<Tree switcherIcon={<i className="switcherIcon" />} defaultExpandAll>
<TreeNode icon="icon">
<TreeNode id="node1" title="node1" icon="icon" key="0-0-2" />
<TreeNode id="node2" title="node2" key="0-0-3" />
</TreeNode>
</Tree>,
);
expect(wrapper.find('.switcherIcon').length).toBe(1);
});
});

View File

@@ -46,8 +46,11 @@ class Editable extends React.Component<EditableProps, EditableState> {
};
componentDidMount() {
if (this.textarea) {
this.textarea.focus();
if (this.textarea && this.textarea.resizableTextArea) {
const { textArea } = this.textarea.resizableTextArea;
textArea.focus();
const { length } = textArea.value;
textArea.setSelectionRange(length, length);
}
}

View File

@@ -241,6 +241,17 @@ describe('Typography', () => {
wrapper.find('TextArea').simulate('blur');
});
});
it('should focus at the end of textarea', () => {
const wrapper = mount(<Paragraph editable>content</Paragraph>);
wrapper
.find('.ant-typography-edit')
.first()
.simulate('click');
const textareaNode = wrapper.find('textarea').getDOMNode();
expect(textareaNode.selectionStart).toBe(7);
expect(textareaNode.selectionEnd).toBe(7);
});
});
it('warning if use setContentRef', () => {

View File

@@ -1,6 +1,6 @@
{
"name": "antd",
"version": "3.26.6",
"version": "3.26.9",
"description": "An enterprise-class UI design language and React components implementation",
"keywords": [
"ant",

View File

@@ -24,7 +24,7 @@ async function checkVersion() {
}
async function checkBranch({ current }) {
if (current !== 'master') {
if (current !== '3.x-stable') {
console.log(chalk.yellow('🤔 You are not in the master branch!'));
exitProcess();
}

View File

@@ -28,14 +28,13 @@
}
}
@media only screen and (max-width: 991.99px) {
.main-menu {
> div > .ant-affix {
position: static !important;
}
.main-menu-inner {
max-height: none;
overflow: hidden;
@media only screen and (max-width: @screen-lg) {
.main-container {
padding-right: 48px;
padding-left: 48px;
.toc-affix {
display: none;
}
}
.code-boxes-col-2-1,

View File

@@ -320,13 +320,13 @@ class MainContent extends Component {
{menuChild}
</MobileMenu>
) : (
<Col xxl={4} xl={5} lg={6} md={24} sm={24} xs={24} className="main-menu">
<Col xxl={4} xl={5} lg={6} md={6} sm={24} xs={24} className="main-menu">
<Affix>
<section className="main-menu-inner">{menuChild}</section>
</Affix>
</Col>
)}
<Col xxl={20} xl={19} lg={18} md={24} sm={24} xs={24}>
<Col xxl={20} xl={19} lg={18} md={18} sm={24} xs={24}>
<section className={mainContainerClass}>
{demos ? (
<ComponentDoc {...this.props} doc={localizedPageData} demos={demos} />

View File

@@ -97,23 +97,20 @@ const Banner = ({ isMobile }) => {
<FormattedMessage id="app.home.recommend" />
</Divider>
<a
href="https://next.ant.design/"
href="https://github.com/antvis/g2plot?from=antd"
target="_blank"
rel="noopener noreferrer"
onClick={() => {
if (window.gtag) {
window.gtag('event', '点击', {
event_category: '首页推广',
event_label: `https://next.ant.design/?from=antd`,
event_label: `https://github.com/antvis/g2plot?from=antd`,
});
}
}}
>
<img
src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg"
alt="antd logo"
/>
<FormattedMessage id="app.home.recommend.antd.next" />
<img src="https://antv.vision/icons/icon-512x512.png" alt="antv logo" />
<FormattedMessage id="app.home.recommend.antv.g2plot" />
<Icon type="right" style={{ marginLeft: 6, fontSize: 12, opacity: 0.6 }} />
</a>
</div>

View File

@@ -49,7 +49,7 @@ module.exports = {
'app.home.tool-kitchen-content': '一个为设计师提效的 Sketch 工具集',
'app.home.getting-started': '开始使用',
'app.home.recommend': '推荐',
'app.home.recommend.yuque': '语雀,我们都喜欢的文档工具',
'app.home.recommend.yuque': '语雀2020 领福蛋有大奖',
'app.home.recommend.antv.g2plot': 'G2Plot全新企业级图表',
'app.home.recommend.antd.next': 'Ant Design 4.0:创造快乐工作',
'app.home.more': '查看更多',