@progress/kendo-react-layout 4.14.0-dev.202112150919 → 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.
- package/dist/cdn/js/kendo-react-layout.js +1 -1
- package/dist/es/main.d.ts +4 -1
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/panelbar/PanelBar.d.ts +10 -30
- package/dist/es/panelbar/PanelBar.js +131 -45
- package/dist/es/panelbar/PanelBarItem.d.ts +1 -89
- package/dist/es/panelbar/PanelBarItem.js +3 -1
- package/dist/es/panelbar/interfaces/NavigationAction.d.ts +8 -0
- package/dist/es/panelbar/interfaces/NavigationAction.js +9 -0
- package/dist/es/panelbar/interfaces/PanelBarItemClickEventArguments.d.ts +8 -0
- package/dist/es/panelbar/interfaces/PanelBarItemClickEventArguments.js +0 -0
- package/dist/es/panelbar/interfaces/PanelBarItemProps.d.ts +90 -0
- package/dist/es/panelbar/interfaces/PanelBarItemProps.js +0 -0
- package/dist/es/panelbar/{PanelBarInterface.d.ts → interfaces/PanelBarProps.d.ts} +19 -23
- package/dist/es/panelbar/interfaces/PanelBarProps.js +0 -0
- package/dist/es/panelbar/interfaces/PanelBarSelectEventArguments.d.ts +15 -0
- package/dist/es/panelbar/interfaces/PanelBarSelectEventArguments.js +0 -0
- package/dist/es/panelbar/interfaces/RenderPanelBarItem.d.ts +16 -0
- package/dist/es/panelbar/interfaces/RenderPanelBarItem.js +0 -0
- package/dist/es/panelbar/util.d.ts +19 -5
- package/dist/es/panelbar/util.js +75 -21
- package/dist/npm/main.d.ts +4 -1
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/panelbar/PanelBar.d.ts +10 -30
- package/dist/npm/panelbar/PanelBar.js +132 -46
- package/dist/npm/panelbar/PanelBarItem.d.ts +1 -89
- package/dist/npm/panelbar/PanelBarItem.js +3 -1
- package/dist/npm/panelbar/interfaces/NavigationAction.d.ts +8 -0
- package/dist/npm/panelbar/interfaces/NavigationAction.js +11 -0
- package/dist/npm/panelbar/interfaces/PanelBarItemClickEventArguments.d.ts +8 -0
- package/dist/npm/panelbar/{PanelBarInterface.js → interfaces/PanelBarItemClickEventArguments.js} +0 -1
- package/dist/npm/panelbar/interfaces/PanelBarItemProps.d.ts +90 -0
- package/dist/npm/panelbar/interfaces/PanelBarItemProps.js +2 -0
- package/dist/npm/panelbar/{PanelBarInterface.d.ts → interfaces/PanelBarProps.d.ts} +19 -23
- package/dist/npm/panelbar/interfaces/PanelBarProps.js +2 -0
- package/dist/npm/panelbar/interfaces/PanelBarSelectEventArguments.d.ts +15 -0
- package/dist/npm/panelbar/interfaces/PanelBarSelectEventArguments.js +2 -0
- package/dist/npm/panelbar/interfaces/RenderPanelBarItem.d.ts +16 -0
- package/dist/npm/panelbar/interfaces/RenderPanelBarItem.js +2 -0
- package/dist/npm/panelbar/util.d.ts +19 -5
- package/dist/npm/panelbar/util.js +77 -21
- package/dist/systemjs/kendo-react-layout.js +1 -1
- package/package.json +15 -14
- package/dist/es/panelbar/PanelBarInterface.js +0 -1
- package/dist/es/panelbar/services/navigationService.d.ts +0 -23
- package/dist/es/panelbar/services/navigationService.js +0 -51
- package/dist/es/panelbar/services/selectionService.d.ts +0 -23
- package/dist/es/panelbar/services/selectionService.js +0 -88
- package/dist/npm/panelbar/services/navigationService.d.ts +0 -23
- package/dist/npm/panelbar/services/navigationService.js +0 -53
- package/dist/npm/panelbar/services/selectionService.d.ts +0 -23
- package/dist/npm/panelbar/services/selectionService.js +0 -90
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-layout",
|
|
3
|
-
"version": "4.14.0-dev.
|
|
3
|
+
"version": "4.14.0-dev.202112301830",
|
|
4
4
|
"description": "KendoReact Layout package",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,20 +46,20 @@
|
|
|
46
46
|
"@progress/kendo-date-math": "^1.5.1",
|
|
47
47
|
"@progress/kendo-drawing": "^1.8.0",
|
|
48
48
|
"@progress/kendo-licensing": "^1.0.1",
|
|
49
|
-
"@progress/kendo-react-buttons": "4.14.0-dev.
|
|
50
|
-
"@progress/kendo-react-charts": "4.14.0-dev.
|
|
51
|
-
"@progress/kendo-react-dateinputs": "4.14.0-dev.
|
|
52
|
-
"@progress/kendo-react-dropdowns": "4.14.0-dev.
|
|
53
|
-
"@progress/kendo-react-grid": "4.14.0-dev.
|
|
54
|
-
"@progress/kendo-react-indicators": "4.14.0-dev.
|
|
55
|
-
"@progress/kendo-react-inputs": "4.14.0-dev.
|
|
56
|
-
"@progress/kendo-react-intl": "4.14.0-dev.
|
|
57
|
-
"@progress/kendo-react-progressbars": "4.14.0-dev.
|
|
49
|
+
"@progress/kendo-react-buttons": "4.14.0-dev.202112301830",
|
|
50
|
+
"@progress/kendo-react-charts": "4.14.0-dev.202112301830",
|
|
51
|
+
"@progress/kendo-react-dateinputs": "4.14.0-dev.202112301830",
|
|
52
|
+
"@progress/kendo-react-dropdowns": "4.14.0-dev.202112301830",
|
|
53
|
+
"@progress/kendo-react-grid": "4.14.0-dev.202112301830",
|
|
54
|
+
"@progress/kendo-react-indicators": "4.14.0-dev.202112301830",
|
|
55
|
+
"@progress/kendo-react-inputs": "4.14.0-dev.202112301830",
|
|
56
|
+
"@progress/kendo-react-intl": "4.14.0-dev.202112301830",
|
|
57
|
+
"@progress/kendo-react-progressbars": "4.14.0-dev.202112301830"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@progress/kendo-react-animation": "4.14.0-dev.
|
|
61
|
-
"@progress/kendo-react-common": "4.14.0-dev.
|
|
62
|
-
"@progress/kendo-react-popup": "4.14.0-dev.
|
|
60
|
+
"@progress/kendo-react-animation": "4.14.0-dev.202112301830",
|
|
61
|
+
"@progress/kendo-react-common": "4.14.0-dev.202112301830",
|
|
62
|
+
"@progress/kendo-react-popup": "4.14.0-dev.202112301830",
|
|
63
63
|
"prop-types": "^15.6.0"
|
|
64
64
|
},
|
|
65
65
|
"@progress": {
|
|
@@ -70,5 +70,6 @@
|
|
|
70
70
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public"
|
|
73
|
-
}
|
|
73
|
+
},
|
|
74
|
+
"sideEffects": false
|
|
74
75
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// tslint:enable:max-line-length
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
/**
|
|
3
|
-
* @hidden
|
|
4
|
-
*/
|
|
5
|
-
export interface NavigationServiceInterface {
|
|
6
|
-
navigate: (event: React.KeyboardEvent<HTMLElement>, rtl: boolean) => void;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* @hidden
|
|
10
|
-
*/
|
|
11
|
-
export declare enum NavigationAction {
|
|
12
|
-
Toggle = 0,
|
|
13
|
-
Next = 1,
|
|
14
|
-
Previous = 2
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* @hidden
|
|
18
|
-
*/
|
|
19
|
-
export declare class NavigationService implements NavigationServiceInterface {
|
|
20
|
-
private onNavigate;
|
|
21
|
-
constructor(onNavigate: (action: NavigationAction) => void);
|
|
22
|
-
navigate(event: React.KeyboardEvent<HTMLElement>, rtl: boolean): void;
|
|
23
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { Keys } from '@progress/kendo-react-common';
|
|
2
|
-
/**
|
|
3
|
-
* @hidden
|
|
4
|
-
*/
|
|
5
|
-
export var NavigationAction;
|
|
6
|
-
(function (NavigationAction) {
|
|
7
|
-
NavigationAction[NavigationAction["Toggle"] = 0] = "Toggle";
|
|
8
|
-
NavigationAction[NavigationAction["Next"] = 1] = "Next";
|
|
9
|
-
NavigationAction[NavigationAction["Previous"] = 2] = "Previous";
|
|
10
|
-
})(NavigationAction || (NavigationAction = {}));
|
|
11
|
-
/**
|
|
12
|
-
* @hidden
|
|
13
|
-
*/
|
|
14
|
-
var NavigationService = /** @class */ (function () {
|
|
15
|
-
function NavigationService(onNavigate) {
|
|
16
|
-
this.onNavigate = onNavigate;
|
|
17
|
-
}
|
|
18
|
-
NavigationService.prototype.navigate = function (event, rtl) {
|
|
19
|
-
var keyCode = event.keyCode;
|
|
20
|
-
var action;
|
|
21
|
-
switch (keyCode) {
|
|
22
|
-
case Keys.left:
|
|
23
|
-
action = !rtl ? NavigationAction.Previous : NavigationAction.Next;
|
|
24
|
-
break;
|
|
25
|
-
case Keys.up:
|
|
26
|
-
action = NavigationAction.Previous;
|
|
27
|
-
break;
|
|
28
|
-
case Keys.right:
|
|
29
|
-
action = !rtl ? NavigationAction.Next : NavigationAction.Previous;
|
|
30
|
-
break;
|
|
31
|
-
case Keys.down:
|
|
32
|
-
action = NavigationAction.Next;
|
|
33
|
-
break;
|
|
34
|
-
case Keys.space:
|
|
35
|
-
action = NavigationAction.Toggle;
|
|
36
|
-
break;
|
|
37
|
-
case Keys.enter:
|
|
38
|
-
action = NavigationAction.Toggle;
|
|
39
|
-
break;
|
|
40
|
-
default:
|
|
41
|
-
action = null;
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
if (action !== null) {
|
|
45
|
-
event.preventDefault();
|
|
46
|
-
this.onNavigate(action);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
return NavigationService;
|
|
50
|
-
}());
|
|
51
|
-
export { NavigationService };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { PanelBarExpandMode } from '../PanelBarInterface';
|
|
2
|
-
/**
|
|
3
|
-
* @hidden
|
|
4
|
-
*/
|
|
5
|
-
export interface SelectionServiceInterface {
|
|
6
|
-
select: Function;
|
|
7
|
-
focus: Function;
|
|
8
|
-
setExpandMode: Function;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* @hidden
|
|
12
|
-
*/
|
|
13
|
-
export declare class SelectionService {
|
|
14
|
-
private onSelect;
|
|
15
|
-
private onFocus;
|
|
16
|
-
private expandMode;
|
|
17
|
-
constructor(onSelectCallback: any, onFocusCallback: any, expandMode: PanelBarExpandMode);
|
|
18
|
-
select(uniquePrivateKey: number, children: any, expanded: any[]): void;
|
|
19
|
-
focus(currentFocus: number, step: number, children: any): void;
|
|
20
|
-
setExpandMode(expandMode: PanelBarExpandMode): void;
|
|
21
|
-
private flatChildren;
|
|
22
|
-
private flatVisibleChildren;
|
|
23
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { isArrayEqual } from '../util';
|
|
3
|
-
/**
|
|
4
|
-
* @hidden
|
|
5
|
-
*/
|
|
6
|
-
var SelectionService = /** @class */ (function () {
|
|
7
|
-
function SelectionService(onSelectCallback, onFocusCallback, expandMode) {
|
|
8
|
-
var _this = this;
|
|
9
|
-
this.flatChildren = function (children, flattenChildren) {
|
|
10
|
-
if (flattenChildren === void 0) { flattenChildren = []; }
|
|
11
|
-
React.Children.forEach(children, function (child) {
|
|
12
|
-
if (child && child.props && !child.props.disabled) {
|
|
13
|
-
flattenChildren.push(child);
|
|
14
|
-
if (child.props.children) {
|
|
15
|
-
_this.flatChildren(child.props.children, flattenChildren);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
return flattenChildren;
|
|
20
|
-
};
|
|
21
|
-
this.flatVisibleChildren = function (children, flattenVisibleChildren) {
|
|
22
|
-
if (flattenVisibleChildren === void 0) { flattenVisibleChildren = []; }
|
|
23
|
-
React.Children.forEach(children, function (child) {
|
|
24
|
-
if (child && child.props && !child.props.disabled && (child.props.expanded || child.props.parentExpanded)) {
|
|
25
|
-
flattenVisibleChildren.push(child);
|
|
26
|
-
if (child.props.children) {
|
|
27
|
-
_this.flatVisibleChildren(child.props.children, flattenVisibleChildren);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
return flattenVisibleChildren;
|
|
32
|
-
};
|
|
33
|
-
this.onSelect = onSelectCallback;
|
|
34
|
-
this.onFocus = onFocusCallback;
|
|
35
|
-
this.expandMode = expandMode;
|
|
36
|
-
}
|
|
37
|
-
SelectionService.prototype.select = function (uniquePrivateKey, children, expanded) {
|
|
38
|
-
var flattenChildren = this.flatChildren(React.Children.toArray(children));
|
|
39
|
-
var selectedChild;
|
|
40
|
-
var newExpanded;
|
|
41
|
-
flattenChildren.forEach(function (child) {
|
|
42
|
-
if (child.props.uniquePrivateKey === uniquePrivateKey) {
|
|
43
|
-
selectedChild = child;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
switch (this.expandMode) {
|
|
47
|
-
case 'single':
|
|
48
|
-
newExpanded = selectedChild.props.parentUniquePrivateKey.concat([selectedChild.props.uniquePrivateKey]);
|
|
49
|
-
if (isArrayEqual(expanded, newExpanded)) {
|
|
50
|
-
if (selectedChild.props.parentUniquePrivateKey) {
|
|
51
|
-
newExpanded = selectedChild.props.parentUniquePrivateKey.slice();
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
newExpanded = [];
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
break;
|
|
58
|
-
case 'multiple':
|
|
59
|
-
newExpanded = expanded.slice();
|
|
60
|
-
var index = newExpanded.indexOf(selectedChild.props.uniquePrivateKey);
|
|
61
|
-
index === -1 ? newExpanded.push(selectedChild.props.uniquePrivateKey) : newExpanded.splice(index, 1);
|
|
62
|
-
break;
|
|
63
|
-
default:
|
|
64
|
-
newExpanded = expanded.slice();
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
this.onSelect(selectedChild, newExpanded);
|
|
68
|
-
};
|
|
69
|
-
SelectionService.prototype.focus = function (currentFocus, step, children) {
|
|
70
|
-
var flattenChildren = this.flatVisibleChildren(React.Children.toArray(children));
|
|
71
|
-
var focusedChild;
|
|
72
|
-
flattenChildren.forEach(function (child, ixd) {
|
|
73
|
-
if (child.props.uniquePrivateKey === currentFocus) {
|
|
74
|
-
var index = ixd + step < 0 ?
|
|
75
|
-
0 : ixd + step >= flattenChildren.length
|
|
76
|
-
? flattenChildren.length - 1
|
|
77
|
-
: ixd + step;
|
|
78
|
-
focusedChild = flattenChildren[index];
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
this.onFocus(focusedChild);
|
|
82
|
-
};
|
|
83
|
-
SelectionService.prototype.setExpandMode = function (expandMode) {
|
|
84
|
-
this.expandMode = expandMode;
|
|
85
|
-
};
|
|
86
|
-
return SelectionService;
|
|
87
|
-
}());
|
|
88
|
-
export { SelectionService };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
/**
|
|
3
|
-
* @hidden
|
|
4
|
-
*/
|
|
5
|
-
export interface NavigationServiceInterface {
|
|
6
|
-
navigate: (event: React.KeyboardEvent<HTMLElement>, rtl: boolean) => void;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* @hidden
|
|
10
|
-
*/
|
|
11
|
-
export declare enum NavigationAction {
|
|
12
|
-
Toggle = 0,
|
|
13
|
-
Next = 1,
|
|
14
|
-
Previous = 2
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* @hidden
|
|
18
|
-
*/
|
|
19
|
-
export declare class NavigationService implements NavigationServiceInterface {
|
|
20
|
-
private onNavigate;
|
|
21
|
-
constructor(onNavigate: (action: NavigationAction) => void);
|
|
22
|
-
navigate(event: React.KeyboardEvent<HTMLElement>, rtl: boolean): void;
|
|
23
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
4
|
-
/**
|
|
5
|
-
* @hidden
|
|
6
|
-
*/
|
|
7
|
-
var NavigationAction;
|
|
8
|
-
(function (NavigationAction) {
|
|
9
|
-
NavigationAction[NavigationAction["Toggle"] = 0] = "Toggle";
|
|
10
|
-
NavigationAction[NavigationAction["Next"] = 1] = "Next";
|
|
11
|
-
NavigationAction[NavigationAction["Previous"] = 2] = "Previous";
|
|
12
|
-
})(NavigationAction = exports.NavigationAction || (exports.NavigationAction = {}));
|
|
13
|
-
/**
|
|
14
|
-
* @hidden
|
|
15
|
-
*/
|
|
16
|
-
var NavigationService = /** @class */ (function () {
|
|
17
|
-
function NavigationService(onNavigate) {
|
|
18
|
-
this.onNavigate = onNavigate;
|
|
19
|
-
}
|
|
20
|
-
NavigationService.prototype.navigate = function (event, rtl) {
|
|
21
|
-
var keyCode = event.keyCode;
|
|
22
|
-
var action;
|
|
23
|
-
switch (keyCode) {
|
|
24
|
-
case kendo_react_common_1.Keys.left:
|
|
25
|
-
action = !rtl ? NavigationAction.Previous : NavigationAction.Next;
|
|
26
|
-
break;
|
|
27
|
-
case kendo_react_common_1.Keys.up:
|
|
28
|
-
action = NavigationAction.Previous;
|
|
29
|
-
break;
|
|
30
|
-
case kendo_react_common_1.Keys.right:
|
|
31
|
-
action = !rtl ? NavigationAction.Next : NavigationAction.Previous;
|
|
32
|
-
break;
|
|
33
|
-
case kendo_react_common_1.Keys.down:
|
|
34
|
-
action = NavigationAction.Next;
|
|
35
|
-
break;
|
|
36
|
-
case kendo_react_common_1.Keys.space:
|
|
37
|
-
action = NavigationAction.Toggle;
|
|
38
|
-
break;
|
|
39
|
-
case kendo_react_common_1.Keys.enter:
|
|
40
|
-
action = NavigationAction.Toggle;
|
|
41
|
-
break;
|
|
42
|
-
default:
|
|
43
|
-
action = null;
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
if (action !== null) {
|
|
47
|
-
event.preventDefault();
|
|
48
|
-
this.onNavigate(action);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
return NavigationService;
|
|
52
|
-
}());
|
|
53
|
-
exports.NavigationService = NavigationService;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { PanelBarExpandMode } from '../PanelBarInterface';
|
|
2
|
-
/**
|
|
3
|
-
* @hidden
|
|
4
|
-
*/
|
|
5
|
-
export interface SelectionServiceInterface {
|
|
6
|
-
select: Function;
|
|
7
|
-
focus: Function;
|
|
8
|
-
setExpandMode: Function;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* @hidden
|
|
12
|
-
*/
|
|
13
|
-
export declare class SelectionService {
|
|
14
|
-
private onSelect;
|
|
15
|
-
private onFocus;
|
|
16
|
-
private expandMode;
|
|
17
|
-
constructor(onSelectCallback: any, onFocusCallback: any, expandMode: PanelBarExpandMode);
|
|
18
|
-
select(uniquePrivateKey: number, children: any, expanded: any[]): void;
|
|
19
|
-
focus(currentFocus: number, step: number, children: any): void;
|
|
20
|
-
setExpandMode(expandMode: PanelBarExpandMode): void;
|
|
21
|
-
private flatChildren;
|
|
22
|
-
private flatVisibleChildren;
|
|
23
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var React = require("react");
|
|
4
|
-
var util_1 = require("../util");
|
|
5
|
-
/**
|
|
6
|
-
* @hidden
|
|
7
|
-
*/
|
|
8
|
-
var SelectionService = /** @class */ (function () {
|
|
9
|
-
function SelectionService(onSelectCallback, onFocusCallback, expandMode) {
|
|
10
|
-
var _this = this;
|
|
11
|
-
this.flatChildren = function (children, flattenChildren) {
|
|
12
|
-
if (flattenChildren === void 0) { flattenChildren = []; }
|
|
13
|
-
React.Children.forEach(children, function (child) {
|
|
14
|
-
if (child && child.props && !child.props.disabled) {
|
|
15
|
-
flattenChildren.push(child);
|
|
16
|
-
if (child.props.children) {
|
|
17
|
-
_this.flatChildren(child.props.children, flattenChildren);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
return flattenChildren;
|
|
22
|
-
};
|
|
23
|
-
this.flatVisibleChildren = function (children, flattenVisibleChildren) {
|
|
24
|
-
if (flattenVisibleChildren === void 0) { flattenVisibleChildren = []; }
|
|
25
|
-
React.Children.forEach(children, function (child) {
|
|
26
|
-
if (child && child.props && !child.props.disabled && (child.props.expanded || child.props.parentExpanded)) {
|
|
27
|
-
flattenVisibleChildren.push(child);
|
|
28
|
-
if (child.props.children) {
|
|
29
|
-
_this.flatVisibleChildren(child.props.children, flattenVisibleChildren);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
return flattenVisibleChildren;
|
|
34
|
-
};
|
|
35
|
-
this.onSelect = onSelectCallback;
|
|
36
|
-
this.onFocus = onFocusCallback;
|
|
37
|
-
this.expandMode = expandMode;
|
|
38
|
-
}
|
|
39
|
-
SelectionService.prototype.select = function (uniquePrivateKey, children, expanded) {
|
|
40
|
-
var flattenChildren = this.flatChildren(React.Children.toArray(children));
|
|
41
|
-
var selectedChild;
|
|
42
|
-
var newExpanded;
|
|
43
|
-
flattenChildren.forEach(function (child) {
|
|
44
|
-
if (child.props.uniquePrivateKey === uniquePrivateKey) {
|
|
45
|
-
selectedChild = child;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
switch (this.expandMode) {
|
|
49
|
-
case 'single':
|
|
50
|
-
newExpanded = selectedChild.props.parentUniquePrivateKey.concat([selectedChild.props.uniquePrivateKey]);
|
|
51
|
-
if (util_1.isArrayEqual(expanded, newExpanded)) {
|
|
52
|
-
if (selectedChild.props.parentUniquePrivateKey) {
|
|
53
|
-
newExpanded = selectedChild.props.parentUniquePrivateKey.slice();
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
newExpanded = [];
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
break;
|
|
60
|
-
case 'multiple':
|
|
61
|
-
newExpanded = expanded.slice();
|
|
62
|
-
var index = newExpanded.indexOf(selectedChild.props.uniquePrivateKey);
|
|
63
|
-
index === -1 ? newExpanded.push(selectedChild.props.uniquePrivateKey) : newExpanded.splice(index, 1);
|
|
64
|
-
break;
|
|
65
|
-
default:
|
|
66
|
-
newExpanded = expanded.slice();
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
this.onSelect(selectedChild, newExpanded);
|
|
70
|
-
};
|
|
71
|
-
SelectionService.prototype.focus = function (currentFocus, step, children) {
|
|
72
|
-
var flattenChildren = this.flatVisibleChildren(React.Children.toArray(children));
|
|
73
|
-
var focusedChild;
|
|
74
|
-
flattenChildren.forEach(function (child, ixd) {
|
|
75
|
-
if (child.props.uniquePrivateKey === currentFocus) {
|
|
76
|
-
var index = ixd + step < 0 ?
|
|
77
|
-
0 : ixd + step >= flattenChildren.length
|
|
78
|
-
? flattenChildren.length - 1
|
|
79
|
-
: ixd + step;
|
|
80
|
-
focusedChild = flattenChildren[index];
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
this.onFocus(focusedChild);
|
|
84
|
-
};
|
|
85
|
-
SelectionService.prototype.setExpandMode = function (expandMode) {
|
|
86
|
-
this.expandMode = expandMode;
|
|
87
|
-
};
|
|
88
|
-
return SelectionService;
|
|
89
|
-
}());
|
|
90
|
-
exports.SelectionService = SelectionService;
|