Table of Contents

Class FieldBase<T, U>

Namespace
The.Web.Entities.Fields
Assembly
Instagile.Web.Client.dll

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

T
U
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

IReadOnlyList<ValidationFinding>

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

EventCallback<IReadOnlyList<ValidationFinding>>

FocusChanged

[Parameter]
public EventCallback<bool> FocusChanged { get; set; }

Property Value

EventCallback<bool>

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

string

IsReadOnly

[Parameter]
public bool IsReadOnly { get; set; }

Property Value

bool

IsValid

protected bool IsValid { get; }

Property Value

bool

Logger

[Inject]
public ILogger<FieldBase<T, U>> Logger { get; set; }

Property Value

ILogger<FieldBase<T, U>>

MaxLength

[Parameter]
public int MaxLength { get; set; }

Property Value

int

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

IServices

Validation

Optional live validation session, typically owned by an EntityEditViews<T>.

[CascadingParameter]
public ValidationSession? Validation { get; set; }

Property Value

ValidationSession

Validity

The most severe displayed finding level, or null when there are none. Bound to widgets' Validity.

protected MessageLevel? Validity { get; }

Property Value

MessageLevel?

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

IReadOnlyList<ValidationFinding>

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public override void Dispose()

HasChanges()

public abstract bool HasChanges()

Returns

bool

NotifyValueChanged()

protected void NotifyValueChanged()

OnFocusChanged(bool)

protected Task OnFocusChanged(bool focus)

Parameters

focus bool

Returns

Task

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

level MessageLevel
message string

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()

Returns

bool