@progress/kendo-angular-pivotgrid 1.0.2 → 1.1.0-dev.202210190858

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.
@@ -12,7 +12,7 @@ import { cloneArray, syncScroll, syncWheel } from './util';
12
12
  // eslint-disable-next-line rxjs/ban-operators
13
13
  import { merge } from 'rxjs/operators';
14
14
  import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
15
- import { PivotGridNavigation } from '@progress/kendo-pivotgrid-common';
15
+ import { ConfiguratorNavigation, PivotGridNavigation } from '@progress/kendo-pivotgrid-common';
16
16
  import { PivotLocalizationService } from './localization/pivot-localization.service';
17
17
  import * as i0 from "@angular/core";
18
18
  import * as i1 from "./data-binding/pivotgrid-data.service";
@@ -86,7 +86,7 @@ export class PivotGridComponent {
86
86
  this.rtl = rtl;
87
87
  this.direction = this.rtl ? 'rtl' : 'ltr';
88
88
  }));
89
- dataService.wrapper = hostEl.nativeElement;
89
+ dataService.wrapper = this.hostEl.nativeElement;
90
90
  }
91
91
  get rightPositionClass() {
92
92
  var _a;
@@ -179,10 +179,32 @@ export class PivotGridComponent {
179
179
  messageFor(localizationToken) {
180
180
  return this.localization.get(localizationToken);
181
181
  }
182
+ /**
183
+ * @hidden
184
+ */
185
+ toggleConfigurator() {
186
+ this.showConfigurator = !this.showConfigurator;
187
+ if (!this.navigable) {
188
+ return;
189
+ }
190
+ if (this.showConfigurator) {
191
+ this.zone.runOutsideAngular(() => setTimeout(() => this.initConfiguratorNavigation()));
192
+ }
193
+ else {
194
+ this.stopConfiguratorNavigation();
195
+ const el = this.navigation.current;
196
+ if (el) {
197
+ this.zone.runOutsideAngular(() => {
198
+ setTimeout(() => this.navigation.focusElement(el, null));
199
+ });
200
+ }
201
+ ;
202
+ }
203
+ }
182
204
  initNavigation() {
183
205
  this.stopNavigation();
184
206
  this.navigation = new PivotGridNavigation({ tabIndex: 0 });
185
- this.navigation.start(this.hostEl.nativeElement);
207
+ this.navigation.start(this.table.nativeElement);
186
208
  const firstCell = this.navigation.first;
187
209
  if (firstCell) {
188
210
  firstCell.setAttribute('tabindex', '0');
@@ -203,6 +225,21 @@ export class PivotGridComponent {
203
225
  this.navigation.stop();
204
226
  }
205
227
  }
228
+ initConfiguratorNavigation() {
229
+ this.stopConfiguratorNavigation();
230
+ this.configuratorNavigation = new ConfiguratorNavigation({ tabIndex: 0 });
231
+ this.configuratorNavigation.start(this.configuratorWrapper.nativeElement);
232
+ this.configuratorNavigation.first.setAttribute('tabindex', '0');
233
+ }
234
+ stopConfiguratorNavigation() {
235
+ if (this.configuratorNavigation) {
236
+ const lastFocusedEl = this.configuratorNavigation.elements.find(el => el.hasAttribute('tabindex'));
237
+ if (lastFocusedEl) {
238
+ this.renderer.removeAttribute(lastFocusedEl, 'tabindex');
239
+ }
240
+ this.configuratorNavigation.stop();
241
+ }
242
+ }
206
243
  }
207
244
  PivotGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i1.PivotGridDataService }, { token: i2.LocalizationService }, { token: i0.Renderer2 }, { token: i3.ScrollbarWidthService }], target: i0.ɵɵFactoryTarget.Component });
208
245
  PivotGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: PivotGridComponent, selector: "kendo-pivotgrid", inputs: { loaderSettings: "loaderSettings", configurator: "configurator", columnHeadersWidth: "columnHeadersWidth", navigable: "navigable" }, 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: [
@@ -213,7 +250,7 @@ PivotGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
213
250
  provide: L10N_PREFIX,
214
251
  useValue: 'kendo.pivotgrid'
215
252
  }
216
- ], 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 }], usesOnChanges: true, ngImport: i0, template: `
253
+ ], 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 }, { propertyName: "configuratorWrapper", first: true, predicate: ["configurator"], descendants: true, read: ElementRef }], usesOnChanges: true, ngImport: i0, template: `
217
254
  <ng-container kendoPivotGridLocalizedMessages
218
255
  i18n-loading="kendo.pivotgrid.loading|The loading text"
219
256
  loading="Loading"
@@ -337,19 +374,22 @@ PivotGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
337
374
  <span class="k-loading-text">{{ loadingText }}</span>
338
375
  </div>
339
376
  </div>
340
-
341
377
  <kendo-pivotgrid-configurator
378
+ #configurator
342
379
  *ngIf="showConfigurator"
343
- [orientation]="configuratorSettings.orientation">
380
+ [navigation]="configuratorNavigation"
381
+ [orientation]="configuratorSettings.orientation"
382
+ (close)="toggleConfigurator()">
344
383
  </kendo-pivotgrid-configurator>
345
-
346
384
  <div *ngIf="configurator"
385
+ #configuratorButton
347
386
  class="k-pivotgrid-configurator-button"
348
- (click)="showConfigurator = !showConfigurator">
387
+ aria-hidden="true"
388
+ (click)="toggleConfigurator()">
349
389
  <span>{{messageFor('configuratorButtonText')}}<span class="k-icon k-i-gear k-color-inherit"></span>
350
390
  </span>
351
391
  </div>
352
- `, 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: i4.PivotGridTableComponent, selector: "kendo-pivotgrid-table", inputs: ["tableType", "colWidth"] }, { type: i5.LoaderComponent, selector: "kendo-loader", inputs: ["type", "themeColor", "size"] }, { type: i6.PivotGridConfiguratorComponent, selector: "kendo-pivotgrid-configurator", inputs: ["orientation", "sort", "filter"] }], directives: [{ type: i7.LocalizedMessagesDirective, selector: "[kendoPivotGridLocalizedMessages]" }, { type: i8.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
392
+ `, 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: i4.PivotGridTableComponent, selector: "kendo-pivotgrid-table", inputs: ["tableType", "colWidth"] }, { type: i5.LoaderComponent, selector: "kendo-loader", inputs: ["type", "themeColor", "size"] }, { type: i6.PivotGridConfiguratorComponent, selector: "kendo-pivotgrid-configurator", inputs: ["orientation", "sort", "filter", "navigation"], outputs: ["close"] }], directives: [{ type: i7.LocalizedMessagesDirective, selector: "[kendoPivotGridLocalizedMessages]" }, { type: i8.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
353
393
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridComponent, decorators: [{
354
394
  type: Component,
355
395
  args: [{
@@ -487,15 +527,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
487
527
  <span class="k-loading-text">{{ loadingText }}</span>
488
528
  </div>
489
529
  </div>
490
-
491
530
  <kendo-pivotgrid-configurator
531
+ #configurator
492
532
  *ngIf="showConfigurator"
493
- [orientation]="configuratorSettings.orientation">
533
+ [navigation]="configuratorNavigation"
534
+ [orientation]="configuratorSettings.orientation"
535
+ (close)="toggleConfigurator()">
494
536
  </kendo-pivotgrid-configurator>
495
-
496
537
  <div *ngIf="configurator"
538
+ #configuratorButton
497
539
  class="k-pivotgrid-configurator-button"
498
- (click)="showConfigurator = !showConfigurator">
540
+ aria-hidden="true"
541
+ (click)="toggleConfigurator()">
499
542
  <span>{{messageFor('configuratorButtonText')}}<span class="k-icon k-i-gear k-color-inherit"></span>
500
543
  </span>
501
544
  </div>
@@ -546,6 +589,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
546
589
  }], table: [{
547
590
  type: ViewChild,
548
591
  args: ['table', { read: ElementRef }]
592
+ }], configuratorWrapper: [{
593
+ type: ViewChild,
594
+ args: ['configurator', { read: ElementRef }]
549
595
  }], loaderSettings: [{
550
596
  type: Input
551
597
  }], configurator: [{
@@ -18,6 +18,7 @@ import { DraggableChipDirective } from './configurator/draggable.directive';
18
18
  import { DropTargetDirective } from './configurator/drop-target.directive';
19
19
  import { ChipMenuModule } from './configurator/chip-menu/chip-menu.module';
20
20
  import { SharedModule } from './shared.module';
21
+ import { ChipKeyboardNavigationDirective } from './configurator/chip-kb-nav.directive';
21
22
  import * as i0 from "@angular/core";
22
23
  const IMPORTED_MODULES = [
23
24
  EventsModule,
@@ -37,7 +38,8 @@ const DECLARATIONS = [
37
38
  DraggableChipDirective,
38
39
  DropTargetDirective,
39
40
  LocalizedMessagesDirective,
40
- CustomMessagesComponent
41
+ CustomMessagesComponent,
42
+ ChipKeyboardNavigationDirective
41
43
  ];
42
44
  const EXPORTS = [
43
45
  PivotGridComponent,
@@ -62,7 +64,8 @@ PivotGridModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
62
64
  DraggableChipDirective,
63
65
  DropTargetDirective,
64
66
  LocalizedMessagesDirective,
65
- CustomMessagesComponent], imports: [EventsModule,
67
+ CustomMessagesComponent,
68
+ ChipKeyboardNavigationDirective], imports: [EventsModule,
66
69
  IndicatorsModule,
67
70
  TreeViewModule,
68
71
  DraggableModule,
package/esm2015/util.js CHANGED
@@ -180,3 +180,11 @@ export function cloneValue(value, nextValue) {
180
180
  export function cloneArray(array) {
181
181
  return array.map(value => cloneValue(value, undefined));
182
182
  }
183
+ /**
184
+ * @hidden
185
+ */
186
+ export const swapItems = (arr, i1, i2) => {
187
+ let temp = arr[i1];
188
+ arr[i1] = arr[i2];
189
+ arr[i2] = temp;
190
+ };