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

Commit fb3eaed

Browse files
Googlernshahan
authored andcommitted
Add menu item affix for rendering deprecation warning in material menu.
Add deprecation icon to deprecated filter items. PiperOrigin-RevId: 259425716
1 parent a62f6ac commit fb3eaed

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

angular_components/lib/material_menu/menu_item_groups.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
</span>
8989
</span>
9090
<menu-item-affix-list
91-
*ngIf="item.itemSuffixes.isNotEmpty"
91+
*ngIf="item.hasVisibleSuffixes"
9292
class="suffix-list"
9393
[disabled]="!item.enabled"
9494
[items]="item.itemSuffixes">

angular_components/lib/model/menu/delegating_menu_item.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,7 @@ class DelegatingMenuItem<SubMenuType> implements MenuItem<SubMenuType> {
7777

7878
@override
7979
String get secondaryLabel => _delegate.secondaryLabel;
80+
81+
@override
82+
bool get hasVisibleSuffixes => _delegate.hasVisibleSuffixes;
8083
}

angular_components/lib/model/menu/menu.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,12 @@ class MenuItem<T> with MenuItemMixin implements HasUIDisplayName, HasIcon {
203203
'Only one of itemSuffix or itemSuffixes should be provided');
204204
}
205205

206+
/// True if any of the [itemSuffixes] are rendered.
207+
///
208+
/// Rendered suffixes include those that are visible on hover. Hidden suffixes
209+
/// are excluded.
210+
bool get hasVisibleSuffixes => itemSuffixes.any((suffix) => suffix.isVisible);
211+
206212
@override
207213
String toString() => {
208214
'label': label,

angular_components/lib/model/menu/selectable_menu.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,13 @@ class SelectableMenuItem<ItemType> extends PropertyChangeNotifier
204204
_selectableState = value;
205205
notifyPropertyChange(#selectableState, _selectableState, value);
206206
}
207+
208+
/// True if any of the [itemSuffixes] are rendered.
209+
///
210+
/// Rendered suffixes include those that are visible on hover. Hidden suffixes
211+
/// are excluded.
212+
@override
213+
bool get hasVisibleSuffixes => itemSuffixes.any((suffix) => suffix.isVisible);
207214
}
208215

209216
void _noOp() {}

0 commit comments

Comments
 (0)