@nice2dev/ui 1.1.5 → 1.1.7
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 +102 -0
- package/README.md +50 -29
- package/css/legacy-bg-text-aliases.css +65 -61
- package/dist/NiceCodeEditor-Bc81wiaN.js +1134 -0
- package/dist/NiceCodeEditor-D6f8KdHN.js +1134 -0
- package/dist/NiceCodeEditor-DE3saxyt.cjs +260 -0
- package/dist/NiceCodeEditor-DZM16My5.cjs +260 -0
- package/dist/NiceCodeEditor-HqmcJjmZ.js +1179 -0
- package/dist/NiceColorPicker-6EqXaDj0.cjs +1 -0
- package/dist/NiceColorPicker-BiEWqWnd.js +596 -0
- package/dist/NiceColorPicker-Cuc6YXqz.cjs +1 -0
- package/dist/NiceColorPicker-DMATcNWG.js +596 -0
- package/dist/NiceColorPicker-R3O1nemp.js +596 -0
- package/dist/NiceConfirmDialog-B0e10fRL.cjs +1 -0
- package/dist/NiceConfirmDialog-BBDgEMHv.js +81 -0
- package/dist/NiceConfirmDialog-C7kdr8jJ.js +81 -0
- package/dist/NiceConfirmDialog-DMHqPfFM.js +81 -0
- package/dist/NiceConfirmDialog-ZJpQLQQS.cjs +1 -0
- package/dist/NiceDataGrid-BzUw4dSu.cjs +10 -0
- package/dist/NiceDataGrid-CPKcVOVz.js +1743 -0
- package/dist/NiceDataGrid-DJr33WMy.cjs +10 -0
- package/dist/NiceDataGrid-D_4gZ1Hu.js +1736 -0
- package/dist/NiceDataGrid-DlUAaXhD.js +1736 -0
- package/dist/NiceDocumentViewer-8ghRVtfO.js +672 -0
- package/dist/NiceDocumentViewer-ChWtA_Ry.cjs +180 -0
- package/dist/NiceDocumentViewer-DwLUV7Tc.js +672 -0
- package/dist/NiceDocumentViewer-goMzF1w3.cjs +180 -0
- package/dist/NiceDocumentViewer-gt1mxzP8.js +672 -0
- package/dist/NiceForm-CHEAHxDw.js +4805 -0
- package/dist/NiceForm-CJUp1CL0.cjs +1 -0
- package/dist/NiceForm-Cp_RH3Yj.js +4805 -0
- package/dist/NiceForm-a6tGr6ss.js +4819 -0
- package/dist/NiceForm-jU89oe2S.cjs +1 -0
- package/dist/NiceGantt-BnQwyTfG.cjs +1 -0
- package/dist/NiceGantt-D8coFAvK.js +328 -0
- package/dist/NiceGantt-DOZfT6r5.js +328 -0
- package/dist/NiceGantt-DQzH1V-R.js +328 -0
- package/dist/NiceGantt-jQ8ZpXko.cjs +1 -0
- package/dist/NiceHtmlEditor-B1nlXJNW.cjs +10 -0
- package/dist/NiceHtmlEditor-Bv3VqJPG.js +862 -0
- package/dist/NiceHtmlEditor-CKsGj-Ei.cjs +10 -0
- package/dist/NiceHtmlEditor-CloMgyzg.js +841 -0
- package/dist/NiceHtmlEditor-DUAHmkWI.js +841 -0
- package/dist/NiceLoginForm-Ce_QLnLf.js +736 -0
- package/dist/NiceLoginForm-DLpNTQlR.cjs +1 -0
- package/dist/NiceLoginForm-Dg0286Cc.js +736 -0
- package/dist/NiceLoginForm-X05Vadeg.js +708 -0
- package/dist/NiceLoginForm-f_dBCnUi.cjs +1 -0
- package/dist/NiceMention-BByI4nFG.js +11120 -0
- package/dist/NiceMention-BjeLN4Jx.cjs +430 -0
- package/dist/NiceMention-C2TPiMph.cjs +430 -0
- package/dist/NiceMention-C67vT6m0.js +11145 -0
- package/dist/NiceMention-D1cdy63w.cjs +430 -0
- package/dist/NiceMention-OaCi-GNO.js +11094 -0
- package/dist/NiceMention-QIuggb9Y.js +11122 -0
- package/dist/NiceMention.css +1 -1
- package/dist/NiceModal-CHaan9al.js +95 -0
- package/dist/NiceModal-Czq6OEAT.js +95 -0
- package/dist/NiceModal-D-HFwawr.js +95 -0
- package/dist/NiceModal-DOy2XTzc.cjs +1 -0
- package/dist/NiceModal-DkawKzEE.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-1CsP8Zst.js +6997 -0
- package/dist/NiceModuleLifecyclePanel-Bkx4Yg-3.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-C5oYtczk.js +6999 -0
- package/dist/NiceModuleLifecyclePanel-DCcy2yYi.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-DqdgW-0s.js +7004 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -1
- package/dist/NicePagination-7od5KUa3.cjs +1 -0
- package/dist/NicePagination-DMrkR8hH.cjs +1 -0
- package/dist/NicePagination-DQmZpsSQ.js +179 -0
- package/dist/NicePagination-DipQRjPq.js +172 -0
- package/dist/NicePagination-KhlVXYaT.js +172 -0
- package/dist/NicePivotGrid-B-KthuqL.cjs +152 -0
- package/dist/NicePivotGrid-CLCTHkKO.cjs +152 -0
- package/dist/NicePivotGrid-DV54FCsH.js +1174 -0
- package/dist/NicePivotGrid-DoWLUPUs.js +1167 -0
- package/dist/NicePivotGrid-etwpfccz.js +1167 -0
- package/dist/NiceSavedQueryPanel-BABkTNc5.js +5129 -0
- package/dist/NiceSavedQueryPanel-Cfeig83P.cjs +586 -0
- package/dist/NiceSavedQueryPanel-DTWRLseb.cjs +586 -0
- package/dist/NiceSavedQueryPanel-Dy154sxE.js +5129 -0
- package/dist/NiceSavedQueryPanel-v7AffOOe.js +5129 -0
- package/dist/NiceSavedQueryPanel.css +1 -1
- package/dist/NiceScheduler-BEgB7ZgF.cjs +5 -0
- package/dist/NiceScheduler-C9JprsEI.cjs +5 -0
- package/dist/NiceScheduler-DSP-PPh0.js +1645 -0
- package/dist/NiceScheduler-DuPnaA3t.js +1652 -0
- package/dist/NiceScheduler-Oa89YZx9.js +1645 -0
- package/dist/NiceSelect-A336yeLZ.js +433 -0
- package/dist/NiceSelect-B5hTbqi2.js +433 -0
- package/dist/NiceSelect-BYSgDYzq.cjs +1 -0
- package/dist/NiceSelect-Dudf2T5T.js +433 -0
- package/dist/NiceSelect-DwBAIrX7.cjs +1 -0
- package/dist/NiceWindow-B6zjBTl9.cjs +1 -0
- package/dist/NiceWindow-BKQEx7Vf.js +1623 -0
- package/dist/NiceWindow-BnTH7Gy0.js +1623 -0
- package/dist/NiceWindow-CZN9NVZw.cjs +1 -0
- package/dist/NiceWindow-lxtPR7yZ.js +1623 -0
- package/dist/NiceWindow.css +1 -1
- package/dist/charts-B8_V3_nq.cjs +882 -0
- package/dist/charts-BZgyyybE.js +31933 -0
- package/dist/charts-FuDk5-r6.js +31958 -0
- package/dist/charts-INj3yFo5.js +31946 -0
- package/dist/charts-NolNXKUL.cjs +882 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.css +1 -1
- package/dist/charts.mjs +1 -1
- package/dist/core-A_A6c7an.js +795 -0
- package/dist/core-B2iH2J_X.js +795 -0
- package/dist/core-BmspZEfD.js +795 -0
- package/dist/core-DAfLOet6.cjs +1 -0
- package/dist/core-ZG3bgnBR.cjs +1 -0
- package/dist/data-branching-B3TOqXAO.cjs +1 -0
- package/dist/data-branching-BUGiICDZ.js +6275 -0
- package/dist/data-branching-DMXmcocj.js +6275 -0
- package/dist/data-branching-YE8P9M5P.js +6275 -0
- package/dist/data-branching-t6uhAwIm.cjs +1 -0
- package/dist/data-branching.cjs +1 -1
- package/dist/data-branching.mjs +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +7 -2
- package/dist/data.mjs +3 -3
- package/dist/devops-BhV3OmF7.js +8285 -0
- package/dist/devops-BqUxnbRi.cjs +17 -0
- package/dist/devops-Bx-Qwj9w.cjs +17 -0
- package/dist/devops-DYZatW45.js +8251 -0
- package/dist/devops-R98k2zpd.js +8251 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.d.ts +29 -16
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +59 -28
- package/dist/editors.mjs +7 -7
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.mjs +3 -3
- package/dist/index.cjs +445 -445
- package/dist/index.css +1 -1
- package/dist/index.d.ts +214 -119
- package/dist/index.mjs +16635 -16351
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.d.ts +31 -18
- package/dist/lazy.mjs +24 -24
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +17 -14
- package/dist/navigation.mjs +130 -130
- package/dist/no-code-BPaAS4wW.cjs +332 -0
- package/dist/no-code-CBwUVL1i.js +7447 -0
- package/dist/no-code-CjktkQ50.js +7447 -0
- package/dist/no-code-DW2NrRba.js +7447 -0
- package/dist/no-code-DmFxrZ5T.cjs +332 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.d.ts +2 -2
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +4 -4
- package/dist/overlays.mjs +2 -2
- package/dist/pickerCommons-C4XWRUvH.cjs +1 -0
- package/dist/pickerCommons-C_BpYs_m.cjs +1 -0
- package/dist/pickerCommons-DAOXH_u5.js +1122 -0
- package/dist/pickerCommons-Dn4wnDco.js +1122 -0
- package/dist/pickerCommons-DskswPS5.js +1122 -0
- package/dist/pickerCommons.css +1 -1
- package/dist/style.css +7 -7
- package/package.json +3 -3
|
@@ -0,0 +1,1652 @@
|
|
|
1
|
+
import { jsxs as g, jsx as t, Fragment as Ve } from "react/jsx-runtime";
|
|
2
|
+
import { w as ot, G as lt, V as dt } from "./charts-FuDk5-r6.js";
|
|
3
|
+
import q, { useState as B, useRef as ut, useCallback as ne, useMemo as Ne } from "react";
|
|
4
|
+
import { N as mt, a as re } from "./NiceColorPicker-BiEWqWnd.js";
|
|
5
|
+
import { d as ht, c as Pe } from "./NiceForm-a6tGr6ss.js";
|
|
6
|
+
import { N as gt } from "./NiceModal-CHaan9al.js";
|
|
7
|
+
const Ye = ({
|
|
8
|
+
children: e,
|
|
9
|
+
className: n,
|
|
10
|
+
style: s,
|
|
11
|
+
direction: d = "horizontal",
|
|
12
|
+
size: a,
|
|
13
|
+
disabled: u,
|
|
14
|
+
readOnly: D,
|
|
15
|
+
loading: N,
|
|
16
|
+
error: T,
|
|
17
|
+
errorPlacement: P = "bottom"
|
|
18
|
+
}) => {
|
|
19
|
+
const S = /* @__PURE__ */ g(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
className: `nice-btn-group ${d === "vertical" ? "nice-btn-group--vertical" : ""} ${N ? "nice-btn-group--loading" : ""} ${D ? "nice-btn-group--readonly" : ""} ${n || ""}`,
|
|
23
|
+
style: s,
|
|
24
|
+
role: "group",
|
|
25
|
+
"aria-busy": N || void 0,
|
|
26
|
+
children: [
|
|
27
|
+
q.Children.map(e, ($) => {
|
|
28
|
+
if (!q.isValidElement($))
|
|
29
|
+
return $;
|
|
30
|
+
const r = {};
|
|
31
|
+
return u && (r.disabled = !0), D && (r.disabled = !0), N && (r.disabled = !0), a && (r.size = a), q.cloneElement($, r);
|
|
32
|
+
}),
|
|
33
|
+
N && /* @__PURE__ */ t("span", { className: "nice-btn-group__spinner", children: /* @__PURE__ */ t("span", { className: "nice-spinner nice-spinner--sm" }) })
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
if (!T)
|
|
38
|
+
return S;
|
|
39
|
+
const w = /* @__PURE__ */ t("div", { className: "nice-field__error", role: "alert", children: T });
|
|
40
|
+
return P === "right" ? /* @__PURE__ */ g(
|
|
41
|
+
"span",
|
|
42
|
+
{
|
|
43
|
+
className: `nice-btn-field nice-btn-field--right ${a ? `nice-field--${a}` : ""}`,
|
|
44
|
+
style: {
|
|
45
|
+
display: "inline-flex",
|
|
46
|
+
flexDirection: "row",
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
gap: "8px",
|
|
49
|
+
width: "fit-content"
|
|
50
|
+
},
|
|
51
|
+
children: [
|
|
52
|
+
S,
|
|
53
|
+
w
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
) : /* @__PURE__ */ g(
|
|
57
|
+
"span",
|
|
58
|
+
{
|
|
59
|
+
className: `nice-btn-field nice-btn-field--bottom ${a ? `nice-field--${a}` : ""}`,
|
|
60
|
+
style: {
|
|
61
|
+
display: "inline-flex",
|
|
62
|
+
flexDirection: "column",
|
|
63
|
+
alignItems: "flex-start",
|
|
64
|
+
gap: "4px",
|
|
65
|
+
width: "fit-content"
|
|
66
|
+
},
|
|
67
|
+
children: [
|
|
68
|
+
S,
|
|
69
|
+
w
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}, I = (e, n) => {
|
|
74
|
+
const s = new Date(e);
|
|
75
|
+
return s.setDate(s.getDate() + n), s;
|
|
76
|
+
}, z = (e, n) => e.getFullYear() === n.getFullYear() && e.getMonth() === n.getMonth() && e.getDate() === n.getDate(), pt = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], yt = [
|
|
77
|
+
"January",
|
|
78
|
+
"February",
|
|
79
|
+
"March",
|
|
80
|
+
"April",
|
|
81
|
+
"May",
|
|
82
|
+
"June",
|
|
83
|
+
"July",
|
|
84
|
+
"August",
|
|
85
|
+
"September",
|
|
86
|
+
"October",
|
|
87
|
+
"November",
|
|
88
|
+
"December"
|
|
89
|
+
], ft = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"], _t = [
|
|
90
|
+
"january",
|
|
91
|
+
"february",
|
|
92
|
+
"march",
|
|
93
|
+
"april",
|
|
94
|
+
"may",
|
|
95
|
+
"june",
|
|
96
|
+
"july",
|
|
97
|
+
"august",
|
|
98
|
+
"september",
|
|
99
|
+
"october",
|
|
100
|
+
"november",
|
|
101
|
+
"december"
|
|
102
|
+
];
|
|
103
|
+
function he(e) {
|
|
104
|
+
return ft.map((n, s) => e(n, pt[s]));
|
|
105
|
+
}
|
|
106
|
+
function vt(e) {
|
|
107
|
+
return _t.map((n, s) => e(n, yt[s]));
|
|
108
|
+
}
|
|
109
|
+
function We(e) {
|
|
110
|
+
const n = [
|
|
111
|
+
"Jan",
|
|
112
|
+
"Feb",
|
|
113
|
+
"Mar",
|
|
114
|
+
"Apr",
|
|
115
|
+
"May",
|
|
116
|
+
"Jun",
|
|
117
|
+
"Jul",
|
|
118
|
+
"Aug",
|
|
119
|
+
"Sep",
|
|
120
|
+
"Oct",
|
|
121
|
+
"Nov",
|
|
122
|
+
"Dec"
|
|
123
|
+
];
|
|
124
|
+
return [
|
|
125
|
+
"janShort",
|
|
126
|
+
"febShort",
|
|
127
|
+
"marShort",
|
|
128
|
+
"aprShort",
|
|
129
|
+
"mayShort",
|
|
130
|
+
"junShort",
|
|
131
|
+
"julShort",
|
|
132
|
+
"augShort",
|
|
133
|
+
"sepShort",
|
|
134
|
+
"octShort",
|
|
135
|
+
"novShort",
|
|
136
|
+
"decShort"
|
|
137
|
+
].map((d, a) => e(d, n[a]));
|
|
138
|
+
}
|
|
139
|
+
const Dt = [
|
|
140
|
+
"Sunday",
|
|
141
|
+
"Monday",
|
|
142
|
+
"Tuesday",
|
|
143
|
+
"Wednesday",
|
|
144
|
+
"Thursday",
|
|
145
|
+
"Friday",
|
|
146
|
+
"Saturday"
|
|
147
|
+
], Nt = [
|
|
148
|
+
"sunday",
|
|
149
|
+
"monday",
|
|
150
|
+
"tuesday",
|
|
151
|
+
"wednesday",
|
|
152
|
+
"thursday",
|
|
153
|
+
"friday",
|
|
154
|
+
"saturday"
|
|
155
|
+
];
|
|
156
|
+
function Me(e) {
|
|
157
|
+
return Nt.map((n, s) => e(n, Dt[s]));
|
|
158
|
+
}
|
|
159
|
+
function wt(e, n, s) {
|
|
160
|
+
const d = [];
|
|
161
|
+
for (const a of e) {
|
|
162
|
+
if (!a.recurrence) {
|
|
163
|
+
d.push(a);
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
const { freq: u, interval: D = 1, until: N, count: T } = a.recurrence, P = new Date(a.end).getTime() - new Date(a.start).getTime();
|
|
167
|
+
let S = new Date(a.start), w = 0;
|
|
168
|
+
const $ = N ? new Date(Math.min(N.getTime(), s.getTime())) : s;
|
|
169
|
+
for (; S <= $ && (!T || w < T); ) {
|
|
170
|
+
const r = new Date(S.getTime() + P);
|
|
171
|
+
r >= n && d.push({
|
|
172
|
+
...a,
|
|
173
|
+
id: `${a.id}_${w}`,
|
|
174
|
+
start: new Date(S),
|
|
175
|
+
end: r
|
|
176
|
+
}), w++;
|
|
177
|
+
const v = new Date(S);
|
|
178
|
+
u === "daily" ? v.setDate(v.getDate() + D) : u === "weekly" ? v.setDate(v.getDate() + 7 * D) : u === "monthly" ? v.setMonth(v.getMonth() + D) : u === "yearly" && v.setFullYear(v.getFullYear() + D), S = v;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return d;
|
|
182
|
+
}
|
|
183
|
+
function je(e, n) {
|
|
184
|
+
return e.filter((s) => {
|
|
185
|
+
const d = new Date(s.start), a = new Date(s.end);
|
|
186
|
+
return n >= new Date(d.getFullYear(), d.getMonth(), d.getDate()) && n <= new Date(a.getFullYear(), a.getMonth(), a.getDate());
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
function bt(e = "r") {
|
|
190
|
+
return `${e}_${Math.random().toString(36).slice(2, 9)}`;
|
|
191
|
+
}
|
|
192
|
+
function St(e = {}) {
|
|
193
|
+
return {
|
|
194
|
+
id: e.id ?? bt(),
|
|
195
|
+
title: e.title ?? "",
|
|
196
|
+
description: e.description ?? "",
|
|
197
|
+
servings: e.servings ?? 2,
|
|
198
|
+
prepMinutes: e.prepMinutes,
|
|
199
|
+
cookMinutes: e.cookMinutes,
|
|
200
|
+
difficulty: e.difficulty,
|
|
201
|
+
cuisine: e.cuisine,
|
|
202
|
+
tags: e.tags ?? [],
|
|
203
|
+
ingredients: e.ingredients ?? [],
|
|
204
|
+
steps: e.steps ?? [],
|
|
205
|
+
photos: e.photos ?? [],
|
|
206
|
+
nutrition: e.nutrition,
|
|
207
|
+
sourceUrl: e.sourceUrl,
|
|
208
|
+
createdAt: e.createdAt ?? /* @__PURE__ */ new Date(),
|
|
209
|
+
updatedAt: e.updatedAt ?? /* @__PURE__ */ new Date()
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function Ct(e) {
|
|
213
|
+
const n = (e.prepMinutes ?? 0) + (e.cookMinutes ?? 0);
|
|
214
|
+
return n > 0 ? n : void 0;
|
|
215
|
+
}
|
|
216
|
+
const ge = ({ ev: e, renderEvent: n, onClick: s, draggable: d, dragRef: a, onHover: u, categoryColor: D }) => {
|
|
217
|
+
const N = D || e.color || "var(--nice-color-primary, #3b82f6)", P = {
|
|
218
|
+
solid: { backgroundColor: N, color: "var(--nice-bg-primary, #fff)" },
|
|
219
|
+
striped: {
|
|
220
|
+
background: `repeating-linear-gradient(45deg, ${N}, ${N} 4px, transparent 4px, transparent 8px)`,
|
|
221
|
+
border: `1px solid ${N}`,
|
|
222
|
+
color: "var(--nice-bg-tertiary, #333)"
|
|
223
|
+
},
|
|
224
|
+
outlined: { backgroundColor: "transparent", border: `2px solid ${N}`, color: N },
|
|
225
|
+
dashed: { backgroundColor: "transparent", border: `2px dashed ${N}`, color: N }
|
|
226
|
+
}[e.eventStyle || "solid"];
|
|
227
|
+
return /* @__PURE__ */ t(
|
|
228
|
+
"div",
|
|
229
|
+
{
|
|
230
|
+
className: `nice-scheduler__event nice-scheduler__event--${e.eventStyle || "solid"}`,
|
|
231
|
+
style: P,
|
|
232
|
+
draggable: d,
|
|
233
|
+
onDragStart: () => {
|
|
234
|
+
a.current = { event: e };
|
|
235
|
+
},
|
|
236
|
+
onDragEnd: () => {
|
|
237
|
+
a.current = null;
|
|
238
|
+
},
|
|
239
|
+
onClick: (S) => {
|
|
240
|
+
S.stopPropagation(), s?.(e);
|
|
241
|
+
},
|
|
242
|
+
onMouseEnter: (S) => u(e, S.currentTarget.getBoundingClientRect()),
|
|
243
|
+
onMouseLeave: () => u(null),
|
|
244
|
+
children: n ? n(e) : e.title
|
|
245
|
+
}
|
|
246
|
+
);
|
|
247
|
+
};
|
|
248
|
+
function ie(e, n) {
|
|
249
|
+
if (!(!e.category || !n))
|
|
250
|
+
return n.find((s) => s.key === e.category)?.color;
|
|
251
|
+
}
|
|
252
|
+
const kt = ({
|
|
253
|
+
events: e,
|
|
254
|
+
curDate: n,
|
|
255
|
+
firstDayOfWeek: s,
|
|
256
|
+
onSlotClick: d,
|
|
257
|
+
onEventClick: a,
|
|
258
|
+
draggable: u,
|
|
259
|
+
dragRef: D,
|
|
260
|
+
categories: N,
|
|
261
|
+
renderEvent: T,
|
|
262
|
+
onHoverEvent: P,
|
|
263
|
+
readOnly: S,
|
|
264
|
+
t: w
|
|
265
|
+
}) => {
|
|
266
|
+
const $ = he(w), r = n.getFullYear(), v = n.getMonth(), k = new Date(r, v, 1), o = new Date(r, v + 1, 0), l = (k.getDay() - s + 7) % 7, E = o.getDate(), p = [];
|
|
267
|
+
for (let m = l - 1; m >= 0; m--)
|
|
268
|
+
p.push({ date: I(k, -m - 1), isCurrentMonth: !1 });
|
|
269
|
+
for (let m = 0; m < E; m++)
|
|
270
|
+
p.push({ date: new Date(r, v, m + 1), isCurrentMonth: !0 });
|
|
271
|
+
let F = 1;
|
|
272
|
+
for (; p.length < 42; )
|
|
273
|
+
p.push({ date: new Date(r, v + 1, F++), isCurrentMonth: !1 });
|
|
274
|
+
return /* @__PURE__ */ g("div", { className: "nice-scheduler__month", children: [
|
|
275
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__month-header", children: Array.from({ length: 7 }, (m, y) => /* @__PURE__ */ t("div", { className: "nice-scheduler__month-dayname", children: $[(s + y) % 7] }, y)) }),
|
|
276
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__month-grid", children: p.map((m, y) => {
|
|
277
|
+
const R = je(e, m.date), h = z(m.date, /* @__PURE__ */ new Date()), b = m.date.getDay(), A = b === 0 || b === 6;
|
|
278
|
+
return /* @__PURE__ */ g(
|
|
279
|
+
"div",
|
|
280
|
+
{
|
|
281
|
+
className: `nice-scheduler__month-cell ${m.isCurrentMonth ? "" : "nice-scheduler__month-cell--other"} ${h ? "nice-scheduler__month-cell--today" : ""} ${A ? "nice-scheduler__month-cell--weekend" : ""}`,
|
|
282
|
+
onClick: () => !S && d?.(m.date, I(m.date, 1)),
|
|
283
|
+
children: [
|
|
284
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__month-date", children: m.date.getDate() }),
|
|
285
|
+
R.slice(0, 3).map((Y) => /* @__PURE__ */ t(
|
|
286
|
+
ge,
|
|
287
|
+
{
|
|
288
|
+
ev: Y,
|
|
289
|
+
renderEvent: T,
|
|
290
|
+
onClick: a,
|
|
291
|
+
draggable: u && !S,
|
|
292
|
+
dragRef: D,
|
|
293
|
+
onHover: P,
|
|
294
|
+
categoryColor: ie(Y, N)
|
|
295
|
+
},
|
|
296
|
+
Y.id
|
|
297
|
+
)),
|
|
298
|
+
R.length > 3 && /* @__PURE__ */ g("div", { className: "nice-scheduler__month-more", children: [
|
|
299
|
+
"+",
|
|
300
|
+
R.length - 3
|
|
301
|
+
] })
|
|
302
|
+
]
|
|
303
|
+
},
|
|
304
|
+
y
|
|
305
|
+
);
|
|
306
|
+
}) })
|
|
307
|
+
] });
|
|
308
|
+
}, Mt = ({
|
|
309
|
+
events: e,
|
|
310
|
+
days: n,
|
|
311
|
+
startHour: s,
|
|
312
|
+
endHour: d,
|
|
313
|
+
draggable: a,
|
|
314
|
+
dragRef: u,
|
|
315
|
+
onEventClick: D,
|
|
316
|
+
onSlotClick: N,
|
|
317
|
+
onEventDrop: T,
|
|
318
|
+
categories: P,
|
|
319
|
+
workHours: S,
|
|
320
|
+
showCurrentTime: w,
|
|
321
|
+
renderEvent: $,
|
|
322
|
+
onHoverEvent: r,
|
|
323
|
+
readOnly: v,
|
|
324
|
+
t: k
|
|
325
|
+
}) => {
|
|
326
|
+
const o = [];
|
|
327
|
+
for (let h = s; h < d; h++)
|
|
328
|
+
o.push(h);
|
|
329
|
+
he(k);
|
|
330
|
+
const l = Me(k), E = q.useRef(null), p = /* @__PURE__ */ new Date(), F = p.getHours() * 60 + p.getMinutes(), m = (d - s) * 60, y = (F - s * 60) / m * 100, R = w && F >= s * 60 && F < d * 60;
|
|
331
|
+
return q.useEffect(() => {
|
|
332
|
+
const h = E.current;
|
|
333
|
+
if (!h)
|
|
334
|
+
return;
|
|
335
|
+
const b = /* @__PURE__ */ new Date(), A = e.filter((x) => n.some((W) => z(W, new Date(x.start)))), Y = A.filter((x) => z(new Date(x.start), b));
|
|
336
|
+
let V;
|
|
337
|
+
Y.length > 0 ? V = Math.min(...Y.map((x) => new Date(x.start).getHours())) : A.length > 0 ? V = Math.min(...A.map((x) => new Date(x.start).getHours())) : V = 8, V = Math.max(s, Math.min(V, d - 1));
|
|
338
|
+
const c = V - s, f = h.children[c];
|
|
339
|
+
if (f) {
|
|
340
|
+
const x = h.closest(".nice-scheduler__content") ?? h.closest(".nice-scheduler__timegrid");
|
|
341
|
+
x && (x.scrollTop = f.offsetTop - 4);
|
|
342
|
+
}
|
|
343
|
+
}, []), /* @__PURE__ */ g("div", { className: "nice-scheduler__timegrid", children: [
|
|
344
|
+
/* @__PURE__ */ g("div", { className: "nice-scheduler__timegrid-header", children: [
|
|
345
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__time-gutter" }),
|
|
346
|
+
n.map((h, b) => {
|
|
347
|
+
const A = h.getDay() === 0 || h.getDay() === 6;
|
|
348
|
+
return /* @__PURE__ */ g(
|
|
349
|
+
"div",
|
|
350
|
+
{
|
|
351
|
+
className: `nice-scheduler__timegrid-day-header ${z(h, p) ? "nice-scheduler__timegrid-day-header--today" : ""} ${A ? "nice-scheduler__timegrid-day-header--weekend" : ""}`,
|
|
352
|
+
children: [
|
|
353
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__timegrid-day-name", children: l[h.getDay()] }),
|
|
354
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__timegrid-day-num", children: h.getDate() })
|
|
355
|
+
]
|
|
356
|
+
},
|
|
357
|
+
b
|
|
358
|
+
);
|
|
359
|
+
})
|
|
360
|
+
] }),
|
|
361
|
+
/* @__PURE__ */ g("div", { className: "nice-scheduler__timegrid-body", ref: E, style: { position: "relative" }, children: [
|
|
362
|
+
o.map((h) => {
|
|
363
|
+
const b = S ? h >= S[0] && h < S[1] : !1;
|
|
364
|
+
return /* @__PURE__ */ g(
|
|
365
|
+
"div",
|
|
366
|
+
{
|
|
367
|
+
className: `nice-scheduler__timegrid-row ${b ? "nice-scheduler__timegrid-row--work" : ""}`,
|
|
368
|
+
children: [
|
|
369
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__time-gutter", children: `${h.toString().padStart(2, "0")}:00` }),
|
|
370
|
+
n.map((A, Y) => {
|
|
371
|
+
const V = e.filter((c) => {
|
|
372
|
+
const f = new Date(c.start);
|
|
373
|
+
return z(f, A) && f.getHours() === h;
|
|
374
|
+
});
|
|
375
|
+
return /* @__PURE__ */ t(
|
|
376
|
+
"div",
|
|
377
|
+
{
|
|
378
|
+
className: "nice-scheduler__timegrid-cell",
|
|
379
|
+
onDragOver: a && !v ? (c) => c.preventDefault() : void 0,
|
|
380
|
+
onDrop: a && !v ? () => {
|
|
381
|
+
if (!u.current || !T)
|
|
382
|
+
return;
|
|
383
|
+
const c = u.current.event, f = new Date(c.end).getTime() - new Date(c.start).getTime(), x = new Date(A);
|
|
384
|
+
x.setHours(h, 0, 0, 0);
|
|
385
|
+
const W = new Date(x.getTime() + f);
|
|
386
|
+
T(c, x, W), u.current = null;
|
|
387
|
+
} : void 0,
|
|
388
|
+
onClick: () => !v && (() => {
|
|
389
|
+
const c = new Date(A);
|
|
390
|
+
c.setHours(h);
|
|
391
|
+
const f = new Date(c);
|
|
392
|
+
f.setHours(h + 1), N?.(c, f);
|
|
393
|
+
})(),
|
|
394
|
+
children: V.map((c) => /* @__PURE__ */ t(
|
|
395
|
+
ge,
|
|
396
|
+
{
|
|
397
|
+
ev: c,
|
|
398
|
+
renderEvent: $,
|
|
399
|
+
onClick: D,
|
|
400
|
+
draggable: a && !v,
|
|
401
|
+
dragRef: u,
|
|
402
|
+
onHover: r,
|
|
403
|
+
categoryColor: ie(c, P)
|
|
404
|
+
},
|
|
405
|
+
c.id
|
|
406
|
+
))
|
|
407
|
+
},
|
|
408
|
+
Y
|
|
409
|
+
);
|
|
410
|
+
})
|
|
411
|
+
]
|
|
412
|
+
},
|
|
413
|
+
h
|
|
414
|
+
);
|
|
415
|
+
}),
|
|
416
|
+
R && n.some((h) => z(h, p)) && /* @__PURE__ */ t("div", { className: "nice-scheduler__now-line", style: { top: `${y}%` }, children: /* @__PURE__ */ t("div", { className: "nice-scheduler__now-dot" }) })
|
|
417
|
+
] })
|
|
418
|
+
] });
|
|
419
|
+
}, Tt = ({
|
|
420
|
+
events: e,
|
|
421
|
+
curDate: n,
|
|
422
|
+
onEventClick: s,
|
|
423
|
+
categories: d,
|
|
424
|
+
t: a
|
|
425
|
+
}) => {
|
|
426
|
+
const u = [...e].filter(
|
|
427
|
+
(D) => new Date(D.start) >= new Date(n.getFullYear(), n.getMonth(), n.getDate())
|
|
428
|
+
).sort((D, N) => new Date(D.start).getTime() - new Date(N.start).getTime()).slice(0, 50);
|
|
429
|
+
return /* @__PURE__ */ g("div", { className: "nice-scheduler__agenda", children: [
|
|
430
|
+
u.map((D) => /* @__PURE__ */ t($t, { ev: D, categories: d, onEventClick: s }, D.id)),
|
|
431
|
+
u.length === 0 && /* @__PURE__ */ t("div", { className: "nice-scheduler__agenda-empty", children: a("noEvents", "No upcoming events") })
|
|
432
|
+
] });
|
|
433
|
+
}, qe = ({ ev: e }) => {
|
|
434
|
+
if (e.eventType === "recipe" && e.recipe) {
|
|
435
|
+
const n = Ct(e.recipe), s = [];
|
|
436
|
+
return n !== void 0 && s.push(`⏱ ${n} min`), e.recipe.ingredients?.length && s.push(`🥕 ${e.recipe.ingredients.length} ingredients`), e.recipe.servings && s.push(`🍽 ${e.recipe.servings} servings`), s.length === 0 ? null : /* @__PURE__ */ t("div", { className: "nice-scheduler__agenda-meta", children: s.join(" · ") });
|
|
437
|
+
}
|
|
438
|
+
if (e.eventType === "service" && e.service) {
|
|
439
|
+
const n = e.service, s = [];
|
|
440
|
+
return n.serviceName && s.push(`🛎 ${n.serviceName}`), n.providerName && s.push(`👤 ${n.providerName}`), n.customerName && s.push(`→ ${n.customerName}`), typeof n.price == "number" && s.push(`💵 ${n.price}${n.currency ? " " + n.currency : ""}`), s.length === 0 ? null : /* @__PURE__ */ t("div", { className: "nice-scheduler__agenda-meta", children: s.join(" · ") });
|
|
441
|
+
}
|
|
442
|
+
return null;
|
|
443
|
+
}, $t = ({ ev: e, categories: n, onEventClick: s }) => {
|
|
444
|
+
const d = ot({ onClick: () => s?.(e) });
|
|
445
|
+
return /* @__PURE__ */ g("div", { className: "nice-scheduler__agenda-item", "aria-label": `Event ${e.title}`, ...d, children: [
|
|
446
|
+
/* @__PURE__ */ t(
|
|
447
|
+
"div",
|
|
448
|
+
{
|
|
449
|
+
className: "nice-scheduler__agenda-dot",
|
|
450
|
+
style: {
|
|
451
|
+
backgroundColor: ie(e, n) || e.color || "var(--nice-color-primary, #3b82f6)"
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
),
|
|
455
|
+
/* @__PURE__ */ g("div", { className: "nice-scheduler__agenda-info", children: [
|
|
456
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__agenda-title", children: e.title }),
|
|
457
|
+
/* @__PURE__ */ g("div", { className: "nice-scheduler__agenda-time", children: [
|
|
458
|
+
new Date(e.start).toLocaleString(),
|
|
459
|
+
" � ",
|
|
460
|
+
new Date(e.end).toLocaleString()
|
|
461
|
+
] }),
|
|
462
|
+
e.description && /* @__PURE__ */ t("div", { className: "nice-scheduler__agenda-desc", children: e.description }),
|
|
463
|
+
/* @__PURE__ */ t(qe, { ev: e })
|
|
464
|
+
] }),
|
|
465
|
+
e.category && n && /* @__PURE__ */ t(
|
|
466
|
+
"span",
|
|
467
|
+
{
|
|
468
|
+
className: "nice-scheduler__agenda-badge",
|
|
469
|
+
style: { backgroundColor: ie(e, n) || e.color },
|
|
470
|
+
children: n.find((a) => a.key === e.category)?.label
|
|
471
|
+
}
|
|
472
|
+
)
|
|
473
|
+
] });
|
|
474
|
+
}, xt = ({
|
|
475
|
+
events: e,
|
|
476
|
+
curDate: n,
|
|
477
|
+
timelineDays: s,
|
|
478
|
+
resources: d,
|
|
479
|
+
draggable: a,
|
|
480
|
+
dragRef: u,
|
|
481
|
+
onEventClick: D,
|
|
482
|
+
onSlotClick: N,
|
|
483
|
+
onEventDrop: T,
|
|
484
|
+
categories: P,
|
|
485
|
+
renderEvent: S,
|
|
486
|
+
onHoverEvent: w,
|
|
487
|
+
readOnly: $,
|
|
488
|
+
t: r
|
|
489
|
+
}) => {
|
|
490
|
+
const v = Array.from({ length: s }, (l, E) => I(n, E)), k = d ?? [{ id: "__default", name: "" }], o = he(r);
|
|
491
|
+
return /* @__PURE__ */ g("div", { className: "nice-scheduler__timeline", children: [
|
|
492
|
+
/* @__PURE__ */ g("div", { className: "nice-scheduler__timeline-header", children: [
|
|
493
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__timeline-res-label" }),
|
|
494
|
+
v.map((l, E) => /* @__PURE__ */ g(
|
|
495
|
+
"div",
|
|
496
|
+
{
|
|
497
|
+
className: `nice-scheduler__timeline-day ${z(l, /* @__PURE__ */ new Date()) ? "nice-scheduler__timeline-day--today" : ""}`,
|
|
498
|
+
children: [
|
|
499
|
+
o[l.getDay()],
|
|
500
|
+
" ",
|
|
501
|
+
l.getDate()
|
|
502
|
+
]
|
|
503
|
+
},
|
|
504
|
+
E
|
|
505
|
+
))
|
|
506
|
+
] }),
|
|
507
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__timeline-body", children: k.map((l) => {
|
|
508
|
+
const E = e.filter((p) => !d || p.resourceId === l.id);
|
|
509
|
+
return /* @__PURE__ */ g("div", { className: "nice-scheduler__timeline-row", children: [
|
|
510
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__timeline-res-label", children: l.name }),
|
|
511
|
+
v.map((p, F) => {
|
|
512
|
+
const m = E.filter((y) => z(new Date(y.start), p));
|
|
513
|
+
return /* @__PURE__ */ t(
|
|
514
|
+
"div",
|
|
515
|
+
{
|
|
516
|
+
className: "nice-scheduler__timeline-cell",
|
|
517
|
+
onDragOver: a && !$ ? (y) => y.preventDefault() : void 0,
|
|
518
|
+
onDrop: a && !$ ? () => {
|
|
519
|
+
if (!u.current || !T)
|
|
520
|
+
return;
|
|
521
|
+
const y = u.current.event, R = new Date(y.end).getTime() - new Date(y.start).getTime(), h = new Date(p);
|
|
522
|
+
h.setHours(
|
|
523
|
+
new Date(y.start).getHours(),
|
|
524
|
+
new Date(y.start).getMinutes()
|
|
525
|
+
), T(y, h, new Date(h.getTime() + R), l.id), u.current = null;
|
|
526
|
+
} : void 0,
|
|
527
|
+
onClick: () => !$ && N?.(p, I(p, 1), l.id),
|
|
528
|
+
children: m.map((y) => /* @__PURE__ */ t(
|
|
529
|
+
ge,
|
|
530
|
+
{
|
|
531
|
+
ev: y,
|
|
532
|
+
renderEvent: S,
|
|
533
|
+
onClick: D,
|
|
534
|
+
draggable: a && !$,
|
|
535
|
+
dragRef: u,
|
|
536
|
+
onHover: w,
|
|
537
|
+
categoryColor: ie(y, P)
|
|
538
|
+
},
|
|
539
|
+
y.id
|
|
540
|
+
))
|
|
541
|
+
},
|
|
542
|
+
F
|
|
543
|
+
);
|
|
544
|
+
})
|
|
545
|
+
] }, l.id);
|
|
546
|
+
}) })
|
|
547
|
+
] });
|
|
548
|
+
}, He = ({ categories: e, events: n, filteredCategories: s, onToggleCategory: d, t: a }) => /* @__PURE__ */ g("div", { className: "nice-scheduler__legend", children: [
|
|
549
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__legend-title", children: a("legend", "Legend") }),
|
|
550
|
+
e.map((u) => {
|
|
551
|
+
const D = n.filter((T) => T.category === u.key).length, N = !s.has(u.key);
|
|
552
|
+
return /* @__PURE__ */ g(
|
|
553
|
+
"button",
|
|
554
|
+
{
|
|
555
|
+
className: `nice-scheduler__legend-item ${N ? "" : "nice-scheduler__legend-item--hidden"}`,
|
|
556
|
+
onClick: () => d(u.key),
|
|
557
|
+
children: [
|
|
558
|
+
/* @__PURE__ */ t(
|
|
559
|
+
"span",
|
|
560
|
+
{
|
|
561
|
+
className: "nice-scheduler__legend-dot",
|
|
562
|
+
style: { backgroundColor: N ? u.color : "var(--nice-border-color, #ccc)" }
|
|
563
|
+
}
|
|
564
|
+
),
|
|
565
|
+
/* @__PURE__ */ t("span", { className: "nice-scheduler__legend-label", children: u.label }),
|
|
566
|
+
/* @__PURE__ */ t("span", { className: "nice-scheduler__legend-count", children: D })
|
|
567
|
+
]
|
|
568
|
+
},
|
|
569
|
+
u.key
|
|
570
|
+
);
|
|
571
|
+
})
|
|
572
|
+
] }), Et = ({ curDate: e, onDateSelect: n, firstDayOfWeek: s, t: d }) => {
|
|
573
|
+
const [a, u] = q.useState(e.getMonth()), [D, N] = q.useState(e.getFullYear()), T = new Date(D, a, 1), P = new Date(D, a + 1, 0), S = (T.getDay() - s + 7) % 7, w = [];
|
|
574
|
+
for (let l = S - 1; l >= 0; l--)
|
|
575
|
+
w.push(I(T, -l - 1));
|
|
576
|
+
for (let l = 0; l < P.getDate(); l++)
|
|
577
|
+
w.push(new Date(D, a, l + 1));
|
|
578
|
+
const $ = 7 - w.length % 7;
|
|
579
|
+
if ($ < 7)
|
|
580
|
+
for (let l = 1; l <= $; l++)
|
|
581
|
+
w.push(new Date(D, a + 1, l));
|
|
582
|
+
const r = () => {
|
|
583
|
+
a === 0 ? (u(11), N((l) => l - 1)) : u((l) => l - 1);
|
|
584
|
+
}, v = () => {
|
|
585
|
+
a === 11 ? (u(0), N((l) => l + 1)) : u((l) => l + 1);
|
|
586
|
+
}, k = We(d), o = he(d);
|
|
587
|
+
return /* @__PURE__ */ g("div", { className: "nice-scheduler__mini-cal", children: [
|
|
588
|
+
/* @__PURE__ */ g("div", { className: "nice-scheduler__mini-cal-header", children: [
|
|
589
|
+
/* @__PURE__ */ t("button", { className: "nice-btn nice-btn--xs", onClick: r, children: "�" }),
|
|
590
|
+
/* @__PURE__ */ g("span", { children: [
|
|
591
|
+
k[a],
|
|
592
|
+
" ",
|
|
593
|
+
D
|
|
594
|
+
] }),
|
|
595
|
+
/* @__PURE__ */ t("button", { className: "nice-btn nice-btn--xs", onClick: v, children: "�" })
|
|
596
|
+
] }),
|
|
597
|
+
/* @__PURE__ */ g("div", { className: "nice-scheduler__mini-cal-grid", children: [
|
|
598
|
+
o.map((l, E) => /* @__PURE__ */ t("div", { className: "nice-scheduler__mini-cal-dayname", children: o[(s + E) % 7].charAt(0) }, E)),
|
|
599
|
+
w.map((l, E) => {
|
|
600
|
+
const p = z(l, /* @__PURE__ */ new Date()), F = z(l, e), m = l.getMonth() !== a;
|
|
601
|
+
return /* @__PURE__ */ t(
|
|
602
|
+
"button",
|
|
603
|
+
{
|
|
604
|
+
className: `nice-scheduler__mini-cal-day ${p ? "nice-scheduler__mini-cal-day--today" : ""} ${F ? "nice-scheduler__mini-cal-day--selected" : ""} ${m ? "nice-scheduler__mini-cal-day--other" : ""}`,
|
|
605
|
+
onClick: () => n(l),
|
|
606
|
+
children: l.getDate()
|
|
607
|
+
},
|
|
608
|
+
E
|
|
609
|
+
);
|
|
610
|
+
})
|
|
611
|
+
] })
|
|
612
|
+
] });
|
|
613
|
+
}, Rt = ({
|
|
614
|
+
events: e,
|
|
615
|
+
rangeStart: n,
|
|
616
|
+
rangeEnd: s,
|
|
617
|
+
startHour: d,
|
|
618
|
+
endHour: a,
|
|
619
|
+
draggable: u,
|
|
620
|
+
dragRef: D,
|
|
621
|
+
onEventClick: N,
|
|
622
|
+
onSlotClick: T,
|
|
623
|
+
onEventDrop: P,
|
|
624
|
+
categories: S,
|
|
625
|
+
workHours: w,
|
|
626
|
+
showCurrentTime: $,
|
|
627
|
+
renderEvent: r,
|
|
628
|
+
onHoverEvent: v,
|
|
629
|
+
readOnly: k,
|
|
630
|
+
t: o
|
|
631
|
+
}) => {
|
|
632
|
+
const l = [];
|
|
633
|
+
let E = new Date(n);
|
|
634
|
+
for (; E <= s; )
|
|
635
|
+
l.push(new Date(E)), E = I(E, 1);
|
|
636
|
+
const p = [];
|
|
637
|
+
for (let f = d; f < a; f++)
|
|
638
|
+
p.push(f);
|
|
639
|
+
const F = Me(o), m = q.useRef(null), y = q.useRef(null), R = q.useRef(null), h = /* @__PURE__ */ new Date(), b = h.getHours() * 60 + h.getMinutes(), A = (a - d) * 60, Y = (b - d * 60) / A * 100, V = $ && b >= d * 60 && b < a * 60;
|
|
640
|
+
q.useEffect(() => {
|
|
641
|
+
const f = m.current;
|
|
642
|
+
if (!f)
|
|
643
|
+
return;
|
|
644
|
+
const x = /* @__PURE__ */ new Date(), W = e.filter(
|
|
645
|
+
(L) => l.some((C) => z(C, x) && z(new Date(L.start), x))
|
|
646
|
+
);
|
|
647
|
+
let K = W.length > 0 ? Math.min(...W.map((L) => new Date(L.start).getHours())) : x.getHours();
|
|
648
|
+
K = Math.max(d, Math.min(K, a - 1));
|
|
649
|
+
const G = f.children[K - d];
|
|
650
|
+
if (G) {
|
|
651
|
+
const L = R.current ?? f.closest(".nice-scheduler__content") ?? f.closest(".nice-scheduler__timegrid");
|
|
652
|
+
L && (L.scrollTop = G.offsetTop - 4);
|
|
653
|
+
}
|
|
654
|
+
}, []);
|
|
655
|
+
const c = (f) => {
|
|
656
|
+
y.current && (y.current.scrollLeft = f.currentTarget.scrollLeft);
|
|
657
|
+
};
|
|
658
|
+
return /* @__PURE__ */ g("div", { className: "nice-scheduler__timegrid nice-scheduler__timegrid--range", children: [
|
|
659
|
+
/* @__PURE__ */ t(
|
|
660
|
+
"div",
|
|
661
|
+
{
|
|
662
|
+
className: "nice-scheduler__timegrid-header-scroll",
|
|
663
|
+
ref: y,
|
|
664
|
+
"aria-hidden": "true",
|
|
665
|
+
children: /* @__PURE__ */ g("div", { className: "nice-scheduler__timegrid-header", children: [
|
|
666
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__time-gutter" }),
|
|
667
|
+
l.map((f, x) => {
|
|
668
|
+
const W = f.getDay() === 0 || f.getDay() === 6;
|
|
669
|
+
return /* @__PURE__ */ g(
|
|
670
|
+
"div",
|
|
671
|
+
{
|
|
672
|
+
className: `nice-scheduler__timegrid-day-header ${z(f, h) ? "nice-scheduler__timegrid-day-header--today" : ""} ${W ? "nice-scheduler__timegrid-day-header--weekend" : ""}`,
|
|
673
|
+
children: [
|
|
674
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__timegrid-day-name", children: F[f.getDay()] }),
|
|
675
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__timegrid-day-num", children: f.getDate() })
|
|
676
|
+
]
|
|
677
|
+
},
|
|
678
|
+
x
|
|
679
|
+
);
|
|
680
|
+
})
|
|
681
|
+
] })
|
|
682
|
+
}
|
|
683
|
+
),
|
|
684
|
+
/* @__PURE__ */ t(
|
|
685
|
+
"div",
|
|
686
|
+
{
|
|
687
|
+
className: "nice-scheduler__timegrid-body-scroll",
|
|
688
|
+
ref: R,
|
|
689
|
+
onScroll: c,
|
|
690
|
+
children: /* @__PURE__ */ g(
|
|
691
|
+
"div",
|
|
692
|
+
{
|
|
693
|
+
className: "nice-scheduler__timegrid-body",
|
|
694
|
+
ref: m,
|
|
695
|
+
style: { position: "relative" },
|
|
696
|
+
children: [
|
|
697
|
+
p.map((f) => {
|
|
698
|
+
const x = w ? f >= w[0] && f < w[1] : !1;
|
|
699
|
+
return /* @__PURE__ */ g(
|
|
700
|
+
"div",
|
|
701
|
+
{
|
|
702
|
+
className: `nice-scheduler__timegrid-row ${x ? "nice-scheduler__timegrid-row--work" : ""}`,
|
|
703
|
+
children: [
|
|
704
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__time-gutter", children: `${f.toString().padStart(2, "0")}:00` }),
|
|
705
|
+
l.map((W, K) => {
|
|
706
|
+
const G = e.filter((L) => {
|
|
707
|
+
const C = new Date(L.start);
|
|
708
|
+
return z(C, W) && C.getHours() === f;
|
|
709
|
+
});
|
|
710
|
+
return /* @__PURE__ */ t(
|
|
711
|
+
"div",
|
|
712
|
+
{
|
|
713
|
+
className: "nice-scheduler__timegrid-cell",
|
|
714
|
+
onDragOver: u && !k ? (L) => L.preventDefault() : void 0,
|
|
715
|
+
onDrop: u && !k ? () => {
|
|
716
|
+
if (!D.current || !P)
|
|
717
|
+
return;
|
|
718
|
+
const L = D.current.event, C = new Date(L.end).getTime() - new Date(L.start).getTime(), Q = new Date(W);
|
|
719
|
+
Q.setHours(f, 0, 0, 0), P(L, Q, new Date(Q.getTime() + C)), D.current = null;
|
|
720
|
+
} : void 0,
|
|
721
|
+
onClick: () => !k && (() => {
|
|
722
|
+
const L = new Date(W);
|
|
723
|
+
L.setHours(f);
|
|
724
|
+
const C = new Date(L);
|
|
725
|
+
C.setHours(f + 1), T?.(L, C);
|
|
726
|
+
})(),
|
|
727
|
+
children: G.map((L) => /* @__PURE__ */ t(
|
|
728
|
+
ge,
|
|
729
|
+
{
|
|
730
|
+
ev: L,
|
|
731
|
+
renderEvent: r,
|
|
732
|
+
onClick: N,
|
|
733
|
+
draggable: u && !k,
|
|
734
|
+
dragRef: D,
|
|
735
|
+
onHover: v,
|
|
736
|
+
categoryColor: ie(L, S)
|
|
737
|
+
},
|
|
738
|
+
L.id
|
|
739
|
+
))
|
|
740
|
+
},
|
|
741
|
+
K
|
|
742
|
+
);
|
|
743
|
+
})
|
|
744
|
+
]
|
|
745
|
+
},
|
|
746
|
+
f
|
|
747
|
+
);
|
|
748
|
+
}),
|
|
749
|
+
V && l.some((f) => z(f, h)) && /* @__PURE__ */ t("div", { className: "nice-scheduler__now-line", style: { top: `${Y}%` }, children: /* @__PURE__ */ t("div", { className: "nice-scheduler__now-dot" }) })
|
|
750
|
+
]
|
|
751
|
+
}
|
|
752
|
+
)
|
|
753
|
+
}
|
|
754
|
+
)
|
|
755
|
+
] });
|
|
756
|
+
}, Lt = ({
|
|
757
|
+
events: e,
|
|
758
|
+
rangeStart: n,
|
|
759
|
+
rangeEnd: s,
|
|
760
|
+
firstDayOfWeek: d,
|
|
761
|
+
onSlotClick: a,
|
|
762
|
+
onEventClick: u,
|
|
763
|
+
draggable: D,
|
|
764
|
+
dragRef: N,
|
|
765
|
+
categories: T,
|
|
766
|
+
renderEvent: P,
|
|
767
|
+
onHoverEvent: S,
|
|
768
|
+
readOnly: w,
|
|
769
|
+
t: $
|
|
770
|
+
}) => {
|
|
771
|
+
const r = he($);
|
|
772
|
+
Me($);
|
|
773
|
+
const v = [];
|
|
774
|
+
let k = new Date(n);
|
|
775
|
+
for (; k <= s; )
|
|
776
|
+
v.push(new Date(k)), k = I(k, 1);
|
|
777
|
+
const o = (v[0].getDay() - d + 7) % 7, l = [];
|
|
778
|
+
for (let p = o - 1; p >= 0; p--)
|
|
779
|
+
l.push({ date: I(v[0], -p - 1), inRange: !1 });
|
|
780
|
+
v.forEach((p) => l.push({ date: p, inRange: !0 }));
|
|
781
|
+
const E = 7 - l.length % 7;
|
|
782
|
+
if (E < 7) {
|
|
783
|
+
const p = v[v.length - 1];
|
|
784
|
+
for (let F = 1; F <= E; F++)
|
|
785
|
+
l.push({ date: I(p, F), inRange: !1 });
|
|
786
|
+
}
|
|
787
|
+
return /* @__PURE__ */ g("div", { className: "nice-scheduler__month nice-scheduler__month--range", children: [
|
|
788
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__month-header", children: Array.from({ length: 7 }, (p, F) => /* @__PURE__ */ t("div", { className: "nice-scheduler__month-dayname", children: r[(d + F) % 7] }, F)) }),
|
|
789
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__month-grid", children: l.map((p, F) => {
|
|
790
|
+
const m = je(e, p.date), y = z(p.date, /* @__PURE__ */ new Date()), R = p.date.getDay() === 0 || p.date.getDay() === 6;
|
|
791
|
+
return /* @__PURE__ */ g(
|
|
792
|
+
"div",
|
|
793
|
+
{
|
|
794
|
+
className: `nice-scheduler__month-cell ${p.inRange ? "" : "nice-scheduler__month-cell--other"} ${y ? "nice-scheduler__month-cell--today" : ""} ${R ? "nice-scheduler__month-cell--weekend" : ""}`,
|
|
795
|
+
onClick: () => !w && a?.(p.date, I(p.date, 1)),
|
|
796
|
+
children: [
|
|
797
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__month-date", children: p.date.getDate() === 1 || F === 0 ? /* @__PURE__ */ g(Ve, { children: [
|
|
798
|
+
/* @__PURE__ */ t("span", { className: "nice-scheduler__month-monthname", children: We($)[p.date.getMonth()] }),
|
|
799
|
+
" ",
|
|
800
|
+
p.date.getDate()
|
|
801
|
+
] }) : p.date.getDate() }),
|
|
802
|
+
m.slice(0, 3).map((h) => /* @__PURE__ */ t(
|
|
803
|
+
ge,
|
|
804
|
+
{
|
|
805
|
+
ev: h,
|
|
806
|
+
renderEvent: P,
|
|
807
|
+
onClick: u,
|
|
808
|
+
draggable: D && !w,
|
|
809
|
+
dragRef: N,
|
|
810
|
+
onHover: S,
|
|
811
|
+
categoryColor: ie(h, T)
|
|
812
|
+
},
|
|
813
|
+
h.id
|
|
814
|
+
)),
|
|
815
|
+
m.length > 3 && /* @__PURE__ */ g("div", { className: "nice-scheduler__month-more", children: [
|
|
816
|
+
"+",
|
|
817
|
+
m.length - 3
|
|
818
|
+
] })
|
|
819
|
+
]
|
|
820
|
+
},
|
|
821
|
+
F
|
|
822
|
+
);
|
|
823
|
+
}) })
|
|
824
|
+
] });
|
|
825
|
+
}, Ft = ({ event: e, rect: n, categories: s, renderTooltip: d }) => {
|
|
826
|
+
if (d)
|
|
827
|
+
return /* @__PURE__ */ t(
|
|
828
|
+
"div",
|
|
829
|
+
{
|
|
830
|
+
className: "nice-scheduler__tooltip",
|
|
831
|
+
style: { position: "fixed", left: n.right + 8, top: n.top, zIndex: 1e4 },
|
|
832
|
+
children: d(e)
|
|
833
|
+
}
|
|
834
|
+
);
|
|
835
|
+
const a = s?.find((u) => u.key === e.category);
|
|
836
|
+
return /* @__PURE__ */ g(
|
|
837
|
+
"div",
|
|
838
|
+
{
|
|
839
|
+
className: "nice-scheduler__tooltip",
|
|
840
|
+
style: { position: "fixed", left: n.right + 8, top: n.top, zIndex: 1e4 },
|
|
841
|
+
children: [
|
|
842
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__tooltip-title", children: e.title }),
|
|
843
|
+
/* @__PURE__ */ g("div", { className: "nice-scheduler__tooltip-time", children: [
|
|
844
|
+
new Date(e.start).toLocaleString(),
|
|
845
|
+
" � ",
|
|
846
|
+
new Date(e.end).toLocaleString()
|
|
847
|
+
] }),
|
|
848
|
+
a && /* @__PURE__ */ g("div", { className: "nice-scheduler__tooltip-cat", children: [
|
|
849
|
+
/* @__PURE__ */ t("span", { className: "nice-scheduler__tooltip-dot", style: { backgroundColor: a.color } }),
|
|
850
|
+
a.label
|
|
851
|
+
] }),
|
|
852
|
+
e.description && /* @__PURE__ */ t("div", { className: "nice-scheduler__tooltip-desc", children: e.description }),
|
|
853
|
+
/* @__PURE__ */ t(qe, { ev: e })
|
|
854
|
+
]
|
|
855
|
+
}
|
|
856
|
+
);
|
|
857
|
+
}, At = ({
|
|
858
|
+
event: e,
|
|
859
|
+
slotStart: n,
|
|
860
|
+
slotEnd: s,
|
|
861
|
+
categories: d,
|
|
862
|
+
resources: a,
|
|
863
|
+
formFields: u,
|
|
864
|
+
formFieldsByType: D,
|
|
865
|
+
eventTypes: N,
|
|
866
|
+
renderEditor: T,
|
|
867
|
+
saving: P,
|
|
868
|
+
onSave: S,
|
|
869
|
+
onDelete: w,
|
|
870
|
+
onClose: $,
|
|
871
|
+
t: r
|
|
872
|
+
}) => {
|
|
873
|
+
const v = !!e, k = q.useMemo(
|
|
874
|
+
() => ({
|
|
875
|
+
title: e?.title ?? "",
|
|
876
|
+
description: e?.description ?? "",
|
|
877
|
+
color: e?.color ?? "var(--nice-primary, #3b82f6)",
|
|
878
|
+
category: e?.category ?? "",
|
|
879
|
+
eventStyle: e?.eventStyle ?? "solid",
|
|
880
|
+
start: e?.start ?? n ?? /* @__PURE__ */ new Date(),
|
|
881
|
+
end: e?.end ?? s ?? /* @__PURE__ */ new Date(),
|
|
882
|
+
allDay: e?.allDay ?? !1,
|
|
883
|
+
resourceId: e?.resourceId ?? "",
|
|
884
|
+
eventType: e?.eventType ?? "task",
|
|
885
|
+
recurring: !!e?.recurrence,
|
|
886
|
+
recurrenceFreq: e?.recurrence?.freq ?? "weekly",
|
|
887
|
+
recurrenceInterval: e?.recurrence?.interval ?? 1,
|
|
888
|
+
recurrenceCount: e?.recurrence?.count,
|
|
889
|
+
// Recipe-specific
|
|
890
|
+
recipeTitle: e?.recipe?.title ?? "",
|
|
891
|
+
recipeServings: e?.recipe?.servings ?? 2,
|
|
892
|
+
recipePrep: e?.recipe?.prepMinutes,
|
|
893
|
+
recipeCook: e?.recipe?.cookMinutes,
|
|
894
|
+
recipeIngredients: (e?.recipe?.ingredients ?? []).map(
|
|
895
|
+
(m) => [m.quantity, m.unit, m.name].filter((y) => y !== void 0 && y !== "").join(" ")
|
|
896
|
+
).join(`
|
|
897
|
+
`),
|
|
898
|
+
recipeSteps: (e?.recipe?.steps ?? []).map((m) => m.instruction).join(`
|
|
899
|
+
`),
|
|
900
|
+
// Service-specific
|
|
901
|
+
serviceName: e?.service?.serviceName ?? "",
|
|
902
|
+
serviceProvider: e?.service?.providerName ?? "",
|
|
903
|
+
serviceCustomer: e?.service?.customerName ?? "",
|
|
904
|
+
serviceContact: e?.service?.customerContact ?? "",
|
|
905
|
+
serviceLocation: e?.service?.location ?? "",
|
|
906
|
+
servicePrice: e?.service?.price,
|
|
907
|
+
serviceCurrency: e?.service?.currency ?? "PLN",
|
|
908
|
+
serviceNotes: e?.service?.notes ?? ""
|
|
909
|
+
}),
|
|
910
|
+
[e, n, s]
|
|
911
|
+
), [o, l] = q.useState(k);
|
|
912
|
+
q.useEffect(() => {
|
|
913
|
+
l(k);
|
|
914
|
+
}, [k]);
|
|
915
|
+
const E = q.useCallback((m, y) => {
|
|
916
|
+
l((R) => ({ ...R, [m]: y }));
|
|
917
|
+
}, []), p = q.useMemo(() => {
|
|
918
|
+
if (u && u.length > 0)
|
|
919
|
+
return u;
|
|
920
|
+
const m = (c) => c.toString().padStart(2, "0"), y = (c) => `${c.getFullYear()}-${m(c.getMonth() + 1)}-${m(c.getDate())}`, R = (c) => `${m(c.getHours())}:${m(c.getMinutes())}`, h = (c, f) => {
|
|
921
|
+
const x = c instanceof Date ? c : new Date(c), W = isNaN(x.getTime()) ? /* @__PURE__ */ new Date() : x, K = y(W), G = R(W), L = (C, Q) => {
|
|
922
|
+
const [X, U, pe] = C.split("-").map((le) => parseInt(le, 10)), [ye, fe] = Q.split(":").map((le) => parseInt(le, 10)), oe = new Date(W);
|
|
923
|
+
!isNaN(X) && !isNaN(U) && !isNaN(pe) && oe.setFullYear(X, U - 1, pe), !isNaN(ye) && !isNaN(fe) && oe.setHours(ye, fe, 0, 0), f(oe);
|
|
924
|
+
};
|
|
925
|
+
return /* @__PURE__ */ g("div", { style: { display: "flex", gap: 12, flexWrap: "wrap", alignItems: "flex-end" }, children: [
|
|
926
|
+
/* @__PURE__ */ g("div", { style: { display: "flex", flexDirection: "column", gap: 2 }, children: [
|
|
927
|
+
/* @__PURE__ */ t("span", { style: { fontSize: "0.7rem", color: "var(--nice-text-muted, #888)" }, children: r("date", "Date") }),
|
|
928
|
+
/* @__PURE__ */ t(Pe, { value: K, onChange: (C) => L(C, G), size: "sm" })
|
|
929
|
+
] }),
|
|
930
|
+
/* @__PURE__ */ g("div", { style: { display: "flex", flexDirection: "column", gap: 2 }, children: [
|
|
931
|
+
/* @__PURE__ */ t("span", { style: { fontSize: "0.7rem", color: "var(--nice-text-muted, #888)" }, children: r("time", "Time") }),
|
|
932
|
+
/* @__PURE__ */ t(
|
|
933
|
+
Pe,
|
|
934
|
+
{
|
|
935
|
+
dateFormatPreset: "time",
|
|
936
|
+
value: G,
|
|
937
|
+
onChange: (C) => L(K, C),
|
|
938
|
+
size: "sm"
|
|
939
|
+
}
|
|
940
|
+
)
|
|
941
|
+
] })
|
|
942
|
+
] });
|
|
943
|
+
}, b = [];
|
|
944
|
+
N && N.length > 1 && b.push({
|
|
945
|
+
field: "eventType",
|
|
946
|
+
label: r("eventType", "Type"),
|
|
947
|
+
type: "select",
|
|
948
|
+
group: r("common", "Common"),
|
|
949
|
+
options: N.map((c) => ({
|
|
950
|
+
label: c.icon ? `${c.icon} ${c.label}` : c.label,
|
|
951
|
+
value: c.type
|
|
952
|
+
}))
|
|
953
|
+
}), b.push(
|
|
954
|
+
{
|
|
955
|
+
field: "title",
|
|
956
|
+
label: r("title", "Title"),
|
|
957
|
+
type: "text",
|
|
958
|
+
required: !0,
|
|
959
|
+
group: r("common", "Common")
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
field: "start",
|
|
963
|
+
label: r("start", "Start"),
|
|
964
|
+
render: h,
|
|
965
|
+
group: r("common", "Common")
|
|
966
|
+
},
|
|
967
|
+
{
|
|
968
|
+
field: "end",
|
|
969
|
+
label: r("end", "End"),
|
|
970
|
+
render: h,
|
|
971
|
+
group: r("common", "Common")
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
field: "description",
|
|
975
|
+
label: r("description", "Description"),
|
|
976
|
+
type: "textarea",
|
|
977
|
+
group: r("common", "Common")
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
field: "color",
|
|
981
|
+
label: r("color", "Color"),
|
|
982
|
+
group: r("common", "Common"),
|
|
983
|
+
render: (c, f) => /* @__PURE__ */ t(
|
|
984
|
+
mt,
|
|
985
|
+
{
|
|
986
|
+
value: typeof c == "string" ? c : "var(--nice-primary, #3b82f6)",
|
|
987
|
+
onChange: f,
|
|
988
|
+
showInput: !1,
|
|
989
|
+
showRandom: !1
|
|
990
|
+
}
|
|
991
|
+
)
|
|
992
|
+
}
|
|
993
|
+
), d && d.length > 0 && b.push({
|
|
994
|
+
field: "category",
|
|
995
|
+
label: r("category", "Category"),
|
|
996
|
+
type: "select",
|
|
997
|
+
group: r("common", "Common"),
|
|
998
|
+
options: [
|
|
999
|
+
{ label: r("none", "(none)"), value: "" },
|
|
1000
|
+
...d.map((c) => ({ label: c.label, value: c.key }))
|
|
1001
|
+
]
|
|
1002
|
+
}), a && a.length > 0 && b.push({
|
|
1003
|
+
field: "resourceId",
|
|
1004
|
+
label: r("resource", "Resource"),
|
|
1005
|
+
type: "select",
|
|
1006
|
+
group: r("common", "Common"),
|
|
1007
|
+
options: [
|
|
1008
|
+
{ label: r("none", "(none)"), value: "" },
|
|
1009
|
+
...a.map((c) => ({ label: c.name, value: String(c.id) }))
|
|
1010
|
+
]
|
|
1011
|
+
});
|
|
1012
|
+
const A = r("recurring", "Recurring");
|
|
1013
|
+
b.push({
|
|
1014
|
+
field: "recurring",
|
|
1015
|
+
label: r("repeat", "Repeat"),
|
|
1016
|
+
type: "checkbox",
|
|
1017
|
+
group: A
|
|
1018
|
+
}), b.push({
|
|
1019
|
+
field: "recurrenceFreq",
|
|
1020
|
+
label: r("frequency", "Frequency"),
|
|
1021
|
+
type: "select",
|
|
1022
|
+
group: A,
|
|
1023
|
+
visibleWhen: (c) => !!c.recurring,
|
|
1024
|
+
options: [
|
|
1025
|
+
{ label: r("daily", "Daily"), value: "daily" },
|
|
1026
|
+
{ label: r("weekly", "Weekly"), value: "weekly" },
|
|
1027
|
+
{ label: r("monthly", "Monthly"), value: "monthly" },
|
|
1028
|
+
{ label: r("yearly", "Yearly"), value: "yearly" }
|
|
1029
|
+
]
|
|
1030
|
+
}), b.push({
|
|
1031
|
+
field: "recurrenceInterval",
|
|
1032
|
+
label: r("interval", "Interval"),
|
|
1033
|
+
type: "number",
|
|
1034
|
+
group: A,
|
|
1035
|
+
visibleWhen: (c) => !!c.recurring
|
|
1036
|
+
}), b.push({
|
|
1037
|
+
field: "recurrenceCount",
|
|
1038
|
+
label: r("occurrences", "Occurrences (optional)"),
|
|
1039
|
+
type: "number",
|
|
1040
|
+
group: A,
|
|
1041
|
+
visibleWhen: (c) => !!c.recurring
|
|
1042
|
+
});
|
|
1043
|
+
const Y = o.eventType ?? "task", V = D?.[Y];
|
|
1044
|
+
if (V && V.length > 0)
|
|
1045
|
+
b.push(...V);
|
|
1046
|
+
else if (Y === "recipe") {
|
|
1047
|
+
const c = r("recipe.section", "Recipe");
|
|
1048
|
+
b.push(
|
|
1049
|
+
{ field: "recipeTitle", label: r("recipe.title", "Recipe title"), type: "text", group: c },
|
|
1050
|
+
{
|
|
1051
|
+
field: "recipeServings",
|
|
1052
|
+
label: r("recipe.servings", "Servings"),
|
|
1053
|
+
type: "number",
|
|
1054
|
+
group: c
|
|
1055
|
+
},
|
|
1056
|
+
{
|
|
1057
|
+
field: "recipePrep",
|
|
1058
|
+
label: r("recipe.prepMinutes", "Prep (min)"),
|
|
1059
|
+
type: "number",
|
|
1060
|
+
group: c
|
|
1061
|
+
},
|
|
1062
|
+
{
|
|
1063
|
+
field: "recipeCook",
|
|
1064
|
+
label: r("recipe.cookMinutes", "Cook (min)"),
|
|
1065
|
+
type: "number",
|
|
1066
|
+
group: c
|
|
1067
|
+
},
|
|
1068
|
+
{
|
|
1069
|
+
field: "recipeIngredients",
|
|
1070
|
+
label: r("recipe.ingredients", "Ingredients (one per line)"),
|
|
1071
|
+
type: "textarea",
|
|
1072
|
+
group: c,
|
|
1073
|
+
hint: r("recipe.ingredients.hint", 'Format: "200 g flour"')
|
|
1074
|
+
},
|
|
1075
|
+
{
|
|
1076
|
+
field: "recipeSteps",
|
|
1077
|
+
label: r("recipe.steps", "Steps (one per line)"),
|
|
1078
|
+
type: "textarea",
|
|
1079
|
+
group: c
|
|
1080
|
+
}
|
|
1081
|
+
);
|
|
1082
|
+
} else if (Y === "service") {
|
|
1083
|
+
const c = r("service.section", "Service");
|
|
1084
|
+
b.push(
|
|
1085
|
+
{
|
|
1086
|
+
field: "serviceName",
|
|
1087
|
+
label: r("service.name", "Service name"),
|
|
1088
|
+
type: "text",
|
|
1089
|
+
group: c,
|
|
1090
|
+
required: !0
|
|
1091
|
+
},
|
|
1092
|
+
{
|
|
1093
|
+
field: "serviceProvider",
|
|
1094
|
+
label: r("service.provider", "Provider"),
|
|
1095
|
+
type: "text",
|
|
1096
|
+
group: c
|
|
1097
|
+
},
|
|
1098
|
+
{
|
|
1099
|
+
field: "serviceCustomer",
|
|
1100
|
+
label: r("service.customer", "Customer"),
|
|
1101
|
+
type: "text",
|
|
1102
|
+
group: c
|
|
1103
|
+
},
|
|
1104
|
+
{ field: "serviceContact", label: r("service.contact", "Contact"), type: "text", group: c },
|
|
1105
|
+
{
|
|
1106
|
+
field: "serviceLocation",
|
|
1107
|
+
label: r("service.location", "Location"),
|
|
1108
|
+
type: "text",
|
|
1109
|
+
group: c
|
|
1110
|
+
},
|
|
1111
|
+
{
|
|
1112
|
+
field: "servicePrice",
|
|
1113
|
+
label: r("service.price", "Price"),
|
|
1114
|
+
type: "number",
|
|
1115
|
+
group: c
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
field: "serviceCurrency",
|
|
1119
|
+
label: r("service.currency", "Currency"),
|
|
1120
|
+
type: "text",
|
|
1121
|
+
group: c
|
|
1122
|
+
},
|
|
1123
|
+
{ field: "serviceNotes", label: r("service.notes", "Notes"), type: "textarea", group: c }
|
|
1124
|
+
);
|
|
1125
|
+
}
|
|
1126
|
+
return b;
|
|
1127
|
+
}, [u, D, N, d, a, o.eventType, r]), F = () => {
|
|
1128
|
+
const m = o.eventType ?? "task", y = {
|
|
1129
|
+
title: o.title,
|
|
1130
|
+
description: o.description || void 0,
|
|
1131
|
+
color: o.color,
|
|
1132
|
+
category: o.category || void 0,
|
|
1133
|
+
eventStyle: o.eventStyle,
|
|
1134
|
+
allDay: o.allDay,
|
|
1135
|
+
start: o.start instanceof Date ? o.start : new Date(o.start),
|
|
1136
|
+
end: o.end instanceof Date ? o.end : new Date(o.end),
|
|
1137
|
+
resourceId: o.resourceId || void 0,
|
|
1138
|
+
eventType: m
|
|
1139
|
+
};
|
|
1140
|
+
if (o.recurring) {
|
|
1141
|
+
const R = {
|
|
1142
|
+
freq: o.recurrenceFreq || "weekly",
|
|
1143
|
+
interval: typeof o.recurrenceInterval == "number" && o.recurrenceInterval > 0 ? o.recurrenceInterval : 1
|
|
1144
|
+
};
|
|
1145
|
+
typeof o.recurrenceCount == "number" && o.recurrenceCount > 0 && (R.count = o.recurrenceCount), y.recurrence = R;
|
|
1146
|
+
} else
|
|
1147
|
+
y.recurrence = void 0;
|
|
1148
|
+
if (m === "recipe") {
|
|
1149
|
+
const R = String(o.recipeIngredients || "").split(`
|
|
1150
|
+
`).map((Y) => Y.trim()).filter(Boolean).map((Y, V) => {
|
|
1151
|
+
const c = Y.match(/^([\d.,/]+)\s*(\S+)?\s+(.+)$/);
|
|
1152
|
+
if (c) {
|
|
1153
|
+
const f = parseFloat(c[1].replace(",", "."));
|
|
1154
|
+
return {
|
|
1155
|
+
id: `ing-${V}`,
|
|
1156
|
+
name: c[3],
|
|
1157
|
+
quantity: isNaN(f) ? void 0 : f,
|
|
1158
|
+
unit: c[2]
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
return { id: `ing-${V}`, name: Y };
|
|
1162
|
+
}), h = String(o.recipeSteps || "").split(`
|
|
1163
|
+
`).map((Y) => Y.trim()).filter(Boolean).map((Y, V) => ({
|
|
1164
|
+
id: `step-${V}`,
|
|
1165
|
+
order: V + 1,
|
|
1166
|
+
instruction: Y
|
|
1167
|
+
})), b = e?.recipe ?? St(), A = {
|
|
1168
|
+
...b,
|
|
1169
|
+
title: o.recipeTitle || o.title || b.title,
|
|
1170
|
+
servings: typeof o.recipeServings == "number" ? o.recipeServings : b.servings,
|
|
1171
|
+
prepMinutes: typeof o.recipePrep == "number" ? o.recipePrep : b.prepMinutes,
|
|
1172
|
+
cookMinutes: typeof o.recipeCook == "number" ? o.recipeCook : b.cookMinutes,
|
|
1173
|
+
ingredients: R,
|
|
1174
|
+
steps: h
|
|
1175
|
+
};
|
|
1176
|
+
y.recipe = A, y.service = void 0;
|
|
1177
|
+
} else if (m === "service") {
|
|
1178
|
+
const R = {
|
|
1179
|
+
serviceName: String(o.serviceName || ""),
|
|
1180
|
+
providerName: o.serviceProvider || void 0,
|
|
1181
|
+
customerName: o.serviceCustomer || void 0,
|
|
1182
|
+
customerContact: o.serviceContact || void 0,
|
|
1183
|
+
location: o.serviceLocation || void 0,
|
|
1184
|
+
price: typeof o.servicePrice == "number" ? o.servicePrice : void 0,
|
|
1185
|
+
currency: o.serviceCurrency || void 0,
|
|
1186
|
+
notes: o.serviceNotes || void 0
|
|
1187
|
+
};
|
|
1188
|
+
y.service = R, y.recipe = void 0;
|
|
1189
|
+
} else
|
|
1190
|
+
y.recipe = void 0, y.service = void 0;
|
|
1191
|
+
return v && (y.id = e.id), y;
|
|
1192
|
+
};
|
|
1193
|
+
return /* @__PURE__ */ t(
|
|
1194
|
+
gt,
|
|
1195
|
+
{
|
|
1196
|
+
open: !0,
|
|
1197
|
+
onClose: $,
|
|
1198
|
+
title: v ? r("editEvent", "Edit Event") : r("newEvent", "New Event"),
|
|
1199
|
+
size: "md",
|
|
1200
|
+
footer: T ? null : /* @__PURE__ */ g(Ve, { children: [
|
|
1201
|
+
v && w && /* @__PURE__ */ t(
|
|
1202
|
+
re,
|
|
1203
|
+
{
|
|
1204
|
+
type: "button",
|
|
1205
|
+
variant: "error",
|
|
1206
|
+
size: "sm",
|
|
1207
|
+
onClick: () => {
|
|
1208
|
+
w(e), $();
|
|
1209
|
+
},
|
|
1210
|
+
disabled: P,
|
|
1211
|
+
children: r("delete", "Delete")
|
|
1212
|
+
}
|
|
1213
|
+
),
|
|
1214
|
+
/* @__PURE__ */ t("div", { style: { flex: 1 } }),
|
|
1215
|
+
/* @__PURE__ */ t(
|
|
1216
|
+
re,
|
|
1217
|
+
{
|
|
1218
|
+
type: "button",
|
|
1219
|
+
variant: "secondary",
|
|
1220
|
+
size: "sm",
|
|
1221
|
+
onClick: $,
|
|
1222
|
+
disabled: P,
|
|
1223
|
+
children: r("cancel", "Cancel")
|
|
1224
|
+
}
|
|
1225
|
+
),
|
|
1226
|
+
/* @__PURE__ */ t(
|
|
1227
|
+
re,
|
|
1228
|
+
{
|
|
1229
|
+
type: "button",
|
|
1230
|
+
variant: "primary",
|
|
1231
|
+
size: "sm",
|
|
1232
|
+
onClick: () => {
|
|
1233
|
+
o.title && S(F());
|
|
1234
|
+
},
|
|
1235
|
+
disabled: P || !o.title,
|
|
1236
|
+
children: P ? r("saving", "Saving…") : r("save", "Save")
|
|
1237
|
+
}
|
|
1238
|
+
)
|
|
1239
|
+
] }),
|
|
1240
|
+
children: /* @__PURE__ */ t(
|
|
1241
|
+
"div",
|
|
1242
|
+
{
|
|
1243
|
+
className: "nice-scheduler__form-body",
|
|
1244
|
+
onKeyDown: (m) => {
|
|
1245
|
+
m.key === "Enter" && m.target.tagName !== "TEXTAREA" && (m.preventDefault(), o.title && S(F()));
|
|
1246
|
+
},
|
|
1247
|
+
children: T ? T({
|
|
1248
|
+
event: e,
|
|
1249
|
+
slotStart: n,
|
|
1250
|
+
slotEnd: s,
|
|
1251
|
+
save: S,
|
|
1252
|
+
cancel: $,
|
|
1253
|
+
remove: w
|
|
1254
|
+
}) : /* @__PURE__ */ t(
|
|
1255
|
+
ht,
|
|
1256
|
+
{
|
|
1257
|
+
items: p,
|
|
1258
|
+
data: o,
|
|
1259
|
+
onFieldChange: E,
|
|
1260
|
+
columns: 1,
|
|
1261
|
+
gap: 12,
|
|
1262
|
+
size: "sm"
|
|
1263
|
+
}
|
|
1264
|
+
)
|
|
1265
|
+
}
|
|
1266
|
+
)
|
|
1267
|
+
}
|
|
1268
|
+
);
|
|
1269
|
+
}, It = [
|
|
1270
|
+
"day",
|
|
1271
|
+
"workWeek",
|
|
1272
|
+
"week",
|
|
1273
|
+
"dayRange",
|
|
1274
|
+
"month",
|
|
1275
|
+
"monthRange",
|
|
1276
|
+
"timeline",
|
|
1277
|
+
"agenda"
|
|
1278
|
+
], ze = ({
|
|
1279
|
+
events: e,
|
|
1280
|
+
defaultEvents: n,
|
|
1281
|
+
resources: s,
|
|
1282
|
+
currentDate: d,
|
|
1283
|
+
view: a,
|
|
1284
|
+
onDateChange: u,
|
|
1285
|
+
onViewChange: D,
|
|
1286
|
+
onEventClick: N,
|
|
1287
|
+
onSlotClick: T,
|
|
1288
|
+
onEventDrop: P,
|
|
1289
|
+
draggable: S = !1,
|
|
1290
|
+
timelineDays: w = 7,
|
|
1291
|
+
startHour: $ = 0,
|
|
1292
|
+
endHour: r = 24,
|
|
1293
|
+
firstDayOfWeek: v = 1,
|
|
1294
|
+
categories: k,
|
|
1295
|
+
showLegend: o,
|
|
1296
|
+
showTooltip: l,
|
|
1297
|
+
renderEvent: E,
|
|
1298
|
+
renderTooltip: p,
|
|
1299
|
+
workHours: F,
|
|
1300
|
+
showCurrentTime: m = !0,
|
|
1301
|
+
showMiniCalendar: y,
|
|
1302
|
+
onEventCreate: R,
|
|
1303
|
+
onEventEdit: h,
|
|
1304
|
+
onEventDelete: b,
|
|
1305
|
+
editable: A = !0,
|
|
1306
|
+
formFields: Y,
|
|
1307
|
+
formFieldsByType: V,
|
|
1308
|
+
eventTypes: c,
|
|
1309
|
+
renderEventEditor: f,
|
|
1310
|
+
loadEvents: x,
|
|
1311
|
+
onEventsChange: W,
|
|
1312
|
+
accessMode: K = "full",
|
|
1313
|
+
className: G,
|
|
1314
|
+
style: L
|
|
1315
|
+
}) => {
|
|
1316
|
+
const { t: C } = lt(), Q = K === "hidden", X = K === "readOnly" || K === "disabled", U = K === "disabled", [pe, ye] = B(d ?? /* @__PURE__ */ new Date()), [fe, oe] = B(a ?? "week"), le = d !== void 0 && u !== void 0, Ke = a !== void 0 && D !== void 0, H = le ? d : pe, M = Ke ? a : fe, Be = ut(null), [J, we] = B(() => {
|
|
1317
|
+
const i = /* @__PURE__ */ new Date();
|
|
1318
|
+
return i.setHours(0, 0, 0, 0), i;
|
|
1319
|
+
}), [O, be] = B(() => I(/* @__PURE__ */ new Date(), 13)), [Se, Te] = B(
|
|
1320
|
+
null
|
|
1321
|
+
), Ue = ne(
|
|
1322
|
+
(i, _) => {
|
|
1323
|
+
l && Te(i && _ ? { event: i, rect: _ } : null);
|
|
1324
|
+
},
|
|
1325
|
+
[l]
|
|
1326
|
+
), [ce, de] = B(null), [Je, _e] = B(!1), $e = e !== void 0 && W !== void 0, [Ge, xe] = dt({
|
|
1327
|
+
value: $e ? e : void 0,
|
|
1328
|
+
defaultValue: n,
|
|
1329
|
+
fallbackValue: [],
|
|
1330
|
+
onChange: W,
|
|
1331
|
+
componentName: "NiceScheduler"
|
|
1332
|
+
}), [Oe, Xe] = B(!1), [Qe, Ze] = B(null), [Pt, Ee] = B(!1), Z = Qe ?? ($e || Oe || e === void 0 ? Ge : e), [ue, et] = B(/* @__PURE__ */ new Set()), Re = ne((i) => {
|
|
1333
|
+
et((_) => {
|
|
1334
|
+
const j = new Set(_);
|
|
1335
|
+
return j.has(i) ? j.delete(i) : j.add(i), j;
|
|
1336
|
+
});
|
|
1337
|
+
}, []), ee = Ne(() => {
|
|
1338
|
+
if (M === "month")
|
|
1339
|
+
return {
|
|
1340
|
+
start: new Date(H.getFullYear(), H.getMonth(), 1),
|
|
1341
|
+
end: new Date(H.getFullYear(), H.getMonth() + 2, 0)
|
|
1342
|
+
};
|
|
1343
|
+
if (M === "timeline")
|
|
1344
|
+
return { start: new Date(H), end: I(H, w) };
|
|
1345
|
+
if (M === "dayRange" || M === "monthRange")
|
|
1346
|
+
return { start: new Date(J), end: I(O, 1) };
|
|
1347
|
+
const i = (() => {
|
|
1348
|
+
const _ = new Date(H), j = (_.getDay() - v + 7) % 7;
|
|
1349
|
+
return I(_, -j);
|
|
1350
|
+
})();
|
|
1351
|
+
return { start: I(i, -1), end: I(i, 8) };
|
|
1352
|
+
}, [H, M, v, w, J, O]), Ce = Ne(() => {
|
|
1353
|
+
let i = wt(Z, ee.start, ee.end);
|
|
1354
|
+
return ue.size > 0 && (i = i.filter((_) => !_.category || !ue.has(_.category))), i;
|
|
1355
|
+
}, [Z, ee, ue]), se = (i) => {
|
|
1356
|
+
ye(i), u?.(i);
|
|
1357
|
+
}, tt = (i) => {
|
|
1358
|
+
oe(i), D?.(i);
|
|
1359
|
+
}, Le = (i) => {
|
|
1360
|
+
if (M === "day")
|
|
1361
|
+
se(I(H, i));
|
|
1362
|
+
else if (M === "week" || M === "workWeek")
|
|
1363
|
+
se(I(H, i * 7));
|
|
1364
|
+
else if (M === "timeline")
|
|
1365
|
+
se(I(H, i * w));
|
|
1366
|
+
else if (M === "dayRange" || M === "monthRange") {
|
|
1367
|
+
const _ = Math.round((O.getTime() - J.getTime()) / 864e5) + 1;
|
|
1368
|
+
we(I(J, i * _)), be(I(O, i * _));
|
|
1369
|
+
} else {
|
|
1370
|
+
const _ = new Date(H);
|
|
1371
|
+
_.setMonth(_.getMonth() + i), se(_);
|
|
1372
|
+
}
|
|
1373
|
+
}, ke = Ne(() => {
|
|
1374
|
+
const i = new Date(H), _ = (i.getDay() - v + 7) % 7;
|
|
1375
|
+
return I(i, -_);
|
|
1376
|
+
}, [H, v]), ve = Ne(() => {
|
|
1377
|
+
if (M === "day")
|
|
1378
|
+
return [H];
|
|
1379
|
+
if (M === "workWeek") {
|
|
1380
|
+
const i = [];
|
|
1381
|
+
for (let _ = 0; _ < 7; _++) {
|
|
1382
|
+
const j = I(ke, _), te = j.getDay();
|
|
1383
|
+
te !== 0 && te !== 6 && i.push(j);
|
|
1384
|
+
}
|
|
1385
|
+
return i;
|
|
1386
|
+
}
|
|
1387
|
+
return Array.from({ length: 7 }, (i, _) => I(ke, _));
|
|
1388
|
+
}, [M, H, ke]), nt = M === "day" ? H.toLocaleDateString() : M === "week" || M === "workWeek" ? `${ve[0].toLocaleDateString()} – ${ve[ve.length - 1].toLocaleDateString()}` : M === "timeline" ? `${H.toLocaleDateString()} – ${I(H, w - 1).toLocaleDateString()}` : M === "dayRange" || M === "monthRange" ? `${J.toLocaleDateString()} – ${O.toLocaleDateString()}` : `${vt(C)[H.getMonth()]} ${H.getFullYear()}`, rt = ne(
|
|
1389
|
+
(i, _, j) => {
|
|
1390
|
+
X || (A && de({ mode: "create", slotStart: i, slotEnd: _ }), T?.(i, _, j));
|
|
1391
|
+
},
|
|
1392
|
+
[A, T, X]
|
|
1393
|
+
), it = ne(
|
|
1394
|
+
(i) => {
|
|
1395
|
+
A && !X && de({ mode: "edit", event: i }), N?.(i);
|
|
1396
|
+
},
|
|
1397
|
+
[A, N, X]
|
|
1398
|
+
), me = ne(
|
|
1399
|
+
(i) => {
|
|
1400
|
+
Xe(!0), xe(i);
|
|
1401
|
+
},
|
|
1402
|
+
[xe]
|
|
1403
|
+
), ct = ne(
|
|
1404
|
+
async (i) => {
|
|
1405
|
+
const _ = ce?.mode === "create";
|
|
1406
|
+
try {
|
|
1407
|
+
if (_e(!0), _) {
|
|
1408
|
+
const te = (R ? await R(i) : void 0) ?? {
|
|
1409
|
+
...i,
|
|
1410
|
+
id: typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `evt_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`
|
|
1411
|
+
}, De = Z.slice();
|
|
1412
|
+
De.push(te), me(De);
|
|
1413
|
+
} else {
|
|
1414
|
+
const te = (h ? await h(i) : void 0) ?? i, De = Z.map((Ie) => Ie.id === te.id ? te : Ie);
|
|
1415
|
+
me(De);
|
|
1416
|
+
}
|
|
1417
|
+
de(null);
|
|
1418
|
+
} finally {
|
|
1419
|
+
_e(!1);
|
|
1420
|
+
}
|
|
1421
|
+
},
|
|
1422
|
+
[ce, R, h, Z, me]
|
|
1423
|
+
), st = ne(
|
|
1424
|
+
async (i) => {
|
|
1425
|
+
try {
|
|
1426
|
+
_e(!0), b && await b(i);
|
|
1427
|
+
const _ = Z.filter((j) => j.id !== i.id);
|
|
1428
|
+
me(_), de(null);
|
|
1429
|
+
} finally {
|
|
1430
|
+
_e(!1);
|
|
1431
|
+
}
|
|
1432
|
+
},
|
|
1433
|
+
[b, Z, me]
|
|
1434
|
+
);
|
|
1435
|
+
q.useEffect(() => {
|
|
1436
|
+
if (!x)
|
|
1437
|
+
return;
|
|
1438
|
+
let i = !1;
|
|
1439
|
+
return Ee(!0), x({ start: ee.start, end: ee.end }).then((_) => {
|
|
1440
|
+
i || Ze(_);
|
|
1441
|
+
}).finally(() => {
|
|
1442
|
+
i || Ee(!1);
|
|
1443
|
+
}), () => {
|
|
1444
|
+
i = !0;
|
|
1445
|
+
};
|
|
1446
|
+
}, [x, ee.start.getTime(), ee.end.getTime()]);
|
|
1447
|
+
const at = (i) => ({
|
|
1448
|
+
day: C("day", "Day"),
|
|
1449
|
+
week: C("week", "Week"),
|
|
1450
|
+
workWeek: C("workWeek", "Work Week"),
|
|
1451
|
+
month: C("month", "Month"),
|
|
1452
|
+
timeline: C("timeline", "Timeline"),
|
|
1453
|
+
agenda: C("agenda", "Agenda"),
|
|
1454
|
+
dayRange: C("dayRange", "Day Range"),
|
|
1455
|
+
monthRange: C("monthRange", "Month Range")
|
|
1456
|
+
})[i], ae = {
|
|
1457
|
+
events: Ce,
|
|
1458
|
+
curDate: H,
|
|
1459
|
+
firstDayOfWeek: v,
|
|
1460
|
+
startHour: $,
|
|
1461
|
+
endHour: r,
|
|
1462
|
+
draggable: S,
|
|
1463
|
+
dragRef: Be,
|
|
1464
|
+
onEventClick: it,
|
|
1465
|
+
onSlotClick: rt,
|
|
1466
|
+
onEventDrop: P,
|
|
1467
|
+
resources: s,
|
|
1468
|
+
timelineDays: w,
|
|
1469
|
+
categories: k,
|
|
1470
|
+
workHours: F,
|
|
1471
|
+
showCurrentTime: m,
|
|
1472
|
+
renderEvent: E,
|
|
1473
|
+
showTooltip: l,
|
|
1474
|
+
renderTooltip: p,
|
|
1475
|
+
onHoverEvent: Ue,
|
|
1476
|
+
readOnly: X,
|
|
1477
|
+
t: C
|
|
1478
|
+
}, Fe = M === "dayRange" || M === "monthRange", Ae = (i) => {
|
|
1479
|
+
const _ = (j) => j.toString().padStart(2, "0");
|
|
1480
|
+
return `${i.getFullYear()}-${_(i.getMonth() + 1)}-${_(i.getDate())}`;
|
|
1481
|
+
};
|
|
1482
|
+
return Q ? null : /* @__PURE__ */ g(
|
|
1483
|
+
"div",
|
|
1484
|
+
{
|
|
1485
|
+
className: `nice-scheduler ${U ? "nice-scheduler--disabled" : ""} ${G || ""}`,
|
|
1486
|
+
style: L,
|
|
1487
|
+
children: [
|
|
1488
|
+
/* @__PURE__ */ g("div", { className: "nice-scheduler__toolbar", children: [
|
|
1489
|
+
/* @__PURE__ */ g("div", { className: "nice-scheduler__nav", children: [
|
|
1490
|
+
/* @__PURE__ */ g(Ye, { size: "sm", children: [
|
|
1491
|
+
/* @__PURE__ */ t(
|
|
1492
|
+
re,
|
|
1493
|
+
{
|
|
1494
|
+
onClick: () => Le(-1),
|
|
1495
|
+
disabled: U,
|
|
1496
|
+
"aria-label": C("previous", "Previous"),
|
|
1497
|
+
children: "‹"
|
|
1498
|
+
}
|
|
1499
|
+
),
|
|
1500
|
+
/* @__PURE__ */ t(
|
|
1501
|
+
re,
|
|
1502
|
+
{
|
|
1503
|
+
onClick: () => {
|
|
1504
|
+
if (Fe) {
|
|
1505
|
+
const i = /* @__PURE__ */ new Date();
|
|
1506
|
+
i.setHours(0, 0, 0, 0);
|
|
1507
|
+
const _ = Math.round((O.getTime() - J.getTime()) / 864e5);
|
|
1508
|
+
we(i), be(I(i, _));
|
|
1509
|
+
} else
|
|
1510
|
+
se(/* @__PURE__ */ new Date());
|
|
1511
|
+
},
|
|
1512
|
+
disabled: U,
|
|
1513
|
+
children: C("today", "Today")
|
|
1514
|
+
}
|
|
1515
|
+
),
|
|
1516
|
+
/* @__PURE__ */ t(
|
|
1517
|
+
re,
|
|
1518
|
+
{
|
|
1519
|
+
onClick: () => Le(1),
|
|
1520
|
+
disabled: U,
|
|
1521
|
+
"aria-label": C("next", "Next"),
|
|
1522
|
+
children: "›"
|
|
1523
|
+
}
|
|
1524
|
+
)
|
|
1525
|
+
] }),
|
|
1526
|
+
Fe ? /* @__PURE__ */ g("span", { className: "nice-scheduler__range-picker", children: [
|
|
1527
|
+
/* @__PURE__ */ t(
|
|
1528
|
+
"input",
|
|
1529
|
+
{
|
|
1530
|
+
type: "date",
|
|
1531
|
+
className: "nice-textinput nice-textinput--sm",
|
|
1532
|
+
value: Ae(J),
|
|
1533
|
+
disabled: U,
|
|
1534
|
+
onChange: (i) => {
|
|
1535
|
+
const _ = /* @__PURE__ */ new Date(i.target.value + "T00:00:00");
|
|
1536
|
+
isNaN(_.getTime()) || we(_);
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
),
|
|
1540
|
+
/* @__PURE__ */ t("span", { style: { margin: "0 4px" }, children: "–" }),
|
|
1541
|
+
/* @__PURE__ */ t(
|
|
1542
|
+
"input",
|
|
1543
|
+
{
|
|
1544
|
+
type: "date",
|
|
1545
|
+
className: "nice-textinput nice-textinput--sm",
|
|
1546
|
+
value: Ae(O),
|
|
1547
|
+
disabled: U,
|
|
1548
|
+
onChange: (i) => {
|
|
1549
|
+
const _ = /* @__PURE__ */ new Date(i.target.value + "T00:00:00");
|
|
1550
|
+
!isNaN(_.getTime()) && _ >= J && be(_);
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
)
|
|
1554
|
+
] }) : /* @__PURE__ */ t("span", { className: "nice-scheduler__title", children: nt })
|
|
1555
|
+
] }),
|
|
1556
|
+
/* @__PURE__ */ t("div", { className: "nice-scheduler__views", children: /* @__PURE__ */ t(Ye, { size: "sm", children: It.map((i) => /* @__PURE__ */ t(
|
|
1557
|
+
re,
|
|
1558
|
+
{
|
|
1559
|
+
variant: i === M ? "primary" : "secondary",
|
|
1560
|
+
onClick: () => tt(i),
|
|
1561
|
+
disabled: U,
|
|
1562
|
+
children: at(i)
|
|
1563
|
+
},
|
|
1564
|
+
i
|
|
1565
|
+
)) }) })
|
|
1566
|
+
] }),
|
|
1567
|
+
/* @__PURE__ */ g("div", { className: "nice-scheduler__body", children: [
|
|
1568
|
+
y && /* @__PURE__ */ g("div", { className: "nice-scheduler__sidebar", children: [
|
|
1569
|
+
/* @__PURE__ */ t(
|
|
1570
|
+
Et,
|
|
1571
|
+
{
|
|
1572
|
+
curDate: H,
|
|
1573
|
+
onDateSelect: (i) => se(i),
|
|
1574
|
+
firstDayOfWeek: v,
|
|
1575
|
+
t: C
|
|
1576
|
+
}
|
|
1577
|
+
),
|
|
1578
|
+
o && k && /* @__PURE__ */ t(
|
|
1579
|
+
He,
|
|
1580
|
+
{
|
|
1581
|
+
categories: k,
|
|
1582
|
+
events: Ce,
|
|
1583
|
+
filteredCategories: ue,
|
|
1584
|
+
onToggleCategory: Re,
|
|
1585
|
+
t: C
|
|
1586
|
+
}
|
|
1587
|
+
)
|
|
1588
|
+
] }),
|
|
1589
|
+
/* @__PURE__ */ g("div", { className: "nice-scheduler__content", children: [
|
|
1590
|
+
M === "month" && /* @__PURE__ */ t(kt, { ...ae }),
|
|
1591
|
+
(M === "week" || M === "day" || M === "workWeek") && /* @__PURE__ */ t(Mt, { ...ae, days: ve }),
|
|
1592
|
+
M === "dayRange" && /* @__PURE__ */ t(Rt, { ...ae, rangeStart: J, rangeEnd: O }),
|
|
1593
|
+
M === "monthRange" && /* @__PURE__ */ t(Lt, { ...ae, rangeStart: J, rangeEnd: O }),
|
|
1594
|
+
M === "timeline" && /* @__PURE__ */ t(xt, { ...ae }),
|
|
1595
|
+
M === "agenda" && /* @__PURE__ */ t(Tt, { ...ae })
|
|
1596
|
+
] }),
|
|
1597
|
+
!y && o && k && /* @__PURE__ */ t("div", { className: "nice-scheduler__sidebar nice-scheduler__sidebar--right", children: /* @__PURE__ */ t(
|
|
1598
|
+
He,
|
|
1599
|
+
{
|
|
1600
|
+
categories: k,
|
|
1601
|
+
events: Ce,
|
|
1602
|
+
filteredCategories: ue,
|
|
1603
|
+
onToggleCategory: Re,
|
|
1604
|
+
t: C
|
|
1605
|
+
}
|
|
1606
|
+
) })
|
|
1607
|
+
] }),
|
|
1608
|
+
Se && /* @__PURE__ */ t(
|
|
1609
|
+
Ft,
|
|
1610
|
+
{
|
|
1611
|
+
event: Se.event,
|
|
1612
|
+
rect: Se.rect,
|
|
1613
|
+
categories: k,
|
|
1614
|
+
renderTooltip: p
|
|
1615
|
+
}
|
|
1616
|
+
),
|
|
1617
|
+
ce && A && /* @__PURE__ */ t(
|
|
1618
|
+
At,
|
|
1619
|
+
{
|
|
1620
|
+
event: ce.event,
|
|
1621
|
+
slotStart: ce.slotStart,
|
|
1622
|
+
slotEnd: ce.slotEnd,
|
|
1623
|
+
categories: k,
|
|
1624
|
+
resources: s,
|
|
1625
|
+
formFields: Y,
|
|
1626
|
+
formFieldsByType: V,
|
|
1627
|
+
eventTypes: c,
|
|
1628
|
+
renderEditor: f,
|
|
1629
|
+
saving: Je,
|
|
1630
|
+
onSave: ct,
|
|
1631
|
+
onDelete: st,
|
|
1632
|
+
onClose: () => de(null),
|
|
1633
|
+
t: C
|
|
1634
|
+
}
|
|
1635
|
+
)
|
|
1636
|
+
]
|
|
1637
|
+
}
|
|
1638
|
+
);
|
|
1639
|
+
};
|
|
1640
|
+
ze.displayName = "NiceScheduler";
|
|
1641
|
+
const zt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1642
|
+
__proto__: null,
|
|
1643
|
+
NiceScheduler: ze
|
|
1644
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1645
|
+
export {
|
|
1646
|
+
Ye as N,
|
|
1647
|
+
ze as a,
|
|
1648
|
+
zt as b,
|
|
1649
|
+
St as c,
|
|
1650
|
+
bt as n,
|
|
1651
|
+
Ct as r
|
|
1652
|
+
};
|