@pagamio/frontend-commons-lib 0.8.318 → 0.8.319
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,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { MantineReactTable, useMantineReactTable } from 'mantine-react-table';
|
|
3
3
|
import { HiPlusSm } from 'react-icons/hi';
|
|
4
|
-
import {
|
|
4
|
+
import { useMemo, useRef, useState } from 'react';
|
|
5
5
|
import { FilterComponent, IconButton } from '../../components';
|
|
6
6
|
import { cn } from '../../helpers';
|
|
7
7
|
import { useMediaQueries } from '../../shared';
|
|
@@ -104,31 +104,18 @@ function CustomToolbar({ filters, appliedFilters, onFilterChange, onApply, onCle
|
|
|
104
104
|
const PagamioTable = ({ columns, data, isLoading = 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, }) => {
|
|
105
105
|
const [expanded, setExpanded] = useState({});
|
|
106
106
|
const tableRef = useRef(null);
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
//
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
});
|
|
120
|
-
useEffect(() => {
|
|
121
|
-
const el = tableRef.current;
|
|
122
|
-
if (!el)
|
|
123
|
-
return;
|
|
124
|
-
const resizeObserver = new ResizeObserver(() => applyTableHeight(el));
|
|
125
|
-
resizeObserver.observe(document.documentElement);
|
|
126
|
-
window.addEventListener('resize', () => applyTableHeight(el));
|
|
127
|
-
return () => {
|
|
128
|
-
resizeObserver.disconnect();
|
|
129
|
-
window.removeEventListener('resize', () => applyTableHeight(el));
|
|
130
|
-
};
|
|
131
|
-
}, []);
|
|
107
|
+
// Note: previously this component force-applied
|
|
108
|
+
// max-height: calc(100vh - {tableTop + 68}px)
|
|
109
|
+
// to the inner mantine table container. That produced a "squeezed" table
|
|
110
|
+
// whenever the table sat below other content (e.g. nested in tabs on the
|
|
111
|
+
// event details page) — the table's own top was already far down the
|
|
112
|
+
// viewport, so the leftover max-height was tiny and only ~3 rows showed
|
|
113
|
+
// before an internal scroll kicked in.
|
|
114
|
+
//
|
|
115
|
+
// We now let the table render its natural height. Pagination caps the row
|
|
116
|
+
// count, and the parent route layout already scrolls when the page is
|
|
117
|
+
// taller than the viewport, so the user gets one continuous scroll instead
|
|
118
|
+
// of a nested mini-scroll.
|
|
132
119
|
// Process columns (handle showHeader: false)
|
|
133
120
|
const processedColumns = useMemo(() => processColumns(columns), [columns]);
|
|
134
121
|
// Convert our SortConfig to MRT's SortingState
|
|
@@ -274,6 +261,6 @@ const PagamioTable = ({ columns, data, isLoading = false, rowCount, sorting, pag
|
|
|
274
261
|
});
|
|
275
262
|
// ── Toolbar rendering ──────────────────────────────────────────────
|
|
276
263
|
const showCustomToolbar = toolbarMode === 'custom' && (!!toolbar || !!search || !!filtering);
|
|
277
|
-
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-hidden", children: _jsx(MantineReactTable, { table: table }) })] }));
|
|
264
|
+
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 }) })] }));
|
|
278
265
|
};
|
|
279
266
|
export default PagamioTable;
|
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.319",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"provenance": false
|