Just the data that is used to describe this ValueHost. It should not contain any supporting functions or services. It should be generatable from JSON, and simply gets typed to this or a child implementation.

This provides the business rules and other non-state values for each ValueHost. The server side could in fact supply this object via JSON, allowing the server's Model to dictate this, except values are converted to their native forms like a JSON date is a Date object.

NOTE: extensions of this interface can implement IDisposable knowing that the ValueHost will call dispose() if supplied, during its own disposal.

interface ValueHostConfig {
    valueHostType?: string;
    name: string;
    label?: string;
    labell10n?: null | string;
    initialValue?: any;
    dataType?: string;
    initialEnabled?: boolean;
    enablerConfig?: ConditionConfig;
}

Hierarchy (view full)

Properties

valueHostType?: string

Identifies the type of ValueHost that will be created to support the Config. Can use the enumeration ValueHostType to get these strings. InputValueHost - 'Input' PropertyValueHost - 'Property' StaticValueHost - 'Static' CalcValueHost - 'Calc' If left null, the ValueHostFactory will determine between StaticValueHost and InputValueHost by checking for inclusion of the InputValueHostConfig.validationConfigs property.

name: string

Provides a unique name for this ValueHost, within the scope of one ValueHostsManager instance. Consuming systems use this name to locate the ValueHost for which they will access a Value. Its up to the consuming system to define unique names. A good form is path notation through the module's properties, such as: AddressInfo/StreetName When a property is part of a collection/list, consider:

  • index into the list, a simple number starting at 0. Property1/0, Property1/1
  • Primary key when the children are data elements themselves. Property1/Key=abc123
label?: string

The UI-ready label for this value, to be shown in error messages that have the {Label} token.

labell10n?: null | string

Localization key for Label. Its value will be matched to an entry made to ValidationServices.TextLocalizerService, specific to the active culture. If setup and no entry was found in TextLocalizerService, the value from the errorMessage property is used.

initialValue?: any

Provides an initial value when constructing the instance. Changes to the value should come from setValue(), as they report state changes. Can be undefined/omitted. Note that a value of null or empty string are both considered real values to store. Only undefined means nothing to store.

dataType?: string

A name of a data type used to lookup supporting services specific to the data type. See LookupKey. Some examples: "String", "Number", "Date", "DateTime", "MonthYear". If null, the current value's type (ValueHostInstanceState.Value) is used and must be string, number, boolean, or date.

initialEnabled?: boolean

When defined, it is the initial value for isEnabled(). Its value overridden by calling setEnabled() or using an Enabler condition. It is not used when enablerConfig is defined.

enablerConfig?: ConditionConfig

Provides an automated way to change the value of isEnabled() on the ValueHost. To use, provide a Condition through its ConditionConfig object. When using, the initialEnabled property is ignored. The setEnabled() function will override this when setting it to false, while setting it to true will restore this condition.

Using the Builder API, use builder.enabler('valueHostName', (builder)=> builder.condition(parameters)).

Generated using TypeDoc v0.25.12