@addsign/moje-agenda-shared-lib 1.0.0 → 1.0.1

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.
@@ -861,6 +861,9 @@ video {
861
861
  .min-h-\[32px\] {
862
862
  min-height: 32px;
863
863
  }
864
+ .\!w-\[100px\] {
865
+ width: 100px !important;
866
+ }
864
867
  .w-0 {
865
868
  width: 0px;
866
869
  }
@@ -921,6 +924,9 @@ video {
921
924
  .w-\[calc\(100\%-40px\)\] {
922
925
  width: calc(100% - 40px);
923
926
  }
927
+ .w-auto {
928
+ width: auto;
929
+ }
924
930
  .w-fit {
925
931
  width: -moz-fit-content;
926
932
  width: fit-content;
@@ -928,8 +934,8 @@ video {
928
934
  .w-full {
929
935
  width: 100%;
930
936
  }
931
- .min-w-32 {
932
- min-width: 8rem;
937
+ .min-w-20 {
938
+ min-width: 5rem;
933
939
  }
934
940
  .min-w-\[100px\] {
935
941
  min-width: 100px;
@@ -977,7 +983,7 @@ video {
977
983
  }
978
984
  }
979
985
  .animate-spin {
980
- animation: spin 1s linear infinite;
986
+ animation: spin 2s linear infinite;
981
987
  }
982
988
  .cursor-col-resize {
983
989
  cursor: col-resize;
@@ -1011,6 +1017,9 @@ video {
1011
1017
  .grid-cols-7 {
1012
1018
  grid-template-columns: repeat(7, minmax(0, 1fr));
1013
1019
  }
1020
+ .flex-row {
1021
+ flex-direction: row;
1022
+ }
1014
1023
  .flex-col {
1015
1024
  flex-direction: column;
1016
1025
  }
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import React__default, { useState, useEffect, useCallback } from "react";
3
- import { a as FaChevronLeft, b as FaChevronRight } from "../index-DaPOQQEd.js";
3
+ import { a as FaChevronLeft, b as FaChevronRight } from "../index-DH-TC1O6.js";
4
4
  const Calendar = ({
5
5
  items,
6
6
  startingDate,
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useEffect } from "react";
3
- import { F as FaRegTrashAlt } from "../index-DaPOQQEd.js";
3
+ import { F as FaRegTrashAlt } from "../index-DH-TC1O6.js";
4
4
  import { G as GenIcon } from "../iconBase-B8_TsgYI.js";
5
5
  import Button from "./Button.js";
6
6
  function IoCloseOutline(props) {
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { F as FaRegTrashAlt } from "../index-DaPOQQEd.js";
2
+ import { F as FaRegTrashAlt } from "../index-DH-TC1O6.js";
3
3
  import Button from "./Button.js";
4
4
  function Modal({
5
5
  title,
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+
3
+ type SpinnerIconProps = {
4
+ icon: React.ReactNode;
5
+ };
6
+ declare const SpinnerIcon: React.FC<SpinnerIconProps>;
7
+ export default SpinnerIcon;
@@ -0,0 +1,9 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { c as FaSpinner } from "../index-DH-TC1O6.js";
3
+ const SpinnerIcon = ({ icon = /* @__PURE__ */ jsx(FaSpinner, {}) }) => {
4
+ return /* @__PURE__ */ jsx("div", { className: "animate-spin", children: icon });
5
+ };
6
+ export {
7
+ SpinnerIcon as default
8
+ };
9
+ //# sourceMappingURL=SpinnerIcon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpinnerIcon.js","sources":["../../lib/components/SpinnerIcon.tsx"],"sourcesContent":["import React from \"react\";\nimport { FaSpinner } from \"react-icons/fa\";\n\ntype SpinnerIconProps = {\n icon: React.ReactNode;\n};\n\nconst SpinnerIcon: React.FC<SpinnerIconProps> = ({ icon = <FaSpinner /> }) => {\n return <div className=\"animate-spin\">{icon}</div>;\n};\n\nexport default SpinnerIcon;\n"],"names":[],"mappings":";;AAOA,MAAM,cAA0C,CAAC,EAAE,OAAQ,oBAAA,WAAA,CAAU,CAAA,QAAS;AAC5E,SAAQ,oBAAA,OAAA,EAAI,WAAU,gBAAgB,UAAK,KAAA,CAAA;AAC7C;"}
@@ -9,7 +9,6 @@ interface DataTableServerProps<T> {
9
9
  id: string;
10
10
  url: string;
11
11
  columns: DataTableColumn<T | "actions">[];
12
- itemsPerPage?: number;
13
12
  title?: string;
14
13
  subtitle?: string;
15
14
  allowSearch?: boolean;
@@ -23,5 +22,5 @@ type DataTableInternalItems = {
23
22
  _isHighlighted?: boolean;
24
23
  id: string;
25
24
  };
26
- declare function DataTableServer<T extends DataTableInternalItems>({ id, url, columns, itemsPerPage, title, subtitle, allowSearch, showHeader, rowAction, bulkAction, filters, }: DataTableServerProps<T>): import("react/jsx-runtime").JSX.Element;
25
+ declare function DataTableServer<T extends DataTableInternalItems>({ id, url, columns, title, subtitle, allowSearch, showHeader, rowAction, bulkAction, filters, }: DataTableServerProps<T>): import("react/jsx-runtime").JSX.Element;
27
26
  export default DataTableServer;
@@ -21685,7 +21685,6 @@ function DataTableServer({
21685
21685
  id,
21686
21686
  url,
21687
21687
  columns,
21688
- itemsPerPage = 10,
21689
21688
  title,
21690
21689
  subtitle,
21691
21690
  allowSearch = false,
@@ -21695,6 +21694,7 @@ function DataTableServer({
21695
21694
  filters
21696
21695
  }) {
21697
21696
  var _a, _b;
21697
+ const [itemsPerPageLocal, setItemsPerPageLocal] = useState();
21698
21698
  const federationContext = useFederationContext();
21699
21699
  const [data, setData] = useState();
21700
21700
  const [isLoading, setIsLoading] = useState(false);
@@ -21706,7 +21706,7 @@ function DataTableServer({
21706
21706
  const [columnFilters, setColumnFilters] = useState();
21707
21707
  const [showColFilters, setShowColFilters] = useState();
21708
21708
  const [sortConfig, setSortConfig] = useState(null);
21709
- const createDataPageable = (response, itemsPerPage2) => {
21709
+ const createDataPageable = (response, itemsPerPage) => {
21710
21710
  var _a2, _b2, _c, _d, _e, _f, _g;
21711
21711
  return {
21712
21712
  content: response.data.content || response.data,
@@ -21715,7 +21715,7 @@ function DataTableServer({
21715
21715
  last: ((_c = response.data) == null ? void 0 : _c.content) ? response.data.last : true,
21716
21716
  number: ((_d = response.data) == null ? void 0 : _d.content) ? response.data.number : 0,
21717
21717
  numberOfElements: response.data.numberOfElements || response.data.length,
21718
- size: ((_e = response.data) == null ? void 0 : _e.size) || itemsPerPage2,
21718
+ size: ((_e = response.data) == null ? void 0 : _e.size) || itemsPerPage,
21719
21719
  totalElements: ((_f = response.data) == null ? void 0 : _f.totalElements) || response.data.length,
21720
21720
  totalPages: ((_g = response.data) == null ? void 0 : _g.totalPages) || 1
21721
21721
  };
@@ -21728,7 +21728,7 @@ function DataTableServer({
21728
21728
  showColFilters,
21729
21729
  // id,
21730
21730
  columnFilters,
21731
- itemsPerPage,
21731
+ itemsPerPageLocal,
21732
21732
  currentPage,
21733
21733
  sortConfig,
21734
21734
  federationContext.apiClient,
@@ -21745,7 +21745,7 @@ function DataTableServer({
21745
21745
  params: {
21746
21746
  ...filters,
21747
21747
  ...showColFilters ? columnFilters : {},
21748
- pageSize: itemsPerPage,
21748
+ pageSize: itemsPerPageLocal,
21749
21749
  page: currentPage,
21750
21750
  sortBy: sortConfig == null ? void 0 : sortConfig.sortParam,
21751
21751
  sortDirection: sortConfig == null ? void 0 : sortConfig.direction
@@ -21753,7 +21753,7 @@ function DataTableServer({
21753
21753
  }).then((response) => {
21754
21754
  const dataPageable = createDataPageable(
21755
21755
  response,
21756
- itemsPerPage
21756
+ itemsPerPageLocal || 10
21757
21757
  );
21758
21758
  setData(dataPageable);
21759
21759
  setIsLoading(false);
@@ -21767,7 +21767,7 @@ function DataTableServer({
21767
21767
  last: true,
21768
21768
  number: 0,
21769
21769
  numberOfElements: 0,
21770
- size: itemsPerPage,
21770
+ size: itemsPerPageLocal || 10,
21771
21771
  totalElements: 0,
21772
21772
  totalPages: 1
21773
21773
  });
@@ -21798,6 +21798,12 @@ function DataTableServer({
21798
21798
  setShowColFilters(storageObject.showColFilters);
21799
21799
  setCurrentPage(storageObject.currentPage || 0);
21800
21800
  setSortConfig(null);
21801
+ console.log(
21802
+ "%clibcomponentsdatatableDataTableServer.tsx:204 storageObject",
21803
+ "color: #007acc;",
21804
+ storageObject
21805
+ );
21806
+ setItemsPerPageLocal(storageObject.itemsPerPage || 10);
21801
21807
  }
21802
21808
  }
21803
21809
  }, [id]);
@@ -21895,7 +21901,7 @@ function DataTableServer({
21895
21901
  setFulltextSearch((_a2 = e.target) == null ? void 0 : _a2.value);
21896
21902
  setCurrentPage(0);
21897
21903
  };
21898
- const paginationDisplay = `Strana ${(currentPage || 0) + 1} z ${data == null ? void 0 : data.totalPages} (${itemsPerPage} řádků na stranu)`;
21904
+ const paginationDisplay = `Strana ${(currentPage || 0) + 1} z ${data == null ? void 0 : data.totalPages}`;
21899
21905
  const filterHandler = (filterParam, value) => {
21900
21906
  setColumnFilters((prev) => ({ ...prev, [filterParam]: value }));
21901
21907
  setCurrentPage(0);
@@ -21917,9 +21923,10 @@ function DataTableServer({
21917
21923
  storageObject.columnFilters = columnFilters || {};
21918
21924
  storageObject.showColFilters = showColFilters || false;
21919
21925
  storageObject.currentPage = currentPage !== void 0 ? currentPage : storageObject.currentPage || 0;
21926
+ storageObject.itemsPerPage = itemsPerPageLocal || storageObject.itemsPerPage;
21920
21927
  localStorage.setItem(storageKey, JSON.stringify(storageObject));
21921
21928
  }
21922
- }, [columnFilters, showColFilters, currentPage, id]);
21929
+ }, [columnFilters, showColFilters, currentPage, id, itemsPerPageLocal]);
21923
21930
  const rerenderTable = () => {
21924
21931
  setTableKey((previous) => previous + 1);
21925
21932
  };
@@ -21971,6 +21978,11 @@ function DataTableServer({
21971
21978
  handleErrors,
21972
21979
  columns
21973
21980
  ]);
21981
+ const handleItemsPerPageChange = (event) => {
21982
+ const selectedItemsPerPage = Number(event.target.value);
21983
+ setItemsPerPageLocal(selectedItemsPerPage);
21984
+ setCurrentPage(0);
21985
+ };
21974
21986
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
21975
21987
  "div",
21976
21988
  {
@@ -22213,35 +22225,55 @@ function DataTableServer({
22213
22225
  ] }),
22214
22226
  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, {}) }) }) }) })
22215
22227
  ] }, tableKey) }),
22216
- /* @__PURE__ */ jsx("div", { className: "w-full p-5 flex gap-5 justify-between", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-5", children: [
22217
- data && /* @__PURE__ */ jsxs(
22218
- Button,
22219
- {
22220
- variant: "secondary",
22221
- onClick: prevPage,
22222
- className: "flex items-center",
22223
- disabled: data.first || isLoading,
22224
- children: [
22225
- /* @__PURE__ */ jsx(MdArrowBack, { className: "mr-1.5" }),
22226
- " Předchozí"
22227
- ]
22228
- }
22229
- ),
22230
- data && /* @__PURE__ */ jsxs(
22231
- Button,
22232
- {
22233
- variant: "secondary",
22234
- onClick: nextPage,
22235
- className: "flex items-center",
22236
- disabled: data.last || isLoading,
22237
- children: [
22238
- "Následující ",
22239
- /* @__PURE__ */ jsx(MdArrowForward, { className: "ml-2", size: 20 })
22240
- ]
22241
- }
22242
- ),
22243
- /* @__PURE__ */ jsx("div", { className: "flex items-center justify-end text-xs text-gray-800", children: paginationDisplay })
22244
- ] }) })
22228
+ /* @__PURE__ */ jsxs("div", { className: "w-full p-5 flex gap-5 justify-between", children: [
22229
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-5 ", children: [
22230
+ data && /* @__PURE__ */ jsxs(
22231
+ Button,
22232
+ {
22233
+ variant: "secondary",
22234
+ onClick: prevPage,
22235
+ className: "flex items-center",
22236
+ disabled: data.first || isLoading,
22237
+ children: [
22238
+ /* @__PURE__ */ jsx(MdArrowBack, { className: "mr-1.5" }),
22239
+ " Předchozí"
22240
+ ]
22241
+ }
22242
+ ),
22243
+ data && /* @__PURE__ */ jsxs(
22244
+ Button,
22245
+ {
22246
+ variant: "secondary",
22247
+ onClick: nextPage,
22248
+ className: "flex items-center",
22249
+ disabled: data.last || isLoading,
22250
+ children: [
22251
+ "Následující ",
22252
+ /* @__PURE__ */ jsx(MdArrowForward, { className: "ml-2", size: 20 })
22253
+ ]
22254
+ }
22255
+ ),
22256
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-end text-sm text-gray-800", children: paginationDisplay })
22257
+ ] }),
22258
+ " ",
22259
+ /* @__PURE__ */ jsxs("div", { className: "content-center w-auto items-center justify-end flex-row gap-5 flex", children: [
22260
+ /* @__PURE__ */ jsx("span", { className: "text-sm whitespace-nowrap flex-grow", children: "Počet řádků na stránku:" }),
22261
+ /* @__PURE__ */ jsx(
22262
+ SelectField,
22263
+ {
22264
+ name: "itemsPerPage",
22265
+ onInputChange: handleItemsPerPageChange,
22266
+ className: "!w-[100px]",
22267
+ options: [
22268
+ { value: 10, label: "10" },
22269
+ { value: 50, label: "50" },
22270
+ { value: 100, label: "100" }
22271
+ ],
22272
+ value: itemsPerPageLocal
22273
+ }
22274
+ )
22275
+ ] })
22276
+ ] })
22245
22277
  ]
22246
22278
  }
22247
22279
  ) });