From 6ea86b1b56aebbae7edeb37b01d7bf5cd145bf60 Mon Sep 17 00:00:00 2001 From: Josh Kingsley Date: Thu, 6 Nov 2025 22:31:12 +0200 Subject: feat(web): change subvisions --- web/src/components/grid/index.ts | 11 ++++++++++- web/src/components/grid/selection.ts | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'web/src/components/grid') diff --git a/web/src/components/grid/index.ts b/web/src/components/grid/index.ts index 78bb14e..3189409 100644 --- a/web/src/components/grid/index.ts +++ b/web/src/components/grid/index.ts @@ -12,7 +12,16 @@ import { extendSelection, GridSelection } from "./selection"; export class NotiveGridElement extends NotiveElement { #internals: ElementInternals = this.attachInternals(); - grid?: RenderedGrid; + #grid?: RenderedGrid; + + get grid(): RenderedGrid | undefined { + return this.#grid; + } + + set grid(grid: RenderedGrid | undefined) { + this.#grid = grid; + this.draw(); + } #selection?: GridSelection; diff --git a/web/src/components/grid/selection.ts b/web/src/components/grid/selection.ts index a24bbf5..517f8ae 100644 --- a/web/src/components/grid/selection.ts +++ b/web/src/components/grid/selection.ts @@ -1,4 +1,5 @@ import { CellRef, cellRefEquals } from "../../types"; +import { RenderedGrid } from "./renderGrid"; export type CellRange = [start: CellRef, end: CellRef]; @@ -21,3 +22,7 @@ export function extendSelection( return { ...selection, range: [selection.activeCellRef, cellRef] }; } + +export function getSelectionRange(selection: GridSelection): CellRange { + return selection.range ?? [selection.activeCellRef, selection.activeCellRef]; +} -- cgit v1.2.3