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

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
  }
@@ -1306,6 +1315,10 @@ video {
1306
1315
  .\!bg-danger {
1307
1316
  background-color: var(--color-danger) !important;
1308
1317
  }
1318
+ .\!bg-gray-100 {
1319
+ --tw-bg-opacity: 1 !important;
1320
+ background-color: rgb(243 244 246 / var(--tw-bg-opacity)) !important;
1321
+ }
1309
1322
  .\!bg-primary {
1310
1323
  background-color: var(--color-primary) !important;
1311
1324
  }
@@ -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;
@@ -1,5 +1,5 @@
1
1
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
- import { useState, useEffect, useCallback } from "react";
2
+ import { useState, useMemo, useEffect, useCallback } from "react";
3
3
  import '../../assets/tailwind.css';/* empty css */
4
4
  import Button from "../Button.js";
5
5
  import { e as MdOutlineFilterAlt, f as MdOutlineFilterAltOff, g as MdSearch, d as MdClose, h as MdArrowBack, i as MdArrowForward, j as MdArrowUpward, k as MdArrowDownward } from "../../index-BMFehNPK.js";
@@ -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);
@@ -21703,10 +21703,12 @@ function DataTableServer({
21703
21703
  const [selectedItems, setSelectedItems] = useState([]);
21704
21704
  const [fulltextSearch, setFulltextSearch] = useState("");
21705
21705
  const [filterOptions, setFilterOptions] = useState({});
21706
- const [columnFilters, setColumnFilters] = useState();
21706
+ const [columnFilters, setColumnFilters] = useState(
21707
+ {}
21708
+ );
21707
21709
  const [showColFilters, setShowColFilters] = useState();
21708
21710
  const [sortConfig, setSortConfig] = useState(null);
21709
- const createDataPageable = (response, itemsPerPage2) => {
21711
+ const createDataPageable = (response, itemsPerPage) => {
21710
21712
  var _a2, _b2, _c, _d, _e, _f, _g;
21711
21713
  return {
21712
21714
  content: response.data.content || response.data,
@@ -21715,12 +21717,15 @@ function DataTableServer({
21715
21717
  last: ((_c = response.data) == null ? void 0 : _c.content) ? response.data.last : true,
21716
21718
  number: ((_d = response.data) == null ? void 0 : _d.content) ? response.data.number : 0,
21717
21719
  numberOfElements: response.data.numberOfElements || response.data.length,
21718
- size: ((_e = response.data) == null ? void 0 : _e.size) || itemsPerPage2,
21720
+ size: ((_e = response.data) == null ? void 0 : _e.size) || itemsPerPage,
21719
21721
  totalElements: ((_f = response.data) == null ? void 0 : _f.totalElements) || response.data.length,
21720
21722
  totalPages: ((_g = response.data) == null ? void 0 : _g.totalPages) || 1
21721
21723
  };
21722
21724
  };
21723
21725
  const [reloadData, setReloadData] = useState(false);
21726
+ const mergedFilters = useMemo(() => {
21727
+ return { ...columnFilters, ...filters };
21728
+ }, [columnFilters, filters]);
21724
21729
  useEffect(() => {
21725
21730
  setReloadData(true);
21726
21731
  }, [
@@ -21728,7 +21733,7 @@ function DataTableServer({
21728
21733
  showColFilters,
21729
21734
  // id,
21730
21735
  columnFilters,
21731
- itemsPerPage,
21736
+ itemsPerPageLocal,
21732
21737
  currentPage,
21733
21738
  sortConfig,
21734
21739
  federationContext.apiClient,
@@ -21743,9 +21748,8 @@ function DataTableServer({
21743
21748
  setIsLoading(true);
21744
21749
  federationContext.apiClient.get(url, {
21745
21750
  params: {
21746
- ...filters,
21747
- ...showColFilters ? columnFilters : {},
21748
- pageSize: itemsPerPage,
21751
+ ...mergedFilters,
21752
+ pageSize: itemsPerPageLocal,
21749
21753
  page: currentPage,
21750
21754
  sortBy: sortConfig == null ? void 0 : sortConfig.sortParam,
21751
21755
  sortDirection: sortConfig == null ? void 0 : sortConfig.direction
@@ -21753,7 +21757,7 @@ function DataTableServer({
21753
21757
  }).then((response) => {
21754
21758
  const dataPageable = createDataPageable(
21755
21759
  response,
21756
- itemsPerPage
21760
+ itemsPerPageLocal || 10
21757
21761
  );
21758
21762
  setData(dataPageable);
21759
21763
  setIsLoading(false);
@@ -21767,7 +21771,7 @@ function DataTableServer({
21767
21771
  last: true,
21768
21772
  number: 0,
21769
21773
  numberOfElements: 0,
21770
- size: itemsPerPage,
21774
+ size: itemsPerPageLocal || 10,
21771
21775
  totalElements: 0,
21772
21776
  totalPages: 1
21773
21777
  });
@@ -21798,6 +21802,7 @@ function DataTableServer({
21798
21802
  setShowColFilters(storageObject.showColFilters);
21799
21803
  setCurrentPage(storageObject.currentPage || 0);
21800
21804
  setSortConfig(null);
21805
+ setItemsPerPageLocal(storageObject.itemsPerPage || 10);
21801
21806
  }
21802
21807
  }
21803
21808
  }, [id]);
@@ -21895,7 +21900,7 @@ function DataTableServer({
21895
21900
  setFulltextSearch((_a2 = e.target) == null ? void 0 : _a2.value);
21896
21901
  setCurrentPage(0);
21897
21902
  };
21898
- const paginationDisplay = `Strana ${(currentPage || 0) + 1} z ${data == null ? void 0 : data.totalPages} (${itemsPerPage} řádků na stranu)`;
21903
+ const paginationDisplay = `Strana ${(currentPage || 0) + 1} z ${data == null ? void 0 : data.totalPages}`;
21899
21904
  const filterHandler = (filterParam, value) => {
21900
21905
  setColumnFilters((prev) => ({ ...prev, [filterParam]: value }));
21901
21906
  setCurrentPage(0);
@@ -21917,9 +21922,10 @@ function DataTableServer({
21917
21922
  storageObject.columnFilters = columnFilters || {};
21918
21923
  storageObject.showColFilters = showColFilters || false;
21919
21924
  storageObject.currentPage = currentPage !== void 0 ? currentPage : storageObject.currentPage || 0;
21925
+ storageObject.itemsPerPage = itemsPerPageLocal || storageObject.itemsPerPage;
21920
21926
  localStorage.setItem(storageKey, JSON.stringify(storageObject));
21921
21927
  }
21922
- }, [columnFilters, showColFilters, currentPage, id]);
21928
+ }, [columnFilters, showColFilters, currentPage, id, itemsPerPageLocal]);
21923
21929
  const rerenderTable = () => {
21924
21930
  setTableKey((previous) => previous + 1);
21925
21931
  };
@@ -21971,6 +21977,11 @@ function DataTableServer({
21971
21977
  handleErrors,
21972
21978
  columns
21973
21979
  ]);
21980
+ const handleItemsPerPageChange = (event) => {
21981
+ const selectedItemsPerPage = Number(event.target.value);
21982
+ setItemsPerPageLocal(selectedItemsPerPage);
21983
+ setCurrentPage(0);
21984
+ };
21974
21985
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
21975
21986
  "div",
21976
21987
  {
@@ -22082,12 +22093,13 @@ function DataTableServer({
22082
22093
  ),
22083
22094
  type: filterType,
22084
22095
  options: filterOptions[String(filterParam)] || [],
22085
- value: (columnFilters == null ? void 0 : columnFilters[String(filterParam)]) || "",
22096
+ value: (mergedFilters == null ? void 0 : mergedFilters[String(filterParam)]) || "",
22086
22097
  clearable: true,
22087
22098
  className: " px-0",
22088
22099
  placeholder: "Filtr",
22089
22100
  rounded: true
22090
- }
22101
+ },
22102
+ JSON.stringify(mergedFilters)
22091
22103
  ) : filterType === "dateRange" ? /* @__PURE__ */ jsx(
22092
22104
  DateRangeField,
22093
22105
  {
@@ -22100,14 +22112,15 @@ function DataTableServer({
22100
22112
  type: filterType,
22101
22113
  options: filterOptions[String(filterParam)] || [],
22102
22114
  value: {
22103
- startDate: (columnFilters == null ? void 0 : columnFilters[String(filterParam)]) || "",
22104
- endDate: (columnFilters == null ? void 0 : columnFilters[String(filterParam2)]) || ""
22115
+ startDate: (mergedFilters == null ? void 0 : mergedFilters[String(filterParam)]) || "",
22116
+ endDate: (mergedFilters == null ? void 0 : mergedFilters[String(filterParam2)]) || ""
22105
22117
  },
22106
22118
  clearable: true,
22107
22119
  className: " px-0 py-0 ",
22108
22120
  placeholder: "Filtr",
22109
22121
  rounded: true
22110
- }
22122
+ },
22123
+ JSON.stringify(mergedFilters)
22111
22124
  ) : /* @__PURE__ */ jsx(
22112
22125
  InputField,
22113
22126
  {
@@ -22117,13 +22130,15 @@ function DataTableServer({
22117
22130
  e.target.value
22118
22131
  ),
22119
22132
  type: filterType,
22120
- value: (columnFilters == null ? void 0 : columnFilters[String(filterParam)]) || "",
22133
+ value: (mergedFilters == null ? void 0 : mergedFilters[String(filterParam)]) || "",
22134
+ disabled: !!(filters == null ? void 0 : filters[String(filterParam)]),
22121
22135
  clearable: true,
22122
22136
  className: " min-w-[100px] px-0 ",
22123
22137
  rounded: true,
22124
22138
  placeholder: "Filtr",
22125
22139
  debounceTimeout: 1e3
22126
- }
22140
+ },
22141
+ JSON.stringify(mergedFilters)
22127
22142
  )
22128
22143
  }
22129
22144
  )
@@ -22213,35 +22228,55 @@ function DataTableServer({
22213
22228
  ] }),
22214
22229
  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
22230
  ] }, 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
- ] }) })
22231
+ /* @__PURE__ */ jsxs("div", { className: "w-full p-5 flex gap-5 justify-between", children: [
22232
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-5 ", children: [
22233
+ data && /* @__PURE__ */ jsxs(
22234
+ Button,
22235
+ {
22236
+ variant: "secondary",
22237
+ onClick: prevPage,
22238
+ className: "flex items-center",
22239
+ disabled: data.first || isLoading,
22240
+ children: [
22241
+ /* @__PURE__ */ jsx(MdArrowBack, { className: "mr-1.5" }),
22242
+ " Předchozí"
22243
+ ]
22244
+ }
22245
+ ),
22246
+ data && /* @__PURE__ */ jsxs(
22247
+ Button,
22248
+ {
22249
+ variant: "secondary",
22250
+ onClick: nextPage,
22251
+ className: "flex items-center",
22252
+ disabled: data.last || isLoading,
22253
+ children: [
22254
+ "Následující ",
22255
+ /* @__PURE__ */ jsx(MdArrowForward, { className: "ml-2", size: 20 })
22256
+ ]
22257
+ }
22258
+ ),
22259
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-end text-sm text-gray-800", children: paginationDisplay })
22260
+ ] }),
22261
+ " ",
22262
+ /* @__PURE__ */ jsxs("div", { className: "content-center w-auto items-center justify-end flex-row gap-5 flex", children: [
22263
+ /* @__PURE__ */ jsx("span", { className: "text-sm whitespace-nowrap flex-grow", children: "Počet řádků na stránku:" }),
22264
+ /* @__PURE__ */ jsx(
22265
+ SelectField,
22266
+ {
22267
+ name: "itemsPerPage",
22268
+ onInputChange: handleItemsPerPageChange,
22269
+ className: "!w-[100px]",
22270
+ options: [
22271
+ { value: 10, label: "10" },
22272
+ { value: 50, label: "50" },
22273
+ { value: 100, label: "100" }
22274
+ ],
22275
+ value: itemsPerPageLocal
22276
+ }
22277
+ )
22278
+ ] })
22279
+ ] })
22245
22280
  ]
22246
22281
  }
22247
22282
  ) });