@bagelink/vue 1.2.15 → 1.2.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/components/calendar/CalendarTypes.d.ts +13 -0
  2. package/dist/components/calendar/CalendarTypes.d.ts.map +1 -0
  3. package/dist/components/calendar/Index.vue.d.ts +39 -507
  4. package/dist/components/calendar/Index.vue.d.ts.map +1 -1
  5. package/dist/components/calendar/utils.d.ts +31 -0
  6. package/dist/components/calendar/utils.d.ts.map +1 -0
  7. package/dist/components/calendar/views/AgendaView.vue.d.ts +16 -0
  8. package/dist/components/calendar/views/AgendaView.vue.d.ts.map +1 -0
  9. package/dist/components/calendar/views/DayView.vue.d.ts +50 -0
  10. package/dist/components/calendar/views/DayView.vue.d.ts.map +1 -0
  11. package/dist/components/calendar/views/MonthView.vue.d.ts +20 -0
  12. package/dist/components/calendar/views/MonthView.vue.d.ts.map +1 -0
  13. package/dist/components/calendar/views/WeekView.vue.d.ts +33 -0
  14. package/dist/components/calendar/views/WeekView.vue.d.ts.map +1 -0
  15. package/dist/components/form/BglMultiStepForm.vue.d.ts +63 -0
  16. package/dist/components/form/BglMultiStepForm.vue.d.ts.map +1 -0
  17. package/dist/components/form/index.d.ts +1 -0
  18. package/dist/components/form/index.d.ts.map +1 -1
  19. package/dist/components/form/inputs/CodeEditor/Index.vue.d.ts.map +1 -1
  20. package/dist/components/form/inputs/DateInput.vue.d.ts +3 -3
  21. package/dist/components/form/inputs/DateInput.vue.d.ts.map +1 -1
  22. package/dist/components/form/inputs/DatePicker.vue.d.ts +3 -3
  23. package/dist/components/form/inputs/DatePicker.vue.d.ts.map +1 -1
  24. package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
  25. package/dist/index.cjs +2241 -3891
  26. package/dist/index.d.ts +1 -1
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.mjs +2242 -3892
  29. package/dist/style.css +567 -633
  30. package/dist/utils/BagelFormUtils.d.ts +4 -2
  31. package/dist/utils/BagelFormUtils.d.ts.map +1 -1
  32. package/dist/utils/calendar/EDate.d.ts +2 -0
  33. package/dist/utils/calendar/EDate.d.ts.map +1 -0
  34. package/dist/utils/calendar/Helpers.d.ts +19 -0
  35. package/dist/utils/calendar/Helpers.d.ts.map +1 -0
  36. package/dist/utils/calendar/constants.d.ts +3 -0
  37. package/dist/utils/calendar/constants.d.ts.map +1 -0
  38. package/dist/utils/calendar/dateUtils.d.ts +30 -0
  39. package/dist/utils/calendar/dateUtils.d.ts.map +1 -0
  40. package/dist/utils/calendar/event.interface.d.ts +32 -0
  41. package/dist/utils/calendar/event.interface.d.ts.map +1 -0
  42. package/dist/utils/calendar/time.d.ts +117 -0
  43. package/dist/utils/calendar/time.d.ts.map +1 -0
  44. package/dist/utils/calendar/types.d.ts +27 -0
  45. package/dist/utils/calendar/types.d.ts.map +1 -0
  46. package/dist/utils/calendar/typings.d.ts +87 -0
  47. package/dist/utils/calendar/typings.d.ts.map +1 -0
  48. package/dist/utils/calendar/week.d.ts +117 -0
  49. package/dist/utils/calendar/week.d.ts.map +1 -0
  50. package/package.json +1 -1
  51. package/src/components/calendar/CalendarTypes.ts +13 -0
  52. package/src/components/calendar/Index.vue +124 -389
  53. package/src/components/calendar/utils.ts +70 -0
  54. package/src/components/calendar/views/AgendaView.vue +263 -0
  55. package/src/components/calendar/views/DayView.vue +373 -0
  56. package/src/components/calendar/views/MonthView.vue +313 -0
  57. package/src/components/calendar/views/WeekView.vue +431 -0
  58. package/src/components/form/BglMultiStepForm.vue +383 -69
  59. package/src/components/form/index.ts +1 -0
  60. package/src/components/form/inputs/CodeEditor/Index.vue +11 -0
  61. package/src/components/form/inputs/DateInput.vue +3 -3
  62. package/src/components/form/inputs/DatePicker.vue +35 -30
  63. package/src/components/form/inputs/SelectInput.vue +2 -0
  64. package/src/components/form/inputs/Upload/upload.types.d.ts +0 -1
  65. package/src/index.ts +2 -2
  66. package/src/styles/inputs.css +138 -137
  67. package/src/styles/layout.css +3 -2
  68. package/src/styles/mobilLayout.css +4 -2
  69. package/src/utils/BagelFormUtils.ts +6 -2
  70. package/src/utils/calendar/EDate.ts +0 -0
  71. package/src/{components/calendar/helpers → utils/calendar}/Helpers.ts +6 -6
  72. package/src/utils/calendar/constants.ts +2 -0
  73. package/src/utils/{timeAgo.ts → calendar/dateUtils.ts} +38 -1
  74. package/src/utils/calendar/event.interface.ts +33 -0
  75. package/src/{components/calendar/helpers/Time.ts → utils/calendar/time.ts} +15 -15
  76. package/src/utils/calendar/types.ts +27 -0
  77. package/src/{components/calendar/typings/config.interface.ts → utils/calendar/typings.ts} +13 -6
  78. package/src/utils/calendar/week.ts +588 -0
  79. package/src/components/calendar/assets/base.css +0 -60
  80. package/src/components/calendar/components/header/Header.vue +0 -153
  81. package/src/components/calendar/components/month/AgendaEventTile.vue +0 -135
  82. package/src/components/calendar/components/month/AgendaEvents.vue +0 -72
  83. package/src/components/calendar/components/month/Day.vue +0 -256
  84. package/src/components/calendar/components/month/Event.vue +0 -164
  85. package/src/components/calendar/components/month/Month.vue +0 -241
  86. package/src/components/calendar/components/month/WeekDay.vue +0 -15
  87. package/src/components/calendar/components/partials/EventFlyout.vue +0 -430
  88. package/src/components/calendar/components/week/Day.vue +0 -198
  89. package/src/components/calendar/components/week/DayEvent.vue +0 -584
  90. package/src/components/calendar/components/week/DayTimeline.vue +0 -80
  91. package/src/components/calendar/components/week/FullDayEvent.vue +0 -121
  92. package/src/components/calendar/components/week/Week.vue +0 -414
  93. package/src/components/calendar/components/week/WeekTimeline.vue +0 -101
  94. package/src/components/calendar/constants.ts +0 -13
  95. package/src/components/calendar/helpers/DayIntervals.ts +0 -48
  96. package/src/components/calendar/helpers/EDate.ts +0 -18
  97. package/src/components/calendar/helpers/Errors.ts +0 -69
  98. package/src/components/calendar/helpers/EventChange.ts +0 -88
  99. package/src/components/calendar/helpers/EventConcurrency.ts +0 -69
  100. package/src/components/calendar/helpers/EventFlyoutPosition.ts +0 -96
  101. package/src/components/calendar/helpers/EventPosition.ts +0 -154
  102. package/src/components/calendar/helpers/EventsFilter.ts +0 -50
  103. package/src/components/calendar/helpers/Week.ts +0 -37
  104. package/src/components/calendar/language/index.ts +0 -41
  105. package/src/components/calendar/language/keys.ts +0 -99
  106. package/src/components/calendar/models/Event.ts +0 -112
  107. package/src/components/calendar/styles/_mixins.css +0 -21
  108. package/src/components/calendar/styles/_variables.css +0 -47
  109. package/src/components/calendar/typings/interfaces/day.interface.ts +0 -10
  110. package/src/components/calendar/typings/interfaces/event.interface.ts +0 -32
  111. package/src/components/calendar/typings/interfaces/full-day-events-week.type.ts +0 -8
  112. package/src/components/calendar/typings/interfaces/period.interface.ts +0 -5
  113. package/src/components/calendar/typings/interfaces/time-modes.ts +0 -11
  114. package/src/components/calendar/typings/types.ts +0 -27
@@ -1,430 +0,0 @@
1
- <script setup lang="ts">
2
- import type { PropType } from 'vue'
3
- import type Time from '../../helpers/Time'
4
- import type { ConfigInterface } from '../../typings/config.interface'
5
- import type { EventInterface } from '../../typings/interfaces/event.interface'
6
- import { Icon } from '@bagelink/vue'
7
- import { ref, computed, watch, onMounted, onBeforeUnmount, nextTick } from 'vue'
8
- import { EVENT_COLORS } from '../../constants'
9
- import EventFlyoutPosition, { EVENT_FLYOUT_WIDTH } from '../../helpers/EventFlyoutPosition'
10
- import Helpers from '../../helpers/Helpers'
11
-
12
- const props = defineProps({
13
- calendarEventProp: {
14
- type: Object as PropType<EventInterface | null>,
15
- default: () => ({}),
16
- },
17
- eventElement: {
18
- type: Object as PropType<HTMLElement | any>,
19
- default: null,
20
- },
21
- time: {
22
- type: Object as PropType<Time>,
23
- required: true,
24
- },
25
- config: {
26
- type: Object as PropType<ConfigInterface>,
27
- required: true,
28
- },
29
- })
30
-
31
- const emit = defineEmits(['hide', 'editEvent', 'deleteEvent'])
32
-
33
- const eventFlyoutPositionHelper = new EventFlyoutPosition()
34
-
35
- const isVisible = ref(false)
36
- const top = ref<number | null>(0)
37
- const insetInlineEnd = ref<number | null>(0)
38
- const calendarEvent = ref(props.calendarEventProp)
39
- const flyoutWidth = `${EVENT_FLYOUT_WIDTH}px`
40
- const colors = EVENT_COLORS
41
-
42
- const icons = {
43
- clock: 'clock',
44
- user: 'user',
45
- description: 'comment',
46
- trash: 'delete',
47
- edit: 'edit',
48
- times: 'close',
49
- topic: 'help',
50
- location: 'location_on',
51
- }
52
-
53
- const getEventTime = computed(() => {
54
- if (!calendarEvent.value || !calendarEvent.value.time) return null
55
-
56
- const eventType = Helpers.getEventType(calendarEvent.value, props.time)
57
-
58
- if (['MULTI_DAY_TIMED'].includes(eventType)) {
59
- const startLocalizedString = `${getDateFromDateString(
60
- calendarEvent.value.time.start
61
- )} ${props.time.getLocalizedTime(calendarEvent.value.time.start)}`
62
- const endLocalizedString = `${getDateFromDateString(
63
- calendarEvent.value.time.end
64
- )} ${props.time.getLocalizedTime(calendarEvent.value.time.end)}`
65
-
66
- return `${startLocalizedString} - ${endLocalizedString}`
67
- }
68
-
69
- if (['SINGLE_DAY_FULL_DAY', 'MULTI_DAY_FULL_DAY'].includes(eventType)) {
70
- const startDate = getDateFromDateString(calendarEvent.value.time.start)
71
- const endDate = getDateFromDateString(calendarEvent.value.time.end)
72
-
73
- if (startDate === endDate) return startDate
74
-
75
- return `${startDate} - ${endDate}`
76
- }
77
-
78
- const dateString = getDateFromDateString(calendarEvent.value.time.start)
79
- const timeString = props.time.getLocalizedTimeRange(
80
- calendarEvent.value.time.start,
81
- calendarEvent.value.time.end
82
- )
83
-
84
- return `${dateString} ⋅ ${timeString}`
85
- })
86
-
87
- const eventFlyoutInlineStyles = computed(() => {
88
- if (typeof top.value === 'number' && !insetInlineEnd.value) {
89
- return {
90
- top: `${top.value}px`,
91
- left: '50%',
92
- position: 'fixed' as const,
93
- transform: 'translateX(-50%)',
94
- }
95
- }
96
-
97
- return {
98
- top: `${top.value}px`,
99
- insetInlineEnd: `${insetInlineEnd.value}px`,
100
- position: 'fixed' as const,
101
- }
102
- })
103
-
104
- const isEditable = computed(() => props.calendarEventProp?.isEditable || false)
105
-
106
- const eventBackgroundColor = computed(() => {
107
- if (
108
- calendarEvent.value?.colorScheme
109
- && props.config.style?.colorSchemes
110
- && props.config.style.colorSchemes[calendarEvent.value.colorScheme]
111
- ) {
112
- return props.config.style.colorSchemes[calendarEvent.value.colorScheme]
113
- .backgroundColor
114
- }
115
-
116
- return colors[calendarEvent.value?.color || 'blue']
117
- })
118
-
119
- function setFlyoutPosition() {
120
- const calendar = props.eventElement?.closest('.calendar-root')
121
- const flyout = document.querySelector('.event-flyout')
122
-
123
- if (!props.eventElement) return
124
-
125
- const flyoutPosition = eventFlyoutPositionHelper.calculateFlyoutPosition(
126
- props.eventElement?.getBoundingClientRect(),
127
- {
128
- height: flyout?.clientHeight || 300,
129
- width: flyout?.clientWidth || 0,
130
- },
131
- calendar ? calendar.getBoundingClientRect() : null
132
- )
133
-
134
- top.value = typeof flyoutPosition?.top === 'number' ? flyoutPosition.top : null
135
- insetInlineEnd.value = typeof flyoutPosition?.left === 'number' ? flyoutPosition.left : null
136
- }
137
-
138
- function editEvent() {
139
- emit('editEvent', calendarEvent.value?.id)
140
- closeFlyout()
141
- }
142
-
143
- function deleteEvent() {
144
- emit('deleteEvent', calendarEvent.value?.id)
145
- closeFlyout()
146
- }
147
-
148
- function closeFlyout() {
149
- isVisible.value = false
150
-
151
- setTimeout(() => {
152
- emit('hide')
153
- }, 100)
154
- }
155
-
156
- function getDateFromDateString(dateString: string) {
157
- const { year, month, date } = props.time.getAllVariablesFromDateTimeString(dateString)
158
-
159
- return new Date(year, month, date).toLocaleDateString(
160
- props.time.CALENDAR_LOCALE,
161
- {
162
- year: 'numeric',
163
- month: 'long',
164
- day: 'numeric',
165
- }
166
- )
167
- }
168
-
169
- function closeFlyoutOnClickOutside(e: any) {
170
- const flyout = document.querySelector('.event-flyout')
171
- if (!flyout || !isVisible.value) return
172
-
173
- const isClickOutside = !flyout.contains(e.target)
174
- const isClickOnEvent = !!e.target.closest('.is-event')
175
- const closeOnClickOutside = props.config.eventDialog?.closeOnClickOutside ?? true
176
-
177
- if (isVisible.value && isClickOutside && !isClickOnEvent && closeOnClickOutside) {
178
- closeFlyout()
179
- }
180
- }
181
-
182
- // Watch for changes
183
- watch(
184
- () => props.calendarEventProp,
185
- (value) => {
186
- setTimeout(() => {
187
- calendarEvent.value = value
188
- isVisible.value = !!value
189
- nextTick(() => { setFlyoutPosition() })
190
- }, 10)
191
- },
192
- { deep: true }
193
- )
194
-
195
- // Lifecycle hooks
196
- onMounted(() => {
197
- document.addEventListener('click', closeFlyoutOnClickOutside)
198
- })
199
-
200
- onBeforeUnmount(() => {
201
- document.removeEventListener('click', closeFlyoutOnClickOutside)
202
- })
203
- </script>
204
-
205
- <template>
206
- <div
207
- class="event-flyout p-05 bg-white"
208
- :class="{ 'is-visible': isVisible, 'is-not-editable': !isEditable }"
209
- :style="eventFlyoutInlineStyles"
210
- >
211
- <div
212
- v-if="!config.eventDialog || !config.eventDialog.isCustom"
213
- class="event-flyout__relative-wrapper"
214
- >
215
- <div class="event-flyout__menu">
216
- <span
217
- v-if="isEditable"
218
- class="event-flyout__menu-editable"
219
- >
220
- <Icon
221
- class="event-flyout__menu-item is-edit-icon"
222
- :icon="icons.edit"
223
- @click="editEvent"
224
- />
225
-
226
- <Icon
227
- class="event-flyout__menu-item is-trash-icon"
228
- :icon="icons.trash"
229
- @click="deleteEvent"
230
- />
231
- </span>
232
-
233
- <span class="event-flyout__menu-close">
234
- <Icon
235
- class="event-flyout__menu-item is-times-icon"
236
- :icon="icons.times"
237
- @click="closeFlyout"
238
- />
239
- </span>
240
- </div>
241
-
242
- <div
243
- v-if="calendarEvent"
244
- class="event-flyout__info-wrapper"
245
- >
246
- <div
247
- v-if="calendarEvent.title"
248
- class="event-flyout__row is-title"
249
- >
250
- <div
251
- class="event-flyout__color-icon"
252
- :style="{ backgroundColor: eventBackgroundColor }"
253
- />
254
- {{ calendarEvent.title }}
255
- </div>
256
-
257
- <div
258
- v-if="calendarEvent.time"
259
- class="event-flyout__row is-time"
260
- >
261
- {{ getEventTime }}
262
- </div>
263
-
264
- <div
265
- v-if="calendarEvent.location"
266
- class="event-flyout__row is-location"
267
- >
268
- <Icon :icon="icons.location" />
269
- {{ calendarEvent.location }}
270
- </div>
271
-
272
- <div
273
- v-if="calendarEvent.with"
274
- class="event-flyout__row is-with"
275
- >
276
- <Icon :icon="icons.user" />
277
- {{ calendarEvent.with }}
278
- </div>
279
-
280
- <div
281
- v-if="calendarEvent.topic"
282
- class="event-flyout__row is-topic"
283
- >
284
- <Icon :icon="icons.topic" />
285
- {{ calendarEvent.topic }}
286
- </div>
287
-
288
- <div
289
- v-if="calendarEvent.description"
290
- class="event-flyout__row is-description"
291
- >
292
- <Icon :icon="icons.description" />
293
- <p v-html="calendarEvent.description" />
294
- </div>
295
- </div>
296
- </div>
297
-
298
- <slot
299
- v-else
300
- :event-dialog-data="calendarEvent"
301
- :close-event-dialog="closeFlyout"
302
- />
303
- </div>
304
- </template>
305
-
306
- <style>
307
- .event-flyout {
308
- position: fixed;
309
- z-index: 50;
310
- background-color: #fff;
311
- max-height: 100%;
312
- width: v-bind(flyoutWidth);
313
- max-width: 98%;
314
- border: var(--qalendar-border-gray-thin);
315
- border-radius: 8px;
316
- box-shadow: 0 12px 24px rgb(0 0 0 / 9%), 0 6px 12px rgb(0 0 0 / 18%);
317
- overflow: hidden;
318
- transition: all 0.2s ease;
319
- transition-property: opacity, transform;
320
- transform: translateY(-40px);
321
- opacity: 0;
322
- pointer-events: none;
323
- }
324
-
325
- @media (prefers-color-scheme: dark) {
326
- .event-flyout {
327
- background-color: var(--qalendar-dark-mode-elevated-surface);
328
- border-color: transparent;
329
- }
330
- }
331
-
332
- .event-flyout.is-visible {
333
- opacity: 1;
334
- transform: translateY(0);
335
- pointer-events: initial;
336
- }
337
-
338
- .event-flyout__relative-wrapper {
339
- position: relative;
340
- }
341
-
342
- .event-flyout__menu {
343
- display: flex;
344
- justify-content: space-between;
345
- align-items: center;
346
- }
347
-
348
- .event-flyout__menu-editable,
349
- .event-flyout__menu-close {
350
- padding: var(--qalendar-spacing) var(--qalendar-spacing) 0 var(--qalendar-spacing);
351
- display: flex;
352
- gap: 20px;
353
- }
354
-
355
- .is-not-editable .event-flyout__menu-close {
356
- position: absolute;
357
- top: 0;
358
- inset-inline-end: 0;
359
- }
360
-
361
- .event-flyout__menu-item {
362
- font-size: var(--qalendar-font-l);
363
- color: gray;
364
- }
365
-
366
- @media (prefers-color-scheme: dark) {
367
- .event-flyout__menu-item {
368
- color: var(--qalendar-dark-mode-text-hint);
369
- }
370
- }
371
-
372
- .event-flyout__menu-item:hover {
373
- color: var(--qalendar-theme-color);
374
- cursor: pointer;
375
- }
376
-
377
- .is-trash-icon:hover {
378
- color: red;
379
- }
380
-
381
- .event-flyout__info-wrapper {
382
- padding: var(--qalendar-spacing);
383
- }
384
-
385
- .event-flyout__row {
386
- display: flex;
387
- gap: var(--qalendar-spacing);
388
- margin-bottom: 0.25em;
389
- font-weight: 400;
390
- }
391
-
392
- .event-flyout__row p {
393
- margin: 0;
394
- padding: 0;
395
- }
396
-
397
- .event-flyout__row svg {
398
- margin-top: 0.1rem;
399
- color: #5f6368;
400
- width: 14px;
401
- }
402
-
403
- @media (prefers-color-scheme: dark) {
404
- .event-flyout__row svg {
405
- color: var(--qalendar-dark-mode-text-hint);
406
- }
407
- }
408
-
409
- .event-flyout__color-icon {
410
- --icon-height: 16px;
411
- border-radius: 50%;
412
- height: var(--icon-height);
413
- width: var(--icon-height);
414
- }
415
-
416
- .is-title {
417
- font-size: 18px;
418
- line-height: 1.2;
419
- align-items: center;
420
- }
421
-
422
- .is-not-editable .is-title {
423
- max-width: 90%;
424
- }
425
-
426
- .is-time {
427
- font-size: var(--qalendar-font-s);
428
- margin-bottom: 0.75em;
429
- }
430
- </style>
@@ -1,198 +0,0 @@
1
- <script setup lang="ts">
2
- import type { PropType } from 'vue'
3
- import type { Interval } from '../../helpers/DayIntervals'
4
- import type Time from '../../helpers/Time'
5
- import type { ConfigInterface, DayIntervalsType } from '../../typings/config.interface'
6
- import type { DayInterface } from '../../typings/interfaces/day.interface'
7
- import type { EventInterface } from '../../typings/interfaces/event.interface'
8
- import type { DayInfo, ModeType } from '../../typings/types'
9
- import { ref, computed, onMounted } from 'vue'
10
- import DayIntervals from '../../helpers/DayIntervals'
11
- import EventConcurrency from '../../helpers/EventConcurrency'
12
- import DayEvent from './DayEvent.vue'
13
-
14
- const props = defineProps({
15
- day: {
16
- type: Object as PropType<DayInterface>,
17
- required: true,
18
- },
19
- time: {
20
- type: Object as PropType<Time>,
21
- required: true,
22
- },
23
- config: {
24
- type: Object as PropType<ConfigInterface>,
25
- required: true,
26
- },
27
- dayInfo: {
28
- type: Object as PropType<DayInfo>,
29
- required: true,
30
- },
31
- mode: {
32
- type: String as PropType<ModeType>,
33
- required: true,
34
- },
35
- dayIntervals: {
36
- type: Object as PropType<DayIntervalsType>,
37
- required: true,
38
- },
39
- weekHeight: {
40
- type: Number,
41
- required: true,
42
- },
43
- })
44
-
45
- const emit = defineEmits([
46
- 'eventWasClicked',
47
- 'eventWasResized',
48
- 'eventWasDragged',
49
- 'intervalWasClicked',
50
- 'dayWasClicked',
51
- 'datetimeWasClicked',
52
- 'dragStart',
53
- 'dragEnd',
54
- ])
55
-
56
- const eventConcurrencyHelper = new EventConcurrency()
57
-
58
- const events = ref<EventInterface[]>([])
59
- const intervals = ref<Interval[]>([])
60
-
61
- const intervalStyles = computed(() => {
62
- return props.config.dayIntervals?.intervalStyles
63
- ? props.config.dayIntervals.intervalStyles
64
- : {}
65
- })
66
-
67
- function calculateEventConcurrency() {
68
- events.value = eventConcurrencyHelper.calculateConcurrencyForEvents(
69
- props.day.events
70
- )
71
- }
72
-
73
- function handleEventWasResized(event: any) {
74
- emit('eventWasResized', event)
75
- calculateEventConcurrency()
76
- }
77
-
78
- function handleClickOnInterval(payload: Interval) {
79
- const { intervalStart, intervalEnd } = payload
80
- emit('intervalWasClicked', { intervalStart, intervalEnd })
81
- }
82
-
83
- function setClickableIntervals() {
84
- let dayStartTimeString = props.day.dateTimeString
85
- if (props.time.DAY_START !== 0) {
86
- const { hour: startHour } = props.time.getHourAndMinutesFromTimePoints(props.time.DAY_START)
87
- dayStartTimeString = props.time.setSegmentOfDateTimeString(dayStartTimeString, { hour: startHour })
88
- }
89
-
90
- intervals.value = new DayIntervals(
91
- props.dayIntervals.length || 60,
92
- dayStartTimeString,
93
- props.time.HOURS_PER_DAY,
94
- ).getIntervals()
95
- }
96
-
97
- function getDateStringForFlexibleDayBoundaries(dateString: string, timeClickedHHMM: string) {
98
- const hourTwoDigits = props.time.doubleDigit(props.time.DAY_START / 100)
99
- const dayStartTimeHHMM = `${hourTwoDigits}:00`
100
- const isClickOnNextDay = timeClickedHHMM < dayStartTimeHHMM
101
-
102
- if (isClickOnNextDay) {
103
- dateString = props.time.dateStringFrom(
104
- props.time.addDaysToDateTimeString(1, dateString)
105
- )
106
- }
107
-
108
- return dateString
109
- }
110
-
111
- function handleClickOnDay(event: MouseEvent) {
112
- const timeClicked = props.time.getTimeFromClick(event.offsetY, props.weekHeight)
113
- let dateString = props.time.dateStringFrom(props.day.dateTimeString)
114
- const isFlexibleDay = props.time.DAY_END <= props.time.DAY_START
115
- if (isFlexibleDay) dateString = getDateStringForFlexibleDayBoundaries(dateString, timeClicked)
116
- const dateTimeString = `${dateString} ${timeClicked}`
117
-
118
- emit('dayWasClicked', dateString)
119
- emit('datetimeWasClicked', dateTimeString)
120
- }
121
-
122
- onMounted(() => {
123
- calculateEventConcurrency()
124
- if (props.dayIntervals.displayClickableInterval) setClickableIntervals()
125
- })
126
- </script>
127
-
128
- <template>
129
- <div
130
- class="calendar-week__day"
131
- @click.self="handleClickOnDay"
132
- >
133
- <DayEvent
134
- v-for="(event, eventIndex) in events"
135
- :key="eventIndex"
136
- data-test="day-event"
137
- :event-prop="event"
138
- :day="day"
139
- :time="time"
140
- :config="config"
141
- :day-info="dayInfo"
142
- :mode="mode"
143
- @eventWasClicked="$emit('eventWasClicked', $event)"
144
- @eventWasDragged="$emit('eventWasDragged', $event)"
145
- @eventWasResized="handleEventWasResized"
146
- @dragStart="$emit('dragStart')"
147
- @dragEnd="$emit('dragEnd')"
148
- >
149
- <template #weekDayEvent="p">
150
- <slot
151
- :event-data="p.eventData"
152
- name="weekDayEvent"
153
- />
154
- </template>
155
- </DayEvent>
156
-
157
- <template v-if="dayIntervals && dayIntervals.displayClickableInterval">
158
- <div
159
- v-for="(interval, intervalIndex) in intervals"
160
- :id="`interval-${intervalIndex}`"
161
- :key="interval.intervalStart"
162
- class="calendar-week__day-interval"
163
- :class="{ 'has-border': interval.hasBorder }"
164
- :style="intervalStyles"
165
- @click="handleClickOnInterval(interval)"
166
- >
167
- {{ time.getLocalizedTime(interval.intervalStart) }}
168
- </div>
169
- </template>
170
- </div>
171
- </template>
172
-
173
- <style scoped>
174
- .calendar-week__day {
175
- position: relative;
176
- width: 100%;
177
- height: 100%;
178
- display: flex;
179
- flex-direction: column;
180
- }
181
-
182
- .calendar-week__day .calendar-week__day-interval {
183
- flex: 1;
184
- font-size: var(--qalendar-font-xs);
185
- color: var(--qalendar-gray);
186
- padding: 2px;
187
- }
188
-
189
- .calendar-week__day:first-child {
190
- border-inline-start: 1px solid var(--border-color);
191
- }
192
-
193
- .calendar-week__day {
194
- border-inline-end: 1px solid var(--border-color);
195
- border-bottom: 1px solid var(--border-color);
196
-
197
- }
198
- </style>