mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-04 21:18:01 +08:00
commit
a79f9d7b68
3
.github/workflows/pr-check-ci.yml
vendored
3
.github/workflows/pr-check-ci.yml
vendored
@ -9,13 +9,14 @@ jobs:
|
||||
pr-check-ci:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions-cool/check-pr-ci@v1.2.2
|
||||
- uses: actions-cool/check-pr-ci@v1.3.0
|
||||
with:
|
||||
filter-label: 'BranchAutoMerge'
|
||||
filter-creator-authority: 'write'
|
||||
filter-head-ref: 'master, feature, master-merge-feature, feature-merge-master'
|
||||
filter-support-fork: false
|
||||
skip-run-names: 'deploy preview, pr-check-ci, build preview failed'
|
||||
conflict-review-body: '😅 This branch has conflicts that must be resolved!'
|
||||
success-review: true
|
||||
success-merge: true
|
||||
merge-method: 'merge'
|
||||
|
3
.github/workflows/release-helper.yml
vendored
3
.github/workflows/release-helper.yml
vendored
@ -16,10 +16,11 @@ jobs:
|
||||
steps:
|
||||
- name: make release
|
||||
if: github.event.ref_type == 'tag'
|
||||
uses: actions-cool/release-helper@v1
|
||||
uses: actions-cool/release-helper@v1.4.0
|
||||
with:
|
||||
triger: 'tag'
|
||||
changelogs: 'CHANGELOG.en-US.md, CHANGELOG.zh-CN.md'
|
||||
branch: 'master'
|
||||
dingding-token: ${{ secrets.DINGDING_BOT_TOKEN }}
|
||||
dingding-msg: 'CHANGELOG.zh-CN.md'
|
||||
prerelease-filter: '-, a, b, A, B'
|
||||
|
@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npx --no-install pretty-quick --staged
|
@ -10,6 +10,7 @@
|
||||
"function-name-case": ["lower", { "ignoreFunctions": ["/colorPalette/"] }],
|
||||
"no-invalid-double-slash-comments": null,
|
||||
"no-descending-specificity": null,
|
||||
"no-invalid-position-at-import-rule": null,
|
||||
"declaration-empty-line-before": null
|
||||
},
|
||||
"ignoreFiles": ["components/style/color/{bezierEasing,colorPalette,tinyColor}.less"]
|
||||
|
@ -15,6 +15,36 @@ timeline: true
|
||||
|
||||
---
|
||||
|
||||
## 4.15.4
|
||||
|
||||
`2021-04-30`
|
||||
|
||||
- 🐞 Fix Menu.Item width issue when `collapsedWidth` is set. [#30357](https://github.com/ant-design/ant-design/pull/30357) [@Map1en](https://github.com/Map1en)
|
||||
- 🐞 Fix Radio check spin style sometime height too long. [#30367](https://github.com/ant-design/ant-design/pull/30367)
|
||||
- 🐞 Fix Typography.Link open link when trigger `editable`. [#30354](https://github.com/ant-design/ant-design/pull/30354) [@John60676](https://github.com/John60676)
|
||||
- 🐞 InputNumber clean up input will trigger `onChange(null)` now. [#30337](https://github.com/ant-design/ant-design/pull/30337)
|
||||
- 🐞 Fix Dropdown.Button broken style when inside Modal `footer`. [#30328](https://github.com/ant-design/ant-design/pull/30328) [@Map1en](https://github.com/Map1en)
|
||||
- 💄 Replace Anchor default background from `#FFFFFF` to `transparent`. [#30336](https://github.com/ant-design/ant-design/pull/30336)
|
||||
- 🌐 Add `ko_KR` and `ja_JP` TimePicker.RangePicker placeholder. [#30285](https://github.com/ant-design/ant-design/pull/30285) [@ChalkPE](https://github.com/ChalkPE)
|
||||
- TypeScript
|
||||
- 🤖 Fix Upload type definition of `beforeUpload`. [#30351](https://github.com/ant-design/ant-design/pull/30351) [@kerm1it](https://github.com/kerm1it)
|
||||
|
||||
## 4.15.3
|
||||
|
||||
`2021-04-25`
|
||||
|
||||
- Table
|
||||
- 🐞 Fix Table selection column width when bordered is true. [#30304](https://github.com/ant-design/ant-design/pull/30304)
|
||||
- 🚨 Add warning when Table `current` is negative number. [#30242](https://github.com/ant-design/ant-design/pull/30242) [@wadezhan](https://github.com/wadezhan)
|
||||
- 🐞 Fix Button `type="link"` should not redirect when it is `disabled`. [#30209](https://github.com/ant-design/ant-design/pull/30209)
|
||||
- 🐞 Fix Upload appear errors when url of file is `null`. [#30215](https://github.com/ant-design/ant-design/pull/30215)
|
||||
- 🐞 Fix padding on a SubMenu inside an ItemGroup. [#30218](https://github.com/ant-design/ant-design/pull/30218) [@sebakerckhof](https://github.com/sebakerckhof)
|
||||
- 🐞 Fix Checkbox & Radio align issue in flex box. [#30260](https://github.com/ant-design/ant-design/pull/30260)
|
||||
- 🐞 Fix Badge broken animation on spin icon. [#30275](https://github.com/ant-design/ant-design/pull/30275)
|
||||
- 🐞 Fix Input `disabled` hover style in Form. [#30302](https://github.com/ant-design/ant-design/pull/30302) [@Fog3211](https://github.com/Fog3211)
|
||||
- TypeScript
|
||||
- 🤖 Fix Upload type definition of `beforeUpload`. [#30213](https://github.com/ant-design/ant-design/pull/30213)
|
||||
|
||||
## 4.15.2
|
||||
|
||||
`2021-04-19`
|
||||
|
@ -15,6 +15,36 @@ timeline: true
|
||||
|
||||
---
|
||||
|
||||
## 4.15.4
|
||||
|
||||
`2021-04-30`
|
||||
|
||||
- 🐞 修复 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)
|
||||
- 🐞 修复 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)
|
||||
- 🐞 修复 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)
|
||||
- 🌐 添加 TimePicker.RangePicker `ko_KR` 和 `ja_JP` 的 `placeholder` 国际化。[#30285](https://github.com/ant-design/ant-design/pull/30285) [@ChalkPE](https://github.com/ChalkPE)
|
||||
- TypeScript
|
||||
- 🤖 修复 Upload 组件 `beforeUpload` 类型声明。[#30351](https://github.com/ant-design/ant-design/pull/30351) [@kerm1it](https://github.com/kerm1it)
|
||||
|
||||
## 4.15.3
|
||||
|
||||
`2021-04-25`
|
||||
|
||||
- Table
|
||||
- 🐞 修复选择列和边框冲突的问题。[#30304](https://github.com/ant-design/ant-design/pull/30304)
|
||||
- 🚨 当 `current` 为负数时将在显示控制台警告。[#30242](https://github.com/ant-design/ant-design/pull/30242) [@wadezhan](https://github.com/wadezhan)
|
||||
- 🐞 修复 Button `type="link"` 添加 `disabled` 后仍然可点击跳转的问题。[#30209](https://github.com/ant-design/ant-design/pull/30209)
|
||||
- 🐞 修复 Upload 当文件 url 为 `null` 时渲染出错问题。[#30215](https://github.com/ant-design/ant-design/pull/30215)
|
||||
- 🐞 修复 SubMenu 在 ItemGroup 内时的内边距。[#30218](https://github.com/ant-design/ant-design/pull/30218) [@sebakerckhof](https://github.com/sebakerckhof)
|
||||
- 🐞 修复 Checkbox 和 Radio 在 flex 布局下的对齐问题。[#30260](https://github.com/ant-design/ant-design/pull/30260)
|
||||
- 🐞 修复 Badge 上放置旋转图标的动画问题。[#30275](https://github.com/ant-design/ant-design/pull/30275)
|
||||
- 🐞 修复 Form 错误校验状态下 Input `disabled` 的 hover 样式。[#30302](https://github.com/ant-design/ant-design/pull/30302) [@Fog3211](https://github.com/Fog3211)
|
||||
- TypeScript
|
||||
- 🤖 修复 Upload 组件 `beforeUpload` 类型声明。[#30213](https://github.com/ant-design/ant-design/pull/30213)
|
||||
|
||||
## 4.15.2
|
||||
|
||||
`2021-04-19`
|
||||
|
@ -20,16 +20,22 @@
|
||||
}
|
||||
|
||||
.@{ant-prefix}-input-disabled {
|
||||
background-color: @input-disabled-bg;
|
||||
border-color: @input-border-color;
|
||||
&,
|
||||
&:hover {
|
||||
background-color: @input-disabled-bg;
|
||||
border-color: @input-border-color;
|
||||
}
|
||||
}
|
||||
|
||||
.@{ant-prefix}-input-affix-wrapper-disabled {
|
||||
background-color: @input-disabled-bg;
|
||||
border-color: @input-border-color;
|
||||
&,
|
||||
&:hover {
|
||||
background-color: @input-disabled-bg;
|
||||
border-color: @input-border-color;
|
||||
|
||||
input:focus {
|
||||
box-shadow: none !important;
|
||||
input:focus {
|
||||
box-shadow: none !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,9 +15,6 @@ describe('InputNumber', () => {
|
||||
const onChange = jest.fn();
|
||||
const wrapper = mount(<InputNumber defaultValue="1" onChange={onChange} />);
|
||||
wrapper.find('input').simulate('change', { target: { value: '' } });
|
||||
expect(onChange).not.toHaveBeenCalled();
|
||||
|
||||
wrapper.find('input').simulate('blur');
|
||||
expect(onChange).toHaveBeenLastCalledWith(null);
|
||||
});
|
||||
|
||||
|
@ -143325,7 +143325,7 @@ exports[`Locale Provider should display the text as ja 1`] = `
|
||||
>
|
||||
<input
|
||||
autocomplete="off"
|
||||
placeholder="時刻を選択"
|
||||
placeholder="時間を選択"
|
||||
readonly=""
|
||||
size="10"
|
||||
title=""
|
||||
|
@ -17,6 +17,8 @@ const localeValues: Locale = {
|
||||
filterTitle: '필터 메뉴',
|
||||
filterConfirm: '확인',
|
||||
filterReset: '초기화',
|
||||
filterEmptyText: '필터 없음',
|
||||
emptyText: '데이터 없음',
|
||||
selectAll: '모두 선택',
|
||||
selectInvert: '선택 반전',
|
||||
},
|
||||
@ -51,9 +53,9 @@ const localeValues: Locale = {
|
||||
enum: '${label} [${enum}] 중에 하나여야 합니다',
|
||||
whitespace: '${label} 비워둘 수 없습니다',
|
||||
date: {
|
||||
format: '${label} 유효하지 않은 날짜 형식입니다.',
|
||||
format: '${label} 유효하지 않은 날짜 형식입니다',
|
||||
parse: '${label} 날짜 형식으로 변환될 수 없습니다',
|
||||
invalid: '${label} 휴효하지 않은 날짜입니다',
|
||||
invalid: '${label} 유효하지 않은 날짜입니다',
|
||||
},
|
||||
types: {
|
||||
string: typeTemplate,
|
||||
@ -77,15 +79,15 @@ const localeValues: Locale = {
|
||||
range: '${label} ${min}-${max}글자 사이어야 합니다',
|
||||
},
|
||||
number: {
|
||||
len: '${label} 값은 ${len} 이어야 합니다',
|
||||
min: '${label} 최솟값은 ${min} 입니다',
|
||||
max: '${label} 최댓값은 ${max} 입니다',
|
||||
len: '${label} 값은 ${len}이어야 합니다',
|
||||
min: '${label} 최솟값은 ${min}입니다',
|
||||
max: '${label} 최댓값은 ${max}입니다',
|
||||
range: '${label} 값은 ${min}-${max} 사이어야 합니다',
|
||||
},
|
||||
array: {
|
||||
len: '${len} 이어야 합니다 ${label} ',
|
||||
min: '최소 ${min} 이어야 합니다 ${label}',
|
||||
max: '최대 ${max} 이어야 합니다 ${label}',
|
||||
len: '${len}이어야 합니다 ${label} ',
|
||||
min: '최소 ${min}이어야 합니다 ${label}',
|
||||
max: '최대 ${max}이어야 합니다 ${label}',
|
||||
range: '${label} ${min}-${max} 사이어야 합니다',
|
||||
},
|
||||
pattern: {
|
||||
|
@ -118,6 +118,23 @@ describe('Menu', () => {
|
||||
expect(wrapper.find('.ant-menu-submenu-selected').length).toBe(1);
|
||||
});
|
||||
|
||||
it('forceSubMenuRender', () => {
|
||||
const wrapper = mount(
|
||||
<Menu mode="horizontal">
|
||||
<SubMenu key="1" title="submenu1">
|
||||
<Menu.Item key="1-1">
|
||||
<span className="bamboo" />
|
||||
</Menu.Item>
|
||||
</SubMenu>
|
||||
</Menu>,
|
||||
);
|
||||
|
||||
expect(wrapper.find('.bamboo').hostNodes()).toHaveLength(0);
|
||||
|
||||
wrapper.setProps({ forceSubMenuRender: true });
|
||||
expect(wrapper.find('.bamboo').hostNodes()).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('should accept defaultOpenKeys in mode horizontal', () => {
|
||||
const wrapper = mount(
|
||||
<Menu defaultOpenKeys={['1']} mode="horizontal">
|
||||
|
@ -460,7 +460,9 @@
|
||||
}
|
||||
|
||||
&-inline-collapsed {
|
||||
width: @menu-collapsed-width;
|
||||
&:not(.@{ant-prefix}-layout-sider-children > ul) {
|
||||
width: @menu-collapsed-width;
|
||||
}
|
||||
> .@{menu-prefix-cls}-item,
|
||||
> .@{menu-prefix-cls}-item-group
|
||||
> .@{menu-prefix-cls}-item-group-list
|
||||
|
@ -93,7 +93,7 @@
|
||||
@modal-footer-border-color-split;
|
||||
border-radius: 0 0 @border-radius-base @border-radius-base;
|
||||
|
||||
.@{ant-prefix}-btn + .@{ant-prefix}-btn {
|
||||
.@{ant-prefix}-btn + .@{ant-prefix}-btn:not(.@{ant-prefix}-dropdown-trigger) {
|
||||
margin-bottom: 0;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@
|
||||
position: absolute;
|
||||
top: ((@radio-size - @radio-dot-size) / 2) - @radio-border-width;
|
||||
left: ((@radio-size - @radio-dot-size) / 2) - @radio-border-width;
|
||||
display: table;
|
||||
display: block;
|
||||
width: @radio-dot-size;
|
||||
height: @radio-dot-size;
|
||||
background-color: @radio-dot-color;
|
||||
|
@ -90,6 +90,68 @@ Array [
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`Space should render width rtl 1`] = `
|
||||
Array [
|
||||
<div
|
||||
class="ant-space ant-space-horizontal ant-space-rtl ant-space-align-center"
|
||||
>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
style="margin-left:8px"
|
||||
>
|
||||
<span>
|
||||
1
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
>
|
||||
<span>
|
||||
2
|
||||
</span>
|
||||
</div>
|
||||
</div>,
|
||||
<div
|
||||
class="ant-space ant-space-horizontal ant-space-rtl ant-space-align-center"
|
||||
>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
style="margin-left:16px"
|
||||
>
|
||||
<span>
|
||||
1
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
>
|
||||
<span>
|
||||
2
|
||||
</span>
|
||||
</div>
|
||||
</div>,
|
||||
<div
|
||||
class="ant-space ant-space-horizontal ant-space-rtl ant-space-align-center"
|
||||
>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
style="margin-left:24px"
|
||||
>
|
||||
<span>
|
||||
1
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
>
|
||||
<span>
|
||||
2
|
||||
</span>
|
||||
</div>
|
||||
</div>,
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`Space split 1`] = `
|
||||
<div
|
||||
class="ant-space ant-space-horizontal ant-space-align-center"
|
||||
|
@ -37,6 +37,27 @@ describe('Space', () => {
|
||||
expect(render(wrapper)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should render width rtl', () => {
|
||||
const wrapper = mount(
|
||||
<ConfigProvider direction="rtl">
|
||||
<Space>
|
||||
<span>1</span>
|
||||
<span>2</span>
|
||||
</Space>
|
||||
<Space size="middle">
|
||||
<span>1</span>
|
||||
<span>2</span>
|
||||
</Space>
|
||||
<Space size="large">
|
||||
<span>1</span>
|
||||
<span>2</span>
|
||||
</Space>
|
||||
</ConfigProvider>,
|
||||
);
|
||||
|
||||
expect(render(wrapper)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should render width customize size', () => {
|
||||
const wrapper = mount(
|
||||
<Space size={10}>
|
||||
|
@ -462,7 +462,7 @@
|
||||
|
||||
// Anchor
|
||||
// ---
|
||||
@anchor-bg: @component-background;
|
||||
@anchor-bg: transparent;
|
||||
@anchor-border-color: @border-color-split;
|
||||
@anchor-link-top: 7px;
|
||||
@anchor-link-left: 16px;
|
||||
|
@ -54,7 +54,7 @@ function VirtualTable(props: Parameters<typeof Table>[0]) {
|
||||
const resetVirtualGrid = () => {
|
||||
gridRef.current.resetAfterIndices({
|
||||
columnIndex: 0,
|
||||
shouldForceUpdate: false,
|
||||
shouldForceUpdate: true,
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -362,10 +362,14 @@
|
||||
}
|
||||
|
||||
// ========================== Selections ==========================
|
||||
.@{table-prefix-cls}-selection-col {
|
||||
&-selection-col {
|
||||
width: @table-selection-column-width;
|
||||
}
|
||||
|
||||
&-bordered &-selection-col {
|
||||
width: @table-selection-column-width + 18px;
|
||||
}
|
||||
|
||||
table tr th&-selection-column,
|
||||
table tr td&-selection-column {
|
||||
padding-right: @padding-xs;
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { TimePickerLocale } from '../index';
|
||||
|
||||
const locale: TimePickerLocale = {
|
||||
placeholder: '時刻を選択',
|
||||
placeholder: '時間を選択',
|
||||
rangePlaceholder: ['開始時間', '終了時間'],
|
||||
};
|
||||
|
||||
export default locale;
|
||||
|
@ -2,6 +2,7 @@ import { TimePickerLocale } from '../index';
|
||||
|
||||
const locale: TimePickerLocale = {
|
||||
placeholder: '시간 선택',
|
||||
rangePlaceholder: ['시작 시간', '종료 시간'],
|
||||
};
|
||||
|
||||
export default locale;
|
||||
|
@ -195,7 +195,8 @@ class Base extends React.Component<InternalBlockProps, BaseState> {
|
||||
};
|
||||
|
||||
// ================ Edit ================
|
||||
onEditClick = () => {
|
||||
onEditClick = (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
e.preventDefault();
|
||||
this.triggerEdit(true);
|
||||
};
|
||||
|
||||
|
@ -6,7 +6,7 @@ import PaperClipOutlined from '@ant-design/icons/PaperClipOutlined';
|
||||
import PictureTwoTone from '@ant-design/icons/PictureTwoTone';
|
||||
import FileTwoTone from '@ant-design/icons/FileTwoTone';
|
||||
import { cloneElement, isValidElement } from '../../_util/reactNode';
|
||||
import { UploadListProps, UploadFile, UploadListType } from '../interface';
|
||||
import { UploadListProps, UploadFile, UploadListType, InternalUploadFile } from '../interface';
|
||||
import { previewImage, isImageUrl } from '../utils';
|
||||
import collapseMotion from '../../_util/motion';
|
||||
import { ConfigContext } from '../../config-provider';
|
||||
@ -53,7 +53,7 @@ const InternalUploadList: React.ForwardRefRenderFunction<unknown, UploadListProp
|
||||
if (listType !== 'picture' && listType !== 'picture-card') {
|
||||
return;
|
||||
}
|
||||
(items || []).forEach(file => {
|
||||
(items || []).forEach((file: InternalUploadFile) => {
|
||||
if (
|
||||
typeof document === 'undefined' ||
|
||||
typeof window === 'undefined' ||
|
||||
|
@ -32,13 +32,28 @@ describe('Upload.typescript', () => {
|
||||
const upload = (
|
||||
<Upload
|
||||
beforeUpload={file => {
|
||||
if (file.type === 'image/png') {
|
||||
const { name: returnType } = file;
|
||||
if (returnType === 'boolean') {
|
||||
return true;
|
||||
}
|
||||
if (file.type === 'image/webp') {
|
||||
if (returnType === 'Promise<boolean>') {
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
if (returnType === 'file') {
|
||||
return file;
|
||||
}
|
||||
if (returnType === 'Promise<file>') {
|
||||
return Promise.resolve(file);
|
||||
}
|
||||
return Upload.LIST_IGNORE;
|
||||
if (returnType === 'string') {
|
||||
return Upload.LIST_IGNORE;
|
||||
}
|
||||
if (returnType === 'Promise<string>') {
|
||||
return Promise.resolve(Upload.LIST_IGNORE);
|
||||
}
|
||||
if (returnType === 'Promise<void>') {
|
||||
return Promise.resolve();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<span>click to upload</span>
|
||||
@ -46,4 +61,49 @@ describe('Upload.typescript', () => {
|
||||
);
|
||||
expect(upload).toBeTruthy();
|
||||
});
|
||||
|
||||
it('beforeUpload async', () => {
|
||||
const upload = (
|
||||
<Upload
|
||||
beforeUpload={async file => {
|
||||
const { name: returnType } = file;
|
||||
if (returnType === 'boolean') {
|
||||
return true;
|
||||
}
|
||||
if (returnType === 'file') {
|
||||
return file;
|
||||
}
|
||||
if (returnType === 'string') {
|
||||
return Upload.LIST_IGNORE;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<span>click to upload</span>
|
||||
</Upload>
|
||||
);
|
||||
expect(upload).toBeTruthy();
|
||||
});
|
||||
|
||||
it('defaultFileList/fileList', () => {
|
||||
const fileList = [
|
||||
{
|
||||
uid: '-1',
|
||||
name: 'xxx.png',
|
||||
status: 'done' as const,
|
||||
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
|
||||
thumbUrl: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
|
||||
},
|
||||
{
|
||||
uid: '-2',
|
||||
name: 'yyy.png',
|
||||
status: 'error' as const,
|
||||
},
|
||||
];
|
||||
const upload = (
|
||||
<Upload fileList={fileList} defaultFileList={fileList}>
|
||||
<span>click to upload</span>
|
||||
</Upload>
|
||||
);
|
||||
expect(upload).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
@ -9,13 +9,13 @@ title:
|
||||
|
||||
点击上传用户头像,并使用 `beforeUpload` 限制用户上传的图片格式和大小。
|
||||
|
||||
> `beforeUpload` 的返回值可以是一个 Promise 以支持异步处理,如服务端校验等:[示例](http://react-component.github.io/upload/examples/beforeUpload.html)。
|
||||
> `beforeUpload` 的返回值可以是一个 Promise 以支持异步处理,如服务端校验等:[示例](https://upload-react-component.vercel.app/demo/before-upload#beforeupload)。
|
||||
|
||||
## en-US
|
||||
|
||||
Click to upload user's avatar, and validate size and format of picture with `beforeUpload`.
|
||||
|
||||
> The return value of function `beforeUpload` can be a Promise to check asynchronously. [demo](http://react-component.github.io/upload/examples/beforeUpload.html)
|
||||
> The return value of function `beforeUpload` can be a Promise to check asynchronously. [demo](https://upload-react-component.vercel.app/demo/before-upload#beforeupload)
|
||||
|
||||
```jsx
|
||||
import { Upload, message } from 'antd';
|
||||
|
@ -17,7 +17,7 @@ export interface HttpRequestHeader {
|
||||
|
||||
export interface UploadFile<T = any> {
|
||||
uid: string;
|
||||
size: number;
|
||||
size?: number;
|
||||
name: string;
|
||||
fileName?: string;
|
||||
lastModified?: number;
|
||||
@ -26,15 +26,19 @@ export interface UploadFile<T = any> {
|
||||
status?: UploadFileStatus;
|
||||
percent?: number;
|
||||
thumbUrl?: string;
|
||||
originFileObj: RcFile;
|
||||
originFileObj?: RcFile;
|
||||
response?: T;
|
||||
error?: any;
|
||||
linkProps?: any;
|
||||
type: string;
|
||||
type?: string;
|
||||
xhr?: T;
|
||||
preview?: string;
|
||||
}
|
||||
|
||||
export interface InternalUploadFile<T = any> extends UploadFile<T> {
|
||||
originFileObj: RcFile;
|
||||
}
|
||||
|
||||
export interface UploadChangeParam<T extends object = UploadFile> {
|
||||
// https://github.com/ant-design/ant-design/issues/14420
|
||||
file: T;
|
||||
@ -72,6 +76,7 @@ type PreviewFileHandler = (file: File | Blob) => PromiseLike<string>;
|
||||
type TransformFileHandler = (
|
||||
file: RcFile,
|
||||
) => string | Blob | File | PromiseLike<string | Blob | File>;
|
||||
type BeforeUploadValueType = void | boolean | string | Blob | File;
|
||||
|
||||
export interface UploadProps<T = any> {
|
||||
type?: UploadType;
|
||||
@ -89,7 +94,7 @@ export interface UploadProps<T = any> {
|
||||
beforeUpload?: (
|
||||
file: RcFile,
|
||||
FileList: RcFile[],
|
||||
) => boolean | string | Promise<void | Blob | File>;
|
||||
) => BeforeUploadValueType | Promise<BeforeUploadValueType>;
|
||||
onChange?: (info: UploadChangeParam) => void;
|
||||
onDrop?: (event: React.DragEvent<HTMLDivElement>) => void;
|
||||
listType?: UploadListType;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { RcFile, UploadFile } from './interface';
|
||||
import { RcFile, UploadFile, InternalUploadFile } from './interface';
|
||||
|
||||
export function file2Obj(file: RcFile): UploadFile {
|
||||
export function file2Obj(file: RcFile): InternalUploadFile {
|
||||
return {
|
||||
...file,
|
||||
lastModified: file.lastModified,
|
||||
|
12
package.json
12
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "antd",
|
||||
"version": "4.15.3-alpha.0",
|
||||
"version": "4.15.4",
|
||||
"description": "An enterprise-class UI design language and React components implementation",
|
||||
"title": "Ant Design",
|
||||
"keywords": [
|
||||
@ -124,7 +124,7 @@
|
||||
"rc-dropdown": "~3.2.0",
|
||||
"rc-field-form": "~1.20.0",
|
||||
"rc-image": "~5.2.4",
|
||||
"rc-input-number": "~7.0.1",
|
||||
"rc-input-number": "~7.1.0",
|
||||
"rc-mentions": "~1.5.0",
|
||||
"rc-menu": "~8.10.0",
|
||||
"rc-motion": "^2.4.0",
|
||||
@ -179,7 +179,7 @@
|
||||
"argos-cli": "^0.3.0",
|
||||
"array-move": "^3.0.0",
|
||||
"babel-plugin-add-react-displayname": "^0.0.5",
|
||||
"bisheng": "^3.0.0",
|
||||
"bisheng": "^3.1.0-beta.1",
|
||||
"bisheng-plugin-description": "^0.1.4",
|
||||
"bisheng-plugin-react": "^1.1.2",
|
||||
"bisheng-plugin-toc": "^0.4.4",
|
||||
@ -188,7 +188,7 @@
|
||||
"cheerio": "^1.0.0-rc.3",
|
||||
"concurrently": "^6.0.0",
|
||||
"cross-env": "^7.0.0",
|
||||
"css-minimizer-webpack-plugin": "^1.1.1",
|
||||
"css-minimizer-webpack-plugin": "^2.0.0",
|
||||
"css-split-webpack-plugin": "^0.2.6",
|
||||
"dekko": "^0.2.1",
|
||||
"docsearch.js": "^2.6.3",
|
||||
@ -207,7 +207,7 @@
|
||||
"eslint-plugin-markdown": "^2.0.0",
|
||||
"eslint-plugin-react": "^7.20.6",
|
||||
"eslint-plugin-react-hooks": "^4.1.2",
|
||||
"eslint-plugin-unicorn": "^30.0.0",
|
||||
"eslint-plugin-unicorn": "^31.0.0",
|
||||
"fetch-jsonp": "^1.1.3",
|
||||
"fs-extra": "^9.0.0",
|
||||
"full-icu": "^1.3.0",
|
||||
@ -272,7 +272,7 @@
|
||||
"stylelint": "^13.0.0",
|
||||
"stylelint-config-prettier": "^8.0.0",
|
||||
"stylelint-config-rational-order": "^0.1.2",
|
||||
"stylelint-config-standard": "^21.0.0",
|
||||
"stylelint-config-standard": "^22.0.0",
|
||||
"stylelint-declaration-block-no-ignored-properties": "^2.1.0",
|
||||
"stylelint-order": "^4.0.0",
|
||||
"theme-switcher": "^1.0.2",
|
||||
|
Loading…
Reference in New Issue
Block a user