Files
Daybreak/Daybreak.Core/Views/Components/Options/OptionBase.razor
T

30 lines
863 B
Plaintext

<h3>OptionBase</h3>
@typeparam T
@code {
[Parameter]
public required string Name { get; init; }
[Parameter]
public required string Description { get; init; }
[Parameter]
public required OptionInstance Instance { get; init; }
[Parameter]
public required OptionProperty Property { get; init; }
[Parameter]
public required Action ValueChanged { get; init; }
public T? Value { get; set; }
protected virtual T? ConvertValue(OptionInstance optionInstance, OptionProperty property) { throw new InvalidOperationException("Converter is not implemented"); }
protected override Task OnParametersSetAsync()
{
this.Value = this.ConvertValue(this.Instance, this.Property);
return base.OnParametersSetAsync();
}
protected void NotifyValueChanged()
{
this.ValueChanged();
}
}