@hkyhy/marsun-components-core 0.1.2 → 0.1.5
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/README.md +11 -7
- package/dist/components/AgentHub/AgentHubAccessGuard.d.ts +11 -0
- package/dist/components/AgentHub/AgentHubIndexRedirect.d.ts +8 -0
- package/dist/components/AgentHub/Chat/Action/CreateButton.d.ts +6 -0
- package/dist/components/AgentHub/Chat/Action/ManageActionButtons.d.ts +6 -0
- package/dist/components/AgentHub/Chat/Action/SessionActionButtons.d.ts +8 -0
- package/dist/components/AgentHub/Chat/Action/handlers.d.ts +11 -0
- package/dist/components/AgentHub/Chat/Action/index.d.ts +7 -0
- package/dist/components/AgentHub/Chat/Detail/ChatInput/index.d.ts +11 -0
- package/dist/components/AgentHub/Chat/Detail/CitationContent/index.d.ts +6 -0
- package/dist/components/AgentHub/Chat/Detail/CitationInlineBadge/index.d.ts +7 -0
- package/dist/components/AgentHub/Chat/Detail/CitationMarkdownContent/index.d.ts +12 -0
- package/dist/components/AgentHub/Chat/Detail/CitationPanel/index.d.ts +9 -0
- package/dist/components/AgentHub/Chat/Detail/MermaidBlock/index.d.ts +7 -0
- package/dist/components/AgentHub/Chat/Detail/MessageActions/index.d.ts +33 -0
- package/dist/components/AgentHub/Chat/Detail/MessageEditPopover/index.d.ts +13 -0
- package/dist/components/AgentHub/Chat/Detail/MessageItem/index.d.ts +14 -0
- package/dist/components/AgentHub/Chat/Detail/ThinkingSection/index.d.ts +13 -0
- package/dist/components/AgentHub/Chat/Detail/index.d.ts +12 -0
- package/dist/components/AgentHub/Chat/Form/Form.d.ts +16 -0
- package/dist/components/AgentHub/Chat/Form/index.d.ts +2 -0
- package/dist/components/AgentHub/Chat/List/ChatCard/index.d.ts +11 -0
- package/dist/components/AgentHub/Chat/List/FilterBar.d.ts +7 -0
- package/dist/components/AgentHub/Chat/List/SessionSidebar/index.d.ts +15 -0
- package/dist/components/AgentHub/Chat/List/index.d.ts +6 -0
- package/dist/components/AgentHub/Chat/Modal/FormModal.d.ts +12 -0
- package/dist/components/AgentHub/Chat/Modal/index.d.ts +2 -0
- package/dist/components/AgentHub/Chat/constants/index.d.ts +1 -0
- package/dist/components/AgentHub/Chat/constants/types.d.ts +2 -0
- package/dist/components/AgentHub/Chat/hooks/index.d.ts +5 -0
- package/dist/components/AgentHub/Chat/hooks/useAutoScrollToBottom.d.ts +21 -0
- package/dist/components/AgentHub/Chat/hooks/useChat.d.ts +19 -0
- package/dist/components/AgentHub/Chat/hooks/useChatSessions.d.ts +20 -0
- package/dist/components/AgentHub/Chat/hooks/useSSECompletion.d.ts +13 -0
- package/dist/components/AgentHub/Chat/hooks/useTypewriter.d.ts +16 -0
- package/dist/components/AgentHub/Chat/index.d.ts +7 -0
- package/dist/components/AgentHub/Chat/utils/citationContent.d.ts +37 -0
- package/dist/components/AgentHub/Chat/utils/index.d.ts +5 -0
- package/dist/components/AgentHub/Chat/utils/messageContent.d.ts +18 -0
- package/dist/components/AgentHub/Chat/utils/sanitizeMermaidChart.d.ts +7 -0
- package/dist/components/AgentHub/Chat/utils/sessionMessages.d.ts +21 -0
- package/dist/components/AgentHub/Chat/utils/smoothScroll.d.ts +14 -0
- package/dist/components/AgentHub/ChatSessionAccessGuard.d.ts +8 -0
- package/dist/components/AgentHub/KnowledgeBase/Action/CreateButton.d.ts +6 -0
- package/dist/components/AgentHub/KnowledgeBase/Action/ManageActionButtons.d.ts +6 -0
- package/dist/components/AgentHub/KnowledgeBase/Action/handlers.d.ts +5 -0
- package/dist/components/AgentHub/KnowledgeBase/Action/index.d.ts +5 -0
- package/dist/components/AgentHub/KnowledgeBase/Detail/DocumentTable/index.d.ts +16 -0
- package/dist/components/AgentHub/KnowledgeBase/Detail/ParseStatusTag/index.d.ts +6 -0
- package/dist/components/AgentHub/KnowledgeBase/Detail/index.d.ts +4 -0
- package/dist/components/AgentHub/KnowledgeBase/Form/Form.d.ts +13 -0
- package/dist/components/AgentHub/KnowledgeBase/Form/index.d.ts +2 -0
- package/dist/components/AgentHub/KnowledgeBase/List/FilterBar.d.ts +7 -0
- package/dist/components/AgentHub/KnowledgeBase/List/KnowledgeCard/index.d.ts +11 -0
- package/dist/components/AgentHub/KnowledgeBase/List/index.d.ts +4 -0
- package/dist/components/AgentHub/KnowledgeBase/Modal/FormModal.d.ts +11 -0
- package/dist/components/AgentHub/KnowledgeBase/Modal/index.d.ts +2 -0
- package/dist/components/AgentHub/KnowledgeBase/constants/index.d.ts +1 -0
- package/dist/components/AgentHub/KnowledgeBase/constants/types.d.ts +16 -0
- package/dist/components/AgentHub/KnowledgeBase/hooks/index.d.ts +2 -0
- package/dist/components/AgentHub/KnowledgeBase/hooks/useKBDocuments.d.ts +10 -0
- package/dist/components/AgentHub/KnowledgeBase/hooks/useKnowledgeBase.d.ts +13 -0
- package/dist/components/AgentHub/KnowledgeBase/index.d.ts +7 -0
- package/dist/components/AgentHub/types.d.ts +83 -0
- package/dist/components/Auth/PermissionGuard.d.ts +19 -0
- package/dist/components/Auth/ProtectedRoute.d.ts +10 -0
- package/dist/components/Auth/hasPermission.d.ts +2 -0
- package/dist/components/Auth/index.d.ts +3 -0
- package/dist/components/Auth/types.d.ts +1 -0
- package/dist/components/Descriptions/CommonDescriptions.d.ts +23 -0
- package/dist/components/Descriptions/index.d.ts +2 -0
- package/dist/components/File/FileItem/index.d.ts +22 -0
- package/dist/components/File/FileLink/index.d.ts +8 -0
- package/dist/components/File/FilePreview/index.d.ts +11 -0
- package/dist/components/File/FilePreviewModal/index.d.ts +10 -0
- package/dist/components/File/fileDisplay.d.ts +11 -0
- package/dist/components/File/index.d.ts +10 -0
- package/dist/components/File/types.d.ts +20 -0
- package/dist/components/Filter/CommonFilter/index.d.ts +41 -0
- package/dist/components/Filter/FilterDateRange/index.d.ts +18 -0
- package/dist/components/Filter/FilterInput/index.d.ts +10 -0
- package/dist/components/Filter/FilterNumberRange/index.d.ts +12 -0
- package/dist/components/Filter/FilterPanel/index.d.ts +11 -0
- package/dist/components/Filter/FilterPopover/index.d.ts +24 -0
- package/dist/components/Filter/FilterSelect/index.d.ts +18 -0
- package/dist/components/Filter/FilterTreeSelect/index.d.ts +22 -0
- package/dist/components/Filter/FilterTrigger/index.d.ts +16 -0
- package/dist/components/Filter/index.d.ts +30 -0
- package/dist/components/Filter/types.d.ts +35 -0
- package/dist/components/Filter/useFilterState.d.ts +49 -0
- package/dist/components/Form/FetchSelect.d.ts +21 -0
- package/dist/components/Form/FetchTreeSelect.d.ts +22 -0
- package/dist/components/Form/PersonOptionRow/index.d.ts +9 -0
- package/dist/components/Form/StepForm.d.ts +42 -0
- package/dist/components/Form/index.d.ts +8 -0
- package/dist/components/Icons/index.d.ts +85 -0
- package/dist/components/Layout/PageHeaderLayout/index.d.ts +12 -0
- package/dist/components/Layout/index.d.ts +2 -0
- package/dist/components/Modal/StepModal/index.d.ts +25 -0
- package/dist/components/Modal/StepModalTypes.d.ts +40 -0
- package/dist/components/Modal/index.d.ts +2 -0
- package/dist/components/Stat/StatCard/index.d.ts +22 -0
- package/dist/components/Stat/StatCardList.d.ts +26 -0
- package/dist/components/Stat/StatPendingBreakdown/index.d.ts +25 -0
- package/dist/components/Stat/index.d.ts +6 -0
- package/dist/components/Tag/FileTags.d.ts +6 -0
- package/dist/components/Tag/SemanticTag.d.ts +52 -0
- package/dist/components/Tag/Tags/index.d.ts +16 -0
- package/dist/components/Tag/index.d.ts +6 -0
- package/dist/components/TooltipInfo/TooltipInfo.d.ts +19 -0
- package/dist/components/TooltipInfo/index.d.ts +2 -0
- package/dist/components/Tour/AppTour/index.d.ts +19 -0
- package/dist/components/Tour/index.d.ts +2 -0
- package/dist/components/Upload/index.d.ts +66 -0
- package/dist/components/Upload/index.js +181 -0
- package/dist/components/Upload/index.js.map +1 -0
- package/dist/components/Upload/style.module.scss.js +19 -0
- package/dist/components/Upload/style.module.scss.js.map +1 -0
- package/dist/components/VirtualScrollbar/VirtualScrollbar/index.d.ts +14 -0
- package/dist/components/VirtualScrollbar/index.d.ts +3 -0
- package/dist/components/VirtualScrollbar/useVirtualScrollbar.d.ts +23 -0
- package/dist/components/index.d.ts +15 -0
- package/dist/hooks/useFetchData.d.ts +22 -0
- package/dist/index.d.ts +26 -28
- package/dist/index.js +166 -164
- package/dist/index.js.map +1 -1
- package/dist/marsun-components-core.css +1 -1
- package/dist/provider/MarsunCoreProvider.d.ts +20 -0
- package/dist/provider/context.d.ts +24 -0
- package/dist/provider/index.d.ts +3 -0
- package/dist/styles/global.css +1 -0
- package/dist/theme/constants.d.ts +12 -0
- package/dist/theme/theme.d.ts +11 -0
- package/dist/utils/format.d.ts +2 -0
- package/dist/utils/resolveMaybeFn.d.ts +11 -0
- package/package.json +9 -4
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { KBDocument } from '../../../types';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
export interface DocumentTableProps {
|
|
4
|
+
datasetId: string;
|
|
5
|
+
data: KBDocument[];
|
|
6
|
+
loading: boolean;
|
|
7
|
+
total: number;
|
|
8
|
+
page: number;
|
|
9
|
+
pageSize: number;
|
|
10
|
+
onPageChange: (page: number, pageSize: number) => void;
|
|
11
|
+
onParse: (doc: KBDocument) => void;
|
|
12
|
+
onStopParse: (doc: KBDocument) => void;
|
|
13
|
+
onDelete: (doc: KBDocument) => void;
|
|
14
|
+
}
|
|
15
|
+
declare const DocumentTable: React.FC<DocumentTableProps>;
|
|
16
|
+
export default DocumentTable;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FormInstance } from 'antd';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
export interface KnowledgeBaseFormProps {
|
|
4
|
+
form: FormInstance;
|
|
5
|
+
initialValues?: {
|
|
6
|
+
name?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
embedding_model?: string;
|
|
9
|
+
chunk_method?: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
declare const KnowledgeBaseForm: React.FC<KnowledgeBaseFormProps>;
|
|
13
|
+
export default KnowledgeBaseForm;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Dataset } from '../../../types';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
export interface KnowledgeCardProps {
|
|
4
|
+
dataset: Dataset;
|
|
5
|
+
onView: (dataset: Dataset) => void;
|
|
6
|
+
onUpload: (dataset: Dataset) => void;
|
|
7
|
+
onEdit: (dataset: Dataset) => void;
|
|
8
|
+
onDelete: (dataset: Dataset) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const KnowledgeCard: React.FC<KnowledgeCardProps>;
|
|
11
|
+
export default KnowledgeCard;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Dataset } from '../../types';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
export interface KBFormModalProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
record?: Dataset | null;
|
|
6
|
+
onSubmit: (values: Record<string, unknown>, record?: Dataset | null) => Promise<void>;
|
|
7
|
+
onSuccess: () => void;
|
|
8
|
+
onCancel: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const KBFormModal: React.FC<KBFormModalProps>;
|
|
11
|
+
export default KBFormModal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Dataset, KBDocument, ParseStatus } from '../../types';
|
|
2
|
+
export type { Dataset, KBDocument };
|
|
3
|
+
export { ParseStatus };
|
|
4
|
+
export declare const PARSE_STATUS_CONFIG: Record<string, {
|
|
5
|
+
label: string;
|
|
6
|
+
color: string;
|
|
7
|
+
spinning?: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const CHUNK_METHOD_OPTIONS: {
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}[];
|
|
13
|
+
export declare const EMBEDDING_MODEL_OPTIONS: {
|
|
14
|
+
label: string;
|
|
15
|
+
value: string;
|
|
16
|
+
}[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { KBDocument } from '../../types';
|
|
2
|
+
export type UseKBDocumentsOptions = {
|
|
3
|
+
listUrl?: string;
|
|
4
|
+
transformList?: (raw: unknown) => KBDocument[];
|
|
5
|
+
};
|
|
6
|
+
export declare const useKBDocuments: (datasetId: string | undefined, options?: UseKBDocumentsOptions) => {
|
|
7
|
+
data: KBDocument[];
|
|
8
|
+
loading: boolean;
|
|
9
|
+
fetchData: () => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Dataset } from '../../types';
|
|
2
|
+
export type UseKnowledgeBaseOptions = {
|
|
3
|
+
listUrl?: string;
|
|
4
|
+
transformList?: (raw: unknown) => Dataset[];
|
|
5
|
+
deleteUrl?: string;
|
|
6
|
+
onDeleteSuccess?: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const useKnowledgeBase: (options?: UseKnowledgeBaseOptions) => {
|
|
9
|
+
data: Dataset[];
|
|
10
|
+
loading: boolean;
|
|
11
|
+
fetchData: () => void;
|
|
12
|
+
deleteDataset: (id: string) => Promise<void>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/** AgentHub 展示层类型(字段宽松,消费方 transformData 映射) */
|
|
2
|
+
export type MessageRole = 'user' | 'assistant' | 'system';
|
|
3
|
+
export interface Citation {
|
|
4
|
+
id: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
content?: string;
|
|
7
|
+
source?: string;
|
|
8
|
+
url?: string;
|
|
9
|
+
doc_id?: string;
|
|
10
|
+
doc_name?: string;
|
|
11
|
+
positions?: unknown;
|
|
12
|
+
score?: number;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
export interface ChatMessage {
|
|
16
|
+
id: string;
|
|
17
|
+
role: MessageRole;
|
|
18
|
+
content: string;
|
|
19
|
+
createdAt?: string;
|
|
20
|
+
citations?: Citation[];
|
|
21
|
+
thinking?: string;
|
|
22
|
+
streaming?: boolean;
|
|
23
|
+
thumbup?: boolean | null;
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
}
|
|
26
|
+
export interface ChatSession {
|
|
27
|
+
id: string;
|
|
28
|
+
title?: string;
|
|
29
|
+
name?: string;
|
|
30
|
+
assistantId?: string;
|
|
31
|
+
updatedAt?: string;
|
|
32
|
+
update_time?: string;
|
|
33
|
+
create_time?: string;
|
|
34
|
+
messages?: ChatMessage[];
|
|
35
|
+
message?: ChatMessage[];
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
}
|
|
38
|
+
export interface ChatAssistant {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
avatar?: string;
|
|
43
|
+
status?: string;
|
|
44
|
+
datasetIds?: string[];
|
|
45
|
+
dataset_ids?: string[];
|
|
46
|
+
prompt_config?: {
|
|
47
|
+
prologue?: string;
|
|
48
|
+
empty_response?: string;
|
|
49
|
+
};
|
|
50
|
+
[key: string]: unknown;
|
|
51
|
+
}
|
|
52
|
+
export interface Dataset {
|
|
53
|
+
id: string;
|
|
54
|
+
name: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
documentCount?: number;
|
|
57
|
+
document_count?: number;
|
|
58
|
+
chunk_count?: number;
|
|
59
|
+
token_num?: number;
|
|
60
|
+
done_count?: number;
|
|
61
|
+
running_count?: number;
|
|
62
|
+
fail_count?: number;
|
|
63
|
+
unstart_count?: number;
|
|
64
|
+
updatedAt?: string;
|
|
65
|
+
embedding_model?: string;
|
|
66
|
+
chunk_method?: string;
|
|
67
|
+
[key: string]: unknown;
|
|
68
|
+
}
|
|
69
|
+
export interface KBDocument {
|
|
70
|
+
id: string;
|
|
71
|
+
name: string;
|
|
72
|
+
status?: string;
|
|
73
|
+
run?: ParseStatus | string;
|
|
74
|
+
size?: number;
|
|
75
|
+
updatedAt?: string;
|
|
76
|
+
[key: string]: unknown;
|
|
77
|
+
}
|
|
78
|
+
export type ParseStatus = 'pending' | 'parsing' | 'done' | 'failed' | string;
|
|
79
|
+
export interface SSEChunk {
|
|
80
|
+
answer?: string;
|
|
81
|
+
citations?: Citation[];
|
|
82
|
+
[key: string]: unknown;
|
|
83
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MaybeFn } from '../../utils/resolveMaybeFn';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
export type PermissionGuardContext = {
|
|
4
|
+
roles?: string[];
|
|
5
|
+
permission?: string;
|
|
6
|
+
};
|
|
7
|
+
export interface PermissionGuardProps {
|
|
8
|
+
/** 允许访问的角色列表 */
|
|
9
|
+
roles?: string[];
|
|
10
|
+
/** 允许访问的权限 key */
|
|
11
|
+
permission?: string;
|
|
12
|
+
/** 展示控制 */
|
|
13
|
+
display?: MaybeFn<boolean, PermissionGuardContext>;
|
|
14
|
+
hidden?: MaybeFn<boolean, PermissionGuardContext>;
|
|
15
|
+
fallback?: React.ReactNode;
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
}
|
|
18
|
+
declare const PermissionGuard: React.FC<PermissionGuardProps>;
|
|
19
|
+
export default PermissionGuard;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ProtectedRouteProps {
|
|
3
|
+
roles?: string[];
|
|
4
|
+
permission?: string;
|
|
5
|
+
loginPath?: string;
|
|
6
|
+
fallbackPath?: string;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare const ProtectedRoute: React.FC<ProtectedRouteProps>;
|
|
10
|
+
export default ProtectedRoute;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Visibility<T = Record<string, unknown>> = import('../../utils/resolveMaybeFn').MaybeFn<boolean, T>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface DescriptionItem {
|
|
3
|
+
label: string;
|
|
4
|
+
value: React.ReactNode;
|
|
5
|
+
span?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface CommonDescriptionsProps {
|
|
8
|
+
content: DescriptionItem[];
|
|
9
|
+
column?: number | {
|
|
10
|
+
xs?: number;
|
|
11
|
+
sm?: number;
|
|
12
|
+
md?: number;
|
|
13
|
+
lg?: number;
|
|
14
|
+
xl?: number;
|
|
15
|
+
xxl?: number;
|
|
16
|
+
};
|
|
17
|
+
bordered?: boolean;
|
|
18
|
+
size?: 'small' | 'default' | 'middle';
|
|
19
|
+
title?: React.ReactNode;
|
|
20
|
+
extra?: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
declare const CommonDescriptions: React.FC<CommonDescriptionsProps>;
|
|
23
|
+
export default CommonDescriptions;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FileDisplayItem } from '../types';
|
|
3
|
+
export interface FileItemAction {
|
|
4
|
+
key: string;
|
|
5
|
+
icon: React.ReactNode;
|
|
6
|
+
tooltip: string;
|
|
7
|
+
onClick: (file: FileDisplayItem) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface FileItemProps {
|
|
10
|
+
file: FileDisplayItem;
|
|
11
|
+
status?: React.ReactNode;
|
|
12
|
+
showDownload?: boolean;
|
|
13
|
+
showDelete?: boolean;
|
|
14
|
+
showPreview?: boolean;
|
|
15
|
+
actions?: FileItemAction[];
|
|
16
|
+
onDownload?: (file: FileDisplayItem) => void;
|
|
17
|
+
onDelete?: (file: FileDisplayItem) => void;
|
|
18
|
+
onPreview?: (file: FileDisplayItem) => void;
|
|
19
|
+
}
|
|
20
|
+
declare const FileItem: React.FC<FileItemProps>;
|
|
21
|
+
export { FileItem };
|
|
22
|
+
export default FileItem;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FileDisplayItem } from '../types';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
export interface FileLinkProps {
|
|
4
|
+
file: FileDisplayItem;
|
|
5
|
+
onClick?: (file: FileDisplayItem) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const FileLink: React.FC<FileLinkProps>;
|
|
8
|
+
export default FileLink;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FileDisplayItem } from '../types';
|
|
3
|
+
export interface FilePreviewProps {
|
|
4
|
+
file: FileDisplayItem;
|
|
5
|
+
url?: string;
|
|
6
|
+
unsupportedMessage?: string;
|
|
7
|
+
title?: React.ReactNode;
|
|
8
|
+
extra?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
declare const FilePreview: React.FC<FilePreviewProps>;
|
|
11
|
+
export default FilePreview;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FileDisplayItem } from '../types';
|
|
3
|
+
export interface FilePreviewModalProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
file: FileDisplayItem;
|
|
6
|
+
url?: string;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare const FilePreviewModal: React.FC<FilePreviewModalProps>;
|
|
10
|
+
export default FilePreviewModal;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FileDisplayItem } from './types';
|
|
3
|
+
export declare function getFileExtension(name: string): string;
|
|
4
|
+
/** 从 URL 路径解析文件名(decodeURIComponent,失败时回退为「未命名文件」) */
|
|
5
|
+
export declare function parseFileNameFromUrl(url: string): string;
|
|
6
|
+
/** 补全 name / extension:name 缺省时从 url 解析 */
|
|
7
|
+
export declare function normalizeFileDisplayItem(file: FileDisplayItem): FileDisplayItem & {
|
|
8
|
+
name: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function getFileIcon(name: string, _mimeType?: string): React.ReactNode;
|
|
11
|
+
export declare function getFileTypeName(name: string, mimeType?: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { FileDisplayItem, FileItemAction } from './types';
|
|
2
|
+
export { getFileExtension, getFileIcon, getFileTypeName, normalizeFileDisplayItem, parseFileNameFromUrl, } from './fileDisplay';
|
|
3
|
+
export { FileItem as FileItemView } from './FileItem';
|
|
4
|
+
export type { FileItemProps } from './FileItem';
|
|
5
|
+
export { default as FileLink } from './FileLink';
|
|
6
|
+
export type { FileLinkProps } from './FileLink';
|
|
7
|
+
export { default as FilePreview } from './FilePreview';
|
|
8
|
+
export type { FilePreviewProps } from './FilePreview';
|
|
9
|
+
export { default as FilePreviewModal } from './FilePreviewModal';
|
|
10
|
+
export type { FilePreviewModalProps } from './FilePreviewModal';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** 文件展示项(纯 UI 字段,无业务语义) */
|
|
2
|
+
export interface FileDisplayItem {
|
|
3
|
+
id: string;
|
|
4
|
+
/** 文件名;缺省且提供 url 时由组件从 url 解析 */
|
|
5
|
+
name?: string;
|
|
6
|
+
size?: number;
|
|
7
|
+
mimeType?: string;
|
|
8
|
+
extension?: string;
|
|
9
|
+
url?: string;
|
|
10
|
+
thumbnailUrl?: string;
|
|
11
|
+
tags?: string[];
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface FileItemAction {
|
|
15
|
+
key: string;
|
|
16
|
+
label: string;
|
|
17
|
+
hidden?: boolean;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
onClick?: (item: FileDisplayItem) => void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface CommonFilterProps {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
/** 筛选项 JSX 数组,如 [<FilterInput .../>, <FilterSelect .../>] */
|
|
5
|
+
list?: React.ReactNode[];
|
|
6
|
+
/** 右侧额外内容(与筛选项两端对齐) */
|
|
7
|
+
extra?: React.ReactNode;
|
|
8
|
+
/** 清空全部回调 */
|
|
9
|
+
onClearAll?: () => void;
|
|
10
|
+
/** 左侧标签文字 */
|
|
11
|
+
label?: string;
|
|
12
|
+
/** 已选标签 value 最大字符数,超出显示 ... 并在 hover 时展示完整内容 */
|
|
13
|
+
selectedTagMaxLength?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 通用筛选栏容器
|
|
17
|
+
*
|
|
18
|
+
* 内部通过 useFilterState 管理各子组件的注册状态,
|
|
19
|
+
* 子组件(FilterInput / FilterSelect / FilterTreeSelect)自行通过 useFilterRegister 注册选中项。
|
|
20
|
+
* 外部不再需要手动维护 selectedItems 数组。
|
|
21
|
+
*
|
|
22
|
+
* 用法一(children 模式):
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <CommonFilter label="筛选">
|
|
25
|
+
* <FilterInput filterKey="keyword" label="关键词" value={keyword} onChange={setKeyword} />
|
|
26
|
+
* <FilterSelect filterKey="status" label="状态" options={options} value={status} onChange={setStatus} />
|
|
27
|
+
* </CommonFilter>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* 用法二(list 模式):
|
|
31
|
+
* ```tsx
|
|
32
|
+
* const filterList = [
|
|
33
|
+
* <FilterInput key="keyword" filterKey="keyword" label="关键词" value={keyword} onChange={setKeyword} />,
|
|
34
|
+
* <FilterSelect key="status" filterKey="status" label="状态" options={options} value={status} onChange={setStatus} />,
|
|
35
|
+
* ];
|
|
36
|
+
* <CommonFilter label="筛选" list={filterList} extra={<Button>导出</Button>} />
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare const CommonFilter: React.FC<CommonFilterProps>;
|
|
40
|
+
export default CommonFilter;
|
|
41
|
+
export type { CommonFilterProps };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Dayjs } from 'dayjs';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { BaseFilterProps } from '../types';
|
|
4
|
+
/** 快捷选项配置类型 */
|
|
5
|
+
interface QuickOption {
|
|
6
|
+
key: string;
|
|
7
|
+
label: string;
|
|
8
|
+
getValue: () => [Dayjs, Dayjs] | null;
|
|
9
|
+
}
|
|
10
|
+
interface FilterDateRangeProps extends BaseFilterProps {
|
|
11
|
+
value?: [string, string] | null;
|
|
12
|
+
onChange?: (value: [string, string] | null) => void;
|
|
13
|
+
showQuickOptions?: boolean;
|
|
14
|
+
quickOptions?: QuickOption[];
|
|
15
|
+
}
|
|
16
|
+
declare const FilterDateRange: React.FC<FilterDateRangeProps>;
|
|
17
|
+
export default FilterDateRange;
|
|
18
|
+
export type { FilterDateRangeProps, QuickOption };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseFilterProps } from '../types';
|
|
3
|
+
interface FilterInputProps extends BaseFilterProps {
|
|
4
|
+
value?: string;
|
|
5
|
+
onChange?: (value: string | undefined) => void;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const FilterInput: React.FC<FilterInputProps>;
|
|
9
|
+
export default FilterInput;
|
|
10
|
+
export type { FilterInputProps };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseFilterProps } from '../types';
|
|
3
|
+
interface FilterNumberRangeProps extends BaseFilterProps {
|
|
4
|
+
value?: [number | undefined, number | undefined] | null;
|
|
5
|
+
onChange?: (value: [number | undefined, number | undefined] | null) => void;
|
|
6
|
+
unit?: string;
|
|
7
|
+
minPlaceholder?: string;
|
|
8
|
+
maxPlaceholder?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const FilterNumberRange: React.FC<FilterNumberRangeProps>;
|
|
11
|
+
export default FilterNumberRange;
|
|
12
|
+
export type { FilterNumberRangeProps };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode, default as React } from 'react';
|
|
2
|
+
interface FilterPanelProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
onConfirm?: () => void;
|
|
5
|
+
onReset?: () => void;
|
|
6
|
+
confirmText?: string;
|
|
7
|
+
width?: number;
|
|
8
|
+
}
|
|
9
|
+
declare const FilterPanel: React.FC<FilterPanelProps>;
|
|
10
|
+
export default FilterPanel;
|
|
11
|
+
export type { FilterPanelProps };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface FilterPopoverProps {
|
|
3
|
+
/** 筛选项标签 */
|
|
4
|
+
label: string;
|
|
5
|
+
/** 是否有值(控制选中态样式) */
|
|
6
|
+
active?: boolean;
|
|
7
|
+
/** 面板宽度 */
|
|
8
|
+
width?: number;
|
|
9
|
+
/** 确定按钮文字 */
|
|
10
|
+
confirmText?: string;
|
|
11
|
+
/** 面板内容 */
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
/** 受控打开状态(传入则由外部控制) */
|
|
14
|
+
open?: boolean;
|
|
15
|
+
/** 打开状态变更回调 */
|
|
16
|
+
onOpenChange?: (open: boolean) => void;
|
|
17
|
+
/** 确认回调(不传则无确定/取消按钮) */
|
|
18
|
+
onConfirm?: () => void;
|
|
19
|
+
/** 取消回调 */
|
|
20
|
+
onReset?: () => void;
|
|
21
|
+
}
|
|
22
|
+
declare const FilterPopover: React.FC<FilterPopoverProps>;
|
|
23
|
+
export default FilterPopover;
|
|
24
|
+
export type { FilterPopoverProps };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseFilterProps, FilterOption } from '../types';
|
|
3
|
+
interface FilterSelectProps extends BaseFilterProps {
|
|
4
|
+
options: FilterOption[];
|
|
5
|
+
value?: string | number | undefined;
|
|
6
|
+
onChange?: (value: string | number | undefined) => void;
|
|
7
|
+
/** 默认值:与默认值相同时视为未筛选(不展示已选标签与选中态) */
|
|
8
|
+
defaultValue?: string | number;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
searchable?: boolean;
|
|
11
|
+
/** 是否多选 */
|
|
12
|
+
multiple?: boolean;
|
|
13
|
+
/** 人员选项:展示部门与联系方式 */
|
|
14
|
+
variant?: 'default' | 'person';
|
|
15
|
+
}
|
|
16
|
+
declare const FilterSelect: React.FC<FilterSelectProps>;
|
|
17
|
+
export default FilterSelect;
|
|
18
|
+
export type { FilterSelectProps };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseFilterProps } from '../types';
|
|
3
|
+
export interface TreeFilterNode {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
children?: TreeFilterNode[];
|
|
7
|
+
}
|
|
8
|
+
export interface FilterTreeSelectProps extends BaseFilterProps {
|
|
9
|
+
treeData?: TreeFilterNode[];
|
|
10
|
+
fetchUrl?: string;
|
|
11
|
+
fetchOptions?: RequestInit;
|
|
12
|
+
transformData?: (raw: unknown) => TreeFilterNode[];
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
value?: string | string[] | undefined;
|
|
15
|
+
onChange?: (value: string | string[] | undefined) => void;
|
|
16
|
+
showSearch?: boolean;
|
|
17
|
+
multiple?: boolean;
|
|
18
|
+
/** 自定义节点展示标签(默认 name) */
|
|
19
|
+
getNodeLabel?: (node: TreeFilterNode) => string;
|
|
20
|
+
}
|
|
21
|
+
declare const FilterTreeSelect: React.FC<FilterTreeSelectProps>;
|
|
22
|
+
export default FilterTreeSelect;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseFilterProps } from '../types';
|
|
3
|
+
interface FilterTriggerProps extends Omit<BaseFilterProps, 'filterKey'> {
|
|
4
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
5
|
+
open?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 筛选触发按钮
|
|
11
|
+
* 未选中:文字 + 下箭头
|
|
12
|
+
* 选中:主题色背景 + 白字 + 上箭头
|
|
13
|
+
*/
|
|
14
|
+
declare const FilterTrigger: React.FC<FilterTriggerProps>;
|
|
15
|
+
export default FilterTrigger;
|
|
16
|
+
export type { FilterTriggerProps };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { default as CommonFilter } from './CommonFilter';
|
|
2
|
+
import { default as FilterTrigger } from './FilterTrigger';
|
|
3
|
+
import { default as FilterPanel } from './FilterPanel';
|
|
4
|
+
import { default as FilterPopover } from './FilterPopover';
|
|
5
|
+
import { default as FilterSelect } from './FilterSelect';
|
|
6
|
+
import { default as FilterInput } from './FilterInput';
|
|
7
|
+
import { default as FilterDateRange } from './FilterDateRange';
|
|
8
|
+
import { default as FilterNumberRange } from './FilterNumberRange';
|
|
9
|
+
import { default as FilterTreeSelect } from './FilterTreeSelect';
|
|
10
|
+
export type { CommonFilterProps } from './CommonFilter';
|
|
11
|
+
export type { BaseFilterProps, FilterOption, PersonOption, SelectedItem } from './types';
|
|
12
|
+
export { resolveHidden } from './types';
|
|
13
|
+
export { CommonFilter };
|
|
14
|
+
export type { FilterTriggerProps } from './FilterTrigger';
|
|
15
|
+
export { FilterTrigger };
|
|
16
|
+
export type { FilterPanelProps } from './FilterPanel';
|
|
17
|
+
export { FilterPanel };
|
|
18
|
+
export type { FilterPopoverProps } from './FilterPopover';
|
|
19
|
+
export { FilterPopover };
|
|
20
|
+
export type { FilterSelectProps } from './FilterSelect';
|
|
21
|
+
export { FilterSelect };
|
|
22
|
+
export type { FilterInputProps } from './FilterInput';
|
|
23
|
+
export { FilterInput };
|
|
24
|
+
export type { FilterDateRangeProps, QuickOption } from './FilterDateRange';
|
|
25
|
+
export { FilterDateRange };
|
|
26
|
+
export type { FilterNumberRangeProps } from './FilterNumberRange';
|
|
27
|
+
export { FilterNumberRange };
|
|
28
|
+
export type { FilterTreeSelectProps, TreeFilterNode } from './FilterTreeSelect';
|
|
29
|
+
export { FilterTreeSelect };
|
|
30
|
+
export { useFilterState, useFilterRegister, FilterProvider } from './useFilterState';
|