We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi @jsakamoto,
For the moment the text field only have color and default but I would like to have the possibility to choose from a list to facilite the rendering.
I was thinking to do like this in the TextParameterController.razor
TextParameterController.razor
@inherits ParameterControllerBase @if (Parameter?.Control is ControlType.Color) { var colorValue = (Value ?? Parameter.DefaultValue) as string; <ColorInput Value="@colorValue" PlaceHolder="Choose color..." OnInput="@((args) => OnInputAsync(args.Value))" /> } else if (Parameter?.Control is ControlType.Select) { var selectValue = (Value ?? Parameter.DefaultValue) as string; <Select Value="@selectValue" Items="Parameter.Options" OnChange="@((args) => OnInputAsync(args.Value))" /> } else { <TextArea PlaceHolder="Edit string..." Value="@(Value as string)" OnInput="@((args) => OnInputAsync(args.Value))" /> }
I was thinking to do like this in the ArgType.razor
ArgType.razor
@using System.Linq.Expressions; @typeparam TComponent where TComponent : notnull @typeparam TParameter @code { [CascadingParameter] internal IEnumerable<ComponentParameter>? ComponentParameters { get; set; } [Parameter] public Expression<Func<TComponent, TParameter>>? For { get; set; } [Parameter] public ControlType Control { get; set; } = ControlType.Default; [Parameter] public object? DefaultValue { get; set; } [Parameter] public string[] Options { get; set; } = Array.Empty<string>(); protected override void OnInitialized() { if (this.ComponentParameters == null) throw new InvalidOperationException($"The ComponentParameters cascading parameter is required."); var parameterName = ParameterExtractor.GetParameterName(this.For); if (this.ComponentParameters.TryGetByName(parameterName, out var parameter)) { parameter.Control = this.Control; parameter.DefaultValue = this.DefaultValue; parameter.Options = this.Options; } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi @jsakamoto,
For the moment the text field only have color and default but I would like to have the possibility to choose from a list to facilite the rendering.
I was thinking to do like this in the
TextParameterController.razor
I was thinking to do like this in the
ArgType.razor
The text was updated successfully, but these errors were encountered: