@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,154 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Filter, ArrowDown } from '@lucide/svelte';
|
|
3
|
+
import { useTranslation } from '@svadmin/core/i18n';
|
|
4
|
+
import { cn } from '../utils.js';
|
|
5
|
+
|
|
6
|
+
export interface FunnelStageItem {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
value: number;
|
|
10
|
+
description?: string | undefined;
|
|
11
|
+
color?: string | undefined;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface ConversionFunnelProps {
|
|
15
|
+
stages: FunnelStageItem[];
|
|
16
|
+
title?: string | undefined;
|
|
17
|
+
description?: string | undefined;
|
|
18
|
+
showPercentages?: boolean | undefined;
|
|
19
|
+
showDropoff?: boolean | undefined;
|
|
20
|
+
valuePrefix?: string | undefined;
|
|
21
|
+
valueSuffix?: string | undefined;
|
|
22
|
+
height?: number | undefined;
|
|
23
|
+
class?: string | undefined;
|
|
24
|
+
onSelectStage?: ((stage: FunnelStageItem) => void) | undefined;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let {
|
|
28
|
+
stages = [],
|
|
29
|
+
title,
|
|
30
|
+
description,
|
|
31
|
+
showPercentages = true,
|
|
32
|
+
showDropoff = true,
|
|
33
|
+
valuePrefix = '',
|
|
34
|
+
valueSuffix = '',
|
|
35
|
+
height = 360,
|
|
36
|
+
class: className = '',
|
|
37
|
+
onSelectStage,
|
|
38
|
+
}: ConversionFunnelProps = $props();
|
|
39
|
+
|
|
40
|
+
const i18n = useTranslation();
|
|
41
|
+
const chinese = $derived(i18n.locale.startsWith('zh'));
|
|
42
|
+
|
|
43
|
+
let hoveredStageId = $state<string | null>(null);
|
|
44
|
+
|
|
45
|
+
const maxValue = $derived(
|
|
46
|
+
stages.length > 0 ? Math.max(...stages.map((s) => s.value), 1) : 1,
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const computedStages = $derived.by(() => {
|
|
50
|
+
return stages.map((stage, idx) => {
|
|
51
|
+
const prev = stages[idx - 1];
|
|
52
|
+
const rateFromTop = Math.round((stage.value / maxValue) * 100);
|
|
53
|
+
const dropoff = prev && prev.value > 0 ? Math.round(((prev.value - stage.value) / prev.value) * 100) : 0;
|
|
54
|
+
return {
|
|
55
|
+
...stage,
|
|
56
|
+
rateFromTop,
|
|
57
|
+
dropoff: Math.max(0, dropoff),
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const resolvedTitle = $derived(title ?? (chinese ? '业务链路转化漏斗' : 'Conversion Funnel'));
|
|
63
|
+
const resolvedDesc = $derived(
|
|
64
|
+
description ?? (chinese ? '各阶段用户留存、流失率与端到端绝对转化分析' : 'Stage-by-stage retention and drop-off rate metrics'),
|
|
65
|
+
);
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<div
|
|
69
|
+
data-svadmin-component="ConversionFunnel"
|
|
70
|
+
style="min-height: {height}px;"
|
|
71
|
+
class={cn(
|
|
72
|
+
'w-full rounded-md border border-border bg-card text-card-foreground shadow-xs p-6 space-y-4',
|
|
73
|
+
className,
|
|
74
|
+
)}
|
|
75
|
+
>
|
|
76
|
+
<div class="flex items-center justify-between border-b border-border/60 pb-3">
|
|
77
|
+
<div class="flex items-center gap-2.5">
|
|
78
|
+
<div class="flex h-8 w-8 items-center justify-center rounded-sm bg-primary/10 text-primary border border-primary/20">
|
|
79
|
+
<Filter class="h-4 w-4" />
|
|
80
|
+
</div>
|
|
81
|
+
<div>
|
|
82
|
+
<h3 class="text-sm font-semibold text-foreground">{resolvedTitle}</h3>
|
|
83
|
+
<p class="text-xs text-muted-foreground">{resolvedDesc}</p>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<!-- Funnel Visual Stack -->
|
|
89
|
+
<div class="space-y-2 py-2">
|
|
90
|
+
{#each computedStages as stage, idx (stage.id)}
|
|
91
|
+
{@const isHovered = hoveredStageId === stage.id}
|
|
92
|
+
{@const widthPct = Math.max(15, Math.min(100, (stage.value / maxValue) * 100))}
|
|
93
|
+
<div
|
|
94
|
+
class="group relative flex flex-col items-center"
|
|
95
|
+
onmouseenter={() => (hoveredStageId = stage.id)}
|
|
96
|
+
onmouseleave={() => (hoveredStageId = null)}
|
|
97
|
+
role="button"
|
|
98
|
+
tabindex="0"
|
|
99
|
+
onclick={() => onSelectStage?.(stage)}
|
|
100
|
+
onkeydown={(e) => e.key === 'Enter' && onSelectStage?.(stage)}
|
|
101
|
+
>
|
|
102
|
+
<!-- Funnel Bar Segment -->
|
|
103
|
+
<div
|
|
104
|
+
class={cn(
|
|
105
|
+
'relative flex h-14 items-center justify-between px-4 rounded-sm transition-all duration-200 cursor-pointer shadow-xs border',
|
|
106
|
+
isHovered ? 'ring-2 ring-primary border-primary scale-[1.01]' : 'border-border/80 hover:border-primary/50',
|
|
107
|
+
)}
|
|
108
|
+
style="width: {widthPct}%; background: {stage.color ?? 'var(--card)'};"
|
|
109
|
+
>
|
|
110
|
+
<div class="flex items-center gap-2 truncate">
|
|
111
|
+
<span class="flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary/15 text-primary text-xs font-bold">
|
|
112
|
+
{idx + 1}
|
|
113
|
+
</span>
|
|
114
|
+
<span class="text-xs font-semibold text-foreground truncate">{stage.label}</span>
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
<div class="flex items-center gap-3 shrink-0 font-mono text-xs">
|
|
118
|
+
<span class="font-bold text-foreground">
|
|
119
|
+
{valuePrefix}{stage.value.toLocaleString()}{valueSuffix}
|
|
120
|
+
</span>
|
|
121
|
+
{#if showPercentages}
|
|
122
|
+
<span class="rounded bg-primary/10 px-1.5 py-0.5 text-xs font-medium text-primary">
|
|
123
|
+
{stage.rateFromTop}%
|
|
124
|
+
</span>
|
|
125
|
+
{/if}
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
<!-- Drop-off Transition Pill between stages -->
|
|
130
|
+
{#if idx < computedStages.length - 1 && showDropoff}
|
|
131
|
+
{@const nextStage = computedStages[idx + 1]}
|
|
132
|
+
{#if nextStage}
|
|
133
|
+
<div class="my-1 flex items-center gap-1.5 text-xs text-muted-foreground/80 font-mono">
|
|
134
|
+
<ArrowDown class="h-3 w-3 text-muted-foreground/60" />
|
|
135
|
+
<span class="text-destructive font-medium">-{nextStage.dropoff}% 流失</span>
|
|
136
|
+
<span>({valuePrefix}{(stage.value - nextStage.value).toLocaleString()})</span>
|
|
137
|
+
</div>
|
|
138
|
+
{/if}
|
|
139
|
+
{/if}
|
|
140
|
+
</div>
|
|
141
|
+
{/each}
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<!-- Overall Summary Metrics Footer -->
|
|
145
|
+
{#if computedStages.length >= 2}
|
|
146
|
+
{@const firstVal = computedStages[0]?.value ?? 1}
|
|
147
|
+
{@const lastVal = computedStages[computedStages.length - 1]?.value ?? 0}
|
|
148
|
+
{@const endToEndRate = Math.round((lastVal / firstVal) * 100)}
|
|
149
|
+
<div class="flex items-center justify-between border-t border-border/60 pt-3 text-xs text-muted-foreground bg-muted/20 px-3 py-2 rounded-lg">
|
|
150
|
+
<span>{chinese ? '端到端综合留存转化率:' : 'End-to-End Overall Conversion:'}</span>
|
|
151
|
+
<span class="font-bold font-mono text-foreground">{endToEndRate}%</span>
|
|
152
|
+
</div>
|
|
153
|
+
{/if}
|
|
154
|
+
</div>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface FunnelStageItem {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
value: number;
|
|
5
|
+
description?: string | undefined;
|
|
6
|
+
color?: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface ConversionFunnelProps {
|
|
9
|
+
stages: FunnelStageItem[];
|
|
10
|
+
title?: string | undefined;
|
|
11
|
+
description?: string | undefined;
|
|
12
|
+
showPercentages?: boolean | undefined;
|
|
13
|
+
showDropoff?: boolean | undefined;
|
|
14
|
+
valuePrefix?: string | undefined;
|
|
15
|
+
valueSuffix?: string | undefined;
|
|
16
|
+
height?: number | undefined;
|
|
17
|
+
class?: string | undefined;
|
|
18
|
+
onSelectStage?: ((stage: FunnelStageItem) => void) | undefined;
|
|
19
|
+
}
|
|
20
|
+
declare const ConversionFunnel: import("svelte").Component<ConversionFunnelProps, {}, "">;
|
|
21
|
+
type ConversionFunnel = ReturnType<typeof ConversionFunnel>;
|
|
22
|
+
export default ConversionFunnel;
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
|
|
118
118
|
<div
|
|
119
119
|
data-svadmin-component="CronExpressionBuilder"
|
|
120
|
-
class={cn('rounded-
|
|
120
|
+
class={cn('rounded-md border border-border bg-card p-4 shadow-xs text-xs space-y-4 font-sans', className)}
|
|
121
121
|
>
|
|
122
122
|
<!-- Header: Cron Display & Copy -->
|
|
123
123
|
<div class="flex flex-wrap items-center justify-between gap-3 pb-3 border-b border-border/60">
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { useTranslation } from '@svadmin/core/i18n';
|
|
4
|
+
import { listText } from './list-i18n.js';
|
|
5
|
+
|
|
6
|
+
type Props = Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'children'> & {
|
|
7
|
+
label: string;
|
|
8
|
+
page: number;
|
|
9
|
+
loadedCount: number;
|
|
10
|
+
hasPrevious: boolean;
|
|
11
|
+
hasNext: boolean;
|
|
12
|
+
loading?: boolean | undefined;
|
|
13
|
+
note?: string | undefined;
|
|
14
|
+
sectionId?: string | undefined;
|
|
15
|
+
onPrevious: () => void;
|
|
16
|
+
onNext: () => void;
|
|
17
|
+
class?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
let {
|
|
21
|
+
label,
|
|
22
|
+
page,
|
|
23
|
+
loadedCount,
|
|
24
|
+
hasPrevious,
|
|
25
|
+
hasNext,
|
|
26
|
+
loading = false,
|
|
27
|
+
note = '',
|
|
28
|
+
sectionId,
|
|
29
|
+
onPrevious,
|
|
30
|
+
onNext,
|
|
31
|
+
class: className = '',
|
|
32
|
+
...restProps
|
|
33
|
+
}: Props = $props();
|
|
34
|
+
|
|
35
|
+
const i18n = useTranslation();
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<div {...restProps} class={`svadmin-cursor-list-footer ${className}`.trim()} data-svadmin-cursor-list-footer data-section={sectionId}>
|
|
39
|
+
<div class="svadmin-cursor-list-footer__status" aria-live="polite">
|
|
40
|
+
<span>{listText(i18n, 'cursorListFooter.loaded', { count: loadedCount })}</span>
|
|
41
|
+
{#if note}<span class="svadmin-cursor-list-footer__note">{note}</span>{/if}
|
|
42
|
+
</div>
|
|
43
|
+
<div class="svadmin-cursor-list-footer__navigation" role="navigation" aria-label={listText(i18n, 'cursorListFooter.navigation', { label })}>
|
|
44
|
+
<button type="button" class="svadmin-cursor-list-footer__control" disabled={loading || !hasPrevious}
|
|
45
|
+
title={listText(i18n, hasPrevious ? 'cursorListFooter.previousAria' : 'cursorListFooter.firstPage', { label })}
|
|
46
|
+
aria-label={listText(i18n, 'cursorListFooter.previousAria', { label })} onclick={onPrevious}>
|
|
47
|
+
← {listText(i18n, 'listPagination.previous')}
|
|
48
|
+
</button>
|
|
49
|
+
<span class="svadmin-cursor-list-footer__page">{listText(i18n, 'cursorListFooter.page', { page })}</span>
|
|
50
|
+
<button type="button" class="svadmin-cursor-list-footer__control" disabled={loading || !hasNext}
|
|
51
|
+
title={listText(i18n, hasNext ? 'cursorListFooter.nextAria' : 'cursorListFooter.nextUnavailable', { label })}
|
|
52
|
+
aria-label={listText(i18n, 'cursorListFooter.nextAria', { label })} onclick={onNext}>
|
|
53
|
+
{listText(i18n, 'listPagination.next')} →
|
|
54
|
+
</button>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<style>
|
|
59
|
+
.svadmin-cursor-list-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem 1rem; min-width: 0; border-top: 1px solid var(--border); padding: .75rem 0 0; }
|
|
60
|
+
.svadmin-cursor-list-footer__status { display: flex; align-items: baseline; flex-wrap: wrap; gap: .35rem .75rem; min-width: 0; font-size: .8125rem; color: var(--muted-foreground); }
|
|
61
|
+
.svadmin-cursor-list-footer__note { color: var(--foreground); }
|
|
62
|
+
.svadmin-cursor-list-footer__navigation { display: flex; align-items: center; gap: .5rem; }
|
|
63
|
+
.svadmin-cursor-list-footer__control { min-width: 2.25rem; min-height: 2.25rem; border: 1px solid var(--border); border-radius: .375rem; background: var(--background); color: inherit; padding: 0 .75rem; cursor: pointer; font: inherit; font-size: .8125rem; }
|
|
64
|
+
.svadmin-cursor-list-footer__control:hover:not(:disabled) { border-color: var(--ring); color: var(--primary); }
|
|
65
|
+
.svadmin-cursor-list-footer__control:disabled { cursor: not-allowed; opacity: .55; }
|
|
66
|
+
.svadmin-cursor-list-footer__page { min-width: 4rem; color: var(--muted-foreground); font-size: .8125rem; text-align: center; }
|
|
67
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
type Props = Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'children'> & {
|
|
3
|
+
label: string;
|
|
4
|
+
page: number;
|
|
5
|
+
loadedCount: number;
|
|
6
|
+
hasPrevious: boolean;
|
|
7
|
+
hasNext: boolean;
|
|
8
|
+
loading?: boolean | undefined;
|
|
9
|
+
note?: string | undefined;
|
|
10
|
+
sectionId?: string | undefined;
|
|
11
|
+
onPrevious: () => void;
|
|
12
|
+
onNext: () => void;
|
|
13
|
+
class?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
declare const CursorListFooter: import("svelte").Component<Props, {}, "">;
|
|
16
|
+
type CursorListFooter = ReturnType<typeof CursorListFooter>;
|
|
17
|
+
export default CursorListFooter;
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
LayoutDashboard,
|
|
4
|
+
GripVertical,
|
|
5
|
+
Plus,
|
|
6
|
+
RotateCcw,
|
|
7
|
+
Edit3,
|
|
8
|
+
Check,
|
|
9
|
+
Trash2,
|
|
10
|
+
Lock,
|
|
11
|
+
Unlock,
|
|
12
|
+
Maximize2,
|
|
13
|
+
Minimize2,
|
|
14
|
+
BarChart3,
|
|
15
|
+
Table as TableIcon,
|
|
16
|
+
} from '@lucide/svelte';
|
|
17
|
+
import { cn } from '../utils.js';
|
|
18
|
+
import { Button } from './ui/button/index.js';
|
|
19
|
+
|
|
20
|
+
export interface DashboardGridItem {
|
|
21
|
+
id: string;
|
|
22
|
+
title: string;
|
|
23
|
+
x?: number | undefined;
|
|
24
|
+
y?: number | undefined;
|
|
25
|
+
w: number; // 1..12
|
|
26
|
+
h: number; // rows
|
|
27
|
+
minW?: number | undefined;
|
|
28
|
+
minH?: number | undefined;
|
|
29
|
+
static?: boolean | undefined;
|
|
30
|
+
category?: string | undefined;
|
|
31
|
+
widgetType?: 'kpi' | 'chart' | 'table' | 'log' | 'custom' | undefined;
|
|
32
|
+
description?: string | undefined;
|
|
33
|
+
metricValue?: string | number | undefined;
|
|
34
|
+
metricTrend?: string | undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface DashboardGridLayoutProps {
|
|
38
|
+
items?: DashboardGridItem[] | undefined;
|
|
39
|
+
isEditable?: boolean | undefined;
|
|
40
|
+
title?: string | undefined;
|
|
41
|
+
description?: string | undefined;
|
|
42
|
+
class?: string | undefined;
|
|
43
|
+
onLayoutChange?: ((items: DashboardGridItem[]) => void) | undefined;
|
|
44
|
+
onAddWidget?: ((type: DashboardGridItem['widgetType']) => void) | undefined;
|
|
45
|
+
onRemoveWidget?: ((id: string) => void) | undefined;
|
|
46
|
+
onResetLayout?: (() => void) | undefined;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let {
|
|
50
|
+
items = $bindable([
|
|
51
|
+
{ id: 'wgt-kpi-rev', title: '本季度核心营收 (GMV)', w: 4, h: 2, widgetType: 'kpi', category: '财务', metricValue: '¥48,290,000', metricTrend: '+18.4% 同比' },
|
|
52
|
+
{ id: 'wgt-kpi-users', title: '全局活跃企业租户数', w: 4, h: 2, widgetType: 'kpi', category: 'SaaS', metricValue: '1,420 家', metricTrend: '+12.1% 环比' },
|
|
53
|
+
{ id: 'wgt-kpi-sla', title: '核心网关可用率 (SLA)', w: 4, h: 2, widgetType: 'kpi', category: 'SRE', metricValue: '99.985%', metricTrend: '稳定运行 42天' },
|
|
54
|
+
{ id: 'wgt-chart-trend', title: '双大区实时业务吞吐量趋势', w: 8, h: 4, widgetType: 'chart', category: '监控', description: '华东大区与华北多活集群实时 QPS 波动曲线' },
|
|
55
|
+
{ id: 'wgt-table-orders', title: '最新待审批大额采购单', w: 4, h: 4, widgetType: 'table', category: '审批', description: '超 10 万元资金划转与双人复核队列' },
|
|
56
|
+
]),
|
|
57
|
+
isEditable = $bindable(false),
|
|
58
|
+
title = '智能动态业务大屏 (Dashboard Grid)',
|
|
59
|
+
description = '12 栅格自适应流式排版,支持小部件拖拽、尺寸自由伸缩与布局方案持久化',
|
|
60
|
+
class: className = '',
|
|
61
|
+
onLayoutChange,
|
|
62
|
+
onAddWidget,
|
|
63
|
+
onRemoveWidget,
|
|
64
|
+
onResetLayout,
|
|
65
|
+
}: DashboardGridLayoutProps = $props();
|
|
66
|
+
|
|
67
|
+
function toggleEditable() {
|
|
68
|
+
isEditable = !isEditable;
|
|
69
|
+
if (!isEditable) {
|
|
70
|
+
onLayoutChange?.(items);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function resizeItem(id: string, deltaW: number, deltaH: number) {
|
|
75
|
+
items = items.map((it) => {
|
|
76
|
+
if (it.id !== id || it.static) return it;
|
|
77
|
+
const newW = Math.max(1, Math.min(12, it.w + deltaW));
|
|
78
|
+
const newH = Math.max(1, Math.min(8, it.h + deltaH));
|
|
79
|
+
return { ...it, w: newW, h: newH };
|
|
80
|
+
});
|
|
81
|
+
onLayoutChange?.(items);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function toggleLock(id: string) {
|
|
85
|
+
items = items.map((it) => {
|
|
86
|
+
if (it.id !== id) return it;
|
|
87
|
+
return { ...it, static: !it.static };
|
|
88
|
+
});
|
|
89
|
+
onLayoutChange?.(items);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function removeItem(id: string) {
|
|
93
|
+
items = items.filter((it) => it.id !== id);
|
|
94
|
+
onRemoveWidget?.(id);
|
|
95
|
+
onLayoutChange?.(items);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function addSampleWidget(type: DashboardGridItem['widgetType'] = 'kpi') {
|
|
99
|
+
const id = `wgt-${Date.now()}`;
|
|
100
|
+
const newWidget: DashboardGridItem = {
|
|
101
|
+
id,
|
|
102
|
+
title: type === 'kpi' ? '新指标计分卡' : type === 'chart' ? '新业务统计图表' : '新待办数据表',
|
|
103
|
+
w: type === 'chart' ? 6 : 4,
|
|
104
|
+
h: type === 'chart' ? 3 : 2,
|
|
105
|
+
widgetType: type,
|
|
106
|
+
category: '自定义',
|
|
107
|
+
metricValue: type === 'kpi' ? '98.5%' : undefined,
|
|
108
|
+
};
|
|
109
|
+
items = [...items, newWidget];
|
|
110
|
+
onAddWidget?.(type);
|
|
111
|
+
onLayoutChange?.(items);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function resetToDefault() {
|
|
115
|
+
onResetLayout?.();
|
|
116
|
+
}
|
|
117
|
+
</script>
|
|
118
|
+
|
|
119
|
+
<div
|
|
120
|
+
class={cn('w-full rounded-2xl border border-border bg-card text-foreground shadow-sm flex flex-col overflow-hidden', className)}
|
|
121
|
+
data-svadmin-component="dashboard-grid-layout"
|
|
122
|
+
>
|
|
123
|
+
<!-- 头部控制栏 -->
|
|
124
|
+
<div class="p-4 border-b border-border bg-muted/10 flex flex-col sm:flex-row sm:items-center justify-between gap-3">
|
|
125
|
+
<div class="flex items-center gap-2.5">
|
|
126
|
+
<div class="flex items-center justify-center w-8 h-8 rounded-lg bg-primary/10 text-primary border border-primary/20 shrink-0">
|
|
127
|
+
<LayoutDashboard class="w-4 h-4" />
|
|
128
|
+
</div>
|
|
129
|
+
<div>
|
|
130
|
+
<h3 class="text-sm font-semibold text-foreground tracking-tight">{title}</h3>
|
|
131
|
+
<p class="text-xs text-muted-foreground">{description}</p>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
|
|
135
|
+
<!-- 顶部操作按钮 -->
|
|
136
|
+
<div class="flex items-center gap-2">
|
|
137
|
+
{#if isEditable}
|
|
138
|
+
<Button
|
|
139
|
+
variant="outline"
|
|
140
|
+
size="sm"
|
|
141
|
+
class="h-8 gap-1 text-xs"
|
|
142
|
+
onclick={() => addSampleWidget('kpi')}
|
|
143
|
+
>
|
|
144
|
+
<Plus class="w-3.5 h-3.5 text-primary" />
|
|
145
|
+
<span>添加卡片</span>
|
|
146
|
+
</Button>
|
|
147
|
+
|
|
148
|
+
<Button
|
|
149
|
+
variant="outline"
|
|
150
|
+
size="sm"
|
|
151
|
+
class="h-8 gap-1 text-xs"
|
|
152
|
+
onclick={() => addSampleWidget('chart')}
|
|
153
|
+
>
|
|
154
|
+
<BarChart3 class="w-3.5 h-3.5 text-primary" />
|
|
155
|
+
<span>添加图表</span>
|
|
156
|
+
</Button>
|
|
157
|
+
|
|
158
|
+
<Button
|
|
159
|
+
variant="ghost"
|
|
160
|
+
size="sm"
|
|
161
|
+
class="h-8 gap-1 text-xs text-muted-foreground"
|
|
162
|
+
onclick={resetToDefault}
|
|
163
|
+
>
|
|
164
|
+
<RotateCcw class="w-3.5 h-3.5" />
|
|
165
|
+
<span>重置默认</span>
|
|
166
|
+
</Button>
|
|
167
|
+
{/if}
|
|
168
|
+
|
|
169
|
+
<Button
|
|
170
|
+
variant={isEditable ? 'default' : 'outline'}
|
|
171
|
+
size="sm"
|
|
172
|
+
class={cn('h-8 gap-1.5 text-xs', isEditable && 'bg-primary text-primary-foreground')}
|
|
173
|
+
onclick={toggleEditable}
|
|
174
|
+
>
|
|
175
|
+
{#if isEditable}
|
|
176
|
+
<Check class="w-3.5 h-3.5" />
|
|
177
|
+
<span>完成排版</span>
|
|
178
|
+
{:else}
|
|
179
|
+
<Edit3 class="w-3.5 h-3.5" />
|
|
180
|
+
<span>编辑布局</span>
|
|
181
|
+
{/if}
|
|
182
|
+
</Button>
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
|
|
186
|
+
<!-- 12 栅格自适应容器 -->
|
|
187
|
+
<div class="p-4 bg-muted/5 min-h-[420px]">
|
|
188
|
+
{#if items.length === 0}
|
|
189
|
+
<div class="py-24 text-center text-sm text-muted-foreground">
|
|
190
|
+
<LayoutDashboard class="w-10 h-10 mx-auto mb-2 opacity-30" />
|
|
191
|
+
<p>当前画布暂无小部件,点击上方按钮添加小部件</p>
|
|
192
|
+
</div>
|
|
193
|
+
{:else}
|
|
194
|
+
<div class="grid grid-cols-12 gap-3.5">
|
|
195
|
+
{#each items as item (item.id)}
|
|
196
|
+
<div
|
|
197
|
+
class={cn(
|
|
198
|
+
'rounded-xl border border-border bg-card p-3.5 flex flex-col justify-between transition-all duration-150 relative shadow-2xs',
|
|
199
|
+
isEditable && 'ring-1 ring-primary/30 border-primary/40',
|
|
200
|
+
item.static && 'opacity-90'
|
|
201
|
+
)}
|
|
202
|
+
style="grid-column: span {item.w}; min-height: {item.h * 72}px;"
|
|
203
|
+
>
|
|
204
|
+
<!-- 小部件头部 -->
|
|
205
|
+
<div class="flex items-start justify-between gap-2 mb-2">
|
|
206
|
+
<div class="flex items-center gap-1.5 min-w-0">
|
|
207
|
+
{#if isEditable && !item.static}
|
|
208
|
+
<span class="cursor-grab text-muted-foreground/60 hover:text-foreground">
|
|
209
|
+
<GripVertical class="w-3.5 h-3.5" />
|
|
210
|
+
</span>
|
|
211
|
+
{/if}
|
|
212
|
+
<div class="flex flex-col min-w-0">
|
|
213
|
+
<div class="flex items-center gap-1.5">
|
|
214
|
+
<span class="text-xs font-semibold text-foreground truncate">{item.title}</span>
|
|
215
|
+
{#if item.category}
|
|
216
|
+
<span class="text-[9px] px-1.5 py-0.2 rounded bg-muted text-muted-foreground border border-border">
|
|
217
|
+
{item.category}
|
|
218
|
+
</span>
|
|
219
|
+
{/if}
|
|
220
|
+
</div>
|
|
221
|
+
{#if item.description}
|
|
222
|
+
<p class="text-[10px] text-muted-foreground truncate mt-0.5">{item.description}</p>
|
|
223
|
+
{/if}
|
|
224
|
+
</div>
|
|
225
|
+
</div>
|
|
226
|
+
|
|
227
|
+
<!-- 编辑工具按钮 -->
|
|
228
|
+
{#if isEditable}
|
|
229
|
+
<div class="flex items-center gap-1 shrink-0">
|
|
230
|
+
<button
|
|
231
|
+
type="button"
|
|
232
|
+
class="p-1 rounded text-muted-foreground hover:text-foreground hover:bg-muted"
|
|
233
|
+
title={item.static ? '解锁小部件' : '锁定位置'}
|
|
234
|
+
onclick={() => toggleLock(item.id)}
|
|
235
|
+
>
|
|
236
|
+
{#if item.static}
|
|
237
|
+
<Lock class="w-3 h-3 text-warning" />
|
|
238
|
+
{:else}
|
|
239
|
+
<Unlock class="w-3 h-3" />
|
|
240
|
+
{/if}
|
|
241
|
+
</button>
|
|
242
|
+
|
|
243
|
+
{#if !item.static}
|
|
244
|
+
<button
|
|
245
|
+
type="button"
|
|
246
|
+
class="p-1 rounded text-muted-foreground hover:text-foreground hover:bg-muted"
|
|
247
|
+
title="放大宽度"
|
|
248
|
+
disabled={item.w >= 12}
|
|
249
|
+
onclick={() => resizeItem(item.id, 1, 0)}
|
|
250
|
+
>
|
|
251
|
+
<Maximize2 class="w-3 h-3" />
|
|
252
|
+
</button>
|
|
253
|
+
<button
|
|
254
|
+
type="button"
|
|
255
|
+
class="p-1 rounded text-muted-foreground hover:text-foreground hover:bg-muted"
|
|
256
|
+
title="缩小宽度"
|
|
257
|
+
disabled={item.w <= 2}
|
|
258
|
+
onclick={() => resizeItem(item.id, -1, 0)}
|
|
259
|
+
>
|
|
260
|
+
<Minimize2 class="w-3 h-3" />
|
|
261
|
+
</button>
|
|
262
|
+
<button
|
|
263
|
+
type="button"
|
|
264
|
+
class="p-1 rounded text-destructive hover:bg-destructive/10"
|
|
265
|
+
title="移除小部件"
|
|
266
|
+
onclick={() => removeItem(item.id)}
|
|
267
|
+
>
|
|
268
|
+
<Trash2 class="w-3 h-3" />
|
|
269
|
+
</button>
|
|
270
|
+
{/if}
|
|
271
|
+
</div>
|
|
272
|
+
{/if}
|
|
273
|
+
</div>
|
|
274
|
+
|
|
275
|
+
<!-- 小部件内容呈现 -->
|
|
276
|
+
<div class="flex-1 flex flex-col justify-center">
|
|
277
|
+
{#if item.widgetType === 'kpi'}
|
|
278
|
+
<div class="flex items-baseline justify-between mt-1">
|
|
279
|
+
<span class="text-xl font-bold tracking-tight text-foreground font-mono">
|
|
280
|
+
{item.metricValue ?? '0'}
|
|
281
|
+
</span>
|
|
282
|
+
{#if item.metricTrend}
|
|
283
|
+
<span class="text-xs font-medium text-success bg-success/10 px-1.5 py-0.5 rounded border border-success/20">
|
|
284
|
+
{item.metricTrend}
|
|
285
|
+
</span>
|
|
286
|
+
{/if}
|
|
287
|
+
</div>
|
|
288
|
+
{:else if item.widgetType === 'chart'}
|
|
289
|
+
<div class="h-28 w-full rounded-lg bg-muted/20 border border-dashed border-border/70 flex items-center justify-center text-xs text-muted-foreground flex-col gap-1">
|
|
290
|
+
<BarChart3 class="w-6 h-6 text-primary/60 mb-1" />
|
|
291
|
+
<span>实时时序图表绘制区域 ({item.w}x{item.h} 栅格)</span>
|
|
292
|
+
</div>
|
|
293
|
+
{:else if item.widgetType === 'table'}
|
|
294
|
+
<div class="h-28 w-full rounded-lg bg-muted/20 border border-dashed border-border/70 flex items-center justify-center text-xs text-muted-foreground flex-col gap-1">
|
|
295
|
+
<TableIcon class="w-6 h-6 text-primary/60 mb-1" />
|
|
296
|
+
<span>结构化数据表格展示区域</span>
|
|
297
|
+
</div>
|
|
298
|
+
{:else}
|
|
299
|
+
<div class="h-20 w-full rounded bg-muted/30 flex items-center justify-center text-xs text-muted-foreground">
|
|
300
|
+
自定义业务小部件
|
|
301
|
+
</div>
|
|
302
|
+
{/if}
|
|
303
|
+
</div>
|
|
304
|
+
</div>
|
|
305
|
+
{/each}
|
|
306
|
+
</div>
|
|
307
|
+
{/if}
|
|
308
|
+
</div>
|
|
309
|
+
</div>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface DashboardGridItem {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
x?: number | undefined;
|
|
5
|
+
y?: number | undefined;
|
|
6
|
+
w: number;
|
|
7
|
+
h: number;
|
|
8
|
+
minW?: number | undefined;
|
|
9
|
+
minH?: number | undefined;
|
|
10
|
+
static?: boolean | undefined;
|
|
11
|
+
category?: string | undefined;
|
|
12
|
+
widgetType?: 'kpi' | 'chart' | 'table' | 'log' | 'custom' | undefined;
|
|
13
|
+
description?: string | undefined;
|
|
14
|
+
metricValue?: string | number | undefined;
|
|
15
|
+
metricTrend?: string | undefined;
|
|
16
|
+
}
|
|
17
|
+
export interface DashboardGridLayoutProps {
|
|
18
|
+
items?: DashboardGridItem[] | undefined;
|
|
19
|
+
isEditable?: boolean | undefined;
|
|
20
|
+
title?: string | undefined;
|
|
21
|
+
description?: string | undefined;
|
|
22
|
+
class?: string | undefined;
|
|
23
|
+
onLayoutChange?: ((items: DashboardGridItem[]) => void) | undefined;
|
|
24
|
+
onAddWidget?: ((type: DashboardGridItem['widgetType']) => void) | undefined;
|
|
25
|
+
onRemoveWidget?: ((id: string) => void) | undefined;
|
|
26
|
+
onResetLayout?: (() => void) | undefined;
|
|
27
|
+
}
|
|
28
|
+
declare const DashboardGridLayout: import("svelte").Component<DashboardGridLayoutProps, {}, "items" | "isEditable">;
|
|
29
|
+
type DashboardGridLayout = ReturnType<typeof DashboardGridLayout>;
|
|
30
|
+
export default DashboardGridLayout;
|