summaryrefslogtreecommitdiff
path: root/public/js/fullcalendar/packages/web-component/index.global.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/js/fullcalendar/packages/web-component/index.global.js')
-rw-r--r--public/js/fullcalendar/packages/web-component/index.global.js79
1 files changed, 79 insertions, 0 deletions
diff --git a/public/js/fullcalendar/packages/web-component/index.global.js b/public/js/fullcalendar/packages/web-component/index.global.js
new file mode 100644
index 0000000..450b052
--- /dev/null
+++ b/public/js/fullcalendar/packages/web-component/index.global.js
@@ -0,0 +1,79 @@
1/*!
2FullCalendar Web Component v6.1.17
3Docs & License: https://fullcalendar.io/docs/web-component
4(c) 2024 Adam Shaw
5*/
6(function (core) {
7 'use strict';
8
9 class FullCalendarElement extends HTMLElement {
10 constructor() {
11 super(...arguments);
12 this._calendar = null;
13 this._options = null;
14 }
15 connectedCallback() {
16 this._handleOptionsStr(this.getAttribute('options'));
17 }
18 disconnectedCallback() {
19 this._handleOptionsStr(null);
20 }
21 attributeChangedCallback(name, oldVal, newVal) {
22 if (name === 'options' &&
23 this._calendar // initial render happened
24 ) {
25 this._handleOptionsStr(newVal);
26 }
27 }
28 get options() {
29 return this._options;
30 }
31 set options(options) {
32 this._handleOptions(options);
33 }
34 getApi() {
35 return this._calendar;
36 }
37 _handleOptionsStr(optionsStr) {
38 this._handleOptions(optionsStr ? JSON.parse(optionsStr) : null);
39 }
40 _handleOptions(options) {
41 if (options) {
42 if (this._calendar) {
43 this._calendar.resetOptions(options);
44 }
45 else {
46 let root;
47 if (this.hasAttribute('shadow')) {
48 this.attachShadow({ mode: 'open' });
49 root = this.shadowRoot;
50 }
51 else {
52 // eslint-disable-next-line @typescript-eslint/no-this-alias
53 root = this;
54 }
55 root.innerHTML = '<div></div>';
56 let calendarEl = root.querySelector('div');
57 let calendar = new core.Calendar(calendarEl, options);
58 calendar.render();
59 this._calendar = calendar;
60 }
61 this._options = options;
62 }
63 else {
64 if (this._calendar) {
65 this._calendar.destroy();
66 this._calendar = null;
67 }
68 this._options = null;
69 }
70 }
71 static get observedAttributes() {
72 return ['options'];
73 }
74 }
75
76 globalThis.FullCalendarElement = FullCalendarElement;
77 customElements.define('full-calendar', FullCalendarElement);
78
79})(FullCalendar);