Options
All
  • Public
  • Public/Protected
  • All
Menu

A collection of CalendarDays, the events on the calendar, and all CalendarEvents generated based on the events.

Type parameters

  • T

    The type of data stored in the Event class.

  • M

    The type of metadata stored in the schedule.

Hierarchy

  • Calendar

Index

Constructors

constructor

Properties

days

days: CalendarDay<T, M>[] = []

The array of days in this calendar and their events.

eventSorter

eventSorter: SortEvent<T, M> = null

The function (if any) which sorts the events on a calendar day.

events

events: Event<T, M>[] = []

The array of scheduled events added to the calendar.

eventsOutside

eventsOutside: boolean = false

When true events will be added to days "outside" the calendar. Days outside the calendar are days filled in when Calendar.fill is true. More specifically days that are in Calendar.filled and not in Calendar.span.

fill

fill: boolean = false

If the calendar should be filled in so the first day of the calendar is Sunday and the last day is Saturday.

filled

filled: DaySpan

The full span of days represented on the calendar. This may be different than the Calendar.span when Calendar.fill is true and the calendar is representing months or years and the days need to start on Sunday and end on Saturday.

length

length: number

The number of days in the calendar specified by Calendar.span.

listTimes

listTimes: boolean = false

When true an event instance will be created for each time specified on the schedule. If the schedule specifies an all day event then only one event is added to a day. This is typically done when displaying days or weeks and events can be displayed on a timeline.

minimumSize

minimumSize: number = 0

The minimum number of days in the calendar no matter what the type or size is. This can be used to display a month with a constant number of weeks - because not all months contain the same number of weeks.

moveEnd

moveEnd: CalendarMover

The function used to move the end day of the calendar when functions like Calendar.next or Calendar.prev are called.

moveStart

moveStart: CalendarMover

The function used to move the start day of the calendar when functions like Calendar.next or Calendar.prev are called.

parseData

parseData: function = (x => x)

A function to use when parsing meta input into the desired type.

param

The input to parse.

returns

The meta parsed from the given input, if any.

Type declaration

    • (input: any): T
    • Parameters

      • input: any

      Returns T

parseMeta

parseMeta: function = (x => x)

A function to use when parsing meta input into the desired type.

param

The input to parse.

returns

The meta parsed from the given input, if any.

Type declaration

    • (input: any): M
    • Parameters

      • input: any

      Returns M

repeatCovers

repeatCovers: boolean = true

When true a CalendarEvent instance exists on each CalendarDay the event covers even if the event didn't start on that day.

selection

selection: DaySpan = null

A selection of days on the calendar. If no days are selected this is null. This is merely used to keep the selection flags in CalendarDay updated via Calendar.refreshSelection.

size

size: number

The size of the calendar. When the calendar type is...

span

span: DaySpan

The span of days in the calendar.

type

type: Units

The type of calendar.

updateColumns

updateColumns: boolean = false

When true CalendarEvent.col will be set so when visually displaying the event based on start and end time any events that overlap with each other will be "indented" to see the event below it.

updateRows

updateRows: boolean = false

When true CalendarEvent.row will be set so when visually displaying the event with others multi-day events will align and not overlap.

visible

visible: Event<T, M>[] = []

The array of visible events on the calendar. This is built based on the span of the schedule in the given event and also the Event.visible flag.

Static DEFAULT_FOCUS

DEFAULT_FOCUS: 0.4999 = 0.4999

Accessors

end

end:

Returns the end day of the calendar. If this calendar is filled, this may not represent the very last day in the calendar.

start

start:

Returns the start day of the calendar. If this calendar is filled, this may not represent the very first day in the calendar.

Methods

addEvent

  • addEvent(event: EventInput<T, M>, allowDuplicates?: boolean, delayRefresh?: boolean): this
  • Adds the given event to this calendar if it doesn't exist already (or allowDuplicates is true).

    see

    Calendar.refreshEvents

    Parameters

    • event: EventInput<T, M>

      The event to add to the calendar.

    • Default value allowDuplicates: boolean = false

      If an event can be added more than once.

    • Default value delayRefresh: boolean = false

      When true the Calendar.refreshEvents will not be called after the event is added.

    Returns this

addEvents

  • addEvents(events: EventInput<T, M>[], allowDuplicates?: boolean, delayRefresh?: boolean): this
  • Adds the given events to this calendar if they don't exist already (or allowDuplicates is true).

    see

    Calendar.refreshEvents

    Parameters

    • events: EventInput<T, M>[]

      The events to add to the calendar.

    • Default value allowDuplicates: boolean = false

      If an event can be added more than once.

    • Default value delayRefresh: boolean = false

      When true the Calendar.refreshEvents will not be called after the events are added.

    Returns this

eventsForDay

  • Returns the events for the given day optionally looking at schedule times, optionally looking at events which cover multiple days, and optionally sorted with the given function.

    Parameters

    • day: Day

      The day to find events for.

    • Default value getTimes: boolean = true

      When true an event is added to the result for each time specified in the schedule.

    • Default value covers: boolean = true

      When true events which don't start on the given day but do overlap are added to the result.

    • Default value sorter: SortEvent<T, M> = this.eventSorter

      The function to sort the events by, if any.

    Returns CalendarEvent<T, M>[]

    An array of events that occurred on the given day.

findEvent

  • findEvent(id: any): Event<T, M>
  • Finds the event given one of the ways to identify the event.

    Parameters

    • id: any

    Returns Event<T, M>

    The refrence to the event or null if not found.

getDay

  • Gets the calendar day for the given day.

    Parameters

    • input: DayInput

      The day to get the calendar day for.

    Returns CalendarDay<T, M>

    The reference to the calendar day, or null if the given input is not on this calendar.

iterateDays

move

  • move(jump?: number, delayRefresh?: boolean): this
  • Shifts the calendar days by the given amount.

    Parameters

    • Default value jump: number = this.size

      The amount to shift the calendar by.

    • Default value delayRefresh: boolean = false

      When true Calendar.refresh will not be called after calendar is moved.

    Returns this

next

  • next(jump?: number, delayRefresh?: boolean): this
  • Moves the calenndar to the next set of days.

    Parameters

    • Default value jump: number = this.size

      The amount to shift the calendar by.

    • Default value delayRefresh: boolean = false

      When true Calendar.refresh will not be called after calendar is moved.

    Returns this

prev

  • prev(jump?: number, delayRefresh?: boolean): this
  • Moves the calenndar to the previous set of days.

    Parameters

    • Default value jump: number = this.size

      The amount to shift the calendar by.

    • Default value delayRefresh: boolean = false

      When true Calendar.refresh will not be called after calendar is moved.

    Returns this

refresh

  • refresh(today?: Day): this
  • Refreshes the days and events in this calendar based on the start and end days, the calendar properties, and its eventss.

    Parameters

    Returns this

refreshColumns

  • refreshColumns(): this

refreshCurrent

  • refreshCurrent(today?: Day): this

refreshEvents

  • refreshEvents(): this

refreshRows

  • refreshRows(): this

refreshSelection

  • refreshSelection(): this

refreshVisible

  • refreshVisible(): this
  • Updates the list of visible schedules.

    Returns this

removeEvent

  • removeEvent(event: any, delayRefresh?: boolean): this
  • Removes the given event if it exists on the calendar.

    see

    Calendar.refreshEvents

    Parameters

    • event: any

      The event to remove if it exists.

    • Default value delayRefresh: boolean = false

      When true the Calendar.refreshEvents will not be called after the event is removed.

    Returns this

removeEvents

  • removeEvents(events?: any[], delayRefresh?: boolean): this
  • Removes the list of events if they exist in the calendar.

    see

    Calendar.removeEvent

    see

    Calendar.refreshEvents

    Parameters

    • Default value events: any[] = null

      The array of events to remove if they exist. If no events are passed (via null) then all events will be removed from the calendar.

    • Default value delayRefresh: boolean = false

      When true the Calendar.refreshEvents will not be called after the events are removed.

    Returns this

resetDays

  • resetDays(): this

resetFilled

  • resetFilled(): this

select

  • select(start: Day, end?: Day): this
  • Sets the selection point or range of the calendar and updates the flags in the days.

    see

    Calendar.refreshSelection

    Parameters

    • start: Day

      The start of the selection.

    • Default value end: Day = start

      The end of the selection.

    Returns this

set

setEvents

  • setEvents(events: EventInput<T, M>[], delayRefresh?: boolean): this

split

  • Splits up this calendar into an iterable collection of calendars. The resulting iterator will return size / by number of calendars.

    Parameters

    • Default value by: number = 1

      The new size of the resulting calendars. If the the size of the current calendar is not divisible by this value the resulting calendars may cover more or less than this calendar covers.

    Returns Iterate<Calendar<T, M>, number, Calendar<T, M>>

    An iterator for the calendars produced.

summary

  • summary(dayOfWeek?: boolean, short?: boolean, repeat?: boolean, contextual?: boolean, delimiter?: string): string

toInput

  • toInput(plain?: boolean, plainData?: function, plainMeta?: function): CalendarInput<T, M>
  • Converts this calendar to input which can be used to later recreate this calendar. The only properties of the calendar which will be loss is the Calendar.eventSorter property because it is a function.

    Parameters

    • Default value plain: boolean = false

      If the returned input should be plain objects as opposed to Day and Event instances.

    • Default value plainData: function = d => d

      A function to convert Event.data to a plain object if it is not already.

        • (data: T): any
        • Parameters

          • data: T

          Returns any

    • Default value plainMeta: function = m => m

      A function to convert values in Schedule.meta to plain objects if they are not alreday.

        • (meta: M): any
        • Parameters

          • meta: M

          Returns any

    Returns CalendarInput<T, M>

    The input generated from this calendar.

unselect

  • unselect(): this

withEventsOutside

  • withEventsOutside(eventsOutside: boolean): this

withListTimes

  • withListTimes(listTimes: boolean): this

withMinimumSize

  • withMinimumSize(minimumSize: number): this

withRepeatCovers

  • withRepeatCovers(repeatCovers: boolean): this

withUpdateColumns

  • withUpdateColumns(updateColumns: boolean, refresh?: boolean): this
  • Sets the Calendar.updateColumns value and returns this for method chaining.

    Parameters

    • updateColumns: boolean

      The new value.

    • Default value refresh: boolean = true

      If the columns should be updated now if updateColumns is true.

    Returns this

withUpdateRows

  • withUpdateRows(updateRows: boolean, refresh?: boolean): this
  • Sets the Calendar.updateRows value and returns this for method chaining.

    Parameters

    • updateRows: boolean

      The new value.

    • Default value refresh: boolean = true

      If the rows should be updated now if updateRows is true.

    Returns this

Static days

  • Creates a calendar based around days optionally focused around a given day.

    see

    Calendar.forType

    Type parameters

    • T

    • M

    Parameters

    • Default value days: number = 1

      The number of days in the calendar.

    • Default value around: Day = Day.today()

      The day to focus the calendar on.

    • Default value focus: number = 0.4999

      The value which describes how days are added around the given day. The default value will center the calendar around the given day. When the value is 0 the given day is the first day in the calendar, and when the value is 1 the given day is the last day in the calendar.

    • Optional input: CalendarInput<T, M>

      The default properties for the calendar.

    Returns Calendar<T, M>

    A new calendar instance.

Static forType

  • Creates a calendar based around a given unit optionally focused around a given day.

    Type parameters

    • T

    • M

    Parameters

    • type: Units

      The unit of the calendar.

    • Default value size: number = 1
    • Default value around: Day = Day.today()

      The day to focus the calendar on.

    • Default value focus: number = 0.49999

      The value which describes how months are added around the given day. The default value will center the calendar around the given day. When the value is 0 the given day is the first day in the calendar, and when the value is 1 the given day is the last day in the calendar.

    • Optional input: CalendarInput<T, M>

      The default properties for the calendar.

    Returns Calendar<T, M>

    A new calendar instance.

Static fromInput

  • Creates a calendar based on the given input.

    Type parameters

    • T

    • M

    Parameters

    • input: CalendarInput<T, M>

      The input which has at least the type specified.

    Returns Calendar<T, M>

    A new calendar instance.

Static months

  • Creates a calendar based around months optionally focused around a given day.

    see

    Calendar.forType

    Type parameters

    • T

    • M

    Parameters

    • Default value months: number = 1
    • Default value around: Day = Day.today()

      The day to focus the calendar on.

    • Default value focus: number = 0.4999

      The value which describes how months are added around the given day. The default value will center the calendar around the given day. When the value is 0 the given day is the first day in the calendar, and when the value is 1 the given day is the last day in the calendar.

    • Optional input: CalendarInput<T, M>

      The default properties for the calendar.

    Returns Calendar<T, M>

    A new calendar instance.

Static weeks

  • Creates a calendar based around weeks optionally focused around a given day.

    see

    Calendar.forType

    Type parameters

    • T

    • M

    Parameters

    • Default value weeks: number = 1
    • Default value around: Day = Day.today()

      The day to focus the calendar on.

    • Default value focus: number = 0.4999

      The value which describes how weeks are added around the given day. The default value will center the calendar around the given day. When the value is 0 the given day is the first day in the calendar, and when the value is 1 the given day is the last day in the calendar.

    • Optional input: CalendarInput<T, M>

      The default properties for the calendar.

    Returns Calendar<T, M>

    A new calendar instance.

Static years

  • Creates a calendar based around years optionally focused around a given day.

    see

    Calendar.forType

    Type parameters

    • T

    • M

    Parameters

    • Default value years: number = 1
    • Default value around: Day = Day.today()

      The day to focus the calendar on.

    • Default value focus: number = 0.4999

      The value which describes how years are added around the given day. The default value will center the calendar around the given day. When the value is 0 the given day is the first day in the calendar, and when the value is 1 the given day is the last day in the calendar.

    • Optional input: CalendarInput<T, M>

      The default properties for the calendar.

    Returns Calendar<T, M>

    A new calendar instance.

Object literals

Static TYPES

TYPES: object

A map of functions and properties by Units used to create or morph Calendars.

__computed

__computed: object

getEnd

  • getEnd(start: Day, size: number, focus: number): Day

getStart

  • getStart(around: Day, size: number, focus: number): Day

moveEnd

  • moveEnd(day: Day, amount: number): Day

moveStart

  • moveStart(day: Day, amount: number): Day

defaultInput

defaultInput: object = undefined

fill

fill: boolean = true

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