@progress/kendo-angular-pivotgrid 0.1.2 → 0.1.4-dev.202205131602

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,4 +2,4 @@
2
2
  * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@progress/kendo-licensing"),require("@progress/kendo-angular-common"),require("@progress/kendo-pivotgrid-common"),require("rxjs"),require("@angular/common"),require("@progress/kendo-angular-indicators"),require("@progress/kendo-angular-l10n")):"function"==typeof define&&define.amd?define("KendoAngularPivotgrid",["exports","@angular/core","@progress/kendo-licensing","@progress/kendo-angular-common","@progress/kendo-pivotgrid-common","rxjs","@angular/common","@progress/kendo-angular-indicators","@progress/kendo-angular-l10n"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoAngularPivotgrid={},e.ng.core,e.KendoLicensing,e.KendoAngularCommon,e.KendoPivotgridCommon,e.rxjs,e.ng.common,e.KendoAngularIndicators,e.KendoAngularL10N)}(this,function(e,t,o,n,s,i,r,a,l){"use strict";function d(n){if(n&&n.__esModule)return n;var o=Object.create(null);return n&&Object.keys(n).forEach(function(e){var t;"default"!==e&&(t=Object.getOwnPropertyDescriptor(n,e),Object.defineProperty(o,e,t.get?t:{enumerable:!0,get:function(){return n[e]}}))}),o.default=n,Object.freeze(o)}function V(){var e;return null===v&&n.isDocumentAvailable()&&document.createElement&&((e=document.createElement("div")).style.cssText="overflow:scroll;overflow-x:hidden;zoom:1;clear:both;display:block",e.innerHTML="&nbsp;",document.body.appendChild(e),v=e.offsetWidth-e.scrollWidth,document.body.removeChild(e)),v}var c=d(t),p=d(n),u=d(r),g=d(a),N={name:"@progress/kendo-angular-pivotgrid",productName:"Kendo UI for Angular",productCodes:["KENDOUIANGULAR","KENDOUICOMPLETE"],publishDate:1652282669,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning"},v=null,m=function(e,t){return(m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}Object.create;function y(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(o=i.next()).done;)a.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a}function f(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||((o=o||Array.prototype.slice.call(t,0,r))[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}Object.create;k.prototype.updateRowsAndCols=function(){var e=s.toTree((this.rows||[]).slice()),e=y(s.toRows(e),4),t=e[0],n=e[1],o=e[2],e=e[3],r=s.toTree((this.columns||[]).slice()),r=y(s.toColumns(r),3),i=r[0],a=r[1],r=r[2];this.columnHeaderLeaves=a,this.columnHeaderCols.next(new Array(r).fill({})),this.columnHeaderRows.next(i),this.rowHeaderLeaves=n,this.rowHeaderCols.next(new Array(e).fill({})),this.rowHeaderRows.next(t),this.valuesRows.next(s.toData((this.normalizedData||[]).slice(),a,n,r,o))};var b=k;function k(){this.expandedStateChange=new t.EventEmitter,this.columnHeaderRows=new i.BehaviorSubject([]),this.columnHeaderCols=new i.BehaviorSubject([]),this.rowHeaderCols=new i.BehaviorSubject([]),this.rowHeaderRows=new i.BehaviorSubject([]),this.valuesRows=new i.BehaviorSubject([]),this.loading=new i.BehaviorSubject(!1)}b.ɵfac=c.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:b,deps:[],target:c.ɵɵFactoryTarget.Injectable}),b.ɵprov=c.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:b}),c.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:b,decorators:[{type:t.Injectable}],propDecorators:{expandedStateChange:[{type:t.Output}]}});Object.defineProperty(x.prototype,"expanded",{get:function(){var e;return(null==(e=this.kendoPivotGridCell)?void 0:e.hasChildren)&&this.kendoPivotGridCell.children.length},enumerable:!1,configurable:!0}),x.prototype.ngOnInit=function(){var e,t=this.hostEl.nativeElement,n=(this.renderer.setAttribute(t,"rowspan",this.kendoPivotGridCell.rowSpan||1),this.renderer.setAttribute(t,"colspan",this.kendoPivotGridCell.colSpan||1),{"k-pivotgrid-header-total":this.kendoPivotGridCell.total||"values"===this.tableType&&(this.dataService.rowHeaderLeaves[this.rowIndex].total||this.dataService.columnHeaderLeaves[this.colIndex].total),"k-pivotgrid-header-root":0===this.kendoPivotGridCell.levelNum,"k-pivotgrid-expanded":this.kendoPivotGridCell.hasChildren&&this.kendoPivotGridCell.children.length,"k-first":1===this.colIndex});for(e in n)n[e]&&this.renderer.addClass(t,e)};var I=x;function x(e,t,n){var o=this;this.hostEl=e,this.renderer=t,this.dataService=n,this.cellClass=!0,this.handleClick=function(){o.dataService.expandedStateChange.emit({action:o.expanded?"collapse":"expand",cell:o.kendoPivotGridCell,tableType:o.tableType})}}I.ɵfac=c.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:I,deps:[{token:c.ElementRef},{token:c.Renderer2},{token:b}],target:c.ɵɵFactoryTarget.Component}),I.ɵcmp=c.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.16",type:I,selector:"[kendoPivotGridCell]",inputs:{kendoPivotGridCell:"kendoPivotGridCell",tableType:"tableType",rowIndex:"rowIndex",colIndex:"colIndex"},host:{properties:{"class.k-pivotgrid-cell":"this.cellClass"}},ngImport:c,template:'\n <span \n *ngIf="kendoPivotGridCell.hasChildren && !kendoPivotGridCell.total"\n class="k-icon"\n [kendoEventsOutsideAngular]="{\n click: handleClick\n }"\n [ngClass]="{\n \'k-i-arrow-chevron-up\': expanded,\n \'k-i-arrow-chevron-down\': !expanded\n }"></span>{{ kendoPivotGridCell.data ? kendoPivotGridCell.data.fmtValue : kendoPivotGridCell.caption }}',isInline:!0,directives:[{type:u.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]},{type:p.EventsOutsideAngularDirective,selector:"[kendoEventsOutsideAngular]",inputs:["kendoEventsOutsideAngular","scope"]},{type:u.NgClass,selector:"[ngClass]",inputs:["class","ngClass"]}]}),c.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:I,decorators:[{type:t.Component,args:[{selector:"[kendoPivotGridCell]",template:'\n <span \n *ngIf="kendoPivotGridCell.hasChildren && !kendoPivotGridCell.total"\n class="k-icon"\n [kendoEventsOutsideAngular]="{\n click: handleClick\n }"\n [ngClass]="{\n \'k-i-arrow-chevron-up\': expanded,\n \'k-i-arrow-chevron-down\': !expanded\n }"></span>{{ kendoPivotGridCell.data ? kendoPivotGridCell.data.fmtValue : kendoPivotGridCell.caption }}'}]}],ctorParameters:function(){return[{type:c.ElementRef},{type:c.Renderer2},{type:b}]},propDecorators:{cellClass:[{type:t.HostBinding,args:["class.k-pivotgrid-cell"]}],kendoPivotGridCell:[{type:t.Input}],tableType:[{type:t.Input}],rowIndex:[{type:t.Input}],colIndex:[{type:t.Input}]}});C.prototype.ngOnInit=function(){var t=this;this.dataChangeSubs.add(this.dataService[this.tableType+"Rows"].subscribe(function(e){return t.rows=e})),this.dataChangeSubs.add("values"===this.tableType?this.dataService.columnHeaderCols.subscribe(function(e){return t.headerItems=e}):this.dataService[this.tableType+"Cols"].subscribe(function(e){return t.headerItems=e}))},C.prototype.ngOnDestroy=function(){this.dataChangeSubs.unsubscribe()};p=C;function C(e){this.dataService=e,this.dataChangeSubs=new i.Subscription}p.ɵfac=c.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:p,deps:[{token:b}],target:c.ɵɵFactoryTarget.Component}),p.ɵcmp=c.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.16",type:p,selector:"kendo-pivotgrid-table",inputs:{tableType:"tableType"},ngImport:c,template:'\n <table class="k-pivotgrid-table">\n <colgroup>\n <col *ngFor="let item of headerItems;" />\n </colgroup>\n <tbody class="k-pivotgrid-tbody">\n <tr *ngFor="let row of rows; index as rowIndex"\n class="k-pivotgrid-row">\n <ng-container *ngFor="let cell of row.cells; index as colIndex">\n <th\n *ngIf="cell && tableType !== \'values\'" \n [kendoPivotGridCell]="cell"\n [tableType]="tableType"\n [colIndex]="colIndex"\n [rowIndex]="rowIndex"></th>\n <td\n *ngIf="cell && tableType === \'values\'"\n [kendoPivotGridCell]="cell"\n tableType="values"\n [colIndex]="colIndex"\n [rowIndex]="rowIndex"></td>\n </ng-container>\n </tr>\n </tbody>\n </table>\n ',isInline:!0,components:[{type:I,selector:"[kendoPivotGridCell]",inputs:["kendoPivotGridCell","tableType","rowIndex","colIndex"]}],directives:[{type:u.NgForOf,selector:"[ngFor][ngForOf]",inputs:["ngForOf","ngForTrackBy","ngForTemplate"]},{type:u.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]}]}),c.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:p,decorators:[{type:t.Component,args:[{selector:"kendo-pivotgrid-table",template:'\n <table class="k-pivotgrid-table">\n <colgroup>\n <col *ngFor="let item of headerItems;" />\n </colgroup>\n <tbody class="k-pivotgrid-tbody">\n <tr *ngFor="let row of rows; index as rowIndex"\n class="k-pivotgrid-row">\n <ng-container *ngFor="let cell of row.cells; index as colIndex">\n <th\n *ngIf="cell && tableType !== \'values\'" \n [kendoPivotGridCell]="cell"\n [tableType]="tableType"\n [colIndex]="colIndex"\n [rowIndex]="rowIndex"></th>\n <td\n *ngIf="cell && tableType === \'values\'"\n [kendoPivotGridCell]="cell"\n tableType="values"\n [colIndex]="colIndex"\n [rowIndex]="rowIndex"></td>\n </ng-container>\n </tr>\n </tbody>\n </table>\n '}]}],ctorParameters:function(){return[{type:b}]},propDecorators:{tableType:[{type:t.Input}]}});var w={type:"converging-spinner",themeColor:"primary",size:"large"},A=(Object.defineProperty(S.prototype,"scrollbarWidth",{get:function(){return V()+"px"},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"loaderSettings",{get:function(){return this._loaderSettings},set:function(e){this._loaderSettings=Object.assign({},w,e)},enumerable:!1,configurable:!0}),S.prototype.ngAfterViewInit=function(){var r=this;n.isDocumentAvailable()&&this.zone.runOutsideAngular(function(){var e=document.querySelector(".k-pivotgrid-row-headers .k-pivotgrid-table"),t=new ResizeObserver(function(){return r.resizeContainer("Columns",e)}),n=(t.observe(e),document.querySelector(".k-pivotgrid-column-headers .k-pivotgrid-table")),o=new ResizeObserver(function(){return r.resizeContainer("Rows",n)});o.observe(n),r.resizeObservers=[t,o]})},S.prototype.ngAfterContentInit=function(){var t=this;this.loadingSubscription.add(this.dataService.loading.subscribe(function(e){return t.loading=e}))},S.prototype.ngOnDestroy=function(){this.resizeObservers.forEach(function(e){return e.disconnect()}),this.loadingSubscription.unsubscribe()},S);function S(e,t,n){var r=this;this.hostEl=e,this.zone=t,this.dataService=n,this.hostClass=!0,this.resizeObservers=[],this._loaderSettings=w,this.loadingSubscription=new i.Subscription,this.resizeContainer=function(e,t){var n=r.hostEl.nativeElement,o="Rows"===e?"offsetHeight":"offsetWidth";n.style["gridTemplate"+e]="",n.style["gridTemplate"+e]=t[o]+"px 1fr"},o.validatePackage(N)}A.ɵfac=c.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:A,deps:[{token:c.ElementRef},{token:c.NgZone},{token:b}],target:c.ɵɵFactoryTarget.Component}),A.ɵcmp=c.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.16",type:A,selector:"kendo-pivotgrid",inputs:{loaderSettings:"loaderSettings"},host:{properties:{"class.k-pivotgrid":"this.hostClass","style.--kendo-scrollbar-width":"this.scrollbarWidth"}},providers:[b],ngImport:c,template:'\n <span class="k-pivotgrid-empty-cell"></span>\n <kendo-pivotgrid-table\n class="k-pivotgrid-column-headers"\n tableType="columnHeader"></kendo-pivotgrid-table>\n <kendo-pivotgrid-table\n class="k-pivotgrid-row-headers"\n tableType="rowHeader"></kendo-pivotgrid-table>\n <kendo-pivotgrid-table\n class="k-pivotgrid-values"\n tableType="values"></kendo-pivotgrid-table>\n\n <div *ngIf="loading" class="k-loader">\n <kendo-loader\n [type]="loaderSettings?.type"\n [themeColor]="loaderSettings?.themeColor"\n [size]="loaderSettings?.size"\n >\n </kendo-loader>\n </div>\n ',isInline:!0,styles:["\n /** TODO: Remove if added to themes */\n div.k-loader {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n "],components:[{type:p,selector:"kendo-pivotgrid-table",inputs:["tableType"]},{type:g.LoaderComponent,selector:"kendo-loader",inputs:["type","themeColor","size"]}],directives:[{type:u.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]}]}),c.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:A,decorators:[{type:t.Component,args:[{selector:"kendo-pivotgrid",providers:[b],template:'\n <span class="k-pivotgrid-empty-cell"></span>\n <kendo-pivotgrid-table\n class="k-pivotgrid-column-headers"\n tableType="columnHeader"></kendo-pivotgrid-table>\n <kendo-pivotgrid-table\n class="k-pivotgrid-row-headers"\n tableType="rowHeader"></kendo-pivotgrid-table>\n <kendo-pivotgrid-table\n class="k-pivotgrid-values"\n tableType="values"></kendo-pivotgrid-table>\n\n <div *ngIf="loading" class="k-loader">\n <kendo-loader\n [type]="loaderSettings?.type"\n [themeColor]="loaderSettings?.themeColor"\n [size]="loaderSettings?.size"\n >\n </kendo-loader>\n </div>\n ',styles:["\n /** TODO: Remove if added to themes */\n div.k-loader {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n "]}]}],ctorParameters:function(){return[{type:c.ElementRef},{type:c.NgZone},{type:b}]},propDecorators:{hostClass:[{type:t.HostBinding,args:["class.k-pivotgrid"]}],scrollbarWidth:[{type:t.HostBinding,args:["style.--kendo-scrollbar-width"]}],loaderSettings:[{type:t.Input}]}});P.prototype.ngOnInit=function(){var o=this;this.loadData(),this.expandedStateSub=this.dataService.expandedStateChange.subscribe(function(n){o.zone.run(function(){var e="columnHeader"===n.tableType,t=e?"columnAxes":"rowAxes",e=s.toTree((e?o.dataService.columns:o.dataService.rows||[]).slice());o.updateHeaders(t,e,n.cell.path)})})},P.prototype.ngOnDestroy=function(){this.expandedStateSub.unsubscribe()},P.prototype.updateDataServiceFields=function(){this.dataService.normalizedData=this.dataState.data,this.dataService.rows=this.dataState.rows,this.dataService.columns=this.dataState.columns,this.dataService.updateRowsAndCols()},P.prototype.updateHeaders=function(e,t,n){n={type:s.HEADERS_ACTION.toggle,payload:n},n=s.headersReducer(this[e].slice(),Object.assign(Object.assign({},n),{tree:t}));this[e]=n,this.loadData()};g=P;function P(e,t){this.dataService=e,this.zone=t,this.columnAxes=[],this.rowAxes=[],this.measureAxes=[],this.expandedStateSub=new i.Subscription}g.ɵfac=c.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:g,deps:[{token:b},{token:c.NgZone}],target:c.ɵɵFactoryTarget.Directive}),g.ɵdir=c.ɵɵngDeclareDirective({minVersion:"12.0.0",version:"12.2.16",type:g,selector:"kendo-base-binding-directive",inputs:{columnAxes:"columnAxes",rowAxes:"rowAxes",measureAxes:"measureAxes"},ngImport:c}),c.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:g,decorators:[{type:t.Directive,args:[{selector:"kendo-base-binding-directive"}]}],ctorParameters:function(){return[{type:b},{type:c.NgZone}]},propDecorators:{columnAxes:[{type:t.Input}],rowAxes:[{type:t.Input}],measureAxes:[{type:t.Input}]}});var D,O={dataField:"aggregate",columnsData:"columns"},u=(h(T,D=g),T.prototype.ngOnChanges=function(e){n.anyChanged(["data","dimensions","columnAxes","rowAxes","measureAxes","measures"],e)&&this.loadData()},T.prototype.loadData=function(){var e=this,t=this.getRootAxes(this.columnAxes),n=this.getRootAxes(this.rowAxes),t=t.split("&").map(this.createAxisSettings),n=n.split("&").map(this.createAxisSettings),o=this.measureAxes.map(function(t){return e.measures.find(function(e){return String(e.name)===String(t.name)})}).filter(Boolean),r=s.createDataTree(this.data,n,t,o,O);this.dataState=s.createLocalDataState({dataTree:r,rowSettings:n,columnSettings:t,rowAxes:this.rowAxes,columnAxes:this.columnAxes,measures:o,sort:[],fields:O}),this.updateDataServiceFields()},T.prototype.getRootAxes=function(e){return Array.from(s.rootFields(e).keys()).join("&")},T);function T(e,t){var n=D.call(this,e,t)||this;return n.createAxisSettings=function(e){return Object.assign({key:e},n.dimensions[e])},n}u.ɵfac=c.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:u,deps:[{token:b},{token:c.NgZone}],target:c.ɵɵFactoryTarget.Directive}),u.ɵdir=c.ɵɵngDeclareDirective({minVersion:"12.0.0",version:"12.2.16",type:u,selector:"[kendoPivotLocalBinding]",inputs:{data:["kendoPivotLocalBinding","data"],dimensions:"dimensions",measures:"measures"},exportAs:["kendoPivotLocalBinding"],usesInheritance:!0,usesOnChanges:!0,ngImport:c}),c.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:u,decorators:[{type:t.Directive,args:[{selector:"[kendoPivotLocalBinding]",exportAs:"kendoPivotLocalBinding"}]}],ctorParameters:function(){return[{type:b},{type:c.NgZone}]},propDecorators:{data:[{type:t.Input,args:["kendoPivotLocalBinding"]}],dimensions:[{type:t.Input}],measures:[{type:t.Input}]}});h(E,j=g),E.prototype.ngOnChanges=function(e){n.anyChanged(["url","cube","catalog","columnAxes","rowAxes","measureAxes"],e)&&this.loadData()},E.prototype.loadData=function(){var t=this,e=(this.dataService.loading.next(!0),{connection:{catalog:this.catalog,cube:this.cube},columnAxes:this.columnAxes,rowAxes:this.rowAxes,measureAxes:this.measureAxes});s.fetchData({url:this.url},JSON.parse(JSON.stringify(e))).then(s.createDataState).then(function(e){t.dataState=e,t.updateDataServiceFields(),t.dataService.loading.next(!1)})};var j,g=E;function E(e,t){return j.call(this,e,t)||this}g.ɵfac=c.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:g,deps:[{token:b},{token:c.NgZone}],target:c.ɵɵFactoryTarget.Directive}),g.ɵdir=c.ɵɵngDeclareDirective({minVersion:"12.0.0",version:"12.2.16",type:g,selector:"[kendoPivotOLAPBinding]",inputs:{url:"url",cube:"cube",catalog:"catalog"},exportAs:["kendoPivotOLAPBinding"],usesInheritance:!0,usesOnChanges:!0,ngImport:c}),c.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:g,decorators:[{type:t.Directive,args:[{selector:"[kendoPivotOLAPBinding]",exportAs:"kendoPivotOLAPBinding"}]}],ctorParameters:function(){return[{type:b},{type:c.NgZone}]},propDecorators:{url:[{type:t.Input}],cube:[{type:t.Input}],catalog:[{type:t.Input}]}});var F=[r.CommonModule,n.EventsModule,a.IndicatorsModule],G=[A,p,I,u,g],R=function(){};R.ɵfac=c.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:R,deps:[],target:c.ɵɵFactoryTarget.NgModule}),R.ɵmod=c.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:R,declarations:[A,p,I,u,g],imports:[r.CommonModule,n.EventsModule,a.IndicatorsModule],exports:[A,p,I,u,g]}),R.ɵinj=c.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:R,providers:[{provide:l.L10N_PREFIX,useValue:"kendo.pivotgrid"}],imports:[f([],y(F))]}),c.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:R,decorators:[{type:t.NgModule,args:[{imports:f([],y(F)),declarations:f([],y(G)),exports:f([],y(G)),providers:[{provide:l.L10N_PREFIX,useValue:"kendo.pivotgrid"}]}]}]}),Object.defineProperty(e,"averageAggregate",{enumerable:!0,get:function(){return s.averageAggregate}}),Object.defineProperty(e,"maxAggregate",{enumerable:!0,get:function(){return s.maxAggregate}}),Object.defineProperty(e,"minAggregate",{enumerable:!0,get:function(){return s.minAggregate}}),Object.defineProperty(e,"sumAggregate",{enumerable:!0,get:function(){return s.sumAggregate}}),e.PivotGridCellDirective=I,e.PivotGridComponent=A,e.PivotGridModule=R,e.PivotGridTableComponent=p,e.PivotLocalBindingDirective=u,e.PivotOLAPBindingDirective=g,Object.defineProperty(e,"__esModule",{value:!0})});
5
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@progress/kendo-licensing"),require("@progress/kendo-angular-common"),require("@progress/kendo-pivotgrid-common"),require("rxjs"),require("rxjs/operators"),require("@angular/common"),require("@progress/kendo-angular-indicators"),require("@progress/kendo-angular-l10n")):"function"==typeof define&&define.amd?define("KendoAngularPivotgrid",["exports","@angular/core","@progress/kendo-licensing","@progress/kendo-angular-common","@progress/kendo-pivotgrid-common","rxjs","rxjs/operators","@angular/common","@progress/kendo-angular-indicators","@progress/kendo-angular-l10n"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoAngularPivotgrid={},e.ng.core,e.KendoLicensing,e.KendoAngularCommon,e.KendoPivotgridCommon,e.rxjs,e.rxjs.operators,e.ng.common,e.KendoAngularIndicators,e.KendoAngularL10N)}(this,function(t,e,G,n,s,a,V,o,r,i){"use strict";function l(n){if(n&&n.__esModule)return n;var o=Object.create(null);return n&&Object.keys(n).forEach(function(e){var t;"default"!==e&&(t=Object.getOwnPropertyDescriptor(n,e),Object.defineProperty(o,e,t.get?t:{enumerable:!0,get:function(){return n[e]}}))}),o.default=n,Object.freeze(o)}var d=l(e),c=l(n),p=l(o),u=l(r),N={name:"@progress/kendo-angular-pivotgrid",productName:"Kendo UI for Angular",productCodes:["KENDOUIANGULAR","KENDOUICOMPLETE"],publishDate:1652457707,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning"},g=function(e,t){return(g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function v(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}g(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}Object.create;function m(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,a=n.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(o=a.next()).done;)i.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i}function h(e,t,n){if(n||2===arguments.length)for(var o,r=0,a=t.length;r<a;r++)!o&&r in t||((o=o||Array.prototype.slice.call(t,0,r))[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}Object.create;f.prototype.updateRowsAndCols=function(){var e=s.toTree((this.rows||[]).slice()),e=m(s.toRows(e),4),t=e[0],n=e[1],o=e[2],e=e[3],r=s.toTree((this.columns||[]).slice()),r=m(s.toColumns(r),3),a=r[0],i=r[1],r=r[2];this.columnHeaderLeaves=i,this.columnHeaderCols.next(i),this.columnHeaderRows.next(a),this.rowHeaderLeaves=n,this.rowHeaderCols.next(new Array(e).fill({})),this.rowHeaderRows.next(t),this.valuesRows.next(s.toData((this.normalizedData||[]).slice(),i,n,r,o))};var y=f;function f(){this.expandedStateChange=new e.EventEmitter,this.columnHeaderRows=new a.BehaviorSubject([]),this.columnHeaderCols=new a.BehaviorSubject([]),this.rowHeaderCols=new a.BehaviorSubject([]),this.rowHeaderRows=new a.BehaviorSubject([]),this.valuesRows=new a.BehaviorSubject([]),this.loading=new a.BehaviorSubject(!1)}y.ɵfac=d.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:d,type:y,deps:[],target:d.ɵɵFactoryTarget.Injectable}),y.ɵprov=d.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.16",ngImport:d,type:y}),d.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:d,type:y,decorators:[{type:e.Injectable}],propDecorators:{expandedStateChange:[{type:e.Output}]}});function b(e,t,n,o){(e="Y"===o?-k(e,o):k(e,o))&&(t[0][n]=t[1][n]+=e)}var k=function(e,t){var n=e["wheelDelta"+t];return e.wheelDelta&&(void 0===n||n)?e.wheelDelta:e.detail&&e.axis===e["X"===t?"HORIZONTAL_AXIS":"VERTICAL_AXIS"]?10*-e.detail:0},I=(Object.defineProperty(C.prototype,"expanded",{get:function(){var e;return(null==(e=this.kendoPivotGridCell)?void 0:e.hasChildren)&&this.kendoPivotGridCell.children.length},enumerable:!1,configurable:!0}),C.prototype.ngOnInit=function(){var e,t=this.hostEl.nativeElement,n=(this.renderer.setAttribute(t,"rowspan",this.kendoPivotGridCell.rowSpan||1),this.renderer.setAttribute(t,"colspan",this.kendoPivotGridCell.colSpan||1),{"k-pivotgrid-header-total":this.kendoPivotGridCell.total||"values"===this.tableType&&(this.dataService.rowHeaderLeaves[this.rowIndex].total||this.dataService.columnHeaderLeaves[this.colIndex].total),"k-pivotgrid-header-root":0===this.kendoPivotGridCell.levelNum,"k-pivotgrid-expanded":this.kendoPivotGridCell.hasChildren&&this.kendoPivotGridCell.children.length,"k-first":0<this.colIndex});for(e in n)n[e]&&this.renderer.addClass(t,e)},C);function C(e,t,n){var o=this;this.hostEl=e,this.renderer=t,this.dataService=n,this.cellClass=!0,this.handleClick=function(){o.dataService.expandedStateChange.emit({action:o.expanded?"collapse":"expand",cell:o.kendoPivotGridCell,tableType:o.tableType})}}I.ɵfac=d.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:d,type:I,deps:[{token:d.ElementRef},{token:d.Renderer2},{token:y}],target:d.ɵɵFactoryTarget.Component}),I.ɵcmp=d.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.16",type:I,selector:"[kendoPivotGridCell]",inputs:{kendoPivotGridCell:"kendoPivotGridCell",tableType:"tableType",rowIndex:"rowIndex",colIndex:"colIndex"},host:{properties:{"class.k-pivotgrid-cell":"this.cellClass"}},ngImport:d,template:'\n <span \n *ngIf="kendoPivotGridCell.hasChildren && !kendoPivotGridCell.total"\n class="k-icon"\n [kendoEventsOutsideAngular]="{\n click: handleClick\n }"\n [ngClass]="{\n \'k-i-arrow-chevron-up\': expanded,\n \'k-i-arrow-chevron-down\': !expanded\n }"></span>{{ kendoPivotGridCell.data ? kendoPivotGridCell.data.fmtValue : kendoPivotGridCell.caption }}',isInline:!0,directives:[{type:p.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]},{type:c.EventsOutsideAngularDirective,selector:"[kendoEventsOutsideAngular]",inputs:["kendoEventsOutsideAngular","scope"]},{type:p.NgClass,selector:"[ngClass]",inputs:["class","ngClass"]}]}),d.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:d,type:I,decorators:[{type:e.Component,args:[{selector:"[kendoPivotGridCell]",template:'\n <span \n *ngIf="kendoPivotGridCell.hasChildren && !kendoPivotGridCell.total"\n class="k-icon"\n [kendoEventsOutsideAngular]="{\n click: handleClick\n }"\n [ngClass]="{\n \'k-i-arrow-chevron-up\': expanded,\n \'k-i-arrow-chevron-down\': !expanded\n }"></span>{{ kendoPivotGridCell.data ? kendoPivotGridCell.data.fmtValue : kendoPivotGridCell.caption }}'}]}],ctorParameters:function(){return[{type:d.ElementRef},{type:d.Renderer2},{type:y}]},propDecorators:{cellClass:[{type:e.HostBinding,args:["class.k-pivotgrid-cell"]}],kendoPivotGridCell:[{type:e.Input}],tableType:[{type:e.Input}],rowIndex:[{type:e.Input}],colIndex:[{type:e.Input}]}});x.prototype.ngOnInit=function(){var t=this;this.dataChangeSubs.add(this.dataService[this.tableType+"Rows"].subscribe(function(e){return t.rows=e})),this.dataChangeSubs.add("values"===this.tableType?this.dataService.columnHeaderCols.subscribe(function(e){return t.headerItems=e}):this.dataService[this.tableType+"Cols"].subscribe(function(e){return t.headerItems=e}))},x.prototype.ngOnDestroy=function(){this.dataChangeSubs.unsubscribe()};var w=x;function x(e){this.dataService=e,this.dataChangeSubs=new a.Subscription}w.ɵfac=d.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:d,type:w,deps:[{token:y}],target:d.ɵɵFactoryTarget.Component}),w.ɵcmp=d.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.16",type:w,selector:"kendo-pivotgrid-table",inputs:{tableType:"tableType"},ngImport:d,template:'\n <table class="k-pivotgrid-table">\n <colgroup>\n <col *ngFor="let item of headerItems;" />\n </colgroup>\n <tbody class="k-pivotgrid-tbody">\n <tr *ngFor="let row of rows; index as rowIndex"\n class="k-pivotgrid-row">\n <ng-container *ngFor="let cell of row.cells; index as colIndex">\n <th\n *ngIf="cell && tableType !== \'values\'" \n [kendoPivotGridCell]="cell"\n [tableType]="tableType"\n [colIndex]="colIndex"\n [rowIndex]="rowIndex"></th>\n <td\n *ngIf="cell && tableType === \'values\'"\n [kendoPivotGridCell]="cell"\n tableType="values"\n [colIndex]="colIndex"\n [rowIndex]="rowIndex"></td>\n </ng-container>\n </tr>\n </tbody>\n </table>\n ',isInline:!0,components:[{type:I,selector:"[kendoPivotGridCell]",inputs:["kendoPivotGridCell","tableType","rowIndex","colIndex"]}],directives:[{type:p.NgForOf,selector:"[ngFor][ngForOf]",inputs:["ngForOf","ngForTrackBy","ngForTemplate"]},{type:p.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]}]}),d.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:d,type:w,decorators:[{type:e.Component,args:[{selector:"kendo-pivotgrid-table",template:'\n <table class="k-pivotgrid-table">\n <colgroup>\n <col *ngFor="let item of headerItems;" />\n </colgroup>\n <tbody class="k-pivotgrid-tbody">\n <tr *ngFor="let row of rows; index as rowIndex"\n class="k-pivotgrid-row">\n <ng-container *ngFor="let cell of row.cells; index as colIndex">\n <th\n *ngIf="cell && tableType !== \'values\'" \n [kendoPivotGridCell]="cell"\n [tableType]="tableType"\n [colIndex]="colIndex"\n [rowIndex]="rowIndex"></th>\n <td\n *ngIf="cell && tableType === \'values\'"\n [kendoPivotGridCell]="cell"\n tableType="values"\n [colIndex]="colIndex"\n [rowIndex]="rowIndex"></td>\n </ng-container>\n </tr>\n </tbody>\n </table>\n '}]}],ctorParameters:function(){return[{type:y}]},propDecorators:{tableType:[{type:e.Input}]}});var T={type:"converging-spinner",themeColor:"primary",size:"large"},S=(Object.defineProperty(A.prototype,"loaderSettings",{get:function(){return this._loaderSettings},set:function(e){this._loaderSettings=Object.assign({},T,e)},enumerable:!1,configurable:!0}),A.prototype.ngAfterViewInit=function(){var r=this;n.isDocumentAvailable()&&this.zone.runOutsideAngular(function(){var e=r.rowHeadersTable.nativeElement.firstElementChild,t=new ResizeObserver(function(){return r.resizeContainer("Columns",e)}),n=(t.observe(e),r.colHeadersTable.nativeElement.firstElementChild),o=new ResizeObserver(function(){return r.resizeContainer("Rows",n)});o.observe(n),r.resizeObservers=[t,o],r.subs.add(a.fromEvent(e,"wheel").pipe(V.mergeWith(a.fromEvent(n,"wheel"),a.fromEvent(r.valuesTable.nativeElement,"scroll"))).subscribe(function(e){return r.handleScroll(e)}))})},A.prototype.ngAfterContentInit=function(){var t=this;this.subs.add(this.dataService.loading.subscribe(function(e){return t.loading=e}))},A.prototype.ngOnDestroy=function(){this.resizeObservers.forEach(function(e){return e.disconnect()}),this.subs.unsubscribe()},A);function A(e,t,n,o){var i=this;this.hostEl=e,this.zone=t,this.dataService=n,this.hostClass=!0,this.resizeObservers=[],this._loaderSettings=T,this.subs=new a.Subscription,this.resizeContainer=function(e,t){var n=i.hostEl.nativeElement,o="Rows"===e?"offsetHeight":"offsetWidth";n.style["gridTemplate"+e]="",n.style["gridTemplate"+e]=t[o]+"px 1fr"},this.handleScroll=function(e){var t,n,o,r,a;e.target===i.valuesTable.nativeElement?(t=e.target,n=[i.rowHeadersTable.nativeElement,i.colHeadersTable.nativeElement],o=t.scrollTop,t=t.scrollLeft,r=n[0].scrollTop,a=t!==n[1].scrollLeft,o!==r?n[0].scrollTop=o:a&&(n[1].scrollLeft=t)):e.target.closest(".k-pivotgrid-row-headers")?b(e,[i.valuesTable.nativeElement,i.rowHeadersTable.nativeElement],"scrollTop","Y"):e.target.closest(".k-pivotgrid-column-headers")&&b(e,[i.valuesTable.nativeElement,i.colHeadersTable.nativeElement],"scrollLeft","X")},G.validatePackage(N)}S.ɵfac=d.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:d,type:S,deps:[{token:d.ElementRef},{token:d.NgZone},{token:y},{token:c.ScrollbarWidthService}],target:d.ɵɵFactoryTarget.Component}),S.ɵcmp=d.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.16",type:S,selector:"kendo-pivotgrid",inputs:{loaderSettings:"loaderSettings"},host:{properties:{"class.k-pivotgrid":"this.hostClass"}},providers:[y],viewQueries:[{propertyName:"colHeadersTable",first:!0,predicate:["colHeadersTable"],descendants:!0,read:e.ElementRef},{propertyName:"rowHeadersTable",first:!0,predicate:["rowHeadersTable"],descendants:!0,read:e.ElementRef},{propertyName:"valuesTable",first:!0,predicate:["valuesTable"],descendants:!0,read:e.ElementRef}],ngImport:d,template:'\n <span class="k-pivotgrid-empty-cell"></span>\n <kendo-pivotgrid-table\n #colHeadersTable\n class="k-pivotgrid-column-headers"\n tableType="columnHeader"></kendo-pivotgrid-table>\n <kendo-pivotgrid-table\n #rowHeadersTable\n class="k-pivotgrid-row-headers"\n tableType="rowHeader"></kendo-pivotgrid-table>\n <kendo-pivotgrid-table\n #valuesTable\n class="k-pivotgrid-values"\n tableType="values"></kendo-pivotgrid-table>\n\n <div *ngIf="loading" class="k-loader">\n <kendo-loader\n [type]="loaderSettings?.type"\n [themeColor]="loaderSettings?.themeColor"\n [size]="loaderSettings?.size"\n >\n </kendo-loader>\n </div>\n ',isInline:!0,styles:["\n /** TODO: Remove if added to themes */\n div.k-loader {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n "],components:[{type:w,selector:"kendo-pivotgrid-table",inputs:["tableType"]},{type:u.LoaderComponent,selector:"kendo-loader",inputs:["type","themeColor","size"]}],directives:[{type:p.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]}]}),d.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:d,type:S,decorators:[{type:e.Component,args:[{selector:"kendo-pivotgrid",providers:[y],template:'\n <span class="k-pivotgrid-empty-cell"></span>\n <kendo-pivotgrid-table\n #colHeadersTable\n class="k-pivotgrid-column-headers"\n tableType="columnHeader"></kendo-pivotgrid-table>\n <kendo-pivotgrid-table\n #rowHeadersTable\n class="k-pivotgrid-row-headers"\n tableType="rowHeader"></kendo-pivotgrid-table>\n <kendo-pivotgrid-table\n #valuesTable\n class="k-pivotgrid-values"\n tableType="values"></kendo-pivotgrid-table>\n\n <div *ngIf="loading" class="k-loader">\n <kendo-loader\n [type]="loaderSettings?.type"\n [themeColor]="loaderSettings?.themeColor"\n [size]="loaderSettings?.size"\n >\n </kendo-loader>\n </div>\n ',styles:["\n /** TODO: Remove if added to themes */\n div.k-loader {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n "]}]}],ctorParameters:function(){return[{type:d.ElementRef},{type:d.NgZone},{type:y},{type:c.ScrollbarWidthService}]},propDecorators:{hostClass:[{type:e.HostBinding,args:["class.k-pivotgrid"]}],colHeadersTable:[{type:e.ViewChild,args:["colHeadersTable",{read:e.ElementRef}]}],rowHeadersTable:[{type:e.ViewChild,args:["rowHeadersTable",{read:e.ElementRef}]}],valuesTable:[{type:e.ViewChild,args:["valuesTable",{read:e.ElementRef}]}],loaderSettings:[{type:e.Input}]}});D.prototype.ngOnInit=function(){var o=this;this.loadData(),this.expandedStateSub=this.dataService.expandedStateChange.subscribe(function(n){o.zone.run(function(){var e="columnHeader"===n.tableType,t=e?"columnAxes":"rowAxes",e=s.toTree((e?o.dataService.columns:o.dataService.rows||[]).slice());o.updateHeaders(t,e,n.cell.path)})})},D.prototype.ngOnDestroy=function(){this.expandedStateSub.unsubscribe()},D.prototype.updateDataServiceFields=function(){this.dataService.normalizedData=this.dataState.data,this.dataService.rows=this.dataState.rows,this.dataService.columns=this.dataState.columns,this.dataService.updateRowsAndCols()},D.prototype.updateHeaders=function(e,t,n){n={type:s.HEADERS_ACTION.toggle,payload:n},n=s.headersReducer(this[e].slice(),Object.assign(Object.assign({},n),{tree:t}));this[e]=n,this.loadData()};u=D;function D(e,t){this.dataService=e,this.zone=t,this.columnAxes=[],this.rowAxes=[],this.measureAxes=[],this.expandedStateSub=new a.Subscription}u.ɵfac=d.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:d,type:u,deps:[{token:y},{token:d.NgZone}],target:d.ɵɵFactoryTarget.Directive}),u.ɵdir=d.ɵɵngDeclareDirective({minVersion:"12.0.0",version:"12.2.16",type:u,selector:"kendo-base-binding-directive",inputs:{columnAxes:"columnAxes",rowAxes:"rowAxes",measureAxes:"measureAxes"},ngImport:d}),d.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:d,type:u,decorators:[{type:e.Directive,args:[{selector:"kendo-base-binding-directive"}]}],ctorParameters:function(){return[{type:y},{type:d.NgZone}]},propDecorators:{columnAxes:[{type:e.Input}],rowAxes:[{type:e.Input}],measureAxes:[{type:e.Input}]}});var P,O={dataField:"aggregate",columnsData:"columns"},p=(v(E,P=u),E.prototype.ngOnChanges=function(e){n.anyChanged(["data","dimensions","columnAxes","rowAxes","measureAxes","measures"],e)&&this.loadData()},E.prototype.loadData=function(){var e=this,t=this.getRootAxes(this.columnAxes),n=this.getRootAxes(this.rowAxes),t=t.split("&").map(this.createAxisSettings),n=n.split("&").map(this.createAxisSettings),o=this.measureAxes.map(function(t){return e.measures.find(function(e){return String(e.name)===String(t.name)})}).filter(Boolean),r=s.createDataTree(this.data,n,t,o,O);this.dataState=s.createLocalDataState({dataTree:r,rowSettings:n,columnSettings:t,rowAxes:this.rowAxes,columnAxes:this.columnAxes,measures:o,sort:[],fields:O}),this.updateDataServiceFields()},E.prototype.getRootAxes=function(e){return Array.from(s.rootFields(e).keys()).join("&")},E);function E(e,t){var n=P.call(this,e,t)||this;return n.createAxisSettings=function(e){return Object.assign({key:e},n.dimensions[e])},n}p.ɵfac=d.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:d,type:p,deps:[{token:y},{token:d.NgZone}],target:d.ɵɵFactoryTarget.Directive}),p.ɵdir=d.ɵɵngDeclareDirective({minVersion:"12.0.0",version:"12.2.16",type:p,selector:"[kendoPivotLocalBinding]",inputs:{data:["kendoPivotLocalBinding","data"],dimensions:"dimensions",measures:"measures"},exportAs:["kendoPivotLocalBinding"],usesInheritance:!0,usesOnChanges:!0,ngImport:d}),d.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:d,type:p,decorators:[{type:e.Directive,args:[{selector:"[kendoPivotLocalBinding]",exportAs:"kendoPivotLocalBinding"}]}],ctorParameters:function(){return[{type:y},{type:d.NgZone}]},propDecorators:{data:[{type:e.Input,args:["kendoPivotLocalBinding"]}],dimensions:[{type:e.Input}],measures:[{type:e.Input}]}});v(j,H=u),j.prototype.ngOnChanges=function(e){n.anyChanged(["url","cube","catalog","columnAxes","rowAxes","measureAxes"],e)&&this.loadData()},j.prototype.loadData=function(){var t=this,e=(this.dataService.loading.next(!0),{connection:{catalog:this.catalog,cube:this.cube},columnAxes:this.columnAxes,rowAxes:this.rowAxes,measureAxes:this.measureAxes});s.fetchData({url:this.url},JSON.parse(JSON.stringify(e))).then(s.createDataState).then(function(e){t.dataState=e,t.updateDataServiceFields(),t.dataService.loading.next(!1)})};var H,u=j;function j(e,t){return H.call(this,e,t)||this}u.ɵfac=d.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:d,type:u,deps:[{token:y},{token:d.NgZone}],target:d.ɵɵFactoryTarget.Directive}),u.ɵdir=d.ɵɵngDeclareDirective({minVersion:"12.0.0",version:"12.2.16",type:u,selector:"[kendoPivotOLAPBinding]",inputs:{url:"url",cube:"cube",catalog:"catalog"},exportAs:["kendoPivotOLAPBinding"],usesInheritance:!0,usesOnChanges:!0,ngImport:d}),d.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:d,type:u,decorators:[{type:e.Directive,args:[{selector:"[kendoPivotOLAPBinding]",exportAs:"kendoPivotOLAPBinding"}]}],ctorParameters:function(){return[{type:y},{type:d.NgZone}]},propDecorators:{url:[{type:e.Input}],cube:[{type:e.Input}],catalog:[{type:e.Input}]}});var R=[o.CommonModule,n.EventsModule,r.IndicatorsModule],L=[S,w,I,p,u],F=function(){};F.ɵfac=d.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:d,type:F,deps:[],target:d.ɵɵFactoryTarget.NgModule}),F.ɵmod=d.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.16",ngImport:d,type:F,declarations:[S,w,I,p,u],imports:[o.CommonModule,n.EventsModule,r.IndicatorsModule],exports:[S,w,I,p,u]}),F.ɵinj=d.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.16",ngImport:d,type:F,providers:[{provide:i.L10N_PREFIX,useValue:"kendo.pivotgrid"}],imports:[h([],m(R))]}),d.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:d,type:F,decorators:[{type:e.NgModule,args:[{imports:h([],m(R)),declarations:h([],m(L)),exports:h([],m(L)),providers:[{provide:i.L10N_PREFIX,useValue:"kendo.pivotgrid"}]}]}]}),t.PivotGridCellDirective=I,t.PivotGridComponent=S,t.PivotGridModule=F,t.PivotGridTableComponent=w,t.PivotLocalBindingDirective=p,t.PivotOLAPBindingDirective=u,Object.keys(s).forEach(function(e){"default"===e||t.hasOwnProperty(e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})}),Object.defineProperty(t,"__esModule",{value:!0})});
@@ -25,7 +25,7 @@ export class PivotGridDataService {
25
25
  const columnsTree = toTree((this.columns || []).slice());
26
26
  const [columnHeaderRows, columnHeaderLeaves, columnHeaderBreadth] = toColumns(columnsTree);
27
27
  this.columnHeaderLeaves = columnHeaderLeaves;
28
- this.columnHeaderCols.next(new Array(columnHeaderBreadth).fill({}));
28
+ this.columnHeaderCols.next(columnHeaderLeaves);
29
29
  this.columnHeaderRows.next(columnHeaderRows);
30
30
  this.rowHeaderLeaves = rowHeaderLeaves;
31
31
  this.rowHeaderCols.next(new Array(rowHeaderBreadth).fill({}));
package/esm2015/main.js CHANGED
@@ -11,4 +11,4 @@ export { PivotGridTableComponent } from './rendering/pivotgrid-table.component';
11
11
  export { PivotLocalBindingDirective } from './data-binding/local-binding.directive';
12
12
  export { PivotOLAPBindingDirective } from './data-binding/olap-binding.directive';
13
13
  // Export types from PivotGrid common package
14
- export { averageAggregate, maxAggregate, minAggregate, sumAggregate } from '@progress/kendo-pivotgrid-common';
14
+ export * from '@progress/kendo-pivotgrid-common';
@@ -9,7 +9,7 @@ export const packageMetadata = {
9
9
  name: '@progress/kendo-angular-pivotgrid',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1652282669,
12
+ publishDate: 1652457707,
13
13
  version: '',
14
14
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
15
15
  };
@@ -2,35 +2,37 @@
2
2
  * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- import { Component, HostBinding, Input } from '@angular/core';
5
+ import { Component, ElementRef, HostBinding, Input, ViewChild } from '@angular/core';
6
6
  import { validatePackage } from '@progress/kendo-licensing';
7
7
  import { packageMetadata } from './package-metadata';
8
- import { scrollbarWidth } from './util';
9
8
  import { isDocumentAvailable } from '@progress/kendo-angular-common';
10
9
  import { PivotGridDataService } from './data-binding/pivotgrid-data.service';
11
- import { Subscription } from 'rxjs';
10
+ import { fromEvent, Subscription } from 'rxjs';
11
+ import { mergeWith } from 'rxjs/operators';
12
+ import { syncScroll, syncWheel } from './util';
12
13
  import * as i0 from "@angular/core";
13
14
  import * as i1 from "./data-binding/pivotgrid-data.service";
14
- import * as i2 from "./rendering/pivotgrid-table.component";
15
- import * as i3 from "@progress/kendo-angular-indicators";
16
- import * as i4 from "@angular/common";
15
+ import * as i2 from "@progress/kendo-angular-common";
16
+ import * as i3 from "./rendering/pivotgrid-table.component";
17
+ import * as i4 from "@progress/kendo-angular-indicators";
18
+ import * as i5 from "@angular/common";
17
19
  const DEFAULT_LOADER_SETTINGS = {
18
20
  type: 'converging-spinner',
19
21
  themeColor: 'primary',
20
22
  size: 'large'
21
23
  };
22
24
  /**
23
- * A sample component
25
+ * Represents the Kendo UI PivotGrid component for Angular.
24
26
  */
25
27
  export class PivotGridComponent {
26
- constructor(hostEl, zone, dataService) {
28
+ constructor(hostEl, zone, dataService, _scrollbarWidthService) {
27
29
  this.hostEl = hostEl;
28
30
  this.zone = zone;
29
31
  this.dataService = dataService;
30
32
  this.hostClass = true;
31
33
  this.resizeObservers = [];
32
34
  this._loaderSettings = DEFAULT_LOADER_SETTINGS;
33
- this.loadingSubscription = new Subscription();
35
+ this.subs = new Subscription();
34
36
  this.resizeContainer = (axis, element) => {
35
37
  const isRows = axis === 'Rows';
36
38
  const wrapper = this.hostEl.nativeElement;
@@ -38,11 +40,22 @@ export class PivotGridComponent {
38
40
  wrapper.style[`gridTemplate${axis}`] = '';
39
41
  wrapper.style[`gridTemplate${axis}`] = `${element[size]}px 1fr`;
40
42
  };
43
+ this.handleScroll = (event) => {
44
+ if (event.target === this.valuesTable.nativeElement) {
45
+ syncScroll(event.target, [
46
+ this.rowHeadersTable.nativeElement,
47
+ this.colHeadersTable.nativeElement
48
+ ]);
49
+ }
50
+ else if (event.target.closest('.k-pivotgrid-row-headers')) {
51
+ syncWheel(event, [this.valuesTable.nativeElement, this.rowHeadersTable.nativeElement], 'scrollTop', 'Y');
52
+ }
53
+ else if (event.target.closest('.k-pivotgrid-column-headers')) {
54
+ syncWheel(event, [this.valuesTable.nativeElement, this.colHeadersTable.nativeElement], 'scrollLeft', 'X');
55
+ }
56
+ };
41
57
  validatePackage(packageMetadata);
42
58
  }
43
- get scrollbarWidth() {
44
- return `${scrollbarWidth()}px`;
45
- }
46
59
  /**
47
60
  * Specify the type, size and color of the PivotGrid's loader.
48
61
  *
@@ -61,36 +74,41 @@ export class PivotGridComponent {
61
74
  ngAfterViewInit() {
62
75
  if (isDocumentAvailable()) {
63
76
  this.zone.runOutsideAngular(() => {
64
- const rowHeadersTable = document.querySelector('.k-pivotgrid-row-headers .k-pivotgrid-table');
77
+ const rowHeadersTable = this.rowHeadersTable.nativeElement.firstElementChild;
65
78
  const headerColsResizeObserver = new ResizeObserver(() => this.resizeContainer('Columns', rowHeadersTable));
66
79
  headerColsResizeObserver.observe(rowHeadersTable);
67
- const colHeadersTable = document.querySelector('.k-pivotgrid-column-headers .k-pivotgrid-table');
80
+ const colHeadersTable = this.colHeadersTable.nativeElement.firstElementChild;
68
81
  const headerRowsResizeObserver = new ResizeObserver(() => this.resizeContainer('Rows', colHeadersTable));
69
82
  headerRowsResizeObserver.observe(colHeadersTable);
70
83
  this.resizeObservers = [headerColsResizeObserver, headerRowsResizeObserver];
84
+ this.subs.add(fromEvent(rowHeadersTable, 'wheel')
85
+ .pipe(mergeWith(fromEvent(colHeadersTable, 'wheel'), fromEvent(this.valuesTable.nativeElement, 'scroll'))).subscribe((ev) => this.handleScroll(ev)));
71
86
  });
72
87
  }
73
88
  }
74
89
  ngAfterContentInit() {
75
- this.loadingSubscription.add(this.dataService.loading.subscribe(state => this.loading = state));
90
+ this.subs.add(this.dataService.loading.subscribe(state => this.loading = state));
76
91
  }
77
92
  ngOnDestroy() {
78
93
  this.resizeObservers.forEach(o => o.disconnect());
79
- this.loadingSubscription.unsubscribe();
94
+ this.subs.unsubscribe();
80
95
  }
81
96
  }
82
- PivotGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i1.PivotGridDataService }], target: i0.ɵɵFactoryTarget.Component });
83
- PivotGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: PivotGridComponent, selector: "kendo-pivotgrid", inputs: { loaderSettings: "loaderSettings" }, host: { properties: { "class.k-pivotgrid": "this.hostClass", "style.--kendo-scrollbar-width": "this.scrollbarWidth" } }, providers: [
97
+ PivotGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i1.PivotGridDataService }, { token: i2.ScrollbarWidthService }], target: i0.ɵɵFactoryTarget.Component });
98
+ PivotGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: PivotGridComponent, selector: "kendo-pivotgrid", inputs: { loaderSettings: "loaderSettings" }, host: { properties: { "class.k-pivotgrid": "this.hostClass" } }, providers: [
84
99
  PivotGridDataService
85
- ], ngImport: i0, template: `
100
+ ], viewQueries: [{ propertyName: "colHeadersTable", first: true, predicate: ["colHeadersTable"], descendants: true, read: ElementRef }, { propertyName: "rowHeadersTable", first: true, predicate: ["rowHeadersTable"], descendants: true, read: ElementRef }, { propertyName: "valuesTable", first: true, predicate: ["valuesTable"], descendants: true, read: ElementRef }], ngImport: i0, template: `
86
101
  <span class="k-pivotgrid-empty-cell"></span>
87
102
  <kendo-pivotgrid-table
103
+ #colHeadersTable
88
104
  class="k-pivotgrid-column-headers"
89
105
  tableType="columnHeader"></kendo-pivotgrid-table>
90
106
  <kendo-pivotgrid-table
107
+ #rowHeadersTable
91
108
  class="k-pivotgrid-row-headers"
92
109
  tableType="rowHeader"></kendo-pivotgrid-table>
93
110
  <kendo-pivotgrid-table
111
+ #valuesTable
94
112
  class="k-pivotgrid-values"
95
113
  tableType="values"></kendo-pivotgrid-table>
96
114
 
@@ -102,7 +120,7 @@ PivotGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
102
120
  >
103
121
  </kendo-loader>
104
122
  </div>
105
- `, isInline: true, styles: ["\n /** TODO: Remove if added to themes */\n div.k-loader {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n "], components: [{ type: i2.PivotGridTableComponent, selector: "kendo-pivotgrid-table", inputs: ["tableType"] }, { type: i3.LoaderComponent, selector: "kendo-loader", inputs: ["type", "themeColor", "size"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
123
+ `, isInline: true, styles: ["\n /** TODO: Remove if added to themes */\n div.k-loader {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n "], components: [{ type: i3.PivotGridTableComponent, selector: "kendo-pivotgrid-table", inputs: ["tableType"] }, { type: i4.LoaderComponent, selector: "kendo-loader", inputs: ["type", "themeColor", "size"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
106
124
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridComponent, decorators: [{
107
125
  type: Component,
108
126
  args: [{
@@ -113,12 +131,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
113
131
  template: `
114
132
  <span class="k-pivotgrid-empty-cell"></span>
115
133
  <kendo-pivotgrid-table
134
+ #colHeadersTable
116
135
  class="k-pivotgrid-column-headers"
117
136
  tableType="columnHeader"></kendo-pivotgrid-table>
118
137
  <kendo-pivotgrid-table
138
+ #rowHeadersTable
119
139
  class="k-pivotgrid-row-headers"
120
140
  tableType="rowHeader"></kendo-pivotgrid-table>
121
141
  <kendo-pivotgrid-table
142
+ #valuesTable
122
143
  class="k-pivotgrid-values"
123
144
  tableType="values"></kendo-pivotgrid-table>
124
145
 
@@ -141,12 +162,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
141
162
  }
142
163
  `]
143
164
  }]
144
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i1.PivotGridDataService }]; }, propDecorators: { hostClass: [{
165
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i1.PivotGridDataService }, { type: i2.ScrollbarWidthService }]; }, propDecorators: { hostClass: [{
145
166
  type: HostBinding,
146
167
  args: ['class.k-pivotgrid']
147
- }], scrollbarWidth: [{
148
- type: HostBinding,
149
- args: ['style.--kendo-scrollbar-width']
168
+ }], colHeadersTable: [{
169
+ type: ViewChild,
170
+ args: ['colHeadersTable', { read: ElementRef }]
171
+ }], rowHeadersTable: [{
172
+ type: ViewChild,
173
+ args: ['rowHeadersTable', { read: ElementRef }]
174
+ }], valuesTable: [{
175
+ type: ViewChild,
176
+ args: ['valuesTable', { read: ElementRef }]
150
177
  }], loaderSettings: [{
151
178
  type: Input
152
179
  }] } });
@@ -38,7 +38,7 @@ export class PivotGridCellDirective {
38
38
  this.dataService.columnHeaderLeaves[this.colIndex].total)),
39
39
  'k-pivotgrid-header-root': this.kendoPivotGridCell.levelNum === 0,
40
40
  'k-pivotgrid-expanded': this.kendoPivotGridCell.hasChildren && this.kendoPivotGridCell.children.length,
41
- 'k-first': this.colIndex === 1
41
+ 'k-first': this.colIndex > 0
42
42
  };
43
43
  for (let prop in classesToAdd) {
44
44
  if (classesToAdd[prop]) {
package/esm2015/util.js CHANGED
@@ -2,29 +2,6 @@
2
2
  * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- import { isDocumentAvailable } from "@progress/kendo-angular-common";
6
- /**
7
- * @hidden
8
- */
9
- const canCreateElement = () => isDocumentAvailable() && document.createElement;
10
- /**
11
- * @hidden
12
- */
13
- let cachedScrollbarWidth = null;
14
- /**
15
- * @hidden
16
- */
17
- export const scrollbarWidth = () => {
18
- if (cachedScrollbarWidth === null && canCreateElement()) {
19
- const div = document.createElement("div");
20
- div.style.cssText = "overflow:scroll;overflow-x:hidden;zoom:1;clear:both;display:block";
21
- div.innerHTML = "&nbsp;";
22
- document.body.appendChild(div);
23
- cachedScrollbarWidth = div.offsetWidth - div.scrollWidth;
24
- document.body.removeChild(div);
25
- }
26
- return cachedScrollbarWidth;
27
- };
28
5
  /**
29
6
  * @hidden
30
7
  */
@@ -47,3 +24,43 @@ export const areSameArrays = (a1, a2) => {
47
24
  }
48
25
  return true;
49
26
  };
27
+ /**
28
+ * @hidden
29
+ */
30
+ export const wheelDelta = (e, axis) => {
31
+ const delta = e[`wheelDelta${axis}`];
32
+ if (e.wheelDelta && (delta === undefined || delta)) {
33
+ return e.wheelDelta;
34
+ }
35
+ if (e.detail && e.axis === e[axis === 'X' ? 'HORIZONTAL_AXIS' : 'VERTICAL_AXIS']) {
36
+ return (-e.detail) * 10;
37
+ }
38
+ return 0;
39
+ };
40
+ /**
41
+ * @hidden
42
+ */
43
+ export const syncScroll = (source, targets) => {
44
+ const sourceScrollTop = source.scrollTop;
45
+ const sourceScrollLeft = source.scrollLeft;
46
+ const targetScrollTop = targets[0].scrollTop;
47
+ const targetScrollLeft = targets[1].scrollLeft;
48
+ const syncVertically = sourceScrollTop !== targetScrollTop;
49
+ const syncHorizontally = sourceScrollLeft !== targetScrollLeft;
50
+ if (syncVertically) {
51
+ targets[0].scrollTop = sourceScrollTop;
52
+ }
53
+ else if (syncHorizontally) {
54
+ targets[1].scrollLeft = sourceScrollLeft;
55
+ }
56
+ };
57
+ /**
58
+ * @hidden
59
+ */
60
+ export const syncWheel = (event, tables, prop, axis) => {
61
+ const delta = axis === 'Y' ? -(wheelDelta(event, axis)) : wheelDelta(event, axis);
62
+ if (delta) {
63
+ tables[0][prop] =
64
+ tables[1][prop] += delta;
65
+ }
66
+ };
@@ -3,16 +3,17 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import * as i0 from '@angular/core';
6
- import { EventEmitter, Injectable, Output, Component, HostBinding, Input, Directive, NgModule } from '@angular/core';
6
+ import { EventEmitter, Injectable, Output, Component, HostBinding, Input, ElementRef, ViewChild, Directive, NgModule } from '@angular/core';
7
7
  import { validatePackage } from '@progress/kendo-licensing';
8
- import * as i3 from '@progress/kendo-angular-common';
8
+ import * as i2$1 from '@progress/kendo-angular-common';
9
9
  import { isDocumentAvailable, anyChanged, EventsModule } from '@progress/kendo-angular-common';
10
10
  import { toTree, toRows, toColumns, toData, HEADERS_ACTION, headersReducer, createDataTree, createLocalDataState, rootFields, fetchData, createDataState } from '@progress/kendo-pivotgrid-common';
11
- export { averageAggregate, maxAggregate, minAggregate, sumAggregate } from '@progress/kendo-pivotgrid-common';
12
- import { BehaviorSubject, Subscription } from 'rxjs';
11
+ export * from '@progress/kendo-pivotgrid-common';
12
+ import { BehaviorSubject, Subscription, fromEvent } from 'rxjs';
13
+ import { mergeWith } from 'rxjs/operators';
13
14
  import * as i2 from '@angular/common';
14
15
  import { CommonModule } from '@angular/common';
15
- import * as i3$1 from '@progress/kendo-angular-indicators';
16
+ import * as i4 from '@progress/kendo-angular-indicators';
16
17
  import { IndicatorsModule } from '@progress/kendo-angular-indicators';
17
18
  import { L10N_PREFIX } from '@progress/kendo-angular-l10n';
18
19
 
@@ -23,56 +24,11 @@ const packageMetadata = {
23
24
  name: '@progress/kendo-angular-pivotgrid',
24
25
  productName: 'Kendo UI for Angular',
25
26
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
26
- publishDate: 1652282669,
27
+ publishDate: 1652457707,
27
28
  version: '',
28
29
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
29
30
  };
30
31
 
31
- /**
32
- * @hidden
33
- */
34
- const canCreateElement = () => isDocumentAvailable() && document.createElement;
35
- /**
36
- * @hidden
37
- */
38
- let cachedScrollbarWidth = null;
39
- /**
40
- * @hidden
41
- */
42
- const scrollbarWidth = () => {
43
- if (cachedScrollbarWidth === null && canCreateElement()) {
44
- const div = document.createElement("div");
45
- div.style.cssText = "overflow:scroll;overflow-x:hidden;zoom:1;clear:both;display:block";
46
- div.innerHTML = "&nbsp;";
47
- document.body.appendChild(div);
48
- cachedScrollbarWidth = div.offsetWidth - div.scrollWidth;
49
- document.body.removeChild(div);
50
- }
51
- return cachedScrollbarWidth;
52
- };
53
- /**
54
- * @hidden
55
- */
56
- const isPresent = (value) => value !== null && value !== undefined;
57
- /**
58
- * @hidden
59
- * Returns whether two arrays contain the same values.
60
- * Assumes array elements are primitive types
61
- */
62
- const areSameArrays = (a1, a2) => {
63
- const areArrays = (isPresent(a1) && Array.isArray(a1) && isPresent(a2) && Array.isArray(a2));
64
- const areOfEqualLength = a1.length === a2.length;
65
- if (!areArrays || !areOfEqualLength) {
66
- return false;
67
- }
68
- for (let i = 0; i < a1.length; i++) {
69
- if (a1[i] !== a2[i]) {
70
- return false;
71
- }
72
- }
73
- return true;
74
- };
75
-
76
32
  /**
77
33
  * @hidden
78
34
  */
@@ -92,7 +48,7 @@ class PivotGridDataService {
92
48
  const columnsTree = toTree((this.columns || []).slice());
93
49
  const [columnHeaderRows, columnHeaderLeaves, columnHeaderBreadth] = toColumns(columnsTree);
94
50
  this.columnHeaderLeaves = columnHeaderLeaves;
95
- this.columnHeaderCols.next(new Array(columnHeaderBreadth).fill({}));
51
+ this.columnHeaderCols.next(columnHeaderLeaves);
96
52
  this.columnHeaderRows.next(columnHeaderRows);
97
53
  this.rowHeaderLeaves = rowHeaderLeaves;
98
54
  this.rowHeaderCols.next(new Array(rowHeaderBreadth).fill({}));
@@ -108,6 +64,69 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
108
64
  type: Output
109
65
  }] } });
110
66
 
67
+ /**
68
+ * @hidden
69
+ */
70
+ const isPresent = (value) => value !== null && value !== undefined;
71
+ /**
72
+ * @hidden
73
+ * Returns whether two arrays contain the same values.
74
+ * Assumes array elements are primitive types
75
+ */
76
+ const areSameArrays = (a1, a2) => {
77
+ const areArrays = (isPresent(a1) && Array.isArray(a1) && isPresent(a2) && Array.isArray(a2));
78
+ const areOfEqualLength = a1.length === a2.length;
79
+ if (!areArrays || !areOfEqualLength) {
80
+ return false;
81
+ }
82
+ for (let i = 0; i < a1.length; i++) {
83
+ if (a1[i] !== a2[i]) {
84
+ return false;
85
+ }
86
+ }
87
+ return true;
88
+ };
89
+ /**
90
+ * @hidden
91
+ */
92
+ const wheelDelta = (e, axis) => {
93
+ const delta = e[`wheelDelta${axis}`];
94
+ if (e.wheelDelta && (delta === undefined || delta)) {
95
+ return e.wheelDelta;
96
+ }
97
+ if (e.detail && e.axis === e[axis === 'X' ? 'HORIZONTAL_AXIS' : 'VERTICAL_AXIS']) {
98
+ return (-e.detail) * 10;
99
+ }
100
+ return 0;
101
+ };
102
+ /**
103
+ * @hidden
104
+ */
105
+ const syncScroll = (source, targets) => {
106
+ const sourceScrollTop = source.scrollTop;
107
+ const sourceScrollLeft = source.scrollLeft;
108
+ const targetScrollTop = targets[0].scrollTop;
109
+ const targetScrollLeft = targets[1].scrollLeft;
110
+ const syncVertically = sourceScrollTop !== targetScrollTop;
111
+ const syncHorizontally = sourceScrollLeft !== targetScrollLeft;
112
+ if (syncVertically) {
113
+ targets[0].scrollTop = sourceScrollTop;
114
+ }
115
+ else if (syncHorizontally) {
116
+ targets[1].scrollLeft = sourceScrollLeft;
117
+ }
118
+ };
119
+ /**
120
+ * @hidden
121
+ */
122
+ const syncWheel = (event, tables, prop, axis) => {
123
+ const delta = axis === 'Y' ? -(wheelDelta(event, axis)) : wheelDelta(event, axis);
124
+ if (delta) {
125
+ tables[0][prop] =
126
+ tables[1][prop] += delta;
127
+ }
128
+ };
129
+
111
130
  /**
112
131
  * @hidden
113
132
  */
@@ -139,7 +158,7 @@ class PivotGridCellDirective {
139
158
  this.dataService.columnHeaderLeaves[this.colIndex].total)),
140
159
  'k-pivotgrid-header-root': this.kendoPivotGridCell.levelNum === 0,
141
160
  'k-pivotgrid-expanded': this.kendoPivotGridCell.hasChildren && this.kendoPivotGridCell.children.length,
142
- 'k-first': this.colIndex === 1
161
+ 'k-first': this.colIndex > 0
143
162
  };
144
163
  for (let prop in classesToAdd) {
145
164
  if (classesToAdd[prop]) {
@@ -159,7 +178,7 @@ PivotGridCellDirective.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
159
178
  [ngClass]="{
160
179
  'k-i-arrow-chevron-up': expanded,
161
180
  'k-i-arrow-chevron-down': !expanded
162
- }"></span>{{ kendoPivotGridCell.data ? kendoPivotGridCell.data.fmtValue : kendoPivotGridCell.caption }}`, isInline: true, directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
181
+ }"></span>{{ kendoPivotGridCell.data ? kendoPivotGridCell.data.fmtValue : kendoPivotGridCell.caption }}`, isInline: true, directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
163
182
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridCellDirective, decorators: [{
164
183
  type: Component,
165
184
  args: [{
@@ -276,17 +295,17 @@ const DEFAULT_LOADER_SETTINGS = {
276
295
  size: 'large'
277
296
  };
278
297
  /**
279
- * A sample component
298
+ * Represents the Kendo UI PivotGrid component for Angular.
280
299
  */
281
300
  class PivotGridComponent {
282
- constructor(hostEl, zone, dataService) {
301
+ constructor(hostEl, zone, dataService, _scrollbarWidthService) {
283
302
  this.hostEl = hostEl;
284
303
  this.zone = zone;
285
304
  this.dataService = dataService;
286
305
  this.hostClass = true;
287
306
  this.resizeObservers = [];
288
307
  this._loaderSettings = DEFAULT_LOADER_SETTINGS;
289
- this.loadingSubscription = new Subscription();
308
+ this.subs = new Subscription();
290
309
  this.resizeContainer = (axis, element) => {
291
310
  const isRows = axis === 'Rows';
292
311
  const wrapper = this.hostEl.nativeElement;
@@ -294,11 +313,22 @@ class PivotGridComponent {
294
313
  wrapper.style[`gridTemplate${axis}`] = '';
295
314
  wrapper.style[`gridTemplate${axis}`] = `${element[size]}px 1fr`;
296
315
  };
316
+ this.handleScroll = (event) => {
317
+ if (event.target === this.valuesTable.nativeElement) {
318
+ syncScroll(event.target, [
319
+ this.rowHeadersTable.nativeElement,
320
+ this.colHeadersTable.nativeElement
321
+ ]);
322
+ }
323
+ else if (event.target.closest('.k-pivotgrid-row-headers')) {
324
+ syncWheel(event, [this.valuesTable.nativeElement, this.rowHeadersTable.nativeElement], 'scrollTop', 'Y');
325
+ }
326
+ else if (event.target.closest('.k-pivotgrid-column-headers')) {
327
+ syncWheel(event, [this.valuesTable.nativeElement, this.colHeadersTable.nativeElement], 'scrollLeft', 'X');
328
+ }
329
+ };
297
330
  validatePackage(packageMetadata);
298
331
  }
299
- get scrollbarWidth() {
300
- return `${scrollbarWidth()}px`;
301
- }
302
332
  /**
303
333
  * Specify the type, size and color of the PivotGrid's loader.
304
334
  *
@@ -317,36 +347,41 @@ class PivotGridComponent {
317
347
  ngAfterViewInit() {
318
348
  if (isDocumentAvailable()) {
319
349
  this.zone.runOutsideAngular(() => {
320
- const rowHeadersTable = document.querySelector('.k-pivotgrid-row-headers .k-pivotgrid-table');
350
+ const rowHeadersTable = this.rowHeadersTable.nativeElement.firstElementChild;
321
351
  const headerColsResizeObserver = new ResizeObserver(() => this.resizeContainer('Columns', rowHeadersTable));
322
352
  headerColsResizeObserver.observe(rowHeadersTable);
323
- const colHeadersTable = document.querySelector('.k-pivotgrid-column-headers .k-pivotgrid-table');
353
+ const colHeadersTable = this.colHeadersTable.nativeElement.firstElementChild;
324
354
  const headerRowsResizeObserver = new ResizeObserver(() => this.resizeContainer('Rows', colHeadersTable));
325
355
  headerRowsResizeObserver.observe(colHeadersTable);
326
356
  this.resizeObservers = [headerColsResizeObserver, headerRowsResizeObserver];
357
+ this.subs.add(fromEvent(rowHeadersTable, 'wheel')
358
+ .pipe(mergeWith(fromEvent(colHeadersTable, 'wheel'), fromEvent(this.valuesTable.nativeElement, 'scroll'))).subscribe((ev) => this.handleScroll(ev)));
327
359
  });
328
360
  }
329
361
  }
330
362
  ngAfterContentInit() {
331
- this.loadingSubscription.add(this.dataService.loading.subscribe(state => this.loading = state));
363
+ this.subs.add(this.dataService.loading.subscribe(state => this.loading = state));
332
364
  }
333
365
  ngOnDestroy() {
334
366
  this.resizeObservers.forEach(o => o.disconnect());
335
- this.loadingSubscription.unsubscribe();
367
+ this.subs.unsubscribe();
336
368
  }
337
369
  }
338
- PivotGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: PivotGridDataService }], target: i0.ɵɵFactoryTarget.Component });
339
- PivotGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: PivotGridComponent, selector: "kendo-pivotgrid", inputs: { loaderSettings: "loaderSettings" }, host: { properties: { "class.k-pivotgrid": "this.hostClass", "style.--kendo-scrollbar-width": "this.scrollbarWidth" } }, providers: [
370
+ PivotGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: PivotGridDataService }, { token: i2$1.ScrollbarWidthService }], target: i0.ɵɵFactoryTarget.Component });
371
+ PivotGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: PivotGridComponent, selector: "kendo-pivotgrid", inputs: { loaderSettings: "loaderSettings" }, host: { properties: { "class.k-pivotgrid": "this.hostClass" } }, providers: [
340
372
  PivotGridDataService
341
- ], ngImport: i0, template: `
373
+ ], viewQueries: [{ propertyName: "colHeadersTable", first: true, predicate: ["colHeadersTable"], descendants: true, read: ElementRef }, { propertyName: "rowHeadersTable", first: true, predicate: ["rowHeadersTable"], descendants: true, read: ElementRef }, { propertyName: "valuesTable", first: true, predicate: ["valuesTable"], descendants: true, read: ElementRef }], ngImport: i0, template: `
342
374
  <span class="k-pivotgrid-empty-cell"></span>
343
375
  <kendo-pivotgrid-table
376
+ #colHeadersTable
344
377
  class="k-pivotgrid-column-headers"
345
378
  tableType="columnHeader"></kendo-pivotgrid-table>
346
379
  <kendo-pivotgrid-table
380
+ #rowHeadersTable
347
381
  class="k-pivotgrid-row-headers"
348
382
  tableType="rowHeader"></kendo-pivotgrid-table>
349
383
  <kendo-pivotgrid-table
384
+ #valuesTable
350
385
  class="k-pivotgrid-values"
351
386
  tableType="values"></kendo-pivotgrid-table>
352
387
 
@@ -358,7 +393,7 @@ PivotGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
358
393
  >
359
394
  </kendo-loader>
360
395
  </div>
361
- `, isInline: true, styles: ["\n /** TODO: Remove if added to themes */\n div.k-loader {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n "], components: [{ type: PivotGridTableComponent, selector: "kendo-pivotgrid-table", inputs: ["tableType"] }, { type: i3$1.LoaderComponent, selector: "kendo-loader", inputs: ["type", "themeColor", "size"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
396
+ `, isInline: true, styles: ["\n /** TODO: Remove if added to themes */\n div.k-loader {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n "], components: [{ type: PivotGridTableComponent, selector: "kendo-pivotgrid-table", inputs: ["tableType"] }, { type: i4.LoaderComponent, selector: "kendo-loader", inputs: ["type", "themeColor", "size"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
362
397
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridComponent, decorators: [{
363
398
  type: Component,
364
399
  args: [{
@@ -369,12 +404,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
369
404
  template: `
370
405
  <span class="k-pivotgrid-empty-cell"></span>
371
406
  <kendo-pivotgrid-table
407
+ #colHeadersTable
372
408
  class="k-pivotgrid-column-headers"
373
409
  tableType="columnHeader"></kendo-pivotgrid-table>
374
410
  <kendo-pivotgrid-table
411
+ #rowHeadersTable
375
412
  class="k-pivotgrid-row-headers"
376
413
  tableType="rowHeader"></kendo-pivotgrid-table>
377
414
  <kendo-pivotgrid-table
415
+ #valuesTable
378
416
  class="k-pivotgrid-values"
379
417
  tableType="values"></kendo-pivotgrid-table>
380
418
 
@@ -397,12 +435,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
397
435
  }
398
436
  `]
399
437
  }]
400
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: PivotGridDataService }]; }, propDecorators: { hostClass: [{
438
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: PivotGridDataService }, { type: i2$1.ScrollbarWidthService }]; }, propDecorators: { hostClass: [{
401
439
  type: HostBinding,
402
440
  args: ['class.k-pivotgrid']
403
- }], scrollbarWidth: [{
404
- type: HostBinding,
405
- args: ['style.--kendo-scrollbar-width']
441
+ }], colHeadersTable: [{
442
+ type: ViewChild,
443
+ args: ['colHeadersTable', { read: ElementRef }]
444
+ }], rowHeadersTable: [{
445
+ type: ViewChild,
446
+ args: ['rowHeadersTable', { read: ElementRef }]
447
+ }], valuesTable: [{
448
+ type: ViewChild,
449
+ args: ['valuesTable', { read: ElementRef }]
406
450
  }], loaderSettings: [{
407
451
  type: Input
408
452
  }] } });
package/main.d.ts CHANGED
@@ -8,4 +8,4 @@ export { PivotGridCellDirective } from './rendering/pivotgrid-cell.directive';
8
8
  export { PivotGridTableComponent } from './rendering/pivotgrid-table.component';
9
9
  export { PivotLocalBindingDirective } from './data-binding/local-binding.directive';
10
10
  export { PivotOLAPBindingDirective } from './data-binding/olap-binding.directive';
11
- export { Dimension, Measure, PivotGridAxis, Aggregate, PivotGridField, averageAggregate, maxAggregate, minAggregate, sumAggregate } from '@progress/kendo-pivotgrid-common';
11
+ export * from '@progress/kendo-pivotgrid-common';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-angular-pivotgrid",
3
- "version": "0.1.2",
3
+ "version": "0.1.4-dev.202205131602",
4
4
  "description": "PivotGrid package for Angular",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "Progress",
@@ -3,18 +3,21 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { AfterContentInit, AfterViewInit, ElementRef, NgZone, OnDestroy } from '@angular/core';
6
+ import { ScrollbarWidthService } from '@progress/kendo-angular-common';
6
7
  import { PivotGridDataService } from './data-binding/pivotgrid-data.service';
7
8
  import { LoaderSettings } from './models/loader-settings';
8
9
  import * as i0 from "@angular/core";
9
10
  /**
10
- * A sample component
11
+ * Represents the Kendo UI PivotGrid component for Angular.
11
12
  */
12
13
  export declare class PivotGridComponent implements AfterViewInit, AfterContentInit, OnDestroy {
13
14
  private hostEl;
14
15
  private zone;
15
16
  private dataService;
16
17
  hostClass: boolean;
17
- get scrollbarWidth(): string;
18
+ private colHeadersTable;
19
+ private rowHeadersTable;
20
+ private valuesTable;
18
21
  /**
19
22
  * Specify the type, size and color of the PivotGrid's loader.
20
23
  *
@@ -28,12 +31,13 @@ export declare class PivotGridComponent implements AfterViewInit, AfterContentIn
28
31
  loading: boolean;
29
32
  private resizeObservers;
30
33
  private _loaderSettings;
31
- private loadingSubscription;
32
- constructor(hostEl: ElementRef, zone: NgZone, dataService: PivotGridDataService);
34
+ private subs;
35
+ constructor(hostEl: ElementRef, zone: NgZone, dataService: PivotGridDataService, _scrollbarWidthService: ScrollbarWidthService);
33
36
  ngAfterViewInit(): void;
34
37
  ngAfterContentInit(): void;
35
38
  ngOnDestroy(): void;
36
39
  private resizeContainer;
40
+ private handleScroll;
37
41
  static ɵfac: i0.ɵɵFactoryDeclaration<PivotGridComponent, never>;
38
42
  static ɵcmp: i0.ɵɵComponentDeclaration<PivotGridComponent, "kendo-pivotgrid", never, { "loaderSettings": "loaderSettings"; }, {}, never, never>;
39
43
  }
package/util.d.ts CHANGED
@@ -2,10 +2,6 @@
2
2
  * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- /**
6
- * @hidden
7
- */
8
- export declare const scrollbarWidth: () => number;
9
5
  /**
10
6
  * @hidden
11
7
  */
@@ -16,3 +12,15 @@ export declare const isPresent: (value: any) => boolean;
16
12
  * Assumes array elements are primitive types
17
13
  */
18
14
  export declare const areSameArrays: (a1: any[], a2: any[]) => boolean;
15
+ /**
16
+ * @hidden
17
+ */
18
+ export declare const wheelDelta: (e: any, axis: 'X' | 'Y') => number;
19
+ /**
20
+ * @hidden
21
+ */
22
+ export declare const syncScroll: (source: HTMLTableElement, targets: HTMLTableElement[]) => void;
23
+ /**
24
+ * @hidden
25
+ */
26
+ export declare const syncWheel: (event: Event, tables: Element[], prop: 'scrollTop' | 'scrollLeft', axis: 'X' | 'Y') => void;