@svadmin/ui 0.121.0 → 0.125.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 +757 -7
- package/dist/app.theme.css +757 -7
- package/dist/components/AbacPolicyMatrix.svelte +356 -0
- package/dist/components/AbacPolicyMatrix.svelte.d.ts +30 -0
- package/dist/components/AboutSettings.svelte +1 -1
- package/dist/components/ActionPalette.svelte +272 -0
- package/dist/components/ActionPalette.svelte.d.ts +23 -0
- package/dist/components/AdminCopilotWidget.svelte +316 -0
- package/dist/components/AdminCopilotWidget.svelte.d.ts +33 -0
- package/dist/components/AnnouncementBanner.svelte +325 -0
- package/dist/components/AnnouncementBanner.svelte.d.ts +49 -0
- package/dist/components/ApiPlayground.svelte +255 -0
- package/dist/components/ApiPlayground.svelte.d.ts +24 -0
- package/dist/components/ApprovalChainBuilder.svelte +262 -0
- package/dist/components/ApprovalChainBuilder.svelte.d.ts +20 -0
- package/dist/components/ApprovalTimeline.svelte +8 -1
- 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/AuditTrailInspector.svelte +448 -0
- package/dist/components/AuditTrailInspector.svelte.d.ts +44 -0
- package/dist/components/BatchEditModal.svelte +266 -0
- package/dist/components/BatchEditModal.svelte.d.ts +27 -0
- package/dist/components/BillingInvoiceDrawer.svelte +206 -0
- package/dist/components/BillingInvoiceDrawer.svelte.d.ts +30 -0
- package/dist/components/CanvasAnnotation.svelte +1 -1
- package/dist/components/ChartAnnotationOverlay.svelte +228 -0
- package/dist/components/ChartAnnotationOverlay.svelte.d.ts +21 -0
- package/dist/components/ClusterTopologyGraph.svelte +317 -0
- package/dist/components/ClusterTopologyGraph.svelte.d.ts +31 -0
- package/dist/components/ColumnFilterBuilder.svelte +135 -0
- package/dist/components/ColumnFilterBuilder.svelte.d.ts +20 -0
- package/dist/components/ColumnMappingTable.svelte +174 -0
- package/dist/components/ColumnMappingTable.svelte.d.ts +23 -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/ConversionFunnel.svelte +154 -0
- package/dist/components/ConversionFunnel.svelte.d.ts +22 -0
- package/dist/components/CronExpressionBuilder.svelte +1 -1
- package/dist/components/CursorListFooter.svelte +67 -0
- package/dist/components/CursorListFooter.svelte.d.ts +17 -0
- package/dist/components/DashboardGridLayout.svelte +309 -0
- package/dist/components/DashboardGridLayout.svelte.d.ts +30 -0
- package/dist/components/DashboardLayoutStorage.svelte +278 -0
- package/dist/components/DashboardLayoutStorage.svelte.d.ts +23 -0
- package/dist/components/DataFreshnessIndicator.svelte +149 -0
- package/dist/components/DataFreshnessIndicator.svelte.d.ts +20 -0
- package/dist/components/DataImportDropzone.svelte +215 -0
- package/dist/components/DataImportDropzone.svelte.d.ts +24 -0
- package/dist/components/DataLineageGraph.svelte +203 -0
- package/dist/components/DataLineageGraph.svelte.d.ts +26 -0
- package/dist/components/DataMaskPolicyEngine.svelte +291 -0
- package/dist/components/DataMaskPolicyEngine.svelte.d.ts +25 -0
- package/dist/components/DataScopeRuleEditor.svelte +142 -0
- package/dist/components/DataScopeRuleEditor.svelte.d.ts +19 -0
- package/dist/components/DataScreenContainer.svelte +160 -0
- package/dist/components/DataScreenContainer.svelte.d.ts +15 -0
- package/dist/components/DecisionTable.svelte +1 -1
- package/dist/components/DevTools.svelte +4 -4
- package/dist/components/DraggableRowTable.svelte +1 -1
- package/dist/components/DualApprovalGate.svelte +485 -0
- package/dist/components/DualApprovalGate.svelte.d.ts +58 -0
- package/dist/components/EditableTable.svelte +1 -1
- package/dist/components/ElectronicSealStamp.svelte +102 -0
- package/dist/components/ElectronicSealStamp.svelte.d.ts +14 -0
- package/dist/components/EnvVariableEditor.svelte +284 -0
- package/dist/components/EnvVariableEditor.svelte.d.ts +17 -0
- package/dist/components/ExcelImportWizard.svelte +2 -2
- package/dist/components/FeatureAnnouncementModal.svelte +173 -0
- package/dist/components/FeatureAnnouncementModal.svelte.d.ts +21 -0
- package/dist/components/FilterTagBar.svelte +210 -0
- package/dist/components/FilterTagBar.svelte.d.ts +23 -0
- package/dist/components/FormulaField.svelte +149 -0
- package/dist/components/FormulaField.svelte.d.ts +18 -0
- package/dist/components/GeoScatterMap.svelte +225 -0
- package/dist/components/GeoScatterMap.svelte.d.ts +22 -0
- package/dist/components/GlobalShortcuts.svelte +1 -1
- package/dist/components/HmacSignatureCalculator.svelte +199 -0
- package/dist/components/HmacSignatureCalculator.svelte.d.ts +10 -0
- package/dist/components/I18nLanguagePackEditor.svelte +208 -0
- package/dist/components/I18nLanguagePackEditor.svelte.d.ts +17 -0
- package/dist/components/ImageCropper.svelte +1 -1
- package/dist/components/ImportPreviewValidator.svelte +239 -0
- package/dist/components/ImportPreviewValidator.svelte.d.ts +26 -0
- package/dist/components/ImportWizard.svelte +1 -1
- package/dist/components/IncidentWarRoomDrawer.svelte +194 -0
- package/dist/components/IncidentWarRoomDrawer.svelte.d.ts +24 -0
- package/dist/components/JsonSchemaForm.svelte +5 -5
- package/dist/components/JsonViewer.svelte +11 -11
- package/dist/components/KeyboardShortcutsModal.svelte +362 -0
- package/dist/components/KeyboardShortcutsModal.svelte.d.ts +22 -0
- package/dist/components/KpiCard.svelte +5 -5
- package/dist/components/ListPagination.svelte +39 -3
- package/dist/components/LiveStreamLogViewer.svelte +185 -0
- package/dist/components/LiveStreamLogViewer.svelte.d.ts +21 -0
- package/dist/components/MasterDetailView.svelte +1 -1
- package/dist/components/MasterSubTableDrawer.svelte +223 -0
- package/dist/components/MasterSubTableDrawer.svelte.d.ts +25 -0
- 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/MockDataInterceptor.svelte +292 -0
- package/dist/components/MockDataInterceptor.svelte.d.ts +27 -0
- package/dist/components/OfflineSyncBanner.svelte +1 -1
- package/dist/components/OmnibarCommandPalette.svelte +320 -0
- package/dist/components/OmnibarCommandPalette.svelte.d.ts +27 -0
- package/dist/components/OrgChart.svelte +1 -1
- package/dist/components/OrgTreePicker.svelte +1 -1
- package/dist/components/OtpInput.svelte +5 -5
- package/dist/components/PageSkeleton.svelte +19 -5
- package/dist/components/PageSkeleton.svelte.d.ts +5 -3
- package/dist/components/PdfDocumentViewer.svelte +2 -2
- package/dist/components/PeriodComparisonCard.svelte +142 -0
- package/dist/components/PeriodComparisonCard.svelte.d.ts +16 -0
- package/dist/components/PermissionSimulator.svelte +319 -0
- package/dist/components/PermissionSimulator.svelte.d.ts +34 -0
- package/dist/components/PivotDrilldownModal.svelte +6 -6
- package/dist/components/PivotMatrix.svelte +271 -0
- package/dist/components/PivotMatrix.svelte.d.ts +32 -0
- package/dist/components/PivotTable.svelte +1 -1
- package/dist/components/PlanUsageQuotaBar.svelte +154 -0
- package/dist/components/PlanUsageQuotaBar.svelte.d.ts +26 -0
- package/dist/components/Popconfirm.svelte +20 -8
- package/dist/components/Popconfirm.svelte.d.ts +3 -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 +10 -6
- package/dist/components/ProSkeleton.svelte.d.ts +2 -0
- package/dist/components/QueryAiExplainer.svelte +148 -0
- package/dist/components/QueryAiExplainer.svelte.d.ts +16 -0
- package/dist/components/QueryBuilder.svelte +456 -0
- package/dist/components/QueryBuilder.svelte.d.ts +33 -0
- package/dist/components/ResultPage.svelte +2 -2
- package/dist/components/RolePermissionComparator.svelte +273 -0
- package/dist/components/RolePermissionComparator.svelte.d.ts +28 -0
- package/dist/components/RuleExpressionBuilder.svelte +380 -0
- package/dist/components/RuleExpressionBuilder.svelte.d.ts +31 -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/ScheduledJobManager.svelte +225 -0
- package/dist/components/ScheduledJobManager.svelte.d.ts +23 -0
- package/dist/components/SchemaVisualModeler.svelte +336 -0
- package/dist/components/SchemaVisualModeler.svelte.d.ts +17 -0
- package/dist/components/ScreenAntiLeakGuard.svelte +88 -0
- package/dist/components/ScreenAntiLeakGuard.svelte.d.ts +12 -0
- package/dist/components/SecureDataExporter.svelte +296 -0
- package/dist/components/SecureDataExporter.svelte.d.ts +29 -0
- package/dist/components/SensitiveDataMask.svelte +81 -22
- package/dist/components/SensitiveDataMask.svelte.d.ts +15 -10
- package/dist/components/ServerStatusGrid.svelte +179 -0
- package/dist/components/ServerStatusGrid.svelte.d.ts +21 -0
- package/dist/components/SessionTimeoutGuard.svelte +154 -0
- package/dist/components/SessionTimeoutGuard.svelte.d.ts +25 -0
- package/dist/components/SignaturePad.svelte +1 -1
- package/dist/components/SliderCaptcha.svelte +1 -1
- package/dist/components/SnapshotTimelineReplay.svelte +219 -0
- package/dist/components/SnapshotTimelineReplay.svelte.d.ts +19 -0
- package/dist/components/SplitPaneLayout.svelte +1 -1
- package/dist/components/SpreadsheetView.svelte +1 -1
- package/dist/components/SqlConsole.svelte +247 -0
- package/dist/components/SqlConsole.svelte.d.ts +20 -0
- 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/SystemCapacityForecastCard.svelte +132 -0
- package/dist/components/SystemCapacityForecastCard.svelte.d.ts +19 -0
- package/dist/components/SystemHealthCheckDashboard.svelte +306 -0
- package/dist/components/SystemHealthCheckDashboard.svelte.d.ts +24 -0
- package/dist/components/TableAggregationFooter.svelte +173 -0
- package/dist/components/TableAggregationFooter.svelte.d.ts +22 -0
- package/dist/components/TableClipboardManager.svelte +307 -0
- package/dist/components/TableClipboardManager.svelte.d.ts +13 -0
- package/dist/components/TaskCenter.svelte +46 -38
- package/dist/components/TenantContextSwitcher.svelte +314 -0
- package/dist/components/TenantContextSwitcher.svelte.d.ts +35 -0
- package/dist/components/TenantQuotasMatrix.svelte +229 -0
- package/dist/components/TenantQuotasMatrix.svelte.d.ts +22 -0
- package/dist/components/TextDiffViewer.svelte +613 -0
- package/dist/components/TextDiffViewer.svelte.d.ts +39 -0
- package/dist/components/ThreadedCommentDrawer.svelte +246 -0
- package/dist/components/ThreadedCommentDrawer.svelte.d.ts +26 -0
- package/dist/components/TierFeatureComparison.svelte +147 -0
- package/dist/components/TierFeatureComparison.svelte.d.ts +28 -0
- package/dist/components/TreeTransfer.svelte +1 -1
- package/dist/components/TreeTransferSelect.svelte +333 -0
- package/dist/components/TreeTransferSelect.svelte.d.ts +18 -0
- package/dist/components/UnsavedChangesGuard.svelte +5 -5
- package/dist/components/UsageCard.svelte +1 -1
- package/dist/components/VersionDiffViewer.svelte +1 -1
- package/dist/components/VirtualCardGrid.svelte +180 -0
- package/dist/components/VirtualCardGrid.svelte.d.ts +65 -0
- package/dist/components/VirtualTable.svelte +1 -1
- package/dist/components/VirtualTreeSelect.svelte +1 -1
- package/dist/components/WebhookSimulator.svelte +263 -0
- package/dist/components/WebhookSimulator.svelte.d.ts +26 -0
- package/dist/components/WidgetContainer.svelte +204 -0
- package/dist/components/WidgetContainer.svelte.d.ts +31 -0
- package/dist/components/WorkflowDesigner.svelte +3 -3
- package/dist/components/WorkflowExecutionTracker.svelte +131 -0
- package/dist/components/WorkflowExecutionTracker.svelte.d.ts +19 -0
- package/dist/components/WorkflowGraphDesigner.svelte +202 -0
- package/dist/components/WorkflowGraphDesigner.svelte.d.ts +24 -0
- package/dist/components/WorkflowNodeInspector.svelte +217 -0
- package/dist/components/WorkflowNodeInspector.svelte.d.ts +24 -0
- 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/list-i18n.d.ts +7 -0
- package/dist/components/list-i18n.js +14 -0
- package/dist/components/ui/button/button.svelte +3 -1
- package/dist/components/ui/button/button.svelte.d.ts +1 -0
- package/dist/components/ui/tooltip/tooltip-content.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/useDynamicLocale.d.svelte.ts +1 -0
- package/dist/components/useDynamicLocale.svelte.d.ts +10 -0
- package/dist/components/useDynamicLocale.svelte.js +40 -0
- package/dist/components/useFormulaEngine.d.svelte.ts +1 -0
- package/dist/components/useFormulaEngine.svelte.d.ts +9 -0
- package/dist/components/useFormulaEngine.svelte.js +209 -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/useStorageCache.d.svelte.ts +1 -0
- package/dist/components/useStorageCache.svelte.d.ts +49 -0
- package/dist/components/useStorageCache.svelte.js +229 -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.css +1 -1
- package/dist/index.d.ts +96 -11
- package/dist/index.js +146 -1
- package/package.json +4 -4
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { 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
|
+
export type DualApprovalState = 'idle' | 'submitting' | 'pending' | 'approved' | 'rejected' | 'unknown';
|
|
22
|
+
|
|
23
|
+
export interface ReviewerVerificationPayload {
|
|
24
|
+
reviewerId: string;
|
|
25
|
+
reviewerName?: string | undefined;
|
|
26
|
+
reviewerRole: string;
|
|
27
|
+
secret: string;
|
|
28
|
+
actionTitle: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface DualApprovalAuditRecord {
|
|
32
|
+
actionId: string;
|
|
33
|
+
actionTitle: string;
|
|
34
|
+
initiator?: string | undefined;
|
|
35
|
+
reviewerId: string;
|
|
36
|
+
reviewerRole: string;
|
|
37
|
+
mode: ApprovalMode;
|
|
38
|
+
approvedAt: string;
|
|
39
|
+
auditHash: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface DualApprovalRequest {
|
|
43
|
+
actionId?: string | undefined;
|
|
44
|
+
actionTitle: string;
|
|
45
|
+
actionPayload?: Record<string, unknown> | undefined;
|
|
46
|
+
reviewerId?: string | undefined;
|
|
47
|
+
reviewerName?: string | undefined;
|
|
48
|
+
reviewerRole: string;
|
|
49
|
+
secret?: string | undefined;
|
|
50
|
+
mode: ApprovalMode;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface DualApprovalGateProps {
|
|
54
|
+
open?: boolean | undefined;
|
|
55
|
+
/** Stable business action identifier supplied by the host/RPC layer. */
|
|
56
|
+
actionId?: string | undefined;
|
|
57
|
+
actionTitle: string;
|
|
58
|
+
actionDescription?: string | undefined;
|
|
59
|
+
actionPayload?: Record<string, unknown> | undefined;
|
|
60
|
+
requiredRole?: string | undefined;
|
|
61
|
+
defaultMode?: ApprovalMode | undefined;
|
|
62
|
+
allowModeSwitch?: boolean | undefined;
|
|
63
|
+
approvalState?: DualApprovalState | undefined;
|
|
64
|
+
approvalError?: string | undefined;
|
|
65
|
+
remoteReviewUrl?: string | undefined;
|
|
66
|
+
verifyReviewer?: ((payload: ReviewerVerificationPayload) => Promise<boolean | undefined> | boolean | undefined) | undefined;
|
|
67
|
+
/** Submit a review intent; the host must update approvalState from the FA RPC result. */
|
|
68
|
+
onReviewRequest?: ((request: DualApprovalRequest) => Promise<void> | void) | undefined;
|
|
69
|
+
/** Request creation of a remote review link; the host supplies the resulting URL. */
|
|
70
|
+
onRemoteReviewRequest?: ((request: DualApprovalRequest) => Promise<void> | void) | undefined;
|
|
71
|
+
onRejected?: ((reason?: string) => void) | undefined;
|
|
72
|
+
class?: string | undefined;
|
|
73
|
+
trigger?: Snippet<[{ openModal: () => void }]> | undefined;
|
|
74
|
+
children?: Snippet | undefined;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let {
|
|
78
|
+
open = $bindable(false),
|
|
79
|
+
actionId,
|
|
80
|
+
actionTitle,
|
|
81
|
+
actionDescription,
|
|
82
|
+
actionPayload,
|
|
83
|
+
requiredRole = '合规主管 / Supervisor Admin',
|
|
84
|
+
defaultMode = 'onsite',
|
|
85
|
+
allowModeSwitch = true,
|
|
86
|
+
approvalState = 'idle',
|
|
87
|
+
approvalError,
|
|
88
|
+
remoteReviewUrl,
|
|
89
|
+
verifyReviewer,
|
|
90
|
+
onReviewRequest,
|
|
91
|
+
onRemoteReviewRequest,
|
|
92
|
+
onRejected,
|
|
93
|
+
class: className = '',
|
|
94
|
+
trigger,
|
|
95
|
+
children,
|
|
96
|
+
}: DualApprovalGateProps = $props();
|
|
97
|
+
|
|
98
|
+
const i18n = useTranslation();
|
|
99
|
+
const chinese = $derived(i18n.locale.startsWith('zh'));
|
|
100
|
+
|
|
101
|
+
let activeMode = $state<ApprovalMode | undefined>();
|
|
102
|
+
let reviewerId = $state('');
|
|
103
|
+
let reviewerName = $state('');
|
|
104
|
+
let reviewerSecret = $state('');
|
|
105
|
+
let isVerifying = $state(false);
|
|
106
|
+
let errorMessage = $state<string | null>(null);
|
|
107
|
+
let isCopied = $state(false);
|
|
108
|
+
|
|
109
|
+
const selectedMode = $derived(activeMode ?? defaultMode);
|
|
110
|
+
const reviewLocked = $derived(
|
|
111
|
+
approvalState === 'submitting' || approvalState === 'pending' || approvalState === 'approved',
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
const resolvedApprovalError = $derived(approvalError ?? (approvalState === 'unknown'
|
|
115
|
+
? (chinese ? '审批结果尚未确认,请查询原请求后再继续。' : 'The approval result is unconfirmed; query the original request before continuing.')
|
|
116
|
+
: approvalState === 'rejected'
|
|
117
|
+
? (chinese ? '复核请求未通过。' : 'The review request was rejected.')
|
|
118
|
+
: null));
|
|
119
|
+
|
|
120
|
+
function buildRequest(mode: ApprovalMode): DualApprovalRequest {
|
|
121
|
+
return {
|
|
122
|
+
actionId,
|
|
123
|
+
actionTitle,
|
|
124
|
+
actionPayload,
|
|
125
|
+
reviewerId: reviewerId.trim() || undefined,
|
|
126
|
+
reviewerName: reviewerName.trim() || undefined,
|
|
127
|
+
reviewerRole: requiredRole,
|
|
128
|
+
secret: reviewerSecret.trim() || undefined,
|
|
129
|
+
mode,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
async function handleOnsiteSubmit() {
|
|
134
|
+
if (!actionId?.trim()) {
|
|
135
|
+
errorMessage = chinese
|
|
136
|
+
? '缺少业务请求标识,复核意图未提交。'
|
|
137
|
+
: 'A business request ID is required; the review intent was not submitted.';
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (!reviewerId.trim() || !reviewerSecret.trim()) {
|
|
142
|
+
errorMessage = chinese ? '请完整填写复核人员工号与核验口令' : 'Please provide reviewer ID and authorization secret';
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
isVerifying = true;
|
|
147
|
+
errorMessage = null;
|
|
148
|
+
|
|
149
|
+
try {
|
|
150
|
+
if (verifyReviewer) {
|
|
151
|
+
const passed = await verifyReviewer({
|
|
152
|
+
reviewerId: reviewerId.trim(),
|
|
153
|
+
reviewerName: reviewerName.trim() || undefined,
|
|
154
|
+
reviewerRole: requiredRole,
|
|
155
|
+
secret: reviewerSecret.trim(),
|
|
156
|
+
actionTitle,
|
|
157
|
+
});
|
|
158
|
+
if (passed === false) {
|
|
159
|
+
errorMessage = chinese ? '复核人鉴权未通过,请核对权限或密码' : 'Reviewer authorization failed';
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (!onReviewRequest) {
|
|
165
|
+
errorMessage = chinese
|
|
166
|
+
? '审批服务未配置,复核意图未提交。'
|
|
167
|
+
: 'No approval service is configured; the review intent was not submitted.';
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
await onReviewRequest(buildRequest('onsite'));
|
|
172
|
+
errorMessage = null;
|
|
173
|
+
} catch (err) {
|
|
174
|
+
errorMessage = err instanceof Error ? err.message : String(err);
|
|
175
|
+
} finally {
|
|
176
|
+
isVerifying = false;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function handleCancel() {
|
|
181
|
+
open = false;
|
|
182
|
+
onRejected?.('User canceled dual approval flow');
|
|
183
|
+
resetState();
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function resetState() {
|
|
187
|
+
reviewerId = '';
|
|
188
|
+
reviewerName = '';
|
|
189
|
+
reviewerSecret = '';
|
|
190
|
+
errorMessage = null;
|
|
191
|
+
isVerifying = false;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
async function handleCopyLink() {
|
|
195
|
+
if (remoteReviewUrl && typeof navigator !== 'undefined' && navigator.clipboard) {
|
|
196
|
+
await navigator.clipboard.writeText(remoteReviewUrl);
|
|
197
|
+
isCopied = true;
|
|
198
|
+
setTimeout(() => {
|
|
199
|
+
isCopied = false;
|
|
200
|
+
}, 1500);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
async function handleRemoteRequest() {
|
|
205
|
+
if (!actionId?.trim()) {
|
|
206
|
+
errorMessage = chinese
|
|
207
|
+
? '缺少业务请求标识,远程复核请求未提交。'
|
|
208
|
+
: 'A business request ID is required; the remote review request was not submitted.';
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (!onRemoteReviewRequest) {
|
|
213
|
+
errorMessage = chinese
|
|
214
|
+
? '远程复核服务未配置,未生成复核链接。'
|
|
215
|
+
: 'No remote review service is configured; no review link was created.';
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
isVerifying = true;
|
|
220
|
+
errorMessage = null;
|
|
221
|
+
try {
|
|
222
|
+
await onRemoteReviewRequest(buildRequest('remote'));
|
|
223
|
+
} catch (err) {
|
|
224
|
+
errorMessage = err instanceof Error ? err.message : String(err);
|
|
225
|
+
} finally {
|
|
226
|
+
isVerifying = false;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const resolvedDesc = $derived(
|
|
231
|
+
actionDescription ??
|
|
232
|
+
(chinese
|
|
233
|
+
? '本操作涉及高危特权变更或资金资产,系统已开启双人双锁(Two-Person Rule)联签保护,须由第二位授权人员复核后方可执行。'
|
|
234
|
+
: 'This operation involves high-privilege changes. Dual-person approval (Two-Person Rule) is strictly required before execution.'),
|
|
235
|
+
);
|
|
236
|
+
</script>
|
|
237
|
+
|
|
238
|
+
{#if trigger}
|
|
239
|
+
{@render trigger({ openModal: () => (open = true) })}
|
|
240
|
+
{:else if children}
|
|
241
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
242
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
243
|
+
<div onclick={() => (open = true)} class="inline-block">
|
|
244
|
+
{@render children()}
|
|
245
|
+
</div>
|
|
246
|
+
{/if}
|
|
247
|
+
|
|
248
|
+
{#if open}
|
|
249
|
+
<div
|
|
250
|
+
role="dialog"
|
|
251
|
+
aria-modal="true"
|
|
252
|
+
aria-labelledby="dual-approval-title"
|
|
253
|
+
aria-describedby="dual-approval-desc"
|
|
254
|
+
data-svadmin-component="DualApprovalGate"
|
|
255
|
+
class="fixed inset-0 z-50 flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm"
|
|
256
|
+
>
|
|
257
|
+
<!-- Modal Card -->
|
|
258
|
+
<div
|
|
259
|
+
class={cn(
|
|
260
|
+
'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',
|
|
261
|
+
className,
|
|
262
|
+
)}
|
|
263
|
+
>
|
|
264
|
+
<!-- Header -->
|
|
265
|
+
<div class="flex items-start justify-between border-b border-border/60 pb-4">
|
|
266
|
+
<div class="flex items-center gap-3">
|
|
267
|
+
<div class="flex h-11 w-11 shrink-0 items-center justify-center rounded-sm bg-destructive/15 text-destructive border border-destructive/20">
|
|
268
|
+
<ShieldCheck class="h-6 w-6" />
|
|
269
|
+
</div>
|
|
270
|
+
<div>
|
|
271
|
+
<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">
|
|
272
|
+
<AlertTriangle class="h-3 w-3" />
|
|
273
|
+
<span>{chinese ? '特权高危操作 · 双人双锁' : 'Two-Person Rule Required'}</span>
|
|
274
|
+
</div>
|
|
275
|
+
<h3 id="dual-approval-title" class="text-base font-bold text-foreground">
|
|
276
|
+
{actionTitle}
|
|
277
|
+
</h3>
|
|
278
|
+
</div>
|
|
279
|
+
</div>
|
|
280
|
+
|
|
281
|
+
<button
|
|
282
|
+
type="button"
|
|
283
|
+
onclick={handleCancel}
|
|
284
|
+
class="rounded-lg p-1.5 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors"
|
|
285
|
+
aria-label="Close"
|
|
286
|
+
>
|
|
287
|
+
<X class="h-4 w-4" />
|
|
288
|
+
</button>
|
|
289
|
+
</div>
|
|
290
|
+
|
|
291
|
+
<!-- Description Banner -->
|
|
292
|
+
<p id="dual-approval-desc" class="text-xs text-muted-foreground leading-relaxed my-3">
|
|
293
|
+
{resolvedDesc}
|
|
294
|
+
</p>
|
|
295
|
+
|
|
296
|
+
<!-- Mode Switcher Tabs -->
|
|
297
|
+
{#if allowModeSwitch}
|
|
298
|
+
<div class="flex rounded-lg border border-border bg-muted/40 p-1 mb-4 text-xs">
|
|
299
|
+
<button
|
|
300
|
+
type="button"
|
|
301
|
+
onclick={() => (activeMode = 'onsite')}
|
|
302
|
+
class={cn(
|
|
303
|
+
'flex-1 flex items-center justify-center gap-1.5 py-1.5 rounded-md font-medium transition-all',
|
|
304
|
+
selectedMode === 'onsite' ? 'bg-card text-foreground shadow-xs' : 'text-muted-foreground hover:text-foreground',
|
|
305
|
+
)}
|
|
306
|
+
>
|
|
307
|
+
<KeyRound class="h-3.5 w-3.5" />
|
|
308
|
+
<span>{chinese ? '当面同台复核' : 'Onsite Review'}</span>
|
|
309
|
+
</button>
|
|
310
|
+
<button
|
|
311
|
+
type="button"
|
|
312
|
+
onclick={() => (activeMode = 'remote')}
|
|
313
|
+
class={cn(
|
|
314
|
+
'flex-1 flex items-center justify-center gap-1.5 py-1.5 rounded-md font-medium transition-all',
|
|
315
|
+
selectedMode === 'remote' ? 'bg-card text-foreground shadow-xs' : 'text-muted-foreground hover:text-foreground',
|
|
316
|
+
)}
|
|
317
|
+
>
|
|
318
|
+
<QrCode class="h-3.5 w-3.5" />
|
|
319
|
+
<span>{chinese ? '扫码/链接远程复核' : 'Remote QR Review'}</span>
|
|
320
|
+
</button>
|
|
321
|
+
</div>
|
|
322
|
+
{/if}
|
|
323
|
+
|
|
324
|
+
<!-- Error and external approval status -->
|
|
325
|
+
{#if errorMessage || resolvedApprovalError}
|
|
326
|
+
<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">
|
|
327
|
+
<XCircle class="h-4 w-4 shrink-0" />
|
|
328
|
+
<span>{errorMessage ?? resolvedApprovalError}</span>
|
|
329
|
+
</div>
|
|
330
|
+
{/if}
|
|
331
|
+
|
|
332
|
+
{#if approvalState === 'approved'}
|
|
333
|
+
<div role="status" class="flex items-center gap-2 rounded-lg border border-success/30 bg-success/10 p-3 text-xs text-success mb-4">
|
|
334
|
+
<CheckCircle2 class="h-4 w-4 shrink-0" />
|
|
335
|
+
<span>{chinese ? '审批服务已确认复核通过。' : 'The approval service confirmed the review.'}</span>
|
|
336
|
+
</div>
|
|
337
|
+
{:else if approvalState === 'pending' || approvalState === 'submitting'}
|
|
338
|
+
<div role="status" class="flex items-center gap-2 rounded-lg border border-primary/20 bg-primary/10 p-3 text-xs text-primary mb-4" aria-live="polite">
|
|
339
|
+
<Loader2 class="h-4 w-4 shrink-0 animate-spin" />
|
|
340
|
+
<span>{chinese ? '复核请求已提交,等待审批服务确认。' : 'The review request was submitted and is awaiting confirmation.'}</span>
|
|
341
|
+
</div>
|
|
342
|
+
{/if}
|
|
343
|
+
|
|
344
|
+
{#if selectedMode === 'onsite'}
|
|
345
|
+
<!-- Onsite Form -->
|
|
346
|
+
<div class="space-y-3.5 text-xs">
|
|
347
|
+
<div>
|
|
348
|
+
<label for="reviewer-role" class="block font-medium text-foreground mb-1">
|
|
349
|
+
{chinese ? '指定复核角色' : 'Required Role'}
|
|
350
|
+
</label>
|
|
351
|
+
<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">
|
|
352
|
+
<Users class="h-3.5 w-3.5 text-primary" />
|
|
353
|
+
<span>{requiredRole}</span>
|
|
354
|
+
</div>
|
|
355
|
+
</div>
|
|
356
|
+
|
|
357
|
+
<div class="grid grid-cols-2 gap-3">
|
|
358
|
+
<div>
|
|
359
|
+
<label for="reviewer-id" class="block font-medium text-foreground mb-1">
|
|
360
|
+
{chinese ? '复核人工号/账号 *' : 'Reviewer ID *'}
|
|
361
|
+
</label>
|
|
362
|
+
<input
|
|
363
|
+
id="reviewer-id"
|
|
364
|
+
type="text"
|
|
365
|
+
bind:value={reviewerId}
|
|
366
|
+
placeholder={chinese ? '例如: MGR-8801' : 'E.g. ADM-001'}
|
|
367
|
+
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"
|
|
368
|
+
/>
|
|
369
|
+
</div>
|
|
370
|
+
<div>
|
|
371
|
+
<label for="reviewer-name" class="block font-medium text-foreground mb-1">
|
|
372
|
+
{chinese ? '复核人姓名 (选填)' : 'Name (Optional)'}
|
|
373
|
+
</label>
|
|
374
|
+
<input
|
|
375
|
+
id="reviewer-name"
|
|
376
|
+
type="text"
|
|
377
|
+
bind:value={reviewerName}
|
|
378
|
+
placeholder={chinese ? '真实姓名' : 'Reviewer name'}
|
|
379
|
+
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"
|
|
380
|
+
/>
|
|
381
|
+
</div>
|
|
382
|
+
</div>
|
|
383
|
+
|
|
384
|
+
<div>
|
|
385
|
+
<label for="reviewer-secret" class="block font-medium text-foreground mb-1">
|
|
386
|
+
{chinese ? '复核人口令 / 动态 2FA 验证码 *' : 'Reviewer Password / 2FA OTP *'}
|
|
387
|
+
</label>
|
|
388
|
+
<input
|
|
389
|
+
id="reviewer-secret"
|
|
390
|
+
type="password"
|
|
391
|
+
bind:value={reviewerSecret}
|
|
392
|
+
placeholder={chinese ? '输入复核人独立认证口令' : 'Enter authorization secret'}
|
|
393
|
+
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"
|
|
394
|
+
/>
|
|
395
|
+
</div>
|
|
396
|
+
</div>
|
|
397
|
+
{:else}
|
|
398
|
+
<!-- Remote Review QR Code -->
|
|
399
|
+
<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">
|
|
400
|
+
<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">
|
|
401
|
+
<div class="space-y-1 text-center">
|
|
402
|
+
<QrCode class="h-16 w-16 mx-auto text-primary/80" />
|
|
403
|
+
<div class="text-xs font-mono">{chinese ? '复核专属二维码' : 'Approval QR'}</div>
|
|
404
|
+
</div>
|
|
405
|
+
</div>
|
|
406
|
+
|
|
407
|
+
<div class="space-y-1 max-w-sm">
|
|
408
|
+
<p class="text-xs font-medium text-foreground">
|
|
409
|
+
{chinese ? '请联系主管使用移动端扫描上方二维码或点击链接复核' : 'Share link with supervisor to sign remotely'}
|
|
410
|
+
</p>
|
|
411
|
+
<div class="flex items-center gap-1.5 pt-1">
|
|
412
|
+
<input
|
|
413
|
+
readonly
|
|
414
|
+
value={remoteReviewUrl ?? (chinese ? '等待审批服务生成链接' : 'Waiting for the approval service to create a link')}
|
|
415
|
+
class="h-7 w-full rounded border border-border bg-background px-2 text-xs font-mono text-muted-foreground"
|
|
416
|
+
/>
|
|
417
|
+
{#if remoteReviewUrl}
|
|
418
|
+
<Button size="sm" variant="outline" class="h-7 px-2 shrink-0" onclick={handleCopyLink}>
|
|
419
|
+
{#if isCopied}
|
|
420
|
+
<Check class="h-3.5 w-3.5 text-success" />
|
|
421
|
+
{:else}
|
|
422
|
+
<Copy class="h-3.5 w-3.5" />
|
|
423
|
+
{/if}
|
|
424
|
+
</Button>
|
|
425
|
+
{/if}
|
|
426
|
+
</div>
|
|
427
|
+
</div>
|
|
428
|
+
</div>
|
|
429
|
+
{/if}
|
|
430
|
+
|
|
431
|
+
<!-- Footer Actions -->
|
|
432
|
+
<div class="mt-6 flex items-center justify-between border-t border-border/60 pt-4">
|
|
433
|
+
<span class="text-xs text-muted-foreground font-mono">
|
|
434
|
+
ID: {actionId ?? (chinese ? '由审批服务提供' : 'Provided by approval service')}
|
|
435
|
+
</span>
|
|
436
|
+
|
|
437
|
+
<div class="flex items-center gap-2">
|
|
438
|
+
<Button
|
|
439
|
+
type="button"
|
|
440
|
+
variant="ghost"
|
|
441
|
+
size="sm"
|
|
442
|
+
onclick={handleCancel}
|
|
443
|
+
disabled={isVerifying}
|
|
444
|
+
>
|
|
445
|
+
{chinese ? '放弃操作' : 'Cancel'}
|
|
446
|
+
</Button>
|
|
447
|
+
|
|
448
|
+
{#if selectedMode === 'onsite'}
|
|
449
|
+
<Button
|
|
450
|
+
type="button"
|
|
451
|
+
size="sm"
|
|
452
|
+
onclick={handleOnsiteSubmit}
|
|
453
|
+
disabled={isVerifying || reviewLocked || !reviewerId || !reviewerSecret}
|
|
454
|
+
class="gap-1.5 min-w-28 bg-destructive text-destructive-foreground hover:bg-destructive/90"
|
|
455
|
+
>
|
|
456
|
+
{#if isVerifying}
|
|
457
|
+
<Loader2 class="h-3.5 w-3.5 animate-spin" />
|
|
458
|
+
<span>{chinese ? '联签核验中...' : 'Verifying...'}</span>
|
|
459
|
+
{:else}
|
|
460
|
+
<ShieldCheck class="h-3.5 w-3.5" />
|
|
461
|
+
<span>{chinese ? '确认双人联签' : 'Dual Approve'}</span>
|
|
462
|
+
{/if}
|
|
463
|
+
</Button>
|
|
464
|
+
{:else}
|
|
465
|
+
<Button
|
|
466
|
+
type="button"
|
|
467
|
+
size="sm"
|
|
468
|
+
onclick={handleRemoteRequest}
|
|
469
|
+
disabled={isVerifying || reviewLocked}
|
|
470
|
+
class="gap-1.5"
|
|
471
|
+
>
|
|
472
|
+
{#if isVerifying}
|
|
473
|
+
<Loader2 class="h-3.5 w-3.5 animate-spin" />
|
|
474
|
+
<span>{chinese ? '创建复核请求中...' : 'Creating review request...'}</span>
|
|
475
|
+
{:else}
|
|
476
|
+
<QrCode class="h-3.5 w-3.5" />
|
|
477
|
+
<span>{chinese ? '请求远程复核' : 'Request Remote Review'}</span>
|
|
478
|
+
{/if}
|
|
479
|
+
</Button>
|
|
480
|
+
{/if}
|
|
481
|
+
</div>
|
|
482
|
+
</div>
|
|
483
|
+
</div>
|
|
484
|
+
</div>
|
|
485
|
+
{/if}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
export type ApprovalMode = 'onsite' | 'remote';
|
|
3
|
+
export type DualApprovalState = 'idle' | 'submitting' | 'pending' | 'approved' | 'rejected' | 'unknown';
|
|
4
|
+
export interface ReviewerVerificationPayload {
|
|
5
|
+
reviewerId: string;
|
|
6
|
+
reviewerName?: string | undefined;
|
|
7
|
+
reviewerRole: string;
|
|
8
|
+
secret: string;
|
|
9
|
+
actionTitle: string;
|
|
10
|
+
}
|
|
11
|
+
export interface DualApprovalAuditRecord {
|
|
12
|
+
actionId: string;
|
|
13
|
+
actionTitle: string;
|
|
14
|
+
initiator?: string | undefined;
|
|
15
|
+
reviewerId: string;
|
|
16
|
+
reviewerRole: string;
|
|
17
|
+
mode: ApprovalMode;
|
|
18
|
+
approvedAt: string;
|
|
19
|
+
auditHash: string;
|
|
20
|
+
}
|
|
21
|
+
export interface DualApprovalRequest {
|
|
22
|
+
actionId?: string | undefined;
|
|
23
|
+
actionTitle: string;
|
|
24
|
+
actionPayload?: Record<string, unknown> | undefined;
|
|
25
|
+
reviewerId?: string | undefined;
|
|
26
|
+
reviewerName?: string | undefined;
|
|
27
|
+
reviewerRole: string;
|
|
28
|
+
secret?: string | undefined;
|
|
29
|
+
mode: ApprovalMode;
|
|
30
|
+
}
|
|
31
|
+
export interface DualApprovalGateProps {
|
|
32
|
+
open?: boolean | undefined;
|
|
33
|
+
/** Stable business action identifier supplied by the host/RPC layer. */
|
|
34
|
+
actionId?: string | undefined;
|
|
35
|
+
actionTitle: string;
|
|
36
|
+
actionDescription?: string | undefined;
|
|
37
|
+
actionPayload?: Record<string, unknown> | undefined;
|
|
38
|
+
requiredRole?: string | undefined;
|
|
39
|
+
defaultMode?: ApprovalMode | undefined;
|
|
40
|
+
allowModeSwitch?: boolean | undefined;
|
|
41
|
+
approvalState?: DualApprovalState | undefined;
|
|
42
|
+
approvalError?: string | undefined;
|
|
43
|
+
remoteReviewUrl?: string | undefined;
|
|
44
|
+
verifyReviewer?: ((payload: ReviewerVerificationPayload) => Promise<boolean | undefined> | boolean | undefined) | undefined;
|
|
45
|
+
/** Submit a review intent; the host must update approvalState from the FA RPC result. */
|
|
46
|
+
onReviewRequest?: ((request: DualApprovalRequest) => Promise<void> | void) | undefined;
|
|
47
|
+
/** Request creation of a remote review link; the host supplies the resulting URL. */
|
|
48
|
+
onRemoteReviewRequest?: ((request: DualApprovalRequest) => Promise<void> | void) | undefined;
|
|
49
|
+
onRejected?: ((reason?: string) => void) | undefined;
|
|
50
|
+
class?: string | undefined;
|
|
51
|
+
trigger?: Snippet<[{
|
|
52
|
+
openModal: () => void;
|
|
53
|
+
}]> | undefined;
|
|
54
|
+
children?: Snippet | undefined;
|
|
55
|
+
}
|
|
56
|
+
declare const DualApprovalGate: import("svelte").Component<DualApprovalGateProps, {}, "open">;
|
|
57
|
+
type DualApprovalGate = ReturnType<typeof DualApprovalGate>;
|
|
58
|
+
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>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export type SealType = 'official' | 'finance' | 'contract' | 'approved' | 'rejected' | 'void';
|
|
3
|
+
|
|
4
|
+
export interface ElectronicSealStampProps {
|
|
5
|
+
companyName?: string | undefined;
|
|
6
|
+
sealTitle?: string | undefined;
|
|
7
|
+
serialNumber?: string | undefined;
|
|
8
|
+
type?: SealType | undefined;
|
|
9
|
+
dateText?: string | undefined;
|
|
10
|
+
size?: 'sm' | 'md' | 'lg' | undefined;
|
|
11
|
+
rotate?: number | undefined;
|
|
12
|
+
class?: string | undefined;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
companyName = '上海创智多租户研发网络科技有限公司',
|
|
17
|
+
sealTitle = '电子审批专用章',
|
|
18
|
+
serialNumber = '3101040098214',
|
|
19
|
+
type = 'official',
|
|
20
|
+
dateText = '2026-11-12',
|
|
21
|
+
size = 'md',
|
|
22
|
+
rotate = -6,
|
|
23
|
+
class: className = '',
|
|
24
|
+
}: ElectronicSealStampProps = $props();
|
|
25
|
+
|
|
26
|
+
const sizePixel = $derived.by(() => {
|
|
27
|
+
switch (size) {
|
|
28
|
+
case 'sm': return 100;
|
|
29
|
+
case 'lg': return 180;
|
|
30
|
+
default: return 140;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const isRejected = $derived(type === 'rejected' || type === 'void');
|
|
35
|
+
const strokeColor = $derived(isRejected ? 'currentColor text-destructive' : 'currentColor text-destructive');
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<div
|
|
39
|
+
class="inline-block select-none pointer-events-none transition-transform opacity-90 {className}"
|
|
40
|
+
style="transform: rotate({rotate}deg);"
|
|
41
|
+
data-svadmin-component="ElectronicSealStamp"
|
|
42
|
+
data-seal-type={type}
|
|
43
|
+
aria-label="{companyName} {sealTitle}"
|
|
44
|
+
>
|
|
45
|
+
<svg
|
|
46
|
+
width={sizePixel}
|
|
47
|
+
height={sizePixel}
|
|
48
|
+
viewBox="0 0 200 200"
|
|
49
|
+
class="{strokeColor}"
|
|
50
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
51
|
+
>
|
|
52
|
+
<!-- Outer Double Circular Rings -->
|
|
53
|
+
<circle cx="100" cy="100" r="95" fill="none" stroke="currentColor" stroke-width="4" stroke-opacity="0.85" />
|
|
54
|
+
<circle cx="100" cy="100" r="90" fill="none" stroke="currentColor" stroke-width="1.5" stroke-opacity="0.85" />
|
|
55
|
+
|
|
56
|
+
<!-- Arc Path Definition for Top Curving Text -->
|
|
57
|
+
<defs>
|
|
58
|
+
<path id="seal-text-arc" d="M 22,100 A 78,78 0 1,1 178,100" fill="none" />
|
|
59
|
+
</defs>
|
|
60
|
+
|
|
61
|
+
<!-- Top Curving Company Name Text -->
|
|
62
|
+
<text font-size="12" font-weight="bold" fill="currentColor" letter-spacing="1.5" text-anchor="middle">
|
|
63
|
+
<textPath href="#seal-text-arc" startOffset="50%">
|
|
64
|
+
{companyName}
|
|
65
|
+
</textPath>
|
|
66
|
+
</text>
|
|
67
|
+
|
|
68
|
+
<!-- Center Emblem (5-point star or status word) -->
|
|
69
|
+
{#if type === 'approved'}
|
|
70
|
+
<rect x="50" y="80" width="100" height="32" rx="4" fill="none" stroke="currentColor" stroke-width="2" />
|
|
71
|
+
<text x="100" y="102" font-size="18" font-weight="900" fill="currentColor" text-anchor="middle">已通过</text>
|
|
72
|
+
{:else if type === 'rejected'}
|
|
73
|
+
<rect x="50" y="80" width="100" height="32" rx="4" fill="none" stroke="currentColor" stroke-width="2" />
|
|
74
|
+
<text x="100" y="102" font-size="18" font-weight="900" fill="currentColor" text-anchor="middle">已驳回</text>
|
|
75
|
+
{:else}
|
|
76
|
+
<!-- Classic 5-Point Star -->
|
|
77
|
+
<polygon
|
|
78
|
+
points="100,56 108,78 131,78 112,92 119,114 100,101 81,114 88,92 69,78 92,78"
|
|
79
|
+
fill="currentColor"
|
|
80
|
+
fill-opacity="0.85"
|
|
81
|
+
/>
|
|
82
|
+
<!-- Seal Title underneath Star -->
|
|
83
|
+
<text x="100" y="132" font-size="13" font-weight="bold" fill="currentColor" text-anchor="middle">
|
|
84
|
+
{sealTitle}
|
|
85
|
+
</text>
|
|
86
|
+
{/if}
|
|
87
|
+
|
|
88
|
+
<!-- Date underneath -->
|
|
89
|
+
{#if dateText}
|
|
90
|
+
<text x="100" y="152" font-size="10" font-family="monospace" font-weight="bold" fill="currentColor" text-anchor="middle">
|
|
91
|
+
{dateText}
|
|
92
|
+
</text>
|
|
93
|
+
{/if}
|
|
94
|
+
|
|
95
|
+
<!-- Bottom Serial Number -->
|
|
96
|
+
{#if serialNumber}
|
|
97
|
+
<text x="100" y="174" font-size="9" font-family="monospace" letter-spacing="1" fill="currentColor" text-anchor="middle">
|
|
98
|
+
{serialNumber}
|
|
99
|
+
</text>
|
|
100
|
+
{/if}
|
|
101
|
+
</svg>
|
|
102
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type SealType = 'official' | 'finance' | 'contract' | 'approved' | 'rejected' | 'void';
|
|
2
|
+
export interface ElectronicSealStampProps {
|
|
3
|
+
companyName?: string | undefined;
|
|
4
|
+
sealTitle?: string | undefined;
|
|
5
|
+
serialNumber?: string | undefined;
|
|
6
|
+
type?: SealType | undefined;
|
|
7
|
+
dateText?: string | undefined;
|
|
8
|
+
size?: 'sm' | 'md' | 'lg' | undefined;
|
|
9
|
+
rotate?: number | undefined;
|
|
10
|
+
class?: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
declare const ElectronicSealStamp: import("svelte").Component<ElectronicSealStampProps, {}, "">;
|
|
13
|
+
type ElectronicSealStamp = ReturnType<typeof ElectronicSealStamp>;
|
|
14
|
+
export default ElectronicSealStamp;
|