Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion react/Table/Virtualized/Dnd/TableRow.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import React, { useEffect } from 'react'
import cx from 'classnames'

import { useDrag, useDrop } from 'react-dnd'
import { getEmptyImage } from 'react-dnd-html5-backend'

Expand All @@ -20,6 +22,7 @@ const TableRow = ({ item, context, componentsProps, ...props }) => {
const isSelected = context?.isSelectedItem(item)
const isDisabled =
itemsInDropProcess.includes(item._id) || componentsProps?.tableRow?.disabled
const isNew = context?.isNewItem?.(item)

const [dragCollect, dragRef, dragRefPreview] = useDrag(
() => ({
Expand Down Expand Up @@ -85,7 +88,10 @@ const TableRow = ({ item, context, componentsProps, ...props }) => {
{...props}
ref={node => dragRef(dropRef(node))}
selected={isSelected || dropCollect.isOver}
className={dragCollect.isDragging ? 'virtualized u-o-50' : 'virtualized'}
className={cx(
dragCollect.isDragging ? 'virtualized u-o-50' : 'virtualized',
isNew ? 'u-bg-primaryColorLight' : ''
Copy link
Collaborator

@JF-Cozy JF-Cozy Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

be careful we don't use u-classes to change color anymore, don't know if they are still relevant. For now I recommand to avoid this while someone didn't take a deep look on it.. For example it's not compliant with dark mode, see #2867 (comment)

)}
disabled={isDisabled}
hover
/>
Expand Down
8 changes: 6 additions & 2 deletions react/Table/Virtualized/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const VirtualizedTable = forwardRef(
context,
components,
onSortChange,
isNewItem,
...props
},
ref
Expand All @@ -43,7 +44,8 @@ const VirtualizedTable = forwardRef(
...context,
...(isGroupedTable && { data }), // we use directly `data` prop if no groupCounts
isSelectedItem,
selectedItems
selectedItems,
isNewItem
}

const handleSort = property => {
Expand Down Expand Up @@ -141,7 +143,9 @@ VirtualizedTable.propTypes = {
/** Function to determine if a row is selected */
isSelectedItem: PropTypes.func,
/** Callback called after the sort */
onSortChange: PropTypes.func
onSortChange: PropTypes.func,
/** Function to determine if a row is new */
isNewItem: PropTypes.func
}

export default VirtualizedTable
Loading