File tree 4 files changed +21
-2
lines changed
4 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,18 @@ storiesOf(TREE_GRID, module)
11
11
< div className = "slds-p-around_medium" > { getStory ( ) } </ div >
12
12
) )
13
13
. add ( 'Default' , ( ) => < Default action = { action } /> )
14
- . add ( 'w/ Single Select' , ( ) => (
14
+ . add ( 'Single Select' , ( ) => (
15
15
< Default action = { action } selectRows = "single" />
16
16
) )
17
+ . add ( 'w/o Border' , ( ) => < Default action = { action } isBorderless /> )
18
+ . add ( 'Single Select w/o Border' , ( ) => (
19
+ < Default action = { action } selectRows = "single" isBorderless />
20
+ ) )
21
+ . add ( 'Headless Single Select w/ Border' , ( ) => (
22
+ < Headless action = { action } selectRows = "single" />
23
+ ) )
17
24
. add ( 'Headless w/ Border' , ( ) => < Headless action = { action } /> )
25
+ . add ( 'Headless Single Select w/o Border' , ( ) => (
26
+ < Headless action = { action } selectRows = "single" isBorderless />
27
+ ) )
18
28
. add ( 'Headless w/o Border' , ( ) => < Headless action = { action } isBorderless /> ) ;
Original file line number Diff line number Diff line change @@ -182,6 +182,7 @@ class Example extends React.Component {
182
182
nodes : this . props . nodes || sampleData ,
183
183
isIndeterminate : false ,
184
184
allSelect : false ,
185
+ selectedNode : null
185
186
} ;
186
187
187
188
getNodes = ( node ) =>
@@ -250,6 +251,12 @@ class Example extends React.Component {
250
251
}
251
252
this . setState ( { nodes : curr , isIndeterminate, allSelect } ) ;
252
253
}
254
+ else {
255
+ const { nodes, selectedNode } = this . state ;
256
+ nodes [ data . node . id ] . selected = true ;
257
+ if ( selectedNode != null ) { nodes [ selectedNode ] . selected = false ; }
258
+ this . setState ( { nodes, selectedNode : data . node . id } )
259
+ }
253
260
} ;
254
261
255
262
handleSelectAll = ( event ) => {
@@ -285,6 +292,7 @@ class Example extends React.Component {
285
292
< TreeGrid
286
293
id = "example"
287
294
nodes = { this . state . nodes [ '0' ] . nodes }
295
+ isBorderless = { this . props . isBorderless }
288
296
getNodes = { this . getNodes }
289
297
onExpand = { this . handleExpansion }
290
298
onSelect = { this . handleSelection }
Original file line number Diff line number Diff line change @@ -158,6 +158,7 @@ class Example extends React.Component {
158
158
< TreeGrid
159
159
isHeadless
160
160
isBorderless = { this . props . isBorderless }
161
+ selectRows = { this . props . selectRows }
161
162
nodes = { this . state . nodes [ '0' ] . nodes }
162
163
getNodes = { this . getNodes }
163
164
onExpand = { this . handleExpansion }
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ const Item = (props) => {
102
102
props . row . selected ? `slds-is-selected` : null
103
103
) }
104
104
onClick = { ( event ) =>
105
- props . selectRows === 'single' ? props . onSelect ( event , props . row ) : null
105
+ props . selectRows === 'single' ? handleSelection ( event ) : null
106
106
}
107
107
onKeyDown = { handleKeyDown }
108
108
ref = { ( component ) => {
You can’t perform that action at this time.
0 commit comments