|
|
|
@ -79,7 +79,8 @@ public class ApplicationMenuItem : IHasMenuItems, IHasSimpleStateCheckers<Applic |
|
|
|
/// <summary>
|
|
|
|
/// Can be used to store a custom object related to this menu item. Optional.
|
|
|
|
/// </summary>
|
|
|
|
public object CustomData { get; set; } |
|
|
|
[NotNull] |
|
|
|
public Dictionary<string, object> CustomData { get; } = new(); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Can be used to render the element with a specific Id for DOM selections.
|
|
|
|
@ -97,7 +98,6 @@ public class ApplicationMenuItem : IHasMenuItems, IHasSimpleStateCheckers<Applic |
|
|
|
string url = null, |
|
|
|
string icon = null, |
|
|
|
int order = DefaultOrder, |
|
|
|
object customData = null, |
|
|
|
string target = null, |
|
|
|
string elementId = null, |
|
|
|
string cssClass = null, |
|
|
|
@ -111,7 +111,6 @@ public class ApplicationMenuItem : IHasMenuItems, IHasSimpleStateCheckers<Applic |
|
|
|
Url = url; |
|
|
|
Icon = icon; |
|
|
|
Order = order; |
|
|
|
CustomData = customData; |
|
|
|
Target = target; |
|
|
|
ElementId = elementId ?? GetDefaultElementId(); |
|
|
|
CssClass = cssClass; |
|
|
|
@ -131,6 +130,16 @@ public class ApplicationMenuItem : IHasMenuItems, IHasSimpleStateCheckers<Applic |
|
|
|
return this; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Adds a custom data item to <see cref="CustomData"/> with given key & value.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>This <see cref="ApplicationMenuItem"/> itself.</returns>
|
|
|
|
public ApplicationMenuItem WithCustomData(string key, object value) |
|
|
|
{ |
|
|
|
CustomData[key] = value; |
|
|
|
return this; |
|
|
|
} |
|
|
|
|
|
|
|
private string GetDefaultElementId() |
|
|
|
{ |
|
|
|
return "MenuItem_" + Name; |
|
|
|
|