@globalpayments/vega 2.27.0 → 2.28.1

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 (185) hide show
  1. package/dist/cjs/{app-globals-190595cc.js → app-globals-512d84f4.js} +1 -1
  2. package/dist/cjs/{form-field-controller-slimmer-ee984eb2.js → form-field-controller-slimmer-223f8ee3.js} +1 -1
  3. package/dist/cjs/index.cjs.js +1 -1
  4. package/dist/cjs/loader.cjs.js +3 -3
  5. package/dist/cjs/{string-input-formatter-slimmer-fcfa5bb7.js → string-input-formatter-slimmer-79272527.js} +8 -13
  6. package/dist/cjs/{sub-state-observer-slimmer-832a4215.js → sub-state-observer-slimmer-36660092.js} +2 -2
  7. package/dist/cjs/{translation-slimmer-8ebf126d.js → translation-slimmer-83577cfd.js} +1 -1
  8. package/dist/cjs/vega-app-header-button.cjs.entry.js +1 -1
  9. package/dist/cjs/vega-button-circle.cjs.entry.js +1 -1
  10. package/dist/cjs/vega-button-group_2.cjs.entry.js +3 -3
  11. package/dist/cjs/vega-button.cjs.entry.js +1 -1
  12. package/dist/cjs/vega-calendar_3.cjs.entry.js +963 -838
  13. package/dist/cjs/vega-checkbox_2.cjs.entry.js +2 -2
  14. package/dist/cjs/vega-chip.cjs.entry.js +1 -1
  15. package/dist/cjs/vega-color-picker.cjs.entry.js +2 -2
  16. package/dist/cjs/vega-combo-box.cjs.entry.js +2 -2
  17. package/dist/cjs/vega-date-picker_2.cjs.entry.js +4 -4
  18. package/dist/cjs/vega-dropdown_5.cjs.entry.js +3 -3
  19. package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
  20. package/dist/cjs/vega-file-uploader.cjs.entry.js +3 -3
  21. package/dist/cjs/vega-form.cjs.entry.js +2 -2
  22. package/dist/cjs/vega-image-uploader.cjs.entry.js +3 -3
  23. package/dist/cjs/vega-input-credit-card.cjs.entry.js +2 -2
  24. package/dist/cjs/vega-input-phone-number.cjs.entry.js +2 -2
  25. package/dist/cjs/vega-input-range.cjs.entry.js +3 -3
  26. package/dist/cjs/vega-input-select.cjs.entry.js +3 -3
  27. package/dist/cjs/vega-input.cjs.entry.js +48 -16
  28. package/dist/cjs/vega-pagination.cjs.entry.js +2 -2
  29. package/dist/cjs/vega-radio_2.cjs.entry.js +2 -2
  30. package/dist/cjs/vega-selection-chip_2.cjs.entry.js +3 -3
  31. package/dist/cjs/vega-selection-tile_2.cjs.entry.js +3 -3
  32. package/dist/cjs/vega-signature-capture.cjs.entry.js +3 -3
  33. package/dist/cjs/vega-stepper.cjs.entry.js +2 -2
  34. package/dist/cjs/vega-table_8.cjs.entry.js +3 -3
  35. package/dist/cjs/vega-textarea.cjs.entry.js +2 -2
  36. package/dist/cjs/vega-time-picker_2.cjs.entry.js +3 -3
  37. package/dist/cjs/vega-toggle-switch.cjs.entry.js +2 -2
  38. package/dist/cjs/vega.cjs.js +3 -3
  39. package/dist/collection/components/vega-app-header-button/vega-app-header-button.css +7 -1
  40. package/dist/collection/components/vega-button/vega-button.css +1 -0
  41. package/dist/collection/components/vega-button-circle/vega-button-circle.css +4 -0
  42. package/dist/collection/components/vega-button-group/vega-button-group-item/vega-button-group-item.css +10 -0
  43. package/dist/collection/components/vega-button-group/vega-button-group.css +13 -0
  44. package/dist/collection/components/vega-calendar/slimmers/common/controllers/vega-calendar-current-period-controller.js +17 -3
  45. package/dist/collection/components/vega-calendar/slimmers/common/controllers/vega-calendar-event-responsive-controller.js +1 -1
  46. package/dist/collection/components/vega-calendar/slimmers/common/controllers/vega-calendar-view-controller.js +3 -0
  47. package/dist/collection/components/vega-calendar/slimmers/common/helpers/repeat-pattern/calendar-event-daily-repeat-pattern.js +7 -1
  48. package/dist/collection/components/vega-calendar/slimmers/common/helpers/repeat-pattern/calendar-event-monthly-repeat-pattern.js +7 -1
  49. package/dist/collection/components/vega-calendar/slimmers/common/helpers/repeat-pattern/calendar-event-weekly-repeat-pattern.js +9 -1
  50. package/dist/collection/components/vega-calendar/slimmers/common/helpers/repeat-pattern/calendar-event-yearly-repeat-pattern.js +7 -1
  51. package/dist/collection/components/vega-calendar/slimmers/common/helpers/test/calendar-event-repeat-pattern-factory.test.js +56 -0
  52. package/dist/collection/components/vega-calendar/slimmers/common/layout/full-day-event-layout-generator.js +1 -1
  53. package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-switch-panel.js +4 -3
  54. package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-view-renderer.js +4 -1
  55. package/dist/collection/components/vega-calendar/slimmers/day-view/renderers/timed-event/vega-calendar-day-event-layout-renderer.js +1 -1
  56. package/dist/collection/components/vega-calendar/slimmers/day-view/renderers/vega-calendar-time-line-renderer.js +1 -1
  57. package/dist/collection/components/vega-calendar/slimmers/day-view/renderers/vega-calendar-view-with-time-renderer.js +0 -3
  58. package/dist/collection/components/vega-calendar/slimmers/month-view/renderers/vega-calendar-month-event-renderer.js +3 -1
  59. package/dist/collection/components/vega-calendar/slimmers/month-view/renderers/vega-calendar-month-view-renderer.js +0 -3
  60. package/dist/collection/components/vega-calendar/utils/index.js +24 -0
  61. package/dist/collection/components/vega-calendar/vega-calendar-event/slimmers/renderers/vega-calendar-event-renderer.js +3 -2
  62. package/dist/collection/components/vega-calendar/vega-calendar.css +10 -6
  63. package/dist/collection/components/vega-calendar/vega-calendar.js +36 -0
  64. package/dist/collection/components/vega-chip/vega-chip.css +4 -0
  65. package/dist/collection/helpers/calendar/calendar-period/calendar-period.abstract.js +8 -0
  66. package/dist/collection/helpers/calendar/calendar-period/day-period.js +27 -4
  67. package/dist/collection/helpers/calendar/calendar-period/month-period.js +4 -2
  68. package/dist/collection/helpers/calendar/calendar-period/week-period.js +4 -2
  69. package/dist/collection/helpers/calendar/calendar-view-generator/month-view-generator.js +8 -2
  70. package/dist/collection/helpers/calendar/calendar-view-generator/week-view-generator.js +8 -1
  71. package/dist/collection/helpers/calendar/test/calendar-period/day-period.test.js +16 -0
  72. package/dist/collection/helpers/calendar/test/calendar-view-generator/month-view-generator.test.js +50 -0
  73. package/dist/collection/helpers/calendar/test/calendar-view-generator/week-view-generator.test.js +15 -0
  74. package/dist/collection/helpers/formatter/string-formatter/number-mask-strategy.js +36 -4
  75. package/dist/collection/helpers/formatter/string-formatter/number-thousand-comma-strategy.js +10 -9
  76. package/dist/collection/helpers/formatter/test/string-formatter/number-mask-strategy.test.js +11 -2
  77. package/dist/collection/helpers/formatter/test/string-formatter/number-thousand-comma-mask-strategy.test.js +10 -0
  78. package/dist/collection/helpers/slimmers/string-input-formatter-slimmer.js +8 -13
  79. package/dist/collection/helpers/slimmers/sub-state/sub-state-observer-slimmer.js +2 -2
  80. package/dist/collection/helpers/slimmers/test/string-input-formatter-slimmer.test.js +52 -20
  81. package/dist/collection/utils/spec-utils.js +28 -0
  82. package/dist/collection/utils/test-utils.js +21 -0
  83. package/dist/esm/{app-globals-d0b86358.js → app-globals-41797af8.js} +1 -1
  84. package/dist/esm/{form-field-controller-slimmer-2f9c871b.js → form-field-controller-slimmer-edbaaf7c.js} +1 -1
  85. package/dist/esm/index.js +1 -1
  86. package/dist/esm/loader.js +3 -3
  87. package/dist/esm/{string-input-formatter-slimmer-bfe3f5e5.js → string-input-formatter-slimmer-fc23bc9f.js} +8 -13
  88. package/dist/esm/{sub-state-observer-slimmer-af28076b.js → sub-state-observer-slimmer-8eff5559.js} +2 -2
  89. package/dist/esm/{translation-slimmer-c740a5f3.js → translation-slimmer-79f9a9c9.js} +1 -1
  90. package/dist/esm/vega-app-header-button.entry.js +1 -1
  91. package/dist/esm/vega-button-circle.entry.js +1 -1
  92. package/dist/esm/vega-button-group_2.entry.js +3 -3
  93. package/dist/esm/vega-button.entry.js +1 -1
  94. package/dist/esm/vega-calendar_3.entry.js +963 -838
  95. package/dist/esm/vega-checkbox_2.entry.js +2 -2
  96. package/dist/esm/vega-chip.entry.js +1 -1
  97. package/dist/esm/vega-color-picker.entry.js +2 -2
  98. package/dist/esm/vega-combo-box.entry.js +2 -2
  99. package/dist/esm/vega-date-picker_2.entry.js +4 -4
  100. package/dist/esm/vega-dropdown_5.entry.js +3 -3
  101. package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
  102. package/dist/esm/vega-file-uploader.entry.js +3 -3
  103. package/dist/esm/vega-form.entry.js +2 -2
  104. package/dist/esm/vega-image-uploader.entry.js +3 -3
  105. package/dist/esm/vega-input-credit-card.entry.js +2 -2
  106. package/dist/esm/vega-input-phone-number.entry.js +2 -2
  107. package/dist/esm/vega-input-range.entry.js +3 -3
  108. package/dist/esm/vega-input-select.entry.js +3 -3
  109. package/dist/esm/vega-input.entry.js +48 -16
  110. package/dist/esm/vega-pagination.entry.js +2 -2
  111. package/dist/esm/vega-radio_2.entry.js +2 -2
  112. package/dist/esm/vega-selection-chip_2.entry.js +3 -3
  113. package/dist/esm/vega-selection-tile_2.entry.js +3 -3
  114. package/dist/esm/vega-signature-capture.entry.js +3 -3
  115. package/dist/esm/vega-stepper.entry.js +2 -2
  116. package/dist/esm/vega-table_8.entry.js +3 -3
  117. package/dist/esm/vega-textarea.entry.js +2 -2
  118. package/dist/esm/vega-time-picker_2.entry.js +3 -3
  119. package/dist/esm/vega-toggle-switch.entry.js +2 -2
  120. package/dist/esm/vega.js +3 -3
  121. package/dist/types/components/vega-calendar/slimmers/common/controllers/vega-calendar-current-period-controller.d.ts +5 -0
  122. package/dist/types/components/vega-calendar/slimmers/common/controllers/vega-calendar-view-controller.d.ts +1 -0
  123. package/dist/types/components/vega-calendar/slimmers/common/renderers/vega-calendar-switch-panel.d.ts +1 -1
  124. package/dist/types/components/vega-calendar/slimmers/common/renderers/vega-calendar-view-renderer.d.ts +1 -0
  125. package/dist/types/components/vega-calendar/slimmers/day-view/renderers/vega-calendar-view-with-time-renderer.d.ts +0 -1
  126. package/dist/types/components/vega-calendar/slimmers/month-view/renderers/vega-calendar-month-view-renderer.d.ts +0 -1
  127. package/dist/types/components/vega-calendar/utils/index.d.ts +13 -0
  128. package/dist/types/components/vega-calendar/vega-calendar.d.ts +10 -0
  129. package/dist/types/components.d.ts +10 -0
  130. package/dist/types/helpers/calendar/calendar-period/calendar-period.abstract.d.ts +7 -0
  131. package/dist/types/helpers/calendar/calendar-period/day-period.d.ts +8 -1
  132. package/dist/types/helpers/calendar/calendar-period/month-period.d.ts +2 -1
  133. package/dist/types/helpers/calendar/calendar-period/week-period.d.ts +2 -1
  134. package/dist/types/helpers/formatter/string-formatter/number-mask-strategy.d.ts +20 -0
  135. package/dist/types/helpers/slimmers/sub-state/sub-state-observer-slimmer.d.ts +1 -1
  136. package/dist/types/utils/spec-utils.d.ts +8 -0
  137. package/dist/types/utils/test-utils.d.ts +10 -0
  138. package/dist/vega/index.esm.js +1 -1
  139. package/dist/vega/{p-f57454a6.js → p-0120ce7a.js} +1 -1
  140. package/dist/vega/{p-1dc80394.entry.js → p-0395e791.entry.js} +1 -1
  141. package/dist/vega/{p-8a1d8b99.entry.js → p-048a97d1.entry.js} +1 -1
  142. package/dist/vega/{p-963e8c45.entry.js → p-0dd750b0.entry.js} +1 -1
  143. package/dist/vega/{p-c31002d0.entry.js → p-128fbe13.entry.js} +1 -1
  144. package/dist/vega/p-1f38eef6.entry.js +1 -0
  145. package/dist/vega/{p-8912d5c9.entry.js → p-1fc5373a.entry.js} +1 -1
  146. package/dist/vega/{p-7f8db003.entry.js → p-22a85055.entry.js} +1 -1
  147. package/dist/vega/{p-351a0ea1.entry.js → p-34545d2d.entry.js} +1 -1
  148. package/dist/vega/{p-f37e6adf.entry.js → p-40f6add9.entry.js} +1 -1
  149. package/dist/vega/p-41784db1.js +1 -0
  150. package/dist/vega/{p-c9e3413b.entry.js → p-4bc042ec.entry.js} +1 -1
  151. package/dist/vega/{p-a7666db3.entry.js → p-5d231a82.entry.js} +1 -1
  152. package/dist/vega/p-5f377954.js +1 -1
  153. package/dist/vega/{p-ded47af0.entry.js → p-657df167.entry.js} +1 -1
  154. package/dist/vega/{p-28f6ead3.entry.js → p-6d015656.entry.js} +1 -1
  155. package/dist/vega/{p-8c2852c4.entry.js → p-6e3cc7f0.entry.js} +1 -1
  156. package/dist/vega/p-8843226a.entry.js +1 -0
  157. package/dist/vega/{p-09352107.entry.js → p-8c72aa56.entry.js} +1 -1
  158. package/dist/vega/{p-ba3db23b.entry.js → p-8f60c3ee.entry.js} +1 -1
  159. package/dist/vega/{p-bffaa859.entry.js → p-9a4ffc2c.entry.js} +1 -1
  160. package/dist/vega/p-9e6934fb.js +1 -0
  161. package/dist/vega/p-a10074a8.entry.js +1 -0
  162. package/dist/vega/{p-e7e19350.entry.js → p-a454acc4.entry.js} +1 -1
  163. package/dist/vega/p-a46329bb.js +1 -0
  164. package/dist/vega/{p-27b73500.entry.js → p-a8b1f19c.entry.js} +1 -1
  165. package/dist/vega/{p-14c0b4ea.js → p-bccacf42.js} +1 -1
  166. package/dist/vega/{p-8eadc60b.entry.js → p-d0a83562.entry.js} +1 -1
  167. package/dist/vega/{p-288b47f0.entry.js → p-d4fb2264.entry.js} +1 -1
  168. package/dist/vega/{p-fa78f87f.entry.js → p-d550fc66.entry.js} +1 -1
  169. package/dist/vega/p-d686dd96.entry.js +1 -0
  170. package/dist/vega/{p-0afaa0f3.entry.js → p-ead9a2b9.entry.js} +1 -1
  171. package/dist/vega/{p-54f5c773.entry.js → p-f0ad06bd.entry.js} +1 -1
  172. package/dist/vega/{p-8aaa9233.entry.js → p-f2019f70.entry.js} +1 -1
  173. package/dist/vega/{p-af71fe84.entry.js → p-fc746bae.entry.js} +1 -1
  174. package/dist/vega/vega.esm.js +1 -1
  175. package/package.json +1 -1
  176. package/dist/vega/p-15452727.js +0 -1
  177. package/dist/vega/p-38e3d50e.entry.js +0 -1
  178. package/dist/vega/p-8a646846.entry.js +0 -1
  179. package/dist/vega/p-bf557666.entry.js +0 -1
  180. package/dist/vega/p-d7bd2be5.entry.js +0 -1
  181. package/dist/vega/p-db120a1e.js +0 -1
  182. package/dist/vega/p-dee487f9.js +0 -1
  183. /package/dist/cjs/{translation-77e9ccce.js → translation-0dd74433.js} +0 -0
  184. /package/dist/esm/{translation-3b437b6d.js → translation-0fa7cf77.js} +0 -0
  185. /package/dist/vega/{p-05ebf5a3.js → p-be784f53.js} +0 -0
@@ -19,8 +19,8 @@ const createPublicApiRuntimeMetricsSlimmer = require('./create-public-api-runtim
19
19
  const pageResizeObserverSlimmer = require('./page-resize-observer-slimmer-a8cf1874.js');
20
20
  const timer = require('./timer-5f33058b.js');
21
21
  const changeManager = require('./change-manager-a297e4d2.js');
22
- const subStateObserverSlimmer = require('./sub-state-observer-slimmer-832a4215.js');
23
- const translationSlimmer = require('./translation-slimmer-8ebf126d.js');
22
+ const subStateObserverSlimmer = require('./sub-state-observer-slimmer-36660092.js');
23
+ const translationSlimmer = require('./translation-slimmer-83577cfd.js');
24
24
  const placeholder = require('./placeholder-cb6d37ad.js');
25
25
  const typeGuard = require('./type-guard-a07b353b.js');
26
26
  const stateBackgroundColorFormatter = require('./state-background-color-formatter-418b84e6.js');
@@ -36,7 +36,7 @@ require('./index-5792390b.js');
36
36
  require('./number-459031f7.js');
37
37
  require('./breakpoints-7e2dff90.js');
38
38
  require('./ui-32e69595.js');
39
- require('./translation-77e9ccce.js');
39
+ require('./translation-0dd74433.js');
40
40
  require('./static-subject-title-3599787e.js');
41
41
  require('./regex-c1f70fd4.js');
42
42
  require('./typography-4560e7f1.js');
@@ -76,1078 +76,1146 @@ const chevronLeft = {
76
76
  };
77
77
 
78
78
  /**
79
- * get month name from the month number
79
+ * Get a week days array
80
80
  *
81
- * @param {Date} date the date object
82
- * @param {boolean} isShortName short or long name
83
- * @returns {string} the month English name
81
+ * @param {number} firstWeekDay - The first week day (0: Sunday, 1: Monday, ...)
82
+ * @returns {number[]} - The week days array
84
83
  */
85
- function getMonthName(date, isShortName = false) {
86
- return date.toLocaleDateString('en-US', { month: isShortName ? 'short' : 'long' });
87
- }
84
+ const getWeekdays = (firstWeekDay = 0) => {
85
+ const weekdays = [0, 1, 2, 3, 4, 5, 6];
86
+ return weekdays.concat(weekdays).slice(firstWeekDay, firstWeekDay + 7);
87
+ };
88
+
88
89
  /**
89
- * The function `getTimeIndex` calculates the index of a given time string based on a specified time unit.
90
- *
91
- * @param {string} timeString - A string representing a time in the format "HH:MM", where HH is the hour and MM is the minutes.
92
- * @param {number} [unit=15] - The `unit` parameter in the `getTimeIndex` function is used to specify
93
- * the interval in minutes for dividing the day. By default, it is set to 15 minutes, meaning that the
94
- * day will be divided into 15-minute intervals.
95
- * @returns {number} the index of the given time string based on the specified time unit.
90
+ * Calendar view generator abstract class.
96
91
  */
97
- function getTimeIndex(timeString, unit = 15) {
98
- const [hour, minutes] = timeString.split(':');
99
- return Math.round((Number(hour) * 60 + Number(minutes)) / unit);
92
+ class CalendarViewGenerator {
93
+ constructor() {
94
+ this.WEEKDAYS_SHORT = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
95
+ this.weekdays = getWeekdays();
96
+ }
97
+ /**
98
+ * Get weekday names.
99
+ *
100
+ * @returns {string[]} - The weekday strings
101
+ */
102
+ getWeekdayNames() {
103
+ return this.WEEKDAYS_SHORT;
104
+ }
105
+ /**
106
+ * Generate calendar dates
107
+ *
108
+ * @param {CalendarPeriod} period - The calendar period
109
+ * @returns {Date[]} - The date result
110
+ */
111
+ generateDates(period) {
112
+ const cursor = period.startDate.toDate();
113
+ const dates = [];
114
+ for (let i = 0; i < period.count; i++) {
115
+ dates.push(new Date(cursor));
116
+ cursor.setDate(cursor.getDate() + 1);
117
+ }
118
+ return dates;
119
+ }
120
+ /**
121
+ * Generate calendar head
122
+ *
123
+ * @returns {string[]} - The data of week head
124
+ */
125
+ generateWeekHead() {
126
+ return this.weekdays.map((day) => this.getWeekdayNames()[day]);
127
+ }
100
128
  }
129
+
101
130
  /**
102
- * Returns a string that includes the event key for a calendar event slot.
103
- *
104
- * @param {string} eventKey - represents the key or identifier of a calendar event.
105
- * @returns {string} a string that is a concatenation of 'vega-calendar-event-slot-' and the eventKey parameter.
131
+ * Calendar view
106
132
  */
107
- function getCalendarEventSlotName(eventKey) {
108
- return 'vega-calendar-event-slot-' + eventKey;
133
+ class CalendarView {
134
+ constructor(weekdays, dateItems) {
135
+ this._weekdays = weekdays;
136
+ this._dateItems = dateItems;
137
+ }
138
+ /**
139
+ * The week head of the calendar view
140
+ *
141
+ * @type {string[]}
142
+ */
143
+ get weekdays() {
144
+ return this._weekdays;
145
+ }
146
+ /**
147
+ * The date items of the calendar view
148
+ *
149
+ * @type {CalendarDate[][]}
150
+ */
151
+ get dateItems() {
152
+ return this._dateItems;
153
+ }
109
154
  }
110
155
 
111
- const ellipsisVertical = {
112
- icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M48 464a48 48 0 1 1 0-96 48 48 0 1 1 0 96zm0-160a48 48 0 1 1 0-96 48 48 0 1 1 0 96zM0 96a48 48 0 1 1 96 0A48 48 0 1 1 0 96z"/></svg>`,
113
- };
156
+ /**
157
+ * Day view calendar generator
158
+ */
159
+ class DayViewGenerator extends CalendarViewGenerator {
160
+ /**
161
+ * @inheritDoc
162
+ */
163
+ generate(period) {
164
+ return new CalendarView([this.generateWeekHead()[period.current.toDate().getDay()]], [[period.current]]);
165
+ }
166
+ }
114
167
 
115
- var __decorate$n = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
116
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
117
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
118
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
119
- return c > 3 && r && Object.defineProperty(target, key, r), r;
120
- };
121
- /** The `VegaCalendarSwitchPanelRenderer` class in TypeScript React renders a calendar switch panel with date navigation, view selection, and action buttons. */
122
- class VegaCalendarSwitchPanelRenderer extends globalSlimmerRegistry.VegaSlimmer {
123
- constructor() {
124
- super(...arguments);
125
- /**
126
- * This function is responsible for updating the `viewMode` property of the `VegaCalendarSwitchPanelRenderer` class with the value extracted from the `input` parameter.
127
- *
128
- * @param {NotifyObserverPayload<VegaCalendarViewModeType>} input mark which view should be selected
129
- */
130
- this.handleViewChange = (input) => {
131
- this.currentPeriodController.updateCalendarPeriod(input.detail, this.currentPeriod.current);
132
- };
133
- /**
134
- * reset view content to today
135
- */
136
- this.todayButtonClick = () => {
137
- this.currentPeriodController.setCurrentPeriod(this.currentPeriod.now());
138
- };
139
- /**
140
- * update view content after click next button
141
- */
142
- this.nextButtonClick = () => {
143
- this.currentPeriodController.setCurrentPeriod(this.currentPeriod.next());
144
- };
145
- /**
146
- * update view content after click previous button
147
- */
148
- this.prevButtonClick = () => {
149
- this.currentPeriodController.setCurrentPeriod(this.currentPeriod.previous());
150
- };
151
- /**
152
- * The more action menu ite click
153
- *
154
- * @param {NotifyObserverPayload<string>} payload The object contains the menu item key
155
- */
156
- this.moreActionMenuClick = (payload) => {
157
- this.moreActionClickEmitter.emit(payload.detail);
158
- };
168
+ /**
169
+ * Calendar date class
170
+ */
171
+ class CalendarDate {
172
+ constructor(year, month, date) {
173
+ this._date = date;
174
+ this._month = month;
175
+ this._year = year;
159
176
  }
160
177
  /**
161
- * get the switch panel container element
178
+ * Create a calendar date from a Date object
162
179
  *
163
- * @returns {HTMLElement} container element
180
+ * @param {Date} date - The Date object
181
+ * @returns {CalendarDate} - Return a CalendarDate object
164
182
  */
165
- getSwitchPanelRef() {
166
- return this.switchPanelRef;
183
+ static from(date) {
184
+ return new CalendarDate(date.getFullYear(), date.getMonth() + 1, date.getDate());
167
185
  }
168
186
  /**
169
- * calendar switch panel with date switch, view switch, add new button, and more action components.
187
+ * The year of the calendar date
170
188
  *
171
- * @returns {HTMLElement} html element
189
+ * @type {number}
172
190
  */
173
- render() {
174
- return (index.h("vega-flex", { direction: "row", gap: "size-16", justifyContent: "space-between", alignItems: "center", class: "calendar-switch-panel", ref: (node) => (this.switchPanelRef = node) },
175
- this.renderDateSwitch(),
176
- index.h("div", { class: "calendar-view-switch-container" },
177
- this.renderViewSwitch(),
178
- this.renderMoreActionMenu())));
191
+ get year() {
192
+ return this._year;
193
+ }
194
+ set year(value) {
195
+ this._year = value;
179
196
  }
180
197
  /**
181
- * The `renderDateSwitch` function returns a container with buttons for switching dates and displaying the current date.
198
+ * The month of the calendar date
182
199
  *
183
- * @returns {HTMLDivElement} action button elements container.
200
+ * @type {number}
184
201
  */
185
- renderDateSwitch() {
186
- return (index.h("div", { class: "calendar-date-switch-container" },
187
- index.h("vega-button", { variant: "secondary", size: "small", ref: (button) => {
188
- domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(button, vegaEventId.VegaClick, this.todayButtonClick);
189
- }, label: this.translationSlimmer.t('Today') }),
190
- index.h("vega-button-circle", { variant: "secondary", size: "small", icon: internalIconManager.VegaInternalIconManager.getIconKey('chevron-left'), label: "previous", showTooltip: false, ref: (button) => {
191
- domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(button, vegaEventId.VegaClick, this.prevButtonClick);
192
- } }),
193
- index.h("vega-button-circle", { variant: "secondary", size: "small", icon: internalIconManager.VegaInternalIconManager.getIconKey('chevron-right'), label: "next", showTooltip: false, ref: (button) => {
194
- domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(button, vegaEventId.VegaClick, this.nextButtonClick);
195
- } }),
196
- this.renderCurrentPeriod()));
202
+ get month() {
203
+ return this._month;
204
+ }
205
+ set month(value) {
206
+ this._month = value;
197
207
  }
198
208
  /**
199
- * The function `renderCurrentPeriod` returns an HTML element displaying the view date content summary info.
209
+ * The date of the calendar date
200
210
  *
201
- * @returns {HTMLVegaFontElement} The text content inside the element is "Current Date Test".
211
+ * @type {number}
202
212
  */
203
- renderCurrentPeriod() {
204
- return (index.h("vega-font", { class: "calendar-current-date", variant: "font-field-label", color: "text-primary" }, this.getViewDateSummary()));
213
+ get date() {
214
+ return this._date;
215
+ }
216
+ set date(value) {
217
+ this._date = value;
205
218
  }
206
219
  /**
207
- * The function `renderViewSwitch` returns a JSX element for rendering a segment control component in a TypeScript React application.
220
+ * Verify whether the calendar date is today
208
221
  *
209
- * @returns {HTMLElement} An HTMLElement containing a vega-segment-control element with specific attributes and event handling.
222
+ * @returns {boolean} - Return true if the calendar date is today. Otherwise, return false.
210
223
  */
211
- renderViewSwitch() {
212
- return (index.h("vega-segment-control", { segments: VegaCalendarSwitchPanelRenderer.views.map((item) => (Object.assign(Object.assign({}, item), { text: this.translationSlimmer.t(item.text) }))), size: "small", variant: "text-only", selected: this.viewMode, ref: (node) => {
213
- domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(node, vegaEventId.VegaChange, this.handleViewChange);
214
- } }));
224
+ isToday() {
225
+ const today = new Date();
226
+ return (today.getFullYear() === this.year &&
227
+ today.getMonth() + 1 === this.month &&
228
+ today.getDate() === this.date);
215
229
  }
216
230
  /**
217
- * Render an more action button if dropdown source is not empty
231
+ * Convert the calendar date to a Date object
218
232
  *
219
- * @returns {Nullable<HTMLElement>} the additional element
233
+ * @returns {Date} - Return a Date object
220
234
  */
221
- renderMoreActionMenu() {
222
- var _a, _b;
223
- if ((_b = (_a = this.moreActionDropdownProps) === null || _a === void 0 ? void 0 : _a.source) === null || _b === void 0 ? void 0 : _b.length) {
224
- return (index.h("vega-dropdown", Object.assign({ alignment: "end", trigger: "click" }, this.moreActionDropdownProps, { ref: (node) => {
225
- domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(node, vegaEventId.VegaDropdownClick, this.moreActionMenuClick);
226
- } }),
227
- index.h("vega-button-circle", { size: "small", icon: internalIconManager.VegaInternalIconManager.getIconKey('ellipsis-vertical'), variant: "icon-only" })));
228
- }
235
+ toDate() {
236
+ return new Date(this.year, this.month - 1, this.date);
229
237
  }
230
238
  /**
231
- * Get the view content date summary info, such as `January, 2024` or `10 January, 2024` or `28 December, 2023 - 3 January, 2024`
239
+ * Compare with another calendar date
232
240
  *
233
- * @returns {string} string
241
+ * @param {CalendarDate} date - The calendar date to compare with
242
+ * @returns {DateCompareResult} - Return a DateCompareResult object
234
243
  */
235
- getViewDateSummary() {
236
- const currentDate = this.currentPeriod.current;
237
- let result = '';
238
- switch (this.viewMode) {
239
- case 'day': {
240
- const monthName = this.translationSlimmer.t(getMonthName(currentDate.toDate()));
241
- result = `${currentDate.date} ${monthName}, ${currentDate.year}`;
242
- break;
243
- }
244
- case 'week': {
245
- const start = this.currentPeriod.startDate;
246
- const end = this.currentPeriod.endDate;
247
- const [startMonthName, endMonthName] = [start, end].map((item) => this.translationSlimmer.t(getMonthName(item.toDate())));
248
- result = `${start.date} ${startMonthName}${start.year === end.year ? '' : ', ' + start.year} - ${end.date} ${endMonthName}, ${end.year}`;
249
- break;
244
+ compare(date) {
245
+ const { year, month } = date;
246
+ const result = {
247
+ isPreviousMonth: false,
248
+ inMonth: false,
249
+ isNextMonth: false,
250
+ };
251
+ if (this.year === year) {
252
+ if (this.month < month) {
253
+ result.isPreviousMonth = true;
250
254
  }
251
- case 'month': {
252
- const monthName = this.translationSlimmer.t(getMonthName(currentDate.toDate()));
253
- result = `${monthName}, ${currentDate.year}`;
254
- break;
255
+ else if (this.month > month) {
256
+ result.isNextMonth = true;
255
257
  }
258
+ else {
259
+ result.inMonth = true;
260
+ }
261
+ }
262
+ else if (this.year > year) {
263
+ result.isNextMonth = true;
264
+ }
265
+ else {
266
+ result.isPreviousMonth = true;
256
267
  }
257
268
  return result;
258
269
  }
259
- }
260
- (() => {
261
- internalIconManager.VegaInternalIconManager.register({
262
- 'chevron-right': chevronRight,
263
- 'chevron-left': chevronLeft,
264
- 'ellipsis-vertical': ellipsisVertical,
265
- });
266
- })();
267
- VegaCalendarSwitchPanelRenderer.views = [
268
- { text: 'Day', key: 'day' },
269
- { text: 'Week', key: 'week' },
270
- { text: 'Month', key: 'month' },
271
- ];
272
- __decorate$n([
273
- globalSlimmerRegistry.MapToComponentField()
274
- ], VegaCalendarSwitchPanelRenderer.prototype, "viewMode", void 0);
275
- __decorate$n([
276
- globalSlimmerRegistry.MapToComponentField()
277
- ], VegaCalendarSwitchPanelRenderer.prototype, "calendarView", void 0);
278
- __decorate$n([
279
- globalSlimmerRegistry.MapToComponentField()
280
- ], VegaCalendarSwitchPanelRenderer.prototype, "currentPeriod", void 0);
281
- __decorate$n([
282
- globalSlimmerRegistry.MapToComponentField()
283
- ], VegaCalendarSwitchPanelRenderer.prototype, "moreActionDropdownProps", void 0);
284
- __decorate$n([
285
- globalSlimmerRegistry.MapToComponentField()
286
- ], VegaCalendarSwitchPanelRenderer.prototype, "moreActionClickEmitter", void 0);
287
- __decorate$n([
288
- globalSlimmerRegistry.MapToComponentField()
289
- ], VegaCalendarSwitchPanelRenderer.prototype, "currentPeriodController", void 0);
290
- __decorate$n([
291
- globalSlimmerRegistry.MapToComponentField()
292
- ], VegaCalendarSwitchPanelRenderer.prototype, "calendarViewController", void 0);
293
- __decorate$n([
294
- globalSlimmerRegistry.MapToComponentField()
295
- ], VegaCalendarSwitchPanelRenderer.prototype, "translationSlimmer", void 0);
296
-
297
- var __decorate$m = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
298
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
299
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
300
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
301
- return c > 3 && r && Object.defineProperty(target, key, r), r;
302
- };
303
- /** renders different views based on the specified view mode using month, week, and day view render. */
304
- class VegaCalendarViewRenderer extends globalSlimmerRegistry.VegaSlimmer {
305
270
  /**
306
- * render the calendar month/week/day view
271
+ * The function "equal" compares the year, month, and date of two CalendarDate objects and returns true if they are equal.
307
272
  *
308
- * @returns {HTMLElement} html element
273
+ * @param {CalendarDate} calendarDate - The `equal` method in the code snippet is a function that compares the year, month, and date of the current `CalendarDate` object with another
274
+ * `CalendarDate` object passed as a parameter. The method returns `true` if all three values (year, month, date) are equal
275
+ * @returns {boolean} The date is same day with current
309
276
  */
310
- render() {
311
- return (index.h("div", { class: `calendar-view calendar-view-${this.viewMode}` }, this.viewMode === 'month'
312
- ? this.monthViewRenderer.render()
313
- : this.viewWithTimeRenderer.render()));
277
+ equal(calendarDate) {
278
+ const { year, month, date } = calendarDate;
279
+ return this._year === year && this._month === month && this._date === date;
314
280
  }
315
281
  }
316
- __decorate$m([
317
- globalSlimmerRegistry.MapToComponentField()
318
- ], VegaCalendarViewRenderer.prototype, "viewMode", void 0);
319
- __decorate$m([
320
- globalSlimmerRegistry.MapToComponentField()
321
- ], VegaCalendarViewRenderer.prototype, "monthViewRenderer", void 0);
322
- __decorate$m([
323
- globalSlimmerRegistry.MapToComponentField()
324
- ], VegaCalendarViewRenderer.prototype, "viewWithTimeRenderer", void 0);
325
282
 
326
- var __decorate$l = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
327
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
328
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
329
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
330
- return c > 3 && r && Object.defineProperty(target, key, r), r;
331
- };
332
- /** The code provided is defining a TypeScript class called `VegaCalendarMonthViewRenderer` that extends `VegaSlimmer`. This class is responsible for rendering a month view of a calendar component. */
333
- class VegaCalendarMonthViewRenderer extends globalSlimmerRegistry.VegaSlimmer {
283
+ /**
284
+ * Calendar week view generator
285
+ */
286
+ class WeekViewGenerator extends CalendarViewGenerator {
334
287
  /**
335
- * the HTML elements that represent the month view of a calendar component.
336
- *
337
- * @returns {HTMLElement} the month view calendar content
288
+ * @inheritDoc
338
289
  */
339
- render() {
340
- const weekHead = this.calendarView.weekdays;
341
- return (index.h("div", { class: "calendar-view-month-container" },
342
- index.h("div", { class: "calendar-view-row calendar-view-title border-divider-bottom" }, weekHead.map((title) => (index.h("div", { key: title }, this.translationSlimmer.t(title))))),
343
- this.renderMonthViewContent()));
290
+ generate(period) {
291
+ const dates = this.generateDates(period);
292
+ const showWeekends = period.showWeekends;
293
+ let weekDays = this.generateWeekHead();
294
+ let dateItems = [dates.map(CalendarDate.from)];
295
+ if (showWeekends === false) {
296
+ weekDays = weekDays.slice(1, 6);
297
+ dateItems = dateItems.map((items) => items.slice(1, 6));
298
+ }
299
+ return new CalendarView(weekDays, dateItems);
344
300
  }
301
+ }
302
+
303
+ /**
304
+ * Calendar month view generator
305
+ */
306
+ class MonthViewGenerator extends CalendarViewGenerator {
345
307
  /**
346
- * generating the HTML elements that represent the content of the month view in a calendar component
347
- *
348
- * @returns {HTMLElement[]} month view content and event content
308
+ * @inheritDoc
349
309
  */
350
- renderMonthViewContent() {
351
- const monthSource = this.calendarView.dateItems;
352
- const currentDate = this.currentPeriod.current;
353
- return monthSource.map((dateArray, index$1) => {
354
- const eventsArray = this.monthEventRenderer.getCurrentRowEvents(dateArray);
355
- const displayEventsArray = this.monthEventRenderer.filterRowDisplayEvents(eventsArray);
356
- return (index.h("div", { key: index$1, class: "calendar-view-row border-divider-bottom" }, dateArray.map((item, itemIndex) => {
357
- return (index.h("div", { class: {
358
- 'row-cell border-divider-right': true,
359
- 'current-month-day': item.compare(currentDate).inMonth,
360
- 'active': item.isToday(),
361
- 'disabled': false,
362
- }, key: `${item.month}-${item.date}`,
363
- // eslint-disable-next-line react/jsx-no-bind
364
- onDblClick: (e) => this.handleDateBlockClick(e, item) },
365
- this.renderDateBlock(item),
366
- this.monthEventRenderer.render(item, eventsArray[itemIndex], displayEventsArray[itemIndex], itemIndex)));
367
- })));
310
+ generate(period) {
311
+ const showWeekends = period.showWeekends;
312
+ let calendarDates = [];
313
+ let week = [];
314
+ const dates = this.generateDates(period);
315
+ dates.forEach((date, i) => {
316
+ if (!(i % 7)) {
317
+ calendarDates[i / 7] = week = [];
318
+ }
319
+ const item = CalendarDate.from(date);
320
+ week.push(item);
368
321
  });
369
- }
370
- /**
371
- * It takes a `CalendarDate` object as a parameter and returns an HTML element representing a date block in the calendar view.
372
- *
373
- * @param {CalendarDate} item the day object
374
- * @returns {HTMLElement} the date block element
375
- */
376
- renderDateBlock(item) {
377
- const isMonthFirstDay = item.date === 1;
378
- return (index.h("div", { class: "date" },
379
- isMonthFirstDay && index.h("div", { class: "month-block" }, getMonthName(item.toDate(), true)),
380
- index.h("div", { role: "button", tabIndex: 0, class: "grid-col",
381
- // eslint-disable-next-line react/jsx-no-bind
382
- onDblClick: (e) => this.goToCurrentDayView(e, item) }, item.date)));
383
- }
384
- /**
385
- * switch to current date day view
386
- *
387
- * @param {MouseEvent} e the double click event object
388
- * @param {CalendarDate} calendarDate the calendar date object
389
- */
390
- goToCurrentDayView(e, calendarDate) {
391
- e.stopPropagation();
392
- this.currentPeriodController.updateCalendarPeriod('day', calendarDate);
393
- }
394
- /**
395
- * emit vega click event when click the date block
396
- *
397
- * @param {MouseEvent} e the mouse event object
398
- * @param {CalendarDate} calendarDate the calendar date object
399
- */
400
- handleDateBlockClick(e, calendarDate) {
401
- const { target, clientX, clientY } = e;
402
- if (this.isMonthBlockBlankArea(target)) {
403
- const { year, month, date } = calendarDate;
404
- this.dateDblClickEmitter.emit({
405
- year,
406
- month,
407
- date,
408
- hour: 0,
409
- mouseEventInfo: { clientX, clientY },
410
- });
322
+ let weekDays = this.generateWeekHead();
323
+ if (showWeekends === false) {
324
+ weekDays = weekDays.slice(1, 6);
325
+ calendarDates = calendarDates.map((items) => items.slice(1, 6));
411
326
  }
412
- }
413
- /**
414
- * determine if the clicked element is blank area
415
- *
416
- * @param {HTMLElement} element the target element
417
- * @returns {boolean} true or false
418
- */
419
- isMonthBlockBlankArea(element) {
420
- // the more button and the calendar event component should not trigger dateDblClick event
421
- return !element.classList.contains('more-button') && element.tagName !== 'VEGA-CALENDAR-EVENT';
327
+ return new CalendarView(weekDays, calendarDates);
422
328
  }
423
329
  }
424
- __decorate$l([
425
- globalSlimmerRegistry.MapToComponentField()
426
- ], VegaCalendarMonthViewRenderer.prototype, "viewMode", void 0);
427
- __decorate$l([
428
- globalSlimmerRegistry.MapToComponentField()
429
- ], VegaCalendarMonthViewRenderer.prototype, "calendarView", void 0);
430
- __decorate$l([
431
- globalSlimmerRegistry.MapToComponentField()
432
- ], VegaCalendarMonthViewRenderer.prototype, "currentPeriod", void 0);
433
- __decorate$l([
434
- globalSlimmerRegistry.MapToComponentField()
435
- ], VegaCalendarMonthViewRenderer.prototype, "calendarViewController", void 0);
436
- __decorate$l([
437
- globalSlimmerRegistry.MapToComponentField()
438
- ], VegaCalendarMonthViewRenderer.prototype, "currentPeriodController", void 0);
439
- __decorate$l([
440
- globalSlimmerRegistry.MapToComponentField()
441
- ], VegaCalendarMonthViewRenderer.prototype, "monthEventRenderer", void 0);
442
- __decorate$l([
443
- globalSlimmerRegistry.MapToComponentField()
444
- ], VegaCalendarMonthViewRenderer.prototype, "dateDblClickEmitter", void 0);
445
- __decorate$l([
446
- globalSlimmerRegistry.MapToComponentField()
447
- ], VegaCalendarMonthViewRenderer.prototype, "translationSlimmer", void 0);
448
330
 
449
- var __decorate$k = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
450
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
451
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
452
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
453
- return c > 3 && r && Object.defineProperty(target, key, r), r;
454
- };
455
- /** The `VegaCalendarViewWithTimeRenderer` class in TypeScript React renders a day view for a calendar component with title, content, and hour blocks. */
456
- class VegaCalendarViewWithTimeRenderer extends globalSlimmerRegistry.VegaSlimmer {
457
- /**
458
- * The render function in TypeScript React returns an array of HTMLElements containing the week calendar view for a specific day.
459
- *
460
- * @returns {HTMLElement} An array of HTMLElement elements containing the rendered content of a calendar view for a
461
- * specific day in the week. The content includes the title and the main content of the calendar view
462
- * for that day.
463
- */
464
- render() {
465
- return (index.h("div", { class: "calendar-view-container" },
466
- this.renderViewTitle(),
467
- this.renderViewContent()));
468
- }
469
- /**
470
- * The function `renderViewTitle` renders a calendar view title and events based on the provided source data.
471
- *
472
- * @returns {HTMLElement} The `renderViewTitle` function returns an HTML element (HTMLElement) that contains a calendar view title container with rows for each day's information.
473
- */
474
- renderViewTitle() {
475
- const source = this.calendarView.dateItems[0];
476
- const weekHead = this.calendarView.weekdays;
477
- return (index.h("div", { class: "calendar-view-title-container" },
478
- index.h("div", { class: "calendar-view-row" },
479
- index.h("div", { class: "time-line-empty" }),
480
- index.h("div", { class: "calendar-view-title" }, source.map((item, index$1) => (index.h("div", { key: item.date, class: { active: item.isToday() } },
481
- index.h("div", null, this.translationSlimmer.t(weekHead[index$1])),
482
- index.h("div", { class: "week-day" }, item.date)))))),
483
- index.h("div", { class: "calendar-view-row calendar-view-event-all-container border-divider-bottom" },
484
- index.h("div", { class: "time-line-all" }, this.translationSlimmer.t('All Day')),
485
- this.dayViewFullDayEventRenderer.render())));
486
- }
487
- /**
488
- * The `renderViewContent` function in TypeScript React renders a calendar view with day blocks and time markers based on the provided data.
489
- *
490
- * @returns {HTMLElement} An HTMLElement containing a calendar view row with day containers, a timeline renderer, a content container, a day list, and hour blocks for each item in the source array.
491
- */
492
- renderViewContent() {
493
- const source = this.calendarView.dateItems[0];
494
- return (index.h("div", { class: "calendar-view-row calendar-view-day-container" },
495
- this.timeLineRenderer.render(),
496
- index.h("div", { class: "calendar-view-content-container" },
497
- index.h("div", { class: "calendar-view-content" }, source.map((item) => {
498
- return (index.h("div", { class: "grid-col border-divider-left", key: item.date },
499
- index.h("div", { class: "hour-empty border-divider-top" }),
500
- this.renderHourBlock(item)));
501
- })),
502
- this.dayViewTimedEventRenderer.render(),
503
- this.timeLineRenderer.renderTimeMarker(source))));
331
+ /**
332
+ * CalendarPeriod is an abstract class that represents a period of date for calendar.
333
+ */
334
+ class CalendarPeriod {
335
+ constructor(count, current) {
336
+ this._count = count;
337
+ this._current = current ? current : CalendarDate.from(new Date());
338
+ this.calculatePeriod(this._current);
504
339
  }
505
340
  /**
506
- * The function `renderHourBlock` returns an array of HTML elements representing hour blocks with time information.
341
+ * The current date of the period.
507
342
  *
508
- * @param {CalendarDate} calendarDate then current calendar date object
509
- * @returns {HTMLElement[]} An array of HTMLElements is being returned. Each HTMLElement represents an hour block with a time value inside a div element.
343
+ * @type {CalendarDate}
510
344
  */
511
- renderHourBlock(calendarDate) {
512
- const timeLineSource = Array(24).fill('');
513
- return timeLineSource.map((_item, index$1) => {
514
- return (index.h("div", { class: "grid-cell border-divider-top",
515
- // eslint-disable-next-line react/jsx-no-bind
516
- onDblClick: (e) => {
517
- this.handleDateBlockClick(calendarDate, index$1, e);
518
- } }));
519
- });
345
+ get current() {
346
+ return this._current;
520
347
  }
521
348
  /**
522
- * emit vega click event when click the date block
523
- *
524
- * @param {CalendarDate} calendarDate the calendar date object
525
- */
526
- handleDateBlockClick(calendarDate, hour, e) {
527
- const { year, month, date } = calendarDate;
528
- const { clientX, clientY } = e;
529
- this.dateDblClickEmitter.emit({ year, month, date, hour, mouseEventInfo: { clientX, clientY } });
530
- }
531
- }
532
- __decorate$k([
533
- globalSlimmerRegistry.MapToComponentField()
534
- ], VegaCalendarViewWithTimeRenderer.prototype, "viewMode", void 0);
535
- __decorate$k([
536
- globalSlimmerRegistry.MapToComponentField()
537
- ], VegaCalendarViewWithTimeRenderer.prototype, "timeLineRenderer", void 0);
538
- __decorate$k([
539
- globalSlimmerRegistry.MapToComponentField()
540
- ], VegaCalendarViewWithTimeRenderer.prototype, "dayViewTimedEventRenderer", void 0);
541
- __decorate$k([
542
- globalSlimmerRegistry.MapToComponentField()
543
- ], VegaCalendarViewWithTimeRenderer.prototype, "dayViewFullDayEventRenderer", void 0);
544
- __decorate$k([
545
- globalSlimmerRegistry.MapToComponentField()
546
- ], VegaCalendarViewWithTimeRenderer.prototype, "calendarView", void 0);
547
- __decorate$k([
548
- globalSlimmerRegistry.MapToComponentField()
549
- ], VegaCalendarViewWithTimeRenderer.prototype, "calendarViewController", void 0);
550
- __decorate$k([
551
- globalSlimmerRegistry.MapToComponentField()
552
- ], VegaCalendarViewWithTimeRenderer.prototype, "dateDblClickEmitter", void 0);
553
- __decorate$k([
554
- globalSlimmerRegistry.MapToComponentField()
555
- ], VegaCalendarViewWithTimeRenderer.prototype, "translationSlimmer", void 0);
556
-
557
- var __decorate$j = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
558
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
559
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
560
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
561
- return c > 3 && r && Object.defineProperty(target, key, r), r;
562
- };
563
- /** The `VegaCalendarTimeLineRenderer` class in TypeScript React renders a time line with custom time format options and includes methods for rendering time markers and the time line itself. */
564
- class VegaCalendarTimeLineRenderer extends globalSlimmerRegistry.VegaSlimmer {
565
- /**
566
- * takes an array of `CalendarDate` objects as input and returns an HTML element
349
+ * The start date of the period
567
350
  *
568
- * @param {CalendarDate[]} source
569
- * @returns {HTMLElement} the html element
351
+ * @type {CalendarDate}
570
352
  */
571
- renderTimeMarker(source) {
572
- const isVisible = source.findIndex((calendarDate) => calendarDate.isToday()) >= 0;
573
- return (index.h("div", { class: {
574
- 'time-marker-container': true,
575
- 'hidden': !isVisible,
576
- } },
577
- index.h("div", { class: "time-marker", style: { top: this.getTimeMarkerPosition() }, ref: (div) => (this.timeMarkerRef = div) }, source.map((item) => {
578
- return index.h("div", { key: item.date, class: { active: item.isToday() } });
579
- }))));
353
+ get startDate() {
354
+ return this._startDate;
580
355
  }
581
356
  /**
582
- * rendering the time line component as an HTML element
357
+ * The end date of the period
583
358
  *
584
- * @returns {HTMLElement} the html element
359
+ * @type {CalendarDate}
585
360
  */
586
- render() {
587
- const timeLineSource = this.getTimeLineTitles();
588
- return (index.h("div", { class: "time-line", ref: (div) => (this.timeLineRef = div) },
589
- index.h("div", { class: "hour-empty" }),
590
- timeLineSource.map((time, index$1) => {
591
- return (index.h("div", { key: time },
592
- index.h("div", { class: "time-text", "data-time": index$1 === 0 ? 24 : index$1 }, time)));
593
- })));
361
+ get endDate() {
362
+ return this._endDate;
594
363
  }
595
364
  /**
596
- * scroll to current time line block if change view mode to week or day
365
+ * The count of the period
597
366
  *
598
- * @param {VegaCalendarViewModeType} viewMode the view mode
367
+ * @type {number}
599
368
  */
600
- updateTimeLine(viewMode) {
601
- this.scrollToTargetTimeBlock(viewMode);
602
- this.syncTimeMarkerPosition(viewMode);
369
+ get count() {
370
+ return this._count;
603
371
  }
604
372
  /**
605
- * remove setInterval when component destroy
373
+ * This function returns the type of the object.
374
+ *
375
+ * @type {string}
606
376
  */
607
- clearTimer() {
608
- clearInterval(this.timeMarkerPositionTimer);
377
+ get type() {
378
+ return this._type;
609
379
  }
610
380
  /**
611
- * Add the time mark position update logic if the component add back to page
381
+ * This function returns the showWeekends of the object.
382
+ *
383
+ * @type {boolean}
612
384
  */
613
- updateTimeLineIfComponentAddBack() {
614
- this.syncTimeMarkerPosition(this.viewMode);
385
+ get showWeekends() {
386
+ return this._showWeekends;
615
387
  }
616
388
  /**
617
- * Should display the current time block in the view if the default view mode is not month
389
+ * Go to a specific date.
390
+ *
391
+ * @param {CalendarDate} date - The date to go to.
392
+ * @returns {this} - The current period.
618
393
  */
619
- displayCurrentTimeBlockByDefault() {
620
- this.scrollToTargetTimeBlock(this.viewMode);
394
+ goTo(date) {
395
+ return this.createBy(date);
621
396
  }
622
397
  /**
623
- * The function `getTimeMarkerPosition` calculates the position of the current time marker as a percentage of the day.
398
+ * Go to now.
624
399
  *
625
- * @returns {string} a string representing the current time marker position as a percentage of the day.
400
+ * @returns {this} - The current period.
626
401
  */
627
- getTimeMarkerPosition() {
628
- const now = new Date();
629
- const minutesOneDay = 24 * 60;
630
- return ((now.getHours() * 60 + now.getMinutes()) / minutesOneDay) * 100 + '%';
402
+ now() {
403
+ return this.createBy(CalendarDate.from(new Date()));
631
404
  }
632
405
  /**
633
- * The function `getTimeLineTitles` generates a time line array based on the specified time format (24-hour) and stores it in the `timeLineSource` property.
406
+ * Calculate the period start date and end date.
634
407
  *
635
- * @returns {string[]} returns an array of strings representing the time line
408
+ * @param {CalendarDate} date - The date to calculate the period from.
636
409
  */
637
- getTimeLineTitles() {
638
- const timeLine = [];
639
- if (this.timeFormat === '12-hour') {
640
- timeLine.push('12 AM');
641
- for (let i = 1; i < 12; i++) {
642
- timeLine.push(`${i} AM`);
643
- }
644
- timeLine.push('12 PM');
645
- for (let i = 1; i < 12; i++) {
646
- timeLine.push(`${i} PM`);
647
- }
648
- }
649
- else {
650
- for (let i = 0; i < 24; i++) {
651
- timeLine.push(date.pad(i));
652
- }
410
+ calculatePeriod(date) {
411
+ const cursor = date.toDate();
412
+ if (this.count > 1) {
413
+ cursor.setDate(cursor.getDate() - getWeekdays().indexOf(cursor.getDay()));
653
414
  }
654
- return timeLine;
415
+ this._startDate = CalendarDate.from(cursor);
416
+ cursor.setDate(cursor.getDate() + this.count - 1);
417
+ this._endDate = CalendarDate.from(cursor);
418
+ }
419
+ }
420
+
421
+ /**
422
+ * Period of day.
423
+ */
424
+ class DayPeriod extends CalendarPeriod {
425
+ constructor(current, showWeekends) {
426
+ super(DayPeriod.DISPLAY_DATE_COUNT, current);
427
+ this._type = 'day';
428
+ this._showWeekends = true;
429
+ this._showWeekends = showWeekends === false ? false : true;
655
430
  }
656
- /*
657
- * The below method is e2e-test covered in
658
- * @see{module:vega-calendar-scroll-to-current-time}
659
- */
660
- /* istanbul ignore next */
661
431
  /**
662
- * Update the time marker position with the time
663
- *
664
- * @param {VegaCalendarViewModeType} viewMode view mode value
432
+ * @inheritDoc
665
433
  */
666
- syncTimeMarkerPosition(viewMode) {
667
- clearInterval(this.timeMarkerPositionTimer);
668
- if (viewMode !== 'month') {
669
- this.timeMarkerPositionTimer = setInterval(() => {
670
- if (this.timeMarkerRef) {
671
- this.timeMarkerRef.style.top = this.getTimeMarkerPosition();
672
- }
673
- }, 60 * 1000);
434
+ next() {
435
+ const nextDate = this.current.toDate();
436
+ nextDate.setDate(nextDate.getDate() + 1);
437
+ let calendarDate = CalendarDate.from(nextDate);
438
+ if (this._showWeekends === false) {
439
+ calendarDate = getClosestWorkday(calendarDate);
674
440
  }
441
+ return this.createBy(calendarDate);
675
442
  }
676
- /*
677
- * The below method is e2e-test covered in
678
- * @see{module:vega-calendar-scroll-to-current-time}
443
+ /**
444
+ * @inheritDoc
679
445
  */
680
- /* istanbul ignore next */
446
+ previous() {
447
+ const previousDate = this.current.toDate();
448
+ previousDate.setDate(previousDate.getDate() - 1);
449
+ let calendarDate = CalendarDate.from(previousDate);
450
+ if (this._showWeekends === false) {
451
+ calendarDate = getClosestWorkday(calendarDate, DateDirection.PREVIOUS);
452
+ }
453
+ return this.createBy(calendarDate);
454
+ }
681
455
  /**
682
- * scroll the time line in to current view
456
+ * Go to now.
683
457
  *
684
- * @param {VegaCalendarViewModeType} viewMode view mode value
458
+ * @returns {this} - The current period.
685
459
  */
686
- scrollToTargetTimeBlock(viewMode) {
687
- if (viewMode !== 'month') {
688
- // add setTimeout here to make sure call the scroll into view after time line rendered.
689
- const oneFrame = 16;
690
- setTimeout(() => {
691
- var _a, _b;
692
- const hour = new Date().getHours();
693
- (_b = (_a = this.timeLineRef) === null || _a === void 0 ? void 0 : _a.querySelector(`[data-time='${hour < 23 ? hour + 1 : hour}']`)) === null || _b === void 0 ? void 0 : _b.scrollIntoView({ block: 'end' });
694
- }, oneFrame);
460
+ now() {
461
+ let calendarDate = CalendarDate.from(new Date());
462
+ if (this._showWeekends === false) {
463
+ calendarDate = getClosestWorkday(calendarDate);
695
464
  }
465
+ return this.createBy(calendarDate);
466
+ }
467
+ /**
468
+ * @inheritDoc
469
+ */
470
+ createBy(current) {
471
+ return new DayPeriod(current, this._showWeekends);
696
472
  }
697
473
  }
698
- __decorate$j([
699
- globalSlimmerRegistry.MapToComponentField()
700
- ], VegaCalendarTimeLineRenderer.prototype, "timeFormat", void 0);
701
- __decorate$j([
702
- globalSlimmerRegistry.MapToComponentField()
703
- ], VegaCalendarTimeLineRenderer.prototype, "viewMode", void 0);
704
- __decorate$j([
705
- globalSlimmerRegistry.MapToComponentMethod('watchViewModeChange')
706
- ], VegaCalendarTimeLineRenderer.prototype, "updateTimeLine", null);
707
- __decorate$j([
708
- globalSlimmerRegistry.MapToComponentMethod('disconnectedCallback')
709
- ], VegaCalendarTimeLineRenderer.prototype, "clearTimer", null);
710
- __decorate$j([
711
- globalSlimmerRegistry.MapToComponentMethod('connectedCallback')
712
- ], VegaCalendarTimeLineRenderer.prototype, "updateTimeLineIfComponentAddBack", null);
713
- __decorate$j([
714
- globalSlimmerRegistry.MapToComponentMethod('componentDidLoad')
715
- ], VegaCalendarTimeLineRenderer.prototype, "displayCurrentTimeBlockByDefault", null);
716
-
717
- /**
718
- * Get a week days array
719
- *
720
- * @param {number} firstWeekDay - The first week day (0: Sunday, 1: Monday, ...)
721
- * @returns {number[]} - The week days array
722
- */
723
- const getWeekdays = (firstWeekDay = 0) => {
724
- const weekdays = [0, 1, 2, 3, 4, 5, 6];
725
- return weekdays.concat(weekdays).slice(firstWeekDay, firstWeekDay + 7);
726
- };
474
+ DayPeriod.DISPLAY_DATE_COUNT = 1;
727
475
 
728
476
  /**
729
- * Calendar view generator abstract class.
477
+ * Period of the week
730
478
  */
731
- class CalendarViewGenerator {
732
- constructor() {
733
- this.WEEKDAYS_SHORT = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
734
- this.weekdays = getWeekdays();
479
+ class WeekPeriod extends CalendarPeriod {
480
+ constructor(current, showWeekends) {
481
+ super(WeekPeriod.DISPLAY_DATE_COUNT, current);
482
+ this._type = 'week';
483
+ this._showWeekends = true;
484
+ this._showWeekends = showWeekends === false ? false : true;
735
485
  }
736
486
  /**
737
- * Get weekday names.
738
- *
739
- * @returns {string[]} - The weekday strings
487
+ * @inheritDoc
740
488
  */
741
- getWeekdayNames() {
742
- return this.WEEKDAYS_SHORT;
489
+ next() {
490
+ const nextWeekStartDate = this.current.toDate();
491
+ nextWeekStartDate.setDate(nextWeekStartDate.getDate() - getWeekdays().indexOf(nextWeekStartDate.getDay()) + 7);
492
+ return this.createBy(CalendarDate.from(nextWeekStartDate));
743
493
  }
744
494
  /**
745
- * Generate calendar dates
746
- *
747
- * @param {CalendarPeriod} period - The calendar period
748
- * @returns {Date[]} - The date result
495
+ * @inheritDoc
749
496
  */
750
- generateDates(period) {
751
- const cursor = period.startDate.toDate();
752
- const dates = [];
753
- for (let i = 0; i < period.count; i++) {
754
- dates.push(new Date(cursor));
755
- cursor.setDate(cursor.getDate() + 1);
756
- }
757
- return dates;
497
+ previous() {
498
+ const previousWeekStartDate = this.current.toDate();
499
+ previousWeekStartDate.setDate(previousWeekStartDate.getDate() - getWeekdays().indexOf(previousWeekStartDate.getDay()) - 7);
500
+ return this.createBy(CalendarDate.from(previousWeekStartDate));
758
501
  }
759
502
  /**
760
- * Generate calendar head
761
- *
762
- * @returns {string[]} - The data of week head
503
+ * @inheritDoc
763
504
  */
764
- generateWeekHead() {
765
- return this.weekdays.map((day) => this.getWeekdayNames()[day]);
505
+ createBy(current) {
506
+ return new WeekPeriod(current, this._showWeekends);
766
507
  }
767
508
  }
509
+ WeekPeriod.DISPLAY_DATE_COUNT = 7;
768
510
 
769
511
  /**
770
- * Calendar view
512
+ * Period of month
771
513
  */
772
- class CalendarView {
773
- constructor(weekdays, dateItems) {
774
- this._weekdays = weekdays;
775
- this._dateItems = dateItems;
514
+ class MonthPeriod extends CalendarPeriod {
515
+ constructor(current, showWeekends) {
516
+ super(MonthPeriod.DISPLAY_DATE_COUNT, MonthPeriod.getMonthFirstDay(current));
517
+ this._type = 'month';
518
+ this._showWeekends = true;
519
+ this._showWeekends = showWeekends === false ? false : true;
776
520
  }
777
521
  /**
778
- * The week head of the calendar view
522
+ * The function `getMonthFirstDay` returns the first day of a given month in a calendar.
779
523
  *
780
- * @type {string[]}
524
+ * @param {CalendarDate} [calendarDate] - The `calendarDate` parameter is an optional parameter of
525
+ * type `CalendarDate`. It represents a specific date in the calendar. If a `calendarDate` is
526
+ * provided, the function will use that date to determine the first day of the month. If no
527
+ * `calendarDate` is provided, the function
528
+ * @returns {CalendarDate} A new `CalendarDate` object representing the first day of the month from the provided
529
+ * `calendarDate` parameter or the current date if no parameter is provided.
781
530
  */
782
- get weekdays() {
783
- return this._weekdays;
531
+ static getMonthFirstDay(calendarDate) {
532
+ const date = calendarDate || CalendarDate.from(new Date());
533
+ return new CalendarDate(date.year, date.month, 1);
784
534
  }
785
535
  /**
786
- * The date items of the calendar view
787
- *
788
- * @type {CalendarDate[][]}
536
+ * @inheritDoc
789
537
  */
790
- get dateItems() {
791
- return this._dateItems;
538
+ next() {
539
+ const next = this.current.toDate();
540
+ next.setMonth(next.getMonth() + 1);
541
+ return this.createBy(CalendarDate.from(next));
542
+ }
543
+ /**
544
+ * @inheritDoc
545
+ */
546
+ previous() {
547
+ const previous = this.current.toDate();
548
+ previous.setMonth(previous.getMonth() - 1);
549
+ return this.createBy(CalendarDate.from(previous));
792
550
  }
793
- }
794
-
795
- /**
796
- * Day view calendar generator
797
- */
798
- class DayViewGenerator extends CalendarViewGenerator {
799
551
  /**
800
552
  * @inheritDoc
801
553
  */
802
- generate(period) {
803
- return new CalendarView([this.generateWeekHead()[period.current.toDate().getDay()]], [[period.current]]);
554
+ createBy(current) {
555
+ return new MonthPeriod(current, this._showWeekends);
804
556
  }
805
557
  }
558
+ MonthPeriod.DISPLAY_DATE_COUNT = 6 * 7;
806
559
 
560
+ var DateDirection;
561
+ (function (DateDirection) {
562
+ DateDirection["PREVIOUS"] = "-1";
563
+ DateDirection["NEXT"] = "1";
564
+ })(DateDirection || (DateDirection = {}));
807
565
  /**
808
- * Calendar date class
566
+ * get month name from the month number
567
+ *
568
+ * @param {Date} date the date object
569
+ * @param {boolean} isShortName short or long name
570
+ * @returns {string} the month English name
809
571
  */
810
- class CalendarDate {
811
- constructor(year, month, date) {
812
- this._date = date;
813
- this._month = month;
814
- this._year = year;
572
+ function getMonthName(date, isShortName = false) {
573
+ return date.toLocaleDateString('en-US', { month: isShortName ? 'short' : 'long' });
574
+ }
575
+ /**
576
+ * The function `getTimeIndex` calculates the index of a given time string based on a specified time unit.
577
+ *
578
+ * @param {string} timeString - A string representing a time in the format "HH:MM", where HH is the hour and MM is the minutes.
579
+ * @param {number} [unit=15] - The `unit` parameter in the `getTimeIndex` function is used to specify
580
+ * the interval in minutes for dividing the day. By default, it is set to 15 minutes, meaning that the
581
+ * day will be divided into 15-minute intervals.
582
+ * @returns {number} the index of the given time string based on the specified time unit.
583
+ */
584
+ function getTimeIndex(timeString, unit = 15) {
585
+ const [hour, minutes] = timeString.split(':');
586
+ return Math.round((Number(hour) * 60 + Number(minutes)) / unit);
587
+ }
588
+ /**
589
+ * Returns a string that includes the event key for a calendar event slot.
590
+ *
591
+ * @param {string} eventKey - represents the key or identifier of a calendar event.
592
+ * @returns {string} a string that is a concatenation of 'vega-calendar-event-slot-' and the eventKey parameter.
593
+ */
594
+ function getCalendarEventSlotName(eventKey) {
595
+ return 'vega-calendar-event-slot-' + eventKey;
596
+ }
597
+ /**
598
+ * Returns the closest workday to a given calendar date based on a specified direction.
599
+ *
600
+ * @param {Date} date - The starting date from which you want to find the closest workday.
601
+ * @param {'-1' | '1'} [direction=1] - Determines whether to find the closest workday in the past or future. It can have two possible values:
602
+ * @returns {Date} The closest workday to the input date
603
+ */
604
+ function getClosestWorkday(date, direction = DateDirection.NEXT) {
605
+ const day = date.toDate().getDay();
606
+ if (day === 0 || day === 6) {
607
+ let nextWorkdayGap = day === 0 ? 1 : 2;
608
+ if (direction === DateDirection.PREVIOUS) {
609
+ nextWorkdayGap = day === 0 ? -2 : -1;
610
+ }
611
+ return CalendarDate.from(new Date(date.year, date.month - 1, date.date + nextWorkdayGap));
612
+ }
613
+ return date;
614
+ }
615
+
616
+ const ellipsisVertical = {
617
+ icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M48 464a48 48 0 1 1 0-96 48 48 0 1 1 0 96zm0-160a48 48 0 1 1 0-96 48 48 0 1 1 0 96zM0 96a48 48 0 1 1 96 0A48 48 0 1 1 0 96z"/></svg>`,
618
+ };
619
+
620
+ var __decorate$n = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
621
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
622
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
623
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
624
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
625
+ };
626
+ /** The `VegaCalendarSwitchPanelRenderer` class in TypeScript React renders a calendar switch panel with date navigation, view selection, and action buttons. */
627
+ class VegaCalendarSwitchPanelRenderer extends globalSlimmerRegistry.VegaSlimmer {
628
+ constructor() {
629
+ super(...arguments);
630
+ /**
631
+ * This function is responsible for updating the `viewMode` property of the `VegaCalendarSwitchPanelRenderer` class with the value extracted from the `input` parameter.
632
+ *
633
+ * @param {NotifyObserverPayload<VegaCalendarViewModeType>} input mark which view should be selected
634
+ */
635
+ this.handleViewChange = (input) => {
636
+ this.currentPeriodController.updateCalendarPeriod(input.detail, this.currentPeriod.current);
637
+ };
638
+ /**
639
+ * reset view content to today
640
+ */
641
+ this.todayButtonClick = () => {
642
+ this.currentPeriodController.setCurrentPeriod(this.currentPeriod.now());
643
+ };
644
+ /**
645
+ * update view content after click next button
646
+ */
647
+ this.nextButtonClick = () => {
648
+ this.currentPeriodController.setCurrentPeriod(this.currentPeriod.next());
649
+ };
650
+ /**
651
+ * update view content after click previous button
652
+ */
653
+ this.prevButtonClick = () => {
654
+ this.currentPeriodController.setCurrentPeriod(this.currentPeriod.previous());
655
+ };
656
+ /**
657
+ * The more action menu item click
658
+ *
659
+ * @param {NotifyObserverPayload<string>} payload The object contains the menu item key
660
+ */
661
+ this.moreActionMenuClick = (payload) => {
662
+ this.moreActionClickEmitter.emit(payload.detail);
663
+ };
815
664
  }
816
665
  /**
817
- * Create a calendar date from a Date object
666
+ * get the switch panel container element
818
667
  *
819
- * @param {Date} date - The Date object
820
- * @returns {CalendarDate} - Return a CalendarDate object
668
+ * @returns {HTMLElement} container element
821
669
  */
822
- static from(date) {
823
- return new CalendarDate(date.getFullYear(), date.getMonth() + 1, date.getDate());
670
+ getSwitchPanelRef() {
671
+ return this.switchPanelRef;
824
672
  }
825
673
  /**
826
- * The year of the calendar date
674
+ * calendar switch panel with date switch, view switch, add new button, and more action components.
827
675
  *
828
- * @type {number}
676
+ * @returns {HTMLElement} html element
829
677
  */
830
- get year() {
831
- return this._year;
832
- }
833
- set year(value) {
834
- this._year = value;
678
+ render() {
679
+ return (index.h("vega-flex", { direction: "row", gap: "size-16", justifyContent: "space-between", alignItems: "center", class: "calendar-switch-panel", ref: (node) => (this.switchPanelRef = node) },
680
+ this.renderDateSwitch(),
681
+ index.h("div", { class: "calendar-view-switch-container" },
682
+ this.renderViewSwitch(),
683
+ this.renderMoreActionMenu())));
835
684
  }
836
685
  /**
837
- * The month of the calendar date
686
+ * The `renderDateSwitch` function returns a container with buttons for switching dates and displaying the current date.
838
687
  *
839
- * @type {number}
688
+ * @returns {HTMLDivElement} action button elements container.
840
689
  */
841
- get month() {
842
- return this._month;
843
- }
844
- set month(value) {
845
- this._month = value;
690
+ renderDateSwitch() {
691
+ return (index.h("div", { class: "calendar-date-switch-container" },
692
+ index.h("vega-button", { variant: "secondary", size: "small", ref: (button) => {
693
+ domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(button, vegaEventId.VegaClick, this.todayButtonClick);
694
+ }, label: this.translationSlimmer.t('Today') }),
695
+ index.h("vega-button-circle", { variant: "secondary", size: "small", icon: internalIconManager.VegaInternalIconManager.getIconKey('chevron-left'), label: "previous", showTooltip: false, ref: (button) => {
696
+ domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(button, vegaEventId.VegaClick, this.prevButtonClick);
697
+ } }),
698
+ index.h("vega-button-circle", { variant: "secondary", size: "small", icon: internalIconManager.VegaInternalIconManager.getIconKey('chevron-right'), label: "next", showTooltip: false, ref: (button) => {
699
+ domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(button, vegaEventId.VegaClick, this.nextButtonClick);
700
+ } }),
701
+ this.renderCurrentPeriod()));
846
702
  }
847
703
  /**
848
- * The date of the calendar date
704
+ * The function `renderCurrentPeriod` returns an HTML element displaying the view date content summary info.
849
705
  *
850
- * @type {number}
706
+ * @returns {HTMLVegaFontElement} The text content inside the element is "Current Date Test".
851
707
  */
852
- get date() {
853
- return this._date;
854
- }
855
- set date(value) {
856
- this._date = value;
708
+ renderCurrentPeriod() {
709
+ return (index.h("vega-font", { class: "calendar-current-date", variant: "font-field-label", color: "text-primary" }, this.getViewDateSummary()));
857
710
  }
858
711
  /**
859
- * Verify whether the calendar date is today
712
+ * The function `renderViewSwitch` returns a JSX element for rendering a segment control component in a TypeScript React application.
860
713
  *
861
- * @returns {boolean} - Return true if the calendar date is today. Otherwise, return false.
714
+ * @returns {HTMLElement} An HTMLElement containing a vega-segment-control element with specific attributes and event handling.
862
715
  */
863
- isToday() {
864
- const today = new Date();
865
- return (today.getFullYear() === this.year &&
866
- today.getMonth() + 1 === this.month &&
867
- today.getDate() === this.date);
716
+ renderViewSwitch() {
717
+ return (index.h("vega-segment-control", { segments: VegaCalendarSwitchPanelRenderer.views.map((item) => (Object.assign(Object.assign({}, item), { text: this.translationSlimmer.t(item.text) }))), size: "small", variant: "text-only", selected: this.viewMode, ref: (node) => {
718
+ domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(node, vegaEventId.VegaChange, this.handleViewChange);
719
+ } }));
868
720
  }
869
721
  /**
870
- * Convert the calendar date to a Date object
722
+ * Render an more action button if dropdown source is not empty
871
723
  *
872
- * @returns {Date} - Return a Date object
724
+ * @returns {Nullable<HTMLElement>} the additional element
873
725
  */
874
- toDate() {
875
- return new Date(this.year, this.month - 1, this.date);
726
+ renderMoreActionMenu() {
727
+ var _a, _b;
728
+ if ((_b = (_a = this.moreActionDropdownProps) === null || _a === void 0 ? void 0 : _a.source) === null || _b === void 0 ? void 0 : _b.length) {
729
+ return (index.h("vega-dropdown", Object.assign({ alignment: "end", trigger: "click" }, this.moreActionDropdownProps, { ref: (node) => {
730
+ domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(node, vegaEventId.VegaDropdownClick, this.moreActionMenuClick);
731
+ } }),
732
+ index.h("vega-button-circle", { size: "small", icon: internalIconManager.VegaInternalIconManager.getIconKey('ellipsis-vertical'), variant: "icon-only" })));
733
+ }
876
734
  }
877
735
  /**
878
- * Compare with another calendar date
736
+ * Get the view content date summary info, such as `January, 2024` or `10 January, 2024` or `28 December, 2023 - 3 January, 2024`
879
737
  *
880
- * @param {CalendarDate} date - The calendar date to compare with
881
- * @returns {DateCompareResult} - Return a DateCompareResult object
738
+ * @returns {string} string
882
739
  */
883
- compare(date) {
884
- const { year, month } = date;
885
- const result = {
886
- isPreviousMonth: false,
887
- inMonth: false,
888
- isNextMonth: false,
889
- };
890
- if (this.year === year) {
891
- if (this.month < month) {
892
- result.isPreviousMonth = true;
740
+ getViewDateSummary() {
741
+ const currentDate = this.currentPeriod.current;
742
+ let result = '';
743
+ switch (this.viewMode) {
744
+ case 'day': {
745
+ const monthName = this.translationSlimmer.t(getMonthName(currentDate.toDate()));
746
+ result = `${currentDate.date} ${monthName}, ${currentDate.year}`;
747
+ break;
893
748
  }
894
- else if (this.month > month) {
895
- result.isNextMonth = true;
749
+ case 'week': {
750
+ const weekItems = this.calendarView.dateItems[0];
751
+ const start = weekItems[0];
752
+ const end = weekItems[weekItems.length - 1];
753
+ const [startMonthName, endMonthName] = [start, end].map((item) => this.translationSlimmer.t(getMonthName(item.toDate())));
754
+ result = `${start.date} ${startMonthName}${start.year === end.year ? '' : ', ' + start.year} - ${end.date} ${endMonthName}, ${end.year}`;
755
+ break;
896
756
  }
897
- else {
898
- result.inMonth = true;
757
+ case 'month': {
758
+ const monthName = this.translationSlimmer.t(getMonthName(currentDate.toDate()));
759
+ result = `${monthName}, ${currentDate.year}`;
760
+ break;
899
761
  }
900
762
  }
901
- else if (this.year > year) {
902
- result.isNextMonth = true;
903
- }
904
- else {
905
- result.isPreviousMonth = true;
906
- }
907
763
  return result;
908
764
  }
765
+ }
766
+ (() => {
767
+ internalIconManager.VegaInternalIconManager.register({
768
+ 'chevron-right': chevronRight,
769
+ 'chevron-left': chevronLeft,
770
+ 'ellipsis-vertical': ellipsisVertical,
771
+ });
772
+ })();
773
+ VegaCalendarSwitchPanelRenderer.views = [
774
+ { text: 'Day', key: 'day' },
775
+ { text: 'Week', key: 'week' },
776
+ { text: 'Month', key: 'month' },
777
+ ];
778
+ __decorate$n([
779
+ globalSlimmerRegistry.MapToComponentField()
780
+ ], VegaCalendarSwitchPanelRenderer.prototype, "viewMode", void 0);
781
+ __decorate$n([
782
+ globalSlimmerRegistry.MapToComponentField()
783
+ ], VegaCalendarSwitchPanelRenderer.prototype, "calendarView", void 0);
784
+ __decorate$n([
785
+ globalSlimmerRegistry.MapToComponentField()
786
+ ], VegaCalendarSwitchPanelRenderer.prototype, "currentPeriod", void 0);
787
+ __decorate$n([
788
+ globalSlimmerRegistry.MapToComponentField()
789
+ ], VegaCalendarSwitchPanelRenderer.prototype, "moreActionDropdownProps", void 0);
790
+ __decorate$n([
791
+ globalSlimmerRegistry.MapToComponentField()
792
+ ], VegaCalendarSwitchPanelRenderer.prototype, "moreActionClickEmitter", void 0);
793
+ __decorate$n([
794
+ globalSlimmerRegistry.MapToComponentField()
795
+ ], VegaCalendarSwitchPanelRenderer.prototype, "currentPeriodController", void 0);
796
+ __decorate$n([
797
+ globalSlimmerRegistry.MapToComponentField()
798
+ ], VegaCalendarSwitchPanelRenderer.prototype, "calendarViewController", void 0);
799
+ __decorate$n([
800
+ globalSlimmerRegistry.MapToComponentField()
801
+ ], VegaCalendarSwitchPanelRenderer.prototype, "translationSlimmer", void 0);
802
+
803
+ var __decorate$m = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
804
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
805
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
806
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
807
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
808
+ };
809
+ /** renders different views based on the specified view mode using month, week, and day view render. */
810
+ class VegaCalendarViewRenderer extends globalSlimmerRegistry.VegaSlimmer {
909
811
  /**
910
- * The function "equal" compares the year, month, and date of two CalendarDate objects and returns true if they are equal.
812
+ * render the calendar month/week/day view
911
813
  *
912
- * @param {CalendarDate} calendarDate - The `equal` method in the code snippet is a function that compares the year, month, and date of the current `CalendarDate` object with another
913
- * `CalendarDate` object passed as a parameter. The method returns `true` if all three values (year, month, date) are equal
914
- * @returns {boolean} The date is same day with current
814
+ * @returns {HTMLElement} html element
915
815
  */
916
- equal(calendarDate) {
917
- const { year, month, date } = calendarDate;
918
- return this._year === year && this._month === month && this._date === date;
816
+ render() {
817
+ return (index.h("div", { class: `calendar-view calendar-view-${this.viewMode} ${this.showWeekends === false ? 'calendar-hide-weekends' : ''}` }, this.viewMode === 'month'
818
+ ? this.monthViewRenderer.render()
819
+ : this.viewWithTimeRenderer.render()));
919
820
  }
920
821
  }
822
+ __decorate$m([
823
+ globalSlimmerRegistry.MapToComponentField()
824
+ ], VegaCalendarViewRenderer.prototype, "viewMode", void 0);
825
+ __decorate$m([
826
+ globalSlimmerRegistry.MapToComponentField()
827
+ ], VegaCalendarViewRenderer.prototype, "showWeekends", void 0);
828
+ __decorate$m([
829
+ globalSlimmerRegistry.MapToComponentField()
830
+ ], VegaCalendarViewRenderer.prototype, "monthViewRenderer", void 0);
831
+ __decorate$m([
832
+ globalSlimmerRegistry.MapToComponentField()
833
+ ], VegaCalendarViewRenderer.prototype, "viewWithTimeRenderer", void 0);
921
834
 
922
- /**
923
- * Calendar week view generator
924
- */
925
- class WeekViewGenerator extends CalendarViewGenerator {
835
+ var __decorate$l = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
836
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
837
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
838
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
839
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
840
+ };
841
+ /** The code provided is defining a TypeScript class called `VegaCalendarMonthViewRenderer` that extends `VegaSlimmer`. This class is responsible for rendering a month view of a calendar component. */
842
+ class VegaCalendarMonthViewRenderer extends globalSlimmerRegistry.VegaSlimmer {
926
843
  /**
927
- * @inheritDoc
844
+ * the HTML elements that represent the month view of a calendar component.
845
+ *
846
+ * @returns {HTMLElement} the month view calendar content
928
847
  */
929
- generate(period) {
930
- const dates = this.generateDates(period);
931
- return new CalendarView(this.generateWeekHead(), [dates.map(CalendarDate.from)]);
848
+ render() {
849
+ const weekHead = this.calendarView.weekdays;
850
+ return (index.h("div", { class: "calendar-view-month-container" },
851
+ index.h("div", { class: "calendar-view-row calendar-view-title border-divider-bottom" }, weekHead.map((title) => (index.h("div", { key: title }, this.translationSlimmer.t(title))))),
852
+ this.renderMonthViewContent()));
932
853
  }
933
- }
934
-
935
- /**
936
- * Calendar month view generator
937
- */
938
- class MonthViewGenerator extends CalendarViewGenerator {
939
854
  /**
940
- * @inheritDoc
855
+ * generating the HTML elements that represent the content of the month view in a calendar component
856
+ *
857
+ * @returns {HTMLElement[]} month view content and event content
941
858
  */
942
- generate(period) {
943
- const calendarDates = [];
944
- let week = [];
945
- const dates = this.generateDates(period);
946
- dates.forEach((date, i) => {
947
- if (!(i % 7)) {
948
- calendarDates[i / 7] = week = [];
949
- }
950
- const item = CalendarDate.from(date);
951
- week.push(item);
859
+ renderMonthViewContent() {
860
+ const monthSource = this.calendarView.dateItems;
861
+ const currentDate = this.currentPeriod.current;
862
+ return monthSource.map((dateArray, index$1) => {
863
+ const eventsArray = this.monthEventRenderer.getCurrentRowEvents(dateArray);
864
+ const displayEventsArray = this.monthEventRenderer.filterRowDisplayEvents(eventsArray);
865
+ return (index.h("div", { key: index$1, class: "calendar-view-row border-divider-bottom" }, dateArray.map((item, itemIndex) => {
866
+ return (index.h("div", { class: {
867
+ 'row-cell border-divider-right': true,
868
+ 'current-month-day': item.compare(currentDate).inMonth,
869
+ 'active': item.isToday(),
870
+ 'disabled': false,
871
+ }, key: `${item.month}-${item.date}`,
872
+ // eslint-disable-next-line react/jsx-no-bind
873
+ onDblClick: (e) => this.handleDateBlockClick(e, item) },
874
+ this.renderDateBlock(item),
875
+ this.monthEventRenderer.render(item, eventsArray[itemIndex], displayEventsArray[itemIndex], itemIndex)));
876
+ })));
952
877
  });
953
- return new CalendarView(this.generateWeekHead(), calendarDates);
954
878
  }
955
- }
956
-
957
- /**
958
- * CalendarPeriod is an abstract class that represents a period of date for calendar.
959
- */
960
- class CalendarPeriod {
961
- constructor(count, current) {
962
- this._count = count;
963
- this._current = current ? current : CalendarDate.from(new Date());
964
- this.calculatePeriod(this._current);
879
+ /**
880
+ * It takes a `CalendarDate` object as a parameter and returns an HTML element representing a date block in the calendar view.
881
+ *
882
+ * @param {CalendarDate} item the day object
883
+ * @returns {HTMLElement} the date block element
884
+ */
885
+ renderDateBlock(item) {
886
+ const isMonthFirstDay = item.date === 1;
887
+ return (index.h("div", { class: "date" },
888
+ isMonthFirstDay && index.h("div", { class: "month-block" }, getMonthName(item.toDate(), true)),
889
+ index.h("div", { role: "button", tabIndex: 0, class: "grid-col",
890
+ // eslint-disable-next-line react/jsx-no-bind
891
+ onDblClick: (e) => this.goToCurrentDayView(e, item) }, item.date)));
965
892
  }
966
893
  /**
967
- * The current date of the period.
894
+ * switch to current date day view
968
895
  *
969
- * @type {CalendarDate}
896
+ * @param {MouseEvent} e the double click event object
897
+ * @param {CalendarDate} calendarDate the calendar date object
970
898
  */
971
- get current() {
972
- return this._current;
899
+ goToCurrentDayView(e, calendarDate) {
900
+ e.stopPropagation();
901
+ this.currentPeriodController.updateCalendarPeriod('day', calendarDate);
973
902
  }
974
903
  /**
975
- * The start date of the period
904
+ * emit vega click event when click the date block
976
905
  *
977
- * @type {CalendarDate}
906
+ * @param {MouseEvent} e the mouse event object
907
+ * @param {CalendarDate} calendarDate the calendar date object
978
908
  */
979
- get startDate() {
980
- return this._startDate;
909
+ handleDateBlockClick(e, calendarDate) {
910
+ const { target, clientX, clientY } = e;
911
+ if (this.isMonthBlockBlankArea(target)) {
912
+ const { year, month, date } = calendarDate;
913
+ this.dateDblClickEmitter.emit({
914
+ year,
915
+ month,
916
+ date,
917
+ hour: 0,
918
+ mouseEventInfo: { clientX, clientY },
919
+ });
920
+ }
981
921
  }
982
922
  /**
983
- * The end date of the period
923
+ * determine if the clicked element is blank area
984
924
  *
985
- * @type {CalendarDate}
925
+ * @param {HTMLElement} element the target element
926
+ * @returns {boolean} true or false
986
927
  */
987
- get endDate() {
988
- return this._endDate;
928
+ isMonthBlockBlankArea(element) {
929
+ // the more button and the calendar event component should not trigger dateDblClick event
930
+ return !element.classList.contains('more-button') && element.tagName !== 'VEGA-CALENDAR-EVENT';
989
931
  }
932
+ }
933
+ __decorate$l([
934
+ globalSlimmerRegistry.MapToComponentField()
935
+ ], VegaCalendarMonthViewRenderer.prototype, "viewMode", void 0);
936
+ __decorate$l([
937
+ globalSlimmerRegistry.MapToComponentField()
938
+ ], VegaCalendarMonthViewRenderer.prototype, "calendarView", void 0);
939
+ __decorate$l([
940
+ globalSlimmerRegistry.MapToComponentField()
941
+ ], VegaCalendarMonthViewRenderer.prototype, "currentPeriod", void 0);
942
+ __decorate$l([
943
+ globalSlimmerRegistry.MapToComponentField()
944
+ ], VegaCalendarMonthViewRenderer.prototype, "currentPeriodController", void 0);
945
+ __decorate$l([
946
+ globalSlimmerRegistry.MapToComponentField()
947
+ ], VegaCalendarMonthViewRenderer.prototype, "monthEventRenderer", void 0);
948
+ __decorate$l([
949
+ globalSlimmerRegistry.MapToComponentField()
950
+ ], VegaCalendarMonthViewRenderer.prototype, "dateDblClickEmitter", void 0);
951
+ __decorate$l([
952
+ globalSlimmerRegistry.MapToComponentField()
953
+ ], VegaCalendarMonthViewRenderer.prototype, "translationSlimmer", void 0);
954
+
955
+ var __decorate$k = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
956
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
957
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
958
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
959
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
960
+ };
961
+ /** The `VegaCalendarViewWithTimeRenderer` class in TypeScript React renders a day view for a calendar component with title, content, and hour blocks. */
962
+ class VegaCalendarViewWithTimeRenderer extends globalSlimmerRegistry.VegaSlimmer {
990
963
  /**
991
- * The count of the period
964
+ * The render function in TypeScript React returns an array of HTMLElements containing the week calendar view for a specific day.
992
965
  *
993
- * @type {number}
966
+ * @returns {HTMLElement} An array of HTMLElement elements containing the rendered content of a calendar view for a
967
+ * specific day in the week. The content includes the title and the main content of the calendar view
968
+ * for that day.
994
969
  */
995
- get count() {
996
- return this._count;
970
+ render() {
971
+ return (index.h("div", { class: "calendar-view-container" },
972
+ this.renderViewTitle(),
973
+ this.renderViewContent()));
997
974
  }
998
975
  /**
999
- * This function returns the type of the object.
976
+ * The function `renderViewTitle` renders a calendar view title and events based on the provided source data.
1000
977
  *
1001
- * @type {string}
978
+ * @returns {HTMLElement} The `renderViewTitle` function returns an HTML element (HTMLElement) that contains a calendar view title container with rows for each day's information.
1002
979
  */
1003
- get type() {
1004
- return this._type;
980
+ renderViewTitle() {
981
+ const source = this.calendarView.dateItems[0];
982
+ const weekHead = this.calendarView.weekdays;
983
+ return (index.h("div", { class: "calendar-view-title-container" },
984
+ index.h("div", { class: "calendar-view-row" },
985
+ index.h("div", { class: "time-line-empty" }),
986
+ index.h("div", { class: "calendar-view-title" }, source.map((item, index$1) => (index.h("div", { key: item.date, class: { active: item.isToday() } },
987
+ index.h("div", null, this.translationSlimmer.t(weekHead[index$1])),
988
+ index.h("div", { class: "week-day" }, item.date)))))),
989
+ index.h("div", { class: "calendar-view-row calendar-view-event-all-container border-divider-bottom" },
990
+ index.h("div", { class: "time-line-all" }, this.translationSlimmer.t('All Day')),
991
+ this.dayViewFullDayEventRenderer.render())));
1005
992
  }
1006
993
  /**
1007
- * Go to a specific date.
994
+ * The `renderViewContent` function in TypeScript React renders a calendar view with day blocks and time markers based on the provided data.
1008
995
  *
1009
- * @param {CalendarDate} date - The date to go to.
1010
- * @returns {this} - The current period.
996
+ * @returns {HTMLElement} An HTMLElement containing a calendar view row with day containers, a timeline renderer, a content container, a day list, and hour blocks for each item in the source array.
1011
997
  */
1012
- goTo(date) {
1013
- return this.createBy(date);
998
+ renderViewContent() {
999
+ const source = this.calendarView.dateItems[0];
1000
+ return (index.h("div", { class: "calendar-view-row calendar-view-day-container" },
1001
+ this.timeLineRenderer.render(),
1002
+ index.h("div", { class: "calendar-view-content-container" },
1003
+ index.h("div", { class: "calendar-view-content" }, source.map((item) => {
1004
+ return (index.h("div", { class: "grid-col border-divider-left", key: item.date },
1005
+ index.h("div", { class: "hour-empty border-divider-top" }),
1006
+ this.renderHourBlock(item)));
1007
+ })),
1008
+ this.dayViewTimedEventRenderer.render(),
1009
+ this.timeLineRenderer.renderTimeMarker(source))));
1014
1010
  }
1015
1011
  /**
1016
- * Go to now.
1012
+ * The function `renderHourBlock` returns an array of HTML elements representing hour blocks with time information.
1017
1013
  *
1018
- * @returns {this} - The current period.
1014
+ * @param {CalendarDate} calendarDate then current calendar date object
1015
+ * @returns {HTMLElement[]} An array of HTMLElements is being returned. Each HTMLElement represents an hour block with a time value inside a div element.
1019
1016
  */
1020
- now() {
1021
- return this.createBy(CalendarDate.from(new Date()));
1017
+ renderHourBlock(calendarDate) {
1018
+ const timeLineSource = Array(24).fill('');
1019
+ return timeLineSource.map((_item, index$1) => {
1020
+ return (index.h("div", { class: "grid-cell border-divider-top",
1021
+ // eslint-disable-next-line react/jsx-no-bind
1022
+ onDblClick: (e) => {
1023
+ this.handleDateBlockClick(calendarDate, index$1, e);
1024
+ } }));
1025
+ });
1022
1026
  }
1023
1027
  /**
1024
- * Calculate the period start date and end date.
1028
+ * emit vega click event when click the date block
1025
1029
  *
1026
- * @param {CalendarDate} date - The date to calculate the period from.
1030
+ * @param {CalendarDate} calendarDate the calendar date object
1027
1031
  */
1028
- calculatePeriod(date) {
1029
- const cursor = date.toDate();
1030
- if (this.count > 1) {
1031
- cursor.setDate(cursor.getDate() - getWeekdays().indexOf(cursor.getDay()));
1032
- }
1033
- this._startDate = CalendarDate.from(cursor);
1034
- cursor.setDate(cursor.getDate() + this.count - 1);
1035
- this._endDate = CalendarDate.from(cursor);
1032
+ handleDateBlockClick(calendarDate, hour, e) {
1033
+ const { year, month, date } = calendarDate;
1034
+ const { clientX, clientY } = e;
1035
+ this.dateDblClickEmitter.emit({ year, month, date, hour, mouseEventInfo: { clientX, clientY } });
1036
1036
  }
1037
1037
  }
1038
+ __decorate$k([
1039
+ globalSlimmerRegistry.MapToComponentField()
1040
+ ], VegaCalendarViewWithTimeRenderer.prototype, "viewMode", void 0);
1041
+ __decorate$k([
1042
+ globalSlimmerRegistry.MapToComponentField()
1043
+ ], VegaCalendarViewWithTimeRenderer.prototype, "timeLineRenderer", void 0);
1044
+ __decorate$k([
1045
+ globalSlimmerRegistry.MapToComponentField()
1046
+ ], VegaCalendarViewWithTimeRenderer.prototype, "dayViewTimedEventRenderer", void 0);
1047
+ __decorate$k([
1048
+ globalSlimmerRegistry.MapToComponentField()
1049
+ ], VegaCalendarViewWithTimeRenderer.prototype, "dayViewFullDayEventRenderer", void 0);
1050
+ __decorate$k([
1051
+ globalSlimmerRegistry.MapToComponentField()
1052
+ ], VegaCalendarViewWithTimeRenderer.prototype, "calendarView", void 0);
1053
+ __decorate$k([
1054
+ globalSlimmerRegistry.MapToComponentField()
1055
+ ], VegaCalendarViewWithTimeRenderer.prototype, "dateDblClickEmitter", void 0);
1056
+ __decorate$k([
1057
+ globalSlimmerRegistry.MapToComponentField()
1058
+ ], VegaCalendarViewWithTimeRenderer.prototype, "translationSlimmer", void 0);
1038
1059
 
1039
- /**
1040
- * Period of day.
1041
- */
1042
- class DayPeriod extends CalendarPeriod {
1043
- constructor(current) {
1044
- super(DayPeriod.DISPLAY_DATE_COUNT, current);
1045
- this._type = 'day';
1046
- }
1060
+ var __decorate$j = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1061
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1062
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1063
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1064
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1065
+ };
1066
+ /** The `VegaCalendarTimeLineRenderer` class in TypeScript React renders a time line with custom time format options and includes methods for rendering time markers and the time line itself. */
1067
+ class VegaCalendarTimeLineRenderer extends globalSlimmerRegistry.VegaSlimmer {
1047
1068
  /**
1048
- * @inheritDoc
1069
+ * takes an array of `CalendarDate` objects as input and returns an HTML element
1070
+ *
1071
+ * @param {CalendarDate[]} source
1072
+ * @returns {HTMLElement} the html element
1049
1073
  */
1050
- next() {
1051
- const nextDate = this.current.toDate();
1052
- nextDate.setDate(nextDate.getDate() + 1);
1053
- return this.createBy(CalendarDate.from(nextDate));
1074
+ renderTimeMarker(source) {
1075
+ const isVisible = source.findIndex((calendarDate) => calendarDate.isToday()) >= 0;
1076
+ return (index.h("div", { class: {
1077
+ 'time-marker-container': true,
1078
+ 'hidden': !isVisible,
1079
+ } },
1080
+ index.h("div", { class: "time-marker", style: { top: this.getTimeMarkerPosition() }, ref: (div) => (this.timeMarkerRef = div) }, source.map((item) => {
1081
+ return index.h("div", { key: item.date, class: { active: item.isToday() } });
1082
+ }))));
1054
1083
  }
1055
1084
  /**
1056
- * @inheritDoc
1085
+ * rendering the time line component as an HTML element
1086
+ *
1087
+ * @returns {HTMLElement} the html element
1057
1088
  */
1058
- previous() {
1059
- const previousDate = this.current.toDate();
1060
- previousDate.setDate(previousDate.getDate() - 1);
1061
- return this.createBy(CalendarDate.from(previousDate));
1089
+ render() {
1090
+ const timeLineSource = this.getTimeLineTitles();
1091
+ return (index.h("div", { class: "time-line", ref: (div) => (this.timeLineRef = div) },
1092
+ index.h("div", { class: "hour-empty" }),
1093
+ timeLineSource.map((time, index$1) => {
1094
+ return (index.h("div", { key: time },
1095
+ index.h("div", { class: "time-text", "data-time": index$1 === 0 ? 24 : index$1 }, time)));
1096
+ })));
1062
1097
  }
1063
1098
  /**
1064
- * @inheritDoc
1099
+ * scroll to current time line block if change view mode to week or day
1100
+ *
1101
+ * @param {VegaCalendarViewModeType} viewMode the view mode
1065
1102
  */
1066
- createBy(current) {
1067
- return new DayPeriod(current);
1068
- }
1069
- }
1070
- DayPeriod.DISPLAY_DATE_COUNT = 1;
1071
-
1072
- /**
1073
- * Period of the week
1074
- */
1075
- class WeekPeriod extends CalendarPeriod {
1076
- constructor(current) {
1077
- super(WeekPeriod.DISPLAY_DATE_COUNT, current);
1078
- this._type = 'week';
1103
+ updateTimeLine(viewMode) {
1104
+ this.scrollToTargetTimeBlock(viewMode);
1105
+ this.syncTimeMarkerPosition(viewMode);
1079
1106
  }
1080
1107
  /**
1081
- * @inheritDoc
1108
+ * remove setInterval when component destroy
1082
1109
  */
1083
- next() {
1084
- const nextWeekStartDate = this.current.toDate();
1085
- nextWeekStartDate.setDate(nextWeekStartDate.getDate() - getWeekdays().indexOf(nextWeekStartDate.getDay()) + 7);
1086
- return this.createBy(CalendarDate.from(nextWeekStartDate));
1110
+ clearTimer() {
1111
+ clearInterval(this.timeMarkerPositionTimer);
1087
1112
  }
1088
1113
  /**
1089
- * @inheritDoc
1114
+ * Add the time mark position update logic if the component add back to page
1090
1115
  */
1091
- previous() {
1092
- const previousWeekStartDate = this.current.toDate();
1093
- previousWeekStartDate.setDate(previousWeekStartDate.getDate() - getWeekdays().indexOf(previousWeekStartDate.getDay()) - 7);
1094
- return this.createBy(CalendarDate.from(previousWeekStartDate));
1116
+ updateTimeLineIfComponentAddBack() {
1117
+ this.syncTimeMarkerPosition(this.viewMode);
1095
1118
  }
1096
1119
  /**
1097
- * @inheritDoc
1120
+ * Should display the current time block in the view if the default view mode is not month
1098
1121
  */
1099
- createBy(current) {
1100
- return new WeekPeriod(current);
1101
- }
1102
- }
1103
- WeekPeriod.DISPLAY_DATE_COUNT = 7;
1104
-
1105
- /**
1106
- * Period of month
1107
- */
1108
- class MonthPeriod extends CalendarPeriod {
1109
- constructor(current) {
1110
- super(MonthPeriod.DISPLAY_DATE_COUNT, MonthPeriod.getMonthFirstDay(current));
1111
- this._type = 'month';
1122
+ displayCurrentTimeBlockByDefault() {
1123
+ this.scrollToTargetTimeBlock(this.viewMode);
1112
1124
  }
1113
1125
  /**
1114
- * The function `getMonthFirstDay` returns the first day of a given month in a calendar.
1126
+ * The function `getTimeMarkerPosition` calculates the position of the current time marker as a percentage of the day.
1115
1127
  *
1116
- * @param {CalendarDate} [calendarDate] - The `calendarDate` parameter is an optional parameter of
1117
- * type `CalendarDate`. It represents a specific date in the calendar. If a `calendarDate` is
1118
- * provided, the function will use that date to determine the first day of the month. If no
1119
- * `calendarDate` is provided, the function
1120
- * @returns {CalendarDate} A new `CalendarDate` object representing the first day of the month from the provided
1121
- * `calendarDate` parameter or the current date if no parameter is provided.
1128
+ * @returns {string} a string representing the current time marker position as a percentage of the day.
1122
1129
  */
1123
- static getMonthFirstDay(calendarDate) {
1124
- const date = calendarDate || CalendarDate.from(new Date());
1125
- return new CalendarDate(date.year, date.month, 1);
1130
+ getTimeMarkerPosition() {
1131
+ const now = new Date();
1132
+ const minutesOneDay = 24 * 60;
1133
+ return ((now.getHours() * 60 + now.getMinutes()) / minutesOneDay) * 100 + '%';
1126
1134
  }
1127
1135
  /**
1128
- * @inheritDoc
1136
+ * The function `getTimeLineTitles` generates a time line array based on the specified time format (24-hour) and stores it in the `timeLineSource` property.
1137
+ *
1138
+ * @returns {string[]} returns an array of strings representing the time line
1129
1139
  */
1130
- next() {
1131
- const next = this.current.toDate();
1132
- next.setMonth(next.getMonth() + 1);
1133
- return this.createBy(CalendarDate.from(next));
1140
+ getTimeLineTitles() {
1141
+ const timeLine = [];
1142
+ if (this.timeFormat === '12-hour') {
1143
+ timeLine.push('12 AM');
1144
+ for (let i = 1; i < 12; i++) {
1145
+ timeLine.push(`${i} AM`);
1146
+ }
1147
+ timeLine.push('12 PM');
1148
+ for (let i = 1; i < 12; i++) {
1149
+ timeLine.push(`${i} PM`);
1150
+ }
1151
+ }
1152
+ else {
1153
+ for (let i = 0; i < 24; i++) {
1154
+ timeLine.push(`${date.pad(i)}`);
1155
+ }
1156
+ }
1157
+ return timeLine;
1134
1158
  }
1159
+ /*
1160
+ * The below method is e2e-test covered in
1161
+ * @see{module:vega-calendar-scroll-to-current-time}
1162
+ */
1163
+ /* istanbul ignore next */
1135
1164
  /**
1136
- * @inheritDoc
1165
+ * Update the time marker position with the time
1166
+ *
1167
+ * @param {VegaCalendarViewModeType} viewMode view mode value
1137
1168
  */
1138
- previous() {
1139
- const previous = this.current.toDate();
1140
- previous.setMonth(previous.getMonth() - 1);
1141
- return this.createBy(CalendarDate.from(previous));
1169
+ syncTimeMarkerPosition(viewMode) {
1170
+ clearInterval(this.timeMarkerPositionTimer);
1171
+ if (viewMode !== 'month') {
1172
+ this.timeMarkerPositionTimer = setInterval(() => {
1173
+ if (this.timeMarkerRef) {
1174
+ this.timeMarkerRef.style.top = this.getTimeMarkerPosition();
1175
+ }
1176
+ }, 60 * 1000);
1177
+ }
1142
1178
  }
1179
+ /*
1180
+ * The below method is e2e-test covered in
1181
+ * @see{module:vega-calendar-scroll-to-current-time}
1182
+ */
1183
+ /* istanbul ignore next */
1143
1184
  /**
1144
- * @inheritDoc
1185
+ * scroll the time line in to current view
1186
+ *
1187
+ * @param {VegaCalendarViewModeType} viewMode view mode value
1145
1188
  */
1146
- createBy(current) {
1147
- return new MonthPeriod(current);
1189
+ scrollToTargetTimeBlock(viewMode) {
1190
+ if (viewMode !== 'month') {
1191
+ // add setTimeout here to make sure call the scroll into view after time line rendered.
1192
+ const oneFrame = 16;
1193
+ setTimeout(() => {
1194
+ var _a, _b;
1195
+ const hour = new Date().getHours();
1196
+ (_b = (_a = this.timeLineRef) === null || _a === void 0 ? void 0 : _a.querySelector(`[data-time='${hour < 23 ? hour + 1 : hour}']`)) === null || _b === void 0 ? void 0 : _b.scrollIntoView({ block: 'end' });
1197
+ }, oneFrame);
1198
+ }
1148
1199
  }
1149
1200
  }
1150
- MonthPeriod.DISPLAY_DATE_COUNT = 6 * 7;
1201
+ __decorate$j([
1202
+ globalSlimmerRegistry.MapToComponentField()
1203
+ ], VegaCalendarTimeLineRenderer.prototype, "timeFormat", void 0);
1204
+ __decorate$j([
1205
+ globalSlimmerRegistry.MapToComponentField()
1206
+ ], VegaCalendarTimeLineRenderer.prototype, "viewMode", void 0);
1207
+ __decorate$j([
1208
+ globalSlimmerRegistry.MapToComponentMethod('watchViewModeChange')
1209
+ ], VegaCalendarTimeLineRenderer.prototype, "updateTimeLine", null);
1210
+ __decorate$j([
1211
+ globalSlimmerRegistry.MapToComponentMethod('disconnectedCallback')
1212
+ ], VegaCalendarTimeLineRenderer.prototype, "clearTimer", null);
1213
+ __decorate$j([
1214
+ globalSlimmerRegistry.MapToComponentMethod('connectedCallback')
1215
+ ], VegaCalendarTimeLineRenderer.prototype, "updateTimeLineIfComponentAddBack", null);
1216
+ __decorate$j([
1217
+ globalSlimmerRegistry.MapToComponentMethod('componentDidLoad')
1218
+ ], VegaCalendarTimeLineRenderer.prototype, "displayCurrentTimeBlockByDefault", null);
1151
1219
 
1152
1220
  var __decorate$i = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1153
1221
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1208,6 +1276,9 @@ __decorate$i([
1208
1276
  __decorate$i([
1209
1277
  globalSlimmerRegistry.MapToComponentField()
1210
1278
  ], VegaCalendarViewController.prototype, "currentPeriod", void 0);
1279
+ __decorate$i([
1280
+ globalSlimmerRegistry.MapToComponentField()
1281
+ ], VegaCalendarViewController.prototype, "showWeekends", void 0);
1211
1282
  __decorate$i([
1212
1283
  globalSlimmerRegistry.MapToComponentField()
1213
1284
  ], VegaCalendarViewController.prototype, "currentPeriodController", void 0);
@@ -1243,13 +1314,14 @@ class VegaCalendarCurrentPeriodController extends globalSlimmerRegistry.VegaSlim
1243
1314
  updateCalendarPeriod(viewMode, date) {
1244
1315
  switch (viewMode) {
1245
1316
  case 'month':
1246
- this.setCurrentPeriod(new MonthPeriod(date));
1317
+ this.setCurrentPeriod(new MonthPeriod(date, this.showWeekends));
1247
1318
  break;
1248
1319
  case 'week':
1249
- this.setCurrentPeriod(new WeekPeriod(date));
1320
+ this.setCurrentPeriod(new WeekPeriod(date, this.showWeekends));
1250
1321
  break;
1251
1322
  case 'day':
1252
- this.setCurrentPeriod(new DayPeriod(date));
1323
+ date = this.showWeekends === false ? getClosestWorkday(date) : date;
1324
+ this.setCurrentPeriod(new DayPeriod(date, this.showWeekends));
1253
1325
  break;
1254
1326
  }
1255
1327
  }
@@ -1291,6 +1363,12 @@ class VegaCalendarCurrentPeriodController extends globalSlimmerRegistry.VegaSlim
1291
1363
  this.updateCalendarPeriod(viewMode, this.currentPeriod.current);
1292
1364
  }
1293
1365
  }
1366
+ /**
1367
+ * The calendar period should update when the property showWeekends change
1368
+ */
1369
+ updateCurrentPeriodAfterHideWeekEndsChange() {
1370
+ this.updateCalendarPeriod(this.viewMode, this.currentPeriod.current);
1371
+ }
1294
1372
  /**
1295
1373
  * The function `getStartDateAndEndDate` returns an array of `VegaCalendarDateType` objects based on the `startDate` and `endDate` properties of the `currentPeriod` object.
1296
1374
  *
@@ -1324,6 +1402,9 @@ __decorate$h([
1324
1402
  __decorate$h([
1325
1403
  globalSlimmerRegistry.MapToComponentField({ writable: true })
1326
1404
  ], VegaCalendarCurrentPeriodController.prototype, "viewMode", void 0);
1405
+ __decorate$h([
1406
+ globalSlimmerRegistry.MapToComponentField()
1407
+ ], VegaCalendarCurrentPeriodController.prototype, "showWeekends", void 0);
1327
1408
  __decorate$h([
1328
1409
  globalSlimmerRegistry.MapToComponentMethod('componentWillLoad')
1329
1410
  ], VegaCalendarCurrentPeriodController.prototype, "initialCurrentPeriod", null);
@@ -1333,6 +1414,9 @@ __decorate$h([
1333
1414
  __decorate$h([
1334
1415
  globalSlimmerRegistry.MapToComponentMethod('watchViewModeChange')
1335
1416
  ], VegaCalendarCurrentPeriodController.prototype, "updateCurrentPeriodByViewMode", null);
1417
+ __decorate$h([
1418
+ globalSlimmerRegistry.MapToComponentMethod('watchShowWeekendsChange')
1419
+ ], VegaCalendarCurrentPeriodController.prototype, "updateCurrentPeriodAfterHideWeekEndsChange", null);
1336
1420
 
1337
1421
  var __decorate$g = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1338
1422
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1477,7 +1561,9 @@ class VegaCalendarMonthEventRenderer extends globalSlimmerRegistry.VegaSlimmer {
1477
1561
  }
1478
1562
  if (removeItems.length) {
1479
1563
  rowEvents.forEach((items) => {
1480
- if (items.length && removeItems.includes(items[items.length - 1])) {
1564
+ if (items.length &&
1565
+ items[items.length - 1] &&
1566
+ removeItems.includes(items[items.length - 1])) {
1481
1567
  result.push(items.slice(0, items.length - 1));
1482
1568
  }
1483
1569
  else {
@@ -1604,7 +1690,13 @@ class CalendarEventDailyRepeatPattern extends CalendarEventBaseRepeatPattern {
1604
1690
  (!this.count || (typeof this.count === 'number' && this.cache.length < this.count))) {
1605
1691
  let nextMatchDate = this.getNextRepeatStartDate(lastMatchDate);
1606
1692
  while (nextMatchDate && nextMatchDate.toDate() < endDate.toDate()) {
1607
- nextMatchDate = this.getNextRepeatStartDate(nextMatchDate);
1693
+ const newNextMatchDate = this.getNextRepeatStartDate(nextMatchDate);
1694
+ //The below if block is used to break the infinite loop when the `getNextRepeatStartDate` method return unexpected result. such as when the date is greater than a certain value, it will be returned back 1900.
1695
+ if (newNextMatchDate && newNextMatchDate.toDate() <= nextMatchDate.toDate()) {
1696
+ this.cache.pop();
1697
+ break;
1698
+ }
1699
+ nextMatchDate = newNextMatchDate;
1608
1700
  if (typeof this.count === 'number' && this.cache.length >= this.count) {
1609
1701
  break;
1610
1702
  }
@@ -1676,7 +1768,13 @@ class CalendarEventMonthlyRepeatPattern extends CalendarEventBaseRepeatPattern {
1676
1768
  (!this.count || (typeof this.count === 'number' && this.cache.length < this.count))) {
1677
1769
  let nextMatchDate = this.getNextRepeatStartDate(lastMatchDate);
1678
1770
  while (nextMatchDate && nextMatchDate.toDate() < endDate.toDate()) {
1679
- nextMatchDate = this.getNextRepeatStartDate(nextMatchDate);
1771
+ const newNextMatchDate = this.getNextRepeatStartDate(nextMatchDate);
1772
+ //The below if block is used to break the infinite loop when the `getNextRepeatStartDate` method return unexpected result. such as when the date is greater than a certain value, it will be returned back 1900.
1773
+ if (newNextMatchDate && newNextMatchDate.toDate() <= nextMatchDate.toDate()) {
1774
+ this.cache.pop();
1775
+ break;
1776
+ }
1777
+ nextMatchDate = newNextMatchDate;
1680
1778
  if (typeof this.count === 'number' && this.cache.length >= this.count) {
1681
1779
  break;
1682
1780
  }
@@ -1780,7 +1878,15 @@ class CalendarEventWeeklyRepeatPattern extends CalendarEventBaseRepeatPattern {
1780
1878
  (!this.count || (typeof this.count === 'number' && this.cache.length < this.count))) {
1781
1879
  let nextMatchDate = this.getNextRepeatStartDate(lastMatchDate);
1782
1880
  while (nextMatchDate && nextMatchDate[0].toDate() < endDate.toDate()) {
1783
- nextMatchDate = this.getNextRepeatStartDate(nextMatchDate);
1881
+ const newNextMatchDate = this.getNextRepeatStartDate(nextMatchDate);
1882
+ //The below if block is used to break the infinite loop when the `getNextRepeatStartDate` method return unexpected result. such as when the date is greater than a certain value, it will be returned back 1900.
1883
+ if (newNextMatchDate &&
1884
+ newNextMatchDate[0] &&
1885
+ newNextMatchDate[0].toDate() <= nextMatchDate[0].toDate()) {
1886
+ this.cache.pop();
1887
+ break;
1888
+ }
1889
+ nextMatchDate = newNextMatchDate;
1784
1890
  if (typeof this.count === 'number' && this.getValidCache().length >= this.count) {
1785
1891
  break;
1786
1892
  }
@@ -1927,7 +2033,13 @@ class CalendarEventYearlyRepeatPattern extends CalendarEventBaseRepeatPattern {
1927
2033
  (!this.count || (typeof this.count === 'number' && this.cache.length < this.count))) {
1928
2034
  let nextMatchDate = this.getNextRepeatStartDate(lastMatchDate);
1929
2035
  while (nextMatchDate && nextMatchDate.toDate() < endDate.toDate()) {
1930
- nextMatchDate = this.getNextRepeatStartDate(nextMatchDate);
2036
+ const newNextMatchDate = this.getNextRepeatStartDate(nextMatchDate);
2037
+ //The below if block is used to break the infinite loop when the `getNextRepeatStartDate` method return unexpected result. such as when the date is greater than a certain value, it will be returned back 1900.
2038
+ if (newNextMatchDate && newNextMatchDate.toDate() <= nextMatchDate.toDate()) {
2039
+ this.cache.pop();
2040
+ break;
2041
+ }
2042
+ nextMatchDate = newNextMatchDate;
1931
2043
  if (typeof this.count === 'number' && this.cache.length >= this.count) {
1932
2044
  break;
1933
2045
  }
@@ -2528,7 +2640,7 @@ class VegaCalendarEventResponsiveController extends pageResizeObserverSlimmer.Pa
2528
2640
  // The debounce method will case this method called after component disconnect, then the slimmer will get issue to get viewMode from component class, this issue will catch in spec.ts
2529
2641
  try {
2530
2642
  const eventContainerRef = this.monthEventRenderer.getMonthEventContainerRef();
2531
- if (this.viewMode === 'month' && eventContainerRef) {
2643
+ if (this.viewMode === 'month' && eventContainerRef && eventContainerRef.parentElement) {
2532
2644
  const maxContainerHeight = eventContainerRef.parentElement.getBoundingClientRect().height;
2533
2645
  const count = Math.floor((maxContainerHeight - VegaCalendarEventResponsiveController.monthDateTitleHeight) /
2534
2646
  VegaCalendarEventItemRenderer.backgroundColorModeEventHeight);
@@ -2713,7 +2825,7 @@ class VegaCalendarDayViewEventLayoutRenderer extends globalSlimmerRegistry.VegaS
2713
2825
  top: `${(100 / VegaCalendarDayViewEventLayoutRenderer.totalNumberOfCells) * startIndex}%`,
2714
2826
  width: `calc(100% - ${left * 100}%)`,
2715
2827
  height: `${(100 / VegaCalendarDayViewEventLayoutRenderer.totalNumberOfCells) * (endIndex - startIndex)}%`,
2716
- zIndex: columnIndex > 0 ? `${columnIndex}` : null,
2828
+ zIndex: columnIndex > 0 ? `${columnIndex}` : undefined,
2717
2829
  };
2718
2830
  }
2719
2831
  }
@@ -3148,7 +3260,7 @@ class VegaCalendarFullDayEventLayoutGenerator extends VegaCalendarBaseEventLayou
3148
3260
  */
3149
3261
  generate(calendarEvents) {
3150
3262
  const allShouldOrderLongEvents = this.collectAllShouldOrderLongEvents(calendarEvents);
3151
- const layoutRows = [new VegaCalendarFullDayEventLayoutRow()];
3263
+ const layoutRows = [this.createNewLayoutCell()];
3152
3264
  allShouldOrderLongEvents.forEach((eventView) => {
3153
3265
  this.addCurrentEventToLayout(layoutRows, eventView);
3154
3266
  });
@@ -3357,7 +3469,7 @@ __decorate$8([
3357
3469
  globalSlimmerRegistry.MapToComponentMethod('watchViewModeChange')
3358
3470
  ], VegaCalendarFullDayEventMoreButtonRenderer.prototype, "resetShowAllFlag", null);
3359
3471
 
3360
- const vegaCalendarCss = ".border-divider-top{border:1px solid rgba(var(--v-border-divider-secondary, 199, 217, 229, 1));border-left-width:0px;border-right-width:0px;border-bottom-width:0px}.border-divider-left{border:1px solid rgba(var(--v-border-divider-secondary, 199, 217, 229, 1));border-top-width:0px;border-right-width:0px;border-bottom-width:0px}.border-divider-right{border:1px solid rgba(var(--v-border-divider-secondary, 199, 217, 229, 1));border-top-width:0px;border-left-width:0px;border-bottom-width:0px}.border-divider-bottom{border:1px solid rgba(var(--v-border-divider-secondary, 199, 217, 229, 1));border-top-width:0px;border-left-width:0px;border-right-width:0px}:host{display:flex;flex-direction:column;border-radius:12px;border:1px solid rgba(var(--v-border-divider, 171, 198, 216, 1));background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1));overflow:hidden;width:100%;height:100%;box-sizing:border-box;max-height:1966px}.calendar-switch-panel{padding:24px;border-bottom-width:1px;border-top-width:0px;border-left-width:0px;border-right-width:0px;border-style:solid;border-color:rgba(var(--v-border-color-divider, 171, 198, 216, 1));flex-shrink:0;width:100%;box-sizing:border-box}.calendar-switch-panel .calendar-date-switch-container{display:flex;gap:8px;align-items:center;flex-direction:row}.calendar-switch-panel .calendar-view-switch-container{display:flex;gap:16px;align-items:center;flex-direction:row}.calendar-switch-panel .calendar-current-date{padding-left:8px}.calendar-view{width:100%;position:relative;flex-grow:1;overflow-y:auto;overflow-x:hidden}.calendar-view-month .calendar-view-month-container{width:100%;display:grid;min-height:100%;grid-template-rows:43px repeat(6, minmax(64px, 1fr))}.calendar-view-month .calendar-view-title{background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1));top:0;left:0;z-index:62}.calendar-view-month .calendar-view-title div{padding-top:12px;padding-bottom:12px;color:rgba(var(--v-text-secondary, 107, 116, 125, 1));font-family:\"Inter\", sans-serif;font-size:14px;font-weight:700;line-height:18px;text-align:center}@media screen and (min-width: 768px) and (max-width: 1023px){.calendar-view-month .calendar-view-title div{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:700;line-height:18px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.calendar-view-month .calendar-view-title div{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:700;line-height:18px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.calendar-view-month .calendar-view-title div{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:700;line-height:18px}}.calendar-view-month .calendar-view-row{position:relative;display:grid;grid-template-rows:1fr;grid-template-columns:repeat(7, minmax(64px, 1fr))}.calendar-view-month .calendar-view-row.calendar-view-title{position:sticky}.calendar-view-month .calendar-view-row:last-child{border-bottom-width:0px}.calendar-view-month .calendar-view-row .row-cell{overflow:hidden;display:flex;flex-direction:column;justify-content:space-between}.calendar-view-month .calendar-view-row .row-cell:last-child{border-right-width:0px}.calendar-view-month .calendar-view-row .row-cell .date{padding-top:4px;padding-bottom:4px;padding-right:12px;padding-left:8px}.calendar-view-month .calendar-view-row .row-cell .date>div{display:inline-block;color:rgba(var(--v-text-secondary, 107, 116, 125, 1));font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px}@media screen and (min-width: 768px) and (max-width: 1023px){.calendar-view-month .calendar-view-row .row-cell .date>div{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.calendar-view-month .calendar-view-row .row-cell .date>div{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.calendar-view-month .calendar-view-row .row-cell .date>div{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px}}.calendar-view-month .calendar-view-row .row-cell .date .month-block{margin-right:2px}.calendar-view-month .calendar-view-row .row-cell .date .grid-col{text-align:center;border-top-left-radius:9999px;border-bottom-left-radius:9999px;border-top-right-radius:9999px;border-bottom-right-radius:9999px;cursor:pointer;width:18px;height:18px;line-height:18px}.calendar-view-month .calendar-view-row .row-cell .date .grid-col:hover{background-color:rgba(var(--v-bg-action-secondary-hover, 4, 112, 236, 0.1))}.calendar-view-month .calendar-view-row .row-cell .date .grid-col:active{background-color:rgba(var(--v-bg-action-secondary-active, 29, 65, 195, 0.1))}.calendar-view-month .calendar-view-row .row-cell .date .grid-col:focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:2px}.calendar-view-month .calendar-view-row .row-cell.current-month-day .date>div{color:rgba(var(--v-text-primary, 32, 54, 69, 1))}.calendar-view-month .calendar-view-row .row-cell.disabled{background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1))}.calendar-view-month .calendar-view-row .row-cell.disabled .date>div{color:rgba(var(--v-text-disabled, 176, 180, 181, 1))}.calendar-view-month .calendar-view-row .row-cell.active .date .grid-col{background-color:rgba(var(--v-bg-action, 19, 98, 226, 1));border-top-left-radius:9999px;border-bottom-left-radius:9999px;color:rgba(var(--v-text-on-action, 252, 252, 252, 1))}.calendar-view-month .calendar-view-row .row-cell.active .date .grid-col:hover{background-color:rgba(var(--v-bg-action-hover, 4, 112, 236, 1))}.calendar-view-month .calendar-view-row .row-cell.active .date .grid-col:active{background-color:rgba(var(--v-bg-action-active, 29, 65, 195, 1))}.calendar-view-month .calendar-view-row .row-cell.active .date .grid-col:focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:2px}.calendar-view-container{width:100%}.calendar-view-container .calendar-view-title-container{background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1));position:sticky;top:0;left:0;z-index:62}.calendar-view-container .calendar-view-row{box-sizing:border-box;width:100%;display:flex;flex-direction:row}.calendar-view-container .calendar-view-row .time-line,.calendar-view-container .calendar-view-row .time-line-empty,.calendar-view-container .calendar-view-row .time-line-all{width:72px;text-align:right;padding-right:8px;box-sizing:border-box;font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;color:rgba(var(--v-text-primary, 32, 54, 69, 1));flex-shrink:0}@media screen and (min-width: 768px) and (max-width: 1023px){.calendar-view-container .calendar-view-row .time-line,.calendar-view-container .calendar-view-row .time-line-empty,.calendar-view-container .calendar-view-row .time-line-all{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.calendar-view-container .calendar-view-row .time-line,.calendar-view-container .calendar-view-row .time-line-empty,.calendar-view-container .calendar-view-row .time-line-all{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.calendar-view-container .calendar-view-row .time-line,.calendar-view-container .calendar-view-row .time-line-empty,.calendar-view-container .calendar-view-row .time-line-all{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px}}.calendar-view-container .calendar-view-title{width:100%}.calendar-view-container .calendar-view-title>div{padding:12px;padding-bottom:8px;color:rgba(var(--v-text-secondary, 107, 116, 125, 1));font-family:\"Inter\", sans-serif;font-size:14px;font-weight:700;line-height:18px;text-align:center;display:flex;flex-direction:column;gap:8px}@media screen and (min-width: 768px) and (max-width: 1023px){.calendar-view-container .calendar-view-title>div{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:700;line-height:18px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.calendar-view-container .calendar-view-title>div{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:700;line-height:18px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.calendar-view-container .calendar-view-title>div{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:700;line-height:18px}}.calendar-view-container .calendar-view-title .week-day{color:rgba(var(--v-text-primary, 32, 54, 69, 1));font-family:\"Inter\", sans-serif;font-size:20px;font-weight:500;line-height:24px;letter-spacing:0px}@media screen and (min-width: 768px) and (max-width: 1023px){.calendar-view-container .calendar-view-title .week-day{font-family:\"Inter\", sans-serif;font-size:20px;font-weight:500;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.calendar-view-container .calendar-view-title .week-day{font-family:\"Inter\", sans-serif;font-size:20px;font-weight:500;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.calendar-view-container .calendar-view-title .week-day{font-family:\"Inter\", sans-serif;font-size:20px;font-weight:500;line-height:24px;letter-spacing:0px}}.calendar-view-container .calendar-view-title .active div{color:rgba(var(--v-text-link, 19, 98, 226, 1))}.calendar-view-container .calendar-view-event-all-container{align-items:center}.calendar-view-container .calendar-view-event-all{display:grid;grid-template-rows:1fr;flex-grow:1;min-height:18px}.calendar-view-container .calendar-view-day-container .time-line{display:grid;grid-template-rows:16px repeat(24, minmax(74px, 1fr))}.calendar-view-container .calendar-view-day-container .time-line .time-text{margin-top:-9px}.calendar-view-container .calendar-view-day-container .calendar-view-content{width:100%}.calendar-view-container .calendar-view-day-container .calendar-view-content .grid-col{display:grid;grid-template-rows:16px repeat(24, minmax(74px, 1fr));grid-template-columns:minmax(64px, 1fr)}.calendar-view-container .calendar-view-day-container .calendar-view-content .grid-col>.border-divider-top:first-child{border-top-width:0px}.calendar-view-container .calendar-view-content-container{width:100%;position:relative}.calendar-view-week .calendar-view-container{min-height:100%}.calendar-view-week .calendar-view-container .calendar-view-title{display:grid;grid-template-rows:1fr;grid-template-columns:repeat(7, minmax(64px, 1fr))}.calendar-view-week .calendar-view-container .calendar-view-event-all{grid-template-columns:repeat(7, minmax(64px, 1fr))}.calendar-view-week .calendar-view-container .calendar-view-day-container .calendar-view-content{display:grid;grid-template-columns:repeat(7, minmax(64px, 1fr))}.calendar-view-week .time-marker-container .time-marker{display:grid;grid-template-columns:repeat(7, minmax(64px, 1fr))}.calendar-view-week .day-event-container{display:grid;grid-template-columns:repeat(7, minmax(64px, 1fr))}.calendar-view-day .calendar-view-container{min-height:100%}.time-marker-container{position:absolute;min-width:100%;left:0;top:16px;height:calc(100% - 16px);pointer-events:none}.time-marker-container.hidden{display:none}.time-marker-container .time-marker{position:absolute;height:2px;display:grid;min-width:100%;left:0;top:0;z-index:61}.time-marker-container .time-marker div{width:100%;height:2px;background-color:rgba(var(--v-bg-status-error, 255, 110, 139, 1));opacity:0.3}.time-marker-container .time-marker div.active{opacity:1;position:relative}.time-marker-container .time-marker div.active::before{content:\"\";display:block;border-top-left-radius:9999px;border-bottom-left-radius:9999px;border-top-right-radius:9999px;border-bottom-right-radius:9999px;position:absolute;width:8px;height:8px;background-color:rgba(var(--v-bg-status-error, 255, 110, 139, 1));top:-3px;left:-4px}.day-event-container{position:absolute;min-width:100%;left:0;top:16px;height:calc(100% - 16px);pointer-events:none}.day-event-container .day-event-col{height:100%;overflow:hidden}.day-event-container vega-calendar-event{pointer-events:auto;height:100%}.calendar-view-month .month-event-row{position:absolute;width:100%;overflow:hidden;height:calc(100% - 26px);left:0;bottom:0}.calendar-view-month .events-container{width:100%;box-sizing:border-box;overflow:hidden;padding:2px;display:flex;flex-direction:column;gap:2px;justify-content:space-between;flex-grow:1}.calendar-view-month .events-container .event-list{display:flex;flex-direction:column;gap:2px;flex-grow:1}.calendar-view-month .events-container .event-list .month-event-block{box-sizing:border-box;padding-left:2px;padding-right:3px}.calendar-view-month .events-container .month-event-more .more-button{display:inline-block;height:16px;font-family:\"Inter\", sans-serif;font-size:12px;font-weight:700;line-height:16px;letter-spacing:0px;color:rgba(var(--v-text-link, 19, 98, 226, 1));cursor:pointer;border-radius:2px}@media screen and (min-width: 768px) and (max-width: 1023px){.calendar-view-month .events-container .month-event-more .more-button{font-family:\"Inter\", sans-serif;font-size:12px;font-weight:700;line-height:16px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.calendar-view-month .events-container .month-event-more .more-button{font-family:\"Inter\", sans-serif;font-size:12px;font-weight:700;line-height:16px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.calendar-view-month .events-container .month-event-more .more-button{font-family:\"Inter\", sans-serif;font-size:12px;font-weight:700;line-height:16px;letter-spacing:0px}}.calendar-view-month .events-container .month-event-more .more-button:focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:0px}.calendar-view-container .calendar-view-event-all{position:relative}.calendar-view-container .calendar-view-event-all .placeholder-block{padding-top:2px;padding-bottom:2px;box-sizing:content-box}.calendar-view-container .calendar-view-event-all .placeholder-block span{display:none}.calendar-view-container .calendar-view-event-all .day-event-block{padding-top:2px;padding-right:2px;box-sizing:border-box;padding-left:3px}.calendar-view-container .calendar-view-event-all .more-button{display:inline-block;height:16px;font-family:\"Inter\", sans-serif;font-size:12px;font-weight:700;line-height:16px;letter-spacing:0px;color:rgba(var(--v-text-link, 19, 98, 226, 1));cursor:pointer;border-radius:2px;margin-left:2px;padding:2px}@media screen and (min-width: 768px) and (max-width: 1023px){.calendar-view-container .calendar-view-event-all .more-button{font-family:\"Inter\", sans-serif;font-size:12px;font-weight:700;line-height:16px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.calendar-view-container .calendar-view-event-all .more-button{font-family:\"Inter\", sans-serif;font-size:12px;font-weight:700;line-height:16px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.calendar-view-container .calendar-view-event-all .more-button{font-family:\"Inter\", sans-serif;font-size:12px;font-weight:700;line-height:16px;letter-spacing:0px}}.calendar-view-container .calendar-view-event-all .more-button:focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:0px}.calendar-view-container .calendar-view-event-all .event-all-col{display:flex;flex-direction:column;justify-content:space-between;align-items:flex-start}.calendar-view-container .day-event-col{position:relative}.calendar-view-container .day-event-col .time-event-block{box-sizing:border-box;padding-right:8px;padding-bottom:2px;padding-top:3px}.calendar-view-container .day-event-col .time-event-block vega-calendar-event.bg-shadow::part(event-container):not(:focus){outline:2px solid rgba(var(--v-bg-primary, 252, 252, 252, 1))}.calendar-view-container .day-event-col .time-event-block:focus-within{z-index:60 !important}.calendar-event-slot-container{display:none}";
3472
+ const vegaCalendarCss = ".border-divider-top{border:1px solid rgba(var(--v-border-divider-secondary, 199, 217, 229, 1));border-left-width:0px;border-right-width:0px;border-bottom-width:0px}.border-divider-left{border:1px solid rgba(var(--v-border-divider-secondary, 199, 217, 229, 1));border-top-width:0px;border-right-width:0px;border-bottom-width:0px}.border-divider-right{border:1px solid rgba(var(--v-border-divider-secondary, 199, 217, 229, 1));border-top-width:0px;border-left-width:0px;border-bottom-width:0px}.border-divider-bottom{border:1px solid rgba(var(--v-border-divider-secondary, 199, 217, 229, 1));border-top-width:0px;border-left-width:0px;border-right-width:0px}:host{display:flex;flex-direction:column;border-radius:12px;border:1px solid rgba(var(--v-border-divider, 171, 198, 216, 1));background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1));overflow:hidden;width:100%;height:100%;box-sizing:border-box;max-height:1966px}.calendar-switch-panel{padding:24px;border-bottom-width:1px;border-top-width:0px;border-left-width:0px;border-right-width:0px;border-style:solid;border-color:rgba(var(--v-border-color-divider, 171, 198, 216, 1));flex-shrink:0;width:100%;box-sizing:border-box}.calendar-switch-panel .calendar-date-switch-container{display:flex;gap:8px;align-items:center;flex-direction:row}.calendar-switch-panel .calendar-view-switch-container{display:flex;gap:16px;align-items:center;flex-direction:row}.calendar-switch-panel .calendar-current-date{padding-left:8px}.calendar-view{width:100%;position:relative;flex-grow:1;overflow-y:auto;overflow-x:hidden;--calendar-weekday-columns:7}.calendar-view.calendar-hide-weekends{--calendar-weekday-columns:5}.calendar-view-month .calendar-view-month-container{width:100%;display:grid;min-height:100%;grid-template-rows:43px repeat(6, minmax(64px, 1fr))}.calendar-view-month .calendar-view-title{background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1));top:0;left:0;z-index:62}.calendar-view-month .calendar-view-title div{padding-top:12px;padding-bottom:12px;color:rgba(var(--v-text-secondary, 107, 116, 125, 1));font-family:\"Inter\", sans-serif;font-size:14px;font-weight:700;line-height:18px;text-align:center}@media screen and (min-width: 768px) and (max-width: 1023px){.calendar-view-month .calendar-view-title div{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:700;line-height:18px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.calendar-view-month .calendar-view-title div{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:700;line-height:18px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.calendar-view-month .calendar-view-title div{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:700;line-height:18px}}.calendar-view-month .calendar-view-row{position:relative;display:grid;grid-template-rows:1fr;grid-template-columns:repeat(var(--calendar-weekday-columns), minmax(64px, 1fr))}.calendar-view-month .calendar-view-row.calendar-view-title{position:sticky}.calendar-view-month .calendar-view-row:last-child{border-bottom-width:0px}.calendar-view-month .calendar-view-row .row-cell{overflow:hidden;display:flex;flex-direction:column;justify-content:space-between}.calendar-view-month .calendar-view-row .row-cell:last-child{border-right-width:0px}.calendar-view-month .calendar-view-row .row-cell .date{padding-top:4px;padding-bottom:4px;padding-right:12px;padding-left:8px}.calendar-view-month .calendar-view-row .row-cell .date>div{display:inline-block;color:rgba(var(--v-text-secondary, 107, 116, 125, 1));font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px}@media screen and (min-width: 768px) and (max-width: 1023px){.calendar-view-month .calendar-view-row .row-cell .date>div{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.calendar-view-month .calendar-view-row .row-cell .date>div{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.calendar-view-month .calendar-view-row .row-cell .date>div{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px}}.calendar-view-month .calendar-view-row .row-cell .date .month-block{margin-right:2px}.calendar-view-month .calendar-view-row .row-cell .date .grid-col{text-align:center;border-top-left-radius:9999px;border-bottom-left-radius:9999px;border-top-right-radius:9999px;border-bottom-right-radius:9999px;cursor:pointer;width:18px;height:18px;line-height:18px}.calendar-view-month .calendar-view-row .row-cell .date .grid-col:hover{background-color:rgba(var(--v-bg-action-secondary-hover, 4, 112, 236, 0.1))}.calendar-view-month .calendar-view-row .row-cell .date .grid-col:active{background-color:rgba(var(--v-bg-action-secondary-active, 29, 65, 195, 0.1))}.calendar-view-month .calendar-view-row .row-cell .date .grid-col:focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:2px}.calendar-view-month .calendar-view-row .row-cell.current-month-day .date>div{color:rgba(var(--v-text-primary, 32, 54, 69, 1))}.calendar-view-month .calendar-view-row .row-cell.disabled{background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1))}.calendar-view-month .calendar-view-row .row-cell.disabled .date>div{color:rgba(var(--v-text-disabled, 176, 180, 181, 1))}.calendar-view-month .calendar-view-row .row-cell.active .date .grid-col{background-color:rgba(var(--v-bg-action, 19, 98, 226, 1));border-top-left-radius:9999px;border-bottom-left-radius:9999px;color:rgba(var(--v-text-on-action, 252, 252, 252, 1))}.calendar-view-month .calendar-view-row .row-cell.active .date .grid-col:hover{background-color:rgba(var(--v-bg-action-hover, 4, 112, 236, 1))}.calendar-view-month .calendar-view-row .row-cell.active .date .grid-col:active{background-color:rgba(var(--v-bg-action-active, 29, 65, 195, 1))}.calendar-view-month .calendar-view-row .row-cell.active .date .grid-col:focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:2px}.calendar-view-container{width:100%}.calendar-view-container .calendar-view-title-container{background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1));position:sticky;top:0;left:0;z-index:62}.calendar-view-container .calendar-view-row{box-sizing:border-box;width:100%;display:flex;flex-direction:row}.calendar-view-container .calendar-view-row .time-line,.calendar-view-container .calendar-view-row .time-line-empty,.calendar-view-container .calendar-view-row .time-line-all{width:72px;text-align:right;padding-right:8px;box-sizing:border-box;font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;color:rgba(var(--v-text-primary, 32, 54, 69, 1));flex-shrink:0}@media screen and (min-width: 768px) and (max-width: 1023px){.calendar-view-container .calendar-view-row .time-line,.calendar-view-container .calendar-view-row .time-line-empty,.calendar-view-container .calendar-view-row .time-line-all{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.calendar-view-container .calendar-view-row .time-line,.calendar-view-container .calendar-view-row .time-line-empty,.calendar-view-container .calendar-view-row .time-line-all{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.calendar-view-container .calendar-view-row .time-line,.calendar-view-container .calendar-view-row .time-line-empty,.calendar-view-container .calendar-view-row .time-line-all{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px}}.calendar-view-container .calendar-view-title{width:100%}.calendar-view-container .calendar-view-title>div{padding:12px;padding-bottom:8px;color:rgba(var(--v-text-secondary, 107, 116, 125, 1));font-family:\"Inter\", sans-serif;font-size:14px;font-weight:700;line-height:18px;text-align:center;display:flex;flex-direction:column;gap:8px}@media screen and (min-width: 768px) and (max-width: 1023px){.calendar-view-container .calendar-view-title>div{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:700;line-height:18px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.calendar-view-container .calendar-view-title>div{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:700;line-height:18px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.calendar-view-container .calendar-view-title>div{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:700;line-height:18px}}.calendar-view-container .calendar-view-title .week-day{color:rgba(var(--v-text-primary, 32, 54, 69, 1));font-family:\"Inter\", sans-serif;font-size:20px;font-weight:500;line-height:24px;letter-spacing:0px}@media screen and (min-width: 768px) and (max-width: 1023px){.calendar-view-container .calendar-view-title .week-day{font-family:\"Inter\", sans-serif;font-size:20px;font-weight:500;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.calendar-view-container .calendar-view-title .week-day{font-family:\"Inter\", sans-serif;font-size:20px;font-weight:500;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.calendar-view-container .calendar-view-title .week-day{font-family:\"Inter\", sans-serif;font-size:20px;font-weight:500;line-height:24px;letter-spacing:0px}}.calendar-view-container .calendar-view-title .active div{color:rgba(var(--v-text-link, 19, 98, 226, 1))}.calendar-view-container .calendar-view-event-all-container{align-items:center}.calendar-view-container .calendar-view-event-all{display:grid;grid-template-rows:1fr;flex-grow:1;min-height:18px}.calendar-view-container .calendar-view-day-container .time-line{display:grid;grid-template-rows:16px repeat(24, minmax(74px, 1fr))}.calendar-view-container .calendar-view-day-container .time-line .time-text{margin-top:-9px}.calendar-view-container .calendar-view-day-container .calendar-view-content{width:100%}.calendar-view-container .calendar-view-day-container .calendar-view-content .grid-col{display:grid;grid-template-rows:16px repeat(24, minmax(74px, 1fr));grid-template-columns:minmax(64px, 1fr)}.calendar-view-container .calendar-view-day-container .calendar-view-content .grid-col>.border-divider-top:first-child{border-top-width:0px}.calendar-view-container .calendar-view-content-container{width:100%;position:relative}.calendar-view-week .calendar-view-container{min-height:100%}.calendar-view-week .calendar-view-container .calendar-view-title{display:grid;grid-template-rows:1fr;grid-template-columns:repeat(var(--calendar-weekday-columns), minmax(64px, 1fr))}.calendar-view-week .calendar-view-container .calendar-view-event-all{grid-template-columns:repeat(var(--calendar-weekday-columns), minmax(64px, 1fr))}.calendar-view-week .calendar-view-container .calendar-view-day-container .calendar-view-content{display:grid;grid-template-columns:repeat(var(--calendar-weekday-columns), minmax(64px, 1fr))}.calendar-view-week .time-marker-container .time-marker{display:grid;grid-template-columns:repeat(var(--calendar-weekday-columns), minmax(64px, 1fr))}.calendar-view-week .day-event-container{display:grid;grid-template-columns:repeat(var(--calendar-weekday-columns), minmax(64px, 1fr))}.calendar-view-day .calendar-view-container{min-height:100%}.time-marker-container{position:absolute;min-width:100%;left:0;top:16px;height:calc(100% - 16px);pointer-events:none}.time-marker-container.hidden{display:none}.time-marker-container .time-marker{position:absolute;height:2px;display:grid;min-width:100%;left:0;top:0;z-index:61}.time-marker-container .time-marker div{width:100%;height:2px;background-color:rgba(var(--v-bg-status-error, 255, 110, 139, 1));opacity:0.3}.time-marker-container .time-marker div.active{opacity:1;position:relative}.time-marker-container .time-marker div.active::before{content:\"\";display:block;border-top-left-radius:9999px;border-bottom-left-radius:9999px;border-top-right-radius:9999px;border-bottom-right-radius:9999px;position:absolute;width:8px;height:8px;background-color:rgba(var(--v-bg-status-error, 255, 110, 139, 1));top:-3px;left:-4px}.day-event-container{position:absolute;min-width:100%;left:0;top:16px;height:calc(100% - 16px);pointer-events:none}.day-event-container .day-event-col{height:100%;overflow:hidden}.day-event-container vega-calendar-event{pointer-events:auto;height:100%}.calendar-view-month .month-event-row{position:absolute;width:100%;overflow:hidden;height:calc(100% - 26px);left:0;bottom:0}.calendar-view-month .events-container{width:100%;box-sizing:border-box;overflow:hidden;padding:2px;display:flex;flex-direction:column;gap:2px;justify-content:space-between;flex-grow:1}.calendar-view-month .events-container .event-list{display:flex;flex-direction:column;gap:2px;flex-grow:1}.calendar-view-month .events-container .event-list .month-event-block{box-sizing:border-box;padding-left:2px;padding-right:3px}.calendar-view-month .events-container .month-event-more .more-button{display:inline-block;height:16px;font-family:\"Inter\", sans-serif;font-size:12px;font-weight:700;line-height:16px;letter-spacing:0px;color:rgba(var(--v-text-link, 19, 98, 226, 1));cursor:pointer;border-radius:2px}@media screen and (min-width: 768px) and (max-width: 1023px){.calendar-view-month .events-container .month-event-more .more-button{font-family:\"Inter\", sans-serif;font-size:12px;font-weight:700;line-height:16px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.calendar-view-month .events-container .month-event-more .more-button{font-family:\"Inter\", sans-serif;font-size:12px;font-weight:700;line-height:16px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.calendar-view-month .events-container .month-event-more .more-button{font-family:\"Inter\", sans-serif;font-size:12px;font-weight:700;line-height:16px;letter-spacing:0px}}.calendar-view-month .events-container .month-event-more .more-button:focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:0px}.calendar-view-container .calendar-view-event-all{position:relative}.calendar-view-container .calendar-view-event-all .placeholder-block{padding-top:2px;padding-bottom:2px;box-sizing:content-box}.calendar-view-container .calendar-view-event-all .placeholder-block span{display:none}.calendar-view-container .calendar-view-event-all .day-event-block{padding-top:2px;padding-right:2px;box-sizing:border-box;padding-left:3px}.calendar-view-container .calendar-view-event-all .more-button{display:inline-block;height:16px;font-family:\"Inter\", sans-serif;font-size:12px;font-weight:700;line-height:16px;letter-spacing:0px;color:rgba(var(--v-text-link, 19, 98, 226, 1));cursor:pointer;border-radius:2px;margin-left:2px;padding:2px}@media screen and (min-width: 768px) and (max-width: 1023px){.calendar-view-container .calendar-view-event-all .more-button{font-family:\"Inter\", sans-serif;font-size:12px;font-weight:700;line-height:16px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.calendar-view-container .calendar-view-event-all .more-button{font-family:\"Inter\", sans-serif;font-size:12px;font-weight:700;line-height:16px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.calendar-view-container .calendar-view-event-all .more-button{font-family:\"Inter\", sans-serif;font-size:12px;font-weight:700;line-height:16px;letter-spacing:0px}}.calendar-view-container .calendar-view-event-all .more-button:focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:0px}.calendar-view-container .calendar-view-event-all .event-all-col{display:flex;flex-direction:column;justify-content:space-between;align-items:flex-start}.calendar-view-container .day-event-col{position:relative}.calendar-view-container .day-event-col .time-event-block{box-sizing:border-box;padding-right:8px;padding-bottom:2px;padding-top:3px}.calendar-view-container .day-event-col .time-event-block vega-calendar-event.bg-shadow::part(event-container):not(:focus){outline:2px solid rgba(var(--v-bg-primary, 252, 252, 252, 1))}.calendar-view-container .day-event-col .time-event-block:focus-within{z-index:60 !important}.calendar-event-slot-container{display:none}";
3361
3473
 
3362
3474
  var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
3363
3475
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -3429,6 +3541,12 @@ const VegaCalendar = class {
3429
3541
  * @vegaVersion 2.21.0
3430
3542
  */
3431
3543
  this.showEventColorBar = true;
3544
+ /**
3545
+ * Controls the visibility of the weekend columns in the calendar.
3546
+ *
3547
+ * @vegaVersion 2.28.0
3548
+ */
3549
+ this.showWeekends = true;
3432
3550
  }
3433
3551
  /**
3434
3552
  * Tracks changes to the current period state.
@@ -3466,6 +3584,11 @@ const VegaCalendar = class {
3466
3584
  */
3467
3585
  watchShowEventColorBar(newValue) {
3468
3586
  }
3587
+ /**
3588
+ * Monitors changes in the visibility of the weekend columns in the calendar.
3589
+ */
3590
+ watchShowWeekendsChange() {
3591
+ }
3469
3592
  render() {
3470
3593
  return component.sanitizeVegaComponent(index.h(index.Host, null, this.renderer.render()), this.host);
3471
3594
  }
@@ -3475,7 +3598,8 @@ const VegaCalendar = class {
3475
3598
  "viewMode": ["watchViewModeChange"],
3476
3599
  "events": ["watchEventsChange"],
3477
3600
  "timeFormat": ["watchTimeFormat"],
3478
- "showEventColorBar": ["watchShowEventColorBar"]
3601
+ "showEventColorBar": ["watchShowEventColorBar"],
3602
+ "showWeekends": ["watchShowWeekendsChange"]
3479
3603
  }; }
3480
3604
  };
3481
3605
  __decorate$7([
@@ -3634,13 +3758,14 @@ class VegaCalendarEventRenderer extends globalSlimmerRegistry.VegaSlimmer {
3634
3758
  * @returns {HTMLAnchorElement} event element
3635
3759
  */
3636
3760
  renderNormalEvent() {
3637
- const { variant = 'primary', disabled } = this.calendarEvent;
3761
+ const { variant, disabled } = this.calendarEvent;
3762
+ const variantText = variant || 'primary';
3638
3763
  const isMonthEvent = !this.host.classList.contains('day-event');
3639
3764
  const classMap = {
3640
3765
  'slot-container': this.slotMode,
3641
3766
  'event-container': true,
3642
3767
  'disabled': disabled,
3643
- [variant]: true,
3768
+ [variantText]: true,
3644
3769
  };
3645
3770
  if (isMonthEvent) {
3646
3771
  return (index.h("div", { role: "button", tabIndex: 0, class: classMap, ref: (node) => (this.slotContainerRef = node) },