UNPKG

@ag-grid-enterprise/row-grouping

Version:

Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue

15 lines 72.7 kB
var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,t)=>{for(var o in t)__defProp(e,o,{get:t[o],enumerable:!0})},__copyProps=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of __getOwnPropNames(t))!__hasOwnProp.call(e,i)&&i!==o&&__defProp(e,i,{get:()=>t[i],enumerable:!(r=__getOwnPropDesc(t,i))||r.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),main_exports={};__export(main_exports,{PivotDropZonePanel:()=>PivotDropZonePanel,RowGroupDropZonePanel:()=>RowGroupDropZonePanel,RowGroupingModule:()=>RowGroupingModule,ValuesDropZonePanel:()=>ValuesDropZonePanel}),module.exports=__toCommonJS(main_exports);var import_core22=require("@ag-grid-community/core"),import_core23=require("@ag-grid-enterprise/core"),import_core=require("@ag-grid-community/core"),defaultAggFuncNames={sum:"Sum",first:"First",last:"Last",min:"Min",max:"Max",count:"Count",avg:"Average"},AggFuncService=class extends import_core.BeanStub{constructor(){super(...arguments),this.beanName="aggFuncService",this.aggFuncsMap={},this.initialised=!1}postConstruct(){this.init()}init(){this.initialised||(this.initialiseWithDefaultAggregations(),this.addAggFuncs(this.gos.get("aggFuncs")))}initialiseWithDefaultAggregations(){const e=this.aggFuncsMap;e.sum=aggSum,e.first=aggFirst,e.last=aggLast,e.min=aggMin,e.max=aggMax,e.count=aggCount,e.avg=aggAvg,this.initialised=!0}isAggFuncPossible(e,t){const o=this.getFuncNames(e),r=(0,import_core._includes)(o,t),i=(0,import_core._exists)(this.aggFuncsMap[t]);return r&&i}getDefaultFuncLabel(e){return defaultAggFuncNames[e]??e}getDefaultAggFunc(e){const t=e.getColDef().defaultAggFunc;if((0,import_core._exists)(t)&&this.isAggFuncPossible(e,t))return t;if(this.isAggFuncPossible(e,"sum"))return"sum";const o=this.getFuncNames(e);return(0,import_core._existsAndNotEmpty)(o)?o[0]:null}addAggFuncs(e){this.init(),(0,import_core._iterateObject)(e,(t,o)=>{this.aggFuncsMap[t]=o})}getAggFunc(e){return this.init(),this.aggFuncsMap[e]}getFuncNames(e){const t=e.getColDef().allowedAggFuncs;return t??Object.keys(this.aggFuncsMap).sort()}clear(){this.aggFuncsMap={}}};function aggSum(e){const{values:t}=e;let o=null;for(let r=0;r<t.length;r++){const i=t[r];typeof i=="number"?o===null?o=i:o+=typeof o=="number"?i:BigInt(i):typeof i=="bigint"&&(o===null?o=i:o=(typeof o=="bigint"?o:BigInt(o))+i)}return o}function aggFirst(e){return e.values.length>0?e.values[0]:null}function aggLast(e){return e.values.length>0?(0,import_core._last)(e.values):null}function aggMin(e){const{values:t}=e;let o=null;for(let r=0;r<t.length;r++){const i=t[r];(typeof i=="number"||typeof i=="bigint")&&(o===null||o>i)&&(o=i)}return o}function aggMax(e){const{values:t}=e;let o=null;for(let r=0;r<t.length;r++){const i=t[r];(typeof i=="number"||typeof i=="bigint")&&(o===null||o<i)&&(o=i)}return o}function aggCount(e){const{values:t}=e;let o=0;for(let i=0;i<t.length;i++){const s=t[i];o+=s!=null&&typeof s.value=="number"?s.value:1}const r=e.rowNode?.aggData?.[e.column.getColId()];return r&&r.value===o?r:{value:o,toString:function(){return this.value.toString()},toNumber:function(){return this.value}}}function aggAvg(e){const{values:t}=e;let o=0,r=0;for(let n=0;n<t.length;n++){const l=t[n];let a=null;typeof l=="number"||typeof l=="bigint"?(a=l,r++):l!=null&&(typeof l.value=="number"||typeof l.value=="bigint")&&typeof l.count=="number"&&(a=l.value*(typeof l.value=="number"?l.count:BigInt(l.count)),r+=l.count),typeof a=="number"?o+=typeof o=="number"?a:BigInt(a):typeof a=="bigint"&&(o=(typeof o=="bigint"?o:BigInt(o))+a)}let i=null;r>0&&(i=o/(typeof o=="number"?r:BigInt(r)));const s=e.rowNode?.aggData?.[e.column?.getColId()];return s&&s.count===r&&s.value===i?s:{count:r,value:i,toString:function(){return typeof this.value=="number"||typeof this.value=="bigint"?this.value.toString():""},toNumber:function(){return this.value}}}var import_core2=require("@ag-grid-community/core"),AggregationStage=class extends import_core2.BeanStub{constructor(){super(...arguments),this.beanName="aggregationStage"}wireBeans(e){this.columnModel=e.columnModel,this.aggFuncService=e.aggFuncService,this.funcColsService=e.funcColsService,this.pivotResultColsService=e.pivotResultColsService,this.valueService=e.valueService}execute(e){const t=(0,import_core2._missingOrEmpty)(this.funcColsService.getValueColumns()),o=!this.gos.getCallback("getGroupRowAgg"),r=e.changedPath&&e.changedPath.isActive();if(t&&o&&r)return;const i=this.createAggDetails(e);this.recursivelyCreateAggData(i)}createAggDetails(e){const t=this.columnModel.isPivotActive(),o=this.funcColsService.getValueColumns(),r=t?this.funcColsService.getPivotColumns():[];return{alwaysAggregateAtRootLevel:this.gos.get("alwaysAggregateAtRootLevel"),groupIncludeTotalFooter:!!(0,import_core2._getGrandTotalRow)(this.gos),changedPath:e.changedPath,valueColumns:o,pivotColumns:r,filteredOnly:!this.isSuppressAggFilteredOnly(),userAggFunc:this.gos.getCallback("getGroupRowAgg")}}isSuppressAggFilteredOnly(){return(0,import_core2._getGroupAggFiltering)(this.gos)!==void 0||this.gos.get("suppressAggFilteredOnly")}recursivelyCreateAggData(e){const t=o=>{if(!o.hasChildren()){o.aggData&&o.setAggData(null);return}if(o.level===-1&&!e.groupIncludeTotalFooter){const s=!this.columnModel.isPivotMode();if(!e.alwaysAggregateAtRootLevel&&s){o.setAggData(null);return}}this.aggregateRowNode(o,e)};e.changedPath.forEachChangedNodeDepthFirst(t,!0)}aggregateRowNode(e,t){const o=t.valueColumns.length===0,r=t.pivotColumns.length===0;let i;t.userAggFunc?i=t.userAggFunc({nodes:e.childrenAfterFilter}):o?i=null:r?i=this.aggregateRowNodeUsingValuesOnly(e,t):i=this.aggregateRowNodeUsingValuesAndPivot(e),e.setAggData(i),e.sibling&&e.sibling.setAggData(i)}aggregateRowNodeUsingValuesAndPivot(e){const t={},o=this.pivotResultColsService.getPivotResultCols()?.list??[];let r=!0;for(let i=0;i<o.length;i++){const s=o[i],n=s.getColDef();if(n.pivotTotalColumnIds!=null){r=!1;continue}const l=n.pivotKeys??[];let a;e.leafGroup?a=this.getValuesFromMappedSet(e.childrenMapped,l,n.pivotValueColumn):a=this.getValuesPivotNonLeaf(e,n.colId),t[n.colId]=this.aggregateValues(a,n.pivotValueColumn.getAggFunc(),n.pivotValueColumn,e,s)}if(!r)for(let i=0;i<o.length;i++){const s=o[i],n=s.getColDef();if(n.pivotTotalColumnIds==null||!n.pivotTotalColumnIds.length)continue;const l=n.pivotTotalColumnIds.map(a=>t[a]);t[n.colId]=this.aggregateValues(l,n.pivotValueColumn.getAggFunc(),n.pivotValueColumn,e,s)}return t}aggregateRowNodeUsingValuesOnly(e,t){const o={},r=t.changedPath.isActive()?t.changedPath.getValueColumnsForNode(e,t.valueColumns):t.valueColumns,i=t.changedPath.isActive()?t.changedPath.getNotValueColumnsForNode(e,t.valueColumns):null,s=this.getValuesNormal(e,r,t.filteredOnly),n=e.aggData;return r.forEach((l,a)=>{o[l.getId()]=this.aggregateValues(s[a],l.getAggFunc(),l,e)}),i&&n&&i.forEach(l=>{o[l.getId()]=n[l.getId()]}),o}getValuesPivotNonLeaf(e,t){return e.childrenAfterFilter.map(o=>o.aggData[t])}getValuesFromMappedSet(e,t,o){let r=e;for(let i=0;i<t.length;i++){const s=t[i];r=r?r[s]:null}return r?r.map(i=>this.valueService.getValue(o,i)):[]}getValuesNormal(e,t,o){const r=[];t.forEach(()=>r.push([]));const i=t.length,s=o?e.childrenAfterFilter:e.childrenAfterGroup,n=s.length;for(let l=0;l<n;l++){const a=s[l];for(let u=0;u<i;u++){const c=t[u],d=this.valueService.getValue(c,a);r[u].push(d)}}return r}aggregateValues(e,t,o,r,i){const s=typeof t=="string"?this.aggFuncService.getAggFunc(t):t;if(typeof s!="function")return(0,import_core2._errorOnce)(`unrecognised aggregation function ${t}`),null;const n=s,l=this.gos.addGridCommonParams({values:e,column:o,colDef:o?o.getColDef():void 0,pivotResultColumn:i,rowNode:r,data:r?r.data:void 0});return n(l)}},import_core3=require("@ag-grid-community/core"),AutoColService=class extends import_core3.BeanStub{constructor(){super(...arguments),this.beanName="autoColService"}wireBeans(e){this.columnModel=e.columnModel,this.columnNameService=e.columnNameService,this.columnFactory=e.columnFactory}createAutoCols(e){const t=[],o=this.gos.get("treeData");let r=(0,import_core3._isGroupMultiAutoColumn)(this.gos);return o&&r&&((0,import_core3._warnOnce)('you cannot mix groupDisplayType = "multipleColumns" with treeData, only one column can be used to display groups when doing tree data'),r=!1),r?e.forEach((i,s)=>{t.push(this.createOneAutoCol(i,s))}):t.push(this.createOneAutoCol()),t}updateAutoCols(e,t){e.forEach((o,r)=>this.updateOneAutoCol(o,r,t))}createOneAutoCol(e,t){let o;e?o=`${import_core3.GROUP_AUTO_COLUMN_ID}-${e.getId()}`:o=import_core3.GROUP_AUTO_COLUMN_ID;const r=this.createAutoColDef(o,e,t);r.colId=o;const i=new import_core3.AgColumn(r,null,o,!0);return this.createBean(i),i}updateOneAutoCol(e,t,o){const r=e.getColDef(),i=typeof r.showRowGroup=="string"?r.showRowGroup:void 0,s=i!=null?this.columnModel.getColDefCol(i):void 0,n=this.createAutoColDef(e.getId(),s??void 0,t);e.setColDef(n,null,o),this.columnFactory.applyColumnState(e,n,o)}createAutoColDef(e,t,o){let r=this.createBaseColDef(t);const i=this.gos.get("autoGroupColumnDef");(0,import_core3._mergeDeep)(r,i),r=this.columnFactory.addColumnDefaultAndTypes(r,e),this.gos.get("treeData")||(0,import_core3._missing)(r.field)&&(0,import_core3._missing)(r.valueGetter)&&(0,import_core3._missing)(r.filterValueGetter)&&r.filter!=="agGroupColumnFilter"&&(r.filter=!1),o&&o>0&&(r.headerCheckboxSelection=!1);const s=(0,import_core3._isColumnsSortingCoupledToGroup)(this.gos),n=r.valueGetter||r.field!=null;return s&&!n&&(r.sortIndex=void 0,r.initialSort=void 0),r}createBaseColDef(e){const t=this.gos.get("autoGroupColumnDef"),r={headerName:this.localeService.getLocaleTextFunc()("group","Group")};if(t&&(t.cellRenderer||t.cellRendererSelector)||(r.cellRenderer="agGroupCellRenderer"),e){const s=e.getColDef();Object.assign(r,{headerName:this.columnNameService.getDisplayNameForColumn(e,"header"),headerValueGetter:s.headerValueGetter}),s.cellRenderer&&Object.assign(r,{cellRendererParams:{innerRenderer:s.cellRenderer,innerRendererParams:s.cellRendererParams}}),r.showRowGroup=e.getColId()}else r.showRowGroup=!0;return r}},import_core11=require("@ag-grid-community/core"),import_core10=require("@ag-grid-community/core"),import_core8=require("@ag-grid-community/core"),import_core6=require("@ag-grid-community/core"),import_core7=require("@ag-grid-enterprise/core"),import_core4=require("@ag-grid-community/core"),import_core5=require("@ag-grid-enterprise/core"),DropZoneColumnComp=class extends import_core5.PillDragComp{constructor(e,t,o,r,i){super(t,o,i,` <span role="option"> <span data-ref="eDragHandle" class="ag-drag-handle ag-column-drop-cell-drag-handle" role="presentation"></span> <span data-ref="eText" class="ag-column-drop-cell-text" aria-hidden="true"></span> <ag-sort-indicator data-ref="eSortIndicator"></ag-sort-indicator> <span data-ref="eButton" class="ag-column-drop-cell-button" role="presentation"></span> </span> `,[import_core4.SortIndicatorSelector]),this.column=e,this.dropZonePurpose=r,this.eSortIndicator=import_core4.RefPlaceholder,this.popupShowing=!1}wireBeans(e){super.wireBeans(e),this.popupService=e.popupService,this.sortController=e.sortController,this.columnModel=e.columnModel,this.columnNameService=e.columnNameService,this.funcColsService=e.funcColsService,this.aggFuncService=e.aggFuncService}postConstruct(){this.displayName=this.columnNameService.getDisplayNameForColumn(this.column,"columnDrop"),super.postConstruct(),this.setupSort(),this.addManagedEventListeners({sortChanged:()=>{this.setupAria()}}),this.isGroupingZone()&&this.addManagedPropertyListener("groupLockGroupColumns",()=>{this.refreshRemove(),this.refreshDraggable(),this.setupAria()})}getItem(){return this.column}getDisplayName(){return this.displayName}getTooltip(){return this.column.getColDef().headerTooltip}addAdditionalAriaInstructions(e,t){const o=this.gos.get("rowGroupPanelSuppressSort"),r=this.gos.get("functionsReadOnly");if(this.isAggregationZone()&&!r){const i=t("ariaDropZoneColumnValueItemDescription","Press ENTER to change the aggregation type");e.push(i)}if(this.isGroupingZone()&&this.column.isSortable()&&!o){const i=t("ariaDropZoneColumnGroupItemDescription","Press ENTER to sort");e.push(i)}super.addAdditionalAriaInstructions(e,t)}isDraggable(){return this.isReadOnly()}isRemovable(){return this.isReadOnly()}isReadOnly(){return!this.isGroupingAndLocked()&&!this.gos.get("functionsReadOnly")}getAriaDisplayName(){const e=this.localeService.getLocaleTextFunc(),{name:t,aggFuncName:o}=this.getColumnAndAggFuncName(),r=e("ariaDropZoneColumnComponentAggFuncSeparator"," of "),i={asc:e("ariaDropZoneColumnComponentSortAscending","ascending"),desc:e("ariaDropZoneColumnComponentSortDescending","descending")},s=this.column.getSort(),n=this.gos.get("rowGroupPanelSuppressSort");return[o&&`${o}${r}`,t,this.isGroupingZone()&&!n&&s&&`, ${i[s]}`].filter(l=>!!l).join("")}getColumnAndAggFuncName(){const e=this.displayName;let t="";if(this.isAggregationZone()){const o=this.column.getAggFunc(),r=typeof o=="string"?o:"agg";t=this.localeService.getLocaleTextFunc()(r,r)}return{name:e,aggFuncName:t}}setupSort(){const e=this.column.isSortable(),t=this.isGroupingZone();if(!(!e||!t)&&!this.gos.get("rowGroupPanelSuppressSort")){this.eSortIndicator.setupSort(this.column,!0);const o=r=>{r.preventDefault();const s=this.gos.get("multiSortKey")==="ctrl"?r.ctrlKey||r.metaKey:r.shiftKey;this.sortController.progressSort(this.column,s,"uiColumnSorted")};this.addGuiEventListener("click",o),this.addGuiEventListener("keydown",r=>{r.key===import_core4.KeyCode.ENTER&&this.isGroupingZone()&&o(r)})}}getDefaultIconName(){return"hide"}createGetDragItem(){const{column:e}=this;return()=>{const t={};return t[e.getId()]=e.isVisible(),{columns:[e],visibleState:t}}}setupComponents(){super.setupComponents(),this.isAggregationZone()&&!this.gos.get("functionsReadOnly")&&this.addGuiEventListener("click",this.onShowAggFuncSelection.bind(this))}onKeyDown(e){super.onKeyDown(e),e.key===import_core4.KeyCode.ENTER&&this.isAggregationZone()&&!this.gos.get("functionsReadOnly")&&(e.preventDefault(),this.onShowAggFuncSelection())}getDisplayValue(){const{name:e,aggFuncName:t}=this.getColumnAndAggFuncName();return this.isAggregationZone()?`${t}(${e})`:e}onShowAggFuncSelection(){if(this.popupShowing)return;this.popupShowing=!0;const e=new import_core5.VirtualList({cssIdentifier:"select-agg-func"}),t=this.aggFuncService.getFuncNames(this.column),o=this.getGui(),r=e.getGui();e.setModel({getRow:function(c){return t[c]},getRowCount:function(){return t.length}}),this.createBean(e);const i=(0,import_core4._loadTemplate)('<div class="ag-select-agg-func-popup"></div>');i.style.top="0px",i.style.left="0px",i.appendChild(r),i.style.width=`${o.clientWidth}px`;const[s]=this.addManagedElementListeners(i,{focusout:c=>{!i.contains(c.relatedTarget)&&a&&a.hideFunc()}}),n=c=>{this.destroyBean(e),this.popupShowing=!1,c?.key==="Escape"&&o.focus(),s&&s()},l=this.localeService.getLocaleTextFunc(),a=this.popupService.addPopup({modal:!0,eChild:i,closeOnEsc:!0,closedCallback:n,ariaLabel:l("ariaLabelAggregationFunction","Aggregation Function")});a&&e.setComponentCreator(this.createAggSelect.bind(this,a.hideFunc)),e.addGuiEventListener("keydown",c=>{if(c.key===import_core4.KeyCode.ENTER||c.key===import_core4.KeyCode.SPACE){const d=e.getLastFocusedRow();if(d==null)return;const h=e.getComponentAt(d);h&&h.selectItem()}}),this.popupService.positionPopupByComponent({type:"aggFuncSelect",eventSource:o,ePopup:i,keepWithinBounds:!0,column:this.column,position:"under"}),e.refresh();let u=t.findIndex(c=>c===this.column.getAggFunc());u===-1&&(u=0),e.focusRow(u)}createAggSelect(e,t){const o=()=>{e(),this.getGui().focus(),this.funcColsService.setColumnAggFunc(this.column,t,"toolPanelDragAndDrop")},r=this.localeService.getLocaleTextFunc(),i=t.toString(),s=r(i,i);return new AggItemComp(o,s)}isGroupingAndLocked(){return this.isGroupingZone()&&this.columnModel.isColGroupLocked(this.column)}isAggregationZone(){return this.dropZonePurpose==="aggregation"}isGroupingZone(){return this.dropZonePurpose==="rowGroup"}getDragSourceType(){return import_core4.DragSourceType.ToolPanel}destroy(){super.destroy(),this.column=null}},AggItemComp=class extends import_core4.Component{constructor(e,t){super('<div class="ag-select-agg-func-item"/>'),this.selectItem=e,this.getGui().innerText=t,this.addGuiEventListener("click",this.selectItem)}},BaseDropZonePanel=class extends import_core7.PillDropZonePanel{constructor(e,t){super(e),this.dropZonePurpose=t}wireBeans(e){super.wireBeans(e),this.columnModel=e.columnModel,this.funcColsService=e.funcColsService}init(e){super.init(e),this.addManagedEventListeners({newColumnsLoaded:this.refreshGui.bind(this)}),this.addManagedPropertyListeners(["functionsReadOnly","rowGroupPanelSuppressSort","groupLockGroupColumns"],this.refreshGui.bind(this))}getItems(e){return e.columns??[]}isInterestedIn(e){return e===import_core6.DragSourceType.HeaderCell||e===import_core6.DragSourceType.ToolPanel}minimumAllowedNewInsertIndex(){const e=this.gos.get("groupLockGroupColumns"),t=this.funcColsService.getRowGroupColumns().length;return e===-1?t:Math.min(e,t)}showOrHideColumnOnExit(e){return this.isRowGroupPanel()&&!this.gos.get("suppressRowGroupHidesColumns")&&!e.fromNudge}handleDragEnterEnd(e){if(this.showOrHideColumnOnExit(e)){const r=e.dragSource.getDragItem().columns;this.setColumnsVisible(r,!1,"uiColumnDragged")}}handleDragLeaveEnd(e){if(this.showOrHideColumnOnExit(e)){const o=e.dragSource.getDragItem();this.setColumnsVisible(o.columns,!0,"uiColumnDragged")}}setColumnsVisible(e,t,o){if(e){const r=e.filter(i=>!i.getColDef().lockVisible);this.columnModel.setColsVisible(r,t,o)}}isRowGroupPanel(){return this.dropZonePurpose==="rowGroup"}createPillComponent(e,t,o,r){return new DropZoneColumnComp(e,t,o,this.dropZonePurpose,r)}},PivotDropZonePanel=class extends BaseDropZonePanel{constructor(e){super(e,"pivot")}postConstruct(){const e=this.localeService.getLocaleTextFunc(),t=e("pivotColumnsEmptyMessage","Drag here to set column labels"),o=e("pivots","Column Labels");super.init({icon:(0,import_core8._createIconNoSpan)("pivotPanel",this.gos,null),emptyMessage:t,title:o}),this.addManagedEventListeners({newColumnsLoaded:this.refresh.bind(this),columnPivotChanged:this.refresh.bind(this),columnPivotModeChanged:this.checkVisibility.bind(this)}),this.refresh()}getAriaLabel(){return this.localeService.getLocaleTextFunc()("ariaPivotDropZonePanelLabel","Column Labels")}getTooltipParams(){const e=super.getTooltipParams();return e.location="pivotColumnsList",e}refresh(){this.checkVisibility(),this.refreshGui()}checkVisibility(){const e=this.columnModel.isPivotMode();if(this.isHorizontal())switch(this.gos.get("pivotPanelShow")){case"always":this.setDisplayed(e);break;case"onlyWhenPivoting":{const t=this.columnModel.isPivotActive();this.setDisplayed(e&&t);break}default:this.setDisplayed(!1);break}else this.setDisplayed(e)}isItemDroppable(e,t){return this.gos.get("functionsReadOnly")||!e.isPrimary()?!1:e.isAllowPivot()&&(!e.isPivotActive()||this.isSourceEventFromTarget(t))}updateItems(e){this.funcColsService.setPivotColumns(e,"toolPanelUi")}getIconName(){return this.isPotentialDndItems()?"pivot":"notAllowed"}getExistingItems(){return this.funcColsService.getPivotColumns()}},import_core9=require("@ag-grid-community/core"),RowGroupDropZonePanel=class extends BaseDropZonePanel{constructor(e){super(e,"rowGroup")}postConstruct(){const e=this.localeService.getLocaleTextFunc(),t=e("rowGroupColumnsEmptyMessage","Drag here to set row groups"),o=e("groups","Row Groups");super.init({icon:(0,import_core9._createIconNoSpan)("rowGroupPanel",this.gos,null),emptyMessage:t,title:o}),this.addManagedEventListeners({columnRowGroupChanged:this.refreshGui.bind(this)})}getAriaLabel(){return this.localeService.getLocaleTextFunc()("ariaRowGroupDropZonePanelLabel","Row Groups")}getTooltipParams(){const e=super.getTooltipParams();return e.location="rowGroupColumnsList",e}isItemDroppable(e,t){return this.gos.get("functionsReadOnly")||!e.isPrimary()?!1:e.isAllowRowGroup()&&(!e.isRowGroupActive()||this.isSourceEventFromTarget(t))}updateItems(e){this.funcColsService.setRowGroupColumns(e,"toolPanelUi")}getIconName(){return this.isPotentialDndItems()?"group":"notAllowed"}getExistingItems(){return this.funcColsService.getRowGroupColumns()}},AgGridHeaderDropZones=class extends import_core10.Component{wireBeans(e){this.columnModel=e.columnModel,this.funcColsService=e.funcColsService}constructor(){super()}postConstruct(){this.setGui(this.createNorthPanel());const e=this.onRowGroupChanged.bind(this);this.addManagedEventListeners({columnRowGroupChanged:e,newColumnsLoaded:e}),this.addManagedPropertyListener("rowGroupPanelShow",e),this.addManagedPropertyListener("pivotPanelShow",()=>this.onPivotPanelShow()),this.onRowGroupChanged()}createNorthPanel(){const e=document.createElement("div");e.classList.add("ag-column-drop-wrapper"),(0,import_core10._setAriaRole)(e,"presentation"),this.rowGroupComp=new RowGroupDropZonePanel(!0),this.createManagedBean(this.rowGroupComp),this.pivotComp=new PivotDropZonePanel(!0),this.createManagedBean(this.pivotComp),e.appendChild(this.rowGroupComp.getGui()),e.appendChild(this.pivotComp.getGui());const t=this.onDropPanelVisible.bind(this);return this.addManagedListeners(this.rowGroupComp,{displayChanged:t}),this.addManagedListeners(this.pivotComp,{displayChanged:t}),this.onDropPanelVisible(),e}onDropPanelVisible(){const e=this.rowGroupComp.isDisplayed()&&this.pivotComp.isDisplayed(),t="ag-column-drop-horizontal-half-width";this.rowGroupComp.addOrRemoveCssClass(t,e),this.pivotComp.addOrRemoveCssClass(t,e)}onRowGroupChanged(){if(!this.rowGroupComp)return;const e=this.gos.get("rowGroupPanelShow");if(e==="always")this.rowGroupComp.setDisplayed(!0);else if(e==="onlyWhenGrouping"){const t=!this.funcColsService.isRowGroupEmpty();this.rowGroupComp.setDisplayed(t)}else this.rowGroupComp.setDisplayed(!1)}onPivotPanelShow(){if(!this.pivotComp)return;const e=this.gos.get("pivotPanelShow");if(e==="always")this.pivotComp.setDisplayed(!0);else if(e==="onlyWhenPivoting"){const t=this.columnModel.isPivotActive();this.pivotComp.setDisplayed(t)}else this.pivotComp.setDisplayed(!1)}},AgGridHeaderDropZonesSelector={selector:"AG-GRID-HEADER-DROP-ZONES",component:AgGridHeaderDropZones},ColumnDropZoneService=class extends import_core11.BeanStub{constructor(){super(...arguments),this.beanName="columnDropZonesService"}getDropZoneSelector(){return AgGridHeaderDropZonesSelector}},import_core12=require("@ag-grid-community/core"),FilterAggregatesStage=class extends import_core12.BeanStub{constructor(){super(...arguments),this.beanName="filterAggregatesStage"}wireBeans(e){this.filterManager=e.filterManager,this.columnModel=e.columnModel}execute(e){const t=this.columnModel.isPivotMode(),o=this.filterManager?.isAggregateFilterPresent()||this.filterManager?.isAggregateQuickFilterPresent(),r=u=>!u.node.group,i=u=>u.node.leafGroup,s=(0,import_core12._getGroupAggFiltering)(this.gos)||(t?i:r),{changedPath:n}=e,l=(u,c=!1)=>{u.childrenAfterFilter&&(u.childrenAfterAggFilter=u.childrenAfterFilter,c&&u.childrenAfterAggFilter.forEach(d=>l(d,c)),this.setAllChildrenCount(u)),u.sibling&&(u.sibling.childrenAfterAggFilter=u.childrenAfterAggFilter)},a=u=>{u.childrenAfterAggFilter=u.childrenAfterFilter?.filter(c=>s({node:c})&&this.filterManager.doesRowPassAggregateFilters({rowNode:c})?(l(c,!0),!0):c.childrenAfterAggFilter?.length)||null,this.setAllChildrenCount(u),u.sibling&&(u.sibling.childrenAfterAggFilter=u.childrenAfterAggFilter)};n.forEachChangedNodeDepthFirst(o?a:l,!0)}setAllChildrenCountTreeData(e){const t=e.childrenAfterAggFilter;let o=0;if(t){const r=t.length;o=r;for(let i=0;i<r;++i)o+=t[i].allChildrenCount??0}e.setAllChildrenCount(o===0&&e.level>=0?null:o)}setAllChildrenCountGridGrouping(e){let t=0;e.childrenAfterAggFilter.forEach(o=>{o.group?t+=o.allChildrenCount:t++}),e.setAllChildrenCount(t)}setAllChildrenCount(e){if(!e.hasChildren()){e.setAllChildrenCount(null);return}this.gos.get("treeData")?this.setAllChildrenCountTreeData(e):this.setAllChildrenCountGridGrouping(e)}},import_core13=require("@ag-grid-community/core"),GroupFilter=class extends import_core13.TabGuardComp{constructor(){super(` <div class="ag-group-filter"> <div data-ref="eGroupField"></div> <div data-ref="eUnderlyingFilter"></div> </div> `),this.eGroupField=import_core13.RefPlaceholder,this.eUnderlyingFilter=import_core13.RefPlaceholder}wireBeans(e){this.filterManager=e.filterManager,this.columnNameService=e.columnNameService,this.funcColsService=e.funcColsService}postConstruct(){this.initialiseTabGuard({})}init(e){return this.updateParams(e).then(()=>{this.addManagedEventListeners({columnRowGroupChanged:()=>this.onColumnRowGroupChanged(),filterDestroyed:t=>this.onFilterDestroyed(t)})})}refresh(e){return this.updateParams(e),!0}updateParams(e){return this.params=e,this.validateParams(),this.updateGroups()}validateParams(){const{colDef:e}=this.params;e.field&&(0,import_core13._warnOnce)('Group Column Filter does not work with the colDef property "field". This property will be ignored.'),e.filterValueGetter&&(0,import_core13._warnOnce)('Group Column Filter does not work with the colDef property "filterValueGetter". This property will be ignored.'),e.filterParams&&(0,import_core13._warnOnce)('Group Column Filter does not work with the colDef property "filterParams". This property will be ignored.')}updateGroups(){const e=this.updateGroupField();return this.getUnderlyingFilters(e)}getSourceColumns(){if(this.groupColumn=this.params.column,this.gos.get("treeData"))return(0,import_core13._warnOnce)("Group Column Filter does not work with Tree Data enabled. Please disable Tree Data, or use a different filter."),[];const e=this.funcColsService.getSourceColumnsForGroupColumn(this.groupColumn);return e||((0,import_core13._warnOnce)("Group Column Filter only works on group columns. Please use a different filter."),[])}updateGroupField(){(0,import_core13._clearElement)(this.eGroupField),this.eGroupFieldSelect&&this.destroyBean(this.eGroupFieldSelect);const e=this.getSourceColumns(),t=e.filter(o=>o.isFilterAllowed());return t.length?(e.length===1?(this.selectedColumn=t[0],(0,import_core13._setDisplayed)(this.eGroupField,!1)):((!this.selectedColumn||!t.some(o=>o.getId()===this.selectedColumn.getId()))&&(this.selectedColumn=t[0]),this.createGroupFieldSelectElement(t),this.eGroupField.appendChild(this.eGroupFieldSelect.getGui()),this.eGroupField.appendChild((0,import_core13._loadTemplate)('<div class="ag-filter-separator"></div>')),(0,import_core13._setDisplayed)(this.eGroupField,!0)),t):(this.selectedColumn=void 0,(0,import_core13._setDisplayed)(this.eGroupField,!1),null)}createGroupFieldSelectElement(e){this.eGroupFieldSelect=this.createManagedBean(new import_core13.AgSelect);const t=this.localeService.getLocaleTextFunc();this.eGroupFieldSelect.setLabel(t("groupFilterSelect","Select field:")),this.eGroupFieldSelect.setLabelAlignment("top"),this.eGroupFieldSelect.addOptions(e.map(o=>({value:o.getId(),text:this.columnNameService.getDisplayNameForColumn(o,"groupFilter",!1)??void 0}))),this.eGroupFieldSelect.setValue(this.selectedColumn.getId()),this.eGroupFieldSelect.onValueChange(o=>this.updateSelectedColumn(o)),this.eGroupFieldSelect.addCssClass("ag-group-filter-field-select-wrapper"),e.length===1&&this.eGroupFieldSelect.setDisabled(!0)}getUnderlyingFilters(e){if(!e)return this.filterColumnPairs=void 0,this.selectedFilter=void 0,this.groupColumn.setFilterActive(!1,"columnRowGroupChanged"),import_core13.AgPromise.resolve();const t=[],o=[];return e.forEach(r=>{const i=this.filterManager.getOrCreateFilterWrapper(r);i?.filterPromise&&t.push(i.filterPromise.then(s=>(s&&o.push({filter:s,column:r}),r.getId()===this.selectedColumn.getId()&&(this.selectedFilter=s??void 0),s)))}),import_core13.AgPromise.all(t).then(()=>{this.filterColumnPairs=o,this.groupColumn.setFilterActive(this.isFilterActive(),"columnRowGroupChanged")})}addUnderlyingFilterElement(){if((0,import_core13._clearElement)(this.eUnderlyingFilter),!this.selectedColumn)return import_core13.AgPromise.resolve();const e=this.createManagedBean(new import_core13.FilterWrapperComp(this.selectedColumn,"COLUMN_MENU"));return this.filterWrapperComp=e,e.hasFilter()?(this.eUnderlyingFilter.appendChild(e.getGui()),e.getFilter()?.then(()=>{e.afterGuiAttached?.(this.afterGuiAttachedParams),!this.afterGuiAttachedParams?.suppressFocus&&this.eGroupFieldSelect&&!this.eGroupFieldSelect.isDisabled()&&this.eGroupFieldSelect.getFocusableElement().focus()})??import_core13.AgPromise.resolve()):import_core13.AgPromise.resolve()}updateSelectedColumn(e){if(!e)return;this.filterWrapperComp?.afterGuiDetached(),this.destroyBean(this.filterWrapperComp);const t=this.getFilterColumnPair(e);this.selectedColumn=t?.column,this.selectedFilter=t?.filter,this.dispatchLocalEvent({type:"selectedColumnChanged"}),this.addUnderlyingFilterElement()}isFilterActive(){return!!this.filterColumnPairs?.some(({filter:e})=>e.isFilterActive())}doesFilterPass(){return!0}getModel(){return null}setModel(){return import_core13.AgPromise.resolve()}afterGuiAttached(e){this.afterGuiAttachedParams=e,this.addUnderlyingFilterElement()}afterGuiDetached(){(0,import_core13._clearElement)(this.eUnderlyingFilter),this.selectedFilter?.afterGuiDetached?.()}onColumnRowGroupChanged(){this.updateGroups().then(()=>{this.dispatchLocalEvent({type:"columnRowGroupChanged"})})}onFilterDestroyed({column:e,source:t}){if(t==="gridDestroyed")return;const o=e.getColId();this.filterColumnPairs?.some(({column:r})=>r.getColId()===o)&&setTimeout(()=>{this.isAlive()&&this.updateGroups()})}getFilterColumnPair(e){if(e)return this.filterColumnPairs?.find(({column:t})=>t.getId()===e)}getSelectedFilter(){return this.selectedFilter}getSelectedColumn(){return this.selectedColumn}isFilterAllowed(){return!!this.selectedColumn}destroy(){super.destroy()}},import_core14=require("@ag-grid-community/core"),GroupFloatingFilterComp=class extends import_core14.Component{constructor(){super(` <div data-ref="eFloatingFilter" class="ag-group-floating-filter ag-floating-filter-input" role="presentation"></div> `),this.eFloatingFilter=import_core14.RefPlaceholder,this.haveAddedColumnListeners=!1}wireBeans(e){this.columnNameService=e.columnNameService,this.filterManager=e.filterManager}init(e){this.params=e;const t=this.gos.get("groupDisplayType")==="multipleColumns";return new import_core14.AgPromise(o=>{this.params.parentFilterInstance(r=>{this.parentFilterInstance=r,t?this.setupUnderlyingFloatingFilterElement().then(()=>o()):(this.setupReadOnlyFloatingFilterElement(),o())})}).then(()=>{this.addManagedListeners(this.parentFilterInstance,{selectedColumnChanged:this.onSelectedColumnChanged.bind(this),columnRowGroupChanged:this.onColumnRowGroupChanged.bind(this)})})}onParamsUpdated(e){this.refresh(e)}refresh(e){this.params=e,this.setParams()}setParams(){const e=this.columnNameService.getDisplayNameForColumn(this.params.column,"header",!0),t=this.localeService.getLocaleTextFunc();this.eFloatingFilterText?.setInputAriaLabel(`${e} ${t("ariaFilterInput","Filter Input")}`)}setupReadOnlyFloatingFilterElement(){this.eFloatingFilterText||(this.eFloatingFilterText=this.createManagedBean(new import_core14.AgInputTextField),this.eFloatingFilterText.setDisabled(!0).addGuiEventListener("click",()=>this.params.showParentFilter()),this.setParams()),this.updateDisplayedValue(),this.eFloatingFilter.appendChild(this.eFloatingFilterText.getGui())}setupUnderlyingFloatingFilterElement(){this.showingUnderlyingFloatingFilter=!1,this.underlyingFloatingFilter=void 0,(0,import_core14._clearElement)(this.eFloatingFilter);const e=this.parentFilterInstance.getSelectedColumn();if(e&&!e.isVisible()){const t=this.filterManager.getFloatingFilterCompDetails(e,this.params.showParentFilter);if(t)return this.haveAddedColumnListeners||(this.haveAddedColumnListeners=!0,this.addManagedListeners(e,{visibleChanged:this.onColumnVisibleChanged.bind(this),colDefChanged:this.onColDefChanged.bind(this)})),t.newAgStackInstance().then(o=>{this.underlyingFloatingFilter=o,this.underlyingFloatingFilter?.onParentModelChanged(this.parentFilterInstance.getSelectedFilter()?.getModel()),this.appendChild(o.getGui()),this.showingUnderlyingFloatingFilter=!0})}return this.setupReadOnlyFloatingFilterElement(),import_core14.AgPromise.resolve()}onColumnVisibleChanged(){this.setupUnderlyingFloatingFilterElement()}onColDefChanged(e){if(!e.column)return;const t=this.filterManager.getFloatingFilterCompDetails(e.column,this.params.showParentFilter);t&&(this.underlyingFloatingFilter?.refresh?this.underlyingFloatingFilter.refresh(t.params):this.underlyingFloatingFilter?.onParamsUpdated?.(t.params))}onParentModelChanged(e,t){this.showingUnderlyingFloatingFilter?this.underlyingFloatingFilter?.onParentModelChanged(this.parentFilterInstance.getSelectedFilter()?.getModel(),t):this.updateDisplayedValue()}updateDisplayedValue(){if(!this.parentFilterInstance||!this.eFloatingFilterText)return;const e=this.parentFilterInstance.getSelectedFilter();if(!e){this.eFloatingFilterText.setValue(""),this.eFloatingFilterText.setDisplayed(!1);return}if(this.eFloatingFilterText.setDisplayed(!0),e.getModelAsString){const t=e.getModel();this.eFloatingFilterText.setValue(t==null?"":e.getModelAsString(t))}else this.eFloatingFilterText.setValue("")}onSelectedColumnChanged(){this.showingUnderlyingFloatingFilter||this.updateDisplayedValue()}onColumnRowGroupChanged(){this.showingUnderlyingFloatingFilter||this.updateDisplayedValue()}destroy(){super.destroy()}},import_core18=require("@ag-grid-community/core"),import_core15=require("@ag-grid-community/core"),BatchRemover=class{constructor(){this.allSets={},this.allParents=[]}removeFromChildrenAfterGroup(e,t){const o=this.getSet(e);o.removeFromChildrenAfterGroup[t.id]=!0}isRemoveFromAllLeafChildren(e,t){return!!this.getSet(e).removeFromAllLeafChildren[t.id]}preventRemoveFromAllLeafChildren(e,t){const o=this.getSet(e);delete o.removeFromAllLeafChildren[t.id]}removeFromAllLeafChildren(e,t){const o=this.getSet(e);o.removeFromAllLeafChildren[t.id]=!0}getSet(e){return this.allSets[e.id]||(this.allSets[e.id]={removeFromAllLeafChildren:{},removeFromChildrenAfterGroup:{}},this.allParents.push(e)),this.allSets[e.id]}getAllParents(){return this.allParents}flush(){this.allParents.forEach(e=>{const t=this.allSets[e.id];e.childrenAfterGroup=e.childrenAfterGroup.filter(r=>!t.removeFromChildrenAfterGroup[r.id]),e.allLeafChildren=e.allLeafChildren?.filter(r=>!t.removeFromAllLeafChildren[r.id])??null,e.updateHasChildren();const o=e.sibling;o&&(o.childrenAfterGroup=e.childrenAfterGroup,o.allLeafChildren=e.allLeafChildren)}),this.allSets={},this.allParents.length=0}};function sortGroupChildren(e){if(!e)return!1;const t=e.length;if(t<2)return!1;let o=!1;for(let r=1;r<t;r++)if(compareGroupChildren(e[r-1],e[r])>0){o=!0;break}return o?(e.sort(compareGroupChildren),!0):!1}function compareGroupChildren(e,t){const o=e.sourceRowIndex,r=t.sourceRowIndex,i=o>=0,s=r>=0,n=i&&s,l=!i&&!s;return n?o-r:l?e.__objectId-t.__objectId:i?1:-1}var GroupStrategy=class extends import_core15.BeanStub{wireBeans(e){this.beans=e,this.columnModel=e.columnModel,this.funcColsService=e.funcColsService,this.valueService=e.valueService,this.selectionService=e.selectionService,this.showRowGroupColsService=e.showRowGroupColsService}execute(e){const t=this.createGroupingDetails(e);if(t.transactions)this.handleTransaction(t);else{const o=e.afterColumnsChanged===!0;this.shotgunResetEverything(t,o)}this.positionLeafsAndGroups(e.changedPath),this.orderGroups(t)}positionLeafsAndGroups(e){e.forEachChangedNodeDepthFirst(t=>{if(t.childrenAfterGroup){const o=[],r=[];let i;t.childrenAfterGroup.forEach(s=>{s.childrenAfterGroup?.length?s.key===""&&!i?i=s:r.push(s):o.push(s)}),i&&r.push(i),t.childrenAfterGroup=[...o,...r]}},!1)}createGroupingDetails(e){const{rowNode:t,changedPath:o,rowNodeTransactions:r,rowNodesOrderChanged:i}=e,s=this.funcColsService.getRowGroupColumns();return{expandByDefault:this.gos.get("groupDefaultExpanded"),groupedCols:s,rootNode:t,pivotMode:this.columnModel.isPivotMode(),groupedColCount:s?.length??0,transactions:r,rowNodesOrderChanged:!!i,changedPath:o,groupAllowUnbalanced:this.gos.get("groupAllowUnbalanced"),isGroupOpenByDefault:this.gos.getCallback("isGroupOpenByDefault"),initialGroupOrderComparator:this.gos.getCallback("initialGroupOrderComparator"),suppressGroupMaintainValueType:this.gos.get("suppressGroupMaintainValueType"),keyCreators:s?.map(l=>l.getColDef().keyCreator)??[]}}handleTransaction(e){e.transactions.forEach(t=>{const o=new BatchRemover;(0,import_core15._existsAndNotEmpty)(t.remove)&&this.removeNodes(t.remove,e,o),(0,import_core15._existsAndNotEmpty)(t.update)&&this.moveNodesInWrongPath(t.update,e,o),(0,import_core15._existsAndNotEmpty)(t.add)&&this.insertNodes(t.add,e);const r=o.getAllParents().slice();o.flush(),this.removeEmptyGroups(r,e)}),e.rowNodesOrderChanged&&this.sortChildren(e)}sortChildren(e){e.changedPath.forEachChangedNodeDepthFirst(t=>{sortGroupChildren(t.childrenAfterGroup)&&e.changedPath.addParentNode(t)},!1,!0)}orderGroups(e){const t=e.initialGroupOrderComparator;(0,import_core15._exists)(t)&&o(e.rootNode);function o(r){(0,import_core15._exists)(r.childrenAfterGroup)&&!r.leafGroup&&(r.childrenAfterGroup.sort((s,n)=>t({nodeA:s,nodeB:n})),r.childrenAfterGroup.forEach(s=>o(s)))}}getExistingPathForNode(e,t){const o=[];let r=e.parent;for(;r&&r!==t.rootNode;)o.push({key:r.key,rowGroupColumn:r.rowGroupColumn,field:r.field}),r=r.parent;return o.reverse(),o}moveNodesInWrongPath(e,t,o){e.forEach(r=>{t.changedPath.isActive()&&t.changedPath.addParentNode(r.parent);const i=a=>a.key,s=this.getExistingPathForNode(r,t).map(i),n=this.getGroupInfo(r,t).map(i);(0,import_core15._areEqual)(s,n)||this.moveNode(r,t,o)})}moveNode(e,t,o){if(this.removeNodesFromParents([e],t,o),this.insertOneNode(e,t,o),e.setData(e.data),t.changedPath.isActive()){const r=e.parent;t.changedPath.addParentNode(r)}}removeNodes(e,t,o){this.removeNodesFromParents(e,t,o),t.changedPath.isActive()&&e.forEach(r=>t.changedPath.addParentNode(r.parent))}forEachParentGroup(e,t,o){let r=t;for(;r&&r!==e.rootNode;)o(r),r=r.parent}removeNodesFromParents(e,t,o){const r=o==null,i=o||new BatchRemover;e.forEach(s=>{this.removeFromParent(s,i),this.forEachParentGroup(t,s.parent,n=>{i.removeFromAllLeafChildren(n,s)})}),r&&i.flush()}removeEmptyGroups(e,t){let o=!0;const r=i=>{const s=this.getChildrenMappedKey(i.key,i.rowGroupColumn),n=i.parent;return(n?.childrenMapped?!n.childrenMapped[s]:!0)?!1:!!i.group&&(i.childrenAfterGroup?.length??0)===0};for(;o;){o=!1;const i=new BatchRemover;e.forEach(s=>{this.forEachParentGroup(t,s,n=>{r(n)&&(o=!0,this.removeFromParent(n,i),n.setSelectedParams({newValue:!1,source:"rowGroupChanged"}))})}),i.flush()}}removeFromParent(e,t){e.parent&&(t?t.removeFromChildrenAfterGroup(e.parent,e):((0,import_core15._removeFromArray)(e.parent.childrenAfterGroup,e),e.parent.updateHasChildren()));const o=this.getChildrenMappedKey(e.key,e.rowGroupColumn);e.parent?.childrenMapped&&delete e.parent.childrenMapped[o],e.setRowTop(null),e.setRowIndex(null)}addToParent(e,t){const o=this.getChildrenMappedKey(e.key,e.rowGroupColumn);t?.childrenMapped&&t.childrenMapped[o]!==e&&(t.childrenMapped[o]=e,t.childrenAfterGroup.push(e),t.setGroup(!0))}areGroupColsEqual(e,t){return e==null||t==null||e.pivotMode!==t.pivotMode?!1:(0,import_core15._areEqual)(e.groupedCols,t.groupedCols)&&(0,import_core15._areEqual)(e.keyCreators,t.keyCreators)}checkAllGroupDataAfterColsChanged(e){const t=o=>{o&&o.forEach(r=>{if(!r.group)return;const s={field:r.field,key:r.key,rowGroupColumn:r.rowGroupColumn,leafNode:r.allLeafChildren?.[0]};this.setGroupData(r,s,e),t(r.childrenAfterGroup)})};t(e.rootNode.childrenAfterGroup)}shotgunResetEverything(e,t){if(this.noChangeInGroupingColumns(e,t))return;this.selectionService.filterFromSelection(s=>s&&!s.group);const{groupedCols:o}=e,r=e.rootNode;r.leafGroup=o.length===0,r.childrenAfterGroup=[],r.childrenMapped={},r.updateHasChildren();const i=r.sibling;i&&(i.childrenAfterGroup=r.childrenAfterGroup,i.childrenMapped=r.childrenMapped),this.insertNodes(r.allLeafChildren,e)}noChangeInGroupingColumns(e,t){let o=!1;const r=this.showRowGroupColsService.getShowRowGroupCols(),i=r?r.map(s=>s.getId()).join("-"):"";return t&&(o=this.areGroupColsEqual(e,this.oldGroupingDetails),this.oldGroupDisplayColIds!==i&&this.checkAllGroupDataAfterColsChanged(e)),this.oldGroupingDetails=e,this.oldGroupDisplayColIds=i,o}insertNodes(e,t){e.forEach(o=>{this.insertOneNode(o,t),t.changedPath.isActive()&&t.changedPath.addParentNode(o.parent)})}insertOneNode(e,t,o){const r=this.getGroupInfo(e,t),i=this.findParentForNode(e,r,t,o);i.group||(0,import_core15._warnOnce)("duplicate group keys for row data, keys should be unique",[i.data,e.data]),e.parent=i,e.level=r.length,i.childrenAfterGroup.push(e),i.updateHasChildren()}findParentForNode(e,t,o,r){let i=o.rootNode;return t.forEach((s,n)=>{i=this.getOrCreateNextNode(i,s,n,o),r?.isRemoveFromAllLeafChildren(i,e)?r?.preventRemoveFromAllLeafChildren(i,e):i.allLeafChildren.push(e)}),i}getOrCreateNextNode(e,t,o,r){const i=this.getChildrenMappedKey(t.key,t.rowGroupColumn);let s=e?.childrenMapped?.[i];return s||(s=this.createGroup(t,e,o,r),this.addToParent(s,e)),s}createGroup(e,t,o,r){const i=new import_core15.RowNode(this.beans);return i.group=!0,i.field=e.field,i.rowGroupColumn=e.rowGroupColumn,this.setGroupData(i,e,r),i.key=e.key,i.id=this.createGroupId(i,t,o),i.level=o,i.leafGroup=o===r.groupedColCount-1,i.allLeafChildren=[],i.setAllChildrenCount(0),i.rowGroupIndex=o,i.childrenAfterGroup=[],i.childrenMapped={},i.updateHasChildren(),i.parent=t,this.setExpandedInitialValue(r,i),i}createGroupId(e,t,o){const r=(i,s)=>{if(!i.rowGroupColumn)return null;const n=s?r(s,s.parent,0):null;return`${n==null?"":n+"-"}${i.rowGroupColumn.getColId()}-${i.key}`};return import_core15.RowNode.ID_PREFIX_ROW_GROUP+r(e,t,o)}setGroupData(e,t,o){e.groupData={},this.showRowGroupColsService.getShowRowGroupCols().forEach(i=>{const s=e.rowGroupColumn;s!==null&&i.isRowGroupDisplayed(s.getId())&&(o.suppressGroupMaintainValueType?e.groupData[i.getColId()]=t.key:e.groupData[i.getColId()]=this.valueService.getValue(s,t.leafNode))})}getChildrenMappedKey(e,t){return t?t.getId()+"-"+e:e}setExpandedInitialValue(e,t){if(e.pivotMode&&t.leafGroup){t.expanded=!1;return}const o=e.isGroupOpenByDefault;if(o){const r={rowNode:t,field:t.field,key:t.key,level:t.level,rowGroupColumn:t.rowGroupColumn};t.expanded=o(r)==!0;return}if(e.expandByDefault===-1){t.expanded=!0;return}t.expanded=t.level<e.expandByDefault}getGroupInfo(e,t){const o=[];return t.groupedCols.forEach(r=>{let i=this.valueService.getKeyForNode(r,e),s=i!=null&&i!=="";if((t.pivotMode||!t.groupAllowUnbalanced)&&!s&&(i="",s=!0),s){const l={key:i,field:r.getColDef().field,rowGroupColumn:r,leafNode:e};o.push(l)}}),o}},import_core16=require("@ag-grid-community/core"),import_core17=require("@ag-grid-community/core"),treeNodePositionComparer=(e,t)=>e.treeNode.oldSourceRowIndex-t.treeNode.oldSourceRowIndex,EMPTY_ARRAY=Object.freeze([]),EMPTY_CHILDREN=EMPTY_ARRAY.values(),orphanRow=(e,t)=>{e.parent=null,e.treeNode=null,t?e.childrenAfterGroup=[]:(e.level=0,e.childrenAfterGroup=null,e.allLeafChildren=null)},TreeNode=class v{constructor(t,o,r){this.parent=t,this.key=o,this.level=r,this.children=null,this.invalidatedHead=null,this.invalidatedNext=void 0,this.row=null,this.oldRow=null,this.duplicateRows=null,this.childrenAfterGroup=EMPTY_ARRAY,this.allLeafChildren=EMPTY_ARRAY,this.childrenChanged=!1,this.leafChildrenChanged=!1,this.oldSourceRowIndex=-1}isEmptyFillerNode(){return!this.row?.data&&!this.children?.size}hasChildren(){return!!this.children?.size}enumChildren(){return this.children?.values()??EMPTY_CHILDREN}upsertKey(t){typeof t!="string"&&(t=String(t));let o=this.children?.get(t);return o||(o=new v(this,t,this.level+1),(this.children??(this.children=new Map))?.set(o.key,o)),o}destroy(){const{row:t,parent:o}=this;o!==null&&(o?.children?.delete(this.key),t!==null&&orphanRow(t,!0),this.parent=null)}setRow(t){const{level:o,row:r,childrenAfterGroup:i}=this;if(o<0)r!==null&&r!==t&&orphanRow(r,!0);else{if(r===t)return!1;r!==null?(t.allLeafChildren=r.allLeafChildren??this.allLeafChildren??EMPTY_ARRAY,orphanRow(r,!1)):t.allLeafChildren=this.allLeafChildren??EMPTY_ARRAY}return t.level=o,t.childrenAfterGroup=i,t.treeNode=this,this.row=t,!0}removeRow(t){const{level:o,row:r,duplicateRows:i,childrenAfterGroup:s}=this;if(r===t){const n=this.popDuplicateRow();n?(this.row=n,n.childrenAfterGroup=s,o>=0&&(n.allLeafChildren=r.allLeafChildren??this.allLeafChildren??EMPTY_ARRAY)):this.row=null}else{if(!i?.delete(t))return!1;i.size===0&&(this.duplicateRows=null)}return orphanRow(t,o<0),!0}addDuplicateRow(t){const{level:o}=this;let r=this.duplicateRows;if(r===null)r=new Set,this.duplicateRows=r;else if(r.has(t))return!1;return r.add(t),t.treeNode=this,t.level=o,o>=0&&(t.allLeafChildren=EMPTY_ARRAY),t.childrenAfterGroup=EMPTY_ARRAY,!0}sortFirstDuplicateRow(){const t=this.duplicateRows,o=this.row;if(!o||!t)return o;let r=o;for(const i of t)i.sourceRowIndex<r.sourceRowIndex&&(r=i);return r!==o&&(r.childrenAfterGroup=this.childrenAfterGroup,r.allLeafChildren=o.allLeafChildren??this.allLeafChildren??EMPTY_ARRAY,o.childrenAfterGroup=EMPTY_ARRAY,o.allLeafChildren=EMPTY_ARRAY,t.delete(r),t.add(o),this.row=r),r}popDuplicateRow(){let t=null;const o=this.duplicateRows;return o!==null&&(t=o.values().next().value,t!==null&&o.delete(t)&&o.size===0&&(this.duplicateRows=null)),t}dequeueInvalidated(){const t=this.invalidatedHead;return t!==null&&(this.invalidatedHead=t.invalidatedNext??null,t.invalidatedNext=void 0),t}invalidate(){let t=this,o=this.parent;for(;o!==null&&t.invalidatedNext===void 0;)t.invalidatedNext=o.invalidatedHead,o.invalidatedHead=t,t=o,o=t.parent}invalidateOrder(){const t=this.parent;t!==null&&!t.childrenChanged&&((this.children?.size??0)>1||!t.row?.data)&&(t.childrenChanged=!0,t.invalidate())}getRowPosition(){const t=this.row;return t?.data?t.sourceRowIndex:this.childrenAfterGroup[0]?.treeNode?.oldSourceRowIndex??this.oldSourceRowIndex}updateChildrenAfterGroup(){this.childrenChanged=!1;const t=this.children?.size??0;if(t===0)return this.childrenAfterGroup.length===0?!1:(this.leafChildrenChanged=!0,this.childrenAfterGroup=EMPTY_ARRAY,this.row.childrenAfterGroup=EMPTY_ARRAY,!0);let o=!1,r=this.childrenAfterGroup;r===EMPTY_ARRAY?(r=new Array(t),this.childrenAfterGroup=r,this.row.childrenAfterGroup=r,o=!0):r.length!==t&&(r.length=t,o=!0);let i=0,s=-1,n=!1;for(const l of this.enumChildren()){const a=l.getRowPosition();a<s&&(n=!0),s=a,l.oldSourceRowIndex=a;const u=l.row;r[i]!==u&&(r[i]=u,o=!0),++i}return o&&(this.leafChildrenChanged=!0),n&&this.reorderChildrenList(r),o||n}reorderChildrenList(t){const o=t.length,r=this.children;t.sort(treeNodePositionComparer),r.clear();for(let i=0;i<o;++i){const s=t[i].treeNode;r.set(s.key,s)}}updateAllLeafChildren(){const{parent:t,row:o,childrenAfterGroup:r}=this;this.leafChildrenChanged=!1;let i=!1;const s=r.length;if(s===0)i=o.allLeafChildren?.length!==0,o.allLeafChildren=EMPTY_ARRAY,this.allLeafChildren=EMPTY_ARRAY;else if(s===1&&r[0].allLeafChildren?.length)o.allLeafChildren=r[0].allLeafChildren,this.allLeafChildren=null,i=!0;else{let n=this.allLeafChildren;(n===EMPTY_ARRAY||n===null)&&(n=[],this.allLeafChildren=n);const l=n.length;let a=0;for(let u=0;u<s;++u){const c=r[u],d=c.allLeafChildren,h=d.length;if(h)for(let g=0;g<h;++g){const p=d[g];(a>=l||n[a]!==p)&&(n[a]=p,i=!0),++a}else(a>=l||n[a]!==c)&&c&&(n[a]=c,i=!0),++a}l!==a&&(n.length=a,i=!0),o.allLeafChildren!==n&&(o.allLeafChildren=n,i=!0)}i&&t&&(t.leafChildrenChanged=!0)}},isTreeRowCommitted=e=>(e.treeNodeFlags&1)!==0,isTreeRowExpandedInitialized=e=>(e.treeNodeFlags&2)!==0,isTreeRowUpdated=e=>(e.treeNodeFlags&4)!==0,isTreeRowKeyChanged=e=>(e.treeNodeFlags&8)!==0,isTreeRowPathChanged=e=>(e.treeNodeFlags&16)!==0,setTreeRowExpandedInitialized=(e,t)=>{t?e.treeNodeFlags|=2:e.treeNodeFlags&=-3},setTreeRowUpdated=e=>{const t=e.treeNodeFlags;t&1&&(e.treeNodeFlags=t|4)},setTreeRowKeyChanged=e=>{const t=e.treeNodeFlags;t&1&&(e.treeNodeFlags=t|12)},markTreeRowPathChanged=e=>{e.treeNodeFlags|=16},markTreeRowCommitted=e=>{e.treeNodeFlags=1|e.treeNodeFlags&-29},clearTreeRowFlags=e=>{e.treeNodeFlags=0},TreeStrategy=class extends import_core16.BeanStub{constructor(){super(...arguments),this.rowsPendingDestruction=null,this.root=new TreeNode(null,"",-1)}wireBeans(e){this.beans=e,this.showRowGroupColsService=e.showRowGroupColsService}destroy(){const e=this.root.row;e!==null&&(this.root.removeRow(e),clearTreeRowFlags(e)),this.destroyTree(this.root),this.commitDestroyedRows(),super.destroy()}execute(e){const{rowNodeTransactions:t,rowNodesOrderChanged:o,changedPath:r}=e,i=e.rowNode,s=this.gos,n={changedPath:r,expandByDefault:s.get("groupDefaultExpanded"),suppressGroupMaintainValueType:s.get("suppressGroupMaintainValueType"),getDataPath:s.get("getDataPath"),isGroupOpenByDefault:s.getCallback("isGroupOpenByDefault"),initialGroupOrderComparator:s.getCallback("initialGroupOrderComparator")};this.root.setRow(i),i.leafGroup=!1;const a=i.sibling;a&&(a.childrenAfterGroup=i.childrenAfterGroup,a.childrenMapped=i.childrenMapped),t?this.handleTransaction(n,t,o):this.handleRowData(n,i,e.afterColumnsChanged===!0)}handleRowData(e,t,o){const r=this.root;if(o||this.oldGroupDisplayColIds===void 0){const i=this.showRowGroupColsService?.getShowRowGroupCols()?.map(s=>s.getId()).join("-")??"";if(o){this.oldGroupDisplayColIds!==i&&this.checkAllGroupDataAfterC