@svadmin/ui 0.120.0 → 0.122.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/dist/app.css +336 -7
- package/dist/app.theme.css +336 -7
- package/dist/components/AboutSettings.svelte +1 -1
- package/dist/components/AnnouncementBanner.svelte +314 -0
- package/dist/components/AnnouncementBanner.svelte.d.ts +45 -0
- package/dist/components/AsyncExportModal.svelte +551 -0
- package/dist/components/AsyncExportModal.svelte.d.ts +50 -0
- package/dist/components/AudioFeedbackProvider.svelte +131 -0
- package/dist/components/AudioFeedbackProvider.svelte.d.ts +11 -0
- package/dist/components/AuditLogViewer.svelte +1 -1
- package/dist/components/CanvasAnnotation.svelte +1 -1
- package/dist/components/ColumnFilterBuilder.svelte +135 -0
- package/dist/components/ColumnFilterBuilder.svelte.d.ts +20 -0
- package/dist/components/ColumnSettings.svelte +1 -1
- package/dist/components/ColumnVisibilityDrawer.svelte +541 -0
- package/dist/components/ColumnVisibilityDrawer.svelte.d.ts +16 -0
- package/dist/components/ConcurrentConflictModal.svelte +7 -7
- package/dist/components/ContextMenu.svelte +268 -0
- package/dist/components/ContextMenu.svelte.d.ts +22 -0
- package/dist/components/ConversionFunnel.svelte +154 -0
- package/dist/components/ConversionFunnel.svelte.d.ts +22 -0
- package/dist/components/CronExpressionBuilder.svelte +1 -1
- package/dist/components/DecisionTable.svelte +1 -1
- package/dist/components/DevTools.svelte +1 -1
- package/dist/components/DraggableRowTable.svelte +1 -1
- package/dist/components/DualApprovalGate.svelte +418 -0
- package/dist/components/DualApprovalGate.svelte.d.ts +39 -0
- package/dist/components/EditableTable.svelte +1 -1
- package/dist/components/ExcelImportWizard.svelte +2 -2
- package/dist/components/GlobalShortcuts.svelte +1 -1
- package/dist/components/ImageCropper.svelte +1 -1
- package/dist/components/ImportWizard.svelte +1 -1
- package/dist/components/JsonSchemaForm.svelte +1 -1
- package/dist/components/JsonViewer.svelte +323 -0
- package/dist/components/JsonViewer.svelte.d.ts +20 -0
- package/dist/components/KeyboardShortcutsModal.svelte +362 -0
- package/dist/components/KeyboardShortcutsModal.svelte.d.ts +22 -0
- package/dist/components/KpiCard.svelte +250 -0
- package/dist/components/KpiCard.svelte.d.ts +44 -0
- package/dist/components/MasterDetailView.svelte +1 -1
- package/dist/components/MetricGrid.svelte +2 -2
- package/dist/components/MicroAppBridge.svelte +59 -0
- package/dist/components/MicroAppBridge.svelte.d.ts +11 -0
- package/dist/components/OfflineSyncBanner.svelte +1 -1
- package/dist/components/OrgChart.svelte +1 -1
- package/dist/components/OrgTreePicker.svelte +1 -1
- package/dist/components/OtpInput.svelte +209 -0
- package/dist/components/OtpInput.svelte.d.ts +17 -0
- package/dist/components/PdfDocumentViewer.svelte +2 -2
- package/dist/components/PivotDrilldownModal.svelte +6 -6
- package/dist/components/PivotTable.svelte +1 -1
- package/dist/components/PricingCard.svelte +1 -1
- package/dist/components/PricingTable.svelte +1 -1
- package/dist/components/PrintableBill.svelte +2 -2
- package/dist/components/PrintableReportLayout.svelte +259 -0
- package/dist/components/PrintableReportLayout.svelte.d.ts +32 -0
- package/dist/components/ProSkeleton.svelte +6 -6
- package/dist/components/RecordCompareModal.svelte +428 -0
- package/dist/components/RecordCompareModal.svelte.d.ts +42 -0
- package/dist/components/ResultPage.svelte +166 -0
- package/dist/components/ResultPage.svelte.d.ts +28 -0
- package/dist/components/SafeDeleteConfirm.svelte +5 -5
- package/dist/components/SankeyChart.svelte +111 -0
- package/dist/components/SankeyChart.svelte.d.ts +22 -0
- package/dist/components/SchemaVisualModeler.svelte +336 -0
- package/dist/components/SchemaVisualModeler.svelte.d.ts +17 -0
- package/dist/components/SensitiveDataMask.svelte +81 -22
- package/dist/components/SensitiveDataMask.svelte.d.ts +15 -10
- package/dist/components/SessionTimeoutGuard.svelte +154 -0
- package/dist/components/SessionTimeoutGuard.svelte.d.ts +25 -0
- package/dist/components/SignaturePad.svelte +231 -67
- package/dist/components/SignaturePad.svelte.d.ts +6 -5
- package/dist/components/SliderCaptcha.svelte +1 -1
- package/dist/components/SplitPaneLayout.svelte +1 -1
- package/dist/components/SpreadsheetView.svelte +1 -1
- package/dist/components/StepForm.svelte +1 -1
- package/dist/components/StepWizard.svelte +513 -0
- package/dist/components/StepWizard.svelte.d.ts +49 -0
- package/dist/components/TableClipboardManager.svelte +307 -0
- package/dist/components/TableClipboardManager.svelte.d.ts +13 -0
- package/dist/components/TaskCenter.svelte +9 -9
- package/dist/components/TextDiffViewer.svelte +613 -0
- package/dist/components/TextDiffViewer.svelte.d.ts +39 -0
- package/dist/components/Tour.svelte +71 -13
- package/dist/components/Tour.svelte.d.ts +1 -1
- package/dist/components/TreeTransfer.svelte +1 -1
- package/dist/components/TrendIndicator.svelte +21 -13
- package/dist/components/TrendIndicator.svelte.d.ts +4 -2
- package/dist/components/UnsavedChangesGuard.svelte +138 -0
- package/dist/components/UnsavedChangesGuard.svelte.d.ts +32 -0
- package/dist/components/UsageCard.svelte +1 -1
- package/dist/components/VersionDiffViewer.svelte +1 -1
- package/dist/components/VirtualTable.svelte +1 -1
- package/dist/components/VirtualTreeSelect.svelte +1 -1
- package/dist/components/WatermarkContainer.svelte +196 -0
- package/dist/components/WatermarkContainer.svelte.d.ts +20 -0
- package/dist/components/WorkflowDesigner.svelte +3 -3
- package/dist/components/WorkflowProcessCard.svelte +1 -1
- package/dist/components/WorkflowStepper.svelte +250 -0
- package/dist/components/WorkflowStepper.svelte.d.ts +27 -0
- package/dist/components/charts/GaugeChart.svelte +1 -1
- package/dist/components/useAudioAlert.d.svelte.ts +1 -0
- package/dist/components/useAudioAlert.svelte.d.ts +13 -0
- package/dist/components/useAudioAlert.svelte.js +90 -0
- package/dist/components/useHotkeys.d.svelte.ts +1 -0
- package/dist/components/useHotkeys.svelte.d.ts +44 -0
- package/dist/components/useHotkeys.svelte.js +190 -0
- package/dist/components/useMicroAppEvent.d.svelte.ts +1 -0
- package/dist/components/useMicroAppEvent.svelte.d.ts +16 -0
- package/dist/components/useMicroAppEvent.svelte.js +61 -0
- package/dist/components/usePrintExport.d.svelte.ts +1 -0
- package/dist/components/usePrintExport.svelte.d.ts +11 -0
- package/dist/components/usePrintExport.svelte.js +45 -0
- package/dist/components/useSessionTimeout.d.svelte.ts +1 -0
- package/dist/components/useSessionTimeout.svelte.d.ts +28 -0
- package/dist/components/useSessionTimeout.svelte.js +182 -0
- package/dist/components/useTableClipboard.d.svelte.ts +1 -0
- package/dist/components/useTableClipboard.svelte.d.ts +28 -0
- package/dist/components/useTableClipboard.svelte.js +116 -0
- package/dist/components/useUnsavedChanges.d.svelte.ts +1 -0
- package/dist/components/useUnsavedChanges.svelte.d.ts +22 -0
- package/dist/components/useUnsavedChanges.svelte.js +105 -0
- package/dist/index.d.ts +47 -28
- package/dist/index.js +49 -2
- package/package.json +1 -1
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { untrack, type Snippet } from 'svelte';
|
|
3
|
+
import {
|
|
4
|
+
ShieldCheck,
|
|
5
|
+
Users,
|
|
6
|
+
QrCode,
|
|
7
|
+
KeyRound,
|
|
8
|
+
AlertTriangle,
|
|
9
|
+
CheckCircle2,
|
|
10
|
+
XCircle,
|
|
11
|
+
Loader2,
|
|
12
|
+
Copy,
|
|
13
|
+
Check,
|
|
14
|
+
X,
|
|
15
|
+
} from '@lucide/svelte';
|
|
16
|
+
import { useTranslation } from '@svadmin/core/i18n';
|
|
17
|
+
import { cn } from '../utils.js';
|
|
18
|
+
import { Button } from './ui/button/index.js';
|
|
19
|
+
|
|
20
|
+
export type ApprovalMode = 'onsite' | 'remote';
|
|
21
|
+
|
|
22
|
+
export interface ReviewerVerificationPayload {
|
|
23
|
+
reviewerId: string;
|
|
24
|
+
reviewerName?: string | undefined;
|
|
25
|
+
reviewerRole: string;
|
|
26
|
+
secret: string;
|
|
27
|
+
actionTitle: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface DualApprovalAuditRecord {
|
|
31
|
+
actionId: string;
|
|
32
|
+
actionTitle: string;
|
|
33
|
+
initiator?: string | undefined;
|
|
34
|
+
reviewerId: string;
|
|
35
|
+
reviewerRole: string;
|
|
36
|
+
mode: ApprovalMode;
|
|
37
|
+
approvedAt: string;
|
|
38
|
+
auditHash: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface DualApprovalGateProps {
|
|
42
|
+
open?: boolean | undefined;
|
|
43
|
+
actionTitle: string;
|
|
44
|
+
actionDescription?: string | undefined;
|
|
45
|
+
actionPayload?: Record<string, unknown> | undefined;
|
|
46
|
+
requiredRole?: string | undefined;
|
|
47
|
+
defaultMode?: ApprovalMode | undefined;
|
|
48
|
+
allowModeSwitch?: boolean | undefined;
|
|
49
|
+
verifyReviewer?: ((payload: ReviewerVerificationPayload) => Promise<boolean | undefined> | boolean | undefined) | undefined;
|
|
50
|
+
onApproved?: ((record: DualApprovalAuditRecord) => void) | undefined;
|
|
51
|
+
onRejected?: ((reason?: string) => void) | undefined;
|
|
52
|
+
class?: string | undefined;
|
|
53
|
+
trigger?: Snippet<[{ openModal: () => void }]> | undefined;
|
|
54
|
+
children?: Snippet | undefined;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let {
|
|
58
|
+
open = $bindable(false),
|
|
59
|
+
actionTitle,
|
|
60
|
+
actionDescription,
|
|
61
|
+
actionPayload,
|
|
62
|
+
requiredRole = '合规主管 / Supervisor Admin',
|
|
63
|
+
defaultMode = 'onsite',
|
|
64
|
+
allowModeSwitch = true,
|
|
65
|
+
verifyReviewer,
|
|
66
|
+
onApproved,
|
|
67
|
+
onRejected,
|
|
68
|
+
class: className = '',
|
|
69
|
+
trigger,
|
|
70
|
+
children,
|
|
71
|
+
}: DualApprovalGateProps = $props();
|
|
72
|
+
|
|
73
|
+
const i18n = useTranslation();
|
|
74
|
+
const chinese = $derived(i18n.locale.startsWith('zh'));
|
|
75
|
+
|
|
76
|
+
let activeMode = $state<ApprovalMode>(untrack(() => defaultMode));
|
|
77
|
+
let reviewerId = $state('');
|
|
78
|
+
let reviewerName = $state('');
|
|
79
|
+
let reviewerSecret = $state('');
|
|
80
|
+
let isVerifying = $state(false);
|
|
81
|
+
let errorMessage = $state<string | null>(null);
|
|
82
|
+
let isCopied = $state(false);
|
|
83
|
+
|
|
84
|
+
const actionId = $derived(`action-${Math.random().toString(36).slice(2, 9)}`);
|
|
85
|
+
const remoteReviewUrl = $derived(
|
|
86
|
+
typeof window !== 'undefined'
|
|
87
|
+
? `${window.location.origin}/approval/dual-review?id=${actionId}`
|
|
88
|
+
: `https://example.com/approval/dual-review?id=${actionId}`,
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
function generateAuditHash(): string {
|
|
92
|
+
const raw = `${actionId}:${reviewerId}:${Date.now()}:${JSON.stringify(actionPayload ?? {})}`;
|
|
93
|
+
let hash = 0;
|
|
94
|
+
for (let i = 0; i < raw.length; i++) {
|
|
95
|
+
hash = (hash << 5) - hash + raw.charCodeAt(i);
|
|
96
|
+
hash |= 0;
|
|
97
|
+
}
|
|
98
|
+
return `SHA-${Math.abs(hash).toString(16).padStart(8, '0')}`;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async function handleOnsiteSubmit() {
|
|
102
|
+
if (!reviewerId.trim() || !reviewerSecret.trim()) {
|
|
103
|
+
errorMessage = chinese ? '请完整填写复核人员工号与核验口令' : 'Please provide reviewer ID and authorization secret';
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
isVerifying = true;
|
|
108
|
+
errorMessage = null;
|
|
109
|
+
|
|
110
|
+
try {
|
|
111
|
+
if (verifyReviewer) {
|
|
112
|
+
const passed = await verifyReviewer({
|
|
113
|
+
reviewerId: reviewerId.trim(),
|
|
114
|
+
reviewerName: reviewerName.trim() || undefined,
|
|
115
|
+
reviewerRole: requiredRole,
|
|
116
|
+
secret: reviewerSecret.trim(),
|
|
117
|
+
actionTitle,
|
|
118
|
+
});
|
|
119
|
+
if (passed === false) {
|
|
120
|
+
errorMessage = chinese ? '复核人鉴权未通过,请核对权限或密码' : 'Reviewer authorization failed';
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const auditRecord: DualApprovalAuditRecord = {
|
|
126
|
+
actionId,
|
|
127
|
+
actionTitle,
|
|
128
|
+
reviewerId: reviewerId.trim(),
|
|
129
|
+
reviewerRole: requiredRole,
|
|
130
|
+
mode: 'onsite',
|
|
131
|
+
approvedAt: new Date().toISOString(),
|
|
132
|
+
auditHash: generateAuditHash(),
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
open = false;
|
|
136
|
+
onApproved?.(auditRecord);
|
|
137
|
+
resetState();
|
|
138
|
+
} catch (err) {
|
|
139
|
+
errorMessage = err instanceof Error ? err.message : String(err);
|
|
140
|
+
} finally {
|
|
141
|
+
isVerifying = false;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function handleCancel() {
|
|
146
|
+
open = false;
|
|
147
|
+
onRejected?.('User canceled dual approval flow');
|
|
148
|
+
resetState();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function resetState() {
|
|
152
|
+
reviewerId = '';
|
|
153
|
+
reviewerName = '';
|
|
154
|
+
reviewerSecret = '';
|
|
155
|
+
errorMessage = null;
|
|
156
|
+
isVerifying = false;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
async function handleCopyLink() {
|
|
160
|
+
if (typeof navigator !== 'undefined' && navigator.clipboard) {
|
|
161
|
+
await navigator.clipboard.writeText(remoteReviewUrl);
|
|
162
|
+
isCopied = true;
|
|
163
|
+
setTimeout(() => {
|
|
164
|
+
isCopied = false;
|
|
165
|
+
}, 1500);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const resolvedDesc = $derived(
|
|
170
|
+
actionDescription ??
|
|
171
|
+
(chinese
|
|
172
|
+
? '本操作涉及高危特权变更或资金资产,系统已开启双人双锁(Two-Person Rule)联签保护,须由第二位授权人员复核后方可执行。'
|
|
173
|
+
: 'This operation involves high-privilege changes. Dual-person approval (Two-Person Rule) is strictly required before execution.'),
|
|
174
|
+
);
|
|
175
|
+
</script>
|
|
176
|
+
|
|
177
|
+
{#if trigger}
|
|
178
|
+
{@render trigger({ openModal: () => (open = true) })}
|
|
179
|
+
{:else if children}
|
|
180
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
181
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
182
|
+
<div onclick={() => (open = true)} class="inline-block">
|
|
183
|
+
{@render children()}
|
|
184
|
+
</div>
|
|
185
|
+
{/if}
|
|
186
|
+
|
|
187
|
+
{#if open}
|
|
188
|
+
<div
|
|
189
|
+
role="dialog"
|
|
190
|
+
aria-modal="true"
|
|
191
|
+
aria-labelledby="dual-approval-title"
|
|
192
|
+
aria-describedby="dual-approval-desc"
|
|
193
|
+
data-svadmin-component="DualApprovalGate"
|
|
194
|
+
class="fixed inset-0 z-50 flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm"
|
|
195
|
+
>
|
|
196
|
+
<!-- Modal Card -->
|
|
197
|
+
<div
|
|
198
|
+
class={cn(
|
|
199
|
+
'relative z-10 w-full max-w-lg rounded-md border border-border bg-card p-6 text-card-foreground shadow-[var(--shadow-overlay)] animate-in fade-in zoom-in-95 duration-150',
|
|
200
|
+
className,
|
|
201
|
+
)}
|
|
202
|
+
>
|
|
203
|
+
<!-- Header -->
|
|
204
|
+
<div class="flex items-start justify-between border-b border-border/60 pb-4">
|
|
205
|
+
<div class="flex items-center gap-3">
|
|
206
|
+
<div class="flex h-11 w-11 shrink-0 items-center justify-center rounded-sm bg-destructive/15 text-destructive border border-destructive/20">
|
|
207
|
+
<ShieldCheck class="h-6 w-6" />
|
|
208
|
+
</div>
|
|
209
|
+
<div>
|
|
210
|
+
<div class="inline-flex items-center gap-1.5 rounded-full bg-destructive/10 px-2 py-0.5 text-xs font-semibold text-destructive mb-1">
|
|
211
|
+
<AlertTriangle class="h-3 w-3" />
|
|
212
|
+
<span>{chinese ? '特权高危操作 · 双人双锁' : 'Two-Person Rule Required'}</span>
|
|
213
|
+
</div>
|
|
214
|
+
<h3 id="dual-approval-title" class="text-base font-bold text-foreground">
|
|
215
|
+
{actionTitle}
|
|
216
|
+
</h3>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
|
|
220
|
+
<button
|
|
221
|
+
type="button"
|
|
222
|
+
onclick={handleCancel}
|
|
223
|
+
class="rounded-lg p-1.5 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors"
|
|
224
|
+
aria-label="Close"
|
|
225
|
+
>
|
|
226
|
+
<X class="h-4 w-4" />
|
|
227
|
+
</button>
|
|
228
|
+
</div>
|
|
229
|
+
|
|
230
|
+
<!-- Description Banner -->
|
|
231
|
+
<p id="dual-approval-desc" class="text-xs text-muted-foreground leading-relaxed my-3">
|
|
232
|
+
{resolvedDesc}
|
|
233
|
+
</p>
|
|
234
|
+
|
|
235
|
+
<!-- Mode Switcher Tabs -->
|
|
236
|
+
{#if allowModeSwitch}
|
|
237
|
+
<div class="flex rounded-lg border border-border bg-muted/40 p-1 mb-4 text-xs">
|
|
238
|
+
<button
|
|
239
|
+
type="button"
|
|
240
|
+
onclick={() => (activeMode = 'onsite')}
|
|
241
|
+
class={cn(
|
|
242
|
+
'flex-1 flex items-center justify-center gap-1.5 py-1.5 rounded-md font-medium transition-all',
|
|
243
|
+
activeMode === 'onsite' ? 'bg-card text-foreground shadow-xs' : 'text-muted-foreground hover:text-foreground',
|
|
244
|
+
)}
|
|
245
|
+
>
|
|
246
|
+
<KeyRound class="h-3.5 w-3.5" />
|
|
247
|
+
<span>{chinese ? '当面同台复核' : 'Onsite Review'}</span>
|
|
248
|
+
</button>
|
|
249
|
+
<button
|
|
250
|
+
type="button"
|
|
251
|
+
onclick={() => (activeMode = 'remote')}
|
|
252
|
+
class={cn(
|
|
253
|
+
'flex-1 flex items-center justify-center gap-1.5 py-1.5 rounded-md font-medium transition-all',
|
|
254
|
+
activeMode === 'remote' ? 'bg-card text-foreground shadow-xs' : 'text-muted-foreground hover:text-foreground',
|
|
255
|
+
)}
|
|
256
|
+
>
|
|
257
|
+
<QrCode class="h-3.5 w-3.5" />
|
|
258
|
+
<span>{chinese ? '扫码/链接远程复核' : 'Remote QR Review'}</span>
|
|
259
|
+
</button>
|
|
260
|
+
</div>
|
|
261
|
+
{/if}
|
|
262
|
+
|
|
263
|
+
<!-- Error alert -->
|
|
264
|
+
{#if errorMessage}
|
|
265
|
+
<div role="alert" class="flex items-center gap-2 rounded-lg border border-destructive/30 bg-destructive/10 p-3 text-xs text-destructive mb-4">
|
|
266
|
+
<XCircle class="h-4 w-4 shrink-0" />
|
|
267
|
+
<span>{errorMessage}</span>
|
|
268
|
+
</div>
|
|
269
|
+
{/if}
|
|
270
|
+
|
|
271
|
+
{#if activeMode === 'onsite'}
|
|
272
|
+
<!-- Onsite Form -->
|
|
273
|
+
<div class="space-y-3.5 text-xs">
|
|
274
|
+
<div>
|
|
275
|
+
<label for="reviewer-role" class="block font-medium text-foreground mb-1">
|
|
276
|
+
{chinese ? '指定复核角色' : 'Required Role'}
|
|
277
|
+
</label>
|
|
278
|
+
<div id="reviewer-role" class="flex items-center gap-1.5 rounded-md border border-border bg-muted/30 px-3 py-1.5 text-muted-foreground font-mono">
|
|
279
|
+
<Users class="h-3.5 w-3.5 text-primary" />
|
|
280
|
+
<span>{requiredRole}</span>
|
|
281
|
+
</div>
|
|
282
|
+
</div>
|
|
283
|
+
|
|
284
|
+
<div class="grid grid-cols-2 gap-3">
|
|
285
|
+
<div>
|
|
286
|
+
<label for="reviewer-id" class="block font-medium text-foreground mb-1">
|
|
287
|
+
{chinese ? '复核人工号/账号 *' : 'Reviewer ID *'}
|
|
288
|
+
</label>
|
|
289
|
+
<input
|
|
290
|
+
id="reviewer-id"
|
|
291
|
+
type="text"
|
|
292
|
+
bind:value={reviewerId}
|
|
293
|
+
placeholder={chinese ? '例如: MGR-8801' : 'E.g. ADM-001'}
|
|
294
|
+
class="h-8.5 w-full rounded-md border border-input bg-background px-3 text-xs focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
295
|
+
/>
|
|
296
|
+
</div>
|
|
297
|
+
<div>
|
|
298
|
+
<label for="reviewer-name" class="block font-medium text-foreground mb-1">
|
|
299
|
+
{chinese ? '复核人姓名 (选填)' : 'Name (Optional)'}
|
|
300
|
+
</label>
|
|
301
|
+
<input
|
|
302
|
+
id="reviewer-name"
|
|
303
|
+
type="text"
|
|
304
|
+
bind:value={reviewerName}
|
|
305
|
+
placeholder={chinese ? '真实姓名' : 'Reviewer name'}
|
|
306
|
+
class="h-8.5 w-full rounded-md border border-input bg-background px-3 text-xs focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
307
|
+
/>
|
|
308
|
+
</div>
|
|
309
|
+
</div>
|
|
310
|
+
|
|
311
|
+
<div>
|
|
312
|
+
<label for="reviewer-secret" class="block font-medium text-foreground mb-1">
|
|
313
|
+
{chinese ? '复核人口令 / 动态 2FA 验证码 *' : 'Reviewer Password / 2FA OTP *'}
|
|
314
|
+
</label>
|
|
315
|
+
<input
|
|
316
|
+
id="reviewer-secret"
|
|
317
|
+
type="password"
|
|
318
|
+
bind:value={reviewerSecret}
|
|
319
|
+
placeholder={chinese ? '输入复核人独立认证口令' : 'Enter authorization secret'}
|
|
320
|
+
class="h-8.5 w-full rounded-md border border-input bg-background px-3 text-xs font-mono focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
321
|
+
/>
|
|
322
|
+
</div>
|
|
323
|
+
</div>
|
|
324
|
+
{:else}
|
|
325
|
+
<!-- Remote Review QR Code -->
|
|
326
|
+
<div class="flex flex-col items-center justify-center p-4 border border-dashed border-border rounded-md bg-muted/20 text-center space-y-3">
|
|
327
|
+
<div class="flex h-36 w-36 items-center justify-center rounded-sm bg-background border border-border shadow-xs text-xs text-muted-foreground p-3">
|
|
328
|
+
<div class="space-y-1 text-center">
|
|
329
|
+
<QrCode class="h-16 w-16 mx-auto text-primary/80" />
|
|
330
|
+
<div class="text-xs font-mono">{chinese ? '复核专属二维码' : 'Approval QR'}</div>
|
|
331
|
+
</div>
|
|
332
|
+
</div>
|
|
333
|
+
|
|
334
|
+
<div class="space-y-1 max-w-sm">
|
|
335
|
+
<p class="text-xs font-medium text-foreground">
|
|
336
|
+
{chinese ? '请联系主管使用移动端扫描上方二维码或点击链接复核' : 'Share link with supervisor to sign remotely'}
|
|
337
|
+
</p>
|
|
338
|
+
<div class="flex items-center gap-1.5 pt-1">
|
|
339
|
+
<input
|
|
340
|
+
readonly
|
|
341
|
+
value={remoteReviewUrl}
|
|
342
|
+
class="h-7 w-full rounded border border-border bg-background px-2 text-xs font-mono text-muted-foreground"
|
|
343
|
+
/>
|
|
344
|
+
<Button size="sm" variant="outline" class="h-7 px-2 shrink-0" onclick={handleCopyLink}>
|
|
345
|
+
{#if isCopied}
|
|
346
|
+
<Check class="h-3.5 w-3.5 text-success" />
|
|
347
|
+
{:else}
|
|
348
|
+
<Copy class="h-3.5 w-3.5" />
|
|
349
|
+
{/if}
|
|
350
|
+
</Button>
|
|
351
|
+
</div>
|
|
352
|
+
</div>
|
|
353
|
+
</div>
|
|
354
|
+
{/if}
|
|
355
|
+
|
|
356
|
+
<!-- Footer Actions -->
|
|
357
|
+
<div class="mt-6 flex items-center justify-between border-t border-border/60 pt-4">
|
|
358
|
+
<span class="text-xs text-muted-foreground font-mono">
|
|
359
|
+
ID: {actionId}
|
|
360
|
+
</span>
|
|
361
|
+
|
|
362
|
+
<div class="flex items-center gap-2">
|
|
363
|
+
<Button
|
|
364
|
+
type="button"
|
|
365
|
+
variant="ghost"
|
|
366
|
+
size="sm"
|
|
367
|
+
onclick={handleCancel}
|
|
368
|
+
disabled={isVerifying}
|
|
369
|
+
>
|
|
370
|
+
{chinese ? '放弃操作' : 'Cancel'}
|
|
371
|
+
</Button>
|
|
372
|
+
|
|
373
|
+
{#if activeMode === 'onsite'}
|
|
374
|
+
<Button
|
|
375
|
+
type="button"
|
|
376
|
+
size="sm"
|
|
377
|
+
onclick={handleOnsiteSubmit}
|
|
378
|
+
disabled={isVerifying || !reviewerId || !reviewerSecret}
|
|
379
|
+
class="gap-1.5 min-w-28 bg-destructive text-destructive-foreground hover:bg-destructive/90"
|
|
380
|
+
>
|
|
381
|
+
{#if isVerifying}
|
|
382
|
+
<Loader2 class="h-3.5 w-3.5 animate-spin" />
|
|
383
|
+
<span>{chinese ? '联签核验中...' : 'Verifying...'}</span>
|
|
384
|
+
{:else}
|
|
385
|
+
<ShieldCheck class="h-3.5 w-3.5" />
|
|
386
|
+
<span>{chinese ? '确认双人联签' : 'Dual Approve'}</span>
|
|
387
|
+
{/if}
|
|
388
|
+
</Button>
|
|
389
|
+
{:else}
|
|
390
|
+
<Button
|
|
391
|
+
type="button"
|
|
392
|
+
size="sm"
|
|
393
|
+
onclick={() => {
|
|
394
|
+
// Simulate approval callback for remote mode demo
|
|
395
|
+
const auditRecord: DualApprovalAuditRecord = {
|
|
396
|
+
actionId,
|
|
397
|
+
actionTitle,
|
|
398
|
+
reviewerId: 'REMOTE-MGR',
|
|
399
|
+
reviewerRole: requiredRole,
|
|
400
|
+
mode: 'remote',
|
|
401
|
+
approvedAt: new Date().toISOString(),
|
|
402
|
+
auditHash: generateAuditHash(),
|
|
403
|
+
};
|
|
404
|
+
open = false;
|
|
405
|
+
onApproved?.(auditRecord);
|
|
406
|
+
resetState();
|
|
407
|
+
}}
|
|
408
|
+
class="gap-1.5"
|
|
409
|
+
>
|
|
410
|
+
<CheckCircle2 class="h-3.5 w-3.5 text-success" />
|
|
411
|
+
<span>{chinese ? '模拟远程复核通过' : 'Simulate Approved'}</span>
|
|
412
|
+
</Button>
|
|
413
|
+
{/if}
|
|
414
|
+
</div>
|
|
415
|
+
</div>
|
|
416
|
+
</div>
|
|
417
|
+
</div>
|
|
418
|
+
{/if}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
export type ApprovalMode = 'onsite' | 'remote';
|
|
3
|
+
export interface ReviewerVerificationPayload {
|
|
4
|
+
reviewerId: string;
|
|
5
|
+
reviewerName?: string | undefined;
|
|
6
|
+
reviewerRole: string;
|
|
7
|
+
secret: string;
|
|
8
|
+
actionTitle: string;
|
|
9
|
+
}
|
|
10
|
+
export interface DualApprovalAuditRecord {
|
|
11
|
+
actionId: string;
|
|
12
|
+
actionTitle: string;
|
|
13
|
+
initiator?: string | undefined;
|
|
14
|
+
reviewerId: string;
|
|
15
|
+
reviewerRole: string;
|
|
16
|
+
mode: ApprovalMode;
|
|
17
|
+
approvedAt: string;
|
|
18
|
+
auditHash: string;
|
|
19
|
+
}
|
|
20
|
+
export interface DualApprovalGateProps {
|
|
21
|
+
open?: boolean | undefined;
|
|
22
|
+
actionTitle: string;
|
|
23
|
+
actionDescription?: string | undefined;
|
|
24
|
+
actionPayload?: Record<string, unknown> | undefined;
|
|
25
|
+
requiredRole?: string | undefined;
|
|
26
|
+
defaultMode?: ApprovalMode | undefined;
|
|
27
|
+
allowModeSwitch?: boolean | undefined;
|
|
28
|
+
verifyReviewer?: ((payload: ReviewerVerificationPayload) => Promise<boolean | undefined> | boolean | undefined) | undefined;
|
|
29
|
+
onApproved?: ((record: DualApprovalAuditRecord) => void) | undefined;
|
|
30
|
+
onRejected?: ((reason?: string) => void) | undefined;
|
|
31
|
+
class?: string | undefined;
|
|
32
|
+
trigger?: Snippet<[{
|
|
33
|
+
openModal: () => void;
|
|
34
|
+
}]> | undefined;
|
|
35
|
+
children?: Snippet | undefined;
|
|
36
|
+
}
|
|
37
|
+
declare const DualApprovalGate: import("svelte").Component<DualApprovalGateProps, {}, "open">;
|
|
38
|
+
type DualApprovalGate = ReturnType<typeof DualApprovalGate>;
|
|
39
|
+
export default DualApprovalGate;
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
}
|
|
116
116
|
</script>
|
|
117
117
|
|
|
118
|
-
<div class={cn('space-y-3 rounded-
|
|
118
|
+
<div class={cn('space-y-3 rounded-md border border-border bg-card p-4 shadow-xs text-xs', className)}>
|
|
119
119
|
<div class="flex items-center justify-between gap-2 pb-2 border-b border-border/60">
|
|
120
120
|
<div class="font-semibold text-foreground">
|
|
121
121
|
Editable Grid <span class="text-muted-foreground font-normal">({rows.length} records)</span>
|
|
@@ -266,7 +266,7 @@
|
|
|
266
266
|
<div
|
|
267
267
|
data-svadmin-component="ExcelImportWizard"
|
|
268
268
|
class={cn(
|
|
269
|
-
'flex flex-col rounded-
|
|
269
|
+
'flex flex-col rounded-md border border-border bg-card text-card-foreground shadow-sm overflow-hidden',
|
|
270
270
|
className,
|
|
271
271
|
)}
|
|
272
272
|
>
|
|
@@ -337,7 +337,7 @@
|
|
|
337
337
|
<div class="flex flex-col items-center justify-center py-8">
|
|
338
338
|
<label
|
|
339
339
|
class={cn(
|
|
340
|
-
'flex flex-col items-center justify-center w-full max-w-lg h-60 border-2 border-dashed rounded-
|
|
340
|
+
'flex flex-col items-center justify-center w-full max-w-lg h-60 border-2 border-dashed rounded-md cursor-pointer transition-all',
|
|
341
341
|
isDragOver ? 'border-primary bg-primary/5' : 'border-border hover:border-primary/50 bg-background',
|
|
342
342
|
)}
|
|
343
343
|
ondragover={(e) => { e.preventDefault(); isDragOver = true; }}
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
>
|
|
147
147
|
<div
|
|
148
148
|
class={cn(
|
|
149
|
-
'relative flex flex-col w-full max-w-xl max-h-[85vh] rounded-
|
|
149
|
+
'relative flex flex-col w-full max-w-xl max-h-[85vh] rounded-md border border-border bg-card text-card-foreground shadow-[var(--shadow-overlay)] overflow-hidden',
|
|
150
150
|
className,
|
|
151
151
|
)}
|
|
152
152
|
>
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
}
|
|
57
57
|
</script>
|
|
58
58
|
|
|
59
|
-
<div class={cn('rounded-
|
|
59
|
+
<div class={cn('rounded-md border border-border bg-card p-4 shadow-xs space-y-4 text-xs', className)}>
|
|
60
60
|
<div class="flex items-center justify-between pb-2 border-b border-border/60">
|
|
61
61
|
<h4 class="font-semibold text-foreground flex items-center gap-1.5">
|
|
62
62
|
<Crop class="h-4 w-4 text-primary" />
|
|
@@ -747,7 +747,7 @@
|
|
|
747
747
|
<Button type="button" onclick={() => { open = false; }}>{i18n.t('common.close')}</Button>
|
|
748
748
|
{:else if currentStep === 1}
|
|
749
749
|
<div
|
|
750
|
-
class="border-2 border-dashed border-border/80 hover:border-primary/60 rounded-
|
|
750
|
+
class="border-2 border-dashed border-border/80 hover:border-primary/60 rounded-md p-8 text-center transition-colors cursor-pointer bg-muted/20"
|
|
751
751
|
ondragover={(e) => e.preventDefault()}
|
|
752
752
|
ondrop={handleDrop}
|
|
753
753
|
role="region"
|
|
@@ -477,7 +477,7 @@
|
|
|
477
477
|
bind:this={formElement}
|
|
478
478
|
aria-busy={isSubmitting}
|
|
479
479
|
onsubmit={handleSubmit}
|
|
480
|
-
class={cn('space-y-4 rounded-
|
|
480
|
+
class={cn('space-y-4 rounded-md border border-border bg-card p-6 shadow-xs text-xs', className)}
|
|
481
481
|
>
|
|
482
482
|
{#if resolvedSchema?.title}
|
|
483
483
|
<div class="pb-2 border-b border-border/60">
|