@mxmweb/aichat 2.1.2 → 2.1.6
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/components/AiChat.d.ts +7 -1
- package/i18n/context.d.ts +20 -0
- package/i18n/index.d.ts +3 -0
- package/i18n/messages.d.ts +17 -0
- package/i18n/types.d.ts +53 -0
- package/index.js +10437 -10167
- package/lib_enter.d.ts +3 -1
- package/package.json +1 -1
- package/stats.html +1 -1
- package/utils/fileIcon.d.ts +2 -2
- package/utils/fileUploadValidator.d.ts +11 -1
package/utils/fileIcon.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { default as React } from 'react';
|
|
|
3
3
|
* 文件类型图标获取函数
|
|
4
4
|
* 优先使用用户传入的 styles.theme.icons,如果没有配置则使用 zui-icon 的默认图标
|
|
5
5
|
* 支持两种形式的自定义图标:
|
|
6
|
-
* 1. React 组件形式:<Icon type="
|
|
6
|
+
* 1. React 组件形式:<Icon type="rag/pdf" size={18} />
|
|
7
7
|
* 2. 图片路径形式:字符串 URL
|
|
8
|
-
* 默认图标使用
|
|
8
|
+
* 默认图标使用 rag/xxx 格式的图标系统
|
|
9
9
|
* @param type 文件类型(如 'pdf', 'docx', 'jpg' 等)
|
|
10
10
|
* @param styles 样式配置对象,可包含 theme.icons 自定义图标
|
|
11
11
|
* @returns React.ReactNode 图标组件
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FilePreview } from '../components/AiChat.types';
|
|
2
|
+
import { AIChatLocale } from '../i18n';
|
|
2
3
|
/**
|
|
3
4
|
* 文件上传验证结果
|
|
4
5
|
*/
|
|
@@ -7,11 +8,20 @@ export interface FileValidationResult {
|
|
|
7
8
|
rejectedFiles: File[];
|
|
8
9
|
errors: string[];
|
|
9
10
|
}
|
|
11
|
+
export type ValidationMessageKey = 'fileCountExceeded' | 'fileTypeNotAllowed' | 'totalSizeExceeded' | 'totalSizeExceededWithExisting';
|
|
12
|
+
/**
|
|
13
|
+
* 校验选项:传入 locale 使用内置三语文案,或传入 getValidationMessage 自定义
|
|
14
|
+
*/
|
|
15
|
+
export interface ValidateFileUploadOptions {
|
|
16
|
+
locale?: AIChatLocale;
|
|
17
|
+
getValidationMessage?: (key: ValidationMessageKey, params: Record<string, string | number>) => string;
|
|
18
|
+
}
|
|
10
19
|
/**
|
|
11
20
|
* 验证文件上传
|
|
12
21
|
* @param newFiles 新上传的文件列表
|
|
13
22
|
* @param existingFiles 已存在的文件列表
|
|
14
23
|
* @param config 上传配置
|
|
24
|
+
* @param options 可选,locale 或 getValidationMessage 用于 i18n 错误文案
|
|
15
25
|
* @returns 验证结果
|
|
16
26
|
*/
|
|
17
27
|
export declare function validateFileUpload(newFiles: File[], existingFiles: FilePreview[], config?: {
|
|
@@ -19,7 +29,7 @@ export declare function validateFileUpload(newFiles: File[], existingFiles: File
|
|
|
19
29
|
upload_number_limit?: number;
|
|
20
30
|
upload_file_type_limit?: string[];
|
|
21
31
|
upload_limit_message?: string;
|
|
22
|
-
}): FileValidationResult;
|
|
32
|
+
}, options?: ValidateFileUploadOptions): FileValidationResult;
|
|
23
33
|
/**
|
|
24
34
|
* 显示文件验证错误提示
|
|
25
35
|
* @param result 验证结果
|