@progress/kendo-react-pivotgrid 6.1.1 → 7.0.0-develop.10
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 +1 -1
- package/{dist/npm/PivotGrid.d.ts → PivotGrid.d.ts} +4 -0
- package/{dist/es/components → components}/AxesEditor.d.ts +4 -6
- package/{dist/npm/components → components}/AxisEditor.d.ts +4 -0
- package/{dist/es/components → components}/AxisFilterFieldsEditor.d.ts +4 -0
- package/{dist/npm/components → components}/Cell.d.ts +4 -0
- package/{dist/es/components → components}/Column.d.ts +4 -0
- package/{dist/npm/components → components}/Configurator.d.ts +4 -0
- package/{dist/npm/components → components}/ConfiguratorButton.d.ts +4 -0
- package/{dist/es/components → components}/ConfiguratorEditor.d.ts +4 -0
- package/{dist/es/components → components}/Container.d.ts +4 -0
- package/components/EditorContext.d.ts +11 -0
- package/{dist/npm/components → components}/FieldsEditor.d.ts +4 -0
- package/{dist/es/components → components}/HeaderCell.d.ts +4 -0
- package/{dist/es/components → components}/Row.d.ts +4 -0
- package/dist/cdn/js/kendo-react-pivotgrid.js +5 -2
- package/hooks/index.d.ts +6 -0
- package/{dist/es/hooks → hooks}/useExpansion.d.ts +5 -1
- package/{dist/es/hooks → hooks}/useHeaders.d.ts +5 -1
- package/hooks/useHorizontalScrollSync.d.ts +9 -0
- package/{dist/es/hooks → hooks}/usePivotConfiguratorEditor.d.ts +5 -1
- package/{dist/npm/hooks → hooks}/usePivotLocalDataService.d.ts +4 -0
- package/{dist/npm/hooks → hooks}/usePivotOLAPService.d.ts +4 -0
- package/hooks/useVerticalScrollSync.d.ts +9 -0
- package/index.d.ts +22 -0
- package/index.js +5 -0
- package/index.mjs +1585 -0
- package/{dist/es/messages → messages}/index.d.ts +4 -0
- package/{dist/es/models → models}/index.d.ts +4 -1
- package/package-metadata.d.ts +9 -0
- package/package.json +36 -54
- package/{dist/es/shared → shared}/PivotGridConfiguratorEditorEventsContext.d.ts +4 -0
- package/{dist/npm/shared → shared}/PivotGridConfiguratorEditorStateContext.d.ts +4 -0
- package/shared/index.d.ts +6 -0
- package/{dist/es/utils → utils}/index.d.ts +4 -0
- package/about.md +0 -3
- package/dist/cdn/js/kendo-react-pivotgrid.js.LICENSE.txt +0 -14
- package/dist/es/PivotGrid.d.ts +0 -177
- package/dist/es/PivotGrid.js +0 -245
- package/dist/es/components/AxesEditor.js +0 -43
- package/dist/es/components/AxisEditor.d.ts +0 -52
- package/dist/es/components/AxisEditor.js +0 -138
- package/dist/es/components/AxisFilterFieldsEditor.js +0 -150
- package/dist/es/components/Cell.d.ts +0 -65
- package/dist/es/components/Cell.js +0 -31
- package/dist/es/components/Column.js +0 -33
- package/dist/es/components/Configurator.d.ts +0 -125
- package/dist/es/components/Configurator.js +0 -118
- package/dist/es/components/ConfiguratorButton.d.ts +0 -40
- package/dist/es/components/ConfiguratorButton.js +0 -39
- package/dist/es/components/ConfiguratorEditor.js +0 -191
- package/dist/es/components/Container.js +0 -22
- package/dist/es/components/FieldsEditor.d.ts +0 -74
- package/dist/es/components/FieldsEditor.js +0 -90
- package/dist/es/components/HeaderCell.js +0 -50
- package/dist/es/components/Row.js +0 -28
- package/dist/es/hooks/index.d.ts +0 -2
- package/dist/es/hooks/index.js +0 -2
- package/dist/es/hooks/useExpansion.js +0 -89
- package/dist/es/hooks/useHeaders.js +0 -25
- package/dist/es/hooks/useHorizontalScrollSync.d.ts +0 -5
- package/dist/es/hooks/useHorizontalScrollSync.js +0 -27
- package/dist/es/hooks/usePivotConfiguratorEditor.js +0 -103
- package/dist/es/hooks/usePivotLocalDataService.d.ts +0 -79
- package/dist/es/hooks/usePivotLocalDataService.js +0 -105
- package/dist/es/hooks/usePivotOLAPService.d.ts +0 -41
- package/dist/es/hooks/usePivotOLAPService.js +0 -371
- package/dist/es/hooks/useVerticalScrollSync.d.ts +0 -5
- package/dist/es/hooks/useVerticalScrollSync.js +0 -27
- package/dist/es/main.d.ts +0 -18
- package/dist/es/main.js +0 -17
- package/dist/es/messages/index.js +0 -71
- package/dist/es/models/index.js +0 -1
- package/dist/es/package-metadata.d.ts +0 -5
- package/dist/es/package-metadata.js +0 -11
- package/dist/es/shared/PivotGridConfiguratorEditorEventsContext.js +0 -5
- package/dist/es/shared/PivotGridConfiguratorEditorStateContext.d.ts +0 -6
- package/dist/es/shared/PivotGridConfiguratorEditorStateContext.js +0 -18
- package/dist/es/shared/index.d.ts +0 -2
- package/dist/es/shared/index.js +0 -2
- package/dist/es/utils/index.js +0 -118
- package/dist/npm/PivotGrid.js +0 -248
- package/dist/npm/components/AxesEditor.d.ts +0 -46
- package/dist/npm/components/AxesEditor.js +0 -46
- package/dist/npm/components/AxisEditor.js +0 -141
- package/dist/npm/components/AxisFilterFieldsEditor.d.ts +0 -114
- package/dist/npm/components/AxisFilterFieldsEditor.js +0 -153
- package/dist/npm/components/Cell.js +0 -34
- package/dist/npm/components/Column.d.ts +0 -42
- package/dist/npm/components/Column.js +0 -36
- package/dist/npm/components/Configurator.js +0 -121
- package/dist/npm/components/ConfiguratorButton.js +0 -42
- package/dist/npm/components/ConfiguratorEditor.d.ts +0 -126
- package/dist/npm/components/ConfiguratorEditor.js +0 -194
- package/dist/npm/components/Container.d.ts +0 -46
- package/dist/npm/components/Container.js +0 -25
- package/dist/npm/components/FieldsEditor.js +0 -93
- package/dist/npm/components/HeaderCell.d.ts +0 -96
- package/dist/npm/components/HeaderCell.js +0 -53
- package/dist/npm/components/Row.d.ts +0 -50
- package/dist/npm/components/Row.js +0 -31
- package/dist/npm/hooks/index.d.ts +0 -2
- package/dist/npm/hooks/index.js +0 -18
- package/dist/npm/hooks/useExpansion.d.ts +0 -19
- package/dist/npm/hooks/useExpansion.js +0 -93
- package/dist/npm/hooks/useHeaders.d.ts +0 -12
- package/dist/npm/hooks/useHeaders.js +0 -30
- package/dist/npm/hooks/useHorizontalScrollSync.d.ts +0 -5
- package/dist/npm/hooks/useHorizontalScrollSync.js +0 -31
- package/dist/npm/hooks/usePivotConfiguratorEditor.d.ts +0 -83
- package/dist/npm/hooks/usePivotConfiguratorEditor.js +0 -107
- package/dist/npm/hooks/usePivotLocalDataService.js +0 -110
- package/dist/npm/hooks/usePivotOLAPService.js +0 -376
- package/dist/npm/hooks/useVerticalScrollSync.d.ts +0 -5
- package/dist/npm/hooks/useVerticalScrollSync.js +0 -31
- package/dist/npm/main.d.ts +0 -18
- package/dist/npm/main.js +0 -43
- package/dist/npm/messages/index.d.ts +0 -70
- package/dist/npm/messages/index.js +0 -74
- package/dist/npm/models/index.d.ts +0 -45
- package/dist/npm/models/index.js +0 -2
- package/dist/npm/package-metadata.d.ts +0 -5
- package/dist/npm/package-metadata.js +0 -14
- package/dist/npm/shared/PivotGridConfiguratorEditorEventsContext.d.ts +0 -13
- package/dist/npm/shared/PivotGridConfiguratorEditorEventsContext.js +0 -8
- package/dist/npm/shared/PivotGridConfiguratorEditorStateContext.js +0 -21
- package/dist/npm/shared/index.d.ts +0 -2
- package/dist/npm/shared/index.js +0 -18
- package/dist/npm/utils/index.d.ts +0 -47
- package/dist/npm/utils/index.js +0 -130
- package/dist/systemjs/kendo-react-pivotgrid.js +0 -1
- package/e2e-next/basic.tests.ts +0 -24
package/dist/es/hooks/index.d.ts
DELETED
package/dist/es/hooks/index.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
-
if (ar || !(i in from)) {
|
|
4
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
-
ar[i] = from[i];
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
-
};
|
|
10
|
-
import * as React from 'react';
|
|
11
|
-
/**
|
|
12
|
-
* @hidden
|
|
13
|
-
*/
|
|
14
|
-
export var EXPANSION_ACTION;
|
|
15
|
-
(function (EXPANSION_ACTION) {
|
|
16
|
-
EXPANSION_ACTION["toggle"] = "EXPAND_TOGGLE";
|
|
17
|
-
EXPANSION_ACTION["expand"] = "EXPAND_EXPAND";
|
|
18
|
-
EXPANSION_ACTION["collapse"] = "EXPAND_COLLAPSE";
|
|
19
|
-
})(EXPANSION_ACTION || (EXPANSION_ACTION = {}));
|
|
20
|
-
/**
|
|
21
|
-
* @hidden
|
|
22
|
-
*/
|
|
23
|
-
var expansionReducer = function (state, action, compare) {
|
|
24
|
-
switch (action.type) {
|
|
25
|
-
case EXPANSION_ACTION.toggle:
|
|
26
|
-
if (Array.isArray(state)) {
|
|
27
|
-
if (state.find(function (s) { return compare(s, action.payload); })) {
|
|
28
|
-
return __spreadArray([], state.filter(function (s) { return !compare(s, action.payload); }), true);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
return __spreadArray(__spreadArray([], state, true), [action.payload], false);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
if (compare(state, action.payload)) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
return action.payload;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
case EXPANSION_ACTION.expand:
|
|
43
|
-
if (Array.isArray(state)) {
|
|
44
|
-
if (!state.find(function (s) { return compare(s, action.payload); })) {
|
|
45
|
-
return __spreadArray(__spreadArray([], state, true), [action.payload], false);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
if (!compare(state, action.payload)) {
|
|
50
|
-
return action.payload;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
break;
|
|
54
|
-
case EXPANSION_ACTION.collapse:
|
|
55
|
-
if (Array.isArray(state)) {
|
|
56
|
-
if (state.find(function (s) { return compare(s, action.payload); })) {
|
|
57
|
-
return __spreadArray([], state.filter(function (s) { return !compare(s, action.payload); }), true);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
if (compare(state, action.payload)) {
|
|
62
|
-
null;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
break;
|
|
66
|
-
default:
|
|
67
|
-
return state;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* @hidden
|
|
72
|
-
*/
|
|
73
|
-
export var useExpansion = function (defaultValue, callback, target, compare) {
|
|
74
|
-
if (defaultValue === void 0) { defaultValue = []; }
|
|
75
|
-
if (compare === void 0) { compare = function (a, b) { return a === b; }; }
|
|
76
|
-
var _a = React.useState(defaultValue), expanded = _a[0], setExpanded = _a[1];
|
|
77
|
-
var handleExpandAction = function (action, syntheticEvent) {
|
|
78
|
-
var newState = expansionReducer(expanded, action, compare);
|
|
79
|
-
if (callback) {
|
|
80
|
-
callback.call(undefined, {
|
|
81
|
-
value: newState,
|
|
82
|
-
target: target.current,
|
|
83
|
-
syntheticEvent: syntheticEvent
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
setExpanded(newState);
|
|
87
|
-
};
|
|
88
|
-
return [expanded, handleExpandAction];
|
|
89
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { headersReducer } from '@progress/kendo-pivotgrid-common';
|
|
13
|
-
export { HEADERS_ACTION } from '@progress/kendo-pivotgrid-common';
|
|
14
|
-
/**
|
|
15
|
-
* @hidden
|
|
16
|
-
*/
|
|
17
|
-
export var useHeaders = function (prop, tree, onChange) {
|
|
18
|
-
var handleHeadersAction = function (action, event) {
|
|
19
|
-
var newHeaders = headersReducer(prop, __assign(__assign({}, action), { tree: tree }));
|
|
20
|
-
if (onChange) {
|
|
21
|
-
onChange(newHeaders, event);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
return [prop, handleHeadersAction];
|
|
25
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* @hidden
|
|
4
|
-
*/
|
|
5
|
-
export var useHorizontalScrollSync = function () {
|
|
6
|
-
var elements = [];
|
|
7
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
8
|
-
elements[_i] = arguments[_i];
|
|
9
|
-
}
|
|
10
|
-
var AF = React.useRef();
|
|
11
|
-
var handleScroll = function (event) {
|
|
12
|
-
if (AF.current !== undefined) {
|
|
13
|
-
window.cancelAnimationFrame(AF.current);
|
|
14
|
-
}
|
|
15
|
-
var target = event.currentTarget;
|
|
16
|
-
var scroll = target.scrollLeft;
|
|
17
|
-
elements.forEach(function (elementRef) {
|
|
18
|
-
var element = elementRef.current;
|
|
19
|
-
if (element && element !== target) {
|
|
20
|
-
AF.current = window.requestAnimationFrame(function () {
|
|
21
|
-
element.scrollLeft = Math.round(scroll);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
return handleScroll;
|
|
27
|
-
};
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import * as React from 'react';
|
|
13
|
-
import { useExpansion, EXPANSION_ACTION } from './useExpansion';
|
|
14
|
-
import { compareFields } from '../utils';
|
|
15
|
-
import { PIVOT_CONFIGURATOR_ACTION as COMMON_CONFIGURATOR_ACTION, configuratorReducer } from '@progress/kendo-pivotgrid-common';
|
|
16
|
-
var EXTENDED_CONFIGURATOR_ACTION;
|
|
17
|
-
(function (EXTENDED_CONFIGURATOR_ACTION) {
|
|
18
|
-
EXTENDED_CONFIGURATOR_ACTION["toggleExpansion"] = "PIVOT_CONFIGURATOR_ACTION_TOGGLE_EXPANSION";
|
|
19
|
-
})(EXTENDED_CONFIGURATOR_ACTION || (EXTENDED_CONFIGURATOR_ACTION = {}));
|
|
20
|
-
;
|
|
21
|
-
/**
|
|
22
|
-
* @hidden
|
|
23
|
-
*/
|
|
24
|
-
export var PIVOT_CONFIGURATOR_ACTION = __assign(__assign({}, COMMON_CONFIGURATOR_ACTION), EXTENDED_CONFIGURATOR_ACTION);
|
|
25
|
-
;
|
|
26
|
-
/**
|
|
27
|
-
* @hidden
|
|
28
|
-
*/
|
|
29
|
-
export var usePivotConfiguratorEditor = function (props, target) {
|
|
30
|
-
var rowAxes = props.valueGetter('rowAxes');
|
|
31
|
-
var columnAxes = props.valueGetter('columnAxes');
|
|
32
|
-
var measureAxes = props.valueGetter('measureAxes');
|
|
33
|
-
var sort = props.valueGetter('sort');
|
|
34
|
-
var filter = props.valueGetter('filter');
|
|
35
|
-
var _a = useExpansion([], undefined, target, compareFields), expanded = _a[0], dispatchExpansion = _a[1];
|
|
36
|
-
var _b = React.useState(null), dragItem = _b[0], setDragItem = _b[1];
|
|
37
|
-
var _c = React.useState(null), dropZone = _c[0], setDropZone = _c[1];
|
|
38
|
-
var _d = React.useState(null), dropTarget = _d[0], setDropTarget = _d[1];
|
|
39
|
-
var _e = React.useState(null), dropDirection = _e[0], setDropDirection = _e[1];
|
|
40
|
-
var handlePivotConfiguratorEditorAction = function (action, syntheticEvent) {
|
|
41
|
-
switch (action.type) {
|
|
42
|
-
case PIVOT_CONFIGURATOR_ACTION.toggleExpansion: {
|
|
43
|
-
dispatchExpansion({ type: EXPANSION_ACTION.toggle, payload: action.payload }, syntheticEvent);
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
default:
|
|
47
|
-
var newState = configuratorReducer({
|
|
48
|
-
filter: (action.override && action.override.filter !== undefined) ? action.override.filter : filter,
|
|
49
|
-
sort: (action.override && action.override.sort !== undefined) ? action.override.sort : sort,
|
|
50
|
-
rowAxes: (action.override && action.override.rowAxes !== undefined) ? action.override.rowAxes : rowAxes,
|
|
51
|
-
columnAxes: (action.override && action.override.columnAxes !== undefined) ? action.override.columnAxes : columnAxes,
|
|
52
|
-
measureAxes: (action.override && action.override.measureAxes !== undefined) ? action.override.measureAxes : measureAxes,
|
|
53
|
-
dragItem: (action.override && action.override.dragItem !== undefined) ? action.override.dragItem : dragItem,
|
|
54
|
-
dropDirection: (action.override && action.override.dropDirection !== undefined) ? action.override.dropDirection : dropDirection,
|
|
55
|
-
dropTarget: (action.override && action.override.dropTarget !== undefined) ? action.override.dropTarget : dropTarget,
|
|
56
|
-
dropZone: (action.override && action.override.dropZone !== undefined) ? action.override.dropZone : dropZone
|
|
57
|
-
}, action);
|
|
58
|
-
if (newState.columnAxes !== undefined) {
|
|
59
|
-
props.onChange('columnAxes', { value: newState.columnAxes });
|
|
60
|
-
}
|
|
61
|
-
if (newState.rowAxes !== undefined) {
|
|
62
|
-
props.onChange('rowAxes', { value: newState.rowAxes });
|
|
63
|
-
}
|
|
64
|
-
if (newState.measureAxes !== undefined) {
|
|
65
|
-
props.onChange('measureAxes', { value: newState.measureAxes });
|
|
66
|
-
}
|
|
67
|
-
if (newState.sort !== undefined) {
|
|
68
|
-
props.onChange('sort', { value: newState.sort });
|
|
69
|
-
}
|
|
70
|
-
if (newState.filter !== undefined) {
|
|
71
|
-
props.onChange('filter', { value: newState.filter });
|
|
72
|
-
}
|
|
73
|
-
if (newState.dropDirection !== undefined) {
|
|
74
|
-
setDropDirection(newState.dropDirection);
|
|
75
|
-
}
|
|
76
|
-
if (newState.dropTarget !== undefined) {
|
|
77
|
-
setDropTarget(newState.dropTarget);
|
|
78
|
-
}
|
|
79
|
-
if (newState.dropZone !== undefined) {
|
|
80
|
-
setDropZone(newState.dropZone);
|
|
81
|
-
}
|
|
82
|
-
if (newState.dragItem !== undefined) {
|
|
83
|
-
setDragItem(newState.dragItem);
|
|
84
|
-
}
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
return [
|
|
89
|
-
{
|
|
90
|
-
dragItem: dragItem,
|
|
91
|
-
dropTarget: dropTarget,
|
|
92
|
-
dropZone: dropZone,
|
|
93
|
-
dropDirection: dropDirection,
|
|
94
|
-
columnAxes: columnAxes,
|
|
95
|
-
rowAxes: rowAxes,
|
|
96
|
-
measureAxes: measureAxes,
|
|
97
|
-
sort: sort,
|
|
98
|
-
filter: filter,
|
|
99
|
-
expanded: expanded
|
|
100
|
-
},
|
|
101
|
-
handlePivotConfiguratorEditorAction
|
|
102
|
-
];
|
|
103
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { PivotGridAxis, Measure, Dimension } from '@progress/kendo-pivotgrid-common';
|
|
2
|
-
import { SortDescriptor, FilterDescriptor } from '@progress/kendo-data-query';
|
|
3
|
-
import { PivotGridProps } from '../PivotGrid';
|
|
4
|
-
import { PivotGridConfiguratorProps } from '../components/Configurator';
|
|
5
|
-
/**
|
|
6
|
-
* Represents the arguments of the [usePivotLocalDataService]({% slug api_pivotgrid_usepivotlocaldataservice %}) hook.
|
|
7
|
-
*/
|
|
8
|
-
export interface PivotLocalDataServiceArgs {
|
|
9
|
-
/**
|
|
10
|
-
* Represents the dimensions object of the [usePivotLocalDataService]({% slug api_pivotgrid_usepivotlocaldataservice %}) hook and the [PivotLocalDataService]({% slug api_pivotgrid_pivotlocaldataservice %}) component.
|
|
11
|
-
*/
|
|
12
|
-
dimensions: {
|
|
13
|
-
[key: string]: Dimension;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Represents the measures collection of the [usePivotLocalDataService]({% slug api_pivotgrid_usepivotlocaldataservice %}) hook and the [PivotLocalDataService]({% slug api_pivotgrid_pivotlocaldataservice %}) component.
|
|
17
|
-
*/
|
|
18
|
-
measures: Measure[];
|
|
19
|
-
/**
|
|
20
|
-
* Represents the local data of the [usePivotLocalDataService]({% slug api_pivotgrid_usepivotlocaldataservice %}) hook and the [PivotLocalDataService]({% slug api_pivotgrid_pivotlocaldataservice %}) component.
|
|
21
|
-
*/
|
|
22
|
-
data: any[];
|
|
23
|
-
/**
|
|
24
|
-
* Represents the default column axes configuration of the [usePivotLocalDataService]({% slug api_pivotgrid_usepivotlocaldataservice %}) hook and the [PivotLocalDataService]({% slug api_pivotgrid_pivotlocaldataservice %}) component.
|
|
25
|
-
*/
|
|
26
|
-
defaultColumnAxes: PivotGridAxis[];
|
|
27
|
-
/**
|
|
28
|
-
* Represents the default row axes configuration of the [usePivotLocalDataService]({% slug api_pivotgrid_usepivotlocaldataservice %}) hook and the [PivotLocalDataService]({% slug api_pivotgrid_pivotlocaldataservice %}) component.
|
|
29
|
-
*/
|
|
30
|
-
defaultRowAxes: PivotGridAxis[];
|
|
31
|
-
/**
|
|
32
|
-
* Represents the default measure axes configuration of the [usePivotLocalDataService]({% slug api_pivotgrid_usepivotlocaldataservice %}) hook and the [PivotLocalDataService]({% slug api_pivotgrid_pivotlocaldataservice %}) component.
|
|
33
|
-
*/
|
|
34
|
-
defaultMeasureAxes: PivotGridAxis[];
|
|
35
|
-
/**
|
|
36
|
-
* Represents the default sort descriptors of the [usePivotLocalDataService]({% slug api_pivotgrid_usepivotlocaldataservice %}) hook and the [PivotLocalDataService]({% slug api_pivotgrid_pivotlocaldataservice %}) component.
|
|
37
|
-
*/
|
|
38
|
-
defaultSort: SortDescriptor[];
|
|
39
|
-
/**
|
|
40
|
-
* Represents the default filter descriptors of the [usePivotLocalDataService]({% slug api_pivotgrid_usepivotlocaldataservice %}) hook and the [PivotLocalDataService]({% slug api_pivotgrid_pivotlocaldataservice %}) component.
|
|
41
|
-
*/
|
|
42
|
-
defaultFilter: FilterDescriptor[];
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Represents the `state` of the [usePivotLocalDataService]({% slug api_pivotgrid_usepivotlocaldataservice %}) hook and the [PivotLocalDataService]({% slug api_pivotgrid_pivotlocaldataservice %}) component.
|
|
46
|
-
*/
|
|
47
|
-
export interface PivotLocalDataServiceState {
|
|
48
|
-
/**
|
|
49
|
-
* Represents the `PivotGrid` component props.
|
|
50
|
-
*/
|
|
51
|
-
pivotProps: PivotGridProps;
|
|
52
|
-
/**
|
|
53
|
-
* Represents the `PivotGridConfigurator` component props.
|
|
54
|
-
*/
|
|
55
|
-
configuratorProps: PivotGridConfiguratorProps;
|
|
56
|
-
/**
|
|
57
|
-
* Represents an object containing additional state data.
|
|
58
|
-
*/
|
|
59
|
-
state: {
|
|
60
|
-
loading: boolean;
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* A [custom React hook](https://reactjs.org/docs/hooks-custom.html) which provides data-binding to local data.
|
|
65
|
-
*/
|
|
66
|
-
export declare const usePivotLocalDataService: (args: PivotLocalDataServiceArgs) => PivotLocalDataServiceState;
|
|
67
|
-
/**
|
|
68
|
-
* Represents the properties of the [PivotLocalDataService]({% slug api_pivotgrid_pivotlocaldataservice %}) component.
|
|
69
|
-
*/
|
|
70
|
-
export interface PivotLocalDataServiceProps extends PivotLocalDataServiceArgs {
|
|
71
|
-
/**
|
|
72
|
-
* Represents the children prop of the [PivotLocalDataService]({% slug api_pivotgrid_pivotlocaldataservice %}) component.
|
|
73
|
-
*/
|
|
74
|
-
children: (args: PivotLocalDataServiceState) => any;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* A [React higher-order component](https://reactjs.org/docs/higher-order-components.html) which provides data-binding to local data.
|
|
78
|
-
*/
|
|
79
|
-
export declare const PivotLocalDataService: (props: PivotLocalDataServiceProps) => any;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
/* eslint-disable max-len */
|
|
13
|
-
import * as React from 'react';
|
|
14
|
-
import { createDataTree, rootFields, createLocalDataState, createFlatSchemaDimensions } from '@progress/kendo-pivotgrid-common';
|
|
15
|
-
;
|
|
16
|
-
var dataField = 'aggregate';
|
|
17
|
-
var columnsData = 'columns';
|
|
18
|
-
var bindingFields = { dataField: dataField, columnsData: columnsData };
|
|
19
|
-
var stringSeparator = '&';
|
|
20
|
-
/**
|
|
21
|
-
* A [custom React hook](https://reactjs.org/docs/hooks-custom.html) which provides data-binding to local data.
|
|
22
|
-
*/
|
|
23
|
-
export var usePivotLocalDataService = function (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];
|
|
31
|
-
var handleRowAxesChange = React.useCallback(function (event) {
|
|
32
|
-
setRowAxes(event.value);
|
|
33
|
-
}, []);
|
|
34
|
-
var handleColumnAxesChange = React.useCallback(function (event) {
|
|
35
|
-
setColumnAxes(event.value);
|
|
36
|
-
}, []);
|
|
37
|
-
var handleMeasureAxesChange = function (event) {
|
|
38
|
-
setMeasureAxes(event.value);
|
|
39
|
-
};
|
|
40
|
-
var handleSortChange = function (event) {
|
|
41
|
-
setSort(event.value);
|
|
42
|
-
};
|
|
43
|
-
var handleFilterChange = function (event) {
|
|
44
|
-
setFilter(event.value);
|
|
45
|
-
};
|
|
46
|
-
var rootColumnAxes = React.useMemo(function () { return Array.from(rootFields(columnAxes).keys()).join(stringSeparator); }, [columnAxes]);
|
|
47
|
-
var rootRowAxes = React.useMemo(function () { return Array.from(rootFields(rowAxes).keys()).join(stringSeparator); }, [rowAxes]);
|
|
48
|
-
var createAxisSettings = React.useCallback(function (key) { return (__assign({ key: key }, args.dimensions[key])); }, [args.dimensions]);
|
|
49
|
-
var columnSettings = React.useMemo(function () { return rootColumnAxes ? rootColumnAxes.split(stringSeparator).map(createAxisSettings) : []; }, [rootColumnAxes, createAxisSettings]);
|
|
50
|
-
var rowSettings = React.useMemo(function () { return rootRowAxes ? rootRowAxes.split(stringSeparator).map(createAxisSettings) : []; }, [rootRowAxes, createAxisSettings]);
|
|
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]);
|
|
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]);
|
|
60
|
-
var configuratorData = React.useMemo(function () { return createFlatSchemaDimensions(args.dimensions, args.measures); }, [args.dimensions, args.measures]);
|
|
61
|
-
var dataState = React.useMemo(function () { return createLocalDataState({
|
|
62
|
-
dataTree: dataTree,
|
|
63
|
-
rowSettings: rowSettings,
|
|
64
|
-
columnSettings: columnSettings,
|
|
65
|
-
rowAxes: rowAxes,
|
|
66
|
-
columnAxes: columnAxes,
|
|
67
|
-
measures: measuresSettings,
|
|
68
|
-
sort: sort,
|
|
69
|
-
fields: bindingFields
|
|
70
|
-
}); }, [columnAxes, columnSettings, dataTree, rowAxes, rowSettings, sort]);
|
|
71
|
-
return {
|
|
72
|
-
pivotProps: {
|
|
73
|
-
rowAxes: rowAxes,
|
|
74
|
-
columnAxes: columnAxes,
|
|
75
|
-
data: dataState.data,
|
|
76
|
-
rows: dataState.rows,
|
|
77
|
-
columns: dataState.columns,
|
|
78
|
-
onRowAxesChange: handleRowAxesChange,
|
|
79
|
-
onColumnAxesChange: handleColumnAxesChange
|
|
80
|
-
},
|
|
81
|
-
configuratorProps: {
|
|
82
|
-
sort: sort,
|
|
83
|
-
onSortChange: handleSortChange,
|
|
84
|
-
filter: filter,
|
|
85
|
-
onFilterChange: handleFilterChange,
|
|
86
|
-
data: configuratorData,
|
|
87
|
-
rowAxes: rowAxes,
|
|
88
|
-
columnAxes: columnAxes,
|
|
89
|
-
measureAxes: measureAxes,
|
|
90
|
-
onRowAxesChange: handleRowAxesChange,
|
|
91
|
-
onColumnAxesChange: handleColumnAxesChange,
|
|
92
|
-
onMeasureAxesChange: handleMeasureAxesChange
|
|
93
|
-
},
|
|
94
|
-
state: {
|
|
95
|
-
loading: loading
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* A [React higher-order component](https://reactjs.org/docs/higher-order-components.html) which provides data-binding to local data.
|
|
101
|
-
*/
|
|
102
|
-
export var PivotLocalDataService = function (props) {
|
|
103
|
-
var args = usePivotLocalDataService(props);
|
|
104
|
-
return props.children(args);
|
|
105
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { PivotGridAxis } from '@progress/kendo-pivotgrid-common';
|
|
2
|
-
import { SortDescriptor, FilterDescriptor } from '@progress/kendo-data-query';
|
|
3
|
-
import { PivotGridProps } from '../PivotGrid';
|
|
4
|
-
import { PivotGridConfiguratorProps } from '../components/Configurator';
|
|
5
|
-
/**
|
|
6
|
-
* Represents the arguments of the [usePivotOLAPService]({% slug api_pivotgrid_usepivotolapservice %}) hook.
|
|
7
|
-
*/
|
|
8
|
-
export interface PivotOLAPServiceArgs {
|
|
9
|
-
url: string;
|
|
10
|
-
cube: string;
|
|
11
|
-
catalog: string;
|
|
12
|
-
defaultColumnAxes?: PivotGridAxis[];
|
|
13
|
-
defaultRowAxes?: PivotGridAxis[];
|
|
14
|
-
defaultMeasureAxes?: PivotGridAxis[];
|
|
15
|
-
defaultSort?: SortDescriptor[];
|
|
16
|
-
defaultFilter?: FilterDescriptor[];
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Represents the `state` of the [usePivotOLAPService]({% slug api_pivotgrid_usepivotolapservice %}) hook and the [PivotOLAPService]({% slug api_pivotgrid_pivotolapservice %}) component.
|
|
20
|
-
*/
|
|
21
|
-
export interface PivotOLAPServiceState {
|
|
22
|
-
pivotProps: PivotGridProps;
|
|
23
|
-
configuratorProps: PivotGridConfiguratorProps;
|
|
24
|
-
state: {
|
|
25
|
-
loading: boolean;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* A [custom React hook](https://reactjs.org/docs/hooks-custom.html) which provides data-binding to an OLAP service.
|
|
30
|
-
*/
|
|
31
|
-
export declare const usePivotOLAPService: (args: PivotOLAPServiceArgs) => PivotOLAPServiceState;
|
|
32
|
-
/**
|
|
33
|
-
* Represents the properties of the [PivotOLAPService]({% slug api_pivotgrid_pivotolapservice %}) component.
|
|
34
|
-
*/
|
|
35
|
-
export interface PivotOLAPServiceProps extends PivotOLAPServiceArgs {
|
|
36
|
-
children: (args: PivotOLAPServiceState) => any;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* A [React higher-order component](https://reactjs.org/docs/higher-order-components.html) which provides data-binding to an OLAP service.
|
|
40
|
-
*/
|
|
41
|
-
export declare const PivotOLAPService: (props: PivotOLAPServiceProps) => any;
|