make fields open with space (to avoid conflicts)
This commit is contained in:
parent
380fc56d17
commit
0138e1aa2a
BIN
prisma/dev.db
BIN
prisma/dev.db
Binary file not shown.
|
@ -27,9 +27,7 @@ export default function NumberInputCell(props: CellContext<any, any>) {
|
|||
defaultValues: {
|
||||
[column]: props.cell.getValue()
|
||||
},
|
||||
// mode: "onChange"
|
||||
})
|
||||
const isDirty = form.formState.isDirty
|
||||
|
||||
function onSubmit(value: z.infer<typeof formSchema>) {
|
||||
toast({
|
||||
|
@ -67,20 +65,15 @@ export default function NumberInputCell(props: CellContext<any, any>) {
|
|||
className="w-full h-fit flex items-center justify-center"
|
||||
tabIndex={0}
|
||||
onKeyDown={e => {
|
||||
if (e.code === "Enter" && !isActive) {
|
||||
if (e.code === "Space" && !isActive) {
|
||||
setIsActive(true)
|
||||
}
|
||||
}}
|
||||
>
|
||||
{isActive ?
|
||||
<Form {...form}>
|
||||
<form onSubmit={e => {
|
||||
e.preventDefault()
|
||||
if (isDirty) {
|
||||
console.log("SUBMIT")
|
||||
form.handleSubmit(onSubmit, onErrors)
|
||||
}
|
||||
}} >
|
||||
<form onSubmit={form.handleSubmit(onSubmit, onErrors)}
|
||||
>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name={column}
|
||||
|
|
Loading…
Reference in New Issue