react-glide-table 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -19
- package/dist/compound.cjs +2235 -0
- package/dist/compound.d.cts +63 -0
- package/dist/compound.d.ts +63 -0
- package/dist/compound.js +2217 -0
- package/dist/core.cjs +1198 -0
- package/dist/core.d.cts +256 -0
- package/dist/core.d.ts +256 -0
- package/dist/core.js +1154 -0
- package/dist/index.cjs +243 -93
- package/dist/index.d.cts +5 -481
- package/dist/index.d.ts +5 -481
- package/dist/index.js +230 -80
- package/dist/types-BfthylVR.d.cts +220 -0
- package/dist/types-BfthylVR.d.ts +220 -0
- package/package.json +12 -1
package/dist/index.js
CHANGED
|
@@ -1132,6 +1132,7 @@ function useGlideTable(options) {
|
|
|
1132
1132
|
|
|
1133
1133
|
// src/components/ui/table/components/DataTable/DataTable.tsx
|
|
1134
1134
|
import { flexRender as flexRender2 } from "@tanstack/react-table";
|
|
1135
|
+
import { useMemo as useMemo3 } from "react";
|
|
1135
1136
|
|
|
1136
1137
|
// src/components/ui/table/components/DataTable/DataTableRow.tsx
|
|
1137
1138
|
import { flexRender } from "@tanstack/react-table";
|
|
@@ -1322,7 +1323,7 @@ function DataTableRow({
|
|
|
1322
1323
|
virtualIndex,
|
|
1323
1324
|
measureElement
|
|
1324
1325
|
}) {
|
|
1325
|
-
const { rowSpan, selection, cellSelection, cellEdit, expand } = useDataTableRowContext();
|
|
1326
|
+
const { classNames, rowSpan, selection, cellSelection, cellEdit, expand } = useDataTableRowContext();
|
|
1326
1327
|
const {
|
|
1327
1328
|
enableRowSpan,
|
|
1328
1329
|
primaryRowSpanKey,
|
|
@@ -1400,12 +1401,17 @@ function DataTableRow({
|
|
|
1400
1401
|
{
|
|
1401
1402
|
ref: measureElement,
|
|
1402
1403
|
"data-index": virtualIndex,
|
|
1404
|
+
"data-selected": isRowSelected ? "" : void 0,
|
|
1405
|
+
"data-hovered": isRowHovered || isGroupHovered ? "" : void 0,
|
|
1406
|
+
"data-expandable": enableExpand && canExpand ? "" : void 0,
|
|
1407
|
+
"data-expanded": isExpanded ? "" : void 0,
|
|
1403
1408
|
className: cn(
|
|
1404
1409
|
"DataTableRowJSX",
|
|
1405
1410
|
!enableRowSpan && ROW_HOVER_CLASS,
|
|
1406
1411
|
enableRowSpan && isRowHovered && !isRowSelected && ROW_HOVERED_BG_CLASS,
|
|
1407
1412
|
isRowSelected && "is-selected",
|
|
1408
1413
|
enableExpand && canExpand && "is-expandable",
|
|
1414
|
+
classNames?.row,
|
|
1409
1415
|
getRowClassName?.(rowData, rowIndex)
|
|
1410
1416
|
),
|
|
1411
1417
|
onMouseEnter: () => onRowHover(rowIndex, rowData),
|
|
@@ -1456,10 +1462,19 @@ function DataTableRow({
|
|
|
1456
1462
|
isVisuallySelectedAt
|
|
1457
1463
|
);
|
|
1458
1464
|
const resolveCellRowIndex = (clientY, element) => getRowIndexInMergedCell(clientY, element, rowIndex, cellRowSpan);
|
|
1465
|
+
const hasSelectionEdges = hasCellSelectionEdges(selectionEdgeStyle);
|
|
1459
1466
|
return /* @__PURE__ */ jsxs2(
|
|
1460
1467
|
"td",
|
|
1461
1468
|
{
|
|
1462
1469
|
rowSpan: rowSpanInfo && rowSpanInfo.rowSpan > 1 ? rowSpanInfo.rowSpan : void 0,
|
|
1470
|
+
"data-merged": isMerged && cellIndex > 0 ? "" : void 0,
|
|
1471
|
+
"data-merged-edge-right": showMergedRightEdge ? "" : void 0,
|
|
1472
|
+
"data-group-selected": enableRowSpan && showCellSelected ? "" : void 0,
|
|
1473
|
+
"data-group-hovered": enableRowSpan && showCellHover && !showCellSelected ? "" : void 0,
|
|
1474
|
+
"data-selection-fill": isCellDragSelected ? "" : void 0,
|
|
1475
|
+
"data-selection-edges": hasSelectionEdges ? "" : void 0,
|
|
1476
|
+
"data-editable": editable ? "" : void 0,
|
|
1477
|
+
"data-editing": isEditing ? "" : void 0,
|
|
1463
1478
|
onMouseDown: (event) => {
|
|
1464
1479
|
if (isEditing) {
|
|
1465
1480
|
event.stopPropagation();
|
|
@@ -1503,8 +1518,9 @@ function DataTableRow({
|
|
|
1503
1518
|
enableRowSpan && showCellSelected && "is-group-selected",
|
|
1504
1519
|
enableRowSpan && showCellHover && !showCellSelected && "is-group-hovered",
|
|
1505
1520
|
isCellDragSelected && CELL_SELECTION_FILL_CLASS,
|
|
1506
|
-
|
|
1507
|
-
editable && "is-editable"
|
|
1521
|
+
hasSelectionEdges && CELL_SELECTION_EDGES_CLASS,
|
|
1522
|
+
editable && "is-editable",
|
|
1523
|
+
classNames?.cell
|
|
1508
1524
|
),
|
|
1509
1525
|
children: [
|
|
1510
1526
|
isEditing ? /* @__PURE__ */ jsx3(
|
|
@@ -1513,7 +1529,11 @@ function DataTableRow({
|
|
|
1513
1529
|
ref: editInputRef,
|
|
1514
1530
|
type: editType === "number" ? "number" : "text",
|
|
1515
1531
|
defaultValue: draftValue,
|
|
1516
|
-
className: cn(
|
|
1532
|
+
className: cn(
|
|
1533
|
+
"cell-edit-input",
|
|
1534
|
+
CELL_ALIGN_CLASS[align],
|
|
1535
|
+
classNames?.cellEditInput
|
|
1536
|
+
),
|
|
1517
1537
|
onChange: (event) => onDraftValueChange(event.target.value),
|
|
1518
1538
|
onMouseDown: (event) => event.stopPropagation(),
|
|
1519
1539
|
onClick: (event) => event.stopPropagation(),
|
|
@@ -1531,23 +1551,69 @@ function DataTableRow({
|
|
|
1531
1551
|
onCommitEdit(event.currentTarget.value);
|
|
1532
1552
|
}
|
|
1533
1553
|
}
|
|
1534
|
-
) : isExpandCell && enableExpand ? /* @__PURE__ */ jsxs2("div", { className: "expand-cell", children: [
|
|
1535
|
-
/* @__PURE__ */ jsxs2(
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1554
|
+
) : isExpandCell && enableExpand ? /* @__PURE__ */ jsxs2("div", { className: cn("expand-cell", classNames?.expandCell), children: [
|
|
1555
|
+
/* @__PURE__ */ jsxs2(
|
|
1556
|
+
"div",
|
|
1557
|
+
{
|
|
1558
|
+
className: cn(
|
|
1559
|
+
"expand-cell-content",
|
|
1560
|
+
classNames?.expandCellContent
|
|
1561
|
+
),
|
|
1562
|
+
children: [
|
|
1563
|
+
rowLevel > 0 && /* @__PURE__ */ jsx3(
|
|
1564
|
+
"span",
|
|
1565
|
+
{
|
|
1566
|
+
className: cn(
|
|
1567
|
+
"expand-cell-indent",
|
|
1568
|
+
classNames?.expandCellIndent
|
|
1569
|
+
),
|
|
1570
|
+
children: "\xB7"
|
|
1571
|
+
}
|
|
1572
|
+
),
|
|
1573
|
+
/* @__PURE__ */ jsx3(
|
|
1574
|
+
"div",
|
|
1575
|
+
{
|
|
1576
|
+
className: cn(
|
|
1577
|
+
"expand-cell-value",
|
|
1578
|
+
classNames?.expandCellValue
|
|
1579
|
+
),
|
|
1580
|
+
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
1581
|
+
}
|
|
1582
|
+
)
|
|
1583
|
+
]
|
|
1584
|
+
}
|
|
1585
|
+
),
|
|
1539
1586
|
canExpand && expandKey && /* @__PURE__ */ jsx3(
|
|
1540
1587
|
"button",
|
|
1541
1588
|
{
|
|
1542
1589
|
type: "button",
|
|
1543
1590
|
"aria-label": isExpanded ? collapseRowLabel : expandRowLabel,
|
|
1544
|
-
className:
|
|
1591
|
+
className: cn(
|
|
1592
|
+
"expand-toggle-button",
|
|
1593
|
+
classNames?.expandToggle
|
|
1594
|
+
),
|
|
1545
1595
|
onClick: (event) => {
|
|
1546
1596
|
event.stopPropagation();
|
|
1547
1597
|
onToggleExpand?.(expandKey);
|
|
1548
1598
|
},
|
|
1549
1599
|
onMouseDown: (event) => event.stopPropagation(),
|
|
1550
|
-
children: isExpanded ? /* @__PURE__ */ jsx3(
|
|
1600
|
+
children: isExpanded ? /* @__PURE__ */ jsx3(
|
|
1601
|
+
ChevronUp,
|
|
1602
|
+
{
|
|
1603
|
+
className: cn(
|
|
1604
|
+
"expand-toggle-icon",
|
|
1605
|
+
classNames?.expandToggleIcon
|
|
1606
|
+
)
|
|
1607
|
+
}
|
|
1608
|
+
) : /* @__PURE__ */ jsx3(
|
|
1609
|
+
ChevronDown,
|
|
1610
|
+
{
|
|
1611
|
+
className: cn(
|
|
1612
|
+
"expand-toggle-icon",
|
|
1613
|
+
classNames?.expandToggleIcon
|
|
1614
|
+
)
|
|
1615
|
+
}
|
|
1616
|
+
)
|
|
1551
1617
|
}
|
|
1552
1618
|
)
|
|
1553
1619
|
] }) : flexRender(cell.column.columnDef.cell, cell.getContext()),
|
|
@@ -1555,7 +1621,7 @@ function DataTableRow({
|
|
|
1555
1621
|
"div",
|
|
1556
1622
|
{
|
|
1557
1623
|
role: "presentation",
|
|
1558
|
-
className: "fill-handle",
|
|
1624
|
+
className: cn("fill-handle", classNames?.fillHandle),
|
|
1559
1625
|
onMouseDown: (event) => {
|
|
1560
1626
|
event.stopPropagation();
|
|
1561
1627
|
event.preventDefault();
|
|
@@ -1581,7 +1647,8 @@ function DataTableToolbar({
|
|
|
1581
1647
|
selectedCount,
|
|
1582
1648
|
selectionLabel,
|
|
1583
1649
|
toolbar,
|
|
1584
|
-
className
|
|
1650
|
+
className,
|
|
1651
|
+
classNames
|
|
1585
1652
|
}) {
|
|
1586
1653
|
const displayFiltered = filteredCount ?? totalCount;
|
|
1587
1654
|
const hasCount = displayFiltered !== void 0 || totalCount !== void 0;
|
|
@@ -1590,9 +1657,9 @@ function DataTableToolbar({
|
|
|
1590
1657
|
const selectionContent = selectionLabel?.(selectedCount) ?? null;
|
|
1591
1658
|
const hasSelectionContent = selectionContent !== null && selectionContent !== false && selectionContent !== void 0 && typeof selectionContent !== "boolean";
|
|
1592
1659
|
if (!hasLeftContent && !hasToolbar && !hasSelectionContent) return null;
|
|
1593
|
-
return /* @__PURE__ */ jsxs3("div", { className: cn("DataTableToolbarJSX", className), children: [
|
|
1594
|
-
/* @__PURE__ */ jsxs3("div", { className: "toolbar-left", children: [
|
|
1595
|
-
hasCount && /* @__PURE__ */ jsx4("span", { className: "toolbar-count", children: displayFiltered !== void 0 && totalCount !== void 0 ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1660
|
+
return /* @__PURE__ */ jsxs3("div", { className: cn("DataTableToolbarJSX", classNames?.toolbar, className), children: [
|
|
1661
|
+
/* @__PURE__ */ jsxs3("div", { className: cn("toolbar-left", classNames?.toolbarLeft), children: [
|
|
1662
|
+
hasCount && /* @__PURE__ */ jsx4("span", { className: cn("toolbar-count", classNames?.toolbarCount), children: displayFiltered !== void 0 && totalCount !== void 0 ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1596
1663
|
/* @__PURE__ */ jsx4("span", { className: "toolbar-count-primary", children: displayFiltered }),
|
|
1597
1664
|
/* @__PURE__ */ jsxs3("span", { className: "toolbar-count-placeholder", children: [
|
|
1598
1665
|
" / ",
|
|
@@ -1601,9 +1668,9 @@ function DataTableToolbar({
|
|
|
1601
1668
|
] }) : /* @__PURE__ */ jsx4("span", { className: "toolbar-count-primary", children: displayFiltered ?? totalCount }) }),
|
|
1602
1669
|
summary
|
|
1603
1670
|
] }),
|
|
1604
|
-
/* @__PURE__ */ jsxs3("div", { className: "toolbar-right", children: [
|
|
1605
|
-
hasSelectionContent && (typeof selectionContent === "string" || typeof selectionContent === "number" ? /* @__PURE__ */ jsx4("span", { className: "toolbar-selection", children: selectionContent }) : selectionContent),
|
|
1606
|
-
hasToolbar && /* @__PURE__ */ jsx4("div", { className: "toolbar-actions", children: toolbar })
|
|
1671
|
+
/* @__PURE__ */ jsxs3("div", { className: cn("toolbar-right", classNames?.toolbarRight), children: [
|
|
1672
|
+
hasSelectionContent && (typeof selectionContent === "string" || typeof selectionContent === "number" ? /* @__PURE__ */ jsx4("span", { className: cn("toolbar-selection", classNames?.toolbarSelection), children: selectionContent }) : selectionContent),
|
|
1673
|
+
hasToolbar && /* @__PURE__ */ jsx4("div", { className: cn("toolbar-actions", classNames?.toolbarActions), children: toolbar })
|
|
1607
1674
|
] })
|
|
1608
1675
|
] });
|
|
1609
1676
|
}
|
|
@@ -1612,15 +1679,36 @@ function DataTableToolbar({
|
|
|
1612
1679
|
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1613
1680
|
function DefaultPending({
|
|
1614
1681
|
loadingText,
|
|
1615
|
-
className
|
|
1682
|
+
className,
|
|
1683
|
+
classNames
|
|
1616
1684
|
}) {
|
|
1617
|
-
return /* @__PURE__ */ jsx5(
|
|
1685
|
+
return /* @__PURE__ */ jsx5(
|
|
1686
|
+
"div",
|
|
1687
|
+
{
|
|
1688
|
+
className: cn(
|
|
1689
|
+
"DataTableJSX",
|
|
1690
|
+
"DataTableJSX--pending",
|
|
1691
|
+
classNames?.root,
|
|
1692
|
+
classNames?.pending,
|
|
1693
|
+
className
|
|
1694
|
+
),
|
|
1695
|
+
children: /* @__PURE__ */ jsx5("span", { className: cn("data-table-loading-text", classNames?.loadingText), children: loadingText })
|
|
1696
|
+
}
|
|
1697
|
+
);
|
|
1618
1698
|
}
|
|
1619
1699
|
function DefaultEmpty({
|
|
1620
1700
|
emptyText,
|
|
1621
|
-
columnCount
|
|
1701
|
+
columnCount,
|
|
1702
|
+
classNames
|
|
1622
1703
|
}) {
|
|
1623
|
-
return /* @__PURE__ */ jsx5("tr", { children: /* @__PURE__ */ jsx5(
|
|
1704
|
+
return /* @__PURE__ */ jsx5("tr", { children: /* @__PURE__ */ jsx5(
|
|
1705
|
+
"td",
|
|
1706
|
+
{
|
|
1707
|
+
colSpan: columnCount,
|
|
1708
|
+
className: cn("data-table-empty-cell", classNames?.emptyCell),
|
|
1709
|
+
children: emptyText
|
|
1710
|
+
}
|
|
1711
|
+
) });
|
|
1624
1712
|
}
|
|
1625
1713
|
function DataTable({
|
|
1626
1714
|
isPending = false,
|
|
@@ -1629,6 +1717,7 @@ function DataTable({
|
|
|
1629
1717
|
filteredCount,
|
|
1630
1718
|
totalCount,
|
|
1631
1719
|
className,
|
|
1720
|
+
classNames,
|
|
1632
1721
|
slots,
|
|
1633
1722
|
...glideOptions
|
|
1634
1723
|
}) {
|
|
@@ -1656,8 +1745,19 @@ function DataTable({
|
|
|
1656
1745
|
const RowSlot = slots?.Row ?? DataTableRow;
|
|
1657
1746
|
const PendingSlot = slots?.Pending ?? DefaultPending;
|
|
1658
1747
|
const EmptySlot = slots?.Empty ?? DefaultEmpty;
|
|
1748
|
+
const contextValue = useMemo3(
|
|
1749
|
+
() => ({ ...rowContextValue, classNames }),
|
|
1750
|
+
[rowContextValue, classNames]
|
|
1751
|
+
);
|
|
1659
1752
|
if (isPending) {
|
|
1660
|
-
return /* @__PURE__ */ jsx5(
|
|
1753
|
+
return /* @__PURE__ */ jsx5(
|
|
1754
|
+
PendingSlot,
|
|
1755
|
+
{
|
|
1756
|
+
loadingText,
|
|
1757
|
+
className,
|
|
1758
|
+
classNames
|
|
1759
|
+
}
|
|
1760
|
+
);
|
|
1661
1761
|
}
|
|
1662
1762
|
return /* @__PURE__ */ jsxs4(
|
|
1663
1763
|
"div",
|
|
@@ -1665,6 +1765,7 @@ function DataTable({
|
|
|
1665
1765
|
className: cn(
|
|
1666
1766
|
"DataTableJSX",
|
|
1667
1767
|
!enableCellSelection && "DataTableJSX--no-cell-selection",
|
|
1768
|
+
classNames?.root,
|
|
1668
1769
|
className
|
|
1669
1770
|
),
|
|
1670
1771
|
children: [
|
|
@@ -1676,71 +1777,120 @@ function DataTable({
|
|
|
1676
1777
|
summary,
|
|
1677
1778
|
selectedCount,
|
|
1678
1779
|
selectionLabel,
|
|
1679
|
-
toolbar
|
|
1780
|
+
toolbar,
|
|
1781
|
+
classNames
|
|
1680
1782
|
}
|
|
1681
1783
|
),
|
|
1682
|
-
/* @__PURE__ */ jsx5("div", { ref: scrollRef, className: "data-table-scroll", children: /* @__PURE__ */ jsxs4(
|
|
1784
|
+
/* @__PURE__ */ jsx5("div", { ref: scrollRef, className: cn("data-table-scroll", classNames?.scroll), children: /* @__PURE__ */ jsxs4(
|
|
1683
1785
|
"table",
|
|
1684
1786
|
{
|
|
1685
|
-
className: "data-table",
|
|
1787
|
+
className: cn("data-table", classNames?.table),
|
|
1686
1788
|
onDragStart: enableCellSelection ? (event) => event.preventDefault() : void 0,
|
|
1687
1789
|
children: [
|
|
1688
|
-
/* @__PURE__ */ jsx5("thead", { className: "data-table-head", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx5(
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
"
|
|
1697
|
-
|
|
1698
|
-
|
|
1790
|
+
/* @__PURE__ */ jsx5("thead", { className: cn("data-table-head", classNames?.head), children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx5(
|
|
1791
|
+
"tr",
|
|
1792
|
+
{
|
|
1793
|
+
className: cn("data-table-head-row", classNames?.headRow),
|
|
1794
|
+
children: headerGroup.headers.map((header) => {
|
|
1795
|
+
const align = header.column.columnDef.meta?.align ?? "center";
|
|
1796
|
+
const headerClassName = header.column.columnDef.meta?.headerClassName;
|
|
1797
|
+
return /* @__PURE__ */ jsx5(
|
|
1798
|
+
"th",
|
|
1799
|
+
{
|
|
1800
|
+
style: { width: header.getSize() !== 150 ? header.getSize() : void 0 },
|
|
1801
|
+
className: cn(
|
|
1802
|
+
"data-table-head-cell",
|
|
1803
|
+
CELL_ALIGN_CLASS[align],
|
|
1804
|
+
classNames?.headCell,
|
|
1805
|
+
headerClassName
|
|
1806
|
+
),
|
|
1807
|
+
children: header.isPlaceholder ? null : flexRender2(header.column.columnDef.header, header.getContext())
|
|
1808
|
+
},
|
|
1809
|
+
header.id
|
|
1810
|
+
);
|
|
1811
|
+
})
|
|
1812
|
+
},
|
|
1813
|
+
headerGroup.id
|
|
1814
|
+
)) }),
|
|
1815
|
+
/* @__PURE__ */ jsx5(DataTableContextProvider, { value: contextValue, children: /* @__PURE__ */ jsx5(
|
|
1816
|
+
"tbody",
|
|
1817
|
+
{
|
|
1818
|
+
onMouseLeave: clearHover,
|
|
1819
|
+
className: cn("data-table-body", classNames?.body),
|
|
1820
|
+
children: rows.length === 0 ? /* @__PURE__ */ jsx5(
|
|
1821
|
+
EmptySlot,
|
|
1822
|
+
{
|
|
1823
|
+
emptyText,
|
|
1824
|
+
columnCount,
|
|
1825
|
+
classNames
|
|
1826
|
+
}
|
|
1827
|
+
) : shouldVirtualize ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1828
|
+
paddingTop > 0 && /* @__PURE__ */ jsx5(
|
|
1829
|
+
"tr",
|
|
1830
|
+
{
|
|
1831
|
+
"aria-hidden": true,
|
|
1832
|
+
className: cn(
|
|
1833
|
+
"data-table-virtual-spacer",
|
|
1834
|
+
classNames?.virtualSpacer
|
|
1835
|
+
),
|
|
1836
|
+
children: /* @__PURE__ */ jsx5(
|
|
1837
|
+
"td",
|
|
1838
|
+
{
|
|
1839
|
+
colSpan: columnCount,
|
|
1840
|
+
style: { height: paddingTop },
|
|
1841
|
+
className: cn(
|
|
1842
|
+
"data-table-virtual-spacer-cell",
|
|
1843
|
+
classNames?.virtualSpacerCell
|
|
1844
|
+
)
|
|
1845
|
+
}
|
|
1846
|
+
)
|
|
1847
|
+
}
|
|
1699
1848
|
),
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1849
|
+
virtualRows.map((virtualRow) => {
|
|
1850
|
+
const row = rows[virtualRow.index];
|
|
1851
|
+
if (!row) return null;
|
|
1852
|
+
return /* @__PURE__ */ jsx5(
|
|
1853
|
+
RowSlot,
|
|
1854
|
+
{
|
|
1855
|
+
row,
|
|
1856
|
+
virtualIndex: virtualRow.index,
|
|
1857
|
+
measureElement: rowVirtualizer.measureElement,
|
|
1858
|
+
onToggleSelect: () => handleToggleSelect(row)
|
|
1859
|
+
},
|
|
1860
|
+
row.id
|
|
1861
|
+
);
|
|
1862
|
+
}),
|
|
1863
|
+
paddingBottom > 0 && /* @__PURE__ */ jsx5(
|
|
1864
|
+
"tr",
|
|
1865
|
+
{
|
|
1866
|
+
"aria-hidden": true,
|
|
1867
|
+
className: cn(
|
|
1868
|
+
"data-table-virtual-spacer",
|
|
1869
|
+
classNames?.virtualSpacer
|
|
1870
|
+
),
|
|
1871
|
+
children: /* @__PURE__ */ jsx5(
|
|
1872
|
+
"td",
|
|
1873
|
+
{
|
|
1874
|
+
colSpan: columnCount,
|
|
1875
|
+
style: { height: paddingBottom },
|
|
1876
|
+
className: cn(
|
|
1877
|
+
"data-table-virtual-spacer-cell",
|
|
1878
|
+
classNames?.virtualSpacerCell
|
|
1879
|
+
)
|
|
1880
|
+
}
|
|
1881
|
+
)
|
|
1882
|
+
}
|
|
1883
|
+
)
|
|
1884
|
+
] }) : rows.map((row) => /* @__PURE__ */ jsx5(
|
|
1718
1885
|
RowSlot,
|
|
1719
1886
|
{
|
|
1720
1887
|
row,
|
|
1721
|
-
virtualIndex: virtualRow.index,
|
|
1722
|
-
measureElement: rowVirtualizer.measureElement,
|
|
1723
1888
|
onToggleSelect: () => handleToggleSelect(row)
|
|
1724
1889
|
},
|
|
1725
1890
|
row.id
|
|
1726
|
-
)
|
|
1727
|
-
}
|
|
1728
|
-
|
|
1729
|
-
"td",
|
|
1730
|
-
{
|
|
1731
|
-
colSpan: columnCount,
|
|
1732
|
-
style: { height: paddingBottom },
|
|
1733
|
-
className: "data-table-virtual-spacer-cell"
|
|
1734
|
-
}
|
|
1735
|
-
) })
|
|
1736
|
-
] }) : rows.map((row) => /* @__PURE__ */ jsx5(
|
|
1737
|
-
RowSlot,
|
|
1738
|
-
{
|
|
1739
|
-
row,
|
|
1740
|
-
onToggleSelect: () => handleToggleSelect(row)
|
|
1741
|
-
},
|
|
1742
|
-
row.id
|
|
1743
|
-
)) }) })
|
|
1891
|
+
))
|
|
1892
|
+
}
|
|
1893
|
+
) })
|
|
1744
1894
|
]
|
|
1745
1895
|
}
|
|
1746
1896
|
) })
|
|
@@ -1750,7 +1900,7 @@ function DataTable({
|
|
|
1750
1900
|
}
|
|
1751
1901
|
|
|
1752
1902
|
// src/components/ui/table/components/Table/Table.tsx
|
|
1753
|
-
import { useCallback as useCallback4, useMemo as
|
|
1903
|
+
import { useCallback as useCallback4, useMemo as useMemo4, useState as useState4 } from "react";
|
|
1754
1904
|
|
|
1755
1905
|
// src/components/ui/table/components/Table/buildColumnDef.tsx
|
|
1756
1906
|
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
@@ -1979,7 +2129,7 @@ function TableRoot({
|
|
|
1979
2129
|
filteredCount,
|
|
1980
2130
|
...dataTableProps
|
|
1981
2131
|
}) {
|
|
1982
|
-
const { header, pagination: paginationElement } =
|
|
2132
|
+
const { header, pagination: paginationElement } = useMemo4(
|
|
1983
2133
|
() => parseTableChildren(children),
|
|
1984
2134
|
[children]
|
|
1985
2135
|
);
|
|
@@ -1995,7 +2145,7 @@ function TableRoot({
|
|
|
1995
2145
|
return null;
|
|
1996
2146
|
});
|
|
1997
2147
|
}, []);
|
|
1998
|
-
const columns =
|
|
2148
|
+
const columns = useMemo4(() => {
|
|
1999
2149
|
return extractColumnElements(header).map(
|
|
2000
2150
|
(columnElement) => buildColumnDef(columnElement.props, sort, handleSort)
|
|
2001
2151
|
);
|
|
@@ -2004,7 +2154,7 @@ function TableRoot({
|
|
|
2004
2154
|
const pageSize = paginationProps?.pageSize ?? 10;
|
|
2005
2155
|
const page = paginationProps?.page ?? 1;
|
|
2006
2156
|
const resolvedTotalCount = paginationProps?.totalCount ?? totalCount ?? data.length;
|
|
2007
|
-
const tableData =
|
|
2157
|
+
const tableData = useMemo4(() => {
|
|
2008
2158
|
const sortedData = sortTableData(data, sort);
|
|
2009
2159
|
if (!paginationProps) return sortedData;
|
|
2010
2160
|
return paginateTableData(sortedData, page, pageSize);
|