@forcecalendar/interface 1.0.51 → 1.0.52
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 +28 -15
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +8 -8
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/renderers/BaseViewRenderer.js +22 -0
- package/src/renderers/DayViewRenderer.js +1 -0
- package/src/renderers/WeekViewRenderer.js +1 -0
package/package.json
CHANGED
|
@@ -18,6 +18,7 @@ export class BaseViewRenderer {
|
|
|
18
18
|
this.stateManager = stateManager;
|
|
19
19
|
this._listeners = [];
|
|
20
20
|
this._scrolled = false;
|
|
21
|
+
this._nowIndicatorTimer = null;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -36,6 +37,10 @@ export class BaseViewRenderer {
|
|
|
36
37
|
element.removeEventListener(event, handler);
|
|
37
38
|
});
|
|
38
39
|
this._listeners = [];
|
|
40
|
+
if (this._nowIndicatorTimer) {
|
|
41
|
+
clearInterval(this._nowIndicatorTimer);
|
|
42
|
+
this._nowIndicatorTimer = null;
|
|
43
|
+
}
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
/**
|
|
@@ -137,6 +142,23 @@ export class BaseViewRenderer {
|
|
|
137
142
|
return `<div class="fc-now-indicator" style="position: absolute; left: 0; right: 0; top: ${minutes}px; height: 2px; background: var(--fc-danger-color); z-index: 15; pointer-events: none;"></div>`;
|
|
138
143
|
}
|
|
139
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Start a timer that updates the now indicator position every 60 seconds.
|
|
147
|
+
* Call this after render() in day/week views that show a now indicator.
|
|
148
|
+
*/
|
|
149
|
+
startNowIndicatorTimer() {
|
|
150
|
+
if (this._nowIndicatorTimer) {
|
|
151
|
+
clearInterval(this._nowIndicatorTimer);
|
|
152
|
+
}
|
|
153
|
+
this._nowIndicatorTimer = setInterval(() => {
|
|
154
|
+
const indicator = this.container.querySelector('.fc-now-indicator');
|
|
155
|
+
if (indicator) {
|
|
156
|
+
const now = new Date();
|
|
157
|
+
indicator.style.top = `${now.getHours() * 60 + now.getMinutes()}px`;
|
|
158
|
+
}
|
|
159
|
+
}, 60000);
|
|
160
|
+
}
|
|
161
|
+
|
|
140
162
|
/**
|
|
141
163
|
* Compute overlap layout columns for a list of timed events.
|
|
142
164
|
* Returns a Map of event.id -> { column, totalColumns }.
|