mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c52401fd1 | ||
|
|
7c96796872 | ||
|
|
ac63d26f88 | ||
|
|
b22ef2280c | ||
|
|
831f0fcb5e | ||
|
|
4db7cbcf43 | ||
|
|
dd16a24426 | ||
|
|
f692e7ee34 | ||
|
|
fd553c9ba0 | ||
|
|
1b23971fd6 | ||
|
|
04ef6a8bce | ||
|
|
703a4b1011 | ||
|
|
a1c733ad07 | ||
|
|
9918140695 | ||
|
|
87cbe0168f | ||
|
|
eea0b028c9 | ||
|
|
88bed67368 | ||
|
|
f7e7ce9d4f | ||
|
|
ae7666f8fa | ||
|
|
3fb7325a21 | ||
|
|
59c29a400d | ||
|
|
d3102bb2db | ||
|
|
e036e4c9a3 | ||
|
|
da3540bd59 | ||
|
|
bba87d4125 | ||
|
|
6de8522894 | ||
|
|
674074ce93 | ||
|
|
c68f4463d3 | ||
|
|
a96a95ccb8 | ||
|
|
b112378de3 | ||
|
|
db4bec92be | ||
|
|
b6fc0168db | ||
|
|
92fe411961 | ||
|
|
ab29ecb377 | ||
|
|
23d5a856c0 | ||
|
|
6e4fa95d0f | ||
|
|
2753ce91c9 | ||
|
|
057f5b8526 | ||
|
|
d3eea22097 | ||
|
|
da2f54a18a | ||
|
|
e5dd231aaa | ||
|
|
c6eafe8380 |
2
.github/workflows/deploy-site.yml
vendored
2
.github/workflows/deploy-site.yml
vendored
@@ -3,7 +3,7 @@ on:
|
||||
release:
|
||||
types: [published]
|
||||
branches:
|
||||
- master
|
||||
- 3.x-stable
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
|
||||
@@ -15,6 +15,51 @@ timeline: true
|
||||
|
||||
---
|
||||
|
||||
## 3.26.10
|
||||
|
||||
`2020-02-16`
|
||||
|
||||
- 🐞 Fix Input.Group inside `<Form layout="vertical" >` 1px bug. [#20685](https://github.com/ant-design/ant-design/pull/20685)
|
||||
- 🐞 Fix Badge `color` not working when contains children. [#21333](https://github.com/ant-design/ant-design/pull/21333)
|
||||
- 🐞 Fix Alert close button extra `padding`. [#21325](https://github.com/ant-design/ant-design/pull/21325)
|
||||
- 🐞 Fix Affix throws `Cannot read property getBoundingClientRect in mobile device`. [#21350](https://github.com/ant-design/ant-design/pull/21350)
|
||||
- 💄 Tweak Steps 1px align issue. [#21306](https://github.com/ant-design/ant-design/pull/21306)
|
||||
- 💄 Fix Row component affect next element style issue. [#21310](https://github.com/ant-design/ant-design/pull/21310)
|
||||
- Typescript
|
||||
- 🔷 Revert [#21250](https://github.com/ant-design/ant-design/pull/21250) Type Definition Update.[#21356](https://github.com/ant-design/ant-design/pull/21356)
|
||||
|
||||
## 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`
|
||||
|
||||
@@ -15,6 +15,51 @@ timeline: true
|
||||
|
||||
---
|
||||
|
||||
## 3.26.10
|
||||
|
||||
`2020-02-16`
|
||||
|
||||
- 🐞 修复 `<Form layout="vertical" >` 内 Input.Group 偏上一像素的问题。[#20685](https://github.com/ant-design/ant-design/pull/20685)
|
||||
- 🐞 修复 Badge 包裹模式下 `color` 属性失效的问题。[#21333](https://github.com/ant-design/ant-design/pull/21333)
|
||||
- 🐞 修复 Alert 关闭按钮额外的 `padding`。[#21325](https://github.com/ant-design/ant-design/pull/21325)
|
||||
- 🐞 修复 Affix 在移动设备下抛错 `Cannot read property getBoundingClientRect` 的问题。[#21350](https://github.com/ant-design/ant-design/pull/21350)
|
||||
- 💄 微调 Steps 文本 1px 使其居中对齐。[#21306](https://github.com/ant-design/ant-design/pull/21306)
|
||||
- 💄 修复 Row 组件影响下一个元素样式问题。[#21310](https://github.com/ant-design/ant-design/pull/21310)
|
||||
- Typescript
|
||||
- 🔷 回滚 [#21250](https://github.com/ant-design/ant-design/pull/21250) 的类型定义更新。[#21356](https://github.com/ant-design/ant-design/pull/21356)
|
||||
|
||||
## 3.26.9
|
||||
|
||||
`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`
|
||||
|
||||
@@ -239,7 +239,7 @@ class Affix extends React.Component<AffixProps, AffixState> {
|
||||
const offsetBottom = this.getOffsetBottom();
|
||||
|
||||
const targetNode = target();
|
||||
if (targetNode) {
|
||||
if (targetNode && this.placeholderNode) {
|
||||
const targetRect = getTargetRect(targetNode);
|
||||
const placeholderReact = getTargetRect(this.placeholderNode);
|
||||
const fixedTop = getFixedTop(placeholderReact, targetRect, offsetTop);
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 16px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
font-size: @font-size-sm;
|
||||
line-height: 22px;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
@@ -111,4 +111,22 @@ describe('Badge', () => {
|
||||
);
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
// https://github.com/ant-design/ant-design/issues/21331
|
||||
it('render Badge status/color when contains children', () => {
|
||||
const wrapper = render(
|
||||
<div>
|
||||
<Badge count={5} status="success">
|
||||
<a />
|
||||
</Badge>
|
||||
<Badge count={5} color="blue">
|
||||
<a />
|
||||
</Badge>
|
||||
<Badge count={5} color="#08c">
|
||||
<a />
|
||||
</Badge>
|
||||
</div>,
|
||||
);
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
})
|
||||
});
|
||||
|
||||
@@ -136,7 +136,7 @@ export default class Badge extends React.Component<BadgeProps, any> {
|
||||
}
|
||||
|
||||
renderBadgeNumber(prefixCls: string, scrollNumberPrefixCls: string) {
|
||||
const { status, count } = this.props;
|
||||
const { status, count, color } = this.props;
|
||||
|
||||
const displayCount = this.getDispayCount();
|
||||
const isDot = this.isDot();
|
||||
@@ -147,9 +147,16 @@ export default class Badge extends React.Component<BadgeProps, any> {
|
||||
[`${prefixCls}-count`]: !isDot,
|
||||
[`${prefixCls}-multiple-words`]:
|
||||
!isDot && count && count.toString && count.toString().length > 1,
|
||||
[`${prefixCls}-status-${status}`]: this.hasStatus(),
|
||||
[`${prefixCls}-status-${status}`]: !!status,
|
||||
[`${prefixCls}-status-${color}`]: isPresetColor(color),
|
||||
});
|
||||
|
||||
let statusStyle: React.CSSProperties | undefined = this.getStyleWithOffset();
|
||||
if (color && !isPresetColor(color)) {
|
||||
statusStyle = statusStyle || {};
|
||||
statusStyle.background = color;
|
||||
}
|
||||
|
||||
return hidden ? null : (
|
||||
<ScrollNumber
|
||||
prefixCls={scrollNumberPrefixCls}
|
||||
@@ -158,7 +165,7 @@ export default class Badge extends React.Component<BadgeProps, any> {
|
||||
count={displayCount}
|
||||
displayComponent={this.renderDispayComponent()} // <Badge status="success" count={<Icon type="xxx" />}></Badge>
|
||||
title={this.getScrollNumberTitle()}
|
||||
style={this.getStyleWithOffset()}
|
||||
style={statusStyle}
|
||||
key="scrollNumber"
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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<{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 | - | |
|
||||
|
||||
@@ -33,7 +33,7 @@ cols: 1
|
||||
| hoverable | 鼠标移过时可浮起 | boolean | false | |
|
||||
| loading | 当卡片内容还在加载中时,可以用 loading 展示一个占位 | boolean | false | |
|
||||
| tabList | 页签标题列表 | Array<{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 | - | |
|
||||
|
||||
@@ -144,7 +144,7 @@
|
||||
position: relative;
|
||||
display: block;
|
||||
min-width: 32px;
|
||||
font-size: 14px;
|
||||
font-size: @font-size-base;
|
||||
line-height: 22px;
|
||||
cursor: pointer;
|
||||
|
||||
|
||||
@@ -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>,
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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.
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
}
|
||||
|
||||
&-borderless {
|
||||
background-color: @component-background;
|
||||
background-color: @collapse-header-bg;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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/)\[]) | - | |
|
||||
|
||||
|
||||
@@ -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/)\[]) | - | |
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
exports[`renders ./components/dropdown/demo/basic.md correctly 1`] = `
|
||||
<a
|
||||
class="ant-dropdown-link ant-dropdown-trigger"
|
||||
href="#"
|
||||
>
|
||||
Hover me
|
||||
<i
|
||||
@@ -184,7 +183,6 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
|
||||
exports[`renders ./components/dropdown/demo/event.md correctly 1`] = `
|
||||
<a
|
||||
class="ant-dropdown-link ant-dropdown-trigger"
|
||||
href="#"
|
||||
>
|
||||
Hover me, Click menu item
|
||||
<i
|
||||
@@ -212,7 +210,6 @@ exports[`renders ./components/dropdown/demo/event.md correctly 1`] = `
|
||||
exports[`renders ./components/dropdown/demo/item.md correctly 1`] = `
|
||||
<a
|
||||
class="ant-dropdown-link ant-dropdown-trigger"
|
||||
href="#"
|
||||
>
|
||||
Hover me
|
||||
<i
|
||||
@@ -240,7 +237,6 @@ exports[`renders ./components/dropdown/demo/item.md correctly 1`] = `
|
||||
exports[`renders ./components/dropdown/demo/menu-full.md correctly 1`] = `
|
||||
<a
|
||||
class="ant-dropdown-link ant-dropdown-trigger"
|
||||
href="#"
|
||||
>
|
||||
Hover to check menu style
|
||||
<i
|
||||
@@ -268,7 +264,6 @@ exports[`renders ./components/dropdown/demo/menu-full.md correctly 1`] = `
|
||||
exports[`renders ./components/dropdown/demo/overlay-visible.md correctly 1`] = `
|
||||
<a
|
||||
class="ant-dropdown-link ant-dropdown-trigger"
|
||||
href="#"
|
||||
>
|
||||
Hover me
|
||||
<i
|
||||
@@ -350,7 +345,6 @@ exports[`renders ./components/dropdown/demo/placement.md correctly 1`] = `
|
||||
exports[`renders ./components/dropdown/demo/sub-menu.md correctly 1`] = `
|
||||
<a
|
||||
class="ant-dropdown-link ant-dropdown-trigger"
|
||||
href="#"
|
||||
>
|
||||
Cascading menu
|
||||
<i
|
||||
@@ -378,7 +372,6 @@ exports[`renders ./components/dropdown/demo/sub-menu.md correctly 1`] = `
|
||||
exports[`renders ./components/dropdown/demo/trigger.md correctly 1`] = `
|
||||
<a
|
||||
class="ant-dropdown-link ant-dropdown-trigger"
|
||||
href="#"
|
||||
>
|
||||
Click me
|
||||
<i
|
||||
|
||||
@@ -38,7 +38,7 @@ const menu = (
|
||||
|
||||
ReactDOM.render(
|
||||
<Dropdown overlay={menu}>
|
||||
<a className="ant-dropdown-link" href="#">
|
||||
<a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
|
||||
Hover me <Icon type="down" />
|
||||
</a>
|
||||
</Dropdown>,
|
||||
|
||||
@@ -30,7 +30,7 @@ const menu = (
|
||||
|
||||
ReactDOM.render(
|
||||
<Dropdown overlay={menu}>
|
||||
<a className="ant-dropdown-link" href="#">
|
||||
<a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
|
||||
Hover me, Click menu item <Icon type="down" />
|
||||
</a>
|
||||
</Dropdown>,
|
||||
|
||||
@@ -37,7 +37,7 @@ const menu = (
|
||||
|
||||
ReactDOM.render(
|
||||
<Dropdown overlay={menu}>
|
||||
<a className="ant-dropdown-link" href="#">
|
||||
<a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
|
||||
Hover me <Icon type="down" />
|
||||
</a>
|
||||
</Dropdown>,
|
||||
|
||||
@@ -82,7 +82,7 @@ const menu = (
|
||||
|
||||
ReactDOM.render(
|
||||
<Dropdown overlay={menu}>
|
||||
<a className="ant-dropdown-link" href="#">
|
||||
<a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
|
||||
Hover to check menu style <Icon type="down" />
|
||||
</a>
|
||||
</Dropdown>,
|
||||
|
||||
@@ -45,7 +45,7 @@ class OverlayVisible extends React.Component {
|
||||
onVisibleChange={this.handleVisibleChange}
|
||||
visible={this.state.visible}
|
||||
>
|
||||
<a className="ant-dropdown-link" href="#">
|
||||
<a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
|
||||
Hover me <Icon type="down" />
|
||||
</a>
|
||||
</Dropdown>
|
||||
|
||||
@@ -35,7 +35,7 @@ const menu = (
|
||||
|
||||
ReactDOM.render(
|
||||
<Dropdown overlay={menu}>
|
||||
<a className="ant-dropdown-link" href="#">
|
||||
<a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
|
||||
Cascading menu <Icon type="down" />
|
||||
</a>
|
||||
</Dropdown>,
|
||||
|
||||
@@ -31,7 +31,7 @@ const menu = (
|
||||
|
||||
ReactDOM.render(
|
||||
<Dropdown overlay={menu} trigger={['click']}>
|
||||
<a className="ant-dropdown-link" href="#">
|
||||
<a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
|
||||
Click me <Icon type="down" />
|
||||
</a>
|
||||
</Dropdown>,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
&-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: @list-item-padding;
|
||||
|
||||
&-content {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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,11 +90,10 @@ 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;
|
||||
okText?: React.ReactNode;
|
||||
okType?: ButtonType;
|
||||
cancelText?: React.ReactNode;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
&.@{steps-prefix-cls}-small:not(.@{steps-prefix-cls}-dot) {
|
||||
.@{steps-prefix-cls}-item {
|
||||
&-icon {
|
||||
margin-left: 40px;
|
||||
margin-left: 46px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
&::before,
|
||||
&::after {
|
||||
display: table;
|
||||
width: 100%;
|
||||
content: '';
|
||||
}
|
||||
&::after {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
>
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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> {
|
||||
|
||||
@@ -11,6 +11,7 @@ export interface TimeLineItemProps {
|
||||
pending?: boolean;
|
||||
position?: string;
|
||||
style?: React.CSSProperties;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
const TimelineItem: React.SFC<TimeLineItemProps> = props => (
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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'}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "antd",
|
||||
"version": "3.26.6",
|
||||
"version": "3.26.10",
|
||||
"description": "An enterprise-class UI design language and React components implementation",
|
||||
"keywords": [
|
||||
"ant",
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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} />
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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': '查看更多',
|
||||
|
||||
Reference in New Issue
Block a user