@forcecalendar/interface 1.0.27 → 1.0.28
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/README.md +9 -0
- package/dist/force-calendar-interface.esm.js +102 -55
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +3 -1
- package/src/components/EventForm.js +180 -176
- package/src/components/ForceCalendar.js +414 -392
- package/src/core/BaseComponent.js +146 -144
- package/src/core/EventBus.js +197 -197
- package/src/core/StateManager.js +405 -399
- package/src/index.js +3 -3
- package/src/renderers/BaseViewRenderer.js +195 -192
- package/src/renderers/DayViewRenderer.js +133 -118
- package/src/renderers/MonthViewRenderer.js +74 -72
- package/src/renderers/WeekViewRenderer.js +118 -96
- package/src/utils/DOMUtils.js +277 -277
- package/src/utils/DateUtils.js +164 -164
- package/src/utils/StyleUtils.js +286 -249
|
@@ -10,109 +10,111 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
export class BaseComponent extends HTMLElement {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this.attachShadow({ mode: 'open' });
|
|
16
|
+
this._listeners = [];
|
|
17
|
+
this._state = null;
|
|
18
|
+
this._props = new Map();
|
|
19
|
+
this._initialized = false;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Lifecycle methods
|
|
23
|
+
connectedCallback() {
|
|
24
|
+
if (!this._initialized) {
|
|
25
|
+
this.initialize();
|
|
26
|
+
this._initialized = true;
|
|
27
|
+
}
|
|
28
|
+
this.mount();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
disconnectedCallback() {
|
|
32
|
+
this.unmount();
|
|
33
|
+
this.cleanup();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// To be overridden by child classes
|
|
37
|
+
initialize() {
|
|
38
|
+
// Setup component-specific initialization
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
mount() {
|
|
42
|
+
// Component mounted to DOM
|
|
43
|
+
this.render();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
unmount() {
|
|
47
|
+
// Component removed from DOM
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
cleanup() {
|
|
51
|
+
// Clean up event listeners
|
|
52
|
+
this._listeners.forEach(({ element, event, handler }) => {
|
|
53
|
+
element.removeEventListener(event, handler);
|
|
54
|
+
});
|
|
55
|
+
this._listeners = [];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// State management
|
|
59
|
+
setState(newState) {
|
|
60
|
+
const oldState = this._state;
|
|
61
|
+
this._state = { ...this._state, ...newState };
|
|
62
|
+
this.stateChanged(oldState, this._state);
|
|
63
|
+
this.render();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
getState() {
|
|
67
|
+
return this._state;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
stateChanged(oldState, newState) {
|
|
71
|
+
// Override in child classes to handle state changes
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Props management
|
|
75
|
+
setProp(key, value) {
|
|
76
|
+
const oldValue = this._props.get(key);
|
|
77
|
+
this._props.set(key, value);
|
|
78
|
+
this.propChanged(key, oldValue, value);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
getProp(key) {
|
|
82
|
+
return this._props.get(key);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
propChanged(key, oldValue, newValue) {
|
|
86
|
+
// Override in child classes to handle prop changes
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Event handling
|
|
90
|
+
addListener(element, event, handler) {
|
|
91
|
+
if (!element || !event || !handler) {
|
|
92
|
+
console.warn('addListener called with invalid parameters', { element, event, handler });
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const boundHandler = handler.bind(this);
|
|
96
|
+
element.addEventListener(event, boundHandler);
|
|
97
|
+
this._listeners.push({ element, event, handler: boundHandler });
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
emit(eventName, detail = {}) {
|
|
101
|
+
this.dispatchEvent(
|
|
102
|
+
new CustomEvent(eventName, {
|
|
103
|
+
detail,
|
|
104
|
+
bubbles: true,
|
|
105
|
+
composed: true
|
|
106
|
+
})
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Style management
|
|
111
|
+
getStyles() {
|
|
112
|
+
// Override in child classes to provide component styles
|
|
113
|
+
return '';
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
getBaseStyles() {
|
|
117
|
+
return `
|
|
116
118
|
:host {
|
|
117
119
|
display: block;
|
|
118
120
|
box-sizing: border-box;
|
|
@@ -122,52 +124,52 @@ export class BaseComponent extends HTMLElement {
|
|
|
122
124
|
box-sizing: inherit;
|
|
123
125
|
}
|
|
124
126
|
`;
|
|
125
|
-
|
|
127
|
+
}
|
|
126
128
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
// Template rendering
|
|
130
|
+
render() {
|
|
131
|
+
// Clean up existing listeners before replacing DOM
|
|
132
|
+
this.cleanup();
|
|
131
133
|
|
|
132
|
-
|
|
134
|
+
const styles = `
|
|
133
135
|
<style>
|
|
134
136
|
${this.getBaseStyles()}
|
|
135
137
|
${this.getStyles()}
|
|
136
138
|
</style>
|
|
137
139
|
`;
|
|
138
140
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
141
|
+
const template = this.template();
|
|
142
|
+
this.shadowRoot.innerHTML = styles + template;
|
|
143
|
+
this.afterRender();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
template() {
|
|
147
|
+
// Override in child classes to provide component template
|
|
148
|
+
return '';
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
afterRender() {
|
|
152
|
+
// Override in child classes for post-render operations
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Utility methods
|
|
156
|
+
$(selector) {
|
|
157
|
+
return this.shadowRoot.querySelector(selector);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
$$(selector) {
|
|
161
|
+
return this.shadowRoot.querySelectorAll(selector);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Attribute observation
|
|
165
|
+
static get observedAttributes() {
|
|
166
|
+
return [];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
170
|
+
this.setProp(name, newValue);
|
|
171
|
+
if (this._initialized) {
|
|
172
|
+
this.render();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|