Compare commits

...

11 Commits

Author SHA1 Message Date
信鑫-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
19 changed files with 182 additions and 81 deletions

View File

@@ -15,6 +15,17 @@ timeline: true
---
## 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,17 @@ timeline: true
---
## 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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -1,6 +1,6 @@
{
"name": "antd",
"version": "3.26.6",
"version": "3.26.7",
"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

@@ -97,23 +97,23 @@ const Banner = ({ isMobile }) => {
<FormattedMessage id="app.home.recommend" />
</Divider>
<a
href="https://next.ant.design/"
href="https://www.yuque.com/e/que?chInfo=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://www.yuque.com/e/que?chInfo=antd`,
});
}
}}
>
<img
src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg"
alt="antd logo"
src="https://gw.alipayobjects.com/zos/rmsportal/XuVpGqBFxXplzvLjJBZB.svg"
alt="yuque logo"
/>
<FormattedMessage id="app.home.recommend.antd.next" />
<FormattedMessage id="app.home.recommend.yuque" />
<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': '查看更多',