@forcecalendar/interface 1.0.37 → 1.0.39
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/force-calendar-interface.esm.js +20 -23
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +7 -7
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ForceCalendar.js +2 -1
- package/src/renderers/DayViewRenderer.js +6 -5
- package/src/renderers/WeekViewRenderer.js +6 -5
package/package.json
CHANGED
|
@@ -854,10 +854,11 @@ export class ForceCalendar extends BaseComponent {
|
|
|
854
854
|
switch (view) {
|
|
855
855
|
case 'month':
|
|
856
856
|
return DateUtils.formatDate(date, 'month', locale);
|
|
857
|
-
case 'week':
|
|
857
|
+
case 'week': {
|
|
858
858
|
const weekStart = DateUtils.startOfWeek(date);
|
|
859
859
|
const weekEnd = DateUtils.endOfWeek(date);
|
|
860
860
|
return DateUtils.formatDateRange(weekStart, weekEnd, locale);
|
|
861
|
+
}
|
|
861
862
|
case 'day':
|
|
862
863
|
return DateUtils.formatDate(date, 'long', locale);
|
|
863
864
|
default:
|
|
@@ -180,14 +180,15 @@ export class DayViewRenderer extends BaseViewRenderer {
|
|
|
180
180
|
if (e.target.closest('.fc-event')) return;
|
|
181
181
|
|
|
182
182
|
const date = new Date(dayEl.dataset.date);
|
|
183
|
-
const rect = dayEl.getBoundingClientRect();
|
|
184
183
|
const scrollContainer = this.container.querySelector('#day-scroll-container');
|
|
185
|
-
const
|
|
184
|
+
const gridTop = dayEl.offsetTop;
|
|
185
|
+
const y = e.clientY - dayEl.getBoundingClientRect().top + (scrollContainer ? scrollContainer.scrollTop : 0) - gridTop;
|
|
186
186
|
|
|
187
|
-
// Calculate time from click position
|
|
187
|
+
// Calculate time from click position within the 1440px time grid
|
|
188
|
+
const clampedY = Math.max(0, Math.min(y + gridTop, this.totalHeight));
|
|
188
189
|
date.setHours(
|
|
189
|
-
Math.floor(
|
|
190
|
-
Math.floor((
|
|
190
|
+
Math.floor(clampedY / this.hourHeight),
|
|
191
|
+
Math.floor((clampedY % this.hourHeight) / (this.hourHeight / 60)),
|
|
191
192
|
0,
|
|
192
193
|
0
|
|
193
194
|
);
|
|
@@ -159,14 +159,15 @@ export class WeekViewRenderer extends BaseViewRenderer {
|
|
|
159
159
|
if (e.target.closest('.fc-event')) return;
|
|
160
160
|
|
|
161
161
|
const date = new Date(dayEl.dataset.date);
|
|
162
|
-
const rect = dayEl.getBoundingClientRect();
|
|
163
162
|
const scrollContainer = this.container.querySelector('#week-scroll-container');
|
|
164
|
-
const
|
|
163
|
+
const gridTop = dayEl.offsetTop;
|
|
164
|
+
const y = e.clientY - dayEl.getBoundingClientRect().top + (scrollContainer ? scrollContainer.scrollTop : 0) - gridTop;
|
|
165
165
|
|
|
166
|
-
// Calculate time from click position
|
|
166
|
+
// Calculate time from click position within the 1440px time grid
|
|
167
|
+
const clampedY = Math.max(0, Math.min(y + gridTop, this.totalHeight));
|
|
167
168
|
date.setHours(
|
|
168
|
-
Math.floor(
|
|
169
|
-
Math.floor((
|
|
169
|
+
Math.floor(clampedY / this.hourHeight),
|
|
170
|
+
Math.floor((clampedY % this.hourHeight) / (this.hourHeight / 60)),
|
|
170
171
|
0,
|
|
171
172
|
0
|
|
172
173
|
);
|