@redvars/peacock 4.3.4 → 4.5.0

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 (242) hide show
  1. package/dist/{BaseField-DPyW5Zm5.js → BaseField-BbOj212R.js} +3 -3
  2. package/dist/{BaseField-DPyW5Zm5.js.map → BaseField-BbOj212R.js.map} +1 -1
  3. package/dist/{BaseInput-FhjvfMjF.js → BaseInput-Cv03GZLu.js} +2 -2
  4. package/dist/{BaseInput-FhjvfMjF.js.map → BaseInput-Cv03GZLu.js.map} +1 -1
  5. package/dist/ai-badge.js +2 -2
  6. package/dist/ai-summary.js +2 -2
  7. package/dist/alert.js +2 -2
  8. package/dist/anchor-nav.js +2 -2
  9. package/dist/app-shell.js +2 -2
  10. package/dist/assistant-panel.js +2 -2
  11. package/dist/assistant-step.js +2 -2
  12. package/dist/assistant-steps.js +2 -2
  13. package/dist/avatar-group.js +2 -2
  14. package/dist/banner.js +2 -2
  15. package/dist/{base-progress-D8-x6XS4.js → base-progress-CqsyiVOV.js} +2 -2
  16. package/dist/{base-progress-D8-x6XS4.js.map → base-progress-CqsyiVOV.js.map} +1 -1
  17. package/dist/bottom-sheet.js +2 -2
  18. package/dist/breadcrumb.js +2 -2
  19. package/dist/calendar-column-view.js +648 -30
  20. package/dist/calendar-column-view.js.map +1 -1
  21. package/dist/calendar-drag-IXMPZrTN.js +344 -0
  22. package/dist/calendar-drag-IXMPZrTN.js.map +1 -0
  23. package/dist/{calendar-event-_OYdAT3c.js → calendar-event-BQChlMXy.js} +15 -4
  24. package/dist/calendar-event-BQChlMXy.js.map +1 -0
  25. package/dist/calendar-header-DVrfThwr.js +59 -0
  26. package/dist/calendar-header-DVrfThwr.js.map +1 -0
  27. package/dist/calendar-month-view.js +311 -21
  28. package/dist/calendar-month-view.js.map +1 -1
  29. package/dist/calendar-timeline.js +1877 -0
  30. package/dist/calendar-timeline.js.map +1 -0
  31. package/dist/calendar.js +224 -62
  32. package/dist/calendar.js.map +1 -1
  33. package/dist/{canvas-base-CjxNdEsR.js → canvas-base-BjiU3Ecl.js} +2 -2
  34. package/dist/{canvas-base-CjxNdEsR.js.map → canvas-base-BjiU3Ecl.js.map} +1 -1
  35. package/dist/carousel.js +2 -2
  36. package/dist/{cartesian-chart-D30aTNVm.js → cartesian-chart-iE3cmeGF.js} +2 -2
  37. package/dist/{cartesian-chart-D30aTNVm.js.map → cartesian-chart-iE3cmeGF.js.map} +1 -1
  38. package/dist/{cb-group-base-BhWC78b0.js → cb-group-base-CWctDJvy.js} +2 -2
  39. package/dist/{cb-group-base-BhWC78b0.js.map → cb-group-base-CWctDJvy.js.map} +1 -1
  40. package/dist/cb-group.js +3 -3
  41. package/dist/cb-rule.js +3 -3
  42. package/dist/chart-area.js +4 -4
  43. package/dist/chart-bar.js +4 -4
  44. package/dist/{chart-base-D2kPte5J.js → chart-base-CDyVDmz7.js} +2 -2
  45. package/dist/{chart-base-D2kPte5J.js.map → chart-base-CDyVDmz7.js.map} +1 -1
  46. package/dist/chart-doughnut.js +3 -3
  47. package/dist/chart-line.js +4 -4
  48. package/dist/chart-pie.js +3 -3
  49. package/dist/chat-event.js +2 -2
  50. package/dist/chat-message.js +2 -2
  51. package/dist/chat-thread.js +2 -2
  52. package/dist/checkbox-group.js +3 -3
  53. package/dist/checkbox.js +3 -3
  54. package/dist/chip-set.js +2 -2
  55. package/dist/chip.js +2 -2
  56. package/dist/circular-progress.js +3 -3
  57. package/dist/citation.js +2 -2
  58. package/dist/code-editor.js +3 -3
  59. package/dist/code-highlighter.js +2 -2
  60. package/dist/color-field.js +4 -4
  61. package/dist/color-picker.js +2 -2
  62. package/dist/command-palette.js +2 -2
  63. package/dist/comment-composer.js +4 -4
  64. package/dist/condition-builder.js +3 -3
  65. package/dist/confirm-dialog.js +2 -2
  66. package/dist/copy-button.js +2 -2
  67. package/dist/currency-field.js +4 -4
  68. package/dist/custom-elements-jsdocs.json +52 -129
  69. package/dist/custom-elements.json +3109 -5
  70. package/dist/{date-vFrYT1S9.js → date-cfPx3alz.js} +20 -3
  71. package/dist/date-cfPx3alz.js.map +1 -0
  72. package/dist/date-field.js +8 -8
  73. package/dist/date-picker.js +4 -4
  74. package/dist/date-range-field.js +8 -8
  75. package/dist/datetime-field.js +7 -7
  76. package/dist/dependency-map.js +3 -3
  77. package/dist/description-item.js +2 -2
  78. package/dist/description-list.js +2 -2
  79. package/dist/{diagram-BFGq2POp.js → diagram-D2aM93kf.js} +2 -2
  80. package/dist/{diagram-BFGq2POp.js.map → diagram-D2aM93kf.js.map} +1 -1
  81. package/dist/diagram-controls.js +2 -2
  82. package/dist/diagram-minimap.js +2 -2
  83. package/dist/diagram.js +4 -4
  84. package/dist/diff-viewer.js +2 -2
  85. package/dist/discussion-activity.js +2 -2
  86. package/dist/discussion-comment.js +2 -2
  87. package/dist/discussion.js +4 -4
  88. package/dist/{document-editor-CC7MTHMO.js → document-editor-BS6al7Hq.js} +2 -2
  89. package/dist/{document-editor-CC7MTHMO.js.map → document-editor-BS6al7Hq.js.map} +1 -1
  90. package/dist/document-editor.js +3 -3
  91. package/dist/draft-card.js +2 -2
  92. package/dist/erd.js +3 -3
  93. package/dist/{event-manager-CWAWPOUE.js → event-manager-KGMT2x2Q.js} +10 -8
  94. package/dist/event-manager-KGMT2x2Q.js.map +1 -0
  95. package/dist/file-upload.js +3 -3
  96. package/dist/filter-bar.js +4 -4
  97. package/dist/flow.js +4 -4
  98. package/dist/form.js +2 -2
  99. package/dist/{generative-view-DoT9YwHL.js → generative-view-DsSOPf26.js} +2 -2
  100. package/dist/{generative-view-DoT9YwHL.js.map → generative-view-DsSOPf26.js.map} +1 -1
  101. package/dist/generative-view.js +3 -3
  102. package/dist/html-editor.js +4 -4
  103. package/dist/{i18n-controller-Co6pasNo.js → i18n-controller-BTeChxE0.js} +2 -2
  104. package/dist/{i18n-controller-Co6pasNo.js.map → i18n-controller-BTeChxE0.js.map} +1 -1
  105. package/dist/image.js +2 -2
  106. package/dist/index.js +26 -23
  107. package/dist/index.js.map +1 -1
  108. package/dist/inline-edit.js +2 -2
  109. package/dist/input.js +3 -3
  110. package/dist/json-viewer.js +2 -2
  111. package/dist/kanban.js +2 -2
  112. package/dist/kbd.js +2 -2
  113. package/dist/linear-progress.js +3 -3
  114. package/dist/listbox.js +2 -2
  115. package/dist/loader-full.js +13 -13
  116. package/dist/loader.js +17 -13
  117. package/dist/loader.js.map +1 -1
  118. package/dist/markdown-editor.js +4 -4
  119. package/dist/mention-input.js +4 -4
  120. package/dist/modal.js +2 -2
  121. package/dist/navigation-bar.js +2 -2
  122. package/dist/navigation-drawer.js +2 -2
  123. package/dist/navigation-rail.js +2 -2
  124. package/dist/notification-center.js +2 -2
  125. package/dist/number-field.js +4 -4
  126. package/dist/page-header.js +2 -2
  127. package/dist/pagination.js +2 -2
  128. package/dist/password-field.js +4 -4
  129. package/dist/password-rules.js +2 -2
  130. package/dist/phone-field.js +4 -4
  131. package/dist/{picker-field-BliKNENo.js → picker-field-DmXYPvbF.js} +3 -3
  132. package/dist/{picker-field-BliKNENo.js.map → picker-field-DmXYPvbF.js.map} +1 -1
  133. package/dist/pin-input.js +4 -4
  134. package/dist/presence-indicator.js +2 -2
  135. package/dist/prompt-input.js +4 -4
  136. package/dist/radio.js +3 -3
  137. package/dist/{range-utils-BoKOhxVX.js → range-utils-DZe96GnO.js} +2 -2
  138. package/dist/{range-utils-BoKOhxVX.js.map → range-utils-DZe96GnO.js.map} +1 -1
  139. package/dist/rating.js +3 -3
  140. package/dist/redvars-loader.js +2 -2
  141. package/dist/relative-time.js +2 -2
  142. package/dist/resizable-panels.js +2 -2
  143. package/dist/{rich-text-input-YeqK1or-.js → rich-text-input-BCZ46UF8.js} +3 -3
  144. package/dist/{rich-text-input-YeqK1or-.js.map → rich-text-input-BCZ46UF8.js.map} +1 -1
  145. package/dist/{schema-CuHBNpzo.js → schema-D0PCeIEA.js} +2 -2
  146. package/dist/{schema-CuHBNpzo.js.map → schema-D0PCeIEA.js.map} +1 -1
  147. package/dist/search.js +3 -3
  148. package/dist/select.js +4 -4
  149. package/dist/side-sheet.js +2 -2
  150. package/dist/signature-pad.js +3 -3
  151. package/dist/site-header.js +2 -2
  152. package/dist/slider.js +3 -3
  153. package/dist/snackbar.js +2 -2
  154. package/dist/sparkline.js +2 -2
  155. package/dist/split-button.js +2 -2
  156. package/dist/src/__internal/i18n/strings.d.ts +20 -0
  157. package/dist/src/__internal/utils/date.d.ts +5 -0
  158. package/dist/src/calendar/base-event.d.ts +5 -0
  159. package/dist/src/calendar/calendar-column-view.d.ts +65 -1
  160. package/dist/src/calendar/calendar-drag.d.ts +91 -0
  161. package/dist/src/calendar/calendar-header.d.ts +28 -0
  162. package/dist/src/calendar/calendar-month-view.d.ts +39 -1
  163. package/dist/src/calendar/calendar.d.ts +83 -6
  164. package/dist/src/calendar/index.d.ts +2 -2
  165. package/dist/src/calendar/types.d.ts +32 -0
  166. package/dist/src/calendar/utils.d.ts +53 -0
  167. package/dist/src/calendar-timeline/calendar-timeline.d.ts +287 -0
  168. package/dist/src/calendar-timeline/index.d.ts +3 -0
  169. package/dist/src/calendar-timeline/layout.d.ts +39 -0
  170. package/dist/src/calendar-timeline/types.d.ts +60 -0
  171. package/dist/src/index.d.ts +4 -2
  172. package/dist/src/workflow/workflow-model.d.ts +12 -3
  173. package/dist/stat.js +2 -2
  174. package/dist/status-indicator.js +2 -2
  175. package/dist/step.js +2 -2
  176. package/dist/stepper.js +2 -2
  177. package/dist/{strings-DYwXSSu_.js → strings-DeiQWMd9.js} +22 -1
  178. package/dist/strings-DeiQWMd9.js.map +1 -0
  179. package/dist/svg.js +2 -2
  180. package/dist/switch.js +3 -3
  181. package/dist/table.js +2 -2
  182. package/dist/test/calendar-timeline.test.d.ts +1 -0
  183. package/dist/textarea.js +4 -4
  184. package/dist/time-field.js +7 -7
  185. package/dist/time-picker.js +4 -4
  186. package/dist/timeline-item.js +2 -2
  187. package/dist/timeline.js +2 -2
  188. package/dist/{toggle-base-B-HOnUIy.js → toggle-base-BtjRAZ5z.js} +2 -2
  189. package/dist/{toggle-base-B-HOnUIy.js.map → toggle-base-BtjRAZ5z.js.map} +1 -1
  190. package/dist/tour.js +2 -2
  191. package/dist/transfer-list.js +3 -3
  192. package/dist/tree-chart.js +3 -3
  193. package/dist/tree-item.js +2 -2
  194. package/dist/tree.js +2 -2
  195. package/dist/tsconfig.tsbuildinfo +1 -1
  196. package/dist/typing-indicator.js +2 -2
  197. package/dist/url-field.js +4 -4
  198. package/dist/user-menu.js +2 -2
  199. package/dist/{utils-D92ldd1V.js → utils-DcvLgexs.js} +116 -19
  200. package/dist/utils-DcvLgexs.js.map +1 -0
  201. package/dist/{video-u-Vs7M9g.js → video-DPjOBk6I.js} +2 -2
  202. package/dist/{video-u-Vs7M9g.js.map → video-DPjOBk6I.js.map} +1 -1
  203. package/dist/video.js +3 -3
  204. package/dist/virtual-list.js +2 -2
  205. package/dist/workflow-model-CauduOG2.js.map +1 -1
  206. package/dist/workflow-timeline.js +2 -2
  207. package/dist/workflow.js +16 -5
  208. package/dist/workflow.js.map +1 -1
  209. package/dist/workspace-switcher.js +2 -2
  210. package/package.json +1 -1
  211. package/readme.md +1 -0
  212. package/src/__internal/i18n/strings.ts +29 -0
  213. package/src/__internal/utils/date.ts +19 -0
  214. package/src/calendar/_calendar-header.scss +33 -0
  215. package/src/calendar/base-event.ts +19 -2
  216. package/src/calendar/calendar-column-view.scss +174 -2
  217. package/src/calendar/calendar-column-view.ts +665 -37
  218. package/src/calendar/calendar-drag.ts +403 -0
  219. package/src/calendar/calendar-header.ts +78 -0
  220. package/src/calendar/calendar-month-view.scss +89 -0
  221. package/src/calendar/calendar-month-view.ts +289 -23
  222. package/src/calendar/calendar.scss +2 -27
  223. package/src/calendar/calendar.ts +264 -62
  224. package/src/calendar/event-manager.ts +11 -7
  225. package/src/calendar/index.ts +8 -2
  226. package/src/calendar/types.ts +35 -0
  227. package/src/calendar/utils.ts +160 -20
  228. package/src/calendar-timeline/calendar-timeline.scss +554 -0
  229. package/src/calendar-timeline/calendar-timeline.ts +1528 -0
  230. package/src/calendar-timeline/index.ts +14 -0
  231. package/src/calendar-timeline/layout.ts +129 -0
  232. package/src/calendar-timeline/types.ts +65 -0
  233. package/src/index.ts +18 -0
  234. package/src/loader.ts +4 -0
  235. package/src/workflow/workflow-model.ts +12 -3
  236. package/src/workflow/workflow.scss +5 -0
  237. package/src/workflow/workflow.ts +10 -2
  238. package/dist/calendar-event-_OYdAT3c.js.map +0 -1
  239. package/dist/date-vFrYT1S9.js.map +0 -1
  240. package/dist/event-manager-CWAWPOUE.js.map +0 -1
  241. package/dist/strings-DYwXSSu_.js.map +0 -1
  242. package/dist/utils-D92ldd1V.js.map +0 -1
@@ -1,10 +1,13 @@
1
1
  import { i, _ as __decorate, I as IndividualComponent, a as i$1, A, b } from './IndividualComponent-BK7XZjE2.js';
2
2
  import { n } from './property-B2TG3KEE.js';
3
3
  import { r } from './state-BCeDVCI9.js';
4
- import { g as getTimePercent, c as calculateDateRange, d as startOfDay, e as endOfDay, h as differenceInDays, a as addDays, f as formatDate, o as onActivateKey, i as addHours, j as formatEventLabel, L as LONG_EVENT_PADDING } from './utils-D92ldd1V.js';
5
- import { B as BaseEvent } from './calendar-event-_OYdAT3c.js';
6
- import { E as EventManager } from './event-manager-CWAWPOUE.js';
4
+ import { e } from './class-map-NDIkZErE.js';
5
+ import { j as getTimePercent, k as calculateDateRange, b as startOfDay, n as nextDay, r as rangesOverlap, d as differenceInDays, a as addDays, h as formatDate, m as timeAtFraction, o as snapTime, p as clamp, M as MINUTE_MS, q as onActivateKey, l as lastDayOf, u as addHours, g as formatEventLabel, v as formatTimeRange, L as LONG_EVENT_PADDING } from './utils-DcvLgexs.js';
6
+ import { C as CalendarDragController, n as nearestIndex, d as dragByDays } from './calendar-drag-IXMPZrTN.js';
7
+ import { E as EventManager } from './event-manager-KGMT2x2Q.js';
7
8
  import { r as resolveLocale } from './locale-DEsJZCQG.js';
9
+ import './directive-ZPhl09Yt.js';
10
+ import './calendar-event-BQChlMXy.js';
8
11
 
9
12
  var css_248z = i`@charset "UTF-8";
10
13
  * {
@@ -150,8 +153,11 @@ var css_248z = i`@charset "UTF-8";
150
153
  .multi-day-section-wrapper .multi-day-background .columns .column:first-child {
151
154
  border-inline-start: 0;
152
155
  }
156
+ .multi-day-section-wrapper .multi-day-background .columns .column.drop-target {
157
+ background: color-mix(in srgb, var(--color-primary) 12%, transparent);
158
+ }
153
159
  .multi-day-section-wrapper .multi-events {
154
- padding: 0 0 0 var(--scale-size);
160
+ padding-inline-start: var(--scale-size);
155
161
  }
156
162
  .multi-day-section-wrapper .multi-events .row {
157
163
  height: 1.8rem;
@@ -322,14 +328,149 @@ var css_248z = i`@charset "UTF-8";
322
328
  .event.clickable:hover {
323
329
  background: var(--calendar-event-bg-color--hover);
324
330
  }
325
- .event.clickable:hover .event-title {
331
+ .event.clickable:hover .event-title,
332
+ .event.clickable:hover .resize-handle {
326
333
  color: var(--calendar-event-text-color--hover);
327
334
  }
328
335
  .event.clickable:focus-visible {
329
336
  outline: 2px solid var(--color-primary);
330
337
  outline-offset: 1px;
338
+ }
339
+
340
+ /* ── Editing ── */
341
+ .calendar-column-view.addable .drawing-area,
342
+ .calendar-column-view.addable .multi-day-section {
343
+ user-select: none;
344
+ -webkit-touch-callout: none;
345
+ }
346
+ .calendar-column-view.addable .multi-events {
347
+ min-height: 2rem;
348
+ }
349
+
350
+ .calendar-column-view.dragging {
351
+ user-select: none;
352
+ }
353
+ .calendar-column-view.dragging .event {
354
+ pointer-events: none;
355
+ }
356
+
357
+ .calendar-column-view.drag-move {
358
+ cursor: grabbing;
359
+ }
360
+
361
+ .calendar-column-view.drag-resize-y {
362
+ cursor: ns-resize;
363
+ }
364
+
365
+ .calendar-column-view.drag-resize-x {
366
+ cursor: ew-resize;
367
+ }
368
+
369
+ .event.editable {
370
+ cursor: grab;
371
+ user-select: none;
372
+ -webkit-touch-callout: none;
373
+ }
374
+ .event.drag-source {
375
+ opacity: 0.4;
376
+ }
377
+ .event.lifted {
378
+ z-index: 2;
379
+ overflow: hidden;
380
+ box-shadow: var(--elevation-level2);
381
+ }
382
+ .event.lifted .event-time {
383
+ white-space: normal;
384
+ }
385
+ .event.preview {
386
+ z-index: 2;
387
+ overflow: hidden;
388
+ pointer-events: none;
389
+ box-shadow: var(--elevation-level2);
390
+ }
391
+ .event.placeholder {
392
+ box-shadow: var(--elevation-level3);
393
+ }
394
+ .event .event-time {
395
+ padding: 0 0.375rem 0.25rem;
396
+ font-size: 0.75rem;
397
+ color: var(--calendar-event-text-color);
398
+ white-space: nowrap;
399
+ overflow: hidden;
400
+ text-overflow: ellipsis;
401
+ unicode-bidi: plaintext;
402
+ }
403
+
404
+ .resize-handle {
405
+ position: absolute;
406
+ z-index: 1;
407
+ color: var(--calendar-event-text-color);
408
+ }
409
+ .resize-handle::after {
410
+ content: "";
411
+ position: absolute;
412
+ margin: auto;
413
+ border-radius: var(--shape-corner-full);
414
+ background: currentColor;
415
+ opacity: 0;
416
+ transition: opacity 150ms ease;
417
+ }
418
+
419
+ .event.editable:hover .resize-handle::after,
420
+ .event.editable:focus-visible .resize-handle::after,
421
+ .event.lifted .resize-handle::after {
422
+ opacity: 0.6;
423
+ }
424
+
425
+ .events-container .resize-handle {
426
+ inset-inline: 0;
427
+ block-size: 0.375rem;
428
+ cursor: ns-resize;
429
+ }
430
+ .events-container .resize-handle.start {
431
+ inset-block-start: 0;
432
+ }
433
+ .events-container .resize-handle.end {
434
+ inset-block-end: 0;
435
+ }
436
+ .events-container .resize-handle::after {
437
+ inset: 0;
438
+ inline-size: 1rem;
439
+ block-size: 0.125rem;
440
+ }
441
+
442
+ .multi-events .resize-handle {
443
+ inset-block: 0;
444
+ inline-size: 0.375rem;
445
+ cursor: ew-resize;
446
+ }
447
+ .multi-events .resize-handle.start {
448
+ inset-inline-start: 0;
449
+ }
450
+ .multi-events .resize-handle.end {
451
+ inset-inline-end: 0;
452
+ }
453
+ .multi-events .resize-handle::after {
454
+ inset: 0;
455
+ inline-size: 0.125rem;
456
+ block-size: 0.875rem;
457
+ }
458
+
459
+ @media (forced-colors: active) {
460
+ .event.preview,
461
+ .event.lifted {
462
+ outline: 2px solid Highlight;
463
+ }
464
+ .multi-day-background .column.drop-target {
465
+ outline: 2px solid Highlight;
466
+ outline-offset: -2px;
467
+ }
331
468
  }`;
332
469
 
470
+ /** Events shorter than this have no handle at their start, so there is room to grab them. */
471
+ const START_HANDLE_MIN_MS = 30 * MINUTE_MS;
472
+ /** Previews shorter than this show their title and times on one line. */
473
+ const COMPACT_PREVIEW_MS = 45 * MINUTE_MS;
333
474
  /**
334
475
  * @internal
335
476
  *
@@ -344,9 +485,13 @@ var css_248z = i`@charset "UTF-8";
344
485
  * that open the day; events are buttons labelled with their title and time, or notes that cannot
345
486
  * be focused when <code>events-readonly</code> is set. Events lasting a day or more are shown in a
346
487
  * row above the hours.</p>
488
+ * <p>With <code>editable</code>, events are dragged to move them and their edges to resize them;
489
+ * with <code>addable</code>, dragging across empty time or clicking it asks for a new event.</p>
347
490
  *
348
491
  * @fires date-click - Internal, does not bubble; a day number was chosen. Detail contains `{ date }`.
349
492
  * @fires event-click - Internal, does not bubble; `wc-calendar` re-fires it. Detail contains `{ event }`.
493
+ * @fires event-change - Internal, does not bubble; an event was dropped at a new time. `wc-calendar` re-fires it.
494
+ * @fires event-add - Internal, does not bubble; a range of empty time was drawn or clicked. `wc-calendar` re-fires it.
350
495
  */
351
496
  let CalendarColumnView = class CalendarColumnView extends i$1 {
352
497
  constructor() {
@@ -361,6 +506,20 @@ let CalendarColumnView = class CalendarColumnView extends i$1 {
361
506
  this.days = 7;
362
507
  /** Events are shown but cannot be clicked or focused. */
363
508
  this.eventsReadonly = false;
509
+ /** Events can be moved and resized by dragging. */
510
+ this.editable = false;
511
+ /** Dragging across empty time, or clicking it, asks for a new event. */
512
+ this.addable = false;
513
+ /** Minutes that drags move timed events and their edges by. */
514
+ this.minuteStep = 15;
515
+ /** Minutes an event added by a click lasts. */
516
+ this.defaultDuration = 60;
517
+ /** A range waiting for its new event, drawn as one. */
518
+ this.placeholder = null;
519
+ /** Title shown for an event without one. */
520
+ this.untitledLabel = '(no title)';
521
+ /** Title of the block that marks a new event. */
522
+ this.newEventLabel = 'New event';
364
523
  /** Now, which places the current-time line and marks today. */
365
524
  this.currentTime = new Date();
366
525
  /** A date in the range to show. */
@@ -380,6 +539,21 @@ let CalendarColumnView = class CalendarColumnView extends i$1 {
380
539
  this.singleDayEvents = {};
381
540
  /** Rows of events lasting a day or more. */
382
541
  this.multiDayEvents = [];
542
+ /** The drag in progress, where it would put its event. */
543
+ this._preview = null;
544
+ // ── Private fields
545
+ this._drag = new CalendarDragController(this, {
546
+ lift: () => this._blurFocused(),
547
+ move: (press, point) => this._follow(press, point),
548
+ drop: (press, point) => this._drop(press, point),
549
+ cancel: () => {
550
+ this._preview = null;
551
+ },
552
+ tap: press => this._tap(press),
553
+ scrollers: press => [
554
+ this.renderRoot.querySelector(press.section === 'timed' ? '.view-body' : '.multi-day-section-scroll'),
555
+ ],
556
+ });
383
557
  }
384
558
  // ── Lifecycle
385
559
  connectedCallback() {
@@ -397,6 +571,7 @@ let CalendarColumnView = class CalendarColumnView extends i$1 {
397
571
  }
398
572
  willUpdate(changed) {
399
573
  super.willUpdate(changed);
574
+ this._drag.enabled = this.addable || (this.editable && this._interactive);
400
575
  if (changed.has('events') ||
401
576
  changed.has('contextDate') ||
402
577
  changed.has('view') ||
@@ -404,6 +579,17 @@ let CalendarColumnView = class CalendarColumnView extends i$1 {
404
579
  changed.has('weekStartsOn')) {
405
580
  this._processEvents();
406
581
  }
582
+ // A drag cannot outlive the days it started on, or editing being turned off.
583
+ if (this._drag.pressing &&
584
+ (changed.has('contextDate') ||
585
+ changed.has('view') ||
586
+ changed.has('days') ||
587
+ changed.has('weekStartsOn') ||
588
+ changed.has('editable') ||
589
+ changed.has('addable') ||
590
+ changed.has('eventsReadonly'))) {
591
+ this._drag.abort();
592
+ }
407
593
  }
408
594
  // ── Private methods
409
595
  get _interactive() {
@@ -413,18 +599,37 @@ let CalendarColumnView = class CalendarColumnView extends i$1 {
413
599
  get _locale() {
414
600
  return resolveLocale(this.locale, this);
415
601
  }
602
+ /** `minuteStep` when it is a whole number of minutes in a day, else 15. */
603
+ get _step() {
604
+ const step = Math.round(this.minuteStep);
605
+ return Number.isFinite(step) && step >= 1 ? Math.min(step, 1440) : 15;
606
+ }
607
+ /** `defaultDuration` when it is a positive number of minutes, else 60. */
608
+ get _duration() {
609
+ const minutes = Math.round(this.defaultDuration);
610
+ return Number.isFinite(minutes) && minutes >= 1 ? minutes : 60;
611
+ }
612
+ /** Whether an event can be dragged: the view is editable and the event did not opt out. */
613
+ _canEdit(node) {
614
+ const data = node.data;
615
+ return this.editable && this._interactive && data?.editable !== false;
616
+ }
416
617
  _processEvents() {
417
618
  this.dateRange = calculateDateRange(this.view, this.contextDate, this.days, this.weekStartsOn);
418
619
  this.singleDayEvents = {};
419
620
  this._forEachDayInRange(i => {
621
+ const dayStart = startOfDay(i);
622
+ const dayEnd = nextDay(dayStart);
420
623
  const manager = new EventManager();
421
- manager.addEvents(this.events.filter(event => event.isOverlapping(new BaseEvent(startOfDay(i), endOfDay(i))) &&
422
- event.length() < 86400000));
624
+ manager.addEvents(this.events.filter(event => !event.isAllDay() &&
625
+ rangesOverlap(event.start, event.end, dayStart, dayEnd)));
423
626
  manager.process();
424
627
  this.singleDayEvents[this._getDateOnly(i)] = manager.columns;
425
628
  });
629
+ const rangeEnd = nextDay(this.dateRange.endDate);
426
630
  const multiManager = new EventManager();
427
- multiManager.addEvents(this.events.filter(event => event.isOverlapping(new BaseEvent(this.dateRange.startDate, this.dateRange.endDate)) && event.length() >= 86400000));
631
+ multiManager.addEvents(this.events.filter(event => event.isAllDay() &&
632
+ rangesOverlap(event.start, event.end, this.dateRange.startDate, rangeEnd)));
428
633
  multiManager.process();
429
634
  this.multiDayEvents = multiManager.columns;
430
635
  }
@@ -469,6 +674,12 @@ let CalendarColumnView = class CalendarColumnView extends i$1 {
469
674
  _emitEventClick(event) {
470
675
  this.dispatchEvent(new CustomEvent('event-click', { detail: { event } }));
471
676
  }
677
+ _emitChange(detail) {
678
+ this.dispatchEvent(new CustomEvent('event-change', { detail }));
679
+ }
680
+ _emitAdd(detail) {
681
+ this.dispatchEvent(new CustomEvent('event-add', { detail }));
682
+ }
472
683
  /** Accessible name of the view: the dates it shows. */
473
684
  _rangeLabel() {
474
685
  const { startDate, endDate } = this.dateRange;
@@ -487,6 +698,236 @@ let CalendarColumnView = class CalendarColumnView extends i$1 {
487
698
  .map(([k, v]) => `${k}:${v}`)
488
699
  .join(';');
489
700
  }
701
+ // ── Drag and drop
702
+ /** The day columns of a section. */
703
+ _columnsOf(section) {
704
+ return [
705
+ ...this.renderRoot.querySelectorAll(section === 'timed'
706
+ ? '.events-container > .column'
707
+ : '.multi-day-background .columns > .column'),
708
+ ];
709
+ }
710
+ /** The day of the column nearest `x`; with `within`, only a column that spans `x`. */
711
+ _dayAt(section, x, within = false) {
712
+ const columns = this._columnsOf(section);
713
+ const index = nearestIndex(columns, x);
714
+ if (index < 0)
715
+ return null;
716
+ if (within) {
717
+ const rect = columns[index].getBoundingClientRect();
718
+ if (x < rect.left || x > rect.right)
719
+ return null;
720
+ }
721
+ return startOfDay(addDays(this.dateRange.startDate, index));
722
+ }
723
+ /** The time at `y` in `day`'s column of the hours. */
724
+ _timeAt(day, y) {
725
+ const rect = this.renderRoot
726
+ .querySelector('.events-container')
727
+ ?.getBoundingClientRect();
728
+ if (!rect || rect.height <= 0)
729
+ return startOfDay(day);
730
+ return timeAtFraction(day, (y - rect.top) / rect.height);
731
+ }
732
+ _onEventPointerDown(event, node, section) {
733
+ if (!this._canEdit(node))
734
+ return;
735
+ const handle = event.target instanceof Element
736
+ ? event.target.closest('[data-handle]')?.dataset.handle
737
+ : undefined;
738
+ let action = 'move';
739
+ if (handle === 'start')
740
+ action = 'resize-start';
741
+ else if (handle === 'end')
742
+ action = 'resize-end';
743
+ const day = this._dayAt(section, event.clientX) ?? startOfDay(node.start);
744
+ this._drag.start(event, {
745
+ action,
746
+ section,
747
+ event: node,
748
+ day,
749
+ time: section === 'timed' ? this._timeAt(day, event.clientY) : day,
750
+ });
751
+ }
752
+ _onSectionPointerDown(event, section) {
753
+ if (!this.addable || this._drag.pressing)
754
+ return;
755
+ // Presses on events are theirs, even on events that cannot be dragged.
756
+ const onEvent = event
757
+ .composedPath()
758
+ .some(target => target instanceof HTMLElement && target.classList.contains('event'));
759
+ if (onEvent)
760
+ return;
761
+ const day = this._dayAt(section, event.clientX, true);
762
+ if (!day)
763
+ return;
764
+ this._drag.start(event, {
765
+ action: 'add',
766
+ section,
767
+ day,
768
+ time: section === 'timed' ? this._timeAt(day, event.clientY) : day,
769
+ });
770
+ }
771
+ /** Where the drag of `press` would put its event with the pointer at `point`. */
772
+ _previewFor(press, point) {
773
+ const { event } = press;
774
+ const range = press.section === 'timed'
775
+ ? this._timedRange(press, point)
776
+ : dragByDays(press.action, press.day, this._dayAt('all-day', point.x) ?? press.day, event);
777
+ if (!range)
778
+ return null;
779
+ return {
780
+ action: press.action,
781
+ section: press.section,
782
+ data: event?.data,
783
+ title: event ? event.title || this.untitledLabel : this.newEventLabel,
784
+ color: event?.color,
785
+ ...range,
786
+ };
787
+ }
788
+ /** The range a drag in the hours gives, snapped to `minuteStep`. */
789
+ _timedRange(press, point) {
790
+ const step = this._step;
791
+ const stepMs = step * MINUTE_MS;
792
+ const { event } = press;
793
+ if (press.action === 'add') {
794
+ // The slot pressed is always part of the range; the drag stays in its day.
795
+ const time = this._timeAt(press.day, point.y);
796
+ const anchor = snapTime(press.time, step, 'floor');
797
+ const dayEnd = nextDay(press.day).valueOf();
798
+ if (time.valueOf() >= anchor.valueOf()) {
799
+ const end = Math.max(snapTime(time, step, 'ceil', press.day).valueOf(), anchor.valueOf() + stepMs);
800
+ return { start: anchor, end: new Date(Math.min(end, dayEnd)) };
801
+ }
802
+ return {
803
+ start: snapTime(time, step, 'floor', press.day),
804
+ end: new Date(Math.min(anchor.valueOf() + stepMs, dayEnd)),
805
+ };
806
+ }
807
+ if (!event)
808
+ return null;
809
+ if (press.action === 'move') {
810
+ // The point the event was grabbed by follows the pointer, so the event keeps its length and
811
+ // may run past midnight; at least a step of it stays in the column under the pointer.
812
+ const day = this._dayAt('timed', point.x) ?? press.day;
813
+ const length = event.length();
814
+ const visible = Math.min(stepMs, length);
815
+ const grab = press.time.valueOf() - event.start.valueOf();
816
+ const raw = new Date(this._timeAt(day, point.y).valueOf() - grab);
817
+ const start = clamp(snapTime(raw, step, 'round').valueOf(), startOfDay(day).valueOf() + visible - length, nextDay(day).valueOf() - visible);
818
+ return { start: new Date(start), end: new Date(start + length) };
819
+ }
820
+ if (press.action === 'resize-end') {
821
+ // The end stays on the day it is drawn on, at least one step after the start.
822
+ const endDay = event.lastDay();
823
+ const end = snapTime(this._timeAt(endDay, point.y), step, 'round', endDay).valueOf();
824
+ const min = event.start.valueOf() + stepMs;
825
+ const max = Math.max(nextDay(endDay).valueOf(), min);
826
+ return { start: event.start, end: new Date(clamp(end, min, max)) };
827
+ }
828
+ // resize-start: the start stays on its day, at least one step before the end.
829
+ const startDay = startOfDay(event.start);
830
+ const start = snapTime(this._timeAt(startDay, point.y), step, 'round', startDay).valueOf();
831
+ const max = event.end.valueOf() - stepMs;
832
+ return {
833
+ start: new Date(clamp(start, Math.min(startDay.valueOf(), max), max)),
834
+ end: event.end,
835
+ };
836
+ }
837
+ _follow(press, point) {
838
+ const preview = this._previewFor(press, point);
839
+ if (!preview)
840
+ return;
841
+ const current = this._preview;
842
+ if (current &&
843
+ current.start.valueOf() === preview.start.valueOf() &&
844
+ current.end.valueOf() === preview.end.valueOf()) {
845
+ return;
846
+ }
847
+ this._preview = preview;
848
+ }
849
+ _drop(press, point) {
850
+ const preview = this._previewFor(press, point) ?? this._preview;
851
+ this._preview = null;
852
+ if (!preview)
853
+ return;
854
+ const { start, end } = preview;
855
+ if (press.action === 'add') {
856
+ this._emitAdd({ start, end, allDay: press.section === 'all-day' });
857
+ return;
858
+ }
859
+ const { event } = press;
860
+ if (!event || !preview.data)
861
+ return;
862
+ if (start.valueOf() === event.start.valueOf() &&
863
+ end.valueOf() === event.end.valueOf()) {
864
+ return;
865
+ }
866
+ this._emitChange({
867
+ event: preview.data,
868
+ start,
869
+ end,
870
+ action: press.action === 'move' ? 'move' : 'resize',
871
+ });
872
+ }
873
+ /** A click on empty time adds an event there: `defaultDuration` long, or the whole day. */
874
+ _tap(press) {
875
+ if (press.action !== 'add')
876
+ return;
877
+ if (press.section === 'all-day') {
878
+ this._emitAdd({
879
+ start: press.day,
880
+ end: nextDay(press.day),
881
+ allDay: true,
882
+ });
883
+ return;
884
+ }
885
+ // Starts at the half hour clicked, the rows the grid draws.
886
+ const start = snapTime(press.time, Math.max(30, this._step), 'floor');
887
+ const dayEnd = nextDay(press.day).valueOf();
888
+ const end = new Date(Math.min(start.valueOf() + this._duration * MINUTE_MS, dayEnd));
889
+ this._emitAdd({ start, end, allDay: false });
890
+ }
891
+ /**
892
+ * Blurs the focused event when a drag starts. The drop redraws the events, and the element that
893
+ * held focus could then show another event, which Enter would open.
894
+ */
895
+ _blurFocused() {
896
+ const active = this.renderRoot.activeElement;
897
+ if (active instanceof HTMLElement)
898
+ active.blur();
899
+ }
900
+ /** How `node`'s blocks take part in the drag in progress. */
901
+ _dragRole(node, section) {
902
+ const preview = this._preview;
903
+ if (!preview?.data || preview.data !== node.data)
904
+ return null;
905
+ // A timed event moving between columns is drawn again where it lands.
906
+ return section === 'timed' && preview.action === 'move'
907
+ ? 'source'
908
+ : 'lifted';
909
+ }
910
+ /** The days the drag in progress, or the placeholder, covers in the all-day row. */
911
+ _allDayTarget() {
912
+ const preview = this._preview;
913
+ if (preview)
914
+ return preview.section === 'all-day' ? preview : null;
915
+ return this.placeholder?.allDay ? this.placeholder : null;
916
+ }
917
+ /** Classes of the view while a drag is in progress, which set the cursor. */
918
+ _rootClasses() {
919
+ const action = this._preview?.action;
920
+ const section = this._preview?.section;
921
+ const resizing = action === 'resize-start' || action === 'resize-end';
922
+ return {
923
+ 'calendar-column-view': true,
924
+ addable: this.addable,
925
+ dragging: !!action,
926
+ 'drag-move': action === 'move',
927
+ 'drag-resize-y': resizing && section === 'timed',
928
+ 'drag-resize-x': resizing && section === 'all-day',
929
+ };
930
+ }
490
931
  // ── Render helpers
491
932
  _renderHeader() {
492
933
  const locale = this._locale;
@@ -519,9 +960,16 @@ let CalendarColumnView = class CalendarColumnView extends i$1 {
519
960
  return columns;
520
961
  }
521
962
  _renderMultiDayBackground() {
963
+ const target = this._allDayTarget();
964
+ const first = target ? startOfDay(target.start).valueOf() : 0;
965
+ const last = target ? lastDayOf(target.start, target.end).valueOf() : -1;
522
966
  const columns = [];
523
967
  this._forEachDayInRange(i => {
524
- columns.push(b `<div class=${this._getDayClass(i)}></div>`);
968
+ const day = startOfDay(i).valueOf();
969
+ const covered = day >= first && day <= last;
970
+ columns.push(b `<div
971
+ class="${this._getDayClass(i)}${covered ? ' drop-target' : ''}"
972
+ ></div>`);
525
973
  });
526
974
  return columns;
527
975
  }
@@ -555,67 +1003,207 @@ let CalendarColumnView = class CalendarColumnView extends i$1 {
555
1003
  }
556
1004
  return b `<div class="background" aria-hidden="true">${rows}</div>`;
557
1005
  }
558
- /** One event block; `allDay` marks events lasting a day or more. */
559
- _renderEvent(node, position, allDay) {
1006
+ /** One event block. `start` and `end` are where it is drawn, which a resize changes. */
1007
+ _renderEvent(node, section, position, range, handles) {
560
1008
  const interactive = this._interactive;
1009
+ const editable = this._canEdit(node);
1010
+ const role = this._dragRole(node, section);
1011
+ const resizing = role === 'lifted' &&
1012
+ section === 'timed' &&
1013
+ this._preview?.action !== 'move';
561
1014
  const declarations = node.color
562
1015
  ? { ...position, ...this._colorVars(node.color) }
563
1016
  : position;
564
1017
  const activate = () => this._emitEventClick(node.data);
1018
+ const handle = (edge) => editable && handles.includes(edge)
1019
+ ? b `<div
1020
+ class="resize-handle ${edge}"
1021
+ data-handle=${edge}
1022
+ aria-hidden="true"
1023
+ ></div>`
1024
+ : A;
565
1025
  return b `
566
1026
  <div
567
- class=${interactive ? 'event clickable' : 'event'}
1027
+ class=${e({
1028
+ event: true,
1029
+ clickable: interactive,
1030
+ editable,
1031
+ 'drag-source': role === 'source',
1032
+ lifted: role === 'lifted',
1033
+ })}
568
1034
  style=${this._styleMap(declarations)}
569
1035
  role=${interactive ? 'button' : 'note'}
570
1036
  tabindex=${interactive ? '0' : A}
571
- aria-label=${formatEventLabel(node.title, node.start, node.end, this._locale, allDay)}
1037
+ aria-label=${formatEventLabel(node.title, node.start, node.end, this._locale, section === 'all-day')}
572
1038
  @click=${() => {
573
1039
  if (interactive)
574
1040
  activate();
575
1041
  }}
576
1042
  @keydown=${interactive ? onActivateKey(activate) : A}
1043
+ @pointerdown=${editable
1044
+ ? (event) => this._onEventPointerDown(event, node, section)
1045
+ : A}
577
1046
  >
1047
+ ${handle('start')}
578
1048
  <div class="event-title" aria-hidden="true">
579
- ${node.title || '(no title)'}
1049
+ ${node.title || this.untitledLabel}
580
1050
  </div>
1051
+ ${resizing
1052
+ ? b `<div class="event-time" aria-hidden="true">
1053
+ ${formatTimeRange(range.start, range.end, this._locale)}
1054
+ </div>`
1055
+ : A}
1056
+ ${handle('end')}
1057
+ </div>
1058
+ `;
1059
+ }
1060
+ /** A timed event's block in one day column, at its own times or those of its resize. */
1061
+ _renderTimedEvent(node, dayStart, dayEnd, columnIndex, columnCount) {
1062
+ const preview = this._preview;
1063
+ const resized = this._dragRole(node, 'timed') === 'lifted' && preview ? preview : null;
1064
+ const start = resized ? resized.start : node.start;
1065
+ const end = resized ? resized.end : node.end;
1066
+ const top = getTimePercent(start, dayStart);
1067
+ const bottom = getTimePercent(end, dayStart);
1068
+ // A block shows the handle of an edge only on the day that edge falls on. The event's own
1069
+ // times decide, not the resize's: removing the handle being dragged would strand a touch drag.
1070
+ const handles = [];
1071
+ if (node.start.valueOf() >= dayStart.valueOf() &&
1072
+ node.length() >= START_HANDLE_MIN_MS) {
1073
+ handles.push('start');
1074
+ }
1075
+ if (node.end.valueOf() <= dayEnd.valueOf())
1076
+ handles.push('end');
1077
+ return this._renderEvent(node, 'timed', {
1078
+ top: `${top}%`,
1079
+ height: `${bottom - top}%`,
1080
+ 'inset-inline-start': `${(columnIndex / columnCount) * 100}%`,
1081
+ width: `calc(${(node.width / columnCount) * 100}% - 1px)`,
1082
+ }, { start, end }, handles);
1083
+ }
1084
+ /** A new or moved timed event where the drag would put it, or the placeholder. */
1085
+ _renderTimedPreview(dayStart, dayEnd) {
1086
+ const preview = this._preview;
1087
+ let item = null;
1088
+ let placeholder = false;
1089
+ if (preview) {
1090
+ if (preview.section === 'timed' &&
1091
+ (preview.action === 'add' || preview.action === 'move')) {
1092
+ item = preview;
1093
+ }
1094
+ }
1095
+ else if (this.placeholder && !this.placeholder.allDay) {
1096
+ item = { ...this.placeholder, title: this.newEventLabel };
1097
+ placeholder = true;
1098
+ }
1099
+ if (!item || !rangesOverlap(item.start, item.end, dayStart, dayEnd)) {
1100
+ return A;
1101
+ }
1102
+ const top = getTimePercent(item.start, dayStart);
1103
+ const bottom = getTimePercent(item.end, dayStart);
1104
+ const position = {
1105
+ top: `${top}%`,
1106
+ height: `${bottom - top}%`,
1107
+ 'inset-inline-start': '0',
1108
+ width: 'calc(100% - 1px)',
1109
+ };
1110
+ const time = formatTimeRange(item.start, item.end, this._locale);
1111
+ const compact = item.end.valueOf() - item.start.valueOf() < COMPACT_PREVIEW_MS;
1112
+ return b `
1113
+ <div
1114
+ class=${e({ event: true, preview: true, placeholder })}
1115
+ style=${this._styleMap(item.color
1116
+ ? { ...position, ...this._colorVars(item.color) }
1117
+ : position)}
1118
+ aria-hidden="true"
1119
+ >
1120
+ ${compact
1121
+ ? b `<div class="event-title">${item.title}, ${time}</div>`
1122
+ : b `<div class="event-title">${item.title}</div>
1123
+ <div class="event-time">${time}</div>`}
581
1124
  </div>
582
1125
  `;
583
1126
  }
584
1127
  _renderEvents() {
585
1128
  const columns = [];
586
1129
  this._forEachDayInRange(i => {
587
- const cls = this._getDayClass(i);
1130
+ const dayStart = startOfDay(i);
1131
+ const dayEnd = nextDay(dayStart);
588
1132
  const eventDay = this.singleDayEvents[this._getDateOnly(i)];
589
1133
  columns.push(b `
590
- <div class=${cls}>
1134
+ <div class=${this._getDayClass(i)}>
591
1135
  <div class="column-content">
592
1136
  ${eventDay
593
- ? eventDay.map((nodes, columnIndex) => nodes.map(node => this._renderEvent(node, {
594
- top: `${getTimePercent(node.start, startOfDay(i))}%`,
595
- height: `${getTimePercent(node.end, startOfDay(i)) - getTimePercent(node.start, startOfDay(i))}%`,
596
- left: `${(columnIndex / eventDay.length) * 100}%`,
597
- width: `calc(${((1 * node.width) / eventDay.length) * 100}% - 1px)`,
598
- }, false)))
1137
+ ? eventDay.map((nodes, columnIndex) => nodes.map(node => this._renderTimedEvent(node, dayStart, dayEnd, columnIndex, eventDay.length)))
599
1138
  : A}
1139
+ ${this._renderTimedPreview(dayStart, dayEnd)}
600
1140
  </div>
601
1141
  </div>
602
1142
  `);
603
1143
  });
604
1144
  return b `<div class="events-container">${columns}</div>`;
605
1145
  }
1146
+ /** Position of a bar in the all-day row covering the days of `start`–`end`. */
1147
+ _allDayPosition(start, end) {
1148
+ const from = this._getDatePercent(start);
1149
+ const to = this._getDatePercent(nextDay(lastDayOf(start, end)));
1150
+ return {
1151
+ 'inset-inline-start': `${from + LONG_EVENT_PADDING}%`,
1152
+ width: `${to - from - 2 * LONG_EVENT_PADDING}%`,
1153
+ };
1154
+ }
1155
+ _renderAllDayEvent(node) {
1156
+ const preview = this._preview;
1157
+ const dragged = this._dragRole(node, 'all-day') === 'lifted' && preview ? preview : null;
1158
+ const start = dragged ? dragged.start : node.start;
1159
+ const end = dragged ? dragged.end : node.end;
1160
+ // Edges outside the days shown cannot be dragged. The event's own days decide, so the handle
1161
+ // being dragged stays while the bar moves.
1162
+ const handles = [];
1163
+ if (startOfDay(node.start).valueOf() >=
1164
+ startOfDay(this.dateRange.startDate).valueOf()) {
1165
+ handles.push('start');
1166
+ }
1167
+ if (node.lastDay().valueOf() <= startOfDay(this.dateRange.endDate).valueOf()) {
1168
+ handles.push('end');
1169
+ }
1170
+ return this._renderEvent(node, 'all-day', this._allDayPosition(start, end), { start, end }, handles);
1171
+ }
606
1172
  _renderMultiDayEvents() {
607
- if (!this.multiDayEvents || !this.multiDayEvents.length)
1173
+ const preview = this._preview;
1174
+ let adding = null;
1175
+ if (preview) {
1176
+ if (preview.section === 'all-day' && preview.action === 'add') {
1177
+ adding = { start: preview.start, end: preview.end, placeholder: false };
1178
+ }
1179
+ }
1180
+ else if (this.placeholder?.allDay) {
1181
+ adding = { ...this.placeholder, placeholder: true };
1182
+ }
1183
+ if (!this.multiDayEvents.length && !adding)
608
1184
  return A;
609
1185
  return b `
610
1186
  <div class="row-content">
611
1187
  ${this.multiDayEvents.map(nodes => b `
612
1188
  <div class="row">
613
- ${nodes.map(node => this._renderEvent(node, {
614
- left: `${this._getDatePercent(node.start) + LONG_EVENT_PADDING}%`,
615
- width: `${this._getDatePercent(addDays(node.end, 1)) - this._getDatePercent(node.start) - 2 * LONG_EVENT_PADDING}%`,
616
- }, true))}
1189
+ ${nodes.map(node => this._renderAllDayEvent(node))}
617
1190
  </div>
618
1191
  `)}
1192
+ ${adding
1193
+ ? b `<div class="row">
1194
+ <div
1195
+ class=${e({
1196
+ event: true,
1197
+ preview: true,
1198
+ placeholder: adding.placeholder,
1199
+ })}
1200
+ style=${this._styleMap(this._allDayPosition(adding.start, adding.end))}
1201
+ aria-hidden="true"
1202
+ >
1203
+ <div class="event-title">${this.newEventLabel}</div>
1204
+ </div>
1205
+ </div>`
1206
+ : A}
619
1207
  <div class="row-spacer"></div>
620
1208
  </div>
621
1209
  `;
@@ -655,7 +1243,7 @@ let CalendarColumnView = class CalendarColumnView extends i$1 {
655
1243
  render() {
656
1244
  return b `
657
1245
  <div
658
- class="calendar-column-view"
1246
+ class=${e(this._rootClasses())}
659
1247
  role="region"
660
1248
  aria-label=${this._rangeLabel()}
661
1249
  >
@@ -666,7 +1254,10 @@ let CalendarColumnView = class CalendarColumnView extends i$1 {
666
1254
  </div>
667
1255
  <div class="multi-day-section-wrapper">
668
1256
  <div class="multi-day-section-scroll">
669
- <div class="multi-day-section">
1257
+ <div
1258
+ class="multi-day-section"
1259
+ @pointerdown=${(event) => this._onSectionPointerDown(event, 'all-day')}
1260
+ >
670
1261
  <div class="multi-day-background" aria-hidden="true">
671
1262
  <div class="scale"></div>
672
1263
  <div class="columns">${this._renderMultiDayBackground()}</div>
@@ -678,7 +1269,10 @@ let CalendarColumnView = class CalendarColumnView extends i$1 {
678
1269
  <div class="view-body">
679
1270
  <div class="view-body-scroll">
680
1271
  <div class="scale">${this._renderScale()}</div>
681
- <div class="drawing-area">
1272
+ <div
1273
+ class="drawing-area"
1274
+ @pointerdown=${(event) => this._onSectionPointerDown(event, 'timed')}
1275
+ >
682
1276
  ${this._renderBackgroundGrid()} ${this._renderEvents()}
683
1277
  </div>
684
1278
  ${this._renderCurrentTime()}
@@ -701,6 +1295,27 @@ __decorate([
701
1295
  __decorate([
702
1296
  n({ type: Boolean, attribute: 'events-readonly' })
703
1297
  ], CalendarColumnView.prototype, "eventsReadonly", void 0);
1298
+ __decorate([
1299
+ n({ type: Boolean })
1300
+ ], CalendarColumnView.prototype, "editable", void 0);
1301
+ __decorate([
1302
+ n({ type: Boolean })
1303
+ ], CalendarColumnView.prototype, "addable", void 0);
1304
+ __decorate([
1305
+ n({ type: Number, attribute: false })
1306
+ ], CalendarColumnView.prototype, "minuteStep", void 0);
1307
+ __decorate([
1308
+ n({ type: Number, attribute: false })
1309
+ ], CalendarColumnView.prototype, "defaultDuration", void 0);
1310
+ __decorate([
1311
+ n({ attribute: false })
1312
+ ], CalendarColumnView.prototype, "placeholder", void 0);
1313
+ __decorate([
1314
+ n({ attribute: false })
1315
+ ], CalendarColumnView.prototype, "untitledLabel", void 0);
1316
+ __decorate([
1317
+ n({ attribute: false })
1318
+ ], CalendarColumnView.prototype, "newEventLabel", void 0);
704
1319
  __decorate([
705
1320
  n({ type: Object, attribute: false })
706
1321
  ], CalendarColumnView.prototype, "currentTime", void 0);
@@ -722,6 +1337,9 @@ __decorate([
722
1337
  __decorate([
723
1338
  r()
724
1339
  ], CalendarColumnView.prototype, "multiDayEvents", void 0);
1340
+ __decorate([
1341
+ r()
1342
+ ], CalendarColumnView.prototype, "_preview", void 0);
725
1343
  CalendarColumnView = __decorate([
726
1344
  IndividualComponent
727
1345
  ], CalendarColumnView);