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: {
|
defaultValues: {
|
||||||
[column]: props.cell.getValue()
|
[column]: props.cell.getValue()
|
||||||
},
|
},
|
||||||
// mode: "onChange"
|
|
||||||
})
|
})
|
||||||
const isDirty = form.formState.isDirty
|
|
||||||
|
|
||||||
function onSubmit(value: z.infer<typeof formSchema>) {
|
function onSubmit(value: z.infer<typeof formSchema>) {
|
||||||
toast({
|
toast({
|
||||||
|
@ -67,20 +65,15 @@ export default function NumberInputCell(props: CellContext<any, any>) {
|
||||||
className="w-full h-fit flex items-center justify-center"
|
className="w-full h-fit flex items-center justify-center"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
onKeyDown={e => {
|
onKeyDown={e => {
|
||||||
if (e.code === "Enter" && !isActive) {
|
if (e.code === "Space" && !isActive) {
|
||||||
setIsActive(true)
|
setIsActive(true)
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isActive ?
|
{isActive ?
|
||||||
<Form {...form}>
|
<Form {...form}>
|
||||||
<form onSubmit={e => {
|
<form onSubmit={form.handleSubmit(onSubmit, onErrors)}
|
||||||
e.preventDefault()
|
>
|
||||||
if (isDirty) {
|
|
||||||
console.log("SUBMIT")
|
|
||||||
form.handleSubmit(onSubmit, onErrors)
|
|
||||||
}
|
|
||||||
}} >
|
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name={column}
|
name={column}
|
||||||
|
|
Loading…
Reference in New Issue