@progress/kendo-angular-pivotgrid 0.2.0-dev.202208181233 → 0.2.0-dev.202208250747

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.
Files changed (45) hide show
  1. package/bundles/kendo-angular-pivotgrid.umd.js +1 -1
  2. package/configurator/configurator.component.d.ts +96 -0
  3. package/configurator/configurator.service.d.ts +17 -0
  4. package/configurator/draggable.directive.d.ts +32 -0
  5. package/configurator/drop-cue.service.d.ts +22 -0
  6. package/configurator/drop-target.directive.d.ts +32 -0
  7. package/data-binding/base-binding-directive.d.ts +33 -5
  8. package/data-binding/local-binding.directive.d.ts +8 -1
  9. package/data-binding/olap-binding.directive.d.ts +13 -1
  10. package/data-binding/pivotgrid-data.service.d.ts +8 -3
  11. package/esm2015/configurator/configurator.component.js +500 -0
  12. package/esm2015/configurator/configurator.service.js +38 -0
  13. package/esm2015/configurator/draggable.directive.js +94 -0
  14. package/esm2015/configurator/drop-cue.service.js +64 -0
  15. package/esm2015/configurator/drop-target.directive.js +82 -0
  16. package/esm2015/data-binding/base-binding-directive.js +82 -9
  17. package/esm2015/data-binding/local-binding.directive.js +20 -8
  18. package/esm2015/data-binding/olap-binding.directive.js +131 -6
  19. package/esm2015/data-binding/pivotgrid-data.service.js +9 -1
  20. package/esm2015/localization/custom-messages.component.js +41 -0
  21. package/esm2015/localization/localized-messages.directive.js +36 -0
  22. package/esm2015/localization/messages.js +77 -0
  23. package/esm2015/main.js +8 -0
  24. package/esm2015/models/configuration-change-event.js +18 -0
  25. package/esm2015/models/configurator-settings.js +14 -0
  26. package/esm2015/models/data-row-item.js +6 -0
  27. package/esm2015/models/expanded-change-event.js +18 -0
  28. package/esm2015/package-metadata.js +1 -1
  29. package/esm2015/pivotgrid.component.js +355 -63
  30. package/esm2015/pivotgrid.module.js +43 -16
  31. package/esm2015/util.js +59 -0
  32. package/fesm2015/kendo-angular-pivotgrid.js +1593 -106
  33. package/localization/custom-messages.component.d.ts +18 -0
  34. package/localization/localized-messages.directive.d.ts +16 -0
  35. package/localization/messages.d.ts +172 -0
  36. package/main.d.ts +7 -0
  37. package/models/configuration-change-event.d.ts +36 -0
  38. package/models/configurator-settings.d.ts +32 -0
  39. package/models/data-row-item.d.ts +18 -0
  40. package/models/expanded-change-event.d.ts +27 -0
  41. package/package.json +7 -1
  42. package/pivotgrid.component.d.ts +27 -3
  43. package/pivotgrid.module.d.ts +15 -7
  44. package/rendering/pivotgrid-table.component.d.ts +2 -2
  45. package/util.d.ts +23 -0
@@ -3,19 +3,27 @@
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, ElementRef, ViewChild, Directive, NgModule } from '@angular/core';
6
+ import { EventEmitter, Injectable, Output, Component, HostBinding, Input, Directive, Optional, forwardRef, ElementRef, ViewChild, NgModule } from '@angular/core';
7
7
  import { validatePackage } from '@progress/kendo-licensing';
8
- import * as i2$1 from '@progress/kendo-angular-common';
9
- import { isDocumentAvailable, anyChanged, EventsModule } from '@progress/kendo-angular-common';
10
- import { toTree, toRows, toColumns, toData, HEADERS_ACTION, headersReducer, createDataTree, createLocalDataState, rootFields, fetchData, createDataState } from '@progress/kendo-pivotgrid-common';
8
+ import * as i3 from '@progress/kendo-angular-common';
9
+ import { isDocumentAvailable, PreventableEvent, hasObservers, anyChanged, EventsModule, DraggableModule } from '@progress/kendo-angular-common';
10
+ import { toTree, toRows, toColumns, toData, configuratorReducer, PIVOT_CONFIGURATOR_ACTION, HEADERS_ACTION, headersReducer, createFlatSchemaDimensions, createDataTree, createLocalDataState, rootFields, fetchData, createDataState, fetchDiscover, addKPI, buildKPIMeasures } from '@progress/kendo-pivotgrid-common';
11
11
  export { averageAggregate, maxAggregate, minAggregate, sumAggregate } from '@progress/kendo-pivotgrid-common';
12
- import { BehaviorSubject, Subscription, fromEvent } from 'rxjs';
13
- import { merge } from 'rxjs/operators';
14
- import * as i2 from '@angular/common';
12
+ import { BehaviorSubject, Subscription, from, of, fromEvent } from 'rxjs';
13
+ import { mergeMap, merge } from 'rxjs/operators';
14
+ import * as i2 from '@progress/kendo-angular-l10n';
15
+ import { ComponentMessages, LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
16
+ import * as i6 from '@angular/common';
15
17
  import { CommonModule } from '@angular/common';
16
- import * as i4 from '@progress/kendo-angular-indicators';
18
+ import * as i5$1 from '@progress/kendo-angular-indicators';
17
19
  import { IndicatorsModule } from '@progress/kendo-angular-indicators';
18
- import { L10N_PREFIX } from '@progress/kendo-angular-l10n';
20
+ import * as i4 from '@progress/kendo-angular-treeview';
21
+ import { TreeViewModule } from '@progress/kendo-angular-treeview';
22
+ import * as i5 from '@progress/kendo-angular-buttons';
23
+ import { ButtonsModule } from '@progress/kendo-angular-buttons';
24
+ import * as i7 from '@progress/kendo-angular-inputs';
25
+ import { InputsModule } from '@progress/kendo-angular-inputs';
26
+ import { __awaiter } from 'tslib';
19
27
 
20
28
  /**
21
29
  * @hidden
@@ -24,7 +32,7 @@ const packageMetadata = {
24
32
  name: '@progress/kendo-angular-pivotgrid',
25
33
  productName: 'Kendo UI for Angular',
26
34
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
27
- publishDate: 1660825955,
35
+ publishDate: 1661413588,
28
36
  version: '',
29
37
  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'
30
38
  };
@@ -91,6 +99,54 @@ const syncWheel = (event, tables, prop, axis) => {
91
99
  tables[1][prop] += delta;
92
100
  }
93
101
  };
102
+ /**
103
+ * @hidden
104
+ */
105
+ function cloneTo(obj, result) {
106
+ for (let field in obj) {
107
+ if (obj.hasOwnProperty(field)) {
108
+ const value = obj[field];
109
+ if (Array.isArray(value)) {
110
+ result[field] = value.slice(0);
111
+ }
112
+ else if (value && typeof value === 'object' && !(value instanceof Date)) {
113
+ result[field] = result[field] || {};
114
+ cloneTo(value, result[field]);
115
+ }
116
+ else {
117
+ result[field] = value;
118
+ }
119
+ }
120
+ }
121
+ }
122
+ /**
123
+ * @hidden
124
+ */
125
+ function clone(obj) {
126
+ const result = {};
127
+ cloneTo(obj, result);
128
+ return result;
129
+ }
130
+ /**
131
+ * @hidden
132
+ */
133
+ const getDocument = element => element.ownerDocument.documentElement;
134
+ /**
135
+ * @hidden
136
+ */
137
+ const getWindow = element => element.ownerDocument.defaultView;
138
+ /**
139
+ * @hidden
140
+ */
141
+ const offset = element => {
142
+ const { clientTop, clientLeft } = getDocument(element);
143
+ const { pageYOffset, pageXOffset } = getWindow(element);
144
+ const { top, left } = element.getBoundingClientRect();
145
+ return {
146
+ top: top + pageYOffset - clientTop,
147
+ left: left + pageXOffset - clientLeft
148
+ };
149
+ };
94
150
  /**
95
151
  * @hidden
96
152
  */
@@ -114,6 +170,17 @@ const matchAriaAttributes = (wrapper) => {
114
170
  cell.setAttribute('aria-describedby', colHeaderCellsIds.join(' '));
115
171
  });
116
172
  };
173
+ /**
174
+ * @hidden
175
+ */
176
+ const position = (target, before) => {
177
+ const targetRect = offset(target);
178
+ const { offsetWidth, offsetHeight } = target;
179
+ const left = targetRect.left + (before ? 0 : offsetWidth);
180
+ const top = targetRect.top + offsetHeight / 2;
181
+ const height = offsetHeight;
182
+ return { left, top, height };
183
+ };
117
184
  /**
118
185
  * @hidden
119
186
  */
@@ -130,12 +197,16 @@ class PivotGridDataService {
130
197
  constructor(ngZone) {
131
198
  this.ngZone = ngZone;
132
199
  this.expandedStateChange = new EventEmitter();
200
+ this.configuratorFieldChange = new EventEmitter();
201
+ this.expandedFieldChange = new EventEmitter();
133
202
  this.columnHeaderRows = new BehaviorSubject([]);
134
203
  this.columnHeaderCols = new BehaviorSubject([]);
135
204
  this.rowHeaderCols = new BehaviorSubject([]);
136
205
  this.rowHeaderRows = new BehaviorSubject([]);
137
206
  this.valuesRows = new BehaviorSubject([]);
138
207
  this.loading = new BehaviorSubject(false);
208
+ this.fields = new BehaviorSubject([]);
209
+ this.configuredFields = new BehaviorSubject([]);
139
210
  this.pivotGridId = nextPivotGridId++;
140
211
  }
141
212
  updateRowsAndCols() {
@@ -165,6 +236,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
165
236
  type: Injectable
166
237
  }], ctorParameters: function () { return [{ type: i0.NgZone }]; }, propDecorators: { expandedStateChange: [{
167
238
  type: Output
239
+ }], configuratorFieldChange: [{
240
+ type: Output
241
+ }], expandedFieldChange: [{
242
+ type: Output
168
243
  }] } });
169
244
 
170
245
  /**
@@ -220,7 +295,7 @@ PivotGridCellDirective.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
220
295
  [ngClass]="{
221
296
  'k-i-arrow-chevron-up': expanded,
222
297
  'k-i-arrow-chevron-down': !expanded
223
- }"></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"] }] });
298
+ }"></span>{{ kendoPivotGridCell.data ? kendoPivotGridCell.data.fmtValue : kendoPivotGridCell.caption }}`, isInline: true, directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
224
299
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridCellDirective, decorators: [{
225
300
  type: Component,
226
301
  args: [{
@@ -309,7 +384,7 @@ PivotGridTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0"
309
384
  </tr>
310
385
  </tbody>
311
386
  </table>
312
- `, isInline: true, components: [{ type: PivotGridCellDirective, selector: "[kendoPivotGridCell]", inputs: ["kendoPivotGridCell", "tableType", "rowIndex", "colIndex"] }], directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
387
+ `, isInline: true, components: [{ type: PivotGridCellDirective, selector: "[kendoPivotGridCell]", inputs: ["kendoPivotGridCell", "tableType", "rowIndex", "colIndex"] }], directives: [{ type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
313
388
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridTableComponent, decorators: [{
314
389
  type: Component,
315
390
  args: [{
@@ -357,19 +432,849 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
357
432
  type: Input
358
433
  }] } });
359
434
 
435
+ /**
436
+ * @hidden
437
+ */
438
+ class ConfiguratorService {
439
+ constructor() {
440
+ this.configuratorStateChange = new EventEmitter();
441
+ }
442
+ parseConfiguratorState(action) {
443
+ const newState = configuratorReducer({
444
+ filter: [],
445
+ sort: [],
446
+ rowAxes: this.state.rowAxes,
447
+ columnAxes: this.state.columnAxes,
448
+ measureAxes: this.state.measureAxes,
449
+ dragItem: this.state.dragItem,
450
+ dropDirection: this.state.dropDirection,
451
+ dropTarget: this.state.dropTarget,
452
+ dropZone: this.state.dropZone
453
+ }, action);
454
+ Object.keys(newState).forEach(key => newState[key] === undefined && delete newState[key]);
455
+ this.state = Object.assign(Object.assign({}, this.state), newState);
456
+ this.configuratorStateChange.emit(this.state);
457
+ }
458
+ }
459
+ ConfiguratorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ConfiguratorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
460
+ ConfiguratorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ConfiguratorService });
461
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ConfiguratorService, decorators: [{
462
+ type: Injectable
463
+ }], propDecorators: { configuratorStateChange: [{
464
+ type: Output
465
+ }] } });
466
+
467
+ /**
468
+ * @hidden
469
+ */
470
+ const append = (element) => {
471
+ let appended = false;
472
+ return () => {
473
+ if (!appended) {
474
+ document.body.appendChild(element);
475
+ appended = true;
476
+ }
477
+ return element;
478
+ };
479
+ };
480
+ /**
481
+ * @hidden
482
+ */
483
+ class DropCueService {
484
+ create() {
485
+ this.dom = document.createElement('span');
486
+ this.dom.style.position = 'absolute';
487
+ const wrapper = document.createElement('div');
488
+ wrapper.classList.add('k-drop-hint', 'k-drop-hint-v');
489
+ const hintStart = document.createElement('div');
490
+ hintStart.classList.add('k-drop-hint-start');
491
+ const hintLine = document.createElement('div');
492
+ hintLine.classList.add('k-drop-hint-line');
493
+ const hintEnd = document.createElement('div');
494
+ hintEnd.classList.add('k-drop-hint-end');
495
+ wrapper.append(hintStart, hintLine, hintEnd);
496
+ this.dom.append(wrapper);
497
+ this.hide();
498
+ }
499
+ attach() {
500
+ return append(this.dom)();
501
+ }
502
+ remove() {
503
+ if (this.dom && this.dom.parentElement) {
504
+ document.body.removeChild(this.dom);
505
+ this.dom = null;
506
+ }
507
+ }
508
+ hide() {
509
+ this.dom.style.display = "none";
510
+ }
511
+ position({ left, top, height }) {
512
+ this.dom.style.display = 'block';
513
+ this.dom.style.height = height + 'px';
514
+ this.dom.style.top = top + 'px';
515
+ this.dom.style.zIndex = '1000';
516
+ const width = this.dom.offsetWidth / 2;
517
+ this.dom.style.left = left - width + 'px';
518
+ }
519
+ }
520
+ DropCueService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropCueService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
521
+ DropCueService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropCueService });
522
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropCueService, decorators: [{
523
+ type: Injectable
524
+ }] });
525
+
526
+ /**
527
+ * @hidden
528
+ */
529
+ class DropTargetDirective {
530
+ constructor(element, configuratorService, cue, renderer, zone) {
531
+ this.element = element;
532
+ this.configuratorService = configuratorService;
533
+ this.cue = cue;
534
+ this.renderer = renderer;
535
+ this.zone = zone;
536
+ this.subs = new Subscription();
537
+ }
538
+ ngOnInit() {
539
+ const element = this.element.nativeElement;
540
+ this.elementType = element.nodeName === 'KENDO-CHIP' ? 'chip' : 'container';
541
+ this.zone.runOutsideAngular(() => {
542
+ this.subs.add(this.renderer.listen(element, 'mouseenter', this.handleMouseEnter.bind(this)));
543
+ this.subs.add(this.renderer.listen(element, 'mousemove', this.handleMouseMove.bind(this)));
544
+ this.subs.add(this.renderer.listen(element, 'mouseleave', this.handleMouseLeave.bind(this)));
545
+ });
546
+ }
547
+ ngOnDestroy() {
548
+ this.subs.unsubscribe();
549
+ }
550
+ handleMouseEnter(event) {
551
+ if (this.configuratorService.state.dragItem) {
552
+ if (this.elementType === 'chip') {
553
+ this.configuratorService.parseConfiguratorState({ type: PIVOT_CONFIGURATOR_ACTION.setDropTarget, payload: this.item });
554
+ this.targetElement = event.target;
555
+ this.cue.position(position(event.target, this.configuratorService.state.dropDirection === 'before'));
556
+ }
557
+ this.configuratorService.parseConfiguratorState({ type: PIVOT_CONFIGURATOR_ACTION.setDropZone, payload: this.axes });
558
+ }
559
+ }
560
+ handleMouseMove($event) {
561
+ if (this.configuratorService.state.dragItem) {
562
+ if (this.elementType !== 'chip') {
563
+ return;
564
+ }
565
+ if (this.element.nativeElement) {
566
+ const rect = this.element.nativeElement.getBoundingClientRect();
567
+ const x = $event.clientX - rect.left;
568
+ const direction = x < rect.width / 2 ? 'before' : 'after';
569
+ if ((direction !== this.configuratorService.state.dropDirection) && this.targetElement) {
570
+ this.cue.position(position(this.targetElement, direction === 'before'));
571
+ }
572
+ this.configuratorService.parseConfiguratorState({ type: PIVOT_CONFIGURATOR_ACTION.setDropDirection, payload: direction });
573
+ }
574
+ }
575
+ }
576
+ handleMouseLeave() {
577
+ if (this.elementType === 'chip') {
578
+ return;
579
+ }
580
+ if (this.configuratorService.state.dragItem) {
581
+ this.configuratorService.parseConfiguratorState({ type: PIVOT_CONFIGURATOR_ACTION.setDropZone, payload: null });
582
+ }
583
+ }
584
+ }
585
+ DropTargetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropTargetDirective, deps: [{ token: i0.ElementRef }, { token: ConfiguratorService }, { token: DropCueService }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
586
+ DropTargetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DropTargetDirective, selector: "[kendoDropTarget]", inputs: { item: "item", axes: "axes" }, ngImport: i0 });
587
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropTargetDirective, decorators: [{
588
+ type: Directive,
589
+ args: [{
590
+ selector: '[kendoDropTarget]'
591
+ }]
592
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ConfiguratorService }, { type: DropCueService }, { type: i0.Renderer2 }, { type: i0.NgZone }]; }, propDecorators: { item: [{
593
+ type: Input
594
+ }], axes: [{
595
+ type: Input
596
+ }] } });
597
+
598
+ /**
599
+ * @hidden
600
+ */
601
+ class DraggableChipDirective {
602
+ constructor(draggable, element, zone, service, cue) {
603
+ this.draggable = draggable;
604
+ this.element = element;
605
+ this.zone = zone;
606
+ this.service = service;
607
+ this.cue = cue;
608
+ this.touchActions = 'none';
609
+ this.initialX = {};
610
+ this.initialY = {};
611
+ this.subs = new Subscription();
612
+ }
613
+ get pointerEvents() {
614
+ return this.drag ? 'none' : undefined;
615
+ }
616
+ ngOnInit() {
617
+ this.zone.runOutsideAngular(() => this.subs.add(this.draggable.kendoPress
618
+ .subscribe((event) => {
619
+ if (isDocumentAvailable()) {
620
+ this.cue.create();
621
+ this.cue.attach();
622
+ this.initialX.current = event.clientX;
623
+ this.initialY.current = event.clientY;
624
+ }
625
+ })));
626
+ this.zone.runOutsideAngular(() => this.subs.add(this.draggable.kendoDrag
627
+ .subscribe((event) => {
628
+ if (isDocumentAvailable()) {
629
+ if (Math.abs(this.initialX.current - event.clientX) < 10 &&
630
+ Math.abs(this.initialY.current - event.clientY) < 10) {
631
+ return;
632
+ }
633
+ if (this.element.nativeElement) {
634
+ this.element.nativeElement.style.transform = `translate(${event.clientX - this.initialX.current}px, ${event.clientY - this.initialY.current}px)`;
635
+ }
636
+ }
637
+ this.drag = true;
638
+ this.service.parseConfiguratorState({ type: PIVOT_CONFIGURATOR_ACTION.setDragItem, payload: this.item });
639
+ })));
640
+ this.zone.runOutsideAngular(() => this.subs.add(this.draggable.kendoRelease
641
+ .subscribe(() => {
642
+ this.drag = false;
643
+ if (this.service.state.dragItem) {
644
+ if (isDocumentAvailable()) {
645
+ if (this.element.nativeElement) {
646
+ this.element.nativeElement.style.transform = '';
647
+ }
648
+ this.cue.remove();
649
+ }
650
+ this.service.parseConfiguratorState({ type: PIVOT_CONFIGURATOR_ACTION.drop, payload: this.item });
651
+ this.service.state.dragItem = null;
652
+ this.service.state.dropDirection = null;
653
+ this.service.state.dropTarget = null;
654
+ this.service.state.dropZone = null;
655
+ }
656
+ })));
657
+ }
658
+ ngOnDestroy() {
659
+ this.subs.unsubscribe();
660
+ }
661
+ }
662
+ DraggableChipDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DraggableChipDirective, deps: [{ token: i3.DraggableDirective, optional: true }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: ConfiguratorService }, { token: DropCueService }], target: i0.ɵɵFactoryTarget.Directive });
663
+ DraggableChipDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DraggableChipDirective, selector: "[kendoChipDraggable]", inputs: { item: "item" }, host: { properties: { "style.pointerEvents": "this.pointerEvents", "style.touch-action": "this.touchActions" } }, ngImport: i0 });
664
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DraggableChipDirective, decorators: [{
665
+ type: Directive,
666
+ args: [{
667
+ selector: '[kendoChipDraggable]'
668
+ }]
669
+ }], ctorParameters: function () { return [{ type: i3.DraggableDirective, decorators: [{
670
+ type: Optional
671
+ }] }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: ConfiguratorService }, { type: DropCueService }]; }, propDecorators: { pointerEvents: [{
672
+ type: HostBinding,
673
+ args: ['style.pointerEvents']
674
+ }], touchActions: [{
675
+ type: HostBinding,
676
+ args: ['style.touch-action']
677
+ }], item: [{
678
+ type: Input
679
+ }] } });
680
+
681
+ /**
682
+ * @hidden
683
+ * Represents the Kendo UI PivotGrid Configurator component for Angular.
684
+ */
685
+ class PivotGridConfiguratorComponent {
686
+ constructor(dataService, localization, configuratorService, cdr) {
687
+ this.dataService = dataService;
688
+ this.localization = localization;
689
+ this.configuratorService = configuratorService;
690
+ this.cdr = cdr;
691
+ this.hostClass = true;
692
+ this.horizontal = false;
693
+ this.checked = [];
694
+ this.subs = new Subscription();
695
+ /**
696
+ * A function which determines if a specific node has child nodes.
697
+ */
698
+ this.hasChildren = (node) => !('hierarchyUniqueName' in node) && !('aggregator' in node);
699
+ /**
700
+ * A function which provides the child nodes for a given parent node.
701
+ */
702
+ this.children = (node) => {
703
+ if (this.dataService.directive.type === 'olap') {
704
+ const observable = from(this.dataService.directive.fetchChildren(node, this.fields));
705
+ return observable.pipe(mergeMap(value => of(value)));
706
+ }
707
+ return of(node.children);
708
+ };
709
+ }
710
+ ngOnInit() {
711
+ this.subs.add(this.dataService.fields
712
+ .subscribe(res => {
713
+ this.fields = res;
714
+ }));
715
+ this.subs.add(this.dataService.configuredFields
716
+ .subscribe(res => {
717
+ this.originalState = clone(res);
718
+ this.setState(clone(res));
719
+ this.setChecked();
720
+ }));
721
+ this.subs.add(this.configuratorService.configuratorStateChange
722
+ .subscribe(res => {
723
+ this.state = res;
724
+ this.cdr.detectChanges();
725
+ }));
726
+ }
727
+ ngOnDestroy() {
728
+ this.subs.unsubscribe();
729
+ }
730
+ getName(name) {
731
+ return name.toString();
732
+ }
733
+ setState(state) {
734
+ this.state = state;
735
+ this.configuratorService.state = state;
736
+ }
737
+ /**
738
+ * Returns the localized message for a given token
739
+ */
740
+ messageFor(localizationToken) {
741
+ return this.localization.get(localizationToken);
742
+ }
743
+ /**
744
+ * Retrieves the 'Columns' section item names
745
+ */
746
+ get columnHierarchies() {
747
+ return this.extractDefaultFields(this.state.columnAxes);
748
+ }
749
+ ;
750
+ /**
751
+ * Retrieves the 'Rows' section item names
752
+ */
753
+ get rowHierarchies() {
754
+ return this.extractDefaultFields(this.state.rowAxes);
755
+ }
756
+ ;
757
+ /**
758
+ * Retrieves the 'Value' section item names
759
+ */
760
+ get measureHierarchies() {
761
+ return this.extractDefaultFields(this.state.measureAxes);
762
+ }
763
+ ;
764
+ /**
765
+ * Constructs an array with all selected fields.
766
+ * @param fields - used for when child nodes are loaded on demand.
767
+ * Child nodes are concatinated to the root level nodes.
768
+ */
769
+ setChecked(fields = []) {
770
+ const allFields = [...this.fields, ...fields];
771
+ const checked = this.getFieldsFlatMap(allFields).filter((f) => [
772
+ ...this.columnHierarchies,
773
+ ...this.rowHierarchies,
774
+ ...this.measureHierarchies
775
+ ].some((h) => (h === f.uniqueName || h === f.defaultHierarchy)));
776
+ this.checked = checked;
777
+ }
778
+ /**
779
+ * A function which determines if a specific node is checked/
780
+ */
781
+ isItemChecked(node) {
782
+ var _a, _b;
783
+ const res = this.checked.some(s => node.defaultHierarchy
784
+ ? s.defaultHierarchy === node.defaultHierarchy
785
+ : s.uniqueName === node.uniqueName)
786
+ || (((_a = node.children) === null || _a === void 0 ? void 0 : _a.length) && ((_b = node.children) === null || _b === void 0 ? void 0 : _b.every((c) => c.checked)));
787
+ return res || null;
788
+ }
789
+ /**
790
+ * Determines if a checkbox should be rendered.
791
+ */
792
+ isSelectable(node) {
793
+ const hasChildren = !('hierarchyUniqueName' in node) && !('aggregator' in node);
794
+ return !Boolean((!hasChildren && !node.aggregator && !node.measure)
795
+ || (node.type === 2)
796
+ || node.uniqueName === '[KPIs]');
797
+ }
798
+ /**
799
+ * Check if the newly loaded child nodes have checked items.
800
+ * (Only for OLAP data-binding directive)
801
+ */
802
+ handleChildrenLoaded(event) {
803
+ if (this.dataService.directive.type === 'local') {
804
+ return;
805
+ }
806
+ const fields = event.children.map(item => item.dataItem);
807
+ this.setChecked(fields);
808
+ }
809
+ handleCheckedChange(event, item) {
810
+ if (event.target.checked) {
811
+ this.checked = [...this.checked, item];
812
+ }
813
+ else {
814
+ const itemIndex = this.checked.findIndex(checkedItem => checkedItem.uniqueName === item.uniqueName);
815
+ this.checked.splice(itemIndex, 1);
816
+ }
817
+ const action = {
818
+ type: 'PIVOT_CONFIGURATOR_ACTION_TOGGLE_SELECTION',
819
+ payload: item
820
+ };
821
+ this.configuratorService.parseConfiguratorState(action);
822
+ }
823
+ handleSubmit() {
824
+ this.dataService.configuratorFieldChange.emit(this.state);
825
+ }
826
+ /**
827
+ * Reset the configurator to the last saved state
828
+ */
829
+ handleReset() {
830
+ this.setState(clone(this.originalState));
831
+ this.setChecked();
832
+ }
833
+ /**
834
+ * Flattens all available fields.
835
+ */
836
+ getFieldsFlatMap(nodes = []) {
837
+ let result = [...nodes];
838
+ (nodes || []).forEach((child) => {
839
+ result = result.concat(this.getFieldsFlatMap(child.children));
840
+ });
841
+ return result;
842
+ }
843
+ /**
844
+ * Creates an array containing only the field names, e.g. '[Date].[Calendar]' or 'Product'
845
+ */
846
+ extractDefaultFields(columns = []) {
847
+ const result = new Set();
848
+ columns.forEach((column) => {
849
+ result.add(String(column.name));
850
+ });
851
+ return Array.from(result);
852
+ }
853
+ ;
854
+ }
855
+ PivotGridConfiguratorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridConfiguratorComponent, deps: [{ token: PivotGridDataService }, { token: i2.LocalizationService }, { token: ConfiguratorService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
856
+ PivotGridConfiguratorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: PivotGridConfiguratorComponent, selector: "kendo-pivotgrid-configurator", inputs: { horizontal: "horizontal" }, host: { properties: { "class.k-pivotgrid-configurator": "this.hostClass" } }, providers: [
857
+ ConfiguratorService,
858
+ DropCueService
859
+ ], ngImport: i0, template: `
860
+ <div
861
+ class="k-pivotgrid-configurator-panel k-pivotgrid-configurator-push"
862
+ [ngClass]="{
863
+ 'k-pivotgrid-configurator-horizontal': horizontal,
864
+ 'k-pivotgrid-configurator-vertical': !horizontal
865
+ }"
866
+ >
867
+ <div class="k-pivotgrid-configurator-header">
868
+ <div class="k-pivotgrid-configurator-header-text">{{messageFor('configuratorHeaderText')}}</div>
869
+ </div>
870
+
871
+ <div class="k-pivotgrid-configurator-content">
872
+ <div class="k-form" [class.k-form-horizontal]="horizontal">
873
+ <div class="k-form-field-wrapper">
874
+ <div class="k-form-field">
875
+ <span class="k-label">{{messageFor('configuratorFieldsText')}}</span>
876
+ </div>
877
+
878
+ <div class="k-form-field">
879
+ <div class="k-fields-list-wrapper">
880
+ <kendo-treeview
881
+ [nodes]="fields"
882
+ textField="caption"
883
+ [children]="children"
884
+ [hasChildren]="hasChildren"
885
+ kendoTreeViewExpandable
886
+ (childrenLoaded)="handleChildrenLoaded($event)"
887
+ >
888
+ <ng-template kendoTreeViewNodeTemplate let-dataItem>
889
+ <input kendoCheckBox
890
+ *ngIf="isSelectable(dataItem)"
891
+ type="checkbox"
892
+ kendoCheckBox
893
+ [checked]="isItemChecked(dataItem)"
894
+ (change)="handleCheckedChange($event, dataItem)"/>
895
+ {{ dataItem.caption }}
896
+ </ng-template>
897
+ </kendo-treeview>
898
+
899
+ </div>
900
+ </div>
901
+ </div>
902
+
903
+ <div *ngIf="horizontal; else verticalTemplate" class="k-form-field-wrapper">
904
+ <ng-container *ngTemplateOutlet="verticalTemplate"></ng-container>
905
+ </div>
906
+
907
+ <ng-template #verticalTemplate>
908
+ <div class="k-form-field" kendoDropTarget axes="columnAxes">
909
+ <span class="k-label">{{messageFor('configuratorColumnsText')}}</span>
910
+ </div>
911
+
912
+ <kendo-chiplist
913
+ *ngIf="state.columnAxes && state.columnAxes.length; else noColumnAxes"
914
+ kendoDropTarget
915
+ axes="columnAxes"
916
+ >
917
+ <kendo-chip *ngFor="let item of state.columnAxes"
918
+ kendoChipDraggable
919
+ kendoDraggable
920
+ kendoDropTarget
921
+ [item]="item"
922
+ axes="columnAxes"
923
+ rounded="full"
924
+ [removable]="true"
925
+ >
926
+ {{ getName(item.name) }}
927
+ </kendo-chip>
928
+ </kendo-chiplist>
929
+
930
+ <ng-template #noColumnAxes>
931
+ <div class="k-settings-description" kendoDropTarget axes="columnAxes">{{messageFor('configuratorEmptyColumnsText')}}</div>
932
+ </ng-template>
933
+
934
+ <div class="k-form-field" kendoDropTarget axes="rowAxes">
935
+ <span class="k-label">{{messageFor('configuratorRowsText')}}</span>
936
+ </div>
937
+
938
+ <kendo-chiplist
939
+ *ngIf="state.rowAxes && state.rowAxes.length; else noRowAxes"
940
+ kendoDropTarget
941
+ axes="rowAxes"
942
+ >
943
+ <kendo-chip *ngFor="let item of state.rowAxes"
944
+ kendoChipDraggable
945
+ kendoDraggable
946
+ kendoDropTarget
947
+ [item]="item"
948
+ axes="rowAxes"
949
+ rounded="full"
950
+ [removable]="true"
951
+ >
952
+ {{ getName(item.name) }}
953
+ </kendo-chip>
954
+ </kendo-chiplist>
955
+
956
+ <ng-template #noRowAxes>
957
+ <div class="k-settings-description" kendoDropTarget axes="rowAxes">{{messageFor('configuratorEmptyRowsText')}}</div>
958
+ </ng-template>
959
+ </ng-template>
960
+
961
+ <div *ngIf="horizontal; else elseTpl2" class="k-form-field-wrapper">
962
+ <ng-container *ngTemplateOutlet="elseTpl2"></ng-container>
963
+ </div>
964
+
965
+ <ng-template #elseTpl2>
966
+ <div class="k-form-field" kendoDropTarget axes="measureAxes">
967
+ <span class="k-label">{{messageFor('configuratorValuesText')}}</span>
968
+ </div>
969
+
970
+ <kendo-chiplist
971
+ *ngIf="state.measureAxes && state.measureAxes.length; else noMeasureAxes"
972
+ kendoDropTarget
973
+ axes="measureAxes"
974
+ >
975
+ <kendo-chip *ngFor="let item of state.measureAxes"
976
+ kendoChipDraggable
977
+ kendoDraggable
978
+ kendoDropTarget
979
+ [item]="item"
980
+ axes="measureAxes"
981
+
982
+ rounded="full"
983
+ [removable]="true"
984
+ >
985
+ {{ getName(item.name) }}
986
+ </kendo-chip>
987
+ </kendo-chiplist>
988
+
989
+ <ng-template #noMeasureAxes>
990
+ <div class="k-settings-description" kendoDropTarget axes="measureAxes">{{messageFor('configuratorEmptyMeasuresText')}}</div>
991
+ </ng-template>
992
+ </ng-template>
993
+
994
+ </div>
995
+ </div>
996
+ <div class="k-pivotgrid-configurator-actions k-actions k-hstack k-justify-content-end">
997
+ <button kendoButton type="button" (click)="handleReset()">{{messageFor('configuratorCancelButtonText')}}</button>
998
+ <button kendoButton themeColor="primary" type="button" (click)="handleSubmit()">{{messageFor('configuratorApplyButtonText')}}</button>
999
+ </div>
1000
+ </div>
1001
+ `, isInline: true, components: [{ type: i4.TreeViewComponent, selector: "kendo-treeview", inputs: ["filterInputPlaceholder", "expandDisabledNodes", "animate", "nodeTemplate", "loadMoreButtonTemplate", "trackBy", "nodes", "textField", "hasChildren", "isChecked", "isDisabled", "isExpanded", "isSelected", "isVisible", "navigable", "children", "loadOnDemand", "filterable", "filter", "size", "disableParentNodesOnly"], outputs: ["childrenLoaded", "blur", "focus", "expand", "collapse", "nodeDragStart", "nodeDrag", "filterStateChange", "nodeDrop", "nodeDragEnd", "addItem", "removeItem", "checkedChange", "selectionChange", "filterChange", "nodeClick", "nodeDblClick"], exportAs: ["kendoTreeView"] }, { type: i5.ChipListComponent, selector: "kendo-chiplist, kendo-chip-list", inputs: ["selection", "size"], outputs: ["selectedChange", "remove"] }, { type: i5.ChipComponent, selector: "kendo-chip", inputs: ["label", "icon", "iconClass", "avatarClass", "selected", "removable", "removeIcon", "disabled", "size", "rounded", "fillMode", "themeColor"], outputs: ["remove", "contentClick"] }], directives: [{ type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4.ExpandDirective, selector: "[kendoTreeViewExpandable]", inputs: ["isExpanded", "expandBy", "expandOnFilter", "expandedKeys"], outputs: ["expandedKeysChange"] }, { type: i4.NodeTemplateDirective, selector: "[kendoTreeViewNodeTemplate]" }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.CheckBoxDirective, selector: "input[kendoCheckBox]", inputs: ["size", "rounded"] }, { type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: DropTargetDirective, selector: "[kendoDropTarget]", inputs: ["item", "axes"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: DraggableChipDirective, selector: "[kendoChipDraggable]", inputs: ["item"] }, { type: i3.DraggableDirective, selector: "[kendoDraggable]", inputs: ["enableDrag"], outputs: ["kendoPress", "kendoDrag", "kendoRelease"] }, { type: i5.ButtonDirective, selector: "button[kendoButton], span[kendoButton]", inputs: ["toggleable", "togglable", "selected", "tabIndex", "icon", "iconClass", "imageUrl", "disabled", "size", "rounded", "fillMode", "themeColor", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }] });
1002
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridConfiguratorComponent, decorators: [{
1003
+ type: Component,
1004
+ args: [{
1005
+ selector: 'kendo-pivotgrid-configurator',
1006
+ providers: [
1007
+ ConfiguratorService,
1008
+ DropCueService
1009
+ ],
1010
+ template: `
1011
+ <div
1012
+ class="k-pivotgrid-configurator-panel k-pivotgrid-configurator-push"
1013
+ [ngClass]="{
1014
+ 'k-pivotgrid-configurator-horizontal': horizontal,
1015
+ 'k-pivotgrid-configurator-vertical': !horizontal
1016
+ }"
1017
+ >
1018
+ <div class="k-pivotgrid-configurator-header">
1019
+ <div class="k-pivotgrid-configurator-header-text">{{messageFor('configuratorHeaderText')}}</div>
1020
+ </div>
1021
+
1022
+ <div class="k-pivotgrid-configurator-content">
1023
+ <div class="k-form" [class.k-form-horizontal]="horizontal">
1024
+ <div class="k-form-field-wrapper">
1025
+ <div class="k-form-field">
1026
+ <span class="k-label">{{messageFor('configuratorFieldsText')}}</span>
1027
+ </div>
1028
+
1029
+ <div class="k-form-field">
1030
+ <div class="k-fields-list-wrapper">
1031
+ <kendo-treeview
1032
+ [nodes]="fields"
1033
+ textField="caption"
1034
+ [children]="children"
1035
+ [hasChildren]="hasChildren"
1036
+ kendoTreeViewExpandable
1037
+ (childrenLoaded)="handleChildrenLoaded($event)"
1038
+ >
1039
+ <ng-template kendoTreeViewNodeTemplate let-dataItem>
1040
+ <input kendoCheckBox
1041
+ *ngIf="isSelectable(dataItem)"
1042
+ type="checkbox"
1043
+ kendoCheckBox
1044
+ [checked]="isItemChecked(dataItem)"
1045
+ (change)="handleCheckedChange($event, dataItem)"/>
1046
+ {{ dataItem.caption }}
1047
+ </ng-template>
1048
+ </kendo-treeview>
1049
+
1050
+ </div>
1051
+ </div>
1052
+ </div>
1053
+
1054
+ <div *ngIf="horizontal; else verticalTemplate" class="k-form-field-wrapper">
1055
+ <ng-container *ngTemplateOutlet="verticalTemplate"></ng-container>
1056
+ </div>
1057
+
1058
+ <ng-template #verticalTemplate>
1059
+ <div class="k-form-field" kendoDropTarget axes="columnAxes">
1060
+ <span class="k-label">{{messageFor('configuratorColumnsText')}}</span>
1061
+ </div>
1062
+
1063
+ <kendo-chiplist
1064
+ *ngIf="state.columnAxes && state.columnAxes.length; else noColumnAxes"
1065
+ kendoDropTarget
1066
+ axes="columnAxes"
1067
+ >
1068
+ <kendo-chip *ngFor="let item of state.columnAxes"
1069
+ kendoChipDraggable
1070
+ kendoDraggable
1071
+ kendoDropTarget
1072
+ [item]="item"
1073
+ axes="columnAxes"
1074
+ rounded="full"
1075
+ [removable]="true"
1076
+ >
1077
+ {{ getName(item.name) }}
1078
+ </kendo-chip>
1079
+ </kendo-chiplist>
1080
+
1081
+ <ng-template #noColumnAxes>
1082
+ <div class="k-settings-description" kendoDropTarget axes="columnAxes">{{messageFor('configuratorEmptyColumnsText')}}</div>
1083
+ </ng-template>
1084
+
1085
+ <div class="k-form-field" kendoDropTarget axes="rowAxes">
1086
+ <span class="k-label">{{messageFor('configuratorRowsText')}}</span>
1087
+ </div>
1088
+
1089
+ <kendo-chiplist
1090
+ *ngIf="state.rowAxes && state.rowAxes.length; else noRowAxes"
1091
+ kendoDropTarget
1092
+ axes="rowAxes"
1093
+ >
1094
+ <kendo-chip *ngFor="let item of state.rowAxes"
1095
+ kendoChipDraggable
1096
+ kendoDraggable
1097
+ kendoDropTarget
1098
+ [item]="item"
1099
+ axes="rowAxes"
1100
+ rounded="full"
1101
+ [removable]="true"
1102
+ >
1103
+ {{ getName(item.name) }}
1104
+ </kendo-chip>
1105
+ </kendo-chiplist>
1106
+
1107
+ <ng-template #noRowAxes>
1108
+ <div class="k-settings-description" kendoDropTarget axes="rowAxes">{{messageFor('configuratorEmptyRowsText')}}</div>
1109
+ </ng-template>
1110
+ </ng-template>
1111
+
1112
+ <div *ngIf="horizontal; else elseTpl2" class="k-form-field-wrapper">
1113
+ <ng-container *ngTemplateOutlet="elseTpl2"></ng-container>
1114
+ </div>
1115
+
1116
+ <ng-template #elseTpl2>
1117
+ <div class="k-form-field" kendoDropTarget axes="measureAxes">
1118
+ <span class="k-label">{{messageFor('configuratorValuesText')}}</span>
1119
+ </div>
1120
+
1121
+ <kendo-chiplist
1122
+ *ngIf="state.measureAxes && state.measureAxes.length; else noMeasureAxes"
1123
+ kendoDropTarget
1124
+ axes="measureAxes"
1125
+ >
1126
+ <kendo-chip *ngFor="let item of state.measureAxes"
1127
+ kendoChipDraggable
1128
+ kendoDraggable
1129
+ kendoDropTarget
1130
+ [item]="item"
1131
+ axes="measureAxes"
1132
+
1133
+ rounded="full"
1134
+ [removable]="true"
1135
+ >
1136
+ {{ getName(item.name) }}
1137
+ </kendo-chip>
1138
+ </kendo-chiplist>
1139
+
1140
+ <ng-template #noMeasureAxes>
1141
+ <div class="k-settings-description" kendoDropTarget axes="measureAxes">{{messageFor('configuratorEmptyMeasuresText')}}</div>
1142
+ </ng-template>
1143
+ </ng-template>
1144
+
1145
+ </div>
1146
+ </div>
1147
+ <div class="k-pivotgrid-configurator-actions k-actions k-hstack k-justify-content-end">
1148
+ <button kendoButton type="button" (click)="handleReset()">{{messageFor('configuratorCancelButtonText')}}</button>
1149
+ <button kendoButton themeColor="primary" type="button" (click)="handleSubmit()">{{messageFor('configuratorApplyButtonText')}}</button>
1150
+ </div>
1151
+ </div>
1152
+ `
1153
+ }]
1154
+ }], ctorParameters: function () { return [{ type: PivotGridDataService }, { type: i2.LocalizationService }, { type: ConfiguratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { hostClass: [{
1155
+ type: HostBinding,
1156
+ args: ['class.k-pivotgrid-configurator']
1157
+ }], horizontal: [{
1158
+ type: Input
1159
+ }] } });
1160
+
1161
+ /**
1162
+ * @hidden
1163
+ */
1164
+ class PivotGridMessages extends ComponentMessages {
1165
+ }
1166
+ PivotGridMessages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridMessages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1167
+ PivotGridMessages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: PivotGridMessages, inputs: { fieldMenuFilterItemLabel: "fieldMenuFilterItemLabel", fieldMenuSortAscendingItemLabel: "fieldMenuSortAscendingItemLabel", fieldMenuSortDescendingItemLabel: "fieldMenuSortDescendingItemLabel", filterInputLabel: "filterInputLabel", filterOperatorsDropDownLabel: "filterOperatorsDropDownLabel", filterEqOperator: "filterEqOperator", filterNotEqOperator: "filterNotEqOperator", filterIsNullOperator: "filterIsNullOperator", filterIsNotNullOperator: "filterIsNotNullOperator", filterIsEmptyOperator: "filterIsEmptyOperator", filterIsNotEmptyOperator: "filterIsNotEmptyOperator", filterStartsWithOperator: "filterStartsWithOperator", filterContainsOperator: "filterContainsOperator", filterNotContainsOperator: "filterNotContainsOperator", filterEndsWithOperator: "filterEndsWithOperator", filterFilterButton: "filterFilterButton", filterClearButton: "filterClearButton", loading: "loading", emptyCellLabel: "emptyCellLabel", configuratorButtonText: "configuratorButtonText", configuratorHeaderText: "configuratorHeaderText", configuratorFieldsText: "configuratorFieldsText", configuratorColumnsText: "configuratorColumnsText", configuratorRowsText: "configuratorRowsText", configuratorValuesText: "configuratorValuesText", configuratorCancelButtonText: "configuratorCancelButtonText", configuratorApplyButtonText: "configuratorApplyButtonText", configuratorEmptyRowsText: "configuratorEmptyRowsText", configuratorEmptyColumnsText: "configuratorEmptyColumnsText", configuratorEmptyMeasuresText: "configuratorEmptyMeasuresText" }, usesInheritance: true, ngImport: i0 });
1168
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridMessages, decorators: [{
1169
+ type: Directive
1170
+ }], propDecorators: { fieldMenuFilterItemLabel: [{
1171
+ type: Input
1172
+ }], fieldMenuSortAscendingItemLabel: [{
1173
+ type: Input
1174
+ }], fieldMenuSortDescendingItemLabel: [{
1175
+ type: Input
1176
+ }], filterInputLabel: [{
1177
+ type: Input
1178
+ }], filterOperatorsDropDownLabel: [{
1179
+ type: Input
1180
+ }], filterEqOperator: [{
1181
+ type: Input
1182
+ }], filterNotEqOperator: [{
1183
+ type: Input
1184
+ }], filterIsNullOperator: [{
1185
+ type: Input
1186
+ }], filterIsNotNullOperator: [{
1187
+ type: Input
1188
+ }], filterIsEmptyOperator: [{
1189
+ type: Input
1190
+ }], filterIsNotEmptyOperator: [{
1191
+ type: Input
1192
+ }], filterStartsWithOperator: [{
1193
+ type: Input
1194
+ }], filterContainsOperator: [{
1195
+ type: Input
1196
+ }], filterNotContainsOperator: [{
1197
+ type: Input
1198
+ }], filterEndsWithOperator: [{
1199
+ type: Input
1200
+ }], filterFilterButton: [{
1201
+ type: Input
1202
+ }], filterClearButton: [{
1203
+ type: Input
1204
+ }], loading: [{
1205
+ type: Input
1206
+ }], emptyCellLabel: [{
1207
+ type: Input
1208
+ }], configuratorButtonText: [{
1209
+ type: Input
1210
+ }], configuratorHeaderText: [{
1211
+ type: Input
1212
+ }], configuratorFieldsText: [{
1213
+ type: Input
1214
+ }], configuratorColumnsText: [{
1215
+ type: Input
1216
+ }], configuratorRowsText: [{
1217
+ type: Input
1218
+ }], configuratorValuesText: [{
1219
+ type: Input
1220
+ }], configuratorCancelButtonText: [{
1221
+ type: Input
1222
+ }], configuratorApplyButtonText: [{
1223
+ type: Input
1224
+ }], configuratorEmptyRowsText: [{
1225
+ type: Input
1226
+ }], configuratorEmptyColumnsText: [{
1227
+ type: Input
1228
+ }], configuratorEmptyMeasuresText: [{
1229
+ type: Input
1230
+ }] } });
1231
+
1232
+ /**
1233
+ * @hidden
1234
+ */
1235
+ class LocalizedMessagesDirective extends PivotGridMessages {
1236
+ constructor(service) {
1237
+ super();
1238
+ this.service = service;
1239
+ }
1240
+ }
1241
+ LocalizedMessagesDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LocalizedMessagesDirective, deps: [{ token: i2.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
1242
+ LocalizedMessagesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: LocalizedMessagesDirective, selector: "[kendoPivotGridLocalizedMessages]", providers: [
1243
+ {
1244
+ provide: PivotGridMessages,
1245
+ useExisting: forwardRef(() => LocalizedMessagesDirective)
1246
+ }
1247
+ ], usesInheritance: true, ngImport: i0 });
1248
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LocalizedMessagesDirective, decorators: [{
1249
+ type: Directive,
1250
+ args: [{
1251
+ providers: [
1252
+ {
1253
+ provide: PivotGridMessages,
1254
+ useExisting: forwardRef(() => LocalizedMessagesDirective)
1255
+ }
1256
+ ],
1257
+ selector: '[kendoPivotGridLocalizedMessages]'
1258
+ }]
1259
+ }], ctorParameters: function () { return [{ type: i2.LocalizationService }]; } });
1260
+
360
1261
  const DEFAULT_LOADER_SETTINGS = {
361
1262
  type: 'converging-spinner',
362
1263
  themeColor: 'primary',
363
1264
  size: 'large'
364
1265
  };
1266
+ const DEFAULT_CONFIGURATOR_SETTINGS = {
1267
+ position: 'right',
1268
+ horizontal: false
1269
+ };
365
1270
  /**
366
1271
  * Represents the Kendo UI PivotGrid component for Angular.
367
1272
  */
368
1273
  class PivotGridComponent {
369
- constructor(hostEl, zone, dataService, _scrollbarWidthService) {
370
- this.hostEl = hostEl;
1274
+ constructor(hostEl, zone, dataService, localization, _scrollbarWidthService) {
371
1275
  this.zone = zone;
372
1276
  this.dataService = dataService;
1277
+ this.localization = localization;
373
1278
  this.hostClass = true;
374
1279
  this.ariaRole = 'grid';
375
1280
  /**
@@ -381,12 +1286,13 @@ class PivotGridComponent {
381
1286
  this.resizeObservers = [];
382
1287
  this._loaderSettings = DEFAULT_LOADER_SETTINGS;
383
1288
  this.subs = new Subscription();
1289
+ this.rtl = false;
384
1290
  this.resizeContainer = (axis, element) => {
385
1291
  const isRows = axis === 'Rows';
386
- const wrapper = this.hostEl.nativeElement;
1292
+ const table = this.table.nativeElement;
387
1293
  const size = isRows ? 'offsetHeight' : 'offsetWidth';
388
- wrapper.style[`gridTemplate${axis}`] = '';
389
- wrapper.style[`gridTemplate${axis}`] = `${element[size]}px 1fr`;
1294
+ table.style[`gridTemplate${axis}`] = '';
1295
+ table.style[`gridTemplate${axis}`] = `${element[size]}px 1fr`;
390
1296
  };
391
1297
  this.handleScroll = (event) => {
392
1298
  if (event.target === this.valuesTable.nativeElement) {
@@ -403,8 +1309,31 @@ class PivotGridComponent {
403
1309
  }
404
1310
  };
405
1311
  validatePackage(packageMetadata);
1312
+ this.subs.add(this.localization.changes.subscribe(({ rtl }) => {
1313
+ this.rtl = rtl;
1314
+ this.direction = this.rtl ? 'rtl' : 'ltr';
1315
+ }));
406
1316
  dataService.wrapper = hostEl.nativeElement;
407
1317
  }
1318
+ get rightPositionClass() {
1319
+ var _a;
1320
+ return ((_a = this.configuratorSettings) === null || _a === void 0 ? void 0 : _a.position) === 'right';
1321
+ }
1322
+ get leftPositionClass() {
1323
+ var _a;
1324
+ return ((_a = this.configuratorSettings) === null || _a === void 0 ? void 0 : _a.position) === 'left';
1325
+ }
1326
+ get bottomPositionClass() {
1327
+ var _a;
1328
+ return ((_a = this.configuratorSettings) === null || _a === void 0 ? void 0 : _a.position) === 'bottom';
1329
+ }
1330
+ get topPositionClass() {
1331
+ var _a;
1332
+ return ((_a = this.configuratorSettings) === null || _a === void 0 ? void 0 : _a.position) === 'top';
1333
+ }
1334
+ get dir() {
1335
+ return this.direction;
1336
+ }
408
1337
  /**
409
1338
  * Specify the type, size and color of the PivotGrid's loader.
410
1339
  *
@@ -420,6 +1349,15 @@ class PivotGridComponent {
420
1349
  get loaderSettings() {
421
1350
  return this._loaderSettings;
422
1351
  }
1352
+ /**
1353
+ * @hidden
1354
+ */
1355
+ get loadingText() {
1356
+ return this.localization.get('loading');
1357
+ }
1358
+ get configuratorSettings() {
1359
+ return this.configurator && Object.assign({}, DEFAULT_CONFIGURATOR_SETTINGS, this.configurator);
1360
+ }
423
1361
  ngAfterViewInit() {
424
1362
  if (isDocumentAvailable()) {
425
1363
  this.zone.runOutsideAngular(() => {
@@ -442,67 +1380,295 @@ class PivotGridComponent {
442
1380
  this.resizeObservers.forEach(o => o.disconnect());
443
1381
  this.subs.unsubscribe();
444
1382
  }
1383
+ /**
1384
+ * @hidden
1385
+ */
1386
+ messageFor(localizationToken) {
1387
+ return this.localization.get(localizationToken);
1388
+ }
445
1389
  }
446
- 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 });
447
- PivotGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: PivotGridComponent, selector: "kendo-pivotgrid", inputs: { loaderSettings: "loaderSettings", columnHeadersWidth: "columnHeadersWidth" }, host: { properties: { "class.k-pivotgrid": "this.hostClass", "attr.role": "this.ariaRole" } }, providers: [
448
- PivotGridDataService
449
- ], 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: `
450
- <span class="k-pivotgrid-empty-cell"></span>
451
- <kendo-pivotgrid-table
452
- #colHeadersTable
453
- [colWidth]="columnHeadersWidth"
454
- class="k-pivotgrid-column-headers"
455
- tableType="columnHeader"></kendo-pivotgrid-table>
456
- <kendo-pivotgrid-table
457
- #rowHeadersTable
458
- class="k-pivotgrid-row-headers"
459
- tableType="rowHeader"></kendo-pivotgrid-table>
460
- <kendo-pivotgrid-table
461
- #valuesTable
462
- [colWidth]="columnHeadersWidth"
463
- class="k-pivotgrid-values"
464
- tableType="values"></kendo-pivotgrid-table>
465
-
466
- <div *ngIf="loading" class="k-loader">
467
- <kendo-loader
468
- [type]="loaderSettings?.type"
469
- [themeColor]="loaderSettings?.themeColor"
470
- [size]="loaderSettings?.size"
471
- >
472
- </kendo-loader>
1390
+ 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.LocalizationService }, { token: i3.ScrollbarWidthService }], target: i0.ɵɵFactoryTarget.Component });
1391
+ PivotGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: PivotGridComponent, selector: "kendo-pivotgrid", inputs: { loaderSettings: "loaderSettings", configurator: "configurator", columnHeadersWidth: "columnHeadersWidth" }, host: { properties: { "class.k-d-flex": "this.hostClass", "class.k-pos-relative": "this.hostClass", "class.k-flex-row": "this.rightPositionClass", "class.k-flex-row-reverse": "this.leftPositionClass", "class.k-flex-column": "this.bottomPositionClass", "class.k-flex-column-reverse": "this.topPositionClass", "attr.dir": "this.dir", "attr.role": "this.ariaRole" } }, providers: [
1392
+ PivotGridDataService,
1393
+ LocalizationService,
1394
+ {
1395
+ provide: L10N_PREFIX,
1396
+ useValue: 'kendo.pivotgrid'
1397
+ }
1398
+ ], 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 }, { propertyName: "table", first: true, predicate: ["table"], descendants: true, read: ElementRef }], ngImport: i0, template: `
1399
+ <ng-container kendoPivotGridLocalizedMessages
1400
+ i18n-loading="kendo.pivotgrid.loading|The loading text"
1401
+ loading="Loading"
1402
+
1403
+ i18n-emptyCellLabel="kendo.pivotgrid.emptyCellLabel|The value of the aria-label attribute placed on the focusable empty cell element"
1404
+ emptyCellLabel="PivotGrid Empty Cell"
1405
+
1406
+ i18n-fieldMenuFilterItemLabel="kendo.pivotgrid.fieldMenuFilterItemLabel|The text content of the filter item in the column and row fields menu"
1407
+ fieldMenuFilterItemLabel="Filter"
1408
+
1409
+ i18n-fieldMenuSortAscendingItemLabel="kendo.pivotgrid.fieldMenuSortAscendingItemLabel|The text content of the sort ascending item in the column and row fields menu"
1410
+ fieldMenuSortAscendingItemLabel="Sort ascending"
1411
+
1412
+ i18n-fieldMenuSortDescendingItemLabel="kendo.pivotgrid.fieldMenuSortDescendingItemLabel|The text content of the sort descending item in the column and row fields menu"
1413
+ fieldMenuSortDescendingItemLabel="Sort descending"
1414
+
1415
+ i18n-filterInputLabel="kendo.pivotgrid.filterInputLabel|The label of the filter input"
1416
+ filterInputLabel="{{ '{fields} Filter' }}"
1417
+
1418
+ i18n-filterOperatorsDropDownLabel="kendo.pivotgrid.filterOperatorsDropDownLabel|The label of the filter operators DropDownList"
1419
+ filterOperatorsDropDownLabel="{{ '{fields} Filter Operators' }}"
1420
+
1421
+ i18n-filterEqOperator="kendo.pivotgrid.filterEqOperator|The text of the equal filter operator"
1422
+ filterEqOperator="Is equal to"
1423
+
1424
+ i18n-filterNotEqOperator="kendo.pivotgrid.filterNotEqOperator|The text of the not equal filter operator"
1425
+ filterNotEqOperator="Is not equal to"
1426
+
1427
+ i18n-filterIsNullOperator="kendo.pivotgrid.filterIsNullOperator|The text of the is null filter operator"
1428
+ filterIsNullOperator="Is null"
1429
+
1430
+ i18n-filterIsNotNullOperator="kendo.pivotgrid.filterIsNotNullOperator|The text of the is not null filter operator"
1431
+ filterIsNotNullOperator="Is not null"
1432
+
1433
+ i18n-filterIsEmptyOperator="kendo.pivotgrid.filterIsEmptyOperator|The text of the is empty filter operator"
1434
+ filterIsEmptyOperator="Is empty"
1435
+
1436
+ i18n-filterIsNotEmptyOperator="kendo.pivotgrid.filterIsNotEmptyOperator|The text of the is not empty filter operator"
1437
+ filterIsNotEmptyOperator="Is not empty"
1438
+
1439
+ i18n-filterStartsWithOperator="kendo.pivotgrid.filterStartsWithOperator|The text of the starts with filter operator"
1440
+ filterStartsWithOperator="Starts with"
1441
+
1442
+ i18n-filterContainsOperator="kendo.pivotgrid.filterContainsOperator|The text of the contains filter operator"
1443
+ filterContainsOperator="Contains"
1444
+
1445
+ i18n-filterNotContainsOperator="kendo.pivotgrid.filterNotContainsOperator|The text of the does not contain filter operator"
1446
+ filterNotContainsOperator="Does not contain"
1447
+
1448
+ i18n-filterEndsWithOperator="kendo.pivotgrid.filterEndsWithOperator|The text of the ends with filter operator"
1449
+ filterEndsWithOperator="Ends with"
1450
+
1451
+ i18n-filterFilterButton="kendo.pivotgrid.filterFilterButton|The text of the filter button"
1452
+ filterFilterButton="Filter"
1453
+
1454
+ i18n-filterClearButton="kendo.pivotgrid.filterClearButton|The text of the clear filter button"
1455
+ filterClearButton="Clear"
1456
+
1457
+ i18n-configuratorButtonText="kendo.pivotgrid.configuratorButtonText|The text content of the button that opens and closes the PivotGrid configurator"
1458
+ configuratorButtonText="Change Settings"
1459
+
1460
+ i18n-configuratorHeaderText="kendo.pivotgrid.configuratorHeaderText|The text content of the PivotGrid configurator title element"
1461
+ configuratorHeaderText="Settings"
1462
+
1463
+ i18n-configuratorFieldsText="kendo.pivotgrid.configuratorFieldsText|The text content of the PivotGrid configurator fields section title element"
1464
+ configuratorFieldsText="Fields"
1465
+
1466
+ i18n-configuratorColumnsText="kendo.pivotgrid.configuratorColumnsText|The text content of the PivotGrid configurator columns section title element"
1467
+ configuratorColumnsText="Columns"
1468
+
1469
+ i18n-configuratorRowsText="kendo.pivotgrid.configuratorRowsText|The text content of the PivotGrid configurator rows section title element"
1470
+ configuratorRowsText="Rows"
1471
+
1472
+ i18n-configuratorValuesText="kendo.pivotgrid.configuratorValuesText|The text content of the PivotGrid configurator values section title element"
1473
+ configuratorValuesText="Values"
1474
+
1475
+ i18n-configuratorCancelButtonText="kendo.pivotgrid.configuratorCancelButtonText|The text content of the PivotGrid configurator configurator Cancel button"
1476
+ configuratorCancelButtonText="Cancel"
1477
+
1478
+ i18n-configuratorApplyButtonText="kendo.pivotgrid.configuratorApplyButtonText|The text content of the PivotGrid configurator configurator Apply button"
1479
+ configuratorApplyButtonText="Apply"
1480
+
1481
+ i18n-configuratorEmptyRowsText="kendo.pivotgrid.configuratorEmptyRowsText|The text content of the PivotGrid configurator empty rows container"
1482
+ configuratorEmptyRowsText="Select some fields to begin setup"
1483
+
1484
+ i18n-configuratorEmptyColumnsText="kendo.pivotgrid.configuratorEmptyColumnsText|The text content of the PivotGrid configurator empty columns container"
1485
+ configuratorEmptyColumnsText="Select some fields to begin setup"
1486
+
1487
+ i18n-configuratorEmptyMeasuresText="kendo.pivotgrid.configuratorEmptyMeasuresText|The text content of the PivotGrid configurator empty measures container"
1488
+ configuratorEmptyMeasuresText="Select some fields to begin setup"></ng-container>
1489
+
1490
+ <div #table class="k-pivotgrid">
1491
+ <span class="k-pivotgrid-empty-cell" [attr.aria-label]="messageFor('emptyCellLabel')"></span>
1492
+ <kendo-pivotgrid-table
1493
+ #colHeadersTable
1494
+ [colWidth]="columnHeadersWidth"
1495
+ class="k-pivotgrid-column-headers"
1496
+ tableType="columnHeader"></kendo-pivotgrid-table>
1497
+ <kendo-pivotgrid-table
1498
+ #rowHeadersTable
1499
+ class="k-pivotgrid-row-headers"
1500
+ tableType="rowHeader"></kendo-pivotgrid-table>
1501
+ <kendo-pivotgrid-table
1502
+ #valuesTable
1503
+ [colWidth]="columnHeadersWidth"
1504
+ class="k-pivotgrid-values"
1505
+ tableType="values"></kendo-pivotgrid-table>
1506
+
1507
+ <div *ngIf="loading" class="k-loader">
1508
+ <kendo-loader
1509
+ [type]="loaderSettings?.type"
1510
+ [themeColor]="loaderSettings?.themeColor"
1511
+ [size]="loaderSettings?.size"
1512
+ >
1513
+ </kendo-loader>
1514
+ <span class="k-loading-text">{{ loadingText }}</span>
1515
+ </div>
473
1516
  </div>
474
- `, 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", "colWidth"] }, { type: i4.LoaderComponent, selector: "kendo-loader", inputs: ["type", "themeColor", "size"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1517
+
1518
+ <kendo-pivotgrid-configurator
1519
+ *ngIf="showConfigurator"
1520
+ [horizontal]="configuratorSettings.horizontal">
1521
+ </kendo-pivotgrid-configurator>
1522
+
1523
+ <div *ngIf="configurator"
1524
+ class="k-pivotgrid-configurator-button"
1525
+ (click)="showConfigurator = !showConfigurator">
1526
+ <span>{{ messageFor('configuratorButtonText') }}<span class="k-icon k-i-gear k-color-inherit"></span>
1527
+ </span>
1528
+ </div>
1529
+ `, 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", "colWidth"] }, { type: i5$1.LoaderComponent, selector: "kendo-loader", inputs: ["type", "themeColor", "size"] }, { type: PivotGridConfiguratorComponent, selector: "kendo-pivotgrid-configurator", inputs: ["horizontal"] }], directives: [{ type: LocalizedMessagesDirective, selector: "[kendoPivotGridLocalizedMessages]" }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
475
1530
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridComponent, decorators: [{
476
1531
  type: Component,
477
1532
  args: [{
478
1533
  selector: 'kendo-pivotgrid',
479
1534
  providers: [
480
- PivotGridDataService
1535
+ PivotGridDataService,
1536
+ LocalizationService,
1537
+ {
1538
+ provide: L10N_PREFIX,
1539
+ useValue: 'kendo.pivotgrid'
1540
+ }
481
1541
  ],
482
1542
  template: `
483
- <span class="k-pivotgrid-empty-cell"></span>
484
- <kendo-pivotgrid-table
485
- #colHeadersTable
486
- [colWidth]="columnHeadersWidth"
487
- class="k-pivotgrid-column-headers"
488
- tableType="columnHeader"></kendo-pivotgrid-table>
489
- <kendo-pivotgrid-table
490
- #rowHeadersTable
491
- class="k-pivotgrid-row-headers"
492
- tableType="rowHeader"></kendo-pivotgrid-table>
493
- <kendo-pivotgrid-table
494
- #valuesTable
495
- [colWidth]="columnHeadersWidth"
496
- class="k-pivotgrid-values"
497
- tableType="values"></kendo-pivotgrid-table>
498
-
499
- <div *ngIf="loading" class="k-loader">
500
- <kendo-loader
501
- [type]="loaderSettings?.type"
502
- [themeColor]="loaderSettings?.themeColor"
503
- [size]="loaderSettings?.size"
504
- >
505
- </kendo-loader>
1543
+ <ng-container kendoPivotGridLocalizedMessages
1544
+ i18n-loading="kendo.pivotgrid.loading|The loading text"
1545
+ loading="Loading"
1546
+
1547
+ i18n-emptyCellLabel="kendo.pivotgrid.emptyCellLabel|The value of the aria-label attribute placed on the focusable empty cell element"
1548
+ emptyCellLabel="PivotGrid Empty Cell"
1549
+
1550
+ i18n-fieldMenuFilterItemLabel="kendo.pivotgrid.fieldMenuFilterItemLabel|The text content of the filter item in the column and row fields menu"
1551
+ fieldMenuFilterItemLabel="Filter"
1552
+
1553
+ i18n-fieldMenuSortAscendingItemLabel="kendo.pivotgrid.fieldMenuSortAscendingItemLabel|The text content of the sort ascending item in the column and row fields menu"
1554
+ fieldMenuSortAscendingItemLabel="Sort ascending"
1555
+
1556
+ i18n-fieldMenuSortDescendingItemLabel="kendo.pivotgrid.fieldMenuSortDescendingItemLabel|The text content of the sort descending item in the column and row fields menu"
1557
+ fieldMenuSortDescendingItemLabel="Sort descending"
1558
+
1559
+ i18n-filterInputLabel="kendo.pivotgrid.filterInputLabel|The label of the filter input"
1560
+ filterInputLabel="{{ '{fields} Filter' }}"
1561
+
1562
+ i18n-filterOperatorsDropDownLabel="kendo.pivotgrid.filterOperatorsDropDownLabel|The label of the filter operators DropDownList"
1563
+ filterOperatorsDropDownLabel="{{ '{fields} Filter Operators' }}"
1564
+
1565
+ i18n-filterEqOperator="kendo.pivotgrid.filterEqOperator|The text of the equal filter operator"
1566
+ filterEqOperator="Is equal to"
1567
+
1568
+ i18n-filterNotEqOperator="kendo.pivotgrid.filterNotEqOperator|The text of the not equal filter operator"
1569
+ filterNotEqOperator="Is not equal to"
1570
+
1571
+ i18n-filterIsNullOperator="kendo.pivotgrid.filterIsNullOperator|The text of the is null filter operator"
1572
+ filterIsNullOperator="Is null"
1573
+
1574
+ i18n-filterIsNotNullOperator="kendo.pivotgrid.filterIsNotNullOperator|The text of the is not null filter operator"
1575
+ filterIsNotNullOperator="Is not null"
1576
+
1577
+ i18n-filterIsEmptyOperator="kendo.pivotgrid.filterIsEmptyOperator|The text of the is empty filter operator"
1578
+ filterIsEmptyOperator="Is empty"
1579
+
1580
+ i18n-filterIsNotEmptyOperator="kendo.pivotgrid.filterIsNotEmptyOperator|The text of the is not empty filter operator"
1581
+ filterIsNotEmptyOperator="Is not empty"
1582
+
1583
+ i18n-filterStartsWithOperator="kendo.pivotgrid.filterStartsWithOperator|The text of the starts with filter operator"
1584
+ filterStartsWithOperator="Starts with"
1585
+
1586
+ i18n-filterContainsOperator="kendo.pivotgrid.filterContainsOperator|The text of the contains filter operator"
1587
+ filterContainsOperator="Contains"
1588
+
1589
+ i18n-filterNotContainsOperator="kendo.pivotgrid.filterNotContainsOperator|The text of the does not contain filter operator"
1590
+ filterNotContainsOperator="Does not contain"
1591
+
1592
+ i18n-filterEndsWithOperator="kendo.pivotgrid.filterEndsWithOperator|The text of the ends with filter operator"
1593
+ filterEndsWithOperator="Ends with"
1594
+
1595
+ i18n-filterFilterButton="kendo.pivotgrid.filterFilterButton|The text of the filter button"
1596
+ filterFilterButton="Filter"
1597
+
1598
+ i18n-filterClearButton="kendo.pivotgrid.filterClearButton|The text of the clear filter button"
1599
+ filterClearButton="Clear"
1600
+
1601
+ i18n-configuratorButtonText="kendo.pivotgrid.configuratorButtonText|The text content of the button that opens and closes the PivotGrid configurator"
1602
+ configuratorButtonText="Change Settings"
1603
+
1604
+ i18n-configuratorHeaderText="kendo.pivotgrid.configuratorHeaderText|The text content of the PivotGrid configurator title element"
1605
+ configuratorHeaderText="Settings"
1606
+
1607
+ i18n-configuratorFieldsText="kendo.pivotgrid.configuratorFieldsText|The text content of the PivotGrid configurator fields section title element"
1608
+ configuratorFieldsText="Fields"
1609
+
1610
+ i18n-configuratorColumnsText="kendo.pivotgrid.configuratorColumnsText|The text content of the PivotGrid configurator columns section title element"
1611
+ configuratorColumnsText="Columns"
1612
+
1613
+ i18n-configuratorRowsText="kendo.pivotgrid.configuratorRowsText|The text content of the PivotGrid configurator rows section title element"
1614
+ configuratorRowsText="Rows"
1615
+
1616
+ i18n-configuratorValuesText="kendo.pivotgrid.configuratorValuesText|The text content of the PivotGrid configurator values section title element"
1617
+ configuratorValuesText="Values"
1618
+
1619
+ i18n-configuratorCancelButtonText="kendo.pivotgrid.configuratorCancelButtonText|The text content of the PivotGrid configurator configurator Cancel button"
1620
+ configuratorCancelButtonText="Cancel"
1621
+
1622
+ i18n-configuratorApplyButtonText="kendo.pivotgrid.configuratorApplyButtonText|The text content of the PivotGrid configurator configurator Apply button"
1623
+ configuratorApplyButtonText="Apply"
1624
+
1625
+ i18n-configuratorEmptyRowsText="kendo.pivotgrid.configuratorEmptyRowsText|The text content of the PivotGrid configurator empty rows container"
1626
+ configuratorEmptyRowsText="Select some fields to begin setup"
1627
+
1628
+ i18n-configuratorEmptyColumnsText="kendo.pivotgrid.configuratorEmptyColumnsText|The text content of the PivotGrid configurator empty columns container"
1629
+ configuratorEmptyColumnsText="Select some fields to begin setup"
1630
+
1631
+ i18n-configuratorEmptyMeasuresText="kendo.pivotgrid.configuratorEmptyMeasuresText|The text content of the PivotGrid configurator empty measures container"
1632
+ configuratorEmptyMeasuresText="Select some fields to begin setup"></ng-container>
1633
+
1634
+ <div #table class="k-pivotgrid">
1635
+ <span class="k-pivotgrid-empty-cell" [attr.aria-label]="messageFor('emptyCellLabel')"></span>
1636
+ <kendo-pivotgrid-table
1637
+ #colHeadersTable
1638
+ [colWidth]="columnHeadersWidth"
1639
+ class="k-pivotgrid-column-headers"
1640
+ tableType="columnHeader"></kendo-pivotgrid-table>
1641
+ <kendo-pivotgrid-table
1642
+ #rowHeadersTable
1643
+ class="k-pivotgrid-row-headers"
1644
+ tableType="rowHeader"></kendo-pivotgrid-table>
1645
+ <kendo-pivotgrid-table
1646
+ #valuesTable
1647
+ [colWidth]="columnHeadersWidth"
1648
+ class="k-pivotgrid-values"
1649
+ tableType="values"></kendo-pivotgrid-table>
1650
+
1651
+ <div *ngIf="loading" class="k-loader">
1652
+ <kendo-loader
1653
+ [type]="loaderSettings?.type"
1654
+ [themeColor]="loaderSettings?.themeColor"
1655
+ [size]="loaderSettings?.size"
1656
+ >
1657
+ </kendo-loader>
1658
+ <span class="k-loading-text">{{ loadingText }}</span>
1659
+ </div>
1660
+ </div>
1661
+
1662
+ <kendo-pivotgrid-configurator
1663
+ *ngIf="showConfigurator"
1664
+ [horizontal]="configuratorSettings.horizontal">
1665
+ </kendo-pivotgrid-configurator>
1666
+
1667
+ <div *ngIf="configurator"
1668
+ class="k-pivotgrid-configurator-button"
1669
+ (click)="showConfigurator = !showConfigurator">
1670
+ <span>{{ messageFor('configuratorButtonText') }}<span class="k-icon k-i-gear k-color-inherit"></span>
1671
+ </span>
506
1672
  </div>
507
1673
  `,
508
1674
  styles: [`
@@ -515,9 +1681,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
515
1681
  }
516
1682
  `]
517
1683
  }]
518
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: PivotGridDataService }, { type: i2$1.ScrollbarWidthService }]; }, propDecorators: { hostClass: [{
1684
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: PivotGridDataService }, { type: i2.LocalizationService }, { type: i3.ScrollbarWidthService }]; }, propDecorators: { hostClass: [{
1685
+ type: HostBinding,
1686
+ args: ['class.k-d-flex']
1687
+ }, {
1688
+ type: HostBinding,
1689
+ args: ['class.k-pos-relative']
1690
+ }], rightPositionClass: [{
1691
+ type: HostBinding,
1692
+ args: ['class.k-flex-row']
1693
+ }], leftPositionClass: [{
519
1694
  type: HostBinding,
520
- args: ['class.k-pivotgrid']
1695
+ args: ['class.k-flex-row-reverse']
1696
+ }], bottomPositionClass: [{
1697
+ type: HostBinding,
1698
+ args: ['class.k-flex-column']
1699
+ }], topPositionClass: [{
1700
+ type: HostBinding,
1701
+ args: ['class.k-flex-column-reverse']
1702
+ }], dir: [{
1703
+ type: HostBinding,
1704
+ args: ['attr.dir']
521
1705
  }], ariaRole: [{
522
1706
  type: HostBinding,
523
1707
  args: ['attr.role']
@@ -530,12 +1714,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
530
1714
  }], valuesTable: [{
531
1715
  type: ViewChild,
532
1716
  args: ['valuesTable', { read: ElementRef }]
1717
+ }], table: [{
1718
+ type: ViewChild,
1719
+ args: ['table', { read: ElementRef }]
533
1720
  }], loaderSettings: [{
534
1721
  type: Input
1722
+ }], configurator: [{
1723
+ type: Input
535
1724
  }], columnHeadersWidth: [{
536
1725
  type: Input
537
1726
  }] } });
538
1727
 
1728
+ /**
1729
+ * @hidden
1730
+ */
1731
+ class PivotGridState {
1732
+ constructor(columnAxes, rowAxes, measureAxes) {
1733
+ this.columnAxes = columnAxes;
1734
+ this.rowAxes = rowAxes;
1735
+ this.measureAxes = measureAxes;
1736
+ }
1737
+ }
1738
+
1739
+ /**
1740
+ * The event data for the ExpandChangeEvent
1741
+ */
1742
+ class ExpandChangeEvent extends PreventableEvent {
1743
+ /**
1744
+ * @hidden
1745
+ */
1746
+ constructor(args) {
1747
+ super();
1748
+ Object.assign(this, args);
1749
+ }
1750
+ }
1751
+ ;
1752
+
1753
+ /**
1754
+ * The event data for the ConfigurationChangeEvent
1755
+ */
1756
+ class ConfigurationChangeEvent extends PreventableEvent {
1757
+ /**
1758
+ * @hidden
1759
+ */
1760
+ constructor(args) {
1761
+ super();
1762
+ Object.assign(this, args);
1763
+ }
1764
+ }
1765
+ ;
1766
+
539
1767
  /**
540
1768
  * @hidden
541
1769
  * A directive which binds the PivotGrid to an array of objects.
@@ -556,11 +1784,33 @@ class PivotBaseBindingDirective {
556
1784
  * Represents the measure axes configuration of the PivotGrid.
557
1785
  */
558
1786
  this.measureAxes = [];
559
- this.expandedStateSub = new Subscription();
1787
+ /**
1788
+ * Fires each time a row or column header gets expanded or collapsed by the end user. The event is preventable.
1789
+ * If you prevent the event, the PivotGrid will not be rerendered with the new state, resulting from the end user interaction.
1790
+ */
1791
+ this.expandChange = new EventEmitter();
1792
+ /**
1793
+ * Fires when the Configurator Apply button is pressed. The event is preventable.
1794
+ * If you prevent the event, the PivotGrid will not be rerendered with the new state, resulting from the configuration changes, applied through the configurator interface.
1795
+ */
1796
+ this.configurationChange = new EventEmitter();
1797
+ /**
1798
+ * Fires each time when new data is loaded and transformed to show aggregated values.
1799
+ * The event fires upon initialization and on user interaction that changes the state of the PivotGrid.
1800
+ */
1801
+ this.dataLoaded = new EventEmitter();
1802
+ this.subs = new Subscription();
1803
+ }
1804
+ /**
1805
+ * @hidden
1806
+ */
1807
+ get state() {
1808
+ return new PivotGridState(this.columnAxes, this.rowAxes, this.measureAxes);
560
1809
  }
561
1810
  ngOnInit() {
562
- this.loadData();
563
- this.expandedStateSub = this.dataService.expandedStateChange.subscribe((state) => {
1811
+ this.loadData(this.state);
1812
+ this.loadFields();
1813
+ this.subs.add(this.dataService.expandedStateChange.subscribe((state) => {
564
1814
  this.zone.run(() => {
565
1815
  const isCol = state.tableType === 'columnHeader';
566
1816
  const axes = isCol ? 'columnAxes' : 'rowAxes';
@@ -568,10 +1818,35 @@ class PivotBaseBindingDirective {
568
1818
  const tree = toTree((isCol ? this.dataService.columns : this.dataService.rows || []).slice());
569
1819
  this.updateHeaders(axes, tree, state.cell.path);
570
1820
  });
571
- });
1821
+ }));
1822
+ this.subs.add(this.dataService.configuratorFieldChange.subscribe((state) => {
1823
+ this.zone.run(() => {
1824
+ if (hasObservers(this.configurationChange)) {
1825
+ const event = new ConfigurationChangeEvent(state);
1826
+ this.configurationChange.emit(event);
1827
+ if (event.isDefaultPrevented()) {
1828
+ return;
1829
+ }
1830
+ }
1831
+ this.dataService.configuredFields.next({
1832
+ columnAxes: state.columnAxes,
1833
+ rowAxes: state.rowAxes,
1834
+ measureAxes: state.measureAxes
1835
+ });
1836
+ this.loadData(state);
1837
+ });
1838
+ }));
1839
+ this.subs.add(this.dataService.valuesRows.subscribe((data) => {
1840
+ this.zone.run(() => {
1841
+ if (hasObservers(this.dataLoaded)) {
1842
+ this.dataLoaded.emit(data);
1843
+ }
1844
+ });
1845
+ }));
1846
+ this.dataService.directive = this;
572
1847
  }
573
1848
  ngOnDestroy() {
574
- this.expandedStateSub.unsubscribe();
1849
+ this.subs.unsubscribe();
575
1850
  }
576
1851
  updateDataServiceFields() {
577
1852
  this.dataService.normalizedData = this.dataState.data;
@@ -579,6 +1854,14 @@ class PivotBaseBindingDirective {
579
1854
  this.dataService.columns = this.dataState.columns;
580
1855
  this.dataService.updateRowsAndCols();
581
1856
  }
1857
+ updateConfiguratorFields() {
1858
+ this.dataService.fields.next(this.configuratorFields);
1859
+ this.dataService.configuredFields.next({
1860
+ columnAxes: this.columnAxes,
1861
+ rowAxes: this.rowAxes,
1862
+ measureAxes: this.measureAxes
1863
+ });
1864
+ }
582
1865
  updateHeaders(axes, tree, path) {
583
1866
  // Action to determine expand/collapse state
584
1867
  const action = {
@@ -587,15 +1870,23 @@ class PivotBaseBindingDirective {
587
1870
  };
588
1871
  // The `headersReducer` method is responsible for udpating
589
1872
  // the expanded state based on the toggle action (expand/collapse)
590
- const newHeaders = headersReducer(this[axes].slice(), Object.assign(Object.assign({}, action), { tree }));
591
1873
  // Update axes and reload data
1874
+ const newHeaders = headersReducer(this[axes].slice(), Object.assign(Object.assign({}, action), { tree }));
1875
+ if (hasObservers(this.expandChange)) {
1876
+ const newState = Object.assign(Object.assign({}, this.state), { [axes]: newHeaders });
1877
+ const event = new ExpandChangeEvent(newState);
1878
+ this.expandChange.emit(event);
1879
+ if (event.isDefaultPrevented()) {
1880
+ return;
1881
+ }
1882
+ }
592
1883
  this[axes] = newHeaders;
593
- this.loadData();
1884
+ this.loadData(this.state);
594
1885
  }
595
1886
  ;
596
1887
  }
597
1888
  PivotBaseBindingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotBaseBindingDirective, deps: [{ token: PivotGridDataService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
598
- PivotBaseBindingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: PivotBaseBindingDirective, selector: "kendo-base-binding-directive", inputs: { columnAxes: "columnAxes", rowAxes: "rowAxes", measureAxes: "measureAxes" }, ngImport: i0 });
1889
+ PivotBaseBindingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: PivotBaseBindingDirective, selector: "kendo-base-binding-directive", inputs: { columnAxes: "columnAxes", rowAxes: "rowAxes", measureAxes: "measureAxes" }, outputs: { expandChange: "expandChange", configurationChange: "configurationChange", dataLoaded: "dataLoaded" }, ngImport: i0 });
599
1890
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotBaseBindingDirective, decorators: [{
600
1891
  type: Directive,
601
1892
  args: [{
@@ -607,6 +1898,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
607
1898
  type: Input
608
1899
  }], measureAxes: [{
609
1900
  type: Input
1901
+ }], expandChange: [{
1902
+ type: Output
1903
+ }], configurationChange: [{
1904
+ type: Output
1905
+ }], dataLoaded: [{
1906
+ type: Output
610
1907
  }] } });
611
1908
 
612
1909
  const dataField = 'aggregate';
@@ -619,26 +1916,38 @@ const stringSeparator = '&';
619
1916
  class PivotLocalBindingDirective extends PivotBaseBindingDirective {
620
1917
  constructor(dataService, zone) {
621
1918
  super(dataService, zone);
1919
+ this.type = 'local';
622
1920
  this.createAxisSettings = (key) => (Object.assign({ key }, this.dimensions[key]));
623
1921
  }
624
1922
  ngOnChanges(changes) {
625
1923
  if (anyChanged(['data', 'dimensions', 'columnAxes', 'rowAxes', 'measureAxes', 'measures'], changes)) {
626
- this.loadData();
1924
+ this.loadData(this.state);
627
1925
  }
628
1926
  }
629
- loadData() {
630
- const rootColumnAxes = this.getRootAxes(this.columnAxes);
631
- const rootRowAxes = this.getRootAxes(this.rowAxes);
1927
+ /**
1928
+ * @hidden
1929
+ */
1930
+ fetchChildren(node) {
1931
+ return node.children;
1932
+ }
1933
+ loadFields() {
1934
+ this.configuratorFields = createFlatSchemaDimensions(this.dimensions, this.measures);
1935
+ this.updateConfiguratorFields();
1936
+ }
1937
+ loadData(state) {
1938
+ const { columnAxes, rowAxes, measureAxes } = state;
1939
+ const rootColumnAxes = this.getRootAxes(columnAxes);
1940
+ const rootRowAxes = this.getRootAxes(rowAxes);
632
1941
  const columnSettings = rootColumnAxes.split(stringSeparator).map(this.createAxisSettings);
633
1942
  const rowSettings = rootRowAxes.split(stringSeparator).map(this.createAxisSettings);
634
- const measuresSettings = this.measureAxes.map(m => this.measures.find(meas => String(meas.name) === String(m.name))).filter(Boolean);
1943
+ const measuresSettings = measureAxes.map(m => this.measures.find(meas => String(meas.name) === String(m.name))).filter(Boolean);
635
1944
  const dataTree = createDataTree(this.data, rowSettings, columnSettings, measuresSettings, bindingFields);
636
1945
  this.dataState = createLocalDataState({
637
1946
  dataTree,
638
1947
  rowSettings,
639
1948
  columnSettings,
640
- rowAxes: this.rowAxes,
641
- columnAxes: this.columnAxes,
1949
+ rowAxes: rowAxes,
1950
+ columnAxes: columnAxes,
642
1951
  measures: measuresSettings,
643
1952
  sort: [],
644
1953
  fields: bindingFields
@@ -672,22 +1981,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
672
1981
  class PivotOLAPBindingDirective extends PivotBaseBindingDirective {
673
1982
  constructor(dataService, zone) {
674
1983
  super(dataService, zone);
1984
+ this.type = 'olap';
675
1985
  }
676
1986
  ngOnChanges(changes) {
677
1987
  if (anyChanged(['url', 'cube', 'catalog', 'columnAxes', 'rowAxes', 'measureAxes'], changes)) {
678
- this.loadData();
1988
+ this.loadData(this.state);
1989
+ this.loadFields();
679
1990
  }
680
1991
  }
681
- loadData() {
1992
+ loadData(state) {
1993
+ const { columnAxes, rowAxes, measureAxes } = state;
682
1994
  this.dataService.loading.next(true);
683
1995
  const options = {
684
1996
  connection: {
685
1997
  catalog: this.catalog,
686
1998
  cube: this.cube
687
1999
  },
688
- columnAxes: this.columnAxes,
689
- rowAxes: this.rowAxes,
690
- measureAxes: this.measureAxes
2000
+ columnAxes: columnAxes,
2001
+ rowAxes: rowAxes,
2002
+ measureAxes: measureAxes
691
2003
  };
692
2004
  fetchData({ url: this.url }, JSON.parse(JSON.stringify(options)))
693
2005
  .then(createDataState)
@@ -697,6 +2009,127 @@ class PivotOLAPBindingDirective extends PivotBaseBindingDirective {
697
2009
  this.dataService.loading.next(false);
698
2010
  });
699
2011
  }
2012
+ loadFields() {
2013
+ const options = {
2014
+ connection: {
2015
+ catalog: this.catalog,
2016
+ cube: this.cube
2017
+ },
2018
+ restrictions: {
2019
+ catalogName: this.catalog,
2020
+ cubeName: this.cube
2021
+ },
2022
+ command: 'schemaDimensions'
2023
+ };
2024
+ fetchDiscover({ url: this.url }, options)
2025
+ .then((newFields) => {
2026
+ addKPI(newFields);
2027
+ this.configuratorFields = newFields;
2028
+ this.updateConfiguratorFields();
2029
+ });
2030
+ }
2031
+ updateFields(event, fields) {
2032
+ return __awaiter(this, void 0, void 0, function* () {
2033
+ const newFields = fields.slice();
2034
+ const field = this.getField(newFields, event);
2035
+ if (field && field.uniqueName === '[KPIs]') {
2036
+ const KPIs = this.normalizeKPIs(yield this.loadKPIs());
2037
+ field.children = KPIs;
2038
+ }
2039
+ else if (field && field.type === 'kpi') {
2040
+ field.children = buildKPIMeasures(field);
2041
+ }
2042
+ else if (field && !field.children) {
2043
+ const additionalFields = yield this.loadAvailableFields(field);
2044
+ field.children = additionalFields;
2045
+ }
2046
+ return field === null || field === void 0 ? void 0 : field.children;
2047
+ });
2048
+ }
2049
+ /**
2050
+ * @hidden
2051
+ */
2052
+ fetchChildren(event, fields) {
2053
+ return this.updateFields(event, fields);
2054
+ }
2055
+ normalizeKPIs(data) {
2056
+ for (let idx = 0, length = data.length; idx < length; idx++) {
2057
+ data[idx].uniqueName = data[idx].name;
2058
+ data[idx].type = 'kpi';
2059
+ }
2060
+ return data;
2061
+ }
2062
+ ;
2063
+ getField(nodes = [], target) {
2064
+ for (let i = 0; i < nodes.length; i++) {
2065
+ const node = nodes[i];
2066
+ if (node.uniqueName === target.uniqueName) {
2067
+ return node;
2068
+ }
2069
+ let result = this.getField(node.children, target);
2070
+ if (result !== null) {
2071
+ return result;
2072
+ }
2073
+ }
2074
+ return null;
2075
+ }
2076
+ ;
2077
+ loadKPIs() {
2078
+ return __awaiter(this, void 0, void 0, function* () {
2079
+ const options = {
2080
+ connection: {
2081
+ catalog: this.catalog,
2082
+ cube: this.cube
2083
+ },
2084
+ restrictions: {
2085
+ catalogName: this.catalog,
2086
+ cubeName: this.cube
2087
+ },
2088
+ command: 'schemaKPIs'
2089
+ };
2090
+ return fetchDiscover({ url: this.url }, options);
2091
+ });
2092
+ }
2093
+ ;
2094
+ loadAvailableFields(field) {
2095
+ return __awaiter(this, void 0, void 0, function* () {
2096
+ let command;
2097
+ let dimensionUniqueName;
2098
+ let hierarchyUniqueName;
2099
+ let levelUniqueName;
2100
+ let memberUniqueName;
2101
+ let treeOp;
2102
+ if (field.type === 2) {
2103
+ command = 'schemaMeasures';
2104
+ }
2105
+ else if (field.dimensionUniqueName) {
2106
+ command = 'schemaLevels';
2107
+ hierarchyUniqueName = field.uniqueName;
2108
+ }
2109
+ else {
2110
+ command = 'schemaHierarchies';
2111
+ dimensionUniqueName = field.uniqueName;
2112
+ }
2113
+ const options = {
2114
+ connection: {
2115
+ catalog: this.catalog,
2116
+ cube: this.cube
2117
+ },
2118
+ restrictions: {
2119
+ catalogName: this.catalog,
2120
+ cubeName: this.cube,
2121
+ hierarchyUniqueName,
2122
+ dimensionUniqueName,
2123
+ levelUniqueName,
2124
+ memberUniqueName,
2125
+ treeOp
2126
+ },
2127
+ command
2128
+ };
2129
+ return fetchDiscover({ url: this.url }, options);
2130
+ });
2131
+ }
2132
+ ;
700
2133
  }
701
2134
  PivotOLAPBindingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotOLAPBindingDirective, deps: [{ token: PivotGridDataService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
702
2135
  PivotOLAPBindingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: PivotOLAPBindingDirective, selector: "[kendoPivotOLAPBinding]", inputs: { url: "url", cube: "cube", catalog: "catalog" }, exportAs: ["kendoPivotOLAPBinding"], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
@@ -714,17 +2147,68 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
714
2147
  type: Input
715
2148
  }] } });
716
2149
 
2150
+ /**
2151
+ * Custom component messages override default component messages
2152
+ * ([see example]({% slug globalization_pivotgrid %}#toc-localization)).
2153
+ */
2154
+ class CustomMessagesComponent extends PivotGridMessages {
2155
+ constructor(service) {
2156
+ super();
2157
+ this.service = service;
2158
+ }
2159
+ get override() {
2160
+ return true;
2161
+ }
2162
+ }
2163
+ CustomMessagesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CustomMessagesComponent, deps: [{ token: i2.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
2164
+ CustomMessagesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: CustomMessagesComponent, selector: "kendo-pivotgrid-messages", providers: [
2165
+ {
2166
+ provide: PivotGridMessages,
2167
+ useExisting: forwardRef(() => CustomMessagesComponent)
2168
+ }
2169
+ ], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
2170
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CustomMessagesComponent, decorators: [{
2171
+ type: Component,
2172
+ args: [{
2173
+ providers: [
2174
+ {
2175
+ provide: PivotGridMessages,
2176
+ useExisting: forwardRef(() => CustomMessagesComponent)
2177
+ }
2178
+ ],
2179
+ selector: 'kendo-pivotgrid-messages',
2180
+ template: ``
2181
+ }]
2182
+ }], ctorParameters: function () { return [{ type: i2.LocalizationService }]; } });
2183
+
717
2184
  const IMPORTED_MODULES = [
718
2185
  CommonModule,
719
2186
  EventsModule,
720
- IndicatorsModule
2187
+ IndicatorsModule,
2188
+ ButtonsModule,
2189
+ TreeViewModule,
2190
+ InputsModule,
2191
+ DraggableModule
721
2192
  ];
722
2193
  const DECLARATIONS = [
2194
+ PivotGridComponent,
2195
+ PivotGridTableComponent,
2196
+ PivotGridConfiguratorComponent,
2197
+ PivotGridCellDirective,
2198
+ PivotLocalBindingDirective,
2199
+ PivotOLAPBindingDirective,
2200
+ DraggableChipDirective,
2201
+ DropTargetDirective,
2202
+ LocalizedMessagesDirective,
2203
+ CustomMessagesComponent
2204
+ ];
2205
+ const EXPORTS = [
723
2206
  PivotGridComponent,
724
2207
  PivotGridTableComponent,
725
2208
  PivotGridCellDirective,
726
2209
  PivotLocalBindingDirective,
727
- PivotOLAPBindingDirective
2210
+ PivotOLAPBindingDirective,
2211
+ CustomMessagesComponent
728
2212
  ];
729
2213
  /**
730
2214
  * Sample module
@@ -734,29 +2218,32 @@ class PivotGridModule {
734
2218
  PivotGridModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
735
2219
  PivotGridModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridModule, declarations: [PivotGridComponent,
736
2220
  PivotGridTableComponent,
2221
+ PivotGridConfiguratorComponent,
737
2222
  PivotGridCellDirective,
738
2223
  PivotLocalBindingDirective,
739
- PivotOLAPBindingDirective], imports: [CommonModule,
2224
+ PivotOLAPBindingDirective,
2225
+ DraggableChipDirective,
2226
+ DropTargetDirective,
2227
+ LocalizedMessagesDirective,
2228
+ CustomMessagesComponent], imports: [CommonModule,
740
2229
  EventsModule,
741
- IndicatorsModule], exports: [PivotGridComponent,
2230
+ IndicatorsModule,
2231
+ ButtonsModule,
2232
+ TreeViewModule,
2233
+ InputsModule,
2234
+ DraggableModule], exports: [PivotGridComponent,
742
2235
  PivotGridTableComponent,
743
2236
  PivotGridCellDirective,
744
2237
  PivotLocalBindingDirective,
745
- PivotOLAPBindingDirective] });
746
- PivotGridModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridModule, providers: [{
747
- provide: L10N_PREFIX,
748
- useValue: 'kendo.pivotgrid'
749
- }], imports: [[...IMPORTED_MODULES]] });
2238
+ PivotOLAPBindingDirective,
2239
+ CustomMessagesComponent] });
2240
+ PivotGridModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridModule, imports: [[...IMPORTED_MODULES]] });
750
2241
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridModule, decorators: [{
751
2242
  type: NgModule,
752
2243
  args: [{
753
2244
  imports: [...IMPORTED_MODULES],
754
2245
  declarations: [...DECLARATIONS],
755
- exports: [...DECLARATIONS],
756
- providers: [{
757
- provide: L10N_PREFIX,
758
- useValue: 'kendo.pivotgrid'
759
- }]
2246
+ exports: [...EXPORTS]
760
2247
  }]
761
2248
  }] });
762
2249
 
@@ -764,5 +2251,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
764
2251
  * Generated bundle index. Do not edit.
765
2252
  */
766
2253
 
767
- export { PivotGridCellDirective, PivotGridComponent, PivotGridModule, PivotGridTableComponent, PivotLocalBindingDirective, PivotOLAPBindingDirective };
2254
+ export { ConfigurationChangeEvent, CustomMessagesComponent, DraggableChipDirective, DropTargetDirective, ExpandChangeEvent, PivotGridCellDirective, PivotGridComponent, PivotGridConfiguratorComponent, PivotGridModule, PivotGridTableComponent, PivotLocalBindingDirective, PivotOLAPBindingDirective };
768
2255