Fix a couple of pixel layout issues

This commit is contained in:
Andrew Kingston 2023-04-24 16:23:47 +01:00
parent 975cb867ee
commit 10e64c0573
4 changed files with 18 additions and 11 deletions

View File

@ -6,12 +6,13 @@
import { createEventDispatcher } from "svelte"
export let row
export let rowFocused
export let rowHovered
export let rowSelected
export let rowFocused = false
export let rowHovered = false
export let rowSelected = false
export let disableExpand = false
export let disableNumber = false
export let defaultHeight = false
export let disabled = false
const { config, dispatch, selectedRows } = getContext("grid")
const svelteDispatch = createEventDispatcher()
@ -57,7 +58,7 @@
class:visible={$config.allowDeleteRows &&
(disableNumber || rowSelected || rowHovered || rowFocused)}
>
<Checkbox value={rowSelected} />
<Checkbox value={rowSelected} {disabled} />
</div>
{#if !disableNumber}
<div

View File

@ -11,9 +11,10 @@
let open = false
let anchor
$: allSmall = $columns.every(col => col.width === smallSize)
$: allMedium = $columns.every(col => col.width === mediumSize)
$: allLarge = $columns.every(col => col.width === largeSize)
$: allCols = $columns.concat($stickyColumn ? [$stickyColumn] : [])
$: allSmall = allCols.every(col => col.width === smallSize)
$: allMedium = allCols.every(col => col.width === mediumSize)
$: allLarge = allCols.every(col => col.width === largeSize)
$: custom = !allSmall && !allMedium && !allLarge
$: sizeOptions = [
{
@ -57,6 +58,7 @@
size="M"
on:click={() => (open = !open)}
selected={open}
disabled={!allCols.length}
>
Width
</ActionButton>

View File

@ -87,8 +87,10 @@
...state,
top: $maxScrollTop,
}))
offset =
$renderedRows.length * $rowHeight - ($maxScrollTop % $rowHeight) - 1
offset = $renderedRows.length * $rowHeight - ($maxScrollTop % $rowHeight)
if ($renderedRows.length !== 0) {
offset -= 1
}
}
// Update state and select initial cell

View File

@ -12,6 +12,7 @@
rows,
selectedRows,
stickyColumn,
renderedColumns,
renderedRows,
focusedCellId,
hoveredRowId,
@ -51,7 +52,8 @@
disableNumber
on:select={selectAll}
defaultHeight
rowSelected={selectedRowCount === rowCount}
rowSelected={selectedRowCount && selectedRowCount === rowCount}
disabled={!$renderedRows.length}
/>
{#if $stickyColumn}
<HeaderCell column={$stickyColumn} orderable={false} idx="sticky" />
@ -87,7 +89,7 @@
{/if}
</div>
{/each}
{#if $config.allowAddRows}
{#if $config.allowAddRows && ($renderedColumns.length || $stickyColumn)}
<div
class="row new"
on:mouseenter={() => ($hoveredRowId = BlankRowID)}