@svadmin/ui 0.23.2 → 0.24.1
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.1",
|
|
4
4
|
"description": "Pre-built admin UI components — AdminApp, AutoTable, AutoForm, Sidebar, Layout",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@svadmin/core": "^0.19.3",
|
|
24
24
|
"@tanstack/svelte-query": "^6.0.0",
|
|
25
|
-
"highlight.js": "^11.
|
|
26
|
-
"isomorphic-dompurify": "^
|
|
27
|
-
"marked": "^
|
|
28
|
-
"marked-highlight": "^2.2.
|
|
25
|
+
"highlight.js": "^11.11.1",
|
|
26
|
+
"isomorphic-dompurify": "^3.7.1",
|
|
27
|
+
"marked": "^17.0.5",
|
|
28
|
+
"marked-highlight": "^2.2.3",
|
|
29
29
|
"svelte": "^5.0.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependenciesMeta": {
|
|
@@ -388,64 +388,78 @@
|
|
|
388
388
|
</div>
|
|
389
389
|
</div>
|
|
390
390
|
|
|
391
|
-
<!-- Search -->
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
<
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
391
|
+
<!-- Search and Advanced Filters -->
|
|
392
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
393
|
+
{#if searchableFields.length > 0}
|
|
394
|
+
<div class="relative max-w-sm flex-1 sm:min-w-[250px]">
|
|
395
|
+
<Search class="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
|
|
396
|
+
<Input
|
|
397
|
+
type="text"
|
|
398
|
+
bind:value={searchText}
|
|
399
|
+
oninput={() => { pagination = { ...pagination, current: 1 }; }}
|
|
400
|
+
placeholder={t('common.search')}
|
|
401
|
+
class="pl-10 h-9"
|
|
402
|
+
/>
|
|
403
|
+
</div>
|
|
404
|
+
{/if}
|
|
404
405
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
{/if}
|
|
416
|
-
</Button>
|
|
417
|
-
{/snippet}
|
|
418
|
-
</Popover.Trigger>
|
|
419
|
-
<Popover.Content class="w-80">
|
|
420
|
-
<div class="space-y-3">
|
|
421
|
-
<h4 class="font-medium text-sm">{t('common.filter')}</h4>
|
|
422
|
-
{#each filterableFields as field}
|
|
423
|
-
<div class="space-y-1">
|
|
424
|
-
<label class="text-xs text-muted-foreground" for="filter-{field.key}">{field.label}</label>
|
|
425
|
-
<Input
|
|
426
|
-
id="filter-{field.key}"
|
|
427
|
-
type="text"
|
|
428
|
-
bind:value={filterValues[field.key]}
|
|
429
|
-
placeholder={field.label}
|
|
430
|
-
class="h-8 text-sm"
|
|
431
|
-
/>
|
|
432
|
-
</div>
|
|
433
|
-
{/each}
|
|
434
|
-
<div class="flex gap-2">
|
|
435
|
-
<Button size="sm" class="flex-1" onclick={() => { pagination = { ...pagination, current: 1 }; }}>
|
|
436
|
-
{t('common.confirm')}
|
|
437
|
-
</Button>
|
|
438
|
-
<Button variant="outline" size="sm" onclick={() => {
|
|
439
|
-
filterValues = {};
|
|
440
|
-
pagination = { ...pagination, current: 1 };
|
|
441
|
-
}}>
|
|
442
|
-
{t('common.reset')}
|
|
406
|
+
{#if filterableFields.length > 0}
|
|
407
|
+
<Popover.Root>
|
|
408
|
+
<Popover.Trigger>
|
|
409
|
+
{#snippet child({ props })}
|
|
410
|
+
<Button variant="outline" size="sm" class="h-9 px-3" {...props}>
|
|
411
|
+
<FilterIcon class="h-4 w-4" data-icon="inline-start" />
|
|
412
|
+
{t('common.filter')}
|
|
413
|
+
{#if activeFilterCount > 0}
|
|
414
|
+
<Badge variant="secondary" class="ml-1 h-5 min-w-5 px-1">{activeFilterCount}</Badge>
|
|
415
|
+
{/if}
|
|
443
416
|
</Button>
|
|
417
|
+
{/snippet}
|
|
418
|
+
</Popover.Trigger>
|
|
419
|
+
<Popover.Content class="w-80">
|
|
420
|
+
<div class="space-y-3">
|
|
421
|
+
<h4 class="font-medium text-sm">{t('common.filter')}</h4>
|
|
422
|
+
{#each filterableFields as field}
|
|
423
|
+
<div class="space-y-1">
|
|
424
|
+
<label class="text-xs text-muted-foreground" for="filter-{field.key}">{field.label}</label>
|
|
425
|
+
{#if field.type === 'select' && field.options}
|
|
426
|
+
<Select
|
|
427
|
+
id="filter-{field.key}"
|
|
428
|
+
class="h-9 text-sm w-full font-normal"
|
|
429
|
+
bind:value={filterValues[field.key]}
|
|
430
|
+
>
|
|
431
|
+
<option value="">全部</option>
|
|
432
|
+
{#each field.options as opt}
|
|
433
|
+
<option value={opt.value}>{opt.label}</option>
|
|
434
|
+
{/each}
|
|
435
|
+
</Select>
|
|
436
|
+
{:else}
|
|
437
|
+
<Input
|
|
438
|
+
id="filter-{field.key}"
|
|
439
|
+
type="text"
|
|
440
|
+
bind:value={filterValues[field.key]}
|
|
441
|
+
placeholder={field.label}
|
|
442
|
+
class="h-9 text-sm"
|
|
443
|
+
/>
|
|
444
|
+
{/if}
|
|
445
|
+
</div>
|
|
446
|
+
{/each}
|
|
447
|
+
<div class="flex gap-2 pt-2">
|
|
448
|
+
<Button size="sm" class="flex-1" onclick={() => { pagination = { ...pagination, current: 1 }; }}>
|
|
449
|
+
{t('common.confirm')}
|
|
450
|
+
</Button>
|
|
451
|
+
<Button variant="outline" size="sm" onclick={() => {
|
|
452
|
+
filterValues = {};
|
|
453
|
+
pagination = { ...pagination, current: 1 };
|
|
454
|
+
}}>
|
|
455
|
+
{t('common.reset')}
|
|
456
|
+
</Button>
|
|
457
|
+
</div>
|
|
444
458
|
</div>
|
|
445
|
-
</
|
|
446
|
-
</Popover.
|
|
447
|
-
|
|
448
|
-
|
|
459
|
+
</Popover.Content>
|
|
460
|
+
</Popover.Root>
|
|
461
|
+
{/if}
|
|
462
|
+
</div>
|
|
449
463
|
|
|
450
464
|
<!-- Table (TanStack-powered) -->
|
|
451
465
|
<div class="rounded-lg bg-card shadow-sm ring-1 ring-border/10 overflow-hidden" role="region" aria-label="{resource.label} {t('common.list')}">
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import { Avatar } from './ui/avatar/index.js';
|
|
15
15
|
import {
|
|
16
16
|
LayoutDashboard, FileText, Users, Settings, Home,
|
|
17
|
-
ChevronLeft, ChevronDown, LogOut, Sun, Moon, Palette
|
|
17
|
+
ChevronLeft, ChevronRight, ChevronDown, LogOut, Sun, Moon, Palette
|
|
18
18
|
} from 'lucide-svelte';
|
|
19
19
|
|
|
20
20
|
let { collapsed, identity, title, onToggle, onLogout, menu, routeMode = 'auto' }: {
|
|
@@ -181,7 +181,9 @@
|
|
|
181
181
|
<ChevronLeft class="h-4 w-4" />
|
|
182
182
|
</TooltipButton>
|
|
183
183
|
{:else}
|
|
184
|
-
<
|
|
184
|
+
<TooltipButton tooltip={t('common.toggleSidebar')} variant="ghost" size="icon-sm" onclick={onToggle} class="mx-auto mt-2 mb-2 block">
|
|
185
|
+
<ChevronRight class="h-4 w-4" />
|
|
186
|
+
</TooltipButton>
|
|
185
187
|
{/if}
|
|
186
188
|
</div>
|
|
187
189
|
|