Skip to content
This repository was archived by the owner on May 20, 2023. It is now read-only.

Commit 10f69a7

Browse files
matanlureynshahan
authored andcommitted
This is a no-op, but I may not have changed _all_ of the host bindings or listeners in this CL (please await upcoming CLs). The host: const { ... } syntax is deprecated.
This one is complicated, because it relies on inherited host bindings from: * MaterialSelectItemComponent * ButtonDirective * ActiveItemMixin ... but as implemented, should still be a no-op. PiperOrigin-RevId: 197068174
1 parent 428eeb2 commit 10f69a7

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

lib/material_select/material_select_dropdown_item.dart

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,6 @@ import 'package:angular_components/utils/id_generator/id_generator.dart';
2121
/// This should only be used in select dropdowns.
2222
@Component(
2323
selector: 'material-select-dropdown-item',
24-
host: const {
25-
'[class.disabled]': 'disabled',
26-
'[class.hidden]': 'isHidden',
27-
'[class.active]': 'active',
28-
'[class.selected]': 'isSelected',
29-
'[class.multiselect]': 'supportsMultiSelect',
30-
'(click)': r'handleClick($event)',
31-
'(keypress)': r'handleKeyPress($event)',
32-
'(mousedown)': r'preventTextSelectionIfShiftKey($event)',
33-
'(mouseenter)': 'onMouseEnter()',
34-
'(mouseleave)': 'onMouseLeave()',
35-
'[attr.aria-selected]': 'isSelected',
36-
'[attr.aria-disabled]': 'disabledStr',
37-
'[attr.id]': 'id',
38-
},
3924
providers: const [
4025
const Provider(SelectionItem,
4126
useExisting: MaterialSelectDropdownItemComponent),
@@ -65,7 +50,9 @@ class MaterialSelectDropdownItemComponent extends MaterialSelectItemComponent
6550
String _id;
6651

6752
/// The id of the element.
53+
@HostBinding('attr.id')
6854
String get id => _id ?? _generatedId;
55+
6956
@Input()
7057
set id(String id) {
7158
_id = id;
@@ -86,6 +73,11 @@ class MaterialSelectDropdownItemComponent extends MaterialSelectItemComponent
8673
this.itemRenderer = defaultItemRenderer;
8774
}
8875

76+
@HostBinding('attr.aria-selected')
77+
@override
78+
bool get isSelected => super.isSelected;
79+
80+
@HostListener('mousedown')
8981
void preventTextSelectionIfShiftKey(MouseEvent e) {
9082
if (e.shiftKey) e.preventDefault();
9183
}

0 commit comments

Comments
 (0)