"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),i=require("lodash-unified");require("../../../ag-grid/index.js");const _=require("../../../ap-modal/index.js"),q=require("../utils.js");require("../wrapper/index.vue.js");const y=require("./use-ag-grid-instance.js"),C=require("../wrapper/index.vue2.js"),P=require("../../../ag-grid/index.vue.js");function H(r){let a=null,s=null;const[o,f]=y.useAgGridInstance(),l=q.genRequest(r.api,r.getRowKey),d=t=>{const{title:e,width:u,modalProps:p,...c}=i.isFunction(t)?t(r):t;i.isEmpty(c)||s?.(c);const g=i.omitBy({title:e,width:u,modalProps:p},i.isUndefined);i.isEmpty(g)||a?.update(g)},m=n.defineComponent({name:"AgGridModalPreviewContent",props:{modalConfig:{type:Object,required:!0}},setup(t){const e=n.ref(t.modalConfig);return s=u=>{e.value={...e.value,...u}},()=>n.createVNode(f,null,{default:()=>[n.createVNode(C.default,{height:e.value.height,rowHeight:e.value.rowHeight,minHeight:e.value.minHeight,maxHeight:e.value.maxHeight},{default:()=>[e.value.renderHeader?.(i.omit(o,"setInstance"),{updateProps:d}),n.createVNode(P.default,n.mergeProps({ref:o.setInstance,searchForm:{sortable:!1,resize:{target:"form"}},rowKey:e.value.getRowKey,request:l.request,style:{padding:"0px"},rowHeight:e.value.rowHeight,columns:e.value.columns,autoHeight:e.value.height==="auto",onModelUpdated:o.onAgGridUpdate},r.gridProps),e.value.gridSlots)]})]})}});function h(){a=_.ApModal.createModal({title:r.title,width:r.width,destroyOnClose:!0,maskClosable:!1,footer:null,afterOpenChange(t){t===!1&&(o.setInstance(void 0),a=null)},content:n.createVNode(m,{modalConfig:r},null),...r.modalProps||{}})}function v(t){l.setExtraParams(t?.extraParams),h()}return{open:v,refresh:o.refresh,getAgGridInstance:o.getInstance,updateProps:d}}exports.useAgGridModal=H;
