Class FieldSpec
Describes how one edit-form field renders and behaves: its component, label, height and visibility/editability combinators. Paired with a PropertyBinding in a RowSpec and resolved into a FieldModel by the edit components - the edit-view analog of CellSpec. Most fields are the generic FieldSpec<T, U, V>.
public abstract class FieldSpec
- Inheritance
-
FieldSpec
- Derived
-
FieldSpec<T, U, V>
- Inherited Members
Constructors
FieldSpec(string?, string?, int, int?, bool, bool, IEnumerable<IFieldParameter>?)
public FieldSpec(string? label, string? helpText = null, int rows = 1, int? maxlength = null, bool isReadOnly = false, bool isAdminOnly = false, IEnumerable<IFieldParameter>? parameters = null)
Parameters
labelstringhelpTextstringrowsintmaxlengthint?isReadOnlyboolisAdminOnlyboolparametersIEnumerable<IFieldParameter>
Methods
CreateModel(FieldContext, PropertyBinding)
public abstract FieldModel CreateModel(FieldContext context, PropertyBinding binding)
Parameters
contextFieldContextbindingPropertyBinding
Returns
Height(Func<FieldContext, FieldModel, int>)
Set the field height from its FieldContext and resolved FieldModel, so it can depend on chrome state (e.g. low density) or the field's resolved IsReadOnly.
public FieldSpec Height(Func<FieldContext, FieldModel, int> getRows)
Parameters
getRowsFunc<FieldContext, FieldModel, int>
Returns
Height(Func<FieldContext, FieldModel, FieldHeight>)
Set the field height from its FieldContext and resolved FieldModel, so it can depend on chrome state (e.g. low density) or the field's resolved IsReadOnly.
public FieldSpec Height(Func<FieldContext, FieldModel, FieldHeight> getRows)
Parameters
getRowsFunc<FieldContext, FieldModel, FieldHeight>
Returns
Height(Func<IServices, int>)
public FieldSpec Height(Func<IServices, int> getRows)
Parameters
Returns
Height(Func<IServices, IEntity, int>)
public FieldSpec Height(Func<IServices, IEntity, int> getRows)
Parameters
Returns
Height(Func<IServices, IEntity, FieldHeight>)
public FieldSpec Height(Func<IServices, IEntity, FieldHeight> getRows)
Parameters
getRowsFunc<IServices, IEntity, FieldHeight>
Returns
Height(Func<IServices, FieldHeight>)
public FieldSpec Height(Func<IServices, FieldHeight> getRows)
Parameters
getRowsFunc<IServices, FieldHeight>
Returns
Height(int)
public FieldSpec Height(int rows)
Parameters
rowsint
Returns
Height(FieldHeight)
public FieldSpec Height(FieldHeight height)
Parameters
heightFieldHeight
Returns
Height<T>(Func<IServices, T, int>)
public FieldSpec Height<T>(Func<IServices, T, int> getRows) where T : IEntity
Parameters
Returns
Type Parameters
T
Height<T>(Func<IServices, T, FieldHeight>)
public FieldSpec Height<T>(Func<IServices, T, FieldHeight> getRows) where T : IEntity
Parameters
getRowsFunc<IServices, T, FieldHeight>
Returns
Type Parameters
T
Hidden()
public FieldSpec Hidden()
Returns
HiddenIf(Func<FieldContext, bool>)
public FieldSpec HiddenIf(Func<FieldContext, bool> predicate)
Parameters
predicateFunc<FieldContext, bool>
Returns
HiddenIf(Func<IServices, IEntity, bool>)
public FieldSpec HiddenIf(Func<IServices, IEntity, bool> predicate)
Parameters
Returns
HiddenIf<T>(Func<IServices, T, bool>)
public FieldSpec HiddenIf<T>(Func<IServices, T, bool> predicate) where T : IEntity
Parameters
Returns
Type Parameters
T
ReadOnly()
public FieldSpec ReadOnly()
Returns
ReadOnlyIf(Func<FieldContext, bool>)
public FieldSpec ReadOnlyIf(Func<FieldContext, bool> predicate)
Parameters
predicateFunc<FieldContext, bool>
Returns
ReadOnlyIf(Func<IServices, IEntity, bool>)
public FieldSpec ReadOnlyIf(Func<IServices, IEntity, bool> predicate)
Parameters
Returns
ReadOnlyIf<T>(Func<IServices, T, bool>)
public FieldSpec ReadOnlyIf<T>(Func<IServices, T, bool> predicate) where T : IEntity
Parameters
Returns
Type Parameters
T
ReadWrite()
public FieldSpec ReadWrite()
Returns
ReadWriteIf(Func<FieldContext, bool>)
public FieldSpec ReadWriteIf(Func<FieldContext, bool> predicate)
Parameters
predicateFunc<FieldContext, bool>
Returns
ReadWriteIf(Func<IServices, IEntity, bool>)
public FieldSpec ReadWriteIf(Func<IServices, IEntity, bool> predicate)
Parameters
Returns
ReadWriteIf<T>(Func<IServices, T, bool>)
public FieldSpec ReadWriteIf<T>(Func<IServices, T, bool> predicate) where T : IEntity
Parameters
Returns
Type Parameters
T
Rename()
Removes the label from a field, making it nameless and full-width
public FieldSpec Rename()
Returns
Rename(Func<IServices, string?>)
Sets the label for a field
public FieldSpec Rename(Func<IServices, string?> getLabel)
Parameters
Returns
Rename(Func<IServices, IEntity, string?>)
Sets the label for a field at runtime based on entity data
public FieldSpec Rename(Func<IServices, IEntity, string?> getLabel)
Parameters
Returns
Rename(string?)
Sets the label for a field
public FieldSpec Rename(string? label)
Parameters
labelstring
Returns
Rename<T>(Func<IServices, T, string?>)
Sets the label for a field at runtime based on entity data
public FieldSpec Rename<T>(Func<IServices, T, string?> getLabel) where T : IEntity
Parameters
Returns
Type Parameters
T
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Visible()
public FieldSpec Visible()
Returns
VisibleIf(Func<FieldContext, bool>)
public FieldSpec VisibleIf(Func<FieldContext, bool> predicate)
Parameters
predicateFunc<FieldContext, bool>
Returns
VisibleIf(Func<IServices, IEntity, bool>)
public FieldSpec VisibleIf(Func<IServices, IEntity, bool> predicate)
Parameters
Returns
VisibleIf<T>(Func<IServices, T, bool>)
public FieldSpec VisibleIf<T>(Func<IServices, T, bool> predicate) where T : IEntity
Parameters
Returns
Type Parameters
T
WithHelpText(string)
public FieldSpec WithHelpText(string helpText)
Parameters
helpTextstring
Returns
WithLabelComponent<TFieldLabel>()
public FieldSpec WithLabelComponent<TFieldLabel>() where TFieldLabel : FieldLabel
Returns
Type Parameters
TFieldLabel
WithMaxLength(int)
public FieldSpec WithMaxLength(int maxLength)
Parameters
maxLengthint
Returns
WithParameters(params IFieldParameter[])
public FieldSpec WithParameters(params IFieldParameter[] parameters)
Parameters
parametersIFieldParameter[]
Returns
WithRowOrDefault<T>(Func<IServices, IEntity, T>, FieldContext, T)
protected static T WithRowOrDefault<T>(Func<IServices, IEntity, T> f, FieldContext ctx, T fallback)
Parameters
fFunc<IServices, IEntity, T>ctxFieldContextfallbackT
Returns
- T
Type Parameters
T
WithRowOrDefault<T, U>(Func<IServices, U, T>, FieldContext, T)
protected static T WithRowOrDefault<T, U>(Func<IServices, U, T> f, FieldContext ctx, T fallback)
Parameters
fFunc<IServices, U, T>ctxFieldContextfallbackT
Returns
- T
Type Parameters
TU