@addsign/moje-agenda-shared-lib 0.0.88 → 0.0.90
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.
|
@@ -21698,7 +21698,7 @@ function DataTableServer({
|
|
|
21698
21698
|
const [data, setData] = useState();
|
|
21699
21699
|
const [isLoading, setIsLoading] = useState(false);
|
|
21700
21700
|
const [tableKey, setTableKey] = useState(0);
|
|
21701
|
-
const [currentPage, setCurrentPage] = useState(
|
|
21701
|
+
const [currentPage, setCurrentPage] = useState();
|
|
21702
21702
|
const [selectedItems, setSelectedItems] = useState([]);
|
|
21703
21703
|
const [fulltextSearch, setFulltextSearch] = useState("");
|
|
21704
21704
|
const [filterOptions, setFilterOptions] = useState({});
|
|
@@ -21720,6 +21720,13 @@ function DataTableServer({
|
|
|
21720
21720
|
};
|
|
21721
21721
|
};
|
|
21722
21722
|
useEffect(() => {
|
|
21723
|
+
console.log(
|
|
21724
|
+
"%clibcomponentsdatatableDataTableServer.tsx:103 currentPage",
|
|
21725
|
+
"color: #007acc;",
|
|
21726
|
+
currentPage
|
|
21727
|
+
);
|
|
21728
|
+
if (currentPage === void 0)
|
|
21729
|
+
return;
|
|
21723
21730
|
setIsLoading(true);
|
|
21724
21731
|
federationContext.apiClient.get(url, {
|
|
21725
21732
|
params: {
|
|
@@ -21850,17 +21857,17 @@ function DataTableServer({
|
|
|
21850
21857
|
return selectedItems.some((selectedItem) => selectedItem.id === item.id);
|
|
21851
21858
|
};
|
|
21852
21859
|
const nextPage = () => {
|
|
21853
|
-
setCurrentPage(currentPage + 1);
|
|
21860
|
+
setCurrentPage((currentPage || 0) + 1);
|
|
21854
21861
|
};
|
|
21855
21862
|
const prevPage = () => {
|
|
21856
|
-
setCurrentPage(currentPage - 1);
|
|
21863
|
+
setCurrentPage((currentPage || 0) - 1);
|
|
21857
21864
|
};
|
|
21858
21865
|
const handleSearchChanged = (e) => {
|
|
21859
21866
|
var _a2;
|
|
21860
21867
|
setFulltextSearch((_a2 = e.target) == null ? void 0 : _a2.value);
|
|
21861
21868
|
setCurrentPage(0);
|
|
21862
21869
|
};
|
|
21863
|
-
const paginationDisplay = `Strana ${currentPage + 1} z ${data == null ? void 0 : data.totalPages}`;
|
|
21870
|
+
const paginationDisplay = `Strana ${(currentPage || 0) + 1} z ${data == null ? void 0 : data.totalPages}`;
|
|
21864
21871
|
const filterHandler = (filterParam, value) => {
|
|
21865
21872
|
setColumnFilters((prev) => ({ ...prev, [filterParam]: value }));
|
|
21866
21873
|
setCurrentPage(0);
|
|
@@ -21879,18 +21886,24 @@ function DataTableServer({
|
|
|
21879
21886
|
const storageObject = JSON.parse(storedStorageObject);
|
|
21880
21887
|
setColumnFilters(storageObject.columnFilters);
|
|
21881
21888
|
setShowColFilters(storageObject.showColFilters);
|
|
21889
|
+
setCurrentPage(storageObject.currentPage || 0);
|
|
21882
21890
|
}
|
|
21883
21891
|
}
|
|
21884
21892
|
}, [id]);
|
|
21885
21893
|
useEffect(() => {
|
|
21886
|
-
if (id
|
|
21894
|
+
if (id) {
|
|
21887
21895
|
const storageKey = `datatable:${id}`;
|
|
21888
|
-
const storageObject = localStorage.getItem(
|
|
21889
|
-
|
|
21890
|
-
|
|
21896
|
+
const storageObject = localStorage.getItem(
|
|
21897
|
+
storageKey
|
|
21898
|
+
) ? JSON.parse(
|
|
21899
|
+
localStorage.getItem(storageKey)
|
|
21900
|
+
) : {};
|
|
21901
|
+
storageObject.columnFilters = columnFilters || {};
|
|
21902
|
+
storageObject.showColFilters = showColFilters || false;
|
|
21903
|
+
storageObject.currentPage = currentPage || storageObject.currentPage || 0;
|
|
21891
21904
|
localStorage.setItem(storageKey, JSON.stringify(storageObject));
|
|
21892
21905
|
}
|
|
21893
|
-
}, [columnFilters, showColFilters, id]);
|
|
21906
|
+
}, [columnFilters, showColFilters, currentPage, id]);
|
|
21894
21907
|
const rerenderTable = () => {
|
|
21895
21908
|
setTableKey((previous) => previous + 1);
|
|
21896
21909
|
};
|
|
@@ -21942,6 +21955,11 @@ function DataTableServer({
|
|
|
21942
21955
|
handleErrors,
|
|
21943
21956
|
columns
|
|
21944
21957
|
]);
|
|
21958
|
+
console.log(
|
|
21959
|
+
"%clibcomponentsdatatableDataTableServer.tsx:392 data",
|
|
21960
|
+
"color: #007acc;",
|
|
21961
|
+
data
|
|
21962
|
+
);
|
|
21945
21963
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
21946
21964
|
"div",
|
|
21947
21965
|
{
|