@progress/kendo-themes-html 5.0.0-beta.2 → 5.0.0-beta.3
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 +14 -2
- package/package.json +7 -7
- package/src/button/button.jsx +1 -1
- package/src/colorpicker/color-preview.jsx +27 -20
- package/src/combobox/combobox.jsx +4 -6
- package/src/dropdownlist/dropdownlist.jsx +4 -6
- 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 +3 -4
- package/src/list/README.md +14 -0
- package/src/list/list-item.jsx +2 -2
- package/src/maskedtextbox/maskedtextbox.jsx +7 -10
- package/src/menu/README.md +40 -0
- package/src/{menuitem → menu}/index.js +1 -0
- package/src/{menuitem → menu}/menu-item-content.jsx +0 -0
- package/src/{menuitem → menu}/menu-item.jsx +26 -21
- package/src/menu/menu-list.jsx +74 -0
- package/src/menulist/menulist.jsx +3 -9
- 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
- package/src/menuitem/README.md +0 -26
- package/src/menulist/README.md +0 -11
- package/src/menulist/index.js +0 -1
package/lib/jsx-runtime.js
CHANGED
|
@@ -42,8 +42,14 @@ const attrMap = {
|
|
|
42
42
|
// Chip
|
|
43
43
|
showavatar: 'showAvatar',
|
|
44
44
|
|
|
45
|
-
//
|
|
46
|
-
|
|
45
|
+
// Hierarchy
|
|
46
|
+
haschildren: 'hasChildren',
|
|
47
|
+
|
|
48
|
+
// Treeview
|
|
49
|
+
leafclassname: 'leafClassName',
|
|
50
|
+
|
|
51
|
+
// Template
|
|
52
|
+
contenttemplate: 'contentTemplate'
|
|
47
53
|
};
|
|
48
54
|
|
|
49
55
|
const booleanAttr = new Set([
|
|
@@ -77,6 +83,12 @@ const booleanAttr = new Set([
|
|
|
77
83
|
'virtualization',
|
|
78
84
|
'root',
|
|
79
85
|
|
|
86
|
+
'open',
|
|
87
|
+
'expanded',
|
|
88
|
+
'hasChildren',
|
|
89
|
+
|
|
90
|
+
'showArrow',
|
|
91
|
+
|
|
80
92
|
'showAvatar',
|
|
81
93
|
|
|
82
94
|
'aria'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-themes-html",
|
|
3
3
|
"description": "A collection of HTML helpers used for developing Kendo UI themes",
|
|
4
|
-
"version": "5.0.0-beta.
|
|
4
|
+
"version": "5.0.0-beta.3",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"keywords": [
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"dev": "rollup -cw"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@babel/core": "^7.16.
|
|
38
|
-
"@babel/preset-env": "^7.16.
|
|
39
|
-
"@babel/preset-react": "^7.16.
|
|
37
|
+
"@babel/core": "^7.16.7",
|
|
38
|
+
"@babel/preset-env": "^7.16.7",
|
|
39
|
+
"@babel/preset-react": "^7.16.7",
|
|
40
40
|
"@rollup/plugin-babel": "^5.3.0",
|
|
41
41
|
"@rollup/plugin-commonjs": "^21.0.1",
|
|
42
|
-
"@rollup/plugin-node-resolve": "^13.
|
|
43
|
-
"rollup": "^2.
|
|
42
|
+
"@rollup/plugin-node-resolve": "^13.1.2",
|
|
43
|
+
"rollup": "^2.62.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "a508e10c60c1c14b569a908ef7f8584cf449a421"
|
|
46
46
|
}
|
package/src/button/button.jsx
CHANGED
|
@@ -87,7 +87,7 @@ function ButtonStatic(props) {
|
|
|
87
87
|
if (legacy) {
|
|
88
88
|
return (
|
|
89
89
|
<button type={type} className={legacyClasses} {...ariaAttr} {...htmlAttributes}>
|
|
90
|
-
<IconStatic name={icon} />
|
|
90
|
+
<IconStatic className="k-button-icon" name={icon} />
|
|
91
91
|
{ text }
|
|
92
92
|
</button>
|
|
93
93
|
);
|
|
@@ -39,28 +39,35 @@ function ColorPreviewStatic(props) {
|
|
|
39
39
|
|
|
40
40
|
if (legacy) {
|
|
41
41
|
|
|
42
|
-
let legacyClasses = [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
let legacyStyles = {
|
|
51
|
-
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
if (iconName === '') {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
42
|
+
// let legacyClasses = [
|
|
43
|
+
// ownClassName,
|
|
44
|
+
// 'k-selected-color',
|
|
45
|
+
// {
|
|
46
|
+
// 'k-no-color': color === ''
|
|
47
|
+
// }
|
|
48
|
+
// ];
|
|
49
|
+
|
|
50
|
+
// let legacyStyles = {
|
|
51
|
+
// 'background-color': color
|
|
52
|
+
// };
|
|
53
|
+
|
|
54
|
+
// if (iconName === '') {
|
|
55
|
+
// return (
|
|
56
|
+
// <span className={legacyClasses} style={legacyStyles}></span>
|
|
57
|
+
// );
|
|
58
|
+
// }
|
|
59
|
+
|
|
60
|
+
// return (
|
|
61
|
+
// <IconStatic className="k-tool-icon" name={iconName}>
|
|
62
|
+
// <span className={legacyClasses} style={legacyStyles}></span>
|
|
63
|
+
// </IconStatic>
|
|
64
|
+
// );
|
|
59
65
|
|
|
60
66
|
return (
|
|
61
|
-
<
|
|
62
|
-
<
|
|
63
|
-
|
|
67
|
+
<span className={colorPreviewClasses} {...ariaAttr} {...htmlAttributes}>
|
|
68
|
+
{iconName && <IconStatic name={iconName} className="k-color-preview-icon" />}
|
|
69
|
+
<span className="k-color-preview-mask" style={styles}></span>
|
|
70
|
+
</span>
|
|
64
71
|
);
|
|
65
72
|
|
|
66
73
|
}
|
|
@@ -76,17 +76,15 @@ function ComboboxStatic(props) {
|
|
|
76
76
|
'k-widget',
|
|
77
77
|
'k-combobox',
|
|
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-dropdown-wrap'
|
|
85
|
-
{
|
|
86
|
-
'k-state-hover': hover === true,
|
|
87
|
-
'k-state-focused': focus === true,
|
|
88
|
-
'k-state-invalid': invalid === true
|
|
89
|
-
}
|
|
87
|
+
'k-dropdown-wrap'
|
|
90
88
|
];
|
|
91
89
|
|
|
92
90
|
return (
|
|
@@ -88,17 +88,15 @@ function DropdownListStatic(props) {
|
|
|
88
88
|
'k-widget',
|
|
89
89
|
'k-dropdown',
|
|
90
90
|
{
|
|
91
|
+
'k-state-hover': hover === true,
|
|
92
|
+
'k-state-focus': focus === true,
|
|
93
|
+
'k-state-invalid': invalid === true,
|
|
91
94
|
'k-state-disabled': disabled === true
|
|
92
95
|
}
|
|
93
96
|
];
|
|
94
97
|
|
|
95
98
|
let legacyWrapClasses = [
|
|
96
|
-
'k-dropdown-wrap'
|
|
97
|
-
{
|
|
98
|
-
'k-state-hover': hover === true,
|
|
99
|
-
'k-state-focused': focus === true,
|
|
100
|
-
'k-state-invalid': invalid === true
|
|
101
|
-
}
|
|
99
|
+
'k-dropdown-wrap'
|
|
102
100
|
];
|
|
103
101
|
|
|
104
102
|
return (
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
```html
|
|
2
|
+
<!-- default rendering -->
|
|
3
|
+
<button type="button" class="k-fab k-fab-rectangle k-fab-md k-rounded-full k-fab-solid k-fab-solid-primary">
|
|
4
|
+
<span class="k-fab-icon k-icon k-i-plus"></span>
|
|
5
|
+
<span class="k-fab-text">Create</span>
|
|
6
|
+
</button>
|
|
7
|
+
|
|
8
|
+
<!-- canonical rendering -->
|
|
9
|
+
<button class="
|
|
10
|
+
k-fab
|
|
11
|
+
k-fab-{size}
|
|
12
|
+
k-fab-{rounded}
|
|
13
|
+
k-fab-{fillMode}
|
|
14
|
+
k-fab-{fillMode}-{themeColor}
|
|
15
|
+
">
|
|
16
|
+
{icon !== '' && <span class="k-fab-icon k-icon k-i-{icon}"></span>}
|
|
17
|
+
{text !== '' && <span class="k-fab-text">{text}</span>}
|
|
18
|
+
</button>
|
|
19
|
+
```
|
package/src/fab/fab.jsx
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import * as styles from '../../utils/styles';
|
|
2
|
+
import { Component, globalDefaultProps } from '../component/index';
|
|
3
|
+
import { IconStatic } from '../icon/index';
|
|
4
|
+
|
|
5
|
+
class Fab extends Component {
|
|
6
|
+
|
|
7
|
+
init() {
|
|
8
|
+
this._props.text = this.element.innerHTML;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
render() {
|
|
12
|
+
return <FabStatic {...this.props} />;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function FabStatic(props) {
|
|
17
|
+
const {
|
|
18
|
+
className: ownClassName,
|
|
19
|
+
|
|
20
|
+
text,
|
|
21
|
+
type,
|
|
22
|
+
|
|
23
|
+
size,
|
|
24
|
+
rounded,
|
|
25
|
+
shape,
|
|
26
|
+
|
|
27
|
+
fillMode,
|
|
28
|
+
themeColor,
|
|
29
|
+
|
|
30
|
+
icon,
|
|
31
|
+
|
|
32
|
+
position,
|
|
33
|
+
|
|
34
|
+
hover,
|
|
35
|
+
focus,
|
|
36
|
+
active,
|
|
37
|
+
selected,
|
|
38
|
+
disabled,
|
|
39
|
+
|
|
40
|
+
aria,
|
|
41
|
+
legacy,
|
|
42
|
+
|
|
43
|
+
...htmlAttributes
|
|
44
|
+
} = props;
|
|
45
|
+
|
|
46
|
+
let buttonClasses = [
|
|
47
|
+
ownClassName,
|
|
48
|
+
'k-fab',
|
|
49
|
+
styles.positionClass( position, 'k'),
|
|
50
|
+
styles.shapeClass( shape, 'k-fab' ),
|
|
51
|
+
styles.sizeClass( size, 'k-fab' ),
|
|
52
|
+
styles.roundedClass( rounded ),
|
|
53
|
+
styles.fillModeClass( fillMode, 'k-fab' ),
|
|
54
|
+
styles.themeColorClass( fillMode, themeColor, 'k-fab' ),
|
|
55
|
+
{
|
|
56
|
+
'k-hover': hover === true,
|
|
57
|
+
'k-focus': focus === true,
|
|
58
|
+
'k-active': active === true,
|
|
59
|
+
'k-selected': selected === true,
|
|
60
|
+
'k-disabled': disabled === true
|
|
61
|
+
}
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
// Augment attributes
|
|
65
|
+
htmlAttributes.disabled = disabled;
|
|
66
|
+
|
|
67
|
+
let ariaAttr = aria
|
|
68
|
+
? {}
|
|
69
|
+
: {};
|
|
70
|
+
|
|
71
|
+
if (legacy) {
|
|
72
|
+
let legacyClasses = [
|
|
73
|
+
ownClassName,
|
|
74
|
+
'k-fab',
|
|
75
|
+
`k-fab-${themeColor}`,
|
|
76
|
+
{
|
|
77
|
+
'k-fab-rectangle': rounded === null,
|
|
78
|
+
'k-fab-rounded': rounded !== 'full' && rounded !== null,
|
|
79
|
+
'k-fab-pill': rounded === 'full'
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
'k-state-hover': hover === true,
|
|
83
|
+
'k-state-focus': focus === true,
|
|
84
|
+
'k-state-active': active === true,
|
|
85
|
+
'k-state-selected': selected === true,
|
|
86
|
+
'k-state-disabled': disabled === true
|
|
87
|
+
},
|
|
88
|
+
styles.positionClass( position, 'k'),
|
|
89
|
+
styles.sizeClass( size, 'k-fab' )
|
|
90
|
+
];
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<button type={type} className={legacyClasses} {...ariaAttr} {...htmlAttributes}>
|
|
94
|
+
<IconStatic className="k-fab-icon" name={icon} />
|
|
95
|
+
{text && <span className="k-fab-text">{text}</span>}
|
|
96
|
+
</button>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<button type={type} className={buttonClasses} {...ariaAttr} {...htmlAttributes}>
|
|
102
|
+
<IconStatic className="k-fab-icon" name={icon} />
|
|
103
|
+
{text && <span className="k-fab-text">{text}</span>}
|
|
104
|
+
</button>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
FabStatic.defaultProps = {
|
|
109
|
+
...globalDefaultProps,
|
|
110
|
+
|
|
111
|
+
text: '',
|
|
112
|
+
icon: '',
|
|
113
|
+
|
|
114
|
+
className: '',
|
|
115
|
+
type: 'button',
|
|
116
|
+
|
|
117
|
+
size: 'medium',
|
|
118
|
+
rounded: 'full',
|
|
119
|
+
shape: 'rectangle',
|
|
120
|
+
|
|
121
|
+
position: null,
|
|
122
|
+
|
|
123
|
+
fillMode: 'solid',
|
|
124
|
+
themeColor: 'primary'
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
FabStatic.propTypes = {
|
|
128
|
+
text: typeof '',
|
|
129
|
+
icon: typeof '',
|
|
130
|
+
|
|
131
|
+
type: typeof [ 'button', 'submit', 'reset' ],
|
|
132
|
+
|
|
133
|
+
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
134
|
+
rounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
135
|
+
shape: typeof [ null, 'rectangle', 'square' ],
|
|
136
|
+
fillMode: typeof [ null, 'solid' ],
|
|
137
|
+
themeColor: typeof [ null, 'primary', 'secondary', 'tertiary', 'info', 'success', 'warning', 'error', 'dark', 'light', 'inverse' ],
|
|
138
|
+
|
|
139
|
+
position: typeof [ null, 'top-start', 'top-center', 'top-end', 'middle-start', 'middle-end', 'bottom-start', 'bottom-center', 'bottom-end' ],
|
|
140
|
+
|
|
141
|
+
hover: typeof false,
|
|
142
|
+
focus: typeof false,
|
|
143
|
+
active: typeof false,
|
|
144
|
+
selected: typeof false,
|
|
145
|
+
disabled: typeof false,
|
|
146
|
+
|
|
147
|
+
aria: typeof false,
|
|
148
|
+
legacy: typeof false,
|
|
149
|
+
|
|
150
|
+
className: typeof '',
|
|
151
|
+
htmlAttributes: typeof []
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export { Fab, FabStatic };
|
package/src/fab/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './fab.jsx';
|
package/src/index.js
CHANGED
|
@@ -71,10 +71,8 @@ export * from './switch/index';
|
|
|
71
71
|
|
|
72
72
|
// Command interfaces
|
|
73
73
|
// export * from './action-buttons/index';
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
export * from './menulist/index';
|
|
77
|
-
export * from './menuitem/index';
|
|
74
|
+
export * from './fab/index';
|
|
75
|
+
export * from './menu/index';
|
|
78
76
|
// export * from './toolbar/index';
|
|
79
77
|
|
|
80
78
|
// Popups and modals
|
|
@@ -93,6 +91,7 @@ export * from './menuitem/index';
|
|
|
93
91
|
// export * from './pager/index';
|
|
94
92
|
// export * from './stepper/index';
|
|
95
93
|
// export * from './tabstrip/index';
|
|
94
|
+
export * from './treeview/index';
|
|
96
95
|
// export * from './wizard/index';
|
|
97
96
|
|
|
98
97
|
// Layout & containers
|
package/src/list/README.md
CHANGED
|
@@ -90,4 +90,18 @@
|
|
|
90
90
|
</ul>
|
|
91
91
|
</div>
|
|
92
92
|
</div>
|
|
93
|
+
|
|
94
|
+
<!-- filter -->
|
|
95
|
+
<div class="k-list-filter">
|
|
96
|
+
<span class="k-searchbox k-input k-input-md k-rounded-md k-input-solid" type="text" autocomplete="off">
|
|
97
|
+
<span class="k-input-icon k-icon k-i-search"></span>
|
|
98
|
+
<input type="text" class="k-input-inner" placeholder="Filter..." autocomplete="off">
|
|
99
|
+
</span>
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
<!-- no data template -->
|
|
103
|
+
<div class="k-list k-list-md">
|
|
104
|
+
<div class="k-no-data">No data found.</div>
|
|
105
|
+
</div>
|
|
93
106
|
```
|
|
107
|
+
|
package/src/list/list-item.jsx
CHANGED
|
@@ -61,7 +61,7 @@ function ListItemStatic(props) {
|
|
|
61
61
|
if (legacy) {
|
|
62
62
|
return (
|
|
63
63
|
<li className={legacyListItemClasses} {...ariaAttr} {...htmlAttributes}>
|
|
64
|
-
{showCheckbox && <CheckboxStatic checked={checked}
|
|
64
|
+
{showCheckbox && <span className="k-checkbox-wrap"><CheckboxStatic checked={checked} /></span>}
|
|
65
65
|
{showIcon && <IconStatic name={iconName} />}
|
|
66
66
|
<span className="k-list-item-text">{children}</span>
|
|
67
67
|
{groupLabel !== '' && <div className="k-group">{groupLabel}</div>}
|
|
@@ -71,7 +71,7 @@ function ListItemStatic(props) {
|
|
|
71
71
|
|
|
72
72
|
return (
|
|
73
73
|
<li className={listItemClasses} {...ariaAttr} {...htmlAttributes}>
|
|
74
|
-
{showCheckbox && <CheckboxStatic checked={checked}
|
|
74
|
+
{showCheckbox && <span className="k-checkbox-wrap"><CheckboxStatic checked={checked} /></span>}
|
|
75
75
|
{showIcon && <IconStatic name={iconName} />}
|
|
76
76
|
<span className="k-list-item-text">{children}</span>
|
|
77
77
|
{groupLabel !== '' && <div className="k-list-item-group-label">{groupLabel}</div>}
|
|
@@ -71,23 +71,20 @@ function MaskedTextboxStatic(props) {
|
|
|
71
71
|
ownClassName,
|
|
72
72
|
'k-widget',
|
|
73
73
|
'k-maskedtextbox',
|
|
74
|
-
{
|
|
75
|
-
'k-state-disabled': disabled === true
|
|
76
|
-
}
|
|
77
|
-
];
|
|
78
|
-
|
|
79
|
-
let legacyInputClasses = [
|
|
80
|
-
'k-textbox',
|
|
81
74
|
{
|
|
82
75
|
'k-state-hover': hover === true,
|
|
83
|
-
'k-state-
|
|
84
|
-
'k-state-invalid': invalid === true
|
|
76
|
+
'k-state-focus': focus === true,
|
|
77
|
+
'k-state-invalid': invalid === true,
|
|
78
|
+
'k-state-disabled': disabled === true
|
|
85
79
|
}
|
|
86
80
|
];
|
|
87
81
|
|
|
88
82
|
return (
|
|
89
83
|
<InputStatic className={legacyClasses} {...htmlAttributes}>
|
|
90
|
-
<input type={type} className=
|
|
84
|
+
<input type={type} className="k-input" {...inputAttributes} />
|
|
85
|
+
<InputValidationIconStatic {...props} />
|
|
86
|
+
<InputLoadingIconStatic {...props} />
|
|
87
|
+
<InputClearValueStatic {...props} />
|
|
91
88
|
</InputStatic>
|
|
92
89
|
);
|
|
93
90
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
```html
|
|
2
|
+
<!-- default rendering -->
|
|
3
|
+
<ul class="k-group k-menu-group k-reset"></ul>
|
|
4
|
+
|
|
5
|
+
<!-- canonical rendering -->
|
|
6
|
+
<ul class="
|
|
7
|
+
k-group k-menu-group k-reset
|
|
8
|
+
k-menulist-{size}
|
|
9
|
+
"
|
|
10
|
+
></ul>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<!-- default rendering -->
|
|
15
|
+
<li class="k-item k-menu-item">
|
|
16
|
+
<span class="k-link k-menu-link">
|
|
17
|
+
{icon !== '' && <span class="k-icon k-i-{icon}"></span>}
|
|
18
|
+
{text !== '' && <span class="k-menu-link-text">Text</span>}
|
|
19
|
+
<span className="k-menu-expand-arrow k-icon k-i-{arrowIconName || 'none'}"></span>
|
|
20
|
+
</span>
|
|
21
|
+
</li>
|
|
22
|
+
|
|
23
|
+
<!-- canonical rendering -->
|
|
24
|
+
<li class="
|
|
25
|
+
k-item
|
|
26
|
+
k-menu-item
|
|
27
|
+
{hover && 'k-hover'}
|
|
28
|
+
{focus && 'k-focus'}
|
|
29
|
+
{active && 'k-active'}
|
|
30
|
+
{disabled && 'k-disabled'}
|
|
31
|
+
" disabled={disabled}>
|
|
32
|
+
<span class="k-link k-menu-link">
|
|
33
|
+
{icon !== '' && <span class="k-icon k-i-{icon}"></span>}
|
|
34
|
+
{text !== '' && <span class="k-menu-link-text">Text</span>}
|
|
35
|
+
{showArrow && <span className="k-menu-expand-arrow">
|
|
36
|
+
<span className="k-icon k-i-{arrowIconName || 'none'}"></span>
|
|
37
|
+
</span>}
|
|
38
|
+
</span>
|
|
39
|
+
</li>
|
|
40
|
+
```
|
|
File without changes
|
|
@@ -79,48 +79,52 @@ function MenuItemStatic(props) {
|
|
|
79
79
|
}
|
|
80
80
|
];
|
|
81
81
|
|
|
82
|
+
let expandArrowName = arrowIconName;
|
|
82
83
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
'k-state-focus': focus === true,
|
|
89
|
-
'k-state-selected': selected === true,
|
|
90
|
-
'k-state-disabled': disabled === true,
|
|
91
|
-
}
|
|
92
|
-
];
|
|
84
|
+
if ( expandArrowName === '' ) {
|
|
85
|
+
expandArrowName = dir === 'rtl'
|
|
86
|
+
? 'arrow-w'
|
|
87
|
+
: 'arrow-e';
|
|
88
|
+
}
|
|
93
89
|
|
|
94
90
|
// Augment attributes
|
|
95
91
|
htmlAttributes.disabled = disabled;
|
|
96
|
-
htmlAttributes.dir = dir;
|
|
97
92
|
|
|
98
93
|
let ariaAttr = aria
|
|
99
94
|
? {}
|
|
100
95
|
: {};
|
|
101
96
|
|
|
102
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
|
+
|
|
103
110
|
return (
|
|
104
111
|
<li className={legacyMenuItemClasses} {...ariaAttr} {...htmlAttributes}>
|
|
105
|
-
<span className={`k-link k-menu-link ${active === true
|
|
106
|
-
{icon && <IconStatic name={icon} />}
|
|
107
|
-
{text}
|
|
108
|
-
{showArrow && <
|
|
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>}
|
|
109
116
|
</span>
|
|
117
|
+
{contentTemplate}
|
|
110
118
|
</li>
|
|
111
119
|
);
|
|
112
120
|
}
|
|
113
121
|
|
|
114
|
-
const renderLTRArrowIconName = showArrow ? arrowIconName || 'arrow-60-right' : 'none';
|
|
115
|
-
|
|
116
|
-
const renderRTLArrowIconName = showArrow ? arrowIconName || 'arrow-60-left' : 'none';
|
|
117
|
-
|
|
118
122
|
return (
|
|
119
123
|
<li className={menuItemClasses} {...ariaAttr} {...htmlAttributes}>
|
|
120
124
|
<span className={menuItemLinkClasses}>
|
|
121
|
-
{icon && <IconStatic name={icon} />}
|
|
125
|
+
{icon && <IconStatic className="k-menu-link-icon" name={icon} />}
|
|
122
126
|
<span className="k-menu-link-text">{text}</span>
|
|
123
|
-
{<
|
|
127
|
+
{showArrow && <span className="k-menu-expand-arrow"><IconStatic name={expandArrowName} /></span>}
|
|
124
128
|
</span>
|
|
125
129
|
{contentTemplate}
|
|
126
130
|
</li>
|
|
@@ -134,6 +138,7 @@ MenuItemStatic.defaultProps = {
|
|
|
134
138
|
icon: '',
|
|
135
139
|
|
|
136
140
|
className: '',
|
|
141
|
+
arrowIconName: '',
|
|
137
142
|
|
|
138
143
|
size: 'medium',
|
|
139
144
|
|
|
@@ -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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as styles from '../../utils/styles';
|
|
2
|
-
import { Component, globalDefaultProps } from '../component
|
|
2
|
+
import { Component, globalDefaultProps } from '../component';
|
|
3
3
|
|
|
4
4
|
class MenuList extends Component {
|
|
5
5
|
render() {
|
|
@@ -37,16 +37,12 @@ function MenuListStatic(props) {
|
|
|
37
37
|
|
|
38
38
|
if (legacy) {
|
|
39
39
|
return (
|
|
40
|
-
<ul className={legacyMenuListClasses} {...ariaAttr} {...htmlAttributes}
|
|
41
|
-
{props.children}
|
|
42
|
-
</ul>
|
|
40
|
+
<ul className={legacyMenuListClasses} {...ariaAttr} {...htmlAttributes} />
|
|
43
41
|
);
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
return (
|
|
47
|
-
<ul className={menuListClasses} {...ariaAttr} {...htmlAttributes}
|
|
48
|
-
{props.children}
|
|
49
|
-
</ul>
|
|
45
|
+
<ul className={menuListClasses} {...ariaAttr} {...htmlAttributes} />
|
|
50
46
|
);
|
|
51
47
|
}
|
|
52
48
|
|
|
@@ -61,8 +57,6 @@ MenuListStatic.defaultProps = {
|
|
|
61
57
|
MenuListStatic.propTypes = {
|
|
62
58
|
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
63
59
|
|
|
64
|
-
children: typeof [],
|
|
65
|
-
|
|
66
60
|
aria: typeof false,
|
|
67
61
|
legacy: typeof false,
|
|
68
62
|
|
|
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 && <span className="k-checkbox-wrap"><CheckboxStatic checked={checked} /></span>}
|
|
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 && <span className="k-checkbox-wrap"><CheckboxStatic checked={checked} /></span>}
|
|
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 };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Component, globalDefaultProps } from '../component/index';
|
|
2
|
+
import { IconStatic } from '../icon/index';
|
|
3
|
+
|
|
4
|
+
class TreeviewLeaf extends Component {
|
|
5
|
+
render() {
|
|
6
|
+
return <TreeviewLeafStatic {...this.props} />;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function TreeviewLeafStatic(props) {
|
|
11
|
+
const {
|
|
12
|
+
className: ownClassName,
|
|
13
|
+
|
|
14
|
+
text,
|
|
15
|
+
|
|
16
|
+
showIcon,
|
|
17
|
+
iconName,
|
|
18
|
+
|
|
19
|
+
hover,
|
|
20
|
+
focus,
|
|
21
|
+
selected,
|
|
22
|
+
|
|
23
|
+
aria,
|
|
24
|
+
legacy,
|
|
25
|
+
|
|
26
|
+
...htmlAttributes
|
|
27
|
+
} = props;
|
|
28
|
+
|
|
29
|
+
let treeviewLeafClasses = [
|
|
30
|
+
ownClassName,
|
|
31
|
+
'k-treeview-leaf',
|
|
32
|
+
{
|
|
33
|
+
'k-hover': hover === true,
|
|
34
|
+
'k-focus': focus === true,
|
|
35
|
+
'k-selected': selected === true
|
|
36
|
+
}
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
let ariaAttr = aria
|
|
40
|
+
? {}
|
|
41
|
+
: {};
|
|
42
|
+
|
|
43
|
+
if (legacy) {
|
|
44
|
+
|
|
45
|
+
let legacyTreeviewLeafClasses = [
|
|
46
|
+
ownClassName,
|
|
47
|
+
'k-in',
|
|
48
|
+
{
|
|
49
|
+
'k-state-hover': hover === true,
|
|
50
|
+
'k-state-focus': focus === true,
|
|
51
|
+
'k-state-selected': selected === true
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<span className={legacyTreeviewLeafClasses} {...ariaAttr} {...htmlAttributes}>
|
|
57
|
+
{showIcon && <IconStatic name={iconName} />}
|
|
58
|
+
<span className="k-treeview-leaf-text">{text}</span>
|
|
59
|
+
</span>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<span className={treeviewLeafClasses} {...ariaAttr} {...htmlAttributes}>
|
|
65
|
+
{showIcon && <IconStatic name={iconName} />}
|
|
66
|
+
<span className="k-treeview-leaf-text">{text}</span>
|
|
67
|
+
</span>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
TreeviewLeafStatic.defaultProps = {
|
|
72
|
+
...globalDefaultProps,
|
|
73
|
+
|
|
74
|
+
text: '',
|
|
75
|
+
|
|
76
|
+
showIcon: false,
|
|
77
|
+
iconName: ''
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
TreeviewLeafStatic.propTypes = {
|
|
81
|
+
children: typeof [],
|
|
82
|
+
className: typeof '',
|
|
83
|
+
|
|
84
|
+
text: typeof '',
|
|
85
|
+
|
|
86
|
+
showIcon: typeof false,
|
|
87
|
+
iconName: typeof '',
|
|
88
|
+
|
|
89
|
+
hover: typeof false,
|
|
90
|
+
focus: typeof false,
|
|
91
|
+
selected: typeof false,
|
|
92
|
+
|
|
93
|
+
aria: typeof false,
|
|
94
|
+
legacy: typeof false,
|
|
95
|
+
|
|
96
|
+
htmlAttributes: typeof []
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export { TreeviewLeaf, TreeviewLeafStatic };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import * as styles from '../../utils/styles';
|
|
2
|
+
import { Component, globalDefaultProps } from '../component/index';
|
|
3
|
+
import { TreeviewGroupStatic } from './treeview-group.jsx';
|
|
4
|
+
import { TreeviewItemStatic } from './treeview-item.jsx';
|
|
5
|
+
|
|
6
|
+
class Treeview extends Component {
|
|
7
|
+
|
|
8
|
+
static transformUL( ul ) {
|
|
9
|
+
let children = ul.props.children;
|
|
10
|
+
let items = [];
|
|
11
|
+
|
|
12
|
+
children.filter( child => child.type === 'LI' ).forEach( li => {
|
|
13
|
+
items.push( Treeview.transformLI( li ) );
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
return items;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static transformLI( li ) {
|
|
20
|
+
let children = li.props.children;
|
|
21
|
+
let text = li.props.text || '';
|
|
22
|
+
let items = [];
|
|
23
|
+
|
|
24
|
+
children.forEach( child => {
|
|
25
|
+
if (text === '' && child.type === '#text') {
|
|
26
|
+
text = child.props.text;
|
|
27
|
+
}
|
|
28
|
+
if (child.type === 'UL') {
|
|
29
|
+
items.push( ...Treeview.transformUL( child ) );
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
li.props.children = [];
|
|
34
|
+
li.props.text = text;
|
|
35
|
+
li.props.items = items;
|
|
36
|
+
|
|
37
|
+
return <TreeviewItemStatic {...li.props} />;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
init() {
|
|
41
|
+
let children = this._props.children;
|
|
42
|
+
let items = [];
|
|
43
|
+
|
|
44
|
+
children.filter( child => child.type === 'LI' ).forEach( li => {
|
|
45
|
+
items.push( Treeview.transformLI( li ) );
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
this._props.children = [];
|
|
49
|
+
this._props.items = items;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
render() {
|
|
53
|
+
return <TreeviewStatic {...this.props} />;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function TreeviewStatic(props) {
|
|
58
|
+
const {
|
|
59
|
+
className: ownClassName,
|
|
60
|
+
|
|
61
|
+
items,
|
|
62
|
+
|
|
63
|
+
size,
|
|
64
|
+
|
|
65
|
+
aria,
|
|
66
|
+
legacy,
|
|
67
|
+
|
|
68
|
+
...htmlAttributes
|
|
69
|
+
} = props;
|
|
70
|
+
|
|
71
|
+
let treeviewClasses = [
|
|
72
|
+
ownClassName,
|
|
73
|
+
'k-treeview',
|
|
74
|
+
styles.sizeClass( size, 'k-treeview' )
|
|
75
|
+
];
|
|
76
|
+
|
|
77
|
+
let ariaAttr = aria
|
|
78
|
+
? {}
|
|
79
|
+
: {};
|
|
80
|
+
|
|
81
|
+
if (legacy) {
|
|
82
|
+
|
|
83
|
+
let legacyTreeviewClasses = [
|
|
84
|
+
ownClassName,
|
|
85
|
+
'k-treeview'
|
|
86
|
+
];
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<div className={legacyTreeviewClasses} {...ariaAttr} {...htmlAttributes}>
|
|
90
|
+
<TreeviewGroupStatic className="k-treeview-lines" items={items} />
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<div className={treeviewClasses} {...ariaAttr} {...htmlAttributes}>
|
|
97
|
+
<TreeviewGroupStatic className="k-treeview-lines" items={items} />
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
TreeviewStatic.defaultProps = {
|
|
103
|
+
...globalDefaultProps,
|
|
104
|
+
|
|
105
|
+
children: [],
|
|
106
|
+
items: [],
|
|
107
|
+
|
|
108
|
+
size: 'medium'
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
TreeviewStatic.propTypes = {
|
|
112
|
+
children: typeof [],
|
|
113
|
+
className: typeof '',
|
|
114
|
+
|
|
115
|
+
items: typeof [],
|
|
116
|
+
|
|
117
|
+
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
118
|
+
|
|
119
|
+
aria: typeof false,
|
|
120
|
+
legacy: typeof false,
|
|
121
|
+
|
|
122
|
+
htmlAttributes: typeof []
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export { Treeview, TreeviewStatic };
|
package/utils/styles.js
CHANGED
|
@@ -72,6 +72,14 @@ function borderedClass( bordered, prefix ) {
|
|
|
72
72
|
return `${prefix}-bordered`;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
function positionClass( position, prefix ) {
|
|
76
|
+
if ( position === null ) {
|
|
77
|
+
return '';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return `k-pos-absolute ${prefix}-${position}`;
|
|
81
|
+
}
|
|
82
|
+
|
|
75
83
|
function classNames( ...args ) {
|
|
76
84
|
|
|
77
85
|
/* eslint-disable arrow-body-style, no-nested-ternary */
|
|
@@ -131,6 +139,7 @@ export {
|
|
|
131
139
|
fillModeClass,
|
|
132
140
|
themeColorClass,
|
|
133
141
|
borderedClass,
|
|
142
|
+
positionClass,
|
|
134
143
|
|
|
135
144
|
classNames,
|
|
136
145
|
cssStyle,
|
package/src/menuitem/README.md
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
```html
|
|
2
|
-
<!-- default rendering -->
|
|
3
|
-
<li class="k-item k-menu-item">
|
|
4
|
-
<span class="k-link k-menu-link">
|
|
5
|
-
{icon !== '' && <span class="k-icon k-i-${icon}"></span>}
|
|
6
|
-
{text !== '' && <span class="k-menu-link-text">Text</span>}
|
|
7
|
-
<span className="k-menu-expand-arrow k-icon k-i-${arrowIconName || 'none'}"></span>
|
|
8
|
-
</span>
|
|
9
|
-
</li>
|
|
10
|
-
|
|
11
|
-
<!-- canonical rendering -->
|
|
12
|
-
<li class="
|
|
13
|
-
k-item
|
|
14
|
-
k-menu-item
|
|
15
|
-
${hover && 'k-hover'}
|
|
16
|
-
${focus && 'k-focus'}
|
|
17
|
-
${active && 'k-active'}
|
|
18
|
-
${disabled && 'k-disabled'}
|
|
19
|
-
" disabled={disabled}>
|
|
20
|
-
<span class="k-link k-menu-link">
|
|
21
|
-
{icon !== '' && <span class="k-icon k-i-${icon}"></span>}
|
|
22
|
-
{text !== '' && <span class="k-menu-link-text">Text</span>}
|
|
23
|
-
<span className="k-menu-expand-arrow k-icon k-i-${arrowIconName || 'none'}"></span>
|
|
24
|
-
</span>
|
|
25
|
-
</li>
|
|
26
|
-
```
|
package/src/menulist/README.md
DELETED
package/src/menulist/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './menulist.jsx';
|