@nccirtu/tablefy 0.6.0 → 0.6.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/cli/templates/tablefy/data-table-empty.tsx +1 -1
- package/cli/templates/tablefy/data-table-header.tsx +4 -2
- package/cli/templates/tablefy/data-table-pagination.tsx +4 -2
- package/cli/templates/tablefy/data-table.tsx +1 -2
- package/dist/columns/tablefy/data-table-empty.d.ts +1 -1
- package/dist/columns/tablefy/data-table-header.d.ts +1 -1
- package/dist/columns/tablefy/data-table-pagination.d.ts +1 -1
- package/dist/columns/tablefy/data-table.d.ts +1 -1
- package/dist/index.esm.js +3 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/tablefy/data-table-empty.d.ts +1 -1
- package/dist/tablefy/data-table-header.d.ts +1 -1
- package/dist/tablefy/data-table-pagination.d.ts +1 -1
- package/dist/tablefy/data-table.d.ts +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// shadcn components - installed by user
|
|
4
4
|
import { Button } from "@/components/ui/button";
|
|
5
5
|
import { cn } from "@/lib/utils";
|
|
6
|
-
import { EmptyStateConfig } from "
|
|
6
|
+
import { EmptyStateConfig } from "@nccirtu/tablefy";
|
|
7
7
|
|
|
8
8
|
interface DataTableEmptyProps {
|
|
9
9
|
config: EmptyStateConfig;
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "@/components/ui/dropdown-menu";
|
|
13
13
|
import { ChevronDown, Search, X } from "lucide-react";
|
|
14
14
|
import { cn } from "@/lib/utils";
|
|
15
|
-
import { HeaderAction, SearchConfig } from "
|
|
15
|
+
import { HeaderAction, SearchConfig } from "@nccirtu/tablefy";
|
|
16
16
|
|
|
17
17
|
interface DataTableHeaderProps<TData> {
|
|
18
18
|
title?: string;
|
|
@@ -176,7 +176,9 @@ export function DataTableHeader<TData>({
|
|
|
176
176
|
<Input
|
|
177
177
|
placeholder={search.placeholder || "Suchen..."}
|
|
178
178
|
value={searchValue}
|
|
179
|
-
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
|
179
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
|
180
|
+
onSearchChange?.(e.target.value)
|
|
181
|
+
}
|
|
180
182
|
className="pl-9 pr-9"
|
|
181
183
|
/>
|
|
182
184
|
{searchValue && (
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
ChevronsRight,
|
|
18
18
|
} from "lucide-react";
|
|
19
19
|
import { cn } from "@/lib/utils";
|
|
20
|
-
import { PaginationConfig } from "
|
|
20
|
+
import { PaginationConfig } from "@nccirtu/tablefy";
|
|
21
21
|
|
|
22
22
|
interface DataTablePaginationProps<TData> {
|
|
23
23
|
table: TanstackTable<TData>;
|
|
@@ -64,7 +64,9 @@ export function DataTablePagination<TData>({
|
|
|
64
64
|
</span>
|
|
65
65
|
<Select
|
|
66
66
|
value={`${table.getState().pagination.pageSize}`}
|
|
67
|
-
onValueChange={(value: string) =>
|
|
67
|
+
onValueChange={(value: string) =>
|
|
68
|
+
table.setPageSize(Number(value))
|
|
69
|
+
}
|
|
68
70
|
>
|
|
69
71
|
<SelectTrigger className="h-8 w-[70px]">
|
|
70
72
|
<SelectValue
|
|
@@ -23,11 +23,10 @@ import {
|
|
|
23
23
|
TableRow,
|
|
24
24
|
} from "@/components/ui/table";
|
|
25
25
|
import { cn } from "@/lib/utils";
|
|
26
|
-
import { DataTableConfig } from "
|
|
26
|
+
import { DataTableConfig, EmptyStateBuilder } from "@nccirtu/tablefy";
|
|
27
27
|
import { DataTableHeader } from "./data-table-header";
|
|
28
28
|
import { DataTableEmpty } from "./data-table-empty";
|
|
29
29
|
import { DataTablePagination } from "./data-table-pagination";
|
|
30
|
-
import { EmptyStateBuilder } from "@/lib/builders";
|
|
31
30
|
|
|
32
31
|
interface DataTableProps<TData, TValue> {
|
|
33
32
|
columns: ColumnDef<TData, TValue>[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Table as TanstackTable } from "@tanstack/react-table";
|
|
2
|
-
import { PaginationConfig } from "
|
|
2
|
+
import { PaginationConfig } from "../lib/types";
|
|
3
3
|
interface DataTablePaginationProps<TData> {
|
|
4
4
|
table: TanstackTable<TData>;
|
|
5
5
|
config?: PaginationConfig;
|
package/dist/index.esm.js
CHANGED
|
@@ -64,7 +64,9 @@ function DataTablePagination({ table, config, className, }) {
|
|
|
64
64
|
if (!config?.enabled)
|
|
65
65
|
return null;
|
|
66
66
|
const { showPageInfo = true, showPageSizeSelector = true, pageSizeOptions = [10, 20, 30, 50, 100], } = config;
|
|
67
|
-
return (jsxs("div", { className: cn("flex flex-col gap-4 px-4 py-4 sm:flex-row sm:items-center sm:justify-between", className), children: [jsx("div", { className: "text-sm text-muted-foreground", children: table.getFilteredSelectedRowModel().rows.length > 0 ? (jsxs("span", { children: [table.getFilteredSelectedRowModel().rows.length, " von", " ", table.getFilteredRowModel().rows.length, " Zeile(n) ausgew\u00E4hlt"] })) : showPageInfo ? (jsxs("span", { children: [table.getFilteredRowModel().rows.length, " Eintr\u00E4ge"] })) : null }), jsxs("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:gap-6", children: [showPageSizeSelector && (jsxs("div", { className: "flex items-center gap-2", children: [jsx("span", { className: "text-sm text-muted-foreground whitespace-nowrap", children: "Zeilen pro Seite" }), jsxs(Select, { value: `${table.getState().pagination.pageSize}`, onValueChange: (value) => table.setPageSize(Number(value)), children: [jsx(SelectTrigger, { className: "h-8 w-[70px]", children: jsx(SelectValue, { placeholder: table.getState().pagination.pageSize }) }), jsx(SelectContent, { side: "top", children: pageSizeOptions.map((pageSize) => (jsx(SelectItem, { value: `${pageSize}`, children: pageSize }, pageSize))) })] })] })), showPageInfo && (jsxs("div", { className: "text-sm text-muted-foreground whitespace-nowrap", children: ["Seite
|
|
67
|
+
return (jsxs("div", { className: cn("flex flex-col gap-4 px-4 py-4 sm:flex-row sm:items-center sm:justify-between", className), children: [jsx("div", { className: "text-sm text-muted-foreground", children: table.getFilteredSelectedRowModel().rows.length > 0 ? (jsxs("span", { children: [table.getFilteredSelectedRowModel().rows.length, " von", " ", table.getFilteredRowModel().rows.length, " Zeile(n) ausgew\u00E4hlt"] })) : showPageInfo ? (jsxs("span", { children: [table.getFilteredRowModel().rows.length, " Eintr\u00E4ge"] })) : null }), jsxs("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:gap-6", children: [showPageSizeSelector && (jsxs("div", { className: "flex items-center gap-2", children: [jsx("span", { className: "text-sm text-muted-foreground whitespace-nowrap", children: "Zeilen pro Seite" }), jsxs(Select, { value: `${table.getState().pagination.pageSize}`, onValueChange: (value) => table.setPageSize(Number(value)), children: [jsx(SelectTrigger, { className: "h-8 w-[70px]", children: jsx(SelectValue, { placeholder: table.getState().pagination.pageSize }) }), jsx(SelectContent, { side: "top", children: pageSizeOptions.map((pageSize) => (jsx(SelectItem, { value: `${pageSize}`, children: pageSize }, pageSize))) })] })] })), showPageInfo && (jsxs("div", { className: "text-sm text-muted-foreground whitespace-nowrap", children: ["Seite", " ", table.getPageCount() > 0
|
|
68
|
+
? table.getState().pagination.pageIndex + 1
|
|
69
|
+
: 0, " ", "von ", Math.max(table.getPageCount(), 0)] })), jsxs("div", { className: "flex items-center gap-1", children: [jsxs(Button, { variant: "outline", size: "icon", className: "h-8 w-8", onClick: () => table.setPageIndex(0), disabled: !table.getCanPreviousPage(), children: [jsx(ChevronsLeft, { className: "h-4 w-4" }), jsx("span", { className: "sr-only", children: "Erste Seite" })] }), jsxs(Button, { variant: "outline", size: "icon", className: "h-8 w-8", onClick: () => table.previousPage(), disabled: !table.getCanPreviousPage(), children: [jsx(ChevronLeft, { className: "h-4 w-4" }), jsx("span", { className: "sr-only", children: "Vorherige Seite" })] }), jsxs(Button, { variant: "outline", size: "icon", className: "h-8 w-8", onClick: () => table.nextPage(), disabled: !table.getCanNextPage(), children: [jsx(ChevronRight, { className: "h-4 w-4" }), jsx("span", { className: "sr-only", children: "N\u00E4chste Seite" })] }), jsxs(Button, { variant: "outline", size: "icon", className: "h-8 w-8", onClick: () => table.setPageIndex(table.getPageCount() - 1), disabled: !table.getCanNextPage(), children: [jsx(ChevronsRight, { className: "h-4 w-4" }), jsx("span", { className: "sr-only", children: "Letzte Seite" })] })] })] })] }));
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
/**
|