@egose/shadcn-theme-ng-tw 0.6.4 → 0.7.0

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,12 +1,19 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, computed, ChangeDetectionStrategy, Component, model, output, signal, linkedSignal, effect, untracked, NgModule } from '@angular/core';
2
+ import { InjectionToken, inject, effect, input, computed, ChangeDetectionStrategy, Component, model, output, signal, linkedSignal, untracked, afterNextRender, NgModule } from '@angular/core';
3
+ import { _IdGenerator } from '@angular/cdk/a11y';
4
+ import { BreakpointObserver } from '@angular/cdk/layout';
3
5
  import { NgTemplateOutlet } from '@angular/common';
6
+ import { takeUntilDestroyed, toSignal, toObservable } from '@angular/core/rxjs-interop';
7
+ import * as i2 from '@angular/forms';
8
+ import { FormControl, ReactiveFormsModule } from '@angular/forms';
4
9
  import { HlmButton } from '@egose/shadcn-theme-ng-tw/button';
5
10
  import { HlmCard, HlmCardContent } from '@egose/shadcn-theme-ng-tw/card';
6
11
  import { HlmIcon } from '@egose/shadcn-theme-ng-tw/icon';
7
12
  import { HlmInput } from '@egose/shadcn-theme-ng-tw/input';
13
+ import * as i1 from '@egose/shadcn-theme-ng-tw/select';
14
+ import { HlmSelectImports } from '@egose/shadcn-theme-ng-tw/select';
8
15
  import { HlmSpinner } from '@egose/shadcn-theme-ng-tw/spinner';
9
- import * as i2 from '@egose/shadcn-theme-ng-tw/table';
16
+ import * as i3 from '@egose/shadcn-theme-ng-tw/table';
10
17
  import { HlmTableImports } from '@egose/shadcn-theme-ng-tw/table';
11
18
  import { HlmToggleGroup, HlmToggleGroupItem } from '@egose/shadcn-theme-ng-tw/toggle-group';
12
19
  import { hlm } from '@egose/shadcn-theme-ng-tw/utils';
@@ -14,11 +21,15 @@ import { NgIcon, provideIcons } from '@ng-icons/core';
14
21
  import { lucideChevronsRight, lucideChevronsLeft, lucideChevronRight, lucideChevronLeft, lucideSettings2, lucideLayoutList, lucideLayoutGrid, lucideChevronsUpDown, lucideArrowUp, lucideArrowDown, lucideEyeOff } from '@ng-icons/lucide';
15
22
  import * as i1$2 from '@tanstack/angular-table';
16
23
  import { createFilteredRowModel, createPaginatedRowModel, createSortedRowModel, filterFn_includesString, sortFn_alphanumeric, sortFn_text, tableFeatures, rowSortingFeature, rowSelectionFeature, rowPaginationFeature, columnVisibilityFeature, columnFilteringFeature, injectTableContext, createColumnHelper, injectTable, TanStackTable, FlexRender } from '@tanstack/angular-table';
17
- import * as i1 from '@egose/shadcn-theme-ng-tw/select';
18
- import { HlmSelectImports } from '@egose/shadcn-theme-ng-tw/select';
24
+ import { switchMap, map, of } from 'rxjs';
25
+ import { HlmCheckbox } from '@egose/shadcn-theme-ng-tw/checkbox';
19
26
  import * as i1$1 from '@egose/shadcn-theme-ng-tw/dropdown-menu';
20
27
  import { HlmDropdownMenuImports } from '@egose/shadcn-theme-ng-tw/dropdown-menu';
21
- import { HlmCheckbox } from '@egose/shadcn-theme-ng-tw/checkbox';
28
+
29
+ function columnLabel(column) {
30
+ const { header, meta } = column.columnDef;
31
+ return meta?.label ?? (typeof header === 'string' ? header : column.id.replace(/_/g, ' '));
32
+ }
22
33
 
23
34
  // Explicit instantiations keep the inferred feature-registry type free of `any`
24
35
  // (the factories default their generics to `any` when called bare, which would
@@ -55,6 +66,80 @@ const defaultEgDataTableFeatures = tableFeatures({
55
66
  columnMeta: {},
56
67
  });
57
68
 
69
+ const defaultLabels = {
70
+ filterLabel: 'Filter rows',
71
+ filterPlaceholder: 'Filter...',
72
+ emptyMessage: 'No results found.',
73
+ loading: 'Loading results',
74
+ refreshing: 'Refreshing…',
75
+ tableView: 'Table view',
76
+ gridView: 'Grid view',
77
+ sortBy: 'Sort by',
78
+ sortByColumn: (column) => `Sort by ${column}`,
79
+ sortAscending: 'Sort ascending',
80
+ sortDescending: 'Sort descending',
81
+ ascending: 'Asc',
82
+ descending: 'Desc',
83
+ hideColumn: 'Hide',
84
+ view: 'View',
85
+ toggleColumns: 'Toggle columns',
86
+ selectAll: 'Select all',
87
+ selectRow: 'Select row',
88
+ rowsPerPage: 'Rows per page',
89
+ firstPage: 'First',
90
+ previousPage: 'Previous',
91
+ nextPage: 'Next',
92
+ lastPage: 'Last',
93
+ goToFirstPage: 'Go to first page',
94
+ goToPreviousPage: 'Go to previous page',
95
+ goToNextPage: 'Go to next page',
96
+ goToLastPage: 'Go to last page',
97
+ pageStatus: (page, count) => (count === undefined ? `Page ${page}` : `Page ${page} of ${count}`),
98
+ rowCount: (count, onPage) => (onPage ? `${count} row(s) on this page.` : `${count} row(s).`),
99
+ selectedRows: (selected, total) => `${selected} of ${total} row(s) selected`,
100
+ rowRange: (from, to, total) => `Showing ${from} to ${to} of ${total} records`,
101
+ };
102
+ const labelsToken = new InjectionToken('EgDataTableLabels');
103
+ /** Override data-table text in an application or component's providers. Omitted labels use English. */
104
+ function provideEgDataTableLabels(labels) {
105
+ const overrides = Object.entries(labels).filter(([, value]) => value !== undefined);
106
+ return { provide: labelsToken, useValue: { ...defaultLabels, ...Object.fromEntries(overrides) } };
107
+ }
108
+ function injectEgDataTableLabels() {
109
+ return inject(labelsToken, { optional: true }) ?? defaultLabels;
110
+ }
111
+
112
+ /** Keep the select on the accepted value, including when the caller rejects or hasn't applied a proposal. */
113
+ function createControlledSelect(value, onSelect) {
114
+ const control = new FormControl(null);
115
+ const syncValue = () => {
116
+ const current = value();
117
+ if (!Object.is(control.value, current))
118
+ control.setValue(current, { emitEvent: false });
119
+ };
120
+ effect(syncValue);
121
+ control.valueChanges.pipe(takeUntilDestroyed()).subscribe((requested) => {
122
+ if (requested !== null && !Object.is(requested, value()))
123
+ onSelect(requested);
124
+ syncValue();
125
+ });
126
+ return control;
127
+ }
128
+
129
+ /**
130
+ * Standalone pagination controls with an optional rows-per-page selector.
131
+ *
132
+ * Reads the table from the nearest `[tanStackTable]` directive, so no table
133
+ * input or generics are needed and the same component works with any table.
134
+ * Wrap the usage site: `<div [tanStackTable]="table"><eg-data-table-pagination /></div>`.
135
+ * With TanStack's `pageCount: -1` (unknown total), the pager shows only Previous/Next
136
+ * and the current page number. Bind `hasNext` and `hasPrevious` to API limits when available.
137
+ *
138
+ * Page-size changes flow through `table.setPageSize()`: client-side tables
139
+ * re-paginate immediately, while server-driven (`manualPagination`) tables
140
+ * surface the change via their `onPaginationChange` handler (e.g. the
141
+ * `pageSizeChange` output of `EgDataTable`) so the caller can refetch.
142
+ */
58
143
  class EgDataTablePagination {
59
144
  /** Show the `selected of total` status text. Set false when the host renders its own status. */
60
145
  showStatus = input(true, /* @ts-ignore */
@@ -71,6 +156,16 @@ class EgDataTablePagination {
71
156
  /** Density of buttons, trigger, and meta texts. Type scale of buttons is untouched. */
72
157
  size = input('default', /* @ts-ignore */
73
158
  ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
159
+ /** Disable navigation and the page-size selector while leaving the pager visible. */
160
+ disabled = input(false, /* @ts-ignore */
161
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
162
+ /** Optional server-side navigation limits. */
163
+ hasPrevious = input(/* @ts-ignore */
164
+ ...(ngDevMode ? [undefined, { debugName: "hasPrevious" }] : /* istanbul ignore next */ []));
165
+ hasNext = input(/* @ts-ignore */
166
+ ...(ngDevMode ? [undefined, { debugName: "hasNext" }] : /* istanbul ignore next */ []));
167
+ _labels = injectEgDataTableLabels();
168
+ _pageSizeLabelId = inject(_IdGenerator).getId('eg-data-table-page-size-');
74
169
  _table = injectTableContext();
75
170
  _pageCount = computed(() => this._table().getPageCount(), /* @ts-ignore */
76
171
  ...(ngDevMode ? [{ debugName: "_pageCount" }] : /* istanbul ignore next */ []));
@@ -79,12 +174,20 @@ class EgDataTablePagination {
79
174
  ...(ngDevMode ? [{ debugName: "_pageIndex" }] : /* istanbul ignore next */ []));
80
175
  _pageSize = computed(() => this._table().atoms.pagination.get().pageSize, /* @ts-ignore */
81
176
  ...(ngDevMode ? [{ debugName: "_pageSize" }] : /* istanbul ignore next */ []));
82
- _canPrevious = computed(() => this._table().getCanPreviousPage(), /* @ts-ignore */
177
+ _pageSizeControl = createControlledSelect(this._pageSize, (size) => {
178
+ if (!this.disabled())
179
+ this._table().setPageSize(size);
180
+ });
181
+ _unknownTotal = computed(() => this._pageCount() === -1, /* @ts-ignore */
182
+ ...(ngDevMode ? [{ debugName: "_unknownTotal" }] : /* istanbul ignore next */ []));
183
+ _canPrevious = computed(() => !this.disabled() && this.hasPrevious() !== false && this._table().getCanPreviousPage(), /* @ts-ignore */
83
184
  ...(ngDevMode ? [{ debugName: "_canPrevious" }] : /* istanbul ignore next */ []));
84
- _canNext = computed(() => this._table().getCanNextPage(), /* @ts-ignore */
185
+ _canNext = computed(() => !this.disabled() && this.hasNext() !== false && this._table().getCanNextPage(), /* @ts-ignore */
85
186
  ...(ngDevMode ? [{ debugName: "_canNext" }] : /* istanbul ignore next */ []));
86
- _showPager = computed(() => this._pageCount() > 1, /* @ts-ignore */
187
+ _showPager = computed(() => this._unknownTotal() || this._pageCount() > 1, /* @ts-ignore */
87
188
  ...(ngDevMode ? [{ debugName: "_showPager" }] : /* istanbul ignore next */ []));
189
+ _pageLabel = computed(() => this._labels.pageStatus(this._pageIndex() + 1, this._unknownTotal() ? undefined : this._pageCount()), /* @ts-ignore */
190
+ ...(ngDevMode ? [{ debugName: "_pageLabel" }] : /* istanbul ignore next */ []));
88
191
  /** Icon-only buttons stay square; labeled buttons size to their text. Merged by `hlmButton` via the `class` binding. */
89
192
  _navButtonClass = computed(() => hlm(this.size() === 'sm' ? 'tw:h-7 tw:p-0' : this.size() === 'lg' ? 'tw:h-9 tw:p-0' : 'tw:h-8 tw:p-0', this.navMode() === 'icons'
90
193
  ? this.size() === 'sm'
@@ -113,15 +216,25 @@ class EgDataTablePagination {
113
216
  const selected = table.getFilteredSelectedRowModel().rows.length;
114
217
  const total = table.getFilteredRowModel().rows.length;
115
218
  if (selected > 0)
116
- return `${selected} of ${total} row(s) selected.`;
117
- return `${total} row(s).`;
219
+ return this._labels.selectedRows(selected, total);
220
+ return this._labels.rowCount(total, false);
118
221
  }, /* @ts-ignore */
119
222
  ...(ngDevMode ? [{ debugName: "_statusText" }] : /* istanbul ignore next */ []));
120
- _onPageSizeChange(value) {
121
- this._table().setPageSize(Number(value));
223
+ constructor() {
224
+ effect(() => {
225
+ if (this.disabled())
226
+ this._pageSizeControl.disable({ emitEvent: false });
227
+ else
228
+ this._pageSizeControl.enable({ emitEvent: false });
229
+ });
230
+ }
231
+ _navigate(action) {
232
+ const canNavigate = action === 'firstPage' || action === 'previousPage' ? this._canPrevious() : this._canNext();
233
+ if (canNavigate)
234
+ this._table()[action]();
122
235
  }
123
236
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgDataTablePagination, deps: [], target: i0.ɵɵFactoryTarget.Component });
124
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgDataTablePagination, isStandalone: true, selector: "eg-data-table-pagination", inputs: { showStatus: { classPropertyName: "showStatus", publicName: "showStatus", isSignal: true, isRequired: false, transformFunction: null }, showPageSize: { classPropertyName: "showPageSize", publicName: "showPageSize", isSignal: true, isRequired: false, transformFunction: null }, pageSizes: { classPropertyName: "pageSizes", publicName: "pageSizes", isSignal: true, isRequired: false, transformFunction: null }, navMode: { classPropertyName: "navMode", publicName: "navMode", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideIcons({ lucideChevronLeft, lucideChevronRight, lucideChevronsLeft, lucideChevronsRight })], ngImport: i0, template: `
237
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgDataTablePagination, isStandalone: true, selector: "eg-data-table-pagination", inputs: { showStatus: { classPropertyName: "showStatus", publicName: "showStatus", isSignal: true, isRequired: false, transformFunction: null }, showPageSize: { classPropertyName: "showPageSize", publicName: "showPageSize", isSignal: true, isRequired: false, transformFunction: null }, pageSizes: { classPropertyName: "pageSizes", publicName: "pageSizes", isSignal: true, isRequired: false, transformFunction: null }, navMode: { classPropertyName: "navMode", publicName: "navMode", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, hasPrevious: { classPropertyName: "hasPrevious", publicName: "hasPrevious", isSignal: true, isRequired: false, transformFunction: null }, hasNext: { classPropertyName: "hasNext", publicName: "hasNext", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideIcons({ lucideChevronLeft, lucideChevronRight, lucideChevronsLeft, lucideChevronsRight })], ngImport: i0, template: `
125
238
  <div class="tw:flex tw:flex-wrap tw:items-center tw:justify-between tw:gap-2 tw:px-2">
126
239
  @if (showStatus()) {
127
240
  <div class="tw:text-muted-foreground tw:flex-1 {{ _metaTextClass() }}">{{ _statusText() }}</div>
@@ -129,42 +242,57 @@ class EgDataTablePagination {
129
242
  <div class="tw:flex tw:flex-wrap tw:items-center tw:gap-x-6 tw:gap-y-2 tw:lg:gap-x-8">
130
243
  @if (showPageSize()) {
131
244
  <div class="tw:flex tw:items-center tw:gap-2">
132
- <p class="tw:font-medium {{ _metaTextClass() }}">Rows per page</p>
133
- <div hlmSelect class="tw:inline-flex" [value]="_pageSize()" (valueChange)="_onPageSizeChange($event)">
134
- <hlm-select-trigger class="tw:w-[70px]" [size]="size() === 'sm' ? 'sm' : 'default'">
245
+ <span [id]="_pageSizeLabelId" class="tw:font-medium {{ _metaTextClass() }}">{{ _labels.rowsPerPage }}</span>
246
+ <!-- Also close an open overlay on disable. Null lets the select own its open state. -->
247
+ <div
248
+ hlmSelect
249
+ class="tw:inline-flex"
250
+ [formControl]="_pageSizeControl"
251
+ [state]="disabled() ? 'closed' : null"
252
+ >
253
+ <hlm-select-trigger
254
+ class="tw:w-[70px]"
255
+ [size]="size() === 'sm' ? 'sm' : 'default'"
256
+ [aria-labelledby]="_pageSizeLabelId"
257
+ >
135
258
  <hlm-select-value />
136
259
  </hlm-select-trigger>
137
260
  <hlm-select-content *hlmSelectPortal>
138
261
  @for (size of _pageSizeOptions(); track size) {
139
- <hlm-select-item [value]="size">{{ size }}</hlm-select-item>
262
+ <hlm-select-item [value]="size" [disabled]="disabled()">{{ size }}</hlm-select-item>
140
263
  }
141
264
  </hlm-select-content>
142
265
  </div>
143
266
  </div>
144
267
  }
145
268
  @if (_showPager()) {
146
- <div class="tw:flex tw:w-[100px] tw:items-center tw:justify-center tw:font-medium {{ _metaTextClass() }}">
147
- Page {{ _pageIndex() + 1 }} of {{ _pageCount() }}
269
+ <div
270
+ class="tw:flex tw:min-w-[100px] tw:items-center tw:justify-center tw:font-medium {{ _metaTextClass() }}"
271
+ aria-live="polite"
272
+ >
273
+ {{ _pageLabel() }}
148
274
  </div>
149
275
  <div class="tw:flex tw:items-center tw:gap-2">
150
- <button
151
- hlmButton
152
- variant="secondary"
153
- appearance="outline"
154
- size="sm"
155
- [class]="_edgeNavButtonClass()"
156
- type="button"
157
- [disabled]="!_canPrevious()"
158
- (click)="_table().setPageIndex(0)"
159
- aria-label="Go to first page"
160
- >
161
- @if (navMode() !== 'text') {
162
- <ng-icon hlm size="sm" name="lucideChevronsLeft" />
163
- }
164
- @if (navMode() !== 'icons') {
165
- <span>First</span>
166
- }
167
- </button>
276
+ @if (!_unknownTotal()) {
277
+ <button
278
+ hlmButton
279
+ variant="secondary"
280
+ appearance="outline"
281
+ size="sm"
282
+ [class]="_edgeNavButtonClass()"
283
+ type="button"
284
+ [disabled]="!_canPrevious()"
285
+ (click)="_navigate('firstPage')"
286
+ [attr.aria-label]="_labels.goToFirstPage"
287
+ >
288
+ @if (navMode() !== 'text') {
289
+ <ng-icon hlm size="sm" name="lucideChevronsLeft" />
290
+ }
291
+ @if (navMode() !== 'icons') {
292
+ <span>{{ _labels.firstPage }}</span>
293
+ }
294
+ </button>
295
+ }
168
296
  <button
169
297
  hlmButton
170
298
  variant="secondary"
@@ -173,14 +301,14 @@ class EgDataTablePagination {
173
301
  [class]="_navButtonClass()"
174
302
  type="button"
175
303
  [disabled]="!_canPrevious()"
176
- (click)="_table().previousPage()"
177
- aria-label="Go to previous page"
304
+ (click)="_navigate('previousPage')"
305
+ [attr.aria-label]="_labels.goToPreviousPage"
178
306
  >
179
307
  @if (navMode() !== 'text') {
180
308
  <ng-icon hlm size="sm" name="lucideChevronLeft" />
181
309
  }
182
310
  @if (navMode() !== 'icons') {
183
- <span>Previous</span>
311
+ <span>{{ _labels.previousPage }}</span>
184
312
  }
185
313
  </button>
186
314
  <button
@@ -191,45 +319,47 @@ class EgDataTablePagination {
191
319
  [class]="_navButtonClass()"
192
320
  type="button"
193
321
  [disabled]="!_canNext()"
194
- (click)="_table().nextPage()"
195
- aria-label="Go to next page"
322
+ (click)="_navigate('nextPage')"
323
+ [attr.aria-label]="_labels.goToNextPage"
196
324
  >
197
325
  @if (navMode() !== 'icons') {
198
- <span>Next</span>
326
+ <span>{{ _labels.nextPage }}</span>
199
327
  }
200
328
  @if (navMode() !== 'text') {
201
329
  <ng-icon hlm size="sm" name="lucideChevronRight" />
202
330
  }
203
331
  </button>
204
- <button
205
- hlmButton
206
- variant="secondary"
207
- appearance="outline"
208
- size="sm"
209
- [class]="_edgeNavButtonClass()"
210
- type="button"
211
- [disabled]="!_canNext()"
212
- (click)="_table().setPageIndex(_pageCount() - 1)"
213
- aria-label="Go to last page"
214
- >
215
- @if (navMode() !== 'icons') {
216
- <span>Last</span>
217
- }
218
- @if (navMode() !== 'text') {
219
- <ng-icon hlm size="sm" name="lucideChevronsRight" />
220
- }
221
- </button>
332
+ @if (!_unknownTotal()) {
333
+ <button
334
+ hlmButton
335
+ variant="secondary"
336
+ appearance="outline"
337
+ size="sm"
338
+ [class]="_edgeNavButtonClass()"
339
+ type="button"
340
+ [disabled]="!_canNext()"
341
+ (click)="_navigate('lastPage')"
342
+ [attr.aria-label]="_labels.goToLastPage"
343
+ >
344
+ @if (navMode() !== 'icons') {
345
+ <span>{{ _labels.lastPage }}</span>
346
+ }
347
+ @if (navMode() !== 'text') {
348
+ <ng-icon hlm size="sm" name="lucideChevronsRight" />
349
+ }
350
+ </button>
351
+ }
222
352
  </div>
223
353
  }
224
354
  </div>
225
355
  </div>
226
- `, isInline: true, dependencies: [{ kind: "component", type: HlmButton, selector: "button[hlmButton], a[hlmButton]", inputs: ["variant", "size", "appearance", "loading", "icon", "iconPosition", "class", "spinnerUserClass", "disabled", "type"] }, { kind: "directive", type: HlmIcon, selector: "ng-icon[hlm]", inputs: ["size"] }, { kind: "directive", type: i1.HlmSelect, selector: "[hlmSelect],hlm-select" }, { kind: "component", type: i1.HlmSelectContent, selector: "hlm-select-content", inputs: ["showScroll"] }, { kind: "component", type: i1.HlmSelectItem, selector: "hlm-select-item" }, { kind: "directive", type: i1.HlmSelectPortal, selector: "[hlmSelectPortal]" }, { kind: "component", type: i1.HlmSelectTrigger, selector: "hlm-select-trigger", inputs: ["class", "buttonId", "ariaDescribedby", "wrapperDisabled", "size", "forceInvalid"] }, { kind: "directive", type: i1.HlmSelectValue, selector: "[hlmSelectValue],hlm-select-value" }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
356
+ `, isInline: true, dependencies: [{ kind: "component", type: HlmButton, selector: "button[hlmButton], a[hlmButton]", inputs: ["variant", "size", "appearance", "loading", "icon", "iconPosition", "class", "spinnerUserClass", "disabled", "type"] }, { kind: "directive", type: HlmIcon, selector: "ng-icon[hlm]", inputs: ["size"] }, { kind: "directive", type: i1.HlmSelect, selector: "[hlmSelect],hlm-select" }, { kind: "component", type: i1.HlmSelectContent, selector: "hlm-select-content", inputs: ["showScroll"] }, { kind: "component", type: i1.HlmSelectItem, selector: "hlm-select-item" }, { kind: "directive", type: i1.HlmSelectPortal, selector: "[hlmSelectPortal]" }, { kind: "component", type: i1.HlmSelectTrigger, selector: "hlm-select-trigger", inputs: ["class", "buttonId", "aria-labelledby", "ariaDescribedby", "wrapperDisabled", "size", "forceInvalid"] }, { kind: "directive", type: i1.HlmSelectValue, selector: "[hlmSelectValue],hlm-select-value" }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
227
357
  }
228
358
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgDataTablePagination, decorators: [{
229
359
  type: Component,
230
360
  args: [{
231
361
  selector: 'eg-data-table-pagination',
232
- imports: [HlmButton, HlmIcon, HlmSelectImports, NgIcon],
362
+ imports: [HlmButton, HlmIcon, HlmSelectImports, NgIcon, ReactiveFormsModule],
233
363
  providers: [provideIcons({ lucideChevronLeft, lucideChevronRight, lucideChevronsLeft, lucideChevronsRight })],
234
364
  template: `
235
365
  <div class="tw:flex tw:flex-wrap tw:items-center tw:justify-between tw:gap-2 tw:px-2">
@@ -239,42 +369,57 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
239
369
  <div class="tw:flex tw:flex-wrap tw:items-center tw:gap-x-6 tw:gap-y-2 tw:lg:gap-x-8">
240
370
  @if (showPageSize()) {
241
371
  <div class="tw:flex tw:items-center tw:gap-2">
242
- <p class="tw:font-medium {{ _metaTextClass() }}">Rows per page</p>
243
- <div hlmSelect class="tw:inline-flex" [value]="_pageSize()" (valueChange)="_onPageSizeChange($event)">
244
- <hlm-select-trigger class="tw:w-[70px]" [size]="size() === 'sm' ? 'sm' : 'default'">
372
+ <span [id]="_pageSizeLabelId" class="tw:font-medium {{ _metaTextClass() }}">{{ _labels.rowsPerPage }}</span>
373
+ <!-- Also close an open overlay on disable. Null lets the select own its open state. -->
374
+ <div
375
+ hlmSelect
376
+ class="tw:inline-flex"
377
+ [formControl]="_pageSizeControl"
378
+ [state]="disabled() ? 'closed' : null"
379
+ >
380
+ <hlm-select-trigger
381
+ class="tw:w-[70px]"
382
+ [size]="size() === 'sm' ? 'sm' : 'default'"
383
+ [aria-labelledby]="_pageSizeLabelId"
384
+ >
245
385
  <hlm-select-value />
246
386
  </hlm-select-trigger>
247
387
  <hlm-select-content *hlmSelectPortal>
248
388
  @for (size of _pageSizeOptions(); track size) {
249
- <hlm-select-item [value]="size">{{ size }}</hlm-select-item>
389
+ <hlm-select-item [value]="size" [disabled]="disabled()">{{ size }}</hlm-select-item>
250
390
  }
251
391
  </hlm-select-content>
252
392
  </div>
253
393
  </div>
254
394
  }
255
395
  @if (_showPager()) {
256
- <div class="tw:flex tw:w-[100px] tw:items-center tw:justify-center tw:font-medium {{ _metaTextClass() }}">
257
- Page {{ _pageIndex() + 1 }} of {{ _pageCount() }}
396
+ <div
397
+ class="tw:flex tw:min-w-[100px] tw:items-center tw:justify-center tw:font-medium {{ _metaTextClass() }}"
398
+ aria-live="polite"
399
+ >
400
+ {{ _pageLabel() }}
258
401
  </div>
259
402
  <div class="tw:flex tw:items-center tw:gap-2">
260
- <button
261
- hlmButton
262
- variant="secondary"
263
- appearance="outline"
264
- size="sm"
265
- [class]="_edgeNavButtonClass()"
266
- type="button"
267
- [disabled]="!_canPrevious()"
268
- (click)="_table().setPageIndex(0)"
269
- aria-label="Go to first page"
270
- >
271
- @if (navMode() !== 'text') {
272
- <ng-icon hlm size="sm" name="lucideChevronsLeft" />
273
- }
274
- @if (navMode() !== 'icons') {
275
- <span>First</span>
276
- }
277
- </button>
403
+ @if (!_unknownTotal()) {
404
+ <button
405
+ hlmButton
406
+ variant="secondary"
407
+ appearance="outline"
408
+ size="sm"
409
+ [class]="_edgeNavButtonClass()"
410
+ type="button"
411
+ [disabled]="!_canPrevious()"
412
+ (click)="_navigate('firstPage')"
413
+ [attr.aria-label]="_labels.goToFirstPage"
414
+ >
415
+ @if (navMode() !== 'text') {
416
+ <ng-icon hlm size="sm" name="lucideChevronsLeft" />
417
+ }
418
+ @if (navMode() !== 'icons') {
419
+ <span>{{ _labels.firstPage }}</span>
420
+ }
421
+ </button>
422
+ }
278
423
  <button
279
424
  hlmButton
280
425
  variant="secondary"
@@ -283,14 +428,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
283
428
  [class]="_navButtonClass()"
284
429
  type="button"
285
430
  [disabled]="!_canPrevious()"
286
- (click)="_table().previousPage()"
287
- aria-label="Go to previous page"
431
+ (click)="_navigate('previousPage')"
432
+ [attr.aria-label]="_labels.goToPreviousPage"
288
433
  >
289
434
  @if (navMode() !== 'text') {
290
435
  <ng-icon hlm size="sm" name="lucideChevronLeft" />
291
436
  }
292
437
  @if (navMode() !== 'icons') {
293
- <span>Previous</span>
438
+ <span>{{ _labels.previousPage }}</span>
294
439
  }
295
440
  </button>
296
441
  <button
@@ -301,34 +446,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
301
446
  [class]="_navButtonClass()"
302
447
  type="button"
303
448
  [disabled]="!_canNext()"
304
- (click)="_table().nextPage()"
305
- aria-label="Go to next page"
449
+ (click)="_navigate('nextPage')"
450
+ [attr.aria-label]="_labels.goToNextPage"
306
451
  >
307
452
  @if (navMode() !== 'icons') {
308
- <span>Next</span>
453
+ <span>{{ _labels.nextPage }}</span>
309
454
  }
310
455
  @if (navMode() !== 'text') {
311
456
  <ng-icon hlm size="sm" name="lucideChevronRight" />
312
457
  }
313
458
  </button>
314
- <button
315
- hlmButton
316
- variant="secondary"
317
- appearance="outline"
318
- size="sm"
319
- [class]="_edgeNavButtonClass()"
320
- type="button"
321
- [disabled]="!_canNext()"
322
- (click)="_table().setPageIndex(_pageCount() - 1)"
323
- aria-label="Go to last page"
324
- >
325
- @if (navMode() !== 'icons') {
326
- <span>Last</span>
327
- }
328
- @if (navMode() !== 'text') {
329
- <ng-icon hlm size="sm" name="lucideChevronsRight" />
330
- }
331
- </button>
459
+ @if (!_unknownTotal()) {
460
+ <button
461
+ hlmButton
462
+ variant="secondary"
463
+ appearance="outline"
464
+ size="sm"
465
+ [class]="_edgeNavButtonClass()"
466
+ type="button"
467
+ [disabled]="!_canNext()"
468
+ (click)="_navigate('lastPage')"
469
+ [attr.aria-label]="_labels.goToLastPage"
470
+ >
471
+ @if (navMode() !== 'icons') {
472
+ <span>{{ _labels.lastPage }}</span>
473
+ }
474
+ @if (navMode() !== 'text') {
475
+ <ng-icon hlm size="sm" name="lucideChevronsRight" />
476
+ }
477
+ </button>
478
+ }
332
479
  </div>
333
480
  }
334
481
  </div>
@@ -336,26 +483,108 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
336
483
  `,
337
484
  changeDetection: ChangeDetectionStrategy.OnPush,
338
485
  }]
339
- }], propDecorators: { showStatus: [{ type: i0.Input, args: [{ isSignal: true, alias: "showStatus", required: false }] }], showPageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPageSize", required: false }] }], pageSizes: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSizes", required: false }] }], navMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "navMode", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
486
+ }], ctorParameters: () => [], propDecorators: { showStatus: [{ type: i0.Input, args: [{ isSignal: true, alias: "showStatus", required: false }] }], showPageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPageSize", required: false }] }], pageSizes: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSizes", required: false }] }], navMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "navMode", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], hasPrevious: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasPrevious", required: false }] }], hasNext: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasNext", required: false }] }] } });
487
+
488
+ /**
489
+ * Header selection checkbox: toggles all page rows.
490
+ *
491
+ * Generic over `TData` so the same component works with any table; the table
492
+ * instance is passed explicitly (no DI needed inside column definitions).
493
+ * `HlmCheckbox.checked` accepts `'indeterminate'`, so the tri-state is derived
494
+ * via `computed` instead of a separate input.
495
+ */
496
+ class EgTableHeadSelection {
497
+ table = input.required(/* @ts-ignore */
498
+ ...(ngDevMode ? [{ debugName: "table" }] : /* istanbul ignore next */ []));
499
+ ariaLabel = input(injectEgDataTableLabels().selectAll, /* @ts-ignore */
500
+ ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
501
+ _checked = computed(() => {
502
+ const table = this.table();
503
+ if (table.getIsAllPageRowsSelected())
504
+ return true;
505
+ if (table.getIsSomePageRowsSelected())
506
+ return 'indeterminate';
507
+ return false;
508
+ }, /* @ts-ignore */
509
+ ...(ngDevMode ? [{ debugName: "_checked" }] : /* istanbul ignore next */ []));
510
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgTableHeadSelection, deps: [], target: i0.ɵɵFactoryTarget.Component });
511
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.3", type: EgTableHeadSelection, isStandalone: true, selector: "eg-table-head-selection", inputs: { table: { classPropertyName: "table", publicName: "table", isSignal: true, isRequired: true, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "tw:flex" }, ngImport: i0, template: `
512
+ <hlm-checkbox
513
+ [aria-label]="ariaLabel()"
514
+ [checked]="_checked()"
515
+ (changed)="table().toggleAllPageRowsSelected($event)"
516
+ />
517
+ `, isInline: true, dependencies: [{ kind: "component", type: HlmCheckbox, selector: "hlm-checkbox", inputs: ["class", "id", "aria-label", "aria-labelledby", "aria-describedby", "checked", "name", "required", "disabled", "wrapperDisabled"], outputs: ["checkedChange", "changed"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
518
+ }
519
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgTableHeadSelection, decorators: [{
520
+ type: Component,
521
+ args: [{
522
+ selector: 'eg-table-head-selection',
523
+ imports: [HlmCheckbox],
524
+ host: { class: 'tw:flex' },
525
+ template: `
526
+ <hlm-checkbox
527
+ [aria-label]="ariaLabel()"
528
+ [checked]="_checked()"
529
+ (changed)="table().toggleAllPageRowsSelected($event)"
530
+ />
531
+ `,
532
+ changeDetection: ChangeDetectionStrategy.OnPush,
533
+ }]
534
+ }], propDecorators: { table: [{ type: i0.Input, args: [{ isSignal: true, alias: "table", required: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
535
+ /**
536
+ * Row selection checkbox: toggles a single row.
537
+ */
538
+ class EgTableRowSelection {
539
+ row = input.required(/* @ts-ignore */
540
+ ...(ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []));
541
+ ariaLabel = input(injectEgDataTableLabels().selectRow, /* @ts-ignore */
542
+ ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
543
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgTableRowSelection, deps: [], target: i0.ɵɵFactoryTarget.Component });
544
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.3", type: EgTableRowSelection, isStandalone: true, selector: "eg-table-row-selection", inputs: { row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "tw:flex" }, ngImport: i0, template: `
545
+ <hlm-checkbox
546
+ [aria-label]="ariaLabel()"
547
+ [checked]="row().getIsSelected()"
548
+ (changed)="row().toggleSelected($event)"
549
+ />
550
+ `, isInline: true, dependencies: [{ kind: "component", type: HlmCheckbox, selector: "hlm-checkbox", inputs: ["class", "id", "aria-label", "aria-labelledby", "aria-describedby", "checked", "name", "required", "disabled", "wrapperDisabled"], outputs: ["checkedChange", "changed"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
551
+ }
552
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgTableRowSelection, decorators: [{
553
+ type: Component,
554
+ args: [{
555
+ selector: 'eg-table-row-selection',
556
+ imports: [HlmCheckbox],
557
+ host: { class: 'tw:flex' },
558
+ template: `
559
+ <hlm-checkbox
560
+ [aria-label]="ariaLabel()"
561
+ [checked]="row().getIsSelected()"
562
+ (changed)="row().toggleSelected($event)"
563
+ />
564
+ `,
565
+ changeDetection: ChangeDetectionStrategy.OnPush,
566
+ }]
567
+ }], propDecorators: { row: [{ type: i0.Input, args: [{ isSignal: true, alias: "row", required: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
340
568
 
341
569
  /**
342
570
  * Column-visibility toggle.
343
571
  *
344
572
  * Reads the table from the nearest `[tanStackTable]` directive — no table
345
- * input or generics needed. Only columns with an `accessorFn` that can hide
346
- * are listed (display columns like `select` / `actions` stay fixed).
573
+ * input or generics needed. Data columns can hide; display columns can opt in.
347
574
  */
348
575
  class EgDataTableViewOptions {
349
576
  /** Density of the toggle button. */
350
577
  size = input('default', /* @ts-ignore */
351
578
  ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
579
+ _labels = injectEgDataTableLabels();
352
580
  _table = injectTableContext();
353
- /** Height per density; hidden below `lg` like the pager edge buttons. Merged by `hlmButton`. */
354
- _buttonClass = computed(() => hlm('tw:ml-auto tw:hidden tw:lg:flex', this.size() === 'sm' ? 'tw:h-7' : this.size() === 'lg' ? 'tw:h-9' : 'tw:h-8'), /* @ts-ignore */
581
+ _columnLabel = columnLabel;
582
+ /** Height per density. The restore control stays available at every viewport size. */
583
+ _buttonClass = computed(() => hlm('tw:ml-auto', this.size() === 'sm' ? 'tw:h-7' : this.size() === 'lg' ? 'tw:h-9' : 'tw:h-8'), /* @ts-ignore */
355
584
  ...(ngDevMode ? [{ debugName: "_buttonClass" }] : /* istanbul ignore next */ []));
356
585
  _hidableColumns = computed(() => this._table()
357
- .getAllColumns()
358
- .filter((column) => typeof column.accessorFn !== 'undefined' && column.getCanHide()), /* @ts-ignore */
586
+ .getAllLeafColumns()
587
+ .filter((column) => column.getCanHide() && (column.accessorFn || column.columnDef.enableHiding === true)), /* @ts-ignore */
359
588
  ...(ngDevMode ? [{ debugName: "_hidableColumns" }] : /* istanbul ignore next */ []));
360
589
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgDataTableViewOptions, deps: [], target: i0.ɵɵFactoryTarget.Component });
361
590
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgDataTableViewOptions, isStandalone: true, selector: "eg-data-table-view-options", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideIcons({ lucideSettings2 })], ngImport: i0, template: `
@@ -369,21 +598,16 @@ class EgDataTableViewOptions {
369
598
  [hlmDropdownMenuTrigger]="_menu"
370
599
  >
371
600
  <ng-icon hlm size="sm" name="lucideSettings2" />
372
- View
601
+ {{ _labels.view }}
373
602
  </button>
374
603
  <ng-template #_menu>
375
- <div hlmDropdownMenu class="tw:w-[150px]">
376
- <div hlmDropdownMenuLabel>Toggle columns</div>
604
+ <div hlmDropdownMenu class="tw:min-w-[150px]">
605
+ <div hlmDropdownMenuLabel>{{ _labels.toggleColumns }}</div>
377
606
  <div hlmDropdownMenuSeparator></div>
378
607
  @for (column of _hidableColumns(); track column.id) {
379
- <button
380
- hlmDropdownMenuCheckbox
381
- class="tw:capitalize"
382
- [checked]="column.getIsVisible()"
383
- (triggered)="column.toggleVisibility()"
384
- >
608
+ <button hlmDropdownMenuCheckbox [checked]="column.getIsVisible()" (triggered)="column.toggleVisibility()">
385
609
  <hlm-dropdown-menu-checkbox-indicator />
386
- {{ column.id }}
610
+ {{ _columnLabel(column) }}
387
611
  </button>
388
612
  }
389
613
  </div>
@@ -407,21 +631,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
407
631
  [hlmDropdownMenuTrigger]="_menu"
408
632
  >
409
633
  <ng-icon hlm size="sm" name="lucideSettings2" />
410
- View
634
+ {{ _labels.view }}
411
635
  </button>
412
636
  <ng-template #_menu>
413
- <div hlmDropdownMenu class="tw:w-[150px]">
414
- <div hlmDropdownMenuLabel>Toggle columns</div>
637
+ <div hlmDropdownMenu class="tw:min-w-[150px]">
638
+ <div hlmDropdownMenuLabel>{{ _labels.toggleColumns }}</div>
415
639
  <div hlmDropdownMenuSeparator></div>
416
640
  @for (column of _hidableColumns(); track column.id) {
417
- <button
418
- hlmDropdownMenuCheckbox
419
- class="tw:capitalize"
420
- [checked]="column.getIsVisible()"
421
- (triggered)="column.toggleVisibility()"
422
- >
641
+ <button hlmDropdownMenuCheckbox [checked]="column.getIsVisible()" (triggered)="column.toggleVisibility()">
423
642
  <hlm-dropdown-menu-checkbox-indicator />
424
- {{ column.id }}
643
+ {{ _columnLabel(column) }}
425
644
  </button>
426
645
  }
427
646
  </div>
@@ -431,93 +650,37 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
431
650
  }]
432
651
  }], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
433
652
 
434
- /**
435
- * Header selection checkbox: toggles all page rows.
436
- *
437
- * Generic over `TData` so the same component works with any table; the table
438
- * instance is passed explicitly (no DI needed inside column definitions).
439
- * `HlmCheckbox.checked` accepts `'indeterminate'`, so the tri-state is derived
440
- * via `computed` instead of a separate input.
441
- */
442
- class EgTableHeadSelection {
443
- table = input.required(/* @ts-ignore */
444
- ...(ngDevMode ? [{ debugName: "table" }] : /* istanbul ignore next */ []));
445
- ariaLabel = input('Select all', /* @ts-ignore */
446
- ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
447
- _checked = computed(() => {
448
- const table = this.table();
449
- if (table.getIsAllPageRowsSelected())
450
- return true;
451
- if (table.getIsSomePageRowsSelected())
452
- return 'indeterminate';
453
- return false;
454
- }, /* @ts-ignore */
455
- ...(ngDevMode ? [{ debugName: "_checked" }] : /* istanbul ignore next */ []));
456
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgTableHeadSelection, deps: [], target: i0.ɵɵFactoryTarget.Component });
457
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.3", type: EgTableHeadSelection, isStandalone: true, selector: "eg-table-head-selection", inputs: { table: { classPropertyName: "table", publicName: "table", isSignal: true, isRequired: true, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-label": "ariaLabel()" }, classAttribute: "tw:flex" }, ngImport: i0, template: ` <hlm-checkbox [checked]="_checked()" (changed)="table().toggleAllPageRowsSelected($event)" /> `, isInline: true, dependencies: [{ kind: "component", type: HlmCheckbox, selector: "hlm-checkbox", inputs: ["class", "id", "aria-label", "aria-labelledby", "aria-describedby", "checked", "name", "required", "disabled", "wrapperDisabled"], outputs: ["checkedChange", "changed"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
458
- }
459
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgTableHeadSelection, decorators: [{
460
- type: Component,
461
- args: [{
462
- selector: 'eg-table-head-selection',
463
- imports: [HlmCheckbox],
464
- host: { class: 'tw:flex', '[attr.aria-label]': 'ariaLabel()' },
465
- template: ` <hlm-checkbox [checked]="_checked()" (changed)="table().toggleAllPageRowsSelected($event)" /> `,
466
- changeDetection: ChangeDetectionStrategy.OnPush,
467
- }]
468
- }], propDecorators: { table: [{ type: i0.Input, args: [{ isSignal: true, alias: "table", required: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
469
- /**
470
- * Row selection checkbox: toggles a single row.
471
- */
472
- class EgTableRowSelection {
473
- row = input.required(/* @ts-ignore */
474
- ...(ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []));
475
- ariaLabel = input('Select row', /* @ts-ignore */
476
- ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
477
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgTableRowSelection, deps: [], target: i0.ɵɵFactoryTarget.Component });
478
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.3", type: EgTableRowSelection, isStandalone: true, selector: "eg-table-row-selection", inputs: { row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-label": "ariaLabel()" }, classAttribute: "tw:flex" }, ngImport: i0, template: ` <hlm-checkbox [checked]="row().getIsSelected()" (changed)="row().toggleSelected($event)" /> `, isInline: true, dependencies: [{ kind: "component", type: HlmCheckbox, selector: "hlm-checkbox", inputs: ["class", "id", "aria-label", "aria-labelledby", "aria-describedby", "checked", "name", "required", "disabled", "wrapperDisabled"], outputs: ["checkedChange", "changed"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
479
- }
480
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgTableRowSelection, decorators: [{
481
- type: Component,
482
- args: [{
483
- selector: 'eg-table-row-selection',
484
- imports: [HlmCheckbox],
485
- host: { class: 'tw:flex', '[attr.aria-label]': 'ariaLabel()' },
486
- template: ` <hlm-checkbox [checked]="row().getIsSelected()" (changed)="row().toggleSelected($event)" /> `,
487
- changeDetection: ChangeDetectionStrategy.OnPush,
488
- }]
489
- }], propDecorators: { row: [{ type: i0.Input, args: [{ isSignal: true, alias: "row", required: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
490
-
491
653
  /**
492
654
  * Generic data table with TanStack-powered sorting, filtering, pagination,
493
655
  * selection, column visibility, plus a React-parity grid layout.
494
656
  *
495
- * The caller passes `columns` (and optionally `gridColumns`) — everything else
496
- * is owned internally with change notifications via outputs:
657
+ * The caller supplies columns and rows, and can control sorting via `sorting`.
497
658
  *
498
659
  * - Client mode: pass `data` as an array. Pagination/sorting/filtering run in-browser.
499
660
  * `filterRows` can pre-filter the array before the built-in pipeline.
500
- * - Server mode: pass `data` as a page slice (`{items,total,limit,offset,hasPrevious,hasNext}`)
501
- * with `manualPagination` set. The slice renders as-is — sorting/filtering
502
- * are not applied client-side. Page, sort and filter interactions emit
503
- * `pageChange` / `pageSizeChange` / `sortingChange` / `filterChange`
504
- * (`columnFiltersChange`) so the caller can fetch the next slice.
661
+ * - Server mode: pass an `EgPaginatedResponse` or `EgUnknownTotalPage` with
662
+ * `manualPagination` set. The slice renders as-is. Handle `paginationChange`,
663
+ * `sortingChange`, and either `filterChange` or `columnFiltersChange` to fetch the next slice.
505
664
  * - Selection: set `enableSelection` to auto-prepend a checkbox column;
506
665
  * selected rows are emitted via `selectionChange` (array of `TData`).
507
- * - Grid mode: pass `gridColumns` to enable the layout toggle. Columns with
508
- * `meta: { hideInTable: true }` are table-hidden; `meta: { thumbnail: true }`
509
- * renders as the card banner.
666
+ * - Grid mode: pass `gridColumns` to enable the layout toggle, or `gridBreakpoint`
667
+ * to switch automatically. `meta.hideInTable` hides a column from the table;
668
+ * `meta.thumbnail` displays it as the card banner.
510
669
  */
511
670
  class EgDataTable {
671
+ _labels = injectEgDataTableLabels();
512
672
  /** Column definitions for table layout (required). */
513
673
  columns = input.required(/* @ts-ignore */
514
674
  ...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
515
- /** Column definitions for grid layout; falls back to `columns` when omitted. */
675
+ /** Column definitions for grid layout; falls back to `columns` when using the responsive layout. */
516
676
  gridColumns = input(/* @ts-ignore */
517
677
  ...(ngDevMode ? [undefined, { debugName: "gridColumns" }] : /* istanbul ignore next */ []));
518
678
  /** Client rows, or a server page slice when `manualPagination` is set (`null` while loading). */
519
679
  data = input([], /* @ts-ignore */
520
680
  ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
681
+ /** Reset table-owned state when the dataset changes. */
682
+ resetKey = input(/* @ts-ignore */
683
+ ...(ngDevMode ? [undefined, { debugName: "resetKey" }] : /* istanbul ignore next */ []));
521
684
  /**
522
685
  * Pure stable identity callback, e.g. `(record) => record.id`. Return a unique
523
686
  * string per entity, independent of position, and keep the callback reference stable.
@@ -531,13 +694,38 @@ class EgDataTable {
531
694
  /** When true, `data` is a server page slice and the table uses TanStack `manualPagination`. Sorting and filtering are then display-only: the slice is shown as-is while `sortingChange` / `filterChange` (`columnFiltersChange`) notify the caller to refetch. */
532
695
  manualPagination = input(false, /* @ts-ignore */
533
696
  ...(ngDevMode ? [{ debugName: "manualPagination" }] : /* istanbul ignore next */ []));
697
+ /** Show all client rows and omit the pager. Server mode takes precedence. */
698
+ paginate = input(true, /* @ts-ignore */
699
+ ...(ngDevMode ? [{ debugName: "paginate" }] : /* istanbul ignore next */ []));
700
+ /** Disable the built-in pager's controls, independently of loading. */
701
+ paginationDisabled = input(false, /* @ts-ignore */
702
+ ...(ngDevMode ? [{ debugName: "paginationDisabled" }] : /* istanbul ignore next */ []));
534
703
  /** TanStack feature registry. Defaults to filtering + visibility + pagination + selection + sorting. */
535
704
  features = input(defaultEgDataTableFeatures, /* @ts-ignore */
536
705
  ...(ngDevMode ? [{ debugName: "features" }] : /* istanbul ignore next */ []));
537
706
  isLoading = input(false, /* @ts-ignore */
538
707
  ...(ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []));
539
- emptyMessage = input('No results found.', /* @ts-ignore */
708
+ /** Keep the visible rows mounted during a refresh. */
709
+ keepRowsWhileLoading = input(false, /* @ts-ignore */
710
+ ...(ngDevMode ? [{ debugName: "keepRowsWhileLoading" }] : /* istanbul ignore next */ []));
711
+ loadingTemplate = input(/* @ts-ignore */
712
+ ...(ngDevMode ? [undefined, { debugName: "loadingTemplate" }] : /* istanbul ignore next */ []));
713
+ refreshingTemplate = input(/* @ts-ignore */
714
+ ...(ngDevMode ? [undefined, { debugName: "refreshingTemplate" }] : /* istanbul ignore next */ []));
715
+ emptyMessage = input(this._labels.emptyMessage, /* @ts-ignore */
540
716
  ...(ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []));
717
+ caption = input('', /* @ts-ignore */
718
+ ...(ngDevMode ? [{ debugName: "caption" }] : /* istanbul ignore next */ []));
719
+ /** Render string cell results as text. A column's `meta.renderAsText` can override this. */
720
+ renderAsText = input(false, /* @ts-ignore */
721
+ ...(ngDevMode ? [{ debugName: "renderAsText" }] : /* istanbul ignore next */ []));
722
+ striped = input(false, /* @ts-ignore */
723
+ ...(ngDevMode ? [{ debugName: "striped" }] : /* istanbul ignore next */ []));
724
+ wrapCells = input(false, /* @ts-ignore */
725
+ ...(ngDevMode ? [{ debugName: "wrapCells" }] : /* istanbul ignore next */ []));
726
+ /** Classes for a body row or a grid card. Use a stable, pure callback returning a clsx class value. */
727
+ rowClass = input(/* @ts-ignore */
728
+ ...(ngDevMode ? [undefined, { debugName: "rowClass" }] : /* istanbul ignore next */ []));
541
729
  /** When true, a checkbox column is auto-prepended and `selectionChange` emits the selected rows. */
542
730
  enableSelection = input(false, /* @ts-ignore */
543
731
  ...(ngDevMode ? [{ debugName: "enableSelection" }] : /* istanbul ignore next */ []));
@@ -549,18 +737,29 @@ class EgDataTable {
549
737
  /** Presentation mode. Two-way bindable: `[(layout)]`. Grid requires `gridColumns`. */
550
738
  layout = model('table', /* @ts-ignore */
551
739
  ...(ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []));
740
+ /** CSS media query for automatic grid layout. When set, it takes precedence over `layout`. */
741
+ gridBreakpoint = input(/* @ts-ignore */
742
+ ...(ngDevMode ? [undefined, { debugName: "gridBreakpoint" }] : /* istanbul ignore next */ []));
552
743
  /** Show the table/grid toggle (only rendered when `gridColumns` is set). */
553
744
  showLayoutToggle = input(true, /* @ts-ignore */
554
745
  ...(ngDevMode ? [{ debugName: "showLayoutToggle" }] : /* istanbul ignore next */ []));
555
- /** Show the toolbar (filter input, plus the column-visibility dropdown when `showColumnToggle` is set). */
746
+ /** Offer a sort-column selector and direction control in grid view. */
747
+ showGridSort = input(false, /* @ts-ignore */
748
+ ...(ngDevMode ? [{ debugName: "showGridSort" }] : /* istanbul ignore next */ []));
749
+ /** Replace the grid sort controls rendered by `showGridSort`. */
750
+ gridSortTemplate = input(/* @ts-ignore */
751
+ ...(ngDevMode ? [undefined, { debugName: "gridSortTemplate" }] : /* istanbul ignore next */ []));
752
+ /** Show the toolbar's filter input. */
556
753
  showToolbar = input(false, /* @ts-ignore */
557
754
  ...(ngDevMode ? [{ debugName: "showToolbar" }] : /* istanbul ignore next */ []));
558
755
  /** Column id the toolbar filter input writes to (e.g. `'email'`). Empty means client-side filtering is skipped and keystrokes only emit `filterChange` (server-side pattern). */
559
756
  filterColumnId = input('', /* @ts-ignore */
560
757
  ...(ngDevMode ? [{ debugName: "filterColumnId" }] : /* istanbul ignore next */ []));
561
- filterPlaceholder = input('Filter...', /* @ts-ignore */
758
+ filterLabel = input(this._labels.filterLabel, /* @ts-ignore */
759
+ ...(ngDevMode ? [{ debugName: "filterLabel" }] : /* istanbul ignore next */ []));
760
+ filterPlaceholder = input(this._labels.filterPlaceholder, /* @ts-ignore */
562
761
  ...(ngDevMode ? [{ debugName: "filterPlaceholder" }] : /* istanbul ignore next */ []));
563
- /** Show the column-visibility dropdown inside the toolbar (requires `showToolbar`). Off by default; opt in per table. Also enables hiding — the `Hide` item in `EgDataTableColumnHeader` only renders when this is true, so hidden columns always have a way back. Per-column `enableHiding: false` further disables individual columns. */
762
+ /** Show the View dropdown and enable column hiding, independently of `showToolbar`. */
564
763
  showColumnToggle = input(false, /* @ts-ignore */
565
764
  ...(ngDevMode ? [{ debugName: "showColumnToggle" }] : /* istanbul ignore next */ []));
566
765
  /** Custom right-side toolbar content (e.g. action buttons) as a template. Renders the toolbar row even when `showToolbar` is false; built-ins stay on the left. */
@@ -569,16 +768,25 @@ class EgDataTable {
569
768
  /** Default client-side page size. Changing it later resets the pager to the new size. */
570
769
  defaultPageSize = input(10, /* @ts-ignore */
571
770
  ...(ngDevMode ? [{ debugName: "defaultPageSize" }] : /* istanbul ignore next */ []));
771
+ /** Keep the page on client data refreshes, clamping to the last page. Sorting and filtering still reset to page 1. */
772
+ preservePageOnDataChange = input(false, /* @ts-ignore */
773
+ ...(ngDevMode ? [{ debugName: "preservePageOnDataChange" }] : /* istanbul ignore next */ []));
774
+ /** Start at the first page when the user selects a different page size. */
775
+ resetPageOnSizeChange = input(false, /* @ts-ignore */
776
+ ...(ngDevMode ? [{ debugName: "resetPageOnSizeChange" }] : /* istanbul ignore next */ []));
572
777
  /** Caller-provided frontend filter: receives all client rows, returns the kept rows. Runs before built-in filtering/sorting/pagination; ignored in server mode. Must be pure. */
573
778
  filterRows = input(null, /* @ts-ignore */
574
779
  ...(ngDevMode ? [{ debugName: "filterRows" }] : /* istanbul ignore next */ []));
575
- /** Seeds the sorting state once at creation. Later changes are ignored — use `sortingChange` to stay in sync. */
780
+ /** Default uncontrolled sorting, applied at creation and on a dataset reset. */
576
781
  initialSorting = input([], /* @ts-ignore */
577
782
  ...(ngDevMode ? [{ debugName: "initialSorting" }] : /* istanbul ignore next */ []));
578
- /** Seeds the column-filter state once at creation. Later changes are ignored. */
783
+ /** Controlled sorting. When supplied, apply `sortingChange` to accept the proposed sort. */
784
+ sorting = input(/* @ts-ignore */
785
+ ...(ngDevMode ? [undefined, { debugName: "sorting" }] : /* istanbul ignore next */ []));
786
+ /** Default column filters, applied at creation and on a dataset reset. */
579
787
  initialColumnFilters = input([], /* @ts-ignore */
580
788
  ...(ngDevMode ? [{ debugName: "initialColumnFilters" }] : /* istanbul ignore next */ []));
581
- /** Seeds the column-visibility state once at creation. Later changes are ignored. */
789
+ /** Default column visibility, applied at creation and on a dataset reset. */
582
790
  initialColumnVisibility = input({}, /* @ts-ignore */
583
791
  ...(ngDevMode ? [{ debugName: "initialColumnVisibility" }] : /* istanbul ignore next */ []));
584
792
  /** Seeds selection once for current rows: keys come from `getRowId`, or positional indices without it. Missing IDs are discarded. Later changes are ignored. */
@@ -596,9 +804,11 @@ class EgDataTable {
596
804
  userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
597
805
  /** Emits on init and when selected row identities/order or object references change. Includes rows hidden by built-in filters/client pagination, but never rows absent from `data`/`filterRows`. */
598
806
  selectionChange = output();
599
- /** Emits the target page index on pager navigation (primary hook for server fetching). */
807
+ /** Legacy page-index output. With page retention, automatic adjustments emit only `paginationChange`. */
600
808
  pageChange = output();
601
809
  pageSizeChange = output();
810
+ /** Emits both zero-based page index and page size once per pagination change. */
811
+ paginationChange = output();
602
812
  /** Emits the row's data when a row (table) or card (grid) is clicked. Clicks from nested interactive elements (buttons, links, inputs, checkboxes, selects) are ignored. */
603
813
  rowClick = output();
604
814
  sortingChange = output();
@@ -608,43 +818,56 @@ class EgDataTable {
608
818
  columnVisibilityChange = output();
609
819
  _containerClass = computed(() => hlm('tw:space-y-2', this.userClass()), /* @ts-ignore */
610
820
  ...(ngDevMode ? [{ debugName: "_containerClass" }] : /* istanbul ignore next */ []));
821
+ _bodyClass = computed(() => this.striped() ? 'tw:[&>tr:nth-child(even):not([data-state=selected]):not(:hover)]:bg-muted' : '', /* @ts-ignore */
822
+ ...(ngDevMode ? [{ debugName: "_bodyClass" }] : /* istanbul ignore next */ []));
823
+ _columnLabel = columnLabel;
824
+ _gridSortLabelId = inject(_IdGenerator).getId('eg-data-table-grid-sort-');
611
825
  /** Inline TH sort-button footprint per density. Merged by `hlmButton` via the `class` binding. */
612
826
  _sortButtonClass = computed(() => hlm('tw:p-0', this.size() === 'sm' ? 'tw:h-5 tw:w-5' : this.size() === 'lg' ? 'tw:h-7 tw:w-7' : 'tw:h-6 tw:w-6'), /* @ts-ignore */
613
827
  ...(ngDevMode ? [{ debugName: "_sortButtonClass" }] : /* istanbul ignore next */ []));
614
- _sorting = signal([], /* @ts-ignore */
828
+ _localSorting = signal([], /* @ts-ignore */
829
+ ...(ngDevMode ? [{ debugName: "_localSorting" }] : /* istanbul ignore next */ []));
830
+ _sorting = computed(() => this.sorting() ?? this._localSorting(), /* @ts-ignore */
615
831
  ...(ngDevMode ? [{ debugName: "_sorting" }] : /* istanbul ignore next */ []));
616
832
  _columnFilters = signal([], /* @ts-ignore */
617
833
  ...(ngDevMode ? [{ debugName: "_columnFilters" }] : /* istanbul ignore next */ []));
834
+ _filterControl = new FormControl('', { nonNullable: true });
618
835
  _columnVisibility = signal({}, /* @ts-ignore */
619
836
  ...(ngDevMode ? [{ debugName: "_columnVisibility" }] : /* istanbul ignore next */ []));
620
- _clientPageIndex = signal(0, /* @ts-ignore */
621
- ...(ngDevMode ? [{ debugName: "_clientPageIndex" }] : /* istanbul ignore next */ []));
837
+ _clientPageIndex = linkedSignal({ ...(ngDevMode ? { debugName: "_clientPageIndex" } : /* istanbul ignore next */ {}), source: this.paginate, computation: () => 0 });
622
838
  // Linked so the bound `defaultPageSize` applies once inputs are set, while
623
839
  // pager-driven `set()` writes below are preserved until it changes again.
624
840
  _clientPageSize = linkedSignal(() => this.defaultPageSize(), /* @ts-ignore */
625
841
  ...(ngDevMode ? [{ debugName: "_clientPageSize" }] : /* istanbul ignore next */ []));
842
+ _paginationDefaults = signal(undefined, /* @ts-ignore */
843
+ ...(ngDevMode ? [{ debugName: "_paginationDefaults" }] : /* istanbul ignore next */ []));
626
844
  _isServer = computed(() => this.manualPagination(), /* @ts-ignore */
627
845
  ...(ngDevMode ? [{ debugName: "_isServer" }] : /* istanbul ignore next */ []));
846
+ _unpaginated = computed(() => !this._isServer() && !this.paginate(), /* @ts-ignore */
847
+ ...(ngDevMode ? [{ debugName: "_unpaginated" }] : /* istanbul ignore next */ []));
848
+ _responsiveReady = signal(false, /* @ts-ignore */
849
+ ...(ngDevMode ? [{ debugName: "_responsiveReady" }] : /* istanbul ignore next */ []));
850
+ _gridQuery = computed(() => this.gridBreakpoint()?.trim() || '', /* @ts-ignore */
851
+ ...(ngDevMode ? [{ debugName: "_gridQuery" }] : /* istanbul ignore next */ []));
852
+ _breakpointObserver = inject(BreakpointObserver);
853
+ _compact = toSignal(toObservable(computed(() => (this._responsiveReady() ? this._gridQuery() : ''))).pipe(switchMap((query) => query ? this._breakpointObserver.observe(query).pipe(map(({ matches }) => matches)) : of(false))), { initialValue: false });
628
854
  /** The server page slice when in server mode; `null` for client data, misuse shapes, or `null` while loading. */
629
855
  _page = computed(() => {
630
856
  if (!this._isServer())
631
857
  return null;
632
858
  const data = this.data();
633
- if (data !== null && typeof data === 'object' && 'items' in data) {
634
- return data;
635
- }
636
- return null;
859
+ return data && 'items' in data ? data : null;
637
860
  }, /* @ts-ignore */
638
861
  ...(ngDevMode ? [{ debugName: "_page" }] : /* istanbul ignore next */ []));
862
+ _hasToolbarControls = computed(() => this.showToolbar() || this.showColumnToggle(), /* @ts-ignore */
863
+ ...(ngDevMode ? [{ debugName: "_hasToolbarControls" }] : /* istanbul ignore next */ []));
639
864
  _items = computed(() => {
640
865
  const page = this._page();
641
866
  if (page)
642
867
  return page.items;
643
868
  const data = this.data();
644
- const rows = Array.isArray(data)
645
- ? data
646
- : (data?.items ?? []);
647
- const filter = this.filterRows();
869
+ const rows = data && 'items' in data ? data.items : (data ?? []);
870
+ const filter = this._isServer() ? null : this.filterRows();
648
871
  return filter ? filter(rows) : rows;
649
872
  }, /* @ts-ignore */
650
873
  ...(ngDevMode ? [{ debugName: "_items" }] : /* istanbul ignore next */ []));
@@ -659,9 +882,11 @@ class EgDataTable {
659
882
  // Reconcile synchronously with the data source, before either TanStack or the
660
883
  // output can observe old positional keys against new records. An effect-based
661
884
  // reset would permit a transient wrong-entity selection.
662
- _rowSelection = linkedSignal({ ...(ngDevMode ? { debugName: "_rowSelection" } : /* istanbul ignore next */ {}), source: () => ({ items: this._items(), getRowId: this.getRowId() }),
885
+ _rowSelection = linkedSignal({ ...(ngDevMode ? { debugName: "_rowSelection" } : /* istanbul ignore next */ {}), source: () => ({ items: this._items(), getRowId: this.getRowId(), resetKey: this.resetKey() }),
663
886
  computation: (source, previous) => {
664
- if (!previous || source.getRowId !== previous.source.getRowId)
887
+ if (!previous ||
888
+ source.getRowId !== previous.source.getRowId ||
889
+ !Object.is(source.resetKey, previous.source.resetKey))
665
890
  return {};
666
891
  if (!source.getRowId && source.items !== previous.source.items)
667
892
  return {};
@@ -676,7 +901,11 @@ class EgDataTable {
676
901
  }
677
902
  _serverPageCount = computed(() => {
678
903
  const paginated = this._page();
679
- if (!paginated || paginated.limit <= 0)
904
+ if (!paginated)
905
+ return 1;
906
+ if (!('total' in paginated))
907
+ return -1;
908
+ if (paginated.limit <= 0)
680
909
  return 1;
681
910
  return Math.max(1, Math.ceil(paginated.total / paginated.limit));
682
911
  }, /* @ts-ignore */
@@ -685,7 +914,7 @@ class EgDataTable {
685
914
  const paginated = this._page();
686
915
  if (!paginated || paginated.limit <= 0)
687
916
  return 0;
688
- return Math.floor(paginated.offset / paginated.limit);
917
+ return 'total' in paginated ? Math.floor(paginated.offset / paginated.limit) : paginated.pageIndex;
689
918
  }, /* @ts-ignore */
690
919
  ...(ngDevMode ? [{ debugName: "_serverPageIndex" }] : /* istanbul ignore next */ []));
691
920
  _paginationState = computed(() => {
@@ -695,13 +924,46 @@ class EgDataTable {
695
924
  return { pageIndex: this._clientPageIndex(), pageSize: this._clientPageSize() };
696
925
  }, /* @ts-ignore */
697
926
  ...(ngDevMode ? [{ debugName: "_paginationState" }] : /* istanbul ignore next */ []));
927
+ _setPagination(next, reason, notifyLegacy = true) {
928
+ const current = this._paginationState();
929
+ const pageChanged = next.pageIndex !== current.pageIndex;
930
+ const sizeChanged = next.pageSize !== current.pageSize;
931
+ if (!pageChanged && !sizeChanged)
932
+ return;
933
+ if (!this._isServer()) {
934
+ this._clientPageIndex.set(next.pageIndex);
935
+ this._clientPageSize.set(next.pageSize);
936
+ }
937
+ this.paginationChange.emit({ ...next, reason: reason ?? (sizeChanged ? 'pageSize' : 'page') });
938
+ if (!notifyLegacy)
939
+ return;
940
+ if (pageChanged)
941
+ this.pageChange.emit(next.pageIndex);
942
+ if (sizeChanged)
943
+ this.pageSizeChange.emit(next.pageSize);
944
+ }
945
+ /** Reset to page 1 without changing page size, or request page 1 in server mode. */
946
+ resetPagination() {
947
+ if (!this._unpaginated())
948
+ this._setPagination({ ...this._paginationState(), pageIndex: 0 }, 'reset');
949
+ }
698
950
  _selectionHelper = computed(() => createColumnHelper(), /* @ts-ignore */
699
951
  ...(ngDevMode ? [{ debugName: "_selectionHelper" }] : /* istanbul ignore next */ []));
952
+ _withDisplayColumnDefaults(columns) {
953
+ return columns.map((column) => {
954
+ if ('columns' in column && column.columns) {
955
+ return { ...column, columns: this._withDisplayColumnDefaults(column.columns) };
956
+ }
957
+ if ('accessorFn' in column || 'accessorKey' in column || column.enableHiding !== undefined)
958
+ return column;
959
+ return { ...column, enableHiding: false };
960
+ });
961
+ }
700
962
  /** Caller columns + auto-injected selection column + layout filtering. */
701
963
  _finalColumns = computed(() => {
702
964
  const isGrid = this._effectiveLayout() === 'grid';
703
965
  const base = isGrid ? (this.gridColumns() ?? this.columns()) : this.columns();
704
- const visible = isGrid ? base : base.filter((column) => column.meta?.hideInTable !== true);
966
+ const visible = this._withDisplayColumnDefaults(isGrid ? base : base.filter((column) => column.meta?.hideInTable !== true));
705
967
  if (!this.enableSelection())
706
968
  return [...visible];
707
969
  const helper = this._selectionHelper();
@@ -717,6 +979,7 @@ class EgDataTable {
717
979
  ...(ngDevMode ? [{ debugName: "_finalColumns" }] : /* istanbul ignore next */ []));
718
980
  _table = injectTable(() => {
719
981
  const server = this._isServer();
982
+ const paginationDefaults = this._paginationDefaults();
720
983
  return {
721
984
  features: this.features(),
722
985
  columns: this._finalColumns(),
@@ -726,10 +989,19 @@ class EgDataTable {
726
989
  // This drives `column.getCanHide()` for both `EgDataTableColumnHeader`
727
990
  // (Hide item) and `EgDataTableViewOptions` (toggle list).
728
991
  enableHiding: this.showColumnToggle(),
729
- manualPagination: server,
992
+ manualPagination: server || this._unpaginated(),
730
993
  manualSorting: server,
731
994
  manualFiltering: server,
732
- ...(server ? { pageCount: this._serverPageCount() } : {}),
995
+ ...(server
996
+ ? { pageCount: this._serverPageCount() }
997
+ : paginationDefaults
998
+ ? { pageCount: paginationDefaults.pageCount }
999
+ : {}),
1000
+ ...(paginationDefaults
1001
+ ? {
1002
+ autoResetPageIndex: this.preservePageOnDataChange() && !server ? false : paginationDefaults.autoResetPageIndex,
1003
+ }
1004
+ : {}),
733
1005
  state: {
734
1006
  sorting: this._sorting(),
735
1007
  columnFilters: this._columnFilters(),
@@ -739,18 +1011,20 @@ class EgDataTable {
739
1011
  },
740
1012
  onSortingChange: (updater) => {
741
1013
  const next = typeof updater === 'function' ? updater(this._sorting()) : updater;
742
- this._sorting.set(next);
1014
+ if (this.sorting() === undefined)
1015
+ this._localSorting.set(next);
743
1016
  this.sortingChange.emit(next);
744
1017
  },
745
1018
  onColumnFiltersChange: (updater) => {
746
1019
  const next = typeof updater === 'function' ? updater(this._columnFilters()) : updater;
747
1020
  this._columnFilters.set(next);
748
- this.columnFiltersChange.emit(next);
749
- const filterId = this.filterColumnId();
750
- if (filterId) {
751
- const value = next.find((filter) => filter.id === filterId)?.value;
752
- this.filterChange.emit(typeof value === 'string' ? value : '');
1021
+ const text = this.filterColumnId() ? this._columnFilterText(next) : undefined;
1022
+ if (text !== undefined && text !== this._filterControl.value) {
1023
+ this._filterControl.setValue(text, { emitEvent: false });
753
1024
  }
1025
+ this.columnFiltersChange.emit(next);
1026
+ if (text !== undefined)
1027
+ this.filterChange.emit(text);
754
1028
  },
755
1029
  onColumnVisibilityChange: (updater) => {
756
1030
  const next = typeof updater === 'function' ? updater(this._columnVisibility()) : updater;
@@ -764,17 +1038,32 @@ class EgDataTable {
764
1038
  onPaginationChange: (updater) => {
765
1039
  const current = this._paginationState();
766
1040
  const next = typeof updater === 'function' ? updater(current) : updater;
767
- if (next.pageIndex !== current.pageIndex)
768
- this.pageChange.emit(next.pageIndex);
769
- if (next.pageSize !== current.pageSize)
770
- this.pageSizeChange.emit(next.pageSize);
771
- if (!this._isServer()) {
772
- this._clientPageIndex.set(next.pageIndex);
773
- this._clientPageSize.set(next.pageSize);
774
- }
1041
+ const reset = this.resetPageOnSizeChange() && next.pageSize !== current.pageSize;
1042
+ this._setPagination(reset ? { ...next, pageIndex: 0 } : next);
775
1043
  },
776
1044
  };
777
1045
  });
1046
+ _previousPageQuery;
1047
+ _reconcilePage = effect(() => {
1048
+ if (!this.preservePageOnDataChange() || this._isServer() || this._unpaginated()) {
1049
+ this._previousPageQuery = undefined;
1050
+ return;
1051
+ }
1052
+ const sorting = this._sorting();
1053
+ const filters = this._columnFilters();
1054
+ const filterRows = this.filterRows();
1055
+ const previous = this._previousPageQuery;
1056
+ this._previousPageQuery = { sorting, filters, filterRows };
1057
+ const reset = previous && (previous.sorting !== sorting || previous.filters !== filters || previous.filterRows !== filterRows);
1058
+ const lastPageIndex = Math.max(0, this._table.getPageCount() - 1);
1059
+ untracked(() => {
1060
+ const state = this._paginationState();
1061
+ const pageIndex = reset ? 0 : Math.min(state.pageIndex, lastPageIndex);
1062
+ // This is reconciliation, not a request from the pager.
1063
+ this._setPagination({ ...state, pageIndex }, reset ? 'reset' : 'data', false);
1064
+ });
1065
+ }, /* @ts-ignore */
1066
+ ...(ngDevMode ? [{ debugName: "_reconcilePage" }] : /* istanbul ignore next */ []));
778
1067
  _selectedRows = computed(() => this._table.getSelectedRowModel().rows.map((row) => row.original), { ...(ngDevMode ? { debugName: "_selectedRows" } : /* istanbul ignore next */ {}), equal: (a, b) => a.length === b.length && a.every((row, index) => row === b[index]) });
779
1068
  _emitSelection = effect(() => {
780
1069
  const selected = this._selectedRows();
@@ -789,17 +1078,82 @@ class EgDataTable {
789
1078
  * interaction afterwards. Values are copied to avoid aliasing caller data.
790
1079
  */
791
1080
  ngOnInit() {
792
- this._sorting.set([...this.initialSorting()]);
1081
+ this._localSorting.set([...this.initialSorting()]);
793
1082
  this._columnFilters.set([...this.initialColumnFilters()]);
1083
+ this._filterControl.setValue(this._columnFilterText(this._columnFilters()), { emitEvent: false });
794
1084
  this._columnVisibility.set({ ...this.initialColumnVisibility() });
795
1085
  this._rowSelection.set(this._keepCurrentSelection(this.initialRowSelection()));
1086
+ // Preserve feature-provided defaults when the table has no override.
1087
+ const { autoResetPageIndex, pageCount } = this._table.options;
1088
+ this._paginationDefaults.set({ autoResetPageIndex, pageCount: this._isServer() ? undefined : pageCount });
1089
+ }
1090
+ ngOnChanges(changes) {
1091
+ // Let ngOnInit seed the first dataset before handling later changes.
1092
+ if (!this._paginationDefaults())
1093
+ return;
1094
+ const key = changes['resetKey'];
1095
+ if (!key || Object.is(key.previousValue, key.currentValue)) {
1096
+ if (changes['filterColumnId']) {
1097
+ this._filterControl.setValue(this._columnFilterText(this._columnFilters()), { emitEvent: false });
1098
+ }
1099
+ return;
1100
+ }
1101
+ const previousFilters = this._columnFilters();
1102
+ const previousText = this._filterControl.value;
1103
+ const filters = [...this.initialColumnFilters()];
1104
+ const filtersChanged = previousFilters.length !== filters.length ||
1105
+ previousFilters.some((filter, index) => filter.id !== filters[index].id || !Object.is(filter.value, filters[index].value));
1106
+ this._localSorting.set([...this.initialSorting()]);
1107
+ if (filtersChanged)
1108
+ this._columnFilters.set(filters);
1109
+ this._columnVisibility.set({ ...this.initialColumnVisibility() });
1110
+ this._clientPageIndex.set(0);
1111
+ this._clientPageSize.set(this.defaultPageSize());
1112
+ const text = this._columnFilterText(filters);
1113
+ this._filterControl.setValue(text, { emitEvent: false });
1114
+ if (filtersChanged)
1115
+ this.columnFiltersChange.emit(filters);
1116
+ if (previousText !== text)
1117
+ this.filterChange.emit(text);
1118
+ }
1119
+ constructor() {
1120
+ this._filterControl.valueChanges.pipe(takeUntilDestroyed()).subscribe((value) => this._onFilterInput(value));
1121
+ afterNextRender(() => this._responsiveReady.set(true));
796
1122
  }
797
1123
  _hasGrid = computed(() => this.gridColumns() !== undefined, /* @ts-ignore */
798
1124
  ...(ngDevMode ? [{ debugName: "_hasGrid" }] : /* istanbul ignore next */ []));
799
- _effectiveLayout = computed(() => this.layout() === 'grid' && this._hasGrid() ? 'grid' : 'table', /* @ts-ignore */
1125
+ _effectiveLayout = computed(() => {
1126
+ if (this._gridQuery())
1127
+ return this._compact() ? 'grid' : 'table';
1128
+ return this.layout() === 'grid' && this._hasGrid() ? 'grid' : 'table';
1129
+ }, /* @ts-ignore */
800
1130
  ...(ngDevMode ? [{ debugName: "_effectiveLayout" }] : /* istanbul ignore next */ []));
801
- _showLayoutToggle = computed(() => this.showLayoutToggle() && this._hasGrid(), /* @ts-ignore */
1131
+ _showLayoutToggle = computed(() => this.showLayoutToggle() && !this._gridQuery() && this._hasGrid(), /* @ts-ignore */
802
1132
  ...(ngDevMode ? [{ debugName: "_showLayoutToggle" }] : /* istanbul ignore next */ []));
1133
+ _gridSortableColumns = computed(() => this._effectiveLayout() === 'grid' && this.showGridSort()
1134
+ ? this._table.getAllLeafColumns().filter((column) => column.getCanSort())
1135
+ : [], /* @ts-ignore */
1136
+ ...(ngDevMode ? [{ debugName: "_gridSortableColumns" }] : /* istanbul ignore next */ []));
1137
+ _gridSortOptions = computed(() => this._gridSortableColumns().map((column) => ({ id: column.id, label: columnLabel(column) })), /* @ts-ignore */
1138
+ ...(ngDevMode ? [{ debugName: "_gridSortOptions" }] : /* istanbul ignore next */ []));
1139
+ _gridSortColumn = computed(() => this._gridSortableColumns().find((column) => column.id === this._sorting()[0]?.id), /* @ts-ignore */
1140
+ ...(ngDevMode ? [{ debugName: "_gridSortColumn" }] : /* istanbul ignore next */ []));
1141
+ _gridSortLabel = (id) => this._gridSortOptions().find((option) => option.id === id)?.label ?? this._labels.sortBy;
1142
+ _gridSortControl = createControlledSelect(() => this._gridSortColumn()?.id ?? null, (id) => {
1143
+ const column = this._gridSortableColumns().find((column) => column.id === id);
1144
+ column?.toggleSorting(false, false);
1145
+ });
1146
+ _showGridSorting = computed(() => this._gridSortOptions().length > 0, /* @ts-ignore */
1147
+ ...(ngDevMode ? [{ debugName: "_showGridSorting" }] : /* istanbul ignore next */ []));
1148
+ _setGridSorting = (sorting) => this._table.setSorting(sorting);
1149
+ _gridSortContext = computed(() => ({
1150
+ options: this._gridSortOptions(),
1151
+ sorting: this._sorting(),
1152
+ setSorting: this._setGridSorting,
1153
+ }), /* @ts-ignore */
1154
+ ...(ngDevMode ? [{ debugName: "_gridSortContext" }] : /* istanbul ignore next */ []));
1155
+ _showLoadingState = computed(() => this.isLoading() && (!this.keepRowsWhileLoading() || this._table.getRowModel().rows.length === 0), /* @ts-ignore */
1156
+ ...(ngDevMode ? [{ debugName: "_showLoadingState" }] : /* istanbul ignore next */ []));
803
1157
  _visibleColumnCount = computed(() => {
804
1158
  const count = this._table.getVisibleLeafColumns().length;
805
1159
  return count > 0 ? count : 1;
@@ -810,30 +1164,35 @@ class EgDataTable {
810
1164
  const table = this._table;
811
1165
  const selected = table.getFilteredSelectedRowModel().rows.length;
812
1166
  if (this.enableSelection() && selected > 0) {
813
- const total = paginated ? paginated.total : table.getFilteredRowModel().rows.length;
814
- return `${selected} of ${total} row(s) selected`;
1167
+ const total = paginated && 'total' in paginated ? paginated.total : table.getFilteredRowModel().rows.length;
1168
+ return this._labels.selectedRows(selected, total);
815
1169
  }
816
- if (paginated) {
1170
+ if (paginated && 'total' in paginated) {
817
1171
  const from = paginated.items.length === 0 ? 0 : paginated.offset + 1;
818
- const to = paginated.offset + paginated.items.length;
819
- return `Showing ${from} to ${to} of ${paginated.total} records`;
1172
+ const to = paginated.items.length === 0 ? 0 : paginated.offset + paginated.items.length;
1173
+ return this._labels.rowRange(from, to, paginated.total);
820
1174
  }
821
1175
  const total = table.getFilteredRowModel().rows.length;
822
- return `${total} row(s).`;
1176
+ return this._labels.rowCount(total, paginated !== null);
823
1177
  }, /* @ts-ignore */
824
1178
  ...(ngDevMode ? [{ debugName: "_statusText" }] : /* istanbul ignore next */ []));
825
1179
  _onLayoutToggle(value) {
826
1180
  if (value === 'table' || value === 'grid')
827
1181
  this.layout.set(value);
828
1182
  }
829
- _onFilterInput(event) {
830
- const value = event.target.value;
1183
+ _onFilterInput(value) {
831
1184
  const id = this.filterColumnId();
832
- if (!id) {
1185
+ const column = id ? this._table.getColumn(id) : undefined;
1186
+ if (!column) {
833
1187
  this.filterChange.emit(value);
834
1188
  return;
835
1189
  }
836
- this._table.getColumn(id)?.setFilterValue(value);
1190
+ column.setFilterValue(value);
1191
+ }
1192
+ _columnFilterText(filters) {
1193
+ const id = this.filterColumnId();
1194
+ const value = id ? filters.find((filter) => filter.id === id)?.value : undefined;
1195
+ return typeof value === 'string' ? value : '';
837
1196
  }
838
1197
  /**
839
1198
  * Row/card click handler. Ignores clicks originating from nested interactive
@@ -854,6 +1213,25 @@ class EgDataTable {
854
1213
  _toggleHeaderSorting(header) {
855
1214
  header.column.toggleSorting(header.column.getIsSorted() === 'asc');
856
1215
  }
1216
+ _ariaSort(header) {
1217
+ // ARIA expects aria-sort on only one header; announce the primary sort.
1218
+ const first = this._sorting()[0];
1219
+ if (!first || header.isPlaceholder || first.id !== header.column.id)
1220
+ return null;
1221
+ return first.desc ? 'descending' : 'ascending';
1222
+ }
1223
+ _cellClass(userClass) {
1224
+ return hlm(this.wrapCells() ? 'tw:whitespace-normal tw:wrap-anywhere tw:align-top' : '', userClass);
1225
+ }
1226
+ _cardCellClass(userClass) {
1227
+ return hlm('tw:mt-0.5 tw:text-sm tw:leading-none tw:font-medium', this._cellClass(userClass));
1228
+ }
1229
+ _thumbnailClass(userClass) {
1230
+ return hlm('tw:border-b tw:border-border tw:bg-muted/30', this._cellClass(userClass));
1231
+ }
1232
+ _cardClass(row) {
1233
+ return hlm('tw:group tw:relative tw:transition-all tw:hover:shadow-md tw:data-[state=selected]:border-primary tw:data-[state=selected]:ring-1 tw:data-[state=selected]:ring-primary/20', this.rowClass()?.(row, "tw:grid"));
1234
+ }
857
1235
  _selectionCell(row) {
858
1236
  return row.getVisibleCells().find((cell) => cell.column.id === 'select');
859
1237
  }
@@ -865,24 +1243,21 @@ class EgDataTable {
865
1243
  .getVisibleCells()
866
1244
  .filter((cell) => cell.column.id !== 'select' && cell.column.columnDef.meta?.thumbnail !== true);
867
1245
  }
868
- _cellLabel(cell) {
869
- const header = cell.column.columnDef.header;
870
- if (typeof header === 'string')
871
- return header;
872
- return cell.column.id.replace(/_/g, ' ');
873
- }
874
1246
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgDataTable, deps: [], target: i0.ɵɵFactoryTarget.Component });
875
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgDataTable, isStandalone: true, selector: "eg-data-table", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: true, transformFunction: null }, gridColumns: { classPropertyName: "gridColumns", publicName: "gridColumns", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, getRowId: { classPropertyName: "getRowId", publicName: "getRowId", isSignal: true, isRequired: false, transformFunction: null }, manualPagination: { classPropertyName: "manualPagination", publicName: "manualPagination", isSignal: true, isRequired: false, transformFunction: null }, features: { classPropertyName: "features", publicName: "features", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, enableSelection: { classPropertyName: "enableSelection", publicName: "enableSelection", isSignal: true, isRequired: false, transformFunction: null }, hideFooter: { classPropertyName: "hideFooter", publicName: "hideFooter", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, showLayoutToggle: { classPropertyName: "showLayoutToggle", publicName: "showLayoutToggle", isSignal: true, isRequired: false, transformFunction: null }, showToolbar: { classPropertyName: "showToolbar", publicName: "showToolbar", isSignal: true, isRequired: false, transformFunction: null }, filterColumnId: { classPropertyName: "filterColumnId", publicName: "filterColumnId", isSignal: true, isRequired: false, transformFunction: null }, filterPlaceholder: { classPropertyName: "filterPlaceholder", publicName: "filterPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, showColumnToggle: { classPropertyName: "showColumnToggle", publicName: "showColumnToggle", isSignal: true, isRequired: false, transformFunction: null }, toolbarActions: { classPropertyName: "toolbarActions", publicName: "toolbarActions", isSignal: true, isRequired: false, transformFunction: null }, defaultPageSize: { classPropertyName: "defaultPageSize", publicName: "defaultPageSize", isSignal: true, isRequired: false, transformFunction: null }, filterRows: { classPropertyName: "filterRows", publicName: "filterRows", isSignal: true, isRequired: false, transformFunction: null }, initialSorting: { classPropertyName: "initialSorting", publicName: "initialSorting", isSignal: true, isRequired: false, transformFunction: null }, initialColumnFilters: { classPropertyName: "initialColumnFilters", publicName: "initialColumnFilters", isSignal: true, isRequired: false, transformFunction: null }, initialColumnVisibility: { classPropertyName: "initialColumnVisibility", publicName: "initialColumnVisibility", isSignal: true, isRequired: false, transformFunction: null }, initialRowSelection: { classPropertyName: "initialRowSelection", publicName: "initialRowSelection", isSignal: true, isRequired: false, transformFunction: null }, showPageSize: { classPropertyName: "showPageSize", publicName: "showPageSize", isSignal: true, isRequired: false, transformFunction: null }, pageSizes: { classPropertyName: "pageSizes", publicName: "pageSizes", isSignal: true, isRequired: false, transformFunction: null }, navMode: { classPropertyName: "navMode", publicName: "navMode", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { layout: "layoutChange", selectionChange: "selectionChange", pageChange: "pageChange", pageSizeChange: "pageSizeChange", rowClick: "rowClick", sortingChange: "sortingChange", columnFiltersChange: "columnFiltersChange", filterChange: "filterChange", columnVisibilityChange: "columnVisibilityChange" }, providers: [
1247
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgDataTable, isStandalone: true, selector: "eg-data-table", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: true, transformFunction: null }, gridColumns: { classPropertyName: "gridColumns", publicName: "gridColumns", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, resetKey: { classPropertyName: "resetKey", publicName: "resetKey", isSignal: true, isRequired: false, transformFunction: null }, getRowId: { classPropertyName: "getRowId", publicName: "getRowId", isSignal: true, isRequired: false, transformFunction: null }, manualPagination: { classPropertyName: "manualPagination", publicName: "manualPagination", isSignal: true, isRequired: false, transformFunction: null }, paginate: { classPropertyName: "paginate", publicName: "paginate", isSignal: true, isRequired: false, transformFunction: null }, paginationDisabled: { classPropertyName: "paginationDisabled", publicName: "paginationDisabled", isSignal: true, isRequired: false, transformFunction: null }, features: { classPropertyName: "features", publicName: "features", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, keepRowsWhileLoading: { classPropertyName: "keepRowsWhileLoading", publicName: "keepRowsWhileLoading", isSignal: true, isRequired: false, transformFunction: null }, loadingTemplate: { classPropertyName: "loadingTemplate", publicName: "loadingTemplate", isSignal: true, isRequired: false, transformFunction: null }, refreshingTemplate: { classPropertyName: "refreshingTemplate", publicName: "refreshingTemplate", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, caption: { classPropertyName: "caption", publicName: "caption", isSignal: true, isRequired: false, transformFunction: null }, renderAsText: { classPropertyName: "renderAsText", publicName: "renderAsText", isSignal: true, isRequired: false, transformFunction: null }, striped: { classPropertyName: "striped", publicName: "striped", isSignal: true, isRequired: false, transformFunction: null }, wrapCells: { classPropertyName: "wrapCells", publicName: "wrapCells", isSignal: true, isRequired: false, transformFunction: null }, rowClass: { classPropertyName: "rowClass", publicName: "rowClass", isSignal: true, isRequired: false, transformFunction: null }, enableSelection: { classPropertyName: "enableSelection", publicName: "enableSelection", isSignal: true, isRequired: false, transformFunction: null }, hideFooter: { classPropertyName: "hideFooter", publicName: "hideFooter", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, gridBreakpoint: { classPropertyName: "gridBreakpoint", publicName: "gridBreakpoint", isSignal: true, isRequired: false, transformFunction: null }, showLayoutToggle: { classPropertyName: "showLayoutToggle", publicName: "showLayoutToggle", isSignal: true, isRequired: false, transformFunction: null }, showGridSort: { classPropertyName: "showGridSort", publicName: "showGridSort", isSignal: true, isRequired: false, transformFunction: null }, gridSortTemplate: { classPropertyName: "gridSortTemplate", publicName: "gridSortTemplate", isSignal: true, isRequired: false, transformFunction: null }, showToolbar: { classPropertyName: "showToolbar", publicName: "showToolbar", isSignal: true, isRequired: false, transformFunction: null }, filterColumnId: { classPropertyName: "filterColumnId", publicName: "filterColumnId", isSignal: true, isRequired: false, transformFunction: null }, filterLabel: { classPropertyName: "filterLabel", publicName: "filterLabel", isSignal: true, isRequired: false, transformFunction: null }, filterPlaceholder: { classPropertyName: "filterPlaceholder", publicName: "filterPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, showColumnToggle: { classPropertyName: "showColumnToggle", publicName: "showColumnToggle", isSignal: true, isRequired: false, transformFunction: null }, toolbarActions: { classPropertyName: "toolbarActions", publicName: "toolbarActions", isSignal: true, isRequired: false, transformFunction: null }, defaultPageSize: { classPropertyName: "defaultPageSize", publicName: "defaultPageSize", isSignal: true, isRequired: false, transformFunction: null }, preservePageOnDataChange: { classPropertyName: "preservePageOnDataChange", publicName: "preservePageOnDataChange", isSignal: true, isRequired: false, transformFunction: null }, resetPageOnSizeChange: { classPropertyName: "resetPageOnSizeChange", publicName: "resetPageOnSizeChange", isSignal: true, isRequired: false, transformFunction: null }, filterRows: { classPropertyName: "filterRows", publicName: "filterRows", isSignal: true, isRequired: false, transformFunction: null }, initialSorting: { classPropertyName: "initialSorting", publicName: "initialSorting", isSignal: true, isRequired: false, transformFunction: null }, sorting: { classPropertyName: "sorting", publicName: "sorting", isSignal: true, isRequired: false, transformFunction: null }, initialColumnFilters: { classPropertyName: "initialColumnFilters", publicName: "initialColumnFilters", isSignal: true, isRequired: false, transformFunction: null }, initialColumnVisibility: { classPropertyName: "initialColumnVisibility", publicName: "initialColumnVisibility", isSignal: true, isRequired: false, transformFunction: null }, initialRowSelection: { classPropertyName: "initialRowSelection", publicName: "initialRowSelection", isSignal: true, isRequired: false, transformFunction: null }, showPageSize: { classPropertyName: "showPageSize", publicName: "showPageSize", isSignal: true, isRequired: false, transformFunction: null }, pageSizes: { classPropertyName: "pageSizes", publicName: "pageSizes", isSignal: true, isRequired: false, transformFunction: null }, navMode: { classPropertyName: "navMode", publicName: "navMode", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { layout: "layoutChange", selectionChange: "selectionChange", pageChange: "pageChange", pageSizeChange: "pageSizeChange", paginationChange: "paginationChange", rowClick: "rowClick", sortingChange: "sortingChange", columnFiltersChange: "columnFiltersChange", filterChange: "filterChange", columnVisibilityChange: "columnVisibilityChange" }, providers: [
876
1248
  provideIcons({ lucideArrowDown, lucideArrowUp, lucideChevronsUpDown, lucideLayoutGrid, lucideLayoutList }),
877
- ], ngImport: i0, template: `
878
- <div [class]="_containerClass()">
1249
+ ], usesOnChanges: true, ngImport: i0, template: `
1250
+ <div [class]="_containerClass()" [attr.aria-busy]="isLoading() || null">
1251
+ @if (isLoading() && !_showLoadingState()) {
1252
+ <ng-container *ngTemplateOutlet="refreshingTemplate() || _defaultRefreshing" />
1253
+ }
879
1254
  @if (_showLayoutToggle()) {
880
1255
  <div class="tw:flex tw:items-center tw:justify-between">
881
1256
  <div hlmToggleGroup type="single" [value]="_effectiveLayout()" (valueChange)="_onLayoutToggle($event)">
882
- <button hlmToggleGroupItem value="table" aria-label="Table view">
1257
+ <button hlmToggleGroupItem value="table" [aria-label]="_labels.tableView">
883
1258
  <ng-icon hlm name="lucideLayoutList" />
884
1259
  </button>
885
- <button hlmToggleGroupItem value="grid" aria-label="Grid view">
1260
+ <button hlmToggleGroupItem value="grid" [aria-label]="_labels.gridView">
886
1261
  <ng-icon hlm name="lucideLayoutGrid" />
887
1262
  </button>
888
1263
  </div>
@@ -890,24 +1265,30 @@ class EgDataTable {
890
1265
  </div>
891
1266
  }
892
1267
 
893
- @if (showToolbar() || toolbarActions()) {
1268
+ @if (_hasToolbarControls() || _showGridSorting() || toolbarActions()) {
894
1269
  <div class="tw:flex tw:flex-wrap tw:items-center tw:justify-between tw:gap-2 tw:py-1" [tanStackTable]="_table">
895
- @if (showToolbar()) {
1270
+ @if (_hasToolbarControls()) {
896
1271
  <div class="tw:flex tw:flex-wrap tw:items-center tw:gap-2">
897
- <input
898
- hlmInput
899
- class="tw:w-full tw:min-w-0 tw:md:w-80"
900
- [size]="size()"
901
- [placeholder]="filterPlaceholder()"
902
- (input)="_onFilterInput($event)"
903
- />
1272
+ @if (showToolbar()) {
1273
+ <input
1274
+ hlmInput
1275
+ class="tw:w-full tw:min-w-0 tw:md:w-80"
1276
+ [size]="size()"
1277
+ [attr.aria-label]="filterLabel()"
1278
+ [placeholder]="filterPlaceholder()"
1279
+ [formControl]="_filterControl"
1280
+ />
1281
+ }
904
1282
  @if (showColumnToggle()) {
905
1283
  <eg-data-table-view-options [size]="size()" />
906
1284
  }
907
1285
  </div>
908
1286
  }
909
- @if (toolbarActions()) {
910
- <div class="tw:flex tw:flex-wrap tw:items-center tw:gap-2">
1287
+ @if (_showGridSorting() || toolbarActions()) {
1288
+ <div class="tw:ms-auto tw:flex tw:flex-wrap tw:items-center tw:gap-2">
1289
+ @if (_showGridSorting()) {
1290
+ <ng-container *ngTemplateOutlet="gridSortTemplate() || _gridSortView; context: _gridSortContext()" />
1291
+ }
911
1292
  <ng-container *ngTemplateOutlet="toolbarActions()" />
912
1293
  </div>
913
1294
  }
@@ -920,15 +1301,66 @@ class EgDataTable {
920
1301
  <ng-container *ngTemplateOutlet="_tableView" />
921
1302
  }
922
1303
 
1304
+ <ng-template #_gridSortView>
1305
+ <div class="tw:flex tw:items-center tw:gap-2">
1306
+ <span class="tw:sr-only" [id]="_gridSortLabelId">{{ _labels.sortBy }}</span>
1307
+ <div hlmSelect [formControl]="_gridSortControl" [itemToString]="_gridSortLabel">
1308
+ <hlm-select-trigger [aria-labelledby]="_gridSortLabelId" [size]="size() === 'sm' ? 'sm' : 'default'">
1309
+ <hlm-select-value [placeholder]="_labels.sortBy" />
1310
+ </hlm-select-trigger>
1311
+ <hlm-select-content *hlmSelectPortal>
1312
+ @for (option of _gridSortOptions(); track option.id) {
1313
+ <hlm-select-item [value]="option.id">{{ option.label }}</hlm-select-item>
1314
+ }
1315
+ </hlm-select-content>
1316
+ </div>
1317
+ @if (_gridSortColumn(); as column) {
1318
+ @let descending = column.getIsSorted() === 'desc';
1319
+ <button
1320
+ hlmButton
1321
+ variant="secondary"
1322
+ appearance="outline"
1323
+ [size]="size() === 'sm' ? 'icon-sm' : 'icon'"
1324
+ type="button"
1325
+ [attr.aria-label]="descending ? _labels.sortAscending : _labels.sortDescending"
1326
+ (click)="column.toggleSorting(!descending, false)"
1327
+ >
1328
+ <ng-icon hlm size="sm" [name]="descending ? 'lucideArrowDown' : 'lucideArrowUp'" />
1329
+ </button>
1330
+ }
1331
+ </div>
1332
+ </ng-template>
1333
+
1334
+ <ng-template #_defaultRefreshing>
1335
+ <span class="tw:sr-only" role="status">{{ _labels.refreshing }}</span>
1336
+ </ng-template>
1337
+ <ng-template #_defaultLoading>
1338
+ <hlm-spinner class="tw:inline-flex" [attr.aria-label]="_labels.loading" />
1339
+ </ng-template>
1340
+
923
1341
  <ng-template #_tableView>
924
- <div class="tw:overflow-hidden tw:rounded-md tw:border">
1342
+ <div data-slot="data-table-frame" class="tw:overflow-hidden tw:rounded-md tw:border tw:border-border">
925
1343
  <div hlmTableContainer>
926
1344
  <table hlmTable>
1345
+ @if (caption()) {
1346
+ <caption hlmTableCaption>
1347
+ {{
1348
+ caption()
1349
+ }}
1350
+ </caption>
1351
+ }
927
1352
  <thead hlmTHead>
928
1353
  @for (headerGroup of _table.getHeaderGroups(); track headerGroup.id) {
929
1354
  <tr hlmTr>
930
1355
  @for (header of headerGroup.headers; track header.id) {
931
- <th hlmTh [size]="size()" [attr.colSpan]="header.colSpan">
1356
+ <th
1357
+ hlmTh
1358
+ [size]="size()"
1359
+ [class]="_cellClass(header.column.columnDef.meta?.headerClass)"
1360
+ [attr.colspan]="header.colSpan"
1361
+ [attr.scope]="header.isPlaceholder ? null : header.subHeaders.length ? 'colgroup' : 'col'"
1362
+ [attr.aria-sort]="_ariaSort(header)"
1363
+ >
932
1364
  @if (!header.isPlaceholder) {
933
1365
  <div class="tw:flex tw:items-center tw:gap-1">
934
1366
  <ng-container
@@ -943,7 +1375,7 @@ class EgDataTable {
943
1375
  size="sm"
944
1376
  [class]="_sortButtonClass()"
945
1377
  type="button"
946
- [attr.aria-label]="'Sort by ' + header.column.id"
1378
+ [attr.aria-label]="_labels.sortByColumn(_columnLabel(header.column))"
947
1379
  (click)="_toggleHeaderSorting(header)"
948
1380
  >
949
1381
  @switch (header.column.getIsSorted()) {
@@ -966,11 +1398,11 @@ class EgDataTable {
966
1398
  </tr>
967
1399
  }
968
1400
  </thead>
969
- <tbody hlmTBody>
970
- @if (isLoading()) {
1401
+ <tbody hlmTBody [class]="_bodyClass()">
1402
+ @if (_showLoadingState()) {
971
1403
  <tr hlmTr>
972
1404
  <td hlmTd [attr.colspan]="_visibleColumnCount()" class="tw:h-24 tw:text-center">
973
- <hlm-spinner class="tw:inline-flex" />
1405
+ <ng-container *ngTemplateOutlet="loadingTemplate() || _defaultLoading" />
974
1406
  </td>
975
1407
  </tr>
976
1408
  } @else if (_table.getRowModel().rows.length === 0) {
@@ -983,17 +1415,29 @@ class EgDataTable {
983
1415
  @for (row of _table.getRowModel().rows; track row.id) {
984
1416
  <tr
985
1417
  hlmTr
1418
+ [class]="rowClass()?.(row.original, 'table')"
986
1419
  [attr.data-state]="row.getIsSelected() ? 'selected' : null"
987
1420
  (click)="_onRowClick($event, row)"
988
1421
  >
989
1422
  @for (cell of row.getVisibleCells(); track cell.id) {
990
- <td hlmTd [size]="size()">
991
- <ng-container
992
- *flexRender="cell.column.columnDef.cell; props: cell.getContext(); let cellText"
993
- >
994
- <div [innerHTML]="cellText"></div>
995
- </ng-container>
996
- </td>
1423
+ @let meta = cell.column.columnDef.meta;
1424
+ @if (meta?.rowHeader) {
1425
+ <th hlmTableCell scope="row" [size]="size()" [class]="_cellClass(meta?.cellClass)">
1426
+ <ng-container *flexRender="cell.column.columnDef.cell; props: cell.getContext(); let value">
1427
+ <ng-container
1428
+ *ngTemplateOutlet="_renderedCell; context: { value, text: meta?.renderAsText }"
1429
+ />
1430
+ </ng-container>
1431
+ </th>
1432
+ } @else {
1433
+ <td hlmTd [size]="size()" [class]="_cellClass(meta?.cellClass)">
1434
+ <ng-container *flexRender="cell.column.columnDef.cell; props: cell.getContext(); let value">
1435
+ <ng-container
1436
+ *ngTemplateOutlet="_renderedCell; context: { value, text: meta?.renderAsText }"
1437
+ />
1438
+ </ng-container>
1439
+ </td>
1440
+ }
997
1441
  }
998
1442
  </tr>
999
1443
  }
@@ -1005,16 +1449,15 @@ class EgDataTable {
1005
1449
  </ng-template>
1006
1450
 
1007
1451
  <ng-template #_gridView>
1008
- @if (isLoading()) {
1452
+ @if (_showLoadingState()) {
1009
1453
  <div
1010
- class="tw:flex tw:h-64 tw:items-center tw:justify-center tw:rounded-lg tw:border tw:border-dashed"
1011
- role="status"
1454
+ class="tw:flex tw:h-64 tw:items-center tw:justify-center tw:rounded-lg tw:border tw:border-dashed tw:border-border"
1012
1455
  >
1013
- <hlm-spinner />
1456
+ <ng-container *ngTemplateOutlet="loadingTemplate() || _defaultLoading" />
1014
1457
  </div>
1015
1458
  } @else if (_table.getRowModel().rows.length === 0) {
1016
1459
  <div
1017
- class="tw:text-muted-foreground tw:flex tw:h-64 tw:items-center tw:justify-center tw:rounded-lg tw:border tw:border-dashed"
1460
+ class="tw:text-muted-foreground tw:flex tw:h-64 tw:items-center tw:justify-center tw:rounded-lg tw:border tw:border-dashed tw:border-border"
1018
1461
  >
1019
1462
  {{ emptyMessage() }}
1020
1463
  </div>
@@ -1023,43 +1466,61 @@ class EgDataTable {
1023
1466
  @for (row of _table.getRowModel().rows; track row.id) {
1024
1467
  <div
1025
1468
  hlmCard
1026
- class="tw:group tw:relative tw:transition-all tw:hover:shadow-md tw:data-[state=selected]:border-primary tw:data-[state=selected]:ring-1 tw:data-[state=selected]:ring-primary/20"
1469
+ [class]="_cardClass(row.original)"
1027
1470
  [attr.data-state]="row.getIsSelected() ? 'selected' : null"
1028
1471
  (click)="_onRowClick($event, row)"
1029
1472
  >
1030
1473
  @if (_thumbnailCell(row); as thumbnail) {
1031
- <div class="tw:border-b tw:bg-muted/30">
1474
+ <div [class]="_thumbnailClass(thumbnail.column.columnDef.meta?.cellClass)">
1032
1475
  <ng-container
1033
- *flexRender="thumbnail.column.columnDef.cell; props: thumbnail.getContext(); let thumbHtml"
1476
+ *flexRender="thumbnail.column.columnDef.cell; props: thumbnail.getContext(); let value"
1034
1477
  >
1035
- <div [innerHTML]="thumbHtml"></div>
1478
+ <ng-container
1479
+ *ngTemplateOutlet="
1480
+ _renderedCell;
1481
+ context: {
1482
+ value,
1483
+ text: thumbnail.column.columnDef.meta?.renderAsText,
1484
+ }
1485
+ "
1486
+ />
1036
1487
  </ng-container>
1037
1488
  </div>
1038
1489
  }
1039
1490
  @if (_selectionCell(row); as selection) {
1040
1491
  <div class="tw:absolute tw:top-4 tw:right-4">
1041
1492
  <ng-container
1042
- *flexRender="selection.column.columnDef.cell; props: selection.getContext(); let selectHtml"
1493
+ *flexRender="selection.column.columnDef.cell; props: selection.getContext(); let value"
1043
1494
  >
1044
- <div [innerHTML]="selectHtml"></div>
1495
+ <div [innerHTML]="value"></div>
1045
1496
  </ng-container>
1046
1497
  </div>
1047
1498
  }
1048
1499
  <div hlmCardContent class="tw:space-y-3">
1049
- @for (cell of _contentCells(row); track cell.id) {
1050
- <div class="tw:flex tw:flex-col">
1051
- <dt
1052
- class="tw:text-[10px] tw:font-bold tw:tracking-wider tw:uppercase tw:text-muted-foreground/80"
1053
- >
1054
- {{ _cellLabel(cell) }}
1055
- </dt>
1056
- <dd class="tw:mt-0.5 tw:text-sm tw:leading-none tw:font-medium">
1057
- <ng-container *flexRender="cell.column.columnDef.cell; props: cell.getContext(); let valueHtml">
1058
- <div [innerHTML]="valueHtml"></div>
1059
- </ng-container>
1060
- </dd>
1061
- </div>
1062
- }
1500
+ <dl class="tw:m-0 tw:space-y-3">
1501
+ @for (cell of _contentCells(row); track cell.id) {
1502
+ <div class="tw:flex tw:flex-col">
1503
+ <dt
1504
+ class="tw:text-[10px] tw:font-bold tw:tracking-wider tw:uppercase tw:text-muted-foreground/80"
1505
+ >
1506
+ {{ _columnLabel(cell.column) }}
1507
+ </dt>
1508
+ <dd [class]="_cardCellClass(cell.column.columnDef.meta?.cellClass)">
1509
+ <ng-container *flexRender="cell.column.columnDef.cell; props: cell.getContext(); let value">
1510
+ <ng-container
1511
+ *ngTemplateOutlet="
1512
+ _renderedCell;
1513
+ context: {
1514
+ value,
1515
+ text: cell.column.columnDef.meta?.renderAsText,
1516
+ }
1517
+ "
1518
+ />
1519
+ </ng-container>
1520
+ </dd>
1521
+ </div>
1522
+ }
1523
+ </dl>
1063
1524
  </div>
1064
1525
  </div>
1065
1526
  }
@@ -1067,23 +1528,36 @@ class EgDataTable {
1067
1528
  }
1068
1529
  </ng-template>
1069
1530
 
1531
+ <ng-template #_renderedCell let-value="value" let-text="text">
1532
+ @if (text ?? renderAsText()) {
1533
+ <div>{{ value }}</div>
1534
+ } @else {
1535
+ <div [innerHTML]="value"></div>
1536
+ }
1537
+ </ng-template>
1538
+
1070
1539
  @if (!hideFooter()) {
1071
1540
  <div
1072
1541
  class="tw:flex tw:flex-col tw:gap-2 tw:px-2 tw:py-4 tw:sm:flex-row tw:sm:items-center tw:sm:justify-between"
1073
1542
  [tanStackTable]="_table"
1074
1543
  >
1075
1544
  <div class="tw:text-muted-foreground tw:flex-1 tw:text-sm">{{ _statusText() }}</div>
1076
- <eg-data-table-pagination
1077
- [showStatus]="false"
1078
- [showPageSize]="showPageSize()"
1079
- [pageSizes]="pageSizes()"
1080
- [navMode]="navMode()"
1081
- [size]="size()"
1082
- />
1545
+ @if (!_unpaginated()) {
1546
+ <eg-data-table-pagination
1547
+ [showStatus]="false"
1548
+ [disabled]="paginationDisabled()"
1549
+ [showPageSize]="showPageSize()"
1550
+ [pageSizes]="pageSizes()"
1551
+ [navMode]="navMode()"
1552
+ [size]="size()"
1553
+ [hasPrevious]="_page()?.hasPrevious"
1554
+ [hasNext]="_page()?.hasNext"
1555
+ />
1556
+ }
1083
1557
  </div>
1084
1558
  }
1085
1559
  </div>
1086
- `, isInline: true, dependencies: [{ kind: "directive", type: i1$2.FlexRenderDirective, selector: "ng-template[flexRender]", inputs: ["flexRender", "flexRenderProps", "flexRenderInjector"] }, { kind: "directive", type: TanStackTable, selector: "[tanStackTable]", inputs: ["tanStackTable"], exportAs: ["table"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.HlmTableContainer, selector: "div[hlmTableContainer]" }, { kind: "directive", type: i2.HlmTable, selector: "table[hlmTable]" }, { kind: "directive", type: i2.HlmTBody, selector: "tbody[hlmTBody],tbody[hlmTableBody]" }, { kind: "directive", type: i2.HlmTd, selector: "td[hlmTd],td[hlmTableCell]", inputs: ["size"] }, { kind: "directive", type: i2.HlmTh, selector: "th[hlmTh],th[hlmTableHead]", inputs: ["size"] }, { kind: "directive", type: i2.HlmTHead, selector: "thead[hlmTHead],thead[hlmTableHeader]" }, { kind: "directive", type: i2.HlmTr, selector: "tr[hlmTr],tr[hlmTableRow]" }, { kind: "component", type: HlmButton, selector: "button[hlmButton], a[hlmButton]", inputs: ["variant", "size", "appearance", "loading", "icon", "iconPosition", "class", "spinnerUserClass", "disabled", "type"] }, { kind: "directive", type: HlmCard, selector: "[hlmCard],hlm-card", inputs: ["size"] }, { kind: "directive", type: HlmCardContent, selector: "[hlmCardContent]" }, { kind: "directive", type: HlmIcon, selector: "ng-icon[hlm]", inputs: ["size"] }, { kind: "directive", type: HlmInput, selector: "[hlmInput]", inputs: ["ariaDescribedby", "size"] }, { kind: "component", type: HlmSpinner, selector: "hlm-spinner", inputs: ["size", "show", "class", "spinnerClass"] }, { kind: "directive", type: HlmToggleGroup, selector: "[hlmToggleGroup],hlm-toggle-group", inputs: ["variant", "size", "spacing", "orientation"] }, { kind: "directive", type: HlmToggleGroupItem, selector: "button[hlmToggleGroupItem]", inputs: ["variant", "size"] }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "component", type: EgDataTablePagination, selector: "eg-data-table-pagination", inputs: ["showStatus", "showPageSize", "pageSizes", "navMode", "size"] }, { kind: "component", type: EgDataTableViewOptions, selector: "eg-data-table-view-options", inputs: ["size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1560
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1$2.FlexRenderDirective, selector: "ng-template[flexRender]", inputs: ["flexRender", "flexRenderProps", "flexRenderInjector"] }, { kind: "directive", type: TanStackTable, selector: "[tanStackTable]", inputs: ["tanStackTable"], exportAs: ["table"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.HlmCaption, selector: "caption[hlmCaption],caption[hlmTableCaption]" }, { kind: "directive", type: i3.HlmTableContainer, selector: "div[hlmTableContainer]" }, { kind: "directive", type: i3.HlmTable, selector: "table[hlmTable]" }, { kind: "directive", type: i3.HlmTBody, selector: "tbody[hlmTBody],tbody[hlmTableBody]" }, { kind: "directive", type: i3.HlmTd, selector: "td[hlmTd],td[hlmTableCell],th[hlmTd],th[hlmTableCell]", inputs: ["size", "class"] }, { kind: "directive", type: i3.HlmTh, selector: "th[hlmTh],th[hlmTableHead]", inputs: ["size", "class"] }, { kind: "directive", type: i3.HlmTHead, selector: "thead[hlmTHead],thead[hlmTableHeader]" }, { kind: "directive", type: i3.HlmTr, selector: "tr[hlmTr],tr[hlmTableRow]", inputs: ["class"] }, { kind: "component", type: HlmButton, selector: "button[hlmButton], a[hlmButton]", inputs: ["variant", "size", "appearance", "loading", "icon", "iconPosition", "class", "spinnerUserClass", "disabled", "type"] }, { kind: "directive", type: HlmCard, selector: "[hlmCard],hlm-card", inputs: ["size"] }, { kind: "directive", type: HlmCardContent, selector: "[hlmCardContent]" }, { kind: "directive", type: HlmIcon, selector: "ng-icon[hlm]", inputs: ["size"] }, { kind: "directive", type: HlmInput, selector: "[hlmInput]", inputs: ["ariaDescribedby", "size"] }, { kind: "directive", type: i1.HlmSelect, selector: "[hlmSelect],hlm-select" }, { kind: "component", type: i1.HlmSelectContent, selector: "hlm-select-content", inputs: ["showScroll"] }, { kind: "component", type: i1.HlmSelectItem, selector: "hlm-select-item" }, { kind: "directive", type: i1.HlmSelectPortal, selector: "[hlmSelectPortal]" }, { kind: "component", type: i1.HlmSelectTrigger, selector: "hlm-select-trigger", inputs: ["class", "buttonId", "aria-labelledby", "ariaDescribedby", "wrapperDisabled", "size", "forceInvalid"] }, { kind: "directive", type: i1.HlmSelectValue, selector: "[hlmSelectValue],hlm-select-value" }, { kind: "component", type: HlmSpinner, selector: "hlm-spinner", inputs: ["size", "show", "class", "spinnerClass"] }, { kind: "directive", type: HlmToggleGroup, selector: "[hlmToggleGroup],hlm-toggle-group", inputs: ["variant", "size", "spacing", "orientation"] }, { kind: "directive", type: HlmToggleGroupItem, selector: "button[hlmToggleGroupItem]", inputs: ["variant", "size"] }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "component", type: EgDataTablePagination, selector: "eg-data-table-pagination", inputs: ["showStatus", "showPageSize", "pageSizes", "navMode", "size", "disabled", "hasPrevious", "hasNext"] }, { kind: "component", type: EgDataTableViewOptions, selector: "eg-data-table-view-options", inputs: ["size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1087
1561
  }
1088
1562
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgDataTable, decorators: [{
1089
1563
  type: Component,
@@ -1093,12 +1567,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
1093
1567
  FlexRender,
1094
1568
  TanStackTable,
1095
1569
  NgTemplateOutlet,
1570
+ ReactiveFormsModule,
1096
1571
  HlmTableImports,
1097
1572
  HlmButton,
1098
1573
  HlmCard,
1099
1574
  HlmCardContent,
1100
1575
  HlmIcon,
1101
1576
  HlmInput,
1577
+ HlmSelectImports,
1102
1578
  HlmSpinner,
1103
1579
  HlmToggleGroup,
1104
1580
  HlmToggleGroupItem,
@@ -1110,14 +1586,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
1110
1586
  provideIcons({ lucideArrowDown, lucideArrowUp, lucideChevronsUpDown, lucideLayoutGrid, lucideLayoutList }),
1111
1587
  ],
1112
1588
  template: `
1113
- <div [class]="_containerClass()">
1589
+ <div [class]="_containerClass()" [attr.aria-busy]="isLoading() || null">
1590
+ @if (isLoading() && !_showLoadingState()) {
1591
+ <ng-container *ngTemplateOutlet="refreshingTemplate() || _defaultRefreshing" />
1592
+ }
1114
1593
  @if (_showLayoutToggle()) {
1115
1594
  <div class="tw:flex tw:items-center tw:justify-between">
1116
1595
  <div hlmToggleGroup type="single" [value]="_effectiveLayout()" (valueChange)="_onLayoutToggle($event)">
1117
- <button hlmToggleGroupItem value="table" aria-label="Table view">
1596
+ <button hlmToggleGroupItem value="table" [aria-label]="_labels.tableView">
1118
1597
  <ng-icon hlm name="lucideLayoutList" />
1119
1598
  </button>
1120
- <button hlmToggleGroupItem value="grid" aria-label="Grid view">
1599
+ <button hlmToggleGroupItem value="grid" [aria-label]="_labels.gridView">
1121
1600
  <ng-icon hlm name="lucideLayoutGrid" />
1122
1601
  </button>
1123
1602
  </div>
@@ -1125,24 +1604,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
1125
1604
  </div>
1126
1605
  }
1127
1606
 
1128
- @if (showToolbar() || toolbarActions()) {
1607
+ @if (_hasToolbarControls() || _showGridSorting() || toolbarActions()) {
1129
1608
  <div class="tw:flex tw:flex-wrap tw:items-center tw:justify-between tw:gap-2 tw:py-1" [tanStackTable]="_table">
1130
- @if (showToolbar()) {
1609
+ @if (_hasToolbarControls()) {
1131
1610
  <div class="tw:flex tw:flex-wrap tw:items-center tw:gap-2">
1132
- <input
1133
- hlmInput
1134
- class="tw:w-full tw:min-w-0 tw:md:w-80"
1135
- [size]="size()"
1136
- [placeholder]="filterPlaceholder()"
1137
- (input)="_onFilterInput($event)"
1138
- />
1611
+ @if (showToolbar()) {
1612
+ <input
1613
+ hlmInput
1614
+ class="tw:w-full tw:min-w-0 tw:md:w-80"
1615
+ [size]="size()"
1616
+ [attr.aria-label]="filterLabel()"
1617
+ [placeholder]="filterPlaceholder()"
1618
+ [formControl]="_filterControl"
1619
+ />
1620
+ }
1139
1621
  @if (showColumnToggle()) {
1140
1622
  <eg-data-table-view-options [size]="size()" />
1141
1623
  }
1142
1624
  </div>
1143
1625
  }
1144
- @if (toolbarActions()) {
1145
- <div class="tw:flex tw:flex-wrap tw:items-center tw:gap-2">
1626
+ @if (_showGridSorting() || toolbarActions()) {
1627
+ <div class="tw:ms-auto tw:flex tw:flex-wrap tw:items-center tw:gap-2">
1628
+ @if (_showGridSorting()) {
1629
+ <ng-container *ngTemplateOutlet="gridSortTemplate() || _gridSortView; context: _gridSortContext()" />
1630
+ }
1146
1631
  <ng-container *ngTemplateOutlet="toolbarActions()" />
1147
1632
  </div>
1148
1633
  }
@@ -1155,15 +1640,66 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
1155
1640
  <ng-container *ngTemplateOutlet="_tableView" />
1156
1641
  }
1157
1642
 
1643
+ <ng-template #_gridSortView>
1644
+ <div class="tw:flex tw:items-center tw:gap-2">
1645
+ <span class="tw:sr-only" [id]="_gridSortLabelId">{{ _labels.sortBy }}</span>
1646
+ <div hlmSelect [formControl]="_gridSortControl" [itemToString]="_gridSortLabel">
1647
+ <hlm-select-trigger [aria-labelledby]="_gridSortLabelId" [size]="size() === 'sm' ? 'sm' : 'default'">
1648
+ <hlm-select-value [placeholder]="_labels.sortBy" />
1649
+ </hlm-select-trigger>
1650
+ <hlm-select-content *hlmSelectPortal>
1651
+ @for (option of _gridSortOptions(); track option.id) {
1652
+ <hlm-select-item [value]="option.id">{{ option.label }}</hlm-select-item>
1653
+ }
1654
+ </hlm-select-content>
1655
+ </div>
1656
+ @if (_gridSortColumn(); as column) {
1657
+ @let descending = column.getIsSorted() === 'desc';
1658
+ <button
1659
+ hlmButton
1660
+ variant="secondary"
1661
+ appearance="outline"
1662
+ [size]="size() === 'sm' ? 'icon-sm' : 'icon'"
1663
+ type="button"
1664
+ [attr.aria-label]="descending ? _labels.sortAscending : _labels.sortDescending"
1665
+ (click)="column.toggleSorting(!descending, false)"
1666
+ >
1667
+ <ng-icon hlm size="sm" [name]="descending ? 'lucideArrowDown' : 'lucideArrowUp'" />
1668
+ </button>
1669
+ }
1670
+ </div>
1671
+ </ng-template>
1672
+
1673
+ <ng-template #_defaultRefreshing>
1674
+ <span class="tw:sr-only" role="status">{{ _labels.refreshing }}</span>
1675
+ </ng-template>
1676
+ <ng-template #_defaultLoading>
1677
+ <hlm-spinner class="tw:inline-flex" [attr.aria-label]="_labels.loading" />
1678
+ </ng-template>
1679
+
1158
1680
  <ng-template #_tableView>
1159
- <div class="tw:overflow-hidden tw:rounded-md tw:border">
1681
+ <div data-slot="data-table-frame" class="tw:overflow-hidden tw:rounded-md tw:border tw:border-border">
1160
1682
  <div hlmTableContainer>
1161
1683
  <table hlmTable>
1684
+ @if (caption()) {
1685
+ <caption hlmTableCaption>
1686
+ {{
1687
+ caption()
1688
+ }}
1689
+ </caption>
1690
+ }
1162
1691
  <thead hlmTHead>
1163
1692
  @for (headerGroup of _table.getHeaderGroups(); track headerGroup.id) {
1164
1693
  <tr hlmTr>
1165
1694
  @for (header of headerGroup.headers; track header.id) {
1166
- <th hlmTh [size]="size()" [attr.colSpan]="header.colSpan">
1695
+ <th
1696
+ hlmTh
1697
+ [size]="size()"
1698
+ [class]="_cellClass(header.column.columnDef.meta?.headerClass)"
1699
+ [attr.colspan]="header.colSpan"
1700
+ [attr.scope]="header.isPlaceholder ? null : header.subHeaders.length ? 'colgroup' : 'col'"
1701
+ [attr.aria-sort]="_ariaSort(header)"
1702
+ >
1167
1703
  @if (!header.isPlaceholder) {
1168
1704
  <div class="tw:flex tw:items-center tw:gap-1">
1169
1705
  <ng-container
@@ -1178,7 +1714,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
1178
1714
  size="sm"
1179
1715
  [class]="_sortButtonClass()"
1180
1716
  type="button"
1181
- [attr.aria-label]="'Sort by ' + header.column.id"
1717
+ [attr.aria-label]="_labels.sortByColumn(_columnLabel(header.column))"
1182
1718
  (click)="_toggleHeaderSorting(header)"
1183
1719
  >
1184
1720
  @switch (header.column.getIsSorted()) {
@@ -1201,11 +1737,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
1201
1737
  </tr>
1202
1738
  }
1203
1739
  </thead>
1204
- <tbody hlmTBody>
1205
- @if (isLoading()) {
1740
+ <tbody hlmTBody [class]="_bodyClass()">
1741
+ @if (_showLoadingState()) {
1206
1742
  <tr hlmTr>
1207
1743
  <td hlmTd [attr.colspan]="_visibleColumnCount()" class="tw:h-24 tw:text-center">
1208
- <hlm-spinner class="tw:inline-flex" />
1744
+ <ng-container *ngTemplateOutlet="loadingTemplate() || _defaultLoading" />
1209
1745
  </td>
1210
1746
  </tr>
1211
1747
  } @else if (_table.getRowModel().rows.length === 0) {
@@ -1218,17 +1754,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
1218
1754
  @for (row of _table.getRowModel().rows; track row.id) {
1219
1755
  <tr
1220
1756
  hlmTr
1757
+ [class]="rowClass()?.(row.original, 'table')"
1221
1758
  [attr.data-state]="row.getIsSelected() ? 'selected' : null"
1222
1759
  (click)="_onRowClick($event, row)"
1223
1760
  >
1224
1761
  @for (cell of row.getVisibleCells(); track cell.id) {
1225
- <td hlmTd [size]="size()">
1226
- <ng-container
1227
- *flexRender="cell.column.columnDef.cell; props: cell.getContext(); let cellText"
1228
- >
1229
- <div [innerHTML]="cellText"></div>
1230
- </ng-container>
1231
- </td>
1762
+ @let meta = cell.column.columnDef.meta;
1763
+ @if (meta?.rowHeader) {
1764
+ <th hlmTableCell scope="row" [size]="size()" [class]="_cellClass(meta?.cellClass)">
1765
+ <ng-container *flexRender="cell.column.columnDef.cell; props: cell.getContext(); let value">
1766
+ <ng-container
1767
+ *ngTemplateOutlet="_renderedCell; context: { value, text: meta?.renderAsText }"
1768
+ />
1769
+ </ng-container>
1770
+ </th>
1771
+ } @else {
1772
+ <td hlmTd [size]="size()" [class]="_cellClass(meta?.cellClass)">
1773
+ <ng-container *flexRender="cell.column.columnDef.cell; props: cell.getContext(); let value">
1774
+ <ng-container
1775
+ *ngTemplateOutlet="_renderedCell; context: { value, text: meta?.renderAsText }"
1776
+ />
1777
+ </ng-container>
1778
+ </td>
1779
+ }
1232
1780
  }
1233
1781
  </tr>
1234
1782
  }
@@ -1240,16 +1788,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
1240
1788
  </ng-template>
1241
1789
 
1242
1790
  <ng-template #_gridView>
1243
- @if (isLoading()) {
1791
+ @if (_showLoadingState()) {
1244
1792
  <div
1245
- class="tw:flex tw:h-64 tw:items-center tw:justify-center tw:rounded-lg tw:border tw:border-dashed"
1246
- role="status"
1793
+ class="tw:flex tw:h-64 tw:items-center tw:justify-center tw:rounded-lg tw:border tw:border-dashed tw:border-border"
1247
1794
  >
1248
- <hlm-spinner />
1795
+ <ng-container *ngTemplateOutlet="loadingTemplate() || _defaultLoading" />
1249
1796
  </div>
1250
1797
  } @else if (_table.getRowModel().rows.length === 0) {
1251
1798
  <div
1252
- class="tw:text-muted-foreground tw:flex tw:h-64 tw:items-center tw:justify-center tw:rounded-lg tw:border tw:border-dashed"
1799
+ class="tw:text-muted-foreground tw:flex tw:h-64 tw:items-center tw:justify-center tw:rounded-lg tw:border tw:border-dashed tw:border-border"
1253
1800
  >
1254
1801
  {{ emptyMessage() }}
1255
1802
  </div>
@@ -1258,43 +1805,61 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
1258
1805
  @for (row of _table.getRowModel().rows; track row.id) {
1259
1806
  <div
1260
1807
  hlmCard
1261
- class="tw:group tw:relative tw:transition-all tw:hover:shadow-md tw:data-[state=selected]:border-primary tw:data-[state=selected]:ring-1 tw:data-[state=selected]:ring-primary/20"
1808
+ [class]="_cardClass(row.original)"
1262
1809
  [attr.data-state]="row.getIsSelected() ? 'selected' : null"
1263
1810
  (click)="_onRowClick($event, row)"
1264
1811
  >
1265
1812
  @if (_thumbnailCell(row); as thumbnail) {
1266
- <div class="tw:border-b tw:bg-muted/30">
1813
+ <div [class]="_thumbnailClass(thumbnail.column.columnDef.meta?.cellClass)">
1267
1814
  <ng-container
1268
- *flexRender="thumbnail.column.columnDef.cell; props: thumbnail.getContext(); let thumbHtml"
1815
+ *flexRender="thumbnail.column.columnDef.cell; props: thumbnail.getContext(); let value"
1269
1816
  >
1270
- <div [innerHTML]="thumbHtml"></div>
1817
+ <ng-container
1818
+ *ngTemplateOutlet="
1819
+ _renderedCell;
1820
+ context: {
1821
+ value,
1822
+ text: thumbnail.column.columnDef.meta?.renderAsText,
1823
+ }
1824
+ "
1825
+ />
1271
1826
  </ng-container>
1272
1827
  </div>
1273
1828
  }
1274
1829
  @if (_selectionCell(row); as selection) {
1275
1830
  <div class="tw:absolute tw:top-4 tw:right-4">
1276
1831
  <ng-container
1277
- *flexRender="selection.column.columnDef.cell; props: selection.getContext(); let selectHtml"
1832
+ *flexRender="selection.column.columnDef.cell; props: selection.getContext(); let value"
1278
1833
  >
1279
- <div [innerHTML]="selectHtml"></div>
1834
+ <div [innerHTML]="value"></div>
1280
1835
  </ng-container>
1281
1836
  </div>
1282
1837
  }
1283
1838
  <div hlmCardContent class="tw:space-y-3">
1284
- @for (cell of _contentCells(row); track cell.id) {
1285
- <div class="tw:flex tw:flex-col">
1286
- <dt
1287
- class="tw:text-[10px] tw:font-bold tw:tracking-wider tw:uppercase tw:text-muted-foreground/80"
1288
- >
1289
- {{ _cellLabel(cell) }}
1290
- </dt>
1291
- <dd class="tw:mt-0.5 tw:text-sm tw:leading-none tw:font-medium">
1292
- <ng-container *flexRender="cell.column.columnDef.cell; props: cell.getContext(); let valueHtml">
1293
- <div [innerHTML]="valueHtml"></div>
1294
- </ng-container>
1295
- </dd>
1296
- </div>
1297
- }
1839
+ <dl class="tw:m-0 tw:space-y-3">
1840
+ @for (cell of _contentCells(row); track cell.id) {
1841
+ <div class="tw:flex tw:flex-col">
1842
+ <dt
1843
+ class="tw:text-[10px] tw:font-bold tw:tracking-wider tw:uppercase tw:text-muted-foreground/80"
1844
+ >
1845
+ {{ _columnLabel(cell.column) }}
1846
+ </dt>
1847
+ <dd [class]="_cardCellClass(cell.column.columnDef.meta?.cellClass)">
1848
+ <ng-container *flexRender="cell.column.columnDef.cell; props: cell.getContext(); let value">
1849
+ <ng-container
1850
+ *ngTemplateOutlet="
1851
+ _renderedCell;
1852
+ context: {
1853
+ value,
1854
+ text: cell.column.columnDef.meta?.renderAsText,
1855
+ }
1856
+ "
1857
+ />
1858
+ </ng-container>
1859
+ </dd>
1860
+ </div>
1861
+ }
1862
+ </dl>
1298
1863
  </div>
1299
1864
  </div>
1300
1865
  }
@@ -1302,26 +1867,39 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
1302
1867
  }
1303
1868
  </ng-template>
1304
1869
 
1870
+ <ng-template #_renderedCell let-value="value" let-text="text">
1871
+ @if (text ?? renderAsText()) {
1872
+ <div>{{ value }}</div>
1873
+ } @else {
1874
+ <div [innerHTML]="value"></div>
1875
+ }
1876
+ </ng-template>
1877
+
1305
1878
  @if (!hideFooter()) {
1306
1879
  <div
1307
1880
  class="tw:flex tw:flex-col tw:gap-2 tw:px-2 tw:py-4 tw:sm:flex-row tw:sm:items-center tw:sm:justify-between"
1308
1881
  [tanStackTable]="_table"
1309
1882
  >
1310
1883
  <div class="tw:text-muted-foreground tw:flex-1 tw:text-sm">{{ _statusText() }}</div>
1311
- <eg-data-table-pagination
1312
- [showStatus]="false"
1313
- [showPageSize]="showPageSize()"
1314
- [pageSizes]="pageSizes()"
1315
- [navMode]="navMode()"
1316
- [size]="size()"
1317
- />
1884
+ @if (!_unpaginated()) {
1885
+ <eg-data-table-pagination
1886
+ [showStatus]="false"
1887
+ [disabled]="paginationDisabled()"
1888
+ [showPageSize]="showPageSize()"
1889
+ [pageSizes]="pageSizes()"
1890
+ [navMode]="navMode()"
1891
+ [size]="size()"
1892
+ [hasPrevious]="_page()?.hasPrevious"
1893
+ [hasNext]="_page()?.hasNext"
1894
+ />
1895
+ }
1318
1896
  </div>
1319
1897
  }
1320
1898
  </div>
1321
1899
  `,
1322
1900
  changeDetection: ChangeDetectionStrategy.OnPush,
1323
1901
  }]
1324
- }], propDecorators: { columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: true }] }], gridColumns: [{ type: i0.Input, args: [{ isSignal: true, alias: "gridColumns", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], getRowId: [{ type: i0.Input, args: [{ isSignal: true, alias: "getRowId", required: false }] }], manualPagination: [{ type: i0.Input, args: [{ isSignal: true, alias: "manualPagination", required: false }] }], features: [{ type: i0.Input, args: [{ isSignal: true, alias: "features", required: false }] }], isLoading: [{ type: i0.Input, args: [{ isSignal: true, alias: "isLoading", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], enableSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableSelection", required: false }] }], hideFooter: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideFooter", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], layout: [{ type: i0.Input, args: [{ isSignal: true, alias: "layout", required: false }] }, { type: i0.Output, args: ["layoutChange"] }], showLayoutToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLayoutToggle", required: false }] }], showToolbar: [{ type: i0.Input, args: [{ isSignal: true, alias: "showToolbar", required: false }] }], filterColumnId: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterColumnId", required: false }] }], filterPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterPlaceholder", required: false }] }], showColumnToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "showColumnToggle", required: false }] }], toolbarActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "toolbarActions", required: false }] }], defaultPageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultPageSize", required: false }] }], filterRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterRows", required: false }] }], initialSorting: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialSorting", required: false }] }], initialColumnFilters: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialColumnFilters", required: false }] }], initialColumnVisibility: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialColumnVisibility", required: false }] }], initialRowSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialRowSelection", required: false }] }], showPageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPageSize", required: false }] }], pageSizes: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSizes", required: false }] }], navMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "navMode", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], pageChange: [{ type: i0.Output, args: ["pageChange"] }], pageSizeChange: [{ type: i0.Output, args: ["pageSizeChange"] }], rowClick: [{ type: i0.Output, args: ["rowClick"] }], sortingChange: [{ type: i0.Output, args: ["sortingChange"] }], columnFiltersChange: [{ type: i0.Output, args: ["columnFiltersChange"] }], filterChange: [{ type: i0.Output, args: ["filterChange"] }], columnVisibilityChange: [{ type: i0.Output, args: ["columnVisibilityChange"] }] } });
1902
+ }], ctorParameters: () => [], propDecorators: { columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: true }] }], gridColumns: [{ type: i0.Input, args: [{ isSignal: true, alias: "gridColumns", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], resetKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "resetKey", required: false }] }], getRowId: [{ type: i0.Input, args: [{ isSignal: true, alias: "getRowId", required: false }] }], manualPagination: [{ type: i0.Input, args: [{ isSignal: true, alias: "manualPagination", required: false }] }], paginate: [{ type: i0.Input, args: [{ isSignal: true, alias: "paginate", required: false }] }], paginationDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "paginationDisabled", required: false }] }], features: [{ type: i0.Input, args: [{ isSignal: true, alias: "features", required: false }] }], isLoading: [{ type: i0.Input, args: [{ isSignal: true, alias: "isLoading", required: false }] }], keepRowsWhileLoading: [{ type: i0.Input, args: [{ isSignal: true, alias: "keepRowsWhileLoading", required: false }] }], loadingTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadingTemplate", required: false }] }], refreshingTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "refreshingTemplate", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], caption: [{ type: i0.Input, args: [{ isSignal: true, alias: "caption", required: false }] }], renderAsText: [{ type: i0.Input, args: [{ isSignal: true, alias: "renderAsText", required: false }] }], striped: [{ type: i0.Input, args: [{ isSignal: true, alias: "striped", required: false }] }], wrapCells: [{ type: i0.Input, args: [{ isSignal: true, alias: "wrapCells", required: false }] }], rowClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowClass", required: false }] }], enableSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableSelection", required: false }] }], hideFooter: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideFooter", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], layout: [{ type: i0.Input, args: [{ isSignal: true, alias: "layout", required: false }] }, { type: i0.Output, args: ["layoutChange"] }], gridBreakpoint: [{ type: i0.Input, args: [{ isSignal: true, alias: "gridBreakpoint", required: false }] }], showLayoutToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLayoutToggle", required: false }] }], showGridSort: [{ type: i0.Input, args: [{ isSignal: true, alias: "showGridSort", required: false }] }], gridSortTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "gridSortTemplate", required: false }] }], showToolbar: [{ type: i0.Input, args: [{ isSignal: true, alias: "showToolbar", required: false }] }], filterColumnId: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterColumnId", required: false }] }], filterLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterLabel", required: false }] }], filterPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterPlaceholder", required: false }] }], showColumnToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "showColumnToggle", required: false }] }], toolbarActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "toolbarActions", required: false }] }], defaultPageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultPageSize", required: false }] }], preservePageOnDataChange: [{ type: i0.Input, args: [{ isSignal: true, alias: "preservePageOnDataChange", required: false }] }], resetPageOnSizeChange: [{ type: i0.Input, args: [{ isSignal: true, alias: "resetPageOnSizeChange", required: false }] }], filterRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterRows", required: false }] }], initialSorting: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialSorting", required: false }] }], sorting: [{ type: i0.Input, args: [{ isSignal: true, alias: "sorting", required: false }] }], initialColumnFilters: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialColumnFilters", required: false }] }], initialColumnVisibility: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialColumnVisibility", required: false }] }], initialRowSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialRowSelection", required: false }] }], showPageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPageSize", required: false }] }], pageSizes: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSizes", required: false }] }], navMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "navMode", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], pageChange: [{ type: i0.Output, args: ["pageChange"] }], pageSizeChange: [{ type: i0.Output, args: ["pageSizeChange"] }], paginationChange: [{ type: i0.Output, args: ["paginationChange"] }], rowClick: [{ type: i0.Output, args: ["rowClick"] }], sortingChange: [{ type: i0.Output, args: ["sortingChange"] }], columnFiltersChange: [{ type: i0.Output, args: ["columnFiltersChange"] }], filterChange: [{ type: i0.Output, args: ["filterChange"] }], columnVisibilityChange: [{ type: i0.Output, args: ["columnVisibilityChange"] }] } });
1325
1903
 
1326
1904
  /**
1327
1905
  * Sortable + hideable column header.
@@ -1341,6 +1919,7 @@ class EgDataTableColumnHeader {
1341
1919
  /** Density of the trigger button. */
1342
1920
  size = input('default', /* @ts-ignore */
1343
1921
  ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
1922
+ _labels = injectEgDataTableLabels();
1344
1923
  _sorted = computed(() => this.column().getIsSorted(), /* @ts-ignore */
1345
1924
  ...(ngDevMode ? [{ debugName: "_sorted" }] : /* istanbul ignore next */ []));
1346
1925
  /** Hideable only when TanStack allows it (table + column `enableHiding`). Absent `getCanHide` (legacy mocks) means hideable. */
@@ -1378,17 +1957,17 @@ class EgDataTableColumnHeader {
1378
1957
  <div hlmDropdownMenu>
1379
1958
  <button hlmDropdownMenuItem type="button" (click)="column().toggleSorting(false)">
1380
1959
  <ng-icon hlm size="sm" name="lucideArrowUp" />
1381
- Asc
1960
+ {{ _labels.ascending }}
1382
1961
  </button>
1383
1962
  <button hlmDropdownMenuItem type="button" (click)="column().toggleSorting(true)">
1384
1963
  <ng-icon hlm size="sm" name="lucideArrowDown" />
1385
- Desc
1964
+ {{ _labels.descending }}
1386
1965
  </button>
1387
1966
  @if (_canHide()) {
1388
1967
  <div hlmDropdownMenuSeparator></div>
1389
1968
  <button hlmDropdownMenuItem type="button" (click)="column().toggleVisibility(false)">
1390
1969
  <ng-icon hlm size="sm" name="lucideEyeOff" />
1391
- Hide
1970
+ {{ _labels.hideColumn }}
1392
1971
  </button>
1393
1972
  }
1394
1973
  </div>
@@ -1433,17 +2012,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
1433
2012
  <div hlmDropdownMenu>
1434
2013
  <button hlmDropdownMenuItem type="button" (click)="column().toggleSorting(false)">
1435
2014
  <ng-icon hlm size="sm" name="lucideArrowUp" />
1436
- Asc
2015
+ {{ _labels.ascending }}
1437
2016
  </button>
1438
2017
  <button hlmDropdownMenuItem type="button" (click)="column().toggleSorting(true)">
1439
2018
  <ng-icon hlm size="sm" name="lucideArrowDown" />
1440
- Desc
2019
+ {{ _labels.descending }}
1441
2020
  </button>
1442
2021
  @if (_canHide()) {
1443
2022
  <div hlmDropdownMenuSeparator></div>
1444
2023
  <button hlmDropdownMenuItem type="button" (click)="column().toggleVisibility(false)">
1445
2024
  <ng-icon hlm size="sm" name="lucideEyeOff" />
1446
- Hide
2025
+ {{ _labels.hideColumn }}
1447
2026
  </button>
1448
2027
  }
1449
2028
  </div>
@@ -1495,5 +2074,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
1495
2074
  * Generated bundle index. Do not edit.
1496
2075
  */
1497
2076
 
1498
- export { EgDataTable, EgDataTableColumnHeader, EgDataTableImports, EgDataTableModule, EgDataTablePagination, EgDataTableViewOptions, EgTableHeadSelection, EgTableRowSelection, defaultEgDataTableFeatures };
2077
+ export { EgDataTable, EgDataTableColumnHeader, EgDataTableImports, EgDataTableModule, EgDataTablePagination, EgDataTableViewOptions, EgTableHeadSelection, EgTableRowSelection, defaultEgDataTableFeatures, provideEgDataTableLabels };
1499
2078