@ai-matrx/design-system 0.47.1 → 0.47.2
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/CHANGELOG.md +8 -0
- package/dist/data-table/copy-helpers.d.cts +1 -1
- package/dist/data-table/copy-helpers.d.ts +1 -1
- package/dist/data-table/filter-engine.d.cts +1 -1
- package/dist/data-table/filter-engine.d.ts +1 -1
- package/dist/data-table/host.d.cts +1 -1
- package/dist/data-table/host.d.ts +1 -1
- package/dist/data-table/index.cjs +567 -399
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.d.cts +2 -2
- package/dist/data-table/index.d.ts +2 -2
- package/dist/data-table/index.js +568 -399
- package/dist/data-table/index.js.map +1 -1
- package/dist/data-table/infer-filter.d.cts +1 -1
- package/dist/data-table/infer-filter.d.ts +1 -1
- package/dist/data-table/layered-filters.d.cts +1 -1
- package/dist/data-table/layered-filters.d.ts +1 -1
- package/dist/data-table/query-control.d.cts +1 -1
- package/dist/data-table/query-control.d.ts +1 -1
- package/dist/data-table/types.cjs.map +1 -1
- package/dist/data-table/types.d.cts +1 -1
- package/dist/data-table/types.d.ts +1 -1
- package/dist/data-table/url-state.d.cts +1 -1
- package/dist/data-table/url-state.d.ts +1 -1
- package/dist/data-table/xlsx.d.cts +1 -1
- package/dist/data-table/xlsx.d.ts +1 -1
- package/dist/{types-DbYAEQz3.d.cts → types-DuvXeW4i.d.cts} +12 -0
- package/dist/{types-BmPwPUWu.d.ts → types-oza_vuRW.d.ts} +12 -0
- package/package.json +1 -1
|
@@ -24331,7 +24331,7 @@ var init_xlsx = __esm({
|
|
|
24331
24331
|
}
|
|
24332
24332
|
prep_blob(d, 0);
|
|
24333
24333
|
var ft = d.read_shift(1);
|
|
24334
|
-
var
|
|
24334
|
+
var memo2 = !!(ft & 136);
|
|
24335
24335
|
var vfp = false, l7 = false;
|
|
24336
24336
|
switch (ft) {
|
|
24337
24337
|
case 2:
|
|
@@ -24342,12 +24342,12 @@ var init_xlsx = __esm({
|
|
|
24342
24342
|
// dBASE III
|
|
24343
24343
|
case 48:
|
|
24344
24344
|
vfp = true;
|
|
24345
|
-
|
|
24345
|
+
memo2 = true;
|
|
24346
24346
|
break;
|
|
24347
24347
|
// VFP
|
|
24348
24348
|
case 49:
|
|
24349
24349
|
vfp = true;
|
|
24350
|
-
|
|
24350
|
+
memo2 = true;
|
|
24351
24351
|
break;
|
|
24352
24352
|
// VFP with autoincrement
|
|
24353
24353
|
// 0x43 dBASE IV SQL table files
|
|
@@ -24496,7 +24496,7 @@ var init_xlsx = __esm({
|
|
|
24496
24496
|
}
|
|
24497
24497
|
break;
|
|
24498
24498
|
case "M":
|
|
24499
|
-
if (!
|
|
24499
|
+
if (!memo2) throw new Error("DBF Unexpected MEMO for type " + ft.toString(16));
|
|
24500
24500
|
out[R][C] = "##MEMO##" + (l7 ? parseInt(s.trim(), 10) : dd.read_shift(4));
|
|
24501
24501
|
break;
|
|
24502
24502
|
case "N":
|
|
@@ -47385,72 +47385,119 @@ function sameWindow(a, b) {
|
|
|
47385
47385
|
return a.start === b.start && a.end === b.end && a.padStart === b.padStart && a.padEnd === b.padEnd && a.total === b.total && a.pinned.length === b.pinned.length;
|
|
47386
47386
|
}
|
|
47387
47387
|
var NO_GROUPING_VALUE = "__matrx_no_grouping__";
|
|
47388
|
-
function
|
|
47389
|
-
|
|
47390
|
-
|
|
47391
|
-
|
|
47392
|
-
|
|
47393
|
-
|
|
47394
|
-
|
|
47395
|
-
|
|
47396
|
-
|
|
47397
|
-
|
|
47398
|
-
|
|
47399
|
-
|
|
47400
|
-
|
|
47401
|
-
|
|
47402
|
-
|
|
47403
|
-
|
|
47404
|
-
|
|
47405
|
-
|
|
47406
|
-
|
|
47407
|
-
|
|
47408
|
-
|
|
47409
|
-
|
|
47410
|
-
|
|
47411
|
-
|
|
47412
|
-
|
|
47413
|
-
|
|
47414
|
-
|
|
47415
|
-
|
|
47416
|
-
|
|
47417
|
-
|
|
47418
|
-
|
|
47419
|
-
|
|
47420
|
-
|
|
47421
|
-
|
|
47422
|
-
|
|
47423
|
-
|
|
47424
|
-
|
|
47425
|
-
|
|
47426
|
-
|
|
47427
|
-
|
|
47428
|
-
|
|
47429
|
-
|
|
47430
|
-
|
|
47431
|
-
|
|
47432
|
-
|
|
47433
|
-
|
|
47434
|
-
|
|
47435
|
-
|
|
47436
|
-
|
|
47437
|
-
|
|
47438
|
-
|
|
47439
|
-
|
|
47440
|
-
|
|
47441
|
-
|
|
47442
|
-
|
|
47443
|
-
|
|
47444
|
-
|
|
47445
|
-
|
|
47446
|
-
|
|
47447
|
-
|
|
47448
|
-
|
|
47449
|
-
|
|
47450
|
-
|
|
47451
|
-
|
|
47452
|
-
|
|
47453
|
-
|
|
47388
|
+
function useRenderEpoch(values) {
|
|
47389
|
+
const held = (0, import_react22.useRef)(null);
|
|
47390
|
+
const previous = held.current;
|
|
47391
|
+
if (previous !== null && previous.values.length === values.length && previous.values.every((value, i) => Object.is(value, values[i]))) {
|
|
47392
|
+
return previous.epoch;
|
|
47393
|
+
}
|
|
47394
|
+
const next = { values, epoch: (previous?.epoch ?? 0) + 1 };
|
|
47395
|
+
held.current = next;
|
|
47396
|
+
return next.epoch;
|
|
47397
|
+
}
|
|
47398
|
+
var HEADER_ONLY_COLUMN_KEYS = /* @__PURE__ */ new Set([
|
|
47399
|
+
"sortValue",
|
|
47400
|
+
"filterValue",
|
|
47401
|
+
"sortable",
|
|
47402
|
+
"defaultSortDirection",
|
|
47403
|
+
"filter",
|
|
47404
|
+
"filterOptions",
|
|
47405
|
+
"filterSingle",
|
|
47406
|
+
"headerMenu",
|
|
47407
|
+
"filterAllowCustom",
|
|
47408
|
+
"headerClassName"
|
|
47409
|
+
]);
|
|
47410
|
+
function columnBodySignature(columns) {
|
|
47411
|
+
const out = [];
|
|
47412
|
+
for (const column of columns) {
|
|
47413
|
+
out.push(COLUMN_SIGNATURE_START);
|
|
47414
|
+
for (const [key, value] of Object.entries(column)) {
|
|
47415
|
+
if (HEADER_ONLY_COLUMN_KEYS.has(key)) continue;
|
|
47416
|
+
if (key === "header" && typeof value !== "string") continue;
|
|
47417
|
+
out.push(key, value);
|
|
47418
|
+
}
|
|
47419
|
+
}
|
|
47420
|
+
return out;
|
|
47421
|
+
}
|
|
47422
|
+
var COLUMN_SIGNATURE_START = /* @__PURE__ */ Symbol("column");
|
|
47423
|
+
function versionFacts(version2) {
|
|
47424
|
+
if (version2 === void 0) return [];
|
|
47425
|
+
return Array.isArray(version2) ? ["rowVersion", ...version2] : ["rowVersion", version2];
|
|
47426
|
+
}
|
|
47427
|
+
function sameBodyRow(a, b) {
|
|
47428
|
+
return a.row === b.row && a.index === b.index && a.epoch === b.epoch && a.rowId === b.rowId && a.facts.length === b.facts.length && a.facts.every((fact, i) => Object.is(fact, b.facts[i]));
|
|
47429
|
+
}
|
|
47430
|
+
var MatrxTableBodyRow = (0, import_react22.memo)(function MatrxTableBodyRow2({ row, index, render }) {
|
|
47431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_jsx_runtime47.Fragment, { children: render(row, index) });
|
|
47432
|
+
}, sameBodyRow);
|
|
47433
|
+
function MatrxDataTableCore(coreProps) {
|
|
47434
|
+
const {
|
|
47435
|
+
data: suppliedData,
|
|
47436
|
+
columns,
|
|
47437
|
+
tableId,
|
|
47438
|
+
defaultViewSnapshot,
|
|
47439
|
+
viewTabs = true,
|
|
47440
|
+
relatedTableActions,
|
|
47441
|
+
columnState,
|
|
47442
|
+
reorderableColumns = true,
|
|
47443
|
+
resizableColumns = true,
|
|
47444
|
+
columnManager: controlledColumnManager,
|
|
47445
|
+
getRowId,
|
|
47446
|
+
searchText,
|
|
47447
|
+
processLocalRows,
|
|
47448
|
+
defaultSort = null,
|
|
47449
|
+
isLoading: suppliedLoading = false,
|
|
47450
|
+
isFetching: suppliedFetching = false,
|
|
47451
|
+
query,
|
|
47452
|
+
urlState,
|
|
47453
|
+
toolbar,
|
|
47454
|
+
hideToolbar = false,
|
|
47455
|
+
hidePagination = false,
|
|
47456
|
+
paginationLabelFormat,
|
|
47457
|
+
filterUi,
|
|
47458
|
+
detail,
|
|
47459
|
+
expandedDetail,
|
|
47460
|
+
window: windowConfig,
|
|
47461
|
+
copy,
|
|
47462
|
+
contextMenu,
|
|
47463
|
+
rowCopyPlacement = "inline",
|
|
47464
|
+
edit,
|
|
47465
|
+
hierarchy,
|
|
47466
|
+
selectedId: controlledSelectedId,
|
|
47467
|
+
onSelectedIdChange,
|
|
47468
|
+
windowRowId: controlledWindowRowId,
|
|
47469
|
+
onWindowRowIdChange,
|
|
47470
|
+
selection: selectionConfig,
|
|
47471
|
+
rowActions,
|
|
47472
|
+
footerRows = [],
|
|
47473
|
+
rowClassName,
|
|
47474
|
+
rowVersion,
|
|
47475
|
+
cellClassName,
|
|
47476
|
+
tableStyle,
|
|
47477
|
+
highlightedIndex,
|
|
47478
|
+
onViewChange,
|
|
47479
|
+
rowWrapper,
|
|
47480
|
+
emptyState,
|
|
47481
|
+
read,
|
|
47482
|
+
pageSize: defaultPageSize = 25,
|
|
47483
|
+
localPagination,
|
|
47484
|
+
pageSizeOptions = [10, 25, 50, 100, 200, 500, 1e3, 2e3],
|
|
47485
|
+
zebra = true,
|
|
47486
|
+
stickyHeader = true,
|
|
47487
|
+
className,
|
|
47488
|
+
tableClassName,
|
|
47489
|
+
mobileCards,
|
|
47490
|
+
mobileCardsBreakpoint = "sm",
|
|
47491
|
+
getRowHref,
|
|
47492
|
+
onRowOpen,
|
|
47493
|
+
density,
|
|
47494
|
+
grouping,
|
|
47495
|
+
virtualize,
|
|
47496
|
+
coverage,
|
|
47497
|
+
spreadsheet,
|
|
47498
|
+
facets,
|
|
47499
|
+
rowHeight: explicitRowHeight
|
|
47500
|
+
} = coreProps;
|
|
47454
47501
|
const appendQuery = query?.mode === "controlled-append" ? query : null;
|
|
47455
47502
|
const appendQueryKey = appendQuery?.pagination.queryKey ?? null;
|
|
47456
47503
|
const committedAppendQueryKey = (0, import_react22.useRef)(appendQueryKey);
|
|
@@ -49330,6 +49377,7 @@ function MatrxDataTableCore({
|
|
|
49330
49377
|
}
|
|
49331
49378
|
} : facet
|
|
49332
49379
|
) : toolbar?.facets;
|
|
49380
|
+
const rowLatest = (0, import_react22.useRef)(null);
|
|
49333
49381
|
const renderRecordCell = (row, col, index) => {
|
|
49334
49382
|
const id = getRowId(row);
|
|
49335
49383
|
const field = col.accessorKey ? String(col.accessorKey) : columnId(col);
|
|
@@ -49345,7 +49393,7 @@ function MatrxDataTableCore({
|
|
|
49345
49393
|
...col.editOptions === void 0 ? {} : { editOptions: col.editOptions },
|
|
49346
49394
|
display,
|
|
49347
49395
|
dirty: Boolean(rowEdits && field in rowEdits),
|
|
49348
|
-
onCommit: (next) => commitCell(id, field, next),
|
|
49396
|
+
onCommit: (next) => rowLatest.current.commitCell(id, field, next),
|
|
49349
49397
|
...href === void 0 ? {} : { href },
|
|
49350
49398
|
...spreadsheetEnabled ? {
|
|
49351
49399
|
// 🚨 THE CLICK LAW, enforced where the two paths meet. In a grid
|
|
@@ -49469,6 +49517,446 @@ function MatrxDataTableCore({
|
|
|
49469
49517
|
},
|
|
49470
49518
|
[columns, commitColumnState, commitColumnWidths, controlledQuery, intelligentSearchEnabled, intelligentSearchScopes, toolbar]
|
|
49471
49519
|
);
|
|
49520
|
+
rowLatest.current = {
|
|
49521
|
+
onRowClick: (row, e) => {
|
|
49522
|
+
if (rowEventTargetsInteractiveDescendant(e.target)) return;
|
|
49523
|
+
if (spreadsheetEnabled && spreadsheetClickLandsOnACell(e.target)) return;
|
|
49524
|
+
if (opensRowHref(e)) {
|
|
49525
|
+
const href = getRowHref?.(row);
|
|
49526
|
+
if (href) window.open(href, "_blank", "noopener");
|
|
49527
|
+
return;
|
|
49528
|
+
}
|
|
49529
|
+
openRow(row);
|
|
49530
|
+
},
|
|
49531
|
+
onRowAuxClick: (row, e) => {
|
|
49532
|
+
if (e.button !== 1 || rowEventTargetsInteractiveDescendant(e.target)) return;
|
|
49533
|
+
const href = getRowHref?.(row);
|
|
49534
|
+
if (href) {
|
|
49535
|
+
e.preventDefault();
|
|
49536
|
+
window.open(href, "_blank", "noopener");
|
|
49537
|
+
}
|
|
49538
|
+
},
|
|
49539
|
+
toggleRowSelected,
|
|
49540
|
+
toggleExpanded,
|
|
49541
|
+
openDetail,
|
|
49542
|
+
openWindow,
|
|
49543
|
+
commitCell,
|
|
49544
|
+
sheet,
|
|
49545
|
+
buildRecordControls
|
|
49546
|
+
};
|
|
49547
|
+
const liveRecordControls = (row) => {
|
|
49548
|
+
const drawn = buildRecordControls(row);
|
|
49549
|
+
const live = {};
|
|
49550
|
+
for (const [key, value] of Object.entries(drawn)) {
|
|
49551
|
+
live[key] = typeof value === "function" ? (...args) => {
|
|
49552
|
+
const now = rowLatest.current.buildRecordControls(row);
|
|
49553
|
+
const handler = now[key];
|
|
49554
|
+
return typeof handler === "function" ? handler(...args) : void 0;
|
|
49555
|
+
} : value;
|
|
49556
|
+
}
|
|
49557
|
+
return live;
|
|
49558
|
+
};
|
|
49559
|
+
const rowEpoch = useRenderEpoch([
|
|
49560
|
+
// WHAT A BODY ROW READS FROM THIS TABLE'S PROPS — and nothing it does not, so a host that
|
|
49561
|
+
// rebuilds its toolbar, its query or its empty state on every render redraws no row. Handlers
|
|
49562
|
+
// are absent on purpose: they run through `rowLatest`. Columns count by what a body cell
|
|
49563
|
+
// draws (`columnBodySignature`), never by the header's menus and filters.
|
|
49564
|
+
...columnBodySignature(visibleColumns),
|
|
49565
|
+
...renderedColumns.map(columnId),
|
|
49566
|
+
getRowId,
|
|
49567
|
+
selection !== void 0 && selection !== null,
|
|
49568
|
+
selection?.isRowSelectable,
|
|
49569
|
+
selectionNoun,
|
|
49570
|
+
windowConfig?.openOnRowClick,
|
|
49571
|
+
expandedDetail,
|
|
49572
|
+
hierarchy,
|
|
49573
|
+
cellClassName,
|
|
49574
|
+
rowClassName,
|
|
49575
|
+
rowWrapper,
|
|
49576
|
+
rowActions,
|
|
49577
|
+
tableStyle,
|
|
49578
|
+
zebra,
|
|
49579
|
+
resizableColumns,
|
|
49580
|
+
Boolean(onRowOpen),
|
|
49581
|
+
edit?.enabled,
|
|
49582
|
+
edit?.autoSave,
|
|
49583
|
+
Boolean(edit?.onSave),
|
|
49584
|
+
copy === void 0,
|
|
49585
|
+
explicitRowHeight,
|
|
49586
|
+
// …and the values of this component the row body reads.
|
|
49587
|
+
virtualizeActive,
|
|
49588
|
+
virtualRowHeight,
|
|
49589
|
+
// Widths and the frozen band by VALUE: both are re-derived whenever the host hands a new
|
|
49590
|
+
// columns array, with the same numbers in them.
|
|
49591
|
+
...Object.entries(effectiveColumnWidths).flat(),
|
|
49592
|
+
...Object.entries(frozenColumns.offsets).flat(),
|
|
49593
|
+
frozenColumns.selectionOffset,
|
|
49594
|
+
effectiveColumnWindow?.start,
|
|
49595
|
+
effectiveColumnWindow?.end,
|
|
49596
|
+
columnWindowWidth,
|
|
49597
|
+
frozenEdgeId,
|
|
49598
|
+
fixedTableGeometry,
|
|
49599
|
+
columnSpacers?.start,
|
|
49600
|
+
columnSpacers?.end,
|
|
49601
|
+
columnDragPreview,
|
|
49602
|
+
spreadsheetEnabled,
|
|
49603
|
+
editEnabled,
|
|
49604
|
+
detailEnabled,
|
|
49605
|
+
windowEnabled,
|
|
49606
|
+
opensWindowOnRowClick,
|
|
49607
|
+
showActionsCol,
|
|
49608
|
+
showInlineRowCopy,
|
|
49609
|
+
showRowCopy,
|
|
49610
|
+
rowCopyInMenu,
|
|
49611
|
+
effectiveCopy,
|
|
49612
|
+
tableCopySourceNamespace,
|
|
49613
|
+
renderedColSpan,
|
|
49614
|
+
hierarchyIndex,
|
|
49615
|
+
hierarchyBlockedIds,
|
|
49616
|
+
draggedRowId
|
|
49617
|
+
]);
|
|
49618
|
+
const rowFactsFor = (row, id, index) => {
|
|
49619
|
+
const pending = edits[id];
|
|
49620
|
+
let sheetFlags = "";
|
|
49621
|
+
if (spreadsheetEnabled) {
|
|
49622
|
+
for (const col of renderedColumns) {
|
|
49623
|
+
const cell = sheet.cellProps(id, columnId(col));
|
|
49624
|
+
sheetFlags += (cell["data-matrx-cell-selected"] ? "s" : "-") + (cell["data-matrx-cell-active"] ? "a" : "-") + (cell["data-matrx-cell-fill-preview"] ? "f" : "-") + (sheet.isFillHandleCell(id, columnId(col)) ? "h" : "-");
|
|
49625
|
+
}
|
|
49626
|
+
}
|
|
49627
|
+
return [
|
|
49628
|
+
selectedId === id,
|
|
49629
|
+
selectedIdSet.has(getSelectionId(row)),
|
|
49630
|
+
pending,
|
|
49631
|
+
highlightedIndex === index,
|
|
49632
|
+
editRequest?.rowId === id ? editRequest : null,
|
|
49633
|
+
Boolean(pending && edit?.onSave && !edit.autoSave && !saving),
|
|
49634
|
+
isRowExpanded(row),
|
|
49635
|
+
sheetFlags,
|
|
49636
|
+
...versionFacts(rowVersion?.(row))
|
|
49637
|
+
];
|
|
49638
|
+
};
|
|
49639
|
+
const renderRecordRow = (row, index) => {
|
|
49640
|
+
const id = getRowId(row);
|
|
49641
|
+
const isSelected = selectedId === id;
|
|
49642
|
+
const rowEdits = edits[id];
|
|
49643
|
+
const displayRow = applyRowEdits(row, rowEdits);
|
|
49644
|
+
const controls = liveRecordControls(displayRow);
|
|
49645
|
+
const isChecked = selectedIdSet.has(getSelectionId(row));
|
|
49646
|
+
const background = rowBackground({
|
|
49647
|
+
tint: rowTintColor(row, id),
|
|
49648
|
+
highlighted: highlightedIndex === index,
|
|
49649
|
+
selected: isSelected,
|
|
49650
|
+
checked: isChecked,
|
|
49651
|
+
zebraOdd: zebra && index % 2 === 1,
|
|
49652
|
+
hoverable: detailEnabled || Boolean(onRowOpen) || canExpandRow(row)
|
|
49653
|
+
});
|
|
49654
|
+
const canHoverFrozenCell = background.frozenHover;
|
|
49655
|
+
const frozenRowBackgroundClass = background.frozen;
|
|
49656
|
+
const rowNode = /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
49657
|
+
"tr",
|
|
49658
|
+
{
|
|
49659
|
+
"data-row-id": id,
|
|
49660
|
+
style: explicitRowHeight !== void 0 ? { height: `${explicitRowHeight}px` } : virtualizeActive ? { height: `${virtualRowHeight}px` } : void 0,
|
|
49661
|
+
"data-state": isSelected ? "selected" : void 0,
|
|
49662
|
+
onClick: (e) => rowLatest.current.onRowClick(row, e),
|
|
49663
|
+
onAuxClick: (e) => rowLatest.current.onRowAuxClick(row, e),
|
|
49664
|
+
className: cn(
|
|
49665
|
+
// Keep the mobile row opaque while the complete row scrolls
|
|
49666
|
+
// horizontally. The translucent zebra/hover tints remain
|
|
49667
|
+
// desktop-only so densely layered mobile content stays crisp.
|
|
49668
|
+
"group/matrx-row border-b border-border/60 bg-card transition-colors",
|
|
49669
|
+
(detailEnabled || Boolean(onRowOpen) || canExpandRow(row)) && "cursor-pointer",
|
|
49670
|
+
rowClassName?.(row, index),
|
|
49671
|
+
draggedRowId === id && "opacity-40",
|
|
49672
|
+
// LAST, and decided once: tint, then highlight / open / ticked, then
|
|
49673
|
+
// the zebra stripe (./row-background.ts). Under a tint no stripe is
|
|
49674
|
+
// emitted at all, so no `sm:` class can win the cascade over it.
|
|
49675
|
+
background.row
|
|
49676
|
+
),
|
|
49677
|
+
children: [
|
|
49678
|
+
selection ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
49679
|
+
"td",
|
|
49680
|
+
{
|
|
49681
|
+
className: cn(
|
|
49682
|
+
"px-2 py-1.5 align-middle lg:py-0.5",
|
|
49683
|
+
// When a data column is frozen the checkbox
|
|
49684
|
+
// column has to freeze with it, or the first
|
|
49685
|
+
// frozen column slides over the checkboxes.
|
|
49686
|
+
frozenColumns.selectionOffset !== null && cn(
|
|
49687
|
+
"sm:sticky sm:left-0 sm:z-20",
|
|
49688
|
+
frozenRowBackgroundClass,
|
|
49689
|
+
canHoverFrozenCell && "sm:group-hover/matrx-row:bg-[color-mix(in_oklab,var(--color-muted)_50%,var(--color-card))]"
|
|
49690
|
+
)
|
|
49691
|
+
),
|
|
49692
|
+
style: fixedUtilityWidth(fixedTableGeometry?.selectionWidth),
|
|
49693
|
+
onClick: (e) => e.stopPropagation(),
|
|
49694
|
+
children: selection.isRowSelectable?.(row) ?? true ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
49695
|
+
"div",
|
|
49696
|
+
{
|
|
49697
|
+
"data-matrx-table-selection-target": true,
|
|
49698
|
+
onClick: (event) => {
|
|
49699
|
+
if (event.target === event.currentTarget) {
|
|
49700
|
+
event.currentTarget.querySelector('[role="checkbox"]')?.click();
|
|
49701
|
+
}
|
|
49702
|
+
},
|
|
49703
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
49704
|
+
Checkbox,
|
|
49705
|
+
{
|
|
49706
|
+
className: CHECKBOX_TAP_AREA,
|
|
49707
|
+
checked: isChecked,
|
|
49708
|
+
"aria-label": `Select this ${selectionNoun}`,
|
|
49709
|
+
onClick: (e) => rowLatest.current.toggleRowSelected(index, e.shiftKey)
|
|
49710
|
+
}
|
|
49711
|
+
)
|
|
49712
|
+
}
|
|
49713
|
+
) : null
|
|
49714
|
+
}
|
|
49715
|
+
) : null,
|
|
49716
|
+
columnSpacers && columnSpacers.start > 0 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
49717
|
+
"td",
|
|
49718
|
+
{
|
|
49719
|
+
"aria-hidden": "true",
|
|
49720
|
+
"data-matrx-table-column-spacer": "start",
|
|
49721
|
+
className: "border-0 p-0",
|
|
49722
|
+
style: { width: `${columnSpacers.start}px`, minWidth: `${columnSpacers.start}px` }
|
|
49723
|
+
},
|
|
49724
|
+
"matrx-column-spacer-start"
|
|
49725
|
+
) : null,
|
|
49726
|
+
renderedColumns.map((col, colIdx) => {
|
|
49727
|
+
const isColumnDragShadow = columnDragPreview?.draggedId === columnId(col) && columnDragPreview.targetId !== null;
|
|
49728
|
+
const sheetCell = spreadsheetEnabled ? sheet.cellProps(id, columnId(col)) : null;
|
|
49729
|
+
const carriesFillHandle = sheetCell !== null && sheet.isFillHandleCell(id, columnId(col));
|
|
49730
|
+
const frozen = frozenColumns.offsets[columnId(col)] !== void 0;
|
|
49731
|
+
const frozenCellTint = cellTintColor(
|
|
49732
|
+
row,
|
|
49733
|
+
id,
|
|
49734
|
+
columnId(col)
|
|
49735
|
+
);
|
|
49736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
49737
|
+
"td",
|
|
49738
|
+
{
|
|
49739
|
+
"data-matrx-table-column-id": columnId(col),
|
|
49740
|
+
"data-matrx-column-drag-shadow": isColumnDragShadow ? "true" : void 0,
|
|
49741
|
+
...sheetCell ? {
|
|
49742
|
+
"data-matrx-cell-row": sheetCell["data-matrx-cell-row"],
|
|
49743
|
+
"data-matrx-cell-col": sheetCell["data-matrx-cell-col"],
|
|
49744
|
+
...sheetCell["data-matrx-cell-selected"] ? { "data-matrx-cell-selected": "true" } : {},
|
|
49745
|
+
...sheetCell["data-matrx-cell-active"] ? { "data-matrx-cell-active": "true" } : {},
|
|
49746
|
+
...sheetCell["data-matrx-cell-fill-preview"] ? { "data-matrx-cell-fill-preview": "true" } : {},
|
|
49747
|
+
// Handlers read the grid as it is NOW: a row the memo kept must
|
|
49748
|
+
// never act on the selection it was drawn with.
|
|
49749
|
+
onMouseDown: (event) => rowLatest.current.sheet.cellProps(id, columnId(col)).onMouseDown(event),
|
|
49750
|
+
onMouseEnter: () => rowLatest.current.sheet.cellProps(id, columnId(col)).onMouseEnter()
|
|
49751
|
+
} : {},
|
|
49752
|
+
className: cn(
|
|
49753
|
+
"py-1.5 align-middle lg:py-0.5",
|
|
49754
|
+
sheetCell?.["data-matrx-cell-selected"] && "bg-primary/10",
|
|
49755
|
+
sheetCell?.["data-matrx-cell-fill-preview"] && "ring-1 ring-inset ring-primary/40",
|
|
49756
|
+
sheetCell?.["data-matrx-cell-active"] && "relative z-10 ring-2 ring-inset ring-primary",
|
|
49757
|
+
carriesFillHandle && "relative",
|
|
49758
|
+
col.compact || resolveColumnMarker(col) !== void 0 ? "px-1" : "px-2",
|
|
49759
|
+
// nowrap (NOT truncate — truncate clips the cell and
|
|
49760
|
+
// defeats w-max, killing the horizontal scroll).
|
|
49761
|
+
"max-sm:whitespace-nowrap",
|
|
49762
|
+
col.mobileHidden && "max-sm:hidden",
|
|
49763
|
+
((resolveColumnMarker(col) && col.width === void 0 ? 40 : col.width) !== void 0 || resizableColumns && col.resizable !== false) && "sm:w-[var(--matrx-col-w)] sm:min-w-[var(--matrx-col-w)] sm:max-w-[var(--matrx-col-w)]",
|
|
49764
|
+
col.className,
|
|
49765
|
+
isColumnDragShadow && "bg-primary/10 shadow-[inset_2px_0_0_var(--primary),inset_-2px_0_0_var(--primary)]",
|
|
49766
|
+
alignForFormat(col) === "center" && "text-center",
|
|
49767
|
+
alignForFormat(col) === "right" && "text-right",
|
|
49768
|
+
frozen && FROZEN_CELL_CLASS,
|
|
49769
|
+
frozen && frozenRowBackgroundClass,
|
|
49770
|
+
frozen && sheetCell?.["data-matrx-cell-selected"] && "sm:bg-[color-mix(in_oklab,var(--color-primary)_10%,var(--color-card))]",
|
|
49771
|
+
frozen && canHoverFrozenCell && "sm:group-hover/matrx-row:bg-[color-mix(in_oklab,var(--color-muted)_50%,var(--color-card))]",
|
|
49772
|
+
frozenEdgeId === columnId(col) && FROZEN_EDGE_CLASS,
|
|
49773
|
+
// A cell tint paints OVER the row tint beneath
|
|
49774
|
+
// it, and the consumer's own hook comes last so
|
|
49775
|
+
// it can always win.
|
|
49776
|
+
cellTintClass(row, id, columnId(col)),
|
|
49777
|
+
frozen && frozenCellTint && FROZEN_CELL_TINT_CLASS[frozenCellTint],
|
|
49778
|
+
cellClassName?.(row, columnId(col), index)
|
|
49779
|
+
),
|
|
49780
|
+
style: {
|
|
49781
|
+
...columnWidthVar(
|
|
49782
|
+
resolveColumnMarker(col) && col.width === void 0 ? 40 : col.width,
|
|
49783
|
+
windowedWidthFor(columnId(col), col.width),
|
|
49784
|
+
columnId(col),
|
|
49785
|
+
resizableColumns && col.resizable !== false
|
|
49786
|
+
),
|
|
49787
|
+
...frozenStyle(columnId(col))
|
|
49788
|
+
},
|
|
49789
|
+
children: [
|
|
49790
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
49791
|
+
"div",
|
|
49792
|
+
{
|
|
49793
|
+
className: cn(
|
|
49794
|
+
colIdx === 0 && (hierarchy || canExpandRow(row)) && "flex min-w-0 items-center"
|
|
49795
|
+
),
|
|
49796
|
+
children: [
|
|
49797
|
+
colIdx === 0 && hierarchy ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
49798
|
+
HierarchyDragHandle,
|
|
49799
|
+
{
|
|
49800
|
+
id,
|
|
49801
|
+
label: hierarchy.itemLabel?.(row) ?? "row",
|
|
49802
|
+
disabled: !(hierarchy.canReparent?.(row) ?? true)
|
|
49803
|
+
}
|
|
49804
|
+
) : null,
|
|
49805
|
+
colIdx === 0 && canExpandRow(row) ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Tooltip, { children: [
|
|
49806
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
49807
|
+
Button,
|
|
49808
|
+
{
|
|
49809
|
+
type: "button",
|
|
49810
|
+
variant: "ghost",
|
|
49811
|
+
size: "icon",
|
|
49812
|
+
"data-matrx-table-expand-toggle": true,
|
|
49813
|
+
className: "mr-1 h-7 w-7 shrink-0 text-muted-foreground hover:text-foreground [&_svg]:size-4",
|
|
49814
|
+
"aria-label": isRowExpanded(row) ? "Collapse row details" : "Expand row details",
|
|
49815
|
+
"aria-expanded": isRowExpanded(row),
|
|
49816
|
+
onClick: (event) => {
|
|
49817
|
+
event.stopPropagation();
|
|
49818
|
+
rowLatest.current.toggleExpanded(row);
|
|
49819
|
+
},
|
|
49820
|
+
onKeyDown: (event) => {
|
|
49821
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
49822
|
+
event.preventDefault();
|
|
49823
|
+
event.stopPropagation();
|
|
49824
|
+
rowLatest.current.toggleExpanded(row);
|
|
49825
|
+
},
|
|
49826
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
49827
|
+
ChevronRight,
|
|
49828
|
+
{
|
|
49829
|
+
className: cn(
|
|
49830
|
+
"transition-transform",
|
|
49831
|
+
isRowExpanded(row) && "rotate-90"
|
|
49832
|
+
)
|
|
49833
|
+
}
|
|
49834
|
+
)
|
|
49835
|
+
}
|
|
49836
|
+
) }),
|
|
49837
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TooltipContent, { children: isRowExpanded(row) ? "Collapse details" : "Expand details" })
|
|
49838
|
+
] }) : null,
|
|
49839
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
49840
|
+
"div",
|
|
49841
|
+
{
|
|
49842
|
+
"data-matrx-cell-content": true,
|
|
49843
|
+
className: "min-w-0 max-w-full flex-1 whitespace-normal break-words [overflow-wrap:anywhere] sm:[&_*]:min-w-0 sm:[&_*]:whitespace-normal sm:[&_*]:[overflow-wrap:anywhere] sm:[&_.truncate]:whitespace-nowrap sm:[&_[data-slot=badge]]:whitespace-nowrap sm:[&_[data-slot=badge]]:[overflow-wrap:normal] sm:[&_[data-matrx-cell-control]]:w-max sm:[&_[data-matrx-cell-control]]:min-w-max sm:[&_[data-matrx-cell-control]]:max-w-none sm:[&_[data-matrx-cell-control]]:whitespace-nowrap sm:[&_[data-matrx-cell-control]]:[overflow-wrap:normal] sm:[&_[data-matrx-cell-control]_*]:whitespace-nowrap sm:[&_[data-matrx-cell-control]_*]:[overflow-wrap:normal] [&_[data-matrx-cell-fill]]:!w-full [&_[data-matrx-cell-fill]]:!min-w-0 [&_[data-matrx-cell-fill]]:!max-w-full sm:[&_[data-matrx-cell-fill]]:!w-full sm:[&_[data-matrx-cell-fill]]:!min-w-0 sm:[&_[data-matrx-cell-fill]]:!max-w-full",
|
|
49844
|
+
children: renderRecordCell(row, col, index)
|
|
49845
|
+
}
|
|
49846
|
+
)
|
|
49847
|
+
]
|
|
49848
|
+
}
|
|
49849
|
+
),
|
|
49850
|
+
carriesFillHandle ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
49851
|
+
"button",
|
|
49852
|
+
{
|
|
49853
|
+
type: "button",
|
|
49854
|
+
"data-matrx-table-fill-handle": true,
|
|
49855
|
+
"aria-label": "Drag to fill the cells below or beside this selection",
|
|
49856
|
+
onMouseDown: (event) => rowLatest.current.sheet.startFillDrag(event),
|
|
49857
|
+
className: "absolute -bottom-[3px] -right-[3px] z-20 h-2 w-2 cursor-crosshair rounded-[1px] border border-background bg-primary"
|
|
49858
|
+
}
|
|
49859
|
+
) : null
|
|
49860
|
+
]
|
|
49861
|
+
},
|
|
49862
|
+
columnId(col)
|
|
49863
|
+
);
|
|
49864
|
+
}),
|
|
49865
|
+
columnSpacers && columnSpacers.end > 0 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
49866
|
+
"td",
|
|
49867
|
+
{
|
|
49868
|
+
"aria-hidden": "true",
|
|
49869
|
+
"data-matrx-table-column-spacer": "end",
|
|
49870
|
+
className: "border-0 p-0",
|
|
49871
|
+
style: { width: `${columnSpacers.end}px`, minWidth: `${columnSpacers.end}px` }
|
|
49872
|
+
},
|
|
49873
|
+
"matrx-column-spacer-end"
|
|
49874
|
+
) : null,
|
|
49875
|
+
showActionsCol && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
49876
|
+
"td",
|
|
49877
|
+
{
|
|
49878
|
+
"data-matrx-table-row-action-cell": true,
|
|
49879
|
+
className: "text-right align-middle",
|
|
49880
|
+
style: fixedUtilityWidth(fixedTableGeometry?.actionsWidth),
|
|
49881
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
49882
|
+
"div",
|
|
49883
|
+
{
|
|
49884
|
+
"data-matrx-table-row-actions": true,
|
|
49885
|
+
className: "inline-flex items-center justify-end gap-0",
|
|
49886
|
+
onClick: (e) => e.stopPropagation(),
|
|
49887
|
+
children: [
|
|
49888
|
+
showInlineRowCopy && effectiveCopy ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
49889
|
+
TableRowCopyControl,
|
|
49890
|
+
{
|
|
49891
|
+
size: "toolbar",
|
|
49892
|
+
copy: effectiveCopy,
|
|
49893
|
+
row: displayRow,
|
|
49894
|
+
sourceId: `${tableCopySourceNamespace}:row:${getRowId(displayRow)}`,
|
|
49895
|
+
...copy === void 0 ? { defaultColumns: declaredVisibleCopyColumns } : {}
|
|
49896
|
+
}
|
|
49897
|
+
) : null,
|
|
49898
|
+
renderRowActions(displayRow, controls),
|
|
49899
|
+
windowEnabled ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Tooltip, { children: [
|
|
49900
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
49901
|
+
Button,
|
|
49902
|
+
{
|
|
49903
|
+
type: "button",
|
|
49904
|
+
variant: "ghost",
|
|
49905
|
+
size: "icon",
|
|
49906
|
+
"data-matrx-table-icon-action": true,
|
|
49907
|
+
className: "h-11 w-11 text-muted-foreground hover:text-foreground [&_svg]:size-5",
|
|
49908
|
+
"aria-label": windowConfig?.openOnRowClick === true ? "Open in side panel" : "Open in window",
|
|
49909
|
+
onClick: (e) => {
|
|
49910
|
+
e.stopPropagation();
|
|
49911
|
+
if (windowConfig?.openOnRowClick === true) rowLatest.current.openDetail(row);
|
|
49912
|
+
else rowLatest.current.openWindow(row);
|
|
49913
|
+
},
|
|
49914
|
+
children: opensWindowOnRowClick ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PanelRightOpen, { className: "h-5 w-5" }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PanelRight, { className: "h-5 w-5" })
|
|
49915
|
+
}
|
|
49916
|
+
) }),
|
|
49917
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TooltipContent, { children: windowConfig?.openOnRowClick === true ? "Open in side panel" : "Open in window" })
|
|
49918
|
+
] }) : null
|
|
49919
|
+
]
|
|
49920
|
+
}
|
|
49921
|
+
)
|
|
49922
|
+
}
|
|
49923
|
+
)
|
|
49924
|
+
]
|
|
49925
|
+
},
|
|
49926
|
+
id
|
|
49927
|
+
);
|
|
49928
|
+
const wrappedRow = rowWrapper ? rowWrapper(row, rowNode) : rowNode;
|
|
49929
|
+
const inlineDetail = expandedDetail && isRowExpanded(row) ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
49930
|
+
"tr",
|
|
49931
|
+
{
|
|
49932
|
+
"data-matrx-table-expanded-detail": id,
|
|
49933
|
+
className: cn("bg-muted/20", expandedDetail.className),
|
|
49934
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
49935
|
+
"td",
|
|
49936
|
+
{
|
|
49937
|
+
colSpan: renderedColSpan,
|
|
49938
|
+
className: "p-4",
|
|
49939
|
+
children: expandedDetail.render(displayRow, controls)
|
|
49940
|
+
}
|
|
49941
|
+
)
|
|
49942
|
+
},
|
|
49943
|
+
`${id}:expanded-detail`
|
|
49944
|
+
) : null;
|
|
49945
|
+
return hierarchy ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react22.Fragment, { children: [
|
|
49946
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
49947
|
+
HierarchyDroppableRow,
|
|
49948
|
+
{
|
|
49949
|
+
id,
|
|
49950
|
+
disabled: !canDropOn(row),
|
|
49951
|
+
children: wrappedRow
|
|
49952
|
+
}
|
|
49953
|
+
),
|
|
49954
|
+
inlineDetail
|
|
49955
|
+
] }, id) : /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react22.Fragment, { children: [
|
|
49956
|
+
wrappedRow,
|
|
49957
|
+
inlineDetail
|
|
49958
|
+
] }, id);
|
|
49959
|
+
};
|
|
49472
49960
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
49473
49961
|
ContextMenuBoundary,
|
|
49474
49962
|
{
|
|
@@ -50366,338 +50854,18 @@ function MatrxDataTableCore({
|
|
|
50366
50854
|
const row = entry.row;
|
|
50367
50855
|
const index = entry.index;
|
|
50368
50856
|
const id = getRowId(row);
|
|
50369
|
-
|
|
50370
|
-
|
|
50371
|
-
const displayRow = applyRowEdits(row, rowEdits);
|
|
50372
|
-
const controls = buildRecordControls(displayRow);
|
|
50373
|
-
const isChecked = selectedIdSet.has(getSelectionId(row));
|
|
50374
|
-
const background = rowBackground({
|
|
50375
|
-
tint: rowTintColor(row, id),
|
|
50376
|
-
highlighted: highlightedIndex === index,
|
|
50377
|
-
selected: isSelected,
|
|
50378
|
-
checked: isChecked,
|
|
50379
|
-
zebraOdd: zebra && index % 2 === 1,
|
|
50380
|
-
hoverable: detailEnabled || Boolean(onRowOpen) || canExpandRow(row)
|
|
50381
|
-
});
|
|
50382
|
-
const canHoverFrozenCell = background.frozenHover;
|
|
50383
|
-
const frozenRowBackgroundClass = background.frozen;
|
|
50384
|
-
const rowNode = /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
50385
|
-
"tr",
|
|
50857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
50858
|
+
MatrxTableBodyRow,
|
|
50386
50859
|
{
|
|
50387
|
-
|
|
50388
|
-
|
|
50389
|
-
|
|
50390
|
-
|
|
50391
|
-
|
|
50392
|
-
|
|
50393
|
-
if (opensRowHref(e)) {
|
|
50394
|
-
const href = getRowHref?.(row);
|
|
50395
|
-
if (href) window.open(href, "_blank", "noopener");
|
|
50396
|
-
return;
|
|
50397
|
-
}
|
|
50398
|
-
openRow(row);
|
|
50399
|
-
},
|
|
50400
|
-
onAuxClick: (e) => {
|
|
50401
|
-
if (e.button !== 1 || rowEventTargetsInteractiveDescendant(e.target)) return;
|
|
50402
|
-
const href = getRowHref?.(row);
|
|
50403
|
-
if (href) {
|
|
50404
|
-
e.preventDefault();
|
|
50405
|
-
window.open(href, "_blank", "noopener");
|
|
50406
|
-
}
|
|
50407
|
-
},
|
|
50408
|
-
className: cn(
|
|
50409
|
-
// Keep the mobile row opaque while the complete row scrolls
|
|
50410
|
-
// horizontally. The translucent zebra/hover tints remain
|
|
50411
|
-
// desktop-only so densely layered mobile content stays crisp.
|
|
50412
|
-
"group/matrx-row border-b border-border/60 bg-card transition-colors",
|
|
50413
|
-
(detailEnabled || Boolean(onRowOpen) || canExpandRow(row)) && "cursor-pointer",
|
|
50414
|
-
rowClassName?.(row, index),
|
|
50415
|
-
draggedRowId === id && "opacity-40",
|
|
50416
|
-
// LAST, and decided once: tint, then highlight / open / ticked, then
|
|
50417
|
-
// the zebra stripe (./row-background.ts). Under a tint no stripe is
|
|
50418
|
-
// emitted at all, so no `sm:` class can win the cascade over it.
|
|
50419
|
-
background.row
|
|
50420
|
-
),
|
|
50421
|
-
children: [
|
|
50422
|
-
selection ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
50423
|
-
"td",
|
|
50424
|
-
{
|
|
50425
|
-
className: cn(
|
|
50426
|
-
"px-2 py-1.5 align-middle lg:py-0.5",
|
|
50427
|
-
// When a data column is frozen the checkbox
|
|
50428
|
-
// column has to freeze with it, or the first
|
|
50429
|
-
// frozen column slides over the checkboxes.
|
|
50430
|
-
frozenColumns.selectionOffset !== null && cn(
|
|
50431
|
-
"sm:sticky sm:left-0 sm:z-20",
|
|
50432
|
-
frozenRowBackgroundClass,
|
|
50433
|
-
canHoverFrozenCell && "sm:group-hover/matrx-row:bg-[color-mix(in_oklab,var(--color-muted)_50%,var(--color-card))]"
|
|
50434
|
-
)
|
|
50435
|
-
),
|
|
50436
|
-
style: fixedUtilityWidth(fixedTableGeometry?.selectionWidth),
|
|
50437
|
-
onClick: (e) => e.stopPropagation(),
|
|
50438
|
-
children: selection.isRowSelectable?.(row) ?? true ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
50439
|
-
"div",
|
|
50440
|
-
{
|
|
50441
|
-
"data-matrx-table-selection-target": true,
|
|
50442
|
-
onClick: (event) => {
|
|
50443
|
-
if (event.target === event.currentTarget) {
|
|
50444
|
-
event.currentTarget.querySelector('[role="checkbox"]')?.click();
|
|
50445
|
-
}
|
|
50446
|
-
},
|
|
50447
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
50448
|
-
Checkbox,
|
|
50449
|
-
{
|
|
50450
|
-
className: CHECKBOX_TAP_AREA,
|
|
50451
|
-
checked: isChecked,
|
|
50452
|
-
"aria-label": `Select this ${selectionNoun}`,
|
|
50453
|
-
onClick: (e) => toggleRowSelected(index, e.shiftKey)
|
|
50454
|
-
}
|
|
50455
|
-
)
|
|
50456
|
-
}
|
|
50457
|
-
) : null
|
|
50458
|
-
}
|
|
50459
|
-
) : null,
|
|
50460
|
-
columnSpacers && columnSpacers.start > 0 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
50461
|
-
"td",
|
|
50462
|
-
{
|
|
50463
|
-
"aria-hidden": "true",
|
|
50464
|
-
"data-matrx-table-column-spacer": "start",
|
|
50465
|
-
className: "border-0 p-0",
|
|
50466
|
-
style: { width: `${columnSpacers.start}px`, minWidth: `${columnSpacers.start}px` }
|
|
50467
|
-
},
|
|
50468
|
-
"matrx-column-spacer-start"
|
|
50469
|
-
) : null,
|
|
50470
|
-
renderedColumns.map((col, colIdx) => {
|
|
50471
|
-
const isColumnDragShadow = columnDragPreview?.draggedId === columnId(col) && columnDragPreview.targetId !== null;
|
|
50472
|
-
const sheetCell = spreadsheetEnabled ? sheet.cellProps(id, columnId(col)) : null;
|
|
50473
|
-
const carriesFillHandle = sheetCell !== null && sheet.isFillHandleCell(id, columnId(col));
|
|
50474
|
-
const frozen = frozenColumns.offsets[columnId(col)] !== void 0;
|
|
50475
|
-
const frozenCellTint = cellTintColor(
|
|
50476
|
-
row,
|
|
50477
|
-
id,
|
|
50478
|
-
columnId(col)
|
|
50479
|
-
);
|
|
50480
|
-
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
50481
|
-
"td",
|
|
50482
|
-
{
|
|
50483
|
-
"data-matrx-table-column-id": columnId(col),
|
|
50484
|
-
"data-matrx-column-drag-shadow": isColumnDragShadow ? "true" : void 0,
|
|
50485
|
-
...sheetCell ? {
|
|
50486
|
-
"data-matrx-cell-row": sheetCell["data-matrx-cell-row"],
|
|
50487
|
-
"data-matrx-cell-col": sheetCell["data-matrx-cell-col"],
|
|
50488
|
-
...sheetCell["data-matrx-cell-selected"] ? { "data-matrx-cell-selected": "true" } : {},
|
|
50489
|
-
...sheetCell["data-matrx-cell-active"] ? { "data-matrx-cell-active": "true" } : {},
|
|
50490
|
-
...sheetCell["data-matrx-cell-fill-preview"] ? { "data-matrx-cell-fill-preview": "true" } : {},
|
|
50491
|
-
onMouseDown: sheetCell.onMouseDown,
|
|
50492
|
-
onMouseEnter: sheetCell.onMouseEnter
|
|
50493
|
-
} : {},
|
|
50494
|
-
className: cn(
|
|
50495
|
-
"py-1.5 align-middle lg:py-0.5",
|
|
50496
|
-
sheetCell?.["data-matrx-cell-selected"] && "bg-primary/10",
|
|
50497
|
-
sheetCell?.["data-matrx-cell-fill-preview"] && "ring-1 ring-inset ring-primary/40",
|
|
50498
|
-
sheetCell?.["data-matrx-cell-active"] && "relative z-10 ring-2 ring-inset ring-primary",
|
|
50499
|
-
carriesFillHandle && "relative",
|
|
50500
|
-
col.compact || resolveColumnMarker(col) !== void 0 ? "px-1" : "px-2",
|
|
50501
|
-
// nowrap (NOT truncate — truncate clips the cell and
|
|
50502
|
-
// defeats w-max, killing the horizontal scroll).
|
|
50503
|
-
"max-sm:whitespace-nowrap",
|
|
50504
|
-
col.mobileHidden && "max-sm:hidden",
|
|
50505
|
-
((resolveColumnMarker(col) && col.width === void 0 ? 40 : col.width) !== void 0 || resizableColumns && col.resizable !== false) && "sm:w-[var(--matrx-col-w)] sm:min-w-[var(--matrx-col-w)] sm:max-w-[var(--matrx-col-w)]",
|
|
50506
|
-
col.className,
|
|
50507
|
-
isColumnDragShadow && "bg-primary/10 shadow-[inset_2px_0_0_var(--primary),inset_-2px_0_0_var(--primary)]",
|
|
50508
|
-
alignForFormat(col) === "center" && "text-center",
|
|
50509
|
-
alignForFormat(col) === "right" && "text-right",
|
|
50510
|
-
frozen && FROZEN_CELL_CLASS,
|
|
50511
|
-
frozen && frozenRowBackgroundClass,
|
|
50512
|
-
frozen && sheetCell?.["data-matrx-cell-selected"] && "sm:bg-[color-mix(in_oklab,var(--color-primary)_10%,var(--color-card))]",
|
|
50513
|
-
frozen && canHoverFrozenCell && "sm:group-hover/matrx-row:bg-[color-mix(in_oklab,var(--color-muted)_50%,var(--color-card))]",
|
|
50514
|
-
frozenEdgeId === columnId(col) && FROZEN_EDGE_CLASS,
|
|
50515
|
-
// A cell tint paints OVER the row tint beneath
|
|
50516
|
-
// it, and the consumer's own hook comes last so
|
|
50517
|
-
// it can always win.
|
|
50518
|
-
cellTintClass(row, id, columnId(col)),
|
|
50519
|
-
frozen && frozenCellTint && FROZEN_CELL_TINT_CLASS[frozenCellTint],
|
|
50520
|
-
cellClassName?.(row, columnId(col), index)
|
|
50521
|
-
),
|
|
50522
|
-
style: {
|
|
50523
|
-
...columnWidthVar(
|
|
50524
|
-
resolveColumnMarker(col) && col.width === void 0 ? 40 : col.width,
|
|
50525
|
-
windowedWidthFor(columnId(col), col.width),
|
|
50526
|
-
columnId(col),
|
|
50527
|
-
resizableColumns && col.resizable !== false
|
|
50528
|
-
),
|
|
50529
|
-
...frozenStyle(columnId(col))
|
|
50530
|
-
},
|
|
50531
|
-
children: [
|
|
50532
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
50533
|
-
"div",
|
|
50534
|
-
{
|
|
50535
|
-
className: cn(
|
|
50536
|
-
colIdx === 0 && (hierarchy || canExpandRow(row)) && "flex min-w-0 items-center"
|
|
50537
|
-
),
|
|
50538
|
-
children: [
|
|
50539
|
-
colIdx === 0 && hierarchy ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
50540
|
-
HierarchyDragHandle,
|
|
50541
|
-
{
|
|
50542
|
-
id,
|
|
50543
|
-
label: hierarchy.itemLabel?.(row) ?? "row",
|
|
50544
|
-
disabled: !(hierarchy.canReparent?.(row) ?? true)
|
|
50545
|
-
}
|
|
50546
|
-
) : null,
|
|
50547
|
-
colIdx === 0 && canExpandRow(row) ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Tooltip, { children: [
|
|
50548
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
50549
|
-
Button,
|
|
50550
|
-
{
|
|
50551
|
-
type: "button",
|
|
50552
|
-
variant: "ghost",
|
|
50553
|
-
size: "icon",
|
|
50554
|
-
"data-matrx-table-expand-toggle": true,
|
|
50555
|
-
className: "mr-1 h-7 w-7 shrink-0 text-muted-foreground hover:text-foreground [&_svg]:size-4",
|
|
50556
|
-
"aria-label": isRowExpanded(row) ? "Collapse row details" : "Expand row details",
|
|
50557
|
-
"aria-expanded": isRowExpanded(row),
|
|
50558
|
-
onClick: (event) => {
|
|
50559
|
-
event.stopPropagation();
|
|
50560
|
-
toggleExpanded(row);
|
|
50561
|
-
},
|
|
50562
|
-
onKeyDown: (event) => {
|
|
50563
|
-
if (event.key !== "Enter" && event.key !== " ") return;
|
|
50564
|
-
event.preventDefault();
|
|
50565
|
-
event.stopPropagation();
|
|
50566
|
-
toggleExpanded(row);
|
|
50567
|
-
},
|
|
50568
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
50569
|
-
ChevronRight,
|
|
50570
|
-
{
|
|
50571
|
-
className: cn(
|
|
50572
|
-
"transition-transform",
|
|
50573
|
-
isRowExpanded(row) && "rotate-90"
|
|
50574
|
-
)
|
|
50575
|
-
}
|
|
50576
|
-
)
|
|
50577
|
-
}
|
|
50578
|
-
) }),
|
|
50579
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TooltipContent, { children: isRowExpanded(row) ? "Collapse details" : "Expand details" })
|
|
50580
|
-
] }) : null,
|
|
50581
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
50582
|
-
"div",
|
|
50583
|
-
{
|
|
50584
|
-
"data-matrx-cell-content": true,
|
|
50585
|
-
className: "min-w-0 max-w-full flex-1 whitespace-normal break-words [overflow-wrap:anywhere] sm:[&_*]:min-w-0 sm:[&_*]:whitespace-normal sm:[&_*]:[overflow-wrap:anywhere] sm:[&_.truncate]:whitespace-nowrap sm:[&_[data-slot=badge]]:whitespace-nowrap sm:[&_[data-slot=badge]]:[overflow-wrap:normal] sm:[&_[data-matrx-cell-control]]:w-max sm:[&_[data-matrx-cell-control]]:min-w-max sm:[&_[data-matrx-cell-control]]:max-w-none sm:[&_[data-matrx-cell-control]]:whitespace-nowrap sm:[&_[data-matrx-cell-control]]:[overflow-wrap:normal] sm:[&_[data-matrx-cell-control]_*]:whitespace-nowrap sm:[&_[data-matrx-cell-control]_*]:[overflow-wrap:normal] [&_[data-matrx-cell-fill]]:!w-full [&_[data-matrx-cell-fill]]:!min-w-0 [&_[data-matrx-cell-fill]]:!max-w-full sm:[&_[data-matrx-cell-fill]]:!w-full sm:[&_[data-matrx-cell-fill]]:!min-w-0 sm:[&_[data-matrx-cell-fill]]:!max-w-full",
|
|
50586
|
-
children: renderRecordCell(row, col, index)
|
|
50587
|
-
}
|
|
50588
|
-
)
|
|
50589
|
-
]
|
|
50590
|
-
}
|
|
50591
|
-
),
|
|
50592
|
-
carriesFillHandle ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
50593
|
-
"button",
|
|
50594
|
-
{
|
|
50595
|
-
type: "button",
|
|
50596
|
-
"data-matrx-table-fill-handle": true,
|
|
50597
|
-
"aria-label": "Drag to fill the cells below or beside this selection",
|
|
50598
|
-
onMouseDown: sheet.startFillDrag,
|
|
50599
|
-
className: "absolute -bottom-[3px] -right-[3px] z-20 h-2 w-2 cursor-crosshair rounded-[1px] border border-background bg-primary"
|
|
50600
|
-
}
|
|
50601
|
-
) : null
|
|
50602
|
-
]
|
|
50603
|
-
},
|
|
50604
|
-
columnId(col)
|
|
50605
|
-
);
|
|
50606
|
-
}),
|
|
50607
|
-
columnSpacers && columnSpacers.end > 0 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
50608
|
-
"td",
|
|
50609
|
-
{
|
|
50610
|
-
"aria-hidden": "true",
|
|
50611
|
-
"data-matrx-table-column-spacer": "end",
|
|
50612
|
-
className: "border-0 p-0",
|
|
50613
|
-
style: { width: `${columnSpacers.end}px`, minWidth: `${columnSpacers.end}px` }
|
|
50614
|
-
},
|
|
50615
|
-
"matrx-column-spacer-end"
|
|
50616
|
-
) : null,
|
|
50617
|
-
showActionsCol && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
50618
|
-
"td",
|
|
50619
|
-
{
|
|
50620
|
-
"data-matrx-table-row-action-cell": true,
|
|
50621
|
-
className: "text-right align-middle",
|
|
50622
|
-
style: fixedUtilityWidth(fixedTableGeometry?.actionsWidth),
|
|
50623
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
50624
|
-
"div",
|
|
50625
|
-
{
|
|
50626
|
-
"data-matrx-table-row-actions": true,
|
|
50627
|
-
className: "inline-flex items-center justify-end gap-0",
|
|
50628
|
-
onClick: (e) => e.stopPropagation(),
|
|
50629
|
-
children: [
|
|
50630
|
-
showInlineRowCopy && effectiveCopy ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
50631
|
-
TableRowCopyControl,
|
|
50632
|
-
{
|
|
50633
|
-
size: "toolbar",
|
|
50634
|
-
copy: effectiveCopy,
|
|
50635
|
-
row: displayRow,
|
|
50636
|
-
sourceId: `${tableCopySourceNamespace}:row:${getRowId(displayRow)}`,
|
|
50637
|
-
...copy === void 0 ? { defaultColumns: declaredVisibleCopyColumns } : {}
|
|
50638
|
-
}
|
|
50639
|
-
) : null,
|
|
50640
|
-
renderRowActions(displayRow, controls),
|
|
50641
|
-
windowEnabled ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Tooltip, { children: [
|
|
50642
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
50643
|
-
Button,
|
|
50644
|
-
{
|
|
50645
|
-
type: "button",
|
|
50646
|
-
variant: "ghost",
|
|
50647
|
-
size: "icon",
|
|
50648
|
-
"data-matrx-table-icon-action": true,
|
|
50649
|
-
className: "h-11 w-11 text-muted-foreground hover:text-foreground [&_svg]:size-5",
|
|
50650
|
-
"aria-label": windowConfig?.openOnRowClick === true ? "Open in side panel" : "Open in window",
|
|
50651
|
-
onClick: (e) => {
|
|
50652
|
-
e.stopPropagation();
|
|
50653
|
-
if (windowConfig?.openOnRowClick === true) openDetail(row);
|
|
50654
|
-
else openWindow(row);
|
|
50655
|
-
},
|
|
50656
|
-
children: opensWindowOnRowClick ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PanelRightOpen, { className: "h-5 w-5" }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PanelRight, { className: "h-5 w-5" })
|
|
50657
|
-
}
|
|
50658
|
-
) }),
|
|
50659
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TooltipContent, { children: windowConfig?.openOnRowClick === true ? "Open in side panel" : "Open in window" })
|
|
50660
|
-
] }) : null
|
|
50661
|
-
]
|
|
50662
|
-
}
|
|
50663
|
-
)
|
|
50664
|
-
}
|
|
50665
|
-
)
|
|
50666
|
-
]
|
|
50860
|
+
rowId: id,
|
|
50861
|
+
row,
|
|
50862
|
+
index,
|
|
50863
|
+
epoch: rowEpoch,
|
|
50864
|
+
facts: rowFactsFor(row, id, index),
|
|
50865
|
+
render: renderRecordRow
|
|
50667
50866
|
},
|
|
50668
50867
|
id
|
|
50669
50868
|
);
|
|
50670
|
-
const wrappedRow = rowWrapper ? rowWrapper(row, rowNode) : rowNode;
|
|
50671
|
-
const inlineDetail = expandedDetail && isRowExpanded(row) ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
50672
|
-
"tr",
|
|
50673
|
-
{
|
|
50674
|
-
"data-matrx-table-expanded-detail": id,
|
|
50675
|
-
className: cn("bg-muted/20", expandedDetail.className),
|
|
50676
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
50677
|
-
"td",
|
|
50678
|
-
{
|
|
50679
|
-
colSpan: renderedColSpan,
|
|
50680
|
-
className: "p-4",
|
|
50681
|
-
children: expandedDetail.render(displayRow, controls)
|
|
50682
|
-
}
|
|
50683
|
-
)
|
|
50684
|
-
},
|
|
50685
|
-
`${id}:expanded-detail`
|
|
50686
|
-
) : null;
|
|
50687
|
-
return hierarchy ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react22.Fragment, { children: [
|
|
50688
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
50689
|
-
HierarchyDroppableRow,
|
|
50690
|
-
{
|
|
50691
|
-
id,
|
|
50692
|
-
disabled: !canDropOn(row),
|
|
50693
|
-
children: wrappedRow
|
|
50694
|
-
}
|
|
50695
|
-
),
|
|
50696
|
-
inlineDetail
|
|
50697
|
-
] }, id) : /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react22.Fragment, { children: [
|
|
50698
|
-
wrappedRow,
|
|
50699
|
-
inlineDetail
|
|
50700
|
-
] }, id);
|
|
50701
50869
|
}),
|
|
50702
50870
|
appendQuery !== null && isFetching && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("tr", { "data-matrx-table-append-loading-row": true, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
50703
50871
|
"td",
|