Fix a couple of pixel layout issues
This commit is contained in:
parent
975cb867ee
commit
10e64c0573
|
@ -6,12 +6,13 @@
|
||||||
import { createEventDispatcher } from "svelte"
|
import { createEventDispatcher } from "svelte"
|
||||||
|
|
||||||
export let row
|
export let row
|
||||||
export let rowFocused
|
export let rowFocused = false
|
||||||
export let rowHovered
|
export let rowHovered = false
|
||||||
export let rowSelected
|
export let rowSelected = false
|
||||||
export let disableExpand = false
|
export let disableExpand = false
|
||||||
export let disableNumber = false
|
export let disableNumber = false
|
||||||
export let defaultHeight = false
|
export let defaultHeight = false
|
||||||
|
export let disabled = false
|
||||||
|
|
||||||
const { config, dispatch, selectedRows } = getContext("grid")
|
const { config, dispatch, selectedRows } = getContext("grid")
|
||||||
const svelteDispatch = createEventDispatcher()
|
const svelteDispatch = createEventDispatcher()
|
||||||
|
@ -57,7 +58,7 @@
|
||||||
class:visible={$config.allowDeleteRows &&
|
class:visible={$config.allowDeleteRows &&
|
||||||
(disableNumber || rowSelected || rowHovered || rowFocused)}
|
(disableNumber || rowSelected || rowHovered || rowFocused)}
|
||||||
>
|
>
|
||||||
<Checkbox value={rowSelected} />
|
<Checkbox value={rowSelected} {disabled} />
|
||||||
</div>
|
</div>
|
||||||
{#if !disableNumber}
|
{#if !disableNumber}
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -11,9 +11,10 @@
|
||||||
let open = false
|
let open = false
|
||||||
let anchor
|
let anchor
|
||||||
|
|
||||||
$: allSmall = $columns.every(col => col.width === smallSize)
|
$: allCols = $columns.concat($stickyColumn ? [$stickyColumn] : [])
|
||||||
$: allMedium = $columns.every(col => col.width === mediumSize)
|
$: allSmall = allCols.every(col => col.width === smallSize)
|
||||||
$: allLarge = $columns.every(col => col.width === largeSize)
|
$: allMedium = allCols.every(col => col.width === mediumSize)
|
||||||
|
$: allLarge = allCols.every(col => col.width === largeSize)
|
||||||
$: custom = !allSmall && !allMedium && !allLarge
|
$: custom = !allSmall && !allMedium && !allLarge
|
||||||
$: sizeOptions = [
|
$: sizeOptions = [
|
||||||
{
|
{
|
||||||
|
@ -57,6 +58,7 @@
|
||||||
size="M"
|
size="M"
|
||||||
on:click={() => (open = !open)}
|
on:click={() => (open = !open)}
|
||||||
selected={open}
|
selected={open}
|
||||||
|
disabled={!allCols.length}
|
||||||
>
|
>
|
||||||
Width
|
Width
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
|
|
|
@ -87,8 +87,10 @@
|
||||||
...state,
|
...state,
|
||||||
top: $maxScrollTop,
|
top: $maxScrollTop,
|
||||||
}))
|
}))
|
||||||
offset =
|
offset = $renderedRows.length * $rowHeight - ($maxScrollTop % $rowHeight)
|
||||||
$renderedRows.length * $rowHeight - ($maxScrollTop % $rowHeight) - 1
|
if ($renderedRows.length !== 0) {
|
||||||
|
offset -= 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update state and select initial cell
|
// Update state and select initial cell
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
rows,
|
rows,
|
||||||
selectedRows,
|
selectedRows,
|
||||||
stickyColumn,
|
stickyColumn,
|
||||||
|
renderedColumns,
|
||||||
renderedRows,
|
renderedRows,
|
||||||
focusedCellId,
|
focusedCellId,
|
||||||
hoveredRowId,
|
hoveredRowId,
|
||||||
|
@ -51,7 +52,8 @@
|
||||||
disableNumber
|
disableNumber
|
||||||
on:select={selectAll}
|
on:select={selectAll}
|
||||||
defaultHeight
|
defaultHeight
|
||||||
rowSelected={selectedRowCount === rowCount}
|
rowSelected={selectedRowCount && selectedRowCount === rowCount}
|
||||||
|
disabled={!$renderedRows.length}
|
||||||
/>
|
/>
|
||||||
{#if $stickyColumn}
|
{#if $stickyColumn}
|
||||||
<HeaderCell column={$stickyColumn} orderable={false} idx="sticky" />
|
<HeaderCell column={$stickyColumn} orderable={false} idx="sticky" />
|
||||||
|
@ -87,7 +89,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
{#if $config.allowAddRows}
|
{#if $config.allowAddRows && ($renderedColumns.length || $stickyColumn)}
|
||||||
<div
|
<div
|
||||||
class="row new"
|
class="row new"
|
||||||
on:mouseenter={() => ($hoveredRowId = BlankRowID)}
|
on:mouseenter={() => ($hoveredRowId = BlankRowID)}
|
||||||
|
|
Loading…
Reference in New Issue