@@ -53,11 +53,9 @@ export abstract class ListWidget<
53
53
*/
54
54
protected firstActivate = true ;
55
55
56
- protected readonly defaultSortComparator : ( left : T , right : T ) => number ;
57
-
58
56
constructor ( protected options : ListWidget . Options < T , S > ) {
59
57
super ( ) ;
60
- const { id, label, iconClass, itemDeprecated , itemLabel } = options ;
58
+ const { id, label, iconClass } = options ;
61
59
this . id = id ;
62
60
this . title . label = label ;
63
61
this . title . caption = label ;
@@ -67,15 +65,6 @@ export abstract class ListWidget<
67
65
this . node . tabIndex = 0 ; // To be able to set the focus on the widget.
68
66
this . scrollOptions = undefined ;
69
67
this . toDispose . push ( this . searchOptionsChangeEmitter ) ;
70
-
71
- this . defaultSortComparator = ( left , right ) : number => {
72
- // always put deprecated items at the bottom of the list
73
- if ( itemDeprecated ( left ) ) {
74
- return 1 ;
75
- }
76
-
77
- return itemLabel ( left ) . localeCompare ( itemLabel ( right ) ) ;
78
- } ;
79
68
}
80
69
81
70
@postConstruct ( )
@@ -144,30 +133,6 @@ export abstract class ListWidget<
144
133
return this . options . installable . uninstall ( { item, progressId } ) ;
145
134
}
146
135
147
- protected filterableListSort = ( items : T [ ] ) : T [ ] => {
148
- const isArduinoTypeComparator = ( left : T , right : T ) => {
149
- const aIsArduinoType = left . types . includes ( 'Arduino' ) ;
150
- const bIsArduinoType = right . types . includes ( 'Arduino' ) ;
151
-
152
- if ( aIsArduinoType && ! bIsArduinoType && ! left . deprecated ) {
153
- return - 1 ;
154
- }
155
-
156
- if ( ! aIsArduinoType && bIsArduinoType && ! right . deprecated ) {
157
- return 1 ;
158
- }
159
-
160
- return 0 ;
161
- } ;
162
-
163
- return items . sort ( ( left , right ) => {
164
- return (
165
- isArduinoTypeComparator ( left , right ) ||
166
- this . defaultSortComparator ( left , right )
167
- ) ;
168
- } ) ;
169
- } ;
170
-
171
136
render ( ) : React . ReactNode {
172
137
return (
173
138
< FilterableListContainer < T , S >
@@ -178,14 +143,12 @@ export abstract class ListWidget<
178
143
install = { this . install . bind ( this ) }
179
144
uninstall = { this . uninstall . bind ( this ) }
180
145
itemLabel = { this . options . itemLabel }
181
- itemDeprecated = { this . options . itemDeprecated }
182
146
itemRenderer = { this . options . itemRenderer }
183
147
filterRenderer = { this . options . filterRenderer }
184
148
searchOptionsDidChange = { this . searchOptionsChangeEmitter . event }
185
149
messageService = { this . messageService }
186
150
commandService = { this . commandService }
187
151
responseService = { this . responseService }
188
- sort = { this . filterableListSort }
189
152
/>
190
153
) ;
191
154
}
@@ -218,7 +181,6 @@ export namespace ListWidget {
218
181
readonly installable : Installable < T > ;
219
182
readonly searchable : Searchable < T , S > ;
220
183
readonly itemLabel : ( item : T ) => string ;
221
- readonly itemDeprecated : ( item : T ) => boolean ;
222
184
readonly itemRenderer : ListItemRenderer < T > ;
223
185
readonly filterRenderer : FilterRenderer < S > ;
224
186
readonly defaultSearchOptions : S ;
0 commit comments