@alicloud/appflow-chat 0.0.4-alpha.11 → 0.0.4-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/appflow-chat.cjs.js +8 -8
- package/dist/appflow-chat.esm.js +2310 -2310
- package/package.json +1 -1
- package/src/components/ChatSender.tsx +28 -26
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React, { useState, useRef, useCallback, useMemo, useEffect } from 'react';
|
|
6
6
|
import { Sender, Attachments } from '@ant-design/x';
|
|
7
7
|
import type { AttachmentsProps } from '@ant-design/x';
|
|
8
|
-
import { Select, Switch, Button, Tooltip } from 'antd';
|
|
8
|
+
import { Select, Switch, Button, Tooltip, Spin } from 'antd';
|
|
9
9
|
import {
|
|
10
10
|
PaperClipOutlined,
|
|
11
11
|
PictureOutlined,
|
|
@@ -429,34 +429,36 @@ export const ChatSender: React.FC<ChatSenderProps> = ({
|
|
|
429
429
|
content: { padding: 4 },
|
|
430
430
|
}}
|
|
431
431
|
>
|
|
432
|
-
<
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
}}
|
|
442
|
-
onRemove={(file) => {
|
|
443
|
-
setAttachments(prev => {
|
|
444
|
-
const updated = prev.filter(a => a.uid !== file.uid);
|
|
445
|
-
if (updated.length === 0) {
|
|
446
|
-
setHeaderOpen(false);
|
|
432
|
+
<Spin spinning={isUploading} tip="文件上传中,请稍候...">
|
|
433
|
+
<Attachments
|
|
434
|
+
ref={attachmentsRef as any}
|
|
435
|
+
items={attachmentItems as AttachmentsProps['items']}
|
|
436
|
+
accept={acceptTypes}
|
|
437
|
+
multiple
|
|
438
|
+
customRequest={({ file }) => {
|
|
439
|
+
if (file instanceof File) {
|
|
440
|
+
handleFileUpload(file);
|
|
447
441
|
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
442
|
+
}}
|
|
443
|
+
onRemove={(file) => {
|
|
444
|
+
setAttachments(prev => {
|
|
445
|
+
const updated = prev.filter(a => a.uid !== file.uid);
|
|
446
|
+
if (updated.length === 0) {
|
|
447
|
+
setHeaderOpen(false);
|
|
448
|
+
}
|
|
449
|
+
return updated;
|
|
450
|
+
});
|
|
451
|
+
}}
|
|
452
|
+
placeholder={{
|
|
453
|
+
icon: <CloudUploadOutlined />,
|
|
454
|
+
title: '拖拽文件到此处',
|
|
455
|
+
description: '支持图片和文件',
|
|
456
|
+
}}
|
|
457
|
+
/>
|
|
458
|
+
</Spin>
|
|
457
459
|
</Sender.Header>
|
|
458
460
|
);
|
|
459
|
-
}, [hasUploadCapability, headerOpen, attachmentItems]);
|
|
461
|
+
}, [hasUploadCapability, headerOpen, attachmentItems, isUploading]);
|
|
460
462
|
|
|
461
463
|
// ==================== 触发文件选择 ====================
|
|
462
464
|
|