@svadmin/ui 0.122.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 +561 -4
- package/dist/app.theme.css +561 -4
- 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 +12 -1
- package/dist/components/AnnouncementBanner.svelte.d.ts +4 -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 +1 -1
- package/dist/components/AudioFeedbackProvider.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/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/ColumnMappingTable.svelte +174 -0
- package/dist/components/ColumnMappingTable.svelte.d.ts +23 -0
- package/dist/components/ConversionFunnel.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/DevTools.svelte +3 -3
- package/dist/components/DualApprovalGate.svelte +132 -65
- package/dist/components/DualApprovalGate.svelte.d.ts +20 -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/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/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/ImportPreviewValidator.svelte +239 -0
- package/dist/components/ImportPreviewValidator.svelte.d.ts +26 -0
- package/dist/components/IncidentWarRoomDrawer.svelte +194 -0
- package/dist/components/IncidentWarRoomDrawer.svelte.d.ts +24 -0
- package/dist/components/JsonSchemaForm.svelte +4 -4
- 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/MasterSubTableDrawer.svelte +223 -0
- package/dist/components/MasterSubTableDrawer.svelte.d.ts +25 -0
- package/dist/components/MockDataInterceptor.svelte +292 -0
- package/dist/components/MockDataInterceptor.svelte.d.ts +27 -0
- package/dist/components/OmnibarCommandPalette.svelte +320 -0
- package/dist/components/OmnibarCommandPalette.svelte.d.ts +27 -0
- package/dist/components/PageSkeleton.svelte +19 -5
- package/dist/components/PageSkeleton.svelte.d.ts +5 -3
- 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/PivotMatrix.svelte +271 -0
- package/dist/components/PivotMatrix.svelte.d.ts +32 -0
- 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/ProSkeleton.svelte +4 -0
- 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/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/ScheduledJobManager.svelte +225 -0
- package/dist/components/ScheduledJobManager.svelte.d.ts +23 -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/ServerStatusGrid.svelte +179 -0
- package/dist/components/ServerStatusGrid.svelte.d.ts +21 -0
- package/dist/components/SnapshotTimelineReplay.svelte +219 -0
- package/dist/components/SnapshotTimelineReplay.svelte.d.ts +19 -0
- package/dist/components/SqlConsole.svelte +247 -0
- package/dist/components/SqlConsole.svelte.d.ts +20 -0
- package/dist/components/StepWizard.svelte +1 -1
- 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/TaskCenter.svelte +37 -29
- 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/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/TreeTransferSelect.svelte +333 -0
- package/dist/components/TreeTransferSelect.svelte.d.ts +18 -0
- package/dist/components/VirtualCardGrid.svelte +180 -0
- package/dist/components/VirtualCardGrid.svelte.d.ts +65 -0
- 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/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/WorkflowStepper.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/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/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.css +1 -1
- package/dist/index.d.ts +69 -3
- package/dist/index.js +112 -2
- package/package.json +4 -4
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
UserCheck,
|
|
4
|
+
Shield,
|
|
5
|
+
CheckCircle2,
|
|
6
|
+
XCircle,
|
|
7
|
+
Eye,
|
|
8
|
+
KeyRound,
|
|
9
|
+
Database,
|
|
10
|
+
Lock,
|
|
11
|
+
User,
|
|
12
|
+
Layers,
|
|
13
|
+
} from '@lucide/svelte';
|
|
14
|
+
import { cn } from '../utils.js';
|
|
15
|
+
|
|
16
|
+
export interface SimulationTargetUser {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
department: string;
|
|
20
|
+
level: string;
|
|
21
|
+
securityClearance: 'L1' | 'L2' | 'L3' | 'L4';
|
|
22
|
+
roles: string[];
|
|
23
|
+
simulatedIp?: string | undefined;
|
|
24
|
+
isWorkingHours?: boolean | undefined;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface SimulatedMenuNode {
|
|
28
|
+
id: string;
|
|
29
|
+
title: string;
|
|
30
|
+
path: string;
|
|
31
|
+
visible: boolean;
|
|
32
|
+
reason: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface SimulatedAction {
|
|
36
|
+
action: string;
|
|
37
|
+
resource: string;
|
|
38
|
+
effect: 'allow' | 'mask' | 'require_mfa' | 'deny';
|
|
39
|
+
ruleMatched: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface PermissionSimulatorProps {
|
|
43
|
+
users?: SimulationTargetUser[] | undefined;
|
|
44
|
+
selectedUserId?: string | undefined;
|
|
45
|
+
title?: string | undefined;
|
|
46
|
+
description?: string | undefined;
|
|
47
|
+
class?: string | undefined;
|
|
48
|
+
onSimulate?: ((user: SimulationTargetUser) => void) | undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let {
|
|
52
|
+
users = [
|
|
53
|
+
{
|
|
54
|
+
id: 'usr-fin-01',
|
|
55
|
+
name: '李思远 (财务主管)',
|
|
56
|
+
department: '财务结算中心',
|
|
57
|
+
level: 'M2',
|
|
58
|
+
securityClearance: 'L3',
|
|
59
|
+
roles: ['财务经理', '资金调度员'],
|
|
60
|
+
simulatedIp: '192.168.10.42 (内网专用专线)',
|
|
61
|
+
isWorkingHours: true,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: 'usr-dev-02',
|
|
65
|
+
name: '王小磊 (初级开发工程师)',
|
|
66
|
+
department: '技术工程部',
|
|
67
|
+
level: 'P5',
|
|
68
|
+
securityClearance: 'L1',
|
|
69
|
+
roles: ['研发人员'],
|
|
70
|
+
simulatedIp: '10.8.0.55 (本地测试网段)',
|
|
71
|
+
isWorkingHours: true,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: 'usr-sec-03',
|
|
75
|
+
name: '赵宏 (合规安全总监)',
|
|
76
|
+
department: '信息安全合规处',
|
|
77
|
+
level: 'D1',
|
|
78
|
+
securityClearance: 'L4',
|
|
79
|
+
roles: ['合规审计员', '安全网关主管'],
|
|
80
|
+
simulatedIp: '192.168.1.1 (机房管理骨干网)',
|
|
81
|
+
isWorkingHours: false,
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
selectedUserId = $bindable('usr-fin-01'),
|
|
85
|
+
title = '角色与多维属性权限模拟沙箱 (Permission Simulator)',
|
|
86
|
+
description = '无需换号登录,直接以指定员工身份模拟其可访问菜单、高危动作裁决与行级数据范围',
|
|
87
|
+
class: className = '',
|
|
88
|
+
onSimulate,
|
|
89
|
+
}: PermissionSimulatorProps = $props();
|
|
90
|
+
|
|
91
|
+
let currentUser = $derived(
|
|
92
|
+
users.find((u) => u.id === selectedUserId) ?? users[0]
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
let simulatedMenus = $derived<SimulatedMenuNode[]>([
|
|
96
|
+
{ id: 'm1', title: '全景运营仪表盘', path: '/dashboard', visible: true, reason: '基础角色通用授权' },
|
|
97
|
+
{
|
|
98
|
+
id: 'm2',
|
|
99
|
+
title: '大额资金调拨中心',
|
|
100
|
+
path: '/finance/payments',
|
|
101
|
+
visible: currentUser?.department === '财务结算中心' || currentUser?.securityClearance === 'L4',
|
|
102
|
+
reason: currentUser?.department === '财务结算中心' ? '符合部门属性与安全密级' : '非财务岗位不可见',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 'm3',
|
|
106
|
+
title: '核心数据资产审计',
|
|
107
|
+
path: '/audit/trail',
|
|
108
|
+
visible: currentUser?.securityClearance === 'L3' || currentUser?.securityClearance === 'L4',
|
|
109
|
+
reason: (currentUser?.securityClearance === 'L3' || currentUser?.securityClearance === 'L4') ? '具备 L3+ 安全密级' : '需 L3 及以上密级',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: 'm4',
|
|
113
|
+
title: '全量员工薪酬名册',
|
|
114
|
+
path: '/hr/compensation',
|
|
115
|
+
visible: currentUser?.securityClearance === 'L4',
|
|
116
|
+
reason: currentUser?.securityClearance === 'L4' ? 'L4 核心特权可见' : '普通职级完全隐藏',
|
|
117
|
+
},
|
|
118
|
+
]);
|
|
119
|
+
|
|
120
|
+
let simulatedActions = $derived<SimulatedAction[]>([
|
|
121
|
+
{
|
|
122
|
+
action: '发起大额资金支付 (¥5,000,000)',
|
|
123
|
+
resource: 'TreasuryPayment',
|
|
124
|
+
effect: currentUser?.level === 'M2' ? 'allow' : 'deny',
|
|
125
|
+
ruleMatched: currentUser?.level === 'M2' ? 'ABAC-01 (财务M2直接放行)' : 'ABAC-01 (职级不足被阻断)',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
action: '调阅客户敏感手机号与地址',
|
|
129
|
+
resource: 'CustomerRecord',
|
|
130
|
+
effect: currentUser?.securityClearance === 'L4' ? 'allow' : 'mask',
|
|
131
|
+
ruleMatched: currentUser?.securityClearance === 'L4' ? '合规总监明文调阅' : 'ABAC-02 (动态脱敏掩码展示)',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
action: '单次导出 10,000+ 条流水记录',
|
|
135
|
+
resource: 'BatchDataExport',
|
|
136
|
+
effect: 'require_mfa',
|
|
137
|
+
ruleMatched: 'ABAC-04 (大批量导出需 MFA 二次认证)',
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
action: '物理清空 2025 年度审计数据库',
|
|
141
|
+
resource: 'AuditArchiveStore',
|
|
142
|
+
effect: 'deny',
|
|
143
|
+
ruleMatched: 'ABAC-03 (高危不可逆操作绝对拦截)',
|
|
144
|
+
},
|
|
145
|
+
]);
|
|
146
|
+
|
|
147
|
+
let simulatedRlsSql = $derived(
|
|
148
|
+
currentUser?.department === '财务结算中心'
|
|
149
|
+
? "SELECT * FROM payments WHERE tenant_id = 'HQ-GLOBAL' AND approval_status = 'approved'"
|
|
150
|
+
: currentUser?.securityClearance === 'L4'
|
|
151
|
+
? "SELECT * FROM payments WHERE 1=1 /* 全局审计穿透视图 */"
|
|
152
|
+
: "SELECT * FROM payments WHERE creator_id = '" + (currentUser?.id ?? '') + "' /* 仅限本人创建 */"
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
function handleSelectUser(user: SimulationTargetUser) {
|
|
156
|
+
selectedUserId = user.id;
|
|
157
|
+
onSimulate?.(user);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function getEffectBadge(effect: SimulatedAction['effect']) {
|
|
161
|
+
switch (effect) {
|
|
162
|
+
case 'allow':
|
|
163
|
+
return { label: '允许放行', class: 'bg-success/10 text-success border-success/20', icon: CheckCircle2 };
|
|
164
|
+
case 'mask':
|
|
165
|
+
return { label: '脱敏展示', class: 'bg-info/10 text-info border-info/20', icon: Eye };
|
|
166
|
+
case 'require_mfa':
|
|
167
|
+
return { label: '需提权MFA', class: 'bg-warning/10 text-warning border-warning/20', icon: KeyRound };
|
|
168
|
+
case 'deny':
|
|
169
|
+
return { label: '安全阻断', class: 'bg-destructive/10 text-destructive border-destructive/20', icon: XCircle };
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
</script>
|
|
173
|
+
|
|
174
|
+
<div
|
|
175
|
+
class={cn('w-full rounded-2xl border border-border bg-card text-foreground shadow-sm flex flex-col overflow-hidden', className)}
|
|
176
|
+
data-svadmin-component="permission-simulator"
|
|
177
|
+
>
|
|
178
|
+
<!-- 头部与身份选择条 -->
|
|
179
|
+
<div class="p-5 border-b border-border bg-muted/10 flex flex-col md:flex-row md:items-center justify-between gap-4">
|
|
180
|
+
<div>
|
|
181
|
+
<div class="flex items-center gap-2">
|
|
182
|
+
<UserCheck class="w-5 h-5 text-primary" />
|
|
183
|
+
<h3 class="text-base font-semibold text-foreground tracking-tight">{title}</h3>
|
|
184
|
+
</div>
|
|
185
|
+
<p class="text-xs text-muted-foreground mt-1">{description}</p>
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
<!-- 模拟目标员工切换 -->
|
|
189
|
+
<div class="flex items-center gap-1.5 flex-wrap">
|
|
190
|
+
{#each users as u (u.id)}
|
|
191
|
+
{@const isActive = u.id === selectedUserId}
|
|
192
|
+
<button
|
|
193
|
+
type="button"
|
|
194
|
+
class={cn(
|
|
195
|
+
'flex items-center gap-1.5 px-3 py-1.5 rounded-lg border text-xs font-medium transition-all duration-150',
|
|
196
|
+
isActive
|
|
197
|
+
? 'border-primary/50 bg-primary/10 text-primary shadow-xs'
|
|
198
|
+
: 'border-border bg-card hover:bg-muted text-foreground'
|
|
199
|
+
)}
|
|
200
|
+
onclick={() => handleSelectUser(u)}
|
|
201
|
+
>
|
|
202
|
+
<User class="w-3.5 h-3.5" />
|
|
203
|
+
<span>{u.name}</span>
|
|
204
|
+
<span class="text-[10px] px-1 py-0.2 rounded bg-muted text-muted-foreground border border-border">
|
|
205
|
+
{u.securityClearance}
|
|
206
|
+
</span>
|
|
207
|
+
</button>
|
|
208
|
+
{/each}
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
|
|
212
|
+
<!-- 当前模拟身份详情卡片 -->
|
|
213
|
+
{#if currentUser}
|
|
214
|
+
<div class="px-5 py-3 border-b border-border bg-muted/20 flex flex-wrap items-center justify-between gap-3 text-xs">
|
|
215
|
+
<div class="flex items-center gap-3 flex-wrap">
|
|
216
|
+
<span class="font-semibold text-foreground">{currentUser.name}</span>
|
|
217
|
+
<span class="text-muted-foreground">部门: {currentUser.department}</span>
|
|
218
|
+
<span class="text-muted-foreground">职级: {currentUser.level}</span>
|
|
219
|
+
<span class="px-1.5 py-0.5 rounded bg-primary/10 text-primary border border-primary/20 font-medium">
|
|
220
|
+
安全密级: {currentUser.securityClearance}
|
|
221
|
+
</span>
|
|
222
|
+
<div class="flex items-center gap-1">
|
|
223
|
+
<span class="text-muted-foreground">角色:</span>
|
|
224
|
+
{#each currentUser.roles as r (r)}
|
|
225
|
+
<span class="px-1.5 py-0.2 rounded bg-muted text-muted-foreground border border-border text-[10px]">
|
|
226
|
+
{r}
|
|
227
|
+
</span>
|
|
228
|
+
{/each}
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
|
|
232
|
+
<div class="text-[11px] text-muted-foreground font-mono">
|
|
233
|
+
模拟 IP: {currentUser.simulatedIp}
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
{/if}
|
|
237
|
+
|
|
238
|
+
<!-- 三栏推演展示区 -->
|
|
239
|
+
<div class="grid grid-cols-1 lg:grid-cols-3 divide-y lg:divide-y-0 lg:divide-x divide-border">
|
|
240
|
+
<!-- 栏目 1:菜单可见性推演 -->
|
|
241
|
+
<div class="p-4 flex flex-col gap-2">
|
|
242
|
+
<div class="flex items-center gap-1.5 text-xs font-semibold text-foreground mb-1">
|
|
243
|
+
<Layers class="w-4 h-4 text-primary" />
|
|
244
|
+
<span>系统导航可见性推演</span>
|
|
245
|
+
</div>
|
|
246
|
+
|
|
247
|
+
<div class="space-y-2">
|
|
248
|
+
{#each simulatedMenus as menu (menu.id)}
|
|
249
|
+
<div class="p-2.5 rounded-xl border border-border bg-card flex items-center justify-between text-xs">
|
|
250
|
+
<div class="flex flex-col">
|
|
251
|
+
<span class="font-medium text-foreground">{menu.title}</span>
|
|
252
|
+
<span class="text-[10px] text-muted-foreground font-mono">{menu.path}</span>
|
|
253
|
+
<span class="text-[10px] text-muted-foreground mt-0.5">{menu.reason}</span>
|
|
254
|
+
</div>
|
|
255
|
+
|
|
256
|
+
{#if menu.visible}
|
|
257
|
+
<span class="flex items-center gap-1 text-[11px] text-success font-medium shrink-0">
|
|
258
|
+
<CheckCircle2 class="w-3.5 h-3.5" />
|
|
259
|
+
正常呈现
|
|
260
|
+
</span>
|
|
261
|
+
{:else}
|
|
262
|
+
<span class="flex items-center gap-1 text-[11px] text-muted-foreground font-medium shrink-0 opacity-70">
|
|
263
|
+
<Lock class="w-3.5 h-3.5" />
|
|
264
|
+
已被隐藏
|
|
265
|
+
</span>
|
|
266
|
+
{/if}
|
|
267
|
+
</div>
|
|
268
|
+
{/each}
|
|
269
|
+
</div>
|
|
270
|
+
</div>
|
|
271
|
+
|
|
272
|
+
<!-- 栏目 2:高危操作裁决沙箱 -->
|
|
273
|
+
<div class="p-4 flex flex-col gap-2">
|
|
274
|
+
<div class="flex items-center gap-1.5 text-xs font-semibold text-foreground mb-1">
|
|
275
|
+
<Shield class="w-4 h-4 text-primary" />
|
|
276
|
+
<span>高危业务动作裁决结果</span>
|
|
277
|
+
</div>
|
|
278
|
+
|
|
279
|
+
<div class="space-y-2">
|
|
280
|
+
{#each simulatedActions as act (act.action)}
|
|
281
|
+
{@const meta = getEffectBadge(act.effect)}
|
|
282
|
+
{@const MetaIcon = meta.icon}
|
|
283
|
+
<div class="p-2.5 rounded-xl border border-border bg-card flex items-start justify-between gap-2 text-xs">
|
|
284
|
+
<div class="flex flex-col min-w-0">
|
|
285
|
+
<span class="font-medium text-foreground truncate">{act.action}</span>
|
|
286
|
+
<span class="text-[10px] text-muted-foreground">资源: {act.resource}</span>
|
|
287
|
+
<span class="text-[10px] text-muted-foreground/80 mt-0.5">{act.ruleMatched}</span>
|
|
288
|
+
</div>
|
|
289
|
+
|
|
290
|
+
<span class={cn('flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded border font-medium shrink-0 leading-none', meta.class)}>
|
|
291
|
+
<MetaIcon class="w-3 h-3" />
|
|
292
|
+
{meta.label}
|
|
293
|
+
</span>
|
|
294
|
+
</div>
|
|
295
|
+
{/each}
|
|
296
|
+
</div>
|
|
297
|
+
</div>
|
|
298
|
+
|
|
299
|
+
<!-- 栏目 3:行级数据范围 RLS 推演 -->
|
|
300
|
+
<div class="p-4 flex flex-col gap-2">
|
|
301
|
+
<div class="flex items-center gap-1.5 text-xs font-semibold text-foreground mb-1">
|
|
302
|
+
<Database class="w-4 h-4 text-primary" />
|
|
303
|
+
<span>行级数据范围 (RLS) 注入推演</span>
|
|
304
|
+
</div>
|
|
305
|
+
|
|
306
|
+
<div class="p-3 rounded-xl border border-border bg-muted/20 flex flex-col gap-2 text-xs">
|
|
307
|
+
<p class="text-[11px] text-muted-foreground">
|
|
308
|
+
当该员工在界面发起列表或图表查询时,底层 DataProvider 自动注入的条件表达式:
|
|
309
|
+
</p>
|
|
310
|
+
|
|
311
|
+
<pre class="p-3 rounded-lg border border-border bg-card font-mono text-[11px] text-primary whitespace-pre-wrap leading-relaxed">{simulatedRlsSql}</pre>
|
|
312
|
+
|
|
313
|
+
<div class="text-[10px] text-muted-foreground pt-1 border-t border-border/50">
|
|
314
|
+
状态:数据范围过滤已生效,杜绝跨部门或跨权限越权读取。
|
|
315
|
+
</div>
|
|
316
|
+
</div>
|
|
317
|
+
</div>
|
|
318
|
+
</div>
|
|
319
|
+
</div>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface SimulationTargetUser {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
department: string;
|
|
5
|
+
level: string;
|
|
6
|
+
securityClearance: 'L1' | 'L2' | 'L3' | 'L4';
|
|
7
|
+
roles: string[];
|
|
8
|
+
simulatedIp?: string | undefined;
|
|
9
|
+
isWorkingHours?: boolean | undefined;
|
|
10
|
+
}
|
|
11
|
+
export interface SimulatedMenuNode {
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
14
|
+
path: string;
|
|
15
|
+
visible: boolean;
|
|
16
|
+
reason: string;
|
|
17
|
+
}
|
|
18
|
+
export interface SimulatedAction {
|
|
19
|
+
action: string;
|
|
20
|
+
resource: string;
|
|
21
|
+
effect: 'allow' | 'mask' | 'require_mfa' | 'deny';
|
|
22
|
+
ruleMatched: string;
|
|
23
|
+
}
|
|
24
|
+
export interface PermissionSimulatorProps {
|
|
25
|
+
users?: SimulationTargetUser[] | undefined;
|
|
26
|
+
selectedUserId?: string | undefined;
|
|
27
|
+
title?: string | undefined;
|
|
28
|
+
description?: string | undefined;
|
|
29
|
+
class?: string | undefined;
|
|
30
|
+
onSimulate?: ((user: SimulationTargetUser) => void) | undefined;
|
|
31
|
+
}
|
|
32
|
+
declare const PermissionSimulator: import("svelte").Component<PermissionSimulatorProps, {}, "selectedUserId">;
|
|
33
|
+
type PermissionSimulator = ReturnType<typeof PermissionSimulator>;
|
|
34
|
+
export default PermissionSimulator;
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { untrack } from 'svelte';
|
|
3
|
+
|
|
4
|
+
export interface PivotDimension {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
field: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface PivotMeasure {
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
field: string;
|
|
14
|
+
aggregation: 'sum' | 'avg' | 'count' | 'min' | 'max';
|
|
15
|
+
format?: ((val: number) => string) | undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface PivotMatrixProps {
|
|
19
|
+
data?: Record<string, unknown>[] | undefined;
|
|
20
|
+
rowDimensions?: PivotDimension[] | undefined;
|
|
21
|
+
colDimensions?: PivotDimension[] | undefined;
|
|
22
|
+
measures?: PivotMeasure[] | undefined;
|
|
23
|
+
showRowTotals?: boolean | undefined;
|
|
24
|
+
showColTotals?: boolean | undefined;
|
|
25
|
+
heatmap?: boolean | undefined;
|
|
26
|
+
title?: string | undefined;
|
|
27
|
+
class?: string | undefined;
|
|
28
|
+
onCellClick?: ((params: { rowKey: string; colKey: string; value: number; records: Record<string, unknown>[] }) => void) | undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const {
|
|
32
|
+
data = [],
|
|
33
|
+
rowDimensions = [
|
|
34
|
+
{ id: 'region', label: '区域', field: 'region' },
|
|
35
|
+
{ id: 'dept', label: '部门', field: 'dept' }
|
|
36
|
+
],
|
|
37
|
+
colDimensions = [
|
|
38
|
+
{ id: 'quarter', label: '季度', field: 'quarter' }
|
|
39
|
+
],
|
|
40
|
+
measures = [
|
|
41
|
+
{ id: 'revenue', label: '销售额', field: 'revenue', aggregation: 'sum' }
|
|
42
|
+
],
|
|
43
|
+
showRowTotals = true,
|
|
44
|
+
showColTotals = true,
|
|
45
|
+
heatmap = true,
|
|
46
|
+
title = '多维交叉透视分析矩阵',
|
|
47
|
+
class: className = '',
|
|
48
|
+
onCellClick = undefined
|
|
49
|
+
}: PivotMatrixProps = $props();
|
|
50
|
+
|
|
51
|
+
let activeMeasureId = $state(untrack(() => measures[0]?.id ?? ''));
|
|
52
|
+
|
|
53
|
+
const currentMeasure = $derived(
|
|
54
|
+
measures.find(m => m.id === activeMeasureId) ?? measures[0] ?? {
|
|
55
|
+
id: 'default',
|
|
56
|
+
label: '数值',
|
|
57
|
+
field: 'value',
|
|
58
|
+
aggregation: 'sum' as const
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const matrixComputation = $derived.by(() => {
|
|
63
|
+
const rowMap = new Map<string, Record<string, unknown>[]>();
|
|
64
|
+
const colSet = new Set<string>();
|
|
65
|
+
|
|
66
|
+
for (const item of data) {
|
|
67
|
+
const rowKey = rowDimensions.map(d => String(item[d.field] ?? '—')).join(' / ');
|
|
68
|
+
const colKey = colDimensions.map(d => String(item[d.field] ?? '—')).join(' / ');
|
|
69
|
+
|
|
70
|
+
colSet.add(colKey);
|
|
71
|
+
if (!rowMap.has(rowKey)) {
|
|
72
|
+
rowMap.set(rowKey, []);
|
|
73
|
+
}
|
|
74
|
+
const existing = rowMap.get(rowKey);
|
|
75
|
+
if (existing) {
|
|
76
|
+
existing.push(item);
|
|
77
|
+
} else {
|
|
78
|
+
rowMap.set(rowKey, [item]);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const uniqueCols = Array.from(colSet).sort();
|
|
83
|
+
const uniqueRows = Array.from(rowMap.keys()).sort();
|
|
84
|
+
|
|
85
|
+
const aggregate = (records: Record<string, unknown>[], field: string, agg: string): number => {
|
|
86
|
+
if (!records || records.length === 0) return 0;
|
|
87
|
+
const values = records
|
|
88
|
+
.map(r => Number(r[field]))
|
|
89
|
+
.filter(v => !isNaN(v));
|
|
90
|
+
if (values.length === 0) return 0;
|
|
91
|
+
|
|
92
|
+
if (agg === 'sum') return values.reduce((a, b) => a + b, 0);
|
|
93
|
+
if (agg === 'avg') return values.reduce((a, b) => a + b, 0) / values.length;
|
|
94
|
+
if (agg === 'count') return values.length;
|
|
95
|
+
if (agg === 'min') return Math.min(...values);
|
|
96
|
+
if (agg === 'max') return Math.max(...values);
|
|
97
|
+
return 0;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
let maxVal = -Infinity;
|
|
101
|
+
let minVal = Infinity;
|
|
102
|
+
const grid: Record<string, Record<string, { val: number; records: Record<string, unknown>[] }>> = {};
|
|
103
|
+
const rowTotals: Record<string, number> = {};
|
|
104
|
+
const colTotals: Record<string, number> = {};
|
|
105
|
+
|
|
106
|
+
for (const r of uniqueRows) {
|
|
107
|
+
grid[r] = {};
|
|
108
|
+
const allRowRecords = rowMap.get(r) ?? [];
|
|
109
|
+
rowTotals[r] = aggregate(allRowRecords, currentMeasure.field, currentMeasure.aggregation);
|
|
110
|
+
|
|
111
|
+
for (const c of uniqueCols) {
|
|
112
|
+
const matching = allRowRecords.filter(item => {
|
|
113
|
+
const itemColKey = colDimensions.map(d => String(item[d.field] ?? '—')).join(' / ');
|
|
114
|
+
return itemColKey === c;
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const cellVal = aggregate(matching, currentMeasure.field, currentMeasure.aggregation);
|
|
118
|
+
grid[r][c] = { val: cellVal, records: matching };
|
|
119
|
+
|
|
120
|
+
if (cellVal > maxVal) maxVal = cellVal;
|
|
121
|
+
if (cellVal < minVal) minVal = cellVal;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
for (const c of uniqueCols) {
|
|
126
|
+
const allColRecords = data.filter(item => {
|
|
127
|
+
const itemColKey = colDimensions.map(d => String(item[d.field] ?? '—')).join(' / ');
|
|
128
|
+
return itemColKey === c;
|
|
129
|
+
});
|
|
130
|
+
colTotals[c] = aggregate(allColRecords, currentMeasure.field, currentMeasure.aggregation);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const grandTotal = aggregate(data, currentMeasure.field, currentMeasure.aggregation);
|
|
134
|
+
|
|
135
|
+
return {
|
|
136
|
+
rows: uniqueRows,
|
|
137
|
+
cols: uniqueCols,
|
|
138
|
+
grid,
|
|
139
|
+
rowTotals,
|
|
140
|
+
colTotals,
|
|
141
|
+
grandTotal,
|
|
142
|
+
maxVal: maxVal === -Infinity ? 0 : maxVal,
|
|
143
|
+
minVal: minVal === Infinity ? 0 : minVal
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
function formatValue(num: number): string {
|
|
148
|
+
if (currentMeasure.format) {
|
|
149
|
+
return currentMeasure.format(num);
|
|
150
|
+
}
|
|
151
|
+
return num.toLocaleString('zh-CN', { maximumFractionDigits: 2 });
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function getHeatmapClass(val: number): string {
|
|
155
|
+
if (!heatmap || matrixComputation.maxVal === matrixComputation.minVal) {
|
|
156
|
+
return 'bg-card text-foreground';
|
|
157
|
+
}
|
|
158
|
+
const ratio = (val - matrixComputation.minVal) / (matrixComputation.maxVal - matrixComputation.minVal || 1);
|
|
159
|
+
if (ratio > 0.75) return 'bg-primary/25 font-semibold text-foreground';
|
|
160
|
+
if (ratio > 0.5) return 'bg-primary/15 text-foreground';
|
|
161
|
+
if (ratio > 0.25) return 'bg-primary/10 text-foreground';
|
|
162
|
+
return 'bg-card text-foreground';
|
|
163
|
+
}
|
|
164
|
+
</script>
|
|
165
|
+
|
|
166
|
+
<div
|
|
167
|
+
class="flex flex-col gap-3 rounded-lg border border-border bg-card p-4 text-card-foreground shadow-sm {className}"
|
|
168
|
+
data-svadmin-component="PivotMatrix"
|
|
169
|
+
>
|
|
170
|
+
<div class="flex flex-wrap items-center justify-between gap-3 border-b border-border pb-3">
|
|
171
|
+
<div class="flex items-center gap-2">
|
|
172
|
+
<div class="flex h-8 w-8 items-center justify-center rounded-md bg-primary/10 text-primary">
|
|
173
|
+
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
174
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M3 14h18m-9-4v8m-7 0h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" />
|
|
175
|
+
</svg>
|
|
176
|
+
</div>
|
|
177
|
+
<div>
|
|
178
|
+
<h3 class="text-sm font-medium text-foreground">{title}</h3>
|
|
179
|
+
<p class="text-xs text-muted-foreground">
|
|
180
|
+
行: {rowDimensions.map(d => d.label).join(' / ')} ✕ 列: {colDimensions.map(d => d.label).join(' / ')}
|
|
181
|
+
</p>
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
|
|
185
|
+
<div class="flex items-center gap-1.5 rounded-lg border border-border bg-muted/30 p-1">
|
|
186
|
+
<span class="px-2 text-xs text-muted-foreground">度量:</span>
|
|
187
|
+
{#each measures as m (m.id)}
|
|
188
|
+
<button
|
|
189
|
+
type="button"
|
|
190
|
+
class="rounded px-2.5 py-1 text-xs font-medium transition-colors {activeMeasureId === m.id ? 'bg-primary text-primary-foreground shadow-sm' : 'text-muted-foreground hover:bg-muted hover:text-foreground'}"
|
|
191
|
+
onclick={() => { activeMeasureId = m.id; }}
|
|
192
|
+
>
|
|
193
|
+
{m.label} ({m.aggregation.toUpperCase()})
|
|
194
|
+
</button>
|
|
195
|
+
{/each}
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
<div class="overflow-x-auto rounded-md border border-border">
|
|
200
|
+
<table class="w-full border-collapse text-left text-xs">
|
|
201
|
+
<thead>
|
|
202
|
+
<tr class="border-b border-border bg-muted/50 font-medium text-muted-foreground">
|
|
203
|
+
<th class="p-2.5 border-r border-border">
|
|
204
|
+
{rowDimensions.map(d => d.label).join(' / ')}
|
|
205
|
+
</th>
|
|
206
|
+
{#each matrixComputation.cols as colHeader (colHeader)}
|
|
207
|
+
<th class="p-2.5 text-right border-r border-border min-w-[90px]">
|
|
208
|
+
{colHeader}
|
|
209
|
+
</th>
|
|
210
|
+
{/each}
|
|
211
|
+
{#if showRowTotals}
|
|
212
|
+
<th class="p-2.5 text-right font-semibold text-foreground bg-muted/80 min-w-[90px]">
|
|
213
|
+
行汇总
|
|
214
|
+
</th>
|
|
215
|
+
{/if}
|
|
216
|
+
</tr>
|
|
217
|
+
</thead>
|
|
218
|
+
<tbody class="divide-y divide-border">
|
|
219
|
+
{#if matrixComputation.rows.length === 0}
|
|
220
|
+
<tr>
|
|
221
|
+
<td
|
|
222
|
+
colspan={matrixComputation.cols.length + (showRowTotals ? 2 : 1)}
|
|
223
|
+
class="p-6 text-center text-muted-foreground"
|
|
224
|
+
>
|
|
225
|
+
暂无透视数据
|
|
226
|
+
</td>
|
|
227
|
+
</tr>
|
|
228
|
+
{:else}
|
|
229
|
+
{#each matrixComputation.rows as rowKey (rowKey)}
|
|
230
|
+
<tr class="hover:bg-muted/40 transition-colors">
|
|
231
|
+
<td class="p-2.5 font-medium text-foreground border-r border-border bg-muted/10">
|
|
232
|
+
{rowKey}
|
|
233
|
+
</td>
|
|
234
|
+
{#each matrixComputation.cols as colKey (colKey)}
|
|
235
|
+
{@const cellData = matrixComputation.grid[rowKey]?.[colKey] ?? { val: 0, records: [] }}
|
|
236
|
+
<td
|
|
237
|
+
class="p-2.5 text-right border-r border-border transition-colors cursor-pointer {getHeatmapClass(cellData.val)}"
|
|
238
|
+
onclick={() => onCellClick?.({ rowKey, colKey, value: cellData.val, records: cellData.records })}
|
|
239
|
+
>
|
|
240
|
+
{formatValue(cellData.val)}
|
|
241
|
+
</td>
|
|
242
|
+
{/each}
|
|
243
|
+
{#if showRowTotals}
|
|
244
|
+
<td class="p-2.5 text-right font-semibold text-foreground bg-muted/30">
|
|
245
|
+
{formatValue(matrixComputation.rowTotals[rowKey] ?? 0)}
|
|
246
|
+
</td>
|
|
247
|
+
{/if}
|
|
248
|
+
</tr>
|
|
249
|
+
{/each}
|
|
250
|
+
{/if}
|
|
251
|
+
</tbody>
|
|
252
|
+
{#if showColTotals && matrixComputation.rows.length > 0}
|
|
253
|
+
<tfoot>
|
|
254
|
+
<tr class="border-t-2 border-border bg-muted/60 font-semibold text-foreground">
|
|
255
|
+
<td class="p-2.5 border-r border-border">列汇总</td>
|
|
256
|
+
{#each matrixComputation.cols as colKey (colKey)}
|
|
257
|
+
<td class="p-2.5 text-right border-r border-border">
|
|
258
|
+
{formatValue(matrixComputation.colTotals[colKey] ?? 0)}
|
|
259
|
+
</td>
|
|
260
|
+
{/each}
|
|
261
|
+
{#if showRowTotals}
|
|
262
|
+
<td class="p-2.5 text-right text-primary font-bold bg-primary/10">
|
|
263
|
+
{formatValue(matrixComputation.grandTotal)}
|
|
264
|
+
</td>
|
|
265
|
+
{/if}
|
|
266
|
+
</tr>
|
|
267
|
+
</tfoot>
|
|
268
|
+
{/if}
|
|
269
|
+
</table>
|
|
270
|
+
</div>
|
|
271
|
+
</div>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface PivotDimension {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
field: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PivotMeasure {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
field: string;
|
|
10
|
+
aggregation: 'sum' | 'avg' | 'count' | 'min' | 'max';
|
|
11
|
+
format?: ((val: number) => string) | undefined;
|
|
12
|
+
}
|
|
13
|
+
export interface PivotMatrixProps {
|
|
14
|
+
data?: Record<string, unknown>[] | undefined;
|
|
15
|
+
rowDimensions?: PivotDimension[] | undefined;
|
|
16
|
+
colDimensions?: PivotDimension[] | undefined;
|
|
17
|
+
measures?: PivotMeasure[] | undefined;
|
|
18
|
+
showRowTotals?: boolean | undefined;
|
|
19
|
+
showColTotals?: boolean | undefined;
|
|
20
|
+
heatmap?: boolean | undefined;
|
|
21
|
+
title?: string | undefined;
|
|
22
|
+
class?: string | undefined;
|
|
23
|
+
onCellClick?: ((params: {
|
|
24
|
+
rowKey: string;
|
|
25
|
+
colKey: string;
|
|
26
|
+
value: number;
|
|
27
|
+
records: Record<string, unknown>[];
|
|
28
|
+
}) => void) | undefined;
|
|
29
|
+
}
|
|
30
|
+
declare const PivotMatrix: import("svelte").Component<PivotMatrixProps, {}, "">;
|
|
31
|
+
type PivotMatrix = ReturnType<typeof PivotMatrix>;
|
|
32
|
+
export default PivotMatrix;
|