Tabla de Datos y Lista Paginada para Angular | ng-hub-ui-paginable
Tabla de datos y lista paginada para Angular con paginación server-side, ordenación, filtros, selección, plantillas y variables CSS.
Referencia API
Aquí tienes el contrato completo de paginable: todo lo que puedes enlazar, escuchar, proyectar y personalizar, reunido en un solo sitio. Enlaza lo que necesites y dale el estilo que quieras — es standalone y reactivo con signals.
Inputs
Ajusta paginable a tu gusto con 29 inputs. Se enlazan como cualquier @Input de Angular.
| Nombre | Tipo | Por defecto | Descripción |
|---|---|---|---|
dataObligatorio | T[] | PaginationState<T> | null | — | Table data, bound with the `data` alias. Pass a plain array to let the table paginate/filter/sort in memory (client mode, when `paginate` is true and `totalItems` is unset); pass a `PaginationState` for server mode (the table renders it as-is and reads `page`/`perPage`/`totalItems` from it). |
headersObligatorio | (PaginableTableHeader | string)[] | — | Column definitions. A string is shorthand for `{ property, title }`; a `PaginableTableHeader` enables sorting, per-column filters, buttons, sticky/visibility, alignment and templates. Two-way bindable (`model`). |
page | number | null | — | Current 1-based page. Two-way bindable (`model`) — emits `pageChange`. Defaults to `null`. |
perPage | number | null | — | Items per page. Two-way bindable (`model`) — emits `perPageChange`. Defaults to `10`. |
perPageOptions | number[] | — | Selectable page sizes shown in the per-page selector. Defaults to `[10, 20, 50, 100]`. |
totalItems | number | null | — | Total number of items across all pages (server mode). Setting it keeps the table in server mode even for a plain array. Two-way bindable (`model`) — emits `totalItemsChange`. |
paginate | boolean | — | Enables pagination. When `true` (default) with a plain array and no `totalItems`, the table searches, filters, sorts and slices in memory (client mode). Set `false` to render the whole array without pagination. |
ordination | PaginableTableOrdination | — | Active sort (`{ property, direction }`). Two-way bindable (`model`) — emits `ordinationChange` when a sortable header is clicked. |
searchable | boolean | — | Shows the global search box. Defaults to `true`. |
searchTerm | string | — | Global search term. Two-way bindable (`model`) — emits `searchTermChange` (debounced by `debounce`). |
filters | Record<string, unknown> | null | — | Per-column filter values keyed by `filter.key` or `property`. Two-way bindable (`model`) — emits `filtersChange`. |
selectable | SelectionTypes | boolean | null | — | Enables row selection (`true`/`single` or `multiple`). The selected value is read/written through `ControlValueAccessor` (`[(ngModel)]` or a `formControl`). |
multiple | boolean | — | Forces multiple selection regardless of `selectable`. Defaults to `false`. |
bindValue | string | — | Property of each row used as the selection value instead of the whole object. |
clickFn | (event: TableRowEvent<T>) => void | Promise<void> | — | Callback invoked when a row is clicked, receiving the row data plus the originating event. |
rowClass | string | ((item: T) => string) | — | CSS class applied to every row, either a fixed string or a function of the row data. |
responsive | TableBreakpoint | null | — | Breakpoint at which the table switches to its responsive (stacked) layout. |
paginationPosition | 'bottom' | 'top' | 'both' | — | Where the pagination controls are rendered (`bottom`, `top` or `both`). Defaults to `bottom`. |
paginationInfo | boolean | — | Shows the "Showing X of Y" info line. Defaults to `true`. |
stickyActions | boolean | — | Keeps the row action column stuck to the viewport while scrolling. Defaults to `false`. |
stickyHeader | boolean | — | Pins the header (`position: sticky; top: 0`) while the body scrolls, inside any consumer `max-height`/`overflow:auto` container — decoupled from `options.scrollable`. Overridable via `--hub-table-head-position`. Defaults to `false`. |
batchActions | (PaginableTableDropdown | PaginableActionButton)[] | — | Actions shown in the toolbar that operate on the currently selected rows. |
debounce | number | — | Debounce in milliseconds applied to search and filter changes. Defaults to `0`. |
options | PaginableTableOptions | — | Visual/behavioural options: `striped`, `hoverableRows`, `variant`, `cursor`, `scrollable`, `rtl`… |
loading | boolean | — | Renders the loading state. Two-way bindable (`model`) — emits `loadingChange`. |
error | unknown | null | — | When truthy, renders the error state. Two-way bindable (`model`) — emits `errorChange`. |
loadingComponent | PaginableStateDefault | null | — | Per-instance default component for the loading state. |
errorComponent | PaginableStateDefault | null | — | Per-instance default component for the error state. |
noResultsComponent | PaginableStateDefault | null | — | Per-instance default component for the no-results state. |
Outputs
Reacciona a lo que hace paginable: 9 eventos a los que enganchar tu lógica.
| Nombre | Tipo | Descripción |
|---|---|---|
pageChange | number | null | Emitted by the two-way `page` model when the current page changes. |
perPageChange | number | null | Emitted by the two-way `perPage` model when the page size changes. |
totalItemsChange | number | null | Emitted by the two-way `totalItems` model (e.g. when a `PaginationState` is bound). |
ordinationChange | PaginableTableOrdination | Emitted by the two-way `ordination` model when sorting changes — use it to drive server-side sorting. |
filtersChange | Record<string, unknown> | null | Emitted by the two-way `filters` model when a column filter changes — use it to drive server-side filtering. |
searchTermChange | string | Emitted by the two-way `searchTerm` model when the global search changes (debounced by `debounce`). |
loadingChange | boolean | Emitted by the two-way `loading` model. |
errorChange | unknown | null | Emitted by the two-way `error` model. |
headersChange | (PaginableTableHeader | string)[] | Emitted by the two-way `headers` model when the column configuration changes. |
Templates
Hazlo tuyo — 7 plantillas para proyectar tu propio marcado.
| Nombre | Descripción | Ejemplo |
|---|---|---|
*paginableTableHeader | Plantilla de cabecera personalizada para definir cabeceras de columna personalizadas | <ng-template *paginableTableHeader="let column">{{ column.title }}</ng-template> |
*paginableTableCell | Plantilla de celda personalizada para personalizar el renderizado del contenido de las celdas | <ng-template *paginableTableCell="let value; let row">{{ value }}</ng-template> |
*paginableTableRow | Plantilla de fila personalizada para definir la estructura completa de la fila | <ng-template *paginableTableRow="let row"><tr>...</tr></ng-template> |
*paginableTableFilter | Plantilla de filtro personalizada para añadir elementos de interfaz de filtrado | <ng-template *paginableTableFilter="let column"><input type="text"></ng-template> |
*paginableTableLoading | Plantilla de estado de carga para indicadores de carga personalizados | <ng-template *paginableTableLoading><div class="spinner"></div></ng-template> |
*paginableNoResults | Plantilla de estado vacío que se muestra cuando no hay datos disponibles | <ng-template *paginableNoResults><p>No data found</p></ng-template> |
*paginableTableError | Plantilla de estado de error para gestionar condiciones de error | <ng-template *paginableTableError="let error"><p>Error: {{ error }}</p></ng-template> |