@addsign/moje-agenda-shared-lib 1.0.20 → 1.0.22
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.
|
@@ -22,5 +22,6 @@ type DataTableInternalItems = {
|
|
|
22
22
|
_isHighlighted?: boolean;
|
|
23
23
|
id: string;
|
|
24
24
|
};
|
|
25
|
+
export declare const resetAllDataTablePaging: () => void;
|
|
25
26
|
declare function DataTableServer<T extends DataTableInternalItems>({ id, url, columns, title, subtitle, allowSearch, showHeader, rowAction, bulkAction, filters, }: DataTableServerProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
26
27
|
export default DataTableServer;
|
|
@@ -21682,6 +21682,16 @@ var utils = {
|
|
|
21682
21682
|
SHEET_VERY_HIDDEN: 2
|
|
21683
21683
|
}
|
|
21684
21684
|
};
|
|
21685
|
+
const resetAllDataTablePaging = () => {
|
|
21686
|
+
Object.keys(localStorage).filter((key) => key.startsWith("datatable:")).forEach((key) => {
|
|
21687
|
+
const storageObject = localStorage.getItem(key);
|
|
21688
|
+
if (storageObject) {
|
|
21689
|
+
const parsedObject = JSON.parse(storageObject);
|
|
21690
|
+
parsedObject.currentPage = 0;
|
|
21691
|
+
localStorage.setItem(key, JSON.stringify(parsedObject));
|
|
21692
|
+
}
|
|
21693
|
+
});
|
|
21694
|
+
};
|
|
21685
21695
|
function DataTableServer({
|
|
21686
21696
|
id,
|
|
21687
21697
|
url,
|
|
@@ -21701,6 +21711,7 @@ function DataTableServer({
|
|
|
21701
21711
|
const [isLoading, setIsLoading] = useState(false);
|
|
21702
21712
|
const [isLocalStorageLoaded, setIsLocalStorageLoaded] = useState(false);
|
|
21703
21713
|
const [tableKey, setTableKey] = useState(0);
|
|
21714
|
+
const [hasMounted, setHasMounted] = useState(false);
|
|
21704
21715
|
const [currentPage, setCurrentPage] = useState();
|
|
21705
21716
|
const [selectedItems, setSelectedItems] = useState([]);
|
|
21706
21717
|
const [fulltextSearch, setFulltextSearch] = useState("");
|
|
@@ -21803,7 +21814,7 @@ function DataTableServer({
|
|
|
21803
21814
|
setColumnFilters(storageObject.columnFilters);
|
|
21804
21815
|
setShowColFilters(storageObject.showColFilters);
|
|
21805
21816
|
setCurrentPage(storageObject.currentPage || 0);
|
|
21806
|
-
setSortConfig(null);
|
|
21817
|
+
setSortConfig(storageObject.sortConfig || null);
|
|
21807
21818
|
setItemsPerPageLocal(storageObject.itemsPerPage || 10);
|
|
21808
21819
|
}
|
|
21809
21820
|
setIsLocalStorageLoaded(true);
|
|
@@ -21915,7 +21926,13 @@ function DataTableServer({
|
|
|
21915
21926
|
setShowColFilters(!showColFilters);
|
|
21916
21927
|
};
|
|
21917
21928
|
useEffect(() => {
|
|
21918
|
-
|
|
21929
|
+
if (!hasMounted) {
|
|
21930
|
+
console.log("useEffect ran on mount");
|
|
21931
|
+
setHasMounted(true);
|
|
21932
|
+
} else {
|
|
21933
|
+
console.log("useEffect ran due to prop change");
|
|
21934
|
+
setCurrentPage(0);
|
|
21935
|
+
}
|
|
21919
21936
|
}, [filters]);
|
|
21920
21937
|
useEffect(() => {
|
|
21921
21938
|
if (id && isLocalStorageLoaded) {
|
|
@@ -21928,6 +21945,7 @@ function DataTableServer({
|
|
|
21928
21945
|
storageObject.columnFilters = columnFilters || {};
|
|
21929
21946
|
storageObject.showColFilters = showColFilters || false;
|
|
21930
21947
|
storageObject.currentPage = currentPage || 0;
|
|
21948
|
+
storageObject.sortConfig = sortConfig || null;
|
|
21931
21949
|
storageObject.itemsPerPage = itemsPerPageLocal || 10;
|
|
21932
21950
|
localStorage.setItem(storageKey, JSON.stringify(storageObject));
|
|
21933
21951
|
}
|
|
@@ -21937,7 +21955,8 @@ function DataTableServer({
|
|
|
21937
21955
|
currentPage,
|
|
21938
21956
|
id,
|
|
21939
21957
|
itemsPerPageLocal,
|
|
21940
|
-
isLocalStorageLoaded
|
|
21958
|
+
isLocalStorageLoaded,
|
|
21959
|
+
sortConfig
|
|
21941
21960
|
]);
|
|
21942
21961
|
const rerenderTable = () => {
|
|
21943
21962
|
setTableKey((previous) => previous + 1);
|
|
@@ -22268,7 +22287,7 @@ function DataTableServer({
|
|
|
22268
22287
|
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
22288
|
] }, tableKey) }),
|
|
22270
22289
|
/* @__PURE__ */ jsxs("div", { className: "w-full p-5 flex gap-5 justify-between", children: [
|
|
22271
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-5 ", children: [
|
|
22290
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-5 text-sm ", children: [
|
|
22272
22291
|
data && /* @__PURE__ */ jsxs(
|
|
22273
22292
|
Button,
|
|
22274
22293
|
{
|
|
@@ -22295,11 +22314,11 @@ function DataTableServer({
|
|
|
22295
22314
|
]
|
|
22296
22315
|
}
|
|
22297
22316
|
),
|
|
22298
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-end
|
|
22317
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-end text-gray-800", children: paginationDisplay })
|
|
22299
22318
|
] }),
|
|
22300
22319
|
" ",
|
|
22301
22320
|
/* @__PURE__ */ jsxs("div", { className: "content-center w-auto items-center justify-end flex-row gap-5 flex", children: [
|
|
22302
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
22321
|
+
/* @__PURE__ */ jsx("span", { className: " whitespace-nowrap flex-grow", children: "Počet řádků na stránku:" }),
|
|
22303
22322
|
/* @__PURE__ */ jsx(
|
|
22304
22323
|
SelectField,
|
|
22305
22324
|
{
|
|
@@ -22321,6 +22340,7 @@ function DataTableServer({
|
|
|
22321
22340
|
) });
|
|
22322
22341
|
}
|
|
22323
22342
|
export {
|
|
22324
|
-
DataTableServer as default
|
|
22343
|
+
DataTableServer as default,
|
|
22344
|
+
resetAllDataTablePaging
|
|
22325
22345
|
};
|
|
22326
22346
|
//# sourceMappingURL=DataTableServer.js.map
|