0.1.6 • Published 12 months ago

@glhrmoura/vue-calendar v0.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

Vue Calendar

NPM Version License

Library designed to facilitate the creation of interactive calendars in applications using Vue >= 3.

Demo

Vue Calendar

Install

$ yarn add @glhrmoura/vue-calendar

or

$ npm install @glhrmoura/vue-calendar

Usage

<template>
  <VueCalendar
    :events="events"
    :ranges="ranges"
  />
</template>

<script>
  import VueCalendar from '@glhrmoura/vue-calendar';

  export default {
    components: {
      VueCalendar,
    },
  
    data() {
      return {
        events: [
          {
            all: true,
            interval: { from: '05:00', to: '06:00' },
          },
          {
            date: new Date,
            interval: { from: '06:00', to: '08:45' },
          },
          {
            wday: ['monday', 'wednesday', 'thursday', 'friday'],
            interval: { from: '09:00', to: '11:00' },
          },
          {
            wday: 'thursday',
            interval: { from: '11:00', to: '12:00' },
          },
        ],

        ranges: [
          {
            start: new Date,
            end: new Date,
          },
          {
            start: new Date,
            end: new Date,
          },
          {
          /**
           * Passing only the {start} property we will have a range that will 
           * start on the given date and cover all subsequent dates
           **/
            start: new Date,
          },
        ],
      };
    },
  };
</script>

Properties

Calendar

PropertyDescriptionTypeDefault
eventsEvents that will be shown on the calendarEvent[][]
rangesA range of dates that will be highlighted in the calendarRange[][]
rowsNumber of lines that the calendar will showNumber5
controlsIndicates whether action buttons will be shownBooleantrue

Event

PropertyDescriptionType
wdayUsed to define recurring eventsString or String[]
dateUsed to set events on fixed dates (Takes precedence over wday)Date
allUsed to define that an event will happen every day. This property takes precedence over all othersBoolean
intervalAn object that informs the start and end time of the eventInterval

Range

PropertyDescriptionType
startRange start dateDate
endRange end dateDate

Interval

PropertyDescriptionType
fromEvent start timeString
toEvent end timeString

Events

NameDescriptionCallback Arguments
select-dateWhen only one date is selected with a simple click{ date: Date, events: Event[] }
select-datesWhen multiple dates are selected by clicking and dragging{ dates: Date[] }

License

MIT

Copyright (c) Guilherme Moura

0.1.6

12 months ago

0.1.5

12 months ago

0.1.4

12 months ago

0.1.3

12 months ago

0.1.2

12 months ago

0.1.1

1 year ago

0.1.0

1 year ago