Builder specific to ValidationManager. It provides the ability to attach callbacks to the baseConfig.

Hierarchy (view full)

Implements

Constructors

Accessors

  • get notifyValidationStateChangedDelay(): number
  • Provides a debounce delay for onValidationStateChanged notifications. The delay is in milliseconds.

    onValidationStateChanged runs after each valueHost.validate() call, even though onValueHostValidationStateChanged also runs. Some features need to know about the general change to the validation state, not just on the individual field. So they expect onValidationStateChanged to run after valueHost.validate() runs. A call by ValidationManager.validate() will validate a list of valueHosts, and all of them will try to invoke onValidationStateChanged. That's too many in a short period. This debounces them so ValidationManager.validated() generally has one call.

    Leave undefined to use the default of defaultNotifyValidationStateChangedDelay. Set to 0 to disable the debounce.

    Returns number

  • set notifyValidationStateChangedDelay(value): void
  • Provides a debounce delay for onValidationStateChanged notifications. The delay is in milliseconds.

    onValidationStateChanged runs after each valueHost.validate() call, even though onValueHostValidationStateChanged also runs. Some features need to know about the general change to the validation state, not just on the individual field. So they expect onValidationStateChanged to run after valueHost.validate() runs. A call by ValidationManager.validate() will validate a list of valueHosts, and all of them will try to invoke onValidationStateChanged. That's too many in a short period. This debounces them so ValidationManager.validated() generally has one call.

    Leave undefined to use the default of defaultNotifyValidationStateChangedDelay. Set to 0 to disable the debounce.

    Parameters

    • value: number

    Returns void

  • 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

  • get onConfigChanged(): null | ValueHostsManagerConfigChangedHandler
  • Use this when caching the configuration for a later creation of ValueHostsManager.

    Called when the configuration of ValueHosts has been changed, usually through the ValueHostsManagerConfigModifier.apply, or these members of ValueHostsManager: addValueHost, addOrUpdateValueHost, addOrMergeValueHost, discardValueHost. The supplied object is a clone so modifications will not impact the ValueHostsManager.

    Note that where a ValueHostConfig has a property that references a function, you will have to retain that reference in some way to reuse it. In particular, ValidatorConfig.conditionCreator.

    Returns null | ValueHostsManagerConfigChangedHandler

  • set onConfigChanged(value): void
  • Use this when caching the configuration for a later creation of ValueHostsManager.

    Called when the configuration of ValueHosts has been changed, usually through the ValueHostsManagerConfigModifier.apply, or these members of ValueHostsManager: addValueHost, addOrUpdateValueHost, addOrMergeValueHost, discardValueHost. The supplied object is a clone so modifications will not impact the ValueHostsManager.

    Note that where a ValueHostConfig has a property that references a function, you will have to retain that reference in some way to reuse it. In particular, ValidatorConfig.conditionCreator.

    Returns void

Methods

  • When the business logic provides the initial validators, they include error messages designed from the business logic perspective.

    The UI layer can override them in several ways:

    1. Replacing them directly using updateValidator during configuration.
    2. Replacing them directly once ValidationManager exists, using startModifier(). modifier.updateValidator('valuehostname', 'errorcode', { errorMessage: 'replacement'}) or modifier.valueHostType('valuehostname').ruleName(null, 'replacement')
    3. By using those registered with TextLocalizationService. To use them, there should not be any error message already supplied to the validator and business layer messages get in the way.

    This function should be called prior to creating ValidationManager to remove all error messages supplied by business logic, so long as they are covered in TextLocalizationServices. Be sure that TextLocalizationServices is setup as desired before calling this.

    Returns void

  • Replaces the valueHostType property value, from 'Property' to 'Input' (no changes to any other case). This allows business logic to output in its preferred ValueHostType and UI to upscale it to InputValueHost. Only impacts the initial ValueHostConfig, not any overrides.

    Returns boolean

    when true, changes were made

  • If it finds the validator with the errorcode specified, it will combine the condition with the existing condition using a rule supplied or callback to let you create a conditionConfig. If it the validator is not found, it will throw an error and log. 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

    • valueHostName: string
    • errorCode: string
    • builderFn: ((combiningBuilder, existingConditionConfig) => void)

      A function to create a conditionConfig that will replace the existing. You are passed a 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.

      builder.combineWithRule('Field1', 'NotNull', 
      (combiningBuilder, existingConditionConfig)=> {
      combiningBuilder.when(
      (enablerBuilder)=> enablerBuilder.equalToValue('YES', 'Field2'),
      (childBuilder)=> childBuilder.conditionConfig(existingConditionConfig));
      });

    Returns ValidationManagerConfigBuilder

    itself for chaining

  • Uses the combineUsing parameter to determine how to combine the conditions.

    Parameters

    • valueHostName: string
    • errorCode: string
    • combineUsing: CombineUsingCondition
    • builderFn: ((combiningBuilder) => void)

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

      builder.combineWithRule('Field1', 'NotNull', CombineUsingCondition.When, 
      (combiningBuilder)=> combiningBuilder.equalToValue('YES', 'Field2'));

    Returns ValidationManagerConfigBuilder

  • Replace the condition supplying the replacement conditionConfig directly. 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

    • valueHostName: string
    • errorCode: string
    • conditionConfig: ConditionConfig

      provide a complete ConditionConfig as the replacement

    Returns ValidationManagerConfigBuilder

  • Replace supplying the replacement condition through a Builder object.

    Parameters

    • valueHostName: string
    • errorCode: string
    • builderFn: ((replacementBuilder) => void)

      Use a function to create a conditionConfig that will replace the existing. You are passed the builder, where you can build your new conditions.

    Returns ValidationManagerConfigBuilder

    itself for chaining

  • 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