@omnitend/dashboard-for-laravel 0.33.0 → 0.33.1

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,8 +1,8 @@
1
1
  {
2
- "generated": "2026-07-20T13:20:24.769Z",
2
+ "generated": "2026-07-20T14:11:55.309Z",
3
3
  "package": {
4
4
  "name": "@omnitend/dashboard-for-laravel",
5
- "version": "0.33.0"
5
+ "version": "0.33.1"
6
6
  },
7
7
  "components": {
8
8
  "base": [
@@ -2807,6 +2807,12 @@
2807
2807
  "required": false,
2808
2808
  "description": "API endpoint URL for auto-provider mode (alternative to provider function)"
2809
2809
  },
2810
+ {
2811
+ "name": "apiAdapter",
2812
+ "type": "DXTableApiAdapter",
2813
+ "required": false,
2814
+ "description": "Adapts the built-in provider's request params / response body to a\n backend convention that differs from dfl's (see DXTableApiAdapter)."
2815
+ },
2810
2816
  {
2811
2817
  "name": "fields",
2812
2818
  "type": "Array",
@@ -1,7 +1,7 @@
1
1
  # Documentation Map
2
2
 
3
3
  > Auto-generated hierarchical overview of all documentation
4
- > Last updated: 2026-07-20T13:20:24.828Z
4
+ > Last updated: 2026-07-20T14:11:55.365Z
5
5
 
6
6
  This file provides a complete map of all available documentation for AI agents and developers.
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnitend/dashboard-for-laravel",
3
- "version": "0.33.0",
3
+ "version": "0.33.1",
4
4
  "description": "Vue 3 dashboard components for Laravel with Bootstrap Vue Next",
5
5
  "type": "module",
6
6
  "main": "./dist/dashboard-for-laravel.umd.cjs",
@@ -284,6 +284,23 @@ export interface FilterOption {
284
284
  text: string;
285
285
  }
286
286
 
287
+ /**
288
+ * Adapts the built-in `apiUrl` provider's request/response to a backend whose
289
+ * convention differs from dfl's (spatie query-builder params, an envelope
290
+ * without the `{data, pagination}` shape). The sanctioned replacement for the
291
+ * axios-interceptor bridges #132 removed the route for: `request` maps the
292
+ * outgoing params (its return is what goes on the wire); `response` maps the
293
+ * body back, receiving the ORIGINAL dfl-shape params (`page`, `perPage`, …)
294
+ * so it can synthesize paginator metadata a foreign envelope lacks.
295
+ */
296
+ export interface DXTableApiAdapter {
297
+ request?: (params: Record<string, any>) => Record<string, any>;
298
+ response?: (
299
+ body: any,
300
+ context: { params: Record<string, any> },
301
+ ) => { data: any[]; pagination?: PaginationData; filterValues?: Record<string, string[]> };
302
+ }
303
+
287
304
  export interface TableField {
288
305
  key: string;
289
306
  label?: string;
@@ -414,6 +431,10 @@ export interface Props<TItem = any> {
414
431
  /** API endpoint URL for auto-provider mode (alternative to provider function) */
415
432
  apiUrl?: string;
416
433
 
434
+ /** Adapts the built-in provider's request params / response body to a
435
+ * backend convention that differs from dfl's (see DXTableApiAdapter). */
436
+ apiAdapter?: DXTableApiAdapter;
437
+
417
438
  /** Table field definitions */
418
439
  fields: TableField[];
419
440
 
@@ -1419,19 +1440,41 @@ const internalProvider: BTableProvider<T> = async (context: Readonly<BTableProvi
1419
1440
  params.filterValues = fieldsNeedingFilterValues.value;
1420
1441
  }
1421
1442
 
1422
- const response = await api.get<any>(props.apiUrl, params);
1443
+ // Adapt the outgoing params to the backend's convention (e.g. spatie
1444
+ // query-builder's `sort=-name` / `filter[key]`). This is the sanctioned
1445
+ // replacement for the axios request interceptors #132 removed the route
1446
+ // for — the adapter's return IS the wire params.
1447
+ const wireParams = props.apiAdapter?.request
1448
+ ? props.apiAdapter.request(params)
1449
+ : params;
1450
+
1451
+ const response = await api.get<any>(props.apiUrl, wireParams);
1452
+
1453
+ // Adapt a foreign response envelope back into the dfl shape. Gets the
1454
+ // ORIGINAL dfl-shape params (page/perPage/…) for context, since a foreign
1455
+ // envelope often lacks paginator metadata the adapter must synthesize.
1456
+ let body = props.apiAdapter?.response
1457
+ ? props.apiAdapter.response(response.data, { params })
1458
+ : response.data;
1459
+
1460
+ // A backend that ignores the pagination convention and returns a bare
1461
+ // array of rows used to render as a SILENTLY EMPTY table (data present,
1462
+ // nothing shown). Degrade to visible rows with no pager metadata instead.
1463
+ if (Array.isArray(body)) {
1464
+ body = { data: body };
1465
+ }
1423
1466
 
1424
1467
  // Extract and store pagination metadata for display
1425
- if (response.data.pagination) {
1426
- apiPaginationMeta.value = response.data.pagination;
1468
+ if (body.pagination) {
1469
+ apiPaginationMeta.value = body.pagination;
1427
1470
  }
1428
1471
 
1429
1472
  // Extract and store filter values
1430
- if (response.data.filterValues) {
1431
- apiFilterValues.value = { ...apiFilterValues.value, ...response.data.filterValues };
1473
+ if (body.filterValues) {
1474
+ apiFilterValues.value = { ...apiFilterValues.value, ...body.filterValues };
1432
1475
  }
1433
1476
 
1434
- return response.data.data;
1477
+ return body.data;
1435
1478
  };
1436
1479
 
1437
1480
  /**