diff --git a/packages/frontend-core/src/components/grid/controls/DeleteButton.svelte b/packages/frontend-core/src/components/grid/controls/DeleteButton.svelte index 53e0c46883..8ca5f0920d 100644 --- a/packages/frontend-core/src/components/grid/controls/DeleteButton.svelte +++ b/packages/frontend-core/src/components/grid/controls/DeleteButton.svelte @@ -1,8 +1,8 @@ {#if selectedRowCount} diff --git a/packages/frontend-core/src/components/grid/layout/NewRowTop.svelte b/packages/frontend-core/src/components/grid/layout/NewRowTop.svelte index 8643ca6911..4abbf41d24 100644 --- a/packages/frontend-core/src/components/grid/layout/NewRowTop.svelte +++ b/packages/frontend-core/src/components/grid/layout/NewRowTop.svelte @@ -6,6 +6,7 @@ import DataCell from "../cells/DataCell.svelte" import { fade } from "svelte/transition" import { GutterWidth } from "../lib/constants" + import { NewRowID } from "../lib/constants" const { hoveredRowId, @@ -21,10 +22,8 @@ renderedColumns, } = getContext("grid") - const rowId = "new" let isAdding = false let newRow = {} - let touched = false $: firstColumn = $stickyColumn || $renderedColumns[0] $: width = GutterWidth + ($stickyColumn?.width || 0) @@ -66,19 +65,18 @@ document.addEventListener("keydown", handleKeyPress) newRow = {} isAdding = true - $hoveredRowId = rowId + $hoveredRowId = NewRowID if (firstColumn) { - $focusedCellId = `${rowId}-${firstColumn.name}` + $focusedCellId = `${NewRowID}-${firstColumn.name}` } } const updateValue = (rowId, columnName, val) => { - touched = true newRow[columnName] = val } const addViaModal = () => { - isAdding = false + clear() dispatch("add-row") } diff --git a/packages/frontend-core/src/components/grid/lib/constants.js b/packages/frontend-core/src/components/grid/lib/constants.js index e5427106a7..2d059343c1 100644 --- a/packages/frontend-core/src/components/grid/lib/constants.js +++ b/packages/frontend-core/src/components/grid/lib/constants.js @@ -9,3 +9,4 @@ export const SmallRowHeight = 36 export const MediumRowHeight = 64 export const LargeRowHeight = 92 export const DefaultRowHeight = SmallRowHeight +export const NewRowID = "new" diff --git a/packages/frontend-core/src/components/grid/lib/events.js b/packages/frontend-core/src/components/grid/lib/events.js index 1c486858b2..950ed70332 100644 --- a/packages/frontend-core/src/components/grid/lib/events.js +++ b/packages/frontend-core/src/components/grid/lib/events.js @@ -21,7 +21,10 @@ export const createEventManagers = () => { // Return unsubscribe function return () => { + console.log("unsub", event) + console.log(subscribers[event].length) subscribers[event] = subscribers[event].filter(cb => cb !== callback) + console.log(subscribers[event].length) } } diff --git a/packages/frontend-core/src/components/grid/overlays/KeyboardManager.svelte b/packages/frontend-core/src/components/grid/overlays/KeyboardManager.svelte index 4da5cd2c0d..eb034edf2d 100644 --- a/packages/frontend-core/src/components/grid/overlays/KeyboardManager.svelte +++ b/packages/frontend-core/src/components/grid/overlays/KeyboardManager.svelte @@ -1,6 +1,7 @@