mtxuilib 0.0.716 → 0.0.717
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 +1 @@
|
|
|
1
|
-
"use client";var b=(l,
|
|
1
|
+
"use client";var b=(l,c,e)=>new Promise((o,n)=>{var v=t=>{try{s(e.next(t))}catch(i){n(i)}},r=t=>{try{s(e.throw(t))}catch(i){n(i)}},s=t=>t.done?o(t.value):Promise.resolve(t.value).then(v,r);s((e=e.apply(l,c)).next())});import{jsx as a,jsxs as d}from"react/jsx-runtime";import y,{useState as g}from"react";import{useFormContext as M}from"react-hook-form";import{cn as S}from"../lib/utils";import{MtButton as u,MtButtonWithHostKey as h}from"../ui/ui-mt/Button";import{ConformDeleteBtn as k}from"./deleteConform";const x=y.forwardRef((l,c)=>{const{submitText:e,onSubmit:o,onCancel:n,children:v,zodForm:r,enableCancelConform:s,enableDeleteButton:t,onDelete:i}=l,m=M(),D=m.formState.isDirty,B=m.formState,[p,C]=g(!1);return d("div",{className:"flex w-full flex-col p-1",children:[!p&&d("div",{className:"flex justify-end gap-2",children:[a(u,{variant:"outline",className:" min-w-24",onClick:f=>{f.preventDefault(),s&&D?C(!0):n&&n()},children:"cancel"}),a(h,{hotKey:"alt+g",form:r==null?void 0:r.id,type:"submit",disabled:B.isSubmitting,className:" min-w-24",onClick:f=>{o&&(console.log("ssss",m.getValues()),o(m.getValues()),f.preventDefault(),f.stopPropagation())},children:e||"submit"}),t&&a(k,{callback:()=>b(void 0,null,function*(){i&&i()}),disabled:m.formState.isSubmitting,variant:"destructive",children:"delete"})]}),p&&a(N,{onBack:()=>{C(!1)},onContinue:()=>{n&&n()}})]})});x.displayName="EditFormToolbar";const N=l=>{const{onContinue:c,onBack:e}=l;return d("div",{className:"flex gap-2",children:["\u672A\u4FDD\u5B58\u66F4\u6539\uFF0C\u786E\u5B9A\u7EE7\u7EED\u5417\uFF1F",a(u,{onClick:o=>{o.preventDefault(),e()},children:"\u7EE7\u7EED\u7F16\u8F91"}),a(u,{variant:"destructive",className:S(""),onClick:o=>{o.preventDefault(),c()},children:"\u5173\u95ED"})]})};export{x as EditFormToolbar};
|