@baishuyun/ui-mobile 0.3.0 → 0.5.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 +2 -11
- package/dist/ActionSheet/ActionSheet-Ok-UTVMn.js +133 -0
- package/dist/ActionSheet/index.js +5 -0
- package/dist/Calendar/Calendar-ipjycVqK.js +1580 -0
- package/dist/Calendar/index.js +4 -3
- package/dist/Calendar/timeUtils-CPYfw0pt.js +27 -0
- package/dist/ConfigProvider/ConfigProvider-CNhaKMJa.js +181 -0
- package/dist/ConfigProvider/index.js +3 -3
- package/dist/Gantt/Gantt-DDItjDkR.js +1099 -0
- package/dist/Gantt/index.js +7 -3
- package/dist/Icon/Icon-CFvcrGGg.js +23 -0
- package/dist/Icon/index.js +3 -0
- package/dist/components/ActionSheet/ActionSheet.d.ts +3 -0
- package/dist/components/ActionSheet/index.d.ts +2 -0
- package/dist/components/ActionSheet/interface.d.ts +75 -0
- package/dist/components/Calendar/index.d.ts +1 -1
- package/dist/components/Calendar/interface.d.ts +65 -7
- package/dist/components/ConfigProvider/context.d.ts +4 -0
- package/dist/components/Gantt/Gantt.d.ts +1 -1
- package/dist/components/Gantt/GanttBar.d.ts +10 -0
- package/dist/components/Gantt/GanttHeader.d.ts +2 -0
- package/dist/components/Gantt/GanttTimeLine.d.ts +9 -0
- package/dist/components/Gantt/HeaderToolbar.d.ts +6 -0
- package/dist/components/Gantt/OffscreenIndicatorArrow.d.ts +8 -0
- package/dist/components/Gantt/OffscreenIndicatorOverlay.d.ts +14 -0
- package/dist/components/Gantt/StickyLabel.d.ts +10 -0
- package/dist/components/Gantt/TodayIndicator.d.ts +14 -0
- package/dist/components/Gantt/calcTodayLeft.d.ts +8 -0
- package/dist/components/Gantt/context.d.ts +27 -0
- package/dist/components/Gantt/hooks/useGanttScroll.d.ts +23 -0
- package/dist/components/Gantt/hooks/useGanttViewport.d.ts +20 -0
- package/dist/components/Gantt/hooks/useTodayTracker.d.ts +7 -0
- package/dist/components/Gantt/index.d.ts +2 -1
- package/dist/components/Gantt/interface.d.ts +27 -2
- package/dist/components/Gantt/msUntilNextDay.d.ts +2 -0
- package/dist/components/Gantt/utils/color.d.ts +2 -0
- package/dist/components/Gantt/utils/cx.d.ts +1 -0
- package/dist/components/Gantt/utils/dateRangeNormalizer.d.ts +25 -0
- package/dist/components/Gantt/utils/dayScale.d.ts +30 -0
- package/dist/components/Gantt/utils/headerTimeUtils.d.ts +43 -0
- package/dist/components/Gantt/utils/layoutBars.d.ts +26 -0
- package/dist/components/Gantt/utils/time.d.ts +4 -0
- package/dist/components/Gantt/utils/viewportDateUtils.d.ts +11 -0
- package/dist/components/Gantt/utils/zoomReanchor.d.ts +18 -0
- package/dist/components/Icon/Icon.d.ts +6 -0
- package/dist/components/Icon/index.d.ts +2 -0
- package/dist/components/Icon/interface.d.ts +19 -0
- package/dist/components/Icon/loadIconfont.d.ts +1 -0
- package/dist/components/index.d.ts +7 -2
- package/dist/index.js +9 -6
- package/dist/locale/index.d.ts +3 -0
- package/dist/locale/lang/en-US.json.d.ts +41 -0
- package/dist/locale/lang/zh-CN.json.d.ts +41 -0
- package/dist/locale/lang/zh-TW.json.d.ts +41 -0
- package/dist/style.css +1 -1
- package/dist/vendors/useLocale-CMHIlzlj.js +98 -0
- package/dist/vendors/{version-BVySNITW.js → version-3D9AaDf3.js} +1 -1
- package/dist/vite-env.d.ts +1 -0
- package/package.json +6 -1
- package/dist/Calendar/Calendar-6ibIyMx0.js +0 -1606
- package/dist/ConfigProvider/ConfigProvider-E792q6ny.js +0 -99
- package/dist/Gantt/Gantt-DLmqZPAQ.js +0 -8
- package/dist/vendors/useLocale-BbUDQCzl.js +0 -57
|
@@ -0,0 +1,1580 @@
|
|
|
1
|
+
import { t as e } from "../vendors/useLocale-CMHIlzlj.js";
|
|
2
|
+
import { n as t, r as n, t as r } from "./timeUtils-CPYfw0pt.js";
|
|
3
|
+
import i, { createContext as a, forwardRef as o, useCallback as s, useContext as c, useEffect as l, useLayoutEffect as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
4
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
5
|
+
import { useControllableValue as g, useLatest as _, useSize as v } from "ahooks";
|
|
6
|
+
import y from "dayjs";
|
|
7
|
+
//#region src/components/Calendar/Calendar.module.scss
|
|
8
|
+
var b = {
|
|
9
|
+
"bsy-mobile-calendar": "_bsy-mobile-calendar_12jhk_1",
|
|
10
|
+
"bsy-mobile-calendar__body": "_bsy-mobile-calendar__body_12jhk_15"
|
|
11
|
+
}, x = a(null), S = ({ children: n, currentDate: i, setCurrentDate: a, viewMode: o, setViewMode: c, scheduleColor: l, timeZone: u, events: f, onEventClick: p, onDayClick: h }) => {
|
|
12
|
+
let { t: g } = e(), _ = d(() => t(u), [u]), v = s(() => {
|
|
13
|
+
let e = r(u);
|
|
14
|
+
y(i).isSame(e, "day") || a(e.toDate());
|
|
15
|
+
}, [
|
|
16
|
+
i,
|
|
17
|
+
a,
|
|
18
|
+
u
|
|
19
|
+
]), b = d(() => g("calendar.yearMonth", {
|
|
20
|
+
year: i.getFullYear(),
|
|
21
|
+
monthShort: g(`calendar.monthShort.${i.getMonth() + 1}`)
|
|
22
|
+
}), [i, g]), S = d(() => ({
|
|
23
|
+
currentDate: i,
|
|
24
|
+
setCurrentDate: a,
|
|
25
|
+
goToToday: v,
|
|
26
|
+
viewMode: o,
|
|
27
|
+
setViewMode: c,
|
|
28
|
+
yearMonthText: b,
|
|
29
|
+
scheduleColor: l,
|
|
30
|
+
timeZone: u,
|
|
31
|
+
timezoneLabel: _,
|
|
32
|
+
events: f,
|
|
33
|
+
onEventClick: p,
|
|
34
|
+
onDayClick: h
|
|
35
|
+
}), [
|
|
36
|
+
i,
|
|
37
|
+
a,
|
|
38
|
+
v,
|
|
39
|
+
o,
|
|
40
|
+
c,
|
|
41
|
+
b,
|
|
42
|
+
l,
|
|
43
|
+
u,
|
|
44
|
+
_,
|
|
45
|
+
f,
|
|
46
|
+
p,
|
|
47
|
+
h
|
|
48
|
+
]);
|
|
49
|
+
return /* @__PURE__ */ m(x.Provider, {
|
|
50
|
+
value: S,
|
|
51
|
+
children: n
|
|
52
|
+
});
|
|
53
|
+
}, C = () => {
|
|
54
|
+
let e = c(x);
|
|
55
|
+
if (!e) throw Error("useCalendarContext must be used within a CalendarProvider");
|
|
56
|
+
return e;
|
|
57
|
+
}, w = (...e) => e.filter(Boolean).join(" "), T = {
|
|
58
|
+
"bsy-mobile-calendar-header": "_bsy-mobile-calendar-header_r7swj_1",
|
|
59
|
+
"bsy-mobile-calendar-header__left": "_bsy-mobile-calendar-header__left_r7swj_12",
|
|
60
|
+
"bsy-mobile-calendar-header__year-month": "_bsy-mobile-calendar-header__year-month_r7swj_18",
|
|
61
|
+
"bsy-mobile-calendar-header__today": "_bsy-mobile-calendar-header__today_r7swj_23",
|
|
62
|
+
"bsy-mobile-calendar-segmented": "_bsy-mobile-calendar-segmented_r7swj_33",
|
|
63
|
+
"bsy-mobile-calendar-segmented__item": "_bsy-mobile-calendar-segmented__item_r7swj_39",
|
|
64
|
+
"bsy-mobile-calendar-segmented__item--active": "_bsy-mobile-calendar-segmented__item--active_r7swj_50"
|
|
65
|
+
}, E = [
|
|
66
|
+
{
|
|
67
|
+
key: "calendar.viewDay",
|
|
68
|
+
value: "day"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
key: "calendar.viewThreeDay",
|
|
72
|
+
value: "threeDay"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
key: "calendar.viewMonth",
|
|
76
|
+
value: "month"
|
|
77
|
+
}
|
|
78
|
+
], D = () => {
|
|
79
|
+
let { yearMonthText: t, goToToday: n, viewMode: r, setViewMode: i } = C(), { t: a } = e();
|
|
80
|
+
return /* @__PURE__ */ h("div", {
|
|
81
|
+
className: T["bsy-mobile-calendar-header"],
|
|
82
|
+
children: [/* @__PURE__ */ h("div", {
|
|
83
|
+
className: T["bsy-mobile-calendar-header__left"],
|
|
84
|
+
children: [/* @__PURE__ */ m("span", {
|
|
85
|
+
className: T["bsy-mobile-calendar-header__year-month"],
|
|
86
|
+
children: t
|
|
87
|
+
}), /* @__PURE__ */ m("button", {
|
|
88
|
+
className: T["bsy-mobile-calendar-header__today"],
|
|
89
|
+
onClick: n,
|
|
90
|
+
type: "button",
|
|
91
|
+
children: a("calendar.today")
|
|
92
|
+
})]
|
|
93
|
+
}), /* @__PURE__ */ m("div", {
|
|
94
|
+
className: T["bsy-mobile-calendar-segmented"],
|
|
95
|
+
role: "tablist",
|
|
96
|
+
children: E.map((e) => /* @__PURE__ */ m("button", {
|
|
97
|
+
type: "button",
|
|
98
|
+
role: "tab",
|
|
99
|
+
"aria-selected": r === e.value,
|
|
100
|
+
className: w(T["bsy-mobile-calendar-segmented__item"], r === e.value && T["bsy-mobile-calendar-segmented__item--active"]),
|
|
101
|
+
onClick: () => i(e.value),
|
|
102
|
+
children: a(e.key)
|
|
103
|
+
}, e.value))
|
|
104
|
+
})]
|
|
105
|
+
});
|
|
106
|
+
}, O = "0.4s", k = "cubic-bezier(0.25, 0.8, 0.25, 1)", A = 26, j = {
|
|
107
|
+
HEADER_HEIGHT: 24,
|
|
108
|
+
SLOT_HEIGHT: 22,
|
|
109
|
+
SLOT_GAP: 4,
|
|
110
|
+
WEEK_PADDING_X: 10
|
|
111
|
+
}, M = [
|
|
112
|
+
1,
|
|
113
|
+
2,
|
|
114
|
+
3,
|
|
115
|
+
4,
|
|
116
|
+
5,
|
|
117
|
+
6,
|
|
118
|
+
7
|
|
119
|
+
], N = {
|
|
120
|
+
"bsy-mobile-calendar-month": "_bsy-mobile-calendar-month_lsyxr_1",
|
|
121
|
+
"bsy-mobile-calendar-weekday-header": "_bsy-mobile-calendar-weekday-header_lsyxr_7",
|
|
122
|
+
"bsy-mobile-calendar-weekday-header__item": "_bsy-mobile-calendar-weekday-header__item_lsyxr_13",
|
|
123
|
+
"bsy-mobile-calendar-carousel": "_bsy-mobile-calendar-carousel_lsyxr_21",
|
|
124
|
+
"bsy-mobile-calendar-month-slide": "_bsy-mobile-calendar-month-slide_lsyxr_28",
|
|
125
|
+
"bsy-mobile-calendar-week-row": "_bsy-mobile-calendar-week-row_lsyxr_35",
|
|
126
|
+
"bsy-mobile-calendar-week-row__cells": "_bsy-mobile-calendar-week-row__cells_lsyxr_40",
|
|
127
|
+
"bsy-mobile-calendar-day-cell": "_bsy-mobile-calendar-day-cell_lsyxr_45",
|
|
128
|
+
"bsy-mobile-calendar-day-cell__header": "_bsy-mobile-calendar-day-cell__header_lsyxr_51",
|
|
129
|
+
"bsy-mobile-calendar-day-cell__body": "_bsy-mobile-calendar-day-cell__body_lsyxr_59",
|
|
130
|
+
"bsy-mobile-calendar-day-cell__text": "_bsy-mobile-calendar-day-cell__text_lsyxr_63",
|
|
131
|
+
"bsy-mobile-calendar-day-cell__text--today": "_bsy-mobile-calendar-day-cell__text--today_lsyxr_72",
|
|
132
|
+
"bsy-mobile-calendar-day-cell__text--other": "_bsy-mobile-calendar-day-cell__text--other_lsyxr_78",
|
|
133
|
+
"bsy-mobile-calendar-day-cell__badge": "_bsy-mobile-calendar-day-cell__badge_lsyxr_81",
|
|
134
|
+
"bsy-mobile-calendar-week-events": "_bsy-mobile-calendar-week-events_lsyxr_97",
|
|
135
|
+
"bsy-mobile-calendar-week-events__segment": "_bsy-mobile-calendar-week-events__segment_lsyxr_108"
|
|
136
|
+
}, ee = () => {
|
|
137
|
+
let { t } = e();
|
|
138
|
+
return /* @__PURE__ */ m("div", {
|
|
139
|
+
className: N["bsy-mobile-calendar-weekday-header"],
|
|
140
|
+
children: M.map((e) => /* @__PURE__ */ m("div", {
|
|
141
|
+
className: N["bsy-mobile-calendar-weekday-header__item"],
|
|
142
|
+
children: t(`calendar.weekday.${e}`)
|
|
143
|
+
}, e))
|
|
144
|
+
});
|
|
145
|
+
}, te = o(function({ date: e, isCurrentMonth: t, isToday: n, hiddenCount: r = 0 }, i) {
|
|
146
|
+
return /* @__PURE__ */ h("div", {
|
|
147
|
+
ref: i,
|
|
148
|
+
className: N["bsy-mobile-calendar-day-cell"],
|
|
149
|
+
children: [/* @__PURE__ */ h("div", {
|
|
150
|
+
className: N["bsy-mobile-calendar-day-cell__header"],
|
|
151
|
+
children: [/* @__PURE__ */ m("div", {
|
|
152
|
+
className: w(N["bsy-mobile-calendar-day-cell__text"], !t && N["bsy-mobile-calendar-day-cell__text--other"], n && N["bsy-mobile-calendar-day-cell__text--today"]),
|
|
153
|
+
children: e.date()
|
|
154
|
+
}), r > 0 ? /* @__PURE__ */ h("div", {
|
|
155
|
+
className: N["bsy-mobile-calendar-day-cell__badge"],
|
|
156
|
+
children: ["+", r]
|
|
157
|
+
}) : null]
|
|
158
|
+
}), /* @__PURE__ */ m("div", { className: N["bsy-mobile-calendar-day-cell__body"] })]
|
|
159
|
+
});
|
|
160
|
+
}), P = {
|
|
161
|
+
"bsy-mobile-calendar-event-card": "_bsy-mobile-calendar-event-card_r9n00_1",
|
|
162
|
+
"bsy-mobile-calendar-event-card--timed": "_bsy-mobile-calendar-event-card--timed_r9n00_17",
|
|
163
|
+
"bsy-mobile-calendar-event-card--start": "_bsy-mobile-calendar-event-card--start_r9n00_30",
|
|
164
|
+
"bsy-mobile-calendar-event-card--end": "_bsy-mobile-calendar-event-card--end_r9n00_34",
|
|
165
|
+
"bsy-mobile-calendar-event-card--continue": "_bsy-mobile-calendar-event-card--continue_r9n00_38",
|
|
166
|
+
"bsy-mobile-calendar-event-card__timed-body": "_bsy-mobile-calendar-event-card__timed-body_r9n00_42",
|
|
167
|
+
"bsy-mobile-calendar-event-card__title": "_bsy-mobile-calendar-event-card__title_r9n00_46",
|
|
168
|
+
"bsy-mobile-calendar-event-card__time": "_bsy-mobile-calendar-event-card__time_r9n00_42"
|
|
169
|
+
}, F = i.memo(({ label: e, showLabel: t = !0, isStart: n = !0, isEnd: r = !0, isContinue: i = !1, height: a = 22, style: o, className: s, onClick: c, variant: l = "allDay", timeText: u }) => /* @__PURE__ */ m("div", {
|
|
170
|
+
className: w(P["bsy-mobile-calendar-event-card"], l === "timed" && P["bsy-mobile-calendar-event-card--timed"], n && P["bsy-mobile-calendar-event-card--start"], r && P["bsy-mobile-calendar-event-card--end"], i && P["bsy-mobile-calendar-event-card--continue"], s),
|
|
171
|
+
style: {
|
|
172
|
+
height: a,
|
|
173
|
+
lineHeight: l === "timed" ? "normal" : `${a}px`,
|
|
174
|
+
...o
|
|
175
|
+
},
|
|
176
|
+
onClick: c ? (e) => {
|
|
177
|
+
e.stopPropagation(), c();
|
|
178
|
+
} : void 0,
|
|
179
|
+
role: c ? "button" : void 0,
|
|
180
|
+
children: t ? l === "timed" ? /* @__PURE__ */ h("div", {
|
|
181
|
+
className: P["bsy-mobile-calendar-event-card__timed-body"],
|
|
182
|
+
children: [/* @__PURE__ */ m("div", {
|
|
183
|
+
className: P["bsy-mobile-calendar-event-card__title"],
|
|
184
|
+
children: e
|
|
185
|
+
}), !!u && /* @__PURE__ */ m("div", {
|
|
186
|
+
className: P["bsy-mobile-calendar-event-card__time"],
|
|
187
|
+
children: u
|
|
188
|
+
})]
|
|
189
|
+
}) : e : null
|
|
190
|
+
}));
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region src/components/Calendar/utils/monthLayoutAlgorithm.ts
|
|
193
|
+
function ne(e) {
|
|
194
|
+
let { startCol: t, endCol: n, row: r } = e, { HEADER_HEIGHT: i, SLOT_HEIGHT: a, SLOT_GAP: o, WEEK_PADDING_X: s } = j, c = 100 / 7, l = s;
|
|
195
|
+
return {
|
|
196
|
+
top: i + r * (a + o),
|
|
197
|
+
height: a,
|
|
198
|
+
left: `calc(${t * c}% + ${l}px)`,
|
|
199
|
+
width: `calc(${(n - t) * c}% - ${l}px)`
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function I(e, t, n) {
|
|
203
|
+
let r = y(e.startTime), i = y(e.endTime), a = t.add(n, "day"), o = r.isBefore(t) ? t : r, s = i.isAfter(a) ? a : i, c = o.diff(t, "day"), l = r.startOf("day").diff(t.startOf("day"), "day"), u = s.hour() === 0 && s.minute() === 0 && s.second() === 0 ? s.diff(t, "day") : s.diff(t, "day") + 1;
|
|
204
|
+
return o.valueOf() === s.valueOf() && c >= 0 && c < n && (u = Math.min(c + 1, n)), {
|
|
205
|
+
event: e,
|
|
206
|
+
startDayIndex: c,
|
|
207
|
+
endDayIndex: u,
|
|
208
|
+
span: u - c,
|
|
209
|
+
originalStartDayIndex: l
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function re(e, t, n) {
|
|
213
|
+
if (!e || e.length === 0) return /* @__PURE__ */ new Map();
|
|
214
|
+
let r = e.map((e) => I(e, t, n));
|
|
215
|
+
r.sort((e, t) => e.startDayIndex === t.startDayIndex ? t.span - e.span : e.startDayIndex - t.startDayIndex);
|
|
216
|
+
let i = /* @__PURE__ */ new Map(), a = [];
|
|
217
|
+
for (let e of r) {
|
|
218
|
+
let { event: t, startDayIndex: n, endDayIndex: r } = e, o = -1;
|
|
219
|
+
for (let e = 0; e <= a.length; e += 1) {
|
|
220
|
+
a[e] || (a[e] = []);
|
|
221
|
+
let t = !0;
|
|
222
|
+
for (let i = n; i < r; i += 1) if (a[e][i]) {
|
|
223
|
+
t = !1;
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
if (t) {
|
|
227
|
+
o = e;
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
a[o] || (a[o] = []);
|
|
232
|
+
for (let e = n; e < r; e += 1) a[o][e] = t.id;
|
|
233
|
+
i.set(t.id, o);
|
|
234
|
+
}
|
|
235
|
+
return i;
|
|
236
|
+
}
|
|
237
|
+
function ie(e, t) {
|
|
238
|
+
let { event: n, startDayIndex: r, endDayIndex: i, originalStartDayIndex: a } = e, o = [], s = r;
|
|
239
|
+
for (; s < i;) {
|
|
240
|
+
let e = Math.floor(s / 7), r = (e + 1) * 7, c = Math.min(i, r), l = s % 7;
|
|
241
|
+
o.push({
|
|
242
|
+
event: n,
|
|
243
|
+
weekIndex: e,
|
|
244
|
+
startCol: l,
|
|
245
|
+
endCol: c - e * 7,
|
|
246
|
+
row: t,
|
|
247
|
+
isStart: s === a,
|
|
248
|
+
isEnd: c === i,
|
|
249
|
+
isWeekStart: l === 0
|
|
250
|
+
}), s = c;
|
|
251
|
+
}
|
|
252
|
+
return o;
|
|
253
|
+
}
|
|
254
|
+
function ae(e, t, n, r, i) {
|
|
255
|
+
let a = /* @__PURE__ */ new Set();
|
|
256
|
+
if (!t || t.length === 0) return a;
|
|
257
|
+
let o = t.map((e) => I(e, n, r)), s = Array.from({ length: r }, () => []);
|
|
258
|
+
for (let e of o) for (let t = e.startDayIndex; t < e.endDayIndex; t += 1) s[t].push(e);
|
|
259
|
+
for (let t = 0; t < r; t += 1) {
|
|
260
|
+
let n = s[t].filter((e) => !a.has(e.event.id));
|
|
261
|
+
for (let t of n) (e.get(t.event.id) ?? 0) >= i && a.add(t.event.id);
|
|
262
|
+
}
|
|
263
|
+
return a;
|
|
264
|
+
}
|
|
265
|
+
function oe(e, t, n = 6) {
|
|
266
|
+
let r = n * 7;
|
|
267
|
+
if (!e || e.length === 0) return {
|
|
268
|
+
weekLayouts: Array.from({ length: n }, () => []),
|
|
269
|
+
eventRowMap: /* @__PURE__ */ new Map(),
|
|
270
|
+
gridEvents: []
|
|
271
|
+
};
|
|
272
|
+
let i = re(e, t, r), a = e.map((e) => I(e, t, r)), o = Array.from({ length: n }, () => []);
|
|
273
|
+
for (let e of a) {
|
|
274
|
+
let t = ie(e, i.get(e.event.id) ?? 0);
|
|
275
|
+
for (let e of t) o[e.weekIndex].push(e);
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
weekLayouts: o,
|
|
279
|
+
eventRowMap: i,
|
|
280
|
+
gridEvents: a
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
function se(e, t, n) {
|
|
284
|
+
let r = Array(7).fill(0), i = Array.from({ length: 7 }, () => /* @__PURE__ */ new Set());
|
|
285
|
+
for (let a of e) {
|
|
286
|
+
let e = a.event.id;
|
|
287
|
+
if (t.has(e) || a.row >= n) for (let t = a.startCol; t < a.endCol; t += 1) i[t].has(e) || (i[t].add(e), r[t] += 1);
|
|
288
|
+
}
|
|
289
|
+
return r;
|
|
290
|
+
}
|
|
291
|
+
var ce = i.memo(({ segments: e, hiddenScheduleIds: t, maxVisibleRows: n }) => {
|
|
292
|
+
let { onEventClick: r } = C(), i = e.filter((e) => !t.has(e.event.id) && e.row < n);
|
|
293
|
+
return /* @__PURE__ */ m("div", {
|
|
294
|
+
className: N["bsy-mobile-calendar-week-events"],
|
|
295
|
+
children: i.map((e) => {
|
|
296
|
+
let t = ne(e), { event: n, isStart: i, isEnd: a, isWeekStart: o } = e, s = i || o;
|
|
297
|
+
return /* @__PURE__ */ m(F, {
|
|
298
|
+
className: N["bsy-mobile-calendar-week-events__segment"],
|
|
299
|
+
label: n.label,
|
|
300
|
+
showLabel: s,
|
|
301
|
+
isStart: i,
|
|
302
|
+
isEnd: a,
|
|
303
|
+
isContinue: !i && o,
|
|
304
|
+
height: t.height,
|
|
305
|
+
style: {
|
|
306
|
+
top: t.top,
|
|
307
|
+
left: t.left,
|
|
308
|
+
width: t.width
|
|
309
|
+
},
|
|
310
|
+
onClick: () => r?.(n)
|
|
311
|
+
}, `${n.id}-${e.weekIndex}-${e.startCol}`);
|
|
312
|
+
})
|
|
313
|
+
});
|
|
314
|
+
});
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region src/components/Calendar/utils/dateUtils.ts
|
|
317
|
+
function le(e) {
|
|
318
|
+
let t = y(e).startOf("isoWeek");
|
|
319
|
+
return Array.from({ length: 7 }, (e, n) => t.add(n, "day"));
|
|
320
|
+
}
|
|
321
|
+
function ue(e) {
|
|
322
|
+
let t = e.startOf("month"), n = t.isoWeekday() - 1, r = t.subtract(n, "day"), i = [];
|
|
323
|
+
for (let e = 0; e < 42; e += 1) i.push(r.add(e, "day"));
|
|
324
|
+
return i;
|
|
325
|
+
}
|
|
326
|
+
function de(e) {
|
|
327
|
+
let t = [];
|
|
328
|
+
for (let n = 0; n < e.length; n += 7) t.push(e.slice(n, n + 7));
|
|
329
|
+
return t;
|
|
330
|
+
}
|
|
331
|
+
function L(e, t) {
|
|
332
|
+
return e.isSame(r(t), "day");
|
|
333
|
+
}
|
|
334
|
+
function fe(e, t) {
|
|
335
|
+
return e.isSame(t, "month");
|
|
336
|
+
}
|
|
337
|
+
function R(e) {
|
|
338
|
+
return y(e.startTime).format("YYYY-MM-DD") !== y(e.endTime).format("YYYY-MM-DD");
|
|
339
|
+
}
|
|
340
|
+
function pe(e, t) {
|
|
341
|
+
let n = t.startOf("day"), r = y(e.startTime).startOf("day"), i = y(e.endTime).startOf("day");
|
|
342
|
+
return !n.isBefore(r) && !n.isAfter(i);
|
|
343
|
+
}
|
|
344
|
+
function me(e, t) {
|
|
345
|
+
let n = t.startOf("day");
|
|
346
|
+
return e.filter((e) => {
|
|
347
|
+
let t = y(e.startTime), r = y(e.endTime), i = t.startOf("day"), a = r.hour() === 0 && r.minute() === 0 && r.second() === 0, o = t.valueOf() === r.valueOf(), s = r.startOf("day");
|
|
348
|
+
return a && !o && (s = r.subtract(1, "day").startOf("day")), !n.isBefore(i) && !n.isAfter(s);
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
//#endregion
|
|
352
|
+
//#region src/components/Calendar/CalendarMonth/WeekRow/WeekRow.tsx
|
|
353
|
+
var he = ({ dates: e, monthDate: t, segments: n, hiddenCounts: r, hiddenScheduleIds: i, maxVisibleRows: a, cellRef: o, onDayClick: s }) => {
|
|
354
|
+
let { timeZone: c } = C();
|
|
355
|
+
return /* @__PURE__ */ h("div", {
|
|
356
|
+
className: N["bsy-mobile-calendar-week-row"],
|
|
357
|
+
onClick: (t) => {
|
|
358
|
+
if (!s) return;
|
|
359
|
+
let n = t.currentTarget.getBoundingClientRect(), r = t.clientX - n.left, i = n.width / 7, a = Math.floor(r / i);
|
|
360
|
+
a >= 0 && a < e.length && s(e[a]);
|
|
361
|
+
},
|
|
362
|
+
children: [/* @__PURE__ */ m("div", {
|
|
363
|
+
className: N["bsy-mobile-calendar-week-row__cells"],
|
|
364
|
+
children: e.map((e, n) => /* @__PURE__ */ m(te, {
|
|
365
|
+
ref: n === 0 ? o : void 0,
|
|
366
|
+
date: e,
|
|
367
|
+
isCurrentMonth: fe(e, t),
|
|
368
|
+
isToday: L(e, c),
|
|
369
|
+
hiddenCount: r[n] || 0
|
|
370
|
+
}, e.format("YYYY-MM-DD")))
|
|
371
|
+
}), /* @__PURE__ */ m(ce, {
|
|
372
|
+
segments: n,
|
|
373
|
+
hiddenScheduleIds: i,
|
|
374
|
+
maxVisibleRows: a
|
|
375
|
+
})]
|
|
376
|
+
});
|
|
377
|
+
};
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region src/components/Calendar/hooks/useMonthDates.ts
|
|
380
|
+
function ge(e) {
|
|
381
|
+
return { weeks: d(() => de(ue(e)), [e.format("YYYY-MM")]) };
|
|
382
|
+
}
|
|
383
|
+
//#endregion
|
|
384
|
+
//#region src/components/Calendar/hooks/useCellHeight.ts
|
|
385
|
+
var { HEADER_HEIGHT: _e, SLOT_HEIGHT: ve, SLOT_GAP: ye } = j;
|
|
386
|
+
function be() {
|
|
387
|
+
let e = f(null), [t, n] = p(2);
|
|
388
|
+
return l(() => {
|
|
389
|
+
let t = e.current;
|
|
390
|
+
if (!t) return;
|
|
391
|
+
let r = (e) => {
|
|
392
|
+
let t = e - _e;
|
|
393
|
+
return Math.max(1, Math.floor(t / (ve + ye)));
|
|
394
|
+
}, i = new ResizeObserver((e) => {
|
|
395
|
+
requestAnimationFrame(() => {
|
|
396
|
+
let t = e[0]?.contentRect.height;
|
|
397
|
+
t && n(r(t));
|
|
398
|
+
});
|
|
399
|
+
});
|
|
400
|
+
i.observe(t);
|
|
401
|
+
let a = t.getBoundingClientRect().height;
|
|
402
|
+
return a > 0 && n(r(a)), () => i.disconnect();
|
|
403
|
+
}, []), {
|
|
404
|
+
cellRef: e,
|
|
405
|
+
maxVisibleRows: t
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
//#endregion
|
|
409
|
+
//#region src/components/Calendar/hooks/useMonthEventLayout.ts
|
|
410
|
+
function xe({ events: e, monthDate: t, maxVisibleRows: n }) {
|
|
411
|
+
return d(() => {
|
|
412
|
+
if (!e || e.length === 0) return {
|
|
413
|
+
weekLayouts: Array.from({ length: 6 }, () => []),
|
|
414
|
+
hiddenScheduleIds: /* @__PURE__ */ new Set(),
|
|
415
|
+
weekHiddenCounts: Array.from({ length: 6 }, () => Array(7).fill(0))
|
|
416
|
+
};
|
|
417
|
+
let r = ue(t)[0], { weekLayouts: i, eventRowMap: a } = oe(e, r, 6), o = ae(a, e, r, 42, n);
|
|
418
|
+
return {
|
|
419
|
+
weekLayouts: i,
|
|
420
|
+
hiddenScheduleIds: o,
|
|
421
|
+
weekHiddenCounts: i.map((e) => se(e, o, n))
|
|
422
|
+
};
|
|
423
|
+
}, [
|
|
424
|
+
e,
|
|
425
|
+
t.format("YYYY-MM"),
|
|
426
|
+
n
|
|
427
|
+
]);
|
|
428
|
+
}
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region src/components/Calendar/CalendarMonth/MonthSlide/MonthSlide.tsx
|
|
431
|
+
var Se = ({ monthDate: e, containerWidth: t, events: n, style: r, onDayClick: i }) => {
|
|
432
|
+
let { weeks: a } = ge(e), { cellRef: o, maxVisibleRows: s } = be(), { weekLayouts: c, hiddenScheduleIds: l, weekHiddenCounts: u } = xe({
|
|
433
|
+
events: n,
|
|
434
|
+
monthDate: e,
|
|
435
|
+
maxVisibleRows: s
|
|
436
|
+
});
|
|
437
|
+
return /* @__PURE__ */ m("div", {
|
|
438
|
+
className: N["bsy-mobile-calendar-month-slide"],
|
|
439
|
+
style: {
|
|
440
|
+
width: t,
|
|
441
|
+
...r
|
|
442
|
+
},
|
|
443
|
+
children: a.map((t, n) => /* @__PURE__ */ m(he, {
|
|
444
|
+
dates: t,
|
|
445
|
+
monthDate: e,
|
|
446
|
+
segments: c[n] || [],
|
|
447
|
+
hiddenCounts: u[n] || Array(7).fill(0),
|
|
448
|
+
hiddenScheduleIds: l,
|
|
449
|
+
maxVisibleRows: s,
|
|
450
|
+
cellRef: n === 0 ? o : void 0,
|
|
451
|
+
onDayClick: i
|
|
452
|
+
}, `week-${n}`))
|
|
453
|
+
});
|
|
454
|
+
}, Ce = (e) => e.subtract(1, "month"), z = (e) => e.add(1, "month");
|
|
455
|
+
function we({ currentDate: e, setCurrentDate: t, containerWidth: n }) {
|
|
456
|
+
let r = d(() => [
|
|
457
|
+
Ce(e),
|
|
458
|
+
e,
|
|
459
|
+
z(e)
|
|
460
|
+
], [e.format("YYYY-MM")]), [i, a] = p(0), [o, c] = p(!1), l = f({
|
|
461
|
+
startX: 0,
|
|
462
|
+
startY: 0,
|
|
463
|
+
startTime: 0,
|
|
464
|
+
isDragging: !1,
|
|
465
|
+
isVerticalScroll: !1,
|
|
466
|
+
directionLocked: !1
|
|
467
|
+
}), u = _(e), m = _(t), h = _(n), g = _(i), v = s((e) => {
|
|
468
|
+
if (l.current.isDragging) return;
|
|
469
|
+
let t = e.touches[0];
|
|
470
|
+
l.current = {
|
|
471
|
+
startX: t.clientX,
|
|
472
|
+
startY: t.clientY,
|
|
473
|
+
startTime: Date.now(),
|
|
474
|
+
isDragging: !0,
|
|
475
|
+
isVerticalScroll: !1,
|
|
476
|
+
directionLocked: !1
|
|
477
|
+
}, c(!1);
|
|
478
|
+
}, []), y = s((e) => {
|
|
479
|
+
if (!l.current.isDragging) return;
|
|
480
|
+
let t = e.touches[0], n = t.clientX - l.current.startX, r = t.clientY - l.current.startY;
|
|
481
|
+
if (!l.current.directionLocked && (Math.abs(n) > 10 || Math.abs(r) > 10) && (l.current.directionLocked = !0, Math.abs(r) > Math.abs(n))) {
|
|
482
|
+
l.current.isVerticalScroll = !0;
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
l.current.isVerticalScroll || a(n);
|
|
486
|
+
}, []), b = s(() => {
|
|
487
|
+
if (!l.current.isDragging) return;
|
|
488
|
+
let e = h.current ?? 0, t = g.current ?? 0;
|
|
489
|
+
if (l.current.isDragging = !1, !e || l.current.isVerticalScroll) return;
|
|
490
|
+
let n = Date.now() - l.current.startTime, r = Math.abs(t) / n, i = Math.abs(t) > e * .35 || r > .3;
|
|
491
|
+
c(!0), a(i && t !== 0 ? -(t > 0 ? -1 : 1) * e : 0);
|
|
492
|
+
}, [h, g]), x = s(() => {
|
|
493
|
+
let e = g.current ?? 0, t = u.current, n = m.current;
|
|
494
|
+
if (e !== 0 && t && n) {
|
|
495
|
+
let r = (e > 0 ? -1 : 1) == 1 ? z(t) : Ce(t);
|
|
496
|
+
c(!1), a(0), n(r);
|
|
497
|
+
}
|
|
498
|
+
}, [
|
|
499
|
+
g,
|
|
500
|
+
u,
|
|
501
|
+
m
|
|
502
|
+
]);
|
|
503
|
+
return {
|
|
504
|
+
months: r,
|
|
505
|
+
translateX: i,
|
|
506
|
+
transitionEnabled: o,
|
|
507
|
+
bindEvents: d(() => ({
|
|
508
|
+
onTouchStart: v,
|
|
509
|
+
onTouchMove: y,
|
|
510
|
+
onTouchEnd: b,
|
|
511
|
+
onTouchCancel: b
|
|
512
|
+
}), [
|
|
513
|
+
v,
|
|
514
|
+
y,
|
|
515
|
+
b
|
|
516
|
+
]),
|
|
517
|
+
handleTransitionEnd: x
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
//#endregion
|
|
521
|
+
//#region src/components/Calendar/CalendarMonth/MonthCarousel/MonthCarousel.tsx
|
|
522
|
+
var Te = ({ currentDate: e, setCurrentDate: t, containerWidth: n, events: r }) => {
|
|
523
|
+
let { onDayClick: i } = C(), { months: a, translateX: o, transitionEnabled: s, bindEvents: c, handleTransitionEnd: l } = we({
|
|
524
|
+
currentDate: e,
|
|
525
|
+
setCurrentDate: t,
|
|
526
|
+
containerWidth: n
|
|
527
|
+
}), u = (e) => {
|
|
528
|
+
let t = me(r, e);
|
|
529
|
+
i?.(e.toDate(), t);
|
|
530
|
+
};
|
|
531
|
+
return n ? /* @__PURE__ */ m("div", {
|
|
532
|
+
className: N["bsy-mobile-calendar-carousel"],
|
|
533
|
+
...c,
|
|
534
|
+
children: /* @__PURE__ */ m("div", {
|
|
535
|
+
style: {
|
|
536
|
+
width: n * 3,
|
|
537
|
+
marginLeft: -n,
|
|
538
|
+
height: "100%",
|
|
539
|
+
display: "flex",
|
|
540
|
+
transform: `translateX(${o}px)`,
|
|
541
|
+
transition: s ? "transform 300ms cubic-bezier(0.25, 0.1, 0.25, 1)" : "none",
|
|
542
|
+
willChange: "transform"
|
|
543
|
+
},
|
|
544
|
+
onTransitionEnd: l,
|
|
545
|
+
children: a.map((e) => /* @__PURE__ */ m(Se, {
|
|
546
|
+
monthDate: e,
|
|
547
|
+
containerWidth: n,
|
|
548
|
+
events: r,
|
|
549
|
+
style: {
|
|
550
|
+
width: n,
|
|
551
|
+
flexShrink: 0
|
|
552
|
+
},
|
|
553
|
+
onDayClick: u
|
|
554
|
+
}, e.format("YYYY-MM")))
|
|
555
|
+
})
|
|
556
|
+
}) : null;
|
|
557
|
+
}, Ee = () => {
|
|
558
|
+
let e = f(null), t = v(e), { currentDate: n, setCurrentDate: r, events: i } = C(), a = d(() => y(n), [n]), o = s((e) => {
|
|
559
|
+
r(e.toDate());
|
|
560
|
+
}, [r]);
|
|
561
|
+
return /* @__PURE__ */ h("div", {
|
|
562
|
+
ref: e,
|
|
563
|
+
className: N["bsy-mobile-calendar-month"],
|
|
564
|
+
children: [/* @__PURE__ */ m(ee, {}), /* @__PURE__ */ m(Te, {
|
|
565
|
+
currentDate: a,
|
|
566
|
+
setCurrentDate: o,
|
|
567
|
+
containerWidth: t?.width ?? 0,
|
|
568
|
+
events: i
|
|
569
|
+
})]
|
|
570
|
+
});
|
|
571
|
+
}, B = (e) => e.subtract(1, "week"), V = (e) => e.add(1, "week");
|
|
572
|
+
function De({ selectedDate: e, setSelectedDate: t, containerWidth: n }) {
|
|
573
|
+
let r = d(() => [
|
|
574
|
+
B(e),
|
|
575
|
+
e,
|
|
576
|
+
V(e)
|
|
577
|
+
], [e.format("YYYY-MM-DD")]), [i, a] = p(0), [o, c] = p(!1), l = f({
|
|
578
|
+
startX: 0,
|
|
579
|
+
startY: 0,
|
|
580
|
+
startTime: 0,
|
|
581
|
+
isDragging: !1,
|
|
582
|
+
isVerticalScroll: !1,
|
|
583
|
+
directionLocked: !1
|
|
584
|
+
}), u = _(e), m = _(t), h = _(n), g = _(i), v = s((e) => {
|
|
585
|
+
if (l.current.isDragging) return;
|
|
586
|
+
let t = e.touches[0];
|
|
587
|
+
l.current = {
|
|
588
|
+
startX: t.clientX,
|
|
589
|
+
startY: t.clientY,
|
|
590
|
+
startTime: Date.now(),
|
|
591
|
+
isDragging: !0,
|
|
592
|
+
isVerticalScroll: !1,
|
|
593
|
+
directionLocked: !1
|
|
594
|
+
}, c(!1);
|
|
595
|
+
}, []), y = s((e) => {
|
|
596
|
+
if (!l.current.isDragging) return;
|
|
597
|
+
let t = e.touches[0], n = t.clientX - l.current.startX, r = t.clientY - l.current.startY;
|
|
598
|
+
if (!l.current.directionLocked && (Math.abs(n) > 10 || Math.abs(r) > 10) && (l.current.directionLocked = !0, Math.abs(r) > Math.abs(n))) {
|
|
599
|
+
l.current.isVerticalScroll = !0;
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
l.current.isVerticalScroll || a(n);
|
|
603
|
+
}, []), b = s(() => {
|
|
604
|
+
if (!l.current.isDragging) return;
|
|
605
|
+
let e = h.current ?? 0, t = g.current ?? 0;
|
|
606
|
+
if (l.current.isDragging = !1, !e || l.current.isVerticalScroll) return;
|
|
607
|
+
let n = Date.now() - l.current.startTime, r = Math.abs(t) / n, i = Math.abs(t) > e * .35 || r > .3;
|
|
608
|
+
c(!0), a(i && t !== 0 ? -(t > 0 ? -1 : 1) * e : 0);
|
|
609
|
+
}, [h, g]), x = s(() => {
|
|
610
|
+
let e = g.current ?? 0, t = u.current, n = m.current;
|
|
611
|
+
if (e !== 0 && t && n) {
|
|
612
|
+
let r = (e > 0 ? -1 : 1) == 1 ? V(t) : B(t);
|
|
613
|
+
c(!1), a(0), n(r);
|
|
614
|
+
}
|
|
615
|
+
}, [
|
|
616
|
+
g,
|
|
617
|
+
u,
|
|
618
|
+
m
|
|
619
|
+
]);
|
|
620
|
+
return {
|
|
621
|
+
weeks: r,
|
|
622
|
+
translateX: i,
|
|
623
|
+
transitionEnabled: o,
|
|
624
|
+
bindEvents: d(() => ({
|
|
625
|
+
onTouchStart: v,
|
|
626
|
+
onTouchMove: y,
|
|
627
|
+
onTouchEnd: b,
|
|
628
|
+
onTouchCancel: b
|
|
629
|
+
}), [
|
|
630
|
+
v,
|
|
631
|
+
y,
|
|
632
|
+
b
|
|
633
|
+
]),
|
|
634
|
+
handleTransitionEnd: x
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
//#endregion
|
|
638
|
+
//#region src/components/Calendar/CalendarDay/CalendarDay.module.scss
|
|
639
|
+
var H = {
|
|
640
|
+
"bsy-mobile-calendar-day": "_bsy-mobile-calendar-day_12vkp_1",
|
|
641
|
+
"bsy-mobile-calendar-day__header-wrap": "_bsy-mobile-calendar-day__header-wrap_12vkp_7",
|
|
642
|
+
"bsy-mobile-calendar-day__header": "_bsy-mobile-calendar-day__header_12vkp_7",
|
|
643
|
+
"bsy-mobile-calendar-day__tz": "_bsy-mobile-calendar-day__tz_12vkp_15",
|
|
644
|
+
"bsy-mobile-calendar-day__body": "_bsy-mobile-calendar-day__body_12vkp_25",
|
|
645
|
+
"bsy-mobile-calendar-day__time-grid": "_bsy-mobile-calendar-day__time-grid_12vkp_30",
|
|
646
|
+
"bsy-mobile-calendar-day__time-col": "_bsy-mobile-calendar-day__time-col_12vkp_34",
|
|
647
|
+
"bsy-mobile-calendar-day__time-label": "_bsy-mobile-calendar-day__time-label_12vkp_39",
|
|
648
|
+
"bsy-mobile-calendar-day__content-col": "_bsy-mobile-calendar-day__content-col_12vkp_47",
|
|
649
|
+
"bsy-mobile-calendar-day__hour-cell": "_bsy-mobile-calendar-day__hour-cell_12vkp_52",
|
|
650
|
+
"bsy-mobile-calendar-day__timed-layer": "_bsy-mobile-calendar-day__timed-layer_12vkp_57",
|
|
651
|
+
"bsy-mobile-calendar-day__timed-item": "_bsy-mobile-calendar-day__timed-item_12vkp_69",
|
|
652
|
+
"bsy-mobile-calendar-week-carousel": "_bsy-mobile-calendar-week-carousel_12vkp_75",
|
|
653
|
+
"bsy-mobile-calendar-week-slide": "_bsy-mobile-calendar-week-slide_12vkp_81",
|
|
654
|
+
"bsy-mobile-calendar-week-slide__weekdays": "_bsy-mobile-calendar-week-slide__weekdays_12vkp_86",
|
|
655
|
+
"bsy-mobile-calendar-week-slide__dates": "_bsy-mobile-calendar-week-slide__dates_12vkp_91",
|
|
656
|
+
"bsy-mobile-calendar-week-slide__weekday": "_bsy-mobile-calendar-week-slide__weekday_12vkp_86",
|
|
657
|
+
"bsy-mobile-calendar-week-slide__weekday--weekend": "_bsy-mobile-calendar-week-slide__weekday--weekend_12vkp_103",
|
|
658
|
+
"bsy-mobile-calendar-week-slide__weekday--today": "_bsy-mobile-calendar-week-slide__weekday--today_12vkp_106",
|
|
659
|
+
"bsy-mobile-calendar-week-slide__weekday--future": "_bsy-mobile-calendar-week-slide__weekday--future_12vkp_109",
|
|
660
|
+
"bsy-mobile-calendar-week-slide__date-item": "_bsy-mobile-calendar-week-slide__date-item_12vkp_112",
|
|
661
|
+
"bsy-mobile-calendar-week-slide__date-circle": "_bsy-mobile-calendar-week-slide__date-circle_12vkp_118",
|
|
662
|
+
"bsy-mobile-calendar-week-slide__date-circle--today": "_bsy-mobile-calendar-week-slide__date-circle--today_12vkp_128",
|
|
663
|
+
"bsy-mobile-calendar-week-slide__date-circle--today-idle": "_bsy-mobile-calendar-week-slide__date-circle--today-idle_12vkp_132",
|
|
664
|
+
"bsy-mobile-calendar-week-slide__date-circle--past": "_bsy-mobile-calendar-week-slide__date-circle--past_12vkp_136",
|
|
665
|
+
"bsy-mobile-calendar-week-slide__date-circle--future": "_bsy-mobile-calendar-week-slide__date-circle--future_12vkp_139",
|
|
666
|
+
"bsy-mobile-calendar-week-slide__date-circle--selected": "_bsy-mobile-calendar-week-slide__date-circle--selected_12vkp_142",
|
|
667
|
+
"bsy-mobile-calendar-now-line": "_bsy-mobile-calendar-now-line_12vkp_146",
|
|
668
|
+
"bsy-mobile-calendar-now-dot": "_bsy-mobile-calendar-now-dot_12vkp_156",
|
|
669
|
+
"bsy-mobile-calendar-allday": "_bsy-mobile-calendar-allday_12vkp_166",
|
|
670
|
+
"bsy-mobile-calendar-allday__content": "_bsy-mobile-calendar-allday__content_12vkp_170",
|
|
671
|
+
"bsy-mobile-calendar-allday__list": "_bsy-mobile-calendar-allday__list_12vkp_177",
|
|
672
|
+
"bsy-mobile-calendar-allday__expand": "_bsy-mobile-calendar-allday__expand_12vkp_181"
|
|
673
|
+
}, Oe = ({ weekDate: t, currentDate: n, containerWidth: i, onDateClick: a }) => {
|
|
674
|
+
let { timeZone: o } = C(), { t: s } = e(), c = le(t.toDate()), l = r(o).startOf("day"), u = c.some((e) => L(e, o)), d = l.day(), f = n.isSame(l, "day");
|
|
675
|
+
return /* @__PURE__ */ h("div", {
|
|
676
|
+
className: H["bsy-mobile-calendar-week-slide"],
|
|
677
|
+
style: { width: i },
|
|
678
|
+
children: [/* @__PURE__ */ m("div", {
|
|
679
|
+
className: H["bsy-mobile-calendar-week-slide__weekdays"],
|
|
680
|
+
children: M.map((e, t) => {
|
|
681
|
+
let n = t >= 5, r = t === 6 ? 0 : t + 1, i = c.find((e) => e.day() === r), a = u && r === d, o = i ? i.isAfter(l) : !1;
|
|
682
|
+
return /* @__PURE__ */ m("div", {
|
|
683
|
+
className: w(H["bsy-mobile-calendar-week-slide__weekday"], n && H["bsy-mobile-calendar-week-slide__weekday--weekend"], a && H["bsy-mobile-calendar-week-slide__weekday--today"], o && H["bsy-mobile-calendar-week-slide__weekday--future"]),
|
|
684
|
+
children: s(`calendar.weekday.${e}`)
|
|
685
|
+
}, e);
|
|
686
|
+
})
|
|
687
|
+
}), /* @__PURE__ */ m("div", {
|
|
688
|
+
className: H["bsy-mobile-calendar-week-slide__dates"],
|
|
689
|
+
children: c.map((e) => {
|
|
690
|
+
let t = L(e, o), r = e.isSame(n, "day") && !t, i = e.isBefore(l);
|
|
691
|
+
return /* @__PURE__ */ m("div", {
|
|
692
|
+
className: H["bsy-mobile-calendar-week-slide__date-item"],
|
|
693
|
+
onClick: () => a?.(e),
|
|
694
|
+
children: /* @__PURE__ */ m("div", {
|
|
695
|
+
className: w(H["bsy-mobile-calendar-week-slide__date-circle"], t && (f ? H["bsy-mobile-calendar-week-slide__date-circle--today"] : H["bsy-mobile-calendar-week-slide__date-circle--today-idle"]), !t && i && H["bsy-mobile-calendar-week-slide__date-circle--past"], !t && !i && H["bsy-mobile-calendar-week-slide__date-circle--future"], r && H["bsy-mobile-calendar-week-slide__date-circle--selected"]),
|
|
696
|
+
children: e.date()
|
|
697
|
+
})
|
|
698
|
+
}, e.format("YYYY-MM-DD"));
|
|
699
|
+
})
|
|
700
|
+
})]
|
|
701
|
+
});
|
|
702
|
+
}, ke = ({ currentDate: e, setCurrentDate: t, containerWidth: n }) => {
|
|
703
|
+
let { weeks: r, translateX: i, transitionEnabled: a, bindEvents: o, handleTransitionEnd: s } = De({
|
|
704
|
+
selectedDate: e,
|
|
705
|
+
setSelectedDate: t,
|
|
706
|
+
containerWidth: n
|
|
707
|
+
});
|
|
708
|
+
return n ? /* @__PURE__ */ m("div", {
|
|
709
|
+
className: H["bsy-mobile-calendar-week-carousel"],
|
|
710
|
+
...o,
|
|
711
|
+
children: /* @__PURE__ */ m("div", {
|
|
712
|
+
style: {
|
|
713
|
+
width: n * 3,
|
|
714
|
+
marginLeft: -n,
|
|
715
|
+
height: "100%",
|
|
716
|
+
display: "flex",
|
|
717
|
+
transform: `translateX(${i}px)`,
|
|
718
|
+
transition: a ? "transform 300ms cubic-bezier(0.25, 0.1, 0.25, 1)" : "none",
|
|
719
|
+
willChange: "transform"
|
|
720
|
+
},
|
|
721
|
+
onTransitionEnd: s,
|
|
722
|
+
children: r.map((r) => /* @__PURE__ */ m(Oe, {
|
|
723
|
+
weekDate: r,
|
|
724
|
+
currentDate: e,
|
|
725
|
+
containerWidth: n,
|
|
726
|
+
onDateClick: t
|
|
727
|
+
}, r.format("YYYY-MM-DD")))
|
|
728
|
+
})
|
|
729
|
+
}) : null;
|
|
730
|
+
}, Ae = i.memo(({ events: t, onEventClick: n }) => {
|
|
731
|
+
let { t: r } = e(), i = f(null), [a, o] = p(0), [s, c] = p(!1), l = s ? t.length : Math.min(t.length, 3), d = t.slice(0, l), g = t.length - 3, _ = t.length > 3, v = s && t.length > 8;
|
|
732
|
+
return u(() => {
|
|
733
|
+
i.current && o(t.length > 0 ? i.current.scrollHeight : 0);
|
|
734
|
+
}, [t, s]), /* @__PURE__ */ m("div", {
|
|
735
|
+
className: H["bsy-mobile-calendar-allday"],
|
|
736
|
+
style: { height: a },
|
|
737
|
+
children: /* @__PURE__ */ h("div", {
|
|
738
|
+
ref: i,
|
|
739
|
+
className: H["bsy-mobile-calendar-allday__content"],
|
|
740
|
+
children: [/* @__PURE__ */ m("div", {
|
|
741
|
+
className: H["bsy-mobile-calendar-allday__list"],
|
|
742
|
+
style: v ? {
|
|
743
|
+
maxHeight: 204,
|
|
744
|
+
overflowY: "auto"
|
|
745
|
+
} : void 0,
|
|
746
|
+
children: d.map((e) => /* @__PURE__ */ m(F, {
|
|
747
|
+
label: e.label,
|
|
748
|
+
style: { width: "100%" },
|
|
749
|
+
onClick: () => n?.(e)
|
|
750
|
+
}, e.id))
|
|
751
|
+
}), _ ? /* @__PURE__ */ h("div", {
|
|
752
|
+
className: H["bsy-mobile-calendar-allday__expand"],
|
|
753
|
+
onClick: () => c((e) => !e),
|
|
754
|
+
children: [/* @__PURE__ */ m("span", { children: s ? r("calendar.collapse") : r("calendar.moreRecords", { count: g }) }), /* @__PURE__ */ m("svg", {
|
|
755
|
+
width: "16",
|
|
756
|
+
height: "16",
|
|
757
|
+
viewBox: "0 0 16 16",
|
|
758
|
+
fill: "none",
|
|
759
|
+
style: {
|
|
760
|
+
transform: s ? "rotate(180deg)" : "rotate(0deg)",
|
|
761
|
+
transition: "transform 200ms ease"
|
|
762
|
+
},
|
|
763
|
+
children: /* @__PURE__ */ m("path", {
|
|
764
|
+
d: "M4 6L8 10L12 6",
|
|
765
|
+
stroke: "#666666",
|
|
766
|
+
strokeWidth: "1.5",
|
|
767
|
+
strokeLinecap: "round",
|
|
768
|
+
strokeLinejoin: "round"
|
|
769
|
+
})
|
|
770
|
+
})]
|
|
771
|
+
}) : null]
|
|
772
|
+
})
|
|
773
|
+
});
|
|
774
|
+
}), je = ({ currentDate: e, setCurrentDate: t, containerWidth: n, allDayEvents: r, onEventClick: i }) => {
|
|
775
|
+
let { timezoneLabel: a } = C();
|
|
776
|
+
return /* @__PURE__ */ h("div", {
|
|
777
|
+
className: H["bsy-mobile-calendar-day__header-wrap"],
|
|
778
|
+
children: [/* @__PURE__ */ h("div", {
|
|
779
|
+
className: H["bsy-mobile-calendar-day__header"],
|
|
780
|
+
children: [/* @__PURE__ */ m("div", {
|
|
781
|
+
className: H["bsy-mobile-calendar-day__tz"],
|
|
782
|
+
children: a
|
|
783
|
+
}), /* @__PURE__ */ m(ke, {
|
|
784
|
+
currentDate: e,
|
|
785
|
+
setCurrentDate: t,
|
|
786
|
+
containerWidth: n
|
|
787
|
+
})]
|
|
788
|
+
}), /* @__PURE__ */ m(Ae, {
|
|
789
|
+
events: r,
|
|
790
|
+
onEventClick: i
|
|
791
|
+
})]
|
|
792
|
+
});
|
|
793
|
+
}, Me = (e) => y(e.startTime).format("YYYY-MM-DD") !== y(e.endTime).format("YYYY-MM-DD"), U = (e) => {
|
|
794
|
+
let t = y(e.startTime), n = y(e.endTime);
|
|
795
|
+
return n.diff(t, "minute") < 22 ? t.add(22, "minute") : n;
|
|
796
|
+
}, Ne = (e, t) => {
|
|
797
|
+
let n = y(e.startTime), r = U(e), i = y(t.startTime), a = U(t);
|
|
798
|
+
return n.isBefore(a) && r.isAfter(i);
|
|
799
|
+
}, Pe = (e) => {
|
|
800
|
+
if (e.length === 0) return [];
|
|
801
|
+
let t = [...e].sort((e, t) => y(e.startTime).valueOf() - y(t.startTime).valueOf()), n = [], r = [t[0]], i = U(t[0]);
|
|
802
|
+
for (let e = 1; e < t.length; e += 1) {
|
|
803
|
+
let a = t[e];
|
|
804
|
+
if (y(a.startTime).isBefore(i)) {
|
|
805
|
+
r.push(a);
|
|
806
|
+
let e = U(a);
|
|
807
|
+
e.isAfter(i) && (i = e);
|
|
808
|
+
} else n.push(r), r = [a], i = U(a);
|
|
809
|
+
}
|
|
810
|
+
return n.push(r), n;
|
|
811
|
+
}, Fe = (e) => {
|
|
812
|
+
let t = /* @__PURE__ */ new Map(), n = [], r = [...e].sort((e, t) => y(e.startTime).valueOf() - y(t.startTime).valueOf());
|
|
813
|
+
for (let e of r) {
|
|
814
|
+
let r = !1;
|
|
815
|
+
for (let i = 0; i < n.length; i += 1) if (n[i].every((t) => !Ne(t, e))) {
|
|
816
|
+
n[i].push(e), t.set(e.id, i), r = !0;
|
|
817
|
+
break;
|
|
818
|
+
}
|
|
819
|
+
r || (n.push([e]), t.set(e.id, n.length - 1));
|
|
820
|
+
}
|
|
821
|
+
return t;
|
|
822
|
+
}, Ie = (e, t, n, r, i) => {
|
|
823
|
+
let a = n;
|
|
824
|
+
for (let n of r) if (n.id !== e.id) {
|
|
825
|
+
let r = i.get(n.id) ?? 0;
|
|
826
|
+
r > t && Ne(e, n) && (a = Math.min(a, r));
|
|
827
|
+
}
|
|
828
|
+
return a - t;
|
|
829
|
+
}, Le = (e, t) => {
|
|
830
|
+
let n = Math.max(...Array.from(t.values())) + 1, r = /* @__PURE__ */ new Map(), i = n > 10;
|
|
831
|
+
for (let a of e) {
|
|
832
|
+
let o = t.get(a.id) ?? 0;
|
|
833
|
+
if (i) {
|
|
834
|
+
let e = o * 15;
|
|
835
|
+
r.set(a.id, {
|
|
836
|
+
left: e,
|
|
837
|
+
width: 85,
|
|
838
|
+
isPercent: !1
|
|
839
|
+
});
|
|
840
|
+
} else {
|
|
841
|
+
let i = Ie(a, o, n, e, t), s = 100 / n;
|
|
842
|
+
r.set(a.id, {
|
|
843
|
+
left: o * s,
|
|
844
|
+
width: s * i,
|
|
845
|
+
isPercent: !0
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
return r;
|
|
850
|
+
}, Re = (e, t) => {
|
|
851
|
+
let n = e.filter(Me), r = Pe(e.filter((e) => !Me(e))), i = [];
|
|
852
|
+
for (let e of r) {
|
|
853
|
+
let n = Fe(e), r = Le(e, n), a = Math.max(...Array.from(n.values())) + 1;
|
|
854
|
+
for (let o of e) {
|
|
855
|
+
let e = y(o.startTime), s = y(o.endTime), c = e.hour() * 60 + e.minute(), l = s.hour() * 60 + s.minute(), u = Math.max(l - c, 22), d = c / t.interval * t.rowHeight, f = u / t.interval * t.rowHeight, p = r.get(o.id);
|
|
856
|
+
i.push({
|
|
857
|
+
event: o,
|
|
858
|
+
top: d,
|
|
859
|
+
height: f,
|
|
860
|
+
left: p.left,
|
|
861
|
+
width: p.width,
|
|
862
|
+
isPercent: p.isPercent,
|
|
863
|
+
column: n.get(o.id) ?? 0,
|
|
864
|
+
totalColumns: a
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
return {
|
|
869
|
+
timedEvents: i,
|
|
870
|
+
allDayEvents: n
|
|
871
|
+
};
|
|
872
|
+
}, W = Array.from({ length: 24 }, (e, t) => `${t.toString().padStart(2, "0")}:00`), ze = {
|
|
873
|
+
interval: 60,
|
|
874
|
+
rowHeight: 60
|
|
875
|
+
}, Be = (e) => {
|
|
876
|
+
let t = y(e.startTime), n = y(e.endTime);
|
|
877
|
+
return `${t.format("HH:mm")}-${n.format("HH:mm")}`;
|
|
878
|
+
}, Ve = (e, t, n) => Math.min(Math.max(e, t), n), He = ({ events: e, currentDate: t, onEventClick: i }) => {
|
|
879
|
+
let { timeZone: a } = C(), o = f(null), s = f(null), [c, u] = p(() => Date.now()), g = d(() => Re(e, ze), [e]), _ = d(() => new Map(e.map((e) => [e.id, e])), [e]), v = g.timedEvents ?? [], b = d(() => y(t).isSame(r(a), "day"), [t, a]);
|
|
880
|
+
l(() => {
|
|
881
|
+
if (!b) {
|
|
882
|
+
s.current = null;
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
u(Date.now());
|
|
886
|
+
let e = window.setInterval(() => {
|
|
887
|
+
u(Date.now());
|
|
888
|
+
}, 60 * 1e3);
|
|
889
|
+
return () => {
|
|
890
|
+
window.clearInterval(e);
|
|
891
|
+
};
|
|
892
|
+
}, [b]);
|
|
893
|
+
let x = d(() => {
|
|
894
|
+
if (!b) return null;
|
|
895
|
+
let e = n(c, a);
|
|
896
|
+
return 20 + (e.hour() * 60 + e.minute() + e.second() / 60) / 60 * 60;
|
|
897
|
+
}, [
|
|
898
|
+
b,
|
|
899
|
+
c,
|
|
900
|
+
a
|
|
901
|
+
]), S = d(() => x === null ? null : x - 20, [x]);
|
|
902
|
+
return l(() => {
|
|
903
|
+
if (!b || !o.current || x === null) return;
|
|
904
|
+
let e = y(t).format("YYYY-MM-DD");
|
|
905
|
+
if (s.current === e) return;
|
|
906
|
+
let n = o.current, r = Math.max(n.scrollHeight - n.clientHeight, 0);
|
|
907
|
+
n.scrollTop = Ve(x - n.clientHeight * .35, 0, r), s.current = e;
|
|
908
|
+
}, [
|
|
909
|
+
t,
|
|
910
|
+
b,
|
|
911
|
+
x
|
|
912
|
+
]), /* @__PURE__ */ m("div", {
|
|
913
|
+
className: H["bsy-mobile-calendar-day__body"],
|
|
914
|
+
ref: o,
|
|
915
|
+
children: /* @__PURE__ */ h("div", {
|
|
916
|
+
className: H["bsy-mobile-calendar-day__time-grid"],
|
|
917
|
+
children: [/* @__PURE__ */ m("div", {
|
|
918
|
+
className: H["bsy-mobile-calendar-day__time-col"],
|
|
919
|
+
children: W.map((e, t) => /* @__PURE__ */ m("div", {
|
|
920
|
+
className: H["bsy-mobile-calendar-day__time-label"],
|
|
921
|
+
style: { top: 20 + t * 60 },
|
|
922
|
+
children: e
|
|
923
|
+
}, e))
|
|
924
|
+
}), /* @__PURE__ */ h("div", {
|
|
925
|
+
className: H["bsy-mobile-calendar-day__content-col"],
|
|
926
|
+
children: [
|
|
927
|
+
/* @__PURE__ */ m("div", { style: { height: 20 } }),
|
|
928
|
+
W.map((e) => /* @__PURE__ */ m("div", { className: H["bsy-mobile-calendar-day__hour-cell"] }, e)),
|
|
929
|
+
/* @__PURE__ */ h("div", {
|
|
930
|
+
className: H["bsy-mobile-calendar-day__timed-layer"],
|
|
931
|
+
children: [v.map((e) => {
|
|
932
|
+
let { event: t, top: n, height: r, left: a, width: o, isPercent: s } = e, c = _.get(t.id);
|
|
933
|
+
return c ? /* @__PURE__ */ m(F, {
|
|
934
|
+
className: H["bsy-mobile-calendar-day__timed-item"],
|
|
935
|
+
label: t.label,
|
|
936
|
+
timeText: Be(c),
|
|
937
|
+
variant: "timed",
|
|
938
|
+
height: r,
|
|
939
|
+
style: {
|
|
940
|
+
top: n,
|
|
941
|
+
left: s ? `calc(${a}% + 4px)` : a + 4,
|
|
942
|
+
width: s ? `calc(${o}% - 8px)` : o - 8
|
|
943
|
+
},
|
|
944
|
+
onClick: () => i?.(c)
|
|
945
|
+
}, t.id) : null;
|
|
946
|
+
}), S === null ? null : /* @__PURE__ */ m("div", {
|
|
947
|
+
className: H["bsy-mobile-calendar-now-line"],
|
|
948
|
+
style: { top: S },
|
|
949
|
+
children: /* @__PURE__ */ m("div", { className: H["bsy-mobile-calendar-now-dot"] })
|
|
950
|
+
})]
|
|
951
|
+
})
|
|
952
|
+
]
|
|
953
|
+
})]
|
|
954
|
+
})
|
|
955
|
+
});
|
|
956
|
+
}, Ue = () => {
|
|
957
|
+
let { currentDate: e, setCurrentDate: t, events: n, onEventClick: r } = C(), i = f(null), a = v(i), o = d(() => {
|
|
958
|
+
let t = y(e);
|
|
959
|
+
return n.filter((e) => R(e) && pe(e, t));
|
|
960
|
+
}, [n, e]), c = d(() => {
|
|
961
|
+
let t = y(e);
|
|
962
|
+
return n.filter((e) => !R(e) && y(e.startTime).isSame(t, "day"));
|
|
963
|
+
}, [n, e]), l = d(() => a?.width ? a.width - 56 : 0, [a?.width]), u = s((e) => {
|
|
964
|
+
t(e.toDate());
|
|
965
|
+
}, [t]);
|
|
966
|
+
return /* @__PURE__ */ h("div", {
|
|
967
|
+
className: H["bsy-mobile-calendar-day"],
|
|
968
|
+
ref: i,
|
|
969
|
+
children: [/* @__PURE__ */ m(je, {
|
|
970
|
+
currentDate: y(e),
|
|
971
|
+
setCurrentDate: u,
|
|
972
|
+
containerWidth: l,
|
|
973
|
+
allDayEvents: o,
|
|
974
|
+
onEventClick: r
|
|
975
|
+
}), /* @__PURE__ */ m(He, {
|
|
976
|
+
events: c,
|
|
977
|
+
currentDate: e,
|
|
978
|
+
onEventClick: r
|
|
979
|
+
})]
|
|
980
|
+
});
|
|
981
|
+
};
|
|
982
|
+
function G(e) {
|
|
983
|
+
return e + 4;
|
|
984
|
+
}
|
|
985
|
+
function We(e, t, n) {
|
|
986
|
+
let r = G(n), i = n > 0 ? -t / r : 0, a = Math.floor(i) - 2;
|
|
987
|
+
return Array.from({ length: 7 }, (t, n) => ({
|
|
988
|
+
date: e.add(a + n, "day"),
|
|
989
|
+
offset: a + n
|
|
990
|
+
}));
|
|
991
|
+
}
|
|
992
|
+
function Ge(e, t) {
|
|
993
|
+
return e * t + e * 4;
|
|
994
|
+
}
|
|
995
|
+
function Ke({ baseDate: e, setBaseDate: t, columnWidth: n }) {
|
|
996
|
+
let [r, i] = p(0), [a, o] = p(!1), c = f({
|
|
997
|
+
startX: 0,
|
|
998
|
+
startY: 0,
|
|
999
|
+
startTime: 0,
|
|
1000
|
+
startTranslateX: 0,
|
|
1001
|
+
isDragging: !1,
|
|
1002
|
+
isVerticalScroll: !1,
|
|
1003
|
+
directionLocked: !1
|
|
1004
|
+
}), u = _(e), m = _(t), h = _(n), g = _(r), v = f(e.format("YYYY-MM-DD"));
|
|
1005
|
+
l(() => {
|
|
1006
|
+
let t = e.format("YYYY-MM-DD");
|
|
1007
|
+
v.current !== t && (i(0), o(!1), v.current = t);
|
|
1008
|
+
}, [e]);
|
|
1009
|
+
let y = d(() => We(e, r, n), [
|
|
1010
|
+
e.format("YYYY-MM-DD"),
|
|
1011
|
+
r,
|
|
1012
|
+
n
|
|
1013
|
+
]), b = s((e) => Ge(e, h.current ?? 0), [h]), x = r, S = s((e) => {
|
|
1014
|
+
if (c.current.isDragging) return;
|
|
1015
|
+
let t = e.touches[0];
|
|
1016
|
+
c.current = {
|
|
1017
|
+
startX: t.clientX,
|
|
1018
|
+
startY: t.clientY,
|
|
1019
|
+
startTime: Date.now(),
|
|
1020
|
+
startTranslateX: g.current ?? 0,
|
|
1021
|
+
isDragging: !0,
|
|
1022
|
+
isVerticalScroll: !1,
|
|
1023
|
+
directionLocked: !1
|
|
1024
|
+
}, o(!1);
|
|
1025
|
+
}, [g]), C = s((e) => {
|
|
1026
|
+
if (!c.current.isDragging) return;
|
|
1027
|
+
let t = e.touches[0], n = t.clientX - c.current.startX, r = t.clientY - c.current.startY;
|
|
1028
|
+
if (!c.current.directionLocked && (Math.abs(n) > 10 || Math.abs(r) > 10) && (c.current.directionLocked = !0, Math.abs(r) > Math.abs(n))) {
|
|
1029
|
+
c.current.isVerticalScroll = !0;
|
|
1030
|
+
return;
|
|
1031
|
+
}
|
|
1032
|
+
c.current.isVerticalScroll || i(c.current.startTranslateX + n);
|
|
1033
|
+
}, []), w = s(() => {
|
|
1034
|
+
if (!c.current.isDragging) return;
|
|
1035
|
+
let e = g.current ?? 0, t = h.current ?? 0;
|
|
1036
|
+
if (c.current.isDragging = !1, !t || c.current.isVerticalScroll) return;
|
|
1037
|
+
let n = G(t), r = e - c.current.startTranslateX, a = Date.now() - c.current.startTime, s = Math.abs(r) / a, l = Math.abs(r) > t * .35 || s > .3, u;
|
|
1038
|
+
u = l ? r > 0 ? Math.ceil(e / n) * n : Math.floor(e / n) * n : Math.round(e / n) * n, o(!0), i(u);
|
|
1039
|
+
}, [h, g]), T = s(() => {
|
|
1040
|
+
o(!1);
|
|
1041
|
+
let e = g.current ?? 0, t = h.current ?? 0, n = u.current, r = m.current;
|
|
1042
|
+
if (t > 0 && n && r) {
|
|
1043
|
+
let a = G(t), o = -e / a, s = Math.round(o);
|
|
1044
|
+
if (s !== 0) {
|
|
1045
|
+
let e = n.add(s, "day");
|
|
1046
|
+
v.current = e.format("YYYY-MM-DD"), r(e), i(0);
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
}, [
|
|
1050
|
+
h,
|
|
1051
|
+
g,
|
|
1052
|
+
u,
|
|
1053
|
+
m
|
|
1054
|
+
]), E = s(() => {
|
|
1055
|
+
i(0), o(!1);
|
|
1056
|
+
}, []);
|
|
1057
|
+
return {
|
|
1058
|
+
visibleDays: y,
|
|
1059
|
+
offsetX: r,
|
|
1060
|
+
trackTransformX: x,
|
|
1061
|
+
transitionEnabled: a,
|
|
1062
|
+
bindEvents: d(() => ({
|
|
1063
|
+
onTouchStart: S,
|
|
1064
|
+
onTouchMove: C,
|
|
1065
|
+
onTouchEnd: w,
|
|
1066
|
+
onTouchCancel: w
|
|
1067
|
+
}), [
|
|
1068
|
+
S,
|
|
1069
|
+
C,
|
|
1070
|
+
w
|
|
1071
|
+
]),
|
|
1072
|
+
handleTransitionEnd: T,
|
|
1073
|
+
getColumnLeft: b,
|
|
1074
|
+
resetPosition: E
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
//#endregion
|
|
1078
|
+
//#region src/components/Calendar/CalendarThreeDay/ThreeDayCarousel.context.tsx
|
|
1079
|
+
var K = a(null), qe = ({ children: e, value: t }) => {
|
|
1080
|
+
let n = d(() => t, [t]);
|
|
1081
|
+
return /* @__PURE__ */ m(K.Provider, {
|
|
1082
|
+
value: n,
|
|
1083
|
+
children: e
|
|
1084
|
+
});
|
|
1085
|
+
}, q = () => {
|
|
1086
|
+
let e = c(K);
|
|
1087
|
+
if (!e) throw Error("useThreeDayCarouselContext must be used within a ThreeDayCarouselProvider");
|
|
1088
|
+
return e;
|
|
1089
|
+
}, J = {
|
|
1090
|
+
"bsy-mobile-calendar-threeday": "_bsy-mobile-calendar-threeday_bnwsm_1",
|
|
1091
|
+
"bsy-mobile-calendar-threeday__header-wrap": "_bsy-mobile-calendar-threeday__header-wrap_bnwsm_7",
|
|
1092
|
+
"bsy-mobile-calendar-threeday__header": "_bsy-mobile-calendar-threeday__header_bnwsm_7",
|
|
1093
|
+
"bsy-mobile-calendar-threeday__tz": "_bsy-mobile-calendar-threeday__tz_bnwsm_15",
|
|
1094
|
+
"bsy-mobile-calendar-threeday__tz-empty": "_bsy-mobile-calendar-threeday__tz-empty_bnwsm_21",
|
|
1095
|
+
"bsy-mobile-calendar-threeday__tz-label": "_bsy-mobile-calendar-threeday__tz-label_bnwsm_24",
|
|
1096
|
+
"bsy-mobile-calendar-threeday__dates": "_bsy-mobile-calendar-threeday__dates_bnwsm_32",
|
|
1097
|
+
"bsy-mobile-calendar-threeday__dates-track": "_bsy-mobile-calendar-threeday__dates-track_bnwsm_38",
|
|
1098
|
+
"bsy-mobile-calendar-threeday__date-col": "_bsy-mobile-calendar-threeday__date-col_bnwsm_43",
|
|
1099
|
+
"bsy-mobile-calendar-threeday__weekday": "_bsy-mobile-calendar-threeday__weekday_bnwsm_50",
|
|
1100
|
+
"bsy-mobile-calendar-threeday__weekday--weekend": "_bsy-mobile-calendar-threeday__weekday--weekend_bnwsm_55",
|
|
1101
|
+
"bsy-mobile-calendar-threeday__weekday--today": "_bsy-mobile-calendar-threeday__weekday--today_bnwsm_58",
|
|
1102
|
+
"bsy-mobile-calendar-threeday__weekday--past": "_bsy-mobile-calendar-threeday__weekday--past_bnwsm_61",
|
|
1103
|
+
"bsy-mobile-calendar-threeday__date-num": "_bsy-mobile-calendar-threeday__date-num_bnwsm_64",
|
|
1104
|
+
"bsy-mobile-calendar-threeday__date-num--today": "_bsy-mobile-calendar-threeday__date-num--today_bnwsm_71",
|
|
1105
|
+
"bsy-mobile-calendar-threeday__date-num--past": "_bsy-mobile-calendar-threeday__date-num--past_bnwsm_74",
|
|
1106
|
+
"bsy-mobile-calendar-threeday__date-num--future": "_bsy-mobile-calendar-threeday__date-num--future_bnwsm_77",
|
|
1107
|
+
"bsy-mobile-calendar-threeday__allday": "_bsy-mobile-calendar-threeday__allday_bnwsm_80",
|
|
1108
|
+
"bsy-mobile-calendar-threeday__allday-area": "_bsy-mobile-calendar-threeday__allday-area_bnwsm_88",
|
|
1109
|
+
"bsy-mobile-calendar-threeday__allday-track": "_bsy-mobile-calendar-threeday__allday-track_bnwsm_94",
|
|
1110
|
+
"bsy-mobile-calendar-threeday__allday-card": "_bsy-mobile-calendar-threeday__allday-card_bnwsm_99",
|
|
1111
|
+
"bsy-mobile-calendar-threeday__expand-btn": "_bsy-mobile-calendar-threeday__expand-btn_bnwsm_107",
|
|
1112
|
+
"bsy-mobile-calendar-threeday__collapse": "_bsy-mobile-calendar-threeday__collapse_bnwsm_118",
|
|
1113
|
+
"bsy-mobile-calendar-threeday__body": "_bsy-mobile-calendar-threeday__body_bnwsm_130",
|
|
1114
|
+
"bsy-mobile-calendar-threeday__body-content": "_bsy-mobile-calendar-threeday__body-content_bnwsm_135",
|
|
1115
|
+
"bsy-mobile-calendar-threeday__body-time": "_bsy-mobile-calendar-threeday__body-time_bnwsm_139",
|
|
1116
|
+
"bsy-mobile-calendar-threeday__time-label": "_bsy-mobile-calendar-threeday__time-label_bnwsm_153",
|
|
1117
|
+
"bsy-mobile-calendar-threeday__grid": "_bsy-mobile-calendar-threeday__grid_bnwsm_161",
|
|
1118
|
+
"bsy-mobile-calendar-threeday__grid-track": "_bsy-mobile-calendar-threeday__grid-track_bnwsm_168",
|
|
1119
|
+
"bsy-mobile-calendar-threeday__day-col": "_bsy-mobile-calendar-threeday__day-col_bnwsm_173",
|
|
1120
|
+
"bsy-mobile-calendar-threeday__hour-cell": "_bsy-mobile-calendar-threeday__hour-cell_bnwsm_177",
|
|
1121
|
+
"bsy-mobile-calendar-threeday__timed-layer": "_bsy-mobile-calendar-threeday__timed-layer_bnwsm_182",
|
|
1122
|
+
"bsy-mobile-calendar-threeday__timed-item": "_bsy-mobile-calendar-threeday__timed-item_bnwsm_195",
|
|
1123
|
+
"bsy-mobile-calendar-threeday__now-line": "_bsy-mobile-calendar-threeday__now-line_bnwsm_200",
|
|
1124
|
+
"bsy-mobile-calendar-threeday__now-dot": "_bsy-mobile-calendar-threeday__now-dot_bnwsm_209"
|
|
1125
|
+
}, Je = () => {
|
|
1126
|
+
let { visibleDays: t, trackTransformX: n, transitionEnabled: i, bindEvents: a, handleTransitionEnd: o, columnWidth: s, getColumnLeft: c } = q(), { timeZone: l, timezoneLabel: u } = C(), { t: f } = e(), p = d(() => r(l).startOf("day"), [l]), g = d(() => ({
|
|
1127
|
+
transform: `translateX(${n}px)`,
|
|
1128
|
+
transition: i ? `transform ${O} ${k}` : "none"
|
|
1129
|
+
}), [n, i]);
|
|
1130
|
+
return /* @__PURE__ */ h("div", {
|
|
1131
|
+
className: J["bsy-mobile-calendar-threeday__header"],
|
|
1132
|
+
children: [/* @__PURE__ */ h("div", {
|
|
1133
|
+
className: J["bsy-mobile-calendar-threeday__tz"],
|
|
1134
|
+
children: [/* @__PURE__ */ m("div", { className: J["bsy-mobile-calendar-threeday__tz-empty"] }), /* @__PURE__ */ m("div", {
|
|
1135
|
+
className: J["bsy-mobile-calendar-threeday__tz-label"],
|
|
1136
|
+
children: u
|
|
1137
|
+
})]
|
|
1138
|
+
}), /* @__PURE__ */ m("div", {
|
|
1139
|
+
className: J["bsy-mobile-calendar-threeday__dates"],
|
|
1140
|
+
...a,
|
|
1141
|
+
children: /* @__PURE__ */ m("div", {
|
|
1142
|
+
className: J["bsy-mobile-calendar-threeday__dates-track"],
|
|
1143
|
+
style: g,
|
|
1144
|
+
onTransitionEnd: o,
|
|
1145
|
+
children: t.map(({ date: e, offset: t }) => {
|
|
1146
|
+
let n = e.isSame(p, "day"), r = e.isBefore(p, "day"), i = e.isoWeekday(), a = i === 6 || i === 7, o = c(t);
|
|
1147
|
+
return /* @__PURE__ */ h("div", {
|
|
1148
|
+
className: J["bsy-mobile-calendar-threeday__date-col"],
|
|
1149
|
+
style: {
|
|
1150
|
+
position: "absolute",
|
|
1151
|
+
left: o,
|
|
1152
|
+
width: s
|
|
1153
|
+
},
|
|
1154
|
+
children: [/* @__PURE__ */ m("div", {
|
|
1155
|
+
className: w(J["bsy-mobile-calendar-threeday__weekday"], a && J["bsy-mobile-calendar-threeday__weekday--weekend"], n && J["bsy-mobile-calendar-threeday__weekday--today"], !n && r && J["bsy-mobile-calendar-threeday__weekday--past"]),
|
|
1156
|
+
children: f(`calendar.weekdayPrefixed.${i}`)
|
|
1157
|
+
}), /* @__PURE__ */ m("div", {
|
|
1158
|
+
className: w(J["bsy-mobile-calendar-threeday__date-num"], n && J["bsy-mobile-calendar-threeday__date-num--today"], !n && r && J["bsy-mobile-calendar-threeday__date-num--past"], !n && !r && J["bsy-mobile-calendar-threeday__date-num--future"]),
|
|
1159
|
+
children: e.date()
|
|
1160
|
+
})]
|
|
1161
|
+
}, e.format("YYYY-MM-DD"));
|
|
1162
|
+
})
|
|
1163
|
+
})
|
|
1164
|
+
})]
|
|
1165
|
+
});
|
|
1166
|
+
}, Y = Array.from({ length: 24 }, (e, t) => `${t.toString().padStart(2, "0")}:00`), Ye = {
|
|
1167
|
+
interval: 60,
|
|
1168
|
+
rowHeight: 60
|
|
1169
|
+
}, Xe = 4, Ze = 8, Qe = 4, X = 8, $e = (e) => {
|
|
1170
|
+
let t = y(e.startTime), n = y(e.endTime);
|
|
1171
|
+
return `${t.format("HH:mm")}-${n.format("HH:mm")}`;
|
|
1172
|
+
}, et = (e, t, n) => Math.min(Math.max(e, t), n), tt = ({ events: e, currentDate: t, onEventClick: i }) => {
|
|
1173
|
+
let { timeZone: a } = C(), { visibleDays: o, trackTransformX: s, transitionEnabled: c, bindEvents: u, columnWidth: g, getColumnLeft: _ } = q(), v = f(null), b = f(null), [x, S] = p(() => Date.now()), w = d(() => r(a).startOf("day"), [a]), T = d(() => o.map(({ date: t, offset: n }, r) => ({
|
|
1174
|
+
date: t,
|
|
1175
|
+
offset: n,
|
|
1176
|
+
layout: Re(e.filter((e) => y(e.startTime).isSame(t, "day") || y(e.startTime).isBefore(t, "day") && y(e.endTime).isAfter(t, "day")), Ye),
|
|
1177
|
+
isFirstVisibleDay: r === 2
|
|
1178
|
+
})), [o, e]), E = d(() => new Map(e.map((e) => [e.id, e])), [e]), D = d(() => o.findIndex(({ date: e }) => e.isSame(w, "day")), [o, w]), A = d(() => y(t).isSame(w, "day"), [t, w]);
|
|
1179
|
+
l(() => {
|
|
1180
|
+
if (D === -1) {
|
|
1181
|
+
b.current = null;
|
|
1182
|
+
return;
|
|
1183
|
+
}
|
|
1184
|
+
S(Date.now());
|
|
1185
|
+
let e = window.setInterval(() => S(Date.now()), 60 * 1e3);
|
|
1186
|
+
return () => window.clearInterval(e);
|
|
1187
|
+
}, [D]);
|
|
1188
|
+
let j = d(() => {
|
|
1189
|
+
if (D === -1) return null;
|
|
1190
|
+
let e = n(x, a);
|
|
1191
|
+
return 20 + (e.hour() * 60 + e.minute() + e.second() / 60) / 60 * 60;
|
|
1192
|
+
}, [
|
|
1193
|
+
D,
|
|
1194
|
+
x,
|
|
1195
|
+
a
|
|
1196
|
+
]), M = d(() => j === null ? null : j - 20, [j]);
|
|
1197
|
+
l(() => {
|
|
1198
|
+
if (!A || !v.current || j === null) return;
|
|
1199
|
+
let e = y(t).format("YYYY-MM-DD");
|
|
1200
|
+
if (b.current === e) return;
|
|
1201
|
+
let n = v.current, r = Math.max(n.scrollHeight - n.clientHeight, 0);
|
|
1202
|
+
n.scrollTop = et(j - n.clientHeight * .35, 0, r), b.current = e;
|
|
1203
|
+
}, [
|
|
1204
|
+
t,
|
|
1205
|
+
A,
|
|
1206
|
+
j
|
|
1207
|
+
]);
|
|
1208
|
+
let N = d(() => ({
|
|
1209
|
+
transform: `translateX(${s}px)`,
|
|
1210
|
+
transition: c ? `transform ${O} ${k}` : "none"
|
|
1211
|
+
}), [s, c]);
|
|
1212
|
+
return /* @__PURE__ */ m("div", {
|
|
1213
|
+
className: J["bsy-mobile-calendar-threeday__body"],
|
|
1214
|
+
ref: v,
|
|
1215
|
+
children: /* @__PURE__ */ h("div", {
|
|
1216
|
+
className: J["bsy-mobile-calendar-threeday__body-content"],
|
|
1217
|
+
children: [/* @__PURE__ */ m("div", {
|
|
1218
|
+
className: J["bsy-mobile-calendar-threeday__body-time"],
|
|
1219
|
+
children: Y.map((e, t) => /* @__PURE__ */ m("div", {
|
|
1220
|
+
className: J["bsy-mobile-calendar-threeday__time-label"],
|
|
1221
|
+
style: { top: 20 + t * 60 },
|
|
1222
|
+
children: e
|
|
1223
|
+
}, e))
|
|
1224
|
+
}), /* @__PURE__ */ m("div", {
|
|
1225
|
+
className: J["bsy-mobile-calendar-threeday__grid"],
|
|
1226
|
+
...u,
|
|
1227
|
+
children: /* @__PURE__ */ m("div", {
|
|
1228
|
+
className: J["bsy-mobile-calendar-threeday__grid-track"],
|
|
1229
|
+
style: N,
|
|
1230
|
+
children: T.map((e) => {
|
|
1231
|
+
let { date: t, offset: n, layout: r, isFirstVisibleDay: a } = e, o = r.timedEvents ?? [], s = t.isSame(w, "day"), c = _(n);
|
|
1232
|
+
return /* @__PURE__ */ h("div", {
|
|
1233
|
+
className: J["bsy-mobile-calendar-threeday__day-col"],
|
|
1234
|
+
style: {
|
|
1235
|
+
position: "absolute",
|
|
1236
|
+
left: c,
|
|
1237
|
+
width: g
|
|
1238
|
+
},
|
|
1239
|
+
children: [
|
|
1240
|
+
/* @__PURE__ */ m("div", { style: { height: 20 } }),
|
|
1241
|
+
Y.map((e) => /* @__PURE__ */ m("div", { className: J["bsy-mobile-calendar-threeday__hour-cell"] }, e)),
|
|
1242
|
+
/* @__PURE__ */ h("div", {
|
|
1243
|
+
className: J["bsy-mobile-calendar-threeday__timed-layer"],
|
|
1244
|
+
children: [o.map((e) => {
|
|
1245
|
+
let { event: t, top: n, height: r, left: o, width: s, isPercent: c, column: l, totalColumns: u } = e, d = E.get(t.id);
|
|
1246
|
+
if (!d) return null;
|
|
1247
|
+
let f = a ? Ze : Qe, p = Math.max(0, g - f), h = Math.max(u ?? 1, 1), _ = Math.max(0, s - f), v = Math.max(X, p - (h - 1) * X), y = et(_, Math.min(X, p), Math.min(p, v)), b = Math.max(0, p - y), x = (h > 1 ? (l ?? 0) / (h - 1) : 0) * b, S = a ? x + Xe : x;
|
|
1248
|
+
return /* @__PURE__ */ m(F, {
|
|
1249
|
+
className: J["bsy-mobile-calendar-threeday__timed-item"],
|
|
1250
|
+
label: t.label,
|
|
1251
|
+
timeText: $e(d),
|
|
1252
|
+
variant: "timed",
|
|
1253
|
+
height: r,
|
|
1254
|
+
style: {
|
|
1255
|
+
top: n,
|
|
1256
|
+
left: c ? a ? `calc(${o}% + ${Xe}px)` : `${o}%` : S,
|
|
1257
|
+
width: c ? a ? `calc(${s}% - ${Ze}px)` : `calc(${s}% - ${Qe}px)` : y
|
|
1258
|
+
},
|
|
1259
|
+
onClick: () => i?.(d)
|
|
1260
|
+
}, t.id);
|
|
1261
|
+
}), s && M !== null ? /* @__PURE__ */ m("div", {
|
|
1262
|
+
className: J["bsy-mobile-calendar-threeday__now-line"],
|
|
1263
|
+
style: { top: M },
|
|
1264
|
+
children: /* @__PURE__ */ m("div", { className: J["bsy-mobile-calendar-threeday__now-dot"] })
|
|
1265
|
+
}) : null]
|
|
1266
|
+
})
|
|
1267
|
+
]
|
|
1268
|
+
}, t.format("YYYY-MM-DD"));
|
|
1269
|
+
})
|
|
1270
|
+
})
|
|
1271
|
+
})]
|
|
1272
|
+
})
|
|
1273
|
+
});
|
|
1274
|
+
};
|
|
1275
|
+
//#endregion
|
|
1276
|
+
//#region src/components/Calendar/utils/threeDaysAlgorithm.ts
|
|
1277
|
+
function nt(e, t) {
|
|
1278
|
+
let n = t.startOf("day"), r = y(e.startTime), i = y(e.endTime), a = r.startOf("day").diff(n, "day"), o = i.hour() === 0 && i.minute() === 0 && i.second() === 0 ? i.startOf("day").diff(n, "day") : i.startOf("day").add(1, "day").diff(n, "day");
|
|
1279
|
+
return {
|
|
1280
|
+
event: e,
|
|
1281
|
+
startCol: a,
|
|
1282
|
+
endCol: o,
|
|
1283
|
+
span: o - a,
|
|
1284
|
+
startTimestamp: r.startOf("day").valueOf()
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1287
|
+
function rt(e, t) {
|
|
1288
|
+
return e.startCol < t.endCol && e.endCol > t.startCol;
|
|
1289
|
+
}
|
|
1290
|
+
function it(e, t) {
|
|
1291
|
+
if (!e || e.length === 0) return [];
|
|
1292
|
+
let n = [...e.map((e) => nt(e, t))].sort((e, t) => e.startTimestamp === t.startTimestamp ? t.span - e.span : e.startTimestamp - t.startTimestamp), r = [], i = [];
|
|
1293
|
+
for (let e of n) {
|
|
1294
|
+
let t = !1;
|
|
1295
|
+
for (let n = 0; n < r.length; n += 1) if (!r[n].some((t) => rt(t, e))) {
|
|
1296
|
+
r[n].push(e), i.push({
|
|
1297
|
+
...e,
|
|
1298
|
+
row: n
|
|
1299
|
+
}), t = !0;
|
|
1300
|
+
break;
|
|
1301
|
+
}
|
|
1302
|
+
t || (r.push([e]), i.push({
|
|
1303
|
+
...e,
|
|
1304
|
+
row: r.length - 1
|
|
1305
|
+
}));
|
|
1306
|
+
}
|
|
1307
|
+
return i;
|
|
1308
|
+
}
|
|
1309
|
+
//#endregion
|
|
1310
|
+
//#region src/components/Calendar/CalendarThreeDay/ThreeDayAllDayEvents/ThreeDayAllDayEvents.tsx
|
|
1311
|
+
var at = 22;
|
|
1312
|
+
function Z(e, t, n, r) {
|
|
1313
|
+
let i = G(r), a = e * i, o = t * i, s = a + n, c = o + n, l = r * 3 + 8, u = Math.max(s, 0), d = Math.min(c, l) - u;
|
|
1314
|
+
return {
|
|
1315
|
+
left: u,
|
|
1316
|
+
width: d,
|
|
1317
|
+
visible: d > 0,
|
|
1318
|
+
isStart: s >= 0,
|
|
1319
|
+
isEnd: c <= l
|
|
1320
|
+
};
|
|
1321
|
+
}
|
|
1322
|
+
function ot(e, t, n) {
|
|
1323
|
+
let r = G(n), i = [
|
|
1324
|
+
0,
|
|
1325
|
+
0,
|
|
1326
|
+
0
|
|
1327
|
+
], a = Math.round(-t / r);
|
|
1328
|
+
for (let t of e) if (!(t.row < 3)) for (let e = 0; e < 3; e++) {
|
|
1329
|
+
let n = a + e;
|
|
1330
|
+
n >= t.startCol && n < t.endCol && (i[e] += 1);
|
|
1331
|
+
}
|
|
1332
|
+
return i;
|
|
1333
|
+
}
|
|
1334
|
+
var st = ({ events: e, baseDate: t, onEventClick: n }) => {
|
|
1335
|
+
let { offsetX: r, transitionEnabled: i, bindEvents: a, columnWidth: o } = q(), [s, c] = p(!1), l = d(() => it(e, t), [e, t]), u = d(() => {
|
|
1336
|
+
let e = l.filter((e) => Z(e.startCol, e.endCol, r, o).visible);
|
|
1337
|
+
return e.length === 0 ? -1 : Math.max(...e.map((e) => e.row));
|
|
1338
|
+
}, [
|
|
1339
|
+
l,
|
|
1340
|
+
r,
|
|
1341
|
+
o
|
|
1342
|
+
]) + 1, f = u > 3, g = s && u > 8, _ = s ? Math.min(u, 8) : Math.min(u, 3), v = d(() => s || !f ? [
|
|
1343
|
+
0,
|
|
1344
|
+
0,
|
|
1345
|
+
0
|
|
1346
|
+
] : ot(l, r, o), [
|
|
1347
|
+
l,
|
|
1348
|
+
r,
|
|
1349
|
+
o,
|
|
1350
|
+
s,
|
|
1351
|
+
f
|
|
1352
|
+
]), y = !s && f && v.some((e) => e > 0), b = d(() => u === 0 ? 0 : _ * A + (y ? at : 0) + 8, [
|
|
1353
|
+
u,
|
|
1354
|
+
_,
|
|
1355
|
+
y
|
|
1356
|
+
]), x = d(() => u === 0 ? 0 : g ? u * A : _ * A + (y ? at : 0), [
|
|
1357
|
+
u,
|
|
1358
|
+
_,
|
|
1359
|
+
y,
|
|
1360
|
+
g
|
|
1361
|
+
]), S = G(o);
|
|
1362
|
+
return /* @__PURE__ */ h("div", {
|
|
1363
|
+
className: J["bsy-mobile-calendar-threeday__allday"],
|
|
1364
|
+
style: { height: b },
|
|
1365
|
+
children: [s && f ? /* @__PURE__ */ m("div", {
|
|
1366
|
+
className: J["bsy-mobile-calendar-threeday__collapse"],
|
|
1367
|
+
onClick: () => c(!1),
|
|
1368
|
+
children: /* @__PURE__ */ m("svg", {
|
|
1369
|
+
width: "16",
|
|
1370
|
+
height: "16",
|
|
1371
|
+
viewBox: "0 0 16 16",
|
|
1372
|
+
fill: "none",
|
|
1373
|
+
style: { transform: "rotate(180deg)" },
|
|
1374
|
+
children: /* @__PURE__ */ m("path", {
|
|
1375
|
+
d: "M4 6L8 10L12 6",
|
|
1376
|
+
stroke: "#666666",
|
|
1377
|
+
strokeWidth: "1.5",
|
|
1378
|
+
strokeLinecap: "round",
|
|
1379
|
+
strokeLinejoin: "round"
|
|
1380
|
+
})
|
|
1381
|
+
})
|
|
1382
|
+
}) : null, /* @__PURE__ */ m("div", {
|
|
1383
|
+
className: J["bsy-mobile-calendar-threeday__allday-area"],
|
|
1384
|
+
style: g ? {
|
|
1385
|
+
overflowY: "auto",
|
|
1386
|
+
maxHeight: 8 * A
|
|
1387
|
+
} : void 0,
|
|
1388
|
+
...a,
|
|
1389
|
+
children: /* @__PURE__ */ h("div", {
|
|
1390
|
+
className: J["bsy-mobile-calendar-threeday__allday-track"],
|
|
1391
|
+
style: {
|
|
1392
|
+
height: x,
|
|
1393
|
+
transition: i ? `height ${O} ${k}` : "none"
|
|
1394
|
+
},
|
|
1395
|
+
children: [l.map((e) => {
|
|
1396
|
+
let { event: t, startCol: i, endCol: a, row: c } = e;
|
|
1397
|
+
if (!s && c >= 3) return null;
|
|
1398
|
+
let l = Z(i, a, r, o);
|
|
1399
|
+
return l.visible ? /* @__PURE__ */ m(F, {
|
|
1400
|
+
className: J["bsy-mobile-calendar-threeday__allday-card"],
|
|
1401
|
+
label: t.label,
|
|
1402
|
+
variant: "allDay",
|
|
1403
|
+
height: 22,
|
|
1404
|
+
isStart: l.isStart,
|
|
1405
|
+
isEnd: l.isEnd,
|
|
1406
|
+
isContinue: !l.isStart,
|
|
1407
|
+
style: {
|
|
1408
|
+
left: l.left,
|
|
1409
|
+
width: l.width - 4,
|
|
1410
|
+
top: c * A + 4
|
|
1411
|
+
},
|
|
1412
|
+
onClick: () => n?.(t)
|
|
1413
|
+
}, t.id) : null;
|
|
1414
|
+
}), y ? v.map((e, t) => {
|
|
1415
|
+
if (e === 0) return null;
|
|
1416
|
+
let n = t * S;
|
|
1417
|
+
return /* @__PURE__ */ m("div", {
|
|
1418
|
+
className: J["bsy-mobile-calendar-threeday__expand-btn"],
|
|
1419
|
+
style: {
|
|
1420
|
+
left: n,
|
|
1421
|
+
width: o - 4,
|
|
1422
|
+
top: 3 * A + 4
|
|
1423
|
+
},
|
|
1424
|
+
onClick: () => c(!0),
|
|
1425
|
+
children: /* @__PURE__ */ h("span", { children: [
|
|
1426
|
+
"还有",
|
|
1427
|
+
e,
|
|
1428
|
+
"条记录"
|
|
1429
|
+
] })
|
|
1430
|
+
}, `expand-btn-${t}`);
|
|
1431
|
+
}) : null]
|
|
1432
|
+
})
|
|
1433
|
+
})]
|
|
1434
|
+
});
|
|
1435
|
+
}, ct = () => {
|
|
1436
|
+
let { currentDate: e, setCurrentDate: t, events: n, onEventClick: r } = C(), i = f(null), a = v(i), o = d(() => a?.width ? (a.width - 56 - 8 - 8) / 3 : 0, [a?.width]), c = d(() => y(e), [e]), { visibleDays: l, offsetX: u, trackTransformX: p, transitionEnabled: g, bindEvents: _, handleTransitionEnd: b, getColumnLeft: x, resetPosition: S } = Ke({
|
|
1437
|
+
baseDate: c,
|
|
1438
|
+
setBaseDate: s((e) => {
|
|
1439
|
+
t(e.toDate());
|
|
1440
|
+
}, [t]),
|
|
1441
|
+
columnWidth: o
|
|
1442
|
+
}), w = d(() => n.filter((e) => R(e)), [n]), T = d(() => n.filter((e) => !R(e)), [n]), E = d(() => ({
|
|
1443
|
+
visibleDays: l,
|
|
1444
|
+
offsetX: u,
|
|
1445
|
+
trackTransformX: p,
|
|
1446
|
+
transitionEnabled: g,
|
|
1447
|
+
bindEvents: _,
|
|
1448
|
+
handleTransitionEnd: b,
|
|
1449
|
+
columnWidth: o,
|
|
1450
|
+
getColumnLeft: x,
|
|
1451
|
+
resetPosition: S
|
|
1452
|
+
}), [
|
|
1453
|
+
l,
|
|
1454
|
+
u,
|
|
1455
|
+
p,
|
|
1456
|
+
g,
|
|
1457
|
+
_,
|
|
1458
|
+
b,
|
|
1459
|
+
o,
|
|
1460
|
+
x,
|
|
1461
|
+
S
|
|
1462
|
+
]);
|
|
1463
|
+
return /* @__PURE__ */ m("div", {
|
|
1464
|
+
className: J["bsy-mobile-calendar-threeday"],
|
|
1465
|
+
ref: i,
|
|
1466
|
+
children: o > 0 ? /* @__PURE__ */ h(qe, {
|
|
1467
|
+
value: E,
|
|
1468
|
+
children: [/* @__PURE__ */ h("div", {
|
|
1469
|
+
className: J["bsy-mobile-calendar-threeday__header-wrap"],
|
|
1470
|
+
children: [/* @__PURE__ */ m(Je, {}), /* @__PURE__ */ m(st, {
|
|
1471
|
+
events: w,
|
|
1472
|
+
baseDate: c,
|
|
1473
|
+
onEventClick: r
|
|
1474
|
+
})]
|
|
1475
|
+
}), /* @__PURE__ */ m(tt, {
|
|
1476
|
+
events: T,
|
|
1477
|
+
currentDate: e,
|
|
1478
|
+
onEventClick: r
|
|
1479
|
+
})]
|
|
1480
|
+
}) : null
|
|
1481
|
+
});
|
|
1482
|
+
}, lt = (e, t = {}) => {
|
|
1483
|
+
let { timeZone: r } = t;
|
|
1484
|
+
return Array.isArray(e) ? e.map((e, t) => ({
|
|
1485
|
+
...e,
|
|
1486
|
+
id: e.id ?? String(t),
|
|
1487
|
+
label: e.label ?? "",
|
|
1488
|
+
startTime: n(e.startTime, r),
|
|
1489
|
+
endTime: n(e.endTime, r)
|
|
1490
|
+
})) : [];
|
|
1491
|
+
}, Q = {
|
|
1492
|
+
"#005EEF": {
|
|
1493
|
+
normal: "#EFF5FF",
|
|
1494
|
+
hover: "#D9E8FF"
|
|
1495
|
+
},
|
|
1496
|
+
"#3642E9": {
|
|
1497
|
+
normal: "#EDEEFF",
|
|
1498
|
+
hover: "#DEE0FF"
|
|
1499
|
+
},
|
|
1500
|
+
"#10A9C4": {
|
|
1501
|
+
normal: "#EBFCFF",
|
|
1502
|
+
hover: "#DDFAFF"
|
|
1503
|
+
},
|
|
1504
|
+
"#32A645": {
|
|
1505
|
+
normal: "#f2ffef",
|
|
1506
|
+
hover: "#E4FFE0"
|
|
1507
|
+
},
|
|
1508
|
+
"#FFC502": {
|
|
1509
|
+
normal: "#FFFAE8",
|
|
1510
|
+
hover: "#FFF4D0"
|
|
1511
|
+
},
|
|
1512
|
+
"#FF9921": {
|
|
1513
|
+
normal: "#FFF5EA",
|
|
1514
|
+
hover: "#FFECD7"
|
|
1515
|
+
},
|
|
1516
|
+
"#F06648": {
|
|
1517
|
+
normal: "#FFF0ED",
|
|
1518
|
+
hover: "#FFE3DD"
|
|
1519
|
+
},
|
|
1520
|
+
"#F168B6": {
|
|
1521
|
+
normal: "#FFEFF8",
|
|
1522
|
+
hover: "#FFDEF1"
|
|
1523
|
+
},
|
|
1524
|
+
"#6C6C6E": {
|
|
1525
|
+
normal: "#F2F3F5",
|
|
1526
|
+
hover: "#E6E6E7"
|
|
1527
|
+
}
|
|
1528
|
+
}, $ = /* @__PURE__ */ new Map(), ut = (e) => {
|
|
1529
|
+
if (!e) return {
|
|
1530
|
+
normal: "#e8f0fe",
|
|
1531
|
+
hover: "#d7e3fd"
|
|
1532
|
+
};
|
|
1533
|
+
if ($.has(e)) return $.get(e);
|
|
1534
|
+
let t = e.toUpperCase();
|
|
1535
|
+
if (Q[t]) return $.set(e, Q[t]), Q[t];
|
|
1536
|
+
let n = parseInt(e.slice(1, 3), 16), r = parseInt(e.slice(3, 5), 16), i = parseInt(e.slice(5, 7), 16), a = .88, o = .8, s = {
|
|
1537
|
+
normal: `rgb(${Math.round(n + (255 - n) * a)}, ${Math.round(r + (255 - r) * a)}, ${Math.round(i + (255 - i) * a)})`,
|
|
1538
|
+
hover: `rgb(${Math.round(n + (255 - n) * o)}, ${Math.round(r + (255 - r) * o)}, ${Math.round(i + (255 - i) * o)})`
|
|
1539
|
+
};
|
|
1540
|
+
return $.set(e, s), s;
|
|
1541
|
+
}, dt = (e) => {
|
|
1542
|
+
let t = ut(e);
|
|
1543
|
+
return {
|
|
1544
|
+
"--bsy-mobile-calendar-color": e,
|
|
1545
|
+
"--bsy-mobile-calendar-bg": t.normal,
|
|
1546
|
+
"--bsy-mobile-calendar-hover": t.hover
|
|
1547
|
+
};
|
|
1548
|
+
}, ft = (e) => {
|
|
1549
|
+
let { events: t, scheduleColor: n, timeZone: i, className: a, onEventClick: o, onDayClick: s } = e, [c, l] = g(e, {
|
|
1550
|
+
defaultValue: "month",
|
|
1551
|
+
defaultValuePropName: "defaultMode",
|
|
1552
|
+
valuePropName: "mode",
|
|
1553
|
+
trigger: "onModeChange"
|
|
1554
|
+
}), [u, f] = g(e, { defaultValue: r(i).toDate() }), p = d(() => lt(t, { timeZone: i }), [t, i]), _ = d(() => dt(n), [n]);
|
|
1555
|
+
return /* @__PURE__ */ m("div", {
|
|
1556
|
+
className: w(b["bsy-mobile-calendar"], a),
|
|
1557
|
+
style: _,
|
|
1558
|
+
children: /* @__PURE__ */ h(S, {
|
|
1559
|
+
currentDate: u,
|
|
1560
|
+
setCurrentDate: f,
|
|
1561
|
+
viewMode: c,
|
|
1562
|
+
setViewMode: l,
|
|
1563
|
+
scheduleColor: n,
|
|
1564
|
+
timeZone: i,
|
|
1565
|
+
events: p,
|
|
1566
|
+
onEventClick: o,
|
|
1567
|
+
onDayClick: s,
|
|
1568
|
+
children: [/* @__PURE__ */ m(D, {}), /* @__PURE__ */ h("div", {
|
|
1569
|
+
className: b["bsy-mobile-calendar__body"],
|
|
1570
|
+
children: [
|
|
1571
|
+
c === "month" ? /* @__PURE__ */ m(Ee, {}) : null,
|
|
1572
|
+
c === "day" ? /* @__PURE__ */ m(Ue, {}) : null,
|
|
1573
|
+
c === "threeDay" ? /* @__PURE__ */ m(ct, {}) : null
|
|
1574
|
+
]
|
|
1575
|
+
})]
|
|
1576
|
+
})
|
|
1577
|
+
});
|
|
1578
|
+
};
|
|
1579
|
+
//#endregion
|
|
1580
|
+
export { ft as t };
|