@addsign/moje-agenda-shared-lib 2.0.49 → 2.0.51

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.
Files changed (33) hide show
  1. package/dist/assets/style.css +3 -0
  2. package/dist/components/datatable/DataTable.js +1 -1
  3. package/dist/components/datatable/DataTableServer.d.ts +2 -1
  4. package/dist/components/datatable/DataTableServer.js +48 -17
  5. package/dist/components/datatable/DataTableServer.js.map +1 -1
  6. package/dist/components/datatable/DatatableSettings.js +1 -1
  7. package/dist/components/datatable/Resizable.d.ts +2 -1
  8. package/dist/components/datatable/Resizable.js +11 -4
  9. package/dist/components/datatable/Resizable.js.map +1 -1
  10. package/dist/components/form/AutocompleteSearchBar.js +1 -1
  11. package/dist/components/form/AutocompleteSearchBarServer.js +1 -1
  12. package/dist/components/form/FileInput.js +1 -1
  13. package/dist/components/form/FileInputMultiple.js +1 -1
  14. package/dist/components/form/FormField.js +1 -1
  15. package/dist/components/form/InputField.js +1 -1
  16. package/dist/components/form/PositionsSelectorSingle.js +1 -1
  17. package/dist/components/form/SelectField.js +1 -1
  18. package/dist/components/layout/CollapsibleSection.js +1 -1
  19. package/dist/components/layout/IconInCircle.js +1 -1
  20. package/dist/components/layout/PageTitle.js +1 -1
  21. package/dist/components/layout/PageTitle.js.map +1 -1
  22. package/dist/components/layout/SectionTitle.js +1 -1
  23. package/dist/components/layout/SectionTitle.js.map +1 -1
  24. package/dist/components/ui/multi-select.js +2 -2
  25. package/dist/components/ui/multi-select.js.map +1 -1
  26. package/dist/index-CrfjcbOs.js +68 -0
  27. package/dist/index-CrfjcbOs.js.map +1 -0
  28. package/lib/components/datatable/DataTableServer.tsx +68 -11
  29. package/lib/components/datatable/Resizable.tsx +11 -3
  30. package/lib/components/layout/PageTitle.tsx +1 -1
  31. package/lib/components/layout/SectionTitle.tsx +1 -1
  32. package/lib/components/ui/multi-select.tsx +3 -2
  33. package/package.json +1 -1
@@ -738,6 +738,9 @@ video {
738
738
  margin-top: 1rem;
739
739
  margin-bottom: 1rem;
740
740
  }
741
+ .mb-1 {
742
+ margin-bottom: 0.25rem;
743
+ }
741
744
  .mb-2 {
742
745
  margin-bottom: 0.5rem;
743
746
  }
@@ -2,7 +2,7 @@ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
2
  import { useState, useEffect } from "react";
3
3
  import "../../tailwind-l0sNRNKZ.js";
4
4
  import Button from "../Button.js";
5
- import { f as MdOutlineFilterAlt, g as MdOutlineFilterAltOff, h as MdSearch, b as MdClose, i as MdArrowBack, j as MdArrowForward, k as MdArrowUpward, l as MdArrowDownward } from "../../index-DVD0PiGU.js";
5
+ import { f as MdOutlineFilterAlt, g as MdOutlineFilterAltOff, h as MdSearch, b as MdClose, i as MdArrowBack, j as MdArrowForward, k as MdArrowUpward, l as MdArrowDownward } from "../../index-CrfjcbOs.js";
6
6
  import FormField from "../form/FormField.js";
7
7
  import Spinner from "../Spinner.js";
8
8
  import "../ui/multi-select.js";
@@ -13,11 +13,12 @@ interface DataTableServerProps<T> {
13
13
  filters?: object;
14
14
  selectedItemKey?: string;
15
15
  itemsPerPageOptions?: IOptionItem[];
16
+ setMinWidth?: boolean;
16
17
  }
17
18
  type DataTableInternalItems = {
18
19
  _isHighlighted?: boolean;
19
20
  id: string;
20
21
  };
21
22
  export declare const resetAllDataTablePaging: () => void;
22
- declare function DataTableServer<T extends DataTableInternalItems>({ id, url, columns, title, subtitle, allowSearch, showHeader, rowAction, bulkAction, filters, selectedItemKey, itemsPerPageOptions, }: DataTableServerProps<T>): import("react/jsx-runtime").JSX.Element;
23
+ declare function DataTableServer<T extends DataTableInternalItems>({ id, url, columns, title, subtitle, allowSearch, showHeader, rowAction, bulkAction, filters, selectedItemKey, itemsPerPageOptions, setMinWidth, }: DataTableServerProps<T>): import("react/jsx-runtime").JSX.Element;
23
24
  export default DataTableServer;
@@ -2,7 +2,7 @@ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
2
  import { useRef, useState, useMemo, useEffect, useCallback } from "react";
3
3
  import "../../tailwind-l0sNRNKZ.js";
4
4
  import Button from "../Button.js";
5
- import { f as MdOutlineFilterAlt, g as MdOutlineFilterAltOff, h as MdSearch, b as MdClose, i as MdArrowBack, j as MdArrowForward, k as MdArrowUpward, l as MdArrowDownward } from "../../index-DVD0PiGU.js";
5
+ import { f as MdOutlineFilterAlt, g as MdOutlineFilterAltOff, h as MdSearch, b as MdClose, i as MdArrowBack, j as MdArrowForward, k as MdArrowUpward, l as MdArrowDownward, n as MdOutlineUnfoldMore } from "../../index-CrfjcbOs.js";
6
6
  import FormField from "../form/FormField.js";
7
7
  import InputField from "../form/InputField.js";
8
8
  import SelectField from "../form/SelectField.js";
@@ -21726,10 +21726,15 @@ function DataTableServer({
21726
21726
  bulkAction,
21727
21727
  filters,
21728
21728
  selectedItemKey = "id",
21729
- itemsPerPageOptions = defaultItemsPerPageOptions
21729
+ itemsPerPageOptions = defaultItemsPerPageOptions,
21730
+ setMinWidth = false
21730
21731
  }) {
21731
21732
  var _a, _b;
21732
21733
  const abortControllerRef = useRef(null);
21734
+ const topScrollbarRef = useRef(null);
21735
+ const bottomScrollbarRef = useRef(null);
21736
+ const tableRef = useRef(null);
21737
+ const syncWidthRef = useRef(null);
21733
21738
  const [itemsPerPageLocal, setItemsPerPageLocal] = useState();
21734
21739
  const federationContext = useFederationContext();
21735
21740
  const [data, setData] = useState();
@@ -21931,21 +21936,9 @@ function DataTableServer({
21931
21936
  };
21932
21937
  const getSortIcon = (sortParam) => {
21933
21938
  if ((sortConfig == null ? void 0 : sortConfig.sortParam) === sortParam) {
21934
- return sortConfig.direction === "asc" ? /* @__PURE__ */ jsx(MdArrowUpward, { fontSize: "small" }) : sortConfig.direction === "desc" ? /* @__PURE__ */ jsx(MdArrowDownward, { fontSize: "small" }) : /* @__PURE__ */ jsx(
21935
- MdArrowUpward,
21936
- {
21937
- fontSize: "small",
21938
- className: "text-gray-300 invisible group-hover:visible "
21939
- }
21940
- );
21939
+ return sortConfig.direction === "asc" ? /* @__PURE__ */ jsx(MdArrowUpward, { fontSize: "small" }) : sortConfig.direction === "desc" ? /* @__PURE__ */ jsx(MdArrowDownward, { fontSize: "small" }) : /* @__PURE__ */ jsx(MdOutlineUnfoldMore, { fontSize: "small", className: " " });
21941
21940
  }
21942
- return /* @__PURE__ */ jsx(
21943
- MdArrowUpward,
21944
- {
21945
- fontSize: "small",
21946
- className: "text-gray-300 invisible group-hover:visible "
21947
- }
21948
- );
21941
+ return /* @__PURE__ */ jsx(MdOutlineUnfoldMore, { fontSize: "small", className: " " });
21949
21942
  };
21950
21943
  const handleSelectItem = (item) => {
21951
21944
  setSelectedItems((prevSelectedItems) => {
@@ -22130,6 +22123,41 @@ function DataTableServer({
22130
22123
  handleErrors,
22131
22124
  columns
22132
22125
  ]);
22126
+ const updateSyncWidth = useCallback(() => {
22127
+ if (tableRef.current && syncWidthRef.current && setMinWidth) {
22128
+ syncWidthRef.current.style.width = tableRef.current.scrollWidth + "px";
22129
+ }
22130
+ }, [setMinWidth]);
22131
+ useEffect(() => {
22132
+ if (!setMinWidth)
22133
+ return;
22134
+ const topScrollbar = topScrollbarRef.current;
22135
+ const bottomScrollbar = bottomScrollbarRef.current;
22136
+ if (!topScrollbar || !bottomScrollbar)
22137
+ return;
22138
+ const handleTopScroll = () => {
22139
+ bottomScrollbar.scrollLeft = topScrollbar.scrollLeft;
22140
+ };
22141
+ const handleBottomScroll = () => {
22142
+ topScrollbar.scrollLeft = bottomScrollbar.scrollLeft;
22143
+ };
22144
+ topScrollbar.addEventListener("scroll", handleTopScroll);
22145
+ bottomScrollbar.addEventListener("scroll", handleBottomScroll);
22146
+ return () => {
22147
+ topScrollbar.removeEventListener("scroll", handleTopScroll);
22148
+ bottomScrollbar.removeEventListener("scroll", handleBottomScroll);
22149
+ };
22150
+ }, [setMinWidth]);
22151
+ useEffect(() => {
22152
+ if (!tableRef.current)
22153
+ return;
22154
+ const resizeObserver = new ResizeObserver(updateSyncWidth);
22155
+ resizeObserver.observe(tableRef.current);
22156
+ updateSyncWidth();
22157
+ return () => {
22158
+ resizeObserver.disconnect();
22159
+ };
22160
+ }, [updateSyncWidth, data, isLoading]);
22133
22161
  const handleItemsPerPageChange = (event) => {
22134
22162
  const selectedItemsPerPage = Number(event.target.value);
22135
22163
  setItemsPerPageLocal(selectedItemsPerPage);
@@ -22185,9 +22213,11 @@ function DataTableServer({
22185
22213
  }
22186
22214
  ) })
22187
22215
  ] }),
22188
- /* @__PURE__ */ jsx("div", { className: "overflow-auto min-h-[500px]", children: /* @__PURE__ */ jsxs(
22216
+ setMinWidth && /* @__PURE__ */ jsx("div", { ref: topScrollbarRef, className: "overflow-x-auto h-4 mb-1 mmmmm", children: /* @__PURE__ */ jsx("div", { ref: syncWidthRef, className: "h-full" }) }),
22217
+ /* @__PURE__ */ jsx("div", { ref: bottomScrollbarRef, className: "overflow-auto min-h-[500px]", children: /* @__PURE__ */ jsxs(
22189
22218
  "table",
22190
22219
  {
22220
+ ref: tableRef,
22191
22221
  className: "w-full leading-normal",
22192
22222
  "data-cy": "datatable-table-" + id,
22193
22223
  children: [
@@ -22218,6 +22248,7 @@ function DataTableServer({
22218
22248
  tableId: id,
22219
22249
  colKey: String(key),
22220
22250
  defaultWidth: width || "auto",
22251
+ setMinWidth,
22221
22252
  children: ({ ref }) => /* @__PURE__ */ jsxs(
22222
22253
  "th",
22223
22254
  {