fix(dashboard): Cell behaviour in DataGrid (#8183)
This commit is contained in:
committed by
GitHub
parent
fffd4f2b3b
commit
2967221e73
@@ -1,20 +1,31 @@
|
||||
import { MouseEvent, createContext } from "react"
|
||||
import { FocusEvent, MouseEvent, createContext } from "react"
|
||||
import { Control, FieldValues, Path, UseFormRegister } from "react-hook-form"
|
||||
import { CellCoords } from "./types"
|
||||
|
||||
type DataGridContextType<TForm extends FieldValues> = {
|
||||
// Grid state
|
||||
anchor: CellCoords | null
|
||||
selection: Record<string, boolean>
|
||||
dragSelection: Record<string, boolean>
|
||||
// Cell handlers
|
||||
registerCell: (coords: CellCoords, key: string) => void
|
||||
getIsCellSelected: (coords: CellCoords) => boolean
|
||||
getIsCellDragSelected: (coords: CellCoords) => boolean
|
||||
// Grid handlers
|
||||
setIsEditing: (value: boolean) => void
|
||||
setIsSelecting: (value: boolean) => void
|
||||
setRangeEnd: (coords: CellCoords) => void
|
||||
// Form state and handlers
|
||||
register: UseFormRegister<TForm>
|
||||
control: Control<TForm>
|
||||
onRegisterCell: (coordinates: CellCoords) => void
|
||||
onUnregisterCell: (coordinates: CellCoords) => void
|
||||
getMouseDownHandler: (
|
||||
getInputChangeHandler: (field: Path<TForm>) => (next: any, prev: any) => void
|
||||
// Wrapper handlers
|
||||
getWrapperFocusHandler: (
|
||||
coordinates: CellCoords
|
||||
) => (e: MouseEvent<HTMLElement>) => void
|
||||
getMouseOverHandler: (
|
||||
) => (e: FocusEvent<HTMLElement>) => void
|
||||
getWrapperMouseOverHandler: (
|
||||
coordinates: CellCoords
|
||||
) => ((e: MouseEvent<HTMLElement>) => void) | undefined
|
||||
getOnChangeHandler: (field: Path<TForm>) => (next: any, prev: any) => void
|
||||
}
|
||||
|
||||
export const DataGridContext = createContext<DataGridContextType<any> | null>(
|
||||
|
||||
Reference in New Issue
Block a user