vue-simple-calendar
Advanced tools
Changelog
4.3.2 (2019-11-24)
Changelog
4.3.0 (2019-11-24)
click-date
and click-event
events are emitted with the DOM click event as the second argumentdoEmitItemMouseEvents
option to emit item-mouseover
and item-mouseout
events when the mouse hovers over a calendar item (#136)cli-plugin-eslint
isn't caught up yet.Changelog
4.2.2 (2019-05-01)
Changelog
4.2.1 (2019-01-25)
Changelog
4.2.0 (2018-12-18)
id
, was causing update issues (#108)headerProps.currentPeriodLabel
property (set by the parent calendar) (#101)order
property)currentPeriodLabel
property to the calendar component. If undefined, uses the localized date range. If "icons", uses an icon pair (⇤
or ⇥
). Otherwise uses the literal value (e.g., use "Today" to mimic the old functionality).currentPeriodLabelIcons
property for advanced swapping of said iconsChangelog
4.1.0 (2018-10-05)
isHovered
) to all event elements in the view whose id matches the event being hovered (#95)onPeriodChange
to periodChangedCallback
to resolve issue for JSX users (#94) BREAKING CHANGEperiodChangedCallback
was not firing for all users, or was firing duplicates (could not reproduce, #94, #98)Changelog
4.0.1, 4.0.2 (2018-08-25)
Changelog
4.0.1, 4.0.2 (2018-08-25)
Changelog
4.0.0 (2018-08-25)
This involved some changes to the source folder structure, as well as to the compiled files in the "dist" folder. Webpack-based imports of the components should be unaffected, same with CSS files. However, if you reference files directly in the dist folder (such as working in a non-webpack environment), the filenames have changed. Also, CalendarMathMixin is now part of the exported module, so if you're using webpack, you shouldn't need to reference the distribution file directly anymore. (And due to other changes, you may not need it anyway!)
This is the biggest change. Many users want to heavily customize the header using slots, and to ensure feature parity and minimize edge cases, I decided to make the default header component opt-in. This library still includes the same default header component (CalendarViewHeader), but to see it, you should put it in the header
named slot. Then, if you decide to create your own header, you can swap it out with ease.
Here's a minimal example:
<CalendarView :show-date="dt">
<template #header="{ headerProps }">
<CalendarViewHeader :header-props @input="setShowDate" />
</template>
</CalendarView>
import { CalendarView, CalendarViewHeader } from "vue-simple-calendar"
export default {
name: "App",
data: () ({ dt: new Date() })
components: {
CalendarView,
CalendarViewHeader,
},
methods: {
setShowDate(newValue) {
this.dt = newValue
}
}
[...]
}
The show-date-change
event was emitted by CalendarView
on behalf of the default header. Since CalendarView
is now decoupled from the default header, the purpose of this event is now moot. If you're using the default header component, put an @input
listener on it instead. If you are using your own header component, you can decide how it should communicate with your app if the header includes UI components the user can interact with.
This property sounds like an event, and it is, sort of. It's an optional prop
that takes a function as its argument. The function is invoked whenever the date range being shown by the calendar has changed (and also when the component is initialized). It passes a single argument to the function, an object with the keys periodStart
and periodEnd
(the dates that fall within the range of the months being shown) and displayFirstDate
/ displayLastDate
(the dates shown on the calendar, including those that fall outside the period). The intent of this property is to let the parent know what is being shown on the calendar, which the parent can then use to, for example, query a back-end database to update the event list, or update another component with information about the same period.
This was the solution I landed on in response to the question I had on issue #69. While watch
with immediate
can be used to see when the period changes, a watch handler will not emit an event during initialization (this.$emit
does nothing). I also tried using mounted
or updated
as well, but they have the same problem--you can't emit events during component initialization. Function
props are an oft-ignored feature of Vue, but in this case I believe it was the right call. It is fired once after the component updates the first time, and anytime thereafter that a change to any of the other props results in a change in the calendar's current date range.
Note: these date ranges are also passed to the header slot as part of headerProps
, so you don't need to wire them to your header.
The vue-simple-calendar
main bundle now includes CalendarView
, CalendarViewHeader
, and CalendarViewMixin
. This makes more sense, particularly since the header will need to be imported in any apps that want to use it, but it also means your import
statements need to specify which module you're importing (there is no default export). In most cases, your import should look like this:
import { CalendarView, CalendarViewHeader } from "vue-simple-calendar"
In short, the curly braces are important.
style
property to events to allow pass-through of arbitrary CSS attributes (thanks @apalethorpe!)previousFullPeriod
/nextFullPeriod
to headerProps
to provide more flexibility to how the previous/next buttons operats. #79 (thanks @lochstar!)label
to headerProps
, as part of the move to get rid of the default header and require a header slot.