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

View File

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