fixing baseform table edit

This commit is contained in:
rizky 2024-11-28 21:14:53 -07:00
parent cb28c0fe82
commit bc73112e50
2 changed files with 8 additions and 3 deletions

View File

@ -14,7 +14,7 @@ export type BaseFormProps<T> = {
onSubmit?: (arg: { fm: FMLocal }) => Promise<boolean> | boolean;
onChange?: (fm: FMLocal, name: string, new_value: any) => any;
children: ReactNode | ((arg: { fm: FMLocal }) => ReactNode);
tag?: "form" | "div";
tag?: "form" | "div" | "blank";
};
export const BaseForm = <T extends Record<string, any>>({
@ -73,6 +73,10 @@ export const BaseForm = <T extends Record<string, any>>({
}
const toaster_el = document.getElementsByClassName("prasi-toaster")[0];
if (tag === "blank") {
return child;
}
return (
<DivForm
tag={tag || "form"}

View File

@ -274,14 +274,14 @@ export const TableEdit: FC<{
<BaseForm
key={idx}
name={`tef-${idx}`}
tag={"div"}
tag={"blank"}
data={row}
>
{(form) => {
return (
<tr
className={cx(
"c-border-b c-py-1",
"c-border-t",
idx !== value.length - 1
? "c-border-gray-300"
: ""
@ -291,6 +291,7 @@ export const TableEdit: FC<{
return (
<td
className={cx(
"c-py-1",
css`
vertical-align: top;
`,