File tree Expand file tree Collapse file tree 5 files changed +101
-10
lines changed
packages/html/src/column-menu Expand file tree Collapse file tree 5 files changed +101
-10
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,9 @@ const options = {};
10
10
11
11
export type KendoColumnMenuExpanderProps = {
12
12
itemText ?: string ;
13
- itemIcon ?: string ;
13
+ itemStartIcon ?: string ;
14
+ itemEndIcon ?: string ;
15
+ itemSortIndex ?: number ;
14
16
expanderIcon ?: string ;
15
17
itemContent ?: React . JSX . Element ;
16
18
expanded ?: boolean ;
@@ -24,7 +26,9 @@ export const ColumnMenuExpander = (
24
26
) => {
25
27
const {
26
28
itemText,
27
- itemIcon,
29
+ itemStartIcon,
30
+ itemEndIcon,
31
+ itemSortIndex,
28
32
expanded,
29
33
itemContent,
30
34
expanderIcon,
@@ -46,7 +50,7 @@ export const ColumnMenuExpander = (
46
50
props . className ,
47
51
COLUMNMENUEXPANDER_CLASSNAME
48
52
) } >
49
- < ColumnMenuItem text = { itemText } icon = { itemIcon } >
53
+ < ColumnMenuItem text = { itemText } startIcon = { itemStartIcon } endIcon = { itemEndIcon } sortIndex = { itemSortIndex } >
50
54
< span className = "k-spacer" > </ span >
51
55
< span className = "k-expander-indicator" >
52
56
{ icon }
Original file line number Diff line number Diff line change
1
+ import { Icon } from '../icon' ;
2
+ import { classNames } from '../misc' ;
3
+
4
+ export const COLUMNMENUITEM_ACTION_CLASSNAME = `k-columnmenu-item-action` ;
5
+
6
+ export enum columnMenuItemActionType {
7
+ REMOVE = 'remove' ,
8
+ ADD = 'add'
9
+ } ;
10
+
11
+ export type KendoColumnMenuItemActionProps = {
12
+ type ?: columnMenuItemActionType | string ;
13
+ } ;
14
+
15
+ export const ColumnMenuItemAction = (
16
+ props : KendoColumnMenuItemActionProps &
17
+ React . HTMLAttributes < HTMLSpanElement >
18
+ ) => {
19
+ const {
20
+ type,
21
+ ...other
22
+ } = props ;
23
+
24
+ let icon ;
25
+
26
+ switch ( type ) {
27
+ case columnMenuItemActionType . REMOVE :
28
+ icon = < Icon icon = "x-circle" size = "medium" /> ;
29
+ break ;
30
+ case columnMenuItemActionType . ADD :
31
+ icon = < Icon themeColor = "primary" icon = "plus-circle" size = "medium" /> ;
32
+ break ;
33
+ default :
34
+ return < Icon icon = { type } size = "medium" /> ;
35
+ }
36
+
37
+ return (
38
+ < span
39
+ { ...other }
40
+ className = { classNames (
41
+ props . className ,
42
+ COLUMNMENUITEM_ACTION_CLASSNAME ,
43
+ `k-columnmenu-item-${ type } -action`
44
+ ) }
45
+ >
46
+ { icon }
47
+ </ span >
48
+ ) ;
49
+ } ;
Original file line number Diff line number Diff line change @@ -12,7 +12,11 @@ const options = {};
12
12
13
13
export type KendoColumnMenuItemProps = {
14
14
text ?: string ;
15
- icon ?: string ;
15
+ startIcon ?: string ;
16
+ endIcon ?: string ;
17
+ sortIndex ?: number ;
18
+ actions ?: React . JSX . Element | string ;
19
+ draggable ?: boolean ;
16
20
} ;
17
21
18
22
const defaultOptions = { } ;
@@ -27,7 +31,11 @@ export const ColumnMenuItem = (
27
31
focus,
28
32
selected,
29
33
text,
30
- icon,
34
+ startIcon,
35
+ endIcon,
36
+ sortIndex,
37
+ actions,
38
+ draggable,
31
39
...other
32
40
} = props ;
33
41
@@ -42,8 +50,26 @@ export const ColumnMenuItem = (
42
50
selected,
43
51
} )
44
52
) } >
45
- < Icon icon = { icon } /> { text }
53
+ { draggable &&
54
+ < span className = "k-columnmenu-drag-handle" >
55
+ < Icon icon = "handle-drag" />
56
+ </ span >
57
+ }
58
+ { startIcon && < Icon icon = { startIcon } /> }
59
+ { text }
60
+ { endIcon &&
61
+ < span className = "k-columnmenu-indicators" >
62
+ < Icon icon = { endIcon } />
63
+ { sortIndex && < span className = "k-sort-index" > { sortIndex } </ span > }
64
+ </ span >
65
+ }
46
66
{ props . children }
67
+ { actions &&
68
+ < >
69
+ < span className = "k-spacer" > </ span >
70
+ < span className = "k-columnmenu-item-actions" > { actions } </ span >
71
+ </ >
72
+ }
47
73
</ div >
48
74
) ;
49
75
} ;
Original file line number Diff line number Diff line change 1
- import { classNames } from '../misc' ;
1
+ import { classNames , optionClassNames , Size } from '../misc' ;
2
2
3
3
export const COLUMNMENU_CLASSNAME = `k-column-menu` ;
4
4
5
5
const states = [ ] ;
6
6
7
- const options = { } ;
7
+ const options = {
8
+ size : [ Size . small , Size . medium , Size . large ]
9
+ } ;
10
+
11
+ export type KendoColumnMenuOptions = {
12
+ size ?: ( typeof options . size ) [ number ] | null ;
13
+ }
8
14
9
- export type KendoColumnMenuProps = {
15
+ export type KendoColumnMenuProps = KendoColumnMenuOptions & {
10
16
view ?: 'list' | 'tabbed' ;
11
17
} ;
12
18
13
19
const defaultOptions = {
14
20
view : 'list' ,
21
+ size : Size . medium
15
22
} ;
16
23
17
24
export const ColumnMenu = (
@@ -20,6 +27,7 @@ export const ColumnMenu = (
20
27
) => {
21
28
const {
22
29
view = defaultOptions . view ,
30
+ size = defaultOptions . size ,
23
31
...other
24
32
} = props ;
25
33
@@ -29,6 +37,9 @@ export const ColumnMenu = (
29
37
className = { classNames (
30
38
props . className ,
31
39
COLUMNMENU_CLASSNAME ,
40
+ optionClassNames ( COLUMNMENU_CLASSNAME , {
41
+ size,
42
+ } ) ,
32
43
{
33
44
'k-column-menu-tabbed' : view === 'tabbed'
34
45
} ,
Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ export * from './filter-menu.spec';
6
6
export * from './column-menu-multicheck-wrap' ;
7
7
export * from './column-menu-multicheck-item' ;
8
8
export * from './column-menu-expander.spec' ;
9
+ export * from './column-menu-item-action' ;
9
10
export * from './templates/column-menu-normal' ;
10
11
export * from './templates/column-menu-tabbed' ;
11
12
export * from './templates/filter-menu-normal' ;
12
- export * from './templates/filter-menu-multi-check' ;
13
+ export * from './templates/filter-menu-multi-check' ;
You can’t perform that action at this time.
0 commit comments