Merge pull request #30544 from ant-design/master

chore: merge master into feature
This commit is contained in:
afc163 2021-05-17 09:30:31 +08:00 committed by GitHub
commit 3aad6ee882
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 149 additions and 36 deletions

4
.husky/pre-commit Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no-install pretty-quick --staged

View File

@ -15,6 +15,28 @@ timeline: true
--- ---
## 4.15.5
`2021-05-10`
- 🐞 Fix Upload crashes if `beforeUpload` returns `false` in IE. [#30391](https://github.com/ant-design/ant-design/pull/30391) [@OleksandrAntonenko1](https://github.com/OleksandrAntonenko1)
- Calendar
- 🐞 Fix Calendar broken style inside Form.Item. [#30442](https://github.com/ant-design/ant-design/pull/30442)
- 🐞 Fix Calendar throws error when set `value` to `null` or `undefined`. [#30442](https://github.com/ant-design/ant-design/pull/30442)
- Table
- 🐞 Fix Table call `confirm({ closeDropdown: true })` in `filterDropdown` should not trigger `onFilterDropdownVisibleChange`. [#30457](https://github.com/ant-design/ant-design/pull/30457)
- 🐞 Fix Table broken expand icon style in Windows Firefox. [#30410](https://github.com/ant-design/ant-design/pull/30410)
- 🐞 Fix Dropdown.Button don't support `mouseEnterDelay` and `mouseLeaveDelay`. [#30452](https://github.com/ant-design/ant-design/pull/30452)
- 💄 Optimize Rate focus behavior from `:focus` to `:focus-visible`. [#30451](https://github.com/ant-design/ant-design/pull/30451)
- 🐞 Fix Steps with progress get cut at the bottom. [#30373](https://github.com/ant-design/ant-design/pull/30373) [@fachreza73](https://github.com/fachreza73)
- 🐞 Fix the problem that setting `locale` in DatePicker cannot override ConfigProvider `locale`. [#30380](https://github.com/ant-design/ant-design/pull/30380) [@Map1en](https://github.com/Map1en)
- Locale
- 🇫🇮 Update DatePicker Finnish locale. [#30433](https://github.com/ant-design/ant-design/pull/30433) [@hiiri](https://github.com/hiiri)
- 🇫🇷 Update French locale with missing messages. [#30436](https://github.com/ant-design/ant-design/pull/30436) [@LoicUV](https://github.com/LoicUV)
- 🇷🇸 Update Serbian locale. [#30401](https://github.com/ant-design/ant-design/pull/30401) [@vmedar](https://github.com/vmedar)
- TypeScript
- 🤖 Export Tooltip `zIndex` prop typescript definition. [#30432](https://github.com/ant-design/ant-design/pull/30432)
## 4.15.4 ## 4.15.4
`2021-04-30` `2021-04-30`

View File

@ -15,17 +15,39 @@ timeline: true
--- ---
## 4.15.5
`2021-05-10`
- 🐞 修复 Upload 在 IE 下,`beforeUpload` 返回 `false` 的报错问题。[#30391](https://github.com/ant-design/ant-design/pull/30391) [@OleksandrAntonenko1](https://github.com/OleksandrAntonenko1)
- Calendar
- 🐞 修复 Calendar 在 Form.Item 下样式错乱的问题。[#30442](https://github.com/ant-design/ant-design/pull/30442)
- 🐞 修复 Calendar `value` 设置 `null``undefined` 时报错的问题。[#30442](https://github.com/ant-design/ant-design/pull/30442)。[#30442](https://github.com/ant-design/ant-design/pull/30442)
- Table
- 🐞 修复 Table `filterDropdown` 调用 `confirm({ closeDropdown: true })` 时也会触发 `onFilterDropdownVisibleChange` 的问题。[#30457](https://github.com/ant-design/ant-design/pull/30457)
- 🐞 修复 Table 展开图标在 Windows Firefox 下显示异常的问题。[#30410](https://github.com/ant-design/ant-design/pull/30410)
- 🐞 修复 Dropdown.Button 不支持 `mouseEnterDelay``mouseLeaveDelay` 的问题。[#30452](https://github.com/ant-design/ant-design/pull/30452)
- 💄 优化 Rate 聚焦行为从 `:focus``:focus-visible`。[#30451](https://github.com/ant-design/ant-design/pull/30451)
- 🐞 修复 Steps 进度条圆圈在底部被切掉的问题。[#30373](https://github.com/ant-design/ant-design/pull/30373) [@fachreza73](https://github.com/fachreza73)
- 🐞 修复在 DatePicker 里设置 `locale` 不能覆盖 ConfigProvider `locale` 的问题。[#30380](https://github.com/ant-design/ant-design/pull/30380) [@Map1en](https://github.com/Map1en)
- 国际化
- 🇫🇮 改进 DatePicker 芬兰语国际化。[#30433](https://github.com/ant-design/ant-design/pull/30433) [@hiiri](https://github.com/hiiri)
- 🇫🇷 更新法语国际化。[#30436](https://github.com/ant-design/ant-design/pull/30436) [@LoicUV](https://github.com/LoicUV)
- 🇷🇸 更新塞尔维亚语国际化。[#30401](https://github.com/ant-design/ant-design/pull/30401) [@vmedar](https://github.com/vmedar)
- TypeScript
- 🤖 Tooltip 导出 `zIndex` 类型定义。[#30432](https://github.com/ant-design/ant-design/pull/30432)
## 4.15.4 ## 4.15.4
`2021-04-30` `2021-04-30`
- 🐞 修复 Menu.Item 设置 `collapsedWidth` 时宽度错误的问题。[#30357](https://github.com/ant-design/ant-design/pull/30357) [@Map1en](https://github.com/Map1en) - 🐞 修复 Menu.Item 设置 `collapsedWidth` 时宽度错误的问题。[#30357](https://github.com/ant-design/ant-design/pull/30357) [@Map1en](https://github.com/Map1en)
- 🐞 修复 Radio 选中样式有时高度略长的问题。[#30367](https://github.com/ant-design/ant-design/pull/30367) - 🐞 修复 Radio 选中样式有时高度略长的问题。[#30367](https://github.com/ant-design/ant-design/pull/30367)
- 🐞 修复 Typography.Link 在 `editable` 模式下点击编辑会触发链接跳转的问题。[#30354](https://github.com/ant-design/ant-design/pull/30354) [@John60676](https://github.com/John60676) - 🐞 修复 Typography.Link 在 `editable` 模式下点击编辑会触发链接跳转的问题。[#30354](https://github.com/ant-design/ant-design/pull/30354) [@John60676](https://github.com/John60676)
- 🐞 InputNumber 现在清空输入框时会触发 `onChange(null)`。[#30337](https://github.com/ant-design/ant-design/pull/30337) - 🐞 InputNumber 现在清空输入框时会触发 `onChange(null)`。[#30337](https://github.com/ant-design/ant-design/pull/30337)
- 🐞 修复 Modal `footer` 里放置 Dropdown.Button 的样式错乱问题。[#30328](https://github.com/ant-design/ant-design/pull/30328) [@Map1en](https://github.com/Map1en) - 🐞 修复 Modal `footer` 里放置 Dropdown.Button 的样式错乱问题。[#30328](https://github.com/ant-design/ant-design/pull/30328) [@Map1en](https://github.com/Map1en)
- 💄 替换 Anchor 默认背景颜色从 `#FFFFFF` 改至 `transparent`。[#30336](https://github.com/ant-design/ant-design/pull/30336) - 💄 替换 Anchor 默认背景颜色从 `#FFFFFF` 改至 `transparent`。[#30336](https://github.com/ant-design/ant-design/pull/30336)
- 🌐 添加 TimePicker.RangePicker `ko_KR``ja_JP``placeholder` 国际化。[#30285](https://github.com/ant-design/ant-design/pull/30285) [@ChalkPE](https://github.com/ChalkPE) - 🌐 添加 TimePicker.RangePicker `ko_KR``ja_JP``placeholder` 国际化。[#30285](https://github.com/ant-design/ant-design/pull/30285) [@ChalkPE](https://github.com/ChalkPE)
- TypeScript - TypeScript
- 🤖 修复 Upload `beforeUpload``UploadFile` 类型声明。[#30351](https://github.com/ant-design/ant-design/pull/30351) [#30343](https://github.com/ant-design/ant-design/pull/30343) [@kerm1it](https://github.com/kerm1it) - 🤖 修复 Upload `beforeUpload``UploadFile` 类型声明。[#30351](https://github.com/ant-design/ant-design/pull/30351) [#30343](https://github.com/ant-design/ant-design/pull/30343) [@kerm1it](https://github.com/kerm1it)

View File

@ -69,7 +69,7 @@ The following APIs are shared by DatePicker, RangePicker.
| picker | Set picker type | `date` \| `week` \| `month` \| `quarter` \| `year` | `date` | `quarter`: 4.1.0 | | picker | Set picker type | `date` \| `week` \| `month` \| `quarter` \| `year` | `date` | `quarter`: 4.1.0 |
| placeholder | The placeholder of date input | string \| \[string,string] | - | | | placeholder | The placeholder of date input | string \| \[string,string] | - | |
| popupStyle | To customize the style of the popup calendar | CSSProperties | {} | | | popupStyle | To customize the style of the popup calendar | CSSProperties | {} | |
| size | The determine the size of the input box, the height of `large` and `small`, are 40px and 24px respectively, while default size is 32px | `large` \| `middle` \| `small` | - | | | size | To determine the size of the input box, the height of `large` and `small`, are 40px and 24px respectively, while default size is 32px | `large` \| `middle` \| `small` | - | |
| style | To customize the style of the input box | CSSProperties | {} | | | style | To customize the style of the input box | CSSProperties | {} | |
| suffixIcon | The custom suffix icon | ReactNode | - | | | suffixIcon | The custom suffix icon | ReactNode | - | |
| onOpenChange | Callback function, can be executed whether the popup calendar is popped up or closed | function(open) | - | | | onOpenChange | Callback function, can be executed whether the popup calendar is popped up or closed | function(open) | - | |

View File

@ -6,7 +6,7 @@ import { PickerLocale } from '../generatePicker';
const locale: PickerLocale = { const locale: PickerLocale = {
lang: { lang: {
placeholder: 'Valitse päivä', placeholder: 'Valitse päivä',
rangePlaceholder: ['Alku päivä', 'Loppu päivä'], rangePlaceholder: ['Alkamispäivä', 'Päättymispäivä'],
...CalendarLocale, ...CalendarLocale,
}, },
timePickerLocale: { timePickerLocale: {

View File

@ -64,4 +64,15 @@ describe('DropdownButton', () => {
const wrapper = mount(<Dropdown.Button overlay={menu} />); const wrapper = mount(<Dropdown.Button overlay={menu} />);
expect(wrapper.type().__ANT_BUTTON).toBe(true); expect(wrapper.type().__ANT_BUTTON).toBe(true);
}); });
it('should pass mouseEnterDelay and mouseLeaveDelay to Dropdown', () => {
const menu = (
<Menu>
<Menu.Item>foo</Menu.Item>
</Menu>
);
const wrapper = mount(<Dropdown.Button mouseEnterDelay={1} mouseLeaveDelay={2} overlay={menu} />);
expect(wrapper.find('Dropdown').props().mouseEnterDelay).toBe(1);
expect(wrapper.find('Dropdown').props().mouseLeaveDelay).toBe(2);
});
}); });

View File

@ -52,6 +52,8 @@ const DropdownButton: DropdownButtonInterface = props => {
icon = <EllipsisOutlined />, icon = <EllipsisOutlined />,
title, title,
buttonsRender, buttonsRender,
mouseEnterDelay,
mouseLeaveDelay,
...restProps ...restProps
} = props; } = props;
@ -63,6 +65,8 @@ const DropdownButton: DropdownButtonInterface = props => {
trigger: disabled ? [] : trigger, trigger: disabled ? [] : trigger,
onVisibleChange, onVisibleChange,
getPopupContainer: getPopupContainer || getContextPopupContainer, getPopupContainer: getPopupContainer || getContextPopupContainer,
mouseEnterDelay,
mouseLeaveDelay,
} as DropDownProps; } as DropDownProps;
if ('visible' in props) { if ('visible' in props) {

View File

@ -11,7 +11,7 @@ title:
## en-US ## en-US
Import icons from `@ant-design/icons`, component name of icons with different theme is the icon name suffixed by the theme name. Specific the `spin` property to show spinning animation. Import icons from `@ant-design/icons`, component name of icons with different theme is the icon name suffixed by the theme name. Specify the `spin` property to show spinning animation.
```jsx ```jsx
import { import {

View File

@ -74424,7 +74424,7 @@ exports[`Locale Provider should display the text as fi 1`] = `
> >
<input <input
autocomplete="off" autocomplete="off"
placeholder="Alku päivä" placeholder="Alkamispäivä"
readonly="" readonly=""
size="12" size="12"
value="" value=""
@ -74463,7 +74463,7 @@ exports[`Locale Provider should display the text as fi 1`] = `
> >
<input <input
autocomplete="off" autocomplete="off"
placeholder="Loppu päivä" placeholder="Päättymispäivä"
readonly="" readonly=""
size="12" size="12"
value="" value=""

View File

@ -1,5 +1,4 @@
/* eslint-disable no-template-curly-in-string */ /* eslint-disable no-template-curly-in-string */
import Pagination from 'rc-pagination/lib/locale/pt_BR'; import Pagination from 'rc-pagination/lib/locale/pt_BR';
import DatePicker from '../date-picker/locale/pt_BR'; import DatePicker from '../date-picker/locale/pt_BR';
import TimePicker from '../time-picker/locale/pt_BR'; import TimePicker from '../time-picker/locale/pt_BR';
@ -21,8 +20,11 @@ const localeValues: Locale = {
filterTitle: 'Menu de Filtro', filterTitle: 'Menu de Filtro',
filterConfirm: 'OK', filterConfirm: 'OK',
filterReset: 'Resetar', filterReset: 'Resetar',
filterEmptyText: 'Sem filtros',
emptyText: 'Sem conteúdo',
selectAll: 'Selecionar página atual', selectAll: 'Selecionar página atual',
selectInvert: 'Inverter seleção', selectInvert: 'Inverter seleção',
selectNone: 'Apagar todo o conteúdo',
selectionAll: 'Selecionar todo o conteúdo', selectionAll: 'Selecionar todo o conteúdo',
sortTitle: 'Ordenar título', sortTitle: 'Ordenar título',
expand: 'Expandir linha', expand: 'Expandir linha',
@ -41,9 +43,16 @@ const localeValues: Locale = {
cancelText: 'Cancelar', cancelText: 'Cancelar',
}, },
Transfer: { Transfer: {
titles: ['', ''],
searchPlaceholder: 'Procurar', searchPlaceholder: 'Procurar',
itemUnit: 'item', itemUnit: 'item',
itemsUnit: 'items', itemsUnit: 'items',
remove: 'Remover',
selectCurrent: 'Selecionar página atual',
removeCurrent: 'Remover página atual',
selectAll: 'Selecionar todos',
removeAll: 'Remover todos',
selectInvert: 'Inverter seleção atual',
}, },
Upload: { Upload: {
uploading: 'Enviando...', uploading: 'Enviando...',
@ -68,11 +77,12 @@ const localeValues: Locale = {
back: 'Retornar', back: 'Retornar',
}, },
Form: { Form: {
optional: '(opcional)',
defaultValidateMessages: { defaultValidateMessages: {
default: 'Erro ${label} na validação de campo', default: 'Erro ${label} na validação de campo',
required: 'Por favor, insira ${label}', required: 'Por favor, insira ${label}',
enum: '${label} deve ser um dos seguinte: [${enum}]', enum: '${label} deve ser um dos seguinte: [${enum}]',
whitespace: '${label} não pode ser um caractér vazio', whitespace: '${label} não pode ser um carácter vazio',
date: { date: {
format: ' O formato de data ${label} é inválido', format: ' O formato de data ${label} é inválido',
parse: '${label} não pode ser convertido para uma data', parse: '${label} não pode ser convertido para uma data',
@ -116,6 +126,9 @@ const localeValues: Locale = {
}, },
}, },
}, },
Image: {
preview: 'Pré-visualização',
},
}; };
export default localeValues; export default localeValues;

View File

@ -27,21 +27,22 @@
display: inline-block; display: inline-block;
color: inherit; color: inherit;
cursor: pointer; cursor: pointer;
transition: all 0.3s;
&:not(:last-child) { &:not(:last-child) {
margin-right: 8px; margin-right: 8px;
} }
> div { > div {
&:focus { transition: all 0.3s;
outline: 0;
}
&:hover, &:hover,
&:focus { &:focus-visible {
transform: @rate-star-hover-scale; transform: @rate-star-hover-scale;
} }
&:focus:not(:focus-visible) {
outline: 0;
}
} }
&-first, &-first,

View File

@ -322,12 +322,6 @@ caption {
caption-side: bottom; caption-side: bottom;
} }
th {
// Matches default `<td>` alignment by inheriting from the `<body>`, or the
// closest parent with a set `text-align`.
text-align: inherit;
}
// //
// Forms // Forms
// //

View File

@ -1544,6 +1544,7 @@ describe('Table.filter', () => {
expect(wrapper.find('.ant-table-filter-column')).toHaveLength(3); expect(wrapper.find('.ant-table-filter-column')).toHaveLength(3);
}); });
it('should pagination.current be 1 after filtering', () => { it('should pagination.current be 1 after filtering', () => {
const onChange = jest.fn(); const onChange = jest.fn();
const columns = [ const columns = [
@ -1593,4 +1594,46 @@ describe('Table.filter', () => {
wrapper.find('.ant-btn-primary').first().simulate('click'); wrapper.find('.ant-btn-primary').first().simulate('click');
expect(onChange.mock.calls[1][0].current).toBe(1); expect(onChange.mock.calls[1][0].current).toBe(1);
}); });
// https://github.com/ant-design/ant-design/issues/30454
it('should not trigger onFilterDropdownVisibleChange when call confirm({ closeDropdown: false })', () => {
const onFilterDropdownVisibleChange = jest.fn();
const wrapper = mount(
createTable({
columns: [
{
title: 'Name',
dataIndex: 'name',
key: 'name',
filteredValue: name,
filterDropdown: ({ confirm }) => (
<>
<button id="confirm-and-close" type="button" onClick={() => confirm()}>
confirm
</button>
<button
id="confirm-only"
type="button"
onClick={() => confirm({ closeDropdown: false })}
>
confirm
</button>
</>
),
onFilterDropdownVisibleChange,
},
],
}),
);
wrapper.find('.ant-dropdown-trigger').first().simulate('click');
expect(onFilterDropdownVisibleChange).toHaveBeenCalledTimes(1);
wrapper.find('#confirm-only').simulate('click');
expect(onFilterDropdownVisibleChange).toHaveBeenCalledTimes(1);
wrapper.find('#confirm-and-close').simulate('click');
expect(onFilterDropdownVisibleChange).toHaveBeenCalledTimes(2);
expect(onFilterDropdownVisibleChange).toHaveBeenLastCalledWith(false);
});
}); });

View File

@ -64,7 +64,7 @@ class App extends React.Component {
value={selectedKeys[0]} value={selectedKeys[0]}
onChange={e => setSelectedKeys(e.target.value ? [e.target.value] : [])} onChange={e => setSelectedKeys(e.target.value ? [e.target.value] : [])}
onPressEnter={() => this.handleSearch(selectedKeys, confirm, dataIndex)} onPressEnter={() => this.handleSearch(selectedKeys, confirm, dataIndex)}
style={{ width: 188, marginBottom: 8, display: 'block' }} style={{ marginBottom: 8, display: 'block' }}
/> />
<Space> <Space>
<Button <Button

View File

@ -8,14 +8,7 @@ import Checkbox from '../../../checkbox';
import Radio from '../../../radio'; import Radio from '../../../radio';
import Dropdown from '../../../dropdown'; import Dropdown from '../../../dropdown';
import Empty from '../../../empty'; import Empty from '../../../empty';
import { import { ColumnType, ColumnFilterItem, Key, TableLocale, GetPopupContainer } from '../../interface';
ColumnType,
ColumnFilterItem,
Key,
TableLocale,
GetPopupContainer,
FilterConfirmProps,
} from '../../interface';
import FilterDropdownMenuWrapper from './FilterWrapper'; import FilterDropdownMenuWrapper from './FilterWrapper';
import { FilterState } from '.'; import { FilterState } from '.';
import useSyncState from '../../../_util/hooks/useSyncState'; import useSyncState from '../../../_util/hooks/useSyncState';
@ -194,8 +187,10 @@ function FilterDropdown<RecordType>(props: FilterDropdownProps<RecordType>) {
internalTriggerFilter([]); internalTriggerFilter([]);
}; };
const doFilter = (param: FilterConfirmProps = { closeDropdown: true }) => { const doFilter = ({ closeDropdown } = { closeDropdown: true }) => {
triggerVisible(!param.closeDropdown); if (closeDropdown) {
triggerVisible(false);
}
internalTriggerFilter(getFilteredKeysSync()); internalTriggerFilter(getFilteredKeysSync());
}; };

View File

@ -1,6 +1,6 @@
{ {
"name": "antd", "name": "antd",
"version": "4.15.4", "version": "4.15.5",
"description": "An enterprise-class UI design language and React components implementation", "description": "An enterprise-class UI design language and React components implementation",
"title": "Ant Design", "title": "Ant Design",
"keywords": [ "keywords": [
@ -188,7 +188,7 @@
"cheerio": "^1.0.0-rc.3", "cheerio": "^1.0.0-rc.3",
"concurrently": "^6.0.0", "concurrently": "^6.0.0",
"cross-env": "^7.0.0", "cross-env": "^7.0.0",
"css-minimizer-webpack-plugin": "^2.0.0", "css-minimizer-webpack-plugin": "^3.0.0",
"css-split-webpack-plugin": "^0.2.6", "css-split-webpack-plugin": "^0.2.6",
"dekko": "^0.2.1", "dekko": "^0.2.1",
"docsearch.js": "^2.6.3", "docsearch.js": "^2.6.3",
@ -207,7 +207,7 @@
"eslint-plugin-markdown": "^2.0.0", "eslint-plugin-markdown": "^2.0.0",
"eslint-plugin-react": "^7.20.6", "eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.1.2", "eslint-plugin-react-hooks": "^4.1.2",
"eslint-plugin-unicorn": "^31.0.0", "eslint-plugin-unicorn": "^32.0.1",
"fetch-jsonp": "^1.1.3", "fetch-jsonp": "^1.1.3",
"fs-extra": "^10.0.0", "fs-extra": "^10.0.0",
"full-icu": "^1.3.0", "full-icu": "^1.3.0",
@ -252,7 +252,7 @@
"react-highlight-words": "^0.17.0", "react-highlight-words": "^0.17.0",
"react-infinite-scroller": "^1.2.4", "react-infinite-scroller": "^1.2.4",
"react-intl": "^5.3.0", "react-intl": "^5.3.0",
"react-resizable": "^2.0.0", "react-resizable": "^3.0.1",
"react-router-dom": "^5.0.1", "react-router-dom": "^5.0.1",
"react-sortable-hoc": "^2.0.0", "react-sortable-hoc": "^2.0.0",
"react-sticky": "^6.0.3", "react-sticky": "^6.0.3",

View File

@ -59,6 +59,10 @@ module.exports = {
javascriptEnabled: true, javascriptEnabled: true,
}, },
webpackConfig(config) { webpackConfig(config) {
config.cache = {
type: 'filesystem',
};
config.resolve.alias = { config.resolve.alias = {
'antd/lib': path.join(process.cwd(), 'components'), 'antd/lib': path.join(process.cwd(), 'components'),
'antd/es': path.join(process.cwd(), 'components'), 'antd/es': path.join(process.cwd(), 'components'),

View File

@ -79,7 +79,7 @@ export default () => {
const articles = data[isZhCN ? 'cn' : 'en']; const articles = data[isZhCN ? 'cn' : 'en'];
const yearData: Record<number | string, Record<string, Article[]>> = {}; const yearData: Record<number | string, Record<string, Article[]>> = {};
articles.forEach(article => { articles?.forEach(article => {
const year = moment(article.date).year(); const year = moment(article.date).year();
yearData[year] = yearData[year] || {}; yearData[year] = yearData[year] || {};