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