@progress/kendo-react-pivotgrid 5.6.0-next.202208310638 → 5.6.0

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 (40) hide show
  1. package/LICENSE.md +2 -2
  2. package/README.md +4 -4
  3. package/about.md +1 -1
  4. package/dist/cdn/js/kendo-react-pivotgrid.js +1 -1
  5. package/dist/es/PivotGrid.d.ts +14 -1
  6. package/dist/es/PivotGrid.js +69 -18
  7. package/dist/es/components/Cell.d.ts +8 -0
  8. package/dist/es/components/Cell.js +1 -1
  9. package/dist/es/components/HeaderCell.d.ts +4 -0
  10. package/dist/es/components/HeaderCell.js +2 -2
  11. package/dist/es/components/Row.d.ts +8 -0
  12. package/dist/es/components/Row.js +1 -1
  13. package/dist/es/hooks/usePivotLocalDataService.d.ts +6 -0
  14. package/dist/es/hooks/usePivotLocalDataService.js +18 -6
  15. package/dist/es/main.d.ts +2 -1
  16. package/dist/es/main.js +1 -0
  17. package/dist/es/messages/index.d.ts +5 -0
  18. package/dist/es/messages/index.js +5 -0
  19. package/dist/es/package-metadata.js +1 -1
  20. package/dist/es/utils/index.d.ts +13 -2
  21. package/dist/es/utils/index.js +19 -0
  22. package/dist/npm/PivotGrid.d.ts +14 -1
  23. package/dist/npm/PivotGrid.js +68 -17
  24. package/dist/npm/components/Cell.d.ts +8 -0
  25. package/dist/npm/components/Cell.js +1 -1
  26. package/dist/npm/components/HeaderCell.d.ts +4 -0
  27. package/dist/npm/components/HeaderCell.js +2 -2
  28. package/dist/npm/components/Row.d.ts +8 -0
  29. package/dist/npm/components/Row.js +1 -1
  30. package/dist/npm/hooks/usePivotLocalDataService.d.ts +6 -0
  31. package/dist/npm/hooks/usePivotLocalDataService.js +18 -6
  32. package/dist/npm/main.d.ts +2 -1
  33. package/dist/npm/main.js +3 -1
  34. package/dist/npm/messages/index.d.ts +5 -0
  35. package/dist/npm/messages/index.js +6 -1
  36. package/dist/npm/package-metadata.js +1 -1
  37. package/dist/npm/utils/index.d.ts +13 -2
  38. package/dist/npm/utils/index.js +21 -1
  39. package/dist/systemjs/kendo-react-pivotgrid.js +1 -1
  40. package/package.json +15 -12
@@ -15,6 +15,8 @@ exports.PivotGrid = void 0;
15
15
  var React = require("react");
16
16
  var kendo_react_common_1 = require("@progress/kendo-react-common");
17
17
  var package_metadata_1 = require("./package-metadata");
18
+ var kendo_react_intl_1 = require("@progress/kendo-react-intl");
19
+ var messages_1 = require("./messages");
18
20
  var Row_1 = require("./components/Row");
19
21
  var Cell_1 = require("./components/Cell");
20
22
  var useHeaders_1 = require("./hooks/useHeaders");
@@ -33,13 +35,12 @@ exports.PivotGrid = React.forwardRef(function (props, ref) {
33
35
  var _a = __assign(__assign({}, defaultProps), props), rows = _a.rows, rowAxes = _a.rowAxes, columns = _a.columns, columnAxes = _a.columnAxes, data = _a.data;
34
36
  var element = React.useRef(null);
35
37
  var target = React.useRef(null);
36
- React.useImperativeHandle(target, function () { return ({ props: props, element: element.current }); });
37
- React.useImperativeHandle(ref, function () { return target.current; });
38
38
  var rowHeadersTable = React.useRef(null);
39
39
  var columnHeadersTable = React.useRef(null);
40
40
  var rowHeadersContainer = React.useRef(null);
41
41
  var columnHeadersContainer = React.useRef(null);
42
42
  var valuesHeadersContainer = React.useRef(null);
43
+ var localization = (0, kendo_react_intl_1.useLocalization)();
43
44
  var handleRowAxesChange = function (newRowAxes, syntheticEvent) {
44
45
  if (props.onRowAxesChange) {
45
46
  props.onRowAxesChange({
@@ -65,6 +66,16 @@ exports.PivotGrid = React.forwardRef(function (props, ref) {
65
66
  var _d = (0, useHeaders_1.useHeaders)((columnAxes || []).slice(), columnsTree, handleColumnAxesChange), dispatchColumns = _d[1];
66
67
  var _e = (0, kendo_pivotgrid_common_1.toColumns)(columnsTree), columnHeaderRows = _e[0], columnHeaderLeafs = _e[1], columnHeaderBreadth = _e[3];
67
68
  var measures = (0, kendo_pivotgrid_common_1.toData)((data || []).slice(), columnHeaderLeafs, rowHeaderLeafs, columnHeaderBreadth, rowHeaderDepth);
69
+ React.useImperativeHandle(target, function () { return ({
70
+ props: props,
71
+ element: element.current,
72
+ columnHeaderRows: columnHeaderRows,
73
+ rowHeaderRows: rowHeaderRows,
74
+ dataCells: measures,
75
+ rowHeaderBreadth: rowHeaderBreadth,
76
+ columnHeaderBreadth: columnHeaderBreadth
77
+ }); });
78
+ React.useImperativeHandle(ref, function () { return target.current; });
68
79
  var dataColumns = [];
69
80
  var rowHeaderColumns = [];
70
81
  var columnHeadersColumns = [];
@@ -125,6 +136,27 @@ exports.PivotGrid = React.forwardRef(function (props, ref) {
125
136
  element.current.style.gridTemplateColumns = "".concat(rowHeadersTable.current.offsetWidth, "px 1fr");
126
137
  }
127
138
  }, []);
139
+ var navigation = React.useRef(new kendo_pivotgrid_common_1.PivotGridNavigation({ tabIndex: props.tabIndex || 0 }));
140
+ React.useEffect(function () {
141
+ if (element.current) {
142
+ var tabIndex = props.tabIndex || 0;
143
+ navigation.current.stop();
144
+ navigation.current.tabIndex = tabIndex;
145
+ if (props.navigatable) {
146
+ navigation.current.start(element.current);
147
+ var firstCell = navigation.current.first;
148
+ if (firstCell) {
149
+ firstCell.setAttribute('tabindex', String(tabIndex));
150
+ }
151
+ }
152
+ }
153
+ return function () {
154
+ navigation.current.stop();
155
+ };
156
+ }, [props.tabIndex, props.navigatable]);
157
+ React.useEffect(function () {
158
+ navigation.current.update();
159
+ });
128
160
  React.useEffect(function () {
129
161
  if (columnHeadersTable.current) {
130
162
  var observer_1 = new window.ResizeObserver(setRowsTemplate);
@@ -147,14 +179,37 @@ exports.PivotGrid = React.forwardRef(function (props, ref) {
147
179
  return function () { observer_3.disconnect(); };
148
180
  }
149
181
  }, []);
150
- return (React.createElement("div", { ref: element, id: props.id, style: props.style, tabIndex: props.tabIndex, className: (0, kendo_react_common_2.classNames)('k-pivotgrid', props.className) },
151
- React.createElement("span", { className: "k-pivotgrid-empty-cell" }),
182
+ var columnHeaderCellsIds = new Array(columnHeaderRows.length).fill([]).map(function () { return new Array(columnHeaderLeafs.length); });
183
+ columnHeaderRows.forEach(function (row, r) {
184
+ var curColSpan = 0;
185
+ Array.from(row.cells).forEach(function (cell) {
186
+ var expanded = Boolean(cell && cell.children && cell.children.length);
187
+ var id = (cell ? (0, utils_1.generateKey)(cell.normalizedPath)
188
+ + (cell.total ? '|[TOTAL]' : '')
189
+ + (expanded ? '|[EXPANDED]' : '') : '').replace(/\s/g, '-');
190
+ if (cell) {
191
+ for (var colSp = 0; colSp < (cell.colSpan || 1); colSp++) {
192
+ for (var rowSp = 0; rowSp < (cell.rowSpan || 1); rowSp++) {
193
+ var ind = columnHeaderCellsIds[r + rowSp].findIndex(function (val, curInd) { return curInd >= curColSpan && !val; });
194
+ columnHeaderCellsIds[r + rowSp][ind] = id;
195
+ }
196
+ curColSpan++;
197
+ }
198
+ }
199
+ });
200
+ });
201
+ var dataCellsIds = measures.map(function (row) {
202
+ return row.cells.map(function (cell) { return (0, utils_1.generateDataKey)(cell.rowTuple.members, cell.columnTuple.members).replace(/\s/g, '-'); });
203
+ });
204
+ return (React.createElement("div", { ref: element, id: props.id, style: props.style, tabIndex: !props.navigatable ? props.tabIndex : undefined, className: (0, kendo_react_common_2.classNames)('k-pivotgrid', props.className), role: "grid" },
205
+ React.createElement("span", { className: "k-pivotgrid-empty-cell" },
206
+ React.createElement("span", { className: "k-sr-only" }, localization.toLanguageString(messages_1.emptyCellAriaLabel, messages_1.messages[messages_1.emptyCellAriaLabel]))),
152
207
  React.createElement("div", { ref: columnHeadersContainer, className: "k-pivotgrid-column-headers", onScroll: handleHorizontalScroll },
153
- React.createElement("table", { ref: columnHeadersTable, className: "k-pivotgrid-table" },
208
+ React.createElement("table", { ref: columnHeadersTable, className: "k-pivotgrid-table", role: "none" },
154
209
  React.createElement("colgroup", null, columnHeadersColumns),
155
- React.createElement("tbody", { className: "k-pivotgrid-tbody" }, columnHeaderRows.map(function (row) {
210
+ React.createElement("tbody", { className: "k-pivotgrid-tbody", role: 'rowgroup' }, columnHeaderRows.map(function (row, r) {
156
211
  var foundCell = false;
157
- return (React.createElement(ColumnHeadersRowComponent, __assign({ key: row.name }, RowProps), row.cells.map(function (cell, cellIdx) {
212
+ return (React.createElement(ColumnHeadersRowComponent, __assign({ key: row.name, role: "row" }, RowProps), row.cells.map(function (cell, cellIdx) {
158
213
  var first = cellIdx !== 0 && !foundCell;
159
214
  if (cell) {
160
215
  foundCell = true;
@@ -162,28 +217,24 @@ exports.PivotGrid = React.forwardRef(function (props, ref) {
162
217
  var expanded = cell && Boolean(cell.children && cell.children.length);
163
218
  var expandable = cell && (cell.hasChildren && (!cell.total || (cell.total && cell.parent.total)));
164
219
  return cell
165
- ? (React.createElement(ColumnHeadersColumnCellComponent, __assign({}, HeaderCellProps, { key: (0, utils_1.generateKey)(cell.normalizedPath)
166
- + (cell.total ? '|[TOTAL]' : '')
167
- + (expanded ? '|[EXPANDED]' : ''), "data-key": (0, utils_1.generateKey)(cell.normalizedPath)
168
- + (cell.total ? '|[TOTAL]' : '')
169
- + (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))
220
+ ? (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))
170
221
  : null;
171
222
  })));
172
223
  })))),
173
224
  React.createElement("div", { ref: rowHeadersContainer, className: "k-pivotgrid-row-headers" },
174
- React.createElement("table", { ref: rowHeadersTable, className: "k-pivotgrid-table" },
225
+ React.createElement("table", { ref: rowHeadersTable, className: "k-pivotgrid-table", role: "none" },
175
226
  React.createElement("colgroup", null, rowHeaderColumns),
176
- React.createElement("tbody", { className: "k-pivotgrid-tbody" }, rowHeaderRows.map(function (row, rowId) { return (React.createElement(RowHeadersRowComponent, __assign({ key: (0, utils_1.generateKey)(rowHeaderLeafs[rowId].path) }, RowProps, { path: rowHeaderLeafs[rowId].path }), row.cells.filter(Boolean).map(function (cell) { return cell
227
+ React.createElement("tbody", { className: "k-pivotgrid-tbody", role: "rowgroup" }, rowHeaderRows.map(function (row, rowId) { return (React.createElement(RowHeadersRowComponent, __assign({ key: (0, utils_1.generateKey)(rowHeaderLeafs[rowId].path) }, RowProps, { path: rowHeaderLeafs[rowId].path, role: "row", ariaOwns: dataCellsIds[rowId].join(' ') }), row.cells.filter(Boolean).map(function (cell) { return cell
177
228
  ? (React.createElement(RowHeadersCellComponent, __assign({}, HeaderCellProps, { key: (0, utils_1.generateKey)(cell.normalizedPath)
178
229
  + (cell.total ? '|[TOTAL]' : '')
179
230
  + (Boolean(cell.children && cell.children.length) ? '|[EXPANDED]' : ''), "data-key": (0, utils_1.generateKey)(cell.normalizedPath)
180
231
  + (cell.total ? '|[TOTAL]' : '')
181
- + (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))
232
+ + (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))
182
233
  : null; }))); })))),
183
234
  React.createElement("div", { ref: valuesHeadersContainer, className: "k-pivotgrid-values", onScroll: handleValuesContainerScroll },
184
- React.createElement("table", { className: "k-pivotgrid-table" },
235
+ React.createElement("table", { className: "k-pivotgrid-table", role: "none" },
185
236
  React.createElement("colgroup", null, dataColumns),
186
- React.createElement("tbody", { className: "k-pivotgrid-tbody" }, measures.map(function (row, rowId) { return (React.createElement(DataRowComponent, __assign({ key: (0, utils_1.generateKey)(rowHeaderLeafs[rowId].path) }, RowProps, { path: rowHeaderLeafs[rowId].path }), row.cells.map(function (cell, cellId) { return (React.createElement(CellComponent, __assign({ key: "".concat((0, utils_1.generateDataKey)(cell.rowTuple.members, cell.columnTuple.members)), "data-key": "".concat((0, utils_1.generateDataKey)(cell.rowTuple.members, cell.columnTuple.members)) }, 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 }), (cell && cell.data && cell.data.fmtValue) ? cell.data.fmtValue : '\u00A0')); }))); }))))));
237
+ React.createElement("tbody", { className: "k-pivotgrid-tbody", role: "none" }, measures.map(function (row, rowId) { return (React.createElement(DataRowComponent, __assign({ key: (0, utils_1.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')); }))); }))))));
187
238
  });
188
239
  var defaultProps = {
189
240
  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 %}).
@@ -27,7 +27,7 @@ exports.PivotGridCell = React.forwardRef(function (props, ref) {
27
27
  }); });
28
28
  React.useImperativeHandle(ref, function () { return target.current; });
29
29
  var mouseProps = (0, kendo_react_common_1.useMouse)(props, target);
30
- return (React.createElement("td", __assign({ ref: element }, mouseProps, { "data-key": props['data-key'], id: props.id, style: props.style, tabIndex: props.tabIndex, className: (0, kendo_react_common_1.classNames)('k-pivotgrid-cell', {
30
+ 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: (0, kendo_react_common_1.classNames)('k-pivotgrid-cell', {
31
31
  'k-pivotgrid-header-total': props.total
32
32
  }, props.className) }), props.children));
33
33
  });
@@ -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 %}).
@@ -37,13 +37,13 @@ exports.PivotGridHeaderCell = React.forwardRef(function (props, ref) {
37
37
  });
38
38
  }
39
39
  };
40
- return (React.createElement("th", __assign({ ref: element }, mouseProps, { colSpan: props.colSpan, rowSpan: props.rowSpan, "data-key": props['data-key'], id: props.id, style: props.style, tabIndex: props.tabIndex, className: (0, kendo_react_common_1.classNames)('k-pivotgrid-cell', {
40
+ 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: (0, kendo_react_common_1.classNames)('k-pivotgrid-cell', {
41
41
  'k-pivotgrid-header-total': props.total,
42
42
  'k-pivotgrid-header-root': props.root,
43
43
  'k-pivotgrid-expanded': props.expanded,
44
44
  'k-first': props.first
45
45
  }, props.className) }),
46
- props.expandable && (React.createElement(IconComponent, __assign({}, IconProps, { onClick: handleIconClick, name: "chevron-".concat(props.expanded ? 'up' : 'down') }))),
46
+ props.expandable && (React.createElement(IconComponent, __assign({}, IconProps, { onClick: handleIconClick, name: "chevron-".concat(props.expanded ? 'up' : 'down'), "aria-hidden": true }))),
47
47
  props.children));
48
48
  });
49
49
  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 %}).
@@ -26,6 +26,6 @@ exports.PivotGridRow = React.forwardRef(function (props, ref) {
26
26
  }); });
27
27
  React.useImperativeHandle(ref, function () { return target.current; });
28
28
  var mouseProps = (0, kendo_react_common_1.useMouse)(props, target);
29
- return (React.createElement("tr", __assign({ ref: element }, mouseProps, { id: props.id, style: props.style, tabIndex: props.tabIndex, children: props.children, className: (0, kendo_react_common_1.classNames)('k-pivotgrid-row', props.className) })));
29
+ 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: (0, kendo_react_common_1.classNames)('k-pivotgrid-row', props.className) })));
30
30
  });
31
31
  exports.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.
@@ -24,11 +24,13 @@ var stringSeparator = '&';
24
24
  * A [custom React hook](https://reactjs.org/docs/hooks-custom.html) which provides data-binding to local data.
25
25
  */
26
26
  var usePivotLocalDataService = function (args) {
27
- var _a = React.useState(args.defaultColumnAxes || []), columnAxes = _a[0], setColumnAxes = _a[1];
28
- var _b = React.useState(args.defaultRowAxes || []), rowAxes = _b[0], setRowAxes = _b[1];
29
- var _c = React.useState(args.defaultMeasureAxes || []), measureAxes = _c[0], setMeasureAxes = _c[1];
30
- var _d = React.useState(args.defaultSort || []), sort = _d[0], setSort = _d[1];
31
- var _e = React.useState(args.defaultFilter || []), filter = _e[0], setFilter = _e[1];
27
+ var _a = React.useState(true), loading = _a[0], setLoading = _a[1];
28
+ var _b = React.useState(args.defaultColumnAxes || []), columnAxes = _b[0], setColumnAxes = _b[1];
29
+ var _c = React.useState(args.defaultRowAxes || []), rowAxes = _c[0], setRowAxes = _c[1];
30
+ var _d = React.useState(args.defaultMeasureAxes || []), measureAxes = _d[0], setMeasureAxes = _d[1];
31
+ var _e = React.useState(args.defaultSort || []), sort = _e[0], setSort = _e[1];
32
+ var _f = React.useState(args.defaultFilter || []), filter = _f[0], setFilter = _f[1];
33
+ var _g = React.useState(new Map()), dataTree = _g[0], setDataTree = _g[1];
32
34
  var handleRowAxesChange = React.useCallback(function (event) {
33
35
  setRowAxes(event.value);
34
36
  }, []);
@@ -50,7 +52,14 @@ var usePivotLocalDataService = function (args) {
50
52
  var columnSettings = React.useMemo(function () { return rootColumnAxes.split(stringSeparator).map(createAxisSettings); }, [rootColumnAxes, createAxisSettings]);
51
53
  var rowSettings = React.useMemo(function () { return rootRowAxes.split(stringSeparator).map(createAxisSettings); }, [rootRowAxes, createAxisSettings]);
52
54
  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]);
53
- var dataTree = React.useMemo(function () { return (0, kendo_pivotgrid_common_1.createDataTree)(args.data, rowSettings, columnSettings, measuresSettings, bindingFields, filter); }, [args.data, rowSettings, columnSettings, measuresSettings, filter]);
55
+ React.useEffect(function () {
56
+ setLoading(true);
57
+ setTimeout(function () {
58
+ var result = (0, kendo_pivotgrid_common_1.createDataTree)(args.data, rowSettings, columnSettings, measuresSettings, bindingFields, filter);
59
+ setDataTree(result);
60
+ setLoading(false);
61
+ }, 0);
62
+ }, [args.data, rowSettings, columnSettings, measuresSettings, filter]);
54
63
  var configuratorData = React.useMemo(function () { return (0, kendo_pivotgrid_common_1.createFlatSchemaDimensions)(args.dimensions, args.measures); }, [args.dimensions, args.measures]);
55
64
  var dataState = React.useMemo(function () { return (0, kendo_pivotgrid_common_1.createLocalDataState)({
56
65
  dataTree: dataTree,
@@ -84,6 +93,9 @@ var usePivotLocalDataService = function (args) {
84
93
  onRowAxesChange: handleRowAxesChange,
85
94
  onColumnAxesChange: handleColumnAxesChange,
86
95
  onMeasureAxesChange: handleMeasureAxesChange
96
+ },
97
+ state: {
98
+ loading: loading
87
99
  }
88
100
  };
89
101
  };
@@ -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 { PivotGridAxis, AxisDataItem, DimensionField, HierarchyField, KPIField, KPIMeasureField, LevelField, MeasureField, MemberField, PivotDataItem, sumAggregate, averageAggregate, minAggregate, maxAggregate, Aggregate, Dimension, Measure } from '@progress/kendo-pivotgrid-common';
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/npm/main.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.maxAggregate = exports.minAggregate = exports.averageAggregate = exports.sumAggregate = exports.PivotLocalDataService = exports.usePivotLocalDataService = exports.usePivotOLAPService = exports.PivotOLAPService = exports.PivotGridAxisFilterFieldsEditor = exports.PivotGridAxisEditor = exports.PivotGridConfiguratorEditorAxesContext = exports.PivotGridAxesEditor = exports.PivotGridFieldsEditor = exports.PivotGridConfiguratorButton = exports.PivotGridConfiguratorEditor = exports.PivotGridConfigurator = exports.PivotGridContainer = exports.PivotGridHeaderCell = exports.PivotGridCell = exports.PivotGridRow = exports.PivotGridColumn = exports.PivotGrid = void 0;
3
+ exports.maxAggregate = exports.minAggregate = exports.averageAggregate = exports.sumAggregate = exports.dataCells = exports.PivotLocalDataService = exports.usePivotLocalDataService = exports.usePivotOLAPService = exports.PivotOLAPService = exports.PivotGridAxisFilterFieldsEditor = exports.PivotGridAxisEditor = exports.PivotGridConfiguratorEditorAxesContext = exports.PivotGridAxesEditor = exports.PivotGridFieldsEditor = exports.PivotGridConfiguratorButton = exports.PivotGridConfiguratorEditor = exports.PivotGridConfigurator = exports.PivotGridContainer = exports.PivotGridHeaderCell = exports.PivotGridCell = exports.PivotGridRow = exports.PivotGridColumn = exports.PivotGrid = void 0;
4
4
  var PivotGrid_1 = require("./PivotGrid");
5
5
  Object.defineProperty(exports, "PivotGrid", { enumerable: true, get: function () { return PivotGrid_1.PivotGrid; } });
6
6
  var Column_1 = require("./components/Column");
@@ -34,6 +34,8 @@ Object.defineProperty(exports, "usePivotOLAPService", { enumerable: true, get: f
34
34
  var usePivotLocalDataService_1 = require("./hooks/usePivotLocalDataService");
35
35
  Object.defineProperty(exports, "usePivotLocalDataService", { enumerable: true, get: function () { return usePivotLocalDataService_1.usePivotLocalDataService; } });
36
36
  Object.defineProperty(exports, "PivotLocalDataService", { enumerable: true, get: function () { return usePivotLocalDataService_1.PivotLocalDataService; } });
37
+ var utils_1 = require("./utils");
38
+ Object.defineProperty(exports, "dataCells", { enumerable: true, get: function () { return utils_1.dataCells; } });
37
39
  var kendo_pivotgrid_common_1 = require("@progress/kendo-pivotgrid-common");
38
40
  Object.defineProperty(exports, "sumAggregate", { enumerable: true, get: function () { return kendo_pivotgrid_common_1.sumAggregate; } });
39
41
  Object.defineProperty(exports, "averageAggregate", { enumerable: true, get: function () { return kendo_pivotgrid_common_1.averageAggregate; } });
@@ -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,7 +1,11 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.messages = exports.configuratorButtonLabel = exports.configuratorMissingFields = exports.configuratorEditorSearchPlaceholder = exports.configuratorEditorSearchTitle = exports.configuratorMeasuresTitle = exports.configuratorRowsTitle = exports.configuratorColumnsTitle = exports.configuratorApply = exports.configuratorCancel = exports.configuratorTitle = exports.fieldMenuApply = exports.fieldMenuReset = void 0;
4
+ exports.messages = exports.configuratorButtonLabel = exports.configuratorMissingFields = exports.configuratorEditorSearchPlaceholder = exports.configuratorEditorSearchTitle = exports.configuratorMeasuresTitle = exports.configuratorRowsTitle = exports.configuratorColumnsTitle = exports.configuratorApply = exports.configuratorCancel = exports.configuratorTitle = exports.fieldMenuApply = exports.fieldMenuReset = exports.emptyCellAriaLabel = void 0;
5
+ /**
6
+ * @hidden
7
+ */
8
+ exports.emptyCellAriaLabel = 'pivotgrid.emptyCellAriaLabel';
5
9
  /**
6
10
  * @hidden
7
11
  */
@@ -54,6 +58,7 @@ exports.configuratorButtonLabel = 'pivotgrid.configuratorButtonLabel';
54
58
  * @hidden
55
59
  */
56
60
  exports.messages = (_a = {},
61
+ _a[exports.emptyCellAriaLabel] = 'PivotGrid component. Use the arrow keys to navigate.',
57
62
  _a[exports.fieldMenuReset] = 'Reset',
58
63
  _a[exports.fieldMenuApply] = 'Apply',
59
64
  _a[exports.configuratorCancel] = 'Cancel',
@@ -8,7 +8,7 @@ exports.packageMetadata = {
8
8
  name: '@progress/kendo-react-pivotgrid',
9
9
  productName: 'KendoReact',
10
10
  productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
11
- publishDate: 1661927471,
11
+ publishDate: 1662551201,
12
12
  version: '',
13
13
  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'
14
14
  };
@@ -1,5 +1,16 @@
1
- import { AxisDescriptor } from '@progress/kendo-pivotgrid-common';
2
- import { PivotGridField } from '@progress/kendo-pivotgrid-common';
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
  */
@@ -9,7 +9,27 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
9
9
  return to.concat(ar || Array.prototype.slice.call(from));
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.compareFields = exports.findFilters = exports.findFilter = exports.generateDataKey = exports.generateKey = exports.extractDefaultFields = exports.flatMap = exports.recursiveMap = void 0;
12
+ exports.compareFields = exports.findFilters = exports.findFilter = exports.generateDataKey = exports.generateKey = exports.extractDefaultFields = exports.flatMap = exports.recursiveMap = exports.dataCells = void 0;
13
+ var kendo_pivotgrid_common_1 = require("@progress/kendo-pivotgrid-common");
14
+ /**
15
+ * Generates suitable data for Charting visualization.
16
+ *
17
+ * @param rows - The PivotGrid's rows prop.
18
+ * @param columns - The PivotGrid's columns prop.
19
+ * @param data - The PivotGrid's data prop.
20
+ * @returns - Suitable data for Charting visualization.
21
+ */
22
+ var dataCells = function (rows, columns, data) {
23
+ var pRows = JSON.parse(JSON.stringify(rows || []));
24
+ var pColumns = JSON.parse(JSON.stringify(columns || []));
25
+ var pData = JSON.parse(JSON.stringify(data || []));
26
+ var rowsTree = (0, kendo_pivotgrid_common_1.toTree)(pRows);
27
+ var _a = (0, kendo_pivotgrid_common_1.toRows)(rowsTree), rowHeaderLeafs = _a[1], rowHeaderDepth = _a[2];
28
+ var columnsTree = (0, kendo_pivotgrid_common_1.toTree)(pColumns);
29
+ var _b = (0, kendo_pivotgrid_common_1.toColumns)(columnsTree), columnHeaderLeafs = _b[1], columnHeaderBreadth = _b[3];
30
+ return (0, kendo_pivotgrid_common_1.toData)(pData, columnHeaderLeafs, rowHeaderLeafs, columnHeaderBreadth, rowHeaderDepth);
31
+ };
32
+ exports.dataCells = dataCells;
13
33
  /**
14
34
  * @hidden
15
35
  */