Remove leftover usages of inversion params which are no longer needed
This commit is contained in:
parent
0fbbc3c88a
commit
f906bd3dd5
|
@ -8,7 +8,6 @@
|
|||
export let onChange
|
||||
export let readonly = false
|
||||
export let api
|
||||
export let invertX = false
|
||||
export let schema
|
||||
export let maximum
|
||||
|
||||
|
@ -92,13 +91,7 @@
|
|||
</div>
|
||||
|
||||
{#if isOpen}
|
||||
<GridPopover
|
||||
open={isOpen}
|
||||
{anchor}
|
||||
{invertX}
|
||||
maxHeight={null}
|
||||
on:close={close}
|
||||
>
|
||||
<GridPopover open={isOpen} {anchor} maxHeight={null} on:close={close}>
|
||||
<div class="dropzone">
|
||||
<Dropzone
|
||||
{value}
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
export let row
|
||||
export let cellId
|
||||
export let updateValue = rows.actions.updateValue
|
||||
export let invertX = false
|
||||
export let invertY = false
|
||||
export let contentLines = 1
|
||||
export let hidden = false
|
||||
|
||||
|
@ -93,8 +91,6 @@
|
|||
onChange={cellAPI.setValue}
|
||||
{focused}
|
||||
{readonly}
|
||||
{invertY}
|
||||
{invertX}
|
||||
{contentLines}
|
||||
/>
|
||||
<slot />
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
export let focused = false
|
||||
export let readonly = false
|
||||
export let api
|
||||
export let invertX = false
|
||||
|
||||
let isOpen
|
||||
let anchor
|
||||
|
@ -111,7 +110,7 @@
|
|||
</div>
|
||||
|
||||
{#if isOpen}
|
||||
<GridPopover {anchor} {invertX} maxHeight={null} on:close={close}>
|
||||
<GridPopover {anchor} maxHeight={null} on:close={close}>
|
||||
<CoreDatePickerPopoverContents
|
||||
value={parsedValue}
|
||||
useKeyboardShortcuts={false}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
export let onChange
|
||||
export let readonly = false
|
||||
export let api
|
||||
export let invertX = false
|
||||
|
||||
let textarea
|
||||
let isOpen = false
|
||||
|
@ -67,7 +66,7 @@
|
|||
</div>
|
||||
|
||||
{#if isOpen}
|
||||
<GridPopover {anchor} {invertX} on:close={close}>
|
||||
<GridPopover {anchor} on:close={close}>
|
||||
<textarea
|
||||
bind:this={textarea}
|
||||
value={value || ""}
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
export let multi = false
|
||||
export let readonly = false
|
||||
export let api
|
||||
export let invertX
|
||||
export let contentLines = 1
|
||||
|
||||
let isOpen = false
|
||||
|
@ -120,7 +119,7 @@
|
|||
</div>
|
||||
|
||||
{#if isOpen}
|
||||
<GridPopover {anchor} {invertX} on:close={close}>
|
||||
<GridPopover {anchor} on:close={close}>
|
||||
<div class="options">
|
||||
{#each options as option, idx}
|
||||
{@const color = optionColors[option] || getOptionColor(option)}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
export let focused
|
||||
export let schema
|
||||
export let onChange
|
||||
export let invertX = false
|
||||
export let contentLines = 1
|
||||
export let searchFunction = API.searchTable
|
||||
export let primaryDisplay
|
||||
|
@ -275,7 +274,7 @@
|
|||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
{#if isOpen}
|
||||
<GridPopover open={isOpen} {anchor} {invertX} on:close={close}>
|
||||
<GridPopover open={isOpen} {anchor} on:close={close}>
|
||||
<div class="dropdown" on:wheel|stopPropagation>
|
||||
<div class="search">
|
||||
<Input
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
export let onChange
|
||||
export let readonly = false
|
||||
export let api
|
||||
export let invertX = false
|
||||
|
||||
const { API, notifications, props } = getContext("grid")
|
||||
|
||||
|
@ -91,13 +90,7 @@
|
|||
/>
|
||||
|
||||
{#if isOpen}
|
||||
<GridPopover
|
||||
open={isOpen}
|
||||
{anchor}
|
||||
{invertX}
|
||||
maxHeight={null}
|
||||
on:close={close}
|
||||
>
|
||||
<GridPopover open={isOpen} {anchor} maxHeight={null} on:close={close}>
|
||||
<div class="signature" class:empty={!value}>
|
||||
{#if value?.key}
|
||||
<div class="signature-wrap">
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
bounds,
|
||||
renderedRows,
|
||||
visibleColumns,
|
||||
rowVerticalInversionIndex,
|
||||
hoveredRowId,
|
||||
dispatch,
|
||||
isDragging,
|
||||
|
@ -41,11 +40,7 @@
|
|||
<div bind:this={body} class="grid-body">
|
||||
<GridScrollWrapper scrollHorizontally scrollVertically attachHandlers>
|
||||
{#each $renderedRows as row, idx}
|
||||
<GridRow
|
||||
{row}
|
||||
top={idx === 0}
|
||||
invertY={idx >= $rowVerticalInversionIndex}
|
||||
/>
|
||||
<GridRow {row} top={idx === 0} />
|
||||
{/each}
|
||||
{#if $config.canAddRows}
|
||||
<div
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
export let row
|
||||
export let top = false
|
||||
export let invertY = false
|
||||
|
||||
const {
|
||||
focusedCellId,
|
||||
|
@ -15,7 +14,6 @@
|
|||
hoveredRowId,
|
||||
selectedCellMap,
|
||||
focusedRow,
|
||||
columnHorizontalInversionIndex,
|
||||
contentLines,
|
||||
isDragging,
|
||||
dispatch,
|
||||
|
@ -38,15 +36,13 @@
|
|||
on:mouseleave={$isDragging ? null : () => ($hoveredRowId = null)}
|
||||
on:click={() => dispatch("rowclick", rows.actions.cleanRow(row))}
|
||||
>
|
||||
{#each $visibleColumns as column, columnIdx}
|
||||
{#each $visibleColumns as column}
|
||||
{@const cellId = getCellID(row._id, column.name)}
|
||||
<DataCell
|
||||
{cellId}
|
||||
{column}
|
||||
{row}
|
||||
{invertY}
|
||||
{rowFocused}
|
||||
invertX={columnIdx >= $columnHorizontalInversionIndex}
|
||||
highlighted={rowHovered || rowFocused || reorderSource === column.name}
|
||||
selected={rowSelected}
|
||||
rowIdx={row.__idx}
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
rowHeight,
|
||||
hasNextPage,
|
||||
maxScrollTop,
|
||||
rowVerticalInversionIndex,
|
||||
columnHorizontalInversionIndex,
|
||||
selectedRows,
|
||||
loaded,
|
||||
refreshing,
|
||||
|
@ -43,17 +41,9 @@
|
|||
$: firstColumn = $stickyColumn || $visibleColumns[0]
|
||||
$: width = GutterWidth + ($stickyColumn?.width || 0)
|
||||
$: $datasource, (visible = false)
|
||||
$: invertY = shouldInvertY(offset, $rowVerticalInversionIndex, $renderedRows)
|
||||
$: selectedRowCount = Object.values($selectedRows).length
|
||||
$: hasNoRows = !$rows.length
|
||||
|
||||
const shouldInvertY = (offset, inversionIndex, rows) => {
|
||||
if (offset === 0) {
|
||||
return false
|
||||
}
|
||||
return rows.length >= inversionIndex
|
||||
}
|
||||
|
||||
const addRow = async () => {
|
||||
// Blur the active cell and tick to let final value updates propagate
|
||||
isAdding = true
|
||||
|
@ -205,7 +195,6 @@
|
|||
width={$stickyColumn.width}
|
||||
{updateValue}
|
||||
topRow={offset === 0}
|
||||
{invertY}
|
||||
>
|
||||
{#if $stickyColumn?.schema?.autocolumn}
|
||||
<div class="readonly-overlay">Can't edit auto column</div>
|
||||
|
@ -219,7 +208,7 @@
|
|||
<div class="normal-columns" transition:fade|local={{ duration: 130 }}>
|
||||
<GridScrollWrapper scrollHorizontally attachHandlers>
|
||||
<div class="row">
|
||||
{#each $visibleColumns as column, columnIdx}
|
||||
{#each $visibleColumns as column}
|
||||
{@const cellId = `new-${column.name}`}
|
||||
<DataCell
|
||||
{cellId}
|
||||
|
@ -230,8 +219,6 @@
|
|||
focused={$focusedCellId === cellId}
|
||||
width={column.width}
|
||||
topRow={offset === 0}
|
||||
invertX={columnIdx >= $columnHorizontalInversionIndex}
|
||||
{invertY}
|
||||
hidden={!$columnRenderMap[column.name]}
|
||||
>
|
||||
{#if column?.schema?.autocolumn}
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
import { derived } from "svelte/store"
|
||||
import {
|
||||
MaxCellRenderOverflow,
|
||||
MinColumnWidth,
|
||||
ScrollBarSize,
|
||||
} from "../lib/constants"
|
||||
import { MinColumnWidth } from "../lib/constants"
|
||||
|
||||
export const deriveStores = context => {
|
||||
const {
|
||||
|
@ -85,51 +81,10 @@ export const deriveStores = context => {
|
|||
}
|
||||
)
|
||||
|
||||
// Determine the row index at which we should start vertically inverting cell
|
||||
// dropdowns
|
||||
const rowVerticalInversionIndex = derived(
|
||||
[height, rowHeight, scrollTop],
|
||||
([$height, $rowHeight, $scrollTop]) => {
|
||||
const offset = $scrollTop % $rowHeight
|
||||
|
||||
// Compute the last row index with space to render popovers below it
|
||||
const minBottom =
|
||||
$height - ScrollBarSize * 3 - MaxCellRenderOverflow + offset
|
||||
const lastIdx = Math.floor(minBottom / $rowHeight)
|
||||
|
||||
// Compute the first row index with space to render popovers above it
|
||||
const minTop = MaxCellRenderOverflow + offset
|
||||
const firstIdx = Math.ceil(minTop / $rowHeight)
|
||||
|
||||
// Use the greater of the two indices so that we prefer content below,
|
||||
// unless there is room to render the entire popover above
|
||||
return Math.max(lastIdx, firstIdx)
|
||||
}
|
||||
)
|
||||
|
||||
// Determine the column index at which we should start horizontally inverting
|
||||
// cell dropdowns
|
||||
const columnHorizontalInversionIndex = derived(
|
||||
[visibleColumns, scrollLeft, width],
|
||||
([$visibleColumns, $scrollLeft, $width]) => {
|
||||
const cutoff = $width + $scrollLeft - ScrollBarSize * 3
|
||||
let inversionIdx = $visibleColumns.length
|
||||
for (let i = $visibleColumns.length - 1; i >= 0; i--, inversionIdx--) {
|
||||
const rightEdge = $visibleColumns[i].left + $visibleColumns[i].width
|
||||
if (rightEdge + MaxCellRenderOverflow <= cutoff) {
|
||||
break
|
||||
}
|
||||
}
|
||||
return inversionIdx
|
||||
}
|
||||
)
|
||||
|
||||
return {
|
||||
scrolledRowCount,
|
||||
visualRowCapacity,
|
||||
renderedRows,
|
||||
columnRenderMap,
|
||||
rowVerticalInversionIndex,
|
||||
columnHorizontalInversionIndex,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue