@pagamio/frontend-commons-lib 0.8.329 → 0.8.331
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.
|
@@ -238,6 +238,9 @@ const PagamioTable = ({ columns, data, isLoading = false, isFetching = false, ro
|
|
|
238
238
|
// visible underneath so the table doesn't blank, but the overlay makes
|
|
239
239
|
// the loading state unambiguous on slower connections.
|
|
240
240
|
showLoadingOverlay: isFetching,
|
|
241
|
+
// MRT defaults showProgressBars based on its own fetch heuristics — turn
|
|
242
|
+
// it off explicitly so only the overlay above renders during refetch.
|
|
243
|
+
showProgressBars: false,
|
|
241
244
|
pagination: paginationState,
|
|
242
245
|
sorting: sortingState,
|
|
243
246
|
expanded,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mirror a row's primary-key field into a top-level `id` so the row
|
|
3
|
+
* satisfies `BaseEntity` (and MRT's row keying) when the underlying entity
|
|
4
|
+
* has a composite PK or a non-`id`-named PK (e.g. `customerId`, `orderId`).
|
|
5
|
+
*
|
|
6
|
+
* Usage in a usePagamioTable queryFn:
|
|
7
|
+
*
|
|
8
|
+
* queryFn: async (params) => {
|
|
9
|
+
* const res = await getThings(params);
|
|
10
|
+
* return { ...res, data: withSyntheticId(res.data, 'customerId') };
|
|
11
|
+
* }
|
|
12
|
+
*
|
|
13
|
+
* The synthesized `id` is purely for the table layer — it never goes back
|
|
14
|
+
* to the server.
|
|
15
|
+
*/
|
|
16
|
+
export declare const withSyntheticId: <T extends Record<string, unknown>, K extends keyof T>(rows: T[], key: K) => Array<T & {
|
|
17
|
+
id: T[K];
|
|
18
|
+
}>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mirror a row's primary-key field into a top-level `id` so the row
|
|
3
|
+
* satisfies `BaseEntity` (and MRT's row keying) when the underlying entity
|
|
4
|
+
* has a composite PK or a non-`id`-named PK (e.g. `customerId`, `orderId`).
|
|
5
|
+
*
|
|
6
|
+
* Usage in a usePagamioTable queryFn:
|
|
7
|
+
*
|
|
8
|
+
* queryFn: async (params) => {
|
|
9
|
+
* const res = await getThings(params);
|
|
10
|
+
* return { ...res, data: withSyntheticId(res.data, 'customerId') };
|
|
11
|
+
* }
|
|
12
|
+
*
|
|
13
|
+
* The synthesized `id` is purely for the table layer — it never goes back
|
|
14
|
+
* to the server.
|
|
15
|
+
*/
|
|
16
|
+
export const withSyntheticId = (rows, key) => rows.map((row) => ({ ...row, id: row[key] }));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pagamio/frontend-commons-lib",
|
|
3
3
|
"description": "Pagamio library for Frontend reusable components like the form engine and table container",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.331",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"provenance": false
|