@object-ui/plugin-calendar 15.0.0 → 16.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +96 -0
- package/dist/ObjectCalendar.d.ts.map +1 -1
- package/dist/index.js +287 -286
- package/dist/index.umd.cjs +1 -1
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
2
|
import t, { useCallback as n, useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
|
|
3
3
|
import { ComponentRegistry as s, buildExpandFields as c, extractRecords as l, getRecordDisplayName as u } from "@object-ui/core";
|
|
4
|
-
import {
|
|
5
|
-
import { CalendarIcon as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { useObjectTranslation as
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import { usePullToRefresh as
|
|
10
|
-
import { RecordDetailDrawer as
|
|
4
|
+
import { extractWriteErrorMessage as d, isPermissionError as f, useNavigationOverlay as p, useSafeTranslate as m, useSchemaContext as h } from "@object-ui/react";
|
|
5
|
+
import { CalendarIcon as g, ChevronLeftIcon as _, ChevronRightIcon as v, PlusIcon as y } from "lucide-react";
|
|
6
|
+
import { Button as b, Calendar as x, Dialog as S, DialogContent as C, DialogDescription as w, DialogFooter as T, DialogHeader as E, DialogTitle as D, Input as ee, Label as te, Popover as O, PopoverContent as k, PopoverTrigger as A, Select as ne, SelectContent as j, SelectItem as M, SelectTrigger as N, SelectValue as re, cn as P, toast as ie, useIsMobile as ae } from "@object-ui/components";
|
|
7
|
+
import { useObjectTranslation as F } from "@object-ui/i18n";
|
|
8
|
+
import { Fragment as I, jsx as L, jsxs as R } from "react/jsx-runtime";
|
|
9
|
+
import { usePullToRefresh as oe } from "@object-ui/mobile";
|
|
10
|
+
import { RecordDetailDrawer as se, deriveRecordPageHref as ce } from "@object-ui/plugin-detail";
|
|
11
11
|
//#region src/CalendarView.tsx
|
|
12
|
-
var
|
|
12
|
+
var le = "bg-blue-100 text-blue-900 border border-blue-200", z = /* @__PURE__ */ new Date(), ue = [
|
|
13
13
|
"bg-blue-100 text-blue-900 border border-blue-200",
|
|
14
14
|
"bg-emerald-100 text-emerald-900 border border-emerald-200",
|
|
15
15
|
"bg-amber-100 text-amber-900 border border-amber-200",
|
|
@@ -18,17 +18,17 @@ var R = "bg-blue-100 text-blue-900 border border-blue-200", oe = /* @__PURE__ */
|
|
|
18
18
|
"bg-cyan-100 text-cyan-900 border border-cyan-200",
|
|
19
19
|
"bg-orange-100 text-orange-900 border border-orange-200",
|
|
20
20
|
"bg-fuchsia-100 text-fuchsia-900 border border-fuchsia-200"
|
|
21
|
-
],
|
|
21
|
+
], de = /^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i, fe = /(^|\s)(bg|text|from|to|via)-/;
|
|
22
22
|
function B(e) {
|
|
23
|
-
if (!e) return { className:
|
|
24
|
-
if (
|
|
23
|
+
if (!e) return { className: le };
|
|
24
|
+
if (de.test(e)) return {
|
|
25
25
|
className: "text-white",
|
|
26
26
|
inlineColor: e
|
|
27
27
|
};
|
|
28
|
-
if (
|
|
28
|
+
if (fe.test(e)) return { className: e };
|
|
29
29
|
let t = 0;
|
|
30
30
|
for (let n = 0; n < e.length; n++) t = (t << 5) - t + e.charCodeAt(n) | 0;
|
|
31
|
-
return { className:
|
|
31
|
+
return { className: ue[Math.abs(t) % ue.length] };
|
|
32
32
|
}
|
|
33
33
|
var V = {
|
|
34
34
|
"calendar.today": "Today",
|
|
@@ -41,7 +41,7 @@ var V = {
|
|
|
41
41
|
};
|
|
42
42
|
function H() {
|
|
43
43
|
try {
|
|
44
|
-
let e =
|
|
44
|
+
let e = F();
|
|
45
45
|
return e.t("calendar.today") === "calendar.today" ? {
|
|
46
46
|
t: (e, t) => {
|
|
47
47
|
let n = V[e] || e;
|
|
@@ -64,38 +64,38 @@ function H() {
|
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
let [
|
|
67
|
+
function pe({ events: t = [], view: n = "month", currentDate: r = z, locale: i = "default", onEventClick: a, onDateClick: o, onViewChange: s, onNavigate: c, onAddClick: l, onEventDrop: u, onTimeRangeSelect: d, slotMinutes: f = 30, className: p }) {
|
|
68
|
+
let [m, h] = e.useState(n), [S, C] = e.useState(r), { t: w, language: T } = H(), E = i === "default" ? T : i;
|
|
69
69
|
e.useEffect(() => {
|
|
70
70
|
C(r);
|
|
71
71
|
}, [r]), e.useEffect(() => {
|
|
72
|
-
|
|
72
|
+
h(n);
|
|
73
73
|
}, [n]);
|
|
74
|
-
let
|
|
75
|
-
|
|
74
|
+
let D = e.useRef(s);
|
|
75
|
+
D.current = s, e.useEffect(() => {
|
|
76
76
|
let e = window.matchMedia("(max-width: 639px)"), t = (e) => {
|
|
77
|
-
e.matches && (
|
|
77
|
+
e.matches && (h("day"), D.current?.("day"));
|
|
78
78
|
};
|
|
79
79
|
return t(e), e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
80
80
|
}, []);
|
|
81
|
-
let
|
|
81
|
+
let ee = () => {
|
|
82
82
|
let e = new Date(S);
|
|
83
|
-
|
|
84
|
-
},
|
|
83
|
+
m === "month" ? e.setMonth(e.getMonth() - 1) : m === "week" ? e.setDate(e.getDate() - 7) : e.setDate(e.getDate() - 1), C(e), c?.(e);
|
|
84
|
+
}, te = () => {
|
|
85
85
|
let e = new Date(S);
|
|
86
|
-
|
|
86
|
+
m === "month" ? e.setMonth(e.getMonth() + 1) : m === "week" ? e.setDate(e.getDate() + 7) : e.setDate(e.getDate() + 1), C(e), c?.(e);
|
|
87
87
|
}, ie = () => {
|
|
88
88
|
let e = /* @__PURE__ */ new Date();
|
|
89
89
|
C(e), c?.(e);
|
|
90
90
|
}, ae = (e) => {
|
|
91
|
-
|
|
92
|
-
},
|
|
93
|
-
if (
|
|
91
|
+
h(e), s?.(e);
|
|
92
|
+
}, F = () => {
|
|
93
|
+
if (m === "month") return S.toLocaleDateString(E, {
|
|
94
94
|
month: "long",
|
|
95
95
|
year: "numeric"
|
|
96
96
|
});
|
|
97
|
-
if (
|
|
98
|
-
let e =
|
|
97
|
+
if (m === "week") {
|
|
98
|
+
let e = me(S), t = new Date(e);
|
|
99
99
|
return t.setDate(t.getDate() + 6), `${e.toLocaleDateString(E, {
|
|
100
100
|
month: "short",
|
|
101
101
|
day: "numeric"
|
|
@@ -110,19 +110,19 @@ function le({ events: t = [], view: n = "month", currentDate: r = oe, locale: i
|
|
|
110
110
|
day: "numeric",
|
|
111
111
|
year: "numeric"
|
|
112
112
|
});
|
|
113
|
-
},
|
|
114
|
-
return /* @__PURE__ */
|
|
113
|
+
}, I = e.useRef(0);
|
|
114
|
+
return /* @__PURE__ */ R("div", {
|
|
115
115
|
role: "region",
|
|
116
116
|
"aria-label": "Calendar",
|
|
117
|
-
className: P("flex flex-col h-full bg-background min-w-0 overflow-hidden",
|
|
118
|
-
children: [/* @__PURE__ */
|
|
117
|
+
className: P("flex flex-col h-full bg-background min-w-0 overflow-hidden", p),
|
|
118
|
+
children: [/* @__PURE__ */ R("div", {
|
|
119
119
|
className: "flex flex-wrap items-center justify-between gap-2 p-2 sm:p-4 border-b min-w-0",
|
|
120
|
-
children: [/* @__PURE__ */
|
|
120
|
+
children: [/* @__PURE__ */ R("div", {
|
|
121
121
|
className: "flex items-center gap-4",
|
|
122
|
-
children: [/* @__PURE__ */
|
|
122
|
+
children: [/* @__PURE__ */ R("div", {
|
|
123
123
|
className: "flex items-center bg-muted/50 rounded-lg p-1 gap-1",
|
|
124
124
|
children: [
|
|
125
|
-
/* @__PURE__ */
|
|
125
|
+
/* @__PURE__ */ L(b, {
|
|
126
126
|
variant: "ghost",
|
|
127
127
|
size: "sm",
|
|
128
128
|
onClick: ie,
|
|
@@ -130,36 +130,36 @@ function le({ events: t = [], view: n = "month", currentDate: r = oe, locale: i
|
|
|
130
130
|
"aria-label": "Go to today",
|
|
131
131
|
children: w("calendar.today")
|
|
132
132
|
}),
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ L("div", { className: "h-4 w-px bg-border mx-1" }),
|
|
134
|
+
/* @__PURE__ */ L(b, {
|
|
135
135
|
variant: "ghost",
|
|
136
136
|
size: "icon",
|
|
137
137
|
"aria-label": "Previous period",
|
|
138
|
-
onClick:
|
|
138
|
+
onClick: ee,
|
|
139
139
|
className: "h-8 w-8",
|
|
140
|
-
children: /* @__PURE__ */
|
|
140
|
+
children: /* @__PURE__ */ L(_, { className: "h-4 w-4" })
|
|
141
141
|
}),
|
|
142
|
-
/* @__PURE__ */
|
|
142
|
+
/* @__PURE__ */ L(b, {
|
|
143
143
|
variant: "ghost",
|
|
144
144
|
size: "icon",
|
|
145
145
|
"aria-label": "Next period",
|
|
146
|
-
onClick:
|
|
146
|
+
onClick: te,
|
|
147
147
|
className: "h-8 w-8",
|
|
148
|
-
children: /* @__PURE__ */
|
|
148
|
+
children: /* @__PURE__ */ L(v, { className: "h-4 w-4" })
|
|
149
149
|
})
|
|
150
150
|
]
|
|
151
|
-
}), /* @__PURE__ */
|
|
151
|
+
}), /* @__PURE__ */ R(O, { children: [/* @__PURE__ */ L(A, {
|
|
152
152
|
asChild: !0,
|
|
153
|
-
children: /* @__PURE__ */
|
|
153
|
+
children: /* @__PURE__ */ R(b, {
|
|
154
154
|
variant: "ghost",
|
|
155
|
-
"aria-label": `Current date: ${
|
|
155
|
+
"aria-label": `Current date: ${F()}`,
|
|
156
156
|
className: P("text-base sm:text-xl font-semibold h-auto px-2 sm:px-3 py-1 hover:bg-muted/50 transition-colors", "flex items-center gap-2"),
|
|
157
|
-
children: [/* @__PURE__ */
|
|
157
|
+
children: [/* @__PURE__ */ L(g, { className: "h-5 w-5 text-muted-foreground" }), /* @__PURE__ */ L("span", { children: F() })]
|
|
158
158
|
})
|
|
159
|
-
}), /* @__PURE__ */
|
|
159
|
+
}), /* @__PURE__ */ L(k, {
|
|
160
160
|
className: "w-auto p-0",
|
|
161
161
|
align: "start",
|
|
162
|
-
children: /* @__PURE__ */
|
|
162
|
+
children: /* @__PURE__ */ L(x, {
|
|
163
163
|
mode: "single",
|
|
164
164
|
selected: S,
|
|
165
165
|
onSelect: (e) => {
|
|
@@ -170,49 +170,49 @@ function le({ events: t = [], view: n = "month", currentDate: r = oe, locale: i
|
|
|
170
170
|
endMonth: new Date(2050, 11)
|
|
171
171
|
})
|
|
172
172
|
})] })]
|
|
173
|
-
}), /* @__PURE__ */
|
|
173
|
+
}), /* @__PURE__ */ R("div", {
|
|
174
174
|
className: "flex items-center gap-2",
|
|
175
|
-
children: [/* @__PURE__ */
|
|
176
|
-
value:
|
|
175
|
+
children: [/* @__PURE__ */ R(ne, {
|
|
176
|
+
value: m,
|
|
177
177
|
onValueChange: ae,
|
|
178
|
-
children: [/* @__PURE__ */
|
|
178
|
+
children: [/* @__PURE__ */ L(N, {
|
|
179
179
|
className: "w-32 bg-background",
|
|
180
|
-
children: /* @__PURE__ */
|
|
181
|
-
}), /* @__PURE__ */
|
|
182
|
-
/* @__PURE__ */
|
|
180
|
+
children: /* @__PURE__ */ L(re, {})
|
|
181
|
+
}), /* @__PURE__ */ R(j, { children: [
|
|
182
|
+
/* @__PURE__ */ L(M, {
|
|
183
183
|
value: "day",
|
|
184
184
|
children: w("calendar.day")
|
|
185
185
|
}),
|
|
186
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ L(M, {
|
|
187
187
|
value: "week",
|
|
188
188
|
children: w("calendar.week")
|
|
189
189
|
}),
|
|
190
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ L(M, {
|
|
191
191
|
value: "month",
|
|
192
192
|
children: w("calendar.month")
|
|
193
193
|
})
|
|
194
194
|
] })]
|
|
195
|
-
}), l && /* @__PURE__ */
|
|
195
|
+
}), l && /* @__PURE__ */ R(b, {
|
|
196
196
|
onClick: l,
|
|
197
197
|
size: "sm",
|
|
198
198
|
className: "gap-1",
|
|
199
|
-
children: [/* @__PURE__ */
|
|
199
|
+
children: [/* @__PURE__ */ L(y, { className: "h-4 w-4" }), w("calendar.newEvent")]
|
|
200
200
|
})]
|
|
201
201
|
})]
|
|
202
|
-
}), /* @__PURE__ */
|
|
202
|
+
}), /* @__PURE__ */ R("div", {
|
|
203
203
|
className: "flex-1 overflow-auto",
|
|
204
204
|
onTouchStart: (e) => {
|
|
205
|
-
|
|
205
|
+
I.current = e.touches[0].clientX;
|
|
206
206
|
},
|
|
207
207
|
onTouchEnd: (e) => {
|
|
208
|
-
let t =
|
|
208
|
+
let t = I.current - e.changedTouches[0].clientX;
|
|
209
209
|
if (Math.abs(t) > 50) {
|
|
210
210
|
let e = new Date(S);
|
|
211
|
-
|
|
211
|
+
m === "day" ? e.setDate(e.getDate() + (t > 0 ? 1 : -1)) : m === "week" ? e.setDate(e.getDate() + (t > 0 ? 7 : -7)) : e.setMonth(e.getMonth() + (t > 0 ? 1 : -1)), C(e), c?.(e);
|
|
212
212
|
}
|
|
213
213
|
},
|
|
214
214
|
children: [
|
|
215
|
-
|
|
215
|
+
m === "month" && /* @__PURE__ */ L(ge, {
|
|
216
216
|
date: S,
|
|
217
217
|
events: t,
|
|
218
218
|
locale: E,
|
|
@@ -220,7 +220,7 @@ function le({ events: t = [], view: n = "month", currentDate: r = oe, locale: i
|
|
|
220
220
|
onDateClick: o,
|
|
221
221
|
onEventDrop: u
|
|
222
222
|
}),
|
|
223
|
-
|
|
223
|
+
m === "week" && /* @__PURE__ */ L(J, {
|
|
224
224
|
mode: "week",
|
|
225
225
|
date: S,
|
|
226
226
|
events: t,
|
|
@@ -230,7 +230,7 @@ function le({ events: t = [], view: n = "month", currentDate: r = oe, locale: i
|
|
|
230
230
|
onEventDrop: u,
|
|
231
231
|
onTimeRangeSelect: d
|
|
232
232
|
}),
|
|
233
|
-
|
|
233
|
+
m === "day" && /* @__PURE__ */ L(J, {
|
|
234
234
|
mode: "day",
|
|
235
235
|
date: S,
|
|
236
236
|
events: t,
|
|
@@ -244,11 +244,11 @@ function le({ events: t = [], view: n = "month", currentDate: r = oe, locale: i
|
|
|
244
244
|
})]
|
|
245
245
|
});
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function me(e) {
|
|
248
248
|
let t = new Date(e), n = t.getDay(), r = t.getDate() - n;
|
|
249
249
|
return t.setDate(r), t;
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function he(e) {
|
|
252
252
|
let t = e.getFullYear(), n = e.getMonth(), r = new Date(t, n, 1), i = new Date(t, n + 1, 0), a = r.getDay(), o = [];
|
|
253
253
|
for (let e = a - 1; e >= 0; e--) {
|
|
254
254
|
let t = new Date(r.getTime());
|
|
@@ -262,11 +262,11 @@ function de(e) {
|
|
|
262
262
|
}
|
|
263
263
|
return o;
|
|
264
264
|
}
|
|
265
|
-
function
|
|
265
|
+
function U(e, t) {
|
|
266
266
|
return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
|
|
267
267
|
}
|
|
268
|
-
function
|
|
269
|
-
let s = e.useMemo(() =>
|
|
268
|
+
function ge({ date: t, events: n, locale: r = "default", onEventClick: i, onDateClick: a, onEventDrop: o }) {
|
|
269
|
+
let s = e.useMemo(() => he(t), [t.getFullYear(), t.getMonth()]), c = e.useMemo(() => /* @__PURE__ */ new Date(), []), { t: l } = H(), u = e.useMemo(() => {
|
|
270
270
|
let e = new Date(2024, 0, 7);
|
|
271
271
|
return Array.from({ length: 7 }, (t, n) => {
|
|
272
272
|
let i = new Date(e);
|
|
@@ -337,23 +337,23 @@ function pe({ date: t, events: n, locale: r = "default", onEventClick: i, onDate
|
|
|
337
337
|
let d = new Date(c.getTime() + u), p;
|
|
338
338
|
a.end && (p = new Date(new Date(a.end).getTime() + u)), o(a, d, p);
|
|
339
339
|
};
|
|
340
|
-
return /* @__PURE__ */
|
|
340
|
+
return /* @__PURE__ */ R("div", {
|
|
341
341
|
className: "flex flex-col h-full",
|
|
342
|
-
children: [/* @__PURE__ */
|
|
342
|
+
children: [/* @__PURE__ */ L("div", {
|
|
343
343
|
role: "row",
|
|
344
344
|
className: "grid grid-cols-7 border-b",
|
|
345
|
-
children: u.map((e) => /* @__PURE__ */
|
|
345
|
+
children: u.map((e) => /* @__PURE__ */ L("div", {
|
|
346
346
|
role: "columnheader",
|
|
347
347
|
className: "p-2 text-center text-sm font-medium text-muted-foreground border-r last:border-r-0",
|
|
348
348
|
children: e
|
|
349
349
|
}, e))
|
|
350
|
-
}), /* @__PURE__ */
|
|
350
|
+
}), /* @__PURE__ */ L("div", {
|
|
351
351
|
role: "grid",
|
|
352
352
|
"aria-label": "Calendar grid",
|
|
353
353
|
className: "grid grid-cols-7 flex-1 auto-rows-fr",
|
|
354
354
|
children: s.map((e, n) => {
|
|
355
|
-
let r = `${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`, s = h.get(r) || [], u = e.getMonth() === t.getMonth(), f =
|
|
356
|
-
return /* @__PURE__ */
|
|
355
|
+
let r = `${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`, s = h.get(r) || [], u = e.getMonth() === t.getMonth(), f = U(e, c);
|
|
356
|
+
return /* @__PURE__ */ R("div", {
|
|
357
357
|
role: "gridcell",
|
|
358
358
|
"aria-label": `${e.toLocaleDateString("default", {
|
|
359
359
|
weekday: "long",
|
|
@@ -366,15 +366,15 @@ function pe({ date: t, events: n, locale: r = "default", onEventClick: i, onDate
|
|
|
366
366
|
onDragOver: (e) => v(e, n),
|
|
367
367
|
onDragLeave: y,
|
|
368
368
|
onDrop: (t) => b(t, e),
|
|
369
|
-
children: [/* @__PURE__ */
|
|
369
|
+
children: [/* @__PURE__ */ L("div", {
|
|
370
370
|
className: P("text-sm font-medium mb-2", f && "inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground h-6 w-6"),
|
|
371
371
|
...f ? { "aria-current": "date" } : {},
|
|
372
372
|
children: e.getDate()
|
|
373
|
-
}), /* @__PURE__ */
|
|
373
|
+
}), /* @__PURE__ */ R("div", {
|
|
374
374
|
className: "space-y-0.5",
|
|
375
375
|
children: [s.slice(0, 4).map(({ event: t, isTitleDay: n, isSpanStart: r, isSpanEnd: a }, s) => {
|
|
376
376
|
let c = !n, { className: l, inlineColor: u } = B(t.color), f = !!o && a;
|
|
377
|
-
return /* @__PURE__ */
|
|
377
|
+
return /* @__PURE__ */ R("div", {
|
|
378
378
|
role: "button",
|
|
379
379
|
title: t.title,
|
|
380
380
|
"aria-label": t.title,
|
|
@@ -386,7 +386,7 @@ function pe({ date: t, events: n, locale: r = "default", onEventClick: i, onDate
|
|
|
386
386
|
onClick: (e) => {
|
|
387
387
|
e.stopPropagation(), i?.(t);
|
|
388
388
|
},
|
|
389
|
-
children: [c ? "" : t.title, f && /* @__PURE__ */
|
|
389
|
+
children: [c ? "" : t.title, f && /* @__PURE__ */ L("span", {
|
|
390
390
|
role: "separator",
|
|
391
391
|
"aria-label": "Resize event end",
|
|
392
392
|
title: "Drag to change end date",
|
|
@@ -397,7 +397,7 @@ function pe({ date: t, events: n, locale: r = "default", onEventClick: i, onDate
|
|
|
397
397
|
className: "absolute inset-y-0 right-0 w-2 cursor-ew-resize bg-black/25 hover:bg-black/50 rounded-r"
|
|
398
398
|
})]
|
|
399
399
|
}, `${t.id}-${s}`);
|
|
400
|
-
}), s.length > 4 && /* @__PURE__ */
|
|
400
|
+
}), s.length > 4 && /* @__PURE__ */ L("div", {
|
|
401
401
|
className: "text-xs text-muted-foreground px-2",
|
|
402
402
|
children: l("calendar.moreEvents", { count: s.length - 4 })
|
|
403
403
|
})]
|
|
@@ -407,24 +407,24 @@ function pe({ date: t, events: n, locale: r = "default", onEventClick: i, onDate
|
|
|
407
407
|
})]
|
|
408
408
|
});
|
|
409
409
|
}
|
|
410
|
-
var
|
|
411
|
-
function
|
|
410
|
+
var W = 48;
|
|
411
|
+
function G(e) {
|
|
412
412
|
let t = new Date(e);
|
|
413
413
|
return t.setHours(0, 0, 0, 0), t;
|
|
414
414
|
}
|
|
415
|
-
function
|
|
415
|
+
function K(e) {
|
|
416
416
|
return e.getHours() * 60 + e.getMinutes();
|
|
417
417
|
}
|
|
418
|
-
function
|
|
418
|
+
function q(e) {
|
|
419
419
|
return `${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`;
|
|
420
420
|
}
|
|
421
|
-
function
|
|
422
|
-
let { t: l } = H(), u =
|
|
423
|
-
if (t === "day") return [
|
|
424
|
-
let e =
|
|
421
|
+
function J({ mode: t, date: n, events: r, locale: i = "default", slotMinutes: a = 30, onEventClick: o, onEventDrop: s, onTimeRangeSelect: c }) {
|
|
422
|
+
let { t: l } = H(), u = W * a / 60, d = W * 24, f = e.useMemo(() => {
|
|
423
|
+
if (t === "day") return [G(n)];
|
|
424
|
+
let e = me(n);
|
|
425
425
|
return Array.from({ length: 7 }, (t, n) => {
|
|
426
426
|
let r = new Date(e);
|
|
427
|
-
return r.setDate(e.getDate() + n),
|
|
427
|
+
return r.setDate(e.getDate() + n), G(r);
|
|
428
428
|
});
|
|
429
429
|
}, [
|
|
430
430
|
t,
|
|
@@ -444,13 +444,13 @@ function q({ mode: t, date: n, events: r, locale: i = "default", slotMinutes: a
|
|
|
444
444
|
};
|
|
445
445
|
}, [r, m]), _ = e.useMemo(() => {
|
|
446
446
|
let e = /* @__PURE__ */ new Map();
|
|
447
|
-
for (let t of f) e.set(
|
|
447
|
+
for (let t of f) e.set(q(t), []);
|
|
448
448
|
for (let t of h) {
|
|
449
|
-
let n =
|
|
449
|
+
let n = G(new Date(t.start)), r = t.end ? new Date(t.end) : new Date(t.start), i = G(r);
|
|
450
450
|
r.getHours() === 0 && r.getMinutes() === 0 && r.getSeconds() === 0 && r.getTime() > n.getTime() && (i = new Date(i), i.setDate(i.getDate() - 1));
|
|
451
451
|
for (let r of f) {
|
|
452
|
-
let a =
|
|
453
|
-
a < n || a > i || e.get(
|
|
452
|
+
let a = G(r);
|
|
453
|
+
a < n || a > i || e.get(q(r)).push({
|
|
454
454
|
event: t,
|
|
455
455
|
isStart: a.getTime() === n.getTime(),
|
|
456
456
|
isEnd: a.getTime() === i.getTime()
|
|
@@ -460,14 +460,14 @@ function q({ mode: t, date: n, events: r, locale: i = "default", slotMinutes: a
|
|
|
460
460
|
return e;
|
|
461
461
|
}, [f, h]), v = e.useMemo(() => {
|
|
462
462
|
let e = /* @__PURE__ */ new Map();
|
|
463
|
-
for (let t of f) e.set(
|
|
463
|
+
for (let t of f) e.set(q(t), []);
|
|
464
464
|
for (let t of g) {
|
|
465
465
|
let n = new Date(t.start), r = t.end ? new Date(t.end) : new Date(n.getTime() + 3600 * 1e3);
|
|
466
466
|
for (let i of f) {
|
|
467
|
-
let a =
|
|
467
|
+
let a = G(i), o = new Date(a);
|
|
468
468
|
if (o.setDate(o.getDate() + 1), r <= a || n >= o) continue;
|
|
469
|
-
let s = n < a ? a : n, c = r > o ? o : r, l =
|
|
470
|
-
e.get(
|
|
469
|
+
let s = n < a ? a : n, c = r > o ? o : r, l = K(s), u = c.getTime() === o.getTime() ? 1440 : K(c);
|
|
470
|
+
e.get(q(i)).push({
|
|
471
471
|
event: t,
|
|
472
472
|
startMin: l,
|
|
473
473
|
endMin: Math.max(u, l + 15),
|
|
@@ -510,7 +510,7 @@ function q({ mode: t, date: n, events: r, locale: i = "default", slotMinutes: a
|
|
|
510
510
|
let T = e.useRef(!1), E = e.useCallback((e, t) => {
|
|
511
511
|
let n = x.current[t];
|
|
512
512
|
if (!n) return 0;
|
|
513
|
-
let r = (e - n.getBoundingClientRect().top + n.scrollTop) /
|
|
513
|
+
let r = (e - n.getBoundingClientRect().top + n.scrollTop) / W * 60, i = Math.round(r / a) * a;
|
|
514
514
|
return Math.max(0, Math.min(1440, i));
|
|
515
515
|
}, [a]), D = e.useCallback((e) => {
|
|
516
516
|
for (let t = 0; t < x.current.length; t++) {
|
|
@@ -593,16 +593,16 @@ function q({ mode: t, date: n, events: r, locale: i = "default", slotMinutes: a
|
|
|
593
593
|
D,
|
|
594
594
|
E
|
|
595
595
|
]);
|
|
596
|
-
let
|
|
596
|
+
let ee = e.useMemo(() => f.map((e) => ({
|
|
597
597
|
weekday: e.toLocaleDateString(i, { weekday: "short" }),
|
|
598
598
|
day: e.getDate(),
|
|
599
599
|
month: e.toLocaleDateString(i, { month: "short" }),
|
|
600
|
-
isToday:
|
|
600
|
+
isToday: U(e, p)
|
|
601
601
|
})), [
|
|
602
602
|
f,
|
|
603
603
|
i,
|
|
604
604
|
p
|
|
605
|
-
]),
|
|
605
|
+
]), te = e.useMemo(() => Array.from({ length: 24 }, (e, t) => new Date(2024, 0, 1, t, 0).toLocaleTimeString(i, { hour: "numeric" })), [i]), O = (e, t, n, r) => {
|
|
606
606
|
if (!s || e.button !== 0) return;
|
|
607
607
|
e.stopPropagation(), e.preventDefault();
|
|
608
608
|
let i = E(e.clientY, n);
|
|
@@ -626,7 +626,7 @@ function q({ mode: t, date: n, events: r, locale: i = "default", slotMinutes: a
|
|
|
626
626
|
dayIndex: n,
|
|
627
627
|
minutes: i
|
|
628
628
|
});
|
|
629
|
-
},
|
|
629
|
+
}, k = (e, t) => {
|
|
630
630
|
if (!c || e.button !== 0) return;
|
|
631
631
|
e.preventDefault();
|
|
632
632
|
let n = E(e.clientY, t);
|
|
@@ -636,88 +636,88 @@ function q({ mode: t, date: n, events: r, locale: i = "default", slotMinutes: a
|
|
|
636
636
|
anchorMinutes: n,
|
|
637
637
|
headMinutes: n
|
|
638
638
|
});
|
|
639
|
-
},
|
|
639
|
+
}, A = (e) => {
|
|
640
640
|
if (!S) return null;
|
|
641
641
|
if (S.kind === "select" && S.dayIndex === e) {
|
|
642
642
|
let t = Math.min(S.anchorMinutes, S.headMinutes), n = Math.max(S.anchorMinutes, S.headMinutes);
|
|
643
|
-
return /* @__PURE__ */
|
|
643
|
+
return /* @__PURE__ */ L("div", {
|
|
644
644
|
className: "absolute left-1 right-1 rounded bg-primary/30 border border-primary pointer-events-none z-10",
|
|
645
645
|
style: {
|
|
646
|
-
top: t / 60 *
|
|
647
|
-
height: Math.max(u, (n - t) / 60 *
|
|
646
|
+
top: t / 60 * W,
|
|
647
|
+
height: Math.max(u, (n - t) / 60 * W)
|
|
648
648
|
},
|
|
649
649
|
"aria-hidden": !0,
|
|
650
|
-
children: /* @__PURE__ */
|
|
650
|
+
children: /* @__PURE__ */ L("div", {
|
|
651
651
|
className: "px-2 py-0.5 text-xs font-medium text-primary",
|
|
652
|
-
children:
|
|
652
|
+
children: Y(f[e], t, n, i)
|
|
653
653
|
})
|
|
654
654
|
});
|
|
655
655
|
}
|
|
656
656
|
if (S.kind === "move" && S.dayIndex === e) {
|
|
657
657
|
let t = S.minutes - S.grabMinuteOffset, n = Math.max(0, Math.min(1440 - S.durationMin, Math.round(t / a) * a));
|
|
658
|
-
return /* @__PURE__ */
|
|
658
|
+
return /* @__PURE__ */ L("div", {
|
|
659
659
|
className: "absolute left-1 right-1 rounded border-2 border-dashed border-primary bg-primary/10 pointer-events-none z-10",
|
|
660
660
|
style: {
|
|
661
|
-
top: n / 60 *
|
|
662
|
-
height: S.durationMin / 60 *
|
|
661
|
+
top: n / 60 * W,
|
|
662
|
+
height: S.durationMin / 60 * W
|
|
663
663
|
},
|
|
664
664
|
"aria-hidden": !0,
|
|
665
|
-
children: /* @__PURE__ */
|
|
665
|
+
children: /* @__PURE__ */ L("div", {
|
|
666
666
|
className: "px-2 py-0.5 text-xs font-medium text-primary",
|
|
667
|
-
children:
|
|
667
|
+
children: Y(f[e], n, n + S.durationMin, i)
|
|
668
668
|
})
|
|
669
669
|
});
|
|
670
670
|
}
|
|
671
671
|
if ((S.kind === "resize-top" || S.kind === "resize-bottom") && S.dayIndex === e) {
|
|
672
672
|
let t, n;
|
|
673
|
-
return S.kind === "resize-top" ? (t = Math.min(S.anchorEndMin - a, Math.max(0, S.minutes)), n = S.anchorEndMin) : (t = S.anchorStartMin, n = Math.max(S.anchorStartMin + a, Math.min(1440, S.minutes))), /* @__PURE__ */
|
|
673
|
+
return S.kind === "resize-top" ? (t = Math.min(S.anchorEndMin - a, Math.max(0, S.minutes)), n = S.anchorEndMin) : (t = S.anchorStartMin, n = Math.max(S.anchorStartMin + a, Math.min(1440, S.minutes))), /* @__PURE__ */ L("div", {
|
|
674
674
|
className: "absolute left-1 right-1 rounded border-2 border-dashed border-primary bg-primary/10 pointer-events-none z-10",
|
|
675
675
|
style: {
|
|
676
|
-
top: t / 60 *
|
|
677
|
-
height: (n - t) / 60 *
|
|
676
|
+
top: t / 60 * W,
|
|
677
|
+
height: (n - t) / 60 * W
|
|
678
678
|
},
|
|
679
679
|
"aria-hidden": !0,
|
|
680
|
-
children: /* @__PURE__ */
|
|
680
|
+
children: /* @__PURE__ */ L("div", {
|
|
681
681
|
className: "px-2 py-0.5 text-xs font-medium text-primary",
|
|
682
|
-
children:
|
|
682
|
+
children: Y(f[e], t, n, i)
|
|
683
683
|
})
|
|
684
684
|
});
|
|
685
685
|
}
|
|
686
686
|
return null;
|
|
687
687
|
};
|
|
688
|
-
return /* @__PURE__ */
|
|
688
|
+
return /* @__PURE__ */ R("div", {
|
|
689
689
|
className: "flex flex-col h-full",
|
|
690
690
|
ref: b,
|
|
691
691
|
children: [
|
|
692
|
-
/* @__PURE__ */
|
|
692
|
+
/* @__PURE__ */ R("div", {
|
|
693
693
|
className: "flex border-b sticky top-0 bg-background z-20",
|
|
694
|
-
children: [/* @__PURE__ */
|
|
694
|
+
children: [/* @__PURE__ */ L("div", {
|
|
695
695
|
className: "w-14 shrink-0 border-r",
|
|
696
696
|
"aria-hidden": !0
|
|
697
|
-
}),
|
|
697
|
+
}), ee.map((e, t) => /* @__PURE__ */ R("div", {
|
|
698
698
|
role: "columnheader",
|
|
699
699
|
className: P("flex-1 p-2 text-center text-sm border-r last:border-r-0", e.isToday && "bg-primary/5"),
|
|
700
|
-
children: [/* @__PURE__ */
|
|
700
|
+
children: [/* @__PURE__ */ L("div", {
|
|
701
701
|
className: "text-xs text-muted-foreground",
|
|
702
702
|
children: e.weekday
|
|
703
|
-
}), /* @__PURE__ */
|
|
703
|
+
}), /* @__PURE__ */ L("div", {
|
|
704
704
|
className: P("font-medium", e.isToday && "inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground h-6 w-6 mx-auto"),
|
|
705
705
|
children: e.day
|
|
706
706
|
})]
|
|
707
707
|
}, t))]
|
|
708
708
|
}),
|
|
709
|
-
h.length > 0 && /* @__PURE__ */
|
|
709
|
+
h.length > 0 && /* @__PURE__ */ R("div", {
|
|
710
710
|
className: "flex border-b bg-muted/20 max-h-[140px] overflow-y-auto",
|
|
711
|
-
children: [/* @__PURE__ */
|
|
711
|
+
children: [/* @__PURE__ */ L("div", {
|
|
712
712
|
className: "w-14 shrink-0 border-r flex items-start justify-end pr-1 pt-1 text-[10px] text-muted-foreground sticky left-0 bg-muted/20",
|
|
713
713
|
children: l("calendar.allDay") === "calendar.allDay" ? "all-day" : l("calendar.allDay")
|
|
714
714
|
}), f.map((e) => {
|
|
715
|
-
let t =
|
|
716
|
-
return /* @__PURE__ */
|
|
715
|
+
let t = q(e);
|
|
716
|
+
return /* @__PURE__ */ L("div", {
|
|
717
717
|
className: "flex-1 border-r last:border-r-0 min-h-[28px] p-0.5 space-y-0.5",
|
|
718
718
|
children: (_.get(t) ?? []).map(({ event: e, isStart: t, isEnd: n }, r) => {
|
|
719
719
|
let { className: i, inlineColor: a } = B(e.color);
|
|
720
|
-
return /* @__PURE__ */
|
|
720
|
+
return /* @__PURE__ */ L("div", {
|
|
721
721
|
role: "button",
|
|
722
722
|
title: e.title,
|
|
723
723
|
onClick: (t) => {
|
|
@@ -731,27 +731,27 @@ function q({ mode: t, date: n, events: r, locale: i = "default", slotMinutes: a
|
|
|
731
731
|
}, t);
|
|
732
732
|
})]
|
|
733
733
|
}),
|
|
734
|
-
/* @__PURE__ */
|
|
734
|
+
/* @__PURE__ */ L("div", {
|
|
735
735
|
className: "flex-1 overflow-auto",
|
|
736
|
-
children: /* @__PURE__ */
|
|
736
|
+
children: /* @__PURE__ */ R("div", {
|
|
737
737
|
className: "flex",
|
|
738
738
|
style: { height: d },
|
|
739
|
-
children: [/* @__PURE__ */
|
|
739
|
+
children: [/* @__PURE__ */ L("div", {
|
|
740
740
|
className: "w-14 shrink-0 border-r relative",
|
|
741
|
-
children:
|
|
741
|
+
children: te.map((e, t) => /* @__PURE__ */ L("div", {
|
|
742
742
|
className: "absolute right-1 text-[10px] text-muted-foreground -translate-y-1/2",
|
|
743
|
-
style: { top: t *
|
|
743
|
+
style: { top: t * W },
|
|
744
744
|
children: t === 0 ? "" : e
|
|
745
745
|
}, t))
|
|
746
746
|
}), f.map((e, t) => {
|
|
747
|
-
let n =
|
|
748
|
-
return /* @__PURE__ */
|
|
747
|
+
let n = q(e), r = y.get(n) ?? [];
|
|
748
|
+
return /* @__PURE__ */ R("div", {
|
|
749
749
|
ref: (e) => {
|
|
750
750
|
x.current[t] = e;
|
|
751
751
|
},
|
|
752
752
|
className: "flex-1 border-r last:border-r-0 relative select-none",
|
|
753
753
|
style: { height: d },
|
|
754
|
-
onPointerDown: (e) =>
|
|
754
|
+
onPointerDown: (e) => k(e, t),
|
|
755
755
|
"aria-label": e.toLocaleDateString(i, {
|
|
756
756
|
weekday: "long",
|
|
757
757
|
month: "long",
|
|
@@ -759,25 +759,25 @@ function q({ mode: t, date: n, events: r, locale: i = "default", slotMinutes: a
|
|
|
759
759
|
year: "numeric"
|
|
760
760
|
}),
|
|
761
761
|
children: [
|
|
762
|
-
Array.from({ length: 24 }, (e, t) => /* @__PURE__ */
|
|
762
|
+
Array.from({ length: 24 }, (e, t) => /* @__PURE__ */ L("div", {
|
|
763
763
|
className: "absolute left-0 right-0 border-t border-muted/60 pointer-events-none",
|
|
764
|
-
style: { top: t *
|
|
764
|
+
style: { top: t * W }
|
|
765
765
|
}, t)),
|
|
766
766
|
a < 60 && Array.from({ length: Math.floor(1440 / a) }, (e, t) => {
|
|
767
767
|
let n = t * a;
|
|
768
|
-
return n % 60 == 0 ? null : /* @__PURE__ */
|
|
768
|
+
return n % 60 == 0 ? null : /* @__PURE__ */ L("div", {
|
|
769
769
|
className: "absolute left-0 right-0 border-t border-dashed border-muted/30 pointer-events-none",
|
|
770
|
-
style: { top: n / 60 *
|
|
770
|
+
style: { top: n / 60 * W }
|
|
771
771
|
}, t);
|
|
772
772
|
}),
|
|
773
773
|
r.map((n) => {
|
|
774
|
-
let r = n.startMin / 60 *
|
|
775
|
-
return /* @__PURE__ */
|
|
774
|
+
let r = n.startMin / 60 * W, a = Math.max(u, (n.endMin - n.startMin) / 60 * W), c = 100 / n.cols, l = n.col * c, { className: d, inlineColor: f } = B(n.event.color), p = S && S.eventId === n.event.id;
|
|
775
|
+
return /* @__PURE__ */ R("div", {
|
|
776
776
|
role: "button",
|
|
777
777
|
tabIndex: 0,
|
|
778
778
|
title: n.event.title,
|
|
779
779
|
"aria-label": n.event.title,
|
|
780
|
-
onPointerDown: (e) =>
|
|
780
|
+
onPointerDown: (e) => O(e, n, t, "body"),
|
|
781
781
|
onClick: (e) => {
|
|
782
782
|
if (T.current) {
|
|
783
783
|
e.stopPropagation();
|
|
@@ -794,28 +794,28 @@ function q({ mode: t, date: n, events: r, locale: i = "default", slotMinutes: a
|
|
|
794
794
|
...f ? { backgroundColor: f } : {}
|
|
795
795
|
},
|
|
796
796
|
children: [
|
|
797
|
-
/* @__PURE__ */
|
|
797
|
+
/* @__PURE__ */ L("div", {
|
|
798
798
|
className: "font-medium truncate",
|
|
799
799
|
children: n.event.title
|
|
800
800
|
}),
|
|
801
|
-
/* @__PURE__ */
|
|
801
|
+
/* @__PURE__ */ L("div", {
|
|
802
802
|
className: "text-[10px] opacity-80 truncate",
|
|
803
|
-
children:
|
|
803
|
+
children: Y(e, n.startMin, n.endMin, i)
|
|
804
804
|
}),
|
|
805
|
-
s && n.isStart && /* @__PURE__ */
|
|
806
|
-
onPointerDown: (e) =>
|
|
805
|
+
s && n.isStart && /* @__PURE__ */ L("div", {
|
|
806
|
+
onPointerDown: (e) => O(e, n, t, "top"),
|
|
807
807
|
className: "absolute top-0 left-0 right-0 h-1.5 cursor-ns-resize",
|
|
808
808
|
"aria-label": "Resize start"
|
|
809
809
|
}),
|
|
810
|
-
s && n.isEnd && /* @__PURE__ */
|
|
811
|
-
onPointerDown: (e) =>
|
|
810
|
+
s && n.isEnd && /* @__PURE__ */ L("div", {
|
|
811
|
+
onPointerDown: (e) => O(e, n, t, "bottom"),
|
|
812
812
|
className: "absolute bottom-0 left-0 right-0 h-1.5 cursor-ns-resize",
|
|
813
813
|
"aria-label": "Resize end"
|
|
814
814
|
})
|
|
815
815
|
]
|
|
816
816
|
}, `${n.event.id}-${n.startMin}`);
|
|
817
817
|
}),
|
|
818
|
-
|
|
818
|
+
A(t)
|
|
819
819
|
]
|
|
820
820
|
}, n);
|
|
821
821
|
})]
|
|
@@ -824,7 +824,7 @@ function q({ mode: t, date: n, events: r, locale: i = "default", slotMinutes: a
|
|
|
824
824
|
]
|
|
825
825
|
});
|
|
826
826
|
}
|
|
827
|
-
function
|
|
827
|
+
function Y(e, t, n, r) {
|
|
828
828
|
let i = new Date(e);
|
|
829
829
|
i.setHours(0, Math.round(t), 0, 0);
|
|
830
830
|
let a = new Date(e);
|
|
@@ -837,7 +837,7 @@ function J(e, t, n, r) {
|
|
|
837
837
|
}
|
|
838
838
|
//#endregion
|
|
839
839
|
//#region src/ObjectCalendar.tsx
|
|
840
|
-
function
|
|
840
|
+
function _e(e) {
|
|
841
841
|
return "data" in e && e.data ? e.data : "staticData" in e && e.staticData ? {
|
|
842
842
|
provider: "value",
|
|
843
843
|
items: e.staticData
|
|
@@ -846,7 +846,7 @@ function me(e) {
|
|
|
846
846
|
object: e.objectName
|
|
847
847
|
} : null;
|
|
848
848
|
}
|
|
849
|
-
function
|
|
849
|
+
function ve(e) {
|
|
850
850
|
if (e) {
|
|
851
851
|
if (typeof e == "string") {
|
|
852
852
|
let t = e.split(" "), n = t[0], r = t[1]?.toLowerCase() === "desc" ? "desc" : "asc";
|
|
@@ -855,7 +855,7 @@ function he(e) {
|
|
|
855
855
|
if (Array.isArray(e)) return e.reduce((e, t) => (t.field && t.order && (e[t.field] = t.order), e), {});
|
|
856
856
|
}
|
|
857
857
|
}
|
|
858
|
-
function
|
|
858
|
+
function ye(e) {
|
|
859
859
|
return "filter" in e && e.filter && typeof e.filter == "object" && "calendar" in e.filter ? e.filter.calendar : e.calendar ? e.calendar : e.startDateField || e.dateField ? {
|
|
860
860
|
startDateField: e.startDateField || e.dateField,
|
|
861
861
|
endDateField: e.endDateField || e.endField,
|
|
@@ -864,87 +864,87 @@ function ge(e) {
|
|
|
864
864
|
allDayField: e.allDayField
|
|
865
865
|
} : null;
|
|
866
866
|
}
|
|
867
|
-
var
|
|
868
|
-
let
|
|
869
|
-
let e =
|
|
870
|
-
return typeof window < "u" && window.innerWidth < 768 && e ? "month" :
|
|
867
|
+
var be = ({ schema: e, dataSource: t, className: s, data: h, loading: g, onEventClick: _, onRowClick: v, onDateClick: y, onNavigate: x, onViewChange: O, onEventDrop: k, locale: A }) => {
|
|
868
|
+
let ne = m(), j = Array.isArray(h), [M, N] = o(j ? h : []), [re, P] = o(j ? g ?? !1 : !0), [F, le] = o(null), [z, ue] = o(null), [de, fe] = o(/* @__PURE__ */ new Date()), B = ae(), V = e.defaultView, [H, me] = o(() => {
|
|
869
|
+
let e = V === "day" || !V;
|
|
870
|
+
return typeof window < "u" && window.innerWidth < 768 && e ? "month" : V || "month";
|
|
871
871
|
});
|
|
872
872
|
r(() => {
|
|
873
|
-
|
|
874
|
-
}, [
|
|
875
|
-
let [
|
|
873
|
+
B && H === "day" && (V === "day" || !V) && me("month");
|
|
874
|
+
}, [B]);
|
|
875
|
+
let [he, U] = o(0);
|
|
876
876
|
r(() => {
|
|
877
|
-
if (!
|
|
878
|
-
t.resource === e.objectName &&
|
|
877
|
+
if (!j && !(!t?.onMutation || !e.objectName)) return t.onMutation((t) => {
|
|
878
|
+
t.resource === e.objectName && U((e) => e + 1);
|
|
879
879
|
});
|
|
880
880
|
}, [
|
|
881
881
|
t,
|
|
882
882
|
e.objectName,
|
|
883
|
-
|
|
883
|
+
j
|
|
884
884
|
]);
|
|
885
|
-
let { ref:
|
|
885
|
+
let { ref: ge, isRefreshing: W, pullDistance: G } = oe({
|
|
886
886
|
onRefresh: n(async () => {
|
|
887
|
-
|
|
887
|
+
U((e) => e + 1);
|
|
888
888
|
}, []),
|
|
889
889
|
enabled: !!t && !!e.objectName
|
|
890
|
-
}),
|
|
890
|
+
}), K = i(() => _e(e), [
|
|
891
891
|
e.data,
|
|
892
892
|
e.staticData,
|
|
893
893
|
e.objectName
|
|
894
|
-
]),
|
|
894
|
+
]), q = i(() => ye(e), [
|
|
895
895
|
e.filter,
|
|
896
896
|
e.calendar,
|
|
897
897
|
e.dateField,
|
|
898
898
|
e.endField,
|
|
899
899
|
e.titleField,
|
|
900
900
|
e.colorField
|
|
901
|
-
]),
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
}, [
|
|
905
|
-
|
|
906
|
-
}, [
|
|
907
|
-
if (
|
|
901
|
+
]), J = K?.provider === "value", Y = a(null);
|
|
902
|
+
Y.current = z, r(() => {
|
|
903
|
+
j && N(h);
|
|
904
|
+
}, [h, j]), r(() => {
|
|
905
|
+
j && g !== void 0 && P(g);
|
|
906
|
+
}, [g, j]), r(() => {
|
|
907
|
+
if (j) return;
|
|
908
908
|
let n = !0;
|
|
909
909
|
return (async () => {
|
|
910
910
|
try {
|
|
911
911
|
if (!n) return;
|
|
912
|
-
if (
|
|
913
|
-
n && (
|
|
912
|
+
if (P(!0), J && K?.provider === "value") {
|
|
913
|
+
n && (N(K.items), P(!1));
|
|
914
914
|
return;
|
|
915
915
|
}
|
|
916
916
|
if (!t || typeof t.find != "function") throw Error("DataSource required for object/api providers");
|
|
917
|
-
if (
|
|
918
|
-
let r =
|
|
917
|
+
if (K?.provider === "object") {
|
|
918
|
+
let r = K.object, i = c(Y.current?.fields), a = l(await t.find(r, {
|
|
919
919
|
$filter: e.filter,
|
|
920
|
-
$orderby:
|
|
920
|
+
$orderby: ve(e.sort),
|
|
921
921
|
...i.length > 0 ? { $expand: i } : {}
|
|
922
922
|
}));
|
|
923
|
-
n &&
|
|
924
|
-
} else
|
|
925
|
-
n &&
|
|
923
|
+
n && N(a);
|
|
924
|
+
} else K?.provider === "api" && (console.warn("API provider not yet implemented for ObjectCalendar"), n && N([]));
|
|
925
|
+
n && P(!1);
|
|
926
926
|
} catch (e) {
|
|
927
|
-
console.error("[ObjectCalendar] Error fetching data:", e), n && (
|
|
927
|
+
console.error("[ObjectCalendar] Error fetching data:", e), n && (le(e), P(!1));
|
|
928
928
|
}
|
|
929
929
|
})(), () => {
|
|
930
930
|
n = !1;
|
|
931
931
|
};
|
|
932
932
|
}, [
|
|
933
|
-
|
|
934
|
-
W,
|
|
935
|
-
t,
|
|
933
|
+
j,
|
|
936
934
|
K,
|
|
935
|
+
t,
|
|
936
|
+
J,
|
|
937
937
|
e.filter,
|
|
938
938
|
e.sort,
|
|
939
|
-
|
|
939
|
+
he
|
|
940
940
|
]), r(() => {
|
|
941
|
-
!
|
|
941
|
+
!J && t && (async () => {
|
|
942
942
|
try {
|
|
943
943
|
if (!t) return;
|
|
944
|
-
let n =
|
|
944
|
+
let n = K?.provider === "object" ? K.object : e.objectName;
|
|
945
945
|
if (!n) return;
|
|
946
946
|
let r = await t.getObjectSchema(n);
|
|
947
|
-
|
|
947
|
+
ue(r);
|
|
948
948
|
} catch (e) {
|
|
949
949
|
console.error("Failed to fetch object schema:", e);
|
|
950
950
|
}
|
|
@@ -952,19 +952,19 @@ var Y = ({ schema: e, dataSource: t, className: s, data: f, loading: p, onEventC
|
|
|
952
952
|
}, [
|
|
953
953
|
e.objectName,
|
|
954
954
|
t,
|
|
955
|
-
|
|
956
|
-
|
|
955
|
+
J,
|
|
956
|
+
K
|
|
957
957
|
]);
|
|
958
|
-
let
|
|
959
|
-
if (!
|
|
960
|
-
let { startDateField: e, endDateField: t, titleField: n, colorField: r } =
|
|
958
|
+
let be = i(() => {
|
|
959
|
+
if (!q || !M.length) return [];
|
|
960
|
+
let { startDateField: e, endDateField: t, titleField: n, colorField: r } = q, i = (e) => {
|
|
961
961
|
if (n) {
|
|
962
962
|
let t = e[n], r = typeof t == "string" ? t.trim() : t;
|
|
963
963
|
if (r) return String(r);
|
|
964
964
|
}
|
|
965
|
-
return u(
|
|
965
|
+
return u(z, e);
|
|
966
966
|
};
|
|
967
|
-
return
|
|
967
|
+
return M.map((n, a) => {
|
|
968
968
|
let o = n[e], s = t ? n[t] : null, c = i(n), l = r ? n[r] : void 0;
|
|
969
969
|
return {
|
|
970
970
|
id: n.id || n._id || `event-${a}`,
|
|
@@ -977,64 +977,65 @@ var Y = ({ schema: e, dataSource: t, className: s, data: f, loading: p, onEventC
|
|
|
977
977
|
};
|
|
978
978
|
}).filter((e) => !isNaN(e.start.getTime()));
|
|
979
979
|
}, [
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
980
|
+
M,
|
|
981
|
+
q,
|
|
982
|
+
z
|
|
983
983
|
]);
|
|
984
984
|
n(() => {
|
|
985
|
-
|
|
986
|
-
}, [
|
|
987
|
-
let
|
|
985
|
+
y?.(/* @__PURE__ */ new Date());
|
|
986
|
+
}, [y]);
|
|
987
|
+
let X = e.navigation ?? {
|
|
988
988
|
mode: "drawer",
|
|
989
989
|
width: "min(960px, 60vw)"
|
|
990
|
-
},
|
|
991
|
-
navigation:
|
|
990
|
+
}, xe = X.mode === "drawer" || X.mode === "modal" || X.mode === "split" || X.mode === "popover", Z = p({
|
|
991
|
+
navigation: X,
|
|
992
992
|
objectName: e.objectName,
|
|
993
|
-
onRowClick:
|
|
994
|
-
}),
|
|
995
|
-
if (!
|
|
996
|
-
let { startDateField: a, endDateField: o } =
|
|
993
|
+
onRowClick: xe ? void 0 : v
|
|
994
|
+
}), Se = n(async (n, r, i) => {
|
|
995
|
+
if (!q) return;
|
|
996
|
+
let { startDateField: a, endDateField: o } = q, s = n?.id ?? n?._id;
|
|
997
997
|
if (!s || !e.objectName || !t?.update) return;
|
|
998
998
|
let c = { [a]: r.toISOString() };
|
|
999
999
|
o && i && (c[o] = i.toISOString());
|
|
1000
|
-
let l =
|
|
1001
|
-
|
|
1000
|
+
let l = M;
|
|
1001
|
+
N((e) => e.map((e) => (e?.id ?? e?._id) === s ? {
|
|
1002
1002
|
...e,
|
|
1003
1003
|
...c
|
|
1004
1004
|
} : e));
|
|
1005
1005
|
try {
|
|
1006
1006
|
await t.update(e.objectName, s, c);
|
|
1007
1007
|
} catch (e) {
|
|
1008
|
-
|
|
1008
|
+
N(l), console.error("[ObjectCalendar] Failed to persist drag-and-drop reschedule:", e), ie.error(f(e) ? ne("errors.unauthorized", "You are not authorized to perform this action.") : d(e) ?? ne("table.saveFailed", "Save failed"));
|
|
1009
1009
|
}
|
|
1010
1010
|
}, [
|
|
1011
|
-
|
|
1011
|
+
q,
|
|
1012
1012
|
e.objectName,
|
|
1013
1013
|
t,
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1014
|
+
M,
|
|
1015
|
+
ne
|
|
1016
|
+
]), [Q, $] = o(null), Ce = n((n) => {
|
|
1017
|
+
!q || !e.objectName || !t?.create || $({
|
|
1017
1018
|
start: n,
|
|
1018
1019
|
title: "",
|
|
1019
1020
|
submitting: !1
|
|
1020
1021
|
});
|
|
1021
1022
|
}, [
|
|
1022
|
-
|
|
1023
|
+
q,
|
|
1023
1024
|
e.objectName,
|
|
1024
1025
|
t
|
|
1025
|
-
]),
|
|
1026
|
-
!
|
|
1026
|
+
]), we = n((n, r) => {
|
|
1027
|
+
!q || !e.objectName || !t?.create || $({
|
|
1027
1028
|
start: n,
|
|
1028
1029
|
end: r,
|
|
1029
1030
|
title: "",
|
|
1030
1031
|
submitting: !1
|
|
1031
1032
|
});
|
|
1032
1033
|
}, [
|
|
1033
|
-
|
|
1034
|
+
q,
|
|
1034
1035
|
e.objectName,
|
|
1035
1036
|
t
|
|
1036
|
-
]),
|
|
1037
|
-
if (!Q || !
|
|
1037
|
+
]), Te = n(async () => {
|
|
1038
|
+
if (!Q || !q) return;
|
|
1038
1039
|
let n = Q.title.trim();
|
|
1039
1040
|
if (!n) {
|
|
1040
1041
|
$((e) => e && {
|
|
@@ -1049,12 +1050,12 @@ var Y = ({ schema: e, dataSource: t, className: s, data: f, loading: p, onEventC
|
|
|
1049
1050
|
submitting: !0,
|
|
1050
1051
|
error: void 0
|
|
1051
1052
|
});
|
|
1052
|
-
let { startDateField: r, endDateField: i, titleField: a } =
|
|
1053
|
+
let { startDateField: r, endDateField: i, titleField: a } = q, o = {
|
|
1053
1054
|
[a || "name"]: n,
|
|
1054
1055
|
[r]: Q.start.toISOString()
|
|
1055
1056
|
};
|
|
1056
1057
|
i && (o[i] = (Q.end ?? Q.start).toISOString());
|
|
1057
|
-
let s =
|
|
1058
|
+
let s = z?.fields;
|
|
1058
1059
|
if (s && typeof s == "object") {
|
|
1059
1060
|
let e = Array.isArray(s) ? s.map((e) => [e.name ?? e.apiName, e]) : Object.entries(s);
|
|
1060
1061
|
for (let [t, n] of e) {
|
|
@@ -1072,7 +1073,7 @@ var Y = ({ schema: e, dataSource: t, className: s, data: f, loading: p, onEventC
|
|
|
1072
1073
|
}
|
|
1073
1074
|
try {
|
|
1074
1075
|
let n = await t.create(e.objectName, o), r = (n && (n.record || n.data || n)) ?? null;
|
|
1075
|
-
r && (r.id !== void 0 || r._id !== void 0) &&
|
|
1076
|
+
r && (r.id !== void 0 || r._id !== void 0) && N((e) => [...e, r]), $(null);
|
|
1076
1077
|
} catch (e) {
|
|
1077
1078
|
let t = e?.message || String(e);
|
|
1078
1079
|
$((e) => e && {
|
|
@@ -1083,84 +1084,84 @@ var Y = ({ schema: e, dataSource: t, className: s, data: f, loading: p, onEventC
|
|
|
1083
1084
|
}
|
|
1084
1085
|
}, [
|
|
1085
1086
|
Q,
|
|
1086
|
-
|
|
1087
|
+
q,
|
|
1087
1088
|
e.objectName,
|
|
1088
1089
|
t,
|
|
1089
|
-
|
|
1090
|
+
z
|
|
1090
1091
|
]);
|
|
1091
|
-
return
|
|
1092
|
+
return re ? /* @__PURE__ */ L("div", {
|
|
1092
1093
|
className: s,
|
|
1093
|
-
children: /* @__PURE__ */
|
|
1094
|
+
children: /* @__PURE__ */ L("div", {
|
|
1094
1095
|
className: "flex items-center justify-center h-96",
|
|
1095
|
-
children: /* @__PURE__ */
|
|
1096
|
+
children: /* @__PURE__ */ L("div", {
|
|
1096
1097
|
className: "text-muted-foreground",
|
|
1097
1098
|
children: "Loading calendar..."
|
|
1098
1099
|
})
|
|
1099
1100
|
})
|
|
1100
|
-
}) :
|
|
1101
|
+
}) : F ? /* @__PURE__ */ L("div", {
|
|
1101
1102
|
className: s,
|
|
1102
|
-
children: /* @__PURE__ */
|
|
1103
|
+
children: /* @__PURE__ */ L("div", {
|
|
1103
1104
|
className: "flex items-center justify-center h-96",
|
|
1104
|
-
children: /* @__PURE__ */
|
|
1105
|
+
children: /* @__PURE__ */ R("div", {
|
|
1105
1106
|
className: "text-destructive",
|
|
1106
|
-
children: ["Error: ",
|
|
1107
|
+
children: ["Error: ", F.message]
|
|
1107
1108
|
})
|
|
1108
1109
|
})
|
|
1109
|
-
}) :
|
|
1110
|
-
ref:
|
|
1110
|
+
}) : q ? /* @__PURE__ */ R("div", {
|
|
1111
|
+
ref: ge,
|
|
1111
1112
|
className: s,
|
|
1112
1113
|
children: [
|
|
1113
|
-
|
|
1114
|
+
G > 0 && /* @__PURE__ */ L("div", {
|
|
1114
1115
|
className: "flex items-center justify-center text-xs text-muted-foreground",
|
|
1115
|
-
style: { height:
|
|
1116
|
-
children:
|
|
1116
|
+
style: { height: G },
|
|
1117
|
+
children: W ? "Refreshing…" : "Pull to refresh"
|
|
1117
1118
|
}),
|
|
1118
|
-
/* @__PURE__ */
|
|
1119
|
+
/* @__PURE__ */ L("div", {
|
|
1119
1120
|
className: "bg-background h-[calc(100vh-120px)] sm:h-[calc(100vh-160px)] md:h-[calc(100vh-200px)] min-h-[400px] sm:min-h-[600px]",
|
|
1120
|
-
children: /* @__PURE__ */
|
|
1121
|
-
events:
|
|
1122
|
-
currentDate:
|
|
1123
|
-
view:
|
|
1124
|
-
locale:
|
|
1121
|
+
children: /* @__PURE__ */ L(pe, {
|
|
1122
|
+
events: be,
|
|
1123
|
+
currentDate: de,
|
|
1124
|
+
view: H,
|
|
1125
|
+
locale: A,
|
|
1125
1126
|
onEventClick: (e) => {
|
|
1126
|
-
Z.handleClick(e.data),
|
|
1127
|
+
Z.handleClick(e.data), xe || _?.(e.data);
|
|
1127
1128
|
},
|
|
1128
1129
|
onDateClick: (e) => {
|
|
1129
|
-
|
|
1130
|
+
y ? y(e) : Ce(e);
|
|
1130
1131
|
},
|
|
1131
1132
|
onNavigate: (e) => {
|
|
1132
|
-
|
|
1133
|
+
fe(e), x?.(e);
|
|
1133
1134
|
},
|
|
1134
1135
|
onViewChange: (e) => {
|
|
1135
|
-
|
|
1136
|
+
me(e), O?.(e);
|
|
1136
1137
|
},
|
|
1137
1138
|
onAddClick: void 0,
|
|
1138
1139
|
onEventDrop: (e, t, n) => {
|
|
1139
|
-
|
|
1140
|
+
k ? k(e.data, t, n) : Se(e.data, t, n);
|
|
1140
1141
|
},
|
|
1141
|
-
onTimeRangeSelect:
|
|
1142
|
+
onTimeRangeSelect: we
|
|
1142
1143
|
})
|
|
1143
1144
|
}),
|
|
1144
|
-
/* @__PURE__ */
|
|
1145
|
+
/* @__PURE__ */ L(S, {
|
|
1145
1146
|
open: !!Q,
|
|
1146
1147
|
onOpenChange: (e) => {
|
|
1147
1148
|
e || $(null);
|
|
1148
1149
|
},
|
|
1149
|
-
children: /* @__PURE__ */
|
|
1150
|
+
children: /* @__PURE__ */ R(C, {
|
|
1150
1151
|
className: "sm:max-w-md",
|
|
1151
1152
|
children: [
|
|
1152
|
-
/* @__PURE__ */
|
|
1153
|
-
let e = Q.end && Q.end.getTime() !== Q.start.getTime(), t = Q.start.toLocaleDateString(
|
|
1153
|
+
/* @__PURE__ */ R(E, { children: [/* @__PURE__ */ L(D, { children: "New event" }), /* @__PURE__ */ L(w, { children: Q && (() => {
|
|
1154
|
+
let e = Q.end && Q.end.getTime() !== Q.start.getTime(), t = Q.start.toLocaleDateString(A, {
|
|
1154
1155
|
year: "numeric",
|
|
1155
1156
|
month: "long",
|
|
1156
1157
|
day: "numeric"
|
|
1157
1158
|
});
|
|
1158
1159
|
if (e) {
|
|
1159
|
-
let e = (e) => e.toLocaleTimeString(
|
|
1160
|
+
let e = (e) => e.toLocaleTimeString(A, {
|
|
1160
1161
|
hour: "numeric",
|
|
1161
1162
|
minute: "2-digit"
|
|
1162
1163
|
});
|
|
1163
|
-
return /* @__PURE__ */ I
|
|
1164
|
+
return /* @__PURE__ */ R(I, { children: [
|
|
1164
1165
|
t,
|
|
1165
1166
|
" · ",
|
|
1166
1167
|
e(Q.start),
|
|
@@ -1168,16 +1169,16 @@ var Y = ({ schema: e, dataSource: t, className: s, data: f, loading: p, onEventC
|
|
|
1168
1169
|
e(Q.end)
|
|
1169
1170
|
] });
|
|
1170
1171
|
}
|
|
1171
|
-
return /* @__PURE__ */ I
|
|
1172
|
+
return /* @__PURE__ */ R(I, { children: ["On ", t] });
|
|
1172
1173
|
})() })] }),
|
|
1173
|
-
/* @__PURE__ */
|
|
1174
|
+
/* @__PURE__ */ R("div", {
|
|
1174
1175
|
className: "space-y-2",
|
|
1175
1176
|
children: [
|
|
1176
|
-
/* @__PURE__ */
|
|
1177
|
+
/* @__PURE__ */ L(te, {
|
|
1177
1178
|
htmlFor: "quick-create-title",
|
|
1178
1179
|
children: "Title"
|
|
1179
1180
|
}),
|
|
1180
|
-
/* @__PURE__ */
|
|
1181
|
+
/* @__PURE__ */ L(ee, {
|
|
1181
1182
|
id: "quick-create-title",
|
|
1182
1183
|
autoFocus: !0,
|
|
1183
1184
|
value: Q?.title ?? "",
|
|
@@ -1187,24 +1188,24 @@ var Y = ({ schema: e, dataSource: t, className: s, data: f, loading: p, onEventC
|
|
|
1187
1188
|
error: void 0
|
|
1188
1189
|
}),
|
|
1189
1190
|
onKeyDown: (e) => {
|
|
1190
|
-
e.key === "Enter" && !Q?.submitting && (e.preventDefault(),
|
|
1191
|
+
e.key === "Enter" && !Q?.submitting && (e.preventDefault(), Te());
|
|
1191
1192
|
},
|
|
1192
1193
|
placeholder: "What's this event about?",
|
|
1193
1194
|
disabled: Q?.submitting
|
|
1194
1195
|
}),
|
|
1195
|
-
Q?.error && /* @__PURE__ */
|
|
1196
|
+
Q?.error && /* @__PURE__ */ L("p", {
|
|
1196
1197
|
className: "text-sm text-destructive",
|
|
1197
1198
|
children: Q.error
|
|
1198
1199
|
})
|
|
1199
1200
|
]
|
|
1200
1201
|
}),
|
|
1201
|
-
/* @__PURE__ */
|
|
1202
|
+
/* @__PURE__ */ R(T, { children: [/* @__PURE__ */ L(b, {
|
|
1202
1203
|
variant: "outline",
|
|
1203
1204
|
onClick: () => $(null),
|
|
1204
1205
|
disabled: Q?.submitting,
|
|
1205
1206
|
children: "Cancel"
|
|
1206
|
-
}), /* @__PURE__ */
|
|
1207
|
-
onClick: () => void
|
|
1207
|
+
}), /* @__PURE__ */ L(b, {
|
|
1208
|
+
onClick: () => void Te(),
|
|
1208
1209
|
disabled: Q?.submitting || !Q?.title.trim(),
|
|
1209
1210
|
children: Q?.submitting ? "Creating…" : "Create"
|
|
1210
1211
|
})] })
|
|
@@ -1212,10 +1213,10 @@ var Y = ({ schema: e, dataSource: t, className: s, data: f, loading: p, onEventC
|
|
|
1212
1213
|
})
|
|
1213
1214
|
}),
|
|
1214
1215
|
Z.isOverlay && Z.isOpen && Z.selectedRecord && (() => {
|
|
1215
|
-
let n =
|
|
1216
|
+
let n = K?.provider === "object" ? K.object : e.objectName, r = Z.selectedRecord, i = r.id ?? r._id;
|
|
1216
1217
|
if (!n || i == null) return null;
|
|
1217
|
-
let a =
|
|
1218
|
-
return /* @__PURE__ */
|
|
1218
|
+
let a = q?.titleField ? String(r[q.titleField] ?? "Event Details") : "Event Details";
|
|
1219
|
+
return /* @__PURE__ */ L(se, {
|
|
1219
1220
|
open: !0,
|
|
1220
1221
|
onClose: Z.close,
|
|
1221
1222
|
title: a,
|
|
@@ -1223,26 +1224,26 @@ var Y = ({ schema: e, dataSource: t, className: s, data: f, loading: p, onEventC
|
|
|
1223
1224
|
objectName: n,
|
|
1224
1225
|
recordId: i,
|
|
1225
1226
|
dataSource: t,
|
|
1226
|
-
objectSchema:
|
|
1227
|
+
objectSchema: z,
|
|
1227
1228
|
width: Z.width ?? "min(960px, 60vw)",
|
|
1228
|
-
fullPageHref:
|
|
1229
|
+
fullPageHref: ce(n, i) ?? void 0,
|
|
1229
1230
|
onFieldSave: async (e, r) => {
|
|
1230
|
-
t?.update && (await t.update(n, String(i), { [e]: r }),
|
|
1231
|
+
t?.update && (await t.update(n, String(i), { [e]: r }), N((t) => t.map((t) => String(t.id ?? t._id) === String(i) ? {
|
|
1231
1232
|
...t,
|
|
1232
1233
|
[e]: r
|
|
1233
1234
|
} : t)));
|
|
1234
1235
|
},
|
|
1235
1236
|
onDelete: async () => {
|
|
1236
|
-
t?.delete && (await t.delete(n, String(i)),
|
|
1237
|
+
t?.delete && (await t.delete(n, String(i)), N((e) => e.filter((e) => String(e.id ?? e._id) !== String(i))));
|
|
1237
1238
|
}
|
|
1238
1239
|
});
|
|
1239
1240
|
})()
|
|
1240
1241
|
]
|
|
1241
|
-
}) : /* @__PURE__ */
|
|
1242
|
+
}) : /* @__PURE__ */ L("div", {
|
|
1242
1243
|
className: s,
|
|
1243
|
-
children: /* @__PURE__ */
|
|
1244
|
+
children: /* @__PURE__ */ L("div", {
|
|
1244
1245
|
className: "flex items-center justify-center h-96",
|
|
1245
|
-
children: /* @__PURE__ */
|
|
1246
|
+
children: /* @__PURE__ */ L("div", {
|
|
1246
1247
|
className: "text-muted-foreground",
|
|
1247
1248
|
children: "Calendar configuration required. Please specify startDateField and titleField."
|
|
1248
1249
|
})
|
|
@@ -1251,7 +1252,7 @@ var Y = ({ schema: e, dataSource: t, className: s, data: f, loading: p, onEventC
|
|
|
1251
1252
|
};
|
|
1252
1253
|
//#endregion
|
|
1253
1254
|
//#region src/calendar-view-renderer.tsx
|
|
1254
|
-
s.register("calendar-view", ({ schema: e, className: n, onAction: r, ...i }) => /* @__PURE__ */
|
|
1255
|
+
s.register("calendar-view", ({ schema: e, className: n, onAction: r, ...i }) => /* @__PURE__ */ L(pe, {
|
|
1255
1256
|
className: n,
|
|
1256
1257
|
events: t.useMemo(() => !e.data || !Array.isArray(e.data) ? [] : e.data.map((t, n) => {
|
|
1257
1258
|
let r = e.titleField || "title", i = e.startDateField || "start", a = e.endDateField || "end", o = e.colorField || "color", s = e.allDayField || "allDay";
|
|
@@ -1400,8 +1401,8 @@ s.register("calendar-view", ({ schema: e, className: n, onAction: r, ...i }) =>
|
|
|
1400
1401
|
//#endregion
|
|
1401
1402
|
//#region src/index.tsx
|
|
1402
1403
|
var X = ({ schema: e, ...t }) => {
|
|
1403
|
-
let { dataSource: n } =
|
|
1404
|
-
return /* @__PURE__ */
|
|
1404
|
+
let { dataSource: n } = h() || {};
|
|
1405
|
+
return /* @__PURE__ */ L(be, {
|
|
1405
1406
|
schema: e,
|
|
1406
1407
|
dataSource: n,
|
|
1407
1408
|
...t
|
|
@@ -1439,4 +1440,4 @@ s.register("object-calendar", X, {
|
|
|
1439
1440
|
}]
|
|
1440
1441
|
});
|
|
1441
1442
|
//#endregion
|
|
1442
|
-
export {
|
|
1443
|
+
export { pe as CalendarView, be as ObjectCalendar, X as ObjectCalendarRenderer };
|