diff --git a/packages/builder/src/components/backend/DataTable/buttons/ManageAccessButton.svelte b/packages/builder/src/components/backend/DataTable/buttons/ManageAccessButton.svelte index 4d5faca4c6..bc8e0c5318 100644 --- a/packages/builder/src/components/backend/DataTable/buttons/ManageAccessButton.svelte +++ b/packages/builder/src/components/backend/DataTable/buttons/ManageAccessButton.svelte @@ -16,7 +16,7 @@ - Manage access + Access - Create view + Add view diff --git a/packages/frontend-core/src/components/grid/cells/DataCell.svelte b/packages/frontend-core/src/components/grid/cells/DataCell.svelte index f205c0a74a..c41b015cf0 100644 --- a/packages/frontend-core/src/components/grid/cells/DataCell.svelte +++ b/packages/frontend-core/src/components/grid/cells/DataCell.svelte @@ -27,6 +27,12 @@ // Get the error for this cell if the row is focused $: error = getErrorStore(rowFocused, cellId) + $: { + if ($error) { + console.log(cellId, $error) + } + } + // Determine if the cell is editable $: readonly = column.schema.autocolumn || diff --git a/packages/frontend-core/src/components/grid/cells/GutterCell.svelte b/packages/frontend-core/src/components/grid/cells/GutterCell.svelte new file mode 100644 index 0000000000..b5c3afc03b --- /dev/null +++ b/packages/frontend-core/src/components/grid/cells/GutterCell.svelte @@ -0,0 +1,119 @@ + + + +
+ {#if $$slots.default} + + {:else} +
+ +
+ {#if !disableNumber} +
+ {row.__idx + 1} +
+ {/if} + {/if} + {#if $config.allowExpandRows} +
+ +
+ {/if} +
+
+ + diff --git a/packages/frontend-core/src/components/grid/controls/AddColumnButton.svelte b/packages/frontend-core/src/components/grid/controls/AddColumnButton.svelte index e04c1ee627..6ad241eb65 100644 --- a/packages/frontend-core/src/components/grid/controls/AddColumnButton.svelte +++ b/packages/frontend-core/src/components/grid/controls/AddColumnButton.svelte @@ -12,5 +12,5 @@ on:click={() => dispatch("add-column")} disabled={!$config.allowAddColumns} > - Create column + Add column diff --git a/packages/frontend-core/src/components/grid/controls/AddRowButton.svelte b/packages/frontend-core/src/components/grid/controls/AddRowButton.svelte index 3545cbbeed..71062d6a1a 100644 --- a/packages/frontend-core/src/components/grid/controls/AddRowButton.svelte +++ b/packages/frontend-core/src/components/grid/controls/AddRowButton.svelte @@ -14,5 +14,5 @@ !$config.allowAddRows || (!$columns.length && !$stickyColumn)} > - Create row + Add row diff --git a/packages/frontend-core/src/components/grid/controls/ColumnWidthButton.svelte b/packages/frontend-core/src/components/grid/controls/ColumnWidthButton.svelte index d5f82957f4..9a4638efdf 100644 --- a/packages/frontend-core/src/components/grid/controls/ColumnWidthButton.svelte +++ b/packages/frontend-core/src/components/grid/controls/ColumnWidthButton.svelte @@ -52,13 +52,13 @@
(open = !open)} selected={open} > - Column width + Width
diff --git a/packages/frontend-core/src/components/grid/controls/HideColumnsButton.svelte b/packages/frontend-core/src/components/grid/controls/HideColumnsButton.svelte index 6c9d1be8ac..7d7c4664b6 100644 --- a/packages/frontend-core/src/components/grid/controls/HideColumnsButton.svelte +++ b/packages/frontend-core/src/components/grid/controls/HideColumnsButton.svelte @@ -48,7 +48,7 @@ selected={open || anyHidden} disabled={!$columns.length} > - Hide columns + Columns diff --git a/packages/frontend-core/src/components/grid/controls/RowHeightButton.svelte b/packages/frontend-core/src/components/grid/controls/RowHeightButton.svelte index 0fcbbed089..e9045ac5c7 100644 --- a/packages/frontend-core/src/components/grid/controls/RowHeightButton.svelte +++ b/packages/frontend-core/src/components/grid/controls/RowHeightButton.svelte @@ -36,13 +36,13 @@
(open = !open)} selected={open} > - Row height + Height
diff --git a/packages/frontend-core/src/components/grid/layout/GridBody.svelte b/packages/frontend-core/src/components/grid/layout/GridBody.svelte index 5c61fde3ef..ba7bde0724 100644 --- a/packages/frontend-core/src/components/grid/layout/GridBody.svelte +++ b/packages/frontend-core/src/components/grid/layout/GridBody.svelte @@ -2,11 +2,25 @@ import { getContext, onMount } from "svelte" import GridScrollWrapper from "./GridScrollWrapper.svelte" import GridRow from "./GridRow.svelte" + import { BlankRowID } from "../lib/constants" - const { bounds, renderedRows, rowVerticalInversionIndex } = getContext("grid") + const { + bounds, + renderedRows, + renderedColumns, + rowVerticalInversionIndex, + config, + hoveredRowId, + dispatch, + } = getContext("grid") let body + $: renderColumnsWidth = $renderedColumns.reduce( + (total, col) => (total += col.width), + 0 + ) + onMount(() => { // Observe and record the height of the body const observer = new ResizeObserver(() => { @@ -24,6 +38,16 @@ {#each $renderedRows as row, idx} = $rowVerticalInversionIndex} /> {/each} + {#if $config.allowAddRows} +
($hoveredRowId = BlankRowID)} + on:mouseleave={() => ($hoveredRowId = null)} + on:click={() => dispatch("add-row-inline", true)} + /> + {/if}
@@ -35,4 +59,15 @@ overflow: hidden; flex: 1 1 auto; } + .blank { + height: var(--row-height); + background: var(--cell-background); + border-bottom: var(--cell-border); + border-right: var(--cell-border); + position: absolute; + } + .blank.highlighted { + background: var(--cell-background-hover); + cursor: pointer; + } diff --git a/packages/frontend-core/src/components/grid/layout/NewRow.svelte b/packages/frontend-core/src/components/grid/layout/NewRow.svelte deleted file mode 100644 index a40104b8d2..0000000000 --- a/packages/frontend-core/src/components/grid/layout/NewRow.svelte +++ /dev/null @@ -1,228 +0,0 @@ - - - -
($hoveredRowId = rowId)} - on:mouseleave={() => ($hoveredRowId = null)} -> -
- -
-
- -
- {#if $config.allowExpandRows} -
- -
- {/if} -
-
- {#if $stickyColumn} - {@const cellId = `${rowId}-${$stickyColumn.name}`} - - {/if} -
- -
- {#each $renderedColumns as column} - {@const cellId = `${rowId}-${column.name}`} - {#key cellId} - - {/key} - {/each} -
-
- {#if Object.keys(newRow || {}).length > 1} -
- - -
- {/if} -
- - diff --git a/packages/frontend-core/src/components/grid/layout/NewRowBottom.svelte b/packages/frontend-core/src/components/grid/layout/NewRowBottom.svelte deleted file mode 100644 index 709b7674c8..0000000000 --- a/packages/frontend-core/src/components/grid/layout/NewRowBottom.svelte +++ /dev/null @@ -1,25 +0,0 @@ - - -
- -
- - diff --git a/packages/frontend-core/src/components/grid/layout/StickyColumn.svelte b/packages/frontend-core/src/components/grid/layout/StickyColumn.svelte index cbf74a0d22..02e962e8b1 100644 --- a/packages/frontend-core/src/components/grid/layout/StickyColumn.svelte +++ b/packages/frontend-core/src/components/grid/layout/StickyColumn.svelte @@ -1,11 +1,12 @@
0} >
- -
-
- {#if $config.allowDeleteRows} -
- -
- {/if} -
- {#if $config.allowExpandRows} -
- -
- {/if} -
-
- + {#if $stickyColumn} {/if} @@ -95,41 +64,7 @@ on:mouseenter={() => ($hoveredRowId = row._id)} on:mouseleave={() => ($hoveredRowId = null)} > - -
-
selectRow(row._id)} - class="checkbox" - class:visible={$config.allowDeleteRows && - (rowSelected || rowHovered || rowFocused)} - > - -
-
- {row.__idx + 1} -
- {#if $config.allowExpandRows} -
- { - dispatch("edit-row", row) - }} - /> -
- {/if} -
-
+ {#if $stickyColumn} {/each} + {#if $config.allowAddRows} +
($hoveredRowId = BlankRowID)} + on:mouseleave={() => ($hoveredRowId = null)} + on:click={() => dispatch("add-row-inline", true)} + > + + + + {#if $stickyColumn} + + {/if} +
+ {/if}
@@ -203,43 +156,7 @@ position: relative; flex: 1 1 auto; } - - /* Styles for gutter */ - .gutter { - flex: 1 1 auto; - display: grid; - align-items: center; - padding: var(--cell-padding); - grid-template-columns: 1fr auto; - gap: var(--cell-spacing); - } - .checkbox, - .number { - display: none; - flex-direction: row; - justify-content: center; - align-items: center; - } - .checkbox :global(.spectrum-Checkbox) { - min-height: 0; - height: 20px; - } - .checkbox :global(.spectrum-Checkbox-box) { - margin: 3px 0 0 0; - } - .number { - color: var(--spectrum-global-color-gray-500); - } - .checkbox.visible, - .number.visible { - display: flex; - } - .expand { - opacity: 0; - pointer-events: none; - } - .expand.visible { - opacity: 1; - pointer-events: all; + .row.new :global(*:hover) { + cursor: pointer; } diff --git a/packages/frontend-core/src/components/grid/lib/constants.js b/packages/frontend-core/src/components/grid/lib/constants.js index cfca89b2b6..86590c0562 100644 --- a/packages/frontend-core/src/components/grid/lib/constants.js +++ b/packages/frontend-core/src/components/grid/lib/constants.js @@ -10,3 +10,4 @@ export const MediumRowHeight = 64 export const LargeRowHeight = 92 export const DefaultRowHeight = SmallRowHeight export const NewRowID = "new" +export const BlankRowID = "blank" diff --git a/packages/frontend-core/src/components/grid/stores/viewport.js b/packages/frontend-core/src/components/grid/stores/viewport.js index 87a10a0330..bda56dc34f 100644 --- a/packages/frontend-core/src/components/grid/stores/viewport.js +++ b/packages/frontend-core/src/components/grid/stores/viewport.js @@ -75,6 +75,8 @@ export const deriveStores = context => { leftEdge += $visibleColumns[endColIdx].width endColIdx++ } + // Render an additional column on either side to account for + // debounce column updates based on scroll position const next = $visibleColumns.slice( Math.max(0, startColIdx - 1), endColIdx + 1