@progress/kendo-react-pivotgrid 6.1.1 → 7.0.0-develop.2

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 (132) hide show
  1. package/LICENSE.md +1 -1
  2. package/{dist/npm/PivotGrid.d.ts → PivotGrid.d.ts} +4 -0
  3. package/{dist/es/components → components}/AxesEditor.d.ts +4 -6
  4. package/{dist/npm/components → components}/AxisEditor.d.ts +4 -0
  5. package/{dist/es/components → components}/AxisFilterFieldsEditor.d.ts +4 -0
  6. package/{dist/npm/components → components}/Cell.d.ts +4 -0
  7. package/{dist/es/components → components}/Column.d.ts +4 -0
  8. package/{dist/npm/components → components}/Configurator.d.ts +4 -0
  9. package/{dist/npm/components → components}/ConfiguratorButton.d.ts +4 -0
  10. package/{dist/es/components → components}/ConfiguratorEditor.d.ts +4 -0
  11. package/{dist/es/components → components}/Container.d.ts +4 -0
  12. package/components/EditorContext.d.ts +11 -0
  13. package/{dist/npm/components → components}/FieldsEditor.d.ts +4 -0
  14. package/{dist/es/components → components}/HeaderCell.d.ts +4 -0
  15. package/{dist/es/components → components}/Row.d.ts +4 -0
  16. package/dist/cdn/js/kendo-react-pivotgrid.js +5 -2
  17. package/hooks/index.d.ts +6 -0
  18. package/{dist/es/hooks → hooks}/useExpansion.d.ts +5 -1
  19. package/{dist/es/hooks → hooks}/useHeaders.d.ts +5 -1
  20. package/hooks/useHorizontalScrollSync.d.ts +9 -0
  21. package/{dist/es/hooks → hooks}/usePivotConfiguratorEditor.d.ts +5 -1
  22. package/{dist/npm/hooks → hooks}/usePivotLocalDataService.d.ts +4 -0
  23. package/{dist/npm/hooks → hooks}/usePivotOLAPService.d.ts +4 -0
  24. package/hooks/useVerticalScrollSync.d.ts +9 -0
  25. package/index.d.ts +22 -0
  26. package/index.js +5 -0
  27. package/index.mjs +1585 -0
  28. package/{dist/es/messages → messages}/index.d.ts +4 -0
  29. package/{dist/es/models → models}/index.d.ts +4 -1
  30. package/package-metadata.d.ts +9 -0
  31. package/package.json +36 -54
  32. package/{dist/es/shared → shared}/PivotGridConfiguratorEditorEventsContext.d.ts +4 -0
  33. package/{dist/npm/shared → shared}/PivotGridConfiguratorEditorStateContext.d.ts +4 -0
  34. package/shared/index.d.ts +6 -0
  35. package/{dist/es/utils → utils}/index.d.ts +4 -0
  36. package/about.md +0 -3
  37. package/dist/cdn/js/kendo-react-pivotgrid.js.LICENSE.txt +0 -14
  38. package/dist/es/PivotGrid.d.ts +0 -177
  39. package/dist/es/PivotGrid.js +0 -245
  40. package/dist/es/components/AxesEditor.js +0 -43
  41. package/dist/es/components/AxisEditor.d.ts +0 -52
  42. package/dist/es/components/AxisEditor.js +0 -138
  43. package/dist/es/components/AxisFilterFieldsEditor.js +0 -150
  44. package/dist/es/components/Cell.d.ts +0 -65
  45. package/dist/es/components/Cell.js +0 -31
  46. package/dist/es/components/Column.js +0 -33
  47. package/dist/es/components/Configurator.d.ts +0 -125
  48. package/dist/es/components/Configurator.js +0 -118
  49. package/dist/es/components/ConfiguratorButton.d.ts +0 -40
  50. package/dist/es/components/ConfiguratorButton.js +0 -39
  51. package/dist/es/components/ConfiguratorEditor.js +0 -191
  52. package/dist/es/components/Container.js +0 -22
  53. package/dist/es/components/FieldsEditor.d.ts +0 -74
  54. package/dist/es/components/FieldsEditor.js +0 -90
  55. package/dist/es/components/HeaderCell.js +0 -50
  56. package/dist/es/components/Row.js +0 -28
  57. package/dist/es/hooks/index.d.ts +0 -2
  58. package/dist/es/hooks/index.js +0 -2
  59. package/dist/es/hooks/useExpansion.js +0 -89
  60. package/dist/es/hooks/useHeaders.js +0 -25
  61. package/dist/es/hooks/useHorizontalScrollSync.d.ts +0 -5
  62. package/dist/es/hooks/useHorizontalScrollSync.js +0 -27
  63. package/dist/es/hooks/usePivotConfiguratorEditor.js +0 -103
  64. package/dist/es/hooks/usePivotLocalDataService.d.ts +0 -79
  65. package/dist/es/hooks/usePivotLocalDataService.js +0 -105
  66. package/dist/es/hooks/usePivotOLAPService.d.ts +0 -41
  67. package/dist/es/hooks/usePivotOLAPService.js +0 -371
  68. package/dist/es/hooks/useVerticalScrollSync.d.ts +0 -5
  69. package/dist/es/hooks/useVerticalScrollSync.js +0 -27
  70. package/dist/es/main.d.ts +0 -18
  71. package/dist/es/main.js +0 -17
  72. package/dist/es/messages/index.js +0 -71
  73. package/dist/es/models/index.js +0 -1
  74. package/dist/es/package-metadata.d.ts +0 -5
  75. package/dist/es/package-metadata.js +0 -11
  76. package/dist/es/shared/PivotGridConfiguratorEditorEventsContext.js +0 -5
  77. package/dist/es/shared/PivotGridConfiguratorEditorStateContext.d.ts +0 -6
  78. package/dist/es/shared/PivotGridConfiguratorEditorStateContext.js +0 -18
  79. package/dist/es/shared/index.d.ts +0 -2
  80. package/dist/es/shared/index.js +0 -2
  81. package/dist/es/utils/index.js +0 -118
  82. package/dist/npm/PivotGrid.js +0 -248
  83. package/dist/npm/components/AxesEditor.d.ts +0 -46
  84. package/dist/npm/components/AxesEditor.js +0 -46
  85. package/dist/npm/components/AxisEditor.js +0 -141
  86. package/dist/npm/components/AxisFilterFieldsEditor.d.ts +0 -114
  87. package/dist/npm/components/AxisFilterFieldsEditor.js +0 -153
  88. package/dist/npm/components/Cell.js +0 -34
  89. package/dist/npm/components/Column.d.ts +0 -42
  90. package/dist/npm/components/Column.js +0 -36
  91. package/dist/npm/components/Configurator.js +0 -121
  92. package/dist/npm/components/ConfiguratorButton.js +0 -42
  93. package/dist/npm/components/ConfiguratorEditor.d.ts +0 -126
  94. package/dist/npm/components/ConfiguratorEditor.js +0 -194
  95. package/dist/npm/components/Container.d.ts +0 -46
  96. package/dist/npm/components/Container.js +0 -25
  97. package/dist/npm/components/FieldsEditor.js +0 -93
  98. package/dist/npm/components/HeaderCell.d.ts +0 -96
  99. package/dist/npm/components/HeaderCell.js +0 -53
  100. package/dist/npm/components/Row.d.ts +0 -50
  101. package/dist/npm/components/Row.js +0 -31
  102. package/dist/npm/hooks/index.d.ts +0 -2
  103. package/dist/npm/hooks/index.js +0 -18
  104. package/dist/npm/hooks/useExpansion.d.ts +0 -19
  105. package/dist/npm/hooks/useExpansion.js +0 -93
  106. package/dist/npm/hooks/useHeaders.d.ts +0 -12
  107. package/dist/npm/hooks/useHeaders.js +0 -30
  108. package/dist/npm/hooks/useHorizontalScrollSync.d.ts +0 -5
  109. package/dist/npm/hooks/useHorizontalScrollSync.js +0 -31
  110. package/dist/npm/hooks/usePivotConfiguratorEditor.d.ts +0 -83
  111. package/dist/npm/hooks/usePivotConfiguratorEditor.js +0 -107
  112. package/dist/npm/hooks/usePivotLocalDataService.js +0 -110
  113. package/dist/npm/hooks/usePivotOLAPService.js +0 -376
  114. package/dist/npm/hooks/useVerticalScrollSync.d.ts +0 -5
  115. package/dist/npm/hooks/useVerticalScrollSync.js +0 -31
  116. package/dist/npm/main.d.ts +0 -18
  117. package/dist/npm/main.js +0 -43
  118. package/dist/npm/messages/index.d.ts +0 -70
  119. package/dist/npm/messages/index.js +0 -74
  120. package/dist/npm/models/index.d.ts +0 -45
  121. package/dist/npm/models/index.js +0 -2
  122. package/dist/npm/package-metadata.d.ts +0 -5
  123. package/dist/npm/package-metadata.js +0 -14
  124. package/dist/npm/shared/PivotGridConfiguratorEditorEventsContext.d.ts +0 -13
  125. package/dist/npm/shared/PivotGridConfiguratorEditorEventsContext.js +0 -8
  126. package/dist/npm/shared/PivotGridConfiguratorEditorStateContext.js +0 -21
  127. package/dist/npm/shared/index.d.ts +0 -2
  128. package/dist/npm/shared/index.js +0 -18
  129. package/dist/npm/utils/index.d.ts +0 -47
  130. package/dist/npm/utils/index.js +0 -130
  131. package/dist/systemjs/kendo-react-pivotgrid.js +0 -1
  132. package/e2e-next/basic.tests.ts +0 -24
@@ -1,43 +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 { ChipList as KendoReactChipList } from '@progress/kendo-react-buttons';
14
- import { canUseRef, useCustomComponent } from '@progress/kendo-react-common';
15
- import { PivotGridAxisEditor } from './AxisEditor';
16
- /**
17
- * @hidden
18
- */
19
- export var PivotGridConfiguratorEditorAxesContext = React.createContext({ axes: null });
20
- /**
21
- * Represents the [KendoReact PivotGridAxesEditor component]({% slug api_pivotgrid_pivotgridaxeseditorprops %}).
22
- */
23
- export var PivotGridAxesEditor = React.forwardRef(function (props, ref) {
24
- var _a = __assign(__assign({}, defaultProps), props), value = _a.value, field = _a.field;
25
- var chipList = React.useRef(null);
26
- var element = React.useRef(null);
27
- var target = React.useRef(null);
28
- var _b = useCustomComponent(props.chipList || defaultProps.chipList), ChipListComponent = _b[0], ChipListProps = _b[1];
29
- React.useImperativeHandle(element, function () { return chipList.current && chipList.current.element; });
30
- React.useImperativeHandle(target, function () { return ({ props: props, element: element.current }); });
31
- React.useImperativeHandle(ref, function () { return target.current; });
32
- var data = value
33
- .filter(function (v) { return v.name.length === 1 && v.name.every(function (n) { return n.indexOf('&') === -1; }); })
34
- .map(function (i) { return (__assign(__assign({}, i), { text: String(i.name) })); });
35
- return (React.createElement(PivotGridConfiguratorEditorAxesContext.Provider, { value: { axes: field } },
36
- React.createElement(ChipListComponent, __assign({ ref: canUseRef(ChipListComponent) ? chipList : undefined, textField: "text", valueField: "name", data: data, chip: PivotGridAxisEditor, style: { position: 'relative' }, className: props.className, selection: "none" }, ChipListProps))));
37
- });
38
- var defaultProps = {
39
- value: [],
40
- chipList: KendoReactChipList
41
- };
42
- PivotGridAxesEditor.defaultProps = defaultProps;
43
- PivotGridAxesEditor.displayName = 'KendoReactPivotGridAxesEditor';
@@ -1,52 +0,0 @@
1
- import * as React from 'react';
2
- import { PivotGridAxis } from '@progress/kendo-pivotgrid-common';
3
- import { CustomComponent } from '@progress/kendo-react-common';
4
- import { ColumnMenuProps as KendoReactColumnMenuProps } from '@progress/kendo-react-data-tools';
5
- import { ChipProps as KendoReactChipProps } from '@progress/kendo-react-buttons';
6
- import { PivotGridAxisFilterFieldsEditorProps } from './AxisFilterFieldsEditor';
7
- /**
8
- * Represents the props of the [KendoReact PivotGridAxisEditor component]({% slug api_pivotgrid_pivotgridaxiseditor %}).
9
- */
10
- export interface PivotGridAxisEditorProps extends KendoReactChipProps {
11
- /**
12
- * Represents the `dataItem` of the AxisEditor.
13
- *
14
- * The `dataItem` is a single [PivotGridAxis]({% slug api_pivotgrid_pivotgridaxis %}) object.
15
- */
16
- dataItem: PivotGridAxis;
17
- /**
18
- * Overrides the default `chip` component.
19
- *
20
- * The default component is: [KendoReactChip]({% slug api_buttons_chip %}).
21
- */
22
- chip?: CustomComponent<KendoReactChipProps>;
23
- /**
24
- * Overrides the default `dropClue` component.
25
- *
26
- * The default component is: `(props) => <div className="k-grouping-dropclue" style={{ position: 'relative', zIndex: 10000 }} {...props}/>`
27
- */
28
- dropClue?: CustomComponent<any>;
29
- /**
30
- * Overrides the default `columnMenuTextColumn` component.
31
- *
32
- * The default component is: [KendoReactColumnMenuTextColumn]({% slug api_data-tools_columnmenutextcolumn %}).
33
- */
34
- columnMenuTextColumn?: CustomComponent<KendoReactColumnMenuProps>;
35
- /**
36
- * Overrides the default `filterFieldsEditor` component.
37
- *
38
- * The default component is: [PivotGridAxisFilterFieldsEditor]({% slug api_pivotgrid_pivotgridaxisfilterfieldseditor%}).
39
- */
40
- filterFieldsEditor?: CustomComponent<PivotGridAxisFilterFieldsEditorProps>;
41
- }
42
- /**
43
- * Represents the object which is passed to the [`ref`](https://reactjs.org/docs/refs-and-the-dom.html) callback of the PivotGridAxisEditor component.
44
- */
45
- export interface PivotGridAxisEditorHandle {
46
- props: PivotGridAxisEditorProps;
47
- element: HTMLSpanElement | null;
48
- }
49
- /**
50
- * Represents the [KendoReact PivotGridAxisEditor component]({% slug api_pivotgrid_pivotgridaxiseditorprops %}).
51
- */
52
- export declare const PivotGridAxisEditor: React.ForwardRefExoticComponent<PivotGridAxisEditorProps & React.RefAttributes<PivotGridAxisEditorHandle | null>>;
@@ -1,138 +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
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
- if (ar || !(i in from)) {
15
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
- ar[i] = from[i];
17
- }
18
- }
19
- return to.concat(ar || Array.prototype.slice.call(from));
20
- };
21
- import * as React from 'react';
22
- import { compareAxes } from '@progress/kendo-pivotgrid-common';
23
- import { useDraggable, useCustomComponent, canUseRef } from '@progress/kendo-react-common';
24
- import { ColumnMenuTextColumn as KendoReactColumnMenuTextColumn, ColumnMenuTextFilter } from '@progress/kendo-react-data-tools';
25
- import { Chip as KendoReactChip } from '@progress/kendo-react-buttons';
26
- import { findFilters, findFilter } from '../utils';
27
- import { PIVOT_CONFIGURATOR_ACTION } from '../hooks/';
28
- import { PivotGridConfiguratorEditorStateContext } from '../shared';
29
- import { PivotGridConfiguratorEditorAxesContext } from './AxesEditor';
30
- import { PivotGridAxisFilterFieldsEditor } from './AxisFilterFieldsEditor';
31
- /**
32
- * Represents the [KendoReact PivotGridAxisEditor component]({% slug api_pivotgrid_pivotgridaxiseditorprops %}).
33
- */
34
- export var PivotGridAxisEditor = React.forwardRef(function (props, ref) {
35
- var initialX = React.useRef(0);
36
- var initialY = React.useRef(0);
37
- var chip = React.useRef(null);
38
- var element = React.useRef(null);
39
- var target = React.useRef(null);
40
- var axes = React.useContext(PivotGridConfiguratorEditorAxesContext).axes;
41
- var _a = React.useState(false), drag = _a[0], setDrag = _a[1];
42
- var _b = React.useContext(PivotGridConfiguratorEditorStateContext), state = _b[0], dispatchState = _b[1];
43
- React.useImperativeHandle(element, function () { return chip.current && chip.current.element; });
44
- React.useImperativeHandle(target, function () { return ({ props: props, element: element.current }); });
45
- React.useImperativeHandle(ref, function () { return target.current; });
46
- var _c = useCustomComponent(props.chip || defaultProps.chip), ChipComponent = _c[0], ChipProps = _c[1];
47
- var _d = useCustomComponent(props.dropClue || defaultProps.dropClue), DropClueComponent = _d[0], DropClueProps = _d[1];
48
- var _e = useCustomComponent(props.columnMenuTextColumn || defaultProps.columnMenuTextColumn), ColumnMenuTextColumnComponent = _e[0], ColumnMenuTextColumnProps = _e[1];
49
- var _f = useCustomComponent(props.filterFieldsEditor || defaultProps.filterFieldsEditor), FilterFieldsEditorComponent = _f[0], FilterFieldsEditorProps = _f[1];
50
- var inFilter = findFilters(state.filter, String(props.value), 'in');
51
- var textFilter = findFilters(state.filter, String(props.value));
52
- var handleSortChange = function (syntheticEvent, sort) {
53
- dispatchState({ type: PIVOT_CONFIGURATOR_ACTION.setSort, payload: sort }, syntheticEvent);
54
- };
55
- var handleFilterChange = function (syntheticEvent, filter) {
56
- if (filter.length) {
57
- dispatchState({
58
- type: PIVOT_CONFIGURATOR_ACTION.setFilter,
59
- payload: __spreadArray(__spreadArray([], (inFilter || []), true), filter.reduce(function (acc, current) { return __spreadArray(__spreadArray([], acc, true), current.filters.filter(function (f) { return f.value; }), true); }, []), true)
60
- }, syntheticEvent);
61
- }
62
- else {
63
- dispatchState({ type: PIVOT_CONFIGURATOR_ACTION.setFilter, payload: inFilter }, syntheticEvent);
64
- }
65
- };
66
- var handleRemove = function (event) {
67
- dispatchState({ type: PIVOT_CONFIGURATOR_ACTION.remove, payload: props.dataItem }, event.syntheticEvent);
68
- };
69
- var customRender = function (children) {
70
- var customizedChildren = children.slice();
71
- var filter = findFilter(state.filter, String(props.dataItem.name), 'in');
72
- customizedChildren.splice(1, 0, (React.createElement(FilterFieldsEditorComponent, __assign({ key: 'axis-filter-fields-editor', defaultFilter: filter, dataItem: props.dataItem, data: props.dataItem.fields, axes: axes }, FilterFieldsEditorProps))));
73
- return customizedChildren;
74
- };
75
- var handlePress = function (event) {
76
- initialX.current = event.clientX;
77
- initialY.current = event.clientY;
78
- };
79
- var handleDrag = function (event) {
80
- if (Math.abs(initialX.current - event.clientX) < 10 &&
81
- Math.abs(initialY.current - event.clientY) < 10) {
82
- return;
83
- }
84
- if (element.current) {
85
- element.current.style.transform = "translate(".concat(event.clientX - initialX.current, "px, ").concat(event.clientY - initialY.current, "px)");
86
- }
87
- setDrag(true);
88
- dispatchState({ type: PIVOT_CONFIGURATOR_ACTION.setDragItem, payload: props.dataItem });
89
- };
90
- var handleRelease = function () {
91
- setDrag(false);
92
- if (state.dragItem) {
93
- if (element.current) {
94
- element.current.style.transform = '';
95
- }
96
- dispatchState({ type: PIVOT_CONFIGURATOR_ACTION.drop, payload: props.dataItem });
97
- }
98
- };
99
- var handleMouseEnter = function (event) {
100
- if (state.dragItem) {
101
- dispatchState({ type: PIVOT_CONFIGURATOR_ACTION.setDropTarget, payload: props.dataItem }, event.syntheticEvent);
102
- dispatchState({ type: PIVOT_CONFIGURATOR_ACTION.setDropZone, payload: axes }, event.syntheticEvent);
103
- }
104
- };
105
- var handleMouseMove = function (event) {
106
- if (state.dragItem && !drag) {
107
- if (element.current) {
108
- var rect = element.current.getBoundingClientRect();
109
- var x = event.syntheticEvent.clientX - rect.left;
110
- var direction = x < rect.width / 2 ? 'before' : 'after';
111
- dispatchState({ type: PIVOT_CONFIGURATOR_ACTION.setDropDirection, payload: direction }, event.syntheticEvent);
112
- }
113
- }
114
- };
115
- useDraggable(element, {
116
- onPress: handlePress,
117
- onDrag: handleDrag,
118
- onRelease: handleRelease
119
- });
120
- return (React.createElement(React.Fragment, null,
121
- (state.dropTarget && compareAxes(state.dropTarget, props.dataItem) && state.dropDirection === 'before')
122
- && (React.createElement(DropClueComponent, __assign({}, DropClueProps))),
123
- React.createElement(ChipComponent, __assign({ ref: canUseRef(ChipComponent) ? chip : undefined }, props, { removable: true, onRemove: handleRemove, onMouseEnter: handleMouseEnter, onMouseMove: handleMouseMove, style: { pointerEvents: drag ? 'none' : undefined }, rounded: 'full' }, ChipProps),
124
- props.text,
125
- (axes !== 'measureAxes') && (React.createElement(ColumnMenuTextColumnComponent, __assign({ field: String(props.value), itemsRender: customRender, sort: state.sort, onSortChange: handleSortChange, filter: (textFilter && textFilter.length) ? [{ logic: 'and', filters: textFilter }] : undefined, onFilterChange: handleFilterChange, filterContent: [
126
- ColumnMenuTextFilter
127
- ] }, ColumnMenuTextColumnProps)))),
128
- (state.dropTarget && compareAxes(state.dropTarget, props.dataItem) && state.dropDirection === 'after')
129
- && (React.createElement(DropClueComponent, __assign({}, DropClueProps)))));
130
- });
131
- var defaultProps = {
132
- chip: KendoReactChip,
133
- columnMenuTextColumn: KendoReactColumnMenuTextColumn,
134
- filterFieldsEditor: PivotGridAxisFilterFieldsEditor,
135
- dropClue: function (props) { return React.createElement("div", __assign({ className: "k-grouping-dropclue", style: { position: 'relative', zIndex: 10000 } }, props)); }
136
- };
137
- PivotGridAxisEditor.defaultProps = defaultProps;
138
- PivotGridAxisEditor.displayName = 'KendoReactPivotGridAxisEditor';
@@ -1,150 +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 { TreeView as KendoReactTreeView } from '@progress/kendo-react-treeview';
14
- import { Button as KendoReactButton } from '@progress/kendo-react-buttons';
15
- import { Skeleton } from '@progress/kendo-react-indicators';
16
- import { useLocalization } from '@progress/kendo-react-intl';
17
- import { ColumnMenuItem as KendoReactColumnMenuItem, ColumnMenuForm as KendoReactColumnMenuForm } from '@progress/kendo-react-data-tools';
18
- import { classNames, useCustomComponent } from '@progress/kendo-react-common';
19
- import { gridLayoutIcon } from '@progress/kendo-svg-icons';
20
- import { recursiveMap, flatMap, compareFields } from '../utils';
21
- import { fieldMenuReset, messages, fieldMenuApply } from '../messages';
22
- import { useExpansion, EXPANSION_ACTION, PIVOT_CONFIGURATOR_ACTION } from '../hooks';
23
- import { PivotGridConfiguratorEditorEventsContext, PivotGridConfiguratorEditorStateContext } from '../shared';
24
- /* eslint-enable max-len */
25
- /**
26
- * Represents the [KendoReact PivotGridAxisFilterFieldsEditor component]({% slug api_pivotgrid_pivotgridaxisfilterfieldseditorprops %}).
27
- */
28
- export var PivotGridAxisFilterFieldsEditor = React.forwardRef(function (props, ref) {
29
- var _a = __assign(__assign({}, defaultProps), props), data = _a.data, dataItem = _a.dataItem, defaultFilter = _a.defaultFilter;
30
- var element = React.useRef(null);
31
- var target = React.useRef(null);
32
- var localization = useLocalization();
33
- var _b = useCustomComponent(props.columnMenuItem || defaultProps.columnMenuItem), ColumnMenuItemComponent = _b[0], ColumnMenuItemProps = _b[1];
34
- var _c = useCustomComponent(props.columnMenuForm || defaultProps.columnMenuForm), ColumnMenuFormComponent = _c[0], ColumnMenuFormProps = _c[1];
35
- var _d = useCustomComponent(props.resetButton || defaultProps.resetButton), ResetButtonComponent = _d[0], ResetButtonProps = _d[1];
36
- var _e = useCustomComponent(props.applyButton || defaultProps.applyButton), ApplyButtonComponent = _e[0], ApplyButtonProps = _e[1];
37
- var _f = useCustomComponent(props.treeView || defaultProps.treeView), TreeViewComponent = _f[0], TreeViewProps = _f[1];
38
- var _g = useCustomComponent(props.noData || defaultProps.noData), NoDataComponent = _g[0], NoDataProps = _g[1];
39
- React.useImperativeHandle(target, function () { return ({ props: props, element: element.current }); });
40
- React.useImperativeHandle(ref, function () { return target.current; });
41
- var _h = React.useState(false), show = _h[0], setShow = _h[1];
42
- var _j = React.useContext(PivotGridConfiguratorEditorEventsContext), onAxisFilterFieldsExpandChange = _j.onAxisFilterFieldsExpandChange, onAxisFilterFieldExpand = _j.onAxisFilterFieldExpand;
43
- var _k = React.useContext(PivotGridConfiguratorEditorStateContext), dispatchState = _k[1];
44
- var _l = React.useState(defaultFilter), filter = _l[0], setFilter = _l[1];
45
- var selected = filter ? filter.value.split(',') : [];
46
- var _m = useExpansion([], undefined, target, compareFields), expanded = _m[0], dispatchExpansion = _m[1];
47
- var map = {
48
- caption: function (node) { return node.dataItem.caption; },
49
- id: function (node) { return node.dataItem.uniqueName; },
50
- parent: function (_, parent) { return parent && parent.value; },
51
- value: function (node) { return (node.dataItem.defaultHierarchy || node.dataItem.uniqueName); },
52
- expanded: function (node) { return expanded.some(function (e) { return e.uniqueName === node.id; }); },
53
- checked: function (node) { return !selected.length || (selected || []).some(function (f) { return f === node.dataItem.uniqueName; }); },
54
- hasChildren: function (node) { return parseInt(node.dataItem.childrenCardinality, 10) > 0; },
55
- children: function (node) { return recursiveMap(node.dataItem.children, map, node); },
56
- checkIndeterminate: function (node) {
57
- var everyChildChecked = (node.children || []).length && node.children.every(function (c) { return c.checked; });
58
- if (everyChildChecked) {
59
- node.checked = true;
60
- }
61
- return (node.children || []).some(function (c) { return c.checked; }) && !everyChildChecked;
62
- }
63
- };
64
- var fields = recursiveMap(data, map);
65
- var dataFlatMap = flatMap(fields);
66
- var handleClick = function (syntheticEvent) {
67
- setShow(!show);
68
- if (onAxisFilterFieldsExpandChange) {
69
- onAxisFilterFieldsExpandChange({
70
- value: !show,
71
- target: target.current,
72
- syntheticEvent: syntheticEvent
73
- });
74
- }
75
- };
76
- var handleFieldExpand = function (event) {
77
- dispatchExpansion({ type: EXPANSION_ACTION.toggle, payload: event.item.dataItem }, event.syntheticEvent);
78
- if (onAxisFilterFieldExpand) {
79
- onAxisFilterFieldExpand({
80
- value: event.item.dataItem,
81
- target: target.current,
82
- syntheticEvent: event.syntheticEvent
83
- });
84
- }
85
- };
86
- var handleFieldCheck = function (event) {
87
- var newFilter;
88
- if (event.item.checked) {
89
- newFilter = {
90
- field: String(dataItem.name),
91
- operator: 'in',
92
- value: dataFlatMap
93
- .filter(function (i) { return i.checked; })
94
- .map(function (c) { return String(c.value); })
95
- .filter(function (i) { return i !== event.item.value && i !== event.item.parent; })
96
- .join(',')
97
- };
98
- }
99
- else {
100
- newFilter = {
101
- field: String(dataItem.name),
102
- operator: 'in',
103
- value: dataFlatMap
104
- .filter(function (i) { return i.checked; })
105
- .map(function (c) { return String(c.value); })
106
- .concat([event.item.value])
107
- .join(',')
108
- };
109
- }
110
- setFilter(newFilter);
111
- };
112
- var handleResetClick = function (syntheticEvent) {
113
- setShow(false);
114
- if (filter) {
115
- dispatchState({
116
- type: PIVOT_CONFIGURATOR_ACTION.removeFilter,
117
- payload: filter
118
- }, syntheticEvent);
119
- }
120
- };
121
- var handleApplyClick = function (syntheticEvent) {
122
- setShow(false);
123
- if (filter) {
124
- dispatchState({
125
- type: defaultFilter
126
- ? PIVOT_CONFIGURATOR_ACTION.changeFilter
127
- : PIVOT_CONFIGURATOR_ACTION.addFilter,
128
- payload: filter
129
- }, syntheticEvent);
130
- }
131
- };
132
- return (React.createElement("div", { ref: element, id: props.id, tabIndex: props.tabIndex, style: props.style, className: classNames('k-columnmenu-item-wrapper', props.className) },
133
- React.createElement(ColumnMenuItemComponent, __assign({}, ColumnMenuItemProps, { title: "Include Fields", iconClass: "k-i-grid-layout", svgIcon: gridLayoutIcon, onClick: handleClick })),
134
- React.createElement(ColumnMenuFormComponent, __assign({ show: show, actions: (React.createElement(React.Fragment, null,
135
- React.createElement(ResetButtonComponent, __assign({ type: "reset", onClick: handleResetClick }, ResetButtonProps), localization.toLanguageString(fieldMenuReset, messages[fieldMenuReset])),
136
- React.createElement(ApplyButtonComponent, __assign({ themeColor: 'primary', onClick: handleApplyClick }, ApplyButtonProps), localization.toLanguageString(fieldMenuApply, messages[fieldMenuApply])))) }, ColumnMenuFormProps), (fields && fields.length)
137
- ? (React.createElement(TreeViewComponent, __assign({ data: fields, checkboxes: true, onExpandChange: handleFieldExpand, onCheckChange: handleFieldCheck, textField: 'caption', expandIcons: true, hasChildrenField: "hasChildren", checkIndeterminateField: "checkIndeterminate", childrenField: "children" }, TreeViewProps)))
138
- : (React.createElement(NoDataComponent, __assign({}, NoDataProps))))));
139
- });
140
- var defaultProps = {
141
- data: [],
142
- resetButton: KendoReactButton,
143
- applyButton: KendoReactButton,
144
- treeView: KendoReactTreeView,
145
- noData: function () { return React.createElement(Skeleton, { shape: 'rectangle', style: { height: '20px', width: 'calc(100% - 16px)', margin: 8 } }); },
146
- columnMenuItem: KendoReactColumnMenuItem,
147
- columnMenuForm: KendoReactColumnMenuForm
148
- };
149
- PivotGridAxisFilterFieldsEditor.defaultProps = defaultProps;
150
- PivotGridAxisFilterFieldsEditor.displayName = 'KendoReactPivotGridAxisFilterFieldsEditor';
@@ -1,65 +0,0 @@
1
- import * as React from 'react';
2
- import { KendoMouse } from '@progress/kendo-react-common';
3
- import { PivotDataItem } from '@progress/kendo-pivotgrid-common';
4
- /**
5
- * Represents the object which is passed to the [`ref`](https://reactjs.org/docs/refs-and-the-dom.html) callback of the PivotGridCell component.
6
- */
7
- export interface PivotGridCellHandle {
8
- props: PivotGridCellProps;
9
- element: HTMLTableCellElement | null;
10
- }
11
- /**
12
- * Represents the props of the [KendoReact PivotGridCell component]({% slug api_pivotgrid_pivotgridcell %}).
13
- */
14
- export interface PivotGridCellProps extends KendoMouse<PivotGridCellHandle, HTMLTableCellElement> {
15
- /**
16
- * Represents the `dataItem` of the PivotGridCell.
17
- *
18
- * The `dataItem` is a single [PivotDataItem]({% slug api_pivotgrid_pivotdataitem %}) object.
19
- */
20
- dataItem: PivotDataItem;
21
- /**
22
- * Sets the `id` property of the top-most element of the PivotGridCell.
23
- */
24
- id?: string;
25
- /**
26
- * Sets the `className` property of the top-most element of the PivotGridCell in addition to the default `k-pivotgrid-cell` class.
27
- */
28
- className?: string;
29
- /**
30
- * Sets the `tabIndex` property of the top-most element of the PivotGridCell.
31
- */
32
- tabIndex?: number;
33
- /**
34
- * Sets the `children` property of the top-most element of the PivotGridCell.
35
- */
36
- children?: React.ReactNode;
37
- /**
38
- * Sets the `style` property of the top-most element of the PivotGridCell.
39
- */
40
- style?: React.CSSProperties;
41
- /**
42
- * Represents the columns `path` leading to the current cell.
43
- */
44
- columnPath?: string[];
45
- /**
46
- * Represents the row `path` leading to the current cell.
47
- */
48
- rowPath?: string[];
49
- /**
50
- * Indicates if the current cell represents a `total` value.
51
- */
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;
61
- }
62
- /**
63
- * Represents the [KendoReact PivotGridCell component]({% slug api_pivotgrid_pivotgridcellprops %}).
64
- */
65
- export declare const PivotGridCell: React.ForwardRefExoticComponent<PivotGridCellProps & React.RefAttributes<PivotGridCellHandle | null>>;
@@ -1,31 +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 { classNames, useMouse } from '@progress/kendo-react-common';
14
- ;
15
- /**
16
- * Represents the [KendoReact PivotGridCell component]({% slug api_pivotgrid_pivotgridcellprops %}).
17
- */
18
- export var PivotGridCell = React.forwardRef(function (props, ref) {
19
- var target = React.useRef(null);
20
- var element = React.useRef(null);
21
- React.useImperativeHandle(target, function () { return ({
22
- element: element.current,
23
- props: props
24
- }); });
25
- React.useImperativeHandle(ref, function () { return target.current; });
26
- var mouseProps = useMouse(props, target);
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
- 'k-pivotgrid-header-total': props.total
29
- }, props.className) }), props.children));
30
- });
31
- PivotGridCell.displayName = 'KendoReactPivotGridCell';
@@ -1,33 +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 { useMouse } from '@progress/kendo-react-common';
14
- ;
15
- /**
16
- * Represents the [KendoReact PivotGridColumn component]({% slug api_pivotgrid_pivotgridcolumnprops %}).
17
- */
18
- export var PivotGridColumn = React.forwardRef(function (props, ref) {
19
- var target = React.useRef(null);
20
- var element = React.useRef(null);
21
- React.useImperativeHandle(target, function () { return ({
22
- element: element.current,
23
- props: props
24
- }); });
25
- React.useImperativeHandle(ref, function () { return target.current; });
26
- var mouseProps = useMouse(props, target);
27
- return (React.createElement("col", __assign({ ref: element }, mouseProps, { id: props.id, style: props.style, tabIndex: props.tabIndex, children: props.children, className: props.className })));
28
- });
29
- var defaultProps = {
30
- path: []
31
- };
32
- PivotGridColumn.defaultProps = defaultProps;
33
- PivotGridColumn.displayName = 'KendoReactPivotGridColumn';
@@ -1,125 +0,0 @@
1
- import * as React from 'react';
2
- import { CustomComponent } from '@progress/kendo-react-common';
3
- import { FormProps as KendoFormProps, FormElementProps as KendoFormElementProps } from '@progress/kendo-react-form';
4
- import { SortDescriptor, FilterDescriptor } from '@progress/kendo-data-query';
5
- import { PivotGridAxis, PivotGridField } from '@progress/kendo-pivotgrid-common';
6
- import { PivotGridConfiguratorEditorProps } from './ConfiguratorEditor';
7
- import { PivotGridAxisFilterFieldsExpandChangeEvent, PivotGridAxisFilterFieldExpandEvent } from './AxisFilterFieldsEditor';
8
- import { PivotGridConfiguratorAxesChangeEvent, PivotGridConfiguratorSortChangeEvent, PivotGridConfiguratorFilterChangeEvent } from '../models';
9
- import { PivotGridFieldsEditorFieldExpandEvent, PivotGridFieldsEditorFieldCheckEvent } from './FieldsEditor';
10
- /**
11
- * Represents the props of the [KendoReact PivotGridConfigurator component]({% slug api_pivotgrid_pivotgridconfigurator %}).
12
- */
13
- export interface PivotGridConfiguratorProps {
14
- /**
15
- * Sets the `className` property of the top-most element of the PivotGridConfigurator in addition to the default `k-pivotgrid-configurator` class.
16
- */
17
- className?: string;
18
- /**
19
- * Sets the `id` property of the top-most element of the PivotGridConfigurator.
20
- */
21
- id?: string;
22
- /**
23
- * Sets the `tabIndex` property of the top-most element of the PivotGridConfigurator.
24
- */
25
- tabIndex?: number;
26
- /**
27
- * Sets the `style` property of the top-most element of the PivotGridConfigurator.
28
- */
29
- style?: React.CSSProperties;
30
- /**
31
- * Renders the PivotGridConfigurator in `horizontal` orientation.
32
- */
33
- horizontal?: boolean;
34
- /**
35
- * Sets the `data` of the PivotGridConfigurator.
36
- *
37
- * The `data` represents all fields available in the configurator.
38
- */
39
- data?: PivotGridField[];
40
- /**
41
- * The configuration of the `column` axes.
42
- */
43
- columnAxes?: PivotGridAxis[];
44
- /**
45
- * A callback, fired whenever the `columnAxes` property should change.
46
- */
47
- onColumnAxesChange?: (event: PivotGridConfiguratorAxesChangeEvent) => void;
48
- /**
49
- * The configuration of the `row` axes.
50
- */
51
- rowAxes?: PivotGridAxis[];
52
- /**
53
- * A callback, fired whenever the `rowAxes` property should change.
54
- */
55
- onRowAxesChange?: (event: PivotGridConfiguratorAxesChangeEvent) => void;
56
- /**
57
- * The configuration of the `measure` axes.
58
- */
59
- measureAxes?: PivotGridAxis[];
60
- /**
61
- * A callback, fired whenever the `measureAxes` property should change.
62
- */
63
- onMeasureAxesChange?: (event: PivotGridConfiguratorAxesChangeEvent) => void;
64
- /**
65
- * The descriptors by which the data is sorted.
66
- */
67
- sort?: SortDescriptor[];
68
- /**
69
- * A callback, fired whenever the `sort` property should change.
70
- */
71
- onSortChange?: (event: PivotGridConfiguratorSortChangeEvent) => void;
72
- /**
73
- * The descriptors by which the data is filtered.
74
- */
75
- filter?: FilterDescriptor[];
76
- /**
77
- * A callback, fired whenever the `filter` property should change.
78
- */
79
- onFilterChange?: (event: PivotGridConfiguratorFilterChangeEvent) => void;
80
- /**
81
- * A callback, fired whenever a `field` is expanded.
82
- */
83
- onFieldsEditorFieldExpand?: (event: PivotGridFieldsEditorFieldExpandEvent) => void;
84
- /**
85
- * A callback, fired whenever a `field` is checked.
86
- */
87
- onFieldsEditorFieldCheck?: (event: PivotGridFieldsEditorFieldCheckEvent) => void;
88
- /**
89
- * A callback, fired whenever an `AxisFilterField` is expanded.
90
- */
91
- onAxisFilterFieldExpand?: (event?: PivotGridAxisFilterFieldExpandEvent) => void;
92
- /**
93
- * A callback, fired whenever the `expanded` state of the `AxisFilterFields` is changed.
94
- */
95
- onAxisFilterFieldsExpandChange?: (event?: PivotGridAxisFilterFieldsExpandChangeEvent) => void;
96
- /**
97
- * Overrides the default `editor` component.
98
- *
99
- * The default component is: [PivotGridConfiguratorEditor]({% slug api_pivotgrid_pivotgridconfiguratoreditor %}).
100
- */
101
- editor?: CustomComponent<PivotGridConfiguratorEditorProps>;
102
- /**
103
- * Overrides the default `form` component.
104
- *
105
- * The default component is: [KendoReactForm]({% slug api_form_form %}).
106
- */
107
- form?: CustomComponent<KendoFormProps>;
108
- /**
109
- * Overrides the default `formElement` component.
110
- *
111
- * The default component is: [KendoReactFormElement]({% slug api_form_formelement %}).
112
- */
113
- formElement?: CustomComponent<KendoFormElementProps>;
114
- }
115
- /**
116
- * Represents the object which is passed to the [`ref`](https://reactjs.org/docs/refs-and-the-dom.html) callback of the PivotGridConfigurator component.
117
- */
118
- export interface PivotGridConfiguratorHandle {
119
- props: PivotGridConfiguratorProps;
120
- element: HTMLDivElement | null;
121
- }
122
- /**
123
- * Represents the [KendoReact PivotGridConfigurator component]({% slug api_pivotgrid_pivotgridconfiguratorprops %}).
124
- */
125
- export declare const PivotGridConfigurator: React.ForwardRefExoticComponent<PivotGridConfiguratorProps & React.RefAttributes<PivotGridConfiguratorHandle | null>>;