using AIStudio.Settings; using Microsoft.AspNetCore.Components; namespace AIStudio.Components; /// /// Configuration component for selecting a value from a list. /// /// The type of the value to select. public partial class ConfigurationSelect : ConfigurationBaseCore { /// /// The data to select from. /// [Parameter] public IEnumerable> Data { get; set; } = []; /// /// The selected value. /// [Parameter] public Func SelectedValue { get; set; } = () => default!; /// /// An action that is called when the selection changes. /// [Parameter] public Action SelectionUpdate { get; set; } = _ => { }; #region Overrides of ConfigurationBase /// protected override bool Stretch => true; /// protected override string Label => this.OptionDescription; protected override Variant Variant => Variant.Outlined; #endregion private async Task OptionChanged(TConfig updatedValue) { this.SelectionUpdate(updatedValue); await this.SettingsManager.StoreSettings(); await this.InformAboutChange(); } }