@svadmin/ui 0.22.1 → 0.23.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/package.json
CHANGED
|
@@ -308,9 +308,7 @@
|
|
|
308
308
|
const ids = Object.keys(rowSelection);
|
|
309
309
|
confirmMessage = t('common.batchDeleteConfirm', { count: ids.length });
|
|
310
310
|
confirmAction = async () => {
|
|
311
|
-
|
|
312
|
-
await deleteMutation.mutateAsync({ id, resource: resourceName });
|
|
313
|
-
}
|
|
311
|
+
await Promise.allSettled(ids.map(id => deleteMutation.mutateAsync({ id, resource: resourceName })));
|
|
314
312
|
rowSelection = {};
|
|
315
313
|
confirmOpen = false;
|
|
316
314
|
};
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
</script>
|
|
79
79
|
|
|
80
80
|
<div class="space-y-1.5">
|
|
81
|
-
<Label for={field.key}>
|
|
81
|
+
<Label for={field.key} id="label-{field.key}">
|
|
82
82
|
{field.label}
|
|
83
83
|
{#if field.required}
|
|
84
84
|
<span class="text-destructive">*</span>
|
|
@@ -233,7 +233,11 @@
|
|
|
233
233
|
{/if}
|
|
234
234
|
|
|
235
235
|
{:else if field.type === 'multiselect'}
|
|
236
|
-
<div
|
|
236
|
+
<div
|
|
237
|
+
class="space-y-2 rounded-lg border border-input p-3 max-h-48 overflow-y-auto"
|
|
238
|
+
role="group"
|
|
239
|
+
aria-labelledby="label-{field.key}"
|
|
240
|
+
>
|
|
237
241
|
{#each field.options ?? [] as opt}
|
|
238
242
|
<label class="flex items-center gap-2 text-sm cursor-pointer hover:bg-muted/50 rounded px-1 py-0.5 transition-colors">
|
|
239
243
|
<Checkbox
|
|
@@ -17,16 +17,23 @@
|
|
|
17
17
|
ChevronLeft, ChevronDown, LogOut, Sun, Moon, Palette
|
|
18
18
|
} from 'lucide-svelte';
|
|
19
19
|
|
|
20
|
-
let { collapsed, identity, title, onToggle, onLogout, menu,
|
|
20
|
+
let { collapsed, identity, title, onToggle, onLogout, menu, routeMode = 'auto' }: {
|
|
21
21
|
collapsed: boolean;
|
|
22
22
|
identity: Identity | null;
|
|
23
23
|
title: string;
|
|
24
24
|
onToggle: () => void;
|
|
25
25
|
onLogout: () => void;
|
|
26
26
|
menu?: MenuItem[];
|
|
27
|
-
|
|
27
|
+
/** 'hash' for SPA hash routing, 'path' for SvelteKit/filesystem routing, 'auto' to detect */
|
|
28
|
+
routeMode?: 'hash' | 'path' | 'auto';
|
|
28
29
|
} = $props();
|
|
29
30
|
|
|
31
|
+
const effectiveRouteMode = $derived(
|
|
32
|
+
routeMode === 'auto'
|
|
33
|
+
? (typeof window !== 'undefined' && window.location.hash.startsWith('#/') ? 'hash' : 'path')
|
|
34
|
+
: routeMode
|
|
35
|
+
);
|
|
36
|
+
|
|
30
37
|
const resources = getResources();
|
|
31
38
|
|
|
32
39
|
const iconMap: Record<string, typeof LayoutDashboard> = {
|
|
@@ -98,7 +105,7 @@
|
|
|
98
105
|
|
|
99
106
|
function isActive(itemPath: string): boolean {
|
|
100
107
|
if (itemPath === '/') return path === '/';
|
|
101
|
-
return path.startsWith(itemPath);
|
|
108
|
+
return path === itemPath || path.startsWith(itemPath + "/");
|
|
102
109
|
}
|
|
103
110
|
|
|
104
111
|
/** Prefetch resource data on hover for instant navigation */
|
|
@@ -206,7 +213,7 @@
|
|
|
206
213
|
{#each group.items as item}
|
|
207
214
|
{@const active = isActive(item.path)}
|
|
208
215
|
<a
|
|
209
|
-
href={
|
|
216
|
+
href={effectiveRouteMode === 'hash' ? `#${item.path}` : item.path}
|
|
210
217
|
class="flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-all duration-200
|
|
211
218
|
{active
|
|
212
219
|
? 'bg-sidebar-accent text-sidebar-accent-foreground sidebar-nav-active'
|
|
@@ -229,7 +236,7 @@
|
|
|
229
236
|
{#snippet child({ props }: { props: Record<string, unknown> })}
|
|
230
237
|
<a
|
|
231
238
|
{...props}
|
|
232
|
-
href={
|
|
239
|
+
href={effectiveRouteMode === 'hash' ? `#${item.path}` : item.path}
|
|
233
240
|
class="flex items-center justify-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-all duration-200
|
|
234
241
|
{active
|
|
235
242
|
? 'bg-sidebar-accent text-sidebar-accent-foreground'
|
|
@@ -245,7 +252,7 @@
|
|
|
245
252
|
</Tooltip.Root>
|
|
246
253
|
{:else}
|
|
247
254
|
<a
|
|
248
|
-
href={
|
|
255
|
+
href={effectiveRouteMode === 'hash' ? `#${item.path}` : item.path}
|
|
249
256
|
class="flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-all duration-200
|
|
250
257
|
{active
|
|
251
258
|
? 'bg-sidebar-accent text-sidebar-accent-foreground sidebar-nav-active'
|