Class FieldBase<T, U>
Base class for components that model an entity property, which can be generated by an IEditSpec.
public abstract class FieldBase<T, U> : CancellableComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable, ITag where T : IHasChanges where U : IEntity?
Type Parameters
TU
- Inheritance
-
FieldBase<T, U>
- Implements
- Derived
- Inherited Members
Properties
Findings
Combined findings from a ValidationReport and this field's local findings (parse errors).
protected IReadOnlyList<ValidationFinding> Findings { get; }
Property Value
FindingsChanged
Raised when the findings this field displays have changed; the hosting row uses it to update the field's label.
[Parameter]
public EventCallback<IReadOnlyList<ValidationFinding>> FindingsChanged { get; set; }
Property Value
FocusChanged
[Parameter]
public EventCallback<bool> FocusChanged { get; set; }
Property Value
ID
The id to place on the field's primary form input, so a <label for> can focus it.
[Parameter]
public string? ID { get; set; }
Property Value
IsReadOnly
[Parameter]
public bool IsReadOnly { get; set; }
Property Value
IsValid
protected bool IsValid { get; }
Property Value
Logger
[Inject]
public ILogger<FieldBase<T, U>> Logger { get; set; }
Property Value
MaxLength
[Parameter]
public int MaxLength { get; set; }
Property Value
Parent
public abstract U Parent { get; }
Property Value
- U
Property
[Parameter]
public T? Property { get; set; }
Property Value
- T
Services
[Inject]
public IServices Services { get; set; }
Property Value
Validation
Optional live validation session, typically owned by an EntityEditViews<T>.
[CascadingParameter]
public ValidationSession? Validation { get; set; }
Property Value
Validity
The most severe displayed finding level, or null when there are none. Bound to widgets' Validity.
protected MessageLevel? Validity { get; }
Property Value
Methods
ComputeFindings()
The findings this field displays: the report's findings for the bound property, filtered by the display policy, followed by the field's local findings. A composite field which displays findings belonging to other entities (e.g. inline collection rows) overrides this to include them - the field re-renders whenever the computed set changes.
protected virtual IReadOnlyList<ValidationFinding> ComputeFindings()
Returns
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public override void Dispose()
HasChanges()
public abstract bool HasChanges()
Returns
NotifyValueChanged()
protected void NotifyValueChanged()
OnFocusChanged(bool)
protected Task OnFocusChanged(bool focus)
Parameters
focusbool
Returns
OnParametersSet()
Sealed so that a subclass cannot accidentally disconnect the field from the cascaded ValidationSession; parameter-set logic belongs in OnParametersSetInternal().
protected override sealed void OnParametersSet()
OnParametersSetInternal()
Runs when component parameters are set, after the field's own bookkeeping.
protected virtual void OnParametersSetInternal()
SetLocalFinding(MessageLevel, string?)
Sets or clears a local finding, like a parse error, for the field's bound property.
protected bool SetLocalFinding(MessageLevel level, string? message)
Parameters
levelMessageLevelmessagestring
Returns
- bool
True if the finding was attached to an entity, false if the field has no binding.
ShouldRenderFindings()
True once per findings change; subclasses with ShouldRender overrides consult it.
protected bool ShouldRenderFindings()