@ai-matrx/design-system 0.47.1 → 0.47.3
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 +14 -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
package/dist/data-table/index.js
CHANGED
|
@@ -24309,7 +24309,7 @@ var init_xlsx = __esm({
|
|
|
24309
24309
|
}
|
|
24310
24310
|
prep_blob(d, 0);
|
|
24311
24311
|
var ft = d.read_shift(1);
|
|
24312
|
-
var
|
|
24312
|
+
var memo2 = !!(ft & 136);
|
|
24313
24313
|
var vfp = false, l7 = false;
|
|
24314
24314
|
switch (ft) {
|
|
24315
24315
|
case 2:
|
|
@@ -24320,12 +24320,12 @@ var init_xlsx = __esm({
|
|
|
24320
24320
|
// dBASE III
|
|
24321
24321
|
case 48:
|
|
24322
24322
|
vfp = true;
|
|
24323
|
-
|
|
24323
|
+
memo2 = true;
|
|
24324
24324
|
break;
|
|
24325
24325
|
// VFP
|
|
24326
24326
|
case 49:
|
|
24327
24327
|
vfp = true;
|
|
24328
|
-
|
|
24328
|
+
memo2 = true;
|
|
24329
24329
|
break;
|
|
24330
24330
|
// VFP with autoincrement
|
|
24331
24331
|
// 0x43 dBASE IV SQL table files
|
|
@@ -24474,7 +24474,7 @@ var init_xlsx = __esm({
|
|
|
24474
24474
|
}
|
|
24475
24475
|
break;
|
|
24476
24476
|
case "M":
|
|
24477
|
-
if (!
|
|
24477
|
+
if (!memo2) throw new Error("DBF Unexpected MEMO for type " + ft.toString(16));
|
|
24478
24478
|
out[R][C] = "##MEMO##" + (l7 ? parseInt(s.trim(), 10) : dd.read_shift(4));
|
|
24479
24479
|
break;
|
|
24480
24480
|
case "N":
|
|
@@ -34004,6 +34004,7 @@ import {
|
|
|
34004
34004
|
cloneElement as cloneElement2,
|
|
34005
34005
|
Fragment as Fragment9,
|
|
34006
34006
|
isValidElement as isValidElement2,
|
|
34007
|
+
memo,
|
|
34007
34008
|
useCallback as useCallback8,
|
|
34008
34009
|
useEffect as useEffect17,
|
|
34009
34010
|
useId as useId2,
|
|
@@ -47314,72 +47315,119 @@ function sameWindow(a, b) {
|
|
|
47314
47315
|
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;
|
|
47315
47316
|
}
|
|
47316
47317
|
var NO_GROUPING_VALUE = "__matrx_no_grouping__";
|
|
47317
|
-
function
|
|
47318
|
-
|
|
47319
|
-
|
|
47320
|
-
|
|
47321
|
-
|
|
47322
|
-
|
|
47323
|
-
|
|
47324
|
-
|
|
47325
|
-
|
|
47326
|
-
|
|
47327
|
-
|
|
47328
|
-
|
|
47329
|
-
|
|
47330
|
-
|
|
47331
|
-
|
|
47332
|
-
|
|
47333
|
-
|
|
47334
|
-
|
|
47335
|
-
|
|
47336
|
-
|
|
47337
|
-
|
|
47338
|
-
|
|
47339
|
-
|
|
47340
|
-
|
|
47341
|
-
|
|
47342
|
-
|
|
47343
|
-
|
|
47344
|
-
|
|
47345
|
-
|
|
47346
|
-
|
|
47347
|
-
|
|
47348
|
-
|
|
47349
|
-
|
|
47350
|
-
|
|
47351
|
-
|
|
47352
|
-
|
|
47353
|
-
|
|
47354
|
-
|
|
47355
|
-
|
|
47356
|
-
|
|
47357
|
-
|
|
47358
|
-
|
|
47359
|
-
|
|
47360
|
-
|
|
47361
|
-
|
|
47362
|
-
|
|
47363
|
-
|
|
47364
|
-
|
|
47365
|
-
|
|
47366
|
-
|
|
47367
|
-
|
|
47368
|
-
|
|
47369
|
-
|
|
47370
|
-
|
|
47371
|
-
|
|
47372
|
-
|
|
47373
|
-
|
|
47374
|
-
|
|
47375
|
-
|
|
47376
|
-
|
|
47377
|
-
|
|
47378
|
-
|
|
47379
|
-
|
|
47380
|
-
|
|
47381
|
-
|
|
47382
|
-
|
|
47318
|
+
function useRenderEpoch(values) {
|
|
47319
|
+
const held = useRef16(null);
|
|
47320
|
+
const previous = held.current;
|
|
47321
|
+
if (previous !== null && previous.values.length === values.length && previous.values.every((value, i) => Object.is(value, values[i]))) {
|
|
47322
|
+
return previous.epoch;
|
|
47323
|
+
}
|
|
47324
|
+
const next = { values, epoch: (previous?.epoch ?? 0) + 1 };
|
|
47325
|
+
held.current = next;
|
|
47326
|
+
return next.epoch;
|
|
47327
|
+
}
|
|
47328
|
+
var HEADER_ONLY_COLUMN_KEYS = /* @__PURE__ */ new Set([
|
|
47329
|
+
"sortValue",
|
|
47330
|
+
"filterValue",
|
|
47331
|
+
"sortable",
|
|
47332
|
+
"defaultSortDirection",
|
|
47333
|
+
"filter",
|
|
47334
|
+
"filterOptions",
|
|
47335
|
+
"filterSingle",
|
|
47336
|
+
"headerMenu",
|
|
47337
|
+
"filterAllowCustom",
|
|
47338
|
+
"headerClassName"
|
|
47339
|
+
]);
|
|
47340
|
+
function columnBodySignature(columns) {
|
|
47341
|
+
const out = [];
|
|
47342
|
+
for (const column of columns) {
|
|
47343
|
+
out.push(COLUMN_SIGNATURE_START);
|
|
47344
|
+
for (const [key, value] of Object.entries(column)) {
|
|
47345
|
+
if (HEADER_ONLY_COLUMN_KEYS.has(key)) continue;
|
|
47346
|
+
if (key === "header" && typeof value !== "string") continue;
|
|
47347
|
+
out.push(key, value);
|
|
47348
|
+
}
|
|
47349
|
+
}
|
|
47350
|
+
return out;
|
|
47351
|
+
}
|
|
47352
|
+
var COLUMN_SIGNATURE_START = /* @__PURE__ */ Symbol("column");
|
|
47353
|
+
function versionFacts(version2) {
|
|
47354
|
+
if (version2 === void 0) return [];
|
|
47355
|
+
return Array.isArray(version2) ? ["rowVersion", ...version2] : ["rowVersion", version2];
|
|
47356
|
+
}
|
|
47357
|
+
function sameBodyRow(a, b) {
|
|
47358
|
+
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]));
|
|
47359
|
+
}
|
|
47360
|
+
var MatrxTableBodyRow = memo(function MatrxTableBodyRow2({ row, index, render }) {
|
|
47361
|
+
return /* @__PURE__ */ jsx47(Fragment10, { children: render(row, index) });
|
|
47362
|
+
}, sameBodyRow);
|
|
47363
|
+
function MatrxDataTableCore(coreProps) {
|
|
47364
|
+
const {
|
|
47365
|
+
data: suppliedData,
|
|
47366
|
+
columns,
|
|
47367
|
+
tableId,
|
|
47368
|
+
defaultViewSnapshot,
|
|
47369
|
+
viewTabs = true,
|
|
47370
|
+
relatedTableActions,
|
|
47371
|
+
columnState,
|
|
47372
|
+
reorderableColumns = true,
|
|
47373
|
+
resizableColumns = true,
|
|
47374
|
+
columnManager: controlledColumnManager,
|
|
47375
|
+
getRowId,
|
|
47376
|
+
searchText,
|
|
47377
|
+
processLocalRows,
|
|
47378
|
+
defaultSort = null,
|
|
47379
|
+
isLoading: suppliedLoading = false,
|
|
47380
|
+
isFetching: suppliedFetching = false,
|
|
47381
|
+
query,
|
|
47382
|
+
urlState,
|
|
47383
|
+
toolbar,
|
|
47384
|
+
hideToolbar = false,
|
|
47385
|
+
hidePagination = false,
|
|
47386
|
+
paginationLabelFormat,
|
|
47387
|
+
filterUi,
|
|
47388
|
+
detail,
|
|
47389
|
+
expandedDetail,
|
|
47390
|
+
window: windowConfig,
|
|
47391
|
+
copy,
|
|
47392
|
+
contextMenu,
|
|
47393
|
+
rowCopyPlacement = "inline",
|
|
47394
|
+
edit,
|
|
47395
|
+
hierarchy,
|
|
47396
|
+
selectedId: controlledSelectedId,
|
|
47397
|
+
onSelectedIdChange,
|
|
47398
|
+
windowRowId: controlledWindowRowId,
|
|
47399
|
+
onWindowRowIdChange,
|
|
47400
|
+
selection: selectionConfig,
|
|
47401
|
+
rowActions,
|
|
47402
|
+
footerRows = [],
|
|
47403
|
+
rowClassName,
|
|
47404
|
+
rowVersion,
|
|
47405
|
+
cellClassName,
|
|
47406
|
+
tableStyle,
|
|
47407
|
+
highlightedIndex,
|
|
47408
|
+
onViewChange,
|
|
47409
|
+
rowWrapper,
|
|
47410
|
+
emptyState,
|
|
47411
|
+
read,
|
|
47412
|
+
pageSize: defaultPageSize = 25,
|
|
47413
|
+
localPagination,
|
|
47414
|
+
pageSizeOptions = [10, 25, 50, 100, 200, 500, 1e3, 2e3],
|
|
47415
|
+
zebra = true,
|
|
47416
|
+
stickyHeader = true,
|
|
47417
|
+
className,
|
|
47418
|
+
tableClassName,
|
|
47419
|
+
mobileCards,
|
|
47420
|
+
mobileCardsBreakpoint = "sm",
|
|
47421
|
+
getRowHref,
|
|
47422
|
+
onRowOpen,
|
|
47423
|
+
density,
|
|
47424
|
+
grouping,
|
|
47425
|
+
virtualize,
|
|
47426
|
+
coverage,
|
|
47427
|
+
spreadsheet,
|
|
47428
|
+
facets,
|
|
47429
|
+
rowHeight: explicitRowHeight
|
|
47430
|
+
} = coreProps;
|
|
47383
47431
|
const appendQuery = query?.mode === "controlled-append" ? query : null;
|
|
47384
47432
|
const appendQueryKey = appendQuery?.pagination.queryKey ?? null;
|
|
47385
47433
|
const committedAppendQueryKey = useRef16(appendQueryKey);
|
|
@@ -49259,6 +49307,7 @@ function MatrxDataTableCore({
|
|
|
49259
49307
|
}
|
|
49260
49308
|
} : facet
|
|
49261
49309
|
) : toolbar?.facets;
|
|
49310
|
+
const rowLatest = useRef16(null);
|
|
49262
49311
|
const renderRecordCell = (row, col, index) => {
|
|
49263
49312
|
const id = getRowId(row);
|
|
49264
49313
|
const field = col.accessorKey ? String(col.accessorKey) : columnId(col);
|
|
@@ -49274,7 +49323,7 @@ function MatrxDataTableCore({
|
|
|
49274
49323
|
...col.editOptions === void 0 ? {} : { editOptions: col.editOptions },
|
|
49275
49324
|
display,
|
|
49276
49325
|
dirty: Boolean(rowEdits && field in rowEdits),
|
|
49277
|
-
onCommit: (next) => commitCell(id, field, next),
|
|
49326
|
+
onCommit: (next) => rowLatest.current.commitCell(id, field, next),
|
|
49278
49327
|
...href === void 0 ? {} : { href },
|
|
49279
49328
|
...spreadsheetEnabled ? {
|
|
49280
49329
|
// 🚨 THE CLICK LAW, enforced where the two paths meet. In a grid
|
|
@@ -49398,6 +49447,446 @@ function MatrxDataTableCore({
|
|
|
49398
49447
|
},
|
|
49399
49448
|
[columns, commitColumnState, commitColumnWidths, controlledQuery, intelligentSearchEnabled, intelligentSearchScopes, toolbar]
|
|
49400
49449
|
);
|
|
49450
|
+
rowLatest.current = {
|
|
49451
|
+
onRowClick: (row, e) => {
|
|
49452
|
+
if (rowEventTargetsInteractiveDescendant(e.target)) return;
|
|
49453
|
+
if (spreadsheetEnabled && spreadsheetClickLandsOnACell(e.target)) return;
|
|
49454
|
+
if (opensRowHref(e)) {
|
|
49455
|
+
const href = getRowHref?.(row);
|
|
49456
|
+
if (href) window.open(href, "_blank", "noopener");
|
|
49457
|
+
return;
|
|
49458
|
+
}
|
|
49459
|
+
openRow(row);
|
|
49460
|
+
},
|
|
49461
|
+
onRowAuxClick: (row, e) => {
|
|
49462
|
+
if (e.button !== 1 || rowEventTargetsInteractiveDescendant(e.target)) return;
|
|
49463
|
+
const href = getRowHref?.(row);
|
|
49464
|
+
if (href) {
|
|
49465
|
+
e.preventDefault();
|
|
49466
|
+
window.open(href, "_blank", "noopener");
|
|
49467
|
+
}
|
|
49468
|
+
},
|
|
49469
|
+
toggleRowSelected,
|
|
49470
|
+
toggleExpanded,
|
|
49471
|
+
openDetail,
|
|
49472
|
+
openWindow,
|
|
49473
|
+
commitCell,
|
|
49474
|
+
sheet,
|
|
49475
|
+
buildRecordControls
|
|
49476
|
+
};
|
|
49477
|
+
const liveRecordControls = (row) => {
|
|
49478
|
+
const drawn = buildRecordControls(row);
|
|
49479
|
+
const live = {};
|
|
49480
|
+
for (const [key, value] of Object.entries(drawn)) {
|
|
49481
|
+
live[key] = typeof value === "function" ? (...args) => {
|
|
49482
|
+
const now = rowLatest.current.buildRecordControls(row);
|
|
49483
|
+
const handler = now[key];
|
|
49484
|
+
return typeof handler === "function" ? handler(...args) : void 0;
|
|
49485
|
+
} : value;
|
|
49486
|
+
}
|
|
49487
|
+
return live;
|
|
49488
|
+
};
|
|
49489
|
+
const rowEpoch = useRenderEpoch([
|
|
49490
|
+
// WHAT A BODY ROW READS FROM THIS TABLE'S PROPS — and nothing it does not, so a host that
|
|
49491
|
+
// rebuilds its toolbar, its query or its empty state on every render redraws no row. Handlers
|
|
49492
|
+
// are absent on purpose: they run through `rowLatest`. Columns count by what a body cell
|
|
49493
|
+
// draws (`columnBodySignature`), never by the header's menus and filters.
|
|
49494
|
+
...columnBodySignature(visibleColumns),
|
|
49495
|
+
...renderedColumns.map(columnId),
|
|
49496
|
+
getRowId,
|
|
49497
|
+
selection !== void 0 && selection !== null,
|
|
49498
|
+
selection?.isRowSelectable,
|
|
49499
|
+
selectionNoun,
|
|
49500
|
+
windowConfig?.openOnRowClick,
|
|
49501
|
+
expandedDetail,
|
|
49502
|
+
hierarchy,
|
|
49503
|
+
cellClassName,
|
|
49504
|
+
rowClassName,
|
|
49505
|
+
rowWrapper,
|
|
49506
|
+
rowActions,
|
|
49507
|
+
tableStyle,
|
|
49508
|
+
zebra,
|
|
49509
|
+
resizableColumns,
|
|
49510
|
+
Boolean(onRowOpen),
|
|
49511
|
+
edit?.enabled,
|
|
49512
|
+
edit?.autoSave,
|
|
49513
|
+
Boolean(edit?.onSave),
|
|
49514
|
+
copy === void 0,
|
|
49515
|
+
explicitRowHeight,
|
|
49516
|
+
// …and the values of this component the row body reads.
|
|
49517
|
+
virtualizeActive,
|
|
49518
|
+
virtualRowHeight,
|
|
49519
|
+
// Widths and the frozen band by VALUE: both are re-derived whenever the host hands a new
|
|
49520
|
+
// columns array, with the same numbers in them.
|
|
49521
|
+
...Object.entries(effectiveColumnWidths).flat(),
|
|
49522
|
+
...Object.entries(frozenColumns.offsets).flat(),
|
|
49523
|
+
frozenColumns.selectionOffset,
|
|
49524
|
+
effectiveColumnWindow?.start,
|
|
49525
|
+
effectiveColumnWindow?.end,
|
|
49526
|
+
columnWindowWidth,
|
|
49527
|
+
frozenEdgeId,
|
|
49528
|
+
fixedTableGeometry,
|
|
49529
|
+
columnSpacers?.start,
|
|
49530
|
+
columnSpacers?.end,
|
|
49531
|
+
columnDragPreview,
|
|
49532
|
+
spreadsheetEnabled,
|
|
49533
|
+
editEnabled,
|
|
49534
|
+
detailEnabled,
|
|
49535
|
+
windowEnabled,
|
|
49536
|
+
opensWindowOnRowClick,
|
|
49537
|
+
showActionsCol,
|
|
49538
|
+
showInlineRowCopy,
|
|
49539
|
+
showRowCopy,
|
|
49540
|
+
rowCopyInMenu,
|
|
49541
|
+
effectiveCopy,
|
|
49542
|
+
tableCopySourceNamespace,
|
|
49543
|
+
renderedColSpan,
|
|
49544
|
+
hierarchyIndex,
|
|
49545
|
+
hierarchyBlockedIds,
|
|
49546
|
+
draggedRowId
|
|
49547
|
+
]);
|
|
49548
|
+
const rowFactsFor = (row, id, index) => {
|
|
49549
|
+
const pending = edits[id];
|
|
49550
|
+
let sheetFlags = "";
|
|
49551
|
+
if (spreadsheetEnabled) {
|
|
49552
|
+
for (const col of renderedColumns) {
|
|
49553
|
+
const cell = sheet.cellProps(id, columnId(col));
|
|
49554
|
+
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" : "-");
|
|
49555
|
+
}
|
|
49556
|
+
}
|
|
49557
|
+
return [
|
|
49558
|
+
selectedId === id,
|
|
49559
|
+
selectedIdSet.has(getSelectionId(row)),
|
|
49560
|
+
pending,
|
|
49561
|
+
highlightedIndex === index,
|
|
49562
|
+
editRequest?.rowId === id ? editRequest : null,
|
|
49563
|
+
Boolean(pending && edit?.onSave && !edit.autoSave && !saving),
|
|
49564
|
+
isRowExpanded(row),
|
|
49565
|
+
sheetFlags,
|
|
49566
|
+
...versionFacts(rowVersion?.(row))
|
|
49567
|
+
];
|
|
49568
|
+
};
|
|
49569
|
+
const renderRecordRow = (row, index) => {
|
|
49570
|
+
const id = getRowId(row);
|
|
49571
|
+
const isSelected = selectedId === id;
|
|
49572
|
+
const rowEdits = edits[id];
|
|
49573
|
+
const displayRow = applyRowEdits(row, rowEdits);
|
|
49574
|
+
const controls = liveRecordControls(displayRow);
|
|
49575
|
+
const isChecked = selectedIdSet.has(getSelectionId(row));
|
|
49576
|
+
const background = rowBackground({
|
|
49577
|
+
tint: rowTintColor(row, id),
|
|
49578
|
+
highlighted: highlightedIndex === index,
|
|
49579
|
+
selected: isSelected,
|
|
49580
|
+
checked: isChecked,
|
|
49581
|
+
zebraOdd: zebra && index % 2 === 1,
|
|
49582
|
+
hoverable: detailEnabled || Boolean(onRowOpen) || canExpandRow(row)
|
|
49583
|
+
});
|
|
49584
|
+
const canHoverFrozenCell = background.frozenHover;
|
|
49585
|
+
const frozenRowBackgroundClass = background.frozen;
|
|
49586
|
+
const rowNode = /* @__PURE__ */ jsxs37(
|
|
49587
|
+
"tr",
|
|
49588
|
+
{
|
|
49589
|
+
"data-row-id": id,
|
|
49590
|
+
style: explicitRowHeight !== void 0 ? { height: `${explicitRowHeight}px` } : virtualizeActive ? { height: `${virtualRowHeight}px` } : void 0,
|
|
49591
|
+
"data-state": isSelected ? "selected" : void 0,
|
|
49592
|
+
onClick: (e) => rowLatest.current.onRowClick(row, e),
|
|
49593
|
+
onAuxClick: (e) => rowLatest.current.onRowAuxClick(row, e),
|
|
49594
|
+
className: cn(
|
|
49595
|
+
// Keep the mobile row opaque while the complete row scrolls
|
|
49596
|
+
// horizontally. The translucent zebra/hover tints remain
|
|
49597
|
+
// desktop-only so densely layered mobile content stays crisp.
|
|
49598
|
+
"group/matrx-row border-b border-border/60 bg-card transition-colors",
|
|
49599
|
+
(detailEnabled || Boolean(onRowOpen) || canExpandRow(row)) && "cursor-pointer",
|
|
49600
|
+
rowClassName?.(row, index),
|
|
49601
|
+
draggedRowId === id && "opacity-40",
|
|
49602
|
+
// LAST, and decided once: tint, then highlight / open / ticked, then
|
|
49603
|
+
// the zebra stripe (./row-background.ts). Under a tint no stripe is
|
|
49604
|
+
// emitted at all, so no `sm:` class can win the cascade over it.
|
|
49605
|
+
background.row
|
|
49606
|
+
),
|
|
49607
|
+
children: [
|
|
49608
|
+
selection ? /* @__PURE__ */ jsx47(
|
|
49609
|
+
"td",
|
|
49610
|
+
{
|
|
49611
|
+
className: cn(
|
|
49612
|
+
"px-2 py-1.5 align-middle lg:py-0.5",
|
|
49613
|
+
// When a data column is frozen the checkbox
|
|
49614
|
+
// column has to freeze with it, or the first
|
|
49615
|
+
// frozen column slides over the checkboxes.
|
|
49616
|
+
frozenColumns.selectionOffset !== null && cn(
|
|
49617
|
+
"sm:sticky sm:left-0 sm:z-20",
|
|
49618
|
+
frozenRowBackgroundClass,
|
|
49619
|
+
canHoverFrozenCell && "sm:group-hover/matrx-row:bg-[color-mix(in_oklab,var(--color-muted)_50%,var(--color-card))]"
|
|
49620
|
+
)
|
|
49621
|
+
),
|
|
49622
|
+
style: fixedUtilityWidth(fixedTableGeometry?.selectionWidth),
|
|
49623
|
+
onClick: (e) => e.stopPropagation(),
|
|
49624
|
+
children: selection.isRowSelectable?.(row) ?? true ? /* @__PURE__ */ jsx47(
|
|
49625
|
+
"div",
|
|
49626
|
+
{
|
|
49627
|
+
"data-matrx-table-selection-target": true,
|
|
49628
|
+
onClick: (event) => {
|
|
49629
|
+
if (event.target === event.currentTarget) {
|
|
49630
|
+
event.currentTarget.querySelector('[role="checkbox"]')?.click();
|
|
49631
|
+
}
|
|
49632
|
+
},
|
|
49633
|
+
children: /* @__PURE__ */ jsx47(
|
|
49634
|
+
Checkbox,
|
|
49635
|
+
{
|
|
49636
|
+
className: CHECKBOX_TAP_AREA,
|
|
49637
|
+
checked: isChecked,
|
|
49638
|
+
"aria-label": `Select this ${selectionNoun}`,
|
|
49639
|
+
onClick: (e) => rowLatest.current.toggleRowSelected(index, e.shiftKey)
|
|
49640
|
+
}
|
|
49641
|
+
)
|
|
49642
|
+
}
|
|
49643
|
+
) : null
|
|
49644
|
+
}
|
|
49645
|
+
) : null,
|
|
49646
|
+
columnSpacers && columnSpacers.start > 0 ? /* @__PURE__ */ jsx47(
|
|
49647
|
+
"td",
|
|
49648
|
+
{
|
|
49649
|
+
"aria-hidden": "true",
|
|
49650
|
+
"data-matrx-table-column-spacer": "start",
|
|
49651
|
+
className: "border-0 p-0",
|
|
49652
|
+
style: { width: `${columnSpacers.start}px`, minWidth: `${columnSpacers.start}px` }
|
|
49653
|
+
},
|
|
49654
|
+
"matrx-column-spacer-start"
|
|
49655
|
+
) : null,
|
|
49656
|
+
renderedColumns.map((col, colIdx) => {
|
|
49657
|
+
const isColumnDragShadow = columnDragPreview?.draggedId === columnId(col) && columnDragPreview.targetId !== null;
|
|
49658
|
+
const sheetCell = spreadsheetEnabled ? sheet.cellProps(id, columnId(col)) : null;
|
|
49659
|
+
const carriesFillHandle = sheetCell !== null && sheet.isFillHandleCell(id, columnId(col));
|
|
49660
|
+
const frozen = frozenColumns.offsets[columnId(col)] !== void 0;
|
|
49661
|
+
const frozenCellTint = cellTintColor(
|
|
49662
|
+
row,
|
|
49663
|
+
id,
|
|
49664
|
+
columnId(col)
|
|
49665
|
+
);
|
|
49666
|
+
return /* @__PURE__ */ jsxs37(
|
|
49667
|
+
"td",
|
|
49668
|
+
{
|
|
49669
|
+
"data-matrx-table-column-id": columnId(col),
|
|
49670
|
+
"data-matrx-column-drag-shadow": isColumnDragShadow ? "true" : void 0,
|
|
49671
|
+
...sheetCell ? {
|
|
49672
|
+
"data-matrx-cell-row": sheetCell["data-matrx-cell-row"],
|
|
49673
|
+
"data-matrx-cell-col": sheetCell["data-matrx-cell-col"],
|
|
49674
|
+
...sheetCell["data-matrx-cell-selected"] ? { "data-matrx-cell-selected": "true" } : {},
|
|
49675
|
+
...sheetCell["data-matrx-cell-active"] ? { "data-matrx-cell-active": "true" } : {},
|
|
49676
|
+
...sheetCell["data-matrx-cell-fill-preview"] ? { "data-matrx-cell-fill-preview": "true" } : {},
|
|
49677
|
+
// Handlers read the grid as it is NOW: a row the memo kept must
|
|
49678
|
+
// never act on the selection it was drawn with.
|
|
49679
|
+
onMouseDown: (event) => rowLatest.current.sheet.cellProps(id, columnId(col)).onMouseDown(event),
|
|
49680
|
+
onMouseEnter: () => rowLatest.current.sheet.cellProps(id, columnId(col)).onMouseEnter()
|
|
49681
|
+
} : {},
|
|
49682
|
+
className: cn(
|
|
49683
|
+
"py-1.5 align-middle lg:py-0.5",
|
|
49684
|
+
sheetCell?.["data-matrx-cell-selected"] && "bg-primary/10",
|
|
49685
|
+
sheetCell?.["data-matrx-cell-fill-preview"] && "ring-1 ring-inset ring-primary/40",
|
|
49686
|
+
sheetCell?.["data-matrx-cell-active"] && "relative z-10 ring-2 ring-inset ring-primary",
|
|
49687
|
+
carriesFillHandle && "relative",
|
|
49688
|
+
col.compact || resolveColumnMarker(col) !== void 0 ? "px-1" : "px-2",
|
|
49689
|
+
// nowrap (NOT truncate — truncate clips the cell and
|
|
49690
|
+
// defeats w-max, killing the horizontal scroll).
|
|
49691
|
+
"max-sm:whitespace-nowrap",
|
|
49692
|
+
col.mobileHidden && "max-sm:hidden",
|
|
49693
|
+
((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)]",
|
|
49694
|
+
col.className,
|
|
49695
|
+
isColumnDragShadow && "bg-primary/10 shadow-[inset_2px_0_0_var(--primary),inset_-2px_0_0_var(--primary)]",
|
|
49696
|
+
alignForFormat(col) === "center" && "text-center",
|
|
49697
|
+
alignForFormat(col) === "right" && "text-right",
|
|
49698
|
+
frozen && FROZEN_CELL_CLASS,
|
|
49699
|
+
frozen && frozenRowBackgroundClass,
|
|
49700
|
+
frozen && sheetCell?.["data-matrx-cell-selected"] && "sm:bg-[color-mix(in_oklab,var(--color-primary)_10%,var(--color-card))]",
|
|
49701
|
+
frozen && canHoverFrozenCell && "sm:group-hover/matrx-row:bg-[color-mix(in_oklab,var(--color-muted)_50%,var(--color-card))]",
|
|
49702
|
+
frozenEdgeId === columnId(col) && FROZEN_EDGE_CLASS,
|
|
49703
|
+
// A cell tint paints OVER the row tint beneath
|
|
49704
|
+
// it, and the consumer's own hook comes last so
|
|
49705
|
+
// it can always win.
|
|
49706
|
+
cellTintClass(row, id, columnId(col)),
|
|
49707
|
+
frozen && frozenCellTint && FROZEN_CELL_TINT_CLASS[frozenCellTint],
|
|
49708
|
+
cellClassName?.(row, columnId(col), index)
|
|
49709
|
+
),
|
|
49710
|
+
style: {
|
|
49711
|
+
...columnWidthVar(
|
|
49712
|
+
resolveColumnMarker(col) && col.width === void 0 ? 40 : col.width,
|
|
49713
|
+
windowedWidthFor(columnId(col), col.width),
|
|
49714
|
+
columnId(col),
|
|
49715
|
+
resizableColumns && col.resizable !== false
|
|
49716
|
+
),
|
|
49717
|
+
...frozenStyle(columnId(col))
|
|
49718
|
+
},
|
|
49719
|
+
children: [
|
|
49720
|
+
/* @__PURE__ */ jsxs37(
|
|
49721
|
+
"div",
|
|
49722
|
+
{
|
|
49723
|
+
className: cn(
|
|
49724
|
+
colIdx === 0 && (hierarchy || canExpandRow(row)) && "flex min-w-0 items-center"
|
|
49725
|
+
),
|
|
49726
|
+
children: [
|
|
49727
|
+
colIdx === 0 && hierarchy ? /* @__PURE__ */ jsx47(
|
|
49728
|
+
HierarchyDragHandle,
|
|
49729
|
+
{
|
|
49730
|
+
id,
|
|
49731
|
+
label: hierarchy.itemLabel?.(row) ?? "row",
|
|
49732
|
+
disabled: !(hierarchy.canReparent?.(row) ?? true)
|
|
49733
|
+
}
|
|
49734
|
+
) : null,
|
|
49735
|
+
colIdx === 0 && canExpandRow(row) ? /* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
49736
|
+
/* @__PURE__ */ jsx47(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx47(
|
|
49737
|
+
Button,
|
|
49738
|
+
{
|
|
49739
|
+
type: "button",
|
|
49740
|
+
variant: "ghost",
|
|
49741
|
+
size: "icon",
|
|
49742
|
+
"data-matrx-table-expand-toggle": true,
|
|
49743
|
+
className: "mr-1 h-7 w-7 shrink-0 text-muted-foreground hover:text-foreground [&_svg]:size-4",
|
|
49744
|
+
"aria-label": isRowExpanded(row) ? "Collapse row details" : "Expand row details",
|
|
49745
|
+
"aria-expanded": isRowExpanded(row),
|
|
49746
|
+
onClick: (event) => {
|
|
49747
|
+
event.stopPropagation();
|
|
49748
|
+
rowLatest.current.toggleExpanded(row);
|
|
49749
|
+
},
|
|
49750
|
+
onKeyDown: (event) => {
|
|
49751
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
49752
|
+
event.preventDefault();
|
|
49753
|
+
event.stopPropagation();
|
|
49754
|
+
rowLatest.current.toggleExpanded(row);
|
|
49755
|
+
},
|
|
49756
|
+
children: /* @__PURE__ */ jsx47(
|
|
49757
|
+
ChevronRight,
|
|
49758
|
+
{
|
|
49759
|
+
className: cn(
|
|
49760
|
+
"transition-transform",
|
|
49761
|
+
isRowExpanded(row) && "rotate-90"
|
|
49762
|
+
)
|
|
49763
|
+
}
|
|
49764
|
+
)
|
|
49765
|
+
}
|
|
49766
|
+
) }),
|
|
49767
|
+
/* @__PURE__ */ jsx47(TooltipContent, { children: isRowExpanded(row) ? "Collapse details" : "Expand details" })
|
|
49768
|
+
] }) : null,
|
|
49769
|
+
/* @__PURE__ */ jsx47(
|
|
49770
|
+
"div",
|
|
49771
|
+
{
|
|
49772
|
+
"data-matrx-cell-content": true,
|
|
49773
|
+
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",
|
|
49774
|
+
children: renderRecordCell(row, col, index)
|
|
49775
|
+
}
|
|
49776
|
+
)
|
|
49777
|
+
]
|
|
49778
|
+
}
|
|
49779
|
+
),
|
|
49780
|
+
carriesFillHandle ? /* @__PURE__ */ jsx47(
|
|
49781
|
+
"button",
|
|
49782
|
+
{
|
|
49783
|
+
type: "button",
|
|
49784
|
+
"data-matrx-table-fill-handle": true,
|
|
49785
|
+
"aria-label": "Drag to fill the cells below or beside this selection",
|
|
49786
|
+
onMouseDown: (event) => rowLatest.current.sheet.startFillDrag(event),
|
|
49787
|
+
className: "absolute -bottom-[3px] -right-[3px] z-20 h-2 w-2 cursor-crosshair rounded-[1px] border border-background bg-primary"
|
|
49788
|
+
}
|
|
49789
|
+
) : null
|
|
49790
|
+
]
|
|
49791
|
+
},
|
|
49792
|
+
columnId(col)
|
|
49793
|
+
);
|
|
49794
|
+
}),
|
|
49795
|
+
columnSpacers && columnSpacers.end > 0 ? /* @__PURE__ */ jsx47(
|
|
49796
|
+
"td",
|
|
49797
|
+
{
|
|
49798
|
+
"aria-hidden": "true",
|
|
49799
|
+
"data-matrx-table-column-spacer": "end",
|
|
49800
|
+
className: "border-0 p-0",
|
|
49801
|
+
style: { width: `${columnSpacers.end}px`, minWidth: `${columnSpacers.end}px` }
|
|
49802
|
+
},
|
|
49803
|
+
"matrx-column-spacer-end"
|
|
49804
|
+
) : null,
|
|
49805
|
+
showActionsCol && /* @__PURE__ */ jsx47(
|
|
49806
|
+
"td",
|
|
49807
|
+
{
|
|
49808
|
+
"data-matrx-table-row-action-cell": true,
|
|
49809
|
+
className: "text-right align-middle",
|
|
49810
|
+
style: fixedUtilityWidth(fixedTableGeometry?.actionsWidth),
|
|
49811
|
+
children: /* @__PURE__ */ jsxs37(
|
|
49812
|
+
"div",
|
|
49813
|
+
{
|
|
49814
|
+
"data-matrx-table-row-actions": true,
|
|
49815
|
+
className: "inline-flex items-center justify-end gap-0",
|
|
49816
|
+
onClick: (e) => e.stopPropagation(),
|
|
49817
|
+
children: [
|
|
49818
|
+
showInlineRowCopy && effectiveCopy ? /* @__PURE__ */ jsx47(
|
|
49819
|
+
TableRowCopyControl,
|
|
49820
|
+
{
|
|
49821
|
+
size: "toolbar",
|
|
49822
|
+
copy: effectiveCopy,
|
|
49823
|
+
row: displayRow,
|
|
49824
|
+
sourceId: `${tableCopySourceNamespace}:row:${getRowId(displayRow)}`,
|
|
49825
|
+
...copy === void 0 ? { defaultColumns: declaredVisibleCopyColumns } : {}
|
|
49826
|
+
}
|
|
49827
|
+
) : null,
|
|
49828
|
+
renderRowActions(displayRow, controls),
|
|
49829
|
+
windowEnabled ? /* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
49830
|
+
/* @__PURE__ */ jsx47(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx47(
|
|
49831
|
+
Button,
|
|
49832
|
+
{
|
|
49833
|
+
type: "button",
|
|
49834
|
+
variant: "ghost",
|
|
49835
|
+
size: "icon",
|
|
49836
|
+
"data-matrx-table-icon-action": true,
|
|
49837
|
+
className: "h-11 w-11 text-muted-foreground hover:text-foreground [&_svg]:size-5",
|
|
49838
|
+
"aria-label": windowConfig?.openOnRowClick === true ? "Open in side panel" : "Open in window",
|
|
49839
|
+
onClick: (e) => {
|
|
49840
|
+
e.stopPropagation();
|
|
49841
|
+
if (windowConfig?.openOnRowClick === true) rowLatest.current.openDetail(row);
|
|
49842
|
+
else rowLatest.current.openWindow(row);
|
|
49843
|
+
},
|
|
49844
|
+
children: opensWindowOnRowClick ? /* @__PURE__ */ jsx47(PanelRightOpen, { className: "h-5 w-5" }) : /* @__PURE__ */ jsx47(PanelRight, { className: "h-5 w-5" })
|
|
49845
|
+
}
|
|
49846
|
+
) }),
|
|
49847
|
+
/* @__PURE__ */ jsx47(TooltipContent, { children: windowConfig?.openOnRowClick === true ? "Open in side panel" : "Open in window" })
|
|
49848
|
+
] }) : null
|
|
49849
|
+
]
|
|
49850
|
+
}
|
|
49851
|
+
)
|
|
49852
|
+
}
|
|
49853
|
+
)
|
|
49854
|
+
]
|
|
49855
|
+
},
|
|
49856
|
+
id
|
|
49857
|
+
);
|
|
49858
|
+
const wrappedRow = rowWrapper ? rowWrapper(row, rowNode) : rowNode;
|
|
49859
|
+
const inlineDetail = expandedDetail && isRowExpanded(row) ? /* @__PURE__ */ jsx47(
|
|
49860
|
+
"tr",
|
|
49861
|
+
{
|
|
49862
|
+
"data-matrx-table-expanded-detail": id,
|
|
49863
|
+
className: cn("bg-muted/20", expandedDetail.className),
|
|
49864
|
+
children: /* @__PURE__ */ jsx47(
|
|
49865
|
+
"td",
|
|
49866
|
+
{
|
|
49867
|
+
colSpan: renderedColSpan,
|
|
49868
|
+
className: "p-4",
|
|
49869
|
+
children: expandedDetail.render(displayRow, controls)
|
|
49870
|
+
}
|
|
49871
|
+
)
|
|
49872
|
+
},
|
|
49873
|
+
`${id}:expanded-detail`
|
|
49874
|
+
) : null;
|
|
49875
|
+
return hierarchy ? /* @__PURE__ */ jsxs37(Fragment9, { children: [
|
|
49876
|
+
/* @__PURE__ */ jsx47(
|
|
49877
|
+
HierarchyDroppableRow,
|
|
49878
|
+
{
|
|
49879
|
+
id,
|
|
49880
|
+
disabled: !canDropOn(row),
|
|
49881
|
+
children: wrappedRow
|
|
49882
|
+
}
|
|
49883
|
+
),
|
|
49884
|
+
inlineDetail
|
|
49885
|
+
] }, id) : /* @__PURE__ */ jsxs37(Fragment9, { children: [
|
|
49886
|
+
wrappedRow,
|
|
49887
|
+
inlineDetail
|
|
49888
|
+
] }, id);
|
|
49889
|
+
};
|
|
49401
49890
|
return /* @__PURE__ */ jsx47(TooltipProvider, { children: /* @__PURE__ */ jsx47(
|
|
49402
49891
|
ContextMenuBoundary,
|
|
49403
49892
|
{
|
|
@@ -50295,338 +50784,18 @@ function MatrxDataTableCore({
|
|
|
50295
50784
|
const row = entry.row;
|
|
50296
50785
|
const index = entry.index;
|
|
50297
50786
|
const id = getRowId(row);
|
|
50298
|
-
|
|
50299
|
-
|
|
50300
|
-
const displayRow = applyRowEdits(row, rowEdits);
|
|
50301
|
-
const controls = buildRecordControls(displayRow);
|
|
50302
|
-
const isChecked = selectedIdSet.has(getSelectionId(row));
|
|
50303
|
-
const background = rowBackground({
|
|
50304
|
-
tint: rowTintColor(row, id),
|
|
50305
|
-
highlighted: highlightedIndex === index,
|
|
50306
|
-
selected: isSelected,
|
|
50307
|
-
checked: isChecked,
|
|
50308
|
-
zebraOdd: zebra && index % 2 === 1,
|
|
50309
|
-
hoverable: detailEnabled || Boolean(onRowOpen) || canExpandRow(row)
|
|
50310
|
-
});
|
|
50311
|
-
const canHoverFrozenCell = background.frozenHover;
|
|
50312
|
-
const frozenRowBackgroundClass = background.frozen;
|
|
50313
|
-
const rowNode = /* @__PURE__ */ jsxs37(
|
|
50314
|
-
"tr",
|
|
50787
|
+
return /* @__PURE__ */ jsx47(
|
|
50788
|
+
MatrxTableBodyRow,
|
|
50315
50789
|
{
|
|
50316
|
-
|
|
50317
|
-
|
|
50318
|
-
|
|
50319
|
-
|
|
50320
|
-
|
|
50321
|
-
|
|
50322
|
-
if (opensRowHref(e)) {
|
|
50323
|
-
const href = getRowHref?.(row);
|
|
50324
|
-
if (href) window.open(href, "_blank", "noopener");
|
|
50325
|
-
return;
|
|
50326
|
-
}
|
|
50327
|
-
openRow(row);
|
|
50328
|
-
},
|
|
50329
|
-
onAuxClick: (e) => {
|
|
50330
|
-
if (e.button !== 1 || rowEventTargetsInteractiveDescendant(e.target)) return;
|
|
50331
|
-
const href = getRowHref?.(row);
|
|
50332
|
-
if (href) {
|
|
50333
|
-
e.preventDefault();
|
|
50334
|
-
window.open(href, "_blank", "noopener");
|
|
50335
|
-
}
|
|
50336
|
-
},
|
|
50337
|
-
className: cn(
|
|
50338
|
-
// Keep the mobile row opaque while the complete row scrolls
|
|
50339
|
-
// horizontally. The translucent zebra/hover tints remain
|
|
50340
|
-
// desktop-only so densely layered mobile content stays crisp.
|
|
50341
|
-
"group/matrx-row border-b border-border/60 bg-card transition-colors",
|
|
50342
|
-
(detailEnabled || Boolean(onRowOpen) || canExpandRow(row)) && "cursor-pointer",
|
|
50343
|
-
rowClassName?.(row, index),
|
|
50344
|
-
draggedRowId === id && "opacity-40",
|
|
50345
|
-
// LAST, and decided once: tint, then highlight / open / ticked, then
|
|
50346
|
-
// the zebra stripe (./row-background.ts). Under a tint no stripe is
|
|
50347
|
-
// emitted at all, so no `sm:` class can win the cascade over it.
|
|
50348
|
-
background.row
|
|
50349
|
-
),
|
|
50350
|
-
children: [
|
|
50351
|
-
selection ? /* @__PURE__ */ jsx47(
|
|
50352
|
-
"td",
|
|
50353
|
-
{
|
|
50354
|
-
className: cn(
|
|
50355
|
-
"px-2 py-1.5 align-middle lg:py-0.5",
|
|
50356
|
-
// When a data column is frozen the checkbox
|
|
50357
|
-
// column has to freeze with it, or the first
|
|
50358
|
-
// frozen column slides over the checkboxes.
|
|
50359
|
-
frozenColumns.selectionOffset !== null && cn(
|
|
50360
|
-
"sm:sticky sm:left-0 sm:z-20",
|
|
50361
|
-
frozenRowBackgroundClass,
|
|
50362
|
-
canHoverFrozenCell && "sm:group-hover/matrx-row:bg-[color-mix(in_oklab,var(--color-muted)_50%,var(--color-card))]"
|
|
50363
|
-
)
|
|
50364
|
-
),
|
|
50365
|
-
style: fixedUtilityWidth(fixedTableGeometry?.selectionWidth),
|
|
50366
|
-
onClick: (e) => e.stopPropagation(),
|
|
50367
|
-
children: selection.isRowSelectable?.(row) ?? true ? /* @__PURE__ */ jsx47(
|
|
50368
|
-
"div",
|
|
50369
|
-
{
|
|
50370
|
-
"data-matrx-table-selection-target": true,
|
|
50371
|
-
onClick: (event) => {
|
|
50372
|
-
if (event.target === event.currentTarget) {
|
|
50373
|
-
event.currentTarget.querySelector('[role="checkbox"]')?.click();
|
|
50374
|
-
}
|
|
50375
|
-
},
|
|
50376
|
-
children: /* @__PURE__ */ jsx47(
|
|
50377
|
-
Checkbox,
|
|
50378
|
-
{
|
|
50379
|
-
className: CHECKBOX_TAP_AREA,
|
|
50380
|
-
checked: isChecked,
|
|
50381
|
-
"aria-label": `Select this ${selectionNoun}`,
|
|
50382
|
-
onClick: (e) => toggleRowSelected(index, e.shiftKey)
|
|
50383
|
-
}
|
|
50384
|
-
)
|
|
50385
|
-
}
|
|
50386
|
-
) : null
|
|
50387
|
-
}
|
|
50388
|
-
) : null,
|
|
50389
|
-
columnSpacers && columnSpacers.start > 0 ? /* @__PURE__ */ jsx47(
|
|
50390
|
-
"td",
|
|
50391
|
-
{
|
|
50392
|
-
"aria-hidden": "true",
|
|
50393
|
-
"data-matrx-table-column-spacer": "start",
|
|
50394
|
-
className: "border-0 p-0",
|
|
50395
|
-
style: { width: `${columnSpacers.start}px`, minWidth: `${columnSpacers.start}px` }
|
|
50396
|
-
},
|
|
50397
|
-
"matrx-column-spacer-start"
|
|
50398
|
-
) : null,
|
|
50399
|
-
renderedColumns.map((col, colIdx) => {
|
|
50400
|
-
const isColumnDragShadow = columnDragPreview?.draggedId === columnId(col) && columnDragPreview.targetId !== null;
|
|
50401
|
-
const sheetCell = spreadsheetEnabled ? sheet.cellProps(id, columnId(col)) : null;
|
|
50402
|
-
const carriesFillHandle = sheetCell !== null && sheet.isFillHandleCell(id, columnId(col));
|
|
50403
|
-
const frozen = frozenColumns.offsets[columnId(col)] !== void 0;
|
|
50404
|
-
const frozenCellTint = cellTintColor(
|
|
50405
|
-
row,
|
|
50406
|
-
id,
|
|
50407
|
-
columnId(col)
|
|
50408
|
-
);
|
|
50409
|
-
return /* @__PURE__ */ jsxs37(
|
|
50410
|
-
"td",
|
|
50411
|
-
{
|
|
50412
|
-
"data-matrx-table-column-id": columnId(col),
|
|
50413
|
-
"data-matrx-column-drag-shadow": isColumnDragShadow ? "true" : void 0,
|
|
50414
|
-
...sheetCell ? {
|
|
50415
|
-
"data-matrx-cell-row": sheetCell["data-matrx-cell-row"],
|
|
50416
|
-
"data-matrx-cell-col": sheetCell["data-matrx-cell-col"],
|
|
50417
|
-
...sheetCell["data-matrx-cell-selected"] ? { "data-matrx-cell-selected": "true" } : {},
|
|
50418
|
-
...sheetCell["data-matrx-cell-active"] ? { "data-matrx-cell-active": "true" } : {},
|
|
50419
|
-
...sheetCell["data-matrx-cell-fill-preview"] ? { "data-matrx-cell-fill-preview": "true" } : {},
|
|
50420
|
-
onMouseDown: sheetCell.onMouseDown,
|
|
50421
|
-
onMouseEnter: sheetCell.onMouseEnter
|
|
50422
|
-
} : {},
|
|
50423
|
-
className: cn(
|
|
50424
|
-
"py-1.5 align-middle lg:py-0.5",
|
|
50425
|
-
sheetCell?.["data-matrx-cell-selected"] && "bg-primary/10",
|
|
50426
|
-
sheetCell?.["data-matrx-cell-fill-preview"] && "ring-1 ring-inset ring-primary/40",
|
|
50427
|
-
sheetCell?.["data-matrx-cell-active"] && "relative z-10 ring-2 ring-inset ring-primary",
|
|
50428
|
-
carriesFillHandle && "relative",
|
|
50429
|
-
col.compact || resolveColumnMarker(col) !== void 0 ? "px-1" : "px-2",
|
|
50430
|
-
// nowrap (NOT truncate — truncate clips the cell and
|
|
50431
|
-
// defeats w-max, killing the horizontal scroll).
|
|
50432
|
-
"max-sm:whitespace-nowrap",
|
|
50433
|
-
col.mobileHidden && "max-sm:hidden",
|
|
50434
|
-
((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)]",
|
|
50435
|
-
col.className,
|
|
50436
|
-
isColumnDragShadow && "bg-primary/10 shadow-[inset_2px_0_0_var(--primary),inset_-2px_0_0_var(--primary)]",
|
|
50437
|
-
alignForFormat(col) === "center" && "text-center",
|
|
50438
|
-
alignForFormat(col) === "right" && "text-right",
|
|
50439
|
-
frozen && FROZEN_CELL_CLASS,
|
|
50440
|
-
frozen && frozenRowBackgroundClass,
|
|
50441
|
-
frozen && sheetCell?.["data-matrx-cell-selected"] && "sm:bg-[color-mix(in_oklab,var(--color-primary)_10%,var(--color-card))]",
|
|
50442
|
-
frozen && canHoverFrozenCell && "sm:group-hover/matrx-row:bg-[color-mix(in_oklab,var(--color-muted)_50%,var(--color-card))]",
|
|
50443
|
-
frozenEdgeId === columnId(col) && FROZEN_EDGE_CLASS,
|
|
50444
|
-
// A cell tint paints OVER the row tint beneath
|
|
50445
|
-
// it, and the consumer's own hook comes last so
|
|
50446
|
-
// it can always win.
|
|
50447
|
-
cellTintClass(row, id, columnId(col)),
|
|
50448
|
-
frozen && frozenCellTint && FROZEN_CELL_TINT_CLASS[frozenCellTint],
|
|
50449
|
-
cellClassName?.(row, columnId(col), index)
|
|
50450
|
-
),
|
|
50451
|
-
style: {
|
|
50452
|
-
...columnWidthVar(
|
|
50453
|
-
resolveColumnMarker(col) && col.width === void 0 ? 40 : col.width,
|
|
50454
|
-
windowedWidthFor(columnId(col), col.width),
|
|
50455
|
-
columnId(col),
|
|
50456
|
-
resizableColumns && col.resizable !== false
|
|
50457
|
-
),
|
|
50458
|
-
...frozenStyle(columnId(col))
|
|
50459
|
-
},
|
|
50460
|
-
children: [
|
|
50461
|
-
/* @__PURE__ */ jsxs37(
|
|
50462
|
-
"div",
|
|
50463
|
-
{
|
|
50464
|
-
className: cn(
|
|
50465
|
-
colIdx === 0 && (hierarchy || canExpandRow(row)) && "flex min-w-0 items-center"
|
|
50466
|
-
),
|
|
50467
|
-
children: [
|
|
50468
|
-
colIdx === 0 && hierarchy ? /* @__PURE__ */ jsx47(
|
|
50469
|
-
HierarchyDragHandle,
|
|
50470
|
-
{
|
|
50471
|
-
id,
|
|
50472
|
-
label: hierarchy.itemLabel?.(row) ?? "row",
|
|
50473
|
-
disabled: !(hierarchy.canReparent?.(row) ?? true)
|
|
50474
|
-
}
|
|
50475
|
-
) : null,
|
|
50476
|
-
colIdx === 0 && canExpandRow(row) ? /* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
50477
|
-
/* @__PURE__ */ jsx47(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx47(
|
|
50478
|
-
Button,
|
|
50479
|
-
{
|
|
50480
|
-
type: "button",
|
|
50481
|
-
variant: "ghost",
|
|
50482
|
-
size: "icon",
|
|
50483
|
-
"data-matrx-table-expand-toggle": true,
|
|
50484
|
-
className: "mr-1 h-7 w-7 shrink-0 text-muted-foreground hover:text-foreground [&_svg]:size-4",
|
|
50485
|
-
"aria-label": isRowExpanded(row) ? "Collapse row details" : "Expand row details",
|
|
50486
|
-
"aria-expanded": isRowExpanded(row),
|
|
50487
|
-
onClick: (event) => {
|
|
50488
|
-
event.stopPropagation();
|
|
50489
|
-
toggleExpanded(row);
|
|
50490
|
-
},
|
|
50491
|
-
onKeyDown: (event) => {
|
|
50492
|
-
if (event.key !== "Enter" && event.key !== " ") return;
|
|
50493
|
-
event.preventDefault();
|
|
50494
|
-
event.stopPropagation();
|
|
50495
|
-
toggleExpanded(row);
|
|
50496
|
-
},
|
|
50497
|
-
children: /* @__PURE__ */ jsx47(
|
|
50498
|
-
ChevronRight,
|
|
50499
|
-
{
|
|
50500
|
-
className: cn(
|
|
50501
|
-
"transition-transform",
|
|
50502
|
-
isRowExpanded(row) && "rotate-90"
|
|
50503
|
-
)
|
|
50504
|
-
}
|
|
50505
|
-
)
|
|
50506
|
-
}
|
|
50507
|
-
) }),
|
|
50508
|
-
/* @__PURE__ */ jsx47(TooltipContent, { children: isRowExpanded(row) ? "Collapse details" : "Expand details" })
|
|
50509
|
-
] }) : null,
|
|
50510
|
-
/* @__PURE__ */ jsx47(
|
|
50511
|
-
"div",
|
|
50512
|
-
{
|
|
50513
|
-
"data-matrx-cell-content": true,
|
|
50514
|
-
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",
|
|
50515
|
-
children: renderRecordCell(row, col, index)
|
|
50516
|
-
}
|
|
50517
|
-
)
|
|
50518
|
-
]
|
|
50519
|
-
}
|
|
50520
|
-
),
|
|
50521
|
-
carriesFillHandle ? /* @__PURE__ */ jsx47(
|
|
50522
|
-
"button",
|
|
50523
|
-
{
|
|
50524
|
-
type: "button",
|
|
50525
|
-
"data-matrx-table-fill-handle": true,
|
|
50526
|
-
"aria-label": "Drag to fill the cells below or beside this selection",
|
|
50527
|
-
onMouseDown: sheet.startFillDrag,
|
|
50528
|
-
className: "absolute -bottom-[3px] -right-[3px] z-20 h-2 w-2 cursor-crosshair rounded-[1px] border border-background bg-primary"
|
|
50529
|
-
}
|
|
50530
|
-
) : null
|
|
50531
|
-
]
|
|
50532
|
-
},
|
|
50533
|
-
columnId(col)
|
|
50534
|
-
);
|
|
50535
|
-
}),
|
|
50536
|
-
columnSpacers && columnSpacers.end > 0 ? /* @__PURE__ */ jsx47(
|
|
50537
|
-
"td",
|
|
50538
|
-
{
|
|
50539
|
-
"aria-hidden": "true",
|
|
50540
|
-
"data-matrx-table-column-spacer": "end",
|
|
50541
|
-
className: "border-0 p-0",
|
|
50542
|
-
style: { width: `${columnSpacers.end}px`, minWidth: `${columnSpacers.end}px` }
|
|
50543
|
-
},
|
|
50544
|
-
"matrx-column-spacer-end"
|
|
50545
|
-
) : null,
|
|
50546
|
-
showActionsCol && /* @__PURE__ */ jsx47(
|
|
50547
|
-
"td",
|
|
50548
|
-
{
|
|
50549
|
-
"data-matrx-table-row-action-cell": true,
|
|
50550
|
-
className: "text-right align-middle",
|
|
50551
|
-
style: fixedUtilityWidth(fixedTableGeometry?.actionsWidth),
|
|
50552
|
-
children: /* @__PURE__ */ jsxs37(
|
|
50553
|
-
"div",
|
|
50554
|
-
{
|
|
50555
|
-
"data-matrx-table-row-actions": true,
|
|
50556
|
-
className: "inline-flex items-center justify-end gap-0",
|
|
50557
|
-
onClick: (e) => e.stopPropagation(),
|
|
50558
|
-
children: [
|
|
50559
|
-
showInlineRowCopy && effectiveCopy ? /* @__PURE__ */ jsx47(
|
|
50560
|
-
TableRowCopyControl,
|
|
50561
|
-
{
|
|
50562
|
-
size: "toolbar",
|
|
50563
|
-
copy: effectiveCopy,
|
|
50564
|
-
row: displayRow,
|
|
50565
|
-
sourceId: `${tableCopySourceNamespace}:row:${getRowId(displayRow)}`,
|
|
50566
|
-
...copy === void 0 ? { defaultColumns: declaredVisibleCopyColumns } : {}
|
|
50567
|
-
}
|
|
50568
|
-
) : null,
|
|
50569
|
-
renderRowActions(displayRow, controls),
|
|
50570
|
-
windowEnabled ? /* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
50571
|
-
/* @__PURE__ */ jsx47(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx47(
|
|
50572
|
-
Button,
|
|
50573
|
-
{
|
|
50574
|
-
type: "button",
|
|
50575
|
-
variant: "ghost",
|
|
50576
|
-
size: "icon",
|
|
50577
|
-
"data-matrx-table-icon-action": true,
|
|
50578
|
-
className: "h-11 w-11 text-muted-foreground hover:text-foreground [&_svg]:size-5",
|
|
50579
|
-
"aria-label": windowConfig?.openOnRowClick === true ? "Open in side panel" : "Open in window",
|
|
50580
|
-
onClick: (e) => {
|
|
50581
|
-
e.stopPropagation();
|
|
50582
|
-
if (windowConfig?.openOnRowClick === true) openDetail(row);
|
|
50583
|
-
else openWindow(row);
|
|
50584
|
-
},
|
|
50585
|
-
children: opensWindowOnRowClick ? /* @__PURE__ */ jsx47(PanelRightOpen, { className: "h-5 w-5" }) : /* @__PURE__ */ jsx47(PanelRight, { className: "h-5 w-5" })
|
|
50586
|
-
}
|
|
50587
|
-
) }),
|
|
50588
|
-
/* @__PURE__ */ jsx47(TooltipContent, { children: windowConfig?.openOnRowClick === true ? "Open in side panel" : "Open in window" })
|
|
50589
|
-
] }) : null
|
|
50590
|
-
]
|
|
50591
|
-
}
|
|
50592
|
-
)
|
|
50593
|
-
}
|
|
50594
|
-
)
|
|
50595
|
-
]
|
|
50790
|
+
rowId: id,
|
|
50791
|
+
row,
|
|
50792
|
+
index,
|
|
50793
|
+
epoch: rowEpoch,
|
|
50794
|
+
facts: rowFactsFor(row, id, index),
|
|
50795
|
+
render: renderRecordRow
|
|
50596
50796
|
},
|
|
50597
50797
|
id
|
|
50598
50798
|
);
|
|
50599
|
-
const wrappedRow = rowWrapper ? rowWrapper(row, rowNode) : rowNode;
|
|
50600
|
-
const inlineDetail = expandedDetail && isRowExpanded(row) ? /* @__PURE__ */ jsx47(
|
|
50601
|
-
"tr",
|
|
50602
|
-
{
|
|
50603
|
-
"data-matrx-table-expanded-detail": id,
|
|
50604
|
-
className: cn("bg-muted/20", expandedDetail.className),
|
|
50605
|
-
children: /* @__PURE__ */ jsx47(
|
|
50606
|
-
"td",
|
|
50607
|
-
{
|
|
50608
|
-
colSpan: renderedColSpan,
|
|
50609
|
-
className: "p-4",
|
|
50610
|
-
children: expandedDetail.render(displayRow, controls)
|
|
50611
|
-
}
|
|
50612
|
-
)
|
|
50613
|
-
},
|
|
50614
|
-
`${id}:expanded-detail`
|
|
50615
|
-
) : null;
|
|
50616
|
-
return hierarchy ? /* @__PURE__ */ jsxs37(Fragment9, { children: [
|
|
50617
|
-
/* @__PURE__ */ jsx47(
|
|
50618
|
-
HierarchyDroppableRow,
|
|
50619
|
-
{
|
|
50620
|
-
id,
|
|
50621
|
-
disabled: !canDropOn(row),
|
|
50622
|
-
children: wrappedRow
|
|
50623
|
-
}
|
|
50624
|
-
),
|
|
50625
|
-
inlineDetail
|
|
50626
|
-
] }, id) : /* @__PURE__ */ jsxs37(Fragment9, { children: [
|
|
50627
|
-
wrappedRow,
|
|
50628
|
-
inlineDetail
|
|
50629
|
-
] }, id);
|
|
50630
50799
|
}),
|
|
50631
50800
|
appendQuery !== null && isFetching && !isLoading ? /* @__PURE__ */ jsx47("tr", { "data-matrx-table-append-loading-row": true, children: /* @__PURE__ */ jsx47(
|
|
50632
50801
|
"td",
|