How to use the @fullcalendar/core.memoize function in @fullcalendar/core

To help you get started, we’ve selected a few @fullcalendar/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github avpeery / Moon-Phase-Tracker / static / fullcalendar / packages / list / main.esm.js View on Github external
function ListView(context, viewSpec, dateProfileGenerator, parentEl) {
        var _this = _super.call(this, context, viewSpec, dateProfileGenerator, parentEl) || this;
        _this.computeDateVars = memoize(computeDateVars);
        _this.eventStoreToSegs = memoize(_this._eventStoreToSegs);
        var eventRenderer = _this.eventRenderer = new ListEventRenderer(_this);
        _this.renderContent = memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer));
        _this.el.classList.add('fc-list-view');
        var listViewClassNames = (_this.theme.getClass('listView') || '').split(' '); // wish we didn't have to do this
        for (var _i = 0, listViewClassNames_1 = listViewClassNames; _i < listViewClassNames_1.length; _i++) {
            var listViewClassName = listViewClassNames_1[_i];
            if (listViewClassName) { // in case input was empty string
                _this.el.classList.add(listViewClassName);
            }
        }
        _this.scroller = new ScrollComponent('hidden', // overflow x
        'auto' // overflow y
        );
        _this.el.appendChild(_this.scroller.el);
        _this.contentEl = _this.scroller.el; // shortcut
        context.calendar.registerInteractiveComponent(_this, {
github avpeery / Moon-Phase-Tracker / static / fullcalendar / packages / list / main.esm.js View on Github external
function ListView(context, viewSpec, dateProfileGenerator, parentEl) {
        var _this = _super.call(this, context, viewSpec, dateProfileGenerator, parentEl) || this;
        _this.computeDateVars = memoize(computeDateVars);
        _this.eventStoreToSegs = memoize(_this._eventStoreToSegs);
        var eventRenderer = _this.eventRenderer = new ListEventRenderer(_this);
        _this.renderContent = memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer));
        _this.el.classList.add('fc-list-view');
        var listViewClassNames = (_this.theme.getClass('listView') || '').split(' '); // wish we didn't have to do this
        for (var _i = 0, listViewClassNames_1 = listViewClassNames; _i < listViewClassNames_1.length; _i++) {
            var listViewClassName = listViewClassNames_1[_i];
            if (listViewClassName) { // in case input was empty string
                _this.el.classList.add(listViewClassName);
            }
        }
        _this.scroller = new ScrollComponent('hidden', // overflow x
        'auto' // overflow y
        );
        _this.el.appendChild(_this.scroller.el);
        _this.contentEl = _this.scroller.el; // shortcut
github fullcalendar / fullcalendar / packages / list / src / ListView.ts View on Github external
Seg,
  ViewSpec
} from '@fullcalendar/core'
import ListEventRenderer from './ListEventRenderer'

/*
Responsible for the scroller, and forwarding event-related actions into the "grid".
*/
export default class ListView extends View {

  scroller: ScrollComponent
  contentEl: HTMLElement

  dayDates: DateMarker[] // TOOD: kill this. only have it because ListEventRenderer

  private computeDateVars = memoize(computeDateVars)
  private eventStoreToSegs = memoize(this._eventStoreToSegs)
  private renderSkeleton = memoizeRendering(this._renderSkeleton, this._unrenderSkeleton)
  private renderContent: MemoizedRendering<[ComponentContext, Seg[]]>


  constructor(viewSpec: ViewSpec, parentEl: HTMLElement) {
    super(viewSpec, parentEl)

    let eventRenderer = this.eventRenderer = new ListEventRenderer(this)
    this.renderContent = memoizeRendering(
      eventRenderer.renderSegs.bind(eventRenderer),
      eventRenderer.unrender.bind(eventRenderer),
      [ this.renderSkeleton ]
    )
  }
github fullcalendar / fullcalendar / packages / timegrid / src / TimeGrid.ts View on Github external
isSlatSizesDirty: boolean = false
  isColSizesDirty: boolean = false

  rootBgContainerEl: HTMLElement
  bottomRuleEl: HTMLElement // hidden by default
  contentSkeletonEl: HTMLElement
  colContainerEls: HTMLElement[] // containers for each column

  // inner-containers for each column where different types of segs live
  fgContainerEls: HTMLElement[]
  bgContainerEls: HTMLElement[]
  mirrorContainerEls: HTMLElement[]
  highlightContainerEls: HTMLElement[]
  businessContainerEls: HTMLElement[]

  private processOptions = memoize(this._processOptions)
  private renderSkeleton = memoizeRendering(this._renderSkeleton)
  private renderSlats = memoizeRendering(this._renderSlats, null, [ this.renderSkeleton ])
  private renderColumns = memoizeRendering(this._renderColumns, this._unrenderColumns, [ this.renderSkeleton ])
  private renderBusinessHours: MemoizedRendering<[ComponentContext, TimeGridSeg[]]>
  private renderDateSelection: MemoizedRendering<[TimeGridSeg[]]>
  private renderBgEvents: MemoizedRendering<[ComponentContext, TimeGridSeg[]]>
  private renderFgEvents: MemoizedRendering<[ComponentContext, TimeGridSeg[]]>
  private renderEventSelection: MemoizedRendering<[string]>
  private renderEventDrag: MemoizedRendering<[EventSegUiInteractionState]>
  private renderEventResize: MemoizedRendering<[EventSegUiInteractionState]>


  constructor(el: HTMLElement, renderProps: RenderProps) {
    super(el)

    this.renderProps = renderProps
github fullcalendar / fullcalendar / packages / timegrid / src / TimeGridView.ts View on Github external
DayTable,
  memoize,
  ViewProps
} from '@fullcalendar/core'
import { SimpleDayGrid } from '@fullcalendar/daygrid'
import SimpleTimeGrid from './SimpleTimeGrid'
import AbstractTimeGridView from './AbstractTimeGridView'


export default class TimeGridView extends AbstractTimeGridView {

  header: DayHeader
  simpleDayGrid: SimpleDayGrid
  simpleTimeGrid: SimpleTimeGrid

  private buildDayTable = memoize(buildDayTable)


  render(props: ViewProps, context: ComponentContext) {
    super.render(props, context) // for flags for updateSize. also _renderSkeleton/_unrenderSkeleton

    let { dateProfile, dateProfileGenerator } = this.props
    let { nextDayThreshold } = context
    let dayTable = this.buildDayTable(dateProfile, dateProfileGenerator)
    let splitProps = this.splitter.splitProps(props)

    if (this.header) {
      this.header.receiveProps({
        dateProfile,
        dates: dayTable.headerDates,
        datesRepDistinctDays: true,
        renderIntroHtml: this.renderHeadIntroHtml
github fullcalendar / fullcalendar / packages / daygrid / src / AbstractDayGridView.ts View on Github external
/* An abstract class for the daygrid views, as well as month view. Renders one or more rows of day cells.
----------------------------------------------------------------------------------------------------------------------*/
// It is a manager for a DayGrid subcomponent, which does most of the heavy lifting.
// It is responsible for managing width/height.

export default abstract class AbstractDayGridView extends View {

  scroller: ScrollComponent
  dayGrid: DayGrid // the main subcomponent that does most of the heavy lifting

  colWeekNumbersVisible: boolean
  cellWeekNumbersVisible: boolean
  weekNumberWidth: number

  private processOptions = memoize(this._processOptions)
  private renderSkeleton = memoizeRendering(this._renderSkeleton, this._unrenderSkeleton)


  _processOptions(options) {
    if (options.weekNumbers) {
      if (options.weekNumbersWithinDays) {
        this.cellWeekNumbersVisible = true
        this.colWeekNumbersVisible = false
      } else {
        this.cellWeekNumbersVisible = false
        this.colWeekNumbersVisible = true
      }
    } else {
      this.colWeekNumbersVisible = false
      this.cellWeekNumbersVisible = false
    }
github fullcalendar / fullcalendar / packages / list / src / ListView.ts View on Github external
ViewSpec
} from '@fullcalendar/core'
import ListEventRenderer from './ListEventRenderer'

/*
Responsible for the scroller, and forwarding event-related actions into the "grid".
*/
export default class ListView extends View {

  scroller: ScrollComponent
  contentEl: HTMLElement

  dayDates: DateMarker[] // TOOD: kill this. only have it because ListEventRenderer

  private computeDateVars = memoize(computeDateVars)
  private eventStoreToSegs = memoize(this._eventStoreToSegs)
  private renderSkeleton = memoizeRendering(this._renderSkeleton, this._unrenderSkeleton)
  private renderContent: MemoizedRendering<[ComponentContext, Seg[]]>


  constructor(viewSpec: ViewSpec, parentEl: HTMLElement) {
    super(viewSpec, parentEl)

    let eventRenderer = this.eventRenderer = new ListEventRenderer(this)
    this.renderContent = memoizeRendering(
      eventRenderer.renderSegs.bind(eventRenderer),
      eventRenderer.unrender.bind(eventRenderer),
      [ this.renderSkeleton ]
    )
  }
github fullcalendar / fullcalendar / packages / timegrid / src / SimpleTimeGrid.ts View on Github external
dateProfile: DateProfile | null
  dayTable: DayTable
  businessHours: EventStore
  eventStore: EventStore
  eventUiBases: EventUiHash
  dateSelection: DateSpan | null
  eventSelection: string
  eventDrag: EventInteractionState | null
  eventResize: EventInteractionState | null
}

export default class SimpleTimeGrid extends DateComponent {

  timeGrid: TimeGrid

  private buildDayRanges = memoize(buildDayRanges)
  private dayRanges: DateRange[] // for now indicator
  private slicer = new TimeGridSlicer()

  constructor(timeGrid: TimeGrid) {
    super(timeGrid.el)

    this.timeGrid = timeGrid
  }

  firstContext(context: ComponentContext) {
    context.calendar.registerInteractiveComponent(this, {
      el: this.timeGrid.el
    })
  }

  destroy() {
github avpeery / Moon-Phase-Tracker / static / fullcalendar / packages / timegrid / main.esm.js View on Github external
function TimeGridView(_context, viewSpec, dateProfileGenerator, parentEl) {
        var _this = _super.call(this, _context, viewSpec, dateProfileGenerator, parentEl) || this;
        _this.buildDayTable = memoize(buildDayTable);
        if (_this.opt('columnHeader')) {
            _this.header = new DayHeader(_this.context, _this.el.querySelector('.fc-head-container'));
        }
        _this.simpleTimeGrid = new SimpleTimeGrid(_this.context, _this.timeGrid);
        if (_this.dayGrid) {
            _this.simpleDayGrid = new SimpleDayGrid(_this.context, _this.dayGrid);
        }
        return _this;
    }
    TimeGridView.prototype.destroy = function () {
github avpeery / Moon-Phase-Tracker / static / fullcalendar / packages / daygrid / main.esm.js View on Github external
function DayGridView(_context, viewSpec, dateProfileGenerator, parentEl) {
        var _this = _super.call(this, _context, viewSpec, dateProfileGenerator, parentEl) || this;
        _this.buildDayTable = memoize(buildDayTable);
        if (_this.opt('columnHeader')) {
            _this.header = new DayHeader(_this.context, _this.el.querySelector('.fc-head-container'));
        }
        _this.simpleDayGrid = new SimpleDayGrid(_this.context, _this.dayGrid);
        return _this;
    }
    DayGridView.prototype.destroy = function () {