1
0
Fork 0
mirror of synced 2024-09-20 11:27:56 +12:00

Fix position and styles of button column

This commit is contained in:
Andrew Kingston 2024-06-27 14:37:33 +01:00
parent 38a12ca8fa
commit 97a4c199f0
No known key found for this signature in database

View file

@ -12,7 +12,7 @@
rows,
focusedRow,
selectedRows,
visibleColumns,
scrollableColumns,
scroll,
isDragging,
buttonColumnWidth,
@ -22,12 +22,13 @@
let container
$: buttons = $props.buttons?.slice(0, 3) || []
$: columnsWidth = $visibleColumns.reduce(
$: columnsWidth = $scrollableColumns.reduce(
(total, col) => (total += col.width),
0
)
$: end = columnsWidth - 1 - $scroll.left
$: left = Math.min($width - $buttonColumnWidth, end)
$: columnEnd = columnsWidth - $scroll.left - 1
$: gridEnd = $width - $buttonColumnWidth
$: left = Math.min(columnEnd, gridEnd)
const handleClick = async (button, row) => {
await button.onClick?.(rows.actions.cleanRow(row))
@ -49,6 +50,7 @@
class="button-column"
style="left:{left}px"
class:hidden={$buttonColumnWidth === 0}
class:right-border={left !== gridEnd}
>
<div class="content" on:mouseleave={() => ($hoveredRowId = null)}>
<GridScrollWrapper scrollVertically attachHandlers bind:ref={container}>
@ -134,4 +136,7 @@
.button-column :global(.cell) {
border-left: var(--cell-border);
}
.button-column:not(.right-border) :global(.cell) {
border-right-color: transparent;
}
</style>