2.3.1 • Published 3 years ago

vue-calendarless v2.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

vue-calendarless 📆

A Vue renderless calendar component.

This is a fork of the vue-renderless-calendar library, which is not maintained actively. This library may be subject of heavy changes at any time, since it's not developped for public usage for the moment.

Install

npm i vue-calendarless
yarn add vue-calendarless

Component usage

Main wrapper component which contains state of the calendar and other helpful data

Props

PropRequiredTypeDefaultDescription
viewModefalseString'single', 'double', 'infinite'
modefalseString'single', 'range'
localefalseObject or Stringnavigator.language (client), 'en' (server)Locale string (e.g. 'ru'), it will automatically generate locale object using Date.prototype.toLocaleString, otherwise you can provide this object manually
minDatefalseString''Minimal valid date (YYYY-MM-DDD)
maxDatefalseString''Maximal valid date (YYYY-MM-DDD)
preventOutOfRangefalseBooleantruePrevent user go out of valid dates range
dateSelectStrategyfalseFunctionnullIf you want custom behaviour for handling date select, you can implement this function
defaultSelectedDatesfalseArray[]Array of date strings with YYYY-MM-DDD format
captureHoverfalseBooleantruecaptureHover prop is used for computing dates which are between selected date and current hovered date
captureThirdDatefalseBooleanfalsecaptureThirdDate prop is used for capturing dates between in case when 2 dates already selected and you have third element hovered
disabledDatesfalseArray[]Array of YYYY-MM-DDD strings containing dates that can't be selected
markedDatesfalseArray[]Array of YYYY-MM-DDD strings with special meaning, that later will be accessed via isMarked modifier
firstDayOfWeekfalsenumber1Index of the weekday to start the week from. From 0 to 6. 0 is Sunday, 6 is Saturday

Scoped-slots properties

PropertyTypeDescription
weekDayNamesArrayList of week days with short and full titles from locale object
monthNamesArrayList of months with short and full titles from locale object
monthsListArrayList of months which can be used for rendering months with possibility for changing current month view of calendar using setMonth method
calendarArrayArray of months with month, year number and array of dates
selectedDatesArray\<CalendarDate>Array of current selected dates
currentMonthNumber
currentYearNumber
canGoToPrevMonthBoolean
canGoToNextMonthBoolean

Scoped-slots Methods

PropertyArgumentsDescription
prevPage-Go to previous view iteration
nextPage-Go to next view iteration
resetDates-Set selectedDates to []
setMonthmonthListItemUpdate views current active month
onDateMouseOut-Reset current hovered date
onDateMouseOverCalendarDateSet current hovered date
onDateSelectCalendarDateAppend selected date to selectedDates array using "date select strategy"
getModifiersCalendarDateReturns

Events

Event namePayload
onDateChangeArray\<CalendarDate>

Modifiers

Object containing boolean properties that can be useful for computing styles

PropertyTypeDescription
isSelectedBoolean
isBetweenBoolean
isDisabledBoolean
isMarkedBoolean
isFirstBooleanis first selected date
isLastBooleanis last selected date
isOneDayAfterBooleanis one day after selected date
isOneDayBeforeBooleanis one date before selected date
isOneDayBeforeFirstBoolean
isOneDayAfterFirstBoolean
isOneDayBeforeLastBoolean
isOneDayAfterLastBoolean

CalendarDate

Class representing information about date

Properties

PropertyTypeDescription
yearNumber
monthNumber0-11
dayNumber1-31
actualMonthNumberNumberNumber of month with index correction
formattedStringYYYY-MM-DD
isWeekendBoolean
isTodayBoolean
isOtherMonthDayBooleanThis field can be used to find out that this is the date from previous or next month

Contributing

How to debug in local

Runs the local examples

This opens a simple Vue application with calendar examples.

yarn dev:example

In another project

If you use the library in another project, you can link it to your local clone and debug the calendar sources from this project directly.

yarn link
yarn watch # Updates the /dist folder at every change
# Use the local version of the library in the node_modules
yarn link vue-calendarless

You can now open the source files in the browser debugger.