react-glide-table 1.7.0 → 2.0.2
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 +87 -6
- package/dist/compound.cjs +474 -98
- package/dist/compound.d.cts +2 -2
- package/dist/compound.d.ts +2 -2
- package/dist/compound.js +459 -83
- package/dist/core.cjs +416 -12
- package/dist/core.d.cts +58 -4
- package/dist/core.d.ts +58 -4
- package/dist/core.js +407 -12
- package/dist/index.cjs +574 -166
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +545 -146
- package/dist/{types-Cs9MiZs1.d.cts → types-bgEceyRV.d.cts} +82 -4
- package/dist/{types-Cs9MiZs1.d.ts → types-bgEceyRV.d.ts} +82 -4
- package/package.json +1 -1
package/dist/compound.js
CHANGED
|
@@ -71,19 +71,15 @@ function getCellEditDraftValue(value) {
|
|
|
71
71
|
if (value === null || value === void 0) return "";
|
|
72
72
|
return String(value);
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const newData = data.map((row) => ({ ...row }));
|
|
84
|
-
if (!newData[rowIndex]) return null;
|
|
85
|
-
newData[rowIndex][accessorKey] = parsed.value;
|
|
86
|
-
return newData;
|
|
74
|
+
|
|
75
|
+
// src/components/ui/table/features/cell-render/withCellUpdate.ts
|
|
76
|
+
function withCellUpdate(context, commitValue) {
|
|
77
|
+
return {
|
|
78
|
+
...context,
|
|
79
|
+
update: (next) => {
|
|
80
|
+
commitValue(context.row.id, context.column.id, next);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
87
83
|
}
|
|
88
84
|
|
|
89
85
|
// src/components/ui/table/features/cell-selection/cellSelection.ts
|
|
@@ -469,10 +465,40 @@ function getColumnFreezeStyle(offset, options) {
|
|
|
469
465
|
return {
|
|
470
466
|
position: "sticky",
|
|
471
467
|
...offset.side === "left" ? { left: offset.offset } : { right: offset.offset },
|
|
472
|
-
zIndex: zBase + offset.stack
|
|
473
|
-
...options?.isHeader ? { top: options.headerTop ?? 0 } : {}
|
|
468
|
+
zIndex: zBase + offset.stack
|
|
474
469
|
};
|
|
475
470
|
}
|
|
471
|
+
function resolveHeaderFreezeOffset(column, freezeOffsets) {
|
|
472
|
+
const direct = freezeOffsets.get(column.id);
|
|
473
|
+
if (direct) return direct;
|
|
474
|
+
const leaves = typeof column.getLeafColumns === "function" ? column.getLeafColumns() : column.columns && column.columns.length > 0 ? flattenHeaderLeaves(column) : [];
|
|
475
|
+
if (leaves.length === 0) return void 0;
|
|
476
|
+
const leafOffsets = [];
|
|
477
|
+
for (const leaf of leaves) {
|
|
478
|
+
const offset2 = freezeOffsets.get(leaf.id);
|
|
479
|
+
if (!offset2) return void 0;
|
|
480
|
+
leafOffsets.push(offset2);
|
|
481
|
+
}
|
|
482
|
+
const side = leafOffsets[0]?.side;
|
|
483
|
+
if (!side || leafOffsets.some((offset2) => offset2.side !== side)) {
|
|
484
|
+
return void 0;
|
|
485
|
+
}
|
|
486
|
+
const offset = Math.min(...leafOffsets.map((item) => item.offset));
|
|
487
|
+
const leftmost = leafOffsets[0];
|
|
488
|
+
const rightmost = leafOffsets[leafOffsets.length - 1];
|
|
489
|
+
return {
|
|
490
|
+
side,
|
|
491
|
+
offset,
|
|
492
|
+
edgeLeft: leftmost.edgeLeft,
|
|
493
|
+
edgeRight: rightmost.edgeRight,
|
|
494
|
+
isEdge: leftmost.edgeLeft || rightmost.edgeRight,
|
|
495
|
+
stack: Math.max(...leafOffsets.map((item) => item.stack))
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
function flattenHeaderLeaves(column) {
|
|
499
|
+
if (!column.columns || column.columns.length === 0) return [column];
|
|
500
|
+
return column.columns.flatMap((child) => flattenHeaderLeaves(child));
|
|
501
|
+
}
|
|
476
502
|
|
|
477
503
|
// src/components/ui/table/features/column-resize/columnResize.ts
|
|
478
504
|
function getColumnSizeStyle(size, options) {
|
|
@@ -1086,6 +1112,7 @@ function DataTableRow({
|
|
|
1086
1112
|
selection,
|
|
1087
1113
|
cellSelection,
|
|
1088
1114
|
cellEdit,
|
|
1115
|
+
cellRender,
|
|
1089
1116
|
expand,
|
|
1090
1117
|
columnResize,
|
|
1091
1118
|
columnFreeze,
|
|
@@ -1123,6 +1150,10 @@ function DataTableRow({
|
|
|
1123
1150
|
onCommitEdit,
|
|
1124
1151
|
onCancelEdit
|
|
1125
1152
|
} = cellEdit;
|
|
1153
|
+
const renderCell = (tableCell) => flexRender(
|
|
1154
|
+
tableCell.column.columnDef.cell,
|
|
1155
|
+
withCellUpdate(tableCell.getContext(), cellRender.commitValue)
|
|
1156
|
+
);
|
|
1126
1157
|
const {
|
|
1127
1158
|
enableExpand,
|
|
1128
1159
|
toggleField,
|
|
@@ -1435,7 +1466,7 @@ function DataTableRow({
|
|
|
1435
1466
|
"expand-cell-value",
|
|
1436
1467
|
classNames?.expandCellValue
|
|
1437
1468
|
),
|
|
1438
|
-
children:
|
|
1469
|
+
children: renderCell(cell)
|
|
1439
1470
|
}
|
|
1440
1471
|
)
|
|
1441
1472
|
]
|
|
@@ -1474,7 +1505,7 @@ function DataTableRow({
|
|
|
1474
1505
|
)
|
|
1475
1506
|
}
|
|
1476
1507
|
)
|
|
1477
|
-
] }) :
|
|
1508
|
+
] }) : renderCell(cell),
|
|
1478
1509
|
isBottomRightCell && /* @__PURE__ */ jsx3(
|
|
1479
1510
|
"div",
|
|
1480
1511
|
{
|
|
@@ -1744,6 +1775,39 @@ import {
|
|
|
1744
1775
|
|
|
1745
1776
|
// src/components/ui/table/features/cell-edit/useCellEdit.ts
|
|
1746
1777
|
import { useCallback, useEffect as useEffect3, useRef as useRef3, useState } from "react";
|
|
1778
|
+
|
|
1779
|
+
// src/components/ui/table/features/cell-render/commitCellValue.ts
|
|
1780
|
+
function commitCellValue({
|
|
1781
|
+
data,
|
|
1782
|
+
rows,
|
|
1783
|
+
rowId,
|
|
1784
|
+
columnId,
|
|
1785
|
+
value,
|
|
1786
|
+
onCellChange,
|
|
1787
|
+
onDataChange
|
|
1788
|
+
}) {
|
|
1789
|
+
if (!onCellChange && !onDataChange) return true;
|
|
1790
|
+
if (onCellChange) {
|
|
1791
|
+
onCellChange(rowId, columnId, value);
|
|
1792
|
+
return true;
|
|
1793
|
+
}
|
|
1794
|
+
const row = rows.find((item) => item.id === rowId);
|
|
1795
|
+
if (!row) return false;
|
|
1796
|
+
const cell = row.getAllCells().find((item) => item.column.id === columnId) ?? row.getVisibleCells().find((item) => item.column.id === columnId);
|
|
1797
|
+
if (!cell) return false;
|
|
1798
|
+
const accessorKey = getColumnAccessorKey(cell.column.columnDef);
|
|
1799
|
+
if (!accessorKey) return false;
|
|
1800
|
+
const dataIndex = row.index;
|
|
1801
|
+
if (dataIndex < 0 || dataIndex >= data.length) return false;
|
|
1802
|
+
const next = data.map((item) => ({ ...item }));
|
|
1803
|
+
const target = next[dataIndex];
|
|
1804
|
+
if (!target) return false;
|
|
1805
|
+
target[accessorKey] = value;
|
|
1806
|
+
onDataChange?.(next);
|
|
1807
|
+
return true;
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
// src/components/ui/table/features/cell-edit/useCellEdit.ts
|
|
1747
1811
|
function useCellEdit({
|
|
1748
1812
|
data,
|
|
1749
1813
|
rows,
|
|
@@ -1778,21 +1842,23 @@ function useCellEdit({
|
|
|
1778
1842
|
cancelEdit();
|
|
1779
1843
|
return true;
|
|
1780
1844
|
}
|
|
1781
|
-
const value = raw ?? draftValueRef.current;
|
|
1782
1845
|
if (!isColumnEditable(cell.column.columnDef)) {
|
|
1783
1846
|
cancelEdit();
|
|
1784
1847
|
return true;
|
|
1785
1848
|
}
|
|
1849
|
+
const value = raw ?? draftValueRef.current;
|
|
1786
1850
|
const parsed = parseCellEditValue(value, getColumnEditType(cell.column.columnDef));
|
|
1787
1851
|
if (!parsed.ok) return false;
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1852
|
+
const committed = commitCellValue({
|
|
1853
|
+
data,
|
|
1854
|
+
rows,
|
|
1855
|
+
rowId: row.id,
|
|
1856
|
+
columnId: cell.column.id,
|
|
1857
|
+
value: parsed.value,
|
|
1858
|
+
onCellChange,
|
|
1859
|
+
onDataChange
|
|
1860
|
+
});
|
|
1861
|
+
if (!committed) return false;
|
|
1796
1862
|
cancelEdit();
|
|
1797
1863
|
return true;
|
|
1798
1864
|
},
|
|
@@ -1821,13 +1887,250 @@ function useCellEdit({
|
|
|
1821
1887
|
};
|
|
1822
1888
|
}
|
|
1823
1889
|
|
|
1890
|
+
// src/components/ui/table/features/cell-render/builtins.tsx
|
|
1891
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1892
|
+
function asString(value) {
|
|
1893
|
+
if (value == null) return "";
|
|
1894
|
+
return String(value);
|
|
1895
|
+
}
|
|
1896
|
+
function asStringList(value) {
|
|
1897
|
+
if (Array.isArray(value)) {
|
|
1898
|
+
return value.map((item) => asString(item)).filter(Boolean);
|
|
1899
|
+
}
|
|
1900
|
+
if (value == null || value === "") return [];
|
|
1901
|
+
return [asString(value)];
|
|
1902
|
+
}
|
|
1903
|
+
function asDrilldownItems(value) {
|
|
1904
|
+
if (!Array.isArray(value)) return [];
|
|
1905
|
+
return value.flatMap((item) => {
|
|
1906
|
+
if (item == null) return [];
|
|
1907
|
+
if (typeof item === "string") return [{ text: item }];
|
|
1908
|
+
if (typeof item === "object") {
|
|
1909
|
+
const record = item;
|
|
1910
|
+
const text = asString(record.text ?? record.label ?? "");
|
|
1911
|
+
if (!text) return [];
|
|
1912
|
+
const img = record.img ?? record.image;
|
|
1913
|
+
return [{ text, ...typeof img === "string" ? { img } : {} }];
|
|
1914
|
+
}
|
|
1915
|
+
return [{ text: asString(item) }];
|
|
1916
|
+
});
|
|
1917
|
+
}
|
|
1918
|
+
function escapeHtml(text) {
|
|
1919
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1920
|
+
}
|
|
1921
|
+
function simpleMarkdownToHtml(source) {
|
|
1922
|
+
const escaped = escapeHtml(source);
|
|
1923
|
+
return escaped.replace(/`([^`]+)`/g, "<code>$1</code>").replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>").replace(/\*([^*]+)\*/g, "<em>$1</em>").replace(/\n/g, "<br />");
|
|
1924
|
+
}
|
|
1925
|
+
function TextCell({ value }) {
|
|
1926
|
+
return asString(value);
|
|
1927
|
+
}
|
|
1928
|
+
function NumberCell({ value }) {
|
|
1929
|
+
if (value == null || value === "") return null;
|
|
1930
|
+
return asString(value);
|
|
1931
|
+
}
|
|
1932
|
+
function BooleanCell({ value, update, cellProps }) {
|
|
1933
|
+
const checked = Boolean(value);
|
|
1934
|
+
const readonly = Boolean(cellProps?.readonly);
|
|
1935
|
+
return /* @__PURE__ */ jsx6(
|
|
1936
|
+
"input",
|
|
1937
|
+
{
|
|
1938
|
+
type: "checkbox",
|
|
1939
|
+
className: "data-table-cell-boolean",
|
|
1940
|
+
checked,
|
|
1941
|
+
disabled: readonly,
|
|
1942
|
+
"aria-checked": checked,
|
|
1943
|
+
onChange: (event) => {
|
|
1944
|
+
if (readonly) return;
|
|
1945
|
+
update(event.target.checked);
|
|
1946
|
+
},
|
|
1947
|
+
onClick: (event) => {
|
|
1948
|
+
event.stopPropagation();
|
|
1949
|
+
},
|
|
1950
|
+
onMouseDown: (event) => {
|
|
1951
|
+
event.stopPropagation();
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
);
|
|
1955
|
+
}
|
|
1956
|
+
function sanitizeUriHref(raw) {
|
|
1957
|
+
const href = raw.trim();
|
|
1958
|
+
if (!href) return null;
|
|
1959
|
+
if (href.startsWith("/") || href.startsWith("#") || href.startsWith("?") || href.startsWith("./") || href.startsWith("../")) {
|
|
1960
|
+
return href;
|
|
1961
|
+
}
|
|
1962
|
+
try {
|
|
1963
|
+
const parsed = new URL(href);
|
|
1964
|
+
const protocol = parsed.protocol.toLowerCase();
|
|
1965
|
+
if (protocol === "http:" || protocol === "https:" || protocol === "mailto:") {
|
|
1966
|
+
return href;
|
|
1967
|
+
}
|
|
1968
|
+
return null;
|
|
1969
|
+
} catch {
|
|
1970
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(href)) return null;
|
|
1971
|
+
return href;
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
function UriCell({ value }) {
|
|
1975
|
+
const raw = asString(value);
|
|
1976
|
+
if (!raw) return null;
|
|
1977
|
+
const href = sanitizeUriHref(raw);
|
|
1978
|
+
if (!href) {
|
|
1979
|
+
return /* @__PURE__ */ jsx6("span", { className: "data-table-cell-uri", children: raw });
|
|
1980
|
+
}
|
|
1981
|
+
return /* @__PURE__ */ jsx6(
|
|
1982
|
+
"a",
|
|
1983
|
+
{
|
|
1984
|
+
className: "data-table-cell-uri",
|
|
1985
|
+
href,
|
|
1986
|
+
target: "_blank",
|
|
1987
|
+
rel: "noopener noreferrer",
|
|
1988
|
+
onClick: (event) => event.stopPropagation(),
|
|
1989
|
+
onMouseDown: (event) => event.stopPropagation(),
|
|
1990
|
+
children: raw
|
|
1991
|
+
}
|
|
1992
|
+
);
|
|
1993
|
+
}
|
|
1994
|
+
function ImageCell({ value }) {
|
|
1995
|
+
const urls = asStringList(value);
|
|
1996
|
+
if (urls.length === 0) return null;
|
|
1997
|
+
return /* @__PURE__ */ jsx6("span", { className: "data-table-cell-image", children: urls.map((url, index) => /* @__PURE__ */ jsx6(
|
|
1998
|
+
"img",
|
|
1999
|
+
{
|
|
2000
|
+
src: url,
|
|
2001
|
+
alt: "",
|
|
2002
|
+
className: "data-table-cell-image-item"
|
|
2003
|
+
},
|
|
2004
|
+
`${index}:${url}`
|
|
2005
|
+
)) });
|
|
2006
|
+
}
|
|
2007
|
+
function BubbleCell({ value }) {
|
|
2008
|
+
const items = asStringList(value);
|
|
2009
|
+
if (items.length === 0) return null;
|
|
2010
|
+
return /* @__PURE__ */ jsx6("span", { className: "data-table-cell-bubble", children: items.map((item, index) => /* @__PURE__ */ jsx6("span", { className: "data-table-cell-bubble-item", children: item }, `${index}:${item}`)) });
|
|
2011
|
+
}
|
|
2012
|
+
function MarkdownCell({ value }) {
|
|
2013
|
+
const source = asString(value);
|
|
2014
|
+
if (!source) return null;
|
|
2015
|
+
return /* @__PURE__ */ jsx6(
|
|
2016
|
+
"span",
|
|
2017
|
+
{
|
|
2018
|
+
className: "data-table-cell-markdown",
|
|
2019
|
+
dangerouslySetInnerHTML: { __html: simpleMarkdownToHtml(source) }
|
|
2020
|
+
}
|
|
2021
|
+
);
|
|
2022
|
+
}
|
|
2023
|
+
function DrilldownCell({ value }) {
|
|
2024
|
+
const items = asDrilldownItems(value);
|
|
2025
|
+
if (items.length === 0) return null;
|
|
2026
|
+
return /* @__PURE__ */ jsx6("span", { className: "data-table-cell-drilldown", children: items.map((item, index) => /* @__PURE__ */ jsxs5(
|
|
2027
|
+
"span",
|
|
2028
|
+
{
|
|
2029
|
+
className: "data-table-cell-drilldown-item",
|
|
2030
|
+
children: [
|
|
2031
|
+
item.img ? /* @__PURE__ */ jsx6(
|
|
2032
|
+
"img",
|
|
2033
|
+
{
|
|
2034
|
+
src: item.img,
|
|
2035
|
+
alt: "",
|
|
2036
|
+
className: "data-table-cell-drilldown-image"
|
|
2037
|
+
}
|
|
2038
|
+
) : null,
|
|
2039
|
+
/* @__PURE__ */ jsx6("span", { className: "data-table-cell-drilldown-text", children: item.text })
|
|
2040
|
+
]
|
|
2041
|
+
},
|
|
2042
|
+
`${index}:${item.text}:${item.img ?? ""}`
|
|
2043
|
+
)) });
|
|
2044
|
+
}
|
|
2045
|
+
function LoadingCell() {
|
|
2046
|
+
return /* @__PURE__ */ jsx6("span", { className: "data-table-cell-loading", "aria-busy": "true" });
|
|
2047
|
+
}
|
|
2048
|
+
function ProtectedCell() {
|
|
2049
|
+
return /* @__PURE__ */ jsx6("span", { className: "data-table-cell-protected", "aria-label": "protected", children: "****" });
|
|
2050
|
+
}
|
|
2051
|
+
function RowIdCell({ value }) {
|
|
2052
|
+
return /* @__PURE__ */ jsx6("span", { className: "data-table-cell-row-id", children: asString(value) });
|
|
2053
|
+
}
|
|
2054
|
+
var BUILTIN_RENDER_MAP = {
|
|
2055
|
+
text: TextCell,
|
|
2056
|
+
number: NumberCell,
|
|
2057
|
+
boolean: BooleanCell,
|
|
2058
|
+
uri: UriCell,
|
|
2059
|
+
image: ImageCell,
|
|
2060
|
+
bubble: BubbleCell,
|
|
2061
|
+
markdown: MarkdownCell,
|
|
2062
|
+
drilldown: DrilldownCell,
|
|
2063
|
+
loading: LoadingCell,
|
|
2064
|
+
protected: ProtectedCell,
|
|
2065
|
+
"row-id": RowIdCell
|
|
2066
|
+
};
|
|
2067
|
+
var BUILTIN_CELL_RENDERERS = Object.keys(BUILTIN_RENDER_MAP).map((kind) => ({
|
|
2068
|
+
kind,
|
|
2069
|
+
render: BUILTIN_RENDER_MAP[kind]
|
|
2070
|
+
}));
|
|
2071
|
+
|
|
2072
|
+
// src/components/ui/table/features/cell-render/registry.ts
|
|
2073
|
+
function createCellRendererRegistry(customRenderers = []) {
|
|
2074
|
+
const registry = /* @__PURE__ */ new Map();
|
|
2075
|
+
for (const renderer of BUILTIN_CELL_RENDERERS) {
|
|
2076
|
+
registry.set(renderer.kind, renderer);
|
|
2077
|
+
}
|
|
2078
|
+
for (const renderer of customRenderers) {
|
|
2079
|
+
registry.set(renderer.kind, renderer);
|
|
2080
|
+
}
|
|
2081
|
+
return registry;
|
|
2082
|
+
}
|
|
2083
|
+
function resolveCellRenderer(registry, kind, ctx) {
|
|
2084
|
+
if (!kind) return void 0;
|
|
2085
|
+
const renderer = registry.get(kind);
|
|
2086
|
+
if (!renderer) return void 0;
|
|
2087
|
+
if (renderer.isMatch && !renderer.isMatch(ctx)) {
|
|
2088
|
+
return void 0;
|
|
2089
|
+
}
|
|
2090
|
+
return renderer;
|
|
2091
|
+
}
|
|
2092
|
+
function formatDefaultCellValue(value) {
|
|
2093
|
+
if (value == null) return null;
|
|
2094
|
+
if (typeof value === "string") return value;
|
|
2095
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
2096
|
+
return String(value);
|
|
2097
|
+
}
|
|
2098
|
+
if (typeof value === "bigint") return value.toString();
|
|
2099
|
+
return String(value);
|
|
2100
|
+
}
|
|
2101
|
+
|
|
1824
2102
|
// src/components/ui/table/features/cell-selection/useCellSelection.ts
|
|
1825
2103
|
import { useCallback as useCallback2, useEffect as useEffect4, useRef as useRef4, useState as useState2 } from "react";
|
|
1826
2104
|
|
|
1827
2105
|
// src/components/ui/table/features/cell-selection/copyData.ts
|
|
2106
|
+
function formatPrimitive(value) {
|
|
2107
|
+
if (value === null || value === void 0) return "";
|
|
2108
|
+
if (typeof value === "string") return value;
|
|
2109
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
2110
|
+
return String(value);
|
|
2111
|
+
}
|
|
2112
|
+
return "";
|
|
2113
|
+
}
|
|
2114
|
+
function formatObjectValue(value) {
|
|
2115
|
+
const text = value.text ?? value.label ?? value.name ?? value.title;
|
|
2116
|
+
if (text != null && text !== "") {
|
|
2117
|
+
return formatCellValue(text);
|
|
2118
|
+
}
|
|
2119
|
+
try {
|
|
2120
|
+
return JSON.stringify(value);
|
|
2121
|
+
} catch {
|
|
2122
|
+
return "";
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
1828
2125
|
function formatCellValue(value) {
|
|
1829
2126
|
if (value === null || value === void 0) return "";
|
|
1830
|
-
|
|
2127
|
+
if (Array.isArray(value)) {
|
|
2128
|
+
return value.map((item) => formatCellValue(item)).filter((item) => item.length > 0).join(", ");
|
|
2129
|
+
}
|
|
2130
|
+
if (typeof value === "object") {
|
|
2131
|
+
return formatObjectValue(value);
|
|
2132
|
+
}
|
|
2133
|
+
return formatPrimitive(value);
|
|
1831
2134
|
}
|
|
1832
2135
|
function getNestedValue(row, path) {
|
|
1833
2136
|
if (!path.includes(".")) return row[path];
|
|
@@ -2716,6 +3019,7 @@ function useGlideTable(options) {
|
|
|
2716
3019
|
onDataChange,
|
|
2717
3020
|
onCellChange,
|
|
2718
3021
|
onBatchChange,
|
|
3022
|
+
cellRenderers,
|
|
2719
3023
|
preserveRowSelection = false,
|
|
2720
3024
|
toggleField,
|
|
2721
3025
|
childField,
|
|
@@ -2941,6 +3245,26 @@ function useGlideTable(options) {
|
|
|
2941
3245
|
commitEdit,
|
|
2942
3246
|
cancelEdit
|
|
2943
3247
|
} = useCellEdit({ data: tableData, rows, onDataChange, onCellChange });
|
|
3248
|
+
const cellRendererRegistry = useMemo3(
|
|
3249
|
+
() => createCellRendererRegistry(cellRenderers),
|
|
3250
|
+
[cellRenderers]
|
|
3251
|
+
);
|
|
3252
|
+
const commitRenderedCellValue = useCallback4(
|
|
3253
|
+
(rowId, columnId, value) => commitCellValue({
|
|
3254
|
+
data: tableData,
|
|
3255
|
+
rows,
|
|
3256
|
+
rowId,
|
|
3257
|
+
columnId,
|
|
3258
|
+
value,
|
|
3259
|
+
onCellChange,
|
|
3260
|
+
onDataChange
|
|
3261
|
+
}),
|
|
3262
|
+
[onCellChange, onDataChange, rows, tableData]
|
|
3263
|
+
);
|
|
3264
|
+
const getCellContext = useCallback4(
|
|
3265
|
+
(cell) => withCellUpdate(cell.getContext(), commitRenderedCellValue),
|
|
3266
|
+
[commitRenderedCellValue]
|
|
3267
|
+
);
|
|
2944
3268
|
const handleCellMouseDownWithCommit = useCallback4(
|
|
2945
3269
|
(rowIndex, colIndex, options2) => {
|
|
2946
3270
|
const isSameEditingCell = editingCell?.rowIndex === rowIndex && editingCell?.colIndex === colIndex;
|
|
@@ -3177,6 +3501,10 @@ function useGlideTable(options) {
|
|
|
3177
3501
|
onCommitEdit: commitEdit,
|
|
3178
3502
|
onCancelEdit: cancelEdit
|
|
3179
3503
|
},
|
|
3504
|
+
cellRender: {
|
|
3505
|
+
registry: cellRendererRegistry,
|
|
3506
|
+
commitValue: commitRenderedCellValue
|
|
3507
|
+
},
|
|
3180
3508
|
expand: {
|
|
3181
3509
|
enableExpand,
|
|
3182
3510
|
toggleField,
|
|
@@ -3223,6 +3551,8 @@ function useGlideTable(options) {
|
|
|
3223
3551
|
startEdit,
|
|
3224
3552
|
commitEdit,
|
|
3225
3553
|
cancelEdit,
|
|
3554
|
+
cellRendererRegistry,
|
|
3555
|
+
commitRenderedCellValue,
|
|
3226
3556
|
enableExpand,
|
|
3227
3557
|
toggleField,
|
|
3228
3558
|
expandedRows,
|
|
@@ -3267,6 +3597,7 @@ function useGlideTable(options) {
|
|
|
3267
3597
|
paddingTop,
|
|
3268
3598
|
paddingBottom,
|
|
3269
3599
|
rowContextValue,
|
|
3600
|
+
getCellContext,
|
|
3270
3601
|
handleToggleSelect,
|
|
3271
3602
|
clearHover,
|
|
3272
3603
|
copySelection: stableCopySelection,
|
|
@@ -3288,20 +3619,20 @@ function useGlideTable(options) {
|
|
|
3288
3619
|
}
|
|
3289
3620
|
|
|
3290
3621
|
// src/components/ui/table/components/DataTable/DataTable.tsx
|
|
3291
|
-
import { Fragment as Fragment2, jsx as
|
|
3622
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3292
3623
|
function DefaultScroll({
|
|
3293
3624
|
scrollRef,
|
|
3294
3625
|
children,
|
|
3295
3626
|
className
|
|
3296
3627
|
}) {
|
|
3297
|
-
return /* @__PURE__ */
|
|
3628
|
+
return /* @__PURE__ */ jsx7("div", { ref: scrollRef, className: cn("data-table-scroll", className), children });
|
|
3298
3629
|
}
|
|
3299
3630
|
function DefaultPending({
|
|
3300
3631
|
loadingText,
|
|
3301
3632
|
className,
|
|
3302
3633
|
classNames
|
|
3303
3634
|
}) {
|
|
3304
|
-
return /* @__PURE__ */
|
|
3635
|
+
return /* @__PURE__ */ jsx7(
|
|
3305
3636
|
"div",
|
|
3306
3637
|
{
|
|
3307
3638
|
className: cn(
|
|
@@ -3311,7 +3642,7 @@ function DefaultPending({
|
|
|
3311
3642
|
classNames?.pending,
|
|
3312
3643
|
className
|
|
3313
3644
|
),
|
|
3314
|
-
children: /* @__PURE__ */
|
|
3645
|
+
children: /* @__PURE__ */ jsx7("span", { className: cn("data-table-loading-text", classNames?.loadingText), children: loadingText })
|
|
3315
3646
|
}
|
|
3316
3647
|
);
|
|
3317
3648
|
}
|
|
@@ -3320,7 +3651,7 @@ function DefaultEmpty({
|
|
|
3320
3651
|
columnCount,
|
|
3321
3652
|
classNames
|
|
3322
3653
|
}) {
|
|
3323
|
-
return /* @__PURE__ */
|
|
3654
|
+
return /* @__PURE__ */ jsx7("tr", { children: /* @__PURE__ */ jsx7(
|
|
3324
3655
|
"td",
|
|
3325
3656
|
{
|
|
3326
3657
|
colSpan: columnCount,
|
|
@@ -3378,7 +3709,7 @@ function DataTable({
|
|
|
3378
3709
|
[rowContextValue, classNames]
|
|
3379
3710
|
);
|
|
3380
3711
|
if (isPending) {
|
|
3381
|
-
return /* @__PURE__ */
|
|
3712
|
+
return /* @__PURE__ */ jsx7(
|
|
3382
3713
|
PendingSlot,
|
|
3383
3714
|
{
|
|
3384
3715
|
loadingText,
|
|
@@ -3387,7 +3718,7 @@ function DataTable({
|
|
|
3387
3718
|
}
|
|
3388
3719
|
);
|
|
3389
3720
|
}
|
|
3390
|
-
return /* @__PURE__ */
|
|
3721
|
+
return /* @__PURE__ */ jsxs6(
|
|
3391
3722
|
"div",
|
|
3392
3723
|
{
|
|
3393
3724
|
ref: rootRef,
|
|
@@ -3401,7 +3732,7 @@ function DataTable({
|
|
|
3401
3732
|
className
|
|
3402
3733
|
),
|
|
3403
3734
|
children: [
|
|
3404
|
-
/* @__PURE__ */
|
|
3735
|
+
/* @__PURE__ */ jsx7(
|
|
3405
3736
|
ToolbarSlot,
|
|
3406
3737
|
{
|
|
3407
3738
|
filteredCount: filteredCount ?? tableData.length,
|
|
@@ -3413,7 +3744,7 @@ function DataTable({
|
|
|
3413
3744
|
classNames
|
|
3414
3745
|
}
|
|
3415
3746
|
),
|
|
3416
|
-
enableInlineSearch ? /* @__PURE__ */
|
|
3747
|
+
enableInlineSearch ? /* @__PURE__ */ jsx7(
|
|
3417
3748
|
DataTableSearch,
|
|
3418
3749
|
{
|
|
3419
3750
|
showSearch: inlineSearch.showSearch,
|
|
@@ -3435,14 +3766,14 @@ function DataTable({
|
|
|
3435
3766
|
onPrevious: inlineSearch.goToPrevious
|
|
3436
3767
|
}
|
|
3437
3768
|
) : null,
|
|
3438
|
-
/* @__PURE__ */
|
|
3769
|
+
/* @__PURE__ */ jsx7(ScrollSlot, { scrollRef, className: classNames?.scroll, children: /* @__PURE__ */ jsxs6(
|
|
3439
3770
|
"table",
|
|
3440
3771
|
{
|
|
3441
3772
|
className: cn("data-table", classNames?.table),
|
|
3442
3773
|
style: enableColumnResize ? { width: table.getTotalSize() } : void 0,
|
|
3443
3774
|
onDragStart: enableCellSelection ? (event) => event.preventDefault() : void 0,
|
|
3444
3775
|
children: [
|
|
3445
|
-
/* @__PURE__ */
|
|
3776
|
+
/* @__PURE__ */ jsx7("thead", { className: cn("data-table-head", classNames?.head), children: headerGroups.map((headerGroup) => /* @__PURE__ */ jsx7(
|
|
3446
3777
|
"tr",
|
|
3447
3778
|
{
|
|
3448
3779
|
className: cn("data-table-head-row", classNames?.headRow),
|
|
@@ -3454,7 +3785,7 @@ function DataTable({
|
|
|
3454
3785
|
force: enableColumnResize,
|
|
3455
3786
|
lockMax: enableColumnResize
|
|
3456
3787
|
});
|
|
3457
|
-
const freezeOffset = enableColumnFreeze ?
|
|
3788
|
+
const freezeOffset = enableColumnFreeze ? resolveHeaderFreezeOffset(header.column, freezeOffsets) : void 0;
|
|
3458
3789
|
const freezeStyle = getColumnFreezeStyle(freezeOffset, {
|
|
3459
3790
|
isHeader: true,
|
|
3460
3791
|
headerTop: header.depth * DATA_TABLE_HEADER_ROW_HEIGHT
|
|
@@ -3463,7 +3794,7 @@ function DataTable({
|
|
|
3463
3794
|
...sizeStyle,
|
|
3464
3795
|
...freezeStyle
|
|
3465
3796
|
};
|
|
3466
|
-
return /* @__PURE__ */
|
|
3797
|
+
return /* @__PURE__ */ jsxs6(
|
|
3467
3798
|
"th",
|
|
3468
3799
|
{
|
|
3469
3800
|
colSpan: header.colSpan,
|
|
@@ -3480,8 +3811,11 @@ function DataTable({
|
|
|
3480
3811
|
headerClassName
|
|
3481
3812
|
),
|
|
3482
3813
|
children: [
|
|
3483
|
-
header.isPlaceholder ? null : flexRender2(
|
|
3484
|
-
|
|
3814
|
+
header.isPlaceholder ? null : flexRender2(
|
|
3815
|
+
header.column.columnDef.header,
|
|
3816
|
+
header.getContext()
|
|
3817
|
+
),
|
|
3818
|
+
canResize ? /* @__PURE__ */ jsx7(
|
|
3485
3819
|
"div",
|
|
3486
3820
|
{
|
|
3487
3821
|
role: "separator",
|
|
@@ -3507,20 +3841,20 @@ function DataTable({
|
|
|
3507
3841
|
},
|
|
3508
3842
|
headerGroup.id
|
|
3509
3843
|
)) }),
|
|
3510
|
-
/* @__PURE__ */
|
|
3844
|
+
/* @__PURE__ */ jsx7(DataTableContextProvider, { value: contextValue, children: /* @__PURE__ */ jsx7(
|
|
3511
3845
|
"tbody",
|
|
3512
3846
|
{
|
|
3513
3847
|
onMouseLeave: clearHover,
|
|
3514
3848
|
className: cn("data-table-body", classNames?.body),
|
|
3515
|
-
children: rows.length === 0 ? /* @__PURE__ */
|
|
3849
|
+
children: rows.length === 0 ? /* @__PURE__ */ jsx7(
|
|
3516
3850
|
EmptySlot,
|
|
3517
3851
|
{
|
|
3518
3852
|
emptyText,
|
|
3519
3853
|
columnCount,
|
|
3520
3854
|
classNames
|
|
3521
3855
|
}
|
|
3522
|
-
) : shouldVirtualize ? /* @__PURE__ */
|
|
3523
|
-
paddingTop > 0 && /* @__PURE__ */
|
|
3856
|
+
) : shouldVirtualize ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
3857
|
+
paddingTop > 0 && /* @__PURE__ */ jsx7(
|
|
3524
3858
|
"tr",
|
|
3525
3859
|
{
|
|
3526
3860
|
"aria-hidden": true,
|
|
@@ -3528,7 +3862,7 @@ function DataTable({
|
|
|
3528
3862
|
"data-table-virtual-spacer",
|
|
3529
3863
|
classNames?.virtualSpacer
|
|
3530
3864
|
),
|
|
3531
|
-
children: /* @__PURE__ */
|
|
3865
|
+
children: /* @__PURE__ */ jsx7(
|
|
3532
3866
|
"td",
|
|
3533
3867
|
{
|
|
3534
3868
|
colSpan: columnCount,
|
|
@@ -3544,7 +3878,7 @@ function DataTable({
|
|
|
3544
3878
|
virtualRows.map((virtualRow) => {
|
|
3545
3879
|
const row = rows[virtualRow.index];
|
|
3546
3880
|
if (!row) return null;
|
|
3547
|
-
return /* @__PURE__ */
|
|
3881
|
+
return /* @__PURE__ */ jsx7(
|
|
3548
3882
|
RowSlot,
|
|
3549
3883
|
{
|
|
3550
3884
|
row,
|
|
@@ -3555,7 +3889,7 @@ function DataTable({
|
|
|
3555
3889
|
row.id
|
|
3556
3890
|
);
|
|
3557
3891
|
}),
|
|
3558
|
-
paddingBottom > 0 && /* @__PURE__ */
|
|
3892
|
+
paddingBottom > 0 && /* @__PURE__ */ jsx7(
|
|
3559
3893
|
"tr",
|
|
3560
3894
|
{
|
|
3561
3895
|
"aria-hidden": true,
|
|
@@ -3563,7 +3897,7 @@ function DataTable({
|
|
|
3563
3897
|
"data-table-virtual-spacer",
|
|
3564
3898
|
classNames?.virtualSpacer
|
|
3565
3899
|
),
|
|
3566
|
-
children: /* @__PURE__ */
|
|
3900
|
+
children: /* @__PURE__ */ jsx7(
|
|
3567
3901
|
"td",
|
|
3568
3902
|
{
|
|
3569
3903
|
colSpan: columnCount,
|
|
@@ -3576,7 +3910,7 @@ function DataTable({
|
|
|
3576
3910
|
)
|
|
3577
3911
|
}
|
|
3578
3912
|
)
|
|
3579
|
-
] }) : rows.map((row) => /* @__PURE__ */
|
|
3913
|
+
] }) : rows.map((row) => /* @__PURE__ */ jsx7(
|
|
3580
3914
|
RowSlot,
|
|
3581
3915
|
{
|
|
3582
3916
|
row,
|
|
@@ -3595,10 +3929,44 @@ function DataTable({
|
|
|
3595
3929
|
}
|
|
3596
3930
|
|
|
3597
3931
|
// src/components/ui/table/components/Table/Table.tsx
|
|
3598
|
-
import { useCallback as
|
|
3932
|
+
import { useCallback as useCallback6, useMemo as useMemo5, useState as useState5 } from "react";
|
|
3933
|
+
|
|
3934
|
+
// src/components/ui/table/features/cell-render/ResolvedTableCell.tsx
|
|
3935
|
+
import { useCallback as useCallback5 } from "react";
|
|
3936
|
+
function ResolvedTableCell({
|
|
3937
|
+
info
|
|
3938
|
+
}) {
|
|
3939
|
+
const { cellRender } = useDataTableRowContext();
|
|
3940
|
+
const { row, column, getValue } = info;
|
|
3941
|
+
const meta = column.columnDef.meta;
|
|
3942
|
+
const value = getValue();
|
|
3943
|
+
const columnId = column.id;
|
|
3944
|
+
const update = useCallback5(
|
|
3945
|
+
(next) => {
|
|
3946
|
+
cellRender.commitValue(row.id, columnId, next);
|
|
3947
|
+
},
|
|
3948
|
+
[cellRender, columnId, row.id]
|
|
3949
|
+
);
|
|
3950
|
+
const ctx = {
|
|
3951
|
+
value,
|
|
3952
|
+
row,
|
|
3953
|
+
index: row.index,
|
|
3954
|
+
columnId,
|
|
3955
|
+
cellProps: meta?.cellProps,
|
|
3956
|
+
update
|
|
3957
|
+
};
|
|
3958
|
+
if (meta?.cellRender) {
|
|
3959
|
+
return meta.cellRender(ctx);
|
|
3960
|
+
}
|
|
3961
|
+
const renderer = resolveCellRenderer(cellRender.registry, meta?.kind, ctx);
|
|
3962
|
+
if (renderer) {
|
|
3963
|
+
return renderer.render(ctx);
|
|
3964
|
+
}
|
|
3965
|
+
return formatDefaultCellValue(value);
|
|
3966
|
+
}
|
|
3599
3967
|
|
|
3600
3968
|
// src/components/ui/table/components/Table/buildColumnDef.tsx
|
|
3601
|
-
import { jsx as
|
|
3969
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3602
3970
|
function SortableHeader({
|
|
3603
3971
|
label,
|
|
3604
3972
|
field,
|
|
@@ -3607,15 +3975,18 @@ function SortableHeader({
|
|
|
3607
3975
|
}) {
|
|
3608
3976
|
const isActive = sort?.field === field;
|
|
3609
3977
|
const Icon = isActive ? sort.direction === "asc" ? ArrowUp : ArrowDown : ArrowUpDown;
|
|
3610
|
-
return /* @__PURE__ */
|
|
3978
|
+
return /* @__PURE__ */ jsxs7(
|
|
3611
3979
|
"button",
|
|
3612
3980
|
{
|
|
3613
3981
|
type: "button",
|
|
3614
|
-
className: cn(
|
|
3982
|
+
className: cn(
|
|
3983
|
+
"SortableHeaderJSX",
|
|
3984
|
+
isActive ? "is-active" : "is-inactive"
|
|
3985
|
+
),
|
|
3615
3986
|
onClick: () => onSort(field),
|
|
3616
3987
|
children: [
|
|
3617
|
-
/* @__PURE__ */
|
|
3618
|
-
/* @__PURE__ */
|
|
3988
|
+
/* @__PURE__ */ jsx8("span", { children: label }),
|
|
3989
|
+
/* @__PURE__ */ jsx8(Icon, { className: "sortable-header-icon" })
|
|
3619
3990
|
]
|
|
3620
3991
|
}
|
|
3621
3992
|
);
|
|
@@ -3637,6 +4008,8 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
3637
4008
|
editable,
|
|
3638
4009
|
editType,
|
|
3639
4010
|
editInputProps,
|
|
4011
|
+
kind,
|
|
4012
|
+
cellProps,
|
|
3640
4013
|
className,
|
|
3641
4014
|
headerClassName,
|
|
3642
4015
|
render
|
|
@@ -3648,18 +4021,20 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
3648
4021
|
...minWidth != null ? { minSize: minWidth } : {},
|
|
3649
4022
|
...maxWidth != null ? { maxSize: maxWidth } : {},
|
|
3650
4023
|
...resizable === false ? { enableResizing: false } : {},
|
|
3651
|
-
header: sortable ? () => /* @__PURE__ */
|
|
4024
|
+
header: sortable ? () => /* @__PURE__ */ jsx8(
|
|
4025
|
+
SortableHeader,
|
|
4026
|
+
{
|
|
4027
|
+
label: children,
|
|
4028
|
+
field,
|
|
4029
|
+
sort,
|
|
4030
|
+
onSort
|
|
4031
|
+
}
|
|
4032
|
+
) : (
|
|
3652
4033
|
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
3653
4034
|
() => children
|
|
3654
4035
|
),
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
cell: ({ row, getValue }) => render(
|
|
3658
|
-
getValue(),
|
|
3659
|
-
row,
|
|
3660
|
-
row.index
|
|
3661
|
-
)
|
|
3662
|
-
} : {},
|
|
4036
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
4037
|
+
cell: (info) => /* @__PURE__ */ jsx8(ResolvedTableCell, { info }),
|
|
3663
4038
|
meta: {
|
|
3664
4039
|
align,
|
|
3665
4040
|
rowSpan,
|
|
@@ -3667,6 +4042,9 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
3667
4042
|
editable,
|
|
3668
4043
|
editType,
|
|
3669
4044
|
editInputProps,
|
|
4045
|
+
kind,
|
|
4046
|
+
cellProps,
|
|
4047
|
+
cellRender: render,
|
|
3670
4048
|
frozen,
|
|
3671
4049
|
className,
|
|
3672
4050
|
headerClassName
|
|
@@ -3689,10 +4067,8 @@ function buildColumnDefsFromTree(nodes, sort, onSort) {
|
|
|
3689
4067
|
const { header, align, headerClassName } = node.props;
|
|
3690
4068
|
return {
|
|
3691
4069
|
id: resolveGroupId(node.props, index),
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
() => header
|
|
3695
|
-
),
|
|
4070
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
4071
|
+
header: () => header,
|
|
3696
4072
|
columns: childDefs,
|
|
3697
4073
|
enableResizing: false,
|
|
3698
4074
|
meta: {
|
|
@@ -3859,7 +4235,7 @@ function TableHeader(props) {
|
|
|
3859
4235
|
TableHeader.displayName = TABLE_HEADER_DISPLAY_NAME;
|
|
3860
4236
|
|
|
3861
4237
|
// src/components/ui/table/components/Table/TablePagination.tsx
|
|
3862
|
-
import { jsx as
|
|
4238
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3863
4239
|
function TablePagination({
|
|
3864
4240
|
page,
|
|
3865
4241
|
pageSize = 10,
|
|
@@ -3871,8 +4247,8 @@ function TablePagination({
|
|
|
3871
4247
|
const safePage = Math.min(Math.max(1, page), totalPages);
|
|
3872
4248
|
const canGoPrev = safePage > 1;
|
|
3873
4249
|
const canGoNext = safePage < totalPages;
|
|
3874
|
-
return /* @__PURE__ */
|
|
3875
|
-
/* @__PURE__ */
|
|
4250
|
+
return /* @__PURE__ */ jsxs8("div", { className: cn("TablePaginationJSX", className), children: [
|
|
4251
|
+
/* @__PURE__ */ jsx9(
|
|
3876
4252
|
"button",
|
|
3877
4253
|
{
|
|
3878
4254
|
type: "button",
|
|
@@ -3880,15 +4256,15 @@ function TablePagination({
|
|
|
3880
4256
|
disabled: !canGoPrev,
|
|
3881
4257
|
onClick: () => onChange(safePage - 1),
|
|
3882
4258
|
"aria-label": "Previous page",
|
|
3883
|
-
children: /* @__PURE__ */
|
|
4259
|
+
children: /* @__PURE__ */ jsx9(ChevronLeft, { className: "pagination-button-icon" })
|
|
3884
4260
|
}
|
|
3885
4261
|
),
|
|
3886
|
-
/* @__PURE__ */
|
|
4262
|
+
/* @__PURE__ */ jsxs8("span", { className: "pagination-label", children: [
|
|
3887
4263
|
safePage,
|
|
3888
4264
|
" / ",
|
|
3889
4265
|
totalPages
|
|
3890
4266
|
] }),
|
|
3891
|
-
/* @__PURE__ */
|
|
4267
|
+
/* @__PURE__ */ jsx9(
|
|
3892
4268
|
"button",
|
|
3893
4269
|
{
|
|
3894
4270
|
type: "button",
|
|
@@ -3896,7 +4272,7 @@ function TablePagination({
|
|
|
3896
4272
|
disabled: !canGoNext,
|
|
3897
4273
|
onClick: () => onChange(safePage + 1),
|
|
3898
4274
|
"aria-label": "Next page",
|
|
3899
|
-
children: /* @__PURE__ */
|
|
4275
|
+
children: /* @__PURE__ */ jsx9(ChevronRight, { className: "pagination-button-icon" })
|
|
3900
4276
|
}
|
|
3901
4277
|
)
|
|
3902
4278
|
] });
|
|
@@ -3904,7 +4280,7 @@ function TablePagination({
|
|
|
3904
4280
|
TablePagination.displayName = TABLE_PAGINATION_DISPLAY_NAME;
|
|
3905
4281
|
|
|
3906
4282
|
// src/components/ui/table/components/Table/Table.tsx
|
|
3907
|
-
import { jsx as
|
|
4283
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3908
4284
|
function TableRoot({
|
|
3909
4285
|
data,
|
|
3910
4286
|
children,
|
|
@@ -3918,7 +4294,7 @@ function TableRoot({
|
|
|
3918
4294
|
[children]
|
|
3919
4295
|
);
|
|
3920
4296
|
const [sort, setSort] = useState5(null);
|
|
3921
|
-
const handleSort =
|
|
4297
|
+
const handleSort = useCallback6((field) => {
|
|
3922
4298
|
setSort((previous) => {
|
|
3923
4299
|
if (previous?.field !== field) {
|
|
3924
4300
|
return { field, direction: "asc" };
|
|
@@ -3946,8 +4322,8 @@ function TableRoot({
|
|
|
3946
4322
|
if (countLeafColumns(columnTree) === 0) {
|
|
3947
4323
|
console.warn("[Table] Declare at least one Table.Column inside Table.Header.");
|
|
3948
4324
|
}
|
|
3949
|
-
return /* @__PURE__ */
|
|
3950
|
-
/* @__PURE__ */
|
|
4325
|
+
return /* @__PURE__ */ jsxs9("div", { className: "TableJSX", children: [
|
|
4326
|
+
/* @__PURE__ */ jsx10(
|
|
3951
4327
|
DataTable,
|
|
3952
4328
|
{
|
|
3953
4329
|
...dataTableProps,
|
|
@@ -3958,7 +4334,7 @@ function TableRoot({
|
|
|
3958
4334
|
className: cn(className, paginationProps && "DataTableJSX--with-pagination")
|
|
3959
4335
|
}
|
|
3960
4336
|
),
|
|
3961
|
-
paginationProps && /* @__PURE__ */
|
|
4337
|
+
paginationProps && /* @__PURE__ */ jsx10(
|
|
3962
4338
|
TablePagination,
|
|
3963
4339
|
{
|
|
3964
4340
|
page,
|
|
@@ -3983,7 +4359,7 @@ function createTable() {
|
|
|
3983
4359
|
ColumnGroup.displayName = TABLE_COLUMN_GROUP_DISPLAY_NAME;
|
|
3984
4360
|
return Object.assign(
|
|
3985
4361
|
function BoundTable(props) {
|
|
3986
|
-
return /* @__PURE__ */
|
|
4362
|
+
return /* @__PURE__ */ jsx10(TableRoot, { ...props });
|
|
3987
4363
|
},
|
|
3988
4364
|
{
|
|
3989
4365
|
Header: TableHeader,
|