1
1
import { useState } from 'react'
2
2
import reduce from 'lodash/reduce'
3
+ import pick from 'lodash/pick'
3
4
4
5
import { COLORS , Labware , RobotCoordinateSpace } from '@opentrons/components'
5
6
import {
@@ -29,6 +30,8 @@ interface WellSelectionProps {
29
30
pipetteNozzleDetails ?: NozzleLayoutDetails
30
31
/* Whether highlighting and selectWells() updates are permitted. */
31
32
allowSelect ?: boolean
33
+ /* Whether selecting more than the channel count of well locations is permitted. */
34
+ allowMultiDrag ?: boolean
32
35
}
33
36
34
37
export function WellSelection ( props : WellSelectionProps ) : JSX . Element {
@@ -40,6 +43,7 @@ export function WellSelection(props: WellSelectionProps): JSX.Element {
40
43
channels,
41
44
pipetteNozzleDetails,
42
45
allowSelect = true ,
46
+ allowMultiDrag = true ,
43
47
} = props
44
48
const [ highlightedWells , setHighlightedWells ] = useState < WellGroup > ( { } )
45
49
@@ -61,16 +65,21 @@ export function WellSelection(props: WellSelectionProps): JSX.Element {
61
65
} )
62
66
if ( ! wellSet ) {
63
67
return acc
68
+ } else if ( allowMultiDrag ) {
69
+ return { ...acc , [ wellSet [ 0 ] ] : null }
70
+ } else {
71
+ return { [ wellSet [ 0 ] ] : null }
64
72
}
65
- return { ...acc , [ wellSet [ 0 ] ] : null }
66
73
} ,
67
74
{ }
68
75
)
69
76
return primaryWells
77
+ } else {
78
+ // single-channel or ingred selection mode
79
+ return allowMultiDrag
80
+ ? selectedWells
81
+ : pick ( selectedWells , Object . keys ( selectedWells ) [ 0 ] )
70
82
}
71
-
72
- // single-channel or ingred selection mode
73
- return selectedWells
74
83
}
75
84
76
85
const _getWellsFromRect : ( rect : GenericRect ) => WellGroup = rect => {
0 commit comments