Skip to content

fix(upload): fix locale ts type #3629

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

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/upload/themes/custom-file.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export default defineComponent({

setup(props) {
const { accept } = toRefs(props);

const drag = useDrag(props.dragEvents, accept);
const { dragActive } = drag;

Expand Down
4 changes: 3 additions & 1 deletion src/upload/themes/dragger-file.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import useGlobalIcon from '../../hooks/useGlobalIcon';
import ImageViewer from '../../image-viewer';
import { renderTNodeJSX } from '../../utils/render-tnode';
import Image from '../../image';
import { UploadConfig } from '../../config-provider';

export interface DraggerProps extends CommonDisplayFileProps {
trigger?: TdUploadProps['trigger'];
Expand All @@ -41,7 +42,7 @@ export default defineComponent({

setup(props: DraggerProps) {
const { displayFiles, accept } = toRefs(props);

const locale = computed(() => props.locale as UploadConfig);
const { sizeClassNames } = useCommonClassName();
const uploadPrefix = `${props.classPrefix}-upload`;

Expand Down Expand Up @@ -69,6 +70,7 @@ export default defineComponent({
sizeClassNames,
uploadPrefix,
icons,
locale,
};
},

Expand Down
3 changes: 3 additions & 0 deletions src/upload/themes/image-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { abridgeName } from '../../_common/js/upload/utils';
import { renderTNodeJSX } from '../../utils/render-tnode';
import Link from '../../link';
import Image from '../../image';
import { UploadConfig } from '../../config-provider';

export interface ImageCardUploadProps extends CommonDisplayFileProps {
multiple: TdUploadProps['multiple'];
Expand Down Expand Up @@ -45,6 +46,7 @@ export default defineComponent({
},

setup(props: ImageCardUploadProps) {
const locale = computed(() => props.locale as UploadConfig);
const { displayFiles, multiple, max } = toRefs(props);
const icons = useGlobalIcon({
AddIcon: TdAddIcon,
Expand All @@ -63,6 +65,7 @@ export default defineComponent({
return {
icons,
showTrigger,
locale,
};
},

Expand Down
11 changes: 6 additions & 5 deletions src/upload/themes/multiple-flow-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import TLoading from '../../loading';
import Link from '../../link';
import { renderTNodeJSX } from '../../utils/render-tnode';
import Image from '../../image';
import { UploadConfig } from '../../config-provider';

export interface ImageFlowListProps extends CommonDisplayFileProps {
uploadFiles?: (toFiles?: UploadFile[]) => void;
Expand Down Expand Up @@ -69,9 +70,8 @@ export default defineComponent({

setup(props: ImageFlowListProps, context) {
// locale 已经在 useUpload 中统一处理优先级
const {
locale, uploading, classPrefix, accept,
} = toRefs(props);
const { uploading, classPrefix, accept } = toRefs(props);
const locale = computed(() => props.locale as UploadConfig);
const uploadPrefix = `${classPrefix.value}-upload`;

const icons = useGlobalIcon({
Expand Down Expand Up @@ -150,6 +150,7 @@ export default defineComponent({
browseIconClick,
closePreview,
previewIndexChange,
locale,
};
},

Expand Down Expand Up @@ -286,7 +287,7 @@ export default defineComponent({
renderBatchActionCol(index: number) {
// 第一行数据才需要合并单元格
return index === 0 ? (
<td rowSpan={this.displayFiles.length} class={`${this.uploadPrefix}__flow-table__batch-row`}>
<td rowspan={this.displayFiles.length} class={`${this.uploadPrefix}__flow-table__batch-row`}>
<TButton
theme="primary"
variant="text"
Expand Down Expand Up @@ -326,7 +327,7 @@ export default defineComponent({
<tbody>
{!this.displayFiles.length && (
<tr>
<td colSpan={4}>{this.renderEmpty()}</td>
<td colspan={4}>{this.renderEmpty()}</td>
</tr>
)}
{this.displayFiles.map((file, index) => {
Expand Down
4 changes: 3 additions & 1 deletion src/upload/themes/normal-file.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { abridgeName } from '../../_common/js/upload/utils';
import { useGlobalIcon } from '../../hooks/useGlobalIcon';
import { CommonDisplayFileProps } from '../interface';
import { commonProps } from '../constants';
import { UploadConfig } from '../../config-provider';

export interface NormalFileProps extends CommonDisplayFileProps {
multiple: boolean;
Expand All @@ -35,7 +36,7 @@ const NormalFile = defineComponent({
ErrorCircleFilledIcon: TdErrorCircleFilledIcon,
CloseCircleFilledIcon: TdCloseCircleFilledIcon,
});

const locale = computed(() => props.locale as UploadConfig);
const uploadPrefix = computed(() => `${props.classPrefix}-upload`);

const classes = computed(() => [`${uploadPrefix.value}__single`, `${uploadPrefix.value}__single-${props.theme}`]);
Expand All @@ -44,6 +45,7 @@ const NormalFile = defineComponent({
classes,
uploadPrefix,
icons,
locale,
};
},

Expand Down