@progress/kendo-react-pivotgrid 5.6.0-dev.202208291418 → 5.6.0-dev.202209021051
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +2 -2
- package/README.md +4 -4
- package/about.md +1 -1
- package/dist/cdn/js/kendo-react-pivotgrid.js +1 -1
- package/dist/es/PivotGrid.d.ts +14 -1
- package/dist/es/PivotGrid.js +68 -17
- package/dist/es/components/Cell.d.ts +8 -0
- package/dist/es/components/Cell.js +1 -1
- package/dist/es/components/HeaderCell.d.ts +4 -0
- package/dist/es/components/HeaderCell.js +2 -2
- package/dist/es/components/Row.d.ts +8 -0
- package/dist/es/components/Row.js +1 -1
- package/dist/es/hooks/usePivotLocalDataService.d.ts +6 -0
- package/dist/es/hooks/usePivotLocalDataService.js +18 -6
- package/dist/es/main.d.ts +2 -1
- package/dist/es/main.js +1 -0
- package/dist/es/messages/index.d.ts +5 -0
- package/dist/es/messages/index.js +5 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/utils/index.d.ts +13 -2
- package/dist/es/utils/index.js +19 -0
- package/dist/es/utils/navigation.d.ts +22 -0
- package/dist/es/utils/navigation.js +265 -0
- package/dist/npm/PivotGrid.d.ts +14 -1
- package/dist/npm/PivotGrid.js +68 -17
- package/dist/npm/components/Cell.d.ts +8 -0
- package/dist/npm/components/Cell.js +1 -1
- package/dist/npm/components/HeaderCell.d.ts +4 -0
- package/dist/npm/components/HeaderCell.js +2 -2
- package/dist/npm/components/Row.d.ts +8 -0
- package/dist/npm/components/Row.js +1 -1
- package/dist/npm/hooks/usePivotLocalDataService.d.ts +6 -0
- package/dist/npm/hooks/usePivotLocalDataService.js +18 -6
- package/dist/npm/main.d.ts +2 -1
- package/dist/npm/main.js +3 -1
- package/dist/npm/messages/index.d.ts +5 -0
- package/dist/npm/messages/index.js +6 -1
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/utils/index.d.ts +13 -2
- package/dist/npm/utils/index.js +21 -1
- package/dist/npm/utils/navigation.d.ts +22 -0
- package/dist/npm/utils/navigation.js +268 -0
- package/dist/systemjs/kendo-react-pivotgrid.js +1 -1
- package/package.json +15 -12
package/dist/es/PivotGrid.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { PivotGridCellProps } from './components/Cell';
|
|
|
4
4
|
import { PivotGridHeaderCellProps } from './components/HeaderCell';
|
|
5
5
|
import { PivotGridColumnProps } from './components/Column';
|
|
6
6
|
import { CustomComponent } from '@progress/kendo-react-common';
|
|
7
|
-
import { PivotGridAxis, PivotDataItem, Tuple } from '@progress/kendo-pivotgrid-common';
|
|
7
|
+
import { PivotGridAxis, PivotDataItem, Tuple, AxisRow } from '@progress/kendo-pivotgrid-common';
|
|
8
8
|
import { PivotGridAxesChangeEvent } from './models';
|
|
9
9
|
/**
|
|
10
10
|
* Represents the props of the [KendoReact PivotGrid component]({% slug api_pivotgrid_pivotgrid %}).
|
|
@@ -26,6 +26,11 @@ export interface PivotGridProps {
|
|
|
26
26
|
* Sets the `tabIndex` property of the top-most element of the PivotGrid.
|
|
27
27
|
*/
|
|
28
28
|
tabIndex?: number;
|
|
29
|
+
/**
|
|
30
|
+
* If set to `true`, the user can use dedicated shortcuts to interact with the PivotGrid.
|
|
31
|
+
* By default, navigation is disabled.
|
|
32
|
+
*/
|
|
33
|
+
navigatable?: boolean;
|
|
29
34
|
/**
|
|
30
35
|
* Sets the `data` of the PivotGrid.
|
|
31
36
|
*/
|
|
@@ -157,6 +162,14 @@ export interface PivotGridProps {
|
|
|
157
162
|
export interface PivotGridHandle {
|
|
158
163
|
element: HTMLDivElement | null;
|
|
159
164
|
props: PivotGridProps;
|
|
165
|
+
columnHeaderRows: AxisRow[];
|
|
166
|
+
rowHeaderRows: AxisRow[];
|
|
167
|
+
dataCells: {
|
|
168
|
+
row: string[];
|
|
169
|
+
cells: PivotDataItem[];
|
|
170
|
+
}[];
|
|
171
|
+
rowHeaderBreadth: number;
|
|
172
|
+
columnHeaderBreadth: number;
|
|
160
173
|
}
|
|
161
174
|
/**
|
|
162
175
|
* Represents the [KendoReact PivotGrid component]({% slug api_pivotgrid_pivotgridprops %}).
|
package/dist/es/PivotGrid.js
CHANGED
|
@@ -12,6 +12,8 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import * as React from 'react';
|
|
13
13
|
import { validatePackage } from '@progress/kendo-react-common';
|
|
14
14
|
import { packageMetadata } from './package-metadata';
|
|
15
|
+
import { useLocalization } from '@progress/kendo-react-intl';
|
|
16
|
+
import { messages, emptyCellAriaLabel } from './messages';
|
|
15
17
|
import { PivotGridRow } from './components/Row';
|
|
16
18
|
import { PivotGridCell } from './components/Cell';
|
|
17
19
|
import { useHeaders, HEADERS_ACTION } from './hooks/useHeaders';
|
|
@@ -20,6 +22,7 @@ import { useHorizontalScrollSync } from './hooks/useHorizontalScrollSync';
|
|
|
20
22
|
import { useVerticalScrollSync } from './hooks/useVerticalScrollSync';
|
|
21
23
|
import { PivotGridColumn } from './components/Column';
|
|
22
24
|
import { generateKey, generateDataKey } from './utils';
|
|
25
|
+
import { PivotGridNavigation } from './utils/navigation';
|
|
23
26
|
import { classNames, setScrollbarWidth, useCustomComponent } from '@progress/kendo-react-common';
|
|
24
27
|
import { toColumns, toRows, toTree, toData } from '@progress/kendo-pivotgrid-common';
|
|
25
28
|
/**
|
|
@@ -30,13 +33,12 @@ export var PivotGrid = React.forwardRef(function (props, ref) {
|
|
|
30
33
|
var _a = __assign(__assign({}, defaultProps), props), rows = _a.rows, rowAxes = _a.rowAxes, columns = _a.columns, columnAxes = _a.columnAxes, data = _a.data;
|
|
31
34
|
var element = React.useRef(null);
|
|
32
35
|
var target = React.useRef(null);
|
|
33
|
-
React.useImperativeHandle(target, function () { return ({ props: props, element: element.current }); });
|
|
34
|
-
React.useImperativeHandle(ref, function () { return target.current; });
|
|
35
36
|
var rowHeadersTable = React.useRef(null);
|
|
36
37
|
var columnHeadersTable = React.useRef(null);
|
|
37
38
|
var rowHeadersContainer = React.useRef(null);
|
|
38
39
|
var columnHeadersContainer = React.useRef(null);
|
|
39
40
|
var valuesHeadersContainer = React.useRef(null);
|
|
41
|
+
var localization = useLocalization();
|
|
40
42
|
var handleRowAxesChange = function (newRowAxes, syntheticEvent) {
|
|
41
43
|
if (props.onRowAxesChange) {
|
|
42
44
|
props.onRowAxesChange({
|
|
@@ -62,6 +64,16 @@ export var PivotGrid = React.forwardRef(function (props, ref) {
|
|
|
62
64
|
var _d = useHeaders((columnAxes || []).slice(), columnsTree, handleColumnAxesChange), dispatchColumns = _d[1];
|
|
63
65
|
var _e = toColumns(columnsTree), columnHeaderRows = _e[0], columnHeaderLeafs = _e[1], columnHeaderBreadth = _e[3];
|
|
64
66
|
var measures = toData((data || []).slice(), columnHeaderLeafs, rowHeaderLeafs, columnHeaderBreadth, rowHeaderDepth);
|
|
67
|
+
React.useImperativeHandle(target, function () { return ({
|
|
68
|
+
props: props,
|
|
69
|
+
element: element.current,
|
|
70
|
+
columnHeaderRows: columnHeaderRows,
|
|
71
|
+
rowHeaderRows: rowHeaderRows,
|
|
72
|
+
dataCells: measures,
|
|
73
|
+
rowHeaderBreadth: rowHeaderBreadth,
|
|
74
|
+
columnHeaderBreadth: columnHeaderBreadth
|
|
75
|
+
}); });
|
|
76
|
+
React.useImperativeHandle(ref, function () { return target.current; });
|
|
65
77
|
var dataColumns = [];
|
|
66
78
|
var rowHeaderColumns = [];
|
|
67
79
|
var columnHeadersColumns = [];
|
|
@@ -122,6 +134,27 @@ export var PivotGrid = React.forwardRef(function (props, ref) {
|
|
|
122
134
|
element.current.style.gridTemplateColumns = "".concat(rowHeadersTable.current.offsetWidth, "px 1fr");
|
|
123
135
|
}
|
|
124
136
|
}, []);
|
|
137
|
+
var navigation = React.useRef(new PivotGridNavigation({ tabIndex: props.tabIndex || 0 }));
|
|
138
|
+
React.useEffect(function () {
|
|
139
|
+
if (element.current) {
|
|
140
|
+
var tabIndex = props.tabIndex || 0;
|
|
141
|
+
navigation.current.stop();
|
|
142
|
+
navigation.current.tabIndex = tabIndex;
|
|
143
|
+
if (props.navigatable) {
|
|
144
|
+
navigation.current.start(element.current);
|
|
145
|
+
var firstCell = navigation.current.first;
|
|
146
|
+
if (firstCell) {
|
|
147
|
+
firstCell.setAttribute('tabindex', String(tabIndex));
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return function () {
|
|
152
|
+
navigation.current.stop();
|
|
153
|
+
};
|
|
154
|
+
}, [props.tabIndex, props.navigatable]);
|
|
155
|
+
React.useEffect(function () {
|
|
156
|
+
navigation.current.update();
|
|
157
|
+
});
|
|
125
158
|
React.useEffect(function () {
|
|
126
159
|
if (columnHeadersTable.current) {
|
|
127
160
|
var observer_1 = new window.ResizeObserver(setRowsTemplate);
|
|
@@ -144,14 +177,36 @@ export var PivotGrid = React.forwardRef(function (props, ref) {
|
|
|
144
177
|
return function () { observer_3.disconnect(); };
|
|
145
178
|
}
|
|
146
179
|
}, []);
|
|
147
|
-
|
|
148
|
-
|
|
180
|
+
var columnHeaderCellsIds = new Array(columnHeaderRows.length).fill([]).map(function () { return new Array(columnHeaderLeafs.length); });
|
|
181
|
+
columnHeaderRows.forEach(function (row, r) {
|
|
182
|
+
var curColSpan = 0;
|
|
183
|
+
Array.from(row.cells).forEach(function (cell) {
|
|
184
|
+
var expanded = Boolean(cell && cell.children && cell.children.length);
|
|
185
|
+
var id = (cell ? generateKey(cell.normalizedPath)
|
|
186
|
+
+ (cell.total ? '|[TOTAL]' : '')
|
|
187
|
+
+ (expanded ? '|[EXPANDED]' : '') : '').replace(/\s/g, '-');
|
|
188
|
+
if (cell) {
|
|
189
|
+
for (var colSp = 0; colSp < (cell.colSpan || 1); colSp++) {
|
|
190
|
+
for (var rowSp = 0; rowSp < (cell.rowSpan || 1); rowSp++) {
|
|
191
|
+
var ind = columnHeaderCellsIds[r + rowSp].findIndex(function (val, curInd) { return curInd >= curColSpan && !val; });
|
|
192
|
+
columnHeaderCellsIds[r + rowSp][ind] = id;
|
|
193
|
+
}
|
|
194
|
+
curColSpan++;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
var dataCellsIds = measures.map(function (row) {
|
|
200
|
+
return row.cells.map(function (cell) { return generateDataKey(cell.rowTuple.members, cell.columnTuple.members).replace(/\s/g, '-'); });
|
|
201
|
+
});
|
|
202
|
+
return (React.createElement("div", { ref: element, id: props.id, style: props.style, tabIndex: !props.navigatable ? props.tabIndex : undefined, className: classNames('k-pivotgrid', props.className), role: "grid" },
|
|
203
|
+
React.createElement("span", { className: "k-pivotgrid-empty-cell", title: localization.toLanguageString(emptyCellAriaLabel, messages[emptyCellAriaLabel]) }),
|
|
149
204
|
React.createElement("div", { ref: columnHeadersContainer, className: "k-pivotgrid-column-headers", onScroll: handleHorizontalScroll },
|
|
150
|
-
React.createElement("table", { ref: columnHeadersTable, className: "k-pivotgrid-table" },
|
|
205
|
+
React.createElement("table", { ref: columnHeadersTable, className: "k-pivotgrid-table", role: "none" },
|
|
151
206
|
React.createElement("colgroup", null, columnHeadersColumns),
|
|
152
|
-
React.createElement("tbody", { className: "k-pivotgrid-tbody" }, columnHeaderRows.map(function (row) {
|
|
207
|
+
React.createElement("tbody", { className: "k-pivotgrid-tbody", role: 'rowgroup' }, columnHeaderRows.map(function (row, r) {
|
|
153
208
|
var foundCell = false;
|
|
154
|
-
return (React.createElement(ColumnHeadersRowComponent, __assign({ key: row.name }, RowProps), row.cells.map(function (cell, cellIdx) {
|
|
209
|
+
return (React.createElement(ColumnHeadersRowComponent, __assign({ key: row.name, role: "row" }, RowProps), row.cells.map(function (cell, cellIdx) {
|
|
155
210
|
var first = cellIdx !== 0 && !foundCell;
|
|
156
211
|
if (cell) {
|
|
157
212
|
foundCell = true;
|
|
@@ -159,28 +214,24 @@ export var PivotGrid = React.forwardRef(function (props, ref) {
|
|
|
159
214
|
var expanded = cell && Boolean(cell.children && cell.children.length);
|
|
160
215
|
var expandable = cell && (cell.hasChildren && (!cell.total || (cell.total && cell.parent.total)));
|
|
161
216
|
return cell
|
|
162
|
-
? (React.createElement(ColumnHeadersColumnCellComponent, __assign({}, HeaderCellProps, { key:
|
|
163
|
-
+ (cell.total ? '|[TOTAL]' : '')
|
|
164
|
-
+ (expanded ? '|[EXPANDED]' : ''), "data-key": generateKey(cell.normalizedPath)
|
|
165
|
-
+ (cell.total ? '|[TOTAL]' : '')
|
|
166
|
-
+ (expanded ? '|[EXPANDED]' : ''), columnPath: cell.normalizedPath, rowSpan: cell.rowSpan || undefined, colSpan: cell.colSpan || undefined, onIconClick: handleColumnCellClick, dataItem: cell, expanded: expanded, expandable: expandable, total: cell.total, first: first, root: cell.levelNum === 0 }), cell.caption))
|
|
217
|
+
? (React.createElement(ColumnHeadersColumnCellComponent, __assign({}, HeaderCellProps, { key: columnHeaderCellsIds[r][cellIdx], "data-key": columnHeaderCellsIds[r][cellIdx], id: columnHeaderCellsIds[r][cellIdx], columnPath: cell.normalizedPath, rowSpan: cell.rowSpan || undefined, colSpan: cell.colSpan || undefined, onIconClick: handleColumnCellClick, dataItem: cell, expanded: expanded, expandable: expandable, total: cell.total, first: first, root: cell.levelNum === 0, role: "columnheader" }), cell.caption))
|
|
167
218
|
: null;
|
|
168
219
|
})));
|
|
169
220
|
})))),
|
|
170
221
|
React.createElement("div", { ref: rowHeadersContainer, className: "k-pivotgrid-row-headers" },
|
|
171
|
-
React.createElement("table", { ref: rowHeadersTable, className: "k-pivotgrid-table" },
|
|
222
|
+
React.createElement("table", { ref: rowHeadersTable, className: "k-pivotgrid-table", role: "none" },
|
|
172
223
|
React.createElement("colgroup", null, rowHeaderColumns),
|
|
173
|
-
React.createElement("tbody", { className: "k-pivotgrid-tbody" }, rowHeaderRows.map(function (row, rowId) { return (React.createElement(RowHeadersRowComponent, __assign({ key: generateKey(rowHeaderLeafs[rowId].path) }, RowProps, { path: rowHeaderLeafs[rowId].path }), row.cells.filter(Boolean).map(function (cell) { return cell
|
|
224
|
+
React.createElement("tbody", { className: "k-pivotgrid-tbody", role: "rowgroup" }, rowHeaderRows.map(function (row, rowId) { return (React.createElement(RowHeadersRowComponent, __assign({ key: generateKey(rowHeaderLeafs[rowId].path) }, RowProps, { path: rowHeaderLeafs[rowId].path, role: "row", ariaOwns: dataCellsIds[rowId].join(' ') }), row.cells.filter(Boolean).map(function (cell) { return cell
|
|
174
225
|
? (React.createElement(RowHeadersCellComponent, __assign({}, HeaderCellProps, { key: generateKey(cell.normalizedPath)
|
|
175
226
|
+ (cell.total ? '|[TOTAL]' : '')
|
|
176
227
|
+ (Boolean(cell.children && cell.children.length) ? '|[EXPANDED]' : ''), "data-key": generateKey(cell.normalizedPath)
|
|
177
228
|
+ (cell.total ? '|[TOTAL]' : '')
|
|
178
|
-
+ (Boolean(cell.children && cell.children.length) ? '|[EXPANDED]' : ''), rowPath: cell.normalizedPath, rowSpan: cell.rowSpan || undefined, colSpan: cell.colSpan || undefined, dataItem: cell, expanded: Boolean(cell.children && cell.children.length), expandable: cell.hasChildren && !cell.total, total: cell.total, onIconClick: handleRowCellClick, root: cell.levelNum === 0 }), cell.caption))
|
|
229
|
+
+ (Boolean(cell.children && cell.children.length) ? '|[EXPANDED]' : ''), rowPath: cell.normalizedPath, rowSpan: cell.rowSpan || undefined, colSpan: cell.colSpan || undefined, dataItem: cell, expanded: Boolean(cell.children && cell.children.length), expandable: cell.hasChildren && !cell.total, total: cell.total, onIconClick: handleRowCellClick, root: cell.levelNum === 0, role: "rowheader" }), cell.caption))
|
|
179
230
|
: null; }))); })))),
|
|
180
231
|
React.createElement("div", { ref: valuesHeadersContainer, className: "k-pivotgrid-values", onScroll: handleValuesContainerScroll },
|
|
181
|
-
React.createElement("table", { className: "k-pivotgrid-table" },
|
|
232
|
+
React.createElement("table", { className: "k-pivotgrid-table", role: "none" },
|
|
182
233
|
React.createElement("colgroup", null, dataColumns),
|
|
183
|
-
React.createElement("tbody", { className: "k-pivotgrid-tbody" }, measures.map(function (row, rowId) { return (React.createElement(DataRowComponent, __assign({ key: generateKey(rowHeaderLeafs[rowId].path) }, RowProps, { path: rowHeaderLeafs[rowId].path }), row.cells.map(function (cell, cellId) { return (React.createElement(CellComponent, __assign({ key:
|
|
234
|
+
React.createElement("tbody", { className: "k-pivotgrid-tbody", role: "none" }, measures.map(function (row, rowId) { return (React.createElement(DataRowComponent, __assign({ key: generateKey(rowHeaderLeafs[rowId].path) }, RowProps, { path: rowHeaderLeafs[rowId].path, role: "none" }), row.cells.map(function (cell, cellId) { return (React.createElement(CellComponent, __assign({ key: dataCellsIds[rowId][cellId], "data-key": dataCellsIds[rowId][cellId], id: dataCellsIds[rowId][cellId] }, CellProps, { rowPath: cell.rowTuple.members.map(function (m) { return m.name; }), columnPath: cell.columnTuple.members.map(function (m) { return m.name; }), dataItem: cell, total: rowHeaderLeafs[rowId].total || columnHeaderLeafs[cellId].total, role: "gridcell", ariaDescribedby: columnHeaderCellsIds.map(function (r) { return r[cellId]; }).join(' ') }), (cell && cell.data && cell.data.fmtValue) ? cell.data.fmtValue : '\u00A0')); }))); }))))));
|
|
184
235
|
});
|
|
185
236
|
var defaultProps = {
|
|
186
237
|
rowAxes: [],
|
|
@@ -50,6 +50,14 @@ export interface PivotGridCellProps extends KendoMouse<PivotGridCellHandle, HTML
|
|
|
50
50
|
* Indicates if the current cell represents a `total` value.
|
|
51
51
|
*/
|
|
52
52
|
total?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Sets the `role` property of the top-most element of the PivotGridCell.
|
|
55
|
+
*/
|
|
56
|
+
role?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the `aria-describedby` property of the top-most element of the PivotGridCell.
|
|
59
|
+
*/
|
|
60
|
+
ariaDescribedby?: string;
|
|
53
61
|
}
|
|
54
62
|
/**
|
|
55
63
|
* Represents the [KendoReact PivotGridCell component]({% slug api_pivotgrid_pivotgridcellprops %}).
|
|
@@ -24,7 +24,7 @@ export var PivotGridCell = React.forwardRef(function (props, ref) {
|
|
|
24
24
|
}); });
|
|
25
25
|
React.useImperativeHandle(ref, function () { return target.current; });
|
|
26
26
|
var mouseProps = useMouse(props, target);
|
|
27
|
-
return (React.createElement("td", __assign({ ref: element }, mouseProps, {
|
|
27
|
+
return (React.createElement("td", __assign({ ref: element }, mouseProps, { id: props.id, style: props.style, tabIndex: props.tabIndex, role: props.role, "aria-describedby": props.ariaDescribedby, className: classNames('k-pivotgrid-cell', {
|
|
28
28
|
'k-pivotgrid-header-total': props.total
|
|
29
29
|
}, props.className) }), props.children));
|
|
30
30
|
});
|
|
@@ -85,6 +85,10 @@ export interface PivotGridHeaderCellProps extends KendoMouse<PivotGridHeaderCell
|
|
|
85
85
|
* A callback, fired whenever the `icon` is clicked.
|
|
86
86
|
*/
|
|
87
87
|
onIconClick?: (args: KendoMouseEvent<PivotGridHeaderCellHandle, HTMLSpanElement>) => void;
|
|
88
|
+
/**
|
|
89
|
+
* Sets the `role` property of the top-most element of the PivotGridHeaderCell.
|
|
90
|
+
*/
|
|
91
|
+
role?: string;
|
|
88
92
|
}
|
|
89
93
|
/**
|
|
90
94
|
* Represents the [KendoReact PivotGridHeaderCell component]({% slug api_pivotgrid_pivotgridheadercellprops %}).
|
|
@@ -34,13 +34,13 @@ export var PivotGridHeaderCell = React.forwardRef(function (props, ref) {
|
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
return (React.createElement("th", __assign({ ref: element }, mouseProps, { colSpan: props.colSpan, rowSpan: props.rowSpan,
|
|
37
|
+
return (React.createElement("th", __assign({ ref: element }, mouseProps, { colSpan: props.colSpan, rowSpan: props.rowSpan, id: props.id, style: props.style, tabIndex: props.tabIndex, role: props.role }, (props.expandable ? { 'aria-expanded': props.expanded } : {}), { className: classNames('k-pivotgrid-cell', {
|
|
38
38
|
'k-pivotgrid-header-total': props.total,
|
|
39
39
|
'k-pivotgrid-header-root': props.root,
|
|
40
40
|
'k-pivotgrid-expanded': props.expanded,
|
|
41
41
|
'k-first': props.first
|
|
42
42
|
}, props.className) }),
|
|
43
|
-
props.expandable && (React.createElement(IconComponent, __assign({}, IconProps, { onClick: handleIconClick, name: "
|
|
43
|
+
props.expandable && (React.createElement(IconComponent, __assign({}, IconProps, { onClick: handleIconClick, name: "chevron-".concat(props.expanded ? 'up' : 'down'), "aria-hidden": true }))),
|
|
44
44
|
props.children));
|
|
45
45
|
});
|
|
46
46
|
var defaultProps = {
|
|
@@ -35,6 +35,14 @@ export interface PivotGridRowProps extends KendoMouse<PivotGridRowHandle, HTMLTa
|
|
|
35
35
|
* Represents the `path` leading to the current `row`.
|
|
36
36
|
*/
|
|
37
37
|
path?: string[];
|
|
38
|
+
/**
|
|
39
|
+
* Sets the `role` property of the top-most element of the PivotGridRow.
|
|
40
|
+
*/
|
|
41
|
+
role?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Sets the `aria-owns` property of the top-most element of the PivotGridRow.
|
|
44
|
+
*/
|
|
45
|
+
ariaOwns?: string;
|
|
38
46
|
}
|
|
39
47
|
/**
|
|
40
48
|
* Represents the [KendoReact PivotGridRow component]({% slug api_pivotgrid_pivotgridrowprops %}).
|
|
@@ -23,6 +23,6 @@ export var PivotGridRow = React.forwardRef(function (props, ref) {
|
|
|
23
23
|
}); });
|
|
24
24
|
React.useImperativeHandle(ref, function () { return target.current; });
|
|
25
25
|
var mouseProps = useMouse(props, target);
|
|
26
|
-
return (React.createElement("tr", __assign({ ref: element }, mouseProps, { id: props.id, style: props.style, tabIndex: props.tabIndex, children: props.children, className: classNames('k-pivotgrid-row', props.className) })));
|
|
26
|
+
return (React.createElement("tr", __assign({ ref: element }, mouseProps, { id: props.id, style: props.style, tabIndex: props.tabIndex, children: props.children, role: props.role, "aria-owns": props.ariaOwns, className: classNames('k-pivotgrid-row', props.className) })));
|
|
27
27
|
});
|
|
28
28
|
PivotGridRow.displayName = 'KendoReactPivotGridRow';
|
|
@@ -53,6 +53,12 @@ export interface PivotLocalDataServiceState {
|
|
|
53
53
|
* Represents the `PivotGridConfigurator` component props.
|
|
54
54
|
*/
|
|
55
55
|
configuratorProps: PivotGridConfiguratorProps;
|
|
56
|
+
/**
|
|
57
|
+
* Represents an object containing additional state data.
|
|
58
|
+
*/
|
|
59
|
+
state: {
|
|
60
|
+
loading: boolean;
|
|
61
|
+
};
|
|
56
62
|
}
|
|
57
63
|
/**
|
|
58
64
|
* A [custom React hook](https://reactjs.org/docs/hooks-custom.html) which provides data-binding to local data.
|
|
@@ -21,11 +21,13 @@ var stringSeparator = '&';
|
|
|
21
21
|
* A [custom React hook](https://reactjs.org/docs/hooks-custom.html) which provides data-binding to local data.
|
|
22
22
|
*/
|
|
23
23
|
export var usePivotLocalDataService = function (args) {
|
|
24
|
-
var _a = React.useState(
|
|
25
|
-
var _b = React.useState(args.
|
|
26
|
-
var _c = React.useState(args.
|
|
27
|
-
var _d = React.useState(args.
|
|
28
|
-
var _e = React.useState(args.
|
|
24
|
+
var _a = React.useState(true), loading = _a[0], setLoading = _a[1];
|
|
25
|
+
var _b = React.useState(args.defaultColumnAxes || []), columnAxes = _b[0], setColumnAxes = _b[1];
|
|
26
|
+
var _c = React.useState(args.defaultRowAxes || []), rowAxes = _c[0], setRowAxes = _c[1];
|
|
27
|
+
var _d = React.useState(args.defaultMeasureAxes || []), measureAxes = _d[0], setMeasureAxes = _d[1];
|
|
28
|
+
var _e = React.useState(args.defaultSort || []), sort = _e[0], setSort = _e[1];
|
|
29
|
+
var _f = React.useState(args.defaultFilter || []), filter = _f[0], setFilter = _f[1];
|
|
30
|
+
var _g = React.useState(new Map()), dataTree = _g[0], setDataTree = _g[1];
|
|
29
31
|
var handleRowAxesChange = React.useCallback(function (event) {
|
|
30
32
|
setRowAxes(event.value);
|
|
31
33
|
}, []);
|
|
@@ -47,7 +49,14 @@ export var usePivotLocalDataService = function (args) {
|
|
|
47
49
|
var columnSettings = React.useMemo(function () { return rootColumnAxes.split(stringSeparator).map(createAxisSettings); }, [rootColumnAxes, createAxisSettings]);
|
|
48
50
|
var rowSettings = React.useMemo(function () { return rootRowAxes.split(stringSeparator).map(createAxisSettings); }, [rootRowAxes, createAxisSettings]);
|
|
49
51
|
var measuresSettings = React.useMemo(function () { return measureAxes.map(function (m) { return args.measures.find(function (meas) { return String(meas.name) === String(m.name); }); }).filter(Boolean); }, [measureAxes, args.measures]);
|
|
50
|
-
|
|
52
|
+
React.useEffect(function () {
|
|
53
|
+
setLoading(true);
|
|
54
|
+
setTimeout(function () {
|
|
55
|
+
var result = createDataTree(args.data, rowSettings, columnSettings, measuresSettings, bindingFields, filter);
|
|
56
|
+
setDataTree(result);
|
|
57
|
+
setLoading(false);
|
|
58
|
+
}, 0);
|
|
59
|
+
}, [args.data, rowSettings, columnSettings, measuresSettings, filter]);
|
|
51
60
|
var configuratorData = React.useMemo(function () { return createFlatSchemaDimensions(args.dimensions, args.measures); }, [args.dimensions, args.measures]);
|
|
52
61
|
var dataState = React.useMemo(function () { return createLocalDataState({
|
|
53
62
|
dataTree: dataTree,
|
|
@@ -81,6 +90,9 @@ export var usePivotLocalDataService = function (args) {
|
|
|
81
90
|
onRowAxesChange: handleRowAxesChange,
|
|
82
91
|
onColumnAxesChange: handleColumnAxesChange,
|
|
83
92
|
onMeasureAxesChange: handleMeasureAxesChange
|
|
93
|
+
},
|
|
94
|
+
state: {
|
|
95
|
+
loading: loading
|
|
84
96
|
}
|
|
85
97
|
};
|
|
86
98
|
};
|
package/dist/es/main.d.ts
CHANGED
|
@@ -14,4 +14,5 @@ export { PivotGridAxisFilterFieldsEditor, PivotGridAxisFilterFieldsEditorProps,
|
|
|
14
14
|
export { PivotOLAPService, usePivotOLAPService, PivotOLAPServiceArgs, PivotOLAPServiceProps, PivotOLAPServiceState } from './hooks/usePivotOLAPService';
|
|
15
15
|
export { usePivotLocalDataService, PivotLocalDataService, PivotLocalDataServiceArgs, PivotLocalDataServiceProps, PivotLocalDataServiceState } from './hooks/usePivotLocalDataService';
|
|
16
16
|
export { PivotGridTreeViewData, PivotGridAxesChangeEvent, PivotGridConfiguratorAxesChangeEvent, PivotGridConfiguratorSortChangeEvent, PivotGridConfiguratorFilterChangeEvent } from './models';
|
|
17
|
-
export {
|
|
17
|
+
export { dataCells } from './utils';
|
|
18
|
+
export { PivotGridAxis, AxisDataItem, AxisRow, DimensionField, HierarchyField, KPIField, KPIMeasureField, LevelField, MeasureField, Member, MemberField, PivotDataItem, Tuple, sumAggregate, averageAggregate, minAggregate, maxAggregate, Aggregate, Dimension, Measure } from '@progress/kendo-pivotgrid-common';
|
package/dist/es/main.js
CHANGED
|
@@ -13,4 +13,5 @@ export { PivotGridAxisEditor } from './components/AxisEditor';
|
|
|
13
13
|
export { PivotGridAxisFilterFieldsEditor } from './components/AxisFilterFieldsEditor';
|
|
14
14
|
export { PivotOLAPService, usePivotOLAPService } from './hooks/usePivotOLAPService';
|
|
15
15
|
export { usePivotLocalDataService, PivotLocalDataService } from './hooks/usePivotLocalDataService';
|
|
16
|
+
export { dataCells } from './utils';
|
|
16
17
|
export { sumAggregate, averageAggregate, minAggregate, maxAggregate } from '@progress/kendo-pivotgrid-common';
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
*/
|
|
4
|
+
export declare const emptyCellAriaLabel = "pivotgrid.emptyCellAriaLabel";
|
|
1
5
|
/**
|
|
2
6
|
* @hidden
|
|
3
7
|
*/
|
|
@@ -50,6 +54,7 @@ export declare const configuratorButtonLabel = "pivotgrid.configuratorButtonLabe
|
|
|
50
54
|
* @hidden
|
|
51
55
|
*/
|
|
52
56
|
export declare const messages: {
|
|
57
|
+
"pivotgrid.emptyCellAriaLabel": string;
|
|
53
58
|
"pivotgrid.fieldMenuReset": string;
|
|
54
59
|
"pivotgrid.fieldMenuApply": string;
|
|
55
60
|
"pivotgrid.configuratorCancel": string;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
var _a;
|
|
2
|
+
/**
|
|
3
|
+
* @hidden
|
|
4
|
+
*/
|
|
5
|
+
export var emptyCellAriaLabel = 'pivotgrid.emptyCellAriaLabel';
|
|
2
6
|
/**
|
|
3
7
|
* @hidden
|
|
4
8
|
*/
|
|
@@ -51,6 +55,7 @@ export var configuratorButtonLabel = 'pivotgrid.configuratorButtonLabel';
|
|
|
51
55
|
* @hidden
|
|
52
56
|
*/
|
|
53
57
|
export var messages = (_a = {},
|
|
58
|
+
_a[emptyCellAriaLabel] = 'PivotGrid component. Use the arrow keys to navigate.',
|
|
54
59
|
_a[fieldMenuReset] = 'Reset',
|
|
55
60
|
_a[fieldMenuApply] = 'Apply',
|
|
56
61
|
_a[configuratorCancel] = 'Cancel',
|
|
@@ -5,7 +5,7 @@ export var packageMetadata = {
|
|
|
5
5
|
name: '@progress/kendo-react-pivotgrid',
|
|
6
6
|
productName: 'KendoReact',
|
|
7
7
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
8
|
-
publishDate:
|
|
8
|
+
publishDate: 1662115406,
|
|
9
9
|
version: '',
|
|
10
10
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
11
11
|
};
|
package/dist/es/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
import { AxisDescriptor } from '@progress/kendo-pivotgrid-common';
|
|
2
|
-
|
|
1
|
+
import { AxisDescriptor, PivotDataItem, PivotGridField, Tuple } from '@progress/kendo-pivotgrid-common';
|
|
2
|
+
/**
|
|
3
|
+
* Generates suitable data for Charting visualization.
|
|
4
|
+
*
|
|
5
|
+
* @param rows - The PivotGrid's rows prop.
|
|
6
|
+
* @param columns - The PivotGrid's columns prop.
|
|
7
|
+
* @param data - The PivotGrid's data prop.
|
|
8
|
+
* @returns - Suitable data for Charting visualization.
|
|
9
|
+
*/
|
|
10
|
+
export declare const dataCells: (rows?: Tuple[], columns?: Tuple[], data?: PivotDataItem[]) => {
|
|
11
|
+
row: string[];
|
|
12
|
+
cells: PivotDataItem[];
|
|
13
|
+
}[];
|
|
3
14
|
/**
|
|
4
15
|
* @hidden
|
|
5
16
|
*/
|
package/dist/es/utils/index.js
CHANGED
|
@@ -7,6 +7,25 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
7
7
|
}
|
|
8
8
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
9
|
};
|
|
10
|
+
import { toColumns, toData, toRows, toTree } from '@progress/kendo-pivotgrid-common';
|
|
11
|
+
/**
|
|
12
|
+
* Generates suitable data for Charting visualization.
|
|
13
|
+
*
|
|
14
|
+
* @param rows - The PivotGrid's rows prop.
|
|
15
|
+
* @param columns - The PivotGrid's columns prop.
|
|
16
|
+
* @param data - The PivotGrid's data prop.
|
|
17
|
+
* @returns - Suitable data for Charting visualization.
|
|
18
|
+
*/
|
|
19
|
+
export var dataCells = function (rows, columns, data) {
|
|
20
|
+
var pRows = JSON.parse(JSON.stringify(rows || []));
|
|
21
|
+
var pColumns = JSON.parse(JSON.stringify(columns || []));
|
|
22
|
+
var pData = JSON.parse(JSON.stringify(data || []));
|
|
23
|
+
var rowsTree = toTree(pRows);
|
|
24
|
+
var _a = toRows(rowsTree), rowHeaderLeafs = _a[1], rowHeaderDepth = _a[2];
|
|
25
|
+
var columnsTree = toTree(pColumns);
|
|
26
|
+
var _b = toColumns(columnsTree), columnHeaderLeafs = _b[1], columnHeaderBreadth = _b[3];
|
|
27
|
+
return toData(pData, columnHeaderLeafs, rowHeaderLeafs, columnHeaderBreadth, rowHeaderDepth);
|
|
28
|
+
};
|
|
10
29
|
/**
|
|
11
30
|
* @hidden
|
|
12
31
|
*/
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
*/
|
|
4
|
+
declare class PivotGridNavigation {
|
|
5
|
+
root: HTMLElement | null;
|
|
6
|
+
get elements(): HTMLElement[];
|
|
7
|
+
get first(): HTMLElement | null;
|
|
8
|
+
get last(): HTMLElement | null;
|
|
9
|
+
selectors: string[];
|
|
10
|
+
tabIndex: number;
|
|
11
|
+
private eventHandlers;
|
|
12
|
+
private mouseEvents;
|
|
13
|
+
private keyboardEvents;
|
|
14
|
+
constructor(settings: {
|
|
15
|
+
tabIndex: number;
|
|
16
|
+
});
|
|
17
|
+
start(root: HTMLElement): void;
|
|
18
|
+
stop(): void;
|
|
19
|
+
focusElement(element: HTMLElement | null, previous: HTMLElement | null): void;
|
|
20
|
+
update: () => void;
|
|
21
|
+
}
|
|
22
|
+
export { PivotGridNavigation };
|