mtxuilib 0.0.385 → 0.0.387
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ComponentProps, PropsWithChildren } from "react";
|
|
2
2
|
import type { Message, PartialMessage } from "@bufbuild/protobuf";
|
|
3
|
-
import { type MethodUnaryDescriptor } from 'gomtm/connectquery';
|
|
3
|
+
import { ConnectQueryKey, type MethodUnaryDescriptor } from 'gomtm/connectquery';
|
|
4
4
|
export declare function ConnectEsUpdateForm<I extends Message<I>, O extends Message<O>>(props: {
|
|
5
5
|
defaultValues?: any;
|
|
6
6
|
mutationMethodSig: MethodUnaryDescriptor<any, any>;
|
|
7
|
+
onMutationSuccess?: ((data: any, variables: PartialMessage<any>, context: ConnectQueryKey<any>) => unknown) | undefined;
|
|
7
8
|
} & Omit<ComponentProps<typeof FormInnerWithSuspenseQuery>, "onSubmit">): import("react").JSX.Element;
|
|
8
9
|
declare function FormInner(props: {
|
|
9
10
|
defaultValues: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";var
|
|
1
|
+
"use client";var F=Object.defineProperty,I=Object.defineProperties;var C=Object.getOwnPropertyDescriptors;var d=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable;var f=(e,n,t)=>n in e?F(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,p=(e,n)=>{for(var t in n||(n={}))S.call(n,t)&&f(e,t,n[t]);if(d)for(var t of d(n))h.call(n,t)&&f(e,t,n[t]);return e},M=(e,n)=>I(e,C(n));var b=(e,n)=>{var t={};for(var o in e)S.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&d)for(var o of d(e))n.indexOf(o)<0&&h.call(e,o)&&(t[o]=e[o]);return t};import{Fragment as c,jsx as a}from"react/jsx-runtime";import{Suspense as P,useMemo as Q}from"react";import{useMutation as V,useSuspenseQuery as O}from"gomtm/connectquery";import{FormProvider as v,useForm as U}from"react-hook-form";function A(e){const{defaultValues:n,methodQuerySig:t,params:o,children:r,mutationMethodSig:s,onMutationSuccess:l}=e,m=V(s,{onSuccess:l}),u=i=>{console.log("ConnectEsUpdateForm handle submit ",i,s),m.mutateAsync({input:i})};return a(c,{children:n?a(g,{defaultValues:n,onSubmit:u,children:r}):a(c,{children:a(P,{fallback:a(c,{children:"ConnectEsUpdateForm loading"}),children:a(x,{methodQuerySig:t,params:o,onSubmit:u,children:r})})})})}function g(e){const{defaultValues:n,onSubmit:t,children:o}=e,r=U({defaultValues:n});return a(v,M(p({},r),{children:a("form",{onSubmit:r.handleSubmit(t),children:o})}))}function x(e){const m=e,{methodQuerySig:n,params:t,onSubmit:o}=m,r=b(m,["methodQuerySig","params","onSubmit"]),s=O(n,t),l=Q(()=>{var i,y;const u=s.data;return(i=u.item)!=null&&i.value?(y=u.item)==null?void 0:y.value:s.data},[s.data]);return a(g,p({defaultValues:l,onSubmit:o},r))}export{A as ConnectEsUpdateForm};
|