Skip to content

Commit

Permalink
Add IsReadOnly parameter to MultiComboBox component
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbware committed Nov 28, 2023
1 parent a1950c9 commit eb43aa2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions COMET.Web.Common/Components/MultiComboBox.razor
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
Data="@this.Data"
ValueChanged="@this.ItemSelected"
Enabled="@this.Enabled"
ReadOnly="@(this.IsReadOnly)"
Value="@this.lastSelectedValue"
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto"
CssClass="w-100">
Expand Down
12 changes: 10 additions & 2 deletions COMET.Web.Common/Components/MultiComboBox.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public partial class MultiComboBox<TItem>
public IEnumerable<TItem> Data { get; set; } = Enumerable.Empty<TItem>();

/// <summary>
/// Gets or sets if the component should show all the fields as readonly
/// Gets or sets if the component should show all the fields as enabled/disabled.
/// If a component is disabled, the user can't select the values within the component.
/// </summary>
[Parameter]
public bool Enabled { get; set; } = true;
Expand All @@ -83,7 +84,14 @@ public partial class MultiComboBox<TItem>
/// Gets or sets the callback used to update the component value
/// </summary>
[Parameter]
public EventCallback<List<TItem>> ValuesChanged { get; set; }
public EventCallback<List<TItem>> ValuesChanged { get; set; }

/// <summary>
/// Gets or sets if the component is read only.
/// If a component is read only, the user can select the values but not edit them.
/// </summary>
[Parameter]
public bool IsReadOnly { get; set; }

/// <summary>
/// Handler for when the value of the component has changed
Expand Down

0 comments on commit eb43aa2

Please sign in to comment.