@forcecalendar/interface 1.0.24 → 1.0.25
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 +31 -23
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +13 -13
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/renderers/BaseViewRenderer.js +10 -1
- package/src/renderers/DayViewRenderer.js +1 -1
- package/src/renderers/MonthViewRenderer.js +1 -1
- package/src/renderers/WeekViewRenderer.js +1 -1
package/package.json
CHANGED
|
@@ -171,7 +171,7 @@ export class BaseViewRenderer {
|
|
|
171
171
|
const end = new Date(event.end);
|
|
172
172
|
const startMinutes = start.getHours() * 60 + start.getMinutes();
|
|
173
173
|
const durationMinutes = Math.max((end - start) / (1000 * 60), compact ? 20 : 30);
|
|
174
|
-
const color = event
|
|
174
|
+
const color = this.getEventColor(event);
|
|
175
175
|
|
|
176
176
|
const padding = compact ? '4px 8px' : '8px 12px';
|
|
177
177
|
const fontSize = compact ? '11px' : '13px';
|
|
@@ -198,6 +198,15 @@ export class BaseViewRenderer {
|
|
|
198
198
|
`;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
/**
|
|
202
|
+
* Get a safe, sanitized event color value.
|
|
203
|
+
* @param {Object} event
|
|
204
|
+
* @returns {string}
|
|
205
|
+
*/
|
|
206
|
+
getEventColor(event) {
|
|
207
|
+
return StyleUtils.sanitizeColor(event?.backgroundColor, '#2563eb');
|
|
208
|
+
}
|
|
209
|
+
|
|
201
210
|
/**
|
|
202
211
|
* Attach common event handlers for day/event clicks
|
|
203
212
|
*/
|
|
@@ -116,7 +116,7 @@ export class DayViewRenderer extends BaseViewRenderer {
|
|
|
116
116
|
<div class="fc-all-day-cell" data-date="${dayDate.toISOString()}" style="padding: 6px 12px; display: flex; flex-wrap: wrap; gap: 4px;">
|
|
117
117
|
${allDayEvents.map(evt => `
|
|
118
118
|
<div class="fc-event fc-all-day-event" data-event-id="${this.escapeHTML(evt.id)}"
|
|
119
|
-
style="background-color: ${evt
|
|
119
|
+
style="background-color: ${this.getEventColor(evt)}; font-size: 12px; padding: 4px 8px; border-radius: 4px; color: white; cursor: pointer; font-weight: 500;">
|
|
120
120
|
${this.escapeHTML(evt.title)}
|
|
121
121
|
</div>
|
|
122
122
|
`).join('')}
|
|
@@ -98,7 +98,7 @@ export class MonthViewRenderer extends BaseViewRenderer {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
_renderEvent(event) {
|
|
101
|
-
const color = event
|
|
101
|
+
const color = this.getEventColor(event);
|
|
102
102
|
return `
|
|
103
103
|
<div class="fc-event" data-event-id="${this.escapeHTML(event.id)}"
|
|
104
104
|
style="background-color: ${color}; font-size: 11px; padding: 2px 6px; border-radius: 3px; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;">
|
|
@@ -87,7 +87,7 @@ export class WeekViewRenderer extends BaseViewRenderer {
|
|
|
87
87
|
<div class="fc-all-day-cell" data-date="${day.date.toISOString()}" style="border-right: 1px solid #e5e7eb; padding: 4px; display: flex; flex-direction: column; gap: 2px;">
|
|
88
88
|
${day.allDayEvents.map(evt => `
|
|
89
89
|
<div class="fc-event fc-all-day-event" data-event-id="${this.escapeHTML(evt.id)}"
|
|
90
|
-
style="background-color: ${evt
|
|
90
|
+
style="background-color: ${this.getEventColor(evt)}; font-size: 10px; padding: 2px 4px; border-radius: 2px; color: white; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
|
91
91
|
${this.escapeHTML(evt.title)}
|
|
92
92
|
</div>
|
|
93
93
|
`).join('')}
|