mtxuilib 0.0.451 → 0.0.452
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,15 @@
|
|
|
1
1
|
import { ComponentProps, PropsWithChildren } from "react";
|
|
2
2
|
import type { Message, PartialMessage } from "@bufbuild/protobuf";
|
|
3
3
|
import { DecoratedMutation, DecoratedQuery } from "@trpc/react-query/dist/createTRPCReact";
|
|
4
|
-
|
|
4
|
+
type ResolverDef = {
|
|
5
|
+
input: any;
|
|
6
|
+
output: any;
|
|
7
|
+
transformer: boolean;
|
|
8
|
+
errorShape: any;
|
|
9
|
+
};
|
|
10
|
+
export declare function TrpcUpdateForm<TDef extends ResolverDef>(props: {
|
|
5
11
|
defaultValues?: any;
|
|
6
|
-
mutationUpdate: DecoratedMutation<
|
|
12
|
+
mutationUpdate: DecoratedMutation<TDef>;
|
|
7
13
|
} & Omit<ComponentProps<typeof FormInnerWithSuspenseQuery>, "onSubmit">): import("react").JSX.Element;
|
|
8
14
|
declare function FormInner(props: {
|
|
9
15
|
defaultValues: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";var
|
|
1
|
+
"use client";var I=Object.defineProperty,P=Object.defineProperties;var V=Object.getOwnPropertyDescriptors;var l=Object.getOwnPropertySymbols;var h=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var b=(e,o,t)=>o in e?I(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,p=(e,o)=>{for(var t in o||(o={}))h.call(o,t)&&b(e,t,o[t]);if(l)for(var t of l(o))S.call(o,t)&&b(e,t,o[t]);return e},M=(e,o)=>P(e,V(o));var F=(e,o)=>{var t={};for(var n in e)h.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&l)for(var n of l(e))o.indexOf(n)<0&&S.call(e,n)&&(t[n]=e[n]);return t};var g=(e,o,t)=>new Promise((n,u)=>{var d=a=>{try{s(t.next(a))}catch(m){u(m)}},i=a=>{try{s(t.throw(a))}catch(m){u(m)}},s=a=>a.done?n(a.value):Promise.resolve(a.value).then(d,i);s((t=t.apply(e,o)).next())});import{Fragment as f,jsx as r,jsxs as x}from"react/jsx-runtime";import{Suspense as D,useMemo as C}from"react";import{FormProvider as Q,useForm as q}from"react-hook-form";import{MtButton as U}from"../ui/ui-mt/Button";function _(e){const{defaultValues:o,params:t,children:n,mutationUpdate:u,queryMethod:d}=e,i=u.useMutation(),s=a=>g(this,null,function*(){console.log("ConnectEsUpdateForm handle submit ",a);try{yield i.mutateAsync({input:a})}catch(m){console.log("\u51FA\u9519",m)}});return r(f,{children:o?r(v,{defaultValues:o,onSubmit:s,children:n}):r(f,{children:r(D,{fallback:r(f,{children:"ConnectEsUpdateForm loading"}),children:x(W,{queryMethod:d,params:t,onSubmit:s,children:[r("div",{className:"flex justify-end gap-2 pr-8",children:r(U,{type:"submit",children:"submit2"})}),n]})})})})}function v(e){const{defaultValues:o,onSubmit:t,children:n}=e,u=q({defaultValues:o});return r(Q,M(p({},u),{children:r("form",{onSubmit:u.handleSubmit(t),children:n})}))}function W(e){const a=e,{queryMethod:o,params:t,onSubmit:n}=a,u=F(a,["queryMethod","params","onSubmit"]),[d,i]=o.useSuspenseQuery(t),s=C(()=>{var c,y;const m=i.data;return(c=m.item)!=null&&c.value?(y=m.item)==null?void 0:y.value:i.data},[i.data]);return r(v,p({defaultValues:s,onSubmit:n},u))}export{_ as TrpcUpdateForm};
|