@progress/kendo-react-layout 4.11.0-dev.202111172052 → 4.11.0-dev.202111180932
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/dist/cdn/js/kendo-react-layout.js +1 -1
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/panelbar/PanelBar.d.ts +6 -0
- package/dist/es/panelbar/PanelBar.js +9 -7
- package/dist/es/panelbar/PanelBarItem.d.ts +13 -1
- package/dist/es/panelbar/PanelBarItem.js +20 -9
- package/dist/es/panelbar/util.d.ts +1 -1
- package/dist/es/panelbar/util.js +4 -3
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/panelbar/PanelBar.d.ts +6 -0
- package/dist/npm/panelbar/PanelBar.js +9 -7
- package/dist/npm/panelbar/PanelBarItem.d.ts +13 -1
- package/dist/npm/panelbar/PanelBarItem.js +20 -9
- package/dist/npm/panelbar/util.d.ts +1 -1
- package/dist/npm/panelbar/util.js +4 -3
- package/dist/systemjs/kendo-react-layout.js +1 -1
- package/package.json +13 -13
|
@@ -5,7 +5,7 @@ export var packageMetadata = {
|
|
|
5
5
|
name: '@progress/kendo-react-layout',
|
|
6
6
|
productName: 'KendoReact',
|
|
7
7
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
8
|
-
publishDate:
|
|
8
|
+
publishDate: 1637227031,
|
|
9
9
|
version: '',
|
|
10
10
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
11
11
|
};
|
|
@@ -15,6 +15,10 @@ export interface PanelBarProps extends PanelBarInterface {
|
|
|
15
15
|
* The class name that is set to the PanelBar.
|
|
16
16
|
*/
|
|
17
17
|
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Determines if the PanelBar items will be mounted after expand collapse. Defaults to `false`.
|
|
20
|
+
*/
|
|
21
|
+
keepItemsMounted?: boolean;
|
|
18
22
|
}
|
|
19
23
|
/**
|
|
20
24
|
* @hidden
|
|
@@ -38,6 +42,7 @@ export declare class PanelBar extends React.Component<PanelBarProps, PanelBarSta
|
|
|
38
42
|
focused: PropTypes.Requireable<string>;
|
|
39
43
|
expandMode: PropTypes.Requireable<string>;
|
|
40
44
|
className: PropTypes.Requireable<string>;
|
|
45
|
+
keepItemsMounted: PropTypes.Requireable<boolean>;
|
|
41
46
|
onSelect: PropTypes.Requireable<(...args: any[]) => any>;
|
|
42
47
|
style: PropTypes.Requireable<object>;
|
|
43
48
|
};
|
|
@@ -47,6 +52,7 @@ export declare class PanelBar extends React.Component<PanelBarProps, PanelBarSta
|
|
|
47
52
|
static defaultProps: {
|
|
48
53
|
expandMode: string;
|
|
49
54
|
animation: boolean;
|
|
55
|
+
keepItemsMounted: boolean;
|
|
50
56
|
};
|
|
51
57
|
/**
|
|
52
58
|
* @hidden
|
|
@@ -41,8 +41,8 @@ var PanelBar = /** @class */ (function (_super) {
|
|
|
41
41
|
*/
|
|
42
42
|
_this.handleSelect = function (event) {
|
|
43
43
|
var state = __assign({}, _this.state, { selected: _this.selected });
|
|
44
|
-
_this._selectionService.select(event.uniquePrivateKey, renderChildren(_this.props.animation, state, _this.handleSelect, _this.props.children), state.expanded);
|
|
45
|
-
_this._selectionService.focus(event.uniquePrivateKey, 0, renderChildren(_this.props.animation, state, _this.handleSelect, _this.props.children));
|
|
44
|
+
_this._selectionService.select(event.uniquePrivateKey, renderChildren(_this.props.animation, _this.props.keepItemsMounted, state, _this.handleSelect, _this.props.children), state.expanded);
|
|
45
|
+
_this._selectionService.focus(event.uniquePrivateKey, 0, renderChildren(_this.props.animation, _this.props.keepItemsMounted, state, _this.handleSelect, _this.props.children));
|
|
46
46
|
};
|
|
47
47
|
/**
|
|
48
48
|
* @hidden
|
|
@@ -71,13 +71,13 @@ var PanelBar = /** @class */ (function (_super) {
|
|
|
71
71
|
var state = __assign({}, _this.state, { selected: _this.selected });
|
|
72
72
|
switch (action) {
|
|
73
73
|
case NavigationAction.Previous:
|
|
74
|
-
_this._selectionService.focus(state.focused, -1, renderChildren(_this.props.animation, state, _this.handleSelect, _this.props.children));
|
|
74
|
+
_this._selectionService.focus(state.focused, -1, renderChildren(_this.props.animation, _this.props.keepItemsMounted, state, _this.handleSelect, _this.props.children));
|
|
75
75
|
break;
|
|
76
76
|
case NavigationAction.Next:
|
|
77
|
-
_this._selectionService.focus(state.focused, 1, renderChildren(_this.props.animation, state, _this.handleSelect, _this.props.children));
|
|
77
|
+
_this._selectionService.focus(state.focused, 1, renderChildren(_this.props.animation, _this.props.keepItemsMounted, state, _this.handleSelect, _this.props.children));
|
|
78
78
|
break;
|
|
79
79
|
case NavigationAction.Toggle:
|
|
80
|
-
_this._selectionService.select(state.focused, renderChildren(_this.props.animation, state, _this.handleSelect, _this.props.children), state.expanded);
|
|
80
|
+
_this._selectionService.select(state.focused, renderChildren(_this.props.animation, _this.props.keepItemsMounted, state, _this.handleSelect, _this.props.children), state.expanded);
|
|
81
81
|
break;
|
|
82
82
|
default:
|
|
83
83
|
}
|
|
@@ -132,7 +132,7 @@ var PanelBar = /** @class */ (function (_super) {
|
|
|
132
132
|
'aria-activedescendant': this.activeDescendant
|
|
133
133
|
};
|
|
134
134
|
var state = __assign({}, this.state, { selected: this.selected });
|
|
135
|
-
var children = renderChildren(this.props.animation, state, this.handleSelect, this.props.children);
|
|
135
|
+
var children = renderChildren(this.props.animation, this.props.keepItemsMounted, state, this.handleSelect, this.props.children);
|
|
136
136
|
var className = classNames('k-panelbar', this.props.className);
|
|
137
137
|
return (React.createElement("ul", __assign({ ref: function (div) { _this._element = div; }, dir: this.props.dir, role: 'tree', tabIndex: 0, onKeyDown: this.handleKeyDown, onFocus: this.handleWrapperFocus, onBlur: this.handleWrapperBlur, className: className, style: this.props.style }, ariaProps), children));
|
|
138
138
|
};
|
|
@@ -173,6 +173,7 @@ var PanelBar = /** @class */ (function (_super) {
|
|
|
173
173
|
focused: PropTypes.string,
|
|
174
174
|
expandMode: PropTypes.oneOf(['single', 'multiple']),
|
|
175
175
|
className: PropTypes.string,
|
|
176
|
+
keepItemsMounted: PropTypes.bool,
|
|
176
177
|
onSelect: PropTypes.func,
|
|
177
178
|
style: PropTypes.object
|
|
178
179
|
};
|
|
@@ -181,7 +182,8 @@ var PanelBar = /** @class */ (function (_super) {
|
|
|
181
182
|
*/
|
|
182
183
|
PanelBar.defaultProps = {
|
|
183
184
|
expandMode: 'multiple',
|
|
184
|
-
animation: true
|
|
185
|
+
animation: true,
|
|
186
|
+
keepItemsMounted: false
|
|
185
187
|
};
|
|
186
188
|
return PanelBar;
|
|
187
189
|
}(React.Component));
|
|
@@ -80,12 +80,20 @@ export interface PanelBarItemProps {
|
|
|
80
80
|
* @hidden
|
|
81
81
|
*/
|
|
82
82
|
parentUniquePrivateKey?: string[];
|
|
83
|
+
/**
|
|
84
|
+
* @hidden
|
|
85
|
+
*/
|
|
86
|
+
keepItemsMounted?: boolean;
|
|
83
87
|
/**
|
|
84
88
|
* Sets a custom property. Contained in the PanelBarItem props that are returned from the `onSelect` PanelBar event.
|
|
85
89
|
*/
|
|
86
90
|
[customProp: string]: any;
|
|
87
91
|
}
|
|
88
|
-
|
|
92
|
+
/** @hidden */
|
|
93
|
+
interface PanelBarItemState {
|
|
94
|
+
show: boolean;
|
|
95
|
+
}
|
|
96
|
+
export declare class PanelBarItem extends React.PureComponent<PanelBarItemProps, PanelBarItemState> {
|
|
89
97
|
/**
|
|
90
98
|
* @hidden
|
|
91
99
|
*/
|
|
@@ -101,6 +109,7 @@ export declare class PanelBarItem extends React.PureComponent<PanelBarItemProps,
|
|
|
101
109
|
title: PropTypes.Requireable<string | PropTypes.ReactElementLike>;
|
|
102
110
|
id: PropTypes.Requireable<string | number>;
|
|
103
111
|
focused: PropTypes.Requireable<boolean>;
|
|
112
|
+
keepItemsMounted: PropTypes.Requireable<boolean>;
|
|
104
113
|
};
|
|
105
114
|
/**
|
|
106
115
|
* @hidden
|
|
@@ -108,9 +117,12 @@ export declare class PanelBarItem extends React.PureComponent<PanelBarItemProps,
|
|
|
108
117
|
static defaultProps: {
|
|
109
118
|
title: string;
|
|
110
119
|
};
|
|
120
|
+
constructor(props: any);
|
|
111
121
|
/**
|
|
112
122
|
* @hidden
|
|
113
123
|
*/
|
|
114
124
|
render(): JSX.Element;
|
|
115
125
|
private handleItemClick;
|
|
126
|
+
private childFactory;
|
|
116
127
|
}
|
|
128
|
+
export {};
|
|
@@ -43,11 +43,10 @@ function iconElement(_a) {
|
|
|
43
43
|
}
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
|
-
// tslint:enable:max-line-length
|
|
47
46
|
var PanelBarItem = /** @class */ (function (_super) {
|
|
48
47
|
__extends(PanelBarItem, _super);
|
|
49
|
-
function PanelBarItem() {
|
|
50
|
-
var _this = _super
|
|
48
|
+
function PanelBarItem(props) {
|
|
49
|
+
var _this = _super.call(this, props) || this;
|
|
51
50
|
_this.handleItemClick = function () {
|
|
52
51
|
var _a = _this.props, onSelect = _a.onSelect, disabled = _a.disabled, id = _a.id;
|
|
53
52
|
if (onSelect && !disabled) {
|
|
@@ -58,14 +57,24 @@ var PanelBarItem = /** @class */ (function (_super) {
|
|
|
58
57
|
});
|
|
59
58
|
}
|
|
60
59
|
};
|
|
60
|
+
_this.childFactory = function (child) {
|
|
61
|
+
if (_this.props.keepItemsMounted) {
|
|
62
|
+
return React.cloneElement(child, __assign({}, child.props, { in: _this.props.expanded }));
|
|
63
|
+
}
|
|
64
|
+
return child;
|
|
65
|
+
};
|
|
66
|
+
_this.state = {
|
|
67
|
+
show: props.expanded
|
|
68
|
+
};
|
|
61
69
|
return _this;
|
|
62
70
|
}
|
|
63
71
|
/**
|
|
64
72
|
* @hidden
|
|
65
73
|
*/
|
|
66
74
|
PanelBarItem.prototype.render = function () {
|
|
75
|
+
var _this = this;
|
|
67
76
|
var _a;
|
|
68
|
-
var _b = this.props, id = _b.id, children = _b.children, title = _b.title, uniquePrivateKey = _b.uniquePrivateKey, disabled = _b.disabled, selected = _b.selected, focused = _b.focused, expanded = _b.expanded, className = _b.className, level = _b.level, headerClassName = _b.headerClassName, animation = _b.animation;
|
|
77
|
+
var _b = this.props, id = _b.id, children = _b.children, title = _b.title, uniquePrivateKey = _b.uniquePrivateKey, disabled = _b.disabled, selected = _b.selected, focused = _b.focused, expanded = _b.expanded, className = _b.className, level = _b.level, headerClassName = _b.headerClassName, animation = _b.animation, keepItemsMounted = _b.keepItemsMounted;
|
|
69
78
|
var panelBarItemAriaAttributes = {
|
|
70
79
|
'role': 'treeitem',
|
|
71
80
|
'aria-disabled': disabled,
|
|
@@ -92,11 +101,12 @@ var PanelBarItem = /** @class */ (function (_super) {
|
|
|
92
101
|
var animationStyle = { display: 'block' };
|
|
93
102
|
var icon = iconElement(this.props);
|
|
94
103
|
var arrow = (!disabled && children) ? React.createElement("span", { className: panelBarItemArrowClassName }) : null;
|
|
95
|
-
var
|
|
96
|
-
|
|
104
|
+
var opened = (!disabled && expanded);
|
|
105
|
+
var content = opened || keepItemsMounted
|
|
106
|
+
? (React.createElement("ul", { role: "group", className: "k-panelbar-group k-panel k-group", style: { display: keepItemsMounted ? (this.state.show ? 'block' : 'none') : 'block' } }, children))
|
|
97
107
|
: null;
|
|
98
|
-
var child = ((animation !== undefined ? animation : true) && !disabled && children)
|
|
99
|
-
(React.createElement(Reveal, { transitionEnterDuration: 200, transitionExitDuration: 200, key: uniquePrivateKey + '_animation', style: animationStyle, children: content }))
|
|
108
|
+
var child = ((animation !== undefined ? animation : true) && !disabled && children)
|
|
109
|
+
? (React.createElement(Reveal, { transitionEnterDuration: 200, transitionExitDuration: 200, key: uniquePrivateKey + '_animation', style: animationStyle, children: content, childFactory: keepItemsMounted && this.childFactory, unmountOnExit: !keepItemsMounted, onBeforeEnter: function () { return keepItemsMounted && _this.setState({ show: true }); }, onAfterExited: function () { return keepItemsMounted && _this.setState({ show: false }); } }))
|
|
100
110
|
: content;
|
|
101
111
|
return (React.createElement("li", __assign({ id: id, className: panelBarItemClassName }, panelBarItemAriaAttributes),
|
|
102
112
|
React.createElement("span", { className: panelBarLinkClassName, onClick: this.handleItemClick },
|
|
@@ -125,7 +135,8 @@ var PanelBarItem = /** @class */ (function (_super) {
|
|
|
125
135
|
PropTypes.string,
|
|
126
136
|
PropTypes.number
|
|
127
137
|
]),
|
|
128
|
-
focused: PropTypes.bool
|
|
138
|
+
focused: PropTypes.bool,
|
|
139
|
+
keepItemsMounted: PropTypes.bool
|
|
129
140
|
};
|
|
130
141
|
/**
|
|
131
142
|
* @hidden
|
|
@@ -5,7 +5,7 @@ import { PanelBarExpandMode } from './PanelBarInterface';
|
|
|
5
5
|
/**
|
|
6
6
|
* @hidden
|
|
7
7
|
*/
|
|
8
|
-
export declare const renderChildren: (animation: boolean, state: PanelBarState, handleSelect: any, children: React.ReactNode, parentExpanded?: boolean, level?: number, parentPrivateKey?: string[]) => React.ReactNode;
|
|
8
|
+
export declare const renderChildren: (animation: boolean, keepItemsMounted: boolean, state: PanelBarState, handleSelect: any, children: React.ReactNode, parentExpanded?: boolean, level?: number, parentPrivateKey?: string[]) => React.ReactNode;
|
|
9
9
|
/**
|
|
10
10
|
* @hidden
|
|
11
11
|
*/
|
package/dist/es/panelbar/util.js
CHANGED
|
@@ -14,8 +14,9 @@ import { PanelBarItem } from './PanelBarItem';
|
|
|
14
14
|
/**
|
|
15
15
|
* @hidden
|
|
16
16
|
*/
|
|
17
|
-
export var renderChildren = function (animation, state, handleSelect, children, parentExpanded, level, parentPrivateKey) {
|
|
17
|
+
export var renderChildren = function (animation, keepItemsMounted, state, handleSelect, children, parentExpanded, level, parentPrivateKey) {
|
|
18
18
|
if (animation === void 0) { animation = true; }
|
|
19
|
+
if (keepItemsMounted === void 0) { keepItemsMounted = false; }
|
|
19
20
|
if (parentExpanded === void 0) { parentExpanded = true; }
|
|
20
21
|
if (level === void 0) { level = 0; }
|
|
21
22
|
if (parentPrivateKey === void 0) { parentPrivateKey = []; }
|
|
@@ -27,9 +28,9 @@ export var renderChildren = function (animation, state, handleSelect, children,
|
|
|
27
28
|
: "." + idx;
|
|
28
29
|
if (child.props.children) {
|
|
29
30
|
nestedChildren =
|
|
30
|
-
renderChildren(animation, state, handleSelect, child.props.children, (state.expanded || []).indexOf(privateKey) > -1
|
|
31
|
+
renderChildren(animation, keepItemsMounted, state, handleSelect, child.props.children, (state.expanded || []).indexOf(privateKey) > -1, level + 1, parentPrivateKey.concat([privateKey]));
|
|
31
32
|
}
|
|
32
|
-
return React.cloneElement(child, __assign({}, child.props, { animation: child.props.animation !== undefined ? child.props.animation : animation, id: child.props.id || "k-panelbar-item-default-" + privateKey, uniquePrivateKey: privateKey, parentUniquePrivateKey: parentPrivateKey, parentExpanded: parentExpanded, level: level, expanded: (state.expanded || []).indexOf(privateKey) > -1
|
|
33
|
+
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 }));
|
|
33
34
|
}
|
|
34
35
|
else {
|
|
35
36
|
return React.createElement("div", { className: "k-panelbar-content k-content" }, child);
|
|
@@ -7,7 +7,7 @@ exports.packageMetadata = {
|
|
|
7
7
|
name: '@progress/kendo-react-layout',
|
|
8
8
|
productName: 'KendoReact',
|
|
9
9
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
10
|
-
publishDate:
|
|
10
|
+
publishDate: 1637227031,
|
|
11
11
|
version: '',
|
|
12
12
|
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'
|
|
13
13
|
};
|
|
@@ -15,6 +15,10 @@ export interface PanelBarProps extends PanelBarInterface {
|
|
|
15
15
|
* The class name that is set to the PanelBar.
|
|
16
16
|
*/
|
|
17
17
|
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Determines if the PanelBar items will be mounted after expand collapse. Defaults to `false`.
|
|
20
|
+
*/
|
|
21
|
+
keepItemsMounted?: boolean;
|
|
18
22
|
}
|
|
19
23
|
/**
|
|
20
24
|
* @hidden
|
|
@@ -38,6 +42,7 @@ export declare class PanelBar extends React.Component<PanelBarProps, PanelBarSta
|
|
|
38
42
|
focused: PropTypes.Requireable<string>;
|
|
39
43
|
expandMode: PropTypes.Requireable<string>;
|
|
40
44
|
className: PropTypes.Requireable<string>;
|
|
45
|
+
keepItemsMounted: PropTypes.Requireable<boolean>;
|
|
41
46
|
onSelect: PropTypes.Requireable<(...args: any[]) => any>;
|
|
42
47
|
style: PropTypes.Requireable<object>;
|
|
43
48
|
};
|
|
@@ -47,6 +52,7 @@ export declare class PanelBar extends React.Component<PanelBarProps, PanelBarSta
|
|
|
47
52
|
static defaultProps: {
|
|
48
53
|
expandMode: string;
|
|
49
54
|
animation: boolean;
|
|
55
|
+
keepItemsMounted: boolean;
|
|
50
56
|
};
|
|
51
57
|
/**
|
|
52
58
|
* @hidden
|
|
@@ -43,8 +43,8 @@ var PanelBar = /** @class */ (function (_super) {
|
|
|
43
43
|
*/
|
|
44
44
|
_this.handleSelect = function (event) {
|
|
45
45
|
var state = __assign({}, _this.state, { selected: _this.selected });
|
|
46
|
-
_this._selectionService.select(event.uniquePrivateKey, util_1.renderChildren(_this.props.animation, state, _this.handleSelect, _this.props.children), state.expanded);
|
|
47
|
-
_this._selectionService.focus(event.uniquePrivateKey, 0, util_1.renderChildren(_this.props.animation, state, _this.handleSelect, _this.props.children));
|
|
46
|
+
_this._selectionService.select(event.uniquePrivateKey, util_1.renderChildren(_this.props.animation, _this.props.keepItemsMounted, state, _this.handleSelect, _this.props.children), state.expanded);
|
|
47
|
+
_this._selectionService.focus(event.uniquePrivateKey, 0, util_1.renderChildren(_this.props.animation, _this.props.keepItemsMounted, state, _this.handleSelect, _this.props.children));
|
|
48
48
|
};
|
|
49
49
|
/**
|
|
50
50
|
* @hidden
|
|
@@ -73,13 +73,13 @@ var PanelBar = /** @class */ (function (_super) {
|
|
|
73
73
|
var state = __assign({}, _this.state, { selected: _this.selected });
|
|
74
74
|
switch (action) {
|
|
75
75
|
case navigationService_1.NavigationAction.Previous:
|
|
76
|
-
_this._selectionService.focus(state.focused, -1, util_1.renderChildren(_this.props.animation, state, _this.handleSelect, _this.props.children));
|
|
76
|
+
_this._selectionService.focus(state.focused, -1, util_1.renderChildren(_this.props.animation, _this.props.keepItemsMounted, state, _this.handleSelect, _this.props.children));
|
|
77
77
|
break;
|
|
78
78
|
case navigationService_1.NavigationAction.Next:
|
|
79
|
-
_this._selectionService.focus(state.focused, 1, util_1.renderChildren(_this.props.animation, state, _this.handleSelect, _this.props.children));
|
|
79
|
+
_this._selectionService.focus(state.focused, 1, util_1.renderChildren(_this.props.animation, _this.props.keepItemsMounted, state, _this.handleSelect, _this.props.children));
|
|
80
80
|
break;
|
|
81
81
|
case navigationService_1.NavigationAction.Toggle:
|
|
82
|
-
_this._selectionService.select(state.focused, util_1.renderChildren(_this.props.animation, state, _this.handleSelect, _this.props.children), state.expanded);
|
|
82
|
+
_this._selectionService.select(state.focused, util_1.renderChildren(_this.props.animation, _this.props.keepItemsMounted, state, _this.handleSelect, _this.props.children), state.expanded);
|
|
83
83
|
break;
|
|
84
84
|
default:
|
|
85
85
|
}
|
|
@@ -134,7 +134,7 @@ var PanelBar = /** @class */ (function (_super) {
|
|
|
134
134
|
'aria-activedescendant': this.activeDescendant
|
|
135
135
|
};
|
|
136
136
|
var state = __assign({}, this.state, { selected: this.selected });
|
|
137
|
-
var children = util_1.renderChildren(this.props.animation, state, this.handleSelect, this.props.children);
|
|
137
|
+
var children = util_1.renderChildren(this.props.animation, this.props.keepItemsMounted, state, this.handleSelect, this.props.children);
|
|
138
138
|
var className = kendo_react_common_1.classNames('k-panelbar', this.props.className);
|
|
139
139
|
return (React.createElement("ul", __assign({ ref: function (div) { _this._element = div; }, dir: this.props.dir, role: 'tree', tabIndex: 0, onKeyDown: this.handleKeyDown, onFocus: this.handleWrapperFocus, onBlur: this.handleWrapperBlur, className: className, style: this.props.style }, ariaProps), children));
|
|
140
140
|
};
|
|
@@ -175,6 +175,7 @@ var PanelBar = /** @class */ (function (_super) {
|
|
|
175
175
|
focused: PropTypes.string,
|
|
176
176
|
expandMode: PropTypes.oneOf(['single', 'multiple']),
|
|
177
177
|
className: PropTypes.string,
|
|
178
|
+
keepItemsMounted: PropTypes.bool,
|
|
178
179
|
onSelect: PropTypes.func,
|
|
179
180
|
style: PropTypes.object
|
|
180
181
|
};
|
|
@@ -183,7 +184,8 @@ var PanelBar = /** @class */ (function (_super) {
|
|
|
183
184
|
*/
|
|
184
185
|
PanelBar.defaultProps = {
|
|
185
186
|
expandMode: 'multiple',
|
|
186
|
-
animation: true
|
|
187
|
+
animation: true,
|
|
188
|
+
keepItemsMounted: false
|
|
187
189
|
};
|
|
188
190
|
return PanelBar;
|
|
189
191
|
}(React.Component));
|
|
@@ -80,12 +80,20 @@ export interface PanelBarItemProps {
|
|
|
80
80
|
* @hidden
|
|
81
81
|
*/
|
|
82
82
|
parentUniquePrivateKey?: string[];
|
|
83
|
+
/**
|
|
84
|
+
* @hidden
|
|
85
|
+
*/
|
|
86
|
+
keepItemsMounted?: boolean;
|
|
83
87
|
/**
|
|
84
88
|
* Sets a custom property. Contained in the PanelBarItem props that are returned from the `onSelect` PanelBar event.
|
|
85
89
|
*/
|
|
86
90
|
[customProp: string]: any;
|
|
87
91
|
}
|
|
88
|
-
|
|
92
|
+
/** @hidden */
|
|
93
|
+
interface PanelBarItemState {
|
|
94
|
+
show: boolean;
|
|
95
|
+
}
|
|
96
|
+
export declare class PanelBarItem extends React.PureComponent<PanelBarItemProps, PanelBarItemState> {
|
|
89
97
|
/**
|
|
90
98
|
* @hidden
|
|
91
99
|
*/
|
|
@@ -101,6 +109,7 @@ export declare class PanelBarItem extends React.PureComponent<PanelBarItemProps,
|
|
|
101
109
|
title: PropTypes.Requireable<string | PropTypes.ReactElementLike>;
|
|
102
110
|
id: PropTypes.Requireable<string | number>;
|
|
103
111
|
focused: PropTypes.Requireable<boolean>;
|
|
112
|
+
keepItemsMounted: PropTypes.Requireable<boolean>;
|
|
104
113
|
};
|
|
105
114
|
/**
|
|
106
115
|
* @hidden
|
|
@@ -108,9 +117,12 @@ export declare class PanelBarItem extends React.PureComponent<PanelBarItemProps,
|
|
|
108
117
|
static defaultProps: {
|
|
109
118
|
title: string;
|
|
110
119
|
};
|
|
120
|
+
constructor(props: any);
|
|
111
121
|
/**
|
|
112
122
|
* @hidden
|
|
113
123
|
*/
|
|
114
124
|
render(): JSX.Element;
|
|
115
125
|
private handleItemClick;
|
|
126
|
+
private childFactory;
|
|
116
127
|
}
|
|
128
|
+
export {};
|
|
@@ -45,11 +45,10 @@ function iconElement(_a) {
|
|
|
45
45
|
}
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
48
|
-
// tslint:enable:max-line-length
|
|
49
48
|
var PanelBarItem = /** @class */ (function (_super) {
|
|
50
49
|
__extends(PanelBarItem, _super);
|
|
51
|
-
function PanelBarItem() {
|
|
52
|
-
var _this = _super
|
|
50
|
+
function PanelBarItem(props) {
|
|
51
|
+
var _this = _super.call(this, props) || this;
|
|
53
52
|
_this.handleItemClick = function () {
|
|
54
53
|
var _a = _this.props, onSelect = _a.onSelect, disabled = _a.disabled, id = _a.id;
|
|
55
54
|
if (onSelect && !disabled) {
|
|
@@ -60,14 +59,24 @@ var PanelBarItem = /** @class */ (function (_super) {
|
|
|
60
59
|
});
|
|
61
60
|
}
|
|
62
61
|
};
|
|
62
|
+
_this.childFactory = function (child) {
|
|
63
|
+
if (_this.props.keepItemsMounted) {
|
|
64
|
+
return React.cloneElement(child, __assign({}, child.props, { in: _this.props.expanded }));
|
|
65
|
+
}
|
|
66
|
+
return child;
|
|
67
|
+
};
|
|
68
|
+
_this.state = {
|
|
69
|
+
show: props.expanded
|
|
70
|
+
};
|
|
63
71
|
return _this;
|
|
64
72
|
}
|
|
65
73
|
/**
|
|
66
74
|
* @hidden
|
|
67
75
|
*/
|
|
68
76
|
PanelBarItem.prototype.render = function () {
|
|
77
|
+
var _this = this;
|
|
69
78
|
var _a;
|
|
70
|
-
var _b = this.props, id = _b.id, children = _b.children, title = _b.title, uniquePrivateKey = _b.uniquePrivateKey, disabled = _b.disabled, selected = _b.selected, focused = _b.focused, expanded = _b.expanded, className = _b.className, level = _b.level, headerClassName = _b.headerClassName, animation = _b.animation;
|
|
79
|
+
var _b = this.props, id = _b.id, children = _b.children, title = _b.title, uniquePrivateKey = _b.uniquePrivateKey, disabled = _b.disabled, selected = _b.selected, focused = _b.focused, expanded = _b.expanded, className = _b.className, level = _b.level, headerClassName = _b.headerClassName, animation = _b.animation, keepItemsMounted = _b.keepItemsMounted;
|
|
71
80
|
var panelBarItemAriaAttributes = {
|
|
72
81
|
'role': 'treeitem',
|
|
73
82
|
'aria-disabled': disabled,
|
|
@@ -94,11 +103,12 @@ var PanelBarItem = /** @class */ (function (_super) {
|
|
|
94
103
|
var animationStyle = { display: 'block' };
|
|
95
104
|
var icon = iconElement(this.props);
|
|
96
105
|
var arrow = (!disabled && children) ? React.createElement("span", { className: panelBarItemArrowClassName }) : null;
|
|
97
|
-
var
|
|
98
|
-
|
|
106
|
+
var opened = (!disabled && expanded);
|
|
107
|
+
var content = opened || keepItemsMounted
|
|
108
|
+
? (React.createElement("ul", { role: "group", className: "k-panelbar-group k-panel k-group", style: { display: keepItemsMounted ? (this.state.show ? 'block' : 'none') : 'block' } }, children))
|
|
99
109
|
: null;
|
|
100
|
-
var child = ((animation !== undefined ? animation : true) && !disabled && children)
|
|
101
|
-
(React.createElement(kendo_react_animation_1.Reveal, { transitionEnterDuration: 200, transitionExitDuration: 200, key: uniquePrivateKey + '_animation', style: animationStyle, children: content }))
|
|
110
|
+
var child = ((animation !== undefined ? animation : true) && !disabled && children)
|
|
111
|
+
? (React.createElement(kendo_react_animation_1.Reveal, { transitionEnterDuration: 200, transitionExitDuration: 200, key: uniquePrivateKey + '_animation', style: animationStyle, children: content, childFactory: keepItemsMounted && this.childFactory, unmountOnExit: !keepItemsMounted, onBeforeEnter: function () { return keepItemsMounted && _this.setState({ show: true }); }, onAfterExited: function () { return keepItemsMounted && _this.setState({ show: false }); } }))
|
|
102
112
|
: content;
|
|
103
113
|
return (React.createElement("li", __assign({ id: id, className: panelBarItemClassName }, panelBarItemAriaAttributes),
|
|
104
114
|
React.createElement("span", { className: panelBarLinkClassName, onClick: this.handleItemClick },
|
|
@@ -127,7 +137,8 @@ var PanelBarItem = /** @class */ (function (_super) {
|
|
|
127
137
|
PropTypes.string,
|
|
128
138
|
PropTypes.number
|
|
129
139
|
]),
|
|
130
|
-
focused: PropTypes.bool
|
|
140
|
+
focused: PropTypes.bool,
|
|
141
|
+
keepItemsMounted: PropTypes.bool
|
|
131
142
|
};
|
|
132
143
|
/**
|
|
133
144
|
* @hidden
|
|
@@ -5,7 +5,7 @@ import { PanelBarExpandMode } from './PanelBarInterface';
|
|
|
5
5
|
/**
|
|
6
6
|
* @hidden
|
|
7
7
|
*/
|
|
8
|
-
export declare const renderChildren: (animation: boolean, state: PanelBarState, handleSelect: any, children: React.ReactNode, parentExpanded?: boolean, level?: number, parentPrivateKey?: string[]) => React.ReactNode;
|
|
8
|
+
export declare const renderChildren: (animation: boolean, keepItemsMounted: boolean, state: PanelBarState, handleSelect: any, children: React.ReactNode, parentExpanded?: boolean, level?: number, parentPrivateKey?: string[]) => React.ReactNode;
|
|
9
9
|
/**
|
|
10
10
|
* @hidden
|
|
11
11
|
*/
|
|
@@ -16,8 +16,9 @@ var PanelBarItem_1 = require("./PanelBarItem");
|
|
|
16
16
|
/**
|
|
17
17
|
* @hidden
|
|
18
18
|
*/
|
|
19
|
-
exports.renderChildren = function (animation, state, handleSelect, children, parentExpanded, level, parentPrivateKey) {
|
|
19
|
+
exports.renderChildren = function (animation, keepItemsMounted, state, handleSelect, children, parentExpanded, level, parentPrivateKey) {
|
|
20
20
|
if (animation === void 0) { animation = true; }
|
|
21
|
+
if (keepItemsMounted === void 0) { keepItemsMounted = false; }
|
|
21
22
|
if (parentExpanded === void 0) { parentExpanded = true; }
|
|
22
23
|
if (level === void 0) { level = 0; }
|
|
23
24
|
if (parentPrivateKey === void 0) { parentPrivateKey = []; }
|
|
@@ -29,9 +30,9 @@ exports.renderChildren = function (animation, state, handleSelect, children, par
|
|
|
29
30
|
: "." + idx;
|
|
30
31
|
if (child.props.children) {
|
|
31
32
|
nestedChildren =
|
|
32
|
-
exports.renderChildren(animation, state, handleSelect, child.props.children, (state.expanded || []).indexOf(privateKey) > -1
|
|
33
|
+
exports.renderChildren(animation, keepItemsMounted, state, handleSelect, child.props.children, (state.expanded || []).indexOf(privateKey) > -1, level + 1, parentPrivateKey.concat([privateKey]));
|
|
33
34
|
}
|
|
34
|
-
return React.cloneElement(child, __assign({}, child.props, { animation: child.props.animation !== undefined ? child.props.animation : animation, id: child.props.id || "k-panelbar-item-default-" + privateKey, uniquePrivateKey: privateKey, parentUniquePrivateKey: parentPrivateKey, parentExpanded: parentExpanded, level: level, expanded: (state.expanded || []).indexOf(privateKey) > -1
|
|
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 }));
|
|
35
36
|
}
|
|
36
37
|
else {
|
|
37
38
|
return React.createElement("div", { className: "k-panelbar-content k-content" }, child);
|