react-glide-table 1.1.2 → 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 +19 -5
- package/dist/compound.cjs +240 -90
- package/dist/compound.d.cts +5 -5
- package/dist/compound.d.ts +5 -5
- package/dist/compound.js +230 -80
- package/dist/core.d.cts +4 -3
- package/dist/core.d.ts +4 -3
- package/dist/index.cjs +240 -90
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +230 -80
- package/dist/{types-ByOoRY8x.d.cts → types-BfthylVR.d.cts} +44 -1
- package/dist/{types-ByOoRY8x.d.ts → types-BfthylVR.d.ts} +44 -1
- package/package.json +1 -1
package/dist/compound.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/components/ui/table/components/DataTable/DataTable.tsx
|
|
2
2
|
import { flexRender as flexRender2 } from "@tanstack/react-table";
|
|
3
|
+
import { useMemo as useMemo3 } from "react";
|
|
3
4
|
|
|
4
5
|
// src/components/ui/table/components/DataTable/DataTableRow.tsx
|
|
5
6
|
import { flexRender } from "@tanstack/react-table";
|
|
@@ -708,7 +709,7 @@ function DataTableRow({
|
|
|
708
709
|
virtualIndex,
|
|
709
710
|
measureElement
|
|
710
711
|
}) {
|
|
711
|
-
const { rowSpan, selection, cellSelection, cellEdit, expand } = useDataTableRowContext();
|
|
712
|
+
const { classNames, rowSpan, selection, cellSelection, cellEdit, expand } = useDataTableRowContext();
|
|
712
713
|
const {
|
|
713
714
|
enableRowSpan,
|
|
714
715
|
primaryRowSpanKey,
|
|
@@ -786,12 +787,17 @@ function DataTableRow({
|
|
|
786
787
|
{
|
|
787
788
|
ref: measureElement,
|
|
788
789
|
"data-index": virtualIndex,
|
|
790
|
+
"data-selected": isRowSelected ? "" : void 0,
|
|
791
|
+
"data-hovered": isRowHovered || isGroupHovered ? "" : void 0,
|
|
792
|
+
"data-expandable": enableExpand && canExpand ? "" : void 0,
|
|
793
|
+
"data-expanded": isExpanded ? "" : void 0,
|
|
789
794
|
className: cn(
|
|
790
795
|
"DataTableRowJSX",
|
|
791
796
|
!enableRowSpan && ROW_HOVER_CLASS,
|
|
792
797
|
enableRowSpan && isRowHovered && !isRowSelected && ROW_HOVERED_BG_CLASS,
|
|
793
798
|
isRowSelected && "is-selected",
|
|
794
799
|
enableExpand && canExpand && "is-expandable",
|
|
800
|
+
classNames?.row,
|
|
795
801
|
getRowClassName?.(rowData, rowIndex)
|
|
796
802
|
),
|
|
797
803
|
onMouseEnter: () => onRowHover(rowIndex, rowData),
|
|
@@ -842,10 +848,19 @@ function DataTableRow({
|
|
|
842
848
|
isVisuallySelectedAt
|
|
843
849
|
);
|
|
844
850
|
const resolveCellRowIndex = (clientY, element) => getRowIndexInMergedCell(clientY, element, rowIndex, cellRowSpan);
|
|
851
|
+
const hasSelectionEdges = hasCellSelectionEdges(selectionEdgeStyle);
|
|
845
852
|
return /* @__PURE__ */ jsxs2(
|
|
846
853
|
"td",
|
|
847
854
|
{
|
|
848
855
|
rowSpan: rowSpanInfo && rowSpanInfo.rowSpan > 1 ? rowSpanInfo.rowSpan : void 0,
|
|
856
|
+
"data-merged": isMerged && cellIndex > 0 ? "" : void 0,
|
|
857
|
+
"data-merged-edge-right": showMergedRightEdge ? "" : void 0,
|
|
858
|
+
"data-group-selected": enableRowSpan && showCellSelected ? "" : void 0,
|
|
859
|
+
"data-group-hovered": enableRowSpan && showCellHover && !showCellSelected ? "" : void 0,
|
|
860
|
+
"data-selection-fill": isCellDragSelected ? "" : void 0,
|
|
861
|
+
"data-selection-edges": hasSelectionEdges ? "" : void 0,
|
|
862
|
+
"data-editable": editable ? "" : void 0,
|
|
863
|
+
"data-editing": isEditing ? "" : void 0,
|
|
849
864
|
onMouseDown: (event) => {
|
|
850
865
|
if (isEditing) {
|
|
851
866
|
event.stopPropagation();
|
|
@@ -889,8 +904,9 @@ function DataTableRow({
|
|
|
889
904
|
enableRowSpan && showCellSelected && "is-group-selected",
|
|
890
905
|
enableRowSpan && showCellHover && !showCellSelected && "is-group-hovered",
|
|
891
906
|
isCellDragSelected && CELL_SELECTION_FILL_CLASS,
|
|
892
|
-
|
|
893
|
-
editable && "is-editable"
|
|
907
|
+
hasSelectionEdges && CELL_SELECTION_EDGES_CLASS,
|
|
908
|
+
editable && "is-editable",
|
|
909
|
+
classNames?.cell
|
|
894
910
|
),
|
|
895
911
|
children: [
|
|
896
912
|
isEditing ? /* @__PURE__ */ jsx3(
|
|
@@ -899,7 +915,11 @@ function DataTableRow({
|
|
|
899
915
|
ref: editInputRef,
|
|
900
916
|
type: editType === "number" ? "number" : "text",
|
|
901
917
|
defaultValue: draftValue,
|
|
902
|
-
className: cn(
|
|
918
|
+
className: cn(
|
|
919
|
+
"cell-edit-input",
|
|
920
|
+
CELL_ALIGN_CLASS[align],
|
|
921
|
+
classNames?.cellEditInput
|
|
922
|
+
),
|
|
903
923
|
onChange: (event) => onDraftValueChange(event.target.value),
|
|
904
924
|
onMouseDown: (event) => event.stopPropagation(),
|
|
905
925
|
onClick: (event) => event.stopPropagation(),
|
|
@@ -917,23 +937,69 @@ function DataTableRow({
|
|
|
917
937
|
onCommitEdit(event.currentTarget.value);
|
|
918
938
|
}
|
|
919
939
|
}
|
|
920
|
-
) : isExpandCell && enableExpand ? /* @__PURE__ */ jsxs2("div", { className: "expand-cell", children: [
|
|
921
|
-
/* @__PURE__ */ jsxs2(
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
940
|
+
) : isExpandCell && enableExpand ? /* @__PURE__ */ jsxs2("div", { className: cn("expand-cell", classNames?.expandCell), children: [
|
|
941
|
+
/* @__PURE__ */ jsxs2(
|
|
942
|
+
"div",
|
|
943
|
+
{
|
|
944
|
+
className: cn(
|
|
945
|
+
"expand-cell-content",
|
|
946
|
+
classNames?.expandCellContent
|
|
947
|
+
),
|
|
948
|
+
children: [
|
|
949
|
+
rowLevel > 0 && /* @__PURE__ */ jsx3(
|
|
950
|
+
"span",
|
|
951
|
+
{
|
|
952
|
+
className: cn(
|
|
953
|
+
"expand-cell-indent",
|
|
954
|
+
classNames?.expandCellIndent
|
|
955
|
+
),
|
|
956
|
+
children: "\xB7"
|
|
957
|
+
}
|
|
958
|
+
),
|
|
959
|
+
/* @__PURE__ */ jsx3(
|
|
960
|
+
"div",
|
|
961
|
+
{
|
|
962
|
+
className: cn(
|
|
963
|
+
"expand-cell-value",
|
|
964
|
+
classNames?.expandCellValue
|
|
965
|
+
),
|
|
966
|
+
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
967
|
+
}
|
|
968
|
+
)
|
|
969
|
+
]
|
|
970
|
+
}
|
|
971
|
+
),
|
|
925
972
|
canExpand && expandKey && /* @__PURE__ */ jsx3(
|
|
926
973
|
"button",
|
|
927
974
|
{
|
|
928
975
|
type: "button",
|
|
929
976
|
"aria-label": isExpanded ? collapseRowLabel : expandRowLabel,
|
|
930
|
-
className:
|
|
977
|
+
className: cn(
|
|
978
|
+
"expand-toggle-button",
|
|
979
|
+
classNames?.expandToggle
|
|
980
|
+
),
|
|
931
981
|
onClick: (event) => {
|
|
932
982
|
event.stopPropagation();
|
|
933
983
|
onToggleExpand?.(expandKey);
|
|
934
984
|
},
|
|
935
985
|
onMouseDown: (event) => event.stopPropagation(),
|
|
936
|
-
children: isExpanded ? /* @__PURE__ */ jsx3(
|
|
986
|
+
children: isExpanded ? /* @__PURE__ */ jsx3(
|
|
987
|
+
ChevronUp,
|
|
988
|
+
{
|
|
989
|
+
className: cn(
|
|
990
|
+
"expand-toggle-icon",
|
|
991
|
+
classNames?.expandToggleIcon
|
|
992
|
+
)
|
|
993
|
+
}
|
|
994
|
+
) : /* @__PURE__ */ jsx3(
|
|
995
|
+
ChevronDown,
|
|
996
|
+
{
|
|
997
|
+
className: cn(
|
|
998
|
+
"expand-toggle-icon",
|
|
999
|
+
classNames?.expandToggleIcon
|
|
1000
|
+
)
|
|
1001
|
+
}
|
|
1002
|
+
)
|
|
937
1003
|
}
|
|
938
1004
|
)
|
|
939
1005
|
] }) : flexRender(cell.column.columnDef.cell, cell.getContext()),
|
|
@@ -941,7 +1007,7 @@ function DataTableRow({
|
|
|
941
1007
|
"div",
|
|
942
1008
|
{
|
|
943
1009
|
role: "presentation",
|
|
944
|
-
className: "fill-handle",
|
|
1010
|
+
className: cn("fill-handle", classNames?.fillHandle),
|
|
945
1011
|
onMouseDown: (event) => {
|
|
946
1012
|
event.stopPropagation();
|
|
947
1013
|
event.preventDefault();
|
|
@@ -967,7 +1033,8 @@ function DataTableToolbar({
|
|
|
967
1033
|
selectedCount,
|
|
968
1034
|
selectionLabel,
|
|
969
1035
|
toolbar,
|
|
970
|
-
className
|
|
1036
|
+
className,
|
|
1037
|
+
classNames
|
|
971
1038
|
}) {
|
|
972
1039
|
const displayFiltered = filteredCount ?? totalCount;
|
|
973
1040
|
const hasCount = displayFiltered !== void 0 || totalCount !== void 0;
|
|
@@ -976,9 +1043,9 @@ function DataTableToolbar({
|
|
|
976
1043
|
const selectionContent = selectionLabel?.(selectedCount) ?? null;
|
|
977
1044
|
const hasSelectionContent = selectionContent !== null && selectionContent !== false && selectionContent !== void 0 && typeof selectionContent !== "boolean";
|
|
978
1045
|
if (!hasLeftContent && !hasToolbar && !hasSelectionContent) return null;
|
|
979
|
-
return /* @__PURE__ */ jsxs3("div", { className: cn("DataTableToolbarJSX", className), children: [
|
|
980
|
-
/* @__PURE__ */ jsxs3("div", { className: "toolbar-left", children: [
|
|
981
|
-
hasCount && /* @__PURE__ */ jsx4("span", { className: "toolbar-count", children: displayFiltered !== void 0 && totalCount !== void 0 ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1046
|
+
return /* @__PURE__ */ jsxs3("div", { className: cn("DataTableToolbarJSX", classNames?.toolbar, className), children: [
|
|
1047
|
+
/* @__PURE__ */ jsxs3("div", { className: cn("toolbar-left", classNames?.toolbarLeft), children: [
|
|
1048
|
+
hasCount && /* @__PURE__ */ jsx4("span", { className: cn("toolbar-count", classNames?.toolbarCount), children: displayFiltered !== void 0 && totalCount !== void 0 ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
982
1049
|
/* @__PURE__ */ jsx4("span", { className: "toolbar-count-primary", children: displayFiltered }),
|
|
983
1050
|
/* @__PURE__ */ jsxs3("span", { className: "toolbar-count-placeholder", children: [
|
|
984
1051
|
" / ",
|
|
@@ -987,9 +1054,9 @@ function DataTableToolbar({
|
|
|
987
1054
|
] }) : /* @__PURE__ */ jsx4("span", { className: "toolbar-count-primary", children: displayFiltered ?? totalCount }) }),
|
|
988
1055
|
summary
|
|
989
1056
|
] }),
|
|
990
|
-
/* @__PURE__ */ jsxs3("div", { className: "toolbar-right", children: [
|
|
991
|
-
hasSelectionContent && (typeof selectionContent === "string" || typeof selectionContent === "number" ? /* @__PURE__ */ jsx4("span", { className: "toolbar-selection", children: selectionContent }) : selectionContent),
|
|
992
|
-
hasToolbar && /* @__PURE__ */ jsx4("div", { className: "toolbar-actions", children: toolbar })
|
|
1057
|
+
/* @__PURE__ */ jsxs3("div", { className: cn("toolbar-right", classNames?.toolbarRight), children: [
|
|
1058
|
+
hasSelectionContent && (typeof selectionContent === "string" || typeof selectionContent === "number" ? /* @__PURE__ */ jsx4("span", { className: cn("toolbar-selection", classNames?.toolbarSelection), children: selectionContent }) : selectionContent),
|
|
1059
|
+
hasToolbar && /* @__PURE__ */ jsx4("div", { className: cn("toolbar-actions", classNames?.toolbarActions), children: toolbar })
|
|
993
1060
|
] })
|
|
994
1061
|
] });
|
|
995
1062
|
}
|
|
@@ -1612,15 +1679,36 @@ function useGlideTable(options) {
|
|
|
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);
|
package/dist/core.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CellEditType, R as RowSelectionMode,
|
|
2
|
-
export { D as DEFAULT_DATA_TABLE_LABELS, r as resolveDataTableLabels } from './types-
|
|
1
|
+
import { C as CellEditType, a as DataTableClassNames, R as RowSelectionMode, c as DataTableProps, b as DataTableLabels } from './types-BfthylVR.cjs';
|
|
2
|
+
export { D as DEFAULT_DATA_TABLE_LABELS, r as resolveDataTableLabels } from './types-BfthylVR.cjs';
|
|
3
3
|
import { Row, ColumnDef, Table, Updater, RowSelectionState } from '@tanstack/react-table';
|
|
4
4
|
export { ColumnDef, RowSelectionState } from '@tanstack/react-table';
|
|
5
5
|
import { Virtualizer, VirtualItem } from '@tanstack/react-virtual';
|
|
@@ -108,6 +108,7 @@ declare function collectRowSpanColumns<T extends Record<string, unknown>>(column
|
|
|
108
108
|
|
|
109
109
|
type RowData = Record<string, unknown>;
|
|
110
110
|
type DataTableRowContextValue = {
|
|
111
|
+
classNames?: DataTableClassNames;
|
|
111
112
|
rowSpan: {
|
|
112
113
|
enableRowSpan: boolean;
|
|
113
114
|
primaryRowSpanKey?: string;
|
|
@@ -150,7 +151,7 @@ type DataTableRowContextValue = {
|
|
|
150
151
|
};
|
|
151
152
|
};
|
|
152
153
|
|
|
153
|
-
type UseGlideTableOptions<T extends Record<string, unknown>> = Omit<DataTableProps<T>, "className" | "slots" | "summary" | "toolbar" | "isPending" | "totalCount" | "filteredCount">;
|
|
154
|
+
type UseGlideTableOptions<T extends Record<string, unknown>> = Omit<DataTableProps<T>, "className" | "classNames" | "slots" | "summary" | "toolbar" | "isPending" | "totalCount" | "filteredCount">;
|
|
154
155
|
type UseGlideTableResult<T extends Record<string, unknown>> = {
|
|
155
156
|
table: Table<T>;
|
|
156
157
|
tableData: T[];
|
package/dist/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CellEditType, R as RowSelectionMode,
|
|
2
|
-
export { D as DEFAULT_DATA_TABLE_LABELS, r as resolveDataTableLabels } from './types-
|
|
1
|
+
import { C as CellEditType, a as DataTableClassNames, R as RowSelectionMode, c as DataTableProps, b as DataTableLabels } from './types-BfthylVR.js';
|
|
2
|
+
export { D as DEFAULT_DATA_TABLE_LABELS, r as resolveDataTableLabels } from './types-BfthylVR.js';
|
|
3
3
|
import { Row, ColumnDef, Table, Updater, RowSelectionState } from '@tanstack/react-table';
|
|
4
4
|
export { ColumnDef, RowSelectionState } from '@tanstack/react-table';
|
|
5
5
|
import { Virtualizer, VirtualItem } from '@tanstack/react-virtual';
|
|
@@ -108,6 +108,7 @@ declare function collectRowSpanColumns<T extends Record<string, unknown>>(column
|
|
|
108
108
|
|
|
109
109
|
type RowData = Record<string, unknown>;
|
|
110
110
|
type DataTableRowContextValue = {
|
|
111
|
+
classNames?: DataTableClassNames;
|
|
111
112
|
rowSpan: {
|
|
112
113
|
enableRowSpan: boolean;
|
|
113
114
|
primaryRowSpanKey?: string;
|
|
@@ -150,7 +151,7 @@ type DataTableRowContextValue = {
|
|
|
150
151
|
};
|
|
151
152
|
};
|
|
152
153
|
|
|
153
|
-
type UseGlideTableOptions<T extends Record<string, unknown>> = Omit<DataTableProps<T>, "className" | "slots" | "summary" | "toolbar" | "isPending" | "totalCount" | "filteredCount">;
|
|
154
|
+
type UseGlideTableOptions<T extends Record<string, unknown>> = Omit<DataTableProps<T>, "className" | "classNames" | "slots" | "summary" | "toolbar" | "isPending" | "totalCount" | "filteredCount">;
|
|
154
155
|
type UseGlideTableResult<T extends Record<string, unknown>> = {
|
|
155
156
|
table: Table<T>;
|
|
156
157
|
tableData: T[];
|