@svadmin/ui 0.112.0 → 0.113.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.
Files changed (46) hide show
  1. package/dist/app.css +207 -0
  2. package/dist/app.theme.css +207 -0
  3. package/dist/components/AboutSettings.svelte +1 -1
  4. package/dist/components/FormDependency.svelte +36 -0
  5. package/dist/components/FormDependency.svelte.d.ts +12 -0
  6. package/dist/components/PageContainer.svelte +263 -0
  7. package/dist/components/PageContainer.svelte.d.ts +53 -0
  8. package/dist/components/ProDescriptions.svelte +278 -0
  9. package/dist/components/ProDescriptions.svelte.d.ts +37 -0
  10. package/dist/components/QueryFilter.svelte +194 -0
  11. package/dist/components/QueryFilter.svelte.d.ts +34 -0
  12. package/dist/components/RealtimeMonitorView.svelte +245 -0
  13. package/dist/components/RealtimeMonitorView.svelte.d.ts +40 -0
  14. package/dist/components/RoleSwitcher.svelte +267 -0
  15. package/dist/components/RoleSwitcher.svelte.d.ts +40 -0
  16. package/dist/components/WorkflowDesigner.svelte +244 -0
  17. package/dist/components/WorkflowDesigner.svelte.d.ts +29 -0
  18. package/dist/components/fields/UploadField.svelte +222 -0
  19. package/dist/components/fields/UploadField.svelte.d.ts +14 -0
  20. package/dist/components/icons/IconApprove.svelte +35 -0
  21. package/dist/components/icons/IconApprove.svelte.d.ts +4 -0
  22. package/dist/components/icons/IconAudit.svelte +38 -0
  23. package/dist/components/icons/IconAudit.svelte.d.ts +4 -0
  24. package/dist/components/icons/IconBilling.svelte +37 -0
  25. package/dist/components/icons/IconBilling.svelte.d.ts +4 -0
  26. package/dist/components/icons/IconCluster.svelte +41 -0
  27. package/dist/components/icons/IconCluster.svelte.d.ts +4 -0
  28. package/dist/components/icons/IconMonitor.svelte +37 -0
  29. package/dist/components/icons/IconMonitor.svelte.d.ts +4 -0
  30. package/dist/components/icons/IconReject.svelte +36 -0
  31. package/dist/components/icons/IconReject.svelte.d.ts +4 -0
  32. package/dist/components/icons/IconSeal.svelte +36 -0
  33. package/dist/components/icons/IconSeal.svelte.d.ts +4 -0
  34. package/dist/components/icons/IconSecurity.svelte +35 -0
  35. package/dist/components/icons/IconSecurity.svelte.d.ts +4 -0
  36. package/dist/components/icons/IconTenant.svelte +39 -0
  37. package/dist/components/icons/IconTenant.svelte.d.ts +4 -0
  38. package/dist/components/icons/IconWorkflow.svelte +38 -0
  39. package/dist/components/icons/IconWorkflow.svelte.d.ts +4 -0
  40. package/dist/components/icons/index.d.ts +11 -0
  41. package/dist/components/icons/index.js +10 -0
  42. package/dist/components/icons/types.d.ts +15 -0
  43. package/dist/components/icons/types.js +1 -0
  44. package/dist/index.d.ts +22 -5
  45. package/dist/index.js +16 -5
  46. package/package.json +5 -5
@@ -0,0 +1,267 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import { cn } from '../utils.js';
4
+ import IconSecurity from './icons/IconSecurity.svelte';
5
+ import IconTenant from './icons/IconTenant.svelte';
6
+ import IconApprove from './icons/IconApprove.svelte';
7
+
8
+ export interface RoleItem {
9
+ /** Unique role identifier */
10
+ key: string;
11
+ /** Human-readable role display name */
12
+ label: string;
13
+ /** Short role description */
14
+ description?: string;
15
+ /** Permissions array associated with this role */
16
+ permissions?: string[];
17
+ /** Organization or tenant name */
18
+ tenant?: string;
19
+ /** Optional badge text or tag */
20
+ badge?: string;
21
+ /** Whether the role is disabled */
22
+ disabled?: boolean;
23
+ }
24
+
25
+ export interface RoleSwitcherProps {
26
+ /** List of available mock roles */
27
+ roles?: RoleItem[];
28
+ /** Currently active role key */
29
+ activeRole?: string;
30
+ /** Title shown in the role switcher drawer/popover */
31
+ title?: string;
32
+ /** Trigger button label override */
33
+ triggerText?: string;
34
+ /** Compact mode (icon or minimal badge only) */
35
+ compact?: boolean;
36
+ /** Callback when a role is selected */
37
+ onroleswitch?: (role: RoleItem) => void;
38
+ /** Callback when reset to standard role */
39
+ onreset?: () => void;
40
+ /** Custom extra action in footer */
41
+ extra?: Snippet;
42
+ /** Additional CSS classes */
43
+ class?: string;
44
+ }
45
+
46
+ let {
47
+ roles = [
48
+ {
49
+ key: 'super_admin',
50
+ label: '超级管理员',
51
+ description: '系统最高权限,具备所有模块的写操作、系统审计与多租户管理权限',
52
+ permissions: ['system:write', 'user:admin', 'audit:export', 'tenant:full'],
53
+ tenant: '全平台 (Root)',
54
+ badge: '全量',
55
+ },
56
+ {
57
+ key: 'operator',
58
+ label: '运营专家',
59
+ description: '负责业务数据运营、活动流转与内容审核,不可修改核心系统配置',
60
+ permissions: ['order:read', 'order:audit', 'marketing:write', 'content:publish'],
61
+ tenant: '华东大区运营中心',
62
+ },
63
+ {
64
+ key: 'developer',
65
+ label: '研发技术专员',
66
+ description: '拥有 API 网关配置、自动化脚本调试与系统监控诊断权限',
67
+ permissions: ['gateway:config', 'monitor:read', 'devtools:debug'],
68
+ tenant: '技术工程部',
69
+ },
70
+ {
71
+ key: 'auditor',
72
+ label: '合规审计员',
73
+ description: '仅具备全局只读与全量不可篡改审计日志导出检索权限',
74
+ permissions: ['audit:read', 'audit:export', 'log:immutable'],
75
+ tenant: '风险与合规法务组',
76
+ badge: '只读',
77
+ },
78
+ {
79
+ key: 'guest',
80
+ label: '访客体验角色',
81
+ description: '仅用于公共视图预览,受限于最低数据展示策略',
82
+ permissions: ['public:view'],
83
+ tenant: '演示沙盒环境',
84
+ disabled: false,
85
+ },
86
+ ],
87
+ activeRole = 'super_admin',
88
+ title = '角色与权限模拟器',
89
+ triggerText,
90
+ compact = false,
91
+ onroleswitch,
92
+ onreset,
93
+ extra,
94
+ class: className = '',
95
+ }: RoleSwitcherProps = $props();
96
+
97
+ let isOpen = $state(false);
98
+ let selectedRoleKey = $derived(activeRole);
99
+
100
+ const fallbackRole: RoleItem = {
101
+ key: 'none',
102
+ label: '未选择角色',
103
+ description: '当前没有可用的角色配置。',
104
+ };
105
+ const currentRole = $derived(roles.find((r) => r.key === selectedRoleKey) ?? roles[0] ?? fallbackRole);
106
+
107
+ function handleSelect(role: RoleItem) {
108
+ if (role.disabled) return;
109
+ selectedRoleKey = role.key;
110
+ onroleswitch?.(role);
111
+ isOpen = false;
112
+ }
113
+
114
+ function handleReset() {
115
+ selectedRoleKey = roles[0]?.key || 'super_admin';
116
+ const fallback = roles[0];
117
+ if (fallback) {
118
+ onroleswitch?.(fallback);
119
+ }
120
+ onreset?.();
121
+ isOpen = false;
122
+ }
123
+ </script>
124
+
125
+ <div
126
+ data-svadmin-component="RoleSwitcher"
127
+ class={cn('svadmin-role-switcher relative inline-block text-foreground', className)}
128
+ >
129
+ <!-- Trigger Button -->
130
+ <button
131
+ type="button"
132
+ aria-haspopup="dialog"
133
+ aria-expanded={isOpen}
134
+ onclick={() => (isOpen = !isOpen)}
135
+ class={cn(
136
+ 'inline-flex items-center gap-2 px-3 py-1.5 rounded-[4px] border border-border bg-card text-xs font-medium text-foreground hover:bg-muted/70 transition-colors shadow-sm focus:outline-none focus:ring-1 focus:ring-primary',
137
+ isOpen && 'border-primary ring-1 ring-primary'
138
+ )}
139
+ >
140
+ <div class="flex items-center justify-center w-5 h-5 rounded-[4px] bg-primary/10 text-primary shrink-0">
141
+ <IconSecurity size={13} />
142
+ </div>
143
+ {#if !compact}
144
+ <div class="flex flex-col text-left">
145
+ <span class="text-[10px] text-muted-foreground leading-tight">模拟角色</span>
146
+ <span class="font-semibold text-xs leading-none">{triggerText || currentRole.label}</span>
147
+ </div>
148
+ {/if}
149
+ <span class="inline-block px-1.5 py-0.2 rounded-[2px] bg-primary/15 text-[10px] text-primary font-mono font-medium">
150
+ {currentRole.key}
151
+ </span>
152
+ <svg
153
+ class={cn('w-3.5 h-3.5 text-muted-foreground transition-transform shrink-0', isOpen && 'rotate-180')}
154
+ fill="none"
155
+ viewBox="0 0 24 24"
156
+ stroke="currentColor"
157
+ >
158
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
159
+ </svg>
160
+ </button>
161
+
162
+ <!-- Overlay Dropdown Card -->
163
+ {#if isOpen}
164
+ <!-- Backdrop to close -->
165
+ <div
166
+ class="fixed inset-0 z-40"
167
+ tabindex="-1"
168
+ role="presentation"
169
+ onclick={() => (isOpen = false)}
170
+ onkeydown={(e) => e.key === 'Escape' && (isOpen = false)}
171
+ ></div>
172
+
173
+ <div
174
+ role="dialog"
175
+ aria-label={title}
176
+ class="absolute right-0 top-full mt-1.5 z-50 w-80 sm:w-96 rounded-[4px] border border-border bg-card p-3.5 shadow-xl text-xs flex flex-col gap-3 animate-in fade-in zoom-in-95 duration-100"
177
+ >
178
+ <!-- Header -->
179
+ <div class="flex items-center justify-between pb-2 border-b border-border">
180
+ <div class="flex items-center gap-2">
181
+ <IconTenant size={15} class="text-primary" />
182
+ <span class="font-semibold text-sm">{title}</span>
183
+ </div>
184
+ <button
185
+ type="button"
186
+ onclick={handleReset}
187
+ class="text-[11px] text-muted-foreground hover:text-primary transition-colors cursor-pointer"
188
+ >
189
+ 重置默认
190
+ </button>
191
+ </div>
192
+
193
+ <!-- Role Items List -->
194
+ <div class="flex flex-col gap-2 max-h-72 overflow-y-auto pr-1">
195
+ {#each roles as role (role.key)}
196
+ {@const isSelected = role.key === selectedRoleKey}
197
+ <button
198
+ type="button"
199
+ disabled={role.disabled}
200
+ onclick={() => handleSelect(role)}
201
+ class={cn(
202
+ 'group w-full flex flex-col items-start gap-1 p-2.5 rounded-[4px] border transition-all text-left cursor-pointer',
203
+ isSelected
204
+ ? 'border-primary bg-primary/5 text-foreground shadow-sm'
205
+ : 'border-border/60 hover:border-border hover:bg-muted/40',
206
+ role.disabled && 'opacity-50 cursor-not-allowed'
207
+ )}
208
+ >
209
+ <div class="flex items-center justify-between w-full">
210
+ <div class="flex items-center gap-2">
211
+ <span class={cn('font-medium text-xs', isSelected ? 'text-primary font-semibold' : 'text-foreground')}>
212
+ {role.label}
213
+ </span>
214
+ {#if role.badge}
215
+ <span class="px-1.5 py-0.5 rounded-[2px] bg-primary/10 text-primary text-[10px] font-medium">
216
+ {role.badge}
217
+ </span>
218
+ {/if}
219
+ </div>
220
+ {#if isSelected}
221
+ <span class="flex items-center gap-1 text-[11px] text-primary font-medium">
222
+ <IconApprove size={13} />
223
+ 已生效
224
+ </span>
225
+ {/if}
226
+ </div>
227
+
228
+ {#if role.description}
229
+ <p class="text-[11px] text-muted-foreground line-clamp-2 leading-relaxed">
230
+ {role.description}
231
+ </p>
232
+ {/if}
233
+
234
+ {#if role.tenant}
235
+ <div class="flex items-center gap-1 text-[10px] text-muted-foreground/80 mt-0.5">
236
+ <span>所属部门/租户:</span>
237
+ <span class="font-medium text-foreground/80">{role.tenant}</span>
238
+ </div>
239
+ {/if}
240
+
241
+ {#if role.permissions && role.permissions.length > 0}
242
+ <div class="flex flex-wrap gap-1 mt-1.5 pt-1.5 border-t border-border/40 w-full">
243
+ {#each role.permissions.slice(0, 4) as perm (perm)}
244
+ <span class="px-1 py-0.2 rounded-[2px] bg-muted text-[10px] text-muted-foreground font-mono">
245
+ {perm}
246
+ </span>
247
+ {/each}
248
+ {#if role.permissions.length > 4}
249
+ <span class="text-[10px] text-muted-foreground/70 self-center">
250
+ +{role.permissions.length - 4}
251
+ </span>
252
+ {/if}
253
+ </div>
254
+ {/if}
255
+ </button>
256
+ {/each}
257
+ </div>
258
+
259
+ <!-- Footer Actions -->
260
+ {#if extra}
261
+ <div class="pt-2 border-t border-border flex items-center justify-end">
262
+ {@render extra()}
263
+ </div>
264
+ {/if}
265
+ </div>
266
+ {/if}
267
+ </div>
@@ -0,0 +1,40 @@
1
+ import type { Snippet } from 'svelte';
2
+ export interface RoleItem {
3
+ /** Unique role identifier */
4
+ key: string;
5
+ /** Human-readable role display name */
6
+ label: string;
7
+ /** Short role description */
8
+ description?: string;
9
+ /** Permissions array associated with this role */
10
+ permissions?: string[];
11
+ /** Organization or tenant name */
12
+ tenant?: string;
13
+ /** Optional badge text or tag */
14
+ badge?: string;
15
+ /** Whether the role is disabled */
16
+ disabled?: boolean;
17
+ }
18
+ export interface RoleSwitcherProps {
19
+ /** List of available mock roles */
20
+ roles?: RoleItem[];
21
+ /** Currently active role key */
22
+ activeRole?: string;
23
+ /** Title shown in the role switcher drawer/popover */
24
+ title?: string;
25
+ /** Trigger button label override */
26
+ triggerText?: string;
27
+ /** Compact mode (icon or minimal badge only) */
28
+ compact?: boolean;
29
+ /** Callback when a role is selected */
30
+ onroleswitch?: (role: RoleItem) => void;
31
+ /** Callback when reset to standard role */
32
+ onreset?: () => void;
33
+ /** Custom extra action in footer */
34
+ extra?: Snippet;
35
+ /** Additional CSS classes */
36
+ class?: string;
37
+ }
38
+ declare const RoleSwitcher: import("svelte").Component<RoleSwitcherProps, {}, "">;
39
+ type RoleSwitcher = ReturnType<typeof RoleSwitcher>;
40
+ export default RoleSwitcher;
@@ -0,0 +1,244 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import { cn } from '../utils';
4
+
5
+ export interface WorkflowNode {
6
+ id: string;
7
+ type: 'start' | 'approver' | 'condition' | 'notifier';
8
+ title: string;
9
+ content?: string;
10
+ status?: 'pending' | 'active' | 'completed' | 'rejected';
11
+ error?: string;
12
+ assignees?: string[];
13
+ }
14
+
15
+ export interface WorkflowDesignerProps {
16
+ /** List of workflow steps in linear or branching order */
17
+ nodes?: WorkflowNode[];
18
+ /** Whether the designer is in view-only / execution status mode */
19
+ readonly?: boolean;
20
+ /** Callback when a node card is clicked for editing */
21
+ onnodeclick?: (node: WorkflowNode) => void;
22
+ /** Callback when an add node button is clicked */
23
+ onaddnode?: (targetNodeId: string, type: 'approver' | 'condition' | 'notifier') => void;
24
+ /** Callback when a node is removed */
25
+ ondeletenode?: (nodeId: string) => void;
26
+ /** Extra header or toolbar slot */
27
+ extra?: Snippet;
28
+ /** Additional CSS classes */
29
+ class?: string;
30
+ }
31
+
32
+ let {
33
+ nodes = [
34
+ { id: '1', type: 'start', title: '发起人', content: '所有人' },
35
+ { id: '2', type: 'approver', title: '直属主管审批', content: '主管审批' },
36
+ { id: '3', type: 'notifier', title: '抄送人', content: '抄送发起人' },
37
+ ],
38
+ readonly = false,
39
+ onnodeclick,
40
+ onaddnode,
41
+ ondeletenode,
42
+ extra,
43
+ class: className = '',
44
+ }: WorkflowDesignerProps = $props();
45
+
46
+ let activeAddMenuId = $state<string | null>(null);
47
+
48
+ function getNodeTypeColor(type: WorkflowNode['type']) {
49
+ switch (type) {
50
+ case 'start':
51
+ return {
52
+ headerBg: 'bg-primary',
53
+ headerText: 'text-primary-foreground',
54
+ badge: '发起',
55
+ };
56
+ case 'approver':
57
+ return {
58
+ headerBg: 'bg-warning',
59
+ headerText: 'text-warning-foreground',
60
+ badge: '审批人',
61
+ };
62
+ case 'condition':
63
+ return {
64
+ headerBg: 'bg-success',
65
+ headerText: 'text-success-foreground',
66
+ badge: '条件分支',
67
+ };
68
+ case 'notifier':
69
+ return {
70
+ headerBg: 'bg-info',
71
+ headerText: 'text-info-foreground',
72
+ badge: '抄送人',
73
+ };
74
+ default:
75
+ return {
76
+ headerBg: 'bg-muted-foreground',
77
+ headerText: 'text-background',
78
+ badge: '节点',
79
+ };
80
+ }
81
+ }
82
+
83
+ function getStatusTone(status?: WorkflowNode['status']) {
84
+ switch (status) {
85
+ case 'completed':
86
+ return 'bg-success/10 text-success border-success/30';
87
+ case 'active':
88
+ return 'bg-primary/10 text-primary border-primary/30';
89
+ case 'rejected':
90
+ return 'bg-destructive/10 text-destructive border-destructive/30';
91
+ case 'pending':
92
+ default:
93
+ return 'bg-muted text-muted-foreground border-border';
94
+ }
95
+ }
96
+
97
+ function handleAdd(nodeId: string, type: 'approver' | 'condition' | 'notifier') {
98
+ onaddnode?.(nodeId, type);
99
+ activeAddMenuId = null;
100
+ }
101
+ </script>
102
+
103
+ <div
104
+ data-svadmin-component="WorkflowDesigner"
105
+ class={cn(
106
+ 'svadmin-workflow-designer relative flex w-full flex-col items-center justify-start bg-background py-6',
107
+ className
108
+ )}
109
+ >
110
+ {#if extra}
111
+ <div class="mb-4 flex w-full max-w-md items-center justify-end px-4">
112
+ {@render extra()}
113
+ </div>
114
+ {/if}
115
+
116
+ <div class="relative flex flex-col items-center gap-0">
117
+ {#each nodes as node, index (node.id)}
118
+ {@const colors = getNodeTypeColor(node.type)}
119
+ <!-- Node Card -->
120
+ <div class="group/node relative flex w-72 flex-col rounded-[4px] border border-border bg-card shadow-xs transition-all hover:shadow-md">
121
+ <!-- Node Header -->
122
+ <div class={cn('flex items-center justify-between px-3 py-1.5 rounded-t-[3px]', colors.headerBg, colors.headerText)}>
123
+ <div class="flex items-center gap-1.5 text-xs font-medium">
124
+ <span>{node.title}</span>
125
+ </div>
126
+
127
+ <div class="flex items-center gap-1">
128
+ {#if node.status}
129
+ <span class={cn('rounded-[2px] border px-1.5 py-0.2 text-[10px] font-normal leading-tight', getStatusTone(node.status))}>
130
+ {node.status}
131
+ </span>
132
+ {/if}
133
+
134
+ {#if !readonly && node.type !== 'start'}
135
+ <button
136
+ type="button"
137
+ aria-label={`删除 ${node.title}`}
138
+ class="opacity-0 transition-opacity group-hover/node:opacity-100 p-0.5 text-white/80 hover:text-white"
139
+ onclick={(e) => {
140
+ e.stopPropagation();
141
+ ondeletenode?.(node.id);
142
+ }}
143
+ >
144
+ <svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
145
+ <line x1="18" y1="6" x2="6" y2="18" />
146
+ <line x1="6" y1="6" x2="18" y2="18" />
147
+ </svg>
148
+ </button>
149
+ {/if}
150
+ </div>
151
+ </div>
152
+
153
+ <!-- Node Body -->
154
+ <button
155
+ type="button"
156
+ class="flex w-full flex-col items-start p-3 text-left transition-colors hover:bg-muted/30 focus-visible:outline-none"
157
+ onclick={() => onnodeclick?.(node)}
158
+ >
159
+ <div class="text-xs text-foreground line-clamp-2">
160
+ {node.content || '请设置节点属性'}
161
+ </div>
162
+
163
+ {#if node.assignees && node.assignees.length > 0}
164
+ <div class="mt-2 flex flex-wrap gap-1">
165
+ {#each node.assignees as assignee (assignee)}
166
+ <span class="rounded-[2px] bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground">
167
+ {assignee}
168
+ </span>
169
+ {/each}
170
+ </div>
171
+ {/if}
172
+
173
+ {#if node.error}
174
+ <span class="mt-1 text-[11px] text-destructive">
175
+ {node.error}
176
+ </span>
177
+ {/if}
178
+ </button>
179
+ </div>
180
+
181
+ <!-- Connecting line and Add Button -->
182
+ {#if index < nodes.length - 1 || !readonly}
183
+ <div class="relative flex h-14 w-full flex-col items-center justify-center">
184
+ <div class="h-full w-[1.5px] bg-border"></div>
185
+
186
+ {#if !readonly}
187
+ <div class="absolute inset-auto flex items-center justify-center">
188
+ <button
189
+ type="button"
190
+ aria-label="添加节点"
191
+ class="inline-flex h-6 w-6 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-xs transition-transform hover:scale-110 active:scale-95 focus-visible:outline-none"
192
+ onclick={() => {
193
+ activeAddMenuId = activeAddMenuId === node.id ? null : node.id;
194
+ }}
195
+ >
196
+ <svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
197
+ <line x1="12" y1="5" x2="12" y2="19" />
198
+ <line x1="5" y1="12" x2="19" y2="12" />
199
+ </svg>
200
+ </button>
201
+
202
+ {#if activeAddMenuId === node.id}
203
+ <!-- Add Node Menu Modal/Popover -->
204
+ <div class="absolute top-8 z-30 flex w-48 flex-col rounded-[4px] border border-border bg-card p-1.5 shadow-lg">
205
+ <button
206
+ type="button"
207
+ class="flex items-center gap-2 rounded-[2px] px-2.5 py-1.5 text-xs text-foreground transition-colors hover:bg-muted"
208
+ onclick={() => handleAdd(node.id, 'approver')}
209
+ >
210
+ <span class="h-2 w-2 rounded-full bg-warning"></span>
211
+ <span>审批人节点</span>
212
+ </button>
213
+ <button
214
+ type="button"
215
+ class="flex items-center gap-2 rounded-[2px] px-2.5 py-1.5 text-xs text-foreground transition-colors hover:bg-muted"
216
+ onclick={() => handleAdd(node.id, 'notifier')}
217
+ >
218
+ <span class="h-2 w-2 rounded-full bg-info"></span>
219
+ <span>抄送人节点</span>
220
+ </button>
221
+ <button
222
+ type="button"
223
+ class="flex items-center gap-2 rounded-[2px] px-2.5 py-1.5 text-xs text-foreground transition-colors hover:bg-muted"
224
+ onclick={() => handleAdd(node.id, 'condition')}
225
+ >
226
+ <span class="h-2 w-2 rounded-full bg-success"></span>
227
+ <span>条件分支</span>
228
+ </button>
229
+ </div>
230
+ {/if}
231
+ </div>
232
+ {/if}
233
+ </div>
234
+ {/if}
235
+ {/each}
236
+
237
+ <!-- End Node -->
238
+ <div class="flex items-center justify-center">
239
+ <div class="rounded-full bg-muted px-4 py-1 text-xs text-muted-foreground select-none">
240
+ 流程结束
241
+ </div>
242
+ </div>
243
+ </div>
244
+ </div>
@@ -0,0 +1,29 @@
1
+ import type { Snippet } from 'svelte';
2
+ export interface WorkflowNode {
3
+ id: string;
4
+ type: 'start' | 'approver' | 'condition' | 'notifier';
5
+ title: string;
6
+ content?: string;
7
+ status?: 'pending' | 'active' | 'completed' | 'rejected';
8
+ error?: string;
9
+ assignees?: string[];
10
+ }
11
+ export interface WorkflowDesignerProps {
12
+ /** List of workflow steps in linear or branching order */
13
+ nodes?: WorkflowNode[];
14
+ /** Whether the designer is in view-only / execution status mode */
15
+ readonly?: boolean;
16
+ /** Callback when a node card is clicked for editing */
17
+ onnodeclick?: (node: WorkflowNode) => void;
18
+ /** Callback when an add node button is clicked */
19
+ onaddnode?: (targetNodeId: string, type: 'approver' | 'condition' | 'notifier') => void;
20
+ /** Callback when a node is removed */
21
+ ondeletenode?: (nodeId: string) => void;
22
+ /** Extra header or toolbar slot */
23
+ extra?: Snippet;
24
+ /** Additional CSS classes */
25
+ class?: string;
26
+ }
27
+ declare const WorkflowDesigner: import("svelte").Component<WorkflowDesignerProps, {}, "">;
28
+ type WorkflowDesigner = ReturnType<typeof WorkflowDesigner>;
29
+ export default WorkflowDesigner;