@@ -7,12 +7,8 @@ import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails';
7
7
import ExpansionPanelActions from '@material-ui/core/ExpansionPanelActions' ;
8
8
import Typography from '@material-ui/core/Typography' ;
9
9
import Input from '@material-ui/core/Input' ;
10
- import MenuItem from '@material-ui/core/MenuItem' ;
11
- import RemoveCircleOutlineIcon from '@material-ui/icons/RemoveCircleOutline' ;
12
- import ListItemText from '@material-ui/core/ListItemText' ;
13
10
import ExpandMoreIcon from '@material-ui/icons/ExpandMore' ;
14
11
import Switch from '@material-ui/core/Switch' ;
15
- import Chip from '@material-ui/core/Chip' ;
16
12
import IconButton from '@material-ui/core/IconButton' ;
17
13
import DeleteIcon from '@material-ui/icons/Delete' ;
18
14
import FlipToBackIcon from '@material-ui/icons/FlipToBack' ;
@@ -32,13 +28,6 @@ const styles = theme => ({
32
28
fontSize : theme . typography . pxToRem ( 15 ) ,
33
29
fontWeight : theme . typography . fontWeightRegular ,
34
30
} ,
35
- chips : {
36
- display : 'flex' ,
37
- flexWrap : 'wrap' ,
38
- } ,
39
- chip : {
40
- margin : theme . spacing . unit / 4 ,
41
- } ,
42
31
panel : {
43
32
backgroundColor : '#333333' ,
44
33
} ,
@@ -71,15 +60,6 @@ const styles = theme => ({
71
60
group : {
72
61
margin : `${ theme . spacing . unit } px 0` ,
73
62
} ,
74
- icon : {
75
- fontSize : '20px' ,
76
- color : '#000' ,
77
- transition : 'all .2s ease' ,
78
-
79
- '&:hover' : {
80
- color : 'red' ,
81
- } ,
82
- } ,
83
63
} ) ;
84
64
85
65
const LeftColExpansionPanel = ( props ) => {
@@ -99,24 +79,23 @@ const LeftColExpansionPanel = (props) => {
99
79
id,
100
80
stateful,
101
81
color,
102
- parents,
103
- parentIds,
82
+ parent,
104
83
selectableParents,
105
84
} = component ;
106
85
107
- const handleParentChange = ( event , parentId = null ) => {
108
- let newParentId = parentId ;
109
- if ( event ) {
110
- const selectedParents = event . target . value ;
111
- newParentId = selectedParents [ selectedParents . length - 1 ] . id ;
112
- }
113
-
114
- return updateComponent ( {
115
- index ,
116
- id ,
117
- newParentId ,
118
- } ) ;
119
- } ;
86
+ const parentOptions = [
87
+ < option value = 'null' key = '' >
88
+ None
89
+ </ option > ,
90
+ ... selectableParents . map (
91
+ selectableParent => < option
92
+ value = { selectableParent . id }
93
+ key = { selectableParent . id }
94
+ >
95
+ { selectableParent . title }
96
+ </ option > ,
97
+ ) ,
98
+ ] ;
120
99
121
100
return (
122
101
< div className = { classes . root } >
@@ -151,35 +130,24 @@ const LeftColExpansionPanel = (props) => {
151
130
/>
152
131
</ div >
153
132
< div className = { classes . column } >
154
- < InputLabel className = { classes . label } htmlFor = 'parentSelect' > selectedParents </ InputLabel >
133
+ < InputLabel className = { classes . label } htmlFor = 'parentSelect' > Parent </ InputLabel >
155
134
< Select
156
135
className = { classes . light }
157
- multiple
158
- value = { parents }
136
+ native
137
+ value = { parent . id }
159
138
id = 'parentSelect'
160
139
name = 'parentName'
161
- disabled = { selectableParents . length < 1 }
162
- onChange = { handleParentChange }
163
- input = { < Input id = 'parentSelect' /> }
164
- renderValue = { selectedP => (
165
- < div className = { classes . chips } >
166
- { selectedP . map ( parent => (
167
- < Chip
168
- key = { parent . id }
169
- label = { parent . title }
170
- className = { classes . chip }
171
- onDelete = { ( ) => handleParentChange ( null , parent . id ) }
172
- deleteIcon = { < RemoveCircleOutlineIcon className = { classes . icon } /> }
173
- />
174
- ) ) }
175
- </ div >
176
- ) }
140
+ onChange = { ( event ) => {
141
+ const newParentId = event . target . value ;
142
+ updateComponent ( {
143
+ newParentId,
144
+ index,
145
+ id,
146
+ parent,
147
+ } ) ;
148
+ } }
177
149
>
178
- { selectableParents . map ( parentObj => (
179
- < MenuItem key = { parentObj . id } value = { parentObj } >
180
- < ListItemText primary = { parentObj . title } />
181
- </ MenuItem >
182
- ) ) }
150
+ { parentOptions }
183
151
</ Select >
184
152
</ div >
185
153
</ ExpansionPanelDetails >
@@ -205,7 +173,7 @@ const LeftColExpansionPanel = (props) => {
205
173
className = { classes . button }
206
174
onClick = { ( ) => {
207
175
deleteComponent ( {
208
- index, id, parentIds ,
176
+ index, id, parent ,
209
177
} ) ;
210
178
} }
211
179
aria-label = 'Delete' >
0 commit comments