@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.
Files changed (129) hide show
  1. package/dist/app.css +660 -81
  2. package/dist/app.theme.css +660 -81
  3. package/dist/components/AbacPolicyMatrix.svelte +1 -1
  4. package/dist/components/AboutSettings.svelte +1 -1
  5. package/dist/components/ActionPalette.svelte +2 -2
  6. package/dist/components/ActivityFeed.svelte +1 -1
  7. package/dist/components/AdminApp.svelte +2 -2
  8. package/dist/components/AdminCopilotWidget.svelte +4 -4
  9. package/dist/components/AnimatedCounter.svelte +2 -1
  10. package/dist/components/ApiPlayground.svelte +2 -2
  11. package/dist/components/ApiSettings.svelte +3 -3
  12. package/dist/components/ApprovalActionCard.svelte +1 -1
  13. package/dist/components/AsyncExportModal.svelte +6 -6
  14. package/dist/components/AuditLogDrawer.svelte +1 -1
  15. package/dist/components/AuditLogViewer.svelte +3 -3
  16. package/dist/components/AuditTrailInspector.svelte +1 -1
  17. package/dist/components/AutoTable.svelte +2 -1
  18. package/dist/components/BatchEditModal.svelte +2 -2
  19. package/dist/components/BillingInvoiceDrawer.svelte +4 -3
  20. package/dist/components/CanvasAnnotation.svelte +1 -1
  21. package/dist/components/Cascader.svelte +3 -3
  22. package/dist/components/ColumnSettings.svelte +1 -1
  23. package/dist/components/ColumnVisibilityDrawer.svelte +2 -2
  24. package/dist/components/ComboboxField.svelte +15 -8
  25. package/dist/components/CommandPalette.svelte +16 -5
  26. package/dist/components/CommentThread.svelte +2 -1
  27. package/dist/components/ConcurrentConflictModal.svelte +3 -3
  28. package/dist/components/ConfirmDialog.svelte +2 -2
  29. package/dist/components/DashboardLayoutStorage.svelte +2 -2
  30. package/dist/components/DataFreshnessIndicator.svelte +1 -1
  31. package/dist/components/DataImportDropzone.svelte +1 -1
  32. package/dist/components/DrawerForm.svelte +1 -1
  33. package/dist/components/DualApprovalGate.svelte +2 -2
  34. package/dist/components/ExcelExportButton.svelte +1 -1
  35. package/dist/components/ExcelImportWizard.svelte +1 -1
  36. package/dist/components/FieldRenderer.svelte +6 -6
  37. package/dist/components/FileUpload.svelte +11 -2
  38. package/dist/components/FileUpload.svelte.d.ts +2 -0
  39. package/dist/components/FilterDropdown.svelte +2 -2
  40. package/dist/components/FilterTagBar.svelte +1 -1
  41. package/dist/components/GlobalShortcuts.svelte +1 -1
  42. package/dist/components/HmacSignatureCalculator.svelte +2 -2
  43. package/dist/components/I18nLanguagePackEditor.svelte +1 -1
  44. package/dist/components/ImportPreviewValidator.svelte +1 -1
  45. package/dist/components/ImportWizard.svelte +2 -2
  46. package/dist/components/IncidentWarRoomDrawer.svelte +1 -1
  47. package/dist/components/InlineEdit.svelte +1 -1
  48. package/dist/components/JsonViewer.svelte +1 -1
  49. package/dist/components/KeyboardShortcutsModal.svelte +1 -1
  50. package/dist/components/KpiCard.svelte +2 -1
  51. package/dist/components/LazyPage.svelte +1 -1
  52. package/dist/components/LiveIndicator.svelte +1 -1
  53. package/dist/components/LiveStreamLogViewer.svelte +1 -1
  54. package/dist/components/LockScreen.svelte +4 -4
  55. package/dist/components/MasterDetailView.svelte +1 -1
  56. package/dist/components/MasterSubTableDrawer.svelte +1 -1
  57. package/dist/components/MentionsInput.svelte +1 -1
  58. package/dist/components/MicroAppFrame.svelte +1 -1
  59. package/dist/components/MicroAppSandbox.svelte +1 -1
  60. package/dist/components/MockDataInterceptor.svelte +1 -1
  61. package/dist/components/ModalForm.svelte +9 -9
  62. package/dist/components/NavigateToResource.svelte +1 -1
  63. package/dist/components/NotificationCenter.svelte +2 -1
  64. package/dist/components/OfflineSyncBanner.svelte +1 -1
  65. package/dist/components/OmnibarCommandPalette.svelte +1 -1
  66. package/dist/components/PivotDrilldownModal.svelte +1 -1
  67. package/dist/components/Popconfirm.svelte +62 -21
  68. package/dist/components/Popconfirm.svelte.d.ts +5 -0
  69. package/dist/components/QueryBuilder.svelte +1 -1
  70. package/dist/components/QuotaProgressBar.svelte +2 -1
  71. package/dist/components/RadioGroup.svelte +1 -1
  72. package/dist/components/RecordCompareModal.svelte +1 -1
  73. package/dist/components/RuleExpressionBuilder.svelte +1 -1
  74. package/dist/components/SafeDeleteConfirm.svelte +1 -1
  75. package/dist/components/ScheduledJobManager.svelte +1 -1
  76. package/dist/components/SchemaVisualModeler.svelte +1 -1
  77. package/dist/components/SecureDataExporter.svelte +1 -1
  78. package/dist/components/SecuritySettings.svelte +3 -3
  79. package/dist/components/SessionTimeoutGuard.svelte +1 -1
  80. package/dist/components/Space.svelte +19 -3
  81. package/dist/components/Space.svelte.d.ts +6 -1
  82. package/dist/components/Statistic.svelte +2 -1
  83. package/dist/components/StepWizard.svelte +1 -1
  84. package/dist/components/SvarDataGrid.svelte +1 -1
  85. package/dist/components/SystemHealthCheckDashboard.svelte +2 -2
  86. package/dist/components/TableAggregationFooter.svelte +3 -1
  87. package/dist/components/TaskCenter.svelte +3 -2
  88. package/dist/components/TenantContextSwitcher.svelte +1 -1
  89. package/dist/components/ThreadedCommentDrawer.svelte +1 -1
  90. package/dist/components/Toast.svelte +7 -1
  91. package/dist/components/Toast.svelte.d.ts +4 -1
  92. package/dist/components/Transfer.svelte +2 -2
  93. package/dist/components/TreeSelect.svelte +2 -2
  94. package/dist/components/TreeTransferSelect.svelte +2 -2
  95. package/dist/components/VirtualTreeSelect.svelte +2 -2
  96. package/dist/components/WebhookSimulator.svelte +1 -1
  97. package/dist/components/WidgetContainer.svelte +2 -1
  98. package/dist/components/account/SettingsEnterprisePage.svelte +5 -4
  99. package/dist/components/charts/FunnelChart.svelte +2 -2
  100. package/dist/components/content/AuditTimeline.svelte +2 -1
  101. package/dist/components/content/ContentPageHeader.svelte +2 -2
  102. package/dist/components/fields/CopyField.svelte +1 -1
  103. package/dist/components/fields/DateRangeField.svelte +7 -13
  104. package/dist/components/svar-grid-interactions.js +9 -5
  105. package/dist/components/ui/alert/alert.svelte +1 -0
  106. package/dist/components/ui/breadcrumb/breadcrumb-separator.svelte +10 -2
  107. package/dist/components/ui/breadcrumb/breadcrumb-separator.svelte.d.ts +1 -0
  108. package/dist/components/ui/command/command-list.svelte +2 -0
  109. package/dist/components/ui/command/command-loading.svelte +13 -7
  110. package/dist/components/ui/dialog/dialog-content.svelte +15 -1
  111. package/dist/components/ui/dialog/dialog-content.svelte.d.ts +6 -0
  112. package/dist/components/ui/input/input.svelte +82 -7
  113. package/dist/components/ui/input/input.svelte.d.ts +7 -2
  114. package/dist/components/ui/select/select.svelte +6 -1
  115. package/dist/components/ui/select/select.svelte.d.ts +4 -1
  116. package/dist/components/ui/switch/switch.svelte +11 -2
  117. package/dist/components/ui/switch/switch.svelte.d.ts +2 -0
  118. package/dist/components/ui/textarea/textarea.svelte +61 -1
  119. package/dist/components/ui/textarea/textarea.svelte.d.ts +7 -1
  120. package/dist/components/ui/tooltip/tooltip-content.svelte +5 -1
  121. package/dist/components/ui/tooltip/tooltip-content.svelte.d.ts +1 -0
  122. package/dist/components/ui/tooltip/tooltip-context.svelte.js +1 -1
  123. package/dist/copy-format.d.ts +2 -0
  124. package/dist/copy-format.js +1 -0
  125. package/dist/index.d.ts +3 -0
  126. package/dist/index.js +2 -0
  127. package/dist/notifications.svelte.js +1 -1
  128. package/dist/page-chrome.css +5 -0
  129. package/package.json +4 -4
@@ -455,7 +455,7 @@
455
455
  >
456
456
  {#if isVerifying}
457
457
  <Loader2 class="h-3.5 w-3.5 animate-spin" />
458
- <span>{chinese ? '联签核验中...' : 'Verifying...'}</span>
458
+ <span>{chinese ? '联签核验中…' : 'Verifying…'}</span>
459
459
  {:else}
460
460
  <ShieldCheck class="h-3.5 w-3.5" />
461
461
  <span>{chinese ? '确认双人联签' : 'Dual Approve'}</span>
@@ -471,7 +471,7 @@
471
471
  >
472
472
  {#if isVerifying}
473
473
  <Loader2 class="h-3.5 w-3.5 animate-spin" />
474
- <span>{chinese ? '创建复核请求中...' : 'Creating review request...'}</span>
474
+ <span>{chinese ? '创建复核请求中…' : 'Creating review request…'}</span>
475
475
  {:else}
476
476
  <QrCode class="h-3.5 w-3.5" />
477
477
  <span>{chinese ? '请求远程复核' : 'Request Remote Review'}</span>
@@ -137,6 +137,6 @@
137
137
  {#if children}
138
138
  {@render children()}
139
139
  {:else}
140
- <span>{loading ? '正在导出...' : i18n.t('excel.export')}</span>
140
+ <span>{loading ? '正在导出…' : i18n.t('excel.export')}</span>
141
141
  {/if}
142
142
  </button>
@@ -561,7 +561,7 @@
561
561
  class="inline-flex items-center gap-1.5 px-4 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 cursor-pointer"
562
562
  onclick={handleConfirmImport}
563
563
  >
564
- <span>{isSubmitting ? '正在提交...' : i18n.t('excel.startImport')}</span>
564
+ <span>{isSubmitting ? '正在提交…' : i18n.t('excel.startImport')}</span>
565
565
  <Check size={14} />
566
566
  </button>
567
567
  {/if}
@@ -140,19 +140,16 @@
140
140
  </script>
141
141
 
142
142
  <div
143
- class="space-y-1.5"
143
+ class="svadmin-field"
144
144
  data-svadmin-field
145
145
  data-svadmin-field-key={field.key}
146
146
  >
147
147
  <Label {...definedOptions({ for: !children && (['array', 'transfer'].includes(field.type) || field.type === 'richtext' && getRichTextEditor()) ? undefined : labelTarget })} id={labelId} data-svadmin-field-label>
148
- {field.label}
149
148
  {#if field.required}
150
- <span class="text-destructive" data-svadmin-required>*</span>
149
+ <span class="text-destructive" data-svadmin-required aria-hidden="true">*</span>
151
150
  {/if}
151
+ {field.label}
152
152
  </Label>
153
- {#if field.description}
154
- <p id={descriptionId} data-svadmin-field-description class="text-xs text-muted-foreground">{field.description}</p>
155
- {/if}
156
153
 
157
154
  {#if children}
158
155
  {@render children()}
@@ -694,4 +691,7 @@
694
691
  {disabled}
695
692
  />
696
693
  {/if}
694
+ {#if field.description}
695
+ <p id={descriptionId} data-svadmin-field-description class="svadmin-field-help text-xs text-muted-foreground">{field.description}</p>
696
+ {/if}
697
697
  </div>
@@ -31,6 +31,8 @@
31
31
  cancelUpload?: UploadCancelHandler | undefined;
32
32
  onChange?: ((items: UploadItem[]) => void) | undefined;
33
33
  onReject?: ((file: File, reason: string) => void) | undefined;
34
+ /** 返回 false 时不移除。异步检查完成前文件仍留在列表里。 */
35
+ beforeRemove?: ((item: UploadItem) => boolean | Promise<boolean>) | undefined;
34
36
  class?: string | undefined;
35
37
  }
36
38
 
@@ -50,6 +52,7 @@
50
52
  cancelUpload,
51
53
  onChange,
52
54
  onReject,
55
+ beforeRemove,
53
56
  class: className = '',
54
57
  }: Props = $props();
55
58
 
@@ -359,11 +362,17 @@
359
362
  if (upload) target.value = '';
360
363
  }
361
364
 
362
- function remove(id: string): void {
365
+ async function remove(id: string): Promise<void> {
363
366
  if (disabled) return;
367
+ const item = items.find(entry => entry.id === id);
368
+ if (!item) return;
369
+ if (beforeRemove) {
370
+ const allowed = await beforeRemove(item);
371
+ if (!allowed || disabled || !items.some(entry => entry.id === id)) return;
372
+ }
364
373
  retire(id, 'remove');
365
374
  latestAttempts.delete(id);
366
- items = items.filter(item => item.id !== id);
375
+ items = items.filter(entry => entry.id !== id);
367
376
  if (input && upload) input.value = '';
368
377
  emitChange();
369
378
  }
@@ -16,6 +16,8 @@ interface Props {
16
16
  cancelUpload?: UploadCancelHandler | undefined;
17
17
  onChange?: ((items: UploadItem[]) => void) | undefined;
18
18
  onReject?: ((file: File, reason: string) => void) | undefined;
19
+ /** 返回 false 时不移除。异步检查完成前文件仍留在列表里。 */
20
+ beforeRemove?: ((item: UploadItem) => boolean | Promise<boolean>) | undefined;
19
21
  class?: string | undefined;
20
22
  }
21
23
  declare const FileUpload: import("svelte").Component<Props, {}, "">;
@@ -34,7 +34,7 @@
34
34
  active,
35
35
  value = $bindable(undefined),
36
36
  options,
37
- placeholder = 'Search...',
37
+ placeholder = 'Search…',
38
38
  applyLabel = 'Apply',
39
39
  resetLabel = 'Reset',
40
40
  align = 'right',
@@ -199,7 +199,7 @@
199
199
  <Search class="absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" />
200
200
  <Input
201
201
  bind:value={optionSearch}
202
- placeholder="Search options..."
202
+ placeholder="Search options…"
203
203
  class="h-7 pl-7 text-xs"
204
204
  />
205
205
  </div>
@@ -153,7 +153,7 @@
153
153
  if (preset) applyPreset(preset);
154
154
  }}
155
155
  >
156
- <option value="">常用视图预设...</option>
156
+ <option value="">常用视图预设…</option>
157
157
  {#each savedPresets as p (p.id)}
158
158
  <option value={p.id}>{p.name} ({p.filters.length} 项)</option>
159
159
  {/each}
@@ -173,7 +173,7 @@
173
173
  <input
174
174
  type="text"
175
175
  bind:value={query}
176
- placeholder="搜索快捷键..."
176
+ placeholder="搜索快捷键…"
177
177
  class="flex h-9 w-full rounded-md border border-input bg-background pl-9 pr-3 py-1 text-sm shadow-2xs placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring"
178
178
  />
179
179
  </div>
@@ -109,7 +109,7 @@
109
109
  type="text"
110
110
  class="w-full bg-transparent outline-none text-foreground text-xs"
111
111
  bind:value={secretKey}
112
- placeholder="请输入密钥..."
112
+ placeholder="请输入密钥…"
113
113
  />
114
114
  </div>
115
115
  </div>
@@ -178,7 +178,7 @@
178
178
  type="text"
179
179
  class="flex-1 rounded-md border border-input bg-background px-3 py-1.5 text-xs text-foreground outline-none focus:ring-1 focus:ring-primary"
180
180
  bind:value={expectedSignature}
181
- placeholder="例如粘贴 X-Svadmin-Signature 标头值..."
181
+ placeholder="例如粘贴 X-Svadmin-Signature 标头值…"
182
182
  />
183
183
 
184
184
  {#if isMatched !== null}
@@ -165,7 +165,7 @@
165
165
  <input
166
166
  type="text"
167
167
  bind:value={query}
168
- placeholder={chinese ? '检索词条 Key 或文本...' : 'Search keys or text...'}
168
+ placeholder={chinese ? '检索词条 Key 或文本…' : 'Search keys or text…'}
169
169
  class="h-7.5 w-full rounded-md border border-input bg-background pl-8 pr-2.5 text-xs focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
170
170
  />
171
171
  </div>
@@ -229,7 +229,7 @@
229
229
  >
230
230
  {#if isSubmitting}
231
231
  <Loader2 class="h-3.5 w-3.5 animate-spin" />
232
- <span>正在入库提交...</span>
232
+ <span>正在入库提交…</span>
233
233
  {:else}
234
234
  <span>确认导入 ({validCount} 条正常数据)</span>
235
235
  <ArrowRight class="h-3.5 w-3.5" />
@@ -854,7 +854,7 @@
854
854
  <div class="space-y-5 py-2">
855
855
  <div class="space-y-2">
856
856
  <div class="flex items-center justify-between text-xs">
857
- <span class="text-muted-foreground">{cancelled ? i18n.t('import.stopped') : isImporting ? i18n.t('common.importing', { defaultValue: 'Importing...' }) : importError ? i18n.t('common.operationFailed', { defaultValue: 'Import failed' }) : i18n.t('common.completed', { defaultValue: 'Completed' })}</span>
857
+ <span class="text-muted-foreground">{cancelled ? i18n.t('import.stopped') : isImporting ? i18n.t('common.importing', { defaultValue: 'Importing…' }) : importError ? i18n.t('common.operationFailed', { defaultValue: 'Import failed' }) : i18n.t('common.completed', { defaultValue: 'Completed' })}</span>
858
858
  {#if !cancelled}<span class="font-semibold text-foreground tabular-nums">{progressPercent}%</span>{/if}
859
859
  </div>
860
860
  {#if !cancelled}<Progress value={progressPercent} class="h-2" />{/if}
@@ -904,7 +904,7 @@
904
904
  <Button variant="outline" size="sm" onclick={cancelImport}>{i18n.t('common.cancel')}</Button>
905
905
  <Button size="sm" disabled class="gap-2">
906
906
  <Loader2 class="h-3.5 w-3.5 animate-spin" />
907
- {i18n.t('common.processing', { defaultValue: 'Processing...' })}
907
+ {i18n.t('common.processing', { defaultValue: 'Processing…' })}
908
908
  </Button>
909
909
  {/if}
910
910
  </div>
@@ -181,7 +181,7 @@
181
181
  <input
182
182
  type="text"
183
183
  bind:value={newNoteText}
184
- placeholder={chinese ? '同步应急进展或处置备注...' : 'Add progress note...'}
184
+ placeholder={chinese ? '同步应急进展或处置备注…' : 'Add progress note…'}
185
185
  class="h-8.5 flex-1 rounded-md border border-input bg-background px-3 text-xs focus-visible:outline-none"
186
186
  />
187
187
  <Button size="sm" onclick={handleSendNote} disabled={!newNoteText.trim()} class="h-8.5 px-3 gap-1">
@@ -149,7 +149,7 @@
149
149
  <Button type="button" variant="ghost" size="icon-sm" disabled={saving} title={i18n.t('common.save')}
150
150
  aria-label={i18n.t('common.save')} aria-busy={saving} onclick={save}>
151
151
  {#if saving}
152
- <Loader2 class="h-4 w-4 animate-spin" role="status" aria-label="Saving..." />
152
+ <Loader2 class="h-4 w-4 animate-spin" role="status" aria-label="Saving…" />
153
153
  {:else}
154
154
  <Check class="h-4 w-4" />
155
155
  {/if}
@@ -130,7 +130,7 @@
130
130
  <input
131
131
  type="text"
132
132
  bind:value={searchQuery}
133
- placeholder="搜索 Key 或 Value..."
133
+ placeholder="搜索 Key 或 Value…"
134
134
  class="w-full pl-8 pr-2.5 py-1 text-xs rounded-md border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-2 focus:outline-primary"
135
135
  />
136
136
  </div>
@@ -280,7 +280,7 @@
280
280
  bind:this={searchInputRef}
281
281
  type="text"
282
282
  bind:value={query}
283
- placeholder={chinese ? '搜索快捷键名称、描述或按键 (如 Mod+S, J/K)...' : 'Search shortcuts by action, category, or key...'}
283
+ placeholder={chinese ? '搜索快捷键名称、描述或按键 (如 Mod+S, J/K)…' : 'Search shortcuts by action, category, or key…'}
284
284
  class="flex h-9 w-full rounded-lg border border-input bg-background pl-9 pr-3 py-1 text-sm shadow-2xs placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
285
285
  />
286
286
  {#if query}
@@ -2,6 +2,7 @@
2
2
  import type { Snippet } from 'svelte';
3
3
  import { AlertTriangle, AlertCircle } from '@lucide/svelte';
4
4
  import TrendIndicator from './TrendIndicator.svelte';
5
+ import { formatAdminNumber } from '@svadmin/core';
5
6
  import { cn } from '../utils.js';
6
7
 
7
8
  export interface KpiCardProps {
@@ -64,7 +65,7 @@
64
65
 
65
66
  const formattedValue = $derived.by(() => {
66
67
  if (typeof value === 'number') {
67
- return value.toLocaleString('en-US');
68
+ return formatAdminNumber(value, 'en-US');
68
69
  }
69
70
  return String(value);
70
71
  });
@@ -35,7 +35,7 @@
35
35
 
36
36
  {#await pagePromise}
37
37
  <div class="flex min-h-40 items-center justify-center" role="status" aria-live="polite">
38
- <span class="text-sm text-muted-foreground">Loading...</span>
38
+ <span class="text-sm text-muted-foreground">Loading…</span>
39
39
  </div>
40
40
  {:then pageModule}
41
41
  {@const Page = pageModule.default as unknown as Component<Record<string, unknown>>}
@@ -17,7 +17,7 @@
17
17
 
18
18
  const statusConfigs = {
19
19
  connected: { variant: 'default' as const, dotClass: 'bg-success', label: 'Live', icon: Wifi },
20
- connecting: { variant: 'secondary' as const, dotClass: 'bg-warning', label: 'Connecting...', icon: Loader2 as typeof Wifi },
20
+ connecting: { variant: 'secondary' as const, dotClass: 'bg-warning', label: 'Connecting…', icon: Loader2 as typeof Wifi },
21
21
  disconnected: { variant: 'destructive' as const, dotClass: 'bg-destructive', label: 'Offline', icon: WifiOff },
22
22
  } as const;
23
23
  type StatusKey = 'connected' | 'connecting' | 'disconnected';
@@ -108,7 +108,7 @@
108
108
  <Search class="h-3 w-3 absolute left-2 text-muted-foreground pointer-events-none" />
109
109
  <input
110
110
  type="text"
111
- placeholder="关键词匹配..."
111
+ placeholder="关键词匹配…"
112
112
  bind:value={searchQuery}
113
113
  class="h-7 w-32 md:w-44 rounded-md border border-border bg-background pl-6 pr-2 text-xs text-foreground outline-none focus:border-primary"
114
114
  />
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { onMount, onDestroy, type Snippet } from 'svelte';
3
3
  import { Lock, Unlock, Eye, EyeOff, ShieldCheck, Clock } from '@lucide/svelte';
4
- import { useTranslation } from '@svadmin/core';
4
+ import { formatAdminDate, useTranslation } from '@svadmin/core';
5
5
  import { cn } from '../utils.js';
6
6
  import MediaThumbnail from './content/MediaThumbnail.svelte';
7
7
 
@@ -54,12 +54,12 @@
54
54
  const seconds = String(now.getSeconds()).padStart(2, '0');
55
55
  currentTime = `${hours}:${minutes}:${seconds}`;
56
56
 
57
- const options: Intl.DateTimeFormatOptions = {
57
+ currentDate = formatAdminDate(now, {
58
+ locale: i18n.locale === 'zh-CN' ? 'zh-CN' : 'en-US',
58
59
  month: 'long',
59
60
  day: 'numeric',
60
61
  weekday: 'long',
61
- };
62
- currentDate = now.toLocaleDateString(i18n.locale === 'zh-CN' ? 'zh-CN' : 'en-US', options);
62
+ });
63
63
  }
64
64
 
65
65
  // 自动空闲超时检测
@@ -56,7 +56,7 @@
56
56
  <input
57
57
  type="text"
58
58
  bind:value={searchQuery}
59
- placeholder="Search items..."
59
+ placeholder="Search items…"
60
60
  class="h-8 w-full rounded-md border border-input bg-background pl-8 pr-2 text-xs focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
61
61
  />
62
62
  </div>
@@ -137,7 +137,7 @@
137
137
  <input
138
138
  type="text"
139
139
  bind:value={searchQuery}
140
- placeholder={chinese ? '筛选明细...' : 'Search items...'}
140
+ placeholder={chinese ? '筛选明细…' : 'Search items…'}
141
141
  class="h-7 w-40 rounded border border-input bg-background pl-7.5 pr-2 text-xs focus-visible:outline-none"
142
142
  />
143
143
  </div>
@@ -25,7 +25,7 @@
25
25
 
26
26
  let {
27
27
  value = $bindable(''),
28
- placeholder = 'Type @ to mention team members, or # to link tags...',
28
+ placeholder = 'Type @ to mention team members, or # to link tags…',
29
29
  triggers = ['@', '#'],
30
30
  users = [],
31
31
  tags = [],
@@ -245,7 +245,7 @@
245
245
  data-svadmin-frame-loading="true"
246
246
  >
247
247
  <Loader2 class="h-7 w-7 animate-spin text-primary mb-2" />
248
- <span class="text-xs text-muted-foreground font-medium">Connecting micro application...</span>
248
+ <span class="text-xs text-muted-foreground font-medium">Connecting micro application…</span>
249
249
  </div>
250
250
  {/if}
251
251
 
@@ -149,7 +149,7 @@
149
149
  <!-- 加载过渡态骨架 -->
150
150
  <div class="p-6 flex flex-col items-center justify-center gap-3 text-muted-foreground">
151
151
  <Activity class="w-8 h-8 text-primary animate-spin" />
152
- <div class="text-xs">正在向子应用注入登录令牌与安全样式表...</div>
152
+ <div class="text-xs">正在向子应用注入登录令牌与安全样式表…</div>
153
153
  </div>
154
154
  {:else if status === 'error'}
155
155
  <!-- 异常崩溃容灾降级面板 -->
@@ -269,7 +269,7 @@
269
269
  class="w-full rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50"
270
270
  onclick={() => runTest(currentRule)}
271
271
  >
272
- {isTesting ? '正在模拟请求与网络延迟...' : '立即发起模拟请求验证'}
272
+ {isTesting ? '正在模拟请求与网络延迟…' : '立即发起模拟请求验证'}
273
273
  </button>
274
274
 
275
275
  {#if testStatus !== null}
@@ -35,7 +35,7 @@
35
35
  triggerSize = 'sm',
36
36
  submitText = 'Confirm',
37
37
  cancelText = 'Cancel',
38
- widthClass = 'sm:max-w-lg',
38
+ widthClass = '',
39
39
  isSubmitting = false,
40
40
  disabled = false,
41
41
  onsubmit,
@@ -106,7 +106,8 @@
106
106
  open = false;
107
107
  } catch {
108
108
  if (!isCurrentRequest(token)) return;
109
- submitError = i18n.t('common.operationFailed');
109
+ // 失败原因用固定文案,不把异常原文写进界面。
110
+ submitError = i18n.t('common.submitRejected');
110
111
  } finally {
111
112
  if (activeRequest === token) {
112
113
  activeRequest = undefined;
@@ -153,8 +154,8 @@
153
154
  </Dialog.Trigger>
154
155
  {/if}
155
156
 
156
- <Dialog.Content class={cn(widthClass, 'max-h-[90vh] overflow-y-auto', className)}>
157
- <form bind:this={formElement} onsubmit={handleSubmit} aria-busy={busy} class="space-y-4">
157
+ <Dialog.Content closeOnOverlayClick={false} size="md" loading={busy} class={cn('svadmin-dialog-form', widthClass, className)}>
158
+ <form bind:this={formElement} onsubmit={handleSubmit} aria-busy={busy} class="svadmin-dialog-form__body">
158
159
  <Dialog.Header>
159
160
  <Dialog.Title>{title}</Dialog.Title>
160
161
  {#if description}
@@ -162,11 +163,10 @@
162
163
  {/if}
163
164
  </Dialog.Header>
164
165
 
165
- {#if submitError}
166
- <FeedbackNotice tone="danger" message={submitError} />
167
- {/if}
168
-
169
- <div class="py-2 text-sm text-foreground">
166
+ <div class="svadmin-dialog-body">
167
+ {#if submitError}
168
+ <FeedbackNotice tone="danger" message={submitError} />
169
+ {/if}
170
170
  {#if children}
171
171
  {@render children()}
172
172
  {/if}
@@ -18,6 +18,6 @@
18
18
  <div class="flex h-screen w-screen items-center justify-center p-4 text-muted-foreground">
19
19
  <div class="text-center">
20
20
  <div class="mb-4 inline-block h-8 w-8 animate-spin rounded-full border-4 border-primary border-r-transparent"></div>
21
- <p>Navigating to default resource...</p>
21
+ <p>Navigating to default resource…</p>
22
22
  </div>
23
23
  </div>
@@ -3,6 +3,7 @@
3
3
  import { Bell, CheckCheck } from '@lucide/svelte';
4
4
  import { Button } from './ui/button/index.js';
5
5
  import * as Popover from './ui/popover/index.js';
6
+ import { formatAdminTime } from '@svadmin/core';
6
7
  import { cn } from '../utils.js';
7
8
 
8
9
  export interface NotificationItem {
@@ -69,7 +70,7 @@
69
70
  if (!value) return '';
70
71
  const date = value instanceof Date ? value : new Date(value);
71
72
  if (Number.isNaN(date.getTime())) return String(value);
72
- return new Intl.DateTimeFormat(undefined, { dateStyle: 'medium', timeStyle: 'short' }).format(date);
73
+ return formatAdminTime(date, { dateStyle: 'medium', seconds: false });
73
74
  }
74
75
 
75
76
  async function read(item: NotificationItem): Promise<void> {
@@ -127,7 +127,7 @@
127
127
  onclick={triggerSync}
128
128
  >
129
129
  <RefreshCw class={cn('h-3 w-3', isSyncing ? 'animate-spin' : '')} />
130
- {isSyncing ? 'Syncing...' : 'Sync Now'}
130
+ {isSyncing ? 'Syncing…' : 'Sync Now'}
131
131
  </Button>
132
132
  {/if}
133
133
  </div>
@@ -40,7 +40,7 @@
40
40
  let {
41
41
  open = $bindable(false),
42
42
  shortcutKey = 'k',
43
- placeholder = '输入命令、查找页面或搜索实体资源... (⌘K)',
43
+ placeholder = '输入命令、查找页面或搜索实体资源… (⌘K)',
44
44
  emptyText = '未找到匹配的命令或资源',
45
45
  items = [
46
46
  { id: 'nav-dashboard', title: '运营与财务仪表盘', category: 'navigation', categoryLabel: '系统导航', description: '高管大屏与实时多维指标看板', shortcut: 'G D' },
@@ -154,7 +154,7 @@
154
154
  <input
155
155
  type="text"
156
156
  bind:value={searchQuery}
157
- placeholder="搜索明细内容..."
157
+ placeholder="搜索明细内容…"
158
158
  class="h-8 w-full rounded-md border border-input bg-background pl-8 pr-3 text-xs placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring"
159
159
  />
160
160
  </div>
@@ -3,12 +3,14 @@
3
3
  import { CircleAlert } from "@lucide/svelte";
4
4
  import Button from "./ui/button/button.svelte";
5
5
  import * as Popover from "./ui/popover/index.js";
6
+ import * as Dialog from "./ui/dialog/index.js";
6
7
 
7
8
  let {
8
9
  title,
9
10
  okText = "确定",
10
11
  cancelText = "取消",
11
12
  okType = "primary",
13
+ risk = "light",
12
14
  icon,
13
15
  onConfirm,
14
16
  children,
@@ -17,32 +19,71 @@
17
19
  okText?: string;
18
20
  cancelText?: string;
19
21
  okType?: "primary" | "danger";
22
+ /**
23
+ * light:频繁的轻确认,仍用气泡,宽度不超过 320px。
24
+ * irreversible:有风险或不可逆,改成对话框,不再弹出气泡。
25
+ */
26
+ risk?: "light" | "irreversible";
20
27
  icon?: Snippet;
21
28
  onConfirm?: () => void;
22
29
  children: Snippet;
23
30
  } = $props();
24
31
 
25
32
  let open = $state(false);
33
+
34
+ function confirm() {
35
+ onConfirm?.();
36
+ open = false;
37
+ }
26
38
  </script>
27
39
 
28
- <Popover.Root bind:open>
29
- <Popover.Trigger>
30
- {#snippet child({ props })}
31
- <span class="svadmin-popconfirm__trigger" {...props}>{@render children()}</span>
32
- {/snippet}
33
- </Popover.Trigger>
34
- <Popover.Content class="svadmin-popconfirm" sideOffset={8}>
35
- <div class="flex items-start gap-2">
36
- {#if icon}
37
- {@render icon()}
38
- {:else}
39
- <CircleAlert class="mt-0.5 size-4 shrink-0 text-warning" aria-hidden="true" />
40
- {/if}
41
- <p class="svadmin-popconfirm__title leading-5">{title}</p>
42
- </div>
43
- <div class="svadmin-popconfirm__actions">
44
- <Button type="button" variant="outline" size="xs" onclick={() => (open = false)}>{cancelText}</Button>
45
- <Button type="button" variant={okType === "danger" ? "destructive" : "default"} size="xs" onclick={() => { onConfirm?.(); open = false; }}>{okText}</Button>
46
- </div>
47
- </Popover.Content>
48
- </Popover.Root>
40
+ {#if risk === "irreversible"}
41
+ <Dialog.Root bind:open>
42
+ <Dialog.Trigger>
43
+ {#snippet child({ props })}
44
+ <span class="svadmin-popconfirm__trigger" {...props}>{@render children()}</span>
45
+ {/snippet}
46
+ </Dialog.Trigger>
47
+ <Dialog.Content size="sm" closeOnOverlayClick={true} data-confirm-weight="irreversible">
48
+ <Dialog.Header>
49
+ <Dialog.Title>{title}</Dialog.Title>
50
+ </Dialog.Header>
51
+ <div class="svadmin-dialog-body">
52
+ <div class="flex items-start gap-2">
53
+ {#if icon}
54
+ {@render icon()}
55
+ {:else}
56
+ <CircleAlert class="mt-0.5 size-4 shrink-0 text-warning" aria-hidden="true" />
57
+ {/if}
58
+ <p class="leading-5">{title}</p>
59
+ </div>
60
+ </div>
61
+ <Dialog.Footer>
62
+ <Button type="button" variant="outline" size="sm" onclick={() => (open = false)}>{cancelText}</Button>
63
+ <Button type="button" variant={okType === "danger" ? "destructive" : "default"} size="sm" onclick={confirm}>{okText}</Button>
64
+ </Dialog.Footer>
65
+ </Dialog.Content>
66
+ </Dialog.Root>
67
+ {:else}
68
+ <Popover.Root bind:open>
69
+ <Popover.Trigger>
70
+ {#snippet child({ props })}
71
+ <span class="svadmin-popconfirm__trigger" {...props}>{@render children()}</span>
72
+ {/snippet}
73
+ </Popover.Trigger>
74
+ <Popover.Content class="svadmin-popconfirm" data-confirm-weight="light" sideOffset={8}>
75
+ <div class="flex items-start gap-2">
76
+ {#if icon}
77
+ {@render icon()}
78
+ {:else}
79
+ <CircleAlert class="mt-0.5 size-4 shrink-0 text-warning" aria-hidden="true" />
80
+ {/if}
81
+ <p class="svadmin-popconfirm__title leading-5">{title}</p>
82
+ </div>
83
+ <div class="svadmin-popconfirm__actions">
84
+ <Button type="button" variant="outline" size="xs" onclick={() => (open = false)}>{cancelText}</Button>
85
+ <Button type="button" variant={okType === "danger" ? "destructive" : "default"} size="xs" onclick={confirm}>{okText}</Button>
86
+ </div>
87
+ </Popover.Content>
88
+ </Popover.Root>
89
+ {/if}
@@ -4,6 +4,11 @@ type $$ComponentProps = {
4
4
  okText?: string;
5
5
  cancelText?: string;
6
6
  okType?: "primary" | "danger";
7
+ /**
8
+ * light:频繁的轻确认,仍用气泡,宽度不超过 320px。
9
+ * irreversible:有风险或不可逆,改成对话框,不再弹出气泡。
10
+ */
11
+ risk?: "light" | "irreversible";
7
12
  icon?: Snippet;
8
13
  onConfirm?: () => void;
9
14
  children: Snippet;
@@ -427,7 +427,7 @@
427
427
  class="rounded border border-input bg-background px-2.5 py-1 text-xs text-foreground focus:ring-1 focus:ring-primary min-w-[160px] flex-1"
428
428
  bind:value={item.value}
429
429
  oninput={notifyChange}
430
- placeholder="输入匹配内容..."
430
+ placeholder="输入匹配内容…"
431
431
  disabled={readOnly}
432
432
  />
433
433
  {/if}