@agilant/toga-blox 1.0.169 → 1.0.170
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.
|
@@ -7,8 +7,19 @@ const TableCell = ({ cell, isLastCell, hasInfiniteScroll, expanded, onToggle, li
|
|
|
7
7
|
const isLong = isString && fullText.length > MAX_CHARS;
|
|
8
8
|
const hasToggle = hasInfiniteScroll && isLong;
|
|
9
9
|
const truncated = fullText.slice(0, MAX_CHARS);
|
|
10
|
+
/* stop row click when toggling */
|
|
11
|
+
const handleToggle = (e) => {
|
|
12
|
+
e.stopPropagation(); // ← prevents bubbling to the <tr>
|
|
13
|
+
onToggle();
|
|
14
|
+
};
|
|
10
15
|
const baseTd = "relative overflow-hidden font-light text-sm text-left px-5";
|
|
11
16
|
const wrapper = "min-h-[40px] flex select-none" + (hasToggle ? " cursor-pointer" : "");
|
|
12
|
-
return (_jsx("td", { ...cell.getCellProps(), className: isLastCell ? "" : baseTd, children: _jsx("div", { ...(hasToggle ? { onClick:
|
|
17
|
+
return (_jsx("td", { ...cell.getCellProps(), className: isLastCell ? "" : baseTd, children: _jsx("div", { ...(hasToggle ? { onClick: handleToggle } : {}), className: wrapper, children: hasToggle ? (!expanded ? (
|
|
18
|
+
/* collapsed view */
|
|
19
|
+
_jsx("div", { className: "flex items-center group", children: _jsxs("span", { children: [truncated, "\u2026", _jsx("span", { className: `hidden group-hover:inline ${linkText}`, children: "Show more" })] }) })) : (
|
|
20
|
+
/* expanded view */
|
|
21
|
+
_jsxs("div", { className: "flex flex-col", children: [_jsx("span", { children: fullText }), _jsx("span", { className: linkText, children: "Show less" })] }))) : (
|
|
22
|
+
/* no toggle required */
|
|
23
|
+
cell.render("Cell")) }) }));
|
|
13
24
|
};
|
|
14
25
|
export default TableCell;
|