@pagamio/frontend-commons-lib 0.8.359 → 0.8.360

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,3 +1,3 @@
1
1
  import type { PagamioTableProps } from './types';
2
- declare const PagamioTable: <T extends Record<string, any>>({ columns, data, isLoading, isFetching, rowCount, sorting, pagination, filtering, search, onRowClick, rowClassName, expandable, renderDetailPanel, toolbar, toolbarMode, enableColumnResizing, enableColumnPinning, enableColumnOrdering, enableColumnFilters, enableHiding, enableRowSelection, enableRowActions, enableRowVirtualization, enableGrouping, enableEditing, enableDensityToggle, enableFullScreenToggle, enableClickToCopy, enableRowNumbers, enableMultiSort, enableStickyHeader, enableStickyFooter, editDisplayMode, onEditingRowSave, onEditingRowCancel, renderRowActions, renderRowActionMenuItems, positionActionsColumn, renderTopToolbarCustomActions, renderBottomToolbarCustomActions, layoutMode, defaultColumn, mantineTableOptions, }: PagamioTableProps<T>) => import("react/jsx-runtime").JSX.Element;
2
+ declare const PagamioTable: <T extends Record<string, any>>({ columns, data, isLoading, isFetching, rowCount, sorting, pagination, filtering, search, onRowClick, rowClassName, expandable, renderDetailPanel, toolbar, toolbarMode, fetchAllData, enableColumnResizing, enableColumnPinning, enableColumnOrdering, enableColumnFilters, enableHiding, enableRowSelection, enableRowActions, enableRowVirtualization, enableGrouping, enableEditing, enableDensityToggle, enableFullScreenToggle, enableClickToCopy, enableRowNumbers, enableMultiSort, enableStickyHeader, enableStickyFooter, editDisplayMode, onEditingRowSave, onEditingRowCancel, renderRowActions, renderRowActionMenuItems, positionActionsColumn, renderTopToolbarCustomActions, renderBottomToolbarCustomActions, layoutMode, defaultColumn, mantineTableOptions, }: PagamioTableProps<T>) => import("react/jsx-runtime").JSX.Element;
3
3
  export default PagamioTable;
@@ -101,7 +101,7 @@ function CustomToolbar({ filters, appliedFilters, onFilterChange, onApply, onCle
101
101
  (typeof addButton === 'boolean' ? (_jsx(IconButton, { onClick: onAdd ?? (() => { }), icon: HiPlusSm, label: "add-new-entry", className: cn('items-center text-nowrap', isNarrow ? 'w-full' : undefined), children: addText ?? 'Add New Entry' })) : (addButton))] }) }));
102
102
  }
103
103
  // ─── PagamioTable Component ──────────────────────────────────────────
104
- const PagamioTable = ({ columns, data, isLoading = false, isFetching = false, rowCount, sorting, pagination, filtering, search, onRowClick, rowClassName, expandable = false, renderDetailPanel, toolbar, toolbarMode = 'custom', enableColumnResizing, enableColumnPinning, enableColumnOrdering, enableColumnFilters, enableHiding, enableRowSelection, enableRowActions, enableRowVirtualization, enableGrouping, enableEditing, enableDensityToggle, enableFullScreenToggle, enableClickToCopy, enableRowNumbers, enableMultiSort, enableStickyHeader, enableStickyFooter, editDisplayMode, onEditingRowSave, onEditingRowCancel, renderRowActions, renderRowActionMenuItems, positionActionsColumn, renderTopToolbarCustomActions, renderBottomToolbarCustomActions, layoutMode, defaultColumn, mantineTableOptions, }) => {
104
+ const PagamioTable = ({ columns, data, isLoading = false, isFetching = false, rowCount, sorting, pagination, filtering, search, onRowClick, rowClassName, expandable = false, renderDetailPanel, toolbar, toolbarMode = 'custom', fetchAllData, enableColumnResizing, enableColumnPinning, enableColumnOrdering, enableColumnFilters, enableHiding, enableRowSelection, enableRowActions, enableRowVirtualization, enableGrouping, enableEditing, enableDensityToggle, enableFullScreenToggle, enableClickToCopy, enableRowNumbers, enableMultiSort, enableStickyHeader, enableStickyFooter, editDisplayMode, onEditingRowSave, onEditingRowCancel, renderRowActions, renderRowActionMenuItems, positionActionsColumn, renderTopToolbarCustomActions, renderBottomToolbarCustomActions, layoutMode, defaultColumn, mantineTableOptions, }) => {
105
105
  const [expanded, setExpanded] = useState({});
106
106
  const tableRef = useRef(null);
107
107
  // ── Internal max-height ─────────────────────────────────────────────
@@ -332,6 +332,14 @@ const PagamioTable = ({ columns, data, isLoading = false, isFetching = false, ro
332
332
  });
333
333
  // ── Toolbar rendering ──────────────────────────────────────────────
334
334
  const showCustomToolbar = toolbarMode === 'custom' && (!!toolbar || !!search || !!filtering);
335
- return (_jsxs("div", { children: [showCustomToolbar && (_jsx(CustomToolbar, { filters: toolbar?.filters ?? [], appliedFilters: filtering?.appliedFilters ?? {}, onFilterChange: filtering?.onFilterChange ?? (() => { }), onApply: filtering?.onApply ?? (() => { }), onClearFilters: toolbar?.onClearFilters, showClearFilters: toolbar?.showClearFilters ?? false, showApplyFilterButton: toolbar?.showApplyFilterButton ?? true, searchEnabled: !!search, searchQuery: search?.query ?? '', onSearch: search?.onChange ?? (() => { }), searchPlaceholder: search?.placeholder, exportConfig: toolbar?.export, columns: columns, data: data, addButton: toolbar?.addButton, addText: toolbar?.addText, onAdd: toolbar?.onAdd })), _jsx("div", { ref: tableRef, className: "border border-border rounded-md overflow-y-hidden", children: _jsx(MantineReactTable, { table: table }) })] }));
335
+ return (_jsxs("div", { children: [showCustomToolbar && (_jsx(CustomToolbar, { filters: toolbar?.filters ?? [], appliedFilters: filtering?.appliedFilters ?? {}, onFilterChange: filtering?.onFilterChange ?? (() => { }), onApply: filtering?.onApply ?? (() => { }), onClearFilters: toolbar?.onClearFilters, showClearFilters: toolbar?.showClearFilters ?? false, showApplyFilterButton: toolbar?.showApplyFilterButton ?? true, searchEnabled: !!search, searchQuery: search?.query ?? '', onSearch: search?.onChange ?? (() => { }), searchPlaceholder: search?.placeholder, exportConfig: toolbar?.export
336
+ ? {
337
+ ...toolbar.export,
338
+ // Fall back to the hook's top-level fetcher when a consumer's
339
+ // toolbar override didn't carry one — keeps "Export all data"
340
+ // working even when `toolbar` is replaced wholesale.
341
+ fetchAllData: toolbar.export.fetchAllData ?? fetchAllData,
342
+ }
343
+ : undefined, columns: columns, data: data, addButton: toolbar?.addButton, addText: toolbar?.addText, onAdd: toolbar?.onAdd })), _jsx("div", { ref: tableRef, className: "border border-border rounded-md overflow-y-hidden", children: _jsx(MantineReactTable, { table: table }) })] }));
336
344
  };
337
345
  export default PagamioTable;
@@ -172,6 +172,17 @@ export interface PagamioTableProps<T extends Record<string, any>> {
172
172
  }) => ReactNode;
173
173
  toolbar?: ToolbarConfig<T>;
174
174
  toolbarMode?: 'custom' | 'mrt' | 'none';
175
+ /**
176
+ * Server-side "export all" fetcher, auto-wired by `usePagamioTable` as a
177
+ * TOP-LEVEL prop (not just inside `toolbar.export`). Consumers spread
178
+ * `{...tableProps}` but frequently pass their own `toolbar={{...}}` for
179
+ * add-buttons/filters, which would otherwise drop the hook's
180
+ * `toolbar.export.fetchAllData` and silently break "Export all data".
181
+ * PagamioTable falls back to this when `toolbar.export.fetchAllData` is unset,
182
+ * so export-all keeps working regardless of a toolbar override. A consumer
183
+ * can still override by setting `toolbar.export.fetchAllData` explicitly.
184
+ */
185
+ fetchAllData?: (params?: Record<string, string>, onProgress?: (fetched: number, total: number) => void) => Promise<T[]>;
175
186
  enableColumnResizing?: boolean;
176
187
  enableColumnPinning?: boolean;
177
188
  enableColumnOrdering?: boolean;
@@ -327,6 +327,10 @@ export const usePagamioTable = ({ queryKey, queryFn, enabled: queryEnabled = tru
327
327
  isLoading,
328
328
  isFetching,
329
329
  rowCount: totalItems,
330
+ // Top-level so it survives a consumer's `toolbar={{...}}` override.
331
+ // PagamioTable falls back to this for export-all. Only for server mode
332
+ // (client tables already hold the whole set).
333
+ ...(isServerMode && { fetchAllData: fetchAllPages }),
330
334
  ...(paginationConfig.enabled && {
331
335
  pagination: {
332
336
  pageIndex: currentPage,
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.359",
4
+ "version": "0.8.360",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "provenance": false