@agilant/toga-blox 1.0.218 → 1.0.219

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.
@@ -40,7 +40,9 @@ const TableCell = ({ cell, isLastCell, expanded, onToggle, maxCharacters = DEFAU
40
40
  }, [needsToggle, onCellOverflow]);
41
41
  return (_jsx("td", { ...safeCellProps, className: isStickyColumn ? undefined : isLastCell ? "" : baseTd, children: _jsx("div", { className: wrapper, 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: expandedCellActionButton }), _jsx("span", { onClick: (e) => {
43
+ }, children: [_jsx("span", { className: `text-left pr-5 ${cellTextClassNames}`, children: fullText }), _jsx("span", { children: typeof expandedCellActionButton === "function"
44
+ ? expandedCellActionButton(fullText)
45
+ : expandedCellActionButton }), _jsx("span", { onClick: (e) => {
44
46
  e.stopPropagation();
45
47
  onToggle();
46
48
  }, className: linkTextClassNames, children: "Show less" })] }))) : (cell.render("Cell")) }) }, cellKey));
@@ -37,5 +37,5 @@ export interface TableCellProps {
37
37
  linkTextClassNames?: string;
38
38
  cellTextClassNames: string;
39
39
  onCellOverflow?: (isOverflowing: boolean) => void;
40
- expandedCellActionButton?: ReactNode;
40
+ expandedCellActionButton?: ReactNode | ((fullText: string) => ReactNode);
41
41
  }
@@ -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;
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;
@@ -4,6 +4,7 @@ import { Fragment, useState, useCallback, } from "react";
4
4
  import { motion, AnimatePresence } from "framer-motion";
5
5
  import TableCell from "../TableCell";
6
6
  const TableRow = ({ row, prepareRow, activeIndex, activeRowColor = "bg-pink-100", rowHoverClasses = "hover:bg-navy-100 hover:cursor-pointer", rowClassNames = "", hasInfiniteScroll, rowUuid, onRowClick, expandedCells, toggleCell, hasDropDown = false, onFetchRowData, loadingIndicator, errorIndicator, expandedContent, expandedRowUuid = null, cellExpandable = false, onToggleRow, maxCharacters = 30, cellColor = "bg-blue-50", cellMaxWidthWhenExpanded = 50, additionalCellClassNames = "", toggleComponent = undefined, linkTextClassNames = "", cellTextClassNames = "", onRowOverflow = () => { }, expandedCellActionButton = (_jsx("span", { className: "text-blue-500", children: "Action button here" })), }) => {
7
+ prepareRow(row);
7
8
  prepareRow(row);
8
9
  const rowClasses = `border-primary${activeIndex === row.index ? ` activeRow ${activeRowColor}` : ""}`;
9
10
  const [overflowMap, setOverflowMap] = useState({});
@@ -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: "", 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);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agilant/toga-blox",
3
3
  "private": false,
4
- "version": "1.0.218",
4
+ "version": "1.0.219",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",