@progress/kendo-angular-pivotgrid 0.2.0-dev.202208181226 → 0.2.0-dev.202208190706

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 +27 -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 +13 -4
  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 +68 -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 +26 -3
  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/expanded-change-event.js +18 -0
  27. package/esm2015/package-metadata.js +1 -1
  28. package/esm2015/pivotgrid.component.js +360 -63
  29. package/esm2015/pivotgrid.module.js +43 -16
  30. package/esm2015/rendering/pivotgrid-cell.directive.js +6 -3
  31. package/esm2015/rendering/pivotgrid-table.component.js +29 -10
  32. package/esm2015/util.js +86 -0
  33. package/fesm2015/kendo-angular-pivotgrid.js +1696 -156
  34. package/localization/custom-messages.component.d.ts +18 -0
  35. package/localization/localized-messages.directive.d.ts +16 -0
  36. package/localization/messages.d.ts +172 -0
  37. package/main.d.ts +6 -0
  38. package/models/configuration-change-event.d.ts +36 -0
  39. package/models/configurator-settings.d.ts +32 -0
  40. package/models/expanded-change-event.d.ts +27 -0
  41. package/package.json +7 -1
  42. package/pivotgrid.component.d.ts +28 -3
  43. package/pivotgrid.module.d.ts +15 -7
  44. package/rendering/pivotgrid-table.component.d.ts +3 -2
  45. package/util.d.ts +31 -0
@@ -16,6 +16,9 @@ export class PivotGridTableComponent {
16
16
  this.dataService = dataService;
17
17
  this.dataChangeSubs = new Subscription();
18
18
  }
19
+ get pivotGridId() {
20
+ return `kendo-pivotgrid-${this.dataService.pivotGridId}-`;
21
+ }
19
22
  ngOnInit() {
20
23
  this.dataChangeSubs.add(this.dataService[`${this.tableType}Rows`].subscribe(rows => this.rows = rows));
21
24
  this.dataChangeSubs.add(this.tableType === 'values' ?
@@ -28,28 +31,36 @@ export class PivotGridTableComponent {
28
31
  }
29
32
  PivotGridTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridTableComponent, deps: [{ token: i1.PivotGridDataService }], target: i0.ɵɵFactoryTarget.Component });
30
33
  PivotGridTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: PivotGridTableComponent, selector: "kendo-pivotgrid-table", inputs: { tableType: "tableType", colWidth: "colWidth" }, ngImport: i0, template: `
31
- <table class="k-pivotgrid-table">
34
+ <table
35
+ class="k-pivotgrid-table"
36
+ role="presentation">
32
37
  <colgroup>
33
38
  <col
34
39
  *ngFor="let item of headerItems;"
35
40
  [style.width]="tableType !== 'rowHeader' ? colWidth >= 0 ? colWidth + 'px' : '200px' : undefined" />
36
41
  </colgroup>
37
- <tbody class="k-pivotgrid-tbody">
42
+ <tbody class="k-pivotgrid-tbody" role="rowgroup">
38
43
  <tr *ngFor="let row of rows; index as rowIndex"
39
- class="k-pivotgrid-row">
44
+ class="k-pivotgrid-row"
45
+ role="row">
40
46
  <ng-container *ngFor="let cell of row.cells; index as colIndex">
41
47
  <th
42
48
  *ngIf="cell && tableType !== 'values'"
43
49
  [kendoPivotGridCell]="cell"
44
50
  [tableType]="tableType"
45
51
  [colIndex]="colIndex"
46
- [rowIndex]="rowIndex"></th>
52
+ [rowIndex]="rowIndex"
53
+ [attr.aria-expanded]="cell.hasChildren && cell.children.length ? 'true' : 'false'"
54
+ [attr.role]="tableType === 'columnHeader' ? 'columnheader' : 'rowheader'"
55
+ [attr.id]="pivotGridId + (tableType === 'columnHeader' ? 'ch-' : 'rh-') + (rowIndex + 1) + '-' + (colIndex + 1)"></th>
47
56
  <td
48
57
  *ngIf="cell && tableType === 'values'"
49
58
  [kendoPivotGridCell]="cell"
50
59
  tableType="values"
51
60
  [colIndex]="colIndex"
52
- [rowIndex]="rowIndex"></td>
61
+ [rowIndex]="rowIndex"
62
+ role="gridcell"
63
+ [attr.id]="pivotGridId + 'cell-' + (rowIndex + 1) + '-' + (colIndex + 1)"></td>
53
64
  </ng-container>
54
65
  </tr>
55
66
  </tbody>
@@ -60,28 +71,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
60
71
  args: [{
61
72
  selector: 'kendo-pivotgrid-table',
62
73
  template: `
63
- <table class="k-pivotgrid-table">
74
+ <table
75
+ class="k-pivotgrid-table"
76
+ role="presentation">
64
77
  <colgroup>
65
78
  <col
66
79
  *ngFor="let item of headerItems;"
67
80
  [style.width]="tableType !== 'rowHeader' ? colWidth >= 0 ? colWidth + 'px' : '200px' : undefined" />
68
81
  </colgroup>
69
- <tbody class="k-pivotgrid-tbody">
82
+ <tbody class="k-pivotgrid-tbody" role="rowgroup">
70
83
  <tr *ngFor="let row of rows; index as rowIndex"
71
- class="k-pivotgrid-row">
84
+ class="k-pivotgrid-row"
85
+ role="row">
72
86
  <ng-container *ngFor="let cell of row.cells; index as colIndex">
73
87
  <th
74
88
  *ngIf="cell && tableType !== 'values'"
75
89
  [kendoPivotGridCell]="cell"
76
90
  [tableType]="tableType"
77
91
  [colIndex]="colIndex"
78
- [rowIndex]="rowIndex"></th>
92
+ [rowIndex]="rowIndex"
93
+ [attr.aria-expanded]="cell.hasChildren && cell.children.length ? 'true' : 'false'"
94
+ [attr.role]="tableType === 'columnHeader' ? 'columnheader' : 'rowheader'"
95
+ [attr.id]="pivotGridId + (tableType === 'columnHeader' ? 'ch-' : 'rh-') + (rowIndex + 1) + '-' + (colIndex + 1)"></th>
79
96
  <td
80
97
  *ngIf="cell && tableType === 'values'"
81
98
  [kendoPivotGridCell]="cell"
82
99
  tableType="values"
83
100
  [colIndex]="colIndex"
84
- [rowIndex]="rowIndex"></td>
101
+ [rowIndex]="rowIndex"
102
+ role="gridcell"
103
+ [attr.id]="pivotGridId + 'cell-' + (rowIndex + 1) + '-' + (colIndex + 1)"></td>
85
104
  </ng-container>
86
105
  </tr>
87
106
  </tbody>
package/esm2015/util.js CHANGED
@@ -64,3 +64,89 @@ export const syncWheel = (event, tables, prop, axis) => {
64
64
  tables[1][prop] += delta;
65
65
  }
66
66
  };
67
+ /**
68
+ * @hidden
69
+ */
70
+ export function cloneTo(obj, result) {
71
+ for (let field in obj) {
72
+ if (obj.hasOwnProperty(field)) {
73
+ const value = obj[field];
74
+ if (Array.isArray(value)) {
75
+ result[field] = value.slice(0);
76
+ }
77
+ else if (value && typeof value === 'object' && !(value instanceof Date)) {
78
+ result[field] = result[field] || {};
79
+ cloneTo(value, result[field]);
80
+ }
81
+ else {
82
+ result[field] = value;
83
+ }
84
+ }
85
+ }
86
+ }
87
+ /**
88
+ * @hidden
89
+ */
90
+ export function clone(obj) {
91
+ const result = {};
92
+ cloneTo(obj, result);
93
+ return result;
94
+ }
95
+ /**
96
+ * @hidden
97
+ */
98
+ const getDocument = element => element.ownerDocument.documentElement;
99
+ /**
100
+ * @hidden
101
+ */
102
+ const getWindow = element => element.ownerDocument.defaultView;
103
+ /**
104
+ * @hidden
105
+ */
106
+ export const offset = element => {
107
+ const { clientTop, clientLeft } = getDocument(element);
108
+ const { pageYOffset, pageXOffset } = getWindow(element);
109
+ const { top, left } = element.getBoundingClientRect();
110
+ return {
111
+ top: top + pageYOffset - clientTop,
112
+ left: left + pageXOffset - clientLeft
113
+ };
114
+ };
115
+ /**
116
+ * @hidden
117
+ */
118
+ export const matchAriaAttributes = (wrapper) => {
119
+ const rowHeaderRows = wrapper.querySelectorAll('.k-pivotgrid-row-headers .k-pivotgrid-row');
120
+ const colHeaderCells = wrapper.querySelectorAll('.k-pivotgrid-column-headers th');
121
+ const valueTableCells = wrapper.querySelectorAll('.k-pivotgrid-values td');
122
+ rowHeaderRows.forEach((row, index) => {
123
+ const valueCellsIds = filterAndMap(Array.from(valueTableCells), c => c.getAttribute('id').split('-')[4] === (index + 1).toString(), c => c.getAttribute('id'));
124
+ row.setAttribute('aria-owns', valueCellsIds.join(' '));
125
+ });
126
+ valueTableCells.forEach(cell => {
127
+ const cellColIndex = +cell.getAttribute('id').split('-')[5];
128
+ const colHeaderCellsIds = filterAndMap(Array.from(colHeaderCells), c => {
129
+ const headerCellColIndex = +c.getAttribute('id').split('-')[5];
130
+ const headerCellColspan = +c.getAttribute('colspan');
131
+ const colIndexIsEqual = cellColIndex === headerCellColIndex;
132
+ const cellColIndexIsWithinHeaderCellRange = headerCellColspan > 1 && (headerCellColIndex + headerCellColspan - 1 >= cellColIndex);
133
+ return colIndexIsEqual || cellColIndexIsWithinHeaderCellRange;
134
+ }, c => c.getAttribute('id'));
135
+ cell.setAttribute('aria-describedby', colHeaderCellsIds.join(' '));
136
+ });
137
+ };
138
+ /**
139
+ * @hidden
140
+ */
141
+ export const position = (target, before) => {
142
+ const targetRect = offset(target);
143
+ const { offsetWidth, offsetHeight } = target;
144
+ const left = targetRect.left + (before ? 0 : offsetWidth);
145
+ const top = targetRect.top + offsetHeight / 2;
146
+ const height = offsetHeight;
147
+ return { left, top, height };
148
+ };
149
+ /**
150
+ * @hidden
151
+ */
152
+ export const filterAndMap = (arr, predicate, mapper) => arr.reduce((acc, curr) => predicate(curr) ? [...acc, mapper(curr)] : acc, []);