@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.
@@ -62,6 +62,7 @@ interface DataTableServerProps<T> {
62
62
  selectedItemKey?: string;
63
63
  itemsPerPageOptions?: IOptionItem[];
64
64
  setMinWidth?: boolean;
65
+ onDataLoaded?: (data: IPageable<T>) => void;
65
66
  }
66
67
  const defaultItemsPerPageOptions: IOptionItem[] = [
67
68
  { value: 10, label: "10" },
@@ -121,6 +122,7 @@ function DataTableServer<T extends DataTableInternalItems>({
121
122
  selectedItemKey = "id",
122
123
  itemsPerPageOptions = defaultItemsPerPageOptions,
123
124
  setMinWidth = false,
125
+ onDataLoaded,
124
126
  }: DataTableServerProps<T>) {
125
127
  const abortControllerRef = useRef<AbortController | null>(null);
126
128
  const topScrollbarRef = useRef<HTMLDivElement | null>(null);
@@ -275,6 +277,7 @@ function DataTableServer<T extends DataTableInternalItems>({
275
277
  setData(dataPageable);
276
278
  // setData(response.data);
277
279
  setIsLoading(false);
280
+ onDataLoaded?.(dataPageable);
278
281
  })
279
282
  .catch((error) => {
280
283
  if (error.code === "ERR_CANCELED") {
@@ -282,7 +285,7 @@ function DataTableServer<T extends DataTableInternalItems>({
282
285
  } else {
283
286
  console.error("Error fetching data:", error);
284
287
  handleErrors(error, federationContext.emitter);
285
- setData({
288
+ const emptyDataPageable: IPageable<T> = {
286
289
  content: [],
287
290
  empty: true,
288
291
  first: true,
@@ -292,8 +295,10 @@ function DataTableServer<T extends DataTableInternalItems>({
292
295
  size: itemsPerPageLocal || 10,
293
296
  totalElements: 0,
294
297
  totalPages: 1,
295
- });
298
+ };
299
+ setData(emptyDataPageable);
296
300
  setIsLoading(false);
301
+ onDataLoaded?.(emptyDataPageable);
297
302
  }
298
303
  });
299
304
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@addsign/moje-agenda-shared-lib",
3
3
  "private": false,
4
- "version": "2.0.70",
4
+ "version": "2.0.71",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "types": "dist/main.d.ts",