From b74d23e3e98056a4d8a27580c0acf647ec0a12d6 Mon Sep 17 00:00:00 2001 From: cagataycivici Date: Mon, 13 May 2019 15:50:21 +0300 Subject: [PATCH] Doc update for FullCalendar --- src/views/fullcalendar/FullCalendarDoc.vue | 138 +++++++++++++-------- 1 file changed, 85 insertions(+), 53 deletions(-) diff --git a/src/views/fullcalendar/FullCalendarDoc.vue b/src/views/fullcalendar/FullCalendarDoc.vue index 392385789..5bb951333 100644 --- a/src/views/fullcalendar/FullCalendarDoc.vue +++ b/src/views/fullcalendar/FullCalendarDoc.vue @@ -8,9 +8,17 @@ import FullCalendar from 'primevue/fullcalendar';

Getting Started

-

FullCalendar is a wrapper around on FullCalendar 4.0.0.alpha.2+ so fullcalendar needs to be included in your project. For a complete documentation and samples please refer to the fullcalendar website.

+

FullCalendar is a wrapper around on FullCalendar 4.0.0+ so fullcalendar needs to be included in your project. + For a complete documentation and samples please refer to the fullcalendar website.

-npm install fullcalendar@4.0.0-alpha.2 --save +npm install @fullcalendar/core --save + + +

FullCalendar is plugin based so install the plugins you require and define them with the options property.

+ +npm install @fullcalendar/daygrid --save +npm install @fullcalendar/timegrid --save +npm install @fullcalendar/interaction --save

Events should be an array and defined using the events property.

@@ -62,7 +70,7 @@ export default { } -

In a real application, it is likely to populate the events by making a service call, when the events are updated, the component will detect the change and render them.

+

In a real application, it is likely to populate the events by making a remote call, when the events are updated, the component will detect the change and render them.

import axios from 'axios'; @@ -94,22 +102,40 @@ export default {

Options

-

FullCalendar has a long list of customization parameters that are defined with the options property. Example below customizes the header property.

+

FullCalendar has a long list of customization parameters that can be defined with the options property. Example below customizes the plugins, header and editable properties.

+ +<FullCalendar :events="events" :options="options" /> + + +import EventService from '../../service/EventService'; +import dayGridPlugin from '@fullcalendar/daygrid'; +import timeGridPlugin from '@fullcalendar/timegrid'; +import interactionPlugin from '@fullcalendar/interaction'; + export default { - data() { - return { - options: { - defaultDate: '2019-01-01', - header: { - left: 'prev,next', - center: 'title', - right: 'month,agendaWeek,agendaDay' - }, - editable: true - } - }; - }, + data() { + return { + options: { + plugins:[dayGridPlugin, timeGridPlugin, interactionPlugin], + defaultDate: '2019-01-01', + header: { + left: 'prev,next', + center: 'title', + right: 'dayGridMonth,timeGridWeek,timeGridDay' + }, + editable: true + }, + events: null + }; + }, + eventService: null, + created() { + this.eventService = new EventService(); + }, + mounted() { + this.eventService.getEvents().then(data => this.events = data); + } } @@ -117,22 +143,23 @@ export default {

Callbacks of the FullCalendar such as dateClick are also defined with the options property.

export default { - data() { - return { - options: { - defaultDate: '2019-01-01', - header: { - left: 'prev,next', - center: 'title', - right: 'month,agendaWeek,agendaDay' - }, - editable: true, - dateClick: (e) => { + data() { + return { + options: { + plugins:[dayGridPlugin, timeGridPlugin, interactionPlugin], + defaultDate: '2019-01-01', + header: { + left: 'prev,next', + center: 'title', + right: 'dayGridMonth,timeGridWeek,timeGridDay' + }, + editable: true, + dateClick: (e) => { //handle date click } - } - }; - }, + } + }; + } } @@ -162,7 +189,8 @@ export default {

Dependencies

- FullCalendar 4.0.0.alpha.2+ +

FullCalendar 4.0.0+

+ @@ -190,29 +218,33 @@ export default { import EventService from '../../service/EventService'; +import dayGridPlugin from '@fullcalendar/daygrid'; +import timeGridPlugin from '@fullcalendar/timegrid'; +import interactionPlugin from '@fullcalendar/interaction'; export default { - data() { - return { - options: { - defaultDate: '2019-01-01', - header: { - left: 'prev,next', - center: 'title', - right: 'month,agendaWeek,agendaDay' - }, - editable: true - }, - events: null - }; - }, - eventService: null, - created() { - this.eventService = new EventService(); - }, - mounted() { - this.eventService.getEvents().then(data => this.events = data); - } + data() { + return { + options: { + plugins:[dayGridPlugin, timeGridPlugin, interactionPlugin], + defaultDate: '2019-01-01', + header: { + left: 'prev,next', + center: 'title', + right: 'dayGridMonth,timeGridWeek,timeGridDay' + }, + editable: true + }, + events: null + }; + }, + eventService: null, + created() { + this.eventService = new EventService(); + }, + mounted() { + this.eventService.getEvents().then(data => this.events = data); + } }