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, IValidatable<T>, IValidatable where T : IHasChanges where U : IEntity?

Type Parameters

T
U
Inheritance
FieldBase<T, U>
Implements
Derived
Inherited Members

Properties

FocusChanged

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

Property Value

EventCallback<bool>

HasValue

Indicates whether the validatable field has a value set

public abstract bool HasValue { get; }

Property Value

bool

IsReadOnly

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

Property Value

bool

IsValid

protected bool IsValid { get; }

Property Value

bool

IsValidationPending

protected bool IsValidationPending { get; set; }

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

Rules

[Parameter]
public IEnumerable<IValidationRule> Rules { get; set; }

Property Value

IEnumerable<IValidationRule>

Services

[Inject]
public IServices Services { get; set; }

Property Value

IServices

ValidationContext

[CascadingParameter]
public ValidationContext? ValidationContext { get; set; }

Property Value

ValidationContext

ValidationResults

The results of the latest triggered validation(s) for the field

public ValidationResults ValidationResults { get; }

Property Value

ValidationResults

ValidationResultsChanged

[Parameter]
public EventCallback<ValidationResults> ValidationResultsChanged { get; set; }

Property Value

EventCallback<ValidationResults>

Methods

CanParse()

Indicates whether the validatable field has a value that can be parsed

public abstract bool CanParse()

Returns

bool

Dispose()

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

public override void Dispose()

GetValue()

public T? GetValue()

Returns

T

HasChanges()

public abstract bool HasChanges()

Returns

bool

NotifyValueChanged()

protected void NotifyValueChanged()

OnAddValidationRules()

Called when the validation rules are added. This allows FieldBase implementations to override this method to provide validation rules at the field level (in addition to those passed in via the Rules parameter)

protected virtual void OnAddValidationRules()

OnAfterRender(bool)

Method invoked after each time the component has rendered interactively and the UI has finished updating (for example, after elements have been added to the browser DOM). Any 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.

protected override void OnAfterRender(bool firstRender)

Parameters

firstRender bool

Set to true if this is the first time OnAfterRender(bool) has been invoked on this component instance; otherwise false.

Remarks

The OnAfterRender(bool) and 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.

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 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 Task, because that would cause an infinite render loop.

protected override Task OnAfterRenderAsync(bool firstRender)

Parameters

firstRender bool

Set to true if this is the first time OnAfterRender(bool) has been invoked on this component instance; otherwise false.

Returns

Task

A Task representing any asynchronous operation.

Remarks

The OnAfterRender(bool) and 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.

OnFocusChanged(bool)

protected Task OnFocusChanged(bool focus)

Parameters

focus bool

Returns

Task

OnValidationChanged()

protected virtual void OnValidationChanged()

RequiresValidation()

Marks the field as pending validation

public void RequiresValidation()

Remarks

The field will be responsible for calling validation at the correct time in its rendering pipeline

Validate()

public bool Validate()

Returns

bool

ValidateAsync()

public Task<bool> ValidateAsync()

Returns

Task<bool>