@coldsmirk/ledger-mantine 0.3.1 → 0.5.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 +265 -122
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +66 -46
- package/dist/index.d.ts +66 -46
- package/dist/index.js +266 -123
- package/dist/index.js.map +1 -1
- package/dist/{labels-ChBqD1II.d.ts → labels-D-6FCakH.d.cts} +16 -2
- package/dist/{labels-ChBqD1II.d.cts → labels-D-6FCakH.d.ts} +16 -2
- package/dist/locales.cjs +10 -0
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.d.cts +2 -3
- package/dist/locales.d.ts +2 -3
- package/dist/locales.js +10 -0
- package/dist/locales.js.map +1 -1
- package/dist/styles.css +26 -6
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -52,30 +52,74 @@ let _mantine_dates = require("@mantine/dates");
|
|
|
52
52
|
*/
|
|
53
53
|
const [DataTableProvider, useDataTableContext] = (0, _mantine_core.createSafeContext)("DataTable parts must be rendered inside <DataTable>");
|
|
54
54
|
//#endregion
|
|
55
|
+
//#region src/size.ts
|
|
56
|
+
const SIZES = {
|
|
57
|
+
xs: {
|
|
58
|
+
verticalSpacing: 5,
|
|
59
|
+
horizontalSpacing: 8,
|
|
60
|
+
rowHeight: 31,
|
|
61
|
+
control: "xs",
|
|
62
|
+
glyph: 12,
|
|
63
|
+
injectedWidth: 36
|
|
64
|
+
},
|
|
65
|
+
sm: {
|
|
66
|
+
verticalSpacing: 7,
|
|
67
|
+
horizontalSpacing: 10,
|
|
68
|
+
rowHeight: 37,
|
|
69
|
+
control: "xs",
|
|
70
|
+
glyph: 14,
|
|
71
|
+
injectedWidth: 40
|
|
72
|
+
},
|
|
73
|
+
md: {
|
|
74
|
+
verticalSpacing: 8,
|
|
75
|
+
horizontalSpacing: 12,
|
|
76
|
+
rowHeight: 43,
|
|
77
|
+
control: "sm",
|
|
78
|
+
glyph: 16,
|
|
79
|
+
injectedWidth: 48
|
|
80
|
+
},
|
|
81
|
+
lg: {
|
|
82
|
+
verticalSpacing: 10,
|
|
83
|
+
horizontalSpacing: 16,
|
|
84
|
+
rowHeight: 51,
|
|
85
|
+
control: "md",
|
|
86
|
+
glyph: 18,
|
|
87
|
+
injectedWidth: 62
|
|
88
|
+
},
|
|
89
|
+
xl: {
|
|
90
|
+
verticalSpacing: 14,
|
|
91
|
+
horizontalSpacing: 20,
|
|
92
|
+
rowHeight: 61,
|
|
93
|
+
control: "lg",
|
|
94
|
+
glyph: 20,
|
|
95
|
+
injectedWidth: 76
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
//#endregion
|
|
55
99
|
//#region src/expander.tsx
|
|
56
100
|
/**
|
|
57
101
|
* The injected expander column: a per-row chevron (detail panels and sub-row trees share it)
|
|
58
102
|
* and an expand-all header affordance for trees. Clicks never reach `onRowClick`.
|
|
59
103
|
*/
|
|
60
104
|
function ExpanderHeaderCell({ table }) {
|
|
61
|
-
const { labels, icons, expansion } = useDataTableContext();
|
|
105
|
+
const { labels, icons, expansion, size } = useDataTableContext();
|
|
62
106
|
if (!table.options.getSubRows) return null;
|
|
63
107
|
const allExpanded = table.getIsAllRowsExpanded();
|
|
64
108
|
const canSomeExpand = table.getCanSomeRowsExpand();
|
|
65
109
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.ActionIcon, {
|
|
66
110
|
"aria-label": allExpanded ? labels.collapseAll : labels.expandAll,
|
|
67
111
|
"data-expanded": allExpanded || void 0,
|
|
68
|
-
size:
|
|
112
|
+
size: SIZES[size].control,
|
|
69
113
|
variant: "subtle",
|
|
70
114
|
onClick: (event) => {
|
|
71
115
|
event.stopPropagation();
|
|
72
116
|
expansion?.toggleAll(!allExpanded, canSomeExpand);
|
|
73
117
|
},
|
|
74
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.expandRow, {})
|
|
118
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.expandRow, { size: SIZES[size].glyph })
|
|
75
119
|
});
|
|
76
120
|
}
|
|
77
121
|
function ExpanderCell({ row }) {
|
|
78
|
-
const { labels, icons, expansion } = useDataTableContext();
|
|
122
|
+
const { labels, icons, expansion, size } = useDataTableContext();
|
|
79
123
|
const canExpand = row.getCanExpand();
|
|
80
124
|
if (!canExpand) return null;
|
|
81
125
|
const expanded = row.getIsExpanded();
|
|
@@ -83,13 +127,13 @@ function ExpanderCell({ row }) {
|
|
|
83
127
|
"aria-expanded": expanded,
|
|
84
128
|
"aria-label": expanded ? labels.collapseRow : labels.expandRow,
|
|
85
129
|
"data-expanded": expanded || void 0,
|
|
86
|
-
size:
|
|
130
|
+
size: SIZES[size].control,
|
|
87
131
|
variant: "subtle",
|
|
88
132
|
onClick: (event) => {
|
|
89
133
|
event.stopPropagation();
|
|
90
134
|
expansion?.toggle(row.id, expanded, canExpand);
|
|
91
135
|
},
|
|
92
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.expandRow, {})
|
|
136
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.expandRow, { size: SIZES[size].glyph })
|
|
93
137
|
});
|
|
94
138
|
}
|
|
95
139
|
//#endregion
|
|
@@ -516,7 +560,7 @@ function RowReorderOverlay({ session }) {
|
|
|
516
560
|
* why (docs/rows.md#row-ordering).
|
|
517
561
|
*/
|
|
518
562
|
function RowDragCell({ row, table }) {
|
|
519
|
-
const { labels, icons, rowReorderKeyboard } = useDataTableContext();
|
|
563
|
+
const { labels, icons, rowReorderKeyboard, size } = useDataTableContext();
|
|
520
564
|
const orderable = table.options.meta?.ledger?.rowOrdering.orderable === true;
|
|
521
565
|
const pinned = table.options.enableRowPinning === true && row.getIsPinned() !== false;
|
|
522
566
|
const { ref, isDragSource } = (0, _dnd_kit_react.useDraggable)({
|
|
@@ -574,13 +618,13 @@ function RowDragCell({ row, table }) {
|
|
|
574
618
|
"aria-label": labels.reorderRow,
|
|
575
619
|
"aria-pressed": lifted || void 0,
|
|
576
620
|
color: "gray",
|
|
577
|
-
size:
|
|
621
|
+
size: SIZES[size].control,
|
|
578
622
|
variant: "subtle",
|
|
579
623
|
onBlur: () => {
|
|
580
624
|
if (lifted) rowReorderKeyboard?.cancel();
|
|
581
625
|
},
|
|
582
626
|
onKeyDown: handleKeyDown,
|
|
583
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.reorderRow, { size:
|
|
627
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.reorderRow, { size: SIZES[size].glyph })
|
|
584
628
|
})
|
|
585
629
|
});
|
|
586
630
|
}
|
|
@@ -597,7 +641,7 @@ function RowDragCell({ row, table }) {
|
|
|
597
641
|
*/
|
|
598
642
|
function noop() {}
|
|
599
643
|
function SelectionHeaderCell({ table }) {
|
|
600
|
-
const { labels, selection } = useDataTableContext();
|
|
644
|
+
const { labels, selection, size } = useDataTableContext();
|
|
601
645
|
if (table.options.enableMultiRowSelection === false) return null;
|
|
602
646
|
const scope = table.options.meta?.ledger?.selectAllScope ?? "all";
|
|
603
647
|
const allSelected = scope === "page" ? table.getIsAllPageRowsSelected() : table.getIsAllRowsSelected();
|
|
@@ -606,7 +650,7 @@ function SelectionHeaderCell({ table }) {
|
|
|
606
650
|
"aria-label": labels.selectAllRows,
|
|
607
651
|
checked: allSelected,
|
|
608
652
|
indeterminate: !allSelected && someSelected,
|
|
609
|
-
size:
|
|
653
|
+
size: SIZES[size].control,
|
|
610
654
|
onChange: noop,
|
|
611
655
|
onClick: (event) => {
|
|
612
656
|
event.stopPropagation();
|
|
@@ -615,7 +659,7 @@ function SelectionHeaderCell({ table }) {
|
|
|
615
659
|
});
|
|
616
660
|
}
|
|
617
661
|
function SelectionCell({ row }) {
|
|
618
|
-
const { labels, instanceId, selection } = useDataTableContext();
|
|
662
|
+
const { labels, instanceId, selection, size } = useDataTableContext();
|
|
619
663
|
const selected = row.getIsSelected();
|
|
620
664
|
const select = (event) => {
|
|
621
665
|
event.stopPropagation();
|
|
@@ -626,7 +670,7 @@ function SelectionCell({ row }) {
|
|
|
626
670
|
checked: selected,
|
|
627
671
|
disabled: !row.getCanSelect(),
|
|
628
672
|
name: `${instanceId}-selection`,
|
|
629
|
-
size:
|
|
673
|
+
size: SIZES[size].control,
|
|
630
674
|
onChange: noop,
|
|
631
675
|
onClick: select
|
|
632
676
|
});
|
|
@@ -635,7 +679,7 @@ function SelectionCell({ row }) {
|
|
|
635
679
|
checked: selected,
|
|
636
680
|
disabled: !row.getCanSelect(),
|
|
637
681
|
indeterminate: !selected && row.getIsSomeSelected(),
|
|
638
|
-
size:
|
|
682
|
+
size: SIZES[size].control,
|
|
639
683
|
onChange: noop,
|
|
640
684
|
onClick: select
|
|
641
685
|
});
|
|
@@ -687,9 +731,6 @@ function buildColumns({ columns, withRowDrag, withSelection, withExpander, rowDr
|
|
|
687
731
|
const result = [];
|
|
688
732
|
if (withRowDrag) result.push(injectedColumn({
|
|
689
733
|
id: ROW_DRAG_COLUMN_ID,
|
|
690
|
-
size: 36,
|
|
691
|
-
minSize: 36,
|
|
692
|
-
maxSize: 36,
|
|
693
734
|
enableSorting: false,
|
|
694
735
|
enableHiding: false,
|
|
695
736
|
enableResizing: false,
|
|
@@ -704,9 +745,6 @@ function buildColumns({ columns, withRowDrag, withSelection, withExpander, rowDr
|
|
|
704
745
|
}, rowDragColumn));
|
|
705
746
|
if (withSelection) result.push(injectedColumn({
|
|
706
747
|
id: SELECTION_COLUMN_ID,
|
|
707
|
-
size: 40,
|
|
708
|
-
minSize: 40,
|
|
709
|
-
maxSize: 40,
|
|
710
748
|
enableSorting: false,
|
|
711
749
|
enableHiding: false,
|
|
712
750
|
enableResizing: false,
|
|
@@ -718,9 +756,6 @@ function buildColumns({ columns, withRowDrag, withSelection, withExpander, rowDr
|
|
|
718
756
|
}, selectionColumn));
|
|
719
757
|
if (withExpander) result.push(injectedColumn({
|
|
720
758
|
id: EXPANDER_COLUMN_ID,
|
|
721
|
-
size: 36,
|
|
722
|
-
minSize: 36,
|
|
723
|
-
maxSize: 36,
|
|
724
759
|
enableSorting: false,
|
|
725
760
|
enableHiding: false,
|
|
726
761
|
enableResizing: false,
|
|
@@ -1052,6 +1087,10 @@ function resolveIcons(icons) {
|
|
|
1052
1087
|
const defaultLabels = {
|
|
1053
1088
|
paginationSummary: (from, to, total) => `${from}–${to} of ${total}`,
|
|
1054
1089
|
rowsPerPage: "Rows per page",
|
|
1090
|
+
firstPage: "First page",
|
|
1091
|
+
previousPage: "Previous page",
|
|
1092
|
+
nextPage: "Next page",
|
|
1093
|
+
lastPage: "Last page",
|
|
1055
1094
|
selectAllRows: "Select all rows",
|
|
1056
1095
|
selectRow: "Select row",
|
|
1057
1096
|
selectedCount: (count) => `${count} selected`,
|
|
@@ -1080,6 +1119,12 @@ const defaultLabels = {
|
|
|
1080
1119
|
filterPlaceholder: "Filter…",
|
|
1081
1120
|
filterRangeMin: "Min",
|
|
1082
1121
|
filterRangeMax: "Max",
|
|
1122
|
+
previousMonth: "Previous month",
|
|
1123
|
+
nextMonth: "Next month",
|
|
1124
|
+
previousYear: "Previous year",
|
|
1125
|
+
nextYear: "Next year",
|
|
1126
|
+
previousDecade: "Previous decade",
|
|
1127
|
+
nextDecade: "Next decade",
|
|
1083
1128
|
searchPlaceholder: "Search…",
|
|
1084
1129
|
loading: "Loading",
|
|
1085
1130
|
empty: "No data",
|
|
@@ -1565,7 +1610,13 @@ const DEFAULT_PAGE_SIZE_OPTIONS = [
|
|
|
1565
1610
|
50,
|
|
1566
1611
|
100
|
|
1567
1612
|
];
|
|
1568
|
-
|
|
1613
|
+
const CONTROL_LABELS = {
|
|
1614
|
+
first: "firstPage",
|
|
1615
|
+
previous: "previousPage",
|
|
1616
|
+
next: "nextPage",
|
|
1617
|
+
last: "lastPage"
|
|
1618
|
+
};
|
|
1619
|
+
function PaginationBarCore({ table, labels, pageSizeOptions, size, className, style }) {
|
|
1569
1620
|
const pageSizeLabelId = (0, react.useId)();
|
|
1570
1621
|
const { pageIndex, pageSize } = table.atoms.pagination.get();
|
|
1571
1622
|
const total = table.getRowCount();
|
|
@@ -1580,8 +1631,8 @@ function PaginationBarCore({ table, labels, pageSizeOptions, className, style })
|
|
|
1580
1631
|
style,
|
|
1581
1632
|
wrap: "wrap",
|
|
1582
1633
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Text, {
|
|
1583
|
-
c: "dimmed",
|
|
1584
|
-
size
|
|
1634
|
+
c: "var(--ledger-color-dimmed)",
|
|
1635
|
+
size,
|
|
1585
1636
|
children: labels.paginationSummary(from, to, total)
|
|
1586
1637
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Group, {
|
|
1587
1638
|
gap: "md",
|
|
@@ -1590,21 +1641,24 @@ function PaginationBarCore({ table, labels, pageSizeOptions, className, style })
|
|
|
1590
1641
|
gap: "xs",
|
|
1591
1642
|
wrap: "nowrap",
|
|
1592
1643
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Text, {
|
|
1593
|
-
c: "dimmed",
|
|
1644
|
+
c: "var(--ledger-color-dimmed)",
|
|
1594
1645
|
id: pageSizeLabelId,
|
|
1595
|
-
size
|
|
1646
|
+
size,
|
|
1596
1647
|
children: labels.rowsPerPage
|
|
1597
1648
|
}, "label"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Select, {
|
|
1598
1649
|
allowDeselect: false,
|
|
1599
1650
|
"aria-labelledby": pageSizeLabelId,
|
|
1600
1651
|
data: sizeOptions.map(String),
|
|
1601
|
-
size:
|
|
1652
|
+
size: SIZES[size].control,
|
|
1602
1653
|
value: String(pageSize),
|
|
1603
1654
|
w: 84,
|
|
1604
1655
|
onChange: (value) => value !== null && table.setPageSize(Number(value))
|
|
1605
1656
|
})]
|
|
1606
1657
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Pagination, {
|
|
1607
|
-
|
|
1658
|
+
getControlProps: (control) => {
|
|
1659
|
+
return { "aria-label": labels[CONTROL_LABELS[control]] };
|
|
1660
|
+
},
|
|
1661
|
+
size: SIZES[size].control,
|
|
1608
1662
|
total: pageCount,
|
|
1609
1663
|
value: pageIndex + 1,
|
|
1610
1664
|
onChange: (page) => table.setPageIndex(page - 1)
|
|
@@ -1616,26 +1670,28 @@ function PaginationBarCore({ table, labels, pageSizeOptions, className, style })
|
|
|
1616
1670
|
* The built-in bar rendered by <DataTable> (context-styled).
|
|
1617
1671
|
*/
|
|
1618
1672
|
function PaginationBar({ table, pageSizeOptions }) {
|
|
1619
|
-
const { labels, getStyles } = useDataTableContext();
|
|
1673
|
+
const { labels, getStyles, size } = useDataTableContext();
|
|
1620
1674
|
const { className, style } = getStyles("paginationBar");
|
|
1621
1675
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationBarCore, {
|
|
1622
1676
|
className,
|
|
1623
1677
|
labels,
|
|
1624
1678
|
pageSizeOptions,
|
|
1679
|
+
size,
|
|
1625
1680
|
style,
|
|
1626
1681
|
table
|
|
1627
1682
|
});
|
|
1628
1683
|
}
|
|
1629
|
-
const paginationDefaultProps = {};
|
|
1684
|
+
const paginationDefaultProps = { size: "sm" };
|
|
1630
1685
|
/**
|
|
1631
1686
|
* Standalone compound (`DataTable.Pagination`) — place it anywhere, theme it via defaultProps.
|
|
1632
1687
|
*/
|
|
1633
1688
|
function DataTablePagination(props) {
|
|
1634
|
-
const { table, pageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS, labels, className, style } = (0, _mantine_core.useProps)("DataTablePagination", paginationDefaultProps, props);
|
|
1689
|
+
const { table, pageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS, labels, size, className, style } = (0, _mantine_core.useProps)("DataTablePagination", paginationDefaultProps, props);
|
|
1635
1690
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationBarCore, {
|
|
1636
1691
|
className: (0, clsx.default)("ledger-pagination-bar", className),
|
|
1637
1692
|
labels: resolveLabels(labels),
|
|
1638
1693
|
pageSizeOptions,
|
|
1694
|
+
size,
|
|
1639
1695
|
style,
|
|
1640
1696
|
table
|
|
1641
1697
|
});
|
|
@@ -1793,7 +1849,7 @@ function canEditCell(cell, row) {
|
|
|
1793
1849
|
* commit, and the pending presentation around it.
|
|
1794
1850
|
*/
|
|
1795
1851
|
function CellEditor({ cell }) {
|
|
1796
|
-
const { labels, getStyles } = useDataTableContext();
|
|
1852
|
+
const { labels, getStyles, size } = useDataTableContext();
|
|
1797
1853
|
const { table } = cell.getContext();
|
|
1798
1854
|
const editing = table.options.meta?.ledger?.editing;
|
|
1799
1855
|
const normalized = normalizeEdit(cell.column.columnDef.meta?.edit);
|
|
@@ -1842,7 +1898,8 @@ function CellEditor({ cell }) {
|
|
|
1842
1898
|
pending,
|
|
1843
1899
|
mode: "cell",
|
|
1844
1900
|
autoFocus: true,
|
|
1845
|
-
label: labels.editColumn(columnHeaderText(cell.column))
|
|
1901
|
+
label: labels.editColumn(columnHeaderText(cell.column)),
|
|
1902
|
+
size: SIZES[size].control
|
|
1846
1903
|
});
|
|
1847
1904
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1848
1905
|
"aria-busy": pending || void 0,
|
|
@@ -1864,7 +1921,7 @@ function CellEditor({ cell }) {
|
|
|
1864
1921
|
* a virtualized unmount), blur never commits, and Enter/Escape commit or cancel the whole row.
|
|
1865
1922
|
*/
|
|
1866
1923
|
function RowCellEditor({ cell }) {
|
|
1867
|
-
const { labels, getStyles } = useDataTableContext();
|
|
1924
|
+
const { labels, getStyles, size } = useDataTableContext();
|
|
1868
1925
|
const { table } = cell.getContext();
|
|
1869
1926
|
const editing = table.options.meta?.ledger?.editing;
|
|
1870
1927
|
const rowApi = editing?.row;
|
|
@@ -1922,7 +1979,8 @@ function RowCellEditor({ cell }) {
|
|
|
1922
1979
|
},
|
|
1923
1980
|
error: editError,
|
|
1924
1981
|
pending,
|
|
1925
|
-
label
|
|
1982
|
+
label,
|
|
1983
|
+
size: SIZES[size].control
|
|
1926
1984
|
}) : normalized.render({
|
|
1927
1985
|
row: cell.row,
|
|
1928
1986
|
column: cell.column,
|
|
@@ -1934,7 +1992,8 @@ function RowCellEditor({ cell }) {
|
|
|
1934
1992
|
pending,
|
|
1935
1993
|
mode: "row",
|
|
1936
1994
|
autoFocus,
|
|
1937
|
-
label
|
|
1995
|
+
label,
|
|
1996
|
+
size: SIZES[size].control
|
|
1938
1997
|
});
|
|
1939
1998
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1940
1999
|
ref: containerRef,
|
|
@@ -2327,7 +2386,7 @@ function usePinnedRowOffsets(topCount, bottomCount) {
|
|
|
2327
2386
|
* variables).
|
|
2328
2387
|
*/
|
|
2329
2388
|
const TREE_INDENT_PX = 20;
|
|
2330
|
-
const DEFAULT_ESTIMATED_ROW_HEIGHT =
|
|
2389
|
+
const DEFAULT_ESTIMATED_ROW_HEIGHT = SIZES.sm.rowHeight;
|
|
2331
2390
|
const DEFAULT_OVERSCAN = 8;
|
|
2332
2391
|
/**
|
|
2333
2392
|
* Whether any leaf definition declares a merge — the gate that keeps span-index reads (and the
|
|
@@ -2375,7 +2434,7 @@ function countDisplayRows(rows, withDetailPanels) {
|
|
|
2375
2434
|
* Grouped cell: expander, the grouped value, and the group size.
|
|
2376
2435
|
*/
|
|
2377
2436
|
function GroupCell({ cell }) {
|
|
2378
|
-
const { labels, icons, expansion } = useDataTableContext();
|
|
2437
|
+
const { labels, icons, expansion, size } = useDataTableContext();
|
|
2379
2438
|
const { row } = cell;
|
|
2380
2439
|
const expandedGroup = row.getIsExpanded();
|
|
2381
2440
|
const canExpandGroup = row.getCanExpand();
|
|
@@ -2386,13 +2445,13 @@ function GroupCell({ cell }) {
|
|
|
2386
2445
|
"aria-expanded": expandedGroup,
|
|
2387
2446
|
"aria-label": expandedGroup ? labels.collapseRow : labels.expandRow,
|
|
2388
2447
|
"data-expanded": expandedGroup || void 0,
|
|
2389
|
-
size:
|
|
2448
|
+
size: SIZES[size].control,
|
|
2390
2449
|
variant: "subtle",
|
|
2391
2450
|
onClick: (event) => {
|
|
2392
2451
|
event.stopPropagation();
|
|
2393
2452
|
expansion?.toggle(row.id, expandedGroup, canExpandGroup);
|
|
2394
2453
|
},
|
|
2395
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.expandRow, { size:
|
|
2454
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.expandRow, { size: SIZES[size].glyph })
|
|
2396
2455
|
}),
|
|
2397
2456
|
(0, _tanstack_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext()),
|
|
2398
2457
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
@@ -2416,7 +2475,7 @@ function GroupCell({ cell }) {
|
|
|
2416
2475
|
* `onRowClick` out.
|
|
2417
2476
|
*/
|
|
2418
2477
|
function InstantCell({ cell, render }) {
|
|
2419
|
-
const { labels, getStyles } = useDataTableContext();
|
|
2478
|
+
const { labels, getStyles, size } = useDataTableContext();
|
|
2420
2479
|
const { table } = cell.getContext();
|
|
2421
2480
|
const instant = table.options.meta?.ledger?.editing.instant;
|
|
2422
2481
|
const rowId = cell.row.id;
|
|
@@ -2448,7 +2507,8 @@ function InstantCell({ cell, render }) {
|
|
|
2448
2507
|
commit: (next) => instant.commit(rowId, columnId, next),
|
|
2449
2508
|
pending,
|
|
2450
2509
|
error,
|
|
2451
|
-
label: labels.editColumn(columnHeaderText(cell.column))
|
|
2510
|
+
label: labels.editColumn(columnHeaderText(cell.column)),
|
|
2511
|
+
size: SIZES[size].control
|
|
2452
2512
|
}),
|
|
2453
2513
|
pending && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Loader, {
|
|
2454
2514
|
"aria-label": labels.editPending,
|
|
@@ -3019,8 +3079,16 @@ function autosizeColumn(setColumnSizing, { columnId, minSize, maxSize, hasFilter
|
|
|
3019
3079
|
* a black box that may ship no clear of its own — keeps the popover-level fallback.
|
|
3020
3080
|
*/
|
|
3021
3081
|
const FACETED_OPTIONS_CAP = 100;
|
|
3082
|
+
/**
|
|
3083
|
+
* The smallest pointer target WCAG 2.2 AA accepts without spacing around it, in px.
|
|
3084
|
+
*/
|
|
3085
|
+
const MIN_TARGET_SIZE = 24;
|
|
3086
|
+
/**
|
|
3087
|
+
* The calendar's weekend color, as the variable Mantine's day rule reads (see DateRangeFilter).
|
|
3088
|
+
*/
|
|
3089
|
+
const WEEKEND_COLOR = { "--mantine-color-red-6": "color-mix(in srgb, var(--mantine-color-red-text), var(--mantine-color-text) 30%)" };
|
|
3022
3090
|
function FilterPopover({ column }) {
|
|
3023
|
-
const { labels, icons, getStyles, filterMode } = useDataTableContext();
|
|
3091
|
+
const { labels, icons, getStyles, filterMode, size } = useDataTableContext();
|
|
3024
3092
|
const filter = column.columnDef.meta?.filter;
|
|
3025
3093
|
if (!filter || !column.getCanFilter()) return null;
|
|
3026
3094
|
const active = column.getFilterValue() !== void 0;
|
|
@@ -3032,7 +3100,9 @@ function FilterPopover({ column }) {
|
|
|
3032
3100
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Popover.Target, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.ActionIcon, {
|
|
3033
3101
|
"aria-label": name,
|
|
3034
3102
|
"data-active": active || void 0,
|
|
3035
|
-
|
|
3103
|
+
mih: MIN_TARGET_SIZE,
|
|
3104
|
+
miw: MIN_TARGET_SIZE,
|
|
3105
|
+
size: SIZES[size].control,
|
|
3036
3106
|
variant: active ? "light" : "subtle",
|
|
3037
3107
|
onClick: (event) => event.stopPropagation(),
|
|
3038
3108
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.filterColumn, {})
|
|
@@ -3213,11 +3283,21 @@ function DateRangeFilter({ column, name }) {
|
|
|
3213
3283
|
const filterValue = column.getFilterValue();
|
|
3214
3284
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_dates.DatePicker, {
|
|
3215
3285
|
allowSingleDateInRange: true,
|
|
3286
|
+
hideOutsideDates: true,
|
|
3216
3287
|
highlightToday: true,
|
|
3217
3288
|
"aria-label": name,
|
|
3218
3289
|
size: "xs",
|
|
3290
|
+
style: WEEKEND_COLOR,
|
|
3219
3291
|
type: "range",
|
|
3220
3292
|
value: filterValue ?? [null, null],
|
|
3293
|
+
ariaLabels: {
|
|
3294
|
+
previousMonth: labels.previousMonth,
|
|
3295
|
+
nextMonth: labels.nextMonth,
|
|
3296
|
+
previousYear: labels.previousYear,
|
|
3297
|
+
nextYear: labels.nextYear,
|
|
3298
|
+
previousDecade: labels.previousDecade,
|
|
3299
|
+
nextDecade: labels.nextDecade
|
|
3300
|
+
},
|
|
3221
3301
|
onChange: (next) => column.setFilterValue(!next[0] && !next[1] ? void 0 : next)
|
|
3222
3302
|
}), filterValue !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Group, {
|
|
3223
3303
|
justify: "flex-end",
|
|
@@ -3474,8 +3554,9 @@ function TableHeader({ table, columnWidths, columnSizing, columnWindow }) {
|
|
|
3474
3554
|
});
|
|
3475
3555
|
}
|
|
3476
3556
|
function HeaderCell({ header, table, reorder, resize, columnWidths, columnSizing, colSpan, ariaColIndex }) {
|
|
3477
|
-
const { getStyles, labels, icons } = useDataTableContext();
|
|
3557
|
+
const { getStyles, labels, icons, size } = useDataTableContext();
|
|
3478
3558
|
const { column } = header;
|
|
3559
|
+
const { glyph } = SIZES[size];
|
|
3479
3560
|
const { meta } = column.columnDef;
|
|
3480
3561
|
const internal = isInternalColumn(column.id);
|
|
3481
3562
|
const canSort = column.getCanSort();
|
|
@@ -3551,9 +3632,9 @@ function HeaderCell({ header, table, reorder, resize, columnWidths, columnSizing
|
|
|
3551
3632
|
...getStyles("sortIndicator"),
|
|
3552
3633
|
"data-sorted": sorted || void 0,
|
|
3553
3634
|
children: [
|
|
3554
|
-
sorted === "asc" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.sortAsc, { size:
|
|
3555
|
-
sorted === "desc" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.sortDesc, { size:
|
|
3556
|
-
sorted === false && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.sortable, { size:
|
|
3635
|
+
sorted === "asc" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.sortAsc, { size: glyph }),
|
|
3636
|
+
sorted === "desc" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.sortDesc, { size: glyph }),
|
|
3637
|
+
sorted === false && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.sortable, { size: glyph }),
|
|
3557
3638
|
sorted !== false && sortCount > 1 && sortIndex >= 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("sup", { children: sortIndex + 1 })
|
|
3558
3639
|
]
|
|
3559
3640
|
})]
|
|
@@ -3706,7 +3787,7 @@ function minWidthPx(tableMinWidth, viewport) {
|
|
|
3706
3787
|
if (!tableElement) return Number.parseFloat(tableMinWidth) || 0;
|
|
3707
3788
|
return Number.parseFloat(getComputedStyle(tableElement).minWidth) || 0;
|
|
3708
3789
|
}
|
|
3709
|
-
function useColumnWidths(table, columns, viewport, tableMinWidth) {
|
|
3790
|
+
function useColumnWidths(table, columns, viewport, tableMinWidth, injectedWidth) {
|
|
3710
3791
|
const [availableWidth, setAvailableWidth] = (0, react.useState)(0);
|
|
3711
3792
|
const measure = (0, react.useCallback)(() => {
|
|
3712
3793
|
if (!viewport) return;
|
|
@@ -3725,6 +3806,12 @@ function useColumnWidths(table, columns, viewport, tableMinWidth) {
|
|
|
3725
3806
|
const resolved = (0, react.useMemo)(() => {
|
|
3726
3807
|
return resolveColumnWidths(columns.map((column) => {
|
|
3727
3808
|
const raw = rawColumnSizing(column.columnDef);
|
|
3809
|
+
if (isInternalColumn(column.id)) return {
|
|
3810
|
+
id: column.id,
|
|
3811
|
+
size: raw?.size ?? injectedWidth,
|
|
3812
|
+
minSize: raw?.minSize ?? injectedWidth,
|
|
3813
|
+
maxSize: raw?.maxSize ?? injectedWidth
|
|
3814
|
+
};
|
|
3728
3815
|
return {
|
|
3729
3816
|
id: column.id,
|
|
3730
3817
|
size: raw ? raw.size ?? defaultColumn?.size : column.columnDef.size,
|
|
@@ -3736,7 +3823,8 @@ function useColumnWidths(table, columns, viewport, tableMinWidth) {
|
|
|
3736
3823
|
columns,
|
|
3737
3824
|
columnSizing,
|
|
3738
3825
|
availableWidth,
|
|
3739
|
-
defaultColumn
|
|
3826
|
+
defaultColumn,
|
|
3827
|
+
injectedWidth
|
|
3740
3828
|
]);
|
|
3741
3829
|
const signature = JSON.stringify([resolved.total, Object.entries(resolved.byId)]);
|
|
3742
3830
|
return (0, react.useMemo)(() => resolved, [signature]);
|
|
@@ -3787,6 +3875,24 @@ const builtInFilterFns = {
|
|
|
3787
3875
|
startsWith: _tanstack_react_table.filterFn_startsWith,
|
|
3788
3876
|
weakEquals: _tanstack_react_table.filterFn_weakEquals
|
|
3789
3877
|
};
|
|
3878
|
+
/**
|
|
3879
|
+
* Typed through the exported definitions on purpose: since 9.2 several of their value types
|
|
3880
|
+
* name an alias TanStack does not export, and an inferred registry would carry that alias into
|
|
3881
|
+
* ledger's declaration files, where no consumer can resolve it.
|
|
3882
|
+
*/
|
|
3883
|
+
const builtInAggregationFns = {
|
|
3884
|
+
count: _tanstack_react_table.aggregationFn_count,
|
|
3885
|
+
extent: _tanstack_react_table.aggregationFn_extent,
|
|
3886
|
+
first: _tanstack_react_table.aggregationFn_first,
|
|
3887
|
+
last: _tanstack_react_table.aggregationFn_last,
|
|
3888
|
+
max: _tanstack_react_table.aggregationFn_max,
|
|
3889
|
+
mean: _tanstack_react_table.aggregationFn_mean,
|
|
3890
|
+
median: _tanstack_react_table.aggregationFn_median,
|
|
3891
|
+
min: _tanstack_react_table.aggregationFn_min,
|
|
3892
|
+
sum: _tanstack_react_table.aggregationFn_sum,
|
|
3893
|
+
unique: _tanstack_react_table.aggregationFn_unique,
|
|
3894
|
+
uniqueCount: _tanstack_react_table.aggregationFn_uniqueCount
|
|
3895
|
+
};
|
|
3790
3896
|
const ledgerFeatures = (0, _tanstack_react_table.tableFeatures)({
|
|
3791
3897
|
cellSpanningFeature: _tanstack_react_table.cellSpanningFeature,
|
|
3792
3898
|
columnFacetingFeature: _tanstack_react_table.columnFacetingFeature,
|
|
@@ -3811,19 +3917,7 @@ const ledgerFeatures = (0, _tanstack_react_table.tableFeatures)({
|
|
|
3811
3917
|
groupedRowModel: (0, _tanstack_react_table.createGroupedRowModel)(),
|
|
3812
3918
|
paginatedRowModel: (0, _tanstack_react_table.createPaginatedRowModel)(),
|
|
3813
3919
|
sortedRowModel: (0, _tanstack_react_table.createSortedRowModel)(),
|
|
3814
|
-
aggregationFns:
|
|
3815
|
-
count: _tanstack_react_table.aggregationFn_count,
|
|
3816
|
-
extent: _tanstack_react_table.aggregationFn_extent,
|
|
3817
|
-
first: _tanstack_react_table.aggregationFn_first,
|
|
3818
|
-
last: _tanstack_react_table.aggregationFn_last,
|
|
3819
|
-
max: _tanstack_react_table.aggregationFn_max,
|
|
3820
|
-
mean: _tanstack_react_table.aggregationFn_mean,
|
|
3821
|
-
median: _tanstack_react_table.aggregationFn_median,
|
|
3822
|
-
min: _tanstack_react_table.aggregationFn_min,
|
|
3823
|
-
sum: _tanstack_react_table.aggregationFn_sum,
|
|
3824
|
-
unique: _tanstack_react_table.aggregationFn_unique,
|
|
3825
|
-
uniqueCount: _tanstack_react_table.aggregationFn_uniqueCount
|
|
3826
|
-
},
|
|
3920
|
+
aggregationFns: builtInAggregationFns,
|
|
3827
3921
|
filterFns: {
|
|
3828
3922
|
...builtInFilterFns,
|
|
3829
3923
|
...ledgerFilterFns
|
|
@@ -6344,6 +6438,33 @@ function useStylesRevision(getStyles, selectors) {
|
|
|
6344
6438
|
return revision;
|
|
6345
6439
|
}
|
|
6346
6440
|
//#endregion
|
|
6441
|
+
//#region src/use-viewport-overflow.ts
|
|
6442
|
+
/**
|
|
6443
|
+
* Whether the body viewport scrolls on either axis. A scroll container has to be reachable by
|
|
6444
|
+
* keyboard to be scrolled by it (WCAG 2.1.1), while a focus stop over content that fits is a
|
|
6445
|
+
* Tab press spent on nothing — so the viewport's focus stop follows this.
|
|
6446
|
+
*
|
|
6447
|
+
* Measured whenever the viewport or its content resizes: rows arriving, columns widening, or
|
|
6448
|
+
* the host resizing the table each change the answer without a scroll event. A 1px tolerance
|
|
6449
|
+
* absorbs fractional layout rounding, which would otherwise flicker the stop on and off.
|
|
6450
|
+
*/
|
|
6451
|
+
function useViewportOverflow(viewport) {
|
|
6452
|
+
const [overflowing, setOverflowing] = (0, react.useState)(false);
|
|
6453
|
+
(0, react.useLayoutEffect)(() => {
|
|
6454
|
+
if (!viewport) return;
|
|
6455
|
+
const measure = () => {
|
|
6456
|
+
const next = viewport.scrollHeight - viewport.clientHeight > 1 || viewport.scrollWidth - viewport.clientWidth > 1;
|
|
6457
|
+
setOverflowing(next);
|
|
6458
|
+
};
|
|
6459
|
+
measure();
|
|
6460
|
+
const observer = new ResizeObserver(measure);
|
|
6461
|
+
observer.observe(viewport);
|
|
6462
|
+
if (viewport.firstElementChild) observer.observe(viewport.firstElementChild);
|
|
6463
|
+
return () => observer.disconnect();
|
|
6464
|
+
}, [viewport]);
|
|
6465
|
+
return overflowing;
|
|
6466
|
+
}
|
|
6467
|
+
//#endregion
|
|
6347
6468
|
//#region src/data-table.tsx
|
|
6348
6469
|
/**
|
|
6349
6470
|
* The root component (docs/api.md): a generic Mantine factory with full Styles API,
|
|
@@ -6401,7 +6522,7 @@ const STYLE_SELECTORS = Object.keys(classes);
|
|
|
6401
6522
|
*/
|
|
6402
6523
|
const NO_ARIA_ROWS = [];
|
|
6403
6524
|
const EMPTY_STATE_STYLES = { title: {
|
|
6404
|
-
color: "var(--
|
|
6525
|
+
color: "var(--ledger-color-dimmed)",
|
|
6405
6526
|
fontWeight: 500
|
|
6406
6527
|
} };
|
|
6407
6528
|
const defaultProps = {
|
|
@@ -6411,8 +6532,7 @@ const defaultProps = {
|
|
|
6411
6532
|
withColumnBorders: false,
|
|
6412
6533
|
withRowBorders: true,
|
|
6413
6534
|
withBottomBorder: false,
|
|
6414
|
-
|
|
6415
|
-
horizontalSpacing: "xs",
|
|
6535
|
+
size: "sm",
|
|
6416
6536
|
tabularNums: false,
|
|
6417
6537
|
virtualizedRows: false,
|
|
6418
6538
|
virtualizedColumns: false,
|
|
@@ -6426,12 +6546,13 @@ const defaultProps = {
|
|
|
6426
6546
|
function leafCol(column) {
|
|
6427
6547
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("col", { style: { width: `var(${columnWidthVar(column.id)})` } }, column.id);
|
|
6428
6548
|
}
|
|
6429
|
-
const varsResolver = (0, _mantine_core.createVarsResolver)((theme, { stripedColor, highlightOnHoverColor, borderColor, radius }) => {
|
|
6549
|
+
const varsResolver = (0, _mantine_core.createVarsResolver)((theme, { stripedColor, highlightOnHoverColor, borderColor, radius, size }) => {
|
|
6430
6550
|
return { root: {
|
|
6431
6551
|
"--ledger-striped-color": stripedColor ? (0, _mantine_core.getThemeColor)(stripedColor, theme) : void 0,
|
|
6432
6552
|
"--ledger-hover-color": highlightOnHoverColor ? (0, _mantine_core.getThemeColor)(highlightOnHoverColor, theme) : void 0,
|
|
6433
6553
|
"--ledger-border-color": borderColor ? (0, _mantine_core.getThemeColor)(borderColor, theme) : void 0,
|
|
6434
|
-
"--ledger-radius": radius === void 0 ? void 0 : (0, _mantine_core.getRadius)(radius)
|
|
6554
|
+
"--ledger-radius": radius === void 0 ? void 0 : (0, _mantine_core.getRadius)(radius),
|
|
6555
|
+
"--ledger-font-size": (0, _mantine_core.getFontSize)(size)
|
|
6435
6556
|
} };
|
|
6436
6557
|
});
|
|
6437
6558
|
const OPTION_KEY_SET = /* @__PURE__ */ new Set([
|
|
@@ -6552,7 +6673,7 @@ function DataTableFromOptions({ props }) {
|
|
|
6552
6673
|
});
|
|
6553
6674
|
}
|
|
6554
6675
|
function DataTableCore({ presentation, stylesProps, table }) {
|
|
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;
|
|
6676
|
+
const { striped, stripedColor: _stripedColor, highlightOnHover, highlightOnHoverColor: _highlightOnHoverColor, withTableBorder, withColumnBorders, withRowBorders, withBottomBorder, borderColor: _borderColor, radius: _radius, size: sizeProp, 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;
|
|
6556
6677
|
const getStyles = (0, _mantine_core.useStyles)({
|
|
6557
6678
|
name: "DataTable",
|
|
6558
6679
|
classes,
|
|
@@ -6593,6 +6714,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
6593
6714
|
viewportRef.current = element;
|
|
6594
6715
|
setViewport(element);
|
|
6595
6716
|
}, []);
|
|
6717
|
+
const viewportOverflows = useViewportOverflow(viewport);
|
|
6596
6718
|
const startLeafColumns = table.getStartVisibleLeafColumns();
|
|
6597
6719
|
const endLeafColumns = table.getEndVisibleLeafColumns();
|
|
6598
6720
|
const displayColumns = [
|
|
@@ -6605,9 +6727,11 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
6605
6727
|
const displayOrderSignature = JSON.stringify(displayColumns.map((column) => column.id));
|
|
6606
6728
|
const ledgerColumns = table.options.meta?.ledger?.columns;
|
|
6607
6729
|
const visibleLeafColumns = (0, react.useMemo)(() => displayColumns, [displayOrderSignature, ledgerColumns]);
|
|
6608
|
-
const
|
|
6730
|
+
const size = sizeProp ?? "sm";
|
|
6731
|
+
const scale = SIZES[size];
|
|
6732
|
+
const columnWidths = useColumnWidths(table, visibleLeafColumns, viewport, tableMinWidth, scale.injectedWidth);
|
|
6609
6733
|
const virtualization = virtualizedRows ? {
|
|
6610
|
-
estimateHeight: typeof virtualizedRows === "object" && virtualizedRows.estimateHeight !== void 0 ? virtualizedRows.estimateHeight :
|
|
6734
|
+
estimateHeight: typeof virtualizedRows === "object" && virtualizedRows.estimateHeight !== void 0 ? virtualizedRows.estimateHeight : scale.rowHeight,
|
|
6611
6735
|
overscan: typeof virtualizedRows === "object" && virtualizedRows.overscan !== void 0 ? virtualizedRows.overscan : 8
|
|
6612
6736
|
} : null;
|
|
6613
6737
|
const virtualEnabled = virtualization !== null;
|
|
@@ -6806,7 +6930,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
6806
6930
|
rowPinningActive,
|
|
6807
6931
|
withDetailPanels
|
|
6808
6932
|
]);
|
|
6809
|
-
const bodyAriaRowCount = loading && logicalDisplayRowCount === 0 ? skeletonRowCount : logicalDisplayRowCount + (loadMoreError || loadingMore ? 1 : 0);
|
|
6933
|
+
const bodyAriaRowCount = loading && logicalDisplayRowCount === 0 ? skeletonRowCount : logicalDisplayRowCount + (loadMoreError || loadingMore ? 1 : 0) + (isEmpty || errorActive ? 1 : 0);
|
|
6810
6934
|
const footerRowCount = visibleFooterGroups(table).length;
|
|
6811
6935
|
const ariaRowCount = headerRowCount + bodyAriaRowCount + footerRowCount;
|
|
6812
6936
|
const footerAriaRowIndexStart = headerRowCount + bodyAriaRowCount + 1;
|
|
@@ -7037,11 +7161,11 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
7037
7161
|
]);
|
|
7038
7162
|
const stripedMode = striped === true ? "odd" : striped || void 0;
|
|
7039
7163
|
const sharedTableProps = {
|
|
7040
|
-
horizontalSpacing,
|
|
7164
|
+
horizontalSpacing: horizontalSpacing ?? scale.horizontalSpacing,
|
|
7041
7165
|
layout: "fixed",
|
|
7042
7166
|
role: "presentation",
|
|
7043
7167
|
tabularNums,
|
|
7044
|
-
verticalSpacing
|
|
7168
|
+
verticalSpacing: verticalSpacing ?? scale.verticalSpacing
|
|
7045
7169
|
};
|
|
7046
7170
|
const tableStyleProps = () => getStyles("table", { style: {
|
|
7047
7171
|
width: columnWidths.total > 0 ? columnWidths.total : void 0,
|
|
@@ -7077,6 +7201,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
7077
7201
|
getStyles: stylesRevision,
|
|
7078
7202
|
labels,
|
|
7079
7203
|
icons,
|
|
7204
|
+
size,
|
|
7080
7205
|
filterMode,
|
|
7081
7206
|
virtualizedRows: virtualEnabled,
|
|
7082
7207
|
withColumnHeaders: columnHeadersVisible,
|
|
@@ -7100,6 +7225,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
7100
7225
|
stylesRevision,
|
|
7101
7226
|
labels,
|
|
7102
7227
|
icons,
|
|
7228
|
+
size,
|
|
7103
7229
|
filterMode,
|
|
7104
7230
|
virtualEnabled,
|
|
7105
7231
|
columnHeadersVisible,
|
|
@@ -7123,6 +7249,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
7123
7249
|
"data-loading": loading || void 0,
|
|
7124
7250
|
"data-scrolled-end": scrollEdges.end || void 0,
|
|
7125
7251
|
"data-scrolled-start": scrollEdges.start || void 0,
|
|
7252
|
+
"data-size": size,
|
|
7126
7253
|
"data-striped": stripedMode,
|
|
7127
7254
|
"data-virtualized-columns": columnWindow !== null || void 0,
|
|
7128
7255
|
"data-virtualized-rows": virtualEnabled || void 0,
|
|
@@ -7177,11 +7304,10 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
7177
7304
|
},
|
|
7178
7305
|
viewportProps: mergeElementProps(viewportProps, {
|
|
7179
7306
|
style: { overscrollBehavior: "none" },
|
|
7307
|
+
role: "rowgroup",
|
|
7180
7308
|
"aria-describedby": viewportDescribedBy,
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
onKeyDown: handleActiveRowKeyDown
|
|
7184
|
-
}
|
|
7309
|
+
tabIndex: activeRowEnabled || viewportOverflows ? 0 : void 0,
|
|
7310
|
+
...activeRowEnabled && { onKeyDown: handleActiveRowKeyDown }
|
|
7185
7311
|
}),
|
|
7186
7312
|
onScrollPositionChange: handleScrollPositionChange,
|
|
7187
7313
|
children: [
|
|
@@ -7204,43 +7330,59 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
7204
7330
|
})]
|
|
7205
7331
|
}),
|
|
7206
7332
|
isEmpty && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7333
|
+
"aria-rowindex": virtualEnabled ? headerRowCount + bodyAriaRowCount : void 0,
|
|
7334
|
+
role: "row",
|
|
7335
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
7336
|
+
...getStyles("empty"),
|
|
7337
|
+
"aria-colspan": visibleLeafColumns.length,
|
|
7338
|
+
"data-variant": filtersActive ? "no-results" : "no-data",
|
|
7339
|
+
role: "cell",
|
|
7340
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
7341
|
+
role: "status",
|
|
7342
|
+
children: emptyState ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.EmptyState, {
|
|
7343
|
+
withIndicatorBackground: true,
|
|
7344
|
+
size: "sm",
|
|
7345
|
+
styles: EMPTY_STATE_STYLES,
|
|
7346
|
+
title: filtersActive ? labels.noResults : labels.empty,
|
|
7347
|
+
icon: filtersActive ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.noResults, {
|
|
7348
|
+
size: 40,
|
|
7349
|
+
strokeWidth: 1.5
|
|
7350
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.empty, {
|
|
7351
|
+
size: 40,
|
|
7352
|
+
strokeWidth: 1.5
|
|
7353
|
+
})
|
|
7354
|
+
})
|
|
7221
7355
|
})
|
|
7222
7356
|
})
|
|
7223
7357
|
}),
|
|
7224
7358
|
errorActive && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
7225
|
-
|
|
7226
|
-
"
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
|
|
7359
|
+
"aria-rowindex": virtualEnabled ? headerRowCount + bodyAriaRowCount : void 0,
|
|
7360
|
+
role: "row",
|
|
7361
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
7362
|
+
...getStyles("empty"),
|
|
7363
|
+
"aria-colspan": visibleLeafColumns.length,
|
|
7364
|
+
"data-over-rows": rowsLength > 0 || void 0,
|
|
7365
|
+
"data-variant": "error",
|
|
7366
|
+
role: "cell",
|
|
7367
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
7368
|
+
role: "alert",
|
|
7369
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.EmptyState, {
|
|
7370
|
+
withIndicatorBackground: true,
|
|
7371
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.error, {
|
|
7372
|
+
size: 40,
|
|
7373
|
+
strokeWidth: 1.5
|
|
7374
|
+
}),
|
|
7375
|
+
size: "sm",
|
|
7376
|
+
styles: EMPTY_STATE_STYLES,
|
|
7377
|
+
title: error === true ? labels.error : error,
|
|
7378
|
+
children: onRetry && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Button, {
|
|
7379
|
+
leftSection: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.retry, { size: 14 }),
|
|
7380
|
+
size: "xs",
|
|
7381
|
+
variant: "light",
|
|
7382
|
+
onClick: onRetry,
|
|
7383
|
+
children: labels.retry
|
|
7384
|
+
})
|
|
7385
|
+
})
|
|
7244
7386
|
})
|
|
7245
7387
|
})
|
|
7246
7388
|
})
|
|
@@ -7287,14 +7429,15 @@ DataTable.SelectionBar = DataTableSelectionBar;
|
|
|
7287
7429
|
* The shipped editor renderers — conveniences, never the mechanism. Each is an ordinary
|
|
7288
7430
|
* renderer over the public editing contexts (docs/editing.md#editors), which is the proof the
|
|
7289
7431
|
* contexts suffice: anything these do, an application's own renderer can do the same way.
|
|
7290
|
-
* All are default-variant Mantine inputs — the border marks the cell as an
|
|
7432
|
+
* All are default-variant Mantine inputs at the context's `size` — the border marks the cell as an
|
|
7433
|
+
* open editor, and the size keeps it inside the row.
|
|
7291
7434
|
*/
|
|
7292
|
-
const renderTextEditor = ({ value, setValue, error, pending, autoFocus, label }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.TextInput, {
|
|
7435
|
+
const renderTextEditor = ({ value, setValue, error, pending, autoFocus, label, size }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.TextInput, {
|
|
7293
7436
|
"aria-label": label,
|
|
7294
7437
|
autoFocus,
|
|
7295
7438
|
disabled: pending,
|
|
7296
7439
|
error,
|
|
7297
|
-
size
|
|
7440
|
+
size,
|
|
7298
7441
|
value: value === null || value === void 0 ? "" : String(value),
|
|
7299
7442
|
onChange: (event) => setValue(event.currentTarget.value)
|
|
7300
7443
|
});
|
|
@@ -7304,13 +7447,13 @@ const renderTextEditor = ({ value, setValue, error, pending, autoFocus, label })
|
|
|
7304
7447
|
function textEditor() {
|
|
7305
7448
|
return renderTextEditor;
|
|
7306
7449
|
}
|
|
7307
|
-
const renderNumberEditor = ({ value, setValue, error, pending, autoFocus, label }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.NumberInput, {
|
|
7450
|
+
const renderNumberEditor = ({ value, setValue, error, pending, autoFocus, label, size }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.NumberInput, {
|
|
7308
7451
|
hideControls: true,
|
|
7309
7452
|
"aria-label": label,
|
|
7310
7453
|
autoFocus,
|
|
7311
7454
|
disabled: pending,
|
|
7312
7455
|
error,
|
|
7313
|
-
size
|
|
7456
|
+
size,
|
|
7314
7457
|
value: typeof value === "number" || typeof value === "string" ? value : "",
|
|
7315
7458
|
onChange: (next) => setValue(next === "" ? null : next)
|
|
7316
7459
|
});
|
|
@@ -7326,7 +7469,7 @@ function numberEditor() {
|
|
|
7326
7469
|
* draft-bound field among the row's others, and the row's own commit decides.
|
|
7327
7470
|
*/
|
|
7328
7471
|
function selectEditor(options) {
|
|
7329
|
-
return ({ value, setValue, commit, error, pending, mode, autoFocus, label }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Select, {
|
|
7472
|
+
return ({ value, setValue, commit, error, pending, mode, autoFocus, label, size }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Select, {
|
|
7330
7473
|
"aria-label": label,
|
|
7331
7474
|
autoFocus,
|
|
7332
7475
|
comboboxProps: { withinPortal: true },
|
|
@@ -7334,7 +7477,7 @@ function selectEditor(options) {
|
|
|
7334
7477
|
defaultDropdownOpened: mode === "cell",
|
|
7335
7478
|
disabled: pending,
|
|
7336
7479
|
error,
|
|
7337
|
-
size
|
|
7480
|
+
size,
|
|
7338
7481
|
value: value === null || value === void 0 ? null : String(value),
|
|
7339
7482
|
onChange: (next) => {
|
|
7340
7483
|
setValue(next);
|
|
@@ -7342,12 +7485,12 @@ function selectEditor(options) {
|
|
|
7342
7485
|
}
|
|
7343
7486
|
});
|
|
7344
7487
|
}
|
|
7345
|
-
const renderCheckboxEditor = ({ value, commit, pending, error, label }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Checkbox, {
|
|
7488
|
+
const renderCheckboxEditor = ({ value, commit, pending, error, label, size }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Checkbox, {
|
|
7346
7489
|
"aria-label": label,
|
|
7347
7490
|
checked: Boolean(value),
|
|
7348
7491
|
disabled: pending,
|
|
7349
7492
|
error: Boolean(error),
|
|
7350
|
-
size
|
|
7493
|
+
size,
|
|
7351
7494
|
onChange: (event) => void commit(event.currentTarget.checked)
|
|
7352
7495
|
});
|
|
7353
7496
|
/**
|