@apform-ui/core 1.0.2 → 1.3.0
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 +85 -0
- package/dist/__tests__/components.spec.d.ts +1 -0
- package/dist/apform-ui.css +1 -1
- package/dist/apform-ui.js +5865 -1481
- package/dist/apform-ui.umd.cjs +68 -1
- package/dist/components/AppDialog/AppDialog.vue.d.ts +48 -0
- package/dist/components/AppDialog/index.d.ts +1 -0
- package/dist/components/AppIcon/AppIcon.vue.d.ts +11 -0
- package/dist/components/AppIcon/index.d.ts +1 -0
- package/dist/components/AppPagination/AppPagination.vue.d.ts +26 -0
- package/dist/components/AppPagination/index.d.ts +1 -0
- package/dist/components/CardGridSkeleton/CardGridSkeleton.vue.d.ts +34 -0
- package/dist/components/CardGridSkeleton/index.d.ts +1 -0
- package/dist/components/CardTable/CardTable.vue.d.ts +28 -0
- package/dist/components/CardTable/index.d.ts +1 -0
- package/dist/components/Chat/ApprovalCard/ApprovalCard.vue.d.ts +12 -0
- package/dist/components/Chat/ApprovalCard/index.d.ts +1 -0
- package/dist/components/Chat/Composer/Composer.vue.d.ts +32 -0
- package/dist/components/Chat/Composer/index.d.ts +1 -0
- package/dist/components/Chat/ConversationHeader/ConversationHeader.vue.d.ts +21 -0
- package/dist/components/Chat/ConversationHeader/index.d.ts +1 -0
- package/dist/components/Chat/MessageBubble/MessageBubble.vue.d.ts +23 -0
- package/dist/components/Chat/MessageBubble/index.d.ts +1 -0
- package/dist/components/Chat/MessageList/MessageList.vue.d.ts +24 -0
- package/dist/components/Chat/MessageList/index.d.ts +1 -0
- package/dist/components/Chat/ProcessingDrawer/ProcessingDrawer.vue.d.ts +32 -0
- package/dist/components/Chat/ProcessingDrawer/index.d.ts +1 -0
- package/dist/components/Chat/RunStatusBar/RunStatusBar.vue.d.ts +12 -0
- package/dist/components/Chat/RunStatusBar/index.d.ts +1 -0
- package/dist/components/Chat/SessionSidebar/SessionSidebar.vue.d.ts +18 -0
- package/dist/components/Chat/SessionSidebar/index.d.ts +1 -0
- package/dist/components/Chat/message/AttachmentPreviewModal.vue.d.ts +18 -0
- package/dist/components/Chat/message/DocumentSummaryList.vue.d.ts +12 -0
- package/dist/components/Chat/message/MessageAttachmentList.vue.d.ts +11 -0
- package/dist/components/Chat/message/MessageParts.vue.d.ts +6 -0
- package/dist/components/Chat/message/index.d.ts +4 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.vue.d.ts +26 -0
- package/dist/components/ConfirmDialog/index.d.ts +1 -0
- package/dist/components/ContentPanel/ContentPanel.vue.d.ts +31 -0
- package/dist/components/ContentPanel/index.d.ts +1 -0
- package/dist/components/EmptyState/EmptyState.vue.d.ts +23 -0
- package/dist/components/EmptyState/index.d.ts +1 -0
- package/dist/components/ErrorBoundary/ErrorBoundary.vue.d.ts +39 -0
- package/dist/components/ErrorBoundary/index.d.ts +1 -0
- package/dist/components/FieldRow/FieldRow.vue.d.ts +23 -0
- package/dist/components/FieldRow/index.d.ts +1 -0
- package/dist/components/FilterBar/FilterBar.vue.d.ts +30 -0
- package/dist/components/FilterBar/index.d.ts +1 -0
- package/dist/components/FilterTabs/FilterTabs.vue.d.ts +21 -0
- package/dist/components/FilterTabs/index.d.ts +1 -0
- package/dist/components/FormDialog/FormDialog.vue.d.ts +44 -0
- package/dist/components/FormDialog/index.d.ts +1 -0
- package/dist/components/HintText/HintText.vue.d.ts +19 -0
- package/dist/components/HintText/index.d.ts +1 -0
- package/dist/components/JsonCard/JsonCard.vue.d.ts +20 -0
- package/dist/components/JsonCard/index.d.ts +1 -0
- package/dist/components/JsonDetailDialog/JsonDetailDialog.vue.d.ts +13 -0
- package/dist/components/JsonDetailDialog/index.d.ts +1 -0
- package/dist/components/LoadingDots/LoadingDots.vue.d.ts +10 -0
- package/dist/components/LoadingDots/index.d.ts +1 -0
- package/dist/components/PageHeader/PageHeader.vue.d.ts +28 -0
- package/dist/components/PageHeader/index.d.ts +1 -0
- package/dist/components/PageShell/PageShell.vue.d.ts +25 -0
- package/dist/components/PageShell/index.d.ts +1 -0
- package/dist/components/SchemaLitePreview/SchemaLitePreview.vue.d.ts +30 -0
- package/dist/components/SchemaLitePreview/index.d.ts +2 -0
- package/dist/components/SearchForm/SearchForm.vue.d.ts +39 -0
- package/dist/components/SearchForm/index.d.ts +2 -0
- package/dist/components/SectionToggle/SectionToggle.vue.d.ts +20 -0
- package/dist/components/SectionToggle/index.d.ts +1 -0
- package/dist/components/Skeleton/Skeleton.vue.d.ts +29 -0
- package/dist/components/Skeleton/index.d.ts +1 -0
- package/dist/components/StatusTag/StatusTag.vue.d.ts +21 -0
- package/dist/components/StatusTag/index.d.ts +2 -0
- package/dist/components/TableRowActions/TableRowActions.vue.d.ts +23 -0
- package/dist/components/TableRowActions/index.d.ts +2 -0
- package/dist/components/Toast/Toast.vue.d.ts +12 -0
- package/dist/components/Toast/index.d.ts +2 -0
- package/dist/components/TruncatedTooltipText/TruncatedTooltipText.vue.d.ts +22 -0
- package/dist/components/TruncatedTooltipText/index.d.ts +1 -0
- package/dist/components/UserAvatar/UserAvatar.vue.d.ts +26 -0
- package/dist/components/UserAvatar/index.d.ts +1 -0
- package/dist/composables/index.d.ts +7 -0
- package/dist/composables/useClientPagination.d.ts +15 -0
- package/dist/composables/useConfirm.d.ts +15 -0
- package/dist/composables/useDebounceFn.d.ts +1 -0
- package/dist/composables/useMessage.d.ts +8 -0
- package/dist/composables/useToast.d.ts +17 -0
- package/dist/index.d.ts +69 -0
- package/dist/stories/AppDialog.stories.d.ts +9 -0
- package/dist/stories/AppIcon.stories.d.ts +9 -0
- package/dist/stories/ApprovalCard.stories.d.ts +8 -0
- package/dist/stories/Composer.stories.d.ts +9 -0
- package/dist/stories/MessageBubble.stories.d.ts +10 -0
- package/dist/stories/RunStatusBar.stories.d.ts +8 -0
- package/dist/stories/StatusTag.stories.d.ts +8 -0
- package/dist/stories/useConfirm.stories.d.ts +5 -0
- package/dist/stories/useMessage.stories.d.ts +5 -0
- package/dist/tokens/index.d.ts +139 -0
- package/dist/types/chat.d.ts +121 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/attachmentKind.d.ts +7 -0
- package/dist/utils/iconRegistry.d.ts +7 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/pagination.d.ts +8 -0
- package/dist/utils/resolveApiErrorMessage.d.ts +22 -0
- package/dist/utils/textParser.d.ts +20 -0
- package/package.json +10 -6
- package/src/tokens/index.ts +78 -0
- package/src/tokens/tokens.css +74 -5
- package/styles/element-override.css +155 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
+
import { default as AppIcon } from '../components/AppIcon/AppIcon.vue';
|
|
3
|
+
declare const meta: Meta<typeof AppIcon>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof AppIcon>;
|
|
6
|
+
export declare const Basic: Story;
|
|
7
|
+
export declare const Sizes: Story;
|
|
8
|
+
export declare const Colors: Story;
|
|
9
|
+
export declare const AllIcons: Story;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
+
import { default as ApprovalCard } from '../components/Chat/ApprovalCard/ApprovalCard.vue';
|
|
3
|
+
declare const meta: Meta<typeof ApprovalCard>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ApprovalCard>;
|
|
6
|
+
export declare const Basic: Story;
|
|
7
|
+
export declare const Dangerous: Story;
|
|
8
|
+
export declare const WithFields: Story;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
+
import { default as Composer } from '../components/Chat/Composer/Composer.vue';
|
|
3
|
+
declare const meta: Meta<typeof Composer>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Composer>;
|
|
6
|
+
export declare const Basic: Story;
|
|
7
|
+
export declare const WithFileUpload: Story;
|
|
8
|
+
export declare const Disabled: Story;
|
|
9
|
+
export declare const WithWebSocketStatus: Story;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
+
import { default as MessageBubble } from '../components/Chat/MessageBubble/MessageBubble.vue';
|
|
3
|
+
declare const meta: Meta<typeof MessageBubble>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof MessageBubble>;
|
|
6
|
+
export declare const UserMessage: Story;
|
|
7
|
+
export declare const AssistantMessage: Story;
|
|
8
|
+
export declare const WithThinking: Story;
|
|
9
|
+
export declare const Failed: Story;
|
|
10
|
+
export declare const WaitingInput: Story;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
+
import { default as RunStatusBar } from '../components/Chat/RunStatusBar/RunStatusBar.vue';
|
|
3
|
+
declare const meta: Meta<typeof RunStatusBar>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof RunStatusBar>;
|
|
6
|
+
export declare const Running: Story;
|
|
7
|
+
export declare const Completed: Story;
|
|
8
|
+
export declare const Failed: Story;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
+
import { default as StatusTag } from '../components/StatusTag/StatusTag.vue';
|
|
3
|
+
declare const meta: Meta<typeof StatusTag>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof StatusTag>;
|
|
6
|
+
export declare const AllStatuses: Story;
|
|
7
|
+
export declare const Sizes: Story;
|
|
8
|
+
export declare const CustomStatus: Story;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @apform-ui/core 设计令牌
|
|
3
|
+
*
|
|
4
|
+
* CSS 变量通过 import './tokens.css' 和 './design-tokens.css' 引入
|
|
5
|
+
* 此文件导出令牌常量供 JS/TS 使用
|
|
6
|
+
*/
|
|
7
|
+
/** 主色 */
|
|
8
|
+
export declare const COLORS: {
|
|
9
|
+
readonly primary: "#0060A2";
|
|
10
|
+
readonly primaryHover: "#4581E9";
|
|
11
|
+
readonly primaryLight: "#4581E9";
|
|
12
|
+
readonly primaryLighter: "#EEF5FF";
|
|
13
|
+
readonly primaryDark: "#0060A2";
|
|
14
|
+
readonly success: "#26A036";
|
|
15
|
+
readonly warning: "#F09700";
|
|
16
|
+
readonly danger: "#E50113";
|
|
17
|
+
readonly info: "#4581E9";
|
|
18
|
+
};
|
|
19
|
+
/** 文字色 */
|
|
20
|
+
export declare const TEXT_COLORS: {
|
|
21
|
+
readonly title: "#303133";
|
|
22
|
+
readonly primary: "#333333";
|
|
23
|
+
readonly regular: "#606266";
|
|
24
|
+
readonly secondary: "#666666";
|
|
25
|
+
readonly muted: "#909399";
|
|
26
|
+
readonly placeholder: "#969FA8";
|
|
27
|
+
readonly disabled: "#C0C4CC";
|
|
28
|
+
readonly inverse: "#FFFFFF";
|
|
29
|
+
};
|
|
30
|
+
/** 字号(与 CSS --font-size-* 对齐) */
|
|
31
|
+
export declare const FONT_SIZE: {
|
|
32
|
+
readonly 10: "10px";
|
|
33
|
+
readonly 11: "11px";
|
|
34
|
+
readonly 12: "12px";
|
|
35
|
+
readonly 13: "13px";
|
|
36
|
+
readonly 14: "14px";
|
|
37
|
+
readonly 15: "15px";
|
|
38
|
+
readonly 16: "16px";
|
|
39
|
+
readonly 18: "18px";
|
|
40
|
+
readonly 20: "20px";
|
|
41
|
+
readonly 22: "22px";
|
|
42
|
+
readonly 24: "24px";
|
|
43
|
+
readonly 28: "28px";
|
|
44
|
+
};
|
|
45
|
+
/** 间距 */
|
|
46
|
+
export declare const SPACING: {
|
|
47
|
+
readonly xs: "4px";
|
|
48
|
+
readonly sm: "8px";
|
|
49
|
+
readonly md: "16px";
|
|
50
|
+
readonly lg: "24px";
|
|
51
|
+
readonly xl: "32px";
|
|
52
|
+
readonly '2xl': "48px";
|
|
53
|
+
readonly '3xl': "64px";
|
|
54
|
+
readonly 10: "10px";
|
|
55
|
+
readonly 12: "12px";
|
|
56
|
+
readonly 20: "20px";
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* 控件高度阶梯
|
|
60
|
+
* 全仓统计:32 > 28 > 24 > 40/44/48/60
|
|
61
|
+
*/
|
|
62
|
+
export declare const CONTROL_HEIGHT: {
|
|
63
|
+
readonly xs: "24px";
|
|
64
|
+
readonly sm: "28px";
|
|
65
|
+
readonly md: "32px";
|
|
66
|
+
readonly lg: "40px";
|
|
67
|
+
readonly xl: "44px";
|
|
68
|
+
};
|
|
69
|
+
/** 布局高度 */
|
|
70
|
+
export declare const LAYOUT_HEIGHT: {
|
|
71
|
+
readonly header: "56px";
|
|
72
|
+
readonly conversationHeader: "68px";
|
|
73
|
+
readonly dialogFooter: "60px";
|
|
74
|
+
readonly toolbar: "48px";
|
|
75
|
+
readonly tabs: "40px";
|
|
76
|
+
readonly listRow: "48px";
|
|
77
|
+
};
|
|
78
|
+
/** 图标尺寸 */
|
|
79
|
+
export declare const ICON_SIZE: {
|
|
80
|
+
readonly xs: "12px";
|
|
81
|
+
readonly sm: "14px";
|
|
82
|
+
readonly md: "16px";
|
|
83
|
+
readonly lg: "20px";
|
|
84
|
+
readonly xl: "24px";
|
|
85
|
+
};
|
|
86
|
+
/** 页面边距 */
|
|
87
|
+
export declare const PAGE: {
|
|
88
|
+
readonly paddingX: "24px";
|
|
89
|
+
readonly paddingY: "24px";
|
|
90
|
+
readonly headerPaddingTop: "28px";
|
|
91
|
+
readonly sidebarWidth: "240px";
|
|
92
|
+
readonly sidebarWidthCollapsed: "64px";
|
|
93
|
+
};
|
|
94
|
+
/** 圆角 */
|
|
95
|
+
export declare const BORDER_RADIUS: {
|
|
96
|
+
readonly sm: "2px";
|
|
97
|
+
readonly md: "4px";
|
|
98
|
+
readonly 6: "6px";
|
|
99
|
+
readonly 8: "8px";
|
|
100
|
+
readonly lg: "10px";
|
|
101
|
+
readonly xl: "12px";
|
|
102
|
+
readonly full: "999px";
|
|
103
|
+
};
|
|
104
|
+
/** 表单布局 */
|
|
105
|
+
export declare const FORM: {
|
|
106
|
+
readonly fieldWidth: "220px";
|
|
107
|
+
readonly labelWidth: "96px";
|
|
108
|
+
readonly fieldGap: "6px";
|
|
109
|
+
};
|
|
110
|
+
/** 头像尺寸 */
|
|
111
|
+
export declare const AVATAR_SIZE: {
|
|
112
|
+
readonly sm: "24px";
|
|
113
|
+
readonly md: "32px";
|
|
114
|
+
readonly lg: "40px";
|
|
115
|
+
readonly xl: "48px";
|
|
116
|
+
};
|
|
117
|
+
/** 阴影 */
|
|
118
|
+
export declare const SHADOWS: {
|
|
119
|
+
readonly sm: "0 1px 2px rgba(0, 0, 0, 0.05)";
|
|
120
|
+
readonly md: "0 4px 12px rgba(0, 0, 0, 0.08)";
|
|
121
|
+
readonly lg: "0 8px 24px rgba(0, 0, 0, 0.12)";
|
|
122
|
+
};
|
|
123
|
+
/** 动画时长 */
|
|
124
|
+
export declare const DURATION: {
|
|
125
|
+
readonly fast: "0.15s";
|
|
126
|
+
readonly normal: "0.25s";
|
|
127
|
+
readonly slow: "0.35s";
|
|
128
|
+
};
|
|
129
|
+
/** Z-Index 层级 */
|
|
130
|
+
export declare const Z_INDEX: {
|
|
131
|
+
readonly dropdown: 1000;
|
|
132
|
+
readonly sticky: 1020;
|
|
133
|
+
readonly fixed: 1030;
|
|
134
|
+
readonly modalBackdrop: 1040;
|
|
135
|
+
readonly modal: 1050;
|
|
136
|
+
readonly popover: 1060;
|
|
137
|
+
readonly tooltip: 1070;
|
|
138
|
+
readonly toast: 1080;
|
|
139
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @apform-ui/core — 对话组件类型定义
|
|
3
|
+
*
|
|
4
|
+
* 从 workflow-agent-chat 和 ai/app 项目提取的通用类型。
|
|
5
|
+
* 去除了业务特定的 store 依赖,保留纯数据结构。
|
|
6
|
+
*/
|
|
7
|
+
export type MessageRole = 'user' | 'assistant' | 'system';
|
|
8
|
+
export type MessageStatus = 'PENDING' | 'RUNNING' | 'WAITING_INPUT' | 'COMPLETED' | 'FAILED' | 'CANCELLED';
|
|
9
|
+
export interface Message {
|
|
10
|
+
id: string;
|
|
11
|
+
role: MessageRole;
|
|
12
|
+
content: string;
|
|
13
|
+
status: MessageStatus;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
thinking?: string;
|
|
16
|
+
tip?: string;
|
|
17
|
+
toolCalls?: ToolCallInfo[];
|
|
18
|
+
documentSummaries?: MessageDocumentSummary[];
|
|
19
|
+
workflowExecution?: WorkflowExecution;
|
|
20
|
+
attachments?: MessageAttachment[];
|
|
21
|
+
runtimeExecutionId?: string | null;
|
|
22
|
+
}
|
|
23
|
+
export interface MessageAttachment {
|
|
24
|
+
id: string;
|
|
25
|
+
filename: string;
|
|
26
|
+
mimetype: string;
|
|
27
|
+
size?: number;
|
|
28
|
+
excerpt?: string | null;
|
|
29
|
+
url?: string;
|
|
30
|
+
createdAt?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface ToolCallInfo {
|
|
33
|
+
id?: string;
|
|
34
|
+
name: string;
|
|
35
|
+
arguments: Record<string, unknown>;
|
|
36
|
+
result?: unknown;
|
|
37
|
+
error?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface MessageDocumentSummary {
|
|
40
|
+
documentId: string;
|
|
41
|
+
filename: string;
|
|
42
|
+
summary: string;
|
|
43
|
+
pageCount?: number;
|
|
44
|
+
}
|
|
45
|
+
export interface WorkflowExecution {
|
|
46
|
+
executionId: string;
|
|
47
|
+
workflowId: string;
|
|
48
|
+
workflowName: string;
|
|
49
|
+
status: string;
|
|
50
|
+
nodeRecords?: WorkflowNodeRecord[];
|
|
51
|
+
durationMs?: number;
|
|
52
|
+
error?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface WorkflowNodeRecord {
|
|
55
|
+
nodeId: string;
|
|
56
|
+
nodeName: string;
|
|
57
|
+
nodeType: string;
|
|
58
|
+
status: string;
|
|
59
|
+
startedAt?: string;
|
|
60
|
+
finishedAt?: string;
|
|
61
|
+
durationMs?: number;
|
|
62
|
+
}
|
|
63
|
+
export type RunStatus = 'RUNNING' | 'COMPLETED' | 'FAILED' | 'WAITING_INPUT' | 'CANCELLED';
|
|
64
|
+
export interface RunStatusView {
|
|
65
|
+
runId: string;
|
|
66
|
+
sessionId: string;
|
|
67
|
+
agentId: string;
|
|
68
|
+
runtimeExecutionId: string | null;
|
|
69
|
+
status: RunStatus;
|
|
70
|
+
errorMessage: string | null;
|
|
71
|
+
waiting: WaitingPayload | null;
|
|
72
|
+
startedAt: string;
|
|
73
|
+
finishedAt: string | null;
|
|
74
|
+
}
|
|
75
|
+
export interface WaitingPayload {
|
|
76
|
+
prompt: string;
|
|
77
|
+
fields: WaitingField[];
|
|
78
|
+
actions: WaitingAction[];
|
|
79
|
+
dangerous: boolean;
|
|
80
|
+
}
|
|
81
|
+
export interface WaitingField {
|
|
82
|
+
key: string;
|
|
83
|
+
label: string;
|
|
84
|
+
type: string;
|
|
85
|
+
options: string[];
|
|
86
|
+
}
|
|
87
|
+
export interface WaitingAction {
|
|
88
|
+
action: string;
|
|
89
|
+
label: string;
|
|
90
|
+
style: string;
|
|
91
|
+
}
|
|
92
|
+
export interface Session {
|
|
93
|
+
id: string;
|
|
94
|
+
title: string;
|
|
95
|
+
agentId?: string | null;
|
|
96
|
+
agentName?: string | null;
|
|
97
|
+
status: string;
|
|
98
|
+
createdAt: string;
|
|
99
|
+
updatedAt: string;
|
|
100
|
+
}
|
|
101
|
+
export interface Agent {
|
|
102
|
+
id: string;
|
|
103
|
+
slug: string;
|
|
104
|
+
name: string;
|
|
105
|
+
description: string;
|
|
106
|
+
icon: string;
|
|
107
|
+
supportedInputs: string[];
|
|
108
|
+
hitlCapable: boolean;
|
|
109
|
+
version: string;
|
|
110
|
+
updatedAt: string;
|
|
111
|
+
published: boolean;
|
|
112
|
+
}
|
|
113
|
+
export interface PendingAttachment {
|
|
114
|
+
id: string;
|
|
115
|
+
filename: string;
|
|
116
|
+
mimetype: string;
|
|
117
|
+
size: number;
|
|
118
|
+
status: 'uploading' | 'done' | 'error';
|
|
119
|
+
error?: string;
|
|
120
|
+
previewUrl?: string;
|
|
121
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './chat';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MessageAttachment } from '../types';
|
|
2
|
+
export declare function isImage(att: MessageAttachment): boolean;
|
|
3
|
+
export declare function isPdf(att: MessageAttachment): boolean;
|
|
4
|
+
export declare function isOffice(att: MessageAttachment): boolean;
|
|
5
|
+
export declare function isPreviewable(att: MessageAttachment): boolean;
|
|
6
|
+
export declare function fileKind(att: MessageAttachment): string;
|
|
7
|
+
export declare function formatSize(size?: number): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IconifyIcon } from '@iconify/vue';
|
|
2
|
+
/** 图标名称 → Iconify 图标对象映射(AppIcon 唯一合法来源) */
|
|
3
|
+
export declare const ICON_MAP: Record<string, IconifyIcon>;
|
|
4
|
+
/** 已注册图标名称列表(kebab-case) */
|
|
5
|
+
export declare const APP_ICON_NAMES: readonly string[];
|
|
6
|
+
export type AppIconName = keyof typeof ICON_MAP;
|
|
7
|
+
export declare function isRegisteredAppIcon(name: string): name is AppIconName;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ICON_MAP, APP_ICON_NAMES, isRegisteredAppIcon } from './iconRegistry';
|
|
2
|
+
export type { AppIconName } from './iconRegistry';
|
|
3
|
+
export { DEFAULT_PAGE_SIZE, PAGE_SIZE_OPTIONS, PAGINATION_LAYOUT } from './pagination';
|
|
4
|
+
export type { PageSizeOption } from './pagination';
|
|
5
|
+
export { resolveApiErrorMessage } from './resolveApiErrorMessage';
|
|
6
|
+
export type { ApiError } from './resolveApiErrorMessage';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @apform-ui/core 分页统一常量
|
|
3
|
+
*/
|
|
4
|
+
export declare const DEFAULT_PAGE_SIZE = 10;
|
|
5
|
+
export declare const PAGE_SIZE_OPTIONS: readonly [10, 20, 50];
|
|
6
|
+
export type PageSizeOption = (typeof PAGE_SIZE_OPTIONS)[number];
|
|
7
|
+
/** Element Plus pagination 统一 layout */
|
|
8
|
+
export declare const PAGINATION_LAYOUT = "total, sizes, prev, pager, next";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* resolveApiErrorMessage — API 错误消息标准化
|
|
3
|
+
*
|
|
4
|
+
* 将各种格式的 API 错误转换为人类可读的错误消息。
|
|
5
|
+
* 来自 editor 项目,在 flow/ai 项目中有类似但不一致的实现。
|
|
6
|
+
*
|
|
7
|
+
* 用法:
|
|
8
|
+
* try {
|
|
9
|
+
* await apiCall()
|
|
10
|
+
* } catch (e) {
|
|
11
|
+
* msg.error(resolveApiErrorMessage(e))
|
|
12
|
+
* }
|
|
13
|
+
*/
|
|
14
|
+
export interface ApiError {
|
|
15
|
+
code?: string;
|
|
16
|
+
message?: string;
|
|
17
|
+
errors?: Record<string, string[]>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 从错误对象中提取可读的错误消息
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveApiErrorMessage(error: unknown): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 文本解析工具 — Markdown + 代码块分割
|
|
3
|
+
*
|
|
4
|
+
* 从 workflow-agent-chat/frontend/src/utils/textParser.ts 提取。
|
|
5
|
+
* 将消息正文拆成文本 / 代码块 / artifact 片段。
|
|
6
|
+
*/
|
|
7
|
+
export interface TextPart {
|
|
8
|
+
type: 'text' | 'code' | 'artifact';
|
|
9
|
+
content: string;
|
|
10
|
+
language?: string;
|
|
11
|
+
artifactType?: 'code' | 'json' | 'html' | 'form';
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 将消息正文拆成文本 / 代码块 / artifact 片段。
|
|
15
|
+
*/
|
|
16
|
+
export declare function splitTextAndCodeBlocks(content: string): TextPart[];
|
|
17
|
+
/**
|
|
18
|
+
* Markdown → 安全 HTML。
|
|
19
|
+
*/
|
|
20
|
+
export declare function renderMarkdown(content: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apform-ui/core",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "yangdongnan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"./tokens.css": "./src/tokens/tokens.css",
|
|
37
37
|
"./design-tokens.css": "./src/tokens/design-tokens.css",
|
|
38
|
+
"./styles/element-override.css": "./styles/element-override.css",
|
|
38
39
|
"./theme/*": "./src/theme/*",
|
|
39
40
|
"./styles/*": "./styles/*"
|
|
40
41
|
},
|
|
@@ -56,17 +57,21 @@
|
|
|
56
57
|
"prepublishOnly": "pnpm run build"
|
|
57
58
|
},
|
|
58
59
|
"peerDependencies": {
|
|
59
|
-
"
|
|
60
|
-
"
|
|
60
|
+
"element-plus": "2.14.2",
|
|
61
|
+
"vue": "^3.5.0"
|
|
61
62
|
},
|
|
62
63
|
"dependencies": {
|
|
64
|
+
"@element-plus/icons-vue": "^2.3.2",
|
|
65
|
+
"@iconify-icons/ep": "^1.2.0",
|
|
63
66
|
"@iconify/vue": "^5.0.0",
|
|
64
|
-
"
|
|
67
|
+
"dompurify": "^3.4.14",
|
|
68
|
+
"marked": "^18.0.11"
|
|
65
69
|
},
|
|
66
70
|
"devDependencies": {
|
|
67
71
|
"@types/node": "^26.0.1",
|
|
68
72
|
"@vitejs/plugin-vue": "^5.2.3",
|
|
69
73
|
"@vue/test-utils": "^2.4.6",
|
|
74
|
+
"element-plus": "2.14.2",
|
|
70
75
|
"jsdom": "^26.0.0",
|
|
71
76
|
"sass-embedded": "^1.100.0",
|
|
72
77
|
"typescript": "~5.7.3",
|
|
@@ -74,7 +79,6 @@
|
|
|
74
79
|
"vite-plugin-dts": "^5.0.3",
|
|
75
80
|
"vitest": "^3.2.1",
|
|
76
81
|
"vue": "^3.5.13",
|
|
77
|
-
"vue-tsc": "^2.2.8"
|
|
78
|
-
"element-plus": "2.14.2"
|
|
82
|
+
"vue-tsc": "^2.2.8"
|
|
79
83
|
}
|
|
80
84
|
}
|
package/src/tokens/index.ts
CHANGED
|
@@ -30,6 +30,22 @@ export const TEXT_COLORS = {
|
|
|
30
30
|
inverse: '#FFFFFF',
|
|
31
31
|
} as const
|
|
32
32
|
|
|
33
|
+
/** 字号(与 CSS --font-size-* 对齐) */
|
|
34
|
+
export const FONT_SIZE = {
|
|
35
|
+
10: '10px',
|
|
36
|
+
11: '11px',
|
|
37
|
+
12: '12px',
|
|
38
|
+
13: '13px',
|
|
39
|
+
14: '14px',
|
|
40
|
+
15: '15px',
|
|
41
|
+
16: '16px',
|
|
42
|
+
18: '18px',
|
|
43
|
+
20: '20px',
|
|
44
|
+
22: '22px',
|
|
45
|
+
24: '24px',
|
|
46
|
+
28: '28px',
|
|
47
|
+
} as const
|
|
48
|
+
|
|
33
49
|
/** 间距 */
|
|
34
50
|
export const SPACING = {
|
|
35
51
|
xs: '4px',
|
|
@@ -39,13 +55,75 @@ export const SPACING = {
|
|
|
39
55
|
xl: '32px',
|
|
40
56
|
'2xl': '48px',
|
|
41
57
|
'3xl': '64px',
|
|
58
|
+
10: '10px',
|
|
59
|
+
12: '12px',
|
|
60
|
+
20: '20px',
|
|
61
|
+
} as const
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 控件高度阶梯
|
|
65
|
+
* 全仓统计:32 > 28 > 24 > 40/44/48/60
|
|
66
|
+
*/
|
|
67
|
+
export const CONTROL_HEIGHT = {
|
|
68
|
+
xs: '24px',
|
|
69
|
+
sm: '28px',
|
|
70
|
+
md: '32px',
|
|
71
|
+
lg: '40px',
|
|
72
|
+
xl: '44px',
|
|
73
|
+
} as const
|
|
74
|
+
|
|
75
|
+
/** 布局高度 */
|
|
76
|
+
export const LAYOUT_HEIGHT = {
|
|
77
|
+
header: '56px',
|
|
78
|
+
conversationHeader: '68px',
|
|
79
|
+
dialogFooter: '60px',
|
|
80
|
+
toolbar: '48px',
|
|
81
|
+
tabs: '40px',
|
|
82
|
+
listRow: '48px',
|
|
83
|
+
} as const
|
|
84
|
+
|
|
85
|
+
/** 图标尺寸 */
|
|
86
|
+
export const ICON_SIZE = {
|
|
87
|
+
xs: '12px',
|
|
88
|
+
sm: '14px',
|
|
89
|
+
md: '16px',
|
|
90
|
+
lg: '20px',
|
|
91
|
+
xl: '24px',
|
|
92
|
+
} as const
|
|
93
|
+
|
|
94
|
+
/** 页面边距 */
|
|
95
|
+
export const PAGE = {
|
|
96
|
+
paddingX: '24px',
|
|
97
|
+
paddingY: '24px',
|
|
98
|
+
headerPaddingTop: '28px',
|
|
99
|
+
sidebarWidth: '240px',
|
|
100
|
+
sidebarWidthCollapsed: '64px',
|
|
42
101
|
} as const
|
|
43
102
|
|
|
44
103
|
/** 圆角 */
|
|
45
104
|
export const BORDER_RADIUS = {
|
|
46
105
|
sm: '2px',
|
|
47
106
|
md: '4px',
|
|
107
|
+
6: '6px',
|
|
108
|
+
8: '8px',
|
|
48
109
|
lg: '10px',
|
|
110
|
+
xl: '12px',
|
|
111
|
+
full: '999px',
|
|
112
|
+
} as const
|
|
113
|
+
|
|
114
|
+
/** 表单布局 */
|
|
115
|
+
export const FORM = {
|
|
116
|
+
fieldWidth: '220px',
|
|
117
|
+
labelWidth: '96px',
|
|
118
|
+
fieldGap: '6px',
|
|
119
|
+
} as const
|
|
120
|
+
|
|
121
|
+
/** 头像尺寸 */
|
|
122
|
+
export const AVATAR_SIZE = {
|
|
123
|
+
sm: '24px',
|
|
124
|
+
md: '32px',
|
|
125
|
+
lg: '40px',
|
|
126
|
+
xl: '48px',
|
|
49
127
|
} as const
|
|
50
128
|
|
|
51
129
|
/** 阴影 */
|
package/src/tokens/tokens.css
CHANGED
|
@@ -16,14 +16,19 @@
|
|
|
16
16
|
--font-family-number: 'Microsoft YaHei', '微软雅黑', 'DIN Alternate', Arial, sans-serif;
|
|
17
17
|
--font-family-mono: Consolas, Monaco, monospace;
|
|
18
18
|
|
|
19
|
-
/* 字体大小 */
|
|
19
|
+
/* 字体大小 — 覆盖全仓高频字号(11/12/13/14 占绝大多数) */
|
|
20
|
+
--font-size-10: 10px;
|
|
21
|
+
--font-size-11: 11px;
|
|
20
22
|
--font-size-12: 12px;
|
|
21
23
|
--font-size-13: 13px;
|
|
22
24
|
--font-size-14: 14px;
|
|
25
|
+
--font-size-15: 15px;
|
|
23
26
|
--font-size-16: 16px;
|
|
24
27
|
--font-size-18: 18px;
|
|
25
28
|
--font-size-20: 20px;
|
|
29
|
+
--font-size-22: 22px;
|
|
26
30
|
--font-size-24: 24px;
|
|
31
|
+
--font-size-28: 28px;
|
|
27
32
|
|
|
28
33
|
/* 字重 */
|
|
29
34
|
--font-weight-regular: 400;
|
|
@@ -113,14 +118,75 @@
|
|
|
113
118
|
--overlay-bg: rgba(0, 0, 0, 0.4);
|
|
114
119
|
|
|
115
120
|
/* ---------- 尺寸系统 ---------- */
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
/**
|
|
122
|
+
* 控件高度阶梯(全仓 height 统计:32 > 28 > 24 > 40/44/48/60)
|
|
123
|
+
* 业务代码请优先用 --control-height-*,勿再写死 px
|
|
124
|
+
*/
|
|
125
|
+
--control-height-xs: 24px;
|
|
126
|
+
--control-height-sm: 28px;
|
|
127
|
+
--control-height-md: 32px;
|
|
128
|
+
--control-height-lg: 40px;
|
|
129
|
+
--control-height-xl: 44px;
|
|
130
|
+
|
|
131
|
+
/* 语义别名(兼容历史变量名) */
|
|
132
|
+
--button-height: var(--control-height-md);
|
|
133
|
+
--button-height-sm: var(--control-height-sm);
|
|
134
|
+
--button-height-lg: var(--control-height-lg);
|
|
135
|
+
--input-height: var(--control-height-md);
|
|
136
|
+
--input-height-sm: var(--control-height-sm);
|
|
137
|
+
--input-height-lg: var(--control-height-lg);
|
|
138
|
+
|
|
139
|
+
/* 列表 / 详情行 */
|
|
140
|
+
--list-row-height: 48px;
|
|
141
|
+
--detail-item-height: var(--list-row-height);
|
|
142
|
+
--table-cell-padding-y: 8px;
|
|
143
|
+
|
|
144
|
+
/* 布局高度 */
|
|
145
|
+
--header-height: 56px;
|
|
146
|
+
--conversation-header-height: 68px;
|
|
120
147
|
--dialog-footer-height: 60px;
|
|
148
|
+
--toolbar-height: 48px;
|
|
149
|
+
--tabs-height: 40px;
|
|
150
|
+
|
|
151
|
+
/* 侧栏 / 页面边距 */
|
|
152
|
+
--sidebar-width: 240px;
|
|
153
|
+
--sidebar-width-collapsed: 64px;
|
|
154
|
+
--page-padding-x: 24px;
|
|
155
|
+
--page-padding-y: 24px;
|
|
156
|
+
--page-padding-bottom: var(--page-padding-y);
|
|
157
|
+
--page-header-padding-top: 28px;
|
|
158
|
+
|
|
159
|
+
/* 图标尺寸阶梯 */
|
|
160
|
+
--icon-size-xs: 12px;
|
|
161
|
+
--icon-size-sm: 14px;
|
|
162
|
+
--icon-size-md: 16px;
|
|
163
|
+
--icon-size-lg: 20px;
|
|
164
|
+
--icon-size-xl: 24px;
|
|
165
|
+
|
|
166
|
+
/* 圆角(含聊天 / Tabs 常用 6、8) */
|
|
121
167
|
--border-radius-sm: 2px;
|
|
122
168
|
--border-radius-md: 4px;
|
|
169
|
+
--border-radius-6: 6px;
|
|
170
|
+
--border-radius-8: 8px;
|
|
123
171
|
--border-radius-lg: 10px;
|
|
172
|
+
--border-radius-xl: 12px;
|
|
173
|
+
--border-radius-full: 999px;
|
|
174
|
+
|
|
175
|
+
/* 表单布局 */
|
|
176
|
+
--form-field-width: 220px;
|
|
177
|
+
--form-label-width: 96px;
|
|
178
|
+
--form-field-gap: 6px;
|
|
179
|
+
|
|
180
|
+
/* 头像尺寸 */
|
|
181
|
+
--avatar-size-sm: 24px;
|
|
182
|
+
--avatar-size-md: 32px;
|
|
183
|
+
--avatar-size-lg: 40px;
|
|
184
|
+
--avatar-size-xl: 48px;
|
|
185
|
+
|
|
186
|
+
/* Composer / 多行输入 */
|
|
187
|
+
--composer-textarea-min-height: 96px;
|
|
188
|
+
--composer-textarea-min-height-mobile: 84px;
|
|
189
|
+
--composer-textarea-max-height: 220px;
|
|
124
190
|
|
|
125
191
|
/* 间距 */
|
|
126
192
|
--spacing-xs: 4px;
|
|
@@ -128,6 +194,9 @@
|
|
|
128
194
|
--spacing-md: 16px;
|
|
129
195
|
--spacing-lg: 24px;
|
|
130
196
|
--spacing-xl: 32px;
|
|
197
|
+
--spacing-2xl: 48px;
|
|
198
|
+
--spacing-3xl: 64px;
|
|
131
199
|
--spacing-10px: 10px;
|
|
200
|
+
--spacing-12px: 12px;
|
|
132
201
|
--spacing-20px: 20px;
|
|
133
202
|
}
|