@nccirtu/tablefy 0.6.0 → 0.6.2
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/README.md +7 -2
- 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/index.esm.js +1 -5
- package/dist/columns/index.esm.js.map +1 -1
- package/dist/columns/index.js +28 -32
- package/dist/columns/index.js.map +1 -1
- 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 +4 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +37 -39
- 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
package/README.md
CHANGED
|
@@ -39,11 +39,16 @@ npm install @tanstack/react-table lucide-react class-variance-authority clsx tai
|
|
|
39
39
|
# 2. Install shadcn components
|
|
40
40
|
npx shadcn@latest add button table checkbox dropdown-menu input select badge progress tooltip
|
|
41
41
|
|
|
42
|
-
# 3. Configure Tailwind (see
|
|
42
|
+
# 3. Configure Tailwind (see INSTALLATION.md for framework-specific instructions)
|
|
43
43
|
|
|
44
|
-
# 4.
|
|
44
|
+
# 4. For Laravel/Vite: Add alias configuration to vite.config.js
|
|
45
|
+
# See INSTALLATION.md Step 6 for details
|
|
46
|
+
|
|
47
|
+
# 5. Restart dev server
|
|
45
48
|
```
|
|
46
49
|
|
|
50
|
+
**Laravel/Vite Users:** You must configure the `@` alias in your `vite.config.js` to resolve imports correctly. See [INSTALLATION.md](./INSTALLATION.md#step-6-configure-vite-laravelvite-projects) for details.
|
|
51
|
+
|
|
47
52
|
## Quick Start
|
|
48
53
|
|
|
49
54
|
```tsx
|
|
@@ -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 { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
2
|
+
import { cn } from '@/lib/utils';
|
|
3
3
|
import { Badge } from '@/components/ui/badge';
|
|
4
4
|
import { Button } from '@/components/ui/button';
|
|
5
5
|
import { ArrowUpDown, Calendar, ExternalLink, MoreHorizontal } from 'lucide-react';
|
|
@@ -15,10 +15,6 @@ const AvatarList = ({ items, maxVisible = 5, size = 32, ...props }) => {
|
|
|
15
15
|
return (jsxs("div", { className: "avatar-list", style: { "--avatar-size": `${sizeValue}px` }, ...props, children: [items.slice(0, maxVisible).map((item) => (jsx("div", { className: "avatar-item", children: item.src ? (jsx("img", { src: item.src, alt: item.alt || "Avatar", style: { width: `${sizeValue}px`, height: `${sizeValue}px` } })) : (jsx("div", { className: "avatar-initials", style: { width: `${sizeValue}px`, height: `${sizeValue}px` }, children: item.initials || "?" })) }, item.id))), items.length > maxVisible && (jsxs("div", { className: "avatar-count", style: { width: `${sizeValue}px`, height: `${sizeValue}px` }, children: ["+", items.length - maxVisible] }))] }));
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
function cn(...inputs) {
|
|
19
|
-
return clsx(inputs.filter(Boolean));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
18
|
class BaseColumn {
|
|
23
19
|
config;
|
|
24
20
|
constructor(accessor) {
|