@tmlmobilidade/ui 20250129.1710.49 → 20250130.2005.29

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/dist/cjs/index.js CHANGED
@@ -1490,14 +1490,20 @@ function DataTableHeader({ columns, }) {
1490
1490
  return null;
1491
1491
  return (jsxRuntimeExports.jsx(ActionIcon, { variant: "muted", children: sortState?.accessor === column.accessor ? (sortState.order === 'asc' ? (jsxRuntimeExports.jsx(iconsReact.IconArrowUpRhombus, { size: 18 })) : sortState.order === 'desc' ? (jsxRuntimeExports.jsx(iconsReact.IconArrowDownRhombus, { size: 18 })) : (jsxRuntimeExports.jsx(iconsReact.IconArrowsUpDown, { size: 18 }))) : (jsxRuntimeExports.jsx(iconsReact.IconArrowsUpDown, { size: 18 })) }));
1492
1492
  };
1493
- return (jsxRuntimeExports.jsx(core.Table.Thead, { className: cn(styles$3.header), children: jsxRuntimeExports.jsx(core.Table.Tr, { className: cn(styles$3.row), children: columns.map((column, idx) => (jsxRuntimeExports.jsx(core.Table.Th, { className: cn(styles$3.cell), children: jsxRuntimeExports.jsxs("div", { className: styles$3.cellContent, onClick: () => column.sortable &&
1493
+ return (jsxRuntimeExports.jsx(core.Table.Thead, { className: cn(styles$3.header), children: jsxRuntimeExports.jsx(core.Table.Tr, { className: cn(styles$3.row), children: columns.map((column, idx) => (jsxRuntimeExports.jsx(core.Table.Th, { className: cn(styles$3.cell), style: {
1494
+ maxWidth: column.width,
1495
+ minWidth: column.width ?? 'max-content',
1496
+ }, children: jsxRuntimeExports.jsxs("div", { className: styles$3.cellContent, onClick: () => column.sortable &&
1494
1497
  handleSort(column.sortKey ?? String(column.accessor)), children: [column.title, column.sortable && renderSortIcon(column)] }) }, idx))) }) }));
1495
1498
  }
1496
1499
 
1497
- var styles$2 = {"row":"styles-module_row__46pHv","cell":"styles-module_cell__Yb-lZ"};
1500
+ var styles$2 = {"row":"styles-module_row__46pHv","cell":"styles-module_cell__Yb-lZ","maxWidth":"styles-module_maxWidth__S-bPz","fullWidth":"styles-module_fullWidth__vNRRx"};
1498
1501
 
1499
- function DataTableRow({ columns, record, }) {
1500
- return (jsxRuntimeExports.jsx(core.Table.Tr, { className: cn(styles$2.row), children: columns.map((column, colIndex) => (jsxRuntimeExports.jsx(core.Table.Td, { className: cn(styles$2.cell), children: column.render
1502
+ function DataTableRow({ columns, record, onRowClick, onRowDoubleClick, onRowContextMenu, }) {
1503
+ return (jsxRuntimeExports.jsx(core.Table.Tr, { className: cn(styles$2.row), onClick: () => onRowClick && onRowClick(record), onDoubleClick: () => onRowDoubleClick && onRowDoubleClick(record), onContextMenu: () => onRowContextMenu && onRowContextMenu(record), children: columns.map((column, colIndex) => (jsxRuntimeExports.jsx(core.Table.Td, { className: cn(styles$2.cell, column.width ? styles$2.maxWidth : styles$2.fullWidth), style: {
1504
+ maxWidth: column.width,
1505
+ minWidth: column.width,
1506
+ }, children: column.render
1501
1507
  ? column.render(record)
1502
1508
  : getValueAtPath(record, column.accessor) === null
1503
1509
  ? null
@@ -1527,14 +1533,14 @@ var styles = {"root":"styles-module_root__AStX6","tableWrapper":"styles-module_t
1527
1533
  function DataTable({ records, ...props }) {
1528
1534
  return (jsxRuntimeExports.jsx(DataTableProvider, { initialRecords: records, searchAccessors: props.search?.accessors ?? [], children: jsxRuntimeExports.jsx(DataTableContent, { ...props }) }));
1529
1535
  }
1530
- function DataTableContent({ classnames, columns, maxHeight, search, title, }) {
1536
+ function DataTableContent({ classnames, columns, maxHeight, search, title, onRowClick, onRowDoubleClick, onRowContextMenu, }) {
1531
1537
  //
1532
1538
  //
1533
1539
  // A. Setup Variables
1534
1540
  const { data } = useDataTableContext();
1535
1541
  //
1536
1542
  // B. Render Components
1537
- return (jsxRuntimeExports.jsxs("div", { className: cn(styles.root, classnames?.root), children: [jsxRuntimeExports.jsx(DataTableTitle, { search: search, title: title ?? '' }), jsxRuntimeExports.jsx("div", { className: cn(styles.tableWrapper, classnames?.tableWrapper), style: { maxHeight: maxHeight || '100%' }, children: jsxRuntimeExports.jsxs(core.Table, { className: cn(styles.table, classnames?.table, 'block'), children: [jsxRuntimeExports.jsx(DataTableHeader, { columns: columns }), jsxRuntimeExports.jsx(core.Table.Tbody, { children: jsxRuntimeExports.jsx(reactViewportList.ViewportList, { itemMargin: 0, items: data.records, children: (record, rowIndex) => (jsxRuntimeExports.jsx(DataTableRow, { columns: columns, record: record }, rowIndex)) }) })] }) })] }));
1543
+ return (jsxRuntimeExports.jsxs("div", { className: cn(styles.root, classnames?.root), children: [jsxRuntimeExports.jsx(DataTableTitle, { search: search, title: title ?? '' }), jsxRuntimeExports.jsx("div", { className: cn(styles.tableWrapper, classnames?.tableWrapper), style: { maxHeight: maxHeight || '100%' }, children: jsxRuntimeExports.jsxs(core.Table, { className: cn(styles.table, classnames?.table, 'block'), children: [jsxRuntimeExports.jsx(DataTableHeader, { columns: columns }), jsxRuntimeExports.jsx(core.Table.Tbody, { children: jsxRuntimeExports.jsx(reactViewportList.ViewportList, { itemMargin: 0, items: data.records, children: (record, rowIndex) => (jsxRuntimeExports.jsx(DataTableRow, { columns: columns, record: record, onRowClick: onRowClick, onRowDoubleClick: onRowDoubleClick, onRowContextMenu: onRowContextMenu }, rowIndex)) }) })] }) })] }));
1538
1544
  }
1539
1545
 
1540
1546
  const MOBILE_BREAKPOINT = parseInt(getCssVariableValue('--breakpoint-mobile') ?? '768');