Type alias EntityEditModel<Entity, LoadInput, SaveOutput, ValidationFailedType, LoadError, ValidationError, SaveError>

EntityEditModel<Entity, LoadInput, SaveOutput, ValidationFailedType, LoadError, ValidationError, SaveError>: {
    changed: boolean;
    disabled: boolean;
    edit: ValidatedInputWithResult<ModelWithDefault<Entity>, ModelValidationResult<Entity, ValidationFailedType>, SaveOutput, ValidationError, SaveError>;
    entity: Entity;
    load: CombinedEffectResult<LoadInput | null, Entity, LoadError>;
    loading: boolean;
    validation: ModelValidationResult<Entity, ValidationFailedType> | NoValueType;
}

Value-type for the derived model behavior produced by EntityEditFactory Signals.

Type Parameters

  • Entity

    specifies the entity type

  • LoadInput = number

    specifies the input-type for the loading-effect will be LoadInput | null (defaults to number)

  • SaveOutput = LoadInput

    specifies the output-type for the save-effect (defaults to LoadInput)

  • ValidationFailedType = string

    specifies the type representing a failed validations (total or for a distinct property, hence ModelValidationResult<Entity, ValidationFailedType> will be used as validation result)

  • LoadError = string

    specifies the error type of the load-effect

  • ValidationError = string

    specifies the error type of the validation-effect (use never, if your validation cannot error)

  • SaveError = string

    specifies the error type of the result-effect

Type declaration

  • changed: boolean

    true, if the entity does not equal the default entity, with respect to configured equals function (defaults to shallowEquals).

  • disabled: boolean

    true, if either: the load effect is pending, or the result effect is pending, or the validation effect is pending, or edit.isValid is false (the current validation result represents invalid entity state, or the validation errored), or the result-input equals the current-input

  • edit: ValidatedInputWithResult<ModelWithDefault<Entity>, ModelValidationResult<Entity, ValidationFailedType>, SaveOutput, ValidationError, SaveError>

    The ValidatedInputWithResult for validation and result effects

  • entity: Entity

    The current Entity state (matching edit.currentInput.model) If you need to compare with the current default, use edit.currentInput instead.

  • load: CombinedEffectResult<LoadInput | null, Entity, LoadError>

    The CombinedEffectResult for the load effect

  • loading: boolean

    true, if either: the load effect is pending, or the result effect is pending

  • validation: ModelValidationResult<Entity, ValidationFailedType> | NoValueType

    Current ModelValidationResult for entity. If entity === edit.validatedInput.model and isNotEffectError(edit.validationResult) this matches edit.validationResult, else it's NO_VALUE.

Generated using TypeDoc