feat(dashboard): BulkEditor Boolean cell behaviour (#8418)

* progress

* progress

* add special Space behaviour for boolean cells

* prevent shift clicking setting rangeEnd outside of anchor column
This commit is contained in:
Kasper Fabricius Kristensen
2024-08-13 08:47:54 +02:00
committed by GitHub
parent b78e286224
commit b2250ed7b1
12 changed files with 606 additions and 403 deletions
@@ -1,20 +1,20 @@
import { FocusEvent, MouseEvent, createContext } from "react"
import { Control, FieldValues, Path, UseFormRegister } from "react-hook-form"
import { CellCoords } from "./types"
import { CellCoords, CellType } from "./types"
type DataGridContextType<TForm extends FieldValues> = {
// Grid state
anchor: CellCoords | null
selection: Record<string, boolean>
dragSelection: Record<string, boolean>
trapActive: boolean
// Cell handlers
registerCell: (coords: CellCoords, key: string) => void
registerCell: (coords: CellCoords, field: string, type: CellType) => void
getIsCellSelected: (coords: CellCoords) => boolean
getIsCellDragSelected: (coords: CellCoords) => boolean
// Grid handlers
setIsEditing: (value: boolean) => void
setIsSelecting: (value: boolean) => void
setRangeEnd: (coords: CellCoords) => void
setSingleRange: (coords: CellCoords) => void
// Form state and handlers
register: UseFormRegister<TForm>
control: Control<TForm>