@progress/kendo-themes-html 4.43.1-dev.1 → 4.43.1-dev.5
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/lib/jsx-runtime.js +21 -1
- package/package.json +7 -7
- package/src/autocomplete/autocomplete.jsx +2 -2
- package/src/avatar/README.md +1 -1
- package/src/avatar/avatar.jsx +17 -20
- package/src/button/button.jsx +2 -2
- package/src/checkbox/checkbox.jsx +2 -2
- package/src/chip/README.md +47 -0
- package/src/chip/chip-actions.jsx +80 -0
- package/src/chip/chip-avatar.jsx +13 -0
- package/src/chip/chip-list.jsx +84 -0
- package/src/chip/chip.jsx +180 -0
- package/src/chip/index.js +4 -0
- package/src/colorpicker/README.md +24 -15
- package/src/colorpicker/color-preview.jsx +27 -20
- package/src/colorpicker/colorpicker.jsx +5 -7
- package/src/combobox/combobox.jsx +5 -7
- package/src/dateinput/dateinput.jsx +5 -7
- package/src/datepicker/datepicker.jsx +5 -7
- package/src/datetimepicker/datetimepicker.jsx +5 -7
- package/src/dropdownlist/dropdownlist.jsx +5 -7
- package/src/fab/README.md +19 -0
- package/src/fab/fab.jsx +154 -0
- package/src/fab/index.js +1 -0
- package/src/index.js +4 -3
- package/src/input/input.jsx +1 -1
- package/src/input/picker.jsx +3 -3
- package/src/list/README.md +14 -0
- package/src/list/list-content.jsx +18 -17
- package/src/list/list-header.jsx +2 -1
- package/src/maskedtextbox/maskedtextbox.jsx +8 -11
- package/src/menu/README.md +40 -0
- package/src/menu/index.js +3 -0
- package/src/menu/menu-item-content.jsx +48 -0
- package/src/menu/menu-item.jsx +174 -0
- package/src/menu/menu-list.jsx +74 -0
- package/src/numerictextbox/numerictextbox.jsx +5 -7
- package/src/popup/popup.jsx +1 -1
- package/src/radio/radio.jsx +6 -2
- package/src/searchbox/searchbox.jsx +1 -1
- package/src/switch/README.md +3 -3
- package/src/switch/switch.jsx +4 -4
- package/src/textarea/textarea.jsx +1 -1
- package/src/textbox/textbox.jsx +1 -1
- package/src/timepicker/timepicker.jsx +5 -7
- package/src/treeview/README.md +0 -0
- package/src/treeview/index.js +4 -0
- package/src/treeview/treeview-group.jsx +70 -0
- package/src/treeview/treeview-item.jsx +142 -0
- package/src/treeview/treeview-leaf.jsx +99 -0
- package/src/treeview/treeview.jsx +125 -0
- package/utils/styles.js +9 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Component, globalDefaultProps } from '../component/index';
|
|
2
|
+
|
|
3
|
+
class MenuItemContent extends Component {
|
|
4
|
+
render() {
|
|
5
|
+
return <MenuItemContentStatic {...this.props} />;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function MenuItemContentStatic(props) {
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
className: ownClassName,
|
|
13
|
+
|
|
14
|
+
children,
|
|
15
|
+
|
|
16
|
+
...htmlAttributes
|
|
17
|
+
} = props;
|
|
18
|
+
|
|
19
|
+
let menuItemContentClasses = [
|
|
20
|
+
ownClassName,
|
|
21
|
+
'k-menu-item-content'
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
if (children.length === 0) {
|
|
25
|
+
return <></>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<span className={menuItemContentClasses} {...htmlAttributes}>
|
|
30
|
+
{children}
|
|
31
|
+
</span>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
MenuItemContentStatic.defaultProps = {
|
|
36
|
+
...globalDefaultProps,
|
|
37
|
+
|
|
38
|
+
children: []
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
MenuItemContentStatic.propTypes = {
|
|
42
|
+
children: typeof [],
|
|
43
|
+
className: typeof '',
|
|
44
|
+
|
|
45
|
+
htmlAttributes: typeof []
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export { MenuItemContent, MenuItemContentStatic };
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { Component, globalDefaultProps } from '../component/index';
|
|
2
|
+
import { IconStatic } from '../icon/index';
|
|
3
|
+
|
|
4
|
+
class MenuItem extends Component {
|
|
5
|
+
init() {
|
|
6
|
+
let subItem = <></>;
|
|
7
|
+
let contentTemplate = <></>;
|
|
8
|
+
let children = this._props.children;
|
|
9
|
+
let newChildren = [];
|
|
10
|
+
|
|
11
|
+
children.forEach( child => {
|
|
12
|
+
let component = child._component;
|
|
13
|
+
|
|
14
|
+
if (component === 'MenuItem') {
|
|
15
|
+
subItem.props.children.push( child );
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (component === 'MenuItemContent') {
|
|
20
|
+
contentTemplate.props.children.push( child );
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
newChildren.push( child );
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
this._props.subItem = subItem;
|
|
28
|
+
this._props.contentTemplate = contentTemplate;
|
|
29
|
+
this._props.children = newChildren;
|
|
30
|
+
}
|
|
31
|
+
render() {
|
|
32
|
+
return <MenuItemStatic {...this.props} />;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function MenuItemStatic(props) {
|
|
37
|
+
const {
|
|
38
|
+
className: ownClassName,
|
|
39
|
+
|
|
40
|
+
text,
|
|
41
|
+
|
|
42
|
+
icon,
|
|
43
|
+
|
|
44
|
+
showArrow,
|
|
45
|
+
arrowIconName,
|
|
46
|
+
|
|
47
|
+
contentTemplate,
|
|
48
|
+
|
|
49
|
+
hover,
|
|
50
|
+
focus,
|
|
51
|
+
active,
|
|
52
|
+
selected,
|
|
53
|
+
disabled,
|
|
54
|
+
|
|
55
|
+
dir,
|
|
56
|
+
|
|
57
|
+
aria,
|
|
58
|
+
legacy,
|
|
59
|
+
|
|
60
|
+
...htmlAttributes
|
|
61
|
+
} = props;
|
|
62
|
+
|
|
63
|
+
let menuItemClasses = [
|
|
64
|
+
ownClassName,
|
|
65
|
+
'k-item k-menu-item',
|
|
66
|
+
{
|
|
67
|
+
'k-disabled': disabled === true
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
let menuItemLinkClasses = [
|
|
72
|
+
'k-link k-menu-link',
|
|
73
|
+
{
|
|
74
|
+
'k-hover': hover === true,
|
|
75
|
+
'k-focus': focus === true,
|
|
76
|
+
'k-active': active === true,
|
|
77
|
+
'k-selected': selected === true,
|
|
78
|
+
'k-disabled': disabled === true
|
|
79
|
+
}
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
let expandArrowName = arrowIconName;
|
|
83
|
+
|
|
84
|
+
if ( expandArrowName === '' ) {
|
|
85
|
+
expandArrowName = dir === 'rtl'
|
|
86
|
+
? 'arrow-w'
|
|
87
|
+
: 'arrow-e';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Augment attributes
|
|
91
|
+
htmlAttributes.disabled = disabled;
|
|
92
|
+
|
|
93
|
+
let ariaAttr = aria
|
|
94
|
+
? {}
|
|
95
|
+
: {};
|
|
96
|
+
|
|
97
|
+
if (legacy) {
|
|
98
|
+
|
|
99
|
+
let legacyMenuItemClasses = [
|
|
100
|
+
ownClassName,
|
|
101
|
+
'k-item k-menu-item',
|
|
102
|
+
{
|
|
103
|
+
'k-state-hover': hover === true,
|
|
104
|
+
'k-state-focus': focus === true,
|
|
105
|
+
'k-state-selected': selected === true,
|
|
106
|
+
'k-state-disabled': disabled === true,
|
|
107
|
+
}
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<li className={legacyMenuItemClasses} {...ariaAttr} {...htmlAttributes}>
|
|
112
|
+
<span className={`k-link k-menu-link ${active === true ? 'k-state-active' : ''}`}>
|
|
113
|
+
{icon && <IconStatic className="k-menu-link-icon" name={icon} />}
|
|
114
|
+
<span className="k-menu-link-text">{text}</span>
|
|
115
|
+
{showArrow && <span className="k-menu-expand-arrow"><IconStatic name={expandArrowName} /></span>}
|
|
116
|
+
</span>
|
|
117
|
+
{contentTemplate}
|
|
118
|
+
</li>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<li className={menuItemClasses} {...ariaAttr} {...htmlAttributes}>
|
|
124
|
+
<span className={menuItemLinkClasses}>
|
|
125
|
+
{icon && <IconStatic className="k-menu-link-icon" name={icon} />}
|
|
126
|
+
<span className="k-menu-link-text">{text}</span>
|
|
127
|
+
{showArrow && <span className="k-menu-expand-arrow"><IconStatic name={expandArrowName} /></span>}
|
|
128
|
+
</span>
|
|
129
|
+
{contentTemplate}
|
|
130
|
+
</li>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
MenuItemStatic.defaultProps = {
|
|
135
|
+
...globalDefaultProps,
|
|
136
|
+
|
|
137
|
+
text: '',
|
|
138
|
+
icon: '',
|
|
139
|
+
|
|
140
|
+
className: '',
|
|
141
|
+
arrowIconName: '',
|
|
142
|
+
|
|
143
|
+
size: 'medium',
|
|
144
|
+
|
|
145
|
+
dir: 'ltr'
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
MenuItemStatic.propTypes = {
|
|
149
|
+
text: typeof '',
|
|
150
|
+
icon: typeof '',
|
|
151
|
+
|
|
152
|
+
showArrow: typeof false,
|
|
153
|
+
arrowIconName: typeof '',
|
|
154
|
+
|
|
155
|
+
contentTemplate: typeof '#fragment',
|
|
156
|
+
|
|
157
|
+
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
158
|
+
|
|
159
|
+
hover: typeof false,
|
|
160
|
+
focus: typeof false,
|
|
161
|
+
active: typeof false,
|
|
162
|
+
selected: typeof false,
|
|
163
|
+
disabled: typeof false,
|
|
164
|
+
|
|
165
|
+
aria: typeof false,
|
|
166
|
+
legacy: typeof false,
|
|
167
|
+
|
|
168
|
+
dir: typeof '',
|
|
169
|
+
|
|
170
|
+
className: typeof '',
|
|
171
|
+
htmlAttributes: typeof []
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export { MenuItem, MenuItemStatic };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as styles from '../../utils/styles';
|
|
2
|
+
import { Component, globalDefaultProps } from '../component/index';
|
|
3
|
+
|
|
4
|
+
class MenuList extends Component {
|
|
5
|
+
render() {
|
|
6
|
+
return <MenuListStatic {...this.props} />;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function MenuListStatic(props) {
|
|
11
|
+
const {
|
|
12
|
+
className: ownClassName,
|
|
13
|
+
children,
|
|
14
|
+
|
|
15
|
+
size,
|
|
16
|
+
|
|
17
|
+
aria,
|
|
18
|
+
legacy,
|
|
19
|
+
|
|
20
|
+
...htmlAttributes
|
|
21
|
+
} = props;
|
|
22
|
+
|
|
23
|
+
let menuListClasses = [
|
|
24
|
+
ownClassName,
|
|
25
|
+
'k-menu-group',
|
|
26
|
+
styles.sizeClass( size, 'k-menu-group' ),
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
let ariaAttr = aria
|
|
30
|
+
? {}
|
|
31
|
+
: {};
|
|
32
|
+
|
|
33
|
+
if (legacy) {
|
|
34
|
+
|
|
35
|
+
let legacyMenuListClasses = [
|
|
36
|
+
ownClassName,
|
|
37
|
+
'k-group k-menu-group k-reset',
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<ul className={legacyMenuListClasses} {...ariaAttr} {...htmlAttributes}>
|
|
42
|
+
{children}
|
|
43
|
+
</ul>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<ul className={menuListClasses} {...ariaAttr} {...htmlAttributes}>
|
|
49
|
+
{children}
|
|
50
|
+
</ul>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
MenuListStatic.defaultProps = {
|
|
55
|
+
...globalDefaultProps,
|
|
56
|
+
|
|
57
|
+
className: '',
|
|
58
|
+
|
|
59
|
+
size: 'medium'
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
MenuListStatic.propTypes = {
|
|
63
|
+
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
64
|
+
|
|
65
|
+
children: typeof [],
|
|
66
|
+
|
|
67
|
+
aria: typeof false,
|
|
68
|
+
legacy: typeof false,
|
|
69
|
+
|
|
70
|
+
className: typeof '',
|
|
71
|
+
htmlAttributes: typeof []
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export { MenuList, MenuListStatic };
|
|
@@ -75,17 +75,15 @@ function NumericTextboxStatic(props) {
|
|
|
75
75
|
'k-widget',
|
|
76
76
|
'k-numerictextbox',
|
|
77
77
|
{
|
|
78
|
+
'k-state-hover': hover === true,
|
|
79
|
+
'k-state-focus': focus === true,
|
|
80
|
+
'k-state-invalid': invalid === true,
|
|
78
81
|
'k-state-disabled': disabled === true
|
|
79
82
|
}
|
|
80
83
|
];
|
|
81
84
|
|
|
82
85
|
let legacyWrapClasses = [
|
|
83
|
-
'k-numeric-wrap'
|
|
84
|
-
{
|
|
85
|
-
'k-state-hover': hover === true,
|
|
86
|
-
'k-state-focused': focus === true,
|
|
87
|
-
'k-state-invalid': invalid === true
|
|
88
|
-
}
|
|
86
|
+
'k-numeric-wrap'
|
|
89
87
|
];
|
|
90
88
|
|
|
91
89
|
let legacyInputClasses = [
|
|
@@ -149,7 +147,7 @@ NumericTextboxStatic.propTypes = {
|
|
|
149
147
|
showClearButton: typeof true,
|
|
150
148
|
|
|
151
149
|
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
152
|
-
rounded: typeof [ null, 'small', 'medium', 'large', '
|
|
150
|
+
rounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
153
151
|
|
|
154
152
|
fillMode: typeof [ null, 'solid', 'flat', 'outline' ],
|
|
155
153
|
|
package/src/popup/popup.jsx
CHANGED
|
@@ -69,7 +69,7 @@ PopupStatic.propTypes = {
|
|
|
69
69
|
className: typeof '',
|
|
70
70
|
|
|
71
71
|
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
72
|
-
rounded: typeof [ null, 'small', 'medium', 'large'
|
|
72
|
+
rounded: typeof [ null, 'small', 'medium', 'large' ],
|
|
73
73
|
|
|
74
74
|
aria: typeof false,
|
|
75
75
|
legacy: typeof false,
|
package/src/radio/radio.jsx
CHANGED
|
@@ -62,10 +62,14 @@ function RadioStatic(props) {
|
|
|
62
62
|
}
|
|
63
63
|
];
|
|
64
64
|
|
|
65
|
-
return
|
|
65
|
+
return (
|
|
66
|
+
<span className="k-radio-wrap"><input type="radio" className={legacyClasses} {...ariaAttr} {...htmlAttributes}/></span>
|
|
67
|
+
);
|
|
66
68
|
}
|
|
67
69
|
|
|
68
|
-
return
|
|
70
|
+
return (
|
|
71
|
+
<span className="k-radio-wrap"><input type="radio" className={radioClasses} {...ariaAttr} {...htmlAttributes}/></span>
|
|
72
|
+
);
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
RadioStatic.defaultProps = {
|
|
@@ -150,7 +150,7 @@ SearchboxInner.propTypes = {
|
|
|
150
150
|
suffix: typeof '#fragment',
|
|
151
151
|
|
|
152
152
|
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
153
|
-
rounded: typeof [ null, 'small', 'medium', 'large', '
|
|
153
|
+
rounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
154
154
|
|
|
155
155
|
fillMode: typeof [ null, 'solid', 'flat', 'outline' ],
|
|
156
156
|
|
package/src/switch/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
```html
|
|
2
2
|
<!-- default rendering -->
|
|
3
|
-
<span class="k-switch k-switch-on k-switch-md k-rounded-
|
|
4
|
-
<span class="k-switch-track k-rounded-
|
|
3
|
+
<span class="k-switch k-switch-on k-switch-md k-rounded-full">
|
|
4
|
+
<span class="k-switch-track k-rounded-full">
|
|
5
5
|
<span class="k-switch-label-on">On</span>
|
|
6
6
|
<span class="k-switch-label-off">Off</span>
|
|
7
7
|
</span>
|
|
8
8
|
<span class="k-switch-thumb-wrap">
|
|
9
|
-
<span class="k-switch-thumb k-rounded-
|
|
9
|
+
<span class="k-switch-thumb k-rounded-full"></span>
|
|
10
10
|
</span>
|
|
11
11
|
</span>
|
|
12
12
|
|
package/src/switch/switch.jsx
CHANGED
|
@@ -105,8 +105,8 @@ SwitchStatic.defaultProps = {
|
|
|
105
105
|
offLabel: '',
|
|
106
106
|
|
|
107
107
|
size: 'medium',
|
|
108
|
-
trackRounded: '
|
|
109
|
-
thumbRounded: '
|
|
108
|
+
trackRounded: 'full',
|
|
109
|
+
thumbRounded: 'full'
|
|
110
110
|
};
|
|
111
111
|
SwitchStatic.propTypes = {
|
|
112
112
|
checked: typeof false,
|
|
@@ -115,8 +115,8 @@ SwitchStatic.propTypes = {
|
|
|
115
115
|
offLabel: typeof '',
|
|
116
116
|
|
|
117
117
|
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
118
|
-
trackRounded: typeof [ null, '
|
|
119
|
-
thumbRounded: typeof [ null, '
|
|
118
|
+
trackRounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
119
|
+
thumbRounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
120
120
|
|
|
121
121
|
hover: typeof false,
|
|
122
122
|
focus: typeof false,
|
|
@@ -117,7 +117,7 @@ TextareaStatic.propTypes = {
|
|
|
117
117
|
suffix: typeof '#fragment',
|
|
118
118
|
|
|
119
119
|
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
120
|
-
rounded: typeof [ null, 'small', 'medium', 'large', '
|
|
120
|
+
rounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
121
121
|
|
|
122
122
|
fillMode: typeof [ null, 'solid', 'flat', 'outline' ],
|
|
123
123
|
|
package/src/textbox/textbox.jsx
CHANGED
|
@@ -140,7 +140,7 @@ TextboxStatic.propTypes = {
|
|
|
140
140
|
suffix: typeof '#fragment',
|
|
141
141
|
|
|
142
142
|
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
143
|
-
rounded: typeof [ null, 'small', 'medium', 'large', '
|
|
143
|
+
rounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
144
144
|
|
|
145
145
|
fillMode: typeof [ null, 'solid', 'flat', 'outline' ],
|
|
146
146
|
|
|
@@ -76,17 +76,15 @@ function TimePickerStatic(props) {
|
|
|
76
76
|
'k-widget',
|
|
77
77
|
'k-timepicker',
|
|
78
78
|
{
|
|
79
|
+
'k-state-hover': hover === true,
|
|
80
|
+
'k-state-focus': focus === true,
|
|
81
|
+
'k-state-invalid': invalid === true,
|
|
79
82
|
'k-state-disabled': disabled === true
|
|
80
83
|
}
|
|
81
84
|
];
|
|
82
85
|
|
|
83
86
|
let legacyWrapClasses = [
|
|
84
|
-
'k-picker-wrap'
|
|
85
|
-
{
|
|
86
|
-
'k-state-hover': hover === true,
|
|
87
|
-
'k-state-focused': focus === true,
|
|
88
|
-
'k-state-invalid': invalid === true
|
|
89
|
-
}
|
|
87
|
+
'k-picker-wrap'
|
|
90
88
|
];
|
|
91
89
|
|
|
92
90
|
return (
|
|
@@ -150,7 +148,7 @@ TimePickerStatic.propTypes = {
|
|
|
150
148
|
suffix: typeof '#fragment',
|
|
151
149
|
|
|
152
150
|
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
153
|
-
rounded: typeof [ null, 'small', 'medium', 'large', '
|
|
151
|
+
rounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
154
152
|
|
|
155
153
|
fillMode: typeof [ null, 'solid', 'flat', 'outline' ],
|
|
156
154
|
|
|
File without changes
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Component, globalDefaultProps } from '../component/index';
|
|
2
|
+
|
|
3
|
+
class TreeviewGroup extends Component {
|
|
4
|
+
render() {
|
|
5
|
+
return <TreeviewGroupStatic {...this.props} />;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function TreeviewGroupStatic(props) {
|
|
10
|
+
const {
|
|
11
|
+
className: ownClassName,
|
|
12
|
+
|
|
13
|
+
items,
|
|
14
|
+
|
|
15
|
+
aria,
|
|
16
|
+
legacy,
|
|
17
|
+
|
|
18
|
+
...htmlAttributes
|
|
19
|
+
} = props;
|
|
20
|
+
|
|
21
|
+
let treeviewULClasses = [
|
|
22
|
+
ownClassName,
|
|
23
|
+
'k-treeview-group'
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
let ariaAttr = aria
|
|
27
|
+
? {}
|
|
28
|
+
: {};
|
|
29
|
+
|
|
30
|
+
if (legacy) {
|
|
31
|
+
|
|
32
|
+
let legacyTreeviewULClasses = [
|
|
33
|
+
ownClassName,
|
|
34
|
+
'k-group',
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<ul className={legacyTreeviewULClasses} {...ariaAttr} {...htmlAttributes}>
|
|
39
|
+
{items}
|
|
40
|
+
</ul>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<ul className={treeviewULClasses} {...ariaAttr} {...htmlAttributes}>
|
|
46
|
+
{items}
|
|
47
|
+
</ul>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
TreeviewGroupStatic.defaultProps = {
|
|
52
|
+
...globalDefaultProps,
|
|
53
|
+
|
|
54
|
+
children: [],
|
|
55
|
+
items: []
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
TreeviewGroupStatic.propTypes = {
|
|
59
|
+
children: typeof [],
|
|
60
|
+
className: typeof '',
|
|
61
|
+
|
|
62
|
+
items: typeof [],
|
|
63
|
+
|
|
64
|
+
aria: typeof false,
|
|
65
|
+
legacy: typeof false,
|
|
66
|
+
|
|
67
|
+
htmlAttributes: typeof []
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export { TreeviewGroup, TreeviewGroupStatic };
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Component, globalDefaultProps } from '../component/index';
|
|
2
|
+
import { TreeviewGroupStatic } from './treeview-group.jsx';
|
|
3
|
+
import { TreeviewLeafStatic } from './treeview-leaf.jsx';
|
|
4
|
+
import { IconStatic } from '../icon/index';
|
|
5
|
+
import { CheckboxStatic } from '../checkbox/index';
|
|
6
|
+
|
|
7
|
+
class TreeviewItem extends Component {
|
|
8
|
+
render() {
|
|
9
|
+
return <TreeviewItemStatic {...this.props} />;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function TreeviewItemStatic(props) {
|
|
14
|
+
const {
|
|
15
|
+
className: ownClassName,
|
|
16
|
+
leafClassName,
|
|
17
|
+
|
|
18
|
+
items,
|
|
19
|
+
expanded,
|
|
20
|
+
hasChildren: _hasChildren,
|
|
21
|
+
|
|
22
|
+
text,
|
|
23
|
+
|
|
24
|
+
showIcon,
|
|
25
|
+
iconName,
|
|
26
|
+
showCheckbox,
|
|
27
|
+
checked,
|
|
28
|
+
|
|
29
|
+
hover,
|
|
30
|
+
focus,
|
|
31
|
+
selected,
|
|
32
|
+
disabled,
|
|
33
|
+
|
|
34
|
+
aria,
|
|
35
|
+
legacy,
|
|
36
|
+
|
|
37
|
+
...htmlAttributes
|
|
38
|
+
} = props;
|
|
39
|
+
|
|
40
|
+
const leafProps = {
|
|
41
|
+
className: leafClassName,
|
|
42
|
+
text,
|
|
43
|
+
showIcon,
|
|
44
|
+
iconName,
|
|
45
|
+
hover,
|
|
46
|
+
focus,
|
|
47
|
+
selected
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const hasChildren = _hasChildren || items.length > 0;
|
|
51
|
+
|
|
52
|
+
let treeviewItemClasses = [
|
|
53
|
+
ownClassName,
|
|
54
|
+
'k-treeview-item',
|
|
55
|
+
{
|
|
56
|
+
'k-disabled': disabled === true
|
|
57
|
+
}
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
let ariaAttr = aria
|
|
61
|
+
? {}
|
|
62
|
+
: {};
|
|
63
|
+
|
|
64
|
+
if (legacy) {
|
|
65
|
+
|
|
66
|
+
let legacyTreeviewItemClasses = [
|
|
67
|
+
ownClassName,
|
|
68
|
+
'k-item',
|
|
69
|
+
{
|
|
70
|
+
'k-state-disabled': disabled === true
|
|
71
|
+
}
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<li className={legacyTreeviewItemClasses} {...ariaAttr} {...htmlAttributes}>
|
|
76
|
+
<span className="k-mid">
|
|
77
|
+
{hasChildren && <span className="k-treeview-toggle"><IconStatic name={expanded ? 'collapse' : 'expand'} /></span>}
|
|
78
|
+
{showCheckbox && <CheckboxStatic checked={checked} />}
|
|
79
|
+
<TreeviewLeafStatic {...leafProps} />
|
|
80
|
+
</span>
|
|
81
|
+
{expanded && hasChildren && <TreeviewGroupStatic items={items} />}
|
|
82
|
+
</li>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<li className={treeviewItemClasses} {...ariaAttr} {...htmlAttributes}>
|
|
88
|
+
<span className="k-treeview-mid">
|
|
89
|
+
{hasChildren && <span className="k-treeview-toggle"><IconStatic name={expanded ? 'collapse' : 'expand'} /></span>}
|
|
90
|
+
{showCheckbox && <CheckboxStatic checked={checked} />}
|
|
91
|
+
<TreeviewLeafStatic {...leafProps} />
|
|
92
|
+
</span>
|
|
93
|
+
{expanded && hasChildren && <TreeviewGroupStatic items={items} />}
|
|
94
|
+
</li>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
TreeviewItemStatic.defaultProps = {
|
|
99
|
+
...globalDefaultProps,
|
|
100
|
+
|
|
101
|
+
leafClassName: '',
|
|
102
|
+
|
|
103
|
+
text: '',
|
|
104
|
+
|
|
105
|
+
items: [],
|
|
106
|
+
expanded: false,
|
|
107
|
+
hasChildren: false,
|
|
108
|
+
|
|
109
|
+
showIcon: false,
|
|
110
|
+
iconName: '',
|
|
111
|
+
showCheckbox: false,
|
|
112
|
+
checked: false,
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
TreeviewItemStatic.propTypes = {
|
|
116
|
+
children: typeof [],
|
|
117
|
+
className: typeof '',
|
|
118
|
+
leafClassName: typeof '',
|
|
119
|
+
|
|
120
|
+
text: typeof '',
|
|
121
|
+
|
|
122
|
+
items: [],
|
|
123
|
+
expanded: typeof false,
|
|
124
|
+
hasChildren: typeof false,
|
|
125
|
+
|
|
126
|
+
showIcon: typeof false,
|
|
127
|
+
iconName: typeof '',
|
|
128
|
+
showCheckbox: typeof false,
|
|
129
|
+
checked: typeof false,
|
|
130
|
+
|
|
131
|
+
hover: typeof false,
|
|
132
|
+
focus: typeof false,
|
|
133
|
+
selected: typeof false,
|
|
134
|
+
disabled: typeof false,
|
|
135
|
+
|
|
136
|
+
aria: typeof false,
|
|
137
|
+
legacy: typeof false,
|
|
138
|
+
|
|
139
|
+
htmlAttributes: typeof []
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export { TreeviewItem, TreeviewItemStatic };
|