@addsign/moje-agenda-shared-lib 1.0.19 → 1.0.21

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.
@@ -21701,6 +21701,7 @@ function DataTableServer({
21701
21701
  const [isLoading, setIsLoading] = useState(false);
21702
21702
  const [isLocalStorageLoaded, setIsLocalStorageLoaded] = useState(false);
21703
21703
  const [tableKey, setTableKey] = useState(0);
21704
+ const [hasMounted, setHasMounted] = useState(false);
21704
21705
  const [currentPage, setCurrentPage] = useState();
21705
21706
  const [selectedItems, setSelectedItems] = useState([]);
21706
21707
  const [fulltextSearch, setFulltextSearch] = useState("");
@@ -21803,7 +21804,7 @@ function DataTableServer({
21803
21804
  setColumnFilters(storageObject.columnFilters);
21804
21805
  setShowColFilters(storageObject.showColFilters);
21805
21806
  setCurrentPage(storageObject.currentPage || 0);
21806
- setSortConfig(null);
21807
+ setSortConfig(storageObject.sortConfig || null);
21807
21808
  setItemsPerPageLocal(storageObject.itemsPerPage || 10);
21808
21809
  }
21809
21810
  setIsLocalStorageLoaded(true);
@@ -21915,7 +21916,13 @@ function DataTableServer({
21915
21916
  setShowColFilters(!showColFilters);
21916
21917
  };
21917
21918
  useEffect(() => {
21918
- setCurrentPage(0);
21919
+ if (!hasMounted) {
21920
+ console.log("useEffect ran on mount");
21921
+ setHasMounted(true);
21922
+ } else {
21923
+ console.log("useEffect ran due to prop change");
21924
+ setCurrentPage(0);
21925
+ }
21919
21926
  }, [filters]);
21920
21927
  useEffect(() => {
21921
21928
  if (id && isLocalStorageLoaded) {
@@ -21928,6 +21935,7 @@ function DataTableServer({
21928
21935
  storageObject.columnFilters = columnFilters || {};
21929
21936
  storageObject.showColFilters = showColFilters || false;
21930
21937
  storageObject.currentPage = currentPage || 0;
21938
+ storageObject.sortConfig = sortConfig || null;
21931
21939
  storageObject.itemsPerPage = itemsPerPageLocal || 10;
21932
21940
  localStorage.setItem(storageKey, JSON.stringify(storageObject));
21933
21941
  }
@@ -21937,7 +21945,8 @@ function DataTableServer({
21937
21945
  currentPage,
21938
21946
  id,
21939
21947
  itemsPerPageLocal,
21940
- isLocalStorageLoaded
21948
+ isLocalStorageLoaded,
21949
+ sortConfig
21941
21950
  ]);
21942
21951
  const rerenderTable = () => {
21943
21952
  setTableKey((previous) => previous + 1);
@@ -22268,7 +22277,7 @@ function DataTableServer({
22268
22277
  isLoading && (!data || ((_b = data == null ? void 0 : data.content) == null ? void 0 : _b.length) === 0) && /* @__PURE__ */ jsx("tbody", { className: "relative", children: /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 100, children: /* @__PURE__ */ jsx("div", { className: "w-full flex items-center justify-center h-full py-2", children: /* @__PURE__ */ jsx(Spinner, {}) }) }) }) })
22269
22278
  ] }, tableKey) }),
22270
22279
  /* @__PURE__ */ jsxs("div", { className: "w-full p-5 flex gap-5 justify-between", children: [
22271
- /* @__PURE__ */ jsxs("div", { className: "flex gap-5 ", children: [
22280
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-5 text-sm ", children: [
22272
22281
  data && /* @__PURE__ */ jsxs(
22273
22282
  Button,
22274
22283
  {
@@ -22295,11 +22304,11 @@ function DataTableServer({
22295
22304
  ]
22296
22305
  }
22297
22306
  ),
22298
- /* @__PURE__ */ jsx("div", { className: "flex items-center justify-end text-sm text-gray-800", children: paginationDisplay })
22307
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-end text-gray-800", children: paginationDisplay })
22299
22308
  ] }),
22300
22309
  " ",
22301
22310
  /* @__PURE__ */ jsxs("div", { className: "content-center w-auto items-center justify-end flex-row gap-5 flex", children: [
22302
- /* @__PURE__ */ jsx("span", { className: "text-sm whitespace-nowrap flex-grow", children: "Počet řádků na stránku:" }),
22311
+ /* @__PURE__ */ jsx("span", { className: " whitespace-nowrap flex-grow", children: "Počet řádků na stránku:" }),
22303
22312
  /* @__PURE__ */ jsx(
22304
22313
  SelectField,
22305
22314
  {