VCalendarMonthDay.mjs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import { createVNode as _createVNode } from "vue";
  2. // Styles
  3. import "./VCalendarMonthDay.css";
  4. // Components
  5. import { VCalendarEvent } from "./VCalendarEvent.mjs";
  6. import { VBtn } from "../../components/VBtn/index.mjs"; // Utilities
  7. import { genericComponent, propsFactory, useRender } from "../../util/index.mjs";
  8. export const makeVCalendarMonthDayProps = propsFactory({
  9. active: Boolean,
  10. color: String,
  11. day: Object,
  12. disabled: Boolean,
  13. events: Array,
  14. title: [Number, String]
  15. }, 'VCalendarMonthDay');
  16. export const VCalendarMonthDay = genericComponent()({
  17. name: 'VCalendarMonthDay',
  18. props: makeVCalendarMonthDayProps(),
  19. setup(props, _ref) {
  20. let {
  21. emit,
  22. slots
  23. } = _ref;
  24. useRender(() => {
  25. const hasTitle = !!(props.title || slots.title?.({
  26. title: props.title
  27. }));
  28. return _createVNode("div", {
  29. "class": ['v-calendar-month__day']
  30. }, [!props.day?.isHidden && hasTitle && _createVNode("div", {
  31. "key": "title",
  32. "class": "v-calendar-weekly__day-label"
  33. }, [slots.title?.({
  34. title: props.title
  35. }) ?? _createVNode(VBtn, {
  36. "class": props.day?.isToday ? 'v-calendar-weekly__day-label__today' : undefined,
  37. "color": props.color,
  38. "disabled": props.disabled,
  39. "icon": true,
  40. "size": "x-small",
  41. "variant": props.day?.isToday ? undefined : 'flat'
  42. }, {
  43. default: () => [props.title]
  44. })]), !props.day?.isHidden && _createVNode("div", {
  45. "key": "content",
  46. "class": "v-calendar-weekly__day-content"
  47. }, [slots.content?.() ?? _createVNode("div", null, [_createVNode("div", {
  48. "class": "v-calendar-weekly__day-alldayevents-container"
  49. }, [props.events?.filter(event => event.allDay).map(event => slots.event ? slots.event({
  50. day: props.day,
  51. allDay: true,
  52. event
  53. }) : _createVNode(VCalendarEvent, {
  54. "day": props.day,
  55. "event": event,
  56. "allDay": true
  57. }, null))]), _createVNode("div", {
  58. "class": "v-calendar-weekly__day-events-container"
  59. }, [props.events?.filter(event => !event.allDay).map(event => slots.event ? slots.event({
  60. day: props.day,
  61. event,
  62. allDay: false
  63. }) : _createVNode(VCalendarEvent, {
  64. "day": props.day,
  65. "event": event
  66. }, null))])])]), !props.day?.isHidden && slots.default?.()]);
  67. });
  68. return {};
  69. }
  70. });
  71. //# sourceMappingURL=VCalendarMonthDay.mjs.map