@addsign/moje-agenda-shared-lib 0.0.81 → 0.0.83
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.
|
@@ -21705,6 +21705,19 @@ function DataTableServer({
|
|
|
21705
21705
|
const [columnFilters, setColumnFilters] = useState();
|
|
21706
21706
|
const [showColFilters, setShowColFilters] = useState();
|
|
21707
21707
|
const [sortConfig, setSortConfig] = useState(null);
|
|
21708
|
+
const createDataPageable = (response, itemsPerPage2) => {
|
|
21709
|
+
return {
|
|
21710
|
+
content: response.data.content || response.data,
|
|
21711
|
+
empty: response.data.empty || false,
|
|
21712
|
+
first: response.data.first || true,
|
|
21713
|
+
last: response.data.last || true,
|
|
21714
|
+
number: response.data.number || 0,
|
|
21715
|
+
numberOfElements: response.data.numberOfElements || response.data.length,
|
|
21716
|
+
size: response.data.size || itemsPerPage2,
|
|
21717
|
+
totalElements: response.data.totalElements || response.data.length,
|
|
21718
|
+
totalPages: response.data.totalPages || 1
|
|
21719
|
+
};
|
|
21720
|
+
};
|
|
21708
21721
|
useEffect(() => {
|
|
21709
21722
|
setIsLoading(true);
|
|
21710
21723
|
federationContext.apiClient.get(url, {
|
|
@@ -21717,11 +21730,26 @@ function DataTableServer({
|
|
|
21717
21730
|
sortDirection: sortConfig == null ? void 0 : sortConfig.direction
|
|
21718
21731
|
}
|
|
21719
21732
|
}).then((response) => {
|
|
21720
|
-
|
|
21733
|
+
const dataPageable = createDataPageable(
|
|
21734
|
+
response,
|
|
21735
|
+
itemsPerPage
|
|
21736
|
+
);
|
|
21737
|
+
setData(dataPageable);
|
|
21721
21738
|
setIsLoading(false);
|
|
21722
21739
|
}).catch((error) => {
|
|
21723
21740
|
console.error("Error fetching data:", error);
|
|
21724
21741
|
handleErrors(error, federationContext.emitter);
|
|
21742
|
+
setData({
|
|
21743
|
+
content: [],
|
|
21744
|
+
empty: true,
|
|
21745
|
+
first: true,
|
|
21746
|
+
last: true,
|
|
21747
|
+
number: 0,
|
|
21748
|
+
numberOfElements: 0,
|
|
21749
|
+
size: itemsPerPage,
|
|
21750
|
+
totalElements: 0,
|
|
21751
|
+
totalPages: 1
|
|
21752
|
+
});
|
|
21725
21753
|
setIsLoading(false);
|
|
21726
21754
|
});
|
|
21727
21755
|
}, [
|
|
@@ -21877,14 +21905,18 @@ function DataTableServer({
|
|
|
21877
21905
|
sortDirection: sortConfig == null ? void 0 : sortConfig.direction
|
|
21878
21906
|
}
|
|
21879
21907
|
}).then((response) => {
|
|
21880
|
-
var _a2;
|
|
21881
21908
|
setIsLoading(false);
|
|
21909
|
+
const dataPageable = createDataPageable(
|
|
21910
|
+
response,
|
|
21911
|
+
1e6
|
|
21912
|
+
);
|
|
21882
21913
|
const worksheet = utils.json_to_sheet(
|
|
21883
|
-
|
|
21914
|
+
dataPageable.content.map((item) => {
|
|
21884
21915
|
const row = {};
|
|
21885
21916
|
columns.forEach((column) => {
|
|
21917
|
+
var _a2;
|
|
21886
21918
|
if (column.render) {
|
|
21887
|
-
row[column.header] = column.render(item);
|
|
21919
|
+
row[column.header] = (_a2 = column.render(item)) == null ? void 0 : _a2.toString();
|
|
21888
21920
|
}
|
|
21889
21921
|
});
|
|
21890
21922
|
return row;
|
|
@@ -22116,8 +22148,11 @@ function DataTableServer({
|
|
|
22116
22148
|
!action.icon && /* @__PURE__ */ jsx(
|
|
22117
22149
|
Button,
|
|
22118
22150
|
{
|
|
22119
|
-
variant: "
|
|
22120
|
-
onClick: () =>
|
|
22151
|
+
variant: "primary",
|
|
22152
|
+
onClick: (e) => {
|
|
22153
|
+
e.stopPropagation();
|
|
22154
|
+
action.onClick(item);
|
|
22155
|
+
},
|
|
22121
22156
|
children: action.label
|
|
22122
22157
|
}
|
|
22123
22158
|
)
|