Class BOBInputComponentBase<TValue>
- Namespace
- BlazOrbit.Abstractions
- Assembly
- BlazOrbit.Core.dll
public abstract class BOBInputComponentBase<TValue> : InputBase<TValue>, IHasReadOnly, IHasDisabled, IHasRequired, IHasError
Type Parameters
TValue
- Inheritance
-
objectComponentBaseInputBase<TValue>BOBInputComponentBase<TValue>
- Implements
- Derived
Constructors
BOBInputComponentBase()
protected BOBInputComponentBase()
Properties
ComputedAttributes
public Dictionary<string, object> ComputedAttributes { get; }
Property Value
- Dictionary<string, object>
Disabled
When true, the input is disabled. Combined with internal state via IsDisabled.
[Parameter]
public bool Disabled { get; set; }
Property Value
- bool
Error
When true, the input is forced into the error state. Combined with EditContext validation via IsError.
[Parameter]
public bool Error { get; set; }
Property Value
- bool
IsDisabled
Computed disabled state, combining Disabled with internal conditions such as loading.
public virtual bool IsDisabled { get; }
Property Value
- bool
IsDisposed
true once Dispose(bool) / DisposeAsync() has started. See
BOBComponentBase.IsDisposed for the contract — gate post-await continuations in derived
components on this flag.
protected bool IsDisposed { get; set; }
Property Value
- bool
IsError
Computed error state, combining Error with validation messages from Microsoft.AspNetCore.Components.Forms.EditContext.
public bool IsError { get; }
Property Value
- bool
IsReadOnly
Computed read-only state.
public bool IsReadOnly { get; }
Property Value
- bool
IsRequired
Computed required state.
public bool IsRequired { get; }
Property Value
- bool
ReadOnly
When true, the input is read-only. Combined with internal state via IsReadOnly.
[Parameter]
public bool ReadOnly { get; set; }
Property Value
- bool
Required
When true, the input is marked required for validation. Combined with internal state via IsRequired.
[Parameter]
public bool Required { get; set; }
Property Value
- bool
Methods
BuildComponentCssVariables(Dictionary<string, string>)
public virtual void BuildComponentCssVariables(Dictionary<string, string> cssVariables)
Parameters
cssVariablesDictionary<string, string>
BuildComponentDataAttributes(Dictionary<string, object>)
public virtual void BuildComponentDataAttributes(Dictionary<string, object> dataAttributes)
Parameters
dataAttributesDictionary<string, object>
BuildRenderTree(RenderTreeBuilder)
Renders the component to the supplied Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.
protected override void BuildRenderTree(RenderTreeBuilder builder)
Parameters
builderRenderTreeBuilderA Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder that will receive the render output.
Dispose(bool)
Sync disposal path inherited from Microsoft.AspNetCore.Components.Forms.InputBase<TValue>. Unsubscribes the Microsoft.AspNetCore.Components.Forms.EditContext validation handler so the next component instance does not double-fire validation. JS-side cleanup belongs in DisposeAsync().
protected override void Dispose(bool disposing)
Parameters
disposingbool
DisposeAsync()
Async disposal path. Blazor invokes this first when the component is unmounted because the type implements System.IAsyncDisposable; it tears down the JS-side behavior instance via BlazOrbit.Abstractions.BOBComponentPipeline.DisposeBehaviorAsync().
public virtual ValueTask DisposeAsync()
Returns
- ValueTask
Remarks
Both this method and Dispose(bool) run on disposal — Blazor calls
DisposeAsync for the async work and the framework's System.IDisposable
contract still invokes Dispose(true) afterward. The split is intentional:
async work (JS interop teardown) lives here, sync work (event unsubscribe) lives in
Dispose(true). Both set IsDisposed so derived components can
guard post-await continuations regardless of which path runs first.
OnAfterRenderAsync(bool)
Method invoked after each time the component has been rendered interactively and the UI has finished updating (for example, after elements have been added to the browser DOM). Any Microsoft.AspNetCore.Components.ElementReference fields will be populated by the time this runs.
This method is not invoked during prerendering or server-side rendering, because those processes are not attached to any live browser DOM and are already complete before the DOM is updated.
Note that the component does not automatically re-render after the completion of any returned System.Threading.Tasks.Task, because that would cause an infinite render loop.
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
firstRenderboolSet to
trueif this is the first time Microsoft.AspNetCore.Components.ComponentBase.OnAfterRender(bool) has been invoked on this component instance; otherwisefalse.
Returns
- Task
A System.Threading.Tasks.Task representing any asynchronous operation.
Remarks
The Microsoft.AspNetCore.Components.ComponentBase.OnAfterRender(bool) and Microsoft.AspNetCore.Components.ComponentBase.OnAfterRenderAsync(bool) lifecycle methods
are useful for performing interop, or interacting with values received from @ref.
Use the firstRender parameter to ensure that initialization work is only performed
once.
OnInitialized()
Method invoked when the component is ready to start, having received its initial parameters from its parent in the render tree.
protected override void OnInitialized()
OnParametersSet()
Method invoked when the component has received parameters from its parent in the render tree, and the incoming values have been assigned to properties.
protected override void OnParametersSet()
SetParametersAsync(ParameterView)
Sets parameters supplied by the component's parent in the render tree.
public override Task SetParametersAsync(ParameterView parameters)
Parameters
parametersParameterViewThe parameters.
Returns
- Task
A System.Threading.Tasks.Task that completes when the component has finished updating and rendering itself.
Remarks
Parameters are passed when Microsoft.AspNetCore.Components.ComponentBase.SetParametersAsync(Microsoft.AspNetCore.Components.ParameterView) is called. It is not required that the caller supply a parameter value for all of the parameters that are logically understood by the component.
The default implementation of Microsoft.AspNetCore.Components.ComponentBase.SetParametersAsync(Microsoft.AspNetCore.Components.ParameterView) will set the value of each property decorated with Microsoft.AspNetCore.Components.ParameterAttribute or Microsoft.AspNetCore.Components.CascadingParameterAttribute that has a corresponding value in the Microsoft.AspNetCore.Components.ParameterView. Parameters that do not have a corresponding value will be unchanged.
ShouldRender()
Echo-guard. Suppresses redundant render-tree rebuilds triggered by the
ValueChanged → parent → SetParametersAsync round-trip when nothing
observable changed. Fires only on the parameter-change path; explicit
StateHasChanged calls (focus/blur, validation flips, derived-component
private state, JS-driven updates) always render.
protected override bool ShouldRender()
Returns
- bool