@ag-grid-enterprise/row-grouping
Advanced tools
Comparing version 32.0.0 to 32.0.1
@@ -15,2 +15,2 @@ 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 s of __getOwnPropNames(t))!__hasOwnProp.call(e,s)&&s!==o&&__defProp(e,s,{get:()=>t[s],enumerable:!(r=__getOwnPropDesc(t,s))||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_core19=require("@ag-grid-community/core"),import_core20=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),s=(0,import_core._exists)(this.aggFuncsMap[t]);return r&&s}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 s=t[r];typeof s=="number"?o===null?o=s:o+=typeof o=="number"?s:BigInt(s):typeof s=="bigint"&&(o===null?o=s:o=(typeof o=="bigint"?o:BigInt(o))+s)}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 s=t[r];(typeof s=="number"||typeof s=="bigint")&&(o===null||o>s)&&(o=s)}return o}function aggMax(e){const{values:t}=e;let o=null;for(let r=0;r<t.length;r++){const s=t[r];(typeof s=="number"||typeof s=="bigint")&&(o===null||o<s)&&(o=s)}return o}function aggCount(e){const{values:t}=e;let o=0;for(let s=0;s<t.length;s++){const i=t[s];o+=i!=null&&typeof i.value=="number"?i.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 s=null;r>0&&(s=o/(typeof o=="number"?r:BigInt(r)));const i=e.rowNode?.aggData?.[e.column?.getColId()];return i&&i.count===r&&i.value===s?i:{count:r,value:s,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 s=this.createAggDetails(e);this.recursivelyCreateAggData(s)}createAggDetails(e){const t=this.columnModel.isPivotActive(),o=this.funcColsService.getValueColumns(),r=t?this.funcColsService.getPivotColumns():[];return{alwaysAggregateAtRootLevel:this.gos.get("alwaysAggregateAtRootLevel"),groupIncludeTotalFooter:!!this.gos.getGrandTotalRow(),changedPath:e.changedPath,valueColumns:o,pivotColumns:r,filteredOnly:!this.isSuppressAggFilteredOnly(),userAggFunc:this.gos.getCallback("getGroupRowAgg")}}isSuppressAggFilteredOnly(){return this.gos.getGroupAggFiltering()!==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 i=!this.columnModel.isPivotMode();if(!e.alwaysAggregateAtRootLevel&&i){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 s;t.userAggFunc?s=t.userAggFunc({nodes:e.childrenAfterFilter}):o?s=null:r?s=this.aggregateRowNodeUsingValuesOnly(e,t):s=this.aggregateRowNodeUsingValuesAndPivot(e),e.setAggData(s),e.sibling&&e.sibling.setAggData(s)}aggregateRowNodeUsingValuesAndPivot(e){const t={},o=this.pivotResultColsService.getPivotResultCols()?.list??[];let r=!0;for(let s=0;s<o.length;s++){const i=o[s],n=i.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,i)}if(!r)for(let s=0;s<o.length;s++){const i=o[s],n=i.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,i)}return t}aggregateRowNodeUsingValuesOnly(e,t){const o={},r=t.changedPath.isActive()?t.changedPath.getValueColumnsForNode(e,t.valueColumns):t.valueColumns,s=t.changedPath.isActive()?t.changedPath.getNotValueColumnsForNode(e,t.valueColumns):null,i=this.getValuesNormal(e,r,t.filteredOnly),n=e.aggData;return r.forEach((l,a)=>{o[l.getId()]=this.aggregateValues(i[a],l.getAggFunc(),l,e)}),s&&n&&s.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 s=0;s<t.length;s++){const i=t[s];r=r?r[i]:null}return r?r.map(s=>this.valueService.getValue(o,s)):[]}getValuesNormal(e,t,o){const r=[];t.forEach(()=>r.push([]));const s=t.length,i=o?e.childrenAfterFilter:e.childrenAfterGroup,n=i.length;for(let l=0;l<n;l++){const a=i[l];for(let u=0;u<s;u++){const c=t[u],h=this.valueService.getValue(c,a);r[u].push(h)}}return r}aggregateValues(e,t,o,r,s){const i=typeof t=="string"?this.aggFuncService.getAggFunc(t):t;if(typeof i!="function")return(0,import_core2._errorOnce)(`unrecognised aggregation function ${t}`),null;const n=i,l=this.gos.addGridCommonParams({values:e,column:o,colDef:o?o.getColDef():void 0,pivotResultColumn:s,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=this.gos.isGroupMultiAutoColumn();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((s,i)=>{t.push(this.createOneAutoCol(s,i))}):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 s=new import_core3.AgColumn(r,null,o,!0);return this.createBean(s),s}updateOneAutoCol(e,t,o){const r=e.getColDef(),s=typeof r.showRowGroup=="string"?r.showRowGroup:void 0,i=s!=null?this.columnModel.getColDefCol(s):void 0,n=this.createAutoColDef(e.getId(),i??void 0,t);e.setColDef(n,null,o),this.columnFactory.applyColumnState(e,n,o)}createAutoColDef(e,t,o){let r=this.createBaseColDef(t);const s=this.gos.get("autoGroupColumnDef");(0,import_core3._mergeDeep)(r,s),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 i=this.gos.isColumnsSortingCoupledToGroup(),n=r.valueGetter||r.field!=null;return i&&!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 i=e.getColDef();Object.assign(r,{headerName:this.columnNameService.getDisplayNameForColumn(e,"header"),headerValueGetter:i.headerValueGetter}),i.cellRenderer&&Object.assign(r,{cellRendererParams:{innerRenderer:i.cellRenderer,innerRendererParams:i.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,s){super(t,o,s,` | ||
<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_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(o=>!t.removeFromChildrenAfterGroup[o.id]),e.allLeafChildren=e.allLeafChildren?.filter(o=>!t.removeFromAllLeafChildren[o.id])??null,e.updateHasChildren(),e.sibling&&(e.sibling.childrenAfterGroup=e.childrenAfterGroup,e.sibling.allLeafChildren=e.allLeafChildren)}),this.allSets={},this.allParents.length=0}},GroupStage=class extends import_core15.BeanStub{constructor(){super(...arguments),this.beanName="groupStage",this.treeNodeCache=new TreeDataNodeCache}wireBeans(e){this.beans=e,this.columnModel=e.columnModel,this.funcColsService=e.funcColsService,this.selectableService=e.selectableService,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)}t.usingTreeData||(this.positionLeafsAndGroups(e.changedPath),this.orderGroups(t)),this.selectableService.updateSelectableAfterGrouping()}positionLeafsAndGroups(e){e.forEachChangedNodeDepthFirst(t=>{if(t.childrenAfterGroup){const o=[],r=[];let s;t.childrenAfterGroup.forEach(i=>{i.childrenAfterGroup?.length?i.key===""&&!s?s=i:r.push(i):o.push(i)}),s&&r.push(s),t.childrenAfterGroup=[...o,...r]}},!1)}createGroupingDetails(e){const{rowNode:t,changedPath:o,rowNodeTransactions:r,rowNodeOrder:s}=e,i=this.gos.get("treeData"),n=i?null:this.funcColsService.getRowGroupColumns();return{expandByDefault:this.gos.get("groupDefaultExpanded"),groupedCols:n,rootNode:t,pivotMode:this.columnModel.isPivotMode(),groupedColCount:i||!n?0:n.length,rowNodeOrder:s,transactions:r,changedPath:o,groupAllowUnbalanced:this.gos.get("groupAllowUnbalanced"),isGroupOpenByDefault:this.gos.getCallback("isGroupOpenByDefault"),initialGroupOrderComparator:this.gos.getCallback("initialGroupOrderComparator"),usingTreeData:i,suppressGroupMaintainValueType:this.gos.get("suppressGroupMaintainValueType"),getDataPath:i?this.gos.get("getDataPath"):void 0,keyCreators:n?.map(a=>a.getColDef().keyCreator)??[]}}handleTransaction(e){e.transactions.forEach(t=>{const o=e.usingTreeData?void 0:new BatchRemover;if((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,!1),o){const r=o.getAllParents().slice();o.flush(),this.removeEmptyGroups(r,e)}}),e.rowNodeOrder&&this.sortChildren(e)}sortChildren(e){e.changedPath.forEachChangedNodeDepthFirst(t=>{(0,import_core15._sortRowNodesByOrder)(t.childrenAfterGroup,e.rowNodeOrder)&&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((i,n)=>t({nodeA:i,nodeB:n})),r.childrenAfterGroup.forEach(i=>o(i)))}}getExistingPathForNode(e,t){const o=[];let r=t.usingTreeData?e: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}topoSort(e,t){const o=[],r=Object.fromEntries(e.map((l,a)=>[l.id,a])),s=new Set(Object.keys(r)),i=[t.rootNode];let n=0;for(;n<i.length;){const l=i[n];if(n++,l===void 0)continue;if(l.id&&l.id in r&&(o.push(e[r[l.id]]),s.delete(l.id)),s.size===0)return o;const a=l.childrenAfterGroup??[];for(let u=0;u<a.length;u++)i.push(a[u])}return o}moveNodesInWrongPath(e,t,o){(t.usingTreeData?this.topoSort(e,t):e).forEach(s=>{t.changedPath.isActive()&&t.changedPath.addParentNode(s.parent);const i=u=>u.key,n=this.getExistingPathForNode(s,t).map(i),l=this.getGroupInfo(s,t).map(i);(0,import_core15._areEqual)(n,l)||this.moveNode(s,t,o)})}moveNode(e,t,o){if(this.removeNodesInStages([e],t,o),this.insertOneNode(e,t,!0,o),e.setData(e.data),t.changedPath.isActive()){const r=e.parent;t.changedPath.addParentNode(r)}}removeNodes(e,t,o){this.removeNodesInStages(e,t,o),t.changedPath.isActive()&&e.forEach(r=>t.changedPath.addParentNode(r.parent))}removeNodesInStages(e,t,o){if(this.removeNodesFromParents(e,t,o),t.usingTreeData){const r=e.map(s=>s.parent);this.removeEmptyGroups(r,t)}}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,s=o||new BatchRemover;e.forEach(i=>{this.removeFromParent(i,s),this.forEachParentGroup(t,i.parent,n=>{s.removeFromAllLeafChildren(n,i)})}),r&&s.flush()}removeEmptyGroups(e,t){let o=!0;const r=s=>{const i=this.getChildrenMappedKey(s.key,s.rowGroupColumn),n=s.parent;return(n?.childrenMapped?!n.childrenMapped[i]:!0)?!1:s.isEmptyRowGroupNode()};for(;o;){o=!1;const s=new BatchRemover;e.forEach(i=>{this.forEachParentGroup(t,i,n=>{const l=r(n);l&&t.usingTreeData&&n.data&&t.getDataPath?.(n.data)?n.setGroup((n.childrenAfterGroup&&n.childrenAfterGroup.length>0)??!1):l&&(o=!0,this.removeFromParent(n,s),n.setSelectedParams({newValue:!1,source:"rowGroupChanged"}))})}),s.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!=null&&delete e.parent.childrenMapped[o],e.setRowTop(null),e.setRowIndex(null)}addToParent(e,t){const o=this.getChildrenMappedKey(e.key,e.rowGroupColumn);t?.childrenMapped!=null&&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(!e.usingTreeData&&!r.group)return;const i={field:r.field,key:r.key,rowGroupColumn:r.rowGroupColumn,leafNode:r.allLeafChildren?.[0]};this.setGroupData(r,i,e),t(r.childrenAfterGroup)})};t(e.rootNode.childrenAfterGroup)}shotgunResetEverything(e,t){if(this.noChangeInGroupingColumns(e,t))return;this.selectionService.filterFromSelection(i=>i&&!i.group);const{rootNode:o,groupedCols:r}=e;o.leafGroup=e.usingTreeData?!1:r.length===0,o.childrenAfterGroup=[],o.childrenMapped={},o.updateHasChildren();const s=o.sibling;s&&(s.childrenAfterGroup=o.childrenAfterGroup,s.childrenMapped=o.childrenMapped),this.insertNodes(o.allLeafChildren,e,!1)}noChangeInGroupingColumns(e,t){let o=!1;const r=this.showRowGroupColsService.getShowRowGroupCols(),s=r?r.map(i=>i.getId()).join("-"):"";return t&&(o=e.usingTreeData||this.areGroupColsEqual(e,this.oldGroupingDetails),this.oldGroupDisplayColIds!==s&&this.checkAllGroupDataAfterColsChanged(e)),this.oldGroupingDetails=e,this.oldGroupDisplayColIds=s,o}insertNodes(e,t,o){t.usingTreeData?this.buildNodeCacheFromRows(e,t):this.treeNodeCache.clear(),e.forEach(r=>{this.insertOneNode(r,t,o),t.changedPath.isActive()&&t.changedPath.addParentNode(r.parent)})}insertOneNode(e,t,o,r){const s=this.getGroupInfo(e,t),i=t.usingTreeData?s.length-1:void 0,n=this.findParentForNode(e,s,t,r,i);if(t.usingTreeData){const l=(0,import_core15._last)(s);e.parent=n,e.level=s.length,this.ensureRowNodeFields(e,this.getChildrenMappedKey(l.key,l.rowGroupColumn)),this.setGroupData(e,l,t),o||this.setExpandedInitialValue(t,e),this.addToParent(e,n)}else n.group||(0,import_core15._warnOnce)("duplicate group keys for row data, keys should be unique",[n.data,e.data]),e.parent=n,e.level=s.length,n.childrenAfterGroup.push(e),n.updateHasChildren()}findParentForNode(e,t,o,r,s){let i=o.rootNode;return t.forEach((n,l)=>{s!==void 0&&l>=s||(i=this.getOrCreateNextNode(i,t,n,l,o),r?.isRemoveFromAllLeafChildren(i,e)?r?.preventRemoveFromAllLeafChildren(i,e):i.allLeafChildren.push(e))}),i}getOrCreateNextNode(e,t,o,r,s){const i=this.getChildrenMappedKey(o.key,o.rowGroupColumn);let n=e?.childrenMapped?.[i];return n||(s.usingTreeData&&this.treeNodeCache.has(t,r,i)?(n=this.treeNodeCache.get(t,r,i),n.parent=e):n=this.createGroup(o,e,r,s),this.addToParent(n,e)),n}buildNodeCacheFromRows(e,t){let o=0;const r=e.map(s=>{const i=this.getGroupInfo(s,t);return o=Math.max(o,i.length),i});this.treeNodeCache.clear();for(let s=0;s<o;s++)for(const[i,n]of r.entries()){const l=n[s]!==void 0,a=n[s+1]===void 0;if(!l)continue;const u=n[s];this.treeNodeCache.get(n,s,u.key)==null&&this.treeNodeCache.set(n,s,u.key,a?this.ensureRowNodeFields(e[i],u.key):null)}this.backfillGroups(this.treeNodeCache.inner(),t.rootNode,0,t)}ensureRowNodeFields(e,t){return t!==void 0&&(e.key=t),e.childrenMapped??(e.childrenMapped={}),e.allLeafChildren??(e.allLeafChildren=[]),e.childrenAfterGroup??(e.childrenAfterGroup=[]),e}backfillGroups(e,t,o,r){for(const[s,i]of Object.entries(e))i.node===null&&(i.node=this.createGroup({key:s,rowGroupColumn:null,field:null},t,o,r)),this.backfillGroups(i.subtree,i.node,o+1,r)}createGroup(e,t,o,r){const s=new import_core15.RowNode(this.beans);return s.group=!0,s.field=e.field,s.rowGroupColumn=e.rowGroupColumn,this.setGroupData(s,e,r),s.key=e.key,s.id=this.createGroupId(s,t,r.usingTreeData,o),s.level=o,s.leafGroup=r.usingTreeData?!1:o===r.groupedColCount-1,s.allLeafChildren=[],s.setAllChildrenCount(0),s.rowGroupIndex=r.usingTreeData?null:o,s.childrenAfterGroup=[],s.childrenMapped={},s.updateHasChildren(),s.parent=t,this.setExpandedInitialValue(r,s),s}createGroupId(e,t,o,r){let s;return o?s=(i,n,l)=>{if(l<0)return null;const a=n?s(n,n.parent,l-1):null;return`${a==null?"":a+"-"}${l}-${i.key}`}:s=(i,n)=>{if(!i.rowGroupColumn)return null;const l=n?s(n,n.parent,0):null;return`${l==null?"":l+"-"}${i.rowGroupColumn.getColId()}-${i.key}`},import_core15.RowNode.ID_PREFIX_ROW_GROUP+s(e,t,r)}setGroupData(e,t,o){e.groupData={},this.showRowGroupColsService.getShowRowGroupCols().forEach(s=>{if(o.usingTreeData){e.groupData[s.getColId()]=t.key;return}const n=e.rowGroupColumn;n!==null&&s.isRowGroupDisplayed(n.getId())&&(o.suppressGroupMaintainValueType?e.groupData[s.getColId()]=t.key:e.groupData[s.getColId()]=this.valueService.getValue(n,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){return t.usingTreeData?this.getGroupInfoFromCallback(e,t):this.getGroupInfoFromGroupColumns(e,t)}getGroupInfoFromCallback(e,t){const o=t.getDataPath?.(e.data);return(o===void 0||o.length===0)&&(0,import_core15._warnOnce)(`getDataPath() should not return an empty path for data ${e.data}`),o?.map(r=>({key:r,field:null,rowGroupColumn:null}))??[]}getGroupInfoFromGroupColumns(e,t){const o=[];return t.groupedCols.forEach(r=>{let s=this.valueService.getKeyForNode(r,e),i=s!=null&&s!=="";if((t.pivotMode||!t.groupAllowUnbalanced)&&!i&&(s="",i=!0),i){const l={key:s,field:r.getColDef().field,rowGroupColumn:r,leafNode:e};o.push(l)}}),o}},TreeDataNodeCache=class{constructor(){this.cache={}}traverse(e,t){let o=this.cache,r=0;for(;r<=t;){const s=e[r].key;s in o||(o[s]={node:null,subtree:{}}),o=o[s].subtree,r++}return o}set(e,t,o,r){const s=this.traverse(e,t-1);s[o]={node:r,subtree:{}}}has(e,t,o){const r=this.traverse(e,t-1);return o in r}get(e,t,o){return this.traverse(e,t-1)[o]?.node}clear(){this.cache={}}inner(){return this.cache}},import_core16=require("@ag-grid-community/core"),PIVOT_ROW_TOTAL_PREFIX="PivotRowTotal_",PivotColDefService=class extends import_core16.BeanStub{constructor(){super(...arguments),this.beanName="pivotColDefService"}wireBeans(e){this.columnModel=e.columnModel,this.funcColsService=e.funcColsService,this.columnNameService=e.columnNameService}postConstruct(){const e=()=>this.gos.get("serverSidePivotResultFieldSeparator")??"_";this.fieldSeparator=e(),this.addManagedPropertyListener("serverSidePivotResultFieldSeparator",()=>{this.fieldSeparator=e()});const t=()=>this.gos.get("pivotDefaultExpanded");this.pivotDefaultExpanded=t(),this.addManagedPropertyListener("pivotDefaultExpanded",()=>{this.pivotDefaultExpanded=t()})}createPivotColumnDefs(e){const t=this.createPivotColumnsFromUniqueValues(e);function o(i,n=[]){return i.forEach(l=>{l.children!==void 0?o(l.children,n):n.push(l)}),n}const r=o(t);this.addRowGroupTotals(t,r),this.addExpandablePivotGroups(t,r),this.addPivotTotalsToGroups(t,r);const s=r.map(i=>(0,import_core16._cloneObject)(i));return{pivotColumnGroupDefs:t,pivotColumnDefs:s}}createPivotColumnsFromUniqueValues(e){const t=this.funcColsService.getPivotColumns(),o=t.length;return this.recursivelyBuildGroup(0,e,[],o,t)}recursivelyBuildGroup(e,t,o,r,s){const i=this.funcColsService.getValueColumns();if(e>=r)return this.buildMeasureCols(o);const n=s[e].getColDef(),l=this.headerNameComparator.bind(this,n.pivotComparator);if(i.length===1&&this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&e===r-1){const u=[];return(0,import_core16._iterateObject)(t,c=>{const h=[...o,c],g=this.createColDef(i[0],c,h);g.columnGroupShow="open",u.push(g)}),u.sort(l),u}const a=[];return(0,import_core16._iterateObject)(t,(u,c)=>{const h=this.pivotDefaultExpanded===-1||e<this.pivotDefaultExpanded,g=[...o,u];a.push({children:this.recursivelyBuildGroup(e+1,c,g,r,s),headerName:u,pivotKeys:g,columnGroupShow:"open",openByDefault:h,groupId:this.generateColumnGroupId(g)})}),a.sort(l),a}buildMeasureCols(e){const t=this.funcColsService.getValueColumns();return t.length===0?[this.createColDef(null,"-",e)]:t.map(o=>{const r=this.columnNameService.getDisplayNameForColumn(o,"header");return{...this.createColDef(o,r,e),columnGroupShow:"open"}})}addExpandablePivotGroups(e,t){if(this.gos.get("suppressExpandablePivotGroups")||this.gos.get("pivotColumnGroupTotals"))return;const o=(r,s,i)=>{const n=r;if(n.children){const l=new Map;n.children.forEach(u=>{o(u,s,l)});const a=!n.children.some(u=>u.children);this.funcColsService.getValueColumns().forEach(u=>{const c=this.columnNameService.getDisplayNameForColumn(u,"header"),h=this.createColDef(u,c,r.pivotKeys);h.pivotTotalColumnIds=l.get(u.getColId()),h.columnGroupShow="closed",h.aggFunc=u.getAggFunc(),a||(r.children.push(h),s.push(h))}),this.merge(i,l)}else{const l=r;if(!l.pivotValueColumn)return;const a=l.pivotValueColumn.getColId(),u=i.has(a)?i.get(a):[];u.push(l.colId),i.set(a,u)}};e.forEach(r=>{o(r,t,new Map)})}addPivotTotalsToGroups(e,t){if(!this.gos.get("pivotColumnGroupTotals"))return;const o=this.gos.get("pivotColumnGroupTotals")==="after",r=this.funcColsService.getValueColumns(),s=r.map(n=>n.getAggFunc());if(!s||s.length<1||!this.sameAggFuncs(s))return;const i=r[0];e.forEach(n=>{this.recursivelyAddPivotTotal(n,t,i,o)})}recursivelyAddPivotTotal(e,t,o,r){const s=e;if(!s.children){const n=e;return n.colId?[n.colId]:null}let i=[];if(s.children.forEach(n=>{const l=this.recursivelyAddPivotTotal(n,t,o,r);l&&(i=i.concat(l))}),s.children.length>1){const l=this.localeService.getLocaleTextFunc()("pivotColumnGroupTotals","Total"),a=this.createColDef(o,l,e.pivotKeys,!0);a.pivotTotalColumnIds=i,a.aggFunc=o.getAggFunc();const u=e.children;r?u.push(a):u.unshift(a),t.push(a)}return i}addRowGroupTotals(e,t){if(!this.gos.get("pivotRowTotals"))return;const o=this.gos.get("pivotRowTotals")==="after",r=this.funcColsService.getValueColumns(),s=o?r.slice():r.slice().reverse();for(let i=0;i<s.length;i++){const n=s[i];let l=[];e.forEach(u=>{l=l.concat(this.extractColIdsForValueColumn(u,n))});const a=s.length>1||!this.gos.get("removePivotHeaderRowWhenSingleValueColumn");this.createRowGroupTotal(e,t,n,l,o,a)}}extractColIdsForValueColumn(e,t){const o=e;if(!o.children){const s=o;return s.pivotValueColumn===t&&s.colId?[s.colId]:[]}let r=[];return o.children.forEach(s=>{this.extractColIdsForValueColumn(s,t);const i=this.extractColIdsForValueColumn(s,t);r=r.concat(i)}),r}createRowGroupTotal(e,t,o,r,s,i){const n=this.funcColsService.getValueColumns();let l;if(n.length===0)l=this.createColDef(null,"-",[]);else{const u=this.columnNameService.getDisplayNameForColumn(o,"header");l=this.createColDef(o,u,[]),l.pivotTotalColumnIds=r}l.colId=PIVOT_ROW_TOTAL_PREFIX+l.colId,t.push(l);const a=i?{children:[l],pivotKeys:[],groupId:`${PIVOT_ROW_TOTAL_PREFIX}_pivotGroup_${o.getColId()}`}:l;s?e.push(a):e.unshift(a)}createColDef(e,t,o,r=!1){const s={};if(e){const i=e.getColDef();Object.assign(s,i),s.hide=!1}return s.headerName=t,s.colId=this.generateColumnId(o||[],e&&!r?e.getColId():""),s.field=s.colId,s.valueGetter=i=>i.data?.[i.colDef.field],s.pivotKeys=o,s.pivotValueColumn=e,s.filter===!0&&(s.filter="agNumberColumnFilter"),s}sameAggFuncs(e){if(e.length==1)return!0;for(let t=1;t<e.length;t++)if(e[t]!==e[0])return!1;return!0}headerNameComparator(e,t,o){return e?e(t.headerName,o.headerName):t.headerName&&!o.headerName?1:!t.headerName&&o.headerName?-1:!t.headerName||!o.headerName?0:t.headerName<o.headerName?-1:t.headerName>o.headerName?1:0}merge(e,t){t.forEach((o,r)=>{const i=[...e.has(r)?e.get(r):[],...o];e.set(r,i)})}generateColumnGroupId(e){return`pivotGroup_${this.funcColsService.getPivotColumns().map(o=>o.getColId()).join("-")}_${e.join("-")}`}generateColumnId(e,t){return`pivot_${this.funcColsService.getPivotColumns().map(r=>r.getColId()).join("-")}_${e.join("-")}_${t}`}createColDefsFromFields(e){const t={};for(let s=0;s<e.length;s++){const n=e[s].split(this.fieldSeparator);let l=t;for(let a=0;a<n.length;a++){const u=n[a];l[u]==null&&(l[u]={}),l=l[u]}}const o=(s,i,n,l)=>{const a=[];for(const h in n){const g=n[h],p=o(`${s}${this.fieldSeparator}${h}`,h,g,l+1);a.push(p)}if(a.length===0){const h=this.columnModel.getColDefCol(i);if(h){const p=this.columnNameService.getDisplayNameForColumn(h,"header")??i,m=this.createColDef(h,p,void 0,!1);return m.colId=s,m.aggFunc=h.getAggFunc(),m.valueGetter=f=>f.data?.[s],m}return{colId:s,headerName:i,valueGetter:p=>p.data?.[s]}}return this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&a.length===1&&"colId"in a[0]?(a[0].headerName=i,a[0]):{openByDefault:this.pivotDefaultExpanded===-1||l<this.pivotDefaultExpanded,groupId:s,headerName:i,children:a}},r=[];for(const s in t){const i=t[s],n=o(s,s,i,0);r.push(n)}return r}},import_core17=require("@ag-grid-community/core"),EXCEEDED_MAX_UNIQUE_VALUES="Exceeded maximum allowed pivot column count.",PivotStage=class extends import_core17.BeanStub{constructor(){super(...arguments),this.beanName="pivotStage",this.uniqueValues={},this.lastTimeFailed=!1,this.maxUniqueValues=-1,this.currentUniqueCount=0}wireBeans(e){this.valueService=e.valueService,this.columnModel=e.columnModel,this.pivotResultColsService=e.pivotResultColsService,this.funcColsService=e.funcColsService,this.pivotColDefService=e.pivotColDefService}execute(e){const t=e.changedPath;this.columnModel.isPivotActive()?this.executePivotOn(t):this.executePivotOff(t)}executePivotOff(e){this.aggregationColumnsHashLastTime=null,this.uniqueValues={},this.pivotResultColsService.isPivotResultColsPresent()&&(this.pivotResultColsService.setPivotResultCols(null,"rowModelUpdated"),e&&e.setInactive())}executePivotOn(e){const t=this.funcColsService.getValueColumns().length??1,o=this.gos.get("pivotMaxGeneratedColumns");this.maxUniqueValues=o===-1?-1:o/t;let r;try{r=this.bucketUpRowNodes(e)}catch(d){if(d.message===EXCEEDED_MAX_UNIQUE_VALUES){this.pivotResultColsService.setPivotResultCols([],"rowModelUpdated");const C={type:"pivotMaxColumnsExceeded",message:d.message};this.eventService.dispatchEvent(C),this.lastTimeFailed=!0;return}throw d}const s=this.setUniqueValues(r),i=this.funcColsService.getValueColumns(),n=i.map(d=>`${d.getId()}-${d.getColDef().headerName}`).join("#"),l=i.map(d=>d.getAggFunc().toString()).join("#"),a=this.aggregationColumnsHashLastTime!==n,u=this.aggregationFuncsHashLastTime!==l;this.aggregationColumnsHashLastTime=n,this.aggregationFuncsHashLastTime=l;const c=this.funcColsService.getRowGroupColumns().map(d=>d.getId()).join("#"),h=c!==this.groupColumnsHashLastTime;this.groupColumnsHashLastTime=c;const g=this.gos.get("pivotRowTotals"),p=this.gos.get("pivotColumnGroupTotals"),m=this.gos.get("suppressExpandablePivotGroups"),f=this.gos.get("removePivotHeaderRowWhenSingleValueColumn"),v=g!==this.pivotRowTotalsLastTime||p!==this.pivotColumnGroupTotalsLastTime||m!==this.suppressExpandablePivotGroupsLastTime||f!==this.removePivotHeaderRowWhenSingleValueColumnLastTime;if(this.pivotRowTotalsLastTime=g,this.pivotColumnGroupTotalsLastTime=p,this.suppressExpandablePivotGroupsLastTime=m,this.removePivotHeaderRowWhenSingleValueColumnLastTime=f,this.lastTimeFailed||s||a||h||u||v){const{pivotColumnGroupDefs:d,pivotColumnDefs:C}=this.pivotColDefService.createPivotColumnDefs(this.uniqueValues);this.pivotColumnDefs=C,this.pivotResultColsService.setPivotResultCols(d,"rowModelUpdated"),e&&e.setInactive()}this.lastTimeFailed=!1}setUniqueValues(e){const t=JSON.stringify(e),o=JSON.stringify(this.uniqueValues);return t!==o?(this.uniqueValues=e,!0):!1}bucketUpRowNodes(e){this.currentUniqueCount=0;const t={};e.forEachChangedNodeDepthFirst(r=>{r.leafGroup&&(r.childrenMapped=null)});const o=r=>{r.leafGroup?this.bucketRowNode(r,t):r.childrenAfterFilter?.forEach(o)};return e.executeFromRootNode(o),t}bucketRowNode(e,t){const o=this.funcColsService.getPivotColumns();o.length===0?e.childrenMapped=null:e.childrenMapped=this.bucketChildren(e.childrenAfterFilter,o,0,t),e.sibling&&(e.sibling.childrenMapped=e.childrenMapped)}bucketChildren(e,t,o,r){const s={},i=t[o];if(e.forEach(n=>{let l=this.valueService.getKeyForNode(i,n);if((0,import_core17._missing)(l)&&(l=""),!r[l]){this.currentUniqueCount+=1,r[l]={};const a=this.maxUniqueValues!==-1,u=this.currentUniqueCount>this.maxUniqueValues;if(a&&u)throw Error(EXCEEDED_MAX_UNIQUE_VALUES)}s[l]||(s[l]=[]),s[l].push(n)}),o===t.length-1)return s;{const n={};return(0,import_core17._iterateObject)(s,(l,a)=>{n[l]=this.bucketChildren(a,t,o+1,r[l])}),n}}getPivotColumnDefs(){return this.pivotColumnDefs}};function addAggFunc(e,t,o){e.aggFuncService&&e.aggFuncService.addAggFuncs({key:o})}function addAggFuncs(e,t){e.aggFuncService&&e.aggFuncService.addAggFuncs(t)}function clearAggFuncs(e){e.aggFuncService&&e.aggFuncService.clear()}function setColumnAggFunc(e,t,o){e.funcColsService.setColumnAggFunc(t,o,"api")}function isPivotMode(e){return e.columnModel.isPivotMode()}function getPivotResultColumn(e,t,o){return e.pivotResultColsService.lookupPivotResultCol(t,o)}function setValueColumns(e,t){e.funcColsService.setValueColumns(t,"api")}function getValueColumns(e){return e.funcColsService.getValueColumns()}function removeValueColumn(e,t){e.funcColsService.removeValueColumns([t],"api")}function removeValueColumns(e,t){e.funcColsService.removeValueColumns(t,"api")}function addValueColumn(e,t){e.funcColsService.addValueColumns([t],"api")}function addValueColumns(e,t){e.funcColsService.addValueColumns(t,"api")}function setRowGroupColumns(e,t){e.funcColsService.setRowGroupColumns(t,"api")}function removeRowGroupColumn(e,t){e.funcColsService.removeRowGroupColumns([t],"api")}function removeRowGroupColumns(e,t){e.funcColsService.removeRowGroupColumns(t,"api")}function addRowGroupColumn(e,t){e.funcColsService.addRowGroupColumns([t],"api")}function addRowGroupColumns(e,t){e.funcColsService.addRowGroupColumns(t,"api")}function moveRowGroupColumn(e,t,o){e.funcColsService.moveRowGroupColumn(t,o,"api")}function getRowGroupColumns(e){return e.funcColsService.getRowGroupColumns()}function setPivotColumns(e,t){e.funcColsService.setPivotColumns(t,"api")}function removePivotColumn(e,t){e.funcColsService.removePivotColumns([t],"api")}function removePivotColumns(e,t){e.funcColsService.removePivotColumns(t,"api")}function addPivotColumn(e,t){e.funcColsService.addPivotColumns([t],"api")}function addPivotColumns(e,t){e.funcColsService.addPivotColumns(t,"api")}function getPivotColumns(e){return e.funcColsService.getPivotColumns()}function setPivotResultColumns(e,t){e.pivotResultColsService.setPivotResultCols(t,"api")}function getPivotResultColumns(e){const t=e.pivotResultColsService.getPivotResultCols();return t?t.list:null}var import_core18=require("@ag-grid-community/core"),ShowRowGroupColsService=class extends import_core18.BeanStub{constructor(){super(...arguments),this.beanName="showRowGroupColsService"}wireBeans(e){this.columnModel=e.columnModel,this.funcColsService=e.funcColsService}refresh(){this.showRowGroupCols=[],this.showRowGroupColsMap={},this.columnModel.getCols().forEach(e=>{const o=e.getColDef().showRowGroup,r=typeof o=="string";!r&&!(o===!0)||(this.showRowGroupCols.push(e),r?this.showRowGroupColsMap[o]=e:this.funcColsService.getRowGroupColumns().forEach(n=>{this.showRowGroupColsMap[n.getId()]=e}))})}getShowRowGroupCols(){return this.showRowGroupCols}getShowRowGroupCol(e){return this.showRowGroupColsMap[e]}},VERSION="32.0.0",RowGroupingCoreModule={version:VERSION,moduleName:`${import_core19.ModuleNames.RowGroupingModule}-core`,beans:[AggregationStage,FilterAggregatesStage,GroupStage,PivotColDefService,PivotStage,AggFuncService,AutoColService,ShowRowGroupColsService,ColumnDropZoneService],userComponents:[{name:"agGroupRowRenderer",classImp:import_core20.GroupCellRenderer},{name:"agGroupCellRenderer",classImp:import_core20.GroupCellRenderer}],controllers:[{name:"groupCellRendererCtrl",classImp:import_core20.GroupCellRendererCtrl}],dependantModules:[import_core20.EnterpriseCoreModule]},RowGroupingApiModule={version:VERSION,moduleName:`${import_core19.ModuleNames.RowGroupingModule}-api`,apiFunctions:{addAggFunc,addAggFuncs,clearAggFuncs,setColumnAggFunc,isPivotMode,getPivotResultColumn,setValueColumns,getValueColumns,removeValueColumn,removeValueColumns,addValueColumn,addValueColumns,setRowGroupColumns,removeRowGroupColumn,removeRowGroupColumns,addRowGroupColumn,addRowGroupColumns,getRowGroupColumns,moveRowGroupColumn,setPivotColumns,removePivotColumn,removePivotColumns,addPivotColumn,addPivotColumns,getPivotColumns,setPivotResultColumns,getPivotResultColumns},dependantModules:[RowGroupingCoreModule]},GroupFilterModule={version:VERSION,moduleName:"@ag-grid-enterprise/group-filter",userComponents:[{name:"agGroupColumnFilter",classImp:GroupFilter}],dependantModules:[RowGroupingCoreModule,import_core19._ColumnFilterModule]},GroupFloatingFilterModule={version:VERSION,moduleName:"@ag-grid-enterprise/group-floating-filter",userComponents:[{name:"agGroupColumnFloatingFilter",classImp:GroupFloatingFilterComp}],dependantModules:[GroupFilterModule,import_core19._FloatingFilterModule]},RowGroupingModule={version:VERSION,moduleName:import_core19.ModuleNames.RowGroupingModule,dependantModules:[RowGroupingCoreModule,RowGroupingApiModule,GroupFilterModule,GroupFloatingFilterModule]},import_core21=require("@ag-grid-community/core"),ValuesDropZonePanel=class extends BaseDropZonePanel{constructor(e){super(e,"aggregation")}postConstruct(){const e=this.localeService.getLocaleTextFunc(),t=e("valueColumnsEmptyMessage","Drag here to aggregate"),o=e("values","Values");super.init({icon:(0,import_core21._createIconNoSpan)("valuePanel",this.gos,null),emptyMessage:t,title:o}),this.addManagedEventListeners({columnValueChanged:this.refreshGui.bind(this)})}getAriaLabel(){return this.localeService.getLocaleTextFunc()("ariaValuesDropZonePanelLabel","Values")}getTooltipParams(){const e=super.getTooltipParams();return e.location="valueColumnsList",e}getIconName(){return this.isPotentialDndItems()?"aggregate":"notAllowed"}isItemDroppable(e,t){return this.gos.get("functionsReadOnly")||!e.isPrimary()?!1:e.isAllowValue()&&(!e.isValueActive()||this.isSourceEventFromTarget(t))}updateItems(e){this.funcColsService.setValueColumns(e,"toolPanelUi")}getExistingItems(){return this.funcColsService.getValueColumns()}}; | ||
`),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_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(o=>!t.removeFromChildrenAfterGroup[o.id]),e.allLeafChildren=e.allLeafChildren?.filter(o=>!t.removeFromAllLeafChildren[o.id])??null,e.updateHasChildren(),e.sibling&&(e.sibling.childrenAfterGroup=e.childrenAfterGroup,e.sibling.allLeafChildren=e.allLeafChildren)}),this.allSets={},this.allParents.length=0}},GroupStage=class extends import_core15.BeanStub{constructor(){super(...arguments),this.beanName="groupStage",this.treeNodeCache=new TreeDataNodeCache}wireBeans(e){this.beans=e,this.columnModel=e.columnModel,this.funcColsService=e.funcColsService,this.selectableService=e.selectableService,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)}t.usingTreeData||(this.positionLeafsAndGroups(e.changedPath),this.orderGroups(t)),this.selectableService.updateSelectableAfterGrouping()}positionLeafsAndGroups(e){e.forEachChangedNodeDepthFirst(t=>{if(t.childrenAfterGroup){const o=[],r=[];let s;t.childrenAfterGroup.forEach(i=>{i.childrenAfterGroup?.length?i.key===""&&!s?s=i:r.push(i):o.push(i)}),s&&r.push(s),t.childrenAfterGroup=[...o,...r]}},!1)}createGroupingDetails(e){const{rowNode:t,changedPath:o,rowNodeTransactions:r,rowNodeOrder:s}=e,i=this.gos.get("treeData"),n=i?null:this.funcColsService.getRowGroupColumns();return{expandByDefault:this.gos.get("groupDefaultExpanded"),groupedCols:n,rootNode:t,pivotMode:this.columnModel.isPivotMode(),groupedColCount:i||!n?0:n.length,rowNodeOrder:s,transactions:r,changedPath:o,groupAllowUnbalanced:this.gos.get("groupAllowUnbalanced"),isGroupOpenByDefault:this.gos.getCallback("isGroupOpenByDefault"),initialGroupOrderComparator:this.gos.getCallback("initialGroupOrderComparator"),usingTreeData:i,suppressGroupMaintainValueType:this.gos.get("suppressGroupMaintainValueType"),getDataPath:i?this.gos.get("getDataPath"):void 0,keyCreators:n?.map(a=>a.getColDef().keyCreator)??[]}}handleTransaction(e){e.transactions.forEach(t=>{const o=e.usingTreeData?void 0:new BatchRemover;if((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,!1),o){const r=o.getAllParents().slice();o.flush(),this.removeEmptyGroups(r,e)}}),e.rowNodeOrder&&this.sortChildren(e)}sortChildren(e){e.changedPath.forEachChangedNodeDepthFirst(t=>{(0,import_core15._sortRowNodesByOrder)(t.childrenAfterGroup,e.rowNodeOrder)&&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((i,n)=>t({nodeA:i,nodeB:n})),r.childrenAfterGroup.forEach(i=>o(i)))}}getExistingPathForNode(e,t){const o=[];let r=t.usingTreeData?e: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}topoSort(e,t){const o=[],r=Object.fromEntries(e.map((l,a)=>[l.id,a])),s=new Set(Object.keys(r)),i=[t.rootNode];let n=0;for(;n<i.length;){const l=i[n];if(n++,l===void 0)continue;if(l.id&&l.id in r&&(o.push(e[r[l.id]]),s.delete(l.id)),s.size===0)return o;const a=l.childrenAfterGroup??[];for(let u=0;u<a.length;u++)i.push(a[u])}return o}moveNodesInWrongPath(e,t,o){(t.usingTreeData?this.topoSort(e,t):e).forEach(s=>{t.changedPath.isActive()&&t.changedPath.addParentNode(s.parent);const i=u=>u.key,n=this.getExistingPathForNode(s,t).map(i),l=this.getGroupInfo(s,t).map(i);(0,import_core15._areEqual)(n,l)||this.moveNode(s,t,o)})}moveNode(e,t,o){if(this.removeNodesInStages([e],t,o),this.insertOneNode(e,t,!0,o),e.setData(e.data),t.changedPath.isActive()){const r=e.parent;t.changedPath.addParentNode(r)}}removeNodes(e,t,o){this.removeNodesInStages(e,t,o),t.changedPath.isActive()&&e.forEach(r=>t.changedPath.addParentNode(r.parent))}removeNodesInStages(e,t,o){if(this.removeNodesFromParents(e,t,o),t.usingTreeData){const r=e.map(s=>s.parent);this.removeEmptyGroups(r,t)}}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,s=o||new BatchRemover;e.forEach(i=>{this.removeFromParent(i,s),this.forEachParentGroup(t,i.parent,n=>{s.removeFromAllLeafChildren(n,i)})}),r&&s.flush()}removeEmptyGroups(e,t){let o=!0;const r=s=>{const i=this.getChildrenMappedKey(s.key,s.rowGroupColumn),n=s.parent;return(n?.childrenMapped?!n.childrenMapped[i]:!0)?!1:s.isEmptyRowGroupNode()};for(;o;){o=!1;const s=new BatchRemover;e.forEach(i=>{this.forEachParentGroup(t,i,n=>{const l=r(n);l&&t.usingTreeData&&n.data&&t.getDataPath?.(n.data)?n.setGroup((n.childrenAfterGroup&&n.childrenAfterGroup.length>0)??!1):l&&(o=!0,this.removeFromParent(n,s),n.setSelectedParams({newValue:!1,source:"rowGroupChanged"}))})}),s.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!=null&&delete e.parent.childrenMapped[o],e.setRowTop(null),e.setRowIndex(null)}addToParent(e,t){const o=this.getChildrenMappedKey(e.key,e.rowGroupColumn);t?.childrenMapped!=null&&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(!e.usingTreeData&&!r.group)return;const i={field:r.field,key:r.key,rowGroupColumn:r.rowGroupColumn,leafNode:r.allLeafChildren?.[0]};this.setGroupData(r,i,e),t(r.childrenAfterGroup)})};t(e.rootNode.childrenAfterGroup)}shotgunResetEverything(e,t){if(this.noChangeInGroupingColumns(e,t))return;this.selectionService.filterFromSelection(i=>i&&!i.group);const{rootNode:o,groupedCols:r}=e;o.leafGroup=e.usingTreeData?!1:r.length===0,o.childrenAfterGroup=[],o.childrenMapped={},o.updateHasChildren();const s=o.sibling;s&&(s.childrenAfterGroup=o.childrenAfterGroup,s.childrenMapped=o.childrenMapped),this.insertNodes(o.allLeafChildren,e,!1)}noChangeInGroupingColumns(e,t){let o=!1;const r=this.showRowGroupColsService.getShowRowGroupCols(),s=r?r.map(i=>i.getId()).join("-"):"";return t&&(o=e.usingTreeData||this.areGroupColsEqual(e,this.oldGroupingDetails),this.oldGroupDisplayColIds!==s&&this.checkAllGroupDataAfterColsChanged(e)),this.oldGroupingDetails=e,this.oldGroupDisplayColIds=s,o}insertNodes(e,t,o){t.usingTreeData?this.buildNodeCacheFromRows(e,t):this.treeNodeCache.clear(),e.forEach(r=>{this.insertOneNode(r,t,o),t.changedPath.isActive()&&t.changedPath.addParentNode(r.parent)})}insertOneNode(e,t,o,r){const s=this.getGroupInfo(e,t),i=t.usingTreeData?s.length-1:void 0,n=this.findParentForNode(e,s,t,r,i);if(t.usingTreeData){const l=n.childrenAfterGroup?.find(u=>u.key===e.key);if(l){(0,import_core15._warnOnce)("duplicate group keys for row data, keys should be unique",[l.data,e.data]);return}const a=(0,import_core15._last)(s);e.parent=n,e.level=s.length,this.ensureRowNodeFields(e,this.getChildrenMappedKey(a.key,a.rowGroupColumn)),this.setGroupData(e,a,t),o||this.setExpandedInitialValue(t,e),this.addToParent(e,n)}else n.group||(0,import_core15._warnOnce)("duplicate group keys for row data, keys should be unique",[n.data,e.data]),e.parent=n,e.level=s.length,n.childrenAfterGroup.push(e),n.updateHasChildren()}findParentForNode(e,t,o,r,s){let i=o.rootNode;return t.forEach((n,l)=>{s!==void 0&&l>=s||(i=this.getOrCreateNextNode(i,t,n,l,o),r?.isRemoveFromAllLeafChildren(i,e)?r?.preventRemoveFromAllLeafChildren(i,e):i.allLeafChildren.push(e))}),i}getOrCreateNextNode(e,t,o,r,s){const i=this.getChildrenMappedKey(o.key,o.rowGroupColumn);let n=e?.childrenMapped?.[i];return n||(s.usingTreeData&&this.treeNodeCache.has(t,r,i)?(n=this.treeNodeCache.get(t,r,i),n.parent=e):n=this.createGroup(o,e,r,s),this.addToParent(n,e)),n}buildNodeCacheFromRows(e,t){let o=0;const r=e.map(s=>{const i=this.getGroupInfo(s,t);return o=Math.max(o,i.length),i});this.treeNodeCache.clear();for(let s=0;s<o;s++)for(const[i,n]of r.entries()){const l=n[s]!==void 0,a=n[s+1]===void 0;if(!l)continue;const u=n[s];this.treeNodeCache.get(n,s,u.key)==null&&this.treeNodeCache.set(n,s,u.key,a?this.ensureRowNodeFields(e[i],u.key):null)}this.backfillGroups(this.treeNodeCache.inner(),t.rootNode,0,t)}ensureRowNodeFields(e,t){return t!==void 0&&(e.key=t),e.childrenMapped??(e.childrenMapped={}),e.allLeafChildren??(e.allLeafChildren=[]),e.childrenAfterGroup??(e.childrenAfterGroup=[]),e}backfillGroups(e,t,o,r){for(const[s,i]of Object.entries(e))i.node===null&&(i.node=this.createGroup({key:s,rowGroupColumn:null,field:null},t,o,r)),this.backfillGroups(i.subtree,i.node,o+1,r)}createGroup(e,t,o,r){const s=new import_core15.RowNode(this.beans);return s.group=!0,s.field=e.field,s.rowGroupColumn=e.rowGroupColumn,this.setGroupData(s,e,r),s.key=e.key,s.id=this.createGroupId(s,t,r.usingTreeData,o),s.level=o,s.leafGroup=r.usingTreeData?!1:o===r.groupedColCount-1,s.allLeafChildren=[],s.setAllChildrenCount(0),s.rowGroupIndex=r.usingTreeData?null:o,s.childrenAfterGroup=[],s.childrenMapped={},s.updateHasChildren(),s.parent=t,this.setExpandedInitialValue(r,s),s}createGroupId(e,t,o,r){let s;return o?s=(i,n,l)=>{if(l<0)return null;const a=n?s(n,n.parent,l-1):null;return`${a==null?"":a+"-"}${l}-${i.key}`}:s=(i,n)=>{if(!i.rowGroupColumn)return null;const l=n?s(n,n.parent,0):null;return`${l==null?"":l+"-"}${i.rowGroupColumn.getColId()}-${i.key}`},import_core15.RowNode.ID_PREFIX_ROW_GROUP+s(e,t,r)}setGroupData(e,t,o){e.groupData={},this.showRowGroupColsService.getShowRowGroupCols().forEach(s=>{if(o.usingTreeData){e.groupData[s.getColId()]=t.key;return}const n=e.rowGroupColumn;n!==null&&s.isRowGroupDisplayed(n.getId())&&(o.suppressGroupMaintainValueType?e.groupData[s.getColId()]=t.key:e.groupData[s.getColId()]=this.valueService.getValue(n,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){return t.usingTreeData?this.getGroupInfoFromCallback(e,t):this.getGroupInfoFromGroupColumns(e,t)}getGroupInfoFromCallback(e,t){const o=t.getDataPath?.(e.data);return(o===void 0||o.length===0)&&(0,import_core15._warnOnce)(`getDataPath() should not return an empty path for data ${e.data}`),o?.map(r=>({key:r,field:null,rowGroupColumn:null}))??[]}getGroupInfoFromGroupColumns(e,t){const o=[];return t.groupedCols.forEach(r=>{let s=this.valueService.getKeyForNode(r,e),i=s!=null&&s!=="";if((t.pivotMode||!t.groupAllowUnbalanced)&&!i&&(s="",i=!0),i){const l={key:s,field:r.getColDef().field,rowGroupColumn:r,leafNode:e};o.push(l)}}),o}},TreeDataNodeCache=class{constructor(){this.cache={}}traverse(e,t){let o=this.cache,r=0;for(;r<=t;){const s=e[r].key;s in o||(o[s]={node:null,subtree:{}}),o=o[s].subtree,r++}return o}set(e,t,o,r){const s=this.traverse(e,t-1);s[o]={node:r,subtree:{}}}has(e,t,o){const r=this.traverse(e,t-1);return o in r}get(e,t,o){return this.traverse(e,t-1)[o]?.node}clear(){this.cache={}}inner(){return this.cache}},import_core16=require("@ag-grid-community/core"),PIVOT_ROW_TOTAL_PREFIX="PivotRowTotal_",PivotColDefService=class extends import_core16.BeanStub{constructor(){super(...arguments),this.beanName="pivotColDefService"}wireBeans(e){this.columnModel=e.columnModel,this.funcColsService=e.funcColsService,this.columnNameService=e.columnNameService}postConstruct(){const e=()=>this.gos.get("serverSidePivotResultFieldSeparator")??"_";this.fieldSeparator=e(),this.addManagedPropertyListener("serverSidePivotResultFieldSeparator",()=>{this.fieldSeparator=e()});const t=()=>this.gos.get("pivotDefaultExpanded");this.pivotDefaultExpanded=t(),this.addManagedPropertyListener("pivotDefaultExpanded",()=>{this.pivotDefaultExpanded=t()})}createPivotColumnDefs(e){const t=this.createPivotColumnsFromUniqueValues(e);function o(i,n=[]){return i.forEach(l=>{l.children!==void 0?o(l.children,n):n.push(l)}),n}const r=o(t);this.addRowGroupTotals(t,r),this.addExpandablePivotGroups(t,r),this.addPivotTotalsToGroups(t,r);const s=r.map(i=>(0,import_core16._cloneObject)(i));return{pivotColumnGroupDefs:t,pivotColumnDefs:s}}createPivotColumnsFromUniqueValues(e){const t=this.funcColsService.getPivotColumns(),o=t.length;return this.recursivelyBuildGroup(0,e,[],o,t)}recursivelyBuildGroup(e,t,o,r,s){const i=this.funcColsService.getValueColumns();if(e>=r)return this.buildMeasureCols(o);const n=s[e].getColDef(),l=this.headerNameComparator.bind(this,n.pivotComparator);if(i.length===1&&this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&e===r-1){const u=[];return(0,import_core16._iterateObject)(t,c=>{const h=[...o,c],g=this.createColDef(i[0],c,h);g.columnGroupShow="open",u.push(g)}),u.sort(l),u}const a=[];return(0,import_core16._iterateObject)(t,(u,c)=>{const h=this.pivotDefaultExpanded===-1||e<this.pivotDefaultExpanded,g=[...o,u];a.push({children:this.recursivelyBuildGroup(e+1,c,g,r,s),headerName:u,pivotKeys:g,columnGroupShow:"open",openByDefault:h,groupId:this.generateColumnGroupId(g)})}),a.sort(l),a}buildMeasureCols(e){const t=this.funcColsService.getValueColumns();return t.length===0?[this.createColDef(null,"-",e)]:t.map(o=>{const r=this.columnNameService.getDisplayNameForColumn(o,"header");return{...this.createColDef(o,r,e),columnGroupShow:"open"}})}addExpandablePivotGroups(e,t){if(this.gos.get("suppressExpandablePivotGroups")||this.gos.get("pivotColumnGroupTotals"))return;const o=(r,s,i)=>{const n=r;if(n.children){const l=new Map;n.children.forEach(u=>{o(u,s,l)});const a=!n.children.some(u=>u.children);this.funcColsService.getValueColumns().forEach(u=>{const c=this.columnNameService.getDisplayNameForColumn(u,"header"),h=this.createColDef(u,c,r.pivotKeys);h.pivotTotalColumnIds=l.get(u.getColId()),h.columnGroupShow="closed",h.aggFunc=u.getAggFunc(),a||(r.children.push(h),s.push(h))}),this.merge(i,l)}else{const l=r;if(!l.pivotValueColumn)return;const a=l.pivotValueColumn.getColId(),u=i.has(a)?i.get(a):[];u.push(l.colId),i.set(a,u)}};e.forEach(r=>{o(r,t,new Map)})}addPivotTotalsToGroups(e,t){if(!this.gos.get("pivotColumnGroupTotals"))return;const o=this.gos.get("pivotColumnGroupTotals")==="after",r=this.funcColsService.getValueColumns(),s=r.map(n=>n.getAggFunc());if(!s||s.length<1||!this.sameAggFuncs(s))return;const i=r[0];e.forEach(n=>{this.recursivelyAddPivotTotal(n,t,i,o)})}recursivelyAddPivotTotal(e,t,o,r){const s=e;if(!s.children){const n=e;return n.colId?[n.colId]:null}let i=[];if(s.children.forEach(n=>{const l=this.recursivelyAddPivotTotal(n,t,o,r);l&&(i=i.concat(l))}),s.children.length>1){const l=this.localeService.getLocaleTextFunc()("pivotColumnGroupTotals","Total"),a=this.createColDef(o,l,e.pivotKeys,!0);a.pivotTotalColumnIds=i,a.aggFunc=o.getAggFunc();const u=e.children;r?u.push(a):u.unshift(a),t.push(a)}return i}addRowGroupTotals(e,t){if(!this.gos.get("pivotRowTotals"))return;const o=this.gos.get("pivotRowTotals")==="after",r=this.funcColsService.getValueColumns(),s=o?r.slice():r.slice().reverse();for(let i=0;i<s.length;i++){const n=s[i];let l=[];e.forEach(u=>{l=l.concat(this.extractColIdsForValueColumn(u,n))});const a=s.length>1||!this.gos.get("removePivotHeaderRowWhenSingleValueColumn");this.createRowGroupTotal(e,t,n,l,o,a)}}extractColIdsForValueColumn(e,t){const o=e;if(!o.children){const s=o;return s.pivotValueColumn===t&&s.colId?[s.colId]:[]}let r=[];return o.children.forEach(s=>{this.extractColIdsForValueColumn(s,t);const i=this.extractColIdsForValueColumn(s,t);r=r.concat(i)}),r}createRowGroupTotal(e,t,o,r,s,i){const n=this.funcColsService.getValueColumns();let l;if(n.length===0)l=this.createColDef(null,"-",[]);else{const u=this.columnNameService.getDisplayNameForColumn(o,"header");l=this.createColDef(o,u,[]),l.pivotTotalColumnIds=r}l.colId=PIVOT_ROW_TOTAL_PREFIX+l.colId,t.push(l);const a=i?{children:[l],pivotKeys:[],groupId:`${PIVOT_ROW_TOTAL_PREFIX}_pivotGroup_${o.getColId()}`}:l;s?e.push(a):e.unshift(a)}createColDef(e,t,o,r=!1){const s={};if(e){const i=e.getColDef();Object.assign(s,i),s.hide=!1}return s.headerName=t,s.colId=this.generateColumnId(o||[],e&&!r?e.getColId():""),s.field=s.colId,s.valueGetter=i=>i.data?.[i.colDef.field],s.pivotKeys=o,s.pivotValueColumn=e,s.filter===!0&&(s.filter="agNumberColumnFilter"),s}sameAggFuncs(e){if(e.length==1)return!0;for(let t=1;t<e.length;t++)if(e[t]!==e[0])return!1;return!0}headerNameComparator(e,t,o){return e?e(t.headerName,o.headerName):t.headerName&&!o.headerName?1:!t.headerName&&o.headerName?-1:!t.headerName||!o.headerName?0:t.headerName<o.headerName?-1:t.headerName>o.headerName?1:0}merge(e,t){t.forEach((o,r)=>{const i=[...e.has(r)?e.get(r):[],...o];e.set(r,i)})}generateColumnGroupId(e){return`pivotGroup_${this.funcColsService.getPivotColumns().map(o=>o.getColId()).join("-")}_${e.join("-")}`}generateColumnId(e,t){return`pivot_${this.funcColsService.getPivotColumns().map(r=>r.getColId()).join("-")}_${e.join("-")}_${t}`}createColDefsFromFields(e){const t={};for(let s=0;s<e.length;s++){const n=e[s].split(this.fieldSeparator);let l=t;for(let a=0;a<n.length;a++){const u=n[a];l[u]==null&&(l[u]={}),l=l[u]}}const o=(s,i,n,l)=>{const a=[];for(const h in n){const g=n[h],p=o(`${s}${this.fieldSeparator}${h}`,h,g,l+1);a.push(p)}if(a.length===0){const h=this.columnModel.getColDefCol(i);if(h){const p=this.columnNameService.getDisplayNameForColumn(h,"header")??i,m=this.createColDef(h,p,void 0,!1);return m.colId=s,m.aggFunc=h.getAggFunc(),m.valueGetter=f=>f.data?.[s],m}return{colId:s,headerName:i,valueGetter:p=>p.data?.[s]}}return this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&a.length===1&&"colId"in a[0]?(a[0].headerName=i,a[0]):{openByDefault:this.pivotDefaultExpanded===-1||l<this.pivotDefaultExpanded,groupId:s,headerName:i,children:a}},r=[];for(const s in t){const i=t[s],n=o(s,s,i,0);r.push(n)}return r}},import_core17=require("@ag-grid-community/core"),EXCEEDED_MAX_UNIQUE_VALUES="Exceeded maximum allowed pivot column count.",PivotStage=class extends import_core17.BeanStub{constructor(){super(...arguments),this.beanName="pivotStage",this.uniqueValues={},this.lastTimeFailed=!1,this.maxUniqueValues=-1,this.currentUniqueCount=0}wireBeans(e){this.valueService=e.valueService,this.columnModel=e.columnModel,this.pivotResultColsService=e.pivotResultColsService,this.funcColsService=e.funcColsService,this.pivotColDefService=e.pivotColDefService}execute(e){const t=e.changedPath;this.columnModel.isPivotActive()?this.executePivotOn(t):this.executePivotOff(t)}executePivotOff(e){this.aggregationColumnsHashLastTime=null,this.uniqueValues={},this.pivotResultColsService.isPivotResultColsPresent()&&(this.pivotResultColsService.setPivotResultCols(null,"rowModelUpdated"),e&&e.setInactive())}executePivotOn(e){const t=this.funcColsService.getValueColumns().length??1,o=this.gos.get("pivotMaxGeneratedColumns");this.maxUniqueValues=o===-1?-1:o/t;let r;try{r=this.bucketUpRowNodes(e)}catch(d){if(d.message===EXCEEDED_MAX_UNIQUE_VALUES){this.pivotResultColsService.setPivotResultCols([],"rowModelUpdated");const C={type:"pivotMaxColumnsExceeded",message:d.message};this.eventService.dispatchEvent(C),this.lastTimeFailed=!0;return}throw d}const s=this.setUniqueValues(r),i=this.funcColsService.getValueColumns(),n=i.map(d=>`${d.getId()}-${d.getColDef().headerName}`).join("#"),l=i.map(d=>d.getAggFunc().toString()).join("#"),a=this.aggregationColumnsHashLastTime!==n,u=this.aggregationFuncsHashLastTime!==l;this.aggregationColumnsHashLastTime=n,this.aggregationFuncsHashLastTime=l;const c=this.funcColsService.getRowGroupColumns().map(d=>d.getId()).join("#"),h=c!==this.groupColumnsHashLastTime;this.groupColumnsHashLastTime=c;const g=this.gos.get("pivotRowTotals"),p=this.gos.get("pivotColumnGroupTotals"),m=this.gos.get("suppressExpandablePivotGroups"),f=this.gos.get("removePivotHeaderRowWhenSingleValueColumn"),v=g!==this.pivotRowTotalsLastTime||p!==this.pivotColumnGroupTotalsLastTime||m!==this.suppressExpandablePivotGroupsLastTime||f!==this.removePivotHeaderRowWhenSingleValueColumnLastTime;if(this.pivotRowTotalsLastTime=g,this.pivotColumnGroupTotalsLastTime=p,this.suppressExpandablePivotGroupsLastTime=m,this.removePivotHeaderRowWhenSingleValueColumnLastTime=f,this.lastTimeFailed||s||a||h||u||v){const{pivotColumnGroupDefs:d,pivotColumnDefs:C}=this.pivotColDefService.createPivotColumnDefs(this.uniqueValues);this.pivotColumnDefs=C,this.pivotResultColsService.setPivotResultCols(d,"rowModelUpdated"),e&&e.setInactive()}this.lastTimeFailed=!1}setUniqueValues(e){const t=JSON.stringify(e),o=JSON.stringify(this.uniqueValues);return t!==o?(this.uniqueValues=e,!0):!1}bucketUpRowNodes(e){this.currentUniqueCount=0;const t={};e.forEachChangedNodeDepthFirst(r=>{r.leafGroup&&(r.childrenMapped=null)});const o=r=>{r.leafGroup?this.bucketRowNode(r,t):r.childrenAfterFilter?.forEach(o)};return e.executeFromRootNode(o),t}bucketRowNode(e,t){const o=this.funcColsService.getPivotColumns();o.length===0?e.childrenMapped=null:e.childrenMapped=this.bucketChildren(e.childrenAfterFilter,o,0,t),e.sibling&&(e.sibling.childrenMapped=e.childrenMapped)}bucketChildren(e,t,o,r){const s={},i=t[o];if(e.forEach(n=>{let l=this.valueService.getKeyForNode(i,n);if((0,import_core17._missing)(l)&&(l=""),!r[l]){this.currentUniqueCount+=1,r[l]={};const a=this.maxUniqueValues!==-1,u=this.currentUniqueCount>this.maxUniqueValues;if(a&&u)throw Error(EXCEEDED_MAX_UNIQUE_VALUES)}s[l]||(s[l]=[]),s[l].push(n)}),o===t.length-1)return s;{const n={};return(0,import_core17._iterateObject)(s,(l,a)=>{n[l]=this.bucketChildren(a,t,o+1,r[l])}),n}}getPivotColumnDefs(){return this.pivotColumnDefs}};function addAggFunc(e,t,o){e.aggFuncService&&e.aggFuncService.addAggFuncs({key:o})}function addAggFuncs(e,t){e.aggFuncService&&e.aggFuncService.addAggFuncs(t)}function clearAggFuncs(e){e.aggFuncService&&e.aggFuncService.clear()}function setColumnAggFunc(e,t,o){e.funcColsService.setColumnAggFunc(t,o,"api")}function isPivotMode(e){return e.columnModel.isPivotMode()}function getPivotResultColumn(e,t,o){return e.pivotResultColsService.lookupPivotResultCol(t,o)}function setValueColumns(e,t){e.funcColsService.setValueColumns(t,"api")}function getValueColumns(e){return e.funcColsService.getValueColumns()}function removeValueColumn(e,t){e.funcColsService.removeValueColumns([t],"api")}function removeValueColumns(e,t){e.funcColsService.removeValueColumns(t,"api")}function addValueColumn(e,t){e.funcColsService.addValueColumns([t],"api")}function addValueColumns(e,t){e.funcColsService.addValueColumns(t,"api")}function setRowGroupColumns(e,t){e.funcColsService.setRowGroupColumns(t,"api")}function removeRowGroupColumn(e,t){e.funcColsService.removeRowGroupColumns([t],"api")}function removeRowGroupColumns(e,t){e.funcColsService.removeRowGroupColumns(t,"api")}function addRowGroupColumn(e,t){e.funcColsService.addRowGroupColumns([t],"api")}function addRowGroupColumns(e,t){e.funcColsService.addRowGroupColumns(t,"api")}function moveRowGroupColumn(e,t,o){e.funcColsService.moveRowGroupColumn(t,o,"api")}function getRowGroupColumns(e){return e.funcColsService.getRowGroupColumns()}function setPivotColumns(e,t){e.funcColsService.setPivotColumns(t,"api")}function removePivotColumn(e,t){e.funcColsService.removePivotColumns([t],"api")}function removePivotColumns(e,t){e.funcColsService.removePivotColumns(t,"api")}function addPivotColumn(e,t){e.funcColsService.addPivotColumns([t],"api")}function addPivotColumns(e,t){e.funcColsService.addPivotColumns(t,"api")}function getPivotColumns(e){return e.funcColsService.getPivotColumns()}function setPivotResultColumns(e,t){e.pivotResultColsService.setPivotResultCols(t,"api")}function getPivotResultColumns(e){const t=e.pivotResultColsService.getPivotResultCols();return t?t.list:null}var import_core18=require("@ag-grid-community/core"),ShowRowGroupColsService=class extends import_core18.BeanStub{constructor(){super(...arguments),this.beanName="showRowGroupColsService"}wireBeans(e){this.columnModel=e.columnModel,this.funcColsService=e.funcColsService}refresh(){this.showRowGroupCols=[],this.showRowGroupColsMap={},this.columnModel.getCols().forEach(e=>{const o=e.getColDef().showRowGroup,r=typeof o=="string";!r&&!(o===!0)||(this.showRowGroupCols.push(e),r?this.showRowGroupColsMap[o]=e:this.funcColsService.getRowGroupColumns().forEach(n=>{this.showRowGroupColsMap[n.getId()]=e}))})}getShowRowGroupCols(){return this.showRowGroupCols}getShowRowGroupCol(e){return this.showRowGroupColsMap[e]}},VERSION="32.0.1",RowGroupingCoreModule={version:VERSION,moduleName:`${import_core19.ModuleNames.RowGroupingModule}-core`,beans:[AggregationStage,FilterAggregatesStage,GroupStage,PivotColDefService,PivotStage,AggFuncService,AutoColService,ShowRowGroupColsService,ColumnDropZoneService],userComponents:[{name:"agGroupRowRenderer",classImp:import_core20.GroupCellRenderer},{name:"agGroupCellRenderer",classImp:import_core20.GroupCellRenderer}],controllers:[{name:"groupCellRendererCtrl",classImp:import_core20.GroupCellRendererCtrl}],dependantModules:[import_core20.EnterpriseCoreModule]},RowGroupingApiModule={version:VERSION,moduleName:`${import_core19.ModuleNames.RowGroupingModule}-api`,apiFunctions:{addAggFunc,addAggFuncs,clearAggFuncs,setColumnAggFunc,isPivotMode,getPivotResultColumn,setValueColumns,getValueColumns,removeValueColumn,removeValueColumns,addValueColumn,addValueColumns,setRowGroupColumns,removeRowGroupColumn,removeRowGroupColumns,addRowGroupColumn,addRowGroupColumns,getRowGroupColumns,moveRowGroupColumn,setPivotColumns,removePivotColumn,removePivotColumns,addPivotColumn,addPivotColumns,getPivotColumns,setPivotResultColumns,getPivotResultColumns},dependantModules:[RowGroupingCoreModule]},GroupFilterModule={version:VERSION,moduleName:"@ag-grid-enterprise/group-filter",userComponents:[{name:"agGroupColumnFilter",classImp:GroupFilter}],dependantModules:[RowGroupingCoreModule,import_core19._ColumnFilterModule]},GroupFloatingFilterModule={version:VERSION,moduleName:"@ag-grid-enterprise/group-floating-filter",userComponents:[{name:"agGroupColumnFloatingFilter",classImp:GroupFloatingFilterComp}],dependantModules:[GroupFilterModule,import_core19._FloatingFilterModule]},RowGroupingModule={version:VERSION,moduleName:import_core19.ModuleNames.RowGroupingModule,dependantModules:[RowGroupingCoreModule,RowGroupingApiModule,GroupFilterModule,GroupFloatingFilterModule]},import_core21=require("@ag-grid-community/core"),ValuesDropZonePanel=class extends BaseDropZonePanel{constructor(e){super(e,"aggregation")}postConstruct(){const e=this.localeService.getLocaleTextFunc(),t=e("valueColumnsEmptyMessage","Drag here to aggregate"),o=e("values","Values");super.init({icon:(0,import_core21._createIconNoSpan)("valuePanel",this.gos,null),emptyMessage:t,title:o}),this.addManagedEventListeners({columnValueChanged:this.refreshGui.bind(this)})}getAriaLabel(){return this.localeService.getLocaleTextFunc()("ariaValuesDropZonePanelLabel","Values")}getTooltipParams(){const e=super.getTooltipParams();return e.location="valueColumnsList",e}getIconName(){return this.isPotentialDndItems()?"aggregate":"notAllowed"}isItemDroppable(e,t){return this.gos.get("functionsReadOnly")||!e.isPrimary()?!1:e.isAllowValue()&&(!e.isValueActive()||this.isSourceEventFromTarget(t))}updateItems(e){this.funcColsService.setValueColumns(e,"toolPanelUi")}getExistingItems(){return this.funcColsService.getValueColumns()}}; |
{ | ||
"name": "@ag-grid-enterprise/row-grouping", | ||
"version": "32.0.0", | ||
"version": "32.0.1", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
@@ -16,4 +16,4 @@ "main": "./dist/package/main.cjs.js", | ||
"dependencies": { | ||
"@ag-grid-community/core": "32.0.0", | ||
"@ag-grid-enterprise/core": "32.0.0" | ||
"@ag-grid-community/core": "32.0.1", | ||
"@ag-grid-enterprise/core": "32.0.1" | ||
}, | ||
@@ -20,0 +20,0 @@ "devDependencies": { |
{ | ||
"name": "@ag-grid-enterprise/row-grouping", | ||
"version": "32.0.0", | ||
"version": "32.0.1", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
@@ -16,4 +16,4 @@ "main": "./src/main.js", | ||
"dependencies": { | ||
"@ag-grid-community/core": "32.0.0", | ||
"@ag-grid-enterprise/core": "32.0.0" | ||
"@ag-grid-community/core": "32.0.1", | ||
"@ag-grid-enterprise/core": "32.0.1" | ||
}, | ||
@@ -20,0 +20,0 @@ "devDependencies": { |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "32.0.0"; | ||
export declare const VERSION = "32.0.1"; |
{ | ||
"name": "@ag-grid-enterprise/row-grouping", | ||
"version": "32.0.0", | ||
"version": "32.0.1", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
@@ -16,4 +16,4 @@ "main": "./dist/package/main.cjs.js", | ||
"dependencies": { | ||
"@ag-grid-community/core": "32.0.0", | ||
"@ag-grid-enterprise/core": "32.0.0" | ||
"@ag-grid-community/core": "32.0.1", | ||
"@ag-grid-enterprise/core": "32.0.1" | ||
}, | ||
@@ -20,0 +20,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
503185
7070
+ Added@ag-grid-community/core@32.0.1(transitive)
+ Added@ag-grid-enterprise/core@32.0.1(transitive)
+ Addedag-charts-types@10.0.1(transitive)
- Removed@ag-grid-community/core@32.0.0(transitive)
- Removed@ag-grid-enterprise/core@32.0.0(transitive)
- Removedag-charts-types@10.0.0(transitive)