Class RelatedEntityDisplayComponentGeneratorBaseAbstract

Abstract base class responsible for generating Angular template code for related entity display components. Each subclass handles a specific type of related entity display (e.g., UserViewGrid, JoinGrid, Timeline).

The generated templates are injected into Angular forms that extend BaseFormComponent, so all BaseFormComponent methods and properties are available in the generated templates:

Commonly used BaseFormComponent methods/properties:

  • BuildRelationshipViewParamsByEntityName() - Creates view parameters for related entities
  • NewRecordValues() - Provides default values for new related records
  • IsCurrentTab() - Checks if the current tab is active (useful for deferred loading)
  • GridEditMode() - Determines if grids should be in edit mode
  • GridBottomMargin() - Provides consistent bottom margin for grids

Implementation Pattern:

  1. Extend this class
  2. Register with @RegisterClass(RelatedEntityDisplayComponentGeneratorBase, "YourComponentName")
  3. Implement all abstract methods
  4. Define a configuration class extending ComponentConfigBase
  5. Generate appropriate Angular templates in the Generate() method

See

BaseFormComponent

Hierarchy (view full)

Constructors

Properties

_componentInstanceMap: Map<string, RelatedEntityDisplayComponentGeneratorBase> = ...

Internal cache map storing component instances by their key/name to avoid recreating the same component multiple times during code generation

Accessors

Methods

  • Generates the Angular template code for the related entity display component. This is the core method that each subclass must implement to create the appropriate Angular template based on the entity relationship and configuration.

    Parameters

    • input: GenerationInput

      Contains the entity, relationship info, and tab context needed for generation

    Returns Promise<GenerationResult>

    Promise resolving to the generation result with template and optional code

  • Helper method that returns the EntityFieldInfo object for the foreign key field in the specified entity that links to the related entity. Provides full field metadata.

    Parameters

    • entityName: string

      The name of the entity containing the foreign key

    • relatedEntityName: string

      The name of the entity being referenced

    Returns EntityFieldInfo

    The EntityFieldInfo object for the foreign key field

    Throws

    Error if the entity or foreign key field cannot be found

  • Helper method that returns the name of the foreign key field in the specified entity that links to the related entity. Useful for building relationship queries and joins.

    Parameters

    • entityName: string

      The name of the entity containing the foreign key

    • relatedEntityName: string

      The name of the entity being referenced

    Returns string

    The name of the foreign key field

    Throws

    Error if the foreign key field cannot be found

  • Factory method that dynamically instantiates the correct RelatedEntityDisplayComponentGeneratorBase subclass based on the relationship configuration. Uses the MemberJunction class factory to resolve and create the appropriate component generator.

    Parameters

    • relationshipInfo: EntityRelationshipInfo

      The relationship metadata containing display component configuration

    • contextUser: UserInfo

      User context for database interactions and permission checking

    • Rest ...params: any[]

      Additional parameters passed to the component constructor

    Returns Promise<RelatedEntityDisplayComponentGeneratorBase>

    Promise resolving to the appropriate component generator instance

    Throws

    Error if the specified display component cannot be found or instantiated