mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-05 23:54:25 +00:00
fix(webui): fix overlapping rows in virtualized views
This commit is contained in:
@@ -163,7 +163,7 @@ export function FileListItem({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<tr
|
<div
|
||||||
ref={setDraggableRef}
|
ref={setDraggableRef}
|
||||||
style={{ opacity }}
|
style={{ opacity }}
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
@@ -174,11 +174,11 @@ export function FileListItem({
|
|||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
className="group cursor-pointer select-none transition-colors whitespace-nowrap"
|
className="group cursor-pointer select-none transition-colors whitespace-nowrap flex w-full"
|
||||||
>
|
>
|
||||||
<td
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
'px-4 py-2 sticky left-0 z-10 transition-colors border-r',
|
'px-4 py-2 sticky left-0 z-10 transition-colors border-r shrink-0',
|
||||||
isSelected ? 'bg-muted' : 'bg-card group-hover:bg-muted',
|
isSelected ? 'bg-muted' : 'bg-card group-hover:bg-muted',
|
||||||
)}
|
)}
|
||||||
style={{
|
style={{
|
||||||
@@ -232,24 +232,24 @@ export function FileListItem({
|
|||||||
</Badge>
|
</Badge>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</div>
|
||||||
<td
|
<div
|
||||||
className="px-4 py-2 text-sm text-muted-foreground truncate"
|
className="px-4 py-2 text-sm text-muted-foreground truncate border-r shrink-0 flex items-center"
|
||||||
style={{
|
style={{
|
||||||
width: columnSizing?.['size'] || 100,
|
width: columnSizing?.['size'] || 100,
|
||||||
minWidth: columnSizing?.['size'] || 100,
|
minWidth: columnSizing?.['size'] || 100,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{displayItem.type === 'folder' ? '-' : formatSize(displayItem.sizeByte)}
|
{displayItem.type === 'folder' ? '-' : formatSize(displayItem.sizeByte)}
|
||||||
</td>
|
</div>
|
||||||
<td
|
<div
|
||||||
className="px-4 py-2"
|
className="px-4 py-2 border-r shrink-0 flex items-center"
|
||||||
style={{
|
style={{
|
||||||
width: columnSizing?.['modified'] || 200,
|
width: columnSizing?.['modified'] || 200,
|
||||||
minWidth: columnSizing?.['modified'] || 200,
|
minWidth: columnSizing?.['modified'] || 200,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="flex items-center justify-between overflow-hidden">
|
<div className="flex items-center justify-between overflow-hidden w-full">
|
||||||
<span className="text-sm text-muted-foreground truncate">
|
<span className="text-sm text-muted-foreground truncate">
|
||||||
{formatDate(displayItem.updatedAt)}
|
{formatDate(displayItem.updatedAt)}
|
||||||
</span>
|
</span>
|
||||||
@@ -270,12 +270,12 @@ export function FileListItem({
|
|||||||
<MoreVertical className="h-4 w-4 text-muted-foreground hover:text-foreground" />
|
<MoreVertical className="h-4 w-4 text-muted-foreground hover:text-foreground" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</div>
|
||||||
{displayItem.type === 'file' &&
|
{displayItem.type === 'file' &&
|
||||||
fields.map((field) => (
|
fields.map((field) => (
|
||||||
<td
|
<div
|
||||||
key={field.id}
|
key={field.id}
|
||||||
className="px-4 py-2 truncate"
|
className="px-4 py-2 truncate border-r shrink-0 flex items-center"
|
||||||
style={{
|
style={{
|
||||||
width: columnSizing?.[field.id!] || 150,
|
width: columnSizing?.[field.id!] || 150,
|
||||||
minWidth: columnSizing?.[field.id!] || 150,
|
minWidth: columnSizing?.[field.id!] || 150,
|
||||||
@@ -287,8 +287,8 @@ export function FileListItem({
|
|||||||
onSave={canEdit ? (val) => onSaveField(field.id!, val) : undefined}
|
onSave={canEdit ? (val) => onSaveField(field.id!, val) : undefined}
|
||||||
readOnly={field.readOnly || !canEdit}
|
readOnly={field.readOnly || !canEdit}
|
||||||
/>
|
/>
|
||||||
</td>
|
</div>
|
||||||
))}
|
))}
|
||||||
</tr>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -219,6 +219,7 @@ export function FileBrowserGridView({
|
|||||||
<div
|
<div
|
||||||
key={`header-${row.kind}`}
|
key={`header-${row.kind}`}
|
||||||
ref={rowVirtualizer.measureElement}
|
ref={rowVirtualizer.measureElement}
|
||||||
|
data-index={virtualRow.index}
|
||||||
className="absolute top-0 left-0 w-full z-10 bg-background"
|
className="absolute top-0 left-0 w-full z-10 bg-background"
|
||||||
style={{
|
style={{
|
||||||
transform: `translateY(${virtualRow.start}px)`,
|
transform: `translateY(${virtualRow.start}px)`,
|
||||||
@@ -256,6 +257,7 @@ export function FileBrowserGridView({
|
|||||||
<div
|
<div
|
||||||
key={`row-${row.kind}-${row.rowIndex}`}
|
key={`row-${row.kind}-${row.rowIndex}`}
|
||||||
ref={rowVirtualizer.measureElement}
|
ref={rowVirtualizer.measureElement}
|
||||||
|
data-index={virtualRow.index}
|
||||||
className="absolute top-0 left-0 w-full grid gap-4"
|
className="absolute top-0 left-0 w-full grid gap-4"
|
||||||
style={{
|
style={{
|
||||||
transform: `translateY(${virtualRow.start}px)`,
|
transform: `translateY(${virtualRow.start}px)`,
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ function ListRow({
|
|||||||
setRowRef(node)
|
setRowRef(node)
|
||||||
measureElement(node)
|
measureElement(node)
|
||||||
}}
|
}}
|
||||||
|
data-index={virtualRow.index}
|
||||||
className={cn(
|
className={cn(
|
||||||
'group border-b border-border transition-colors hover:bg-primary/20 absolute top-0 left-0 w-full flex flex-col',
|
'group border-b border-border transition-colors hover:bg-primary/20 absolute top-0 left-0 w-full flex flex-col',
|
||||||
isSelected && 'bg-primary/10',
|
isSelected && 'bg-primary/10',
|
||||||
@@ -338,6 +339,7 @@ export function FileBrowserListView({
|
|||||||
<div
|
<div
|
||||||
key={`header-${item.kind}`}
|
key={`header-${item.kind}`}
|
||||||
ref={rowVirtualizer.measureElement}
|
ref={rowVirtualizer.measureElement}
|
||||||
|
data-index={virtualRow.index}
|
||||||
className="absolute top-0 left-0 w-full border-b border-border hover:bg-muted/50 transition-colors cursor-pointer group flex bg-card z-20"
|
className="absolute top-0 left-0 w-full border-b border-border hover:bg-muted/50 transition-colors cursor-pointer group flex bg-card z-20"
|
||||||
style={{
|
style={{
|
||||||
transform: `translateY(${virtualRow.start}px)`,
|
transform: `translateY(${virtualRow.start}px)`,
|
||||||
|
|||||||
Reference in New Issue
Block a user