1
0
Fork 0
mirror of synced 2024-07-07 07:15:43 +12:00

Improve gutter cell usage

This commit is contained in:
Andrew Kingston 2023-04-24 11:36:48 +01:00
parent 5155727b56
commit 98430138fe
3 changed files with 14 additions and 12 deletions

View file

@ -11,6 +11,7 @@
export let rowSelected
export let disableExpand = false
export let disableNumber = false
export let defaultHeight = false
const { config, dispatch, selectedRows } = getContext("grid")
const svelteDispatch = createEventDispatcher()
@ -44,6 +45,7 @@
width={GutterWidth}
highlighted={rowFocused || rowHovered}
selected={rowSelected}
{defaultHeight}
>
<div class="gutter">
{#if $$slots.default}
@ -111,6 +113,7 @@
.expand {
opacity: 0;
pointer-events: none;
margin-right: 4px;
}
.expand.visible {
opacity: 1;

View file

@ -7,6 +7,7 @@
import { fade } from "svelte/transition"
import { GutterWidth } from "../lib/constants"
import { NewRowID } from "../lib/constants"
import GutterCell from "../cells/GutterCell.svelte"
const {
hoveredRowId,
@ -116,16 +117,9 @@
transition:fade={{ duration: 130 }}
style="flex: 0 0 {width}px"
>
<GridCell width={GutterWidth} rowFocused>
<div class="gutter">
<div class="number">
<Icon name="Add" />
</div>
{#if $config.allowExpandRows}
<Icon name="Maximize" size="S" hoverable on:click={addViaModal} />
{/if}
</div>
</GridCell>
<GutterCell on:expand={addViaModal} rowHovered>
<Icon name="Add" />
</GutterCell>
{#if $stickyColumn}
{@const cellId = `new-${$stickyColumn.name}`}
<DataCell
@ -178,7 +172,7 @@
align-items: stretch;
}
.container :global(.cell) {
--cell-background: var(--spectrum-global-color-gray-75);
--cell-background: var(--spectrum-global-color-gray-75) !important;
}
/* Underlay sits behind everything */

View file

@ -46,7 +46,12 @@
class:scrolled={$scrollLeft > 0}
>
<div class="header row">
<GutterCell disableExpand disableNumber on:select={selectAll} />
<GutterCell
disableExpand
disableNumber
on:select={selectAll}
defaultHeight
/>
{#if $stickyColumn}
<HeaderCell column={$stickyColumn} orderable={false} idx="sticky" />
{/if}