@isma91/react-scheduler 4.0.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/.github/workflows/publish.yml +29 -0
- package/.github/workflows/tests.yml +35 -0
- package/.gitignore +32 -0
- package/.husky/pre-commit +2 -0
- package/.prettierignore +1 -0
- package/.prettierrc.json +7 -0
- package/.yarnrc.yml +1 -0
- package/LICENSE +24 -0
- package/README.md +172 -0
- package/dist/LICENSE +24 -0
- package/dist/README.md +172 -0
- package/dist/SchedulerComponent.d.ts +3 -0
- package/dist/components/common/Cell.d.ts +13 -0
- package/dist/components/common/LocaleArrow.d.ts +8 -0
- package/dist/components/common/ResourceHeader.d.ts +6 -0
- package/dist/components/common/Tabs.d.ts +16 -0
- package/dist/components/common/TodayTypo.d.ts +8 -0
- package/dist/components/common/WithResources.d.ts +6 -0
- package/dist/components/events/Actions.d.ts +8 -0
- package/dist/components/events/AgendaEventsList.d.ts +7 -0
- package/dist/components/events/CurrentTimeBar.d.ts +11 -0
- package/dist/components/events/EmptyAgenda.d.ts +2 -0
- package/dist/components/events/EventItem.d.ts +10 -0
- package/dist/components/events/EventItemPopover.d.ts +9 -0
- package/dist/components/events/MonthEvents.d.ts +13 -0
- package/dist/components/events/TodayEvents.d.ts +16 -0
- package/dist/components/hoc/DateProvider.d.ts +5 -0
- package/dist/components/inputs/DatePicker.d.ts +14 -0
- package/dist/components/inputs/Input.d.ts +19 -0
- package/dist/components/inputs/SelectInput.d.ts +22 -0
- package/dist/components/month/MonthTable.d.ts +8 -0
- package/dist/components/nav/DayDateBtn.d.ts +6 -0
- package/dist/components/nav/MonthDateBtn.d.ts +6 -0
- package/dist/components/nav/Navigation.d.ts +3 -0
- package/dist/components/nav/WeekDateBtn.d.ts +8 -0
- package/dist/components/week/WeekTable.d.ts +11 -0
- package/dist/helpers/constants.d.ts +4 -0
- package/dist/helpers/generals.d.ts +78 -0
- package/dist/hooks/useArrowDisable.d.ts +5 -0
- package/dist/hooks/useCellAttributes.d.ts +18 -0
- package/dist/hooks/useDragAttributes.d.ts +10 -0
- package/dist/hooks/useEventPermissions.d.ts +7 -0
- package/dist/hooks/useStore.d.ts +2 -0
- package/dist/hooks/useSyncScroll.d.ts +8 -0
- package/dist/hooks/useWindowResize.d.ts +4 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2853 -0
- package/dist/package.json +65 -0
- package/dist/positionManger/context.d.ts +14 -0
- package/dist/positionManger/provider.d.ts +5 -0
- package/dist/positionManger/usePosition.d.ts +4 -0
- package/dist/store/context.d.ts +2 -0
- package/dist/store/default.d.ts +245 -0
- package/dist/store/provider.d.ts +7 -0
- package/dist/store/types.d.ts +27 -0
- package/dist/styles/styles.d.ts +30 -0
- package/dist/types.d.ts +372 -0
- package/dist/views/Day.d.ts +2 -0
- package/dist/views/DayAgenda.d.ts +7 -0
- package/dist/views/Editor.d.ts +11 -0
- package/dist/views/Month.d.ts +2 -0
- package/dist/views/MonthAgenda.d.ts +7 -0
- package/dist/views/Week.d.ts +2 -0
- package/dist/views/WeekAgenda.d.ts +8 -0
- package/eslint.config.js +79 -0
- package/index.html +41 -0
- package/jest.config.ts +194 -0
- package/package.json +137 -0
- package/public/favicon.ico +0 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/scripts/post-pack.js +34 -0
- package/src/App.tsx +25 -0
- package/src/Page1.tsx +67 -0
- package/src/events.tsx +227 -0
- package/src/index.tsx +21 -0
- package/src/lib/SchedulerComponent.tsx +78 -0
- package/src/lib/__tests__/index.test.tsx +24 -0
- package/src/lib/components/common/Cell.tsx +52 -0
- package/src/lib/components/common/LocaleArrow.tsx +38 -0
- package/src/lib/components/common/ResourceHeader.tsx +73 -0
- package/src/lib/components/common/Tabs.tsx +119 -0
- package/src/lib/components/common/TodayTypo.tsx +44 -0
- package/src/lib/components/common/WithResources.tsx +98 -0
- package/src/lib/components/events/Actions.tsx +65 -0
- package/src/lib/components/events/AgendaEventsList.tsx +115 -0
- package/src/lib/components/events/CurrentTimeBar.tsx +59 -0
- package/src/lib/components/events/EmptyAgenda.tsx +27 -0
- package/src/lib/components/events/EventItem.tsx +180 -0
- package/src/lib/components/events/EventItemPopover.tsx +179 -0
- package/src/lib/components/events/MonthEvents.tsx +141 -0
- package/src/lib/components/events/TodayEvents.tsx +99 -0
- package/src/lib/components/hoc/DateProvider.tsx +19 -0
- package/src/lib/components/inputs/DatePicker.tsx +95 -0
- package/src/lib/components/inputs/Input.tsx +113 -0
- package/src/lib/components/inputs/SelectInput.tsx +164 -0
- package/src/lib/components/month/MonthTable.tsx +207 -0
- package/src/lib/components/nav/DayDateBtn.tsx +77 -0
- package/src/lib/components/nav/MonthDateBtn.tsx +80 -0
- package/src/lib/components/nav/Navigation.tsx +201 -0
- package/src/lib/components/nav/WeekDateBtn.tsx +89 -0
- package/src/lib/components/week/WeekTable.tsx +229 -0
- package/src/lib/helpers/constants.ts +4 -0
- package/src/lib/helpers/generals.tsx +354 -0
- package/src/lib/hooks/useArrowDisable.ts +26 -0
- package/src/lib/hooks/useCellAttributes.ts +67 -0
- package/src/lib/hooks/useDragAttributes.ts +31 -0
- package/src/lib/hooks/useEventPermissions.ts +42 -0
- package/src/lib/hooks/useStore.ts +8 -0
- package/src/lib/hooks/useSyncScroll.ts +31 -0
- package/src/lib/hooks/useWindowResize.ts +37 -0
- package/src/lib/index.tsx +14 -0
- package/src/lib/positionManger/context.ts +14 -0
- package/src/lib/positionManger/provider.tsx +113 -0
- package/src/lib/positionManger/usePosition.ts +8 -0
- package/src/lib/store/context.ts +5 -0
- package/src/lib/store/default.ts +157 -0
- package/src/lib/store/provider.tsx +211 -0
- package/src/lib/store/types.ts +33 -0
- package/src/lib/styles/styles.ts +256 -0
- package/src/lib/types.ts +423 -0
- package/src/lib/views/Day.tsx +265 -0
- package/src/lib/views/DayAgenda.tsx +57 -0
- package/src/lib/views/Editor.tsx +258 -0
- package/src/lib/views/Month.tsx +82 -0
- package/src/lib/views/MonthAgenda.tsx +84 -0
- package/src/lib/views/Week.tsx +92 -0
- package/src/lib/views/WeekAgenda.tsx +81 -0
- package/src/vite-env.d.ts +3 -0
- package/tsconfig.build.json +5 -0
- package/tsconfig.json +27 -0
- package/vite.config.js +40 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2853 @@
|
|
|
1
|
+
import { jsxs as M, jsx as r, Fragment as Y } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as pt, useContext as yt, useMemo as U, useState as L, Fragment as ie, useRef as nt, useEffect as te, useCallback as Z, forwardRef as mt } from "react";
|
|
3
|
+
import { isWithinInterval as j, endOfDay as q, startOfDay as X, format as N, isSameDay as ye, isBefore as me, isAfter as Se, differenceInDays as _t, addSeconds as Zt, subMinutes as qt, addMinutes as de, differenceInMilliseconds as Xt, addDays as Q, addMilliseconds as Yt, isToday as _e, differenceInMinutes as Fe, set as ke, startOfWeek as $e, eachMinuteOfInterval as vt, endOfMonth as bt, endOfWeek as wt, startOfMonth as Ze, getMonth as Qt, setMonth as rt, getDaysInMonth as Jt, isSameMonth as Dt, differenceInCalendarWeeks as Kt, closestTo as en, setHours as ot, eachWeekOfInterval as tn, eachDayOfInterval as nn, isEqual as it } from "date-fns";
|
|
4
|
+
import { useTheme as ne, ListItem as rn, ListItemAvatar as xt, Avatar as qe, ListItemText as kt, Typography as F, Tabs as on, Tab as an, Box as Ee, styled as se, alpha as Me, Paper as Tt, Grow as sn, IconButton as ve, Slide as ln, Button as ee, Popover as Te, List as dn, ListItemButton as cn, ButtonBase as un, useMediaQuery as Ct, MenuList as hn, MenuItem as Le, TextField as fn, FormControl as gn, InputLabel as pn, Select as yn, Checkbox as mn, Chip as _n, CircularProgress as Et, FormHelperText as vn, Dialog as bn, DialogTitle as wn, DialogContent as Dn, Grid as at, DialogActions as xn } from "@mui/material";
|
|
5
|
+
import { enUS as kn } from "date-fns/locale";
|
|
6
|
+
import { styled as Tn } from "@mui/material/styles";
|
|
7
|
+
import Cn from "@mui/icons-material/DeleteRounded";
|
|
8
|
+
import En from "@mui/icons-material/EditRounded";
|
|
9
|
+
import Sn from "@mui/icons-material/EventNoteRounded";
|
|
10
|
+
import Mn from "@mui/icons-material/ClearRounded";
|
|
11
|
+
import In from "@mui/icons-material/SupervisorAccountRounded";
|
|
12
|
+
import st from "@mui/icons-material/ArrowRightRounded";
|
|
13
|
+
import lt from "@mui/icons-material/ArrowLeftRounded";
|
|
14
|
+
import { LocalizationProvider as Nn } from "@mui/x-date-pickers/LocalizationProvider";
|
|
15
|
+
import { AdapterDateFns as On } from "@mui/x-date-pickers/AdapterDateFns";
|
|
16
|
+
import dt from "@mui/icons-material/NavigateBeforeRounded";
|
|
17
|
+
import ze from "@mui/icons-material/NavigateNextRounded";
|
|
18
|
+
import { DateCalendar as Xe } from "@mui/x-date-pickers";
|
|
19
|
+
import Fn from "@mui/icons-material/MoreVert";
|
|
20
|
+
import $n from "@mui/icons-material/ViewAgenda";
|
|
21
|
+
import { DatePicker as An } from "@mui/x-date-pickers/DatePicker";
|
|
22
|
+
import { DateTimePicker as Rn } from "@mui/x-date-pickers/DateTimePicker";
|
|
23
|
+
import Hn from "@mui/icons-material/ExpandMore";
|
|
24
|
+
const Wn = (e) => {
|
|
25
|
+
if (e.month)
|
|
26
|
+
return "month";
|
|
27
|
+
if (e.week)
|
|
28
|
+
return "week";
|
|
29
|
+
if (e.day)
|
|
30
|
+
return "day";
|
|
31
|
+
throw new Error("No views were selected");
|
|
32
|
+
}, Pn = (e) => {
|
|
33
|
+
const t = [];
|
|
34
|
+
return e.month && t.push("month"), e.week && t.push("week"), e.day && t.push("day"), t;
|
|
35
|
+
}, Ve = (e, t, n) => {
|
|
36
|
+
var a;
|
|
37
|
+
const o = ((a = e.config) == null ? void 0 : a.multiple) && !Array.isArray((n == null ? void 0 : n[e.name]) || e.default), i = o ? t ? [t] : [] : t, s = o ? i.length : i;
|
|
38
|
+
return { value: i, validity: s };
|
|
39
|
+
}, Ce = (e, t, n, o) => {
|
|
40
|
+
var f;
|
|
41
|
+
const i = n.idField, s = o.find((c) => c.name === i), a = !!((f = s == null ? void 0 : s.config) != null && f.multiple), d = [];
|
|
42
|
+
for (const c of e) {
|
|
43
|
+
const v = a && !Array.isArray(c[i]) ? [c[i]] : c[i];
|
|
44
|
+
(a || Array.isArray(v) ? v.includes(t[i]) : v === t[i]) && d.push({
|
|
45
|
+
...c,
|
|
46
|
+
color: c.color || t[n.colorField || ""]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return d;
|
|
50
|
+
}, zn = (e, t) => e.filter(
|
|
51
|
+
(n) => n.event_id !== t.event_id && (j(de(t.start, 1), {
|
|
52
|
+
start: n.start,
|
|
53
|
+
end: n.end
|
|
54
|
+
}) || j(de(t.end, -1), {
|
|
55
|
+
start: n.start,
|
|
56
|
+
end: n.end
|
|
57
|
+
}) || j(de(n.start, 1), {
|
|
58
|
+
start: t.start,
|
|
59
|
+
end: t.end
|
|
60
|
+
}) || j(de(n.end, -1), {
|
|
61
|
+
start: t.start,
|
|
62
|
+
end: t.end
|
|
63
|
+
}))
|
|
64
|
+
), St = (e, t) => Math.ceil(e) / t, Mt = (e, t) => Math.max(e / t, 60), ae = (e, t) => _t(q(Zt(t, -1)), X(e)), Bn = (e) => new Date(
|
|
65
|
+
e.getUTCFullYear(),
|
|
66
|
+
e.getUTCMonth(),
|
|
67
|
+
e.getUTCDate(),
|
|
68
|
+
e.getUTCHours(),
|
|
69
|
+
e.getUTCMinutes()
|
|
70
|
+
), It = (e, t, n) => {
|
|
71
|
+
var i;
|
|
72
|
+
const o = Xt(e.end, e.start);
|
|
73
|
+
return e.recurring ? (i = e.recurring) == null ? void 0 : i.between(Q(t, -1), Q(t, 1), !0).map((s, a) => {
|
|
74
|
+
const d = Bn(s);
|
|
75
|
+
return {
|
|
76
|
+
...e,
|
|
77
|
+
recurrenceId: a,
|
|
78
|
+
start: d,
|
|
79
|
+
end: Yt(d, o)
|
|
80
|
+
};
|
|
81
|
+
}).map((s) => Oe(s, n)) : [Oe(e, n)];
|
|
82
|
+
}, Nt = (e, t, n, o) => {
|
|
83
|
+
const i = [];
|
|
84
|
+
for (let s = 0; s < e.length; s++)
|
|
85
|
+
for (const a of It(e[s], t, n)) {
|
|
86
|
+
if (!a.allDay && ye(t, a.start) && !ae(a.start, a.end)) {
|
|
87
|
+
i.push(a);
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (o && !a.allDay && ae(a.start, a.end) > 0) {
|
|
91
|
+
const f = X(t), c = q(t);
|
|
92
|
+
if (j(t, { start: X(a.start), end: q(a.end) }) || j(a.start, { start: f, end: c }) || j(a.end, { start: f, end: c })) {
|
|
93
|
+
const v = me(a.start, f) ? f : a.start, y = Se(a.end, c) ? c : a.end;
|
|
94
|
+
i.push({
|
|
95
|
+
...a,
|
|
96
|
+
start: v,
|
|
97
|
+
end: y,
|
|
98
|
+
_originalStart: a.start,
|
|
99
|
+
_originalEnd: a.end,
|
|
100
|
+
_hasPrev: me(a.start, f),
|
|
101
|
+
_hasNext: Se(a.end, c)
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return Ot(i);
|
|
107
|
+
}, Ie = (e, t) => {
|
|
108
|
+
const n = e.filter(
|
|
109
|
+
(o) => j(t, {
|
|
110
|
+
start: X(o.start),
|
|
111
|
+
end: q(qt(o.end, 1))
|
|
112
|
+
})
|
|
113
|
+
);
|
|
114
|
+
return Ae(n);
|
|
115
|
+
}, Ot = (e) => e.sort((t, n) => {
|
|
116
|
+
const o = t.end.getTime() - t.start.getTime();
|
|
117
|
+
return n.end.getTime() - n.start.getTime() - o;
|
|
118
|
+
}), Ae = (e) => e.sort((t, n) => t.allDay || ae(t.start, t.end) > 0 ? -1 : t.start.getTime() - n.start.getTime()), Ne = (e, t, n, o, i) => {
|
|
119
|
+
var f;
|
|
120
|
+
const s = Array.isArray(t), a = [], d = {};
|
|
121
|
+
for (let c = 0; c < e.length; c++) {
|
|
122
|
+
const h = Oe(e[c], n), v = ae(h.start, h.end) > 0, y = i && !h.allDay && v;
|
|
123
|
+
let p = h.allDay || v && !y;
|
|
124
|
+
if (p && (s ? p = t.some(
|
|
125
|
+
(u) => j(u, {
|
|
126
|
+
start: X(h.start),
|
|
127
|
+
end: q(h.end)
|
|
128
|
+
})
|
|
129
|
+
) : p = j(t, {
|
|
130
|
+
start: X(h.start),
|
|
131
|
+
end: q(h.end)
|
|
132
|
+
}), p))
|
|
133
|
+
if (a.push(h), s)
|
|
134
|
+
for (const u of t) {
|
|
135
|
+
const g = N(u, "yyyy-MM-dd");
|
|
136
|
+
j(u, { start: X(h.start), end: q(h.end) }) && (d[g] = (d[g] || []).concat(h));
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
const u = N(h.start, "yyyy-MM-dd");
|
|
140
|
+
d[u] = (d[u] || []).concat(h);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return s && o ? ((f = Object.values(d).sort((c, h) => h.length - c.length)) == null ? void 0 : f[0]) || [] : a;
|
|
144
|
+
}, Oe = (e, t) => ({
|
|
145
|
+
...e,
|
|
146
|
+
start: ue(e.start, t),
|
|
147
|
+
end: ue(e.end, t),
|
|
148
|
+
convertedTz: !0
|
|
149
|
+
}), ue = (e, t) => new Date(
|
|
150
|
+
new Intl.DateTimeFormat("en-US", {
|
|
151
|
+
dateStyle: "short",
|
|
152
|
+
timeStyle: "medium",
|
|
153
|
+
timeZone: t
|
|
154
|
+
}).format(e)
|
|
155
|
+
), Ge = (e, t) => {
|
|
156
|
+
if (!t)
|
|
157
|
+
return e;
|
|
158
|
+
const n = -e.getTimezoneOffset(), o = Ln(t), i = n - o;
|
|
159
|
+
return new Date(e.getTime() + i * 60 * 1e3);
|
|
160
|
+
}, he = ({
|
|
161
|
+
dateLeft: e,
|
|
162
|
+
dateRight: t,
|
|
163
|
+
timeZone: n
|
|
164
|
+
}) => ye(e, ue(t || /* @__PURE__ */ new Date(), n)), De = (e) => e === "12" ? "hh:mm a" : "HH:mm";
|
|
165
|
+
function Ln(e) {
|
|
166
|
+
const t = /* @__PURE__ */ new Date(), n = new Date(t.toLocaleString("en-US", { timeZone: e })), o = new Date(t.toLocaleString("en-US", { timeZone: "UTC" }));
|
|
167
|
+
return Math.round((n.getTime() - o.getTime()) / (60 * 1e3));
|
|
168
|
+
}
|
|
169
|
+
const Vn = {
|
|
170
|
+
weekDays: [0, 1, 2, 3, 4, 5, 6],
|
|
171
|
+
weekStartOn: 6,
|
|
172
|
+
startHour: 9,
|
|
173
|
+
endHour: 17,
|
|
174
|
+
navigation: !0,
|
|
175
|
+
disableGoToDay: !1
|
|
176
|
+
}, Gn = {
|
|
177
|
+
weekDays: [0, 1, 2, 3, 4, 5, 6],
|
|
178
|
+
weekStartOn: 6,
|
|
179
|
+
startHour: 9,
|
|
180
|
+
endHour: 17,
|
|
181
|
+
step: 60,
|
|
182
|
+
navigation: !0,
|
|
183
|
+
disableGoToDay: !1
|
|
184
|
+
}, jn = {
|
|
185
|
+
startHour: 9,
|
|
186
|
+
endHour: 17,
|
|
187
|
+
step: 60,
|
|
188
|
+
navigation: !0
|
|
189
|
+
}, Un = {
|
|
190
|
+
idField: "assignee",
|
|
191
|
+
textField: "text",
|
|
192
|
+
subTextField: "subtext",
|
|
193
|
+
avatarField: "avatar",
|
|
194
|
+
colorField: "color"
|
|
195
|
+
}, Zn = (e = {}) => {
|
|
196
|
+
const { navigation: t, form: n, event: o, ...i } = e;
|
|
197
|
+
return {
|
|
198
|
+
navigation: Object.assign(
|
|
199
|
+
{
|
|
200
|
+
month: "Month",
|
|
201
|
+
week: "Week",
|
|
202
|
+
day: "Day",
|
|
203
|
+
agenda: "Agenda",
|
|
204
|
+
today: "Today"
|
|
205
|
+
},
|
|
206
|
+
t
|
|
207
|
+
),
|
|
208
|
+
form: Object.assign(
|
|
209
|
+
{
|
|
210
|
+
addTitle: "Add Event",
|
|
211
|
+
editTitle: "Edit Event",
|
|
212
|
+
confirm: "Confirm",
|
|
213
|
+
delete: "Delete",
|
|
214
|
+
cancel: "Cancel"
|
|
215
|
+
},
|
|
216
|
+
n
|
|
217
|
+
),
|
|
218
|
+
event: Object.assign(
|
|
219
|
+
{
|
|
220
|
+
title: "Title",
|
|
221
|
+
start: "Start",
|
|
222
|
+
end: "End",
|
|
223
|
+
allDay: "All Day"
|
|
224
|
+
},
|
|
225
|
+
o
|
|
226
|
+
),
|
|
227
|
+
...Object.assign(
|
|
228
|
+
{ moreEvents: "More...", loading: "Loading...", noDataToDisplay: "No data to display" },
|
|
229
|
+
i
|
|
230
|
+
)
|
|
231
|
+
};
|
|
232
|
+
}, qn = (e) => {
|
|
233
|
+
const { month: t, week: n, day: o } = e;
|
|
234
|
+
return {
|
|
235
|
+
month: t !== null ? Object.assign(Vn, t) : null,
|
|
236
|
+
week: n !== null ? Object.assign(Gn, n) : null,
|
|
237
|
+
day: o !== null ? Object.assign(jn, o) : null
|
|
238
|
+
};
|
|
239
|
+
}, Ft = (e) => {
|
|
240
|
+
const {
|
|
241
|
+
translations: t,
|
|
242
|
+
resourceFields: n,
|
|
243
|
+
view: o,
|
|
244
|
+
agenda: i,
|
|
245
|
+
selectedDate: s,
|
|
246
|
+
resourceViewMode: a,
|
|
247
|
+
direction: d,
|
|
248
|
+
dialogMaxWidth: f,
|
|
249
|
+
hourFormat: c,
|
|
250
|
+
...h
|
|
251
|
+
} = e, v = qn(e), y = o || "week", p = v[y] ? y : Wn(v);
|
|
252
|
+
return {
|
|
253
|
+
...v,
|
|
254
|
+
translations: Zn(t),
|
|
255
|
+
resourceFields: Object.assign(Un, n),
|
|
256
|
+
view: p,
|
|
257
|
+
selectedDate: ue(s || /* @__PURE__ */ new Date(), e.timeZone),
|
|
258
|
+
height: 600,
|
|
259
|
+
navigation: !0,
|
|
260
|
+
disableViewNavigator: !1,
|
|
261
|
+
events: [],
|
|
262
|
+
fields: [],
|
|
263
|
+
loading: void 0,
|
|
264
|
+
customEditor: void 0,
|
|
265
|
+
onConfirm: void 0,
|
|
266
|
+
onDelete: void 0,
|
|
267
|
+
viewerExtraComponent: void 0,
|
|
268
|
+
resources: [],
|
|
269
|
+
resourceHeaderComponent: void 0,
|
|
270
|
+
resourceViewMode: a || "default",
|
|
271
|
+
direction: d || "ltr",
|
|
272
|
+
dialogMaxWidth: f || "md",
|
|
273
|
+
locale: kn,
|
|
274
|
+
deletable: !0,
|
|
275
|
+
editable: !0,
|
|
276
|
+
hourFormat: c || "12",
|
|
277
|
+
draggable: !0,
|
|
278
|
+
agenda: i,
|
|
279
|
+
enableAgenda: typeof i > "u" || i,
|
|
280
|
+
showCurrentTimeBar: !0,
|
|
281
|
+
forceInlineMultiDay: !1,
|
|
282
|
+
...h
|
|
283
|
+
};
|
|
284
|
+
}, $t = {
|
|
285
|
+
...Ft({}),
|
|
286
|
+
setProps: () => {
|
|
287
|
+
},
|
|
288
|
+
dialog: !1,
|
|
289
|
+
selectedRange: void 0,
|
|
290
|
+
selectedEvent: void 0,
|
|
291
|
+
selectedResource: void 0,
|
|
292
|
+
handleState: () => {
|
|
293
|
+
},
|
|
294
|
+
getViews: () => [],
|
|
295
|
+
toggleAgenda: () => {
|
|
296
|
+
},
|
|
297
|
+
triggerDialog: () => {
|
|
298
|
+
},
|
|
299
|
+
triggerLoading: () => {
|
|
300
|
+
},
|
|
301
|
+
handleGotoDay: () => {
|
|
302
|
+
},
|
|
303
|
+
confirmEvent: () => {
|
|
304
|
+
},
|
|
305
|
+
setCurrentDragged: () => {
|
|
306
|
+
},
|
|
307
|
+
onDrop: () => {
|
|
308
|
+
}
|
|
309
|
+
}, At = pt($t), O = () => yt(At), je = ({ resource: e }) => {
|
|
310
|
+
const { resourceHeaderComponent: t, resourceFields: n, direction: o, resourceViewMode: i } = O(), s = ne(), a = e[n.textField], d = e[n.subTextField || ""], f = e[n.avatarField || ""], c = e[n.colorField || ""];
|
|
311
|
+
return t instanceof Function ? t(e) : /* @__PURE__ */ M(
|
|
312
|
+
rn,
|
|
313
|
+
{
|
|
314
|
+
sx: {
|
|
315
|
+
padding: "2px 10px",
|
|
316
|
+
textAlign: o === "rtl" ? "right" : "left",
|
|
317
|
+
...i === "tabs" ? {} : i === "vertical" ? {
|
|
318
|
+
display: "block",
|
|
319
|
+
textAlign: "center",
|
|
320
|
+
position: "sticky",
|
|
321
|
+
top: 4
|
|
322
|
+
} : {
|
|
323
|
+
borderColor: s.palette.grey[300],
|
|
324
|
+
borderStyle: "solid",
|
|
325
|
+
borderWidth: 1
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
component: "div",
|
|
329
|
+
children: [
|
|
330
|
+
/* @__PURE__ */ r(xt, { children: /* @__PURE__ */ r(qe, { sx: { background: c, margin: "auto" }, alt: a, src: f }) }),
|
|
331
|
+
/* @__PURE__ */ r(
|
|
332
|
+
kt,
|
|
333
|
+
{
|
|
334
|
+
primary: /* @__PURE__ */ r(F, { variant: "body2", noWrap: i !== "vertical", children: a }),
|
|
335
|
+
secondary: /* @__PURE__ */ r(
|
|
336
|
+
F,
|
|
337
|
+
{
|
|
338
|
+
variant: "caption",
|
|
339
|
+
color: "textSecondary",
|
|
340
|
+
noWrap: i !== "vertical",
|
|
341
|
+
children: d
|
|
342
|
+
}
|
|
343
|
+
)
|
|
344
|
+
}
|
|
345
|
+
)
|
|
346
|
+
]
|
|
347
|
+
}
|
|
348
|
+
);
|
|
349
|
+
};
|
|
350
|
+
function Xn(e) {
|
|
351
|
+
const { children: t, value: n, index: o } = e;
|
|
352
|
+
return n === o ? /* @__PURE__ */ r(Y, { children: t }) : /* @__PURE__ */ r(Y, {});
|
|
353
|
+
}
|
|
354
|
+
function Yn(e) {
|
|
355
|
+
return {
|
|
356
|
+
id: `scrollable-auto-tab-${e}`,
|
|
357
|
+
"aria-controls": `scrollable-auto-tabpanel-${e}`
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
const Qn = Tn("div")(({ theme: e }) => ({
|
|
361
|
+
flexGrow: 1,
|
|
362
|
+
width: "100%",
|
|
363
|
+
backgroundColor: e.palette.background.paper,
|
|
364
|
+
alignSelf: "center",
|
|
365
|
+
"& .tabs": {
|
|
366
|
+
borderColor: e.palette.grey[300],
|
|
367
|
+
borderStyle: "solid",
|
|
368
|
+
borderWidth: 1,
|
|
369
|
+
"& button.MuiTab-root": {
|
|
370
|
+
borderColor: e.palette.grey[300],
|
|
371
|
+
borderRightStyle: "solid",
|
|
372
|
+
borderWidth: 1
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
"& .primary": {
|
|
376
|
+
background: e.palette.primary.main
|
|
377
|
+
},
|
|
378
|
+
"& .secondary": {
|
|
379
|
+
background: e.palette.secondary.main
|
|
380
|
+
},
|
|
381
|
+
"& .error": {
|
|
382
|
+
background: e.palette.error.main
|
|
383
|
+
},
|
|
384
|
+
"& .info": {
|
|
385
|
+
background: e.palette.info.dark
|
|
386
|
+
},
|
|
387
|
+
"& .text_primary": {
|
|
388
|
+
color: e.palette.primary.main
|
|
389
|
+
},
|
|
390
|
+
"& .text_secondary": {
|
|
391
|
+
color: e.palette.secondary.main
|
|
392
|
+
},
|
|
393
|
+
"& .text_error": {
|
|
394
|
+
color: e.palette.error.main
|
|
395
|
+
},
|
|
396
|
+
"& .text_info": {
|
|
397
|
+
color: e.palette.info.dark
|
|
398
|
+
}
|
|
399
|
+
})), Jn = ({
|
|
400
|
+
tabs: e,
|
|
401
|
+
variant: t = "scrollable",
|
|
402
|
+
tab: n,
|
|
403
|
+
setTab: o,
|
|
404
|
+
indicator: i = "primary",
|
|
405
|
+
style: s
|
|
406
|
+
}) => /* @__PURE__ */ M(Qn, { style: s, children: [
|
|
407
|
+
/* @__PURE__ */ r(
|
|
408
|
+
on,
|
|
409
|
+
{
|
|
410
|
+
value: n,
|
|
411
|
+
variant: t,
|
|
412
|
+
scrollButtons: !0,
|
|
413
|
+
className: "tabs",
|
|
414
|
+
classes: { indicator: i },
|
|
415
|
+
children: e.map((a, d) => /* @__PURE__ */ r(
|
|
416
|
+
an,
|
|
417
|
+
{
|
|
418
|
+
label: a.label,
|
|
419
|
+
sx: { flex: 1, flexBasis: 200, flexShrink: 0 },
|
|
420
|
+
value: a.id,
|
|
421
|
+
...Yn(a.id),
|
|
422
|
+
onClick: () => o(a.id),
|
|
423
|
+
onDragEnter: () => o(a.id)
|
|
424
|
+
},
|
|
425
|
+
a.id || d
|
|
426
|
+
))
|
|
427
|
+
}
|
|
428
|
+
),
|
|
429
|
+
e.map(
|
|
430
|
+
(a, d) => a.component && /* @__PURE__ */ r(Xn, { value: n, index: a.id, children: a.component }, d)
|
|
431
|
+
)
|
|
432
|
+
] }), Ye = ({ renderChildren: e }) => {
|
|
433
|
+
const { resources: t, resourceFields: n, resourceViewMode: o } = O(), i = ne();
|
|
434
|
+
return o === "tabs" ? /* @__PURE__ */ r(Kn, { renderChildren: e }) : o === "vertical" ? /* @__PURE__ */ r(Y, { children: t.map((s, a) => /* @__PURE__ */ M(Ee, { sx: { display: "flex" }, children: [
|
|
435
|
+
/* @__PURE__ */ r(
|
|
436
|
+
Ee,
|
|
437
|
+
{
|
|
438
|
+
sx: {
|
|
439
|
+
borderColor: i.palette.grey[300],
|
|
440
|
+
borderStyle: "solid",
|
|
441
|
+
borderWidth: "1px 1px 0 1px",
|
|
442
|
+
paddingTop: 1,
|
|
443
|
+
flexBasis: 140
|
|
444
|
+
},
|
|
445
|
+
children: /* @__PURE__ */ r(je, { resource: s })
|
|
446
|
+
}
|
|
447
|
+
),
|
|
448
|
+
/* @__PURE__ */ r(
|
|
449
|
+
Ee,
|
|
450
|
+
{
|
|
451
|
+
sx: { width: "100%", overflowX: "auto" },
|
|
452
|
+
children: e(s)
|
|
453
|
+
}
|
|
454
|
+
)
|
|
455
|
+
] }, `${s[n.idField]}_${a}`)) }) : /* @__PURE__ */ r(Y, { children: t.map((s, a) => /* @__PURE__ */ M("div", { children: [
|
|
456
|
+
/* @__PURE__ */ r(je, { resource: s }),
|
|
457
|
+
e(s)
|
|
458
|
+
] }, `${s[n.idField]}_${a}`)) });
|
|
459
|
+
}, Kn = ({ renderChildren: e }) => {
|
|
460
|
+
const { resources: t, resourceFields: n, selectedTab: o, handleState: i, onResourceChange: s } = O(), a = t.map((c) => ({
|
|
461
|
+
id: c[n.idField],
|
|
462
|
+
label: /* @__PURE__ */ r(je, { resource: c }),
|
|
463
|
+
component: /* @__PURE__ */ r(Y, { children: e(c) })
|
|
464
|
+
})), d = (c) => {
|
|
465
|
+
if (i(c, "selectedTab"), typeof s == "function") {
|
|
466
|
+
const h = t.find((v) => v[n.idField] === c);
|
|
467
|
+
h && s(h);
|
|
468
|
+
}
|
|
469
|
+
}, f = U(() => {
|
|
470
|
+
const c = t[0][n.idField];
|
|
471
|
+
return !o || t.findIndex((v) => v[n.idField] === o) < 0 ? c : o;
|
|
472
|
+
}, [t, n.idField, o]);
|
|
473
|
+
return /* @__PURE__ */ r(Jn, { tabs: a, tab: f, setTab: d, style: { display: "grid" } });
|
|
474
|
+
}, er = se("div")(({ theme: e, dialog: t }) => ({
|
|
475
|
+
position: "relative",
|
|
476
|
+
"& .rs__table_loading": {
|
|
477
|
+
position: "absolute",
|
|
478
|
+
left: 0,
|
|
479
|
+
right: 0,
|
|
480
|
+
top: 0,
|
|
481
|
+
bottom: 0,
|
|
482
|
+
zIndex: 999999,
|
|
483
|
+
"& .rs__table_loading_internal": {
|
|
484
|
+
background: t ? "" : Me(e.palette.background.paper, 0.4),
|
|
485
|
+
height: "100%",
|
|
486
|
+
"& > span": {
|
|
487
|
+
display: "flex",
|
|
488
|
+
alignItems: "center",
|
|
489
|
+
justifyContent: "center",
|
|
490
|
+
height: "100%",
|
|
491
|
+
flexDirection: "column",
|
|
492
|
+
"& >span": {
|
|
493
|
+
marginBottom: 15
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
})), tr = se("div")(({ resource_count: e }) => ({
|
|
499
|
+
position: "relative",
|
|
500
|
+
display: "flex",
|
|
501
|
+
flexDirection: e > 1 ? "row" : "column",
|
|
502
|
+
width: "100%",
|
|
503
|
+
boxSizing: "content-box",
|
|
504
|
+
"& > div": {
|
|
505
|
+
flexShrink: 0,
|
|
506
|
+
flexGrow: 1
|
|
507
|
+
}
|
|
508
|
+
})), nr = se(Tt)(
|
|
509
|
+
({ sticky: e = "0", offset: t = 0 }) => ({
|
|
510
|
+
display: "flex",
|
|
511
|
+
justifyContent: "space-between",
|
|
512
|
+
alignItems: "center",
|
|
513
|
+
position: e === "1" ? "sticky" : "relative",
|
|
514
|
+
top: e === "1" ? t : void 0,
|
|
515
|
+
zIndex: e === "1" ? 999 : void 0,
|
|
516
|
+
boxShadow: "none",
|
|
517
|
+
padding: "2px 0",
|
|
518
|
+
"& > .rs__view_navigator": {
|
|
519
|
+
display: "flex",
|
|
520
|
+
alignItems: "center"
|
|
521
|
+
}
|
|
522
|
+
})
|
|
523
|
+
), Re = se("div")(
|
|
524
|
+
({ theme: e, stickyOffset: t = 0, stickyHeight: n = 40 }) => ({
|
|
525
|
+
borderStyle: "solid",
|
|
526
|
+
borderColor: e.palette.grey[300],
|
|
527
|
+
borderWidth: "1px 1px 0 0",
|
|
528
|
+
"& > .rs__agenda_row": {
|
|
529
|
+
display: "flex",
|
|
530
|
+
"& >.rs__agenda__cell": {
|
|
531
|
+
padding: 4,
|
|
532
|
+
width: "100%",
|
|
533
|
+
maxWidth: 60,
|
|
534
|
+
"& > .MuiTypography-root": {
|
|
535
|
+
position: "sticky",
|
|
536
|
+
top: t + n,
|
|
537
|
+
"&.rs__hover__op": {
|
|
538
|
+
cursor: "pointer",
|
|
539
|
+
"&:hover": {
|
|
540
|
+
opacity: 0.7,
|
|
541
|
+
textDecoration: "underline"
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
},
|
|
546
|
+
"& .rs__cell": {
|
|
547
|
+
borderStyle: "solid",
|
|
548
|
+
borderColor: e.palette.grey[300],
|
|
549
|
+
borderWidth: "0 0 1px 1px"
|
|
550
|
+
},
|
|
551
|
+
"& > .rs__agenda_items": {
|
|
552
|
+
flexGrow: 1
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
})
|
|
556
|
+
), be = se("div")(
|
|
557
|
+
({
|
|
558
|
+
days: e,
|
|
559
|
+
sticky: t = "0",
|
|
560
|
+
stickyNavigation: n,
|
|
561
|
+
indent: o = "1",
|
|
562
|
+
theme: i,
|
|
563
|
+
stickyOffset: s = 0,
|
|
564
|
+
stickyHeight: a = 40
|
|
565
|
+
}) => ({
|
|
566
|
+
display: "grid",
|
|
567
|
+
gridTemplateColumns: +o > 0 ? `10% repeat(${e}, 1fr)` : `repeat(${e}, 1fr)`,
|
|
568
|
+
overflowX: "auto",
|
|
569
|
+
overflowY: "hidden",
|
|
570
|
+
position: t === "1" ? "sticky" : "relative",
|
|
571
|
+
top: t === "1" ? n ? s + a : 0 : void 0,
|
|
572
|
+
zIndex: t === "1" ? 99 : void 0,
|
|
573
|
+
[i.breakpoints.down("sm")]: {
|
|
574
|
+
gridTemplateColumns: +o > 0 ? `30px repeat(${e}, 1fr)` : ""
|
|
575
|
+
},
|
|
576
|
+
borderStyle: "solid",
|
|
577
|
+
borderColor: i.palette.grey[300],
|
|
578
|
+
borderWidth: "0 0 0 1px",
|
|
579
|
+
"&:first-of-type": {
|
|
580
|
+
borderWidth: "1px 0 0 1px"
|
|
581
|
+
},
|
|
582
|
+
"&:last-of-type": {
|
|
583
|
+
borderWidth: "0 0 1px 1px"
|
|
584
|
+
},
|
|
585
|
+
"& .rs__cell": {
|
|
586
|
+
background: i.palette.background.paper,
|
|
587
|
+
position: "relative",
|
|
588
|
+
borderStyle: "solid",
|
|
589
|
+
borderColor: i.palette.grey[300],
|
|
590
|
+
borderWidth: "0 1px 1px 0",
|
|
591
|
+
"&.rs__header": {
|
|
592
|
+
"& > :first-of-type": {
|
|
593
|
+
padding: "2px 5px"
|
|
594
|
+
}
|
|
595
|
+
},
|
|
596
|
+
"&.rs__header__center": {
|
|
597
|
+
padding: "6px 0px"
|
|
598
|
+
},
|
|
599
|
+
"&.rs__time": {
|
|
600
|
+
display: "flex",
|
|
601
|
+
alignItems: "center",
|
|
602
|
+
justifyContent: "center",
|
|
603
|
+
position: "sticky",
|
|
604
|
+
left: 0,
|
|
605
|
+
zIndex: 99,
|
|
606
|
+
[i.breakpoints.down("sm")]: {
|
|
607
|
+
writingMode: "vertical-rl"
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
"& > button": {
|
|
611
|
+
width: "100%",
|
|
612
|
+
height: "100%",
|
|
613
|
+
borderRadius: 0,
|
|
614
|
+
cursor: "pointer",
|
|
615
|
+
"&:hover": {
|
|
616
|
+
background: Me(i.palette.primary.main, 0.1)
|
|
617
|
+
}
|
|
618
|
+
},
|
|
619
|
+
"& .rs__event__item": {
|
|
620
|
+
position: "absolute",
|
|
621
|
+
zIndex: 1
|
|
622
|
+
},
|
|
623
|
+
"& .rs__multi_day": {
|
|
624
|
+
position: "absolute",
|
|
625
|
+
zIndex: 1,
|
|
626
|
+
textOverflow: "ellipsis"
|
|
627
|
+
},
|
|
628
|
+
"& .rs__block_col": {
|
|
629
|
+
display: "block",
|
|
630
|
+
position: "relative"
|
|
631
|
+
},
|
|
632
|
+
"& .rs__hover__op": {
|
|
633
|
+
cursor: "pointer",
|
|
634
|
+
"&:hover": {
|
|
635
|
+
opacity: 0.7,
|
|
636
|
+
textDecoration: "underline"
|
|
637
|
+
}
|
|
638
|
+
},
|
|
639
|
+
"&:not(.rs__time)": {
|
|
640
|
+
minWidth: 65
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
})
|
|
644
|
+
), ct = se(Tt)(({ disabled: e }) => ({
|
|
645
|
+
width: "99.5%",
|
|
646
|
+
height: "100%",
|
|
647
|
+
display: "block",
|
|
648
|
+
cursor: e ? "not-allowed" : "pointer",
|
|
649
|
+
overflow: "hidden",
|
|
650
|
+
"& .MuiButtonBase-root": {
|
|
651
|
+
width: "100%",
|
|
652
|
+
height: "100%",
|
|
653
|
+
display: "block",
|
|
654
|
+
textAlign: "left",
|
|
655
|
+
"& > div": {
|
|
656
|
+
height: "100%"
|
|
657
|
+
// padding: "2px 4px",
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
})), rr = se("div")(({ theme: e }) => ({
|
|
661
|
+
maxWidth: "100%",
|
|
662
|
+
width: 400,
|
|
663
|
+
"& > div": {
|
|
664
|
+
padding: "5px 10px",
|
|
665
|
+
"& .rs__popper_actions": {
|
|
666
|
+
display: "flex",
|
|
667
|
+
alignItems: "center",
|
|
668
|
+
justifyContent: "space-between",
|
|
669
|
+
"& .MuiIconButton-root": {
|
|
670
|
+
color: e.palette.primary.contrastText
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
})), or = se("div")(({ theme: e }) => ({
|
|
675
|
+
display: "inherit",
|
|
676
|
+
"& .MuiIconButton-root": {
|
|
677
|
+
color: e.palette.primary.contrastText
|
|
678
|
+
},
|
|
679
|
+
"& .MuiButton-root": {
|
|
680
|
+
"&.delete": {
|
|
681
|
+
color: e.palette.error.main
|
|
682
|
+
},
|
|
683
|
+
"&.cancel": {
|
|
684
|
+
color: e.palette.action.disabled
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
})), ir = se("div")(({ theme: e, color: t }) => ({
|
|
688
|
+
position: "absolute",
|
|
689
|
+
zIndex: 9,
|
|
690
|
+
width: "100%",
|
|
691
|
+
display: "flex",
|
|
692
|
+
"& > div:first-of-type": {
|
|
693
|
+
height: 12,
|
|
694
|
+
width: 12,
|
|
695
|
+
borderRadius: "50%",
|
|
696
|
+
background: t || e.palette.error.light,
|
|
697
|
+
marginLeft: -6,
|
|
698
|
+
marginTop: -5
|
|
699
|
+
},
|
|
700
|
+
"& > div:last-of-type": {
|
|
701
|
+
borderTop: `solid 2px ${t || e.palette.error.light}`,
|
|
702
|
+
width: "100%"
|
|
703
|
+
}
|
|
704
|
+
})), Rt = (e) => {
|
|
705
|
+
const { editable: t, deletable: n, draggable: o } = O(), i = U(() => typeof e.editable < "u" ? e.editable : t, [t, e.editable]), s = U(() => typeof e.deletable < "u" ? e.deletable : n, [n, e.deletable]), a = U(() => {
|
|
706
|
+
if (i)
|
|
707
|
+
return typeof e.draggable < "u" ? e.draggable : o;
|
|
708
|
+
}, [o, e.draggable, i]);
|
|
709
|
+
return {
|
|
710
|
+
canEdit: i,
|
|
711
|
+
canDelete: s,
|
|
712
|
+
canDrag: a
|
|
713
|
+
};
|
|
714
|
+
}, ar = ({ event: e, onDelete: t, onEdit: n }) => {
|
|
715
|
+
const { translations: o, direction: i } = O(), [s, a] = L(!1), d = () => {
|
|
716
|
+
if (!s)
|
|
717
|
+
return a(!0);
|
|
718
|
+
t();
|
|
719
|
+
}, { canEdit: f, canDelete: c } = Rt(e);
|
|
720
|
+
return /* @__PURE__ */ M(or, { children: [
|
|
721
|
+
/* @__PURE__ */ r(sn, { in: !s, exit: !1, timeout: 400, unmountOnExit: !0, children: /* @__PURE__ */ M("div", { children: [
|
|
722
|
+
f && /* @__PURE__ */ r(ve, { size: "small", onClick: n, children: /* @__PURE__ */ r(En, {}) }),
|
|
723
|
+
c && /* @__PURE__ */ r(ve, { size: "small", onClick: d, children: /* @__PURE__ */ r(Cn, {}) })
|
|
724
|
+
] }) }),
|
|
725
|
+
/* @__PURE__ */ r(
|
|
726
|
+
ln,
|
|
727
|
+
{
|
|
728
|
+
in: s,
|
|
729
|
+
direction: i === "rtl" ? "right" : "left",
|
|
730
|
+
unmountOnExit: !0,
|
|
731
|
+
timeout: 400,
|
|
732
|
+
exit: !1,
|
|
733
|
+
children: /* @__PURE__ */ M("div", { children: [
|
|
734
|
+
/* @__PURE__ */ r(ee, { className: "delete", size: "small", onClick: d, children: o.form.delete.toUpperCase() }),
|
|
735
|
+
/* @__PURE__ */ r(ee, { className: "cancel", size: "small", onClick: () => a(!1), children: o.form.cancel.toUpperCase() })
|
|
736
|
+
] })
|
|
737
|
+
}
|
|
738
|
+
)
|
|
739
|
+
] });
|
|
740
|
+
}, Ht = ({ anchorEl: e, event: t, onTriggerViewer: n }) => {
|
|
741
|
+
const {
|
|
742
|
+
triggerDialog: o,
|
|
743
|
+
onDelete: i,
|
|
744
|
+
events: s,
|
|
745
|
+
handleState: a,
|
|
746
|
+
triggerLoading: d,
|
|
747
|
+
customViewer: f,
|
|
748
|
+
viewerExtraComponent: c,
|
|
749
|
+
fields: h,
|
|
750
|
+
resources: v,
|
|
751
|
+
resourceFields: y,
|
|
752
|
+
locale: p,
|
|
753
|
+
viewerTitleComponent: u,
|
|
754
|
+
viewerSubtitleComponent: g,
|
|
755
|
+
hourFormat: b,
|
|
756
|
+
translations: l,
|
|
757
|
+
onEventEdit: _
|
|
758
|
+
} = O(), T = ne(), E = De(b), D = t._originalStart || t.start, k = t._originalEnd || t.end, S = ae(D, k) <= 0 && t.allDay, I = y.idField, m = v.filter(
|
|
759
|
+
(x) => Array.isArray(t[I]) ? t[I].includes(x[I]) : x[I] === t[I]
|
|
760
|
+
), w = async () => {
|
|
761
|
+
try {
|
|
762
|
+
d(!0);
|
|
763
|
+
let x = t.event_id;
|
|
764
|
+
if (i) {
|
|
765
|
+
const C = await i(x);
|
|
766
|
+
C ? x = C : x = "";
|
|
767
|
+
}
|
|
768
|
+
if (x) {
|
|
769
|
+
n();
|
|
770
|
+
const C = s.filter((W) => W.event_id !== x);
|
|
771
|
+
a(C, "events");
|
|
772
|
+
}
|
|
773
|
+
} catch (x) {
|
|
774
|
+
console.error(x);
|
|
775
|
+
} finally {
|
|
776
|
+
d(!1);
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
return /* @__PURE__ */ r(
|
|
780
|
+
Te,
|
|
781
|
+
{
|
|
782
|
+
open: !!e,
|
|
783
|
+
anchorEl: e,
|
|
784
|
+
onClose: () => {
|
|
785
|
+
n();
|
|
786
|
+
},
|
|
787
|
+
anchorOrigin: {
|
|
788
|
+
vertical: "center",
|
|
789
|
+
horizontal: "center"
|
|
790
|
+
},
|
|
791
|
+
transformOrigin: {
|
|
792
|
+
vertical: "top",
|
|
793
|
+
horizontal: "center"
|
|
794
|
+
},
|
|
795
|
+
onClick: (x) => {
|
|
796
|
+
x.stopPropagation();
|
|
797
|
+
},
|
|
798
|
+
children: typeof f == "function" ? f(t, () => n()) : /* @__PURE__ */ M(rr, { children: [
|
|
799
|
+
/* @__PURE__ */ M(
|
|
800
|
+
Ee,
|
|
801
|
+
{
|
|
802
|
+
sx: {
|
|
803
|
+
bgcolor: t.color || T.palette.primary.main,
|
|
804
|
+
color: T.palette.primary.contrastText
|
|
805
|
+
},
|
|
806
|
+
children: [
|
|
807
|
+
/* @__PURE__ */ M("div", { className: "rs__popper_actions", children: [
|
|
808
|
+
/* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(
|
|
809
|
+
ve,
|
|
810
|
+
{
|
|
811
|
+
size: "small",
|
|
812
|
+
onClick: () => {
|
|
813
|
+
n();
|
|
814
|
+
},
|
|
815
|
+
children: /* @__PURE__ */ r(Mn, { color: "disabled" })
|
|
816
|
+
}
|
|
817
|
+
) }),
|
|
818
|
+
/* @__PURE__ */ r(
|
|
819
|
+
ar,
|
|
820
|
+
{
|
|
821
|
+
event: t,
|
|
822
|
+
onDelete: w,
|
|
823
|
+
onEdit: () => {
|
|
824
|
+
n(), o(!0, t), _ && typeof _ == "function" && _(t);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
)
|
|
828
|
+
] }),
|
|
829
|
+
u instanceof Function ? u(t) : /* @__PURE__ */ r(F, { style: { padding: "5px 0" }, noWrap: !0, children: t.title })
|
|
830
|
+
]
|
|
831
|
+
}
|
|
832
|
+
),
|
|
833
|
+
/* @__PURE__ */ M("div", { style: { padding: "5px 10px" }, children: [
|
|
834
|
+
/* @__PURE__ */ M(
|
|
835
|
+
F,
|
|
836
|
+
{
|
|
837
|
+
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
838
|
+
color: "textSecondary",
|
|
839
|
+
variant: "caption",
|
|
840
|
+
noWrap: !0,
|
|
841
|
+
children: [
|
|
842
|
+
/* @__PURE__ */ r(Sn, {}),
|
|
843
|
+
S ? l.event.allDay : `${N(D, `dd MMMM yyyy ${E}`, {
|
|
844
|
+
locale: p
|
|
845
|
+
})} - ${N(k, `dd MMMM yyyy ${E}`, {
|
|
846
|
+
locale: p
|
|
847
|
+
})}`
|
|
848
|
+
]
|
|
849
|
+
}
|
|
850
|
+
),
|
|
851
|
+
g instanceof Function ? g(t) : /* @__PURE__ */ r(F, { variant: "body2", style: { padding: "5px 0" }, children: t.subtitle }),
|
|
852
|
+
m.length > 0 && /* @__PURE__ */ M(
|
|
853
|
+
F,
|
|
854
|
+
{
|
|
855
|
+
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
856
|
+
color: "textSecondary",
|
|
857
|
+
variant: "caption",
|
|
858
|
+
noWrap: !0,
|
|
859
|
+
children: [
|
|
860
|
+
/* @__PURE__ */ r(In, {}),
|
|
861
|
+
m.map((x) => x[y.textField]).join(", ")
|
|
862
|
+
]
|
|
863
|
+
}
|
|
864
|
+
),
|
|
865
|
+
c instanceof Function ? c(h, t) : c
|
|
866
|
+
] })
|
|
867
|
+
] })
|
|
868
|
+
}
|
|
869
|
+
);
|
|
870
|
+
}, Qe = ({ day: e, events: t }) => {
|
|
871
|
+
const [n, o] = L(null), [i, s] = L(), [a, d] = L(!1), { locale: f, hourFormat: c, eventRenderer: h, onEventClick: v, timeZone: y, disableViewer: p } = O(), u = ne(), g = De(c), b = (l) => {
|
|
872
|
+
!(l != null && l.currentTarget) && a && d(!1), o((l == null ? void 0 : l.currentTarget) || null);
|
|
873
|
+
};
|
|
874
|
+
return /* @__PURE__ */ M(ie, { children: [
|
|
875
|
+
/* @__PURE__ */ r(dn, { children: t.map((l) => {
|
|
876
|
+
const T = he({
|
|
877
|
+
dateLeft: l.start,
|
|
878
|
+
dateRight: e,
|
|
879
|
+
timeZone: y
|
|
880
|
+
}) ? g : `MMM d, ${g}`, E = N(l.start, T, {
|
|
881
|
+
locale: f
|
|
882
|
+
}), k = he({ dateLeft: l.end, dateRight: e, timeZone: y }) ? g : `MMM d, ${g}`, S = N(l.end, k, {
|
|
883
|
+
locale: f
|
|
884
|
+
});
|
|
885
|
+
return typeof h == "function" ? h({
|
|
886
|
+
event: l,
|
|
887
|
+
onClick: (I) => {
|
|
888
|
+
s(l), b(I);
|
|
889
|
+
}
|
|
890
|
+
}) : /* @__PURE__ */ M(
|
|
891
|
+
cn,
|
|
892
|
+
{
|
|
893
|
+
focusRipple: !0,
|
|
894
|
+
disableRipple: p,
|
|
895
|
+
tabIndex: p ? -1 : 0,
|
|
896
|
+
disabled: l.disabled,
|
|
897
|
+
onClick: (I) => {
|
|
898
|
+
I.preventDefault(), I.stopPropagation(), p || b(I), s(l), typeof v == "function" && v(l);
|
|
899
|
+
},
|
|
900
|
+
children: [
|
|
901
|
+
/* @__PURE__ */ r(xt, { children: /* @__PURE__ */ r(
|
|
902
|
+
qe,
|
|
903
|
+
{
|
|
904
|
+
sx: {
|
|
905
|
+
bgcolor: l.disabled ? "#d0d0d0" : l.color || u.palette.primary.main,
|
|
906
|
+
color: l.disabled ? "#808080" : l.textColor || u.palette.primary.contrastText
|
|
907
|
+
},
|
|
908
|
+
children: l.agendaAvatar || " "
|
|
909
|
+
}
|
|
910
|
+
) }),
|
|
911
|
+
/* @__PURE__ */ r(kt, { primary: l.title, secondary: `${E} - ${S}` })
|
|
912
|
+
]
|
|
913
|
+
},
|
|
914
|
+
`${l.start.getTime()}_${l.end.getTime()}_${l.event_id}`
|
|
915
|
+
);
|
|
916
|
+
}) }),
|
|
917
|
+
i && /* @__PURE__ */ r(
|
|
918
|
+
Ht,
|
|
919
|
+
{
|
|
920
|
+
anchorEl: n,
|
|
921
|
+
event: i,
|
|
922
|
+
onTriggerViewer: b
|
|
923
|
+
}
|
|
924
|
+
)
|
|
925
|
+
] });
|
|
926
|
+
}, Je = () => {
|
|
927
|
+
const { height: e, translations: t, stickyNavigationOffset: n, stickyNavigationHeight: o } = O();
|
|
928
|
+
return /* @__PURE__ */ r(
|
|
929
|
+
Re,
|
|
930
|
+
{
|
|
931
|
+
stickyOffset: n,
|
|
932
|
+
stickyHeight: o,
|
|
933
|
+
sx: {
|
|
934
|
+
borderWidth: 1,
|
|
935
|
+
padding: 1,
|
|
936
|
+
height: e / 2,
|
|
937
|
+
display: "flex",
|
|
938
|
+
alignItems: "center",
|
|
939
|
+
justifyContent: "center"
|
|
940
|
+
},
|
|
941
|
+
children: /* @__PURE__ */ r("div", { className: "rs__cell rs__agenda_items", children: /* @__PURE__ */ r(F, { children: t.noDataToDisplay }) })
|
|
942
|
+
}
|
|
943
|
+
);
|
|
944
|
+
}, sr = ({ daysList: e, resource: t, events: n }) => {
|
|
945
|
+
const {
|
|
946
|
+
week: o,
|
|
947
|
+
handleGotoDay: i,
|
|
948
|
+
locale: s,
|
|
949
|
+
timeZone: a,
|
|
950
|
+
translations: d,
|
|
951
|
+
alwaysShowAgendaDays: f,
|
|
952
|
+
stickyNavigationOffset: c,
|
|
953
|
+
stickyNavigationHeight: h
|
|
954
|
+
} = O(), { disableGoToDay: v, headRenderer: y } = o, p = U(() => e.some((u) => Ie(n, u).length > 0), [e, n]);
|
|
955
|
+
return !f && !p ? /* @__PURE__ */ r(Je, {}) : /* @__PURE__ */ r(Re, { stickyOffset: c, stickyHeight: h, children: e.map((u, g) => {
|
|
956
|
+
const b = he({ dateLeft: u, timeZone: a }), l = Ie(n, u);
|
|
957
|
+
return !f && !l.length ? null : /* @__PURE__ */ M("div", { className: `rs__agenda_row ${_e(u) ? "rs__today_cell" : ""}`, children: [
|
|
958
|
+
/* @__PURE__ */ r("div", { className: "rs__cell rs__agenda__cell", children: typeof y == "function" ? /* @__PURE__ */ r("div", { children: y({ day: u, events: n, resource: t }) }) : /* @__PURE__ */ r(
|
|
959
|
+
F,
|
|
960
|
+
{
|
|
961
|
+
sx: { fontWeight: b ? "bold" : "inherit" },
|
|
962
|
+
color: b ? "primary" : "inherit",
|
|
963
|
+
variant: "body2",
|
|
964
|
+
className: v ? "" : "rs__hover__op",
|
|
965
|
+
onClick: (_) => {
|
|
966
|
+
_.stopPropagation(), v || i(u);
|
|
967
|
+
},
|
|
968
|
+
children: N(u, "dd E", { locale: s })
|
|
969
|
+
}
|
|
970
|
+
) }),
|
|
971
|
+
/* @__PURE__ */ r("div", { className: "rs__cell rs__agenda_items", children: l.length > 0 ? /* @__PURE__ */ r(Qe, { day: u, events: l }) : /* @__PURE__ */ r(F, { sx: { padding: 1 }, children: d.noDataToDisplay }) })
|
|
972
|
+
] }, g);
|
|
973
|
+
}) });
|
|
974
|
+
}, Ue = 1, pe = 28, ut = 27, lr = 23, Wt = () => {
|
|
975
|
+
const e = nt(null), t = nt(null);
|
|
976
|
+
return te(() => {
|
|
977
|
+
const n = e.current, o = t.current, i = (s) => {
|
|
978
|
+
const a = s.currentTarget;
|
|
979
|
+
o == null || o.scroll({ left: a.scrollLeft }), n == null || n.scroll({ left: a.scrollLeft });
|
|
980
|
+
};
|
|
981
|
+
return n == null || n.addEventListener("scroll", i), o == null || o.addEventListener("scroll", i), () => {
|
|
982
|
+
n == null || n.removeEventListener("scroll", i), o == null || o.removeEventListener("scroll", i);
|
|
983
|
+
};
|
|
984
|
+
}), { headersRef: e, bodyRef: t };
|
|
985
|
+
}, Pt = ({ date: e, onClick: t, locale: n }) => {
|
|
986
|
+
const { timeZone: o } = O(), i = he({ dateLeft: e, timeZone: o });
|
|
987
|
+
return /* @__PURE__ */ M("div", { children: [
|
|
988
|
+
/* @__PURE__ */ r(
|
|
989
|
+
F,
|
|
990
|
+
{
|
|
991
|
+
style: {
|
|
992
|
+
fontWeight: i ? "bold" : "inherit"
|
|
993
|
+
},
|
|
994
|
+
color: i ? "primary" : "inherit",
|
|
995
|
+
className: t ? "rs__hover__op" : "",
|
|
996
|
+
onClick: (s) => {
|
|
997
|
+
s.stopPropagation(), t && t(e);
|
|
998
|
+
},
|
|
999
|
+
children: N(e, "dd", { locale: n })
|
|
1000
|
+
}
|
|
1001
|
+
),
|
|
1002
|
+
/* @__PURE__ */ r(
|
|
1003
|
+
F,
|
|
1004
|
+
{
|
|
1005
|
+
color: i ? "primary" : "inherit",
|
|
1006
|
+
style: {
|
|
1007
|
+
fontWeight: i ? "bold" : "inherit",
|
|
1008
|
+
fontSize: 11
|
|
1009
|
+
},
|
|
1010
|
+
children: N(e, "eee", { locale: n })
|
|
1011
|
+
}
|
|
1012
|
+
)
|
|
1013
|
+
] });
|
|
1014
|
+
}, zt = pt({
|
|
1015
|
+
renderedSlots: {},
|
|
1016
|
+
setRenderedSlot: () => {
|
|
1017
|
+
}
|
|
1018
|
+
}), Bt = () => yt(zt), dr = (e) => {
|
|
1019
|
+
const { setCurrentDragged: t } = O(), n = ne();
|
|
1020
|
+
return {
|
|
1021
|
+
draggable: !0,
|
|
1022
|
+
onDragStart: (o) => {
|
|
1023
|
+
o.stopPropagation(), t(e), o.currentTarget.style.backgroundColor = n.palette.error.main;
|
|
1024
|
+
},
|
|
1025
|
+
onDragEnd: (o) => {
|
|
1026
|
+
t(), o.currentTarget.style.backgroundColor = e.color || n.palette.primary.main;
|
|
1027
|
+
},
|
|
1028
|
+
onDragOver: (o) => {
|
|
1029
|
+
o.stopPropagation(), o.preventDefault();
|
|
1030
|
+
},
|
|
1031
|
+
onDragEnter: (o) => {
|
|
1032
|
+
o.stopPropagation(), o.preventDefault();
|
|
1033
|
+
}
|
|
1034
|
+
};
|
|
1035
|
+
}, He = ({ event: e, multiday: t, hasPrev: n, hasNext: o, showdate: i = !0 }) => {
|
|
1036
|
+
const { direction: s, locale: a, hourFormat: d, eventRenderer: f, onEventClick: c, view: h, disableViewer: v } = O(), y = dr(e), [p, u] = L(null), [g, b] = L(!1), l = ne(), _ = De(d), T = s === "rtl" ? lt : st, E = s === "rtl" ? st : lt, D = ae(e.start, e.end) <= 0 && e.allDay, { canDrag: k } = Rt(e), S = Z(
|
|
1037
|
+
(m) => {
|
|
1038
|
+
!(m != null && m.currentTarget) && g && b(!1), u((m == null ? void 0 : m.currentTarget) || null);
|
|
1039
|
+
},
|
|
1040
|
+
[g]
|
|
1041
|
+
), I = U(() => {
|
|
1042
|
+
if (typeof f == "function" && !t && h !== "month") {
|
|
1043
|
+
const w = f({ event: e, onClick: S, ...y });
|
|
1044
|
+
if (w)
|
|
1045
|
+
return /* @__PURE__ */ r(ct, { children: w }, `${e.start.getTime()}_${e.end.getTime()}_${e.event_id}`);
|
|
1046
|
+
}
|
|
1047
|
+
let m = /* @__PURE__ */ M("div", { style: { padding: "2px 6px" }, children: [
|
|
1048
|
+
/* @__PURE__ */ r(F, { variant: "subtitle2", style: { fontSize: 12 }, noWrap: !0, children: e.title }),
|
|
1049
|
+
e.subtitle && /* @__PURE__ */ r(F, { variant: "body2", style: { fontSize: 11 }, noWrap: !0, children: e.subtitle }),
|
|
1050
|
+
i && /* @__PURE__ */ r(F, { style: { fontSize: 11 }, noWrap: !0, children: `${N(e.start, _, {
|
|
1051
|
+
locale: a
|
|
1052
|
+
})} - ${N(e.end, _, { locale: a })}` })
|
|
1053
|
+
] });
|
|
1054
|
+
return t && (m = /* @__PURE__ */ M(
|
|
1055
|
+
"div",
|
|
1056
|
+
{
|
|
1057
|
+
style: {
|
|
1058
|
+
padding: 2,
|
|
1059
|
+
display: "flex",
|
|
1060
|
+
alignItems: "center",
|
|
1061
|
+
justifyContent: "space-between"
|
|
1062
|
+
},
|
|
1063
|
+
children: [
|
|
1064
|
+
/* @__PURE__ */ r(F, { sx: { fontSize: 11 }, noWrap: !0, children: n ? /* @__PURE__ */ r(E, { fontSize: "small", sx: { display: "flex" } }) : i && !D && N(e.start, _, { locale: a }) }),
|
|
1065
|
+
/* @__PURE__ */ r(F, { variant: "subtitle2", align: "center", sx: { fontSize: 12 }, noWrap: !0, children: e.title }),
|
|
1066
|
+
/* @__PURE__ */ r(F, { sx: { fontSize: 11 }, noWrap: !0, children: o ? /* @__PURE__ */ r(T, { fontSize: "small", sx: { display: "flex" } }) : i && !D && N(e.end, _, { locale: a }) })
|
|
1067
|
+
]
|
|
1068
|
+
}
|
|
1069
|
+
)), /* @__PURE__ */ r(
|
|
1070
|
+
ct,
|
|
1071
|
+
{
|
|
1072
|
+
disabled: e.disabled,
|
|
1073
|
+
sx: {
|
|
1074
|
+
bgcolor: e.disabled ? "#d0d0d0" : e.color || l.palette.primary.main,
|
|
1075
|
+
color: e.disabled ? "#808080" : e.textColor || l.palette.primary.contrastText,
|
|
1076
|
+
borderTop: e._hasPrev ? `3px dashed ${e.textColor || l.palette.primary.contrastText}` : void 0,
|
|
1077
|
+
borderBottom: e._hasNext ? `3px dashed ${e.textColor || l.palette.primary.contrastText}` : void 0,
|
|
1078
|
+
...e.sx || {}
|
|
1079
|
+
},
|
|
1080
|
+
children: /* @__PURE__ */ r(
|
|
1081
|
+
un,
|
|
1082
|
+
{
|
|
1083
|
+
onClick: (w) => {
|
|
1084
|
+
w.preventDefault(), w.stopPropagation(), v || S(w), typeof c == "function" && c(e);
|
|
1085
|
+
},
|
|
1086
|
+
focusRipple: !0,
|
|
1087
|
+
tabIndex: v ? -1 : 0,
|
|
1088
|
+
disableRipple: v,
|
|
1089
|
+
disabled: e.disabled,
|
|
1090
|
+
children: /* @__PURE__ */ r("div", { ...y, draggable: k, children: m })
|
|
1091
|
+
}
|
|
1092
|
+
)
|
|
1093
|
+
},
|
|
1094
|
+
`${e.start.getTime()}_${e.end.getTime()}_${e.event_id}`
|
|
1095
|
+
);
|
|
1096
|
+
}, [
|
|
1097
|
+
f,
|
|
1098
|
+
t,
|
|
1099
|
+
h,
|
|
1100
|
+
e,
|
|
1101
|
+
i,
|
|
1102
|
+
_,
|
|
1103
|
+
a,
|
|
1104
|
+
l.palette.primary.main,
|
|
1105
|
+
l.palette.primary.contrastText,
|
|
1106
|
+
v,
|
|
1107
|
+
y,
|
|
1108
|
+
k,
|
|
1109
|
+
S,
|
|
1110
|
+
n,
|
|
1111
|
+
E,
|
|
1112
|
+
D,
|
|
1113
|
+
o,
|
|
1114
|
+
T,
|
|
1115
|
+
c
|
|
1116
|
+
]);
|
|
1117
|
+
return /* @__PURE__ */ M(ie, { children: [
|
|
1118
|
+
I,
|
|
1119
|
+
/* @__PURE__ */ r(Ht, { anchorEl: p, event: e, onTriggerViewer: S })
|
|
1120
|
+
] });
|
|
1121
|
+
};
|
|
1122
|
+
function Be({
|
|
1123
|
+
startHour: e,
|
|
1124
|
+
step: t,
|
|
1125
|
+
minuteHeight: n,
|
|
1126
|
+
timeZone: o,
|
|
1127
|
+
currentTime: i
|
|
1128
|
+
}) {
|
|
1129
|
+
const s = ue(i || /* @__PURE__ */ new Date(), o), a = Fe(s, ke(s, { hours: e, minutes: 0 })), d = a * n, c = a / t + Ue;
|
|
1130
|
+
return d + c;
|
|
1131
|
+
}
|
|
1132
|
+
const cr = (e) => {
|
|
1133
|
+
const [t, n] = L(Be(e)), { startHour: o, step: i, minuteHeight: s, timeZone: a, currentTime: d, color: f } = e;
|
|
1134
|
+
return te(() => {
|
|
1135
|
+
const c = { startHour: o, step: i, minuteHeight: s, timeZone: a, currentTime: d };
|
|
1136
|
+
n(Be(c));
|
|
1137
|
+
const h = setInterval(() => n(Be(c)), 60 * 1e3);
|
|
1138
|
+
return () => clearInterval(h);
|
|
1139
|
+
}, [o, i, s, a, d]), t < 0 ? null : /* @__PURE__ */ M(ir, { style: { top: t, zIndex: e.zIndex }, color: f, children: [
|
|
1140
|
+
/* @__PURE__ */ r("div", {}),
|
|
1141
|
+
/* @__PURE__ */ r("div", {})
|
|
1142
|
+
] });
|
|
1143
|
+
}, Lt = ({
|
|
1144
|
+
todayEvents: e,
|
|
1145
|
+
today: t,
|
|
1146
|
+
startHour: n,
|
|
1147
|
+
endHour: o,
|
|
1148
|
+
step: i,
|
|
1149
|
+
minuteHeight: s,
|
|
1150
|
+
direction: a,
|
|
1151
|
+
timeZone: d,
|
|
1152
|
+
currentTime: f,
|
|
1153
|
+
showCurrentTimeBar: c = !0,
|
|
1154
|
+
currentTimeBarColor: h
|
|
1155
|
+
}) => {
|
|
1156
|
+
const v = [];
|
|
1157
|
+
return /* @__PURE__ */ M(ie, { children: [
|
|
1158
|
+
c && he({ dateLeft: t, timeZone: d }) && /* @__PURE__ */ r(
|
|
1159
|
+
cr,
|
|
1160
|
+
{
|
|
1161
|
+
startHour: n,
|
|
1162
|
+
step: i,
|
|
1163
|
+
minuteHeight: s,
|
|
1164
|
+
timeZone: d,
|
|
1165
|
+
zIndex: 2 * e.length + 1,
|
|
1166
|
+
currentTime: f,
|
|
1167
|
+
color: h
|
|
1168
|
+
}
|
|
1169
|
+
),
|
|
1170
|
+
e.map((y, p) => {
|
|
1171
|
+
const u = (o * 60 - n * 60) * s, g = Fe(y.end, y.start) * s, b = Math.min(g, u) - Ue, l = n * 60, _ = y.start.getHours() * 60 + y.start.getMinutes(), T = Math.max(_ - l, 0), E = T * s, k = b / 60 * Ue, S = T / i, I = E + S, m = zn(e, y), w = m.filter((x) => v.includes(x.event_id));
|
|
1172
|
+
return v.push(y.event_id), /* @__PURE__ */ r(
|
|
1173
|
+
"div",
|
|
1174
|
+
{
|
|
1175
|
+
className: "rs__event__item",
|
|
1176
|
+
style: {
|
|
1177
|
+
height: b + k,
|
|
1178
|
+
top: I,
|
|
1179
|
+
width: w.length > 0 ? `calc(100% - ${100 - 98 / (w.length + 1)}%)` : "98%",
|
|
1180
|
+
// Leave some space to click cell
|
|
1181
|
+
zIndex: e.length + p,
|
|
1182
|
+
[a === "rtl" ? "right" : "left"]: w.length > 0 ? `${100 / (m.length + 1) * w.length}%` : ""
|
|
1183
|
+
},
|
|
1184
|
+
children: /* @__PURE__ */ r(He, { event: y })
|
|
1185
|
+
},
|
|
1186
|
+
`${y.event_id}/${y.recurrenceId || ""}`
|
|
1187
|
+
);
|
|
1188
|
+
})
|
|
1189
|
+
] });
|
|
1190
|
+
}, ur = ({ start: e, end: t, resourceKey: n, resourceVal: o }) => {
|
|
1191
|
+
const {
|
|
1192
|
+
triggerDialog: i,
|
|
1193
|
+
onCellClick: s,
|
|
1194
|
+
onDrop: a,
|
|
1195
|
+
currentDragged: d,
|
|
1196
|
+
setCurrentDragged: f,
|
|
1197
|
+
editable: c,
|
|
1198
|
+
timeZone: h
|
|
1199
|
+
} = O(), v = ne();
|
|
1200
|
+
return {
|
|
1201
|
+
tabIndex: c ? 0 : -1,
|
|
1202
|
+
disableRipple: !c,
|
|
1203
|
+
onClick: () => {
|
|
1204
|
+
c && i(!0, {
|
|
1205
|
+
start: e,
|
|
1206
|
+
end: t,
|
|
1207
|
+
[n]: o
|
|
1208
|
+
}), s && typeof s == "function" && s(e, t, n, o);
|
|
1209
|
+
},
|
|
1210
|
+
onDragOver: (y) => {
|
|
1211
|
+
y.preventDefault(), d && (y.currentTarget.style.backgroundColor = Me(v.palette.secondary.main, 0.3));
|
|
1212
|
+
},
|
|
1213
|
+
onDragEnter: (y) => {
|
|
1214
|
+
d && (y.currentTarget.style.backgroundColor = Me(v.palette.secondary.main, 0.3));
|
|
1215
|
+
},
|
|
1216
|
+
onDragLeave: (y) => {
|
|
1217
|
+
d && (y.currentTarget.style.backgroundColor = "");
|
|
1218
|
+
},
|
|
1219
|
+
onDrop: (y) => {
|
|
1220
|
+
if (d && d.event_id) {
|
|
1221
|
+
y.preventDefault(), y.currentTarget.style.backgroundColor = "";
|
|
1222
|
+
const p = Ge(e, h);
|
|
1223
|
+
a(y, d.event_id.toString(), p, n, o), f();
|
|
1224
|
+
}
|
|
1225
|
+
},
|
|
1226
|
+
[n]: o
|
|
1227
|
+
};
|
|
1228
|
+
}, Ke = ({
|
|
1229
|
+
day: e,
|
|
1230
|
+
start: t,
|
|
1231
|
+
end: n,
|
|
1232
|
+
resourceKey: o,
|
|
1233
|
+
resourceVal: i,
|
|
1234
|
+
cellRenderer: s,
|
|
1235
|
+
height: a,
|
|
1236
|
+
children: d
|
|
1237
|
+
}) => {
|
|
1238
|
+
const f = ur({ start: t, end: n, resourceKey: o, resourceVal: i });
|
|
1239
|
+
return s ? s({
|
|
1240
|
+
day: e,
|
|
1241
|
+
start: t,
|
|
1242
|
+
end: n,
|
|
1243
|
+
height: a,
|
|
1244
|
+
...f
|
|
1245
|
+
}) : /* @__PURE__ */ r(
|
|
1246
|
+
ee,
|
|
1247
|
+
{
|
|
1248
|
+
fullWidth: !0,
|
|
1249
|
+
"aria-label": `${t.toLocaleString("en", {
|
|
1250
|
+
dateStyle: "full",
|
|
1251
|
+
timeStyle: "long"
|
|
1252
|
+
})} - ${n.toLocaleString("en", { dateStyle: "full", timeStyle: "long" })}`,
|
|
1253
|
+
...f,
|
|
1254
|
+
children: d
|
|
1255
|
+
}
|
|
1256
|
+
);
|
|
1257
|
+
}, hr = ({
|
|
1258
|
+
daysList: e,
|
|
1259
|
+
hours: t,
|
|
1260
|
+
cellHeight: n,
|
|
1261
|
+
minutesHeight: o,
|
|
1262
|
+
resourcedEvents: i,
|
|
1263
|
+
resource: s
|
|
1264
|
+
}) => {
|
|
1265
|
+
const {
|
|
1266
|
+
week: a,
|
|
1267
|
+
events: d,
|
|
1268
|
+
handleGotoDay: f,
|
|
1269
|
+
resources: c,
|
|
1270
|
+
resourceFields: h,
|
|
1271
|
+
resourceViewMode: v,
|
|
1272
|
+
direction: y,
|
|
1273
|
+
locale: p,
|
|
1274
|
+
hourFormat: u,
|
|
1275
|
+
timeZone: g,
|
|
1276
|
+
stickyNavigation: b,
|
|
1277
|
+
stickyNavigationOffset: l,
|
|
1278
|
+
stickyNavigationHeight: _,
|
|
1279
|
+
currentTime: T,
|
|
1280
|
+
showCurrentTimeBar: E,
|
|
1281
|
+
currentTimeBarColor: D,
|
|
1282
|
+
forceInlineMultiDay: k
|
|
1283
|
+
} = O(), { startHour: S, endHour: I, step: m, cellRenderer: w, disableGoToDay: x, headRenderer: C, hourRenderer: W } = a, { renderedSlots: R } = Bt(), { headersRef: z, bodyRef: J } = Wt(), re = pe, K = X(e[0]), le = q(e[e.length - 1]), P = De(u), fe = U(() => {
|
|
1284
|
+
const $ = c.length && v === "default", A = Ne(
|
|
1285
|
+
$ ? d : i,
|
|
1286
|
+
e,
|
|
1287
|
+
g,
|
|
1288
|
+
!0,
|
|
1289
|
+
k
|
|
1290
|
+
);
|
|
1291
|
+
return re * A.length + 45;
|
|
1292
|
+
}, [
|
|
1293
|
+
re,
|
|
1294
|
+
e,
|
|
1295
|
+
d,
|
|
1296
|
+
v,
|
|
1297
|
+
i,
|
|
1298
|
+
c.length,
|
|
1299
|
+
g
|
|
1300
|
+
]), V = ($, A, G) => {
|
|
1301
|
+
const oe = ye(K, A);
|
|
1302
|
+
return Ne(
|
|
1303
|
+
$,
|
|
1304
|
+
e,
|
|
1305
|
+
g,
|
|
1306
|
+
void 0,
|
|
1307
|
+
k
|
|
1308
|
+
).filter((B) => me(B.start, K) ? oe : ye(B.start, A)).sort((B, ge) => ge.end.getTime() - B.end.getTime()).map((B) => {
|
|
1309
|
+
var tt;
|
|
1310
|
+
const ge = me(X(B.start), K), xe = Se(q(B.end), le), Vt = ae(ge ? K : B.start, xe ? le : B.end) + 1, Gt = N(A, "yyyy-MM-dd"), jt = G ? G[h.idField] : "all", Pe = (tt = R == null ? void 0 : R[jt]) == null ? void 0 : tt[Gt], Ut = (Pe == null ? void 0 : Pe[B.event_id]) || 0;
|
|
1311
|
+
return /* @__PURE__ */ r(
|
|
1312
|
+
"div",
|
|
1313
|
+
{
|
|
1314
|
+
className: "rs__multi_day",
|
|
1315
|
+
style: {
|
|
1316
|
+
top: Ut * re + 45,
|
|
1317
|
+
width: `${99.9 * Vt}%`,
|
|
1318
|
+
overflowX: "hidden"
|
|
1319
|
+
},
|
|
1320
|
+
children: /* @__PURE__ */ r(He, { event: B, hasPrev: ge, hasNext: xe, multiday: !0 })
|
|
1321
|
+
},
|
|
1322
|
+
B.event_id
|
|
1323
|
+
);
|
|
1324
|
+
});
|
|
1325
|
+
};
|
|
1326
|
+
return /* @__PURE__ */ M(Y, { children: [
|
|
1327
|
+
/* @__PURE__ */ M(
|
|
1328
|
+
be,
|
|
1329
|
+
{
|
|
1330
|
+
days: e.length,
|
|
1331
|
+
ref: z,
|
|
1332
|
+
sticky: "1",
|
|
1333
|
+
stickyNavigation: b,
|
|
1334
|
+
stickyOffset: l,
|
|
1335
|
+
stickyHeight: _,
|
|
1336
|
+
children: [
|
|
1337
|
+
/* @__PURE__ */ r("span", { className: "rs__cell rs__time" }),
|
|
1338
|
+
e.map(($, A) => /* @__PURE__ */ M(
|
|
1339
|
+
"span",
|
|
1340
|
+
{
|
|
1341
|
+
className: `rs__cell rs__header ${_e($) ? "rs__today_cell" : ""}`,
|
|
1342
|
+
style: { height: fe },
|
|
1343
|
+
children: [
|
|
1344
|
+
typeof C == "function" ? /* @__PURE__ */ r("div", { children: C({ day: $, events: i, resource: s }) }) : /* @__PURE__ */ r(
|
|
1345
|
+
Pt,
|
|
1346
|
+
{
|
|
1347
|
+
date: $,
|
|
1348
|
+
onClick: x ? void 0 : f,
|
|
1349
|
+
locale: p
|
|
1350
|
+
}
|
|
1351
|
+
),
|
|
1352
|
+
V(i, $, s)
|
|
1353
|
+
]
|
|
1354
|
+
},
|
|
1355
|
+
A
|
|
1356
|
+
))
|
|
1357
|
+
]
|
|
1358
|
+
}
|
|
1359
|
+
),
|
|
1360
|
+
/* @__PURE__ */ r(be, { days: e.length, ref: J, children: t.map(($, A) => /* @__PURE__ */ M(ie, { children: [
|
|
1361
|
+
/* @__PURE__ */ r("span", { style: { height: n }, className: "rs__cell rs__header rs__time", children: typeof W == "function" ? /* @__PURE__ */ r("div", { children: W(N($, P, { locale: p })) }) : /* @__PURE__ */ r(F, { variant: "caption", children: N($, P, { locale: p }) }) }),
|
|
1362
|
+
e.map((G, oe) => {
|
|
1363
|
+
const H = /* @__PURE__ */ new Date(`${N(G, "yyyy/MM/dd")} ${N($, P)}`), ce = de(H, m), B = h.idField;
|
|
1364
|
+
return /* @__PURE__ */ M("span", { className: `rs__cell ${_e(G) ? "rs__today_cell" : ""}`, children: [
|
|
1365
|
+
A === 0 && /* @__PURE__ */ r(
|
|
1366
|
+
Lt,
|
|
1367
|
+
{
|
|
1368
|
+
todayEvents: Nt(
|
|
1369
|
+
i,
|
|
1370
|
+
G,
|
|
1371
|
+
g,
|
|
1372
|
+
k
|
|
1373
|
+
),
|
|
1374
|
+
today: G,
|
|
1375
|
+
minuteHeight: o,
|
|
1376
|
+
startHour: S,
|
|
1377
|
+
endHour: I,
|
|
1378
|
+
step: m,
|
|
1379
|
+
direction: y,
|
|
1380
|
+
timeZone: g,
|
|
1381
|
+
currentTime: T,
|
|
1382
|
+
showCurrentTimeBar: E,
|
|
1383
|
+
currentTimeBarColor: D
|
|
1384
|
+
}
|
|
1385
|
+
),
|
|
1386
|
+
/* @__PURE__ */ r(
|
|
1387
|
+
Ke,
|
|
1388
|
+
{
|
|
1389
|
+
start: H,
|
|
1390
|
+
end: ce,
|
|
1391
|
+
day: G,
|
|
1392
|
+
height: n,
|
|
1393
|
+
resourceKey: B,
|
|
1394
|
+
resourceVal: s ? s[B] : null,
|
|
1395
|
+
cellRenderer: w
|
|
1396
|
+
}
|
|
1397
|
+
)
|
|
1398
|
+
] }, oe);
|
|
1399
|
+
})
|
|
1400
|
+
] }, A)) })
|
|
1401
|
+
] });
|
|
1402
|
+
}, fr = () => {
|
|
1403
|
+
const {
|
|
1404
|
+
week: e,
|
|
1405
|
+
selectedDate: t,
|
|
1406
|
+
height: n,
|
|
1407
|
+
events: o,
|
|
1408
|
+
getRemoteEvents: i,
|
|
1409
|
+
triggerLoading: s,
|
|
1410
|
+
handleState: a,
|
|
1411
|
+
resources: d,
|
|
1412
|
+
resourceFields: f,
|
|
1413
|
+
fields: c,
|
|
1414
|
+
agenda: h
|
|
1415
|
+
} = O(), { weekStartOn: v, weekDays: y, startHour: p, endHour: u, step: g } = e, b = $e(t, { weekStartsOn: v }), l = y.map((x) => Q(b, x)), _ = X(l[0]), T = q(l[l.length - 1]), E = ke(t, { hours: p, minutes: 0, seconds: 0 }), D = ke(t, { hours: u, minutes: -g, seconds: 0 }), k = vt(
|
|
1416
|
+
{
|
|
1417
|
+
start: E,
|
|
1418
|
+
end: D
|
|
1419
|
+
},
|
|
1420
|
+
{ step: g }
|
|
1421
|
+
), S = Mt(n, k.length), I = St(S, g), m = Z(async () => {
|
|
1422
|
+
try {
|
|
1423
|
+
s(!0);
|
|
1424
|
+
const x = await i({
|
|
1425
|
+
start: _,
|
|
1426
|
+
end: T,
|
|
1427
|
+
view: "week"
|
|
1428
|
+
});
|
|
1429
|
+
Array.isArray(x) && a(x, "events");
|
|
1430
|
+
} catch (x) {
|
|
1431
|
+
throw x;
|
|
1432
|
+
} finally {
|
|
1433
|
+
s(!1);
|
|
1434
|
+
}
|
|
1435
|
+
}, [i]);
|
|
1436
|
+
te(() => {
|
|
1437
|
+
i instanceof Function && m();
|
|
1438
|
+
}, [m, i]);
|
|
1439
|
+
const w = (x) => {
|
|
1440
|
+
let C = o;
|
|
1441
|
+
return x && (C = Ce(o, x, f, c)), h ? /* @__PURE__ */ r(sr, { daysList: l, resource: x, events: C }) : /* @__PURE__ */ r(
|
|
1442
|
+
hr,
|
|
1443
|
+
{
|
|
1444
|
+
resourcedEvents: C,
|
|
1445
|
+
resource: x,
|
|
1446
|
+
hours: k,
|
|
1447
|
+
cellHeight: S,
|
|
1448
|
+
minutesHeight: I,
|
|
1449
|
+
daysList: l
|
|
1450
|
+
}
|
|
1451
|
+
);
|
|
1452
|
+
};
|
|
1453
|
+
return d.length ? /* @__PURE__ */ r(Ye, { renderChildren: w }) : w();
|
|
1454
|
+
}, We = ({ children: e }) => {
|
|
1455
|
+
const { locale: t } = O();
|
|
1456
|
+
return /* @__PURE__ */ r(Nn, { dateAdapter: On, adapterLocale: t, children: e });
|
|
1457
|
+
}, we = ({ type: e, onClick: t, ...n }) => {
|
|
1458
|
+
const { direction: o } = O();
|
|
1459
|
+
let i = ze;
|
|
1460
|
+
return e === "prev" ? i = o === "rtl" ? ze : dt : e === "next" && (i = o === "rtl" ? dt : ze), /* @__PURE__ */ r(
|
|
1461
|
+
ve,
|
|
1462
|
+
{
|
|
1463
|
+
style: { padding: 2 },
|
|
1464
|
+
onClick: t,
|
|
1465
|
+
onDragOver: (s) => {
|
|
1466
|
+
s.preventDefault(), t && t();
|
|
1467
|
+
},
|
|
1468
|
+
...n,
|
|
1469
|
+
children: /* @__PURE__ */ r(i, {})
|
|
1470
|
+
}
|
|
1471
|
+
);
|
|
1472
|
+
}, et = () => {
|
|
1473
|
+
const { selectedDate: e, week: t, navigationPickerProps: n, view: o } = O(), i = n == null ? void 0 : n.minDate, s = n == null ? void 0 : n.maxDate, a = o === "month" ? bt(e) : o === "week" ? wt(e, { weekStartsOn: t == null ? void 0 : t.weekStartOn }) : e, d = o === "month" ? Ze(e) : o === "week" ? $e(e, { weekStartsOn: t == null ? void 0 : t.weekStartOn }) : e, f = i ? d <= i : !1, c = s ? a >= s : !1;
|
|
1474
|
+
return { prevDisabled: f, nextDisabled: c };
|
|
1475
|
+
}, gr = ({ selectedDate: e, onChange: t, weekProps: n }) => {
|
|
1476
|
+
const { locale: o, navigationPickerProps: i } = O(), [s, a] = L(null), { weekStartOn: d } = n, f = $e(e, { weekStartsOn: d }), c = wt(e, { weekStartsOn: d }), { prevDisabled: h, nextDisabled: v } = et(), y = (l) => {
|
|
1477
|
+
a(l.currentTarget);
|
|
1478
|
+
}, p = () => {
|
|
1479
|
+
a(null);
|
|
1480
|
+
}, u = (l) => {
|
|
1481
|
+
t(l || /* @__PURE__ */ new Date()), p();
|
|
1482
|
+
}, g = () => {
|
|
1483
|
+
const l = Q(f, -1);
|
|
1484
|
+
t(l);
|
|
1485
|
+
}, b = () => {
|
|
1486
|
+
const l = Q(c, 1);
|
|
1487
|
+
t(l);
|
|
1488
|
+
};
|
|
1489
|
+
return /* @__PURE__ */ M(Y, { children: [
|
|
1490
|
+
/* @__PURE__ */ r(
|
|
1491
|
+
we,
|
|
1492
|
+
{
|
|
1493
|
+
type: "prev",
|
|
1494
|
+
onClick: g,
|
|
1495
|
+
disabled: h,
|
|
1496
|
+
"aria-label": "previous week"
|
|
1497
|
+
}
|
|
1498
|
+
),
|
|
1499
|
+
/* @__PURE__ */ r(ee, { style: { padding: 4 }, onClick: y, "aria-label": "selected week", children: `${N(f, "dd", { locale: o })} - ${N(c, "dd MMM yyyy", {
|
|
1500
|
+
locale: o
|
|
1501
|
+
})}` }),
|
|
1502
|
+
/* @__PURE__ */ r(
|
|
1503
|
+
Te,
|
|
1504
|
+
{
|
|
1505
|
+
open: !!s,
|
|
1506
|
+
anchorEl: s,
|
|
1507
|
+
onClose: p,
|
|
1508
|
+
anchorOrigin: {
|
|
1509
|
+
vertical: "bottom",
|
|
1510
|
+
horizontal: "left"
|
|
1511
|
+
},
|
|
1512
|
+
children: /* @__PURE__ */ r(We, { children: /* @__PURE__ */ r(
|
|
1513
|
+
Xe,
|
|
1514
|
+
{
|
|
1515
|
+
...i,
|
|
1516
|
+
openTo: "day",
|
|
1517
|
+
views: ["month", "day"],
|
|
1518
|
+
value: e,
|
|
1519
|
+
onChange: u
|
|
1520
|
+
}
|
|
1521
|
+
) })
|
|
1522
|
+
}
|
|
1523
|
+
),
|
|
1524
|
+
/* @__PURE__ */ r(
|
|
1525
|
+
we,
|
|
1526
|
+
{
|
|
1527
|
+
type: "next",
|
|
1528
|
+
onClick: b,
|
|
1529
|
+
disabled: v,
|
|
1530
|
+
"aria-label": "next week"
|
|
1531
|
+
}
|
|
1532
|
+
)
|
|
1533
|
+
] });
|
|
1534
|
+
}, pr = ({ selectedDate: e, onChange: t }) => {
|
|
1535
|
+
const { locale: n, navigationPickerProps: o } = O(), [i, s] = L(null), { prevDisabled: a, nextDisabled: d } = et(), f = (p) => {
|
|
1536
|
+
s(p.currentTarget);
|
|
1537
|
+
}, c = () => {
|
|
1538
|
+
s(null);
|
|
1539
|
+
}, h = (p) => {
|
|
1540
|
+
t(p || /* @__PURE__ */ new Date()), c();
|
|
1541
|
+
}, v = () => {
|
|
1542
|
+
const p = Q(e, -1);
|
|
1543
|
+
t(p);
|
|
1544
|
+
}, y = () => {
|
|
1545
|
+
const p = Q(e, 1);
|
|
1546
|
+
t(p);
|
|
1547
|
+
};
|
|
1548
|
+
return /* @__PURE__ */ M(Y, { children: [
|
|
1549
|
+
/* @__PURE__ */ r(
|
|
1550
|
+
we,
|
|
1551
|
+
{
|
|
1552
|
+
type: "prev",
|
|
1553
|
+
onClick: v,
|
|
1554
|
+
disabled: a,
|
|
1555
|
+
"aria-label": "previous day"
|
|
1556
|
+
}
|
|
1557
|
+
),
|
|
1558
|
+
/* @__PURE__ */ r(ee, { style: { padding: 4 }, onClick: f, "aria-label": "selected date", children: N(e, "dd MMMM yyyy", { locale: n }) }),
|
|
1559
|
+
/* @__PURE__ */ r(
|
|
1560
|
+
Te,
|
|
1561
|
+
{
|
|
1562
|
+
open: !!i,
|
|
1563
|
+
anchorEl: i,
|
|
1564
|
+
onClose: c,
|
|
1565
|
+
anchorOrigin: {
|
|
1566
|
+
vertical: "bottom",
|
|
1567
|
+
horizontal: "left"
|
|
1568
|
+
},
|
|
1569
|
+
children: /* @__PURE__ */ r(We, { children: /* @__PURE__ */ r(
|
|
1570
|
+
Xe,
|
|
1571
|
+
{
|
|
1572
|
+
...o,
|
|
1573
|
+
openTo: "day",
|
|
1574
|
+
views: ["month", "day"],
|
|
1575
|
+
value: e,
|
|
1576
|
+
onChange: h
|
|
1577
|
+
}
|
|
1578
|
+
) })
|
|
1579
|
+
}
|
|
1580
|
+
),
|
|
1581
|
+
/* @__PURE__ */ r(we, { type: "next", onClick: y, disabled: d, "aria-label": "next day" })
|
|
1582
|
+
] });
|
|
1583
|
+
}, yr = ({ selectedDate: e, onChange: t }) => {
|
|
1584
|
+
const { locale: n, navigationPickerProps: o } = O(), i = Qt(e), [s, a] = L(null), { prevDisabled: d, nextDisabled: f } = et(), c = (u) => {
|
|
1585
|
+
a(u.currentTarget);
|
|
1586
|
+
}, h = () => {
|
|
1587
|
+
a(null);
|
|
1588
|
+
}, v = (u) => {
|
|
1589
|
+
t(u || /* @__PURE__ */ new Date()), h();
|
|
1590
|
+
}, y = () => {
|
|
1591
|
+
const u = i - 1;
|
|
1592
|
+
t(rt(e, u));
|
|
1593
|
+
}, p = () => {
|
|
1594
|
+
const u = i + 1;
|
|
1595
|
+
t(rt(e, u));
|
|
1596
|
+
};
|
|
1597
|
+
return /* @__PURE__ */ M(Y, { children: [
|
|
1598
|
+
/* @__PURE__ */ r(
|
|
1599
|
+
we,
|
|
1600
|
+
{
|
|
1601
|
+
type: "prev",
|
|
1602
|
+
onClick: y,
|
|
1603
|
+
disabled: d,
|
|
1604
|
+
"aria-label": "previous month"
|
|
1605
|
+
}
|
|
1606
|
+
),
|
|
1607
|
+
/* @__PURE__ */ r(ee, { style: { padding: 4 }, onClick: c, "aria-label": "selected month", children: N(e, "MMMM yyyy", { locale: n }) }),
|
|
1608
|
+
/* @__PURE__ */ r(
|
|
1609
|
+
Te,
|
|
1610
|
+
{
|
|
1611
|
+
open: !!s,
|
|
1612
|
+
anchorEl: s,
|
|
1613
|
+
onClose: h,
|
|
1614
|
+
anchorOrigin: {
|
|
1615
|
+
vertical: "bottom",
|
|
1616
|
+
horizontal: "left"
|
|
1617
|
+
},
|
|
1618
|
+
children: /* @__PURE__ */ r(We, { children: /* @__PURE__ */ r(
|
|
1619
|
+
Xe,
|
|
1620
|
+
{
|
|
1621
|
+
...o,
|
|
1622
|
+
openTo: "month",
|
|
1623
|
+
views: ["year", "month"],
|
|
1624
|
+
value: e,
|
|
1625
|
+
onChange: v
|
|
1626
|
+
}
|
|
1627
|
+
) })
|
|
1628
|
+
}
|
|
1629
|
+
),
|
|
1630
|
+
/* @__PURE__ */ r(
|
|
1631
|
+
we,
|
|
1632
|
+
{
|
|
1633
|
+
type: "next",
|
|
1634
|
+
onClick: p,
|
|
1635
|
+
disabled: f,
|
|
1636
|
+
"aria-label": "next month"
|
|
1637
|
+
}
|
|
1638
|
+
)
|
|
1639
|
+
] });
|
|
1640
|
+
}, mr = () => {
|
|
1641
|
+
const {
|
|
1642
|
+
selectedDate: e,
|
|
1643
|
+
view: t,
|
|
1644
|
+
week: n,
|
|
1645
|
+
handleState: o,
|
|
1646
|
+
getViews: i,
|
|
1647
|
+
translations: s,
|
|
1648
|
+
navigation: a,
|
|
1649
|
+
day: d,
|
|
1650
|
+
month: f,
|
|
1651
|
+
disableViewNavigator: c,
|
|
1652
|
+
onSelectedDateChange: h,
|
|
1653
|
+
onViewChange: v,
|
|
1654
|
+
stickyNavigation: y,
|
|
1655
|
+
timeZone: p,
|
|
1656
|
+
agenda: u,
|
|
1657
|
+
toggleAgenda: g,
|
|
1658
|
+
enableAgenda: b,
|
|
1659
|
+
customHeaderContent: l,
|
|
1660
|
+
stickyNavigationOffset: _
|
|
1661
|
+
} = O(), [T, E] = L(null), D = ne(), k = Ct(D.breakpoints.up("sm")), S = i(), I = (C) => {
|
|
1662
|
+
E(C || null);
|
|
1663
|
+
}, m = (C) => {
|
|
1664
|
+
o(C, "selectedDate"), h && typeof h == "function" && h(C);
|
|
1665
|
+
}, w = (C) => {
|
|
1666
|
+
o(C, "view"), v && typeof v == "function" && v(C, u);
|
|
1667
|
+
}, x = () => {
|
|
1668
|
+
switch (t) {
|
|
1669
|
+
case "month":
|
|
1670
|
+
return (f == null ? void 0 : f.navigation) && /* @__PURE__ */ r(yr, { selectedDate: e, onChange: m });
|
|
1671
|
+
case "week":
|
|
1672
|
+
return (n == null ? void 0 : n.navigation) && /* @__PURE__ */ r(
|
|
1673
|
+
gr,
|
|
1674
|
+
{
|
|
1675
|
+
selectedDate: e,
|
|
1676
|
+
onChange: m,
|
|
1677
|
+
weekProps: n
|
|
1678
|
+
}
|
|
1679
|
+
);
|
|
1680
|
+
case "day":
|
|
1681
|
+
return (d == null ? void 0 : d.navigation) && /* @__PURE__ */ r(pr, { selectedDate: e, onChange: m });
|
|
1682
|
+
default:
|
|
1683
|
+
return "";
|
|
1684
|
+
}
|
|
1685
|
+
};
|
|
1686
|
+
return !a && c ? null : /* @__PURE__ */ M(nr, { sticky: y ? "1" : "0", offset: _, children: [
|
|
1687
|
+
/* @__PURE__ */ r("div", { "data-testid": "date-navigator", children: a && x() }),
|
|
1688
|
+
l && /* @__PURE__ */ r("div", { className: "rs__custom_header_content", children: l() }),
|
|
1689
|
+
/* @__PURE__ */ M(
|
|
1690
|
+
"div",
|
|
1691
|
+
{
|
|
1692
|
+
className: "rs__view_navigator",
|
|
1693
|
+
"data-testid": "view-navigator",
|
|
1694
|
+
style: {
|
|
1695
|
+
visibility: c ? "hidden" : "visible"
|
|
1696
|
+
},
|
|
1697
|
+
children: [
|
|
1698
|
+
/* @__PURE__ */ r(
|
|
1699
|
+
ee,
|
|
1700
|
+
{
|
|
1701
|
+
onClick: () => m(ue(/* @__PURE__ */ new Date(), p)),
|
|
1702
|
+
"aria-label": s.navigation.today,
|
|
1703
|
+
children: s.navigation.today
|
|
1704
|
+
}
|
|
1705
|
+
),
|
|
1706
|
+
b && (k ? /* @__PURE__ */ r(
|
|
1707
|
+
ee,
|
|
1708
|
+
{
|
|
1709
|
+
color: u ? "primary" : "inherit",
|
|
1710
|
+
onClick: g,
|
|
1711
|
+
"aria-label": s.navigation.agenda,
|
|
1712
|
+
children: s.navigation.agenda
|
|
1713
|
+
}
|
|
1714
|
+
) : /* @__PURE__ */ r(
|
|
1715
|
+
ve,
|
|
1716
|
+
{
|
|
1717
|
+
color: u ? "primary" : "default",
|
|
1718
|
+
style: { padding: 5 },
|
|
1719
|
+
onClick: g,
|
|
1720
|
+
children: /* @__PURE__ */ r($n, {})
|
|
1721
|
+
}
|
|
1722
|
+
)),
|
|
1723
|
+
S.length > 1 && (k ? S.map((C) => /* @__PURE__ */ r(
|
|
1724
|
+
ee,
|
|
1725
|
+
{
|
|
1726
|
+
color: C === t ? "primary" : "inherit",
|
|
1727
|
+
onClick: () => w(C),
|
|
1728
|
+
onDragOver: (W) => {
|
|
1729
|
+
W.preventDefault(), w(C);
|
|
1730
|
+
},
|
|
1731
|
+
children: s.navigation[C]
|
|
1732
|
+
},
|
|
1733
|
+
C
|
|
1734
|
+
)) : /* @__PURE__ */ M(ie, { children: [
|
|
1735
|
+
/* @__PURE__ */ r(
|
|
1736
|
+
ve,
|
|
1737
|
+
{
|
|
1738
|
+
style: { padding: 5 },
|
|
1739
|
+
onClick: (C) => {
|
|
1740
|
+
I(C.currentTarget);
|
|
1741
|
+
},
|
|
1742
|
+
children: /* @__PURE__ */ r(Fn, {})
|
|
1743
|
+
}
|
|
1744
|
+
),
|
|
1745
|
+
/* @__PURE__ */ r(
|
|
1746
|
+
Te,
|
|
1747
|
+
{
|
|
1748
|
+
open: !!T,
|
|
1749
|
+
anchorEl: T,
|
|
1750
|
+
onClose: () => {
|
|
1751
|
+
I();
|
|
1752
|
+
},
|
|
1753
|
+
anchorOrigin: {
|
|
1754
|
+
vertical: "center",
|
|
1755
|
+
horizontal: "center"
|
|
1756
|
+
},
|
|
1757
|
+
transformOrigin: {
|
|
1758
|
+
vertical: "top",
|
|
1759
|
+
horizontal: "center"
|
|
1760
|
+
},
|
|
1761
|
+
children: /* @__PURE__ */ r(hn, { autoFocusItem: !!T, disablePadding: !0, children: S.map((C) => /* @__PURE__ */ r(
|
|
1762
|
+
Le,
|
|
1763
|
+
{
|
|
1764
|
+
selected: C === t,
|
|
1765
|
+
onClick: () => {
|
|
1766
|
+
I(), w(C);
|
|
1767
|
+
},
|
|
1768
|
+
children: s.navigation[C]
|
|
1769
|
+
},
|
|
1770
|
+
C
|
|
1771
|
+
)) })
|
|
1772
|
+
}
|
|
1773
|
+
)
|
|
1774
|
+
] }))
|
|
1775
|
+
]
|
|
1776
|
+
}
|
|
1777
|
+
)
|
|
1778
|
+
] });
|
|
1779
|
+
}, _r = ({
|
|
1780
|
+
type: e = "datetime",
|
|
1781
|
+
value: t,
|
|
1782
|
+
label: n,
|
|
1783
|
+
name: o,
|
|
1784
|
+
onChange: i,
|
|
1785
|
+
variant: s = "outlined",
|
|
1786
|
+
error: a,
|
|
1787
|
+
errMsg: d,
|
|
1788
|
+
touched: f,
|
|
1789
|
+
required: c
|
|
1790
|
+
}) => {
|
|
1791
|
+
var b, l;
|
|
1792
|
+
const { translations: h } = O(), [v, y] = L({
|
|
1793
|
+
touched: !1,
|
|
1794
|
+
valid: !!t,
|
|
1795
|
+
errorMsg: d || (c ? ((b = h == null ? void 0 : h.validation) == null ? void 0 : b.required) || "Required" : void 0)
|
|
1796
|
+
}), p = e === "date" ? An : Rn, u = v.touched && (a || !v.valid), g = Z(
|
|
1797
|
+
(_) => {
|
|
1798
|
+
var S;
|
|
1799
|
+
const T = !isNaN(Date.parse(_)), E = typeof _ == "string" && T ? new Date(_) : _;
|
|
1800
|
+
let D = !0, k = d;
|
|
1801
|
+
c && !E && (D = !1, k = d || ((S = h == null ? void 0 : h.validation) == null ? void 0 : S.required) || "Required"), y((I) => ({ ...I, touched: !0, valid: D, errorMsg: k })), i(o, E);
|
|
1802
|
+
},
|
|
1803
|
+
[d, o, i, c, (l = h == null ? void 0 : h.validation) == null ? void 0 : l.required]
|
|
1804
|
+
);
|
|
1805
|
+
return te(() => {
|
|
1806
|
+
f && g(t);
|
|
1807
|
+
}, [g, f, t]), /* @__PURE__ */ r(We, { children: /* @__PURE__ */ r(
|
|
1808
|
+
p,
|
|
1809
|
+
{
|
|
1810
|
+
value: t instanceof Date ? t : new Date(t),
|
|
1811
|
+
label: n,
|
|
1812
|
+
onChange: (_) => {
|
|
1813
|
+
g(_);
|
|
1814
|
+
},
|
|
1815
|
+
minutesStep: 5,
|
|
1816
|
+
slotProps: {
|
|
1817
|
+
textField: {
|
|
1818
|
+
variant: s,
|
|
1819
|
+
helperText: u && v.errorMsg,
|
|
1820
|
+
error: u,
|
|
1821
|
+
fullWidth: !0
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
) });
|
|
1826
|
+
}, vr = ({
|
|
1827
|
+
variant: e = "outlined",
|
|
1828
|
+
label: t,
|
|
1829
|
+
placeholder: n,
|
|
1830
|
+
value: o,
|
|
1831
|
+
name: i,
|
|
1832
|
+
required: s,
|
|
1833
|
+
min: a,
|
|
1834
|
+
max: d,
|
|
1835
|
+
email: f,
|
|
1836
|
+
decimal: c,
|
|
1837
|
+
onChange: h,
|
|
1838
|
+
disabled: v,
|
|
1839
|
+
multiline: y,
|
|
1840
|
+
rows: p,
|
|
1841
|
+
touched: u
|
|
1842
|
+
}) => {
|
|
1843
|
+
const [g, b] = L({
|
|
1844
|
+
touched: !1,
|
|
1845
|
+
valid: !1,
|
|
1846
|
+
errorMsg: ""
|
|
1847
|
+
}), { translations: l } = O(), _ = Z(
|
|
1848
|
+
(T) => {
|
|
1849
|
+
var S, I, m, w, x, C, W, R, z;
|
|
1850
|
+
const E = T;
|
|
1851
|
+
let D = !0, k = "";
|
|
1852
|
+
f && (D = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(E) && D, k = ((S = l == null ? void 0 : l.validation) == null ? void 0 : S.invalidEmail) || "Invalid Email"), c && (D = /^[0-9]+(\.[0-9]*)?$/.test(E) && D, k = ((I = l == null ? void 0 : l.validation) == null ? void 0 : I.onlyNumbers) || "Only Numbers Allowed"), a && `${E}`.trim().length < a && (D = !1, k = typeof ((m = l == null ? void 0 : l.validation) == null ? void 0 : m.min) == "function" ? (w = l == null ? void 0 : l.validation) == null ? void 0 : w.min(a) : ((x = l == null ? void 0 : l.validation) == null ? void 0 : x.min) || `Minimum ${a} letters`), d && `${E}`.trim().length > d && (D = !1, k = typeof ((C = l == null ? void 0 : l.validation) == null ? void 0 : C.max) == "function" ? (W = l == null ? void 0 : l.validation) == null ? void 0 : W.max(d) : ((R = l == null ? void 0 : l.validation) == null ? void 0 : R.max) || `Maximum ${d} letters`), s && `${E}`.trim().length <= 0 && (D = !1, k = ((z = l == null ? void 0 : l.validation) == null ? void 0 : z.required) || "Required"), b({ touched: !0, valid: D, errorMsg: k }), h(i, E, D);
|
|
1853
|
+
},
|
|
1854
|
+
[c, f, d, a, i, h, s, l == null ? void 0 : l.validation]
|
|
1855
|
+
);
|
|
1856
|
+
return te(() => {
|
|
1857
|
+
u && _(o);
|
|
1858
|
+
}, [_, u, o]), /* @__PURE__ */ r(
|
|
1859
|
+
fn,
|
|
1860
|
+
{
|
|
1861
|
+
variant: e,
|
|
1862
|
+
label: t && /* @__PURE__ */ r(F, { variant: "body2", children: `${t} ${s ? "*" : ""}` }),
|
|
1863
|
+
value: o,
|
|
1864
|
+
name: i,
|
|
1865
|
+
onChange: (T) => _(T.target.value),
|
|
1866
|
+
disabled: v,
|
|
1867
|
+
error: g.touched && !g.valid,
|
|
1868
|
+
helperText: g.touched && !g.valid && g.errorMsg,
|
|
1869
|
+
multiline: y,
|
|
1870
|
+
rows: p,
|
|
1871
|
+
style: { width: "100%" },
|
|
1872
|
+
InputProps: {
|
|
1873
|
+
placeholder: n || ""
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
);
|
|
1877
|
+
}, br = ({
|
|
1878
|
+
options: e,
|
|
1879
|
+
value: t,
|
|
1880
|
+
name: n,
|
|
1881
|
+
required: o,
|
|
1882
|
+
onChange: i,
|
|
1883
|
+
label: s,
|
|
1884
|
+
disabled: a,
|
|
1885
|
+
touched: d,
|
|
1886
|
+
variant: f = "outlined",
|
|
1887
|
+
loading: c,
|
|
1888
|
+
multiple: h,
|
|
1889
|
+
placeholder: v,
|
|
1890
|
+
errMsg: y
|
|
1891
|
+
}) => {
|
|
1892
|
+
var T, E;
|
|
1893
|
+
const p = ne(), { translations: u } = O(), [g, b] = L({
|
|
1894
|
+
touched: !1,
|
|
1895
|
+
valid: !!t,
|
|
1896
|
+
errorMsg: y || (o ? ((T = u == null ? void 0 : u.validation) == null ? void 0 : T.required) || "Required" : void 0)
|
|
1897
|
+
}), l = Z(() => {
|
|
1898
|
+
g.touched || b((D) => ({ ...D, touched: !0, errorMsg: y || D.errorMsg }));
|
|
1899
|
+
}, [y, g.touched]), _ = Z(
|
|
1900
|
+
(D) => {
|
|
1901
|
+
var m;
|
|
1902
|
+
const k = D;
|
|
1903
|
+
let S = !0, I = y;
|
|
1904
|
+
o && (h ? !k.length : !k) && (S = !1, I = y || ((m = u == null ? void 0 : u.validation) == null ? void 0 : m.required) || "Required"), b((w) => ({ ...w, touched: !0, valid: S, errorMsg: I })), i(n, k, S);
|
|
1905
|
+
},
|
|
1906
|
+
[y, h, n, i, o, (E = u == null ? void 0 : u.validation) == null ? void 0 : E.required]
|
|
1907
|
+
);
|
|
1908
|
+
return te(() => {
|
|
1909
|
+
d && _(t);
|
|
1910
|
+
}, [_, d, t]), /* @__PURE__ */ M(Y, { children: [
|
|
1911
|
+
/* @__PURE__ */ M(
|
|
1912
|
+
gn,
|
|
1913
|
+
{
|
|
1914
|
+
variant: f || "outlined",
|
|
1915
|
+
fullWidth: !0,
|
|
1916
|
+
error: o && g.touched && !g.valid,
|
|
1917
|
+
disabled: a,
|
|
1918
|
+
children: [
|
|
1919
|
+
s && /* @__PURE__ */ r(pn, { id: `input_${n}`, children: /* @__PURE__ */ r(F, { variant: "body2", children: `${s} ${o ? "*" : ""}` }) }),
|
|
1920
|
+
/* @__PURE__ */ M(
|
|
1921
|
+
yn,
|
|
1922
|
+
{
|
|
1923
|
+
label: s,
|
|
1924
|
+
labelId: `input_${n}`,
|
|
1925
|
+
value: t,
|
|
1926
|
+
onBlur: l,
|
|
1927
|
+
onChange: (D) => _(D.target.value),
|
|
1928
|
+
IconComponent: c ? () => /* @__PURE__ */ r(Et, { size: 5 }) : Hn,
|
|
1929
|
+
multiple: !!h,
|
|
1930
|
+
classes: {
|
|
1931
|
+
select: h === "chips" ? "flex__wrap" : void 0
|
|
1932
|
+
},
|
|
1933
|
+
renderValue: (D) => {
|
|
1934
|
+
if (!D || D.length === 0)
|
|
1935
|
+
return /* @__PURE__ */ r("em", { children: s });
|
|
1936
|
+
const k = [];
|
|
1937
|
+
if (h) {
|
|
1938
|
+
for (const S of e)
|
|
1939
|
+
D.includes(S.value) && k.push([S.text]);
|
|
1940
|
+
return h === "chips" ? k.map((S, I) => /* @__PURE__ */ r(_n, { label: S, style: { margin: "0 2px" }, color: "primary" }, `${S}_${I}`)) : k.join(",");
|
|
1941
|
+
} else {
|
|
1942
|
+
for (const S of e)
|
|
1943
|
+
D === S.value && k.push([S.text]);
|
|
1944
|
+
return k.join(",");
|
|
1945
|
+
}
|
|
1946
|
+
},
|
|
1947
|
+
children: [
|
|
1948
|
+
v && /* @__PURE__ */ r(Le, { value: "", children: /* @__PURE__ */ r("em", { children: v }) }),
|
|
1949
|
+
e.map((D) => /* @__PURE__ */ M(Le, { value: D.value, children: [
|
|
1950
|
+
h && /* @__PURE__ */ r(mn, { checked: t.indexOf(D.value) > -1, color: "primary" }),
|
|
1951
|
+
D.text
|
|
1952
|
+
] }, D.id || D.value))
|
|
1953
|
+
]
|
|
1954
|
+
}
|
|
1955
|
+
)
|
|
1956
|
+
]
|
|
1957
|
+
}
|
|
1958
|
+
),
|
|
1959
|
+
/* @__PURE__ */ r(vn, { style: { color: p.palette.error.main }, children: g.touched && !g.valid && g.errorMsg })
|
|
1960
|
+
] });
|
|
1961
|
+
}, ht = (e, t) => {
|
|
1962
|
+
var o;
|
|
1963
|
+
const n = {};
|
|
1964
|
+
for (const i of e) {
|
|
1965
|
+
const s = Ve(i, i.default, t), a = Ve(i, t == null ? void 0 : t[i.name], t);
|
|
1966
|
+
n[i.name] = {
|
|
1967
|
+
value: a.value || s.value || "",
|
|
1968
|
+
validity: (o = i.config) != null && o.required ? !!a.validity || !!s.validity : !0,
|
|
1969
|
+
type: i.type,
|
|
1970
|
+
config: i.config
|
|
1971
|
+
};
|
|
1972
|
+
}
|
|
1973
|
+
return {
|
|
1974
|
+
event_id: {
|
|
1975
|
+
value: (t == null ? void 0 : t.event_id) || null,
|
|
1976
|
+
validity: !0,
|
|
1977
|
+
type: "hidden"
|
|
1978
|
+
},
|
|
1979
|
+
title: {
|
|
1980
|
+
value: (t == null ? void 0 : t.title) || "",
|
|
1981
|
+
validity: !!(t != null && t.title),
|
|
1982
|
+
type: "input",
|
|
1983
|
+
config: { label: "Title", required: !0, min: 3 }
|
|
1984
|
+
},
|
|
1985
|
+
subtitle: {
|
|
1986
|
+
value: (t == null ? void 0 : t.subtitle) || "",
|
|
1987
|
+
validity: !0,
|
|
1988
|
+
type: "input",
|
|
1989
|
+
config: { label: "Subtitle", required: !1 }
|
|
1990
|
+
},
|
|
1991
|
+
start: {
|
|
1992
|
+
value: (t == null ? void 0 : t._originalStart) || (t == null ? void 0 : t.start) || /* @__PURE__ */ new Date(),
|
|
1993
|
+
validity: !0,
|
|
1994
|
+
type: "date",
|
|
1995
|
+
config: { label: "Start", sm: 6 }
|
|
1996
|
+
},
|
|
1997
|
+
end: {
|
|
1998
|
+
value: (t == null ? void 0 : t._originalEnd) || (t == null ? void 0 : t.end) || /* @__PURE__ */ new Date(),
|
|
1999
|
+
validity: !0,
|
|
2000
|
+
type: "date",
|
|
2001
|
+
config: { label: "End", sm: 6 }
|
|
2002
|
+
},
|
|
2003
|
+
...n
|
|
2004
|
+
};
|
|
2005
|
+
}, wr = () => {
|
|
2006
|
+
const {
|
|
2007
|
+
fields: e,
|
|
2008
|
+
dialog: t,
|
|
2009
|
+
triggerDialog: n,
|
|
2010
|
+
selectedRange: o,
|
|
2011
|
+
selectedEvent: i,
|
|
2012
|
+
resourceFields: s,
|
|
2013
|
+
selectedResource: a,
|
|
2014
|
+
triggerLoading: d,
|
|
2015
|
+
onConfirm: f,
|
|
2016
|
+
customEditor: c,
|
|
2017
|
+
confirmEvent: h,
|
|
2018
|
+
dialogMaxWidth: v,
|
|
2019
|
+
translations: y,
|
|
2020
|
+
timeZone: p
|
|
2021
|
+
} = O(), [u, g] = L(ht(e, i || o)), [b, l] = L(!1), _ = ne(), T = Ct(_.breakpoints.down("sm")), E = (m, w, x) => {
|
|
2022
|
+
g((C) => ({
|
|
2023
|
+
...C,
|
|
2024
|
+
[m]: { ...C[m], value: w, validity: x }
|
|
2025
|
+
}));
|
|
2026
|
+
}, D = (m) => {
|
|
2027
|
+
m && g(ht(e)), n(!1);
|
|
2028
|
+
}, k = async () => {
|
|
2029
|
+
let m = {};
|
|
2030
|
+
for (const w in u)
|
|
2031
|
+
if (m[w] = u[w].value, !c && !u[w].validity)
|
|
2032
|
+
return l(!0);
|
|
2033
|
+
try {
|
|
2034
|
+
d(!0), m.end = m.start >= m.end ? de(m.start, Fe(o == null ? void 0 : o.end, o == null ? void 0 : o.start)) : m.end;
|
|
2035
|
+
const w = i != null && i.event_id ? "edit" : "create";
|
|
2036
|
+
f ? m = await f(m, w) : m.event_id = (i == null ? void 0 : i.event_id) || Date.now().toString(36) + Math.random().toString(36).slice(2), m.start = Ge(m.start, p), m.end = Ge(m.end, p), h(m, w), D(!0);
|
|
2037
|
+
} catch (w) {
|
|
2038
|
+
console.error(w);
|
|
2039
|
+
} finally {
|
|
2040
|
+
d(!1);
|
|
2041
|
+
}
|
|
2042
|
+
}, S = (m) => {
|
|
2043
|
+
var x, C, W;
|
|
2044
|
+
const w = u[m];
|
|
2045
|
+
switch (w.type) {
|
|
2046
|
+
case "input":
|
|
2047
|
+
return /* @__PURE__ */ r(
|
|
2048
|
+
vr,
|
|
2049
|
+
{
|
|
2050
|
+
value: w.value,
|
|
2051
|
+
name: m,
|
|
2052
|
+
onChange: E,
|
|
2053
|
+
touched: b,
|
|
2054
|
+
...w.config,
|
|
2055
|
+
label: y.event[m] || ((x = w.config) == null ? void 0 : x.label)
|
|
2056
|
+
}
|
|
2057
|
+
);
|
|
2058
|
+
case "date":
|
|
2059
|
+
return /* @__PURE__ */ r(
|
|
2060
|
+
_r,
|
|
2061
|
+
{
|
|
2062
|
+
value: w.value,
|
|
2063
|
+
name: m,
|
|
2064
|
+
onChange: (...z) => E(...z, !0),
|
|
2065
|
+
touched: b,
|
|
2066
|
+
...w.config,
|
|
2067
|
+
label: y.event[m] || ((C = w.config) == null ? void 0 : C.label)
|
|
2068
|
+
}
|
|
2069
|
+
);
|
|
2070
|
+
case "select":
|
|
2071
|
+
const R = e.find((z) => z.name === m);
|
|
2072
|
+
return /* @__PURE__ */ r(
|
|
2073
|
+
br,
|
|
2074
|
+
{
|
|
2075
|
+
value: w.value,
|
|
2076
|
+
name: m,
|
|
2077
|
+
options: (R == null ? void 0 : R.options) || [],
|
|
2078
|
+
onChange: E,
|
|
2079
|
+
touched: b,
|
|
2080
|
+
...w.config,
|
|
2081
|
+
label: y.event[m] || ((W = w.config) == null ? void 0 : W.label)
|
|
2082
|
+
}
|
|
2083
|
+
);
|
|
2084
|
+
default:
|
|
2085
|
+
return "";
|
|
2086
|
+
}
|
|
2087
|
+
};
|
|
2088
|
+
return /* @__PURE__ */ r(
|
|
2089
|
+
bn,
|
|
2090
|
+
{
|
|
2091
|
+
open: t,
|
|
2092
|
+
fullScreen: T,
|
|
2093
|
+
maxWidth: v,
|
|
2094
|
+
onClose: () => {
|
|
2095
|
+
n(!1);
|
|
2096
|
+
},
|
|
2097
|
+
children: (() => {
|
|
2098
|
+
if (c) {
|
|
2099
|
+
const m = {
|
|
2100
|
+
state: u,
|
|
2101
|
+
close: () => n(!1),
|
|
2102
|
+
loading: (w) => d(w),
|
|
2103
|
+
edited: i,
|
|
2104
|
+
onConfirm: h,
|
|
2105
|
+
[s.idField]: a
|
|
2106
|
+
};
|
|
2107
|
+
return c(m);
|
|
2108
|
+
}
|
|
2109
|
+
return /* @__PURE__ */ M(ie, { children: [
|
|
2110
|
+
/* @__PURE__ */ r(wn, { children: i ? y.form.editTitle : y.form.addTitle }),
|
|
2111
|
+
/* @__PURE__ */ r(Dn, { style: { overflowX: "hidden" }, children: /* @__PURE__ */ r(at, { container: !0, spacing: 2, children: Object.keys(u).map((m) => {
|
|
2112
|
+
var x;
|
|
2113
|
+
const w = u[m];
|
|
2114
|
+
return /* @__PURE__ */ r(at, { size: { sm: (x = w.config) == null ? void 0 : x.sm, xs: 12 }, children: S(m) }, m);
|
|
2115
|
+
}) }) }),
|
|
2116
|
+
/* @__PURE__ */ M(xn, { children: [
|
|
2117
|
+
/* @__PURE__ */ r(ee, { color: "inherit", fullWidth: !0, onClick: () => D(), children: y.form.cancel }),
|
|
2118
|
+
/* @__PURE__ */ r(ee, { color: "primary", fullWidth: !0, onClick: k, children: y.form.confirm })
|
|
2119
|
+
] })
|
|
2120
|
+
] });
|
|
2121
|
+
})()
|
|
2122
|
+
}
|
|
2123
|
+
);
|
|
2124
|
+
}, Dr = ({ events: e, resource: t }) => {
|
|
2125
|
+
const {
|
|
2126
|
+
month: n,
|
|
2127
|
+
handleGotoDay: o,
|
|
2128
|
+
locale: i,
|
|
2129
|
+
timeZone: s,
|
|
2130
|
+
selectedDate: a,
|
|
2131
|
+
translations: d,
|
|
2132
|
+
alwaysShowAgendaDays: f,
|
|
2133
|
+
stickyNavigationOffset: c,
|
|
2134
|
+
stickyNavigationHeight: h
|
|
2135
|
+
} = O(), { disableGoToDay: v, headRenderer: y } = n, p = Jt(a), u = Array.from({ length: p }, (b, l) => l + 1), g = U(() => e.filter((b) => Dt(b.start, a)), [e, a]);
|
|
2136
|
+
return !f && !g.length ? /* @__PURE__ */ r(Je, {}) : /* @__PURE__ */ r(Re, { stickyOffset: c, stickyHeight: h, children: u.map((b) => {
|
|
2137
|
+
const l = new Date(a.getFullYear(), a.getMonth(), b), _ = he({ dateLeft: l, timeZone: s }), T = Ie(e, l);
|
|
2138
|
+
return !f && !T.length ? null : /* @__PURE__ */ M("div", { className: `rs__agenda_row ${_e(l) ? "rs__today_cell" : ""}`, children: [
|
|
2139
|
+
/* @__PURE__ */ r("div", { className: "rs__cell rs__agenda__cell", children: typeof y == "function" ? /* @__PURE__ */ r("div", { children: y({ day: l, events: e, resource: t }) }) : /* @__PURE__ */ r(
|
|
2140
|
+
F,
|
|
2141
|
+
{
|
|
2142
|
+
sx: { fontWeight: _ ? "bold" : "inherit" },
|
|
2143
|
+
color: _ ? "primary" : "inherit",
|
|
2144
|
+
variant: "body2",
|
|
2145
|
+
className: v ? "" : "rs__hover__op",
|
|
2146
|
+
onClick: (E) => {
|
|
2147
|
+
E.stopPropagation(), v || o(l);
|
|
2148
|
+
},
|
|
2149
|
+
children: N(l, "dd E", { locale: i })
|
|
2150
|
+
}
|
|
2151
|
+
) }),
|
|
2152
|
+
/* @__PURE__ */ r("div", { className: "rs__cell rs__agenda_items", children: T.length > 0 ? /* @__PURE__ */ r(Qe, { day: l, events: T }) : /* @__PURE__ */ r(F, { sx: { padding: 1 }, children: d.noDataToDisplay }) })
|
|
2153
|
+
] }, b);
|
|
2154
|
+
}) });
|
|
2155
|
+
}, xr = ({
|
|
2156
|
+
events: e,
|
|
2157
|
+
resourceId: t,
|
|
2158
|
+
today: n,
|
|
2159
|
+
eachWeekStart: o,
|
|
2160
|
+
eachFirstDayInCalcRow: i,
|
|
2161
|
+
daysList: s,
|
|
2162
|
+
onViewMore: a,
|
|
2163
|
+
cellHeight: d
|
|
2164
|
+
}) => {
|
|
2165
|
+
const f = Math.round((d - ut) / pe - 1), { translations: c, month: h, locale: v, timeZone: y } = O(), { renderedSlots: p } = Bt(), u = U(() => {
|
|
2166
|
+
var b;
|
|
2167
|
+
const g = [];
|
|
2168
|
+
for (let l = 0; l < Math.min(e.length, f + 1); l++) {
|
|
2169
|
+
const _ = Oe(e[l], y), T = !!i && me(_.start, i), E = T && i ? i : _.start;
|
|
2170
|
+
let D = ae(E, _.end) + 1;
|
|
2171
|
+
const k = Kt(_.end, E, {
|
|
2172
|
+
weekStartsOn: h == null ? void 0 : h.weekStartOn,
|
|
2173
|
+
locale: v
|
|
2174
|
+
}) > 0;
|
|
2175
|
+
if (k) {
|
|
2176
|
+
const x = $e(_.start, {
|
|
2177
|
+
weekStartsOn: h == null ? void 0 : h.weekStartOn,
|
|
2178
|
+
locale: v
|
|
2179
|
+
}), C = en(x, o);
|
|
2180
|
+
C && (D = s.length - (i ? 0 : _t(_.start, C)));
|
|
2181
|
+
}
|
|
2182
|
+
const S = N(n, "yyyy-MM-dd"), I = (b = p == null ? void 0 : p[t || "all"]) == null ? void 0 : b[S], m = (I == null ? void 0 : I[_.event_id]) || 0, w = Math.min(m, f) * pe + ut;
|
|
2183
|
+
if (m >= f) {
|
|
2184
|
+
g.push(
|
|
2185
|
+
/* @__PURE__ */ r(
|
|
2186
|
+
F,
|
|
2187
|
+
{
|
|
2188
|
+
width: "100%",
|
|
2189
|
+
className: "rs__multi_day rs__hover__op",
|
|
2190
|
+
style: { top: w, fontSize: 11 },
|
|
2191
|
+
onClick: (x) => {
|
|
2192
|
+
x.stopPropagation(), a(n);
|
|
2193
|
+
},
|
|
2194
|
+
children: `${Math.abs(e.length - l)} ${c.moreEvents}`
|
|
2195
|
+
},
|
|
2196
|
+
l
|
|
2197
|
+
)
|
|
2198
|
+
);
|
|
2199
|
+
break;
|
|
2200
|
+
}
|
|
2201
|
+
g.push(
|
|
2202
|
+
/* @__PURE__ */ r(
|
|
2203
|
+
"div",
|
|
2204
|
+
{
|
|
2205
|
+
className: "rs__multi_day",
|
|
2206
|
+
style: {
|
|
2207
|
+
top: w,
|
|
2208
|
+
width: `${100 * D}%`,
|
|
2209
|
+
height: lr
|
|
2210
|
+
},
|
|
2211
|
+
children: /* @__PURE__ */ r(
|
|
2212
|
+
He,
|
|
2213
|
+
{
|
|
2214
|
+
event: _,
|
|
2215
|
+
showdate: !1,
|
|
2216
|
+
multiday: ae(_.start, _.end) > 0,
|
|
2217
|
+
hasPrev: T,
|
|
2218
|
+
hasNext: k
|
|
2219
|
+
}
|
|
2220
|
+
)
|
|
2221
|
+
},
|
|
2222
|
+
`${_.event_id}_${l}`
|
|
2223
|
+
)
|
|
2224
|
+
);
|
|
2225
|
+
}
|
|
2226
|
+
return g;
|
|
2227
|
+
}, [
|
|
2228
|
+
t,
|
|
2229
|
+
p,
|
|
2230
|
+
e,
|
|
2231
|
+
f,
|
|
2232
|
+
i,
|
|
2233
|
+
h == null ? void 0 : h.weekStartOn,
|
|
2234
|
+
v,
|
|
2235
|
+
n,
|
|
2236
|
+
o,
|
|
2237
|
+
s.length,
|
|
2238
|
+
c.moreEvents,
|
|
2239
|
+
a,
|
|
2240
|
+
y
|
|
2241
|
+
]);
|
|
2242
|
+
return /* @__PURE__ */ r(ie, { children: u });
|
|
2243
|
+
}, kr = ({ daysList: e, resource: t, eachWeekStart: n }) => {
|
|
2244
|
+
const {
|
|
2245
|
+
height: o,
|
|
2246
|
+
month: i,
|
|
2247
|
+
selectedDate: s,
|
|
2248
|
+
events: a,
|
|
2249
|
+
handleGotoDay: d,
|
|
2250
|
+
resourceFields: f,
|
|
2251
|
+
fields: c,
|
|
2252
|
+
locale: h,
|
|
2253
|
+
hourFormat: v,
|
|
2254
|
+
stickyNavigation: y,
|
|
2255
|
+
timeZone: p,
|
|
2256
|
+
onClickMore: u,
|
|
2257
|
+
stickyNavigationOffset: g,
|
|
2258
|
+
stickyNavigationHeight: b
|
|
2259
|
+
} = O(), { weekDays: l, startHour: _, endHour: T, cellRenderer: E, headRenderer: D, disableGoToDay: k } = i, { headersRef: S, bodyRef: I } = Wt(), m = ne(), w = Ze(s), x = De(v), C = o / n.length, W = Z(
|
|
2260
|
+
(R) => {
|
|
2261
|
+
let z = Ae(a);
|
|
2262
|
+
R && (z = Ce(a, R, f, c));
|
|
2263
|
+
const J = [];
|
|
2264
|
+
for (const re of n) {
|
|
2265
|
+
const K = l.map((le) => {
|
|
2266
|
+
const P = Q(re, le), fe = /* @__PURE__ */ new Date(`${N(ot(P, _), `yyyy/MM/dd ${x}`)}`), V = /* @__PURE__ */ new Date(`${N(ot(P, T), `yyyy/MM/dd ${x}`)}`), $ = f.idField, A = ye(re, P) ? P : null, G = z.flatMap((H) => It(H, P)).filter((H) => {
|
|
2267
|
+
if (ye(H.start, P)) return !0;
|
|
2268
|
+
const ce = { start: X(H.start), end: q(H.end) };
|
|
2269
|
+
return !!(A && j(A, ce));
|
|
2270
|
+
}), oe = he({ dateLeft: P, timeZone: p });
|
|
2271
|
+
return /* @__PURE__ */ M("span", { style: { height: C }, className: "rs__cell", children: [
|
|
2272
|
+
/* @__PURE__ */ r(
|
|
2273
|
+
Ke,
|
|
2274
|
+
{
|
|
2275
|
+
start: fe,
|
|
2276
|
+
end: V,
|
|
2277
|
+
day: s,
|
|
2278
|
+
height: C,
|
|
2279
|
+
resourceKey: $,
|
|
2280
|
+
resourceVal: R ? R[$] : null,
|
|
2281
|
+
cellRenderer: E
|
|
2282
|
+
}
|
|
2283
|
+
),
|
|
2284
|
+
/* @__PURE__ */ M(ie, { children: [
|
|
2285
|
+
typeof D == "function" ? /* @__PURE__ */ r("div", { style: { position: "absolute", top: 0 }, children: D({ day: P, events: z, resource: R }) }) : /* @__PURE__ */ r(
|
|
2286
|
+
qe,
|
|
2287
|
+
{
|
|
2288
|
+
style: {
|
|
2289
|
+
width: 27,
|
|
2290
|
+
height: 27,
|
|
2291
|
+
position: "absolute",
|
|
2292
|
+
top: 0,
|
|
2293
|
+
background: oe ? m.palette.secondary.main : "transparent",
|
|
2294
|
+
color: oe ? m.palette.secondary.contrastText : "",
|
|
2295
|
+
marginBottom: 2
|
|
2296
|
+
},
|
|
2297
|
+
children: /* @__PURE__ */ r(
|
|
2298
|
+
F,
|
|
2299
|
+
{
|
|
2300
|
+
color: Dt(P, w) ? "textPrimary" : "#ccc",
|
|
2301
|
+
className: k ? "" : "rs__hover__op",
|
|
2302
|
+
onClick: (H) => {
|
|
2303
|
+
H.stopPropagation(), k || d(P);
|
|
2304
|
+
},
|
|
2305
|
+
children: N(P, "dd")
|
|
2306
|
+
}
|
|
2307
|
+
)
|
|
2308
|
+
}
|
|
2309
|
+
),
|
|
2310
|
+
/* @__PURE__ */ r(
|
|
2311
|
+
xr,
|
|
2312
|
+
{
|
|
2313
|
+
events: G,
|
|
2314
|
+
resourceId: R == null ? void 0 : R[$],
|
|
2315
|
+
today: P,
|
|
2316
|
+
eachWeekStart: n,
|
|
2317
|
+
eachFirstDayInCalcRow: A,
|
|
2318
|
+
daysList: e,
|
|
2319
|
+
onViewMore: (H) => {
|
|
2320
|
+
u && typeof u == "function" ? u(H, d) : d(H);
|
|
2321
|
+
},
|
|
2322
|
+
cellHeight: C
|
|
2323
|
+
}
|
|
2324
|
+
)
|
|
2325
|
+
] })
|
|
2326
|
+
] }, le.toString());
|
|
2327
|
+
});
|
|
2328
|
+
J.push(/* @__PURE__ */ r(ie, { children: K }, re.toString()));
|
|
2329
|
+
}
|
|
2330
|
+
return J;
|
|
2331
|
+
},
|
|
2332
|
+
[
|
|
2333
|
+
C,
|
|
2334
|
+
E,
|
|
2335
|
+
e,
|
|
2336
|
+
k,
|
|
2337
|
+
n,
|
|
2338
|
+
T,
|
|
2339
|
+
a,
|
|
2340
|
+
c,
|
|
2341
|
+
x,
|
|
2342
|
+
d,
|
|
2343
|
+
D,
|
|
2344
|
+
w,
|
|
2345
|
+
u,
|
|
2346
|
+
f,
|
|
2347
|
+
s,
|
|
2348
|
+
_,
|
|
2349
|
+
m.palette.secondary.contrastText,
|
|
2350
|
+
m.palette.secondary.main,
|
|
2351
|
+
p,
|
|
2352
|
+
l
|
|
2353
|
+
]
|
|
2354
|
+
);
|
|
2355
|
+
return /* @__PURE__ */ M(Y, { children: [
|
|
2356
|
+
/* @__PURE__ */ r(
|
|
2357
|
+
be,
|
|
2358
|
+
{
|
|
2359
|
+
days: e.length,
|
|
2360
|
+
ref: S,
|
|
2361
|
+
indent: "0",
|
|
2362
|
+
sticky: "1",
|
|
2363
|
+
stickyNavigation: y,
|
|
2364
|
+
stickyOffset: g,
|
|
2365
|
+
stickyHeight: b,
|
|
2366
|
+
children: e.map((R, z) => /* @__PURE__ */ r(
|
|
2367
|
+
F,
|
|
2368
|
+
{
|
|
2369
|
+
className: "rs__cell rs__header rs__header__center",
|
|
2370
|
+
align: "center",
|
|
2371
|
+
variant: "body2",
|
|
2372
|
+
children: N(R, "EE", { locale: h })
|
|
2373
|
+
},
|
|
2374
|
+
z
|
|
2375
|
+
))
|
|
2376
|
+
}
|
|
2377
|
+
),
|
|
2378
|
+
/* @__PURE__ */ r(be, { days: e.length, ref: I, indent: "0", children: W(t) })
|
|
2379
|
+
] });
|
|
2380
|
+
}, Tr = () => {
|
|
2381
|
+
const {
|
|
2382
|
+
month: e,
|
|
2383
|
+
selectedDate: t,
|
|
2384
|
+
events: n,
|
|
2385
|
+
getRemoteEvents: o,
|
|
2386
|
+
triggerLoading: i,
|
|
2387
|
+
handleState: s,
|
|
2388
|
+
resources: a,
|
|
2389
|
+
resourceFields: d,
|
|
2390
|
+
fields: f,
|
|
2391
|
+
agenda: c
|
|
2392
|
+
} = O(), { weekStartOn: h, weekDays: v } = e, y = Ze(t), p = bt(t), u = tn(
|
|
2393
|
+
{
|
|
2394
|
+
start: y,
|
|
2395
|
+
end: p
|
|
2396
|
+
},
|
|
2397
|
+
{ weekStartsOn: h }
|
|
2398
|
+
), g = v.map((_) => Q(u[0], _)), b = Z(async () => {
|
|
2399
|
+
try {
|
|
2400
|
+
i(!0);
|
|
2401
|
+
const _ = u[0], T = Q(u[u.length - 1], g.length), E = await o({
|
|
2402
|
+
start: _,
|
|
2403
|
+
end: T,
|
|
2404
|
+
view: "month"
|
|
2405
|
+
});
|
|
2406
|
+
E && (E != null && E.length) && s(E, "events");
|
|
2407
|
+
} catch (_) {
|
|
2408
|
+
throw _;
|
|
2409
|
+
} finally {
|
|
2410
|
+
i(!1);
|
|
2411
|
+
}
|
|
2412
|
+
}, [g.length, o]);
|
|
2413
|
+
te(() => {
|
|
2414
|
+
o instanceof Function && b();
|
|
2415
|
+
}, [b, o]);
|
|
2416
|
+
const l = Z(
|
|
2417
|
+
(_) => {
|
|
2418
|
+
if (c) {
|
|
2419
|
+
let T = Ae(n);
|
|
2420
|
+
return _ && (T = Ce(n, _, d, f)), /* @__PURE__ */ r(Dr, { resource: _, events: T });
|
|
2421
|
+
}
|
|
2422
|
+
return /* @__PURE__ */ r(kr, { daysList: g, eachWeekStart: u, resource: _ });
|
|
2423
|
+
},
|
|
2424
|
+
[c, g, u, n, f, d]
|
|
2425
|
+
);
|
|
2426
|
+
return a.length ? /* @__PURE__ */ r(Ye, { renderChildren: l }) : l();
|
|
2427
|
+
}, Cr = ({ events: e, resource: t }) => {
|
|
2428
|
+
const {
|
|
2429
|
+
day: n,
|
|
2430
|
+
locale: o,
|
|
2431
|
+
selectedDate: i,
|
|
2432
|
+
translations: s,
|
|
2433
|
+
alwaysShowAgendaDays: a,
|
|
2434
|
+
stickyNavigationOffset: d,
|
|
2435
|
+
stickyNavigationHeight: f
|
|
2436
|
+
} = O(), { headRenderer: c } = n, h = U(() => Ie(e, i), [e, i]);
|
|
2437
|
+
return !a && !h.length ? /* @__PURE__ */ r(Je, {}) : /* @__PURE__ */ r(Re, { stickyOffset: d, stickyHeight: f, children: /* @__PURE__ */ M("div", { className: "rs__agenda_row rs__today_cell", children: [
|
|
2438
|
+
/* @__PURE__ */ r("div", { className: "rs__cell rs__agenda__cell", children: typeof c == "function" ? /* @__PURE__ */ r("div", { children: c({ day: i, events: e, resource: t }) }) : /* @__PURE__ */ r(F, { variant: "body2", children: N(i, "dd E", { locale: o }) }) }),
|
|
2439
|
+
/* @__PURE__ */ r("div", { className: "rs__cell rs__agenda_items", children: h.length > 0 ? /* @__PURE__ */ r(Qe, { day: i, events: h }) : /* @__PURE__ */ r(F, { sx: { padding: 1 }, children: s.noDataToDisplay }) })
|
|
2440
|
+
] }) });
|
|
2441
|
+
}, Er = () => {
|
|
2442
|
+
const {
|
|
2443
|
+
day: e,
|
|
2444
|
+
selectedDate: t,
|
|
2445
|
+
events: n,
|
|
2446
|
+
height: o,
|
|
2447
|
+
getRemoteEvents: i,
|
|
2448
|
+
triggerLoading: s,
|
|
2449
|
+
handleState: a,
|
|
2450
|
+
resources: d,
|
|
2451
|
+
resourceFields: f,
|
|
2452
|
+
resourceViewMode: c,
|
|
2453
|
+
fields: h,
|
|
2454
|
+
direction: v,
|
|
2455
|
+
locale: y,
|
|
2456
|
+
hourFormat: p,
|
|
2457
|
+
timeZone: u,
|
|
2458
|
+
stickyNavigation: g,
|
|
2459
|
+
agenda: b,
|
|
2460
|
+
stickyNavigationOffset: l,
|
|
2461
|
+
stickyNavigationHeight: _,
|
|
2462
|
+
currentTime: T,
|
|
2463
|
+
showCurrentTimeBar: E,
|
|
2464
|
+
currentTimeBarColor: D,
|
|
2465
|
+
forceInlineMultiDay: k
|
|
2466
|
+
} = O(), { startHour: S, endHour: I, step: m, cellRenderer: w, headRenderer: x, hourRenderer: C } = e, W = ke(t, { hours: S, minutes: 0, seconds: 0 }), R = ke(t, { hours: I, minutes: -m, seconds: 0 }), z = vt(
|
|
2467
|
+
{
|
|
2468
|
+
start: W,
|
|
2469
|
+
end: R
|
|
2470
|
+
},
|
|
2471
|
+
{ step: m }
|
|
2472
|
+
), J = Mt(o, z.length), re = St(J, m), K = De(p), le = Z(async () => {
|
|
2473
|
+
try {
|
|
2474
|
+
s(!0);
|
|
2475
|
+
const V = Q(W, -1), $ = Q(R, 1), A = await i({
|
|
2476
|
+
start: V,
|
|
2477
|
+
end: $,
|
|
2478
|
+
view: "day"
|
|
2479
|
+
});
|
|
2480
|
+
A && (A != null && A.length) && a(A, "events");
|
|
2481
|
+
} catch (V) {
|
|
2482
|
+
throw V;
|
|
2483
|
+
} finally {
|
|
2484
|
+
s(!1);
|
|
2485
|
+
}
|
|
2486
|
+
}, [i]);
|
|
2487
|
+
te(() => {
|
|
2488
|
+
i instanceof Function && le();
|
|
2489
|
+
}, [le, i]);
|
|
2490
|
+
const P = Z(
|
|
2491
|
+
(V) => {
|
|
2492
|
+
const $ = Ne(V, t, u, k);
|
|
2493
|
+
return /* @__PURE__ */ r(
|
|
2494
|
+
"div",
|
|
2495
|
+
{
|
|
2496
|
+
className: "rs__block_col",
|
|
2497
|
+
style: { height: pe * $.length },
|
|
2498
|
+
children: $.map((A, G) => {
|
|
2499
|
+
const oe = me(A.start, X(t)), H = Se(A.end, q(t));
|
|
2500
|
+
return /* @__PURE__ */ r(
|
|
2501
|
+
"div",
|
|
2502
|
+
{
|
|
2503
|
+
className: "rs__multi_day",
|
|
2504
|
+
style: {
|
|
2505
|
+
top: G * pe,
|
|
2506
|
+
width: "99.9%",
|
|
2507
|
+
overflowX: "hidden"
|
|
2508
|
+
},
|
|
2509
|
+
children: /* @__PURE__ */ r(He, { event: A, multiday: !0, hasPrev: oe, hasNext: H })
|
|
2510
|
+
},
|
|
2511
|
+
A.event_id
|
|
2512
|
+
);
|
|
2513
|
+
})
|
|
2514
|
+
}
|
|
2515
|
+
);
|
|
2516
|
+
},
|
|
2517
|
+
[t, u]
|
|
2518
|
+
), fe = Z(
|
|
2519
|
+
(V) => {
|
|
2520
|
+
let $ = n;
|
|
2521
|
+
if (V && ($ = Ce(n, V, f, h)), b)
|
|
2522
|
+
return /* @__PURE__ */ r(Cr, { resource: V, events: $ });
|
|
2523
|
+
const A = d.length && c === "default", G = Ne(
|
|
2524
|
+
A ? n : $,
|
|
2525
|
+
t,
|
|
2526
|
+
u,
|
|
2527
|
+
k
|
|
2528
|
+
), oe = pe * G.length + 45;
|
|
2529
|
+
return /* @__PURE__ */ M(Y, { children: [
|
|
2530
|
+
/* @__PURE__ */ M(
|
|
2531
|
+
be,
|
|
2532
|
+
{
|
|
2533
|
+
days: 1,
|
|
2534
|
+
sticky: "1",
|
|
2535
|
+
stickyNavigation: g,
|
|
2536
|
+
stickyOffset: l,
|
|
2537
|
+
stickyHeight: _,
|
|
2538
|
+
children: [
|
|
2539
|
+
/* @__PURE__ */ r("span", { className: "rs__cell" }),
|
|
2540
|
+
/* @__PURE__ */ M(
|
|
2541
|
+
"span",
|
|
2542
|
+
{
|
|
2543
|
+
className: `rs__cell rs__header ${_e(t) ? "rs__today_cell" : ""}`,
|
|
2544
|
+
style: { height: oe },
|
|
2545
|
+
children: [
|
|
2546
|
+
typeof x == "function" ? /* @__PURE__ */ r("div", { children: x({ day: t, events: $, resource: V }) }) : /* @__PURE__ */ r(Pt, { date: t, locale: y }),
|
|
2547
|
+
P($)
|
|
2548
|
+
]
|
|
2549
|
+
}
|
|
2550
|
+
)
|
|
2551
|
+
]
|
|
2552
|
+
}
|
|
2553
|
+
),
|
|
2554
|
+
/* @__PURE__ */ r(be, { days: 1, children: z.map((H, ce) => {
|
|
2555
|
+
const B = /* @__PURE__ */ new Date(`${N(t, "yyyy/MM/dd")} ${N(H, K)}`), ge = de(B, m), xe = f.idField;
|
|
2556
|
+
return /* @__PURE__ */ M(ie, { children: [
|
|
2557
|
+
/* @__PURE__ */ r("span", { className: "rs__cell rs__header rs__time", style: { height: J }, children: typeof C == "function" ? /* @__PURE__ */ r("div", { children: C(N(H, K, { locale: y })) }) : /* @__PURE__ */ r(F, { variant: "caption", children: N(H, K, { locale: y }) }) }),
|
|
2558
|
+
/* @__PURE__ */ M("span", { className: `rs__cell ${_e(t) ? "rs__today_cell" : ""}`, children: [
|
|
2559
|
+
ce === 0 && /* @__PURE__ */ r(
|
|
2560
|
+
Lt,
|
|
2561
|
+
{
|
|
2562
|
+
todayEvents: Nt(
|
|
2563
|
+
$,
|
|
2564
|
+
t,
|
|
2565
|
+
u,
|
|
2566
|
+
k
|
|
2567
|
+
),
|
|
2568
|
+
today: W,
|
|
2569
|
+
minuteHeight: re,
|
|
2570
|
+
startHour: S,
|
|
2571
|
+
endHour: I,
|
|
2572
|
+
step: m,
|
|
2573
|
+
direction: v,
|
|
2574
|
+
timeZone: u,
|
|
2575
|
+
currentTime: T,
|
|
2576
|
+
showCurrentTimeBar: E,
|
|
2577
|
+
currentTimeBarColor: D
|
|
2578
|
+
}
|
|
2579
|
+
),
|
|
2580
|
+
/* @__PURE__ */ r(
|
|
2581
|
+
Ke,
|
|
2582
|
+
{
|
|
2583
|
+
start: B,
|
|
2584
|
+
end: ge,
|
|
2585
|
+
day: t,
|
|
2586
|
+
height: J,
|
|
2587
|
+
resourceKey: xe,
|
|
2588
|
+
resourceVal: V ? V[xe] : null,
|
|
2589
|
+
cellRenderer: w
|
|
2590
|
+
}
|
|
2591
|
+
)
|
|
2592
|
+
] })
|
|
2593
|
+
] }, ce);
|
|
2594
|
+
}) })
|
|
2595
|
+
] });
|
|
2596
|
+
},
|
|
2597
|
+
[
|
|
2598
|
+
J,
|
|
2599
|
+
re,
|
|
2600
|
+
W,
|
|
2601
|
+
b,
|
|
2602
|
+
w,
|
|
2603
|
+
v,
|
|
2604
|
+
I,
|
|
2605
|
+
n,
|
|
2606
|
+
h,
|
|
2607
|
+
K,
|
|
2608
|
+
x,
|
|
2609
|
+
C,
|
|
2610
|
+
z,
|
|
2611
|
+
y,
|
|
2612
|
+
P,
|
|
2613
|
+
f,
|
|
2614
|
+
c,
|
|
2615
|
+
d.length,
|
|
2616
|
+
t,
|
|
2617
|
+
S,
|
|
2618
|
+
m,
|
|
2619
|
+
g,
|
|
2620
|
+
u,
|
|
2621
|
+
T,
|
|
2622
|
+
E,
|
|
2623
|
+
D
|
|
2624
|
+
]
|
|
2625
|
+
);
|
|
2626
|
+
return d.length ? /* @__PURE__ */ r(Ye, { renderChildren: fe }) : fe();
|
|
2627
|
+
}, ft = (e) => {
|
|
2628
|
+
const t = {};
|
|
2629
|
+
let n = 0;
|
|
2630
|
+
for (let o = 0; o < e.length; o++) {
|
|
2631
|
+
const i = e[o], s = nn({ start: i.start, end: i.end });
|
|
2632
|
+
for (let a = 0; a < s.length; a++) {
|
|
2633
|
+
const d = N(s[a], "yyyy-MM-dd");
|
|
2634
|
+
if (t[d]) {
|
|
2635
|
+
const f = Object.values(t[d]);
|
|
2636
|
+
for (; f.includes(n); )
|
|
2637
|
+
n += 1;
|
|
2638
|
+
t[d][i.event_id] = n;
|
|
2639
|
+
} else
|
|
2640
|
+
t[d] = { [i.event_id]: n };
|
|
2641
|
+
}
|
|
2642
|
+
n = 0;
|
|
2643
|
+
}
|
|
2644
|
+
return t;
|
|
2645
|
+
}, gt = (e, t, n, o, i) => {
|
|
2646
|
+
const s = i === "month" ? Ot(e) : Ae(e), a = {};
|
|
2647
|
+
if (t.length)
|
|
2648
|
+
for (const d of t) {
|
|
2649
|
+
const f = Ce(s, d, n, o), c = ft(f);
|
|
2650
|
+
a[d[n.idField]] = c;
|
|
2651
|
+
}
|
|
2652
|
+
else
|
|
2653
|
+
a.all = ft(s);
|
|
2654
|
+
return a;
|
|
2655
|
+
}, Sr = ({ children: e }) => {
|
|
2656
|
+
const { events: t, resources: n, resourceFields: o, fields: i, view: s } = O(), [a, d] = L({
|
|
2657
|
+
renderedSlots: gt(t, n, o, i, s)
|
|
2658
|
+
});
|
|
2659
|
+
te(() => {
|
|
2660
|
+
d((c) => ({
|
|
2661
|
+
...c,
|
|
2662
|
+
renderedSlots: gt(
|
|
2663
|
+
t,
|
|
2664
|
+
n,
|
|
2665
|
+
o,
|
|
2666
|
+
i,
|
|
2667
|
+
s
|
|
2668
|
+
)
|
|
2669
|
+
}));
|
|
2670
|
+
}, [t, i, o, n, s]);
|
|
2671
|
+
const f = (c, h, v, y) => {
|
|
2672
|
+
d((p) => {
|
|
2673
|
+
var u, g, b, l, _;
|
|
2674
|
+
return {
|
|
2675
|
+
...p,
|
|
2676
|
+
renderedSlots: {
|
|
2677
|
+
...p.renderedSlots,
|
|
2678
|
+
[y || "all"]: {
|
|
2679
|
+
...(u = p.renderedSlots) == null ? void 0 : u[y || "all"],
|
|
2680
|
+
[c]: (b = (g = p.renderedSlots) == null ? void 0 : g[y || "all"]) != null && b[c] ? {
|
|
2681
|
+
...(_ = (l = p.renderedSlots) == null ? void 0 : l[y || "all"]) == null ? void 0 : _[c],
|
|
2682
|
+
[h]: v
|
|
2683
|
+
} : { [h]: v }
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
};
|
|
2687
|
+
});
|
|
2688
|
+
};
|
|
2689
|
+
return /* @__PURE__ */ r(
|
|
2690
|
+
zt.Provider,
|
|
2691
|
+
{
|
|
2692
|
+
value: {
|
|
2693
|
+
...a,
|
|
2694
|
+
setRenderedSlot: f
|
|
2695
|
+
},
|
|
2696
|
+
children: e
|
|
2697
|
+
}
|
|
2698
|
+
);
|
|
2699
|
+
}, Mr = mt(function(t, n) {
|
|
2700
|
+
const o = O(), { view: i, dialog: s, loading: a, loadingComponent: d, resourceViewMode: f, resources: c, translations: h } = o, v = U(() => {
|
|
2701
|
+
switch (i) {
|
|
2702
|
+
case "month":
|
|
2703
|
+
return /* @__PURE__ */ r(Tr, {});
|
|
2704
|
+
case "week":
|
|
2705
|
+
return /* @__PURE__ */ r(fr, {});
|
|
2706
|
+
case "day":
|
|
2707
|
+
return /* @__PURE__ */ r(Er, {});
|
|
2708
|
+
default:
|
|
2709
|
+
return "";
|
|
2710
|
+
}
|
|
2711
|
+
}, [i]), y = U(() => /* @__PURE__ */ r("div", { className: "rs__table_loading", children: d || /* @__PURE__ */ r("div", { className: "rs__table_loading_internal", children: /* @__PURE__ */ M("span", { children: [
|
|
2712
|
+
/* @__PURE__ */ r(Et, { size: 50 }),
|
|
2713
|
+
/* @__PURE__ */ r(F, { align: "center", children: h.loading })
|
|
2714
|
+
] }) }) }), [d, h.loading]);
|
|
2715
|
+
return /* @__PURE__ */ M(
|
|
2716
|
+
er,
|
|
2717
|
+
{
|
|
2718
|
+
dialog: s ? 1 : 0,
|
|
2719
|
+
"data-testid": "rs-wrapper",
|
|
2720
|
+
ref: (p) => {
|
|
2721
|
+
const u = n;
|
|
2722
|
+
u && (u.current = {
|
|
2723
|
+
el: p,
|
|
2724
|
+
scheduler: o
|
|
2725
|
+
});
|
|
2726
|
+
},
|
|
2727
|
+
children: [
|
|
2728
|
+
a ? y : null,
|
|
2729
|
+
/* @__PURE__ */ r(mr, {}),
|
|
2730
|
+
/* @__PURE__ */ r(
|
|
2731
|
+
tr,
|
|
2732
|
+
{
|
|
2733
|
+
resource_count: f === "default" ? c.length : 1,
|
|
2734
|
+
sx: {
|
|
2735
|
+
overflowX: f === "default" && c.length > 1 ? "auto" : void 0,
|
|
2736
|
+
flexDirection: f === "vertical" ? "column" : void 0
|
|
2737
|
+
},
|
|
2738
|
+
"data-testid": "grid",
|
|
2739
|
+
children: /* @__PURE__ */ r(Sr, { children: v })
|
|
2740
|
+
}
|
|
2741
|
+
),
|
|
2742
|
+
s && /* @__PURE__ */ r(wr, {})
|
|
2743
|
+
]
|
|
2744
|
+
}
|
|
2745
|
+
);
|
|
2746
|
+
}), Ir = ({ children: e, initial: t }) => {
|
|
2747
|
+
const [n, o] = L({ ...$t, ...Ft(t) });
|
|
2748
|
+
te(() => {
|
|
2749
|
+
o((p) => ({
|
|
2750
|
+
...p,
|
|
2751
|
+
onEventDrop: t.onEventDrop,
|
|
2752
|
+
customEditor: t.customEditor,
|
|
2753
|
+
customHeaderContent: t.customHeaderContent,
|
|
2754
|
+
events: t.events || []
|
|
2755
|
+
}));
|
|
2756
|
+
}, [t.onEventDrop, t.customEditor, t.events, t.customHeaderContent]), te(() => {
|
|
2757
|
+
typeof t.loading < "u" && o((p) => ({ ...p, loading: t.loading }));
|
|
2758
|
+
}, [t.loading]);
|
|
2759
|
+
const i = (p, u) => {
|
|
2760
|
+
o((g) => ({ ...g, [u]: p }));
|
|
2761
|
+
}, s = () => Pn(n), a = () => {
|
|
2762
|
+
o((p) => {
|
|
2763
|
+
const u = !p.agenda;
|
|
2764
|
+
return n.onViewChange && typeof n.onViewChange == "function" && n.onViewChange(n.view, u), { ...p, agenda: u };
|
|
2765
|
+
});
|
|
2766
|
+
}, d = (p, u) => {
|
|
2767
|
+
const g = u;
|
|
2768
|
+
o((b) => {
|
|
2769
|
+
var l;
|
|
2770
|
+
return {
|
|
2771
|
+
...b,
|
|
2772
|
+
dialog: p,
|
|
2773
|
+
selectedRange: g != null && g.event_id ? void 0 : g || {
|
|
2774
|
+
start: /* @__PURE__ */ new Date(),
|
|
2775
|
+
end: new Date(Date.now() + 3600 * 1e3)
|
|
2776
|
+
},
|
|
2777
|
+
selectedEvent: g != null && g.event_id ? g : void 0,
|
|
2778
|
+
selectedResource: g == null ? void 0 : g[(l = n.resourceFields) == null ? void 0 : l.idField]
|
|
2779
|
+
};
|
|
2780
|
+
});
|
|
2781
|
+
}, f = (p) => {
|
|
2782
|
+
typeof t.loading > "u" && o((u) => ({ ...u, loading: p }));
|
|
2783
|
+
}, c = (p) => {
|
|
2784
|
+
const u = s();
|
|
2785
|
+
let g;
|
|
2786
|
+
u.includes("day") ? (g = "day", o((b) => ({ ...b, view: "day", selectedDate: p }))) : u.includes("week") ? (g = "week", o((b) => ({ ...b, view: "week", selectedDate: p }))) : console.warn("No Day/Week views available"), g && n.onViewChange && typeof n.onViewChange == "function" && n.onViewChange(g, n.agenda), g && n.onSelectedDateChange && typeof n.onSelectedDateChange == "function" && n.onSelectedDateChange(p);
|
|
2787
|
+
}, h = (p, u) => {
|
|
2788
|
+
let g;
|
|
2789
|
+
u === "edit" ? Array.isArray(p) ? g = n.events.map((b) => {
|
|
2790
|
+
const l = p.find((_) => _.event_id === b.event_id);
|
|
2791
|
+
return l ? { ...b, ...l } : b;
|
|
2792
|
+
}) : g = n.events.map(
|
|
2793
|
+
(b) => b.event_id === p.event_id ? { ...b, ...p } : b
|
|
2794
|
+
) : g = n.events.concat(p), o((b) => ({ ...b, events: g }));
|
|
2795
|
+
}, v = (p) => {
|
|
2796
|
+
o((u) => ({ ...u, currentDragged: p }));
|
|
2797
|
+
}, y = async (p, u, g, b, l) => {
|
|
2798
|
+
var I;
|
|
2799
|
+
const _ = n.events.find((m) => typeof m.event_id == "number" ? m.event_id === +u : m.event_id === u), T = n.fields.find((m) => m.name === b), E = !!((I = T == null ? void 0 : T.config) != null && I.multiple);
|
|
2800
|
+
let D = l;
|
|
2801
|
+
if (T) {
|
|
2802
|
+
const m = _[b], w = Ve(T, m, _).value;
|
|
2803
|
+
if (E)
|
|
2804
|
+
if (w.includes(l)) {
|
|
2805
|
+
if (it(_.start, g))
|
|
2806
|
+
return;
|
|
2807
|
+
D = w;
|
|
2808
|
+
} else
|
|
2809
|
+
D = w.length > 1 ? [...w, l] : [l];
|
|
2810
|
+
}
|
|
2811
|
+
if (it(_.start, g) && (!D || !E && D === _[b]))
|
|
2812
|
+
return;
|
|
2813
|
+
const k = Fe(_.end, _.start), S = {
|
|
2814
|
+
..._,
|
|
2815
|
+
start: g,
|
|
2816
|
+
end: de(g, k),
|
|
2817
|
+
recurring: void 0,
|
|
2818
|
+
[b]: D || ""
|
|
2819
|
+
};
|
|
2820
|
+
if (!n.onEventDrop || typeof n.onEventDrop != "function")
|
|
2821
|
+
return h(S, "edit");
|
|
2822
|
+
try {
|
|
2823
|
+
f(!0);
|
|
2824
|
+
const m = await n.onEventDrop(p, g, S, _);
|
|
2825
|
+
m && h(m, "edit");
|
|
2826
|
+
} finally {
|
|
2827
|
+
f(!1);
|
|
2828
|
+
}
|
|
2829
|
+
};
|
|
2830
|
+
return /* @__PURE__ */ r(
|
|
2831
|
+
At.Provider,
|
|
2832
|
+
{
|
|
2833
|
+
value: {
|
|
2834
|
+
...n,
|
|
2835
|
+
handleState: i,
|
|
2836
|
+
getViews: s,
|
|
2837
|
+
toggleAgenda: a,
|
|
2838
|
+
triggerDialog: d,
|
|
2839
|
+
triggerLoading: f,
|
|
2840
|
+
handleGotoDay: c,
|
|
2841
|
+
confirmEvent: h,
|
|
2842
|
+
setCurrentDragged: v,
|
|
2843
|
+
onDrop: y
|
|
2844
|
+
},
|
|
2845
|
+
children: e
|
|
2846
|
+
}
|
|
2847
|
+
);
|
|
2848
|
+
}, eo = mt(function(t, n) {
|
|
2849
|
+
return /* @__PURE__ */ r(Ir, { initial: t, children: /* @__PURE__ */ r(Mr, { ref: n }) });
|
|
2850
|
+
});
|
|
2851
|
+
export {
|
|
2852
|
+
eo as Scheduler
|
|
2853
|
+
};
|