@luckydye/calendar 1.2.1 → 1.2.3
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/calendar.js +198 -210
- package/package.json +1 -1
- package/src/CalDAVConfig.ts +17 -2
- package/src/CalendarView.ts +17 -25
- package/src/InhouseBookingSource.ts +5 -1
- package/src/app.ts +1 -0
package/dist/calendar.js
CHANGED
|
@@ -1613,8 +1613,8 @@ function ds(n, t) {
|
|
|
1613
1613
|
if (F(t.byweekno, -1))
|
|
1614
1614
|
C = -1;
|
|
1615
1615
|
else {
|
|
1616
|
-
var H = Gt(Wt(n - 1, 1, 1)), M = lt(7 - H.valueOf() + t.wkst, 7),
|
|
1617
|
-
M >= 4 ? (M = 0, $ =
|
|
1616
|
+
var H = Gt(Wt(n - 1, 1, 1)), M = lt(7 - H.valueOf() + t.wkst, 7), E = oe(n - 1) ? 366 : 365, $ = void 0;
|
|
1617
|
+
M >= 4 ? (M = 0, $ = E + lt(H - t.wkst, 7)) : $ = i - d, C = Math.floor(52 + lt($, 7) / 4);
|
|
1618
1618
|
}
|
|
1619
1619
|
if (F(t.byweekno, C))
|
|
1620
1620
|
for (var p = 0; p < d; p++)
|
|
@@ -1839,8 +1839,8 @@ function nn(n, t) {
|
|
|
1839
1839
|
for (var y = f; y < v; y++) {
|
|
1840
1840
|
var M = u[y];
|
|
1841
1841
|
if (V(M))
|
|
1842
|
-
for (var
|
|
1843
|
-
var w = d[$], C = Qi(
|
|
1842
|
+
for (var E = Ji(c.yearordinal + M), $ = 0; $ < d.length; $++) {
|
|
1843
|
+
var w = d[$], C = Qi(E, w);
|
|
1844
1844
|
if (r && C > r)
|
|
1845
1845
|
return xt(n);
|
|
1846
1846
|
if (C >= e) {
|
|
@@ -2236,9 +2236,9 @@ const As = [
|
|
|
2236
2236
|
{ label: "2 hours before", value: 120 },
|
|
2237
2237
|
{ label: "1 day before", value: 1440 }
|
|
2238
2238
|
], Os = 12, _s = 12, Hs = 96;
|
|
2239
|
-
class
|
|
2239
|
+
class N {
|
|
2240
2240
|
constructor(t) {
|
|
2241
|
-
this.startDate = /* @__PURE__ */ new Date(), this.endDate =
|
|
2241
|
+
this.startDate = /* @__PURE__ */ new Date(), this.endDate = N.addDays(/* @__PURE__ */ new Date(), 182), this.weekStart = 0, this.filter = "", this.calendarEvents = /* @__PURE__ */ new Map(), this.selectedEvents = /* @__PURE__ */ new Set(), this.enabledCalendars = /* @__PURE__ */ new Set(), this.lockedCalendars = /* @__PURE__ */ new Set(), this.sync = (i, s, r) => {
|
|
2242
2242
|
const o = [];
|
|
2243
2243
|
for (const l of r) {
|
|
2244
2244
|
const c = {
|
|
@@ -2254,7 +2254,7 @@ class U {
|
|
|
2254
2254
|
return this.storage?.sync(o, a).catch((l) => {
|
|
2255
2255
|
console.error("Failed to persist events:", l);
|
|
2256
2256
|
}), o;
|
|
2257
|
-
}, this.locale = t?.locale || navigator.language, this.weekStart = t?.weekStart ||
|
|
2257
|
+
}, this.locale = t?.locale || navigator.language, this.weekStart = t?.weekStart || N.getWeekStartFromLocale(this.locale), this.startDate = this.getStartOfWeek(N.addDays(/* @__PURE__ */ new Date(), -182));
|
|
2258
2258
|
const e = {
|
|
2259
2259
|
start: (i) => {
|
|
2260
2260
|
this.controller = i;
|
|
@@ -2421,10 +2421,10 @@ RRULE:${t.rrule}`, h = Fe(d), u = /* @__PURE__ */ new Date();
|
|
|
2421
2421
|
for (; s < e; ) {
|
|
2422
2422
|
const r = [];
|
|
2423
2423
|
for (let l = 0; l < 7; l++)
|
|
2424
|
-
r.push(new Date(s)), s =
|
|
2424
|
+
r.push(new Date(s)), s = N.addDays(s, 1);
|
|
2425
2425
|
const o = r[0], a = r[3];
|
|
2426
2426
|
o && a && i.push({
|
|
2427
|
-
weekNumber:
|
|
2427
|
+
weekNumber: N.getWeekNumber(o),
|
|
2428
2428
|
year: a.getFullYear(),
|
|
2429
2429
|
// Use Thursday for year
|
|
2430
2430
|
days: r,
|
|
@@ -2438,15 +2438,15 @@ RRULE:${t.rrule}`, h = Fe(d), u = /* @__PURE__ */ new Date();
|
|
|
2438
2438
|
extendRange(t) {
|
|
2439
2439
|
const e = _s, i = [];
|
|
2440
2440
|
if (t === "past") {
|
|
2441
|
-
const s =
|
|
2441
|
+
const s = N.addDays(this.startDate, -e * 7);
|
|
2442
2442
|
let r = new Date(s);
|
|
2443
2443
|
for (; r < this.startDate; ) {
|
|
2444
2444
|
const o = [];
|
|
2445
2445
|
for (let c = 0; c < 7; c++)
|
|
2446
|
-
o.push(new Date(r)), r =
|
|
2446
|
+
o.push(new Date(r)), r = N.addDays(r, 1);
|
|
2447
2447
|
const a = o[0], l = o[3];
|
|
2448
2448
|
a && l && i.push({
|
|
2449
|
-
weekNumber:
|
|
2449
|
+
weekNumber: N.getWeekNumber(a),
|
|
2450
2450
|
year: l.getFullYear(),
|
|
2451
2451
|
days: o,
|
|
2452
2452
|
yOffset: 0,
|
|
@@ -2455,15 +2455,15 @@ RRULE:${t.rrule}`, h = Fe(d), u = /* @__PURE__ */ new Date();
|
|
|
2455
2455
|
}
|
|
2456
2456
|
this.startDate = s;
|
|
2457
2457
|
} else {
|
|
2458
|
-
const s =
|
|
2458
|
+
const s = N.addDays(this.endDate, e * 7);
|
|
2459
2459
|
let r = new Date(this.endDate);
|
|
2460
2460
|
for (; r < s; ) {
|
|
2461
2461
|
const o = [];
|
|
2462
2462
|
for (let c = 0; c < 7; c++)
|
|
2463
|
-
o.push(new Date(r)), r =
|
|
2463
|
+
o.push(new Date(r)), r = N.addDays(r, 1);
|
|
2464
2464
|
const a = o[0], l = o[3];
|
|
2465
2465
|
a && l && i.push({
|
|
2466
|
-
weekNumber:
|
|
2466
|
+
weekNumber: N.getWeekNumber(a),
|
|
2467
2467
|
year: l.getFullYear(),
|
|
2468
2468
|
days: o,
|
|
2469
2469
|
yOffset: 0,
|
|
@@ -2481,12 +2481,12 @@ RRULE:${t.rrule}`, h = Fe(d), u = /* @__PURE__ */ new Date();
|
|
|
2481
2481
|
return Hs;
|
|
2482
2482
|
}
|
|
2483
2483
|
trimRange(t, e) {
|
|
2484
|
-
t === "past" ? this.startDate =
|
|
2484
|
+
t === "past" ? this.startDate = N.addDays(this.startDate, -e * 7) : this.endDate = N.addDays(this.endDate, -e * 7);
|
|
2485
2485
|
}
|
|
2486
2486
|
// Resets the range to be centered around the target date
|
|
2487
2487
|
resetRangeAroundDate(t) {
|
|
2488
2488
|
const e = new Date(t);
|
|
2489
|
-
return e.setHours(0, 0, 0, 0), this.startDate = this.getStartOfWeek(
|
|
2489
|
+
return e.setHours(0, 0, 0, 0), this.startDate = this.getStartOfWeek(N.addDays(e, -182)), this.endDate = N.addDays(e, 182), this.generateWeeks();
|
|
2490
2490
|
}
|
|
2491
2491
|
getWeekdayNames() {
|
|
2492
2492
|
const t = new Intl.DateTimeFormat(this.locale, { weekday: "short" }), e = [];
|
|
@@ -2521,7 +2521,7 @@ RRULE:${t.rrule}`, h = Fe(d), u = /* @__PURE__ */ new Date();
|
|
|
2521
2521
|
}
|
|
2522
2522
|
// Returns timestamp for end of day using pure math (no Date object creation)
|
|
2523
2523
|
static endOfDayTime(t) {
|
|
2524
|
-
return t ?
|
|
2524
|
+
return t ? N.startOfDayTime(t) + 864e5 - 1 : 0;
|
|
2525
2525
|
}
|
|
2526
2526
|
static getWeekStartFromLocale(t) {
|
|
2527
2527
|
const e = ["en-US", "en-CA", "ja-JP", "ko-KR", "zh-TW"], i = t.split("-")[0];
|
|
@@ -3012,15 +3012,15 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3012
3012
|
super(), this._dayHeight = Nt, this._scrollTop = 0, this.viewportHeight = 0, this.currentTime = /* @__PURE__ */ new Date(), this.selection = null, this.canvas = null, this.ctx = null, this.overlayCanvas = null, this.overlayCtx = null, this.minimapBufferCanvas = null, this.minimapBufferCtx = null, this.stripePatternCanvas = null, this.scrollContainer = null, this.scrollContent = null, this.resizeObserver = null, this.totalHeight = 0, this.isDraggingZoom = !1, this.zoomDragStartY = 0, this.zoomDragStartHeight = 0, this.zoomOriginY = 0, this.zoomViewportY = 0, this.isPanning = !1, this.panStartX = 0, this.panStartY = 0, this.panStartScrollTop = 0, this.isSelecting = !1, this.selectionStartX = 0, this.selectionStartY = 0, this.potentialSelectionStart = null, this.selectionModifierKey = !1, this.cursorPosition = null, this.animationFrame = null, this.isDraggingMinimap = !1, this.isFiltered = !1, this.timeUpdateInterval = null, this.isExtendingRange = !1, this.isCreatingEvent = !1, this.eventCreationStart = null, this.eventCreationEnd = null, this.eventCreationShiftPressed = !1, this.eventCreationPreviousShiftPressed = !1, this.eventCreationInitialDuration = null, this.movingEvent = null, this.movingEventOrigin = null, this.movingEventEnd = null, this.isDraggingEvent = !1, this.movingEventDuplicateMode = !1, this.movingEventMouseEvent = null, this.isDraggingFile = !1, this.resizingEvent = null, this.resizingEdge = null, this.resizingOriginalStart = null, this.resizingOriginalEnd = null, this.isResizingEvent = !1, this._columnsPerRow = 7, this.historyStack = [], this.historyIndex = 0, this.saveHistoryTimeout = null, this.weeks = [], this.events = [], this.eventRects = [], this.hoveredEventId = null, this.selectedEventForDetail = null, this.selectedEventRect = null, this.isDescriptionExpanded = !1, this.notificationPopoverOpen = !1, this.scheduledNotifications = [], this.updateEventTimeout = null, this.currentUserEmails = /* @__PURE__ */ new Set(), this.currentTheme = Ls(), this.activeCalendarColor = null, this.scrollToToday = (t = !0) => {
|
|
3013
3013
|
const e = /* @__PURE__ */ new Date();
|
|
3014
3014
|
let i = this.weeks.findIndex(
|
|
3015
|
-
(r) => r.days.some((o) =>
|
|
3015
|
+
(r) => r.days.some((o) => N.isSameDay(o, e))
|
|
3016
3016
|
);
|
|
3017
3017
|
i < 0 && (this.weeks = this.internal.resetRangeAroundDate(e), i = this.weeks.findIndex(
|
|
3018
|
-
(r) => r.days.some((o) =>
|
|
3018
|
+
(r) => r.days.some((o) => N.isSameDay(o, e))
|
|
3019
3019
|
));
|
|
3020
3020
|
let s = 0.5;
|
|
3021
3021
|
if (i >= 0) {
|
|
3022
3022
|
const o = this.weeks[i].days.findIndex(
|
|
3023
|
-
(a) =>
|
|
3023
|
+
(a) => N.isSameDay(a, e)
|
|
3024
3024
|
);
|
|
3025
3025
|
if (o >= 0) {
|
|
3026
3026
|
const a = Math.floor(o / this._columnsPerRow), l = (e.getHours() + e.getMinutes() / 60) / 24;
|
|
@@ -3257,7 +3257,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3257
3257
|
if (a && l) {
|
|
3258
3258
|
const c = l.getTime() - a.getTime(), d = (f) => {
|
|
3259
3259
|
const v = f.getMinutes();
|
|
3260
|
-
return f.setMinutes(Math.
|
|
3260
|
+
return f.setMinutes(Math.round(v / 15) * 15, 0, 0), f;
|
|
3261
3261
|
}, h = d(
|
|
3262
3262
|
new Date(this.movingEvent.start.getTime() + c)
|
|
3263
3263
|
), u = d(
|
|
@@ -3355,7 +3355,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3355
3355
|
}
|
|
3356
3356
|
const o = this.scrollContainer.clientHeight / 2, a = this.scrollTop + o, l = i / s, d = a * l - o;
|
|
3357
3357
|
this.setView(i, d);
|
|
3358
|
-
}, this.minimapCanvas = document.createElement("canvas"), this.internal = new
|
|
3358
|
+
}, this.minimapCanvas = document.createElement("canvas"), this.internal = new N({
|
|
3359
3359
|
locale: this.getAttribute("locale") || void 0,
|
|
3360
3360
|
weekStart: Number(this.getAttribute("week-start")),
|
|
3361
3361
|
storage: new zs()
|
|
@@ -3476,10 +3476,10 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3476
3476
|
scrollToDate(t, e = 0.5, i = !1, s = !1, r) {
|
|
3477
3477
|
const o = r ?? this._dayHeight;
|
|
3478
3478
|
let a = this.weeks.findIndex(
|
|
3479
|
-
(l) => l.days.some((c) =>
|
|
3479
|
+
(l) => l.days.some((c) => N.isSameDay(c, t)) || l.days[0] && l.days[6] && l.days[0] <= t && t <= l.days[6]
|
|
3480
3480
|
);
|
|
3481
3481
|
if (a < 0 && s && (this.weeks = this.internal.resetRangeAroundDate(t), a = this.weeks.findIndex(
|
|
3482
|
-
(l) => l.days.some((c) =>
|
|
3482
|
+
(l) => l.days.some((c) => N.isSameDay(c, t)) || l.days[0] && l.days[6] && l.days[0] <= t && t <= l.days[6]
|
|
3483
3483
|
)), a >= 0) {
|
|
3484
3484
|
const l = this._dayHeight;
|
|
3485
3485
|
this._dayHeight = o, this.updateWeekOffsets();
|
|
@@ -3559,8 +3559,8 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3559
3559
|
const e = this.dayHeight * this.rowsPerWeek;
|
|
3560
3560
|
if (this.filter) {
|
|
3561
3561
|
const s = this.events.map((r) => ({
|
|
3562
|
-
start:
|
|
3563
|
-
end:
|
|
3562
|
+
start: N.startOfDayTime(r.start),
|
|
3563
|
+
end: N.endOfDayTime(r.end)
|
|
3564
3564
|
}));
|
|
3565
3565
|
for (const r of this.weeks) {
|
|
3566
3566
|
r.yOffset = t;
|
|
@@ -3600,15 +3600,15 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3600
3600
|
), d = this.dayHeight >= 300;
|
|
3601
3601
|
for (const h of c) {
|
|
3602
3602
|
const u = h.days.findIndex(
|
|
3603
|
-
(f) =>
|
|
3603
|
+
(f) => N.isSameDay(f, l)
|
|
3604
3604
|
);
|
|
3605
3605
|
if (u >= 0) {
|
|
3606
3606
|
const { row: f, col: v } = this.getDayVisualPosition(u), g = z + v * a, p = h.yOffset + f * this.dayHeight - r, y = getComputedStyle(this).getPropertyValue("--bg-today").trim() || "rgba(255, 255, 255, 0.05)";
|
|
3607
3607
|
if (t.fillStyle = y, t.fillRect(g, p, a, this.dayHeight), d) {
|
|
3608
3608
|
const C = /* @__PURE__ */ new Date(), H = C.getHours() * 60 + C.getMinutes(), M = p + H / 1440 * this.dayHeight;
|
|
3609
3609
|
if (M >= 0 && M <= i) {
|
|
3610
|
-
const
|
|
3611
|
-
t.strokeStyle =
|
|
3610
|
+
const E = getComputedStyle(this).getPropertyValue("--accent-current-time").trim() || "rgba(255, 0, 0, 0.8)";
|
|
3611
|
+
t.strokeStyle = E, t.lineWidth = 1, t.beginPath(), t.moveTo(g, M), t.lineTo(g + a, M), t.stroke(), t.lineWidth = 1;
|
|
3612
3612
|
}
|
|
3613
3613
|
}
|
|
3614
3614
|
}
|
|
@@ -3625,13 +3625,13 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3625
3625
|
if (this.filter && h > 0) {
|
|
3626
3626
|
const w = c[h - 1];
|
|
3627
3627
|
if (!w) continue;
|
|
3628
|
-
const S = this.weeks.indexOf(w),
|
|
3629
|
-
if (
|
|
3630
|
-
const b = f,
|
|
3631
|
-
t.strokeStyle =
|
|
3628
|
+
const S = this.weeks.indexOf(w), O = this.weeks.indexOf(u) - S - 1;
|
|
3629
|
+
if (O > 0) {
|
|
3630
|
+
const b = f, x = getComputedStyle(this).getPropertyValue("--grid-color-strong").trim() || "rgba(255, 255, 255, 0.3)";
|
|
3631
|
+
t.strokeStyle = x, t.lineWidth = 1, t.setLineDash([4, 4]), t.beginPath(), t.moveTo(z, b), t.lineTo(e, b), t.stroke(), t.setLineDash([]);
|
|
3632
3632
|
const T = getComputedStyle(this).getPropertyValue("--text-muted").trim() || "rgba(255, 255, 255, 0.4)";
|
|
3633
3633
|
t.fillStyle = T, t.textAlign = "center";
|
|
3634
|
-
const D = `⋯ ${
|
|
3634
|
+
const D = `⋯ ${O} week${O > 1 ? "s" : ""}`, U = t.measureText(D).width, L = 8, P = (z + e) / 2 - U / 2 - L, B = b - 8, R = U + L * 2, W = 16, K = getComputedStyle(this).getPropertyValue("--bg-primary").trim() || "rgba(30, 30, 30, 0.9)";
|
|
3635
3635
|
t.fillStyle = K, t.beginPath(), t.roundRect(P, B, R, W, 8), t.fill(), t.fillStyle = T, t.fillText(D, (z + e) / 2, b + 4);
|
|
3636
3636
|
}
|
|
3637
3637
|
}
|
|
@@ -3655,28 +3655,28 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3655
3655
|
);
|
|
3656
3656
|
for (let w = 0; w < this.rowsPerWeek; w++) {
|
|
3657
3657
|
const S = f + w * this.dayHeight;
|
|
3658
|
-
for (let
|
|
3659
|
-
const
|
|
3660
|
-
if (
|
|
3661
|
-
const b = `${
|
|
3662
|
-
t.fillText(b, 48,
|
|
3658
|
+
for (let A = 0; A < 24; A++) {
|
|
3659
|
+
const O = S + A / 24 * this.dayHeight;
|
|
3660
|
+
if (O >= 0 && O <= i && (t.beginPath(), t.moveTo(z, O), t.lineTo(e, O), t.stroke(), v > 0.1)) {
|
|
3661
|
+
const b = `${A.toString().padStart(2, "0")}:00`;
|
|
3662
|
+
t.fillText(b, 48, O + 4);
|
|
3663
3663
|
}
|
|
3664
3664
|
}
|
|
3665
3665
|
}
|
|
3666
3666
|
if (v > 0.1) {
|
|
3667
3667
|
const w = /* @__PURE__ */ new Date(), S = u.days.findIndex(
|
|
3668
|
-
(
|
|
3668
|
+
(A) => N.isSameDay(A, w)
|
|
3669
3669
|
);
|
|
3670
3670
|
if (S >= 0) {
|
|
3671
|
-
const { row:
|
|
3671
|
+
const { row: A } = this.getDayVisualPosition(S), O = w.getHours() * 60 + w.getMinutes(), b = f + A * this.dayHeight + O / 1440 * this.dayHeight;
|
|
3672
3672
|
if (b >= 0 && b <= i) {
|
|
3673
|
-
const
|
|
3673
|
+
const x = w.getHours().toString().padStart(2, "0"), T = w.getMinutes().toString().padStart(2, "0"), D = `${x}:${T}`;
|
|
3674
3674
|
t.save(), t.textAlign = "right", t.textBaseline = "middle";
|
|
3675
|
-
const
|
|
3675
|
+
const U = t.measureText(D).width, L = 6, P = 48, B = b, R = getComputedStyle(this).getPropertyValue("--bg-elevated").trim() || "rgba(0, 0, 0, 0.7)";
|
|
3676
3676
|
t.fillStyle = R, t.beginPath(), t.roundRect(
|
|
3677
|
-
P -
|
|
3677
|
+
P - U - L,
|
|
3678
3678
|
B - 8,
|
|
3679
|
-
|
|
3679
|
+
U + L * 2,
|
|
3680
3680
|
16,
|
|
3681
3681
|
4
|
|
3682
3682
|
), t.fill(), t.fillStyle = getComputedStyle(this).getPropertyValue("--text-primary").trim() || "rgba(255, 255, 255, 1)", t.fillText(D, P, B), t.restore();
|
|
@@ -3691,11 +3691,11 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3691
3691
|
/[\d.]+\)$/,
|
|
3692
3692
|
`${0.4 * y})`
|
|
3693
3693
|
), t.textAlign = "center";
|
|
3694
|
-
const H = `W${u.weekNumber}`, M = f,
|
|
3694
|
+
const H = `W${u.weekNumber}`, M = f, E = f + u.height, $ = Math.max(
|
|
3695
3695
|
14,
|
|
3696
|
-
Math.min(M + u.height / 2 + 4,
|
|
3696
|
+
Math.min(M + u.height / 2 + 4, E - 4)
|
|
3697
3697
|
);
|
|
3698
|
-
$ >= Math.max(0, M + 4) && $ <= Math.min(i,
|
|
3698
|
+
$ >= Math.max(0, M + 4) && $ <= Math.min(i, E) && y > 0.1 && t.fillText(H, 30, $);
|
|
3699
3699
|
}
|
|
3700
3700
|
this.renderEventsOnCanvas(t, r, i, a, c), this.renderDateLabels(), this.renderWeekdayLabels(t, a, c, r, i), this.isCreatingEvent && this.renderEventCreationPreview(), this.isDraggingEvent && this.renderEventMovePreview(), this.renderMinimap();
|
|
3701
3701
|
}
|
|
@@ -3704,20 +3704,20 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3704
3704
|
if (this.eventRects = [], r.length === 0) return;
|
|
3705
3705
|
const d = r[0], h = r[r.length - 1], u = d.days[0], f = h.days[6], v = u.getTime(), g = f.getTime() + 864e5 - 1, p = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), C = [], H = [], M = [];
|
|
3706
3706
|
for (const b of o) {
|
|
3707
|
-
const
|
|
3708
|
-
if (T < v ||
|
|
3707
|
+
const x = b.start.getTime(), T = b.end.getTime();
|
|
3708
|
+
if (T < v || x > g)
|
|
3709
3709
|
continue;
|
|
3710
3710
|
const D = [];
|
|
3711
3711
|
for (const P of r) {
|
|
3712
3712
|
const B = P.days[0], R = P.days[6];
|
|
3713
3713
|
if (!B || !R) continue;
|
|
3714
3714
|
const W = B.getTime(), K = R.getTime() + 86399999;
|
|
3715
|
-
if (T >= W &&
|
|
3715
|
+
if (T >= W && x <= K) {
|
|
3716
3716
|
const J = this.weeks.indexOf(P);
|
|
3717
3717
|
D.push({ weekIndex: J, week: P });
|
|
3718
3718
|
}
|
|
3719
3719
|
}
|
|
3720
|
-
const
|
|
3720
|
+
const U = D.length, L = b.isAllDay === !0;
|
|
3721
3721
|
for (let P = 0; P < D.length; P++) {
|
|
3722
3722
|
const { weekIndex: B, week: R } = D[P], W = P === 0, K = P === D.length - 1;
|
|
3723
3723
|
let J = 0, wt = 6;
|
|
@@ -3733,16 +3733,16 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3733
3733
|
endDayIndex: wt,
|
|
3734
3734
|
isStart: W,
|
|
3735
3735
|
isEnd: K,
|
|
3736
|
-
totalWeeks:
|
|
3736
|
+
totalWeeks: U
|
|
3737
3737
|
};
|
|
3738
3738
|
L ? H.push(rt) : M.push(rt);
|
|
3739
3739
|
}
|
|
3740
3740
|
}
|
|
3741
|
-
const
|
|
3741
|
+
const E = c ? M.flatMap((b) => {
|
|
3742
3742
|
if (b.startDayIndex === b.endDayIndex) return [b];
|
|
3743
|
-
const
|
|
3743
|
+
const x = [];
|
|
3744
3744
|
for (let T = b.startDayIndex; T <= b.endDayIndex; T++)
|
|
3745
|
-
|
|
3745
|
+
x.push({
|
|
3746
3746
|
...b,
|
|
3747
3747
|
startDayIndex: T,
|
|
3748
3748
|
endDayIndex: T,
|
|
@@ -3750,30 +3750,30 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3750
3750
|
isEnd: T === b.endDayIndex && b.isEnd,
|
|
3751
3751
|
totalWeeks: 1
|
|
3752
3752
|
});
|
|
3753
|
-
return
|
|
3753
|
+
return x;
|
|
3754
3754
|
}) : M;
|
|
3755
|
-
C.push(...H, ...
|
|
3755
|
+
C.push(...H, ...E);
|
|
3756
3756
|
const $ = /* @__PURE__ */ new Map();
|
|
3757
3757
|
for (const b of C) {
|
|
3758
|
-
const
|
|
3759
|
-
if (c && !
|
|
3758
|
+
const x = b.event.isAllDay === !0;
|
|
3759
|
+
if (c && !x)
|
|
3760
3760
|
for (let T = b.startDayIndex; T <= b.endDayIndex; T++) {
|
|
3761
3761
|
const D = `${b.weekIndex}-${T}`;
|
|
3762
3762
|
$.has(D) || $.set(D, []), $.get(D).push(b);
|
|
3763
3763
|
}
|
|
3764
3764
|
}
|
|
3765
3765
|
const w = /* @__PURE__ */ new Map();
|
|
3766
|
-
for (const [b,
|
|
3767
|
-
const [T, D] = b.split("-"),
|
|
3768
|
-
for (const R of
|
|
3766
|
+
for (const [b, x] of $) {
|
|
3767
|
+
const [T, D] = b.split("-"), U = parseInt(D), L = parseInt(T), P = [];
|
|
3768
|
+
for (const R of x) {
|
|
3769
3769
|
const W = this.weeks[L];
|
|
3770
3770
|
if (!W) continue;
|
|
3771
|
-
const K = new Date(W.days[
|
|
3771
|
+
const K = new Date(W.days[U]).setHours(
|
|
3772
3772
|
0,
|
|
3773
3773
|
0,
|
|
3774
3774
|
0,
|
|
3775
3775
|
0
|
|
3776
|
-
), J = new Date(W.days[
|
|
3776
|
+
), J = new Date(W.days[U]).setHours(
|
|
3777
3777
|
23,
|
|
3778
3778
|
59,
|
|
3779
3779
|
59,
|
|
@@ -3788,32 +3788,32 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3788
3788
|
for (; W < B.length && !(B[W].endMinutes <= R.startMinutes); W++)
|
|
3789
3789
|
;
|
|
3790
3790
|
W === B.length ? B.push({ endMinutes: R.endMinutes }) : B[W].endMinutes = R.endMinutes;
|
|
3791
|
-
const K = `${R.segment.weekIndex}-${R.segment.event.id}-${
|
|
3791
|
+
const K = `${R.segment.weekIndex}-${R.segment.event.id}-${U}`;
|
|
3792
3792
|
w.set(K, {
|
|
3793
3793
|
column: W,
|
|
3794
3794
|
totalColumns: B.length
|
|
3795
3795
|
});
|
|
3796
3796
|
}
|
|
3797
3797
|
for (const R of P) {
|
|
3798
|
-
const W = `${R.segment.weekIndex}-${R.segment.event.id}-${
|
|
3798
|
+
const W = `${R.segment.weekIndex}-${R.segment.event.id}-${U}`, K = w.get(W);
|
|
3799
3799
|
K && (K.totalColumns = B.length);
|
|
3800
3800
|
}
|
|
3801
3801
|
}
|
|
3802
3802
|
for (const b of C) {
|
|
3803
3803
|
const {
|
|
3804
|
-
event:
|
|
3804
|
+
event: x,
|
|
3805
3805
|
week: T,
|
|
3806
3806
|
weekIndex: D,
|
|
3807
|
-
startDayIndex:
|
|
3807
|
+
startDayIndex: U,
|
|
3808
3808
|
endDayIndex: L,
|
|
3809
3809
|
isStart: P,
|
|
3810
3810
|
isEnd: B,
|
|
3811
3811
|
totalWeeks: R
|
|
3812
|
-
} = b, W = T.yOffset, K =
|
|
3812
|
+
} = b, W = T.yOffset, K = x.isAllDay === !0, J = this.getDayVisualPosition(U), wt = this.getDayVisualPosition(L);
|
|
3813
3813
|
J.row, wt.row;
|
|
3814
3814
|
let rt, ut;
|
|
3815
3815
|
if (c && !K) {
|
|
3816
|
-
const nt = new Date(T.days[
|
|
3816
|
+
const nt = new Date(T.days[U]).setHours(
|
|
3817
3817
|
0,
|
|
3818
3818
|
0,
|
|
3819
3819
|
0,
|
|
@@ -3823,15 +3823,15 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3823
3823
|
59,
|
|
3824
3824
|
59,
|
|
3825
3825
|
999
|
|
3826
|
-
), Et =
|
|
3826
|
+
), Et = x.start.getTime(), gt = x.end.getTime() - 6e4, st = Math.max(Et, nt), j = Math.min(gt, q), pt = new Date(st), vt = new Date(j), Pt = pt.getHours() * 60 + pt.getMinutes(), Rt = vt.getHours() * 60 + vt.getMinutes(), $t = W + J.row * this.dayHeight;
|
|
3827
3827
|
rt = $t + Pt / 1440 * this.dayHeight, ut = $t + Rt / 1440 * this.dayHeight;
|
|
3828
3828
|
} else {
|
|
3829
|
-
const nt = `${D}-${
|
|
3829
|
+
const nt = `${D}-${x.id}`;
|
|
3830
3830
|
let q = y.get(nt);
|
|
3831
3831
|
if (q === void 0) {
|
|
3832
3832
|
for (q = 0; ; ) {
|
|
3833
3833
|
let st = !0;
|
|
3834
|
-
for (let j =
|
|
3834
|
+
for (let j = U; j <= L; j++) {
|
|
3835
3835
|
const pt = `${D}-${j}`;
|
|
3836
3836
|
if (p.get(pt)?.has(q)) {
|
|
3837
3837
|
st = !1;
|
|
@@ -3843,7 +3843,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3843
3843
|
}
|
|
3844
3844
|
y.set(nt, q);
|
|
3845
3845
|
}
|
|
3846
|
-
for (let st =
|
|
3846
|
+
for (let st = U; st <= L; st++) {
|
|
3847
3847
|
const j = `${D}-${st}`;
|
|
3848
3848
|
let pt = p.get(j);
|
|
3849
3849
|
pt || (pt = /* @__PURE__ */ new Set(), p.set(j, pt)), pt.add(q);
|
|
@@ -3859,7 +3859,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3859
3859
|
ut - rt
|
|
3860
3860
|
);
|
|
3861
3861
|
let X, Tt;
|
|
3862
|
-
const Qt = `${D}-${
|
|
3862
|
+
const Qt = `${D}-${x.id}-${U}`, kt = w.get(Qt);
|
|
3863
3863
|
if (c && !K && kt && kt.totalColumns > 1) {
|
|
3864
3864
|
const nt = s / kt.totalColumns;
|
|
3865
3865
|
X = z + J.col * s + kt.column * nt, Tt = nt;
|
|
@@ -3869,16 +3869,16 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3869
3869
|
}
|
|
3870
3870
|
const ft = rt - e;
|
|
3871
3871
|
if (ft + Q < 0 || ft > i) continue;
|
|
3872
|
-
const $e =
|
|
3872
|
+
const $e = x.color || "#888888", Ht = this.internal.isEventSelected(x), sn = this.hoveredEventId === x.id, ct = 2, Dt = Tt - ct * 2, te = 3, si = 6;
|
|
3873
3873
|
let Ct = 4, zt = 4, Mt = 4, Ft = 4;
|
|
3874
|
-
R > 1 && (P && !B ? (zt = 0, Ft = 0) : !P && B ? (Ct = 0, Mt = 0) : !P && !B && (Ct = 0, zt = 0, Mt = 0, Ft = 0)), t.save(),
|
|
3874
|
+
R > 1 && (P && !B ? (zt = 0, Ft = 0) : !P && B ? (Ct = 0, Mt = 0) : !P && !B && (Ct = 0, zt = 0, Mt = 0, Ft = 0)), t.save(), x.readOnly && (t.globalAlpha = 0.5);
|
|
3875
3875
|
const Bt = Ps(Re($e)), ri = getComputedStyle(this).getPropertyValue("--text-primary").trim() || "rgba(255, 255, 255, 0.9)", Ae = getComputedStyle(this).getPropertyValue("--text-inverse").trim() || "rgb(0, 0, 0)", rn = Ht ? $e : `hsla(${Bt[0]}, ${Math.min(Bt[1] * 0.9, 90)}%, ${Math.min(
|
|
3876
3876
|
Bt[2] + 15,
|
|
3877
3877
|
40
|
|
3878
3878
|
)}%, 0.45)`, on = Ht ? $e : `hsla(${Bt[0]}, ${Math.min(Bt[1] * 0.9, 90)}%, ${Math.min(
|
|
3879
3879
|
Bt[2] + 10,
|
|
3880
3880
|
70
|
|
3881
|
-
)}%, 1)`, an = this.shouldRenderEventWithStripes(
|
|
3881
|
+
)}%, 1)`, an = this.shouldRenderEventWithStripes(x);
|
|
3882
3882
|
if (t.beginPath(), t.roundRect(X + ct, ft, Dt, Q, [
|
|
3883
3883
|
Ct,
|
|
3884
3884
|
zt,
|
|
@@ -3926,13 +3926,13 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3926
3926
|
ft,
|
|
3927
3927
|
Dt - te,
|
|
3928
3928
|
Q
|
|
3929
|
-
), t.clip(),
|
|
3929
|
+
), t.clip(), x.rrule) {
|
|
3930
3930
|
t.font = `11px ${a}`;
|
|
3931
3931
|
const vt = "⟳", Pt = t.measureText(vt).width;
|
|
3932
3932
|
t.fillText(vt, q, Et), gt -= Pt + 4;
|
|
3933
3933
|
}
|
|
3934
|
-
const st = q + (
|
|
3935
|
-
let j =
|
|
3934
|
+
const st = q + (x.rrule ? t.measureText("⟳").width + 4 : 0);
|
|
3935
|
+
let j = x.title;
|
|
3936
3936
|
if (t.font = `11px ${a}`, t.measureText(j).width > gt) {
|
|
3937
3937
|
const Pt = t.measureText("…").width;
|
|
3938
3938
|
let Rt = 0, $t = j.length, fe = 0;
|
|
@@ -3946,7 +3946,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3946
3946
|
const vt = (ge) => {
|
|
3947
3947
|
const pe = ge.getHours(), ee = ge.getMinutes(), ie = pe >= 12 ? "PM" : "AM";
|
|
3948
3948
|
return `${pe % 12 || 12}:${ee.toString().padStart(2, "0")} ${ie}`;
|
|
3949
|
-
}, Pt = vt(
|
|
3949
|
+
}, Pt = vt(x.start), Rt = vt(x.end), $t = `${Pt} – ${Rt}`, fe = Ht ? Ae : ri;
|
|
3950
3950
|
t.fillStyle = fe, t.font = `10px ${a}`;
|
|
3951
3951
|
let ht = $t;
|
|
3952
3952
|
if (t.measureText(ht).width > gt) {
|
|
@@ -3963,7 +3963,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3963
3963
|
t.restore();
|
|
3964
3964
|
}
|
|
3965
3965
|
t.restore(), this.eventRects.push({
|
|
3966
|
-
event:
|
|
3966
|
+
event: x,
|
|
3967
3967
|
x: X + ct,
|
|
3968
3968
|
y: rt,
|
|
3969
3969
|
width: Dt,
|
|
@@ -3983,29 +3983,29 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
3983
3983
|
"October",
|
|
3984
3984
|
"November",
|
|
3985
3985
|
"December"
|
|
3986
|
-
],
|
|
3986
|
+
], A = [], O = /* @__PURE__ */ new Set();
|
|
3987
3987
|
for (const b of r) {
|
|
3988
|
-
const
|
|
3989
|
-
if (!
|
|
3990
|
-
const T =
|
|
3991
|
-
if (!
|
|
3992
|
-
|
|
3988
|
+
const x = b.days[0];
|
|
3989
|
+
if (!x) continue;
|
|
3990
|
+
const T = x.getMonth(), D = x.getFullYear(), U = `${T}-${D}`;
|
|
3991
|
+
if (!O.has(U)) {
|
|
3992
|
+
O.add(U);
|
|
3993
3993
|
const L = S[T];
|
|
3994
|
-
L &&
|
|
3995
|
-
monthKey:
|
|
3994
|
+
L && A.push({
|
|
3995
|
+
monthKey: U,
|
|
3996
3996
|
monthName: L,
|
|
3997
3997
|
year: D,
|
|
3998
3998
|
yOffset: b.yOffset
|
|
3999
3999
|
});
|
|
4000
4000
|
}
|
|
4001
4001
|
}
|
|
4002
|
-
for (let b = 0; b <
|
|
4003
|
-
const
|
|
4004
|
-
if (
|
|
4002
|
+
for (let b = 0; b < A.length; b++) {
|
|
4003
|
+
const x = A[b], T = A[b + 1], D = x.yOffset, U = T ? T.yOffset : this.totalHeight;
|
|
4004
|
+
if (U < e) continue;
|
|
4005
4005
|
if (D > l) break;
|
|
4006
|
-
const L = [12, 0, 0, 12], P = Math.max(0, e - D), B =
|
|
4006
|
+
const L = [12, 0, 0, 12], P = Math.max(0, e - D), B = U - D - 24, R = Math.min(P, B), K = D + R - e + 32;
|
|
4007
4007
|
t.save(), t.font = `bold 18px ${a}`, t.textAlign = "left", t.textBaseline = "top";
|
|
4008
|
-
const J = `${
|
|
4008
|
+
const J = `${x.monthName} ${x.year}`, wt = t.measureText(J).width, ut = 64 + L[3] + 8, Q = K + L[0], X = 8, Tt = 8, Qt = getComputedStyle(this).getPropertyValue("--bg-elevated").trim() || "rgba(0, 0, 0, 0.7)";
|
|
4009
4009
|
t.fillStyle = Qt, t.beginPath(), t.roundRect(
|
|
4010
4010
|
ut - X,
|
|
4011
4011
|
Q - 4,
|
|
@@ -4175,16 +4175,16 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
4175
4175
|
if (!y) continue;
|
|
4176
4176
|
const { row: C, col: H } = this.getDayVisualPosition(p);
|
|
4177
4177
|
if (H < l || H > c) continue;
|
|
4178
|
-
const M = g.yOffset + C * this.dayHeight,
|
|
4179
|
-
if (s < M || i >
|
|
4180
|
-
const $ = Math.max(i, M), w = Math.min(s,
|
|
4178
|
+
const M = g.yOffset + C * this.dayHeight, E = M + this.dayHeight;
|
|
4179
|
+
if (s < M || i > E) continue;
|
|
4180
|
+
const $ = Math.max(i, M), w = Math.min(s, E), S = $ - M, A = Math.floor(
|
|
4181
4181
|
S / this.dayHeight * 24 * 60
|
|
4182
|
-
),
|
|
4183
|
-
|
|
4184
|
-
), D = Math.floor(T / 60),
|
|
4185
|
-
L.setHours(
|
|
4182
|
+
), O = Math.floor(A / 60), b = A % 60, x = w - M, T = Math.ceil(
|
|
4183
|
+
x / this.dayHeight * 24 * 60
|
|
4184
|
+
), D = Math.floor(T / 60), U = T % 60, L = new Date(y);
|
|
4185
|
+
L.setHours(O, b, 0, 0);
|
|
4186
4186
|
const P = new Date(y);
|
|
4187
|
-
P.setHours(D,
|
|
4187
|
+
P.setHours(D, U, 59, 999), h.push({ start: L, end: P });
|
|
4188
4188
|
}
|
|
4189
4189
|
else
|
|
4190
4190
|
for (const g of d)
|
|
@@ -4193,8 +4193,8 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
4193
4193
|
if (!y) continue;
|
|
4194
4194
|
const { row: C, col: H } = this.getDayVisualPosition(p);
|
|
4195
4195
|
if (H < l || H > c) continue;
|
|
4196
|
-
const M = g.yOffset + C * this.dayHeight,
|
|
4197
|
-
if (s < M || i >
|
|
4196
|
+
const M = g.yOffset + C * this.dayHeight, E = M + this.dayHeight;
|
|
4197
|
+
if (s < M || i > E) continue;
|
|
4198
4198
|
const $ = new Date(y);
|
|
4199
4199
|
$.setHours(0, 0, 0, 0);
|
|
4200
4200
|
const w = new Date(y);
|
|
@@ -4364,32 +4364,32 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
4364
4364
|
this.movingEventEnd.y
|
|
4365
4365
|
);
|
|
4366
4366
|
if (!t || !e) return;
|
|
4367
|
-
const i = e.getTime() - t.getTime(), s = (
|
|
4367
|
+
const i = e.getTime() - t.getTime(), s = (c) => (c.setMinutes(Math.round(c.getMinutes() / 15) * 15, 0, 0), c), r = s(
|
|
4368
4368
|
new Date(this.movingEvent.start.getTime() + i)
|
|
4369
|
-
), o = s(new Date(this.movingEvent.end.getTime() + i));
|
|
4369
|
+
), o = s(new Date(this.movingEvent.end.getTime() + i)), a = (this.movingEvent.start.getTime() + this.movingEvent.end.getTime()) / 2, l = t.getTime() <= a;
|
|
4370
4370
|
if (this.movingEventDuplicateMode) {
|
|
4371
|
-
const
|
|
4371
|
+
const c = getComputedStyle(this).getPropertyValue("--accent-primary").trim() || "rgb(100, 150, 255)";
|
|
4372
4372
|
this.renderVirtualEvent(
|
|
4373
4373
|
r,
|
|
4374
4374
|
o,
|
|
4375
4375
|
{
|
|
4376
|
-
fill:
|
|
4377
|
-
stroke:
|
|
4376
|
+
fill: c.replace("rgb", "rgba").replace(")", ", 0.3)"),
|
|
4377
|
+
stroke: c.replace("rgb", "rgba").replace(")", ", 0.8)"),
|
|
4378
4378
|
text: "white"
|
|
4379
4379
|
},
|
|
4380
|
-
|
|
4380
|
+
l
|
|
4381
4381
|
);
|
|
4382
4382
|
} else {
|
|
4383
|
-
const
|
|
4383
|
+
const c = Re(this.movingEvent.color || "#888888");
|
|
4384
4384
|
this.renderVirtualEvent(
|
|
4385
4385
|
r,
|
|
4386
4386
|
o,
|
|
4387
4387
|
{
|
|
4388
|
-
fill: `rgba(${
|
|
4389
|
-
stroke: `rgba(${
|
|
4388
|
+
fill: `rgba(${c[0]}, ${c[1]}, ${c[2]}, 0.5)`,
|
|
4389
|
+
stroke: `rgba(${c[0]}, ${c[1]}, ${c[2]}, 0.5)`,
|
|
4390
4390
|
text: "rgba(255, 255, 255, 0.5)"
|
|
4391
4391
|
},
|
|
4392
|
-
|
|
4392
|
+
l
|
|
4393
4393
|
);
|
|
4394
4394
|
}
|
|
4395
4395
|
}
|
|
@@ -4405,104 +4405,91 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
4405
4405
|
if (!t || !e) return;
|
|
4406
4406
|
let i, s;
|
|
4407
4407
|
if (this.eventCreationShiftPressed && this.eventCreationInitialDuration !== null) {
|
|
4408
|
-
const
|
|
4408
|
+
const l = this.convertPositionToDateTime(
|
|
4409
4409
|
this.eventCreationEnd.x,
|
|
4410
4410
|
this.eventCreationEnd.y
|
|
4411
4411
|
);
|
|
4412
|
-
if (!
|
|
4413
|
-
s = new Date(
|
|
4414
|
-
|
|
4412
|
+
if (!l) return;
|
|
4413
|
+
s = new Date(l), i = new Date(
|
|
4414
|
+
l.getTime() - this.eventCreationInitialDuration
|
|
4415
4415
|
);
|
|
4416
4416
|
} else
|
|
4417
4417
|
i = t < e ? t : e, s = t < e ? e : t;
|
|
4418
4418
|
i.setMinutes(Math.round(i.getMinutes() / 15) * 15, 0, 0), s.setMinutes(Math.round(s.getMinutes() / 15) * 15, 0, 0);
|
|
4419
4419
|
let r, o;
|
|
4420
4420
|
if (this.activeCalendarColor) {
|
|
4421
|
-
const
|
|
4422
|
-
r = `rgba(${
|
|
4421
|
+
const l = Re(this.activeCalendarColor);
|
|
4422
|
+
r = `rgba(${l[0]}, ${l[1]}, ${l[2]}, 0.3)`, o = `rgba(${l[0]}, ${l[1]}, ${l[2]}, 0.8)`;
|
|
4423
4423
|
} else {
|
|
4424
|
-
const
|
|
4425
|
-
r =
|
|
4426
|
-
}
|
|
4427
|
-
this.
|
|
4428
|
-
|
|
4429
|
-
s,
|
|
4430
|
-
{
|
|
4431
|
-
fill: r,
|
|
4432
|
-
stroke: o,
|
|
4433
|
-
text: "white"
|
|
4434
|
-
},
|
|
4435
|
-
this.eventCreationEnd.y
|
|
4436
|
-
);
|
|
4424
|
+
const l = getComputedStyle(this).getPropertyValue("--accent-primary").trim() || "rgb(100, 150, 255)";
|
|
4425
|
+
r = l.replace("rgb", "rgba").replace(")", ", 0.3)"), o = l.replace("rgb", "rgba").replace(")", ", 0.8)");
|
|
4426
|
+
}
|
|
4427
|
+
const a = this.eventCreationShiftPressed ? !1 : this.eventCreationEnd.y <= this.eventCreationStart.y;
|
|
4428
|
+
this.renderVirtualEvent(i, s, { fill: r, stroke: o, text: "white" }, a);
|
|
4437
4429
|
}
|
|
4438
|
-
renderVirtualEvent(t, e, i, s) {
|
|
4430
|
+
renderVirtualEvent(t, e, i, s = !0) {
|
|
4439
4431
|
if (!this.overlayCanvas || !this.overlayCtx || !this.scrollContainer)
|
|
4440
4432
|
return;
|
|
4441
|
-
const r = this.overlayCtx, o = getComputedStyle(this).fontFamily, c = (this.scrollContainer.getBoundingClientRect().width - z - Yi) / this._columnsPerRow, d = (S,
|
|
4433
|
+
const r = this.overlayCtx, o = getComputedStyle(this).fontFamily, c = (this.scrollContainer.getBoundingClientRect().width - z - Yi) / this._columnsPerRow, d = (S, A, O) => {
|
|
4442
4434
|
const b = this.weeks.find(
|
|
4443
4435
|
(L) => L.days.some((P) => P.toDateString() === S.toDateString())
|
|
4444
4436
|
);
|
|
4445
4437
|
if (!b) return null;
|
|
4446
|
-
const
|
|
4438
|
+
const x = b.days.findIndex(
|
|
4447
4439
|
(L) => L.toDateString() === S.toDateString()
|
|
4448
4440
|
);
|
|
4449
|
-
if (
|
|
4450
|
-
const { row: T } = this.getDayVisualPosition(
|
|
4441
|
+
if (x < 0) return null;
|
|
4442
|
+
const { row: T } = this.getDayVisualPosition(x), D = A * 60 + O;
|
|
4451
4443
|
return b.yOffset + T * this.dayHeight + D / 1440 * this.dayHeight - this.scrollTop;
|
|
4452
4444
|
}, h = (S) => {
|
|
4453
|
-
const
|
|
4454
|
-
(
|
|
4445
|
+
const A = this.weeks.find(
|
|
4446
|
+
(x) => x.days.some((T) => T.toDateString() === S.toDateString())
|
|
4455
4447
|
);
|
|
4456
|
-
if (!
|
|
4457
|
-
const
|
|
4458
|
-
(
|
|
4448
|
+
if (!A) return null;
|
|
4449
|
+
const O = A.days.findIndex(
|
|
4450
|
+
(x) => x.toDateString() === S.toDateString()
|
|
4459
4451
|
);
|
|
4460
|
-
if (
|
|
4461
|
-
const { col: b } = this.getDayVisualPosition(
|
|
4452
|
+
if (O < 0) return null;
|
|
4453
|
+
const { col: b } = this.getDayVisualPosition(O);
|
|
4462
4454
|
return b * c;
|
|
4463
|
-
}, u = (S,
|
|
4464
|
-
const b = S + 2,
|
|
4465
|
-
r.fillStyle = i.fill, r.beginPath(), r.roundRect(b,
|
|
4455
|
+
}, u = (S, A, O) => {
|
|
4456
|
+
const b = S + 2, x = c - 4, T = Math.max(4, O - A);
|
|
4457
|
+
r.fillStyle = i.fill, r.beginPath(), r.roundRect(b, A, x, T, 4), r.fill(), r.strokeStyle = i.stroke, r.lineWidth = 1, r.setLineDash([6, 3]), r.stroke(), r.setLineDash([]);
|
|
4466
4458
|
}, f = t.toDateString() === e.toDateString();
|
|
4467
4459
|
if (f) {
|
|
4468
|
-
const S = h(t),
|
|
4469
|
-
S != null &&
|
|
4460
|
+
const S = h(t), A = d(t, t.getHours(), t.getMinutes()), O = d(e, e.getHours(), e.getMinutes());
|
|
4461
|
+
S != null && A != null && O != null && u(S, A, O);
|
|
4470
4462
|
} else {
|
|
4471
4463
|
const S = new Date(t);
|
|
4472
4464
|
S.setHours(0, 0, 0, 0);
|
|
4473
|
-
const
|
|
4474
|
-
for (
|
|
4475
|
-
const
|
|
4476
|
-
if (
|
|
4477
|
-
const b = S.toDateString() === t.toDateString(),
|
|
4465
|
+
const A = new Date(e);
|
|
4466
|
+
for (A.setHours(23, 59, 59, 999); S <= A; ) {
|
|
4467
|
+
const O = h(S);
|
|
4468
|
+
if (O != null) {
|
|
4469
|
+
const b = S.toDateString() === t.toDateString(), x = S.toDateString() === e.toDateString();
|
|
4478
4470
|
let T, D;
|
|
4479
|
-
b ? (T = d(S, t.getHours(), t.getMinutes()), D = d(S, 23, 59)) :
|
|
4471
|
+
b ? (T = d(S, t.getHours(), t.getMinutes()), D = d(S, 23, 59)) : x ? (T = d(S, 0, 0), D = d(S, e.getHours(), e.getMinutes())) : (T = d(S, 0, 0), D = d(S, 23, 59)), T != null && D != null && u(O, T, D);
|
|
4480
4472
|
}
|
|
4481
4473
|
S.setDate(S.getDate() + 1);
|
|
4482
4474
|
}
|
|
4483
4475
|
}
|
|
4484
|
-
const v = (S) => `${S.getHours().toString().padStart(2, "0")}:${S.getMinutes().toString().padStart(2, "0")}`, g = (S) => `${S.getDate()}.${S.getMonth() + 1}`, p = f ? `${v(t)} – ${v(e)}` : `${g(t)} ${v(t)} – ${g(e)} ${v(e)}`, H = Math.abs(e.getTime() - t.getTime()) / (1e3 * 60) < 15, M = h(t),
|
|
4485
|
-
if (M != null &&
|
|
4476
|
+
const v = (S) => `${S.getHours().toString().padStart(2, "0")}:${S.getMinutes().toString().padStart(2, "0")}`, g = (S) => `${S.getDate()}.${S.getMonth() + 1}`, p = f ? `${v(t)} – ${v(e)}` : `${g(t)} ${v(t)} – ${g(e)} ${v(e)}`, H = Math.abs(e.getTime() - t.getTime()) / (1e3 * 60) < 15, M = h(t), E = h(e), $ = d(t, t.getHours(), t.getMinutes()), w = d(e, e.getHours(), e.getMinutes());
|
|
4477
|
+
if (M != null && E != null && $ != null && w != null) {
|
|
4486
4478
|
r.font = `600 11px ${o}`, r.fillStyle = i.text, r.textAlign = "left";
|
|
4487
|
-
|
|
4488
|
-
if (s !== void 0) {
|
|
4489
|
-
const A = s - this.scrollTop, b = Math.abs(A - $), E = Math.abs(A - w);
|
|
4490
|
-
S = b < E;
|
|
4491
|
-
}
|
|
4492
|
-
const O = S ? M : x;
|
|
4479
|
+
const S = s ? M : E;
|
|
4493
4480
|
if (H) {
|
|
4494
|
-
const A =
|
|
4495
|
-
r.fillStyle =
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4481
|
+
const A = s ? $ : w, O = A + 6, b = A + 10, x = r.measureText(p).width, T = 6, D = getComputedStyle(this).getPropertyValue("--bg-elevated").trim() || "rgba(0, 0, 0, 0.8)";
|
|
4482
|
+
r.fillStyle = D, r.beginPath(), r.roundRect(
|
|
4483
|
+
S + 4,
|
|
4484
|
+
O,
|
|
4485
|
+
x + T * 2,
|
|
4499
4486
|
16,
|
|
4500
4487
|
4
|
|
4501
|
-
), r.fill(), r.fillStyle = "white", r.textBaseline = "top", r.fillText(p,
|
|
4488
|
+
), r.fill(), r.fillStyle = "white", r.textBaseline = "top", r.fillText(p, S + 4 + T, b);
|
|
4502
4489
|
} else {
|
|
4503
4490
|
r.textBaseline = "top";
|
|
4504
|
-
const A =
|
|
4505
|
-
r.fillText(p,
|
|
4491
|
+
const A = s ? $ + 4 : w - 18;
|
|
4492
|
+
r.fillText(p, S + 8, A);
|
|
4506
4493
|
}
|
|
4507
4494
|
}
|
|
4508
4495
|
}
|
|
@@ -4523,13 +4510,13 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
4523
4510
|
if (!d) continue;
|
|
4524
4511
|
const { row: h, col: u } = this.getDayVisualPosition(c), f = u * s, v = l.yOffset + h * this.dayHeight - r, g = v + this.dayHeight;
|
|
4525
4512
|
if (c === 5 || c === 6) {
|
|
4526
|
-
const
|
|
4527
|
-
t.fillStyle =
|
|
4513
|
+
const E = getComputedStyle(this).getPropertyValue("--bg-weekend").trim() || "rgba(255, 255, 255, 0.03)";
|
|
4514
|
+
t.fillStyle = E, t.fillRect(f, v, s, this.dayHeight);
|
|
4528
4515
|
}
|
|
4529
4516
|
const p = this.dayHeight >= 300, y = /* @__PURE__ */ new Date();
|
|
4530
|
-
if (!p &&
|
|
4531
|
-
const
|
|
4532
|
-
t.strokeStyle =
|
|
4517
|
+
if (!p && N.isSameDay(d, y)) {
|
|
4518
|
+
const E = getComputedStyle(this).getPropertyValue("--accent-current-time").trim() || "rgba(255, 0, 0, 0.8)";
|
|
4519
|
+
t.strokeStyle = E, t.lineWidth = 1, t.strokeRect(f + 1, v + 1, s - 2, this.dayHeight - 2), t.lineWidth = 1;
|
|
4533
4520
|
}
|
|
4534
4521
|
const C = 12, M = Math.min(
|
|
4535
4522
|
g - C - 8,
|
|
@@ -4555,11 +4542,11 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
4555
4542
|
if (C >= 7) continue;
|
|
4556
4543
|
const H = o[C];
|
|
4557
4544
|
if (!H) continue;
|
|
4558
|
-
const M = z + y * e + e / 2,
|
|
4545
|
+
const M = z + y * e + e / 2, E = t.measureText(H).width, $ = 6, w = 2;
|
|
4559
4546
|
t.fillStyle = c, t.beginPath(), t.roundRect(
|
|
4560
|
-
M -
|
|
4547
|
+
M - E / 2 - $,
|
|
4561
4548
|
p,
|
|
4562
|
-
|
|
4549
|
+
E + $ * 2,
|
|
4563
4550
|
d,
|
|
4564
4551
|
4
|
|
4565
4552
|
), t.fill(), t.fillStyle = l, t.fillText(H, M, p + w + 1);
|
|
@@ -4597,12 +4584,12 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
4597
4584
|
if (!y || y.height === 0) continue;
|
|
4598
4585
|
const C = y.days[0], H = y.days[6];
|
|
4599
4586
|
if (!C || !H) continue;
|
|
4600
|
-
const M = C.getTime(),
|
|
4587
|
+
const M = C.getTime(), E = H.getTime() + a - 1, $ = Math.max(d, M), w = Math.min(h, E), S = Math.floor(
|
|
4601
4588
|
$ % a / l
|
|
4602
|
-
),
|
|
4589
|
+
), A = Math.floor(
|
|
4603
4590
|
w % a / l
|
|
4604
|
-
),
|
|
4605
|
-
i.globalAlpha = c.readOnly ? 0.333 * 0.5 : 0.333, i.fillStyle = c.color || "#888", i.fillRect(2,
|
|
4591
|
+
), O = y.yOffset / this.totalHeight * e + S / 1440 * (y.height / this.totalHeight * e), b = y.yOffset / this.totalHeight * e + A / 1440 * (y.height / this.totalHeight * e);
|
|
4592
|
+
i.globalAlpha = c.readOnly ? 0.333 * 0.5 : 0.333, i.fillStyle = c.color || "#888", i.fillRect(2, O, t - 4, Math.max(b - O, 2));
|
|
4606
4593
|
}
|
|
4607
4594
|
}
|
|
4608
4595
|
}
|
|
@@ -4828,15 +4815,15 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
4828
4815
|
renderEventDetail() {
|
|
4829
4816
|
if (!this.selectedEventForDetail || !this.selectedEventRect)
|
|
4830
4817
|
return null;
|
|
4831
|
-
const t = this.selectedEventForDetail, e = (
|
|
4818
|
+
const t = this.selectedEventForDetail, e = (E) => new Intl.DateTimeFormat(this.locale, {
|
|
4832
4819
|
weekday: "short",
|
|
4833
4820
|
year: "numeric",
|
|
4834
4821
|
month: "short",
|
|
4835
4822
|
day: "numeric"
|
|
4836
|
-
}).format(
|
|
4823
|
+
}).format(E), i = (E) => new Intl.DateTimeFormat(this.locale, {
|
|
4837
4824
|
hour: "numeric",
|
|
4838
4825
|
minute: "2-digit"
|
|
4839
|
-
}).format(
|
|
4826
|
+
}).format(E), s = N.isSameDay(t.start, t.end), r = 320, o = 550, a = 8, l = this.scrollContainer?.clientWidth || 800, c = this.scrollContainer?.clientHeight || 600, d = this.selectedEventRect.x + this.selectedEventRect.width + a, h = this.selectedEventRect.x - r - a, u = d + r <= l ? d : h, f = z + a, v = l - r - a, g = Math.max(f, Math.min(v, u)), p = this.selectedEventRect.y - this.scrollTop, y = a, C = c - o - a, H = Math.max(y, Math.min(C, p)), M = `left: ${g}px; top: ${H}px; --calendar-color: ${t.color || "#888888"};`;
|
|
4840
4827
|
return _`
|
|
4841
4828
|
<div class="event-detail-overlay" style="${M}">
|
|
4842
4829
|
<div class="event-detail-content">
|
|
@@ -4854,8 +4841,8 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
4854
4841
|
class="event-detail-title-input"
|
|
4855
4842
|
.value=${t.title}
|
|
4856
4843
|
placeholder="Event title"
|
|
4857
|
-
@input=${(
|
|
4858
|
-
const w =
|
|
4844
|
+
@input=${(E) => {
|
|
4845
|
+
const w = E.target.value;
|
|
4859
4846
|
w !== t.title && (this.updateEventTimeout && clearTimeout(this.updateEventTimeout), this.updateEventTimeout = setTimeout(() => {
|
|
4860
4847
|
this.dispatchEvent(
|
|
4861
4848
|
new CustomEvent("update-event", {
|
|
@@ -4866,10 +4853,10 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
4866
4853
|
), this.updateEventTimeout = null;
|
|
4867
4854
|
}, 500));
|
|
4868
4855
|
}}
|
|
4869
|
-
@keydown=${(
|
|
4870
|
-
if (
|
|
4856
|
+
@keydown=${(E) => {
|
|
4857
|
+
if (E.key === "Enter") {
|
|
4871
4858
|
this.updateEventTimeout && (clearTimeout(this.updateEventTimeout), this.updateEventTimeout = null);
|
|
4872
|
-
const $ =
|
|
4859
|
+
const $ = E.target, w = $.value;
|
|
4873
4860
|
w !== t.title && this.dispatchEvent(
|
|
4874
4861
|
new CustomEvent("update-event", {
|
|
4875
4862
|
detail: { event: t, updates: { title: w } },
|
|
@@ -4929,7 +4916,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
4929
4916
|
|
|
4930
4917
|
${(() => {
|
|
4931
4918
|
if (!t.attendees || t.attendees.length === 0) return null;
|
|
4932
|
-
const
|
|
4919
|
+
const E = this.findCurrentUserAttendee(t), $ = E ? t.attendees.filter((w) => w !== E) : t.attendees;
|
|
4933
4920
|
return $.length > 0 ? _`
|
|
4934
4921
|
<div class="event-detail-section">
|
|
4935
4922
|
<div class="event-detail-label">Participants (${$.length})</div>
|
|
@@ -4994,8 +4981,8 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
4994
4981
|
.value=${t.description ?? ""}
|
|
4995
4982
|
placeholder="Add description..."
|
|
4996
4983
|
rows="3"
|
|
4997
|
-
@input=${(
|
|
4998
|
-
const w =
|
|
4984
|
+
@input=${(E) => {
|
|
4985
|
+
const w = E.target.value;
|
|
4999
4986
|
this.updateEventTimeout && clearTimeout(this.updateEventTimeout), this.updateEventTimeout = setTimeout(() => {
|
|
5000
4987
|
this.dispatchEvent(
|
|
5001
4988
|
new CustomEvent("update-event", {
|
|
@@ -5009,8 +4996,8 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
5009
4996
|
), this.updateEventTimeout = null;
|
|
5010
4997
|
}, 500);
|
|
5011
4998
|
}}
|
|
5012
|
-
@blur=${(
|
|
5013
|
-
const w =
|
|
4999
|
+
@blur=${(E) => {
|
|
5000
|
+
const w = E.target.value;
|
|
5014
5001
|
this.updateEventTimeout && (clearTimeout(this.updateEventTimeout), this.updateEventTimeout = null), w !== (t.description ?? "") && this.dispatchEvent(
|
|
5015
5002
|
new CustomEvent("update-event", {
|
|
5016
5003
|
detail: {
|
|
@@ -5029,29 +5016,29 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
|
|
|
5029
5016
|
|
|
5030
5017
|
${(() => {
|
|
5031
5018
|
if (!t.attendees || t.attendees.length === 0) return null;
|
|
5032
|
-
const
|
|
5033
|
-
return !
|
|
5019
|
+
const E = this.findCurrentUserAttendee(t);
|
|
5020
|
+
return !E || t.readOnly || t.organizer?.email === E.email ? null : _`
|
|
5034
5021
|
<div class="event-detail-footer">
|
|
5035
5022
|
<div class="invite-response-buttons">
|
|
5036
5023
|
<button
|
|
5037
|
-
class="invite-response-button ${
|
|
5038
|
-
@click=${() => this.updateAttendeeStatus(t,
|
|
5024
|
+
class="invite-response-button ${E.status === "ACCEPTED" ? "active" : ""}"
|
|
5025
|
+
@click=${() => this.updateAttendeeStatus(t, E, "ACCEPTED")}
|
|
5039
5026
|
>
|
|
5040
5027
|
Accept
|
|
5041
5028
|
</button>
|
|
5042
5029
|
<button
|
|
5043
|
-
class="invite-response-button ${
|
|
5030
|
+
class="invite-response-button ${E.status === "TENTATIVE" ? "active" : ""}"
|
|
5044
5031
|
@click=${() => this.updateAttendeeStatus(
|
|
5045
5032
|
t,
|
|
5046
|
-
|
|
5033
|
+
E,
|
|
5047
5034
|
"TENTATIVE"
|
|
5048
5035
|
)}
|
|
5049
5036
|
>
|
|
5050
5037
|
Maybe
|
|
5051
5038
|
</button>
|
|
5052
5039
|
<button
|
|
5053
|
-
class="invite-response-button ${
|
|
5054
|
-
@click=${() => this.updateAttendeeStatus(t,
|
|
5040
|
+
class="invite-response-button ${E.status === "DECLINED" ? "active" : ""}"
|
|
5041
|
+
@click=${() => this.updateAttendeeStatus(t, E, "DECLINED")}
|
|
5055
5042
|
>
|
|
5056
5043
|
Decline
|
|
5057
5044
|
</button>
|
|
@@ -5554,6 +5541,7 @@ ni.styles = zi`
|
|
|
5554
5541
|
display: flex;
|
|
5555
5542
|
flex-direction: column;
|
|
5556
5543
|
gap: 16px;
|
|
5544
|
+
background: var(--bg-secondary, rgba(36, 36, 38, 0.5));
|
|
5557
5545
|
}
|
|
5558
5546
|
|
|
5559
5547
|
.event-detail-section {
|
|
@@ -5949,7 +5937,7 @@ De.SYNC_INTERVAL_MS = 300 * 1e3;
|
|
|
5949
5937
|
let Li = De;
|
|
5950
5938
|
export {
|
|
5951
5939
|
Li as CalendarIntegration,
|
|
5952
|
-
|
|
5940
|
+
N as CalendarInternal,
|
|
5953
5941
|
Ni as CalendarViewElement,
|
|
5954
5942
|
Vs as InMemorySource,
|
|
5955
5943
|
As as NOTIFICATION_PRESETS
|
package/package.json
CHANGED
package/src/CalDAVConfig.ts
CHANGED
|
@@ -39,6 +39,7 @@ interface InhouseSource extends CalendarSource {
|
|
|
39
39
|
sessionCookie: string;
|
|
40
40
|
employeeId: string;
|
|
41
41
|
unitId?: string;
|
|
42
|
+
startHour?: 9 | 10;
|
|
42
43
|
};
|
|
43
44
|
locked?: boolean;
|
|
44
45
|
}
|
|
@@ -562,6 +563,7 @@ export class CalDAVConfigElement extends LitElement {
|
|
|
562
563
|
sessionCookie: this.formData.credentials.sessionCookie,
|
|
563
564
|
employeeId: this.formData.credentials.employeeId,
|
|
564
565
|
unitId: this.formData.credentials.unitId,
|
|
566
|
+
startHour: this.formData.credentials.startHour,
|
|
565
567
|
},
|
|
566
568
|
color: this.formData.color || "#FF6E68",
|
|
567
569
|
enabled: this.formData.enabled ?? true,
|
|
@@ -597,10 +599,10 @@ export class CalDAVConfigElement extends LitElement {
|
|
|
597
599
|
this.requestUpdate();
|
|
598
600
|
}
|
|
599
601
|
|
|
600
|
-
updateForm(field: string, value: string | boolean) {
|
|
602
|
+
updateForm(field: string, value: string | boolean | number) {
|
|
601
603
|
if (field === "serverUrl" || field === "username" || field === "password" || field === "url" ||
|
|
602
604
|
field === "accessToken" || field === "refreshToken" || field === "tokenExpiry" || field === "calendarId" ||
|
|
603
|
-
field === "sessionCookie" || field === "employeeId" || field === "unitId") {
|
|
605
|
+
field === "sessionCookie" || field === "employeeId" || field === "unitId" || field === "startHour") {
|
|
604
606
|
this.formData = {
|
|
605
607
|
...this.formData,
|
|
606
608
|
credentials: {
|
|
@@ -985,6 +987,19 @@ export class CalDAVConfigElement extends LitElement {
|
|
|
985
987
|
this.updateForm("unitId", (e.target as HTMLInputElement).value)}
|
|
986
988
|
/>
|
|
987
989
|
</div>
|
|
990
|
+
|
|
991
|
+
<div class="form-group">
|
|
992
|
+
<label class="form-label">Bookings Start At</label>
|
|
993
|
+
<select
|
|
994
|
+
class="form-input"
|
|
995
|
+
.value=${String(this.formData.credentials?.startHour ?? 9)}
|
|
996
|
+
@change=${(e: Event) =>
|
|
997
|
+
this.updateForm("startHour", Number((e.target as HTMLSelectElement).value))}
|
|
998
|
+
>
|
|
999
|
+
<option value="9" ?selected=${(this.formData.credentials?.startHour ?? 9) === 9}>9:00 AM</option>
|
|
1000
|
+
<option value="10" ?selected=${this.formData.credentials?.startHour === 10}>10:00 AM</option>
|
|
1001
|
+
</select>
|
|
1002
|
+
</div>
|
|
988
1003
|
`
|
|
989
1004
|
: null}
|
|
990
1005
|
|
package/src/CalendarView.ts
CHANGED
|
@@ -395,6 +395,7 @@ export class CalendarViewElement extends LitElement {
|
|
|
395
395
|
display: flex;
|
|
396
396
|
flex-direction: column;
|
|
397
397
|
gap: 16px;
|
|
398
|
+
background: var(--bg-secondary, rgba(36, 36, 38, 0.5));
|
|
398
399
|
}
|
|
399
400
|
|
|
400
401
|
.event-detail-section {
|
|
@@ -3367,7 +3368,7 @@ export class CalendarViewElement extends LitElement {
|
|
|
3367
3368
|
const deltaMs = dropDate.getTime() - originDate.getTime();
|
|
3368
3369
|
const snap15 = (d: Date) => {
|
|
3369
3370
|
const m = d.getMinutes();
|
|
3370
|
-
d.setMinutes(Math.
|
|
3371
|
+
d.setMinutes(Math.round(m / 15) * 15, 0, 0);
|
|
3371
3372
|
return d;
|
|
3372
3373
|
};
|
|
3373
3374
|
const newStart = snap15(
|
|
@@ -4183,8 +4184,12 @@ export class CalendarViewElement extends LitElement {
|
|
|
4183
4184
|
);
|
|
4184
4185
|
const newEnd = snap15(new Date(this.movingEvent.end.getTime() + deltaMs));
|
|
4185
4186
|
|
|
4187
|
+
// The grab point (originDate) relative to the event's midpoint tells us
|
|
4188
|
+
// which half the user grabbed — this is stable for the whole drag.
|
|
4189
|
+
const eventMidMs = (this.movingEvent.start.getTime() + this.movingEvent.end.getTime()) / 2;
|
|
4190
|
+
const useStartEdge = originDate.getTime() <= eventMidMs;
|
|
4191
|
+
|
|
4186
4192
|
if (this.movingEventDuplicateMode) {
|
|
4187
|
-
// Duplicate mode: use accent color to indicate new event creation
|
|
4188
4193
|
const accent =
|
|
4189
4194
|
getComputedStyle(this).getPropertyValue("--accent-primary").trim() ||
|
|
4190
4195
|
"rgb(100, 150, 255)";
|
|
@@ -4196,10 +4201,9 @@ export class CalendarViewElement extends LitElement {
|
|
|
4196
4201
|
stroke: accent.replace("rgb", "rgba").replace(")", ", 0.8)"),
|
|
4197
4202
|
text: "white",
|
|
4198
4203
|
},
|
|
4199
|
-
|
|
4204
|
+
useStartEdge,
|
|
4200
4205
|
);
|
|
4201
4206
|
} else {
|
|
4202
|
-
// Normal move: use event color
|
|
4203
4207
|
const rgb = hexToRgb(this.movingEvent.color || "#888888");
|
|
4204
4208
|
this.renderVirtualEvent(
|
|
4205
4209
|
newStart,
|
|
@@ -4209,7 +4213,7 @@ export class CalendarViewElement extends LitElement {
|
|
|
4209
4213
|
stroke: `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, 0.5)`,
|
|
4210
4214
|
text: "rgba(255, 255, 255, 0.5)",
|
|
4211
4215
|
},
|
|
4212
|
-
|
|
4216
|
+
useStartEdge,
|
|
4213
4217
|
);
|
|
4214
4218
|
}
|
|
4215
4219
|
}
|
|
@@ -4269,23 +4273,20 @@ export class CalendarViewElement extends LitElement {
|
|
|
4269
4273
|
fill = accent.replace("rgb", "rgba").replace(")", ", 0.3)");
|
|
4270
4274
|
stroke = accent.replace("rgb", "rgba").replace(")", ", 0.8)");
|
|
4271
4275
|
}
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
},
|
|
4280
|
-
this.eventCreationEnd.y,
|
|
4281
|
-
);
|
|
4276
|
+
// In shift mode the cursor tracks the end; otherwise it tracks whichever
|
|
4277
|
+
// edge is away from the fixed anchor (eventCreationStart).
|
|
4278
|
+
const useStartEdge = this.eventCreationShiftPressed
|
|
4279
|
+
? false
|
|
4280
|
+
: this.eventCreationEnd.y <= this.eventCreationStart.y;
|
|
4281
|
+
|
|
4282
|
+
this.renderVirtualEvent(earlier, later, { fill, stroke, text: "white" }, useStartEdge);
|
|
4282
4283
|
}
|
|
4283
4284
|
|
|
4284
4285
|
renderVirtualEvent(
|
|
4285
4286
|
start: Date,
|
|
4286
4287
|
end: Date,
|
|
4287
4288
|
color: { fill: string; stroke: string; text: string },
|
|
4288
|
-
|
|
4289
|
+
useStartEdge = true,
|
|
4289
4290
|
): void {
|
|
4290
4291
|
if (!this.overlayCanvas || !this.overlayCtx || !this.scrollContainer)
|
|
4291
4292
|
return;
|
|
@@ -4405,15 +4406,6 @@ export class CalendarViewElement extends LitElement {
|
|
|
4405
4406
|
ctx.fillStyle = color.text;
|
|
4406
4407
|
ctx.textAlign = "left";
|
|
4407
4408
|
|
|
4408
|
-
// Calculate which edge is closer to cursor
|
|
4409
|
-
let useStartEdge = true;
|
|
4410
|
-
if (cursorY !== undefined) {
|
|
4411
|
-
const cursorYViewport = cursorY - this.scrollTop;
|
|
4412
|
-
const distanceToStart = Math.abs(cursorYViewport - startY);
|
|
4413
|
-
const distanceToEnd = Math.abs(cursorYViewport - endY);
|
|
4414
|
-
useStartEdge = distanceToStart < distanceToEnd;
|
|
4415
|
-
}
|
|
4416
|
-
|
|
4417
4409
|
// Use appropriate column based on which edge is closer
|
|
4418
4410
|
const labelColX = useStartEdge ? firstColX : lastColX;
|
|
4419
4411
|
|
|
@@ -17,6 +17,10 @@ export interface InhouseCredentials extends CalendarCredentials {
|
|
|
17
17
|
* Unit ID (optional, for filtering by unit/location)
|
|
18
18
|
*/
|
|
19
19
|
unitId?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Hour at which bookings start (9 or 10, defaults to 9)
|
|
22
|
+
*/
|
|
23
|
+
startHour?: 9 | 10;
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
/**
|
|
@@ -191,7 +195,7 @@ export class InhouseBookingSource implements CalendarSource {
|
|
|
191
195
|
}
|
|
192
196
|
|
|
193
197
|
const LUNCH_MS = 60 * 60 * 1000;
|
|
194
|
-
let currentTime = new Date(year, month - 1, day, 9, 0);
|
|
198
|
+
let currentTime = new Date(year, month - 1, day, this.credentials.startHour ?? 9, 0);
|
|
195
199
|
|
|
196
200
|
for (let i = 0; i < dateBookings.length; i++) {
|
|
197
201
|
// Insert 1-hour lunch break between morning and afternoon sessions
|
package/src/app.ts
CHANGED
|
@@ -364,6 +364,7 @@ function createInhouseCalendar(source: CalendarSource): Calendar {
|
|
|
364
364
|
sessionCookie: source.credentials.sessionCookie,
|
|
365
365
|
employeeId: source.credentials.employeeId,
|
|
366
366
|
unitId: source.credentials.unitId,
|
|
367
|
+
startHour: source.credentials.startHour,
|
|
367
368
|
},
|
|
368
369
|
source.enabled
|
|
369
370
|
);
|