@ballistix.digital/react-components 9.6.0 → 9.7.1-rc-378.0

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/index.js CHANGED
@@ -3423,6 +3423,8 @@ const $ad4435d9ab2ba956$var$base = {
3423
3423
  expand: '',
3424
3424
  collapse: ''
3425
3425
  },
3426
+ detailRow: '',
3427
+ detailCell: 'p-0',
3426
3428
  checkbox: 'absolute left-4 top-1/2 -mt-2 h-4 w-4 rounded-sm border-gray-300 text-primary-600 focus:ring-primary-500 sm:left-6',
3427
3429
  indicator: 'absolute inset-y-0 left-0 w-0.5 bg-primary-600'
3428
3430
  }
@@ -3447,7 +3449,7 @@ var $ad4435d9ab2ba956$export$2e2bcd8739ae039 = $ad4435d9ab2ba956$var$styles;
3447
3449
 
3448
3450
 
3449
3451
  const $51d5596368acf759$var$TableList2 = (props)=>{
3450
- const { id: id, table: config, head: head, foot: foot, leftSide: leftSide, isLoading: isLoading, onRowClick: onRowClick, onChange: onChange, styles: stylesOverrides, dragConfig: dragConfig } = props;
3452
+ const { id: id, table: config, head: head, foot: foot, leftSide: leftSide, renderSubComponent: renderSubComponent, isLoading: isLoading, onRowClick: onRowClick, onChange: onChange, styles: stylesOverrides, dragConfig: dragConfig } = props;
3451
3453
  const [columnVisibility, setColumnVisibility] = (0, $iA2ta$react.useState)({});
3452
3454
  const [columnOrder, setColumnOrder] = (0, $iA2ta$react.useState)([]);
3453
3455
  const [sorting, setSorting] = (0, $iA2ta$react.useState)(config.options?.defaultSorting ?? []);
@@ -3652,6 +3654,19 @@ const $51d5596368acf759$var$TableList2 = (props)=>{
3652
3654
  ]
3653
3655
  });
3654
3656
  };
3657
+ const renderDetailRow = (row)=>{
3658
+ if (!renderSubComponent || row.getIsGrouped()) return null;
3659
+ const detail = renderSubComponent(row);
3660
+ if (!detail) return null;
3661
+ return (0, $iA2ta$reactjsxruntime.jsx)("tr", {
3662
+ className: styles.body.table.body.detailRow,
3663
+ children: (0, $iA2ta$reactjsxruntime.jsx)("td", {
3664
+ colSpan: row.getVisibleCells().length,
3665
+ className: styles.body.table.body.detailCell,
3666
+ children: detail
3667
+ })
3668
+ });
3669
+ };
3655
3670
  const DraggableRow = ({ row: row, index: index })=>{
3656
3671
  const { transform: transform, transition: transition, setNodeRef: setNodeRef, isDragging: isDragging } = (0, $iA2ta$dndkitsortable.useSortable)({
3657
3672
  id: (0, $iA2ta$lodash.get)(row.original, dragConfig?.rowIdentifierKey)
@@ -3819,42 +3834,52 @@ const $51d5596368acf759$var$TableList2 = (props)=>{
3819
3834
  children: isDraggable ? (0, $iA2ta$reactjsxruntime.jsx)((0, $iA2ta$dndkitsortable.SortableContext), {
3820
3835
  items: (0, $iA2ta$lodash.map)(config.data, (entity)=>(0, $iA2ta$lodash.get)(entity, dragConfig?.rowIdentifierKey)),
3821
3836
  strategy: (0, $iA2ta$dndkitsortable.verticalListSortingStrategy),
3822
- children: (0, $iA2ta$lodash.map)(table?.getRowModel().rows, (row, index)=>(0, $iA2ta$reactjsxruntime.jsx)(DraggableRow, {
3823
- row: row,
3824
- index: index
3837
+ children: (0, $iA2ta$lodash.map)(table?.getRowModel().rows, (row, index)=>(0, $iA2ta$reactjsxruntime.jsxs)((0, ($parcel$interopDefault($iA2ta$react))).Fragment, {
3838
+ children: [
3839
+ (0, $iA2ta$reactjsxruntime.jsx)(DraggableRow, {
3840
+ row: row,
3841
+ index: index
3842
+ }),
3843
+ renderDetailRow(row)
3844
+ ]
3825
3845
  }, (0, $iA2ta$lodash.get)(row.original, dragConfig?.rowIdentifierKey)))
3826
- }) : (0, $iA2ta$lodash.map)(table?.getRowModel().rows, (row, index)=>(0, $iA2ta$reactjsxruntime.jsx)("tr", {
3827
- onClick: ()=>{
3828
- if (onRowClick) onRowClick(row);
3829
- else if (row.getIsGrouped()) row.getToggleExpandedHandler()();
3830
- },
3831
- "data-row-id": row.id,
3832
- className: (0, $622cd2936b18c771$export$4370d69198e9314a)(styles.body.table.body.row, row.getIsGrouped() && styles.body.table.body.groupedRow, config.options?.isStriped && index % 2 === 0 && styles.body.table.body.striped),
3833
- children: (0, $iA2ta$lodash.map)(row.getVisibleCells(), (cell)=>(0, $iA2ta$reactjsxruntime.jsx)("td", {
3834
- "data-column-id": cell.column.id,
3835
- "data-row-id": row.id,
3836
- className: (0, $622cd2936b18c771$export$4370d69198e9314a)(styles.body.table.body.cell, config?.options?.hasStickyHeader && index !== table?.getState()?.pagination?.pageSize - 1 && styles.body.table.body.sticky, cell.column.getIsPinned() && styles.body.table.body.column.pinned.cell),
3837
- style: {
3838
- width: cell.column.getSize(),
3839
- ...getCommonPinningStyles(cell.column)
3846
+ }) : (0, $iA2ta$lodash.map)(table?.getRowModel().rows, (row, index)=>(0, $iA2ta$reactjsxruntime.jsxs)((0, ($parcel$interopDefault($iA2ta$react))).Fragment, {
3847
+ children: [
3848
+ (0, $iA2ta$reactjsxruntime.jsx)("tr", {
3849
+ onClick: ()=>{
3850
+ if (onRowClick) onRowClick(row);
3851
+ else if (row.getIsGrouped()) row.getToggleExpandedHandler()();
3840
3852
  },
3841
- children: cell.getIsGrouped() ? (0, $iA2ta$reactjsxruntime.jsxs)("div", {
3842
- className: styles.body.table.body.groupedCell,
3843
- children: [
3844
- (0, $iA2ta$reactjsxruntime.jsx)((0, $cbf4b156892acb71$export$2e2bcd8739ae039), {
3845
- className: row.getIsExpanded() ? styles.body.table.body.groupedRowIcon.collapse : styles.body.table.body.groupedRowIcon.expand,
3846
- accessor: row.getIsExpanded() ? config?.options?.grouping?.collapseIconAccessor ?? 'chevron-down' : config?.options?.grouping?.expandIconAccessor ?? 'chevron-right'
3847
- }),
3848
- handleFlexRender(cell),
3849
- " (",
3850
- row.subRows.length,
3851
- ")"
3852
- ]
3853
- }) : cell.getIsAggregated() ? // If the cell is aggregated, use the Aggregated
3854
- // renderer for cell
3855
- (0, $iA2ta$tanstackreacttable.flexRender)(cell.column.columnDef.aggregatedCell ?? cell.column.columnDef.cell, cell.getContext()) : cell.getIsPlaceholder() ? null : // Otherwise, just render the regular cell
3856
- (0, $iA2ta$tanstackreacttable.flexRender)(cell.column.columnDef.cell, cell.getContext())
3857
- }, cell.id))
3853
+ "data-row-id": row.id,
3854
+ className: (0, $622cd2936b18c771$export$4370d69198e9314a)(styles.body.table.body.row, row.getIsGrouped() && styles.body.table.body.groupedRow, config.options?.isStriped && index % 2 === 0 && styles.body.table.body.striped),
3855
+ children: (0, $iA2ta$lodash.map)(row.getVisibleCells(), (cell)=>(0, $iA2ta$reactjsxruntime.jsx)("td", {
3856
+ "data-column-id": cell.column.id,
3857
+ "data-row-id": row.id,
3858
+ className: (0, $622cd2936b18c771$export$4370d69198e9314a)(styles.body.table.body.cell, config?.options?.hasStickyHeader && index !== table?.getState()?.pagination?.pageSize - 1 && styles.body.table.body.sticky, cell.column.getIsPinned() && styles.body.table.body.column.pinned.cell),
3859
+ style: {
3860
+ width: cell.column.getSize(),
3861
+ ...getCommonPinningStyles(cell.column)
3862
+ },
3863
+ children: cell.getIsGrouped() ? (0, $iA2ta$reactjsxruntime.jsxs)("div", {
3864
+ className: styles.body.table.body.groupedCell,
3865
+ children: [
3866
+ (0, $iA2ta$reactjsxruntime.jsx)((0, $cbf4b156892acb71$export$2e2bcd8739ae039), {
3867
+ className: row.getIsExpanded() ? styles.body.table.body.groupedRowIcon.collapse : styles.body.table.body.groupedRowIcon.expand,
3868
+ accessor: row.getIsExpanded() ? config?.options?.grouping?.collapseIconAccessor ?? 'chevron-down' : config?.options?.grouping?.expandIconAccessor ?? 'chevron-right'
3869
+ }),
3870
+ handleFlexRender(cell),
3871
+ " (",
3872
+ row.subRows.length,
3873
+ ")"
3874
+ ]
3875
+ }) : cell.getIsAggregated() ? // If the cell is aggregated, use the Aggregated
3876
+ // renderer for cell
3877
+ (0, $iA2ta$tanstackreacttable.flexRender)(cell.column.columnDef.aggregatedCell ?? cell.column.columnDef.cell, cell.getContext()) : cell.getIsPlaceholder() ? null : // Otherwise, just render the regular cell
3878
+ (0, $iA2ta$tanstackreacttable.flexRender)(cell.column.columnDef.cell, cell.getContext())
3879
+ }, cell.id))
3880
+ }),
3881
+ renderDetailRow(row)
3882
+ ]
3858
3883
  }, row.id))
3859
3884
  })
3860
3885
  ]