@forcecalendar/interface 1.0.6 → 1.0.8

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.6",
3
+ "version": "1.0.8",
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",
@@ -430,20 +430,20 @@ export class ForceCalendar extends BaseComponent {
430
430
  }
431
431
 
432
432
  afterRender() {
433
- // Set up view component
433
+ // Set up view component using global registry for Locker Service compatibility
434
434
  const viewElement = this.$('#calendar-view');
435
435
  console.log('[ForceCalendar] afterRender - viewElement:', viewElement);
436
436
  console.log('[ForceCalendar] afterRender - stateManager:', !!this.stateManager);
437
+
437
438
  if (viewElement && this.stateManager) {
438
- // Use method call for Salesforce Locker Service compatibility
439
- // Property setters may not work through Locker Service proxies
440
- if (typeof viewElement.setStateManager === 'function') {
441
- console.log('[ForceCalendar] Using setStateManager method');
442
- viewElement.setStateManager(this.stateManager);
443
- } else {
444
- console.log('[ForceCalendar] Using stateManager property setter');
445
- viewElement.stateManager = this.stateManager;
446
- }
439
+ // Store stateManager in global registry (bypasses Locker Service proxy issues)
440
+ const registryId = this._registryId || (this._registryId = 'fc-' + Math.random().toString(36).substr(2, 9));
441
+ window.__forceCalendarRegistry = window.__forceCalendarRegistry || {};
442
+ window.__forceCalendarRegistry[registryId] = this.stateManager;
443
+
444
+ // Pass registry ID via attribute (attributes work through Locker Service)
445
+ viewElement.setAttribute('data-state-registry', registryId);
446
+ console.log('[ForceCalendar] Set registry ID:', registryId);
447
447
  } else {
448
448
  console.log('[ForceCalendar] Could not set stateManager - viewElement:', !!viewElement, 'stateManager:', !!this.stateManager);
449
449
  }
@@ -15,13 +15,46 @@ export class DayView extends BaseComponent {
15
15
  this._stateManager = null;
16
16
  this.viewData = null;
17
17
  this.hours = Array.from({ length: 24 }, (_, i) => i);
18
+ this._registryCheckInterval = null;
19
+ }
20
+
21
+ connectedCallback() {
22
+ super.connectedCallback();
23
+ this._startRegistryPolling();
24
+ }
25
+
26
+ disconnectedCallback() {
27
+ super.disconnectedCallback();
28
+ if (this._registryCheckInterval) {
29
+ clearInterval(this._registryCheckInterval);
30
+ }
31
+ }
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
+
46
+ _checkRegistry() {
47
+ const registryId = this.getAttribute('data-state-registry');
48
+ if (registryId && window.__forceCalendarRegistry && window.__forceCalendarRegistry[registryId]) {
49
+ clearInterval(this._registryCheckInterval);
50
+ this.setStateManager(window.__forceCalendarRegistry[registryId]);
51
+ }
18
52
  }
19
53
 
20
54
  set stateManager(manager) {
21
55
  this.setStateManager(manager);
22
56
  }
23
57
 
24
- // Method alternative for Salesforce Locker Service compatibility
25
58
  setStateManager(manager) {
26
59
  if (this._stateManager === manager) return;
27
60
  this._stateManager = manager;
@@ -17,6 +17,53 @@ export class MonthView extends BaseComponent {
17
17
  this.config = {
18
18
  maxEventsToShow: 3,
19
19
  };
20
+ this._registryCheckInterval = null;
21
+ }
22
+
23
+ connectedCallback() {
24
+ super.connectedCallback();
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();
33
+ }
34
+
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
+ }
47
+ this._checkRegistry();
48
+ }, 100);
49
+ }
50
+
51
+ _stopRegistryPolling() {
52
+ if (this._registryCheckInterval) {
53
+ clearInterval(this._registryCheckInterval);
54
+ this._registryCheckInterval = null;
55
+ }
56
+ }
57
+
58
+ _checkRegistry() {
59
+ const registryId = this.getAttribute('data-state-registry');
60
+ console.log('[MonthView] Checking registry for ID:', registryId);
61
+ if (registryId && window.__forceCalendarRegistry && window.__forceCalendarRegistry[registryId]) {
62
+ const manager = window.__forceCalendarRegistry[registryId];
63
+ console.log('[MonthView] Found stateManager in registry');
64
+ this._stopRegistryPolling();
65
+ this.setStateManager(manager);
66
+ }
20
67
  }
21
68
 
22
69
  set stateManager(manager) {
@@ -15,13 +15,46 @@ export class WeekView extends BaseComponent {
15
15
  this._stateManager = null;
16
16
  this.viewData = null;
17
17
  this.hours = Array.from({ length: 24 }, (_, i) => i); // 0-23
18
+ this._registryCheckInterval = null;
19
+ }
20
+
21
+ connectedCallback() {
22
+ super.connectedCallback();
23
+ this._startRegistryPolling();
24
+ }
25
+
26
+ disconnectedCallback() {
27
+ super.disconnectedCallback();
28
+ if (this._registryCheckInterval) {
29
+ clearInterval(this._registryCheckInterval);
30
+ }
31
+ }
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
+
46
+ _checkRegistry() {
47
+ const registryId = this.getAttribute('data-state-registry');
48
+ if (registryId && window.__forceCalendarRegistry && window.__forceCalendarRegistry[registryId]) {
49
+ clearInterval(this._registryCheckInterval);
50
+ this.setStateManager(window.__forceCalendarRegistry[registryId]);
51
+ }
18
52
  }
19
53
 
20
54
  set stateManager(manager) {
21
55
  this.setStateManager(manager);
22
56
  }
23
57
 
24
- // Method alternative for Salesforce Locker Service compatibility
25
58
  setStateManager(manager) {
26
59
  if (this._stateManager === manager) return;
27
60
  this._stateManager = manager;