@globalpayments/vega 2.27.0 → 2.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-190595cc.js → app-globals-512d84f4.js} +1 -1
- package/dist/cjs/{form-field-controller-slimmer-ee984eb2.js → form-field-controller-slimmer-223f8ee3.js} +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{sub-state-observer-slimmer-832a4215.js → sub-state-observer-slimmer-36660092.js} +2 -2
- package/dist/cjs/{translation-slimmer-8ebf126d.js → translation-slimmer-83577cfd.js} +1 -1
- package/dist/cjs/vega-app-header-button.cjs.entry.js +1 -1
- package/dist/cjs/vega-button-circle.cjs.entry.js +1 -1
- package/dist/cjs/vega-button-group_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-button.cjs.entry.js +1 -1
- package/dist/cjs/vega-calendar_3.cjs.entry.js +937 -838
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-chip.cjs.entry.js +1 -1
- package/dist/cjs/vega-color-picker.cjs.entry.js +2 -2
- package/dist/cjs/vega-combo-box.cjs.entry.js +2 -2
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +3 -3
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-file-uploader.cjs.entry.js +3 -3
- package/dist/cjs/vega-form.cjs.entry.js +2 -2
- package/dist/cjs/vega-image-uploader.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +2 -2
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +2 -2
- package/dist/cjs/vega-input-range.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-select.cjs.entry.js +3 -3
- package/dist/cjs/vega-input.cjs.entry.js +46 -13
- package/dist/cjs/vega-pagination.cjs.entry.js +2 -2
- package/dist/cjs/vega-radio_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-signature-capture.cjs.entry.js +3 -3
- package/dist/cjs/vega-stepper.cjs.entry.js +2 -2
- package/dist/cjs/vega-table_8.cjs.entry.js +3 -3
- package/dist/cjs/vega-textarea.cjs.entry.js +2 -2
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +2 -2
- package/dist/cjs/vega.cjs.js +3 -3
- package/dist/collection/components/vega-app-header-button/vega-app-header-button.css +7 -1
- package/dist/collection/components/vega-button/vega-button.css +1 -0
- package/dist/collection/components/vega-button-circle/vega-button-circle.css +4 -0
- package/dist/collection/components/vega-button-group/vega-button-group-item/vega-button-group-item.css +10 -0
- package/dist/collection/components/vega-button-group/vega-button-group.css +13 -0
- package/dist/collection/components/vega-calendar/slimmers/common/controllers/vega-calendar-current-period-controller.js +17 -3
- package/dist/collection/components/vega-calendar/slimmers/common/controllers/vega-calendar-event-responsive-controller.js +1 -1
- package/dist/collection/components/vega-calendar/slimmers/common/controllers/vega-calendar-view-controller.js +3 -0
- package/dist/collection/components/vega-calendar/slimmers/common/layout/full-day-event-layout-generator.js +1 -1
- package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-switch-panel.js +4 -3
- package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-view-renderer.js +4 -1
- package/dist/collection/components/vega-calendar/slimmers/day-view/renderers/timed-event/vega-calendar-day-event-layout-renderer.js +1 -1
- package/dist/collection/components/vega-calendar/slimmers/day-view/renderers/vega-calendar-time-line-renderer.js +1 -1
- package/dist/collection/components/vega-calendar/slimmers/day-view/renderers/vega-calendar-view-with-time-renderer.js +0 -3
- package/dist/collection/components/vega-calendar/slimmers/month-view/renderers/vega-calendar-month-event-renderer.js +3 -1
- package/dist/collection/components/vega-calendar/slimmers/month-view/renderers/vega-calendar-month-view-renderer.js +0 -3
- package/dist/collection/components/vega-calendar/utils/index.js +24 -0
- package/dist/collection/components/vega-calendar/vega-calendar-event/slimmers/renderers/vega-calendar-event-renderer.js +3 -2
- package/dist/collection/components/vega-calendar/vega-calendar.css +10 -6
- package/dist/collection/components/vega-calendar/vega-calendar.js +36 -0
- package/dist/collection/components/vega-chip/vega-chip.css +4 -0
- package/dist/collection/helpers/calendar/calendar-period/calendar-period.abstract.js +8 -0
- package/dist/collection/helpers/calendar/calendar-period/day-period.js +27 -4
- package/dist/collection/helpers/calendar/calendar-period/month-period.js +4 -2
- package/dist/collection/helpers/calendar/calendar-period/week-period.js +4 -2
- package/dist/collection/helpers/calendar/calendar-view-generator/month-view-generator.js +8 -2
- package/dist/collection/helpers/calendar/calendar-view-generator/week-view-generator.js +8 -1
- package/dist/collection/helpers/calendar/test/calendar-period/day-period.test.js +16 -0
- package/dist/collection/helpers/calendar/test/calendar-view-generator/month-view-generator.test.js +50 -0
- package/dist/collection/helpers/calendar/test/calendar-view-generator/week-view-generator.test.js +15 -0
- package/dist/collection/helpers/formatter/string-formatter/number-mask-strategy.js +36 -4
- package/dist/collection/helpers/formatter/string-formatter/number-thousand-comma-strategy.js +9 -7
- package/dist/collection/helpers/formatter/test/string-formatter/number-mask-strategy.test.js +11 -2
- package/dist/collection/helpers/formatter/test/string-formatter/number-thousand-comma-mask-strategy.test.js +2 -0
- package/dist/collection/helpers/slimmers/sub-state/sub-state-observer-slimmer.js +2 -2
- package/dist/collection/helpers/slimmers/test/string-input-formatter-slimmer.test.js +20 -0
- package/dist/esm/{app-globals-d0b86358.js → app-globals-41797af8.js} +1 -1
- package/dist/esm/{form-field-controller-slimmer-2f9c871b.js → form-field-controller-slimmer-edbaaf7c.js} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{sub-state-observer-slimmer-af28076b.js → sub-state-observer-slimmer-8eff5559.js} +2 -2
- package/dist/esm/{translation-slimmer-c740a5f3.js → translation-slimmer-79f9a9c9.js} +1 -1
- package/dist/esm/vega-app-header-button.entry.js +1 -1
- package/dist/esm/vega-button-circle.entry.js +1 -1
- package/dist/esm/vega-button-group_2.entry.js +3 -3
- package/dist/esm/vega-button.entry.js +1 -1
- package/dist/esm/vega-calendar_3.entry.js +937 -838
- package/dist/esm/vega-checkbox_2.entry.js +2 -2
- package/dist/esm/vega-chip.entry.js +1 -1
- package/dist/esm/vega-color-picker.entry.js +2 -2
- package/dist/esm/vega-combo-box.entry.js +2 -2
- package/dist/esm/vega-date-picker_2.entry.js +3 -3
- package/dist/esm/vega-dropdown_5.entry.js +3 -3
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-file-uploader.entry.js +3 -3
- package/dist/esm/vega-form.entry.js +2 -2
- package/dist/esm/vega-image-uploader.entry.js +3 -3
- package/dist/esm/vega-input-credit-card.entry.js +2 -2
- package/dist/esm/vega-input-phone-number.entry.js +2 -2
- package/dist/esm/vega-input-range.entry.js +3 -3
- package/dist/esm/vega-input-select.entry.js +3 -3
- package/dist/esm/vega-input.entry.js +46 -13
- package/dist/esm/vega-pagination.entry.js +2 -2
- package/dist/esm/vega-radio_2.entry.js +2 -2
- package/dist/esm/vega-selection-chip_2.entry.js +3 -3
- package/dist/esm/vega-selection-tile_2.entry.js +3 -3
- package/dist/esm/vega-signature-capture.entry.js +3 -3
- package/dist/esm/vega-stepper.entry.js +2 -2
- package/dist/esm/vega-table_8.entry.js +3 -3
- package/dist/esm/vega-textarea.entry.js +2 -2
- package/dist/esm/vega-time-picker_2.entry.js +3 -3
- package/dist/esm/vega-toggle-switch.entry.js +2 -2
- package/dist/esm/vega.js +3 -3
- package/dist/types/components/vega-calendar/slimmers/common/controllers/vega-calendar-current-period-controller.d.ts +5 -0
- package/dist/types/components/vega-calendar/slimmers/common/controllers/vega-calendar-view-controller.d.ts +1 -0
- package/dist/types/components/vega-calendar/slimmers/common/renderers/vega-calendar-switch-panel.d.ts +1 -1
- package/dist/types/components/vega-calendar/slimmers/common/renderers/vega-calendar-view-renderer.d.ts +1 -0
- package/dist/types/components/vega-calendar/slimmers/day-view/renderers/vega-calendar-view-with-time-renderer.d.ts +0 -1
- package/dist/types/components/vega-calendar/slimmers/month-view/renderers/vega-calendar-month-view-renderer.d.ts +0 -1
- package/dist/types/components/vega-calendar/utils/index.d.ts +13 -0
- package/dist/types/components/vega-calendar/vega-calendar.d.ts +10 -0
- package/dist/types/components.d.ts +10 -0
- package/dist/types/helpers/calendar/calendar-period/calendar-period.abstract.d.ts +7 -0
- package/dist/types/helpers/calendar/calendar-period/day-period.d.ts +8 -1
- package/dist/types/helpers/calendar/calendar-period/month-period.d.ts +2 -1
- package/dist/types/helpers/calendar/calendar-period/week-period.d.ts +2 -1
- package/dist/types/helpers/formatter/string-formatter/number-mask-strategy.d.ts +20 -0
- package/dist/types/helpers/slimmers/sub-state/sub-state-observer-slimmer.d.ts +1 -1
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-f57454a6.js → p-0120ce7a.js} +1 -1
- package/dist/vega/{p-1dc80394.entry.js → p-0395e791.entry.js} +1 -1
- package/dist/vega/{p-8a1d8b99.entry.js → p-048a97d1.entry.js} +1 -1
- package/dist/vega/{p-963e8c45.entry.js → p-0dd750b0.entry.js} +1 -1
- package/dist/vega/{p-c31002d0.entry.js → p-1b901368.entry.js} +1 -1
- package/dist/vega/p-1f38eef6.entry.js +1 -0
- package/dist/vega/{p-8912d5c9.entry.js → p-1fc5373a.entry.js} +1 -1
- package/dist/vega/{p-7f8db003.entry.js → p-22a85055.entry.js} +1 -1
- package/dist/vega/{p-351a0ea1.entry.js → p-34545d2d.entry.js} +1 -1
- package/dist/vega/{p-f37e6adf.entry.js → p-40f6add9.entry.js} +1 -1
- package/dist/vega/p-41784db1.js +1 -0
- package/dist/vega/{p-c9e3413b.entry.js → p-4bc042ec.entry.js} +1 -1
- package/dist/vega/{p-a7666db3.entry.js → p-5d231a82.entry.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-ded47af0.entry.js → p-657df167.entry.js} +1 -1
- package/dist/vega/{p-28f6ead3.entry.js → p-6d015656.entry.js} +1 -1
- package/dist/vega/{p-8c2852c4.entry.js → p-6e3cc7f0.entry.js} +1 -1
- package/dist/vega/{p-09352107.entry.js → p-8c72aa56.entry.js} +1 -1
- package/dist/vega/{p-ba3db23b.entry.js → p-8f60c3ee.entry.js} +1 -1
- package/dist/vega/{p-bffaa859.entry.js → p-9a4ffc2c.entry.js} +1 -1
- package/dist/vega/p-9e6934fb.js +1 -0
- package/dist/vega/p-a19ae233.entry.js +1 -0
- package/dist/vega/{p-e7e19350.entry.js → p-a454acc4.entry.js} +1 -1
- package/dist/vega/{p-27b73500.entry.js → p-a8b1f19c.entry.js} +1 -1
- package/dist/vega/{p-14c0b4ea.js → p-bccacf42.js} +1 -1
- package/dist/vega/{p-8eadc60b.entry.js → p-d0a83562.entry.js} +1 -1
- package/dist/vega/{p-288b47f0.entry.js → p-d4fb2264.entry.js} +1 -1
- package/dist/vega/{p-fa78f87f.entry.js → p-d550fc66.entry.js} +1 -1
- package/dist/vega/p-d686dd96.entry.js +1 -0
- package/dist/vega/p-e0410974.entry.js +1 -0
- package/dist/vega/{p-0afaa0f3.entry.js → p-ead9a2b9.entry.js} +1 -1
- package/dist/vega/{p-54f5c773.entry.js → p-f0ad06bd.entry.js} +1 -1
- package/dist/vega/{p-8aaa9233.entry.js → p-f2019f70.entry.js} +1 -1
- package/dist/vega/{p-af71fe84.entry.js → p-fc746bae.entry.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/vega/p-15452727.js +0 -1
- package/dist/vega/p-38e3d50e.entry.js +0 -1
- package/dist/vega/p-8a646846.entry.js +0 -1
- package/dist/vega/p-bf557666.entry.js +0 -1
- package/dist/vega/p-d7bd2be5.entry.js +0 -1
- package/dist/vega/p-dee487f9.js +0 -1
- /package/dist/cjs/{translation-77e9ccce.js → translation-0dd74433.js} +0 -0
- /package/dist/esm/{translation-3b437b6d.js → translation-0fa7cf77.js} +0 -0
- /package/dist/vega/{p-05ebf5a3.js → p-be784f53.js} +0 -0
|
@@ -15,8 +15,8 @@ import { g as generateUUID } from './create-public-api-runtime-metrics-slimmer-9
|
|
|
15
15
|
import { P as PageResizeObserverSlimmer } from './page-resize-observer-slimmer-994c1e1b.js';
|
|
16
16
|
import { d as debounce } from './timer-9321173b.js';
|
|
17
17
|
import { C as ChangeManager } from './change-manager-6a7eb88c.js';
|
|
18
|
-
import { c as createSubStateNotifySlimmer, S as SubStateObserverSlimmer } from './sub-state-observer-slimmer-
|
|
19
|
-
import { T as TranslationSlimmer } from './translation-slimmer-
|
|
18
|
+
import { c as createSubStateNotifySlimmer, S as SubStateObserverSlimmer } from './sub-state-observer-slimmer-8eff5559.js';
|
|
19
|
+
import { T as TranslationSlimmer } from './translation-slimmer-79f9a9c9.js';
|
|
20
20
|
import { s as slotPlaceholder } from './placeholder-bf562081.js';
|
|
21
21
|
import { p as isBackgroundColorTokenType } from './type-guard-63caf78b.js';
|
|
22
22
|
import { s as stateBackgroundColorFormatter } from './state-background-color-formatter-0540d006.js';
|
|
@@ -32,7 +32,7 @@ import './index-0863eec6.js';
|
|
|
32
32
|
import './number-e2519d1c.js';
|
|
33
33
|
import './breakpoints-36a3ed69.js';
|
|
34
34
|
import './ui-8424715a.js';
|
|
35
|
-
import './translation-
|
|
35
|
+
import './translation-0fa7cf77.js';
|
|
36
36
|
import './static-subject-title-6987a80b.js';
|
|
37
37
|
import './regex-dfe11abf.js';
|
|
38
38
|
import './typography-a8fc4764.js';
|
|
@@ -72,1078 +72,1146 @@ const chevronLeft = {
|
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
75
|
+
* Get a week days array
|
|
76
76
|
*
|
|
77
|
-
* @param {
|
|
78
|
-
* @
|
|
79
|
-
* @returns {string} the month English name
|
|
77
|
+
* @param {number} firstWeekDay - The first week day (0: Sunday, 1: Monday, ...)
|
|
78
|
+
* @returns {number[]} - The week days array
|
|
80
79
|
*/
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
const getWeekdays = (firstWeekDay = 0) => {
|
|
81
|
+
const weekdays = [0, 1, 2, 3, 4, 5, 6];
|
|
82
|
+
return weekdays.concat(weekdays).slice(firstWeekDay, firstWeekDay + 7);
|
|
83
|
+
};
|
|
84
|
+
|
|
84
85
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* @param {string} timeString - A string representing a time in the format "HH:MM", where HH is the hour and MM is the minutes.
|
|
88
|
-
* @param {number} [unit=15] - The `unit` parameter in the `getTimeIndex` function is used to specify
|
|
89
|
-
* the interval in minutes for dividing the day. By default, it is set to 15 minutes, meaning that the
|
|
90
|
-
* day will be divided into 15-minute intervals.
|
|
91
|
-
* @returns {number} the index of the given time string based on the specified time unit.
|
|
86
|
+
* Calendar view generator abstract class.
|
|
92
87
|
*/
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
class CalendarViewGenerator {
|
|
89
|
+
constructor() {
|
|
90
|
+
this.WEEKDAYS_SHORT = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
91
|
+
this.weekdays = getWeekdays();
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Get weekday names.
|
|
95
|
+
*
|
|
96
|
+
* @returns {string[]} - The weekday strings
|
|
97
|
+
*/
|
|
98
|
+
getWeekdayNames() {
|
|
99
|
+
return this.WEEKDAYS_SHORT;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Generate calendar dates
|
|
103
|
+
*
|
|
104
|
+
* @param {CalendarPeriod} period - The calendar period
|
|
105
|
+
* @returns {Date[]} - The date result
|
|
106
|
+
*/
|
|
107
|
+
generateDates(period) {
|
|
108
|
+
const cursor = period.startDate.toDate();
|
|
109
|
+
const dates = [];
|
|
110
|
+
for (let i = 0; i < period.count; i++) {
|
|
111
|
+
dates.push(new Date(cursor));
|
|
112
|
+
cursor.setDate(cursor.getDate() + 1);
|
|
113
|
+
}
|
|
114
|
+
return dates;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Generate calendar head
|
|
118
|
+
*
|
|
119
|
+
* @returns {string[]} - The data of week head
|
|
120
|
+
*/
|
|
121
|
+
generateWeekHead() {
|
|
122
|
+
return this.weekdays.map((day) => this.getWeekdayNames()[day]);
|
|
123
|
+
}
|
|
96
124
|
}
|
|
125
|
+
|
|
97
126
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* @param {string} eventKey - represents the key or identifier of a calendar event.
|
|
101
|
-
* @returns {string} a string that is a concatenation of 'vega-calendar-event-slot-' and the eventKey parameter.
|
|
127
|
+
* Calendar view
|
|
102
128
|
*/
|
|
103
|
-
|
|
104
|
-
|
|
129
|
+
class CalendarView {
|
|
130
|
+
constructor(weekdays, dateItems) {
|
|
131
|
+
this._weekdays = weekdays;
|
|
132
|
+
this._dateItems = dateItems;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* The week head of the calendar view
|
|
136
|
+
*
|
|
137
|
+
* @type {string[]}
|
|
138
|
+
*/
|
|
139
|
+
get weekdays() {
|
|
140
|
+
return this._weekdays;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The date items of the calendar view
|
|
144
|
+
*
|
|
145
|
+
* @type {CalendarDate[][]}
|
|
146
|
+
*/
|
|
147
|
+
get dateItems() {
|
|
148
|
+
return this._dateItems;
|
|
149
|
+
}
|
|
105
150
|
}
|
|
106
151
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
152
|
+
/**
|
|
153
|
+
* Day view calendar generator
|
|
154
|
+
*/
|
|
155
|
+
class DayViewGenerator extends CalendarViewGenerator {
|
|
156
|
+
/**
|
|
157
|
+
* @inheritDoc
|
|
158
|
+
*/
|
|
159
|
+
generate(period) {
|
|
160
|
+
return new CalendarView([this.generateWeekHead()[period.current.toDate().getDay()]], [[period.current]]);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
110
163
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
constructor() {
|
|
120
|
-
super(...arguments);
|
|
121
|
-
/**
|
|
122
|
-
* This function is responsible for updating the `viewMode` property of the `VegaCalendarSwitchPanelRenderer` class with the value extracted from the `input` parameter.
|
|
123
|
-
*
|
|
124
|
-
* @param {NotifyObserverPayload<VegaCalendarViewModeType>} input mark which view should be selected
|
|
125
|
-
*/
|
|
126
|
-
this.handleViewChange = (input) => {
|
|
127
|
-
this.currentPeriodController.updateCalendarPeriod(input.detail, this.currentPeriod.current);
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
130
|
-
* reset view content to today
|
|
131
|
-
*/
|
|
132
|
-
this.todayButtonClick = () => {
|
|
133
|
-
this.currentPeriodController.setCurrentPeriod(this.currentPeriod.now());
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* update view content after click next button
|
|
137
|
-
*/
|
|
138
|
-
this.nextButtonClick = () => {
|
|
139
|
-
this.currentPeriodController.setCurrentPeriod(this.currentPeriod.next());
|
|
140
|
-
};
|
|
141
|
-
/**
|
|
142
|
-
* update view content after click previous button
|
|
143
|
-
*/
|
|
144
|
-
this.prevButtonClick = () => {
|
|
145
|
-
this.currentPeriodController.setCurrentPeriod(this.currentPeriod.previous());
|
|
146
|
-
};
|
|
147
|
-
/**
|
|
148
|
-
* The more action menu ite click
|
|
149
|
-
*
|
|
150
|
-
* @param {NotifyObserverPayload<string>} payload The object contains the menu item key
|
|
151
|
-
*/
|
|
152
|
-
this.moreActionMenuClick = (payload) => {
|
|
153
|
-
this.moreActionClickEmitter.emit(payload.detail);
|
|
154
|
-
};
|
|
164
|
+
/**
|
|
165
|
+
* Calendar date class
|
|
166
|
+
*/
|
|
167
|
+
class CalendarDate {
|
|
168
|
+
constructor(year, month, date) {
|
|
169
|
+
this._date = date;
|
|
170
|
+
this._month = month;
|
|
171
|
+
this._year = year;
|
|
155
172
|
}
|
|
156
173
|
/**
|
|
157
|
-
*
|
|
174
|
+
* Create a calendar date from a Date object
|
|
158
175
|
*
|
|
159
|
-
* @
|
|
176
|
+
* @param {Date} date - The Date object
|
|
177
|
+
* @returns {CalendarDate} - Return a CalendarDate object
|
|
160
178
|
*/
|
|
161
|
-
|
|
162
|
-
return
|
|
179
|
+
static from(date) {
|
|
180
|
+
return new CalendarDate(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
163
181
|
}
|
|
164
182
|
/**
|
|
165
|
-
*
|
|
183
|
+
* The year of the calendar date
|
|
166
184
|
*
|
|
167
|
-
* @
|
|
185
|
+
* @type {number}
|
|
168
186
|
*/
|
|
169
|
-
|
|
170
|
-
return
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
this.renderMoreActionMenu())));
|
|
187
|
+
get year() {
|
|
188
|
+
return this._year;
|
|
189
|
+
}
|
|
190
|
+
set year(value) {
|
|
191
|
+
this._year = value;
|
|
175
192
|
}
|
|
176
193
|
/**
|
|
177
|
-
* The
|
|
194
|
+
* The month of the calendar date
|
|
178
195
|
*
|
|
179
|
-
* @
|
|
196
|
+
* @type {number}
|
|
180
197
|
*/
|
|
181
|
-
|
|
182
|
-
return
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
h("vega-button-circle", { variant: "secondary", size: "small", icon: VegaInternalIconManager.getIconKey('chevron-left'), label: "previous", showTooltip: false, ref: (button) => {
|
|
187
|
-
DomNodeSubjectObserverFactory.addUniqueObserverToNode(button, VegaClick, this.prevButtonClick);
|
|
188
|
-
} }),
|
|
189
|
-
h("vega-button-circle", { variant: "secondary", size: "small", icon: VegaInternalIconManager.getIconKey('chevron-right'), label: "next", showTooltip: false, ref: (button) => {
|
|
190
|
-
DomNodeSubjectObserverFactory.addUniqueObserverToNode(button, VegaClick, this.nextButtonClick);
|
|
191
|
-
} }),
|
|
192
|
-
this.renderCurrentPeriod()));
|
|
198
|
+
get month() {
|
|
199
|
+
return this._month;
|
|
200
|
+
}
|
|
201
|
+
set month(value) {
|
|
202
|
+
this._month = value;
|
|
193
203
|
}
|
|
194
204
|
/**
|
|
195
|
-
* The
|
|
205
|
+
* The date of the calendar date
|
|
196
206
|
*
|
|
197
|
-
* @
|
|
207
|
+
* @type {number}
|
|
198
208
|
*/
|
|
199
|
-
|
|
200
|
-
return
|
|
209
|
+
get date() {
|
|
210
|
+
return this._date;
|
|
211
|
+
}
|
|
212
|
+
set date(value) {
|
|
213
|
+
this._date = value;
|
|
201
214
|
}
|
|
202
215
|
/**
|
|
203
|
-
*
|
|
216
|
+
* Verify whether the calendar date is today
|
|
204
217
|
*
|
|
205
|
-
* @returns {
|
|
218
|
+
* @returns {boolean} - Return true if the calendar date is today. Otherwise, return false.
|
|
206
219
|
*/
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
220
|
+
isToday() {
|
|
221
|
+
const today = new Date();
|
|
222
|
+
return (today.getFullYear() === this.year &&
|
|
223
|
+
today.getMonth() + 1 === this.month &&
|
|
224
|
+
today.getDate() === this.date);
|
|
211
225
|
}
|
|
212
226
|
/**
|
|
213
|
-
*
|
|
227
|
+
* Convert the calendar date to a Date object
|
|
214
228
|
*
|
|
215
|
-
* @returns {
|
|
229
|
+
* @returns {Date} - Return a Date object
|
|
216
230
|
*/
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
if ((_b = (_a = this.moreActionDropdownProps) === null || _a === void 0 ? void 0 : _a.source) === null || _b === void 0 ? void 0 : _b.length) {
|
|
220
|
-
return (h("vega-dropdown", Object.assign({ alignment: "end", trigger: "click" }, this.moreActionDropdownProps, { ref: (node) => {
|
|
221
|
-
DomNodeSubjectObserverFactory.addUniqueObserverToNode(node, VegaDropdownClick, this.moreActionMenuClick);
|
|
222
|
-
} }),
|
|
223
|
-
h("vega-button-circle", { size: "small", icon: VegaInternalIconManager.getIconKey('ellipsis-vertical'), variant: "icon-only" })));
|
|
224
|
-
}
|
|
231
|
+
toDate() {
|
|
232
|
+
return new Date(this.year, this.month - 1, this.date);
|
|
225
233
|
}
|
|
226
234
|
/**
|
|
227
|
-
*
|
|
235
|
+
* Compare with another calendar date
|
|
228
236
|
*
|
|
229
|
-
* @
|
|
237
|
+
* @param {CalendarDate} date - The calendar date to compare with
|
|
238
|
+
* @returns {DateCompareResult} - Return a DateCompareResult object
|
|
230
239
|
*/
|
|
231
|
-
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
const start = this.currentPeriod.startDate;
|
|
242
|
-
const end = this.currentPeriod.endDate;
|
|
243
|
-
const [startMonthName, endMonthName] = [start, end].map((item) => this.translationSlimmer.t(getMonthName(item.toDate())));
|
|
244
|
-
result = `${start.date} ${startMonthName}${start.year === end.year ? '' : ', ' + start.year} - ${end.date} ${endMonthName}, ${end.year}`;
|
|
245
|
-
break;
|
|
240
|
+
compare(date) {
|
|
241
|
+
const { year, month } = date;
|
|
242
|
+
const result = {
|
|
243
|
+
isPreviousMonth: false,
|
|
244
|
+
inMonth: false,
|
|
245
|
+
isNextMonth: false,
|
|
246
|
+
};
|
|
247
|
+
if (this.year === year) {
|
|
248
|
+
if (this.month < month) {
|
|
249
|
+
result.isPreviousMonth = true;
|
|
246
250
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
result = `${monthName}, ${currentDate.year}`;
|
|
250
|
-
break;
|
|
251
|
+
else if (this.month > month) {
|
|
252
|
+
result.isNextMonth = true;
|
|
251
253
|
}
|
|
254
|
+
else {
|
|
255
|
+
result.inMonth = true;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
else if (this.year > year) {
|
|
259
|
+
result.isNextMonth = true;
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
result.isPreviousMonth = true;
|
|
252
263
|
}
|
|
253
264
|
return result;
|
|
254
265
|
}
|
|
255
|
-
}
|
|
256
|
-
(() => {
|
|
257
|
-
VegaInternalIconManager.register({
|
|
258
|
-
'chevron-right': chevronRight,
|
|
259
|
-
'chevron-left': chevronLeft,
|
|
260
|
-
'ellipsis-vertical': ellipsisVertical,
|
|
261
|
-
});
|
|
262
|
-
})();
|
|
263
|
-
VegaCalendarSwitchPanelRenderer.views = [
|
|
264
|
-
{ text: 'Day', key: 'day' },
|
|
265
|
-
{ text: 'Week', key: 'week' },
|
|
266
|
-
{ text: 'Month', key: 'month' },
|
|
267
|
-
];
|
|
268
|
-
__decorate$n([
|
|
269
|
-
MapToComponentField()
|
|
270
|
-
], VegaCalendarSwitchPanelRenderer.prototype, "viewMode", void 0);
|
|
271
|
-
__decorate$n([
|
|
272
|
-
MapToComponentField()
|
|
273
|
-
], VegaCalendarSwitchPanelRenderer.prototype, "calendarView", void 0);
|
|
274
|
-
__decorate$n([
|
|
275
|
-
MapToComponentField()
|
|
276
|
-
], VegaCalendarSwitchPanelRenderer.prototype, "currentPeriod", void 0);
|
|
277
|
-
__decorate$n([
|
|
278
|
-
MapToComponentField()
|
|
279
|
-
], VegaCalendarSwitchPanelRenderer.prototype, "moreActionDropdownProps", void 0);
|
|
280
|
-
__decorate$n([
|
|
281
|
-
MapToComponentField()
|
|
282
|
-
], VegaCalendarSwitchPanelRenderer.prototype, "moreActionClickEmitter", void 0);
|
|
283
|
-
__decorate$n([
|
|
284
|
-
MapToComponentField()
|
|
285
|
-
], VegaCalendarSwitchPanelRenderer.prototype, "currentPeriodController", void 0);
|
|
286
|
-
__decorate$n([
|
|
287
|
-
MapToComponentField()
|
|
288
|
-
], VegaCalendarSwitchPanelRenderer.prototype, "calendarViewController", void 0);
|
|
289
|
-
__decorate$n([
|
|
290
|
-
MapToComponentField()
|
|
291
|
-
], VegaCalendarSwitchPanelRenderer.prototype, "translationSlimmer", void 0);
|
|
292
|
-
|
|
293
|
-
var __decorate$m = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
294
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
295
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
296
|
-
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;
|
|
297
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
298
|
-
};
|
|
299
|
-
/** renders different views based on the specified view mode using month, week, and day view render. */
|
|
300
|
-
class VegaCalendarViewRenderer extends VegaSlimmer {
|
|
301
266
|
/**
|
|
302
|
-
*
|
|
267
|
+
* The function "equal" compares the year, month, and date of two CalendarDate objects and returns true if they are equal.
|
|
303
268
|
*
|
|
304
|
-
* @
|
|
269
|
+
* @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
|
|
270
|
+
* `CalendarDate` object passed as a parameter. The method returns `true` if all three values (year, month, date) are equal
|
|
271
|
+
* @returns {boolean} The date is same day with current
|
|
305
272
|
*/
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
: this.viewWithTimeRenderer.render()));
|
|
273
|
+
equal(calendarDate) {
|
|
274
|
+
const { year, month, date } = calendarDate;
|
|
275
|
+
return this._year === year && this._month === month && this._date === date;
|
|
310
276
|
}
|
|
311
277
|
}
|
|
312
|
-
__decorate$m([
|
|
313
|
-
MapToComponentField()
|
|
314
|
-
], VegaCalendarViewRenderer.prototype, "viewMode", void 0);
|
|
315
|
-
__decorate$m([
|
|
316
|
-
MapToComponentField()
|
|
317
|
-
], VegaCalendarViewRenderer.prototype, "monthViewRenderer", void 0);
|
|
318
|
-
__decorate$m([
|
|
319
|
-
MapToComponentField()
|
|
320
|
-
], VegaCalendarViewRenderer.prototype, "viewWithTimeRenderer", void 0);
|
|
321
278
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
327
|
-
};
|
|
328
|
-
/** 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. */
|
|
329
|
-
class VegaCalendarMonthViewRenderer extends VegaSlimmer {
|
|
330
|
-
/**
|
|
331
|
-
* the HTML elements that represent the month view of a calendar component.
|
|
332
|
-
*
|
|
333
|
-
* @returns {HTMLElement} the month view calendar content
|
|
334
|
-
*/
|
|
335
|
-
render() {
|
|
336
|
-
const weekHead = this.calendarView.weekdays;
|
|
337
|
-
return (h("div", { class: "calendar-view-month-container" },
|
|
338
|
-
h("div", { class: "calendar-view-row calendar-view-title border-divider-bottom" }, weekHead.map((title) => (h("div", { key: title }, this.translationSlimmer.t(title))))),
|
|
339
|
-
this.renderMonthViewContent()));
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* generating the HTML elements that represent the content of the month view in a calendar component
|
|
343
|
-
*
|
|
344
|
-
* @returns {HTMLElement[]} month view content and event content
|
|
345
|
-
*/
|
|
346
|
-
renderMonthViewContent() {
|
|
347
|
-
const monthSource = this.calendarView.dateItems;
|
|
348
|
-
const currentDate = this.currentPeriod.current;
|
|
349
|
-
return monthSource.map((dateArray, index) => {
|
|
350
|
-
const eventsArray = this.monthEventRenderer.getCurrentRowEvents(dateArray);
|
|
351
|
-
const displayEventsArray = this.monthEventRenderer.filterRowDisplayEvents(eventsArray);
|
|
352
|
-
return (h("div", { key: index, class: "calendar-view-row border-divider-bottom" }, dateArray.map((item, itemIndex) => {
|
|
353
|
-
return (h("div", { class: {
|
|
354
|
-
'row-cell border-divider-right': true,
|
|
355
|
-
'current-month-day': item.compare(currentDate).inMonth,
|
|
356
|
-
'active': item.isToday(),
|
|
357
|
-
'disabled': false,
|
|
358
|
-
}, key: `${item.month}-${item.date}`,
|
|
359
|
-
// eslint-disable-next-line react/jsx-no-bind
|
|
360
|
-
onDblClick: (e) => this.handleDateBlockClick(e, item) },
|
|
361
|
-
this.renderDateBlock(item),
|
|
362
|
-
this.monthEventRenderer.render(item, eventsArray[itemIndex], displayEventsArray[itemIndex], itemIndex)));
|
|
363
|
-
})));
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
/**
|
|
367
|
-
* It takes a `CalendarDate` object as a parameter and returns an HTML element representing a date block in the calendar view.
|
|
368
|
-
*
|
|
369
|
-
* @param {CalendarDate} item the day object
|
|
370
|
-
* @returns {HTMLElement} the date block element
|
|
371
|
-
*/
|
|
372
|
-
renderDateBlock(item) {
|
|
373
|
-
const isMonthFirstDay = item.date === 1;
|
|
374
|
-
return (h("div", { class: "date" },
|
|
375
|
-
isMonthFirstDay && h("div", { class: "month-block" }, getMonthName(item.toDate(), true)),
|
|
376
|
-
h("div", { role: "button", tabIndex: 0, class: "grid-col",
|
|
377
|
-
// eslint-disable-next-line react/jsx-no-bind
|
|
378
|
-
onDblClick: (e) => this.goToCurrentDayView(e, item) }, item.date)));
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* switch to current date day view
|
|
382
|
-
*
|
|
383
|
-
* @param {MouseEvent} e the double click event object
|
|
384
|
-
* @param {CalendarDate} calendarDate the calendar date object
|
|
385
|
-
*/
|
|
386
|
-
goToCurrentDayView(e, calendarDate) {
|
|
387
|
-
e.stopPropagation();
|
|
388
|
-
this.currentPeriodController.updateCalendarPeriod('day', calendarDate);
|
|
389
|
-
}
|
|
279
|
+
/**
|
|
280
|
+
* Calendar week view generator
|
|
281
|
+
*/
|
|
282
|
+
class WeekViewGenerator extends CalendarViewGenerator {
|
|
390
283
|
/**
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
* @param {MouseEvent} e the mouse event object
|
|
394
|
-
* @param {CalendarDate} calendarDate the calendar date object
|
|
284
|
+
* @inheritDoc
|
|
395
285
|
*/
|
|
396
|
-
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
hour: 0,
|
|
405
|
-
mouseEventInfo: { clientX, clientY },
|
|
406
|
-
});
|
|
286
|
+
generate(period) {
|
|
287
|
+
const dates = this.generateDates(period);
|
|
288
|
+
const showWeekends = period.showWeekends;
|
|
289
|
+
let weekDays = this.generateWeekHead();
|
|
290
|
+
let dateItems = [dates.map(CalendarDate.from)];
|
|
291
|
+
if (showWeekends === false) {
|
|
292
|
+
weekDays = weekDays.slice(1, 6);
|
|
293
|
+
dateItems = dateItems.map((items) => items.slice(1, 6));
|
|
407
294
|
}
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* determine if the clicked element is blank area
|
|
411
|
-
*
|
|
412
|
-
* @param {HTMLElement} element the target element
|
|
413
|
-
* @returns {boolean} true or false
|
|
414
|
-
*/
|
|
415
|
-
isMonthBlockBlankArea(element) {
|
|
416
|
-
// the more button and the calendar event component should not trigger dateDblClick event
|
|
417
|
-
return !element.classList.contains('more-button') && element.tagName !== 'VEGA-CALENDAR-EVENT';
|
|
295
|
+
return new CalendarView(weekDays, dateItems);
|
|
418
296
|
}
|
|
419
297
|
}
|
|
420
|
-
__decorate$l([
|
|
421
|
-
MapToComponentField()
|
|
422
|
-
], VegaCalendarMonthViewRenderer.prototype, "viewMode", void 0);
|
|
423
|
-
__decorate$l([
|
|
424
|
-
MapToComponentField()
|
|
425
|
-
], VegaCalendarMonthViewRenderer.prototype, "calendarView", void 0);
|
|
426
|
-
__decorate$l([
|
|
427
|
-
MapToComponentField()
|
|
428
|
-
], VegaCalendarMonthViewRenderer.prototype, "currentPeriod", void 0);
|
|
429
|
-
__decorate$l([
|
|
430
|
-
MapToComponentField()
|
|
431
|
-
], VegaCalendarMonthViewRenderer.prototype, "calendarViewController", void 0);
|
|
432
|
-
__decorate$l([
|
|
433
|
-
MapToComponentField()
|
|
434
|
-
], VegaCalendarMonthViewRenderer.prototype, "currentPeriodController", void 0);
|
|
435
|
-
__decorate$l([
|
|
436
|
-
MapToComponentField()
|
|
437
|
-
], VegaCalendarMonthViewRenderer.prototype, "monthEventRenderer", void 0);
|
|
438
|
-
__decorate$l([
|
|
439
|
-
MapToComponentField()
|
|
440
|
-
], VegaCalendarMonthViewRenderer.prototype, "dateDblClickEmitter", void 0);
|
|
441
|
-
__decorate$l([
|
|
442
|
-
MapToComponentField()
|
|
443
|
-
], VegaCalendarMonthViewRenderer.prototype, "translationSlimmer", void 0);
|
|
444
298
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
450
|
-
};
|
|
451
|
-
/** The `VegaCalendarViewWithTimeRenderer` class in TypeScript React renders a day view for a calendar component with title, content, and hour blocks. */
|
|
452
|
-
class VegaCalendarViewWithTimeRenderer extends VegaSlimmer {
|
|
453
|
-
/**
|
|
454
|
-
* The render function in TypeScript React returns an array of HTMLElements containing the week calendar view for a specific day.
|
|
455
|
-
*
|
|
456
|
-
* @returns {HTMLElement} An array of HTMLElement elements containing the rendered content of a calendar view for a
|
|
457
|
-
* specific day in the week. The content includes the title and the main content of the calendar view
|
|
458
|
-
* for that day.
|
|
459
|
-
*/
|
|
460
|
-
render() {
|
|
461
|
-
return (h("div", { class: "calendar-view-container" },
|
|
462
|
-
this.renderViewTitle(),
|
|
463
|
-
this.renderViewContent()));
|
|
464
|
-
}
|
|
465
|
-
/**
|
|
466
|
-
* The function `renderViewTitle` renders a calendar view title and events based on the provided source data.
|
|
467
|
-
*
|
|
468
|
-
* @returns {HTMLElement} The `renderViewTitle` function returns an HTML element (HTMLElement) that contains a calendar view title container with rows for each day's information.
|
|
469
|
-
*/
|
|
470
|
-
renderViewTitle() {
|
|
471
|
-
const source = this.calendarView.dateItems[0];
|
|
472
|
-
const weekHead = this.calendarView.weekdays;
|
|
473
|
-
return (h("div", { class: "calendar-view-title-container" },
|
|
474
|
-
h("div", { class: "calendar-view-row" },
|
|
475
|
-
h("div", { class: "time-line-empty" }),
|
|
476
|
-
h("div", { class: "calendar-view-title" }, source.map((item, index) => (h("div", { key: item.date, class: { active: item.isToday() } },
|
|
477
|
-
h("div", null, this.translationSlimmer.t(weekHead[index])),
|
|
478
|
-
h("div", { class: "week-day" }, item.date)))))),
|
|
479
|
-
h("div", { class: "calendar-view-row calendar-view-event-all-container border-divider-bottom" },
|
|
480
|
-
h("div", { class: "time-line-all" }, this.translationSlimmer.t('All Day')),
|
|
481
|
-
this.dayViewFullDayEventRenderer.render())));
|
|
482
|
-
}
|
|
483
|
-
/**
|
|
484
|
-
* The `renderViewContent` function in TypeScript React renders a calendar view with day blocks and time markers based on the provided data.
|
|
485
|
-
*
|
|
486
|
-
* @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.
|
|
487
|
-
*/
|
|
488
|
-
renderViewContent() {
|
|
489
|
-
const source = this.calendarView.dateItems[0];
|
|
490
|
-
return (h("div", { class: "calendar-view-row calendar-view-day-container" },
|
|
491
|
-
this.timeLineRenderer.render(),
|
|
492
|
-
h("div", { class: "calendar-view-content-container" },
|
|
493
|
-
h("div", { class: "calendar-view-content" }, source.map((item) => {
|
|
494
|
-
return (h("div", { class: "grid-col border-divider-left", key: item.date },
|
|
495
|
-
h("div", { class: "hour-empty border-divider-top" }),
|
|
496
|
-
this.renderHourBlock(item)));
|
|
497
|
-
})),
|
|
498
|
-
this.dayViewTimedEventRenderer.render(),
|
|
499
|
-
this.timeLineRenderer.renderTimeMarker(source))));
|
|
500
|
-
}
|
|
299
|
+
/**
|
|
300
|
+
* Calendar month view generator
|
|
301
|
+
*/
|
|
302
|
+
class MonthViewGenerator extends CalendarViewGenerator {
|
|
501
303
|
/**
|
|
502
|
-
*
|
|
503
|
-
*
|
|
504
|
-
* @param {CalendarDate} calendarDate then current calendar date object
|
|
505
|
-
* @returns {HTMLElement[]} An array of HTMLElements is being returned. Each HTMLElement represents an hour block with a time value inside a div element.
|
|
304
|
+
* @inheritDoc
|
|
506
305
|
*/
|
|
507
|
-
|
|
508
|
-
const
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
306
|
+
generate(period) {
|
|
307
|
+
const showWeekends = period.showWeekends;
|
|
308
|
+
let calendarDates = [];
|
|
309
|
+
let week = [];
|
|
310
|
+
const dates = this.generateDates(period);
|
|
311
|
+
dates.forEach((date, i) => {
|
|
312
|
+
if (!(i % 7)) {
|
|
313
|
+
calendarDates[i / 7] = week = [];
|
|
314
|
+
}
|
|
315
|
+
const item = CalendarDate.from(date);
|
|
316
|
+
week.push(item);
|
|
515
317
|
});
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
handleDateBlockClick(calendarDate, hour, e) {
|
|
523
|
-
const { year, month, date } = calendarDate;
|
|
524
|
-
const { clientX, clientY } = e;
|
|
525
|
-
this.dateDblClickEmitter.emit({ year, month, date, hour, mouseEventInfo: { clientX, clientY } });
|
|
318
|
+
let weekDays = this.generateWeekHead();
|
|
319
|
+
if (showWeekends === false) {
|
|
320
|
+
weekDays = weekDays.slice(1, 6);
|
|
321
|
+
calendarDates = calendarDates.map((items) => items.slice(1, 6));
|
|
322
|
+
}
|
|
323
|
+
return new CalendarView(weekDays, calendarDates);
|
|
526
324
|
}
|
|
527
325
|
}
|
|
528
|
-
__decorate$k([
|
|
529
|
-
MapToComponentField()
|
|
530
|
-
], VegaCalendarViewWithTimeRenderer.prototype, "viewMode", void 0);
|
|
531
|
-
__decorate$k([
|
|
532
|
-
MapToComponentField()
|
|
533
|
-
], VegaCalendarViewWithTimeRenderer.prototype, "timeLineRenderer", void 0);
|
|
534
|
-
__decorate$k([
|
|
535
|
-
MapToComponentField()
|
|
536
|
-
], VegaCalendarViewWithTimeRenderer.prototype, "dayViewTimedEventRenderer", void 0);
|
|
537
|
-
__decorate$k([
|
|
538
|
-
MapToComponentField()
|
|
539
|
-
], VegaCalendarViewWithTimeRenderer.prototype, "dayViewFullDayEventRenderer", void 0);
|
|
540
|
-
__decorate$k([
|
|
541
|
-
MapToComponentField()
|
|
542
|
-
], VegaCalendarViewWithTimeRenderer.prototype, "calendarView", void 0);
|
|
543
|
-
__decorate$k([
|
|
544
|
-
MapToComponentField()
|
|
545
|
-
], VegaCalendarViewWithTimeRenderer.prototype, "calendarViewController", void 0);
|
|
546
|
-
__decorate$k([
|
|
547
|
-
MapToComponentField()
|
|
548
|
-
], VegaCalendarViewWithTimeRenderer.prototype, "dateDblClickEmitter", void 0);
|
|
549
|
-
__decorate$k([
|
|
550
|
-
MapToComponentField()
|
|
551
|
-
], VegaCalendarViewWithTimeRenderer.prototype, "translationSlimmer", void 0);
|
|
552
326
|
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
327
|
+
/**
|
|
328
|
+
* CalendarPeriod is an abstract class that represents a period of date for calendar.
|
|
329
|
+
*/
|
|
330
|
+
class CalendarPeriod {
|
|
331
|
+
constructor(count, current) {
|
|
332
|
+
this._count = count;
|
|
333
|
+
this._current = current ? current : CalendarDate.from(new Date());
|
|
334
|
+
this.calculatePeriod(this._current);
|
|
335
|
+
}
|
|
561
336
|
/**
|
|
562
|
-
*
|
|
337
|
+
* The current date of the period.
|
|
563
338
|
*
|
|
564
|
-
* @
|
|
565
|
-
* @returns {HTMLElement} the html element
|
|
339
|
+
* @type {CalendarDate}
|
|
566
340
|
*/
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
341
|
+
get current() {
|
|
342
|
+
return this._current;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* The start date of the period
|
|
346
|
+
*
|
|
347
|
+
* @type {CalendarDate}
|
|
348
|
+
*/
|
|
349
|
+
get startDate() {
|
|
350
|
+
return this._startDate;
|
|
576
351
|
}
|
|
577
352
|
/**
|
|
578
|
-
*
|
|
353
|
+
* The end date of the period
|
|
579
354
|
*
|
|
580
|
-
* @
|
|
355
|
+
* @type {CalendarDate}
|
|
581
356
|
*/
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
return (h("div", { class: "time-line", ref: (div) => (this.timeLineRef = div) },
|
|
585
|
-
h("div", { class: "hour-empty" }),
|
|
586
|
-
timeLineSource.map((time, index) => {
|
|
587
|
-
return (h("div", { key: time },
|
|
588
|
-
h("div", { class: "time-text", "data-time": index === 0 ? 24 : index }, time)));
|
|
589
|
-
})));
|
|
357
|
+
get endDate() {
|
|
358
|
+
return this._endDate;
|
|
590
359
|
}
|
|
591
360
|
/**
|
|
592
|
-
*
|
|
361
|
+
* The count of the period
|
|
593
362
|
*
|
|
594
|
-
* @
|
|
363
|
+
* @type {number}
|
|
595
364
|
*/
|
|
596
|
-
|
|
597
|
-
this.
|
|
598
|
-
this.syncTimeMarkerPosition(viewMode);
|
|
365
|
+
get count() {
|
|
366
|
+
return this._count;
|
|
599
367
|
}
|
|
600
368
|
/**
|
|
601
|
-
*
|
|
369
|
+
* This function returns the type of the object.
|
|
370
|
+
*
|
|
371
|
+
* @type {string}
|
|
602
372
|
*/
|
|
603
|
-
|
|
604
|
-
|
|
373
|
+
get type() {
|
|
374
|
+
return this._type;
|
|
605
375
|
}
|
|
606
376
|
/**
|
|
607
|
-
*
|
|
377
|
+
* This function returns the showWeekends of the object.
|
|
378
|
+
*
|
|
379
|
+
* @type {boolean}
|
|
608
380
|
*/
|
|
609
|
-
|
|
610
|
-
this.
|
|
381
|
+
get showWeekends() {
|
|
382
|
+
return this._showWeekends;
|
|
611
383
|
}
|
|
612
384
|
/**
|
|
613
|
-
*
|
|
385
|
+
* Go to a specific date.
|
|
386
|
+
*
|
|
387
|
+
* @param {CalendarDate} date - The date to go to.
|
|
388
|
+
* @returns {this} - The current period.
|
|
614
389
|
*/
|
|
615
|
-
|
|
616
|
-
this.
|
|
390
|
+
goTo(date) {
|
|
391
|
+
return this.createBy(date);
|
|
617
392
|
}
|
|
618
393
|
/**
|
|
619
|
-
*
|
|
394
|
+
* Go to now.
|
|
620
395
|
*
|
|
621
|
-
* @returns {
|
|
396
|
+
* @returns {this} - The current period.
|
|
622
397
|
*/
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
const minutesOneDay = 24 * 60;
|
|
626
|
-
return ((now.getHours() * 60 + now.getMinutes()) / minutesOneDay) * 100 + '%';
|
|
398
|
+
now() {
|
|
399
|
+
return this.createBy(CalendarDate.from(new Date()));
|
|
627
400
|
}
|
|
628
401
|
/**
|
|
629
|
-
*
|
|
402
|
+
* Calculate the period start date and end date.
|
|
630
403
|
*
|
|
631
|
-
* @
|
|
404
|
+
* @param {CalendarDate} date - The date to calculate the period from.
|
|
632
405
|
*/
|
|
633
|
-
|
|
634
|
-
const
|
|
635
|
-
if (this.
|
|
636
|
-
|
|
637
|
-
for (let i = 1; i < 12; i++) {
|
|
638
|
-
timeLine.push(`${i} AM`);
|
|
639
|
-
}
|
|
640
|
-
timeLine.push('12 PM');
|
|
641
|
-
for (let i = 1; i < 12; i++) {
|
|
642
|
-
timeLine.push(`${i} PM`);
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
else {
|
|
646
|
-
for (let i = 0; i < 24; i++) {
|
|
647
|
-
timeLine.push(pad(i));
|
|
648
|
-
}
|
|
406
|
+
calculatePeriod(date) {
|
|
407
|
+
const cursor = date.toDate();
|
|
408
|
+
if (this.count > 1) {
|
|
409
|
+
cursor.setDate(cursor.getDate() - getWeekdays().indexOf(cursor.getDay()));
|
|
649
410
|
}
|
|
650
|
-
|
|
411
|
+
this._startDate = CalendarDate.from(cursor);
|
|
412
|
+
cursor.setDate(cursor.getDate() + this.count - 1);
|
|
413
|
+
this._endDate = CalendarDate.from(cursor);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Period of day.
|
|
419
|
+
*/
|
|
420
|
+
class DayPeriod extends CalendarPeriod {
|
|
421
|
+
constructor(current, showWeekends) {
|
|
422
|
+
super(DayPeriod.DISPLAY_DATE_COUNT, current);
|
|
423
|
+
this._type = 'day';
|
|
424
|
+
this._showWeekends = true;
|
|
425
|
+
this._showWeekends = showWeekends === false ? false : true;
|
|
651
426
|
}
|
|
652
|
-
/*
|
|
653
|
-
* The below method is e2e-test covered in
|
|
654
|
-
* @see{module:vega-calendar-scroll-to-current-time}
|
|
655
|
-
*/
|
|
656
|
-
/* istanbul ignore next */
|
|
657
427
|
/**
|
|
658
|
-
*
|
|
659
|
-
*
|
|
660
|
-
* @param {VegaCalendarViewModeType} viewMode view mode value
|
|
428
|
+
* @inheritDoc
|
|
661
429
|
*/
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
}
|
|
669
|
-
}, 60 * 1000);
|
|
430
|
+
next() {
|
|
431
|
+
const nextDate = this.current.toDate();
|
|
432
|
+
nextDate.setDate(nextDate.getDate() + 1);
|
|
433
|
+
let calendarDate = CalendarDate.from(nextDate);
|
|
434
|
+
if (this._showWeekends === false) {
|
|
435
|
+
calendarDate = getClosestWorkday(calendarDate);
|
|
670
436
|
}
|
|
437
|
+
return this.createBy(calendarDate);
|
|
671
438
|
}
|
|
672
|
-
|
|
673
|
-
*
|
|
674
|
-
* @see{module:vega-calendar-scroll-to-current-time}
|
|
439
|
+
/**
|
|
440
|
+
* @inheritDoc
|
|
675
441
|
*/
|
|
676
|
-
|
|
442
|
+
previous() {
|
|
443
|
+
const previousDate = this.current.toDate();
|
|
444
|
+
previousDate.setDate(previousDate.getDate() - 1);
|
|
445
|
+
let calendarDate = CalendarDate.from(previousDate);
|
|
446
|
+
if (this._showWeekends === false) {
|
|
447
|
+
calendarDate = getClosestWorkday(calendarDate, DateDirection.PREVIOUS);
|
|
448
|
+
}
|
|
449
|
+
return this.createBy(calendarDate);
|
|
450
|
+
}
|
|
677
451
|
/**
|
|
678
|
-
*
|
|
452
|
+
* Go to now.
|
|
679
453
|
*
|
|
680
|
-
* @
|
|
454
|
+
* @returns {this} - The current period.
|
|
681
455
|
*/
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
setTimeout(() => {
|
|
687
|
-
var _a, _b;
|
|
688
|
-
const hour = new Date().getHours();
|
|
689
|
-
(_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' });
|
|
690
|
-
}, oneFrame);
|
|
456
|
+
now() {
|
|
457
|
+
let calendarDate = CalendarDate.from(new Date());
|
|
458
|
+
if (this._showWeekends === false) {
|
|
459
|
+
calendarDate = getClosestWorkday(calendarDate);
|
|
691
460
|
}
|
|
461
|
+
return this.createBy(calendarDate);
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* @inheritDoc
|
|
465
|
+
*/
|
|
466
|
+
createBy(current) {
|
|
467
|
+
return new DayPeriod(current, this._showWeekends);
|
|
692
468
|
}
|
|
693
469
|
}
|
|
694
|
-
|
|
695
|
-
MapToComponentField()
|
|
696
|
-
], VegaCalendarTimeLineRenderer.prototype, "timeFormat", void 0);
|
|
697
|
-
__decorate$j([
|
|
698
|
-
MapToComponentField()
|
|
699
|
-
], VegaCalendarTimeLineRenderer.prototype, "viewMode", void 0);
|
|
700
|
-
__decorate$j([
|
|
701
|
-
MapToComponentMethod('watchViewModeChange')
|
|
702
|
-
], VegaCalendarTimeLineRenderer.prototype, "updateTimeLine", null);
|
|
703
|
-
__decorate$j([
|
|
704
|
-
MapToComponentMethod('disconnectedCallback')
|
|
705
|
-
], VegaCalendarTimeLineRenderer.prototype, "clearTimer", null);
|
|
706
|
-
__decorate$j([
|
|
707
|
-
MapToComponentMethod('connectedCallback')
|
|
708
|
-
], VegaCalendarTimeLineRenderer.prototype, "updateTimeLineIfComponentAddBack", null);
|
|
709
|
-
__decorate$j([
|
|
710
|
-
MapToComponentMethod('componentDidLoad')
|
|
711
|
-
], VegaCalendarTimeLineRenderer.prototype, "displayCurrentTimeBlockByDefault", null);
|
|
712
|
-
|
|
713
|
-
/**
|
|
714
|
-
* Get a week days array
|
|
715
|
-
*
|
|
716
|
-
* @param {number} firstWeekDay - The first week day (0: Sunday, 1: Monday, ...)
|
|
717
|
-
* @returns {number[]} - The week days array
|
|
718
|
-
*/
|
|
719
|
-
const getWeekdays = (firstWeekDay = 0) => {
|
|
720
|
-
const weekdays = [0, 1, 2, 3, 4, 5, 6];
|
|
721
|
-
return weekdays.concat(weekdays).slice(firstWeekDay, firstWeekDay + 7);
|
|
722
|
-
};
|
|
470
|
+
DayPeriod.DISPLAY_DATE_COUNT = 1;
|
|
723
471
|
|
|
724
472
|
/**
|
|
725
|
-
*
|
|
473
|
+
* Period of the week
|
|
726
474
|
*/
|
|
727
|
-
class
|
|
728
|
-
constructor() {
|
|
729
|
-
|
|
730
|
-
this.
|
|
475
|
+
class WeekPeriod extends CalendarPeriod {
|
|
476
|
+
constructor(current, showWeekends) {
|
|
477
|
+
super(WeekPeriod.DISPLAY_DATE_COUNT, current);
|
|
478
|
+
this._type = 'week';
|
|
479
|
+
this._showWeekends = true;
|
|
480
|
+
this._showWeekends = showWeekends === false ? false : true;
|
|
731
481
|
}
|
|
732
482
|
/**
|
|
733
|
-
*
|
|
734
|
-
*
|
|
735
|
-
* @returns {string[]} - The weekday strings
|
|
483
|
+
* @inheritDoc
|
|
736
484
|
*/
|
|
737
|
-
|
|
738
|
-
|
|
485
|
+
next() {
|
|
486
|
+
const nextWeekStartDate = this.current.toDate();
|
|
487
|
+
nextWeekStartDate.setDate(nextWeekStartDate.getDate() - getWeekdays().indexOf(nextWeekStartDate.getDay()) + 7);
|
|
488
|
+
return this.createBy(CalendarDate.from(nextWeekStartDate));
|
|
739
489
|
}
|
|
740
490
|
/**
|
|
741
|
-
*
|
|
742
|
-
*
|
|
743
|
-
* @param {CalendarPeriod} period - The calendar period
|
|
744
|
-
* @returns {Date[]} - The date result
|
|
491
|
+
* @inheritDoc
|
|
745
492
|
*/
|
|
746
|
-
|
|
747
|
-
const
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
dates.push(new Date(cursor));
|
|
751
|
-
cursor.setDate(cursor.getDate() + 1);
|
|
752
|
-
}
|
|
753
|
-
return dates;
|
|
493
|
+
previous() {
|
|
494
|
+
const previousWeekStartDate = this.current.toDate();
|
|
495
|
+
previousWeekStartDate.setDate(previousWeekStartDate.getDate() - getWeekdays().indexOf(previousWeekStartDate.getDay()) - 7);
|
|
496
|
+
return this.createBy(CalendarDate.from(previousWeekStartDate));
|
|
754
497
|
}
|
|
755
498
|
/**
|
|
756
|
-
*
|
|
757
|
-
*
|
|
758
|
-
* @returns {string[]} - The data of week head
|
|
499
|
+
* @inheritDoc
|
|
759
500
|
*/
|
|
760
|
-
|
|
761
|
-
return
|
|
501
|
+
createBy(current) {
|
|
502
|
+
return new WeekPeriod(current, this._showWeekends);
|
|
762
503
|
}
|
|
763
504
|
}
|
|
505
|
+
WeekPeriod.DISPLAY_DATE_COUNT = 7;
|
|
764
506
|
|
|
765
507
|
/**
|
|
766
|
-
*
|
|
508
|
+
* Period of month
|
|
767
509
|
*/
|
|
768
|
-
class
|
|
769
|
-
constructor(
|
|
770
|
-
|
|
771
|
-
this.
|
|
510
|
+
class MonthPeriod extends CalendarPeriod {
|
|
511
|
+
constructor(current, showWeekends) {
|
|
512
|
+
super(MonthPeriod.DISPLAY_DATE_COUNT, MonthPeriod.getMonthFirstDay(current));
|
|
513
|
+
this._type = 'month';
|
|
514
|
+
this._showWeekends = true;
|
|
515
|
+
this._showWeekends = showWeekends === false ? false : true;
|
|
772
516
|
}
|
|
773
517
|
/**
|
|
774
|
-
* The
|
|
518
|
+
* The function `getMonthFirstDay` returns the first day of a given month in a calendar.
|
|
775
519
|
*
|
|
776
|
-
* @
|
|
520
|
+
* @param {CalendarDate} [calendarDate] - The `calendarDate` parameter is an optional parameter of
|
|
521
|
+
* type `CalendarDate`. It represents a specific date in the calendar. If a `calendarDate` is
|
|
522
|
+
* provided, the function will use that date to determine the first day of the month. If no
|
|
523
|
+
* `calendarDate` is provided, the function
|
|
524
|
+
* @returns {CalendarDate} A new `CalendarDate` object representing the first day of the month from the provided
|
|
525
|
+
* `calendarDate` parameter or the current date if no parameter is provided.
|
|
777
526
|
*/
|
|
778
|
-
|
|
779
|
-
|
|
527
|
+
static getMonthFirstDay(calendarDate) {
|
|
528
|
+
const date = calendarDate || CalendarDate.from(new Date());
|
|
529
|
+
return new CalendarDate(date.year, date.month, 1);
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* @inheritDoc
|
|
533
|
+
*/
|
|
534
|
+
next() {
|
|
535
|
+
const next = this.current.toDate();
|
|
536
|
+
next.setMonth(next.getMonth() + 1);
|
|
537
|
+
return this.createBy(CalendarDate.from(next));
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* @inheritDoc
|
|
541
|
+
*/
|
|
542
|
+
previous() {
|
|
543
|
+
const previous = this.current.toDate();
|
|
544
|
+
previous.setMonth(previous.getMonth() - 1);
|
|
545
|
+
return this.createBy(CalendarDate.from(previous));
|
|
780
546
|
}
|
|
781
547
|
/**
|
|
782
|
-
*
|
|
783
|
-
*
|
|
784
|
-
* @type {CalendarDate[][]}
|
|
548
|
+
* @inheritDoc
|
|
785
549
|
*/
|
|
786
|
-
|
|
787
|
-
return this.
|
|
550
|
+
createBy(current) {
|
|
551
|
+
return new MonthPeriod(current, this._showWeekends);
|
|
788
552
|
}
|
|
789
553
|
}
|
|
554
|
+
MonthPeriod.DISPLAY_DATE_COUNT = 6 * 7;
|
|
790
555
|
|
|
556
|
+
var DateDirection;
|
|
557
|
+
(function (DateDirection) {
|
|
558
|
+
DateDirection["PREVIOUS"] = "-1";
|
|
559
|
+
DateDirection["NEXT"] = "1";
|
|
560
|
+
})(DateDirection || (DateDirection = {}));
|
|
791
561
|
/**
|
|
792
|
-
*
|
|
562
|
+
* get month name from the month number
|
|
563
|
+
*
|
|
564
|
+
* @param {Date} date the date object
|
|
565
|
+
* @param {boolean} isShortName short or long name
|
|
566
|
+
* @returns {string} the month English name
|
|
793
567
|
*/
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
* @inheritDoc
|
|
797
|
-
*/
|
|
798
|
-
generate(period) {
|
|
799
|
-
return new CalendarView([this.generateWeekHead()[period.current.toDate().getDay()]], [[period.current]]);
|
|
800
|
-
}
|
|
568
|
+
function getMonthName(date, isShortName = false) {
|
|
569
|
+
return date.toLocaleDateString('en-US', { month: isShortName ? 'short' : 'long' });
|
|
801
570
|
}
|
|
802
|
-
|
|
803
571
|
/**
|
|
804
|
-
*
|
|
572
|
+
* The function `getTimeIndex` calculates the index of a given time string based on a specified time unit.
|
|
573
|
+
*
|
|
574
|
+
* @param {string} timeString - A string representing a time in the format "HH:MM", where HH is the hour and MM is the minutes.
|
|
575
|
+
* @param {number} [unit=15] - The `unit` parameter in the `getTimeIndex` function is used to specify
|
|
576
|
+
* the interval in minutes for dividing the day. By default, it is set to 15 minutes, meaning that the
|
|
577
|
+
* day will be divided into 15-minute intervals.
|
|
578
|
+
* @returns {number} the index of the given time string based on the specified time unit.
|
|
805
579
|
*/
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
580
|
+
function getTimeIndex(timeString, unit = 15) {
|
|
581
|
+
const [hour, minutes] = timeString.split(':');
|
|
582
|
+
return Math.round((Number(hour) * 60 + Number(minutes)) / unit);
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Returns a string that includes the event key for a calendar event slot.
|
|
586
|
+
*
|
|
587
|
+
* @param {string} eventKey - represents the key or identifier of a calendar event.
|
|
588
|
+
* @returns {string} a string that is a concatenation of 'vega-calendar-event-slot-' and the eventKey parameter.
|
|
589
|
+
*/
|
|
590
|
+
function getCalendarEventSlotName(eventKey) {
|
|
591
|
+
return 'vega-calendar-event-slot-' + eventKey;
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Returns the closest workday to a given calendar date based on a specified direction.
|
|
595
|
+
*
|
|
596
|
+
* @param {Date} date - The starting date from which you want to find the closest workday.
|
|
597
|
+
* @param {'-1' | '1'} [direction=1] - Determines whether to find the closest workday in the past or future. It can have two possible values:
|
|
598
|
+
* @returns {Date} The closest workday to the input date
|
|
599
|
+
*/
|
|
600
|
+
function getClosestWorkday(date, direction = DateDirection.NEXT) {
|
|
601
|
+
const day = date.toDate().getDay();
|
|
602
|
+
if (day === 0 || day === 6) {
|
|
603
|
+
let nextWorkdayGap = day === 0 ? 1 : 2;
|
|
604
|
+
if (direction === DateDirection.PREVIOUS) {
|
|
605
|
+
nextWorkdayGap = day === 0 ? -2 : -1;
|
|
606
|
+
}
|
|
607
|
+
return CalendarDate.from(new Date(date.year, date.month - 1, date.date + nextWorkdayGap));
|
|
608
|
+
}
|
|
609
|
+
return date;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
const ellipsisVertical = {
|
|
613
|
+
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>`,
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
var __decorate$n = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
617
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
618
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
619
|
+
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;
|
|
620
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
621
|
+
};
|
|
622
|
+
/** The `VegaCalendarSwitchPanelRenderer` class in TypeScript React renders a calendar switch panel with date navigation, view selection, and action buttons. */
|
|
623
|
+
class VegaCalendarSwitchPanelRenderer extends VegaSlimmer {
|
|
624
|
+
constructor() {
|
|
625
|
+
super(...arguments);
|
|
626
|
+
/**
|
|
627
|
+
* This function is responsible for updating the `viewMode` property of the `VegaCalendarSwitchPanelRenderer` class with the value extracted from the `input` parameter.
|
|
628
|
+
*
|
|
629
|
+
* @param {NotifyObserverPayload<VegaCalendarViewModeType>} input mark which view should be selected
|
|
630
|
+
*/
|
|
631
|
+
this.handleViewChange = (input) => {
|
|
632
|
+
this.currentPeriodController.updateCalendarPeriod(input.detail, this.currentPeriod.current);
|
|
633
|
+
};
|
|
634
|
+
/**
|
|
635
|
+
* reset view content to today
|
|
636
|
+
*/
|
|
637
|
+
this.todayButtonClick = () => {
|
|
638
|
+
this.currentPeriodController.setCurrentPeriod(this.currentPeriod.now());
|
|
639
|
+
};
|
|
640
|
+
/**
|
|
641
|
+
* update view content after click next button
|
|
642
|
+
*/
|
|
643
|
+
this.nextButtonClick = () => {
|
|
644
|
+
this.currentPeriodController.setCurrentPeriod(this.currentPeriod.next());
|
|
645
|
+
};
|
|
646
|
+
/**
|
|
647
|
+
* update view content after click previous button
|
|
648
|
+
*/
|
|
649
|
+
this.prevButtonClick = () => {
|
|
650
|
+
this.currentPeriodController.setCurrentPeriod(this.currentPeriod.previous());
|
|
651
|
+
};
|
|
652
|
+
/**
|
|
653
|
+
* The more action menu item click
|
|
654
|
+
*
|
|
655
|
+
* @param {NotifyObserverPayload<string>} payload The object contains the menu item key
|
|
656
|
+
*/
|
|
657
|
+
this.moreActionMenuClick = (payload) => {
|
|
658
|
+
this.moreActionClickEmitter.emit(payload.detail);
|
|
659
|
+
};
|
|
811
660
|
}
|
|
812
661
|
/**
|
|
813
|
-
*
|
|
662
|
+
* get the switch panel container element
|
|
814
663
|
*
|
|
815
|
-
* @
|
|
816
|
-
* @returns {CalendarDate} - Return a CalendarDate object
|
|
664
|
+
* @returns {HTMLElement} container element
|
|
817
665
|
*/
|
|
818
|
-
|
|
819
|
-
return
|
|
666
|
+
getSwitchPanelRef() {
|
|
667
|
+
return this.switchPanelRef;
|
|
820
668
|
}
|
|
821
669
|
/**
|
|
822
|
-
*
|
|
670
|
+
* calendar switch panel with date switch, view switch, add new button, and more action components.
|
|
823
671
|
*
|
|
824
|
-
* @
|
|
672
|
+
* @returns {HTMLElement} html element
|
|
825
673
|
*/
|
|
826
|
-
|
|
827
|
-
return this.
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
674
|
+
render() {
|
|
675
|
+
return (h("vega-flex", { direction: "row", gap: "size-16", justifyContent: "space-between", alignItems: "center", class: "calendar-switch-panel", ref: (node) => (this.switchPanelRef = node) },
|
|
676
|
+
this.renderDateSwitch(),
|
|
677
|
+
h("div", { class: "calendar-view-switch-container" },
|
|
678
|
+
this.renderViewSwitch(),
|
|
679
|
+
this.renderMoreActionMenu())));
|
|
831
680
|
}
|
|
832
681
|
/**
|
|
833
|
-
* The
|
|
682
|
+
* The `renderDateSwitch` function returns a container with buttons for switching dates and displaying the current date.
|
|
834
683
|
*
|
|
835
|
-
* @
|
|
684
|
+
* @returns {HTMLDivElement} action button elements container.
|
|
836
685
|
*/
|
|
837
|
-
|
|
838
|
-
return
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
686
|
+
renderDateSwitch() {
|
|
687
|
+
return (h("div", { class: "calendar-date-switch-container" },
|
|
688
|
+
h("vega-button", { variant: "secondary", size: "small", ref: (button) => {
|
|
689
|
+
DomNodeSubjectObserverFactory.addUniqueObserverToNode(button, VegaClick, this.todayButtonClick);
|
|
690
|
+
}, label: this.translationSlimmer.t('Today') }),
|
|
691
|
+
h("vega-button-circle", { variant: "secondary", size: "small", icon: VegaInternalIconManager.getIconKey('chevron-left'), label: "previous", showTooltip: false, ref: (button) => {
|
|
692
|
+
DomNodeSubjectObserverFactory.addUniqueObserverToNode(button, VegaClick, this.prevButtonClick);
|
|
693
|
+
} }),
|
|
694
|
+
h("vega-button-circle", { variant: "secondary", size: "small", icon: VegaInternalIconManager.getIconKey('chevron-right'), label: "next", showTooltip: false, ref: (button) => {
|
|
695
|
+
DomNodeSubjectObserverFactory.addUniqueObserverToNode(button, VegaClick, this.nextButtonClick);
|
|
696
|
+
} }),
|
|
697
|
+
this.renderCurrentPeriod()));
|
|
842
698
|
}
|
|
843
699
|
/**
|
|
844
|
-
* The
|
|
700
|
+
* The function `renderCurrentPeriod` returns an HTML element displaying the view date content summary info.
|
|
845
701
|
*
|
|
846
|
-
* @
|
|
702
|
+
* @returns {HTMLVegaFontElement} The text content inside the element is "Current Date Test".
|
|
847
703
|
*/
|
|
848
|
-
|
|
849
|
-
return this.
|
|
850
|
-
}
|
|
851
|
-
set date(value) {
|
|
852
|
-
this._date = value;
|
|
704
|
+
renderCurrentPeriod() {
|
|
705
|
+
return (h("vega-font", { class: "calendar-current-date", variant: "font-field-label", color: "text-primary" }, this.getViewDateSummary()));
|
|
853
706
|
}
|
|
854
707
|
/**
|
|
855
|
-
*
|
|
708
|
+
* The function `renderViewSwitch` returns a JSX element for rendering a segment control component in a TypeScript React application.
|
|
856
709
|
*
|
|
857
|
-
* @returns {
|
|
710
|
+
* @returns {HTMLElement} An HTMLElement containing a vega-segment-control element with specific attributes and event handling.
|
|
858
711
|
*/
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
today.getDate() === this.date);
|
|
712
|
+
renderViewSwitch() {
|
|
713
|
+
return (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) => {
|
|
714
|
+
DomNodeSubjectObserverFactory.addUniqueObserverToNode(node, VegaChange, this.handleViewChange);
|
|
715
|
+
} }));
|
|
864
716
|
}
|
|
865
717
|
/**
|
|
866
|
-
*
|
|
718
|
+
* Render an more action button if dropdown source is not empty
|
|
867
719
|
*
|
|
868
|
-
* @returns {
|
|
720
|
+
* @returns {Nullable<HTMLElement>} the additional element
|
|
869
721
|
*/
|
|
870
|
-
|
|
871
|
-
|
|
722
|
+
renderMoreActionMenu() {
|
|
723
|
+
var _a, _b;
|
|
724
|
+
if ((_b = (_a = this.moreActionDropdownProps) === null || _a === void 0 ? void 0 : _a.source) === null || _b === void 0 ? void 0 : _b.length) {
|
|
725
|
+
return (h("vega-dropdown", Object.assign({ alignment: "end", trigger: "click" }, this.moreActionDropdownProps, { ref: (node) => {
|
|
726
|
+
DomNodeSubjectObserverFactory.addUniqueObserverToNode(node, VegaDropdownClick, this.moreActionMenuClick);
|
|
727
|
+
} }),
|
|
728
|
+
h("vega-button-circle", { size: "small", icon: VegaInternalIconManager.getIconKey('ellipsis-vertical'), variant: "icon-only" })));
|
|
729
|
+
}
|
|
872
730
|
}
|
|
873
731
|
/**
|
|
874
|
-
*
|
|
732
|
+
* Get the view content date summary info, such as `January, 2024` or `10 January, 2024` or `28 December, 2023 - 3 January, 2024`
|
|
875
733
|
*
|
|
876
|
-
* @
|
|
877
|
-
* @returns {DateCompareResult} - Return a DateCompareResult object
|
|
734
|
+
* @returns {string} string
|
|
878
735
|
*/
|
|
879
|
-
|
|
880
|
-
const
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
if (this.month < month) {
|
|
888
|
-
result.isPreviousMonth = true;
|
|
736
|
+
getViewDateSummary() {
|
|
737
|
+
const currentDate = this.currentPeriod.current;
|
|
738
|
+
let result = '';
|
|
739
|
+
switch (this.viewMode) {
|
|
740
|
+
case 'day': {
|
|
741
|
+
const monthName = this.translationSlimmer.t(getMonthName(currentDate.toDate()));
|
|
742
|
+
result = `${currentDate.date} ${monthName}, ${currentDate.year}`;
|
|
743
|
+
break;
|
|
889
744
|
}
|
|
890
|
-
|
|
891
|
-
|
|
745
|
+
case 'week': {
|
|
746
|
+
const weekItems = this.calendarView.dateItems[0];
|
|
747
|
+
const start = weekItems[0];
|
|
748
|
+
const end = weekItems[weekItems.length - 1];
|
|
749
|
+
const [startMonthName, endMonthName] = [start, end].map((item) => this.translationSlimmer.t(getMonthName(item.toDate())));
|
|
750
|
+
result = `${start.date} ${startMonthName}${start.year === end.year ? '' : ', ' + start.year} - ${end.date} ${endMonthName}, ${end.year}`;
|
|
751
|
+
break;
|
|
892
752
|
}
|
|
893
|
-
|
|
894
|
-
|
|
753
|
+
case 'month': {
|
|
754
|
+
const monthName = this.translationSlimmer.t(getMonthName(currentDate.toDate()));
|
|
755
|
+
result = `${monthName}, ${currentDate.year}`;
|
|
756
|
+
break;
|
|
895
757
|
}
|
|
896
758
|
}
|
|
897
|
-
else if (this.year > year) {
|
|
898
|
-
result.isNextMonth = true;
|
|
899
|
-
}
|
|
900
|
-
else {
|
|
901
|
-
result.isPreviousMonth = true;
|
|
902
|
-
}
|
|
903
759
|
return result;
|
|
904
760
|
}
|
|
761
|
+
}
|
|
762
|
+
(() => {
|
|
763
|
+
VegaInternalIconManager.register({
|
|
764
|
+
'chevron-right': chevronRight,
|
|
765
|
+
'chevron-left': chevronLeft,
|
|
766
|
+
'ellipsis-vertical': ellipsisVertical,
|
|
767
|
+
});
|
|
768
|
+
})();
|
|
769
|
+
VegaCalendarSwitchPanelRenderer.views = [
|
|
770
|
+
{ text: 'Day', key: 'day' },
|
|
771
|
+
{ text: 'Week', key: 'week' },
|
|
772
|
+
{ text: 'Month', key: 'month' },
|
|
773
|
+
];
|
|
774
|
+
__decorate$n([
|
|
775
|
+
MapToComponentField()
|
|
776
|
+
], VegaCalendarSwitchPanelRenderer.prototype, "viewMode", void 0);
|
|
777
|
+
__decorate$n([
|
|
778
|
+
MapToComponentField()
|
|
779
|
+
], VegaCalendarSwitchPanelRenderer.prototype, "calendarView", void 0);
|
|
780
|
+
__decorate$n([
|
|
781
|
+
MapToComponentField()
|
|
782
|
+
], VegaCalendarSwitchPanelRenderer.prototype, "currentPeriod", void 0);
|
|
783
|
+
__decorate$n([
|
|
784
|
+
MapToComponentField()
|
|
785
|
+
], VegaCalendarSwitchPanelRenderer.prototype, "moreActionDropdownProps", void 0);
|
|
786
|
+
__decorate$n([
|
|
787
|
+
MapToComponentField()
|
|
788
|
+
], VegaCalendarSwitchPanelRenderer.prototype, "moreActionClickEmitter", void 0);
|
|
789
|
+
__decorate$n([
|
|
790
|
+
MapToComponentField()
|
|
791
|
+
], VegaCalendarSwitchPanelRenderer.prototype, "currentPeriodController", void 0);
|
|
792
|
+
__decorate$n([
|
|
793
|
+
MapToComponentField()
|
|
794
|
+
], VegaCalendarSwitchPanelRenderer.prototype, "calendarViewController", void 0);
|
|
795
|
+
__decorate$n([
|
|
796
|
+
MapToComponentField()
|
|
797
|
+
], VegaCalendarSwitchPanelRenderer.prototype, "translationSlimmer", void 0);
|
|
798
|
+
|
|
799
|
+
var __decorate$m = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
800
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
801
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
802
|
+
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;
|
|
803
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
804
|
+
};
|
|
805
|
+
/** renders different views based on the specified view mode using month, week, and day view render. */
|
|
806
|
+
class VegaCalendarViewRenderer extends VegaSlimmer {
|
|
905
807
|
/**
|
|
906
|
-
*
|
|
808
|
+
* render the calendar month/week/day view
|
|
907
809
|
*
|
|
908
|
-
* @
|
|
909
|
-
* `CalendarDate` object passed as a parameter. The method returns `true` if all three values (year, month, date) are equal
|
|
910
|
-
* @returns {boolean} The date is same day with current
|
|
810
|
+
* @returns {HTMLElement} html element
|
|
911
811
|
*/
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
812
|
+
render() {
|
|
813
|
+
return (h("div", { class: `calendar-view calendar-view-${this.viewMode} ${this.showWeekends === false ? 'calendar-hide-weekends' : ''}` }, this.viewMode === 'month'
|
|
814
|
+
? this.monthViewRenderer.render()
|
|
815
|
+
: this.viewWithTimeRenderer.render()));
|
|
915
816
|
}
|
|
916
817
|
}
|
|
818
|
+
__decorate$m([
|
|
819
|
+
MapToComponentField()
|
|
820
|
+
], VegaCalendarViewRenderer.prototype, "viewMode", void 0);
|
|
821
|
+
__decorate$m([
|
|
822
|
+
MapToComponentField()
|
|
823
|
+
], VegaCalendarViewRenderer.prototype, "showWeekends", void 0);
|
|
824
|
+
__decorate$m([
|
|
825
|
+
MapToComponentField()
|
|
826
|
+
], VegaCalendarViewRenderer.prototype, "monthViewRenderer", void 0);
|
|
827
|
+
__decorate$m([
|
|
828
|
+
MapToComponentField()
|
|
829
|
+
], VegaCalendarViewRenderer.prototype, "viewWithTimeRenderer", void 0);
|
|
917
830
|
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
831
|
+
var __decorate$l = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
832
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
833
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
834
|
+
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;
|
|
835
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
836
|
+
};
|
|
837
|
+
/** 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. */
|
|
838
|
+
class VegaCalendarMonthViewRenderer extends VegaSlimmer {
|
|
922
839
|
/**
|
|
923
|
-
*
|
|
840
|
+
* the HTML elements that represent the month view of a calendar component.
|
|
841
|
+
*
|
|
842
|
+
* @returns {HTMLElement} the month view calendar content
|
|
924
843
|
*/
|
|
925
|
-
|
|
926
|
-
const
|
|
927
|
-
return
|
|
844
|
+
render() {
|
|
845
|
+
const weekHead = this.calendarView.weekdays;
|
|
846
|
+
return (h("div", { class: "calendar-view-month-container" },
|
|
847
|
+
h("div", { class: "calendar-view-row calendar-view-title border-divider-bottom" }, weekHead.map((title) => (h("div", { key: title }, this.translationSlimmer.t(title))))),
|
|
848
|
+
this.renderMonthViewContent()));
|
|
928
849
|
}
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
/**
|
|
932
|
-
* Calendar month view generator
|
|
933
|
-
*/
|
|
934
|
-
class MonthViewGenerator extends CalendarViewGenerator {
|
|
935
850
|
/**
|
|
936
|
-
*
|
|
851
|
+
* generating the HTML elements that represent the content of the month view in a calendar component
|
|
852
|
+
*
|
|
853
|
+
* @returns {HTMLElement[]} month view content and event content
|
|
937
854
|
*/
|
|
938
|
-
|
|
939
|
-
const
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
855
|
+
renderMonthViewContent() {
|
|
856
|
+
const monthSource = this.calendarView.dateItems;
|
|
857
|
+
const currentDate = this.currentPeriod.current;
|
|
858
|
+
return monthSource.map((dateArray, index) => {
|
|
859
|
+
const eventsArray = this.monthEventRenderer.getCurrentRowEvents(dateArray);
|
|
860
|
+
const displayEventsArray = this.monthEventRenderer.filterRowDisplayEvents(eventsArray);
|
|
861
|
+
return (h("div", { key: index, class: "calendar-view-row border-divider-bottom" }, dateArray.map((item, itemIndex) => {
|
|
862
|
+
return (h("div", { class: {
|
|
863
|
+
'row-cell border-divider-right': true,
|
|
864
|
+
'current-month-day': item.compare(currentDate).inMonth,
|
|
865
|
+
'active': item.isToday(),
|
|
866
|
+
'disabled': false,
|
|
867
|
+
}, key: `${item.month}-${item.date}`,
|
|
868
|
+
// eslint-disable-next-line react/jsx-no-bind
|
|
869
|
+
onDblClick: (e) => this.handleDateBlockClick(e, item) },
|
|
870
|
+
this.renderDateBlock(item),
|
|
871
|
+
this.monthEventRenderer.render(item, eventsArray[itemIndex], displayEventsArray[itemIndex], itemIndex)));
|
|
872
|
+
})));
|
|
948
873
|
});
|
|
949
|
-
return new CalendarView(this.generateWeekHead(), calendarDates);
|
|
950
874
|
}
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
875
|
+
/**
|
|
876
|
+
* It takes a `CalendarDate` object as a parameter and returns an HTML element representing a date block in the calendar view.
|
|
877
|
+
*
|
|
878
|
+
* @param {CalendarDate} item the day object
|
|
879
|
+
* @returns {HTMLElement} the date block element
|
|
880
|
+
*/
|
|
881
|
+
renderDateBlock(item) {
|
|
882
|
+
const isMonthFirstDay = item.date === 1;
|
|
883
|
+
return (h("div", { class: "date" },
|
|
884
|
+
isMonthFirstDay && h("div", { class: "month-block" }, getMonthName(item.toDate(), true)),
|
|
885
|
+
h("div", { role: "button", tabIndex: 0, class: "grid-col",
|
|
886
|
+
// eslint-disable-next-line react/jsx-no-bind
|
|
887
|
+
onDblClick: (e) => this.goToCurrentDayView(e, item) }, item.date)));
|
|
961
888
|
}
|
|
962
889
|
/**
|
|
963
|
-
*
|
|
890
|
+
* switch to current date day view
|
|
964
891
|
*
|
|
965
|
-
* @
|
|
892
|
+
* @param {MouseEvent} e the double click event object
|
|
893
|
+
* @param {CalendarDate} calendarDate the calendar date object
|
|
966
894
|
*/
|
|
967
|
-
|
|
968
|
-
|
|
895
|
+
goToCurrentDayView(e, calendarDate) {
|
|
896
|
+
e.stopPropagation();
|
|
897
|
+
this.currentPeriodController.updateCalendarPeriod('day', calendarDate);
|
|
969
898
|
}
|
|
970
899
|
/**
|
|
971
|
-
*
|
|
900
|
+
* emit vega click event when click the date block
|
|
972
901
|
*
|
|
973
|
-
* @
|
|
902
|
+
* @param {MouseEvent} e the mouse event object
|
|
903
|
+
* @param {CalendarDate} calendarDate the calendar date object
|
|
974
904
|
*/
|
|
975
|
-
|
|
976
|
-
|
|
905
|
+
handleDateBlockClick(e, calendarDate) {
|
|
906
|
+
const { target, clientX, clientY } = e;
|
|
907
|
+
if (this.isMonthBlockBlankArea(target)) {
|
|
908
|
+
const { year, month, date } = calendarDate;
|
|
909
|
+
this.dateDblClickEmitter.emit({
|
|
910
|
+
year,
|
|
911
|
+
month,
|
|
912
|
+
date,
|
|
913
|
+
hour: 0,
|
|
914
|
+
mouseEventInfo: { clientX, clientY },
|
|
915
|
+
});
|
|
916
|
+
}
|
|
977
917
|
}
|
|
978
918
|
/**
|
|
979
|
-
*
|
|
919
|
+
* determine if the clicked element is blank area
|
|
980
920
|
*
|
|
981
|
-
* @
|
|
921
|
+
* @param {HTMLElement} element the target element
|
|
922
|
+
* @returns {boolean} true or false
|
|
982
923
|
*/
|
|
983
|
-
|
|
984
|
-
|
|
924
|
+
isMonthBlockBlankArea(element) {
|
|
925
|
+
// the more button and the calendar event component should not trigger dateDblClick event
|
|
926
|
+
return !element.classList.contains('more-button') && element.tagName !== 'VEGA-CALENDAR-EVENT';
|
|
985
927
|
}
|
|
928
|
+
}
|
|
929
|
+
__decorate$l([
|
|
930
|
+
MapToComponentField()
|
|
931
|
+
], VegaCalendarMonthViewRenderer.prototype, "viewMode", void 0);
|
|
932
|
+
__decorate$l([
|
|
933
|
+
MapToComponentField()
|
|
934
|
+
], VegaCalendarMonthViewRenderer.prototype, "calendarView", void 0);
|
|
935
|
+
__decorate$l([
|
|
936
|
+
MapToComponentField()
|
|
937
|
+
], VegaCalendarMonthViewRenderer.prototype, "currentPeriod", void 0);
|
|
938
|
+
__decorate$l([
|
|
939
|
+
MapToComponentField()
|
|
940
|
+
], VegaCalendarMonthViewRenderer.prototype, "currentPeriodController", void 0);
|
|
941
|
+
__decorate$l([
|
|
942
|
+
MapToComponentField()
|
|
943
|
+
], VegaCalendarMonthViewRenderer.prototype, "monthEventRenderer", void 0);
|
|
944
|
+
__decorate$l([
|
|
945
|
+
MapToComponentField()
|
|
946
|
+
], VegaCalendarMonthViewRenderer.prototype, "dateDblClickEmitter", void 0);
|
|
947
|
+
__decorate$l([
|
|
948
|
+
MapToComponentField()
|
|
949
|
+
], VegaCalendarMonthViewRenderer.prototype, "translationSlimmer", void 0);
|
|
950
|
+
|
|
951
|
+
var __decorate$k = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
952
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
953
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
954
|
+
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;
|
|
955
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
956
|
+
};
|
|
957
|
+
/** The `VegaCalendarViewWithTimeRenderer` class in TypeScript React renders a day view for a calendar component with title, content, and hour blocks. */
|
|
958
|
+
class VegaCalendarViewWithTimeRenderer extends VegaSlimmer {
|
|
986
959
|
/**
|
|
987
|
-
* The
|
|
960
|
+
* The render function in TypeScript React returns an array of HTMLElements containing the week calendar view for a specific day.
|
|
988
961
|
*
|
|
989
|
-
* @
|
|
962
|
+
* @returns {HTMLElement} An array of HTMLElement elements containing the rendered content of a calendar view for a
|
|
963
|
+
* specific day in the week. The content includes the title and the main content of the calendar view
|
|
964
|
+
* for that day.
|
|
990
965
|
*/
|
|
991
|
-
|
|
992
|
-
return
|
|
966
|
+
render() {
|
|
967
|
+
return (h("div", { class: "calendar-view-container" },
|
|
968
|
+
this.renderViewTitle(),
|
|
969
|
+
this.renderViewContent()));
|
|
993
970
|
}
|
|
994
971
|
/**
|
|
995
|
-
*
|
|
972
|
+
* The function `renderViewTitle` renders a calendar view title and events based on the provided source data.
|
|
996
973
|
*
|
|
997
|
-
* @
|
|
974
|
+
* @returns {HTMLElement} The `renderViewTitle` function returns an HTML element (HTMLElement) that contains a calendar view title container with rows for each day's information.
|
|
998
975
|
*/
|
|
999
|
-
|
|
1000
|
-
|
|
976
|
+
renderViewTitle() {
|
|
977
|
+
const source = this.calendarView.dateItems[0];
|
|
978
|
+
const weekHead = this.calendarView.weekdays;
|
|
979
|
+
return (h("div", { class: "calendar-view-title-container" },
|
|
980
|
+
h("div", { class: "calendar-view-row" },
|
|
981
|
+
h("div", { class: "time-line-empty" }),
|
|
982
|
+
h("div", { class: "calendar-view-title" }, source.map((item, index) => (h("div", { key: item.date, class: { active: item.isToday() } },
|
|
983
|
+
h("div", null, this.translationSlimmer.t(weekHead[index])),
|
|
984
|
+
h("div", { class: "week-day" }, item.date)))))),
|
|
985
|
+
h("div", { class: "calendar-view-row calendar-view-event-all-container border-divider-bottom" },
|
|
986
|
+
h("div", { class: "time-line-all" }, this.translationSlimmer.t('All Day')),
|
|
987
|
+
this.dayViewFullDayEventRenderer.render())));
|
|
1001
988
|
}
|
|
1002
989
|
/**
|
|
1003
|
-
*
|
|
990
|
+
* The `renderViewContent` function in TypeScript React renders a calendar view with day blocks and time markers based on the provided data.
|
|
1004
991
|
*
|
|
1005
|
-
* @
|
|
1006
|
-
* @returns {this} - The current period.
|
|
992
|
+
* @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.
|
|
1007
993
|
*/
|
|
1008
|
-
|
|
1009
|
-
|
|
994
|
+
renderViewContent() {
|
|
995
|
+
const source = this.calendarView.dateItems[0];
|
|
996
|
+
return (h("div", { class: "calendar-view-row calendar-view-day-container" },
|
|
997
|
+
this.timeLineRenderer.render(),
|
|
998
|
+
h("div", { class: "calendar-view-content-container" },
|
|
999
|
+
h("div", { class: "calendar-view-content" }, source.map((item) => {
|
|
1000
|
+
return (h("div", { class: "grid-col border-divider-left", key: item.date },
|
|
1001
|
+
h("div", { class: "hour-empty border-divider-top" }),
|
|
1002
|
+
this.renderHourBlock(item)));
|
|
1003
|
+
})),
|
|
1004
|
+
this.dayViewTimedEventRenderer.render(),
|
|
1005
|
+
this.timeLineRenderer.renderTimeMarker(source))));
|
|
1010
1006
|
}
|
|
1011
1007
|
/**
|
|
1012
|
-
*
|
|
1008
|
+
* The function `renderHourBlock` returns an array of HTML elements representing hour blocks with time information.
|
|
1013
1009
|
*
|
|
1014
|
-
* @
|
|
1010
|
+
* @param {CalendarDate} calendarDate then current calendar date object
|
|
1011
|
+
* @returns {HTMLElement[]} An array of HTMLElements is being returned. Each HTMLElement represents an hour block with a time value inside a div element.
|
|
1015
1012
|
*/
|
|
1016
|
-
|
|
1017
|
-
|
|
1013
|
+
renderHourBlock(calendarDate) {
|
|
1014
|
+
const timeLineSource = Array(24).fill('');
|
|
1015
|
+
return timeLineSource.map((_item, index) => {
|
|
1016
|
+
return (h("div", { class: "grid-cell border-divider-top",
|
|
1017
|
+
// eslint-disable-next-line react/jsx-no-bind
|
|
1018
|
+
onDblClick: (e) => {
|
|
1019
|
+
this.handleDateBlockClick(calendarDate, index, e);
|
|
1020
|
+
} }));
|
|
1021
|
+
});
|
|
1018
1022
|
}
|
|
1019
1023
|
/**
|
|
1020
|
-
*
|
|
1024
|
+
* emit vega click event when click the date block
|
|
1021
1025
|
*
|
|
1022
|
-
* @param {CalendarDate}
|
|
1026
|
+
* @param {CalendarDate} calendarDate the calendar date object
|
|
1023
1027
|
*/
|
|
1024
|
-
|
|
1025
|
-
const
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
}
|
|
1029
|
-
this._startDate = CalendarDate.from(cursor);
|
|
1030
|
-
cursor.setDate(cursor.getDate() + this.count - 1);
|
|
1031
|
-
this._endDate = CalendarDate.from(cursor);
|
|
1028
|
+
handleDateBlockClick(calendarDate, hour, e) {
|
|
1029
|
+
const { year, month, date } = calendarDate;
|
|
1030
|
+
const { clientX, clientY } = e;
|
|
1031
|
+
this.dateDblClickEmitter.emit({ year, month, date, hour, mouseEventInfo: { clientX, clientY } });
|
|
1032
1032
|
}
|
|
1033
1033
|
}
|
|
1034
|
+
__decorate$k([
|
|
1035
|
+
MapToComponentField()
|
|
1036
|
+
], VegaCalendarViewWithTimeRenderer.prototype, "viewMode", void 0);
|
|
1037
|
+
__decorate$k([
|
|
1038
|
+
MapToComponentField()
|
|
1039
|
+
], VegaCalendarViewWithTimeRenderer.prototype, "timeLineRenderer", void 0);
|
|
1040
|
+
__decorate$k([
|
|
1041
|
+
MapToComponentField()
|
|
1042
|
+
], VegaCalendarViewWithTimeRenderer.prototype, "dayViewTimedEventRenderer", void 0);
|
|
1043
|
+
__decorate$k([
|
|
1044
|
+
MapToComponentField()
|
|
1045
|
+
], VegaCalendarViewWithTimeRenderer.prototype, "dayViewFullDayEventRenderer", void 0);
|
|
1046
|
+
__decorate$k([
|
|
1047
|
+
MapToComponentField()
|
|
1048
|
+
], VegaCalendarViewWithTimeRenderer.prototype, "calendarView", void 0);
|
|
1049
|
+
__decorate$k([
|
|
1050
|
+
MapToComponentField()
|
|
1051
|
+
], VegaCalendarViewWithTimeRenderer.prototype, "dateDblClickEmitter", void 0);
|
|
1052
|
+
__decorate$k([
|
|
1053
|
+
MapToComponentField()
|
|
1054
|
+
], VegaCalendarViewWithTimeRenderer.prototype, "translationSlimmer", void 0);
|
|
1034
1055
|
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1056
|
+
var __decorate$j = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1057
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1058
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1059
|
+
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;
|
|
1060
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1061
|
+
};
|
|
1062
|
+
/** 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. */
|
|
1063
|
+
class VegaCalendarTimeLineRenderer extends VegaSlimmer {
|
|
1043
1064
|
/**
|
|
1044
|
-
*
|
|
1065
|
+
* takes an array of `CalendarDate` objects as input and returns an HTML element
|
|
1066
|
+
*
|
|
1067
|
+
* @param {CalendarDate[]} source
|
|
1068
|
+
* @returns {HTMLElement} the html element
|
|
1045
1069
|
*/
|
|
1046
|
-
|
|
1047
|
-
const
|
|
1048
|
-
|
|
1049
|
-
|
|
1070
|
+
renderTimeMarker(source) {
|
|
1071
|
+
const isVisible = source.findIndex((calendarDate) => calendarDate.isToday()) >= 0;
|
|
1072
|
+
return (h("div", { class: {
|
|
1073
|
+
'time-marker-container': true,
|
|
1074
|
+
'hidden': !isVisible,
|
|
1075
|
+
} },
|
|
1076
|
+
h("div", { class: "time-marker", style: { top: this.getTimeMarkerPosition() }, ref: (div) => (this.timeMarkerRef = div) }, source.map((item) => {
|
|
1077
|
+
return h("div", { key: item.date, class: { active: item.isToday() } });
|
|
1078
|
+
}))));
|
|
1050
1079
|
}
|
|
1051
1080
|
/**
|
|
1052
|
-
*
|
|
1081
|
+
* rendering the time line component as an HTML element
|
|
1082
|
+
*
|
|
1083
|
+
* @returns {HTMLElement} the html element
|
|
1053
1084
|
*/
|
|
1054
|
-
|
|
1055
|
-
const
|
|
1056
|
-
|
|
1057
|
-
|
|
1085
|
+
render() {
|
|
1086
|
+
const timeLineSource = this.getTimeLineTitles();
|
|
1087
|
+
return (h("div", { class: "time-line", ref: (div) => (this.timeLineRef = div) },
|
|
1088
|
+
h("div", { class: "hour-empty" }),
|
|
1089
|
+
timeLineSource.map((time, index) => {
|
|
1090
|
+
return (h("div", { key: time },
|
|
1091
|
+
h("div", { class: "time-text", "data-time": index === 0 ? 24 : index }, time)));
|
|
1092
|
+
})));
|
|
1058
1093
|
}
|
|
1059
1094
|
/**
|
|
1060
|
-
*
|
|
1095
|
+
* scroll to current time line block if change view mode to week or day
|
|
1096
|
+
*
|
|
1097
|
+
* @param {VegaCalendarViewModeType} viewMode the view mode
|
|
1061
1098
|
*/
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
}
|
|
1066
|
-
DayPeriod.DISPLAY_DATE_COUNT = 1;
|
|
1067
|
-
|
|
1068
|
-
/**
|
|
1069
|
-
* Period of the week
|
|
1070
|
-
*/
|
|
1071
|
-
class WeekPeriod extends CalendarPeriod {
|
|
1072
|
-
constructor(current) {
|
|
1073
|
-
super(WeekPeriod.DISPLAY_DATE_COUNT, current);
|
|
1074
|
-
this._type = 'week';
|
|
1099
|
+
updateTimeLine(viewMode) {
|
|
1100
|
+
this.scrollToTargetTimeBlock(viewMode);
|
|
1101
|
+
this.syncTimeMarkerPosition(viewMode);
|
|
1075
1102
|
}
|
|
1076
1103
|
/**
|
|
1077
|
-
*
|
|
1104
|
+
* remove setInterval when component destroy
|
|
1078
1105
|
*/
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
nextWeekStartDate.setDate(nextWeekStartDate.getDate() - getWeekdays().indexOf(nextWeekStartDate.getDay()) + 7);
|
|
1082
|
-
return this.createBy(CalendarDate.from(nextWeekStartDate));
|
|
1106
|
+
clearTimer() {
|
|
1107
|
+
clearInterval(this.timeMarkerPositionTimer);
|
|
1083
1108
|
}
|
|
1084
1109
|
/**
|
|
1085
|
-
*
|
|
1110
|
+
* Add the time mark position update logic if the component add back to page
|
|
1086
1111
|
*/
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
previousWeekStartDate.setDate(previousWeekStartDate.getDate() - getWeekdays().indexOf(previousWeekStartDate.getDay()) - 7);
|
|
1090
|
-
return this.createBy(CalendarDate.from(previousWeekStartDate));
|
|
1112
|
+
updateTimeLineIfComponentAddBack() {
|
|
1113
|
+
this.syncTimeMarkerPosition(this.viewMode);
|
|
1091
1114
|
}
|
|
1092
1115
|
/**
|
|
1093
|
-
*
|
|
1116
|
+
* Should display the current time block in the view if the default view mode is not month
|
|
1094
1117
|
*/
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
WeekPeriod.DISPLAY_DATE_COUNT = 7;
|
|
1100
|
-
|
|
1101
|
-
/**
|
|
1102
|
-
* Period of month
|
|
1103
|
-
*/
|
|
1104
|
-
class MonthPeriod extends CalendarPeriod {
|
|
1105
|
-
constructor(current) {
|
|
1106
|
-
super(MonthPeriod.DISPLAY_DATE_COUNT, MonthPeriod.getMonthFirstDay(current));
|
|
1107
|
-
this._type = 'month';
|
|
1118
|
+
displayCurrentTimeBlockByDefault() {
|
|
1119
|
+
this.scrollToTargetTimeBlock(this.viewMode);
|
|
1108
1120
|
}
|
|
1109
1121
|
/**
|
|
1110
|
-
* The function `
|
|
1122
|
+
* The function `getTimeMarkerPosition` calculates the position of the current time marker as a percentage of the day.
|
|
1111
1123
|
*
|
|
1112
|
-
* @
|
|
1113
|
-
* type `CalendarDate`. It represents a specific date in the calendar. If a `calendarDate` is
|
|
1114
|
-
* provided, the function will use that date to determine the first day of the month. If no
|
|
1115
|
-
* `calendarDate` is provided, the function
|
|
1116
|
-
* @returns {CalendarDate} A new `CalendarDate` object representing the first day of the month from the provided
|
|
1117
|
-
* `calendarDate` parameter or the current date if no parameter is provided.
|
|
1124
|
+
* @returns {string} a string representing the current time marker position as a percentage of the day.
|
|
1118
1125
|
*/
|
|
1119
|
-
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1126
|
+
getTimeMarkerPosition() {
|
|
1127
|
+
const now = new Date();
|
|
1128
|
+
const minutesOneDay = 24 * 60;
|
|
1129
|
+
return ((now.getHours() * 60 + now.getMinutes()) / minutesOneDay) * 100 + '%';
|
|
1122
1130
|
}
|
|
1123
1131
|
/**
|
|
1124
|
-
*
|
|
1132
|
+
* The function `getTimeLineTitles` generates a time line array based on the specified time format (24-hour) and stores it in the `timeLineSource` property.
|
|
1133
|
+
*
|
|
1134
|
+
* @returns {string[]} returns an array of strings representing the time line
|
|
1125
1135
|
*/
|
|
1126
|
-
|
|
1127
|
-
const
|
|
1128
|
-
|
|
1129
|
-
|
|
1136
|
+
getTimeLineTitles() {
|
|
1137
|
+
const timeLine = [];
|
|
1138
|
+
if (this.timeFormat === '12-hour') {
|
|
1139
|
+
timeLine.push('12 AM');
|
|
1140
|
+
for (let i = 1; i < 12; i++) {
|
|
1141
|
+
timeLine.push(`${i} AM`);
|
|
1142
|
+
}
|
|
1143
|
+
timeLine.push('12 PM');
|
|
1144
|
+
for (let i = 1; i < 12; i++) {
|
|
1145
|
+
timeLine.push(`${i} PM`);
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
else {
|
|
1149
|
+
for (let i = 0; i < 24; i++) {
|
|
1150
|
+
timeLine.push(`${pad(i)}`);
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
return timeLine;
|
|
1130
1154
|
}
|
|
1155
|
+
/*
|
|
1156
|
+
* The below method is e2e-test covered in
|
|
1157
|
+
* @see{module:vega-calendar-scroll-to-current-time}
|
|
1158
|
+
*/
|
|
1159
|
+
/* istanbul ignore next */
|
|
1131
1160
|
/**
|
|
1132
|
-
*
|
|
1161
|
+
* Update the time marker position with the time
|
|
1162
|
+
*
|
|
1163
|
+
* @param {VegaCalendarViewModeType} viewMode view mode value
|
|
1133
1164
|
*/
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1165
|
+
syncTimeMarkerPosition(viewMode) {
|
|
1166
|
+
clearInterval(this.timeMarkerPositionTimer);
|
|
1167
|
+
if (viewMode !== 'month') {
|
|
1168
|
+
this.timeMarkerPositionTimer = setInterval(() => {
|
|
1169
|
+
if (this.timeMarkerRef) {
|
|
1170
|
+
this.timeMarkerRef.style.top = this.getTimeMarkerPosition();
|
|
1171
|
+
}
|
|
1172
|
+
}, 60 * 1000);
|
|
1173
|
+
}
|
|
1138
1174
|
}
|
|
1175
|
+
/*
|
|
1176
|
+
* The below method is e2e-test covered in
|
|
1177
|
+
* @see{module:vega-calendar-scroll-to-current-time}
|
|
1178
|
+
*/
|
|
1179
|
+
/* istanbul ignore next */
|
|
1139
1180
|
/**
|
|
1140
|
-
*
|
|
1181
|
+
* scroll the time line in to current view
|
|
1182
|
+
*
|
|
1183
|
+
* @param {VegaCalendarViewModeType} viewMode view mode value
|
|
1141
1184
|
*/
|
|
1142
|
-
|
|
1143
|
-
|
|
1185
|
+
scrollToTargetTimeBlock(viewMode) {
|
|
1186
|
+
if (viewMode !== 'month') {
|
|
1187
|
+
// add setTimeout here to make sure call the scroll into view after time line rendered.
|
|
1188
|
+
const oneFrame = 16;
|
|
1189
|
+
setTimeout(() => {
|
|
1190
|
+
var _a, _b;
|
|
1191
|
+
const hour = new Date().getHours();
|
|
1192
|
+
(_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' });
|
|
1193
|
+
}, oneFrame);
|
|
1194
|
+
}
|
|
1144
1195
|
}
|
|
1145
1196
|
}
|
|
1146
|
-
|
|
1197
|
+
__decorate$j([
|
|
1198
|
+
MapToComponentField()
|
|
1199
|
+
], VegaCalendarTimeLineRenderer.prototype, "timeFormat", void 0);
|
|
1200
|
+
__decorate$j([
|
|
1201
|
+
MapToComponentField()
|
|
1202
|
+
], VegaCalendarTimeLineRenderer.prototype, "viewMode", void 0);
|
|
1203
|
+
__decorate$j([
|
|
1204
|
+
MapToComponentMethod('watchViewModeChange')
|
|
1205
|
+
], VegaCalendarTimeLineRenderer.prototype, "updateTimeLine", null);
|
|
1206
|
+
__decorate$j([
|
|
1207
|
+
MapToComponentMethod('disconnectedCallback')
|
|
1208
|
+
], VegaCalendarTimeLineRenderer.prototype, "clearTimer", null);
|
|
1209
|
+
__decorate$j([
|
|
1210
|
+
MapToComponentMethod('connectedCallback')
|
|
1211
|
+
], VegaCalendarTimeLineRenderer.prototype, "updateTimeLineIfComponentAddBack", null);
|
|
1212
|
+
__decorate$j([
|
|
1213
|
+
MapToComponentMethod('componentDidLoad')
|
|
1214
|
+
], VegaCalendarTimeLineRenderer.prototype, "displayCurrentTimeBlockByDefault", null);
|
|
1147
1215
|
|
|
1148
1216
|
var __decorate$i = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1149
1217
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1204,6 +1272,9 @@ __decorate$i([
|
|
|
1204
1272
|
__decorate$i([
|
|
1205
1273
|
MapToComponentField()
|
|
1206
1274
|
], VegaCalendarViewController.prototype, "currentPeriod", void 0);
|
|
1275
|
+
__decorate$i([
|
|
1276
|
+
MapToComponentField()
|
|
1277
|
+
], VegaCalendarViewController.prototype, "showWeekends", void 0);
|
|
1207
1278
|
__decorate$i([
|
|
1208
1279
|
MapToComponentField()
|
|
1209
1280
|
], VegaCalendarViewController.prototype, "currentPeriodController", void 0);
|
|
@@ -1239,13 +1310,14 @@ class VegaCalendarCurrentPeriodController extends VegaSlimmer {
|
|
|
1239
1310
|
updateCalendarPeriod(viewMode, date) {
|
|
1240
1311
|
switch (viewMode) {
|
|
1241
1312
|
case 'month':
|
|
1242
|
-
this.setCurrentPeriod(new MonthPeriod(date));
|
|
1313
|
+
this.setCurrentPeriod(new MonthPeriod(date, this.showWeekends));
|
|
1243
1314
|
break;
|
|
1244
1315
|
case 'week':
|
|
1245
|
-
this.setCurrentPeriod(new WeekPeriod(date));
|
|
1316
|
+
this.setCurrentPeriod(new WeekPeriod(date, this.showWeekends));
|
|
1246
1317
|
break;
|
|
1247
1318
|
case 'day':
|
|
1248
|
-
this.
|
|
1319
|
+
date = this.showWeekends === false ? getClosestWorkday(date) : date;
|
|
1320
|
+
this.setCurrentPeriod(new DayPeriod(date, this.showWeekends));
|
|
1249
1321
|
break;
|
|
1250
1322
|
}
|
|
1251
1323
|
}
|
|
@@ -1287,6 +1359,12 @@ class VegaCalendarCurrentPeriodController extends VegaSlimmer {
|
|
|
1287
1359
|
this.updateCalendarPeriod(viewMode, this.currentPeriod.current);
|
|
1288
1360
|
}
|
|
1289
1361
|
}
|
|
1362
|
+
/**
|
|
1363
|
+
* The calendar period should update when the property showWeekends change
|
|
1364
|
+
*/
|
|
1365
|
+
updateCurrentPeriodAfterHideWeekEndsChange() {
|
|
1366
|
+
this.updateCalendarPeriod(this.viewMode, this.currentPeriod.current);
|
|
1367
|
+
}
|
|
1290
1368
|
/**
|
|
1291
1369
|
* The function `getStartDateAndEndDate` returns an array of `VegaCalendarDateType` objects based on the `startDate` and `endDate` properties of the `currentPeriod` object.
|
|
1292
1370
|
*
|
|
@@ -1320,6 +1398,9 @@ __decorate$h([
|
|
|
1320
1398
|
__decorate$h([
|
|
1321
1399
|
MapToComponentField({ writable: true })
|
|
1322
1400
|
], VegaCalendarCurrentPeriodController.prototype, "viewMode", void 0);
|
|
1401
|
+
__decorate$h([
|
|
1402
|
+
MapToComponentField()
|
|
1403
|
+
], VegaCalendarCurrentPeriodController.prototype, "showWeekends", void 0);
|
|
1323
1404
|
__decorate$h([
|
|
1324
1405
|
MapToComponentMethod('componentWillLoad')
|
|
1325
1406
|
], VegaCalendarCurrentPeriodController.prototype, "initialCurrentPeriod", null);
|
|
@@ -1329,6 +1410,9 @@ __decorate$h([
|
|
|
1329
1410
|
__decorate$h([
|
|
1330
1411
|
MapToComponentMethod('watchViewModeChange')
|
|
1331
1412
|
], VegaCalendarCurrentPeriodController.prototype, "updateCurrentPeriodByViewMode", null);
|
|
1413
|
+
__decorate$h([
|
|
1414
|
+
MapToComponentMethod('watchShowWeekendsChange')
|
|
1415
|
+
], VegaCalendarCurrentPeriodController.prototype, "updateCurrentPeriodAfterHideWeekEndsChange", null);
|
|
1332
1416
|
|
|
1333
1417
|
var __decorate$g = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1334
1418
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1473,7 +1557,9 @@ class VegaCalendarMonthEventRenderer extends VegaSlimmer {
|
|
|
1473
1557
|
}
|
|
1474
1558
|
if (removeItems.length) {
|
|
1475
1559
|
rowEvents.forEach((items) => {
|
|
1476
|
-
if (items.length &&
|
|
1560
|
+
if (items.length &&
|
|
1561
|
+
items[items.length - 1] &&
|
|
1562
|
+
removeItems.includes(items[items.length - 1])) {
|
|
1477
1563
|
result.push(items.slice(0, items.length - 1));
|
|
1478
1564
|
}
|
|
1479
1565
|
else {
|
|
@@ -2524,7 +2610,7 @@ class VegaCalendarEventResponsiveController extends PageResizeObserverSlimmer {
|
|
|
2524
2610
|
// 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
|
|
2525
2611
|
try {
|
|
2526
2612
|
const eventContainerRef = this.monthEventRenderer.getMonthEventContainerRef();
|
|
2527
|
-
if (this.viewMode === 'month' && eventContainerRef) {
|
|
2613
|
+
if (this.viewMode === 'month' && eventContainerRef && eventContainerRef.parentElement) {
|
|
2528
2614
|
const maxContainerHeight = eventContainerRef.parentElement.getBoundingClientRect().height;
|
|
2529
2615
|
const count = Math.floor((maxContainerHeight - VegaCalendarEventResponsiveController.monthDateTitleHeight) /
|
|
2530
2616
|
VegaCalendarEventItemRenderer.backgroundColorModeEventHeight);
|
|
@@ -2709,7 +2795,7 @@ class VegaCalendarDayViewEventLayoutRenderer extends VegaSlimmer {
|
|
|
2709
2795
|
top: `${(100 / VegaCalendarDayViewEventLayoutRenderer.totalNumberOfCells) * startIndex}%`,
|
|
2710
2796
|
width: `calc(100% - ${left * 100}%)`,
|
|
2711
2797
|
height: `${(100 / VegaCalendarDayViewEventLayoutRenderer.totalNumberOfCells) * (endIndex - startIndex)}%`,
|
|
2712
|
-
zIndex: columnIndex > 0 ? `${columnIndex}` :
|
|
2798
|
+
zIndex: columnIndex > 0 ? `${columnIndex}` : undefined,
|
|
2713
2799
|
};
|
|
2714
2800
|
}
|
|
2715
2801
|
}
|
|
@@ -3144,7 +3230,7 @@ class VegaCalendarFullDayEventLayoutGenerator extends VegaCalendarBaseEventLayou
|
|
|
3144
3230
|
*/
|
|
3145
3231
|
generate(calendarEvents) {
|
|
3146
3232
|
const allShouldOrderLongEvents = this.collectAllShouldOrderLongEvents(calendarEvents);
|
|
3147
|
-
const layoutRows = [
|
|
3233
|
+
const layoutRows = [this.createNewLayoutCell()];
|
|
3148
3234
|
allShouldOrderLongEvents.forEach((eventView) => {
|
|
3149
3235
|
this.addCurrentEventToLayout(layoutRows, eventView);
|
|
3150
3236
|
});
|
|
@@ -3353,7 +3439,7 @@ __decorate$8([
|
|
|
3353
3439
|
MapToComponentMethod('watchViewModeChange')
|
|
3354
3440
|
], VegaCalendarFullDayEventMoreButtonRenderer.prototype, "resetShowAllFlag", null);
|
|
3355
3441
|
|
|
3356
|
-
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}";
|
|
3442
|
+
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}";
|
|
3357
3443
|
|
|
3358
3444
|
var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
3359
3445
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -3425,6 +3511,12 @@ const VegaCalendar = class {
|
|
|
3425
3511
|
* @vegaVersion 2.21.0
|
|
3426
3512
|
*/
|
|
3427
3513
|
this.showEventColorBar = true;
|
|
3514
|
+
/**
|
|
3515
|
+
* Controls the visibility of the weekend columns in the calendar.
|
|
3516
|
+
*
|
|
3517
|
+
* @vegaVersion 2.28.0
|
|
3518
|
+
*/
|
|
3519
|
+
this.showWeekends = true;
|
|
3428
3520
|
}
|
|
3429
3521
|
/**
|
|
3430
3522
|
* Tracks changes to the current period state.
|
|
@@ -3462,6 +3554,11 @@ const VegaCalendar = class {
|
|
|
3462
3554
|
*/
|
|
3463
3555
|
watchShowEventColorBar(newValue) {
|
|
3464
3556
|
}
|
|
3557
|
+
/**
|
|
3558
|
+
* Monitors changes in the visibility of the weekend columns in the calendar.
|
|
3559
|
+
*/
|
|
3560
|
+
watchShowWeekendsChange() {
|
|
3561
|
+
}
|
|
3465
3562
|
render() {
|
|
3466
3563
|
return sanitizeVegaComponent(h(Host, null, this.renderer.render()), this.host);
|
|
3467
3564
|
}
|
|
@@ -3471,7 +3568,8 @@ const VegaCalendar = class {
|
|
|
3471
3568
|
"viewMode": ["watchViewModeChange"],
|
|
3472
3569
|
"events": ["watchEventsChange"],
|
|
3473
3570
|
"timeFormat": ["watchTimeFormat"],
|
|
3474
|
-
"showEventColorBar": ["watchShowEventColorBar"]
|
|
3571
|
+
"showEventColorBar": ["watchShowEventColorBar"],
|
|
3572
|
+
"showWeekends": ["watchShowWeekendsChange"]
|
|
3475
3573
|
}; }
|
|
3476
3574
|
};
|
|
3477
3575
|
__decorate$7([
|
|
@@ -3630,13 +3728,14 @@ class VegaCalendarEventRenderer extends VegaSlimmer {
|
|
|
3630
3728
|
* @returns {HTMLAnchorElement} event element
|
|
3631
3729
|
*/
|
|
3632
3730
|
renderNormalEvent() {
|
|
3633
|
-
const { variant
|
|
3731
|
+
const { variant, disabled } = this.calendarEvent;
|
|
3732
|
+
const variantText = variant || 'primary';
|
|
3634
3733
|
const isMonthEvent = !this.host.classList.contains('day-event');
|
|
3635
3734
|
const classMap = {
|
|
3636
3735
|
'slot-container': this.slotMode,
|
|
3637
3736
|
'event-container': true,
|
|
3638
3737
|
'disabled': disabled,
|
|
3639
|
-
[
|
|
3738
|
+
[variantText]: true,
|
|
3640
3739
|
};
|
|
3641
3740
|
if (isMonthEvent) {
|
|
3642
3741
|
return (h("div", { role: "button", tabIndex: 0, class: classMap, ref: (node) => (this.slotContainerRef = node) },
|