@addsign/moje-agenda-shared-lib 2.0.70 → 2.0.71

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.
@@ -14,11 +14,24 @@ interface DataTableServerProps<T> {
14
14
  selectedItemKey?: string;
15
15
  itemsPerPageOptions?: IOptionItem[];
16
16
  setMinWidth?: boolean;
17
+ onDataLoaded?: (data: IPageable<T>) => void;
17
18
  }
18
19
  type DataTableInternalItems = {
19
20
  _isHighlighted?: boolean;
20
21
  id: string;
21
22
  };
22
23
  export declare const resetAllDataTablePaging: () => void;
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;
24
+ interface IPageable<T> {
25
+ content: T[];
26
+ empty: boolean;
27
+ first: boolean;
28
+ last: boolean;
29
+ number: number;
30
+ numberOfElements: number;
31
+ size: number;
32
+ totalElements: number;
33
+ totalPages: number;
34
+ isPageable?: boolean;
35
+ }
36
+ declare function DataTableServer<T extends DataTableInternalItems>({ id, url, columns, title, subtitle, allowSearch, showHeader, rowAction, bulkAction, filters, selectedItemKey, itemsPerPageOptions, setMinWidth, onDataLoaded, }: DataTableServerProps<T>): import("react/jsx-runtime").JSX.Element;
24
37
  export default DataTableServer;
@@ -21725,7 +21725,8 @@ function DataTableServer({
21725
21725
  filters,
21726
21726
  selectedItemKey = "id",
21727
21727
  itemsPerPageOptions = defaultItemsPerPageOptions,
21728
- setMinWidth = false
21728
+ setMinWidth = false,
21729
+ onDataLoaded
21729
21730
  }) {
21730
21731
  var _a, _b;
21731
21732
  const abortControllerRef = useRef(null);
@@ -21854,13 +21855,14 @@ function DataTableServer({
21854
21855
  );
21855
21856
  setData(dataPageable);
21856
21857
  setIsLoading(false);
21858
+ onDataLoaded == null ? void 0 : onDataLoaded(dataPageable);
21857
21859
  }).catch((error) => {
21858
21860
  if (error.code === "ERR_CANCELED") {
21859
21861
  console.log("Request was aborted");
21860
21862
  } else {
21861
21863
  console.error("Error fetching data:", error);
21862
21864
  handleErrors(error, federationContext.emitter);
21863
- setData({
21865
+ const emptyDataPageable = {
21864
21866
  content: [],
21865
21867
  empty: true,
21866
21868
  first: true,
@@ -21870,8 +21872,10 @@ function DataTableServer({
21870
21872
  size: itemsPerPageLocal || 10,
21871
21873
  totalElements: 0,
21872
21874
  totalPages: 1
21873
- });
21875
+ };
21876
+ setData(emptyDataPageable);
21874
21877
  setIsLoading(false);
21878
+ onDataLoaded == null ? void 0 : onDataLoaded(emptyDataPageable);
21875
21879
  }
21876
21880
  });
21877
21881
  setReloadData(false);