shirkasoft-ui-components 1.3.11 → 1.3.13

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,18 +1,49 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ChangeDetectorRef, DestroyRef, input, model, output, signal, linkedSignal, computed, afterEveryRender, effect, untracked, HostListener, ChangeDetectionStrategy, Component } from '@angular/core';
2
+ import { inject, ChangeDetectorRef, DestroyRef, Injector, input, model, output, signal, linkedSignal, computed, afterEveryRender, effect, untracked, afterNextRender, HostListener, ChangeDetectionStrategy, Component } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
5
  import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
6
- import * as i2 from '@angular/forms';
7
- import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
8
- import * as i3 from '@jsverse/transloco';
6
+ import * as i2 from '@jsverse/transloco';
9
7
  import { TranslocoService, TranslocoModule } from '@jsverse/transloco';
10
8
  import { Subject, debounceTime } from 'rxjs';
11
- import { LucidePlus, LucideDynamicIcon } from '@lucide/angular';
9
+ import { LucidePlus, LucideTrash2, LucideCircleX, LucideCircleCheck, LucideFunnelX, LucideDynamicIcon } from '@lucide/angular';
12
10
  import { TagComponent } from 'shirkasoft-ui-components/tag';
13
11
  import { TooltipComponent } from 'shirkasoft-ui-components/tooltip';
14
12
  import { getIcon, PortalDirective } from 'shirkasoft-ui-components/utils';
15
13
 
14
+ /** Match modes offered by each filter kind that has a match mode selector. */
15
+ const MATCH_MODES = {
16
+ text: ['startsWith', 'contains', 'notContains', 'endsWith', 'equals', 'notEquals'],
17
+ numeric: ['equals', 'notEquals', 'lt', 'lte', 'gt', 'gte'],
18
+ date: ['dateIs', 'dateIsNot', 'dateBefore', 'dateAfter'],
19
+ };
20
+ /** Fallback labels used when the `table.filter.*` translations are missing. */
21
+ const FILTER_LABELS = {
22
+ startsWith: 'Empieza con',
23
+ contains: 'Contiene',
24
+ notContains: 'No contiene',
25
+ endsWith: 'Termina con',
26
+ equals: 'Igual a',
27
+ notEquals: 'Distinto de',
28
+ lt: 'Menor que',
29
+ lte: 'Menor o igual que',
30
+ gt: 'Mayor que',
31
+ gte: 'Mayor o igual que',
32
+ dateIs: 'La fecha es',
33
+ dateIsNot: 'La fecha no es',
34
+ dateBefore: 'La fecha es anterior a',
35
+ dateAfter: 'La fecha es posterior a',
36
+ matchAll: 'Coincidir todas',
37
+ matchAny: 'Coincidir alguna',
38
+ addRule: 'Agregar regla',
39
+ removeRule: 'Quitar regla',
40
+ apply: 'Aplicar',
41
+ clear: 'Limpiar',
42
+ any: 'Cualquiera',
43
+ selectedCount: '{{count}} seleccionados',
44
+ yes: 'Sí',
45
+ no: 'No',
46
+ };
16
47
  /**
17
48
  * Shirkasoft UI Components.
18
49
  * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).
@@ -21,23 +52,60 @@ import { getIcon, PortalDirective } from 'shirkasoft-ui-components/utils';
21
52
  /** Counter used to generate unique element ids per table instance. */
22
53
  let nextTableId = 0;
23
54
  /**
24
- * Data table with sorting, column filters, global search, pagination,
25
- * row/header actions, tag cells and optional server-side mode.
55
+ * Data table with sorting, column filter menus (match modes,
56
+ * multiple rules, typed filters), global search, pagination, row/header
57
+ * actions, tag/progress/boolean cells and optional server-side mode.
26
58
  */
27
59
  class TableComponent {
28
60
  /** Returns the effective CSS width for a column ('actions' included). */
29
61
  getColumnWidth(col) {
30
- return col.width || this.DEFAULT_COLUMN_WIDTH;
62
+ return this.resizedWidth(col) || col.width || this.DEFAULT_COLUMN_WIDTH;
63
+ }
64
+ /** Whether a value counts as missing: null, undefined, blank text or empty array. */
65
+ isEmptyValue(value) {
66
+ if (value === null || value === undefined)
67
+ return true;
68
+ if (typeof value === 'string')
69
+ return value.trim() === '';
70
+ if (Array.isArray(value))
71
+ return value.length === 0;
72
+ return false;
73
+ }
74
+ columnMissing(col, row) {
75
+ return col.isMissing ? !!col.isMissing(row) : this.isEmptyValue(this.resolveField(row, col.field));
76
+ }
77
+ /** Required columns that are empty in the row. */
78
+ missingFields(row) {
79
+ return this.missingByRow().get(row) ?? [];
80
+ }
81
+ /** Whether a cell is a required field without value. */
82
+ isCellMissing(col, row) {
83
+ return !!col.required && this.missingFields(row).includes(col);
84
+ }
85
+ missingCellMessage(col) {
86
+ return col.missingMessage || this.tr('table.missing.cell', 'Falta {{field}}', { field: col.header });
87
+ }
88
+ missingRowMessage(missing) {
89
+ return this.tr('table.missing.row', 'Faltan datos: {{fields}}', {
90
+ fields: missing.map((c) => c.header).join(', '),
91
+ });
31
92
  }
32
93
  constructor() {
33
94
  /** Unique id prefix so several tables on the same page don't share element ids. */
34
95
  this.uid = `shk-table-${nextTableId++}`;
35
- this.fb = inject(FormBuilder);
36
96
  this.cdr = inject(ChangeDetectorRef);
37
97
  this.transloco = inject(TranslocoService);
38
98
  this.destroyRef = inject(DestroyRef);
99
+ this.injector = inject(Injector);
39
100
  /** Maps icon names to lucide components, falling back to a plus icon. */
40
101
  this.getIcon = (name) => getIcon(name, LucidePlus);
102
+ /** Icons used directly by the template (not part of the central map). */
103
+ this.icons = {
104
+ clear: LucideFunnelX,
105
+ yes: LucideCircleCheck,
106
+ no: LucideCircleX,
107
+ trash: LucideTrash2,
108
+ };
41
109
  /**
42
110
  * Minimum width applied to each column (except `actions`, which keeps its
43
111
  * own computed width) only on narrow screens. On wide screens columns
@@ -83,6 +151,11 @@ class TableComponent {
83
151
  this.showSearch = input(true, ...(ngDevMode ? [{ debugName: "showSearch" }] : /* istanbul ignore next */ []));
84
152
  /** Placeholder for the global search input. */
85
153
  this.searchPlaceholder = input('', ...(ngDevMode ? [{ debugName: "searchPlaceholder" }] : /* istanbul ignore next */ []));
154
+ /**
155
+ * Fields (dot paths allowed) searched by the global search. When empty,
156
+ * every primitive top-level value of the row is searched.
157
+ */
158
+ this.globalFilterFields = input([], ...(ngDevMode ? [{ debugName: "globalFilterFields" }] : /* istanbul ignore next */ []));
86
159
  /** Message shown when there are no rows. */
87
160
  this.emptyMessage = input('', ...(ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []));
88
161
  /** Enables server-side pagination/filtering/sorting mode. */
@@ -93,6 +166,38 @@ class TableComponent {
93
166
  this.filters = input([], ...(ngDevMode ? [{ debugName: "filters" }] : /* istanbul ignore next */ []));
94
167
  /** Currently active filter chip value. */
95
168
  this.activeFilter = input('', ...(ngDevMode ? [{ debugName: "activeFilter" }] : /* istanbul ignore next */ []));
169
+ /** Draws vertical lines between columns (grid look). */
170
+ this.showGridlines = input(false, ...(ngDevMode ? [{ debugName: "showGridlines" }] : /* istanbul ignore next */ []));
171
+ /**
172
+ * With `showGridlines`, lets the user widen/narrow columns by dragging the
173
+ * header border (double click resets, arrow keys adjust).
174
+ */
175
+ this.resizableColumns = input(true, ...(ngDevMode ? [{ debugName: "resizableColumns" }] : /* istanbul ignore next */ []));
176
+ /**
177
+ * Highlights rows where a `required` column is empty: warning row, an icon
178
+ * listing the missing fields and a "Falta …" text in the empty cell.
179
+ */
180
+ this.validateRequired = input(false, ...(ngDevMode ? [{ debugName: "validateRequired" }] : /* istanbul ignore next */ []));
181
+ /**
182
+ * Column widths (px) keyed by field. Two-way bindable via
183
+ * `[(columnWidths)]` to restore/save them yourself.
184
+ */
185
+ this.columnWidths = model({}, ...(ngDevMode ? [{ debugName: "columnWidths" }] : /* istanbul ignore next */ []));
186
+ /**
187
+ * When set, column widths are saved in the browser storage under this key
188
+ * and restored on load (they take precedence over `columnWidths`).
189
+ */
190
+ this.stateKey = input('', ...(ngDevMode ? [{ debugName: "stateKey" }] : /* istanbul ignore next */ []));
191
+ /** Storage used with `stateKey`. */
192
+ this.stateStorage = input('local', ...(ngDevMode ? [{ debugName: "stateStorage" }] : /* istanbul ignore next */ []));
193
+ /** Highlights the row under the pointer. */
194
+ this.rowHover = input(true, ...(ngDevMode ? [{ debugName: "rowHover" }] : /* istanbul ignore next */ []));
195
+ /** Shows the "Clear" button that resets search, column filters and sort. */
196
+ this.showClearButton = input(true, ...(ngDevMode ? [{ debugName: "showClearButton" }] : /* istanbul ignore next */ []));
197
+ /** Shows the "X to Y of Z" report in the paginator. */
198
+ this.showPageReport = input(true, ...(ngDevMode ? [{ debugName: "showPageReport" }] : /* istanbul ignore next */ []));
199
+ /** Shows the rows-per-page selector in the paginator. */
200
+ this.showRowsPerPage = input(true, ...(ngDevMode ? [{ debugName: "showRowsPerPage" }] : /* istanbul ignore next */ []));
96
201
  /** Whether to render the leading checkbox column for multi-row selection. */
97
202
  this.selectable = input(false, ...(ngDevMode ? [{ debugName: "selectable" }] : /* istanbul ignore next */ []));
98
203
  /**
@@ -110,12 +215,14 @@ class TableComponent {
110
215
  this.refresh = output();
111
216
  /** Emits page changes (server-side mode) with first/rows/page info. */
112
217
  this.pageChange = output();
113
- /** Emits the active column filters. */
218
+ /** Emits the active column filters (server-side mode). */
114
219
  this.filterChange = output();
115
220
  /** Emits the debounced global search term. */
116
221
  this.searchChange = output();
117
222
  /** Emits when a filter chip is clicked. */
118
223
  this.filterClick = output();
224
+ /** Emits when a column is resized (`width` in px, `null` when reset to auto). */
225
+ this.columnResize = output();
119
226
  /** Internal copy of the input data used as the base for search/filter. */
120
227
  this.originalData = signal([], ...(ngDevMode ? [{ debugName: "originalData" }] : /* istanbul ignore next */ []));
121
228
  /** Rows after the global search is applied. */
@@ -128,8 +235,6 @@ class TableComponent {
128
235
  this.localTotalRecords = signal(0, ...(ngDevMode ? [{ debugName: "localTotalRecords" }] : /* istanbul ignore next */ []));
129
236
  /** Index of the first row of the current page. */
130
237
  this.first = signal(0, ...(ngDevMode ? [{ debugName: "first" }] : /* istanbul ignore next */ []));
131
- /** Visibility map for each column filter input. */
132
- this.showFilterInput = signal({}, ...(ngDevMode ? [{ debugName: "showFilterInput" }] : /* istanbul ignore next */ []));
133
238
  /** Current global search term. */
134
239
  this.searchQuery = signal('', ...(ngDevMode ? [{ debugName: "searchQuery" }] : /* istanbul ignore next */ []));
135
240
  /** Currently sorted field. */
@@ -138,19 +243,28 @@ class TableComponent {
138
243
  this.sortOrder = signal(1, ...(ngDevMode ? [{ debugName: "sortOrder" }] : /* istanbul ignore next */ []));
139
244
  /** Local rows per page, kept in sync with the `rowsPerPage` input. */
140
245
  this.rowsPerPageLocal = linkedSignal(() => this.rowsPerPage(), ...(ngDevMode ? [{ debugName: "rowsPerPageLocal" }] : /* istanbul ignore next */ []));
246
+ /** Applied filter state of each filterable column, keyed by field. */
247
+ this.filterState = signal({}, ...(ngDevMode ? [{ debugName: "filterState" }] : /* istanbul ignore next */ []));
248
+ /** Field whose filter menu is open (only one at a time). */
249
+ this.openFilterField = signal(null, ...(ngDevMode ? [{ debugName: "openFilterField" }] : /* istanbul ignore next */ []));
250
+ /** Filter being edited in the open menu (committed on Apply). */
251
+ this.filterDraft = signal(null, ...(ngDevMode ? [{ debugName: "filterDraft" }] : /* istanbul ignore next */ []));
252
+ /** Whether the option list of the multiselect filter is expanded. */
253
+ this.multiselectOpen = signal(false, ...(ngDevMode ? [{ debugName: "multiselectOpen" }] : /* istanbul ignore next */ []));
141
254
  /** Total number of pages based on the effective record count. */
142
255
  this.totalPages = computed(() => Math.max(1, Math.ceil(this.effectiveTotalRecords() / this.rowsPerPageLocal())), ...(ngDevMode ? [{ debugName: "totalPages" }] : /* istanbul ignore next */ []));
143
256
  /** Current page number (1-based). */
144
257
  this.currentPage = computed(() => Math.floor(this.first() / this.rowsPerPageLocal()) + 1, ...(ngDevMode ? [{ debugName: "currentPage" }] : /* istanbul ignore next */ []));
258
+ /** Whether any column can be filtered. */
259
+ this.hasFilterableColumns = computed(() => this.columns().some((c) => c.filter), ...(ngDevMode ? [{ debugName: "hasFilterableColumns" }] : /* istanbul ignore next */ []));
145
260
  /** Subjects used to debounce column filters (server mode) and search. */
146
261
  this.filterSubject = new Subject();
147
262
  this.searchSubject = new Subject();
148
263
  /**
149
264
  * Signature of the last built set of filterable fields (+filter type) to
150
- * avoid rebuilding the form (and losing user input) on reference changes.
265
+ * avoid resetting the filters (and losing user input) on reference changes.
151
266
  */
152
267
  this.lastFilterFieldsSignature = '';
153
- this.columnFilterSubscriptions = [];
154
268
  /** Columns array with the leading `actions` column when row actions exist. */
155
269
  this.columnsWithActions = computed(() => {
156
270
  const columnsArray = this.columns();
@@ -158,20 +272,23 @@ class TableComponent {
158
272
  const rowActionsArray = this.rowActions();
159
273
  const translatedHeader = this.actionsHeaderLabel();
160
274
  if (showAction && rowActionsArray.length > 0) {
161
- const visibleCount = Math.min(rowActionsArray.length, this.MAX_VISIBLE_ACTIONS);
162
- const hasDropdown = rowActionsArray.length > this.MAX_VISIBLE_ACTIONS;
163
- const extraWidth = hasDropdown ? 40 : 0;
164
- let baseWidth;
165
- if (visibleCount <= 2) {
166
- baseWidth = '110px';
167
- }
168
- else if (visibleCount <= 3) {
169
- baseWidth = '130px';
275
+ // Width from the actions really shown on the current page (each row can
276
+ // hide some with `isVisible`), not from every action defined.
277
+ const rows = this.effectiveDisplayedData();
278
+ let buttons = 0;
279
+ if (rows.length) {
280
+ for (const row of rows) {
281
+ const n = rowActionsArray.filter((a) => this.isRowActionVisible(a, row)).length;
282
+ const shown = n > this.MAX_VISIBLE_ACTIONS ? this.MAX_VISIBLE_ACTIONS + 1 : n; // +1 = "more" button
283
+ if (shown > buttons)
284
+ buttons = shown;
285
+ }
170
286
  }
171
287
  else {
172
- baseWidth = '170px';
288
+ const n = rowActionsArray.length;
289
+ buttons = n > this.MAX_VISIBLE_ACTIONS ? this.MAX_VISIBLE_ACTIONS + 1 : n;
173
290
  }
174
- const actionsWidth = `calc(${baseWidth} + ${extraWidth}px)`;
291
+ const actionsWidth = `${Math.max(this.MIN_ACTIONS_WIDTH, this.ACTIONS_CELL_PADDING + buttons * this.ACTION_BUTTON_WIDTH)}px`;
175
292
  return [
176
293
  {
177
294
  field: 'actions',
@@ -208,7 +325,36 @@ class TableComponent {
208
325
  return this.bulkActions().filter((a) => (a.isVisible ? a.isVisible(selected) : true));
209
326
  }, ...(ngDevMode ? [{ debugName: "visibleBulkActions" }] : /* istanbul ignore next */ []));
210
327
  /** Number of rendered columns, including the selection column. */
211
- this.totalColspan = computed(() => this.columnsWithActions().length + (this.selectable() ? 1 : 0), ...(ngDevMode ? [{ debugName: "totalColspan" }] : /* istanbul ignore next */ []));
328
+ this.totalColspan = computed(() => this.columnsWithActions().length +
329
+ (this.selectable() ? 1 : 0) +
330
+ (this.validateRequired() ? 1 : 0), ...(ngDevMode ? [{ debugName: "totalColspan" }] : /* istanbul ignore next */ []));
331
+ // ---------------------------------------------------------------------------
332
+ // Required fields validation
333
+ // ---------------------------------------------------------------------------
334
+ /** Columns checked by the validation (empty when it's disabled). */
335
+ this.requiredColumns = computed(() => this.validateRequired() ? this.columns().filter((c) => c.required) : [], ...(ngDevMode ? [{ debugName: "requiredColumns" }] : /* istanbul ignore next */ []));
336
+ /** Missing required columns of each displayed row (cached per render). */
337
+ this.missingByRow = computed(() => {
338
+ const cols = this.requiredColumns();
339
+ const map = new Map();
340
+ if (!cols.length)
341
+ return map;
342
+ for (const row of this.effectiveDisplayedData()) {
343
+ map.set(row, cols.filter((c) => this.columnMissing(c, row)));
344
+ }
345
+ return map;
346
+ }, ...(ngDevMode ? [{ debugName: "missingByRow" }] : /* istanbul ignore next */ []));
347
+ /**
348
+ * Number of rows with missing data in the whole dataset (client mode) or in
349
+ * the current page (server mode).
350
+ */
351
+ this.missingRowsCount = computed(() => {
352
+ const cols = this.requiredColumns();
353
+ if (!cols.length)
354
+ return 0;
355
+ const rows = this.serverSide() ? this.data() : this.originalData();
356
+ return rows.filter((row) => cols.some((c) => this.columnMissing(c, row))).length;
357
+ }, ...(ngDevMode ? [{ debugName: "missingRowsCount" }] : /* istanbul ignore next */ []));
212
358
  /** Total records: server-provided in server mode, locally computed otherwise. */
213
359
  this.effectiveTotalRecords = computed(() => {
214
360
  return this.serverSide() ? this.totalRecords() : this.localTotalRecords();
@@ -239,10 +385,36 @@ class TableComponent {
239
385
  const to = Math.min(this.first() + this.rowsPerPageLocal(), total);
240
386
  return this.transloco.translate('table.pageReport', { from, to, total });
241
387
  }, ...(ngDevMode ? [{ debugName: "pageReport" }] : /* istanbul ignore next */ []));
388
+ // ---------------------------------------------------------------------------
389
+ // Column resizing
390
+ // ---------------------------------------------------------------------------
391
+ /** Minimum width (px) a column can be resized to. */
392
+ this.MIN_COLUMN_WIDTH = 60;
393
+ /** Actions column auto width: button (2rem) + 1px gap, cell padding, header room. */
394
+ this.ACTION_BUTTON_WIDTH = 33;
395
+ this.ACTIONS_CELL_PADDING = 24;
396
+ this.MIN_ACTIONS_WIDTH = 84;
397
+ /** Field being resized right now (for the active handle style). */
398
+ this.resizingField = signal(null, ...(ngDevMode ? [{ debugName: "resizingField" }] : /* istanbul ignore next */ []));
399
+ /** Set right after a drag so the click that ends it doesn't sort the column. */
400
+ this.suppressHeaderClick = false;
401
+ /** Whether columns can be resized (only with gridlines). */
402
+ this.isResizable = computed(() => this.showGridlines() && this.resizableColumns(), ...(ngDevMode ? [{ debugName: "isResizable" }] : /* istanbul ignore next */ []));
403
+ /** Whether any column filter or the global search is active. */
404
+ this.hasActiveFilters = computed(() => {
405
+ if (this.searchQuery())
406
+ return true;
407
+ const state = this.filterState();
408
+ return this.columns().some((c) => c.filter && this.activeRules(c, state[c.field]).length > 0);
409
+ }, ...(ngDevMode ? [{ debugName: "hasActiveFilters" }] : /* istanbul ignore next */ []));
242
410
  /** Width (px) of the column filter popup, used to keep it inside the viewport. */
243
- this.FILTER_POPUP_WIDTH = 200;
411
+ this.FILTER_POPUP_WIDTH = 240;
244
412
  /** Viewport position of the open column filter popup. */
245
- this.filterPopupPosition = signal({ top: 0, left: 0 }, ...(ngDevMode ? [{ debugName: "filterPopupPosition" }] : /* istanbul ignore next */ []));
413
+ this.filterPopupPosition = signal({
414
+ top: 0,
415
+ left: 0,
416
+ maxHeight: 400,
417
+ }, ...(ngDevMode ? [{ debugName: "filterPopupPosition" }] : /* istanbul ignore next */ []));
246
418
  /** Filter button the open popup is anchored to, and its scroll/resize listener cleanup. */
247
419
  this.filterAnchor = null;
248
420
  this.filterListenersCleanup = null;
@@ -252,7 +424,6 @@ class TableComponent {
252
424
  this.actionsDropdownOpen = signal({}, ...(ngDevMode ? [{ debugName: "actionsDropdownOpen" }] : /* istanbul ignore next */ []));
253
425
  /** Computes the fixed position of the dropdown so it's not clipped by overflow. */
254
426
  this.dropdownPosition = signal({ top: 0, left: 0 }, ...(ngDevMode ? [{ debugName: "dropdownPosition" }] : /* istanbul ignore next */ []));
255
- this.columnFiltersForm = this.fb.group({});
256
427
  this.destroyRef.onDestroy(() => this.filterListenersCleanup?.());
257
428
  // Close the filter popup if its header cell was removed (e.g. the column
258
429
  // disappeared). Re-renders of the same columns keep the cell (tracked by
@@ -302,7 +473,29 @@ class TableComponent {
302
473
  this.pruneSelection(newData);
303
474
  });
304
475
  });
305
- // Rebuild the column filter form whenever the columns change.
476
+ // Restore the saved column widths whenever the state key/storage changes.
477
+ effect(() => {
478
+ const key = this.stateKey();
479
+ const storage = this.stateStorage();
480
+ untracked(() => {
481
+ if (!key)
482
+ return;
483
+ const saved = this.readStoredWidths(key, storage);
484
+ if (saved)
485
+ this.columnWidths.set(saved);
486
+ });
487
+ });
488
+ // Save the column widths when they change (not on every pixel of a drag).
489
+ effect(() => {
490
+ const widths = this.columnWidths();
491
+ const resizing = this.resizingField();
492
+ const key = this.stateKey();
493
+ const storage = this.stateStorage();
494
+ if (!key || resizing)
495
+ return;
496
+ untracked(() => this.writeStoredWidths(key, storage, widths));
497
+ });
498
+ // Rebuild the column filter state whenever the columns change.
306
499
  effect(() => {
307
500
  const cols = this.columns();
308
501
  untracked(() => {
@@ -326,7 +519,7 @@ class TableComponent {
326
519
  });
327
520
  // Apply the global search locally whenever the term changes.
328
521
  effect(() => {
329
- const query = this.searchQuery();
522
+ this.searchQuery();
330
523
  untracked(() => {
331
524
  if (!this.serverSide()) {
332
525
  this.applySearch();
@@ -334,85 +527,288 @@ class TableComponent {
334
527
  });
335
528
  });
336
529
  }
530
+ // ---------------------------------------------------------------------------
531
+ // Translations
532
+ // ---------------------------------------------------------------------------
337
533
  /**
338
- * Builds (or keeps) the reactive form with one control per filterable
339
- * column. The form is only rebuilt when the set of filterable
340
- * fields/filter types changes, preserving the values already typed by the
341
- * user otherwise. Previous subscriptions are unsubscribed to avoid leaks.
534
+ * Translates a key, falling back to a built-in (Spanish) label when the app
535
+ * doesn't provide it. Reads the translation signals so template calls are
536
+ * re-evaluated when the language or the loaded translations change.
342
537
  */
343
- setupColumnFilters(cols) {
344
- const filterableCols = cols.filter((c) => c.filter);
345
- const signature = filterableCols.map((c) => `${c.field}:${c.filterType ?? 'text'}`).join('|');
346
- if (signature === this.lastFilterFieldsSignature && this.columnFiltersForm) {
347
- return;
538
+ tr(key, fallback, params) {
539
+ this.translations();
540
+ this.currentLang();
541
+ const value = this.transloco.translate(key, params);
542
+ if (value && value !== key)
543
+ return value;
544
+ return fallback.replace(/\{\{\s*(\w+)\s*\}\}/g, (_, name) => String(params?.[name] ?? ''));
545
+ }
546
+ /** Translated label of a filter menu text (`table.filter.<name>`). */
547
+ filterLabel(name, params) {
548
+ return this.tr(`table.filter.${name}`, FILTER_LABELS[name] ?? name, params);
549
+ }
550
+ /** Translated label of a match mode (`table.filter.matchModes.<mode>`). */
551
+ matchModeLabel(mode) {
552
+ return this.tr(`table.filter.matchModes.${mode}`, FILTER_LABELS[mode] ?? mode);
553
+ }
554
+ // ---------------------------------------------------------------------------
555
+ // Field helpers
556
+ // ---------------------------------------------------------------------------
557
+ /** Reads a row value by field name or dot path (`'country.name'`). */
558
+ resolveField(row, path) {
559
+ if (row == null || !path)
560
+ return undefined;
561
+ if (typeof row === 'object' && path in row)
562
+ return row[path];
563
+ return path.split('.').reduce((obj, key) => (obj == null ? undefined : obj[key]), row);
564
+ }
565
+ /** Field used to filter/sort a column. */
566
+ filterFieldOf(col) {
567
+ return col.filterField || col.field;
568
+ }
569
+ /** Lowercases and strips diacritics so "garcia" matches "García". */
570
+ normalize(value) {
571
+ return String(value ?? '')
572
+ .normalize('NFD')
573
+ .replace(/[̀-ͯ]/g, '')
574
+ .toLocaleLowerCase();
575
+ }
576
+ // ---------------------------------------------------------------------------
577
+ // Column filter state
578
+ // ---------------------------------------------------------------------------
579
+ /** Internal filter kind of a column. */
580
+ filterKind(col) {
581
+ const type = col.filterType ?? 'text';
582
+ return type === 'exact' ? 'text' : type;
583
+ }
584
+ /** Match modes offered by a column's filter menu. */
585
+ matchModesFor(col) {
586
+ return MATCH_MODES[this.filterKind(col)] ?? [];
587
+ }
588
+ /** Default match mode of a column's filter. */
589
+ defaultMatchMode(col) {
590
+ if (col.filterMatchMode)
591
+ return col.filterMatchMode;
592
+ switch (this.filterKind(col)) {
593
+ case 'text':
594
+ return col.filterType === 'exact' ? 'equals' : 'contains';
595
+ case 'numeric':
596
+ return 'equals';
597
+ case 'date':
598
+ return 'dateIs';
599
+ case 'multiselect':
600
+ return 'in';
601
+ case 'range':
602
+ return 'between';
603
+ default:
604
+ return 'equals';
348
605
  }
349
- this.lastFilterFieldsSignature = signature;
350
- // Clean up previous subscriptions before rebuilding.
351
- this.columnFilterSubscriptions.forEach((sub) => sub.unsubscribe());
352
- this.columnFilterSubscriptions = [];
353
- const previousValues = {};
354
- if (this.columnFiltersForm) {
355
- Object.keys(this.columnFiltersForm.controls).forEach((field) => {
356
- previousValues[field] = this.columnFiltersForm.get(field)?.value;
357
- });
606
+ }
607
+ /** Whether the column's filter kind supports match modes / several rules. */
608
+ supportsRules(col) {
609
+ return !!MATCH_MODES[this.filterKind(col)];
610
+ }
611
+ showMatchModesFor(col) {
612
+ return this.supportsRules(col) && col.showMatchModes !== false;
613
+ }
614
+ showOperatorFor(col) {
615
+ return this.supportsRules(col) && col.showOperator !== false;
616
+ }
617
+ canAddRule(col) {
618
+ const draft = this.filterDraft();
619
+ return (this.supportsRules(col) &&
620
+ col.showAddButton !== false &&
621
+ !!draft &&
622
+ draft.rules.length < (col.maxConstraints ?? 2));
623
+ }
624
+ /** Whether changes are applied as soon as the value changes (no Apply needed). */
625
+ appliesImmediately(col) {
626
+ return !this.supportsRules(col);
627
+ }
628
+ /** Empty filter state of a column. */
629
+ emptyFilterState(col) {
630
+ return { operator: 'and', rules: [{ matchMode: this.defaultMatchMode(col), value: null }] };
631
+ }
632
+ cloneState(state) {
633
+ return {
634
+ operator: state.operator,
635
+ rules: state.rules.map((r) => ({
636
+ matchMode: r.matchMode,
637
+ value: Array.isArray(r.value) ? [...r.value] : r.value,
638
+ })),
639
+ };
640
+ }
641
+ /** Bounds of a `range` filter. */
642
+ rangeBounds(col) {
643
+ return [col.filterMin ?? 0, col.filterMax ?? 100];
644
+ }
645
+ /** Whether a rule has a value that actually filters. */
646
+ isRuleActive(col, rule) {
647
+ const value = rule.value;
648
+ if (value === null || value === undefined || value === '')
649
+ return false;
650
+ if (this.filterKind(col) === 'range') {
651
+ if (!Array.isArray(value) || value.length !== 2)
652
+ return false;
653
+ const [min, max] = this.rangeBounds(col);
654
+ return value[0] > min || value[1] < max;
358
655
  }
359
- const filterControls = {};
360
- const filterVisibility = { ...this.showFilterInput() };
361
- filterableCols.forEach((col) => {
362
- const defaultValue = col.filterType === 'select' ? null : '';
363
- const preserved = previousValues.hasOwnProperty(col.field)
364
- ? previousValues[col.field]
365
- : defaultValue;
366
- filterControls[col.field] = [preserved];
367
- if (!(col.field in filterVisibility)) {
368
- filterVisibility[col.field] = false;
369
- }
370
- });
371
- this.columnFiltersForm = this.fb.group(filterControls);
372
- this.showFilterInput.set(filterVisibility);
373
- Object.keys(this.columnFiltersForm.controls).forEach((field) => {
374
- const sub = this.columnFiltersForm
375
- .get(field)
376
- ?.valueChanges.pipe(takeUntilDestroyed(this.destroyRef))
377
- .subscribe(() => {
378
- this.first.set(0);
379
- if (this.serverSide()) {
380
- this.filterSubject.next();
656
+ if (Array.isArray(value))
657
+ return value.length > 0;
658
+ return true;
659
+ }
660
+ activeRules(col, state) {
661
+ return (state?.rules ?? []).filter((r) => this.isRuleActive(col, r));
662
+ }
663
+ /** Converts a Date / ISO string / timestamp into a local midnight timestamp. */
664
+ toDay(value) {
665
+ if (value === null || value === undefined || value === '')
666
+ return null;
667
+ let date;
668
+ if (value instanceof Date) {
669
+ date = value;
670
+ }
671
+ else if (typeof value === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(value)) {
672
+ const [y, m, d] = value.split('-').map(Number);
673
+ date = new Date(y, m - 1, d);
674
+ }
675
+ else {
676
+ date = new Date(value);
677
+ }
678
+ if (isNaN(date.getTime()))
679
+ return null;
680
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
681
+ }
682
+ /** Evaluates one rule against a cell value. */
683
+ matchRule(col, cell, rule) {
684
+ const value = rule.value;
685
+ switch (rule.matchMode) {
686
+ case 'startsWith':
687
+ return this.normalize(cell).startsWith(this.normalize(value));
688
+ case 'contains':
689
+ return this.normalize(cell).includes(this.normalize(value));
690
+ case 'notContains':
691
+ return !this.normalize(cell).includes(this.normalize(value));
692
+ case 'endsWith':
693
+ return this.normalize(cell).endsWith(this.normalize(value));
694
+ case 'equals':
695
+ case 'notEquals': {
696
+ let equal;
697
+ const kind = this.filterKind(col);
698
+ if (kind === 'numeric') {
699
+ equal = cell !== null && cell !== undefined && cell !== '' && Number(cell) === Number(value);
700
+ }
701
+ else if (kind === 'boolean') {
702
+ equal = Boolean(cell) === Boolean(value);
703
+ }
704
+ else if (kind === 'select') {
705
+ equal = cell == value;
381
706
  }
382
707
  else {
383
- this.applyFilters();
708
+ equal = this.normalize(cell) === this.normalize(value);
384
709
  }
385
- this.cdr.markForCheck();
386
- });
387
- if (sub) {
388
- this.columnFilterSubscriptions.push(sub);
710
+ return rule.matchMode === 'equals' ? equal : !equal;
711
+ }
712
+ case 'lt':
713
+ case 'lte':
714
+ case 'gt':
715
+ case 'gte': {
716
+ if (cell === null || cell === undefined || cell === '')
717
+ return false;
718
+ const a = Number(cell);
719
+ const b = Number(value);
720
+ if (isNaN(a) || isNaN(b))
721
+ return false;
722
+ if (rule.matchMode === 'lt')
723
+ return a < b;
724
+ if (rule.matchMode === 'lte')
725
+ return a <= b;
726
+ if (rule.matchMode === 'gt')
727
+ return a > b;
728
+ return a >= b;
729
+ }
730
+ case 'dateIs':
731
+ case 'dateIsNot':
732
+ case 'dateBefore':
733
+ case 'dateAfter': {
734
+ const a = this.toDay(cell);
735
+ const b = this.toDay(value);
736
+ if (b === null)
737
+ return true;
738
+ if (a === null)
739
+ return rule.matchMode === 'dateIsNot';
740
+ if (rule.matchMode === 'dateIs')
741
+ return a === b;
742
+ if (rule.matchMode === 'dateIsNot')
743
+ return a !== b;
744
+ if (rule.matchMode === 'dateBefore')
745
+ return a < b;
746
+ return a > b;
747
+ }
748
+ case 'in':
749
+ return value.some((v) => v == cell);
750
+ case 'between': {
751
+ if (cell === null || cell === undefined || cell === '')
752
+ return false;
753
+ const n = Number(cell);
754
+ return n >= value[0] && n <= value[1];
389
755
  }
756
+ default:
757
+ return true;
758
+ }
759
+ }
760
+ /**
761
+ * Keeps one filter state per filterable column. The state is only reset
762
+ * when the set of filterable fields/filter types changes, preserving what
763
+ * the user already applied otherwise.
764
+ */
765
+ setupColumnFilters(cols) {
766
+ const filterableCols = cols.filter((c) => c.filter);
767
+ const signature = filterableCols.map((c) => `${c.field}:${c.filterType ?? 'text'}`).join('|');
768
+ if (signature === this.lastFilterFieldsSignature)
769
+ return;
770
+ this.lastFilterFieldsSignature = signature;
771
+ const previous = this.filterState();
772
+ const next = {};
773
+ filterableCols.forEach((col) => {
774
+ next[col.field] = previous[col.field] ?? this.emptyFilterState(col);
390
775
  });
776
+ this.filterState.set(next);
391
777
  }
392
- /** Collects the non-empty column filter values and emits them. */
778
+ /** Collects the active column filters and emits them. */
393
779
  emitFilterChange() {
394
780
  const filters = {};
395
- Object.keys(this.columnFiltersForm.controls).forEach((field) => {
396
- const value = this.columnFiltersForm.get(field)?.value;
397
- if (value !== null && value !== undefined && value !== '') {
398
- filters[field] = value;
399
- }
781
+ const filterMeta = {};
782
+ const state = this.filterState();
783
+ this.columns().forEach((col) => {
784
+ if (!col.filter)
785
+ return;
786
+ const rules = this.activeRules(col, state[col.field]);
787
+ if (rules.length === 0)
788
+ return;
789
+ const key = this.filterFieldOf(col);
790
+ filters[key] = rules[0].value;
791
+ filterMeta[key] = this.cloneState({ operator: state[col.field].operator, rules });
400
792
  });
401
- this.filterChange.emit({ filters });
793
+ this.filterChange.emit({ filters, filterMeta });
402
794
  }
403
795
  /** Applies the global search over the original data (client mode). */
404
796
  applySearch() {
405
797
  const original = this.originalData();
406
- const query = this.searchQuery().toLowerCase();
798
+ const query = this.normalize(this.searchQuery().trim());
407
799
  if (!query) {
408
800
  this.searchedData.set([...original]);
409
801
  }
410
802
  else {
803
+ const fields = this.globalFilterFields();
411
804
  const filtered = original.filter((item) => {
412
- return Object.values(item).some((val) => {
805
+ const values = fields.length
806
+ ? fields.map((f) => this.resolveField(item, f))
807
+ : Object.values(item ?? {}).filter((v) => v === null || typeof v !== 'object' || v instanceof Date);
808
+ return values.some((val) => {
413
809
  if (val === null || val === undefined)
414
810
  return false;
415
- return String(val).toLowerCase().includes(query);
811
+ return this.normalize(val).includes(query);
416
812
  });
417
813
  });
418
814
  this.searchedData.set(filtered);
@@ -424,43 +820,53 @@ class TableComponent {
424
820
  this.applySearch();
425
821
  }
426
822
  /**
427
- * Applies every column filter on top of the searched data using each
428
- * column's `filterType` ('select', 'exact' or text contains).
823
+ * Applies every column filter on top of the searched data. The active rules
824
+ * of a column are combined with its operator (Match All / Match Any).
429
825
  */
430
826
  applyColumnFilters() {
431
- const data = this.searchedData();
432
- let filtered = [...data];
827
+ let filtered = [...this.searchedData()];
828
+ const state = this.filterState();
433
829
  this.columns().forEach((col) => {
434
- if (col.filter) {
435
- const filterValue = this.columnFiltersForm.get(col.field)?.value;
436
- if (filterValue !== null && filterValue !== undefined && filterValue !== '') {
437
- if (col.filterType === 'select') {
438
- filtered = filtered.filter((item) => item[col.field] == filterValue);
439
- }
440
- else if (col.filterType === 'exact') {
441
- const searchTerm = String(filterValue).toLowerCase();
442
- filtered = filtered.filter((item) => String(item[col.field] ?? '').toLowerCase() === searchTerm);
443
- }
444
- else {
445
- const searchTerm = String(filterValue).toLowerCase();
446
- filtered = filtered.filter((item) => String(item[col.field] ?? '').toLowerCase().includes(searchTerm));
447
- }
448
- }
449
- }
830
+ if (!col.filter)
831
+ return;
832
+ const colState = state[col.field];
833
+ const rules = this.activeRules(col, colState);
834
+ if (rules.length === 0)
835
+ return;
836
+ const field = this.filterFieldOf(col);
837
+ filtered = filtered.filter((item) => {
838
+ const cell = this.resolveField(item, field);
839
+ return colState.operator === 'or'
840
+ ? rules.some((r) => this.matchRule(col, cell, r))
841
+ : rules.every((r) => this.matchRule(col, cell, r));
842
+ });
450
843
  });
451
844
  this.filteredData.set(filtered);
452
845
  this.localTotalRecords.set(filtered.length);
453
846
  this.applySort();
454
847
  this.updateDisplayedData();
455
848
  }
849
+ /** Re-runs filtering after a filter state change. */
850
+ onFiltersChanged() {
851
+ this.first.set(0);
852
+ if (this.serverSide()) {
853
+ this.filterSubject.next();
854
+ }
855
+ else {
856
+ this.applyFilters();
857
+ }
858
+ this.cdr.markForCheck();
859
+ }
456
860
  /** Slices the filtered rows for the current page. */
457
861
  updateDisplayedData() {
458
862
  const filtered = this.filteredData();
459
863
  const firstIndex = this.first();
460
864
  const rows = this.rowsPerPageLocal();
461
- const displayed = filtered.slice(firstIndex, firstIndex + rows);
462
- this.displayedData.set(displayed);
865
+ this.displayedData.set(filtered.slice(firstIndex, firstIndex + rows));
463
866
  }
867
+ // ---------------------------------------------------------------------------
868
+ // Selection
869
+ // ---------------------------------------------------------------------------
464
870
  /** Identity used for a row inside the selection. */
465
871
  getSelectionKey(row) {
466
872
  const key = this.dataKey();
@@ -526,6 +932,158 @@ class TableComponent {
526
932
  this.selection.set(next);
527
933
  }
528
934
  }
935
+ /** CSS width of a resized column, or null when it uses the automatic width. */
936
+ resizedWidth(col) {
937
+ const width = this.isResizable() ? this.columnWidths()[col.field] : undefined;
938
+ return width ? `${width}px` : null;
939
+ }
940
+ resizedWidthPx(col) {
941
+ return this.columnWidths()[col.field] ?? null;
942
+ }
943
+ /** Header click: sorts unless the click is the end of a resize drag. */
944
+ onHeaderClick(col) {
945
+ if (this.suppressHeaderClick)
946
+ return;
947
+ if (col.field !== 'actions' && col.sortable)
948
+ this.toggleSort(col.field);
949
+ }
950
+ /** Starts dragging the right border of a header cell. */
951
+ startResize(event, col) {
952
+ if (event.button !== 0)
953
+ return;
954
+ event.preventDefault();
955
+ event.stopPropagation();
956
+ const th = event.target.closest('th');
957
+ if (!th)
958
+ return;
959
+ const startX = event.clientX;
960
+ const startWidth = th.getBoundingClientRect().width;
961
+ let moved = false;
962
+ this.resizingField.set(col.field);
963
+ const body = document.body;
964
+ const previousCursor = body.style.cursor;
965
+ const previousSelect = body.style.userSelect;
966
+ body.style.cursor = 'col-resize';
967
+ body.style.userSelect = 'none';
968
+ const onMove = (e) => {
969
+ const dx = e.clientX - startX;
970
+ if (Math.abs(dx) > 2)
971
+ moved = true;
972
+ this.setColumnWidth(col, startWidth + dx, false);
973
+ };
974
+ const onUp = () => {
975
+ document.removeEventListener('pointermove', onMove);
976
+ document.removeEventListener('pointerup', onUp);
977
+ document.removeEventListener('pointercancel', onUp);
978
+ body.style.cursor = previousCursor;
979
+ body.style.userSelect = previousSelect;
980
+ this.resizingField.set(null);
981
+ // Keep the width actually rendered (content can't shrink below its minimum).
982
+ if (moved)
983
+ this.syncRenderedWidth(col, th);
984
+ if (moved) {
985
+ this.suppressHeaderClick = true;
986
+ setTimeout(() => (this.suppressHeaderClick = false));
987
+ this.columnResize.emit({ field: col.field, width: this.columnWidths()[col.field] ?? null });
988
+ }
989
+ this.cdr.markForCheck();
990
+ };
991
+ document.addEventListener('pointermove', onMove);
992
+ document.addEventListener('pointerup', onUp);
993
+ document.addEventListener('pointercancel', onUp);
994
+ }
995
+ /** Arrow keys on the handle widen/narrow the column (Shift = bigger steps). */
996
+ onResizerKeydown(event, col) {
997
+ if (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight') {
998
+ if (event.key === 'Enter' || event.key === ' ')
999
+ event.stopPropagation();
1000
+ return;
1001
+ }
1002
+ event.preventDefault();
1003
+ event.stopPropagation();
1004
+ const th = event.target.closest('th');
1005
+ if (!th)
1006
+ return;
1007
+ const step = event.shiftKey ? 50 : 10;
1008
+ const base = this.columnWidths()[col.field] ?? th.getBoundingClientRect().width;
1009
+ this.setColumnWidth(col, base + (event.key === 'ArrowRight' ? step : -step), true);
1010
+ this.syncRenderedWidth(col, th);
1011
+ }
1012
+ /** Stores the width the column really has (it may be wider than requested). */
1013
+ syncRenderedWidth(col, th) {
1014
+ // Read it after the requested width has been rendered.
1015
+ afterNextRender({
1016
+ read: () => {
1017
+ const rendered = Math.round(th.getBoundingClientRect().width);
1018
+ if (rendered && this.columnWidths()[col.field] !== rendered) {
1019
+ this.columnWidths.update((w) => ({ ...w, [col.field]: rendered }));
1020
+ this.cdr.markForCheck();
1021
+ }
1022
+ },
1023
+ }, { injector: this.injector });
1024
+ }
1025
+ /** Resets every column to its automatic width (also clears the saved state). */
1026
+ resetColumnWidths() {
1027
+ this.columnWidths.set({});
1028
+ }
1029
+ storageFor(type) {
1030
+ try {
1031
+ return type === 'session' ? window.sessionStorage : window.localStorage;
1032
+ }
1033
+ catch {
1034
+ return null; // storage blocked (privacy mode, sandboxed iframe...)
1035
+ }
1036
+ }
1037
+ /** Reads saved widths, ignoring missing, invalid or blocked storage. */
1038
+ readStoredWidths(key, type) {
1039
+ try {
1040
+ const raw = this.storageFor(type)?.getItem(`${key}:columnWidths`);
1041
+ if (!raw)
1042
+ return null;
1043
+ const parsed = JSON.parse(raw);
1044
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
1045
+ return null;
1046
+ const widths = {};
1047
+ Object.entries(parsed).forEach(([field, width]) => {
1048
+ if (typeof width === 'number' && isFinite(width) && width > 0)
1049
+ widths[field] = width;
1050
+ });
1051
+ return widths;
1052
+ }
1053
+ catch {
1054
+ return null;
1055
+ }
1056
+ }
1057
+ writeStoredWidths(key, type, widths) {
1058
+ try {
1059
+ const storage = this.storageFor(type);
1060
+ if (!storage)
1061
+ return;
1062
+ if (Object.keys(widths).length === 0)
1063
+ storage.removeItem(`${key}:columnWidths`);
1064
+ else
1065
+ storage.setItem(`${key}:columnWidths`, JSON.stringify(widths));
1066
+ }
1067
+ catch {
1068
+ // Quota exceeded or storage blocked: widths just aren't persisted.
1069
+ }
1070
+ }
1071
+ /** Resets a column to its automatic width (double click on the handle). */
1072
+ resetColumnWidth(col) {
1073
+ const { [col.field]: _removed, ...rest } = this.columnWidths();
1074
+ this.columnWidths.set(rest);
1075
+ this.columnResize.emit({ field: col.field, width: null });
1076
+ }
1077
+ setColumnWidth(col, width, emit) {
1078
+ const next = Math.max(this.MIN_COLUMN_WIDTH, Math.round(width));
1079
+ this.columnWidths.update((w) => ({ ...w, [col.field]: next }));
1080
+ if (emit)
1081
+ this.columnResize.emit({ field: col.field, width: next });
1082
+ this.cdr.markForCheck();
1083
+ }
1084
+ // ---------------------------------------------------------------------------
1085
+ // Sorting & search
1086
+ // ---------------------------------------------------------------------------
529
1087
  /** Emits the filter chip clicked in the template. */
530
1088
  onFilterClick(value) {
531
1089
  this.filterClick.emit(value);
@@ -554,16 +1112,21 @@ class TableComponent {
554
1112
  const order = this.sortOrder();
555
1113
  if (!field)
556
1114
  return;
1115
+ const col = this.columns().find((c) => c.field === field);
1116
+ const path = col ? this.filterFieldOf(col) : field;
557
1117
  const data = [...this.filteredData()];
558
1118
  data.sort((a, b) => {
559
- const va = a[field];
560
- const vb = b[field];
1119
+ const va = this.resolveField(a, path);
1120
+ const vb = this.resolveField(b, path);
561
1121
  if (va == null && vb == null)
562
1122
  return 0;
563
1123
  if (va == null)
564
1124
  return 1; // nulls always at the end
565
1125
  if (vb == null)
566
1126
  return -1;
1127
+ if (typeof va === 'string' && typeof vb === 'string') {
1128
+ return va.localeCompare(vb, undefined, { numeric: true, sensitivity: 'base' }) * order;
1129
+ }
567
1130
  if (va < vb)
568
1131
  return -1 * order;
569
1132
  if (va > vb)
@@ -580,26 +1143,171 @@ class TableComponent {
580
1143
  this.searchSubject.next(value);
581
1144
  }
582
1145
  }
583
- /** Clears a column filter value and hides its input. */
1146
+ // ---------------------------------------------------------------------------
1147
+ // Filter menu
1148
+ // ---------------------------------------------------------------------------
1149
+ /** Whether a column has an applied (non-empty) filter. */
1150
+ hasFilterValue(field) {
1151
+ const col = this.columns().find((c) => c.field === field);
1152
+ if (!col)
1153
+ return false;
1154
+ return this.activeRules(col, this.filterState()[field]).length > 0;
1155
+ }
1156
+ /** Commits the draft of a column into the applied filter state. */
1157
+ commitDraft(col) {
1158
+ const draft = this.filterDraft();
1159
+ if (!draft)
1160
+ return;
1161
+ this.filterState.update((s) => ({ ...s, [col.field]: this.cloneState(draft) }));
1162
+ this.onFiltersChanged();
1163
+ }
1164
+ setDraftOperator(operator) {
1165
+ this.filterDraft.update((d) => (d ? { ...d, operator } : d));
1166
+ }
1167
+ setDraftMatchMode(col, index, matchMode) {
1168
+ this.filterDraft.update((d) => d ? { ...d, rules: d.rules.map((r, i) => (i === index ? { ...r, matchMode } : r)) } : d);
1169
+ }
1170
+ setDraftValue(col, index, value) {
1171
+ this.filterDraft.update((d) => d ? { ...d, rules: d.rules.map((r, i) => (i === index ? { ...r, value } : r)) } : d);
1172
+ if (this.appliesImmediately(col))
1173
+ this.commitDraft(col);
1174
+ }
1175
+ /** Raw value typed in a rule input, converted for its filter kind. */
1176
+ onRuleInput(col, index, raw) {
1177
+ const kind = this.filterKind(col);
1178
+ const value = kind === 'numeric' ? this.numericValue(raw) : kind === 'date' ? raw || null : raw;
1179
+ this.setDraftValue(col, index, value);
1180
+ }
1181
+ /** Value of a numeric input (`null` when empty). */
1182
+ numericValue(raw) {
1183
+ return raw === '' || raw === null || isNaN(Number(raw)) ? null : Number(raw);
1184
+ }
1185
+ addRule(col) {
1186
+ if (!this.canAddRule(col))
1187
+ return;
1188
+ this.filterDraft.update((d) => d ? { ...d, rules: [...d.rules, { matchMode: this.defaultMatchMode(col), value: null }] } : d);
1189
+ }
1190
+ removeRule(index) {
1191
+ this.filterDraft.update((d) => d && d.rules.length > 1 ? { ...d, rules: d.rules.filter((_, i) => i !== index) } : d);
1192
+ }
1193
+ /** Applies the draft (Apply button / Enter) and closes the menu. */
1194
+ applyFilter(col) {
1195
+ this.commitDraft(col);
1196
+ this.closeFilters();
1197
+ }
1198
+ /** Clears a column filter and closes its menu. */
584
1199
  clearFilter(field) {
585
- const column = this.columns().find((col) => col.field === field);
586
- const value = column?.filterType === 'select' ? null : '';
587
- this.columnFiltersForm.get(field)?.setValue(value);
1200
+ const col = this.columns().find((c) => c.field === field);
1201
+ if (!col)
1202
+ return;
1203
+ this.filterState.update((s) => ({ ...s, [field]: this.emptyFilterState(col) }));
1204
+ this.onFiltersChanged();
588
1205
  this.closeFilters();
589
1206
  }
1207
+ /** Multiselect helpers. */
1208
+ isOptionSelected(value) {
1209
+ const current = this.filterDraft()?.rules[0]?.value;
1210
+ return Array.isArray(current) && current.some((v) => v == value);
1211
+ }
1212
+ toggleOption(col, value) {
1213
+ const current = this.filterDraft()?.rules[0]?.value ?? [];
1214
+ const next = current.some((v) => v == value)
1215
+ ? current.filter((v) => v != value)
1216
+ : [...current, value];
1217
+ this.setDraftValue(col, 0, next.length ? next : null);
1218
+ }
1219
+ selectedOptionsLabel(col) {
1220
+ const current = this.filterDraft()?.rules[0]?.value ?? [];
1221
+ if (!current.length)
1222
+ return '';
1223
+ const labels = (col.filterOptions ?? [])
1224
+ .filter((o) => current.some((v) => v == o.value))
1225
+ .map((o) => o.label);
1226
+ return labels.length > 2
1227
+ ? this.filterLabel('selectedCount', { count: labels.length })
1228
+ : labels.join(', ');
1229
+ }
1230
+ /** Select filter: picks an option (clicking the selected one clears it) and collapses the list. */
1231
+ selectOption(col, value) {
1232
+ const current = this.filterDraft()?.rules[0]?.value;
1233
+ this.setDraftValue(col, 0, current != null && current == value ? null : value);
1234
+ this.multiselectOpen.set(false);
1235
+ }
1236
+ selectedSingleLabel(col) {
1237
+ const current = this.filterDraft()?.rules[0]?.value;
1238
+ if (current === null || current === undefined)
1239
+ return '';
1240
+ return (col.filterOptions ?? []).find((o) => o.value == current)?.label ?? String(current);
1241
+ }
1242
+ /** Boolean filter: cycles any → true → false → any. */
1243
+ cycleBoolean(col) {
1244
+ const current = this.filterDraft()?.rules[0]?.value;
1245
+ const next = current === null || current === undefined ? true : current === true ? false : null;
1246
+ this.setDraftValue(col, 0, next);
1247
+ }
1248
+ /** Current [low, high] of a range filter draft. */
1249
+ rangeValue(col) {
1250
+ const value = this.filterDraft()?.rules[0]?.value;
1251
+ return Array.isArray(value) ? [value[0], value[1]] : this.rangeBounds(col);
1252
+ }
1253
+ /** Updates one thumb of the range slider; `commit` applies it (on release). */
1254
+ onRangeInput(col, thumb, raw, commit) {
1255
+ const [low, high] = this.rangeValue(col);
1256
+ const n = Number(raw);
1257
+ const next = thumb === 0 ? [Math.min(n, high), high] : [low, Math.max(n, low)];
1258
+ // A range covering the full bounds is treated as "no filter" (see isRuleActive).
1259
+ this.filterDraft.update((d) => d ? { ...d, rules: d.rules.map((r, i) => (i === 0 ? { ...r, value: next } : r)) } : d);
1260
+ if (commit)
1261
+ this.commitDraft(col);
1262
+ }
1263
+ /** Position (0-100%) of a range value on the track. */
1264
+ rangePercent(col, value) {
1265
+ const [min, max] = this.rangeBounds(col);
1266
+ return max === min ? 0 : ((value - min) / (max - min)) * 100;
1267
+ }
1268
+ /**
1269
+ * Resets the global search, every column filter, the sort and the page
1270
+ * (the "Clear" button).
1271
+ */
1272
+ clearAll() {
1273
+ const state = {};
1274
+ this.columns()
1275
+ .filter((c) => c.filter)
1276
+ .forEach((col) => (state[col.field] = this.emptyFilterState(col)));
1277
+ this.filterState.set(state);
1278
+ this.closeFilters();
1279
+ const hadSearch = !!this.searchQuery();
1280
+ this.searchQuery.set('');
1281
+ this.sortField.set(this.defaultSortField());
1282
+ this.sortOrder.set(this.defaultSortOrder());
1283
+ this.first.set(0);
1284
+ if (this.serverSide()) {
1285
+ this.emitFilterChange();
1286
+ if (hadSearch)
1287
+ this.searchChange.emit('');
1288
+ }
1289
+ else {
1290
+ this.applyFilters();
1291
+ }
1292
+ this.cdr.markForCheck();
1293
+ }
590
1294
  /**
591
- * Toggles a column filter popup. Only one popup is open at a time. The
592
- * popup uses `position: fixed` anchored to the filter button, so the
593
- * header cell (`overflow: hidden`) and the scroll wrapper can't clip it.
1295
+ * Toggles a column filter menu. Only one menu is open at a time. The menu
1296
+ * uses `position: fixed` anchored to the filter button, so the header cell
1297
+ * and the scroll wrapper can't clip it. Edits go to a draft that is applied
1298
+ * with the Apply button (select/multiselect/boolean/range apply instantly).
594
1299
  */
595
- toggleFilter(field, event) {
596
- const wasOpen = !!this.showFilterInput()[field];
1300
+ toggleFilter(col, event) {
1301
+ const wasOpen = this.openFilterField() === col.field;
597
1302
  this.closeFilters();
598
1303
  if (wasOpen)
599
1304
  return;
600
1305
  this.filterAnchor = event?.currentTarget ?? null;
601
1306
  this.updateFilterPopupPosition();
602
- this.showFilterInput.set({ ...this.showFilterInput(), [field]: true });
1307
+ const applied = this.filterState()[col.field] ?? this.emptyFilterState(col);
1308
+ this.filterDraft.set(this.cloneState(applied));
1309
+ this.multiselectOpen.set(false);
1310
+ this.openFilterField.set(col.field);
603
1311
  const reposition = () => this.updateFilterPopupPosition();
604
1312
  window.addEventListener('scroll', reposition, true);
605
1313
  window.addEventListener('resize', reposition);
@@ -607,94 +1315,73 @@ class TableComponent {
607
1315
  window.removeEventListener('scroll', reposition, true);
608
1316
  window.removeEventListener('resize', reposition);
609
1317
  };
610
- setTimeout(() => document.getElementById(`${this.uid}-filter-${field}`)?.focus());
1318
+ setTimeout(() => document.querySelector(`#${this.uid}-filter-${this.safeId(col.field)}-0`)?.focus());
611
1319
  this.cdr.markForCheck();
612
1320
  }
613
- /** Closes every column filter popup (values are kept). */
1321
+ /** Field name usable inside an element id. */
1322
+ safeId(field) {
1323
+ return field.replace(/[^a-zA-Z0-9_-]/g, '_');
1324
+ }
1325
+ /** Closes the column filter menu (unapplied draft changes are discarded). */
614
1326
  closeFilters() {
615
1327
  this.filterListenersCleanup?.();
616
1328
  this.filterListenersCleanup = null;
617
1329
  this.filterAnchor = null;
618
- const visibility = this.showFilterInput();
619
- if (Object.values(visibility).some((v) => v)) {
620
- const closed = {};
621
- Object.keys(visibility).forEach((key) => (closed[key] = false));
622
- this.showFilterInput.set(closed);
1330
+ if (this.openFilterField() !== null) {
1331
+ this.openFilterField.set(null);
1332
+ this.filterDraft.set(null);
623
1333
  this.cdr.markForCheck();
624
1334
  }
625
1335
  }
626
- /** Places the filter popup under its button, clamped to the viewport. */
1336
+ /** Places the filter menu under its button, clamped to the viewport. */
627
1337
  updateFilterPopupPosition() {
628
1338
  if (!this.filterAnchor)
629
1339
  return;
630
1340
  const rect = this.filterAnchor.getBoundingClientRect();
631
1341
  const maxLeft = window.innerWidth - this.FILTER_POPUP_WIDTH - 8;
632
- const left = Math.max(8, Math.min(rect.right - this.FILTER_POPUP_WIDTH, maxLeft));
633
- this.filterPopupPosition.set({ top: rect.bottom + 6, left });
634
- }
635
- /**
636
- * Whether a column filter is non-empty. Avoids treating the number 0 as
637
- * "no value".
638
- */
639
- hasFilterValue(field) {
640
- const value = this.columnFiltersForm.get(field)?.value;
641
- return value !== null && value !== undefined && value !== '';
1342
+ const left = Math.max(8, Math.min(rect.left, maxLeft));
1343
+ const top = rect.bottom + 6;
1344
+ this.filterPopupPosition.set({
1345
+ top,
1346
+ left,
1347
+ maxHeight: Math.max(200, window.innerHeight - top - 12),
1348
+ });
642
1349
  }
1350
+ // ---------------------------------------------------------------------------
1351
+ // Pagination
1352
+ // ---------------------------------------------------------------------------
643
1353
  /** Returns the reactive page report string (template helper). */
644
1354
  getPageReport() {
645
1355
  return this.pageReport();
646
1356
  }
647
- /** Goes to the first page (emits pageChange in server-side mode). */
648
- goToFirst() {
1357
+ /** Goes to a page (0-based), emitting pageChange in server-side mode. */
1358
+ goToPage(page) {
649
1359
  const rows = this.rowsPerPageLocal();
650
- this.first.set(0);
1360
+ const total = this.effectiveTotalRecords();
1361
+ const pageCount = Math.max(1, Math.ceil(total / rows));
1362
+ const target = Math.min(Math.max(0, page), pageCount - 1);
1363
+ const first = target * rows;
1364
+ this.first.set(first);
651
1365
  if (this.serverSide()) {
652
- this.pageChange.emit({
653
- first: 0,
654
- rows,
655
- page: 0,
656
- pageCount: Math.ceil(this.totalRecords() / rows),
657
- });
1366
+ this.pageChange.emit({ first, rows, page: target, pageCount: Math.ceil(total / rows) });
658
1367
  }
659
1368
  else {
660
1369
  this.updateDisplayedData();
661
1370
  }
662
1371
  }
1372
+ /** Goes to the first page (emits pageChange in server-side mode). */
1373
+ goToFirst() {
1374
+ this.goToPage(0);
1375
+ }
663
1376
  /** Goes to the last page (emits pageChange in server-side mode). */
664
1377
  goToLast() {
665
- const total = this.serverSide() ? this.totalRecords() : this.filteredData().length;
666
- const rows = this.rowsPerPageLocal();
667
- const lastFirst = Math.max(0, Math.ceil(total / rows) * rows - rows);
668
- this.first.set(lastFirst);
669
- if (this.serverSide()) {
670
- const page = Math.floor(lastFirst / rows);
671
- this.pageChange.emit({
672
- first: lastFirst,
673
- rows,
674
- page,
675
- pageCount: Math.ceil(total / rows),
676
- });
677
- }
678
- else {
679
- this.updateDisplayedData();
680
- }
1378
+ this.goToPage(this.totalPages() - 1);
681
1379
  }
682
1380
  /** Updates rows-per-page and resets to the first page. */
683
1381
  onRowsPerPageChange(rows) {
684
1382
  rows = Number(rows);
685
1383
  this.rowsPerPageLocal.set(rows);
686
- this.first.set(0);
687
- if (this.serverSide()) {
688
- this.pageChange.emit({
689
- first: 0,
690
- rows,
691
- page: 0,
692
- pageCount: Math.ceil(this.totalRecords() / rows),
693
- });
694
- }
695
- else {
696
- this.updateDisplayedData();
697
- }
1384
+ this.goToPage(0);
698
1385
  }
699
1386
  /** Emits the refresh output. */
700
1387
  refreshData() {
@@ -706,57 +1393,23 @@ class TableComponent {
706
1393
  }
707
1394
  /** Whether the current page is the last one. */
708
1395
  isLastPage() {
709
- const total = this.effectiveTotalRecords();
710
- return this.first() + this.rowsPerPageLocal() >= total;
1396
+ return this.first() + this.rowsPerPageLocal() >= this.effectiveTotalRecords();
711
1397
  }
712
1398
  /** Moves to the next page (emits pageChange in server-side mode). */
713
1399
  next() {
714
- const total = this.serverSide() ? this.totalRecords() : this.filteredData().length;
715
- const rows = this.rowsPerPageLocal();
716
- let first = this.first() + rows;
717
- if (first >= total) {
718
- first = total - rows;
719
- }
720
- this.first.set(first);
721
- if (this.serverSide()) {
722
- const page = Math.floor(first / rows);
723
- this.pageChange.emit({
724
- first,
725
- rows,
726
- page,
727
- pageCount: Math.ceil(total / rows),
728
- });
729
- }
730
- else {
731
- this.updateDisplayedData();
732
- }
1400
+ this.goToPage(this.currentPage());
733
1401
  }
734
1402
  /** Moves to the previous page (emits pageChange in server mode). */
735
1403
  prev() {
736
- const rows = this.rowsPerPageLocal();
737
- let first = this.first() - rows;
738
- const total = this.serverSide() ? this.totalRecords() : this.filteredData().length;
739
- if (first < 0) {
740
- first = 0;
741
- }
742
- this.first.set(first);
743
- if (this.serverSide()) {
744
- const page = Math.floor(first / rows);
745
- this.pageChange.emit({
746
- first,
747
- rows,
748
- page,
749
- pageCount: Math.ceil(total / rows),
750
- });
751
- }
752
- else {
753
- this.updateDisplayedData();
754
- }
1404
+ this.goToPage(this.currentPage() - 2);
755
1405
  }
756
1406
  /** Resets the table to the first page. */
757
1407
  reset() {
758
1408
  this.goToFirst();
759
1409
  }
1410
+ // ---------------------------------------------------------------------------
1411
+ // Actions & cells
1412
+ // ---------------------------------------------------------------------------
760
1413
  /** Resolves the row action label, static or per-row function. */
761
1414
  getRowActionLabel(action, rowData) {
762
1415
  return typeof action.label === 'function' ? action.label(rowData) : action.label;
@@ -802,11 +1455,16 @@ class TableComponent {
802
1455
  if (value === null || value === undefined)
803
1456
  return '';
804
1457
  const str = String(value);
805
- return str.length > limit ? str.slice(0, limit) + '\u2026' : str;
1458
+ return str.length > limit ? str.slice(0, limit) + '…' : str;
1459
+ }
1460
+ /** Value of a `progress` cell clamped to 0-100. */
1461
+ getProgress(col, rowData) {
1462
+ const n = Number(this.resolveField(rowData, col.field));
1463
+ return isNaN(n) ? 0 : Math.max(0, Math.min(100, n));
806
1464
  }
807
1465
  /** Resolves the value displayed inside a tag cell, static or per-row function. */
808
1466
  getTagValue(col, rowData) {
809
- return col.tagValue ? col.tagValue(rowData) : String(rowData[col.field] ?? '');
1467
+ return col.tagValue ? col.tagValue(rowData) : String(this.resolveField(rowData, col.field) ?? '');
810
1468
  }
811
1469
  /** Resolves and validates the tag severity, falling back to 'secondary'. */
812
1470
  getTagSeverity(col, rowData) {
@@ -847,7 +1505,7 @@ class TableComponent {
847
1505
  onHeaderKeydown(event, col) {
848
1506
  if (col.field === 'actions' || !col.sortable)
849
1507
  return;
850
- // Ignore keys typed inside the filter popup (e.g. spaces in the input).
1508
+ // Ignore keys typed inside the header buttons.
851
1509
  if (event.target !== event.currentTarget)
852
1510
  return;
853
1511
  if (event.key === 'Enter' || event.key === ' ') {
@@ -922,25 +1580,24 @@ class TableComponent {
922
1580
  }
923
1581
  this.closeFilters();
924
1582
  }
925
- /** Closes the column filter popup with Escape. */
1583
+ /** Closes the column filter menu with Escape. */
926
1584
  onEscape() {
927
1585
  this.closeFilters();
928
1586
  }
929
1587
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
930
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.23", type: TableComponent, isStandalone: true, selector: "shk-table", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, rowsPerPage: { classPropertyName: "rowsPerPage", publicName: "rowsPerPage", isSignal: true, isRequired: false, transformFunction: null }, rowsPerPageOptions: { classPropertyName: "rowsPerPageOptions", publicName: "rowsPerPageOptions", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, showActionRow: { classPropertyName: "showActionRow", publicName: "showActionRow", isSignal: true, isRequired: false, transformFunction: null }, customTemplates: { classPropertyName: "customTemplates", publicName: "customTemplates", isSignal: true, isRequired: false, transformFunction: null }, headerActions: { classPropertyName: "headerActions", publicName: "headerActions", isSignal: true, isRequired: false, transformFunction: null }, rowActions: { classPropertyName: "rowActions", publicName: "rowActions", isSignal: true, isRequired: false, transformFunction: null }, hasShadow: { classPropertyName: "hasShadow", publicName: "hasShadow", isSignal: true, isRequired: false, transformFunction: null }, defaultSortField: { classPropertyName: "defaultSortField", publicName: "defaultSortField", isSignal: true, isRequired: false, transformFunction: null }, defaultSortOrder: { classPropertyName: "defaultSortOrder", publicName: "defaultSortOrder", isSignal: true, isRequired: false, transformFunction: null }, showSearch: { classPropertyName: "showSearch", publicName: "showSearch", isSignal: true, isRequired: false, transformFunction: null }, searchPlaceholder: { classPropertyName: "searchPlaceholder", publicName: "searchPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, serverSide: { classPropertyName: "serverSide", publicName: "serverSide", isSignal: true, isRequired: false, transformFunction: null }, totalRecords: { classPropertyName: "totalRecords", publicName: "totalRecords", isSignal: true, isRequired: false, transformFunction: null }, filters: { classPropertyName: "filters", publicName: "filters", isSignal: true, isRequired: false, transformFunction: null }, activeFilter: { classPropertyName: "activeFilter", publicName: "activeFilter", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, dataKey: { classPropertyName: "dataKey", publicName: "dataKey", isSignal: true, isRequired: false, transformFunction: null }, isRowSelectable: { classPropertyName: "isRowSelectable", publicName: "isRowSelectable", isSignal: true, isRequired: false, transformFunction: null }, bulkActions: { classPropertyName: "bulkActions", publicName: "bulkActions", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selection: "selectionChange", refresh: "refresh", pageChange: "pageChange", filterChange: "filterChange", searchChange: "searchChange", filterClick: "filterClick" }, host: { listeners: { "document:click": "onDocumentClick()", "document:keydown.escape": "onEscape()" } }, ngImport: i0, template: "<div class=\"space-y-2 min-[1440px]:space-y-3 mt-2 min-[1440px]:mt-3 animate-fade-in pb-8\">\n @if (\n showSearch() ||\n filters().length > 0 ||\n headerActions().length > 0 ||\n (selectable() && bulkActions().length > 0 && selection().length > 0)\n ) {\n <div class=\"card p-2 min-[1440px]:p-2.5 flex flex-row items-center justify-between gap-2\">\n <div class=\"flex items-center gap-2 min-[1440px]:gap-3 flex-1 min-w-0\">\n @if (showSearch()) {\n <div class=\"relative w-full md:w-52 min-[1440px]:w-56\">\n <label [for]=\"uid + '-search'\" class=\"sr-only\">{{\n searchPlaceholder() || ('common.search_placeholder' | transloco)\n }}</label>\n <div class=\"absolute inset-y-0 left-0 pl-2.5 flex items-center pointer-events-none\">\n <svg\n [lucideIcon]=\"getIcon('search')\"\n class=\"w-3.5 h-3.5 _shk-text-surface-400 dark:[color:var(--shk-surface-500)]\"\n ></svg>\n </div>\n <input\n [id]=\"uid + '-search'\"\n type=\"text\"\n [value]=\"searchQuery()\"\n (input)=\"onSearchInput($any($event.target).value)\"\n [placeholder]=\"searchPlaceholder() || ('common.search_placeholder' | transloco)\"\n class=\"block w-full pl-8 pr-3 py-1.5 text-xs border _shk-border dark:[border-color:var(--shk-surface-200)] rounded-md leading-5 _shk-bg-surface-50 dark:[background-color:var(--shk-surface-100)] placeholder:[color:var(--shk-surface-400)] dark:placeholder:[color:var(--shk-surface-500)] _shk-text-surface-700 dark:[color:var(--shk-surface-700)] focus:outline-none focus:bg-white dark:focus:[background-color:var(--shk-surface-800)] focus:[border-color:var(--shk-primary-500)] focus:ring-1 focus:[--tw-ring-color:var(--shk-primary-500)]\"\n />\n </div>\n }\n @if (filters().length > 0) {\n <div\n class=\"flex _shk-bg-surface-100 dark:[background-color:var(--shk-surface-100)] p-0.5 rounded-md ml-auto\"\n role=\"group\"\n >\n @for (f of filters(); track f.value) {\n <button\n type=\"button\"\n (click)=\"onFilterClick(f.value)\"\n [attr.aria-pressed]=\"f.value === activeFilter()\"\n class=\"px-2.5 min-[1440px]:px-3 py-1 text-xs font-medium rounded _shk-text-surface-700 dark:[color:var(--shk-surface-700)] transition-all\"\n [class]=\"\n f.value === activeFilter()\n ? 'bg-white shadow-sm dark:[background-color:var(--shk-surface-700)]'\n : ''\n \"\n >\n {{ f.label }}\n </button>\n }\n </div>\n }\n </div>\n @if (selectable() && selection().length > 0 && bulkActions().length > 0) {\n <div\n class=\"flex items-center gap-1.5 shrink-0\"\n role=\"toolbar\"\n [attr.aria-label]=\"'table.selected' | transloco: { count: selection().length }\"\n >\n <span\n class=\"text-xs font-medium _shk-text-surface-600 dark:[color:var(--shk-surface-400)] whitespace-nowrap\"\n aria-live=\"polite\"\n >{{ 'table.selected' | transloco: { count: selection().length } }}</span\n >\n <button\n type=\"button\"\n (click)=\"clearSelection()\"\n [attr.aria-label]=\"'table.clearSelection' | transloco\"\n class=\"table-action-btn rounded-md _shk-text-surface-500 dark:[color:var(--shk-surface-400)] hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)]\"\n >\n <svg [lucideIcon]=\"getIcon('x')\" class=\"w-3.5 h-3.5\"></svg>\n </button>\n @for (action of visibleBulkActions(); track $index) {\n <button\n type=\"button\"\n [class]=\"\n 'inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors disabled:opacity-50 disabled:cursor-not-allowed ' +\n (action.class || '')\n \"\n [disabled]=\"isBulkActionDisabled(action)\"\n [attr.aria-label]=\"action.label\"\n (click)=\"runBulkAction(action)\"\n >\n @if (action.icon) {\n <svg [lucideIcon]=\"getIcon(action.icon)\" class=\"w-3.5 h-3.5\"></svg>\n }\n {{ action.label }}\n </button>\n }\n </div>\n }\n @if (headerActions().length > 0) {\n <div class=\"flex items-center gap-1.5 shrink-0\">\n @for (action of headerActions(); track $index) {\n @if (isHeaderActionVisible(action)) {\n <button\n type=\"button\"\n [class]=\"\n 'inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors disabled:opacity-50 disabled:cursor-not-allowed ' +\n (action.class || '')\n \"\n [disabled]=\"isHeaderActionDisabled(action)\"\n [attr.aria-label]=\"action.label\"\n (click)=\"action.onClick()\"\n >\n @if (action.icon) {\n <svg [lucideIcon]=\"getIcon(action.icon)\" class=\"w-3.5 h-3.5\"></svg>\n }\n {{ action.label }}\n </button>\n }\n }\n </div>\n }\n </div>\n }\n <div class=\"card p-0 overflow-hidden table-card\" [class.shadow-lg]=\"hasShadow()\">\n <div class=\"table-scroll-wrapper _shk-scrollbar\">\n <table>\n <thead>\n <tr>\n @if (selectable()) {\n <th\n scope=\"col\"\n data-shk-select\n class=\"w-10 px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-center _shk-bg-surface-50 dark:[background-color:var(--shk-surface-100)] border-b _shk-border dark:[border-color:var(--shk-surface-200)]\"\n >\n <input\n type=\"checkbox\"\n class=\"shk-table-checkbox\"\n [checked]=\"allPageSelected()\"\n [indeterminate]=\"somePageSelected()\"\n [disabled]=\"loading() || selectablePageRows().length === 0\"\n (change)=\"toggleSelectAllPage()\"\n [attr.aria-label]=\"'table.selectAll' | transloco\"\n />\n </th>\n }\n @for (col of columnsWithActions(); track col.field) {\n <th\n scope=\"col\"\n (click)=\"col.field !== 'actions' && col.sortable && toggleSort(col.field)\"\n (keydown)=\"onHeaderKeydown($event, col)\"\n [tabindex]=\"col.field !== 'actions' && col.sortable ? 0 : -1\"\n [attr.role]=\"col.field !== 'actions' && col.sortable ? 'button' : null\"\n [attr.aria-sort]=\"getAriaSort(col)\"\n [attr.data-shk-actions]=\"col.field === 'actions' ? '' : null\"\n [style.cursor]=\"col.field !== 'actions' && col.sortable ? 'pointer' : 'default'\"\n [style.width]=\"col.field === 'actions' ? col.width : null\"\n [style.min-width]=\"col.field === 'actions' ? col.width : null\"\n [style.--shk-col-width]=\"col.field !== 'actions' ? getColumnWidth(col) : null\"\n class=\"relative px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-left text-[10px] min-[1440px]:text-xs font-bold _shk-text-surface-500 dark:[color:var(--shk-surface-400)] uppercase tracking-wider _shk-bg-surface-50 dark:[background-color:var(--shk-surface-100)] border-b _shk-border dark:[border-color:var(--shk-surface-200)] focus:outline-none focus-visible:ring-1 focus-visible:[--tw-ring-color:var(--shk-primary-500)]\"\n >\n @if (col.field !== 'actions') {\n <div class=\"flex items-center justify-between gap-2\">\n <span>{{ col.header }}</span>\n <div class=\"flex items-center gap-1 shrink-0\">\n @if (col.sortable) {\n <shk-tooltip [text]=\"'table.tooltips.sort' | transloco\">\n @if (sortField() === col.field) {\n <svg\n [lucideIcon]=\"getIcon(sortOrder() === 1 ? 'arrow-up' : 'arrow-down')\"\n class=\"w-3.5 h-3.5 _shk-text-primary\"\n ></svg>\n } @else {\n <svg\n [lucideIcon]=\"getIcon('arrow-up-down')\"\n class=\"w-3.5 h-3.5 _shk-text-surface-400 dark:[color:var(--shk-surface-500)]\"\n ></svg>\n }\n </shk-tooltip>\n }\n @if (col.filter) {\n <shk-tooltip [text]=\"'table.tooltips.filter' | transloco\">\n <button\n type=\"button\"\n (click)=\"$event.stopPropagation(); toggleFilter(col.field, $event)\"\n [attr.aria-label]=\"'table.tooltips.filter' | transloco\"\n [attr.aria-expanded]=\"showFilterInput()[col.field] || false\"\n class=\"_shk-text-surface-400 dark:[color:var(--shk-surface-500)] hover:[color:var(--shk-surface-600)] dark:hover:[color:var(--shk-surface-300)] transition-colors\"\n >\n <svg\n [lucideIcon]=\"getIcon('filter')\"\n class=\"w-3.5 h-3.5\"\n [class._shk-text-primary]=\"hasFilterValue(col.field)\"\n ></svg>\n </button>\n </shk-tooltip>\n }\n </div>\n </div>\n @if (col.filter && showFilterInput()[col.field]) {\n <div\n shkPortal\n class=\"fixed z-[9999] p-2 w-[200px] normal-case tracking-normal font-normal bg-white dark:[background-color:var(--shk-surface-100)] border _shk-border dark:[border-color:var(--shk-surface-200)] rounded-lg shadow-lg\"\n [style.top]=\"filterPopupPosition().top + 'px'\"\n [style.left]=\"filterPopupPosition().left + 'px'\"\n [formGroup]=\"columnFiltersForm\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"$event.stopPropagation()\"\n (keydown.escape)=\"closeFilters()\"\n >\n <div class=\"relative\">\n @if (col.filterType !== 'select') {\n <label [for]=\"uid + '-filter-' + col.field\" class=\"sr-only\">{{\n col.filterPlaceholder || ('common.search_placeholder' | transloco)\n }}</label>\n <input\n [id]=\"uid + '-filter-' + col.field\"\n type=\"text\"\n [formControlName]=\"col.field\"\n class=\"w-full px-3 py-1.5 text-sm rounded-md border _shk-border dark:[border-color:var(--shk-surface-200)] bg-white dark:[background-color:var(--shk-surface-100)] _shk-text-surface-700 dark:[color:var(--shk-surface-700)] focus:[border-color:var(--shk-primary-500)] focus:ring-1 focus:[--tw-ring-color:var(--shk-primary-500)] placeholder:[color:var(--shk-surface-400)] dark:placeholder:[color:var(--shk-surface-500)]\"\n [placeholder]=\"\n col.filterPlaceholder || ('common.search_placeholder' | transloco)\n \"\n />\n }\n @if (col.filterType === 'select') {\n <label [for]=\"uid + '-filter-' + col.field\" class=\"sr-only\">{{\n col.filterPlaceholder || ('common.search_placeholder' | transloco)\n }}</label>\n <select\n [id]=\"uid + '-filter-' + col.field\"\n [formControlName]=\"col.field\"\n class=\"w-full px-2 py-1 text-xs rounded-md border _shk-border dark:[border-color:var(--shk-surface-200)] bg-white dark:[background-color:var(--shk-surface-100)] _shk-text-surface-700 dark:[color:var(--shk-surface-700)] focus:[border-color:var(--shk-primary-500)] focus:ring-1 focus:[--tw-ring-color:var(--shk-primary-500)] appearance-none\"\n >\n <option [ngValue]=\"null\">{{ 'table.filterAll' | transloco }}</option>\n @for (opt of col.filterOptions || []; track opt.value) {\n <option [ngValue]=\"opt.value\">{{ opt.label }}</option>\n }\n </select>\n }\n @if (hasFilterValue(col.field) && col.filterType !== 'select') {\n <button\n type=\"button\"\n class=\"absolute right-2 top-1/2 -translate-y-1/2 _shk-text-surface-400 dark:[color:var(--shk-surface-500)] hover:[color:var(--shk-surface-600)] dark:hover:[color:var(--shk-surface-300)]\"\n (click)=\"clearFilter(col.field)\"\n >\n <svg [lucideIcon]=\"getIcon('x')\" class=\"w-3.5 h-3.5\"></svg>\n </button>\n }\n </div>\n </div>\n }\n } @else {\n <div class=\"flex items-center justify-center\">\n <span>{{ col.header }}</span>\n </div>\n }\n </th>\n }\n </tr>\n </thead>\n @if (loading()) {\n <tbody class=\"border-b _shk-border dark:[border-color:var(--shk-surface-100)]\">\n <tr>\n <td [attr.colspan]=\"totalColspan()\" class=\"text-center py-12\">\n <div\n class=\"flex items-center justify-center\"\n role=\"status\"\n [attr.aria-label]=\"'common.loading' | transloco\"\n >\n <svg\n [lucideIcon]=\"getIcon('loader')\"\n class=\"w-6 h-6 animate-spin _shk-text-primary\"\n ></svg>\n </div>\n </td>\n </tr>\n </tbody>\n } @else if (effectiveDisplayedData().length === 0) {\n <tbody class=\"border-b _shk-border dark:[border-color:var(--shk-surface-100)]\">\n <tr>\n <td [attr.colspan]=\"totalColspan()\" class=\"text-center py-12\">\n <div class=\"flex flex-col items-center\">\n <div\n class=\"w-16 h-16 _shk-bg-surface-100 dark:[background-color:var(--shk-surface-100)] rounded-full flex items-center justify-center mb-4\"\n >\n <svg\n [lucideIcon]=\"getIcon('inbox')\"\n class=\"w-8 h-8 _shk-text-surface-400 dark:[color:var(--shk-surface-500)]\"\n ></svg>\n </div>\n <p\n class=\"text-lg font-semibold _shk-text-surface-600 dark:[color:var(--shk-surface-300)]\"\n >\n {{ emptyMessage() || ('common.no_records' | transloco) }}\n </p>\n </div>\n </td>\n </tr>\n </tbody>\n } @else {\n <tbody>\n @for (rowData of effectiveDisplayedData(); track trackByRow(rowData, $index)) {\n <tr\n [attr.aria-selected]=\"selectable() ? isRowSelected(rowData) : null\"\n [class.shk-row-selected]=\"selectable() && isRowSelected(rowData)\"\n class=\"hover:[background-color:color-mix(in srgb,var(--shk-primary-50)30%,transparent)] dark:hover:[background-color:color-mix(in srgb,var(--shk-primary-900)10%,transparent)] transition-colors duration-200 border-b _shk-border dark:[border-color:var(--shk-surface-100)]\"\n >\n @if (selectable()) {\n <td data-shk-select class=\"w-10 px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-center\">\n <input\n type=\"checkbox\"\n class=\"shk-table-checkbox\"\n [checked]=\"isRowSelected(rowData)\"\n [disabled]=\"!canSelectRow(rowData)\"\n (change)=\"toggleRowSelection(rowData)\"\n [attr.aria-label]=\"'table.selectRow' | transloco: { index: first() + $index + 1 }\"\n />\n </td>\n }\n @for (col of columnsWithActions(); track col.field) {\n <td\n [attr.data-shk-actions]=\"col.field === 'actions' ? '' : null\"\n [class]=\"\n 'px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-xs font-medium _shk-text-surface-700 dark:[color:var(--shk-surface-700)] ' +\n (col.field === 'actions' ? 'whitespace-nowrap' : 'whitespace-normal break-words')\n \"\n [style.overflow]=\"col.field === 'actions' ? 'visible' : 'visible'\"\n [style.text-overflow]=\"'clip'\"\n [style.--shk-col-width]=\"col.field !== 'actions' ? getColumnWidth(col) : null\"\n >\n @if (col.field !== 'actions') {\n @if (col.template === 'tag') {\n <shk-tag\n [value]=\"getTagValue(col, rowData)\"\n [severity]=\"getTagSeverity(col, rowData)\"\n [rounded]=\"getTagRounded(col, rowData)\"\n [icon]=\"getTagIcon(col, rowData)\"\n [style]=\"getTagStyle(col, rowData)\"\n />\n } @else if (col.format) {\n <span>{{ col.format(rowData) }}</span>\n } @else {\n <ng-container\n *ngTemplateOutlet=\"\n customTemplates()[col.field] || defaultTemplate;\n context: { $implicit: rowData, field: col.field }\n \"\n ></ng-container>\n }\n } @else {\n <div class=\"flex items-center justify-start gap-px\">\n @for (action of getVisibleRowActions(rowData); track $index) {\n @if (isRowActionVisible(action, rowData)) {\n <div class=\"relative group\">\n <shk-tooltip\n [text]=\"getRowActionLabel(action, rowData)\"\n position=\"top\"\n >\n <button\n type=\"button\"\n (click)=\"action.onClick(rowData)\"\n [class]=\"\n 'table-action-btn hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] rounded-md ' +\n getRowActionClass(action, rowData)\n \"\n [disabled]=\"isRowActionDisabled(action, rowData) || false\"\n [attr.aria-label]=\"getRowActionLabel(action, rowData)\"\n >\n <svg\n [lucideIcon]=\"getIcon(getRowActionIconName(action, rowData))\"\n class=\"w-4 h-4\"\n ></svg>\n </button>\n </shk-tooltip>\n </div>\n }\n }\n @if (getHiddenRowActions(rowData).length > 0) {\n <div class=\"relative\">\n <shk-tooltip\n [text]=\"'common.more_options' | transloco\"\n position=\"top\"\n >\n <button\n type=\"button\"\n (click)=\"$event.stopPropagation(); toggleActionsDropdown(rowData, $event)\"\n class=\"table-action-btn hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] rounded-md\"\n [attr.aria-label]=\"'common.more_options' | transloco\"\n [attr.aria-expanded]=\"isActionsDropdownOpen(rowData)\"\n >\n <svg\n [lucideIcon]=\"getIcon('ellipsis-vertical')\"\n class=\"w-4 h-4\"\n ></svg>\n </button>\n </shk-tooltip>\n @if (isActionsDropdownOpen(rowData)) {\n <div\n shkPortal\n class=\"fixed z-[9999] min-w-[160px] bg-white dark:[background-color:var(--shk-surface-100)] border _shk-border dark:[border-color:var(--shk-surface-200)] rounded-md shadow-lg py-1\"\n [style.top]=\"dropdownPosition().top + 'px'\"\n [style.left]=\"dropdownPosition().left + 'px'\"\n >\n @for (action of getHiddenRowActions(rowData); track $index) {\n <button\n type=\"button\"\n (click)=\"action.onClick(rowData); toggleActionsDropdown(rowData)\"\n [disabled]=\"isRowActionDisabled(action, rowData) || false\"\n [class]=\"\n 'w-full flex items-center gap-2 px-3 py-2 text-xs text-left _shk-text-surface-700 dark:[color:var(--shk-surface-700)] hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors ' +\n getRowActionClass(action, rowData)\n \"\n >\n <svg\n [lucideIcon]=\"getIcon(getRowActionIconName(action, rowData))\"\n class=\"w-3.5 h-3.5 shrink-0\"\n ></svg>\n <span>{{ getRowActionLabel(action, rowData) }}</span>\n </button>\n }\n </div>\n }\n </div>\n }\n </div>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n }\n </table>\n <ng-template #defaultTemplate let-rowData let-field=\"field\">\n {{ rowData[field] }}\n </ng-template>\n </div>\n <div\n class=\"table-pagination flex items-center justify-between gap-4 px-2 min-[1440px]:px-3 py-2 border-t _shk-border dark:[border-color:var(--shk-surface-100)]\"\n >\n <div class=\"text-xs _shk-text-surface-600 dark:[color:var(--shk-surface-400)]\">\n {{ pageReport() }}\n </div>\n <div\n class=\"flex items-center gap-0.5\"\n role=\"navigation\"\n >\n <button\n type=\"button\"\n (click)=\"goToFirst()\"\n [disabled]=\"isFirstPage()\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:[color:var(--shk-surface-400)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [lucideIcon]=\"getIcon('chevrons-left')\" class=\"w-4 h-4\"></svg>\n </button>\n <button\n type=\"button\"\n (click)=\"prev()\"\n [disabled]=\"isFirstPage()\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:[color:var(--shk-surface-400)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [lucideIcon]=\"getIcon('chevron-left')\" class=\"w-4 h-4\"></svg>\n </button>\n <span\n class=\"px-2 text-xs font-medium _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"\n >{{ currentPage() }} / {{ totalPages() }}</span\n >\n <button\n type=\"button\"\n (click)=\"next()\"\n [disabled]=\"isLastPage()\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:[color:var(--shk-surface-400)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [lucideIcon]=\"getIcon('chevron-right')\" class=\"w-4 h-4\"></svg>\n </button>\n <button\n type=\"button\"\n (click)=\"goToLast()\"\n [disabled]=\"isLastPage()\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:[color:var(--shk-surface-400)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [lucideIcon]=\"getIcon('chevrons-right')\" class=\"w-4 h-4\"></svg>\n </button>\n </div>\n <div\n class=\"flex items-center gap-1.5 text-xs _shk-text-surface-600 dark:[color:var(--shk-surface-400)]\"\n >\n <label [for]=\"uid + '-rows-per-page'\">{{ 'table.rows' | transloco }}</label>\n <select\n [id]=\"uid + '-rows-per-page'\"\n [value]=\"rowsPerPageLocal()\"\n (change)=\"onRowsPerPageChange($any($event.target).value)\"\n class=\"border _shk-border dark:[border-color:var(--shk-surface-200)] rounded px-2 py-1 text-xs bg-white dark:[background-color:var(--shk-surface-100)] _shk-text-surface-700 dark:[color:var(--shk-surface-700)] focus:outline-none focus:[border-color:var(--shk-primary-500)]\"\n >\n @for (opt of rowsPerPageOptions(); track opt) {\n <option [value]=\"opt\">{{ opt }}</option>\n }\n </select>\n </div>\n </div>\n </div>\n</div>\n", styles: ["input:focus{outline:none}input[type=text]{font-weight:400!important}table th{white-space:nowrap}table td{white-space:normal;overflow-wrap:break-word}.shk-page-btn{display:inline-flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;border-radius:.375rem;transition:background-color .15s ease,color .15s ease}.shk-page-btn:hover:not(:disabled){background-color:var(--shk-surface-100)}:host-context(.dark) .shk-page-btn:hover:not(:disabled){background-color:var(--shk-surface-200)}.shk-page-btn:focus-visible{outline:none;box-shadow:0 0 0 2px color-mix(in srgb,var(--shk-primary-500) 45%,transparent)}td button svg{width:1.125rem!important;height:1.125rem!important}td button:disabled{opacity:.4;cursor:not-allowed}.table-action-btn svg{width:1rem!important;height:1rem!important;min-width:1rem!important;min-height:1rem!important}.table-action-btn{padding:.5rem!important;min-width:2rem!important;min-height:2rem!important;display:inline-flex!important;align-items:center!important;justify-content:center!important}.table-scroll-wrapper{width:100%;overflow-x:auto;overflow-y:hidden;border-radius:inherit;-webkit-overflow-scrolling:touch;container-type:inline-size}.table-card,.table-pagination{container-type:inline-size}@container (max-width: 640px){.table-pagination{flex-direction:column;align-items:center;gap:.5rem}.table-pagination>div{justify-content:center}}.table-scroll-wrapper table{table-layout:auto;width:100%}@container (max-width: 768px){.table-scroll-wrapper{scroll-snap-type:x mandatory}.table-scroll-wrapper table{table-layout:auto;width:100%}.table-scroll-wrapper th:not([data-shk-actions]):not([data-shk-select]){min-width:var(--shk-col-width, 140px)}.table-scroll-wrapper td:not([data-shk-actions]):not([data-shk-select]){min-width:var(--shk-col-width, 140px);max-width:var(--shk-col-width, 140px)}.table-scroll-wrapper th,.table-scroll-wrapper td{scroll-snap-align:start}}th[data-shk-select],td[data-shk-select]{width:2.5rem;min-width:2.5rem}.shk-table-checkbox{width:.875rem;height:.875rem;cursor:pointer;vertical-align:middle;accent-color:var(--shk-primary-500)}.shk-table-checkbox:disabled{opacity:.4;cursor:not-allowed}tr.shk-row-selected{background-color:color-mix(in srgb,var(--shk-primary-50) 60%,transparent)}tr.shk-row-selected:hover{background-color:color-mix(in srgb,var(--shk-primary-50) 90%,transparent)}:host-context(.dark) tr.shk-row-selected{background-color:color-mix(in srgb,var(--shk-primary-900) 20%,transparent)}:host-context(.dark) tr.shk-row-selected:hover{background-color:color-mix(in srgb,var(--shk-primary-900) 30%,transparent)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"], dependencies: [{ kind: "directive", type: PortalDirective, selector: "[shkPortal]" }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }, { kind: "component", type: TagComponent, selector: "shk-tag", inputs: ["value", "severity", "rounded", "icon", "style", "styleClass"] }, { kind: "component", type: TooltipComponent, selector: "shk-tooltip", inputs: ["text", "position", "mode", "offset"] }, { kind: "pipe", type: i3.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1588
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.23", type: TableComponent, isStandalone: true, selector: "shk-table", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, rowsPerPage: { classPropertyName: "rowsPerPage", publicName: "rowsPerPage", isSignal: true, isRequired: false, transformFunction: null }, rowsPerPageOptions: { classPropertyName: "rowsPerPageOptions", publicName: "rowsPerPageOptions", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, showActionRow: { classPropertyName: "showActionRow", publicName: "showActionRow", isSignal: true, isRequired: false, transformFunction: null }, customTemplates: { classPropertyName: "customTemplates", publicName: "customTemplates", isSignal: true, isRequired: false, transformFunction: null }, headerActions: { classPropertyName: "headerActions", publicName: "headerActions", isSignal: true, isRequired: false, transformFunction: null }, rowActions: { classPropertyName: "rowActions", publicName: "rowActions", isSignal: true, isRequired: false, transformFunction: null }, hasShadow: { classPropertyName: "hasShadow", publicName: "hasShadow", isSignal: true, isRequired: false, transformFunction: null }, defaultSortField: { classPropertyName: "defaultSortField", publicName: "defaultSortField", isSignal: true, isRequired: false, transformFunction: null }, defaultSortOrder: { classPropertyName: "defaultSortOrder", publicName: "defaultSortOrder", isSignal: true, isRequired: false, transformFunction: null }, showSearch: { classPropertyName: "showSearch", publicName: "showSearch", isSignal: true, isRequired: false, transformFunction: null }, searchPlaceholder: { classPropertyName: "searchPlaceholder", publicName: "searchPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, globalFilterFields: { classPropertyName: "globalFilterFields", publicName: "globalFilterFields", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, serverSide: { classPropertyName: "serverSide", publicName: "serverSide", isSignal: true, isRequired: false, transformFunction: null }, totalRecords: { classPropertyName: "totalRecords", publicName: "totalRecords", isSignal: true, isRequired: false, transformFunction: null }, filters: { classPropertyName: "filters", publicName: "filters", isSignal: true, isRequired: false, transformFunction: null }, activeFilter: { classPropertyName: "activeFilter", publicName: "activeFilter", isSignal: true, isRequired: false, transformFunction: null }, showGridlines: { classPropertyName: "showGridlines", publicName: "showGridlines", isSignal: true, isRequired: false, transformFunction: null }, resizableColumns: { classPropertyName: "resizableColumns", publicName: "resizableColumns", isSignal: true, isRequired: false, transformFunction: null }, validateRequired: { classPropertyName: "validateRequired", publicName: "validateRequired", isSignal: true, isRequired: false, transformFunction: null }, columnWidths: { classPropertyName: "columnWidths", publicName: "columnWidths", isSignal: true, isRequired: false, transformFunction: null }, stateKey: { classPropertyName: "stateKey", publicName: "stateKey", isSignal: true, isRequired: false, transformFunction: null }, stateStorage: { classPropertyName: "stateStorage", publicName: "stateStorage", isSignal: true, isRequired: false, transformFunction: null }, rowHover: { classPropertyName: "rowHover", publicName: "rowHover", isSignal: true, isRequired: false, transformFunction: null }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, showPageReport: { classPropertyName: "showPageReport", publicName: "showPageReport", isSignal: true, isRequired: false, transformFunction: null }, showRowsPerPage: { classPropertyName: "showRowsPerPage", publicName: "showRowsPerPage", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, dataKey: { classPropertyName: "dataKey", publicName: "dataKey", isSignal: true, isRequired: false, transformFunction: null }, isRowSelectable: { classPropertyName: "isRowSelectable", publicName: "isRowSelectable", isSignal: true, isRequired: false, transformFunction: null }, bulkActions: { classPropertyName: "bulkActions", publicName: "bulkActions", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { columnWidths: "columnWidthsChange", selection: "selectionChange", refresh: "refresh", pageChange: "pageChange", filterChange: "filterChange", searchChange: "searchChange", filterClick: "filterClick", columnResize: "columnResize" }, host: { listeners: { "document:click": "onDocumentClick()", "document:keydown.escape": "onEscape()" } }, ngImport: i0, template: "<div class=\"space-y-2 min-[1440px]:space-y-3 mt-2 min-[1440px]:mt-3 animate-fade-in pb-8\">\n @if (\n showSearch() ||\n missingRowsCount() > 0 ||\n (showClearButton() && hasFilterableColumns()) ||\n filters().length > 0 ||\n headerActions().length > 0 ||\n (selectable() && bulkActions().length > 0 && selection().length > 0)\n ) {\n <div class=\"card p-2 min-[1440px]:p-2.5 flex flex-row items-center justify-between gap-2\">\n <div class=\"flex items-center gap-2 min-[1440px]:gap-3 flex-1 min-w-0\">\n @if (missingRowsCount() > 0) {\n <span\n class=\"shk-missing-summary inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md whitespace-nowrap order-last\"\n role=\"status\"\n >\n <svg [lucideIcon]=\"getIcon('triangle-alert')\" class=\"w-3.5 h-3.5 shrink-0\"></svg>\n {{ tr('table.missing.summary', '{{count}} fila(s) con datos faltantes', { count: missingRowsCount() }) }}\n </span>\n }\n @if (showSearch()) {\n <div class=\"relative w-full md:w-52 min-[1440px]:w-56\">\n <label [for]=\"uid + '-search'\" class=\"sr-only\">{{\n searchPlaceholder() || ('common.search_placeholder' | transloco)\n }}</label>\n <div class=\"absolute inset-y-0 left-0 pl-2.5 flex items-center pointer-events-none\">\n <svg\n [lucideIcon]=\"getIcon('search')\"\n class=\"w-3.5 h-3.5 _shk-text-surface-400 dark:[color:var(--shk-surface-500)]\"\n ></svg>\n </div>\n <input\n [id]=\"uid + '-search'\"\n type=\"text\"\n [value]=\"searchQuery()\"\n (input)=\"onSearchInput($any($event.target).value)\"\n [placeholder]=\"searchPlaceholder() || ('common.search_placeholder' | transloco)\"\n class=\"block w-full pl-8 pr-3 py-1.5 text-xs border _shk-border dark:[border-color:var(--shk-surface-200)] rounded-md leading-5 _shk-bg-surface-50 dark:[background-color:var(--shk-surface-100)] placeholder:[color:var(--shk-surface-400)] dark:placeholder:[color:var(--shk-surface-500)] _shk-text-surface-700 dark:[color:var(--shk-surface-700)] focus:outline-none focus:bg-white dark:focus:[background-color:var(--shk-surface-100)] focus:[border-color:var(--shk-primary-500)] focus:ring-1 focus:[--tw-ring-color:var(--shk-primary-500)]\"\n />\n </div>\n }\n @if (showClearButton() && (hasFilterableColumns() || showSearch())) {\n <shk-tooltip [text]=\"tr('table.clearFilters', 'Limpiar b\u00FAsqueda, filtros y orden')\">\n <button\n type=\"button\"\n (click)=\"clearAll()\"\n [disabled]=\"!hasActiveFilters()\"\n class=\"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md border _shk-border dark:[border-color:var(--shk-surface-200)] _shk-text-surface-600 dark:[color:var(--shk-surface-500)] hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] transition-colors disabled:opacity-40 disabled:cursor-not-allowed whitespace-nowrap\"\n >\n <svg [lucideIcon]=\"icons.clear\" class=\"w-3.5 h-3.5\"></svg>\n {{ tr('table.clear', 'Limpiar') }}\n </button>\n </shk-tooltip>\n }\n @if (filters().length > 0) {\n <div\n class=\"flex _shk-bg-surface-100 dark:[background-color:var(--shk-surface-100)] p-0.5 rounded-md ml-auto\"\n role=\"group\"\n >\n @for (f of filters(); track f.value) {\n <button\n type=\"button\"\n (click)=\"onFilterClick(f.value)\"\n [attr.aria-pressed]=\"f.value === activeFilter()\"\n class=\"px-2.5 min-[1440px]:px-3 py-1 text-xs font-medium rounded _shk-text-surface-700 dark:[color:var(--shk-surface-700)] transition-all\"\n [class]=\"\n f.value === activeFilter()\n ? 'bg-white shadow-sm dark:[background-color:var(--shk-surface-700)]'\n : ''\n \"\n >\n {{ f.label }}\n </button>\n }\n </div>\n }\n </div>\n @if (selectable() && selection().length > 0 && bulkActions().length > 0) {\n <div\n class=\"flex items-center gap-1.5 shrink-0\"\n role=\"toolbar\"\n [attr.aria-label]=\"'table.selected' | transloco: { count: selection().length }\"\n >\n <span\n class=\"text-xs font-medium _shk-text-surface-600 dark:[color:var(--shk-surface-400)] whitespace-nowrap\"\n aria-live=\"polite\"\n >{{ 'table.selected' | transloco: { count: selection().length } }}</span\n >\n <button\n type=\"button\"\n (click)=\"clearSelection()\"\n [attr.aria-label]=\"'table.clearSelection' | transloco\"\n class=\"table-action-btn rounded-md _shk-text-surface-500 dark:[color:var(--shk-surface-400)] hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)]\"\n >\n <svg [lucideIcon]=\"getIcon('x')\" class=\"w-3.5 h-3.5\"></svg>\n </button>\n @for (action of visibleBulkActions(); track $index) {\n <button\n type=\"button\"\n [class]=\"\n 'inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors disabled:opacity-50 disabled:cursor-not-allowed ' +\n (action.class || '')\n \"\n [disabled]=\"isBulkActionDisabled(action)\"\n [attr.aria-label]=\"action.label\"\n (click)=\"runBulkAction(action)\"\n >\n @if (action.icon) {\n <svg [lucideIcon]=\"getIcon(action.icon)\" class=\"w-3.5 h-3.5\"></svg>\n }\n {{ action.label }}\n </button>\n }\n </div>\n }\n @if (headerActions().length > 0) {\n <div class=\"flex items-center gap-1.5 shrink-0\">\n @for (action of headerActions(); track $index) {\n @if (isHeaderActionVisible(action)) {\n <button\n type=\"button\"\n [class]=\"\n 'inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors disabled:opacity-50 disabled:cursor-not-allowed ' +\n (action.class || '')\n \"\n [disabled]=\"isHeaderActionDisabled(action)\"\n [attr.aria-label]=\"action.label\"\n (click)=\"action.onClick()\"\n >\n @if (action.icon) {\n <svg [lucideIcon]=\"getIcon(action.icon)\" class=\"w-3.5 h-3.5\"></svg>\n }\n {{ action.label }}\n </button>\n }\n }\n </div>\n }\n </div>\n }\n <div class=\"card p-0 overflow-hidden table-card\" [class.shadow-lg]=\"hasShadow()\">\n <div class=\"table-scroll-wrapper _shk-scrollbar\">\n <table [class.shk-gridlines]=\"showGridlines()\" [class.shk-row-hover]=\"rowHover()\">\n <thead>\n <tr>\n @if (selectable()) {\n <th\n scope=\"col\"\n data-shk-select\n class=\"w-10 px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-center _shk-bg-surface-50 dark:[background-color:var(--shk-surface-100)] border-b _shk-border dark:[border-color:var(--shk-surface-200)]\"\n >\n <input\n type=\"checkbox\"\n class=\"shk-table-checkbox\"\n [checked]=\"allPageSelected()\"\n [indeterminate]=\"somePageSelected()\"\n [disabled]=\"loading() || selectablePageRows().length === 0\"\n (change)=\"toggleSelectAllPage()\"\n [attr.aria-label]=\"'table.selectAll' | transloco\"\n />\n </th>\n }\n @if (validateRequired()) {\n <th\n scope=\"col\"\n data-shk-status\n class=\"w-8 px-1 py-2 min-[1440px]:py-2.5 _shk-bg-surface-50 dark:[background-color:var(--shk-surface-100)] border-b _shk-border dark:[border-color:var(--shk-surface-200)]\"\n >\n <span class=\"sr-only\">{{ tr('table.missing.column', 'Datos faltantes') }}</span>\n </th>\n }\n @for (col of columnsWithActions(); track col.field) {\n <th\n scope=\"col\"\n (click)=\"onHeaderClick(col)\"\n (keydown)=\"onHeaderKeydown($event, col)\"\n [tabindex]=\"col.field !== 'actions' && col.sortable ? 0 : -1\"\n [attr.role]=\"col.field !== 'actions' && col.sortable ? 'button' : null\"\n [attr.aria-sort]=\"getAriaSort(col)\"\n [attr.data-shk-actions]=\"col.field === 'actions' ? '' : null\"\n [style.cursor]=\"col.field !== 'actions' && col.sortable ? 'pointer' : 'default'\"\n [style.width]=\"resizedWidth(col) || (col.field === 'actions' ? col.width : null)\"\n [style.min-width]=\"resizedWidth(col) || (col.field === 'actions' ? col.width : col.minWidth) || null\"\n [style.--shk-col-width]=\"col.field !== 'actions' ? getColumnWidth(col) : null\"\n class=\"relative px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-left text-[10px] min-[1440px]:text-xs font-bold _shk-text-surface-500 dark:[color:var(--shk-surface-400)] uppercase tracking-wider _shk-bg-surface-50 dark:[background-color:var(--shk-surface-100)] border-b _shk-border dark:[border-color:var(--shk-surface-200)] focus:outline-none focus-visible:ring-1 focus-visible:[--tw-ring-color:var(--shk-primary-500)]\"\n >\n @if (col.field !== 'actions') {\n <div class=\"flex items-center justify-between gap-2\">\n <span>{{ col.header }}</span>\n <div class=\"flex items-center gap-1 shrink-0\">\n @if (col.sortable) {\n <shk-tooltip [text]=\"'table.tooltips.sort' | transloco\">\n @if (sortField() === col.field) {\n <svg\n [lucideIcon]=\"getIcon(sortOrder() === 1 ? 'arrow-up' : 'arrow-down')\"\n class=\"w-3.5 h-3.5 _shk-text-primary\"\n ></svg>\n } @else {\n <svg\n [lucideIcon]=\"getIcon('arrow-up-down')\"\n class=\"w-3.5 h-3.5 _shk-text-surface-400 dark:[color:var(--shk-surface-500)]\"\n ></svg>\n }\n </shk-tooltip>\n }\n @if (col.filter) {\n <shk-tooltip [text]=\"'table.tooltips.filter' | transloco\">\n <button\n type=\"button\"\n (click)=\"$event.stopPropagation(); toggleFilter(col, $event)\"\n [attr.aria-label]=\"('table.tooltips.filter' | transloco) + ': ' + col.header\"\n [attr.aria-expanded]=\"openFilterField() === col.field\"\n aria-haspopup=\"dialog\"\n class=\"_shk-text-surface-400 dark:[color:var(--shk-surface-500)] hover:[color:var(--shk-surface-600)] dark:hover:[color:var(--shk-surface-300)] transition-colors\"\n >\n <svg\n [lucideIcon]=\"getIcon('filter')\"\n class=\"w-3.5 h-3.5\"\n [class._shk-text-primary]=\"hasFilterValue(col.field) || openFilterField() === col.field\"\n ></svg>\n </button>\n </shk-tooltip>\n }\n </div>\n </div>\n\n\n <!-- Column filter menu -->\n @if (col.filter && openFilterField() === col.field && filterDraft(); as draft) {\n <div\n shkPortal\n class=\"shk-filter-overlay fixed z-[9999] w-[240px] overflow-y-auto normal-case tracking-normal font-normal text-xs _shk-text-surface-700 dark:[color:var(--shk-surface-700)] bg-white dark:[background-color:var(--shk-surface-100)] border _shk-border dark:[border-color:var(--shk-surface-200)] rounded-lg shadow-lg\"\n role=\"dialog\"\n [attr.aria-label]=\"('table.tooltips.filter' | transloco) + ': ' + col.header\"\n [style.top.px]=\"filterPopupPosition().top\"\n [style.left.px]=\"filterPopupPosition().left\"\n [style.max-height.px]=\"filterPopupPosition().maxHeight\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"$event.stopPropagation()\"\n (keydown.escape)=\"closeFilters()\"\n >\n @if (col.filterMenuTitle) {\n <div class=\"px-2 pt-2 font-semibold _shk-text-surface-800 dark:[color:var(--shk-surface-800)]\">\n {{ col.filterMenuTitle }}\n </div>\n }\n @if (showOperatorFor(col)) {\n <div class=\"p-2 border-b _shk-border dark:[border-color:var(--shk-surface-200)]\">\n <select\n class=\"shk-filter-select\"\n [attr.aria-label]=\"filterLabel('matchAll') + ' / ' + filterLabel('matchAny')\"\n (change)=\"setDraftOperator($any($event.target).value)\"\n >\n <option value=\"and\" [selected]=\"draft.operator === 'and'\">\n {{ filterLabel('matchAll') }}\n </option>\n <option value=\"or\" [selected]=\"draft.operator === 'or'\">\n {{ filterLabel('matchAny') }}\n </option>\n </select>\n </div>\n }\n\n @switch (filterKind(col)) {\n @case ('select') {\n <ng-container\n *ngTemplateOutlet=\"optionList; context: { $implicit: col, draft: draft, multiple: false }\"\n ></ng-container>\n }\n @case ('multiselect') {\n <ng-container\n *ngTemplateOutlet=\"optionList; context: { $implicit: col, draft: draft, multiple: true }\"\n ></ng-container>\n }\n @case ('boolean') {\n @let boolValue = draft.rules[0].value;\n <div class=\"p-2\">\n <button\n type=\"button\"\n role=\"checkbox\"\n [id]=\"uid + '-filter-' + safeId(col.field) + '-0'\"\n class=\"inline-flex items-center gap-2 rounded-md focus:outline-none focus-visible:ring-1 focus-visible:[--tw-ring-color:var(--shk-primary-500)]\"\n [attr.aria-checked]=\"\n boolValue === true ? 'true' : boolValue === false ? 'false' : 'mixed'\n \"\n (click)=\"cycleBoolean(col)\"\n >\n <span\n class=\"shk-checkbox-box\"\n [class.shk-checked]=\"boolValue === true || boolValue === false\"\n >\n @if (boolValue === true) {\n <svg [lucideIcon]=\"getIcon('check')\"></svg>\n } @else if (boolValue === false) {\n <svg [lucideIcon]=\"getIcon('x')\"></svg>\n }\n </span>\n <span>{{\n boolValue === true\n ? filterLabel('yes')\n : boolValue === false\n ? filterLabel('no')\n : filterLabel('any')\n }}</span>\n </button>\n </div>\n }\n @case ('range') {\n @let rv = rangeValue(col);\n @let bounds = rangeBounds(col);\n <div class=\"p-2\">\n <div class=\"shk-range\">\n <div class=\"shk-range-track\"></div>\n <div\n class=\"shk-range-fill\"\n [style.left.%]=\"rangePercent(col, rv[0])\"\n [style.width.%]=\"rangePercent(col, rv[1]) - rangePercent(col, rv[0])\"\n ></div>\n <input\n type=\"range\"\n [id]=\"uid + '-filter-' + safeId(col.field) + '-0'\"\n [min]=\"bounds[0]\"\n [max]=\"bounds[1]\"\n [step]=\"col.filterStep || 1\"\n [value]=\"rv[0]\"\n [style.z-index]=\"rv[0] >= bounds[1] ? 3 : null\"\n [attr.aria-label]=\"col.header + ' min'\"\n (input)=\"onRangeInput(col, 0, $any($event.target).value, false)\"\n (change)=\"onRangeInput(col, 0, $any($event.target).value, true)\"\n />\n <input\n type=\"range\"\n [min]=\"bounds[0]\"\n [max]=\"bounds[1]\"\n [step]=\"col.filterStep || 1\"\n [value]=\"rv[1]\"\n [attr.aria-label]=\"col.header + ' max'\"\n (input)=\"onRangeInput(col, 1, $any($event.target).value, false)\"\n (change)=\"onRangeInput(col, 1, $any($event.target).value, true)\"\n />\n </div>\n <div class=\"flex items-center justify-between px-0.5 _shk-text-surface-500 dark:[color:var(--shk-surface-500)]\">\n <span>{{ rv[0] }}</span>\n <span>{{ rv[1] }}</span>\n </div>\n </div>\n }\n @default {\n <!-- text / numeric / date: one block per rule -->\n @for (rule of draft.rules; track $index; let i = $index) {\n <div\n class=\"flex flex-col gap-1.5 p-2\"\n [class.border-b]=\"i < draft.rules.length - 1\"\n [class._shk-border]=\"i < draft.rules.length - 1\"\n >\n @if (showMatchModesFor(col)) {\n <select\n class=\"shk-filter-select\"\n [attr.aria-label]=\"col.header\"\n (change)=\"setDraftMatchMode(col, i, $any($event.target).value)\"\n >\n @for (mode of matchModesFor(col); track mode) {\n <option [value]=\"mode\" [selected]=\"mode === rule.matchMode\">\n {{ matchModeLabel(mode) }}\n </option>\n }\n </select>\n }\n <input\n [id]=\"uid + '-filter-' + safeId(col.field) + '-' + i\"\n [type]=\"filterKind(col) === 'numeric' ? 'number' : filterKind(col) === 'date' ? 'date' : 'text'\"\n [attr.step]=\"filterKind(col) === 'numeric' ? 'any' : null\"\n class=\"shk-filter-input\"\n [value]=\"rule.value ?? ''\"\n [placeholder]=\"col.filterPlaceholder || ('common.search_placeholder' | transloco)\"\n [attr.aria-label]=\"col.header\"\n (input)=\"onRuleInput(col, i, $any($event.target).value)\"\n (keydown.enter)=\"applyFilter(col)\"\n />\n @if (draft.rules.length > 1) {\n <button\n type=\"button\"\n class=\"inline-flex items-center justify-center gap-1 py-1 rounded-md [color:var(--shk-error-600)] hover:[background-color:var(--shk-error-50)] transition-colors\"\n (click)=\"removeRule(i)\"\n >\n <svg [lucideIcon]=\"icons.trash\" class=\"w-3.5 h-3.5\"></svg>\n {{ filterLabel('removeRule') }}\n </button>\n }\n </div>\n }\n @if (canAddRule(col)) {\n <div class=\"px-2 pb-1\">\n <button\n type=\"button\"\n class=\"w-full inline-flex items-center justify-center gap-1 py-1 rounded-md _shk-text-primary hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] transition-colors\"\n (click)=\"addRule(col)\"\n >\n <svg [lucideIcon]=\"getIcon('plus')\" class=\"w-3.5 h-3.5\"></svg>\n {{ filterLabel('addRule') }}\n </button>\n </div>\n }\n }\n }\n\n <div class=\"flex items-center justify-between gap-2 p-2 border-t _shk-border dark:[border-color:var(--shk-surface-200)]\">\n <button\n type=\"button\"\n class=\"px-3 py-1.5 font-medium rounded-md border _shk-border dark:[border-color:var(--shk-surface-200)] _shk-text-surface-600 dark:[color:var(--shk-surface-500)] hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] transition-colors\"\n (click)=\"clearFilter(col.field)\"\n >\n {{ filterLabel('clear') }}\n </button>\n <button\n type=\"button\"\n class=\"px-3 py-1.5 font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors\"\n (click)=\"applyFilter(col)\"\n >\n {{ filterLabel('apply') }}\n </button>\n </div>\n </div>\n }\n } @else {\n <div class=\"flex items-center justify-center\">\n <span>{{ col.header }}</span>\n </div>\n }\n @if (isResizable()) {\n <span\n class=\"shk-col-resizer\"\n [class.shk-resizing]=\"resizingField() === col.field\"\n role=\"separator\"\n aria-orientation=\"vertical\"\n tabindex=\"0\"\n [attr.aria-label]=\"tr('table.resizeColumn', 'Redimensionar columna') + ': ' + col.header\"\n [attr.aria-valuenow]=\"resizedWidthPx(col)\"\n (pointerdown)=\"startResize($event, col)\"\n (click)=\"$event.stopPropagation()\"\n (dblclick)=\"$event.stopPropagation(); resetColumnWidth(col)\"\n (keydown)=\"onResizerKeydown($event, col)\"\n ></span>\n }\n </th>\n }\n </tr>\n </thead>\n @if (loading()) {\n <tbody class=\"border-b _shk-border dark:[border-color:var(--shk-surface-100)]\">\n <tr>\n <td [attr.colspan]=\"totalColspan()\" class=\"text-center py-12\">\n <div\n class=\"flex items-center justify-center\"\n role=\"status\"\n [attr.aria-label]=\"'common.loading' | transloco\"\n >\n <svg\n [lucideIcon]=\"getIcon('loader')\"\n class=\"w-6 h-6 animate-spin _shk-text-primary\"\n ></svg>\n </div>\n </td>\n </tr>\n </tbody>\n } @else if (effectiveDisplayedData().length === 0) {\n <tbody class=\"border-b _shk-border dark:[border-color:var(--shk-surface-100)]\">\n <tr>\n <td [attr.colspan]=\"totalColspan()\" class=\"text-center py-12\">\n <div class=\"flex flex-col items-center\">\n <div\n class=\"w-16 h-16 _shk-bg-surface-100 dark:[background-color:var(--shk-surface-100)] rounded-full flex items-center justify-center mb-4\"\n >\n <svg\n [lucideIcon]=\"getIcon('inbox')\"\n class=\"w-8 h-8 _shk-text-surface-400 dark:[color:var(--shk-surface-500)]\"\n ></svg>\n </div>\n <p\n class=\"text-lg font-semibold _shk-text-surface-600 dark:[color:var(--shk-surface-300)]\"\n >\n {{ emptyMessage() || ('common.no_records' | transloco) }}\n </p>\n </div>\n </td>\n </tr>\n </tbody>\n } @else {\n <tbody>\n @for (rowData of effectiveDisplayedData(); track trackByRow(rowData, $index)) {\n <tr\n [attr.aria-selected]=\"selectable() ? isRowSelected(rowData) : null\"\n [class.shk-row-selected]=\"selectable() && isRowSelected(rowData)\"\n [class.shk-row-missing]=\"missingFields(rowData).length > 0\"\n class=\"shk-data-row transition-colors duration-200 border-b _shk-border dark:[border-color:var(--shk-surface-100)]\"\n >\n @if (selectable()) {\n <td data-shk-select class=\"w-10 px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-center\">\n <input\n type=\"checkbox\"\n class=\"shk-table-checkbox\"\n [checked]=\"isRowSelected(rowData)\"\n [disabled]=\"!canSelectRow(rowData)\"\n (change)=\"toggleRowSelection(rowData)\"\n [attr.aria-label]=\"'table.selectRow' | transloco: { index: first() + $index + 1 }\"\n />\n </td>\n }\n @if (validateRequired()) {\n <td data-shk-status class=\"w-8 px-1 py-2 text-center\">\n @if (missingFields(rowData); as missing) {\n @if (missing.length > 0) {\n <shk-tooltip [text]=\"missingRowMessage(missing)\" position=\"right\" mode=\"fixed\">\n <svg\n [lucideIcon]=\"getIcon('triangle-alert')\"\n class=\"shk-missing-icon w-4 h-4 inline-block\"\n role=\"img\"\n [attr.aria-label]=\"missingRowMessage(missing)\"\n ></svg>\n </shk-tooltip>\n }\n }\n </td>\n }\n @for (col of columnsWithActions(); track col.field) {\n <td\n [attr.data-shk-actions]=\"col.field === 'actions' ? '' : null\"\n [class]=\"\n 'px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-xs font-medium _shk-text-surface-700 dark:[color:var(--shk-surface-700)] ' +\n (col.field === 'actions' ? 'whitespace-nowrap' : 'whitespace-normal break-words')\n \"\n [style.--shk-col-width]=\"col.field !== 'actions' ? getColumnWidth(col) : null\"\n >\n @if (col.field !== 'actions' && isCellMissing(col, rowData)) {\n <span class=\"shk-missing-cell inline-flex items-center gap-1 italic\">\n <svg [lucideIcon]=\"getIcon('triangle-alert')\" class=\"w-3.5 h-3.5 shrink-0\"></svg>\n {{ missingCellMessage(col) }}\n </span>\n } @else if (col.field !== 'actions') {\n @switch (col.template) {\n @case ('tag') {\n <shk-tag\n [value]=\"getTagValue(col, rowData)\"\n [severity]=\"getTagSeverity(col, rowData)\"\n [rounded]=\"getTagRounded(col, rowData)\"\n [icon]=\"getTagIcon(col, rowData)\"\n [style]=\"getTagStyle(col, rowData)\"\n />\n }\n @case ('progress') {\n <div\n class=\"shk-progress\"\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-valuenow]=\"getProgress(col, rowData)\"\n [attr.aria-label]=\"col.header\"\n >\n <div [style.width.%]=\"getProgress(col, rowData)\"></div>\n </div>\n }\n @case ('boolean') {\n @if (resolveField(rowData, col.field)) {\n <svg\n [lucideIcon]=\"icons.yes\"\n class=\"w-4 h-4 [color:var(--shk-success-600)]\"\n role=\"img\"\n [attr.aria-label]=\"filterLabel('yes')\"\n ></svg>\n } @else {\n <svg\n [lucideIcon]=\"icons.no\"\n class=\"w-4 h-4 [color:var(--shk-error-500)]\"\n role=\"img\"\n [attr.aria-label]=\"filterLabel('no')\"\n ></svg>\n }\n }\n @case ('date') {\n {{ resolveField(rowData, col.field) | date: col.dateFormat || 'dd/MM/yyyy' }}\n }\n @case ('currency') {\n {{ resolveField(rowData, col.field) | currency: col.currency || 'USD' : 'symbol' }}\n }\n @default {\n @if (col.image) {\n <div class=\"flex items-center gap-2\">\n @if (col.image(rowData); as src) {\n <img\n [src]=\"src\"\n alt=\"\"\n [width]=\"col.imageWidth || 24\"\n class=\"shrink-0 rounded-sm\"\n />\n }\n <span>\n <ng-container\n *ngTemplateOutlet=\"cellText; context: { $implicit: rowData, col: col }\"\n ></ng-container>\n </span>\n </div>\n } @else {\n <ng-container\n *ngTemplateOutlet=\"cellText; context: { $implicit: rowData, col: col }\"\n ></ng-container>\n }\n }\n }\n } @else {\n <div class=\"flex items-center justify-start gap-px\">\n @for (action of getVisibleRowActions(rowData); track $index) {\n @if (isRowActionVisible(action, rowData)) {\n <div class=\"relative group\">\n <shk-tooltip\n [text]=\"getRowActionLabel(action, rowData)\"\n position=\"top\"\n >\n <button\n type=\"button\"\n (click)=\"action.onClick(rowData)\"\n [class]=\"\n 'table-action-btn hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] rounded-md ' +\n getRowActionClass(action, rowData)\n \"\n [disabled]=\"isRowActionDisabled(action, rowData) || false\"\n [attr.aria-label]=\"getRowActionLabel(action, rowData)\"\n >\n <svg\n [lucideIcon]=\"getIcon(getRowActionIconName(action, rowData))\"\n class=\"w-4 h-4\"\n ></svg>\n </button>\n </shk-tooltip>\n </div>\n }\n }\n @if (getHiddenRowActions(rowData).length > 0) {\n <div class=\"relative\">\n <shk-tooltip\n [text]=\"'common.more_options' | transloco\"\n position=\"top\"\n >\n <button\n type=\"button\"\n (click)=\"$event.stopPropagation(); toggleActionsDropdown(rowData, $event)\"\n class=\"table-action-btn hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] rounded-md\"\n [attr.aria-label]=\"'common.more_options' | transloco\"\n [attr.aria-expanded]=\"isActionsDropdownOpen(rowData)\"\n >\n <svg\n [lucideIcon]=\"getIcon('ellipsis-vertical')\"\n class=\"w-4 h-4\"\n ></svg>\n </button>\n </shk-tooltip>\n @if (isActionsDropdownOpen(rowData)) {\n <div\n shkPortal\n class=\"fixed z-[9999] min-w-[160px] bg-white dark:[background-color:var(--shk-surface-100)] border _shk-border dark:[border-color:var(--shk-surface-200)] rounded-md shadow-lg py-1\"\n [style.top]=\"dropdownPosition().top + 'px'\"\n [style.left]=\"dropdownPosition().left + 'px'\"\n >\n @for (action of getHiddenRowActions(rowData); track $index) {\n <button\n type=\"button\"\n (click)=\"action.onClick(rowData); toggleActionsDropdown(rowData)\"\n [disabled]=\"isRowActionDisabled(action, rowData) || false\"\n [class]=\"\n 'w-full flex items-center gap-2 px-3 py-2 text-xs text-left _shk-text-surface-700 dark:[color:var(--shk-surface-700)] hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors ' +\n getRowActionClass(action, rowData)\n \"\n >\n <svg\n [lucideIcon]=\"getIcon(getRowActionIconName(action, rowData))\"\n class=\"w-3.5 h-3.5 shrink-0\"\n ></svg>\n <span>{{ getRowActionLabel(action, rowData) }}</span>\n </button>\n }\n </div>\n }\n </div>\n }\n </div>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n }\n </table>\n\n <!-- Text content of a cell: format() \u00B7 custom template \u00B7 raw value -->\n <ng-template #cellText let-rowData let-col=\"col\">\n @if (col.format) {\n <span>{{ col.format(rowData) }}</span>\n } @else {\n <ng-container\n *ngTemplateOutlet=\"\n customTemplates()[col.field] || defaultTemplate;\n context: { $implicit: rowData, field: col.field }\n \"\n ></ng-container>\n }\n </ng-template>\n <ng-template #defaultTemplate let-rowData let-field=\"field\">\n {{ resolveField(rowData, field) }}\n </ng-template>\n\n <!-- Option list of the select / multiselect filters -->\n <ng-template #optionList let-col let-draft=\"draft\" let-multiple=\"multiple\">\n <div class=\"p-2 space-y-1.5\">\n @let selectedLabel = multiple ? selectedOptionsLabel(col) : selectedSingleLabel(col);\n <button\n type=\"button\"\n class=\"shk-filter-select flex items-center justify-between gap-2 text-left\"\n style=\"background-image: none\"\n [id]=\"uid + '-filter-' + safeId(col.field) + '-0'\"\n [attr.aria-expanded]=\"multiselectOpen()\"\n (click)=\"multiselectOpen.set(!multiselectOpen())\"\n >\n <span class=\"truncate\" [class._shk-text-surface-400]=\"!selectedLabel\">\n {{ selectedLabel || tr('table.filterAll', 'Todos') }}\n </span>\n <svg\n [lucideIcon]=\"getIcon('chevron-down')\"\n class=\"w-3.5 h-3.5 shrink-0 _shk-text-surface-400 transition-transform\"\n [class.rotate-180]=\"multiselectOpen()\"\n ></svg>\n </button>\n @if (multiselectOpen()) {\n <div\n class=\"max-h-52 overflow-y-auto p-0.5 border _shk-border dark:[border-color:var(--shk-surface-200)] rounded-md _shk-scrollbar\"\n role=\"listbox\"\n [attr.aria-multiselectable]=\"multiple\"\n >\n @for (opt of col.filterOptions || []; track $index) {\n @let isSelected = multiple\n ? isOptionSelected(opt.value)\n : draft.rules[0].value != null && draft.rules[0].value == opt.value;\n <button\n type=\"button\"\n role=\"option\"\n class=\"w-full flex items-center gap-2 px-2 py-1.5 rounded text-left transition-colors hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)]\"\n [class._shk-bg-primary-soft]=\"isSelected\"\n [class._shk-text-primary-700]=\"isSelected\"\n [attr.aria-selected]=\"isSelected\"\n (click)=\"multiple ? toggleOption(col, opt.value) : selectOption(col, opt.value)\"\n >\n @if (multiple) {\n <span class=\"shk-checkbox-box\" [class.shk-checked]=\"isSelected\">\n @if (isSelected) {\n <svg [lucideIcon]=\"getIcon('check')\"></svg>\n }\n </span>\n }\n @if (opt.image) {\n <img [src]=\"opt.image\" alt=\"\" width=\"22\" class=\"shrink-0 rounded-sm\" />\n }\n <span class=\"truncate\">{{ opt.label }}</span>\n </button>\n }\n </div>\n }\n </div>\n </ng-template>\n </div>\n <div\n class=\"table-pagination flex items-center justify-between gap-4 px-2 min-[1440px]:px-3 py-2 border-t _shk-border dark:[border-color:var(--shk-surface-100)]\"\n >\n <div class=\"text-xs _shk-text-surface-600 dark:[color:var(--shk-surface-400)]\">\n @if (showPageReport()) {\n {{ pageReport() }}\n }\n </div>\n <div\n class=\"flex items-center gap-0.5\"\n role=\"navigation\"\n >\n <button\n type=\"button\"\n (click)=\"goToFirst()\"\n [disabled]=\"isFirstPage()\"\n [attr.aria-label]=\"tr('table.firstPage', 'Primera p\u00E1gina')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:[color:var(--shk-surface-400)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [lucideIcon]=\"getIcon('chevrons-left')\" class=\"w-4 h-4\"></svg>\n </button>\n <button\n type=\"button\"\n (click)=\"prev()\"\n [disabled]=\"isFirstPage()\"\n [attr.aria-label]=\"tr('table.prevPage', 'P\u00E1gina anterior')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:[color:var(--shk-surface-400)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [lucideIcon]=\"getIcon('chevron-left')\" class=\"w-4 h-4\"></svg>\n </button>\n <span\n class=\"px-2 text-xs font-medium _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"\n >{{ currentPage() }} / {{ totalPages() }}</span\n >\n <button\n type=\"button\"\n (click)=\"next()\"\n [disabled]=\"isLastPage()\"\n [attr.aria-label]=\"tr('table.nextPage', 'P\u00E1gina siguiente')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:[color:var(--shk-surface-400)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [lucideIcon]=\"getIcon('chevron-right')\" class=\"w-4 h-4\"></svg>\n </button>\n <button\n type=\"button\"\n (click)=\"goToLast()\"\n [disabled]=\"isLastPage()\"\n [attr.aria-label]=\"tr('table.lastPage', '\u00DAltima p\u00E1gina')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:[color:var(--shk-surface-400)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [lucideIcon]=\"getIcon('chevrons-right')\" class=\"w-4 h-4\"></svg>\n </button>\n </div>\n <div\n class=\"flex items-center gap-1.5 text-xs _shk-text-surface-600 dark:[color:var(--shk-surface-400)]\"\n >\n @if (showRowsPerPage()) {\n <label [for]=\"uid + '-rows-per-page'\">{{ 'table.rows' | transloco }}</label>\n <select\n [id]=\"uid + '-rows-per-page'\"\n (change)=\"onRowsPerPageChange($any($event.target).value)\"\n class=\"border _shk-border dark:[border-color:var(--shk-surface-200)] rounded px-2 py-1 text-xs bg-white dark:[background-color:var(--shk-surface-100)] _shk-text-surface-700 dark:[color:var(--shk-surface-700)] focus:outline-none focus:[border-color:var(--shk-primary-500)]\"\n >\n @for (opt of rowsPerPageOptions(); track opt) {\n <option [value]=\"opt\" [selected]=\"opt === rowsPerPageLocal()\">{{ opt }}</option>\n }\n </select>\n }\n </div>\n </div>\n </div>\n</div>\n", styles: ["input:focus{outline:none}input[type=text]{font-weight:400!important}table th{white-space:nowrap}table td{white-space:normal;overflow-wrap:break-word}.shk-page-btn{display:inline-flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;border-radius:.375rem;transition:background-color .15s ease,color .15s ease}.shk-page-btn:hover:not(:disabled){background-color:var(--shk-surface-100)}:host-context(.dark) .shk-page-btn:hover:not(:disabled){background-color:var(--shk-surface-200)}.shk-page-btn:focus-visible{outline:none;box-shadow:0 0 0 2px color-mix(in srgb,var(--shk-primary-500) 45%,transparent)}td button svg{width:1.125rem!important;height:1.125rem!important}td button:disabled{opacity:.4;cursor:not-allowed}.table-action-btn svg{width:1rem!important;height:1rem!important;min-width:1rem!important;min-height:1rem!important}.table-action-btn{padding:.5rem!important;min-width:2rem!important;min-height:2rem!important;display:inline-flex!important;align-items:center!important;justify-content:center!important}.table-scroll-wrapper{width:100%;overflow-x:auto;overflow-y:hidden;border-radius:inherit;-webkit-overflow-scrolling:touch;container-type:inline-size}.table-card,.table-pagination{container-type:inline-size}@container (max-width: 640px){.table-pagination{flex-direction:column;align-items:center;gap:.5rem}.table-pagination>div{justify-content:center}}.table-scroll-wrapper table{table-layout:auto;width:100%}@container (max-width: 768px){.table-scroll-wrapper{scroll-snap-type:x mandatory}.table-scroll-wrapper table{table-layout:auto;width:100%}.table-scroll-wrapper th:not([data-shk-actions]):not([data-shk-select]):not([data-shk-status]){min-width:var(--shk-col-width, 140px)}.table-scroll-wrapper td:not([data-shk-actions]):not([data-shk-select]):not([data-shk-status]){min-width:var(--shk-col-width, 140px);max-width:var(--shk-col-width, 140px)}.table-scroll-wrapper th,.table-scroll-wrapper td{scroll-snap-align:start}}th[data-shk-select],td[data-shk-select]{width:2.5rem;min-width:2.5rem}.shk-table-checkbox{width:.875rem;height:.875rem;cursor:pointer;vertical-align:middle;accent-color:var(--shk-primary-500)}.shk-table-checkbox:disabled{opacity:.4;cursor:not-allowed}tr.shk-row-selected{background-color:color-mix(in srgb,var(--shk-primary-50) 60%,transparent)}tr.shk-row-selected:hover{background-color:color-mix(in srgb,var(--shk-primary-50) 90%,transparent)}:host-context(.dark) tr.shk-row-selected{background-color:color-mix(in srgb,var(--shk-primary-900) 20%,transparent)}:host-context(.dark) tr.shk-row-selected:hover{background-color:color-mix(in srgb,var(--shk-primary-900) 30%,transparent)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}th[data-shk-status],td[data-shk-status]{width:2rem;min-width:2rem}tr.shk-row-missing{background-color:color-mix(in srgb,var(--shk-warning-400) 9%,transparent)}tr.shk-row-missing>td:first-child{box-shadow:inset 3px 0 0 var(--shk-warning-400)}table.shk-row-hover tbody tr.shk-row-missing.shk-data-row:hover{background-color:color-mix(in srgb,var(--shk-warning-400) 15%,transparent)}.shk-missing-icon,.shk-missing-cell{color:var(--shk-warning-600)}:host-context(.dark) .shk-missing-icon,:host-context(.dark) .shk-missing-cell{color:var(--shk-warning-400)}.shk-missing-summary{color:var(--shk-warning-800);background-color:var(--shk-warning-50);border:1px solid color-mix(in srgb,var(--shk-warning-400) 45%,transparent)}table.shk-row-hover tbody tr.shk-data-row:hover{background-color:color-mix(in srgb,var(--shk-primary-50) 30%,transparent)}:host-context(.dark) table.shk-row-hover tbody tr.shk-data-row:hover{background-color:color-mix(in srgb,var(--shk-primary-900) 10%,transparent)}table.shk-gridlines th,table.shk-gridlines td{border-right:1px solid var(--shk-surface-200)}table.shk-gridlines th:last-child,table.shk-gridlines td:last-child{border-right:0}:host-context(.dark) table.shk-gridlines th,:host-context(.dark) table.shk-gridlines td{border-right-color:var(--shk-surface-200)}.shk-col-resizer{position:absolute;top:0;right:-4px;z-index:1;width:8px;height:100%;cursor:col-resize;touch-action:none}.shk-col-resizer:after{content:\"\";position:absolute;top:20%;bottom:20%;left:3px;width:2px;border-radius:1px;background-color:transparent;transition:background-color .15s ease}.shk-col-resizer:hover:after,.shk-col-resizer:focus-visible:after,.shk-col-resizer.shk-resizing:after{background-color:var(--shk-primary-500)}.shk-col-resizer:focus-visible{outline:none}th:last-child .shk-col-resizer{right:0}.shk-filter-input,.shk-filter-select{width:100%;padding:.375rem .625rem;font-size:.75rem;line-height:1.25rem;border-radius:.375rem;border:1px solid var(--shk-surface-200);background-color:#fff;color:var(--shk-surface-700)}.dark .shk-filter-input,.dark .shk-filter-select{background-color:var(--shk-surface-100);border-color:var(--shk-surface-200);color-scheme:dark}.shk-filter-input::placeholder{color:var(--shk-surface-400)}select.shk-filter-select{appearance:none;padding-right:1.75rem;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right .5rem center;cursor:pointer}button.shk-filter-select{cursor:pointer}.shk-filter-input:focus,.shk-filter-select:focus{outline:none;border-color:var(--shk-primary-500);box-shadow:0 0 0 1px var(--shk-primary-500)}.shk-checkbox-box{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:.875rem;height:.875rem;border-radius:.1875rem;border:1px solid var(--shk-surface-300);background-color:#fff;color:#fff}.dark .shk-checkbox-box{background-color:var(--shk-surface-100)}.shk-checkbox-box.shk-checked{background-color:var(--shk-primary-500);border-color:var(--shk-primary-500)}.shk-checkbox-box svg{width:.625rem;height:.625rem}.shk-range{position:relative;height:1rem;margin:.5rem .375rem .375rem}.shk-range-track,.shk-range-fill{position:absolute;top:50%;height:.1875rem;transform:translateY(-50%);border-radius:9999px}.shk-range-track{left:0;right:0;background-color:var(--shk-surface-200)}.shk-range-fill{background-color:var(--shk-primary-500)}.shk-range input[type=range]{position:absolute;inset:0;width:100%;margin:0;background:transparent;pointer-events:none;appearance:none;-webkit-appearance:none}.shk-range input[type=range]::-webkit-slider-thumb{pointer-events:auto;-webkit-appearance:none;width:.875rem;height:.875rem;border-radius:9999px;background:#fff;border:2px solid var(--shk-primary-500);cursor:grab}.shk-range input[type=range]::-moz-range-thumb{pointer-events:auto;width:.625rem;height:.625rem;border-radius:9999px;background:#fff;border:2px solid var(--shk-primary-500);cursor:grab}.shk-progress{height:.375rem;min-width:5rem;border-radius:9999px;background-color:var(--shk-surface-200);overflow:hidden}.shk-progress>div{height:100%;border-radius:inherit;background-color:var(--shk-primary-500)}\n"], dependencies: [{ kind: "directive", type: PortalDirective, selector: "[shkPortal]" }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }, { kind: "component", type: TagComponent, selector: "shk-tag", inputs: ["value", "severity", "rounded", "icon", "style", "styleClass"] }, { kind: "component", type: TooltipComponent, selector: "shk-tooltip", inputs: ["text", "position", "mode", "offset"] }, { kind: "pipe", type: i1.CurrencyPipe, name: "currency" }, { kind: "pipe", type: i1.DatePipe, name: "date" }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
931
1589
  }
932
1590
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: TableComponent, decorators: [{
933
1591
  type: Component,
934
1592
  args: [{ selector: 'shk-table', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
935
1593
  PortalDirective,
936
1594
  CommonModule,
937
- ReactiveFormsModule,
938
1595
  TranslocoModule,
939
1596
  LucideDynamicIcon,
940
1597
  TagComponent,
941
1598
  TooltipComponent,
942
- ], template: "<div class=\"space-y-2 min-[1440px]:space-y-3 mt-2 min-[1440px]:mt-3 animate-fade-in pb-8\">\n @if (\n showSearch() ||\n filters().length > 0 ||\n headerActions().length > 0 ||\n (selectable() && bulkActions().length > 0 && selection().length > 0)\n ) {\n <div class=\"card p-2 min-[1440px]:p-2.5 flex flex-row items-center justify-between gap-2\">\n <div class=\"flex items-center gap-2 min-[1440px]:gap-3 flex-1 min-w-0\">\n @if (showSearch()) {\n <div class=\"relative w-full md:w-52 min-[1440px]:w-56\">\n <label [for]=\"uid + '-search'\" class=\"sr-only\">{{\n searchPlaceholder() || ('common.search_placeholder' | transloco)\n }}</label>\n <div class=\"absolute inset-y-0 left-0 pl-2.5 flex items-center pointer-events-none\">\n <svg\n [lucideIcon]=\"getIcon('search')\"\n class=\"w-3.5 h-3.5 _shk-text-surface-400 dark:[color:var(--shk-surface-500)]\"\n ></svg>\n </div>\n <input\n [id]=\"uid + '-search'\"\n type=\"text\"\n [value]=\"searchQuery()\"\n (input)=\"onSearchInput($any($event.target).value)\"\n [placeholder]=\"searchPlaceholder() || ('common.search_placeholder' | transloco)\"\n class=\"block w-full pl-8 pr-3 py-1.5 text-xs border _shk-border dark:[border-color:var(--shk-surface-200)] rounded-md leading-5 _shk-bg-surface-50 dark:[background-color:var(--shk-surface-100)] placeholder:[color:var(--shk-surface-400)] dark:placeholder:[color:var(--shk-surface-500)] _shk-text-surface-700 dark:[color:var(--shk-surface-700)] focus:outline-none focus:bg-white dark:focus:[background-color:var(--shk-surface-800)] focus:[border-color:var(--shk-primary-500)] focus:ring-1 focus:[--tw-ring-color:var(--shk-primary-500)]\"\n />\n </div>\n }\n @if (filters().length > 0) {\n <div\n class=\"flex _shk-bg-surface-100 dark:[background-color:var(--shk-surface-100)] p-0.5 rounded-md ml-auto\"\n role=\"group\"\n >\n @for (f of filters(); track f.value) {\n <button\n type=\"button\"\n (click)=\"onFilterClick(f.value)\"\n [attr.aria-pressed]=\"f.value === activeFilter()\"\n class=\"px-2.5 min-[1440px]:px-3 py-1 text-xs font-medium rounded _shk-text-surface-700 dark:[color:var(--shk-surface-700)] transition-all\"\n [class]=\"\n f.value === activeFilter()\n ? 'bg-white shadow-sm dark:[background-color:var(--shk-surface-700)]'\n : ''\n \"\n >\n {{ f.label }}\n </button>\n }\n </div>\n }\n </div>\n @if (selectable() && selection().length > 0 && bulkActions().length > 0) {\n <div\n class=\"flex items-center gap-1.5 shrink-0\"\n role=\"toolbar\"\n [attr.aria-label]=\"'table.selected' | transloco: { count: selection().length }\"\n >\n <span\n class=\"text-xs font-medium _shk-text-surface-600 dark:[color:var(--shk-surface-400)] whitespace-nowrap\"\n aria-live=\"polite\"\n >{{ 'table.selected' | transloco: { count: selection().length } }}</span\n >\n <button\n type=\"button\"\n (click)=\"clearSelection()\"\n [attr.aria-label]=\"'table.clearSelection' | transloco\"\n class=\"table-action-btn rounded-md _shk-text-surface-500 dark:[color:var(--shk-surface-400)] hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)]\"\n >\n <svg [lucideIcon]=\"getIcon('x')\" class=\"w-3.5 h-3.5\"></svg>\n </button>\n @for (action of visibleBulkActions(); track $index) {\n <button\n type=\"button\"\n [class]=\"\n 'inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors disabled:opacity-50 disabled:cursor-not-allowed ' +\n (action.class || '')\n \"\n [disabled]=\"isBulkActionDisabled(action)\"\n [attr.aria-label]=\"action.label\"\n (click)=\"runBulkAction(action)\"\n >\n @if (action.icon) {\n <svg [lucideIcon]=\"getIcon(action.icon)\" class=\"w-3.5 h-3.5\"></svg>\n }\n {{ action.label }}\n </button>\n }\n </div>\n }\n @if (headerActions().length > 0) {\n <div class=\"flex items-center gap-1.5 shrink-0\">\n @for (action of headerActions(); track $index) {\n @if (isHeaderActionVisible(action)) {\n <button\n type=\"button\"\n [class]=\"\n 'inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors disabled:opacity-50 disabled:cursor-not-allowed ' +\n (action.class || '')\n \"\n [disabled]=\"isHeaderActionDisabled(action)\"\n [attr.aria-label]=\"action.label\"\n (click)=\"action.onClick()\"\n >\n @if (action.icon) {\n <svg [lucideIcon]=\"getIcon(action.icon)\" class=\"w-3.5 h-3.5\"></svg>\n }\n {{ action.label }}\n </button>\n }\n }\n </div>\n }\n </div>\n }\n <div class=\"card p-0 overflow-hidden table-card\" [class.shadow-lg]=\"hasShadow()\">\n <div class=\"table-scroll-wrapper _shk-scrollbar\">\n <table>\n <thead>\n <tr>\n @if (selectable()) {\n <th\n scope=\"col\"\n data-shk-select\n class=\"w-10 px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-center _shk-bg-surface-50 dark:[background-color:var(--shk-surface-100)] border-b _shk-border dark:[border-color:var(--shk-surface-200)]\"\n >\n <input\n type=\"checkbox\"\n class=\"shk-table-checkbox\"\n [checked]=\"allPageSelected()\"\n [indeterminate]=\"somePageSelected()\"\n [disabled]=\"loading() || selectablePageRows().length === 0\"\n (change)=\"toggleSelectAllPage()\"\n [attr.aria-label]=\"'table.selectAll' | transloco\"\n />\n </th>\n }\n @for (col of columnsWithActions(); track col.field) {\n <th\n scope=\"col\"\n (click)=\"col.field !== 'actions' && col.sortable && toggleSort(col.field)\"\n (keydown)=\"onHeaderKeydown($event, col)\"\n [tabindex]=\"col.field !== 'actions' && col.sortable ? 0 : -1\"\n [attr.role]=\"col.field !== 'actions' && col.sortable ? 'button' : null\"\n [attr.aria-sort]=\"getAriaSort(col)\"\n [attr.data-shk-actions]=\"col.field === 'actions' ? '' : null\"\n [style.cursor]=\"col.field !== 'actions' && col.sortable ? 'pointer' : 'default'\"\n [style.width]=\"col.field === 'actions' ? col.width : null\"\n [style.min-width]=\"col.field === 'actions' ? col.width : null\"\n [style.--shk-col-width]=\"col.field !== 'actions' ? getColumnWidth(col) : null\"\n class=\"relative px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-left text-[10px] min-[1440px]:text-xs font-bold _shk-text-surface-500 dark:[color:var(--shk-surface-400)] uppercase tracking-wider _shk-bg-surface-50 dark:[background-color:var(--shk-surface-100)] border-b _shk-border dark:[border-color:var(--shk-surface-200)] focus:outline-none focus-visible:ring-1 focus-visible:[--tw-ring-color:var(--shk-primary-500)]\"\n >\n @if (col.field !== 'actions') {\n <div class=\"flex items-center justify-between gap-2\">\n <span>{{ col.header }}</span>\n <div class=\"flex items-center gap-1 shrink-0\">\n @if (col.sortable) {\n <shk-tooltip [text]=\"'table.tooltips.sort' | transloco\">\n @if (sortField() === col.field) {\n <svg\n [lucideIcon]=\"getIcon(sortOrder() === 1 ? 'arrow-up' : 'arrow-down')\"\n class=\"w-3.5 h-3.5 _shk-text-primary\"\n ></svg>\n } @else {\n <svg\n [lucideIcon]=\"getIcon('arrow-up-down')\"\n class=\"w-3.5 h-3.5 _shk-text-surface-400 dark:[color:var(--shk-surface-500)]\"\n ></svg>\n }\n </shk-tooltip>\n }\n @if (col.filter) {\n <shk-tooltip [text]=\"'table.tooltips.filter' | transloco\">\n <button\n type=\"button\"\n (click)=\"$event.stopPropagation(); toggleFilter(col.field, $event)\"\n [attr.aria-label]=\"'table.tooltips.filter' | transloco\"\n [attr.aria-expanded]=\"showFilterInput()[col.field] || false\"\n class=\"_shk-text-surface-400 dark:[color:var(--shk-surface-500)] hover:[color:var(--shk-surface-600)] dark:hover:[color:var(--shk-surface-300)] transition-colors\"\n >\n <svg\n [lucideIcon]=\"getIcon('filter')\"\n class=\"w-3.5 h-3.5\"\n [class._shk-text-primary]=\"hasFilterValue(col.field)\"\n ></svg>\n </button>\n </shk-tooltip>\n }\n </div>\n </div>\n @if (col.filter && showFilterInput()[col.field]) {\n <div\n shkPortal\n class=\"fixed z-[9999] p-2 w-[200px] normal-case tracking-normal font-normal bg-white dark:[background-color:var(--shk-surface-100)] border _shk-border dark:[border-color:var(--shk-surface-200)] rounded-lg shadow-lg\"\n [style.top]=\"filterPopupPosition().top + 'px'\"\n [style.left]=\"filterPopupPosition().left + 'px'\"\n [formGroup]=\"columnFiltersForm\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"$event.stopPropagation()\"\n (keydown.escape)=\"closeFilters()\"\n >\n <div class=\"relative\">\n @if (col.filterType !== 'select') {\n <label [for]=\"uid + '-filter-' + col.field\" class=\"sr-only\">{{\n col.filterPlaceholder || ('common.search_placeholder' | transloco)\n }}</label>\n <input\n [id]=\"uid + '-filter-' + col.field\"\n type=\"text\"\n [formControlName]=\"col.field\"\n class=\"w-full px-3 py-1.5 text-sm rounded-md border _shk-border dark:[border-color:var(--shk-surface-200)] bg-white dark:[background-color:var(--shk-surface-100)] _shk-text-surface-700 dark:[color:var(--shk-surface-700)] focus:[border-color:var(--shk-primary-500)] focus:ring-1 focus:[--tw-ring-color:var(--shk-primary-500)] placeholder:[color:var(--shk-surface-400)] dark:placeholder:[color:var(--shk-surface-500)]\"\n [placeholder]=\"\n col.filterPlaceholder || ('common.search_placeholder' | transloco)\n \"\n />\n }\n @if (col.filterType === 'select') {\n <label [for]=\"uid + '-filter-' + col.field\" class=\"sr-only\">{{\n col.filterPlaceholder || ('common.search_placeholder' | transloco)\n }}</label>\n <select\n [id]=\"uid + '-filter-' + col.field\"\n [formControlName]=\"col.field\"\n class=\"w-full px-2 py-1 text-xs rounded-md border _shk-border dark:[border-color:var(--shk-surface-200)] bg-white dark:[background-color:var(--shk-surface-100)] _shk-text-surface-700 dark:[color:var(--shk-surface-700)] focus:[border-color:var(--shk-primary-500)] focus:ring-1 focus:[--tw-ring-color:var(--shk-primary-500)] appearance-none\"\n >\n <option [ngValue]=\"null\">{{ 'table.filterAll' | transloco }}</option>\n @for (opt of col.filterOptions || []; track opt.value) {\n <option [ngValue]=\"opt.value\">{{ opt.label }}</option>\n }\n </select>\n }\n @if (hasFilterValue(col.field) && col.filterType !== 'select') {\n <button\n type=\"button\"\n class=\"absolute right-2 top-1/2 -translate-y-1/2 _shk-text-surface-400 dark:[color:var(--shk-surface-500)] hover:[color:var(--shk-surface-600)] dark:hover:[color:var(--shk-surface-300)]\"\n (click)=\"clearFilter(col.field)\"\n >\n <svg [lucideIcon]=\"getIcon('x')\" class=\"w-3.5 h-3.5\"></svg>\n </button>\n }\n </div>\n </div>\n }\n } @else {\n <div class=\"flex items-center justify-center\">\n <span>{{ col.header }}</span>\n </div>\n }\n </th>\n }\n </tr>\n </thead>\n @if (loading()) {\n <tbody class=\"border-b _shk-border dark:[border-color:var(--shk-surface-100)]\">\n <tr>\n <td [attr.colspan]=\"totalColspan()\" class=\"text-center py-12\">\n <div\n class=\"flex items-center justify-center\"\n role=\"status\"\n [attr.aria-label]=\"'common.loading' | transloco\"\n >\n <svg\n [lucideIcon]=\"getIcon('loader')\"\n class=\"w-6 h-6 animate-spin _shk-text-primary\"\n ></svg>\n </div>\n </td>\n </tr>\n </tbody>\n } @else if (effectiveDisplayedData().length === 0) {\n <tbody class=\"border-b _shk-border dark:[border-color:var(--shk-surface-100)]\">\n <tr>\n <td [attr.colspan]=\"totalColspan()\" class=\"text-center py-12\">\n <div class=\"flex flex-col items-center\">\n <div\n class=\"w-16 h-16 _shk-bg-surface-100 dark:[background-color:var(--shk-surface-100)] rounded-full flex items-center justify-center mb-4\"\n >\n <svg\n [lucideIcon]=\"getIcon('inbox')\"\n class=\"w-8 h-8 _shk-text-surface-400 dark:[color:var(--shk-surface-500)]\"\n ></svg>\n </div>\n <p\n class=\"text-lg font-semibold _shk-text-surface-600 dark:[color:var(--shk-surface-300)]\"\n >\n {{ emptyMessage() || ('common.no_records' | transloco) }}\n </p>\n </div>\n </td>\n </tr>\n </tbody>\n } @else {\n <tbody>\n @for (rowData of effectiveDisplayedData(); track trackByRow(rowData, $index)) {\n <tr\n [attr.aria-selected]=\"selectable() ? isRowSelected(rowData) : null\"\n [class.shk-row-selected]=\"selectable() && isRowSelected(rowData)\"\n class=\"hover:[background-color:color-mix(in srgb,var(--shk-primary-50)30%,transparent)] dark:hover:[background-color:color-mix(in srgb,var(--shk-primary-900)10%,transparent)] transition-colors duration-200 border-b _shk-border dark:[border-color:var(--shk-surface-100)]\"\n >\n @if (selectable()) {\n <td data-shk-select class=\"w-10 px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-center\">\n <input\n type=\"checkbox\"\n class=\"shk-table-checkbox\"\n [checked]=\"isRowSelected(rowData)\"\n [disabled]=\"!canSelectRow(rowData)\"\n (change)=\"toggleRowSelection(rowData)\"\n [attr.aria-label]=\"'table.selectRow' | transloco: { index: first() + $index + 1 }\"\n />\n </td>\n }\n @for (col of columnsWithActions(); track col.field) {\n <td\n [attr.data-shk-actions]=\"col.field === 'actions' ? '' : null\"\n [class]=\"\n 'px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-xs font-medium _shk-text-surface-700 dark:[color:var(--shk-surface-700)] ' +\n (col.field === 'actions' ? 'whitespace-nowrap' : 'whitespace-normal break-words')\n \"\n [style.overflow]=\"col.field === 'actions' ? 'visible' : 'visible'\"\n [style.text-overflow]=\"'clip'\"\n [style.--shk-col-width]=\"col.field !== 'actions' ? getColumnWidth(col) : null\"\n >\n @if (col.field !== 'actions') {\n @if (col.template === 'tag') {\n <shk-tag\n [value]=\"getTagValue(col, rowData)\"\n [severity]=\"getTagSeverity(col, rowData)\"\n [rounded]=\"getTagRounded(col, rowData)\"\n [icon]=\"getTagIcon(col, rowData)\"\n [style]=\"getTagStyle(col, rowData)\"\n />\n } @else if (col.format) {\n <span>{{ col.format(rowData) }}</span>\n } @else {\n <ng-container\n *ngTemplateOutlet=\"\n customTemplates()[col.field] || defaultTemplate;\n context: { $implicit: rowData, field: col.field }\n \"\n ></ng-container>\n }\n } @else {\n <div class=\"flex items-center justify-start gap-px\">\n @for (action of getVisibleRowActions(rowData); track $index) {\n @if (isRowActionVisible(action, rowData)) {\n <div class=\"relative group\">\n <shk-tooltip\n [text]=\"getRowActionLabel(action, rowData)\"\n position=\"top\"\n >\n <button\n type=\"button\"\n (click)=\"action.onClick(rowData)\"\n [class]=\"\n 'table-action-btn hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] rounded-md ' +\n getRowActionClass(action, rowData)\n \"\n [disabled]=\"isRowActionDisabled(action, rowData) || false\"\n [attr.aria-label]=\"getRowActionLabel(action, rowData)\"\n >\n <svg\n [lucideIcon]=\"getIcon(getRowActionIconName(action, rowData))\"\n class=\"w-4 h-4\"\n ></svg>\n </button>\n </shk-tooltip>\n </div>\n }\n }\n @if (getHiddenRowActions(rowData).length > 0) {\n <div class=\"relative\">\n <shk-tooltip\n [text]=\"'common.more_options' | transloco\"\n position=\"top\"\n >\n <button\n type=\"button\"\n (click)=\"$event.stopPropagation(); toggleActionsDropdown(rowData, $event)\"\n class=\"table-action-btn hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] rounded-md\"\n [attr.aria-label]=\"'common.more_options' | transloco\"\n [attr.aria-expanded]=\"isActionsDropdownOpen(rowData)\"\n >\n <svg\n [lucideIcon]=\"getIcon('ellipsis-vertical')\"\n class=\"w-4 h-4\"\n ></svg>\n </button>\n </shk-tooltip>\n @if (isActionsDropdownOpen(rowData)) {\n <div\n shkPortal\n class=\"fixed z-[9999] min-w-[160px] bg-white dark:[background-color:var(--shk-surface-100)] border _shk-border dark:[border-color:var(--shk-surface-200)] rounded-md shadow-lg py-1\"\n [style.top]=\"dropdownPosition().top + 'px'\"\n [style.left]=\"dropdownPosition().left + 'px'\"\n >\n @for (action of getHiddenRowActions(rowData); track $index) {\n <button\n type=\"button\"\n (click)=\"action.onClick(rowData); toggleActionsDropdown(rowData)\"\n [disabled]=\"isRowActionDisabled(action, rowData) || false\"\n [class]=\"\n 'w-full flex items-center gap-2 px-3 py-2 text-xs text-left _shk-text-surface-700 dark:[color:var(--shk-surface-700)] hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors ' +\n getRowActionClass(action, rowData)\n \"\n >\n <svg\n [lucideIcon]=\"getIcon(getRowActionIconName(action, rowData))\"\n class=\"w-3.5 h-3.5 shrink-0\"\n ></svg>\n <span>{{ getRowActionLabel(action, rowData) }}</span>\n </button>\n }\n </div>\n }\n </div>\n }\n </div>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n }\n </table>\n <ng-template #defaultTemplate let-rowData let-field=\"field\">\n {{ rowData[field] }}\n </ng-template>\n </div>\n <div\n class=\"table-pagination flex items-center justify-between gap-4 px-2 min-[1440px]:px-3 py-2 border-t _shk-border dark:[border-color:var(--shk-surface-100)]\"\n >\n <div class=\"text-xs _shk-text-surface-600 dark:[color:var(--shk-surface-400)]\">\n {{ pageReport() }}\n </div>\n <div\n class=\"flex items-center gap-0.5\"\n role=\"navigation\"\n >\n <button\n type=\"button\"\n (click)=\"goToFirst()\"\n [disabled]=\"isFirstPage()\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:[color:var(--shk-surface-400)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [lucideIcon]=\"getIcon('chevrons-left')\" class=\"w-4 h-4\"></svg>\n </button>\n <button\n type=\"button\"\n (click)=\"prev()\"\n [disabled]=\"isFirstPage()\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:[color:var(--shk-surface-400)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [lucideIcon]=\"getIcon('chevron-left')\" class=\"w-4 h-4\"></svg>\n </button>\n <span\n class=\"px-2 text-xs font-medium _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"\n >{{ currentPage() }} / {{ totalPages() }}</span\n >\n <button\n type=\"button\"\n (click)=\"next()\"\n [disabled]=\"isLastPage()\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:[color:var(--shk-surface-400)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [lucideIcon]=\"getIcon('chevron-right')\" class=\"w-4 h-4\"></svg>\n </button>\n <button\n type=\"button\"\n (click)=\"goToLast()\"\n [disabled]=\"isLastPage()\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:[color:var(--shk-surface-400)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [lucideIcon]=\"getIcon('chevrons-right')\" class=\"w-4 h-4\"></svg>\n </button>\n </div>\n <div\n class=\"flex items-center gap-1.5 text-xs _shk-text-surface-600 dark:[color:var(--shk-surface-400)]\"\n >\n <label [for]=\"uid + '-rows-per-page'\">{{ 'table.rows' | transloco }}</label>\n <select\n [id]=\"uid + '-rows-per-page'\"\n [value]=\"rowsPerPageLocal()\"\n (change)=\"onRowsPerPageChange($any($event.target).value)\"\n class=\"border _shk-border dark:[border-color:var(--shk-surface-200)] rounded px-2 py-1 text-xs bg-white dark:[background-color:var(--shk-surface-100)] _shk-text-surface-700 dark:[color:var(--shk-surface-700)] focus:outline-none focus:[border-color:var(--shk-primary-500)]\"\n >\n @for (opt of rowsPerPageOptions(); track opt) {\n <option [value]=\"opt\">{{ opt }}</option>\n }\n </select>\n </div>\n </div>\n </div>\n</div>\n", styles: ["input:focus{outline:none}input[type=text]{font-weight:400!important}table th{white-space:nowrap}table td{white-space:normal;overflow-wrap:break-word}.shk-page-btn{display:inline-flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;border-radius:.375rem;transition:background-color .15s ease,color .15s ease}.shk-page-btn:hover:not(:disabled){background-color:var(--shk-surface-100)}:host-context(.dark) .shk-page-btn:hover:not(:disabled){background-color:var(--shk-surface-200)}.shk-page-btn:focus-visible{outline:none;box-shadow:0 0 0 2px color-mix(in srgb,var(--shk-primary-500) 45%,transparent)}td button svg{width:1.125rem!important;height:1.125rem!important}td button:disabled{opacity:.4;cursor:not-allowed}.table-action-btn svg{width:1rem!important;height:1rem!important;min-width:1rem!important;min-height:1rem!important}.table-action-btn{padding:.5rem!important;min-width:2rem!important;min-height:2rem!important;display:inline-flex!important;align-items:center!important;justify-content:center!important}.table-scroll-wrapper{width:100%;overflow-x:auto;overflow-y:hidden;border-radius:inherit;-webkit-overflow-scrolling:touch;container-type:inline-size}.table-card,.table-pagination{container-type:inline-size}@container (max-width: 640px){.table-pagination{flex-direction:column;align-items:center;gap:.5rem}.table-pagination>div{justify-content:center}}.table-scroll-wrapper table{table-layout:auto;width:100%}@container (max-width: 768px){.table-scroll-wrapper{scroll-snap-type:x mandatory}.table-scroll-wrapper table{table-layout:auto;width:100%}.table-scroll-wrapper th:not([data-shk-actions]):not([data-shk-select]){min-width:var(--shk-col-width, 140px)}.table-scroll-wrapper td:not([data-shk-actions]):not([data-shk-select]){min-width:var(--shk-col-width, 140px);max-width:var(--shk-col-width, 140px)}.table-scroll-wrapper th,.table-scroll-wrapper td{scroll-snap-align:start}}th[data-shk-select],td[data-shk-select]{width:2.5rem;min-width:2.5rem}.shk-table-checkbox{width:.875rem;height:.875rem;cursor:pointer;vertical-align:middle;accent-color:var(--shk-primary-500)}.shk-table-checkbox:disabled{opacity:.4;cursor:not-allowed}tr.shk-row-selected{background-color:color-mix(in srgb,var(--shk-primary-50) 60%,transparent)}tr.shk-row-selected:hover{background-color:color-mix(in srgb,var(--shk-primary-50) 90%,transparent)}:host-context(.dark) tr.shk-row-selected{background-color:color-mix(in srgb,var(--shk-primary-900) 20%,transparent)}:host-context(.dark) tr.shk-row-selected:hover{background-color:color-mix(in srgb,var(--shk-primary-900) 30%,transparent)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"] }]
943
- }], ctorParameters: () => [], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], rowsPerPage: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowsPerPage", required: false }] }], rowsPerPageOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowsPerPageOptions", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], showActionRow: [{ type: i0.Input, args: [{ isSignal: true, alias: "showActionRow", required: false }] }], customTemplates: [{ type: i0.Input, args: [{ isSignal: true, alias: "customTemplates", required: false }] }], headerActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "headerActions", required: false }] }], rowActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowActions", required: false }] }], hasShadow: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasShadow", required: false }] }], defaultSortField: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultSortField", required: false }] }], defaultSortOrder: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultSortOrder", required: false }] }], showSearch: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSearch", required: false }] }], searchPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchPlaceholder", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], serverSide: [{ type: i0.Input, args: [{ isSignal: true, alias: "serverSide", required: false }] }], totalRecords: [{ type: i0.Input, args: [{ isSignal: true, alias: "totalRecords", required: false }] }], filters: [{ type: i0.Input, args: [{ isSignal: true, alias: "filters", required: false }] }], activeFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeFilter", required: false }] }], selectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectable", required: false }] }], dataKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataKey", required: false }] }], isRowSelectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "isRowSelectable", required: false }] }], bulkActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "bulkActions", required: false }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }, { type: i0.Output, args: ["selectionChange"] }], refresh: [{ type: i0.Output, args: ["refresh"] }], pageChange: [{ type: i0.Output, args: ["pageChange"] }], filterChange: [{ type: i0.Output, args: ["filterChange"] }], searchChange: [{ type: i0.Output, args: ["searchChange"] }], filterClick: [{ type: i0.Output, args: ["filterClick"] }], onDocumentClick: [{
1599
+ ], template: "<div class=\"space-y-2 min-[1440px]:space-y-3 mt-2 min-[1440px]:mt-3 animate-fade-in pb-8\">\n @if (\n showSearch() ||\n missingRowsCount() > 0 ||\n (showClearButton() && hasFilterableColumns()) ||\n filters().length > 0 ||\n headerActions().length > 0 ||\n (selectable() && bulkActions().length > 0 && selection().length > 0)\n ) {\n <div class=\"card p-2 min-[1440px]:p-2.5 flex flex-row items-center justify-between gap-2\">\n <div class=\"flex items-center gap-2 min-[1440px]:gap-3 flex-1 min-w-0\">\n @if (missingRowsCount() > 0) {\n <span\n class=\"shk-missing-summary inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md whitespace-nowrap order-last\"\n role=\"status\"\n >\n <svg [lucideIcon]=\"getIcon('triangle-alert')\" class=\"w-3.5 h-3.5 shrink-0\"></svg>\n {{ tr('table.missing.summary', '{{count}} fila(s) con datos faltantes', { count: missingRowsCount() }) }}\n </span>\n }\n @if (showSearch()) {\n <div class=\"relative w-full md:w-52 min-[1440px]:w-56\">\n <label [for]=\"uid + '-search'\" class=\"sr-only\">{{\n searchPlaceholder() || ('common.search_placeholder' | transloco)\n }}</label>\n <div class=\"absolute inset-y-0 left-0 pl-2.5 flex items-center pointer-events-none\">\n <svg\n [lucideIcon]=\"getIcon('search')\"\n class=\"w-3.5 h-3.5 _shk-text-surface-400 dark:[color:var(--shk-surface-500)]\"\n ></svg>\n </div>\n <input\n [id]=\"uid + '-search'\"\n type=\"text\"\n [value]=\"searchQuery()\"\n (input)=\"onSearchInput($any($event.target).value)\"\n [placeholder]=\"searchPlaceholder() || ('common.search_placeholder' | transloco)\"\n class=\"block w-full pl-8 pr-3 py-1.5 text-xs border _shk-border dark:[border-color:var(--shk-surface-200)] rounded-md leading-5 _shk-bg-surface-50 dark:[background-color:var(--shk-surface-100)] placeholder:[color:var(--shk-surface-400)] dark:placeholder:[color:var(--shk-surface-500)] _shk-text-surface-700 dark:[color:var(--shk-surface-700)] focus:outline-none focus:bg-white dark:focus:[background-color:var(--shk-surface-100)] focus:[border-color:var(--shk-primary-500)] focus:ring-1 focus:[--tw-ring-color:var(--shk-primary-500)]\"\n />\n </div>\n }\n @if (showClearButton() && (hasFilterableColumns() || showSearch())) {\n <shk-tooltip [text]=\"tr('table.clearFilters', 'Limpiar b\u00FAsqueda, filtros y orden')\">\n <button\n type=\"button\"\n (click)=\"clearAll()\"\n [disabled]=\"!hasActiveFilters()\"\n class=\"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md border _shk-border dark:[border-color:var(--shk-surface-200)] _shk-text-surface-600 dark:[color:var(--shk-surface-500)] hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] transition-colors disabled:opacity-40 disabled:cursor-not-allowed whitespace-nowrap\"\n >\n <svg [lucideIcon]=\"icons.clear\" class=\"w-3.5 h-3.5\"></svg>\n {{ tr('table.clear', 'Limpiar') }}\n </button>\n </shk-tooltip>\n }\n @if (filters().length > 0) {\n <div\n class=\"flex _shk-bg-surface-100 dark:[background-color:var(--shk-surface-100)] p-0.5 rounded-md ml-auto\"\n role=\"group\"\n >\n @for (f of filters(); track f.value) {\n <button\n type=\"button\"\n (click)=\"onFilterClick(f.value)\"\n [attr.aria-pressed]=\"f.value === activeFilter()\"\n class=\"px-2.5 min-[1440px]:px-3 py-1 text-xs font-medium rounded _shk-text-surface-700 dark:[color:var(--shk-surface-700)] transition-all\"\n [class]=\"\n f.value === activeFilter()\n ? 'bg-white shadow-sm dark:[background-color:var(--shk-surface-700)]'\n : ''\n \"\n >\n {{ f.label }}\n </button>\n }\n </div>\n }\n </div>\n @if (selectable() && selection().length > 0 && bulkActions().length > 0) {\n <div\n class=\"flex items-center gap-1.5 shrink-0\"\n role=\"toolbar\"\n [attr.aria-label]=\"'table.selected' | transloco: { count: selection().length }\"\n >\n <span\n class=\"text-xs font-medium _shk-text-surface-600 dark:[color:var(--shk-surface-400)] whitespace-nowrap\"\n aria-live=\"polite\"\n >{{ 'table.selected' | transloco: { count: selection().length } }}</span\n >\n <button\n type=\"button\"\n (click)=\"clearSelection()\"\n [attr.aria-label]=\"'table.clearSelection' | transloco\"\n class=\"table-action-btn rounded-md _shk-text-surface-500 dark:[color:var(--shk-surface-400)] hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)]\"\n >\n <svg [lucideIcon]=\"getIcon('x')\" class=\"w-3.5 h-3.5\"></svg>\n </button>\n @for (action of visibleBulkActions(); track $index) {\n <button\n type=\"button\"\n [class]=\"\n 'inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors disabled:opacity-50 disabled:cursor-not-allowed ' +\n (action.class || '')\n \"\n [disabled]=\"isBulkActionDisabled(action)\"\n [attr.aria-label]=\"action.label\"\n (click)=\"runBulkAction(action)\"\n >\n @if (action.icon) {\n <svg [lucideIcon]=\"getIcon(action.icon)\" class=\"w-3.5 h-3.5\"></svg>\n }\n {{ action.label }}\n </button>\n }\n </div>\n }\n @if (headerActions().length > 0) {\n <div class=\"flex items-center gap-1.5 shrink-0\">\n @for (action of headerActions(); track $index) {\n @if (isHeaderActionVisible(action)) {\n <button\n type=\"button\"\n [class]=\"\n 'inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors disabled:opacity-50 disabled:cursor-not-allowed ' +\n (action.class || '')\n \"\n [disabled]=\"isHeaderActionDisabled(action)\"\n [attr.aria-label]=\"action.label\"\n (click)=\"action.onClick()\"\n >\n @if (action.icon) {\n <svg [lucideIcon]=\"getIcon(action.icon)\" class=\"w-3.5 h-3.5\"></svg>\n }\n {{ action.label }}\n </button>\n }\n }\n </div>\n }\n </div>\n }\n <div class=\"card p-0 overflow-hidden table-card\" [class.shadow-lg]=\"hasShadow()\">\n <div class=\"table-scroll-wrapper _shk-scrollbar\">\n <table [class.shk-gridlines]=\"showGridlines()\" [class.shk-row-hover]=\"rowHover()\">\n <thead>\n <tr>\n @if (selectable()) {\n <th\n scope=\"col\"\n data-shk-select\n class=\"w-10 px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-center _shk-bg-surface-50 dark:[background-color:var(--shk-surface-100)] border-b _shk-border dark:[border-color:var(--shk-surface-200)]\"\n >\n <input\n type=\"checkbox\"\n class=\"shk-table-checkbox\"\n [checked]=\"allPageSelected()\"\n [indeterminate]=\"somePageSelected()\"\n [disabled]=\"loading() || selectablePageRows().length === 0\"\n (change)=\"toggleSelectAllPage()\"\n [attr.aria-label]=\"'table.selectAll' | transloco\"\n />\n </th>\n }\n @if (validateRequired()) {\n <th\n scope=\"col\"\n data-shk-status\n class=\"w-8 px-1 py-2 min-[1440px]:py-2.5 _shk-bg-surface-50 dark:[background-color:var(--shk-surface-100)] border-b _shk-border dark:[border-color:var(--shk-surface-200)]\"\n >\n <span class=\"sr-only\">{{ tr('table.missing.column', 'Datos faltantes') }}</span>\n </th>\n }\n @for (col of columnsWithActions(); track col.field) {\n <th\n scope=\"col\"\n (click)=\"onHeaderClick(col)\"\n (keydown)=\"onHeaderKeydown($event, col)\"\n [tabindex]=\"col.field !== 'actions' && col.sortable ? 0 : -1\"\n [attr.role]=\"col.field !== 'actions' && col.sortable ? 'button' : null\"\n [attr.aria-sort]=\"getAriaSort(col)\"\n [attr.data-shk-actions]=\"col.field === 'actions' ? '' : null\"\n [style.cursor]=\"col.field !== 'actions' && col.sortable ? 'pointer' : 'default'\"\n [style.width]=\"resizedWidth(col) || (col.field === 'actions' ? col.width : null)\"\n [style.min-width]=\"resizedWidth(col) || (col.field === 'actions' ? col.width : col.minWidth) || null\"\n [style.--shk-col-width]=\"col.field !== 'actions' ? getColumnWidth(col) : null\"\n class=\"relative px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-left text-[10px] min-[1440px]:text-xs font-bold _shk-text-surface-500 dark:[color:var(--shk-surface-400)] uppercase tracking-wider _shk-bg-surface-50 dark:[background-color:var(--shk-surface-100)] border-b _shk-border dark:[border-color:var(--shk-surface-200)] focus:outline-none focus-visible:ring-1 focus-visible:[--tw-ring-color:var(--shk-primary-500)]\"\n >\n @if (col.field !== 'actions') {\n <div class=\"flex items-center justify-between gap-2\">\n <span>{{ col.header }}</span>\n <div class=\"flex items-center gap-1 shrink-0\">\n @if (col.sortable) {\n <shk-tooltip [text]=\"'table.tooltips.sort' | transloco\">\n @if (sortField() === col.field) {\n <svg\n [lucideIcon]=\"getIcon(sortOrder() === 1 ? 'arrow-up' : 'arrow-down')\"\n class=\"w-3.5 h-3.5 _shk-text-primary\"\n ></svg>\n } @else {\n <svg\n [lucideIcon]=\"getIcon('arrow-up-down')\"\n class=\"w-3.5 h-3.5 _shk-text-surface-400 dark:[color:var(--shk-surface-500)]\"\n ></svg>\n }\n </shk-tooltip>\n }\n @if (col.filter) {\n <shk-tooltip [text]=\"'table.tooltips.filter' | transloco\">\n <button\n type=\"button\"\n (click)=\"$event.stopPropagation(); toggleFilter(col, $event)\"\n [attr.aria-label]=\"('table.tooltips.filter' | transloco) + ': ' + col.header\"\n [attr.aria-expanded]=\"openFilterField() === col.field\"\n aria-haspopup=\"dialog\"\n class=\"_shk-text-surface-400 dark:[color:var(--shk-surface-500)] hover:[color:var(--shk-surface-600)] dark:hover:[color:var(--shk-surface-300)] transition-colors\"\n >\n <svg\n [lucideIcon]=\"getIcon('filter')\"\n class=\"w-3.5 h-3.5\"\n [class._shk-text-primary]=\"hasFilterValue(col.field) || openFilterField() === col.field\"\n ></svg>\n </button>\n </shk-tooltip>\n }\n </div>\n </div>\n\n\n <!-- Column filter menu -->\n @if (col.filter && openFilterField() === col.field && filterDraft(); as draft) {\n <div\n shkPortal\n class=\"shk-filter-overlay fixed z-[9999] w-[240px] overflow-y-auto normal-case tracking-normal font-normal text-xs _shk-text-surface-700 dark:[color:var(--shk-surface-700)] bg-white dark:[background-color:var(--shk-surface-100)] border _shk-border dark:[border-color:var(--shk-surface-200)] rounded-lg shadow-lg\"\n role=\"dialog\"\n [attr.aria-label]=\"('table.tooltips.filter' | transloco) + ': ' + col.header\"\n [style.top.px]=\"filterPopupPosition().top\"\n [style.left.px]=\"filterPopupPosition().left\"\n [style.max-height.px]=\"filterPopupPosition().maxHeight\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"$event.stopPropagation()\"\n (keydown.escape)=\"closeFilters()\"\n >\n @if (col.filterMenuTitle) {\n <div class=\"px-2 pt-2 font-semibold _shk-text-surface-800 dark:[color:var(--shk-surface-800)]\">\n {{ col.filterMenuTitle }}\n </div>\n }\n @if (showOperatorFor(col)) {\n <div class=\"p-2 border-b _shk-border dark:[border-color:var(--shk-surface-200)]\">\n <select\n class=\"shk-filter-select\"\n [attr.aria-label]=\"filterLabel('matchAll') + ' / ' + filterLabel('matchAny')\"\n (change)=\"setDraftOperator($any($event.target).value)\"\n >\n <option value=\"and\" [selected]=\"draft.operator === 'and'\">\n {{ filterLabel('matchAll') }}\n </option>\n <option value=\"or\" [selected]=\"draft.operator === 'or'\">\n {{ filterLabel('matchAny') }}\n </option>\n </select>\n </div>\n }\n\n @switch (filterKind(col)) {\n @case ('select') {\n <ng-container\n *ngTemplateOutlet=\"optionList; context: { $implicit: col, draft: draft, multiple: false }\"\n ></ng-container>\n }\n @case ('multiselect') {\n <ng-container\n *ngTemplateOutlet=\"optionList; context: { $implicit: col, draft: draft, multiple: true }\"\n ></ng-container>\n }\n @case ('boolean') {\n @let boolValue = draft.rules[0].value;\n <div class=\"p-2\">\n <button\n type=\"button\"\n role=\"checkbox\"\n [id]=\"uid + '-filter-' + safeId(col.field) + '-0'\"\n class=\"inline-flex items-center gap-2 rounded-md focus:outline-none focus-visible:ring-1 focus-visible:[--tw-ring-color:var(--shk-primary-500)]\"\n [attr.aria-checked]=\"\n boolValue === true ? 'true' : boolValue === false ? 'false' : 'mixed'\n \"\n (click)=\"cycleBoolean(col)\"\n >\n <span\n class=\"shk-checkbox-box\"\n [class.shk-checked]=\"boolValue === true || boolValue === false\"\n >\n @if (boolValue === true) {\n <svg [lucideIcon]=\"getIcon('check')\"></svg>\n } @else if (boolValue === false) {\n <svg [lucideIcon]=\"getIcon('x')\"></svg>\n }\n </span>\n <span>{{\n boolValue === true\n ? filterLabel('yes')\n : boolValue === false\n ? filterLabel('no')\n : filterLabel('any')\n }}</span>\n </button>\n </div>\n }\n @case ('range') {\n @let rv = rangeValue(col);\n @let bounds = rangeBounds(col);\n <div class=\"p-2\">\n <div class=\"shk-range\">\n <div class=\"shk-range-track\"></div>\n <div\n class=\"shk-range-fill\"\n [style.left.%]=\"rangePercent(col, rv[0])\"\n [style.width.%]=\"rangePercent(col, rv[1]) - rangePercent(col, rv[0])\"\n ></div>\n <input\n type=\"range\"\n [id]=\"uid + '-filter-' + safeId(col.field) + '-0'\"\n [min]=\"bounds[0]\"\n [max]=\"bounds[1]\"\n [step]=\"col.filterStep || 1\"\n [value]=\"rv[0]\"\n [style.z-index]=\"rv[0] >= bounds[1] ? 3 : null\"\n [attr.aria-label]=\"col.header + ' min'\"\n (input)=\"onRangeInput(col, 0, $any($event.target).value, false)\"\n (change)=\"onRangeInput(col, 0, $any($event.target).value, true)\"\n />\n <input\n type=\"range\"\n [min]=\"bounds[0]\"\n [max]=\"bounds[1]\"\n [step]=\"col.filterStep || 1\"\n [value]=\"rv[1]\"\n [attr.aria-label]=\"col.header + ' max'\"\n (input)=\"onRangeInput(col, 1, $any($event.target).value, false)\"\n (change)=\"onRangeInput(col, 1, $any($event.target).value, true)\"\n />\n </div>\n <div class=\"flex items-center justify-between px-0.5 _shk-text-surface-500 dark:[color:var(--shk-surface-500)]\">\n <span>{{ rv[0] }}</span>\n <span>{{ rv[1] }}</span>\n </div>\n </div>\n }\n @default {\n <!-- text / numeric / date: one block per rule -->\n @for (rule of draft.rules; track $index; let i = $index) {\n <div\n class=\"flex flex-col gap-1.5 p-2\"\n [class.border-b]=\"i < draft.rules.length - 1\"\n [class._shk-border]=\"i < draft.rules.length - 1\"\n >\n @if (showMatchModesFor(col)) {\n <select\n class=\"shk-filter-select\"\n [attr.aria-label]=\"col.header\"\n (change)=\"setDraftMatchMode(col, i, $any($event.target).value)\"\n >\n @for (mode of matchModesFor(col); track mode) {\n <option [value]=\"mode\" [selected]=\"mode === rule.matchMode\">\n {{ matchModeLabel(mode) }}\n </option>\n }\n </select>\n }\n <input\n [id]=\"uid + '-filter-' + safeId(col.field) + '-' + i\"\n [type]=\"filterKind(col) === 'numeric' ? 'number' : filterKind(col) === 'date' ? 'date' : 'text'\"\n [attr.step]=\"filterKind(col) === 'numeric' ? 'any' : null\"\n class=\"shk-filter-input\"\n [value]=\"rule.value ?? ''\"\n [placeholder]=\"col.filterPlaceholder || ('common.search_placeholder' | transloco)\"\n [attr.aria-label]=\"col.header\"\n (input)=\"onRuleInput(col, i, $any($event.target).value)\"\n (keydown.enter)=\"applyFilter(col)\"\n />\n @if (draft.rules.length > 1) {\n <button\n type=\"button\"\n class=\"inline-flex items-center justify-center gap-1 py-1 rounded-md [color:var(--shk-error-600)] hover:[background-color:var(--shk-error-50)] transition-colors\"\n (click)=\"removeRule(i)\"\n >\n <svg [lucideIcon]=\"icons.trash\" class=\"w-3.5 h-3.5\"></svg>\n {{ filterLabel('removeRule') }}\n </button>\n }\n </div>\n }\n @if (canAddRule(col)) {\n <div class=\"px-2 pb-1\">\n <button\n type=\"button\"\n class=\"w-full inline-flex items-center justify-center gap-1 py-1 rounded-md _shk-text-primary hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] transition-colors\"\n (click)=\"addRule(col)\"\n >\n <svg [lucideIcon]=\"getIcon('plus')\" class=\"w-3.5 h-3.5\"></svg>\n {{ filterLabel('addRule') }}\n </button>\n </div>\n }\n }\n }\n\n <div class=\"flex items-center justify-between gap-2 p-2 border-t _shk-border dark:[border-color:var(--shk-surface-200)]\">\n <button\n type=\"button\"\n class=\"px-3 py-1.5 font-medium rounded-md border _shk-border dark:[border-color:var(--shk-surface-200)] _shk-text-surface-600 dark:[color:var(--shk-surface-500)] hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] transition-colors\"\n (click)=\"clearFilter(col.field)\"\n >\n {{ filterLabel('clear') }}\n </button>\n <button\n type=\"button\"\n class=\"px-3 py-1.5 font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors\"\n (click)=\"applyFilter(col)\"\n >\n {{ filterLabel('apply') }}\n </button>\n </div>\n </div>\n }\n } @else {\n <div class=\"flex items-center justify-center\">\n <span>{{ col.header }}</span>\n </div>\n }\n @if (isResizable()) {\n <span\n class=\"shk-col-resizer\"\n [class.shk-resizing]=\"resizingField() === col.field\"\n role=\"separator\"\n aria-orientation=\"vertical\"\n tabindex=\"0\"\n [attr.aria-label]=\"tr('table.resizeColumn', 'Redimensionar columna') + ': ' + col.header\"\n [attr.aria-valuenow]=\"resizedWidthPx(col)\"\n (pointerdown)=\"startResize($event, col)\"\n (click)=\"$event.stopPropagation()\"\n (dblclick)=\"$event.stopPropagation(); resetColumnWidth(col)\"\n (keydown)=\"onResizerKeydown($event, col)\"\n ></span>\n }\n </th>\n }\n </tr>\n </thead>\n @if (loading()) {\n <tbody class=\"border-b _shk-border dark:[border-color:var(--shk-surface-100)]\">\n <tr>\n <td [attr.colspan]=\"totalColspan()\" class=\"text-center py-12\">\n <div\n class=\"flex items-center justify-center\"\n role=\"status\"\n [attr.aria-label]=\"'common.loading' | transloco\"\n >\n <svg\n [lucideIcon]=\"getIcon('loader')\"\n class=\"w-6 h-6 animate-spin _shk-text-primary\"\n ></svg>\n </div>\n </td>\n </tr>\n </tbody>\n } @else if (effectiveDisplayedData().length === 0) {\n <tbody class=\"border-b _shk-border dark:[border-color:var(--shk-surface-100)]\">\n <tr>\n <td [attr.colspan]=\"totalColspan()\" class=\"text-center py-12\">\n <div class=\"flex flex-col items-center\">\n <div\n class=\"w-16 h-16 _shk-bg-surface-100 dark:[background-color:var(--shk-surface-100)] rounded-full flex items-center justify-center mb-4\"\n >\n <svg\n [lucideIcon]=\"getIcon('inbox')\"\n class=\"w-8 h-8 _shk-text-surface-400 dark:[color:var(--shk-surface-500)]\"\n ></svg>\n </div>\n <p\n class=\"text-lg font-semibold _shk-text-surface-600 dark:[color:var(--shk-surface-300)]\"\n >\n {{ emptyMessage() || ('common.no_records' | transloco) }}\n </p>\n </div>\n </td>\n </tr>\n </tbody>\n } @else {\n <tbody>\n @for (rowData of effectiveDisplayedData(); track trackByRow(rowData, $index)) {\n <tr\n [attr.aria-selected]=\"selectable() ? isRowSelected(rowData) : null\"\n [class.shk-row-selected]=\"selectable() && isRowSelected(rowData)\"\n [class.shk-row-missing]=\"missingFields(rowData).length > 0\"\n class=\"shk-data-row transition-colors duration-200 border-b _shk-border dark:[border-color:var(--shk-surface-100)]\"\n >\n @if (selectable()) {\n <td data-shk-select class=\"w-10 px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-center\">\n <input\n type=\"checkbox\"\n class=\"shk-table-checkbox\"\n [checked]=\"isRowSelected(rowData)\"\n [disabled]=\"!canSelectRow(rowData)\"\n (change)=\"toggleRowSelection(rowData)\"\n [attr.aria-label]=\"'table.selectRow' | transloco: { index: first() + $index + 1 }\"\n />\n </td>\n }\n @if (validateRequired()) {\n <td data-shk-status class=\"w-8 px-1 py-2 text-center\">\n @if (missingFields(rowData); as missing) {\n @if (missing.length > 0) {\n <shk-tooltip [text]=\"missingRowMessage(missing)\" position=\"right\" mode=\"fixed\">\n <svg\n [lucideIcon]=\"getIcon('triangle-alert')\"\n class=\"shk-missing-icon w-4 h-4 inline-block\"\n role=\"img\"\n [attr.aria-label]=\"missingRowMessage(missing)\"\n ></svg>\n </shk-tooltip>\n }\n }\n </td>\n }\n @for (col of columnsWithActions(); track col.field) {\n <td\n [attr.data-shk-actions]=\"col.field === 'actions' ? '' : null\"\n [class]=\"\n 'px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-xs font-medium _shk-text-surface-700 dark:[color:var(--shk-surface-700)] ' +\n (col.field === 'actions' ? 'whitespace-nowrap' : 'whitespace-normal break-words')\n \"\n [style.--shk-col-width]=\"col.field !== 'actions' ? getColumnWidth(col) : null\"\n >\n @if (col.field !== 'actions' && isCellMissing(col, rowData)) {\n <span class=\"shk-missing-cell inline-flex items-center gap-1 italic\">\n <svg [lucideIcon]=\"getIcon('triangle-alert')\" class=\"w-3.5 h-3.5 shrink-0\"></svg>\n {{ missingCellMessage(col) }}\n </span>\n } @else if (col.field !== 'actions') {\n @switch (col.template) {\n @case ('tag') {\n <shk-tag\n [value]=\"getTagValue(col, rowData)\"\n [severity]=\"getTagSeverity(col, rowData)\"\n [rounded]=\"getTagRounded(col, rowData)\"\n [icon]=\"getTagIcon(col, rowData)\"\n [style]=\"getTagStyle(col, rowData)\"\n />\n }\n @case ('progress') {\n <div\n class=\"shk-progress\"\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-valuenow]=\"getProgress(col, rowData)\"\n [attr.aria-label]=\"col.header\"\n >\n <div [style.width.%]=\"getProgress(col, rowData)\"></div>\n </div>\n }\n @case ('boolean') {\n @if (resolveField(rowData, col.field)) {\n <svg\n [lucideIcon]=\"icons.yes\"\n class=\"w-4 h-4 [color:var(--shk-success-600)]\"\n role=\"img\"\n [attr.aria-label]=\"filterLabel('yes')\"\n ></svg>\n } @else {\n <svg\n [lucideIcon]=\"icons.no\"\n class=\"w-4 h-4 [color:var(--shk-error-500)]\"\n role=\"img\"\n [attr.aria-label]=\"filterLabel('no')\"\n ></svg>\n }\n }\n @case ('date') {\n {{ resolveField(rowData, col.field) | date: col.dateFormat || 'dd/MM/yyyy' }}\n }\n @case ('currency') {\n {{ resolveField(rowData, col.field) | currency: col.currency || 'USD' : 'symbol' }}\n }\n @default {\n @if (col.image) {\n <div class=\"flex items-center gap-2\">\n @if (col.image(rowData); as src) {\n <img\n [src]=\"src\"\n alt=\"\"\n [width]=\"col.imageWidth || 24\"\n class=\"shrink-0 rounded-sm\"\n />\n }\n <span>\n <ng-container\n *ngTemplateOutlet=\"cellText; context: { $implicit: rowData, col: col }\"\n ></ng-container>\n </span>\n </div>\n } @else {\n <ng-container\n *ngTemplateOutlet=\"cellText; context: { $implicit: rowData, col: col }\"\n ></ng-container>\n }\n }\n }\n } @else {\n <div class=\"flex items-center justify-start gap-px\">\n @for (action of getVisibleRowActions(rowData); track $index) {\n @if (isRowActionVisible(action, rowData)) {\n <div class=\"relative group\">\n <shk-tooltip\n [text]=\"getRowActionLabel(action, rowData)\"\n position=\"top\"\n >\n <button\n type=\"button\"\n (click)=\"action.onClick(rowData)\"\n [class]=\"\n 'table-action-btn hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] rounded-md ' +\n getRowActionClass(action, rowData)\n \"\n [disabled]=\"isRowActionDisabled(action, rowData) || false\"\n [attr.aria-label]=\"getRowActionLabel(action, rowData)\"\n >\n <svg\n [lucideIcon]=\"getIcon(getRowActionIconName(action, rowData))\"\n class=\"w-4 h-4\"\n ></svg>\n </button>\n </shk-tooltip>\n </div>\n }\n }\n @if (getHiddenRowActions(rowData).length > 0) {\n <div class=\"relative\">\n <shk-tooltip\n [text]=\"'common.more_options' | transloco\"\n position=\"top\"\n >\n <button\n type=\"button\"\n (click)=\"$event.stopPropagation(); toggleActionsDropdown(rowData, $event)\"\n class=\"table-action-btn hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] rounded-md\"\n [attr.aria-label]=\"'common.more_options' | transloco\"\n [attr.aria-expanded]=\"isActionsDropdownOpen(rowData)\"\n >\n <svg\n [lucideIcon]=\"getIcon('ellipsis-vertical')\"\n class=\"w-4 h-4\"\n ></svg>\n </button>\n </shk-tooltip>\n @if (isActionsDropdownOpen(rowData)) {\n <div\n shkPortal\n class=\"fixed z-[9999] min-w-[160px] bg-white dark:[background-color:var(--shk-surface-100)] border _shk-border dark:[border-color:var(--shk-surface-200)] rounded-md shadow-lg py-1\"\n [style.top]=\"dropdownPosition().top + 'px'\"\n [style.left]=\"dropdownPosition().left + 'px'\"\n >\n @for (action of getHiddenRowActions(rowData); track $index) {\n <button\n type=\"button\"\n (click)=\"action.onClick(rowData); toggleActionsDropdown(rowData)\"\n [disabled]=\"isRowActionDisabled(action, rowData) || false\"\n [class]=\"\n 'w-full flex items-center gap-2 px-3 py-2 text-xs text-left _shk-text-surface-700 dark:[color:var(--shk-surface-700)] hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors ' +\n getRowActionClass(action, rowData)\n \"\n >\n <svg\n [lucideIcon]=\"getIcon(getRowActionIconName(action, rowData))\"\n class=\"w-3.5 h-3.5 shrink-0\"\n ></svg>\n <span>{{ getRowActionLabel(action, rowData) }}</span>\n </button>\n }\n </div>\n }\n </div>\n }\n </div>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n }\n </table>\n\n <!-- Text content of a cell: format() \u00B7 custom template \u00B7 raw value -->\n <ng-template #cellText let-rowData let-col=\"col\">\n @if (col.format) {\n <span>{{ col.format(rowData) }}</span>\n } @else {\n <ng-container\n *ngTemplateOutlet=\"\n customTemplates()[col.field] || defaultTemplate;\n context: { $implicit: rowData, field: col.field }\n \"\n ></ng-container>\n }\n </ng-template>\n <ng-template #defaultTemplate let-rowData let-field=\"field\">\n {{ resolveField(rowData, field) }}\n </ng-template>\n\n <!-- Option list of the select / multiselect filters -->\n <ng-template #optionList let-col let-draft=\"draft\" let-multiple=\"multiple\">\n <div class=\"p-2 space-y-1.5\">\n @let selectedLabel = multiple ? selectedOptionsLabel(col) : selectedSingleLabel(col);\n <button\n type=\"button\"\n class=\"shk-filter-select flex items-center justify-between gap-2 text-left\"\n style=\"background-image: none\"\n [id]=\"uid + '-filter-' + safeId(col.field) + '-0'\"\n [attr.aria-expanded]=\"multiselectOpen()\"\n (click)=\"multiselectOpen.set(!multiselectOpen())\"\n >\n <span class=\"truncate\" [class._shk-text-surface-400]=\"!selectedLabel\">\n {{ selectedLabel || tr('table.filterAll', 'Todos') }}\n </span>\n <svg\n [lucideIcon]=\"getIcon('chevron-down')\"\n class=\"w-3.5 h-3.5 shrink-0 _shk-text-surface-400 transition-transform\"\n [class.rotate-180]=\"multiselectOpen()\"\n ></svg>\n </button>\n @if (multiselectOpen()) {\n <div\n class=\"max-h-52 overflow-y-auto p-0.5 border _shk-border dark:[border-color:var(--shk-surface-200)] rounded-md _shk-scrollbar\"\n role=\"listbox\"\n [attr.aria-multiselectable]=\"multiple\"\n >\n @for (opt of col.filterOptions || []; track $index) {\n @let isSelected = multiple\n ? isOptionSelected(opt.value)\n : draft.rules[0].value != null && draft.rules[0].value == opt.value;\n <button\n type=\"button\"\n role=\"option\"\n class=\"w-full flex items-center gap-2 px-2 py-1.5 rounded text-left transition-colors hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)]\"\n [class._shk-bg-primary-soft]=\"isSelected\"\n [class._shk-text-primary-700]=\"isSelected\"\n [attr.aria-selected]=\"isSelected\"\n (click)=\"multiple ? toggleOption(col, opt.value) : selectOption(col, opt.value)\"\n >\n @if (multiple) {\n <span class=\"shk-checkbox-box\" [class.shk-checked]=\"isSelected\">\n @if (isSelected) {\n <svg [lucideIcon]=\"getIcon('check')\"></svg>\n }\n </span>\n }\n @if (opt.image) {\n <img [src]=\"opt.image\" alt=\"\" width=\"22\" class=\"shrink-0 rounded-sm\" />\n }\n <span class=\"truncate\">{{ opt.label }}</span>\n </button>\n }\n </div>\n }\n </div>\n </ng-template>\n </div>\n <div\n class=\"table-pagination flex items-center justify-between gap-4 px-2 min-[1440px]:px-3 py-2 border-t _shk-border dark:[border-color:var(--shk-surface-100)]\"\n >\n <div class=\"text-xs _shk-text-surface-600 dark:[color:var(--shk-surface-400)]\">\n @if (showPageReport()) {\n {{ pageReport() }}\n }\n </div>\n <div\n class=\"flex items-center gap-0.5\"\n role=\"navigation\"\n >\n <button\n type=\"button\"\n (click)=\"goToFirst()\"\n [disabled]=\"isFirstPage()\"\n [attr.aria-label]=\"tr('table.firstPage', 'Primera p\u00E1gina')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:[color:var(--shk-surface-400)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [lucideIcon]=\"getIcon('chevrons-left')\" class=\"w-4 h-4\"></svg>\n </button>\n <button\n type=\"button\"\n (click)=\"prev()\"\n [disabled]=\"isFirstPage()\"\n [attr.aria-label]=\"tr('table.prevPage', 'P\u00E1gina anterior')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:[color:var(--shk-surface-400)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [lucideIcon]=\"getIcon('chevron-left')\" class=\"w-4 h-4\"></svg>\n </button>\n <span\n class=\"px-2 text-xs font-medium _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"\n >{{ currentPage() }} / {{ totalPages() }}</span\n >\n <button\n type=\"button\"\n (click)=\"next()\"\n [disabled]=\"isLastPage()\"\n [attr.aria-label]=\"tr('table.nextPage', 'P\u00E1gina siguiente')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:[color:var(--shk-surface-400)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [lucideIcon]=\"getIcon('chevron-right')\" class=\"w-4 h-4\"></svg>\n </button>\n <button\n type=\"button\"\n (click)=\"goToLast()\"\n [disabled]=\"isLastPage()\"\n [attr.aria-label]=\"tr('table.lastPage', '\u00DAltima p\u00E1gina')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:[color:var(--shk-surface-400)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [lucideIcon]=\"getIcon('chevrons-right')\" class=\"w-4 h-4\"></svg>\n </button>\n </div>\n <div\n class=\"flex items-center gap-1.5 text-xs _shk-text-surface-600 dark:[color:var(--shk-surface-400)]\"\n >\n @if (showRowsPerPage()) {\n <label [for]=\"uid + '-rows-per-page'\">{{ 'table.rows' | transloco }}</label>\n <select\n [id]=\"uid + '-rows-per-page'\"\n (change)=\"onRowsPerPageChange($any($event.target).value)\"\n class=\"border _shk-border dark:[border-color:var(--shk-surface-200)] rounded px-2 py-1 text-xs bg-white dark:[background-color:var(--shk-surface-100)] _shk-text-surface-700 dark:[color:var(--shk-surface-700)] focus:outline-none focus:[border-color:var(--shk-primary-500)]\"\n >\n @for (opt of rowsPerPageOptions(); track opt) {\n <option [value]=\"opt\" [selected]=\"opt === rowsPerPageLocal()\">{{ opt }}</option>\n }\n </select>\n }\n </div>\n </div>\n </div>\n</div>\n", styles: ["input:focus{outline:none}input[type=text]{font-weight:400!important}table th{white-space:nowrap}table td{white-space:normal;overflow-wrap:break-word}.shk-page-btn{display:inline-flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;border-radius:.375rem;transition:background-color .15s ease,color .15s ease}.shk-page-btn:hover:not(:disabled){background-color:var(--shk-surface-100)}:host-context(.dark) .shk-page-btn:hover:not(:disabled){background-color:var(--shk-surface-200)}.shk-page-btn:focus-visible{outline:none;box-shadow:0 0 0 2px color-mix(in srgb,var(--shk-primary-500) 45%,transparent)}td button svg{width:1.125rem!important;height:1.125rem!important}td button:disabled{opacity:.4;cursor:not-allowed}.table-action-btn svg{width:1rem!important;height:1rem!important;min-width:1rem!important;min-height:1rem!important}.table-action-btn{padding:.5rem!important;min-width:2rem!important;min-height:2rem!important;display:inline-flex!important;align-items:center!important;justify-content:center!important}.table-scroll-wrapper{width:100%;overflow-x:auto;overflow-y:hidden;border-radius:inherit;-webkit-overflow-scrolling:touch;container-type:inline-size}.table-card,.table-pagination{container-type:inline-size}@container (max-width: 640px){.table-pagination{flex-direction:column;align-items:center;gap:.5rem}.table-pagination>div{justify-content:center}}.table-scroll-wrapper table{table-layout:auto;width:100%}@container (max-width: 768px){.table-scroll-wrapper{scroll-snap-type:x mandatory}.table-scroll-wrapper table{table-layout:auto;width:100%}.table-scroll-wrapper th:not([data-shk-actions]):not([data-shk-select]):not([data-shk-status]){min-width:var(--shk-col-width, 140px)}.table-scroll-wrapper td:not([data-shk-actions]):not([data-shk-select]):not([data-shk-status]){min-width:var(--shk-col-width, 140px);max-width:var(--shk-col-width, 140px)}.table-scroll-wrapper th,.table-scroll-wrapper td{scroll-snap-align:start}}th[data-shk-select],td[data-shk-select]{width:2.5rem;min-width:2.5rem}.shk-table-checkbox{width:.875rem;height:.875rem;cursor:pointer;vertical-align:middle;accent-color:var(--shk-primary-500)}.shk-table-checkbox:disabled{opacity:.4;cursor:not-allowed}tr.shk-row-selected{background-color:color-mix(in srgb,var(--shk-primary-50) 60%,transparent)}tr.shk-row-selected:hover{background-color:color-mix(in srgb,var(--shk-primary-50) 90%,transparent)}:host-context(.dark) tr.shk-row-selected{background-color:color-mix(in srgb,var(--shk-primary-900) 20%,transparent)}:host-context(.dark) tr.shk-row-selected:hover{background-color:color-mix(in srgb,var(--shk-primary-900) 30%,transparent)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}th[data-shk-status],td[data-shk-status]{width:2rem;min-width:2rem}tr.shk-row-missing{background-color:color-mix(in srgb,var(--shk-warning-400) 9%,transparent)}tr.shk-row-missing>td:first-child{box-shadow:inset 3px 0 0 var(--shk-warning-400)}table.shk-row-hover tbody tr.shk-row-missing.shk-data-row:hover{background-color:color-mix(in srgb,var(--shk-warning-400) 15%,transparent)}.shk-missing-icon,.shk-missing-cell{color:var(--shk-warning-600)}:host-context(.dark) .shk-missing-icon,:host-context(.dark) .shk-missing-cell{color:var(--shk-warning-400)}.shk-missing-summary{color:var(--shk-warning-800);background-color:var(--shk-warning-50);border:1px solid color-mix(in srgb,var(--shk-warning-400) 45%,transparent)}table.shk-row-hover tbody tr.shk-data-row:hover{background-color:color-mix(in srgb,var(--shk-primary-50) 30%,transparent)}:host-context(.dark) table.shk-row-hover tbody tr.shk-data-row:hover{background-color:color-mix(in srgb,var(--shk-primary-900) 10%,transparent)}table.shk-gridlines th,table.shk-gridlines td{border-right:1px solid var(--shk-surface-200)}table.shk-gridlines th:last-child,table.shk-gridlines td:last-child{border-right:0}:host-context(.dark) table.shk-gridlines th,:host-context(.dark) table.shk-gridlines td{border-right-color:var(--shk-surface-200)}.shk-col-resizer{position:absolute;top:0;right:-4px;z-index:1;width:8px;height:100%;cursor:col-resize;touch-action:none}.shk-col-resizer:after{content:\"\";position:absolute;top:20%;bottom:20%;left:3px;width:2px;border-radius:1px;background-color:transparent;transition:background-color .15s ease}.shk-col-resizer:hover:after,.shk-col-resizer:focus-visible:after,.shk-col-resizer.shk-resizing:after{background-color:var(--shk-primary-500)}.shk-col-resizer:focus-visible{outline:none}th:last-child .shk-col-resizer{right:0}.shk-filter-input,.shk-filter-select{width:100%;padding:.375rem .625rem;font-size:.75rem;line-height:1.25rem;border-radius:.375rem;border:1px solid var(--shk-surface-200);background-color:#fff;color:var(--shk-surface-700)}.dark .shk-filter-input,.dark .shk-filter-select{background-color:var(--shk-surface-100);border-color:var(--shk-surface-200);color-scheme:dark}.shk-filter-input::placeholder{color:var(--shk-surface-400)}select.shk-filter-select{appearance:none;padding-right:1.75rem;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right .5rem center;cursor:pointer}button.shk-filter-select{cursor:pointer}.shk-filter-input:focus,.shk-filter-select:focus{outline:none;border-color:var(--shk-primary-500);box-shadow:0 0 0 1px var(--shk-primary-500)}.shk-checkbox-box{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:.875rem;height:.875rem;border-radius:.1875rem;border:1px solid var(--shk-surface-300);background-color:#fff;color:#fff}.dark .shk-checkbox-box{background-color:var(--shk-surface-100)}.shk-checkbox-box.shk-checked{background-color:var(--shk-primary-500);border-color:var(--shk-primary-500)}.shk-checkbox-box svg{width:.625rem;height:.625rem}.shk-range{position:relative;height:1rem;margin:.5rem .375rem .375rem}.shk-range-track,.shk-range-fill{position:absolute;top:50%;height:.1875rem;transform:translateY(-50%);border-radius:9999px}.shk-range-track{left:0;right:0;background-color:var(--shk-surface-200)}.shk-range-fill{background-color:var(--shk-primary-500)}.shk-range input[type=range]{position:absolute;inset:0;width:100%;margin:0;background:transparent;pointer-events:none;appearance:none;-webkit-appearance:none}.shk-range input[type=range]::-webkit-slider-thumb{pointer-events:auto;-webkit-appearance:none;width:.875rem;height:.875rem;border-radius:9999px;background:#fff;border:2px solid var(--shk-primary-500);cursor:grab}.shk-range input[type=range]::-moz-range-thumb{pointer-events:auto;width:.625rem;height:.625rem;border-radius:9999px;background:#fff;border:2px solid var(--shk-primary-500);cursor:grab}.shk-progress{height:.375rem;min-width:5rem;border-radius:9999px;background-color:var(--shk-surface-200);overflow:hidden}.shk-progress>div{height:100%;border-radius:inherit;background-color:var(--shk-primary-500)}\n"] }]
1600
+ }], ctorParameters: () => [], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], rowsPerPage: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowsPerPage", required: false }] }], rowsPerPageOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowsPerPageOptions", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], showActionRow: [{ type: i0.Input, args: [{ isSignal: true, alias: "showActionRow", required: false }] }], customTemplates: [{ type: i0.Input, args: [{ isSignal: true, alias: "customTemplates", required: false }] }], headerActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "headerActions", required: false }] }], rowActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowActions", required: false }] }], hasShadow: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasShadow", required: false }] }], defaultSortField: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultSortField", required: false }] }], defaultSortOrder: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultSortOrder", required: false }] }], showSearch: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSearch", required: false }] }], searchPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchPlaceholder", required: false }] }], globalFilterFields: [{ type: i0.Input, args: [{ isSignal: true, alias: "globalFilterFields", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], serverSide: [{ type: i0.Input, args: [{ isSignal: true, alias: "serverSide", required: false }] }], totalRecords: [{ type: i0.Input, args: [{ isSignal: true, alias: "totalRecords", required: false }] }], filters: [{ type: i0.Input, args: [{ isSignal: true, alias: "filters", required: false }] }], activeFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeFilter", required: false }] }], showGridlines: [{ type: i0.Input, args: [{ isSignal: true, alias: "showGridlines", required: false }] }], resizableColumns: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizableColumns", required: false }] }], validateRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "validateRequired", required: false }] }], columnWidths: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnWidths", required: false }] }, { type: i0.Output, args: ["columnWidthsChange"] }], stateKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "stateKey", required: false }] }], stateStorage: [{ type: i0.Input, args: [{ isSignal: true, alias: "stateStorage", required: false }] }], rowHover: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowHover", required: false }] }], showClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearButton", required: false }] }], showPageReport: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPageReport", required: false }] }], showRowsPerPage: [{ type: i0.Input, args: [{ isSignal: true, alias: "showRowsPerPage", required: false }] }], selectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectable", required: false }] }], dataKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataKey", required: false }] }], isRowSelectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "isRowSelectable", required: false }] }], bulkActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "bulkActions", required: false }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }, { type: i0.Output, args: ["selectionChange"] }], refresh: [{ type: i0.Output, args: ["refresh"] }], pageChange: [{ type: i0.Output, args: ["pageChange"] }], filterChange: [{ type: i0.Output, args: ["filterChange"] }], searchChange: [{ type: i0.Output, args: ["searchChange"] }], filterClick: [{ type: i0.Output, args: ["filterClick"] }], columnResize: [{ type: i0.Output, args: ["columnResize"] }], onDocumentClick: [{
944
1601
  type: HostListener,
945
1602
  args: ['document:click']
946
1603
  }], onEscape: [{