@agilant/toga-blox 1.0.219 → 1.0.221
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.
|
@@ -38,11 +38,12 @@ const TableCell = ({ cell, isLastCell, expanded, onToggle, maxCharacters = DEFAU
|
|
|
38
38
|
prev.current = needsToggle;
|
|
39
39
|
}
|
|
40
40
|
}, [needsToggle, onCellOverflow]);
|
|
41
|
-
return (_jsx("td", { ...safeCellProps, className: isStickyColumn ? undefined : isLastCell ? "" : baseTd, children: _jsx("div", { className: wrapper
|
|
41
|
+
return (_jsx("td", { ...safeCellProps, className: isStickyColumn ? undefined : isLastCell ? "" : baseTd, children: _jsx("div", { className: `${wrapper} group`, style: { maxWidth: `${cellMaxWidthWhenExpanded}ch` }, children: needsToggle ? (!expanded ? (_jsx(ToggleComponent, { expanded: expanded, onToggle: onToggle, truncated: truncated, fullText: fullText, className: additionalCellClassNames, linkTextClassNames: linkTextClassNames })) : (_jsxs("div", { className: "flex flex-col min-w-full", style: {
|
|
42
42
|
maxWidth: `${cellMaxWidthWhenExpanded}ch`,
|
|
43
|
-
}, children: [_jsx("span", { className: `text-left pr-5 ${cellTextClassNames}`, children: fullText }), _jsx("span", { children: typeof expandedCellActionButton ===
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
}, children: [_jsxs("div", { className: "flex items-center", children: [_jsx("span", { className: `text-left pr-5 ${cellTextClassNames}`, children: fullText }), _jsx("span", { className: "opacity-0 group-hover:opacity-100 transition-opacity inline-block", children: typeof expandedCellActionButton ===
|
|
44
|
+
"function"
|
|
45
|
+
? expandedCellActionButton(fullText)
|
|
46
|
+
: expandedCellActionButton })] }), _jsx("span", { onClick: (e) => {
|
|
46
47
|
e.stopPropagation();
|
|
47
48
|
onToggle();
|
|
48
49
|
}, className: linkTextClassNames, children: "Show less" })] }))) : (cell.render("Cell")) }) }, cellKey));
|
|
@@ -30,7 +30,7 @@ export interface TableRowProps<T extends DataWithUUID> extends HTMLAttributes<HT
|
|
|
30
30
|
additionalCellClassNames: string;
|
|
31
31
|
toggleComponent?: React.ComponentType<ToggleProps>;
|
|
32
32
|
onRowOverflow?: (rowUuid: string, hasOverflow: boolean) => void;
|
|
33
|
-
expandedCellActionButton?: ReactNode;
|
|
33
|
+
expandedCellActionButton?: ReactNode | ((fullText: string) => ReactNode);
|
|
34
34
|
}
|
|
35
35
|
declare const TableRow: <T extends DataWithUUID>({ row, prepareRow, activeIndex, activeRowColor, rowHoverClasses, rowClassNames, hasInfiniteScroll, rowUuid, onRowClick, expandedCells, toggleCell, hasDropDown, onFetchRowData, loadingIndicator, errorIndicator, expandedContent, expandedRowUuid, cellExpandable, onToggleRow, maxCharacters, cellColor, cellMaxWidthWhenExpanded, additionalCellClassNames, toggleComponent, linkTextClassNames, cellTextClassNames, onRowOverflow, expandedCellActionButton, }: TableRowProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
36
36
|
export default TableRow;
|
|
@@ -102,7 +102,7 @@ const Template = (args) => {
|
|
|
102
102
|
// ── **new** single-row expansion state ──
|
|
103
103
|
const [expandedRowUuid, setExpandedRowUuid] = React.useState(null);
|
|
104
104
|
const onToggleRow = React.useCallback((uuid) => setExpandedRowUuid((prev) => (prev === uuid ? null : uuid)), []);
|
|
105
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { style: { marginBottom: 12 }, children: ["\uD83D\uDEA8 Row overflow?", " ", _jsx("strong", { children: rowHasOverflow ? "YES" : "no" })] }), _jsx("table", { className: "min-w-[700px]", children: _jsx("tbody", { children: _jsx(TableRow, { expandedCellActionButton: _jsx(_Fragment, { children: "test" }), additionalCellClassNames: "", cellColor: "", cellMaxWidthWhenExpanded: 0, row: undefined, prepareRow: function (row) {
|
|
105
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { style: { marginBottom: 12 }, children: ["\uD83D\uDEA8 Row overflow?", " ", _jsx("strong", { children: rowHasOverflow ? "YES" : "no" })] }), _jsx("table", { className: "min-w-[700px]", children: _jsx("tbody", { children: _jsx(TableRow, { expandedCellActionButton: _jsx(_Fragment, { children: "test!!" }), additionalCellClassNames: "", cellColor: "", cellMaxWidthWhenExpanded: 0, row: undefined, prepareRow: function (row) {
|
|
106
106
|
throw new Error("Function not implemented.");
|
|
107
107
|
}, ...args, expandedCells: expandedCells, toggleCell: toggleCell, hasInfiniteScroll: args.hasInfiniteScroll ?? true, onRowClick: args.onRowClick ?? (() => alert("from row")), expandedRowUuid: expandedRowUuid, onToggleRow: onToggleRow, maxCharacters: 30, onRowOverflow: (_uuid, anyOverflow) => {
|
|
108
108
|
console.log("onRowOverflow:", anyOverflow);
|