@asteby/metacore-runtime-react 7.1.1 → 7.1.3
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
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @asteby/metacore-runtime-react
|
|
2
2
|
|
|
3
|
+
## 7.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- db1a224: Fix raw i18n keys leaking into the auto-generated CRUD actions dropdown.
|
|
8
|
+
|
|
9
|
+
The auto-Actions column shipped in 7.1.0 looked up `datatable.view_record`, `datatable.edit` and `datatable.delete` — keys that didn't exist in `@asteby/metacore-i18n/locales`, so i18next fell back to the key string and the dropdown rendered "datatable.view_record" instead of "Ver".
|
|
10
|
+
|
|
11
|
+
Two fixes:
|
|
12
|
+
- `@asteby/metacore-i18n`: add `datatable.edit` and `datatable.delete` to the base ES/EN bundles (alongside the pre-existing `datatable.view`).
|
|
13
|
+
- `@asteby/metacore-runtime-react`: lookup `datatable.view` (the real key) and pass `{ defaultValue }` to every action label so a missing bundle never leaks the key into the UI.
|
|
14
|
+
|
|
15
|
+
## 7.1.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- c00d7f9: Fix DynamicTable horizontal scrollbar appearing mid-card.
|
|
20
|
+
|
|
21
|
+
`<Table>` from `@asteby/metacore-ui` ships its own `overflow-x-auto` wrapper sized to content height. Combined with DynamicTable's outer `flex-1 min-h-0 overflow-auto` card, the inner scrollbar drew at the bottom of the rendered rows (mid-card) instead of pinned to the card's bottom edge — wide tables felt visually broken when there were few rows.
|
|
22
|
+
|
|
23
|
+
Pass `noWrapper` to opt out of shadcn's inner wrapper. The outer SDK wrapper now owns the scroll; horizontal scrollbar pins to the bottom of the card as expected.
|
|
24
|
+
|
|
3
25
|
## 7.1.1
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-columns.d.ts","sourceRoot":"","sources":["../src/dynamic-columns.tsx"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAER,iBAAiB,EACpB,MAAM,wBAAwB,CAAA;AAE/B,qEAAqE;AACrE,MAAM,WAAW,qBAAqB;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IACtC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACtB;AAwHD;;;;GAIG;AACH,wBAAgB,4BAA4B,CACxC,OAAO,GAAE,qBAA0B,GACpC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"dynamic-columns.d.ts","sourceRoot":"","sources":["../src/dynamic-columns.tsx"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAER,iBAAiB,EACpB,MAAM,wBAAwB,CAAA;AAE/B,qEAAqE;AACrE,MAAM,WAAW,qBAAqB;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IACtC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACtB;AAwHD;;;;GAIG;AACH,wBAAgB,4BAA4B,CACxC,OAAO,GAAE,qBAA0B,GACpC,iBAAiB,CAmXnB;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,iBACL,CAAA"}
|
package/dist/dynamic-columns.js
CHANGED
|
@@ -276,24 +276,25 @@ export function makeDefaultGetDynamicColumns(helpers = {}) {
|
|
|
276
276
|
// ship.
|
|
277
277
|
const explicitActions = metadata.actions ?? [];
|
|
278
278
|
const hasExplicitActions = (metadata.hasActions ?? explicitActions.length > 0) && explicitActions.length > 0;
|
|
279
|
+
const tx = (key, fallback) => t ? t(key, { defaultValue: fallback }) : fallback;
|
|
279
280
|
const defaultCRUDActions = metadata.enableCRUDActions
|
|
280
281
|
? [
|
|
281
282
|
{
|
|
282
283
|
key: 'view',
|
|
283
284
|
name: 'view',
|
|
284
|
-
label:
|
|
285
|
+
label: tx('datatable.view', 'Ver'),
|
|
285
286
|
icon: 'Eye',
|
|
286
287
|
},
|
|
287
288
|
{
|
|
288
289
|
key: 'edit',
|
|
289
290
|
name: 'edit',
|
|
290
|
-
label:
|
|
291
|
+
label: tx('datatable.edit', 'Editar'),
|
|
291
292
|
icon: 'Pencil',
|
|
292
293
|
},
|
|
293
294
|
{
|
|
294
295
|
key: 'delete',
|
|
295
296
|
name: 'delete',
|
|
296
|
-
label:
|
|
297
|
+
label: tx('datatable.delete', 'Eliminar'),
|
|
297
298
|
icon: 'Trash2',
|
|
298
299
|
},
|
|
299
300
|
]
|
package/dist/dynamic-table.js
CHANGED
|
@@ -539,12 +539,12 @@ export function DynamicTable({ model, endpoint, enableUrlSync = true, hiddenColu
|
|
|
539
539
|
});
|
|
540
540
|
const TableSkeleton = () => (_jsx(_Fragment, { children: Array.from({ length: 5 }).map((_, i) => (_jsxs(TableRow, { className: "hover:bg-transparent", children: [_jsx(TableCell, { className: "py-3 w-10", children: _jsx(Skeleton, { className: "h-4 w-4" }) }), _jsx(TableCell, { className: "py-3", children: _jsx(Skeleton, { className: "h-4 w-[70%]" }) }), _jsx(TableCell, { className: "py-3", children: _jsx(Skeleton, { className: "h-4 w-[50%]" }) }), _jsx(TableCell, { className: "py-3", children: _jsx(Skeleton, { className: "h-4 w-[60%]" }) }), _jsx(TableCell, { className: "py-3 w-16", children: _jsx(Skeleton, { className: "h-6 w-6" }) })] }, `skeleton-${i}`))) }));
|
|
541
541
|
if (loading) {
|
|
542
|
-
return (_jsxs("div", { className: 'flex flex-col h-full min-h-0 w-full', children: [_jsx("div", { className: 'pb-4 shrink-0', children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx(Skeleton, { className: "h-9 w-[280px]" }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Skeleton, { className: "h-9 w-9" }), _jsx(Skeleton, { className: "h-9 w-[70px]" })] })] }) }), _jsx("div", { className: 'flex-1 min-h-0 overflow-auto border rounded-md bg-card', children: _jsxs(Table, { className:
|
|
542
|
+
return (_jsxs("div", { className: 'flex flex-col h-full min-h-0 w-full', children: [_jsx("div", { className: 'pb-4 shrink-0', children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx(Skeleton, { className: "h-9 w-[280px]" }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Skeleton, { className: "h-9 w-9" }), _jsx(Skeleton, { className: "h-9 w-[70px]" })] })] }) }), _jsx("div", { className: 'flex-1 min-h-0 overflow-auto border rounded-md bg-card', children: _jsxs(Table, { noWrapper: true, className: "min-w-max w-full", children: [_jsx(TableHeader, { className: 'sticky top-0 z-10', children: _jsxs(TableRow, { className: 'border-b-0 hover:bg-transparent', children: [_jsx(TableHead, { className: 'bg-card border-b h-10 w-10', children: _jsx(Skeleton, { className: "h-4 w-4" }) }), _jsx(TableHead, { className: 'bg-card border-b h-10', children: _jsx(Skeleton, { className: "h-4 w-16" }) }), _jsx(TableHead, { className: 'bg-card border-b h-10', children: _jsx(Skeleton, { className: "h-4 w-14" }) }), _jsx(TableHead, { className: 'bg-card border-b h-10', children: _jsx(Skeleton, { className: "h-4 w-20" }) }), _jsx(TableHead, { className: 'bg-card border-b h-10 w-16', children: _jsx(Skeleton, { className: "h-4 w-12" }) })] }) }), _jsx(TableBody, { children: _jsx(TableSkeleton, {}) })] }) })] }));
|
|
543
543
|
}
|
|
544
544
|
if (!metadata) {
|
|
545
545
|
return _jsx("div", { className: "text-center text-muted-foreground py-8", children: "Error al cargar la configuraci\u00F3n de la tabla." });
|
|
546
546
|
}
|
|
547
|
-
return (_jsxs(OptionsContext.Provider, { value: { optionsMap }, children: [_jsxs("div", { className: 'flex flex-col h-full min-h-0 w-full', children: [_jsx("div", { className: 'pb-4 shrink-0', children: _jsx(DataTableToolbar, { table: table, searchPlaceholder: metadata.searchPlaceholder || 'Buscar...', filters: filters, activeFilters: dynamicFilters, onDynamicFilterChange: handleDynamicFilterChange, dateFilter: { value: dateRange, onChange: setDateRange, placeholder: 'Filtrar por fecha' }, perPageOptions: metadata.perPageOptions, onRefresh: handleRefresh, isLoading: loadingData, selectedCount: Object.keys(rowSelection).length, onBulkDelete: () => setShowBulkDeleteConfirm(true), extraActions: _jsxs(_Fragment, { children: [metadata.canExport && (_jsxs(Button, { variant: "outline", size: "sm", className: "h-8", onClick: () => setExportOpen(true), children: [_jsx(Download, { className: "h-4 w-4 mr-1" }), " Exportar"] })), metadata.canImport && (_jsxs(Button, { variant: "outline", size: "sm", className: "h-8", onClick: () => setImportOpen(true), children: [_jsx(Upload, { className: "h-4 w-4 mr-1" }), " Importar"] }))] }) }) }), _jsx("div", { className: 'flex-1 min-h-0 overflow-auto border rounded-md bg-card', children: _jsxs(Table, { className:
|
|
547
|
+
return (_jsxs(OptionsContext.Provider, { value: { optionsMap }, children: [_jsxs("div", { className: 'flex flex-col h-full min-h-0 w-full', children: [_jsx("div", { className: 'pb-4 shrink-0', children: _jsx(DataTableToolbar, { table: table, searchPlaceholder: metadata.searchPlaceholder || 'Buscar...', filters: filters, activeFilters: dynamicFilters, onDynamicFilterChange: handleDynamicFilterChange, dateFilter: { value: dateRange, onChange: setDateRange, placeholder: 'Filtrar por fecha' }, perPageOptions: metadata.perPageOptions, onRefresh: handleRefresh, isLoading: loadingData, selectedCount: Object.keys(rowSelection).length, onBulkDelete: () => setShowBulkDeleteConfirm(true), extraActions: _jsxs(_Fragment, { children: [metadata.canExport && (_jsxs(Button, { variant: "outline", size: "sm", className: "h-8", onClick: () => setExportOpen(true), children: [_jsx(Download, { className: "h-4 w-4 mr-1" }), " Exportar"] })), metadata.canImport && (_jsxs(Button, { variant: "outline", size: "sm", className: "h-8", onClick: () => setImportOpen(true), children: [_jsx(Upload, { className: "h-4 w-4 mr-1" }), " Importar"] }))] }) }) }), _jsx("div", { className: 'flex-1 min-h-0 overflow-auto border rounded-md bg-card', children: _jsxs(Table, { noWrapper: true, className: "min-w-max w-full", children: [_jsx(TableHeader, { className: 'sticky top-0 z-10', children: table.getHeaderGroups().map((headerGroup) => (_jsx(TableRow, { className: 'border-b-0 hover:bg-transparent', children: headerGroup.headers.map((header) => {
|
|
548
548
|
const isActionsColumn = header.id === 'actions';
|
|
549
549
|
return (_jsx(TableHead, { colSpan: header.colSpan, style: header.column.columnDef.size ? { width: header.column.columnDef.size } : undefined, className: cn('bg-card border-b h-10', isActionsColumn && 'sticky right-0 z-20 bg-card shadow-[-2px_0_5px_-2px_rgba(0,0,0,0.1)]'), children: header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()) }, header.id));
|
|
550
550
|
}) }, 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) => {
|
package/package.json
CHANGED
package/src/dynamic-columns.tsx
CHANGED
|
@@ -471,25 +471,27 @@ export function makeDefaultGetDynamicColumns(
|
|
|
471
471
|
// ship.
|
|
472
472
|
const explicitActions = metadata.actions ?? []
|
|
473
473
|
const hasExplicitActions = (metadata.hasActions ?? explicitActions.length > 0) && explicitActions.length > 0
|
|
474
|
+
const tx = (key: string, fallback: string) =>
|
|
475
|
+
t ? t(key, { defaultValue: fallback }) : fallback
|
|
474
476
|
const defaultCRUDActions: typeof explicitActions =
|
|
475
477
|
metadata.enableCRUDActions
|
|
476
478
|
? [
|
|
477
479
|
{
|
|
478
480
|
key: 'view',
|
|
479
481
|
name: 'view',
|
|
480
|
-
label:
|
|
482
|
+
label: tx('datatable.view', 'Ver'),
|
|
481
483
|
icon: 'Eye',
|
|
482
484
|
} as any,
|
|
483
485
|
{
|
|
484
486
|
key: 'edit',
|
|
485
487
|
name: 'edit',
|
|
486
|
-
label:
|
|
488
|
+
label: tx('datatable.edit', 'Editar'),
|
|
487
489
|
icon: 'Pencil',
|
|
488
490
|
} as any,
|
|
489
491
|
{
|
|
490
492
|
key: 'delete',
|
|
491
493
|
name: 'delete',
|
|
492
|
-
label:
|
|
494
|
+
label: tx('datatable.delete', 'Eliminar'),
|
|
493
495
|
icon: 'Trash2',
|
|
494
496
|
} as any,
|
|
495
497
|
]
|
package/src/dynamic-table.tsx
CHANGED
|
@@ -602,7 +602,7 @@ export function DynamicTable({
|
|
|
602
602
|
</div>
|
|
603
603
|
</div>
|
|
604
604
|
<div className='flex-1 min-h-0 overflow-auto border rounded-md bg-card'>
|
|
605
|
-
<Table className=
|
|
605
|
+
<Table noWrapper className="min-w-max w-full">
|
|
606
606
|
<TableHeader className='sticky top-0 z-10'>
|
|
607
607
|
<TableRow className='border-b-0 hover:bg-transparent'>
|
|
608
608
|
<TableHead className='bg-card border-b h-10 w-10'><Skeleton className="h-4 w-4" /></TableHead>
|
|
@@ -656,7 +656,7 @@ export function DynamicTable({
|
|
|
656
656
|
/>
|
|
657
657
|
</div>
|
|
658
658
|
<div className='flex-1 min-h-0 overflow-auto border rounded-md bg-card'>
|
|
659
|
-
<Table className=
|
|
659
|
+
<Table noWrapper className="min-w-max w-full">
|
|
660
660
|
<TableHeader className='sticky top-0 z-10'>
|
|
661
661
|
{table.getHeaderGroups().map((headerGroup: HeaderGroup<any>) => (
|
|
662
662
|
<TableRow key={headerGroup.id} className='border-b-0 hover:bg-transparent'>
|