Member Junction
    Preparing search index...

    Configures a data source for the timeline component.

    TimelineGroup defines how records are loaded, which fields to display, and how they should be styled. Multiple groups can be used to display different types of events on the same timeline.

    interface MyEvent {
    id: string;
    title: string;
    eventDate: Date;
    description: string;
    }

    const group = new TimelineGroup<MyEvent>();
    group.DataSourceType = 'array';
    group.EntityObjects = myEventsArray;
    group.TitleFieldName = 'title';
    group.DateFieldName = 'eventDate';
    group.DescriptionFieldName = 'description';
    import { MJTaskEntity } from '@memberjunction/core-entities';

    const group = new TimelineGroup<MJTaskEntity>();
    group.EntityName = 'Tasks';
    group.DataSourceType = 'entity';
    group.Filter = "Status = 'Open'";
    group.TitleFieldName = 'Name';
    group.DateFieldName = 'DueDate';
    const group = new TimelineGroup<MJTaskEntity>();
    group.EntityName = 'Tasks';
    group.TitleFieldName = 'Name';
    group.DateFieldName = 'CompletedAt';
    group.SubtitleFieldName = 'Category';
    group.DescriptionFieldName = 'Description';
    group.DisplayIcon = 'fa-solid fa-check-circle';
    group.DisplayColor = '#4caf50';
    group.GroupLabel = 'Completed Tasks';

    group.CardConfig = {
    collapsible: true,
    defaultExpanded: false,
    summaryFields: [
    { fieldName: 'AssignedTo', label: 'Assignee', icon: 'fa-solid fa-user' },
    { fieldName: 'Priority', icon: 'fa-solid fa-flag' }
    ],
    actions: [
    { id: 'view', label: 'View', variant: 'primary' },
    { id: 'edit', label: 'Edit', variant: 'secondary' }
    ]
    };

    group.EventConfigFunction = (task) => ({
    icon: task.Priority === 'High' ? 'fa-solid fa-exclamation' : undefined,
    color: task.Status === 'Overdue' ? '#f44336' : undefined
    });

    Type Parameters

    • T = any

      The type of the source records. Defaults to any for maximum flexibility. MemberJunction users can specify BaseEntity subclasses for full type safety.

    Index

    Constructors

    • Type Parameters

      • T = any

        The type of the source records. Defaults to any for maximum flexibility. MemberJunction users can specify BaseEntity subclasses for full type safety.

      Returns TimelineGroup<T>

    Properties

    CardConfig?: TimelineCardConfig

    Card display configuration for this group. Defines how event cards are rendered. If not set, uses the component's defaultCardConfig.

    DataSourceType: "array" | "entity" = 'entity'

    How data is provided to the timeline.

    • 'array': Data is provided via the EntityObjects array (works with any object type)
    • 'entity': Data is loaded using MemberJunction's RunView (requires MJ core)
    'entity'
    
    DateFieldName: string

    Field name for the event date. Used for chronological ordering and date display.

    DescriptionFieldName?: string

    Field name for the description/body text. Displayed in the card body when expanded.

    DisplayColor?: string

    Custom color for this group's markers and accents. Only used when DisplayColorMode is 'manual'. Any valid CSS color value.

    '#4caf50', 'rgb(66, 135, 245)', 'var(--primary-color)'
    
    DisplayColorMode: "auto" | "manual" = 'auto'

    Color assignment mode.

    • 'auto': System assigns colors based on group index
    • 'manual': Uses the color specified in DisplayColor
    'auto'
    
    DisplayIcon?: string

    Custom icon class (Font Awesome). Only used when DisplayIconMode is 'custom'.

    'fa-solid fa-check', 'fa-regular fa-calendar'
    
    DisplayIconMode: "standard" | "custom" = 'standard'

    Icon display mode.

    • 'standard': Uses a default icon based on the group index
    • 'custom': Uses the icon specified in DisplayIcon
    'standard'
    
    EntityName?: string

    The MemberJunction entity name for this group. Required when DataSourceType is 'entity'.

    'Tasks', 'MJ: AI Agents', 'Users'
    
    EntityObjects: T[] = []

    Pre-loaded data array. Used when DataSourceType is 'array', or populated after loading when using 'entity'.

    EventConfigFunction?: (record: T) => TimelineEventConfig

    Custom function to configure individual events. Allows per-event customization of icons, colors, and actions.

    Type Declaration

    group.EventConfigFunction = (task) => ({
    icon: task.Priority === 'High' ? 'fa-solid fa-exclamation' : undefined,
    color: task.IsOverdue ? '#f44336' : undefined,
    actions: task.CanEdit ? [{ id: 'edit', label: 'Edit' }] : []
    });
    Filter?: string

    SQL WHERE clause filter for entity queries. Only used when DataSourceType is 'entity'.

    "Status = 'Open' AND Priority = 'High'"
    
    GroupLabel?: string

    Human-readable label for this group. Used in legends, headers, or when distinguishing multiple groups.

    'Completed Tasks', 'System Events', 'User Activities'
    
    IdFieldName?: string

    Field name for the unique record ID. Defaults to 'ID' or 'id' if not specified.

    ImageFieldName?: string

    Field name containing an image URL. When set, displays an image in the card.

    MaxRecords?: number

    Maximum number of records to load per batch. Used for virtual scrolling.

    undefined (uses component's virtualScroll.batchSize)
    
    OrderBy?: string

    SQL ORDER BY clause for entity queries. Only used when DataSourceType is 'entity'.

    'CreatedAt DESC', 'Priority ASC, DueDate DESC'
    
    SubtitleFieldName?: string

    Field name for the subtitle. Displayed below the title in smaller text.

    SummaryFunction?: (record: T) => string

    Custom function to generate the event summary/description. Takes precedence over DescriptionFieldName.

    Type Declaration

      • (record: T): string
      • Parameters

        • record: T

          The source record

        Returns string

        HTML string or plain text to display

    group.SummaryFunction = (task) => {
    return `<strong>${task.Status}</strong>: ${task.Description}`;
    };
    TitleFieldName: string

    Field name for the event title. This is the primary text displayed on each timeline card.

    Methods

    • Gets the date from a record.

      Parameters

      • record: T

        The source record

      Returns Date

      The date object

    • Gets the description from a record.

      Parameters

      • record: T

        The source record

      Returns string | undefined

      The description string, or undefined

    • Gets the ID of a record in this group.

      Parameters

      • record: T

        The source record

      Returns string

      The record ID

    • Gets the image URL from a record.

      Parameters

      • record: T

        The source record

      Returns string | undefined

      The image URL, or undefined

    • Gets the subtitle from a record.

      Parameters

      • record: T

        The source record

      Returns string | undefined

      The subtitle string, or undefined

    • Gets the title from a record.

      Parameters

      • record: T

        The source record

      Returns string

      The title string

    • Extracts a field value from a record in this group.

      Parameters

      • record: T

        The source record

      • fieldName: string

        The field name to extract

      Returns unknown

      The field value

    • Creates a TimelineGroup from a plain array of objects.

      This is a convenience method that sets up the group for array-based data.

      Type Parameters

      • T = any

      Parameters

      • data: T[]

        Array of objects to display

      • config: {
            color?: string;
            dateField: string;
            descriptionField?: string;
            groupLabel?: string;
            icon?: string;
            idField?: string;
            imageField?: string;
            subtitleField?: string;
            titleField: string;
        }

        Configuration for field mappings

      Returns TimelineGroup<T>

      A configured TimelineGroup

      const group = TimelineGroup.FromArray(myEvents, {
      titleField: 'name',
      dateField: 'eventDate',
      descriptionField: 'details'
      });
    • Creates a TimelineGroup from MemberJunction RunViewParams.

      This is a convenience method for MemberJunction applications. It loads data immediately and returns a configured group.

      Note: This method requires @memberjunction/core to be available. It will throw an error if used in non-MJ applications.

      Type Parameters

      • T = any

      Parameters

      • params: {
            EntityName?: string;
            ExtraFilter?: string;
            MaxRows?: number;
            OrderBy?: string;
            [key: string]: unknown;
        }

        RunView parameters for loading data

      Returns Promise<TimelineGroup<T>>

      A configured TimelineGroup with loaded data

      const group = await TimelineGroup.FromView<MJTaskEntity>({
      EntityName: 'Tasks',
      ExtraFilter: "Status = 'Open'",
      OrderBy: 'DueDate DESC'
      });
      group.TitleFieldName = 'Name';
      group.DateFieldName = 'DueDate';