Merge branch 'master' into BUDI-8281/update-view-column-ui
This commit is contained in:
commit
60aa9e48d6
|
@ -16,9 +16,10 @@
|
||||||
scroll,
|
scroll,
|
||||||
isDragging,
|
isDragging,
|
||||||
buttonColumnWidth,
|
buttonColumnWidth,
|
||||||
|
showVScrollbar,
|
||||||
} = getContext("grid")
|
} = getContext("grid")
|
||||||
|
|
||||||
let measureContainer
|
let container
|
||||||
|
|
||||||
$: buttons = $props.buttons?.slice(0, 3) || []
|
$: buttons = $props.buttons?.slice(0, 3) || []
|
||||||
$: columnsWidth = $visibleColumns.reduce(
|
$: columnsWidth = $visibleColumns.reduce(
|
||||||
|
@ -39,7 +40,7 @@
|
||||||
const width = entries?.[0]?.contentRect?.width ?? 0
|
const width = entries?.[0]?.contentRect?.width ?? 0
|
||||||
buttonColumnWidth.set(width)
|
buttonColumnWidth.set(width)
|
||||||
})
|
})
|
||||||
observer.observe(measureContainer)
|
observer.observe(container)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -50,7 +51,7 @@
|
||||||
class:hidden={$buttonColumnWidth === 0}
|
class:hidden={$buttonColumnWidth === 0}
|
||||||
>
|
>
|
||||||
<div class="content" on:mouseleave={() => ($hoveredRowId = null)}>
|
<div class="content" on:mouseleave={() => ($hoveredRowId = null)}>
|
||||||
<GridScrollWrapper scrollVertically attachHandlers>
|
<GridScrollWrapper scrollVertically attachHandlers bind:ref={container}>
|
||||||
{#each $renderedRows as row}
|
{#each $renderedRows as row}
|
||||||
{@const rowSelected = !!$selectedRows[row._id]}
|
{@const rowSelected = !!$selectedRows[row._id]}
|
||||||
{@const rowHovered = $hoveredRowId === row._id}
|
{@const rowHovered = $hoveredRowId === row._id}
|
||||||
|
@ -59,7 +60,6 @@
|
||||||
class="row"
|
class="row"
|
||||||
on:mouseenter={$isDragging ? null : () => ($hoveredRowId = row._id)}
|
on:mouseenter={$isDragging ? null : () => ($hoveredRowId = row._id)}
|
||||||
on:mouseleave={$isDragging ? null : () => ($hoveredRowId = null)}
|
on:mouseleave={$isDragging ? null : () => ($hoveredRowId = null)}
|
||||||
bind:this={measureContainer}
|
|
||||||
>
|
>
|
||||||
<GridCell
|
<GridCell
|
||||||
width="auto"
|
width="auto"
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
selected={rowSelected}
|
selected={rowSelected}
|
||||||
highlighted={rowHovered || rowFocused}
|
highlighted={rowHovered || rowFocused}
|
||||||
>
|
>
|
||||||
<div class="buttons">
|
<div class="buttons" class:offset={$showVScrollbar}>
|
||||||
{#each buttons as button}
|
{#each buttons as button}
|
||||||
<Button
|
<Button
|
||||||
newStyles
|
newStyles
|
||||||
|
@ -121,6 +121,9 @@
|
||||||
gap: var(--cell-padding);
|
gap: var(--cell-padding);
|
||||||
height: inherit;
|
height: inherit;
|
||||||
}
|
}
|
||||||
|
.buttons.offset {
|
||||||
|
padding-right: calc(var(--cell-padding) + 2 * var(--scroll-bar-size) - 2px);
|
||||||
|
}
|
||||||
.buttons :global(.spectrum-Button-Label) {
|
.buttons :global(.spectrum-Button-Label) {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
Padding,
|
Padding,
|
||||||
SmallRowHeight,
|
SmallRowHeight,
|
||||||
ControlsHeight,
|
ControlsHeight,
|
||||||
|
ScrollBarSize,
|
||||||
} from "../lib/constants"
|
} from "../lib/constants"
|
||||||
|
|
||||||
export let API = null
|
export let API = null
|
||||||
|
@ -145,7 +146,7 @@
|
||||||
class:quiet
|
class:quiet
|
||||||
on:mouseenter={() => gridFocused.set(true)}
|
on:mouseenter={() => gridFocused.set(true)}
|
||||||
on:mouseleave={() => gridFocused.set(false)}
|
on:mouseleave={() => gridFocused.set(false)}
|
||||||
style="--row-height:{$rowHeight}px; --default-row-height:{DefaultRowHeight}px; --gutter-width:{GutterWidth}px; --max-cell-render-overflow:{MaxCellRenderOverflow}px; --content-lines:{$contentLines}; --min-height:{$minHeight}px; --controls-height:{ControlsHeight}px;"
|
style="--row-height:{$rowHeight}px; --default-row-height:{DefaultRowHeight}px; --gutter-width:{GutterWidth}px; --max-cell-render-overflow:{MaxCellRenderOverflow}px; --content-lines:{$contentLines}; --min-height:{$minHeight}px; --controls-height:{ControlsHeight}px; --scroll-bar-size:{ScrollBarSize}px;"
|
||||||
>
|
>
|
||||||
{#if showControls}
|
{#if showControls}
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
export let scrollVertically = false
|
export let scrollVertically = false
|
||||||
export let scrollHorizontally = false
|
export let scrollHorizontally = false
|
||||||
export let attachHandlers = false
|
export let attachHandlers = false
|
||||||
|
export let ref
|
||||||
|
|
||||||
// Used for tracking touch events
|
// Used for tracking touch events
|
||||||
let initialTouchX
|
let initialTouchX
|
||||||
|
@ -109,7 +110,7 @@
|
||||||
on:touchmove={attachHandlers ? handleTouchMove : null}
|
on:touchmove={attachHandlers ? handleTouchMove : null}
|
||||||
on:click|self={() => ($focusedCellId = null)}
|
on:click|self={() => ($focusedCellId = null)}
|
||||||
>
|
>
|
||||||
<div {style} class="inner">
|
<div {style} class="inner" bind:this={ref}>
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -119,7 +119,7 @@
|
||||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||||
<div
|
<div
|
||||||
class="v-scrollbar"
|
class="v-scrollbar"
|
||||||
style="--size:{ScrollBarSize}px; top:{barTop}px; height:{barHeight}px;"
|
style="top:{barTop}px; height:{barHeight}px;"
|
||||||
on:mousedown={startVDragging}
|
on:mousedown={startVDragging}
|
||||||
on:touchstart={startVDragging}
|
on:touchstart={startVDragging}
|
||||||
class:dragging={isDraggingV}
|
class:dragging={isDraggingV}
|
||||||
|
@ -129,7 +129,7 @@
|
||||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||||
<div
|
<div
|
||||||
class="h-scrollbar"
|
class="h-scrollbar"
|
||||||
style="--size:{ScrollBarSize}px; left:{barLeft}px; width:{barWidth}px;"
|
style="left:{barLeft}px; width:{barWidth}px;"
|
||||||
on:mousedown={startHDragging}
|
on:mousedown={startHDragging}
|
||||||
on:touchstart={startHDragging}
|
on:touchstart={startHDragging}
|
||||||
class:dragging={isDraggingH}
|
class:dragging={isDraggingH}
|
||||||
|
@ -149,11 +149,11 @@
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
.v-scrollbar {
|
.v-scrollbar {
|
||||||
width: var(--size);
|
width: var(--scroll-bar-size);
|
||||||
right: var(--size);
|
right: var(--scroll-bar-size);
|
||||||
}
|
}
|
||||||
.h-scrollbar {
|
.h-scrollbar {
|
||||||
height: var(--size);
|
height: var(--scroll-bar-size);
|
||||||
bottom: var(--size);
|
bottom: var(--scroll-bar-size);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -109,6 +109,7 @@ export const initialise = context => {
|
||||||
maxScrollTop,
|
maxScrollTop,
|
||||||
scrollLeft,
|
scrollLeft,
|
||||||
maxScrollLeft,
|
maxScrollLeft,
|
||||||
|
buttonColumnWidth,
|
||||||
} = context
|
} = context
|
||||||
|
|
||||||
// Ensure scroll state never goes invalid, which can happen when changing
|
// Ensure scroll state never goes invalid, which can happen when changing
|
||||||
|
@ -194,8 +195,10 @@ export const initialise = context => {
|
||||||
|
|
||||||
// Ensure column is not cutoff on right edge
|
// Ensure column is not cutoff on right edge
|
||||||
else {
|
else {
|
||||||
|
const $buttonColumnWidth = get(buttonColumnWidth)
|
||||||
const rightEdge = column.left + column.width
|
const rightEdge = column.left + column.width
|
||||||
const rightBound = $bounds.width + $scroll.left - FocusedCellMinOffset
|
const rightBound =
|
||||||
|
$bounds.width + $scroll.left - FocusedCellMinOffset - $buttonColumnWidth
|
||||||
delta = rightEdge - rightBound
|
delta = rightEdge - rightBound
|
||||||
if (delta > 0) {
|
if (delta > 0) {
|
||||||
scroll.update(state => ({
|
scroll.update(state => ({
|
||||||
|
|
Loading…
Reference in New Issue