Merge remote-tracking branch 'origin/master' into feature-merge-master

This commit is contained in:
zombiej 2021-12-16 10:40:55 +08:00
commit 42bc6dcdef
14 changed files with 128 additions and 15 deletions

View File

@ -24,6 +24,6 @@ jobs:
dingding-token: ${{ secrets.DINGDING_BOT_TOKEN }}
dingding-msg: 'CHANGELOG.zh-CN.md'
msg-poster: 'https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*zx7LTI_ECSAAAAAAAAAAAABkARQnAQ'
msg-footer: '> 💬 前往 [**Ant Design Releases**]({{url}}) 查看更新日志'
msg-footer: '💬 前往 [**Ant Design Releases**]({{url}}) 查看更新日志'
prettier: true
prerelease-filter: '-, a, b, A, B'

View File

@ -15,6 +15,27 @@ timeline: true
---
## 4.17.3
`2021-12-08`
- 🐞 Fix Drawer broken style caused by title width. [#33205](https://github.com/ant-design/ant-design/pull/33205)
- 🐞 Fix Badge flash style when switch from `display:none`. [#33083](https://github.com/ant-design/ant-design/pull/33083) [@songlinn](https://github.com/songlinn)
- 💄 Change Anchor className form `.fixed` to `.ant-anchor-fixed`. [#33085](https://github.com/ant-design/ant-design/pull/33085) [@tangjinzhou](https://github.com/tangjinzhou)
- 💄 Fix Button loading style missing in Firefox. [#33199](https://github.com/ant-design/ant-design/pull/33199)
- Select
- 🐞 Fix Select width became small when searching. [#32988](https://github.com/ant-design/ant-design/pull/32988)
- 🐞 Fix Select throw `Object.values not defined` in low version browser. [#33124](https://github.com/ant-design/ant-design/pull/33124)
- Radio
- 💄 Fix Radio dot offset when zooming. [#33086](https://github.com/ant-design/ant-design/pull/33086) [@hydraZty](https://github.com/hydraZty)
- 💄 Fix Radio cursor style. [#33198](https://github.com/ant-design/ant-design/pull/33198) [@tangjinzhou](https://github.com/tangjinzhou)
- 💄 Revert Collapse header `position: relative` style to ensure some user depends on this style. [#33070](https://github.com/ant-design/ant-design/pull/33070)
- 🐞 Fix Input.TextArea height bug when has `showCount`. [#33055](https://github.com/ant-design/ant-design/pull/33055)
- TypeScript
- 🤖 Fix Upload `data` type. [#33193](https://github.com/ant-design/ant-design/pull/33193)
- 🤖 Fix Carousel type declaration. [#33109](https://github.com/ant-design/ant-design/pull/33109) [@q1uxu](https://github.com/q1uxu)
- 🌐 Add missing zh-TW translation. [#33108](https://github.com/ant-design/ant-design/pull/33108) [@dengfuping](https://github.com/dengfuping)
## 4.17.2
`2021-11-26`

View File

@ -15,6 +15,27 @@ timeline: true
---
## 4.17.3
`2021-12-08`
- 🐞 修复 Drawer `title` 未能填满一行造成的样式问题。[#33205](https://github.com/ant-design/ant-design/pull/33205)
- 🐞 修复 Badge 从 `display:none` 时切换到显示时闪动的问题。[#33083](https://github.com/ant-design/ant-design/pull/33083) [@songlinn](https://github.com/songlinn)
- 💄 Anchor 固定样式类从 `.fixed` 修改成 `.ant-anchor-fixed`[#33085](https://github.com/ant-design/ant-design/pull/33085) [@tangjinzhou](https://github.com/tangjinzhou)
- 💄 修复 Button `loading` 样式在 Firefox 下丢失的问题。[#33199](https://github.com/ant-design/ant-design/pull/33199)
- Select
- 🐞 修复 Select 单选搜索时宽度收缩的问题。[#32988](https://github.com/ant-design/ant-design/pull/32988)
- 🐞 修复 Select 在低版本浏览器报出 `Object.values not defined` 错误的问题。[#33124](https://github.com/ant-design/ant-design/pull/33124)
- Radio
- 💄 修复 Radio 在缩放时蓝点不居中的问题。[#33086](https://github.com/ant-design/ant-design/pull/33086) [@hydraZty](https://github.com/hydraZty)
- 💄 修复 Radio 禁用鼠标手型样式。[#33198](https://github.com/ant-design/ant-design/pull/33198) [@tangjinzhou](https://github.com/tangjinzhou)
- 💄 Collapse header 添加 `position: relative` 样式以兼容过去某些场景用户依赖了该样式。[#33070](https://github.com/ant-design/ant-design/pull/33070)
- 🐞 修复 Input.TextArea 当有 `showCount` 时设置高度失效。[#33055](https://github.com/ant-design/ant-design/pull/33055)
- TypeScript
- 🤖 修复 Upload `data` TypeScript 定义。[#33193](https://github.com/ant-design/ant-design/pull/33193)
- 🤖 修复 Carousel TypeScript 定义。[#33109](https://github.com/ant-design/ant-design/pull/33109) [@q1uxu](https://github.com/q1uxu)
- 🌐 补充 `zh-TW` 语言包。[#33108](https://github.com/ant-design/ant-design/pull/33108) [@dengfuping](https://github.com/dengfuping)
## 4.17.2
`2021-11-26`

View File

@ -168,7 +168,7 @@
}
& > &-loading-icon {
transition: all 0.3s @ease-in-out;
transition: width 0.3s @ease-in-out, opacity 0.3s @ease-in-out;
.@{iconfont-css-prefix} {
padding-right: @padding-xs;

View File

@ -4237,7 +4237,6 @@ exports[`renders ./components/form/demo/register.md correctly 1`] = `
<textarea
class="ant-input"
id="register_intro"
maxlength="100"
/>
</div>
</div>

View File

@ -1,10 +1,14 @@
import React, { Component } from 'react';
import React, { Component, useState } from 'react';
import { mount } from 'enzyme';
import { act } from 'react-dom/test-utils';
import scrollIntoView from 'scroll-into-view-if-needed';
import Form from '..';
import * as Util from '../util';
import Input from '../../input';
import Button from '../../button';
import Select from '../../select';
import mountTest from '../../../tests/shared/mountTest';
import rtlTest from '../../../tests/shared/rtlTest';
import { sleep } from '../../../tests/utils';
@ -831,7 +835,7 @@ describe('Form', () => {
_internalItemRender={{
mark: 'pro_table_render',
render: (_, doms) => (
<div id="test">
<div id="_test">
{doms.input}
{doms.errorList}
{doms.extra}
@ -843,7 +847,62 @@ describe('Form', () => {
</Form.Item>
</Form>,
);
expect(wrapper.find('#test').exists()).toBeTruthy();
expect(wrapper.find('#_test').exists()).toBeTruthy();
});
it('Form Item element id will auto add form_item prefix if form name is empty and item name is in the black list', async () => {
const mockFn = jest.spyOn(Util, 'getFieldId');
const itemName = 'parentNode';
// mock getFieldId old logic,if form name is empty ,and item name is parentNode,will get parentNode
mockFn.mockImplementation(() => itemName);
const { Option } = Select;
const Demo = () => {
const [open, setOpen] = useState(false);
return (
<>
<Form>
<Form.Item name={itemName}>
<Select
className="form_item_parentNode"
defaultValue="lucy"
open={open}
style={{ width: 120 }}
>
<Option value="jack">Jack</Option>
<Option value="lucy">Lucy</Option>
<Option value="Yiminghe">yiminghe</Option>
</Select>
</Form.Item>
</Form>
<button
type="button"
onClick={() => {
setOpen(true);
}}
>
{open ? 'show' : 'hidden'}
</button>
</>
);
};
const wrapper = mount(<Demo />, { attachTo: document.body });
expect(mockFn).toHaveBeenCalled();
expect(Util.getFieldId()).toBe(itemName);
// make sure input id is parentNode
expect(wrapper.find(`#${itemName}`).exists()).toBeTruthy();
act(() => {
wrapper.find('button').simulate('click');
});
expect(wrapper.find('button').text()).toBe('show');
mockFn.mockRestore();
// https://enzymejs.github.io/enzyme/docs/api/ShallowWrapper/update.html
// setProps instead of update
wrapper.setProps({});
expect(wrapper.find(`#form_item_${itemName}`).exists()).toBeTruthy();
wrapper.unmount();
});
describe('tooltip', () => {

View File

@ -1,5 +1,12 @@
import { InternalNamePath } from './interface';
// form item name black list. in form ,you can use form.id get the form item element.
// use object hasOwnProperty will get better performance if black list is longer.
const formItemNameBlackList = ['parentNode'];
// default form item id prefix.
const defaultItemNamePrefixCls: string = 'form_item';
export function toArray<T>(candidate?: T | T[] | false): T[] {
if (candidate === undefined || candidate === false) return [];
@ -10,5 +17,12 @@ export function getFieldId(namePath: InternalNamePath, formName?: string): strin
if (!namePath.length) return undefined;
const mergedId = namePath.join('_');
return formName ? `${formName}_${mergedId}` : mergedId;
if (formName) {
return `${formName}_${mergedId}`;
}
const isIllegalName = formItemNameBlackList.indexOf(mergedId) >= 0;
return isIllegalName ? `${defaultItemNamePrefixCls}_${mergedId}` : mergedId;
}

View File

@ -135,7 +135,6 @@ const TextArea = React.forwardRef<TextAreaRef, TextAreaProps>(
onChange={handleChange}
onCompositionEnd={onInternalCompositionEnd}
ref={innerRef}
maxLength={maxLength}
/>
);

View File

@ -3371,7 +3371,6 @@ exports[`renders ./components/input/demo/textarea-show-count.md correctly 1`] =
>
<textarea
class="ant-input"
maxlength="100"
/>
</div>
`;

View File

@ -245,7 +245,6 @@ exports[`TextArea allowClear should not show icon if value is undefined, null or
exports[`TextArea maxLength should support maxLength 1`] = `
<textarea
class="ant-input"
maxlength="10"
/>
`;

View File

@ -358,6 +358,7 @@ describe('TextArea allowClear', () => {
'setSelectionRange',
);
wrapper.find('textarea').simulate('input', { target: { value: '\n1' } });
wrapper.triggerResize();
await sleep(100);
expect(setSelectionRangeFn).toHaveBeenCalled();
wrapper.unmount();

View File

@ -71,7 +71,7 @@ ConfigProvider.config({
Since prefix modified. Origin `antd.variable.css` should also be replaced:
```bash
lessc --modify-var="ant-prefix=custom" antd/dist/antd.variable.less modified.css
lessc --js --modify-var="ant-prefix=custom" antd/dist/antd.variable.less modified.css
```
### Related changes

View File

@ -71,7 +71,7 @@ ConfigProvider.config({
由于前缀变更,你需要重新生成一份对应的 css 文件。
```bash
lessc --modify-var="ant-prefix=custom" antd/dist/antd.variable.less modified.css
lessc --js --modify-var="ant-prefix=custom" antd/dist/antd.variable.less modified.css
```
### 相关变更

View File

@ -1,6 +1,6 @@
{
"name": "antd",
"version": "4.17.2",
"version": "4.17.3",
"description": "An enterprise-class UI design language and React components implementation",
"title": "Ant Design",
"keywords": [
@ -138,7 +138,7 @@
"rc-picker": "~2.5.17",
"rc-progress": "~3.1.0",
"rc-rate": "~2.9.0",
"rc-resize-observer": "^1.1.0",
"rc-resize-observer": "^1.1.2",
"rc-select": "~13.2.1",
"rc-slider": "~9.7.4",
"rc-steps": "~4.1.0",
@ -167,7 +167,7 @@
"@types/gtag.js": "^0.0.8",
"@types/jest": "^27.0.0",
"@types/jest-axe": "^3.5.3",
"@types/jest-environment-puppeteer": "^4.4.0",
"@types/jest-environment-puppeteer": "^4.4.1",
"@types/jest-image-snapshot": "^4.1.0",
"@types/lodash": "^4.14.139",
"@types/puppeteer": "^5.4.0",
@ -227,6 +227,7 @@
"isomorphic-fetch": "^3.0.0",
"jest": "^27.0.3",
"jest-axe": "^5.0.1",
"jest-environment-node": "^27.4.4",
"jest-image-snapshot": "^4.5.1",
"jest-puppeteer": "^6.0.0",
"jquery": "^3.4.1",