@nice2dev/ui 1.4.1 → 1.4.3
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 +52 -0
- package/dist/NiceCodeEditor-DhdjnDLV.cjs +289 -0
- package/dist/{NiceDataGrid-BT6iCUgP.cjs → NiceDataGrid-CrKDzMM1.cjs} +1 -1
- package/dist/{NiceForm-Bysp66Ef.cjs → NiceForm-CT9hEXpc.cjs} +1 -1
- package/dist/NiceLoginForm-C2-WgRn0.cjs +1 -0
- package/dist/NiceMention-BZEHqPrf.cjs +432 -0
- package/dist/NiceModuleLifecyclePanel-DKlqKPy2.cjs +1 -0
- package/dist/{NiceSavedQueryPanel-BbznsXFd.cjs → NiceSavedQueryPanel-C5Ab_NWx.cjs} +1 -1
- package/dist/NiceScheduler-BZQAKEVF.cjs +5 -0
- package/dist/{NiceWindow-pgR4c-kQ.cjs → NiceWindow-BklnkBpu.cjs} +1 -1
- package/dist/charts/NiceLinearGauge.mjs +96 -83
- package/dist/charts/NicePolarChart.mjs +47 -47
- package/dist/charts-BzlvCCg9.cjs +768 -0
- package/dist/charts.cjs +1 -1
- package/dist/{core-lazy-CL4ZIxF-.cjs → core-lazy-VTd5zfoZ.cjs} +1 -1
- package/dist/data.cjs +1 -1
- package/dist/display/NiceAvatar.mjs +40 -24
- package/dist/editors/pickers/NiceDateRangeBox.mjs +92 -92
- package/dist/editors/pickers/NiceDateTimePicker.mjs +173 -173
- package/dist/editors/rich/NiceCodeEditor.mjs +645 -584
- package/dist/editors/rich/NiceDocumentEditor.mjs +277 -254
- package/dist/editors.cjs +1 -1
- package/dist/feedback/NiceDrawer.mjs +15 -15
- package/dist/feedback.cjs +1 -1
- package/dist/index.cjs +202 -202
- package/dist/index.d.ts +18 -0
- package/dist/lazy.cjs +1 -1
- package/dist/navigation/NiceNavShell.mjs +646 -593
- package/dist/navigation/NiceSidebarNav.mjs +844 -823
- package/dist/navigation.cjs +1 -1
- package/dist/overlays/NiceWindow.mjs +91 -91
- package/dist/overlays.cjs +1 -1
- package/dist/planning/NiceScheduler.mjs +170 -169
- package/dist/planning/NiceSchedulerViews.mjs +242 -233
- package/dist/style.css +2 -2
- package/dist/utility/intlNames.mjs +26 -16
- package/package.json +4 -4
- package/dist/NiceCodeEditor-D0QZW88r.cjs +0 -268
- package/dist/NiceLoginForm-FGf32sro.cjs +0 -1
- package/dist/NiceMention-sc8W-DwH.cjs +0 -430
- package/dist/NiceModuleLifecyclePanel-DBQPCa_V.cjs +0 -1
- package/dist/NiceScheduler-3Ez0zSQJ.cjs +0 -5
- package/dist/charts-B0tHOpJ7.cjs +0 -768
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { jsxs as g, jsx as n, Fragment as
|
|
2
|
-
import { useNiceTranslation as
|
|
1
|
+
import { jsxs as g, jsx as n, Fragment as se } from "react/jsx-runtime";
|
|
2
|
+
import { useNiceTranslation as j, NiceIcon as Z, useAccessibleClick as de } from "@nice2dev/ui-core";
|
|
3
3
|
import q from "react";
|
|
4
|
-
import { NiceButton as
|
|
5
|
-
import { NiceForm as
|
|
6
|
-
import { NiceColorPicker as
|
|
7
|
-
import { NiceDateTimePicker as
|
|
8
|
-
import { NiceModal as
|
|
9
|
-
import { monthNames as
|
|
10
|
-
import { addDays as A, isSameDay as
|
|
11
|
-
import { recipeTotalMinutes as
|
|
12
|
-
const G = ({ ev: e, renderEvent: c, onClick:
|
|
13
|
-
const
|
|
14
|
-
solid: { backgroundColor:
|
|
4
|
+
import { NiceButton as U } from "../buttons/NiceButton.mjs";
|
|
5
|
+
import { NiceForm as ue } from "../editors/forms/NiceForm.mjs";
|
|
6
|
+
import { NiceColorPicker as me } from "../editors/pickers/NiceColorPicker.mjs";
|
|
7
|
+
import { getDefaultLocale as K, NiceDateTimePicker as ie } from "../editors/pickers/NiceDateTimePicker.mjs";
|
|
8
|
+
import { NiceModal as he } from "../feedback/NiceModal.mjs";
|
|
9
|
+
import { monthNames as le, weekdayNames as W, formatNumericDateTime as X } from "../utility/intlNames.mjs";
|
|
10
|
+
import { addDays as A, isSameDay as R, getEventsForDay as ae } from "./NiceScheduler.types.mjs";
|
|
11
|
+
import { recipeTotalMinutes as pe, createEmptyRecipe as ge } from "./recipe-types.mjs";
|
|
12
|
+
const G = ({ ev: e, renderEvent: c, onClick: s, draggable: p, dragRef: y, onHover: l, categoryColor: f }) => {
|
|
13
|
+
const _ = f || e.color || "var(--nice-color-primary, #3b82f6)", E = {
|
|
14
|
+
solid: { backgroundColor: _, color: "var(--nice-color-white, #fff)" },
|
|
15
15
|
striped: {
|
|
16
|
-
background: `repeating-linear-gradient(45deg, ${
|
|
17
|
-
border: `1px solid ${
|
|
16
|
+
background: `repeating-linear-gradient(45deg, ${_}, ${_} 4px, transparent 4px, transparent 8px)`,
|
|
17
|
+
border: `1px solid ${_}`,
|
|
18
18
|
color: "var(--nice-text-primary, #333)"
|
|
19
19
|
},
|
|
20
|
-
outlined: { backgroundColor: "transparent", border: `2px solid ${
|
|
21
|
-
dashed: { backgroundColor: "transparent", border: `2px dashed ${
|
|
20
|
+
outlined: { backgroundColor: "transparent", border: `2px solid ${_}`, color: _ },
|
|
21
|
+
dashed: { backgroundColor: "transparent", border: `2px dashed ${_}`, color: _ }
|
|
22
22
|
}[e.eventStyle || "solid"];
|
|
23
23
|
return (
|
|
24
24
|
// An event took only the pointer (1.3.0 C15): it is a Tab stop, Enter / Space open it as a
|
|
@@ -39,39 +39,39 @@ const G = ({ ev: e, renderEvent: c, onClick: l, draggable: p, dragRef: y, onHove
|
|
|
39
39
|
y.current = null;
|
|
40
40
|
},
|
|
41
41
|
onClick: (D) => {
|
|
42
|
-
D.stopPropagation(),
|
|
42
|
+
D.stopPropagation(), s?.(e);
|
|
43
43
|
},
|
|
44
44
|
onKeyDown: (D) => {
|
|
45
|
-
(D.key === "Enter" || D.key === " ") && (D.preventDefault(), D.stopPropagation(),
|
|
45
|
+
(D.key === "Enter" || D.key === " ") && (D.preventDefault(), D.stopPropagation(), s?.(e));
|
|
46
46
|
},
|
|
47
|
-
onMouseEnter: (D) =>
|
|
48
|
-
onMouseLeave: () =>
|
|
49
|
-
onFocus: (D) =>
|
|
50
|
-
onBlur: () =>
|
|
47
|
+
onMouseEnter: (D) => l(e, D.currentTarget.getBoundingClientRect()),
|
|
48
|
+
onMouseLeave: () => l(null),
|
|
49
|
+
onFocus: (D) => l(e, D.currentTarget.getBoundingClientRect()),
|
|
50
|
+
onBlur: () => l(null),
|
|
51
51
|
children: c ? c(e) : e.title
|
|
52
52
|
}
|
|
53
53
|
)
|
|
54
54
|
);
|
|
55
55
|
};
|
|
56
|
-
function
|
|
56
|
+
function B(e, c) {
|
|
57
57
|
if (!(!e.category || !c))
|
|
58
|
-
return c.find((
|
|
58
|
+
return c.find((s) => s.key === e.category)?.color;
|
|
59
59
|
}
|
|
60
|
-
const
|
|
60
|
+
const Te = ({
|
|
61
61
|
events: e,
|
|
62
62
|
curDate: c,
|
|
63
|
-
firstDayOfWeek:
|
|
63
|
+
firstDayOfWeek: s,
|
|
64
64
|
onSlotClick: p,
|
|
65
65
|
onEventClick: y,
|
|
66
|
-
draggable:
|
|
67
|
-
dragRef:
|
|
68
|
-
categories:
|
|
66
|
+
draggable: l,
|
|
67
|
+
dragRef: f,
|
|
68
|
+
categories: _,
|
|
69
69
|
renderEvent: $,
|
|
70
70
|
onHoverEvent: E,
|
|
71
71
|
readOnly: D
|
|
72
72
|
}) => {
|
|
73
|
-
const { lang: F } =
|
|
74
|
-
for (let a =
|
|
73
|
+
const { lang: F } = j(), b = W(F, "short"), r = c.getFullYear(), w = c.getMonth(), S = new Date(r, w, 1), i = new Date(r, w + 1, 0), v = (S.getDay() - s + 7) % 7, d = i.getDate(), o = [];
|
|
74
|
+
for (let a = v - 1; a >= 0; a--)
|
|
75
75
|
o.push({ date: A(S, -a - 1), isCurrentMonth: !1 });
|
|
76
76
|
for (let a = 0; a < d; a++)
|
|
77
77
|
o.push({ date: new Date(r, w, a + 1), isCurrentMonth: !0 });
|
|
@@ -79,9 +79,9 @@ const Se = ({
|
|
|
79
79
|
for (; o.length < 42; )
|
|
80
80
|
o.push({ date: new Date(r, w + 1, M++), isCurrentMonth: !1 });
|
|
81
81
|
return /* @__PURE__ */ g("div", { className: "nice-scheduler__month", children: [
|
|
82
|
-
/* @__PURE__ */ n("div", { className: "nice-scheduler__month-header", children: Array.from({ length: 7 }, (a, u) => /* @__PURE__ */ n("div", { className: "nice-scheduler__month-dayname", children: b[(
|
|
82
|
+
/* @__PURE__ */ n("div", { className: "nice-scheduler__month-header", children: Array.from({ length: 7 }, (a, u) => /* @__PURE__ */ n("div", { className: "nice-scheduler__month-dayname", children: b[(s + u) % 7] }, u)) }),
|
|
83
83
|
/* @__PURE__ */ n("div", { className: "nice-scheduler__month-grid", children: o.map((a, u) => {
|
|
84
|
-
const T =
|
|
84
|
+
const T = ae(e, a.date), m = R(a.date, /* @__PURE__ */ new Date()), N = a.date.getDay(), P = N === 0 || N === 6;
|
|
85
85
|
return /* @__PURE__ */ g(
|
|
86
86
|
"div",
|
|
87
87
|
{
|
|
@@ -95,10 +95,10 @@ const Se = ({
|
|
|
95
95
|
ev: x,
|
|
96
96
|
renderEvent: $,
|
|
97
97
|
onClick: y,
|
|
98
|
-
draggable:
|
|
99
|
-
dragRef:
|
|
98
|
+
draggable: l && !D,
|
|
99
|
+
dragRef: f,
|
|
100
100
|
onHover: E,
|
|
101
|
-
categoryColor:
|
|
101
|
+
categoryColor: B(x, _)
|
|
102
102
|
},
|
|
103
103
|
x.id
|
|
104
104
|
)),
|
|
@@ -112,15 +112,15 @@ const Se = ({
|
|
|
112
112
|
);
|
|
113
113
|
}) })
|
|
114
114
|
] });
|
|
115
|
-
},
|
|
115
|
+
}, xe = ({
|
|
116
116
|
events: e,
|
|
117
117
|
days: c,
|
|
118
|
-
startHour:
|
|
118
|
+
startHour: s,
|
|
119
119
|
endHour: p,
|
|
120
120
|
draggable: y,
|
|
121
|
-
dragRef:
|
|
122
|
-
onEventClick:
|
|
123
|
-
onSlotClick:
|
|
121
|
+
dragRef: l,
|
|
122
|
+
onEventClick: f,
|
|
123
|
+
onSlotClick: _,
|
|
124
124
|
onEventDrop: $,
|
|
125
125
|
categories: E,
|
|
126
126
|
workHours: D,
|
|
@@ -129,19 +129,19 @@ const Se = ({
|
|
|
129
129
|
onHoverEvent: r,
|
|
130
130
|
readOnly: w
|
|
131
131
|
}) => {
|
|
132
|
-
const { lang: S } =
|
|
133
|
-
for (let m =
|
|
132
|
+
const { lang: S } = j(), i = [];
|
|
133
|
+
for (let m = s; m < p; m++)
|
|
134
134
|
i.push(m);
|
|
135
135
|
W(S, "short");
|
|
136
|
-
const
|
|
136
|
+
const v = W(S, "long"), d = q.useRef(null), o = /* @__PURE__ */ new Date(), M = o.getHours() * 60 + o.getMinutes(), a = (p - s) * 60, u = (M - s * 60) / a * 100, T = F && M >= s * 60 && M < p * 60;
|
|
137
137
|
return q.useEffect(() => {
|
|
138
138
|
const m = d.current;
|
|
139
139
|
if (!m)
|
|
140
140
|
return;
|
|
141
|
-
const N = /* @__PURE__ */ new Date(), P = e.filter((C) => c.some((
|
|
141
|
+
const N = /* @__PURE__ */ new Date(), P = e.filter((C) => c.some((L) => R(L, new Date(C.start)))), x = P.filter((C) => R(new Date(C.start), N));
|
|
142
142
|
let I;
|
|
143
|
-
x.length > 0 ? I = Math.min(...x.map((C) => new Date(C.start).getHours())) : P.length > 0 ? I = Math.min(...P.map((C) => new Date(C.start).getHours())) : I = 8, I = Math.max(
|
|
144
|
-
const t = I -
|
|
143
|
+
x.length > 0 ? I = Math.min(...x.map((C) => new Date(C.start).getHours())) : P.length > 0 ? I = Math.min(...P.map((C) => new Date(C.start).getHours())) : I = 8, I = Math.max(s, Math.min(I, p - 1));
|
|
144
|
+
const t = I - s, h = m.children[t];
|
|
145
145
|
if (h) {
|
|
146
146
|
const C = m.closest(".nice-scheduler__content") ?? m.closest(".nice-scheduler__timegrid");
|
|
147
147
|
C && (C.scrollTop = h.offsetTop - 4);
|
|
@@ -154,9 +154,9 @@ const Se = ({
|
|
|
154
154
|
return /* @__PURE__ */ g(
|
|
155
155
|
"div",
|
|
156
156
|
{
|
|
157
|
-
className: `nice-scheduler__timegrid-day-header ${
|
|
157
|
+
className: `nice-scheduler__timegrid-day-header ${R(m, o) ? "nice-scheduler__timegrid-day-header--today" : ""} ${P ? "nice-scheduler__timegrid-day-header--weekend" : ""}`,
|
|
158
158
|
children: [
|
|
159
|
-
/* @__PURE__ */ n("div", { className: "nice-scheduler__timegrid-day-name", children:
|
|
159
|
+
/* @__PURE__ */ n("div", { className: "nice-scheduler__timegrid-day-name", children: v[m.getDay()] }),
|
|
160
160
|
/* @__PURE__ */ n("div", { className: "nice-scheduler__timegrid-day-num", children: m.getDate() })
|
|
161
161
|
]
|
|
162
162
|
},
|
|
@@ -176,7 +176,7 @@ const Se = ({
|
|
|
176
176
|
c.map((P, x) => {
|
|
177
177
|
const I = e.filter((t) => {
|
|
178
178
|
const h = new Date(t.start);
|
|
179
|
-
return
|
|
179
|
+
return R(h, P) && h.getHours() === m;
|
|
180
180
|
});
|
|
181
181
|
return /* @__PURE__ */ n(
|
|
182
182
|
"div",
|
|
@@ -184,29 +184,29 @@ const Se = ({
|
|
|
184
184
|
className: "nice-scheduler__timegrid-cell",
|
|
185
185
|
onDragOver: y && !w ? (t) => t.preventDefault() : void 0,
|
|
186
186
|
onDrop: y && !w ? () => {
|
|
187
|
-
if (!
|
|
187
|
+
if (!l.current || !$)
|
|
188
188
|
return;
|
|
189
|
-
const t =
|
|
189
|
+
const t = l.current.event, h = new Date(t.end).getTime() - new Date(t.start).getTime(), C = new Date(P);
|
|
190
190
|
C.setHours(m, 0, 0, 0);
|
|
191
|
-
const
|
|
192
|
-
$(t, C,
|
|
191
|
+
const L = new Date(C.getTime() + h);
|
|
192
|
+
$(t, C, L), l.current = null;
|
|
193
193
|
} : void 0,
|
|
194
194
|
onClick: () => !w && (() => {
|
|
195
195
|
const t = new Date(P);
|
|
196
196
|
t.setHours(m);
|
|
197
197
|
const h = new Date(t);
|
|
198
|
-
h.setHours(m + 1),
|
|
198
|
+
h.setHours(m + 1), _?.(t, h);
|
|
199
199
|
})(),
|
|
200
200
|
children: I.map((t) => /* @__PURE__ */ n(
|
|
201
201
|
G,
|
|
202
202
|
{
|
|
203
203
|
ev: t,
|
|
204
204
|
renderEvent: b,
|
|
205
|
-
onClick:
|
|
205
|
+
onClick: f,
|
|
206
206
|
draggable: y && !w,
|
|
207
|
-
dragRef:
|
|
207
|
+
dragRef: l,
|
|
208
208
|
onHover: r,
|
|
209
|
-
categoryColor:
|
|
209
|
+
categoryColor: B(t, E)
|
|
210
210
|
},
|
|
211
211
|
t.id
|
|
212
212
|
))
|
|
@@ -219,140 +219,141 @@ const Se = ({
|
|
|
219
219
|
m
|
|
220
220
|
);
|
|
221
221
|
}),
|
|
222
|
-
T && c.some((m) =>
|
|
222
|
+
T && c.some((m) => R(m, o)) && /* @__PURE__ */ n("div", { className: "nice-scheduler__now-line", style: { top: `${u}%` }, children: /* @__PURE__ */ n("div", { className: "nice-scheduler__now-dot" }) })
|
|
223
223
|
] })
|
|
224
224
|
] });
|
|
225
|
-
},
|
|
225
|
+
}, $e = ({
|
|
226
226
|
events: e,
|
|
227
227
|
curDate: c,
|
|
228
|
-
onEventClick:
|
|
228
|
+
onEventClick: s,
|
|
229
229
|
categories: p,
|
|
230
230
|
t: y
|
|
231
231
|
}) => {
|
|
232
|
-
const
|
|
233
|
-
(
|
|
234
|
-
).sort((
|
|
232
|
+
const l = [...e].filter(
|
|
233
|
+
(f) => new Date(f.start) >= new Date(c.getFullYear(), c.getMonth(), c.getDate())
|
|
234
|
+
).sort((f, _) => new Date(f.start).getTime() - new Date(_.start).getTime()).slice(0, 50);
|
|
235
235
|
return /* @__PURE__ */ g("div", { className: "nice-scheduler__agenda", children: [
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
l.map((f) => /* @__PURE__ */ n(ye, { ev: f, categories: p, onEventClick: s }, f.id)),
|
|
237
|
+
l.length === 0 && /* @__PURE__ */ n("div", { className: "nice-scheduler__agenda-empty", children: y("noEvents", "No upcoming events") })
|
|
238
238
|
] });
|
|
239
|
-
},
|
|
239
|
+
}, ce = ({ parts: e }) => /* @__PURE__ */ n("div", { className: "nice-scheduler__agenda-meta", children: e.map(([c, s], p) => /* @__PURE__ */ g(q.Fragment, { children: [
|
|
240
240
|
p > 0 && " · ",
|
|
241
|
-
/* @__PURE__ */ n(
|
|
241
|
+
/* @__PURE__ */ n(Z, { name: c, size: 12, style: { verticalAlign: "-2px" } }),
|
|
242
242
|
" ",
|
|
243
|
-
|
|
244
|
-
] }, c)) }),
|
|
243
|
+
s
|
|
244
|
+
] }, c)) }), oe = ({ ev: e }) => {
|
|
245
245
|
if (e.eventType === "recipe" && e.recipe) {
|
|
246
|
-
const c =
|
|
247
|
-
return c !== void 0 &&
|
|
246
|
+
const c = pe(e.recipe), s = [];
|
|
247
|
+
return c !== void 0 && s.push(["clock", `${c} min`]), e.recipe.ingredients?.length && s.push(["list", `${e.recipe.ingredients.length} ingredients`]), e.recipe.servings && s.push(["utensils", `${e.recipe.servings} servings`]), s.length === 0 ? null : /* @__PURE__ */ n(ce, { parts: s });
|
|
248
248
|
}
|
|
249
249
|
if (e.eventType === "service" && e.service) {
|
|
250
|
-
const c = e.service,
|
|
251
|
-
return c.serviceName &&
|
|
250
|
+
const c = e.service, s = [];
|
|
251
|
+
return c.serviceName && s.push(["bell", c.serviceName]), c.providerName && s.push(["user", c.providerName]), c.customerName && s.push(["arrow-right", c.customerName]), typeof c.price == "number" && s.push(["dollar", `${c.price}${c.currency ? " " + c.currency : ""}`]), s.length === 0 ? null : /* @__PURE__ */ n(ce, { parts: s });
|
|
252
252
|
}
|
|
253
253
|
return null;
|
|
254
|
-
},
|
|
255
|
-
const { t: p
|
|
254
|
+
}, ye = ({ ev: e, categories: c, onEventClick: s }) => {
|
|
255
|
+
const { t: p } = j(), y = de({ onClick: () => s?.(e) });
|
|
256
256
|
return /* @__PURE__ */ g(
|
|
257
257
|
"div",
|
|
258
258
|
{
|
|
259
259
|
className: "nice-scheduler__agenda-item",
|
|
260
260
|
"aria-label": p("service.event", "Event {title}").replace("{title}", String(e.title)),
|
|
261
|
-
...
|
|
261
|
+
...y,
|
|
262
262
|
children: [
|
|
263
263
|
/* @__PURE__ */ n(
|
|
264
264
|
"div",
|
|
265
265
|
{
|
|
266
266
|
className: "nice-scheduler__agenda-dot",
|
|
267
267
|
style: {
|
|
268
|
-
backgroundColor:
|
|
268
|
+
backgroundColor: B(e, c) || e.color || "var(--nice-color-primary, #3b82f6)"
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
),
|
|
272
272
|
/* @__PURE__ */ g("div", { className: "nice-scheduler__agenda-info", children: [
|
|
273
273
|
/* @__PURE__ */ n("div", { className: "nice-scheduler__agenda-title", children: e.title }),
|
|
274
274
|
/* @__PURE__ */ g("div", { className: "nice-scheduler__agenda-time", children: [
|
|
275
|
-
K(
|
|
276
|
-
" –
|
|
277
|
-
|
|
275
|
+
X(K(), new Date(e.start)),
|
|
276
|
+
" –",
|
|
277
|
+
" ",
|
|
278
|
+
X(K(), new Date(e.end))
|
|
278
279
|
] }),
|
|
279
280
|
e.description && /* @__PURE__ */ n("div", { className: "nice-scheduler__agenda-desc", children: e.description }),
|
|
280
|
-
/* @__PURE__ */ n(
|
|
281
|
+
/* @__PURE__ */ n(oe, { ev: e })
|
|
281
282
|
] }),
|
|
282
283
|
e.category && c && /* @__PURE__ */ n(
|
|
283
284
|
"span",
|
|
284
285
|
{
|
|
285
286
|
className: "nice-scheduler__agenda-badge",
|
|
286
|
-
style: { backgroundColor:
|
|
287
|
-
children: c.find((
|
|
287
|
+
style: { backgroundColor: B(e, c) || e.color },
|
|
288
|
+
children: c.find((l) => l.key === e.category)?.label
|
|
288
289
|
}
|
|
289
290
|
)
|
|
290
291
|
]
|
|
291
292
|
}
|
|
292
293
|
);
|
|
293
|
-
},
|
|
294
|
+
}, Ee = ({
|
|
294
295
|
events: e,
|
|
295
296
|
curDate: c,
|
|
296
|
-
timelineDays:
|
|
297
|
+
timelineDays: s,
|
|
297
298
|
resources: p,
|
|
298
299
|
draggable: y,
|
|
299
|
-
dragRef:
|
|
300
|
-
onEventClick:
|
|
301
|
-
onSlotClick:
|
|
300
|
+
dragRef: l,
|
|
301
|
+
onEventClick: f,
|
|
302
|
+
onSlotClick: _,
|
|
302
303
|
onEventDrop: $,
|
|
303
304
|
categories: E,
|
|
304
305
|
renderEvent: D,
|
|
305
306
|
onHoverEvent: F,
|
|
306
307
|
readOnly: b
|
|
307
308
|
}) => {
|
|
308
|
-
const { lang: r } =
|
|
309
|
+
const { lang: r } = j(), w = Array.from({ length: s }, (v, d) => A(c, d)), S = p ?? [{ id: "__default", name: "" }], i = W(r, "short");
|
|
309
310
|
return /* @__PURE__ */ g("div", { className: "nice-scheduler__timeline", children: [
|
|
310
311
|
/* @__PURE__ */ g("div", { className: "nice-scheduler__timeline-header", children: [
|
|
311
312
|
/* @__PURE__ */ n("div", { className: "nice-scheduler__timeline-res-label" }),
|
|
312
|
-
w.map((
|
|
313
|
+
w.map((v, d) => /* @__PURE__ */ g(
|
|
313
314
|
"div",
|
|
314
315
|
{
|
|
315
|
-
className: `nice-scheduler__timeline-day ${
|
|
316
|
+
className: `nice-scheduler__timeline-day ${R(v, /* @__PURE__ */ new Date()) ? "nice-scheduler__timeline-day--today" : ""}`,
|
|
316
317
|
children: [
|
|
317
|
-
i[
|
|
318
|
+
i[v.getDay()],
|
|
318
319
|
" ",
|
|
319
|
-
|
|
320
|
+
v.getDate()
|
|
320
321
|
]
|
|
321
322
|
},
|
|
322
323
|
d
|
|
323
324
|
))
|
|
324
325
|
] }),
|
|
325
|
-
/* @__PURE__ */ n("div", { className: "nice-scheduler__timeline-body", children: S.map((
|
|
326
|
-
const d = e.filter((o) => !p || o.resourceId ===
|
|
326
|
+
/* @__PURE__ */ n("div", { className: "nice-scheduler__timeline-body", children: S.map((v) => {
|
|
327
|
+
const d = e.filter((o) => !p || o.resourceId === v.id);
|
|
327
328
|
return /* @__PURE__ */ g("div", { className: "nice-scheduler__timeline-row", children: [
|
|
328
|
-
/* @__PURE__ */ n("div", { className: "nice-scheduler__timeline-res-label", children:
|
|
329
|
+
/* @__PURE__ */ n("div", { className: "nice-scheduler__timeline-res-label", children: v.name }),
|
|
329
330
|
w.map((o, M) => {
|
|
330
|
-
const a = d.filter((u) =>
|
|
331
|
+
const a = d.filter((u) => R(new Date(u.start), o));
|
|
331
332
|
return /* @__PURE__ */ n(
|
|
332
333
|
"div",
|
|
333
334
|
{
|
|
334
335
|
className: "nice-scheduler__timeline-cell",
|
|
335
336
|
onDragOver: y && !b ? (u) => u.preventDefault() : void 0,
|
|
336
337
|
onDrop: y && !b ? () => {
|
|
337
|
-
if (!
|
|
338
|
+
if (!l.current || !$)
|
|
338
339
|
return;
|
|
339
|
-
const u =
|
|
340
|
+
const u = l.current.event, T = new Date(u.end).getTime() - new Date(u.start).getTime(), m = new Date(o);
|
|
340
341
|
m.setHours(
|
|
341
342
|
new Date(u.start).getHours(),
|
|
342
343
|
new Date(u.start).getMinutes()
|
|
343
|
-
), $(u, m, new Date(m.getTime() + T),
|
|
344
|
+
), $(u, m, new Date(m.getTime() + T), v.id), l.current = null;
|
|
344
345
|
} : void 0,
|
|
345
|
-
onClick: () => !b &&
|
|
346
|
+
onClick: () => !b && _?.(o, A(o, 1), v.id),
|
|
346
347
|
children: a.map((u) => /* @__PURE__ */ n(
|
|
347
348
|
G,
|
|
348
349
|
{
|
|
349
350
|
ev: u,
|
|
350
351
|
renderEvent: D,
|
|
351
|
-
onClick:
|
|
352
|
+
onClick: f,
|
|
352
353
|
draggable: y && !b,
|
|
353
|
-
dragRef:
|
|
354
|
+
dragRef: l,
|
|
354
355
|
onHover: F,
|
|
355
|
-
categoryColor:
|
|
356
|
+
categoryColor: B(u, E)
|
|
356
357
|
},
|
|
357
358
|
u.id
|
|
358
359
|
))
|
|
@@ -360,48 +361,48 @@ const Se = ({
|
|
|
360
361
|
M
|
|
361
362
|
);
|
|
362
363
|
})
|
|
363
|
-
] },
|
|
364
|
+
] }, v.id);
|
|
364
365
|
}) })
|
|
365
366
|
] });
|
|
366
|
-
},
|
|
367
|
+
}, Pe = ({ categories: e, events: c, filteredCategories: s, onToggleCategory: p, t: y }) => /* @__PURE__ */ g("div", { className: "nice-scheduler__legend", children: [
|
|
367
368
|
/* @__PURE__ */ n("div", { className: "nice-scheduler__legend-title", children: y("legend", "Legend") }),
|
|
368
|
-
e.map((
|
|
369
|
-
const
|
|
369
|
+
e.map((l) => {
|
|
370
|
+
const f = c.filter(($) => $.category === l.key).length, _ = !s.has(l.key);
|
|
370
371
|
return /* @__PURE__ */ g(
|
|
371
372
|
"button",
|
|
372
373
|
{
|
|
373
|
-
className: `nice-scheduler__legend-item ${
|
|
374
|
-
onClick: () => p(
|
|
374
|
+
className: `nice-scheduler__legend-item ${_ ? "" : "nice-scheduler__legend-item--hidden"}`,
|
|
375
|
+
onClick: () => p(l.key),
|
|
375
376
|
children: [
|
|
376
377
|
/* @__PURE__ */ n(
|
|
377
378
|
"span",
|
|
378
379
|
{
|
|
379
380
|
className: "nice-scheduler__legend-dot",
|
|
380
|
-
style: { backgroundColor:
|
|
381
|
+
style: { backgroundColor: _ ? l.color : "var(--nice-border-color, #ccc)" }
|
|
381
382
|
}
|
|
382
383
|
),
|
|
383
|
-
/* @__PURE__ */ n("span", { className: "nice-scheduler__legend-label", children:
|
|
384
|
-
/* @__PURE__ */ n("span", { className: "nice-scheduler__legend-count", children:
|
|
384
|
+
/* @__PURE__ */ n("span", { className: "nice-scheduler__legend-label", children: l.label }),
|
|
385
|
+
/* @__PURE__ */ n("span", { className: "nice-scheduler__legend-count", children: f })
|
|
385
386
|
]
|
|
386
387
|
},
|
|
387
|
-
|
|
388
|
+
l.key
|
|
388
389
|
);
|
|
389
390
|
})
|
|
390
|
-
] }),
|
|
391
|
-
const { lang: y } =
|
|
391
|
+
] }), Ie = ({ curDate: e, onDateSelect: c, firstDayOfWeek: s, t: p }) => {
|
|
392
|
+
const { lang: y } = j(), [l, f] = q.useState(e.getMonth()), [_, $] = q.useState(e.getFullYear()), E = new Date(_, l, 1), D = new Date(_, l + 1, 0), F = (E.getDay() - s + 7) % 7, b = [];
|
|
392
393
|
for (let d = F - 1; d >= 0; d--)
|
|
393
394
|
b.push(A(E, -d - 1));
|
|
394
395
|
for (let d = 0; d < D.getDate(); d++)
|
|
395
|
-
b.push(new Date(
|
|
396
|
+
b.push(new Date(_, l, d + 1));
|
|
396
397
|
const r = 7 - b.length % 7;
|
|
397
398
|
if (r < 7)
|
|
398
399
|
for (let d = 1; d <= r; d++)
|
|
399
|
-
b.push(new Date(
|
|
400
|
+
b.push(new Date(_, l + 1, d));
|
|
400
401
|
const w = () => {
|
|
401
|
-
|
|
402
|
+
l === 0 ? (f(11), $((d) => d - 1)) : f((d) => d - 1);
|
|
402
403
|
}, S = () => {
|
|
403
|
-
|
|
404
|
-
}, i =
|
|
404
|
+
l === 11 ? (f(0), $((d) => d + 1)) : f((d) => d + 1);
|
|
405
|
+
}, i = le(y, "short"), v = W(y, "short");
|
|
405
406
|
return /* @__PURE__ */ g("div", { className: "nice-scheduler__mini-cal", children: [
|
|
406
407
|
/* @__PURE__ */ g("div", { className: "nice-scheduler__mini-cal-header", children: [
|
|
407
408
|
/* @__PURE__ */ n(
|
|
@@ -411,13 +412,13 @@ const Se = ({
|
|
|
411
412
|
className: "nice-btn nice-btn--xs",
|
|
412
413
|
onClick: w,
|
|
413
414
|
"aria-label": p("scheduler.prevMonth", "Previous month"),
|
|
414
|
-
children: /* @__PURE__ */ n(
|
|
415
|
+
children: /* @__PURE__ */ n(Z, { name: "chevron-left", size: "sm" })
|
|
415
416
|
}
|
|
416
417
|
),
|
|
417
418
|
/* @__PURE__ */ g("span", { children: [
|
|
418
|
-
i[
|
|
419
|
+
i[l],
|
|
419
420
|
" ",
|
|
420
|
-
|
|
421
|
+
_
|
|
421
422
|
] }),
|
|
422
423
|
/* @__PURE__ */ n(
|
|
423
424
|
"button",
|
|
@@ -426,14 +427,14 @@ const Se = ({
|
|
|
426
427
|
className: "nice-btn nice-btn--xs",
|
|
427
428
|
onClick: S,
|
|
428
429
|
"aria-label": p("scheduler.nextMonth", "Next month"),
|
|
429
|
-
children: /* @__PURE__ */ n(
|
|
430
|
+
children: /* @__PURE__ */ n(Z, { name: "chevron-right", size: "sm" })
|
|
430
431
|
}
|
|
431
432
|
)
|
|
432
433
|
] }),
|
|
433
434
|
/* @__PURE__ */ g("div", { className: "nice-scheduler__mini-cal-grid", children: [
|
|
434
|
-
|
|
435
|
+
v.map((d, o) => /* @__PURE__ */ n("div", { className: "nice-scheduler__mini-cal-dayname", children: v[(s + o) % 7].charAt(0) }, o)),
|
|
435
436
|
b.map((d, o) => {
|
|
436
|
-
const M =
|
|
437
|
+
const M = R(d, /* @__PURE__ */ new Date()), a = R(d, e), u = d.getMonth() !== l;
|
|
437
438
|
return /* @__PURE__ */ n(
|
|
438
439
|
"button",
|
|
439
440
|
{
|
|
@@ -446,15 +447,15 @@ const Se = ({
|
|
|
446
447
|
})
|
|
447
448
|
] })
|
|
448
449
|
] });
|
|
449
|
-
},
|
|
450
|
+
}, Fe = ({
|
|
450
451
|
events: e,
|
|
451
452
|
rangeStart: c,
|
|
452
|
-
rangeEnd:
|
|
453
|
+
rangeEnd: s,
|
|
453
454
|
startHour: p,
|
|
454
455
|
endHour: y,
|
|
455
|
-
draggable:
|
|
456
|
-
dragRef:
|
|
457
|
-
onEventClick:
|
|
456
|
+
draggable: l,
|
|
457
|
+
dragRef: f,
|
|
458
|
+
onEventClick: _,
|
|
458
459
|
onSlotClick: $,
|
|
459
460
|
onEventDrop: E,
|
|
460
461
|
categories: D,
|
|
@@ -464,10 +465,10 @@ const Se = ({
|
|
|
464
465
|
onHoverEvent: w,
|
|
465
466
|
readOnly: S
|
|
466
467
|
}) => {
|
|
467
|
-
const { lang: i } =
|
|
468
|
+
const { lang: i } = j(), v = [];
|
|
468
469
|
let d = new Date(c);
|
|
469
|
-
for (; d <=
|
|
470
|
-
|
|
470
|
+
for (; d <= s; )
|
|
471
|
+
v.push(new Date(d)), d = A(d, 1);
|
|
471
472
|
const o = [];
|
|
472
473
|
for (let h = p; h < y; h++)
|
|
473
474
|
o.push(h);
|
|
@@ -476,15 +477,15 @@ const Se = ({
|
|
|
476
477
|
const h = a.current;
|
|
477
478
|
if (!h)
|
|
478
479
|
return;
|
|
479
|
-
const C = /* @__PURE__ */ new Date(),
|
|
480
|
-
(k) =>
|
|
480
|
+
const C = /* @__PURE__ */ new Date(), L = e.filter(
|
|
481
|
+
(k) => v.some((z) => R(z, C) && R(new Date(k.start), C))
|
|
481
482
|
);
|
|
482
|
-
let V =
|
|
483
|
+
let V = L.length > 0 ? Math.min(...L.map((k) => new Date(k.start).getHours())) : C.getHours();
|
|
483
484
|
V = Math.max(p, Math.min(V, y - 1));
|
|
484
|
-
const
|
|
485
|
-
if (
|
|
485
|
+
const Y = h.children[V - p];
|
|
486
|
+
if (Y) {
|
|
486
487
|
const k = T.current ?? h.closest(".nice-scheduler__content") ?? h.closest(".nice-scheduler__timegrid");
|
|
487
|
-
k && (k.scrollTop =
|
|
488
|
+
k && (k.scrollTop = Y.offsetTop - 4);
|
|
488
489
|
}
|
|
489
490
|
}, []);
|
|
490
491
|
const t = (h) => {
|
|
@@ -499,12 +500,12 @@ const Se = ({
|
|
|
499
500
|
"aria-hidden": "true",
|
|
500
501
|
children: /* @__PURE__ */ g("div", { className: "nice-scheduler__timegrid-header", children: [
|
|
501
502
|
/* @__PURE__ */ n("div", { className: "nice-scheduler__time-gutter" }),
|
|
502
|
-
|
|
503
|
-
const
|
|
503
|
+
v.map((h, C) => {
|
|
504
|
+
const L = h.getDay() === 0 || h.getDay() === 6;
|
|
504
505
|
return /* @__PURE__ */ g(
|
|
505
506
|
"div",
|
|
506
507
|
{
|
|
507
|
-
className: `nice-scheduler__timegrid-day-header ${
|
|
508
|
+
className: `nice-scheduler__timegrid-day-header ${R(h, m) ? "nice-scheduler__timegrid-day-header--today" : ""} ${L ? "nice-scheduler__timegrid-day-header--weekend" : ""}`,
|
|
508
509
|
children: [
|
|
509
510
|
/* @__PURE__ */ n("div", { className: "nice-scheduler__timegrid-day-name", children: M[h.getDay()] }),
|
|
510
511
|
/* @__PURE__ */ n("div", { className: "nice-scheduler__timegrid-day-num", children: h.getDate() })
|
|
@@ -537,38 +538,38 @@ const Se = ({
|
|
|
537
538
|
className: `nice-scheduler__timegrid-row ${C ? "nice-scheduler__timegrid-row--work" : ""}`,
|
|
538
539
|
children: [
|
|
539
540
|
/* @__PURE__ */ n("div", { className: "nice-scheduler__time-gutter", children: `${h.toString().padStart(2, "0")}:00` }),
|
|
540
|
-
|
|
541
|
-
const
|
|
542
|
-
const
|
|
543
|
-
return z
|
|
541
|
+
v.map((L, V) => {
|
|
542
|
+
const Y = e.filter((k) => {
|
|
543
|
+
const z = new Date(k.start);
|
|
544
|
+
return R(z, L) && z.getHours() === h;
|
|
544
545
|
});
|
|
545
546
|
return /* @__PURE__ */ n(
|
|
546
547
|
"div",
|
|
547
548
|
{
|
|
548
549
|
className: "nice-scheduler__timegrid-cell",
|
|
549
|
-
onDragOver:
|
|
550
|
-
onDrop:
|
|
551
|
-
if (!
|
|
550
|
+
onDragOver: l && !S ? (k) => k.preventDefault() : void 0,
|
|
551
|
+
onDrop: l && !S ? () => {
|
|
552
|
+
if (!f.current || !E)
|
|
552
553
|
return;
|
|
553
|
-
const k =
|
|
554
|
-
H.setHours(h, 0, 0, 0), E(k, H, new Date(H.getTime() +
|
|
554
|
+
const k = f.current.event, z = new Date(k.end).getTime() - new Date(k.start).getTime(), H = new Date(L);
|
|
555
|
+
H.setHours(h, 0, 0, 0), E(k, H, new Date(H.getTime() + z)), f.current = null;
|
|
555
556
|
} : void 0,
|
|
556
557
|
onClick: () => !S && (() => {
|
|
557
|
-
const k = new Date(
|
|
558
|
+
const k = new Date(L);
|
|
558
559
|
k.setHours(h);
|
|
559
|
-
const
|
|
560
|
-
|
|
560
|
+
const z = new Date(k);
|
|
561
|
+
z.setHours(h + 1), $?.(k, z);
|
|
561
562
|
})(),
|
|
562
|
-
children:
|
|
563
|
+
children: Y.map((k) => /* @__PURE__ */ n(
|
|
563
564
|
G,
|
|
564
565
|
{
|
|
565
566
|
ev: k,
|
|
566
567
|
renderEvent: r,
|
|
567
|
-
onClick:
|
|
568
|
-
draggable:
|
|
569
|
-
dragRef:
|
|
568
|
+
onClick: _,
|
|
569
|
+
draggable: l && !S,
|
|
570
|
+
dragRef: f,
|
|
570
571
|
onHover: w,
|
|
571
|
-
categoryColor:
|
|
572
|
+
categoryColor: B(k, D)
|
|
572
573
|
},
|
|
573
574
|
k.id
|
|
574
575
|
))
|
|
@@ -581,55 +582,55 @@ const Se = ({
|
|
|
581
582
|
h
|
|
582
583
|
);
|
|
583
584
|
}),
|
|
584
|
-
I &&
|
|
585
|
+
I && v.some((h) => R(h, m)) && /* @__PURE__ */ n("div", { className: "nice-scheduler__now-line", style: { top: `${x}%` }, children: /* @__PURE__ */ n("div", { className: "nice-scheduler__now-dot" }) })
|
|
585
586
|
]
|
|
586
587
|
}
|
|
587
588
|
)
|
|
588
589
|
}
|
|
589
590
|
)
|
|
590
591
|
] });
|
|
591
|
-
},
|
|
592
|
+
}, Le = ({
|
|
592
593
|
events: e,
|
|
593
594
|
rangeStart: c,
|
|
594
|
-
rangeEnd:
|
|
595
|
+
rangeEnd: s,
|
|
595
596
|
firstDayOfWeek: p,
|
|
596
597
|
onSlotClick: y,
|
|
597
|
-
onEventClick:
|
|
598
|
-
draggable:
|
|
599
|
-
dragRef:
|
|
598
|
+
onEventClick: l,
|
|
599
|
+
draggable: f,
|
|
600
|
+
dragRef: _,
|
|
600
601
|
categories: $,
|
|
601
602
|
renderEvent: E,
|
|
602
603
|
onHoverEvent: D,
|
|
603
604
|
readOnly: F
|
|
604
605
|
}) => {
|
|
605
|
-
const { lang: b } =
|
|
606
|
+
const { lang: b } = j(), r = W(b, "short");
|
|
606
607
|
W(b, "long");
|
|
607
608
|
const w = [];
|
|
608
609
|
let S = new Date(c);
|
|
609
|
-
for (; S <=
|
|
610
|
+
for (; S <= s; )
|
|
610
611
|
w.push(new Date(S)), S = A(S, 1);
|
|
611
|
-
const i = (w[0].getDay() - p + 7) % 7,
|
|
612
|
+
const i = (w[0].getDay() - p + 7) % 7, v = [];
|
|
612
613
|
for (let o = i - 1; o >= 0; o--)
|
|
613
|
-
|
|
614
|
-
w.forEach((o) =>
|
|
615
|
-
const d = 7 -
|
|
614
|
+
v.push({ date: A(w[0], -o - 1), inRange: !1 });
|
|
615
|
+
w.forEach((o) => v.push({ date: o, inRange: !0 }));
|
|
616
|
+
const d = 7 - v.length % 7;
|
|
616
617
|
if (d < 7) {
|
|
617
618
|
const o = w[w.length - 1];
|
|
618
619
|
for (let M = 1; M <= d; M++)
|
|
619
|
-
|
|
620
|
+
v.push({ date: A(o, M), inRange: !1 });
|
|
620
621
|
}
|
|
621
622
|
return /* @__PURE__ */ g("div", { className: "nice-scheduler__month nice-scheduler__month--range", children: [
|
|
622
623
|
/* @__PURE__ */ n("div", { className: "nice-scheduler__month-header", children: Array.from({ length: 7 }, (o, M) => /* @__PURE__ */ n("div", { className: "nice-scheduler__month-dayname", children: r[(p + M) % 7] }, M)) }),
|
|
623
|
-
/* @__PURE__ */ n("div", { className: "nice-scheduler__month-grid", children:
|
|
624
|
-
const a =
|
|
624
|
+
/* @__PURE__ */ n("div", { className: "nice-scheduler__month-grid", children: v.map((o, M) => {
|
|
625
|
+
const a = ae(e, o.date), u = R(o.date, /* @__PURE__ */ new Date()), T = o.date.getDay() === 0 || o.date.getDay() === 6;
|
|
625
626
|
return /* @__PURE__ */ g(
|
|
626
627
|
"div",
|
|
627
628
|
{
|
|
628
629
|
className: `nice-scheduler__month-cell ${o.inRange ? "" : "nice-scheduler__month-cell--other"} ${u ? "nice-scheduler__month-cell--today" : ""} ${T ? "nice-scheduler__month-cell--weekend" : ""}`,
|
|
629
630
|
onClick: () => !F && y?.(o.date, A(o.date, 1)),
|
|
630
631
|
children: [
|
|
631
|
-
/* @__PURE__ */ n("div", { className: "nice-scheduler__month-date", children: o.date.getDate() === 1 || M === 0 ? /* @__PURE__ */ g(
|
|
632
|
-
/* @__PURE__ */ n("span", { className: "nice-scheduler__month-monthname", children:
|
|
632
|
+
/* @__PURE__ */ n("div", { className: "nice-scheduler__month-date", children: o.date.getDate() === 1 || M === 0 ? /* @__PURE__ */ g(se, { children: [
|
|
633
|
+
/* @__PURE__ */ n("span", { className: "nice-scheduler__month-monthname", children: le(b, "short")[o.date.getMonth()] }),
|
|
633
634
|
" ",
|
|
634
635
|
o.date.getDate()
|
|
635
636
|
] }) : o.date.getDate() }),
|
|
@@ -638,11 +639,11 @@ const Se = ({
|
|
|
638
639
|
{
|
|
639
640
|
ev: m,
|
|
640
641
|
renderEvent: E,
|
|
641
|
-
onClick:
|
|
642
|
-
draggable:
|
|
643
|
-
dragRef:
|
|
642
|
+
onClick: l,
|
|
643
|
+
draggable: f && !F,
|
|
644
|
+
dragRef: _,
|
|
644
645
|
onHover: D,
|
|
645
|
-
categoryColor:
|
|
646
|
+
categoryColor: B(m, $)
|
|
646
647
|
},
|
|
647
648
|
m.id
|
|
648
649
|
)),
|
|
@@ -656,8 +657,7 @@ const Se = ({
|
|
|
656
657
|
);
|
|
657
658
|
}) })
|
|
658
659
|
] });
|
|
659
|
-
}, Re = ({ event: e, rect: c, categories:
|
|
660
|
-
const { lang: y } = Y();
|
|
660
|
+
}, Re = ({ event: e, rect: c, categories: s, renderTooltip: p }) => {
|
|
661
661
|
if (p)
|
|
662
662
|
return /* @__PURE__ */ n(
|
|
663
663
|
"div",
|
|
@@ -667,7 +667,7 @@ const Se = ({
|
|
|
667
667
|
children: p(e)
|
|
668
668
|
}
|
|
669
669
|
);
|
|
670
|
-
const
|
|
670
|
+
const y = s?.find((l) => l.key === e.category);
|
|
671
671
|
return /* @__PURE__ */ g(
|
|
672
672
|
"div",
|
|
673
673
|
{
|
|
@@ -676,28 +676,29 @@ const Se = ({
|
|
|
676
676
|
children: [
|
|
677
677
|
/* @__PURE__ */ n("div", { className: "nice-scheduler__tooltip-title", children: e.title }),
|
|
678
678
|
/* @__PURE__ */ g("div", { className: "nice-scheduler__tooltip-time", children: [
|
|
679
|
-
K(
|
|
680
|
-
" –
|
|
681
|
-
|
|
679
|
+
X(K(), new Date(e.start)),
|
|
680
|
+
" –",
|
|
681
|
+
" ",
|
|
682
|
+
X(K(), new Date(e.end))
|
|
682
683
|
] }),
|
|
683
|
-
|
|
684
|
-
/* @__PURE__ */ n("span", { className: "nice-scheduler__tooltip-dot", style: { backgroundColor:
|
|
685
|
-
|
|
684
|
+
y && /* @__PURE__ */ g("div", { className: "nice-scheduler__tooltip-cat", children: [
|
|
685
|
+
/* @__PURE__ */ n("span", { className: "nice-scheduler__tooltip-dot", style: { backgroundColor: y.color } }),
|
|
686
|
+
y.label
|
|
686
687
|
] }),
|
|
687
688
|
e.description && /* @__PURE__ */ n("div", { className: "nice-scheduler__tooltip-desc", children: e.description }),
|
|
688
|
-
/* @__PURE__ */ n(
|
|
689
|
+
/* @__PURE__ */ n(oe, { ev: e })
|
|
689
690
|
]
|
|
690
691
|
}
|
|
691
692
|
);
|
|
692
693
|
}, ze = ({
|
|
693
694
|
event: e,
|
|
694
695
|
slotStart: c,
|
|
695
|
-
slotEnd:
|
|
696
|
+
slotEnd: s,
|
|
696
697
|
categories: p,
|
|
697
698
|
resources: y,
|
|
698
|
-
formFields:
|
|
699
|
-
formFieldsByType:
|
|
700
|
-
eventTypes:
|
|
699
|
+
formFields: l,
|
|
700
|
+
formFieldsByType: f,
|
|
701
|
+
eventTypes: _,
|
|
701
702
|
renderEditor: $,
|
|
702
703
|
saving: E,
|
|
703
704
|
onSave: D,
|
|
@@ -713,7 +714,7 @@ const Se = ({
|
|
|
713
714
|
category: e?.category ?? "",
|
|
714
715
|
eventStyle: e?.eventStyle ?? "solid",
|
|
715
716
|
start: e?.start ?? c ?? /* @__PURE__ */ new Date(),
|
|
716
|
-
end: e?.end ??
|
|
717
|
+
end: e?.end ?? s ?? /* @__PURE__ */ new Date(),
|
|
717
718
|
allDay: e?.allDay ?? !1,
|
|
718
719
|
resourceId: e?.resourceId ?? "",
|
|
719
720
|
eventType: e?.eventType ?? "task",
|
|
@@ -742,46 +743,54 @@ const Se = ({
|
|
|
742
743
|
serviceCurrency: e?.service?.currency ?? "PLN",
|
|
743
744
|
serviceNotes: e?.service?.notes ?? ""
|
|
744
745
|
}),
|
|
745
|
-
[e, c,
|
|
746
|
-
), [i,
|
|
746
|
+
[e, c, s]
|
|
747
|
+
), [i, v] = q.useState(S);
|
|
747
748
|
q.useEffect(() => {
|
|
748
|
-
|
|
749
|
+
v(S);
|
|
749
750
|
}, [S]);
|
|
750
751
|
const d = q.useCallback((a, u) => {
|
|
751
|
-
|
|
752
|
+
v((T) => ({ ...T, [a]: u }));
|
|
752
753
|
}, []), o = q.useMemo(() => {
|
|
753
|
-
if (
|
|
754
|
-
return
|
|
754
|
+
if (l && l.length > 0)
|
|
755
|
+
return l;
|
|
755
756
|
const a = (t) => t.toString().padStart(2, "0"), u = (t) => `${t.getFullYear()}-${a(t.getMonth() + 1)}-${a(t.getDate())}`, T = (t) => `${a(t.getHours())}:${a(t.getMinutes())}`, m = (t, h) => {
|
|
756
|
-
const C = t instanceof Date ? t : new Date(t),
|
|
757
|
-
const [
|
|
758
|
-
!isNaN(
|
|
757
|
+
const C = t instanceof Date ? t : new Date(t), L = isNaN(C.getTime()) ? /* @__PURE__ */ new Date() : C, V = u(L), Y = T(L), k = (z, H) => {
|
|
758
|
+
const [O, ee, te] = z.split("-").map((Q) => parseInt(Q, 10)), [ne, re] = H.split(":").map((Q) => parseInt(Q, 10)), J = new Date(L);
|
|
759
|
+
!isNaN(O) && !isNaN(ee) && !isNaN(te) && J.setFullYear(O, ee - 1, te), !isNaN(ne) && !isNaN(re) && J.setHours(ne, re, 0, 0), h(J);
|
|
759
760
|
};
|
|
760
761
|
return /* @__PURE__ */ g("div", { style: { display: "flex", gap: 12, flexWrap: "wrap", alignItems: "flex-end" }, children: [
|
|
761
762
|
/* @__PURE__ */ g("div", { style: { display: "flex", flexDirection: "column", gap: 2 }, children: [
|
|
762
763
|
/* @__PURE__ */ n("span", { style: { fontSize: "0.7rem", color: "var(--nice-text-muted, #888)" }, children: r("date", "Date") }),
|
|
763
|
-
/* @__PURE__ */ n(
|
|
764
|
+
/* @__PURE__ */ n(
|
|
765
|
+
ie,
|
|
766
|
+
{
|
|
767
|
+
dateFormatPreset: "date-local",
|
|
768
|
+
value: V,
|
|
769
|
+
onChange: (z) => k(z, Y),
|
|
770
|
+
size: "sm"
|
|
771
|
+
}
|
|
772
|
+
)
|
|
764
773
|
] }),
|
|
765
774
|
/* @__PURE__ */ g("div", { style: { display: "flex", flexDirection: "column", gap: 2 }, children: [
|
|
766
775
|
/* @__PURE__ */ n("span", { style: { fontSize: "0.7rem", color: "var(--nice-text-muted, #888)" }, children: r("time", "Time") }),
|
|
767
776
|
/* @__PURE__ */ n(
|
|
768
|
-
|
|
777
|
+
ie,
|
|
769
778
|
{
|
|
770
779
|
dateFormatPreset: "time",
|
|
771
|
-
value:
|
|
772
|
-
onChange: (
|
|
780
|
+
value: Y,
|
|
781
|
+
onChange: (z) => k(V, z),
|
|
773
782
|
size: "sm"
|
|
774
783
|
}
|
|
775
784
|
)
|
|
776
785
|
] })
|
|
777
786
|
] });
|
|
778
787
|
}, N = [];
|
|
779
|
-
|
|
788
|
+
_ && _.length > 1 && N.push({
|
|
780
789
|
field: "eventType",
|
|
781
790
|
label: r("eventType", "Type"),
|
|
782
791
|
type: "select",
|
|
783
792
|
group: r("common", "Common"),
|
|
784
|
-
options:
|
|
793
|
+
options: _.map((t) => ({
|
|
785
794
|
label: t.icon ? `${t.icon} ${t.label}` : t.label,
|
|
786
795
|
value: t.type
|
|
787
796
|
}))
|
|
@@ -816,7 +825,7 @@ const Se = ({
|
|
|
816
825
|
label: r("color", "Color"),
|
|
817
826
|
group: r("common", "Common"),
|
|
818
827
|
render: (t, h) => /* @__PURE__ */ n(
|
|
819
|
-
|
|
828
|
+
me,
|
|
820
829
|
{
|
|
821
830
|
value: typeof t == "string" ? t : "var(--nice-primary, #3b82f6)",
|
|
822
831
|
onChange: h,
|
|
@@ -875,7 +884,7 @@ const Se = ({
|
|
|
875
884
|
group: P,
|
|
876
885
|
visibleWhen: (t) => !!t.recurring
|
|
877
886
|
});
|
|
878
|
-
const x = i.eventType ?? "task", I =
|
|
887
|
+
const x = i.eventType ?? "task", I = f?.[x];
|
|
879
888
|
if (I && I.length > 0)
|
|
880
889
|
N.push(...I);
|
|
881
890
|
else if (x === "recipe") {
|
|
@@ -959,7 +968,7 @@ const Se = ({
|
|
|
959
968
|
);
|
|
960
969
|
}
|
|
961
970
|
return N;
|
|
962
|
-
}, [
|
|
971
|
+
}, [l, f, _, p, y, i.eventType, r]), M = () => {
|
|
963
972
|
const a = i.eventType ?? "task", u = {
|
|
964
973
|
title: i.title,
|
|
965
974
|
description: i.description || void 0,
|
|
@@ -999,7 +1008,7 @@ const Se = ({
|
|
|
999
1008
|
id: `step-${I}`,
|
|
1000
1009
|
order: I + 1,
|
|
1001
1010
|
instruction: x
|
|
1002
|
-
})), N = e?.recipe ??
|
|
1011
|
+
})), N = e?.recipe ?? ge(), P = {
|
|
1003
1012
|
...N,
|
|
1004
1013
|
title: i.recipeTitle || i.title || N.title,
|
|
1005
1014
|
servings: typeof i.recipeServings == "number" ? i.recipeServings : N.servings,
|
|
@@ -1026,15 +1035,15 @@ const Se = ({
|
|
|
1026
1035
|
return w && (u.id = e.id), u;
|
|
1027
1036
|
};
|
|
1028
1037
|
return /* @__PURE__ */ n(
|
|
1029
|
-
|
|
1038
|
+
he,
|
|
1030
1039
|
{
|
|
1031
1040
|
open: !0,
|
|
1032
1041
|
onClose: b,
|
|
1033
1042
|
title: w ? r("editEvent", "Edit Event") : r("newEvent", "New Event"),
|
|
1034
1043
|
size: "md",
|
|
1035
|
-
footer: $ ? null : /* @__PURE__ */ g(
|
|
1044
|
+
footer: $ ? null : /* @__PURE__ */ g(se, { children: [
|
|
1036
1045
|
w && F && /* @__PURE__ */ n(
|
|
1037
|
-
|
|
1046
|
+
U,
|
|
1038
1047
|
{
|
|
1039
1048
|
type: "button",
|
|
1040
1049
|
variant: "error",
|
|
@@ -1048,7 +1057,7 @@ const Se = ({
|
|
|
1048
1057
|
),
|
|
1049
1058
|
/* @__PURE__ */ n("div", { style: { flex: 1 } }),
|
|
1050
1059
|
/* @__PURE__ */ n(
|
|
1051
|
-
|
|
1060
|
+
U,
|
|
1052
1061
|
{
|
|
1053
1062
|
type: "button",
|
|
1054
1063
|
variant: "secondary",
|
|
@@ -1059,7 +1068,7 @@ const Se = ({
|
|
|
1059
1068
|
}
|
|
1060
1069
|
),
|
|
1061
1070
|
/* @__PURE__ */ n(
|
|
1062
|
-
|
|
1071
|
+
U,
|
|
1063
1072
|
{
|
|
1064
1073
|
type: "button",
|
|
1065
1074
|
variant: "primary",
|
|
@@ -1082,12 +1091,12 @@ const Se = ({
|
|
|
1082
1091
|
children: $ ? $({
|
|
1083
1092
|
event: e,
|
|
1084
1093
|
slotStart: c,
|
|
1085
|
-
slotEnd:
|
|
1094
|
+
slotEnd: s,
|
|
1086
1095
|
save: D,
|
|
1087
1096
|
cancel: b,
|
|
1088
1097
|
remove: F
|
|
1089
1098
|
}) : /* @__PURE__ */ n(
|
|
1090
|
-
|
|
1099
|
+
ue,
|
|
1091
1100
|
{
|
|
1092
1101
|
items: o,
|
|
1093
1102
|
data: i,
|
|
@@ -1103,15 +1112,15 @@ const Se = ({
|
|
|
1103
1112
|
);
|
|
1104
1113
|
};
|
|
1105
1114
|
export {
|
|
1106
|
-
|
|
1107
|
-
|
|
1115
|
+
$e as AgendaView,
|
|
1116
|
+
Fe as DayRangeView,
|
|
1108
1117
|
G as EventChip,
|
|
1109
1118
|
ze as EventEditorForm,
|
|
1110
1119
|
Re as EventTooltip,
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1120
|
+
Ie as MiniCalendar,
|
|
1121
|
+
Le as MonthRangeView,
|
|
1122
|
+
Te as MonthView,
|
|
1123
|
+
Pe as SchedulerLegend,
|
|
1124
|
+
xe as TimeGridView,
|
|
1125
|
+
Ee as TimelineView
|
|
1117
1126
|
};
|