@nccirtu/tablefy 0.6.3 → 0.6.4
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 +34 -0
- package/cli/templates/tablefy/data-table-empty.tsx +0 -1
- package/cli/templates/tablefy/data-table-header.tsx +0 -1
- package/cli/templates/tablefy/data-table-pagination.tsx +0 -1
- package/dist/columns/actions-column.d.ts +3 -3
- package/dist/columns/base-column.d.ts +2 -2
- package/dist/columns/checkbox-column.d.ts +1 -1
- package/dist/columns/columns/actions-column.d.ts +3 -3
- package/dist/columns/columns/base-column.d.ts +2 -2
- package/dist/columns/columns/checkbox-column.d.ts +1 -1
- package/dist/columns/columns/date-column.d.ts +5 -5
- package/dist/columns/columns/icon-column.d.ts +7 -7
- package/dist/columns/columns/image-column.d.ts +7 -7
- package/dist/columns/columns/link-column.d.ts +6 -6
- package/dist/columns/columns/number-column.d.ts +3 -3
- package/dist/columns/columns/progress-column.d.ts +7 -7
- package/dist/columns/columns/text-column.d.ts +3 -3
- package/dist/columns/columns/types.d.ts +5 -5
- package/dist/columns/date-column.d.ts +5 -5
- package/dist/columns/icon-column.d.ts +7 -7
- package/dist/columns/image-column.d.ts +7 -7
- package/dist/columns/index.esm.js +189 -167
- package/dist/columns/index.esm.js.map +1 -1
- package/dist/columns/index.js +189 -167
- package/dist/columns/index.js.map +1 -1
- package/dist/columns/link-column.d.ts +6 -6
- package/dist/columns/number-column.d.ts +3 -3
- package/dist/columns/progress-column.d.ts +7 -7
- package/dist/columns/text-column.d.ts +3 -3
- package/dist/columns/types.d.ts +5 -5
- package/dist/index.esm.js +189 -167
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +189 -167
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/columns/index.js
CHANGED
|
@@ -25,7 +25,7 @@ class BaseColumn {
|
|
|
25
25
|
sortable: false,
|
|
26
26
|
searchable: false,
|
|
27
27
|
hidden: false,
|
|
28
|
-
align:
|
|
28
|
+
align: "left",
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
// Fluent API Methods
|
|
@@ -46,15 +46,15 @@ class BaseColumn {
|
|
|
46
46
|
return this;
|
|
47
47
|
}
|
|
48
48
|
alignLeft() {
|
|
49
|
-
this.config.align =
|
|
49
|
+
this.config.align = "left";
|
|
50
50
|
return this;
|
|
51
51
|
}
|
|
52
52
|
alignCenter() {
|
|
53
|
-
this.config.align =
|
|
53
|
+
this.config.align = "center";
|
|
54
54
|
return this;
|
|
55
55
|
}
|
|
56
56
|
alignRight() {
|
|
57
|
-
this.config.align =
|
|
57
|
+
this.config.align = "right";
|
|
58
58
|
return this;
|
|
59
59
|
}
|
|
60
60
|
width(width) {
|
|
@@ -75,11 +75,11 @@ class BaseColumn {
|
|
|
75
75
|
}
|
|
76
76
|
// Hilfsfunktion für Alignment-Klassen
|
|
77
77
|
getAlignmentClass() {
|
|
78
|
-
const baseClasses =
|
|
78
|
+
const baseClasses = "text-sm text-muted-foreground";
|
|
79
79
|
switch (this.config.align) {
|
|
80
|
-
case
|
|
80
|
+
case "center":
|
|
81
81
|
return `${baseClasses} text-center`;
|
|
82
|
-
case
|
|
82
|
+
case "right":
|
|
83
83
|
return `${baseClasses} text-right`;
|
|
84
84
|
default:
|
|
85
85
|
return `${baseClasses} text-left`;
|
|
@@ -280,8 +280,9 @@ class CheckboxColumn {
|
|
|
280
280
|
}
|
|
281
281
|
build() {
|
|
282
282
|
return {
|
|
283
|
-
id:
|
|
284
|
-
header: ({ table }) => (jsxRuntime.jsx(checkbox.Checkbox, { checked: table.getIsAllPageRowsSelected() ||
|
|
283
|
+
id: "select",
|
|
284
|
+
header: ({ table }) => (jsxRuntime.jsx(checkbox.Checkbox, { checked: table.getIsAllPageRowsSelected() ||
|
|
285
|
+
(table.getIsSomePageRowsSelected() && "indeterminate"), onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value), "aria-label": "Alle ausw\u00E4hlen" })),
|
|
285
286
|
cell: ({ row }) => (jsxRuntime.jsx(checkbox.Checkbox, { checked: row.getIsSelected(), onCheckedChange: (value) => row.toggleSelected(!!value), "aria-label": "Zeile ausw\u00E4hlen" })),
|
|
286
287
|
enableSorting: false,
|
|
287
288
|
enableHiding: false,
|
|
@@ -292,8 +293,8 @@ class CheckboxColumn {
|
|
|
292
293
|
class DateColumn extends BaseColumn {
|
|
293
294
|
constructor(accessor) {
|
|
294
295
|
super(accessor);
|
|
295
|
-
this.config.format =
|
|
296
|
-
this.config.locale =
|
|
296
|
+
this.config.format = "short";
|
|
297
|
+
this.config.locale = "de-DE";
|
|
297
298
|
this.config.showIcon = false;
|
|
298
299
|
}
|
|
299
300
|
static make(accessor) {
|
|
@@ -313,52 +314,62 @@ class DateColumn extends BaseColumn {
|
|
|
313
314
|
}
|
|
314
315
|
// Shortcuts
|
|
315
316
|
short() {
|
|
316
|
-
return this.format(
|
|
317
|
+
return this.format("short");
|
|
317
318
|
}
|
|
318
319
|
long() {
|
|
319
|
-
return this.format(
|
|
320
|
+
return this.format("long");
|
|
320
321
|
}
|
|
321
322
|
relative() {
|
|
322
|
-
return this.format(
|
|
323
|
+
return this.format("relative");
|
|
323
324
|
}
|
|
324
325
|
time() {
|
|
325
|
-
return this.format(
|
|
326
|
+
return this.format("time");
|
|
326
327
|
}
|
|
327
328
|
datetime() {
|
|
328
|
-
return this.format(
|
|
329
|
+
return this.format("datetime");
|
|
329
330
|
}
|
|
330
331
|
formatDate(date, format, locale) {
|
|
331
|
-
if (format ===
|
|
332
|
+
if (format === "relative") {
|
|
332
333
|
return this.getRelativeTime(date);
|
|
333
334
|
}
|
|
334
335
|
const formatOptions = {
|
|
335
|
-
short: { day:
|
|
336
|
-
long: { day:
|
|
337
|
-
time: { hour:
|
|
338
|
-
datetime: {
|
|
336
|
+
short: { day: "2-digit", month: "2-digit", year: "numeric" },
|
|
337
|
+
long: { day: "numeric", month: "long", year: "numeric" },
|
|
338
|
+
time: { hour: "2-digit", minute: "2-digit" },
|
|
339
|
+
datetime: {
|
|
340
|
+
day: "2-digit",
|
|
341
|
+
month: "2-digit",
|
|
342
|
+
year: "numeric",
|
|
343
|
+
hour: "2-digit",
|
|
344
|
+
minute: "2-digit",
|
|
345
|
+
},
|
|
346
|
+
};
|
|
347
|
+
const options = formatOptions[format] || {
|
|
348
|
+
day: "2-digit",
|
|
349
|
+
month: "2-digit",
|
|
350
|
+
year: "numeric",
|
|
339
351
|
};
|
|
340
|
-
const options = formatOptions[format] || { day: '2-digit', month: '2-digit', year: 'numeric' };
|
|
341
352
|
return new Intl.DateTimeFormat(locale, options).format(date);
|
|
342
353
|
}
|
|
343
354
|
getRelativeTime(date) {
|
|
344
355
|
const now = new Date();
|
|
345
356
|
const diffInSeconds = Math.floor((now.getTime() - date.getTime()) / 1000);
|
|
346
357
|
const intervals = [
|
|
347
|
-
{ label:
|
|
348
|
-
{ label:
|
|
349
|
-
{ label:
|
|
350
|
-
{ label:
|
|
351
|
-
{ label:
|
|
352
|
-
{ label:
|
|
358
|
+
{ label: "Jahr", seconds: 31536000 },
|
|
359
|
+
{ label: "Monat", seconds: 2592000 },
|
|
360
|
+
{ label: "Woche", seconds: 604800 },
|
|
361
|
+
{ label: "Tag", seconds: 86400 },
|
|
362
|
+
{ label: "Stunde", seconds: 3600 },
|
|
363
|
+
{ label: "Minute", seconds: 60 },
|
|
353
364
|
];
|
|
354
365
|
for (const interval of intervals) {
|
|
355
366
|
const count = Math.floor(diffInSeconds / interval.seconds);
|
|
356
367
|
if (count >= 1) {
|
|
357
|
-
const plural = count > 1 ? (interval.label ===
|
|
368
|
+
const plural = count > 1 ? (interval.label === "Monat" ? "e" : "en") : "";
|
|
358
369
|
return `vor ${count} ${interval.label}${plural}`;
|
|
359
370
|
}
|
|
360
371
|
}
|
|
361
|
-
return
|
|
372
|
+
return "gerade eben";
|
|
362
373
|
}
|
|
363
374
|
build() {
|
|
364
375
|
const config = this.config;
|
|
@@ -368,9 +379,9 @@ class DateColumn extends BaseColumn {
|
|
|
368
379
|
header: ({ column }) => {
|
|
369
380
|
const displayLabel = label || String(accessor);
|
|
370
381
|
if (!sortable) {
|
|
371
|
-
return (jsxRuntime.jsx("span", { className: utils.cn(
|
|
382
|
+
return (jsxRuntime.jsx("span", { className: utils.cn("text-muted-foreground font-medium", this.getAlignmentClass(), this.config.headerClassName), children: displayLabel }));
|
|
372
383
|
}
|
|
373
|
-
return (jsxRuntime.jsxs(button.Button, { variant: "table_header", size: "table_header", onClick: () => column.toggleSorting(column.getIsSorted() ===
|
|
384
|
+
return (jsxRuntime.jsxs(button.Button, { variant: "table_header", size: "table_header", onClick: () => column.toggleSorting(column.getIsSorted() === "asc"), className: utils.cn("text-muted-foreground font-medium", this.getAlignmentClass(), this.config.headerClassName), children: [displayLabel, jsxRuntime.jsx(lucideReact.ArrowUpDown, { className: "ml-2 h-4 w-4" })] }));
|
|
374
385
|
},
|
|
375
386
|
cell: ({ getValue }) => {
|
|
376
387
|
const value = getValue();
|
|
@@ -379,10 +390,10 @@ class DateColumn extends BaseColumn {
|
|
|
379
390
|
}
|
|
380
391
|
const date = value instanceof Date ? value : new Date(value);
|
|
381
392
|
if (isNaN(date.getTime())) {
|
|
382
|
-
return jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Ung\u00FCltiges Datum" });
|
|
393
|
+
return (jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Ung\u00FCltiges Datum" }));
|
|
383
394
|
}
|
|
384
|
-
const formatted = this.formatDate(date, format ||
|
|
385
|
-
return (jsxRuntime.jsxs("span", { className: utils.cn(
|
|
395
|
+
const formatted = this.formatDate(date, format || "short", locale || "de-DE");
|
|
396
|
+
return (jsxRuntime.jsxs("span", { className: utils.cn("flex items-center gap-2", this.getAlignmentClass(), this.config.cellClassName), children: [showIcon && jsxRuntime.jsx(lucideReact.Calendar, { className: "text-muted-foreground h-4 w-4" }), formatted] }));
|
|
386
397
|
},
|
|
387
398
|
};
|
|
388
399
|
}
|
|
@@ -405,11 +416,11 @@ class IconColumn extends BaseColumn {
|
|
|
405
416
|
super(accessor);
|
|
406
417
|
const config = this.config;
|
|
407
418
|
config.states = {};
|
|
408
|
-
config.size =
|
|
419
|
+
config.size = "md";
|
|
409
420
|
config.showLabel = false;
|
|
410
421
|
config.showTooltip = true;
|
|
411
422
|
config.withBackground = false;
|
|
412
|
-
config.align =
|
|
423
|
+
config.align = "center";
|
|
413
424
|
}
|
|
414
425
|
static make(accessor) {
|
|
415
426
|
return new IconColumn(accessor);
|
|
@@ -461,14 +472,14 @@ class IconColumn extends BaseColumn {
|
|
|
461
472
|
c.states = {
|
|
462
473
|
true: {
|
|
463
474
|
icon: config?.trueIcon || this.createCheckIcon(),
|
|
464
|
-
label: config?.trueLabel ||
|
|
465
|
-
color: config?.trueColor ||
|
|
475
|
+
label: config?.trueLabel || "Ja",
|
|
476
|
+
color: config?.trueColor || "text-green-500",
|
|
466
477
|
bgColor: config?.trueBgColor,
|
|
467
478
|
},
|
|
468
479
|
false: {
|
|
469
480
|
icon: config?.falseIcon || this.createXIcon(),
|
|
470
|
-
label: config?.falseLabel ||
|
|
471
|
-
color: config?.falseColor ||
|
|
481
|
+
label: config?.falseLabel || "Nein",
|
|
482
|
+
color: config?.falseColor || "text-red-500",
|
|
472
483
|
bgColor: config?.falseBgColor,
|
|
473
484
|
},
|
|
474
485
|
};
|
|
@@ -479,15 +490,15 @@ class IconColumn extends BaseColumn {
|
|
|
479
490
|
return this.states({
|
|
480
491
|
active: {
|
|
481
492
|
icon: this.createCircleIcon(),
|
|
482
|
-
label:
|
|
483
|
-
color:
|
|
484
|
-
tooltip:
|
|
493
|
+
label: "Aktiv",
|
|
494
|
+
color: "text-green-500",
|
|
495
|
+
tooltip: "Status: Aktiv",
|
|
485
496
|
},
|
|
486
497
|
inactive: {
|
|
487
498
|
icon: this.createCircleIcon(),
|
|
488
|
-
label:
|
|
489
|
-
color:
|
|
490
|
-
tooltip:
|
|
499
|
+
label: "Inaktiv",
|
|
500
|
+
color: "text-gray-400",
|
|
501
|
+
tooltip: "Status: Inaktiv",
|
|
491
502
|
},
|
|
492
503
|
});
|
|
493
504
|
}
|
|
@@ -496,27 +507,27 @@ class IconColumn extends BaseColumn {
|
|
|
496
507
|
return this.states({
|
|
497
508
|
online: {
|
|
498
509
|
icon: this.createCircleIcon(),
|
|
499
|
-
label:
|
|
500
|
-
color:
|
|
501
|
-
bgColor:
|
|
510
|
+
label: "Online",
|
|
511
|
+
color: "text-green-500",
|
|
512
|
+
bgColor: "bg-green-500",
|
|
502
513
|
},
|
|
503
514
|
offline: {
|
|
504
515
|
icon: this.createCircleIcon(),
|
|
505
|
-
label:
|
|
506
|
-
color:
|
|
507
|
-
bgColor:
|
|
516
|
+
label: "Offline",
|
|
517
|
+
color: "text-gray-400",
|
|
518
|
+
bgColor: "bg-gray-400",
|
|
508
519
|
},
|
|
509
520
|
away: {
|
|
510
521
|
icon: this.createCircleIcon(),
|
|
511
|
-
label:
|
|
512
|
-
color:
|
|
513
|
-
bgColor:
|
|
522
|
+
label: "Abwesend",
|
|
523
|
+
color: "text-yellow-500",
|
|
524
|
+
bgColor: "bg-yellow-500",
|
|
514
525
|
},
|
|
515
526
|
busy: {
|
|
516
527
|
icon: this.createCircleIcon(),
|
|
517
|
-
label:
|
|
518
|
-
color:
|
|
519
|
-
bgColor:
|
|
528
|
+
label: "Beschäftigt",
|
|
529
|
+
color: "text-red-500",
|
|
530
|
+
bgColor: "bg-red-500",
|
|
520
531
|
},
|
|
521
532
|
});
|
|
522
533
|
}
|
|
@@ -525,23 +536,23 @@ class IconColumn extends BaseColumn {
|
|
|
525
536
|
return this.states({
|
|
526
537
|
low: {
|
|
527
538
|
icon: this.createArrowDownIcon(),
|
|
528
|
-
label:
|
|
529
|
-
color:
|
|
539
|
+
label: "Niedrig",
|
|
540
|
+
color: "text-blue-500",
|
|
530
541
|
},
|
|
531
542
|
medium: {
|
|
532
543
|
icon: this.createMinusIcon(),
|
|
533
|
-
label:
|
|
534
|
-
color:
|
|
544
|
+
label: "Mittel",
|
|
545
|
+
color: "text-yellow-500",
|
|
535
546
|
},
|
|
536
547
|
high: {
|
|
537
548
|
icon: this.createArrowUpIcon(),
|
|
538
|
-
label:
|
|
539
|
-
color:
|
|
549
|
+
label: "Hoch",
|
|
550
|
+
color: "text-orange-500",
|
|
540
551
|
},
|
|
541
552
|
critical: {
|
|
542
553
|
icon: this.createAlertIcon(),
|
|
543
|
-
label:
|
|
544
|
-
color:
|
|
554
|
+
label: "Kritisch",
|
|
555
|
+
color: "text-red-500",
|
|
545
556
|
},
|
|
546
557
|
});
|
|
547
558
|
}
|
|
@@ -550,18 +561,18 @@ class IconColumn extends BaseColumn {
|
|
|
550
561
|
return this.states({
|
|
551
562
|
verified: {
|
|
552
563
|
icon: this.createShieldCheckIcon(),
|
|
553
|
-
label:
|
|
554
|
-
color:
|
|
564
|
+
label: "Verifiziert",
|
|
565
|
+
color: "text-green-500",
|
|
555
566
|
},
|
|
556
567
|
pending: {
|
|
557
568
|
icon: this.createClockIcon(),
|
|
558
|
-
label:
|
|
559
|
-
color:
|
|
569
|
+
label: "Ausstehend",
|
|
570
|
+
color: "text-yellow-500",
|
|
560
571
|
},
|
|
561
572
|
rejected: {
|
|
562
573
|
icon: this.createShieldXIcon(),
|
|
563
|
-
label:
|
|
564
|
-
color:
|
|
574
|
+
label: "Abgelehnt",
|
|
575
|
+
color: "text-red-500",
|
|
565
576
|
},
|
|
566
577
|
});
|
|
567
578
|
}
|
|
@@ -598,33 +609,33 @@ class IconColumn extends BaseColumn {
|
|
|
598
609
|
}
|
|
599
610
|
build() {
|
|
600
611
|
const config = this.config;
|
|
601
|
-
const { accessor, label, sortable, states, size, showLabel, showTooltip, withBackground, defaultIcon, defaultLabel } = config;
|
|
612
|
+
const { accessor, label, sortable, states, size, showLabel, showTooltip, withBackground, defaultIcon, defaultLabel, } = config;
|
|
602
613
|
const sizeClasses = {
|
|
603
|
-
xs:
|
|
604
|
-
sm:
|
|
605
|
-
md:
|
|
606
|
-
lg:
|
|
614
|
+
xs: "h-3 w-3",
|
|
615
|
+
sm: "h-4 w-4",
|
|
616
|
+
md: "h-5 w-5",
|
|
617
|
+
lg: "h-6 w-6",
|
|
607
618
|
};
|
|
608
619
|
const bgSizeClasses = {
|
|
609
|
-
xs:
|
|
610
|
-
sm:
|
|
611
|
-
md:
|
|
612
|
-
lg:
|
|
620
|
+
xs: "h-5 w-5",
|
|
621
|
+
sm: "h-6 w-6",
|
|
622
|
+
md: "h-8 w-8",
|
|
623
|
+
lg: "h-10 w-10",
|
|
613
624
|
};
|
|
614
625
|
const iconInBgSizeClasses = {
|
|
615
|
-
xs:
|
|
616
|
-
sm:
|
|
617
|
-
md:
|
|
618
|
-
lg:
|
|
626
|
+
xs: "h-2.5 w-2.5",
|
|
627
|
+
sm: "h-3 w-3",
|
|
628
|
+
md: "h-4 w-4",
|
|
629
|
+
lg: "h-5 w-5",
|
|
619
630
|
};
|
|
620
631
|
return {
|
|
621
632
|
accessorKey: accessor,
|
|
622
633
|
header: ({ column }) => {
|
|
623
634
|
const displayLabel = label || String(accessor);
|
|
624
635
|
if (!sortable) {
|
|
625
|
-
return (jsxRuntime.jsx("span", { className: utils.cn(
|
|
636
|
+
return (jsxRuntime.jsx("span", { className: utils.cn("text-muted-foreground font-medium", this.getAlignmentClass(), this.config.headerClassName), children: displayLabel }));
|
|
626
637
|
}
|
|
627
|
-
return (jsxRuntime.jsxs(button.Button, { variant: "table_header", size: "table_header", onClick: () => column.toggleSorting(column.getIsSorted() ===
|
|
638
|
+
return (jsxRuntime.jsxs(button.Button, { variant: "table_header", size: "table_header", onClick: () => column.toggleSorting(column.getIsSorted() === "asc"), className: utils.cn("text-muted-foreground font-medium", this.getAlignmentClass(), this.config.headerClassName), children: [displayLabel, jsxRuntime.jsx(lucideReact.ArrowUpDown, { className: "ml-2 h-4 w-4" })] }));
|
|
628
639
|
},
|
|
629
640
|
cell: ({ getValue }) => {
|
|
630
641
|
const value = String(getValue());
|
|
@@ -632,16 +643,16 @@ class IconColumn extends BaseColumn {
|
|
|
632
643
|
// Default verwenden wenn State nicht gefunden
|
|
633
644
|
const icon = stateConfig?.icon || defaultIcon;
|
|
634
645
|
const stateLabel = stateConfig?.label || defaultLabel || value;
|
|
635
|
-
const color = stateConfig?.color ||
|
|
646
|
+
const color = stateConfig?.color || "text-muted-foreground";
|
|
636
647
|
const bgColor = stateConfig?.bgColor;
|
|
637
648
|
const tooltip$1 = stateConfig?.tooltip || stateLabel;
|
|
638
649
|
if (!icon) {
|
|
639
650
|
return jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
640
651
|
}
|
|
641
652
|
// Icon als Element rendern (falls LucideIcon übergeben wurde)
|
|
642
|
-
const IconElement = typeof icon ===
|
|
643
|
-
const renderedIcon = IconElement ? jsxRuntime.jsx(IconElement, { className: "h-full w-full" }) : icon;
|
|
644
|
-
const iconElement = (jsxRuntime.jsxs("div", { className: utils.cn(
|
|
653
|
+
const IconElement = typeof icon === "function" ? icon : null;
|
|
654
|
+
const renderedIcon = IconElement ? (jsxRuntime.jsx(IconElement, { className: "h-full w-full" })) : icon;
|
|
655
|
+
const iconElement = (jsxRuntime.jsxs("div", { className: utils.cn("flex items-center gap-2", this.getAlignmentClass(), this.config.cellClassName), children: [withBackground ? (jsxRuntime.jsx("div", { className: utils.cn("inline-flex items-center justify-center rounded-md", bgSizeClasses[size || "md"], bgColor || "bg-blue-50"), children: jsxRuntime.jsx("div", { className: utils.cn(iconInBgSizeClasses[size || "md"], color), children: renderedIcon }) })) : (jsxRuntime.jsx("div", { className: utils.cn(sizeClasses[size || "md"], color), children: renderedIcon })), showLabel && (jsxRuntime.jsx("span", { className: utils.cn("text-sm", color), children: stateLabel }))] }));
|
|
645
656
|
if (showTooltip) {
|
|
646
657
|
return (jsxRuntime.jsx(tooltip.TooltipProvider, { children: jsxRuntime.jsxs(tooltip.Tooltip, { children: [jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: iconElement }), jsxRuntime.jsx(tooltip.TooltipContent, { children: jsxRuntime.jsx("p", { children: tooltip$1 }) })] }) }));
|
|
647
658
|
}
|
|
@@ -654,8 +665,8 @@ class IconColumn extends BaseColumn {
|
|
|
654
665
|
class ImageColumn extends BaseColumn {
|
|
655
666
|
constructor(accessor) {
|
|
656
667
|
super(accessor);
|
|
657
|
-
this.config.size =
|
|
658
|
-
this.config.rounded =
|
|
668
|
+
this.config.size = "md";
|
|
669
|
+
this.config.rounded = "md";
|
|
659
670
|
}
|
|
660
671
|
static make(accessor) {
|
|
661
672
|
return new ImageColumn(accessor);
|
|
@@ -669,10 +680,10 @@ class ImageColumn extends BaseColumn {
|
|
|
669
680
|
return this;
|
|
670
681
|
}
|
|
671
682
|
circular() {
|
|
672
|
-
return this.rounded(
|
|
683
|
+
return this.rounded("full");
|
|
673
684
|
}
|
|
674
685
|
square() {
|
|
675
|
-
return this.rounded(
|
|
686
|
+
return this.rounded("none");
|
|
676
687
|
}
|
|
677
688
|
fallback(url) {
|
|
678
689
|
this.config.fallback = url;
|
|
@@ -686,24 +697,24 @@ class ImageColumn extends BaseColumn {
|
|
|
686
697
|
const config = this.config;
|
|
687
698
|
const { accessor, label, size, rounded, fallback, alt } = config;
|
|
688
699
|
const sizeClasses = {
|
|
689
|
-
sm:
|
|
690
|
-
md:
|
|
691
|
-
lg:
|
|
700
|
+
sm: "h-8 w-8",
|
|
701
|
+
md: "h-10 w-10",
|
|
702
|
+
lg: "h-12 w-12",
|
|
692
703
|
};
|
|
693
704
|
const roundedClasses = {
|
|
694
|
-
none:
|
|
695
|
-
sm:
|
|
696
|
-
md:
|
|
697
|
-
lg:
|
|
698
|
-
full:
|
|
705
|
+
none: "rounded-none",
|
|
706
|
+
sm: "rounded-sm",
|
|
707
|
+
md: "rounded-md",
|
|
708
|
+
lg: "rounded-lg",
|
|
709
|
+
full: "rounded-full",
|
|
699
710
|
};
|
|
700
711
|
return {
|
|
701
712
|
accessorKey: accessor,
|
|
702
|
-
header: () => jsxRuntime.jsx("span", { className: utils.cn(
|
|
713
|
+
header: () => (jsxRuntime.jsx("span", { className: utils.cn("text-muted-foreground font-medium", this.config.headerClassName), children: label || "" })),
|
|
703
714
|
cell: ({ getValue, row }) => {
|
|
704
715
|
const src = getValue();
|
|
705
|
-
const altText = alt ? alt(row.original) :
|
|
706
|
-
return (jsxRuntime.jsx("img", { src: src || fallback ||
|
|
716
|
+
const altText = alt ? alt(row.original) : "Bild";
|
|
717
|
+
return (jsxRuntime.jsx("img", { src: src || fallback || "/placeholder.png", alt: altText, className: utils.cn("object-cover", sizeClasses[size || "md"], roundedClasses[rounded || "md"], this.config.cellClassName), onError: (e) => {
|
|
707
718
|
if (fallback) {
|
|
708
719
|
e.target.src = fallback;
|
|
709
720
|
}
|
|
@@ -731,7 +742,7 @@ class LinkColumn extends BaseColumn {
|
|
|
731
742
|
const config = this.config;
|
|
732
743
|
config.external = false;
|
|
733
744
|
config.showExternalIcon = false;
|
|
734
|
-
config.underline =
|
|
745
|
+
config.underline = "hover";
|
|
735
746
|
config.openInNewTab = false;
|
|
736
747
|
}
|
|
737
748
|
static make(accessor) {
|
|
@@ -782,20 +793,20 @@ class LinkColumn extends BaseColumn {
|
|
|
782
793
|
}
|
|
783
794
|
build() {
|
|
784
795
|
const config = this.config;
|
|
785
|
-
const { accessor, label, sortable, href, icon, showExternalIcon, underline, openInNewTab, onClick } = config;
|
|
796
|
+
const { accessor, label, sortable, href, icon, showExternalIcon, underline, openInNewTab, onClick, } = config;
|
|
786
797
|
const underlineClasses = {
|
|
787
|
-
always:
|
|
788
|
-
hover:
|
|
789
|
-
never:
|
|
798
|
+
always: "underline",
|
|
799
|
+
hover: "hover:underline",
|
|
800
|
+
never: "no-underline",
|
|
790
801
|
};
|
|
791
802
|
return {
|
|
792
803
|
accessorKey: accessor,
|
|
793
804
|
header: ({ column }) => {
|
|
794
805
|
const displayLabel = label || String(accessor);
|
|
795
806
|
if (!sortable) {
|
|
796
|
-
return (jsxRuntime.jsx("span", { className: utils.cn(
|
|
807
|
+
return (jsxRuntime.jsx("span", { className: utils.cn("text-muted-foreground font-medium", this.getAlignmentClass(), this.config.headerClassName), children: displayLabel }));
|
|
797
808
|
}
|
|
798
|
-
return (jsxRuntime.jsxs(button.Button, { variant: "table_header", size: "table_header", onClick: () => column.toggleSorting(column.getIsSorted() ===
|
|
809
|
+
return (jsxRuntime.jsxs(button.Button, { variant: "table_header", size: "table_header", onClick: () => column.toggleSorting(column.getIsSorted() === "asc"), className: utils.cn("text-muted-foreground font-medium", this.getAlignmentClass(), this.config.headerClassName), children: [displayLabel, jsxRuntime.jsx(lucideReact.ArrowUpDown, { className: "ml-2 h-4 w-4" })] }));
|
|
799
810
|
},
|
|
800
811
|
cell: ({ getValue, row }) => {
|
|
801
812
|
const value = getValue();
|
|
@@ -803,7 +814,7 @@ class LinkColumn extends BaseColumn {
|
|
|
803
814
|
return jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
804
815
|
}
|
|
805
816
|
// URL berechnen
|
|
806
|
-
const url = typeof href ===
|
|
817
|
+
const url = typeof href === "function" ? href(row.original) : href || value;
|
|
807
818
|
const handleClick = (e) => {
|
|
808
819
|
if (onClick) {
|
|
809
820
|
e.preventDefault();
|
|
@@ -811,8 +822,12 @@ class LinkColumn extends BaseColumn {
|
|
|
811
822
|
}
|
|
812
823
|
};
|
|
813
824
|
// Alignment ohne text-muted-foreground für Links
|
|
814
|
-
const alignmentClass = this.config.align ===
|
|
815
|
-
|
|
825
|
+
const alignmentClass = this.config.align === "center"
|
|
826
|
+
? "text-center"
|
|
827
|
+
: this.config.align === "right"
|
|
828
|
+
? "text-right"
|
|
829
|
+
: "text-left";
|
|
830
|
+
return (jsxRuntime.jsxs("a", { href: url, target: openInNewTab ? "_blank" : undefined, rel: openInNewTab ? "noopener noreferrer" : undefined, onClick: onClick ? handleClick : undefined, className: utils.cn("inline-flex items-center gap-1.5 text-sm text-blue-500", underlineClasses[underline || "hover"], "hover:text-blue-500/80", alignmentClass, this.config.cellClassName), children: [icon, jsxRuntime.jsx("span", { children: value }), showExternalIcon && (jsxRuntime.jsx(lucideReact.ExternalLink, { className: "text-muted-foreground h-3 w-3" }))] }));
|
|
816
831
|
},
|
|
817
832
|
};
|
|
818
833
|
}
|
|
@@ -821,9 +836,9 @@ class LinkColumn extends BaseColumn {
|
|
|
821
836
|
class NumberColumn extends BaseColumn {
|
|
822
837
|
constructor(accessor) {
|
|
823
838
|
super(accessor);
|
|
824
|
-
this.config.align =
|
|
839
|
+
this.config.align = "right"; // Zahlen standardmäßig rechtsbündig
|
|
825
840
|
this.config.decimals = 0;
|
|
826
|
-
this.config.locale =
|
|
841
|
+
this.config.locale = "de-DE";
|
|
827
842
|
}
|
|
828
843
|
static make(accessor) {
|
|
829
844
|
return new NumberColumn(accessor);
|
|
@@ -837,7 +852,7 @@ class NumberColumn extends BaseColumn {
|
|
|
837
852
|
return this;
|
|
838
853
|
}
|
|
839
854
|
// Währungsformatierung
|
|
840
|
-
money(currency =
|
|
855
|
+
money(currency = "EUR") {
|
|
841
856
|
this.config.currency = currency;
|
|
842
857
|
this.config.decimals = 2;
|
|
843
858
|
return this;
|
|
@@ -857,15 +872,15 @@ class NumberColumn extends BaseColumn {
|
|
|
857
872
|
}
|
|
858
873
|
build() {
|
|
859
874
|
const config = this.config;
|
|
860
|
-
const { accessor, label, sortable, decimals, locale, currency, percent, prefix, suffix } = config;
|
|
875
|
+
const { accessor, label, sortable, decimals, locale, currency, percent, prefix, suffix, } = config;
|
|
861
876
|
return {
|
|
862
877
|
accessorKey: accessor,
|
|
863
878
|
header: ({ column }) => {
|
|
864
879
|
const displayLabel = label || String(accessor);
|
|
865
880
|
if (!sortable) {
|
|
866
|
-
return (jsxRuntime.jsx("span", { className: utils.cn(
|
|
881
|
+
return (jsxRuntime.jsx("span", { className: utils.cn("text-muted-foreground font-medium", this.getAlignmentClass(), this.config.headerClassName), children: displayLabel }));
|
|
867
882
|
}
|
|
868
|
-
return (jsxRuntime.jsxs(button.Button, { variant: "table_header", size: "table_header", onClick: () => column.toggleSorting(column.getIsSorted() ===
|
|
883
|
+
return (jsxRuntime.jsxs(button.Button, { variant: "table_header", size: "table_header", onClick: () => column.toggleSorting(column.getIsSorted() === "asc"), className: utils.cn("text-muted-foreground font-medium", this.getAlignmentClass(), this.config.headerClassName), children: [displayLabel, jsxRuntime.jsx(lucideReact.ArrowUpDown, { className: "ml-2 h-4 w-4" })] }));
|
|
869
884
|
},
|
|
870
885
|
cell: ({ getValue }) => {
|
|
871
886
|
const value = getValue();
|
|
@@ -875,7 +890,7 @@ class NumberColumn extends BaseColumn {
|
|
|
875
890
|
let formatted;
|
|
876
891
|
if (currency) {
|
|
877
892
|
formatted = new Intl.NumberFormat(locale, {
|
|
878
|
-
style:
|
|
893
|
+
style: "currency",
|
|
879
894
|
currency,
|
|
880
895
|
minimumFractionDigits: decimals,
|
|
881
896
|
maximumFractionDigits: decimals,
|
|
@@ -883,7 +898,7 @@ class NumberColumn extends BaseColumn {
|
|
|
883
898
|
}
|
|
884
899
|
else if (percent) {
|
|
885
900
|
formatted = new Intl.NumberFormat(locale, {
|
|
886
|
-
style:
|
|
901
|
+
style: "percent",
|
|
887
902
|
minimumFractionDigits: decimals,
|
|
888
903
|
maximumFractionDigits: decimals,
|
|
889
904
|
}).format(value / 100);
|
|
@@ -894,8 +909,8 @@ class NumberColumn extends BaseColumn {
|
|
|
894
909
|
maximumFractionDigits: decimals,
|
|
895
910
|
}).format(value);
|
|
896
911
|
}
|
|
897
|
-
const displayValue = `${prefix ||
|
|
898
|
-
return jsxRuntime.jsx("span", { className: utils.cn(
|
|
912
|
+
const displayValue = `${prefix || ""}${formatted}${suffix || ""}`;
|
|
913
|
+
return (jsxRuntime.jsx("span", { className: utils.cn("tabular-nums", this.getAlignmentClass(), this.config.cellClassName), children: displayValue }));
|
|
899
914
|
},
|
|
900
915
|
};
|
|
901
916
|
}
|
|
@@ -908,8 +923,8 @@ class ProgressColumn extends BaseColumn {
|
|
|
908
923
|
config.max = 100;
|
|
909
924
|
config.showValue = false;
|
|
910
925
|
config.showPercentage = true;
|
|
911
|
-
config.size =
|
|
912
|
-
config.color =
|
|
926
|
+
config.size = "md";
|
|
927
|
+
config.color = "default";
|
|
913
928
|
}
|
|
914
929
|
static make(accessor) {
|
|
915
930
|
return new ProgressColumn(accessor);
|
|
@@ -953,10 +968,10 @@ class ProgressColumn extends BaseColumn {
|
|
|
953
968
|
config.color = (value, max) => {
|
|
954
969
|
const percent = (value / max) * 100;
|
|
955
970
|
if (percent <= danger)
|
|
956
|
-
return
|
|
971
|
+
return "danger";
|
|
957
972
|
if (percent <= warning)
|
|
958
|
-
return
|
|
959
|
-
return
|
|
973
|
+
return "warning";
|
|
974
|
+
return "success";
|
|
960
975
|
};
|
|
961
976
|
return this;
|
|
962
977
|
}
|
|
@@ -967,10 +982,10 @@ class ProgressColumn extends BaseColumn {
|
|
|
967
982
|
config.color = (value, max) => {
|
|
968
983
|
const percent = (value / max) * 100;
|
|
969
984
|
if (percent >= danger)
|
|
970
|
-
return
|
|
985
|
+
return "danger";
|
|
971
986
|
if (percent >= warning)
|
|
972
|
-
return
|
|
973
|
-
return
|
|
987
|
+
return "warning";
|
|
988
|
+
return "success";
|
|
974
989
|
};
|
|
975
990
|
return this;
|
|
976
991
|
}
|
|
@@ -981,26 +996,26 @@ class ProgressColumn extends BaseColumn {
|
|
|
981
996
|
}
|
|
982
997
|
build() {
|
|
983
998
|
const config = this.config;
|
|
984
|
-
const { accessor, label, sortable, max, showValue, showPercentage, size, color, format } = config;
|
|
999
|
+
const { accessor, label, sortable, max, showValue, showPercentage, size, color, format, } = config;
|
|
985
1000
|
const sizeClasses = {
|
|
986
|
-
sm:
|
|
987
|
-
md:
|
|
988
|
-
lg:
|
|
1001
|
+
sm: "h-1.5",
|
|
1002
|
+
md: "h-2",
|
|
1003
|
+
lg: "h-3",
|
|
989
1004
|
};
|
|
990
1005
|
const colorClasses = {
|
|
991
|
-
default:
|
|
992
|
-
success:
|
|
993
|
-
warning:
|
|
994
|
-
danger:
|
|
1006
|
+
default: "[&>div]:bg-primary",
|
|
1007
|
+
success: "[&>div]:bg-green-500",
|
|
1008
|
+
warning: "[&>div]:bg-yellow-500",
|
|
1009
|
+
danger: "[&>div]:bg-red-500",
|
|
995
1010
|
};
|
|
996
1011
|
return {
|
|
997
1012
|
accessorKey: accessor,
|
|
998
1013
|
header: ({ column }) => {
|
|
999
1014
|
const displayLabel = label || String(accessor);
|
|
1000
1015
|
if (!sortable) {
|
|
1001
|
-
return (jsxRuntime.jsx("span", { className: utils.cn(
|
|
1016
|
+
return (jsxRuntime.jsx("span", { className: utils.cn("text-muted-foreground font-medium", this.getAlignmentClass(), this.config.headerClassName), children: displayLabel }));
|
|
1002
1017
|
}
|
|
1003
|
-
return (jsxRuntime.jsxs(button.Button, { variant: "table_header", size: "table_header", onClick: () => column.toggleSorting(column.getIsSorted() ===
|
|
1018
|
+
return (jsxRuntime.jsxs(button.Button, { variant: "table_header", size: "table_header", onClick: () => column.toggleSorting(column.getIsSorted() === "asc"), className: utils.cn("text-muted-foreground font-medium", this.getAlignmentClass(), this.config.headerClassName), children: [displayLabel, jsxRuntime.jsx(lucideReact.ArrowUpDown, { className: "ml-2 h-4 w-4" })] }));
|
|
1004
1019
|
},
|
|
1005
1020
|
cell: ({ getValue }) => {
|
|
1006
1021
|
const value = getValue();
|
|
@@ -1010,9 +1025,11 @@ class ProgressColumn extends BaseColumn {
|
|
|
1010
1025
|
}
|
|
1011
1026
|
const percentage = Math.min(100, Math.max(0, (value / maxValue) * 100));
|
|
1012
1027
|
// Farbe berechnen
|
|
1013
|
-
const currentColor = typeof color ===
|
|
1028
|
+
const currentColor = typeof color === "function"
|
|
1029
|
+
? color(value, maxValue)
|
|
1030
|
+
: color || "default";
|
|
1014
1031
|
// Label erstellen
|
|
1015
|
-
let labelText =
|
|
1032
|
+
let labelText = "";
|
|
1016
1033
|
if (format) {
|
|
1017
1034
|
labelText = format(value, maxValue);
|
|
1018
1035
|
}
|
|
@@ -1022,7 +1039,7 @@ class ProgressColumn extends BaseColumn {
|
|
|
1022
1039
|
else if (showPercentage) {
|
|
1023
1040
|
labelText = `${Math.round(percentage)}%`;
|
|
1024
1041
|
}
|
|
1025
|
-
return (jsxRuntime.jsxs("div", { className: utils.cn(
|
|
1042
|
+
return (jsxRuntime.jsxs("div", { className: utils.cn("flex min-w-[120px] items-center gap-3", this.config.cellClassName), children: [jsxRuntime.jsx(progress.Progress, { value: percentage, className: utils.cn("flex-1", sizeClasses[size || "md"], colorClasses[currentColor]) }), labelText && (jsxRuntime.jsx("span", { className: "text-muted-foreground min-w-[3rem] text-right text-sm tabular-nums", children: labelText }))] }));
|
|
1026
1043
|
},
|
|
1027
1044
|
};
|
|
1028
1045
|
}
|
|
@@ -1065,7 +1082,9 @@ class TextColumn extends BaseColumn {
|
|
|
1065
1082
|
const existingFormatter = this.config.formatter;
|
|
1066
1083
|
this.config.formatter = (value, row) => {
|
|
1067
1084
|
const result = existingFormatter ? existingFormatter(value, row) : value;
|
|
1068
|
-
return typeof result ===
|
|
1085
|
+
return typeof result === "string"
|
|
1086
|
+
? result.toUpperCase()
|
|
1087
|
+
: result;
|
|
1069
1088
|
};
|
|
1070
1089
|
return this;
|
|
1071
1090
|
}
|
|
@@ -1073,7 +1092,9 @@ class TextColumn extends BaseColumn {
|
|
|
1073
1092
|
const existingFormatter = this.config.formatter;
|
|
1074
1093
|
this.config.formatter = (value, row) => {
|
|
1075
1094
|
const result = existingFormatter ? existingFormatter(value, row) : value;
|
|
1076
|
-
return typeof result ===
|
|
1095
|
+
return typeof result === "string"
|
|
1096
|
+
? result.toLowerCase()
|
|
1097
|
+
: result;
|
|
1077
1098
|
};
|
|
1078
1099
|
return this;
|
|
1079
1100
|
}
|
|
@@ -1081,23 +1102,23 @@ class TextColumn extends BaseColumn {
|
|
|
1081
1102
|
const existingFormatter = this.config.formatter;
|
|
1082
1103
|
this.config.formatter = (value, row) => {
|
|
1083
1104
|
const result = existingFormatter ? existingFormatter(value, row) : value;
|
|
1084
|
-
if (typeof result ===
|
|
1085
|
-
return result.slice(0, chars) +
|
|
1105
|
+
if (typeof result === "string" && result.length > chars) {
|
|
1106
|
+
return result.slice(0, chars) + "...";
|
|
1086
1107
|
}
|
|
1087
1108
|
return result;
|
|
1088
1109
|
};
|
|
1089
1110
|
return this;
|
|
1090
1111
|
}
|
|
1091
1112
|
build() {
|
|
1092
|
-
const { accessor, label, sortable, prefix, suffix, placeholder, formatter } = this.config;
|
|
1113
|
+
const { accessor, label, sortable, prefix, suffix, placeholder, formatter, } = this.config;
|
|
1093
1114
|
return {
|
|
1094
1115
|
accessorKey: accessor,
|
|
1095
1116
|
header: ({ column }) => {
|
|
1096
1117
|
const displayLabel = label || String(accessor);
|
|
1097
1118
|
if (!sortable) {
|
|
1098
|
-
return (jsxRuntime.jsx("span", { className: utils.cn(
|
|
1119
|
+
return (jsxRuntime.jsx("span", { className: utils.cn("text-muted-foreground font-medium", this.getAlignmentClass(), this.config.headerClassName), children: displayLabel }));
|
|
1099
1120
|
}
|
|
1100
|
-
return (jsxRuntime.jsxs(button.Button, { variant: "table_header", size: "table_header", onClick: () => column.toggleSorting(column.getIsSorted() ===
|
|
1121
|
+
return (jsxRuntime.jsxs(button.Button, { variant: "table_header", size: "table_header", onClick: () => column.toggleSorting(column.getIsSorted() === "asc"), className: utils.cn("text-muted-foreground font-medium", this.getAlignmentClass(), this.config.headerClassName), children: [displayLabel, jsxRuntime.jsx(lucideReact.ArrowUpDown, { className: "ml-2 h-4 w-4" })] }));
|
|
1101
1122
|
},
|
|
1102
1123
|
cell: ({ row, getValue }) => {
|
|
1103
1124
|
let value = getValue();
|
|
@@ -1106,12 +1127,12 @@ class TextColumn extends BaseColumn {
|
|
|
1106
1127
|
value = formatter(value, row);
|
|
1107
1128
|
}
|
|
1108
1129
|
// Placeholder wenn leer
|
|
1109
|
-
if (value === null || value === undefined || value ===
|
|
1110
|
-
return (jsxRuntime.jsx("span", { className: utils.cn(
|
|
1130
|
+
if (value === null || value === undefined || value === "") {
|
|
1131
|
+
return (jsxRuntime.jsx("span", { className: utils.cn("text-muted-foreground", this.getAlignmentClass(), this.config.cellClassName), children: placeholder || "—" }));
|
|
1111
1132
|
}
|
|
1112
1133
|
// Prefix/Suffix hinzufügen
|
|
1113
|
-
const displayValue = `${prefix ||
|
|
1114
|
-
return jsxRuntime.jsx("span", { className: utils.cn(this.getAlignmentClass(), this.config.cellClassName), children: displayValue });
|
|
1134
|
+
const displayValue = `${prefix || ""}${value}${suffix || ""}`;
|
|
1135
|
+
return (jsxRuntime.jsx("span", { className: utils.cn(this.getAlignmentClass(), this.config.cellClassName), children: displayValue }));
|
|
1115
1136
|
},
|
|
1116
1137
|
};
|
|
1117
1138
|
}
|
|
@@ -1120,7 +1141,7 @@ class TextColumn extends BaseColumn {
|
|
|
1120
1141
|
class ActionsColumn {
|
|
1121
1142
|
config = {
|
|
1122
1143
|
actions: [],
|
|
1123
|
-
label:
|
|
1144
|
+
label: "Aktionen",
|
|
1124
1145
|
};
|
|
1125
1146
|
static make() {
|
|
1126
1147
|
return new ActionsColumn();
|
|
@@ -1140,16 +1161,16 @@ class ActionsColumn {
|
|
|
1140
1161
|
}
|
|
1141
1162
|
// Shortcuts für gängige Actions
|
|
1142
1163
|
view(onClick) {
|
|
1143
|
-
return this.action({ label:
|
|
1164
|
+
return this.action({ label: "Anzeigen", onClick });
|
|
1144
1165
|
}
|
|
1145
1166
|
edit(onClick) {
|
|
1146
|
-
return this.action({ label:
|
|
1167
|
+
return this.action({ label: "Bearbeiten", onClick });
|
|
1147
1168
|
}
|
|
1148
1169
|
delete(onClick) {
|
|
1149
1170
|
return this.action({
|
|
1150
|
-
label:
|
|
1171
|
+
label: "Löschen",
|
|
1151
1172
|
onClick,
|
|
1152
|
-
variant:
|
|
1173
|
+
variant: "destructive",
|
|
1153
1174
|
separator: true,
|
|
1154
1175
|
});
|
|
1155
1176
|
}
|
|
@@ -1165,21 +1186,22 @@ class ActionsColumn {
|
|
|
1165
1186
|
build() {
|
|
1166
1187
|
const { actions, label, triggerIcon } = this.config;
|
|
1167
1188
|
return {
|
|
1168
|
-
id:
|
|
1189
|
+
id: "actions",
|
|
1169
1190
|
header: () => jsxRuntime.jsx("span", { className: "sr-only", children: label }),
|
|
1170
1191
|
cell: ({ row }) => {
|
|
1171
1192
|
const data = row.original;
|
|
1172
1193
|
const visibleActions = actions.filter((action) => !action.hidden || !action.hidden(data));
|
|
1173
1194
|
if (visibleActions.length === 0)
|
|
1174
1195
|
return null;
|
|
1175
|
-
return (jsxRuntime.jsxs(dropdownMenu.DropdownMenu, { children: [jsxRuntime.jsx(dropdownMenu.DropdownMenuTrigger, { asChild: true, children: jsxRuntime.jsxs(button.Button, { variant: "ghost", className: "h-10 w-10 p-0", children: [jsxRuntime.jsx("span", { className: "sr-only", children: label }), triggerIcon || jsxRuntime.jsx(lucideReact.MoreHorizontal, { className: "h-8 w-8" })] }) }), jsxRuntime.jsx(dropdownMenu.DropdownMenuContent, { align: "end", children: visibleActions.map((action, index) => (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { disabled: action.disabled?.(data), className: utils.cn(action.variant ===
|
|
1196
|
+
return (jsxRuntime.jsxs(dropdownMenu.DropdownMenu, { children: [jsxRuntime.jsx(dropdownMenu.DropdownMenuTrigger, { asChild: true, children: jsxRuntime.jsxs(button.Button, { variant: "ghost", className: "h-10 w-10 p-0", children: [jsxRuntime.jsx("span", { className: "sr-only", children: label }), triggerIcon || jsxRuntime.jsx(lucideReact.MoreHorizontal, { className: "h-8 w-8" })] }) }), jsxRuntime.jsx(dropdownMenu.DropdownMenuContent, { align: "end", children: visibleActions.map((action, index) => (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { disabled: action.disabled?.(data), className: utils.cn(action.variant === "destructive" &&
|
|
1197
|
+
"text-destructive focus:text-destructive"), onClick: () => {
|
|
1176
1198
|
if (action.href) {
|
|
1177
1199
|
window.location.href = action.href(data);
|
|
1178
1200
|
}
|
|
1179
1201
|
else if (action.onClick) {
|
|
1180
1202
|
action.onClick(data);
|
|
1181
1203
|
}
|
|
1182
|
-
}, children: [action.icon && jsxRuntime.jsx("span", { className: "mr-2", children: action.icon }), action.label] }), action.separator && index < visibleActions.length - 1 && jsxRuntime.jsx(dropdownMenu.DropdownMenuSeparator, {})] }, index))) })] }));
|
|
1204
|
+
}, children: [action.icon && jsxRuntime.jsx("span", { className: "mr-2", children: action.icon }), action.label] }), action.separator && index < visibleActions.length - 1 && (jsxRuntime.jsx(dropdownMenu.DropdownMenuSeparator, {}))] }, index))) })] }));
|
|
1183
1205
|
},
|
|
1184
1206
|
};
|
|
1185
1207
|
}
|