@svadmin/ui 0.32.10 → 0.33.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.
|
@@ -9,7 +9,13 @@
|
|
|
9
9
|
type ColumnVisibilityState,
|
|
10
10
|
type ExpandedState,
|
|
11
11
|
} from '@tanstack/svelte-table';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
createCoreRowModel,
|
|
14
|
+
column_getCanSort,
|
|
15
|
+
column_getIsSorted,
|
|
16
|
+
column_toggleSorting,
|
|
17
|
+
header_getSize
|
|
18
|
+
} from '@tanstack/table-core';
|
|
13
19
|
|
|
14
20
|
import { useList, useDelete, useDeleteMany, getResource, notify } from '@svadmin/core';
|
|
15
21
|
import type { Pagination as PaginationState, Sort, Filter, FieldDefinition } from '@svadmin/core';
|
|
@@ -557,7 +563,7 @@
|
|
|
557
563
|
<Table.Head
|
|
558
564
|
{...dragProps}
|
|
559
565
|
class={cn("bg-transparent hover:bg-muted/10 border-b border-border/20 uppercase tracking-[0.12em] text-[10px] text-muted-foreground/70 font-semibold py-4", dragProps.class)}
|
|
560
|
-
style={header
|
|
566
|
+
style={header_getSize(header) != null && header_getSize(header) !== 150 ? `width:${header_getSize(header)}px` : undefined}
|
|
561
567
|
>
|
|
562
568
|
{#if header.id === '_select'}
|
|
563
569
|
<Checkbox
|
|
@@ -568,17 +574,17 @@
|
|
|
568
574
|
<!-- empty -->
|
|
569
575
|
{:else if header.id === '_actions'}
|
|
570
576
|
<span class="text-right block">{t('common.actions')}</span>
|
|
571
|
-
{:else if header.column
|
|
577
|
+
{:else if column_getCanSort(header.column)}
|
|
572
578
|
<Button
|
|
573
579
|
variant="ghost"
|
|
574
580
|
size="sm"
|
|
575
581
|
class="flex items-center gap-1 hover:text-foreground -ml-2 h-auto py-1 px-2 uppercase tracking-wide text-[0.7rem] font-semibold"
|
|
576
|
-
onclick={() => header.column
|
|
582
|
+
onclick={() => column_toggleSorting(header.column)}
|
|
577
583
|
>
|
|
578
584
|
{visibleFields.find(f => f.key === header.id)?.label ?? header.id}
|
|
579
585
|
<span class="text-xs opacity-50">
|
|
580
|
-
{#if header.column
|
|
581
|
-
{:else if header.column
|
|
586
|
+
{#if column_getIsSorted(header.column) === 'asc'}↑
|
|
587
|
+
{:else if column_getIsSorted(header.column) === 'desc'}↓
|
|
582
588
|
{:else}⇅
|
|
583
589
|
{/if}
|
|
584
590
|
</span>
|
|
@@ -27,8 +27,9 @@
|
|
|
27
27
|
folder: Folder,
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
function getIcon(name?: string): typeof LayoutDashboard {
|
|
30
|
+
function getIcon(name?: string | any): typeof LayoutDashboard {
|
|
31
31
|
if (!name) return depth === 0 ? Settings : Folder;
|
|
32
|
+
if (typeof name !== 'string') return name; // if it's already a component
|
|
32
33
|
return iconMap[name] ?? Settings;
|
|
33
34
|
}
|
|
34
35
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "Pre-built admin UI components — AdminApp, AutoTable, AutoForm, Sidebar, Layout",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"./components/*": "./dist/components/*"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@svadmin/core": "^0.
|
|
30
|
+
"@svadmin/core": "^0.24.0",
|
|
31
31
|
"@tanstack/svelte-query": "^6.0.0",
|
|
32
32
|
"highlight.js": "^11.11.1",
|
|
33
33
|
"isomorphic-dompurify": "^3.7.1",
|