Giter Site home page Giter Site logo

javaandnet / sf-calendar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from efforddev/sf-calendar

0.0 0.0 0.0 570 KB

Full Calendar implementation using LWC in Salesforce (Admins & Devs)

JavaScript 93.84% PHP 0.42% Apex 0.28% CSS 1.97% HTML 3.50%

sf-calendar's Introduction

Full Calendar(Salesforce) ๐Ÿ“…๐Ÿ“†

Deploy to Salesforce

FullCalendar V4 Full Calendar Implementation as LWC

Provides a <isExposed>false</isExposed> and a <isExposed>true</isExposed> that loads the FullCalendar static resources and displays a calendar. This component is capable of rendering events on any custom object along with standard objects like event. The exposed calendar is for admins to set up on lightning pages. The un exposed calendar component is for devs to use and extend in other lwc's.

Public Methods

setEvents is a public method that takes in formatted events, and renders them to the calendar. By default the function will remove the current events and render the new ones.

 @api setEvents(events)

For event info, see the Event Object

Views

The calendar provides multiple views in order to display the events.

The initial view is dayGridMonth; views provided are ['listWeek', 'dayGridMonth', 'timeGridWeek', 'timeGridDay'] .

Examples of each view are provided below:

listWeek
dayGridMonth
timeGridWeek
timeGridDay

Events

Date Change

As you navigate between dates (months, weeks, days; based on the current view) an event is dispatched everytime the viewed dates change with the start and end of the viewable calender. 'datechange'

this.event('datechange', { startDate, endDate })

Event Click

When clicking an event on the calendar from any view, an event is dispatched with an info object with data about the event. 'fceventclick'

this.event('fceventclick', info)

Date Click

When a date is clicked on the calendar, an event is dispatched with an info object with data about the date. 'fcdateclick'

this.event('fcdateclick', info)

Mouse Enter

Triggered when the user mouses over an event. An event is dispatched with an info object with data about the event. 'eventmouseenter'

this.event('eventmouseenter', info)

Rerendering the Calendar

Having the calendar rerender automatically is handled by using platform events. If you choose not to use platform events, the user will need to click the refresh button at the top right of the calendar to see live changes. Below are instructions for setting up the platform events.

1. Create the Platform Event:

  • Navigate to Setup > Integrations > Platform Events
  • Click New Platform Event
  • Give your Platform Event a Label and API Name
    • I suggest using the name of the object that holds the events on the calendar EG.
    • Be sure the Publish Behavior: Publish After Commit image

2. Create a Flow to create the Platform Event

  • Navigate to Flows in setup
  • Create a new Record Triggered Flow for the object that holds the events on the calendar EG

image

  • Make sure the flow is an After Trigger / Optimize the Flow for: Actions and Related Records

image

  • The Flow should have one node that create the Platform Event

image

  • Add a Create records node and Select your Platform Event as the record to create.
  • Based on your naming conventino you may see your Platform Event and sObject - Be sure you select your Platform Event image image

3. Copy the Platform Event API Name.

  • Navigate to the Lightning Record Page the contains the calendar component.
  • Paste the API Name into the Platform Event Name field image

Demo

sf-calendar-platformevents-demo.mov

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.