@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/index.js
CHANGED
|
@@ -445,7 +445,7 @@ class BaseColumn {
|
|
|
445
445
|
sortable: false,
|
|
446
446
|
searchable: false,
|
|
447
447
|
hidden: false,
|
|
448
|
-
align:
|
|
448
|
+
align: "left",
|
|
449
449
|
};
|
|
450
450
|
}
|
|
451
451
|
// Fluent API Methods
|
|
@@ -466,15 +466,15 @@ class BaseColumn {
|
|
|
466
466
|
return this;
|
|
467
467
|
}
|
|
468
468
|
alignLeft() {
|
|
469
|
-
this.config.align =
|
|
469
|
+
this.config.align = "left";
|
|
470
470
|
return this;
|
|
471
471
|
}
|
|
472
472
|
alignCenter() {
|
|
473
|
-
this.config.align =
|
|
473
|
+
this.config.align = "center";
|
|
474
474
|
return this;
|
|
475
475
|
}
|
|
476
476
|
alignRight() {
|
|
477
|
-
this.config.align =
|
|
477
|
+
this.config.align = "right";
|
|
478
478
|
return this;
|
|
479
479
|
}
|
|
480
480
|
width(width) {
|
|
@@ -495,11 +495,11 @@ class BaseColumn {
|
|
|
495
495
|
}
|
|
496
496
|
// Hilfsfunktion für Alignment-Klassen
|
|
497
497
|
getAlignmentClass() {
|
|
498
|
-
const baseClasses =
|
|
498
|
+
const baseClasses = "text-sm text-muted-foreground";
|
|
499
499
|
switch (this.config.align) {
|
|
500
|
-
case
|
|
500
|
+
case "center":
|
|
501
501
|
return `${baseClasses} text-center`;
|
|
502
|
-
case
|
|
502
|
+
case "right":
|
|
503
503
|
return `${baseClasses} text-right`;
|
|
504
504
|
default:
|
|
505
505
|
return `${baseClasses} text-left`;
|
|
@@ -700,8 +700,9 @@ class CheckboxColumn {
|
|
|
700
700
|
}
|
|
701
701
|
build() {
|
|
702
702
|
return {
|
|
703
|
-
id:
|
|
704
|
-
header: ({ table }) => (jsxRuntime.jsx(checkbox.Checkbox, { checked: table.getIsAllPageRowsSelected() ||
|
|
703
|
+
id: "select",
|
|
704
|
+
header: ({ table }) => (jsxRuntime.jsx(checkbox.Checkbox, { checked: table.getIsAllPageRowsSelected() ||
|
|
705
|
+
(table.getIsSomePageRowsSelected() && "indeterminate"), onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value), "aria-label": "Alle ausw\u00E4hlen" })),
|
|
705
706
|
cell: ({ row }) => (jsxRuntime.jsx(checkbox.Checkbox, { checked: row.getIsSelected(), onCheckedChange: (value) => row.toggleSelected(!!value), "aria-label": "Zeile ausw\u00E4hlen" })),
|
|
706
707
|
enableSorting: false,
|
|
707
708
|
enableHiding: false,
|
|
@@ -712,8 +713,8 @@ class CheckboxColumn {
|
|
|
712
713
|
class DateColumn extends BaseColumn {
|
|
713
714
|
constructor(accessor) {
|
|
714
715
|
super(accessor);
|
|
715
|
-
this.config.format =
|
|
716
|
-
this.config.locale =
|
|
716
|
+
this.config.format = "short";
|
|
717
|
+
this.config.locale = "de-DE";
|
|
717
718
|
this.config.showIcon = false;
|
|
718
719
|
}
|
|
719
720
|
static make(accessor) {
|
|
@@ -733,52 +734,62 @@ class DateColumn extends BaseColumn {
|
|
|
733
734
|
}
|
|
734
735
|
// Shortcuts
|
|
735
736
|
short() {
|
|
736
|
-
return this.format(
|
|
737
|
+
return this.format("short");
|
|
737
738
|
}
|
|
738
739
|
long() {
|
|
739
|
-
return this.format(
|
|
740
|
+
return this.format("long");
|
|
740
741
|
}
|
|
741
742
|
relative() {
|
|
742
|
-
return this.format(
|
|
743
|
+
return this.format("relative");
|
|
743
744
|
}
|
|
744
745
|
time() {
|
|
745
|
-
return this.format(
|
|
746
|
+
return this.format("time");
|
|
746
747
|
}
|
|
747
748
|
datetime() {
|
|
748
|
-
return this.format(
|
|
749
|
+
return this.format("datetime");
|
|
749
750
|
}
|
|
750
751
|
formatDate(date, format, locale) {
|
|
751
|
-
if (format ===
|
|
752
|
+
if (format === "relative") {
|
|
752
753
|
return this.getRelativeTime(date);
|
|
753
754
|
}
|
|
754
755
|
const formatOptions = {
|
|
755
|
-
short: { day:
|
|
756
|
-
long: { day:
|
|
757
|
-
time: { hour:
|
|
758
|
-
datetime: {
|
|
756
|
+
short: { day: "2-digit", month: "2-digit", year: "numeric" },
|
|
757
|
+
long: { day: "numeric", month: "long", year: "numeric" },
|
|
758
|
+
time: { hour: "2-digit", minute: "2-digit" },
|
|
759
|
+
datetime: {
|
|
760
|
+
day: "2-digit",
|
|
761
|
+
month: "2-digit",
|
|
762
|
+
year: "numeric",
|
|
763
|
+
hour: "2-digit",
|
|
764
|
+
minute: "2-digit",
|
|
765
|
+
},
|
|
766
|
+
};
|
|
767
|
+
const options = formatOptions[format] || {
|
|
768
|
+
day: "2-digit",
|
|
769
|
+
month: "2-digit",
|
|
770
|
+
year: "numeric",
|
|
759
771
|
};
|
|
760
|
-
const options = formatOptions[format] || { day: '2-digit', month: '2-digit', year: 'numeric' };
|
|
761
772
|
return new Intl.DateTimeFormat(locale, options).format(date);
|
|
762
773
|
}
|
|
763
774
|
getRelativeTime(date) {
|
|
764
775
|
const now = new Date();
|
|
765
776
|
const diffInSeconds = Math.floor((now.getTime() - date.getTime()) / 1000);
|
|
766
777
|
const intervals = [
|
|
767
|
-
{ label:
|
|
768
|
-
{ label:
|
|
769
|
-
{ label:
|
|
770
|
-
{ label:
|
|
771
|
-
{ label:
|
|
772
|
-
{ label:
|
|
778
|
+
{ label: "Jahr", seconds: 31536000 },
|
|
779
|
+
{ label: "Monat", seconds: 2592000 },
|
|
780
|
+
{ label: "Woche", seconds: 604800 },
|
|
781
|
+
{ label: "Tag", seconds: 86400 },
|
|
782
|
+
{ label: "Stunde", seconds: 3600 },
|
|
783
|
+
{ label: "Minute", seconds: 60 },
|
|
773
784
|
];
|
|
774
785
|
for (const interval of intervals) {
|
|
775
786
|
const count = Math.floor(diffInSeconds / interval.seconds);
|
|
776
787
|
if (count >= 1) {
|
|
777
|
-
const plural = count > 1 ? (interval.label ===
|
|
788
|
+
const plural = count > 1 ? (interval.label === "Monat" ? "e" : "en") : "";
|
|
778
789
|
return `vor ${count} ${interval.label}${plural}`;
|
|
779
790
|
}
|
|
780
791
|
}
|
|
781
|
-
return
|
|
792
|
+
return "gerade eben";
|
|
782
793
|
}
|
|
783
794
|
build() {
|
|
784
795
|
const config = this.config;
|
|
@@ -788,9 +799,9 @@ class DateColumn extends BaseColumn {
|
|
|
788
799
|
header: ({ column }) => {
|
|
789
800
|
const displayLabel = label || String(accessor);
|
|
790
801
|
if (!sortable) {
|
|
791
|
-
return (jsxRuntime.jsx("span", { className: utils.cn(
|
|
802
|
+
return (jsxRuntime.jsx("span", { className: utils.cn("text-muted-foreground font-medium", this.getAlignmentClass(), this.config.headerClassName), children: displayLabel }));
|
|
792
803
|
}
|
|
793
|
-
return (jsxRuntime.jsxs(button.Button, { variant: "table_header", size: "table_header", onClick: () => column.toggleSorting(column.getIsSorted() ===
|
|
804
|
+
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" })] }));
|
|
794
805
|
},
|
|
795
806
|
cell: ({ getValue }) => {
|
|
796
807
|
const value = getValue();
|
|
@@ -799,10 +810,10 @@ class DateColumn extends BaseColumn {
|
|
|
799
810
|
}
|
|
800
811
|
const date = value instanceof Date ? value : new Date(value);
|
|
801
812
|
if (isNaN(date.getTime())) {
|
|
802
|
-
return jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Ung\u00FCltiges Datum" });
|
|
813
|
+
return (jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Ung\u00FCltiges Datum" }));
|
|
803
814
|
}
|
|
804
|
-
const formatted = this.formatDate(date, format ||
|
|
805
|
-
return (jsxRuntime.jsxs("span", { className: utils.cn(
|
|
815
|
+
const formatted = this.formatDate(date, format || "short", locale || "de-DE");
|
|
816
|
+
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] }));
|
|
806
817
|
},
|
|
807
818
|
};
|
|
808
819
|
}
|
|
@@ -825,11 +836,11 @@ class IconColumn extends BaseColumn {
|
|
|
825
836
|
super(accessor);
|
|
826
837
|
const config = this.config;
|
|
827
838
|
config.states = {};
|
|
828
|
-
config.size =
|
|
839
|
+
config.size = "md";
|
|
829
840
|
config.showLabel = false;
|
|
830
841
|
config.showTooltip = true;
|
|
831
842
|
config.withBackground = false;
|
|
832
|
-
config.align =
|
|
843
|
+
config.align = "center";
|
|
833
844
|
}
|
|
834
845
|
static make(accessor) {
|
|
835
846
|
return new IconColumn(accessor);
|
|
@@ -881,14 +892,14 @@ class IconColumn extends BaseColumn {
|
|
|
881
892
|
c.states = {
|
|
882
893
|
true: {
|
|
883
894
|
icon: config?.trueIcon || this.createCheckIcon(),
|
|
884
|
-
label: config?.trueLabel ||
|
|
885
|
-
color: config?.trueColor ||
|
|
895
|
+
label: config?.trueLabel || "Ja",
|
|
896
|
+
color: config?.trueColor || "text-green-500",
|
|
886
897
|
bgColor: config?.trueBgColor,
|
|
887
898
|
},
|
|
888
899
|
false: {
|
|
889
900
|
icon: config?.falseIcon || this.createXIcon(),
|
|
890
|
-
label: config?.falseLabel ||
|
|
891
|
-
color: config?.falseColor ||
|
|
901
|
+
label: config?.falseLabel || "Nein",
|
|
902
|
+
color: config?.falseColor || "text-red-500",
|
|
892
903
|
bgColor: config?.falseBgColor,
|
|
893
904
|
},
|
|
894
905
|
};
|
|
@@ -899,15 +910,15 @@ class IconColumn extends BaseColumn {
|
|
|
899
910
|
return this.states({
|
|
900
911
|
active: {
|
|
901
912
|
icon: this.createCircleIcon(),
|
|
902
|
-
label:
|
|
903
|
-
color:
|
|
904
|
-
tooltip:
|
|
913
|
+
label: "Aktiv",
|
|
914
|
+
color: "text-green-500",
|
|
915
|
+
tooltip: "Status: Aktiv",
|
|
905
916
|
},
|
|
906
917
|
inactive: {
|
|
907
918
|
icon: this.createCircleIcon(),
|
|
908
|
-
label:
|
|
909
|
-
color:
|
|
910
|
-
tooltip:
|
|
919
|
+
label: "Inaktiv",
|
|
920
|
+
color: "text-gray-400",
|
|
921
|
+
tooltip: "Status: Inaktiv",
|
|
911
922
|
},
|
|
912
923
|
});
|
|
913
924
|
}
|
|
@@ -916,27 +927,27 @@ class IconColumn extends BaseColumn {
|
|
|
916
927
|
return this.states({
|
|
917
928
|
online: {
|
|
918
929
|
icon: this.createCircleIcon(),
|
|
919
|
-
label:
|
|
920
|
-
color:
|
|
921
|
-
bgColor:
|
|
930
|
+
label: "Online",
|
|
931
|
+
color: "text-green-500",
|
|
932
|
+
bgColor: "bg-green-500",
|
|
922
933
|
},
|
|
923
934
|
offline: {
|
|
924
935
|
icon: this.createCircleIcon(),
|
|
925
|
-
label:
|
|
926
|
-
color:
|
|
927
|
-
bgColor:
|
|
936
|
+
label: "Offline",
|
|
937
|
+
color: "text-gray-400",
|
|
938
|
+
bgColor: "bg-gray-400",
|
|
928
939
|
},
|
|
929
940
|
away: {
|
|
930
941
|
icon: this.createCircleIcon(),
|
|
931
|
-
label:
|
|
932
|
-
color:
|
|
933
|
-
bgColor:
|
|
942
|
+
label: "Abwesend",
|
|
943
|
+
color: "text-yellow-500",
|
|
944
|
+
bgColor: "bg-yellow-500",
|
|
934
945
|
},
|
|
935
946
|
busy: {
|
|
936
947
|
icon: this.createCircleIcon(),
|
|
937
|
-
label:
|
|
938
|
-
color:
|
|
939
|
-
bgColor:
|
|
948
|
+
label: "Beschäftigt",
|
|
949
|
+
color: "text-red-500",
|
|
950
|
+
bgColor: "bg-red-500",
|
|
940
951
|
},
|
|
941
952
|
});
|
|
942
953
|
}
|
|
@@ -945,23 +956,23 @@ class IconColumn extends BaseColumn {
|
|
|
945
956
|
return this.states({
|
|
946
957
|
low: {
|
|
947
958
|
icon: this.createArrowDownIcon(),
|
|
948
|
-
label:
|
|
949
|
-
color:
|
|
959
|
+
label: "Niedrig",
|
|
960
|
+
color: "text-blue-500",
|
|
950
961
|
},
|
|
951
962
|
medium: {
|
|
952
963
|
icon: this.createMinusIcon(),
|
|
953
|
-
label:
|
|
954
|
-
color:
|
|
964
|
+
label: "Mittel",
|
|
965
|
+
color: "text-yellow-500",
|
|
955
966
|
},
|
|
956
967
|
high: {
|
|
957
968
|
icon: this.createArrowUpIcon(),
|
|
958
|
-
label:
|
|
959
|
-
color:
|
|
969
|
+
label: "Hoch",
|
|
970
|
+
color: "text-orange-500",
|
|
960
971
|
},
|
|
961
972
|
critical: {
|
|
962
973
|
icon: this.createAlertIcon(),
|
|
963
|
-
label:
|
|
964
|
-
color:
|
|
974
|
+
label: "Kritisch",
|
|
975
|
+
color: "text-red-500",
|
|
965
976
|
},
|
|
966
977
|
});
|
|
967
978
|
}
|
|
@@ -970,18 +981,18 @@ class IconColumn extends BaseColumn {
|
|
|
970
981
|
return this.states({
|
|
971
982
|
verified: {
|
|
972
983
|
icon: this.createShieldCheckIcon(),
|
|
973
|
-
label:
|
|
974
|
-
color:
|
|
984
|
+
label: "Verifiziert",
|
|
985
|
+
color: "text-green-500",
|
|
975
986
|
},
|
|
976
987
|
pending: {
|
|
977
988
|
icon: this.createClockIcon(),
|
|
978
|
-
label:
|
|
979
|
-
color:
|
|
989
|
+
label: "Ausstehend",
|
|
990
|
+
color: "text-yellow-500",
|
|
980
991
|
},
|
|
981
992
|
rejected: {
|
|
982
993
|
icon: this.createShieldXIcon(),
|
|
983
|
-
label:
|
|
984
|
-
color:
|
|
994
|
+
label: "Abgelehnt",
|
|
995
|
+
color: "text-red-500",
|
|
985
996
|
},
|
|
986
997
|
});
|
|
987
998
|
}
|
|
@@ -1018,33 +1029,33 @@ class IconColumn extends BaseColumn {
|
|
|
1018
1029
|
}
|
|
1019
1030
|
build() {
|
|
1020
1031
|
const config = this.config;
|
|
1021
|
-
const { accessor, label, sortable, states, size, showLabel, showTooltip, withBackground, defaultIcon, defaultLabel } = config;
|
|
1032
|
+
const { accessor, label, sortable, states, size, showLabel, showTooltip, withBackground, defaultIcon, defaultLabel, } = config;
|
|
1022
1033
|
const sizeClasses = {
|
|
1023
|
-
xs:
|
|
1024
|
-
sm:
|
|
1025
|
-
md:
|
|
1026
|
-
lg:
|
|
1034
|
+
xs: "h-3 w-3",
|
|
1035
|
+
sm: "h-4 w-4",
|
|
1036
|
+
md: "h-5 w-5",
|
|
1037
|
+
lg: "h-6 w-6",
|
|
1027
1038
|
};
|
|
1028
1039
|
const bgSizeClasses = {
|
|
1029
|
-
xs:
|
|
1030
|
-
sm:
|
|
1031
|
-
md:
|
|
1032
|
-
lg:
|
|
1040
|
+
xs: "h-5 w-5",
|
|
1041
|
+
sm: "h-6 w-6",
|
|
1042
|
+
md: "h-8 w-8",
|
|
1043
|
+
lg: "h-10 w-10",
|
|
1033
1044
|
};
|
|
1034
1045
|
const iconInBgSizeClasses = {
|
|
1035
|
-
xs:
|
|
1036
|
-
sm:
|
|
1037
|
-
md:
|
|
1038
|
-
lg:
|
|
1046
|
+
xs: "h-2.5 w-2.5",
|
|
1047
|
+
sm: "h-3 w-3",
|
|
1048
|
+
md: "h-4 w-4",
|
|
1049
|
+
lg: "h-5 w-5",
|
|
1039
1050
|
};
|
|
1040
1051
|
return {
|
|
1041
1052
|
accessorKey: accessor,
|
|
1042
1053
|
header: ({ column }) => {
|
|
1043
1054
|
const displayLabel = label || String(accessor);
|
|
1044
1055
|
if (!sortable) {
|
|
1045
|
-
return (jsxRuntime.jsx("span", { className: utils.cn(
|
|
1056
|
+
return (jsxRuntime.jsx("span", { className: utils.cn("text-muted-foreground font-medium", this.getAlignmentClass(), this.config.headerClassName), children: displayLabel }));
|
|
1046
1057
|
}
|
|
1047
|
-
return (jsxRuntime.jsxs(button.Button, { variant: "table_header", size: "table_header", onClick: () => column.toggleSorting(column.getIsSorted() ===
|
|
1058
|
+
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" })] }));
|
|
1048
1059
|
},
|
|
1049
1060
|
cell: ({ getValue }) => {
|
|
1050
1061
|
const value = String(getValue());
|
|
@@ -1052,16 +1063,16 @@ class IconColumn extends BaseColumn {
|
|
|
1052
1063
|
// Default verwenden wenn State nicht gefunden
|
|
1053
1064
|
const icon = stateConfig?.icon || defaultIcon;
|
|
1054
1065
|
const stateLabel = stateConfig?.label || defaultLabel || value;
|
|
1055
|
-
const color = stateConfig?.color ||
|
|
1066
|
+
const color = stateConfig?.color || "text-muted-foreground";
|
|
1056
1067
|
const bgColor = stateConfig?.bgColor;
|
|
1057
1068
|
const tooltip$1 = stateConfig?.tooltip || stateLabel;
|
|
1058
1069
|
if (!icon) {
|
|
1059
1070
|
return jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
1060
1071
|
}
|
|
1061
1072
|
// Icon als Element rendern (falls LucideIcon übergeben wurde)
|
|
1062
|
-
const IconElement = typeof icon ===
|
|
1063
|
-
const renderedIcon = IconElement ? jsxRuntime.jsx(IconElement, { className: "h-full w-full" }) : icon;
|
|
1064
|
-
const iconElement = (jsxRuntime.jsxs("div", { className: utils.cn(
|
|
1073
|
+
const IconElement = typeof icon === "function" ? icon : null;
|
|
1074
|
+
const renderedIcon = IconElement ? (jsxRuntime.jsx(IconElement, { className: "h-full w-full" })) : icon;
|
|
1075
|
+
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 }))] }));
|
|
1065
1076
|
if (showTooltip) {
|
|
1066
1077
|
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 }) })] }) }));
|
|
1067
1078
|
}
|
|
@@ -1074,8 +1085,8 @@ class IconColumn extends BaseColumn {
|
|
|
1074
1085
|
class ImageColumn extends BaseColumn {
|
|
1075
1086
|
constructor(accessor) {
|
|
1076
1087
|
super(accessor);
|
|
1077
|
-
this.config.size =
|
|
1078
|
-
this.config.rounded =
|
|
1088
|
+
this.config.size = "md";
|
|
1089
|
+
this.config.rounded = "md";
|
|
1079
1090
|
}
|
|
1080
1091
|
static make(accessor) {
|
|
1081
1092
|
return new ImageColumn(accessor);
|
|
@@ -1089,10 +1100,10 @@ class ImageColumn extends BaseColumn {
|
|
|
1089
1100
|
return this;
|
|
1090
1101
|
}
|
|
1091
1102
|
circular() {
|
|
1092
|
-
return this.rounded(
|
|
1103
|
+
return this.rounded("full");
|
|
1093
1104
|
}
|
|
1094
1105
|
square() {
|
|
1095
|
-
return this.rounded(
|
|
1106
|
+
return this.rounded("none");
|
|
1096
1107
|
}
|
|
1097
1108
|
fallback(url) {
|
|
1098
1109
|
this.config.fallback = url;
|
|
@@ -1106,24 +1117,24 @@ class ImageColumn extends BaseColumn {
|
|
|
1106
1117
|
const config = this.config;
|
|
1107
1118
|
const { accessor, label, size, rounded, fallback, alt } = config;
|
|
1108
1119
|
const sizeClasses = {
|
|
1109
|
-
sm:
|
|
1110
|
-
md:
|
|
1111
|
-
lg:
|
|
1120
|
+
sm: "h-8 w-8",
|
|
1121
|
+
md: "h-10 w-10",
|
|
1122
|
+
lg: "h-12 w-12",
|
|
1112
1123
|
};
|
|
1113
1124
|
const roundedClasses = {
|
|
1114
|
-
none:
|
|
1115
|
-
sm:
|
|
1116
|
-
md:
|
|
1117
|
-
lg:
|
|
1118
|
-
full:
|
|
1125
|
+
none: "rounded-none",
|
|
1126
|
+
sm: "rounded-sm",
|
|
1127
|
+
md: "rounded-md",
|
|
1128
|
+
lg: "rounded-lg",
|
|
1129
|
+
full: "rounded-full",
|
|
1119
1130
|
};
|
|
1120
1131
|
return {
|
|
1121
1132
|
accessorKey: accessor,
|
|
1122
|
-
header: () => jsxRuntime.jsx("span", { className: utils.cn(
|
|
1133
|
+
header: () => (jsxRuntime.jsx("span", { className: utils.cn("text-muted-foreground font-medium", this.config.headerClassName), children: label || "" })),
|
|
1123
1134
|
cell: ({ getValue, row }) => {
|
|
1124
1135
|
const src = getValue();
|
|
1125
|
-
const altText = alt ? alt(row.original) :
|
|
1126
|
-
return (jsxRuntime.jsx("img", { src: src || fallback ||
|
|
1136
|
+
const altText = alt ? alt(row.original) : "Bild";
|
|
1137
|
+
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) => {
|
|
1127
1138
|
if (fallback) {
|
|
1128
1139
|
e.target.src = fallback;
|
|
1129
1140
|
}
|
|
@@ -1151,7 +1162,7 @@ class LinkColumn extends BaseColumn {
|
|
|
1151
1162
|
const config = this.config;
|
|
1152
1163
|
config.external = false;
|
|
1153
1164
|
config.showExternalIcon = false;
|
|
1154
|
-
config.underline =
|
|
1165
|
+
config.underline = "hover";
|
|
1155
1166
|
config.openInNewTab = false;
|
|
1156
1167
|
}
|
|
1157
1168
|
static make(accessor) {
|
|
@@ -1202,20 +1213,20 @@ class LinkColumn extends BaseColumn {
|
|
|
1202
1213
|
}
|
|
1203
1214
|
build() {
|
|
1204
1215
|
const config = this.config;
|
|
1205
|
-
const { accessor, label, sortable, href, icon, showExternalIcon, underline, openInNewTab, onClick } = config;
|
|
1216
|
+
const { accessor, label, sortable, href, icon, showExternalIcon, underline, openInNewTab, onClick, } = config;
|
|
1206
1217
|
const underlineClasses = {
|
|
1207
|
-
always:
|
|
1208
|
-
hover:
|
|
1209
|
-
never:
|
|
1218
|
+
always: "underline",
|
|
1219
|
+
hover: "hover:underline",
|
|
1220
|
+
never: "no-underline",
|
|
1210
1221
|
};
|
|
1211
1222
|
return {
|
|
1212
1223
|
accessorKey: accessor,
|
|
1213
1224
|
header: ({ column }) => {
|
|
1214
1225
|
const displayLabel = label || String(accessor);
|
|
1215
1226
|
if (!sortable) {
|
|
1216
|
-
return (jsxRuntime.jsx("span", { className: utils.cn(
|
|
1227
|
+
return (jsxRuntime.jsx("span", { className: utils.cn("text-muted-foreground font-medium", this.getAlignmentClass(), this.config.headerClassName), children: displayLabel }));
|
|
1217
1228
|
}
|
|
1218
|
-
return (jsxRuntime.jsxs(button.Button, { variant: "table_header", size: "table_header", onClick: () => column.toggleSorting(column.getIsSorted() ===
|
|
1229
|
+
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" })] }));
|
|
1219
1230
|
},
|
|
1220
1231
|
cell: ({ getValue, row }) => {
|
|
1221
1232
|
const value = getValue();
|
|
@@ -1223,7 +1234,7 @@ class LinkColumn extends BaseColumn {
|
|
|
1223
1234
|
return jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
1224
1235
|
}
|
|
1225
1236
|
// URL berechnen
|
|
1226
|
-
const url = typeof href ===
|
|
1237
|
+
const url = typeof href === "function" ? href(row.original) : href || value;
|
|
1227
1238
|
const handleClick = (e) => {
|
|
1228
1239
|
if (onClick) {
|
|
1229
1240
|
e.preventDefault();
|
|
@@ -1231,8 +1242,12 @@ class LinkColumn extends BaseColumn {
|
|
|
1231
1242
|
}
|
|
1232
1243
|
};
|
|
1233
1244
|
// Alignment ohne text-muted-foreground für Links
|
|
1234
|
-
const alignmentClass = this.config.align ===
|
|
1235
|
-
|
|
1245
|
+
const alignmentClass = this.config.align === "center"
|
|
1246
|
+
? "text-center"
|
|
1247
|
+
: this.config.align === "right"
|
|
1248
|
+
? "text-right"
|
|
1249
|
+
: "text-left";
|
|
1250
|
+
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" }))] }));
|
|
1236
1251
|
},
|
|
1237
1252
|
};
|
|
1238
1253
|
}
|
|
@@ -1241,9 +1256,9 @@ class LinkColumn extends BaseColumn {
|
|
|
1241
1256
|
class NumberColumn extends BaseColumn {
|
|
1242
1257
|
constructor(accessor) {
|
|
1243
1258
|
super(accessor);
|
|
1244
|
-
this.config.align =
|
|
1259
|
+
this.config.align = "right"; // Zahlen standardmäßig rechtsbündig
|
|
1245
1260
|
this.config.decimals = 0;
|
|
1246
|
-
this.config.locale =
|
|
1261
|
+
this.config.locale = "de-DE";
|
|
1247
1262
|
}
|
|
1248
1263
|
static make(accessor) {
|
|
1249
1264
|
return new NumberColumn(accessor);
|
|
@@ -1257,7 +1272,7 @@ class NumberColumn extends BaseColumn {
|
|
|
1257
1272
|
return this;
|
|
1258
1273
|
}
|
|
1259
1274
|
// Währungsformatierung
|
|
1260
|
-
money(currency =
|
|
1275
|
+
money(currency = "EUR") {
|
|
1261
1276
|
this.config.currency = currency;
|
|
1262
1277
|
this.config.decimals = 2;
|
|
1263
1278
|
return this;
|
|
@@ -1277,15 +1292,15 @@ class NumberColumn extends BaseColumn {
|
|
|
1277
1292
|
}
|
|
1278
1293
|
build() {
|
|
1279
1294
|
const config = this.config;
|
|
1280
|
-
const { accessor, label, sortable, decimals, locale, currency, percent, prefix, suffix } = config;
|
|
1295
|
+
const { accessor, label, sortable, decimals, locale, currency, percent, prefix, suffix, } = config;
|
|
1281
1296
|
return {
|
|
1282
1297
|
accessorKey: accessor,
|
|
1283
1298
|
header: ({ column }) => {
|
|
1284
1299
|
const displayLabel = label || String(accessor);
|
|
1285
1300
|
if (!sortable) {
|
|
1286
|
-
return (jsxRuntime.jsx("span", { className: utils.cn(
|
|
1301
|
+
return (jsxRuntime.jsx("span", { className: utils.cn("text-muted-foreground font-medium", this.getAlignmentClass(), this.config.headerClassName), children: displayLabel }));
|
|
1287
1302
|
}
|
|
1288
|
-
return (jsxRuntime.jsxs(button.Button, { variant: "table_header", size: "table_header", onClick: () => column.toggleSorting(column.getIsSorted() ===
|
|
1303
|
+
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" })] }));
|
|
1289
1304
|
},
|
|
1290
1305
|
cell: ({ getValue }) => {
|
|
1291
1306
|
const value = getValue();
|
|
@@ -1295,7 +1310,7 @@ class NumberColumn extends BaseColumn {
|
|
|
1295
1310
|
let formatted;
|
|
1296
1311
|
if (currency) {
|
|
1297
1312
|
formatted = new Intl.NumberFormat(locale, {
|
|
1298
|
-
style:
|
|
1313
|
+
style: "currency",
|
|
1299
1314
|
currency,
|
|
1300
1315
|
minimumFractionDigits: decimals,
|
|
1301
1316
|
maximumFractionDigits: decimals,
|
|
@@ -1303,7 +1318,7 @@ class NumberColumn extends BaseColumn {
|
|
|
1303
1318
|
}
|
|
1304
1319
|
else if (percent) {
|
|
1305
1320
|
formatted = new Intl.NumberFormat(locale, {
|
|
1306
|
-
style:
|
|
1321
|
+
style: "percent",
|
|
1307
1322
|
minimumFractionDigits: decimals,
|
|
1308
1323
|
maximumFractionDigits: decimals,
|
|
1309
1324
|
}).format(value / 100);
|
|
@@ -1314,8 +1329,8 @@ class NumberColumn extends BaseColumn {
|
|
|
1314
1329
|
maximumFractionDigits: decimals,
|
|
1315
1330
|
}).format(value);
|
|
1316
1331
|
}
|
|
1317
|
-
const displayValue = `${prefix ||
|
|
1318
|
-
return jsxRuntime.jsx("span", { className: utils.cn(
|
|
1332
|
+
const displayValue = `${prefix || ""}${formatted}${suffix || ""}`;
|
|
1333
|
+
return (jsxRuntime.jsx("span", { className: utils.cn("tabular-nums", this.getAlignmentClass(), this.config.cellClassName), children: displayValue }));
|
|
1319
1334
|
},
|
|
1320
1335
|
};
|
|
1321
1336
|
}
|
|
@@ -1328,8 +1343,8 @@ class ProgressColumn extends BaseColumn {
|
|
|
1328
1343
|
config.max = 100;
|
|
1329
1344
|
config.showValue = false;
|
|
1330
1345
|
config.showPercentage = true;
|
|
1331
|
-
config.size =
|
|
1332
|
-
config.color =
|
|
1346
|
+
config.size = "md";
|
|
1347
|
+
config.color = "default";
|
|
1333
1348
|
}
|
|
1334
1349
|
static make(accessor) {
|
|
1335
1350
|
return new ProgressColumn(accessor);
|
|
@@ -1373,10 +1388,10 @@ class ProgressColumn extends BaseColumn {
|
|
|
1373
1388
|
config.color = (value, max) => {
|
|
1374
1389
|
const percent = (value / max) * 100;
|
|
1375
1390
|
if (percent <= danger)
|
|
1376
|
-
return
|
|
1391
|
+
return "danger";
|
|
1377
1392
|
if (percent <= warning)
|
|
1378
|
-
return
|
|
1379
|
-
return
|
|
1393
|
+
return "warning";
|
|
1394
|
+
return "success";
|
|
1380
1395
|
};
|
|
1381
1396
|
return this;
|
|
1382
1397
|
}
|
|
@@ -1387,10 +1402,10 @@ class ProgressColumn extends BaseColumn {
|
|
|
1387
1402
|
config.color = (value, max) => {
|
|
1388
1403
|
const percent = (value / max) * 100;
|
|
1389
1404
|
if (percent >= danger)
|
|
1390
|
-
return
|
|
1405
|
+
return "danger";
|
|
1391
1406
|
if (percent >= warning)
|
|
1392
|
-
return
|
|
1393
|
-
return
|
|
1407
|
+
return "warning";
|
|
1408
|
+
return "success";
|
|
1394
1409
|
};
|
|
1395
1410
|
return this;
|
|
1396
1411
|
}
|
|
@@ -1401,26 +1416,26 @@ class ProgressColumn extends BaseColumn {
|
|
|
1401
1416
|
}
|
|
1402
1417
|
build() {
|
|
1403
1418
|
const config = this.config;
|
|
1404
|
-
const { accessor, label, sortable, max, showValue, showPercentage, size, color, format } = config;
|
|
1419
|
+
const { accessor, label, sortable, max, showValue, showPercentage, size, color, format, } = config;
|
|
1405
1420
|
const sizeClasses = {
|
|
1406
|
-
sm:
|
|
1407
|
-
md:
|
|
1408
|
-
lg:
|
|
1421
|
+
sm: "h-1.5",
|
|
1422
|
+
md: "h-2",
|
|
1423
|
+
lg: "h-3",
|
|
1409
1424
|
};
|
|
1410
1425
|
const colorClasses = {
|
|
1411
|
-
default:
|
|
1412
|
-
success:
|
|
1413
|
-
warning:
|
|
1414
|
-
danger:
|
|
1426
|
+
default: "[&>div]:bg-primary",
|
|
1427
|
+
success: "[&>div]:bg-green-500",
|
|
1428
|
+
warning: "[&>div]:bg-yellow-500",
|
|
1429
|
+
danger: "[&>div]:bg-red-500",
|
|
1415
1430
|
};
|
|
1416
1431
|
return {
|
|
1417
1432
|
accessorKey: accessor,
|
|
1418
1433
|
header: ({ column }) => {
|
|
1419
1434
|
const displayLabel = label || String(accessor);
|
|
1420
1435
|
if (!sortable) {
|
|
1421
|
-
return (jsxRuntime.jsx("span", { className: utils.cn(
|
|
1436
|
+
return (jsxRuntime.jsx("span", { className: utils.cn("text-muted-foreground font-medium", this.getAlignmentClass(), this.config.headerClassName), children: displayLabel }));
|
|
1422
1437
|
}
|
|
1423
|
-
return (jsxRuntime.jsxs(button.Button, { variant: "table_header", size: "table_header", onClick: () => column.toggleSorting(column.getIsSorted() ===
|
|
1438
|
+
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" })] }));
|
|
1424
1439
|
},
|
|
1425
1440
|
cell: ({ getValue }) => {
|
|
1426
1441
|
const value = getValue();
|
|
@@ -1430,9 +1445,11 @@ class ProgressColumn extends BaseColumn {
|
|
|
1430
1445
|
}
|
|
1431
1446
|
const percentage = Math.min(100, Math.max(0, (value / maxValue) * 100));
|
|
1432
1447
|
// Farbe berechnen
|
|
1433
|
-
const currentColor = typeof color ===
|
|
1448
|
+
const currentColor = typeof color === "function"
|
|
1449
|
+
? color(value, maxValue)
|
|
1450
|
+
: color || "default";
|
|
1434
1451
|
// Label erstellen
|
|
1435
|
-
let labelText =
|
|
1452
|
+
let labelText = "";
|
|
1436
1453
|
if (format) {
|
|
1437
1454
|
labelText = format(value, maxValue);
|
|
1438
1455
|
}
|
|
@@ -1442,7 +1459,7 @@ class ProgressColumn extends BaseColumn {
|
|
|
1442
1459
|
else if (showPercentage) {
|
|
1443
1460
|
labelText = `${Math.round(percentage)}%`;
|
|
1444
1461
|
}
|
|
1445
|
-
return (jsxRuntime.jsxs("div", { className: utils.cn(
|
|
1462
|
+
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 }))] }));
|
|
1446
1463
|
},
|
|
1447
1464
|
};
|
|
1448
1465
|
}
|
|
@@ -1485,7 +1502,9 @@ class TextColumn extends BaseColumn {
|
|
|
1485
1502
|
const existingFormatter = this.config.formatter;
|
|
1486
1503
|
this.config.formatter = (value, row) => {
|
|
1487
1504
|
const result = existingFormatter ? existingFormatter(value, row) : value;
|
|
1488
|
-
return typeof result ===
|
|
1505
|
+
return typeof result === "string"
|
|
1506
|
+
? result.toUpperCase()
|
|
1507
|
+
: result;
|
|
1489
1508
|
};
|
|
1490
1509
|
return this;
|
|
1491
1510
|
}
|
|
@@ -1493,7 +1512,9 @@ class TextColumn extends BaseColumn {
|
|
|
1493
1512
|
const existingFormatter = this.config.formatter;
|
|
1494
1513
|
this.config.formatter = (value, row) => {
|
|
1495
1514
|
const result = existingFormatter ? existingFormatter(value, row) : value;
|
|
1496
|
-
return typeof result ===
|
|
1515
|
+
return typeof result === "string"
|
|
1516
|
+
? result.toLowerCase()
|
|
1517
|
+
: result;
|
|
1497
1518
|
};
|
|
1498
1519
|
return this;
|
|
1499
1520
|
}
|
|
@@ -1501,23 +1522,23 @@ class TextColumn extends BaseColumn {
|
|
|
1501
1522
|
const existingFormatter = this.config.formatter;
|
|
1502
1523
|
this.config.formatter = (value, row) => {
|
|
1503
1524
|
const result = existingFormatter ? existingFormatter(value, row) : value;
|
|
1504
|
-
if (typeof result ===
|
|
1505
|
-
return result.slice(0, chars) +
|
|
1525
|
+
if (typeof result === "string" && result.length > chars) {
|
|
1526
|
+
return result.slice(0, chars) + "...";
|
|
1506
1527
|
}
|
|
1507
1528
|
return result;
|
|
1508
1529
|
};
|
|
1509
1530
|
return this;
|
|
1510
1531
|
}
|
|
1511
1532
|
build() {
|
|
1512
|
-
const { accessor, label, sortable, prefix, suffix, placeholder, formatter } = this.config;
|
|
1533
|
+
const { accessor, label, sortable, prefix, suffix, placeholder, formatter, } = this.config;
|
|
1513
1534
|
return {
|
|
1514
1535
|
accessorKey: accessor,
|
|
1515
1536
|
header: ({ column }) => {
|
|
1516
1537
|
const displayLabel = label || String(accessor);
|
|
1517
1538
|
if (!sortable) {
|
|
1518
|
-
return (jsxRuntime.jsx("span", { className: utils.cn(
|
|
1539
|
+
return (jsxRuntime.jsx("span", { className: utils.cn("text-muted-foreground font-medium", this.getAlignmentClass(), this.config.headerClassName), children: displayLabel }));
|
|
1519
1540
|
}
|
|
1520
|
-
return (jsxRuntime.jsxs(button.Button, { variant: "table_header", size: "table_header", onClick: () => column.toggleSorting(column.getIsSorted() ===
|
|
1541
|
+
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" })] }));
|
|
1521
1542
|
},
|
|
1522
1543
|
cell: ({ row, getValue }) => {
|
|
1523
1544
|
let value = getValue();
|
|
@@ -1526,12 +1547,12 @@ class TextColumn extends BaseColumn {
|
|
|
1526
1547
|
value = formatter(value, row);
|
|
1527
1548
|
}
|
|
1528
1549
|
// Placeholder wenn leer
|
|
1529
|
-
if (value === null || value === undefined || value ===
|
|
1530
|
-
return (jsxRuntime.jsx("span", { className: utils.cn(
|
|
1550
|
+
if (value === null || value === undefined || value === "") {
|
|
1551
|
+
return (jsxRuntime.jsx("span", { className: utils.cn("text-muted-foreground", this.getAlignmentClass(), this.config.cellClassName), children: placeholder || "—" }));
|
|
1531
1552
|
}
|
|
1532
1553
|
// Prefix/Suffix hinzufügen
|
|
1533
|
-
const displayValue = `${prefix ||
|
|
1534
|
-
return jsxRuntime.jsx("span", { className: utils.cn(this.getAlignmentClass(), this.config.cellClassName), children: displayValue });
|
|
1554
|
+
const displayValue = `${prefix || ""}${value}${suffix || ""}`;
|
|
1555
|
+
return (jsxRuntime.jsx("span", { className: utils.cn(this.getAlignmentClass(), this.config.cellClassName), children: displayValue }));
|
|
1535
1556
|
},
|
|
1536
1557
|
};
|
|
1537
1558
|
}
|
|
@@ -1540,7 +1561,7 @@ class TextColumn extends BaseColumn {
|
|
|
1540
1561
|
class ActionsColumn {
|
|
1541
1562
|
config = {
|
|
1542
1563
|
actions: [],
|
|
1543
|
-
label:
|
|
1564
|
+
label: "Aktionen",
|
|
1544
1565
|
};
|
|
1545
1566
|
static make() {
|
|
1546
1567
|
return new ActionsColumn();
|
|
@@ -1560,16 +1581,16 @@ class ActionsColumn {
|
|
|
1560
1581
|
}
|
|
1561
1582
|
// Shortcuts für gängige Actions
|
|
1562
1583
|
view(onClick) {
|
|
1563
|
-
return this.action({ label:
|
|
1584
|
+
return this.action({ label: "Anzeigen", onClick });
|
|
1564
1585
|
}
|
|
1565
1586
|
edit(onClick) {
|
|
1566
|
-
return this.action({ label:
|
|
1587
|
+
return this.action({ label: "Bearbeiten", onClick });
|
|
1567
1588
|
}
|
|
1568
1589
|
delete(onClick) {
|
|
1569
1590
|
return this.action({
|
|
1570
|
-
label:
|
|
1591
|
+
label: "Löschen",
|
|
1571
1592
|
onClick,
|
|
1572
|
-
variant:
|
|
1593
|
+
variant: "destructive",
|
|
1573
1594
|
separator: true,
|
|
1574
1595
|
});
|
|
1575
1596
|
}
|
|
@@ -1585,21 +1606,22 @@ class ActionsColumn {
|
|
|
1585
1606
|
build() {
|
|
1586
1607
|
const { actions, label, triggerIcon } = this.config;
|
|
1587
1608
|
return {
|
|
1588
|
-
id:
|
|
1609
|
+
id: "actions",
|
|
1589
1610
|
header: () => jsxRuntime.jsx("span", { className: "sr-only", children: label }),
|
|
1590
1611
|
cell: ({ row }) => {
|
|
1591
1612
|
const data = row.original;
|
|
1592
1613
|
const visibleActions = actions.filter((action) => !action.hidden || !action.hidden(data));
|
|
1593
1614
|
if (visibleActions.length === 0)
|
|
1594
1615
|
return null;
|
|
1595
|
-
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 ===
|
|
1616
|
+
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" &&
|
|
1617
|
+
"text-destructive focus:text-destructive"), onClick: () => {
|
|
1596
1618
|
if (action.href) {
|
|
1597
1619
|
window.location.href = action.href(data);
|
|
1598
1620
|
}
|
|
1599
1621
|
else if (action.onClick) {
|
|
1600
1622
|
action.onClick(data);
|
|
1601
1623
|
}
|
|
1602
|
-
}, 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))) })] }));
|
|
1624
|
+
}, 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))) })] }));
|
|
1603
1625
|
},
|
|
1604
1626
|
};
|
|
1605
1627
|
}
|