@progress/kendo-angular-pivotgrid 0.1.5 → 0.2.0-dev.202208181339

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 +512 -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 +71 -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 +350 -59
  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 +38 -13
  32. package/esm2015/util.js +86 -0
  33. package/fesm2015/kendo-angular-pivotgrid.js +1744 -198
  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 +160 -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 +12 -6
  42. package/pivotgrid.component.d.ts +34 -3
  43. package/pivotgrid.module.d.ts +15 -7
  44. package/rendering/pivotgrid-table.component.d.ts +5 -3
  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' ?
@@ -27,27 +30,37 @@ export class PivotGridTableComponent {
27
30
  }
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
- PivotGridTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: PivotGridTableComponent, selector: "kendo-pivotgrid-table", inputs: { tableType: "tableType" }, ngImport: i0, template: `
31
- <table class="k-pivotgrid-table">
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: `
34
+ <table
35
+ class="k-pivotgrid-table"
36
+ role="presentation">
32
37
  <colgroup>
33
- <col *ngFor="let item of headerItems;" />
38
+ <col
39
+ *ngFor="let item of headerItems;"
40
+ [style.width]="tableType !== 'rowHeader' ? colWidth >= 0 ? colWidth + 'px' : '200px' : undefined" />
34
41
  </colgroup>
35
- <tbody class="k-pivotgrid-tbody">
42
+ <tbody class="k-pivotgrid-tbody" role="rowgroup">
36
43
  <tr *ngFor="let row of rows; index as rowIndex"
37
- class="k-pivotgrid-row">
44
+ class="k-pivotgrid-row"
45
+ role="row">
38
46
  <ng-container *ngFor="let cell of row.cells; index as colIndex">
39
47
  <th
40
48
  *ngIf="cell && tableType !== 'values'"
41
49
  [kendoPivotGridCell]="cell"
42
50
  [tableType]="tableType"
43
51
  [colIndex]="colIndex"
44
- [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>
45
56
  <td
46
57
  *ngIf="cell && tableType === 'values'"
47
58
  [kendoPivotGridCell]="cell"
48
59
  tableType="values"
49
60
  [colIndex]="colIndex"
50
- [rowIndex]="rowIndex"></td>
61
+ [rowIndex]="rowIndex"
62
+ role="gridcell"
63
+ [attr.id]="pivotGridId + 'cell-' + (rowIndex + 1) + '-' + (colIndex + 1)"></td>
51
64
  </ng-container>
52
65
  </tr>
53
66
  </tbody>
@@ -58,26 +71,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
58
71
  args: [{
59
72
  selector: 'kendo-pivotgrid-table',
60
73
  template: `
61
- <table class="k-pivotgrid-table">
74
+ <table
75
+ class="k-pivotgrid-table"
76
+ role="presentation">
62
77
  <colgroup>
63
- <col *ngFor="let item of headerItems;" />
78
+ <col
79
+ *ngFor="let item of headerItems;"
80
+ [style.width]="tableType !== 'rowHeader' ? colWidth >= 0 ? colWidth + 'px' : '200px' : undefined" />
64
81
  </colgroup>
65
- <tbody class="k-pivotgrid-tbody">
82
+ <tbody class="k-pivotgrid-tbody" role="rowgroup">
66
83
  <tr *ngFor="let row of rows; index as rowIndex"
67
- class="k-pivotgrid-row">
84
+ class="k-pivotgrid-row"
85
+ role="row">
68
86
  <ng-container *ngFor="let cell of row.cells; index as colIndex">
69
87
  <th
70
88
  *ngIf="cell && tableType !== 'values'"
71
89
  [kendoPivotGridCell]="cell"
72
90
  [tableType]="tableType"
73
91
  [colIndex]="colIndex"
74
- [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>
75
96
  <td
76
97
  *ngIf="cell && tableType === 'values'"
77
98
  [kendoPivotGridCell]="cell"
78
99
  tableType="values"
79
100
  [colIndex]="colIndex"
80
- [rowIndex]="rowIndex"></td>
101
+ [rowIndex]="rowIndex"
102
+ role="gridcell"
103
+ [attr.id]="pivotGridId + 'cell-' + (rowIndex + 1) + '-' + (colIndex + 1)"></td>
81
104
  </ng-container>
82
105
  </tr>
83
106
  </tbody>
@@ -86,4 +109,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
86
109
  }]
87
110
  }], ctorParameters: function () { return [{ type: i1.PivotGridDataService }]; }, propDecorators: { tableType: [{
88
111
  type: Input
112
+ }], colWidth: [{
113
+ type: Input
89
114
  }] } });
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, []);