Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fat(upload): uploader trigger context add disabled #3321

Merged
merged 10 commits into from
Sep 24, 2024
1 change: 1 addition & 0 deletions src/upload/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ export type SizeUnit = SizeUnitArray[number];

export interface TriggerContext {
dragActive?: boolean;
disabled?: boolean;
files: UploadFile[];
}

Expand Down
2 changes: 1 addition & 1 deletion src/upload/upload.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ sizeLimit | Number / Object | - | files size limit。Typescript:`number \| Siz
status | String | - | tips status。options: default/success/warning/error | N
theme | String | file | different upload UI styles。options: custom/file/file-input/file-flow/image/image-flow | N
tips | String / Slot / Function | - | tips text below upload component, define it's color with `status`。Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
trigger | Slot / Function | - | trigger elements UI。Typescript:`TNode<TriggerContext>` `interface TriggerContext { dragActive?: boolean; files: UploadFile[] }`。[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts)。[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/upload/type.ts) | N
trigger | Slot / Function | - | trigger elements UI。Typescript:`TNode<TriggerContext>` `interface TriggerContext { dragActive?: boolean; disabled?: boolean; files: UploadFile[] }`。[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts)。[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/upload/type.ts) | N
triggerButtonProps | Object | - | trigger button props, it can be used to change color/size/href/... of the trigger button。Typescript:`ButtonProps`,[Button API Documents](./button?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/upload/type.ts) | N
uploadAllFilesInOneRequest | Boolean | false | uploading all files in one request | N
uploadButton | Object / Slot / Function | - | upload button props, which showed on `autoUpload=false` and multiple files/images upload。Typescript:`null \| ButtonProps \| TNode<{ disabled: boolean; uploading: boolean; uploadFiles: () => void; uploadText: string }>`。[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
Expand Down
2 changes: 1 addition & 1 deletion src/upload/upload.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ sizeLimit | Number / Object | - | 图片文件大小限制,默认单位 KB。
status | String | - | 文件上传提示文本状态。可选项:default/success/warning/error | N
theme | String | file | 组件风格。custom 表示完全自定义风格;file 表示默认文件上传风格;file-input 表示输入框形式的文件上传;file-flow 表示文件批量上传;image 表示默认图片上传风格;image-flow 表示图片批量上传。可选项:custom/file/file-input/file-flow/image/image-flow | N
tips | String / Slot / Function | - | 组件下方文本提示,可以使用 `status` 定义文本。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
trigger | Slot / Function | - | 触发上传的元素,`files` 指本次显示的全部文件。TS 类型:`TNode<TriggerContext>` `interface TriggerContext { dragActive?: boolean; files: UploadFile[] }`。[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts)。[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/upload/type.ts) | N
trigger | Slot / Function | - | 触发上传的元素,`files` 指本次显示的全部文件。TS 类型:`TNode<TriggerContext>` `interface TriggerContext { dragActive?: boolean; disabled?: boolean; files: UploadFile[] }`。[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts)。[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/upload/type.ts) | N
triggerButtonProps | Object | - | 透传选择按钮全部属性。TS 类型:`ButtonProps`,[Button API Documents](./button?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/upload/type.ts) | N
uploadAllFilesInOneRequest | Boolean | false | 是否在同一个请求中上传全部文件,默认一个请求上传一个文件。多文件上传时有效 | N
uploadButton | Object / Slot / Function | - | 批量文件/图片上传,`autoUpload=false` 场景下,透传“点击上传”按钮属性。TS 类型:`null \| ButtonProps \| TNode<{ disabled: boolean; uploading: boolean; uploadFiles: () => void; uploadText: string }>`。[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
Expand Down
6 changes: 5 additions & 1 deletion src/upload/upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ export default defineComponent({
};
return (
renderContent(this, 'default', 'trigger', {
params: { dragActive: false, files: this.uploadValue },
params: {
dragActive: false,
files: this.uploadValue,
disabled: this.tDisabled,
},
}) || getDefaultTrigger()
);
},
Expand Down
Loading