@progress/kendo-react-layout 4.14.0-dev.202112221027 → 4.14.0-dev.202112301830

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 (52) hide show
  1. package/dist/cdn/js/kendo-react-layout.js +1 -1
  2. package/dist/es/main.d.ts +4 -1
  3. package/dist/es/package-metadata.js +1 -1
  4. package/dist/es/panelbar/PanelBar.d.ts +10 -30
  5. package/dist/es/panelbar/PanelBar.js +131 -45
  6. package/dist/es/panelbar/PanelBarItem.d.ts +1 -89
  7. package/dist/es/panelbar/PanelBarItem.js +3 -1
  8. package/dist/es/panelbar/interfaces/NavigationAction.d.ts +8 -0
  9. package/dist/es/panelbar/interfaces/NavigationAction.js +9 -0
  10. package/dist/es/panelbar/interfaces/PanelBarItemClickEventArguments.d.ts +8 -0
  11. package/dist/es/panelbar/interfaces/PanelBarItemClickEventArguments.js +0 -0
  12. package/dist/es/panelbar/interfaces/PanelBarItemProps.d.ts +90 -0
  13. package/dist/es/panelbar/interfaces/PanelBarItemProps.js +0 -0
  14. package/dist/es/panelbar/{PanelBarInterface.d.ts → interfaces/PanelBarProps.d.ts} +19 -23
  15. package/dist/es/panelbar/interfaces/PanelBarProps.js +0 -0
  16. package/dist/es/panelbar/interfaces/PanelBarSelectEventArguments.d.ts +15 -0
  17. package/dist/es/panelbar/interfaces/PanelBarSelectEventArguments.js +0 -0
  18. package/dist/es/panelbar/interfaces/RenderPanelBarItem.d.ts +16 -0
  19. package/dist/es/panelbar/interfaces/RenderPanelBarItem.js +0 -0
  20. package/dist/es/panelbar/util.d.ts +19 -5
  21. package/dist/es/panelbar/util.js +75 -21
  22. package/dist/npm/main.d.ts +4 -1
  23. package/dist/npm/package-metadata.js +1 -1
  24. package/dist/npm/panelbar/PanelBar.d.ts +10 -30
  25. package/dist/npm/panelbar/PanelBar.js +132 -46
  26. package/dist/npm/panelbar/PanelBarItem.d.ts +1 -89
  27. package/dist/npm/panelbar/PanelBarItem.js +3 -1
  28. package/dist/npm/panelbar/interfaces/NavigationAction.d.ts +8 -0
  29. package/dist/npm/panelbar/interfaces/NavigationAction.js +11 -0
  30. package/dist/npm/panelbar/interfaces/PanelBarItemClickEventArguments.d.ts +8 -0
  31. package/dist/npm/panelbar/{PanelBarInterface.js → interfaces/PanelBarItemClickEventArguments.js} +0 -1
  32. package/dist/npm/panelbar/interfaces/PanelBarItemProps.d.ts +90 -0
  33. package/dist/npm/panelbar/interfaces/PanelBarItemProps.js +2 -0
  34. package/dist/npm/panelbar/{PanelBarInterface.d.ts → interfaces/PanelBarProps.d.ts} +19 -23
  35. package/dist/npm/panelbar/interfaces/PanelBarProps.js +2 -0
  36. package/dist/npm/panelbar/interfaces/PanelBarSelectEventArguments.d.ts +15 -0
  37. package/dist/npm/panelbar/interfaces/PanelBarSelectEventArguments.js +2 -0
  38. package/dist/npm/panelbar/interfaces/RenderPanelBarItem.d.ts +16 -0
  39. package/dist/npm/panelbar/interfaces/RenderPanelBarItem.js +2 -0
  40. package/dist/npm/panelbar/util.d.ts +19 -5
  41. package/dist/npm/panelbar/util.js +77 -21
  42. package/dist/systemjs/kendo-react-layout.js +1 -1
  43. package/package.json +13 -13
  44. package/dist/es/panelbar/PanelBarInterface.js +0 -1
  45. package/dist/es/panelbar/services/navigationService.d.ts +0 -23
  46. package/dist/es/panelbar/services/navigationService.js +0 -51
  47. package/dist/es/panelbar/services/selectionService.d.ts +0 -23
  48. package/dist/es/panelbar/services/selectionService.js +0 -88
  49. package/dist/npm/panelbar/services/navigationService.d.ts +0 -23
  50. package/dist/npm/panelbar/services/navigationService.js +0 -53
  51. package/dist/npm/panelbar/services/selectionService.d.ts +0 -23
  52. package/dist/npm/panelbar/services/selectionService.js +0 -90
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- // tslint:enable:max-line-length
@@ -0,0 +1,90 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Represents the props of the PanelBarItem component.
4
+ */
5
+ export interface PanelBarItemProps {
6
+ /**
7
+ * Allows individual animation control over the child ([see example]({% slug animations_panelbar %})). By default, it is controlled by the PanelBar component.
8
+ */
9
+ animation?: boolean;
10
+ /**
11
+ * Can be any of PanelBar items, an array of PanelBar items, or a custom component.
12
+ */
13
+ children?: React.ReactNode;
14
+ /**
15
+ * The class name that is set to the PanelBarItem component.
16
+ */
17
+ className?: string;
18
+ /**
19
+ * The class name that is set to the PanelBarItem header.
20
+ */
21
+ headerClassName?: string;
22
+ /**
23
+ * Sets the initial expanded state of the PanelBarItem ([see example]({% slug statesitems_panelbar %}#toc-expanded-items)). Controlled by the PanelBar component.
24
+ */
25
+ expanded?: boolean;
26
+ /**
27
+ * Sets the disabled state of the PanelBarItem ([see example]({% slug statesitems_panelbar %}#toc-disabled-items)).
28
+ */
29
+ disabled?: boolean;
30
+ /**
31
+ * @hidden
32
+ */
33
+ onSelect?: Function;
34
+ /**
35
+ * @hidden
36
+ */
37
+ level?: number;
38
+ /**
39
+ * Defines an icon that will be rendered next to the title ([see example]({% slug titlesitems_panelbar %}#toc-adding-icons)).
40
+ */
41
+ icon?: string;
42
+ /**
43
+ * Defines an icon with a custom CSS class that will be rendered next to the title ([see example]({% slug titlesitems_panelbar %}#toc-adding-icons)).
44
+ */
45
+ iconClass?: string;
46
+ /**
47
+ * Defines the location of the image that will be displayed next to the title ([see example]({% slug titlesitems_panelbar %}#toc-adding-images)).
48
+ */
49
+ imageUrl?: string;
50
+ /**
51
+ * Sets the initial selected state of the PanelBarItem. Controlled by the PanelBarItem component ([see example]({% slug statesitems_panelbar %}#toc-selected-items)).
52
+ */
53
+ selected?: boolean;
54
+ /**
55
+ * Sets the title of the PanelBar item ([see example]({% slug titlesitems_panelbar %}#toc-getting-started)).
56
+ */
57
+ title?: React.ReactNode;
58
+ /**
59
+ * Allows the component to set the `id` property to each item. If not set, a default `id` is applied.
60
+ */
61
+ id?: string;
62
+ /**
63
+ * Sets the initial focused state of the PanelBarItem. Controlled by the PanelBar component.
64
+ */
65
+ focused?: boolean;
66
+ /**
67
+ * @hidden
68
+ */
69
+ parentExpanded?: boolean;
70
+ /**
71
+ * @hidden
72
+ */
73
+ content?: any;
74
+ /**
75
+ * Used to identify the PanelBarItems inside the PanelBar ([see example]({% slug controlling_state_panelbar %})). Does not depend on the state of the PanelBarItem.
76
+ */
77
+ uniquePrivateKey?: string;
78
+ /**
79
+ * @hidden
80
+ */
81
+ parentUniquePrivateKey?: string[];
82
+ /**
83
+ * @hidden
84
+ */
85
+ keepItemsMounted?: boolean;
86
+ /**
87
+ * Sets a custom property. Contained in the PanelBarItem props that are returned from the `onSelect` PanelBar event.
88
+ */
89
+ [customProp: string]: any;
90
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,33 +1,21 @@
1
1
  /// <reference types="react" />
2
- import { PanelBarItem, PanelBarItemProps } from './PanelBarItem';
3
- /**
4
- * The arguments that are passed to the `onSelect` callback function.
5
- */
6
- export interface PanelBarSelectEventArguments {
7
- /**
8
- * The selected PanelBar item.
9
- */
10
- target: React.ReactElement<PanelBarItemProps>;
11
- /**
12
- * @hidden
13
- */
14
- action: string;
15
- }
16
- /**
17
- * @hidden
18
- */
19
- export interface PanelBarItemClickEventArguments {
20
- uniquePrivateKey: number;
21
- target: PanelBarItem;
22
- }
2
+ import { PanelBarSelectEventArguments } from '../../main';
23
3
  /**
24
4
  * Represents the expand modes of the KendoReact PanelBar. Defaults to `multiple`.
25
5
  */
26
6
  export declare type PanelBarExpandMode = 'single' | 'multiple';
27
7
  /**
28
- * @hidden
8
+ * Represents the props of the [KendoReact PanelBar component]({% slug overview_panelbar %}).
29
9
  */
30
- export interface PanelBarInterface {
10
+ export interface PanelBarProps {
11
+ /**
12
+ * The child can be either a single PanelBarItem or a PanelBarItem array.
13
+ */
14
+ children?: React.ReactNode;
15
+ /**
16
+ * The class name that is set to the PanelBar.
17
+ */
18
+ className?: string;
31
19
  /**
32
20
  * Sets the animation state of the PanelBar.
33
21
  */
@@ -56,6 +44,14 @@ export interface PanelBarInterface {
56
44
  * Sets the initial focused state of the PanelBar.
57
45
  */
58
46
  focused?: string;
47
+ /**
48
+ * Determines if the PanelBar items will be mounted after expand collapse. Defaults to `false`.
49
+ */
50
+ keepItemsMounted?: boolean;
51
+ /**
52
+ * Determines if the PanelBar is going to be used in controlled state.
53
+ */
54
+ isControlled?: boolean;
59
55
  /**
60
56
  * Fires each time the user makes a selection ([see example]({% slug controlling_state_panelbar %})).
61
57
  */
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { PanelBarItemProps } from '../interfaces/PanelBarItemProps';
3
+ /**
4
+ * The arguments that are passed to the `onSelect` callback function.
5
+ */
6
+ export interface PanelBarSelectEventArguments {
7
+ /**
8
+ * The selected PanelBar item.
9
+ */
10
+ target: React.ReactElement<PanelBarItemProps>;
11
+ /**
12
+ * The new expanded PanelBar items state.
13
+ */
14
+ expandedItems: string[];
15
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ import { PanelBarState } from '../PanelBar';
3
+ /**
4
+ * @hidden
5
+ */
6
+ export interface RenderPanelBarItem {
7
+ animation?: boolean;
8
+ keepItemsMounted?: boolean;
9
+ state: PanelBarState;
10
+ expanded: string[];
11
+ handleSelect: any;
12
+ children: React.ReactNode;
13
+ parentExpanded?: boolean;
14
+ level?: number;
15
+ parentPrivateKey?: string[];
16
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,19 +1,33 @@
1
1
  import * as React from 'react';
2
2
  import { PanelBarState } from './PanelBar';
3
- import { PanelBarItem, PanelBarItemProps } from './PanelBarItem';
4
- import { PanelBarExpandMode } from './PanelBarInterface';
3
+ import { PanelBarItem } from './PanelBarItem';
4
+ import { RenderPanelBarItem } from './interfaces/RenderPanelBarItem';
5
+ import { PanelBarItemProps } from '../main';
6
+ import { PanelBarExpandMode } from './interfaces/PanelBarProps';
5
7
  /**
6
8
  * @hidden
7
9
  */
8
- export declare const renderChildren: (animation: boolean, keepItemsMounted: boolean, state: PanelBarState, handleSelect: any, children: React.ReactNode, parentExpanded?: boolean, level?: number, parentPrivateKey?: string[]) => React.ReactNode;
10
+ export declare const renderChildren: ({ animation, keepItemsMounted, state, expanded, handleSelect, children, parentExpanded, level, parentPrivateKey }: RenderPanelBarItem) => React.ReactNode;
9
11
  /**
10
12
  * @hidden
11
13
  */
12
- export declare const getInitialState: (props: any, expandMode: PanelBarExpandMode, result?: PanelBarState, _?: boolean, parentExpanded?: boolean, parentPrivateKey?: string[]) => PanelBarState;
14
+ export declare const getFirstId: (props: any) => any;
13
15
  /**
14
16
  * @hidden
15
17
  */
16
- export declare function flatVisibleItems(data: any, flattedItems?: any[], _?: any): any[];
18
+ export declare const getInitialState: (props: any, expandMode: PanelBarExpandMode, result?: PanelBarState, parentExpanded?: boolean, parentPrivateKey?: string[]) => PanelBarState;
19
+ /**
20
+ * @hidden
21
+ */
22
+ export declare function flatVisibleItems(data: any, flattedItems?: any[]): any[];
23
+ /**
24
+ * @hidden
25
+ */
26
+ export declare function flatChildren(children: any, flattenChildren?: any[]): any[];
27
+ /**
28
+ * @hidden
29
+ */
30
+ export declare function flatVisibleChildren(children: any, flattenVisibleChildren?: any[]): any[];
17
31
  /**
18
32
  * @hidden
19
33
  */
@@ -16,23 +16,27 @@ var PanelBarItem_1 = require("./PanelBarItem");
16
16
  /**
17
17
  * @hidden
18
18
  */
19
- exports.renderChildren = function (animation, keepItemsMounted, state, handleSelect, children, parentExpanded, level, parentPrivateKey) {
20
- if (animation === void 0) { animation = true; }
21
- if (keepItemsMounted === void 0) { keepItemsMounted = false; }
22
- if (parentExpanded === void 0) { parentExpanded = true; }
23
- if (level === void 0) { level = 0; }
24
- if (parentPrivateKey === void 0) { parentPrivateKey = []; }
19
+ exports.renderChildren = function (_a) {
20
+ var _b = _a.animation, animation = _b === void 0 ? true : _b, _c = _a.keepItemsMounted, keepItemsMounted = _c === void 0 ? false : _c, state = _a.state, expanded = _a.expanded, handleSelect = _a.handleSelect, children = _a.children, _d = _a.parentExpanded, parentExpanded = _d === void 0 ? true : _d, _e = _a.level, level = _e === void 0 ? 0 : _e, _f = _a.parentPrivateKey, parentPrivateKey = _f === void 0 ? [] : _f;
25
21
  return React.Children.map(children, function (child, idx) {
26
22
  if (child && child.type === PanelBarItem_1.PanelBarItem) {
27
23
  var nestedChildren = void 0;
28
- var privateKey = parentPrivateKey.length ?
29
- parentPrivateKey[parentPrivateKey.length - 1] + ("." + idx)
30
- : "." + idx;
24
+ var privateKey = getId(child, parentPrivateKey, idx);
31
25
  if (child.props.children) {
32
- nestedChildren =
33
- exports.renderChildren(animation, keepItemsMounted, state, handleSelect, child.props.children, (state.expanded || []).indexOf(privateKey) > -1, level + 1, parentPrivateKey.concat([privateKey]));
26
+ var renderState = {
27
+ animation: animation,
28
+ keepItemsMounted: keepItemsMounted,
29
+ state: state,
30
+ expanded: expanded,
31
+ handleSelect: handleSelect,
32
+ children: child.props.children,
33
+ parentExpanded: (expanded || []).indexOf(privateKey) > -1,
34
+ level: level + 1,
35
+ parentPrivateKey: parentPrivateKey.concat([privateKey])
36
+ };
37
+ nestedChildren = exports.renderChildren(renderState);
34
38
  }
35
- return React.cloneElement(child, __assign({}, child.props, { animation: child.props.animation !== undefined ? child.props.animation : animation, keepItemsMounted: keepItemsMounted, id: child.props.id || "k-panelbar-item-default-" + privateKey, uniquePrivateKey: privateKey, parentUniquePrivateKey: parentPrivateKey, parentExpanded: parentExpanded, level: level, expanded: (state.expanded || []).indexOf(privateKey) > -1, focused: state.focused === privateKey && state.wrapperFocused, selected: state.selected === privateKey, children: nestedChildren, onSelect: handleSelect }));
39
+ return React.cloneElement(child, __assign({}, child.props, { animation: child.props.animation !== undefined ? child.props.animation : animation, keepItemsMounted: keepItemsMounted, id: child.props.id || "k-panelbar-item-default-" + privateKey, uniquePrivateKey: privateKey, parentUniquePrivateKey: parentPrivateKey, parentExpanded: parentExpanded, level: level, expanded: (expanded || []).indexOf(privateKey) > -1, focused: state.focused === privateKey && state.wrapperFocused, selected: state.selected === privateKey, children: nestedChildren, onSelect: handleSelect }));
36
40
  }
37
41
  else {
38
42
  return React.createElement("div", { className: "k-panelbar-content k-content" }, child);
@@ -42,21 +46,28 @@ exports.renderChildren = function (animation, keepItemsMounted, state, handleSel
42
46
  /**
43
47
  * @hidden
44
48
  */
45
- exports.getInitialState = function (props, expandMode, result, _, parentExpanded, parentPrivateKey) {
49
+ exports.getFirstId = function (props) {
50
+ var firstItem = React.Children.toArray(props.children)[0];
51
+ if (firstItem) {
52
+ return getId(firstItem, [], 0);
53
+ }
54
+ return '';
55
+ };
56
+ /**
57
+ * @hidden
58
+ */
59
+ exports.getInitialState = function (props, expandMode, result, parentExpanded, parentPrivateKey) {
46
60
  if (result === void 0) { result = {
47
61
  expanded: props.expanded || [],
48
62
  selected: props.selected || '',
49
- focused: props.focused || '.0',
63
+ focused: props.focused || '',
50
64
  wrapperFocused: false
51
65
  }; }
52
- if (_ === void 0) { _ = true; }
53
66
  if (parentExpanded === void 0) { parentExpanded = true; }
54
67
  if (parentPrivateKey === void 0) { parentPrivateKey = []; }
55
68
  React.Children.map(props.children, function (child, idx) {
56
69
  if (child && child.type === PanelBarItem_1.PanelBarItem) {
57
- var privateKey = parentPrivateKey.length ?
58
- parentPrivateKey[parentPrivateKey.length - 1] + ("." + idx)
59
- : "." + idx;
70
+ var privateKey = getId(child, parentPrivateKey, idx);
60
71
  if (!child.props.disabled && parentExpanded) {
61
72
  if (child.props.selected) {
62
73
  result.selected = privateKey;
@@ -73,7 +84,7 @@ exports.getInitialState = function (props, expandMode, result, _, parentExpanded
73
84
  }
74
85
  }
75
86
  if (child.props.children) {
76
- result = exports.getInitialState(child.props, expandMode, result, false, !!child.props.expanded, parentPrivateKey.concat([privateKey]));
87
+ result = exports.getInitialState(child.props, expandMode, result, !!child.props.expanded, parentPrivateKey.concat([privateKey]));
77
88
  }
78
89
  }
79
90
  }
@@ -83,9 +94,18 @@ exports.getInitialState = function (props, expandMode, result, _, parentExpanded
83
94
  /**
84
95
  * @hidden
85
96
  */
86
- function flatVisibleItems(data, flattedItems, _) {
97
+ var getId = function (child, parentPrivateKey, idx) {
98
+ return child && child.props && child.props.id
99
+ ? child.props.id
100
+ : parentPrivateKey.length
101
+ ? parentPrivateKey[parentPrivateKey.length - 1] + ("." + idx)
102
+ : "." + idx;
103
+ };
104
+ /**
105
+ * @hidden
106
+ */
107
+ function flatVisibleItems(data, flattedItems) {
87
108
  if (flattedItems === void 0) { flattedItems = []; }
88
- if (_ === void 0) { _ = null; }
89
109
  (data || []).forEach(function (item) {
90
110
  if (!item.disabled) {
91
111
  flattedItems.push(item);
@@ -97,6 +117,42 @@ function flatVisibleItems(data, flattedItems, _) {
97
117
  return flattedItems;
98
118
  }
99
119
  exports.flatVisibleItems = flatVisibleItems;
120
+ /**
121
+ * @hidden
122
+ */
123
+ function flatChildren(children, flattenChildren) {
124
+ var _this = this;
125
+ if (flattenChildren === void 0) { flattenChildren = []; }
126
+ React.Children.forEach(children, function (child) {
127
+ if (child && child.props && !child.props.disabled) {
128
+ flattenChildren.push(child);
129
+ if (child.props.children) {
130
+ _this.flatChildren(child.props.children, flattenChildren);
131
+ }
132
+ }
133
+ });
134
+ return flattenChildren;
135
+ }
136
+ exports.flatChildren = flatChildren;
137
+ ;
138
+ /**
139
+ * @hidden
140
+ */
141
+ function flatVisibleChildren(children, flattenVisibleChildren) {
142
+ var _this = this;
143
+ if (flattenVisibleChildren === void 0) { flattenVisibleChildren = []; }
144
+ React.Children.forEach(children, function (child) {
145
+ if (child && child.props && !child.props.disabled && (child.props.expanded || child.props.parentExpanded)) {
146
+ flattenVisibleChildren.push(child);
147
+ if (child.props.children) {
148
+ _this.flatVisibleChildren(child.props.children, flattenVisibleChildren);
149
+ }
150
+ }
151
+ });
152
+ return flattenVisibleChildren;
153
+ }
154
+ exports.flatVisibleChildren = flatVisibleChildren;
155
+ ;
100
156
  /**
101
157
  * @hidden
102
158
  */