@nccirtu/tablefy 0.9.2 → 0.9.3

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/index.esm.js CHANGED
@@ -6,7 +6,7 @@ import { cn } from '@/lib/utils';
6
6
  import { Button } from '@/components/ui/button';
7
7
  import { Input } from '@/components/ui/input';
8
8
  import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuCheckboxItem, DropdownMenuItem } from '@/components/ui/dropdown-menu';
9
- import { Search, X, Columns, ChevronDown, ChevronsLeft, ChevronLeft, ChevronRight, ChevronsRight, ArrowUpDown, Calendar, ExternalLink, MoreHorizontal, CalendarIcon, Upload, File, GripVertical, Trash2, Plus } from 'lucide-react';
9
+ import { Search, X, Columns, ChevronDown, MoreHorizontal, ChevronsLeft, ChevronLeft, ChevronRight, ChevronsRight, ArrowUpDown, Calendar, ExternalLink, CalendarIcon, Upload, File, GripVertical, Trash2, Plus } from 'lucide-react';
10
10
  import { Select as Select$1, SelectTrigger, SelectValue, SelectContent, SelectItem } from '@/components/ui/select';
11
11
  import { Badge } from '@/components/ui/badge';
12
12
  import { Checkbox as Checkbox$1 } from '@/components/ui/checkbox';
@@ -59,7 +59,7 @@ function DataTableHeader({ title, description, actions = [], search, searchValue
59
59
  !search?.enabled) {
60
60
  return null;
61
61
  }
62
- return (jsxs("div", { className: cn("flex flex-col gap-4", className), children: [(title || description) && (jsxs("div", { className: "space-y-1", children: [title && (jsx("h2", { className: "text-xl font-semibold tracking-tight", children: title })), description && (jsx("p", { className: "text-sm text-muted-foreground", children: description }))] })), (search?.enabled || normalActions.length > 0 || showBulkActions) && (jsxs("div", { className: "flex items-center justify-between gap-4 mb-4", children: [search?.enabled && (jsxs("div", { className: "relative max-w-sm flex-1", children: [jsx(Search, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }), jsx(Input, { placeholder: search.placeholder || "Suchen...", value: searchValue, onChange: (e) => onSearchChange?.(e.target.value), className: "pl-9 pr-9" }), searchValue && (jsx("button", { onClick: () => onSearchChange?.(""), className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground", children: jsx(X, { className: "h-4 w-4" }) }))] })), jsxs("div", { className: "flex items-center gap-2", children: [showBulkActions && (jsxs("span", { className: "text-sm text-muted-foreground", children: [selectedCount, " ausgew\u00E4hlt"] })), showBulkActions &&
62
+ return (jsxs("div", { className: cn("flex flex-col gap-4", className), children: [(title || description) && (jsxs("div", { className: "space-y-1", children: [title && (jsx("h2", { className: "text-xl font-semibold tracking-tight", children: title })), description && (jsx("p", { className: "text-sm text-muted-foreground", children: description }))] })), (search?.enabled || normalActions.length > 0 || showBulkActions) && (jsxs("div", { className: "flex items-center justify-between gap-4 mb-4", children: [search?.enabled && (jsxs("div", { className: "relative max-w-sm flex-1", children: [jsx(Search, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }), jsx(Input, { placeholder: search.placeholder || "Suchen...", value: searchValue, onChange: (e) => onSearchChange?.(e.target.value), className: "pl-9 pr-9" }), searchValue && (jsx("button", { onClick: () => onSearchChange?.(""), className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground", children: jsx(X, { className: "h-4 w-4" }) }))] })), jsxs("div", { className: "hidden md:flex items-center gap-2", children: [showBulkActions && (jsxs("span", { className: "text-sm text-muted-foreground", children: [selectedCount, " ausgew\u00E4hlt"] })), showBulkActions &&
63
63
  bulkActions.map((action, index) => renderAction(action, index)), enableColumnVisibility && table && (jsxs(DropdownMenu, { children: [jsx(DropdownMenuTrigger, { asChild: true, children: jsxs(Button, { variant: "outline", size: "default", children: [jsx(Columns, { className: "h-4 w-4" }), jsx("span", { className: "ml-2", children: columnVisibilityLabel }), jsx(ChevronDown, { className: "ml-2 h-4 w-4" })] }) }), jsxs(DropdownMenuContent, { align: "end", className: "w-[200px]", children: [jsx(DropdownMenuLabel, { children: columnVisibilityLabel }), jsx(DropdownMenuSeparator, {}), table
64
64
  .getAllColumns()
65
65
  .filter((column) => column.getCanHide())
@@ -68,7 +68,21 @@ function DataTableHeader({ title, description, actions = [], search, searchValue
68
68
  const label = meta?.visibilityLabel || column.id;
69
69
  return (jsx(DropdownMenuCheckboxItem, { checked: column.getIsVisible(), onCheckedChange: (value) => column.toggleVisibility(!!value), children: label }, column.id));
70
70
  })] })] })), normalActions.length > 0 &&
71
- normalActions.map((action, index) => renderAction(action, index))] })] }))] }));
71
+ normalActions.map((action, index) => renderAction(action, index))] }), jsxs("div", { className: "flex md:hidden items-center gap-2", children: [showBulkActions && (jsx("span", { className: "text-sm text-muted-foreground", children: selectedCount })), enableColumnVisibility && table && (jsxs(DropdownMenu, { children: [jsx(DropdownMenuTrigger, { asChild: true, children: jsx(Button, { variant: "outline", size: "icon", "aria-label": columnVisibilityLabel, children: jsx(Columns, { className: "h-4 w-4" }) }) }), jsxs(DropdownMenuContent, { align: "end", className: "w-[200px]", children: [jsx(DropdownMenuLabel, { children: columnVisibilityLabel }), jsx(DropdownMenuSeparator, {}), table
72
+ .getAllColumns()
73
+ .filter((column) => column.getCanHide())
74
+ .map((column) => {
75
+ const meta = column.columnDef.meta;
76
+ const label = meta?.visibilityLabel || column.id;
77
+ return (jsx(DropdownMenuCheckboxItem, { checked: column.getIsVisible(), onCheckedChange: (value) => column.toggleVisibility(!!value), onSelect: (e) => e.preventDefault(), children: label }, column.id));
78
+ })] })] })), (normalActions.length > 0 || showBulkActions) && (jsxs(DropdownMenu, { children: [jsx(DropdownMenuTrigger, { asChild: true, children: jsx(Button, { variant: "outline", size: "icon", "aria-label": "Tabellen-Aktionen", children: jsx(MoreHorizontal, { className: "h-4 w-4" }) }) }), jsxs(DropdownMenuContent, { align: "end", className: "w-[240px]", children: [showBulkActions && (jsxs(Fragment, { children: [jsxs(DropdownMenuLabel, { children: [selectedCount, " ausgew\u00E4hlt"] }), jsx(DropdownMenuSeparator, {}), bulkActions.map((action, index) => (jsxs(DropdownMenuItem, { onClick: () => {
79
+ if (action.bulkOnClick)
80
+ action.bulkOnClick(getSelectedRows());
81
+ else
82
+ action.onClick?.();
83
+ }, disabled: action.disabled || action.loading, className: cn(action.variant === "destructive" &&
84
+ "text-destructive focus:text-destructive"), children: [action.icon && jsx("span", { className: "mr-2", children: action.icon }), action.label] }, `bulk-${action.id || index}`))), normalActions.length > 0 && jsx(DropdownMenuSeparator, {})] })), normalActions.map((action, index) => action.href ? (jsx(DropdownMenuItem, { asChild: true, children: jsxs("a", { href: action.href, children: [action.icon && jsx("span", { className: "mr-2", children: action.icon }), action.label] }) }, action.id || index)) : (jsxs(DropdownMenuItem, { onClick: action.onClick, disabled: action.disabled || action.loading, className: cn(action.variant === "destructive" &&
85
+ "text-destructive focus:text-destructive"), children: [action.icon && jsx("span", { className: "mr-2", children: action.icon }), action.label] }, action.id || index)))] })] }))] })] }))] }));
72
86
  }
73
87
 
74
88
  function DataTableEmpty({ config, colSpan, className, }) {