next-helios-fe 1.10.8 → 1.10.10
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/components/table/index.d.ts +10 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/table/index.tsx +40 -17
package/package.json
CHANGED
|
@@ -43,6 +43,16 @@ interface TableProps {
|
|
|
43
43
|
export?: {
|
|
44
44
|
tooltip?: string;
|
|
45
45
|
show: boolean;
|
|
46
|
+
onExport?: (value: {
|
|
47
|
+
search: string;
|
|
48
|
+
page: number;
|
|
49
|
+
dataOffset: number;
|
|
50
|
+
maxRow: number;
|
|
51
|
+
filter: any[];
|
|
52
|
+
categoryFilter: any[];
|
|
53
|
+
dateFilter: any[];
|
|
54
|
+
sortBy: any;
|
|
55
|
+
}) => void;
|
|
46
56
|
};
|
|
47
57
|
columnSearch?: {
|
|
48
58
|
show: boolean;
|
|
@@ -780,7 +790,7 @@ export const Table: TableComponentProps = ({
|
|
|
780
790
|
return (
|
|
781
791
|
<td
|
|
782
792
|
key={headerItem.key}
|
|
783
|
-
className="whitespace-nowrap bg-secondary-bg px-4 py-1.5
|
|
793
|
+
className="whitespace-nowrap bg-secondary-bg px-4 py-1.5"
|
|
784
794
|
>
|
|
785
795
|
{headerItem.render(item) || "-"}
|
|
786
796
|
</td>
|
|
@@ -951,23 +961,36 @@ export const Table: TableComponentProps = ({
|
|
|
951
961
|
options={{ variant: "primary", width: "fit" }}
|
|
952
962
|
disabled={loading}
|
|
953
963
|
onClick={() => {
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
964
|
+
if (options?.toolbar?.export?.onExport) {
|
|
965
|
+
options?.toolbar?.export?.onExport({
|
|
966
|
+
search,
|
|
967
|
+
page,
|
|
968
|
+
dataOffset: (page - 1) * maxRow,
|
|
969
|
+
maxRow,
|
|
970
|
+
filter,
|
|
971
|
+
categoryFilter,
|
|
972
|
+
dateFilter,
|
|
973
|
+
sortBy,
|
|
974
|
+
});
|
|
975
|
+
} else {
|
|
976
|
+
const exportData = filteredData?.map((item, index) => {
|
|
977
|
+
return header
|
|
978
|
+
?.filter(
|
|
979
|
+
(headerItem) =>
|
|
980
|
+
!excludedColumn?.includes(headerItem.key)
|
|
981
|
+
)
|
|
982
|
+
?.reduce((acc, headerItem) => {
|
|
983
|
+
return {
|
|
984
|
+
...acc,
|
|
985
|
+
"No.": (index + 1)?.toString(),
|
|
986
|
+
[headerItem.title]:
|
|
987
|
+
item[headerItem.key as keyof typeof item],
|
|
988
|
+
};
|
|
989
|
+
}, {});
|
|
990
|
+
});
|
|
969
991
|
|
|
970
|
-
|
|
992
|
+
handleExportData(title || "Table Data", exportData);
|
|
993
|
+
}
|
|
971
994
|
}}
|
|
972
995
|
>
|
|
973
996
|
Export
|