@svadmin/ui 0.126.1 → 0.128.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 +660 -81
- package/dist/app.theme.css +660 -81
- package/dist/components/AbacPolicyMatrix.svelte +1 -1
- package/dist/components/AboutSettings.svelte +1 -1
- package/dist/components/ActionPalette.svelte +2 -2
- package/dist/components/ActivityFeed.svelte +1 -1
- package/dist/components/AdminApp.svelte +2 -2
- package/dist/components/AdminCopilotWidget.svelte +4 -4
- package/dist/components/AnimatedCounter.svelte +2 -1
- package/dist/components/ApiPlayground.svelte +2 -2
- package/dist/components/ApiSettings.svelte +3 -3
- package/dist/components/ApprovalActionCard.svelte +1 -1
- package/dist/components/AsyncExportModal.svelte +6 -6
- package/dist/components/AuditLogDrawer.svelte +1 -1
- package/dist/components/AuditLogViewer.svelte +3 -3
- package/dist/components/AuditTrailInspector.svelte +1 -1
- package/dist/components/AutoTable.svelte +2 -1
- package/dist/components/BatchEditModal.svelte +2 -2
- package/dist/components/BillingInvoiceDrawer.svelte +4 -3
- package/dist/components/CanvasAnnotation.svelte +1 -1
- package/dist/components/Cascader.svelte +3 -3
- package/dist/components/ColumnSettings.svelte +1 -1
- package/dist/components/ColumnVisibilityDrawer.svelte +2 -2
- package/dist/components/ComboboxField.svelte +15 -8
- package/dist/components/CommandPalette.svelte +16 -5
- package/dist/components/CommentThread.svelte +2 -1
- package/dist/components/ConcurrentConflictModal.svelte +3 -3
- package/dist/components/ConfirmDialog.svelte +2 -2
- package/dist/components/DashboardLayoutStorage.svelte +2 -2
- package/dist/components/DataFreshnessIndicator.svelte +1 -1
- package/dist/components/DataImportDropzone.svelte +1 -1
- package/dist/components/DrawerForm.svelte +1 -1
- package/dist/components/DualApprovalGate.svelte +2 -2
- package/dist/components/ExcelExportButton.svelte +1 -1
- package/dist/components/ExcelImportWizard.svelte +1 -1
- package/dist/components/FieldRenderer.svelte +6 -6
- package/dist/components/FileUpload.svelte +11 -2
- package/dist/components/FileUpload.svelte.d.ts +2 -0
- package/dist/components/FilterDropdown.svelte +2 -2
- package/dist/components/FilterTagBar.svelte +1 -1
- package/dist/components/GlobalShortcuts.svelte +1 -1
- package/dist/components/HmacSignatureCalculator.svelte +2 -2
- package/dist/components/I18nLanguagePackEditor.svelte +1 -1
- package/dist/components/ImportPreviewValidator.svelte +1 -1
- package/dist/components/ImportWizard.svelte +2 -2
- package/dist/components/IncidentWarRoomDrawer.svelte +1 -1
- package/dist/components/InlineEdit.svelte +1 -1
- package/dist/components/JsonViewer.svelte +1 -1
- package/dist/components/KeyboardShortcutsModal.svelte +1 -1
- package/dist/components/KpiCard.svelte +2 -1
- package/dist/components/LazyPage.svelte +1 -1
- package/dist/components/LiveIndicator.svelte +1 -1
- package/dist/components/LiveStreamLogViewer.svelte +1 -1
- package/dist/components/LockScreen.svelte +4 -4
- package/dist/components/MasterDetailView.svelte +1 -1
- package/dist/components/MasterSubTableDrawer.svelte +1 -1
- package/dist/components/MentionsInput.svelte +1 -1
- package/dist/components/MicroAppFrame.svelte +1 -1
- package/dist/components/MicroAppSandbox.svelte +1 -1
- package/dist/components/MockDataInterceptor.svelte +1 -1
- package/dist/components/ModalForm.svelte +9 -9
- package/dist/components/NavigateToResource.svelte +1 -1
- package/dist/components/NotificationCenter.svelte +2 -1
- package/dist/components/OfflineSyncBanner.svelte +1 -1
- package/dist/components/OmnibarCommandPalette.svelte +1 -1
- package/dist/components/PivotDrilldownModal.svelte +1 -1
- package/dist/components/Popconfirm.svelte +62 -21
- package/dist/components/Popconfirm.svelte.d.ts +5 -0
- package/dist/components/QueryBuilder.svelte +1 -1
- package/dist/components/QuotaProgressBar.svelte +2 -1
- package/dist/components/RadioGroup.svelte +1 -1
- package/dist/components/RecordCompareModal.svelte +1 -1
- package/dist/components/RuleExpressionBuilder.svelte +1 -1
- package/dist/components/SafeDeleteConfirm.svelte +1 -1
- package/dist/components/ScheduledJobManager.svelte +1 -1
- package/dist/components/SchemaVisualModeler.svelte +1 -1
- package/dist/components/SecureDataExporter.svelte +1 -1
- package/dist/components/SecuritySettings.svelte +3 -3
- package/dist/components/SessionTimeoutGuard.svelte +1 -1
- package/dist/components/Space.svelte +19 -3
- package/dist/components/Space.svelte.d.ts +6 -1
- package/dist/components/Statistic.svelte +2 -1
- package/dist/components/StepWizard.svelte +1 -1
- package/dist/components/SvarDataGrid.svelte +1 -1
- package/dist/components/SystemHealthCheckDashboard.svelte +2 -2
- package/dist/components/TableAggregationFooter.svelte +3 -1
- package/dist/components/TaskCenter.svelte +3 -2
- package/dist/components/TenantContextSwitcher.svelte +1 -1
- package/dist/components/ThreadedCommentDrawer.svelte +1 -1
- package/dist/components/Toast.svelte +7 -1
- package/dist/components/Toast.svelte.d.ts +4 -1
- package/dist/components/Transfer.svelte +2 -2
- package/dist/components/TreeSelect.svelte +2 -2
- package/dist/components/TreeTransferSelect.svelte +2 -2
- package/dist/components/VirtualTreeSelect.svelte +2 -2
- package/dist/components/WebhookSimulator.svelte +1 -1
- package/dist/components/WidgetContainer.svelte +2 -1
- package/dist/components/account/SettingsEnterprisePage.svelte +5 -4
- package/dist/components/charts/FunnelChart.svelte +2 -2
- package/dist/components/content/AuditTimeline.svelte +2 -1
- package/dist/components/content/ContentPageHeader.svelte +2 -2
- package/dist/components/fields/CopyField.svelte +1 -1
- package/dist/components/fields/DateRangeField.svelte +7 -13
- package/dist/components/svar-grid-interactions.js +9 -5
- package/dist/components/ui/alert/alert.svelte +1 -0
- package/dist/components/ui/breadcrumb/breadcrumb-separator.svelte +10 -2
- package/dist/components/ui/breadcrumb/breadcrumb-separator.svelte.d.ts +1 -0
- package/dist/components/ui/command/command-list.svelte +2 -0
- package/dist/components/ui/command/command-loading.svelte +13 -7
- package/dist/components/ui/dialog/dialog-content.svelte +15 -1
- package/dist/components/ui/dialog/dialog-content.svelte.d.ts +6 -0
- package/dist/components/ui/input/input.svelte +82 -7
- package/dist/components/ui/input/input.svelte.d.ts +7 -2
- package/dist/components/ui/select/select.svelte +6 -1
- package/dist/components/ui/select/select.svelte.d.ts +4 -1
- package/dist/components/ui/switch/switch.svelte +11 -2
- package/dist/components/ui/switch/switch.svelte.d.ts +2 -0
- package/dist/components/ui/textarea/textarea.svelte +61 -1
- package/dist/components/ui/textarea/textarea.svelte.d.ts +7 -1
- package/dist/components/ui/tooltip/tooltip-content.svelte +5 -1
- package/dist/components/ui/tooltip/tooltip-content.svelte.d.ts +1 -0
- package/dist/components/ui/tooltip/tooltip-context.svelte.js +1 -1
- package/dist/copy-format.d.ts +2 -0
- package/dist/copy-format.js +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/notifications.svelte.js +1 -1
- package/dist/page-chrome.css +5 -0
- package/package.json +4 -4
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { formatAdminNumber } from '@svadmin/core';
|
|
2
3
|
import { cn } from '../utils.js';
|
|
3
4
|
|
|
4
5
|
export interface QuotaProgressBarProps {
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
warningThreshold = 0.8,
|
|
35
36
|
criticalThreshold = 0.95,
|
|
36
37
|
showPercent = true,
|
|
37
|
-
formatter = (val) => val
|
|
38
|
+
formatter = (val) => formatAdminNumber(val, { locale: null }),
|
|
38
39
|
description,
|
|
39
40
|
compact = false,
|
|
40
41
|
class: className = '',
|
|
@@ -240,7 +240,7 @@
|
|
|
240
240
|
<input
|
|
241
241
|
type="text"
|
|
242
242
|
bind:value={searchQuery}
|
|
243
|
-
placeholder="Filter attributes
|
|
243
|
+
placeholder="Filter attributes…"
|
|
244
244
|
class="h-8 w-full rounded-sm border border-input bg-background pl-8 pr-3 text-xs placeholder:text-muted-foreground focus:border-primary focus:outline-none"
|
|
245
245
|
/>
|
|
246
246
|
</div>
|
|
@@ -294,7 +294,7 @@
|
|
|
294
294
|
type="text"
|
|
295
295
|
bind:value={child.value}
|
|
296
296
|
oninput={notify}
|
|
297
|
-
placeholder={chinese ? '
|
|
297
|
+
placeholder={chinese ? '输入比较值…' : 'Value…'}
|
|
298
298
|
class="h-7 flex-1 rounded border border-input bg-background px-2 text-xs font-mono focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
299
299
|
/>
|
|
300
300
|
|
|
@@ -287,7 +287,7 @@
|
|
|
287
287
|
>
|
|
288
288
|
{#if loading || isSubmitting}
|
|
289
289
|
<Loader2 class="h-3.5 w-3.5 animate-spin" />
|
|
290
|
-
<span>{t('common.processing', '
|
|
290
|
+
<span>{t('common.processing', '处理中…')}</span>
|
|
291
291
|
{:else}
|
|
292
292
|
<span>{resolvedConfirmText}</span>
|
|
293
293
|
{#if isCooldown}
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
const statusLabels = $derived<Record<ScheduledJobStatus, string>>({
|
|
83
83
|
active: chinese ? '计划运行中' : 'Active',
|
|
84
84
|
paused: chinese ? '已暂停调度' : 'Paused',
|
|
85
|
-
running: chinese ? '
|
|
85
|
+
running: chinese ? '执行中…' : 'Running…',
|
|
86
86
|
failed: chinese ? '上次异常' : 'Failed',
|
|
87
87
|
});
|
|
88
88
|
|
|
@@ -298,7 +298,7 @@
|
|
|
298
298
|
<textarea
|
|
299
299
|
id="json-sample"
|
|
300
300
|
bind:value={rawImportText}
|
|
301
|
-
placeholder="输入或粘贴 JSON
|
|
301
|
+
placeholder="输入或粘贴 JSON 数据样例…"
|
|
302
302
|
rows="8"
|
|
303
303
|
class="w-full rounded-lg border border-input bg-muted/20 p-3 font-mono text-xs focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
304
304
|
></textarea>
|
|
@@ -251,7 +251,7 @@
|
|
|
251
251
|
id="export-reason-input"
|
|
252
252
|
bind:value={exportReason}
|
|
253
253
|
rows="3"
|
|
254
|
-
placeholder={chinese ? '请如实填写导出用途 (如: 2026Q4 财务清算审计)
|
|
254
|
+
placeholder={chinese ? '请如实填写导出用途 (如: 2026Q4 财务清算审计)…' : 'State reason for export for compliance audit…'}
|
|
255
255
|
class="w-full rounded-lg border border-input bg-background p-2.5 text-xs text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
256
256
|
></textarea>
|
|
257
257
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { captureAdminContext, notifyWithProvider, type SessionInfo } from '@svadmin/core';
|
|
2
|
+
import { captureAdminContext, formatAdminTime, notifyWithProvider, type SessionInfo } from '@svadmin/core';
|
|
3
3
|
import { useTranslation } from '@svadmin/core/i18n';
|
|
4
4
|
import { AlertTriangle, Monitor, Smartphone, Trash2 } from '@lucide/svelte';
|
|
5
5
|
import * as Alert from './ui/alert/index.js';
|
|
@@ -213,7 +213,7 @@
|
|
|
213
213
|
<PasswordInput id={`${controlId}-security-new-password`} label={i18n.t('profile.newPassword')} bind:value={newPassword} autocomplete="new-password" showStrength disabled={!authProvider?.updatePassword || changingPassword} />
|
|
214
214
|
<PasswordInput id={`${controlId}-security-confirm-password`} label={i18n.t('auth.confirmPassword')} bind:value={confirmPassword} autocomplete="new-password" disabled={!authProvider?.updatePassword || changingPassword} />
|
|
215
215
|
{#if passwordChangedRecently}<p class="text-xs text-muted-foreground">{i18n.t('profile.passwordChangedRecently')}</p>{/if}
|
|
216
|
-
<Button type="submit" disabled={!authProvider?.updatePassword || changingPassword}>{changingPassword ? (isZh ? '
|
|
216
|
+
<Button type="submit" disabled={!authProvider?.updatePassword || changingPassword}>{changingPassword ? (isZh ? '更新中…' : 'Updating…') : i18n.t('profile.updatePassword')}</Button>
|
|
217
217
|
</form>
|
|
218
218
|
</SettingsGroup>
|
|
219
219
|
<SettingsGroup title={i18n.t('security.activeSessions')} description={i18n.t('security.sessionsDescription')} headingLevel={headingLevel === 'h1' ? 'h2' : 'h3'}>
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
<div class="divide-y">
|
|
229
229
|
{#each sessions as session (session.id)}
|
|
230
230
|
<div class="flex items-center justify-between gap-4 py-3">
|
|
231
|
-
<div class="flex min-w-0 items-center gap-3"><div class="rounded-lg bg-muted p-2 text-muted-foreground">{#if (session.os ?? '').toLowerCase().includes('ios') || (session.os ?? '').toLowerCase().includes('android')}<Smartphone class="h-5 w-5" />{:else}<Monitor class="h-5 w-5" />{/if}</div><div class="min-w-0 space-y-1"><div class="flex flex-wrap items-center gap-2"><span class="text-sm font-medium">{session.os ?? (isZh ? '未知系统' : 'Unknown OS')} - {session.browser ?? (isZh ? '未知浏览器' : 'Unknown browser')}</span>{#if session.current}<span class="rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold text-primary">{i18n.t('security.currentSession')}</span>{/if}</div><div class="flex flex-wrap items-center gap-2 text-xs text-muted-foreground"><span>{session.ipAddress ?? '-'}</span><span>{session.lastActiveAt ?
|
|
231
|
+
<div class="flex min-w-0 items-center gap-3"><div class="rounded-lg bg-muted p-2 text-muted-foreground">{#if (session.os ?? '').toLowerCase().includes('ios') || (session.os ?? '').toLowerCase().includes('android')}<Smartphone class="h-5 w-5" />{:else}<Monitor class="h-5 w-5" />{/if}</div><div class="min-w-0 space-y-1"><div class="flex flex-wrap items-center gap-2"><span class="text-sm font-medium">{session.os ?? (isZh ? '未知系统' : 'Unknown OS')} - {session.browser ?? (isZh ? '未知浏览器' : 'Unknown browser')}</span>{#if session.current}<span class="rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold text-primary">{i18n.t('security.currentSession')}</span>{/if}</div><div class="flex flex-wrap items-center gap-2 text-xs text-muted-foreground"><span>{session.ipAddress ?? '-'}</span><span>{session.lastActiveAt ? formatAdminTime(session.lastActiveAt, { dateStyle: 'medium' }) : '-'}</span></div></div></div>
|
|
232
232
|
{#if !session.current}<Button variant="ghost" size="icon-sm" disabled={revoking !== null} onclick={() => revokeSession(session.id)} title={i18n.t('security.revokeSession')}><Trash2 class="h-4 w-4" /></Button>{/if}
|
|
233
233
|
</div>
|
|
234
234
|
{/each}
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import { cn } from '../utils.js';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* 官方间距:mini / small / medium / large = 4 / 8 / 16 / 24。
|
|
7
|
+
* xs / sm / lg / xl 保留。lg 仍是 16px,不改成官方 large 的 24px。
|
|
8
|
+
* 12px 的 md 已删除。
|
|
9
|
+
*/
|
|
10
|
+
type SpaceSize = 'xs' | 'sm' | 'lg' | 'xl' | 'mini' | 'small' | 'medium' | 'large' | number;
|
|
6
11
|
|
|
7
12
|
interface Props {
|
|
8
13
|
direction?: 'horizontal' | 'vertical';
|
|
@@ -26,7 +31,17 @@
|
|
|
26
31
|
children,
|
|
27
32
|
}: Props = $props();
|
|
28
33
|
|
|
29
|
-
const
|
|
34
|
+
const spaceStep: Record<Exclude<SpaceSize, number>, string> = {
|
|
35
|
+
xs: '1',
|
|
36
|
+
mini: '1',
|
|
37
|
+
sm: '2',
|
|
38
|
+
small: '2',
|
|
39
|
+
lg: '4',
|
|
40
|
+
medium: '4',
|
|
41
|
+
xl: '5',
|
|
42
|
+
large: '5',
|
|
43
|
+
};
|
|
44
|
+
const gap = $derived(typeof size === 'number' ? `${size}px` : `var(--svadmin-space-${spaceStep[size]})`);
|
|
30
45
|
const alignMap = { start: 'flex-start', center: 'center', end: 'flex-end', baseline: 'baseline', stretch: 'stretch' } as const;
|
|
31
46
|
const justifyMap = { start: 'flex-start', center: 'center', end: 'flex-end', between: 'space-between', around: 'space-around', evenly: 'space-evenly' } as const;
|
|
32
47
|
</script>
|
|
@@ -34,6 +49,7 @@
|
|
|
34
49
|
<div
|
|
35
50
|
class={cn('svadmin-space', className)}
|
|
36
51
|
data-direction={direction}
|
|
52
|
+
data-size={typeof size === 'number' ? undefined : size}
|
|
37
53
|
data-inline={inline ? 'true' : 'false'}
|
|
38
54
|
style:--svadmin-space-gap={gap}
|
|
39
55
|
style:align-items={alignMap[align]}
|
|
@@ -55,4 +71,4 @@
|
|
|
55
71
|
.svadmin-space[data-inline='true'] {
|
|
56
72
|
display: inline-flex;
|
|
57
73
|
}
|
|
58
|
-
</style>
|
|
74
|
+
</style>
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* 官方间距:mini / small / medium / large = 4 / 8 / 16 / 24。
|
|
4
|
+
* xs / sm / lg / xl 保留。lg 仍是 16px,不改成官方 large 的 24px。
|
|
5
|
+
* 12px 的 md 已删除。
|
|
6
|
+
*/
|
|
7
|
+
type SpaceSize = 'xs' | 'sm' | 'lg' | 'xl' | 'mini' | 'small' | 'medium' | 'large' | number;
|
|
3
8
|
interface Props {
|
|
4
9
|
direction?: 'horizontal' | 'vertical';
|
|
5
10
|
size?: SpaceSize;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
+
import { formatAdminNumber } from '@svadmin/core';
|
|
3
4
|
import { cn } from '../utils.js';
|
|
4
5
|
|
|
5
6
|
interface Props {
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
|
|
31
32
|
const display = $derived(
|
|
32
33
|
typeof value === 'number'
|
|
33
|
-
?
|
|
34
|
+
? formatAdminNumber(value, { locale: null, minimumFractionDigits: precision, maximumFractionDigits: precision })
|
|
34
35
|
: value,
|
|
35
36
|
);
|
|
36
37
|
</script>
|
|
@@ -497,7 +497,7 @@
|
|
|
497
497
|
>
|
|
498
498
|
{#if isValidating || isSubmitting}
|
|
499
499
|
<Loader2 class="h-4 w-4 animate-spin" />
|
|
500
|
-
<span>{chinese ? '
|
|
500
|
+
<span>{chinese ? '校验处理中…' : 'Processing…'}</span>
|
|
501
501
|
{:else if isLastStep}
|
|
502
502
|
<Check class="h-4 w-4" />
|
|
503
503
|
<span>{resolvedSubmitText}</span>
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
const isZh = $derived(locale.startsWith('zh'));
|
|
65
65
|
const resolvedLabel = $derived(label ?? (isZh ? '数据表格' : 'Data grid'));
|
|
66
66
|
const resolvedEmptyLabel = $derived(emptyLabel ?? (isZh ? '暂无记录' : 'No records'));
|
|
67
|
-
const resolvedLoadingLabel = $derived(loadingLabel ?? (isZh ? '
|
|
67
|
+
const resolvedLoadingLabel = $derived(loadingLabel ?? (isZh ? '加载中…' : 'Loading'));
|
|
68
68
|
const resolvedDisabledLabel = $derived(disabledLabel ?? (isZh ? '表格已禁用' : 'Grid is disabled'));
|
|
69
69
|
const resolvedFallbackLabel = $derived(fallbackLabel ?? (isZh ? '静态预览(最多 20 行)' : 'Static preview (up to 20 rows)'));
|
|
70
70
|
const treeKey = $derived(loadChildren ? childrenKey ?? 'children' : childrenKey);
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
case 'unhealthy':
|
|
168
168
|
return { label: '链路不可用', badge: 'bg-destructive/10 text-destructive border-destructive/20', dot: 'bg-destructive' };
|
|
169
169
|
case 'checking':
|
|
170
|
-
return { label: '
|
|
170
|
+
return { label: '正在巡检…', badge: 'bg-muted text-muted-foreground border-border', dot: 'bg-primary animate-pulse' };
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
</script>
|
|
@@ -210,7 +210,7 @@
|
|
|
210
210
|
<svg class="h-3.5 w-3.5 {isCheckingAll ? 'animate-spin' : ''}" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
211
211
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
|
|
212
212
|
</svg>
|
|
213
|
-
{isCheckingAll ? '
|
|
213
|
+
{isCheckingAll ? '正在执行全量链路自检…' : '一键全量链路巡检'}
|
|
214
214
|
</button>
|
|
215
215
|
</div>
|
|
216
216
|
</div>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Calculator, CheckSquare } from '@lucide/svelte';
|
|
3
|
+
import { formatAdminNumber } from '@svadmin/core';
|
|
3
4
|
import { useTranslation } from '@svadmin/core/i18n';
|
|
4
5
|
import { cn } from '../utils.js';
|
|
5
6
|
|
|
@@ -66,7 +67,8 @@
|
|
|
66
67
|
break;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
return result
|
|
70
|
+
return formatAdminNumber(result, {
|
|
71
|
+
locale: null,
|
|
70
72
|
minimumFractionDigits: precision,
|
|
71
73
|
maximumFractionDigits: precision,
|
|
72
74
|
});
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
import * as Sheet from './ui/sheet/index.js';
|
|
16
16
|
import { Button } from './ui/button/index.js';
|
|
17
17
|
import { cn } from '../utils.js';
|
|
18
|
+
import { formatAdminNumber, formatAdminTime } from '@svadmin/core';
|
|
18
19
|
import { useTranslation } from '@svadmin/core/i18n';
|
|
19
20
|
|
|
20
21
|
export type BackgroundTaskStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
@@ -97,7 +98,7 @@
|
|
|
97
98
|
function formatTime(dateVal: string | Date): string {
|
|
98
99
|
const d = typeof dateVal === 'string' ? new Date(dateVal) : dateVal;
|
|
99
100
|
if (isNaN(d.getTime())) return String(dateVal);
|
|
100
|
-
return d
|
|
101
|
+
return formatAdminTime(d);
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
function formatDuration(seconds: number | undefined): string {
|
|
@@ -384,7 +385,7 @@
|
|
|
384
385
|
<div class="flex items-center justify-between text-xs text-muted-foreground">
|
|
385
386
|
<span>
|
|
386
387
|
{#if task.processedCount != null && task.totalCount != null}
|
|
387
|
-
{task.processedCount
|
|
388
|
+
{formatAdminNumber(task.processedCount, { locale: null })} / {formatAdminNumber(task.totalCount, { locale: null })}
|
|
388
389
|
{:else}
|
|
389
390
|
{task.progress ?? 0}%
|
|
390
391
|
{/if}
|
|
@@ -225,7 +225,7 @@
|
|
|
225
225
|
<div class="relative flex items-end gap-2">
|
|
226
226
|
<textarea
|
|
227
227
|
bind:value={newCommentText}
|
|
228
|
-
placeholder={chinese ? '发表业务批注或
|
|
228
|
+
placeholder={chinese ? '发表业务批注或 @成员协同讨论…' : 'Leave a comment…'}
|
|
229
229
|
rows="2"
|
|
230
230
|
class="flex-1 rounded-lg border border-input bg-background p-2.5 text-xs text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
231
231
|
></textarea>
|
|
@@ -15,11 +15,16 @@
|
|
|
15
15
|
import { registerToastHost, type ToastHostRegistration } from './toast-host.svelte.js';
|
|
16
16
|
import UndoableNotification from './UndoableNotification.svelte';
|
|
17
17
|
|
|
18
|
+
let { placement }: { placement?: 'top' | 'bottom' } = $props();
|
|
18
19
|
let host = $state<ToastHostRegistration | null>(null);
|
|
19
20
|
let sheetOpen = $state(false);
|
|
20
21
|
const isActiveHost = $derived(host?.isActive() ?? false);
|
|
21
22
|
const theme = $derived(getResolvedTheme() === 'dark' ? 'dark' : 'light');
|
|
22
|
-
|
|
23
|
+
// 默认仍是 top-right,抽屉打开时改到 bottom-left,避开底部居中的撤销条。
|
|
24
|
+
// 显式 placement 才用 Arco 的顶部 / 底部居中。
|
|
25
|
+
const toastPosition = $derived<'top-right' | 'bottom-left' | 'top-center' | 'bottom-center'>(
|
|
26
|
+
placement === 'top' ? 'top-center' : placement === 'bottom' ? 'bottom-center' : sheetOpen ? 'bottom-left' : 'top-right',
|
|
27
|
+
);
|
|
23
28
|
|
|
24
29
|
onMount(() => {
|
|
25
30
|
const syncSheetState = (): void => {
|
|
@@ -48,6 +53,7 @@
|
|
|
48
53
|
case 'error': sonner.error(t.message, options); break;
|
|
49
54
|
case 'warning': sonner.warning(t.message, options); break;
|
|
50
55
|
case 'info': sonner.info(t.message, options); break;
|
|
56
|
+
case 'normal': sonner.message(t.message, options); break;
|
|
51
57
|
}
|
|
52
58
|
}
|
|
53
59
|
consumeToastQueue();
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
placement?: 'top' | 'bottom';
|
|
3
|
+
};
|
|
4
|
+
declare const Toast: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
2
5
|
type Toast = ReturnType<typeof Toast>;
|
|
3
6
|
export default Toast;
|
|
@@ -226,7 +226,7 @@
|
|
|
226
226
|
type="text"
|
|
227
227
|
aria-label={titles[0]}
|
|
228
228
|
bind:value={leftSearch}
|
|
229
|
-
placeholder={i18n.t('common.search', undefined) ?? '
|
|
229
|
+
placeholder={i18n.t('common.search', undefined) ?? '搜索…'}
|
|
230
230
|
class="h-8 pl-8 pr-2 text-xs"
|
|
231
231
|
{disabled}
|
|
232
232
|
/>
|
|
@@ -355,7 +355,7 @@
|
|
|
355
355
|
type="text"
|
|
356
356
|
aria-label={titles[1]}
|
|
357
357
|
bind:value={rightSearch}
|
|
358
|
-
placeholder={i18n.t('common.search', undefined) ?? '
|
|
358
|
+
placeholder={i18n.t('common.search', undefined) ?? '搜索…'}
|
|
359
359
|
class="h-8 pl-8 pr-2 text-xs"
|
|
360
360
|
{disabled}
|
|
361
361
|
/>
|
|
@@ -811,7 +811,7 @@
|
|
|
811
811
|
>
|
|
812
812
|
{#if selectedValues.length === 0}
|
|
813
813
|
<span class="text-muted-foreground">
|
|
814
|
-
{placeholder ?? (i18n.t('field.selectPlaceholder', undefined) ?? '
|
|
814
|
+
{placeholder ?? (i18n.t('field.selectPlaceholder', undefined) ?? '请选择…')}
|
|
815
815
|
</span>
|
|
816
816
|
{:else if multiple}
|
|
817
817
|
{#each selectedValues as val (val)}
|
|
@@ -873,7 +873,7 @@
|
|
|
873
873
|
aria-label={i18n.t('common.search')}
|
|
874
874
|
aria-controls={treeId}
|
|
875
875
|
onkeydown={handleSearchKeydown}
|
|
876
|
-
placeholder={i18n.t('common.search', undefined) ?? '
|
|
876
|
+
placeholder={i18n.t('common.search', undefined) ?? '搜索…'}
|
|
877
877
|
class="h-8 pl-8 pr-2 text-xs"
|
|
878
878
|
/>
|
|
879
879
|
</div>
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
<input
|
|
168
168
|
type="text"
|
|
169
169
|
bind:value={sourceSearch}
|
|
170
|
-
placeholder={chinese ? '
|
|
170
|
+
placeholder={chinese ? '检索部门或节点…' : 'Search tree…'}
|
|
171
171
|
class="h-7 w-full rounded border border-input bg-muted/20 pl-7.5 pr-2 text-xs focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
172
172
|
/>
|
|
173
173
|
</div>
|
|
@@ -288,7 +288,7 @@
|
|
|
288
288
|
<input
|
|
289
289
|
type="text"
|
|
290
290
|
bind:value={targetSearch}
|
|
291
|
-
placeholder={chinese ? '
|
|
291
|
+
placeholder={chinese ? '搜索已指派项…' : 'Filter assigned…'}
|
|
292
292
|
class="h-7 w-full rounded border border-input bg-muted/20 pl-7.5 pr-2 text-xs focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
293
293
|
/>
|
|
294
294
|
</div>
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
options = [],
|
|
40
40
|
value = $bindable(undefined),
|
|
41
41
|
multiple = false,
|
|
42
|
-
placeholder = 'Please select
|
|
42
|
+
placeholder = 'Please select…',
|
|
43
43
|
disabled = false,
|
|
44
44
|
height = 260,
|
|
45
45
|
itemHeight = 32,
|
|
@@ -344,7 +344,7 @@
|
|
|
344
344
|
<input
|
|
345
345
|
type="text"
|
|
346
346
|
bind:value={searchQuery}
|
|
347
|
-
placeholder="Search nodes
|
|
347
|
+
placeholder="Search nodes…"
|
|
348
348
|
class="w-full rounded-sm border border-input bg-background pl-8 pr-2.5 py-1 text-xs focus:outline-hidden focus:ring-1 focus:ring-ring"
|
|
349
349
|
/>
|
|
350
350
|
</div>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onMount, onDestroy, type Snippet } from 'svelte';
|
|
3
3
|
import { Maximize2, Minimize2, RotateCw, AlertCircle, RefreshCw } from '@lucide/svelte';
|
|
4
|
+
import { formatAdminTime } from '@svadmin/core';
|
|
4
5
|
import { cn } from '../utils.js';
|
|
5
6
|
|
|
6
7
|
export interface WidgetContainerProps {
|
|
@@ -58,7 +59,7 @@
|
|
|
58
59
|
if (!lastUpdated) return '';
|
|
59
60
|
try {
|
|
60
61
|
const d = new Date(lastUpdated);
|
|
61
|
-
return d
|
|
62
|
+
return formatAdminTime(d);
|
|
62
63
|
} catch {
|
|
63
64
|
return String(lastUpdated);
|
|
64
65
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
captureAdminContext,
|
|
6
|
+
formatAdminTime,
|
|
6
7
|
notifyWithProvider,
|
|
7
8
|
type EnterpriseSecurityEvent,
|
|
8
9
|
type EnterpriseSecurityPolicy,
|
|
@@ -193,7 +194,7 @@
|
|
|
193
194
|
event: event.event,
|
|
194
195
|
actor: event.actor,
|
|
195
196
|
location: event.location,
|
|
196
|
-
createdAt: event.createdAt instanceof Date ? event.createdAt
|
|
197
|
+
createdAt: event.createdAt instanceof Date ? formatAdminTime(event.createdAt, { dateStyle: 'medium' }) : String(event.createdAt),
|
|
197
198
|
severity: event.severity === 'critical' ? 'danger' : (event.severity ?? 'info'),
|
|
198
199
|
}))));
|
|
199
200
|
</script>
|
|
@@ -219,7 +220,7 @@
|
|
|
219
220
|
<div class="grid items-start gap-4 lg:grid-cols-2">
|
|
220
221
|
<SettingsGroup title={i18n.t('account.securityPolicy')} description={isZh ? '配置组织级身份、会话与审计策略。' : 'Configure organization-wide identity, session, and audit controls.'} bodyClass="space-y-4">
|
|
221
222
|
{#if organizationProvider}
|
|
222
|
-
<div class="space-y-2"><Label for={`${controlId}-organization-name`}>{isZh ? '组织名称' : 'Organization name'}</Label><div class="flex gap-2"><Input id={`${controlId}-organization-name`} bind:value={organizationName} disabled={!organizationProvider.updateCurrentOrganization || savingOrganization} /><Button variant="outline" size="sm" disabled={!organizationChanged || savingOrganization} onclick={saveOrganization}>{savingOrganization ? (isZh ? '
|
|
223
|
+
<div class="space-y-2"><Label for={`${controlId}-organization-name`}>{isZh ? '组织名称' : 'Organization name'}</Label><div class="flex gap-2"><Input id={`${controlId}-organization-name`} bind:value={organizationName} disabled={!organizationProvider.updateCurrentOrganization || savingOrganization} /><Button variant="outline" size="sm" disabled={!organizationChanged || savingOrganization} onclick={saveOrganization}>{savingOrganization ? (isZh ? '保存中…' : 'Saving…') : i18n.t('common.save')}</Button></div></div>
|
|
223
224
|
{/if}
|
|
224
225
|
<div class="grid gap-4 sm:grid-cols-2">
|
|
225
226
|
<div class="space-y-2"><Label for={`${controlId}-session-timeout`}>{i18n.t('account.sessionTimeout')}</Label><Input id={`${controlId}-session-timeout`} type="number" min="1" step="1" bind:value={sessionTimeoutValue} disabled={!policy || saving} aria-invalid={policy ? !sessionTimeoutValid : undefined} aria-describedby={policy && !sessionTimeoutValid ? `${controlId}-policy-error` : undefined} /></div>
|
|
@@ -227,7 +228,7 @@
|
|
|
227
228
|
</div>
|
|
228
229
|
{#if policy && !policyNumbersValid}<div id={`${controlId}-policy-error`}><FeedbackNotice tone="warning" message={isZh ? '会话超时和审计保留天数必须为正整数。' : 'Session timeout and audit retention must be positive integers.'} /></div>{/if}
|
|
229
230
|
<SettingsFieldRow label={i18n.t('account.auditLogging')} controlId={`${controlId}-audit`} description={isZh ? '由后端持久化组织级审计策略。' : 'Persist the organization audit policy through the backend provider.'} control={auditControl} separated />
|
|
230
|
-
<Button size="sm" disabled={!identityProvider || !policy || !policyNumbersValid || saving} onclick={saveSettings}>{saving ? (isZh ? '
|
|
231
|
+
<Button size="sm" disabled={!identityProvider || !policy || !policyNumbersValid || saving} onclick={saveSettings}>{saving ? (isZh ? '保存中…' : 'Saving…') : i18n.t('common.save')}</Button>
|
|
231
232
|
</SettingsGroup>
|
|
232
233
|
<SettingsGroup title={i18n.t('account.singleSignOn')} description={i18n.t('account.ssoDescription')} bodyClass="space-y-4">
|
|
233
234
|
<SettingsFieldRow label={i18n.t('account.enableSso')} controlId={`${controlId}-sso`} description={isZh ? '启用后由已配置身份源执行组织登录策略。' : 'Require the configured identity provider for organization members.'} control={ssoControl} />
|
|
@@ -235,7 +236,7 @@
|
|
|
235
236
|
<Label for={`${controlId}-metadata-url`}>{i18n.t('account.ssoProvider')}</Label>
|
|
236
237
|
<Input id={`${controlId}-metadata-url`} type="url" bind:value={metadataUrl} placeholder="https://idp.example.com/.well-known/openid-configuration" disabled={!identityProvider || testing} />
|
|
237
238
|
</div>
|
|
238
|
-
<Button variant="outline" size="sm" disabled={!identityProvider || testing} onclick={() => testConnection()}>{testing ? (isZh ? '
|
|
239
|
+
<Button variant="outline" size="sm" disabled={!identityProvider || testing} onclick={() => testConnection()}>{testing ? (isZh ? '测试中…' : 'Testing…') : i18n.t('common.test')}</Button>
|
|
239
240
|
</SettingsGroup>
|
|
240
241
|
</div>
|
|
241
242
|
<section class="space-y-3">
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { formatAdminNumber, formatAdminPercent } from '@svadmin/core';
|
|
2
3
|
interface Stage {
|
|
3
4
|
label: string;
|
|
4
5
|
value: number;
|
|
@@ -57,9 +58,8 @@
|
|
|
57
58
|
{stage.label}
|
|
58
59
|
</text>
|
|
59
60
|
{#if showValue}
|
|
60
|
-
{@const ratio = total > 0 ? ((stage.value / total) * 100).toFixed(1) : '0.0'}
|
|
61
61
|
<text x={width / 2} y={top + 37} text-anchor="middle" fill="var(--muted-foreground)" font-size="11">
|
|
62
|
-
{stage.value
|
|
62
|
+
{formatAdminNumber(stage.value, { locale: null })} · {formatAdminPercent(total > 0 ? stage.value / total : 0, { locale: null, minimumFractionDigits: 1, maximumFractionDigits: 1 })}
|
|
63
63
|
</text>
|
|
64
64
|
{/if}
|
|
65
65
|
{/each}
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
<script lang="ts">
|
|
33
33
|
import type { Snippet } from 'svelte';
|
|
34
34
|
import { ArrowRight, Globe } from '@lucide/svelte';
|
|
35
|
+
import { formatAdminTime } from '@svadmin/core';
|
|
35
36
|
import { definedOptions } from '@svadmin/core/options';
|
|
36
37
|
import { useTranslation } from '@svadmin/core/i18n';
|
|
37
38
|
import { cn } from '../../utils.js';
|
|
@@ -95,7 +96,7 @@
|
|
|
95
96
|
if (typeof val === 'string' && !/^\d{4}-\d{2}-\d{2}T/.test(val)) return val;
|
|
96
97
|
try {
|
|
97
98
|
const d = typeof val === 'number' ? new Date(val) : new Date(val);
|
|
98
|
-
return isNaN(d.getTime()) ? String(val) : d
|
|
99
|
+
return isNaN(d.getTime()) ? String(val) : formatAdminTime(d, { dateStyle: 'medium' });
|
|
99
100
|
} catch {
|
|
100
101
|
return String(val);
|
|
101
102
|
}
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
data-density={density}
|
|
34
34
|
>
|
|
35
35
|
{#if breadcrumbs.length > 0}
|
|
36
|
-
<nav aria-label="Breadcrumb" class={styles.breadcrumbs}>
|
|
36
|
+
<nav aria-label="Breadcrumb" class="{styles.breadcrumbs} svadmin-page-header__breadcrumbs">
|
|
37
37
|
{#each breadcrumbs as crumb, index (crumb)}
|
|
38
38
|
{#if index > 0}<span aria-hidden="true">/</span>{/if}
|
|
39
39
|
<span class={index === breadcrumbs.length - 1 ? styles.currentCrumb : ''}>{crumb}</span>
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
{/if}
|
|
43
43
|
<div class={styles.row}>
|
|
44
44
|
<div class={styles.heading}>
|
|
45
|
-
{#if eyebrow}<p class={styles.eyebrow}>{eyebrow}</p>{/if}
|
|
45
|
+
{#if eyebrow}<p class="{styles.eyebrow} svadmin-page-header__eyebrow">{eyebrow}</p>{/if}
|
|
46
46
|
<svelte:element this={headingLevel} class={styles.title}>{title}</svelte:element>
|
|
47
47
|
{#if description}<p class={styles.description}>{description}</p>{/if}
|
|
48
48
|
</div>
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
|
|
41
41
|
function maskText(str: string): string {
|
|
42
42
|
if (str.length <= 8) return '****';
|
|
43
|
-
return `${str.slice(0, 4)}
|
|
43
|
+
return `${str.slice(0, 4)}…${str.slice(-4)}`;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
const rawString = $derived(value != null && value !== '' ? String(value) : '');
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
<script lang="ts">
|
|
11
11
|
import { Calendar } from '@lucide/svelte';
|
|
12
|
+
import { formatAdminDate, formatAdminTime } from '@svadmin/core';
|
|
12
13
|
import { cn } from '../../utils.js';
|
|
13
14
|
|
|
14
15
|
interface Props {
|
|
@@ -61,20 +62,13 @@
|
|
|
61
62
|
if (isNaN(d.getTime())) return null;
|
|
62
63
|
|
|
63
64
|
if (format === 'iso') return d.toISOString();
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
(format === 'datetime'
|
|
68
|
-
? { dateStyle: 'medium', timeStyle: 'short' }
|
|
69
|
-
: format === 'time'
|
|
70
|
-
? { timeStyle: 'medium' }
|
|
71
|
-
: { dateStyle: 'medium' });
|
|
72
|
-
|
|
73
|
-
try {
|
|
74
|
-
return new Intl.DateTimeFormat(locale, defaultOptions).format(d);
|
|
75
|
-
} catch {
|
|
76
|
-
return d.toLocaleDateString();
|
|
65
|
+
if (options) {
|
|
66
|
+
try { return new Intl.DateTimeFormat(locale, options).format(d); }
|
|
67
|
+
catch { return formatAdminDate(d, { locale }); }
|
|
77
68
|
}
|
|
69
|
+
if (format === 'datetime') return formatAdminTime(d, { locale, dateStyle: 'medium', seconds: false });
|
|
70
|
+
if (format === 'time') return formatAdminTime(d, { locale });
|
|
71
|
+
return formatAdminDate(d, { locale, dateStyle: 'medium' });
|
|
78
72
|
}
|
|
79
73
|
|
|
80
74
|
const startFormatted = $derived(formatDate(start));
|