@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.js CHANGED
@@ -61,7 +61,7 @@ function DataTableHeader({ title, description, actions = [], search, searchValue
61
61
  !search?.enabled) {
62
62
  return null;
63
63
  }
64
- return (jsxRuntime.jsxs("div", { className: utils.cn("flex flex-col gap-4", className), children: [(title || description) && (jsxRuntime.jsxs("div", { className: "space-y-1", children: [title && (jsxRuntime.jsx("h2", { className: "text-xl font-semibold tracking-tight", children: title })), description && (jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: description }))] })), (search?.enabled || normalActions.length > 0 || showBulkActions) && (jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4 mb-4", children: [search?.enabled && (jsxRuntime.jsxs("div", { className: "relative max-w-sm flex-1", children: [jsxRuntime.jsx(lucideReact.Search, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }), jsxRuntime.jsx(input.Input, { placeholder: search.placeholder || "Suchen...", value: searchValue, onChange: (e) => onSearchChange?.(e.target.value), className: "pl-9 pr-9" }), searchValue && (jsxRuntime.jsx("button", { onClick: () => onSearchChange?.(""), className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground", children: jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }) }))] })), jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [showBulkActions && (jsxRuntime.jsxs("span", { className: "text-sm text-muted-foreground", children: [selectedCount, " ausgew\u00E4hlt"] })), showBulkActions &&
64
+ return (jsxRuntime.jsxs("div", { className: utils.cn("flex flex-col gap-4", className), children: [(title || description) && (jsxRuntime.jsxs("div", { className: "space-y-1", children: [title && (jsxRuntime.jsx("h2", { className: "text-xl font-semibold tracking-tight", children: title })), description && (jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: description }))] })), (search?.enabled || normalActions.length > 0 || showBulkActions) && (jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4 mb-4", children: [search?.enabled && (jsxRuntime.jsxs("div", { className: "relative max-w-sm flex-1", children: [jsxRuntime.jsx(lucideReact.Search, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }), jsxRuntime.jsx(input.Input, { placeholder: search.placeholder || "Suchen...", value: searchValue, onChange: (e) => onSearchChange?.(e.target.value), className: "pl-9 pr-9" }), searchValue && (jsxRuntime.jsx("button", { onClick: () => onSearchChange?.(""), className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground", children: jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }) }))] })), jsxRuntime.jsxs("div", { className: "hidden md:flex items-center gap-2", children: [showBulkActions && (jsxRuntime.jsxs("span", { className: "text-sm text-muted-foreground", children: [selectedCount, " ausgew\u00E4hlt"] })), showBulkActions &&
65
65
  bulkActions.map((action, index) => renderAction(action, index)), enableColumnVisibility && table && (jsxRuntime.jsxs(dropdownMenu.DropdownMenu, { children: [jsxRuntime.jsx(dropdownMenu.DropdownMenuTrigger, { asChild: true, children: jsxRuntime.jsxs(button.Button, { variant: "outline", size: "default", children: [jsxRuntime.jsx(lucideReact.Columns, { className: "h-4 w-4" }), jsxRuntime.jsx("span", { className: "ml-2", children: columnVisibilityLabel }), jsxRuntime.jsx(lucideReact.ChevronDown, { className: "ml-2 h-4 w-4" })] }) }), jsxRuntime.jsxs(dropdownMenu.DropdownMenuContent, { align: "end", className: "w-[200px]", children: [jsxRuntime.jsx(dropdownMenu.DropdownMenuLabel, { children: columnVisibilityLabel }), jsxRuntime.jsx(dropdownMenu.DropdownMenuSeparator, {}), table
66
66
  .getAllColumns()
67
67
  .filter((column) => column.getCanHide())
@@ -70,7 +70,21 @@ function DataTableHeader({ title, description, actions = [], search, searchValue
70
70
  const label = meta?.visibilityLabel || column.id;
71
71
  return (jsxRuntime.jsx(dropdownMenu.DropdownMenuCheckboxItem, { checked: column.getIsVisible(), onCheckedChange: (value) => column.toggleVisibility(!!value), children: label }, column.id));
72
72
  })] })] })), normalActions.length > 0 &&
73
- normalActions.map((action, index) => renderAction(action, index))] })] }))] }));
73
+ normalActions.map((action, index) => renderAction(action, index))] }), jsxRuntime.jsxs("div", { className: "flex md:hidden items-center gap-2", children: [showBulkActions && (jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: selectedCount })), enableColumnVisibility && table && (jsxRuntime.jsxs(dropdownMenu.DropdownMenu, { children: [jsxRuntime.jsx(dropdownMenu.DropdownMenuTrigger, { asChild: true, children: jsxRuntime.jsx(button.Button, { variant: "outline", size: "icon", "aria-label": columnVisibilityLabel, children: jsxRuntime.jsx(lucideReact.Columns, { className: "h-4 w-4" }) }) }), jsxRuntime.jsxs(dropdownMenu.DropdownMenuContent, { align: "end", className: "w-[200px]", children: [jsxRuntime.jsx(dropdownMenu.DropdownMenuLabel, { children: columnVisibilityLabel }), jsxRuntime.jsx(dropdownMenu.DropdownMenuSeparator, {}), table
74
+ .getAllColumns()
75
+ .filter((column) => column.getCanHide())
76
+ .map((column) => {
77
+ const meta = column.columnDef.meta;
78
+ const label = meta?.visibilityLabel || column.id;
79
+ return (jsxRuntime.jsx(dropdownMenu.DropdownMenuCheckboxItem, { checked: column.getIsVisible(), onCheckedChange: (value) => column.toggleVisibility(!!value), onSelect: (e) => e.preventDefault(), children: label }, column.id));
80
+ })] })] })), (normalActions.length > 0 || showBulkActions) && (jsxRuntime.jsxs(dropdownMenu.DropdownMenu, { children: [jsxRuntime.jsx(dropdownMenu.DropdownMenuTrigger, { asChild: true, children: jsxRuntime.jsx(button.Button, { variant: "outline", size: "icon", "aria-label": "Tabellen-Aktionen", children: jsxRuntime.jsx(lucideReact.MoreHorizontal, { className: "h-4 w-4" }) }) }), jsxRuntime.jsxs(dropdownMenu.DropdownMenuContent, { align: "end", className: "w-[240px]", children: [showBulkActions && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(dropdownMenu.DropdownMenuLabel, { children: [selectedCount, " ausgew\u00E4hlt"] }), jsxRuntime.jsx(dropdownMenu.DropdownMenuSeparator, {}), bulkActions.map((action, index) => (jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { onClick: () => {
81
+ if (action.bulkOnClick)
82
+ action.bulkOnClick(getSelectedRows());
83
+ else
84
+ action.onClick?.();
85
+ }, disabled: action.disabled || action.loading, className: utils.cn(action.variant === "destructive" &&
86
+ "text-destructive focus:text-destructive"), children: [action.icon && jsxRuntime.jsx("span", { className: "mr-2", children: action.icon }), action.label] }, `bulk-${action.id || index}`))), normalActions.length > 0 && jsxRuntime.jsx(dropdownMenu.DropdownMenuSeparator, {})] })), normalActions.map((action, index) => action.href ? (jsxRuntime.jsx(dropdownMenu.DropdownMenuItem, { asChild: true, children: jsxRuntime.jsxs("a", { href: action.href, children: [action.icon && jsxRuntime.jsx("span", { className: "mr-2", children: action.icon }), action.label] }) }, action.id || index)) : (jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { onClick: action.onClick, disabled: action.disabled || action.loading, className: utils.cn(action.variant === "destructive" &&
87
+ "text-destructive focus:text-destructive"), children: [action.icon && jsxRuntime.jsx("span", { className: "mr-2", children: action.icon }), action.label] }, action.id || index)))] })] }))] })] }))] }));
74
88
  }
75
89
 
76
90
  function DataTableEmpty({ config, colSpan, className, }) {