@object-ui/plugin-calendar 11.2.0 → 11.3.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/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
- import { ComponentRegistry as s, buildExpandFields as c, extractRecords as l } from "@object-ui/core";
4
- import { useNavigationOverlay as u, useSchemaContext as d } from "@object-ui/react";
5
- import { CalendarIcon as f, ChevronLeftIcon as p, ChevronRightIcon as m, PlusIcon as h } from "lucide-react";
6
- import { Button as g, Calendar as _, Dialog as v, DialogContent as y, DialogDescription as b, DialogFooter as x, DialogHeader as S, DialogTitle as C, Input as w, Label as T, Popover as E, PopoverContent as D, PopoverTrigger as O, Select as k, SelectContent as A, SelectItem as j, SelectTrigger as ee, SelectValue as M, cn as N, useIsMobile as P } from "@object-ui/components";
7
- import { useObjectTranslation as F } from "@object-ui/i18n";
8
- import { Fragment as te, jsx as I, jsxs as L } from "react/jsx-runtime";
9
- import { usePullToRefresh as ne } from "@object-ui/mobile";
10
- import { RecordDetailDrawer as re, deriveRecordPageHref as ie } from "@object-ui/plugin-detail";
3
+ import { ComponentRegistry as s, buildExpandFields as c, extractRecords as l, getRecordDisplayName as u } from "@object-ui/core";
4
+ import { useNavigationOverlay as d, useSchemaContext as f } from "@object-ui/react";
5
+ import { CalendarIcon as p, ChevronLeftIcon as m, ChevronRightIcon as h, PlusIcon as g } from "lucide-react";
6
+ import { Button as _, Calendar as v, Dialog as y, DialogContent as b, DialogDescription as x, DialogFooter as S, DialogHeader as C, DialogTitle as w, Input as T, Label as E, Popover as D, PopoverContent as O, PopoverTrigger as k, Select as A, SelectContent as j, SelectItem as M, SelectTrigger as ee, SelectValue as N, cn as P, useIsMobile as te } from "@object-ui/components";
7
+ import { useObjectTranslation as ne } from "@object-ui/i18n";
8
+ import { Fragment as re, jsx as F, jsxs as I } from "react/jsx-runtime";
9
+ import { usePullToRefresh as ie } from "@object-ui/mobile";
10
+ import { RecordDetailDrawer as ae, deriveRecordPageHref as L } from "@object-ui/plugin-detail";
11
11
  //#region src/CalendarView.tsx
12
- var R = "bg-blue-100 text-blue-900 border border-blue-200", ae = /* @__PURE__ */ new Date(), z = [
12
+ var R = "bg-blue-100 text-blue-900 border border-blue-200", oe = /* @__PURE__ */ new Date(), z = [
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,14 +18,14 @@ var R = "bg-blue-100 text-blue-900 border border-blue-200", ae = /* @__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
- ], oe = /^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i, se = /(^|\s)(bg|text|from|to|via)-/;
21
+ ], se = /^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i, ce = /(^|\s)(bg|text|from|to|via)-/;
22
22
  function B(e) {
23
23
  if (!e) return { className: R };
24
- if (oe.test(e)) return {
24
+ if (se.test(e)) return {
25
25
  className: "text-white",
26
26
  inlineColor: e
27
27
  };
28
- if (se.test(e)) return { className: e };
28
+ if (ce.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
31
  return { className: z[Math.abs(t) % z.length] };
@@ -41,7 +41,7 @@ var V = {
41
41
  };
42
42
  function H() {
43
43
  try {
44
- let e = F();
44
+ let e = ne();
45
45
  return e.t("calendar.today") === "calendar.today" ? {
46
46
  t: (e, t) => {
47
47
  let n = V[e] || e;
@@ -64,102 +64,102 @@ function H() {
64
64
  };
65
65
  }
66
66
  }
67
- function ce({ events: t = [], view: n = "month", currentDate: r = ae, locale: i = "default", onEventClick: a, onDateClick: o, onViewChange: s, onNavigate: c, onAddClick: l, onEventDrop: u, onTimeRangeSelect: d, slotMinutes: v = 30, className: y }) {
68
- let [b, x] = e.useState(n), [S, C] = e.useState(r), { t: w, language: T } = H(), P = i === "default" ? T : i;
67
+ function le({ events: t = [], view: n = "month", currentDate: r = oe, locale: i = "default", onEventClick: a, onDateClick: o, onViewChange: s, onNavigate: c, onAddClick: l, onEventDrop: u, onTimeRangeSelect: d, slotMinutes: f = 30, className: y }) {
68
+ let [b, x] = 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
  x(n);
73
73
  }, [n]);
74
- let F = e.useRef(s);
75
- F.current = s, e.useEffect(() => {
74
+ let te = e.useRef(s);
75
+ te.current = s, e.useEffect(() => {
76
76
  let e = window.matchMedia("(max-width: 639px)"), t = (e) => {
77
- e.matches && (x("day"), F.current?.("day"));
77
+ e.matches && (x("day"), te.current?.("day"));
78
78
  };
79
79
  return t(e), e.addEventListener("change", t), () => e.removeEventListener("change", t);
80
80
  }, []);
81
- let te = () => {
81
+ let ne = () => {
82
82
  let e = new Date(S);
83
83
  b === "month" ? e.setMonth(e.getMonth() - 1) : b === "week" ? e.setDate(e.getDate() - 7) : e.setDate(e.getDate() - 1), C(e), c?.(e);
84
- }, ne = () => {
84
+ }, re = () => {
85
85
  let e = new Date(S);
86
86
  b === "month" ? e.setMonth(e.getMonth() + 1) : b === "week" ? e.setDate(e.getDate() + 7) : e.setDate(e.getDate() + 1), C(e), c?.(e);
87
- }, re = () => {
87
+ }, ie = () => {
88
88
  let e = /* @__PURE__ */ new Date();
89
89
  C(e), c?.(e);
90
- }, ie = (e) => {
90
+ }, ae = (e) => {
91
91
  x(e), s?.(e);
92
- }, R = () => {
93
- if (b === "month") return S.toLocaleDateString(P, {
92
+ }, L = () => {
93
+ if (b === "month") return S.toLocaleDateString(E, {
94
94
  month: "long",
95
95
  year: "numeric"
96
96
  });
97
97
  if (b === "week") {
98
- let e = le(S), t = new Date(e);
99
- return t.setDate(t.getDate() + 6), `${e.toLocaleDateString(P, {
98
+ let e = ue(S), t = new Date(e);
99
+ return t.setDate(t.getDate() + 6), `${e.toLocaleDateString(E, {
100
100
  month: "short",
101
101
  day: "numeric"
102
- })} - ${t.toLocaleDateString(P, {
102
+ })} - ${t.toLocaleDateString(E, {
103
103
  month: "short",
104
104
  day: "numeric",
105
105
  year: "numeric"
106
106
  })}`;
107
- } else return S.toLocaleDateString(P, {
107
+ } else return S.toLocaleDateString(E, {
108
108
  weekday: "long",
109
109
  month: "long",
110
110
  day: "numeric",
111
111
  year: "numeric"
112
112
  });
113
- }, z = e.useRef(0);
114
- return /* @__PURE__ */ L("div", {
113
+ }, R = e.useRef(0);
114
+ return /* @__PURE__ */ I("div", {
115
115
  role: "region",
116
116
  "aria-label": "Calendar",
117
- className: N("flex flex-col h-full bg-background min-w-0 overflow-hidden", y),
118
- children: [/* @__PURE__ */ L("div", {
117
+ className: P("flex flex-col h-full bg-background min-w-0 overflow-hidden", y),
118
+ children: [/* @__PURE__ */ I("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__ */ L("div", {
120
+ children: [/* @__PURE__ */ I("div", {
121
121
  className: "flex items-center gap-4",
122
- children: [/* @__PURE__ */ L("div", {
122
+ children: [/* @__PURE__ */ I("div", {
123
123
  className: "flex items-center bg-muted/50 rounded-lg p-1 gap-1",
124
124
  children: [
125
- /* @__PURE__ */ I(g, {
125
+ /* @__PURE__ */ F(_, {
126
126
  variant: "ghost",
127
127
  size: "sm",
128
- onClick: re,
128
+ onClick: ie,
129
129
  className: "h-8",
130
130
  "aria-label": "Go to today",
131
131
  children: w("calendar.today")
132
132
  }),
133
- /* @__PURE__ */ I("div", { className: "h-4 w-px bg-border mx-1" }),
134
- /* @__PURE__ */ I(g, {
133
+ /* @__PURE__ */ F("div", { className: "h-4 w-px bg-border mx-1" }),
134
+ /* @__PURE__ */ F(_, {
135
135
  variant: "ghost",
136
136
  size: "icon",
137
137
  "aria-label": "Previous period",
138
- onClick: te,
138
+ onClick: ne,
139
139
  className: "h-8 w-8",
140
- children: /* @__PURE__ */ I(p, { className: "h-4 w-4" })
140
+ children: /* @__PURE__ */ F(m, { className: "h-4 w-4" })
141
141
  }),
142
- /* @__PURE__ */ I(g, {
142
+ /* @__PURE__ */ F(_, {
143
143
  variant: "ghost",
144
144
  size: "icon",
145
145
  "aria-label": "Next period",
146
- onClick: ne,
146
+ onClick: re,
147
147
  className: "h-8 w-8",
148
- children: /* @__PURE__ */ I(m, { className: "h-4 w-4" })
148
+ children: /* @__PURE__ */ F(h, { className: "h-4 w-4" })
149
149
  })
150
150
  ]
151
- }), /* @__PURE__ */ L(E, { children: [/* @__PURE__ */ I(O, {
151
+ }), /* @__PURE__ */ I(D, { children: [/* @__PURE__ */ F(k, {
152
152
  asChild: !0,
153
- children: /* @__PURE__ */ L(g, {
153
+ children: /* @__PURE__ */ I(_, {
154
154
  variant: "ghost",
155
- "aria-label": `Current date: ${R()}`,
156
- className: N("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__ */ I(f, { className: "h-5 w-5 text-muted-foreground" }), /* @__PURE__ */ I("span", { children: R() })]
155
+ "aria-label": `Current date: ${L()}`,
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__ */ F(p, { className: "h-5 w-5 text-muted-foreground" }), /* @__PURE__ */ F("span", { children: L() })]
158
158
  })
159
- }), /* @__PURE__ */ I(D, {
159
+ }), /* @__PURE__ */ F(O, {
160
160
  className: "w-auto p-0",
161
161
  align: "start",
162
- children: /* @__PURE__ */ I(_, {
162
+ children: /* @__PURE__ */ F(v, {
163
163
  mode: "single",
164
164
  selected: S,
165
165
  onSelect: (e) => {
@@ -170,72 +170,72 @@ function ce({ events: t = [], view: n = "month", currentDate: r = ae, locale: i
170
170
  endMonth: new Date(2050, 11)
171
171
  })
172
172
  })] })]
173
- }), /* @__PURE__ */ L("div", {
173
+ }), /* @__PURE__ */ I("div", {
174
174
  className: "flex items-center gap-2",
175
- children: [/* @__PURE__ */ L(k, {
175
+ children: [/* @__PURE__ */ I(A, {
176
176
  value: b,
177
- onValueChange: ie,
178
- children: [/* @__PURE__ */ I(ee, {
177
+ onValueChange: ae,
178
+ children: [/* @__PURE__ */ F(ee, {
179
179
  className: "w-32 bg-background",
180
- children: /* @__PURE__ */ I(M, {})
181
- }), /* @__PURE__ */ L(A, { children: [
182
- /* @__PURE__ */ I(j, {
180
+ children: /* @__PURE__ */ F(N, {})
181
+ }), /* @__PURE__ */ I(j, { children: [
182
+ /* @__PURE__ */ F(M, {
183
183
  value: "day",
184
184
  children: w("calendar.day")
185
185
  }),
186
- /* @__PURE__ */ I(j, {
186
+ /* @__PURE__ */ F(M, {
187
187
  value: "week",
188
188
  children: w("calendar.week")
189
189
  }),
190
- /* @__PURE__ */ I(j, {
190
+ /* @__PURE__ */ F(M, {
191
191
  value: "month",
192
192
  children: w("calendar.month")
193
193
  })
194
194
  ] })]
195
- }), l && /* @__PURE__ */ L(g, {
195
+ }), l && /* @__PURE__ */ I(_, {
196
196
  onClick: l,
197
197
  size: "sm",
198
198
  className: "gap-1",
199
- children: [/* @__PURE__ */ I(h, { className: "h-4 w-4" }), w("calendar.newEvent")]
199
+ children: [/* @__PURE__ */ F(g, { className: "h-4 w-4" }), w("calendar.newEvent")]
200
200
  })]
201
201
  })]
202
- }), /* @__PURE__ */ L("div", {
202
+ }), /* @__PURE__ */ I("div", {
203
203
  className: "flex-1 overflow-auto",
204
204
  onTouchStart: (e) => {
205
- z.current = e.touches[0].clientX;
205
+ R.current = e.touches[0].clientX;
206
206
  },
207
207
  onTouchEnd: (e) => {
208
- let t = z.current - e.changedTouches[0].clientX;
208
+ let t = R.current - e.changedTouches[0].clientX;
209
209
  if (Math.abs(t) > 50) {
210
210
  let e = new Date(S);
211
211
  b === "day" ? e.setDate(e.getDate() + (t > 0 ? 1 : -1)) : b === "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
- b === "month" && /* @__PURE__ */ I(fe, {
215
+ b === "month" && /* @__PURE__ */ F(pe, {
216
216
  date: S,
217
217
  events: t,
218
- locale: P,
218
+ locale: E,
219
219
  onEventClick: a,
220
220
  onDateClick: o,
221
221
  onEventDrop: u
222
222
  }),
223
- b === "week" && /* @__PURE__ */ I(q, {
223
+ b === "week" && /* @__PURE__ */ F(q, {
224
224
  mode: "week",
225
225
  date: S,
226
226
  events: t,
227
- locale: P,
228
- slotMinutes: v,
227
+ locale: E,
228
+ slotMinutes: f,
229
229
  onEventClick: a,
230
230
  onEventDrop: u,
231
231
  onTimeRangeSelect: d
232
232
  }),
233
- b === "day" && /* @__PURE__ */ I(q, {
233
+ b === "day" && /* @__PURE__ */ F(q, {
234
234
  mode: "day",
235
235
  date: S,
236
236
  events: t,
237
- locale: P,
238
- slotMinutes: v,
237
+ locale: E,
238
+ slotMinutes: f,
239
239
  onEventClick: a,
240
240
  onEventDrop: u,
241
241
  onTimeRangeSelect: d
@@ -244,11 +244,11 @@ function ce({ events: t = [], view: n = "month", currentDate: r = ae, locale: i
244
244
  })]
245
245
  });
246
246
  }
247
- function le(e) {
247
+ function ue(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 ue(e) {
251
+ function de(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 ue(e) {
262
262
  }
263
263
  return o;
264
264
  }
265
- function de(e, t) {
265
+ function fe(e, t) {
266
266
  return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
267
267
  }
268
- function fe({ date: t, events: n, locale: r = "default", onEventClick: i, onDateClick: a, onEventDrop: o }) {
269
- let s = e.useMemo(() => ue(t), [t.getFullYear(), t.getMonth()]), c = e.useMemo(() => /* @__PURE__ */ new Date(), []), { t: l } = H(), u = e.useMemo(() => {
268
+ function pe({ date: t, events: n, locale: r = "default", onEventClick: i, onDateClick: a, onEventDrop: o }) {
269
+ let s = e.useMemo(() => de(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 fe({ 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__ */ L("div", {
340
+ return /* @__PURE__ */ I("div", {
341
341
  className: "flex flex-col h-full",
342
- children: [/* @__PURE__ */ I("div", {
342
+ children: [/* @__PURE__ */ F("div", {
343
343
  role: "row",
344
344
  className: "grid grid-cols-7 border-b",
345
- children: u.map((e) => /* @__PURE__ */ I("div", {
345
+ children: u.map((e) => /* @__PURE__ */ F("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__ */ I("div", {
350
+ }), /* @__PURE__ */ F("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 = de(e, c);
356
- return /* @__PURE__ */ L("div", {
355
+ let r = `${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`, s = h.get(r) || [], u = e.getMonth() === t.getMonth(), f = fe(e, c);
356
+ return /* @__PURE__ */ I("div", {
357
357
  role: "gridcell",
358
358
  "aria-label": `${e.toLocaleDateString("default", {
359
359
  weekday: "long",
@@ -361,32 +361,32 @@ function fe({ date: t, events: n, locale: r = "default", onEventClick: i, onDate
361
361
  day: "numeric",
362
362
  year: "numeric"
363
363
  })}${s.length > 0 ? `, ${s.length} event${s.length > 1 ? "s" : ""}` : ""}`,
364
- className: N("border-b border-r last:border-r-0 p-2 min-h-[100px] cursor-pointer hover:bg-accent/50", !u && "bg-muted/50 text-muted-foreground opacity-50", p === n && "ring-2 ring-primary"),
364
+ className: P("border-b border-r last:border-r-0 p-2 min-h-[100px] cursor-pointer hover:bg-accent/50", !u && "bg-muted/50 text-muted-foreground opacity-50", p === n && "ring-2 ring-primary"),
365
365
  onClick: () => a?.(e),
366
366
  onDragOver: (e) => v(e, n),
367
367
  onDragLeave: y,
368
368
  onDrop: (t) => b(t, e),
369
- children: [/* @__PURE__ */ I("div", {
370
- className: N("text-sm font-medium mb-2", f && "inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground h-6 w-6"),
369
+ children: [/* @__PURE__ */ F("div", {
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__ */ L("div", {
373
+ }), /* @__PURE__ */ I("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__ */ L("div", {
377
+ return /* @__PURE__ */ I("div", {
378
378
  role: "button",
379
379
  title: t.title,
380
380
  "aria-label": t.title,
381
381
  draggable: !!o,
382
382
  onDragStart: (n) => g(n, t, "move", e),
383
383
  onDragEnd: _,
384
- className: N("relative text-xs hover:opacity-80 truncate", o ? "cursor-move" : "cursor-pointer", c ? "h-1.5" : "px-2 py-0.5", r ? "rounded-l" : "rounded-l-none", a ? "rounded-r" : "rounded-r-none", !a && "-mr-2", l, d === t.id && "opacity-50"),
384
+ className: P("relative text-xs hover:opacity-80 truncate", o ? "cursor-move" : "cursor-pointer", c ? "h-1.5" : "px-2 py-0.5", r ? "rounded-l" : "rounded-l-none", a ? "rounded-r" : "rounded-r-none", !a && "-mr-2", l, d === t.id && "opacity-50"),
385
385
  style: u ? { backgroundColor: u } : void 0,
386
386
  onClick: (e) => {
387
387
  e.stopPropagation(), i?.(t);
388
388
  },
389
- children: [c ? "" : t.title, f && /* @__PURE__ */ I("span", {
389
+ children: [c ? "" : t.title, f && /* @__PURE__ */ F("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 fe({ 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__ */ I("div", {
400
+ }), s.length > 4 && /* @__PURE__ */ F("div", {
401
401
  className: "text-xs text-muted-foreground px-2",
402
402
  children: l("calendar.moreEvents", { count: s.length - 4 })
403
403
  })]
@@ -421,7 +421,7 @@ function K(e) {
421
421
  function q({ mode: t, date: n, events: r, locale: i = "default", slotMinutes: a = 30, onEventClick: o, onEventDrop: s, onTimeRangeSelect: c }) {
422
422
  let { t: l } = H(), u = U * a / 60, d = U * 24, f = e.useMemo(() => {
423
423
  if (t === "day") return [W(n)];
424
- let e = le(n);
424
+ let e = ue(n);
425
425
  return Array.from({ length: 7 }, (t, n) => {
426
426
  let r = new Date(e);
427
427
  return r.setDate(e.getDate() + n), W(r);
@@ -597,7 +597,7 @@ function q({ mode: t, date: n, events: r, locale: i = "default", slotMinutes: a
597
597
  weekday: e.toLocaleDateString(i, { weekday: "short" }),
598
598
  day: e.getDate(),
599
599
  month: e.toLocaleDateString(i, { month: "short" }),
600
- isToday: de(e, p)
600
+ isToday: fe(e, p)
601
601
  })), [
602
602
  f,
603
603
  i,
@@ -636,18 +636,18 @@ function q({ mode: t, date: n, events: r, locale: i = "default", slotMinutes: a
636
636
  anchorMinutes: n,
637
637
  headMinutes: n
638
638
  });
639
- }, ee = (e) => {
639
+ }, M = (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__ */ I("div", {
643
+ return /* @__PURE__ */ F("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
646
  top: t / 60 * U,
647
647
  height: Math.max(u, (n - t) / 60 * U)
648
648
  },
649
649
  "aria-hidden": !0,
650
- children: /* @__PURE__ */ I("div", {
650
+ children: /* @__PURE__ */ F("div", {
651
651
  className: "px-2 py-0.5 text-xs font-medium text-primary",
652
652
  children: J(f[e], t, n, i)
653
653
  })
@@ -655,14 +655,14 @@ function q({ mode: t, date: n, events: r, locale: i = "default", slotMinutes: a
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__ */ I("div", {
658
+ return /* @__PURE__ */ F("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
661
  top: n / 60 * U,
662
662
  height: S.durationMin / 60 * U
663
663
  },
664
664
  "aria-hidden": !0,
665
- children: /* @__PURE__ */ I("div", {
665
+ children: /* @__PURE__ */ F("div", {
666
666
  className: "px-2 py-0.5 text-xs font-medium text-primary",
667
667
  children: J(f[e], n, n + S.durationMin, i)
668
668
  })
@@ -670,14 +670,14 @@ function q({ mode: t, date: n, events: r, locale: i = "default", slotMinutes: a
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__ */ I("div", {
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__ */ F("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
676
  top: t / 60 * U,
677
677
  height: (n - t) / 60 * U
678
678
  },
679
679
  "aria-hidden": !0,
680
- children: /* @__PURE__ */ I("div", {
680
+ children: /* @__PURE__ */ F("div", {
681
681
  className: "px-2 py-0.5 text-xs font-medium text-primary",
682
682
  children: J(f[e], t, n, i)
683
683
  })
@@ -685,45 +685,45 @@ function q({ mode: t, date: n, events: r, locale: i = "default", slotMinutes: a
685
685
  }
686
686
  return null;
687
687
  };
688
- return /* @__PURE__ */ L("div", {
688
+ return /* @__PURE__ */ I("div", {
689
689
  className: "flex flex-col h-full",
690
690
  ref: b,
691
691
  children: [
692
- /* @__PURE__ */ L("div", {
692
+ /* @__PURE__ */ I("div", {
693
693
  className: "flex border-b sticky top-0 bg-background z-20",
694
- children: [/* @__PURE__ */ I("div", {
694
+ children: [/* @__PURE__ */ F("div", {
695
695
  className: "w-14 shrink-0 border-r",
696
696
  "aria-hidden": !0
697
- }), O.map((e, t) => /* @__PURE__ */ L("div", {
697
+ }), O.map((e, t) => /* @__PURE__ */ I("div", {
698
698
  role: "columnheader",
699
- className: N("flex-1 p-2 text-center text-sm border-r last:border-r-0", e.isToday && "bg-primary/5"),
700
- children: [/* @__PURE__ */ I("div", {
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__ */ F("div", {
701
701
  className: "text-xs text-muted-foreground",
702
702
  children: e.weekday
703
- }), /* @__PURE__ */ I("div", {
704
- className: N("font-medium", e.isToday && "inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground h-6 w-6 mx-auto"),
703
+ }), /* @__PURE__ */ F("div", {
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__ */ L("div", {
709
+ h.length > 0 && /* @__PURE__ */ I("div", {
710
710
  className: "flex border-b bg-muted/20 max-h-[140px] overflow-y-auto",
711
- children: [/* @__PURE__ */ I("div", {
711
+ children: [/* @__PURE__ */ F("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
715
  let t = K(e);
716
- return /* @__PURE__ */ I("div", {
716
+ return /* @__PURE__ */ F("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__ */ I("div", {
720
+ return /* @__PURE__ */ F("div", {
721
721
  role: "button",
722
722
  title: e.title,
723
723
  onClick: (t) => {
724
724
  t.stopPropagation(), o?.(e);
725
725
  },
726
- className: N("text-[11px] px-2 py-0.5 truncate cursor-pointer hover:opacity-80", t ? "rounded-l" : "rounded-l-none -ml-0.5", n ? "rounded-r" : "rounded-r-none -mr-0.5", i),
726
+ className: P("text-[11px] px-2 py-0.5 truncate cursor-pointer hover:opacity-80", t ? "rounded-l" : "rounded-l-none -ml-0.5", n ? "rounded-r" : "rounded-r-none -mr-0.5", i),
727
727
  style: a ? { backgroundColor: a } : void 0,
728
728
  children: t ? e.title : "\xA0"
729
729
  }, `${e.id}-${r}`);
@@ -731,21 +731,21 @@ function q({ mode: t, date: n, events: r, locale: i = "default", slotMinutes: a
731
731
  }, t);
732
732
  })]
733
733
  }),
734
- /* @__PURE__ */ I("div", {
734
+ /* @__PURE__ */ F("div", {
735
735
  className: "flex-1 overflow-auto",
736
- children: /* @__PURE__ */ L("div", {
736
+ children: /* @__PURE__ */ I("div", {
737
737
  className: "flex",
738
738
  style: { height: d },
739
- children: [/* @__PURE__ */ I("div", {
739
+ children: [/* @__PURE__ */ F("div", {
740
740
  className: "w-14 shrink-0 border-r relative",
741
- children: k.map((e, t) => /* @__PURE__ */ I("div", {
741
+ children: k.map((e, t) => /* @__PURE__ */ F("div", {
742
742
  className: "absolute right-1 text-[10px] text-muted-foreground -translate-y-1/2",
743
743
  style: { top: t * U },
744
744
  children: t === 0 ? "" : e
745
745
  }, t))
746
746
  }), f.map((e, t) => {
747
747
  let n = K(e), r = y.get(n) ?? [];
748
- return /* @__PURE__ */ L("div", {
748
+ return /* @__PURE__ */ I("div", {
749
749
  ref: (e) => {
750
750
  x.current[t] = e;
751
751
  },
@@ -759,20 +759,20 @@ 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__ */ I("div", {
762
+ Array.from({ length: 24 }, (e, t) => /* @__PURE__ */ F("div", {
763
763
  className: "absolute left-0 right-0 border-t border-muted/60 pointer-events-none",
764
764
  style: { top: t * U }
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__ */ I("div", {
768
+ return n % 60 == 0 ? null : /* @__PURE__ */ F("div", {
769
769
  className: "absolute left-0 right-0 border-t border-dashed border-muted/30 pointer-events-none",
770
770
  style: { top: n / 60 * U }
771
771
  }, t);
772
772
  }),
773
773
  r.map((n) => {
774
774
  let r = n.startMin / 60 * U, a = Math.max(u, (n.endMin - n.startMin) / 60 * U), 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__ */ L("div", {
775
+ return /* @__PURE__ */ I("div", {
776
776
  role: "button",
777
777
  tabIndex: 0,
778
778
  title: n.event.title,
@@ -785,7 +785,7 @@ function q({ mode: t, date: n, events: r, locale: i = "default", slotMinutes: a
785
785
  }
786
786
  e.stopPropagation(), o?.(n.event);
787
787
  },
788
- className: N("absolute rounded text-xs px-2 py-1 overflow-hidden shadow-sm", s ? "cursor-move" : "cursor-pointer", d, p && "opacity-40"),
788
+ className: P("absolute rounded text-xs px-2 py-1 overflow-hidden shadow-sm", s ? "cursor-move" : "cursor-pointer", d, p && "opacity-40"),
789
789
  style: {
790
790
  top: r,
791
791
  height: a,
@@ -794,20 +794,20 @@ 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__ */ I("div", {
797
+ /* @__PURE__ */ F("div", {
798
798
  className: "font-medium truncate",
799
799
  children: n.event.title
800
800
  }),
801
- /* @__PURE__ */ I("div", {
801
+ /* @__PURE__ */ F("div", {
802
802
  className: "text-[10px] opacity-80 truncate",
803
803
  children: J(e, n.startMin, n.endMin, i)
804
804
  }),
805
- s && n.isStart && /* @__PURE__ */ I("div", {
805
+ s && n.isStart && /* @__PURE__ */ F("div", {
806
806
  onPointerDown: (e) => A(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__ */ I("div", {
810
+ s && n.isEnd && /* @__PURE__ */ F("div", {
811
811
  onPointerDown: (e) => A(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"
@@ -815,7 +815,7 @@ function q({ mode: t, date: n, events: r, locale: i = "default", slotMinutes: a
815
815
  ]
816
816
  }, `${n.event.id}-${n.startMin}`);
817
817
  }),
818
- ee(t)
818
+ M(t)
819
819
  ]
820
820
  }, n);
821
821
  })]
@@ -837,7 +837,7 @@ function J(e, t, n, r) {
837
837
  }
838
838
  //#endregion
839
839
  //#region src/ObjectCalendar.tsx
840
- function pe(e) {
840
+ function me(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 pe(e) {
846
846
  object: e.objectName
847
847
  } : null;
848
848
  }
849
- function me(e) {
849
+ function he(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 me(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 he(e) {
858
+ function ge(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,34 +864,34 @@ function he(e) {
864
864
  allDayField: e.allDayField
865
865
  } : null;
866
866
  }
867
- var Y = ({ schema: e, dataSource: t, className: s, data: d, loading: f, onEventClick: p, onRowClick: m, onDateClick: h, onNavigate: _, onViewChange: E, onEventDrop: D, locale: O }) => {
868
- let k = Array.isArray(d), [A, j] = o(k ? d : []), [ee, M] = o(k ? f ?? !1 : !0), [N, F] = o(null), [R, ae] = o(null), [z, oe] = o(/* @__PURE__ */ new Date()), se = P(), B = e.defaultView, [V, H] = o(() => {
867
+ var Y = ({ schema: e, dataSource: t, className: s, data: f, loading: p, onEventClick: m, onRowClick: h, onDateClick: g, onNavigate: v, onViewChange: D, onEventDrop: O, locale: k }) => {
868
+ let A = Array.isArray(f), [j, M] = o(A ? f : []), [ee, N] = o(A ? p ?? !1 : !0), [P, ne] = o(null), [R, oe] = o(null), [z, se] = o(/* @__PURE__ */ new Date()), ce = te(), B = e.defaultView, [V, H] = o(() => {
869
869
  let e = B === "day" || !B;
870
870
  return typeof window < "u" && window.innerWidth < 768 && e ? "month" : B || "month";
871
871
  });
872
872
  r(() => {
873
- se && V === "day" && (B === "day" || !B) && H("month");
874
- }, [se]);
875
- let [le, ue] = o(0);
873
+ ce && V === "day" && (B === "day" || !B) && H("month");
874
+ }, [ce]);
875
+ let [ue, de] = o(0);
876
876
  r(() => {
877
- if (!k && !(!t?.onMutation || !e.objectName)) return t.onMutation((t) => {
878
- t.resource === e.objectName && ue((e) => e + 1);
877
+ if (!A && !(!t?.onMutation || !e.objectName)) return t.onMutation((t) => {
878
+ t.resource === e.objectName && de((e) => e + 1);
879
879
  });
880
880
  }, [
881
881
  t,
882
882
  e.objectName,
883
- k
883
+ A
884
884
  ]);
885
- let { ref: de, isRefreshing: fe, pullDistance: U } = ne({
885
+ let { ref: fe, isRefreshing: pe, pullDistance: U } = ie({
886
886
  onRefresh: n(async () => {
887
- ue((e) => e + 1);
887
+ de((e) => e + 1);
888
888
  }, []),
889
889
  enabled: !!t && !!e.objectName
890
- }), W = i(() => pe(e), [
890
+ }), W = i(() => me(e), [
891
891
  e.data,
892
892
  e.staticData,
893
893
  e.objectName
894
- ]), G = i(() => he(e), [
894
+ ]), G = i(() => ge(e), [
895
895
  e.filter,
896
896
  e.calendar,
897
897
  e.dateField,
@@ -900,50 +900,50 @@ var Y = ({ schema: e, dataSource: t, className: s, data: d, loading: f, onEventC
900
900
  e.colorField
901
901
  ]), K = W?.provider === "value", q = a(null);
902
902
  q.current = R, r(() => {
903
- k && j(d);
904
- }, [d, k]), r(() => {
905
- k && f !== void 0 && M(f);
906
- }, [f, k]), r(() => {
907
- if (k) return;
903
+ A && M(f);
904
+ }, [f, A]), r(() => {
905
+ A && p !== void 0 && N(p);
906
+ }, [p, A]), r(() => {
907
+ if (A) return;
908
908
  let n = !0;
909
909
  return (async () => {
910
910
  try {
911
911
  if (!n) return;
912
- if (M(!0), K && W?.provider === "value") {
913
- n && (j(W.items), M(!1));
912
+ if (N(!0), K && W?.provider === "value") {
913
+ n && (M(W.items), N(!1));
914
914
  return;
915
915
  }
916
916
  if (!t || typeof t.find != "function") throw Error("DataSource required for object/api providers");
917
917
  if (W?.provider === "object") {
918
918
  let r = W.object, i = c(q.current?.fields), a = l(await t.find(r, {
919
919
  $filter: e.filter,
920
- $orderby: me(e.sort),
920
+ $orderby: he(e.sort),
921
921
  ...i.length > 0 ? { $expand: i } : {}
922
922
  }));
923
- n && j(a);
924
- } else W?.provider === "api" && (console.warn("API provider not yet implemented for ObjectCalendar"), n && j([]));
925
- n && M(!1);
923
+ n && M(a);
924
+ } else W?.provider === "api" && (console.warn("API provider not yet implemented for ObjectCalendar"), n && M([]));
925
+ n && N(!1);
926
926
  } catch (e) {
927
- console.error("[ObjectCalendar] Error fetching data:", e), n && (F(e), M(!1));
927
+ console.error("[ObjectCalendar] Error fetching data:", e), n && (ne(e), N(!1));
928
928
  }
929
929
  })(), () => {
930
930
  n = !1;
931
931
  };
932
932
  }, [
933
- k,
933
+ A,
934
934
  W,
935
935
  t,
936
936
  K,
937
937
  e.filter,
938
938
  e.sort,
939
- le
939
+ ue
940
940
  ]), r(() => {
941
941
  !K && t && (async () => {
942
942
  try {
943
943
  if (!t) return;
944
944
  let n = W?.provider === "object" ? W.object : e.objectName;
945
945
  if (!n) return;
946
- ae(await t.getObjectSchema(n));
946
+ oe(await t.getObjectSchema(n));
947
947
  } catch (e) {
948
948
  console.error("Failed to fetch object schema:", e);
949
949
  }
@@ -955,90 +955,63 @@ var Y = ({ schema: e, dataSource: t, className: s, data: d, loading: f, onEventC
955
955
  W
956
956
  ]);
957
957
  let J = i(() => {
958
- if (!G || !A.length) return [];
959
- let { startDateField: e, endDateField: t, titleField: n, colorField: r } = G, i = R?.titleFormat, a = typeof i == "string" ? i : i && typeof i == "object" && typeof i.source == "string" ? i.source : void 0, o = R?.NAME_FIELD_KEY, s = [
960
- "name",
961
- "full_name",
962
- "fullName",
963
- "title",
964
- "subject",
965
- "label",
966
- "display_name",
967
- "displayName"
968
- ], c = (e, t) => {
969
- let n = "[-\\u2013\\u2014|/·,:]", r = !1, i = e.replace(/\{([^{}]+)\}/g, (e, n) => {
970
- let i = t[n.trim()];
971
- return i != null && i !== "" ? (r = !0, String(i)) : "\0";
972
- });
973
- return r ? i.replace(RegExp(`\\s*${n}\\s*`, "g"), "").replace(RegExp(`\\s*${n}\\s*`, "g"), "").replace(/* @__PURE__ */ RegExp("\0", "g"), "").replace(/\s+/g, " ").trim() : "";
974
- }, l = (e) => {
975
- let t;
976
- if (n && (t = e[n], typeof t == "string" && (t = t.trim())), !t && a) {
977
- let n = c(a, e);
978
- n && (t = n);
979
- }
980
- if (!t && o) {
981
- let n = e[o];
982
- typeof n == "string" ? t = n.trim() : n && (t = n);
958
+ if (!G || !j.length) return [];
959
+ let { startDateField: e, endDateField: t, titleField: n, colorField: r } = G, i = (e) => {
960
+ if (n) {
961
+ let t = e[n], r = typeof t == "string" ? t.trim() : t;
962
+ if (r) return String(r);
983
963
  }
984
- if (!t) for (let n of s) {
985
- let r = e[n], i = typeof r == "string" ? r.trim() : r;
986
- if (i) {
987
- t = i;
988
- break;
989
- }
990
- }
991
- return t || "Untitled";
964
+ return u(R, e);
992
965
  };
993
- return A.map((n, i) => {
994
- let a = n[e], o = t ? n[t] : null, s = l(n), c = r ? n[r] : void 0;
966
+ return j.map((n, a) => {
967
+ let o = n[e], s = t ? n[t] : null, c = i(n), l = r ? n[r] : void 0;
995
968
  return {
996
- id: n.id || n._id || `event-${i}`,
997
- title: s,
998
- start: a ? new Date(a) : /* @__PURE__ */ new Date(),
999
- end: o ? new Date(o) : void 0,
1000
- color: c,
1001
- allDay: !o,
969
+ id: n.id || n._id || `event-${a}`,
970
+ title: c,
971
+ start: o ? new Date(o) : /* @__PURE__ */ new Date(),
972
+ end: s ? new Date(s) : void 0,
973
+ color: l,
974
+ allDay: !s,
1002
975
  data: n
1003
976
  };
1004
977
  }).filter((e) => !isNaN(e.start.getTime()));
1005
978
  }, [
1006
- A,
979
+ j,
1007
980
  G,
1008
981
  R
1009
982
  ]);
1010
983
  n(() => {
1011
- h?.(/* @__PURE__ */ new Date());
1012
- }, [h]);
984
+ g?.(/* @__PURE__ */ new Date());
985
+ }, [g]);
1013
986
  let Y = e.navigation ?? {
1014
987
  mode: "drawer",
1015
988
  width: "min(960px, 60vw)"
1016
- }, X = Y.mode === "drawer" || Y.mode === "modal" || Y.mode === "split" || Y.mode === "popover", Z = u({
989
+ }, X = Y.mode === "drawer" || Y.mode === "modal" || Y.mode === "split" || Y.mode === "popover", Z = d({
1017
990
  navigation: Y,
1018
991
  objectName: e.objectName,
1019
- onRowClick: X ? void 0 : m
1020
- }), ge = n(async (n, r, i) => {
992
+ onRowClick: X ? void 0 : h
993
+ }), _e = n(async (n, r, i) => {
1021
994
  if (!G) return;
1022
995
  let { startDateField: a, endDateField: o } = G, s = n?.id ?? n?._id;
1023
996
  if (!s || !e.objectName || !t?.update) return;
1024
997
  let c = { [a]: r.toISOString() };
1025
998
  o && i && (c[o] = i.toISOString());
1026
- let l = A;
1027
- j((e) => e.map((e) => (e?.id ?? e?._id) === s ? {
999
+ let l = j;
1000
+ M((e) => e.map((e) => (e?.id ?? e?._id) === s ? {
1028
1001
  ...e,
1029
1002
  ...c
1030
1003
  } : e));
1031
1004
  try {
1032
1005
  await t.update(e.objectName, s, c);
1033
1006
  } catch (e) {
1034
- j(l), console.error("[ObjectCalendar] Failed to persist drag-and-drop reschedule:", e);
1007
+ M(l), console.error("[ObjectCalendar] Failed to persist drag-and-drop reschedule:", e);
1035
1008
  }
1036
1009
  }, [
1037
1010
  G,
1038
1011
  e.objectName,
1039
1012
  t,
1040
- A
1041
- ]), [Q, $] = o(null), _e = n((n) => {
1013
+ j
1014
+ ]), [Q, $] = o(null), ve = n((n) => {
1042
1015
  !G || !e.objectName || !t?.create || $({
1043
1016
  start: n,
1044
1017
  title: "",
@@ -1048,7 +1021,7 @@ var Y = ({ schema: e, dataSource: t, className: s, data: d, loading: f, onEventC
1048
1021
  G,
1049
1022
  e.objectName,
1050
1023
  t
1051
- ]), ve = n((n, r) => {
1024
+ ]), ye = n((n, r) => {
1052
1025
  !G || !e.objectName || !t?.create || $({
1053
1026
  start: n,
1054
1027
  end: r,
@@ -1059,7 +1032,7 @@ var Y = ({ schema: e, dataSource: t, className: s, data: d, loading: f, onEventC
1059
1032
  G,
1060
1033
  e.objectName,
1061
1034
  t
1062
- ]), ye = n(async () => {
1035
+ ]), be = n(async () => {
1063
1036
  if (!Q || !G) return;
1064
1037
  let n = Q.title.trim();
1065
1038
  if (!n) {
@@ -1098,7 +1071,7 @@ var Y = ({ schema: e, dataSource: t, className: s, data: d, loading: f, onEventC
1098
1071
  }
1099
1072
  try {
1100
1073
  let n = await t.create(e.objectName, o), r = (n && (n.record || n.data || n)) ?? null;
1101
- r && (r.id !== void 0 || r._id !== void 0) && j((e) => [...e, r]), $(null);
1074
+ r && (r.id !== void 0 || r._id !== void 0) && M((e) => [...e, r]), $(null);
1102
1075
  } catch (e) {
1103
1076
  let t = e?.message || String(e);
1104
1077
  $((e) => e && {
@@ -1114,79 +1087,79 @@ var Y = ({ schema: e, dataSource: t, className: s, data: d, loading: f, onEventC
1114
1087
  t,
1115
1088
  R
1116
1089
  ]);
1117
- return ee ? /* @__PURE__ */ I("div", {
1090
+ return ee ? /* @__PURE__ */ F("div", {
1118
1091
  className: s,
1119
- children: /* @__PURE__ */ I("div", {
1092
+ children: /* @__PURE__ */ F("div", {
1120
1093
  className: "flex items-center justify-center h-96",
1121
- children: /* @__PURE__ */ I("div", {
1094
+ children: /* @__PURE__ */ F("div", {
1122
1095
  className: "text-muted-foreground",
1123
1096
  children: "Loading calendar..."
1124
1097
  })
1125
1098
  })
1126
- }) : N ? /* @__PURE__ */ I("div", {
1099
+ }) : P ? /* @__PURE__ */ F("div", {
1127
1100
  className: s,
1128
- children: /* @__PURE__ */ I("div", {
1101
+ children: /* @__PURE__ */ F("div", {
1129
1102
  className: "flex items-center justify-center h-96",
1130
- children: /* @__PURE__ */ L("div", {
1103
+ children: /* @__PURE__ */ I("div", {
1131
1104
  className: "text-destructive",
1132
- children: ["Error: ", N.message]
1105
+ children: ["Error: ", P.message]
1133
1106
  })
1134
1107
  })
1135
- }) : G ? /* @__PURE__ */ L("div", {
1136
- ref: de,
1108
+ }) : G ? /* @__PURE__ */ I("div", {
1109
+ ref: fe,
1137
1110
  className: s,
1138
1111
  children: [
1139
- U > 0 && /* @__PURE__ */ I("div", {
1112
+ U > 0 && /* @__PURE__ */ F("div", {
1140
1113
  className: "flex items-center justify-center text-xs text-muted-foreground",
1141
1114
  style: { height: U },
1142
- children: fe ? "Refreshing…" : "Pull to refresh"
1115
+ children: pe ? "Refreshing…" : "Pull to refresh"
1143
1116
  }),
1144
- /* @__PURE__ */ I("div", {
1117
+ /* @__PURE__ */ F("div", {
1145
1118
  className: "bg-background h-[calc(100vh-120px)] sm:h-[calc(100vh-160px)] md:h-[calc(100vh-200px)] min-h-[400px] sm:min-h-[600px]",
1146
- children: /* @__PURE__ */ I(ce, {
1119
+ children: /* @__PURE__ */ F(le, {
1147
1120
  events: J,
1148
1121
  currentDate: z,
1149
1122
  view: V,
1150
- locale: O,
1123
+ locale: k,
1151
1124
  onEventClick: (e) => {
1152
- Z.handleClick(e.data), X || p?.(e.data);
1125
+ Z.handleClick(e.data), X || m?.(e.data);
1153
1126
  },
1154
1127
  onDateClick: (e) => {
1155
- h ? h(e) : _e(e);
1128
+ g ? g(e) : ve(e);
1156
1129
  },
1157
1130
  onNavigate: (e) => {
1158
- oe(e), _?.(e);
1131
+ se(e), v?.(e);
1159
1132
  },
1160
1133
  onViewChange: (e) => {
1161
- H(e), E?.(e);
1134
+ H(e), D?.(e);
1162
1135
  },
1163
1136
  onAddClick: void 0,
1164
1137
  onEventDrop: (e, t, n) => {
1165
- D ? D(e.data, t, n) : ge(e.data, t, n);
1138
+ O ? O(e.data, t, n) : _e(e.data, t, n);
1166
1139
  },
1167
- onTimeRangeSelect: ve
1140
+ onTimeRangeSelect: ye
1168
1141
  })
1169
1142
  }),
1170
- /* @__PURE__ */ I(v, {
1143
+ /* @__PURE__ */ F(y, {
1171
1144
  open: !!Q,
1172
1145
  onOpenChange: (e) => {
1173
1146
  e || $(null);
1174
1147
  },
1175
- children: /* @__PURE__ */ L(y, {
1148
+ children: /* @__PURE__ */ I(b, {
1176
1149
  className: "sm:max-w-md",
1177
1150
  children: [
1178
- /* @__PURE__ */ L(S, { children: [/* @__PURE__ */ I(C, { children: "New event" }), /* @__PURE__ */ I(b, { children: Q && (() => {
1179
- let e = Q.end && Q.end.getTime() !== Q.start.getTime(), t = Q.start.toLocaleDateString(O, {
1151
+ /* @__PURE__ */ I(C, { children: [/* @__PURE__ */ F(w, { children: "New event" }), /* @__PURE__ */ F(x, { children: Q && (() => {
1152
+ let e = Q.end && Q.end.getTime() !== Q.start.getTime(), t = Q.start.toLocaleDateString(k, {
1180
1153
  year: "numeric",
1181
1154
  month: "long",
1182
1155
  day: "numeric"
1183
1156
  });
1184
1157
  if (e) {
1185
- let e = (e) => e.toLocaleTimeString(O, {
1158
+ let e = (e) => e.toLocaleTimeString(k, {
1186
1159
  hour: "numeric",
1187
1160
  minute: "2-digit"
1188
1161
  });
1189
- return /* @__PURE__ */ L(te, { children: [
1162
+ return /* @__PURE__ */ I(re, { children: [
1190
1163
  t,
1191
1164
  " · ",
1192
1165
  e(Q.start),
@@ -1194,16 +1167,16 @@ var Y = ({ schema: e, dataSource: t, className: s, data: d, loading: f, onEventC
1194
1167
  e(Q.end)
1195
1168
  ] });
1196
1169
  }
1197
- return /* @__PURE__ */ L(te, { children: ["On ", t] });
1170
+ return /* @__PURE__ */ I(re, { children: ["On ", t] });
1198
1171
  })() })] }),
1199
- /* @__PURE__ */ L("div", {
1172
+ /* @__PURE__ */ I("div", {
1200
1173
  className: "space-y-2",
1201
1174
  children: [
1202
- /* @__PURE__ */ I(T, {
1175
+ /* @__PURE__ */ F(E, {
1203
1176
  htmlFor: "quick-create-title",
1204
1177
  children: "Title"
1205
1178
  }),
1206
- /* @__PURE__ */ I(w, {
1179
+ /* @__PURE__ */ F(T, {
1207
1180
  id: "quick-create-title",
1208
1181
  autoFocus: !0,
1209
1182
  value: Q?.title ?? "",
@@ -1213,24 +1186,24 @@ var Y = ({ schema: e, dataSource: t, className: s, data: d, loading: f, onEventC
1213
1186
  error: void 0
1214
1187
  }),
1215
1188
  onKeyDown: (e) => {
1216
- e.key === "Enter" && !Q?.submitting && (e.preventDefault(), ye());
1189
+ e.key === "Enter" && !Q?.submitting && (e.preventDefault(), be());
1217
1190
  },
1218
1191
  placeholder: "What's this event about?",
1219
1192
  disabled: Q?.submitting
1220
1193
  }),
1221
- Q?.error && /* @__PURE__ */ I("p", {
1194
+ Q?.error && /* @__PURE__ */ F("p", {
1222
1195
  className: "text-sm text-destructive",
1223
1196
  children: Q.error
1224
1197
  })
1225
1198
  ]
1226
1199
  }),
1227
- /* @__PURE__ */ L(x, { children: [/* @__PURE__ */ I(g, {
1200
+ /* @__PURE__ */ I(S, { children: [/* @__PURE__ */ F(_, {
1228
1201
  variant: "outline",
1229
1202
  onClick: () => $(null),
1230
1203
  disabled: Q?.submitting,
1231
1204
  children: "Cancel"
1232
- }), /* @__PURE__ */ I(g, {
1233
- onClick: () => void ye(),
1205
+ }), /* @__PURE__ */ F(_, {
1206
+ onClick: () => void be(),
1234
1207
  disabled: Q?.submitting || !Q?.title.trim(),
1235
1208
  children: Q?.submitting ? "Creating…" : "Create"
1236
1209
  })] })
@@ -1241,7 +1214,7 @@ var Y = ({ schema: e, dataSource: t, className: s, data: d, loading: f, onEventC
1241
1214
  let n = W?.provider === "object" ? W.object : e.objectName, r = Z.selectedRecord, i = r.id ?? r._id;
1242
1215
  if (!n || i == null) return null;
1243
1216
  let a = G?.titleField ? String(r[G.titleField] ?? "Event Details") : "Event Details";
1244
- return /* @__PURE__ */ I(re, {
1217
+ return /* @__PURE__ */ F(ae, {
1245
1218
  open: !0,
1246
1219
  onClose: Z.close,
1247
1220
  title: a,
@@ -1251,24 +1224,24 @@ var Y = ({ schema: e, dataSource: t, className: s, data: d, loading: f, onEventC
1251
1224
  dataSource: t,
1252
1225
  objectSchema: R,
1253
1226
  width: Z.width ?? "min(960px, 60vw)",
1254
- fullPageHref: ie(n, i) ?? void 0,
1227
+ fullPageHref: L(n, i) ?? void 0,
1255
1228
  onFieldSave: async (e, r) => {
1256
- t?.update && (await t.update(n, String(i), { [e]: r }), j((t) => t.map((t) => String(t.id ?? t._id) === String(i) ? {
1229
+ t?.update && (await t.update(n, String(i), { [e]: r }), M((t) => t.map((t) => String(t.id ?? t._id) === String(i) ? {
1257
1230
  ...t,
1258
1231
  [e]: r
1259
1232
  } : t)));
1260
1233
  },
1261
1234
  onDelete: async () => {
1262
- t?.delete && (await t.delete(n, String(i)), j((e) => e.filter((e) => String(e.id ?? e._id) !== String(i))));
1235
+ t?.delete && (await t.delete(n, String(i)), M((e) => e.filter((e) => String(e.id ?? e._id) !== String(i))));
1263
1236
  }
1264
1237
  });
1265
1238
  })()
1266
1239
  ]
1267
- }) : /* @__PURE__ */ I("div", {
1240
+ }) : /* @__PURE__ */ F("div", {
1268
1241
  className: s,
1269
- children: /* @__PURE__ */ I("div", {
1242
+ children: /* @__PURE__ */ F("div", {
1270
1243
  className: "flex items-center justify-center h-96",
1271
- children: /* @__PURE__ */ I("div", {
1244
+ children: /* @__PURE__ */ F("div", {
1272
1245
  className: "text-muted-foreground",
1273
1246
  children: "Calendar configuration required. Please specify startDateField and titleField."
1274
1247
  })
@@ -1277,7 +1250,7 @@ var Y = ({ schema: e, dataSource: t, className: s, data: d, loading: f, onEventC
1277
1250
  };
1278
1251
  //#endregion
1279
1252
  //#region src/calendar-view-renderer.tsx
1280
- s.register("calendar-view", ({ schema: e, className: n, onAction: r, ...i }) => /* @__PURE__ */ I(ce, {
1253
+ s.register("calendar-view", ({ schema: e, className: n, onAction: r, ...i }) => /* @__PURE__ */ F(le, {
1281
1254
  className: n,
1282
1255
  events: t.useMemo(() => !e.data || !Array.isArray(e.data) ? [] : e.data.map((t, n) => {
1283
1256
  let r = e.titleField || "title", i = e.startDateField || "start", a = e.endDateField || "end", o = e.colorField || "color", s = e.allDayField || "allDay";
@@ -1426,8 +1399,8 @@ s.register("calendar-view", ({ schema: e, className: n, onAction: r, ...i }) =>
1426
1399
  //#endregion
1427
1400
  //#region src/index.tsx
1428
1401
  var X = ({ schema: e, ...t }) => {
1429
- let { dataSource: n } = d() || {};
1430
- return /* @__PURE__ */ I(Y, {
1402
+ let { dataSource: n } = f() || {};
1403
+ return /* @__PURE__ */ F(Y, {
1431
1404
  schema: e,
1432
1405
  dataSource: n,
1433
1406
  ...t
@@ -1465,4 +1438,4 @@ s.register("object-calendar", X, {
1465
1438
  }]
1466
1439
  });
1467
1440
  //#endregion
1468
- export { ce as CalendarView, Y as ObjectCalendar, X as ObjectCalendarRenderer };
1441
+ export { le as CalendarView, Y as ObjectCalendar, X as ObjectCalendarRenderer };