@progress/kendo-themes-html 4.43.1-dev.3 → 4.43.1-dev.7
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 +17 -1
- package/package.json +7 -7
- package/src/autocomplete/autocomplete.jsx +1 -1
- package/src/avatar/README.md +1 -1
- package/src/avatar/avatar.jsx +1 -4
- package/src/button/button.jsx +38 -20
- package/src/checkbox/checkbox.jsx +2 -2
- package/src/chip/chip-avatar.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 +5 -2
- package/src/input/input-inner-span.jsx +1 -1
- package/src/list/README.md +14 -0
- package/src/maskedtextbox/maskedtextbox.jsx +7 -10
- 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/menubutton/README.md +60 -0
- package/src/menubutton/index.js +1 -0
- package/src/menubutton/menubutton.jsx +161 -0
- package/src/numerictextbox/numerictextbox.jsx +4 -6
- package/src/radio/radio.jsx +6 -2
- package/src/splitbutton/README.md +76 -0
- package/src/splitbutton/index.js +1 -0
- package/src/splitbutton/splitbutton.jsx +176 -0
- package/src/switch/README.md +3 -3
- 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,176 @@
|
|
|
1
|
+
import * as styles from '../../utils/styles';
|
|
2
|
+
import { Component, globalDefaultProps } from '../component/index';
|
|
3
|
+
import { ButtonStatic } from '../button/index';
|
|
4
|
+
|
|
5
|
+
class SplitButton extends Component {
|
|
6
|
+
|
|
7
|
+
init() {
|
|
8
|
+
this._props.text = this.element.innerHTML;
|
|
9
|
+
this._props.children = [];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
render() {
|
|
13
|
+
return <SplitButtonStatic {...this.props} />;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function SplitButtonStatic(props) {
|
|
18
|
+
const {
|
|
19
|
+
className: ownClassName,
|
|
20
|
+
|
|
21
|
+
text,
|
|
22
|
+
|
|
23
|
+
size,
|
|
24
|
+
rounded,
|
|
25
|
+
|
|
26
|
+
fillMode,
|
|
27
|
+
themeColor,
|
|
28
|
+
|
|
29
|
+
icon,
|
|
30
|
+
|
|
31
|
+
arrowIconName,
|
|
32
|
+
|
|
33
|
+
hover,
|
|
34
|
+
focus,
|
|
35
|
+
active,
|
|
36
|
+
selected,
|
|
37
|
+
disabled,
|
|
38
|
+
|
|
39
|
+
aria,
|
|
40
|
+
legacy,
|
|
41
|
+
|
|
42
|
+
...htmlAttributes
|
|
43
|
+
} = props;
|
|
44
|
+
|
|
45
|
+
let splitButtonClasses = [
|
|
46
|
+
ownClassName,
|
|
47
|
+
'k-split-button',
|
|
48
|
+
'k-button-group',
|
|
49
|
+
styles.roundedClass( rounded )
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
// Augment attributes
|
|
53
|
+
htmlAttributes.disabled = disabled;
|
|
54
|
+
|
|
55
|
+
let ariaAttr = aria
|
|
56
|
+
? {}
|
|
57
|
+
: {};
|
|
58
|
+
|
|
59
|
+
if (legacy) {
|
|
60
|
+
|
|
61
|
+
let legacySplitButtonClasses = [
|
|
62
|
+
ownClassName,
|
|
63
|
+
'k-split-button',
|
|
64
|
+
'k-button-group'
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<div className={legacySplitButtonClasses} {...ariaAttr} {...htmlAttributes}>
|
|
69
|
+
<ButtonStatic
|
|
70
|
+
text={text}
|
|
71
|
+
icon={icon}
|
|
72
|
+
|
|
73
|
+
size={size}
|
|
74
|
+
rounded={rounded}
|
|
75
|
+
fillMode={fillMode}
|
|
76
|
+
themeColor={themeColor}
|
|
77
|
+
|
|
78
|
+
hover={hover}
|
|
79
|
+
focus={focus}
|
|
80
|
+
active={active}
|
|
81
|
+
selected={selected}
|
|
82
|
+
disabled={disabled}
|
|
83
|
+
></ButtonStatic>
|
|
84
|
+
<ButtonStatic
|
|
85
|
+
className="k-split-button-arrow"
|
|
86
|
+
|
|
87
|
+
icon={arrowIconName}
|
|
88
|
+
|
|
89
|
+
size={size}
|
|
90
|
+
rounded={rounded}
|
|
91
|
+
fillMode={fillMode}
|
|
92
|
+
themeColor={themeColor}
|
|
93
|
+
|
|
94
|
+
disabled={disabled}
|
|
95
|
+
></ButtonStatic>
|
|
96
|
+
</div>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<div className={splitButtonClasses} {...ariaAttr} {...htmlAttributes}>
|
|
102
|
+
<ButtonStatic
|
|
103
|
+
text={text}
|
|
104
|
+
icon={icon}
|
|
105
|
+
|
|
106
|
+
size={size}
|
|
107
|
+
rounded={rounded}
|
|
108
|
+
fillMode={fillMode}
|
|
109
|
+
themeColor={themeColor}
|
|
110
|
+
|
|
111
|
+
hover={hover}
|
|
112
|
+
focus={focus}
|
|
113
|
+
active={active}
|
|
114
|
+
selected={selected}
|
|
115
|
+
disabled={disabled}
|
|
116
|
+
></ButtonStatic>
|
|
117
|
+
<ButtonStatic
|
|
118
|
+
className="k-split-button-arrow"
|
|
119
|
+
|
|
120
|
+
icon={arrowIconName}
|
|
121
|
+
|
|
122
|
+
size={size}
|
|
123
|
+
rounded={rounded}
|
|
124
|
+
fillMode={fillMode}
|
|
125
|
+
themeColor={themeColor}
|
|
126
|
+
|
|
127
|
+
disabled={disabled}
|
|
128
|
+
></ButtonStatic>
|
|
129
|
+
</div>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
SplitButtonStatic.defaultProps = {
|
|
134
|
+
...globalDefaultProps,
|
|
135
|
+
|
|
136
|
+
text: '',
|
|
137
|
+
icon: '',
|
|
138
|
+
|
|
139
|
+
arrowIconName: 'arrow-s',
|
|
140
|
+
|
|
141
|
+
className: '',
|
|
142
|
+
type: 'button',
|
|
143
|
+
|
|
144
|
+
size: 'medium',
|
|
145
|
+
rounded: 'medium',
|
|
146
|
+
|
|
147
|
+
fillMode: 'solid',
|
|
148
|
+
themeColor: 'base'
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
SplitButtonStatic.propTypes = {
|
|
152
|
+
text: typeof '',
|
|
153
|
+
icon: typeof '',
|
|
154
|
+
|
|
155
|
+
arrowIconName: typeof '',
|
|
156
|
+
|
|
157
|
+
size: typeof [ null, 'small', 'medium', 'large' ],
|
|
158
|
+
rounded: typeof [ null, 'small', 'medium', 'large', 'full' ],
|
|
159
|
+
|
|
160
|
+
fillMode: typeof [ null, 'solid', 'flat', 'outline', 'link' ],
|
|
161
|
+
themeColor: typeof [ null, 'surface', 'base', 'primary' ],
|
|
162
|
+
|
|
163
|
+
hover: typeof false,
|
|
164
|
+
focus: typeof false,
|
|
165
|
+
active: typeof false,
|
|
166
|
+
selected: typeof false,
|
|
167
|
+
disabled: typeof false,
|
|
168
|
+
|
|
169
|
+
aria: typeof false,
|
|
170
|
+
legacy: typeof false,
|
|
171
|
+
|
|
172
|
+
className: typeof '',
|
|
173
|
+
htmlAttributes: typeof []
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export { SplitButton, SplitButtonStatic };
|
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
|
|
|
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 };
|
|
@@ -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,
|