@pagamio/frontend-commons-lib 0.8.326 → 0.8.327

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.
@@ -1,5 +1,20 @@
1
- import type { ResponseMapping } from '../../api';
1
+ import type { QueryParamConfig, ResponseMapping } from '../../api';
2
2
  import type { BaseEntity, UsePagamioTableConfig, UsePagamioTableReturn } from '../../pagamio-table/data-table/types';
3
3
  export declare const springBootMapping: ResponseMapping;
4
4
  export declare const arrayResponseMapping: ResponseMapping;
5
+ /**
6
+ * Response mapping for Pagamio NestJS backends (commerce-os-core,
7
+ * nestjs-api-commons). Matches `PaginatedResponseDto<T>`:
8
+ * { data: T[], meta: { page, limit, total, totalPages, hasNextPage, hasPreviousPage } }
9
+ *
10
+ * Pair with `pagamioQueryConfig` so request params line up too.
11
+ */
12
+ export declare const pagamioMapping: ResponseMapping;
13
+ /**
14
+ * Query-param config for Pagamio NestJS backends. Matches `PaginationDto`:
15
+ * page (1-based), limit, search, sortBy, sortOrder ('asc'|'desc')
16
+ *
17
+ * The hook tracks `page` zero-indexed internally; we bump on the way out.
18
+ */
19
+ export declare const pagamioQueryConfig: QueryParamConfig;
5
20
  export declare const usePagamioTable: <T extends BaseEntity>({ queryKey, queryFn, enabled: queryEnabled, staleTime, gcTime, data: clientData, columns, defaultFilters, responseMapping, queryParamConfig, pagination: paginationConfig, filtering: filteringConfig, sorting: sortingConfig, toolbar, searchPlaceholder, onRowClick, rowClassName, expandable, renderDetailPanel, }: UsePagamioTableConfig<T>) => UsePagamioTableReturn<T>;
@@ -30,6 +30,37 @@ export const arrayResponseMapping = {
30
30
  pageSize: '',
31
31
  defaultValues: { data: [], total: 0, page: 0, pageSize: 10 },
32
32
  };
33
+ /**
34
+ * Response mapping for Pagamio NestJS backends (commerce-os-core,
35
+ * nestjs-api-commons). Matches `PaginatedResponseDto<T>`:
36
+ * { data: T[], meta: { page, limit, total, totalPages, hasNextPage, hasPreviousPage } }
37
+ *
38
+ * Pair with `pagamioQueryConfig` so request params line up too.
39
+ */
40
+ export const pagamioMapping = {
41
+ responseType: 'default',
42
+ data: 'data',
43
+ total: 'meta.total',
44
+ page: 'meta.page',
45
+ pageSize: 'meta.limit',
46
+ defaultValues: { data: [], total: 0, page: 1, pageSize: 10 },
47
+ };
48
+ /**
49
+ * Query-param config for Pagamio NestJS backends. Matches `PaginationDto`:
50
+ * page (1-based), limit, search, sortBy, sortOrder ('asc'|'desc')
51
+ *
52
+ * The hook tracks `page` zero-indexed internally; we bump on the way out.
53
+ */
54
+ export const pagamioQueryConfig = {
55
+ pagination: {
56
+ transform: (page, size) => ({
57
+ page: (page + 1).toString(),
58
+ limit: size.toString(),
59
+ }),
60
+ },
61
+ sorting: { sortByParam: 'sortBy', sortDirParam: 'sortOrder' },
62
+ filtering: { searchParam: 'search', filterFormat: 'flat' },
63
+ };
33
64
  const defaultQueryConfig = {
34
65
  pagination: {
35
66
  transform: (page, size) => ({ page: page.toString(), size: size.toString() }),
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.326",
4
+ "version": "0.8.327",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "provenance": false