calkit 0.1.0
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 +734 -0
- package/dist/booking.es.js +1845 -0
- package/dist/booking.es.js.map +1 -0
- package/dist/booking.umd.js +888 -0
- package/dist/booking.umd.js.map +1 -0
- package/dist/calkit.es.js +5230 -0
- package/dist/calkit.es.js.map +1 -0
- package/dist/calkit.umd.js +2164 -0
- package/dist/calkit.umd.js.map +1 -0
- package/dist/datepicker.es.js +1619 -0
- package/dist/datepicker.es.js.map +1 -0
- package/dist/datepicker.umd.js +818 -0
- package/dist/datepicker.umd.js.map +1 -0
- package/dist/scheduler.es.js +3235 -0
- package/dist/scheduler.es.js.map +1 -0
- package/dist/scheduler.umd.js +1547 -0
- package/dist/scheduler.umd.js.map +1 -0
- package/dist/timepicker.es.js +962 -0
- package/dist/timepicker.es.js.map +1 -0
- package/dist/timepicker.umd.js +517 -0
- package/dist/timepicker.umd.js.map +1 -0
- package/llms.txt +594 -0
- package/package.json +58 -0
|
@@ -0,0 +1,1547 @@
|
|
|
1
|
+
(function(fe,be){typeof exports=="object"&&typeof module<"u"?be(exports):typeof define=="function"&&define.amd?define(["exports"],be):(fe=typeof globalThis<"u"?globalThis:fe||self,be(fe.CalScheduler={}))})(this,(function(fe){"use strict";class be extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this._initialized=!1}static get styles(){return[]}connectedCallback(){this._initialized||(this._adoptStyles(),this._initialized=!0),this.render()}_adoptStyles(){const e=this.constructor.styles;if(e.length)if("adoptedStyleSheets"in this.shadowRoot)this.shadowRoot.adoptedStyleSheets=e.map(s=>{if(s instanceof CSSStyleSheet)return s;const a=new CSSStyleSheet;return a.replaceSync(s),a});else for(const s of e){const a=document.createElement("style");a.textContent=s instanceof CSSStyleSheet?"":s,this.shadowRoot.prepend(a)}}render(){}emit(e,s={}){this.dispatchEvent(new CustomEvent(e,{detail:s,bubbles:!0,composed:!0}))}showStatus(e,s,a={}){if(!this._store)return;const{autoDismiss:n,dismissible:l=!0}=a;clearTimeout(this._statusTimer),this._store.set({statusType:e,statusMessage:s,statusDismissible:l}),this.emit("cal:status",{type:e,message:s}),n&&n>0&&(this._statusTimer=setTimeout(()=>this.clearStatus(),n))}clearStatus(){this._store&&(clearTimeout(this._statusTimer),this._store.set({statusType:null,statusMessage:null,statusDismissible:!0}),this.emit("cal:status",{type:null,message:null}))}$(e){return this.shadowRoot.querySelector(e)}$$(e){return this.shadowRoot.querySelectorAll(e)}}function qe(t){let e={...t};const s=new Set;return{get(a){return e[a]},set(a){const n=e;e={...e,...a};let l=!1;for(const r of Object.keys(a))if(n[r]!==e[r]){l=!0;break}if(l)for(const r of s)r(e,n)},getState(){return e},subscribe(a){return s.add(a),()=>s.delete(a)}}}const de=["January","February","March","April","May","June","July","August","September","October","November","December"],Oe=["Su","Mo","Tu","We","Th","Fr","Sa"],Xe=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],We=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function $e(t,e="short"){const s=Q(t);return s?e==="long"?Xe[s.getDay()]:We[s.getDay()]:""}function Ge(t=0){const e=[];for(let s=0;s<7;s++)e.push(Oe[(t+s)%7]);return e}function Ie(t,e){return new Date(t,e+1,0).getDate()}function Ue(t,e){return new Date(t,e,1).getDay()}function ue(t){if(typeof t=="string")return t;const e=t instanceof Date?t:new Date(t.year,t.month,t.day),s=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${s}-${a}-${n}`}function Q(t){if(!t)return null;if(t instanceof Date)return t;if(typeof t=="string"){const[e,s,a]=t.split("-").map(Number);return!e||!s||!a?null:new Date(e,s-1,a)}return null}function ye(t,e){if(!t||!e)return!1;const s=Q(t),a=Q(e);return!s||!a?!1:s.getFullYear()===a.getFullYear()&&s.getMonth()===a.getMonth()&&s.getDate()===a.getDate()}function me(){return ue(new Date)}function we(t,e,s){const a=new Date(t,e+s,1);return{year:a.getFullYear(),month:a.getMonth()}}function ve(t,e){const s=Q(t);return s?(s.setDate(s.getDate()+e),ue(s)):t}function Ze(t,e,s=0){const a=Ie(t,e),l=(Ue(t,e)-s+7)%7,r=[],i=me(),d=we(t,e,-1),g=Ie(d.year,d.month);for(let k=l-1;k>=0;k--){const u=g-k,p=ue({year:d.year,month:d.month,day:u});r.push({year:d.year,month:d.month,day:u,dateString:p,isCurrentMonth:!1,isToday:p===i})}for(let k=1;k<=a;k++){const u=ue({year:t,month:e,day:k});r.push({year:t,month:e,day:k,dateString:u,isCurrentMonth:!0,isToday:u===i})}const c=we(t,e,1);let o=1;for(;r.length<42;){const k=ue({year:c.year,month:c.month,day:o});r.push({year:c.year,month:c.month,day:o,dateString:k,isCurrentMonth:!1,isToday:k===i}),o++}return r}function oe(t){if(!t||typeof t!="string")return null;const e=t.trim().toUpperCase(),s=e.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/);if(s){let n=parseInt(s[1],10);const l=parseInt(s[2],10),r=s[3];return r==="AM"&&n===12&&(n=0),r==="PM"&&n!==12&&(n+=12),{hours:n,minutes:l}}const a=e.match(/^(\d{1,2}):(\d{2})$/);return a?{hours:parseInt(a[1],10),minutes:parseInt(a[2],10)}:null}function pe(t,e,s="24h"){const a=String(e).padStart(2,"0");if(s==="12h"){const n=t>=12?"PM":"AM";return`${t%12||12}:${a} ${n}`}return`${String(t).padStart(2,"0")}:${a}`}function y(t){const e=oe(t);return e?e.hours*60+e.minutes:0}function le(t){const e=Math.floor(t/60)%24,s=t%60;return`${String(e).padStart(2,"0")}:${String(s).padStart(2,"0")}`}function Le(t,e,s){const a=[],n=y(t),l=y(e);for(let r=n;r<=l;r+=s)a.push(le(r));return a}function ze(){const t=new Date;return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Je(t,e=0){const s=Q(t);if(!s)return t;const n=(s.getDay()-e+7)%7;return s.setDate(s.getDate()-n),ue(s)}function Ce(t,e=0){const s=Je(t,e),a=[];for(let n=0;n<7;n++)a.push(ve(s,n));return a}function Ke(t,e,s){const a=Q(e);if(!a)return"";if(t==="day")return`${de[a.getMonth()]} ${a.getDate()}, ${a.getFullYear()}`;if(t==="week"&&s&&s.length===7){const n=Q(s[0]),l=Q(s[6]);return!n||!l?"":n.getMonth()===l.getMonth()?`${de[n.getMonth()]} ${n.getDate()}–${l.getDate()}, ${n.getFullYear()}`:n.getFullYear()===l.getFullYear()?`${de[n.getMonth()].slice(0,3)} ${n.getDate()} – ${de[l.getMonth()].slice(0,3)} ${l.getDate()}, ${n.getFullYear()}`:`${de[n.getMonth()].slice(0,3)} ${n.getDate()}, ${n.getFullYear()} – ${de[l.getMonth()].slice(0,3)} ${l.getDate()}, ${l.getFullYear()}`}return t==="month"?`${de[a.getMonth()]} ${a.getFullYear()}`:""}function _e(t,e){return t.filter(s=>s.start?s.end&&s.end!==s.start?e>=s.start&&e<=s.end:s.start===e:!1)}function ke(t){if(!t.length)return t;const e=[...t].sort((a,n)=>{const l=y(a.startTime||"00:00"),r=y(n.startTime||"00:00");if(l!==r)return l-r;const i=y(a.endTime||"23:59");return y(n.endTime||"23:59")-r-(i-l)}),s=[];for(const a of e){const n=y(a.startTime||"00:00"),l=y(a.endTime||"23:59");let r=!1;for(let i=0;i<s.length;i++)if(n>=s[i]){a._col=i,s[i]=l,r=!0;break}r||(a._col=s.length,s.push(l))}for(const a of e){const n=y(a.startTime||"00:00"),l=y(a.endTime||"23:59");let r=a._col;for(const i of e){const d=y(i.startTime||"00:00"),g=y(i.endTime||"23:59");d<l&&g>n&&(r=Math.max(r,i._col))}a._totalCols=r+1}return e}function re(t,e,s,a){return(y(t)-y(e))/a*s}function Ae(t,e,s,a){const n=t/s*a,l=y(e)+n;return le(Math.round(l))}function Pe(t,e){const s=y(t),a=Math.round(s/e)*e;return le(a)}function Qe(t,e,s){return _e(t,s).filter(a=>a.resourceId===e)}function He(t,e,s,a,n){const l=Qe(t,e,s),r=y(a),i=y(n);for(const d of l){if(!d.startTime||!d.endTime)continue;const g=y(d.startTime),c=y(d.endTime);if(r<c&&i>g)return!1}return!0}function et(t,e,s,a,n="08:00",l="18:00"){const{duration:r,resourceId:i,minCapacity:d}=t,g=t.date||me(),c=14;let o=e;i&&(o=e.filter(p=>p.id===i)),d&&(o=o.filter(p=>p.capacity&&p.capacity>=d));const k=y(n),u=y(l);for(let p=0;p<c;p++){const v=ve(g,p);for(const h of o)for(let m=k;m+r<=u;m+=a){const w=le(m),T=le(m+r);if(He(s,h.id,v,w,T))return{resourceId:h.id,date:v,startTime:w,endTime:T}}}return null}const tt=`
|
|
2
|
+
:host {
|
|
3
|
+
/* Light theme (default) */
|
|
4
|
+
--cal-bg: 0 0% 100%;
|
|
5
|
+
--cal-bg-muted: 240 5% 96%;
|
|
6
|
+
--cal-fg: 240 6% 10%;
|
|
7
|
+
--cal-fg-muted: 240 4% 46%;
|
|
8
|
+
--cal-border: 240 6% 90%;
|
|
9
|
+
--cal-accent: 240 6% 10%;
|
|
10
|
+
--cal-accent-fg: 0 0% 100%;
|
|
11
|
+
--cal-accent-subtle: 240 5% 96%;
|
|
12
|
+
--cal-hover: 240 5% 93%;
|
|
13
|
+
--cal-ring: 240 6% 10%;
|
|
14
|
+
--cal-radius: 8px;
|
|
15
|
+
--cal-radius-sm: 6px;
|
|
16
|
+
--cal-cell-size: 36px;
|
|
17
|
+
--cal-transition: 150ms ease;
|
|
18
|
+
|
|
19
|
+
/* Booking color palette (softer / less saturated) */
|
|
20
|
+
--cal-booking-blue-bg: 217 55% 94%;
|
|
21
|
+
--cal-booking-blue-fg: 217 60% 35%;
|
|
22
|
+
--cal-booking-green-bg: 152 45% 93%;
|
|
23
|
+
--cal-booking-green-fg: 152 55% 28%;
|
|
24
|
+
--cal-booking-red-bg: 4 50% 94%;
|
|
25
|
+
--cal-booking-red-fg: 4 55% 40%;
|
|
26
|
+
--cal-booking-orange-bg: 30 55% 93%;
|
|
27
|
+
--cal-booking-orange-fg: 30 60% 35%;
|
|
28
|
+
--cal-booking-gray-bg: 240 8% 94%;
|
|
29
|
+
--cal-booking-gray-fg: 240 8% 38%;
|
|
30
|
+
|
|
31
|
+
/* Booking hover tokens */
|
|
32
|
+
--cal-booking-blue-hover: 217 55% 88%;
|
|
33
|
+
--cal-booking-green-hover: 152 45% 87%;
|
|
34
|
+
--cal-booking-red-hover: 4 50% 88%;
|
|
35
|
+
--cal-booking-orange-hover: 30 55% 87%;
|
|
36
|
+
--cal-booking-gray-hover: 240 8% 88%;
|
|
37
|
+
|
|
38
|
+
/* Scheduler tokens */
|
|
39
|
+
--cal-sched-grid-line: 240 6% 94%;
|
|
40
|
+
--cal-sched-now-line: 4 70% 55%;
|
|
41
|
+
--cal-sched-slot-hover: 240 5% 97%;
|
|
42
|
+
--cal-sched-header-bg: 240 5% 98%;
|
|
43
|
+
|
|
44
|
+
/* Status tokens */
|
|
45
|
+
--cal-status-error-bg: 4 50% 95%;
|
|
46
|
+
--cal-status-error-fg: 4 55% 40%;
|
|
47
|
+
--cal-status-error-border: 4 50% 85%;
|
|
48
|
+
--cal-status-warning-bg: 40 55% 95%;
|
|
49
|
+
--cal-status-warning-fg: 40 60% 35%;
|
|
50
|
+
--cal-status-warning-border: 40 50% 85%;
|
|
51
|
+
--cal-status-info-bg: 217 55% 95%;
|
|
52
|
+
--cal-status-info-fg: 217 60% 35%;
|
|
53
|
+
--cal-status-info-border: 217 50% 85%;
|
|
54
|
+
--cal-status-success-bg: 152 45% 95%;
|
|
55
|
+
--cal-status-success-fg: 152 55% 28%;
|
|
56
|
+
--cal-status-success-border: 152 45% 85%;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
:host([theme="dark"]) {
|
|
60
|
+
--cal-bg: 240 6% 10%;
|
|
61
|
+
--cal-bg-muted: 240 4% 16%;
|
|
62
|
+
--cal-fg: 0 0% 98%;
|
|
63
|
+
--cal-fg-muted: 240 4% 54%;
|
|
64
|
+
--cal-border: 240 4% 20%;
|
|
65
|
+
--cal-accent: 0 0% 98%;
|
|
66
|
+
--cal-accent-fg: 240 6% 10%;
|
|
67
|
+
--cal-accent-subtle: 240 4% 16%;
|
|
68
|
+
--cal-hover: 240 4% 20%;
|
|
69
|
+
--cal-ring: 0 0% 98%;
|
|
70
|
+
|
|
71
|
+
--cal-booking-blue-bg: 217 50% 25%;
|
|
72
|
+
--cal-booking-blue-fg: 217 80% 75%;
|
|
73
|
+
--cal-booking-green-bg: 142 40% 22%;
|
|
74
|
+
--cal-booking-green-fg: 142 70% 70%;
|
|
75
|
+
--cal-booking-red-bg: 4 45% 25%;
|
|
76
|
+
--cal-booking-red-fg: 4 70% 75%;
|
|
77
|
+
--cal-booking-orange-bg: 30 45% 25%;
|
|
78
|
+
--cal-booking-orange-fg: 30 80% 75%;
|
|
79
|
+
--cal-booking-gray-bg: 240 5% 22%;
|
|
80
|
+
--cal-booking-gray-fg: 240 5% 65%;
|
|
81
|
+
|
|
82
|
+
--cal-booking-blue-hover: 217 50% 30%;
|
|
83
|
+
--cal-booking-green-hover: 142 40% 27%;
|
|
84
|
+
--cal-booking-red-hover: 4 45% 30%;
|
|
85
|
+
--cal-booking-orange-hover: 30 45% 30%;
|
|
86
|
+
--cal-booking-gray-hover: 240 5% 27%;
|
|
87
|
+
|
|
88
|
+
--cal-sched-grid-line: 240 4% 18%;
|
|
89
|
+
--cal-sched-now-line: 4 55% 55%;
|
|
90
|
+
--cal-sched-slot-hover: 240 4% 14%;
|
|
91
|
+
--cal-sched-header-bg: 240 5% 12%;
|
|
92
|
+
|
|
93
|
+
--cal-status-error-bg: 4 45% 20%;
|
|
94
|
+
--cal-status-error-fg: 4 70% 75%;
|
|
95
|
+
--cal-status-error-border: 4 45% 30%;
|
|
96
|
+
--cal-status-warning-bg: 40 45% 20%;
|
|
97
|
+
--cal-status-warning-fg: 40 80% 75%;
|
|
98
|
+
--cal-status-warning-border: 40 45% 30%;
|
|
99
|
+
--cal-status-info-bg: 217 50% 20%;
|
|
100
|
+
--cal-status-info-fg: 217 80% 75%;
|
|
101
|
+
--cal-status-info-border: 217 50% 30%;
|
|
102
|
+
--cal-status-success-bg: 152 40% 18%;
|
|
103
|
+
--cal-status-success-fg: 152 70% 70%;
|
|
104
|
+
--cal-status-success-border: 152 40% 28%;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
:host([theme="auto"]) {
|
|
108
|
+
--cal-bg: 0 0% 100%;
|
|
109
|
+
--cal-bg-muted: 240 5% 96%;
|
|
110
|
+
--cal-fg: 240 6% 10%;
|
|
111
|
+
--cal-fg-muted: 240 4% 46%;
|
|
112
|
+
--cal-border: 240 6% 90%;
|
|
113
|
+
--cal-accent: 240 6% 10%;
|
|
114
|
+
--cal-accent-fg: 0 0% 100%;
|
|
115
|
+
--cal-accent-subtle: 240 5% 96%;
|
|
116
|
+
--cal-hover: 240 5% 93%;
|
|
117
|
+
--cal-ring: 240 6% 10%;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@media (prefers-color-scheme: dark) {
|
|
121
|
+
:host([theme="auto"]) {
|
|
122
|
+
--cal-bg: 240 6% 10%;
|
|
123
|
+
--cal-bg-muted: 240 4% 16%;
|
|
124
|
+
--cal-fg: 0 0% 98%;
|
|
125
|
+
--cal-fg-muted: 240 4% 54%;
|
|
126
|
+
--cal-border: 240 4% 20%;
|
|
127
|
+
--cal-accent: 0 0% 98%;
|
|
128
|
+
--cal-accent-fg: 240 6% 10%;
|
|
129
|
+
--cal-accent-subtle: 240 4% 16%;
|
|
130
|
+
--cal-hover: 240 4% 20%;
|
|
131
|
+
--cal-ring: 0 0% 98%;
|
|
132
|
+
|
|
133
|
+
--cal-booking-blue-bg: 217 50% 25%;
|
|
134
|
+
--cal-booking-blue-fg: 217 80% 75%;
|
|
135
|
+
--cal-booking-green-bg: 142 40% 22%;
|
|
136
|
+
--cal-booking-green-fg: 142 70% 70%;
|
|
137
|
+
--cal-booking-red-bg: 4 45% 25%;
|
|
138
|
+
--cal-booking-red-fg: 4 70% 75%;
|
|
139
|
+
--cal-booking-orange-bg: 30 45% 25%;
|
|
140
|
+
--cal-booking-orange-fg: 30 80% 75%;
|
|
141
|
+
--cal-booking-gray-bg: 240 5% 22%;
|
|
142
|
+
--cal-booking-gray-fg: 240 5% 65%;
|
|
143
|
+
|
|
144
|
+
--cal-booking-blue-hover: 217 50% 30%;
|
|
145
|
+
--cal-booking-green-hover: 142 40% 27%;
|
|
146
|
+
--cal-booking-red-hover: 4 45% 30%;
|
|
147
|
+
--cal-booking-orange-hover: 30 45% 30%;
|
|
148
|
+
--cal-booking-gray-hover: 240 5% 27%;
|
|
149
|
+
|
|
150
|
+
--cal-sched-grid-line: 240 4% 18%;
|
|
151
|
+
--cal-sched-now-line: 4 55% 55%;
|
|
152
|
+
--cal-sched-slot-hover: 240 4% 14%;
|
|
153
|
+
--cal-sched-header-bg: 240 5% 12%;
|
|
154
|
+
|
|
155
|
+
--cal-status-error-bg: 4 45% 20%;
|
|
156
|
+
--cal-status-error-fg: 4 70% 75%;
|
|
157
|
+
--cal-status-error-border: 4 45% 30%;
|
|
158
|
+
--cal-status-warning-bg: 40 45% 20%;
|
|
159
|
+
--cal-status-warning-fg: 40 80% 75%;
|
|
160
|
+
--cal-status-warning-border: 40 45% 30%;
|
|
161
|
+
--cal-status-info-bg: 217 50% 20%;
|
|
162
|
+
--cal-status-info-fg: 217 80% 75%;
|
|
163
|
+
--cal-status-info-border: 217 50% 30%;
|
|
164
|
+
--cal-status-success-bg: 152 40% 18%;
|
|
165
|
+
--cal-status-success-fg: 152 70% 70%;
|
|
166
|
+
--cal-status-success-border: 152 40% 28%;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
`,at=`
|
|
170
|
+
:host {
|
|
171
|
+
display: inline-block;
|
|
172
|
+
font-family: inherit;
|
|
173
|
+
font-size: 14px;
|
|
174
|
+
line-height: 1.5;
|
|
175
|
+
color: hsl(var(--cal-fg));
|
|
176
|
+
-webkit-font-smoothing: antialiased;
|
|
177
|
+
-moz-osx-font-smoothing: grayscale;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
:host([display="inline"]) {
|
|
181
|
+
display: inline-block;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
*,
|
|
185
|
+
*::before,
|
|
186
|
+
*::after {
|
|
187
|
+
box-sizing: border-box;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
button {
|
|
191
|
+
font: inherit;
|
|
192
|
+
color: inherit;
|
|
193
|
+
background: none;
|
|
194
|
+
border: none;
|
|
195
|
+
padding: 0;
|
|
196
|
+
margin: 0;
|
|
197
|
+
cursor: pointer;
|
|
198
|
+
-webkit-tap-highlight-color: transparent;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
button:focus-visible {
|
|
202
|
+
outline: 2px solid hsl(var(--cal-ring));
|
|
203
|
+
outline-offset: 2px;
|
|
204
|
+
border-radius: var(--cal-radius-sm);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
[hidden] {
|
|
208
|
+
display: none !important;
|
|
209
|
+
}
|
|
210
|
+
`,st=`
|
|
211
|
+
@keyframes cal-fade-in {
|
|
212
|
+
from { opacity: 0; }
|
|
213
|
+
to { opacity: 1; }
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
@keyframes cal-slide-up {
|
|
217
|
+
from {
|
|
218
|
+
opacity: 0;
|
|
219
|
+
transform: translateY(4px);
|
|
220
|
+
}
|
|
221
|
+
to {
|
|
222
|
+
opacity: 1;
|
|
223
|
+
transform: translateY(0);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
@keyframes cal-slide-left {
|
|
228
|
+
from {
|
|
229
|
+
opacity: 0;
|
|
230
|
+
transform: translateX(16px);
|
|
231
|
+
}
|
|
232
|
+
to {
|
|
233
|
+
opacity: 1;
|
|
234
|
+
transform: translateX(0);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
@keyframes cal-slide-right {
|
|
239
|
+
from {
|
|
240
|
+
opacity: 0;
|
|
241
|
+
transform: translateX(-16px);
|
|
242
|
+
}
|
|
243
|
+
to {
|
|
244
|
+
opacity: 1;
|
|
245
|
+
transform: translateX(0);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.cal-animate-fade { animation: cal-fade-in 150ms cubic-bezier(0.16, 1, 0.3, 1); }
|
|
250
|
+
.cal-animate-slide-up { animation: cal-slide-up 200ms cubic-bezier(0.16, 1, 0.3, 1); }
|
|
251
|
+
.cal-animate-slide-left { animation: cal-slide-left 200ms cubic-bezier(0.16, 1, 0.3, 1); }
|
|
252
|
+
.cal-animate-slide-right { animation: cal-slide-right 200ms cubic-bezier(0.16, 1, 0.3, 1); }
|
|
253
|
+
|
|
254
|
+
@keyframes cal-shimmer {
|
|
255
|
+
0% { background-position: -200% 0; }
|
|
256
|
+
100% { background-position: 200% 0; }
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.cal-skeleton {
|
|
260
|
+
background: linear-gradient(
|
|
261
|
+
90deg,
|
|
262
|
+
hsl(var(--cal-bg-muted)) 25%,
|
|
263
|
+
hsl(var(--cal-hover)) 50%,
|
|
264
|
+
hsl(var(--cal-bg-muted)) 75%
|
|
265
|
+
);
|
|
266
|
+
background-size: 200% 100%;
|
|
267
|
+
animation: cal-shimmer 1.5s infinite ease-in-out;
|
|
268
|
+
border-radius: 999px;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.cal-skeleton--rect {
|
|
272
|
+
border-radius: var(--cal-radius-sm);
|
|
273
|
+
}
|
|
274
|
+
`,nt='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10 12L6 8l4-4"/></svg>',lt='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M6 4l4 4-4 4"/></svg>';function rt({title:t,view:e,onPrev:s,onNext:a,onToday:n,onViewChange:l}){const r=document.createElement("div");r.classList.add("cal-sched-nav");const i=document.createElement("div");i.classList.add("cal-sched-nav__left");const d=document.createElement("button");d.classList.add("cal-sched-nav__btn"),d.innerHTML=nt,d.setAttribute("aria-label","Previous"),d.addEventListener("click",s);const g=document.createElement("button");g.classList.add("cal-sched-nav__btn"),g.innerHTML=lt,g.setAttribute("aria-label","Next"),g.addEventListener("click",a);const c=document.createElement("button");c.classList.add("cal-sched-nav__today"),c.textContent="Today",c.addEventListener("click",n);const o=document.createElement("span");o.classList.add("cal-sched-nav__title"),o.setAttribute("aria-live","polite"),o.textContent=t,i.appendChild(d),i.appendChild(g),i.appendChild(c),i.appendChild(o);const k=document.createElement("div");k.classList.add("cal-sched-nav__tabs");for(const u of["day","week","month"]){const p=document.createElement("button");p.classList.add("cal-sched-nav__tab"),u===e&&p.classList.add("cal-sched-nav__tab--active"),p.textContent=u.charAt(0).toUpperCase()+u.slice(1),p.addEventListener("click",()=>l(u)),k.appendChild(p)}return r.appendChild(i),r.appendChild(k),r}const it=`
|
|
275
|
+
.cal-sched-nav {
|
|
276
|
+
display: flex;
|
|
277
|
+
align-items: center;
|
|
278
|
+
justify-content: space-between;
|
|
279
|
+
padding: 8px 0;
|
|
280
|
+
gap: 8px;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.cal-sched-nav__left {
|
|
284
|
+
display: flex;
|
|
285
|
+
align-items: center;
|
|
286
|
+
gap: 4px;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.cal-sched-nav__btn {
|
|
290
|
+
display: flex;
|
|
291
|
+
align-items: center;
|
|
292
|
+
justify-content: center;
|
|
293
|
+
width: 28px;
|
|
294
|
+
height: 28px;
|
|
295
|
+
border-radius: var(--cal-radius-sm);
|
|
296
|
+
color: hsl(var(--cal-fg));
|
|
297
|
+
transition: background var(--cal-transition);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.cal-sched-nav__btn:hover {
|
|
301
|
+
background: hsl(var(--cal-hover));
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.cal-sched-nav__today {
|
|
305
|
+
font-size: 13px;
|
|
306
|
+
font-weight: 500;
|
|
307
|
+
color: hsl(var(--cal-fg));
|
|
308
|
+
padding: 4px 12px;
|
|
309
|
+
border-radius: var(--cal-radius-sm);
|
|
310
|
+
border: 1px solid hsl(var(--cal-border));
|
|
311
|
+
margin-left: 4px;
|
|
312
|
+
margin-right: 8px;
|
|
313
|
+
transition: background var(--cal-transition);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.cal-sched-nav__today:hover {
|
|
317
|
+
background: hsl(var(--cal-hover));
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.cal-sched-nav__title {
|
|
321
|
+
font-size: 14px;
|
|
322
|
+
font-weight: 600;
|
|
323
|
+
color: hsl(var(--cal-fg));
|
|
324
|
+
user-select: none;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.cal-sched-nav__tabs {
|
|
328
|
+
display: flex;
|
|
329
|
+
gap: 0;
|
|
330
|
+
border: 1px solid hsl(var(--cal-border));
|
|
331
|
+
border-radius: var(--cal-radius-sm);
|
|
332
|
+
overflow: hidden;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.cal-sched-nav__tab {
|
|
336
|
+
font-size: 13px;
|
|
337
|
+
font-weight: 500;
|
|
338
|
+
color: hsl(var(--cal-fg-muted));
|
|
339
|
+
padding: 4px 12px;
|
|
340
|
+
transition: all var(--cal-transition);
|
|
341
|
+
border-right: 1px solid hsl(var(--cal-border));
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.cal-sched-nav__tab:last-child {
|
|
345
|
+
border-right: none;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.cal-sched-nav__tab:hover {
|
|
349
|
+
background: hsl(var(--cal-hover));
|
|
350
|
+
color: hsl(var(--cal-fg));
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.cal-sched-nav__tab--active {
|
|
354
|
+
background: hsl(var(--cal-accent));
|
|
355
|
+
color: hsl(var(--cal-accent-fg));
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.cal-sched-nav__tab--active:hover {
|
|
359
|
+
background: hsl(var(--cal-accent));
|
|
360
|
+
color: hsl(var(--cal-accent-fg));
|
|
361
|
+
}
|
|
362
|
+
`;function Ye({startTime:t,endTime:e,interval:s,slotHeight:a,format:n}){const l=document.createElement("div");l.classList.add("cal-sched-time-axis");const r=Le(t,e,s);for(let i=0;i<r.length;i++){const d=r[i],g=oe(d);if(!g)continue;const c=document.createElement("div");if(c.classList.add("cal-sched-time-axis__slot"),c.style.height=`${a}px`,g.minutes===0){const o=document.createElement("span");o.classList.add("cal-sched-time-axis__label"),o.textContent=pe(g.hours,g.minutes,n),c.appendChild(o)}l.appendChild(c)}return l}const ct=`
|
|
363
|
+
.cal-sched-time-axis {
|
|
364
|
+
display: flex;
|
|
365
|
+
flex-direction: column;
|
|
366
|
+
flex-shrink: 0;
|
|
367
|
+
width: 56px;
|
|
368
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.cal-sched-time-axis__slot {
|
|
372
|
+
position: relative;
|
|
373
|
+
display: flex;
|
|
374
|
+
align-items: flex-start;
|
|
375
|
+
justify-content: flex-end;
|
|
376
|
+
padding-right: 8px;
|
|
377
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.cal-sched-time-axis__label {
|
|
381
|
+
font-size: 11px;
|
|
382
|
+
color: hsl(var(--cal-fg-muted));
|
|
383
|
+
transform: translateY(-7px);
|
|
384
|
+
white-space: nowrap;
|
|
385
|
+
user-select: none;
|
|
386
|
+
}
|
|
387
|
+
`;function dt({resource:t,width:e}){const s=document.createElement("div");s.classList.add("cal-sched-resource-header"),e&&(s.style.width=`${e}px`),s.style.flex=e?`0 0 ${e}px`:"1 1 0";const a=document.createElement("span");a.classList.add("cal-sched-resource-header__dot");const n=t.color||"blue";a.style.background=`hsl(var(--cal-booking-${n}-fg))`,s.appendChild(a);const l=document.createElement("span");if(l.classList.add("cal-sched-resource-header__name"),l.textContent=t.name,s.appendChild(l),t.capacity){const r=document.createElement("span");r.classList.add("cal-sched-resource-header__capacity"),r.textContent=t.capacity,r.setAttribute("title",`Capacity: ${t.capacity}`),s.appendChild(r)}return s}function ot({resources:t}){const e=document.createElement("div");e.classList.add("cal-sched-resource-header-row");for(const s of t)e.appendChild(dt({resource:s}));return e}const ht=`
|
|
388
|
+
.cal-sched-resource-header-row {
|
|
389
|
+
display: flex;
|
|
390
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
391
|
+
background: hsl(var(--cal-sched-header-bg));
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.cal-sched-resource-header {
|
|
395
|
+
display: flex;
|
|
396
|
+
align-items: center;
|
|
397
|
+
gap: 6px;
|
|
398
|
+
padding: 8px 12px;
|
|
399
|
+
min-width: 0;
|
|
400
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
.cal-sched-resource-header:last-child {
|
|
404
|
+
border-right: none;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.cal-sched-resource-header__dot {
|
|
408
|
+
width: 8px;
|
|
409
|
+
height: 8px;
|
|
410
|
+
border-radius: 50%;
|
|
411
|
+
flex-shrink: 0;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.cal-sched-resource-header__name {
|
|
415
|
+
font-size: 13px;
|
|
416
|
+
font-weight: 500;
|
|
417
|
+
color: hsl(var(--cal-fg));
|
|
418
|
+
white-space: nowrap;
|
|
419
|
+
overflow: hidden;
|
|
420
|
+
text-overflow: ellipsis;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.cal-sched-resource-header__capacity {
|
|
424
|
+
font-size: 11px;
|
|
425
|
+
color: hsl(var(--cal-fg-muted));
|
|
426
|
+
background: hsl(var(--cal-bg-muted));
|
|
427
|
+
padding: 1px 6px;
|
|
428
|
+
border-radius: 999px;
|
|
429
|
+
flex-shrink: 0;
|
|
430
|
+
}
|
|
431
|
+
`;function Ee({event:t,gridStartTime:e,slotHeight:s,interval:a,format:n,onClick:l,eventContent:r,showTime:i=!0,resource:d,draggable:g}){const c=document.createElement("div");c.classList.add("cal-sched-event"),c.setAttribute("role","button"),c.setAttribute("tabindex","0"),c.dataset.eventId=t.id;const o=!!t.locked;g&&!o&&(c.dataset.draggable="true"),o&&c.classList.add("cal-sched-event--locked");const k=t.color||"blue";if(c.style.setProperty("--ev-bg",`var(--cal-booking-${k}-bg)`),c.style.setProperty("--ev-fg",`var(--cal-booking-${k}-fg)`),t.startTime&&t.endTime){const u=re(t.startTime,e,s,a),p=re(t.endTime,e,s,a),v=Math.max(p-u,s*.5);if(c.style.top=`${u}px`,c.style.height=`${v}px`,t._totalCols>1){const h=100/t._totalCols;c.style.left=`${t._col*h}%`,c.style.width=`${h}%`}}if(typeof r=="function"){const u=r(t,d),p=document.createElement("div");p.classList.add("cal-sched-event__custom"),u instanceof HTMLElement?p.appendChild(u):u!=null&&(p.textContent=String(u)),c.appendChild(p)}else{const u=document.createElement("div");if(u.classList.add("cal-sched-event__title"),u.textContent=t.title||"",c.appendChild(u),i&&t.startTime&&t.endTime){const p=document.createElement("div");p.classList.add("cal-sched-event__time");const v=oe(t.startTime),h=oe(t.endTime);v&&h&&(p.textContent=`${pe(v.hours,v.minutes,n)}–${pe(h.hours,h.minutes,n)}`),c.appendChild(p)}}if(g&&!o){const u=document.createElement("div");u.classList.add("cal-sched-event__resize-handle"),c.appendChild(u)}return l&&(c.addEventListener("click",u=>{if(c.dataset.wasDragged){delete c.dataset.wasDragged;return}u.stopPropagation(),l(t)}),c.addEventListener("keydown",u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),u.stopPropagation(),l(t))})),c}function Be({event:t,onClick:e,eventContent:s,resource:a}){const n=document.createElement("div");n.classList.add("cal-sched-allday-chip"),n.dataset.eventId=t.id;const l=t.color||"blue";if(n.style.setProperty("--ev-bg",`var(--cal-booking-${l}-bg)`),n.style.setProperty("--ev-fg",`var(--cal-booking-${l}-fg)`),typeof s=="function"){const r=s(t,a);r instanceof HTMLElement?n.appendChild(r):r!=null&&(n.textContent=String(r))}else n.textContent=t.title||"";return e&&n.addEventListener("click",r=>{r.stopPropagation(),e(t)}),n}function ut({event:t,format:e,onClick:s,eventContent:a,resource:n}){const l=document.createElement("div");l.classList.add("cal-sched-month-chip"),l.dataset.eventId=t.id;const r=t.color||"blue";if(l.style.setProperty("--ev-bg",`var(--cal-booking-${r}-bg)`),l.style.setProperty("--ev-fg",`var(--cal-booking-${r}-fg)`),typeof a=="function"){const i=a(t,n);i instanceof HTMLElement?l.appendChild(i):i!=null&&(l.textContent=String(i))}else{const i=document.createElement("span");i.classList.add("cal-sched-month-chip__dot"),i.style.background=`hsl(var(--cal-booking-${r}-fg))`,l.appendChild(i);const d=document.createElement("span");if(d.classList.add("cal-sched-month-chip__text"),t.startTime){const g=oe(t.startTime),c=g?pe(g.hours,g.minutes,e):t.startTime;d.textContent=`${c} ${t.title||""}`}else d.textContent=t.title||"";l.appendChild(d)}return s&&l.addEventListener("click",i=>{i.stopPropagation(),s(t)}),l}const pt=`
|
|
432
|
+
.cal-sched-event {
|
|
433
|
+
position: absolute;
|
|
434
|
+
left: 2px;
|
|
435
|
+
right: 2px;
|
|
436
|
+
background: hsl(var(--ev-bg));
|
|
437
|
+
color: hsl(var(--ev-fg));
|
|
438
|
+
border-left: 3px solid hsl(var(--ev-fg));
|
|
439
|
+
border-radius: var(--cal-radius-sm);
|
|
440
|
+
padding: 2px 6px;
|
|
441
|
+
font-size: 12px;
|
|
442
|
+
line-height: 1.3;
|
|
443
|
+
overflow: hidden;
|
|
444
|
+
cursor: pointer;
|
|
445
|
+
transition: box-shadow var(--cal-transition);
|
|
446
|
+
z-index: 1;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.cal-sched-event:hover {
|
|
450
|
+
box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.1);
|
|
451
|
+
z-index: 2;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.cal-sched-event:focus-visible {
|
|
455
|
+
outline: 2px solid hsl(var(--cal-ring));
|
|
456
|
+
outline-offset: 1px;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.cal-sched-event__title {
|
|
460
|
+
font-weight: 500;
|
|
461
|
+
white-space: nowrap;
|
|
462
|
+
overflow: hidden;
|
|
463
|
+
text-overflow: ellipsis;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.cal-sched-event__time {
|
|
467
|
+
font-size: 11px;
|
|
468
|
+
opacity: 0.8;
|
|
469
|
+
white-space: nowrap;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
.cal-sched-event__custom {
|
|
473
|
+
overflow: hidden;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.cal-sched-event--locked {
|
|
477
|
+
cursor: default;
|
|
478
|
+
opacity: 0.85;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.cal-sched-event--locked::after {
|
|
482
|
+
content: '';
|
|
483
|
+
position: absolute;
|
|
484
|
+
top: 3px;
|
|
485
|
+
right: 4px;
|
|
486
|
+
width: 10px;
|
|
487
|
+
height: 10px;
|
|
488
|
+
background: currentColor;
|
|
489
|
+
opacity: 0.25;
|
|
490
|
+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='currentColor'%3E%3Cpath d='M11 5V4a3 3 0 0 0-6 0v1H4v7h8V5h-1ZM6 4a2 2 0 1 1 4 0v1H6V4Z'/%3E%3C/svg%3E");
|
|
491
|
+
mask-size: contain;
|
|
492
|
+
mask-repeat: no-repeat;
|
|
493
|
+
-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='currentColor'%3E%3Cpath d='M11 5V4a3 3 0 0 0-6 0v1H4v7h8V5h-1ZM6 4a2 2 0 1 1 4 0v1H6V4Z'/%3E%3C/svg%3E");
|
|
494
|
+
-webkit-mask-size: contain;
|
|
495
|
+
-webkit-mask-repeat: no-repeat;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
.cal-sched-allday-chip {
|
|
499
|
+
background: hsl(var(--ev-bg));
|
|
500
|
+
color: hsl(var(--ev-fg));
|
|
501
|
+
border-left: 3px solid hsl(var(--ev-fg));
|
|
502
|
+
border-radius: var(--cal-radius-sm);
|
|
503
|
+
padding: 2px 8px;
|
|
504
|
+
font-size: 12px;
|
|
505
|
+
font-weight: 500;
|
|
506
|
+
white-space: nowrap;
|
|
507
|
+
overflow: hidden;
|
|
508
|
+
text-overflow: ellipsis;
|
|
509
|
+
cursor: pointer;
|
|
510
|
+
transition: box-shadow var(--cal-transition);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.cal-sched-allday-chip:hover {
|
|
514
|
+
box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.1);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.cal-sched-month-chip {
|
|
518
|
+
display: flex;
|
|
519
|
+
align-items: center;
|
|
520
|
+
gap: 4px;
|
|
521
|
+
background: hsl(var(--ev-bg));
|
|
522
|
+
color: hsl(var(--ev-fg));
|
|
523
|
+
border-radius: var(--cal-radius-sm);
|
|
524
|
+
padding: 1px 6px;
|
|
525
|
+
font-size: 11px;
|
|
526
|
+
cursor: pointer;
|
|
527
|
+
overflow: hidden;
|
|
528
|
+
transition: box-shadow var(--cal-transition);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.cal-sched-month-chip:hover {
|
|
532
|
+
box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.1);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
.cal-sched-month-chip__dot {
|
|
536
|
+
width: 6px;
|
|
537
|
+
height: 6px;
|
|
538
|
+
border-radius: 50%;
|
|
539
|
+
flex-shrink: 0;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.cal-sched-month-chip__text {
|
|
543
|
+
white-space: nowrap;
|
|
544
|
+
overflow: hidden;
|
|
545
|
+
text-overflow: ellipsis;
|
|
546
|
+
}
|
|
547
|
+
`;function xe({date:t,startTime:e,endTime:s,resourceName:a,format:n,onCreate:l}){const r=document.createElement("div");r.classList.add("cal-sched-slot-prompt","cal-animate-fade");const i=document.createElement("div");if(i.classList.add("cal-sched-slot-prompt__info"),e&&s){const g=oe(e),c=oe(s),o=document.createElement("div");o.classList.add("cal-sched-slot-prompt__time"),g&&c&&(o.textContent=`${pe(g.hours,g.minutes,n)}–${pe(c.hours,c.minutes,n)}`),i.appendChild(o)}else{const g=document.createElement("div");g.classList.add("cal-sched-slot-prompt__time"),g.textContent=t,i.appendChild(g)}if(a){const g=document.createElement("div");g.classList.add("cal-sched-slot-prompt__resource"),g.textContent=a,i.appendChild(g)}r.appendChild(i);const d=document.createElement("button");return d.classList.add("cal-sched-slot-prompt__btn"),d.setAttribute("aria-label","Create event"),d.innerHTML='<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M7 3v8M3 7h8"/></svg>',d.addEventListener("click",g=>{g.stopPropagation(),l==null||l()}),r.appendChild(d),r.addEventListener("click",g=>g.stopPropagation()),r}const gt=`
|
|
548
|
+
.cal-sched-slot-prompt {
|
|
549
|
+
position: absolute;
|
|
550
|
+
z-index: 10;
|
|
551
|
+
display: flex;
|
|
552
|
+
align-items: center;
|
|
553
|
+
gap: 8px;
|
|
554
|
+
background: hsl(var(--cal-bg));
|
|
555
|
+
border: 1px solid hsl(var(--cal-border));
|
|
556
|
+
border-radius: var(--cal-radius);
|
|
557
|
+
box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.1), 0 1px 4px -1px rgba(0, 0, 0, 0.06);
|
|
558
|
+
padding: 6px 8px 6px 12px;
|
|
559
|
+
font-size: 12px;
|
|
560
|
+
color: hsl(var(--cal-fg));
|
|
561
|
+
white-space: nowrap;
|
|
562
|
+
pointer-events: auto;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
.cal-sched-slot-prompt__info {
|
|
566
|
+
display: flex;
|
|
567
|
+
flex-direction: column;
|
|
568
|
+
gap: 1px;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
.cal-sched-slot-prompt__time {
|
|
572
|
+
font-weight: 600;
|
|
573
|
+
font-size: 12px;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
.cal-sched-slot-prompt__resource {
|
|
577
|
+
font-size: 11px;
|
|
578
|
+
color: hsl(var(--cal-fg-muted));
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.cal-sched-slot-prompt__btn {
|
|
582
|
+
display: flex;
|
|
583
|
+
align-items: center;
|
|
584
|
+
justify-content: center;
|
|
585
|
+
width: 26px;
|
|
586
|
+
height: 26px;
|
|
587
|
+
border-radius: var(--cal-radius-sm);
|
|
588
|
+
background: hsl(var(--cal-accent));
|
|
589
|
+
color: hsl(var(--cal-accent-fg));
|
|
590
|
+
flex-shrink: 0;
|
|
591
|
+
transition: opacity var(--cal-transition);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
.cal-sched-slot-prompt__btn:hover {
|
|
595
|
+
opacity: 0.85;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/* Selected slot highlight */
|
|
599
|
+
.cal-sched-week__slot--selected,
|
|
600
|
+
.cal-sched-day__slot--selected {
|
|
601
|
+
background: hsl(var(--cal-accent-subtle));
|
|
602
|
+
box-shadow: inset 0 0 0 1.5px hsl(var(--cal-accent));
|
|
603
|
+
z-index: 1;
|
|
604
|
+
position: relative;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
.cal-sched-month__cell--selected {
|
|
608
|
+
background: hsl(var(--cal-accent-subtle));
|
|
609
|
+
box-shadow: inset 0 0 0 1.5px hsl(var(--cal-accent));
|
|
610
|
+
}
|
|
611
|
+
`;function mt({date:t,resources:e,events:s,startTime:a,endTime:n,interval:l,slotHeight:r,format:i,layout:d,resourceMode:g,selectedSlot:c,eventContent:o,showTime:k=!0,draggable:u,onSlotClick:p,onEventClick:v,onSlotCreate:h}){const m=document.createElement("div");m.classList.add("cal-sched-day"),d==="horizontal"&&m.classList.add("cal-sched-day--horizontal");const w=g==="tabs",T=e.length>1&&!w,D=_e(s,t),F=D.filter(_=>!_.startTime||!_.endTime),X=D.filter(_=>_.startTime&&_.endTime),Y=Le(a,n,l);if(F.length>0){const _=document.createElement("div");_.classList.add("cal-sched-day__allday");const E=document.createElement("div");E.classList.add("cal-sched-day__allday-label"),E.textContent="All day",_.appendChild(E);const Z=document.createElement("div");Z.classList.add("cal-sched-day__allday-chips");for(const N of F){const M=e.find(f=>f.id===N.resourceId);Z.appendChild(Be({event:N,onClick:f=>v==null?void 0:v(f,N.resourceId,M),eventContent:o,resource:M}))}_.appendChild(Z),m.appendChild(_)}if(T){const _=document.createElement("div");_.classList.add("cal-sched-day__header");const E=document.createElement("div");E.classList.add("cal-sched-day__header-spacer"),_.appendChild(E),_.appendChild(ot({resources:e})),m.appendChild(_)}const j=document.createElement("div");j.classList.add("cal-sched-day__grid-area"),j.appendChild(Ye({startTime:a,endTime:n,interval:l,slotHeight:r,format:i}));const P=document.createElement("div");if(P.classList.add("cal-sched-day__lanes"),T)for(const _ of e){const E=document.createElement("div");E.classList.add("cal-sched-day__lane"),E.style.flex="1 1 0",E.dataset.resourceId=_.id,E.dataset.date=t;for(let M=0;M<Y.length;M++){const f=document.createElement("div");f.classList.add("cal-sched-day__slot"),f.style.height=`${r}px`,f.dataset.time=Y[M],f.dataset.resourceId=_.id;const z=M<Y.length-1?Y[M+1]:n;c&&c.date===t&&c.startTime===Y[M]&&c.resourceId===_.id&&(f.classList.add("cal-sched-day__slot--selected"),f.appendChild(xe({date:t,startTime:Y[M],endTime:z,resourceName:_.name,format:i,onCreate:()=>h==null?void 0:h(t,Y[M],z,_.id,_)}))),f.addEventListener("click",()=>{p==null||p(t,Y[M],z,_.id,_)}),E.appendChild(f)}const Z=X.filter(M=>M.resourceId===_.id),N=ke(Z);for(const M of N)E.appendChild(Ee({event:M,gridStartTime:a,slotHeight:r,interval:l,format:i,onClick:f=>v==null?void 0:v(f,_.id,_),eventContent:o,showTime:k,resource:_,draggable:u}));P.appendChild(E)}else{const _=document.createElement("div");_.classList.add("cal-sched-day__lane"),_.style.flex="1 1 0",_.dataset.date=t;const E=e.length===1?e[0]:null;E&&(_.dataset.resourceId=E.id);for(let N=0;N<Y.length;N++){const M=document.createElement("div");M.classList.add("cal-sched-day__slot"),M.style.height=`${r}px`,M.dataset.time=Y[N];const f=N<Y.length-1?Y[N+1]:n,z=(E==null?void 0:E.id)||null;c&&c.date===t&&c.startTime===Y[N]&&(c.resourceId===z||!c.resourceId&&!z)&&(M.classList.add("cal-sched-day__slot--selected"),M.appendChild(xe({date:t,startTime:Y[N],endTime:f,resourceName:(E==null?void 0:E.name)||null,format:i,onCreate:()=>h==null?void 0:h(t,Y[N],f,z,E)}))),M.addEventListener("click",()=>{p==null||p(t,Y[N],f,z,E)}),_.appendChild(M)}const Z=ke(X);for(const N of Z){const M=e.find(f=>f.id===N.resourceId)||e[0];_.appendChild(Ee({event:N,gridStartTime:a,slotHeight:r,interval:l,format:i,onClick:f=>v==null?void 0:v(f,N.resourceId,M),eventContent:o,showTime:k,resource:M,draggable:u}))}P.appendChild(_)}j.appendChild(P);const H=me();if(ye(t,H)){const _=ze(),E=y(_),Z=y(a),N=y(n);if(E>=Z&&E<=N){const M=re(_,a,r,l),f=document.createElement("div");f.classList.add("cal-sched-now-line"),f.style.top=`${M}px`;const z=document.createElement("div");z.classList.add("cal-sched-now-line__dot"),f.appendChild(z),P.appendChild(f)}}return m.appendChild(j),m}const ft=`
|
|
612
|
+
.cal-sched-day {
|
|
613
|
+
display: flex;
|
|
614
|
+
flex-direction: column;
|
|
615
|
+
border: 1px solid hsl(var(--cal-sched-grid-line));
|
|
616
|
+
border-radius: var(--cal-radius);
|
|
617
|
+
overflow: hidden;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
.cal-sched-day__allday {
|
|
621
|
+
display: flex;
|
|
622
|
+
align-items: center;
|
|
623
|
+
gap: 8px;
|
|
624
|
+
padding: 6px 12px;
|
|
625
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
626
|
+
background: hsl(var(--cal-sched-header-bg));
|
|
627
|
+
flex-wrap: wrap;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
.cal-sched-day__allday-label {
|
|
631
|
+
font-size: 11px;
|
|
632
|
+
color: hsl(var(--cal-fg-muted));
|
|
633
|
+
flex-shrink: 0;
|
|
634
|
+
width: 48px;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
.cal-sched-day__allday-chips {
|
|
638
|
+
display: flex;
|
|
639
|
+
gap: 4px;
|
|
640
|
+
flex-wrap: wrap;
|
|
641
|
+
flex: 1;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
.cal-sched-day__header {
|
|
645
|
+
display: flex;
|
|
646
|
+
background: hsl(var(--cal-sched-header-bg));
|
|
647
|
+
position: sticky;
|
|
648
|
+
top: 0;
|
|
649
|
+
z-index: 3;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
.cal-sched-day__header-spacer {
|
|
653
|
+
width: 56px;
|
|
654
|
+
flex-shrink: 0;
|
|
655
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
.cal-sched-day__grid-area {
|
|
659
|
+
display: flex;
|
|
660
|
+
overflow-y: auto;
|
|
661
|
+
position: relative;
|
|
662
|
+
padding-top: 8px;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
.cal-sched-day__lanes {
|
|
666
|
+
display: flex;
|
|
667
|
+
flex: 1;
|
|
668
|
+
position: relative;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
.cal-sched-day__lane {
|
|
672
|
+
position: relative;
|
|
673
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
.cal-sched-day__lane:last-child {
|
|
677
|
+
border-right: none;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
.cal-sched-day__slot {
|
|
681
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
682
|
+
cursor: pointer;
|
|
683
|
+
transition: background var(--cal-transition);
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
.cal-sched-day__slot:hover {
|
|
687
|
+
background: hsl(var(--cal-sched-slot-hover));
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
/* Now line */
|
|
691
|
+
.cal-sched-now-line {
|
|
692
|
+
position: absolute;
|
|
693
|
+
left: 0;
|
|
694
|
+
right: 0;
|
|
695
|
+
height: 2px;
|
|
696
|
+
background: hsl(var(--cal-sched-now-line));
|
|
697
|
+
z-index: 5;
|
|
698
|
+
pointer-events: none;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
.cal-sched-now-line__dot {
|
|
702
|
+
position: absolute;
|
|
703
|
+
left: -4px;
|
|
704
|
+
top: -3px;
|
|
705
|
+
width: 8px;
|
|
706
|
+
height: 8px;
|
|
707
|
+
border-radius: 50%;
|
|
708
|
+
background: hsl(var(--cal-sched-now-line));
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/* Horizontal layout */
|
|
712
|
+
.cal-sched-day--horizontal .cal-sched-day__grid-area {
|
|
713
|
+
flex-direction: column;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
.cal-sched-day--horizontal .cal-sched-day__lanes {
|
|
717
|
+
flex-direction: column;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
.cal-sched-day--horizontal .cal-sched-day__lane {
|
|
721
|
+
display: flex;
|
|
722
|
+
border-right: none;
|
|
723
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
.cal-sched-day--horizontal .cal-sched-day__lane:last-child {
|
|
727
|
+
border-bottom: none;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
.cal-sched-day--horizontal .cal-sched-day__slot {
|
|
731
|
+
border-bottom: none;
|
|
732
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
733
|
+
flex: 0 0 auto;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
.cal-sched-day--horizontal .cal-sched-time-axis {
|
|
737
|
+
flex-direction: row;
|
|
738
|
+
width: auto;
|
|
739
|
+
border-right: none;
|
|
740
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
.cal-sched-day--horizontal .cal-sched-time-axis__slot {
|
|
744
|
+
border-bottom: none;
|
|
745
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
746
|
+
align-items: center;
|
|
747
|
+
justify-content: center;
|
|
748
|
+
padding: 4px 0;
|
|
749
|
+
}
|
|
750
|
+
`,Te=3,Me=5;function vt({date:t,firstDay:e,resources:s,events:a,startTime:n,endTime:l,interval:r,slotHeight:i,format:d,layout:g,resourceMode:c,selectedSlot:o,eventContent:k,showTime:u=!0,draggable:p,allDayCollapsed:v,onToggleAllDay:h,onSlotClick:m,onEventClick:w,onSlotCreate:T}){const D=document.createElement("div");D.classList.add("cal-sched-week"),g==="horizontal"&&D.classList.add("cal-sched-week--horizontal");const F=Ce(t,e),X=c==="tabs",Y=s.length>1&&!X,j=Le(n,l,r),P=me(),H={};for(const f of F){const z=_e(a,f).filter(W=>!W.startTime||!W.endTime);z.length&&(H[f]=z)}if(Object.keys(H).length>0){const f=document.createElement("div");f.classList.add("cal-sched-week__allday"),v&&f.classList.add("cal-sched-week__allday--collapsed");const z=document.createElement("div");z.classList.add("cal-sched-week__allday-spacer");const W=document.createElement("span");W.textContent="All day",z.appendChild(W);const $=document.createElement("button");$.classList.add("cal-sched-week__allday-toggle"),$.setAttribute("aria-label",v?"Expand all-day events":"Collapse all-day events"),$.innerHTML=v?'<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 5l3 3 3-3"/></svg>':'<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7l3-3 3 3"/></svg>',$.addEventListener("click",R=>{R.stopPropagation(),h==null||h()}),z.appendChild($),f.appendChild(z);for(const R of F){const U=document.createElement("div");U.classList.add("cal-sched-week__allday-cell");const I=H[R]||[];if(v){if(I.length>0){const C=document.createElement("div");C.classList.add("cal-sched-week__allday-dots");const A=I.slice(0,Me);for(const G of A){const ie=document.createElement("span");ie.classList.add("cal-sched-week__allday-dot");const Se=G.color||"blue";ie.style.background=`hsl(var(--cal-booking-${Se}-fg))`,C.appendChild(ie)}if(I.length>Me){const G=document.createElement("span");G.classList.add("cal-sched-week__allday-overflow"),G.textContent=`+${I.length-Me}`,C.appendChild(G)}U.appendChild(C)}}else{const C=I.slice(0,Te);for(const A of C){const G=s.find(ie=>ie.id===A.resourceId);U.appendChild(Be({event:A,onClick:ie=>w==null?void 0:w(ie,A.resourceId,G),eventContent:k,resource:G}))}if(I.length>Te){const A=document.createElement("span");A.classList.add("cal-sched-week__allday-overflow"),A.textContent=`+${I.length-Te}`,U.appendChild(A)}}f.appendChild(U)}D.appendChild(f)}const E=document.createElement("div");E.classList.add("cal-sched-week__header");const Z=document.createElement("div");Z.classList.add("cal-sched-week__header-spacer"),E.appendChild(Z);for(const f of F){const z=Q(f),W=document.createElement("div");W.classList.add("cal-sched-week__day-header"),ye(f,P)&&W.classList.add("cal-sched-week__day-header--today");const $=document.createElement("span");$.classList.add("cal-sched-week__day-name"),$.textContent=$e(f);const R=document.createElement("span");if(R.classList.add("cal-sched-week__day-num"),ye(f,P)&&R.classList.add("cal-sched-week__day-num--today"),R.textContent=z?z.getDate():"",W.appendChild($),W.appendChild(R),Y){const U=document.createElement("div");U.classList.add("cal-sched-week__res-row");for(const I of s){const C=document.createElement("span");C.classList.add("cal-sched-week__res-label");const A=document.createElement("span");A.classList.add("cal-sched-week__res-dot"),A.style.background=`hsl(var(--cal-booking-${I.color||"blue"}-fg))`,C.appendChild(A),C.appendChild(document.createTextNode(I.name)),U.appendChild(C)}W.appendChild(U)}E.appendChild(W)}D.appendChild(E);const N=document.createElement("div");N.classList.add("cal-sched-week__grid-area"),N.appendChild(Ye({startTime:n,endTime:l,interval:r,slotHeight:i,format:d}));const M=document.createElement("div");M.classList.add("cal-sched-week__cols");for(const f of F){const z=document.createElement("div");z.classList.add("cal-sched-week__day-col"),z.dataset.date=f,ye(f,P)&&z.classList.add("cal-sched-week__day-col--today");const W=_e(a,f).filter($=>$.startTime&&$.endTime);if(Y)for(const $ of s){const R=document.createElement("div");R.classList.add("cal-sched-week__lane"),R.dataset.resourceId=$.id;for(let C=0;C<j.length;C++){const A=document.createElement("div");A.classList.add("cal-sched-week__slot"),A.style.height=`${i}px`,A.dataset.time=j[C];const G=C<j.length-1?j[C+1]:l;o&&o.date===f&&o.startTime===j[C]&&o.resourceId===$.id&&(A.classList.add("cal-sched-week__slot--selected"),A.appendChild(xe({date:f,startTime:j[C],endTime:G,resourceName:$.name,format:d,onCreate:()=>T==null?void 0:T(f,j[C],G,$.id,$)}))),A.addEventListener("click",()=>{m==null||m(f,j[C],G,$.id,$)}),R.appendChild(A)}const U=W.filter(C=>C.resourceId===$.id),I=ke(U);for(const C of I)R.appendChild(Ee({event:C,gridStartTime:n,slotHeight:i,interval:r,format:d,onClick:A=>w==null?void 0:w(A,$.id,$),eventContent:k,showTime:u,resource:$,draggable:p}));z.appendChild(R)}else{const $=document.createElement("div");$.classList.add("cal-sched-week__lane","cal-sched-week__lane--full");const R=s.length===1?s[0]:null;R&&($.dataset.resourceId=R.id);for(let I=0;I<j.length;I++){const C=document.createElement("div");C.classList.add("cal-sched-week__slot"),C.style.height=`${i}px`,C.dataset.time=j[I];const A=I<j.length-1?j[I+1]:l,G=(R==null?void 0:R.id)||null;o&&o.date===f&&o.startTime===j[I]&&(o.resourceId===G||!o.resourceId&&!G)&&(C.classList.add("cal-sched-week__slot--selected"),C.appendChild(xe({date:f,startTime:j[I],endTime:A,resourceName:(R==null?void 0:R.name)||null,format:d,onCreate:()=>T==null?void 0:T(f,j[I],A,G,R)}))),C.addEventListener("click",()=>{m==null||m(f,j[I],A,G,R)}),$.appendChild(C)}const U=ke(W);for(const I of U){const C=s.find(A=>A.id===I.resourceId)||s[0];$.appendChild(Ee({event:I,gridStartTime:n,slotHeight:i,interval:r,format:d,onClick:A=>w==null?void 0:w(A,I.resourceId,C),eventContent:k,showTime:u,resource:C,draggable:p}))}z.appendChild($)}M.appendChild(z)}if(F.includes(P)){const f=ze(),z=y(f),W=y(n),$=y(l);if(z>=W&&z<=$){const R=F.indexOf(P),U=re(f,n,i,r),I=document.createElement("div");I.classList.add("cal-sched-now-line","cal-sched-now-line--week"),I.style.top=`${U}px`;const C=100/7;I.style.left=`${R*C}%`,I.style.width=`${C}%`;const A=document.createElement("div");A.classList.add("cal-sched-now-line__dot"),I.appendChild(A),M.appendChild(I)}}return N.appendChild(M),D.appendChild(N),D}const bt=`
|
|
751
|
+
.cal-sched-week {
|
|
752
|
+
display: flex;
|
|
753
|
+
flex-direction: column;
|
|
754
|
+
border: 1px solid hsl(var(--cal-sched-grid-line));
|
|
755
|
+
border-radius: var(--cal-radius);
|
|
756
|
+
overflow: hidden;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
.cal-sched-week__allday {
|
|
760
|
+
display: flex;
|
|
761
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
762
|
+
background: hsl(var(--cal-sched-header-bg));
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
.cal-sched-week__allday-spacer {
|
|
766
|
+
width: 56px;
|
|
767
|
+
flex-shrink: 0;
|
|
768
|
+
font-size: 11px;
|
|
769
|
+
color: hsl(var(--cal-fg-muted));
|
|
770
|
+
display: flex;
|
|
771
|
+
flex-direction: column;
|
|
772
|
+
align-items: flex-end;
|
|
773
|
+
justify-content: center;
|
|
774
|
+
gap: 4px;
|
|
775
|
+
padding-right: 8px;
|
|
776
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
.cal-sched-week__allday-toggle {
|
|
780
|
+
display: flex;
|
|
781
|
+
align-items: center;
|
|
782
|
+
justify-content: center;
|
|
783
|
+
width: 18px;
|
|
784
|
+
height: 18px;
|
|
785
|
+
border-radius: var(--cal-radius-sm);
|
|
786
|
+
background: transparent;
|
|
787
|
+
color: hsl(var(--cal-fg-muted));
|
|
788
|
+
cursor: pointer;
|
|
789
|
+
transition: background var(--cal-transition), color var(--cal-transition);
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
.cal-sched-week__allday-toggle:hover {
|
|
793
|
+
background: hsl(var(--cal-sched-slot-hover));
|
|
794
|
+
color: hsl(var(--cal-fg));
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
.cal-sched-week__allday-cell {
|
|
798
|
+
flex: 1;
|
|
799
|
+
display: flex;
|
|
800
|
+
gap: 2px;
|
|
801
|
+
padding: 4px;
|
|
802
|
+
flex-wrap: wrap;
|
|
803
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
804
|
+
max-height: 80px;
|
|
805
|
+
overflow: hidden;
|
|
806
|
+
align-items: flex-start;
|
|
807
|
+
align-content: flex-start;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
.cal-sched-week__allday--collapsed .cal-sched-week__allday-cell {
|
|
811
|
+
max-height: 28px;
|
|
812
|
+
align-items: center;
|
|
813
|
+
align-content: center;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
.cal-sched-week__allday-cell:last-child {
|
|
817
|
+
border-right: none;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
.cal-sched-week__allday-overflow {
|
|
821
|
+
font-size: 10px;
|
|
822
|
+
color: hsl(var(--cal-fg-muted));
|
|
823
|
+
padding: 1px 4px;
|
|
824
|
+
white-space: nowrap;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
.cal-sched-week__allday-dots {
|
|
828
|
+
display: flex;
|
|
829
|
+
align-items: center;
|
|
830
|
+
gap: 3px;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
.cal-sched-week__allday-dot {
|
|
834
|
+
width: 7px;
|
|
835
|
+
height: 7px;
|
|
836
|
+
border-radius: 50%;
|
|
837
|
+
flex-shrink: 0;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
.cal-sched-week__header {
|
|
841
|
+
display: flex;
|
|
842
|
+
background: hsl(var(--cal-sched-header-bg));
|
|
843
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
844
|
+
position: sticky;
|
|
845
|
+
top: 0;
|
|
846
|
+
z-index: 3;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
.cal-sched-week__header-spacer {
|
|
850
|
+
width: 56px;
|
|
851
|
+
flex-shrink: 0;
|
|
852
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
.cal-sched-week__day-header {
|
|
856
|
+
flex: 1;
|
|
857
|
+
text-align: center;
|
|
858
|
+
padding: 8px 4px;
|
|
859
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
.cal-sched-week__day-header:last-child {
|
|
863
|
+
border-right: none;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
.cal-sched-week__day-name {
|
|
867
|
+
display: block;
|
|
868
|
+
font-size: 11px;
|
|
869
|
+
color: hsl(var(--cal-fg-muted));
|
|
870
|
+
font-weight: 500;
|
|
871
|
+
text-transform: uppercase;
|
|
872
|
+
letter-spacing: 0.5px;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
.cal-sched-week__day-num {
|
|
876
|
+
display: inline-flex;
|
|
877
|
+
align-items: center;
|
|
878
|
+
justify-content: center;
|
|
879
|
+
width: 28px;
|
|
880
|
+
height: 28px;
|
|
881
|
+
font-size: 14px;
|
|
882
|
+
font-weight: 600;
|
|
883
|
+
color: hsl(var(--cal-fg));
|
|
884
|
+
border-radius: 50%;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
.cal-sched-week__day-num--today {
|
|
888
|
+
background: hsl(var(--cal-accent));
|
|
889
|
+
color: hsl(var(--cal-accent-fg));
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
.cal-sched-week__res-row {
|
|
893
|
+
display: flex;
|
|
894
|
+
justify-content: center;
|
|
895
|
+
gap: 8px;
|
|
896
|
+
margin-top: 4px;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
.cal-sched-week__res-label {
|
|
900
|
+
display: flex;
|
|
901
|
+
align-items: center;
|
|
902
|
+
gap: 3px;
|
|
903
|
+
font-size: 10px;
|
|
904
|
+
color: hsl(var(--cal-fg-muted));
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
.cal-sched-week__res-dot {
|
|
908
|
+
width: 6px;
|
|
909
|
+
height: 6px;
|
|
910
|
+
border-radius: 50%;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
.cal-sched-week__grid-area {
|
|
914
|
+
display: flex;
|
|
915
|
+
overflow-y: auto;
|
|
916
|
+
position: relative;
|
|
917
|
+
padding-top: 8px;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
.cal-sched-week__cols {
|
|
921
|
+
display: flex;
|
|
922
|
+
flex: 1;
|
|
923
|
+
position: relative;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
.cal-sched-week__day-col {
|
|
927
|
+
flex: 1;
|
|
928
|
+
display: flex;
|
|
929
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
930
|
+
position: relative;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
.cal-sched-week__day-col:last-child {
|
|
934
|
+
border-right: none;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
.cal-sched-week__lane {
|
|
938
|
+
flex: 1;
|
|
939
|
+
position: relative;
|
|
940
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line) / 0.5);
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
.cal-sched-week__lane:last-child {
|
|
944
|
+
border-right: none;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
.cal-sched-week__lane--full {
|
|
948
|
+
border-right: none;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
.cal-sched-week__slot {
|
|
952
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
953
|
+
cursor: pointer;
|
|
954
|
+
transition: background var(--cal-transition);
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
.cal-sched-week__slot:hover {
|
|
958
|
+
background: hsl(var(--cal-sched-slot-hover));
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
.cal-sched-now-line--week {
|
|
962
|
+
position: absolute;
|
|
963
|
+
height: 2px;
|
|
964
|
+
background: hsl(var(--cal-sched-now-line));
|
|
965
|
+
z-index: 5;
|
|
966
|
+
pointer-events: none;
|
|
967
|
+
}
|
|
968
|
+
`,je=3;function _t({date:t,firstDay:e,resources:s,events:a,format:n,selectedResourceId:l,selectedDate:r,eventContent:i,onSlotClick:d,onEventClick:g,onSlotCreate:c}){const o=document.createElement("div");o.classList.add("cal-sched-month");const k=Q(t);if(!k)return o;const u=k.getFullYear(),p=k.getMonth();me();const v=document.createElement("div");v.classList.add("cal-sched-month__weekdays");const h=Ge(e);for(const T of h){const D=document.createElement("div");D.classList.add("cal-sched-month__weekday"),D.textContent=T,v.appendChild(D)}o.appendChild(v);const m=document.createElement("div");m.classList.add("cal-sched-month__grid");const w=Ze(u,p,e);for(const T of w){const D=document.createElement("div");D.classList.add("cal-sched-month__cell"),T.isCurrentMonth||D.classList.add("cal-sched-month__cell--outside"),T.isToday&&D.classList.add("cal-sched-month__cell--today"),r&&T.dateString===r&&D.classList.add("cal-sched-month__cell--selected"),D.addEventListener("click",H=>{H.target.closest(".cal-sched-month-chip")||d==null||d(T.dateString)});const F=document.createElement("div");F.classList.add("cal-sched-month__day-num"),T.isToday&&F.classList.add("cal-sched-month__day-num--today"),F.textContent=T.day,D.appendChild(F);let X=_e(a,T.dateString);l&&(X=X.filter(H=>H.resourceId===l)),X.sort((H,_)=>H.startTime&&!_.startTime?-1:!H.startTime&&_.startTime?1:H.startTime&&_.startTime?H.startTime.localeCompare(_.startTime):0);const Y=document.createElement("div");Y.classList.add("cal-sched-month__events");const j=X.slice(0,je),P=X.length-je;for(const H of j){const _=s.find(E=>E.id===H.resourceId);Y.appendChild(ut({event:H,format:n,onClick:E=>g==null?void 0:g(E,H.resourceId,_),eventContent:i,resource:_}))}if(P>0){const H=document.createElement("div");H.classList.add("cal-sched-month__more"),H.textContent=`+${P} more`,Y.appendChild(H)}D.appendChild(Y),r&&T.dateString===r&&(D.style.position="relative",D.appendChild(xe({date:T.dateString,startTime:null,endTime:null,resourceName:null,format:n,onCreate:()=>c==null?void 0:c(T.dateString)}))),m.appendChild(D)}return o.appendChild(m),o}const xt=`
|
|
969
|
+
.cal-sched-month {
|
|
970
|
+
border: 1px solid hsl(var(--cal-sched-grid-line));
|
|
971
|
+
border-radius: var(--cal-radius);
|
|
972
|
+
overflow: hidden;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
.cal-sched-month__weekdays {
|
|
976
|
+
display: grid;
|
|
977
|
+
grid-template-columns: repeat(7, minmax(0, 1fr));
|
|
978
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
979
|
+
background: hsl(var(--cal-sched-header-bg));
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
.cal-sched-month__weekday {
|
|
983
|
+
font-size: 11px;
|
|
984
|
+
font-weight: 500;
|
|
985
|
+
color: hsl(var(--cal-fg-muted));
|
|
986
|
+
text-align: center;
|
|
987
|
+
padding: 8px 4px;
|
|
988
|
+
text-transform: uppercase;
|
|
989
|
+
letter-spacing: 0.5px;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
.cal-sched-month__grid {
|
|
993
|
+
display: grid;
|
|
994
|
+
grid-template-columns: repeat(7, minmax(0, 1fr));
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
.cal-sched-month__cell {
|
|
998
|
+
min-height: 100px;
|
|
999
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1000
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1001
|
+
padding: 4px;
|
|
1002
|
+
cursor: pointer;
|
|
1003
|
+
transition: background var(--cal-transition);
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
.cal-sched-month__cell:nth-child(7n) {
|
|
1007
|
+
border-right: none;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
.cal-sched-month__cell:hover {
|
|
1011
|
+
background: hsl(var(--cal-sched-slot-hover));
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
.cal-sched-month__cell--outside {
|
|
1015
|
+
opacity: 0.4;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
.cal-sched-month__day-num {
|
|
1019
|
+
font-size: 13px;
|
|
1020
|
+
font-weight: 500;
|
|
1021
|
+
color: hsl(var(--cal-fg));
|
|
1022
|
+
margin-bottom: 4px;
|
|
1023
|
+
width: 24px;
|
|
1024
|
+
height: 24px;
|
|
1025
|
+
display: flex;
|
|
1026
|
+
align-items: center;
|
|
1027
|
+
justify-content: center;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
.cal-sched-month__day-num--today {
|
|
1031
|
+
background: hsl(var(--cal-accent));
|
|
1032
|
+
color: hsl(var(--cal-accent-fg));
|
|
1033
|
+
border-radius: 50%;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
.cal-sched-month__events {
|
|
1037
|
+
display: flex;
|
|
1038
|
+
flex-direction: column;
|
|
1039
|
+
gap: 2px;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
.cal-sched-month__more {
|
|
1043
|
+
font-size: 11px;
|
|
1044
|
+
color: hsl(var(--cal-fg-muted));
|
|
1045
|
+
padding: 1px 6px;
|
|
1046
|
+
cursor: pointer;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
.cal-sched-month__more:hover {
|
|
1050
|
+
color: hsl(var(--cal-fg));
|
|
1051
|
+
}
|
|
1052
|
+
`;function yt({columns:t=3,rows:e=10,slotHeight:s=48}={}){const a=document.createElement("div");a.setAttribute("role","status"),a.setAttribute("aria-label","Loading..."),a.classList.add("cal-sched-skeleton-grid");const n=document.createElement("div");n.classList.add("cal-sched-skeleton-grid__header");const l=document.createElement("div");l.classList.add("cal-sched-skeleton-grid__spacer"),n.appendChild(l);for(let i=0;i<t;i++){const d=document.createElement("div");d.classList.add("cal-skeleton","cal-sched-skeleton-grid__col-header"),n.appendChild(d)}a.appendChild(n);const r=document.createElement("div");r.classList.add("cal-sched-skeleton-grid__body");for(let i=0;i<e;i++){const d=document.createElement("div");d.classList.add("cal-sched-skeleton-grid__row"),d.style.height=`${s}px`;const g=document.createElement("div");g.classList.add("cal-skeleton","cal-sched-skeleton-grid__time"),d.appendChild(g);for(let c=0;c<t;c++){const o=document.createElement("div");if(o.classList.add("cal-sched-skeleton-grid__cell"),Math.random()<.15){const k=document.createElement("div");k.classList.add("cal-skeleton","cal-skeleton--rect","cal-sched-skeleton-grid__event"),k.style.height=`${s*(1+Math.floor(Math.random()*2))}px`,o.appendChild(k)}d.appendChild(o)}r.appendChild(d)}return a.appendChild(r),a}function wt(){const t=document.createElement("div");t.setAttribute("role","status"),t.setAttribute("aria-label","Loading..."),t.classList.add("cal-sched-skeleton-month");const e=document.createElement("div");e.classList.add("cal-sched-skeleton-month__weekdays");for(let a=0;a<7;a++){const n=document.createElement("div");n.classList.add("cal-skeleton","cal-sched-skeleton-month__weekday"),e.appendChild(n)}t.appendChild(e);const s=document.createElement("div");s.classList.add("cal-sched-skeleton-month__grid");for(let a=0;a<35;a++){const n=document.createElement("div");n.classList.add("cal-sched-skeleton-month__cell");const l=document.createElement("div");l.classList.add("cal-skeleton","cal-sched-skeleton-month__num"),n.appendChild(l);const r=Math.floor(Math.random()*3);for(let i=0;i<r;i++){const d=document.createElement("div");d.classList.add("cal-skeleton","cal-skeleton--rect","cal-sched-skeleton-month__chip"),n.appendChild(d)}s.appendChild(n)}return t.appendChild(s),t}const kt=`
|
|
1053
|
+
.cal-sched-skeleton-grid {
|
|
1054
|
+
border: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1055
|
+
border-radius: var(--cal-radius);
|
|
1056
|
+
overflow: hidden;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
.cal-sched-skeleton-grid__header {
|
|
1060
|
+
display: flex;
|
|
1061
|
+
background: hsl(var(--cal-sched-header-bg));
|
|
1062
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1063
|
+
padding: 12px 0;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
.cal-sched-skeleton-grid__spacer {
|
|
1067
|
+
width: 56px;
|
|
1068
|
+
flex-shrink: 0;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
.cal-sched-skeleton-grid__col-header {
|
|
1072
|
+
flex: 1;
|
|
1073
|
+
height: 20px;
|
|
1074
|
+
margin: 0 12px;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
.cal-sched-skeleton-grid__body {
|
|
1078
|
+
display: flex;
|
|
1079
|
+
flex-direction: column;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
.cal-sched-skeleton-grid__row {
|
|
1083
|
+
display: flex;
|
|
1084
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
.cal-sched-skeleton-grid__time {
|
|
1088
|
+
width: 36px;
|
|
1089
|
+
height: 12px;
|
|
1090
|
+
margin: 4px 10px;
|
|
1091
|
+
flex-shrink: 0;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
.cal-sched-skeleton-grid__cell {
|
|
1095
|
+
flex: 1;
|
|
1096
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1097
|
+
position: relative;
|
|
1098
|
+
padding: 2px;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
.cal-sched-skeleton-grid__cell:last-child {
|
|
1102
|
+
border-right: none;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
.cal-sched-skeleton-grid__event {
|
|
1106
|
+
width: 80%;
|
|
1107
|
+
min-height: 24px;
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
.cal-sched-skeleton-month {
|
|
1111
|
+
border: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1112
|
+
border-radius: var(--cal-radius);
|
|
1113
|
+
overflow: hidden;
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
.cal-sched-skeleton-month__weekdays {
|
|
1117
|
+
display: grid;
|
|
1118
|
+
grid-template-columns: repeat(7, 1fr);
|
|
1119
|
+
gap: 8px;
|
|
1120
|
+
padding: 12px;
|
|
1121
|
+
background: hsl(var(--cal-sched-header-bg));
|
|
1122
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
.cal-sched-skeleton-month__weekday {
|
|
1126
|
+
height: 14px;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
.cal-sched-skeleton-month__grid {
|
|
1130
|
+
display: grid;
|
|
1131
|
+
grid-template-columns: repeat(7, 1fr);
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
.cal-sched-skeleton-month__cell {
|
|
1135
|
+
min-height: 80px;
|
|
1136
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1137
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1138
|
+
padding: 6px;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
.cal-sched-skeleton-month__cell:nth-child(7n) {
|
|
1142
|
+
border-right: none;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
.cal-sched-skeleton-month__num {
|
|
1146
|
+
width: 20px;
|
|
1147
|
+
height: 14px;
|
|
1148
|
+
margin-bottom: 6px;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
.cal-sched-skeleton-month__chip {
|
|
1152
|
+
height: 16px;
|
|
1153
|
+
margin-bottom: 2px;
|
|
1154
|
+
width: 85%;
|
|
1155
|
+
}
|
|
1156
|
+
`,Ne={error:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M7 4v3M7 9.5v.01"/></svg>',warning:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M7 1.5L1 12.5h12L7 1.5zM7 6v2.5M7 10.5v.01"/></svg>',info:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M7 6.5V10M7 4.5v.01"/></svg>',success:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M4.5 7l2 2L9.5 5"/></svg>'};function Et({type:t="info",message:e,dismissible:s=!0,onDismiss:a}){const n=document.createElement("div");n.classList.add("cal-status",`cal-status--${t}`,"cal-animate-slide-up"),n.setAttribute("role",t==="error"?"alert":"status"),n.setAttribute("aria-live",t==="error"?"assertive":"polite");const l=document.createElement("span");l.classList.add("cal-status__icon"),l.innerHTML=Ne[t]||Ne.info,n.appendChild(l);const r=document.createElement("span");if(r.classList.add("cal-status__text"),r.textContent=e,n.appendChild(r),s){const i=document.createElement("button");i.classList.add("cal-status__close"),i.setAttribute("aria-label","Dismiss"),i.innerHTML='<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M3 3l6 6M9 3l-6 6"/></svg>',i.addEventListener("click",()=>a==null?void 0:a()),n.appendChild(i)}return n}const Lt=`
|
|
1157
|
+
.cal-status {
|
|
1158
|
+
display: flex;
|
|
1159
|
+
align-items: center;
|
|
1160
|
+
gap: 8px;
|
|
1161
|
+
padding: 8px 12px;
|
|
1162
|
+
border-radius: var(--cal-radius-sm);
|
|
1163
|
+
font-size: 12px;
|
|
1164
|
+
line-height: 1.4;
|
|
1165
|
+
margin-bottom: 8px;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
.cal-status__icon {
|
|
1169
|
+
flex-shrink: 0;
|
|
1170
|
+
display: flex;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
.cal-status__text {
|
|
1174
|
+
flex: 1;
|
|
1175
|
+
min-width: 0;
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
.cal-status__close {
|
|
1179
|
+
flex-shrink: 0;
|
|
1180
|
+
display: flex;
|
|
1181
|
+
align-items: center;
|
|
1182
|
+
justify-content: center;
|
|
1183
|
+
width: 20px;
|
|
1184
|
+
height: 20px;
|
|
1185
|
+
border-radius: 4px;
|
|
1186
|
+
cursor: pointer;
|
|
1187
|
+
opacity: 0.7;
|
|
1188
|
+
transition: opacity var(--cal-transition);
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
.cal-status__close:hover {
|
|
1192
|
+
opacity: 1;
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
.cal-status--error {
|
|
1196
|
+
background: hsl(var(--cal-status-error-bg));
|
|
1197
|
+
color: hsl(var(--cal-status-error-fg));
|
|
1198
|
+
border: 1px solid hsl(var(--cal-status-error-border));
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
.cal-status--warning {
|
|
1202
|
+
background: hsl(var(--cal-status-warning-bg));
|
|
1203
|
+
color: hsl(var(--cal-status-warning-fg));
|
|
1204
|
+
border: 1px solid hsl(var(--cal-status-warning-border));
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
.cal-status--info {
|
|
1208
|
+
background: hsl(var(--cal-status-info-bg));
|
|
1209
|
+
color: hsl(var(--cal-status-info-fg));
|
|
1210
|
+
border: 1px solid hsl(var(--cal-status-info-border));
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
.cal-status--success {
|
|
1214
|
+
background: hsl(var(--cal-status-success-bg));
|
|
1215
|
+
color: hsl(var(--cal-status-success-fg));
|
|
1216
|
+
border: 1px solid hsl(var(--cal-status-success-border));
|
|
1217
|
+
}
|
|
1218
|
+
`;function Ct({event:t,resource:e,format:s,onClose:a,actions:n,onAction:l}){const r=document.createElement("div");r.classList.add("cal-sched-detail-backdrop"),r.addEventListener("click",a);const i=document.createElement("div");i.classList.add("cal-sched-detail","cal-animate-fade"),i.addEventListener("click",u=>u.stopPropagation());const d=document.createElement("button");d.classList.add("cal-sched-detail__close"),d.setAttribute("aria-label","Close"),d.innerHTML='<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M4 4l6 6M10 4l-6 6"/></svg>',d.addEventListener("click",a),i.appendChild(d);const g=t.color||"blue",c=document.createElement("div");c.classList.add("cal-sched-detail__accent"),c.style.background=`hsl(var(--cal-booking-${g}-fg))`,i.appendChild(c);const o=document.createElement("div");if(o.classList.add("cal-sched-detail__title"),o.textContent=t.title||"Untitled",i.appendChild(o),t.startTime&&t.endTime){const u=document.createElement("div");u.classList.add("cal-sched-detail__row");const p=document.createElement("span");p.classList.add("cal-sched-detail__icon"),p.innerHTML='<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="5.5"/><path d="M7 4v3.5l2.5 1.5"/></svg>',u.appendChild(p);const v=oe(t.startTime),h=oe(t.endTime),m=document.createElement("span");v&&h&&(m.textContent=`${pe(v.hours,v.minutes,s)}–${pe(h.hours,h.minutes,s)}`),u.appendChild(m),i.appendChild(u)}if(t.start){const u=document.createElement("div");u.classList.add("cal-sched-detail__row");const p=document.createElement("span");p.classList.add("cal-sched-detail__icon"),p.innerHTML='<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><rect x="1.5" y="2.5" width="11" height="9.5" rx="1.5"/><path d="M4.5 1v2.5M9.5 1v2.5M1.5 5.5h11"/></svg>',u.appendChild(p);const v=Q(t.start),h=document.createElement("span");if(v){let m=`${$e(t.start,"long")}, ${de[v.getMonth()]} ${v.getDate()}`;if(t.end&&t.end!==t.start){const w=Q(t.end);w&&(m+=` – ${de[w.getMonth()]} ${w.getDate()}`)}h.textContent=m}u.appendChild(h),i.appendChild(u)}if(e&&e.name){const u=document.createElement("div");u.classList.add("cal-sched-detail__row");const p=document.createElement("span");p.classList.add("cal-sched-detail__res-dot"),p.style.background=`hsl(var(--cal-booking-${e.color||"blue"}-fg))`,u.appendChild(p);const v=document.createElement("span");v.textContent=e.name,e.capacity&&(v.textContent+=` (capacity: ${e.capacity})`),u.appendChild(v),i.appendChild(u)}if(t.metadata&&typeof t.metadata=="object"){const u=Object.entries(t.metadata);if(u.length>0){const p=document.createElement("div");p.classList.add("cal-sched-detail__meta");for(const[v,h]of u){const m=document.createElement("div");m.classList.add("cal-sched-detail__meta-row");const w=document.createElement("span");w.classList.add("cal-sched-detail__meta-label"),w.textContent=v;const T=document.createElement("span");T.textContent=String(h),m.appendChild(w),m.appendChild(T),p.appendChild(m)}i.appendChild(p)}}if(n&&n.length>0){const u=document.createElement("div");u.classList.add("cal-sched-detail__actions");for(const p of n){const v=document.createElement("button");v.classList.add("cal-sched-detail__action"),p.type==="danger"&&v.classList.add("cal-sched-detail__action--danger"),v.textContent=p.label,v.addEventListener("click",()=>{l==null||l(p.label)}),u.appendChild(v)}i.appendChild(u)}r.appendChild(i);const k=u=>{u.key==="Escape"&&a()};return r.addEventListener("keydown",k),requestAnimationFrame(()=>d.focus()),r}const Tt=`
|
|
1219
|
+
.cal-sched-detail-backdrop {
|
|
1220
|
+
position: absolute;
|
|
1221
|
+
inset: 0;
|
|
1222
|
+
z-index: 20;
|
|
1223
|
+
display: flex;
|
|
1224
|
+
align-items: flex-start;
|
|
1225
|
+
justify-content: center;
|
|
1226
|
+
padding-top: 80px;
|
|
1227
|
+
background: rgba(0, 0, 0, 0.06);
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
.cal-sched-detail {
|
|
1231
|
+
position: relative;
|
|
1232
|
+
background: hsl(var(--cal-bg));
|
|
1233
|
+
border: 1px solid hsl(var(--cal-border));
|
|
1234
|
+
border-radius: var(--cal-radius);
|
|
1235
|
+
box-shadow: 0 8px 30px -4px rgba(0, 0, 0, 0.12), 0 2px 8px -2px rgba(0, 0, 0, 0.06);
|
|
1236
|
+
padding: 16px 20px;
|
|
1237
|
+
min-width: 260px;
|
|
1238
|
+
max-width: 340px;
|
|
1239
|
+
font-size: 13px;
|
|
1240
|
+
color: hsl(var(--cal-fg));
|
|
1241
|
+
user-select: text;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
.cal-sched-detail__close {
|
|
1245
|
+
position: absolute;
|
|
1246
|
+
top: 10px;
|
|
1247
|
+
right: 10px;
|
|
1248
|
+
display: flex;
|
|
1249
|
+
align-items: center;
|
|
1250
|
+
justify-content: center;
|
|
1251
|
+
width: 24px;
|
|
1252
|
+
height: 24px;
|
|
1253
|
+
border-radius: var(--cal-radius-sm);
|
|
1254
|
+
color: hsl(var(--cal-fg-muted));
|
|
1255
|
+
transition: background var(--cal-transition), color var(--cal-transition);
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
.cal-sched-detail__close:hover {
|
|
1259
|
+
background: hsl(var(--cal-hover));
|
|
1260
|
+
color: hsl(var(--cal-fg));
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
.cal-sched-detail__accent {
|
|
1264
|
+
width: 32px;
|
|
1265
|
+
height: 4px;
|
|
1266
|
+
border-radius: 2px;
|
|
1267
|
+
margin-bottom: 10px;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
.cal-sched-detail__title {
|
|
1271
|
+
font-size: 15px;
|
|
1272
|
+
font-weight: 600;
|
|
1273
|
+
margin-bottom: 12px;
|
|
1274
|
+
padding-right: 24px;
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
.cal-sched-detail__row {
|
|
1278
|
+
display: flex;
|
|
1279
|
+
align-items: center;
|
|
1280
|
+
gap: 8px;
|
|
1281
|
+
padding: 4px 0;
|
|
1282
|
+
color: hsl(var(--cal-fg-muted));
|
|
1283
|
+
font-size: 13px;
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
.cal-sched-detail__icon {
|
|
1287
|
+
display: flex;
|
|
1288
|
+
flex-shrink: 0;
|
|
1289
|
+
color: hsl(var(--cal-fg-muted));
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
.cal-sched-detail__res-dot {
|
|
1293
|
+
width: 8px;
|
|
1294
|
+
height: 8px;
|
|
1295
|
+
border-radius: 50%;
|
|
1296
|
+
flex-shrink: 0;
|
|
1297
|
+
margin-left: 3px;
|
|
1298
|
+
margin-right: 3px;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
.cal-sched-detail__meta {
|
|
1302
|
+
margin-top: 10px;
|
|
1303
|
+
padding-top: 10px;
|
|
1304
|
+
border-top: 1px solid hsl(var(--cal-border));
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
.cal-sched-detail__meta-row {
|
|
1308
|
+
display: flex;
|
|
1309
|
+
justify-content: space-between;
|
|
1310
|
+
padding: 2px 0;
|
|
1311
|
+
font-size: 12px;
|
|
1312
|
+
color: hsl(var(--cal-fg-muted));
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
.cal-sched-detail__meta-label {
|
|
1316
|
+
font-weight: 500;
|
|
1317
|
+
text-transform: capitalize;
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
.cal-sched-detail__actions {
|
|
1321
|
+
display: flex;
|
|
1322
|
+
gap: 6px;
|
|
1323
|
+
margin-top: 14px;
|
|
1324
|
+
padding-top: 12px;
|
|
1325
|
+
border-top: 1px solid hsl(var(--cal-border));
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
.cal-sched-detail__action {
|
|
1329
|
+
flex: 1;
|
|
1330
|
+
display: flex;
|
|
1331
|
+
align-items: center;
|
|
1332
|
+
justify-content: center;
|
|
1333
|
+
padding: 6px 12px;
|
|
1334
|
+
font-size: 12px;
|
|
1335
|
+
font-weight: 500;
|
|
1336
|
+
border-radius: var(--cal-radius-sm);
|
|
1337
|
+
border: 1px solid hsl(var(--cal-border));
|
|
1338
|
+
color: hsl(var(--cal-fg));
|
|
1339
|
+
background: hsl(var(--cal-bg));
|
|
1340
|
+
transition: background var(--cal-transition);
|
|
1341
|
+
cursor: pointer;
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
.cal-sched-detail__action:hover {
|
|
1345
|
+
background: hsl(var(--cal-hover));
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
.cal-sched-detail__action--danger {
|
|
1349
|
+
color: hsl(var(--cal-status-error-fg));
|
|
1350
|
+
border-color: hsl(var(--cal-status-error-border));
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
.cal-sched-detail__action--danger:hover {
|
|
1354
|
+
background: hsl(var(--cal-status-error-bg));
|
|
1355
|
+
}
|
|
1356
|
+
`;function Mt({resources:t,selectedResourceId:e,onResourceFilter:s}){const a=document.createElement("div");a.classList.add("cal-sched-res-tabs");const n=document.createElement("button");n.classList.add("cal-sched-res-tabs__tab"),e||n.classList.add("cal-sched-res-tabs__tab--active"),n.textContent="All",n.addEventListener("click",()=>s==null?void 0:s(null)),a.appendChild(n);for(const l of t){const r=document.createElement("button");r.classList.add("cal-sched-res-tabs__tab"),e===l.id&&r.classList.add("cal-sched-res-tabs__tab--active");const i=document.createElement("span");i.classList.add("cal-sched-res-tabs__dot"),i.style.background=`hsl(var(--cal-booking-${l.color||"blue"}-fg))`,r.appendChild(i),r.appendChild(document.createTextNode(l.name)),r.addEventListener("click",()=>s==null?void 0:s(l.id)),a.appendChild(r)}return a}const St=`
|
|
1357
|
+
.cal-sched-res-tabs {
|
|
1358
|
+
display: flex;
|
|
1359
|
+
gap: 4px;
|
|
1360
|
+
padding: 8px 12px;
|
|
1361
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1362
|
+
background: hsl(var(--cal-sched-header-bg));
|
|
1363
|
+
flex-wrap: wrap;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
.cal-sched-res-tabs__tab {
|
|
1367
|
+
display: flex;
|
|
1368
|
+
align-items: center;
|
|
1369
|
+
gap: 4px;
|
|
1370
|
+
font-size: 12px;
|
|
1371
|
+
font-weight: 500;
|
|
1372
|
+
color: hsl(var(--cal-fg-muted));
|
|
1373
|
+
padding: 4px 10px;
|
|
1374
|
+
border-radius: var(--cal-radius-sm);
|
|
1375
|
+
border: 1px solid hsl(var(--cal-border));
|
|
1376
|
+
transition: all var(--cal-transition);
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
.cal-sched-res-tabs__tab:hover {
|
|
1380
|
+
background: hsl(var(--cal-hover));
|
|
1381
|
+
color: hsl(var(--cal-fg));
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
.cal-sched-res-tabs__tab--active {
|
|
1385
|
+
background: hsl(var(--cal-accent));
|
|
1386
|
+
color: hsl(var(--cal-accent-fg));
|
|
1387
|
+
border-color: hsl(var(--cal-accent));
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
.cal-sched-res-tabs__tab--active:hover {
|
|
1391
|
+
background: hsl(var(--cal-accent));
|
|
1392
|
+
color: hsl(var(--cal-accent-fg));
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
.cal-sched-res-tabs__dot {
|
|
1396
|
+
width: 6px;
|
|
1397
|
+
height: 6px;
|
|
1398
|
+
border-radius: 50%;
|
|
1399
|
+
}
|
|
1400
|
+
`;function Dt({onClick:t}){const e=document.createElement("button");return e.classList.add("cal-sched-fab"),e.setAttribute("aria-label","Create event"),e.innerHTML='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M10 4v12M4 10h12"/></svg>',e.addEventListener("click",s=>{s.stopPropagation(),t==null||t()}),e}const $t=`
|
|
1401
|
+
.cal-sched-fab {
|
|
1402
|
+
position: absolute;
|
|
1403
|
+
bottom: 16px;
|
|
1404
|
+
right: 16px;
|
|
1405
|
+
width: 48px;
|
|
1406
|
+
height: 48px;
|
|
1407
|
+
border-radius: 50%;
|
|
1408
|
+
background: hsl(var(--cal-accent));
|
|
1409
|
+
color: hsl(var(--cal-accent-fg));
|
|
1410
|
+
display: flex;
|
|
1411
|
+
align-items: center;
|
|
1412
|
+
justify-content: center;
|
|
1413
|
+
box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
|
|
1414
|
+
cursor: pointer;
|
|
1415
|
+
z-index: 8;
|
|
1416
|
+
transition: transform var(--cal-transition), box-shadow var(--cal-transition);
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
.cal-sched-fab:hover {
|
|
1420
|
+
transform: scale(1.08);
|
|
1421
|
+
box-shadow: 0 6px 16px -2px rgba(0, 0, 0, 0.25), 0 3px 6px -1px rgba(0, 0, 0, 0.12);
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
.cal-sched-fab:active {
|
|
1425
|
+
transform: scale(0.96);
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
.cal-sched-fab:focus-visible {
|
|
1429
|
+
outline: 2px solid hsl(var(--cal-ring));
|
|
1430
|
+
outline-offset: 2px;
|
|
1431
|
+
}
|
|
1432
|
+
`,It=4;function zt({shadowRoot:t,getConfig:e,getViewInfo:s,getEvents:a,onMove:n,onResize:l,onCreate:r}){let i=!1,d=null,g=null,c=null,o=null,k=0,u=0,p=0,v=0,h=!1,m=null,w=null,T=null,D=null,F=null,X=null,Y=null,j=null,P=null,H=null,_=null,E=null,Z=0;function N(b){if(!i||b.button!==0)return;const L=b.target.closest(".cal-sched-event__resize-handle"),S=b.target.closest('.cal-sched-event[data-draggable="true"]');if(S){const q=S.dataset.eventId;if(g=a().find(B=>B.id===q),!g)return;b.preventDefault(),b.stopPropagation(),j=S,Y=b.pointerId,S.setPointerCapture(b.pointerId),p=b.clientX,v=b.clientY,h=!1,w=g.startTime,m=g.endTime,T=g.start,D=g.resourceId,L?(d="resize",o=S,o.classList.add("cal-sched-event--resizing")):(d="move",o=S)}else{const q=b.target.closest("[data-time]");if(!q||b.target.closest(".cal-sched-slot-prompt"))return;const x=z(b.clientX,b.clientY);if(!x)return;b.preventDefault(),d="create",p=b.clientX,v=b.clientY,h=!1,H=x.date,_=x.resourceId,E=x.time;const B=t.querySelectorAll("[data-time]");B.length>0&&(Z=B[0].getBoundingClientRect().top),j=q,Y=b.pointerId,q.setPointerCapture(b.pointerId)}t.addEventListener("pointermove",M),t.addEventListener("pointerup",f)}function M(b){if(!d)return;const L=b.clientX-p,S=b.clientY-v,q=Math.sqrt(L*L+S*S);if(!(!h&&q<It)){if(h=!0,d==="move"){if(!c&&o){const B=o.getBoundingClientRect();k=p-B.left,u=v-B.top,c=o.cloneNode(!0),c.classList.add("cal-sched-event--ghost"),c.style.cssText=`
|
|
1433
|
+
position: fixed;
|
|
1434
|
+
width: ${B.width}px;
|
|
1435
|
+
height: ${B.height}px;
|
|
1436
|
+
left: ${B.left}px;
|
|
1437
|
+
top: ${B.top}px;
|
|
1438
|
+
z-index: 1000;
|
|
1439
|
+
pointer-events: none;
|
|
1440
|
+
opacity: 0.85;
|
|
1441
|
+
box-shadow: 0 8px 24px -4px rgba(0,0,0,0.2);
|
|
1442
|
+
background: hsl(var(--ev-bg));
|
|
1443
|
+
color: hsl(var(--ev-fg));
|
|
1444
|
+
border-left: 3px solid hsl(var(--ev-fg));
|
|
1445
|
+
border-radius: var(--cal-radius-sm);
|
|
1446
|
+
padding: 2px 6px;
|
|
1447
|
+
font-size: 12px;
|
|
1448
|
+
line-height: 1.3;
|
|
1449
|
+
overflow: hidden;
|
|
1450
|
+
`,c.style.setProperty("--ev-bg",o.style.getPropertyValue("--ev-bg")),c.style.setProperty("--ev-fg",o.style.getPropertyValue("--ev-fg")),t.appendChild(c),o.classList.add("cal-sched-event--dragging")}c&&(c.style.left=`${b.clientX-k}px`,c.style.top=`${b.clientY-u}px`);const x=z(b.clientX,b.clientY);x?W(x):$()}else if(d==="resize"){const x=e(),B=x.snapInterval||x.interval,ee=x.slotHeight*(B/x.interval),ae=b.clientY-v,O=Math.round(ae/ee)*B,ge=y(m),ce=y(w);let K=ge+O;const te=x.minDuration||B,se=ce+te;if(K<se&&(K=se),x.maxDuration){const he=ce+x.maxDuration;K>he&&(K=he)}const V=y(x.endTime);K>V&&(K=V);const ne=le(K);if(o){const he=re(w,x.startTime,x.slotHeight,x.interval),De=re(ne,x.startTime,x.slotHeight,x.interval);o.style.height=`${Math.max(De-he,x.slotHeight*.5)}px`}U(b.clientX,b.clientY,ne,x.format)}else if(d==="create"){const x=e(),B=x.snapInterval||x.interval,ee=b.clientY-Z,ae=Ae(Math.max(0,ee),x.startTime,x.slotHeight,x.interval),J=Pe(ae,B),O=y(J),ge=y(E),ce=y(x.endTime),K=x.minDuration||B;let te=Math.max(O,ge+K);if(x.maxDuration){const V=ge+x.maxDuration;te>V&&(te=V)}te>ce&&(te=ce);const se=le(te);if(!P){P=document.createElement("div"),P.classList.add("cal-sched-create-preview");let V=null;_&&(V=t.querySelector(`[data-resource-id="${_}"][data-date="${H}"]`),V||(V=t.querySelector(`[data-date="${H}"] [data-resource-id="${_}"]`))),V||(V=t.querySelector(`[data-date="${H}"] .cal-sched-week__lane`)||t.querySelector(`[data-date="${H}"] .cal-sched-day__lane`)||t.querySelector(`[data-date="${H}"]`)),V&&V.appendChild(P)}if(P){const V=e(),ne=re(E,V.startTime,V.slotHeight,V.interval),he=re(se,V.startTime,V.slotHeight,V.interval);P.style.top=`${ne}px`,P.style.height=`${Math.max(he-ne,V.slotHeight*.5)}px`,P.dataset.endTime=se}U(b.clientX,b.clientY,se,x.format)}}}function f(b){if(d){if(t.removeEventListener("pointermove",M),t.removeEventListener("pointerup",f),j&&Y!=null){try{j.releasePointerCapture(Y)}catch{}j=null,Y=null}if(d==="move"){if($(),c&&(c.remove(),c=null),o&&o.classList.remove("cal-sched-event--dragging"),h){o&&(o.dataset.wasDragged="true");const L=z(b.clientX,b.clientY);if(L&&g){const S=e(),q=y(m)-y(w),x=L.time,B=y(x),ee=Math.min(B+q,y(S.endTime)),ae=le(ee),J={date:T,startTime:w,endTime:m,resourceId:D},O={date:L.date,startTime:x,endTime:ae,resourceId:L.resourceId||D};(J.date!==O.date||J.startTime!==O.startTime||J.resourceId!==O.resourceId)&&(n==null||n({event:g,from:J,to:O}))}}}else if(d==="resize"){if(h){const L=e(),S=L.snapInterval||L.interval,q=L.slotHeight*(S/L.interval),x=b.clientY-v,ee=Math.round(x/q)*S,ae=y(m),J=y(w);let O=ae+ee;const ge=L.minDuration||S,ce=J+ge;if(O<ce&&(O=ce),L.maxDuration){const se=J+L.maxDuration;O>se&&(O=se)}const K=y(L.endTime);O>K&&(O=K);const te=le(O);o&&(o.dataset.wasDragged="true"),te!==m&&g&&(l==null||l({event:g,from:{endTime:m},to:{endTime:te}}))}o&&o.classList.remove("cal-sched-event--resizing"),I()}else if(d==="create"){I();const L=(P==null?void 0:P.dataset.endTime)||null;P&&(P.remove(),P=null),h&&H&&E&&L&&(r==null||r({date:H,startTime:E,endTime:L,resourceId:_})),H=null,_=null,E=null,Z=0}d=null,g=null,o=null,k=0,u=0,p=0,v=0,h=!1,m=null,w=null,T=null,D=null}}function z(b,L){const S=e(),q=t.querySelectorAll("[data-date]");let x=null,B=null;for(const ne of q){const he=ne.getBoundingClientRect();if(b>=he.left&&b<=he.right){if(x=ne.dataset.date,ne.dataset.resourceId)B=ne.dataset.resourceId;else{const De=ne.querySelectorAll("[data-resource-id]");for(const Fe of De){const Ve=Fe.getBoundingClientRect();if(b>=Ve.left&&b<=Ve.right){B=Fe.dataset.resourceId;break}}}break}}if(!x)return null;const ee=t.querySelectorAll("[data-time]");if(ee.length===0)return null;const J=ee[0].getBoundingClientRect().top,O=L-J;if(O<0)return null;const ge=S.snapInterval||S.interval,ce=Ae(O,S.startTime,S.slotHeight,S.interval),K=Pe(ce,ge),te=y(K),se=y(S.startTime),V=y(S.endTime);return te<se||te>=V?null:{date:x,time:K,resourceId:B}}function W(b){$();const L=e();let S=L.interval;g&&w&&m&&(S=y(m)-y(w));let x=y(b.time)+S;const B=y(L.endTime);x>B&&(x=B);const ee=le(x);let ae=R(b.date,b.resourceId);if(!ae)return;X=document.createElement("div"),X.classList.add("cal-sched-drop-preview");const J=re(b.time,L.startTime,L.slotHeight,L.interval),O=re(ee,L.startTime,L.slotHeight,L.interval);X.style.top=`${J}px`,X.style.height=`${Math.max(O-J,L.slotHeight*.5)}px`,ae.appendChild(X)}function $(){X&&(X.remove(),X=null)}function R(b,L){if(L){let q=t.querySelector(`[data-resource-id="${L}"][data-date="${b}"]`);if(q||(q=t.querySelector(`[data-date="${b}"] [data-resource-id="${L}"]`)),q)return q}const S=t.querySelector(`[data-date="${b}"]`);return S?S.querySelector(".cal-sched-week__lane")||S.querySelector(".cal-sched-day__lane")||S:null}function U(b,L,S,q){F||(F=document.createElement("div"),F.classList.add("cal-sched-drag-time-label"),t.appendChild(F));const{hours:x,minutes:B}=C(S),ee=q==="12h"?A(x,B):S;F.textContent=ee,F.style.left=`${b+12}px`,F.style.top=`${L-8}px`}function I(){F&&(F.remove(),F=null)}function C(b){const[L,S]=b.split(":").map(Number);return{hours:L,minutes:S}}function A(b,L){const S=b>=12?"PM":"AM";return`${b%12||12}:${String(L).padStart(2,"0")} ${S}`}function G(){i||(i=!0,t.addEventListener("pointerdown",N))}function ie(){i=!1,t.removeEventListener("pointerdown",N),t.removeEventListener("pointermove",M),t.removeEventListener("pointerup",f),Se()}function Se(){c&&(c.remove(),c=null),P&&(P.remove(),P=null),o&&(o.classList.remove("cal-sched-event--dragging","cal-sched-event--resizing"),o=null),$(),I(),d=null,g=null,h=!1}function Ht(){ie()}return{enable:G,disable:ie,destroy:Ht}}const At=`
|
|
1451
|
+
[data-draggable="true"] {
|
|
1452
|
+
cursor: grab;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
[data-draggable="true"]:active {
|
|
1456
|
+
cursor: grabbing;
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
.cal-sched-event--dragging {
|
|
1460
|
+
opacity: 0.3;
|
|
1461
|
+
pointer-events: none;
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
.cal-sched-event--ghost {
|
|
1465
|
+
pointer-events: none;
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
.cal-sched-event--resizing {
|
|
1469
|
+
z-index: 10;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
.cal-sched-event__resize-handle {
|
|
1473
|
+
position: absolute;
|
|
1474
|
+
bottom: 0;
|
|
1475
|
+
left: 0;
|
|
1476
|
+
right: 0;
|
|
1477
|
+
height: 6px;
|
|
1478
|
+
cursor: ns-resize;
|
|
1479
|
+
border-radius: 0 0 var(--cal-radius-sm) var(--cal-radius-sm);
|
|
1480
|
+
display: flex;
|
|
1481
|
+
align-items: center;
|
|
1482
|
+
justify-content: center;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
.cal-sched-event__resize-handle::after {
|
|
1486
|
+
content: '';
|
|
1487
|
+
width: 20px;
|
|
1488
|
+
height: 2px;
|
|
1489
|
+
border-radius: 1px;
|
|
1490
|
+
background: currentColor;
|
|
1491
|
+
opacity: 0.3;
|
|
1492
|
+
transition: opacity var(--cal-transition);
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
.cal-sched-event__resize-handle:hover::after {
|
|
1496
|
+
opacity: 0.6;
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
.cal-sched-drop-preview {
|
|
1500
|
+
position: absolute;
|
|
1501
|
+
left: 2px;
|
|
1502
|
+
right: 2px;
|
|
1503
|
+
background: hsl(var(--cal-accent) / 0.12);
|
|
1504
|
+
border: 1.5px solid hsl(var(--cal-accent) / 0.5);
|
|
1505
|
+
border-radius: var(--cal-radius-sm);
|
|
1506
|
+
z-index: 3;
|
|
1507
|
+
pointer-events: none;
|
|
1508
|
+
transition: top 0.05s ease, height 0.05s ease;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
.cal-sched-create-preview {
|
|
1512
|
+
position: absolute;
|
|
1513
|
+
left: 2px;
|
|
1514
|
+
right: 2px;
|
|
1515
|
+
background: hsl(var(--cal-accent) / 0.15);
|
|
1516
|
+
border: 1.5px dashed hsl(var(--cal-accent));
|
|
1517
|
+
border-radius: var(--cal-radius-sm);
|
|
1518
|
+
z-index: 4;
|
|
1519
|
+
pointer-events: none;
|
|
1520
|
+
transition: height 0.05s ease;
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
.cal-sched-drag-time-label {
|
|
1524
|
+
position: fixed;
|
|
1525
|
+
background: hsl(var(--cal-fg));
|
|
1526
|
+
color: hsl(var(--cal-bg));
|
|
1527
|
+
font-size: 11px;
|
|
1528
|
+
font-weight: 500;
|
|
1529
|
+
padding: 2px 6px;
|
|
1530
|
+
border-radius: var(--cal-radius-sm);
|
|
1531
|
+
pointer-events: none;
|
|
1532
|
+
z-index: 1001;
|
|
1533
|
+
white-space: nowrap;
|
|
1534
|
+
}
|
|
1535
|
+
`,Pt=`
|
|
1536
|
+
.cal-sched {
|
|
1537
|
+
background: hsl(var(--cal-bg));
|
|
1538
|
+
border-radius: var(--cal-radius);
|
|
1539
|
+
user-select: none;
|
|
1540
|
+
font-size: 14px;
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
.cal-sched__body {
|
|
1544
|
+
position: relative;
|
|
1545
|
+
}
|
|
1546
|
+
`;class Re extends be{static get styles(){return[tt,at,st,it,ct,ht,pt,ft,bt,xt,kt,Lt,Tt,St,gt,$t,At,Pt]}static get observedAttributes(){return["theme","view","layout","date","start-time","end-time","interval","format","first-day","loading","slot-height","resource-mode","show-event-time","show-fab","draggable-events","snap-interval","min-duration","max-duration"]}constructor(){super(),this._store=qe({view:"week",anchorDate:me(),layout:"vertical",selectedResourceId:null,selectedSlot:null,detailEvent:null,detailResource:null,statusType:null,statusMessage:null,statusDismissible:!0,allDayCollapsed:!1}),this._resources=[],this._events=[],this._eventActions=[],this._eventContent=null,this._unsubscribe=null,this._rendering=!1,this._nowTimer=null,this._dragManager=null}get view(){return this.getAttribute("view")||this._store.get("view")}get layout(){return this.getAttribute("layout")||this._store.get("layout")}get startTime(){return this.getAttribute("start-time")||"08:00"}get endTime(){return this.getAttribute("end-time")||"18:00"}get interval(){return parseInt(this.getAttribute("interval")||"30",10)}get format(){return this.getAttribute("format")||"24h"}get firstDay(){return parseInt(this.getAttribute("first-day")||"0",10)}get slotHeight(){return parseInt(this.getAttribute("slot-height")||"48",10)}get resourceMode(){return this.getAttribute("resource-mode")||"tabs"}get loading(){return this.hasAttribute("loading")}set loading(e){e?this.setAttribute("loading",""):this.removeAttribute("loading")}get showEventTime(){return this.getAttribute("show-event-time")!=="false"}get showFab(){return this.hasAttribute("show-fab")}get draggableEvents(){return this.hasAttribute("draggable-events")}get snapInterval(){const e=this.getAttribute("snap-interval");return e?parseInt(e,10):null}get minDuration(){const e=this.getAttribute("min-duration");return e?parseInt(e,10):null}get maxDuration(){const e=this.getAttribute("max-duration");return e?parseInt(e,10):null}get resources(){return this._resources}set resources(e){this._resources=Array.isArray(e)?e:[],this._initialized&&this.render()}get events(){return this._events}set events(e){this._events=Array.isArray(e)?e:[],this._initialized&&this.render()}get eventActions(){return this._eventActions}set eventActions(e){this._eventActions=Array.isArray(e)?e:[],this._initialized&&this.render()}get eventContent(){return this._eventContent}set eventContent(e){this._eventContent=typeof e=="function"?e:null,this._initialized&&this.render()}get value(){return this._lastSlotValue||null}connectedCallback(){const e=this.getAttribute("date");e&&this._store.set({anchorDate:e});const s=this.getAttribute("view");s&&this._store.set({view:s});const a=this.getAttribute("layout");a&&this._store.set({layout:a}),super.connectedCallback(),this._unsubscribe=this._store.subscribe(()=>{this._rendering||this.render()}),this._nowTimer=setInterval(()=>{const n=this._store.get("view");(n==="day"||n==="week")&&this.render()},6e4),this.draggableEvents&&this._initDrag()}disconnectedCallback(){var e;(e=this._unsubscribe)==null||e.call(this),clearInterval(this._nowTimer),clearTimeout(this._statusTimer),this._destroyDrag(),this._escHandler&&(document.removeEventListener("keydown",this._escHandler),this._escHandler=null)}attributeChangedCallback(e,s,a){if(s!==a){if(e==="date"&&a){this._store.set({anchorDate:a});return}if(e==="view"&&a){this._store.set({view:a});return}if(e==="layout"&&a){this._store.set({layout:a});return}e==="draggable-events"&&(a!==null?this._initDrag():this._destroyDrag()),this._initialized&&this.render()}}goToDate(e){this._store.set({anchorDate:e}),this.emit("cal:date-change",{date:e,view:this._store.get("view")})}setView(e){["day","week","month"].includes(e)&&(this._store.set({view:e}),this.emit("cal:view-change",{view:e,date:this._store.get("anchorDate")}))}today(){this.goToDate(me())}next(){const e=this._store.getState(),s=Q(e.anchorDate);if(!s)return;let a;if(e.view==="day")a=ve(e.anchorDate,1);else if(e.view==="week")a=ve(e.anchorDate,7);else{const{year:n,month:l}=we(s.getFullYear(),s.getMonth(),1);a=ue(new Date(n,l,1))}this._store.set({anchorDate:a}),this.emit("cal:date-change",{date:a,view:e.view})}prev(){const e=this._store.getState(),s=Q(e.anchorDate);if(!s)return;let a;if(e.view==="day")a=ve(e.anchorDate,-1);else if(e.view==="week")a=ve(e.anchorDate,-7);else{const{year:n,month:l}=we(s.getFullYear(),s.getMonth(),-1);a=ue(new Date(n,l,1))}this._store.set({anchorDate:a}),this.emit("cal:date-change",{date:a,view:e.view})}findAvailableSlot(e){return et(e,this._resources,this._events,this.interval,this.startTime,this.endTime)}isSlotAvailable(e,s,a,n){return He(this._events,n,e,s,a)}_handleSlotClick(e,s,a,n,l){this._lastSlotValue={date:e,startTime:s,endTime:a,resourceId:n,resource:l},this._store.set({selectedSlot:{date:e,startTime:s,endTime:a,resourceId:n,resource:l}}),this.emit("cal:slot-select",{date:e,startTime:s,endTime:a,resourceId:n,resource:l})}_handleSlotCreate(e,s,a,n,l){this.emit("cal:slot-create",{date:e,startTime:s,endTime:a,resourceId:n,resource:l})}_dismissSlot(){this._store.set({selectedSlot:null})}_handleEventClick(e,s,a){this._dismissSlot(),this._store.set({detailEvent:e,detailResource:a||null}),this.emit("cal:event-click",{event:e,resourceId:s,resource:a})}_closeDetail(){this._store.set({detailEvent:null,detailResource:null})}_handleViewChange(e){this._dismissSlot(),this.setView(e)}_handleResourceFilter(e){this._dismissSlot(),this._store.set({selectedResourceId:e})}_handleEventAction(e){const s=this._store.getState(),a=s.detailEvent,n=s.detailResource;this.emit("cal:event-action",{action:e,event:a,resourceId:a==null?void 0:a.resourceId,resource:n})}_initDrag(){this._dragManager||(this._dragManager=zt({shadowRoot:this.shadowRoot,getConfig:()=>({slotHeight:this.slotHeight,interval:this.interval,startTime:this.startTime,endTime:this.endTime,format:this.format,snapInterval:this.snapInterval,minDuration:this.minDuration,maxDuration:this.maxDuration}),getViewInfo:()=>{const e=this._store.getState();return{view:e.view,anchorDate:e.anchorDate,weekDates:Ce(e.anchorDate,this.firstDay),resources:this._resources.length>0?this._resources:[{id:"__default",name:""}],resourceMode:this.resourceMode,selectedResourceId:e.selectedResourceId}},getEvents:()=>this._events,onMove:e=>{this.emit("cal:event-move",e)},onResize:e=>{this.emit("cal:event-resize",e)},onCreate:e=>{const s=this._resources.find(a=>a.id===e.resourceId)||null;this.emit("cal:slot-create",{...e,resource:s})}}),this._dragManager.enable())}_destroyDrag(){this._dragManager&&(this._dragManager.destroy(),this._dragManager=null)}_handleFabClick(){const e=this._store.getState();this.emit("cal:fab-create",{date:e.anchorDate,view:e.view})}render(){var v;if(this._rendering)return;this._rendering=!0;const e=this.shadowRoot,s=[...e.childNodes];for(const h of s)h.nodeName!=="STYLE"&&!(h instanceof CSSStyleSheet)&&e.removeChild(h);const a=this._store.getState(),n=document.createElement("div");n.classList.add("cal-sched"),a.statusType&&a.statusMessage&&n.appendChild(Et({type:a.statusType,message:a.statusMessage,dismissible:a.statusDismissible,onDismiss:()=>this.clearStatus()}));const l=a.view,r=a.anchorDate,i=Ce(r,this.firstDay),d=Ke(l,r,i),g=this.resourceMode;n.appendChild(rt({title:d,view:l,onPrev:()=>this.prev(),onNext:()=>this.next(),onToday:()=>this.today(),onViewChange:h=>this._handleViewChange(h)}));const c=this._resources.length>0?this._resources:[{id:"__default",name:""}],o=g==="tabs"&&c.length>1&&c[0].id!=="__default";o&&!this.loading&&n.appendChild(Mt({resources:c,selectedResourceId:a.selectedResourceId,onResourceFilter:h=>this._handleResourceFilter(h)}));let k=this._events;o&&a.selectedResourceId&&(k=this._events.filter(h=>h.resourceId===a.selectedResourceId));let u=c;if(o&&a.selectedResourceId){const h=c.find(m=>m.id===a.selectedResourceId);h&&(u=[h])}const p=document.createElement("div");if(p.classList.add("cal-sched__body"),this.loading)if(l==="month")p.appendChild(wt());else{const h=l==="week"?7:Math.max(this._resources.length,1);p.appendChild(yt({columns:h,rows:Math.ceil((y(this.endTime)-y(this.startTime))/this.interval),slotHeight:this.slotHeight}))}else l==="day"?p.appendChild(mt({date:r,resources:u,events:k,startTime:this.startTime,endTime:this.endTime,interval:this.interval,slotHeight:this.slotHeight,format:this.format,layout:a.layout,resourceMode:g,selectedSlot:a.selectedSlot,eventContent:this._eventContent,showTime:this.showEventTime,draggable:this.draggableEvents,onSlotClick:(h,m,w,T,D)=>this._handleSlotClick(h,m,w,T,D),onEventClick:(h,m,w)=>this._handleEventClick(h,m,w),onSlotCreate:(h,m,w,T,D)=>this._handleSlotCreate(h,m,w,T,D)})):l==="week"?p.appendChild(vt({date:r,firstDay:this.firstDay,resources:u,events:k,startTime:this.startTime,endTime:this.endTime,interval:this.interval,slotHeight:this.slotHeight,format:this.format,layout:a.layout,resourceMode:g,selectedSlot:a.selectedSlot,eventContent:this._eventContent,showTime:this.showEventTime,draggable:this.draggableEvents,allDayCollapsed:a.allDayCollapsed,onToggleAllDay:()=>this._store.set({allDayCollapsed:!a.allDayCollapsed}),onSlotClick:(h,m,w,T,D)=>this._handleSlotClick(h,m,w,T,D),onEventClick:(h,m,w)=>this._handleEventClick(h,m,w),onSlotCreate:(h,m,w,T,D)=>this._handleSlotCreate(h,m,w,T,D)})):l==="month"&&p.appendChild(_t({date:r,firstDay:this.firstDay,resources:u,events:k,format:this.format,selectedResourceId:a.selectedResourceId,selectedDate:((v=a.selectedSlot)==null?void 0:v.date)||null,eventContent:this._eventContent,onSlotClick:h=>this._handleSlotClick(h,null,null,null,null),onEventClick:(h,m,w)=>this._handleEventClick(h,m,w),onSlotCreate:h=>this._handleSlotCreate(h,null,null,null,null)}));n.appendChild(p),a.detailEvent&&p.appendChild(Ct({event:a.detailEvent,resource:a.detailResource,format:this.format,onClose:()=>this._closeDetail(),actions:this._eventActions,onAction:h=>this._handleEventAction(h)})),this.showFab&&!this.loading&&p.appendChild(Dt({onClick:()=>this._handleFabClick()})),e.appendChild(n),this._escHandler||(this._escHandler=h=>{h.key==="Escape"&&this._store.get("selectedSlot")&&this._dismissSlot()},this.shadowRoot.addEventListener("keydown",this._escHandler),document.addEventListener("keydown",this._escHandler)),this._rendering=!1}}customElements.get("cal-scheduler")||customElements.define("cal-scheduler",Re),fe.CalScheduler=Re,Object.defineProperty(fe,Symbol.toStringTag,{value:"Module"})}));
|
|
1547
|
+
//# sourceMappingURL=scheduler.umd.js.map
|