ag-grid-react
Version:
AG Grid React Component
2 lines • 51.4 kB
JavaScript
import ps,{Component as ms}from"react";import Me,{forwardRef as hs,useCallback as Ze,useContext as fs,useEffect as Cs,useImperativeHandle as gs,useMemo as Xe,useRef as ne,useState as xe}from"react";import{BaseComponentWrapper as ys,GridCoreCreator as vs,VanillaFrameworkOverrides as ws,_combineAttributesAndGridOptions as Rs,_getGridOption as et,_getGridRegisteredModules as bs,_isClientSideRowModel as Es,_isServerSideRowModel as Ss,_observeResize as Ps,_processOnChange as ks,_warn as Gt}from"ag-grid-community";import Re,{forwardRef as Fs,useCallback as Ms,useContext as xs,useImperativeHandle as As,useLayoutEffect as Gs,useMemo as tt,useRef as Ae,useState as be}from"react";import{_toString as Bs}from"ag-grid-community";import Bt from"react";var Z=Bt.createContext({}),Dt=Bt.createContext("default"),Ve=(e,t,s,n)=>{if(!e||e.componentFromFramework||t.isDestroyed())return;const i=e.newAgStackInstance();let c,o,a=!1;return i.then(l=>{if(a){t.destroyBean(l);return}c=l,o=c.getGui(),s.appendChild(o),It(n,c)}),()=>{a=!0,c&&(o?.parentElement?.removeChild(o),t.destroyBean(c),n&&It(n,void 0))}},It=(e,t)=>{if(e)if(e instanceof Function)e(t);else{const s=e;s.current=t}};import st from"react";import Ds from"react-dom";var oe=(...e)=>e.filter(s=>s!=null&&s!=="").join(" "),ae=class ls{constructor(...t){this.classesMap={},t.forEach(s=>{this.classesMap[s]=!0})}setClass(t,s){if(!!this.classesMap[t]==s)return this;const r=new ls;return r.classesMap={...this.classesMap},r.classesMap[t]=s,r}toString(){return Object.keys(this.classesMap).filter(s=>this.classesMap[s]).join(" ")}},Ge=e=>{const t=()=>typeof Symbol=="function"&&Symbol.for,s=()=>t()?Symbol.for("react.memo"):60115;return typeof e=="function"&&!(e.prototype&&e.prototype.isReactComponent)||typeof e=="object"&&e.$$typeof===s()},Ct=st.version?.split(".")[0],Ot=Ct==="16"||Ct==="17";function Is(){return Ct==="19"}var rt=!1;function Os(e){return rt||setTimeout(()=>rt=!1,0),rt=!0,e()}var Le=(e,t)=>{!Ot&&e&&!rt?Ds.flushSync(t):t()},Ws=e=>{Ot?e():st.startTransition(e)};function Ts(e,t,s){return st.useSyncExternalStore?st.useSyncExternalStore(e,t):s}function nt(e,t,s){if(t==null||e==null)return t;if(e===t||t.length===0&&e.length===0)return e;if(s||e.length===0&&t.length>0||e.length>0&&t.length===0)return t;const n=[],r=[],i=new Map,c=new Map;for(let o=0;o<t.length;o++){const a=t[o];c.set(a.instanceId,a)}for(let o=0;o<e.length;o++){const a=e[o];i.set(a.instanceId,a),c.has(a.instanceId)&&n.push(a)}for(let o=0;o<t.length;o++){const a=t[o],l=a.instanceId;i.has(l)||r.push(a)}return n.length===e.length&&r.length===0?e:n.length===0&&r.length===t.length?t:n.length===0?r:r.length===0?n:[...n,...r]}var Wt=Fs((e,t)=>{const{registry:s,context:n}=xs(Z),r=Ae(null),i=Ae(null),c=Ae(null),o=Ae(null),a=Ae(null),l=Ae(),[u,E]=be(),[C,m]=be(),[w,g]=be(),[f,d]=be(()=>new ae),[v,R]=be(()=>new ae("ag-hidden")),[G,p]=be(()=>new ae("ag-hidden")),[O,I]=be(()=>new ae("ag-invisible"));As(t,()=>({refresh(){return!1}})),Gs(()=>Ve(u,n,i.current),[u]);const V=Ms(T=>{if(r.current=T,!T){l.current=n.destroyBean(l.current);return}const F={setInnerRenderer:(M,H)=>{E(M),g(H)},setChildCount:M=>m(M),toggleCss:(M,H)=>d(x=>x.setClass(M,H)),setContractedDisplayed:M=>p(H=>H.setClass("ag-hidden",!M)),setExpandedDisplayed:M=>R(H=>H.setClass("ag-hidden",!M)),setCheckboxVisible:M=>I(H=>H.setClass("ag-invisible",!M)),setCheckboxSpacing:M=>I(H=>H.setClass("ag-group-checkbox-spacing",M))},N=s.createDynamicBean("groupCellRendererCtrl",!0);N&&(l.current=n.createBean(N),l.current.init(F,T,c.current,o.current,a.current,Wt,e))},[]),B=tt(()=>`ag-cell-wrapper ${f.toString()}`,[f]),P=tt(()=>`ag-group-expanded ${v.toString()}`,[v]),b=tt(()=>`ag-group-contracted ${G.toString()}`,[G]),h=tt(()=>`ag-group-checkbox ${O.toString()}`,[O]),y=u?.componentFromFramework,L=y?u.componentClass:void 0,k=u==null&&w!=null,W=Bs(w);return Re.createElement("span",{className:B,ref:V,...e.colDef?{}:{role:l.current?.getCellAriaRole()}},Re.createElement("span",{className:P,ref:o}),Re.createElement("span",{className:b,ref:a}),Re.createElement("span",{className:h,ref:c}),Re.createElement("span",{className:"ag-group-value",ref:i},k?W:y?Re.createElement(L,{...u.params}):null),Re.createElement("span",{className:"ag-group-child-count"},C))}),Tt=Wt;import{AgPromise as gt}from"ag-grid-community";import Nt,{memo as Ns,useEffect as Hs,useState as Us}from"react";import{createContext as _s}from"react";var je=_s({setMethods:()=>{}}),Vs=e=>{const{initialProps:t,addUpdateCallback:s,CustomComponentClass:n,setMethods:r}=e,[{key:i,...c},o]=Us(t);return Hs(()=>{s(a=>o(a))},[]),Nt.createElement(je.Provider,{value:{setMethods:r}},Nt.createElement(n,{key:i,...c}))},Ls=Ns(Vs);import{createElement as js}from"react";import{createPortal as zs}from"react-dom";import{AgPromise as yt}from"ag-grid-community";var $s=0;function Ht(){return`agPortalKey_${++$s}`}var Ut=class{constructor(e,t,s,n){this.portal=null,this.oldPortal=null,this.reactComponent=e,this.portalManager=t,this.componentType=s,this.suppressFallbackMethods=!!n,this.statelessComponent=this.isStateless(this.reactComponent),this.key=Ht(),this.portalKey=Ht(),this.instanceCreated=this.isStatelessComponent()?yt.resolve(!1):new yt(r=>{this.resolveInstanceCreated=r})}getGui(){return this.eParentElement}getRootElement(){return this.eParentElement.firstChild}destroy(){this.componentInstance&&typeof this.componentInstance.destroy=="function"&&this.componentInstance.destroy();const e=this.portal;e&&this.portalManager.destroyPortal(e)}createParentElement(e){const t=this.portalManager.getComponentWrappingElement(),s=document.createElement(t||"div");return s.classList.add("ag-react-container"),e.reactContainer=s,s}statelessComponentRendered(){return this.eParentElement.childElementCount>0||this.eParentElement.childNodes.length>0}getFrameworkComponentInstance(){return this.componentInstance}isStatelessComponent(){return this.statelessComponent}getReactComponentName(){return this.reactComponent.name}getMemoType(){return this.hasSymbol()?Symbol.for("react.memo"):60115}hasSymbol(){return typeof Symbol=="function"&&Symbol.for}isStateless(e){return typeof e=="function"&&!(e.prototype&&e.prototype.isReactComponent)||typeof e=="object"&&e.$$typeof===this.getMemoType()}hasMethod(e){const t=this.getFrameworkComponentInstance();return!!t&&t[e]!=null||this.fallbackMethodAvailable(e)}callMethod(e,t){const s=this.getFrameworkComponentInstance();if(this.isStatelessComponent())return this.fallbackMethod(e,t&&t[0]?t[0]:{});if(!s){setTimeout(()=>this.callMethod(e,t));return}const n=s[e];if(n)return n.apply(s,t);if(this.fallbackMethodAvailable(e))return this.fallbackMethod(e,t&&t[0]?t[0]:{})}addMethod(e,t){this[e]=t}init(e){return this.eParentElement=this.createParentElement(e),this.createOrUpdatePortal(e),new yt(t=>this.createReactComponent(t))}createOrUpdatePortal(e){this.isStatelessComponent()||(this.ref=t=>{this.componentInstance=t,this.resolveInstanceCreated?.(!0),this.resolveInstanceCreated=void 0},e.ref=this.ref),this.reactElement=this.createElement(this.reactComponent,{...e,key:this.key}),this.portal=zs(this.reactElement,this.eParentElement,this.portalKey)}createElement(e,t){return js(e,t)}createReactComponent(e){this.portalManager.mountReactPortal(this.portal,this,e)}rendered(){return this.isStatelessComponent()&&this.statelessComponentRendered()||!!(!this.isStatelessComponent()&&this.getFrameworkComponentInstance())}refreshComponent(e){this.oldPortal=this.portal,this.createOrUpdatePortal(e),this.portalManager.updateReactPortal(this.oldPortal,this.portal)}fallbackMethod(e,t){const s=this[`${e}Component`];if(!this.suppressFallbackMethods&&s)return s.bind(this)(t)}fallbackMethodAvailable(e){return this.suppressFallbackMethods?!1:!!this[`${e}Component`]}};function ot(e,t,s){e.forEach(n=>{const r=t[n];r&&(s[n]=r)})}var se=class extends Ut{constructor(){super(...arguments),this.awaitUpdateCallback=new gt(e=>{this.resolveUpdateCallback=e}),this.wrapperComponent=Ls}init(e){return this.sourceParams=e,super.init(this.getProps())}addMethod(){}getInstance(){return this.instanceCreated.then(()=>this.componentInstance)}getFrameworkComponentInstance(){return this}createElement(e,t){return super.createElement(this.wrapperComponent,{initialProps:t,CustomComponentClass:e,setMethods:s=>this.setMethods(s),addUpdateCallback:s=>{this.updateCallback=()=>(s(this.getProps()),new gt(n=>{setTimeout(()=>{n()})})),this.resolveUpdateCallback()}})}setMethods(e){this.providedMethods=e,ot(this.getOptionalMethods(),this.providedMethods,this)}getOptionalMethods(){return[]}getProps(){return{...this.sourceParams,key:this.key,ref:this.ref}}refreshProps(){return this.updateCallback?this.updateCallback():new gt(e=>this.awaitUpdateCallback.then(()=>{this.updateCallback().then(()=>e())}))}},Js=class extends se{refresh(e){return this.sourceParams=e,this.refreshProps(),!0}},qs=class extends se{constructor(){super(...arguments),this.date=null,this.onDateChange=e=>this.updateDate(e)}getDate(){return this.date}setDate(e){this.date=e,this.refreshProps()}refresh(e){this.sourceParams=e,this.refreshProps()}getOptionalMethods(){return["afterGuiAttached","setInputPlaceholder","setInputAriaLabel","setDisabled"]}updateDate(e){this.setDate(e),this.sourceParams.onDateChanged()}getProps(){const e=super.getProps();return e.date=this.date,e.onDateChange=this.onDateChange,delete e.onDateChanged,e}},Ks=class extends se{constructor(){super(...arguments),this.label="",this.icon=null,this.shake=!1}setIcon(e,t){this.icon=e,this.shake=t,this.refreshProps()}setLabel(e){this.label=e,this.refreshProps()}getProps(){const e=super.getProps(),{label:t,icon:s,shake:n}=this;return e.label=t,e.icon=s,e.shake=n,e}};import{AgPromise as _t}from"ag-grid-community";var Qs=class extends se{constructor(){super(...arguments),this.model=null,this.onModelChange=e=>this.updateModel(e),this.onUiChange=()=>this.sourceParams.filterModifiedCallback(),this.expectingNewMethods=!0,this.hasBeenActive=!1,this.awaitSetMethodsCallback=new _t(e=>{this.resolveSetMethodsCallback=e})}isFilterActive(){return this.model!=null}doesFilterPass(e){return this.providedMethods.doesFilterPass(e)}getModel(){return this.model}setModel(e){return this.expectingNewMethods=!0,this.model=e,this.hasBeenActive||(this.hasBeenActive=this.isFilterActive()),this.refreshProps()}refresh(e){return this.sourceParams=e,this.refreshProps(),!0}afterGuiAttached(e){const t=this.providedMethods;t?t.afterGuiAttached?.(e):this.awaitSetMethodsCallback.then(()=>this.providedMethods?.afterGuiAttached?.(e))}getOptionalMethods(){return["afterGuiDetached","onNewRowsLoaded","getModelAsString","onAnyFilterChanged"]}setMethods(e){this.expectingNewMethods===!1&&this.hasBeenActive&&this.providedMethods?.doesFilterPass!==e?.doesFilterPass&&setTimeout(()=>{this.sourceParams.filterChangedCallback()}),this.expectingNewMethods=!1,super.setMethods(e),this.resolveSetMethodsCallback(),this.resolveFilterPassCallback?.(),this.resolveFilterPassCallback=void 0}updateModel(e){this.resolveFilterPassCallback?.();const t=new _t(s=>{this.resolveFilterPassCallback=s});this.setModel(e).then(()=>{t.then(()=>{this.sourceParams.filterChangedCallback()})})}getProps(){const e=super.getProps();return e.model=this.model,e.onModelChange=this.onModelChange,e.onUiChange=this.onUiChange,delete e.filterChangedCallback,e}};import{AgPromise as Ys}from"ag-grid-community";var Zs=class extends se{constructor(){super(...arguments),this.awaitSetMethodsCallback=new Ys(e=>{this.resolveSetMethodsCallback=e})}refresh(e){return this.sourceParams=e,this.refreshProps(),!0}afterGuiAttached(e){const t=this.providedMethods;t?t.afterGuiAttached?.(e):this.awaitSetMethodsCallback.then(()=>this.providedMethods?.afterGuiAttached?.(e))}getOptionalMethods(){return["afterGuiDetached","onNewRowsLoaded","onAnyFilterChanged"]}setMethods(e){super.setMethods(e),this.resolveSetMethodsCallback()}};import{AgPromise as Xs}from"ag-grid-community";function Vt(e,t){e.parentFilterInstance(s=>{(s.setModel(t)||Xs.resolve()).then(()=>{e.filterParams.filterChangedCallback()})})}var er=class{constructor(e,t){this.floatingFilterParams=e,this.refreshProps=t,this.model=null,this.onModelChange=s=>this.updateModel(s)}getProps(){return{...this.floatingFilterParams,model:this.model,onModelChange:this.onModelChange}}onParentModelChanged(e){this.model=e,this.refreshProps()}refresh(e){this.floatingFilterParams=e,this.refreshProps()}setMethods(e){ot(this.getOptionalMethods(),e,this)}getOptionalMethods(){return["afterGuiAttached"]}updateModel(e){this.model=e,this.refreshProps(),Vt(this.floatingFilterParams,e)}},tr=class extends se{constructor(){super(...arguments),this.model=null,this.onModelChange=e=>this.updateModel(e)}onParentModelChanged(e){this.model=e,this.refreshProps()}refresh(e){this.sourceParams=e,this.refreshProps()}getOptionalMethods(){return["afterGuiAttached"]}updateModel(e){this.model=e,this.refreshProps(),Vt(this.sourceParams,e)}getProps(){const e=super.getProps();return e.model=this.model,e.onModelChange=this.onModelChange,e}},sr=class extends se{refresh(e){this.sourceParams=e,this.refreshProps()}getOptionalMethods(){return["afterGuiAttached"]}},rr=class extends se{refresh(e){return this.sourceParams=e,this.refreshProps(),!0}},nr=class extends se{refresh(e){this.sourceParams=e,this.refreshProps()}},or=class extends se{constructor(){super(...arguments),this.active=!1,this.expanded=!1,this.onActiveChange=e=>this.updateActive(e)}setActive(e){this.awaitSetActive(e)}setExpanded(e){this.expanded=e,this.refreshProps()}getOptionalMethods(){return["select","configureDefaults"]}awaitSetActive(e){return this.active=e,this.refreshProps()}updateActive(e){const t=this.awaitSetActive(e);e&&t.then(()=>this.sourceParams.onItemActivated())}getProps(){const e=super.getProps();return e.active=this.active,e.expanded=this.expanded,e.onActiveChange=this.onActiveChange,delete e.onItemActivated,e}},ar=class extends se{refresh(e){this.sourceParams=e,this.refreshProps()}},cr=class extends se{refresh(e){return this.sourceParams=e,this.refreshProps(),!0}},ir=class extends se{constructor(){super(...arguments),this.onStateChange=e=>this.updateState(e)}refresh(e){return this.sourceParams=e,this.refreshProps(),!0}getState(){return this.state}updateState(e){this.state=e,this.refreshProps(),this.sourceParams.onStateUpdated()}getProps(){const e=super.getProps();return e.state=this.state,e.onStateChange=this.onStateChange,e}};import{AgPromise as lr,_warn as ur}from"ag-grid-community";function dr(e,t){(e?.getInstance?.()??lr.resolve(void 0)).then(n=>t(n))}function at(){ur(231)}var pr=1e3,mr=class{constructor(e,t,s){this.destroyed=!1,this.portals=[],this.hasPendingPortalUpdate=!1,this.wrappingElement=t||"div",this.refresher=e,this.maxComponentCreationTimeMs=s||pr}getPortals(){return this.portals}destroy(){this.destroyed=!0}destroyPortal(e){this.portals=this.portals.filter(t=>t!==e),this.batchUpdate()}getComponentWrappingElement(){return this.wrappingElement}mountReactPortal(e,t,s){this.portals=[...this.portals,e],this.waitForInstance(t,s),this.batchUpdate()}updateReactPortal(e,t){this.portals[this.portals.indexOf(e)]=t,this.batchUpdate()}batchUpdate(){this.hasPendingPortalUpdate||(setTimeout(()=>{this.destroyed||(this.refresher(),this.hasPendingPortalUpdate=!1)}),this.hasPendingPortalUpdate=!0)}waitForInstance(e,t,s=Date.now()){if(this.destroyed){t(null);return}if(e.rendered())t(e);else{if(Date.now()-s>=this.maxComponentCreationTimeMs&&!this.hasPendingPortalUpdate){Le(!0,()=>this.refresher()),e.rendered()&&t(e);return}window.setTimeout(()=>{this.waitForInstance(e,t,s)})}}};import ze,{memo as hr,useCallback as ct,useEffect as fr,useMemo as it,useRef as Be,useState as Ee}from"react";import{GridCtrl as Cr}from"ag-grid-community";import $e,{memo as gr,useCallback as yr,useContext as vr,useMemo as ce,useRef as ue,useState as ee}from"react";import{CssClassManager as wr,FakeHScrollComp as Rr,FakeVScrollComp as br,GridBodyCtrl as Er,_observeResize as Sr,_setAriaColCount as Pr,_setAriaRowCount as kr}from"ag-grid-community";import lt,{memo as Fr,useCallback as Mr,useContext as xr,useMemo as Lt,useRef as jt,useState as zt}from"react";import{GridHeaderCtrl as Ar}from"ag-grid-community";import Je,{memo as Gr,useCallback as Br,useContext as Dr,useRef as vt,useState as $t}from"react";import{HeaderRowContainerCtrl as Ir}from"ag-grid-community";import ut,{memo as Or,useCallback as Jt,useContext as Wr,useMemo as qt,useRef as wt,useState as dt}from"react";import{_EmptyBean as Tr}from"ag-grid-community";import qe,{memo as Nr,useCallback as Hr,useContext as Ur,useEffect as _r,useLayoutEffect as Vr,useMemo as Lr,useRef as De,useState as Kt}from"react";import{CssClassManager as jr,_EmptyBean as zr,_removeAriaSort as $r,_setAriaSort as Jr}from"ag-grid-community";var qr=({ctrl:e})=>{const t=e.isAlive(),{context:s}=Ur(Z),n=t?e.column.getColId():void 0,[r,i]=Kt(),[c,o]=Kt(),a=De(),l=De(null),u=De(null),E=De(null),C=De(),m=De();t&&!m.current&&(m.current=new jr(()=>l.current));const w=Hr(v=>{if(l.current=v,a.current=v?s.createBean(new zr):s.destroyBean(a.current),!v||!e.isAlive())return;const R=()=>{const p=e.getSelectAllGui();p&&(u.current?.insertAdjacentElement("afterend",p),a.current.addDestroyFunc(()=>p.remove()))},G={setWidth:p=>{l.current&&(l.current.style.width=p)},toggleCss:(p,O)=>m.current.toggleCss(p,O),setUserStyles:p=>o(p),setAriaSort:p=>{l.current&&(p?Jr(l.current,p):$r(l.current))},setUserCompDetails:p=>i(p),getUserCompInstance:()=>C.current||void 0,refreshSelectAllGui:R,removeSelectAllGui:()=>e.getSelectAllGui()?.remove()};e.setComp(G,v,u.current,E.current,a.current),R()},[]);Vr(()=>Ve(r,s,E.current,C),[r]),_r(()=>{e.setDragSource(l.current)},[r]);const g=Lr(()=>!!(r?.componentFromFramework&&Ge(r.componentClass)),[r]),f=r?.componentFromFramework,d=r?.componentClass;return qe.createElement("div",{ref:w,style:c,className:"ag-header-cell","col-id":n,role:"columnheader"},qe.createElement("div",{ref:u,className:"ag-header-cell-resize",role:"presentation"}),qe.createElement("div",{ref:E,className:"ag-header-cell-comp-wrapper",role:"presentation"},f?g?qe.createElement(d,{...r.params}):qe.createElement(d,{...r.params,ref:C}):null))},Kr=Nr(qr);import Se,{memo as Qr,useCallback as Yr,useContext as Zr,useLayoutEffect as Xr,useMemo as Ie,useRef as Pe,useState as ye}from"react";import{useEffect as en}from"react";import{AgPromise as tn,_EmptyBean as sn}from"ag-grid-community";var rn=class{constructor(e,t){this.floatingFilterParams=e,this.refreshProps=t}getProps(){return this.floatingFilterParams}refresh(e){this.floatingFilterParams=e,this.refreshProps()}setMethods(e){ot(this.getOptionalMethods(),e,this)}getOptionalMethods(){return["afterGuiAttached"]}},nn=({ctrl:e})=>{const{context:t,gos:s}=Zr(Z),[n,r]=ye(),[i,c]=ye(()=>new ae("ag-header-cell","ag-floating-filter")),[o,a]=ye(()=>new ae),[l,u]=ye(()=>new ae("ag-floating-filter-button","ag-hidden")),[E,C]=ye("false"),[m,w]=ye(),[,g]=ye(1),f=Pe(),d=Pe(null),v=Pe(null),R=Pe(null),G=Pe(null),p=Pe(),O=Pe(),I=M=>{M!=null&&p.current&&p.current(M)},V=Yr(M=>{if(d.current=M,f.current=M?t.createBean(new sn):t.destroyBean(f.current),!M)return;O.current=new tn(x=>{p.current=x});const H={toggleCss:(x,D)=>c(U=>U.setClass(x,D)),setUserStyles:x=>r(x),addOrRemoveBodyCssClass:(x,D)=>a(U=>U.setClass(x,D)),setButtonWrapperDisplayed:x=>{u(D=>D.setClass("ag-hidden",!x)),C(x?"false":"true")},setWidth:x=>{d.current&&(d.current.style.width=x)},setCompDetails:x=>w(x),getFloatingFilterComp:()=>O.current?O.current:null,setMenuIcon:x=>G.current?.appendChild(x)};e.setComp(H,M,G.current,v.current,f.current)},[]);Xr(()=>Ve(m,t,v.current,I),[m]);const B=Ie(()=>i.toString(),[i]),P=Ie(()=>o.toString(),[o]),b=Ie(()=>l.toString(),[l]),h=Ie(()=>!!(m&&m.componentFromFramework&&Ge(m.componentClass)),[m]),y=Ie(()=>s.get("reactiveCustomComponents"),[]),L=Ie(()=>s.get("enableFilterHandlers"),[]),[k,W]=ye();en(()=>{if(m?.componentFromFramework)if(y){const M=L?rn:er,H=new M(m.params,()=>g(x=>x+1));I(H),W(H)}else at()},[m]);const T=k?.getProps(),F=m?.componentFromFramework,N=m?.componentClass;return Se.createElement("div",{ref:V,style:n,className:B,role:"gridcell"},Se.createElement("div",{ref:v,className:P,role:"presentation"},F?y?T&&Se.createElement(je.Provider,{value:{setMethods:M=>k.setMethods(M)}},Se.createElement(N,{...T})):Se.createElement(N,{...m.params,ref:h?()=>{}:I}):null),Se.createElement("div",{ref:R,"aria-hidden":E,className:b,role:"presentation"},Se.createElement("button",{ref:G,type:"button",className:"ag-button ag-floating-filter-button-button",tabIndex:-1})))},on=Qr(nn);import Ke,{memo as an,useCallback as cn,useContext as ln,useEffect as un,useLayoutEffect as dn,useMemo as pt,useRef as Qe,useState as Oe}from"react";import{_EmptyBean as pn}from"ag-grid-community";var mn=({ctrl:e})=>{const{context:t}=ln(Z),[s,n]=Oe(),[r,i]=Oe(()=>new ae),[c,o]=Oe(()=>new ae),[a,l]=Oe("false"),[u,E]=Oe(),[C,m]=Oe(),w=pt(()=>e.column.getUniqueId(),[]),g=Qe(),f=Qe(null),d=Qe(null),v=Qe(null),R=Qe(),G=cn(P=>{if(f.current=P,g.current=P?t.createBean(new pn):t.destroyBean(g.current),!P)return;const b={setWidth:h=>{f.current&&(f.current.style.width=h)},toggleCss:(h,y)=>i(L=>L.setClass(h,y)),setUserStyles:h=>n(h),setHeaderWrapperHidden:h=>{const y=v.current;y&&(h?y.style.setProperty("display","none"):y.style.removeProperty("display"))},setHeaderWrapperMaxHeight:h=>{const y=v.current;y&&(h!=null?y.style.setProperty("max-height",`${h}px`):y.style.removeProperty("max-height"),y.classList.toggle("ag-header-cell-comp-wrapper-limited-height",h!=null))},setUserCompDetails:h=>m(h),setResizableDisplayed:h=>{o(y=>y.setClass("ag-hidden",!h)),l(h?"false":"true")},setAriaExpanded:h=>E(h),getUserCompInstance:()=>R.current||void 0};e.setComp(b,P,d.current,v.current,g.current)},[]);dn(()=>Ve(C,t,v.current),[C]),un(()=>{f.current&&e.setDragSource(f.current)},[C]);const p=pt(()=>!!(C?.componentFromFramework&&Ge(C.componentClass)),[C]),O=pt(()=>"ag-header-group-cell "+r.toString(),[r]),I=pt(()=>"ag-header-cell-resize "+c.toString(),[c]),V=C?.componentFromFramework,B=C?.componentClass;return Ke.createElement("div",{ref:G,style:s,className:O,"col-id":w,role:"columnheader","aria-expanded":u},Ke.createElement("div",{ref:v,className:"ag-header-cell-comp-wrapper",role:"presentation"},V?p?Ke.createElement(B,{...C.params}):Ke.createElement(B,{...C.params,ref:R}):null),Ke.createElement("div",{ref:d,"aria-hidden":a,className:I}))},hn=an(mn),fn=({ctrl:e})=>{const{context:t}=Wr(Z),{topOffset:s,rowHeight:n}=qt(()=>e.getTopAndHeight(),[]),[r,i]=dt(e.getAriaRowIndex()),c=e.headerRowClass,[o,a]=dt(()=>n+"px"),[l,u]=dt(()=>s+"px"),E=wt([]),[C,m]=dt(()=>e.getUpdatedHeaderCtrls()),w=wt(),g=wt(null),f=Jt(R=>{if(g.current=R,w.current=R?t.createBean(new Tr):t.destroyBean(w.current),!R)return;const G={setHeight:p=>a(p),setTop:p=>u(p),setHeaderCtrls:(p,O,I)=>{const V=E.current,B=nt(V,p,O);B!==V&&(E.current=B,Le(I,()=>m(B)))},setWidth:p=>{g.current&&(g.current.style.width=p)},setRowIndex:p=>{i(p)}};e.setComp(G,w.current,!1)},[]),d=qt(()=>({height:o,top:l}),[o,l]),v=Jt(R=>{switch(e.type){case"group":return ut.createElement(hn,{ctrl:R,key:R.instanceId});case"filter":return ut.createElement(on,{ctrl:R,key:R.instanceId});default:return ut.createElement(Kr,{ctrl:R,key:R.instanceId})}},[]);return ut.createElement("div",{ref:f,className:c,role:"row",style:d,"aria-rowindex":r},C.map(v))},Cn=Or(fn),gn=({pinned:e})=>{const[t,s]=$t(!0),[n,r]=$t([]),{context:i}=Dr(Z),c=vt(null),o=vt(null),a=vt(),l=e==="left",u=e==="right",E=!l&&!u,C=Br(g=>{if(c.current=g,a.current=g?i.createBean(new Ir(e)):i.destroyBean(a.current),!g)return;const f={setDisplayed:s,setCtrls:d=>r(d),setCenterWidth:d=>{o.current&&(o.current.style.width=d)},setViewportScrollLeft:d=>{c.current&&(c.current.scrollLeft=d)},setPinnedContainerWidth:d=>{c.current&&(c.current.style.width=d,c.current.style.minWidth=d,c.current.style.maxWidth=d)}};a.current.setComp(f,c.current)},[]),m=t?"":"ag-hidden",w=()=>n.map(g=>Je.createElement(Cn,{ctrl:g,key:g.instanceId}));return l?Je.createElement("div",{ref:C,className:"ag-pinned-left-header "+m,"aria-hidden":!t,role:"rowgroup"},w()):u?Je.createElement("div",{ref:C,className:"ag-pinned-right-header "+m,"aria-hidden":!t,role:"rowgroup"},w()):E?Je.createElement("div",{ref:C,className:"ag-header-viewport "+m,role:"presentation",tabIndex:-1},Je.createElement("div",{ref:o,className:"ag-header-container",role:"rowgroup"},w())):null},Rt=Gr(gn),yn=()=>{const[e,t]=zt(()=>new ae),[s,n]=zt(),{context:r}=xr(Z),i=jt(null),c=jt(),o=Mr(u=>{if(i.current=u,c.current=u?r.createBean(new Ar):r.destroyBean(c.current),!u)return;const E={toggleCss:(C,m)=>t(w=>w.setClass(C,m)),setHeightAndMinHeight:C=>n(C)};c.current.setComp(E,u,u)},[]),a=Lt(()=>"ag-header "+e.toString(),[e]),l=Lt(()=>({height:s,minHeight:s}),[s]);return lt.createElement("div",{ref:o,className:a,style:l,role:"presentation"},lt.createElement(Rt,{pinned:"left"}),lt.createElement(Rt,{pinned:null}),lt.createElement(Rt,{pinned:"right"}))},vn=Fr(yn);import{useEffect as wn}from"react";var Rn=(e,t)=>{wn(()=>{const s=t.current;if(s){const n=s.parentElement;if(n){const r=document.createComment(e);return n.insertBefore(r,s),()=>{n.removeChild(r)}}}},[e])},ke=Rn;import Ye,{memo as bn,useCallback as We,useContext as En,useMemo as mt,useRef as he,useState as Qt}from"react";import{RowContainerCtrl as Sn,_getRowContainerClass as Pn,_getRowContainerOptions as kn,_getRowSpanContainerClass as Fn,_getRowViewportClass as Mn}from"ag-grid-community";import ht,{memo as xn,useCallback as Yt,useContext as Zt,useEffect as Xt,useLayoutEffect as An,useMemo as es,useRef as fe,useState as Ce}from"react";import{CssClassManager as Gn,_EmptyBean as Bn}from"ag-grid-community";import de,{Suspense as Dn,memo as In,useCallback as Te,useContext as On,useLayoutEffect as bt,useMemo as Et,useRef as ie,useState as ge}from"react";import{CssClassManager as Wn,_EmptyBean as Tn,_removeFromParent as Nn}from"ag-grid-community";import{AgPromise as Hn}from"ag-grid-community";var Un=class{constructor(e,t){this.cellEditorParams=e,this.refreshProps=t,this.instanceCreated=new Hn(s=>{this.resolveInstanceCreated=s}),this.onValueChange=s=>this.updateValue(s),this.value=e.value}getProps(){return{...this.cellEditorParams,initialValue:this.cellEditorParams.value,value:this.value,onValueChange:this.onValueChange}}getValue(){return this.value}refresh(e){this.cellEditorParams=e,this.refreshProps()}setMethods(e){ot(this.getOptionalMethods(),e,this)}getInstance(){return this.instanceCreated.then(()=>this.componentInstance)}setRef(e){this.componentInstance=e,this.resolveInstanceCreated?.(),this.resolveInstanceCreated=void 0}getOptionalMethods(){return["isCancelBeforeStart","isCancelAfterEnd","focusIn","focusOut","afterGuiAttached","getValidationErrors","getValidationElement"]}updateValue(e){this.value=e,this.refreshProps()}};import Ne from"react";import{memo as _n,useContext as Vn,useLayoutEffect as Ln,useState as jn}from"react";import{createPortal as zn}from"react-dom";import{_getActiveDomElement as $n}from"ag-grid-community";import{useEffect as Jn,useRef as ft,useState as qn}from"react";var Kn=e=>{const t=ft(e),s=ft(),n=ft(!1),r=ft(!1),[,i]=qn(0);n.current&&(r.current=!0),Jn(()=>(n.current||(s.current=t.current(),n.current=!0),i(c=>c+1),()=>{r.current&&s.current?.()}),[])},Qn=e=>{const[t,s]=jn(),n=Vn(Z),{context:r,popupSvc:i,gos:c,editSvc:o}=n,{editDetails:a,cellCtrl:l,eParentCell:u}=e;return Kn(()=>{const{compDetails:E}=a,C=c.get("stopEditingWhenCellsLoseFocus"),m=r.createBean(o.createPopupEditorWrapper(E.params)),w=m.getGui();if(e.jsChildComp){const p=e.jsChildComp.getGui();p&&w.appendChild(p)}const{column:g,rowNode:f}=l,d={column:g,rowNode:f,type:"popupCellEditor",eventSource:u,ePopup:w,position:a.popupPosition,keepWithinBounds:!0},v=i?.positionPopupByComponent.bind(i,d),R=i?.addPopup({modal:C,eChild:w,closeOnEsc:!0,closedCallback:()=>{l.onPopupEditorClosed()},anchorToElement:u,positionCallback:v,ariaOwns:u}),G=R?R.hideFunc:void 0;return s(m),e.jsChildComp?.afterGuiAttached?.(),()=>{G?.(),r.destroyBean(m)}}),Ln(()=>()=>{l.isCellFocused()&&t?.getGui().contains($n(n))&&u.focus({preventScroll:!0})},[t]),t&&e.wrappedContent?zn(e.wrappedContent,t.getGui()):null},ts=_n(Qn),Yn=(e,t,s)=>{const{compProxy:n}=e;s(n);const r=n.getProps(),i=Ge(t);return Ne.createElement(je.Provider,{value:{setMethods:c=>n.setMethods(c)}},i?Ne.createElement(t,{...r}):Ne.createElement(t,{...r,ref:c=>n.setRef(c)}))},ss=(e,t,s)=>e.compProxy?Yn(e,t,s):Ne.createElement(t,{...e.compDetails.params,ref:s}),Zn=(e,t,s,n,r)=>{const i=e.compDetails,c=i.componentClass,o=i.componentFromFramework&&!e.popup,a=i.componentFromFramework&&e.popup,l=!i.componentFromFramework&&e.popup;return o?ss(e,c,t):a?Ne.createElement(ts,{editDetails:e,cellCtrl:n,eParentCell:s,wrappedContent:ss(e,c,t)}):l&&r?Ne.createElement(ts,{editDetails:e,cellCtrl:n,eParentCell:s,jsChildComp:r}):null};import{useCallback as Xn,useContext as eo,useEffect as rs}from"react";var to=(e,t,s,n,r,i)=>{const{context:c}=eo(Z),o=Xn(()=>{const a=r.current;if(!a)return;const l=a.getGui();l&&l.parentElement&&l.parentElement.removeChild(l),c.destroyBean(a),r.current=void 0},[]);rs(()=>{const a=e!=null,l=e?.compDetails&&!e.compDetails.componentFromFramework,u=t&&s==null;if(!(a&&l&&!u)){o();return}const C=e.compDetails;if(r.current){const w=r.current,f=w.refresh!=null&&e.force==!1?w.refresh(C.params):!1;if(f===!0||f===void 0)return;o()}C.newAgStackInstance().then(w=>{if(!w)return;const g=w.getGui();if(!g)return;(t?s:i.current).appendChild(g),r.current=w})},[e,t,n]),rs(()=>o,[])},ns=to;import St,{useMemo as so,useRef as ro}from"react";var no=({cellCtrl:e,parent:t})=>{const s=ro(),n=so(()=>{const{loadingComp:r}=e.getDeferLoadingCellRenderer();return r?{value:void 0,compDetails:r,force:!1}:void 0},[e]);if(ns(n,!1,void 0,1,s,t),n?.compDetails?.componentFromFramework){const r=n.compDetails.componentClass;return St.createElement(r,{...n.compDetails.params})}return St.createElement(St.Fragment,null)},oo=({cellCtrl:e,printLayout:t,editingCell:s})=>{const n=On(Z),{context:r}=n,{column:{colIdSanitised:i},instanceId:c}=e,o=ie(),[a,l]=ge(()=>e.isCellRenderer()?void 0:{compDetails:void 0,value:e.getValueToDisplay(),force:!1}),[u,E]=ge(),[C,m]=ge(1),[w,g]=ge(),[f,d]=ge(!1),[v,R]=ge(!1),[G,p]=ge(!1),[O,I]=ge(),V=Et(()=>e.isForceWrapper(),[e]),B=Et(()=>e.getCellAriaRole(),[e]),P=ie(null),b=ie(null),h=ie(null),y=ie(),L=ie(),k=ie(),W=ie([]),T=ie(),[F,N]=ge(0),M=Te(S=>{T.current=S,N(_=>_+1)},[]),H=a!=null&&(f||G||v)&&(u==null||!!u.popup),x=V||H,D=Te(S=>{if(L.current=S,S){const _=S.isCancelBeforeStart&&S.isCancelBeforeStart();setTimeout(()=>{_?(e.stopEditing(!0),e.focusCell(!0)):(e.cellEditorAttached(),e.enableEditorTooltipFeature(S))})}},[e]),U=ie();U.current||(U.current=new Wn(()=>P.current)),ns(a,x,T.current,F,y,P);const q=ie();bt(()=>{const S=q.current,_=a;if(q.current=a,S==null||S.compDetails==null||_==null||_.compDetails==null)return;const $=S.compDetails,re=_.compDetails;if($.componentClass!=re.componentClass||h.current?.refresh==null)return;h.current.refresh(re.params)!=!0&&m(J=>J+1)},[a]),bt(()=>{if(!(u&&!u.compDetails.componentFromFramework))return;const _=u.compDetails,$=u.popup===!0,re=_.newAgStackInstance();return re.then(A=>{if(!A)return;const J=A.getGui();D(A),$||((V?k:P).current?.appendChild(J),A.afterGuiAttached&&A.afterGuiAttached()),I(A)}),()=>{re.then(A=>{const J=A.getGui();e.disableEditorTooltipFeature(),r.destroyBean(A),D(void 0),I(void 0),J?.parentElement?.removeChild(J)})}},[u]);const pe=Te(S=>{if(k.current=S,!S){W.current.forEach($=>$()),W.current=[];return}const _=$=>{if($){const re=$.getGui();S.insertAdjacentElement("afterbegin",re),W.current.push(()=>{r.destroyBean($),Nn(re)})}return $};if(f){const $=e.createSelectionCheckbox();_($)}G&&_(e.createDndSource()),v&&_(e.createRowDragComp())},[e,r,G,v,f]),Fe=Te(()=>{const S=!e.isCellSpanning()||b.current,_=P.current;if(o.current=_?r.createBean(new Tn):r.destroyBean(o.current),!_||!S||!e)return;const $={toggleCss:(A,J)=>U.current.toggleCss(A,J),setUserStyles:A=>g(A),getFocusableElement:()=>P.current,setIncludeSelection:A=>d(A),setIncludeRowDrag:A=>R(A),setIncludeDndSource:A=>p(A),getCellEditor:()=>L.current||null,getCellRenderer:()=>h.current??y.current,getParentOfValue:()=>T.current??k.current??P.current,setRenderDetails:(A,J,K)=>{const Q=()=>{l(Y=>Y?.compDetails!==A||Y?.value!==J||Y?.force!==K?{value:J,compDetails:A,force:K}:Y)};if(A?.params?.deferRender&&!e.rowNode.group){const{loadingComp:Y,onReady:me}=e.getDeferLoadingCellRenderer();if(Y){l({value:void 0,compDetails:Y,force:!1}),me.then(()=>Ws(Q));return}}Q()},setEditDetails:(A,J,K,Q)=>{if(A){let Y;A.componentFromFramework&&(Q?Y=new Un(A.params,()=>m(me=>me+1)):at()),E({compDetails:A,popup:J,popupPosition:K,compProxy:Y}),J||l(void 0)}else e.hasBrowserFocus()&&$.getFocusableElement().focus({preventScroll:!0}),E(me=>{me?.compProxy&&(L.current=void 0)})},refreshEditStyles:(A,J)=>{if(!P.current)return;const{current:K}=U;K.toggleCss("ag-cell-value",!x),K.toggleCss("ag-cell-inline-editing",!!A&&!J),K.toggleCss("ag-cell-popup-editing",!!A&&!!J),K.toggleCss("ag-cell-not-inline-editing",!A||!!J)}},re=k.current||void 0;e.setComp($,_,b.current??void 0,re,t,s,o.current)},[]),Ue=Te(S=>{P.current=S,Fe()},[]),j=Te(S=>{b.current=S,Fe()},[]),ve=Et(()=>!!(a?.compDetails?.componentFromFramework&&Ge(a.compDetails.componentClass)),[a]);bt(()=>{if(!P.current)return;const{current:S}=U;S.toggleCss("ag-cell-value",!x),S.toggleCss("ag-cell-inline-editing",!!u&&!u.popup),S.toggleCss("ag-cell-popup-editing",!!u&&!!u.popup),S.toggleCss("ag-cell-not-inline-editing",!u||!!u.popup)});const X=()=>{const{compDetails:S,value:_}=a;if(!S)return _?.toString?.()??_;if(S.componentFromFramework){const $=S.componentClass;return de.createElement(Dn,{fallback:de.createElement(no,{cellCtrl:e,parent:P})},ve?de.createElement($,{...S.params,key:C}):de.createElement($,{...S.params,key:C,ref:h}))}},le=()=>{const S=()=>a==null?null:x?de.createElement("span",{role:"presentation",id:`cell-${c}`,className:"ag-cell-value",ref:M},X()):X(),_=$=>Zn($,D,P.current,e,O);return u!=null?u.popup?de.createElement(de.Fragment,null,S(),_(u)):_(u):S()},we=()=>de.createElement("div",{ref:Ue,style:w,role:B,"col-id":i},x?de.createElement("div",{className:"ag-cell-wrapper",role:"presentation",ref:pe},le()):le());return e.isCellSpanning()?de.createElement("div",{ref:j,className:"ag-spanned-cell-wrapper",role:"presentation"},we()):we()},ao=In(oo),co=({rowCtrl:e,containerType:t})=>{const{context:s,gos:n,editSvc:r}=Zt(Z),i=Zt(Dt)==="default",c=fe(),o=fe(e.getDomOrder()),a=e.isFullWidth(),l=e.rowNode.displayed,[u,E]=Ce(()=>l?e.rowNode.getRowIndexString():null),[C,m]=Ce(()=>e.rowId),[w,g]=Ce(()=>e.businessKey),[f,d]=Ce(()=>e.rowStyles),v=fe(null),[R,G]=Ce(()=>null),[p,O]=Ce(),[I,V]=Ce(()=>l?e.getInitialRowTop(t):void 0),[B,P]=Ce(()=>l?e.getInitialTransform(t):void 0),b=fe(null),h=fe(),y=fe(!1),[L,k]=Ce(0);Xt(()=>{if(y.current||!p||L>10)return;const j=b.current?.firstChild;j?(e.setupDetailRowAutoHeight(j),y.current=!0):k(ve=>ve+1)},[p,L]);const W=fe();W.current||(W.current=new Gn(()=>b.current));const T=fe(()=>{}),F=Yt(j=>(T.current=j,()=>{T.current=()=>{}}),[]),N=Ts(F,()=>v.current,[]),M=i?N:R,H=Yt(j=>{if(b.current=j,c.current=j?s.createBean(new Bn):s.destroyBean(c.current),!j){e.unsetComp(t);return}if(!e.isAlive())return;const ve={setTop:V,setTransform:P,toggleCss:(X,le)=>W.current.toggleCss(X,le),setDomOrder:X=>o.current=X,setRowIndex:E,setRowId:m,setRowBusinessKey:g,setUserStyles:d,setCellCtrls:(X,le)=>{const we=v.current,S=nt(we,X,o.current);S!==we&&(v.current=S,i?T.current():Le(le,()=>G(S)))},showFullWidth:X=>O(X),getFullWidthCellRenderer:()=>h.current,refreshFullWidth:X=>pe.current?(O(le=>({...le,params:X()})),!0):!h.current||!h.current.refresh?!1:h.current.refresh(X())};e.setComp(ve,j,t,c.current)},[]);An(()=>Ve(p,s,b.current,h),[p]);const x=es(()=>{const j={top:I,transform:B};return Object.assign(j,f),j},[I,B,f]),D=a&&p?.componentFromFramework,U=!a&&M!=null,q=es(()=>!!(p?.componentFromFramework&&Ge(p.componentClass)),[p]),pe=fe(!1);Xt(()=>{pe.current=q&&!!p&&!!n.get("reactiveCustomComponents")},[q,p]);const Fe=()=>M?.map(j=>ht.createElement(ao,{cellCtrl:j,editingCell:r?.isEditing(j,{withOpenEditor:!0})??!1,printLayout:e.printLayout,key:j.instanceId})),Ue=()=>{const j=p.componentClass;return q?ht.createElement(j,{...p.params}):ht.createElement(j,{...p.params,ref:h})};return ht.createElement("div",{ref:H,role:"row",style:x,"row-index":u,"row-id":C,"row-business-key":w},U?Fe():D?Ue():null)},os=xn(co),io=({name:e})=>{const{context:t,gos:s}=En(Z),n=mt(()=>kn(e),[e]),r=he(null),i=he(null),c=he(null),o=he([]),a=he([]),[l,u]=Qt(()=>[]),E=!!s.get("enableCellSpan")&&!!n.getSpannedRowCtrls,C=he([]),m=he([]),[w,g]=Qt(()=>[]),f=he(!1),d=he(),v=mt(()=>oe("ag-viewport",Mn(e)),[e]),R=mt(()=>oe(Pn(e)),[e]),G=mt(()=>oe("ag-spanning-container",Fn(e)),[e]),p=n.type==="center"||E,O=p?r:i;ke(" AG Row Container "+e+" ",O);const I=We(()=>{const k=!p||r.current!=null,W=i.current!=null,T=!E||c.current!=null;return k&&W&&T},[]),V=We(()=>r.current==null&&i.current==null&&c.current==null,[]),B=We(()=>{if(V()&&(d.current=t.destroyBean(d.current)),I()){const k=F=>{const N=nt(a.current,o.current,f.current);N!==a.current&&(a.current=N,Le(F,()=>u(N)))},W=F=>{const N=nt(m.current,C.current,f.current);N!==m.current&&(m.current=N,Le(F,()=>g(N)))},T={setHorizontalScroll:F=>{r.current&&(r.current.scrollLeft=F)},setViewportHeight:F=>{r.current&&(r.current.style.height=F)},setRowCtrls:({rowCtrls:F,useFlushSync:N})=>{const M=!!N&&o.current.length>0&&F.length>0;o.current=F,k(M)},setSpannedRowCtrls:(F,N)=>{const M=!!N&&C.current.length>0&&F.length>0;C.current=F,W(M)},setDomOrder:F=>{f.current!=F&&(f.current=F,k(!1))},setContainerWidth:F=>{i.current&&(i.current.style.width=F)},setOffsetTop:F=>{i.current&&(i.current.style.transform=`translateY(${F})`)}};d.current=t.createBean(new Sn(e)),d.current.setComp(T,i.current,c.current??void 0,r.current)}},[I,V]),P=We(k=>{i.current=k,B()},[B]),b=We(k=>{c.current=k,B()},[B]),h=We(k=>{r.current=k,B()},[B]),y=()=>Ye.createElement("div",{className:R,ref:P,role:"rowgroup"},l.map(k=>Ye.createElement(os,{rowCtrl:k,containerType:n.type,key:k.instanceId})));if(!p)return y();const L=()=>Ye.createElement("div",{className:G,ref:b,role:"rowgroup"},w.map(k=>Ye.createElement(os,{rowCtrl:k,containerType:n.type,key:k.instanceId})));return Ye.createElement("div",{className:v,ref:h,role:"presentation"},y(),E?L():null)},lo=bn(io),uo=()=>{const e=vr(Z),{context:t,overlays:s}=e,[n,r]=ee(""),[i,c]=ee(0),[o,a]=ee(0),[l,u]=ee("0px"),[E,C]=ee("0px"),[m,w]=ee("100%"),[g,f]=ee("0px"),[d,v]=ee("0px"),[R,G]=ee("100%"),[p,O]=ee(!0),[I,V]=ee(!0),[B,P]=ee(null),[b,h]=ee(""),[y,L]=ee(null),[k,W]=ee("ag-layout-normal"),T=ue();T.current||(T.current=new wr(()=>F.current));const F=ue(null),N=ue(null),M=ue(null),H=ue(null),x=ue(null),D=ue(null),U=ue(null),q=ue([]),pe=ue([]);ke(" AG Grid Body ",F),ke(" AG Pinned Top ",N),ke(" AG Sticky Top ",M),ke(" AG Middle ",D),ke(" AG Pinned Bottom ",U);const Fe=yr(Q=>{if(F.current=Q,!Q){q.current=t.destroyBeans(q.current),pe.current.forEach(z=>z()),pe.current=[];return}if(!t)return;const Y=(z,te)=>{z.appendChild(te),pe.current.push(()=>z.removeChild(te))},me=z=>{const te=t.createBean(new z);return q.current.push(te),te},_e=(z,te,ds)=>{Y(z,document.createComment(ds)),Y(z,me(te).getGui())};_e(Q,Rr," AG Fake Horizontal Scroll ");const xt=s?.getOverlayWrapperCompClass();xt&&_e(Q,xt," AG Overlay Wrapper "),x.current&&_e(x.current,br," AG Fake Vertical Scroll ");const us={setRowAnimationCssOnBodyViewport:r,setColumnCount:z=>{F.current&&Pr(F.current,z)},setRowCount:z=>{F.current&&kr(F.current,z)},setTopHeight:c,setBottomHeight:a,setStickyTopHeight:u,setStickyTopTop:C,setStickyTopWidth:w,setTopInvisible:O,setBottomInvisible:V,setColumnMovingCss:(z,te)=>T.current.toggleCss(z,te),updateLayoutClasses:W,setAlwaysVerticalScrollClass:P,setPinnedTopBottomOverflowY:h,setCellSelectableCss:(z,te)=>L(te?z:null),setBodyViewportWidth:z=>{D.current&&(D.current.style.width=z)},registerBodyViewportResizeListener:z=>{if(D.current){const te=Sr(e,D.current,z);pe.current.push(()=>te())}},setStickyBottomHeight:f,setStickyBottomBottom:v,setStickyBottomWidth:G,setGridRootRole:z=>Q.setAttribute("role",z)},At=t.createBean(new Er);q.current.push(At),At.setComp(us,Q,D.current,N.current,U.current,M.current,H.current)},[]),Ue=ce(()=>oe("ag-root","ag-unselectable",k),[k]),j=ce(()=>oe("ag-body-viewport",n,k,B,y),[n,k,B,y]),ve=ce(()=>oe("ag-body",k),[k]),X=ce(()=>oe("ag-floating-top",p?"ag-invisible":null,y),[y,p]),le=ce(()=>oe("ag-sticky-top",y),[y]),we=ce(()=>oe("ag-sticky-bottom",g==="0px"?"ag-invisible":null,y),[y,g]),S=ce(()=>oe("ag-floating-bottom",I?"ag-invisible":null,y),[y,I]),_=ce(()=>({height:i,minHeight:i,overflowY:b}),[i,b]),$=ce(()=>({height:l,top:E,width:m}),[l,E,m]),re=ce(()=>({height:g,bottom:d,width:R}),[g,d,R]),A=ce(()=>({height:o,minHeight:o,overflowY:b}),[o,b]),J=Q=>$e.createElement(lo,{name:Q,key:`${Q}-container`}),K=({section:Q,children:Y,className:me,style:_e})=>$e.createElement("div",{ref:Q,className:me,role:"presentation",style:_e},Y.map(J));return $e.createElement("div",{ref:Fe,className:Ue},$e.createElement(vn,null),K({section:N,className:X,style:_,children:["topLeft","topCenter","topRight","topFullWidth"]}),$e.createElement("div",{className:ve,ref:x,role:"presentation"},K({section:D,className:j,children:["left","center","right","fullWidth"]})),K({section:M,className:le,style:$,children:["stickyTopLeft","stickyTopCenter","stickyTopRight","stickyTopFullWidth"]}),K({section:H,className:we,style:re,children:["stickyBottomLeft","stickyBottomCenter","stickyBottomRight","stickyBottomFullWidth"]}),K({section:U,className:S,style:A,children:["bottomLeft","bottomCenter","bottomRight","bottomFullWidth"]}))},po=gr(uo);import Pt,{forwardRef as mo,memo as ho,useCallback as kt,useContext as fo,useImperativeHandle as Co,useRef as Ft}from"react";import{TabGuardClassNames as Mt,TabGuardCtrl as go}from"ag-grid-community";var yo=(e,t)=>{const{children:s,eFocusableElement:n,onTabKeyDown:r,gridCtrl:i,forceFocusOutWhenTabGuardsAreEmpty:c,isEmpty:o}=e,{context:a}=fo(Z),l=Ft(null),u=Ft(null),E=Ft(),C=d=>{const v=d==null?void 0:parseInt(d,10).toString();[l,u].forEach(R=>{v===void 0?R.current?.removeAttribute("tabindex"):R.current?.setAttribute("tabindex",v)})};Co(t,()=>({forceFocusOutOfContainer(d){E.current?.forceFocusOutOfContainer(d)}}));const m=kt(()=>{const d=l.current,v=u.current;if(!d&&!v){E.current=a.destroyBean(E.current);return}if(d&&v){const R={setTabIndex:C};E.current=a.createBean(new go({comp:R,eTopGuard:d,eBottomGuard:v,eFocusableElement:n,onTabKeyDown:r,forceFocusOutWhenTabGuardsAreEmpty:c,focusInnerElement:G=>i.focusInnerElement(G),isEmpty:o}))}},[]),w=kt(d=>{l.current=d,m()},[m]),g=kt(d=>{u.current=d,m()},[m]),f=d=>{const v=d==="top"?Mt.TAB_GUARD_TOP:Mt.TAB_GUARD_BOTTOM;return Pt.createElement("div",{className:`${Mt.TAB_GUARD} ${v}`,role:"presentation",ref:d==="top"?w:g})};return Pt.createElement(Pt.Fragment,null,f("top"),s,f("bottom"))},vo=mo(yo),wo=ho(vo),Ro=({context:e})=>{const[t,s]=Ee(""),[n,r]=Ee(""),[i,c]=Ee(null),[o,a]=Ee(null),[l,u]=Ee(!1),[E,C]=Ee(),m=Be(),w=Be(null),g=Be(),[f,d]=Ee(null),v=Be(()=>{}),R=Be(),G=Be([]),p=ct(()=>{},[]),O=it(()=>e.isDestroyed()?null:e.getBeans(),[e]);ke(" AG Grid ",w);const I=ct(y=>{if(w.current=y,m.current=y?e.createBean(new Cr):e.destroyBean(m.current),!y||e.isDestroyed())return;const L=m.current;v.current=L.focusInnerElement.bind(L);const k={destroyGridUi:()=>{},setRtlClass:s,forceFocusOutOfContainer:W=>{if(!W&&R.current?.isDisplayed()){R.current.forceFocusOutOfContainer(W);return}g.current?.forceFocusOutOfContainer(W)},updateLayoutClasses:r,getFocusableContainers:()=>{const W=[],T=w.current?.querySelector(".ag-root");return T&&W.push({getGui:()=>T}),G.current.forEach(F=>{F.isDisplayed()&&W.push(F)}),W},setCursor:c,setUserSelect:a};L.setComp(k,y,y),u(!0)},[]);fr(()=>{const y=m.current,L=w.current;if(!E||!O||!y||!f||!L||e.isDestroyed())return;const k=[],{watermarkSelector:W,paginationSelector:T,sideBarSelector:F,statusBarSelector:N,gridHeaderDropZonesSelector:M}=y.getOptionalSelectors(),H=[];if(M){const D=e.createBean(new M.component),U=D.getGui();L.insertAdjacentElement("afterbegin",U),H.push(U),k.push(D)}if(F){const D=e.createBean(new F.component),U=D.getGui(),q=f.querySelector(".ag-tab-guard-bottom");q&&(q.insertAdjacentElement("beforebegin",U),H.push(U)),k.push(D),G.current.push(D)}const x=D=>{const U=e.createBean(new D),q=U.getGui();return L.insertAdjacentElement("beforeend",q),H.push(q),k.push(U),U};if(N&&x(N.component),T){const D=x(T.component);R.current=D,G.current.push(D)}return W&&x(W.component),()=>{e.destroyBeans(k),H.forEach(D=>{D.parentElement?.removeChild(D)})}},[E,f,O]);const V=it(()=>oe("ag-root-wrapper",t,n),[t,n]),B=it(()=>oe("ag-root-wrapper-body","ag-focus-managed",n),[n]),P=it(()=>({userSelect:o??"",WebkitUserSelect:o??"",cursor:i??""}),[o,i]),b=ct(y=>{g.current=y,C(y!==null)},[]),h=ct(()=>!m.current?.isFocusable(),[]);return ze.createElement("div",{ref:I,className:V,style:P,role:"presentation"},ze.createElement("div",{className:B,ref:d,role:"presentation"},l&&f&&O&&ze.createElement(Z.Provider,{value:O},ze.createElement(wo,{ref:b,eFocusableElement:f,onTabKeyDown:p,gridCtrl:m.current,forceFocusOutWhenTabGuardsAreEmpty:!0,isEmpty:h},ze.createElement(po,null)))))},bo=hr(Ro);import{BeanStub as Eo}from"ag-grid-community";var So=class extends Eo{wireBeans(e){this.ctrlsSvc=e.ctrlsSvc}areHeaderCellsRendered(){return this.ctrlsSvc.getHeaderRowContainerCtrls().every(e=>e.getAllCtrls().every(t=>t.areCellsRendered()))}},as={setGridApi:void 0,maxComponentCreationTimeMs:void 0,children:void 0},Po={gridOptions:void 0,modules:void 0,containerStyle:void 0,className:void 0,passGridApi:void 0,componentWrappingElement:void 0,...as},cs=new Set(Object.keys(Po)),ko=new Set(Object.keys(as)),is=e=>{const t=ne(),s=ne(null),n=ne(null),r=ne([]),i=ne([]),c=ne(e),o=ne(),a=ne(),l=ne(!1),[u,E]=xe(void 0),[,C]=xe(0),m=Ze(d=>{if(s.current=d,!d){r.current.forEach(b=>b()),r.current.length=0;return}const v=e.modules||[];n.current||(n.current=new mr(()=>C(b=>b+1),e.componentWrappingElement,e.maxComponentCreationTimeMs),r.current.push(()=>{n.current?.destroy(),n.current=null}));const R=Rs(e.gridOptions,e,Object.keys(e).filter(b=>!cs.has(b))),G=()=>{if(l.current){const b=()=>o.current?.shouldQueueUpdates()?void 0:i.current.shift();let h=b();for(;h;)h(),h=b()}},p=new Ao(G);o.current=p;const O=new So,I={providedBeanInstances:{frameworkCompWrapper:new Mo(n.current,R),renderStatus:O},modules:v,frameworkOverrides:p,setThemeOnGridDiv:!0},V=b=>{E(b),b.createBean(O),r.current.push(()=>{b.destroy()}),b.getBean("ctrlsSvc").whenReady({addDestroyFunc:h=>{r.current.push(h)}},()=>{if(b.isDestroyed())return;const h=t.current;h&&e.passGridApi?.(h)})},B=b=>{b.getBean("ctrlsSvc").whenReady({addDestroyFunc:h=>{r.current.push(h)}},()=>{i.current.forEach(h=>h()),i.current.length=0,l.current=!0})},P=new vs;R.gridId??(R.gridId=a.current),t.current=P.create(d,R,V,B,I),r.current.push(()=>{t.current=void 0}),t.current&&(a.current=t.current.getGridId())},[]),w=Xe(()=>({height:"100%",...e.containerStyle||{}}),[e.containerStyle]),g=Ze(d=>{l.current&&!o.current?.shouldQueueUpdates()?d():i.current.push(d)},[]);Cs(()=>{const d=Fo(c.current,e);c.current=e,g(()=>{t.current&&ks(d,t.current)})},[e]);const f=!Me.useSyncExternalStore||et(e,"renderingMode")==="legacy"?"legacy":"default";return Me.createElement("div",{style:w,className:e.className,ref:m},Me.createElement(Dt.Provider,{value:f},u&&!u.isDestroyed()?Me.createElement(bo,{context:u}):null,n.current?.getPortals()??null))};function Fo(e,t){const s={};return Object.keys(t).forEach(n=>{if(cs.has(n)){ko.has(n)&&Gt(274,{prop:n});return}const r=t[n];e[n]!==r&&(s[n]=r)}),s}var Mo=class extends ys{constructor(e,t){super(),this.parent=e,this.gridOptions=t}createWrapper(e,t){const s=this.gridOptions;if(et(s,"reactiveCustomComponents")){const c=(o=>{switch(o){case"filter":return et(s,"enableFilterHandlers")?Zs:Qs;case"floatingFilterComponent":return et(s,"enableFilterHandlers")?sr:tr;case"dateComponent":return qs;case"dragAndDropImageComponent":return Ks;case"loadingOverlayComponent":return nr;case"noRowsOverlayComponent":return ar;case"statusPanel":return cr;case"toolPanel":return ir;case"menuItem":return or;case"cellRenderer":return Js;case"innerHeaderComponent":return rr}})(t.name);if(c)return new c(e,this.parent,t)}else switch(t.name){case"filter":case"floatingFilterComponent":case"dateComponent":case"dragAndDropImageComponent":case"loadingOverlayComponent":case"noRowsOverlayComponent":case"statusPanel":case"toolPanel":case"menuItem":case"cellRenderer":at();break}const r=!t.cellRenderer&&t.name!=="toolPanel";return new Ut(e,this.parent,t,r)}},xo=hs((e,t)=>{const s=fs(Z),{registry:n,context:r,gos:i,rowModel:c}=s,[o,a]=xe(()=>new ae),[l,u]=xe(()=>new ae),[E,C]=xe(),[m,w]=xe(),g=ne(),f=ne(null),d=ne(),v=Xe(()=>bs(e.api.getGridId(),E?.rowModelType??"clientSide"),[e]),R=Xe(()=>o.toString()+" ag-details-row",[o]),G=Xe(()=>l.toString()+" ag-details-grid",[l]);t&&gs(t,()=>({refresh(){return g.current?.refresh()??!1}})),e.template&&Gt(230);const p=Ze(I=>{if(f.current=I,!I){g.current=r.destroyBean(g.current),d.current?.();return}const V={toggleCss:(P,b)=>a(h=>h.setClass(P,b)),toggleDetailGridCss:(P,b)=>u(h=>h.setClass(P,b)),setDetailGrid:P=>C(P),setRowData:P=>w(P),getGui:()=>f.current},B=n.createDynamicBean("detailCellRendererCtrl",!0);if(B&&(r.createBean(B),B.init(V,e),g.current=B,i.get("detailRowAutoHeight"))){const P=()=>{if(f.current==null)return;const b=f.current.clientHeight;b!=null&&b>0&&setTimeout(()=>{e.node.setRowHeight(b),(Es(i,c)||Ss(i,c))&&c.onRowHeightChanged()},0)};d.current=Ps(s,I,P),P()}},[]),O=Ze(I=>{g.current?.registerDetailWithMaster(I)},[]);return Me.createElement("div",{className:R,ref:p},E&&Me.createElement(is,{className:G,...E,modules:v,rowData:m,passGridApi:O}))}),Ao=class extends ws{constructor(e){super("react"),this.processQueuedUpdates=e,this.queueUpdates=!1,this.renderingEngine="react",this.frameworkComponents={agGroupCellRenderer:Tt,agGroupRowRenderer:Tt,agDetailCellRenderer:xo},this.wrapIncoming=(t,s)=>s==="ensureVisible"?Os(t):t()}frameworkComponent(e){return this.frameworkComponents[e]}isFrameworkComponent(e){if(!e)return!1;const t=e.prototype;return!(t&&"getGui"in t)}getLockOnRefresh(){this.queueUpdates=!0}releaseLockOnRefresh(){this.queueUpdates=!1,this.processQueuedUpdates()}shouldQueueUpdates(){return this.queueUpdates}runWhenReadyAsync(){return Is()}},Go=class extends ms{constructor(){super(...arguments),this.apiListeners=[],this.setGridApi=e=>{this.api=e,this.apiListeners.forEach(t=>t(e))}}registerApiListener(e){this.apiListeners.push(e)}componentWillUnmount(){this.apiListeners.length=0}render(){return ps.createElement(is,{...this.props,passGridApi:this.setGridApi})}};import{useContext as Bo}from"react";function He(e){const{setMethods:t}=Bo(je);t(e)}function Do(e){He(e)}function Io(e){return He(e)}function Oo(e){return He(e)}function Wo(e){return He(e)}function To(e){He(e)}function No(e){He(e)}export{Go as AgGridReact,je as CustomComponentContext,dr as getInstance,Do as useGridCellEditor,Io as useGridDate,Oo as useGridFilter,Wo as useGridFilterDisplay,To as useGridFloatingFilter,No as useGridMenuItem,at as warnReactiveCustomComponents};