@forcecalendar/interface 1.0.5 → 1.0.7
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 +123 -61
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +19 -19
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ForceCalendar.js +14 -2
- package/src/components/views/DayView.js +27 -0
- package/src/components/views/MonthView.js +45 -0
- package/src/components/views/WeekView.js +27 -0
package/package.json
CHANGED
|
@@ -430,10 +430,22 @@ 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
|
+
console.log('[ForceCalendar] afterRender - viewElement:', viewElement);
|
|
436
|
+
console.log('[ForceCalendar] afterRender - stateManager:', !!this.stateManager);
|
|
437
|
+
|
|
435
438
|
if (viewElement && this.stateManager) {
|
|
436
|
-
|
|
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
|
+
} else {
|
|
448
|
+
console.log('[ForceCalendar] Could not set stateManager - viewElement:', !!viewElement, 'stateManager:', !!this.stateManager);
|
|
437
449
|
}
|
|
438
450
|
|
|
439
451
|
// Add event listeners for buttons using tracked addListener
|
|
@@ -10,6 +10,10 @@ 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
|
+
|
|
13
17
|
constructor() {
|
|
14
18
|
super();
|
|
15
19
|
this._stateManager = null;
|
|
@@ -17,7 +21,30 @@ export class DayView extends BaseComponent {
|
|
|
17
21
|
this.hours = Array.from({ length: 24 }, (_, i) => i);
|
|
18
22
|
}
|
|
19
23
|
|
|
24
|
+
connectedCallback() {
|
|
25
|
+
super.connectedCallback();
|
|
26
|
+
this._checkRegistry();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
30
|
+
if (name === 'data-state-registry' && newValue) {
|
|
31
|
+
this._checkRegistry();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
_checkRegistry() {
|
|
36
|
+
const registryId = this.getAttribute('data-state-registry');
|
|
37
|
+
if (registryId && window.__forceCalendarRegistry && window.__forceCalendarRegistry[registryId]) {
|
|
38
|
+
this.setStateManager(window.__forceCalendarRegistry[registryId]);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
20
42
|
set stateManager(manager) {
|
|
43
|
+
this.setStateManager(manager);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
setStateManager(manager) {
|
|
47
|
+
if (this._stateManager === manager) return;
|
|
21
48
|
this._stateManager = manager;
|
|
22
49
|
if (manager) {
|
|
23
50
|
this.unsubscribe = manager.subscribe(this.handleStateUpdate.bind(this));
|
|
@@ -10,6 +10,11 @@ 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
|
+
|
|
13
18
|
constructor() {
|
|
14
19
|
super();
|
|
15
20
|
this._stateManager = null;
|
|
@@ -19,9 +24,45 @@ export class MonthView extends BaseComponent {
|
|
|
19
24
|
};
|
|
20
25
|
}
|
|
21
26
|
|
|
27
|
+
connectedCallback() {
|
|
28
|
+
super.connectedCallback();
|
|
29
|
+
// Check for registry ID on connect (may already be set)
|
|
30
|
+
this._checkRegistry();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
34
|
+
console.log('[MonthView] attributeChangedCallback:', name, oldValue, '->', newValue);
|
|
35
|
+
if (name === 'data-state-registry' && newValue) {
|
|
36
|
+
this._checkRegistry();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
_checkRegistry() {
|
|
41
|
+
const registryId = this.getAttribute('data-state-registry');
|
|
42
|
+
console.log('[MonthView] Checking registry for ID:', registryId);
|
|
43
|
+
if (registryId && window.__forceCalendarRegistry && window.__forceCalendarRegistry[registryId]) {
|
|
44
|
+
const manager = window.__forceCalendarRegistry[registryId];
|
|
45
|
+
console.log('[MonthView] Found stateManager in registry');
|
|
46
|
+
this.setStateManager(manager);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
22
50
|
set stateManager(manager) {
|
|
51
|
+
console.log('[MonthView] stateManager setter called with:', !!manager);
|
|
52
|
+
this.setStateManager(manager);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Method alternative for Salesforce Locker Service compatibility
|
|
56
|
+
setStateManager(manager) {
|
|
57
|
+
console.log('[MonthView] setStateManager method called with:', !!manager);
|
|
58
|
+
// Prevent re-initialization if same manager
|
|
59
|
+
if (this._stateManager === manager) {
|
|
60
|
+
console.log('[MonthView] stateManager already set, skipping');
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
23
63
|
this._stateManager = manager;
|
|
24
64
|
if (manager) {
|
|
65
|
+
console.log('[MonthView] Subscribing to state changes and loading view data');
|
|
25
66
|
// Subscribe to state changes
|
|
26
67
|
this.unsubscribe = manager.subscribe(this.handleStateUpdate.bind(this));
|
|
27
68
|
this.loadViewData();
|
|
@@ -67,11 +108,15 @@ export class MonthView extends BaseComponent {
|
|
|
67
108
|
}
|
|
68
109
|
|
|
69
110
|
loadViewData() {
|
|
111
|
+
console.log('[MonthView] loadViewData called, stateManager:', !!this.stateManager);
|
|
70
112
|
if (!this.stateManager) return;
|
|
71
113
|
|
|
72
114
|
const viewData = this.stateManager.getViewData();
|
|
115
|
+
console.log('[MonthView] viewData from stateManager:', viewData);
|
|
73
116
|
this.viewData = this.processViewData(viewData);
|
|
117
|
+
console.log('[MonthView] processed viewData:', this.viewData);
|
|
74
118
|
this.render();
|
|
119
|
+
console.log('[MonthView] render completed');
|
|
75
120
|
}
|
|
76
121
|
|
|
77
122
|
processViewData(viewData) {
|
|
@@ -10,6 +10,10 @@ 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
|
+
|
|
13
17
|
constructor() {
|
|
14
18
|
super();
|
|
15
19
|
this._stateManager = null;
|
|
@@ -17,7 +21,30 @@ export class WeekView extends BaseComponent {
|
|
|
17
21
|
this.hours = Array.from({ length: 24 }, (_, i) => i); // 0-23
|
|
18
22
|
}
|
|
19
23
|
|
|
24
|
+
connectedCallback() {
|
|
25
|
+
super.connectedCallback();
|
|
26
|
+
this._checkRegistry();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
30
|
+
if (name === 'data-state-registry' && newValue) {
|
|
31
|
+
this._checkRegistry();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
_checkRegistry() {
|
|
36
|
+
const registryId = this.getAttribute('data-state-registry');
|
|
37
|
+
if (registryId && window.__forceCalendarRegistry && window.__forceCalendarRegistry[registryId]) {
|
|
38
|
+
this.setStateManager(window.__forceCalendarRegistry[registryId]);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
20
42
|
set stateManager(manager) {
|
|
43
|
+
this.setStateManager(manager);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
setStateManager(manager) {
|
|
47
|
+
if (this._stateManager === manager) return;
|
|
21
48
|
this._stateManager = manager;
|
|
22
49
|
if (manager) {
|
|
23
50
|
this.unsubscribe = manager.subscribe(this.handleStateUpdate.bind(this));
|