@svadmin/ui 0.126.0 → 0.127.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 +505 -54
- package/dist/app.theme.css +505 -54
- 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/CommandPalette.svelte +1 -1
- 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 +5 -2
- 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 +4 -4
- package/dist/components/FilterDropdown.svelte +2 -2
- package/dist/components/FilterTagBar.svelte +7 -4
- 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/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/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/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/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/page-chrome.css +5 -0
- package/package.json +4 -4
|
@@ -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}
|
|
@@ -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));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { formatAdminCurrency, formatAdminDate, formatAdminNumber, formatAdminPercent, formatAdminTime } from '@svadmin/core/copy-format';
|
|
1
2
|
import { checkedSvarColumns, buildSvarColumns, svarColumnId, nextSvarSort, nextSvarFilter, SVAR_BLOCKED_ACTIONS } from './svar-grid-contract.js';
|
|
2
3
|
import { svarRecordIndex, svarRecordKey } from './svar-grid-operations.js';
|
|
3
4
|
export function checkedSvarInteractiveColumns(columns) {
|
|
@@ -29,10 +30,11 @@ export function formatSvarValue(value, column, locale) {
|
|
|
29
30
|
if (format === 'number' || format === 'currency' || format === 'percent') {
|
|
30
31
|
if (typeof value !== 'number' || !Number.isFinite(value))
|
|
31
32
|
return '—';
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
if (format === 'currency')
|
|
34
|
+
return formatAdminCurrency(value, { locale, currency: column.currency ?? 'USD' });
|
|
35
|
+
if (format === 'percent')
|
|
36
|
+
return formatAdminPercent(value, { locale, maximumFractionDigits: 2 });
|
|
37
|
+
return formatAdminNumber(value, { locale });
|
|
36
38
|
}
|
|
37
39
|
if (format === 'date' || format === 'datetime') {
|
|
38
40
|
if (typeof value !== 'string' && typeof value !== 'number')
|
|
@@ -40,7 +42,9 @@ export function formatSvarValue(value, column, locale) {
|
|
|
40
42
|
const date = new Date(value);
|
|
41
43
|
if (!Number.isFinite(date.getTime()))
|
|
42
44
|
return '—';
|
|
43
|
-
return
|
|
45
|
+
return format === 'date'
|
|
46
|
+
? formatAdminDate(date, { locale, dateStyle: 'medium', timeZone: 'UTC' })
|
|
47
|
+
: formatAdminTime(date, { locale, dateStyle: 'medium', seconds: false, timeZone: 'UTC' });
|
|
44
48
|
}
|
|
45
49
|
return typeof value === 'string' || typeof value === 'boolean' || (typeof value === 'number' && Number.isFinite(value)) ? String(value) : '—';
|
|
46
50
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
let {
|
|
6
6
|
ref = $bindable(null),
|
|
7
7
|
class: className,
|
|
8
|
+
"aria-label": ariaLabel = "Suggestions…",
|
|
8
9
|
...restProps
|
|
9
10
|
}: CommandPrimitive.ListProps = $props();
|
|
10
11
|
</script>
|
|
@@ -14,5 +15,6 @@
|
|
|
14
15
|
data-slot="command-list"
|
|
15
16
|
data-cmdk-list=""
|
|
16
17
|
class={cn("svadmin-command-list", className)}
|
|
18
|
+
aria-label={ariaLabel}
|
|
17
19
|
{...restProps}
|
|
18
20
|
/>
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Command as CommandPrimitive } from "bits-ui";
|
|
3
3
|
|
|
4
|
-
let {
|
|
4
|
+
let {
|
|
5
|
+
ref = $bindable(null),
|
|
6
|
+
children,
|
|
7
|
+
"aria-label": ariaLabel = "Loading…",
|
|
8
|
+
...restProps
|
|
9
|
+
}: CommandPrimitive.LoadingProps = $props();
|
|
5
10
|
</script>
|
|
6
11
|
|
|
7
|
-
<CommandPrimitive.Loading
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
<CommandPrimitive.Loading bind:ref {...restProps}>
|
|
13
|
+
{#snippet child({ props })}
|
|
14
|
+
<div {...props} data-slot="command-loading" data-cmdk-loading="" aria-label={ariaLabel}>
|
|
15
|
+
{@render children?.()}
|
|
16
|
+
</div>
|
|
17
|
+
{/snippet}
|
|
18
|
+
</CommandPrimitive.Loading>
|
|
@@ -14,11 +14,20 @@
|
|
|
14
14
|
portalProps,
|
|
15
15
|
children,
|
|
16
16
|
showCloseButton = true,
|
|
17
|
+
closeOnOverlayClick = true,
|
|
18
|
+
size,
|
|
19
|
+
loading = false,
|
|
17
20
|
...restProps
|
|
18
21
|
}: WithoutChildrenOrChild<DialogPrimitive.ContentProps> & {
|
|
19
22
|
portalProps?: WithoutChildrenOrChild<ComponentProps<typeof DialogPortal>>;
|
|
20
23
|
children: Snippet;
|
|
21
24
|
showCloseButton?: boolean;
|
|
25
|
+
/** 信息展示可点遮罩关闭。录入表单应传 false。 */
|
|
26
|
+
closeOnOverlayClick?: boolean;
|
|
27
|
+
/** Arco 建议宽度:400 / 520 / 720。不传则保持现有默认宽度。 */
|
|
28
|
+
size?: 'sm' | 'md' | 'lg';
|
|
29
|
+
/** 加载中时正文区保持最小高度,避免标题和按钮跳动。 */
|
|
30
|
+
loading?: boolean;
|
|
22
31
|
} = $props();
|
|
23
32
|
</script>
|
|
24
33
|
|
|
@@ -27,6 +36,11 @@
|
|
|
27
36
|
<DialogPrimitive.Content
|
|
28
37
|
bind:ref
|
|
29
38
|
data-slot="dialog-content"
|
|
39
|
+
data-dialog-size={size}
|
|
40
|
+
data-close-on-overlay={closeOnOverlayClick ? 'true' : 'false'}
|
|
41
|
+
data-loading={loading ? 'true' : undefined}
|
|
42
|
+
aria-busy={loading ? 'true' : undefined}
|
|
43
|
+
interactOutsideBehavior={closeOnOverlayClick ? 'close' : 'ignore'}
|
|
30
44
|
class={cn(
|
|
31
45
|
"svadmin-dialog-content",
|
|
32
46
|
className
|
|
@@ -37,7 +51,7 @@
|
|
|
37
51
|
{#if showCloseButton}
|
|
38
52
|
<DialogPrimitive.Close data-slot="dialog-close">
|
|
39
53
|
{#snippet child({ props })}
|
|
40
|
-
<Button variant="ghost" class="absolute top-2 right-2" size="icon-sm" {...props}>
|
|
54
|
+
<Button variant="ghost" class="svadmin-dialog-dismiss absolute top-2 right-2" size="icon-sm" {...props}>
|
|
41
55
|
<XIcon />
|
|
42
56
|
<span class="svadmin-sr-only">Close</span>
|
|
43
57
|
</Button>
|
|
@@ -7,6 +7,12 @@ type $$ComponentProps = WithoutChildrenOrChild<DialogPrimitive.ContentProps> & {
|
|
|
7
7
|
portalProps?: WithoutChildrenOrChild<ComponentProps<typeof DialogPortal>>;
|
|
8
8
|
children: Snippet;
|
|
9
9
|
showCloseButton?: boolean;
|
|
10
|
+
/** 信息展示可点遮罩关闭。录入表单应传 false。 */
|
|
11
|
+
closeOnOverlayClick?: boolean;
|
|
12
|
+
/** Arco 建议宽度:400 / 520 / 720。不传则保持现有默认宽度。 */
|
|
13
|
+
size?: 'sm' | 'md' | 'lg';
|
|
14
|
+
/** 加载中时正文区保持最小高度,避免标题和按钮跳动。 */
|
|
15
|
+
loading?: boolean;
|
|
10
16
|
};
|
|
11
17
|
declare const DialogContent: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
12
18
|
type DialogContent = ReturnType<typeof DialogContent>;
|