From 2e8c14e0d64ca67c8dcc6b8c11dc65fc8d7b3d1d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=A2=AB=E9=9B=A8=E6=B0=B4=E8=BF=87=E6=BB=A4=E7=9A=84?=
=?UTF-8?q?=E7=A9=BA=E6=B0=94-Rairn?= <958414905@qq.com>
Date: Sat, 8 Jul 2023 14:49:26 +0800
Subject: [PATCH] fix(upload): fix style of attachement in Table (#2213)
* fix(upload): fix style of attachement in Table
* fix: make test pass
---
.../antd/upload/ReadPretty.tsx | 8 +-
.../__snapshots__/upload.test.tsx.snap | 808 ------------------
.../antd/upload/__tests__/upload.test.tsx | 6 +-
.../src/schema-component/antd/upload/style.ts | 16 +
4 files changed, 24 insertions(+), 814 deletions(-)
delete mode 100644 packages/core/client/src/schema-component/antd/upload/__tests__/__snapshots__/upload.test.tsx.snap
diff --git a/packages/core/client/src/schema-component/antd/upload/ReadPretty.tsx b/packages/core/client/src/schema-component/antd/upload/ReadPretty.tsx
index 1e6823ace..a2669e67e 100644
--- a/packages/core/client/src/schema-component/antd/upload/ReadPretty.tsx
+++ b/packages/core/client/src/schema-component/antd/upload/ReadPretty.tsx
@@ -3,6 +3,7 @@ import { Field } from '@formily/core';
import { useField } from '@formily/react';
import { isString } from '@nocobase/utils/client';
import { Button, Modal, Space } from 'antd';
+import useUploadStyle from 'antd/es/upload/style';
import cls from 'classnames';
import { saveAs } from 'file-saver';
import React, { useState } from 'react';
@@ -31,6 +32,8 @@ ReadPretty.File = function File(props: UploadProps) {
const [fileType, setFileType] = useState<'image' | 'pdf'>();
const { size } = props;
const { wrapSSR, hashId, componentCls: prefixCls } = useStyles();
+ // 加载 antd 的样式
+ useUploadStyle(prefixCls);
function closeIFrameModal() {
setVisible(false);
@@ -43,7 +46,7 @@ ReadPretty.File = function File(props: UploadProps) {
`${prefixCls}-wrapper`,
`${prefixCls}-picture-card-wrapper`,
`nb-upload`,
- size ? `${prefixCls}-${size}` : null,
+ size ? `nb-upload-${size}` : null,
hashId,
)}
>
@@ -174,6 +177,7 @@ ReadPretty.File = function File(props: UploadProps) {
onCancel={closeIFrameModal}
footer={[
,
-