@forcecalendar/interface 1.0.7 → 1.0.9
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 +1566 -1538
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +14 -14
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ForceCalendar.js +19 -0
- package/src/components/views/DayView.js +20 -8
- package/src/components/views/MonthView.js +29 -10
- package/src/components/views/WeekView.js +20 -8
package/package.json
CHANGED
|
@@ -436,6 +436,16 @@ export class ForceCalendar extends BaseComponent {
|
|
|
436
436
|
console.log('[ForceCalendar] afterRender - stateManager:', !!this.stateManager);
|
|
437
437
|
|
|
438
438
|
if (viewElement && this.stateManager) {
|
|
439
|
+
// Debug: check what's available on the viewElement
|
|
440
|
+
console.log('[ForceCalendar] viewElement.constructor.name:', viewElement.constructor?.name);
|
|
441
|
+
console.log('[ForceCalendar] viewElement methods:', Object.getOwnPropertyNames(Object.getPrototypeOf(viewElement)));
|
|
442
|
+
|
|
443
|
+
// Try to force custom element upgrade (Locker Service may prevent auto-upgrade)
|
|
444
|
+
if (typeof customElements !== 'undefined' && customElements.upgrade) {
|
|
445
|
+
console.log('[ForceCalendar] Forcing custom element upgrade');
|
|
446
|
+
customElements.upgrade(viewElement);
|
|
447
|
+
}
|
|
448
|
+
|
|
439
449
|
// Store stateManager in global registry (bypasses Locker Service proxy issues)
|
|
440
450
|
const registryId = this._registryId || (this._registryId = 'fc-' + Math.random().toString(36).substr(2, 9));
|
|
441
451
|
window.__forceCalendarRegistry = window.__forceCalendarRegistry || {};
|
|
@@ -444,6 +454,15 @@ export class ForceCalendar extends BaseComponent {
|
|
|
444
454
|
// Pass registry ID via attribute (attributes work through Locker Service)
|
|
445
455
|
viewElement.setAttribute('data-state-registry', registryId);
|
|
446
456
|
console.log('[ForceCalendar] Set registry ID:', registryId);
|
|
457
|
+
|
|
458
|
+
// Also try direct initialization if the element has the method
|
|
459
|
+
if (viewElement._checkRegistry) {
|
|
460
|
+
console.log('[ForceCalendar] Calling _checkRegistry directly');
|
|
461
|
+
viewElement._checkRegistry();
|
|
462
|
+
} else if (viewElement.setStateManager) {
|
|
463
|
+
console.log('[ForceCalendar] Calling setStateManager directly');
|
|
464
|
+
viewElement.setStateManager(this.stateManager);
|
|
465
|
+
}
|
|
447
466
|
} else {
|
|
448
467
|
console.log('[ForceCalendar] Could not set stateManager - viewElement:', !!viewElement, 'stateManager:', !!this.stateManager);
|
|
449
468
|
}
|
|
@@ -10,31 +10,43 @@ import { StyleUtils } from '../../utils/StyleUtils.js';
|
|
|
10
10
|
import { DOMUtils } from '../../utils/DOMUtils.js';
|
|
11
11
|
|
|
12
12
|
export class DayView extends BaseComponent {
|
|
13
|
-
static get observedAttributes() {
|
|
14
|
-
return ['data-state-registry'];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
13
|
constructor() {
|
|
18
14
|
super();
|
|
19
15
|
this._stateManager = null;
|
|
20
16
|
this.viewData = null;
|
|
21
17
|
this.hours = Array.from({ length: 24 }, (_, i) => i);
|
|
18
|
+
this._registryCheckInterval = null;
|
|
22
19
|
}
|
|
23
20
|
|
|
24
21
|
connectedCallback() {
|
|
25
22
|
super.connectedCallback();
|
|
26
|
-
this.
|
|
23
|
+
this._startRegistryPolling();
|
|
27
24
|
}
|
|
28
25
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
disconnectedCallback() {
|
|
27
|
+
super.disconnectedCallback();
|
|
28
|
+
if (this._registryCheckInterval) {
|
|
29
|
+
clearInterval(this._registryCheckInterval);
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
32
|
|
|
33
|
+
_startRegistryPolling() {
|
|
34
|
+
this._checkRegistry();
|
|
35
|
+
let attempts = 0;
|
|
36
|
+
this._registryCheckInterval = setInterval(() => {
|
|
37
|
+
attempts++;
|
|
38
|
+
if (this._stateManager || attempts > 50) {
|
|
39
|
+
clearInterval(this._registryCheckInterval);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
this._checkRegistry();
|
|
43
|
+
}, 100);
|
|
44
|
+
}
|
|
45
|
+
|
|
35
46
|
_checkRegistry() {
|
|
36
47
|
const registryId = this.getAttribute('data-state-registry');
|
|
37
48
|
if (registryId && window.__forceCalendarRegistry && window.__forceCalendarRegistry[registryId]) {
|
|
49
|
+
clearInterval(this._registryCheckInterval);
|
|
38
50
|
this.setStateManager(window.__forceCalendarRegistry[registryId]);
|
|
39
51
|
}
|
|
40
52
|
}
|
|
@@ -10,11 +10,6 @@ import { DateUtils } from '../../utils/DateUtils.js';
|
|
|
10
10
|
import { StyleUtils } from '../../utils/StyleUtils.js';
|
|
11
11
|
|
|
12
12
|
export class MonthView extends BaseComponent {
|
|
13
|
-
// Observe data-state-registry attribute for Locker Service compatibility
|
|
14
|
-
static get observedAttributes() {
|
|
15
|
-
return ['data-state-registry'];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
13
|
constructor() {
|
|
19
14
|
super();
|
|
20
15
|
this._stateManager = null;
|
|
@@ -22,18 +17,41 @@ export class MonthView extends BaseComponent {
|
|
|
22
17
|
this.config = {
|
|
23
18
|
maxEventsToShow: 3,
|
|
24
19
|
};
|
|
20
|
+
this._registryCheckInterval = null;
|
|
25
21
|
}
|
|
26
22
|
|
|
27
23
|
connectedCallback() {
|
|
28
24
|
super.connectedCallback();
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
console.log('[MonthView] connectedCallback - starting registry polling');
|
|
26
|
+
// Poll for registry since attributeChangedCallback doesn't work in Locker Service
|
|
27
|
+
this._startRegistryPolling();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
disconnectedCallback() {
|
|
31
|
+
super.disconnectedCallback();
|
|
32
|
+
this._stopRegistryPolling();
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
_startRegistryPolling() {
|
|
36
|
+
// Check immediately
|
|
37
|
+
this._checkRegistry();
|
|
38
|
+
|
|
39
|
+
// Then poll every 100ms until we find it (max 5 seconds)
|
|
40
|
+
let attempts = 0;
|
|
41
|
+
this._registryCheckInterval = setInterval(() => {
|
|
42
|
+
attempts++;
|
|
43
|
+
if (this._stateManager || attempts > 50) {
|
|
44
|
+
this._stopRegistryPolling();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
36
47
|
this._checkRegistry();
|
|
48
|
+
}, 100);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
_stopRegistryPolling() {
|
|
52
|
+
if (this._registryCheckInterval) {
|
|
53
|
+
clearInterval(this._registryCheckInterval);
|
|
54
|
+
this._registryCheckInterval = null;
|
|
37
55
|
}
|
|
38
56
|
}
|
|
39
57
|
|
|
@@ -43,6 +61,7 @@ export class MonthView extends BaseComponent {
|
|
|
43
61
|
if (registryId && window.__forceCalendarRegistry && window.__forceCalendarRegistry[registryId]) {
|
|
44
62
|
const manager = window.__forceCalendarRegistry[registryId];
|
|
45
63
|
console.log('[MonthView] Found stateManager in registry');
|
|
64
|
+
this._stopRegistryPolling();
|
|
46
65
|
this.setStateManager(manager);
|
|
47
66
|
}
|
|
48
67
|
}
|
|
@@ -10,31 +10,43 @@ import { StyleUtils } from '../../utils/StyleUtils.js';
|
|
|
10
10
|
import { DOMUtils } from '../../utils/DOMUtils.js';
|
|
11
11
|
|
|
12
12
|
export class WeekView extends BaseComponent {
|
|
13
|
-
static get observedAttributes() {
|
|
14
|
-
return ['data-state-registry'];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
13
|
constructor() {
|
|
18
14
|
super();
|
|
19
15
|
this._stateManager = null;
|
|
20
16
|
this.viewData = null;
|
|
21
17
|
this.hours = Array.from({ length: 24 }, (_, i) => i); // 0-23
|
|
18
|
+
this._registryCheckInterval = null;
|
|
22
19
|
}
|
|
23
20
|
|
|
24
21
|
connectedCallback() {
|
|
25
22
|
super.connectedCallback();
|
|
26
|
-
this.
|
|
23
|
+
this._startRegistryPolling();
|
|
27
24
|
}
|
|
28
25
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
disconnectedCallback() {
|
|
27
|
+
super.disconnectedCallback();
|
|
28
|
+
if (this._registryCheckInterval) {
|
|
29
|
+
clearInterval(this._registryCheckInterval);
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
32
|
|
|
33
|
+
_startRegistryPolling() {
|
|
34
|
+
this._checkRegistry();
|
|
35
|
+
let attempts = 0;
|
|
36
|
+
this._registryCheckInterval = setInterval(() => {
|
|
37
|
+
attempts++;
|
|
38
|
+
if (this._stateManager || attempts > 50) {
|
|
39
|
+
clearInterval(this._registryCheckInterval);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
this._checkRegistry();
|
|
43
|
+
}, 100);
|
|
44
|
+
}
|
|
45
|
+
|
|
35
46
|
_checkRegistry() {
|
|
36
47
|
const registryId = this.getAttribute('data-state-registry');
|
|
37
48
|
if (registryId && window.__forceCalendarRegistry && window.__forceCalendarRegistry[registryId]) {
|
|
49
|
+
clearInterval(this._registryCheckInterval);
|
|
38
50
|
this.setStateManager(window.__forceCalendarRegistry[registryId]);
|
|
39
51
|
}
|
|
40
52
|
}
|