mn-angular-lib 2.0.23 → 2.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/mn-angular-lib-bottom-sheet.mjs +3 -2
- package/fesm2022/mn-angular-lib-bottom-sheet.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-collection.mjs +432 -26
- package/fesm2022/mn-angular-lib-collection.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-core.mjs +21 -1
- package/fesm2022/mn-angular-lib-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-forms.mjs +51 -15
- package/fesm2022/mn-angular-lib-forms.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal-ui.mjs +3 -3
- package/fesm2022/mn-angular-lib-modal-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/mn-angular-lib-collection.d.ts +232 -16
- package/types/mn-angular-lib-core.d.ts +15 -1
- package/types/mn-angular-lib-forms.d.ts +36 -12
|
@@ -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,
|
|
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({
|
|
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 string cell with nothing to say: blank, or a lone dash (hyphen, en or em dash). */
|
|
1285
|
+
const EMPTY_VALUE = /^\s*[-–—]?\s*$/;
|
|
1185
1286
|
class MnTable extends MnSelectableCollectionBase {
|
|
1186
1287
|
/** Lucide icons the template renders. */
|
|
1187
1288
|
icons = ICONS;
|
|
@@ -1202,6 +1303,312 @@ 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
|
+
/**
|
|
1400
|
+
* Whether a row needs its own ⋯ button for the sheet, because a tap already does something
|
|
1401
|
+
* else. A row that opens the consumer's own detail (`onRowClick`) gets one only for actions:
|
|
1402
|
+
* a sheet with nothing but the same record next to that detail was two views of one row.
|
|
1403
|
+
*/
|
|
1404
|
+
showsRowMore(row) {
|
|
1405
|
+
const tap = this.rowTap(row);
|
|
1406
|
+
if (tap === 'click')
|
|
1407
|
+
return !this.inModal && this.rowHasAnyActions(row);
|
|
1408
|
+
return tap === 'select' && this.rowHasDetail(row);
|
|
1409
|
+
}
|
|
1410
|
+
/** Whether a row shows its actions as a ⋯ menu: inside a modal, where there is no sheet. */
|
|
1411
|
+
showsRowMenu(row) {
|
|
1412
|
+
return this.inModal && this.rowHasAnyActions(row);
|
|
1413
|
+
}
|
|
1414
|
+
/** Handles a tap on a composed row's main area. */
|
|
1415
|
+
onRowTap(row, event) {
|
|
1416
|
+
if (this.rowTap(row) === 'detail') {
|
|
1417
|
+
this.openDetail(row, event.currentTarget);
|
|
1418
|
+
}
|
|
1419
|
+
else {
|
|
1420
|
+
this.onRowClick(row);
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
/**
|
|
1424
|
+
* Opens the detail sheet for a row and moves focus to its heading.
|
|
1425
|
+
* @param row The row.
|
|
1426
|
+
* @param trigger The control that opened it, which gets focus back on close.
|
|
1427
|
+
*/
|
|
1428
|
+
openDetail(row, trigger = null) {
|
|
1429
|
+
this.detailRow = row;
|
|
1430
|
+
this.detailTrigger = trigger;
|
|
1431
|
+
this.cdr.markForCheck();
|
|
1432
|
+
afterNextRender(() => this.detailHeading?.nativeElement.focus(), { injector: this.injector });
|
|
1433
|
+
}
|
|
1434
|
+
/** Plays the detail sheet's exit, then unmounts it. */
|
|
1435
|
+
async closeDetail() {
|
|
1436
|
+
await this.detailSheet?.startClosing();
|
|
1437
|
+
this.onDetailDismissed();
|
|
1438
|
+
}
|
|
1439
|
+
/** Clears the detail sheet once it is gone and returns focus to the control that opened it. */
|
|
1440
|
+
onDetailDismissed() {
|
|
1441
|
+
if (this.detailRow === null)
|
|
1442
|
+
return;
|
|
1443
|
+
this.detailRow = null;
|
|
1444
|
+
const trigger = this.detailTrigger;
|
|
1445
|
+
this.detailTrigger = null;
|
|
1446
|
+
this.cdr.markForCheck();
|
|
1447
|
+
trigger?.focus();
|
|
1448
|
+
}
|
|
1449
|
+
/**
|
|
1450
|
+
* Runs an action from the detail sheet. The sheet closes first, so an action that opens a
|
|
1451
|
+
* modal or navigates does not do so underneath it.
|
|
1452
|
+
*/
|
|
1453
|
+
async runDetailAction(action, row) {
|
|
1454
|
+
if (this.isRowActionDisabled(action, row))
|
|
1455
|
+
return;
|
|
1456
|
+
await this.closeDetail();
|
|
1457
|
+
action.run(row);
|
|
1458
|
+
}
|
|
1459
|
+
/**
|
|
1460
|
+
* The text a composed row shows for a string column: the full cell. Not `cellSm` — that is the
|
|
1461
|
+
* short form an app wrote for a squeezed grid column (an e-mail cut to ten characters, a status
|
|
1462
|
+
* reduced to an icon), and a composed row has the room the grid column lacked.
|
|
1463
|
+
*/
|
|
1464
|
+
rowCellText(column, row) {
|
|
1465
|
+
return this.getCellValue(column, row);
|
|
1466
|
+
}
|
|
1467
|
+
/** The template a composed row renders for a column; null for a string column. */
|
|
1468
|
+
rowCellTemplate(column) {
|
|
1469
|
+
return this.isTemplateRef(column.cell) ? column.cell : null;
|
|
1470
|
+
}
|
|
1471
|
+
/**
|
|
1472
|
+
* Whether a string cell is empty for this row: blank, or the lone dash an app writes for
|
|
1473
|
+
* "nothing". Such a value is left off the composed row ("Beschrijving -" said nothing); the
|
|
1474
|
+
* sheet still lists it. A template cell is never judged empty — its markup is the app's.
|
|
1475
|
+
*/
|
|
1476
|
+
rowValueEmpty(column, row) {
|
|
1477
|
+
if (this.rowCellTemplate(column))
|
|
1478
|
+
return false;
|
|
1479
|
+
return EMPTY_VALUE.test(this.rowCellText(column, row));
|
|
1480
|
+
}
|
|
1481
|
+
/** The second-line columns that have something to show for this row. */
|
|
1482
|
+
rowMeta(row) {
|
|
1483
|
+
return this.rowLayout.meta.filter(column => !this.rowValueEmpty(column, row));
|
|
1484
|
+
}
|
|
1485
|
+
/**
|
|
1486
|
+
* The column name a composed row shows beside a second-line or right-side value: with no
|
|
1487
|
+
* header row, "Lid", "1-12-2023" or "535" alone does not say what it is. Empty for a template
|
|
1488
|
+
* cell — a badge or an icon carries its own meaning, and its markup is the app's.
|
|
1489
|
+
*/
|
|
1490
|
+
rowSlotLabel(column) {
|
|
1491
|
+
// Templated values (an amount, a score) are labelled too: the label sits above them,
|
|
1492
|
+
// clear of the app's markup.
|
|
1493
|
+
return this.headerText(column);
|
|
1494
|
+
}
|
|
1495
|
+
/** A row's name as text, for accessible names: its title cell, else the selection label. */
|
|
1496
|
+
rowLabel(row) {
|
|
1497
|
+
const title = this.rowLayout.title;
|
|
1498
|
+
const text = title ? this.getCellValue(title, row) : '';
|
|
1499
|
+
return text || this.defaultSelectionLabel(row) || '';
|
|
1500
|
+
}
|
|
1501
|
+
/** Accessible name of a row's ⋯ button. */
|
|
1502
|
+
rowDetailsLabel(row) {
|
|
1503
|
+
return this.resolveLabel(undefined, 'mnCollection.rowDetails', 'Details for {{label}}')
|
|
1504
|
+
.replace('{{label}}', this.rowLabel(row));
|
|
1505
|
+
}
|
|
1506
|
+
/** Columns a person can sort by, offered in the filter sheet once the header row is gone. */
|
|
1507
|
+
get sortableColumns() {
|
|
1508
|
+
return this.dataSource.columns.filter(c => this.isSortable(c));
|
|
1509
|
+
}
|
|
1510
|
+
/**
|
|
1511
|
+
* Whether the toolbar shows the filter button: below 640px, when there is a filter to set or
|
|
1512
|
+
* a sort to choose — the header row that held both is gone there. Not over an empty or
|
|
1513
|
+
* one-row list, where there is nothing to narrow or order, unless a filter or sort is
|
|
1514
|
+
* already set (then the button is how to undo it).
|
|
1515
|
+
*/
|
|
1516
|
+
get showsFilterButton() {
|
|
1517
|
+
if (!this.filtersCollapsed || !(this.hasColumnFilters || this.sortableColumns.length > 0))
|
|
1518
|
+
return false;
|
|
1519
|
+
return this.totalItemCount > 1 || this.activeFilterCount > 0 || !!this.currentSort;
|
|
1520
|
+
}
|
|
1521
|
+
/**
|
|
1522
|
+
* Whether the search field shows: as always on a wide table, but below 640px not over an empty
|
|
1523
|
+
* or one-row list (there is nothing to find), unless a search is already typed or rows are
|
|
1524
|
+
* still loading.
|
|
1525
|
+
*/
|
|
1526
|
+
get showsSearch() {
|
|
1527
|
+
if (!this.isSearchable)
|
|
1528
|
+
return false;
|
|
1529
|
+
if (!this.rowMode)
|
|
1530
|
+
return true;
|
|
1531
|
+
return this.isLoadingState || this.totalItemCount > 1 || !!this.searchValue;
|
|
1532
|
+
}
|
|
1533
|
+
/**
|
|
1534
|
+
* Whether the pagination strip shows. Below 640px not for a single page: "Page 1 of 1" under
|
|
1535
|
+
* an empty or short list is chrome with nothing to do. Above it the strip stays as it was.
|
|
1536
|
+
*/
|
|
1537
|
+
get showsPagination() {
|
|
1538
|
+
return !this.rowMode || this.totalPages > 1 || this.showLoadMore;
|
|
1539
|
+
}
|
|
1540
|
+
/** How many column filters are set, shown as a count on the filter button. */
|
|
1541
|
+
get activeFilterCount() {
|
|
1542
|
+
return this.activeColumnFilters.length;
|
|
1543
|
+
}
|
|
1544
|
+
/**
|
|
1545
|
+
* Title of the small-screen sheet and its button: "Filters" when there is something to filter,
|
|
1546
|
+
* "Sort by" when the sheet only holds the sort choice — a funnel over a sheet with no filter in
|
|
1547
|
+
* it promises something the sheet does not have.
|
|
1548
|
+
*/
|
|
1549
|
+
get filterSheetLabel() {
|
|
1550
|
+
return this.hasColumnFilters ? this.filtersButtonLabel : this.sortByLabel;
|
|
1551
|
+
}
|
|
1552
|
+
/** Accessible name of the icon-only filter button, with the active count when there is one. */
|
|
1553
|
+
get filtersButtonAriaLabel() {
|
|
1554
|
+
const count = this.activeFilterCount;
|
|
1555
|
+
return count > 0 ? `${this.filterSheetLabel} (${count})` : this.filterSheetLabel;
|
|
1556
|
+
}
|
|
1557
|
+
/** Label of the sort select in the filter sheet. */
|
|
1558
|
+
get sortByLabel() {
|
|
1559
|
+
return this.resolveLabel(undefined, 'mnCollection.sortBy', 'Sort by');
|
|
1560
|
+
}
|
|
1561
|
+
/** The sort select's "no sort" option. */
|
|
1562
|
+
get sortDefaultLabel() {
|
|
1563
|
+
return this.resolveLabel(undefined, 'mnCollection.sortDefault', 'Default order');
|
|
1564
|
+
}
|
|
1565
|
+
/** The current sort direction in words, shown on the chosen column's direction button. */
|
|
1566
|
+
get sortDirectionLabel() {
|
|
1567
|
+
return this.currentSort?.direction === 'desc'
|
|
1568
|
+
? this.resolveLabel(undefined, 'mnCollection.sortDescending', 'Descending')
|
|
1569
|
+
: this.resolveLabel(undefined, 'mnCollection.sortAscending', 'Ascending');
|
|
1570
|
+
}
|
|
1571
|
+
/** Accessible name of the direction button: what it shows and that a press flips it. */
|
|
1572
|
+
get sortDirectionButtonLabel() {
|
|
1573
|
+
return this.resolveLabel(undefined, 'mnCollection.sortDirection', '{{direction}}, tap to reverse')
|
|
1574
|
+
.replace('{{direction}}', this.sortDirectionLabel);
|
|
1575
|
+
}
|
|
1576
|
+
/** Flips the current sort between ascending and descending. */
|
|
1577
|
+
toggleSortDirection() {
|
|
1578
|
+
if (!this.currentSort)
|
|
1579
|
+
return;
|
|
1580
|
+
this.onSortDirection(this.currentSort.direction === 'desc' ? 'asc' : 'desc');
|
|
1581
|
+
}
|
|
1582
|
+
/**
|
|
1583
|
+
* Sorts by a column chosen in the filter sheet, exactly as a header click would. A newly
|
|
1584
|
+
* chosen column starts ascending; re-choosing the current one keeps its direction.
|
|
1585
|
+
* @param columnKey The column, or empty for the default order.
|
|
1586
|
+
*/
|
|
1587
|
+
onSortColumn(columnKey) {
|
|
1588
|
+
if (!columnKey) {
|
|
1589
|
+
this.applySort(null);
|
|
1590
|
+
}
|
|
1591
|
+
else {
|
|
1592
|
+
const direction = this.currentSort?.columnKey === columnKey ? this.currentSort.direction : 'asc';
|
|
1593
|
+
this.applySort({ columnKey, direction });
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
/**
|
|
1597
|
+
* Flips the direction of the current sort from the sheet's switch.
|
|
1598
|
+
* @param direction The value the switch emitted.
|
|
1599
|
+
*/
|
|
1600
|
+
onSortDirection(direction) {
|
|
1601
|
+
if (!this.currentSort)
|
|
1602
|
+
return;
|
|
1603
|
+
this.applySort({ columnKey: this.currentSort.columnKey, direction: direction === 'desc' ? 'desc' : 'asc' });
|
|
1604
|
+
}
|
|
1605
|
+
/** Sets the sort, tells the consumer and re-sorts, as a header click does. */
|
|
1606
|
+
applySort(sort) {
|
|
1607
|
+
this.currentSort = sort;
|
|
1608
|
+
this.sortChange.emit(this.currentSort);
|
|
1609
|
+
this.applyFilter(false);
|
|
1610
|
+
this.cdr.markForCheck();
|
|
1611
|
+
}
|
|
1205
1612
|
componentName = 'MnTable';
|
|
1206
1613
|
get trackedToolbarTemplate() {
|
|
1207
1614
|
return this.dataSource?.toolbarLeftTemplate;
|
|
@@ -1384,8 +1791,14 @@ class MnTable extends MnSelectableCollectionBase {
|
|
|
1384
1791
|
if (collapsed === this.filtersCollapsed)
|
|
1385
1792
|
return;
|
|
1386
1793
|
this.filtersCollapsed = collapsed;
|
|
1387
|
-
if (!collapsed)
|
|
1794
|
+
if (!collapsed) {
|
|
1388
1795
|
this.filtersPanelOpen = false;
|
|
1796
|
+
// The wide table shows every column, so the detail sheet has nothing left to add.
|
|
1797
|
+
this.detailRow = null;
|
|
1798
|
+
this.detailTrigger = null;
|
|
1799
|
+
}
|
|
1800
|
+
// Composed rows and grid rows differ in height; the floor measured for one does not fit the other.
|
|
1801
|
+
this.invalidatePageHeight();
|
|
1389
1802
|
if (reflow)
|
|
1390
1803
|
this.cdr.markForCheck();
|
|
1391
1804
|
}
|
|
@@ -1490,7 +1903,7 @@ class MnTable extends MnSelectableCollectionBase {
|
|
|
1490
1903
|
// the guards below make it a no-op until real rows are on screen, and the
|
|
1491
1904
|
// pinned widths then stop it from measuring again.
|
|
1492
1905
|
afterEveryRender(() => {
|
|
1493
|
-
if (this.layoutMode !== 'stable')
|
|
1906
|
+
if (this.layoutMode !== 'stable' || this.rowMode)
|
|
1494
1907
|
return;
|
|
1495
1908
|
if (this.widthsPinned || this.isLoadingState)
|
|
1496
1909
|
return;
|
|
@@ -1754,7 +2167,7 @@ class MnTable extends MnSelectableCollectionBase {
|
|
|
1754
2167
|
return '';
|
|
1755
2168
|
}
|
|
1756
2169
|
// ── Row actions ──
|
|
1757
|
-
/** The actions visible for a given row — those whose `hidden(row)` is not true. */
|
|
2170
|
+
/** 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
2171
|
visibleRowActions(column, row) {
|
|
1759
2172
|
return (column.actions ?? []).filter(action => !(action.hidden?.(row) ?? false));
|
|
1760
2173
|
}
|
|
@@ -1772,19 +2185,6 @@ class MnTable extends MnSelectableCollectionBase {
|
|
|
1772
2185
|
hasRowActions(column, row) {
|
|
1773
2186
|
return this.visibleRowActions(column, row).length > 0;
|
|
1774
2187
|
}
|
|
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
2188
|
/**
|
|
1789
2189
|
* Resolves a {@link MnRowValue}: either the fixed value, or the accessor applied to
|
|
1790
2190
|
* the row. Every per-row presentation field goes through here so the fixed and derived
|
|
@@ -2034,11 +2434,11 @@ class MnTable extends MnSelectableCollectionBase {
|
|
|
2034
2434
|
return template.replace('{{label}}', this.selectionLabelFor(row));
|
|
2035
2435
|
}
|
|
2036
2436
|
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 });
|
|
2437
|
+
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 (showsSearch || 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 (showsSearch || showsFilterButton) {\n <div class=\"flex items-center gap-2 w-full @min-[420px]:flex-1 @min-[560px]:flex-none\">\n @if (showsSearch) {\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]=\"!showsSearch\"\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 && !rowValueEmpty(rowLayout.trailing, row)) {\n @let trailing = rowLayout.trailing;\n <span class=\"flex shrink-0 flex-col items-end gap-0.5 text-right\">\n @if (rowSlotLabel(trailing); as trailingLabel) {\n <span class=\"text-xs text-(--color-base-content-muted,color-mix(in_oklab,var(--color-base-content)_65%,transparent))\">{{ trailingLabel }}</span>\n }\n <span class=\"text-lg font-semibold tabular-nums text-base-content\">\n <ng-container [ngTemplateOutlet]=\"fullCell\" [ngTemplateOutletContext]=\"{ $implicit: trailing, row: row }\"></ng-container>\n </span>\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 <!-- An empty value or a lone dash says nothing here either (\"Beschrijving: -\"). -->\n @if (!rowValueEmpty(column, row)) {\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 }\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 (not for a single page below 640px, see showsPagination) -->\n@if (showsPagination) {\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}\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 @let meta = rowMeta(row);\n @if (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 meta; track column.key) {\n <!-- Bare values, no column names: on a 375px line a name like \"Goedgekeurd door\" took\n half the room and cut off the value it described. Only the right side is labelled. -->\n <span class=\"min-w-0 max-w-full truncate\">\n <ng-container [ngTemplateOutlet]=\"rowCell\" [ngTemplateOutletContext]=\"{ $implicit: column, row: row }\"></ng-container>\n </span>\n }\n </span>\n }\n </span>\n @if (layout.trailing; as trailing) {\n @if (!rowValueEmpty(trailing, row)) {\n <!-- The right-side value with its column name above it, small: \"1-12-2023\" or \"535\" alone\n does not say whether it is a join date or a score. One line: a date that wrapped\n (\"7 oktober 2026 om / 21:00\") doubled the row's height. Past 45% of the row the value\n is cut short with an ellipsis rather than squeezing the title into two lines. -->\n <span class=\"flex min-w-0 max-w-[45%] shrink-0 flex-col items-end gap-0.5 text-right\">\n @let trailingLabel = rowSlotLabel(trailing);\n @if (trailingLabel) {\n <span class=\"max-w-full truncate text-[0.6875rem] leading-tight text-(--color-base-content-muted,color-mix(in_oklab,var(--color-base-content)_65%,transparent))\">{{ trailingLabel }}</span>\n }\n <span class=\"max-w-full truncate whitespace-nowrap text-sm font-semibold tabular-nums text-base-content\">\n <ng-container [ngTemplateOutlet]=\"rowCell\" [ngTemplateOutletContext]=\"{ $implicit: trailing, row: row }\"></ng-container>\n </span>\n </span>\n }\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. Its column name is the caller's (rowSlotLabel). -->\n<ng-template #rowCell let-column let-row=\"row\">\n @let template = rowCellTemplate(column);\n @if (template) {\n <ng-container [ngTemplateOutletContext]=\"{ $implicit: row, data: row }\" [ngTemplateOutlet]=\"template\"></ng-container>\n } @else {\n {{ 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
2438
|
}
|
|
2039
2439
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnTable, decorators: [{
|
|
2040
2440
|
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" }]
|
|
2441
|
+
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 (showsSearch || 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 (showsSearch || showsFilterButton) {\n <div class=\"flex items-center gap-2 w-full @min-[420px]:flex-1 @min-[560px]:flex-none\">\n @if (showsSearch) {\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]=\"!showsSearch\"\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 && !rowValueEmpty(rowLayout.trailing, row)) {\n @let trailing = rowLayout.trailing;\n <span class=\"flex shrink-0 flex-col items-end gap-0.5 text-right\">\n @if (rowSlotLabel(trailing); as trailingLabel) {\n <span class=\"text-xs text-(--color-base-content-muted,color-mix(in_oklab,var(--color-base-content)_65%,transparent))\">{{ trailingLabel }}</span>\n }\n <span class=\"text-lg font-semibold tabular-nums text-base-content\">\n <ng-container [ngTemplateOutlet]=\"fullCell\" [ngTemplateOutletContext]=\"{ $implicit: trailing, row: row }\"></ng-container>\n </span>\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 <!-- An empty value or a lone dash says nothing here either (\"Beschrijving: -\"). -->\n @if (!rowValueEmpty(column, row)) {\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 }\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 (not for a single page below 640px, see showsPagination) -->\n@if (showsPagination) {\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}\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 @let meta = rowMeta(row);\n @if (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 meta; track column.key) {\n <!-- Bare values, no column names: on a 375px line a name like \"Goedgekeurd door\" took\n half the room and cut off the value it described. Only the right side is labelled. -->\n <span class=\"min-w-0 max-w-full truncate\">\n <ng-container [ngTemplateOutlet]=\"rowCell\" [ngTemplateOutletContext]=\"{ $implicit: column, row: row }\"></ng-container>\n </span>\n }\n </span>\n }\n </span>\n @if (layout.trailing; as trailing) {\n @if (!rowValueEmpty(trailing, row)) {\n <!-- The right-side value with its column name above it, small: \"1-12-2023\" or \"535\" alone\n does not say whether it is a join date or a score. One line: a date that wrapped\n (\"7 oktober 2026 om / 21:00\") doubled the row's height. Past 45% of the row the value\n is cut short with an ellipsis rather than squeezing the title into two lines. -->\n <span class=\"flex min-w-0 max-w-[45%] shrink-0 flex-col items-end gap-0.5 text-right\">\n @let trailingLabel = rowSlotLabel(trailing);\n @if (trailingLabel) {\n <span class=\"max-w-full truncate text-[0.6875rem] leading-tight text-(--color-base-content-muted,color-mix(in_oklab,var(--color-base-content)_65%,transparent))\">{{ trailingLabel }}</span>\n }\n <span class=\"max-w-full truncate whitespace-nowrap text-sm font-semibold tabular-nums text-base-content\">\n <ng-container [ngTemplateOutlet]=\"rowCell\" [ngTemplateOutletContext]=\"{ $implicit: trailing, row: row }\"></ng-container>\n </span>\n </span>\n }\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. Its column name is the caller's (rowSlotLabel). -->\n<ng-template #rowCell let-column let-row=\"row\">\n @let template = rowCellTemplate(column);\n @if (template) {\n <ng-container [ngTemplateOutletContext]=\"{ $implicit: row, data: row }\" [ngTemplateOutlet]=\"template\"></ng-container>\n } @else {\n {{ 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
2442
|
}], ctorParameters: () => [], propDecorators: { sortChange: [{
|
|
2043
2443
|
type: Output
|
|
2044
2444
|
}], rowClick: [{
|
|
@@ -2046,6 +2446,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
2046
2446
|
}], filtersSheet: [{
|
|
2047
2447
|
type: ViewChild,
|
|
2048
2448
|
args: ['filtersSheet']
|
|
2449
|
+
}], detailSheet: [{
|
|
2450
|
+
type: ViewChild,
|
|
2451
|
+
args: ['detailSheet']
|
|
2452
|
+
}], detailHeading: [{
|
|
2453
|
+
type: ViewChild,
|
|
2454
|
+
args: ['detailHeading']
|
|
2049
2455
|
}], collectionBody: [{
|
|
2050
2456
|
type: ViewChild,
|
|
2051
2457
|
args: ['collectionBody']
|
|
@@ -2126,11 +2532,11 @@ class MnList extends MnSelectableCollectionBase {
|
|
|
2126
2532
|
return this.resolveLabel(undefined, 'mnCollection.selectAll', 'Select all');
|
|
2127
2533
|
}
|
|
2128
2534
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnList, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2129
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: MnList, isStandalone: true, selector: "mn-list", outputs: { itemClick: "itemClick" }, viewQueries: [{ propertyName: "collectionBody", first: true, predicate: ["collectionBody"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<!-- Toolbar: left template, then search + right template. Below 375px each group\n takes its own full-width row; from 375px up the left group sits at the start\n and the search group at the end. Structure and classes mirror mn-table so all\n collections behave identically at every width. -->\n@if (\n isSearchable ||\n dataSource.toolbarLeftTemplate ||\n dataSource.toolbarRightTemplate ||\n dataSource.toolbarTemplate\n) {\n <div class=\"flex flex-col min-[375px]:flex-row min-[375px]:items-center justify-between gap-2 mb-3\">\n <div class=\"flex items-center gap-2 w-full min-[375px]:w-auto\">\n @if (dataSource.toolbarLeftTemplate) {\n <div class=\"flex flex-col w-full min-[375px]:w-auto min-[375px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"dataSource.toolbarLeftTemplate\"></ng-container>\n </div>\n }\n </div>\n <div\n class=\"flex flex-col min-[375px]:flex-row min-[375px]:items-center gap-2 w-full min-[375px]:flex-1 min-[480px]:flex-none min-[480px]:w-auto\">\n @if (isSearchable) {\n <!-- Enter must not submit a surrounding form: the search box is the\n collection's own chrome, not a field of whatever form it sits in. -->\n <mn-lib-input-field\n (keydown.enter)=\"$event.preventDefault()\"\n (ngModelChange)=\"onSearch($event)\"\n [ngModel]=\"searchValue\"\n [props]=\"{\n id: 'mn-list-search',\n type: 'search',\n label: '',\n ariaLabel: dataSource.searchPlaceholder ?? 'Search...',\n placeholder: dataSource.searchPlaceholder ?? 'Search...',\n size: 'sm',\n borderRadius: 'md',\n fullWidth: true\n }\"\n class=\"w-full min-[375px]:flex-1 min-[480px]:max-w-64\"\n ></mn-lib-input-field>\n }\n <!-- `toolbarTemplate` is the deprecated name for this slot; honouring it here\n keeps existing callers rendering exactly where they used to. -->\n @if (dataSource.toolbarRightTemplate ?? dataSource.toolbarTemplate; as rightTemplate) {\n <div class=\"flex flex-col w-full min-[375px]:w-auto min-[375px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"rightTemplate\"></ng-container>\n </div>\n }\n </div>\n </div>\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<!-- List wrapper -->\n<div\n #collectionBody\n [attr.aria-busy]=\"isLoadingState || null\"\n [style.min-height.px]=\"bodyMinHeight\"\n class=\"w-full\"\n [class.border]=\"dataSource.appearance?.bordered\"\n [class.border-base-300]=\"dataSource.appearance?.bordered\"\n [class.rounded]=\"dataSource.appearance?.bordered\"\n role=\"list\"\n [attr.aria-label]=\"listRegionLabel\"\n>\n <!-- Loading state -->\n @if (isLoadingState) {\n @for (_ of skeletonRows; track $index) {\n <div [class.py-2]=\"dataSource.appearance?.compact\" class=\"px-4 py-3\" role=\"listitem\">\n @if (isTemplateRef(dataSource.skeleton)) {\n <ng-container [ngTemplateOutlet]=\"$any(dataSource.skeleton)\"></ng-container>\n } @else {\n <div class=\"flex flex-col gap-1\">\n @for (line of skeletonLines; track $index) {\n <mn-skeleton [data]=\"line\"></mn-skeleton>\n }\n </div>\n }\n </div>\n @if (!$last && (dataSource.appearance?.dividers !== false)) {\n <div class=\"border-b border-base-300\"></div>\n }\n }\n } @else if (isErrorState) {\n <!-- Error state -->\n <div class=\"text-center text-xs py-8\" role=\"listitem\">\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 </div>\n } @else {\n <!-- Empty state -->\n @if (filteredItems.length === 0) {\n <div class=\"text-center text-xs py-8\" role=\"listitem\">\n @if (dataSource.emptyTemplate) {\n <ng-container [ngTemplateOutlet]=\"dataSource.emptyTemplate\"></ng-container>\n } @else {\n <!-- The same look as the table's empty state and a section's own. -->\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 </div>\n }\n\n <!-- Select all (multi-select) -->\n @if (isMultiSelect && filteredItems.length > 0) {\n <div class=\"flex items-center gap-2 px-4 py-2 bg-base-200 text-sm\">\n <mn-lib-checkbox\n (checkedChange)=\"toggleAll()\"\n [checked]=\"allSelected\"\n [props]=\"{ id: 'mn-list-select-all', label: selectAllLabel, size: 'sm' }\"\n ></mn-lib-checkbox>\n </div>\n @if (dataSource.appearance?.dividers !== false) {\n <div class=\"border-b border-base-300\"></div>\n }\n }\n\n <!-- Data items. The wash and the pointer promise that a click does something, so only a\n clickable item gets them; a focusable one draws the primary ring inside its edges. -->\n @for (item of paginatedItems; track trackByID($index, item); let odd = $odd; let last = $last) {\n <div\n class=\"flex items-center gap-2 bg-base-100 transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary\"\n [ngClass]=\"{'bg-primary/10': isSelected(item)}\"\n [class.bg-base-200]=\"!isSelected(item) && odd && dataSource.appearance?.dividers !== false\"\n [class.hover:bg-base-200]=\"itemsClickable && dataSource.appearance?.hover !== false\"\n [class.cursor-pointer]=\"itemsClickable\"\n [class.px-4]=\"true\"\n [class.py-3]=\"!dataSource.appearance?.compact\"\n [class.py-2]=\"dataSource.appearance?.compact\"\n role=\"listitem\"\n (keydown)=\"onItemKeydown($event, item)\"\n (click)=\"onItemClick(item)\"\n [attr.tabindex]=\"dataSource.onItemClick ? 0 : null\"\n >\n <!-- Selection checkbox -->\n @if (hasSelection) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events,@angular-eslint/template/interactive-supports-focus -->\n <div (click)=\"$event.stopPropagation()\" class=\"shrink-0\">\n <mn-lib-checkbox\n (checkedChange)=\"toggle(item)\"\n [checked]=\"isSelected(item)\"\n [props]=\"{ id: 'mn-list-item-' + $index, size: 'sm' }\"\n ></mn-lib-checkbox>\n </div>\n }\n\n <!-- Item content via template -->\n <div class=\"flex-1 min-w-0\">\n <ng-container\n [ngTemplateOutlet]=\"dataSource.itemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item, data: item }\"\n ></ng-container>\n </div>\n </div>\n @if (!last && (dataSource.appearance?.dividers !== false)) {\n <div class=\"border-b border-base-300\"></div>\n }\n }\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-list\"\n></mn-collection-pagination>\n", styles: [""], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { 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: MnCheckbox, selector: "mn-lib-checkbox", inputs: ["props", "checked"], outputs: ["checkedChange"] }, { kind: "component", type: MnInputField, selector: "mn-lib-input-field", inputs: ["props"] }, { kind: "component", type: MnSkeleton, selector: "mn-skeleton", inputs: ["data"] }, { 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: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2535
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: MnList, isStandalone: true, selector: "mn-list", outputs: { itemClick: "itemClick" }, viewQueries: [{ propertyName: "collectionBody", first: true, predicate: ["collectionBody"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<!-- Toolbar: left template, then search + right template. Below 375px each group\n takes its own full-width row; from 375px up the left group sits at the start\n and the search group at the end. Structure and classes mirror mn-table so all\n collections behave identically at every width. -->\n@if (\n isSearchable ||\n dataSource.toolbarLeftTemplate ||\n dataSource.toolbarRightTemplate ||\n dataSource.toolbarTemplate\n) {\n <div class=\"flex flex-col min-[375px]:flex-row min-[375px]:items-center justify-between gap-2 mb-3\">\n <div class=\"flex items-center gap-2 w-full min-[375px]:w-auto\">\n @if (dataSource.toolbarLeftTemplate) {\n <div class=\"flex flex-col w-full min-[375px]:w-auto min-[375px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"dataSource.toolbarLeftTemplate\"></ng-container>\n </div>\n }\n </div>\n <div\n class=\"flex flex-col min-[375px]:flex-row min-[375px]:items-center gap-2 w-full min-[375px]:flex-1 min-[480px]:flex-none min-[480px]:w-auto\">\n @if (isSearchable) {\n <!-- Enter must not submit a surrounding form: the search box is the\n collection's own chrome, not a field of whatever form it sits in. -->\n <mn-lib-input-field\n (keydown.enter)=\"$event.preventDefault()\"\n (ngModelChange)=\"onSearch($event)\"\n [ngModel]=\"searchValue\"\n [props]=\"{\n id: 'mn-list-search',\n type: 'search',\n label: '',\n ariaLabel: dataSource.searchPlaceholder ?? 'Search...',\n placeholder: dataSource.searchPlaceholder ?? 'Search...',\n size: 'sm',\n borderRadius: 'md',\n fullWidth: true\n }\"\n class=\"w-full min-[375px]:flex-1 min-[480px]:max-w-64\"\n ></mn-lib-input-field>\n }\n <!-- `toolbarTemplate` is the deprecated name for this slot; honouring it here\n keeps existing callers rendering exactly where they used to. -->\n @if (dataSource.toolbarRightTemplate ?? dataSource.toolbarTemplate; as rightTemplate) {\n <div class=\"flex flex-col w-full min-[375px]:w-auto min-[375px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"rightTemplate\"></ng-container>\n </div>\n }\n </div>\n </div>\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<!-- List wrapper -->\n<div\n #collectionBody\n [attr.aria-busy]=\"isLoadingState || null\"\n [style.min-height.px]=\"bodyMinHeight\"\n class=\"w-full\"\n [class.border]=\"dataSource.appearance?.bordered\"\n [class.border-base-300]=\"dataSource.appearance?.bordered\"\n [class.rounded]=\"dataSource.appearance?.bordered\"\n role=\"list\"\n [attr.aria-label]=\"listRegionLabel\"\n>\n <!-- Loading state -->\n @if (isLoadingState) {\n @for (_ of skeletonRows; track $index) {\n <div [class.py-2]=\"dataSource.appearance?.compact\" class=\"px-4 py-3\" role=\"listitem\">\n @if (isTemplateRef(dataSource.skeleton)) {\n <ng-container [ngTemplateOutlet]=\"$any(dataSource.skeleton)\"></ng-container>\n } @else {\n <div class=\"flex flex-col gap-1\">\n @for (line of skeletonLines; track $index) {\n <mn-skeleton [data]=\"line\"></mn-skeleton>\n }\n </div>\n }\n </div>\n @if (!$last && (dataSource.appearance?.dividers !== false)) {\n <div class=\"border-b border-base-300\"></div>\n }\n }\n } @else if (isErrorState) {\n <!-- Error state -->\n <div class=\"text-center text-xs py-8\" role=\"listitem\">\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 </div>\n } @else {\n <!-- Empty state -->\n @if (filteredItems.length === 0) {\n <div class=\"text-center text-xs py-8\" role=\"listitem\">\n @if (dataSource.emptyTemplate) {\n <ng-container [ngTemplateOutlet]=\"dataSource.emptyTemplate\"></ng-container>\n } @else {\n <!-- The same look as the table's empty state and a section's own. -->\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 </div>\n }\n\n <!-- Select all (multi-select) -->\n @if (isMultiSelect && filteredItems.length > 0) {\n <div class=\"flex items-center gap-2 px-4 py-2 bg-base-200 text-sm\">\n <mn-lib-checkbox\n (checkedChange)=\"toggleAll()\"\n [checked]=\"allSelected\"\n [props]=\"{ id: 'mn-list-select-all', label: selectAllLabel, size: 'sm' }\"\n ></mn-lib-checkbox>\n </div>\n @if (dataSource.appearance?.dividers !== false) {\n <div class=\"border-b border-base-300\"></div>\n }\n }\n\n <!-- Data items. The wash and the pointer promise that a click does something, so only a\n clickable item gets them; a focusable one draws the primary ring inside its edges. -->\n @for (item of paginatedItems; track trackByID($index, item); let odd = $odd; let last = $last) {\n <div\n class=\"flex items-center gap-2 bg-base-100 transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary\"\n [ngClass]=\"{'bg-primary/10': isSelected(item)}\"\n [class.bg-base-200]=\"!isSelected(item) && odd && dataSource.appearance?.dividers !== false\"\n [class.hover:bg-base-200]=\"itemsClickable && dataSource.appearance?.hover !== false\"\n [class.cursor-pointer]=\"itemsClickable\"\n [class.px-4]=\"true\"\n [class.py-3]=\"!dataSource.appearance?.compact\"\n [class.py-2]=\"dataSource.appearance?.compact\"\n role=\"listitem\"\n (keydown)=\"onItemKeydown($event, item)\"\n (click)=\"onItemClick(item)\"\n [attr.tabindex]=\"dataSource.onItemClick ? 0 : null\"\n >\n <!-- Selection checkbox -->\n @if (hasSelection) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events,@angular-eslint/template/interactive-supports-focus -->\n <div (click)=\"$event.stopPropagation()\" class=\"shrink-0\">\n <mn-lib-checkbox\n (checkedChange)=\"toggle(item)\"\n [checked]=\"isSelected(item)\"\n [props]=\"{ id: 'mn-list-item-' + $index, size: 'sm' }\"\n ></mn-lib-checkbox>\n </div>\n }\n\n <!-- Item content via template -->\n <div class=\"flex-1 min-w-0\">\n <ng-container\n [ngTemplateOutlet]=\"dataSource.itemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item, data: item }\"\n ></ng-container>\n </div>\n </div>\n @if (!last && (dataSource.appearance?.dividers !== false)) {\n <div class=\"border-b border-base-300\"></div>\n }\n }\n }\n</div>\n\n<!-- Load more + pagination -->\n<!-- No strip for a single page: \"Page 1 of 1\" under a short list is chrome with nothing to do. -->\n@if (totalPages > 1 || showLoadMore || isLoadingState) {\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-list\"\n></mn-collection-pagination>\n}\n", styles: [""], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { 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: MnCheckbox, selector: "mn-lib-checkbox", inputs: ["props", "checked"], outputs: ["checkedChange"] }, { kind: "component", type: MnInputField, selector: "mn-lib-input-field", inputs: ["props"] }, { kind: "component", type: MnSkeleton, selector: "mn-skeleton", inputs: ["data"] }, { 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: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2130
2536
|
}
|
|
2131
2537
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnList, decorators: [{
|
|
2132
2538
|
type: Component,
|
|
2133
|
-
args: [{ selector: 'mn-list', standalone: true, imports: [NgClass, NgTemplateOutlet, FormsModule, MnCheckbox, MnInputField, MnSkeleton, MnCollectionPagination, LucideDynamicIcon], changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- Toolbar: left template, then search + right template. Below 375px each group\n takes its own full-width row; from 375px up the left group sits at the start\n and the search group at the end. Structure and classes mirror mn-table so all\n collections behave identically at every width. -->\n@if (\n isSearchable ||\n dataSource.toolbarLeftTemplate ||\n dataSource.toolbarRightTemplate ||\n dataSource.toolbarTemplate\n) {\n <div class=\"flex flex-col min-[375px]:flex-row min-[375px]:items-center justify-between gap-2 mb-3\">\n <div class=\"flex items-center gap-2 w-full min-[375px]:w-auto\">\n @if (dataSource.toolbarLeftTemplate) {\n <div class=\"flex flex-col w-full min-[375px]:w-auto min-[375px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"dataSource.toolbarLeftTemplate\"></ng-container>\n </div>\n }\n </div>\n <div\n class=\"flex flex-col min-[375px]:flex-row min-[375px]:items-center gap-2 w-full min-[375px]:flex-1 min-[480px]:flex-none min-[480px]:w-auto\">\n @if (isSearchable) {\n <!-- Enter must not submit a surrounding form: the search box is the\n collection's own chrome, not a field of whatever form it sits in. -->\n <mn-lib-input-field\n (keydown.enter)=\"$event.preventDefault()\"\n (ngModelChange)=\"onSearch($event)\"\n [ngModel]=\"searchValue\"\n [props]=\"{\n id: 'mn-list-search',\n type: 'search',\n label: '',\n ariaLabel: dataSource.searchPlaceholder ?? 'Search...',\n placeholder: dataSource.searchPlaceholder ?? 'Search...',\n size: 'sm',\n borderRadius: 'md',\n fullWidth: true\n }\"\n class=\"w-full min-[375px]:flex-1 min-[480px]:max-w-64\"\n ></mn-lib-input-field>\n }\n <!-- `toolbarTemplate` is the deprecated name for this slot; honouring it here\n keeps existing callers rendering exactly where they used to. -->\n @if (dataSource.toolbarRightTemplate ?? dataSource.toolbarTemplate; as rightTemplate) {\n <div class=\"flex flex-col w-full min-[375px]:w-auto min-[375px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"rightTemplate\"></ng-container>\n </div>\n }\n </div>\n </div>\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<!-- List wrapper -->\n<div\n #collectionBody\n [attr.aria-busy]=\"isLoadingState || null\"\n [style.min-height.px]=\"bodyMinHeight\"\n class=\"w-full\"\n [class.border]=\"dataSource.appearance?.bordered\"\n [class.border-base-300]=\"dataSource.appearance?.bordered\"\n [class.rounded]=\"dataSource.appearance?.bordered\"\n role=\"list\"\n [attr.aria-label]=\"listRegionLabel\"\n>\n <!-- Loading state -->\n @if (isLoadingState) {\n @for (_ of skeletonRows; track $index) {\n <div [class.py-2]=\"dataSource.appearance?.compact\" class=\"px-4 py-3\" role=\"listitem\">\n @if (isTemplateRef(dataSource.skeleton)) {\n <ng-container [ngTemplateOutlet]=\"$any(dataSource.skeleton)\"></ng-container>\n } @else {\n <div class=\"flex flex-col gap-1\">\n @for (line of skeletonLines; track $index) {\n <mn-skeleton [data]=\"line\"></mn-skeleton>\n }\n </div>\n }\n </div>\n @if (!$last && (dataSource.appearance?.dividers !== false)) {\n <div class=\"border-b border-base-300\"></div>\n }\n }\n } @else if (isErrorState) {\n <!-- Error state -->\n <div class=\"text-center text-xs py-8\" role=\"listitem\">\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 </div>\n } @else {\n <!-- Empty state -->\n @if (filteredItems.length === 0) {\n <div class=\"text-center text-xs py-8\" role=\"listitem\">\n @if (dataSource.emptyTemplate) {\n <ng-container [ngTemplateOutlet]=\"dataSource.emptyTemplate\"></ng-container>\n } @else {\n <!-- The same look as the table's empty state and a section's own. -->\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 </div>\n }\n\n <!-- Select all (multi-select) -->\n @if (isMultiSelect && filteredItems.length > 0) {\n <div class=\"flex items-center gap-2 px-4 py-2 bg-base-200 text-sm\">\n <mn-lib-checkbox\n (checkedChange)=\"toggleAll()\"\n [checked]=\"allSelected\"\n [props]=\"{ id: 'mn-list-select-all', label: selectAllLabel, size: 'sm' }\"\n ></mn-lib-checkbox>\n </div>\n @if (dataSource.appearance?.dividers !== false) {\n <div class=\"border-b border-base-300\"></div>\n }\n }\n\n <!-- Data items. The wash and the pointer promise that a click does something, so only a\n clickable item gets them; a focusable one draws the primary ring inside its edges. -->\n @for (item of paginatedItems; track trackByID($index, item); let odd = $odd; let last = $last) {\n <div\n class=\"flex items-center gap-2 bg-base-100 transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary\"\n [ngClass]=\"{'bg-primary/10': isSelected(item)}\"\n [class.bg-base-200]=\"!isSelected(item) && odd && dataSource.appearance?.dividers !== false\"\n [class.hover:bg-base-200]=\"itemsClickable && dataSource.appearance?.hover !== false\"\n [class.cursor-pointer]=\"itemsClickable\"\n [class.px-4]=\"true\"\n [class.py-3]=\"!dataSource.appearance?.compact\"\n [class.py-2]=\"dataSource.appearance?.compact\"\n role=\"listitem\"\n (keydown)=\"onItemKeydown($event, item)\"\n (click)=\"onItemClick(item)\"\n [attr.tabindex]=\"dataSource.onItemClick ? 0 : null\"\n >\n <!-- Selection checkbox -->\n @if (hasSelection) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events,@angular-eslint/template/interactive-supports-focus -->\n <div (click)=\"$event.stopPropagation()\" class=\"shrink-0\">\n <mn-lib-checkbox\n (checkedChange)=\"toggle(item)\"\n [checked]=\"isSelected(item)\"\n [props]=\"{ id: 'mn-list-item-' + $index, size: 'sm' }\"\n ></mn-lib-checkbox>\n </div>\n }\n\n <!-- Item content via template -->\n <div class=\"flex-1 min-w-0\">\n <ng-container\n [ngTemplateOutlet]=\"dataSource.itemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item, data: item }\"\n ></ng-container>\n </div>\n </div>\n @if (!last && (dataSource.appearance?.dividers !== false)) {\n <div class=\"border-b border-base-300\"></div>\n }\n }\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-list\"\n></mn-collection-pagination>\n" }]
|
|
2539
|
+
args: [{ selector: 'mn-list', standalone: true, imports: [NgClass, NgTemplateOutlet, FormsModule, MnCheckbox, MnInputField, MnSkeleton, MnCollectionPagination, LucideDynamicIcon], changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- Toolbar: left template, then search + right template. Below 375px each group\n takes its own full-width row; from 375px up the left group sits at the start\n and the search group at the end. Structure and classes mirror mn-table so all\n collections behave identically at every width. -->\n@if (\n isSearchable ||\n dataSource.toolbarLeftTemplate ||\n dataSource.toolbarRightTemplate ||\n dataSource.toolbarTemplate\n) {\n <div class=\"flex flex-col min-[375px]:flex-row min-[375px]:items-center justify-between gap-2 mb-3\">\n <div class=\"flex items-center gap-2 w-full min-[375px]:w-auto\">\n @if (dataSource.toolbarLeftTemplate) {\n <div class=\"flex flex-col w-full min-[375px]:w-auto min-[375px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"dataSource.toolbarLeftTemplate\"></ng-container>\n </div>\n }\n </div>\n <div\n class=\"flex flex-col min-[375px]:flex-row min-[375px]:items-center gap-2 w-full min-[375px]:flex-1 min-[480px]:flex-none min-[480px]:w-auto\">\n @if (isSearchable) {\n <!-- Enter must not submit a surrounding form: the search box is the\n collection's own chrome, not a field of whatever form it sits in. -->\n <mn-lib-input-field\n (keydown.enter)=\"$event.preventDefault()\"\n (ngModelChange)=\"onSearch($event)\"\n [ngModel]=\"searchValue\"\n [props]=\"{\n id: 'mn-list-search',\n type: 'search',\n label: '',\n ariaLabel: dataSource.searchPlaceholder ?? 'Search...',\n placeholder: dataSource.searchPlaceholder ?? 'Search...',\n size: 'sm',\n borderRadius: 'md',\n fullWidth: true\n }\"\n class=\"w-full min-[375px]:flex-1 min-[480px]:max-w-64\"\n ></mn-lib-input-field>\n }\n <!-- `toolbarTemplate` is the deprecated name for this slot; honouring it here\n keeps existing callers rendering exactly where they used to. -->\n @if (dataSource.toolbarRightTemplate ?? dataSource.toolbarTemplate; as rightTemplate) {\n <div class=\"flex flex-col w-full min-[375px]:w-auto min-[375px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"rightTemplate\"></ng-container>\n </div>\n }\n </div>\n </div>\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<!-- List wrapper -->\n<div\n #collectionBody\n [attr.aria-busy]=\"isLoadingState || null\"\n [style.min-height.px]=\"bodyMinHeight\"\n class=\"w-full\"\n [class.border]=\"dataSource.appearance?.bordered\"\n [class.border-base-300]=\"dataSource.appearance?.bordered\"\n [class.rounded]=\"dataSource.appearance?.bordered\"\n role=\"list\"\n [attr.aria-label]=\"listRegionLabel\"\n>\n <!-- Loading state -->\n @if (isLoadingState) {\n @for (_ of skeletonRows; track $index) {\n <div [class.py-2]=\"dataSource.appearance?.compact\" class=\"px-4 py-3\" role=\"listitem\">\n @if (isTemplateRef(dataSource.skeleton)) {\n <ng-container [ngTemplateOutlet]=\"$any(dataSource.skeleton)\"></ng-container>\n } @else {\n <div class=\"flex flex-col gap-1\">\n @for (line of skeletonLines; track $index) {\n <mn-skeleton [data]=\"line\"></mn-skeleton>\n }\n </div>\n }\n </div>\n @if (!$last && (dataSource.appearance?.dividers !== false)) {\n <div class=\"border-b border-base-300\"></div>\n }\n }\n } @else if (isErrorState) {\n <!-- Error state -->\n <div class=\"text-center text-xs py-8\" role=\"listitem\">\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 </div>\n } @else {\n <!-- Empty state -->\n @if (filteredItems.length === 0) {\n <div class=\"text-center text-xs py-8\" role=\"listitem\">\n @if (dataSource.emptyTemplate) {\n <ng-container [ngTemplateOutlet]=\"dataSource.emptyTemplate\"></ng-container>\n } @else {\n <!-- The same look as the table's empty state and a section's own. -->\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 </div>\n }\n\n <!-- Select all (multi-select) -->\n @if (isMultiSelect && filteredItems.length > 0) {\n <div class=\"flex items-center gap-2 px-4 py-2 bg-base-200 text-sm\">\n <mn-lib-checkbox\n (checkedChange)=\"toggleAll()\"\n [checked]=\"allSelected\"\n [props]=\"{ id: 'mn-list-select-all', label: selectAllLabel, size: 'sm' }\"\n ></mn-lib-checkbox>\n </div>\n @if (dataSource.appearance?.dividers !== false) {\n <div class=\"border-b border-base-300\"></div>\n }\n }\n\n <!-- Data items. The wash and the pointer promise that a click does something, so only a\n clickable item gets them; a focusable one draws the primary ring inside its edges. -->\n @for (item of paginatedItems; track trackByID($index, item); let odd = $odd; let last = $last) {\n <div\n class=\"flex items-center gap-2 bg-base-100 transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary\"\n [ngClass]=\"{'bg-primary/10': isSelected(item)}\"\n [class.bg-base-200]=\"!isSelected(item) && odd && dataSource.appearance?.dividers !== false\"\n [class.hover:bg-base-200]=\"itemsClickable && dataSource.appearance?.hover !== false\"\n [class.cursor-pointer]=\"itemsClickable\"\n [class.px-4]=\"true\"\n [class.py-3]=\"!dataSource.appearance?.compact\"\n [class.py-2]=\"dataSource.appearance?.compact\"\n role=\"listitem\"\n (keydown)=\"onItemKeydown($event, item)\"\n (click)=\"onItemClick(item)\"\n [attr.tabindex]=\"dataSource.onItemClick ? 0 : null\"\n >\n <!-- Selection checkbox -->\n @if (hasSelection) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events,@angular-eslint/template/interactive-supports-focus -->\n <div (click)=\"$event.stopPropagation()\" class=\"shrink-0\">\n <mn-lib-checkbox\n (checkedChange)=\"toggle(item)\"\n [checked]=\"isSelected(item)\"\n [props]=\"{ id: 'mn-list-item-' + $index, size: 'sm' }\"\n ></mn-lib-checkbox>\n </div>\n }\n\n <!-- Item content via template -->\n <div class=\"flex-1 min-w-0\">\n <ng-container\n [ngTemplateOutlet]=\"dataSource.itemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item, data: item }\"\n ></ng-container>\n </div>\n </div>\n @if (!last && (dataSource.appearance?.dividers !== false)) {\n <div class=\"border-b border-base-300\"></div>\n }\n }\n }\n</div>\n\n<!-- Load more + pagination -->\n<!-- No strip for a single page: \"Page 1 of 1\" under a short list is chrome with nothing to do. -->\n@if (totalPages > 1 || showLoadMore || isLoadingState) {\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-list\"\n></mn-collection-pagination>\n}\n" }]
|
|
2134
2540
|
}], propDecorators: { itemClick: [{
|
|
2135
2541
|
type: Output
|
|
2136
2542
|
}], collectionBody: [{
|
|
@@ -2296,11 +2702,11 @@ class MnGrid extends MnCollectionBase {
|
|
|
2296
2702
|
return this.resolveLabel(undefined, 'mnCollection.cardGrid', 'Card grid');
|
|
2297
2703
|
}
|
|
2298
2704
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnGrid, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2299
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: MnGrid, isStandalone: true, selector: "mn-grid", outputs: { itemClick: "itemClick" }, host: { classAttribute: "block" }, viewQueries: [{ propertyName: "collectionBody", first: true, predicate: ["collectionBody"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<!-- Toolbar: left template, then search + right template. Below 375px each group\n takes its own full-width row; from 375px up the left group sits at the start\n and the search group at the end. Structure and classes mirror mn-table so all\n collections behave identically at every width. -->\n@if (\n isSearchable ||\n dataSource.toolbarLeftTemplate ||\n dataSource.toolbarRightTemplate ||\n dataSource.toolbarTemplate\n) {\n <div class=\"flex flex-col min-[375px]:flex-row min-[375px]: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-[375px]:w-auto\">\n <div class=\"flex flex-col w-full min-[375px]:w-auto min-[375px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"dataSource.toolbarLeftTemplate\"></ng-container>\n </div>\n </div>\n }\n <div\n class=\"flex flex-col min-[375px]:flex-row min-[375px]:items-center gap-2 w-full min-[375px]:flex-1 min-[375px]:ml-auto min-[480px]:flex-none min-[480px]:w-auto\">\n @if (isSearchable) {\n <!-- Enter must not submit a surrounding form: the search box is the\n collection's own chrome, not a field of whatever form it sits in. -->\n <mn-lib-input-field\n (keydown.enter)=\"$event.preventDefault()\"\n (ngModelChange)=\"onSearch($event)\"\n [ngModel]=\"searchValue\"\n [props]=\"{\n id: 'mn-grid-search',\n type: 'search',\n label: '',\n ariaLabel: dataSource.searchPlaceholder ?? 'Search...',\n placeholder: dataSource.searchPlaceholder ?? 'Search...',\n size: 'sm',\n borderRadius: 'md',\n fullWidth: true\n }\"\n class=\"w-full min-[375px]:flex-1 min-[480px]:flex-none min-[480px]:min-w-64\"\n ></mn-lib-input-field>\n }\n <!-- `toolbarTemplate` is the deprecated name for this slot; honouring it here\n keeps existing callers rendering exactly where they used to. -->\n @if (dataSource.toolbarRightTemplate ?? dataSource.toolbarTemplate; as rightTemplate) {\n <div class=\"flex flex-col w-full min-[375px]:w-auto min-[375px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"rightTemplate\"></ng-container>\n </div>\n }\n </div>\n </div>\n}\n\n<!-- Body: skeleton/data swap region. Wrapper holds its height during a server reload. -->\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<div #collectionBody [style.min-height.px]=\"bodyMinHeight\">\n<!-- Loading state -->\n @if (isLoadingState) {\n <div\n [class]=\"gridClasses\"\n [style.gap]=\"gridGap\"\n [style.grid-template-columns]=\"autoTemplateColumns\"\n aria-busy=\"true\"\n [attr.aria-label]=\"loadingLabel\"\n role=\"list\"\n >\n @for (_ of skeletonRows; track $index) {\n <div role=\"listitem\">\n @if (isTemplateRef(dataSource.skeleton)) {\n <ng-container [ngTemplateOutlet]=\"$any(dataSource.skeleton)\"></ng-container>\n } @else {\n <div class=\"flex flex-col gap-2 p-4 border border-base-300 rounded-lg\">\n @for (line of skeletonLines; track $index) {\n <mn-skeleton [data]=\"line\"></mn-skeleton>\n }\n </div>\n }\n </div>\n }\n </div>\n } @else if (isErrorState) {\n <!-- Error state -->\n @if (dataSource.errorTemplate) {\n <ng-container [ngTemplateOutlet]=\"dataSource.errorTemplate\"></ng-container>\n } @else {\n <div\n class=\"flex items-center justify-center min-h-[6rem] py-8 rounded-xl border border-dashed border-error/30 bg-base-100\">\n <p class=\"text-sm text-error\">{{ dataSource.errorMessage }}</p>\n </div>\n }\n} @else {\n <!-- Empty state: a caller-provided template/component (rendered unwrapped, full\n control over its own layout) or, when none is given, the default text. -->\n @if (filteredItems.length === 0) {\n @if (dataSource.emptyTemplate) {\n <ng-container [ngTemplateOutlet]=\"dataSource.emptyTemplate\"></ng-container>\n } @else {\n <!-- Borderless, as the table's and list's: a dashed box read as a drop zone. -->\n <div\n class=\"flex flex-col items-center justify-center gap-3 py-16 text-center 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 } @else {\n <!-- Card grid -->\n <div\n [class]=\"gridClasses\"\n [style.gap]=\"gridGap\"\n [style.grid-template-columns]=\"autoTemplateColumns\"\n [attr.aria-label]=\"gridRegionLabel\"\n role=\"list\"\n >\n <!-- A clickable item takes focus itself, not the card it holds, so the focus ring is drawn\n here, in the radius of the default card, the same ring a lifting mnCard shows. -->\n @for (item of paginatedItems; track trackByID($index, item)) {\n <div\n (click)=\"onItemClick(item)\"\n (keydown)=\"onItemKeydown($event, item)\"\n [attr.tabindex]=\"dataSource.onItemClick ? 0 : null\"\n [class.cursor-pointer]=\"!!dataSource.onItemClick\"\n class=\"rounded-2xl transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary\"\n role=\"listitem\"\n >\n <ng-container\n [ngTemplateOutletContext]=\"{ $implicit: item, data: item }\"\n [ngTemplateOutlet]=\"dataSource.cardTemplate\"\n ></ng-container>\n </div>\n }\n </div>\n }\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-grid\"\n></mn-collection-pagination>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { 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: MnSkeleton, selector: "mn-skeleton", inputs: ["data"] }, { kind: "component", type: MnInputField, selector: "mn-lib-input-field", inputs: ["props"] }, { 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: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2705
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: MnGrid, isStandalone: true, selector: "mn-grid", outputs: { itemClick: "itemClick" }, host: { classAttribute: "block" }, viewQueries: [{ propertyName: "collectionBody", first: true, predicate: ["collectionBody"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<!-- Toolbar: left template, then search + right template. Below 375px each group\n takes its own full-width row; from 375px up the left group sits at the start\n and the search group at the end. Structure and classes mirror mn-table so all\n collections behave identically at every width. -->\n@if (\n isSearchable ||\n dataSource.toolbarLeftTemplate ||\n dataSource.toolbarRightTemplate ||\n dataSource.toolbarTemplate\n) {\n <div class=\"flex flex-col min-[375px]:flex-row min-[375px]: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-[375px]:w-auto\">\n <div class=\"flex flex-col w-full min-[375px]:w-auto min-[375px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"dataSource.toolbarLeftTemplate\"></ng-container>\n </div>\n </div>\n }\n <div\n class=\"flex flex-col min-[375px]:flex-row min-[375px]:items-center gap-2 w-full min-[375px]:flex-1 min-[375px]:ml-auto min-[480px]:flex-none min-[480px]:w-auto\">\n @if (isSearchable) {\n <!-- Enter must not submit a surrounding form: the search box is the\n collection's own chrome, not a field of whatever form it sits in. -->\n <mn-lib-input-field\n (keydown.enter)=\"$event.preventDefault()\"\n (ngModelChange)=\"onSearch($event)\"\n [ngModel]=\"searchValue\"\n [props]=\"{\n id: 'mn-grid-search',\n type: 'search',\n label: '',\n ariaLabel: dataSource.searchPlaceholder ?? 'Search...',\n placeholder: dataSource.searchPlaceholder ?? 'Search...',\n size: 'sm',\n borderRadius: 'md',\n fullWidth: true\n }\"\n class=\"w-full min-[375px]:flex-1 min-[480px]:flex-none min-[480px]:min-w-64\"\n ></mn-lib-input-field>\n }\n <!-- `toolbarTemplate` is the deprecated name for this slot; honouring it here\n keeps existing callers rendering exactly where they used to. -->\n @if (dataSource.toolbarRightTemplate ?? dataSource.toolbarTemplate; as rightTemplate) {\n <div class=\"flex flex-col w-full min-[375px]:w-auto min-[375px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"rightTemplate\"></ng-container>\n </div>\n }\n </div>\n </div>\n}\n\n<!-- Body: skeleton/data swap region. Wrapper holds its height during a server reload. -->\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<div #collectionBody [style.min-height.px]=\"bodyMinHeight\">\n<!-- Loading state -->\n @if (isLoadingState) {\n <div\n [class]=\"gridClasses\"\n [style.gap]=\"gridGap\"\n [style.grid-template-columns]=\"autoTemplateColumns\"\n aria-busy=\"true\"\n [attr.aria-label]=\"loadingLabel\"\n role=\"list\"\n >\n @for (_ of skeletonRows; track $index) {\n <div role=\"listitem\">\n @if (isTemplateRef(dataSource.skeleton)) {\n <ng-container [ngTemplateOutlet]=\"$any(dataSource.skeleton)\"></ng-container>\n } @else {\n <div class=\"flex flex-col gap-2 p-4 border border-base-300 rounded-lg\">\n @for (line of skeletonLines; track $index) {\n <mn-skeleton [data]=\"line\"></mn-skeleton>\n }\n </div>\n }\n </div>\n }\n </div>\n } @else if (isErrorState) {\n <!-- Error state -->\n @if (dataSource.errorTemplate) {\n <ng-container [ngTemplateOutlet]=\"dataSource.errorTemplate\"></ng-container>\n } @else {\n <div\n class=\"flex items-center justify-center min-h-[6rem] py-8 rounded-xl border border-dashed border-error/30 bg-base-100\">\n <p class=\"text-sm text-error\">{{ dataSource.errorMessage }}</p>\n </div>\n }\n} @else {\n <!-- Empty state: a caller-provided template/component (rendered unwrapped, full\n control over its own layout) or, when none is given, the default text. -->\n @if (filteredItems.length === 0) {\n @if (dataSource.emptyTemplate) {\n <ng-container [ngTemplateOutlet]=\"dataSource.emptyTemplate\"></ng-container>\n } @else {\n <!-- Borderless, as the table's and list's: a dashed box read as a drop zone. -->\n <div\n class=\"flex flex-col items-center justify-center gap-3 py-16 text-center 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 } @else {\n <!-- Card grid -->\n <div\n [class]=\"gridClasses\"\n [style.gap]=\"gridGap\"\n [style.grid-template-columns]=\"autoTemplateColumns\"\n [attr.aria-label]=\"gridRegionLabel\"\n role=\"list\"\n >\n <!-- A clickable item takes focus itself, not the card it holds, so the focus ring is drawn\n here, in the radius of the default card, the same ring a lifting mnCard shows. -->\n @for (item of paginatedItems; track trackByID($index, item)) {\n <div\n (click)=\"onItemClick(item)\"\n (keydown)=\"onItemKeydown($event, item)\"\n [attr.tabindex]=\"dataSource.onItemClick ? 0 : null\"\n [class.cursor-pointer]=\"!!dataSource.onItemClick\"\n class=\"rounded-2xl transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary\"\n role=\"listitem\"\n >\n <ng-container\n [ngTemplateOutletContext]=\"{ $implicit: item, data: item }\"\n [ngTemplateOutlet]=\"dataSource.cardTemplate\"\n ></ng-container>\n </div>\n }\n </div>\n }\n}\n</div>\n\n<!-- Load more + pagination -->\n<!-- No strip for a single page: \"Page 1 of 1\" under a short list is chrome with nothing to do. -->\n@if (totalPages > 1 || showLoadMore || isLoadingState) {\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-grid\"\n></mn-collection-pagination>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { 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: MnSkeleton, selector: "mn-skeleton", inputs: ["data"] }, { kind: "component", type: MnInputField, selector: "mn-lib-input-field", inputs: ["props"] }, { 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: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2300
2706
|
}
|
|
2301
2707
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnGrid, decorators: [{
|
|
2302
2708
|
type: Component,
|
|
2303
|
-
args: [{ selector: 'mn-grid', standalone: true, imports: [NgTemplateOutlet, FormsModule, MnSkeleton, MnInputField, MnCollectionPagination, LucideDynamicIcon], host: { class: 'block' }, changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- Toolbar: left template, then search + right template. Below 375px each group\n takes its own full-width row; from 375px up the left group sits at the start\n and the search group at the end. Structure and classes mirror mn-table so all\n collections behave identically at every width. -->\n@if (\n isSearchable ||\n dataSource.toolbarLeftTemplate ||\n dataSource.toolbarRightTemplate ||\n dataSource.toolbarTemplate\n) {\n <div class=\"flex flex-col min-[375px]:flex-row min-[375px]: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-[375px]:w-auto\">\n <div class=\"flex flex-col w-full min-[375px]:w-auto min-[375px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"dataSource.toolbarLeftTemplate\"></ng-container>\n </div>\n </div>\n }\n <div\n class=\"flex flex-col min-[375px]:flex-row min-[375px]:items-center gap-2 w-full min-[375px]:flex-1 min-[375px]:ml-auto min-[480px]:flex-none min-[480px]:w-auto\">\n @if (isSearchable) {\n <!-- Enter must not submit a surrounding form: the search box is the\n collection's own chrome, not a field of whatever form it sits in. -->\n <mn-lib-input-field\n (keydown.enter)=\"$event.preventDefault()\"\n (ngModelChange)=\"onSearch($event)\"\n [ngModel]=\"searchValue\"\n [props]=\"{\n id: 'mn-grid-search',\n type: 'search',\n label: '',\n ariaLabel: dataSource.searchPlaceholder ?? 'Search...',\n placeholder: dataSource.searchPlaceholder ?? 'Search...',\n size: 'sm',\n borderRadius: 'md',\n fullWidth: true\n }\"\n class=\"w-full min-[375px]:flex-1 min-[480px]:flex-none min-[480px]:min-w-64\"\n ></mn-lib-input-field>\n }\n <!-- `toolbarTemplate` is the deprecated name for this slot; honouring it here\n keeps existing callers rendering exactly where they used to. -->\n @if (dataSource.toolbarRightTemplate ?? dataSource.toolbarTemplate; as rightTemplate) {\n <div class=\"flex flex-col w-full min-[375px]:w-auto min-[375px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"rightTemplate\"></ng-container>\n </div>\n }\n </div>\n </div>\n}\n\n<!-- Body: skeleton/data swap region. Wrapper holds its height during a server reload. -->\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<div #collectionBody [style.min-height.px]=\"bodyMinHeight\">\n<!-- Loading state -->\n @if (isLoadingState) {\n <div\n [class]=\"gridClasses\"\n [style.gap]=\"gridGap\"\n [style.grid-template-columns]=\"autoTemplateColumns\"\n aria-busy=\"true\"\n [attr.aria-label]=\"loadingLabel\"\n role=\"list\"\n >\n @for (_ of skeletonRows; track $index) {\n <div role=\"listitem\">\n @if (isTemplateRef(dataSource.skeleton)) {\n <ng-container [ngTemplateOutlet]=\"$any(dataSource.skeleton)\"></ng-container>\n } @else {\n <div class=\"flex flex-col gap-2 p-4 border border-base-300 rounded-lg\">\n @for (line of skeletonLines; track $index) {\n <mn-skeleton [data]=\"line\"></mn-skeleton>\n }\n </div>\n }\n </div>\n }\n </div>\n } @else if (isErrorState) {\n <!-- Error state -->\n @if (dataSource.errorTemplate) {\n <ng-container [ngTemplateOutlet]=\"dataSource.errorTemplate\"></ng-container>\n } @else {\n <div\n class=\"flex items-center justify-center min-h-[6rem] py-8 rounded-xl border border-dashed border-error/30 bg-base-100\">\n <p class=\"text-sm text-error\">{{ dataSource.errorMessage }}</p>\n </div>\n }\n} @else {\n <!-- Empty state: a caller-provided template/component (rendered unwrapped, full\n control over its own layout) or, when none is given, the default text. -->\n @if (filteredItems.length === 0) {\n @if (dataSource.emptyTemplate) {\n <ng-container [ngTemplateOutlet]=\"dataSource.emptyTemplate\"></ng-container>\n } @else {\n <!-- Borderless, as the table's and list's: a dashed box read as a drop zone. -->\n <div\n class=\"flex flex-col items-center justify-center gap-3 py-16 text-center 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 } @else {\n <!-- Card grid -->\n <div\n [class]=\"gridClasses\"\n [style.gap]=\"gridGap\"\n [style.grid-template-columns]=\"autoTemplateColumns\"\n [attr.aria-label]=\"gridRegionLabel\"\n role=\"list\"\n >\n <!-- A clickable item takes focus itself, not the card it holds, so the focus ring is drawn\n here, in the radius of the default card, the same ring a lifting mnCard shows. -->\n @for (item of paginatedItems; track trackByID($index, item)) {\n <div\n (click)=\"onItemClick(item)\"\n (keydown)=\"onItemKeydown($event, item)\"\n [attr.tabindex]=\"dataSource.onItemClick ? 0 : null\"\n [class.cursor-pointer]=\"!!dataSource.onItemClick\"\n class=\"rounded-2xl transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary\"\n role=\"listitem\"\n >\n <ng-container\n [ngTemplateOutletContext]=\"{ $implicit: item, data: item }\"\n [ngTemplateOutlet]=\"dataSource.cardTemplate\"\n ></ng-container>\n </div>\n }\n </div>\n }\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-grid\"\n></mn-collection-pagination>\n" }]
|
|
2709
|
+
args: [{ selector: 'mn-grid', standalone: true, imports: [NgTemplateOutlet, FormsModule, MnSkeleton, MnInputField, MnCollectionPagination, LucideDynamicIcon], host: { class: 'block' }, changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- Toolbar: left template, then search + right template. Below 375px each group\n takes its own full-width row; from 375px up the left group sits at the start\n and the search group at the end. Structure and classes mirror mn-table so all\n collections behave identically at every width. -->\n@if (\n isSearchable ||\n dataSource.toolbarLeftTemplate ||\n dataSource.toolbarRightTemplate ||\n dataSource.toolbarTemplate\n) {\n <div class=\"flex flex-col min-[375px]:flex-row min-[375px]: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-[375px]:w-auto\">\n <div class=\"flex flex-col w-full min-[375px]:w-auto min-[375px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"dataSource.toolbarLeftTemplate\"></ng-container>\n </div>\n </div>\n }\n <div\n class=\"flex flex-col min-[375px]:flex-row min-[375px]:items-center gap-2 w-full min-[375px]:flex-1 min-[375px]:ml-auto min-[480px]:flex-none min-[480px]:w-auto\">\n @if (isSearchable) {\n <!-- Enter must not submit a surrounding form: the search box is the\n collection's own chrome, not a field of whatever form it sits in. -->\n <mn-lib-input-field\n (keydown.enter)=\"$event.preventDefault()\"\n (ngModelChange)=\"onSearch($event)\"\n [ngModel]=\"searchValue\"\n [props]=\"{\n id: 'mn-grid-search',\n type: 'search',\n label: '',\n ariaLabel: dataSource.searchPlaceholder ?? 'Search...',\n placeholder: dataSource.searchPlaceholder ?? 'Search...',\n size: 'sm',\n borderRadius: 'md',\n fullWidth: true\n }\"\n class=\"w-full min-[375px]:flex-1 min-[480px]:flex-none min-[480px]:min-w-64\"\n ></mn-lib-input-field>\n }\n <!-- `toolbarTemplate` is the deprecated name for this slot; honouring it here\n keeps existing callers rendering exactly where they used to. -->\n @if (dataSource.toolbarRightTemplate ?? dataSource.toolbarTemplate; as rightTemplate) {\n <div class=\"flex flex-col w-full min-[375px]:w-auto min-[375px]:flex-row\">\n <ng-container [ngTemplateOutlet]=\"rightTemplate\"></ng-container>\n </div>\n }\n </div>\n </div>\n}\n\n<!-- Body: skeleton/data swap region. Wrapper holds its height during a server reload. -->\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<div #collectionBody [style.min-height.px]=\"bodyMinHeight\">\n<!-- Loading state -->\n @if (isLoadingState) {\n <div\n [class]=\"gridClasses\"\n [style.gap]=\"gridGap\"\n [style.grid-template-columns]=\"autoTemplateColumns\"\n aria-busy=\"true\"\n [attr.aria-label]=\"loadingLabel\"\n role=\"list\"\n >\n @for (_ of skeletonRows; track $index) {\n <div role=\"listitem\">\n @if (isTemplateRef(dataSource.skeleton)) {\n <ng-container [ngTemplateOutlet]=\"$any(dataSource.skeleton)\"></ng-container>\n } @else {\n <div class=\"flex flex-col gap-2 p-4 border border-base-300 rounded-lg\">\n @for (line of skeletonLines; track $index) {\n <mn-skeleton [data]=\"line\"></mn-skeleton>\n }\n </div>\n }\n </div>\n }\n </div>\n } @else if (isErrorState) {\n <!-- Error state -->\n @if (dataSource.errorTemplate) {\n <ng-container [ngTemplateOutlet]=\"dataSource.errorTemplate\"></ng-container>\n } @else {\n <div\n class=\"flex items-center justify-center min-h-[6rem] py-8 rounded-xl border border-dashed border-error/30 bg-base-100\">\n <p class=\"text-sm text-error\">{{ dataSource.errorMessage }}</p>\n </div>\n }\n} @else {\n <!-- Empty state: a caller-provided template/component (rendered unwrapped, full\n control over its own layout) or, when none is given, the default text. -->\n @if (filteredItems.length === 0) {\n @if (dataSource.emptyTemplate) {\n <ng-container [ngTemplateOutlet]=\"dataSource.emptyTemplate\"></ng-container>\n } @else {\n <!-- Borderless, as the table's and list's: a dashed box read as a drop zone. -->\n <div\n class=\"flex flex-col items-center justify-center gap-3 py-16 text-center 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 } @else {\n <!-- Card grid -->\n <div\n [class]=\"gridClasses\"\n [style.gap]=\"gridGap\"\n [style.grid-template-columns]=\"autoTemplateColumns\"\n [attr.aria-label]=\"gridRegionLabel\"\n role=\"list\"\n >\n <!-- A clickable item takes focus itself, not the card it holds, so the focus ring is drawn\n here, in the radius of the default card, the same ring a lifting mnCard shows. -->\n @for (item of paginatedItems; track trackByID($index, item)) {\n <div\n (click)=\"onItemClick(item)\"\n (keydown)=\"onItemKeydown($event, item)\"\n [attr.tabindex]=\"dataSource.onItemClick ? 0 : null\"\n [class.cursor-pointer]=\"!!dataSource.onItemClick\"\n class=\"rounded-2xl transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary\"\n role=\"listitem\"\n >\n <ng-container\n [ngTemplateOutletContext]=\"{ $implicit: item, data: item }\"\n [ngTemplateOutlet]=\"dataSource.cardTemplate\"\n ></ng-container>\n </div>\n }\n </div>\n }\n}\n</div>\n\n<!-- Load more + pagination -->\n<!-- No strip for a single page: \"Page 1 of 1\" under a short list is chrome with nothing to do. -->\n@if (totalPages > 1 || showLoadMore || isLoadingState) {\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-grid\"\n></mn-collection-pagination>\n}\n" }]
|
|
2304
2710
|
}], propDecorators: { itemClick: [{
|
|
2305
2711
|
type: Output
|
|
2306
2712
|
}], collectionBody: [{
|
|
@@ -2320,5 +2726,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
2320
2726
|
* Generated bundle index. Do not edit.
|
|
2321
2727
|
*/
|
|
2322
2728
|
|
|
2323
|
-
export { ColumnSortType, MnCollectionBase, MnCollectionPagination, MnCollectionState, MnGrid, MnHiddenBelowDirective, MnList, MnSelectableCollectionBase, MnShowAboveDirective, MnShowBelowDirective, MnTable, defaultFilterPredicate, emptyFilterValue, isFilterValueActive, matchesColumnFilter, resolveFilterableValue };
|
|
2729
|
+
export { ColumnSortType, MnCollectionBase, MnCollectionPagination, MnCollectionState, MnGrid, MnHiddenBelowDirective, MnList, MnSelectableCollectionBase, MnShowAboveDirective, MnShowBelowDirective, MnTable, ROW_META_LIMIT, defaultFilterPredicate, emptyFilterValue, isFilterValueActive, matchesColumnFilter, resolveFilterableValue, resolveRowLayout };
|
|
2324
2730
|
//# sourceMappingURL=mn-angular-lib-collection.mjs.map
|