@forcecalendar/interface 1.0.22 → 1.0.24
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 +73 -51
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +10 -13
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ForceCalendar.js +56 -17
- package/src/core/StateManager.js +4 -1
package/package.json
CHANGED
|
@@ -68,9 +68,31 @@ export class ForceCalendar extends BaseComponent {
|
|
|
68
68
|
this.emit('calendar-view-change', data);
|
|
69
69
|
}));
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
const forwardEventAction = (action, data) => {
|
|
72
|
+
this.emit(`calendar-event-${action}`, data);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// Event management events (canonical + backward-compatible aliases)
|
|
76
|
+
this._busUnsubscribers.push(eventBus.on('event:add', (data) => {
|
|
77
|
+
forwardEventAction('add', data);
|
|
78
|
+
}));
|
|
79
|
+
this._busUnsubscribers.push(eventBus.on('event:update', (data) => {
|
|
80
|
+
forwardEventAction('update', data);
|
|
81
|
+
}));
|
|
82
|
+
this._busUnsubscribers.push(eventBus.on('event:remove', (data) => {
|
|
83
|
+
forwardEventAction('remove', data);
|
|
84
|
+
}));
|
|
85
|
+
this._busUnsubscribers.push(eventBus.on('event:added', (data) => {
|
|
86
|
+
forwardEventAction('add', data);
|
|
87
|
+
this.emit('calendar-event-added', data);
|
|
88
|
+
}));
|
|
89
|
+
this._busUnsubscribers.push(eventBus.on('event:updated', (data) => {
|
|
90
|
+
forwardEventAction('update', data);
|
|
91
|
+
this.emit('calendar-event-updated', data);
|
|
92
|
+
}));
|
|
93
|
+
this._busUnsubscribers.push(eventBus.on('event:deleted', (data) => {
|
|
94
|
+
forwardEventAction('remove', data);
|
|
95
|
+
this.emit('calendar-event-deleted', data);
|
|
74
96
|
}));
|
|
75
97
|
|
|
76
98
|
// Date selection events
|
|
@@ -93,10 +115,14 @@ export class ForceCalendar extends BaseComponent {
|
|
|
93
115
|
const errorChanged = newState.error !== oldState?.error;
|
|
94
116
|
|
|
95
117
|
// For loading/error state changes, do full re-render (rare)
|
|
96
|
-
if (
|
|
118
|
+
if (errorChanged) {
|
|
97
119
|
this.render();
|
|
98
120
|
return;
|
|
99
121
|
}
|
|
122
|
+
if (loadingChanged) {
|
|
123
|
+
this._updateLoadingState(newState.loading);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
100
126
|
|
|
101
127
|
// Update local view reference if needed
|
|
102
128
|
if (viewChanged) {
|
|
@@ -184,15 +210,31 @@ export class ForceCalendar extends BaseComponent {
|
|
|
184
210
|
}
|
|
185
211
|
}
|
|
186
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Toggle loading overlay without rebuilding the component tree.
|
|
215
|
+
*/
|
|
216
|
+
_updateLoadingState(isLoading) {
|
|
217
|
+
const loadingEl = this.$('.fc-loading');
|
|
218
|
+
const viewContainer = this.$('.fc-view-container');
|
|
219
|
+
if (loadingEl) {
|
|
220
|
+
loadingEl.style.display = isLoading ? 'flex' : 'none';
|
|
221
|
+
}
|
|
222
|
+
if (viewContainer) {
|
|
223
|
+
viewContainer.style.display = isLoading ? 'none' : 'flex';
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
187
227
|
mount() {
|
|
228
|
+
this.currentView = this.stateManager.getView();
|
|
188
229
|
super.mount();
|
|
189
|
-
this.loadView(this.stateManager.getView());
|
|
190
230
|
}
|
|
191
231
|
|
|
192
232
|
loadView(viewType) {
|
|
193
|
-
|
|
233
|
+
if (!viewType || this.currentView === viewType) return;
|
|
194
234
|
this.currentView = viewType;
|
|
195
|
-
this.
|
|
235
|
+
this._switchView();
|
|
236
|
+
this._updateViewButtons();
|
|
237
|
+
this._updateTitle();
|
|
196
238
|
}
|
|
197
239
|
|
|
198
240
|
getStyles() {
|
|
@@ -637,16 +679,13 @@ export class ForceCalendar extends BaseComponent {
|
|
|
637
679
|
</header>
|
|
638
680
|
|
|
639
681
|
<div class="fc-body">
|
|
640
|
-
${loading ?
|
|
641
|
-
<div class="fc-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
${this.renderView()}
|
|
648
|
-
</div>
|
|
649
|
-
`}
|
|
682
|
+
<div class="fc-loading" style="display: ${loading ? 'flex' : 'none'};">
|
|
683
|
+
<div class="fc-spinner"></div>
|
|
684
|
+
<span>Loading...</span>
|
|
685
|
+
</div>
|
|
686
|
+
<div class="fc-view-container" style="display: ${loading ? 'none' : 'flex'};">
|
|
687
|
+
${this.renderView()}
|
|
688
|
+
</div>
|
|
650
689
|
</div>
|
|
651
690
|
|
|
652
691
|
<forcecal-event-form id="event-modal"></forcecal-event-form>
|
package/src/core/StateManager.js
CHANGED
|
@@ -215,6 +215,7 @@ class StateManager {
|
|
|
215
215
|
}
|
|
216
216
|
// Sync from Core to ensure consistency (single source of truth)
|
|
217
217
|
this._syncEventsFromCore();
|
|
218
|
+
eventBus.emit('event:add', { event: addedEvent });
|
|
218
219
|
eventBus.emit('event:added', { event: addedEvent });
|
|
219
220
|
return addedEvent;
|
|
220
221
|
}
|
|
@@ -232,6 +233,7 @@ class StateManager {
|
|
|
232
233
|
|
|
233
234
|
// Sync from Core to ensure consistency (single source of truth)
|
|
234
235
|
this._syncEventsFromCore();
|
|
236
|
+
eventBus.emit('event:update', { event });
|
|
235
237
|
eventBus.emit('event:updated', { event });
|
|
236
238
|
return event;
|
|
237
239
|
}
|
|
@@ -248,6 +250,7 @@ class StateManager {
|
|
|
248
250
|
}
|
|
249
251
|
// Sync from Core to ensure consistency (single source of truth)
|
|
250
252
|
this._syncEventsFromCore();
|
|
253
|
+
eventBus.emit('event:remove', { eventId });
|
|
251
254
|
eventBus.emit('event:deleted', { eventId });
|
|
252
255
|
return true;
|
|
253
256
|
}
|
|
@@ -409,4 +412,4 @@ class StateManager {
|
|
|
409
412
|
}
|
|
410
413
|
|
|
411
414
|
// Export StateManager
|
|
412
|
-
export default StateManager;
|
|
415
|
+
export default StateManager;
|