Options
All
  • Public
  • Public/Protected
  • All
Menu

An instance of an Event on a given day of a Calendar generated by the event's Schedule.

Type parameters

  • T

    The type of data stored in the Event class.

  • M

    The type of metadata stored in the schedule and in this class.

Hierarchy

  • CalendarEvent

Index

Constructors

constructor

  • Creates a new event instance given the id, the event paired with the schedule, the schedule, the time span of the event, and the day on the calendar the event belongs to.

    Parameters

    • id: number

      The relatively unique identifier of this event.

    • event: Event<T, M>

      The event which created this instance.

    • time: DaySpan

      The time span of this event.

    • actualDay: Day

      The day on the calendar this event is for.

    Returns CalendarEvent

Properties

cancelled

cancelled: boolean

Whether this event instance was marked as cancelled in the schedule.

col

col: number = 0

The column this event is on in a visual calendar. An event can have its time overlap with another event displaying one of the events in another column. This is only set when Calendar.updateColumns is true or manually set. This value makes sense for visual calendars that are displaying event occurrences at specific times positioned accordingly.

day

day: Day

The day this event occurs on.

ending

ending: boolean

Whether this event is the last day of an occurrence. A calendar can generate multiple CalendarEvent instances over each day it covers if Calendar.repeatCovers is true. These instances have matching CalendarEvent.id values.

event

event: Event<T, M>

The event with the schedule.

fullDay

fullDay: boolean

Whether this event is an all day event.

see

Schedule.isFullDay

id

id: number

The relatively unique identifier of this event. It is generated based on the index of the schedule in the calendar and the time of day listed in the schedule. This number will no longer be unique if the schedule has more than Constants.MAX_EVENTS_PER_DAY occurrences in a single day (based on number of times in Schedule.times).

meta

meta: M

Any metadata specified for this event instance in the schedule.

row

row: number = 0

The row this event is on in a visual calendar. An event can span multiple days and it is desirable to have the occurrence on each day to line up. This is only set when Calendar.updateRows is true or manually set. This value makes sense for visual calendars for all day events or when the visual calendar is not positioning events based on their time span.

starting

starting: boolean

Whether this event is the first day of an occurrence. A calendar can generate multiple CalendarEvent instances over each day it covers if Calendar.repeatCovers is true. These instances have matching CalendarEvent.id values.

time

time: DaySpan

The span of time this event occurs. If this is an all day event this span will start at the beginning of the day and end at the beginning of the next day.

see

Schedule.isFullDay

Accessors

data

data:

The related event data.

end

end:

The end timestamp of the event.

endDelta

endDelta:

Returns a delta value between 0 and 1 which represents where the CalendarEvent.end is relative to CalendarEvent.day. The delta value would be greater than 1 if the end of the event is after CalendarEvent.day.

identifier

identifier:

An IdentifierInput for the start of this event.

identifierType

identifierType:

The Identifier for this event. Either Identifier.Day or Identifier.Time.

schedule

schedule:

The schedule which generated this event.

scheduleId

scheduleId:

The id of the schedule uniqe within the calendar which generated this event.

start

start:

The start timestamp of the event.

startDelta

startDelta:

Returns a delta value between 0 and 1 which represents where the CalendarEvent.start is relative to CalendarEvent.day. The delta value would be less than 0 if the start of the event is before CalendarEvent.day.

Methods

cancel

  • cancel(cancelled?: boolean): this
  • Changes the cancellation status of this event. By default this cancels this event - but false may be passed to undo a cancellation.

    Parameters

    • Default value cancelled: boolean = true

      Whether the event should be cancelled.

    Returns this

exclude

  • exclude(excluded?: boolean): this
  • Changes the exclusion status of this event. By default this excludes this event - but false may be passed to undo an exclusion.

    Parameters

    • Default value excluded: boolean = true

      Whether the event should be excluded.

    Returns this

getTimeBounds

  • getTimeBounds(dayHeight?: number, dayWidth?: number, columnOffset?: number, clip?: boolean, offsetX?: number, offsetY?: number): DaySpanBounds
  • Calculates the bounds for this event if it were placed in a rectangle which represents a day (24 hour period). By default the returned values are between 0 and 1 and can be scaled by the proper rectangle dimensions or the rectangle dimensions can be passed to this function.

    Parameters

    • Default value dayHeight: number = 1

      The height of the rectangle of the day.

    • Default value dayWidth: number = 1

      The width of the rectangle of the day.

    • Default value columnOffset: number = 0.1

      The offset in the rectangle of the day to adjust this event by if it intersects or is contained in a previous event. This also reduces the width of the returned bounds to keep the bounds in the rectangle of the day.

    • Default value clip: boolean = true

      true if the bounds should stay in the day rectangle, false and the bounds may go outside the rectangle of the day for multi-day events.

    • Default value offsetX: number = 0

      How much to translate the left & right properties by.

    • Default value offsetY: number = 0

      How much to translate the top & bottom properties by.

    Returns DaySpanBounds

    The calculated bounds for this event.

move

  • move(toTime: Day): boolean
  • Moves this event to potentially another day and time. A move is accomplished by excluding the current event and adding an inclusion of the new day & time. Any CalendarEvent.meta on this event will be moved to the new event. If the schedule represents a single event (Schedule.isSingleEvent) then the schedule frequencies are updated to match the timestamp provided.

    Parameters

    • toTime: Day

      The timestamp to move this event to.

    Returns boolean

    Whether the event was moved to the given time.

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc