negodesign 0.0.26 → 0.0.27
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/components/core/breadcrumb/breadcrumb-list.svelte +31 -31
- package/dist/components/core/button/ButtonBack.svelte +18 -18
- package/dist/components/core/button/ButtonLogin.svelte +15 -15
- package/dist/components/core/button/ButtonLoginWith.svelte +57 -57
- package/dist/components/core/button/ButtonSend.svelte +15 -15
- package/dist/components/core/card/highlight/01/CardHighlight01.svelte +91 -91
- package/dist/components/core/card/highlight/02/CardHighlight02.svelte +93 -93
- package/dist/components/core/card/highlight/CardHighlight.svelte +22 -22
- package/dist/components/core/card/media/01/CardMedia01.svelte +111 -111
- package/dist/components/core/card/media/02/CardMedia02.svelte +110 -110
- package/dist/components/core/card/media/CardMedia.svelte +17 -17
- package/dist/components/core/card/profile/01/CardProfile01.svelte +98 -98
- package/dist/components/core/card/profile/02/CardProfile02.svelte +98 -98
- package/dist/components/core/card/profile/CardProfile.svelte +17 -17
- package/dist/components/core/card/promotion/CardPromotion.svelte +112 -112
- package/dist/components/core/card/shared/CardButton.svelte +30 -30
- package/dist/components/core/card/shared/CardCart.svelte +36 -36
- package/dist/components/core/card/shared/CardDescription.svelte +38 -38
- package/dist/components/core/card/shared/CardFavorite.svelte +33 -33
- package/dist/components/core/card/shared/CardStarRating.svelte +20 -20
- package/dist/components/core/card/shared/CardStartPrice.svelte +34 -34
- package/dist/components/core/card/shared/CardTags.svelte +73 -73
- package/dist/components/core/card/shared/CardThumbnailVideo.svelte +169 -169
- package/dist/components/core/card/shared/TruncatableText.svelte +55 -55
- package/dist/components/core/carousel/badge/ui/CarouselBadge.svelte +82 -83
- package/dist/components/core/carousel/hero/CarouselHero.svelte +158 -158
- package/dist/components/core/carousel/highlights/ui/CarouselHighlights.svelte +63 -63
- package/dist/components/core/carousel/promotion/ui/CarouselPromotion.svelte +64 -64
- package/dist/components/core/carousel/shared/ui/CarouselHeader.svelte +55 -55
- package/dist/components/core/datatable/ui/DataTableActions.svelte +28 -28
- package/dist/components/core/datatable/ui/DataTableCheckbox.svelte +22 -22
- package/dist/components/core/datatable/ui/DataTableContent.svelte +59 -59
- package/dist/components/core/datatable/ui/DataTableCore.svelte +151 -151
- package/dist/components/core/datatable/ui/DataTableDragHandle.svelte +8 -8
- package/dist/components/core/datatable/ui/DataTableListFilter.svelte +59 -59
- package/dist/components/core/datatable/ui/DataTableListPagination.svelte +35 -35
- package/dist/components/core/form/ui/input-base.svelte +81 -81
- package/dist/components/core/form/ui/input-email-or-phone.svelte +23 -23
- package/dist/components/core/form/ui/input-email.svelte +23 -23
- package/dist/components/core/form/ui/input-password-confirm.svelte +23 -23
- package/dist/components/core/form/ui/input-password.svelte +23 -23
- package/dist/components/core/form/ui/input-phone.svelte +33 -33
- package/dist/components/core/form/ui/input-username.svelte +22 -22
- package/dist/components/core/hero/SimpleHero.svelte +65 -65
- package/dist/components/core/label/LabelOr.svelte +25 -25
- package/dist/components/core/link/link-forget-password.svelte +12 -12
- package/dist/components/core/link/link-privacy-polity.svelte +12 -12
- package/dist/components/core/link/link-terms-of-service.svelte +12 -12
- package/dist/components/core/nav/ui/menu-links.svelte +27 -27
- package/dist/components/core/nav/ui/mobile/nav-menu-drawer.svelte +85 -85
- package/dist/components/core/nav/ui/nav-menu-bottom-sidebar.svelte +33 -33
- package/dist/components/core/nav/ui/nav-menu-sidebar.svelte +97 -97
- package/dist/components/core/nav/ui/nav-menu-top-bar-sidebar.svelte +103 -103
- package/dist/components/core/nav/ui/nav-menu.svelte +106 -106
- package/dist/components/core/panel/CarouselSlot.svelte +63 -63
- package/dist/components/core/panel/LeftHero.svelte +116 -116
- package/dist/components/core/search/SearchInput.svelte +32 -32
- package/dist/components/core/search/shared/SearchInputCore.svelte +66 -66
- package/dist/components/core/sidebar/MenuBarSidebar.svelte +70 -70
- package/dist/components/core/tabs/ui/tab-underline.svelte +43 -43
- package/dist/components/pages/admin/01/ui/AdminContent.svelte +14 -14
- package/dist/components/pages/admin/01/ui/AdminPanel.svelte +46 -46
- package/dist/components/pages/security/login/01/ui/FormRegister.svelte +28 -28
- package/dist/components/pages/security/login/01/ui/LoginCard.svelte +107 -107
- package/dist/components/pages/security/login/PageLogin.svelte +22 -22
- package/dist/components/ui/badge/badge.svelte +49 -49
- package/dist/components/ui/button/button.svelte +82 -82
- package/dist/components/ui/chart/chart-container.svelte +80 -80
- package/dist/components/ui/chart/chart-style.svelte +37 -37
- package/dist/components/ui/chart/chart-tooltip.svelte +184 -184
- package/dist/components/ui/checkbox/checkbox.svelte +40 -40
- package/dist/components/ui/data-table/flex-render.svelte +40 -40
- package/dist/components/ui/drawer/drawer-close.svelte +7 -7
- package/dist/components/ui/drawer/drawer-content.svelte +33 -33
- package/dist/components/ui/drawer/drawer-description.svelte +17 -17
- package/dist/components/ui/drawer/drawer-footer.svelte +20 -20
- package/dist/components/ui/drawer/drawer-header.svelte +20 -20
- package/dist/components/ui/drawer/drawer-nested.svelte +12 -12
- package/dist/components/ui/drawer/drawer-overlay.svelte +17 -17
- package/dist/components/ui/drawer/drawer-portal.svelte +7 -7
- package/dist/components/ui/drawer/drawer-title.svelte +17 -17
- package/dist/components/ui/drawer/drawer-trigger.svelte +7 -7
- package/dist/components/ui/drawer/drawer.svelte +12 -12
- package/dist/components/ui/select/select-content.svelte +45 -45
- package/dist/components/ui/select/select-group-heading.svelte +21 -21
- package/dist/components/ui/select/select-group.svelte +17 -17
- package/dist/components/ui/select/select-item.svelte +41 -41
- package/dist/components/ui/select/select-label.svelte +20 -20
- package/dist/components/ui/select/select-portal.svelte +7 -7
- package/dist/components/ui/select/select-scroll-down-button.svelte +21 -21
- package/dist/components/ui/select/select-scroll-up-button.svelte +21 -21
- package/dist/components/ui/select/select-separator.svelte +18 -18
- package/dist/components/ui/select/select-trigger.svelte +30 -30
- package/dist/components/ui/select/select.svelte +11 -11
- package/dist/components/ui/sidebar/sidebar-menu-sub-button.svelte +39 -39
- package/dist/components/ui/star-rating/star-rating-star.svelte +41 -41
- package/dist/components/ui/star-rating/star-rating.svelte +20 -20
- package/dist/components/ui/table/table-body.svelte +15 -15
- package/dist/components/ui/table/table-caption.svelte +20 -20
- package/dist/components/ui/table/table-cell.svelte +15 -15
- package/dist/components/ui/table/table-footer.svelte +20 -20
- package/dist/components/ui/table/table-head.svelte +15 -15
- package/dist/components/ui/table/table-header.svelte +20 -20
- package/dist/components/ui/table/table-row.svelte +15 -15
- package/dist/components/ui/table/table.svelte +17 -17
- package/dist/components/ui/tabs/tabs-content.svelte +17 -17
- package/dist/components/ui/tabs/tabs-list.svelte +40 -40
- package/dist/components/ui/tabs/tabs-trigger.svelte +23 -23
- package/dist/components/ui/tabs/tabs.svelte +19 -19
- package/dist/globals.css +3 -0
- package/dist/styles/globals.css +149 -149
- package/package.json +113 -113
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import Button from "../../../../ui/button/button.svelte";
|
|
3
|
-
import { t } from "../../../../../i18n";
|
|
4
|
-
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
5
|
-
import { ArrowRight02Icon } from "@hugeicons/core-free-icons";
|
|
6
|
-
import type { CarouselHeaderProps } from "../../types";
|
|
7
|
-
import type { Snippet } from "svelte";
|
|
8
|
-
|
|
9
|
-
type Props = {
|
|
10
|
-
children: Snippet;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const {
|
|
14
|
-
title,
|
|
15
|
-
description,
|
|
16
|
-
titleClass,
|
|
17
|
-
descriptionClass,
|
|
18
|
-
containerClass = "",
|
|
19
|
-
onButtonViewAll,
|
|
20
|
-
children,
|
|
21
|
-
}: CarouselHeaderProps & Props = $props();
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<div class="w-full flex justify-center">
|
|
25
|
-
<div class="w-[95%] p-2 rounded-xl border {containerClass}">
|
|
26
|
-
<div class="flex flex-col gap-1">
|
|
27
|
-
<div class="flex justify-between">
|
|
28
|
-
<div>
|
|
29
|
-
{#if title}
|
|
30
|
-
<h1 class={`text-xl ${titleClass}`}>{title}</h1>
|
|
31
|
-
{/if}
|
|
32
|
-
{#if description}
|
|
33
|
-
<div class={`mt-3 ${descriptionClass}`}>
|
|
34
|
-
{description}
|
|
35
|
-
</div>
|
|
36
|
-
{/if}
|
|
37
|
-
</div>
|
|
38
|
-
{#if onButtonViewAll}
|
|
39
|
-
<div>
|
|
40
|
-
<Button
|
|
41
|
-
variant="ghost"
|
|
42
|
-
size="sm"
|
|
43
|
-
class="flex items-center gap-0.5"
|
|
44
|
-
onclick={onButtonViewAll}
|
|
45
|
-
>
|
|
46
|
-
{$t("label.view.full")}
|
|
47
|
-
<HugeiconsIcon icon={ArrowRight02Icon} />
|
|
48
|
-
</Button>
|
|
49
|
-
</div>
|
|
50
|
-
{/if}
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
<div>{@render children()}</div>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Button from "../../../../ui/button/button.svelte";
|
|
3
|
+
import { t } from "../../../../../i18n";
|
|
4
|
+
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
5
|
+
import { ArrowRight02Icon } from "@hugeicons/core-free-icons";
|
|
6
|
+
import type { CarouselHeaderProps } from "../../types";
|
|
7
|
+
import type { Snippet } from "svelte";
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
children: Snippet;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
title,
|
|
15
|
+
description,
|
|
16
|
+
titleClass,
|
|
17
|
+
descriptionClass,
|
|
18
|
+
containerClass = "",
|
|
19
|
+
onButtonViewAll,
|
|
20
|
+
children,
|
|
21
|
+
}: CarouselHeaderProps & Props = $props();
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<div class="w-full flex justify-center">
|
|
25
|
+
<div class="w-[95%] p-2 rounded-xl border {containerClass}">
|
|
26
|
+
<div class="flex flex-col gap-1">
|
|
27
|
+
<div class="flex justify-between">
|
|
28
|
+
<div>
|
|
29
|
+
{#if title}
|
|
30
|
+
<h1 class={`text-xl ${titleClass}`}>{title}</h1>
|
|
31
|
+
{/if}
|
|
32
|
+
{#if description}
|
|
33
|
+
<div class={`mt-3 ${descriptionClass}`}>
|
|
34
|
+
{description}
|
|
35
|
+
</div>
|
|
36
|
+
{/if}
|
|
37
|
+
</div>
|
|
38
|
+
{#if onButtonViewAll}
|
|
39
|
+
<div>
|
|
40
|
+
<Button
|
|
41
|
+
variant="ghost"
|
|
42
|
+
size="sm"
|
|
43
|
+
class="flex items-center gap-0.5"
|
|
44
|
+
onclick={onButtonViewAll}
|
|
45
|
+
>
|
|
46
|
+
{$t("label.view.full")}
|
|
47
|
+
<HugeiconsIcon icon={ArrowRight02Icon} />
|
|
48
|
+
</Button>
|
|
49
|
+
</div>
|
|
50
|
+
{/if}
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
<div>{@render children()}</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
<script lang="ts" generics="T">
|
|
2
|
-
import type { CellContext } from "@tanstack/table-core";
|
|
3
|
-
import * as DropdownMenu from "../../../ui/dropdown-menu/index.js";
|
|
4
|
-
import Button from "../../../ui/button/button.svelte";
|
|
5
|
-
import { MoreHorizontalIcon } from "@hugeicons/core-free-icons";
|
|
6
|
-
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
7
|
-
|
|
8
|
-
let { row }: CellContext<T, unknown> = $props();
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<DropdownMenu.Root>
|
|
12
|
-
<DropdownMenu.Trigger>
|
|
13
|
-
{#snippet child({ props })}
|
|
14
|
-
<Button {...props} variant="ghost" class="size-8 p-0">
|
|
15
|
-
<HugeiconsIcon icon={MoreHorizontalIcon} class="size-4" />
|
|
16
|
-
<span class="sr-only">Open menu</span>
|
|
17
|
-
</Button>
|
|
18
|
-
{/snippet}
|
|
19
|
-
</DropdownMenu.Trigger>
|
|
20
|
-
<DropdownMenu.Content align="end">
|
|
21
|
-
<DropdownMenu.Item onclick={() => console.log(row.original)}
|
|
22
|
-
>Copy</DropdownMenu.Item
|
|
23
|
-
>
|
|
24
|
-
<DropdownMenu.Item onclick={() => console.log(row.original)}
|
|
25
|
-
>Delete</DropdownMenu.Item
|
|
26
|
-
>
|
|
27
|
-
</DropdownMenu.Content>
|
|
28
|
-
</DropdownMenu.Root>
|
|
1
|
+
<script lang="ts" generics="T">
|
|
2
|
+
import type { CellContext } from "@tanstack/table-core";
|
|
3
|
+
import * as DropdownMenu from "../../../ui/dropdown-menu/index.js";
|
|
4
|
+
import Button from "../../../ui/button/button.svelte";
|
|
5
|
+
import { MoreHorizontalIcon } from "@hugeicons/core-free-icons";
|
|
6
|
+
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
7
|
+
|
|
8
|
+
let { row }: CellContext<T, unknown> = $props();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<DropdownMenu.Root>
|
|
12
|
+
<DropdownMenu.Trigger>
|
|
13
|
+
{#snippet child({ props })}
|
|
14
|
+
<Button {...props} variant="ghost" class="size-8 p-0">
|
|
15
|
+
<HugeiconsIcon icon={MoreHorizontalIcon} class="size-4" />
|
|
16
|
+
<span class="sr-only">Open menu</span>
|
|
17
|
+
</Button>
|
|
18
|
+
{/snippet}
|
|
19
|
+
</DropdownMenu.Trigger>
|
|
20
|
+
<DropdownMenu.Content align="end">
|
|
21
|
+
<DropdownMenu.Item onclick={() => console.log(row.original)}
|
|
22
|
+
>Copy</DropdownMenu.Item
|
|
23
|
+
>
|
|
24
|
+
<DropdownMenu.Item onclick={() => console.log(row.original)}
|
|
25
|
+
>Delete</DropdownMenu.Item
|
|
26
|
+
>
|
|
27
|
+
</DropdownMenu.Content>
|
|
28
|
+
</DropdownMenu.Root>
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Checkbox } from "../../../ui/checkbox";
|
|
3
|
-
|
|
4
|
-
let {
|
|
5
|
-
checked = $bindable(false),
|
|
6
|
-
indeterminate = $bindable(false),
|
|
7
|
-
onCheckedChange,
|
|
8
|
-
...restProps
|
|
9
|
-
}: {
|
|
10
|
-
checked?: boolean;
|
|
11
|
-
indeterminate?: boolean;
|
|
12
|
-
onCheckedChange?: (value: boolean) => void;
|
|
13
|
-
[key: string]: unknown;
|
|
14
|
-
} = $props();
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<Checkbox
|
|
18
|
-
bind:checked
|
|
19
|
-
bind:indeterminate
|
|
20
|
-
onCheckedChange={(v) => onCheckedChange?.(!!v)}
|
|
21
|
-
{...restProps}
|
|
22
|
-
/>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Checkbox } from "../../../ui/checkbox";
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
checked = $bindable(false),
|
|
6
|
+
indeterminate = $bindable(false),
|
|
7
|
+
onCheckedChange,
|
|
8
|
+
...restProps
|
|
9
|
+
}: {
|
|
10
|
+
checked?: boolean;
|
|
11
|
+
indeterminate?: boolean;
|
|
12
|
+
onCheckedChange?: (value: boolean) => void;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
} = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<Checkbox
|
|
18
|
+
bind:checked
|
|
19
|
+
bind:indeterminate
|
|
20
|
+
onCheckedChange={(v) => onCheckedChange?.(!!v)}
|
|
21
|
+
{...restProps}
|
|
22
|
+
/>
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
<script lang="ts" generics="T">
|
|
2
|
-
import type {
|
|
3
|
-
ColumnDef,
|
|
4
|
-
Table as TanstackTable,
|
|
5
|
-
} from "@tanstack/table-core";
|
|
6
|
-
import * as Table from "../../../ui/table/index.js";
|
|
7
|
-
import FlexRender from "../../../ui/data-table/flex-render.svelte";
|
|
8
|
-
|
|
9
|
-
type Props = {
|
|
10
|
-
table: TanstackTable<T>;
|
|
11
|
-
columns: ColumnDef<T>[];
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
let { table, columns }: Props = $props();
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<div class="rounded-md border">
|
|
18
|
-
<Table.Root>
|
|
19
|
-
<Table.Header>
|
|
20
|
-
{#each table.getHeaderGroups() as headerGroup (headerGroup.id)}
|
|
21
|
-
<Table.Row>
|
|
22
|
-
{#each headerGroup.headers as header (header.id)}
|
|
23
|
-
<Table.Head class="[&:has([role=checkbox])]:ps-3">
|
|
24
|
-
{#if !header.isPlaceholder}
|
|
25
|
-
<FlexRender
|
|
26
|
-
content={header.column.columnDef.header}
|
|
27
|
-
context={header.getContext()}
|
|
28
|
-
/>
|
|
29
|
-
{/if}
|
|
30
|
-
</Table.Head>
|
|
31
|
-
{/each}
|
|
32
|
-
</Table.Row>
|
|
33
|
-
{/each}
|
|
34
|
-
</Table.Header>
|
|
35
|
-
<Table.Body>
|
|
36
|
-
{#each table.getRowModel().rows as row (row.id)}
|
|
37
|
-
<Table.Row data-state={row.getIsSelected() && "selected"}>
|
|
38
|
-
{#each row.getVisibleCells() as cell (cell.id)}
|
|
39
|
-
<Table.Cell class="[&:has([role=checkbox])]:ps-3">
|
|
40
|
-
<FlexRender
|
|
41
|
-
content={cell.column.columnDef.cell}
|
|
42
|
-
context={cell.getContext()}
|
|
43
|
-
/>
|
|
44
|
-
</Table.Cell>
|
|
45
|
-
{/each}
|
|
46
|
-
</Table.Row>
|
|
47
|
-
{:else}
|
|
48
|
-
<Table.Row>
|
|
49
|
-
<Table.Cell
|
|
50
|
-
colspan={columns.length}
|
|
51
|
-
class="h-24 text-center"
|
|
52
|
-
>
|
|
53
|
-
No results.
|
|
54
|
-
</Table.Cell>
|
|
55
|
-
</Table.Row>
|
|
56
|
-
{/each}
|
|
57
|
-
</Table.Body>
|
|
58
|
-
</Table.Root>
|
|
59
|
-
</div>
|
|
1
|
+
<script lang="ts" generics="T">
|
|
2
|
+
import type {
|
|
3
|
+
ColumnDef,
|
|
4
|
+
Table as TanstackTable,
|
|
5
|
+
} from "@tanstack/table-core";
|
|
6
|
+
import * as Table from "../../../ui/table/index.js";
|
|
7
|
+
import FlexRender from "../../../ui/data-table/flex-render.svelte";
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
table: TanstackTable<T>;
|
|
11
|
+
columns: ColumnDef<T>[];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
let { table, columns }: Props = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<div class="rounded-md border">
|
|
18
|
+
<Table.Root>
|
|
19
|
+
<Table.Header>
|
|
20
|
+
{#each table.getHeaderGroups() as headerGroup (headerGroup.id)}
|
|
21
|
+
<Table.Row>
|
|
22
|
+
{#each headerGroup.headers as header (header.id)}
|
|
23
|
+
<Table.Head class="[&:has([role=checkbox])]:ps-3">
|
|
24
|
+
{#if !header.isPlaceholder}
|
|
25
|
+
<FlexRender
|
|
26
|
+
content={header.column.columnDef.header}
|
|
27
|
+
context={header.getContext()}
|
|
28
|
+
/>
|
|
29
|
+
{/if}
|
|
30
|
+
</Table.Head>
|
|
31
|
+
{/each}
|
|
32
|
+
</Table.Row>
|
|
33
|
+
{/each}
|
|
34
|
+
</Table.Header>
|
|
35
|
+
<Table.Body>
|
|
36
|
+
{#each table.getRowModel().rows as row (row.id)}
|
|
37
|
+
<Table.Row data-state={row.getIsSelected() && "selected"}>
|
|
38
|
+
{#each row.getVisibleCells() as cell (cell.id)}
|
|
39
|
+
<Table.Cell class="[&:has([role=checkbox])]:ps-3">
|
|
40
|
+
<FlexRender
|
|
41
|
+
content={cell.column.columnDef.cell}
|
|
42
|
+
context={cell.getContext()}
|
|
43
|
+
/>
|
|
44
|
+
</Table.Cell>
|
|
45
|
+
{/each}
|
|
46
|
+
</Table.Row>
|
|
47
|
+
{:else}
|
|
48
|
+
<Table.Row>
|
|
49
|
+
<Table.Cell
|
|
50
|
+
colspan={columns.length}
|
|
51
|
+
class="h-24 text-center"
|
|
52
|
+
>
|
|
53
|
+
No results.
|
|
54
|
+
</Table.Cell>
|
|
55
|
+
</Table.Row>
|
|
56
|
+
{/each}
|
|
57
|
+
</Table.Body>
|
|
58
|
+
</Table.Root>
|
|
59
|
+
</div>
|
|
@@ -1,151 +1,151 @@
|
|
|
1
|
-
<script lang="ts" generics="T">
|
|
2
|
-
import {
|
|
3
|
-
type CellContext,
|
|
4
|
-
type ColumnDef,
|
|
5
|
-
type ColumnFiltersState,
|
|
6
|
-
type PaginationState,
|
|
7
|
-
type RowSelectionState,
|
|
8
|
-
type SortingState,
|
|
9
|
-
type VisibilityState,
|
|
10
|
-
getCoreRowModel,
|
|
11
|
-
getFilteredRowModel,
|
|
12
|
-
getPaginationRowModel,
|
|
13
|
-
getSortedRowModel,
|
|
14
|
-
} from "@tanstack/table-core";
|
|
15
|
-
import type { DataTableItem } from "../data/data-table";
|
|
16
|
-
import { resolveHeader } from "../data/resolve-header.svelte";
|
|
17
|
-
import { resolveCellBadge } from "../data/resolve-cell-badge.svelte";
|
|
18
|
-
import {
|
|
19
|
-
createDragColumn,
|
|
20
|
-
createSelectColumn,
|
|
21
|
-
} from "../data/columns-create";
|
|
22
|
-
import {
|
|
23
|
-
createSvelteTable,
|
|
24
|
-
renderComponent,
|
|
25
|
-
} from "../../../ui/data-table";
|
|
26
|
-
import DataTableListFilter from "./DataTableListFilter.svelte";
|
|
27
|
-
import DataTableContent from "./DataTableContent.svelte";
|
|
28
|
-
import DataTableListPagination from "./DataTableListPagination.svelte";
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Generic data table with pagination, sorting, and filtering.
|
|
32
|
-
* @property {DataTableItem<T>["config"]} config - Column definitions
|
|
33
|
-
* @property {keyof T} columnFilter - Key for column filtering
|
|
34
|
-
* @property {Component} actions - Per-row actions component
|
|
35
|
-
* @property {T[]} items - Table data
|
|
36
|
-
*/
|
|
37
|
-
let { config, columnFilter, actions, items = [] }: DataTableItem<T> = $props();
|
|
38
|
-
|
|
39
|
-
let columns: ColumnDef<T>[] = $derived([
|
|
40
|
-
createDragColumn<T>(),
|
|
41
|
-
createSelectColumn<T>(),
|
|
42
|
-
...config.map((it) => ({
|
|
43
|
-
accessorKey: it.accessorKey,
|
|
44
|
-
header: resolveHeader(it.header),
|
|
45
|
-
cell: resolveCellBadge(it.cell, it.badge),
|
|
46
|
-
enableSorting: it.enableSorting,
|
|
47
|
-
enableHiding: it.enableHiding,
|
|
48
|
-
})),
|
|
49
|
-
...(actions
|
|
50
|
-
? [{
|
|
51
|
-
id: "actions",
|
|
52
|
-
cell: (ctx: CellContext<T, unknown>) => renderComponent(actions, ctx as unknown),
|
|
53
|
-
enableSorting: false,
|
|
54
|
-
enableHiding: false,
|
|
55
|
-
} satisfies ColumnDef<T>]
|
|
56
|
-
: []),
|
|
57
|
-
]);
|
|
58
|
-
|
|
59
|
-
let pagination = $state<PaginationState>({ pageIndex: 0, pageSize: 10 });
|
|
60
|
-
let columnFilters = $state<ColumnFiltersState>([]);
|
|
61
|
-
let columnVisibility = $state<VisibilityState>({});
|
|
62
|
-
let rowSelection = $state<RowSelectionState>({});
|
|
63
|
-
let sorting = $state<SortingState>([]);
|
|
64
|
-
|
|
65
|
-
let table = $derived(
|
|
66
|
-
createSvelteTable({
|
|
67
|
-
data: items,
|
|
68
|
-
columns,
|
|
69
|
-
state: {
|
|
70
|
-
get pagination() {
|
|
71
|
-
return pagination;
|
|
72
|
-
},
|
|
73
|
-
get sorting() {
|
|
74
|
-
return sorting;
|
|
75
|
-
},
|
|
76
|
-
get columnVisibility() {
|
|
77
|
-
return columnVisibility;
|
|
78
|
-
},
|
|
79
|
-
get rowSelection() {
|
|
80
|
-
return rowSelection;
|
|
81
|
-
},
|
|
82
|
-
get columnFilters() {
|
|
83
|
-
return columnFilters;
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
getCoreRowModel: getCoreRowModel(),
|
|
87
|
-
getPaginationRowModel: getPaginationRowModel(),
|
|
88
|
-
getSortedRowModel: getSortedRowModel(),
|
|
89
|
-
getFilteredRowModel: getFilteredRowModel(),
|
|
90
|
-
onPaginationChange: (
|
|
91
|
-
updater:
|
|
92
|
-
| PaginationState
|
|
93
|
-
| ((arg0: PaginationState) => PaginationState),
|
|
94
|
-
) => {
|
|
95
|
-
if (typeof updater === "function") {
|
|
96
|
-
pagination = updater(pagination);
|
|
97
|
-
} else {
|
|
98
|
-
pagination = updater;
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
onSortingChange: (
|
|
102
|
-
updater: SortingState | ((arg0: SortingState) => SortingState),
|
|
103
|
-
) => {
|
|
104
|
-
if (typeof updater === "function") {
|
|
105
|
-
sorting = updater(sorting);
|
|
106
|
-
} else {
|
|
107
|
-
sorting = updater;
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
onColumnFiltersChange: (
|
|
111
|
-
updater:
|
|
112
|
-
| ColumnFiltersState
|
|
113
|
-
| ((arg0: ColumnFiltersState) => ColumnFiltersState),
|
|
114
|
-
) => {
|
|
115
|
-
if (typeof updater === "function") {
|
|
116
|
-
columnFilters = updater(columnFilters);
|
|
117
|
-
} else {
|
|
118
|
-
columnFilters = updater;
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
onColumnVisibilityChange: (
|
|
122
|
-
updater:
|
|
123
|
-
| VisibilityState
|
|
124
|
-
| ((arg0: VisibilityState) => VisibilityState),
|
|
125
|
-
) => {
|
|
126
|
-
if (typeof updater === "function") {
|
|
127
|
-
columnVisibility = updater(columnVisibility);
|
|
128
|
-
} else {
|
|
129
|
-
columnVisibility = updater;
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
onRowSelectionChange: (
|
|
133
|
-
updater:
|
|
134
|
-
| RowSelectionState
|
|
135
|
-
| ((arg0: RowSelectionState) => RowSelectionState),
|
|
136
|
-
) => {
|
|
137
|
-
if (typeof updater === "function") {
|
|
138
|
-
rowSelection = updater(rowSelection);
|
|
139
|
-
} else {
|
|
140
|
-
rowSelection = updater;
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
}),
|
|
144
|
-
);
|
|
145
|
-
</script>
|
|
146
|
-
|
|
147
|
-
<div class="-mb-8 w-full">
|
|
148
|
-
<DataTableListFilter {table} column={columnFilter} />
|
|
149
|
-
<DataTableContent {table} {columns} />
|
|
150
|
-
<DataTableListPagination {table} />
|
|
151
|
-
</div>
|
|
1
|
+
<script lang="ts" generics="T">
|
|
2
|
+
import {
|
|
3
|
+
type CellContext,
|
|
4
|
+
type ColumnDef,
|
|
5
|
+
type ColumnFiltersState,
|
|
6
|
+
type PaginationState,
|
|
7
|
+
type RowSelectionState,
|
|
8
|
+
type SortingState,
|
|
9
|
+
type VisibilityState,
|
|
10
|
+
getCoreRowModel,
|
|
11
|
+
getFilteredRowModel,
|
|
12
|
+
getPaginationRowModel,
|
|
13
|
+
getSortedRowModel,
|
|
14
|
+
} from "@tanstack/table-core";
|
|
15
|
+
import type { DataTableItem } from "../data/data-table";
|
|
16
|
+
import { resolveHeader } from "../data/resolve-header.svelte";
|
|
17
|
+
import { resolveCellBadge } from "../data/resolve-cell-badge.svelte";
|
|
18
|
+
import {
|
|
19
|
+
createDragColumn,
|
|
20
|
+
createSelectColumn,
|
|
21
|
+
} from "../data/columns-create";
|
|
22
|
+
import {
|
|
23
|
+
createSvelteTable,
|
|
24
|
+
renderComponent,
|
|
25
|
+
} from "../../../ui/data-table";
|
|
26
|
+
import DataTableListFilter from "./DataTableListFilter.svelte";
|
|
27
|
+
import DataTableContent from "./DataTableContent.svelte";
|
|
28
|
+
import DataTableListPagination from "./DataTableListPagination.svelte";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Generic data table with pagination, sorting, and filtering.
|
|
32
|
+
* @property {DataTableItem<T>["config"]} config - Column definitions
|
|
33
|
+
* @property {keyof T} columnFilter - Key for column filtering
|
|
34
|
+
* @property {Component} actions - Per-row actions component
|
|
35
|
+
* @property {T[]} items - Table data
|
|
36
|
+
*/
|
|
37
|
+
let { config, columnFilter, actions, items = [] }: DataTableItem<T> = $props();
|
|
38
|
+
|
|
39
|
+
let columns: ColumnDef<T>[] = $derived([
|
|
40
|
+
createDragColumn<T>(),
|
|
41
|
+
createSelectColumn<T>(),
|
|
42
|
+
...config.map((it) => ({
|
|
43
|
+
accessorKey: it.accessorKey,
|
|
44
|
+
header: resolveHeader(it.header),
|
|
45
|
+
cell: resolveCellBadge(it.cell, it.badge),
|
|
46
|
+
enableSorting: it.enableSorting,
|
|
47
|
+
enableHiding: it.enableHiding,
|
|
48
|
+
})),
|
|
49
|
+
...(actions
|
|
50
|
+
? [{
|
|
51
|
+
id: "actions",
|
|
52
|
+
cell: (ctx: CellContext<T, unknown>) => renderComponent(actions, ctx as unknown),
|
|
53
|
+
enableSorting: false,
|
|
54
|
+
enableHiding: false,
|
|
55
|
+
} satisfies ColumnDef<T>]
|
|
56
|
+
: []),
|
|
57
|
+
]);
|
|
58
|
+
|
|
59
|
+
let pagination = $state<PaginationState>({ pageIndex: 0, pageSize: 10 });
|
|
60
|
+
let columnFilters = $state<ColumnFiltersState>([]);
|
|
61
|
+
let columnVisibility = $state<VisibilityState>({});
|
|
62
|
+
let rowSelection = $state<RowSelectionState>({});
|
|
63
|
+
let sorting = $state<SortingState>([]);
|
|
64
|
+
|
|
65
|
+
let table = $derived(
|
|
66
|
+
createSvelteTable({
|
|
67
|
+
data: items,
|
|
68
|
+
columns,
|
|
69
|
+
state: {
|
|
70
|
+
get pagination() {
|
|
71
|
+
return pagination;
|
|
72
|
+
},
|
|
73
|
+
get sorting() {
|
|
74
|
+
return sorting;
|
|
75
|
+
},
|
|
76
|
+
get columnVisibility() {
|
|
77
|
+
return columnVisibility;
|
|
78
|
+
},
|
|
79
|
+
get rowSelection() {
|
|
80
|
+
return rowSelection;
|
|
81
|
+
},
|
|
82
|
+
get columnFilters() {
|
|
83
|
+
return columnFilters;
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
getCoreRowModel: getCoreRowModel(),
|
|
87
|
+
getPaginationRowModel: getPaginationRowModel(),
|
|
88
|
+
getSortedRowModel: getSortedRowModel(),
|
|
89
|
+
getFilteredRowModel: getFilteredRowModel(),
|
|
90
|
+
onPaginationChange: (
|
|
91
|
+
updater:
|
|
92
|
+
| PaginationState
|
|
93
|
+
| ((arg0: PaginationState) => PaginationState),
|
|
94
|
+
) => {
|
|
95
|
+
if (typeof updater === "function") {
|
|
96
|
+
pagination = updater(pagination);
|
|
97
|
+
} else {
|
|
98
|
+
pagination = updater;
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
onSortingChange: (
|
|
102
|
+
updater: SortingState | ((arg0: SortingState) => SortingState),
|
|
103
|
+
) => {
|
|
104
|
+
if (typeof updater === "function") {
|
|
105
|
+
sorting = updater(sorting);
|
|
106
|
+
} else {
|
|
107
|
+
sorting = updater;
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
onColumnFiltersChange: (
|
|
111
|
+
updater:
|
|
112
|
+
| ColumnFiltersState
|
|
113
|
+
| ((arg0: ColumnFiltersState) => ColumnFiltersState),
|
|
114
|
+
) => {
|
|
115
|
+
if (typeof updater === "function") {
|
|
116
|
+
columnFilters = updater(columnFilters);
|
|
117
|
+
} else {
|
|
118
|
+
columnFilters = updater;
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
onColumnVisibilityChange: (
|
|
122
|
+
updater:
|
|
123
|
+
| VisibilityState
|
|
124
|
+
| ((arg0: VisibilityState) => VisibilityState),
|
|
125
|
+
) => {
|
|
126
|
+
if (typeof updater === "function") {
|
|
127
|
+
columnVisibility = updater(columnVisibility);
|
|
128
|
+
} else {
|
|
129
|
+
columnVisibility = updater;
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
onRowSelectionChange: (
|
|
133
|
+
updater:
|
|
134
|
+
| RowSelectionState
|
|
135
|
+
| ((arg0: RowSelectionState) => RowSelectionState),
|
|
136
|
+
) => {
|
|
137
|
+
if (typeof updater === "function") {
|
|
138
|
+
rowSelection = updater(rowSelection);
|
|
139
|
+
} else {
|
|
140
|
+
rowSelection = updater;
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
}),
|
|
144
|
+
);
|
|
145
|
+
</script>
|
|
146
|
+
|
|
147
|
+
<div class="-mb-8 w-full">
|
|
148
|
+
<DataTableListFilter {table} column={columnFilter} />
|
|
149
|
+
<DataTableContent {table} {columns} />
|
|
150
|
+
<DataTableListPagination {table} />
|
|
151
|
+
</div>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { GripVerticalIcon } from "@hugeicons/core-free-icons";
|
|
3
|
-
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
<button class="cursor-grab opacity-60 hover:opacity-100 w-min">
|
|
7
|
-
<HugeiconsIcon icon={GripVerticalIcon} class="size-4" />
|
|
8
|
-
</button>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { GripVerticalIcon } from "@hugeicons/core-free-icons";
|
|
3
|
+
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<button class="cursor-grab opacity-60 hover:opacity-100 w-min">
|
|
7
|
+
<HugeiconsIcon icon={GripVerticalIcon} class="size-4" />
|
|
8
|
+
</button>
|