For populating the ValueHostsManagerConfig and ValidationManagerConfig's ValueHostsConfig property using the guidance of functions. Otherwise you would have to define Config objects carefully following their syntax.

let builder = new ValueHostsManagerConfigBuilder(createValidationServices());
builder.input('Field1').requireText();

let vm = new ValidationManager(builder);

instead of

let vmConfig: ValidationManagerConfig = {
services: createValidationServices(),
valueHostConfigs: [
{
valueHostType: ValueHostType.Input,
name: 'Field1',
validatorConfigs: [
{
conditionConfig: { conditionType: ConditionType.RequireText }
}
]
}
]
}

let vm = new ValidationManager(vmConfig);

Type Parameters

Hierarchy (view full)

Implements

Constructors

Accessors

  • get baseConfig(): T
  • The initial setup from the constructor and assigned ValueHostConfigs until an OverrideConfig is added. It always retains the official services and callbacks. Merging overrides updates this object.

    Returns T

  • get savedValueHostInstanceStates(): null | ValueHostInstanceState[]
  • The state for each ValueHost. The array may not have the same states for all the ValueHostConfigs you are supplying. It will create defaults for those missing and discard those no longer in use.

    Its up to you to retain stateful information so that the service works statelessly. It will supply you with the changes to states through the OnValueHostInstanceStateChanged property. Whatever it gives you, you supply here to rehydrate the ValueHostsManager with the correct state. You can also supply the state of an individual ValueHost when using the addValueHost or addOrUpdateValueHost methods. If you don't have any state, leave this null or undefined and ValueHostsManager will initialize its state.

    Returns null | ValueHostInstanceState[]

  • set savedValueHostInstanceStates(value): void
  • The state for each ValueHost. The array may not have the same states for all the ValueHostConfigs you are supplying. It will create defaults for those missing and discard those no longer in use.

    Its up to you to retain stateful information so that the service works statelessly. It will supply you with the changes to states through the OnValueHostInstanceStateChanged property. Whatever it gives you, you supply here to rehydrate the ValueHostsManager with the correct state. You can also supply the state of an individual ValueHost when using the addValueHost or addOrUpdateValueHost methods. If you don't have any state, leave this null or undefined and ValueHostsManager will initialize its state.

    Parameters

    Returns void

Methods

  • Fluent format to create any ValueHostConfig based upon ValidatorsValueHostBaseConfig. This is the start of a fluent series. Extend series with validation rules like "required()". Protected because ValueHostManager does not support InputValueHost. ValidationManager offers a public interface.

    Type Parameters

    Parameters

    • valueHostType: string

      the ValueHostType to configure

    • arg1: string | Partial<TVHConfig>

      either the ValueHost name for a multiparameter use or InputValueConfig for a single parameter use.

    • Optional arg2: null | string | Partial<TVHConfig>

      optional and can be null. The value for ValueHost.dataType or InputValueHostConfig.

    • Optional arg3: Partial<TVHConfig>

      optional. Any additional properties of a InputValueHostConfig.

    Returns FluentValidatorBuilder

    FluentValidatorBuilder for chaining validators to initial InputValueHost

  • Combines a condition with a ValidatorConfig's condition using a rule supplied or callback to let you create a conditionConfig.

    The resulting ValidatorConfig's errorCode will not have changed from the original to ensure it aligns with everything depending on the original error code.

    Parameters

    • destinationOfCondition: ValidatorConfig

      the conditionConfig that you want to combine with the new condition.

    • arg2: CombineUsingCondition | ((combiningBuilder, existingConditionConfig) => void)

      Either of these:

      • Use a function to create a conditionConfig that will replace the existing. You are passed the Builder object, where you can build your new conditions, and the existing conditionConfig, which can be added to a Builder object with the conditionConfig() function.
      • a CombineUsingCondition enum value that specifies how to combine the conditions.
    • Optional arg3: ((combiningBuilder) => void)

      create the condition that you want to combine with the existing condition.

    Returns void

  • Updates the conditionConfig property of destinationOfCondition where the replacement is either a conditionConfig or using a Builder object.

    If it finds the validator with the errorcode specified, it will replace the condition with the existing condition. If not, it logs and throws an error. If the ValueHost is on an earlier override or baseConfig, a new entry is made in the current override, reflecting the same data as earlier, but now with a modified validator. If the ValueHost is on the current override, the existing entry is modified.

    The resulting ValidatorConfig's errorCode will not have changed from the original to ensure it aligns with everything depending on the original error code.

    Parameters

    • destinationOfCondition: ValidatorConfig
    • sourceOfConditionConfig: ConditionConfig | ((replacementBuilder) => void)

      Either of these:

      • use a function to create a conditionConfig that will replace the existing. You are passed the builder, where you can build your new conditions.
      • provide a complete ConditionConfig as the replacement

    Returns void

Generated using TypeDoc v0.25.12