@progress/kendo-angular-pivotgrid 0.1.0
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.
- package/LICENSE.md +11 -0
- package/NOTICE.txt +654 -0
- package/README.md +31 -0
- package/bundles/kendo-angular-pivotgrid.umd.js +5 -0
- package/data-binding/base-binding-directive.d.ts +38 -0
- package/data-binding/local-binding.directive.d.ts +35 -0
- package/data-binding/olap-binding.directive.d.ts +30 -0
- package/data-binding/pivotgrid-data.service.d.ts +38 -0
- package/esm2015/data-binding/base-binding-directive.js +81 -0
- package/esm2015/data-binding/local-binding.directive.js +66 -0
- package/esm2015/data-binding/olap-binding.directive.js +57 -0
- package/esm2015/data-binding/pivotgrid-data.service.js +42 -0
- package/esm2015/kendo-angular-pivotgrid.js +8 -0
- package/esm2015/main.js +14 -0
- package/esm2015/models/expanded-state-action.js +5 -0
- package/esm2015/models/loader-settings.js +5 -0
- package/esm2015/package-metadata.js +15 -0
- package/esm2015/pivotgrid.component.js +152 -0
- package/esm2015/pivotgrid.module.js +60 -0
- package/esm2015/rendering/pivotgrid-cell.directive.js +90 -0
- package/esm2015/rendering/pivotgrid-table.component.js +89 -0
- package/esm2015/util.js +49 -0
- package/fesm2015/kendo-angular-pivotgrid.js +639 -0
- package/kendo-angular-pivotgrid.d.ts +9 -0
- package/main.d.ts +11 -0
- package/models/expanded-state-action.d.ts +16 -0
- package/models/loader-settings.d.ts +47 -0
- package/package-metadata.d.ts +9 -0
- package/package.json +86 -0
- package/pivotgrid.component.d.ts +39 -0
- package/pivotgrid.module.d.ts +21 -0
- package/rendering/pivotgrid-cell.directive.d.ts +26 -0
- package/rendering/pivotgrid-table.component.d.ts +22 -0
- package/schematics/collection.json +12 -0
- package/schematics/ngAdd/index.js +17 -0
- package/schematics/ngAdd/index.js.map +1 -0
- package/schematics/ngAdd/schema.json +28 -0
- package/util.d.ts +18 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { Component, HostBinding, Input } from '@angular/core';
|
|
6
|
+
import { validatePackage } from '@progress/kendo-licensing';
|
|
7
|
+
import { packageMetadata } from './package-metadata';
|
|
8
|
+
import { scrollbarWidth } from './util';
|
|
9
|
+
import { isDocumentAvailable } from '@progress/kendo-angular-common';
|
|
10
|
+
import { PivotGridDataService } from './data-binding/pivotgrid-data.service';
|
|
11
|
+
import { Subscription } from 'rxjs';
|
|
12
|
+
import * as i0 from "@angular/core";
|
|
13
|
+
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";
|
|
17
|
+
const DEFAULT_LOADER_SETTINGS = {
|
|
18
|
+
type: 'converging-spinner',
|
|
19
|
+
themeColor: 'primary',
|
|
20
|
+
size: 'large'
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A sample component
|
|
24
|
+
*/
|
|
25
|
+
export class PivotGridComponent {
|
|
26
|
+
constructor(hostEl, zone, dataService) {
|
|
27
|
+
this.hostEl = hostEl;
|
|
28
|
+
this.zone = zone;
|
|
29
|
+
this.dataService = dataService;
|
|
30
|
+
this.hostClass = true;
|
|
31
|
+
this.resizeObservers = [];
|
|
32
|
+
this._loaderSettings = DEFAULT_LOADER_SETTINGS;
|
|
33
|
+
this.loadingSubscription = new Subscription();
|
|
34
|
+
this.resizeContainer = (axis, element) => {
|
|
35
|
+
const isRows = axis === 'Rows';
|
|
36
|
+
const wrapper = this.hostEl.nativeElement;
|
|
37
|
+
const size = isRows ? 'offsetHeight' : 'offsetWidth';
|
|
38
|
+
wrapper.style[`gridTemplate${axis}`] = '';
|
|
39
|
+
wrapper.style[`gridTemplate${axis}`] = `${element[size]}px 1fr`;
|
|
40
|
+
};
|
|
41
|
+
validatePackage(packageMetadata);
|
|
42
|
+
}
|
|
43
|
+
get scrollbarWidth() {
|
|
44
|
+
return `${scrollbarWidth()}px`;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Specify the type, size and color of the PivotGrid's loader.
|
|
48
|
+
*
|
|
49
|
+
* The default settings are:
|
|
50
|
+
* * type: `converging-spinner`
|
|
51
|
+
* * color: `primary`
|
|
52
|
+
* * size: `large`
|
|
53
|
+
*/
|
|
54
|
+
set loaderSettings(settings) {
|
|
55
|
+
this._loaderSettings = Object.assign({}, DEFAULT_LOADER_SETTINGS, settings);
|
|
56
|
+
}
|
|
57
|
+
;
|
|
58
|
+
get loaderSettings() {
|
|
59
|
+
return this._loaderSettings;
|
|
60
|
+
}
|
|
61
|
+
ngAfterViewInit() {
|
|
62
|
+
if (isDocumentAvailable()) {
|
|
63
|
+
this.zone.runOutsideAngular(() => {
|
|
64
|
+
const rowHeadersTable = document.querySelector('.k-pivotgrid-row-headers .k-pivotgrid-table');
|
|
65
|
+
const headerColsResizeObserver = new ResizeObserver(() => this.resizeContainer('Columns', rowHeadersTable));
|
|
66
|
+
headerColsResizeObserver.observe(rowHeadersTable);
|
|
67
|
+
const colHeadersTable = document.querySelector('.k-pivotgrid-column-headers .k-pivotgrid-table');
|
|
68
|
+
const headerRowsResizeObserver = new ResizeObserver(() => this.resizeContainer('Rows', colHeadersTable));
|
|
69
|
+
headerRowsResizeObserver.observe(colHeadersTable);
|
|
70
|
+
this.resizeObservers = [headerColsResizeObserver, headerRowsResizeObserver];
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
ngAfterContentInit() {
|
|
75
|
+
this.loadingSubscription.add(this.dataService.loading.subscribe(state => this.loading = state));
|
|
76
|
+
}
|
|
77
|
+
ngOnDestroy() {
|
|
78
|
+
this.resizeObservers.forEach(o => o.disconnect());
|
|
79
|
+
this.loadingSubscription.unsubscribe();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
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: [
|
|
84
|
+
PivotGridDataService
|
|
85
|
+
], ngImport: i0, template: `
|
|
86
|
+
<span class="k-pivotgrid-empty-cell"></span>
|
|
87
|
+
<kendo-pivotgrid-table
|
|
88
|
+
class="k-pivotgrid-column-headers"
|
|
89
|
+
tableType="columnHeader"></kendo-pivotgrid-table>
|
|
90
|
+
<kendo-pivotgrid-table
|
|
91
|
+
class="k-pivotgrid-row-headers"
|
|
92
|
+
tableType="rowHeader"></kendo-pivotgrid-table>
|
|
93
|
+
<kendo-pivotgrid-table
|
|
94
|
+
class="k-pivotgrid-values"
|
|
95
|
+
tableType="values"></kendo-pivotgrid-table>
|
|
96
|
+
|
|
97
|
+
<div *ngIf="loading" class="k-loader">
|
|
98
|
+
<kendo-loader
|
|
99
|
+
[type]="loaderSettings?.type"
|
|
100
|
+
[themeColor]="loaderSettings?.themeColor"
|
|
101
|
+
[size]="loaderSettings?.size"
|
|
102
|
+
>
|
|
103
|
+
</kendo-loader>
|
|
104
|
+
</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"] }] });
|
|
106
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridComponent, decorators: [{
|
|
107
|
+
type: Component,
|
|
108
|
+
args: [{
|
|
109
|
+
selector: 'kendo-pivotgrid',
|
|
110
|
+
providers: [
|
|
111
|
+
PivotGridDataService
|
|
112
|
+
],
|
|
113
|
+
template: `
|
|
114
|
+
<span class="k-pivotgrid-empty-cell"></span>
|
|
115
|
+
<kendo-pivotgrid-table
|
|
116
|
+
class="k-pivotgrid-column-headers"
|
|
117
|
+
tableType="columnHeader"></kendo-pivotgrid-table>
|
|
118
|
+
<kendo-pivotgrid-table
|
|
119
|
+
class="k-pivotgrid-row-headers"
|
|
120
|
+
tableType="rowHeader"></kendo-pivotgrid-table>
|
|
121
|
+
<kendo-pivotgrid-table
|
|
122
|
+
class="k-pivotgrid-values"
|
|
123
|
+
tableType="values"></kendo-pivotgrid-table>
|
|
124
|
+
|
|
125
|
+
<div *ngIf="loading" class="k-loader">
|
|
126
|
+
<kendo-loader
|
|
127
|
+
[type]="loaderSettings?.type"
|
|
128
|
+
[themeColor]="loaderSettings?.themeColor"
|
|
129
|
+
[size]="loaderSettings?.size"
|
|
130
|
+
>
|
|
131
|
+
</kendo-loader>
|
|
132
|
+
</div>
|
|
133
|
+
`,
|
|
134
|
+
styles: [`
|
|
135
|
+
/** TODO: Remove if added to themes */
|
|
136
|
+
div.k-loader {
|
|
137
|
+
position: absolute;
|
|
138
|
+
top: 50%;
|
|
139
|
+
left: 50%;
|
|
140
|
+
transform: translate(-50%, -50%);
|
|
141
|
+
}
|
|
142
|
+
`]
|
|
143
|
+
}]
|
|
144
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i1.PivotGridDataService }]; }, propDecorators: { hostClass: [{
|
|
145
|
+
type: HostBinding,
|
|
146
|
+
args: ['class.k-pivotgrid']
|
|
147
|
+
}], scrollbarWidth: [{
|
|
148
|
+
type: HostBinding,
|
|
149
|
+
args: ['style.--kendo-scrollbar-width']
|
|
150
|
+
}], loaderSettings: [{
|
|
151
|
+
type: Input
|
|
152
|
+
}] } });
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { CommonModule } from '@angular/common';
|
|
6
|
+
import { NgModule } from '@angular/core';
|
|
7
|
+
import { L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
8
|
+
import { IndicatorsModule } from "@progress/kendo-angular-indicators";
|
|
9
|
+
import { PivotGridComponent } from './pivotgrid.component';
|
|
10
|
+
import { PivotGridCellDirective } from './rendering/pivotgrid-cell.directive';
|
|
11
|
+
import { PivotGridTableComponent } from './rendering/pivotgrid-table.component';
|
|
12
|
+
import { EventsModule } from '@progress/kendo-angular-common';
|
|
13
|
+
import { PivotLocalBindingDirective } from './data-binding/local-binding.directive';
|
|
14
|
+
import { PivotOLAPBindingDirective } from './data-binding/olap-binding.directive';
|
|
15
|
+
import * as i0 from "@angular/core";
|
|
16
|
+
const IMPORTED_MODULES = [
|
|
17
|
+
CommonModule,
|
|
18
|
+
EventsModule,
|
|
19
|
+
IndicatorsModule
|
|
20
|
+
];
|
|
21
|
+
const DECLARATIONS = [
|
|
22
|
+
PivotGridComponent,
|
|
23
|
+
PivotGridTableComponent,
|
|
24
|
+
PivotGridCellDirective,
|
|
25
|
+
PivotLocalBindingDirective,
|
|
26
|
+
PivotOLAPBindingDirective
|
|
27
|
+
];
|
|
28
|
+
/**
|
|
29
|
+
* Sample module
|
|
30
|
+
*/
|
|
31
|
+
export class PivotGridModule {
|
|
32
|
+
}
|
|
33
|
+
PivotGridModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
34
|
+
PivotGridModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridModule, declarations: [PivotGridComponent,
|
|
35
|
+
PivotGridTableComponent,
|
|
36
|
+
PivotGridCellDirective,
|
|
37
|
+
PivotLocalBindingDirective,
|
|
38
|
+
PivotOLAPBindingDirective], imports: [CommonModule,
|
|
39
|
+
EventsModule,
|
|
40
|
+
IndicatorsModule], exports: [PivotGridComponent,
|
|
41
|
+
PivotGridTableComponent,
|
|
42
|
+
PivotGridCellDirective,
|
|
43
|
+
PivotLocalBindingDirective,
|
|
44
|
+
PivotOLAPBindingDirective] });
|
|
45
|
+
PivotGridModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridModule, providers: [{
|
|
46
|
+
provide: L10N_PREFIX,
|
|
47
|
+
useValue: 'kendo.pivotgrid'
|
|
48
|
+
}], imports: [[...IMPORTED_MODULES]] });
|
|
49
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridModule, decorators: [{
|
|
50
|
+
type: NgModule,
|
|
51
|
+
args: [{
|
|
52
|
+
imports: [...IMPORTED_MODULES],
|
|
53
|
+
declarations: [...DECLARATIONS],
|
|
54
|
+
exports: [...DECLARATIONS],
|
|
55
|
+
providers: [{
|
|
56
|
+
provide: L10N_PREFIX,
|
|
57
|
+
useValue: 'kendo.pivotgrid'
|
|
58
|
+
}]
|
|
59
|
+
}]
|
|
60
|
+
}] });
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { Component, HostBinding, Input } from '@angular/core';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
import * as i1 from "../data-binding/pivotgrid-data.service";
|
|
8
|
+
import * as i2 from "@angular/common";
|
|
9
|
+
import * as i3 from "@progress/kendo-angular-common";
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
export class PivotGridCellDirective {
|
|
14
|
+
constructor(hostEl, renderer, dataService) {
|
|
15
|
+
this.hostEl = hostEl;
|
|
16
|
+
this.renderer = renderer;
|
|
17
|
+
this.dataService = dataService;
|
|
18
|
+
this.cellClass = true;
|
|
19
|
+
this.handleClick = () => {
|
|
20
|
+
this.dataService.expandedStateChange.emit({
|
|
21
|
+
action: this.expanded ? 'collapse' : 'expand',
|
|
22
|
+
cell: this.kendoPivotGridCell,
|
|
23
|
+
tableType: this.tableType
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
get expanded() {
|
|
28
|
+
var _a;
|
|
29
|
+
return ((_a = this.kendoPivotGridCell) === null || _a === void 0 ? void 0 : _a.hasChildren) && this.kendoPivotGridCell.children.length;
|
|
30
|
+
}
|
|
31
|
+
ngOnInit() {
|
|
32
|
+
const nativeElement = this.hostEl.nativeElement;
|
|
33
|
+
this.renderer.setAttribute(nativeElement, 'rowspan', this.kendoPivotGridCell.rowSpan || 1);
|
|
34
|
+
this.renderer.setAttribute(nativeElement, 'colspan', this.kendoPivotGridCell.colSpan || 1);
|
|
35
|
+
const classesToAdd = {
|
|
36
|
+
'k-pivotgrid-header-total': this.kendoPivotGridCell.total || (this.tableType === 'values'
|
|
37
|
+
&& (this.dataService.rowHeaderLeaves[this.rowIndex].total ||
|
|
38
|
+
this.dataService.columnHeaderLeaves[this.colIndex].total)),
|
|
39
|
+
'k-pivotgrid-header-root': this.kendoPivotGridCell.levelNum === 0,
|
|
40
|
+
'k-pivotgrid-expanded': this.kendoPivotGridCell.hasChildren && this.kendoPivotGridCell.children.length,
|
|
41
|
+
'k-first': this.colIndex === 1
|
|
42
|
+
};
|
|
43
|
+
for (let prop in classesToAdd) {
|
|
44
|
+
if (classesToAdd[prop]) {
|
|
45
|
+
this.renderer.addClass(nativeElement, prop);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
PivotGridCellDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridCellDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1.PivotGridDataService }], target: i0.ɵɵFactoryTarget.Component });
|
|
51
|
+
PivotGridCellDirective.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: PivotGridCellDirective, selector: "[kendoPivotGridCell]", inputs: { kendoPivotGridCell: "kendoPivotGridCell", tableType: "tableType", rowIndex: "rowIndex", colIndex: "colIndex" }, host: { properties: { "class.k-pivotgrid-cell": "this.cellClass" } }, ngImport: i0, template: `
|
|
52
|
+
<span
|
|
53
|
+
*ngIf="kendoPivotGridCell.hasChildren && !kendoPivotGridCell.total"
|
|
54
|
+
class="k-icon"
|
|
55
|
+
[kendoEventsOutsideAngular]="{
|
|
56
|
+
click: handleClick
|
|
57
|
+
}"
|
|
58
|
+
[ngClass]="{
|
|
59
|
+
'k-i-arrow-chevron-up': expanded,
|
|
60
|
+
'k-i-arrow-chevron-down': !expanded
|
|
61
|
+
}"></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"] }] });
|
|
62
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridCellDirective, decorators: [{
|
|
63
|
+
type: Component,
|
|
64
|
+
args: [{
|
|
65
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
66
|
+
selector: '[kendoPivotGridCell]',
|
|
67
|
+
template: `
|
|
68
|
+
<span
|
|
69
|
+
*ngIf="kendoPivotGridCell.hasChildren && !kendoPivotGridCell.total"
|
|
70
|
+
class="k-icon"
|
|
71
|
+
[kendoEventsOutsideAngular]="{
|
|
72
|
+
click: handleClick
|
|
73
|
+
}"
|
|
74
|
+
[ngClass]="{
|
|
75
|
+
'k-i-arrow-chevron-up': expanded,
|
|
76
|
+
'k-i-arrow-chevron-down': !expanded
|
|
77
|
+
}"></span>{{ kendoPivotGridCell.data ? kendoPivotGridCell.data.fmtValue : kendoPivotGridCell.caption }}`
|
|
78
|
+
}]
|
|
79
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1.PivotGridDataService }]; }, propDecorators: { cellClass: [{
|
|
80
|
+
type: HostBinding,
|
|
81
|
+
args: ['class.k-pivotgrid-cell']
|
|
82
|
+
}], kendoPivotGridCell: [{
|
|
83
|
+
type: Input
|
|
84
|
+
}], tableType: [{
|
|
85
|
+
type: Input
|
|
86
|
+
}], rowIndex: [{
|
|
87
|
+
type: Input
|
|
88
|
+
}], colIndex: [{
|
|
89
|
+
type: Input
|
|
90
|
+
}] } });
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { Component, Input } from '@angular/core';
|
|
6
|
+
import { Subscription } from 'rxjs';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
import * as i1 from "../data-binding/pivotgrid-data.service";
|
|
9
|
+
import * as i2 from "./pivotgrid-cell.directive";
|
|
10
|
+
import * as i3 from "@angular/common";
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
export class PivotGridTableComponent {
|
|
15
|
+
constructor(dataService) {
|
|
16
|
+
this.dataService = dataService;
|
|
17
|
+
this.dataChangeSubs = new Subscription();
|
|
18
|
+
}
|
|
19
|
+
ngOnInit() {
|
|
20
|
+
this.dataChangeSubs.add(this.dataService[`${this.tableType}Rows`].subscribe(rows => this.rows = rows));
|
|
21
|
+
this.dataChangeSubs.add(this.tableType === 'values' ?
|
|
22
|
+
this.dataService.columnHeaderCols.subscribe(cols => this.headerItems = cols) :
|
|
23
|
+
this.dataService[`${this.tableType}Cols`].subscribe(cols => this.headerItems = cols));
|
|
24
|
+
}
|
|
25
|
+
ngOnDestroy() {
|
|
26
|
+
this.dataChangeSubs.unsubscribe();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
PivotGridTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridTableComponent, deps: [{ token: i1.PivotGridDataService }], target: i0.ɵɵFactoryTarget.Component });
|
|
30
|
+
PivotGridTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: PivotGridTableComponent, selector: "kendo-pivotgrid-table", inputs: { tableType: "tableType" }, ngImport: i0, template: `
|
|
31
|
+
<table class="k-pivotgrid-table">
|
|
32
|
+
<colgroup>
|
|
33
|
+
<col *ngFor="let item of headerItems;" />
|
|
34
|
+
</colgroup>
|
|
35
|
+
<tbody class="k-pivotgrid-tbody">
|
|
36
|
+
<tr *ngFor="let row of rows; index as rowIndex"
|
|
37
|
+
class="k-pivotgrid-row">
|
|
38
|
+
<ng-container *ngFor="let cell of row.cells; index as colIndex">
|
|
39
|
+
<th
|
|
40
|
+
*ngIf="cell && tableType !== 'values'"
|
|
41
|
+
[kendoPivotGridCell]="cell"
|
|
42
|
+
[tableType]="tableType"
|
|
43
|
+
[colIndex]="colIndex"
|
|
44
|
+
[rowIndex]="rowIndex"></th>
|
|
45
|
+
<td
|
|
46
|
+
*ngIf="cell && tableType === 'values'"
|
|
47
|
+
[kendoPivotGridCell]="cell"
|
|
48
|
+
tableType="values"
|
|
49
|
+
[colIndex]="colIndex"
|
|
50
|
+
[rowIndex]="rowIndex"></td>
|
|
51
|
+
</ng-container>
|
|
52
|
+
</tr>
|
|
53
|
+
</tbody>
|
|
54
|
+
</table>
|
|
55
|
+
`, isInline: true, components: [{ type: i2.PivotGridCellDirective, selector: "[kendoPivotGridCell]", inputs: ["kendoPivotGridCell", "tableType", "rowIndex", "colIndex"] }], directives: [{ type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
56
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridTableComponent, decorators: [{
|
|
57
|
+
type: Component,
|
|
58
|
+
args: [{
|
|
59
|
+
selector: 'kendo-pivotgrid-table',
|
|
60
|
+
template: `
|
|
61
|
+
<table class="k-pivotgrid-table">
|
|
62
|
+
<colgroup>
|
|
63
|
+
<col *ngFor="let item of headerItems;" />
|
|
64
|
+
</colgroup>
|
|
65
|
+
<tbody class="k-pivotgrid-tbody">
|
|
66
|
+
<tr *ngFor="let row of rows; index as rowIndex"
|
|
67
|
+
class="k-pivotgrid-row">
|
|
68
|
+
<ng-container *ngFor="let cell of row.cells; index as colIndex">
|
|
69
|
+
<th
|
|
70
|
+
*ngIf="cell && tableType !== 'values'"
|
|
71
|
+
[kendoPivotGridCell]="cell"
|
|
72
|
+
[tableType]="tableType"
|
|
73
|
+
[colIndex]="colIndex"
|
|
74
|
+
[rowIndex]="rowIndex"></th>
|
|
75
|
+
<td
|
|
76
|
+
*ngIf="cell && tableType === 'values'"
|
|
77
|
+
[kendoPivotGridCell]="cell"
|
|
78
|
+
tableType="values"
|
|
79
|
+
[colIndex]="colIndex"
|
|
80
|
+
[rowIndex]="rowIndex"></td>
|
|
81
|
+
</ng-container>
|
|
82
|
+
</tr>
|
|
83
|
+
</tbody>
|
|
84
|
+
</table>
|
|
85
|
+
`
|
|
86
|
+
}]
|
|
87
|
+
}], ctorParameters: function () { return [{ type: i1.PivotGridDataService }]; }, propDecorators: { tableType: [{
|
|
88
|
+
type: Input
|
|
89
|
+
}] } });
|
package/esm2015/util.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
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 = " ";
|
|
22
|
+
document.body.appendChild(div);
|
|
23
|
+
cachedScrollbarWidth = div.offsetWidth - div.scrollWidth;
|
|
24
|
+
document.body.removeChild(div);
|
|
25
|
+
}
|
|
26
|
+
return cachedScrollbarWidth;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* @hidden
|
|
30
|
+
*/
|
|
31
|
+
export const isPresent = (value) => value !== null && value !== undefined;
|
|
32
|
+
/**
|
|
33
|
+
* @hidden
|
|
34
|
+
* Returns whether two arrays contain the same values.
|
|
35
|
+
* Assumes array elements are primitive types
|
|
36
|
+
*/
|
|
37
|
+
export const areSameArrays = (a1, a2) => {
|
|
38
|
+
const areArrays = (isPresent(a1) && Array.isArray(a1) && isPresent(a2) && Array.isArray(a2));
|
|
39
|
+
const areOfEqualLength = a1.length === a2.length;
|
|
40
|
+
if (!areArrays || !areOfEqualLength) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
for (let i = 0; i < a1.length; i++) {
|
|
44
|
+
if (a1[i] !== a2[i]) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
49
|
+
};
|