@svadmin/ui 0.118.0 → 0.119.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 +198 -52
- package/dist/app.theme.css +198 -52
- package/dist/components/AboutSettings.svelte +1 -1
- package/dist/components/AuditLogDrawer.svelte +165 -55
- package/dist/components/AuditLogDrawer.svelte.d.ts +4 -2
- package/dist/components/Authenticated.svelte +2 -2
- package/dist/components/AutoSaveIndicator.svelte +2 -2
- package/dist/components/AutoTable.svelte +1 -1
- package/dist/components/Breadcrumbs.svelte +1 -1
- package/dist/components/Breadcrumbs.svelte.d.ts +1 -1
- package/dist/components/CanAccess.svelte +2 -2
- package/dist/components/CancelTaskButton.svelte +2 -2
- package/dist/components/Cascader.svelte +19 -19
- package/dist/components/Cascader.svelte.d.ts +19 -19
- package/dist/components/ColorPicker.svelte +9 -9
- package/dist/components/ColorPicker.svelte.d.ts +9 -9
- package/dist/components/ComboboxField.svelte +15 -15
- package/dist/components/ComboboxField.svelte.d.ts +15 -15
- package/dist/components/ConcurrentConflictModal.svelte +292 -0
- package/dist/components/ConcurrentConflictModal.svelte.d.ts +24 -0
- package/dist/components/ConfigErrorScreen.svelte +2 -2
- package/dist/components/ConfirmDialog.svelte +6 -4
- package/dist/components/ConfirmDialog.svelte.d.ts +2 -2
- package/dist/components/CronExpressionBuilder.svelte +389 -0
- package/dist/components/CronExpressionBuilder.svelte.d.ts +20 -0
- package/dist/components/DateRangeInput.svelte +22 -22
- package/dist/components/DateRangeInput.svelte.d.ts +22 -22
- package/dist/components/DateTimeInput.svelte +2 -2
- package/dist/components/DateTimeInput.svelte.d.ts +2 -2
- package/dist/components/EmptyState.svelte +2 -2
- package/dist/components/ErrorComponent.svelte +2 -2
- package/dist/components/ErrorSummary.svelte +2 -2
- package/dist/components/FieldRenderer.svelte +3 -3
- package/dist/components/FileUpload.svelte +16 -16
- package/dist/components/FileUpload.svelte.d.ts +16 -16
- package/dist/components/FileUploadField.svelte +7 -7
- package/dist/components/FileUploadField.svelte.d.ts +7 -7
- package/dist/components/FilterDropdown.svelte.d.ts +1 -1
- package/dist/components/ForgotPasswordPage.svelte +2 -2
- package/dist/components/Header.svelte +2 -2
- package/dist/components/LiveIndicator.svelte +2 -2
- package/dist/components/LoginPage.svelte +2 -2
- package/dist/components/MetricGrid.svelte +163 -0
- package/dist/components/MetricGrid.svelte.d.ts +39 -0
- package/dist/components/MicroAppFrame.svelte +290 -0
- package/dist/components/MicroAppFrame.svelte.d.ts +36 -0
- package/dist/components/MoneyInput.svelte +15 -15
- package/dist/components/MoneyInput.svelte.d.ts +15 -15
- package/dist/components/NotificationCenter.svelte +16 -16
- package/dist/components/NotificationCenter.svelte.d.ts +16 -16
- package/dist/components/NumberInput.svelte +13 -13
- package/dist/components/NumberInput.svelte.d.ts +13 -13
- package/dist/components/NumericInput.svelte +16 -16
- package/dist/components/NumericInput.svelte.d.ts +16 -16
- package/dist/components/OfflineGuard.svelte +65 -0
- package/dist/components/OfflineGuard.svelte.d.ts +15 -0
- package/dist/components/OrgChart.svelte +171 -0
- package/dist/components/OrgChart.svelte.d.ts +26 -0
- package/dist/components/PageSkeleton.svelte +2 -2
- package/dist/components/PercentInput.svelte +14 -14
- package/dist/components/PercentInput.svelte.d.ts +14 -14
- package/dist/components/PresenceAvatarGroup.svelte +78 -29
- package/dist/components/PresenceAvatarGroup.svelte.d.ts +14 -8
- package/dist/components/Rate.svelte +9 -9
- package/dist/components/Rate.svelte.d.ts +9 -9
- package/dist/components/RegisterPage.svelte +2 -2
- package/dist/components/ResizeBox.svelte.d.ts +1 -1
- package/dist/components/RetryTaskButton.svelte +2 -2
- package/dist/components/SafeDeleteConfirm.svelte +301 -0
- package/dist/components/SafeDeleteConfirm.svelte.d.ts +24 -0
- package/dist/components/SignaturePad.svelte +19 -3
- package/dist/components/SignaturePad.svelte.d.ts +3 -0
- package/dist/components/SliderCaptcha.svelte +448 -0
- package/dist/components/SliderCaptcha.svelte.d.ts +26 -0
- package/dist/components/TagsInput.svelte +10 -10
- package/dist/components/TagsInput.svelte.d.ts +10 -10
- package/dist/components/TaskCenter.svelte +450 -0
- package/dist/components/TaskCenter.svelte.d.ts +37 -0
- package/dist/components/TaskDetails.svelte +2 -2
- package/dist/components/TaskList.svelte +2 -2
- package/dist/components/TaskProgressBar.svelte +2 -2
- package/dist/components/TaskStatusBadge.svelte +2 -2
- package/dist/components/ThemedTitle.svelte +2 -2
- package/dist/components/Tour.svelte +9 -1
- package/dist/components/Tour.svelte.d.ts +2 -1
- package/dist/components/Transfer.svelte +11 -11
- package/dist/components/Transfer.svelte.d.ts +11 -11
- package/dist/components/TreeSelect.svelte +17 -17
- package/dist/components/TreeSelect.svelte.d.ts +17 -17
- package/dist/components/TreeTable.svelte.d.ts +1 -1
- package/dist/components/TrendIndicator.svelte +177 -0
- package/dist/components/TrendIndicator.svelte.d.ts +27 -0
- package/dist/components/UndoableNotification.svelte +2 -2
- package/dist/components/UpdatePasswordPage.svelte +2 -2
- package/dist/components/VirtualTreeSelect.svelte +431 -0
- package/dist/components/VirtualTreeSelect.svelte.d.ts +34 -0
- package/dist/components/buttons/CreateButton.svelte +2 -2
- package/dist/components/buttons/ExportButton.svelte +2 -2
- package/dist/components/buttons/ListButton.svelte +2 -2
- package/dist/components/buttons/RefreshButton.svelte +2 -2
- package/dist/components/buttons/SaveButton.svelte +2 -2
- package/dist/components/charts/GaugeChart.svelte +452 -57
- package/dist/components/charts/GaugeChart.svelte.d.ts +61 -10
- package/dist/components/content/AuditTimeline.svelte +125 -28
- package/dist/components/content/AuditTimeline.svelte.d.ts +30 -16
- package/dist/components/fields/JsonField.svelte +2 -2
- package/dist/components/fields/MultiSelectField.svelte +2 -2
- package/dist/components/fields/RelationField.svelte +2 -2
- package/dist/components/fields/RichTextField.svelte +2 -2
- package/dist/components/fields/SelectField.svelte +2 -2
- package/dist/components/list-state.svelte.d.ts +1 -1
- package/dist/components/ui/checkbox/checkbox.svelte.d.ts +1 -1
- package/dist/components/ui/command/command-dialog.svelte.d.ts +1 -1
- package/dist/components/ui/command/index.d.ts +1 -1
- package/dist/components/ui/input/input.svelte.d.ts +1 -1
- package/dist/components/ui/switch/switch.svelte.d.ts +1 -1
- package/dist/components/useNetworkStatus.d.svelte.ts +1 -0
- package/dist/components/useNetworkStatus.svelte.d.ts +30 -0
- package/dist/components/useNetworkStatus.svelte.js +74 -0
- package/dist/design-system.d.ts +4 -4
- package/dist/index.d.ts +31 -5
- package/dist/index.js +23 -3
- package/dist/recipes.d.ts +91 -619
- package/package.json +30 -30
|
@@ -1,20 +1,37 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import type { Status } from './StatusBadge.svelte';
|
|
3
3
|
|
|
4
|
+
export interface AuditFieldChange {
|
|
5
|
+
field: string;
|
|
6
|
+
label?: string | undefined;
|
|
7
|
+
oldValue?: unknown;
|
|
8
|
+
newValue?: unknown;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface AuditActor {
|
|
12
|
+
name?: string | undefined;
|
|
13
|
+
avatar?: string | undefined;
|
|
14
|
+
id?: string | undefined;
|
|
15
|
+
ip?: string | undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
4
18
|
export interface TimelineItem {
|
|
5
19
|
id: string;
|
|
6
20
|
title: string;
|
|
7
|
-
description?: string;
|
|
8
|
-
timestamp?: string;
|
|
9
|
-
actor?: string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
21
|
+
description?: string | undefined;
|
|
22
|
+
timestamp?: string | number | undefined;
|
|
23
|
+
actor?: AuditActor | string | undefined;
|
|
24
|
+
action?: string | undefined;
|
|
25
|
+
status?: Status | undefined;
|
|
26
|
+
tag?: string | undefined;
|
|
27
|
+
changes?: AuditFieldChange[] | undefined;
|
|
28
|
+
meta?: Record<string, unknown> | undefined;
|
|
13
29
|
}
|
|
14
30
|
</script>
|
|
15
31
|
|
|
16
32
|
<script lang="ts">
|
|
17
33
|
import type { Snippet } from 'svelte';
|
|
34
|
+
import { ArrowRight, Globe } from '@lucide/svelte';
|
|
18
35
|
import { definedOptions } from '@svadmin/core/options';
|
|
19
36
|
import { useTranslation } from '@svadmin/core/i18n';
|
|
20
37
|
import { cn } from '../../utils.js';
|
|
@@ -24,16 +41,16 @@
|
|
|
24
41
|
|
|
25
42
|
interface Props {
|
|
26
43
|
items?: TimelineItem[];
|
|
27
|
-
emptyTitle?: string;
|
|
28
|
-
emptyDescription?: string;
|
|
29
|
-
state?: BlockingDataStateKind;
|
|
30
|
-
stateTitle?: string;
|
|
31
|
-
stateDescription?: string;
|
|
32
|
-
retry?: () => void;
|
|
33
|
-
retryLabel?: string;
|
|
34
|
-
loadingLabel?: string;
|
|
35
|
-
action?: Snippet;
|
|
36
|
-
class?: string;
|
|
44
|
+
emptyTitle?: string | undefined;
|
|
45
|
+
emptyDescription?: string | undefined;
|
|
46
|
+
state?: BlockingDataStateKind | undefined;
|
|
47
|
+
stateTitle?: string | undefined;
|
|
48
|
+
stateDescription?: string | undefined;
|
|
49
|
+
retry?: (() => void) | undefined;
|
|
50
|
+
retryLabel?: string | undefined;
|
|
51
|
+
loadingLabel?: string | undefined;
|
|
52
|
+
action?: Snippet | undefined;
|
|
53
|
+
class?: string | undefined;
|
|
37
54
|
}
|
|
38
55
|
|
|
39
56
|
let {
|
|
@@ -58,10 +75,52 @@
|
|
|
58
75
|
info: 'bg-primary border-primary/30 text-primary',
|
|
59
76
|
neutral: 'bg-muted-foreground border-border text-muted-foreground',
|
|
60
77
|
};
|
|
78
|
+
|
|
79
|
+
const actionToneMap: Record<string, Status> = {
|
|
80
|
+
create: 'success',
|
|
81
|
+
add: 'success',
|
|
82
|
+
update: 'info',
|
|
83
|
+
edit: 'info',
|
|
84
|
+
delete: 'danger',
|
|
85
|
+
remove: 'danger',
|
|
86
|
+
approve: 'warning',
|
|
87
|
+
reject: 'danger',
|
|
88
|
+
rollback: 'warning',
|
|
89
|
+
};
|
|
90
|
+
|
|
61
91
|
const resolvedState = $derived(state ?? (items.length === 0 ? 'empty' : undefined));
|
|
92
|
+
|
|
93
|
+
function formatTime(val: string | number | undefined): string {
|
|
94
|
+
if (!val) return '';
|
|
95
|
+
if (typeof val === 'string' && !/^\d{4}-\d{2}-\d{2}T/.test(val)) return val;
|
|
96
|
+
try {
|
|
97
|
+
const d = typeof val === 'number' ? new Date(val) : new Date(val);
|
|
98
|
+
return isNaN(d.getTime()) ? String(val) : d.toLocaleString();
|
|
99
|
+
} catch {
|
|
100
|
+
return String(val);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function formatVal(v: unknown): string {
|
|
105
|
+
if (v === null || v === undefined) return 'null';
|
|
106
|
+
if (typeof v === 'boolean') return v ? 'true' : 'false';
|
|
107
|
+
if (typeof v === 'object') return JSON.stringify(v);
|
|
108
|
+
return String(v);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function getActorName(actor: AuditActor | string | undefined): string | undefined {
|
|
112
|
+
if (!actor) return undefined;
|
|
113
|
+
if (typeof actor === 'string') return actor;
|
|
114
|
+
return actor.name ?? actor.id;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function getActorIp(actor: AuditActor | string | undefined): string | undefined {
|
|
118
|
+
if (!actor || typeof actor === 'string') return undefined;
|
|
119
|
+
return actor.ip;
|
|
120
|
+
}
|
|
62
121
|
</script>
|
|
63
122
|
|
|
64
|
-
<div class={cn('space-y-4', className)} data-svadmin-audit-timeline data-svadmin-audit-state={resolvedState ?? 'ready'}>
|
|
123
|
+
<div class={cn('space-y-4', className)} data-svadmin-component="AuditTimeline" data-svadmin-audit-timeline data-svadmin-audit-state={resolvedState ?? 'ready'}>
|
|
65
124
|
{#if resolvedState}
|
|
66
125
|
<DataState
|
|
67
126
|
state={resolvedState}
|
|
@@ -77,12 +136,14 @@
|
|
|
77
136
|
{:else}
|
|
78
137
|
<div class="relative pl-6 space-y-6 before:absolute before:left-2 before:top-2 before:bottom-2 before:w-0.5 before:bg-border" data-svadmin-audit-events>
|
|
79
138
|
{#each items as item (item.id)}
|
|
80
|
-
{@const statusTone = item.status ?? 'info'}
|
|
81
|
-
|
|
139
|
+
{@const statusTone = item.status ?? (item.action ? (actionToneMap[item.action.toLowerCase()] ?? 'info') : 'info')}
|
|
140
|
+
{@const actorName = getActorName(item.actor)}
|
|
141
|
+
{@const actorIp = getActorIp(item.actor)}
|
|
142
|
+
<div class="relative flex flex-col gap-1 text-sm group" data-svadmin-audit-event={item.id}>
|
|
82
143
|
<span
|
|
83
144
|
class={cn(
|
|
84
145
|
'absolute -left-6 top-1 flex h-4 w-4 items-center justify-center rounded-full border-2 bg-background transition-transform group-hover:scale-110',
|
|
85
|
-
item.status ? dotClass[statusTone] : 'border-border bg-muted'
|
|
146
|
+
item.status || item.action ? dotClass[statusTone] : 'border-border bg-muted'
|
|
86
147
|
)}
|
|
87
148
|
aria-hidden="true"
|
|
88
149
|
></span>
|
|
@@ -90,24 +151,60 @@
|
|
|
90
151
|
<div class="flex flex-wrap items-center justify-between gap-2">
|
|
91
152
|
<div class="flex items-center gap-2">
|
|
92
153
|
<span class="font-medium text-foreground">{item.title}</span>
|
|
93
|
-
{#if
|
|
94
|
-
<span class="text-xs text-muted-foreground">{i18n.t('audit.actorPrefix')}{
|
|
154
|
+
{#if actorName}
|
|
155
|
+
<span class="text-xs text-muted-foreground">{i18n.t('audit.actorPrefix')}{actorName}</span>
|
|
156
|
+
{/if}
|
|
157
|
+
{#if actorIp}
|
|
158
|
+
<span class="inline-flex items-center gap-1 font-mono text-[11px] text-muted-foreground bg-muted/60 px-1 py-0.5 rounded">
|
|
159
|
+
<Globe class="h-3 w-3" />
|
|
160
|
+
{actorIp}
|
|
161
|
+
</span>
|
|
95
162
|
{/if}
|
|
96
163
|
{#if item.status}
|
|
97
|
-
<StatusBadge
|
|
164
|
+
<StatusBadge
|
|
165
|
+
status={statusTone}
|
|
166
|
+
label={item.tag ?? i18n.t(`audit.status.${item.status}`)}
|
|
167
|
+
class="text-[11px] py-0 h-4"
|
|
168
|
+
/>
|
|
98
169
|
{:else if item.tag}
|
|
99
|
-
<
|
|
100
|
-
{item.tag}
|
|
101
|
-
</span>
|
|
170
|
+
<StatusBadge status={statusTone} label={item.tag} />
|
|
102
171
|
{/if}
|
|
103
172
|
</div>
|
|
173
|
+
|
|
104
174
|
{#if item.timestamp}
|
|
105
|
-
<time class="text-xs tabular-nums text-muted-foreground font-mono">
|
|
175
|
+
<time class="text-xs tabular-nums text-muted-foreground font-mono">
|
|
176
|
+
{formatTime(item.timestamp)}
|
|
177
|
+
</time>
|
|
106
178
|
{/if}
|
|
107
179
|
</div>
|
|
108
180
|
|
|
109
181
|
{#if item.description}
|
|
110
|
-
<p class="text-xs text-muted-foreground
|
|
182
|
+
<p class="text-xs text-muted-foreground">
|
|
183
|
+
{item.description}
|
|
184
|
+
</p>
|
|
185
|
+
{/if}
|
|
186
|
+
|
|
187
|
+
<!-- Field Changes Diff Section -->
|
|
188
|
+
{#if item.changes && item.changes.length > 0}
|
|
189
|
+
<div class="mt-2 rounded-md border border-border/60 bg-muted/40 p-2 space-y-1" data-svadmin-audit-diff>
|
|
190
|
+
<div class="text-[11px] font-semibold text-muted-foreground uppercase tracking-wider mb-0.5">
|
|
191
|
+
变更对比 (Diff)
|
|
192
|
+
</div>
|
|
193
|
+
{#each item.changes as ch (ch.field)}
|
|
194
|
+
<div class="flex items-center gap-2 text-xs py-0.5 border-b border-border/30 last:border-0">
|
|
195
|
+
<span class="font-medium text-foreground w-24 truncate flex-shrink-0" title={ch.label ?? ch.field}>
|
|
196
|
+
{ch.label ?? ch.field}:
|
|
197
|
+
</span>
|
|
198
|
+
<span class="line-through bg-destructive/10 text-destructive px-1.5 py-0.5 rounded text-[11px] font-mono truncate max-w-[120px]">
|
|
199
|
+
{formatVal(ch.oldValue)}
|
|
200
|
+
</span>
|
|
201
|
+
<ArrowRight class="h-3 w-3 text-muted-foreground flex-shrink-0" />
|
|
202
|
+
<span class="bg-success/15 text-success font-medium px-1.5 py-0.5 rounded text-[11px] font-mono truncate max-w-[160px]">
|
|
203
|
+
{formatVal(ch.newValue)}
|
|
204
|
+
</span>
|
|
205
|
+
</div>
|
|
206
|
+
{/each}
|
|
207
|
+
</div>
|
|
111
208
|
{/if}
|
|
112
209
|
</div>
|
|
113
210
|
{/each}
|
|
@@ -1,28 +1,42 @@
|
|
|
1
1
|
import type { Status } from './StatusBadge.svelte';
|
|
2
|
+
export interface AuditFieldChange {
|
|
3
|
+
field: string;
|
|
4
|
+
label?: string | undefined;
|
|
5
|
+
oldValue?: unknown;
|
|
6
|
+
newValue?: unknown;
|
|
7
|
+
}
|
|
8
|
+
export interface AuditActor {
|
|
9
|
+
name?: string | undefined;
|
|
10
|
+
avatar?: string | undefined;
|
|
11
|
+
id?: string | undefined;
|
|
12
|
+
ip?: string | undefined;
|
|
13
|
+
}
|
|
2
14
|
export interface TimelineItem {
|
|
3
15
|
id: string;
|
|
4
16
|
title: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
timestamp?: string;
|
|
7
|
-
actor?: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
17
|
+
description?: string | undefined;
|
|
18
|
+
timestamp?: string | number | undefined;
|
|
19
|
+
actor?: AuditActor | string | undefined;
|
|
20
|
+
action?: string | undefined;
|
|
21
|
+
status?: Status | undefined;
|
|
22
|
+
tag?: string | undefined;
|
|
23
|
+
changes?: AuditFieldChange[] | undefined;
|
|
24
|
+
meta?: Record<string, unknown> | undefined;
|
|
11
25
|
}
|
|
12
26
|
import type { Snippet } from 'svelte';
|
|
13
27
|
import type { BlockingDataStateKind } from './DataState.svelte';
|
|
14
28
|
interface Props {
|
|
15
29
|
items?: TimelineItem[];
|
|
16
|
-
emptyTitle?: string;
|
|
17
|
-
emptyDescription?: string;
|
|
18
|
-
state?: BlockingDataStateKind;
|
|
19
|
-
stateTitle?: string;
|
|
20
|
-
stateDescription?: string;
|
|
21
|
-
retry?: () => void;
|
|
22
|
-
retryLabel?: string;
|
|
23
|
-
loadingLabel?: string;
|
|
24
|
-
action?: Snippet;
|
|
25
|
-
class?: string;
|
|
30
|
+
emptyTitle?: string | undefined;
|
|
31
|
+
emptyDescription?: string | undefined;
|
|
32
|
+
state?: BlockingDataStateKind | undefined;
|
|
33
|
+
stateTitle?: string | undefined;
|
|
34
|
+
stateDescription?: string | undefined;
|
|
35
|
+
retry?: (() => void) | undefined;
|
|
36
|
+
retryLabel?: string | undefined;
|
|
37
|
+
loadingLabel?: string | undefined;
|
|
38
|
+
action?: Snippet | undefined;
|
|
39
|
+
class?: string | undefined;
|
|
26
40
|
}
|
|
27
41
|
declare const AuditTimeline: import("svelte").Component<Props, {}, "">;
|
|
28
42
|
type AuditTimeline = ReturnType<typeof AuditTimeline>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Badge } from '../ui/badge/index.js';
|
|
3
3
|
|
|
4
|
-
let { value, options }
|
|
4
|
+
let { value, options }: {
|
|
5
5
|
value: (string | number)[] | null | undefined;
|
|
6
6
|
options?: { label: string; value: string | number }[];
|
|
7
|
-
}
|
|
7
|
+
} = $props();
|
|
8
8
|
|
|
9
9
|
const items = $derived(Array.isArray(value) ? value : []);
|
|
10
10
|
</script>
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { ExternalLink } from '@lucide/svelte';
|
|
3
3
|
import { captureAdminContext } from '@svadmin/core';
|
|
4
4
|
|
|
5
|
-
let { value, resourceName, displayValue }
|
|
5
|
+
let { value, resourceName, displayValue }: {
|
|
6
6
|
value: string | number | null | undefined;
|
|
7
7
|
resourceName?: string;
|
|
8
8
|
displayValue?: string;
|
|
9
|
-
}
|
|
9
|
+
} = $props();
|
|
10
10
|
const adminContext = captureAdminContext();
|
|
11
11
|
|
|
12
12
|
const display = $derived(displayValue ?? (value != null ? `#${value}` : '—'));
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
const i18n = useTranslation();
|
|
6
6
|
|
|
7
|
-
let { value, maxLength = 200 }
|
|
7
|
+
let { value, maxLength = 200 }: {
|
|
8
8
|
value: string | null | undefined;
|
|
9
9
|
maxLength?: number;
|
|
10
|
-
}
|
|
10
|
+
} = $props();
|
|
11
11
|
|
|
12
12
|
const text = $derived(value ?? '');
|
|
13
13
|
const truncated = $derived(text.length > maxLength);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Badge } from '../ui/badge/index.js';
|
|
3
3
|
|
|
4
|
-
let { value, options }
|
|
4
|
+
let { value, options }: {
|
|
5
5
|
value: string | number | null | undefined;
|
|
6
6
|
options?: { label: string; value: string | number }[];
|
|
7
|
-
}
|
|
7
|
+
} = $props();
|
|
8
8
|
|
|
9
9
|
const label = $derived(
|
|
10
10
|
options?.find((o: { label: string; value: string | number }) => o.value === value)?.label ?? (value != null ? String(value) : '—')
|
|
@@ -43,7 +43,7 @@ export declare function createListState(options: ListStateOptions): {
|
|
|
43
43
|
readonly queryPagination: Pagination;
|
|
44
44
|
readonly querySorters: {
|
|
45
45
|
field: string;
|
|
46
|
-
order: "
|
|
46
|
+
order: "asc" | "desc";
|
|
47
47
|
}[];
|
|
48
48
|
readonly queryFilters: Filter[];
|
|
49
49
|
scheduleSearch: (value: string) => void;
|
|
@@ -3,6 +3,6 @@ import { type WithoutChildrenOrChild } from "../../../utils.js";
|
|
|
3
3
|
type $$ComponentProps = Omit<WithoutChildrenOrChild<CheckboxPrimitive.RootProps>, "size"> & {
|
|
4
4
|
size?: "default" | "compact";
|
|
5
5
|
};
|
|
6
|
-
declare const Checkbox: import("svelte").Component<$$ComponentProps, {}, "
|
|
6
|
+
declare const Checkbox: import("svelte").Component<$$ComponentProps, {}, "ref" | "checked" | "indeterminate">;
|
|
7
7
|
type Checkbox = ReturnType<typeof Checkbox>;
|
|
8
8
|
export default Checkbox;
|
|
@@ -6,6 +6,6 @@ type Props = Omit<CommandPrimitive.RootProps, 'children' | 'value'> & Omit<Dialo
|
|
|
6
6
|
class?: string;
|
|
7
7
|
children?: Snippet;
|
|
8
8
|
};
|
|
9
|
-
declare const CommandDialog: import("svelte").Component<Props, {}, "
|
|
9
|
+
declare const CommandDialog: import("svelte").Component<Props, {}, "value" | "open">;
|
|
10
10
|
type CommandDialog = ReturnType<typeof CommandDialog>;
|
|
11
11
|
export default CommandDialog;
|
|
@@ -14,7 +14,7 @@ declare const Command: {
|
|
|
14
14
|
value?: string;
|
|
15
15
|
class?: string;
|
|
16
16
|
children?: import("svelte").Snippet;
|
|
17
|
-
}, {}, "
|
|
17
|
+
}, {}, "value" | "open">;
|
|
18
18
|
Empty: import("svelte").Component<import("bits-ui").CommandEmptyProps, {}, "ref">;
|
|
19
19
|
Group: import("svelte").Component<Omit<{
|
|
20
20
|
value?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HTMLInputAttributes, HTMLInputTypeAttribute } from "svelte/elements";
|
|
2
2
|
declare function $$render<Type extends HTMLInputTypeAttribute | undefined = undefined>(): {
|
|
3
|
-
props: Omit<HTMLInputAttributes, "type" | "
|
|
3
|
+
props: Omit<HTMLInputAttributes, "type" | "value" | "size"> & {
|
|
4
4
|
ref?: HTMLElement | null;
|
|
5
5
|
} & {
|
|
6
6
|
size?: "default" | "compact";
|
|
@@ -5,6 +5,6 @@ type Props = WithElementRef<HTMLButtonAttributes, HTMLButtonElement> & {
|
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
onCheckedChange?: (checked: boolean) => void;
|
|
7
7
|
};
|
|
8
|
-
declare const Switch: import("svelte").Component<Props, {}, "
|
|
8
|
+
declare const Switch: import("svelte").Component<Props, {}, "ref" | "checked">;
|
|
9
9
|
type Switch = ReturnType<typeof Switch>;
|
|
10
10
|
export default Switch;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useNetworkStatus.svelte.js';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface NetworkInformationLike {
|
|
2
|
+
effectiveType?: '4g' | '3g' | '2g' | 'slow-2g';
|
|
3
|
+
downlink?: number;
|
|
4
|
+
rtt?: number;
|
|
5
|
+
saveData?: boolean;
|
|
6
|
+
addEventListener?: (type: string, listener: EventListener) => void;
|
|
7
|
+
removeEventListener?: (type: string, listener: EventListener) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface NetworkStatusState {
|
|
10
|
+
isOnline: boolean;
|
|
11
|
+
isWeak: boolean;
|
|
12
|
+
effectiveType: string;
|
|
13
|
+
downlink: number | null;
|
|
14
|
+
rtt: number | null;
|
|
15
|
+
reconnectedAt: Date | null;
|
|
16
|
+
}
|
|
17
|
+
export interface UseNetworkStatusOptions {
|
|
18
|
+
onOnline?: () => void;
|
|
19
|
+
onOffline?: () => void;
|
|
20
|
+
onReconnect?: (reconnectedAt: Date) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function useNetworkStatus(options?: UseNetworkStatusOptions): {
|
|
23
|
+
readonly isOnline: boolean;
|
|
24
|
+
readonly isWeak: boolean;
|
|
25
|
+
readonly effectiveType: string;
|
|
26
|
+
readonly downlink: number | null;
|
|
27
|
+
readonly rtt: number | null;
|
|
28
|
+
readonly reconnectedAt: Date | null;
|
|
29
|
+
refresh: () => void;
|
|
30
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export function useNetworkStatus(options = {}) {
|
|
2
|
+
let isOnline = $state(typeof navigator !== 'undefined' ? navigator.onLine : true);
|
|
3
|
+
let effectiveType = $state('unknown');
|
|
4
|
+
let downlink = $state(null);
|
|
5
|
+
let rtt = $state(null);
|
|
6
|
+
let reconnectedAt = $state(null);
|
|
7
|
+
const isWeak = $derived(effectiveType === '2g' ||
|
|
8
|
+
effectiveType === 'slow-2g' ||
|
|
9
|
+
(rtt != null && rtt > 1500) ||
|
|
10
|
+
(downlink != null && downlink < 0.2));
|
|
11
|
+
function updateConnectionDetails() {
|
|
12
|
+
if (typeof navigator === 'undefined')
|
|
13
|
+
return;
|
|
14
|
+
const nav = navigator;
|
|
15
|
+
if (nav.connection) {
|
|
16
|
+
if (nav.connection.effectiveType)
|
|
17
|
+
effectiveType = nav.connection.effectiveType;
|
|
18
|
+
if (nav.connection.downlink != null)
|
|
19
|
+
downlink = nav.connection.downlink;
|
|
20
|
+
if (nav.connection.rtt != null)
|
|
21
|
+
rtt = nav.connection.rtt;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function handleOnline() {
|
|
25
|
+
const wasOffline = !isOnline;
|
|
26
|
+
isOnline = true;
|
|
27
|
+
updateConnectionDetails();
|
|
28
|
+
if (wasOffline) {
|
|
29
|
+
const now = new Date();
|
|
30
|
+
reconnectedAt = now;
|
|
31
|
+
options.onReconnect?.(now);
|
|
32
|
+
}
|
|
33
|
+
options.onOnline?.();
|
|
34
|
+
}
|
|
35
|
+
function handleOffline() {
|
|
36
|
+
isOnline = false;
|
|
37
|
+
options.onOffline?.();
|
|
38
|
+
}
|
|
39
|
+
if (typeof window !== 'undefined') {
|
|
40
|
+
updateConnectionDetails();
|
|
41
|
+
window.addEventListener('online', handleOnline);
|
|
42
|
+
window.addEventListener('offline', handleOffline);
|
|
43
|
+
const nav = navigator;
|
|
44
|
+
if (nav.connection?.addEventListener) {
|
|
45
|
+
nav.connection.addEventListener('change', updateConnectionDetails);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
get isOnline() {
|
|
50
|
+
return isOnline;
|
|
51
|
+
},
|
|
52
|
+
get isWeak() {
|
|
53
|
+
return isWeak;
|
|
54
|
+
},
|
|
55
|
+
get effectiveType() {
|
|
56
|
+
return effectiveType;
|
|
57
|
+
},
|
|
58
|
+
get downlink() {
|
|
59
|
+
return downlink;
|
|
60
|
+
},
|
|
61
|
+
get rtt() {
|
|
62
|
+
return rtt;
|
|
63
|
+
},
|
|
64
|
+
get reconnectedAt() {
|
|
65
|
+
return reconnectedAt;
|
|
66
|
+
},
|
|
67
|
+
refresh: () => {
|
|
68
|
+
if (typeof navigator !== 'undefined') {
|
|
69
|
+
isOnline = navigator.onLine;
|
|
70
|
+
updateConnectionDetails();
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
package/dist/design-system.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { SurfaceDensity, SurfaceTone } from "./design-contract.js";
|
|
2
2
|
export declare function metricSurfaceClasses(tone?: SurfaceTone): {
|
|
3
|
-
state: string;
|
|
4
|
-
description: string;
|
|
5
3
|
root: string;
|
|
4
|
+
description: string;
|
|
6
5
|
card: string;
|
|
6
|
+
state: string;
|
|
7
7
|
};
|
|
8
8
|
/** @deprecated The argument is accepted for compatibility and uses the shared baseline. */
|
|
9
9
|
export declare function tableSurfaceClasses(_density?: SurfaceDensity): {
|
|
10
|
+
root: string;
|
|
11
|
+
header: string;
|
|
10
12
|
state: string;
|
|
11
13
|
content: string;
|
|
12
14
|
head: string;
|
|
13
|
-
header: string;
|
|
14
|
-
root: string;
|
|
15
15
|
cell: string;
|
|
16
16
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -151,8 +151,8 @@ export { default as Image } from './components/Image.svelte';
|
|
|
151
151
|
export { default as ImageCropper } from './components/ImageCropper.svelte';
|
|
152
152
|
export { default as ActivityFeed } from './components/ActivityFeed.svelte';
|
|
153
153
|
export type { ActivityItem } from './components/ActivityFeed.svelte';
|
|
154
|
-
export { default as PresenceAvatarGroup } from './components/PresenceAvatarGroup.svelte';
|
|
155
|
-
export type { PresenceUser } from './components/PresenceAvatarGroup.svelte';
|
|
154
|
+
export { default as PresenceAvatarGroup, default as PresenceAvatars } from './components/PresenceAvatarGroup.svelte';
|
|
155
|
+
export type { PresenceAvatarGroupProps, PresenceUser } from './components/PresenceAvatarGroup.svelte';
|
|
156
156
|
export { default as PrintableBill } from './components/PrintableBill.svelte';
|
|
157
157
|
export type { BillItem } from './components/PrintableBill.svelte';
|
|
158
158
|
export { default as JsonSchemaForm } from './components/JsonSchemaForm.svelte';
|
|
@@ -180,7 +180,7 @@ export { default as SpreadsheetView } from './components/SpreadsheetView.svelte'
|
|
|
180
180
|
export type { SheetData, SpreadsheetLimits } from './components/SpreadsheetView.svelte';
|
|
181
181
|
export { default as DecisionTable } from './components/DecisionTable.svelte';
|
|
182
182
|
export type { DecisionColumn, DecisionRule } from './components/DecisionTable.svelte';
|
|
183
|
-
export { default as OfflineSyncBanner } from './components/OfflineSyncBanner.svelte';
|
|
183
|
+
export { default as OfflineSyncBanner, default as OfflineBanner } from './components/OfflineSyncBanner.svelte';
|
|
184
184
|
export type { PendingMutation } from './components/OfflineSyncBanner.svelte';
|
|
185
185
|
export { default as InfiniteList } from './components/InfiniteList.svelte';
|
|
186
186
|
export { default as ComboboxField } from './components/ComboboxField.svelte';
|
|
@@ -321,8 +321,8 @@ export type { TimelineEntry } from './components/Timeline.svelte';
|
|
|
321
321
|
export { default as Statistic } from './components/Statistic.svelte';
|
|
322
322
|
export { default as Countdown } from './components/Countdown.svelte';
|
|
323
323
|
export { default as ResizeBox } from './components/ResizeBox.svelte';
|
|
324
|
-
export { default as Tour } from './components/Tour.svelte';
|
|
325
|
-
export type { TourStep } from './components/Tour.svelte';
|
|
324
|
+
export { default as Tour, default as TourGuide } from './components/Tour.svelte';
|
|
325
|
+
export type { TourStep, TourStep as TourGuideStep } from './components/Tour.svelte';
|
|
326
326
|
export { default as Menu } from './components/Menu.svelte';
|
|
327
327
|
export type { MenuEntry } from './components/Menu.svelte';
|
|
328
328
|
export { default as ConfigProvider, useComponentConfig, hasComponentConfig, resolvePopupContainer } from './components/ConfigProvider.svelte';
|
|
@@ -549,3 +549,29 @@ export { default as ExcelExportButton } from './components/ExcelExportButton.sve
|
|
|
549
549
|
export type { ExcelExportButtonProps, ExcelExportColumn } from './components/ExcelExportButton.svelte';
|
|
550
550
|
export { default as PivotDrilldownModal } from './components/PivotDrilldownModal.svelte';
|
|
551
551
|
export type { PivotDrilldownModalProps, PivotDrilldownColumn, PivotDrilldownFilter, } from './components/PivotDrilldownModal.svelte';
|
|
552
|
+
export { default as SafeDeleteConfirm, default as DoubleCheckModal } from './components/SafeDeleteConfirm.svelte';
|
|
553
|
+
export type { SafeDeleteConfirmProps, ImpactItem } from './components/SafeDeleteConfirm.svelte';
|
|
554
|
+
export { default as SliderCaptcha } from './components/SliderCaptcha.svelte';
|
|
555
|
+
export type { SliderCaptchaProps, SliderCaptchaResult } from './components/SliderCaptcha.svelte';
|
|
556
|
+
export { default as ConcurrentConflictModal } from './components/ConcurrentConflictModal.svelte';
|
|
557
|
+
export type { ConcurrentConflictModalProps, ConflictFieldDiff } from './components/ConcurrentConflictModal.svelte';
|
|
558
|
+
export { default as TrendIndicator, default as Trend } from './components/TrendIndicator.svelte';
|
|
559
|
+
export type { TrendIndicatorProps } from './components/TrendIndicator.svelte';
|
|
560
|
+
export { default as VirtualTreeSelect } from './components/VirtualTreeSelect.svelte';
|
|
561
|
+
export type { VirtualTreeSelectProps, VirtualTreeNode } from './components/VirtualTreeSelect.svelte';
|
|
562
|
+
export { default as CronExpressionBuilder } from './components/CronExpressionBuilder.svelte';
|
|
563
|
+
export type { CronExpressionBuilderProps, CronPreset } from './components/CronExpressionBuilder.svelte';
|
|
564
|
+
export { default as OrgChart } from './components/OrgChart.svelte';
|
|
565
|
+
export type { OrgChartProps, OrgNode } from './components/OrgChart.svelte';
|
|
566
|
+
export { GaugeChart as SpeedometerGauge } from './components/charts/index.js';
|
|
567
|
+
export type { GaugeChartProps, GaugeThreshold, GaugeTone, GaugeType, GaugeMode } from './components/charts/GaugeChart.svelte';
|
|
568
|
+
export { default as MetricGrid, default as DashboardMetricGrid } from './components/MetricGrid.svelte';
|
|
569
|
+
export type { MetricGridProps } from './components/MetricGrid.svelte';
|
|
570
|
+
export { default as MicroAppFrame, default as EmbeddedSandbox } from './components/MicroAppFrame.svelte';
|
|
571
|
+
export type { MicroAppFrameProps, MicroAppMessage } from './components/MicroAppFrame.svelte';
|
|
572
|
+
export { default as TaskCenter, default as BackgroundTaskDrawer } from './components/TaskCenter.svelte';
|
|
573
|
+
export type { TaskCenterProps, BackgroundTask, BackgroundTaskStatus } from './components/TaskCenter.svelte';
|
|
574
|
+
export { useNetworkStatus } from './components/useNetworkStatus.svelte.js';
|
|
575
|
+
export type { NetworkInformationLike, NetworkStatusState, UseNetworkStatusOptions } from './components/useNetworkStatus.svelte.js';
|
|
576
|
+
export { default as OfflineGuard } from './components/OfflineGuard.svelte';
|
|
577
|
+
export type { OfflineGuardProps } from './components/OfflineGuard.svelte';
|
package/dist/index.js
CHANGED
|
@@ -116,7 +116,7 @@ export { default as MediaLibraryModal } from './components/MediaLibraryModal.sve
|
|
|
116
116
|
export { default as Image } from './components/Image.svelte';
|
|
117
117
|
export { default as ImageCropper } from './components/ImageCropper.svelte';
|
|
118
118
|
export { default as ActivityFeed } from './components/ActivityFeed.svelte';
|
|
119
|
-
export { default as PresenceAvatarGroup } from './components/PresenceAvatarGroup.svelte';
|
|
119
|
+
export { default as PresenceAvatarGroup, default as PresenceAvatars } from './components/PresenceAvatarGroup.svelte';
|
|
120
120
|
export { default as PrintableBill } from './components/PrintableBill.svelte';
|
|
121
121
|
export { default as JsonSchemaForm } from './components/JsonSchemaForm.svelte';
|
|
122
122
|
export { default as MentionsInput, default as Mentions, default as Mention } from './components/MentionsInput.svelte';
|
|
@@ -130,7 +130,7 @@ export { default as SignaturePad } from './components/SignaturePad.svelte';
|
|
|
130
130
|
export { default as PdfDocumentViewer } from './components/PdfDocumentViewer.svelte';
|
|
131
131
|
export { default as SpreadsheetView } from './components/SpreadsheetView.svelte';
|
|
132
132
|
export { default as DecisionTable } from './components/DecisionTable.svelte';
|
|
133
|
-
export { default as OfflineSyncBanner } from './components/OfflineSyncBanner.svelte';
|
|
133
|
+
export { default as OfflineSyncBanner, default as OfflineBanner } from './components/OfflineSyncBanner.svelte';
|
|
134
134
|
export { default as InfiniteList } from './components/InfiniteList.svelte';
|
|
135
135
|
export { default as ComboboxField } from './components/ComboboxField.svelte';
|
|
136
136
|
export { default as AutoComplete } from './components/AutoComplete.svelte';
|
|
@@ -261,7 +261,7 @@ export { default as Timeline } from './components/Timeline.svelte';
|
|
|
261
261
|
export { default as Statistic } from './components/Statistic.svelte';
|
|
262
262
|
export { default as Countdown } from './components/Countdown.svelte';
|
|
263
263
|
export { default as ResizeBox } from './components/ResizeBox.svelte';
|
|
264
|
-
export { default as Tour } from './components/Tour.svelte';
|
|
264
|
+
export { default as Tour, default as TourGuide } from './components/Tour.svelte';
|
|
265
265
|
export { default as Menu } from './components/Menu.svelte';
|
|
266
266
|
export { default as ConfigProvider, useComponentConfig, hasComponentConfig, resolvePopupContainer } from './components/ConfigProvider.svelte';
|
|
267
267
|
export { toast, toast as message, toast as Message } from '@svadmin/core';
|
|
@@ -424,3 +424,23 @@ export { default as ProSkeleton } from './components/ProSkeleton.svelte';
|
|
|
424
424
|
export { default as ExcelImportWizard } from './components/ExcelImportWizard.svelte';
|
|
425
425
|
export { default as ExcelExportButton } from './components/ExcelExportButton.svelte';
|
|
426
426
|
export { default as PivotDrilldownModal } from './components/PivotDrilldownModal.svelte';
|
|
427
|
+
// Enterprise security and safe-delete verification suite
|
|
428
|
+
export { default as SafeDeleteConfirm, default as DoubleCheckModal } from './components/SafeDeleteConfirm.svelte';
|
|
429
|
+
export { default as SliderCaptcha } from './components/SliderCaptcha.svelte';
|
|
430
|
+
// Enterprise real-time collaboration and concurrent edit conflict guard
|
|
431
|
+
export { default as ConcurrentConflictModal } from './components/ConcurrentConflictModal.svelte';
|
|
432
|
+
// Enterprise metrics & trend visualization suite
|
|
433
|
+
export { default as TrendIndicator, default as Trend } from './components/TrendIndicator.svelte';
|
|
434
|
+
// Enterprise tree, cron scheduler & organization hierarchy suite
|
|
435
|
+
export { default as VirtualTreeSelect } from './components/VirtualTreeSelect.svelte';
|
|
436
|
+
export { default as CronExpressionBuilder } from './components/CronExpressionBuilder.svelte';
|
|
437
|
+
export { default as OrgChart } from './components/OrgChart.svelte';
|
|
438
|
+
export { GaugeChart as SpeedometerGauge } from './components/charts/index.js';
|
|
439
|
+
export { default as MetricGrid, default as DashboardMetricGrid } from './components/MetricGrid.svelte';
|
|
440
|
+
// Enterprise micro-frontend & embedded sandbox frame suite
|
|
441
|
+
export { default as MicroAppFrame, default as EmbeddedSandbox } from './components/MicroAppFrame.svelte';
|
|
442
|
+
// Enterprise background task center and async job tracking suite
|
|
443
|
+
export { default as TaskCenter, default as BackgroundTaskDrawer } from './components/TaskCenter.svelte';
|
|
444
|
+
// Enterprise offline resilience & network monitoring suite
|
|
445
|
+
export { useNetworkStatus } from './components/useNetworkStatus.svelte.js';
|
|
446
|
+
export { default as OfflineGuard } from './components/OfflineGuard.svelte';
|