@asteby/metacore-runtime-react 18.10.0 → 18.10.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.
- package/CHANGELOG.md +7 -0
- package/dist/dynamic-table.d.ts.map +1 -1
- package/dist/dynamic-table.js +4 -3
- package/package.json +3 -3
- package/src/dynamic-table.tsx +10 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @asteby/metacore-runtime-react
|
|
2
2
|
|
|
3
|
+
## 18.10.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ea5e587: The dynamic table totals footer is now sticky (pinned to the bottom of the
|
|
8
|
+
scroll area) so the column totals stay visible while scrolling the rows.
|
|
9
|
+
|
|
3
10
|
## 18.10.0
|
|
4
11
|
|
|
5
12
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-table.d.ts","sourceRoot":"","sources":["../src/dynamic-table.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAKH,KAAK,SAAS,EAajB,MAAM,uBAAuB,CAAA;AAgC9B,OAAO,KAAK,EAAsB,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAUnF,UAAU,iBAAiB;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,IAAI,CAAA;IAC7C,cAAc,CAAC,EAAE,GAAG,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACpC,YAAY,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,CAAA;IAC/B;;;;;OAKG;IACH,iBAAiB,C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AiB,EACjB,iBAA4C,EAC5C,QAAQ,EACR,QAAQ,GACX,EAAE,iBAAiB,+BA02BnB"}
|
package/dist/dynamic-table.js
CHANGED
|
@@ -626,15 +626,16 @@ export function DynamicTable({ model, endpoint, enableUrlSync = true, hiddenColu
|
|
|
626
626
|
}) }, headerGroup.id))) }), _jsx(TableBody, { children: loadingData && data.length === 0 ? (_jsx(TableSkeleton, {})) : table.getRowModel().rows?.length ? (table.getRowModel().rows.map((row) => (_jsx(TableRow, { "data-state": row.getIsSelected() && 'selected', children: row.getVisibleCells().map((cell) => {
|
|
627
627
|
const isActionsColumn = cell.column.id === 'actions';
|
|
628
628
|
return (_jsx(TableCell, { style: cell.column.columnDef.size ? { width: cell.column.columnDef.size } : undefined, className: cn('py-2', isActionsColumn && 'sticky right-0 bg-card shadow-[-2px_0_5px_-2px_rgba(0,0,0,0.1)]'), children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id));
|
|
629
|
-
}) }, row.id)))) : (_jsx(TableRow, { className: 'border-b-0 hover:bg-transparent', children: _jsx(TableCell, { colSpan: columns.length, className: 'h-full p-0', children: _jsxs("div", { className: "flex h-full py-12 flex-col items-center justify-center gap-2 text-muted-foreground", children: [_jsx("div", { className: "flex h-20 w-20 items-center justify-center rounded-full bg-muted/50", children: _jsx(Inbox, { className: "h-10 w-10" }) }), _jsxs("div", { className: "flex flex-col items-center gap-1", children: [_jsx("h3", { className: "text-lg font-semibold text-foreground", children: "No se encontraron resultados" }), _jsx("p", { className: "text-sm text-muted-foreground", children: "No hay datos para mostrar en este momento." })] })] }) }) })) }), aggregateColumns.length > 0 && Object.keys(footerTotals).length > 0 && (_jsx(TableFooter, { children: _jsx(TableRow, { className: "hover:bg-transparent", children: table.getVisibleLeafColumns().map((leaf, idx) => {
|
|
629
|
+
}) }, row.id)))) : (_jsx(TableRow, { className: 'border-b-0 hover:bg-transparent', children: _jsx(TableCell, { colSpan: columns.length, className: 'h-full p-0', children: _jsxs("div", { className: "flex h-full py-12 flex-col items-center justify-center gap-2 text-muted-foreground", children: [_jsx("div", { className: "flex h-20 w-20 items-center justify-center rounded-full bg-muted/50", children: _jsx(Inbox, { className: "h-10 w-10" }) }), _jsxs("div", { className: "flex flex-col items-center gap-1", children: [_jsx("h3", { className: "text-lg font-semibold text-foreground", children: "No se encontraron resultados" }), _jsx("p", { className: "text-sm text-muted-foreground", children: "No hay datos para mostrar en este momento." })] })] }) }) })) }), aggregateColumns.length > 0 && Object.keys(footerTotals).length > 0 && (_jsx(TableFooter, { className: "bg-transparent", children: _jsx(TableRow, { className: "hover:bg-transparent", children: table.getVisibleLeafColumns().map((leaf, idx) => {
|
|
630
630
|
const col = (metadata?.columns ?? []).find((c) => c.key === leaf.id);
|
|
631
631
|
const isFirst = idx === 0;
|
|
632
|
+
const stickyBase = 'sticky bottom-0 z-10 border-t bg-background py-2 font-semibold';
|
|
632
633
|
// Aggregate cell: render the SUM formatted like the body cell.
|
|
633
634
|
if (col && aggregateOf(col)) {
|
|
634
|
-
return (_jsx(TableCell, { className:
|
|
635
|
+
return (_jsx(TableCell, { className: `${stickyBase} text-right tabular-nums`, children: formatAggregateTotal(col, footerTotals[leaf.id], currency, i18n.language) }, leaf.id));
|
|
635
636
|
}
|
|
636
637
|
// First non-aggregate column carries the "Total" label.
|
|
637
|
-
return (_jsx(TableCell, { className:
|
|
638
|
+
return (_jsx(TableCell, { className: stickyBase, children: isFirst ? t('common.total', 'Total') : '' }, leaf.id));
|
|
638
639
|
}) }) }))] }) }), _jsx("div", { className: 'flex flex-1 min-h-0 flex-col gap-2 overflow-y-auto sm:hidden', children: loadingData && data.length === 0 ? (Array.from({ length: 5 }).map((_, i) => (_jsxs("div", { className: 'rounded-lg border bg-card p-3', children: [_jsx(Skeleton, { className: 'h-4 w-24' }), _jsx(Skeleton, { className: 'mt-2 h-4 w-40' }), _jsx(Skeleton, { className: 'mt-2 h-4 w-32' })] }, i)))) : table.getRowModel().rows?.length ? (table.getRowModel().rows.map((row) => {
|
|
639
640
|
const cells = row.getVisibleCells();
|
|
640
641
|
const actionsCell = cells.find((c) => c.column.id === 'actions');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asteby/metacore-runtime-react",
|
|
3
|
-
"version": "18.10.
|
|
3
|
+
"version": "18.10.1",
|
|
4
4
|
"description": "React runtime for metacore hosts — renders addon contributions dynamically",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"typescript": "^6.0.0",
|
|
62
62
|
"vitest": "^4.0.0",
|
|
63
63
|
"zustand": "^5.0.0",
|
|
64
|
-
"@asteby/metacore-
|
|
65
|
-
"@asteby/metacore-
|
|
64
|
+
"@asteby/metacore-ui": "2.5.1",
|
|
65
|
+
"@asteby/metacore-sdk": "3.2.0"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"build": "tsc -p tsconfig.json",
|
package/src/dynamic-table.tsx
CHANGED
|
@@ -812,19 +812,26 @@ export function DynamicTable({
|
|
|
812
812
|
)}
|
|
813
813
|
</TableBody>
|
|
814
814
|
{aggregateColumns.length > 0 && Object.keys(footerTotals).length > 0 && (
|
|
815
|
-
|
|
815
|
+
// Sticky footer: the totals row stays pinned to the bottom of
|
|
816
|
+
// the scroll area instead of scrolling away with the rows. The
|
|
817
|
+
// sticky lives on the cells (a <tr> can't be position:sticky
|
|
818
|
+
// reliably); each carries an opaque bg + top border so the body
|
|
819
|
+
// scrolls underneath cleanly.
|
|
820
|
+
<TableFooter className="bg-transparent">
|
|
816
821
|
<TableRow className="hover:bg-transparent">
|
|
817
822
|
{table.getVisibleLeafColumns().map((leaf: any, idx: number) => {
|
|
818
823
|
const col = (metadata?.columns ?? []).find(
|
|
819
824
|
(c) => c.key === leaf.id,
|
|
820
825
|
)
|
|
821
826
|
const isFirst = idx === 0
|
|
827
|
+
const stickyBase =
|
|
828
|
+
'sticky bottom-0 z-10 border-t bg-background py-2 font-semibold'
|
|
822
829
|
// Aggregate cell: render the SUM formatted like the body cell.
|
|
823
830
|
if (col && aggregateOf(col as any)) {
|
|
824
831
|
return (
|
|
825
832
|
<TableCell
|
|
826
833
|
key={leaf.id}
|
|
827
|
-
className=
|
|
834
|
+
className={`${stickyBase} text-right tabular-nums`}
|
|
828
835
|
>
|
|
829
836
|
{formatAggregateTotal(
|
|
830
837
|
col as any,
|
|
@@ -837,7 +844,7 @@ export function DynamicTable({
|
|
|
837
844
|
}
|
|
838
845
|
// First non-aggregate column carries the "Total" label.
|
|
839
846
|
return (
|
|
840
|
-
<TableCell key={leaf.id} className=
|
|
847
|
+
<TableCell key={leaf.id} className={stickyBase}>
|
|
841
848
|
{isFirst ? t('common.total', 'Total') : ''}
|
|
842
849
|
</TableCell>
|
|
843
850
|
)
|