chesai-ui 0.16.13 → 0.16.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chesai-ui.css +1 -1
- package/dist/components/card/index.d.ts +3 -0
- package/dist/components/card/index.mjs +73 -42
- package/dist/components/full-calendar/index.mjs +115 -111
- package/dist/components/full-calendar/timeline-view.mjs +124 -122
- package/dist/components/full-calendar/types.d.ts +1 -1
- package/dist/components/full-calendar/utils.d.ts +3 -2
- package/dist/components/full-calendar/utils.mjs +184 -136
- package/package.json +1 -1
|
@@ -1,202 +1,250 @@
|
|
|
1
|
-
import { startOfWeek as
|
|
2
|
-
import { RRule as
|
|
1
|
+
import { startOfWeek as S, startOfMonth as O, endOfWeek as W, endOfMonth as T, addDays as x, startOfDay as h, isBefore as H, isAfter as I, differenceInDays as k, isSameDay as b, startOfYear as C, setMonth as R, format as Y } from "date-fns";
|
|
2
|
+
import { RRule as w } from "rrule";
|
|
3
3
|
const L = (t) => {
|
|
4
4
|
switch (t) {
|
|
5
5
|
case "primary":
|
|
6
|
-
return "bg-surface-container-low";
|
|
6
|
+
return "bg-surface-container-low text-on-surface";
|
|
7
7
|
case "secondary":
|
|
8
|
-
return "bg-surface-container-
|
|
8
|
+
return "bg-surface-container-highest text-on-surface";
|
|
9
|
+
case "tertiary":
|
|
10
|
+
return "bg-tertiary-container text-on-tertiary-container";
|
|
11
|
+
case "high-contrast":
|
|
12
|
+
return "bg-inverse-surface text-inverse-on-surface";
|
|
9
13
|
case "ghost":
|
|
10
|
-
return "bg-transparent";
|
|
14
|
+
return "bg-transparent text-on-surface";
|
|
15
|
+
case "surface-container-lowest":
|
|
16
|
+
return "bg-surface-container-lowest text-on-surface";
|
|
17
|
+
case "surface-container-low":
|
|
18
|
+
return "bg-surface-container-low text-on-surface";
|
|
19
|
+
case "surface-container":
|
|
20
|
+
return "bg-surface-container text-on-surface";
|
|
21
|
+
case "surface-container-high":
|
|
22
|
+
return "bg-surface-container-high text-on-surface";
|
|
23
|
+
case "surface-container-highest":
|
|
24
|
+
return "bg-surface-container-highest text-on-surface";
|
|
11
25
|
default:
|
|
12
|
-
return "bg-surface";
|
|
26
|
+
return "bg-surface text-on-surface";
|
|
13
27
|
}
|
|
14
28
|
}, U = (t) => {
|
|
15
29
|
switch (t) {
|
|
16
30
|
case "primary":
|
|
17
|
-
return "bg-surface-container-low";
|
|
31
|
+
return "bg-surface-container-low text-on-surface";
|
|
18
32
|
case "secondary":
|
|
19
|
-
return "bg-surface-container-
|
|
33
|
+
return "bg-surface-container-highest text-on-surface";
|
|
34
|
+
case "tertiary":
|
|
35
|
+
return "bg-tertiary-container text-on-tertiary-container";
|
|
36
|
+
case "high-contrast":
|
|
37
|
+
return "bg-inverse-surface text-inverse-on-surface";
|
|
20
38
|
case "ghost":
|
|
21
|
-
return "bg-surface/80 backdrop-blur-md";
|
|
39
|
+
return "bg-surface/80 backdrop-blur-md text-on-surface";
|
|
40
|
+
case "surface-container-lowest":
|
|
41
|
+
return "bg-surface-container-lowest text-on-surface";
|
|
42
|
+
case "surface-container-low":
|
|
43
|
+
return "bg-surface-container-low text-on-surface";
|
|
44
|
+
case "surface-container":
|
|
45
|
+
return "bg-surface-container text-on-surface";
|
|
46
|
+
case "surface-container-high":
|
|
47
|
+
return "bg-surface-container-high text-on-surface";
|
|
48
|
+
case "surface-container-highest":
|
|
49
|
+
return "bg-surface-container-highest text-on-surface";
|
|
22
50
|
default:
|
|
23
|
-
return "bg-surface";
|
|
51
|
+
return "bg-surface text-on-surface";
|
|
24
52
|
}
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
53
|
+
}, _ = (t) => {
|
|
54
|
+
switch (t) {
|
|
55
|
+
case "ghost":
|
|
56
|
+
return "bg-transparent";
|
|
57
|
+
case "surface-container-lowest":
|
|
58
|
+
return "bg-surface-container-lowest";
|
|
59
|
+
case "surface-container-low":
|
|
60
|
+
return "bg-surface-container-low";
|
|
61
|
+
case "surface-container":
|
|
62
|
+
return "bg-surface-container-low/30";
|
|
63
|
+
case "surface-container-high":
|
|
64
|
+
return "bg-surface-container-low/50";
|
|
65
|
+
case "surface-container-highest":
|
|
66
|
+
return "bg-surface-container-low/70";
|
|
67
|
+
case "high-contrast":
|
|
68
|
+
return "bg-inverse-surface/5";
|
|
69
|
+
default:
|
|
70
|
+
return "bg-surface-container-low/30";
|
|
71
|
+
}
|
|
72
|
+
}, q = {
|
|
73
|
+
daily: w.DAILY,
|
|
74
|
+
weekly: w.WEEKLY,
|
|
75
|
+
monthly: w.MONTHLY,
|
|
76
|
+
yearly: w.YEARLY
|
|
77
|
+
}, M = [
|
|
78
|
+
w.SU,
|
|
32
79
|
// 0
|
|
33
|
-
|
|
80
|
+
w.MO,
|
|
34
81
|
// 1
|
|
35
|
-
|
|
82
|
+
w.TU,
|
|
36
83
|
// 2
|
|
37
|
-
|
|
84
|
+
w.WE,
|
|
38
85
|
// 3
|
|
39
|
-
|
|
86
|
+
w.TH,
|
|
40
87
|
// 4
|
|
41
|
-
|
|
88
|
+
w.FR,
|
|
42
89
|
// 5
|
|
43
|
-
|
|
90
|
+
w.SA
|
|
44
91
|
// 6
|
|
45
|
-
],
|
|
46
|
-
const
|
|
47
|
-
return t.forEach((
|
|
48
|
-
if (!
|
|
49
|
-
|
|
92
|
+
], K = (t, l, u) => {
|
|
93
|
+
const s = [];
|
|
94
|
+
return t.forEach((c) => {
|
|
95
|
+
if (!c.recurrence) {
|
|
96
|
+
c.start <= u && c.end >= l && s.push(c);
|
|
50
97
|
return;
|
|
51
98
|
}
|
|
52
99
|
try {
|
|
53
|
-
const
|
|
54
|
-
freq:
|
|
55
|
-
dtstart:
|
|
56
|
-
interval:
|
|
100
|
+
const e = c.recurrence, r = {
|
|
101
|
+
freq: q[e.frequency],
|
|
102
|
+
dtstart: c.start,
|
|
103
|
+
interval: e.interval || 1
|
|
57
104
|
};
|
|
58
|
-
if (
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
else if (
|
|
62
|
-
const { dayOfWeek: a, nth:
|
|
63
|
-
|
|
105
|
+
if (e.endType === "on_date" && e.until ? r.until = e.until : e.endType === "after_occurrences" && e.count && (r.count = e.count), e.frequency === "weekly" && e.daysOfWeek && e.daysOfWeek.length > 0 && (r.byweekday = e.daysOfWeek.map((a) => M[a])), e.frequency === "monthly") {
|
|
106
|
+
if (e.monthDay)
|
|
107
|
+
r.bymonthday = e.monthDay;
|
|
108
|
+
else if (e.nthDayOfWeek) {
|
|
109
|
+
const { dayOfWeek: a, nth: g } = e.nthDayOfWeek;
|
|
110
|
+
r.byweekday = M[a].nth(g);
|
|
64
111
|
}
|
|
65
112
|
}
|
|
66
|
-
if (
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
else if (
|
|
70
|
-
const { dayOfWeek: a, nth:
|
|
71
|
-
|
|
113
|
+
if (e.frequency === "yearly") {
|
|
114
|
+
if (e.month && (r.bymonth = e.month), e.monthDay)
|
|
115
|
+
r.bymonthday = e.monthDay;
|
|
116
|
+
else if (e.nthDayOfWeek) {
|
|
117
|
+
const { dayOfWeek: a, nth: g } = e.nthDayOfWeek;
|
|
118
|
+
r.byweekday = M[a].nth(g);
|
|
72
119
|
}
|
|
73
120
|
}
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
...
|
|
78
|
-
id: `${
|
|
121
|
+
const o = new w(r).between(l, u, !0), i = c.end.getTime() - c.start.getTime();
|
|
122
|
+
o.forEach((a, g) => {
|
|
123
|
+
s.push({
|
|
124
|
+
...c,
|
|
125
|
+
id: `${c.id}-occ-${g}`,
|
|
79
126
|
start: a,
|
|
80
|
-
end: new Date(a.getTime() +
|
|
127
|
+
end: new Date(a.getTime() + i)
|
|
81
128
|
});
|
|
82
129
|
});
|
|
83
|
-
} catch (
|
|
84
|
-
console.error("Failed to parse recurrence rule with rrule.js:",
|
|
130
|
+
} catch (e) {
|
|
131
|
+
console.error("Failed to parse recurrence rule with rrule.js:", e), c.start <= u && c.end >= l && s.push(c);
|
|
85
132
|
}
|
|
86
|
-
}),
|
|
87
|
-
},
|
|
88
|
-
const l =
|
|
89
|
-
T(
|
|
90
|
-
const
|
|
91
|
-
let
|
|
92
|
-
for (;
|
|
93
|
-
|
|
94
|
-
return
|
|
133
|
+
}), s;
|
|
134
|
+
}, P = (t) => {
|
|
135
|
+
const l = S(O(t));
|
|
136
|
+
W(T(t));
|
|
137
|
+
const u = [];
|
|
138
|
+
let s = l;
|
|
139
|
+
for (; u.length < 42; )
|
|
140
|
+
u.push(s), s = x(s, 1);
|
|
141
|
+
return u;
|
|
95
142
|
}, V = (t) => {
|
|
96
|
-
const l =
|
|
97
|
-
let
|
|
98
|
-
for (let
|
|
99
|
-
|
|
100
|
-
return
|
|
143
|
+
const l = S(t), u = [];
|
|
144
|
+
let s = l;
|
|
145
|
+
for (let c = 0; c < 7; c++)
|
|
146
|
+
u.push(s), s = x(s, 1);
|
|
147
|
+
return u;
|
|
101
148
|
}, $ = (t) => {
|
|
102
|
-
const l =
|
|
103
|
-
for (let
|
|
104
|
-
|
|
105
|
-
return
|
|
149
|
+
const l = C(t), u = [];
|
|
150
|
+
for (let s = 0; s < 12; s++)
|
|
151
|
+
u.push(R(l, s));
|
|
152
|
+
return u;
|
|
106
153
|
}, j = (t) => {
|
|
107
154
|
const l = /* @__PURE__ */ new Set();
|
|
108
|
-
return t.forEach((
|
|
109
|
-
let
|
|
110
|
-
const
|
|
111
|
-
for (;
|
|
112
|
-
l.add(
|
|
155
|
+
return t.forEach((u) => {
|
|
156
|
+
let s = h(u.start);
|
|
157
|
+
const c = h(u.end);
|
|
158
|
+
for (; s <= c; )
|
|
159
|
+
l.add(Y(s, "yyyy-MM-dd")), s = x(s, 1);
|
|
113
160
|
}), l;
|
|
114
161
|
}, A = (t, l) => {
|
|
115
162
|
if (t.length === 0) return [];
|
|
116
|
-
const
|
|
117
|
-
const n =
|
|
118
|
-
return
|
|
163
|
+
const u = h(t[0]), s = h(t[t.length - 1]), c = l.filter((r) => {
|
|
164
|
+
const n = h(r.start), o = h(r.end);
|
|
165
|
+
return H(n, x(s, 1)) && I(x(o, 1), u);
|
|
119
166
|
});
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
return
|
|
167
|
+
c.sort((r, n) => {
|
|
168
|
+
const o = k(h(r.end), h(r.start)), i = k(h(n.end), h(n.start));
|
|
169
|
+
return o !== i ? i - o : r.start.getTime() - n.start.getTime();
|
|
123
170
|
});
|
|
124
|
-
const
|
|
125
|
-
for (let
|
|
126
|
-
return
|
|
127
|
-
const n =
|
|
128
|
-
let
|
|
129
|
-
|
|
130
|
-
let a = t.findIndex((f) =>
|
|
171
|
+
const e = [], y = {};
|
|
172
|
+
for (let r = 0; r < t.length; r++) y[r] = /* @__PURE__ */ new Set();
|
|
173
|
+
return c.forEach((r) => {
|
|
174
|
+
const n = h(r.start), o = h(r.end);
|
|
175
|
+
let i = t.findIndex((f) => b(f, n));
|
|
176
|
+
i === -1 && (i = 0);
|
|
177
|
+
let a = t.findIndex((f) => b(f, o));
|
|
131
178
|
a === -1 && (a = t.length - 1);
|
|
132
|
-
const
|
|
133
|
-
let
|
|
134
|
-
for (; !
|
|
135
|
-
|
|
136
|
-
for (let f =
|
|
137
|
-
if (
|
|
138
|
-
|
|
179
|
+
const g = a - i + 1;
|
|
180
|
+
let d = 1, p = !1;
|
|
181
|
+
for (; !p; ) {
|
|
182
|
+
p = !0;
|
|
183
|
+
for (let f = i; f <= a; f++)
|
|
184
|
+
if (y[f].has(d)) {
|
|
185
|
+
p = !1, d++;
|
|
139
186
|
break;
|
|
140
187
|
}
|
|
141
188
|
}
|
|
142
|
-
for (let f =
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
event:
|
|
146
|
-
colStart:
|
|
147
|
-
colSpan:
|
|
148
|
-
row:
|
|
189
|
+
for (let f = i; f <= a; f++)
|
|
190
|
+
y[f].add(d);
|
|
191
|
+
e.push({
|
|
192
|
+
event: r,
|
|
193
|
+
colStart: i + 1,
|
|
194
|
+
colSpan: g,
|
|
195
|
+
row: d
|
|
149
196
|
});
|
|
150
|
-
}),
|
|
197
|
+
}), e;
|
|
151
198
|
}, N = (t, l) => {
|
|
152
|
-
const
|
|
199
|
+
const u = h(t), s = l.filter((n) => {
|
|
153
200
|
if (n.isAllDay) return !1;
|
|
154
|
-
const
|
|
155
|
-
return
|
|
201
|
+
const o = h(n.start), i = h(n.end);
|
|
202
|
+
return u >= o && u <= i;
|
|
156
203
|
});
|
|
157
|
-
|
|
158
|
-
const
|
|
159
|
-
return
|
|
204
|
+
s.sort((n, o) => {
|
|
205
|
+
const i = b(n.start, t) ? n.start.getHours() * 60 + n.start.getMinutes() : 0, a = b(o.start, t) ? o.start.getHours() * 60 + o.start.getMinutes() : 0;
|
|
206
|
+
return i - a;
|
|
160
207
|
});
|
|
161
|
-
const
|
|
162
|
-
let
|
|
163
|
-
return
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
}),
|
|
167
|
-
const
|
|
208
|
+
const c = [], e = [];
|
|
209
|
+
let y = [], r = 0;
|
|
210
|
+
return s.forEach((n) => {
|
|
211
|
+
const o = b(n.start, t), i = b(n.end, t), a = o ? n.start.getHours() * 60 + n.start.getMinutes() : 0, g = i ? n.end.getHours() * 60 + n.end.getMinutes() : 1440;
|
|
212
|
+
y.length === 0 ? (y.push(n), r = g) : a < r ? (y.push(n), r = Math.max(r, g)) : (e.push([...y]), y = [n], r = g);
|
|
213
|
+
}), y.length > 0 && e.push(y), e.forEach((n) => {
|
|
214
|
+
const o = [];
|
|
168
215
|
n.forEach((a) => {
|
|
169
|
-
const
|
|
170
|
-
let
|
|
171
|
-
for (let f = 0; f <
|
|
172
|
-
const
|
|
173
|
-
if (
|
|
174
|
-
|
|
216
|
+
const d = b(a.start, t) ? a.start.getHours() * 60 + a.start.getMinutes() : 0;
|
|
217
|
+
let p = !1;
|
|
218
|
+
for (let f = 0; f < o.length; f++) {
|
|
219
|
+
const m = o[f][o[f].length - 1], E = b(m.end, t) ? m.end.getHours() * 60 + m.end.getMinutes() : 1440;
|
|
220
|
+
if (d >= E) {
|
|
221
|
+
o[f].push(a), p = !0;
|
|
175
222
|
break;
|
|
176
223
|
}
|
|
177
224
|
}
|
|
178
|
-
|
|
225
|
+
p || o.push([a]);
|
|
179
226
|
});
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
a.forEach((
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
event:
|
|
186
|
-
top:
|
|
187
|
-
height:
|
|
188
|
-
left:
|
|
189
|
-
width: 100 /
|
|
227
|
+
const i = o.length;
|
|
228
|
+
o.forEach((a, g) => {
|
|
229
|
+
a.forEach((d) => {
|
|
230
|
+
const p = b(d.start, t), f = b(d.end, t), m = p ? d.start.getHours() * 60 + d.start.getMinutes() : 0, D = f ? d.end.getHours() * 60 + d.end.getMinutes() : 1440, E = Math.max(D - m, 15);
|
|
231
|
+
c.push({
|
|
232
|
+
event: d,
|
|
233
|
+
top: m / 1440 * 100,
|
|
234
|
+
height: E / 1440 * 100,
|
|
235
|
+
left: g / i * 100,
|
|
236
|
+
width: 100 / i
|
|
190
237
|
});
|
|
191
238
|
});
|
|
192
239
|
});
|
|
193
|
-
}),
|
|
240
|
+
}), c;
|
|
194
241
|
};
|
|
195
242
|
export {
|
|
196
|
-
|
|
243
|
+
K as expandEvents,
|
|
197
244
|
L as getCalendarBgClasses,
|
|
245
|
+
_ as getCalendarSidePanelBgClasses,
|
|
198
246
|
U as getCalendarStickyBgClasses,
|
|
199
|
-
|
|
247
|
+
P as getDaysForMonthView,
|
|
200
248
|
V as getDaysForWeekView,
|
|
201
249
|
j as getEventDaysMap,
|
|
202
250
|
A as getEventSegments,
|