@@ -15,13 +15,15 @@ import {
15
15
FormControlLabel ,
16
16
FormGroup ,
17
17
Grid ,
18
+ IconButton ,
18
19
StyledEngineProvider ,
19
20
Tab ,
20
21
Tabs ,
21
22
TextField ,
22
23
ThemeProvider ,
23
24
Typography ,
24
25
} from '@mui/material' ;
26
+ import CommentIcon from '@mui/icons-material/Comment' ;
25
27
import { styled } from '@mui/system' ;
26
28
import { useMatch } from 'react-router' ;
27
29
import { IntlProvider , useIntl } from 'react-intl' ;
@@ -102,6 +104,7 @@ import inputs_en from '../../src/components/translations/inputs-en';
102
104
import inputs_fr from '../../src/components/translations/inputs-fr' ;
103
105
import { EquipmentSearchDialog } from './equipment-search' ;
104
106
import { InlineSearch } from './inline-search' ;
107
+ import MultipleSelectionDialog from '../../src/components/MultipleSelectionDialog/MultipleSelectionDialog' ;
105
108
106
109
const messages = {
107
110
en : {
@@ -311,6 +314,10 @@ function AppContent({ language, onLanguageClick }) {
311
314
const [ equipmentLabelling , setEquipmentLabelling ] = useState ( false ) ;
312
315
313
316
const [ openReportViewer , setOpenReportViewer ] = useState ( false ) ;
317
+
318
+ const [ openMultiChoiceDialog , setOpenMultiChoiceDialog ] = useState ( false ) ;
319
+ const [ openDraggableMultiChoiceDialog , setOpenDraggableMultiChoiceDialog ] = useState ( false ) ;
320
+
314
321
const [ openTreeViewFinderDialog , setOpenTreeViewFinderDialog ] = useState ( false ) ;
315
322
const [ openTreeViewFinderDialogCustomDialog , setOpenTreeViewFinderDialogCustomDialog ] = useState ( false ) ;
316
323
@@ -540,6 +547,22 @@ function AppContent({ language, onLanguageClick }) {
540
547
) ;
541
548
}
542
549
550
+ const [ checkBoxListOption , setCheckBoxListOption ] = useState ( [
551
+ { id : 'kiki' , label : 'Kylian Mbappe' } ,
552
+ { id : 'ney' , label : 'Neymar' } ,
553
+ { id : 'lapulga' , label : 'Lionel Messi' } ,
554
+ { id : 'ibra' , label : 'Zlatan Ibrahimovic' } ,
555
+ {
556
+ id : 'john' ,
557
+ label : 'Johannes Vennegoor of Hesselink is the football player with the longest name in history' ,
558
+ } ,
559
+ ] ) ;
560
+
561
+ const secondaryAction = ( ) => (
562
+ < IconButton aria-label = "comment" >
563
+ < CommentIcon />
564
+ </ IconButton >
565
+ ) ;
543
566
const defaultTab = (
544
567
< div >
545
568
< Box mt = { 3 } >
@@ -557,6 +580,65 @@ function AppContent({ language, onLanguageClick }) {
557
580
< SnackWarningButton />
558
581
< SnackInfoButton />
559
582
583
+ < Button
584
+ variant = "contained"
585
+ style = { {
586
+ float : 'left' ,
587
+ margin : '5px' ,
588
+ } }
589
+ onClick = { ( ) => setOpenMultiChoiceDialog ( true ) }
590
+ >
591
+ Checkbox list
592
+ </ Button >
593
+ < MultipleSelectionDialog
594
+ items = { checkBoxListOption }
595
+ selectedItems = { [ ] }
596
+ open = { openMultiChoiceDialog }
597
+ getItemLabel = { ( o ) => o . label }
598
+ getItemId = { ( o ) => o . id }
599
+ handleClose = { ( ) => setOpenMultiChoiceDialog ( false ) }
600
+ handleValidate = { ( ) => setOpenMultiChoiceDialog ( false ) }
601
+ titleId = "Checkbox list"
602
+ divider
603
+ secondaryAction = { secondaryAction }
604
+ addSelectAllCheckbox
605
+ isCheckboxClickableOnly
606
+ enableSecondaryActionOnHover
607
+ />
608
+
609
+ < Button
610
+ variant = "contained"
611
+ style = { {
612
+ float : 'left' ,
613
+ margin : '5px' ,
614
+ } }
615
+ onClick = { ( ) => setOpenDraggableMultiChoiceDialog ( true ) }
616
+ >
617
+ Draggable checkbox list
618
+ </ Button >
619
+ < MultipleSelectionDialog
620
+ items = { checkBoxListOption }
621
+ selectedItems = { [ ] }
622
+ open = { openDraggableMultiChoiceDialog }
623
+ getItemLabel = { ( o ) => o . label }
624
+ getItemId = { ( o ) => o . id }
625
+ handleClose = { ( ) => setOpenDraggableMultiChoiceDialog ( false ) }
626
+ handleValidate = { ( ) => setOpenDraggableMultiChoiceDialog ( false ) }
627
+ titleId = "Draggable checkbox list"
628
+ divider
629
+ secondaryAction = { secondaryAction }
630
+ isDndDragAndDropActive
631
+ enableSecondaryActionOnHover
632
+ onDragEnd = { ( { source, destination } ) => {
633
+ if ( destination !== null && source . index !== destination . index ) {
634
+ const res = [ ...checkBoxListOption ] ;
635
+ const [ item ] = res . splice ( source . index , 1 ) ;
636
+ res . splice ( destination ? destination . index : checkBoxListOption . length , 0 , item ) ;
637
+ setCheckBoxListOption ( res ) ;
638
+ }
639
+ } }
640
+ />
641
+
560
642
< Button
561
643
variant = "contained"
562
644
style = { {
0 commit comments