use-page-modal.369cb1f6.js 758 B

1
  1. import{E as f}from"./index.1417328f.js";function h({createCallback:i,updateCallback:l,confirmCallback:t,previewCallback:o,pageContentRef:d}){const e=f(null),u=f({});function s(){u.value={},e.value.type="create",i&&i(),e.value.dialogVisible=!0}function v(a){u.value={...a},e.value.type="update",l&&l(),e.value.dialogVisible=!0}function g(a){u.value={...a},e.value.type="preview",o&&o(),e.value.dialogVisible=!0}function p(a,r){const n=t?t(r):{};if(n===!1)return;e.value.confirmLoading=!0;const c={...a==="update"?{id:u.value.id}:{},...n||{},...r};d.value.onBeforeAction(a,c,()=>{e.value.confirmLoading=!1,e.value.dialogVisible=!1})}return{handleCreateData:s,handleUpdateData:v,handlePreviewData:g,handleConfrim:p,defaultInfo:u,pageModalRef:e}}export{h as u};