@coldsmirk/ledger-mantine 0.2.0 → 0.3.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 +27 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +27 -4
- package/dist/index.js.map +1 -1
- package/dist/styles.css +34 -34
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -986,6 +986,12 @@ interface DataTableBaseProps<TData extends RowData$1> extends BoxProps, StylesAp
|
|
|
986
986
|
withTableBorder?: boolean;
|
|
987
987
|
withColumnBorders?: boolean;
|
|
988
988
|
withRowBorders?: boolean;
|
|
989
|
+
/**
|
|
990
|
+
* The closing line under the last row — and under a footer — for a table that stands alone
|
|
991
|
+
* without a frame. Mantine's `Table` leaves the last row open, so this is off by default; the
|
|
992
|
+
* `withTableBorder` frame closes the table itself and ignores it (docs/styling.md#borders).
|
|
993
|
+
*/
|
|
994
|
+
withBottomBorder?: boolean;
|
|
989
995
|
borderColor?: MantineColor;
|
|
990
996
|
/**
|
|
991
997
|
* Corner radius of the table box — header, body, and footer as one rounded, clipping box;
|
package/dist/index.d.ts
CHANGED
|
@@ -986,6 +986,12 @@ interface DataTableBaseProps<TData extends RowData$1> extends BoxProps, StylesAp
|
|
|
986
986
|
withTableBorder?: boolean;
|
|
987
987
|
withColumnBorders?: boolean;
|
|
988
988
|
withRowBorders?: boolean;
|
|
989
|
+
/**
|
|
990
|
+
* The closing line under the last row — and under a footer — for a table that stands alone
|
|
991
|
+
* without a frame. Mantine's `Table` leaves the last row open, so this is off by default; the
|
|
992
|
+
* `withTableBorder` frame closes the table itself and ignores it (docs/styling.md#borders).
|
|
993
|
+
*/
|
|
994
|
+
withBottomBorder?: boolean;
|
|
989
995
|
borderColor?: MantineColor;
|
|
990
996
|
/**
|
|
991
997
|
* Corner radius of the table box — header, body, and footer as one rounded, clipping box;
|
package/dist/index.js
CHANGED
|
@@ -2438,7 +2438,7 @@ function InstantCell({ cell, render }) {
|
|
|
2438
2438
|
]
|
|
2439
2439
|
});
|
|
2440
2440
|
}
|
|
2441
|
-
function DataCell({ cell, editing, rowEditing, isFirstDataCell, depth, rowSpan, colSpan, ariaColIndex }) {
|
|
2441
|
+
function DataCell({ cell, editing, rowEditing, isFirstDataCell, depth, rowSpan, colSpan, ariaColIndex, last }) {
|
|
2442
2442
|
const { getStyles } = useDataTableContext();
|
|
2443
2443
|
const { column, row } = cell;
|
|
2444
2444
|
const { table } = cell.getContext();
|
|
@@ -2494,6 +2494,7 @@ function DataCell({ cell, editing, rowEditing, isFirstDataCell, depth, rowSpan,
|
|
|
2494
2494
|
"data-align": meta?.align,
|
|
2495
2495
|
"data-editable": editable || void 0,
|
|
2496
2496
|
"data-editing": cellEditorActive || rowEditorActive || void 0,
|
|
2497
|
+
"data-last": last || void 0,
|
|
2497
2498
|
"data-leading": column.getIsFirstColumn() || void 0,
|
|
2498
2499
|
"data-ledger-column-id": column.id,
|
|
2499
2500
|
"data-pinned": column.getIsPinned() || void 0,
|
|
@@ -2508,7 +2509,7 @@ function DataCell({ cell, editing, rowEditing, isFirstDataCell, depth, rowSpan,
|
|
|
2508
2509
|
children: content
|
|
2509
2510
|
});
|
|
2510
2511
|
}
|
|
2511
|
-
function DataRowImpl({ row, dataIndex, editingColumnId, editingRow, dragging, dropSide, selected, active, expanded, depth, spanning, columnWindow, pinnedPosition, pinnedOffset, virtualIndex, measureRef, ariaRowIndex }) {
|
|
2512
|
+
function DataRowImpl({ row, dataIndex, last, rowsBelow, editingColumnId, editingRow, dragging, dropSide, selected, active, expanded, depth, spanning, columnWindow, pinnedPosition, pinnedOffset, virtualIndex, measureRef, ariaRowIndex }) {
|
|
2512
2513
|
const { getStyles, onRowClick, onRowActivate, onRowDoubleClick, onRowContextMenu, rowProps, activeRowEnabled, setActiveRow } = useDataTableContext();
|
|
2513
2514
|
const cells = row.getVisibleCells();
|
|
2514
2515
|
const firstDataCellIndex = cells.findIndex((cell) => !isInternalColumn(cell.column.id));
|
|
@@ -2532,6 +2533,7 @@ function DataRowImpl({ row, dataIndex, editingColumnId, editingRow, dragging, dr
|
|
|
2532
2533
|
"data-editing-row": editingRow || void 0,
|
|
2533
2534
|
"data-expanded": expanded || void 0,
|
|
2534
2535
|
"data-index": virtualIndex,
|
|
2536
|
+
"data-last": last || void 0,
|
|
2535
2537
|
"data-parity": dataIndex >= 0 ? dataIndex % 2 === 0 ? "odd" : "even" : void 0,
|
|
2536
2538
|
"data-pinned-row": pinnedPosition,
|
|
2537
2539
|
"data-row-id": row.id,
|
|
@@ -2554,6 +2556,7 @@ function DataRowImpl({ row, dataIndex, editingColumnId, editingRow, dragging, dr
|
|
|
2554
2556
|
depth,
|
|
2555
2557
|
editing: editingColumnId === cell.column.id,
|
|
2556
2558
|
isFirstDataCell: displayIndex === firstDataCellIndex,
|
|
2559
|
+
last: rowsBelow === void 0 ? last : cell.getRowSpan() - 1 === rowsBelow,
|
|
2557
2560
|
rowEditing: editingRow,
|
|
2558
2561
|
rowSpan: spanning ? cell.getRowSpan() : 1
|
|
2559
2562
|
}, cell.id);
|
|
@@ -2578,7 +2581,7 @@ function DataRowImpl({ row, dataIndex, editingColumnId, editingRow, dragging, dr
|
|
|
2578
2581
|
}
|
|
2579
2582
|
}
|
|
2580
2583
|
const DataRow = memo(DataRowImpl);
|
|
2581
|
-
function DetailRow({ row, renderDetailPanel, colSpan, dragging, dropSide, pinnedPosition, pinnedOffset, virtualIndex, measureRef, ariaRowIndex }) {
|
|
2584
|
+
function DetailRow({ row, renderDetailPanel, colSpan, dragging, dropSide, last, pinnedPosition, pinnedOffset, virtualIndex, measureRef, ariaRowIndex }) {
|
|
2582
2585
|
const { getStyles } = useDataTableContext();
|
|
2583
2586
|
const pinnedStyle = pinnedPosition === "top" ? { top: `${pinnedOffset ?? 0}px` } : pinnedPosition === "bottom" ? { bottom: `${pinnedOffset ?? 0}px` } : void 0;
|
|
2584
2587
|
return /* @__PURE__ */ jsx(Table.Tr, {
|
|
@@ -2588,6 +2591,7 @@ function DetailRow({ row, renderDetailPanel, colSpan, dragging, dropSide, pinned
|
|
|
2588
2591
|
"data-dragging": dragging || void 0,
|
|
2589
2592
|
"data-drop-side": dropSide ?? void 0,
|
|
2590
2593
|
"data-index": virtualIndex,
|
|
2594
|
+
"data-last": last || void 0,
|
|
2591
2595
|
"data-pinned-row": pinnedPosition,
|
|
2592
2596
|
role: "row",
|
|
2593
2597
|
...getStyles("row", { style: pinnedStyle }),
|
|
@@ -2603,6 +2607,7 @@ function SkeletonRows({ rowCount, columnCount, ariaRowIndexStart }) {
|
|
|
2603
2607
|
const { getStyles } = useDataTableContext();
|
|
2604
2608
|
return /* @__PURE__ */ jsx(Fragment, { children: Array.from({ length: rowCount }, (_, rowIndex) => /* @__PURE__ */ jsx(Table.Tr, {
|
|
2605
2609
|
"aria-rowindex": ariaRowIndexStart === void 0 ? void 0 : ariaRowIndexStart + rowIndex,
|
|
2610
|
+
"data-last": rowIndex === rowCount - 1 || void 0,
|
|
2606
2611
|
role: "row",
|
|
2607
2612
|
...getStyles("row"),
|
|
2608
2613
|
children: Array.from({ length: columnCount }, (_, columnIndex) => /* @__PURE__ */ jsx(Table.Td, {
|
|
@@ -2746,13 +2751,26 @@ function TableBody({ table, virtualization, columnWindow, viewportRef, loading,
|
|
|
2746
2751
|
const editingCell = ledger?.editing.cell ?? null;
|
|
2747
2752
|
const editingRowId = ledger?.editing.mode === "row" ? ledger.editing.row.id : null;
|
|
2748
2753
|
const activeRowId = ledger?.activeRow.enabled ? ledger.activeRow.id : null;
|
|
2754
|
+
const trailingRowCount = loadMoreError || loadingMore ? 1 : 0;
|
|
2755
|
+
const zoneRows = {
|
|
2756
|
+
top: topDisplayRows,
|
|
2757
|
+
center: centerDisplayRows,
|
|
2758
|
+
bottom: bottomDisplayRows
|
|
2759
|
+
};
|
|
2760
|
+
const rowsBelowOf = (zone, displayIndex) => {
|
|
2761
|
+
const laterZones = zone === "top" ? centerDisplayRows.length + bottomDisplayRows.length : zone === "center" ? bottomDisplayRows.length : 0;
|
|
2762
|
+
return zoneRows[zone].length - 1 - displayIndex + laterZones + trailingRowCount;
|
|
2763
|
+
};
|
|
2749
2764
|
const renderDisplayRow = (displayRow, options) => {
|
|
2750
2765
|
const zoneStart = options.pinnedPosition === "top" ? headerRowCount : options.pinnedPosition === "bottom" ? headerRowCount + topDisplayRows.length + centerDisplayRows.length : headerRowCount + topDisplayRows.length;
|
|
2751
2766
|
const ariaRowIndex = virtualEnabled ? zoneStart + options.displayIndex + 1 : void 0;
|
|
2767
|
+
const rowsBelow = rowsBelowOf(options.pinnedPosition ?? "center", options.displayIndex);
|
|
2768
|
+
const last = rowsBelow === 0;
|
|
2752
2769
|
if (displayRow.kind === "detail") return /* @__PURE__ */ jsx(DetailRow, {
|
|
2753
2770
|
ariaRowIndex,
|
|
2754
2771
|
colSpan: fullWidthColSpan,
|
|
2755
2772
|
dragging: reorderSourceId === displayRow.row.id,
|
|
2773
|
+
last,
|
|
2756
2774
|
measureRef: options.measureRef,
|
|
2757
2775
|
pinnedOffset: options.pinnedOffset,
|
|
2758
2776
|
pinnedPosition: options.pinnedPosition,
|
|
@@ -2775,12 +2793,14 @@ function TableBody({ table, virtualization, columnWindow, viewportRef, loading,
|
|
|
2775
2793
|
dropSide,
|
|
2776
2794
|
editingRow: editingRowId === row.id && (ledger?.editing.row.active(row.id) ?? false),
|
|
2777
2795
|
expanded: row.getIsExpanded(),
|
|
2796
|
+
last,
|
|
2778
2797
|
measureRef: options.measureRef,
|
|
2779
2798
|
pinKey,
|
|
2780
2799
|
pinnedOffset: options.pinnedOffset,
|
|
2781
2800
|
pinnedPosition: options.pinnedPosition,
|
|
2782
2801
|
renderVersion,
|
|
2783
2802
|
row,
|
|
2803
|
+
rowsBelow: spanningActive ? rowsBelow : void 0,
|
|
2784
2804
|
selected: row.getIsSelected(),
|
|
2785
2805
|
spanKey,
|
|
2786
2806
|
spanning: spanningActive,
|
|
@@ -6366,6 +6386,7 @@ const defaultProps = {
|
|
|
6366
6386
|
withTableBorder: false,
|
|
6367
6387
|
withColumnBorders: false,
|
|
6368
6388
|
withRowBorders: true,
|
|
6389
|
+
withBottomBorder: false,
|
|
6369
6390
|
verticalSpacing: "xs",
|
|
6370
6391
|
horizontalSpacing: "xs",
|
|
6371
6392
|
tabularNums: false,
|
|
@@ -6507,7 +6528,7 @@ function DataTableFromOptions({ props }) {
|
|
|
6507
6528
|
});
|
|
6508
6529
|
}
|
|
6509
6530
|
function DataTableCore({ presentation, stylesProps, table }) {
|
|
6510
|
-
const { striped, stripedColor: _stripedColor, highlightOnHover, highlightOnHoverColor: _highlightOnHoverColor, withTableBorder, withColumnBorders, withRowBorders, borderColor: _borderColor, radius: _radius, verticalSpacing, horizontalSpacing, tabularNums, tableMinWidth, virtualizedRows, virtualizedColumns, onEndReached, endReachedOffset, loadingMore, loadMoreError, loading, emptyState, error, onRetry, withColumnHeaders, withPaginationBar, pageSizeOptions, onRowClick, onRowActivate, onRowDoubleClick, onRowContextMenu, rowProps, headerRowProps, footerRowProps, viewportProps, labels: labelsProp, icons: iconsProp, handleRef, ref: rootRef, classNames, styles, unstyled, vars, className, style, attributes, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...others } = presentation;
|
|
6531
|
+
const { striped, stripedColor: _stripedColor, highlightOnHover, highlightOnHoverColor: _highlightOnHoverColor, withTableBorder, withColumnBorders, withRowBorders, withBottomBorder, borderColor: _borderColor, radius: _radius, verticalSpacing, horizontalSpacing, tabularNums, tableMinWidth, virtualizedRows, virtualizedColumns, onEndReached, endReachedOffset, loadingMore, loadMoreError, loading, emptyState, error, onRetry, withColumnHeaders, withPaginationBar, pageSizeOptions, onRowClick, onRowActivate, onRowDoubleClick, onRowContextMenu, rowProps, headerRowProps, footerRowProps, viewportProps, labels: labelsProp, icons: iconsProp, handleRef, ref: rootRef, classNames, styles, unstyled, vars, className, style, attributes, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...others } = presentation;
|
|
6511
6532
|
const getStyles = useStyles({
|
|
6512
6533
|
name: "DataTable",
|
|
6513
6534
|
classes,
|
|
@@ -7081,7 +7102,9 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
7081
7102
|
"data-striped": stripedMode,
|
|
7082
7103
|
"data-virtualized-columns": columnWindow !== null || void 0,
|
|
7083
7104
|
"data-virtualized-rows": virtualEnabled || void 0,
|
|
7105
|
+
"data-with-bottom-border": withBottomBorder || void 0,
|
|
7084
7106
|
"data-with-column-borders": withColumnBorders || void 0,
|
|
7107
|
+
"data-with-footer": hasFooter || void 0,
|
|
7085
7108
|
"data-with-row-borders": withRowBorders || void 0,
|
|
7086
7109
|
"data-with-table-border": withTableBorder || void 0,
|
|
7087
7110
|
...getStyles("root", { style: columnVars }),
|