@forcecalendar/interface 1.0.25 → 1.0.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forcecalendar/interface",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "type": "module",
5
5
  "description": "Official interface layer for forceCalendar Core - Enterprise calendar components",
6
6
  "main": "dist/force-calendar-interface.umd.js",
@@ -211,16 +211,17 @@ export class BaseViewRenderer {
211
211
  * Attach common event handlers for day/event clicks
212
212
  */
213
213
  attachCommonEventHandlers() {
214
- // Event click handlers
215
- this.container.querySelectorAll('.fc-event').forEach(eventEl => {
216
- this.addListener(eventEl, 'click', (e) => {
217
- e.stopPropagation();
218
- const eventId = eventEl.dataset.eventId;
219
- const event = this.stateManager.getEvents().find(ev => ev.id === eventId);
220
- if (event) {
221
- this.stateManager.selectEvent(event);
222
- }
223
- });
214
+ // Delegate event clicks at container level to avoid rebinding per event node.
215
+ this.addListener(this.container, 'click', (e) => {
216
+ const eventEl = e.target.closest('.fc-event');
217
+ if (!eventEl || !this.container.contains(eventEl)) return;
218
+
219
+ e.stopPropagation();
220
+ const eventId = eventEl.dataset.eventId;
221
+ const event = this.stateManager.getEvents().find(ev => ev.id === eventId);
222
+ if (event) {
223
+ this.stateManager.selectEvent(event);
224
+ }
224
225
  });
225
226
  }
226
227
  }
@@ -164,20 +164,19 @@ export class DayViewRenderer extends BaseViewRenderer {
164
164
  }
165
165
 
166
166
  _attachEventHandlers() {
167
- // Day column click handler
168
- this.container.querySelectorAll('.fc-day-column').forEach(dayEl => {
169
- this.addListener(dayEl, 'click', (e) => {
170
- if (e.target.closest('.fc-event')) return;
171
-
172
- const date = new Date(dayEl.dataset.date);
173
- const rect = dayEl.getBoundingClientRect();
174
- const scrollContainer = this.container.querySelector('#day-scroll-container');
175
- const y = e.clientY - rect.top + (scrollContainer ? scrollContainer.scrollTop : 0);
176
-
177
- // Calculate time from click position
178
- date.setHours(Math.floor(y / this.hourHeight), Math.floor((y % this.hourHeight) / (this.hourHeight / 60)), 0, 0);
179
- this.stateManager.selectDate(date);
180
- });
167
+ this.addListener(this.container, 'click', (e) => {
168
+ const dayEl = e.target.closest('.fc-day-column');
169
+ if (!dayEl || !this.container.contains(dayEl)) return;
170
+ if (e.target.closest('.fc-event')) return;
171
+
172
+ const date = new Date(dayEl.dataset.date);
173
+ const rect = dayEl.getBoundingClientRect();
174
+ const scrollContainer = this.container.querySelector('#day-scroll-container');
175
+ const y = e.clientY - rect.top + (scrollContainer ? scrollContainer.scrollTop : 0);
176
+
177
+ // Calculate time from click position
178
+ date.setHours(Math.floor(y / this.hourHeight), Math.floor((y % this.hourHeight) / (this.hourHeight / 60)), 0, 0);
179
+ this.stateManager.selectDate(date);
181
180
  });
182
181
 
183
182
  // Common event handlers (event clicks)
@@ -108,13 +108,13 @@ export class MonthViewRenderer extends BaseViewRenderer {
108
108
  }
109
109
 
110
110
  _attachEventHandlers() {
111
- // Day click handlers
112
- this.container.querySelectorAll('.fc-month-day').forEach(dayEl => {
113
- this.addListener(dayEl, 'click', (e) => {
114
- if (e.target.closest('.fc-event')) return;
115
- const date = new Date(dayEl.dataset.date);
116
- this.stateManager.selectDate(date);
117
- });
111
+ this.addListener(this.container, 'click', (e) => {
112
+ const dayEl = e.target.closest('.fc-month-day');
113
+ if (!dayEl || !this.container.contains(dayEl)) return;
114
+ if (e.target.closest('.fc-event')) return;
115
+
116
+ const date = new Date(dayEl.dataset.date);
117
+ this.stateManager.selectDate(date);
118
118
  });
119
119
 
120
120
  // Common event handlers (event clicks)
@@ -136,20 +136,19 @@ export class WeekViewRenderer extends BaseViewRenderer {
136
136
  }
137
137
 
138
138
  _attachEventHandlers() {
139
- // Day column click handlers
140
- this.container.querySelectorAll('.fc-week-day-column').forEach(dayEl => {
141
- this.addListener(dayEl, 'click', (e) => {
142
- if (e.target.closest('.fc-event')) return;
143
-
144
- const date = new Date(dayEl.dataset.date);
145
- const rect = dayEl.getBoundingClientRect();
146
- const scrollContainer = this.container.querySelector('#week-scroll-container');
147
- const y = e.clientY - rect.top + (scrollContainer ? scrollContainer.scrollTop : 0);
148
-
149
- // Calculate time from click position
150
- date.setHours(Math.floor(y / this.hourHeight), Math.floor((y % this.hourHeight) / (this.hourHeight / 60)), 0, 0);
151
- this.stateManager.selectDate(date);
152
- });
139
+ this.addListener(this.container, 'click', (e) => {
140
+ const dayEl = e.target.closest('.fc-week-day-column');
141
+ if (!dayEl || !this.container.contains(dayEl)) return;
142
+ if (e.target.closest('.fc-event')) return;
143
+
144
+ const date = new Date(dayEl.dataset.date);
145
+ const rect = dayEl.getBoundingClientRect();
146
+ const scrollContainer = this.container.querySelector('#week-scroll-container');
147
+ const y = e.clientY - rect.top + (scrollContainer ? scrollContainer.scrollTop : 0);
148
+
149
+ // Calculate time from click position
150
+ date.setHours(Math.floor(y / this.hourHeight), Math.floor((y % this.hourHeight) / (this.hourHeight / 60)), 0, 0);
151
+ this.stateManager.selectDate(date);
153
152
  });
154
153
 
155
154
  // Common event handlers (event clicks)