@forcecalendar/interface 1.0.7 → 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/dist/force-calendar-interface.esm.js +83 -57
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +13 -13
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- 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
|
@@ -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
|
}
|