Options which configure the behavior of the field
Optionalcontext: DataFieldContext = {}Additional context which describes the field
InternalnameThe field name of this DataField instance. This is assigned by SchemaField#initialize.
The initially provided options which configure the data field
InternalparentA reference to the parent schema to which this DataField belongs. This is assigned by SchemaField#initialize.
Is a value of this field written to source data? A Non-persisted value is initialized (with its initial value), and ActiveEffects can use the field for change application.
StatichierarchicalWhether this field defines part of a Document/Embedded Document hierarchy.
StaticrecursiveDoes this field type contain other fields in a recursive structure? Examples of recursive fields are SchemaField, ArrayField, or TypeDataField Examples of non-recursive fields are StringField, NumberField, or ObjectField
A dot-separated string representation of the field path within the parent schema.
Static_Default parameters for this field type
StatichasDoes this form field class have defined form support?
Cast a change delta into an appropriate type to be applied to this field.
The change delta.
Data used to resolve "@" expressions.
InternalCommit a prepared update to DataModel#_source.
The parent source object within which the key field exists
The named field in source to commit
The new value of the field which should be committed to source
The reported change to the field
Options which modify how this update workflow is performed.
InternalUpdate the source data for a DataModel which includes this DataField. Updates are performed depth-first; validated and recorded from leaf-nodes upwards.
This method is responsible for preparing and validating the requested update.
If the update is valid, it is responsible for updating the pending source copy and recording the diff.
If the update is invalid it must avoid recording a diff or staging an update to the source copy.
If validation fails, this workflow may optionally permit fallback to a valid initial value.
a partial node of source data, relative to which this field belongs.
The name of this field within the context of the source data.
The candidate value that should be applied as an update.
Options which modify how this update workflow is performed.
Stateful data that is transacted throughout the model hierarchy during an update operation.
InternalCertain fields may declare joint data validation criteria. This method will only be called if the field is designated as recursive. This method should throw if any validation error occurred, even if resolved by fallback or dropping.
Candidate data for joint model validation
Options which modify joint model validation
Apply a function to this DataField which propagates through recursively to any contained data schema.
The function to apply
The current value of this field
Optionaloptions: object = {}Additional options passed to the applied function
The results object
Apply an ActiveEffectChange to this field.
The field's current value.
The model instance.
The change to apply.
Additional options to configure the change application.
OptionalreplacementData?: Record<string, unknown>Data used to resolve "@" expressions.
The updated value.
Preprocess and clean source data to ensure that it conforms to the correct data type for this field and is ready to be used by data model construction or update operations. Data cleaning is synchronous and automatically applied as the first step of construction and update operations.
An initial requested value
Optionaloptions: Readonly<DataModelCleaningOptions> = {}Additional options for how the field is cleaned
Optional_state: data.types.DataModelUpdateState = {}Internal state variables which are used during recursion
The cleaned value
Attempt to retrieve a valid initial value for the DataField.
Model source data object within which an initial value is required for this field
A proposed initial value
Initialize the original source data into a mutable copy for the DataModel instance.
The source value of the field
The DataModel instance that this field belongs to
Optionaloptions: object = {}Initialization options
An initialized copy of the source data
Render this DataField as a standardized form-group element.
Configuration options passed to the wrapping form-group
Input element configuration options passed to DataField#toInput
The rendered form group element
Render this DataField as an HTML element.
Form element configuration parameters
A rendered HTMLElement for the field
Export the current value of the field into a serializable object.
The initialized value of the field
An exported representation of the field
Validate candidate input for this field, ensuring it meets the field requirements.
This public method validates recursively, testing both the immediate value of this field as well as the validity of any child values for fields with hierarchical data types.
The candidate value to validate
Optionaloptions: DataFieldValidationOptions = {}Options which affect validation behavior
A failure that occurred if validation is non-strict. The failure may have been resolved by fallback or dropping invalid elements.
Iterate over validation functions applied to this field. Validation happens in a depth-first way, for example consider an outerSchema with an innerField:
Protected_ProtectedApply an "add" change to this field.
The field's current value.
The change delta.
The model instance.
The original change data.
The updated value.
Protected_ProtectedApply a custom change to this field.
The field's current value.
The change delta.
The model instance.
The original change data.
The updated value.
Protected_ProtectedApply an "override" change to this field.
The field's current value.
The change delta.
The model instance.
The original change data.
The updated value.
Protected_ProtectedRecursively traverse a schema and retrieve a field specification by a given path/key
The field path or property key if source is passed as an array of strings
(in reverse order)
Optionaloptions: { source?: object; type?: object } = {}Additional options
Optionalsource?: objectThe source data of the field
Optionaltype?: objectThe Document type of the parent field
The corresponding DataField definition for that field, or undefined
Protected_ProtectedMigrate this field's candidate source data. This workflow occurs as a component step of DataField#clean.
Candidate source value for the field
Optionaloptions: Readonly<DataModelCleaningOptions>Options for how the field is cleaned
Optional_state: data.types.DataModelUpdateStateInternal state variables transacted during cleaning recursion.
A migrated value suitable for cleaning
Protected_ProtectedRecursively replace data references in a string change value.
An object providing replacements
Optionaloptions: { strict?: boolean } = {}Additional options to configure the data replacement
Optionalstrict?: booleanThrow an Error if data replacement fails
The expression with data references resolved
Protected_ProtectedFor fields which have hierarchical data structures, define how their inner fields should be validated. This method is called after _validateSpecial and _validateType. It can be assumed that those tests passed. This method should throw if any validation error occurred, even if resolved by fallback or dropping.
The candidate value
Optionaloptions: DataFieldValidationOptionsOptions which affect validation behavior
A boolean to indicate with certainty whether the value is valid
Protected_ProtectedSpecial validation rules which supersede regular field validation. This validator screens for certain values which are otherwise incompatible with this field like null or undefined.
The candidate value
A boolean to indicate with certainty whether the value is valid
A special foundry.data.fields.NumberField represents a number between 0 and 1.