UNPKG

@syncfusion/ej2-pivotview

Version:

The pivot grid, or pivot table, is used to visualize large sets of relational data in a cross-tabular format, similar to an Excel pivot table.

10 lines 1.17 MB
/*! * filename: ej2-pivotview.min.js * version : 31.1.23 * Copyright Syncfusion Inc. 2001 - 2025. All rights reserved. * Use of this code is subject to the terms of our license. * A copy of the current license can be obtained at any time by e-mailing * licensing@syncfusion.com. Any infringement will be prosecuted under * applicable laws. */ this.ej=this.ej||{},this.ej.pivotview=function(e,t,i,a,r,n,s,o,l,d,p,h,u,c,g,m){"use strict";var f="e-pivotfieldlist",v="e-rtl",S="e-device",y="e-icons",b="e-pivotfieldlist-container",C="e-collapse",x="e-expand",w="e-table",T="e-rowsheader",M="e-headercell",D="e-pivot-calc-check",O="e-pivot-calc-input",P="e-format",N="e-pivot-formula",E="e-menu-hide",I="e-visible-hide",F="e-movablescrolldiv",L="e-cellselectionbackground",A="e-selectionbackground",R="e-headercontent",k="e-remove-report",j="e-pivot-toolbar",q="e-pivotchart",H="e-pivotview-disable-icon",V="e-pivotview-select-icon",U="e-group-pivot-rows",B="e-pivot-toolbar-menu",_="e-pivot-content-loader",G=function(){function e(){}return e.getType=function(e){var t=new Date(e);return"boolean"==typeof e?"boolean":isNaN(Number(e))?t instanceof Date&&!isNaN(t.valueOf())?t&&t.getDay()&&(t.getHours()>0||t.getMinutes()>0||t.getSeconds()>0||t.getMilliseconds()>0)?"datetime":"date":typeof e:"number"},e.resetTime=function(e){return e.setHours(0,0,0,0),e},e.getClonedData=function(e){var t=[];if(e)for(var i=0,a=e;i<a.length;i++){for(var r=a[i],n=Object.keys(r),s=0,o={};s<n.length;)o[n[s]]=r[n[s]],s++;t.push(o)}return t},e.getClonedCSVData=function(e){return e.map(function(e){return e.slice()})},e.getDefinedObj=function(e){var t=0,i={};if(null!==e&&void 0!==e)for(var a=Object.keys(e);t<a.length;)null!==e[a[t]]&&void 0!==e[a[t]]&&(i[a[t]]=e[a[t]]),t++;else i=e;return i},e.inArray=function(e,t){if(t)for(var i=0,a=t.length;i<a;i++)if(t[i]===e)return i;return-1},e.setPivotProperties=function(e,t){e.allowServerDataBinding=!1,e.pivotGridModule&&(e.pivotGridModule.allowServerDataBinding=!1),e.setProperties(t,!0),e.allowServerDataBinding=!0,e.pivotGridModule&&(e.pivotGridModule.allowServerDataBinding=!0)},e.getClonedDataSourceSettings=function(e){return this.getDefinedObj({type:e.type,catalog:e.catalog,cube:e.cube,providerType:e.providerType,url:e.url,localeIdentifier:e.localeIdentifier,excludeFields:t.isNullOrUndefined(e.excludeFields)?[]:e.excludeFields.slice(),expandAll:e.expandAll,allowLabelFilter:e.allowLabelFilter,allowValueFilter:e.allowValueFilter,allowMemberFilter:e.allowMemberFilter,enableSorting:!!e.enableSorting,rows:this.cloneFieldSettings(e.rows),columns:this.cloneFieldSettings(e.columns),filters:this.cloneFieldSettings(e.filters),values:this.cloneFieldSettings(e.values),filterSettings:this.cloneFilterSettings(e.filterSettings),sortSettings:this.cloneSortSettings(e.sortSettings),drilledMembers:this.cloneDrillMemberSettings(e.drilledMembers),valueSortSettings:this.CloneValueSortObject(e.valueSortSettings),valueAxis:e.valueAxis,valueIndex:e.valueIndex,grandTotalsPosition:e.grandTotalsPosition,formatSettings:this.cloneFormatSettings(e.formatSettings),calculatedFieldSettings:this.cloneCalculatedFieldSettings(e.calculatedFieldSettings),fieldMapping:this.cloneFieldSettings(e.fieldMapping),showSubTotals:e.showSubTotals,showRowSubTotals:e.showRowSubTotals,showColumnSubTotals:e.showColumnSubTotals,subTotalsPosition:e.subTotalsPosition,showGrandTotals:e.showGrandTotals,showRowGrandTotals:e.showRowGrandTotals,showColumnGrandTotals:e.showColumnGrandTotals,showHeaderWhenEmpty:e.showHeaderWhenEmpty,alwaysShowValueHeader:e.alwaysShowValueHeader,conditionalFormatSettings:this.cloneConditionalFormattingSettings(e.conditionalFormatSettings),emptyCellsTextContent:e.emptyCellsTextContent,groupSettings:this.cloneGroupSettings(e.groupSettings),showAggregationOnValueField:e.showAggregationOnValueField,authentication:this.CloneAuthenticationObject(e.authentication)})},e.getClonedFieldList=function(e,t){for(var i=Object.keys(e),a={},r=0,n=i.length;r<n;r++){var s=e[i[r]];e[i[r]]&&(a[i[r]]={type:s.type,caption:s.caption,id:s.id,isSelected:s.isSelected,sort:s.sort,filterType:s.filterType,index:s.index,filter:t?[]:s.filter,isCustomField:s.isCustomField,showRemoveIcon:s.showRemoveIcon,showFilterIcon:s.showFilterIcon,showSortIcon:s.showSortIcon,showNoDataItems:s.showNoDataItems,isCalculatedField:s.isCalculatedField,showEditIcon:s.showEditIcon,showValueTypeIcon:s.showValueTypeIcon,allowDragAndDrop:s.allowDragAndDrop,showSubTotals:s.showSubTotals,expandAll:s.expandAll,pid:s.pid,aggregateType:s.aggregateType,baseField:s.baseField,baseItem:s.baseItem,dateMember:t?[]:this.cloneDateMembers(s.dateMember),members:t?{}:this.cloneFormatMembers(s.members),formatString:s.formatString,format:s.format,formula:s.formula,isExcelFilter:s.isExcelFilter,membersOrder:s.membersOrder?s.membersOrder.slice():s.membersOrder,isAlphanumeric:s.isAlphanumeric,tag:s.tag,expanded:s.expanded,spriteCssClass:s.spriteCssClass,name:s.name,defaultHierarchy:s.defaultHierarchy,hasAllMember:s.hasAllMember,allMember:s.allMember,isChecked:s.isChecked,filterMembers:this.cloneFieldMembers(s.filterMembers),childMembers:t?[]:this.cloneFieldMembers(s.childMembers),searchMembers:t?[]:this.cloneFieldMembers(s.searchMembers),htmlAttributes:this.getDefinedObj(s.htmlAttributes),currrentMembers:t?{}:this.cloneFormatMembers(s.currrentMembers),isHierarchy:s.isHierarchy,isNamedSets:s.isNamedSets,actualFilter:s.actualFilter?s.actualFilter.slice():s.actualFilter,levels:t?[]:this.cloneFieldMembers(s.levels),levelCount:s.levelCount,fieldType:s.fieldType,memberType:s.memberType,parentHierarchy:s.parentHierarchy})}return a},e.cloneDateMembers=function(e){if(e){for(var t=[],i=0,a=e;i<a.length;i++){var r=a[i];t.push({formattedText:r.formattedText,actualText:r.actualText})}return t}return e},e.cloneFormatMembers=function(e){if(e){for(var t=Object.keys(e),i={},a=0,r=t.length;a<r;a++){var n=e[t[a]];i[t[a]]={index:n.index?n.index.slice():n.index,isDrilled:n.isDrilled,ordinal:n.ordinal}}return i}return e},e.cloneFieldMembers=function(e){if(e){for(var t=[],i=0,a=e;i<a.length;i++){var r=a[i];t.push({caption:r.caption,hasChildren:r.hasChildren,id:r.id,isSelected:r.isSelected,name:r.name,tag:r.tag,htmlAttributes:this.getDefinedObj(r.htmlAttributes),type:r.type,spriteCssClass:r.spriteCssClass,pid:r.pid,isChecked:r.isChecked})}return t}return e},e.updateDataSourceSettings=function(e,i){e&&this.setPivotProperties(e,{dataSourceSettings:this.getDefinedObj({type:i.type,catalog:i.catalog,cube:i.cube,providerType:i.providerType,url:i.url,localeIdentifier:i.localeIdentifier,excludeFields:t.isNullOrUndefined(i.excludeFields)?[]:i.excludeFields,expandAll:i.expandAll,allowLabelFilter:i.allowLabelFilter,allowValueFilter:i.allowValueFilter,allowMemberFilter:i.allowMemberFilter,enableSorting:!!i.enableSorting,rows:i.rows,columns:i.columns,filters:i.filters,values:i.values,filterSettings:i.filterSettings,sortSettings:i.sortSettings,drilledMembers:i.drilledMembers,valueSortSettings:i.valueSortSettings,valueAxis:i.valueAxis,grandTotalsPosition:i.grandTotalsPosition,formatSettings:i.formatSettings,calculatedFieldSettings:i.calculatedFieldSettings,fieldMapping:i.fieldMapping,showSubTotals:i.showSubTotals,showRowSubTotals:i.showRowSubTotals,showColumnSubTotals:i.showColumnSubTotals,subTotalsPosition:i.subTotalsPosition,showGrandTotals:i.showGrandTotals,showRowGrandTotals:i.showRowGrandTotals,showColumnGrandTotals:i.showColumnGrandTotals,showHeaderWhenEmpty:i.showHeaderWhenEmpty,alwaysShowValueHeader:i.alwaysShowValueHeader,conditionalFormatSettings:i.conditionalFormatSettings,emptyCellsTextContent:i.emptyCellsTextContent,groupSettings:i.groupSettings,showAggregationOnValueField:i.showAggregationOnValueField,authentication:this.CloneAuthenticationObject(i.authentication)})})},e.cloneFieldSettings=function(e){if(e){for(var t=[],i=0,a=e;i<a.length;i++){var r=a[i];t.push(this.getDefinedObj({name:r.name,caption:r.caption,axis:r.axis,baseField:r.baseField,baseItem:r.baseItem,isCalculatedField:r.isCalculatedField,isNamedSet:r.isNamedSet,showNoDataItems:r.showNoDataItems,showSubTotals:r.showSubTotals,type:r.type,dataType:r.dataType,showFilterIcon:r.showFilterIcon,showSortIcon:r.showSortIcon,showRemoveIcon:r.showRemoveIcon,showValueTypeIcon:r.showValueTypeIcon,showEditIcon:r.showEditIcon,allowDragAndDrop:r.allowDragAndDrop,expandAll:r.expandAll,groupName:r.groupName}))}return t}return e},e.cloneOlapFieldSettings=function(e){if(e){for(var t=[],i=0,a=e;i<a.length;i++){var r=a[i];t.push(this.getDefinedObj({caption:r.caption,hasChildren:r.hasChildren,id:r.id,isSelected:r.isSelected,name:r.name,spriteCssClass:r.spriteCssClass,tag:r.tag,type:r.type,pid:r.pid,expanded:r.expanded,defaultHierarchy:r.defaultHierarchy,hasAllMember:r.hasAllMember,allMember:r.allMember,isChecked:r.isChecked,filterMembers:r.filterMembers,formula:r.formula,childMembers:r.childMembers,searchMembers:r.searchMembers,htmlAttributes:this.getDefinedObj(r.htmlAttributes),currrentMembers:r.currrentMembers,isHierarchy:r.isHierarchy,isNamedSets:r.isNamedSets,formatString:r.formatString,actualFilter:r.actualFilter,levels:r.levels,levelCount:r.levelCount,memberType:r.memberType,fieldType:r.fieldType,parentHierarchy:r.parentHierarchy}))}return t}return e},e.cloneFilterSettings=function(e){if(e){for(var t=[],i=0,a=e;i<a.length;i++){var r=a[i];t.push(this.getDefinedObj({name:r.name,type:r.type,condition:r.condition,items:r.items?r.items.slice():r.items,levelCount:r.levelCount,measure:r.measure,selectedField:r.selectedField,showDateFilter:r.showDateFilter,showLabelFilter:r.showLabelFilter,showNumberFilter:r.showNumberFilter,value1:r.value1,value2:r.value2}))}return t}return e},e.cloneSortSettings=function(e){if(e){for(var t=[],i=0,a=e;i<a.length;i++){var r=a[i];t.push(this.getDefinedObj({name:r.name,order:r.order,membersOrder:r.membersOrder?r.membersOrder.slice():r.membersOrder}))}return t}return e},e.getFormattedHeader=function(t,i){var a=e.frameHeaderWithKeys(t);if(a.valueSort&&a.valueSort.axis){var r=a.valueSort.axis,n=this.isDateField(r,i);a.formattedText=n||!i.formatFields[r]||!0===t.isSum?a.formattedText:i.getFormattedValue(a.actualText,r).formattedText}return a},e.getFormattedMembers=function(e,t,i){var a=this.isDateField(t,i);if(a||i.groupingFields[t]){for(var r={},n=Object.keys(e),s=i.fieldList[t].dateMember,o=0,l=n.length;o<l;o++){var d=e[n[o]];a?r[d.caption]=d:r[s[d.ordinal-1].actualText]=d}return r}return e},e.isDateField=function(e,t){return t.formatFields[e]&&["date","dateTime","time"].indexOf(t.formatFields[e].type)>-1},e.formatChartHeaders=function(e,i,a,r){for(var n=[],s=0,o=e.length;s<o;s++){var l=a?i.parent.dataSourceSettings.columns.length>0&&!t.isNullOrUndefined(i.parent.dataSourceSettings.columns[s])?i.parent.dataSourceSettings.columns[s].name:void 0:i.parent.dataSourceSettings.rows.length>0&&!t.isNullOrUndefined(i.parent.dataSourceSettings.rows[s])?i.parent.dataSourceSettings.rows[s].name:void 0;t.isNullOrUndefined(l)?r&&r.isGrandSum?n.push(i.parent.localeObj.getConstant("grandTotal")):n.push(e[s]):i.engineModule.formatFields[l]&&["date","dateTime","time"].indexOf(i.engineModule.formatFields[l].type)>-1?n.push(e[s]):n.push(i.engineModule.getFormattedValue(e[s],l).formattedText)}return n.join(" - ")},e.cloneDrillMemberSettings=function(e){if(e){for(var t=[],i=0,a=e;i<a.length;i++){var r=a[i];t.push(this.getDefinedObj({name:r.name,delimiter:r.delimiter,items:r.items?r.items.slice():r.items}))}return t}return e},e.cloneFormatSettings=function(e){if(e){for(var t=[],i=0,a=e;i<a.length;i++){var r=a[i];t.push(this.getDefinedObj({name:r.name,calendar:r.calendar,currency:r.currency,format:r.format,maximumFractionDigits:r.maximumFractionDigits,maximumSignificantDigits:r.maximumSignificantDigits,minimumFractionDigits:r.minimumFractionDigits,minimumIntegerDigits:r.minimumIntegerDigits,minimumSignificantDigits:r.minimumSignificantDigits,skeleton:r.skeleton,type:r.type,useGrouping:r.useGrouping}))}return t}return e},e.CloneValueSortObject=function(e){return e?{columnIndex:e.columnIndex,headerDelimiter:e.headerDelimiter,headerText:e.headerText,measure:e.measure,sortOrder:e.sortOrder,columnHeaderText:e.columnHeaderText,rowHeaderText:e.rowHeaderText,rowSortOrder:e.rowSortOrder,columnSortOrder:e.columnSortOrder}:e},e.CloneAuthenticationObject=function(e){return e?{userName:e.userName,password:e.password}:e},e.cloneCalculatedFieldSettings=function(e){if(e){for(var t=[],i=0,a=e;i<a.length;i++){var r=a[i];t.push(this.getDefinedObj({name:r.name,formatString:r.formatString,formula:r.formula,hierarchyUniqueName:r.hierarchyUniqueName}))}return t}return e},e.cloneConditionalFormattingSettings=function(e){if(e){for(var t=[],i=0,a=e;i<a.length;i++){var r=a[i];t.push(this.getDefinedObj({applyGrandTotals:r.applyGrandTotals,conditions:r.conditions,label:r.label,measure:r.measure,style:r.style?{backgroundColor:r.style.backgroundColor,color:r.style.color,fontFamily:r.style.fontFamily,fontSize:r.style.fontSize}:r.style,value1:r.value1,value2:r.value2}))}return t}return e},e.cloneGroupSettings=function(e){if(e){for(var t=[],i=0,a=e;i<a.length;i++){var r=a[i];t.push(this.getDefinedObj({name:r.name,caption:r.caption,customGroups:this.cloneCustomGroups(r.customGroups),endingAt:r.endingAt,startingAt:r.startingAt,groupInterval:r.groupInterval,rangeInterval:r.rangeInterval,type:r.type}))}return t}return e},e.cloneCustomGroups=function(e){if(e){for(var t=[],i=0,a=e;i<a.length;i++){var r=a[i];t.push(this.getDefinedObj({groupName:r.groupName,items:r.items?r.items.slice():r.items}))}return t}return e},e.getFilterItemByName=function(e,t){var a=new i.DataManager({json:t}).executeLocal((new i.Query).where("name","equal",e));if(a&&a.length>0)return a[a.length-1]},e.getFieldByName=function(e,t){return new i.DataManager({json:t}).executeLocal((new i.Query).where("name","equal",e))[0]},e.getFieldInfo=function(e,t,i){if(!i)for(var a=[this.cloneFieldSettings(t.dataSourceSettings.rows),this.cloneFieldSettings(t.dataSourceSettings.columns),this.cloneFieldSettings(t.dataSourceSettings.values),this.cloneFieldSettings(t.dataSourceSettings.filters)],r=0,n=a.length;r<n;r++)for(var s=0,o=a[r]?a[r].length:0;s<o;s++)if(a[r][s]&&a[r][s].name===e)return{fieldName:e,fieldItem:a[r][s],axis:0===r?"rows":1===r?"columns":2===r?"values":"filters",position:s};var l="olap"===t.dataType?t.olapEngineModule.fieldList[e]:t.engineModule.fieldList[e];return{fieldName:e,fieldItem:l?{name:e,caption:l.caption,baseField:l.baseField,baseItem:l.baseItem,isCalculatedField:l.isCalculatedField,isNamedSet:l.isNamedSets,showNoDataItems:l.showNoDataItems,showSubTotals:l.showSubTotals,type:l.aggregateType,showFilterIcon:l.showFilterIcon,showSortIcon:l.showSortIcon,showRemoveIcon:l.showRemoveIcon,showValueTypeIcon:l.showValueTypeIcon,showEditIcon:l.showEditIcon,allowDragAndDrop:l.allowDragAndDrop,expandAll:l.expandAll}:void 0,axis:"fieldlist",position:-1}},e.isButtonIconRefesh=function(e,i,a){var r=!1;try{if("dataSourceSettings"===e&&i.dataSourceSettings&&a.dataSourceSettings){var n=["notAvail","notAvail","notAvail","notAvail"],s=Object.keys(i.dataSourceSettings),o=Object.keys(a.dataSourceSettings);if(s&&o&&o.length>0&&s.length===o.length)for(var l=["rows","columns","values","filters"],d=0;d<o.length;d++){var p=o[d]in i.dataSourceSettings&&!t.isNullOrUndefined(i.dataSourceSettings[o[d]])?Object.keys(i.dataSourceSettings[o[d]]):[],h=o[d]in a.dataSourceSettings&&!t.isNullOrUndefined(a.dataSourceSettings[o[d]])?Object.keys(a.dataSourceSettings[o[d]]):[];if(-1!==l.indexOf(o[d])&&-1!==l.indexOf(s[d])&&p&&h&&h.length>0&&p.length===h.length)for(var u=["showFilterIcon","showSortIcon","showRemoveIcon","showValueTypeIcon","showEditIcon","allowDragAndDrop","expandAll"],c=0;c<h.length;c++){for(var g=Object.keys(i.dataSourceSettings[o[d]][h[c]]),m=Object.keys(a.dataSourceSettings[o[d]][h[c]]),f=0;f<m.length;f++){if(-1===u.indexOf(m[f])||-1===u.indexOf(g[f])){n[d]="break";break}n[d]="update"}if("break"===n[d])break}else n[d]="break";if("break"===n[d])break}for(var v=0,S=0,y=0,b=0,C=n;b<C.length;b++){var x=C[b];"break"===x&&v++,"notAvail"===x&&S++,"update"===x&&y++}r=!(v>0||4===S)&&(0===v&&S<4&&y>0)}}catch(e){r=!1}return r},e.frameContent=function(e,t,i,a){var r=[],n=a;if(n.dataSourceSettings.values.length>0&&!n.engineModule.isEmptyData&&(n.enableValueSorting||!n.engineModule.isEngineUpdated))for(var s=0,o="value"===t?i:0,l="value"===t?e.length:i,d=o;d<l;d++)if(e[d]){r[s="header"===t?d:s]={};for(var p=0;p<e[d].length;p++)e[d][p]&&(r[s][p]=e[d][p]);s++}return r},e.getLocalizedObject=function(e){var t={};return t.Null=e.localeObj.getConstant("null"),t.Years=e.localeObj.getConstant("Years"),t.Quarters=e.localeObj.getConstant("Quarters"),t.Months=e.localeObj.getConstant("Months"),t.Days=e.localeObj.getConstant("Days"),t.Hours=e.localeObj.getConstant("Hours"),t.Minutes=e.localeObj.getConstant("Minutes"),t.Seconds=e.localeObj.getConstant("Seconds"),t.QuarterYear=e.localeObj.getConstant("QuarterYear"),t.Of=e.localeObj.getConstant("of"),t.Qtr=e.localeObj.getConstant("qtr"),t.Undefined=e.localeObj.getConstant("undefined"),t.GroupOutOfRange=e.localeObj.getConstant("groupOutOfRange"),t.Group=e.localeObj.getConstant("group"),t},e.generateUUID=function(){var e=(new Date).getTime(),t=performance&&performance.now&&1e3*performance.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){var a=16*Math.random();return e>0?(a=(e+a)%16|0,e=Math.floor(e/16)):(a=(t+a)%16|0,t=Math.floor(t/16)),("x"===i?a:3&a|8).toString(16)})},e.applyCustomSort=function(e,t,i,a,r){var n,s=[];(s=e.IsOrderChanged?e.members:"Ascending"===e.sortOrder||"None"===e.sortOrder||void 0===e.sortOrder?[].concat(e.members):[].concat(e.members).reverse()).length>t.length&&(s=s.filter(function(e){return t.some(function(t){var a=r?t.formattedText:"string"===i||"number"===i?t.actualText:t.dateText;return typeof e==typeof a&&a===e})}));var o=[],l=void 0===i||"string"===i||"number"===i;t.length>0&&"Grand Total"===t[0].actualText&&(n=t[0],t.shift());for(var d=0,p=0;d<t.length;d++){var h=t[d],u=r?h.formattedText:l?h.actualText:!0===i?h.actualText.toString():h.dateText;if(s[p]===u){if(t.splice(p++,0,h),t.splice(++d,1),!(p<s.length)){a||o.splice(--p,0,u);break}d=-1}d>=0&&!a&&(o[d]=u)}if(!a){for(d=o.length;d<t.length;d++){var h=t[d],u=r?h.formattedText:l?h.actualText:!0===i?h.actualText.toString():h.dateText;o[d]=u}"Grand Total"===o[o.length-1]&&o.pop(),e.members=o}return n&&t.splice(0,0,n),t},e.applyHeadersSort=function(e,t,i,a){if(a)e=e.sort(function(e,i){var a=e.actualText,r=i.actualText;return"Grand Total"===a||"Grand Total"===r?0:"Out of Range"===a?1:"Out of Range"===r?-1:isNaN(parseFloat(a))||isNaN(parseFloat(r))?"Ascending"===t?a.localeCompare(r,void 0,{numeric:!0,sensitivity:"base"}):r.localeCompare(a,void 0,{numeric:!0,sensitivity:"base"}):"Ascending"===t?parseFloat(a)-parseFloat(r):parseFloat(r)-parseFloat(a)});else if("datetime"===i||"date"===i||"time"===i)e="Ascending"===t?e.sort(function(e,t){return"Out of Range"===e.dateText?1:"Out of Range"===t.dateText?-1:e.dateText>t.dateText?1:e.dateText<t.dateText?-1:0}):"Descending"===t?e.sort(function(e,t){return"Out of Range"===e.dateText?1:"Out of Range"===t.dateText?-1:e.dateText<t.dateText?1:e.dateText>t.dateText?-1:0}):e;else if(!0===i)e="Ascending"===t?e.sort(function(e,t){return"Grand Total"===e.actualText||"Grand Total"===t.actualText?0:"Out of Range"===e.actualText?1:"Out of Range"===t.actualText?-1:Number(e.actualText.toString().match(/\d+/))>Number(t.actualText.toString().match(/\d+/))?1:Number(t.actualText.toString().match(/\d+/))>Number(e.actualText.toString().match(/\d+/))?-1:0}):"Descending"===t?e.sort(function(e,t){return"Grand Total"===e.actualText||"Grand Total"===t.actualText?0:"Out of Range"===e.actualText?-1:"Out of Range"===t.actualText?1:Number(e.actualText.toString().match(/\d+/))<Number(t.actualText.toString().match(/\d+/))?1:Number(t.actualText.toString().match(/\d+/))<Number(e.actualText.toString().match(/\d+/))?-1:0}):e;else if("string"===i){var r=function(e,i){return"Ascending"===t?"Grand Total"===String(e.actualText)||"Grand Total"===String(i.actualText)?0:String(e.actualText).localeCompare(String(i.actualText),void 0,{sensitivity:"base"}):"Grand Total"===String(e.actualText)||"Grand Total"===String(i.actualText)?0:String(i.actualText).localeCompare(String(e.actualText),void 0,{sensitivity:"base"})};e.sort(r)}else e="Ascending"===t?e.sort(function(e,t){return"Grand Total"===e.actualText||"Grand Total"===t.actualText?0:e.actualText>t.actualText?1:t.actualText>e.actualText?-1:0}):"Descending"===t?e.sort(function(e,t){return"Grand Total"===e.actualText||"Grand Total"===t.actualText?0:e.actualText<t.actualText?1:t.actualText<e.actualText?-1:0}):e;return e},e.renderOlapEngine=function(e,t){try{e.olapEngineModule.renderEngine(e.dataSourceSettings,t||e.frameCustomProperties(e.olapEngineModule.fieldListData,e.olapEngineModule.fieldList),e.onHeadersSort?e.getHeaderSortInfo.bind(e):void 0,e.beforeServiceInvoke?e.getBeforeServiceInvoke.bind(e):void 0,e.afterServiceInvoke?e.getAfterServiceInvoke.bind(e):void 0),e.setProperties({dataSourceSettings:{valueIndex:e.olapEngineModule.measureIndex}},!0)}catch(t){e.actionObj.actionName="engineFormation",e.olapEngineModule.errorInfo?(e.actionFailureMethod(e.olapEngineModule.errorInfo),e.olapEngineModule.errorInfo=void 0):e.actionFailureMethod(t)}},e.frameHeaderWithKeys=function(e){for(var t=Object.keys(e),i=0,a={};i<t.length;)a[t[i]]=e[t[i]],i++;return a},e.getPageSize=function(e){switch(e){case"Letter":return new a.SizeF(612,792);case"Note":return new a.SizeF(540,720);case"Legal":return new a.SizeF(612,1008);case"A0":return new a.SizeF(2380,3368);case"A1":return new a.SizeF(1684,2380);case"A2":return new a.SizeF(1190,1684);case"A3":return new a.SizeF(842,1190);case"A5":return new a.SizeF(421,595);case"A6":return new a.SizeF(297,421);case"A7":return new a.SizeF(210,297);case"A8":return new a.SizeF(148,210);case"A9":return new a.SizeF(105,148);case"B0":return new a.SizeF(2836,4008);case"B1":return new a.SizeF(2004,2836);case"B2":return new a.SizeF(1418,2004);case"B3":return new a.SizeF(1002,1418);case"B4":return new a.SizeF(709,1002);case"B5":return new a.SizeF(501,709);case"Archa":return new a.SizeF(648,864);case"Archb":return new a.SizeF(864,1296);case"Archc":return new a.SizeF(1296,1728);case"Archd":return new a.SizeF(1728,2592);case"Arche":return new a.SizeF(2592,3456);case"Flsa":return new a.SizeF(612,936);case"HalfLetter":return new a.SizeF(396,612);case"Letter11x17":return new a.SizeF(792,1224);case"Ledger":return new a.SizeF(1224,792);default:return new a.SizeF(595,842)}},e.getSortedValue=function(e,t){return e.sort(function(e,i){return"Descending"===t?(i.value||"grand sum"===i.header.type?i.value:0)-(e.value||"grand sum"===e.header.type?e.value:0):(e.value||"grand sum"===e.header.type?e.value:0)-(i.value||"grand sum"===i.header.type?i.value:0)}),e.map(function(e){return e.header})},e.toggleFieldListIconVisibility=function(e){e.showFieldList&&t.select("#"+e.element.id+"_PivotFieldList",e.element)&&(e.toolbar&&-1!==e.toolbar.indexOf("FieldList")?t.select("#"+e.element.id+"_PivotFieldList",e.element).style.display="none":(t.select("#"+e.element.id+"_PivotFieldList",e.element).style.top=e.element.querySelector("."+j).offsetHeight.toString()+"px",t.select("#"+e.element.id+"_PivotFieldList",e.element).style.position="relative")),e.toolbar&&-1!==e.toolbar.indexOf("FieldList")&&e.showToolbar&&e.element.querySelector(".e-toggle-field-list")&&(e.element.querySelector(".e-toggle-field-list").style.display="none")},e.isMemberDrilled=function(e,t,i){for(var a=!1,r=0;r<i.length;r++)for(var n=i[r].items,s=0;s<n.length&&!a;s++)for(var o=n[s].split(i[r].delimiter),l=e.formattedText.split(" "),d=[],p=0;p<l.length;p++)if(d.push(l[p]),d.join(" ")===o[o.length-1])for(var h=0;h<t.length&&o[h];h++){if(o[h]!==t[h]||o[0]!==t[0]){a=!1;break}a=!0}return a},e}(),z=function(){return(z=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)},W=function(){function e(){this.aggregatedValueMatrix=[],this.valueContent=[],this.formatFields={},this.groupingFieldsInfo={},this.dateFormatFunction={},this.calculatedFields={},this.calculatedFormulas={},this.valueAxis=0,this.saveDataHeaders={},this.columnCount=0,this.rowCount=0,this.columnPageCount=0,this.rowPageCount=0,this.colFirstLvl=0,this.rowFirstLvl=0,this.rowStartPos=0,this.colStartPos=0,this.enableValueSorting=!1,this.headerCollection={rowHeaders:[],columnHeaders:[],rowHeadersCount:0,columnHeadersCount:0},this.lastMember={},this.rMembers=[],this.cMembers=[],this.groupingFields={},this.isLastHeaderHasMeasures=!0,this.measureIndex=-1,this.isPagingOrVirtualizationEnabled=!1,this.rowMaxLevel=0,this.valueMatrix=[],this.memberCnt=-1,this.pageInLimit=!1,this.endPos=0,this.removeCount=0,this.colHdrBufferCalculated=!1,this.colValuesLength=1,this.rowValuesLength=1,this.slicedHeaders=[],this.fieldFilterMem={},this.filterPosObj={},this.selectedHeaders={selectedHeader:[],values:[]},this.rowGrandTotal=null,this.columnGrandTotal=null,this.removeRowGrandTotal=!1,this.removeColumnGrandTotal=!1,this.isValueHasAdvancedAggregate=!1,this.rawIndexObject={},this.reformAxisCount=0,this.isEditing=!1,this.valueAxisFields={},this.data=[],this.actualData=[],this.groupRawIndex={},this.fieldKeys={},this.allowDataCompression=!1,this.dataSourceSettings={},this.frameHeaderObjectsCollection=!1,this.headerObjectsCollection={},this.columnKeys={},this.fieldDrillCollection={},this.formatRegex=/^(?:[ncpae])(?:([0-9]|1[0-9]|20))?$/i,this.measureNames={},this.enablePaging=!1,this.enableVirtualization=!1,this.enableHtmlSanitizer=!1,this.enableOptimizedRendering=!1,this.groupedDataType={},this.tabularPivotValues=[],this.sortMembers={},this.viewportPageCount=3}return e.prototype.clearProperties=function(e){this.isPagingOrVirtualizationEnabled||e||(this.columnKeys={},this.headerCollection={rowHeaders:[],columnHeaders:[],rowHeadersCount:0,columnHeadersCount:0}),this.enableValueSorting&&(this.valueContent=[]),this.saveDataHeaders=this.allowValueFilter?this.saveDataHeaders:{},this.rMembers=[],this.cMembers=[],this.lastMember={},this.slicedHeaders=[],this.fieldFilterMem={},this.filterPosObj={},this.selectedHeaders={selectedHeader:[],values:[]},this.rowGrandTotal=null,this.columnGrandTotal=null,this.rawIndexObject={},this.dataSourceSettings.valueIndex>-1&&(this.valueAxisFields={}),this.headerObjectsCollection={},this.fieldDrillCollection={},this.sortMembers={}},e.prototype.renderEngine=function(e,a,r,n){if(this.getValueCellInfo=r,this.getHeaderSortInfo=n,this.customProperties=a,this.fieldList)for(var s=0,o=e.formatSettings;s<o.length;s++)!this.formatFields[o[s].name]&&this.fieldList[o[s].name]&&(this.fieldList[o[s].name].members={},this.fieldList[o[s].name].formattedMembers={},this.fieldList[o[s].name].dateMember=[]);this.formatFields={},this.dateFormatFunction={},this.calculatedFields={},this.calculatedFormulas={},this.valueAxis=0,this.saveDataHeaders={},this.columnCount=0,this.rowCount=0,this.columnPageCount=0,this.rowPageCount=0,this.colFirstLvl=0,this.rowFirstLvl=0,this.rowStartPos=0,this.colStartPos=0,this.dataSourceSettings.excludeFields=t.isNullOrUndefined(e.excludeFields)?[]:e.excludeFields,this.enableValueSorting=!1,this.headerCollection={rowHeaders:[],columnHeaders:[],rowHeadersCount:0,columnHeadersCount:0},this.aggregatedValueMatrix=[],this.rMembers=[],this.cMembers=[],this.memberCnt=-1,this.pageInLimit=!1,this.endPos=0,this.removeCount=0,this.colHdrBufferCalculated=!1,this.colValuesLength=1,this.rowValuesLength=1,this.slicedHeaders=[],this.fieldFilterMem={},this.filterPosObj={},this.selectedHeaders={selectedHeader:[],values:[]},this.rowGrandTotal=null,this.columnGrandTotal=null,this.removeRowGrandTotal=!1,this.removeColumnGrandTotal=!1,this.isValueHasAdvancedAggregate=!1,this.rawIndexObject={},this.isLastHeaderHasMeasures=!0,this.isEditing=!1;var l;if(this.globalize=a&&a.globalize?a.globalize:new t.Internationalization,this.currencyCode=a&&a.currenyCode?a.currenyCode:void 0,this.localeObj=a?a.localeObj:void 0,this.fieldsType=a?a.fieldsType:{},this.clonedReport=a?a.clonedReport&&a.clonedReport.properties?a.clonedReport.properties:a.clonedReport:{},this.enablePaging=a.enablePaging,this.enableVirtualization=a.enableVirtualization,this.enableOptimizedRendering=a.enableOptimizedRendering,this.enableHtmlSanitizer=a.enableHtmlSanitizer,this.isPagingOrVirtualizationEnabled=this.enablePaging||this.enableVirtualization,this.enableSort=e.enableSorting,this.dataSourceSettings.alwaysShowValueHeader=e.alwaysShowValueHeader,this.dataSourceSettings.showHeaderWhenEmpty=!!t.isNullOrUndefined(e.showHeaderWhenEmpty)||e.showHeaderWhenEmpty,this.dataSourceSettings.showSubTotals=!!t.isNullOrUndefined(e.showSubTotals)||e.showSubTotals,this.dataSourceSettings.showRowSubTotals=!!t.isNullOrUndefined(e.showRowSubTotals)||e.showRowSubTotals,this.dataSourceSettings.showColumnSubTotals=!!t.isNullOrUndefined(e.showColumnSubTotals)||e.showColumnSubTotals,this.dataSourceSettings.showGrandTotals=!!t.isNullOrUndefined(e.showGrandTotals)||e.showGrandTotals,this.dataSourceSettings.grandTotalsPosition=t.isNullOrUndefined(e.grandTotalsPosition)?"Bottom":e.grandTotalsPosition,this.dataSourceSettings.showRowGrandTotals=!!t.isNullOrUndefined(e.showRowGrandTotals)||e.showRowGrandTotals,this.dataSourceSettings.showColumnGrandTotals=!!t.isNullOrUndefined(e.showColumnGrandTotals)||e.showColumnGrandTotals,this.showSubTotalsAtTop=this.dataSourceSettings.showSubTotals&&this.dataSourceSettings.showColumnSubTotals&&"Top"===e.subTotalsPosition,this.showSubTotalsAtBottom=this.dataSourceSettings.showSubTotals&&this.dataSourceSettings.showRowSubTotals&&"Bottom"===e.subTotalsPosition||a.isTabularLayout,this.allowValueFilter=e.allowValueFilter,this.isValueFilterEnabled=!1,this.enableValueSorting=!!a&&a.enableValueSorting,this.isDrillThrough=!!a&&(!!a.isDrillThrough&&a.isDrillThrough),this.valueContent=[],this.dataSourceSettings=G.getClonedDataSourceSettings(e),e.dataSource instanceof i.DataManager||("CSV"===e.type?(this.data=e.dataSource.map(function(e){return e.slice()}),this.fieldList&&this.data.shift()):this.data=e.dataSource),this.data&&this.data[0]){if(!this.fieldList){"CSV"===e.type?this.fields=this.data.shift():this.fields=Object.keys(this.data[0]),this.fieldKeys={};for(s=0;s<this.fields.length;s++)this.fieldKeys[this.fields[s]]="CSV"===e.type?s:this.fields[s]}a&&a.pageSettings&&a.allowDataCompression&&(this.actualData=this.data,this.data=this.getGroupedRawData(e)),this.dataSourceSettings.rows=e.rows?e.rows:[],this.dataSourceSettings.columns=e.columns?e.columns:[],this.dataSourceSettings.filters=e.filters?e.filters:[],this.dataSourceSettings.values=e.values?e.values:[],this.dataSourceSettings.formatSettings=e.formatSettings?e.formatSettings:[],this.dataSourceSettings.groupSettings=e.groupSettings?e.groupSettings:[],this.dataSourceSettings.calculatedFieldSettings=e.calculatedFieldSettings?e.calculatedFieldSettings:[],this.enableSort=void 0===e.enableSorting||e.enableSorting,this.dataSourceSettings.fieldMapping=e.fieldMapping?e.fieldMapping:[],this.valueAxisFields={};for(var d=0,p=this.dataSourceSettings.values;d<p.length;d++){var h=p[d];this.valueAxisFields[h.name]=h}l=this.getGroupData(this.data),this.validateFilters(e),this.isExpandAll=!(!this.isValueFiltersAvail||!e.allowValueFilter)||e.expandAll,this.drilledMembers=e.drilledMembers?this.isValueFiltersAvail&&e.allowValueFilter?[]:e.drilledMembers:[],this.isMultiMeasures=this.dataSourceSettings.values.length>1,this.valueAxis="row"===e.valueAxis?1:0,this.measureIndex=t.isNullOrUndefined(e.valueIndex)?-1:e.valueIndex,this.emptyCellTextContent=e.emptyCellsTextContent?e.emptyCellsTextContent:"",this.rowValuesLength=1===this.valueAxis?this.dataSourceSettings.values.length:1,this.colValuesLength=0===this.valueAxis?this.dataSourceSettings.values.length:1,this.valueSortSettings=e.valueSortSettings||{rowSortOrder:"None",rowHeaderText:"",columnSortOrder:"None",columnHeaderText:"",headerDelimiter:".",columnIndex:void 0,rowIndex:void 0},this.valueSortData=[],this.pageSettings=a?a.pageSettings?a.pageSettings:this.pageSettings:void 0,this.allowDataCompression=a&&a.allowDataCompression,this.savedFieldList=a?a.savedFieldList:void 0,this.getFieldList(l,this.enableSort,e.allowValueFilter),this.removeIrrelevantFields(Object.keys(this.fieldList)),this.fillFieldMembers(),this.updateSortSettings(e.sortSettings,this.enableSort),this.filterMembers=[];var u=this.dataSourceSettings.columns.length-1;for(this.columnKeys={};u>-1;)this.columnKeys[this.dataSourceSettings.columns[u].name]=this.dataSourceSettings.columns[u],u--;this.updateFilterMembers(e),this.generateGridData(e)}},e.prototype.removeIrrelevantFields=function(e){var i={};i[0]=this.dataSourceSettings.rows,i[1]=this.dataSourceSettings.columns,i[2]=this.dataSourceSettings.values,i[3]=this.dataSourceSettings.filters;for(var a=0;a<4;){if(i[a])for(var r=0;r<i[a].length;r++){var n=i[a][r].name;this.dataSourceSettings.excludeFields.indexOf(n)>-1||!t.isNullOrUndefined(e)&&-1===e.indexOf(n)?(i[a].splice(r,1),r--):2===a&&(this.measureNames[n]=i[a][r].caption?i[a][r].caption:n,this.measureNames[i[a][r].caption?i[a][r].caption:n]=n)}a++}this.isMultiMeasures=this.dataSourceSettings.values.length>1,this.measureIndex=-1===this.measureIndex?this.valueAxis?i[0].length:i[1].length:this.measureIndex},e.prototype.updateDataSourceSettings=function(e,i){i&&(this.emptyCellTextContent=e.emptyCellsTextContent?e.emptyCellsTextContent:"",this.valueAxis="row"===e.valueAxis?1:0,this.rowValuesLength=1===this.valueAxis?this.dataSourceSettings.values.length:1,this.colValuesLength=0===this.valueAxis?this.dataSourceSettings.values.length:1,this.measureIndex=t.isNullOrUndefined(e.valueIndex)?-1:e.valueIndex,this.enableSort=e.enableSorting,this.dataSourceSettings.alwaysShowValueHeader=e.alwaysShowValueHeader,this.dataSourceSettings.showHeaderWhenEmpty=!!t.isNullOrUndefined(e.showHeaderWhenEmpty)||e.showHeaderWhenEmpty,this.dataSourceSettings.showSubTotals=!!t.isNullOrUndefined(e.showSubTotals)||e.showSubTotals,this.dataSourceSettings.showRowSubTotals=!!t.isNullOrUndefined(e.showRowSubTotals)||e.showRowSubTotals,this.dataSourceSettings.showColumnSubTotals=!!t.isNullOrUndefined(e.showColumnSubTotals)||e.showColumnSubTotals,this.dataSourceSettings.showGrandTotals=!!t.isNullOrUndefined(e.showGrandTotals)||e.showGrandTotals,this.dataSourceSettings.grandTotalsPosition=t.isNullOrUndefined(e.grandTotalsPosition)?"Bottom":e.grandTotalsPosition,this.dataSourceSettings.showRowGrandTotals=!!t.isNullOrUndefined(e.showRowGrandTotals)||e.showRowGrandTotals,this.dataSourceSettings.showColumnGrandTotals=!!t.isNullOrUndefined(e.showColumnGrandTotals)||e.showColumnGrandTotals,this.showSubTotalsAtTop=this.dataSourceSettings.showSubTotals&&"Top"===e.subTotalsPosition&&e.showColumnSubTotals,this.showSubTotalsAtBottom=!!this.customProperties.isTabularLayout||this.dataSourceSettings.showSubTotals&&"Bottom"===e.subTotalsPosition&&e.showRowSubTotals,this.allowValueFilter=e.allowValueFilter,this.dataSourceSettings.formatSettings=e.formatSettings?e.formatSettings:[],this.dataSourceSettings.groupSettings=e.groupSettings?e.groupSettings:[],this.dataSourceSettings.calculatedFieldSettings=e.calculatedFieldSettings?e.calculatedFieldSettings:[],this.enableSort=void 0===e.enableSorting||e.enableSorting,this.dataSourceSettings.fieldMapping=e.fieldMapping?e.fieldMapping:[],this.dataSourceSettings.values=e.values?e.values:[],this.dataSourceSettings.rows=e.rows?e.rows:[],this.dataSourceSettings.columns=e.columns?e.columns:[],this.dataSourceSettings.filters=e.filters?e.filters:[],this.dataSourceSettings.filterSettings=e.filterSettings?e.filterSettings:[],this.dataSourceSettings.sortSettings=e.sortSettings?e.sortSettings:[],this.dataSourceSettings.conditionalFormatSettings=e.conditionalFormatSettings?e.conditionalFormatSettings:[],this.dataSourceSettings.valueSortSettings=e.valueSortSettings?e.valueSortSettings:{},this.removeIrrelevantFields(Object.keys(this.fieldList)))},e.prototype.getGroupedRawData=function(e){this.data=[];for(var i=0,a=this.actualData;i<a.length;i++){var r=a[i];this.data[this.data.length]=G.frameHeaderWithKeys(r)}var n=e.values.filter(function(e){return"Count"===e.type||"DistinctCount"===e.type}).map(function(e){return e.name}),s=n.length>0,o=this.data,l=e.rows.concat(e.columns.concat(e.filters)).map(function(e){return e.name}),d={},p=[];this.groupRawIndex={};for(var h={},u=0,c=0;c<o.length;c++){var g=o[c],m=[];if(s)for(S=0;S<n.length;S++)g[this.fieldKeys[n[S]]]=t.isNullOrUndefined(g[this.fieldKeys[n[S]]])?g[this.fieldKeys[n[S]]]:1;for(var f=0;f<l.length;f++)m.push(g[this.fieldKeys[l[f]]]);var v=m.join("-");if(d[v]){for(var S=0;S<e.values.length;S++){var y=e.values[S].name,b=g[this.fieldKeys[y]],C=d[v],x=e.values[S].type;t.isNullOrUndefined(b)||("number"==typeof b&&"DistinctCount"!==x||(x="Count"),t.isNullOrUndefined(C[y])?C[y]="Product"===x?1:"Min"===x||"Max"===x?void 0:0:"number"!=typeof C[y]&&(C[y]=1),"Count"===x?C[y]+=1:"Min"===x?t.isNullOrUndefined(C[y])||(C[y]=C[y]>b?b:C[y]):"Max"===x?t.isNullOrUndefined(C[y])||(C[y]=C[y]<b?b:C[y]):"Product"===x?C[y]*=b:C[y]+=b)}this.isDrillThrough&&this.groupRawIndex[h[v]].push(c)}else d[v]=g,p.push(g),this.isDrillThrough&&(this.groupRawIndex[u]=[c],h[v]=u,u++)}return p},e.prototype.getGroupData=function(e){for(var i=this,a=e[0],r=this,n=0,s=this.dataSourceSettings.groupSettings;n<s.length;n++){var o=function(n,s){var o=s[n],l=o.name,d=o.caption;if(!(r.fields.indexOf(l)>-1))return n<s.length-1?"continue":{value:a};var p={},h=void 0;if("Date"===o.type&&r.groupingFields[l]||"Custom"===o.type&&r.groupingFields[l])return{value:a};if("Number"===o.type){if("number"!==G.getType(a[l])&&r.groupingFields[l])return{value:a};o.rangeInterval&&e.sort(function(e,t){return Number(e[i.fieldKeys[l]])>Number(t[i.fieldKeys[l]])?1:Number(t[i.fieldKeys[l]])>Number(e[i.fieldKeys[l]])?-1:0})}for(var u=e.length;u--;){var c=e[u];if(c[r.fieldKeys[l]]&&"Date"===o.type){var g=new Date(c[r.fieldKeys[l]].toString());if(!t.isNullOrUndefined(g)&&o.groupInterval.length>0)for(var m=0,f=o.groupInterval.length;m<f;m++){var v=o.groupInterval[m],S=r.getRange(o,g.getTime()),y=G.resetTime(new Date);switch(v){case"Years":p[C=m===o.groupInterval.length-1?l:l+"_date_group_years"]=v,r.fieldKeys[C]="CSV"===r.dataSourceSettings.type?r.fieldKeys[C]?r.fieldKeys[C]:r.fields.length:C,-1===r.fields.indexOf(C)&&r.fields.push(C),c[r.fieldKeys[C]]=S?void 0:new Date(y.setFullYear(g.getFullYear())).toString();break;case"Quarters":p[C=m===o.groupInterval.length-1?l:l+"_date_group_quarters"]=v;b=Math.ceil((g.getMonth()+1)/3);r.fieldKeys[C]="CSV"===r.dataSourceSettings.type?r.fieldKeys[C]?r.fieldKeys[C]:r.fields.length:C,-1===r.fields.indexOf(C)&&r.fields.push(C),c[r.fieldKeys[C]]=S?void 0:(r.localeObj?r.localeObj.getConstant("qtr"):"Qtr")+b.toString();break;case"QuarterYear":p[C=m===o.groupInterval.length-1?l:l+"_date_group_quarterYear"]=v;var b=Math.ceil((g.getMonth()+1)/3);r.fieldKeys[C]="CSV"===r.dataSourceSettings.type?r.fieldKeys[C]?r.fieldKeys[C]:r.fields.length:C,-1===r.fields.indexOf(C)&&r.fields.push(C),c[r.fieldKeys[C]]=S?void 0:(r.localeObj?r.localeObj.getConstant("qtr"):"Qtr")+b.toString()+" "+(r.localeObj?r.localeObj.getConstant("of"):"of")+" "+g.getFullYear().toString();break;case"Months":p[C=m===o.groupInterval.length-1?l:l+"_date_group_months"]=v,r.fieldKeys[C]="CSV"===r.dataSourceSettings.type?r.fieldKeys[C]?r.fieldKeys[C]:r.fields.length:C,-1===r.fields.indexOf(C)&&r.fields.push(C),c[r.fieldKeys[C]]=S?void 0:new Date(y.setMonth(g.getMonth(),1)).toString();break;case"Days":p[C=m===o.groupInterval.length-1?l:l+"_date_group_days"]=v,r.fieldKeys[C]="CSV"===r.dataSourceSettings.type?r.fieldKeys[C]?r.fieldKeys[C]:r.fields.length:C,-1===r.fields.indexOf(C)&&r.fields.push(C),c[r.fieldKeys[C]]=S?void 0:new Date(y.setMonth(g.getMonth(),g.getDate())).toString();break;case"Hours":p[C=m===o.groupInterval.length-1?l:l+"_date_group_hours"]=v,r.fieldKeys[C]="CSV"===r.dataSourceSettings.type?r.fieldKeys[C]?r.fieldKeys[C]:r.fields.length:C,-1===r.fields.indexOf(C)&&r.fields.push(C),c[r.fieldKeys[C]]=S?void 0:new Date(y.setHours(g.getHours())).toString();break;case"Minutes":p[C=m===o.groupInterval.length-1?l:l+"_date_group_minutes"]=v,r.fieldKeys[C]="CSV"===r.dataSourceSettings.type?r.fieldKeys[C]?r.fieldKeys[C]:r.fields.length:C,-1===r.fields.indexOf(C)&&r.fields.push(C),c[r.fieldKeys[C]]=S?void 0:new Date(y.setMinutes(g.getMinutes())).toString();break;case"Seconds":p[C=m===o.groupInterval.length-1?l:l+"_date_group_seconds"]=v,r.fieldKeys[C]="CSV"===r.dataSourceSettings.type?r.fieldKeys[C]?r.fieldKeys[C]:r.fields.length:C,-1===r.fields.indexOf(C)&&r.fields.push(C),c[r.fieldKeys[C]]=S?void 0:new Date(y.setSeconds(g.getSeconds())).toString()}}}else if(isNaN(Number(c[r.fieldKeys[l]]))||"Number"!==o.type){if(c[r.fieldKeys[l]]&&"Custom"===o.type&&o.customGroups&&o.customGroups.length>0){var C=l+"_custom_group",x=o.customGroups,w=void 0;r.groupingFieldsInfo[l]=l,r.groupingFieldsInfo[C]=l;for(var T=0,M=x.length;T<M;T++){var D=x[T];if(D.items&&D.items.length>1){h=C,r.fieldKeys[C]="CSV"===r.dataSourceSettings.type?r.fieldKeys[C]?r.fieldKeys[C]:r.fields.length:C,-1===r.fields.indexOf(C)&&r.fields.push(C);var O=-1!==G.inArray(c[r.fieldKeys[l]].toString(),D.items);c[r.fieldKeys[C]]=O?D.groupName&&""!==D.groupName?D.groupName:r.localeObj.getConstant("group")+" "+T:w&&w!==c[r.fieldKeys[l]].toString()?w:c[r.fieldKeys[l]].toString(),w=c[r.fieldKeys[C]]}}}}else{S=r.getRange(o,Number(c[r.fieldKeys[l]]));c[r.fieldKeys[l]]=S?void 0:c[r.fieldKeys[l]]}for(var P=[],N=0,E=ce=Object.keys(c);N<E.length;N++){fe=E[N];P.push(!!c[fe])}a=-1===P.indexOf(!1)&&ce.length===Object.keys(e[0]).length?c:a}if("Date"===o.type){for(var I=!1,F=[r.dataSourceSettings.rows,r.dataSourceSettings.columns,r.dataSourceSettings.values,r.dataSourceSettings.filters],L=Object.keys(p),A=Object.keys(L).length,R=void 0,k=0,j=F;k<j.length;k++){Ee=j[k];if(!I&&Ee){for(var q=Ee.length,H=0;H<q;){if(Ee[H].name===l){I=!0;Fe=Ee[H];for(Ee.splice(H,1),Te=(Te=r.dataSourceSettings.rows).concat(r.dataSourceSettings.columns,r.dataSourceSettings.values,r.dataSourceSettings.filters);A--;){var V=Fe.caption?Fe.caption:Fe.name;if(r.clonedReport){var U=r.clonedReport.rows;U=U.concat(r.clonedReport.columns,r.clonedReport.values,r.clonedReport.filters);var B=G.getFieldByName(L[A],U);B&&(V=B.caption?B.caption:B.name)}if(G.getFieldByName(L[A],Te))r.groupingFieldsInfo[L[A]]=l;else{R=p[L[A]],V=-1!==V.indexOf(" (")&&-1!==V.indexOf(")")?V.slice(V.indexOf("(")+1,V.length-1):V;Le={name:L[A],caption:(r.localeObj?r.localeObj.getConstant(R):R)+" ("+V+")",type:"Count",showNoDataItems:Fe.showNoDataItems,baseField:Fe.baseField,baseItem:Fe.baseItem,showFilterIcon:Fe.showFilterIcon,showSortIcon:Fe.showSortIcon,showEditIcon:Fe.showEditIcon,showRemoveIcon:Fe.showRemoveIcon,showSubTotals:Fe.showValueTypeIcon,allowDragAndDrop:Fe.allowDragAndDrop,expandAll:Fe.expandAll,groupName:Fe.groupName};Ee.splice(H,0,Le),r.groupingFieldsInfo[Le.name]=l}}break}if(Ee[H].name.indexOf(l)>-1){var _=p[Ee[H].name],z=Ee.filter(function(e){return e.name===l})[0];if(!t.isNullOrUndefined(z)){var W=z.caption?-1!==z.caption.indexOf(" (")&&-1!==z.caption.indexOf(")")?z.caption.slice(z.caption.indexOf("(")+1,z.caption.length-1):z.caption:l;Ee[H].caption=(r.localeObj?r.localeObj.getConstant(_):z)+" ("+W+")"}}H++}if(I)break}}A=Object.keys(L).length;for(var Q=(be=r.getMappingField(l,r.clonedReport?r.clonedReport.fieldMapping:r.dataSourceSettings.fieldMapping)).caption?be.caption:l;A--;){R=p[L[A]];for(var Y=0,K=r.dataSourceSettings.formatSettings.length;Y<K;Y++)if(r.dataSourceSettings.formatSettings[Y].name===L[A]){r.dataSourceSettings.formatSettings.splice(Y,1);break}if("Quarters"!==R&&"QuarterYear"!==R){var X={name:L[A],type:["Years","Months","Days"].indexOf(R)>-1?"date":"time",format:"Years"===R?"yyyy":"Months"===R?"MMM":"Days"===R?"d-MMM":"Hours"===R?"hh a":"Minutes"===R?":mm":"Seconds"===R?":ss":void 0};r.dataSourceSettings.formatSettings.push(X)}if(!I){J=r.getMappingField(L[A],r.dataSourceSettings.fieldMapping);if(L[A]!==l&&t.isNullOrUndefined(J.name)){Le={name:L[A],caption:(r.localeObj?r.localeObj.getConstant(R):R)+" ("+Q+")"};r.dataSourceSettings.fieldMapping.push(Le),r.groupingFieldsInfo[Le.name]=l}else L[A]!==l&&(J.caption=(r.localeObj?r.localeObj.getConstant(R):R)+" ("+Q+")",r.groupingFieldsInfo[J.name]=l)}}if(!I){var J=r.getMappingField(l,r.dataSourceSettings.fieldMapping);if(R=p[l],L[A]!==l&&t.isNullOrUndefined(J.name)){Le={name:l,caption:(r.localeObj?r.localeObj.getConstant(R):R)+" ("+Q+")"};r.dataSourceSettings.fieldMapping.push(Le),r.groupingFieldsInfo[Le.name]=l}else J.caption=(r.localeObj?r.localeObj.getConstant(R):R)+" ("+Q+")",r.groupingFieldsInfo[J.name]=l}}else if("Number"===o.type&&o.rangeInterval){var Z=void 0,$=[],ee=[],te=e.length,q=0;r.groupingFields[l]=l;for(var ie=[];q<te;){var ae=Number(e[q][l]);ee.push(ae),isNaN(ae)||-1!==$.indexOf(ae)||$.push(ae),q++}for(te=e.length,q=0;q<te;){var re=e[q];if(re&&!isNaN(Number(re[l]))){Z=("string"==typeof o.endingAt?parseInt(o.endingAt,10):o.endingAt)||Math.max.apply(Math,$);var ne=Number.isInteger(o.rangeInterval)?0:r.countDecimalPlaces(o.rangeInterval),se=void 0;switch(ne){case 10:se=1e-10;break;case 9:se=1e-9;break;case 8:se=1e-8;break;case 7:se=1e-7;break;case 6:se=1e-6;break;case 5:se=1e-5;break;case 4:se=1e-4;break;case 3:se=.001;break;case 2:se=.01;break;case 1:se=.1;break;default:se=1}var oe=Number.isInteger(o.rangeInterval)?Math.floor(Number(re[l])):Number(re[l].toFixed(ne)),le=Number.isInteger(o.rangeInterval)?Math.floor(Number(oe+(o.rangeInterval-1))):Number((oe+o.rangeInterval).toFixed(ne));if(oe>=ie[0]&&oe<=ie[ie.length-1]){var de=ie[0],pe=Number.isInteger(o.rangeInterval)?Math.floor(ie[ie.length-1]):Number(ie[ie.length-1].toFixed(ne));r.processGrouping(re,l,de,pe,Z,o.rangeInterval,ne),t.isNullOrUndefined(r.groupedDataType[l])&&(r.groupedDataType[l]="string")}else if(0===ie.length){for(var he=oe;he<=le;he=Number((he+se).toFixed(ne)))ie.push(he);var de=ie[0],pe=Number.isInteger(o.rangeInterval)?Math.floor(ie[ie.length-1]):Number(ie[ie.length-1].toFixed(ne));r.processGrouping(re,l,de,pe,Z,o.rangeInterval,ne),t.isNullOrUndefined(r.groupedDataType[l])&&(r.groupedDataType[l]="string")}else{var de=Number.isInteger(o.rangeInterval)?Math.floor(ie[ie.length-1])+1:Number(ie[ie.length-1].toFixed(ne)),pe=Number.isInteger(o.rangeInterval)?Math.floor(de+(o.rangeInterval-1)):Number((de+o.rangeInterval).toFixed(ne)),ue=!0;for(ie.splice(0,ie.length);ue;)oe>=de&&oe<=pe&&(r.processGrouping(re,l,de,pe,Z,o.rangeInterval,ne),t.isNullOrUndefined(r.groupedDataType[l])&&(r.groupedDataType[l]="string"),ie.push(de),ie.push(pe),ue=!1),de=Number.isInteger(o.rangeInterval)?pe+1:pe,pe=Number.isInteger(o.rangeInterval)?Math.floor(de+(o.rangeInterval-1)):Number((de+o.rangeInterval).toFixed(ne))}for(var ce=Object.keys(re),P=[],ge=0,me=ce;ge<me.length;ge++){var fe=me[ge];P.push(!!re[fe])}a=-1===P.indexOf(!1)&&ce.length===Object.keys(e[0]).length?re:a}q++}for(var ve=0,Se=F=[r.dataSourceSettings.rows,r.dataSourceSettings.columns,r.dataSourceSettings.values,r.dataSourceSettings.filters];ve<Se.length;ve++){var ye=Se[ve],be=G.getFieldByName(l,ye);be&&((be=be.properties?be.properties:be).type="Count")}for(var Ce=0,xe=r.dataSourceSettings.formatSettings.length;Ce<xe;Ce++)if(r.dataSourceSettings.formatSettings[Ce].name===l){r.dataSourceSettings.formatSettings.splice(Ce,1);break}}else if("Custom"===o.type&&h){var we=h,I=!1,F=[r.dataSourceSettings.rows,r.dataSourceSettings.columns,r.dataSourceSettings.values,r.dataSourceSettings.filters],Te=r.dataSourceSettings.rows;Te=Te.concat(r.dataSourceSettings.columns,r.dataSourceSettings.values,r.dataSourceSettings.filters);var Me=[];d&&""!==d||(Me=we.match(/_custom_group/g));for(var De=G.getFieldByName(l.replace(/_custom_group/g,""),Te),Oe=G.getFieldByName(we,Te),Pe=0,Ne=F;Pe<Ne.length;Pe++){var Ee=Ne[Pe];if(!I&&Ee){for(var q=Ee.length,Ie=0;Ie<q;){if(Ee[Ie].name===o.name&&!Oe){I=!0;var Fe=Ee[Ie],Le={name:we,caption:d&&""!==d?d:(De.caption?De.caption:De.name)+(Me.length+1),type:"Count",showNoDataItems:Fe.showNoDataItems,baseField:Fe.baseField,baseItem:Fe.baseItem,showSubTotals:Fe.showValueTypeIcon,allowDragAndDrop:Fe.allowDragAndDrop,showFilterIcon:Fe.showFilterIcon,showSortIcon:Fe.showSortIcon,showRemoveIcon:Fe.showRemoveIcon,showEditIcon:Fe.showEditIcon,expandAll:Fe.expandAll,groupName:Fe.groupName};Ee.splice(Ie,0,Le),r.groupingFieldsInfo[Le.name]=l,r.groupingFieldsInfo[l]=l;break}if(Ee[Ie].name===we&&Oe){Le={name:Oe.name,caption:d&&""!==d?d:Oe.caption,type:Oe.type,showNoDataItems:Oe.showNoDataItems,baseField:Oe.baseField,baseItem:Oe.baseItem,showRemoveIcon:Oe.showRemoveIcon,showSubTotals:Oe.showValueTypeIcon,allowDragAndDrop:Oe.allowDragAndDrop,showFilterIcon:Oe.showFilterIcon,showSortIcon:Oe.showSortIcon,showEditIcon:Oe.showEditIcon,expandAll:Oe.expandAll,groupName:Oe.groupName};Ee.splice(Ie,1,Le),r.groupingFieldsInfo[Le.name]=l,r.groupingFieldsInfo[l]=l;break}Ie++}if(I)break}}var Ae=G.getFieldByName(l,G.cloneFormatSettings(r.dataSourceSettings.formatSettings));Ae&&(Ae.name=we,r.dataSourceSettings.formatSettings.push(Ae)),r.groupingFields[l]=l}r.groupingFields=t.extend(r.groupingFields,p)}(n,s);if("object"==typeof o)return o.value}return a},e.prototype.countDecimalPlaces=function(e){var t=e.toString();return t.includes(".")?t.split(".")[1].length:0},e.prototype.processGrouping=function(e,t,i,a,r,n,s){Number.isInteger(e[t])||!Number.isInteger(e[t])&&(Number(e[t])<a||r<=Number(e[t]))?e[t]=this.getNumberGroupHeaders(i,a,r):!Number.isInteger(e[t])&&Number(e[t])>=a&&(e[t]=this.getNumberGroupHeaders(Number((i+n).toFixed(s)),Number((a+n).toFixed(s)),r))},e.prototype.getNumberGroupHeaders=function(e,t,i){return e===t?e.toString():i>=e&&i<=t?i===e?e.toString():e.toString()+"-"+i.toString():e.toString()+"-"+t.toSt