@coldsmirk/ledger-mantine 0.2.0 → 0.3.0
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 -33
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2462,7 +2462,7 @@ function InstantCell({ cell, render }) {
|
|
|
2462
2462
|
]
|
|
2463
2463
|
});
|
|
2464
2464
|
}
|
|
2465
|
-
function DataCell({ cell, editing, rowEditing, isFirstDataCell, depth, rowSpan, colSpan, ariaColIndex }) {
|
|
2465
|
+
function DataCell({ cell, editing, rowEditing, isFirstDataCell, depth, rowSpan, colSpan, ariaColIndex, last }) {
|
|
2466
2466
|
const { getStyles } = useDataTableContext();
|
|
2467
2467
|
const { column, row } = cell;
|
|
2468
2468
|
const { table } = cell.getContext();
|
|
@@ -2518,6 +2518,7 @@ function DataCell({ cell, editing, rowEditing, isFirstDataCell, depth, rowSpan,
|
|
|
2518
2518
|
"data-align": meta?.align,
|
|
2519
2519
|
"data-editable": editable || void 0,
|
|
2520
2520
|
"data-editing": cellEditorActive || rowEditorActive || void 0,
|
|
2521
|
+
"data-last": last || void 0,
|
|
2521
2522
|
"data-leading": column.getIsFirstColumn() || void 0,
|
|
2522
2523
|
"data-ledger-column-id": column.id,
|
|
2523
2524
|
"data-pinned": column.getIsPinned() || void 0,
|
|
@@ -2532,7 +2533,7 @@ function DataCell({ cell, editing, rowEditing, isFirstDataCell, depth, rowSpan,
|
|
|
2532
2533
|
children: content
|
|
2533
2534
|
});
|
|
2534
2535
|
}
|
|
2535
|
-
function DataRowImpl({ row, dataIndex, editingColumnId, editingRow, dragging, dropSide, selected, active, expanded, depth, spanning, columnWindow, pinnedPosition, pinnedOffset, virtualIndex, measureRef, ariaRowIndex }) {
|
|
2536
|
+
function DataRowImpl({ row, dataIndex, last, rowsBelow, editingColumnId, editingRow, dragging, dropSide, selected, active, expanded, depth, spanning, columnWindow, pinnedPosition, pinnedOffset, virtualIndex, measureRef, ariaRowIndex }) {
|
|
2536
2537
|
const { getStyles, onRowClick, onRowActivate, onRowDoubleClick, onRowContextMenu, rowProps, activeRowEnabled, setActiveRow } = useDataTableContext();
|
|
2537
2538
|
const cells = row.getVisibleCells();
|
|
2538
2539
|
const firstDataCellIndex = cells.findIndex((cell) => !isInternalColumn(cell.column.id));
|
|
@@ -2556,6 +2557,7 @@ function DataRowImpl({ row, dataIndex, editingColumnId, editingRow, dragging, dr
|
|
|
2556
2557
|
"data-editing-row": editingRow || void 0,
|
|
2557
2558
|
"data-expanded": expanded || void 0,
|
|
2558
2559
|
"data-index": virtualIndex,
|
|
2560
|
+
"data-last": last || void 0,
|
|
2559
2561
|
"data-parity": dataIndex >= 0 ? dataIndex % 2 === 0 ? "odd" : "even" : void 0,
|
|
2560
2562
|
"data-pinned-row": pinnedPosition,
|
|
2561
2563
|
"data-row-id": row.id,
|
|
@@ -2578,6 +2580,7 @@ function DataRowImpl({ row, dataIndex, editingColumnId, editingRow, dragging, dr
|
|
|
2578
2580
|
depth,
|
|
2579
2581
|
editing: editingColumnId === cell.column.id,
|
|
2580
2582
|
isFirstDataCell: displayIndex === firstDataCellIndex,
|
|
2583
|
+
last: rowsBelow === void 0 ? last : cell.getRowSpan() - 1 === rowsBelow,
|
|
2581
2584
|
rowEditing: editingRow,
|
|
2582
2585
|
rowSpan: spanning ? cell.getRowSpan() : 1
|
|
2583
2586
|
}, cell.id);
|
|
@@ -2602,7 +2605,7 @@ function DataRowImpl({ row, dataIndex, editingColumnId, editingRow, dragging, dr
|
|
|
2602
2605
|
}
|
|
2603
2606
|
}
|
|
2604
2607
|
const DataRow = (0, react.memo)(DataRowImpl);
|
|
2605
|
-
function DetailRow({ row, renderDetailPanel, colSpan, dragging, dropSide, pinnedPosition, pinnedOffset, virtualIndex, measureRef, ariaRowIndex }) {
|
|
2608
|
+
function DetailRow({ row, renderDetailPanel, colSpan, dragging, dropSide, last, pinnedPosition, pinnedOffset, virtualIndex, measureRef, ariaRowIndex }) {
|
|
2606
2609
|
const { getStyles } = useDataTableContext();
|
|
2607
2610
|
const pinnedStyle = pinnedPosition === "top" ? { top: `${pinnedOffset ?? 0}px` } : pinnedPosition === "bottom" ? { bottom: `${pinnedOffset ?? 0}px` } : void 0;
|
|
2608
2611
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Table.Tr, {
|
|
@@ -2612,6 +2615,7 @@ function DetailRow({ row, renderDetailPanel, colSpan, dragging, dropSide, pinned
|
|
|
2612
2615
|
"data-dragging": dragging || void 0,
|
|
2613
2616
|
"data-drop-side": dropSide ?? void 0,
|
|
2614
2617
|
"data-index": virtualIndex,
|
|
2618
|
+
"data-last": last || void 0,
|
|
2615
2619
|
"data-pinned-row": pinnedPosition,
|
|
2616
2620
|
role: "row",
|
|
2617
2621
|
...getStyles("row", { style: pinnedStyle }),
|
|
@@ -2627,6 +2631,7 @@ function SkeletonRows({ rowCount, columnCount, ariaRowIndexStart }) {
|
|
|
2627
2631
|
const { getStyles } = useDataTableContext();
|
|
2628
2632
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: Array.from({ length: rowCount }, (_, rowIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Table.Tr, {
|
|
2629
2633
|
"aria-rowindex": ariaRowIndexStart === void 0 ? void 0 : ariaRowIndexStart + rowIndex,
|
|
2634
|
+
"data-last": rowIndex === rowCount - 1 || void 0,
|
|
2630
2635
|
role: "row",
|
|
2631
2636
|
...getStyles("row"),
|
|
2632
2637
|
children: Array.from({ length: columnCount }, (_, columnIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Table.Td, {
|
|
@@ -2770,13 +2775,26 @@ function TableBody({ table, virtualization, columnWindow, viewportRef, loading,
|
|
|
2770
2775
|
const editingCell = ledger?.editing.cell ?? null;
|
|
2771
2776
|
const editingRowId = ledger?.editing.mode === "row" ? ledger.editing.row.id : null;
|
|
2772
2777
|
const activeRowId = ledger?.activeRow.enabled ? ledger.activeRow.id : null;
|
|
2778
|
+
const trailingRowCount = loadMoreError || loadingMore ? 1 : 0;
|
|
2779
|
+
const zoneRows = {
|
|
2780
|
+
top: topDisplayRows,
|
|
2781
|
+
center: centerDisplayRows,
|
|
2782
|
+
bottom: bottomDisplayRows
|
|
2783
|
+
};
|
|
2784
|
+
const rowsBelowOf = (zone, displayIndex) => {
|
|
2785
|
+
const laterZones = zone === "top" ? centerDisplayRows.length + bottomDisplayRows.length : zone === "center" ? bottomDisplayRows.length : 0;
|
|
2786
|
+
return zoneRows[zone].length - 1 - displayIndex + laterZones + trailingRowCount;
|
|
2787
|
+
};
|
|
2773
2788
|
const renderDisplayRow = (displayRow, options) => {
|
|
2774
2789
|
const zoneStart = options.pinnedPosition === "top" ? headerRowCount : options.pinnedPosition === "bottom" ? headerRowCount + topDisplayRows.length + centerDisplayRows.length : headerRowCount + topDisplayRows.length;
|
|
2775
2790
|
const ariaRowIndex = virtualEnabled ? zoneStart + options.displayIndex + 1 : void 0;
|
|
2791
|
+
const rowsBelow = rowsBelowOf(options.pinnedPosition ?? "center", options.displayIndex);
|
|
2792
|
+
const last = rowsBelow === 0;
|
|
2776
2793
|
if (displayRow.kind === "detail") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DetailRow, {
|
|
2777
2794
|
ariaRowIndex,
|
|
2778
2795
|
colSpan: fullWidthColSpan,
|
|
2779
2796
|
dragging: reorderSourceId === displayRow.row.id,
|
|
2797
|
+
last,
|
|
2780
2798
|
measureRef: options.measureRef,
|
|
2781
2799
|
pinnedOffset: options.pinnedOffset,
|
|
2782
2800
|
pinnedPosition: options.pinnedPosition,
|
|
@@ -2799,12 +2817,14 @@ function TableBody({ table, virtualization, columnWindow, viewportRef, loading,
|
|
|
2799
2817
|
dropSide,
|
|
2800
2818
|
editingRow: editingRowId === row.id && (ledger?.editing.row.active(row.id) ?? false),
|
|
2801
2819
|
expanded: row.getIsExpanded(),
|
|
2820
|
+
last,
|
|
2802
2821
|
measureRef: options.measureRef,
|
|
2803
2822
|
pinKey,
|
|
2804
2823
|
pinnedOffset: options.pinnedOffset,
|
|
2805
2824
|
pinnedPosition: options.pinnedPosition,
|
|
2806
2825
|
renderVersion,
|
|
2807
2826
|
row,
|
|
2827
|
+
rowsBelow: spanningActive ? rowsBelow : void 0,
|
|
2808
2828
|
selected: row.getIsSelected(),
|
|
2809
2829
|
spanKey,
|
|
2810
2830
|
spanning: spanningActive,
|
|
@@ -6390,6 +6410,7 @@ const defaultProps = {
|
|
|
6390
6410
|
withTableBorder: false,
|
|
6391
6411
|
withColumnBorders: false,
|
|
6392
6412
|
withRowBorders: true,
|
|
6413
|
+
withBottomBorder: false,
|
|
6393
6414
|
verticalSpacing: "xs",
|
|
6394
6415
|
horizontalSpacing: "xs",
|
|
6395
6416
|
tabularNums: false,
|
|
@@ -6531,7 +6552,7 @@ function DataTableFromOptions({ props }) {
|
|
|
6531
6552
|
});
|
|
6532
6553
|
}
|
|
6533
6554
|
function DataTableCore({ presentation, stylesProps, table }) {
|
|
6534
|
-
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;
|
|
6555
|
+
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;
|
|
6535
6556
|
const getStyles = (0, _mantine_core.useStyles)({
|
|
6536
6557
|
name: "DataTable",
|
|
6537
6558
|
classes,
|
|
@@ -7105,7 +7126,9 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
7105
7126
|
"data-striped": stripedMode,
|
|
7106
7127
|
"data-virtualized-columns": columnWindow !== null || void 0,
|
|
7107
7128
|
"data-virtualized-rows": virtualEnabled || void 0,
|
|
7129
|
+
"data-with-bottom-border": withBottomBorder || void 0,
|
|
7108
7130
|
"data-with-column-borders": withColumnBorders || void 0,
|
|
7131
|
+
"data-with-footer": hasFooter || void 0,
|
|
7109
7132
|
"data-with-row-borders": withRowBorders || void 0,
|
|
7110
7133
|
"data-with-table-border": withTableBorder || void 0,
|
|
7111
7134
|
...getStyles("root", { style: columnVars }),
|