mn-angular-lib 2.0.22 → 2.0.24

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,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ChangeDetectorRef, afterEveryRender, TemplateRef, Input, Directive, EventEmitter, Output, ChangeDetectionStrategy, Component, ElementRef, Renderer2, DestroyRef, afterNextRender, HostListener, ViewChild } from '@angular/core';
2
+ import { inject, ChangeDetectorRef, afterEveryRender, TemplateRef, Input, Directive, EventEmitter, Output, ChangeDetectionStrategy, Component, ElementRef, Renderer2, Injector, afterNextRender, DestroyRef, HostListener, ViewChild } from '@angular/core';
3
3
  import { Subject, skip, debounceTime } from 'rxjs';
4
- import { lucideIcons, MnLanguageService } from 'mn-angular-lib/core';
4
+ import { lucideIcons, MnLanguageService, MN_IN_MODAL, MN_IN_BOTTOM_SHEET } from 'mn-angular-lib/core';
5
5
  import * as lucide from 'lucide';
6
6
  import * as i1 from '@angular/forms';
7
7
  import { FormsModule } from '@angular/forms';
@@ -1026,6 +1026,98 @@ function matchesColumnFilter(column, row, value) {
1026
1026
  return defaultFilterPredicate(column.filterType ?? 'text', resolveFilterableValue(column, row), value);
1027
1027
  }
1028
1028
 
1029
+ /** How many derived columns the second line takes before the rest goes to the sheet. */
1030
+ const ROW_META_LIMIT = 2;
1031
+ /** Widest declared width, in px, that still reads as a leading block (a rank, an avatar). */
1032
+ const LEADING_MAX_WIDTH_PX = 64;
1033
+ /**
1034
+ * How far below the phone a column already is, from its `hiddenBelow`: shown on a phone today
1035
+ * (0), hidden below `sm` (1), `md` (2) or `lg` (3). The existing setting is a priority the app
1036
+ * already expressed — the lower the tier, the more the column matters.
1037
+ * @param column The column.
1038
+ * @returns Its tier.
1039
+ */
1040
+ function tierOf(column) {
1041
+ switch (column.hiddenBelow) {
1042
+ case 'sm': return 1;
1043
+ case 'md': return 2;
1044
+ case 'lg': return 3;
1045
+ default: return 0;
1046
+ }
1047
+ }
1048
+ /**
1049
+ * Whether a column declares a narrow pixel width, the one signal that its content is a small
1050
+ * block rather than text.
1051
+ * @param column The column.
1052
+ * @returns True for a width like `60px`, up to {@link LEADING_MAX_WIDTH_PX}.
1053
+ */
1054
+ function isNarrow(column) {
1055
+ const match = /^(\d+(?:\.\d+)?)px$/.exec(column.width?.trim() ?? '');
1056
+ return !!match && Number(match[1]) <= LEADING_MAX_WIDTH_PX;
1057
+ }
1058
+ /**
1059
+ * Whether a column holds a figure: sorted as a number, or aligned right like one.
1060
+ * @param column The column.
1061
+ * @returns True for a figure column.
1062
+ */
1063
+ function isFigure(column) {
1064
+ return column.sortType === ColumnSortType.NUMERICAL || column.align === 'right';
1065
+ }
1066
+ /**
1067
+ * Derives the phone layout of a row from the column config the app already has, so a table
1068
+ * needs nothing new to read well on a phone. In order:
1069
+ *
1070
+ * 1. **Leading** — the first column a phone shows today, if it declares a width of 64px or less.
1071
+ * 2. **Title** — the next column a phone shows today (falling back to the first value column).
1072
+ * 3. **Trailing** — the first figure (sorted `NUMERICAL` or aligned right), otherwise the first
1073
+ * `DATE` column, among the columns shown today or hidden below `sm`.
1074
+ * 4. **Meta** — up to {@link ROW_META_LIMIT} more: shown today, then hidden below `sm`, then
1075
+ * below `md`, each tier in column order.
1076
+ * 5. **Sheet** — everything else, in column order.
1077
+ *
1078
+ * A column's `mobile` overrides all of this for that column: it is placed in the named slot
1079
+ * (`'hidden'` drops it) and taken out of the derivation. Explicit `'meta'` columns come first on
1080
+ * the second line and do not count against the limit.
1081
+ * @param columns The table's columns, in declaration order.
1082
+ * @returns The layout.
1083
+ */
1084
+ function resolveRowLayout(columns) {
1085
+ const actions = columns.filter(c => !!c.actions);
1086
+ const values = columns.filter(c => !c.actions);
1087
+ const explicit = (slot) => values.filter(c => c.mobile === slot);
1088
+ const auto = values.filter(c => !c.mobile);
1089
+ const used = new Set();
1090
+ const take = (column) => {
1091
+ if (column)
1092
+ used.add(column);
1093
+ return column;
1094
+ };
1095
+ const shownToday = auto.filter(c => tierOf(c) === 0);
1096
+ const leading = take(explicit('leading')[0] ?? (shownToday[0] && isNarrow(shownToday[0]) ? shownToday[0] : undefined));
1097
+ const title = take(explicit('title')[0]
1098
+ ?? shownToday.find(c => !used.has(c))
1099
+ ?? auto.find(c => !used.has(c)));
1100
+ const nearPhone = auto.filter(c => !used.has(c) && tierOf(c) <= 1);
1101
+ const trailing = take(explicit('trailing')[0]
1102
+ ?? nearPhone.find(isFigure)
1103
+ ?? nearPhone.find(c => c.sortType === ColumnSortType.DATE));
1104
+ const explicitMeta = explicit('meta');
1105
+ explicitMeta.forEach(c => used.add(c));
1106
+ const derivedMeta = [];
1107
+ for (const tier of [0, 1, 2]) {
1108
+ for (const column of auto) {
1109
+ if (derivedMeta.length >= ROW_META_LIMIT)
1110
+ break;
1111
+ if (used.has(column) || tierOf(column) !== tier)
1112
+ continue;
1113
+ derivedMeta.push(take(column));
1114
+ }
1115
+ }
1116
+ // A second explicit 'title' (or leading/trailing) has no slot left; the sheet keeps it.
1117
+ const sheet = values.filter(c => !used.has(c) && c.mobile !== 'hidden');
1118
+ return { leading, title, trailing, meta: [...explicitMeta, ...derivedMeta], sheet, actions };
1119
+ }
1120
+
1029
1121
  /**
1030
1122
  * Attribute directive that applies responsive-hiding classes to table cells/headers.
1031
1123
  * Hides the element by default and shows it as `table-cell` at the specified breakpoint.
@@ -1181,7 +1273,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
1181
1273
  }] } });
1182
1274
 
1183
1275
  /** Lucide icons this file renders. */
1184
- const ICONS = lucideIcons({ Funnel: lucide.Funnel, X: lucide.X });
1276
+ const ICONS = lucideIcons({
1277
+ ArrowDown: lucide.ArrowDown,
1278
+ ArrowUp: lucide.ArrowUp,
1279
+ ChevronRight: lucide.ChevronRight,
1280
+ Ellipsis: lucide.Ellipsis,
1281
+ Funnel: lucide.Funnel,
1282
+ X: lucide.X,
1283
+ });
1284
+ /** A cell value made only of figures, which needs its column name to mean anything on its own. */
1285
+ const BARE_FIGURE = /^[\d\s.,:%+\-−]+$/;
1185
1286
  class MnTable extends MnSelectableCollectionBase {
1186
1287
  /** Lucide icons the template renders. */
1187
1288
  icons = ICONS;
@@ -1202,6 +1303,273 @@ class MnTable extends MnSelectableCollectionBase {
1202
1303
  filtersPanelOpen = false;
1203
1304
  /** Small-screen filter sheet, held so the close button can play its exit. */
1204
1305
  filtersSheet;
1306
+ // ── Row mode (below 640px) ──
1307
+ /**
1308
+ * Whether this table renders inside an mn modal. There it never opens its own detail sheet:
1309
+ * on a phone the modal already is a sheet, and a second one stacks two drawers on one screen.
1310
+ * Actions stay reachable through a ⋯ menu on the row instead.
1311
+ */
1312
+ inModal = inject(MN_IN_MODAL);
1313
+ /** For scheduling focus once the detail sheet has rendered. */
1314
+ injector = inject(Injector);
1315
+ /**
1316
+ * The injector the filter sheet renders its fields with. The field template is declared
1317
+ * outside the sheet, so on its own it injects from there and its selects would open a second
1318
+ * sheet on top; this one says they are already in a sheet.
1319
+ */
1320
+ inSheetInjector = Injector.create({
1321
+ providers: [{ provide: MN_IN_BOTTOM_SHEET, useValue: true }],
1322
+ parent: this.injector,
1323
+ });
1324
+ /** The row whose detail sheet is open, or null when none is. */
1325
+ detailRow = null;
1326
+ /** The control that opened the detail sheet, which gets focus back when it closes. */
1327
+ detailTrigger = null;
1328
+ /** Detail sheet, held so an action can play its exit before running. */
1329
+ detailSheet;
1330
+ /** The sheet's heading, focused on open so the sheet is announced and Escape reaches it. */
1331
+ detailHeading;
1332
+ /** The last derived row layout and the column config it was derived from. */
1333
+ layoutCache;
1334
+ /** Counts tables on the page, so each sort radio group gets a name of its own. */
1335
+ static instanceCount = 0;
1336
+ /** The `name` that ties this table's sort radios into one group. */
1337
+ sortGroupName = `mn-table-sort-${MnTable.instanceCount++}`;
1338
+ /**
1339
+ * Whether rows render as composed lines instead of a grid. The same 640px container width
1340
+ * at which the filter row already collapses: below it neither the filter inputs nor the
1341
+ * columns have room, so both give way at once.
1342
+ */
1343
+ get rowMode() {
1344
+ return this.filtersCollapsed;
1345
+ }
1346
+ /**
1347
+ * Which column goes where on a composed row, derived from the column config (see
1348
+ * {@link resolveRowLayout}). Recomputed only when the columns, or a setting the rule reads,
1349
+ * change — a consumer adding a permission-gated column later is picked up.
1350
+ */
1351
+ get rowLayout() {
1352
+ const columns = this.dataSource.columns;
1353
+ const signature = columns
1354
+ .map(c => [c.key, c.hiddenBelow, c.mobile, c.width, c.sortType, c.align, c.actions ? 'a' : ''].join('|'))
1355
+ .join(';');
1356
+ const cached = this.layoutCache;
1357
+ if (cached && cached.signature === signature && cached.columns.length === columns.length
1358
+ && columns.every((c, i) => c === cached.columns[i])) {
1359
+ return cached.layout;
1360
+ }
1361
+ const layout = resolveRowLayout(columns);
1362
+ this.layoutCache = { columns: [...columns], signature, layout };
1363
+ return layout;
1364
+ }
1365
+ /**
1366
+ * Every value column the detail sheet lists under its heading: all of them except the two
1367
+ * the heading itself shows (title and trailing), so the sheet is the whole record.
1368
+ */
1369
+ get detailColumns() {
1370
+ const { title, trailing } = this.rowLayout;
1371
+ return this.dataSource.columns.filter(c => !c.actions && c !== title && c !== trailing && c.mobile !== 'hidden');
1372
+ }
1373
+ /** Whether any of the row's action columns has a visible action for it. */
1374
+ rowHasAnyActions(row) {
1375
+ return this.rowLayout.actions.some(column => this.hasRowActions(column, row));
1376
+ }
1377
+ /**
1378
+ * Whether a row has anything its composed line does not show: a column only the sheet
1379
+ * lists, or an action. Never inside a modal, where the table opens no sheet.
1380
+ */
1381
+ rowHasDetail(row) {
1382
+ if (this.inModal)
1383
+ return false;
1384
+ return this.rowLayout.sheet.length > 0 || this.rowHasAnyActions(row);
1385
+ }
1386
+ /**
1387
+ * What a tap on a composed row does, in order of precedence: select it (a selection table),
1388
+ * run the consumer's row handler as on a wide table, open the detail sheet, or nothing.
1389
+ */
1390
+ rowTap(row) {
1391
+ if (this.hasSelection)
1392
+ return 'select';
1393
+ if (this.dataSource.onRowClick || this.rowClick.observed)
1394
+ return 'click';
1395
+ if (this.rowHasDetail(row))
1396
+ return 'detail';
1397
+ return 'none';
1398
+ }
1399
+ /** Whether a row needs its own ⋯ button for the sheet, because a tap already does something else. */
1400
+ showsRowMore(row) {
1401
+ const tap = this.rowTap(row);
1402
+ return (tap === 'select' || tap === 'click') && this.rowHasDetail(row);
1403
+ }
1404
+ /** Whether a row shows its actions as a ⋯ menu: inside a modal, where there is no sheet. */
1405
+ showsRowMenu(row) {
1406
+ return this.inModal && this.rowHasAnyActions(row);
1407
+ }
1408
+ /** Handles a tap on a composed row's main area. */
1409
+ onRowTap(row, event) {
1410
+ if (this.rowTap(row) === 'detail') {
1411
+ this.openDetail(row, event.currentTarget);
1412
+ }
1413
+ else {
1414
+ this.onRowClick(row);
1415
+ }
1416
+ }
1417
+ /**
1418
+ * Opens the detail sheet for a row and moves focus to its heading.
1419
+ * @param row The row.
1420
+ * @param trigger The control that opened it, which gets focus back on close.
1421
+ */
1422
+ openDetail(row, trigger = null) {
1423
+ this.detailRow = row;
1424
+ this.detailTrigger = trigger;
1425
+ this.cdr.markForCheck();
1426
+ afterNextRender(() => this.detailHeading?.nativeElement.focus(), { injector: this.injector });
1427
+ }
1428
+ /** Plays the detail sheet's exit, then unmounts it. */
1429
+ async closeDetail() {
1430
+ await this.detailSheet?.startClosing();
1431
+ this.onDetailDismissed();
1432
+ }
1433
+ /** Clears the detail sheet once it is gone and returns focus to the control that opened it. */
1434
+ onDetailDismissed() {
1435
+ if (this.detailRow === null)
1436
+ return;
1437
+ this.detailRow = null;
1438
+ const trigger = this.detailTrigger;
1439
+ this.detailTrigger = null;
1440
+ this.cdr.markForCheck();
1441
+ trigger?.focus();
1442
+ }
1443
+ /**
1444
+ * Runs an action from the detail sheet. The sheet closes first, so an action that opens a
1445
+ * modal or navigates does not do so underneath it.
1446
+ */
1447
+ async runDetailAction(action, row) {
1448
+ if (this.isRowActionDisabled(action, row))
1449
+ return;
1450
+ await this.closeDetail();
1451
+ action.run(row);
1452
+ }
1453
+ /**
1454
+ * The text a composed row shows for a string column: its `cellSm` when it has one (the short
1455
+ * form the app already wrote for narrow screens), else the cell itself.
1456
+ */
1457
+ rowCellText(column, row) {
1458
+ if (column.cellSm && typeof column.cellSm.cell === 'function')
1459
+ return column.cellSm.cell(row);
1460
+ return this.getCellValue(column, row);
1461
+ }
1462
+ /** The template a composed row renders for a column, preferring `cellSm`; null for a string column. */
1463
+ rowCellTemplate(column) {
1464
+ if (column.cellSm)
1465
+ return this.isTemplateRef(column.cellSm.cell) ? column.cellSm.cell : null;
1466
+ return this.isTemplateRef(column.cell) ? column.cell : null;
1467
+ }
1468
+ /**
1469
+ * A second-line value. A bare figure gets its column name in front ("Banen 3"): with no
1470
+ * header above it, "3" alone says nothing.
1471
+ */
1472
+ rowMetaText(column, row) {
1473
+ const value = this.rowCellText(column, row);
1474
+ if (!value.trim() || !BARE_FIGURE.test(value))
1475
+ return value;
1476
+ const header = this.headerText(column);
1477
+ return header ? `${header} ${value}` : value;
1478
+ }
1479
+ /** A row's name as text, for accessible names: its title cell, else the selection label. */
1480
+ rowLabel(row) {
1481
+ const title = this.rowLayout.title;
1482
+ const text = title ? this.getCellValue(title, row) : '';
1483
+ return text || this.defaultSelectionLabel(row) || '';
1484
+ }
1485
+ /** Accessible name of a row's ⋯ button. */
1486
+ rowDetailsLabel(row) {
1487
+ return this.resolveLabel(undefined, 'mnCollection.rowDetails', 'Details for {{label}}')
1488
+ .replace('{{label}}', this.rowLabel(row));
1489
+ }
1490
+ /** Columns a person can sort by, offered in the filter sheet once the header row is gone. */
1491
+ get sortableColumns() {
1492
+ return this.dataSource.columns.filter(c => this.isSortable(c));
1493
+ }
1494
+ /**
1495
+ * Whether the toolbar shows the filter button: below 640px, when there is a filter to set or
1496
+ * a sort to choose — the header row that held both is gone there.
1497
+ */
1498
+ get showsFilterButton() {
1499
+ return this.filtersCollapsed && (this.hasColumnFilters || this.sortableColumns.length > 0);
1500
+ }
1501
+ /** How many column filters are set, shown as a count on the filter button. */
1502
+ get activeFilterCount() {
1503
+ return this.activeColumnFilters.length;
1504
+ }
1505
+ /**
1506
+ * Title of the small-screen sheet and its button: "Filters" when there is something to filter,
1507
+ * "Sort by" when the sheet only holds the sort choice — a funnel over a sheet with no filter in
1508
+ * it promises something the sheet does not have.
1509
+ */
1510
+ get filterSheetLabel() {
1511
+ return this.hasColumnFilters ? this.filtersButtonLabel : this.sortByLabel;
1512
+ }
1513
+ /** Accessible name of the icon-only filter button, with the active count when there is one. */
1514
+ get filtersButtonAriaLabel() {
1515
+ const count = this.activeFilterCount;
1516
+ return count > 0 ? `${this.filterSheetLabel} (${count})` : this.filterSheetLabel;
1517
+ }
1518
+ /** Label of the sort select in the filter sheet. */
1519
+ get sortByLabel() {
1520
+ return this.resolveLabel(undefined, 'mnCollection.sortBy', 'Sort by');
1521
+ }
1522
+ /** The sort select's "no sort" option. */
1523
+ get sortDefaultLabel() {
1524
+ return this.resolveLabel(undefined, 'mnCollection.sortDefault', 'Default order');
1525
+ }
1526
+ /** The current sort direction in words, shown on the chosen column's direction button. */
1527
+ get sortDirectionLabel() {
1528
+ return this.currentSort?.direction === 'desc'
1529
+ ? this.resolveLabel(undefined, 'mnCollection.sortDescending', 'Descending')
1530
+ : this.resolveLabel(undefined, 'mnCollection.sortAscending', 'Ascending');
1531
+ }
1532
+ /** Accessible name of the direction button: what it shows and that a press flips it. */
1533
+ get sortDirectionButtonLabel() {
1534
+ return this.resolveLabel(undefined, 'mnCollection.sortDirection', '{{direction}}, tap to reverse')
1535
+ .replace('{{direction}}', this.sortDirectionLabel);
1536
+ }
1537
+ /** Flips the current sort between ascending and descending. */
1538
+ toggleSortDirection() {
1539
+ if (!this.currentSort)
1540
+ return;
1541
+ this.onSortDirection(this.currentSort.direction === 'desc' ? 'asc' : 'desc');
1542
+ }
1543
+ /**
1544
+ * Sorts by a column chosen in the filter sheet, exactly as a header click would. A newly
1545
+ * chosen column starts ascending; re-choosing the current one keeps its direction.
1546
+ * @param columnKey The column, or empty for the default order.
1547
+ */
1548
+ onSortColumn(columnKey) {
1549
+ if (!columnKey) {
1550
+ this.applySort(null);
1551
+ }
1552
+ else {
1553
+ const direction = this.currentSort?.columnKey === columnKey ? this.currentSort.direction : 'asc';
1554
+ this.applySort({ columnKey, direction });
1555
+ }
1556
+ }
1557
+ /**
1558
+ * Flips the direction of the current sort from the sheet's switch.
1559
+ * @param direction The value the switch emitted.
1560
+ */
1561
+ onSortDirection(direction) {
1562
+ if (!this.currentSort)
1563
+ return;
1564
+ this.applySort({ columnKey: this.currentSort.columnKey, direction: direction === 'desc' ? 'desc' : 'asc' });
1565
+ }
1566
+ /** Sets the sort, tells the consumer and re-sorts, as a header click does. */
1567
+ applySort(sort) {
1568
+ this.currentSort = sort;
1569
+ this.sortChange.emit(this.currentSort);
1570
+ this.applyFilter(false);
1571
+ this.cdr.markForCheck();
1572
+ }
1205
1573
  componentName = 'MnTable';
1206
1574
  get trackedToolbarTemplate() {
1207
1575
  return this.dataSource?.toolbarLeftTemplate;
@@ -1384,8 +1752,14 @@ class MnTable extends MnSelectableCollectionBase {
1384
1752
  if (collapsed === this.filtersCollapsed)
1385
1753
  return;
1386
1754
  this.filtersCollapsed = collapsed;
1387
- if (!collapsed)
1755
+ if (!collapsed) {
1388
1756
  this.filtersPanelOpen = false;
1757
+ // The wide table shows every column, so the detail sheet has nothing left to add.
1758
+ this.detailRow = null;
1759
+ this.detailTrigger = null;
1760
+ }
1761
+ // Composed rows and grid rows differ in height; the floor measured for one does not fit the other.
1762
+ this.invalidatePageHeight();
1389
1763
  if (reflow)
1390
1764
  this.cdr.markForCheck();
1391
1765
  }
@@ -1490,7 +1864,7 @@ class MnTable extends MnSelectableCollectionBase {
1490
1864
  // the guards below make it a no-op until real rows are on screen, and the
1491
1865
  // pinned widths then stop it from measuring again.
1492
1866
  afterEveryRender(() => {
1493
- if (this.layoutMode !== 'stable')
1867
+ if (this.layoutMode !== 'stable' || this.rowMode)
1494
1868
  return;
1495
1869
  if (this.widthsPinned || this.isLoadingState)
1496
1870
  return;
@@ -1754,7 +2128,7 @@ class MnTable extends MnSelectableCollectionBase {
1754
2128
  return '';
1755
2129
  }
1756
2130
  // ── Row actions ──
1757
- /** The actions visible for a given row — those whose `hidden(row)` is not true. */
2131
+ /** The actions visible for a given row — those whose `hidden(row)` is not true. Shared by the wide table's buttons, the detail sheet and a modal's ⋯ menu. */
1758
2132
  visibleRowActions(column, row) {
1759
2133
  return (column.actions ?? []).filter(action => !(action.hidden?.(row) ?? false));
1760
2134
  }
@@ -1772,19 +2146,6 @@ class MnTable extends MnSelectableCollectionBase {
1772
2146
  hasRowActions(column, row) {
1773
2147
  return this.visibleRowActions(column, row).length > 0;
1774
2148
  }
1775
- /**
1776
- * Whether a row's actions fold into the ⋯ menu below 450px. They do unless the row has
1777
- * exactly one visible action that renders as a bare icon: that button is narrower than the
1778
- * ⋯ trigger it would hide behind, so collapsing it only puts a second tap in front of the
1779
- * one command the row has.
1780
- */
1781
- collapsesRowActions(column, row) {
1782
- const visible = this.visibleRowActions(column, row);
1783
- if (visible.length !== 1)
1784
- return true;
1785
- const [only] = visible;
1786
- return this.showActionLabel(column, only, row);
1787
- }
1788
2149
  /**
1789
2150
  * Resolves a {@link MnRowValue}: either the fixed value, or the accessor applied to
1790
2151
  * the row. Every per-row presentation field goes through here so the fixed and derived
@@ -2034,11 +2395,11 @@ class MnTable extends MnSelectableCollectionBase {
2034
2395
  return template.replace('{{label}}', this.selectionLabelFor(row));
2035
2396
  }
2036
2397
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnTable, deps: [], target: i0.ɵɵFactoryTarget.Component });
2037
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: MnTable, isStandalone: true, selector: "mn-table", outputs: { sortChange: "sortChange", rowClick: "rowClick" }, host: { listeners: { "window:resize": "onWindowResize()" }, classAttribute: "block" }, viewQueries: [{ propertyName: "filtersSheet", first: true, predicate: ["filtersSheet"], descendants: true }, { propertyName: "collectionBody", first: true, predicate: ["collectionBody"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<!-- Everything that reflows lives inside a @container, so the breakpoints below\n measure the table's own width rather than the window's. A table in a modal,\n a sidebar or a narrow grid cell is far narrower than the viewport, and\n viewport breakpoints would hand it a desktop layout it has no room for. -->\n<div class=\"@container\">\n <!-- Selection summary: the whole selection, never paged, filtered or sorted. The\n table below answers \"what could I pick?\", which is why it is searched and paged;\n this answers \"what did I pick?\", which a paginated list cannot without hiding\n most of the answer on some other page. -->\n @if (showSelectionSummary) {\n <div class=\"flex flex-col gap-2 rounded-md border border-base-300 bg-base-200/50 p-3 mb-3\">\n <div class=\"flex items-center justify-between gap-2\">\n <span class=\"text-sm font-medium text-base-content\">{{ selectionSummaryTitle }}</span>\n <button\n (click)=\"clearSelection()\"\n [data]=\"{ variant: 'text', color: 'gray', size: 'sm', borderRadius: 'md', hover: true }\"\n class=\"gap-1 shrink-0\"\n mnButton\n type=\"button\"\n >\n <svg [size]=\"14\" [lucideIcon]=\"icons.X\"></svg>\n <span>{{ selectionClearAllLabel }}</span>\n </button>\n </div>\n <!-- Only the first few tags render; the rest collapse behind a \"+N more\" control.\n The heading's count always states the true total, so this hides tags, never\n information. Expanded, the list is height-capped and scrolls, so even a\n selection of hundreds cannot push the table off screen. -->\n <ul\n [class.max-h-28]=\"selectionSummaryExpanded\"\n [class.overflow-y-auto]=\"selectionSummaryExpanded\"\n class=\"flex flex-wrap gap-1.5 list-none m-0 p-0\"\n >\n @for (row of visibleSelectionRows; track dataSource.getID(row)) {\n <li\n class=\"inline-flex items-center gap-1 rounded-full bg-base-100 border border-base-300 pl-2.5 pr-1 py-0.5 text-xs text-base-content max-w-full\">\n <span [attr.title]=\"selectionLabelFor(row)\" class=\"truncate\">{{ selectionLabelFor(row) }}</span>\n <button\n (click)=\"removeSelection(row)\"\n [attr.aria-label]=\"selectionRemoveLabel(row)\"\n class=\"shrink-0 rounded-full p-0.5 hover:bg-base-300 transition-colors cursor-pointer\"\n type=\"button\"\n >\n <svg [size]=\"12\" [lucideIcon]=\"icons.X\"></svg>\n </button>\n </li>\n }\n @if (hiddenSelectionCount > 0 || selectionSummaryExpanded) {\n <li>\n <button\n (click)=\"toggleSelectionSummary()\"\n [attr.aria-expanded]=\"selectionSummaryExpanded\"\n [data]=\"{ variant: 'text', color: 'primary', size: 'sm', borderRadius: 'md', hover: true }\"\n class=\"text-xs\"\n mnButton\n type=\"button\"\n >\n {{ selectionSummaryToggleLabel }}\n </button>\n </li>\n }\n </ul>\n </div>\n }\n\n <!-- Toolbar: custom toolbar template + search. Only rendered when it has content,\n so an unsearchable table without toolbar templates emits no empty spacer. -->\n@if (isSearchable || dataSource.toolbarLeftTemplate || dataSource.toolbarRightTemplate || (hasColumnFilters && filtersCollapsed)) {\n <div class=\"flex flex-col @min-[420px]:flex-row @min-[420px]:items-center justify-between gap-2 mb-3\">\n <!-- The left slot only when it has content: an empty one still took a flex gap, which\n pushed the search 8px in from the page edge. ml-auto keeps the search on the right. -->\n @if (dataSource.toolbarLeftTemplate) {\n <div class=\"flex items-center gap-2 w-full @min-[420px]:w-auto\">\n <div class=\"flex flex-col w-full @min-[420px]:w-auto @min-[420px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"dataSource.toolbarLeftTemplate\"></ng-container>\n </div>\n </div>\n }\n <div\n class=\"flex flex-col @min-[420px]:flex-row @min-[420px]:items-center gap-2 w-full @min-[420px]:flex-1 @min-[420px]:ml-auto @min-[560px]:flex-none @min-[560px]:w-auto\">\n @if (isSearchable) {\n <!-- Enter must not submit a surrounding form: the search box belongs to the\n table's chrome, not to whatever form the table happens to sit in. -->\n <mn-lib-input-field\n (keydown.enter)=\"$event.preventDefault()\"\n class=\"w-full @min-[420px]:flex-1 @min-[560px]:flex-none @min-[560px]:min-w-64\"\n [props]=\"{\n id: 'mn-table-search',\n type: 'search',\n label: '',\n ariaLabel: searchPlaceholderLabel,\n placeholder: searchPlaceholderLabel,\n size: 'sm',\n borderRadius: 'md',\n fullWidth: true\n }\"\n [ngModel]=\"searchValue\"\n (ngModelChange)=\"onSearch($event)\"\n ></mn-lib-input-field>\n }\n @if (dataSource.toolbarRightTemplate) {\n <div class=\"flex flex-col w-full @min-[420px]:w-auto @min-[420px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"dataSource.toolbarRightTemplate\"></ng-container>\n </div>\n }\n <!-- Small-screen filter toggle: replaces the inline per-column filter row below 640px -->\n @if (hasColumnFilters && filtersCollapsed) {\n <button\n type=\"button\"\n mnButton\n [data]=\"{ variant: 'outline', color: 'primary', size: 'md', borderRadius: 'md', hover: true }\"\n class=\"w-full @min-[420px]:w-auto gap-1.5\"\n [attr.aria-expanded]=\"filtersPanelOpen\"\n aria-controls=\"mn-table-filters-panel\"\n (click)=\"openFiltersPanel()\"\n >\n <svg [lucideIcon]=\"icons.Funnel\" [size]=\"15\"></svg>\n <span>{{ filtersButtonLabel }}</span>\n </button>\n }\n </div>\n</div>\n}\n\n<!-- Small-screen filters: full-width fields decoupled from column widths, presented\n as a bottom sheet so they overlay rather than push the table down. -->\n@if (hasColumnFilters && filtersCollapsed && filtersPanelOpen) {\n <mn-bottom-sheet\n #filtersSheet\n (dismiss)=\"filtersPanelOpen = false\"\n [ariaLabel]=\"filtersButtonLabel\"\n [growWithKeyboard]=\"true\"\n [maxHeightVh]=\"80\"\n >\n <div id=\"mn-table-filters-panel\" class=\"flex flex-col gap-3 px-4 pb-4\">\n <span class=\"text-base font-semibold text-base-content\">{{ filtersButtonLabel }}</span>\n @for (column of dataSource.columns; track column.key) {\n @if (column.filterable) {\n <div class=\"flex flex-col gap-1\">\n <label\n class=\"text-xs font-medium text-base-content/70\"\n [attr.for]=\"'mn-table-filter-panel-' + column.key\"\n >\n @if (isTemplateRef(column.header)) {\n <ng-container [ngTemplateOutlet]=\"$any(column.header)\"></ng-container>\n } @else {\n {{ headerText(column) }}\n }\n </label>\n <ng-container\n [ngTemplateOutletContext]=\"{ $implicit: column, idScope: 'panel' }\"\n [ngTemplateOutlet]=\"filterField\"\n ></ng-container>\n </div>\n }\n }\n @if (hasActiveFilters) {\n <button\n type=\"button\"\n mnButton\n [data]=\"{ variant: 'text', color: 'gray', size: 'sm', borderRadius: 'md', hover: true }\"\n class=\"self-start gap-1\"\n (click)=\"clearAllFilters()\"\n >\n <svg [lucideIcon]=\"icons.X\" [size]=\"14\"></svg>\n <span>{{ clearFiltersButtonLabel }}</span>\n </button>\n }\n <div class=\"mt-1 flex min-[400px]:justify-end\">\n <button\n type=\"button\"\n mnButton\n [data]=\"{ variant: 'fill', color: 'primary', size: 'md', borderRadius: 'md', hover: true }\"\n class=\"w-full min-[400px]:w-auto\"\n (click)=\"closeFiltersPanel()\"\n >\n <span>{{ filtersCloseLabel }}</span>\n </button>\n </div>\n </div>\n </mn-bottom-sheet>\n}\n\n<!-- Announces loading. The skeletons are aria-hidden, so without this a screen reader hears\n nothing while rows load. The region stays in the DOM and only its text changes, which is\n what makes assistive tech read it; one inserted with its text already set is often missed. -->\n<span class=\"sr-only\" role=\"status\">{{ isLoadingState ? loadingLabel : '' }}</span>\n\n<!-- Table wrapper with horizontal scroll -->\n <div #collectionBody [attr.aria-busy]=\"isLoadingState || null\" [attr.aria-label]=\"tableRegionLabel\" [style.min-height.px]=\"bodyMinHeight\"\n class=\"overflow-x-auto\"\n role=\"region\">\n <table [class]=\"tableClasses\">\n <thead>\n <tr class=\"bg-base-100\">\n <!-- Selection column header. It always carries a screen-reader-only name: a single-select\n table has nothing else in this cell, and a multi-select one only a checkbox, so\n without it the column is announced as a nameless header (axe empty-table-header). -->\n @if (hasSelection) {\n <th class=\"w-10 text-center text-sm px-2 py-2\">\n <span class=\"sr-only\">{{ selectionColumnLabel }}</span>\n @if (isMultiSelect) {\n <mn-lib-checkbox\n (checkedChange)=\"toggleAll()\"\n [checked]=\"allSelected\"\n [props]=\"{ id: 'mn-table-select-all', size: 'sm' }\"\n ></mn-lib-checkbox>\n }\n </th>\n }\n\n <!-- Data columns -->\n @for (column of dataSource.columns; track column.key) {\n <th\n [attr.data-column-key]=\"column.key\"\n [class.truncate]=\"widthsArePinned\"\n [class.cursor-pointer]=\"isSortable(column)\"\n [class.select-none]=\"isSortable(column)\"\n [class.hover:bg-base-200]=\"isSortable(column)\"\n [class.text-left]=\"(column.align ?? 'left') === 'left'\"\n [class.text-center]=\"column.align === 'center'\"\n [class.text-right]=\"column.align === 'right'\"\n [mnHiddenBelow]=\"column.hiddenBelow\"\n [style.width]=\"columnWidth(column)\"\n [attr.aria-sort]=\"currentSort?.columnKey === column.key ? (currentSort!.direction === 'asc' ? 'ascending' : 'descending') : null\"\n class=\"text-sm px-2 py-1 @min-[640px]:px-4 @min-[640px]:py-2 whitespace-nowrap\"\n (click)=\"sort(column)\"\n >\n <!-- The header content is declared once; a sortable column wraps it in a real button so\n the sort is reachable by keyboard. The button's click stops there, so the th's own\n click (which keeps the cell padding clickable) does not sort a second time. -->\n <ng-template #headerContent>\n @if (isTemplateRef(column.header)) {\n <ng-container [ngTemplateOutlet]=\"$any(column.header)\"></ng-container>\n } @else {\n <span>{{ headerText(column) }}</span>\n }\n @if (isSortable(column)) {\n <span class=\"text-[0.65rem] opacity-70 min-w-3 inline-block\" aria-hidden=\"true\">{{ getSortIcon(column) }}</span>\n }\n </ng-template>\n @if (isSortable(column)) {\n <button type=\"button\" class=\"inline-flex items-center gap-1 cursor-pointer\" (click)=\"$event.stopPropagation(); sort(column)\">\n <ng-container [ngTemplateOutlet]=\"headerContent\"></ng-container>\n </button>\n } @else {\n <span class=\"inline-flex items-center gap-1\">\n <ng-container [ngTemplateOutlet]=\"headerContent\"></ng-container>\n </span>\n }\n </th>\n }\n\n </tr>\n\n <!-- Per-column filter row (wide screens only; collapses into a panel below 640px).\n The cells are `td`, not `th`: they hold form controls, not headings, and a\n column without a filter would otherwise be an empty header, which assistive tech\n announces as a nameless column (axe `empty-table-header`). `font-normal` stays\n so a consumer's thead styling cannot make the controls bold. -->\n @if (hasColumnFilters && !filtersCollapsed) {\n <tr class=\"bg-base-100 border-b border-base-300 font-normal\">\n @if (hasSelection) {\n <td class=\"px-2 py-1 font-normal\"></td>\n }\n @for (column of dataSource.columns; track column.key) {\n <td\n class=\"px-4 py-2 font-normal\"\n [mnHiddenBelow]=\"column.hiddenBelow\"\n >\n @if (column.filterable) {\n <!-- Every filter renders as an ordinary control right under its\n header. The rich types used to hide behind a button that opened\n a floating panel, which cost a click to discover, a click to\n apply, and hid whether a column was even filterable. -->\n <ng-container\n [ngTemplateOutletContext]=\"{ $implicit: column, idScope: 'inline' }\"\n [ngTemplateOutlet]=\"filterField\"\n ></ng-container>\n }\n </td>\n }\n </tr>\n }\n </thead>\n\n <tbody>\n <!-- Loading state -->\n @if (isLoadingState) {\n @for (_ of skeletonRows; track $index) {\n <tr>\n @if (hasSelection) {\n <td class=\"px-2 py-3\">\n <mn-skeleton [data]=\"{ shape: 'rectangle', width: '1rem', height: '1rem' }\"></mn-skeleton>\n </td>\n }\n @for (column of dataSource.columns; track column.key) {\n <td class=\"px-4 py-3\"\n [mnHiddenBelow]=\"column.hiddenBelow\"\n [style.width]=\"columnWidth(column)\"\n >\n @if (isTemplateRef(column.skeleton)) {\n <ng-container [ngTemplateOutlet]=\"$any(column.skeleton)\"></ng-container>\n } @else {\n <mn-skeleton [data]=\"getColumnSkeletonData(column)\"></mn-skeleton>\n }\n </td>\n }\n </tr>\n }\n } @else if (isErrorState) {\n <!-- Error state -->\n <tr class=\"bg-base-100\">\n <td [attr.colspan]=\"totalColumnCount\" class=\"text-center text-xs py-8\">\n @if (dataSource.errorTemplate) {\n <ng-container [ngTemplateOutlet]=\"dataSource.errorTemplate\"></ng-container>\n } @else {\n <div class=\"flex flex-col items-center gap-2 text-error\">\n <p class=\"text-sm\">{{ dataSource.errorMessage }}</p>\n </div>\n }\n </td>\n </tr>\n } @else {\n <!-- Empty state -->\n @if (filteredItems.length === 0) {\n <tr class=\"bg-base-100\">\n <td [attr.colspan]=\"totalColumnCount\" class=\"text-center text-xs py-8\">\n @if (dataSource.emptyTemplate) {\n <ng-container [ngTemplateOutlet]=\"dataSource.emptyTemplate\"></ng-container>\n } @else {\n <!-- The same look as a section's empty state, so a page with both reads as one:\n a faint icon over a medium line in the consumer's muted text colour. -->\n <div class=\"flex flex-col items-center gap-3 py-16 text-(--color-base-content-muted,color-mix(in_oklab,var(--color-base-content)_65%,transparent))\">\n @if (dataSource.emptyIcon !== null) {\n <svg [lucideIcon]=\"dataSource.emptyIcon ?? defaultEmptyIcon\" [size]=\"26\" class=\"opacity-30\"></svg>\n }\n <p class=\"text-base font-medium\">{{ dataSource.emptyMessage }}</p>\n </div>\n }\n </td>\n </tr>\n }\n\n <!-- Data rows -->\n @for (row of paginatedItems; track trackByID($index, row); let odd = $odd; let last = $last) {\n <!-- The wash and the pointer promise that a click does something, so only a clickable row gets them. -->\n <tr\n class=\"bg-base-100 transition-colors duration-150 border-b border-base-300\"\n [ngClass]=\"{'bg-primary/10': isSelected(row)}\"\n [class.bg-base-200]=\"!isSelected(row) && odd && dataSource.appearance?.striped\"\n [class.hover:bg-base-200]=\"rowsClickable && dataSource.appearance?.hover !== false\"\n [class.cursor-pointer]=\"rowsClickable\"\n (click)=\"onRowClick(row)\"\n >\n <!-- Selection checkbox -->\n @if (hasSelection) {\n <td (click)=\"$event.stopPropagation()\" class=\"w-10 text-center px-2 py-2\">\n <mn-lib-checkbox\n (checkedChange)=\"toggle(row)\"\n [checked]=\"isSelected(row)\"\n [props]=\"{ id: 'mn-table-row-' + $index, size: 'sm' }\"\n ></mn-lib-checkbox>\n </td>\n }\n\n <!-- Data cells -->\n @for (column of dataSource.columns; track column.key) {\n <td\n [attr.title]=\"cellTitle(column, row)\"\n [class.text-left]=\"(column.align ?? 'left') === 'left'\"\n [class.text-center]=\"column.align === 'center'\"\n [class.text-right]=\"column.align === 'right'\"\n [class.truncate]=\"widthsArePinned\"\n [mnHiddenBelow]=\"column.hiddenBelow\"\n [style.width]=\"columnWidth(column)\"\n class=\"text-xs px-2 py-1 @min-[640px]:px-4 @min-[640px]:py-2\"\n >\n @if (column.actions) {\n <!-- Actions column: inline command buttons that collapse into a \u22EF menu\n once the table is narrower than 450px (container query), for every\n row with actions. A row with no visible actions renders nothing.\n A row with a single icon-only action never collapses: one icon button\n is narrower than the \u22EF trigger it would hide behind, so folding it\n only costs a tap. -->\n @if (hasRowActions(column, row)) {\n <div class=\"inline-flex items-center gap-1\"\n [class.justify-end]=\"(column.align ?? 'left') === 'right'\">\n @if (collapsesRowActions(column, row)) {\n <span class=\"hidden items-center gap-1 @min-[450px]:inline-flex\">\n <ng-container [ngTemplateOutletContext]=\"{ column: column, row: row }\"\n [ngTemplateOutlet]=\"actionButtons\"></ng-container>\n </span>\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events,@angular-eslint/template/interactive-supports-focus -->\n <span class=\"@min-[450px]:hidden\" (click)=\"$event.stopPropagation()\">\n <mn-lib-dropdown [datasource]=\"{\n id: actionsDropdownId(column, row),\n actions: rowDropdownActions(column, row),\n menuLabel: headerText(column),\n size: 'sm'\n }\"></mn-lib-dropdown>\n </span>\n } @else {\n <span class=\"inline-flex items-center gap-1\">\n <ng-container [ngTemplateOutletContext]=\"{ column: column, row: row }\"\n [ngTemplateOutlet]=\"actionButtons\"></ng-container>\n </span>\n }\n </div>\n }\n } @else if (column.cellSm) {\n <!-- Default cell: hidden below the cellSm breakpoint -->\n <span [mnShowAbove]=\"column.cellSm.below\">\n @if (isTemplateRef(column.cell)) {\n <ng-container [ngTemplateOutletContext]=\"{ $implicit: row, data: row }\"\n [ngTemplateOutlet]=\"$any(column.cell)\"></ng-container>\n } @else {\n {{ getCellValue(column, row) }}\n }\n </span>\n <!-- Small cell: shown only below the cellSm breakpoint -->\n <span [mnShowBelow]=\"column.cellSm.below\">\n @if (isTemplateRef(column.cellSm.cell)) {\n <ng-container [ngTemplateOutletContext]=\"{ $implicit: row, data: row }\"\n [ngTemplateOutlet]=\"$any(column.cellSm.cell)\"></ng-container>\n } @else {\n {{ getCellSmValue(column, row) }}\n }\n </span>\n } @else {\n @if (isTemplateRef(column.cell)) {\n <ng-container [ngTemplateOutletContext]=\"{ $implicit: row, data: row }\"\n [ngTemplateOutlet]=\"$any(column.cell)\"></ng-container>\n } @else {\n {{ getCellValue(column, row) }}\n }\n }\n </td>\n }\n\n </tr>\n }\n }\n </tbody>\n </table>\n</div>\n\n<!-- Load more + pagination -->\n<mn-collection-pagination\n (loadMore)=\"loadMoreRows()\"\n (pageChange)=\"goToPage($event)\"\n (pageSizeChange)=\"onPageSizeChange($event)\"\n [currentPage]=\"currentPage\"\n [isPaginated]=\"isPaginated\"\n [isServerPaginated]=\"isServerPaginated\"\n [labels]=\"dataSource.labels\"\n [loadingMoreRows]=\"loadingMoreRows\"\n [pageSizeSelectOptions]=\"pageSizeSelectOptions\"\n [pageSize]=\"pageSize\"\n [showLoadMore]=\"showLoadMore\"\n [totalItemCount]=\"totalItemCount\"\n [totalPages]=\"totalPages\"\n [visiblePages]=\"visiblePages\"\n idPrefix=\"mn-table\"\n></mn-collection-pagination>\n</div>\n\n<!-- Single source of truth for every filter control, reused by the inline header\n row and the small-screen panel. `idScope` keeps element ids unique across\n both placements. -->\n<ng-template #filterField let-column let-idScope=\"idScope\">\n @switch (filterTypeOf(column)) {\n @case ('select') {\n <mn-lib-select\n (ngModelChange)=\"onColumnFilter(column, $event)\"\n [disabled]=\"column.filterDisabled ?? false\"\n [ngModel]=\"textFilterValue(column)\"\n [props]=\"{\n id: 'mn-table-filter-' + idScope + '-' + column.key,\n ariaLabel: filterLabel(column),\n options: getFilterSelectOptions(column),\n placeholder: filterAllLabel(column),\n size: 'sm',\n fullWidth: true\n }\"\n ></mn-lib-select>\n }\n @case ('multi-select') {\n <mn-lib-multi-select\n (ngModelChange)=\"onColumnFilter(column, $event)\"\n [disabled]=\"column.filterDisabled ?? false\"\n [ngModel]=\"multiFilterValue(column)\"\n [props]=\"{\n id: 'mn-table-filter-' + idScope + '-' + column.key,\n ariaLabel: filterLabel(column),\n options: getFilterMultiSelectOptions(column),\n placeholder: column.filterPlaceholder ?? '',\n collapsePlaceholder: filterSelectedLabel,\n collapseThreshold: 1,\n size: 'sm',\n fullWidth: true\n }\"\n ></mn-lib-multi-select>\n }\n @case ('boolean') {\n <mn-lib-select\n (ngModelChange)=\"onBooleanFilter(column, $event)\"\n [disabled]=\"column.filterDisabled ?? false\"\n [ngModel]=\"booleanFilterValue(column)\"\n [props]=\"{\n id: 'mn-table-filter-' + idScope + '-' + column.key,\n ariaLabel: filterLabel(column),\n options: getBooleanFilterOptions(column),\n size: 'sm',\n fullWidth: true\n }\"\n ></mn-lib-select>\n }\n @default {\n <mn-lib-input-field\n (keydown.enter)=\"$event.preventDefault()\"\n (ngModelChange)=\"onColumnFilter(column, $event)\"\n [disabled]=\"column.filterDisabled ?? false\"\n [ngModel]=\"textFilterValue(column)\"\n [props]=\"{\n id: 'mn-table-filter-' + idScope + '-' + column.key,\n type: 'text',\n label: '',\n placeholder: column.filterPlaceholder ?? '',\n ariaLabel: column.filterPlaceholder ?? '',\n autocomplete: column.filterAutocomplete ?? undefined,\n size: 'sm',\n borderRadius: 'md',\n fullWidth: true,\n hover: true\n }\"\n ></mn-lib-input-field>\n }\n }\n</ng-template>\n\n<!-- Inline action buttons for an actions column, shared by the wide-table layout and\n (implicitly) mirrored by the \u22EF menu below 450px. -->\n<ng-template #actionButtons let-column=\"column\" let-row=\"row\">\n <!-- A placeholder (a hidden keepSlot action) is the same button, invisible and inert:\n it holds the column so the actions after it line up with the rows above. -->\n @for (slot of inlineRowActions(column, row); track $index) {\n @let action = slot.action;\n <button\n mnButton\n type=\"button\"\n [data]=\"{\n size: 'sm',\n variant: 'text',\n color: rowActionColor(action, row),\n disabled: isRowActionDisabled(action, row) || slot.placeholder\n }\"\n class=\"cursor-pointer\"\n [class.invisible]=\"slot.placeholder\"\n [attr.inert]=\"slot.placeholder ? '' : null\"\n [attr.aria-hidden]=\"slot.placeholder ? 'true' : null\"\n (click)=\"$event.stopPropagation(); slot.placeholder || runRowAction(action, row)\"\n [attr.aria-label]=\"rowActionLabel(action, row)\"\n [attr.title]=\"showActionLabel(column, action, row) ? null : rowActionLabel(action, row)\"\n >\n @if (showActionIcon(column, action, row)) {\n <span class=\"inline-flex items-center shrink-0\">\n @let icon = rowActionIcon(action, row);\n @if (isTemplateRef(icon)) {\n <ng-container [ngTemplateOutlet]=\"icon\"></ng-container>\n } @else {\n <!-- Data icon: sized here to match the sm button's text, so a caller can\n declare the action in TypeScript without owning a template. -->\n <svg [lucideIcon]=\"$any(icon)\" [size]=\"17\"></svg>\n }\n </span>\n }\n @if (showActionLabel(column, action, row)) {\n <span>{{ rowActionLabel(action, row) }}</span>\n }\n </button>\n }\n</ng-template>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: MnCheckbox, selector: "mn-lib-checkbox", inputs: ["props", "checked"], outputs: ["checkedChange"] }, { kind: "directive", type: MnHiddenBelowDirective, selector: "[mnHiddenBelow]", inputs: ["mnHiddenBelow"] }, { kind: "directive", type: MnShowAboveDirective, selector: "[mnShowAbove]", inputs: ["mnShowAbove"] }, { kind: "directive", type: MnShowBelowDirective, selector: "[mnShowBelow]", inputs: ["mnShowBelow"] }, { kind: "component", type: MnInputField, selector: "mn-lib-input-field", inputs: ["props"] }, { kind: "component", type: MnSelect, selector: "mn-lib-select", inputs: ["props"] }, { kind: "component", type: MnMultiSelect, selector: "mn-lib-multi-select", inputs: ["props"] }, { kind: "component", type: MnDropdown, selector: "mn-lib-dropdown", inputs: ["datasource"] }, { kind: "component", type: MnSkeleton, selector: "mn-skeleton", inputs: ["data"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: MnCollectionPagination, selector: "mn-collection-pagination", inputs: ["idPrefix", "isPaginated", "isServerPaginated", "showLoadMore", "loadingMoreRows", "currentPage", "pageSize", "totalPages", "totalItemCount", "visiblePages", "pageSizeSelectOptions", "labels"], outputs: ["loadMore", "pageChange", "pageSizeChange"] }, { kind: "component", type: MnButton, selector: "button[mnButton], a[mnButton]", inputs: ["data"] }, { kind: "component", type: MnBottomSheet, selector: "mn-bottom-sheet", inputs: ["showBackdrop", "showGrabber", "dismissible", "minHeightPx", "maxHeightVh", "containerClass", "ariaLabel", "ariaLabelledby", "growWithKeyboard", "dismissGuard"], outputs: ["dismiss"] }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2398
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: MnTable, isStandalone: true, selector: "mn-table", outputs: { sortChange: "sortChange", rowClick: "rowClick" }, host: { listeners: { "window:resize": "onWindowResize()" }, classAttribute: "block" }, viewQueries: [{ propertyName: "filtersSheet", first: true, predicate: ["filtersSheet"], descendants: true }, { propertyName: "detailSheet", first: true, predicate: ["detailSheet"], descendants: true }, { propertyName: "detailHeading", first: true, predicate: ["detailHeading"], descendants: true }, { propertyName: "collectionBody", first: true, predicate: ["collectionBody"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<!-- Everything that reflows lives inside a @container, so the breakpoints below\n measure the table's own width rather than the window's. A table in a modal,\n a sidebar or a narrow grid cell is far narrower than the viewport, and\n viewport breakpoints would hand it a desktop layout it has no room for. -->\n<div class=\"@container\">\n <!-- Selection summary: the whole selection, never paged, filtered or sorted. The\n table below answers \"what could I pick?\", which is why it is searched and paged;\n this answers \"what did I pick?\", which a paginated list cannot without hiding\n most of the answer on some other page. -->\n @if (showSelectionSummary) {\n <div class=\"flex flex-col gap-2 rounded-md border border-base-300 bg-base-200/50 p-3 mb-3\">\n <div class=\"flex items-center justify-between gap-2\">\n <span class=\"text-sm font-medium text-base-content\">{{ selectionSummaryTitle }}</span>\n <button\n (click)=\"clearSelection()\"\n [data]=\"{ variant: 'text', color: 'gray', size: 'sm', borderRadius: 'md', hover: true }\"\n class=\"gap-1 shrink-0\"\n mnButton\n type=\"button\"\n >\n <svg [size]=\"14\" [lucideIcon]=\"icons.X\"></svg>\n <span>{{ selectionClearAllLabel }}</span>\n </button>\n </div>\n <!-- Only the first few tags render; the rest collapse behind a \"+N more\" control.\n The heading's count always states the true total, so this hides tags, never\n information. Expanded, the list is height-capped and scrolls, so even a\n selection of hundreds cannot push the table off screen. -->\n <ul\n [class.max-h-28]=\"selectionSummaryExpanded\"\n [class.overflow-y-auto]=\"selectionSummaryExpanded\"\n class=\"flex flex-wrap gap-1.5 list-none m-0 p-0\"\n >\n @for (row of visibleSelectionRows; track dataSource.getID(row)) {\n <li\n class=\"inline-flex items-center gap-1 rounded-full bg-base-100 border border-base-300 pl-2.5 pr-1 py-0.5 text-xs text-base-content max-w-full\">\n <span [attr.title]=\"selectionLabelFor(row)\" class=\"truncate\">{{ selectionLabelFor(row) }}</span>\n <button\n (click)=\"removeSelection(row)\"\n [attr.aria-label]=\"selectionRemoveLabel(row)\"\n class=\"shrink-0 rounded-full p-0.5 hover:bg-base-300 transition-colors cursor-pointer\"\n type=\"button\"\n >\n <svg [size]=\"12\" [lucideIcon]=\"icons.X\"></svg>\n </button>\n </li>\n }\n @if (hiddenSelectionCount > 0 || selectionSummaryExpanded) {\n <li>\n <button\n (click)=\"toggleSelectionSummary()\"\n [attr.aria-expanded]=\"selectionSummaryExpanded\"\n [data]=\"{ variant: 'text', color: 'primary', size: 'sm', borderRadius: 'md', hover: true }\"\n class=\"text-xs\"\n mnButton\n type=\"button\"\n >\n {{ selectionSummaryToggleLabel }}\n </button>\n </li>\n }\n </ul>\n </div>\n }\n\n <!-- Toolbar: custom toolbar template + search. Only rendered when it has content,\n so an unsearchable table without toolbar templates emits no empty spacer. -->\n@if (isSearchable || dataSource.toolbarLeftTemplate || dataSource.toolbarRightTemplate || showsFilterButton) {\n <div class=\"flex flex-col @min-[420px]:flex-row @min-[420px]:items-center justify-between gap-2 mb-3\">\n <!-- The left slot only when it has content: an empty one still took a flex gap, which\n pushed the search 8px in from the page edge. ml-auto keeps the search on the right. -->\n @if (dataSource.toolbarLeftTemplate) {\n <div class=\"flex items-center gap-2 w-full @min-[420px]:w-auto\">\n <div class=\"flex flex-col w-full @min-[420px]:w-auto @min-[420px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"dataSource.toolbarLeftTemplate\"></ng-container>\n </div>\n </div>\n }\n <div\n class=\"flex flex-col @min-[420px]:flex-row @min-[420px]:items-center gap-2 w-full @min-[420px]:flex-1 @min-[420px]:ml-auto @min-[560px]:flex-none @min-[560px]:w-auto\">\n <!-- Search and the filter button share one row: two full-width bars stacked above the\n first row pushed the content a whole screen down on a phone. -->\n @if (isSearchable || showsFilterButton) {\n <div class=\"flex items-center gap-2 w-full @min-[420px]:flex-1 @min-[560px]:flex-none\">\n @if (isSearchable) {\n <!-- Enter must not submit a surrounding form: the search box belongs to the\n table's chrome, not to whatever form the table happens to sit in. -->\n <mn-lib-input-field\n (keydown.enter)=\"$event.preventDefault()\"\n class=\"min-w-0 flex-1 @min-[560px]:flex-none @min-[560px]:min-w-64\"\n [props]=\"{\n id: 'mn-table-search',\n type: 'search',\n label: '',\n ariaLabel: searchPlaceholderLabel,\n placeholder: searchPlaceholderLabel,\n size: 'sm',\n borderRadius: 'md',\n fullWidth: true\n }\"\n [ngModel]=\"searchValue\"\n (ngModelChange)=\"onSearch($event)\"\n ></mn-lib-input-field>\n }\n <!-- Below 640px the header row with its sort buttons and the inline filter row are\n gone; this one button opens both, with a count while filters are set. -->\n @if (showsFilterButton) {\n <button\n type=\"button\"\n mnButton\n [data]=\"{ variant: 'outline', color: 'primary', size: 'md', borderRadius: 'md', hover: true }\"\n class=\"shrink-0 gap-1.5 px-2.5\"\n [class.ml-auto]=\"!isSearchable\"\n [attr.aria-label]=\"filtersButtonAriaLabel\"\n [attr.title]=\"filterSheetLabel\"\n [attr.aria-expanded]=\"filtersPanelOpen\"\n aria-controls=\"mn-table-filters-panel\"\n (click)=\"openFiltersPanel()\"\n >\n <svg [lucideIcon]=\"icons.Funnel\" [size]=\"17\"></svg>\n <!-- The count sits inside the button: a badge hanging off its corner reached past the\n table's right edge and gave a container that clips or scrolls a sideways scroll. -->\n @if (activeFilterCount > 0) {\n <span class=\"text-sm font-semibold leading-none tabular-nums\" aria-hidden=\"true\">{{ activeFilterCount }}</span>\n }\n </button>\n }\n </div>\n }\n @if (dataSource.toolbarRightTemplate) {\n <div class=\"flex flex-col w-full @min-[420px]:w-auto @min-[420px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"dataSource.toolbarRightTemplate\"></ng-container>\n </div>\n }\n </div>\n</div>\n}\n\n<!-- Small-screen filters: full-width fields decoupled from column widths, presented\n as a bottom sheet so they overlay rather than push the table down. -->\n@if (showsFilterButton && filtersPanelOpen) {\n <mn-bottom-sheet\n #filtersSheet\n (dismiss)=\"filtersPanelOpen = false\"\n [ariaLabel]=\"filterSheetLabel\"\n [growWithKeyboard]=\"true\"\n [maxHeightVh]=\"80\"\n >\n <div id=\"mn-table-filters-panel\" class=\"flex flex-col gap-3 px-4 pb-4\">\n <span class=\"text-base font-semibold text-base-content\">{{ filterSheetLabel }}</span>\n <!-- Sorting lives here below 640px: the header row whose buttons sorted is not rendered.\n The choices are inline radios, not a select: a select opens its own bottom sheet on a\n phone, which stacked a second sheet on this one and cut its list off. One row per\n column, the direction as a separate switch once a column is picked. -->\n @if (sortableColumns.length > 0) {\n <fieldset class=\"m-0 flex flex-col gap-2 border-0 p-0\">\n <legend\n class=\"mb-1 p-0 text-xs font-medium text-base-content/70\"\n [class.sr-only]=\"!hasColumnFilters\"\n >{{ sortByLabel }}</legend>\n <div class=\"flex flex-col\">\n <label class=\"flex min-h-11 cursor-pointer items-center gap-3 text-sm text-base-content\">\n <input\n type=\"radio\"\n class=\"size-[1.125rem] shrink-0 cursor-pointer appearance-none rounded-full border-2 border-base-content/40 bg-base-100 transition-[border] checked:border-[0.3125rem] checked:border-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary\"\n [name]=\"sortGroupName\"\n value=\"\"\n [checked]=\"!currentSort\"\n (change)=\"onSortColumn('')\"\n />\n <span>{{ sortDefaultLabel }}</span>\n </label>\n @for (column of sortableColumns; track column.key) {\n <!-- The chosen column carries its own direction button at the row's end: it sits\n inside a row that is already there, so picking a column never grows the sheet,\n and no greyed-out switch shows while the default order is chosen. -->\n <div class=\"flex min-h-11 items-center gap-2\">\n <label class=\"flex min-w-0 flex-1 cursor-pointer items-center gap-3 self-stretch text-sm text-base-content\">\n <input\n type=\"radio\"\n class=\"size-[1.125rem] shrink-0 cursor-pointer appearance-none rounded-full border-2 border-base-content/40 bg-base-100 transition-[border] checked:border-[0.3125rem] checked:border-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary\"\n [name]=\"sortGroupName\"\n [value]=\"column.key\"\n [checked]=\"currentSort?.columnKey === column.key\"\n (change)=\"onSortColumn(column.key)\"\n />\n <span class=\"truncate\">{{ headerText(column) || column.key }}</span>\n </label>\n @if (currentSort?.columnKey === column.key) {\n <button\n type=\"button\"\n mnButton\n [data]=\"{ variant: 'outline', color: 'primary', size: 'sm', borderRadius: 'md', hover: true }\"\n class=\"shrink-0 gap-1.5\"\n [attr.aria-label]=\"sortDirectionButtonLabel\"\n (click)=\"toggleSortDirection()\"\n >\n <svg [lucideIcon]=\"currentSort?.direction === 'desc' ? icons.ArrowDown : icons.ArrowUp\" [size]=\"15\"></svg>\n <span>{{ sortDirectionLabel }}</span>\n </button>\n }\n </div>\n }\n </div>\n </fieldset>\n @if (hasColumnFilters) {\n <div class=\"border-t border-base-300\" aria-hidden=\"true\"></div>\n }\n }\n @for (column of dataSource.columns; track column.key) {\n @if (column.filterable) {\n <div class=\"flex flex-col gap-1\">\n <label\n class=\"text-xs font-medium text-base-content/70\"\n [attr.for]=\"'mn-table-filter-panel-' + column.key\"\n >\n @if (isTemplateRef(column.header)) {\n <ng-container [ngTemplateOutlet]=\"$any(column.header)\"></ng-container>\n } @else {\n {{ headerText(column) }}\n }\n </label>\n <!-- The field template is declared outside the sheet, so it would inject from there;\n this injector tells its selects they are in a sheet (no second sheet on top). -->\n <ng-container\n [ngTemplateOutletContext]=\"{ $implicit: column, idScope: 'panel' }\"\n [ngTemplateOutletInjector]=\"inSheetInjector\"\n [ngTemplateOutlet]=\"filterField\"\n ></ng-container>\n </div>\n }\n }\n @if (hasActiveFilters) {\n <button\n type=\"button\"\n mnButton\n [data]=\"{ variant: 'text', color: 'gray', size: 'sm', borderRadius: 'md', hover: true }\"\n class=\"self-start gap-1\"\n (click)=\"clearAllFilters()\"\n >\n <svg [lucideIcon]=\"icons.X\" [size]=\"14\"></svg>\n <span>{{ clearFiltersButtonLabel }}</span>\n </button>\n }\n <div class=\"mt-1 flex min-[400px]:justify-end\">\n <button\n type=\"button\"\n mnButton\n [data]=\"{ variant: 'fill', color: 'primary', size: 'md', borderRadius: 'md', hover: true }\"\n class=\"w-full min-[400px]:w-auto\"\n (click)=\"closeFiltersPanel()\"\n >\n <span>{{ filtersCloseLabel }}</span>\n </button>\n </div>\n </div>\n </mn-bottom-sheet>\n}\n\n<!-- Detail sheet (below 640px): the whole record of one row \u2014 title and right-side value as the\n heading, every other column as a label/value list, then the actions. It is the only place a\n column the composed row could not show, or an action, is reachable on a phone. -->\n@if (detailRow !== null) {\n @let row = detailRow;\n <mn-bottom-sheet\n #detailSheet\n (dismiss)=\"onDetailDismissed()\"\n [ariaLabel]=\"rowLabel(row)\"\n [maxHeightVh]=\"85\"\n >\n <!-- Escape closes it: the sheet itself only handles the backdrop and the drag. Focus is\n moved inside on open, so the key arrives here by bubbling. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div class=\"flex flex-col gap-4 px-4 pb-4\" (keydown.escape)=\"closeDetail()\">\n <div class=\"flex items-start gap-3\">\n <h2\n #detailHeading\n class=\"m-0 min-w-0 flex-1 text-lg font-semibold leading-snug text-base-content outline-none [overflow-wrap:anywhere]\"\n tabindex=\"-1\"\n >\n @if (rowLayout.title; as title) {\n <ng-container [ngTemplateOutlet]=\"fullCell\" [ngTemplateOutletContext]=\"{ $implicit: title, row: row }\"></ng-container>\n }\n </h2>\n @if (rowLayout.trailing; as trailing) {\n <span class=\"shrink-0 text-lg font-semibold tabular-nums text-base-content\">\n <ng-container [ngTemplateOutlet]=\"fullCell\" [ngTemplateOutletContext]=\"{ $implicit: trailing, row: row }\"></ng-container>\n </span>\n }\n </div>\n @if (detailColumns.length > 0) {\n <dl class=\"m-0 grid grid-cols-[minmax(0,8rem)_minmax(0,1fr)] gap-x-3 gap-y-2.5 border-t border-base-300 pt-4 text-sm\">\n @for (column of detailColumns; track column.key) {\n <dt class=\"text-(--color-base-content-muted,color-mix(in_oklab,var(--color-base-content)_65%,transparent))\">\n @if (isTemplateRef(column.header)) {\n <ng-container [ngTemplateOutlet]=\"$any(column.header)\"></ng-container>\n } @else {\n {{ headerText(column) }}\n }\n </dt>\n <dd class=\"m-0 min-w-0 text-base-content [overflow-wrap:anywhere]\">\n <ng-container [ngTemplateOutlet]=\"fullCell\" [ngTemplateOutletContext]=\"{ $implicit: column, row: row }\"></ng-container>\n </dd>\n }\n </dl>\n }\n @if (rowHasAnyActions(row)) {\n <div class=\"flex flex-col gap-2 border-t border-base-300 pt-4\">\n @for (column of rowLayout.actions; track column.key) {\n @for (action of visibleRowActions(column, row); track $index) {\n <button\n mnButton\n type=\"button\"\n [data]=\"{\n variant: 'outline',\n color: rowActionColor(action, row),\n size: 'md',\n borderRadius: 'md',\n hover: true,\n disabled: isRowActionDisabled(action, row)\n }\"\n class=\"w-full gap-2\"\n [attr.aria-disabled]=\"isRowActionDisabled(action, row) || null\"\n (click)=\"runDetailAction(action, row)\"\n >\n @let icon = rowActionIcon(action, row);\n @if (icon) {\n <span class=\"inline-flex shrink-0 items-center\">\n @if (isTemplateRef(icon)) {\n <ng-container [ngTemplateOutlet]=\"icon\"></ng-container>\n } @else {\n <svg [lucideIcon]=\"$any(icon)\" [size]=\"17\"></svg>\n }\n </span>\n }\n <span>{{ rowActionLabel(action, row) }}</span>\n </button>\n }\n }\n </div>\n }\n </div>\n </mn-bottom-sheet>\n}\n\n<!-- Announces loading. The skeletons are aria-hidden, so without this a screen reader hears\n nothing while rows load. The region stays in the DOM and only its text changes, which is\n what makes assistive tech read it; one inserted with its text already set is often missed. -->\n<span class=\"sr-only\" role=\"status\">{{ isLoadingState ? loadingLabel : '' }}</span>\n\n<!-- Table wrapper with horizontal scroll -->\n <div #collectionBody [attr.aria-busy]=\"isLoadingState || null\" [attr.aria-label]=\"tableRegionLabel\" [style.min-height.px]=\"bodyMinHeight\"\n class=\"overflow-x-auto\"\n role=\"region\">\n @if (rowMode) {\n <!-- Below 640px every row is a composed line (see resolveRowLayout): the columns that\n would not fit as cells become a title, a second line and a value on the right, and\n the rest waits in the detail sheet a tap opens. A list, not a table: there are no\n columns left for a screen reader to navigate. -->\n <ul class=\"m-0 list-none p-0\">\n @if (isLoadingState) {\n @for (_ of skeletonRows; track $index) {\n <li aria-hidden=\"true\" class=\"flex items-center gap-3 border-b border-base-300 bg-base-100 px-2 py-3\">\n <div class=\"flex flex-1 flex-col gap-2\">\n <mn-skeleton [data]=\"{ shape: 'text', width: '60%' }\"></mn-skeleton>\n <mn-skeleton [data]=\"{ shape: 'text', width: '40%', height: '0.75rem' }\"></mn-skeleton>\n </div>\n </li>\n }\n } @else if (isErrorState) {\n <li class=\"bg-base-100 py-8 text-center text-xs\">\n <ng-container [ngTemplateOutlet]=\"errorContent\"></ng-container>\n </li>\n } @else {\n @if (filteredItems.length === 0) {\n <li class=\"bg-base-100 text-center text-xs\">\n <ng-container [ngTemplateOutlet]=\"emptyContent\"></ng-container>\n </li>\n }\n @for (row of paginatedItems; track trackByID($index, row)) {\n @let tap = rowTap(row);\n <li\n class=\"flex items-stretch border-b border-base-300 bg-base-100\"\n [ngClass]=\"{ 'bg-primary/10': isSelected(row) }\"\n >\n @if (hasSelection) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events,@angular-eslint/template/interactive-supports-focus -->\n <div class=\"flex shrink-0 items-center pl-2\" (click)=\"$event.stopPropagation()\">\n <mn-lib-checkbox\n (checkedChange)=\"toggle(row)\"\n [checked]=\"isSelected(row)\"\n [props]=\"{ id: 'mn-table-row-' + $index, size: 'sm' }\"\n ></mn-lib-checkbox>\n </div>\n }\n @if (tap === 'detail' || tap === 'click') {\n <button\n type=\"button\"\n class=\"flex min-w-0 flex-1 cursor-pointer items-start gap-3 px-2 py-3 text-left transition-colors duration-150 hover:bg-base-200 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary\"\n [attr.aria-haspopup]=\"tap === 'detail' ? 'dialog' : null\"\n (click)=\"onRowTap(row, $event)\"\n >\n <ng-container [ngTemplateOutlet]=\"rowBody\" [ngTemplateOutletContext]=\"{ $implicit: row, chevron: true }\"></ng-container>\n </button>\n } @else {\n <!-- A selection row toggles on a click anywhere, as the wide table's row does; the\n checkbox is its keyboard control, so this area needs no focus of its own. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events,@angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"flex min-w-0 flex-1 items-start gap-3 px-2 py-3\"\n [class.cursor-pointer]=\"tap === 'select'\"\n (click)=\"tap === 'select' && onRowClick(row)\"\n >\n <ng-container [ngTemplateOutlet]=\"rowBody\" [ngTemplateOutletContext]=\"{ $implicit: row, chevron: false }\"></ng-container>\n </div>\n }\n @if (showsRowMore(row)) {\n <button\n type=\"button\"\n class=\"flex w-11 shrink-0 cursor-pointer items-center justify-center text-base-content/70 transition-colors hover:bg-base-200 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"rowDetailsLabel(row)\"\n (click)=\"openDetail(row, $any($event.currentTarget))\"\n >\n <svg [lucideIcon]=\"icons.Ellipsis\" [size]=\"18\"></svg>\n </button>\n }\n @if (showsRowMenu(row)) {\n @for (column of rowLayout.actions; track column.key) {\n @if (hasRowActions(column, row)) {\n <div class=\"flex shrink-0 items-center pr-1\">\n <mn-lib-dropdown [datasource]=\"{\n id: actionsDropdownId(column, row),\n actions: rowDropdownActions(column, row),\n menuLabel: headerText(column),\n size: 'sm'\n }\"></mn-lib-dropdown>\n </div>\n }\n }\n }\n </li>\n }\n }\n </ul>\n } @else {\n <table [class]=\"tableClasses\">\n <thead>\n <tr class=\"bg-base-100\">\n <!-- Selection column header. It always carries a screen-reader-only name: a single-select\n table has nothing else in this cell, and a multi-select one only a checkbox, so\n without it the column is announced as a nameless header (axe empty-table-header). -->\n @if (hasSelection) {\n <th class=\"w-10 text-center text-sm px-2 py-2\">\n <span class=\"sr-only\">{{ selectionColumnLabel }}</span>\n @if (isMultiSelect) {\n <mn-lib-checkbox\n (checkedChange)=\"toggleAll()\"\n [checked]=\"allSelected\"\n [props]=\"{ id: 'mn-table-select-all', size: 'sm' }\"\n ></mn-lib-checkbox>\n }\n </th>\n }\n\n <!-- Data columns -->\n @for (column of dataSource.columns; track column.key) {\n <th\n [attr.data-column-key]=\"column.key\"\n [class.truncate]=\"widthsArePinned\"\n [class.cursor-pointer]=\"isSortable(column)\"\n [class.select-none]=\"isSortable(column)\"\n [class.hover:bg-base-200]=\"isSortable(column)\"\n [class.text-left]=\"(column.align ?? 'left') === 'left'\"\n [class.text-center]=\"column.align === 'center'\"\n [class.text-right]=\"column.align === 'right'\"\n [mnHiddenBelow]=\"column.hiddenBelow\"\n [style.width]=\"columnWidth(column)\"\n [attr.aria-sort]=\"currentSort?.columnKey === column.key ? (currentSort!.direction === 'asc' ? 'ascending' : 'descending') : null\"\n class=\"text-sm px-2 py-1 @min-[640px]:px-4 @min-[640px]:py-2 whitespace-nowrap\"\n (click)=\"sort(column)\"\n >\n <!-- The header content is declared once; a sortable column wraps it in a real button so\n the sort is reachable by keyboard. The button's click stops there, so the th's own\n click (which keeps the cell padding clickable) does not sort a second time. -->\n <ng-template #headerContent>\n @if (isTemplateRef(column.header)) {\n <ng-container [ngTemplateOutlet]=\"$any(column.header)\"></ng-container>\n } @else {\n <span>{{ headerText(column) }}</span>\n }\n @if (isSortable(column)) {\n <span class=\"text-[0.65rem] opacity-70 min-w-3 inline-block\" aria-hidden=\"true\">{{ getSortIcon(column) }}</span>\n }\n </ng-template>\n @if (isSortable(column)) {\n <button type=\"button\" class=\"inline-flex items-center gap-1 cursor-pointer\" (click)=\"$event.stopPropagation(); sort(column)\">\n <ng-container [ngTemplateOutlet]=\"headerContent\"></ng-container>\n </button>\n } @else {\n <span class=\"inline-flex items-center gap-1\">\n <ng-container [ngTemplateOutlet]=\"headerContent\"></ng-container>\n </span>\n }\n </th>\n }\n\n </tr>\n\n <!-- Per-column filter row (wide screens only; collapses into a panel below 640px).\n The cells are `td`, not `th`: they hold form controls, not headings, and a\n column without a filter would otherwise be an empty header, which assistive tech\n announces as a nameless column (axe `empty-table-header`). `font-normal` stays\n so a consumer's thead styling cannot make the controls bold. -->\n @if (hasColumnFilters && !filtersCollapsed) {\n <tr class=\"bg-base-100 border-b border-base-300 font-normal\">\n @if (hasSelection) {\n <td class=\"px-2 py-1 font-normal\"></td>\n }\n @for (column of dataSource.columns; track column.key) {\n <td\n class=\"px-4 py-2 font-normal\"\n [mnHiddenBelow]=\"column.hiddenBelow\"\n >\n @if (column.filterable) {\n <!-- Every filter renders as an ordinary control right under its\n header. The rich types used to hide behind a button that opened\n a floating panel, which cost a click to discover, a click to\n apply, and hid whether a column was even filterable. -->\n <ng-container\n [ngTemplateOutletContext]=\"{ $implicit: column, idScope: 'inline' }\"\n [ngTemplateOutlet]=\"filterField\"\n ></ng-container>\n }\n </td>\n }\n </tr>\n }\n </thead>\n\n <tbody>\n <!-- Loading state -->\n @if (isLoadingState) {\n @for (_ of skeletonRows; track $index) {\n <tr>\n @if (hasSelection) {\n <td class=\"px-2 py-3\">\n <mn-skeleton [data]=\"{ shape: 'rectangle', width: '1rem', height: '1rem' }\"></mn-skeleton>\n </td>\n }\n @for (column of dataSource.columns; track column.key) {\n <td class=\"px-4 py-3\"\n [mnHiddenBelow]=\"column.hiddenBelow\"\n [style.width]=\"columnWidth(column)\"\n >\n @if (isTemplateRef(column.skeleton)) {\n <ng-container [ngTemplateOutlet]=\"$any(column.skeleton)\"></ng-container>\n } @else {\n <mn-skeleton [data]=\"getColumnSkeletonData(column)\"></mn-skeleton>\n }\n </td>\n }\n </tr>\n }\n } @else if (isErrorState) {\n <!-- Error state -->\n <tr class=\"bg-base-100\">\n <td [attr.colspan]=\"totalColumnCount\" class=\"text-center text-xs py-8\">\n <ng-container [ngTemplateOutlet]=\"errorContent\"></ng-container>\n </td>\n </tr>\n } @else {\n <!-- Empty state -->\n @if (filteredItems.length === 0) {\n <tr class=\"bg-base-100\">\n <td [attr.colspan]=\"totalColumnCount\" class=\"text-center text-xs py-8\">\n <ng-container [ngTemplateOutlet]=\"emptyContent\"></ng-container>\n </td>\n </tr>\n }\n\n <!-- Data rows -->\n @for (row of paginatedItems; track trackByID($index, row); let odd = $odd; let last = $last) {\n <!-- The wash and the pointer promise that a click does something, so only a clickable row gets them. -->\n <tr\n class=\"bg-base-100 transition-colors duration-150 border-b border-base-300\"\n [ngClass]=\"{'bg-primary/10': isSelected(row)}\"\n [class.bg-base-200]=\"!isSelected(row) && odd && dataSource.appearance?.striped\"\n [class.hover:bg-base-200]=\"rowsClickable && dataSource.appearance?.hover !== false\"\n [class.cursor-pointer]=\"rowsClickable\"\n (click)=\"onRowClick(row)\"\n >\n <!-- Selection checkbox -->\n @if (hasSelection) {\n <td (click)=\"$event.stopPropagation()\" class=\"w-10 text-center px-2 py-2\">\n <mn-lib-checkbox\n (checkedChange)=\"toggle(row)\"\n [checked]=\"isSelected(row)\"\n [props]=\"{ id: 'mn-table-row-' + $index, size: 'sm' }\"\n ></mn-lib-checkbox>\n </td>\n }\n\n <!-- Data cells -->\n @for (column of dataSource.columns; track column.key) {\n <td\n [attr.title]=\"cellTitle(column, row)\"\n [class.text-left]=\"(column.align ?? 'left') === 'left'\"\n [class.text-center]=\"column.align === 'center'\"\n [class.text-right]=\"column.align === 'right'\"\n [class.truncate]=\"widthsArePinned\"\n [mnHiddenBelow]=\"column.hiddenBelow\"\n [style.width]=\"columnWidth(column)\"\n class=\"text-xs px-2 py-1 @min-[640px]:px-4 @min-[640px]:py-2\"\n >\n @if (column.actions) {\n <!-- Actions column: inline command buttons. The grid only renders at 640px\n and wider, where they fit; below that the actions move into the row's\n detail sheet. A row with no visible actions renders nothing. -->\n @if (hasRowActions(column, row)) {\n <div class=\"inline-flex items-center gap-1\"\n [class.justify-end]=\"(column.align ?? 'left') === 'right'\">\n <span class=\"inline-flex items-center gap-1\">\n <ng-container [ngTemplateOutletContext]=\"{ column: column, row: row }\"\n [ngTemplateOutlet]=\"actionButtons\"></ng-container>\n </span>\n </div>\n }\n } @else if (column.cellSm) {\n <!-- Default cell: hidden below the cellSm breakpoint -->\n <span [mnShowAbove]=\"column.cellSm.below\">\n @if (isTemplateRef(column.cell)) {\n <ng-container [ngTemplateOutletContext]=\"{ $implicit: row, data: row }\"\n [ngTemplateOutlet]=\"$any(column.cell)\"></ng-container>\n } @else {\n {{ getCellValue(column, row) }}\n }\n </span>\n <!-- Small cell: shown only below the cellSm breakpoint -->\n <span [mnShowBelow]=\"column.cellSm.below\">\n @if (isTemplateRef(column.cellSm.cell)) {\n <ng-container [ngTemplateOutletContext]=\"{ $implicit: row, data: row }\"\n [ngTemplateOutlet]=\"$any(column.cellSm.cell)\"></ng-container>\n } @else {\n {{ getCellSmValue(column, row) }}\n }\n </span>\n } @else {\n @if (isTemplateRef(column.cell)) {\n <ng-container [ngTemplateOutletContext]=\"{ $implicit: row, data: row }\"\n [ngTemplateOutlet]=\"$any(column.cell)\"></ng-container>\n } @else {\n {{ getCellValue(column, row) }}\n }\n }\n </td>\n }\n\n </tr>\n }\n }\n </tbody>\n </table>\n }\n</div>\n\n<!-- Load more + pagination -->\n<mn-collection-pagination\n (loadMore)=\"loadMoreRows()\"\n (pageChange)=\"goToPage($event)\"\n (pageSizeChange)=\"onPageSizeChange($event)\"\n [currentPage]=\"currentPage\"\n [isPaginated]=\"isPaginated\"\n [isServerPaginated]=\"isServerPaginated\"\n [labels]=\"dataSource.labels\"\n [loadingMoreRows]=\"loadingMoreRows\"\n [pageSizeSelectOptions]=\"pageSizeSelectOptions\"\n [pageSize]=\"pageSize\"\n [showLoadMore]=\"showLoadMore\"\n [totalItemCount]=\"totalItemCount\"\n [totalPages]=\"totalPages\"\n [visiblePages]=\"visiblePages\"\n idPrefix=\"mn-table\"\n></mn-collection-pagination>\n</div>\n\n<!-- Single source of truth for every filter control, reused by the inline header\n row and the small-screen panel. `idScope` keeps element ids unique across\n both placements. -->\n<ng-template #filterField let-column let-idScope=\"idScope\">\n @switch (filterTypeOf(column)) {\n @case ('select') {\n <mn-lib-select\n (ngModelChange)=\"onColumnFilter(column, $event)\"\n [disabled]=\"column.filterDisabled ?? false\"\n [ngModel]=\"textFilterValue(column)\"\n [props]=\"{\n id: 'mn-table-filter-' + idScope + '-' + column.key,\n ariaLabel: filterLabel(column),\n options: getFilterSelectOptions(column),\n placeholder: filterAllLabel(column),\n size: 'sm',\n fullWidth: true\n }\"\n ></mn-lib-select>\n }\n @case ('multi-select') {\n <mn-lib-multi-select\n (ngModelChange)=\"onColumnFilter(column, $event)\"\n [disabled]=\"column.filterDisabled ?? false\"\n [ngModel]=\"multiFilterValue(column)\"\n [props]=\"{\n id: 'mn-table-filter-' + idScope + '-' + column.key,\n ariaLabel: filterLabel(column),\n options: getFilterMultiSelectOptions(column),\n placeholder: column.filterPlaceholder ?? '',\n collapsePlaceholder: filterSelectedLabel,\n collapseThreshold: 1,\n size: 'sm',\n fullWidth: true\n }\"\n ></mn-lib-multi-select>\n }\n @case ('boolean') {\n <mn-lib-select\n (ngModelChange)=\"onBooleanFilter(column, $event)\"\n [disabled]=\"column.filterDisabled ?? false\"\n [ngModel]=\"booleanFilterValue(column)\"\n [props]=\"{\n id: 'mn-table-filter-' + idScope + '-' + column.key,\n ariaLabel: filterLabel(column),\n options: getBooleanFilterOptions(column),\n size: 'sm',\n fullWidth: true\n }\"\n ></mn-lib-select>\n }\n @default {\n <mn-lib-input-field\n (keydown.enter)=\"$event.preventDefault()\"\n (ngModelChange)=\"onColumnFilter(column, $event)\"\n [disabled]=\"column.filterDisabled ?? false\"\n [ngModel]=\"textFilterValue(column)\"\n [props]=\"{\n id: 'mn-table-filter-' + idScope + '-' + column.key,\n type: 'text',\n label: '',\n placeholder: column.filterPlaceholder ?? '',\n ariaLabel: column.filterPlaceholder ?? '',\n autocomplete: column.filterAutocomplete ?? undefined,\n size: 'sm',\n borderRadius: 'md',\n fullWidth: true,\n hover: true\n }\"\n ></mn-lib-input-field>\n }\n }\n</ng-template>\n\n<!-- One composed row (below 640px): the leading block, the title (two lines at most) over the\n second line, the right-side value, and a chevron when a tap opens something. The slots\n come from rowLayout; a column renders its cellSm form here when it has one. -->\n<ng-template #rowBody let-row let-chevron=\"chevron\">\n @let layout = rowLayout;\n @if (layout.leading; as leading) {\n <span class=\"flex h-8 min-w-8 shrink-0 items-center justify-center rounded-md bg-primary/10 px-1.5 text-sm font-semibold tabular-nums text-primary\">\n <ng-container [ngTemplateOutlet]=\"rowCell\" [ngTemplateOutletContext]=\"{ $implicit: leading, row: row }\"></ng-container>\n </span>\n }\n <span class=\"flex min-w-0 flex-1 flex-col gap-1\">\n @if (layout.title; as title) {\n <span class=\"line-clamp-2 text-sm font-semibold leading-snug text-base-content [overflow-wrap:anywhere]\">\n <ng-container [ngTemplateOutlet]=\"rowCell\" [ngTemplateOutletContext]=\"{ $implicit: title, row: row }\"></ng-container>\n </span>\n }\n @if (layout.meta.length > 0) {\n <span class=\"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-(--color-base-content-muted,color-mix(in_oklab,var(--color-base-content)_65%,transparent))\">\n @for (column of layout.meta; track column.key) {\n <span class=\"min-w-0 max-w-full truncate\">\n <ng-container [ngTemplateOutlet]=\"rowCell\" [ngTemplateOutletContext]=\"{ $implicit: column, row: row, meta: true }\"></ng-container>\n </span>\n }\n </span>\n }\n </span>\n @if (layout.trailing; as trailing) {\n <span class=\"max-w-[40%] shrink-0 text-right text-sm font-semibold tabular-nums text-base-content\">\n <ng-container [ngTemplateOutlet]=\"rowCell\" [ngTemplateOutletContext]=\"{ $implicit: trailing, row: row }\"></ng-container>\n </span>\n }\n @if (chevron) {\n <svg [lucideIcon]=\"icons.ChevronRight\" [size]=\"16\" aria-hidden=\"true\" class=\"mt-0.5 shrink-0 opacity-50\"></svg>\n }\n</ng-template>\n\n<!-- A cell as a composed row shows it: cellSm first, a bare figure on the second line with its\n column name in front. -->\n<ng-template #rowCell let-column let-row=\"row\" let-meta=\"meta\">\n @let template = rowCellTemplate(column);\n @if (template) {\n <ng-container [ngTemplateOutletContext]=\"{ $implicit: row, data: row }\" [ngTemplateOutlet]=\"template\"></ng-container>\n } @else {\n {{ meta ? rowMetaText(column, row) : rowCellText(column, row) }}\n }\n</ng-template>\n\n<!-- A cell in full, as the wide table shows it: the detail sheet is where the long form belongs. -->\n<ng-template #fullCell let-column let-row=\"row\">\n @if (isTemplateRef(column.cell)) {\n <ng-container [ngTemplateOutletContext]=\"{ $implicit: row, data: row }\" [ngTemplateOutlet]=\"$any(column.cell)\"></ng-container>\n } @else {\n {{ getCellValue(column, row) }}\n }\n</ng-template>\n\n<!-- Empty and error content, shared by the grid and the composed rows. -->\n<ng-template #emptyContent>\n @if (dataSource.emptyTemplate) {\n <ng-container [ngTemplateOutlet]=\"dataSource.emptyTemplate\"></ng-container>\n } @else {\n <!-- The same look as a section's empty state, so a page with both reads as one:\n a faint icon over a medium line in the consumer's muted text colour. -->\n <div class=\"flex flex-col items-center gap-3 py-16 text-(--color-base-content-muted,color-mix(in_oklab,var(--color-base-content)_65%,transparent))\">\n @if (dataSource.emptyIcon !== null) {\n <svg [lucideIcon]=\"dataSource.emptyIcon ?? defaultEmptyIcon\" [size]=\"26\" class=\"opacity-30\"></svg>\n }\n <p class=\"text-base font-medium\">{{ dataSource.emptyMessage }}</p>\n </div>\n }\n</ng-template>\n\n<ng-template #errorContent>\n @if (dataSource.errorTemplate) {\n <ng-container [ngTemplateOutlet]=\"dataSource.errorTemplate\"></ng-container>\n } @else {\n <div class=\"flex flex-col items-center gap-2 text-error\">\n <p class=\"text-sm\">{{ dataSource.errorMessage }}</p>\n </div>\n }\n</ng-template>\n\n<!-- Inline action buttons for an actions column on the wide table. Below 640px the same\n actions render in the detail sheet (or a modal's \u22EF menu). -->\n<ng-template #actionButtons let-column=\"column\" let-row=\"row\">\n <!-- A placeholder (a hidden keepSlot action) is the same button, invisible and inert:\n it holds the column so the actions after it line up with the rows above. -->\n @for (slot of inlineRowActions(column, row); track $index) {\n @let action = slot.action;\n <button\n mnButton\n type=\"button\"\n [data]=\"{\n size: 'sm',\n variant: 'text',\n color: rowActionColor(action, row),\n disabled: isRowActionDisabled(action, row) || slot.placeholder\n }\"\n class=\"cursor-pointer\"\n [class.invisible]=\"slot.placeholder\"\n [attr.inert]=\"slot.placeholder ? '' : null\"\n [attr.aria-hidden]=\"slot.placeholder ? 'true' : null\"\n (click)=\"$event.stopPropagation(); slot.placeholder || runRowAction(action, row)\"\n [attr.aria-label]=\"rowActionLabel(action, row)\"\n [attr.title]=\"showActionLabel(column, action, row) ? null : rowActionLabel(action, row)\"\n >\n @if (showActionIcon(column, action, row)) {\n <span class=\"inline-flex items-center shrink-0\">\n @let icon = rowActionIcon(action, row);\n @if (isTemplateRef(icon)) {\n <ng-container [ngTemplateOutlet]=\"icon\"></ng-container>\n } @else {\n <!-- Data icon: sized here to match the sm button's text, so a caller can\n declare the action in TypeScript without owning a template. -->\n <svg [lucideIcon]=\"$any(icon)\" [size]=\"17\"></svg>\n }\n </span>\n }\n @if (showActionLabel(column, action, row)) {\n <span>{{ rowActionLabel(action, row) }}</span>\n }\n </button>\n }\n</ng-template>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: MnCheckbox, selector: "mn-lib-checkbox", inputs: ["props", "checked"], outputs: ["checkedChange"] }, { kind: "directive", type: MnHiddenBelowDirective, selector: "[mnHiddenBelow]", inputs: ["mnHiddenBelow"] }, { kind: "directive", type: MnShowAboveDirective, selector: "[mnShowAbove]", inputs: ["mnShowAbove"] }, { kind: "directive", type: MnShowBelowDirective, selector: "[mnShowBelow]", inputs: ["mnShowBelow"] }, { kind: "component", type: MnInputField, selector: "mn-lib-input-field", inputs: ["props"] }, { kind: "component", type: MnSelect, selector: "mn-lib-select", inputs: ["props"] }, { kind: "component", type: MnMultiSelect, selector: "mn-lib-multi-select", inputs: ["props"] }, { kind: "component", type: MnDropdown, selector: "mn-lib-dropdown", inputs: ["datasource"] }, { kind: "component", type: MnSkeleton, selector: "mn-skeleton", inputs: ["data"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: MnCollectionPagination, selector: "mn-collection-pagination", inputs: ["idPrefix", "isPaginated", "isServerPaginated", "showLoadMore", "loadingMoreRows", "currentPage", "pageSize", "totalPages", "totalItemCount", "visiblePages", "pageSizeSelectOptions", "labels"], outputs: ["loadMore", "pageChange", "pageSizeChange"] }, { kind: "component", type: MnButton, selector: "button[mnButton], a[mnButton]", inputs: ["data"] }, { kind: "component", type: MnBottomSheet, selector: "mn-bottom-sheet", inputs: ["showBackdrop", "showGrabber", "dismissible", "minHeightPx", "maxHeightVh", "containerClass", "ariaLabel", "ariaLabelledby", "growWithKeyboard", "dismissGuard"], outputs: ["dismiss"] }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2038
2399
  }
2039
2400
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnTable, decorators: [{
2040
2401
  type: Component,
2041
- args: [{ selector: 'mn-table', standalone: true, imports: [NgClass, NgTemplateOutlet, MnCheckbox, MnHiddenBelowDirective, MnShowAboveDirective, MnShowBelowDirective, MnInputField, MnSelect, MnMultiSelect, MnDropdown, MnSkeleton, FormsModule, MnCollectionPagination, MnButton, MnBottomSheet, LucideDynamicIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'block' }, template: "<!-- Everything that reflows lives inside a @container, so the breakpoints below\n measure the table's own width rather than the window's. A table in a modal,\n a sidebar or a narrow grid cell is far narrower than the viewport, and\n viewport breakpoints would hand it a desktop layout it has no room for. -->\n<div class=\"@container\">\n <!-- Selection summary: the whole selection, never paged, filtered or sorted. The\n table below answers \"what could I pick?\", which is why it is searched and paged;\n this answers \"what did I pick?\", which a paginated list cannot without hiding\n most of the answer on some other page. -->\n @if (showSelectionSummary) {\n <div class=\"flex flex-col gap-2 rounded-md border border-base-300 bg-base-200/50 p-3 mb-3\">\n <div class=\"flex items-center justify-between gap-2\">\n <span class=\"text-sm font-medium text-base-content\">{{ selectionSummaryTitle }}</span>\n <button\n (click)=\"clearSelection()\"\n [data]=\"{ variant: 'text', color: 'gray', size: 'sm', borderRadius: 'md', hover: true }\"\n class=\"gap-1 shrink-0\"\n mnButton\n type=\"button\"\n >\n <svg [size]=\"14\" [lucideIcon]=\"icons.X\"></svg>\n <span>{{ selectionClearAllLabel }}</span>\n </button>\n </div>\n <!-- Only the first few tags render; the rest collapse behind a \"+N more\" control.\n The heading's count always states the true total, so this hides tags, never\n information. Expanded, the list is height-capped and scrolls, so even a\n selection of hundreds cannot push the table off screen. -->\n <ul\n [class.max-h-28]=\"selectionSummaryExpanded\"\n [class.overflow-y-auto]=\"selectionSummaryExpanded\"\n class=\"flex flex-wrap gap-1.5 list-none m-0 p-0\"\n >\n @for (row of visibleSelectionRows; track dataSource.getID(row)) {\n <li\n class=\"inline-flex items-center gap-1 rounded-full bg-base-100 border border-base-300 pl-2.5 pr-1 py-0.5 text-xs text-base-content max-w-full\">\n <span [attr.title]=\"selectionLabelFor(row)\" class=\"truncate\">{{ selectionLabelFor(row) }}</span>\n <button\n (click)=\"removeSelection(row)\"\n [attr.aria-label]=\"selectionRemoveLabel(row)\"\n class=\"shrink-0 rounded-full p-0.5 hover:bg-base-300 transition-colors cursor-pointer\"\n type=\"button\"\n >\n <svg [size]=\"12\" [lucideIcon]=\"icons.X\"></svg>\n </button>\n </li>\n }\n @if (hiddenSelectionCount > 0 || selectionSummaryExpanded) {\n <li>\n <button\n (click)=\"toggleSelectionSummary()\"\n [attr.aria-expanded]=\"selectionSummaryExpanded\"\n [data]=\"{ variant: 'text', color: 'primary', size: 'sm', borderRadius: 'md', hover: true }\"\n class=\"text-xs\"\n mnButton\n type=\"button\"\n >\n {{ selectionSummaryToggleLabel }}\n </button>\n </li>\n }\n </ul>\n </div>\n }\n\n <!-- Toolbar: custom toolbar template + search. Only rendered when it has content,\n so an unsearchable table without toolbar templates emits no empty spacer. -->\n@if (isSearchable || dataSource.toolbarLeftTemplate || dataSource.toolbarRightTemplate || (hasColumnFilters && filtersCollapsed)) {\n <div class=\"flex flex-col @min-[420px]:flex-row @min-[420px]:items-center justify-between gap-2 mb-3\">\n <!-- The left slot only when it has content: an empty one still took a flex gap, which\n pushed the search 8px in from the page edge. ml-auto keeps the search on the right. -->\n @if (dataSource.toolbarLeftTemplate) {\n <div class=\"flex items-center gap-2 w-full @min-[420px]:w-auto\">\n <div class=\"flex flex-col w-full @min-[420px]:w-auto @min-[420px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"dataSource.toolbarLeftTemplate\"></ng-container>\n </div>\n </div>\n }\n <div\n class=\"flex flex-col @min-[420px]:flex-row @min-[420px]:items-center gap-2 w-full @min-[420px]:flex-1 @min-[420px]:ml-auto @min-[560px]:flex-none @min-[560px]:w-auto\">\n @if (isSearchable) {\n <!-- Enter must not submit a surrounding form: the search box belongs to the\n table's chrome, not to whatever form the table happens to sit in. -->\n <mn-lib-input-field\n (keydown.enter)=\"$event.preventDefault()\"\n class=\"w-full @min-[420px]:flex-1 @min-[560px]:flex-none @min-[560px]:min-w-64\"\n [props]=\"{\n id: 'mn-table-search',\n type: 'search',\n label: '',\n ariaLabel: searchPlaceholderLabel,\n placeholder: searchPlaceholderLabel,\n size: 'sm',\n borderRadius: 'md',\n fullWidth: true\n }\"\n [ngModel]=\"searchValue\"\n (ngModelChange)=\"onSearch($event)\"\n ></mn-lib-input-field>\n }\n @if (dataSource.toolbarRightTemplate) {\n <div class=\"flex flex-col w-full @min-[420px]:w-auto @min-[420px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"dataSource.toolbarRightTemplate\"></ng-container>\n </div>\n }\n <!-- Small-screen filter toggle: replaces the inline per-column filter row below 640px -->\n @if (hasColumnFilters && filtersCollapsed) {\n <button\n type=\"button\"\n mnButton\n [data]=\"{ variant: 'outline', color: 'primary', size: 'md', borderRadius: 'md', hover: true }\"\n class=\"w-full @min-[420px]:w-auto gap-1.5\"\n [attr.aria-expanded]=\"filtersPanelOpen\"\n aria-controls=\"mn-table-filters-panel\"\n (click)=\"openFiltersPanel()\"\n >\n <svg [lucideIcon]=\"icons.Funnel\" [size]=\"15\"></svg>\n <span>{{ filtersButtonLabel }}</span>\n </button>\n }\n </div>\n</div>\n}\n\n<!-- Small-screen filters: full-width fields decoupled from column widths, presented\n as a bottom sheet so they overlay rather than push the table down. -->\n@if (hasColumnFilters && filtersCollapsed && filtersPanelOpen) {\n <mn-bottom-sheet\n #filtersSheet\n (dismiss)=\"filtersPanelOpen = false\"\n [ariaLabel]=\"filtersButtonLabel\"\n [growWithKeyboard]=\"true\"\n [maxHeightVh]=\"80\"\n >\n <div id=\"mn-table-filters-panel\" class=\"flex flex-col gap-3 px-4 pb-4\">\n <span class=\"text-base font-semibold text-base-content\">{{ filtersButtonLabel }}</span>\n @for (column of dataSource.columns; track column.key) {\n @if (column.filterable) {\n <div class=\"flex flex-col gap-1\">\n <label\n class=\"text-xs font-medium text-base-content/70\"\n [attr.for]=\"'mn-table-filter-panel-' + column.key\"\n >\n @if (isTemplateRef(column.header)) {\n <ng-container [ngTemplateOutlet]=\"$any(column.header)\"></ng-container>\n } @else {\n {{ headerText(column) }}\n }\n </label>\n <ng-container\n [ngTemplateOutletContext]=\"{ $implicit: column, idScope: 'panel' }\"\n [ngTemplateOutlet]=\"filterField\"\n ></ng-container>\n </div>\n }\n }\n @if (hasActiveFilters) {\n <button\n type=\"button\"\n mnButton\n [data]=\"{ variant: 'text', color: 'gray', size: 'sm', borderRadius: 'md', hover: true }\"\n class=\"self-start gap-1\"\n (click)=\"clearAllFilters()\"\n >\n <svg [lucideIcon]=\"icons.X\" [size]=\"14\"></svg>\n <span>{{ clearFiltersButtonLabel }}</span>\n </button>\n }\n <div class=\"mt-1 flex min-[400px]:justify-end\">\n <button\n type=\"button\"\n mnButton\n [data]=\"{ variant: 'fill', color: 'primary', size: 'md', borderRadius: 'md', hover: true }\"\n class=\"w-full min-[400px]:w-auto\"\n (click)=\"closeFiltersPanel()\"\n >\n <span>{{ filtersCloseLabel }}</span>\n </button>\n </div>\n </div>\n </mn-bottom-sheet>\n}\n\n<!-- Announces loading. The skeletons are aria-hidden, so without this a screen reader hears\n nothing while rows load. The region stays in the DOM and only its text changes, which is\n what makes assistive tech read it; one inserted with its text already set is often missed. -->\n<span class=\"sr-only\" role=\"status\">{{ isLoadingState ? loadingLabel : '' }}</span>\n\n<!-- Table wrapper with horizontal scroll -->\n <div #collectionBody [attr.aria-busy]=\"isLoadingState || null\" [attr.aria-label]=\"tableRegionLabel\" [style.min-height.px]=\"bodyMinHeight\"\n class=\"overflow-x-auto\"\n role=\"region\">\n <table [class]=\"tableClasses\">\n <thead>\n <tr class=\"bg-base-100\">\n <!-- Selection column header. It always carries a screen-reader-only name: a single-select\n table has nothing else in this cell, and a multi-select one only a checkbox, so\n without it the column is announced as a nameless header (axe empty-table-header). -->\n @if (hasSelection) {\n <th class=\"w-10 text-center text-sm px-2 py-2\">\n <span class=\"sr-only\">{{ selectionColumnLabel }}</span>\n @if (isMultiSelect) {\n <mn-lib-checkbox\n (checkedChange)=\"toggleAll()\"\n [checked]=\"allSelected\"\n [props]=\"{ id: 'mn-table-select-all', size: 'sm' }\"\n ></mn-lib-checkbox>\n }\n </th>\n }\n\n <!-- Data columns -->\n @for (column of dataSource.columns; track column.key) {\n <th\n [attr.data-column-key]=\"column.key\"\n [class.truncate]=\"widthsArePinned\"\n [class.cursor-pointer]=\"isSortable(column)\"\n [class.select-none]=\"isSortable(column)\"\n [class.hover:bg-base-200]=\"isSortable(column)\"\n [class.text-left]=\"(column.align ?? 'left') === 'left'\"\n [class.text-center]=\"column.align === 'center'\"\n [class.text-right]=\"column.align === 'right'\"\n [mnHiddenBelow]=\"column.hiddenBelow\"\n [style.width]=\"columnWidth(column)\"\n [attr.aria-sort]=\"currentSort?.columnKey === column.key ? (currentSort!.direction === 'asc' ? 'ascending' : 'descending') : null\"\n class=\"text-sm px-2 py-1 @min-[640px]:px-4 @min-[640px]:py-2 whitespace-nowrap\"\n (click)=\"sort(column)\"\n >\n <!-- The header content is declared once; a sortable column wraps it in a real button so\n the sort is reachable by keyboard. The button's click stops there, so the th's own\n click (which keeps the cell padding clickable) does not sort a second time. -->\n <ng-template #headerContent>\n @if (isTemplateRef(column.header)) {\n <ng-container [ngTemplateOutlet]=\"$any(column.header)\"></ng-container>\n } @else {\n <span>{{ headerText(column) }}</span>\n }\n @if (isSortable(column)) {\n <span class=\"text-[0.65rem] opacity-70 min-w-3 inline-block\" aria-hidden=\"true\">{{ getSortIcon(column) }}</span>\n }\n </ng-template>\n @if (isSortable(column)) {\n <button type=\"button\" class=\"inline-flex items-center gap-1 cursor-pointer\" (click)=\"$event.stopPropagation(); sort(column)\">\n <ng-container [ngTemplateOutlet]=\"headerContent\"></ng-container>\n </button>\n } @else {\n <span class=\"inline-flex items-center gap-1\">\n <ng-container [ngTemplateOutlet]=\"headerContent\"></ng-container>\n </span>\n }\n </th>\n }\n\n </tr>\n\n <!-- Per-column filter row (wide screens only; collapses into a panel below 640px).\n The cells are `td`, not `th`: they hold form controls, not headings, and a\n column without a filter would otherwise be an empty header, which assistive tech\n announces as a nameless column (axe `empty-table-header`). `font-normal` stays\n so a consumer's thead styling cannot make the controls bold. -->\n @if (hasColumnFilters && !filtersCollapsed) {\n <tr class=\"bg-base-100 border-b border-base-300 font-normal\">\n @if (hasSelection) {\n <td class=\"px-2 py-1 font-normal\"></td>\n }\n @for (column of dataSource.columns; track column.key) {\n <td\n class=\"px-4 py-2 font-normal\"\n [mnHiddenBelow]=\"column.hiddenBelow\"\n >\n @if (column.filterable) {\n <!-- Every filter renders as an ordinary control right under its\n header. The rich types used to hide behind a button that opened\n a floating panel, which cost a click to discover, a click to\n apply, and hid whether a column was even filterable. -->\n <ng-container\n [ngTemplateOutletContext]=\"{ $implicit: column, idScope: 'inline' }\"\n [ngTemplateOutlet]=\"filterField\"\n ></ng-container>\n }\n </td>\n }\n </tr>\n }\n </thead>\n\n <tbody>\n <!-- Loading state -->\n @if (isLoadingState) {\n @for (_ of skeletonRows; track $index) {\n <tr>\n @if (hasSelection) {\n <td class=\"px-2 py-3\">\n <mn-skeleton [data]=\"{ shape: 'rectangle', width: '1rem', height: '1rem' }\"></mn-skeleton>\n </td>\n }\n @for (column of dataSource.columns; track column.key) {\n <td class=\"px-4 py-3\"\n [mnHiddenBelow]=\"column.hiddenBelow\"\n [style.width]=\"columnWidth(column)\"\n >\n @if (isTemplateRef(column.skeleton)) {\n <ng-container [ngTemplateOutlet]=\"$any(column.skeleton)\"></ng-container>\n } @else {\n <mn-skeleton [data]=\"getColumnSkeletonData(column)\"></mn-skeleton>\n }\n </td>\n }\n </tr>\n }\n } @else if (isErrorState) {\n <!-- Error state -->\n <tr class=\"bg-base-100\">\n <td [attr.colspan]=\"totalColumnCount\" class=\"text-center text-xs py-8\">\n @if (dataSource.errorTemplate) {\n <ng-container [ngTemplateOutlet]=\"dataSource.errorTemplate\"></ng-container>\n } @else {\n <div class=\"flex flex-col items-center gap-2 text-error\">\n <p class=\"text-sm\">{{ dataSource.errorMessage }}</p>\n </div>\n }\n </td>\n </tr>\n } @else {\n <!-- Empty state -->\n @if (filteredItems.length === 0) {\n <tr class=\"bg-base-100\">\n <td [attr.colspan]=\"totalColumnCount\" class=\"text-center text-xs py-8\">\n @if (dataSource.emptyTemplate) {\n <ng-container [ngTemplateOutlet]=\"dataSource.emptyTemplate\"></ng-container>\n } @else {\n <!-- The same look as a section's empty state, so a page with both reads as one:\n a faint icon over a medium line in the consumer's muted text colour. -->\n <div class=\"flex flex-col items-center gap-3 py-16 text-(--color-base-content-muted,color-mix(in_oklab,var(--color-base-content)_65%,transparent))\">\n @if (dataSource.emptyIcon !== null) {\n <svg [lucideIcon]=\"dataSource.emptyIcon ?? defaultEmptyIcon\" [size]=\"26\" class=\"opacity-30\"></svg>\n }\n <p class=\"text-base font-medium\">{{ dataSource.emptyMessage }}</p>\n </div>\n }\n </td>\n </tr>\n }\n\n <!-- Data rows -->\n @for (row of paginatedItems; track trackByID($index, row); let odd = $odd; let last = $last) {\n <!-- The wash and the pointer promise that a click does something, so only a clickable row gets them. -->\n <tr\n class=\"bg-base-100 transition-colors duration-150 border-b border-base-300\"\n [ngClass]=\"{'bg-primary/10': isSelected(row)}\"\n [class.bg-base-200]=\"!isSelected(row) && odd && dataSource.appearance?.striped\"\n [class.hover:bg-base-200]=\"rowsClickable && dataSource.appearance?.hover !== false\"\n [class.cursor-pointer]=\"rowsClickable\"\n (click)=\"onRowClick(row)\"\n >\n <!-- Selection checkbox -->\n @if (hasSelection) {\n <td (click)=\"$event.stopPropagation()\" class=\"w-10 text-center px-2 py-2\">\n <mn-lib-checkbox\n (checkedChange)=\"toggle(row)\"\n [checked]=\"isSelected(row)\"\n [props]=\"{ id: 'mn-table-row-' + $index, size: 'sm' }\"\n ></mn-lib-checkbox>\n </td>\n }\n\n <!-- Data cells -->\n @for (column of dataSource.columns; track column.key) {\n <td\n [attr.title]=\"cellTitle(column, row)\"\n [class.text-left]=\"(column.align ?? 'left') === 'left'\"\n [class.text-center]=\"column.align === 'center'\"\n [class.text-right]=\"column.align === 'right'\"\n [class.truncate]=\"widthsArePinned\"\n [mnHiddenBelow]=\"column.hiddenBelow\"\n [style.width]=\"columnWidth(column)\"\n class=\"text-xs px-2 py-1 @min-[640px]:px-4 @min-[640px]:py-2\"\n >\n @if (column.actions) {\n <!-- Actions column: inline command buttons that collapse into a \u22EF menu\n once the table is narrower than 450px (container query), for every\n row with actions. A row with no visible actions renders nothing.\n A row with a single icon-only action never collapses: one icon button\n is narrower than the \u22EF trigger it would hide behind, so folding it\n only costs a tap. -->\n @if (hasRowActions(column, row)) {\n <div class=\"inline-flex items-center gap-1\"\n [class.justify-end]=\"(column.align ?? 'left') === 'right'\">\n @if (collapsesRowActions(column, row)) {\n <span class=\"hidden items-center gap-1 @min-[450px]:inline-flex\">\n <ng-container [ngTemplateOutletContext]=\"{ column: column, row: row }\"\n [ngTemplateOutlet]=\"actionButtons\"></ng-container>\n </span>\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events,@angular-eslint/template/interactive-supports-focus -->\n <span class=\"@min-[450px]:hidden\" (click)=\"$event.stopPropagation()\">\n <mn-lib-dropdown [datasource]=\"{\n id: actionsDropdownId(column, row),\n actions: rowDropdownActions(column, row),\n menuLabel: headerText(column),\n size: 'sm'\n }\"></mn-lib-dropdown>\n </span>\n } @else {\n <span class=\"inline-flex items-center gap-1\">\n <ng-container [ngTemplateOutletContext]=\"{ column: column, row: row }\"\n [ngTemplateOutlet]=\"actionButtons\"></ng-container>\n </span>\n }\n </div>\n }\n } @else if (column.cellSm) {\n <!-- Default cell: hidden below the cellSm breakpoint -->\n <span [mnShowAbove]=\"column.cellSm.below\">\n @if (isTemplateRef(column.cell)) {\n <ng-container [ngTemplateOutletContext]=\"{ $implicit: row, data: row }\"\n [ngTemplateOutlet]=\"$any(column.cell)\"></ng-container>\n } @else {\n {{ getCellValue(column, row) }}\n }\n </span>\n <!-- Small cell: shown only below the cellSm breakpoint -->\n <span [mnShowBelow]=\"column.cellSm.below\">\n @if (isTemplateRef(column.cellSm.cell)) {\n <ng-container [ngTemplateOutletContext]=\"{ $implicit: row, data: row }\"\n [ngTemplateOutlet]=\"$any(column.cellSm.cell)\"></ng-container>\n } @else {\n {{ getCellSmValue(column, row) }}\n }\n </span>\n } @else {\n @if (isTemplateRef(column.cell)) {\n <ng-container [ngTemplateOutletContext]=\"{ $implicit: row, data: row }\"\n [ngTemplateOutlet]=\"$any(column.cell)\"></ng-container>\n } @else {\n {{ getCellValue(column, row) }}\n }\n }\n </td>\n }\n\n </tr>\n }\n }\n </tbody>\n </table>\n</div>\n\n<!-- Load more + pagination -->\n<mn-collection-pagination\n (loadMore)=\"loadMoreRows()\"\n (pageChange)=\"goToPage($event)\"\n (pageSizeChange)=\"onPageSizeChange($event)\"\n [currentPage]=\"currentPage\"\n [isPaginated]=\"isPaginated\"\n [isServerPaginated]=\"isServerPaginated\"\n [labels]=\"dataSource.labels\"\n [loadingMoreRows]=\"loadingMoreRows\"\n [pageSizeSelectOptions]=\"pageSizeSelectOptions\"\n [pageSize]=\"pageSize\"\n [showLoadMore]=\"showLoadMore\"\n [totalItemCount]=\"totalItemCount\"\n [totalPages]=\"totalPages\"\n [visiblePages]=\"visiblePages\"\n idPrefix=\"mn-table\"\n></mn-collection-pagination>\n</div>\n\n<!-- Single source of truth for every filter control, reused by the inline header\n row and the small-screen panel. `idScope` keeps element ids unique across\n both placements. -->\n<ng-template #filterField let-column let-idScope=\"idScope\">\n @switch (filterTypeOf(column)) {\n @case ('select') {\n <mn-lib-select\n (ngModelChange)=\"onColumnFilter(column, $event)\"\n [disabled]=\"column.filterDisabled ?? false\"\n [ngModel]=\"textFilterValue(column)\"\n [props]=\"{\n id: 'mn-table-filter-' + idScope + '-' + column.key,\n ariaLabel: filterLabel(column),\n options: getFilterSelectOptions(column),\n placeholder: filterAllLabel(column),\n size: 'sm',\n fullWidth: true\n }\"\n ></mn-lib-select>\n }\n @case ('multi-select') {\n <mn-lib-multi-select\n (ngModelChange)=\"onColumnFilter(column, $event)\"\n [disabled]=\"column.filterDisabled ?? false\"\n [ngModel]=\"multiFilterValue(column)\"\n [props]=\"{\n id: 'mn-table-filter-' + idScope + '-' + column.key,\n ariaLabel: filterLabel(column),\n options: getFilterMultiSelectOptions(column),\n placeholder: column.filterPlaceholder ?? '',\n collapsePlaceholder: filterSelectedLabel,\n collapseThreshold: 1,\n size: 'sm',\n fullWidth: true\n }\"\n ></mn-lib-multi-select>\n }\n @case ('boolean') {\n <mn-lib-select\n (ngModelChange)=\"onBooleanFilter(column, $event)\"\n [disabled]=\"column.filterDisabled ?? false\"\n [ngModel]=\"booleanFilterValue(column)\"\n [props]=\"{\n id: 'mn-table-filter-' + idScope + '-' + column.key,\n ariaLabel: filterLabel(column),\n options: getBooleanFilterOptions(column),\n size: 'sm',\n fullWidth: true\n }\"\n ></mn-lib-select>\n }\n @default {\n <mn-lib-input-field\n (keydown.enter)=\"$event.preventDefault()\"\n (ngModelChange)=\"onColumnFilter(column, $event)\"\n [disabled]=\"column.filterDisabled ?? false\"\n [ngModel]=\"textFilterValue(column)\"\n [props]=\"{\n id: 'mn-table-filter-' + idScope + '-' + column.key,\n type: 'text',\n label: '',\n placeholder: column.filterPlaceholder ?? '',\n ariaLabel: column.filterPlaceholder ?? '',\n autocomplete: column.filterAutocomplete ?? undefined,\n size: 'sm',\n borderRadius: 'md',\n fullWidth: true,\n hover: true\n }\"\n ></mn-lib-input-field>\n }\n }\n</ng-template>\n\n<!-- Inline action buttons for an actions column, shared by the wide-table layout and\n (implicitly) mirrored by the \u22EF menu below 450px. -->\n<ng-template #actionButtons let-column=\"column\" let-row=\"row\">\n <!-- A placeholder (a hidden keepSlot action) is the same button, invisible and inert:\n it holds the column so the actions after it line up with the rows above. -->\n @for (slot of inlineRowActions(column, row); track $index) {\n @let action = slot.action;\n <button\n mnButton\n type=\"button\"\n [data]=\"{\n size: 'sm',\n variant: 'text',\n color: rowActionColor(action, row),\n disabled: isRowActionDisabled(action, row) || slot.placeholder\n }\"\n class=\"cursor-pointer\"\n [class.invisible]=\"slot.placeholder\"\n [attr.inert]=\"slot.placeholder ? '' : null\"\n [attr.aria-hidden]=\"slot.placeholder ? 'true' : null\"\n (click)=\"$event.stopPropagation(); slot.placeholder || runRowAction(action, row)\"\n [attr.aria-label]=\"rowActionLabel(action, row)\"\n [attr.title]=\"showActionLabel(column, action, row) ? null : rowActionLabel(action, row)\"\n >\n @if (showActionIcon(column, action, row)) {\n <span class=\"inline-flex items-center shrink-0\">\n @let icon = rowActionIcon(action, row);\n @if (isTemplateRef(icon)) {\n <ng-container [ngTemplateOutlet]=\"icon\"></ng-container>\n } @else {\n <!-- Data icon: sized here to match the sm button's text, so a caller can\n declare the action in TypeScript without owning a template. -->\n <svg [lucideIcon]=\"$any(icon)\" [size]=\"17\"></svg>\n }\n </span>\n }\n @if (showActionLabel(column, action, row)) {\n <span>{{ rowActionLabel(action, row) }}</span>\n }\n </button>\n }\n</ng-template>\n" }]
2402
+ args: [{ selector: 'mn-table', standalone: true, imports: [NgClass, NgTemplateOutlet, MnCheckbox, MnHiddenBelowDirective, MnShowAboveDirective, MnShowBelowDirective, MnInputField, MnSelect, MnMultiSelect, MnDropdown, MnSkeleton, FormsModule, MnCollectionPagination, MnButton, MnBottomSheet, LucideDynamicIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'block' }, template: "<!-- Everything that reflows lives inside a @container, so the breakpoints below\n measure the table's own width rather than the window's. A table in a modal,\n a sidebar or a narrow grid cell is far narrower than the viewport, and\n viewport breakpoints would hand it a desktop layout it has no room for. -->\n<div class=\"@container\">\n <!-- Selection summary: the whole selection, never paged, filtered or sorted. The\n table below answers \"what could I pick?\", which is why it is searched and paged;\n this answers \"what did I pick?\", which a paginated list cannot without hiding\n most of the answer on some other page. -->\n @if (showSelectionSummary) {\n <div class=\"flex flex-col gap-2 rounded-md border border-base-300 bg-base-200/50 p-3 mb-3\">\n <div class=\"flex items-center justify-between gap-2\">\n <span class=\"text-sm font-medium text-base-content\">{{ selectionSummaryTitle }}</span>\n <button\n (click)=\"clearSelection()\"\n [data]=\"{ variant: 'text', color: 'gray', size: 'sm', borderRadius: 'md', hover: true }\"\n class=\"gap-1 shrink-0\"\n mnButton\n type=\"button\"\n >\n <svg [size]=\"14\" [lucideIcon]=\"icons.X\"></svg>\n <span>{{ selectionClearAllLabel }}</span>\n </button>\n </div>\n <!-- Only the first few tags render; the rest collapse behind a \"+N more\" control.\n The heading's count always states the true total, so this hides tags, never\n information. Expanded, the list is height-capped and scrolls, so even a\n selection of hundreds cannot push the table off screen. -->\n <ul\n [class.max-h-28]=\"selectionSummaryExpanded\"\n [class.overflow-y-auto]=\"selectionSummaryExpanded\"\n class=\"flex flex-wrap gap-1.5 list-none m-0 p-0\"\n >\n @for (row of visibleSelectionRows; track dataSource.getID(row)) {\n <li\n class=\"inline-flex items-center gap-1 rounded-full bg-base-100 border border-base-300 pl-2.5 pr-1 py-0.5 text-xs text-base-content max-w-full\">\n <span [attr.title]=\"selectionLabelFor(row)\" class=\"truncate\">{{ selectionLabelFor(row) }}</span>\n <button\n (click)=\"removeSelection(row)\"\n [attr.aria-label]=\"selectionRemoveLabel(row)\"\n class=\"shrink-0 rounded-full p-0.5 hover:bg-base-300 transition-colors cursor-pointer\"\n type=\"button\"\n >\n <svg [size]=\"12\" [lucideIcon]=\"icons.X\"></svg>\n </button>\n </li>\n }\n @if (hiddenSelectionCount > 0 || selectionSummaryExpanded) {\n <li>\n <button\n (click)=\"toggleSelectionSummary()\"\n [attr.aria-expanded]=\"selectionSummaryExpanded\"\n [data]=\"{ variant: 'text', color: 'primary', size: 'sm', borderRadius: 'md', hover: true }\"\n class=\"text-xs\"\n mnButton\n type=\"button\"\n >\n {{ selectionSummaryToggleLabel }}\n </button>\n </li>\n }\n </ul>\n </div>\n }\n\n <!-- Toolbar: custom toolbar template + search. Only rendered when it has content,\n so an unsearchable table without toolbar templates emits no empty spacer. -->\n@if (isSearchable || dataSource.toolbarLeftTemplate || dataSource.toolbarRightTemplate || showsFilterButton) {\n <div class=\"flex flex-col @min-[420px]:flex-row @min-[420px]:items-center justify-between gap-2 mb-3\">\n <!-- The left slot only when it has content: an empty one still took a flex gap, which\n pushed the search 8px in from the page edge. ml-auto keeps the search on the right. -->\n @if (dataSource.toolbarLeftTemplate) {\n <div class=\"flex items-center gap-2 w-full @min-[420px]:w-auto\">\n <div class=\"flex flex-col w-full @min-[420px]:w-auto @min-[420px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"dataSource.toolbarLeftTemplate\"></ng-container>\n </div>\n </div>\n }\n <div\n class=\"flex flex-col @min-[420px]:flex-row @min-[420px]:items-center gap-2 w-full @min-[420px]:flex-1 @min-[420px]:ml-auto @min-[560px]:flex-none @min-[560px]:w-auto\">\n <!-- Search and the filter button share one row: two full-width bars stacked above the\n first row pushed the content a whole screen down on a phone. -->\n @if (isSearchable || showsFilterButton) {\n <div class=\"flex items-center gap-2 w-full @min-[420px]:flex-1 @min-[560px]:flex-none\">\n @if (isSearchable) {\n <!-- Enter must not submit a surrounding form: the search box belongs to the\n table's chrome, not to whatever form the table happens to sit in. -->\n <mn-lib-input-field\n (keydown.enter)=\"$event.preventDefault()\"\n class=\"min-w-0 flex-1 @min-[560px]:flex-none @min-[560px]:min-w-64\"\n [props]=\"{\n id: 'mn-table-search',\n type: 'search',\n label: '',\n ariaLabel: searchPlaceholderLabel,\n placeholder: searchPlaceholderLabel,\n size: 'sm',\n borderRadius: 'md',\n fullWidth: true\n }\"\n [ngModel]=\"searchValue\"\n (ngModelChange)=\"onSearch($event)\"\n ></mn-lib-input-field>\n }\n <!-- Below 640px the header row with its sort buttons and the inline filter row are\n gone; this one button opens both, with a count while filters are set. -->\n @if (showsFilterButton) {\n <button\n type=\"button\"\n mnButton\n [data]=\"{ variant: 'outline', color: 'primary', size: 'md', borderRadius: 'md', hover: true }\"\n class=\"shrink-0 gap-1.5 px-2.5\"\n [class.ml-auto]=\"!isSearchable\"\n [attr.aria-label]=\"filtersButtonAriaLabel\"\n [attr.title]=\"filterSheetLabel\"\n [attr.aria-expanded]=\"filtersPanelOpen\"\n aria-controls=\"mn-table-filters-panel\"\n (click)=\"openFiltersPanel()\"\n >\n <svg [lucideIcon]=\"icons.Funnel\" [size]=\"17\"></svg>\n <!-- The count sits inside the button: a badge hanging off its corner reached past the\n table's right edge and gave a container that clips or scrolls a sideways scroll. -->\n @if (activeFilterCount > 0) {\n <span class=\"text-sm font-semibold leading-none tabular-nums\" aria-hidden=\"true\">{{ activeFilterCount }}</span>\n }\n </button>\n }\n </div>\n }\n @if (dataSource.toolbarRightTemplate) {\n <div class=\"flex flex-col w-full @min-[420px]:w-auto @min-[420px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"dataSource.toolbarRightTemplate\"></ng-container>\n </div>\n }\n </div>\n</div>\n}\n\n<!-- Small-screen filters: full-width fields decoupled from column widths, presented\n as a bottom sheet so they overlay rather than push the table down. -->\n@if (showsFilterButton && filtersPanelOpen) {\n <mn-bottom-sheet\n #filtersSheet\n (dismiss)=\"filtersPanelOpen = false\"\n [ariaLabel]=\"filterSheetLabel\"\n [growWithKeyboard]=\"true\"\n [maxHeightVh]=\"80\"\n >\n <div id=\"mn-table-filters-panel\" class=\"flex flex-col gap-3 px-4 pb-4\">\n <span class=\"text-base font-semibold text-base-content\">{{ filterSheetLabel }}</span>\n <!-- Sorting lives here below 640px: the header row whose buttons sorted is not rendered.\n The choices are inline radios, not a select: a select opens its own bottom sheet on a\n phone, which stacked a second sheet on this one and cut its list off. One row per\n column, the direction as a separate switch once a column is picked. -->\n @if (sortableColumns.length > 0) {\n <fieldset class=\"m-0 flex flex-col gap-2 border-0 p-0\">\n <legend\n class=\"mb-1 p-0 text-xs font-medium text-base-content/70\"\n [class.sr-only]=\"!hasColumnFilters\"\n >{{ sortByLabel }}</legend>\n <div class=\"flex flex-col\">\n <label class=\"flex min-h-11 cursor-pointer items-center gap-3 text-sm text-base-content\">\n <input\n type=\"radio\"\n class=\"size-[1.125rem] shrink-0 cursor-pointer appearance-none rounded-full border-2 border-base-content/40 bg-base-100 transition-[border] checked:border-[0.3125rem] checked:border-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary\"\n [name]=\"sortGroupName\"\n value=\"\"\n [checked]=\"!currentSort\"\n (change)=\"onSortColumn('')\"\n />\n <span>{{ sortDefaultLabel }}</span>\n </label>\n @for (column of sortableColumns; track column.key) {\n <!-- The chosen column carries its own direction button at the row's end: it sits\n inside a row that is already there, so picking a column never grows the sheet,\n and no greyed-out switch shows while the default order is chosen. -->\n <div class=\"flex min-h-11 items-center gap-2\">\n <label class=\"flex min-w-0 flex-1 cursor-pointer items-center gap-3 self-stretch text-sm text-base-content\">\n <input\n type=\"radio\"\n class=\"size-[1.125rem] shrink-0 cursor-pointer appearance-none rounded-full border-2 border-base-content/40 bg-base-100 transition-[border] checked:border-[0.3125rem] checked:border-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary\"\n [name]=\"sortGroupName\"\n [value]=\"column.key\"\n [checked]=\"currentSort?.columnKey === column.key\"\n (change)=\"onSortColumn(column.key)\"\n />\n <span class=\"truncate\">{{ headerText(column) || column.key }}</span>\n </label>\n @if (currentSort?.columnKey === column.key) {\n <button\n type=\"button\"\n mnButton\n [data]=\"{ variant: 'outline', color: 'primary', size: 'sm', borderRadius: 'md', hover: true }\"\n class=\"shrink-0 gap-1.5\"\n [attr.aria-label]=\"sortDirectionButtonLabel\"\n (click)=\"toggleSortDirection()\"\n >\n <svg [lucideIcon]=\"currentSort?.direction === 'desc' ? icons.ArrowDown : icons.ArrowUp\" [size]=\"15\"></svg>\n <span>{{ sortDirectionLabel }}</span>\n </button>\n }\n </div>\n }\n </div>\n </fieldset>\n @if (hasColumnFilters) {\n <div class=\"border-t border-base-300\" aria-hidden=\"true\"></div>\n }\n }\n @for (column of dataSource.columns; track column.key) {\n @if (column.filterable) {\n <div class=\"flex flex-col gap-1\">\n <label\n class=\"text-xs font-medium text-base-content/70\"\n [attr.for]=\"'mn-table-filter-panel-' + column.key\"\n >\n @if (isTemplateRef(column.header)) {\n <ng-container [ngTemplateOutlet]=\"$any(column.header)\"></ng-container>\n } @else {\n {{ headerText(column) }}\n }\n </label>\n <!-- The field template is declared outside the sheet, so it would inject from there;\n this injector tells its selects they are in a sheet (no second sheet on top). -->\n <ng-container\n [ngTemplateOutletContext]=\"{ $implicit: column, idScope: 'panel' }\"\n [ngTemplateOutletInjector]=\"inSheetInjector\"\n [ngTemplateOutlet]=\"filterField\"\n ></ng-container>\n </div>\n }\n }\n @if (hasActiveFilters) {\n <button\n type=\"button\"\n mnButton\n [data]=\"{ variant: 'text', color: 'gray', size: 'sm', borderRadius: 'md', hover: true }\"\n class=\"self-start gap-1\"\n (click)=\"clearAllFilters()\"\n >\n <svg [lucideIcon]=\"icons.X\" [size]=\"14\"></svg>\n <span>{{ clearFiltersButtonLabel }}</span>\n </button>\n }\n <div class=\"mt-1 flex min-[400px]:justify-end\">\n <button\n type=\"button\"\n mnButton\n [data]=\"{ variant: 'fill', color: 'primary', size: 'md', borderRadius: 'md', hover: true }\"\n class=\"w-full min-[400px]:w-auto\"\n (click)=\"closeFiltersPanel()\"\n >\n <span>{{ filtersCloseLabel }}</span>\n </button>\n </div>\n </div>\n </mn-bottom-sheet>\n}\n\n<!-- Detail sheet (below 640px): the whole record of one row \u2014 title and right-side value as the\n heading, every other column as a label/value list, then the actions. It is the only place a\n column the composed row could not show, or an action, is reachable on a phone. -->\n@if (detailRow !== null) {\n @let row = detailRow;\n <mn-bottom-sheet\n #detailSheet\n (dismiss)=\"onDetailDismissed()\"\n [ariaLabel]=\"rowLabel(row)\"\n [maxHeightVh]=\"85\"\n >\n <!-- Escape closes it: the sheet itself only handles the backdrop and the drag. Focus is\n moved inside on open, so the key arrives here by bubbling. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div class=\"flex flex-col gap-4 px-4 pb-4\" (keydown.escape)=\"closeDetail()\">\n <div class=\"flex items-start gap-3\">\n <h2\n #detailHeading\n class=\"m-0 min-w-0 flex-1 text-lg font-semibold leading-snug text-base-content outline-none [overflow-wrap:anywhere]\"\n tabindex=\"-1\"\n >\n @if (rowLayout.title; as title) {\n <ng-container [ngTemplateOutlet]=\"fullCell\" [ngTemplateOutletContext]=\"{ $implicit: title, row: row }\"></ng-container>\n }\n </h2>\n @if (rowLayout.trailing; as trailing) {\n <span class=\"shrink-0 text-lg font-semibold tabular-nums text-base-content\">\n <ng-container [ngTemplateOutlet]=\"fullCell\" [ngTemplateOutletContext]=\"{ $implicit: trailing, row: row }\"></ng-container>\n </span>\n }\n </div>\n @if (detailColumns.length > 0) {\n <dl class=\"m-0 grid grid-cols-[minmax(0,8rem)_minmax(0,1fr)] gap-x-3 gap-y-2.5 border-t border-base-300 pt-4 text-sm\">\n @for (column of detailColumns; track column.key) {\n <dt class=\"text-(--color-base-content-muted,color-mix(in_oklab,var(--color-base-content)_65%,transparent))\">\n @if (isTemplateRef(column.header)) {\n <ng-container [ngTemplateOutlet]=\"$any(column.header)\"></ng-container>\n } @else {\n {{ headerText(column) }}\n }\n </dt>\n <dd class=\"m-0 min-w-0 text-base-content [overflow-wrap:anywhere]\">\n <ng-container [ngTemplateOutlet]=\"fullCell\" [ngTemplateOutletContext]=\"{ $implicit: column, row: row }\"></ng-container>\n </dd>\n }\n </dl>\n }\n @if (rowHasAnyActions(row)) {\n <div class=\"flex flex-col gap-2 border-t border-base-300 pt-4\">\n @for (column of rowLayout.actions; track column.key) {\n @for (action of visibleRowActions(column, row); track $index) {\n <button\n mnButton\n type=\"button\"\n [data]=\"{\n variant: 'outline',\n color: rowActionColor(action, row),\n size: 'md',\n borderRadius: 'md',\n hover: true,\n disabled: isRowActionDisabled(action, row)\n }\"\n class=\"w-full gap-2\"\n [attr.aria-disabled]=\"isRowActionDisabled(action, row) || null\"\n (click)=\"runDetailAction(action, row)\"\n >\n @let icon = rowActionIcon(action, row);\n @if (icon) {\n <span class=\"inline-flex shrink-0 items-center\">\n @if (isTemplateRef(icon)) {\n <ng-container [ngTemplateOutlet]=\"icon\"></ng-container>\n } @else {\n <svg [lucideIcon]=\"$any(icon)\" [size]=\"17\"></svg>\n }\n </span>\n }\n <span>{{ rowActionLabel(action, row) }}</span>\n </button>\n }\n }\n </div>\n }\n </div>\n </mn-bottom-sheet>\n}\n\n<!-- Announces loading. The skeletons are aria-hidden, so without this a screen reader hears\n nothing while rows load. The region stays in the DOM and only its text changes, which is\n what makes assistive tech read it; one inserted with its text already set is often missed. -->\n<span class=\"sr-only\" role=\"status\">{{ isLoadingState ? loadingLabel : '' }}</span>\n\n<!-- Table wrapper with horizontal scroll -->\n <div #collectionBody [attr.aria-busy]=\"isLoadingState || null\" [attr.aria-label]=\"tableRegionLabel\" [style.min-height.px]=\"bodyMinHeight\"\n class=\"overflow-x-auto\"\n role=\"region\">\n @if (rowMode) {\n <!-- Below 640px every row is a composed line (see resolveRowLayout): the columns that\n would not fit as cells become a title, a second line and a value on the right, and\n the rest waits in the detail sheet a tap opens. A list, not a table: there are no\n columns left for a screen reader to navigate. -->\n <ul class=\"m-0 list-none p-0\">\n @if (isLoadingState) {\n @for (_ of skeletonRows; track $index) {\n <li aria-hidden=\"true\" class=\"flex items-center gap-3 border-b border-base-300 bg-base-100 px-2 py-3\">\n <div class=\"flex flex-1 flex-col gap-2\">\n <mn-skeleton [data]=\"{ shape: 'text', width: '60%' }\"></mn-skeleton>\n <mn-skeleton [data]=\"{ shape: 'text', width: '40%', height: '0.75rem' }\"></mn-skeleton>\n </div>\n </li>\n }\n } @else if (isErrorState) {\n <li class=\"bg-base-100 py-8 text-center text-xs\">\n <ng-container [ngTemplateOutlet]=\"errorContent\"></ng-container>\n </li>\n } @else {\n @if (filteredItems.length === 0) {\n <li class=\"bg-base-100 text-center text-xs\">\n <ng-container [ngTemplateOutlet]=\"emptyContent\"></ng-container>\n </li>\n }\n @for (row of paginatedItems; track trackByID($index, row)) {\n @let tap = rowTap(row);\n <li\n class=\"flex items-stretch border-b border-base-300 bg-base-100\"\n [ngClass]=\"{ 'bg-primary/10': isSelected(row) }\"\n >\n @if (hasSelection) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events,@angular-eslint/template/interactive-supports-focus -->\n <div class=\"flex shrink-0 items-center pl-2\" (click)=\"$event.stopPropagation()\">\n <mn-lib-checkbox\n (checkedChange)=\"toggle(row)\"\n [checked]=\"isSelected(row)\"\n [props]=\"{ id: 'mn-table-row-' + $index, size: 'sm' }\"\n ></mn-lib-checkbox>\n </div>\n }\n @if (tap === 'detail' || tap === 'click') {\n <button\n type=\"button\"\n class=\"flex min-w-0 flex-1 cursor-pointer items-start gap-3 px-2 py-3 text-left transition-colors duration-150 hover:bg-base-200 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary\"\n [attr.aria-haspopup]=\"tap === 'detail' ? 'dialog' : null\"\n (click)=\"onRowTap(row, $event)\"\n >\n <ng-container [ngTemplateOutlet]=\"rowBody\" [ngTemplateOutletContext]=\"{ $implicit: row, chevron: true }\"></ng-container>\n </button>\n } @else {\n <!-- A selection row toggles on a click anywhere, as the wide table's row does; the\n checkbox is its keyboard control, so this area needs no focus of its own. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events,@angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"flex min-w-0 flex-1 items-start gap-3 px-2 py-3\"\n [class.cursor-pointer]=\"tap === 'select'\"\n (click)=\"tap === 'select' && onRowClick(row)\"\n >\n <ng-container [ngTemplateOutlet]=\"rowBody\" [ngTemplateOutletContext]=\"{ $implicit: row, chevron: false }\"></ng-container>\n </div>\n }\n @if (showsRowMore(row)) {\n <button\n type=\"button\"\n class=\"flex w-11 shrink-0 cursor-pointer items-center justify-center text-base-content/70 transition-colors hover:bg-base-200 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"rowDetailsLabel(row)\"\n (click)=\"openDetail(row, $any($event.currentTarget))\"\n >\n <svg [lucideIcon]=\"icons.Ellipsis\" [size]=\"18\"></svg>\n </button>\n }\n @if (showsRowMenu(row)) {\n @for (column of rowLayout.actions; track column.key) {\n @if (hasRowActions(column, row)) {\n <div class=\"flex shrink-0 items-center pr-1\">\n <mn-lib-dropdown [datasource]=\"{\n id: actionsDropdownId(column, row),\n actions: rowDropdownActions(column, row),\n menuLabel: headerText(column),\n size: 'sm'\n }\"></mn-lib-dropdown>\n </div>\n }\n }\n }\n </li>\n }\n }\n </ul>\n } @else {\n <table [class]=\"tableClasses\">\n <thead>\n <tr class=\"bg-base-100\">\n <!-- Selection column header. It always carries a screen-reader-only name: a single-select\n table has nothing else in this cell, and a multi-select one only a checkbox, so\n without it the column is announced as a nameless header (axe empty-table-header). -->\n @if (hasSelection) {\n <th class=\"w-10 text-center text-sm px-2 py-2\">\n <span class=\"sr-only\">{{ selectionColumnLabel }}</span>\n @if (isMultiSelect) {\n <mn-lib-checkbox\n (checkedChange)=\"toggleAll()\"\n [checked]=\"allSelected\"\n [props]=\"{ id: 'mn-table-select-all', size: 'sm' }\"\n ></mn-lib-checkbox>\n }\n </th>\n }\n\n <!-- Data columns -->\n @for (column of dataSource.columns; track column.key) {\n <th\n [attr.data-column-key]=\"column.key\"\n [class.truncate]=\"widthsArePinned\"\n [class.cursor-pointer]=\"isSortable(column)\"\n [class.select-none]=\"isSortable(column)\"\n [class.hover:bg-base-200]=\"isSortable(column)\"\n [class.text-left]=\"(column.align ?? 'left') === 'left'\"\n [class.text-center]=\"column.align === 'center'\"\n [class.text-right]=\"column.align === 'right'\"\n [mnHiddenBelow]=\"column.hiddenBelow\"\n [style.width]=\"columnWidth(column)\"\n [attr.aria-sort]=\"currentSort?.columnKey === column.key ? (currentSort!.direction === 'asc' ? 'ascending' : 'descending') : null\"\n class=\"text-sm px-2 py-1 @min-[640px]:px-4 @min-[640px]:py-2 whitespace-nowrap\"\n (click)=\"sort(column)\"\n >\n <!-- The header content is declared once; a sortable column wraps it in a real button so\n the sort is reachable by keyboard. The button's click stops there, so the th's own\n click (which keeps the cell padding clickable) does not sort a second time. -->\n <ng-template #headerContent>\n @if (isTemplateRef(column.header)) {\n <ng-container [ngTemplateOutlet]=\"$any(column.header)\"></ng-container>\n } @else {\n <span>{{ headerText(column) }}</span>\n }\n @if (isSortable(column)) {\n <span class=\"text-[0.65rem] opacity-70 min-w-3 inline-block\" aria-hidden=\"true\">{{ getSortIcon(column) }}</span>\n }\n </ng-template>\n @if (isSortable(column)) {\n <button type=\"button\" class=\"inline-flex items-center gap-1 cursor-pointer\" (click)=\"$event.stopPropagation(); sort(column)\">\n <ng-container [ngTemplateOutlet]=\"headerContent\"></ng-container>\n </button>\n } @else {\n <span class=\"inline-flex items-center gap-1\">\n <ng-container [ngTemplateOutlet]=\"headerContent\"></ng-container>\n </span>\n }\n </th>\n }\n\n </tr>\n\n <!-- Per-column filter row (wide screens only; collapses into a panel below 640px).\n The cells are `td`, not `th`: they hold form controls, not headings, and a\n column without a filter would otherwise be an empty header, which assistive tech\n announces as a nameless column (axe `empty-table-header`). `font-normal` stays\n so a consumer's thead styling cannot make the controls bold. -->\n @if (hasColumnFilters && !filtersCollapsed) {\n <tr class=\"bg-base-100 border-b border-base-300 font-normal\">\n @if (hasSelection) {\n <td class=\"px-2 py-1 font-normal\"></td>\n }\n @for (column of dataSource.columns; track column.key) {\n <td\n class=\"px-4 py-2 font-normal\"\n [mnHiddenBelow]=\"column.hiddenBelow\"\n >\n @if (column.filterable) {\n <!-- Every filter renders as an ordinary control right under its\n header. The rich types used to hide behind a button that opened\n a floating panel, which cost a click to discover, a click to\n apply, and hid whether a column was even filterable. -->\n <ng-container\n [ngTemplateOutletContext]=\"{ $implicit: column, idScope: 'inline' }\"\n [ngTemplateOutlet]=\"filterField\"\n ></ng-container>\n }\n </td>\n }\n </tr>\n }\n </thead>\n\n <tbody>\n <!-- Loading state -->\n @if (isLoadingState) {\n @for (_ of skeletonRows; track $index) {\n <tr>\n @if (hasSelection) {\n <td class=\"px-2 py-3\">\n <mn-skeleton [data]=\"{ shape: 'rectangle', width: '1rem', height: '1rem' }\"></mn-skeleton>\n </td>\n }\n @for (column of dataSource.columns; track column.key) {\n <td class=\"px-4 py-3\"\n [mnHiddenBelow]=\"column.hiddenBelow\"\n [style.width]=\"columnWidth(column)\"\n >\n @if (isTemplateRef(column.skeleton)) {\n <ng-container [ngTemplateOutlet]=\"$any(column.skeleton)\"></ng-container>\n } @else {\n <mn-skeleton [data]=\"getColumnSkeletonData(column)\"></mn-skeleton>\n }\n </td>\n }\n </tr>\n }\n } @else if (isErrorState) {\n <!-- Error state -->\n <tr class=\"bg-base-100\">\n <td [attr.colspan]=\"totalColumnCount\" class=\"text-center text-xs py-8\">\n <ng-container [ngTemplateOutlet]=\"errorContent\"></ng-container>\n </td>\n </tr>\n } @else {\n <!-- Empty state -->\n @if (filteredItems.length === 0) {\n <tr class=\"bg-base-100\">\n <td [attr.colspan]=\"totalColumnCount\" class=\"text-center text-xs py-8\">\n <ng-container [ngTemplateOutlet]=\"emptyContent\"></ng-container>\n </td>\n </tr>\n }\n\n <!-- Data rows -->\n @for (row of paginatedItems; track trackByID($index, row); let odd = $odd; let last = $last) {\n <!-- The wash and the pointer promise that a click does something, so only a clickable row gets them. -->\n <tr\n class=\"bg-base-100 transition-colors duration-150 border-b border-base-300\"\n [ngClass]=\"{'bg-primary/10': isSelected(row)}\"\n [class.bg-base-200]=\"!isSelected(row) && odd && dataSource.appearance?.striped\"\n [class.hover:bg-base-200]=\"rowsClickable && dataSource.appearance?.hover !== false\"\n [class.cursor-pointer]=\"rowsClickable\"\n (click)=\"onRowClick(row)\"\n >\n <!-- Selection checkbox -->\n @if (hasSelection) {\n <td (click)=\"$event.stopPropagation()\" class=\"w-10 text-center px-2 py-2\">\n <mn-lib-checkbox\n (checkedChange)=\"toggle(row)\"\n [checked]=\"isSelected(row)\"\n [props]=\"{ id: 'mn-table-row-' + $index, size: 'sm' }\"\n ></mn-lib-checkbox>\n </td>\n }\n\n <!-- Data cells -->\n @for (column of dataSource.columns; track column.key) {\n <td\n [attr.title]=\"cellTitle(column, row)\"\n [class.text-left]=\"(column.align ?? 'left') === 'left'\"\n [class.text-center]=\"column.align === 'center'\"\n [class.text-right]=\"column.align === 'right'\"\n [class.truncate]=\"widthsArePinned\"\n [mnHiddenBelow]=\"column.hiddenBelow\"\n [style.width]=\"columnWidth(column)\"\n class=\"text-xs px-2 py-1 @min-[640px]:px-4 @min-[640px]:py-2\"\n >\n @if (column.actions) {\n <!-- Actions column: inline command buttons. The grid only renders at 640px\n and wider, where they fit; below that the actions move into the row's\n detail sheet. A row with no visible actions renders nothing. -->\n @if (hasRowActions(column, row)) {\n <div class=\"inline-flex items-center gap-1\"\n [class.justify-end]=\"(column.align ?? 'left') === 'right'\">\n <span class=\"inline-flex items-center gap-1\">\n <ng-container [ngTemplateOutletContext]=\"{ column: column, row: row }\"\n [ngTemplateOutlet]=\"actionButtons\"></ng-container>\n </span>\n </div>\n }\n } @else if (column.cellSm) {\n <!-- Default cell: hidden below the cellSm breakpoint -->\n <span [mnShowAbove]=\"column.cellSm.below\">\n @if (isTemplateRef(column.cell)) {\n <ng-container [ngTemplateOutletContext]=\"{ $implicit: row, data: row }\"\n [ngTemplateOutlet]=\"$any(column.cell)\"></ng-container>\n } @else {\n {{ getCellValue(column, row) }}\n }\n </span>\n <!-- Small cell: shown only below the cellSm breakpoint -->\n <span [mnShowBelow]=\"column.cellSm.below\">\n @if (isTemplateRef(column.cellSm.cell)) {\n <ng-container [ngTemplateOutletContext]=\"{ $implicit: row, data: row }\"\n [ngTemplateOutlet]=\"$any(column.cellSm.cell)\"></ng-container>\n } @else {\n {{ getCellSmValue(column, row) }}\n }\n </span>\n } @else {\n @if (isTemplateRef(column.cell)) {\n <ng-container [ngTemplateOutletContext]=\"{ $implicit: row, data: row }\"\n [ngTemplateOutlet]=\"$any(column.cell)\"></ng-container>\n } @else {\n {{ getCellValue(column, row) }}\n }\n }\n </td>\n }\n\n </tr>\n }\n }\n </tbody>\n </table>\n }\n</div>\n\n<!-- Load more + pagination -->\n<mn-collection-pagination\n (loadMore)=\"loadMoreRows()\"\n (pageChange)=\"goToPage($event)\"\n (pageSizeChange)=\"onPageSizeChange($event)\"\n [currentPage]=\"currentPage\"\n [isPaginated]=\"isPaginated\"\n [isServerPaginated]=\"isServerPaginated\"\n [labels]=\"dataSource.labels\"\n [loadingMoreRows]=\"loadingMoreRows\"\n [pageSizeSelectOptions]=\"pageSizeSelectOptions\"\n [pageSize]=\"pageSize\"\n [showLoadMore]=\"showLoadMore\"\n [totalItemCount]=\"totalItemCount\"\n [totalPages]=\"totalPages\"\n [visiblePages]=\"visiblePages\"\n idPrefix=\"mn-table\"\n></mn-collection-pagination>\n</div>\n\n<!-- Single source of truth for every filter control, reused by the inline header\n row and the small-screen panel. `idScope` keeps element ids unique across\n both placements. -->\n<ng-template #filterField let-column let-idScope=\"idScope\">\n @switch (filterTypeOf(column)) {\n @case ('select') {\n <mn-lib-select\n (ngModelChange)=\"onColumnFilter(column, $event)\"\n [disabled]=\"column.filterDisabled ?? false\"\n [ngModel]=\"textFilterValue(column)\"\n [props]=\"{\n id: 'mn-table-filter-' + idScope + '-' + column.key,\n ariaLabel: filterLabel(column),\n options: getFilterSelectOptions(column),\n placeholder: filterAllLabel(column),\n size: 'sm',\n fullWidth: true\n }\"\n ></mn-lib-select>\n }\n @case ('multi-select') {\n <mn-lib-multi-select\n (ngModelChange)=\"onColumnFilter(column, $event)\"\n [disabled]=\"column.filterDisabled ?? false\"\n [ngModel]=\"multiFilterValue(column)\"\n [props]=\"{\n id: 'mn-table-filter-' + idScope + '-' + column.key,\n ariaLabel: filterLabel(column),\n options: getFilterMultiSelectOptions(column),\n placeholder: column.filterPlaceholder ?? '',\n collapsePlaceholder: filterSelectedLabel,\n collapseThreshold: 1,\n size: 'sm',\n fullWidth: true\n }\"\n ></mn-lib-multi-select>\n }\n @case ('boolean') {\n <mn-lib-select\n (ngModelChange)=\"onBooleanFilter(column, $event)\"\n [disabled]=\"column.filterDisabled ?? false\"\n [ngModel]=\"booleanFilterValue(column)\"\n [props]=\"{\n id: 'mn-table-filter-' + idScope + '-' + column.key,\n ariaLabel: filterLabel(column),\n options: getBooleanFilterOptions(column),\n size: 'sm',\n fullWidth: true\n }\"\n ></mn-lib-select>\n }\n @default {\n <mn-lib-input-field\n (keydown.enter)=\"$event.preventDefault()\"\n (ngModelChange)=\"onColumnFilter(column, $event)\"\n [disabled]=\"column.filterDisabled ?? false\"\n [ngModel]=\"textFilterValue(column)\"\n [props]=\"{\n id: 'mn-table-filter-' + idScope + '-' + column.key,\n type: 'text',\n label: '',\n placeholder: column.filterPlaceholder ?? '',\n ariaLabel: column.filterPlaceholder ?? '',\n autocomplete: column.filterAutocomplete ?? undefined,\n size: 'sm',\n borderRadius: 'md',\n fullWidth: true,\n hover: true\n }\"\n ></mn-lib-input-field>\n }\n }\n</ng-template>\n\n<!-- One composed row (below 640px): the leading block, the title (two lines at most) over the\n second line, the right-side value, and a chevron when a tap opens something. The slots\n come from rowLayout; a column renders its cellSm form here when it has one. -->\n<ng-template #rowBody let-row let-chevron=\"chevron\">\n @let layout = rowLayout;\n @if (layout.leading; as leading) {\n <span class=\"flex h-8 min-w-8 shrink-0 items-center justify-center rounded-md bg-primary/10 px-1.5 text-sm font-semibold tabular-nums text-primary\">\n <ng-container [ngTemplateOutlet]=\"rowCell\" [ngTemplateOutletContext]=\"{ $implicit: leading, row: row }\"></ng-container>\n </span>\n }\n <span class=\"flex min-w-0 flex-1 flex-col gap-1\">\n @if (layout.title; as title) {\n <span class=\"line-clamp-2 text-sm font-semibold leading-snug text-base-content [overflow-wrap:anywhere]\">\n <ng-container [ngTemplateOutlet]=\"rowCell\" [ngTemplateOutletContext]=\"{ $implicit: title, row: row }\"></ng-container>\n </span>\n }\n @if (layout.meta.length > 0) {\n <span class=\"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-(--color-base-content-muted,color-mix(in_oklab,var(--color-base-content)_65%,transparent))\">\n @for (column of layout.meta; track column.key) {\n <span class=\"min-w-0 max-w-full truncate\">\n <ng-container [ngTemplateOutlet]=\"rowCell\" [ngTemplateOutletContext]=\"{ $implicit: column, row: row, meta: true }\"></ng-container>\n </span>\n }\n </span>\n }\n </span>\n @if (layout.trailing; as trailing) {\n <span class=\"max-w-[40%] shrink-0 text-right text-sm font-semibold tabular-nums text-base-content\">\n <ng-container [ngTemplateOutlet]=\"rowCell\" [ngTemplateOutletContext]=\"{ $implicit: trailing, row: row }\"></ng-container>\n </span>\n }\n @if (chevron) {\n <svg [lucideIcon]=\"icons.ChevronRight\" [size]=\"16\" aria-hidden=\"true\" class=\"mt-0.5 shrink-0 opacity-50\"></svg>\n }\n</ng-template>\n\n<!-- A cell as a composed row shows it: cellSm first, a bare figure on the second line with its\n column name in front. -->\n<ng-template #rowCell let-column let-row=\"row\" let-meta=\"meta\">\n @let template = rowCellTemplate(column);\n @if (template) {\n <ng-container [ngTemplateOutletContext]=\"{ $implicit: row, data: row }\" [ngTemplateOutlet]=\"template\"></ng-container>\n } @else {\n {{ meta ? rowMetaText(column, row) : rowCellText(column, row) }}\n }\n</ng-template>\n\n<!-- A cell in full, as the wide table shows it: the detail sheet is where the long form belongs. -->\n<ng-template #fullCell let-column let-row=\"row\">\n @if (isTemplateRef(column.cell)) {\n <ng-container [ngTemplateOutletContext]=\"{ $implicit: row, data: row }\" [ngTemplateOutlet]=\"$any(column.cell)\"></ng-container>\n } @else {\n {{ getCellValue(column, row) }}\n }\n</ng-template>\n\n<!-- Empty and error content, shared by the grid and the composed rows. -->\n<ng-template #emptyContent>\n @if (dataSource.emptyTemplate) {\n <ng-container [ngTemplateOutlet]=\"dataSource.emptyTemplate\"></ng-container>\n } @else {\n <!-- The same look as a section's empty state, so a page with both reads as one:\n a faint icon over a medium line in the consumer's muted text colour. -->\n <div class=\"flex flex-col items-center gap-3 py-16 text-(--color-base-content-muted,color-mix(in_oklab,var(--color-base-content)_65%,transparent))\">\n @if (dataSource.emptyIcon !== null) {\n <svg [lucideIcon]=\"dataSource.emptyIcon ?? defaultEmptyIcon\" [size]=\"26\" class=\"opacity-30\"></svg>\n }\n <p class=\"text-base font-medium\">{{ dataSource.emptyMessage }}</p>\n </div>\n }\n</ng-template>\n\n<ng-template #errorContent>\n @if (dataSource.errorTemplate) {\n <ng-container [ngTemplateOutlet]=\"dataSource.errorTemplate\"></ng-container>\n } @else {\n <div class=\"flex flex-col items-center gap-2 text-error\">\n <p class=\"text-sm\">{{ dataSource.errorMessage }}</p>\n </div>\n }\n</ng-template>\n\n<!-- Inline action buttons for an actions column on the wide table. Below 640px the same\n actions render in the detail sheet (or a modal's \u22EF menu). -->\n<ng-template #actionButtons let-column=\"column\" let-row=\"row\">\n <!-- A placeholder (a hidden keepSlot action) is the same button, invisible and inert:\n it holds the column so the actions after it line up with the rows above. -->\n @for (slot of inlineRowActions(column, row); track $index) {\n @let action = slot.action;\n <button\n mnButton\n type=\"button\"\n [data]=\"{\n size: 'sm',\n variant: 'text',\n color: rowActionColor(action, row),\n disabled: isRowActionDisabled(action, row) || slot.placeholder\n }\"\n class=\"cursor-pointer\"\n [class.invisible]=\"slot.placeholder\"\n [attr.inert]=\"slot.placeholder ? '' : null\"\n [attr.aria-hidden]=\"slot.placeholder ? 'true' : null\"\n (click)=\"$event.stopPropagation(); slot.placeholder || runRowAction(action, row)\"\n [attr.aria-label]=\"rowActionLabel(action, row)\"\n [attr.title]=\"showActionLabel(column, action, row) ? null : rowActionLabel(action, row)\"\n >\n @if (showActionIcon(column, action, row)) {\n <span class=\"inline-flex items-center shrink-0\">\n @let icon = rowActionIcon(action, row);\n @if (isTemplateRef(icon)) {\n <ng-container [ngTemplateOutlet]=\"icon\"></ng-container>\n } @else {\n <!-- Data icon: sized here to match the sm button's text, so a caller can\n declare the action in TypeScript without owning a template. -->\n <svg [lucideIcon]=\"$any(icon)\" [size]=\"17\"></svg>\n }\n </span>\n }\n @if (showActionLabel(column, action, row)) {\n <span>{{ rowActionLabel(action, row) }}</span>\n }\n </button>\n }\n</ng-template>\n" }]
2042
2403
  }], ctorParameters: () => [], propDecorators: { sortChange: [{
2043
2404
  type: Output
2044
2405
  }], rowClick: [{
@@ -2046,6 +2407,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
2046
2407
  }], filtersSheet: [{
2047
2408
  type: ViewChild,
2048
2409
  args: ['filtersSheet']
2410
+ }], detailSheet: [{
2411
+ type: ViewChild,
2412
+ args: ['detailSheet']
2413
+ }], detailHeading: [{
2414
+ type: ViewChild,
2415
+ args: ['detailHeading']
2049
2416
  }], collectionBody: [{
2050
2417
  type: ViewChild,
2051
2418
  args: ['collectionBody']
@@ -2320,5 +2687,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
2320
2687
  * Generated bundle index. Do not edit.
2321
2688
  */
2322
2689
 
2323
- export { ColumnSortType, MnCollectionBase, MnCollectionPagination, MnCollectionState, MnGrid, MnHiddenBelowDirective, MnList, MnSelectableCollectionBase, MnShowAboveDirective, MnShowBelowDirective, MnTable, defaultFilterPredicate, emptyFilterValue, isFilterValueActive, matchesColumnFilter, resolveFilterableValue };
2690
+ export { ColumnSortType, MnCollectionBase, MnCollectionPagination, MnCollectionState, MnGrid, MnHiddenBelowDirective, MnList, MnSelectableCollectionBase, MnShowAboveDirective, MnShowBelowDirective, MnTable, ROW_META_LIMIT, defaultFilterPredicate, emptyFilterValue, isFilterValueActive, matchesColumnFilter, resolveFilterableValue, resolveRowLayout };
2324
2691
  //# sourceMappingURL=mn-angular-lib-collection.mjs.map