"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),f=require("lodash-unified"),q=require("../../config-provider/index.js"),G=require("./style/index.js"),P=require("../../config-provider/hooks/use-global-config.js"),h=require("../../config-provider/config-provider.js"),R=require("../../config-provider/hooks/use-namespace.js"),S=e.defineComponent({__name:"index",props:{minHeight:{default:150},maxHeight:{default:"unset"},mode:{default:void 0}},emits:["heightChange"],setup(r,{emit:m}){const l=P.useGlobalConfig(),p=h.globalConfigCached.value.agGrid,s=r,H=m,a=e.useTemplateRef("wrapperContainer"),u=e.ref(g(s.minHeight)),{b:C,m:v}=R.useNamespace("ag-grid-container"),w=G.default("ag-grid-container"),c=t=>{const i=a.value?.clientHeight,o=a.value?.querySelector(".ag-body.ag-layout-normal")?.clientHeight;let n=0;!i||!o?n=0:n=i-o;const b=t+n,d=Math.max(b,s.minHeight);u.value=`${d}px`,H("heightChange",d)},x=t=>{if(!t)return;const i=t.getDisplayedRowCount();if(i>0){const o=t.getDisplayedRowAtIndex(i-1);if(o&&!f.isNil(o.rowTop)&&!f.isNil(o.rowHeight)){const n=o.rowTop+o.rowHeight;c(n)}}else c(150)},y=e.shallowRef({...l.value,agGrid:{...l.value?.agGrid,onModelUpdated:x}});e.onUnmounted(()=>{h.globalConfigCached.value.agGrid=p});function g(t){return typeof t=="number"&&t?`${t}px`:t.toString()}return(t,i)=>(e.openBlock(),e.createBlock(e.unref(q.APConfigProvider),e.normalizeProps(e.guardReactiveProps(y.value)),{default:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"wrapperContainer",ref:a,class:e.normalizeClass([e.unref(C)(),r.mode==="form-item"?e.unref(v)("form-item"):"",e.unref(w)]),style:e.normalizeStyle({height:u.value,maxHeight:r.maxHeight&&g(r.maxHeight)})},[e.renderSlot(t.$slots,"default")],6)]),_:3},16))}});exports.default=S;
