@@ -16,10 +16,57 @@ export default class MultiListCollection {
16
16
this . updateSelections ( )
17
17
}
18
18
19
+ clearSelectedItems ( ) {
20
+ this . selectedItems = new Set ( )
21
+ }
22
+
23
+ clearSelectedKeys ( ) {
24
+ this . selectedKeys = new Set ( )
25
+ }
26
+
27
+ getSelectedItems ( ) {
28
+ return this . selectedItems
29
+ }
30
+
31
+ getSelectedKeys ( ) {
32
+ return this . selectedKeys
33
+ }
34
+
35
+ getItemsForKey ( key ) {
36
+ return this . list . getItemsForKey ( key )
37
+ }
38
+
19
39
getLastSelectedListKey ( ) {
20
40
return this . list . getSelectedListKey ( )
21
41
}
22
42
43
+ selectNextList ( { wrap, addToExisting} = { } ) {
44
+ this . list . selectNextList ( { wrap} )
45
+ this . updateSelections ( { addToExisting} )
46
+ }
47
+
48
+ selectPreviousList ( { wrap, addToExisting} = { } ) {
49
+ this . list . selectPreviousList ( { wrap} )
50
+ this . updateSelections ( { addToExisting} )
51
+ }
52
+
53
+ selectNextItem ( { addToExisting, stopAtBounds} = { } ) {
54
+ this . list . selectNextItem ( { stopAtBounds} )
55
+ this . updateSelections ( { addToExisting} )
56
+ }
57
+
58
+ selectPreviousItem ( { addToExisting, stopAtBounds} = { } ) {
59
+ this . list . selectPreviousItem ( { stopAtBounds} )
60
+ this . updateSelections ( { addToExisting} )
61
+ }
62
+
63
+ updateSelections ( { addToExisting} = { } ) {
64
+ const selectedKey = this . list . getSelectedListKey ( )
65
+ const selectedItem = this . list . getSelectedItem ( )
66
+ this . selectItems ( selectedItem ? [ selectedItem ] : [ ] , { addToExisting, suppressCallback : true } )
67
+ this . selectKeys ( selectedKey ? [ selectedKey ] : [ ] , { addToExisting, suppressCallback : true } )
68
+ }
69
+
23
70
selectItems ( items , { addToExisting, suppressCallback} = { } ) {
24
71
if ( ! addToExisting ) this . clearSelectedItems ( )
25
72
items . forEach ( item => this . selectedItems . add ( item ) )
@@ -42,22 +89,6 @@ export default class MultiListCollection {
42
89
this . selectItems ( [ this . list . getItemsForKey ( key ) [ 0 ] ] , { addToExisting} )
43
90
}
44
91
45
- clearSelectedItems ( ) {
46
- this . selectedItems = new Set ( )
47
- }
48
-
49
- clearSelectedKeys ( ) {
50
- this . selectedKeys = new Set ( )
51
- }
52
-
53
- getSelectedItems ( ) {
54
- return this . selectedItems
55
- }
56
-
57
- getSelectedKeys ( ) {
58
- return this . selectedKeys
59
- }
60
-
61
92
selectItemsAndKeysInRange ( endPoint1 , endPoint2 , addToExisting ) {
62
93
if ( ! addToExisting ) {
63
94
this . clearSelectedItems ( )
@@ -108,35 +139,4 @@ export default class MultiListCollection {
108
139
}
109
140
}
110
141
}
111
-
112
- selectNextList ( { wrap, addToExisting} = { } ) {
113
- this . list . selectNextList ( { wrap} )
114
- this . updateSelections ( { addToExisting} )
115
- }
116
-
117
- selectPreviousList ( { wrap, addToExisting} = { } ) {
118
- this . list . selectPreviousList ( { wrap} )
119
- this . updateSelections ( { addToExisting} )
120
- }
121
-
122
- updateSelections ( { addToExisting} = { } ) {
123
- const selectedKey = this . list . getSelectedListKey ( )
124
- const selectedItem = this . list . getSelectedItem ( )
125
- this . selectItems ( selectedItem ? [ selectedItem ] : [ ] , { addToExisting, suppressCallback : true } )
126
- this . selectKeys ( selectedKey ? [ selectedKey ] : [ ] , { addToExisting, suppressCallback : true } )
127
- }
128
-
129
- selectNextItem ( { addToExisting, stopAtBounds} = { } ) {
130
- this . list . selectNextItem ( { stopAtBounds} )
131
- this . updateSelections ( { addToExisting} )
132
- }
133
-
134
- selectPreviousItem ( { addToExisting, stopAtBounds} = { } ) {
135
- this . list . selectPreviousItem ( { stopAtBounds} )
136
- this . updateSelections ( { addToExisting} )
137
- }
138
-
139
- getItemsForKey ( key ) {
140
- return this . list . getItemsForKey ( key )
141
- }
142
142
}
0 commit comments