@coldsmirk/ledger-mantine 0.8.1 → 0.9.1
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/dist/index.cjs +95 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +96 -42
- package/dist/index.js.map +1 -1
- package/dist/styles.css +99 -31
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -621,6 +621,7 @@ function RowDragCell({ row, table }) {
|
|
|
621
621
|
"aria-pressed": lifted || void 0,
|
|
622
622
|
color: "gray",
|
|
623
623
|
size: SIZES[size].control,
|
|
624
|
+
style: { cursor: orderable ? "grab" : "default" },
|
|
624
625
|
variant: "subtle",
|
|
625
626
|
onBlur: () => {
|
|
626
627
|
if (lifted) rowReorderKeyboard?.cancel();
|
|
@@ -641,6 +642,7 @@ function RowDragCell({ row, table }) {
|
|
|
641
642
|
* display order from the shared core when the click arrives, which is whatever render pass ran
|
|
642
643
|
* last. The controller answers from the commit instead (`use-row-commands.ts`).
|
|
643
644
|
*/
|
|
645
|
+
const CONTROL_CLASS_NAMES = { body: "ledger-selection-control" };
|
|
644
646
|
function noop() {}
|
|
645
647
|
function SelectionHeaderCell({ table }) {
|
|
646
648
|
const { labels, selection, size } = useDataTableContext();
|
|
@@ -651,6 +653,7 @@ function SelectionHeaderCell({ table }) {
|
|
|
651
653
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Checkbox, {
|
|
652
654
|
"aria-label": labels.selectAllRows,
|
|
653
655
|
checked: allSelected,
|
|
656
|
+
classNames: CONTROL_CLASS_NAMES,
|
|
654
657
|
indeterminate: !allSelected && someSelected,
|
|
655
658
|
size: SIZES[size].control,
|
|
656
659
|
onChange: noop,
|
|
@@ -670,6 +673,7 @@ function SelectionCell({ row }) {
|
|
|
670
673
|
if (row.getCanMultiSelect() === false) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Radio, {
|
|
671
674
|
"aria-label": labels.selectRow,
|
|
672
675
|
checked: selected,
|
|
676
|
+
classNames: CONTROL_CLASS_NAMES,
|
|
673
677
|
disabled: !row.getCanSelect(),
|
|
674
678
|
name: `${instanceId}-selection`,
|
|
675
679
|
size: SIZES[size].control,
|
|
@@ -679,6 +683,7 @@ function SelectionCell({ row }) {
|
|
|
679
683
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Checkbox, {
|
|
680
684
|
"aria-label": labels.selectRow,
|
|
681
685
|
checked: selected,
|
|
686
|
+
classNames: CONTROL_CLASS_NAMES,
|
|
682
687
|
disabled: !row.getCanSelect(),
|
|
683
688
|
indeterminate: !selected && row.getIsSomeSelected(),
|
|
684
689
|
size: SIZES[size].control,
|
|
@@ -1380,6 +1385,7 @@ function ColumnsPanelItem({ column, table, labels, icons, index, zone, orderable
|
|
|
1380
1385
|
className: "ledger-columns-panel-handle",
|
|
1381
1386
|
color: "gray",
|
|
1382
1387
|
size: "sm",
|
|
1388
|
+
style: { cursor: isDragging ? "grabbing" : "grab" },
|
|
1383
1389
|
variant: "subtle",
|
|
1384
1390
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.reorderColumn, {})
|
|
1385
1391
|
})
|
|
@@ -1699,7 +1705,8 @@ function PaginationBarCore({ table, labels, pageSizeOptions, size, className, st
|
|
|
1699
1705
|
children: labels.paginationSummary(from, to, total)
|
|
1700
1706
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Group, {
|
|
1701
1707
|
gap: "md",
|
|
1702
|
-
|
|
1708
|
+
justify: "flex-end",
|
|
1709
|
+
wrap: "wrap",
|
|
1703
1710
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Group, {
|
|
1704
1711
|
gap: "xs",
|
|
1705
1712
|
wrap: "nowrap",
|
|
@@ -1707,6 +1714,7 @@ function PaginationBarCore({ table, labels, pageSizeOptions, size, className, st
|
|
|
1707
1714
|
c: "var(--ledger-color-dimmed)",
|
|
1708
1715
|
id: pageSizeLabelId,
|
|
1709
1716
|
size,
|
|
1717
|
+
style: { whiteSpace: "nowrap" },
|
|
1710
1718
|
children: labels.rowsPerPage
|
|
1711
1719
|
}, "label"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Select, {
|
|
1712
1720
|
allowDeselect: false,
|
|
@@ -1885,7 +1893,7 @@ function cellValue(cell) {
|
|
|
1885
1893
|
*/
|
|
1886
1894
|
function canEditWith(row, edit, gate) {
|
|
1887
1895
|
if (!gate.enableEditing || !gate.hasCommitHandler) return false;
|
|
1888
|
-
if (!edit) return false;
|
|
1896
|
+
if (!edit || row.getIsGrouped()) return false;
|
|
1889
1897
|
return !(typeof edit === "object" && edit.enabled && !edit.enabled(row));
|
|
1890
1898
|
}
|
|
1891
1899
|
/**
|
|
@@ -2452,6 +2460,15 @@ const TREE_INDENT_PX = 20;
|
|
|
2452
2460
|
const DEFAULT_ESTIMATED_ROW_HEIGHT = SIZES.sm.rowHeight;
|
|
2453
2461
|
const DEFAULT_OVERSCAN = 8;
|
|
2454
2462
|
/**
|
|
2463
|
+
* A row's height as layout has it, fractions included. TanStack Virtual rounds every measurement
|
|
2464
|
+
* to the pixel, and a row is seldom a whole number of pixels tall (Mantine's line height is 1.55):
|
|
2465
|
+
* each measured row then counted up to half a pixel wrong, the virtualizer's idea of where a row
|
|
2466
|
+
* starts drifted from the DOM by that much per row, and `scrollToRow` landed its row a few pixels
|
|
2467
|
+
* under the header. The resize entry's border box is exact. Without an entry (a row mounting) the
|
|
2468
|
+
* default answers from its cache or the element, and the entry that follows corrects it.
|
|
2469
|
+
*/
|
|
2470
|
+
const measureRow = (element, entry, instance) => entry?.borderBoxSize[0]?.blockSize ?? (0, _tanstack_react_virtual.measureElement)(element, entry, instance);
|
|
2471
|
+
/**
|
|
2455
2472
|
* Whether any leaf definition declares a merge — the gate that keeps span-index reads (and the
|
|
2456
2473
|
* per-row span signature) entirely out of tables that never span.
|
|
2457
2474
|
*/
|
|
@@ -2593,9 +2610,10 @@ function DataCell({ cell, editing, rowEditing, isFirstDataCell, depth, rowSpan,
|
|
|
2593
2610
|
const editMode = ledger?.editing.mode ?? "cell";
|
|
2594
2611
|
const { meta } = column.columnDef;
|
|
2595
2612
|
const grouped = cell.getIsGrouped();
|
|
2596
|
-
const
|
|
2597
|
-
const
|
|
2598
|
-
const
|
|
2613
|
+
const groupRow = row.getIsGrouped();
|
|
2614
|
+
const aggregated = cell.getIsAggregated() && groupRow;
|
|
2615
|
+
const empty = cell.getIsPlaceholder() || groupRow && !grouped && !aggregated && !isInternalColumn(column.id);
|
|
2616
|
+
const gateOpen = !empty && canEditCell(cell, row);
|
|
2599
2617
|
const editable = !editing && gateOpen;
|
|
2600
2618
|
const cellEditorActive = editing && gateOpen;
|
|
2601
2619
|
const rowEditorActive = rowEditing && gateOpen;
|
|
@@ -2603,8 +2621,8 @@ function DataCell({ cell, editing, rowEditing, isFirstDataCell, depth, rowSpan,
|
|
|
2603
2621
|
const instantEdit = normalizedEdit?.kind === "instant" ? normalizedEdit : null;
|
|
2604
2622
|
let content;
|
|
2605
2623
|
if (grouped) content = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GroupCell, { cell });
|
|
2606
|
-
else if (aggregated) content = (0, _tanstack_react_table.flexRender)(column.columnDef.aggregatedCell
|
|
2607
|
-
else if (
|
|
2624
|
+
else if (aggregated) content = (0, _tanstack_react_table.flexRender)(column.columnDef.aggregatedCell, cell.getContext());
|
|
2625
|
+
else if (empty) content = null;
|
|
2608
2626
|
else if (cellEditorActive) content = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CellEditor, { cell });
|
|
2609
2627
|
else if (rowEditorActive) content = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RowCellEditor, { cell });
|
|
2610
2628
|
else if (editable && instantEdit && editMode === "cell") content = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InstantCell, {
|
|
@@ -2746,6 +2764,7 @@ function DetailRow({ row, renderDetailPanel, colSpan, dragging, dropSide, last,
|
|
|
2746
2764
|
role: "row",
|
|
2747
2765
|
...getStyles("row", { style: pinnedStyle }),
|
|
2748
2766
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Table.Td, {
|
|
2767
|
+
"data-leading": true,
|
|
2749
2768
|
colSpan,
|
|
2750
2769
|
role: "cell",
|
|
2751
2770
|
...getStyles("detailPanel"),
|
|
@@ -2761,10 +2780,12 @@ function SkeletonRows({ rowCount, columnCount, ariaRowIndexStart }) {
|
|
|
2761
2780
|
role: "row",
|
|
2762
2781
|
...getStyles("row"),
|
|
2763
2782
|
children: Array.from({ length: columnCount }, (_, columnIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Table.Td, {
|
|
2783
|
+
"data-leading": columnIndex === 0 || void 0,
|
|
2764
2784
|
role: "cell",
|
|
2765
2785
|
...getStyles("cell"),
|
|
2766
2786
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Skeleton, {
|
|
2767
2787
|
height: 10,
|
|
2788
|
+
my: "calc((1lh - 10px) / 2)",
|
|
2768
2789
|
radius: "sm"
|
|
2769
2790
|
})
|
|
2770
2791
|
}, columnIndex))
|
|
@@ -2777,6 +2798,7 @@ function LoaderRow({ colSpan, ariaRowIndex }) {
|
|
|
2777
2798
|
role: "row",
|
|
2778
2799
|
...getStyles("loaderRow"),
|
|
2779
2800
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Table.Td, {
|
|
2801
|
+
"data-leading": true,
|
|
2780
2802
|
colSpan,
|
|
2781
2803
|
role: "cell",
|
|
2782
2804
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -2797,6 +2819,7 @@ function LoadMoreErrorRow({ colSpan, message, ariaRowIndex, onRetry }) {
|
|
|
2797
2819
|
role: "row",
|
|
2798
2820
|
...getStyles("loaderRow"),
|
|
2799
2821
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Table.Td, {
|
|
2822
|
+
"data-leading": true,
|
|
2800
2823
|
colSpan,
|
|
2801
2824
|
role: "cell",
|
|
2802
2825
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -2850,6 +2873,7 @@ function TableBody({ table, virtualization, columnWindow, viewportRef, loading,
|
|
|
2850
2873
|
estimateSize,
|
|
2851
2874
|
getItemKey,
|
|
2852
2875
|
getScrollElement: () => viewportRef.current,
|
|
2876
|
+
measureElement: measureRow,
|
|
2853
2877
|
overscan: virtualization?.overscan ?? DEFAULT_OVERSCAN,
|
|
2854
2878
|
useFlushSync: false
|
|
2855
2879
|
});
|
|
@@ -3037,7 +3061,7 @@ function tableHasFooter(table) {
|
|
|
3037
3061
|
}
|
|
3038
3062
|
function TableFooter({ table, ariaRowIndexStart, columnWindow }) {
|
|
3039
3063
|
const { getStyles, footerRowProps } = useDataTableContext();
|
|
3040
|
-
const renderCell = (footer, colSpan, ariaColIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Table.
|
|
3064
|
+
const renderCell = (footer, colSpan, ariaColIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Table.Td, {
|
|
3041
3065
|
...mergeElementProps(resolveElementProps(footer.column.columnDef.meta?.footerCellProps, footer), {
|
|
3042
3066
|
"aria-colindex": ariaColIndex,
|
|
3043
3067
|
colSpan: colSpan ?? footer.colSpan,
|
|
@@ -3058,7 +3082,7 @@ function TableFooter({ table, ariaRowIndexStart, columnWindow }) {
|
|
|
3058
3082
|
role: "row",
|
|
3059
3083
|
...getStyles("footerRow")
|
|
3060
3084
|
}),
|
|
3061
|
-
children: columnWindow === null ? footerGroup.headers.map((footer) => renderCell(footer, void 0, void 0)) : windowHeaderCells(footerGroup.headers, columnWindow).map((cell) => cell.kind === "spacer" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("
|
|
3085
|
+
children: columnWindow === null ? footerGroup.headers.map((footer) => renderCell(footer, void 0, void 0)) : windowHeaderCells(footerGroup.headers, columnWindow).map((cell) => cell.kind === "spacer" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
3062
3086
|
"aria-hidden": true,
|
|
3063
3087
|
"data-ledger-spacer": true
|
|
3064
3088
|
}, `ledger:spacer-${cell.edge}`) : renderCell(cell.header, cell.colSpan, cell.ariaColIndex))
|
|
@@ -3077,9 +3101,12 @@ function TableFooter({ table, ariaRowIndexStart, columnWindow }) {
|
|
|
3077
3101
|
* The column, its constraints and whether it carries a filter all arrive from the render that put
|
|
3078
3102
|
* the handle on screen, for the reason `use-column-resize.ts` gives.
|
|
3079
3103
|
*
|
|
3080
|
-
*
|
|
3081
|
-
*
|
|
3082
|
-
*
|
|
3104
|
+
* A content cell is measured out of the table's layout: for the pass it is a block as wide as its
|
|
3105
|
+
* content (`display: block; width: max-content`, no wrapping), so its width is the content's, in
|
|
3106
|
+
* whichever direction that lies. Read in place, a cell is never narrower than its column — a fixed
|
|
3107
|
+
* table lays every cell at the column's width, and a truncating span clips at it — so a fit could
|
|
3108
|
+
* only ever widen a column. Every cell is switched first and read afterwards, so the whole pass
|
|
3109
|
+
* costs one reflow, and each gets its own inline styles back before anything paints.
|
|
3083
3110
|
*/
|
|
3084
3111
|
/**
|
|
3085
3112
|
* Breathing room over the tightest fit — content flush against the column edge reads clipped.
|
|
@@ -3100,10 +3127,6 @@ function horizontalPadding(element) {
|
|
|
3100
3127
|
const style = getComputedStyle(element);
|
|
3101
3128
|
return asPx(style.paddingInlineStart) + asPx(style.paddingInlineEnd);
|
|
3102
3129
|
}
|
|
3103
|
-
function bodyCellWidth(cell) {
|
|
3104
|
-
const truncated = cell.querySelector(":scope [data-truncate]");
|
|
3105
|
-
return truncated ? truncated.scrollWidth + horizontalPadding(cell) : cell.scrollWidth;
|
|
3106
|
-
}
|
|
3107
3130
|
function headerCellWidth(th, hasFilter) {
|
|
3108
3131
|
const labelText = th.querySelector(":scope .ledger-header-label [data-truncate]");
|
|
3109
3132
|
if (!labelText) return th.scrollWidth;
|
|
@@ -3114,16 +3137,29 @@ function headerCellWidth(th, hasFilter) {
|
|
|
3114
3137
|
function autosizeColumn(setColumnSizing, { columnId, minSize, maxSize, hasFilter }, main) {
|
|
3115
3138
|
const selector = `[data-ledger-column-id="${CSS.escape(columnId)}"]`;
|
|
3116
3139
|
const headerCell = main.querySelector(`:scope .ledger-header ${selector}`);
|
|
3117
|
-
const
|
|
3118
|
-
const footerCells = [...main.querySelectorAll(`:scope .ledger-footer ${selector}`)].filter((cell) => cell.colSpan <= 1);
|
|
3119
|
-
const contentCells = [...bodyCells, ...footerCells];
|
|
3140
|
+
const contentCells = [...main.querySelectorAll(`:scope :is(.ledger-tbody, .ledger-footer) ${selector}`)].filter((cell) => cell.colSpan <= 1);
|
|
3120
3141
|
const cells = headerCell ? [headerCell, ...contentCells] : contentCells;
|
|
3121
3142
|
if (cells.length === 0) return;
|
|
3122
|
-
const
|
|
3143
|
+
const previous = cells.map((cell) => {
|
|
3144
|
+
return {
|
|
3145
|
+
display: cell.style.display,
|
|
3146
|
+
whiteSpace: cell.style.whiteSpace,
|
|
3147
|
+
width: cell.style.width
|
|
3148
|
+
};
|
|
3149
|
+
});
|
|
3123
3150
|
for (const cell of cells) cell.style.whiteSpace = "nowrap";
|
|
3151
|
+
for (const cell of contentCells) {
|
|
3152
|
+
cell.style.display = "block";
|
|
3153
|
+
cell.style.width = "max-content";
|
|
3154
|
+
}
|
|
3124
3155
|
let content = headerCell ? headerCellWidth(headerCell, hasFilter) : 0;
|
|
3125
|
-
for (const cell of contentCells) content = Math.max(content,
|
|
3126
|
-
for (const [index, cell] of cells.entries())
|
|
3156
|
+
for (const cell of contentCells) content = Math.max(content, cell.scrollWidth);
|
|
3157
|
+
for (const [index, cell] of cells.entries()) {
|
|
3158
|
+
const styles = previous[index];
|
|
3159
|
+
cell.style.display = styles?.display ?? "";
|
|
3160
|
+
cell.style.whiteSpace = styles?.whiteSpace ?? "";
|
|
3161
|
+
cell.style.width = styles?.width ?? "";
|
|
3162
|
+
}
|
|
3127
3163
|
const next = Math.min(Math.max(Math.round(content + AUTOSIZE_SLACK_PX), minSize), maxSize);
|
|
3128
3164
|
setColumnSizing((previous) => previous[columnId] === next ? previous : {
|
|
3129
3165
|
...previous,
|
|
@@ -3323,6 +3359,7 @@ function RangeFilter({ column, name }) {
|
|
|
3323
3359
|
wrap: "nowrap",
|
|
3324
3360
|
children: [
|
|
3325
3361
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.NumberInput, {
|
|
3362
|
+
hideControls: true,
|
|
3326
3363
|
"aria-label": labels.filterRangeMin,
|
|
3327
3364
|
flex: 1,
|
|
3328
3365
|
placeholder: facetMin === void 0 ? labels.filterRangeMin : String(facetMin),
|
|
@@ -3330,6 +3367,7 @@ function RangeFilter({ column, name }) {
|
|
|
3330
3367
|
onChange: setBound(0)
|
|
3331
3368
|
}),
|
|
3332
3369
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.NumberInput, {
|
|
3370
|
+
hideControls: true,
|
|
3333
3371
|
"aria-label": labels.filterRangeMax,
|
|
3334
3372
|
flex: 1,
|
|
3335
3373
|
placeholder: facetMax === void 0 ? labels.filterRangeMax : String(facetMax),
|
|
@@ -3685,7 +3723,11 @@ function HeaderCell({ header, table, reorder, resize, columnWidths, columnSizing
|
|
|
3685
3723
|
...getStyles("headerCell", { style: pinnedCellStyle(column) }),
|
|
3686
3724
|
...reorder.getHeaderProps(column.id)
|
|
3687
3725
|
}),
|
|
3688
|
-
children: header.isPlaceholder ? null : internal ?
|
|
3726
|
+
children: header.isPlaceholder ? null : internal ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3727
|
+
...getStyles("headerLabel"),
|
|
3728
|
+
"data-align": "center",
|
|
3729
|
+
children: label
|
|
3730
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
3689
3731
|
canSort ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
3690
3732
|
type: "button",
|
|
3691
3733
|
onClick: handleSortClick,
|
|
@@ -6514,31 +6556,36 @@ function useStylesRevision(getStyles, selectors) {
|
|
|
6514
6556
|
return revision;
|
|
6515
6557
|
}
|
|
6516
6558
|
//#endregion
|
|
6517
|
-
//#region src/use-viewport-
|
|
6559
|
+
//#region src/use-viewport-fit.ts
|
|
6560
|
+
const UNMEASURED = {
|
|
6561
|
+
overflowing: false,
|
|
6562
|
+
underfilled: false
|
|
6563
|
+
};
|
|
6518
6564
|
/**
|
|
6519
|
-
*
|
|
6520
|
-
*
|
|
6521
|
-
*
|
|
6522
|
-
*
|
|
6523
|
-
* Measured whenever the viewport or its content resizes: rows arriving, columns widening, or
|
|
6524
|
-
* the host resizing the table each change the answer without a scroll event. A 1px tolerance
|
|
6525
|
-
* absorbs fractional layout rounding, which would otherwise flicker the stop on and off.
|
|
6565
|
+
* Layout sizes only, never rects: a transform (a modal scaling in) would shrink a rect but not
|
|
6566
|
+
* the viewport's client box, and nothing re-measures when the transform ends. A 1px tolerance
|
|
6567
|
+
* absorbs fractional layout rounding, which would otherwise flicker either answer.
|
|
6526
6568
|
*/
|
|
6527
|
-
function
|
|
6528
|
-
const [
|
|
6569
|
+
function useViewportFit(viewport) {
|
|
6570
|
+
const [fit, setFit] = (0, react.useState)(UNMEASURED);
|
|
6529
6571
|
(0, react.useLayoutEffect)(() => {
|
|
6530
6572
|
if (!viewport) return;
|
|
6573
|
+
const content = viewport.firstElementChild;
|
|
6531
6574
|
const measure = () => {
|
|
6532
|
-
const
|
|
6533
|
-
|
|
6575
|
+
const overflowing = viewport.scrollHeight - viewport.clientHeight > 1 || viewport.scrollWidth - viewport.clientWidth > 1;
|
|
6576
|
+
const underfilled = content instanceof HTMLElement && viewport.clientHeight - content.offsetHeight >= 1;
|
|
6577
|
+
setFit((previous) => previous.overflowing === overflowing && previous.underfilled === underfilled ? previous : {
|
|
6578
|
+
overflowing,
|
|
6579
|
+
underfilled
|
|
6580
|
+
});
|
|
6534
6581
|
};
|
|
6535
6582
|
measure();
|
|
6536
6583
|
const observer = new ResizeObserver(measure);
|
|
6537
6584
|
observer.observe(viewport);
|
|
6538
|
-
if (
|
|
6585
|
+
if (content) observer.observe(content);
|
|
6539
6586
|
return () => observer.disconnect();
|
|
6540
6587
|
}, [viewport]);
|
|
6541
|
-
return
|
|
6588
|
+
return fit;
|
|
6542
6589
|
}
|
|
6543
6590
|
//#endregion
|
|
6544
6591
|
//#region src/data-table.tsx
|
|
@@ -6790,7 +6837,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
6790
6837
|
viewportRef.current = element;
|
|
6791
6838
|
setViewport(element);
|
|
6792
6839
|
}, []);
|
|
6793
|
-
const
|
|
6840
|
+
const viewportFit = useViewportFit(viewport);
|
|
6794
6841
|
const startLeafColumns = table.getStartVisibleLeafColumns();
|
|
6795
6842
|
const endLeafColumns = table.getEndVisibleLeafColumns();
|
|
6796
6843
|
const displayColumns = [
|
|
@@ -6879,6 +6926,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
6879
6926
|
leftOffset += width;
|
|
6880
6927
|
}
|
|
6881
6928
|
}
|
|
6929
|
+
varsMap["--ledger-pinned-start-width"] = `${leftOffset}px`;
|
|
6882
6930
|
let rightOffset = 0;
|
|
6883
6931
|
for (let index = visibleLeafColumns.length - 1; index >= 0; index -= 1) {
|
|
6884
6932
|
const column = visibleLeafColumns[index];
|
|
@@ -7143,7 +7191,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
7143
7191
|
]);
|
|
7144
7192
|
const activeRowAnnouncer = (0, react.useRef)(null);
|
|
7145
7193
|
const rowNavigationHintId = `${instanceId}-row-navigation`;
|
|
7146
|
-
const viewportFocusStop = activeRowEnabled ||
|
|
7194
|
+
const viewportFocusStop = activeRowEnabled || viewportFit.overflowing;
|
|
7147
7195
|
const viewportDescribedBy = activeRowEnabled ? [viewportProps?.["aria-describedby"], rowNavigationHintId].filter(Boolean).join(" ") : viewportProps?.["aria-describedby"];
|
|
7148
7196
|
const announceActiveRow = useEventCallback(() => {
|
|
7149
7197
|
const target = activeRowAnnouncer.current;
|
|
@@ -7253,7 +7301,8 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
7253
7301
|
width: columnWidths.total > 0 ? columnWidths.total : void 0,
|
|
7254
7302
|
minWidth: toPx(tableMinWidth),
|
|
7255
7303
|
borderCollapse: "separate",
|
|
7256
|
-
borderSpacing: 0
|
|
7304
|
+
borderSpacing: 0,
|
|
7305
|
+
fontSize: "inherit"
|
|
7257
7306
|
} });
|
|
7258
7307
|
const rowOrderingEnabled = ledger?.rowOrdering.enabled === true;
|
|
7259
7308
|
const nameReorderRow = useEventCallback((row) => {
|
|
@@ -7333,6 +7382,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
7333
7382
|
"data-scrolled-start": scrollEdges.start || void 0,
|
|
7334
7383
|
"data-size": size,
|
|
7335
7384
|
"data-striped": stripedMode,
|
|
7385
|
+
"data-underfilled": viewportFit.underfilled || void 0,
|
|
7336
7386
|
"data-virtualized-columns": columnWindow !== null || void 0,
|
|
7337
7387
|
"data-virtualized-rows": virtualEnabled || void 0,
|
|
7338
7388
|
"data-with-bottom-border": withBottomBorder || void 0,
|
|
@@ -7513,13 +7563,15 @@ DataTable.SelectionBar = DataTableSelectionBar;
|
|
|
7513
7563
|
* renderer over the public editing contexts (docs/editing.md#editors), which is the proof the
|
|
7514
7564
|
* contexts suffice: anything these do, an application's own renderer can do the same way.
|
|
7515
7565
|
* All are default-variant Mantine inputs at the context's `size` — the border marks the cell as an
|
|
7516
|
-
* open editor, and the size keeps it inside the row.
|
|
7566
|
+
* open editor, and the size keeps it inside the row. The fields fill the cell (`flex={1}` in the
|
|
7567
|
+
* host's flex line); the checkbox keeps its own size, placed by the column's alignment.
|
|
7517
7568
|
*/
|
|
7518
7569
|
const renderTextEditor = ({ value, setValue, error, pending, autoFocus, label, size }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.TextInput, {
|
|
7519
7570
|
"aria-label": label,
|
|
7520
7571
|
autoFocus,
|
|
7521
7572
|
disabled: pending,
|
|
7522
7573
|
error,
|
|
7574
|
+
flex: 1,
|
|
7523
7575
|
size,
|
|
7524
7576
|
value: value === null || value === void 0 ? "" : String(value),
|
|
7525
7577
|
onChange: (event) => setValue(event.currentTarget.value)
|
|
@@ -7536,6 +7588,7 @@ const renderNumberEditor = ({ value, setValue, error, pending, autoFocus, label,
|
|
|
7536
7588
|
autoFocus,
|
|
7537
7589
|
disabled: pending,
|
|
7538
7590
|
error,
|
|
7591
|
+
flex: 1,
|
|
7539
7592
|
size,
|
|
7540
7593
|
value: typeof value === "number" || typeof value === "string" ? value : "",
|
|
7541
7594
|
onChange: (next) => setValue(next === "" ? null : next)
|
|
@@ -7560,6 +7613,7 @@ function selectEditor(options) {
|
|
|
7560
7613
|
defaultDropdownOpened: mode === "cell",
|
|
7561
7614
|
disabled: pending,
|
|
7562
7615
|
error,
|
|
7616
|
+
flex: 1,
|
|
7563
7617
|
size,
|
|
7564
7618
|
value: value === null || value === void 0 ? null : String(value),
|
|
7565
7619
|
onChange: (next) => {
|