@forcecalendar/interface 1.3.0 → 1.5.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/force-calendar-interface.esm.js +294 -28
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +49 -16
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ForceCalendar.js +61 -2
- package/src/core/DragController.js +362 -0
- package/src/renderers/DayViewRenderer.js +4 -0
- package/src/renderers/MonthViewRenderer.js +4 -0
- package/src/renderers/WeekViewRenderer.js +4 -0
- package/src/utils/StyleUtils.js +28 -0
- package/types/components/ForceCalendar.d.ts +6 -0
- package/types/core/DragController.d.ts +56 -0
- package/types/utils/StyleUtils.d.ts +26 -0
|
@@ -677,7 +677,26 @@ var n = class extends HTMLElement {
|
|
|
677
677
|
};
|
|
678
678
|
return e.addEventListener("keydown", i), n?.focus(), () => e.removeEventListener("keydown", i);
|
|
679
679
|
}
|
|
680
|
-
}, c =
|
|
680
|
+
}, c = { slds: {
|
|
681
|
+
"--fc-primary-color": "#0176d3",
|
|
682
|
+
"--fc-primary-hover": "#014486",
|
|
683
|
+
"--fc-primary-light": "#eef4ff",
|
|
684
|
+
"--fc-accent-color": "#0b5cab",
|
|
685
|
+
"--fc-text-color": "#181818",
|
|
686
|
+
"--fc-text-secondary": "#706e6b",
|
|
687
|
+
"--fc-text-light": "#939393",
|
|
688
|
+
"--fc-border-color": "#e5e5e5",
|
|
689
|
+
"--fc-border-color-hover": "#c9c9c9",
|
|
690
|
+
"--fc-background": "#ffffff",
|
|
691
|
+
"--fc-background-alt": "#f3f3f3",
|
|
692
|
+
"--fc-background-hover": "#f3f3f3",
|
|
693
|
+
"--fc-background-active": "#d8e6fe",
|
|
694
|
+
"--fc-danger-color": "#ea001e",
|
|
695
|
+
"--fc-success-color": "#2e844a",
|
|
696
|
+
"--fc-border-radius": "0.25rem",
|
|
697
|
+
"--fc-border-radius-sm": "0.125rem",
|
|
698
|
+
"--fc-font-family": "'Salesforce Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"
|
|
699
|
+
} }, l = class {
|
|
681
700
|
static colors = {
|
|
682
701
|
primary: "#3B82F6",
|
|
683
702
|
secondary: "#64748B",
|
|
@@ -882,7 +901,7 @@ var n = class extends HTMLElement {
|
|
|
882
901
|
static getAnimations() {
|
|
883
902
|
return "\n @keyframes fc-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n\n @keyframes fc-slide-in-up {\n from {\n opacity: 0;\n transform: translateY(10px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n\n @keyframes fc-slide-in-down {\n from {\n opacity: 0;\n transform: translateY(-10px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n\n @keyframes fc-scale-in {\n from {\n opacity: 0;\n transform: scale(0.95);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n }\n\n @keyframes fc-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n\n .fc-fade-in {\n animation: fc-fade-in var(--fc-transition);\n }\n\n .fc-slide-in-up {\n animation: fc-slide-in-up var(--fc-transition);\n }\n\n .fc-scale-in {\n animation: fc-scale-in var(--fc-transition);\n }\n ";
|
|
884
903
|
}
|
|
885
|
-
},
|
|
904
|
+
}, u = class {
|
|
886
905
|
constructor(e, t) {
|
|
887
906
|
this.container = e, this.stateManager = t, this._listeners = [], this._scrolled = !1, this._nowIndicatorTimer = null;
|
|
888
907
|
}
|
|
@@ -921,7 +940,7 @@ var n = class extends HTMLElement {
|
|
|
921
940
|
return n === 0 ? `${i} ${r}` : `${i}:${n.toString().padStart(2, "0")} ${r}`;
|
|
922
941
|
}
|
|
923
942
|
getContrastingTextColor(e) {
|
|
924
|
-
return !e || typeof e != "string" || e.charAt(0) !== "#" ? "white" :
|
|
943
|
+
return !e || typeof e != "string" || e.charAt(0) !== "#" ? "white" : l.getContrastColor(e);
|
|
925
944
|
}
|
|
926
945
|
renderNowIndicator() {
|
|
927
946
|
let e = /* @__PURE__ */ new Date();
|
|
@@ -996,7 +1015,7 @@ var n = class extends HTMLElement {
|
|
|
996
1015
|
`;
|
|
997
1016
|
}
|
|
998
1017
|
getEventColor(e) {
|
|
999
|
-
return
|
|
1018
|
+
return l.sanitizeColor(e?.backgroundColor, "#2563eb");
|
|
1000
1019
|
}
|
|
1001
1020
|
attachCommonEventHandlers() {
|
|
1002
1021
|
this.addListener(this.container, "click", (e) => {
|
|
@@ -1099,7 +1118,213 @@ var n = class extends HTMLElement {
|
|
|
1099
1118
|
t && e.setAttribute("aria-label", `Event: ${t}`);
|
|
1100
1119
|
}
|
|
1101
1120
|
}
|
|
1102
|
-
},
|
|
1121
|
+
}, d = 4, f = 15, p = 1;
|
|
1122
|
+
function m(e, t = f) {
|
|
1123
|
+
return Math.round(e / t) * t;
|
|
1124
|
+
}
|
|
1125
|
+
function h(e, t) {
|
|
1126
|
+
return Math.max(0, Math.min(e, 1440 - t));
|
|
1127
|
+
}
|
|
1128
|
+
function g(e, t) {
|
|
1129
|
+
let n = new Date(e);
|
|
1130
|
+
return n.setHours(t.getHours(), t.getMinutes(), t.getSeconds(), t.getMilliseconds()), n;
|
|
1131
|
+
}
|
|
1132
|
+
var _ = class {
|
|
1133
|
+
constructor(e) {
|
|
1134
|
+
this.renderer = e, this.container = e.container, this.stateManager = e.stateManager, this._active = null, this._docListeners = [];
|
|
1135
|
+
}
|
|
1136
|
+
enableMonthMove() {
|
|
1137
|
+
this.renderer.addListener(this.container, "pointerdown", (e) => {
|
|
1138
|
+
if (e.button !== 0) return;
|
|
1139
|
+
let t = e.target.closest(".fc-event");
|
|
1140
|
+
!t || !this.container.contains(t) || t.closest(".fc-month-day") && this._arm(e, {
|
|
1141
|
+
mode: "month-move",
|
|
1142
|
+
eventEl: t,
|
|
1143
|
+
eventId: t.dataset.eventId,
|
|
1144
|
+
onDragMove: (e) => this._monthDragMove(e),
|
|
1145
|
+
onDrop: (e) => this._monthDrop(e)
|
|
1146
|
+
});
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
enableTimeGrid(e) {
|
|
1150
|
+
this._columnSelector = e, this._injectResizeHandles(), this.renderer.addListener(this.container, "pointerdown", (t) => {
|
|
1151
|
+
if (t.button !== 0) return;
|
|
1152
|
+
let n = t.target.closest(".fc-resize-handle");
|
|
1153
|
+
if (n) {
|
|
1154
|
+
let e = n.closest(".fc-timed-event");
|
|
1155
|
+
if (!e) return;
|
|
1156
|
+
t.preventDefault(), this._arm(t, {
|
|
1157
|
+
mode: "resize",
|
|
1158
|
+
eventEl: e,
|
|
1159
|
+
eventId: e.dataset.eventId,
|
|
1160
|
+
originTop: parseFloat(e.style.top) || 0,
|
|
1161
|
+
originHeight: parseFloat(e.style.height) || 30,
|
|
1162
|
+
onDragMove: (e) => this._resizeDragMove(e),
|
|
1163
|
+
onDrop: () => this._resizeDrop()
|
|
1164
|
+
});
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1167
|
+
let r = t.target.closest(".fc-timed-event");
|
|
1168
|
+
if (r && this.container.contains(r)) {
|
|
1169
|
+
this._arm(t, {
|
|
1170
|
+
mode: "time-move",
|
|
1171
|
+
eventEl: r,
|
|
1172
|
+
eventId: r.dataset.eventId,
|
|
1173
|
+
originTop: parseFloat(r.style.top) || 0,
|
|
1174
|
+
originColumn: r.closest(e),
|
|
1175
|
+
onDragMove: (e) => this._timeMoveDragMove(e),
|
|
1176
|
+
onDrop: () => this._timeMoveDrop()
|
|
1177
|
+
});
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1180
|
+
let i = t.target.closest(e);
|
|
1181
|
+
i && !t.target.closest(".fc-event") && this._arm(t, {
|
|
1182
|
+
mode: "create",
|
|
1183
|
+
column: i,
|
|
1184
|
+
onDragMove: (e) => this._createDragMove(e),
|
|
1185
|
+
onDrop: () => this._createDrop()
|
|
1186
|
+
});
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
_arm(e, t) {
|
|
1190
|
+
this._active = {
|
|
1191
|
+
...t,
|
|
1192
|
+
startX: e.clientX,
|
|
1193
|
+
startY: e.clientY,
|
|
1194
|
+
dragging: !1
|
|
1195
|
+
};
|
|
1196
|
+
let n = (e) => this._onPointerMove(e), r = (e) => this._onPointerUp(e), i = () => this._cancel(), a = (e) => {
|
|
1197
|
+
e.key === "Escape" && this._cancel();
|
|
1198
|
+
}, o = this.container.ownerDocument;
|
|
1199
|
+
o.addEventListener("pointermove", n), o.addEventListener("pointerup", r), o.addEventListener("pointercancel", i), o.addEventListener("keydown", a), this._docListeners = [
|
|
1200
|
+
["pointermove", n],
|
|
1201
|
+
["pointerup", r],
|
|
1202
|
+
["pointercancel", i],
|
|
1203
|
+
["keydown", a]
|
|
1204
|
+
];
|
|
1205
|
+
}
|
|
1206
|
+
_onPointerMove(e) {
|
|
1207
|
+
let t = this._active;
|
|
1208
|
+
if (t) {
|
|
1209
|
+
if (!t.dragging) {
|
|
1210
|
+
if (Math.abs(e.clientX - t.startX) < d && Math.abs(e.clientY - t.startY) < d) return;
|
|
1211
|
+
t.dragging = !0, t.eventEl && t.eventEl.classList.add("fc-dragging");
|
|
1212
|
+
}
|
|
1213
|
+
e.preventDefault(), t.onDragMove(e);
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
_onPointerUp(e) {
|
|
1217
|
+
let t = this._active;
|
|
1218
|
+
if (this._teardownDocListeners(), t) {
|
|
1219
|
+
if (t.dragging) {
|
|
1220
|
+
let n = this.container.ownerDocument, r = (e) => {
|
|
1221
|
+
e.stopPropagation(), e.preventDefault();
|
|
1222
|
+
};
|
|
1223
|
+
n.addEventListener("click", r, {
|
|
1224
|
+
capture: !0,
|
|
1225
|
+
once: !0
|
|
1226
|
+
}), setTimeout(() => n.removeEventListener("click", r, { capture: !0 }), 0), t.onDrop(e);
|
|
1227
|
+
}
|
|
1228
|
+
this._cleanupVisuals(t), this._active = null;
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
_cancel() {
|
|
1232
|
+
let e = this._active;
|
|
1233
|
+
this._teardownDocListeners(), this._active = null, e && this._cleanupVisuals(e);
|
|
1234
|
+
}
|
|
1235
|
+
_teardownDocListeners() {
|
|
1236
|
+
let e = this.container.ownerDocument;
|
|
1237
|
+
for (let [t, n] of this._docListeners) e.removeEventListener(t, n);
|
|
1238
|
+
this._docListeners = [];
|
|
1239
|
+
}
|
|
1240
|
+
_cleanupVisuals(e) {
|
|
1241
|
+
e.eventEl && (e.eventEl.classList.remove("fc-dragging"), e.eventEl.style.transform = ""), this.container.querySelectorAll(".fc-drop-target").forEach((e) => e.classList.remove("fc-drop-target")), this._selectionEl?.remove(), this._selectionEl = null;
|
|
1242
|
+
}
|
|
1243
|
+
_cellAtPoint(e, t) {
|
|
1244
|
+
for (let n of this.container.querySelectorAll(".fc-month-day")) {
|
|
1245
|
+
let r = n.getBoundingClientRect();
|
|
1246
|
+
if (e >= r.left && e < r.right && t >= r.top && t < r.bottom) return n;
|
|
1247
|
+
}
|
|
1248
|
+
return null;
|
|
1249
|
+
}
|
|
1250
|
+
_monthDragMove(e) {
|
|
1251
|
+
let t = this._active;
|
|
1252
|
+
t.eventEl.style.transform = `translate(${e.clientX - t.startX}px, ${e.clientY - t.startY}px)`;
|
|
1253
|
+
let n = this._cellAtPoint(e.clientX, e.clientY);
|
|
1254
|
+
n !== t.dropCell && (t.dropCell?.classList.remove("fc-drop-target"), n?.classList.add("fc-drop-target"), t.dropCell = n);
|
|
1255
|
+
}
|
|
1256
|
+
_monthDrop() {
|
|
1257
|
+
let e = this._active ?? {}, t = e.dropCell;
|
|
1258
|
+
if (!t) return;
|
|
1259
|
+
let n = this.stateManager.getEvents().find((t) => t.id === e.eventId);
|
|
1260
|
+
if (!n) return;
|
|
1261
|
+
let r = new Date(n.start), i = g(new Date(t.dataset.date), r), a = i.getTime() - r.getTime();
|
|
1262
|
+
a !== 0 && this.stateManager.updateEvent(e.eventId, {
|
|
1263
|
+
start: i,
|
|
1264
|
+
end: new Date(new Date(n.end).getTime() + a)
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1267
|
+
_columnAtPoint(e) {
|
|
1268
|
+
for (let t of this.container.querySelectorAll(this._columnSelector)) {
|
|
1269
|
+
let n = t.getBoundingClientRect();
|
|
1270
|
+
if (e >= n.left && e < n.right) return t;
|
|
1271
|
+
}
|
|
1272
|
+
return null;
|
|
1273
|
+
}
|
|
1274
|
+
_timeMoveDragMove(e) {
|
|
1275
|
+
let t = this._active, n = this._columnAtPoint(e.clientX) || t.originColumn;
|
|
1276
|
+
t.dropColumn = n, t.deltaMinutes = m((e.clientY - t.startY) / p);
|
|
1277
|
+
let r = t.originColumn.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
1278
|
+
t.eventEl.style.transform = `translate(${i.left - r.left}px, ${t.deltaMinutes * p}px)`;
|
|
1279
|
+
}
|
|
1280
|
+
_timeMoveDrop() {
|
|
1281
|
+
let e = this._active ?? {}, t = this.stateManager.getEvents().find((t) => t.id === e.eventId);
|
|
1282
|
+
if (!t || !e.deltaMinutes && e.dropColumn === e.originColumn) return;
|
|
1283
|
+
let n = new Date(t.start), r = new Date(t.end).getTime() - n.getTime(), i = g(e.dropColumn ? new Date(e.dropColumn.dataset.date) : n, n), a = h(i.getHours() * 60 + i.getMinutes() + (e.deltaMinutes || 0), Math.round(r / 6e4)), o = new Date(i);
|
|
1284
|
+
o.setHours(Math.floor(a / 60), a % 60, 0, 0), o.getTime() !== n.getTime() && this.stateManager.updateEvent(e.eventId, {
|
|
1285
|
+
start: o,
|
|
1286
|
+
end: new Date(o.getTime() + r)
|
|
1287
|
+
});
|
|
1288
|
+
}
|
|
1289
|
+
_resizeDragMove(e) {
|
|
1290
|
+
let t = this._active, n = m((e.clientY - t.startY) / p);
|
|
1291
|
+
t.newHeight = Math.max(f, t.originHeight + n), t.newHeight = Math.min(t.newHeight, 1440 - t.originTop), t.eventEl.style.height = `${t.newHeight}px`;
|
|
1292
|
+
}
|
|
1293
|
+
_resizeDrop() {
|
|
1294
|
+
let e = this._active ?? {};
|
|
1295
|
+
if (!e.newHeight || e.newHeight === e.originHeight) return;
|
|
1296
|
+
let t = this.stateManager.getEvents().find((t) => t.id === e.eventId);
|
|
1297
|
+
if (!t) return;
|
|
1298
|
+
let n = new Date(new Date(t.start).getTime() + e.newHeight * 6e4);
|
|
1299
|
+
this.stateManager.updateEvent(e.eventId, { end: n });
|
|
1300
|
+
}
|
|
1301
|
+
_createDragMove(e) {
|
|
1302
|
+
let t = this._active, n = t.column.getBoundingClientRect(), r = t.startY - n.top, i = e.clientY - n.top;
|
|
1303
|
+
t.fromMinutes = m(Math.min(r, i) / p), t.toMinutes = m(Math.max(r, i) / p), t.fromMinutes = Math.max(0, t.fromMinutes), t.toMinutes = Math.min(1440, Math.max(t.toMinutes, t.fromMinutes + f)), this._selectionEl || (this._selectionEl = this.container.ownerDocument.createElement("div"), this._selectionEl.className = "fc-drag-selection", t.column.appendChild(this._selectionEl)), this._selectionEl.style.top = `${t.fromMinutes * p}px`, this._selectionEl.style.height = `${(t.toMinutes - t.fromMinutes) * p}px`;
|
|
1304
|
+
}
|
|
1305
|
+
_createDrop() {
|
|
1306
|
+
let e = this._active ?? {};
|
|
1307
|
+
if (e.fromMinutes == null) return;
|
|
1308
|
+
let t = new Date(e.column.dataset.date);
|
|
1309
|
+
t.setHours(Math.floor(e.fromMinutes / 60), e.fromMinutes % 60, 0, 0);
|
|
1310
|
+
let n = new Date(e.column.dataset.date);
|
|
1311
|
+
n.setHours(Math.floor(e.toMinutes / 60), e.toMinutes % 60, 0, 0), this.container.dispatchEvent(new CustomEvent("range-select", {
|
|
1312
|
+
detail: {
|
|
1313
|
+
start: t,
|
|
1314
|
+
end: n
|
|
1315
|
+
},
|
|
1316
|
+
bubbles: !0,
|
|
1317
|
+
composed: !0
|
|
1318
|
+
}));
|
|
1319
|
+
}
|
|
1320
|
+
_injectResizeHandles() {
|
|
1321
|
+
for (let e of this.container.querySelectorAll(".fc-timed-event")) {
|
|
1322
|
+
if (e.querySelector(".fc-resize-handle")) continue;
|
|
1323
|
+
let t = this.container.ownerDocument.createElement("div");
|
|
1324
|
+
t.className = "fc-resize-handle", t.setAttribute("aria-hidden", "true"), e.appendChild(t);
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
}, v = class extends u {
|
|
1103
1328
|
constructor(e, t) {
|
|
1104
1329
|
super(e, t), this.maxEventsToShow = 3;
|
|
1105
1330
|
}
|
|
@@ -1232,7 +1457,7 @@ var n = class extends HTMLElement {
|
|
|
1232
1457
|
let e = new Date(t.dataset.date);
|
|
1233
1458
|
e.setDate(e.getDate() + (i - r)), this._pendingFocusMs = e.getTime(), i < 0 ? this.stateManager.previous() : this.stateManager.next();
|
|
1234
1459
|
}
|
|
1235
|
-
}), this.attachCommonEventHandlers();
|
|
1460
|
+
}), this.attachCommonEventHandlers(), new _(this).enableMonthMove();
|
|
1236
1461
|
}
|
|
1237
1462
|
_applyRovingTabindex(e = null) {
|
|
1238
1463
|
let t = Array.from(this.container.querySelectorAll(".fc-month-day"));
|
|
@@ -1242,7 +1467,7 @@ var n = class extends HTMLElement {
|
|
|
1242
1467
|
for (let e of t) e.setAttribute("tabindex", e === n ? "0" : "-1");
|
|
1243
1468
|
return n;
|
|
1244
1469
|
}
|
|
1245
|
-
},
|
|
1470
|
+
}, y = class extends u {
|
|
1246
1471
|
constructor(e, t) {
|
|
1247
1472
|
super(e, t), this.hourHeight = 60, this.totalHeight = 24 * this.hourHeight;
|
|
1248
1473
|
}
|
|
@@ -1367,14 +1592,14 @@ var n = class extends HTMLElement {
|
|
|
1367
1592
|
day: "numeric",
|
|
1368
1593
|
year: "numeric"
|
|
1369
1594
|
}).format(n)}`;
|
|
1370
|
-
this._enhanceTimeGridAccessibility(".fc-week-day-column", r);
|
|
1595
|
+
this._enhanceTimeGridAccessibility(".fc-week-day-column", r), new _(this).enableTimeGrid(".fc-week-day-column");
|
|
1371
1596
|
}
|
|
1372
1597
|
_scrollToCurrentTime() {
|
|
1373
1598
|
if (this._scrolled) return;
|
|
1374
1599
|
let e = this.container.querySelector("#week-scroll-container");
|
|
1375
1600
|
e && (e.scrollTop = 8 * this.hourHeight - 50, this._scrolled = !0);
|
|
1376
1601
|
}
|
|
1377
|
-
},
|
|
1602
|
+
}, b = class extends u {
|
|
1378
1603
|
constructor(e, t) {
|
|
1379
1604
|
super(e, t), this.hourHeight = 60, this.totalHeight = 24 * this.hourHeight;
|
|
1380
1605
|
}
|
|
@@ -1511,14 +1736,14 @@ var n = class extends HTMLElement {
|
|
|
1511
1736
|
day: "numeric",
|
|
1512
1737
|
year: "numeric"
|
|
1513
1738
|
}).format(t);
|
|
1514
|
-
this._enhanceTimeGridAccessibility(".fc-day-column", n);
|
|
1739
|
+
this._enhanceTimeGridAccessibility(".fc-day-column", n), new _(this).enableTimeGrid(".fc-day-column");
|
|
1515
1740
|
}
|
|
1516
1741
|
_scrollToCurrentTime() {
|
|
1517
1742
|
if (this._scrolled) return;
|
|
1518
1743
|
let e = this.container.querySelector("#day-scroll-container");
|
|
1519
1744
|
e && (e.scrollTop = 8 * this.hourHeight - 50, this._scrolled = !0);
|
|
1520
1745
|
}
|
|
1521
|
-
},
|
|
1746
|
+
}, x = class extends n {
|
|
1522
1747
|
constructor() {
|
|
1523
1748
|
super(), this._isVisible = !1, this._cleanupFocusTrap = null, this.config = {
|
|
1524
1749
|
title: "New Event",
|
|
@@ -1565,8 +1790,8 @@ var n = class extends HTMLElement {
|
|
|
1565
1790
|
}
|
|
1566
1791
|
getStyles() {
|
|
1567
1792
|
return `
|
|
1568
|
-
${
|
|
1569
|
-
${
|
|
1793
|
+
${l.getBaseStyles()}
|
|
1794
|
+
${l.getButtonStyles()}
|
|
1570
1795
|
|
|
1571
1796
|
:host {
|
|
1572
1797
|
display: none;
|
|
@@ -1773,7 +1998,7 @@ var n = class extends HTMLElement {
|
|
|
1773
1998
|
${this.config.colors.map((e) => `
|
|
1774
1999
|
<button type="button"
|
|
1775
2000
|
class="color-btn ${e.color === this._formData.color ? "selected" : ""}"
|
|
1776
|
-
style="background-color: ${
|
|
2001
|
+
style="background-color: ${l.sanitizeColor(e.color)}"
|
|
1777
2002
|
data-color="${s.escapeHTML(e.color)}"
|
|
1778
2003
|
title="${s.escapeHTML(e.label)}"
|
|
1779
2004
|
aria-label="${s.escapeHTML(e.label)}"
|
|
@@ -1838,14 +2063,14 @@ var n = class extends HTMLElement {
|
|
|
1838
2063
|
this._cleanupFocusTrap && this._cleanupFocusTrap(), this._handleKeyDown && (window.removeEventListener("keydown", this._handleKeyDown), this._handleKeyDown = null, this._keydownListenerAdded = !1);
|
|
1839
2064
|
}
|
|
1840
2065
|
};
|
|
1841
|
-
customElements.get("forcecal-event-form") || customElements.define("forcecal-event-form",
|
|
2066
|
+
customElements.get("forcecal-event-form") || customElements.define("forcecal-event-form", x);
|
|
1842
2067
|
//#endregion
|
|
1843
2068
|
//#region src/components/ForceCalendar.js
|
|
1844
|
-
var
|
|
2069
|
+
var S = class e extends n {
|
|
1845
2070
|
static RENDERERS = {
|
|
1846
|
-
month:
|
|
1847
|
-
week:
|
|
1848
|
-
day:
|
|
2071
|
+
month: v,
|
|
2072
|
+
week: y,
|
|
2073
|
+
day: b
|
|
1849
2074
|
};
|
|
1850
2075
|
static get observedAttributes() {
|
|
1851
2076
|
return [
|
|
@@ -1854,7 +2079,8 @@ var m = class e extends n {
|
|
|
1854
2079
|
"locale",
|
|
1855
2080
|
"timezone",
|
|
1856
2081
|
"week-starts-on",
|
|
1857
|
-
"height"
|
|
2082
|
+
"height",
|
|
2083
|
+
"theme"
|
|
1858
2084
|
];
|
|
1859
2085
|
}
|
|
1860
2086
|
constructor() {
|
|
@@ -1955,7 +2181,7 @@ var m = class e extends n {
|
|
|
1955
2181
|
if (t) {
|
|
1956
2182
|
this._currentViewInstance && this._currentViewInstance.cleanup && this._currentViewInstance.cleanup();
|
|
1957
2183
|
try {
|
|
1958
|
-
let n = new (e.RENDERERS[this.currentView] ||
|
|
2184
|
+
let n = new (e.RENDERERS[this.currentView] || v)(t, this.stateManager);
|
|
1959
2185
|
n._viewType = this.currentView, this._currentViewInstance = n, n.render();
|
|
1960
2186
|
} catch (e) {
|
|
1961
2187
|
console.error("[ForceCalendar] Error switching view:", e);
|
|
@@ -1978,10 +2204,10 @@ var m = class e extends n {
|
|
|
1978
2204
|
getStyles() {
|
|
1979
2205
|
let e = this.getAttribute("height") || "800px";
|
|
1980
2206
|
return `
|
|
1981
|
-
${
|
|
1982
|
-
${
|
|
1983
|
-
${
|
|
1984
|
-
${
|
|
2207
|
+
${l.getBaseStyles()}
|
|
2208
|
+
${l.getButtonStyles()}
|
|
2209
|
+
${l.getGridStyles()}
|
|
2210
|
+
${l.getAnimations()}
|
|
1985
2211
|
|
|
1986
2212
|
:host {
|
|
1987
2213
|
--calendar-height: ${e};
|
|
@@ -2089,6 +2315,39 @@ var m = class e extends n {
|
|
|
2089
2315
|
outline-offset: -2px;
|
|
2090
2316
|
}
|
|
2091
2317
|
|
|
2318
|
+
.fc-event { touch-action: none; }
|
|
2319
|
+
|
|
2320
|
+
.fc-dragging {
|
|
2321
|
+
opacity: 0.6;
|
|
2322
|
+
z-index: 30;
|
|
2323
|
+
pointer-events: none;
|
|
2324
|
+
}
|
|
2325
|
+
|
|
2326
|
+
.fc-drop-target {
|
|
2327
|
+
outline: 2px dashed var(--fc-primary-color);
|
|
2328
|
+
outline-offset: -2px;
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
.fc-resize-handle {
|
|
2332
|
+
position: absolute;
|
|
2333
|
+
left: 0;
|
|
2334
|
+
right: 0;
|
|
2335
|
+
bottom: 0;
|
|
2336
|
+
height: 6px;
|
|
2337
|
+
cursor: ns-resize;
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
.fc-drag-selection {
|
|
2341
|
+
position: absolute;
|
|
2342
|
+
left: 2px;
|
|
2343
|
+
right: 2px;
|
|
2344
|
+
background: color-mix(in srgb, var(--fc-primary-color) 18%, transparent);
|
|
2345
|
+
border: 1px solid var(--fc-primary-color);
|
|
2346
|
+
border-radius: 4px;
|
|
2347
|
+
pointer-events: none;
|
|
2348
|
+
z-index: 20;
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2092
2351
|
.fc-nav-arrow:focus-visible,
|
|
2093
2352
|
.fc-btn:focus-visible,
|
|
2094
2353
|
.fc-btn-today:focus-visible,
|
|
@@ -2443,13 +2702,18 @@ var m = class e extends n {
|
|
|
2443
2702
|
renderView() {
|
|
2444
2703
|
return "<div id=\"calendar-view-container\"></div>";
|
|
2445
2704
|
}
|
|
2705
|
+
_applyTheme(e) {
|
|
2706
|
+
let t = c[e];
|
|
2707
|
+
for (let e of Object.keys(c.slds)) t && t[e] ? this.style.setProperty(e, t[e]) : this.style.removeProperty(e);
|
|
2708
|
+
}
|
|
2446
2709
|
afterRender() {
|
|
2710
|
+
this._applyTheme(this.getAttribute("theme"));
|
|
2447
2711
|
let t = this.$("#calendar-view-container");
|
|
2448
2712
|
if (t && this.stateManager && this.currentView) {
|
|
2449
2713
|
if (this._currentViewInstance && this._currentViewInstance._viewType === this.currentView && t.children.length > 0) return;
|
|
2450
2714
|
this._currentViewInstance && (this._currentViewInstance.cleanup && this._currentViewInstance.cleanup(), this._viewUnsubscribe &&= (this._viewUnsubscribe(), null));
|
|
2451
2715
|
try {
|
|
2452
|
-
let n = new (e.RENDERERS[this.currentView] ||
|
|
2716
|
+
let n = new (e.RENDERERS[this.currentView] || v)(t, this.stateManager);
|
|
2453
2717
|
n._viewType = this.currentView, this._currentViewInstance = n, n.render();
|
|
2454
2718
|
} catch (e) {
|
|
2455
2719
|
console.error("[ForceCalendar] Error creating/rendering view:", e);
|
|
@@ -2465,6 +2729,8 @@ var m = class e extends n {
|
|
|
2465
2729
|
n.open(/* @__PURE__ */ new Date());
|
|
2466
2730
|
}), this.addListener(this.shadowRoot, "day-click", (e) => {
|
|
2467
2731
|
n && n.open(e.detail.date);
|
|
2732
|
+
}), this.addListener(this.shadowRoot, "range-select", (e) => {
|
|
2733
|
+
this.emit("calendar-range-select", e.detail), n && n.open(e.detail.start);
|
|
2468
2734
|
}), n && this.addListener(n, "save", (e) => {
|
|
2469
2735
|
let t = e.detail, n = window.crypto && typeof window.crypto.randomUUID == "function" ? window.crypto.randomUUID() : Math.random().toString(36).substring(2, 15);
|
|
2470
2736
|
this.stateManager.addEvent({
|
|
@@ -2543,8 +2809,8 @@ var m = class e extends n {
|
|
|
2543
2809
|
this._busUnsubscribers.forEach((e) => e()), this._busUnsubscribers = [], this._stateUnsubscribe &&= (this._stateUnsubscribe(), null), this._currentViewInstance && this._currentViewInstance.cleanup && (this._currentViewInstance.cleanup(), this._currentViewInstance = null), this.stateManager && this.stateManager.destroy(), super.cleanup();
|
|
2544
2810
|
}
|
|
2545
2811
|
};
|
|
2546
|
-
customElements.get("forcecal-main") || customElements.define("forcecal-main",
|
|
2812
|
+
customElements.get("forcecal-main") || customElements.define("forcecal-main", S);
|
|
2547
2813
|
//#endregion
|
|
2548
|
-
export { n as BaseComponent,
|
|
2814
|
+
export { n as BaseComponent, u as BaseViewRenderer, s as DOMUtils, o as DateUtils, b as DayViewRenderer, r as EventBus, S as ForceCalendar, v as MonthViewRenderer, a as StateManager, l as StyleUtils, y as WeekViewRenderer, i as eventBus };
|
|
2549
2815
|
|
|
2550
2816
|
//# sourceMappingURL=force-calendar-interface.esm.js.map
|