Skip to content

Commit bac864f

Browse files
committed
doc: update table
1 parent 625efff commit bac864f

File tree

5 files changed

+19
-15
lines changed

5 files changed

+19
-15
lines changed

components/components.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export { default as Image, ImagePreviewGroup } from './image';
9090
export type { InputNumberProps } from './input-number';
9191
export { default as InputNumber } from './input-number';
9292

93-
export type { LayoutProps } from './layout';
93+
export type { LayoutProps, SiderProps } from './layout';
9494
export {
9595
default as Layout,
9696
LayoutHeader,

components/upload/Upload.tsx

+7-8
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { uploadProps } from './interface';
1313
import { file2Obj, getFileItem, removeFileItem, updateFileList } from './utils';
1414
import { useLocaleReceiver } from '../locale-provider/LocaleReceiver';
1515
import defaultLocale from '../locale/default';
16+
import type { CSSProperties } from 'vue';
1617
import { computed, defineComponent, onMounted, ref, toRef } from 'vue';
1718
import { flattenChildren, initDefaultProps } from '../_util/props-util';
1819
import useMergedState from '../_util/hooks/useMergedState';
@@ -295,7 +296,7 @@ export default defineComponent({
295296
defaultLocale.Upload,
296297
computed(() => props.locale),
297298
);
298-
const renderUploadList = (button?: VueNode) => {
299+
const renderUploadList = (button?: VueNode, buttonVisible?: boolean) => {
299300
const {
300301
removeIcon,
301302
previewIcon,
@@ -331,6 +332,7 @@ export default defineComponent({
331332
isImageUrl={isImageUrl}
332333
progress={progress}
333334
itemRender={itemRender}
335+
appendActionVisible={buttonVisible}
334336
v-slots={{ ...slots, appendAction: () => button }}
335337
/>
336338
) : (
@@ -403,25 +405,22 @@ export default defineComponent({
403405
[`${prefixCls.value}-rtl`]: direction.value === 'rtl',
404406
});
405407
const children = flattenChildren(slots.default?.());
406-
const uploadButton = (
407-
<div
408-
class={uploadButtonCls}
409-
style={children && children.length ? undefined : { display: 'none' }}
410-
>
408+
const renderUploadButton = (uploadButtonStyle?: CSSProperties) => (
409+
<div class={uploadButtonCls} style={uploadButtonStyle}>
411410
<VcUpload {...rcUploadProps} ref={upload} v-slots={slots} />
412411
</div>
413412
);
414413

415414
if (listType === 'picture-card') {
416415
return (
417416
<span class={classNames(`${prefixCls.value}-picture-card-wrapper`, attrs.class)}>
418-
{renderUploadList(uploadButton)}
417+
{renderUploadList(renderUploadButton(), !!(children && children.length))}
419418
</span>
420419
);
421420
}
422421
return (
423422
<span class={attrs.class}>
424-
{uploadButton}
423+
{renderUploadButton(children && children.length ? undefined : { display: 'none' })}
425424
{renderUploadList()}
426425
</span>
427426
);

components/upload/UploadList/index.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export default defineComponent({
3333
previewFile: previewImage,
3434
isImageUrl,
3535
items: [],
36+
appendActionVisible: true,
3637
}),
3738
setup(props, { slots, expose }) {
3839
const motionAppear = ref(false);
@@ -167,6 +168,7 @@ export default defineComponent({
167168
progress,
168169
appendAction = slots.appendAction,
169170
itemRender,
171+
appendActionVisible,
170172
} = props;
171173
const appendActionDom = appendAction?.()[0];
172174
return (
@@ -201,7 +203,7 @@ export default defineComponent({
201203
/>
202204
);
203205
})}
204-
{isValidElement(appendActionDom) ? (
206+
{appendActionVisible && isValidElement(appendActionDom) ? (
205207
<HackSlot key="__ant_upload_appendAction">{appendActionDom}</HackSlot>
206208
) : null}
207209
</TransitionGroup>

components/upload/index.en-US.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ When uploading state change, it returns:
105105

106106
## FAQ
107107

108-
### How to implement upload server side?
108+
### How do I implement upload server side?
109109

110110
- You can consult [jQuery-File-Upload](https://github.com/blueimp/jQuery-File-Upload/wiki#server-side) about how to implement server side upload interface.
111111
- There is a mock example of [express](https://github.com/react-component/upload/blob/master/server.js) in rc-upload.
@@ -118,10 +118,10 @@ Please set property `url` of each item in `fileList` to control content of link.
118118

119119
See <https://github.com/react-component/upload#customrequest>.
120120

121-
### Why `fileList` in control will not trigger `change` `status` update when file not in the list?
121+
### Why will the `fileList` that's in control not trigger `change` `status` update when the file is not in the list?
122122

123123
`change` only trigger when file in the list, it will ignore left events when removed from the list. Please note that there exist bug which makes event still trigger even the file is not in the list before `3.0.0-beta.10`.
124124

125-
### Why sometime `change` return File object and sometime return { originFileObj: File }?
125+
### Why does `change` sometimes return File object and other times return { originFileObj: File }?
126126

127127
For compatible case, we return File object when `beforeUpload` return `false`. It will merge to `{ originFileObj: File }` in next major version. Current version is compatible to get origin file by `info.file.originFileObj`. You can change this before major release.

components/upload/interface.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,10 @@ function uploadProps<T = any>() {
114114
FileList: FileType[],
115115
) => BeforeUploadValueType | Promise<BeforeUploadValueType>
116116
>,
117-
onChange: Function as PropType<(info: UploadChangeParam<T>) => void>,
118-
'onUpdate:fileList': Function as PropType<(fileList: UploadChangeParam<T>['fileList']) => void>,
117+
onChange: Function as PropType<(info: UploadChangeParam<UploadFile<T>>) => void>,
118+
'onUpdate:fileList': Function as PropType<
119+
(fileList: UploadChangeParam<UploadFile<T>>['fileList']) => void
120+
>,
119121
onDrop: Function as PropType<(event: DragEvent) => void>,
120122
listType: String as PropType<UploadListType>,
121123
onPreview: Function as PropType<(file: UploadFile<T>) => void>,
@@ -181,6 +183,7 @@ function uploadListProps<T = any>() {
181183
>,
182184
isImageUrl: Function as PropType<(file: UploadFile) => boolean>,
183185
appendAction: Function as PropType<() => VueNode>,
186+
appendActionVisible: { type: Boolean, default: undefined },
184187
itemRender: Function as PropType<ItemRender<T>>,
185188
};
186189
}

0 commit comments

Comments
 (0)