"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 s=P.useGlobalConfig(),p=h.globalConfigCached.value.agGrid,a=r,H=m,l=e.useTemplateRef("wrapperContainer"),u=e.ref(g(a.minHeight)),{b:C,m:v}=R.useNamespace("ag-grid-container"),x=G.default("ag-grid-container"),c=t=>{const n=l.value?.clientHeight,i=l.value?.querySelector(".ag-body.ag-layout-normal")?.clientHeight;let o=0;!n||!i?o=0:o=n-i;const b=t+o,d=Math.max(b,a.minHeight);u.value=`${d}px`,H("heightChange",d)},w=t=>{if(!t)return;const n=t.getDisplayedRowCount();if(n>0){const i=t.getDisplayedRowAtIndex(n-1);if(i&&!f.isNil(i.rowTop)&&!f.isNil(i.rowHeight)){const o=i.rowTop+i.rowHeight;c(o)}}else c(Math.max(a.minHeight,86))},y=e.shallowRef({...s.value,agGrid:{...s.value?.agGrid,onModelUpdated:w}});e.onUnmounted(()=>{h.globalConfigCached.value.agGrid=p});function g(t){return typeof t=="number"&&t?`${t}px`:t.toString()}return(t,n)=>(e.openBlock(),e.createBlock(e.unref(q.APConfigProvider),e.normalizeProps(e.guardReactiveProps(y.value)),{default:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"wrapperContainer",ref:l,class:e.normalizeClass([e.unref(C)(),r.mode==="form-item"?e.unref(v)("form-item"):"",e.unref(x)]),style:e.normalizeStyle({height:u.value,maxHeight:r.maxHeight&&g(r.maxHeight)})},[e.renderSlot(t.$slots,"default")],6)]),_:3},16))}});exports.default=S;
