@baishuyun/ui-mobile 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +2 -11
  2. package/dist/ActionSheet/ActionSheet-Ok-UTVMn.js +133 -0
  3. package/dist/ActionSheet/index.js +5 -0
  4. package/dist/Calendar/Calendar-ipjycVqK.js +1580 -0
  5. package/dist/Calendar/index.js +4 -3
  6. package/dist/Calendar/timeUtils-CPYfw0pt.js +27 -0
  7. package/dist/ConfigProvider/ConfigProvider-CNhaKMJa.js +181 -0
  8. package/dist/ConfigProvider/index.js +3 -3
  9. package/dist/Gantt/Gantt-DDItjDkR.js +1099 -0
  10. package/dist/Gantt/index.js +7 -3
  11. package/dist/Icon/Icon-CFvcrGGg.js +23 -0
  12. package/dist/Icon/index.js +3 -0
  13. package/dist/components/ActionSheet/ActionSheet.d.ts +3 -0
  14. package/dist/components/ActionSheet/index.d.ts +2 -0
  15. package/dist/components/ActionSheet/interface.d.ts +75 -0
  16. package/dist/components/Calendar/index.d.ts +1 -1
  17. package/dist/components/Calendar/interface.d.ts +65 -7
  18. package/dist/components/ConfigProvider/context.d.ts +4 -0
  19. package/dist/components/Gantt/Gantt.d.ts +1 -1
  20. package/dist/components/Gantt/GanttBar.d.ts +10 -0
  21. package/dist/components/Gantt/GanttHeader.d.ts +2 -0
  22. package/dist/components/Gantt/GanttTimeLine.d.ts +9 -0
  23. package/dist/components/Gantt/HeaderToolbar.d.ts +6 -0
  24. package/dist/components/Gantt/OffscreenIndicatorArrow.d.ts +8 -0
  25. package/dist/components/Gantt/OffscreenIndicatorOverlay.d.ts +14 -0
  26. package/dist/components/Gantt/StickyLabel.d.ts +10 -0
  27. package/dist/components/Gantt/TodayIndicator.d.ts +14 -0
  28. package/dist/components/Gantt/calcTodayLeft.d.ts +8 -0
  29. package/dist/components/Gantt/context.d.ts +27 -0
  30. package/dist/components/Gantt/hooks/useGanttScroll.d.ts +23 -0
  31. package/dist/components/Gantt/hooks/useGanttViewport.d.ts +20 -0
  32. package/dist/components/Gantt/hooks/useTodayTracker.d.ts +7 -0
  33. package/dist/components/Gantt/index.d.ts +2 -1
  34. package/dist/components/Gantt/interface.d.ts +27 -2
  35. package/dist/components/Gantt/msUntilNextDay.d.ts +2 -0
  36. package/dist/components/Gantt/utils/color.d.ts +2 -0
  37. package/dist/components/Gantt/utils/cx.d.ts +1 -0
  38. package/dist/components/Gantt/utils/dateRangeNormalizer.d.ts +25 -0
  39. package/dist/components/Gantt/utils/dayScale.d.ts +30 -0
  40. package/dist/components/Gantt/utils/headerTimeUtils.d.ts +43 -0
  41. package/dist/components/Gantt/utils/layoutBars.d.ts +26 -0
  42. package/dist/components/Gantt/utils/time.d.ts +4 -0
  43. package/dist/components/Gantt/utils/viewportDateUtils.d.ts +11 -0
  44. package/dist/components/Gantt/utils/zoomReanchor.d.ts +18 -0
  45. package/dist/components/Icon/Icon.d.ts +6 -0
  46. package/dist/components/Icon/index.d.ts +2 -0
  47. package/dist/components/Icon/interface.d.ts +19 -0
  48. package/dist/components/Icon/loadIconfont.d.ts +1 -0
  49. package/dist/components/index.d.ts +7 -2
  50. package/dist/index.js +9 -6
  51. package/dist/locale/index.d.ts +3 -0
  52. package/dist/locale/lang/en-US.json.d.ts +41 -0
  53. package/dist/locale/lang/zh-CN.json.d.ts +41 -0
  54. package/dist/locale/lang/zh-TW.json.d.ts +41 -0
  55. package/dist/style.css +1 -1
  56. package/dist/vendors/useLocale-CMHIlzlj.js +98 -0
  57. package/dist/vendors/{version-BVySNITW.js → version-3D9AaDf3.js} +1 -1
  58. package/dist/vite-env.d.ts +1 -0
  59. package/package.json +6 -1
  60. package/dist/Calendar/Calendar-6ibIyMx0.js +0 -1606
  61. package/dist/ConfigProvider/ConfigProvider-E792q6ny.js +0 -99
  62. package/dist/Gantt/Gantt-DLmqZPAQ.js +0 -8
  63. package/dist/vendors/useLocale-BbUDQCzl.js +0 -57
@@ -0,0 +1,1099 @@
1
+ import { t as e } from "../ActionSheet/ActionSheet-Ok-UTVMn.js";
2
+ import { i as t, r as n, t as r } from "../vendors/useLocale-CMHIlzlj.js";
3
+ import { r as i } from "../Calendar/timeUtils-CPYfw0pt.js";
4
+ import { createContext as a, memo as o, useCallback as s, useContext as c, useEffect as l, useLayoutEffect as u, useMemo as d, useRef as f, useState as p } from "react";
5
+ import { createPortal as m } from "react-dom";
6
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
7
+ import { useControllableValue as v } from "ahooks";
8
+ import y from "dayjs";
9
+ import { useVirtualizer as b } from "@tanstack/react-virtual";
10
+ //#region src/components/Gantt/Gantt.module.scss
11
+ var x = {
12
+ "bsy-mobile-gantt": "_bsy-mobile-gantt_10w5l_1",
13
+ "bsy-mobile-gantt__scroll": "_bsy-mobile-gantt__scroll_10w5l_18",
14
+ "bsy-mobile-gantt__canvas": "_bsy-mobile-gantt__canvas_10w5l_28",
15
+ "bsy-mobile-gantt__overlay-host": "_bsy-mobile-gantt__overlay-host_10w5l_34",
16
+ "bsy-mobile-gantt__header": "_bsy-mobile-gantt__header_10w5l_43",
17
+ "bsy-mobile-gantt__header-row1": "_bsy-mobile-gantt__header-row1_10w5l_50",
18
+ "bsy-mobile-gantt__header-row2": "_bsy-mobile-gantt__header-row2_10w5l_54",
19
+ "bsy-mobile-gantt__header-cell": "_bsy-mobile-gantt__header-cell_10w5l_57",
20
+ "bsy-mobile-gantt__header-cell-label": "_bsy-mobile-gantt__header-cell-label_10w5l_62",
21
+ "bsy-mobile-gantt__header-cell-label--today": "_bsy-mobile-gantt__header-cell-label--today_10w5l_73",
22
+ "bsy-mobile-gantt__today-dot": "_bsy-mobile-gantt__today-dot_10w5l_77",
23
+ "bsy-mobile-gantt__sticky-label": "_bsy-mobile-gantt__sticky-label_10w5l_87",
24
+ "bsy-mobile-gantt__sticky-label-text": "_bsy-mobile-gantt__sticky-label-text_10w5l_95",
25
+ "bsy-mobile-gantt__toolbar": "_bsy-mobile-gantt__toolbar_10w5l_102",
26
+ "bsy-mobile-gantt__toolbar-zoom": "_bsy-mobile-gantt__toolbar-zoom_10w5l_115",
27
+ "bsy-mobile-gantt__toolbar-today": "_bsy-mobile-gantt__toolbar-today_10w5l_115",
28
+ "bsy-mobile-gantt__toolbar-nav": "_bsy-mobile-gantt__toolbar-nav_10w5l_115",
29
+ "bsy-mobile-gantt__toolbar-divider": "_bsy-mobile-gantt__toolbar-divider_10w5l_130",
30
+ "bsy-mobile-gantt__chevron": "_bsy-mobile-gantt__chevron_10w5l_156",
31
+ "bsy-mobile-gantt__chevron--left": "_bsy-mobile-gantt__chevron--left_10w5l_160",
32
+ "bsy-mobile-gantt__chevron--right": "_bsy-mobile-gantt__chevron--right_10w5l_163",
33
+ "bsy-mobile-gantt__timeline": "_bsy-mobile-gantt__timeline_10w5l_166",
34
+ "bsy-mobile-gantt__timeline-inner": "_bsy-mobile-gantt__timeline-inner_10w5l_177",
35
+ "bsy-mobile-gantt__column": "_bsy-mobile-gantt__column_10w5l_181",
36
+ "bsy-mobile-gantt__column--weekend": "_bsy-mobile-gantt__column--weekend_10w5l_192",
37
+ "bsy-mobile-gantt__today-line": "_bsy-mobile-gantt__today-line_10w5l_195",
38
+ "bsy-mobile-gantt__bar": "_bsy-mobile-gantt__bar_10w5l_203",
39
+ "bsy-mobile-gantt__bar-track": "_bsy-mobile-gantt__bar-track_10w5l_210",
40
+ "bsy-mobile-gantt__bar-progress": "_bsy-mobile-gantt__bar-progress_10w5l_210",
41
+ "bsy-mobile-gantt__bar-label": "_bsy-mobile-gantt__bar-label_10w5l_220",
42
+ "bsy-mobile-gantt__offscreen": "_bsy-mobile-gantt__offscreen_10w5l_231",
43
+ "bsy-mobile-gantt__offscreen-layer": "_bsy-mobile-gantt__offscreen-layer_10w5l_240",
44
+ "bsy-mobile-gantt__offscreen-row": "_bsy-mobile-gantt__offscreen-row_10w5l_250",
45
+ "bsy-mobile-gantt__offscreen-arrow": "_bsy-mobile-gantt__offscreen-arrow_10w5l_258",
46
+ "bsy-mobile-gantt-arrow-enter": "_bsy-mobile-gantt-arrow-enter_10w5l_1",
47
+ "bsy-mobile-gantt__offscreen-arrow--right": "_bsy-mobile-gantt__offscreen-arrow--right_10w5l_278"
48
+ }, S = a(null), C = a(null), w = () => {
49
+ let e = c(S);
50
+ if (!e) throw Error("useGanttState must be used within a GanttStateContext.Provider");
51
+ return e;
52
+ }, T = () => {
53
+ let e = c(C);
54
+ if (!e) throw Error("useGanttAction must be used within a GanttActionContext.Provider");
55
+ return e;
56
+ }, E = [
57
+ "day",
58
+ "week",
59
+ "month",
60
+ "quarter",
61
+ "quarterMonth",
62
+ "year"
63
+ ], D = [
64
+ "halfDay",
65
+ "sixHour",
66
+ "hour",
67
+ "halfHour",
68
+ "tenMinute",
69
+ "oneMinute"
70
+ ], O = [...E, ...D], k = t.gantt.zoom, A = [...[...D].reverse(), ...E], j = 1440 * 60 * 1e3, M = j / 24, N = M / 60, P = {
71
+ halfDay: 12 * M,
72
+ sixHour: 6 * M,
73
+ hour: M,
74
+ halfHour: 30 * N,
75
+ tenMinute: 10 * N,
76
+ oneMinute: N
77
+ }, ee = {
78
+ halfDay: 80,
79
+ sixHour: 70,
80
+ hour: 50,
81
+ halfHour: 45,
82
+ tenMinute: 40,
83
+ oneMinute: 40
84
+ }, te = 30 / 40;
85
+ function F(e) {
86
+ return (e === "tenMinute" || e === "oneMinute" ? 30 : Math.round(ee[e] * te)) * (j / P[e]);
87
+ }
88
+ var I = {
89
+ day: 30,
90
+ week: 18,
91
+ month: 6.5,
92
+ quarter: 2.2,
93
+ quarterMonth: 100 / 30,
94
+ year: 1.1,
95
+ halfDay: F("halfDay"),
96
+ sixHour: F("sixHour"),
97
+ hour: F("hour"),
98
+ halfHour: F("halfHour"),
99
+ tenMinute: F("tenMinute"),
100
+ oneMinute: F("oneMinute")
101
+ }, ne = {
102
+ halfDay: 30,
103
+ sixHour: 14,
104
+ hour: 7,
105
+ halfHour: 3,
106
+ tenMinute: 2,
107
+ oneMinute: 0
108
+ };
109
+ function L(e) {
110
+ return D.includes(e);
111
+ }
112
+ function R(e) {
113
+ return L(e) ? P[e] : j;
114
+ }
115
+ function re(e, t) {
116
+ return t * (R(e) / j);
117
+ }
118
+ function z(e, t, n) {
119
+ return (e.valueOf() - t.valueOf()) / j * n;
120
+ }
121
+ function ie(e, t, n) {
122
+ let r = e / n * j;
123
+ return t.add(r, "millisecond");
124
+ }
125
+ //#endregion
126
+ //#region src/components/Gantt/utils/time.ts
127
+ var B = (e) => e ? y().tz(e) : y(), ae = (e, t) => i(e, t), oe = (e, r) => n(t, e, r), V = (e) => `calendar.monthShort.${e}`, H = (e) => `gantt.quarter.${e + 1}`, se = new Set([
128
+ "halfDay",
129
+ "sixHour",
130
+ "hour"
131
+ ]), ce = new Set([
132
+ "halfHour",
133
+ "tenMinute",
134
+ "oneMinute"
135
+ ]);
136
+ function le(e, t, n) {
137
+ switch (t) {
138
+ case "halfDay": return e.hour() < 12 ? n("gantt.am") : n("gantt.pm");
139
+ case "sixHour": {
140
+ let t = e.hour();
141
+ return n("gantt.hourRange", {
142
+ start: t,
143
+ end: t + 6
144
+ });
145
+ }
146
+ case "hour": return String(e.hour());
147
+ case "halfHour": return e.format("HH:mm");
148
+ case "tenMinute": return String(e.minute());
149
+ case "oneMinute": return e.format("mm");
150
+ default: return e.format("HH:mm");
151
+ }
152
+ }
153
+ function ue(e, t) {
154
+ let n = e.hour();
155
+ if (n === 0) {
156
+ let r = e.month() + 1;
157
+ return t("gantt.monthDayHour", {
158
+ month: r,
159
+ day: e.date(),
160
+ hour: n,
161
+ monthShort: t(V(r))
162
+ });
163
+ }
164
+ return t("gantt.hour", { hour: n });
165
+ }
166
+ function de(e, t) {
167
+ switch (t) {
168
+ case "halfDay": return e.add(12, "hour");
169
+ case "sixHour": return e.add(6, "hour");
170
+ case "hour": return e.add(1, "hour");
171
+ case "halfHour": return e.add(30, "minute");
172
+ case "tenMinute": return e.add(10, "minute");
173
+ case "oneMinute": return e.add(1, "minute");
174
+ default: return e.add(1, "hour");
175
+ }
176
+ }
177
+ function fe(e, t, n, r = oe) {
178
+ let i = [], a = "", o = null;
179
+ return e.forEach((e, s) => {
180
+ let c, l, u = e.date.year(), d = e.date.month() + 1;
181
+ if (se.has(t)) c = e.date.format("YYYY-MM-DD"), l = r("gantt.yearMonthDay", {
182
+ year: u,
183
+ month: d,
184
+ day: e.date.date(),
185
+ monthShort: r(V(d))
186
+ });
187
+ else if (ce.has(t)) c = e.date.format("YYYY-MM-DD-HH"), l = ue(e.date, r);
188
+ else if (t === "day" || t === "week") c = e.date.format("YYYY-MM"), l = r("calendar.yearMonth", {
189
+ year: u,
190
+ monthShort: r(V(d))
191
+ });
192
+ else if (t === "quarterMonth") {
193
+ let t = Math.floor(e.date.month() / 3);
194
+ c = `${u}-Q${t + 1}`, l = r("gantt.yearQuarter", {
195
+ year: u,
196
+ quarter: r(H(t))
197
+ });
198
+ } else c = e.date.format("YYYY"), l = r("gantt.year", { year: u });
199
+ c === a ? o && (o.span++, o.widthPx += e.days * n) : (o && i.push(o), a = c, o = {
200
+ label: l,
201
+ startIndex: s,
202
+ span: 1,
203
+ widthPx: e.days * n
204
+ });
205
+ }), o && i.push(o), i;
206
+ }
207
+ function U(e, t, n, r, i = oe) {
208
+ let a = [];
209
+ if (L(n)) {
210
+ let o = P[n] / j, s = e;
211
+ for (let e = 0; e < t; e++) {
212
+ let e = s, t = de(e, n), c = !r.isBefore(e) && r.isBefore(t);
213
+ a.push({
214
+ label: le(e, n, i),
215
+ isToday: c,
216
+ isWeekend: !1,
217
+ date: e,
218
+ endDate: t,
219
+ days: o
220
+ }), s = t;
221
+ }
222
+ return a;
223
+ }
224
+ for (let o = 0; o < t; o++) {
225
+ let t, s, c, l = !1, u = !1;
226
+ switch (n) {
227
+ case "day":
228
+ t = e.add(o, "day"), s = t.add(1, "day"), c = String(t.date()), l = t.isSame(r, "day"), u = t.day() === 0 || t.day() === 6;
229
+ break;
230
+ case "week": {
231
+ t = e.add(o, "week").startOf("isoWeek"), s = t.add(1, "week");
232
+ let n = t.isoWeek();
233
+ c = i("gantt.week", { week: n }), l = r.isoWeek() === n && r.year() === t.year();
234
+ break;
235
+ }
236
+ case "month":
237
+ case "quarterMonth":
238
+ t = e.add(o, "month").startOf("month"), s = t.add(1, "month"), c = i(V(t.month() + 1)), l = r.month() === t.month() && r.year() === t.year();
239
+ break;
240
+ case "quarter": {
241
+ t = e.add(o * 3, "month").startOf("month"), s = t.add(3, "month");
242
+ let n = Math.floor(t.month() / 3);
243
+ c = i(H(n)), l = Math.floor(r.month() / 3) === n && r.year() === t.year();
244
+ break;
245
+ }
246
+ case "year": {
247
+ let n = e.month() < 6 ? 0 : 1, a = o + n, u = a % 2, d = Math.floor(a / 2), f = e.year() + d;
248
+ u === 0 ? (t = e.year(f).month(0).startOf("month"), s = e.year(f).month(6).startOf("month"), c = i("gantt.firstHalfYear")) : (t = e.year(f).month(6).startOf("month"), s = e.year(f + 1).month(0).startOf("month"), c = i("gantt.secondHalfYear")), l = r.isSame(t, "day") || r.isAfter(t) && r.isBefore(s);
249
+ break;
250
+ }
251
+ default:
252
+ t = e.add(o, "day"), s = t.add(1, "day"), c = String(t.date());
253
+ break;
254
+ }
255
+ let d = s.diff(t, "day");
256
+ a.push({
257
+ label: c,
258
+ isToday: l,
259
+ isWeekend: u,
260
+ date: t,
261
+ endDate: s,
262
+ days: d
263
+ });
264
+ }
265
+ return a;
266
+ }
267
+ function pe(e, t) {
268
+ if (t === "oneMinute") return {
269
+ startDate: e.subtract(12, "hour").startOf("minute"),
270
+ count: 1440,
271
+ totalDays: 1
272
+ };
273
+ let n = ne[t], r = R(t), i = e.startOf("day").subtract(n, "day"), a = e.startOf("day").add(n + 1, "day").diff(i, "day", !0);
274
+ return {
275
+ startDate: i,
276
+ count: Math.max(1, Math.round(a * j / r)),
277
+ totalDays: a
278
+ };
279
+ }
280
+ function W(e, t, n, r, i = 30) {
281
+ if (L(t)) return pe(e, t);
282
+ let a = Math.ceil((r > 0 ? r : 375) / n) * (1 + i * 2), o = Math.floor(a / 2), s, c;
283
+ switch (t) {
284
+ case "day":
285
+ s = e.startOf("day").subtract(o, "day"), c = a;
286
+ break;
287
+ case "week": {
288
+ let t = Math.floor(o / 7);
289
+ s = e.startOf("isoWeek").subtract(t, "week"), c = Math.ceil(a / 7);
290
+ break;
291
+ }
292
+ case "month":
293
+ case "quarterMonth": {
294
+ let t = Math.floor(o / 30.44);
295
+ s = e.startOf("month").subtract(t, "month"), c = Math.ceil(a / 30.44);
296
+ break;
297
+ }
298
+ case "quarter": {
299
+ let t = Math.floor(o / 91.31);
300
+ s = e.startOf("month").subtract(Math.floor(e.month() % 3), "month").subtract(t * 3, "month"), c = Math.ceil(a / 91.31);
301
+ break;
302
+ }
303
+ case "year": {
304
+ let t = Math.floor(o / 182.5), n = e.month() < 6 ? 0 : 6;
305
+ s = e.startOf("year").add(n, "month").subtract(t * 6, "month"), s = s.month() >= 6 ? s.month(6).startOf("month") : s.month(0).startOf("month"), c = Math.ceil(a / 182.5);
306
+ break;
307
+ }
308
+ default:
309
+ s = e.startOf("day").subtract(o, "day"), c = a;
310
+ break;
311
+ }
312
+ let l;
313
+ switch (t) {
314
+ case "day":
315
+ l = c;
316
+ break;
317
+ case "week":
318
+ l = c * 7;
319
+ break;
320
+ case "month":
321
+ case "quarterMonth":
322
+ l = s.add(c, "month").diff(s, "day");
323
+ break;
324
+ case "quarter":
325
+ l = s.add(c * 3, "month").diff(s, "day");
326
+ break;
327
+ case "year":
328
+ l = s.add(c * 6, "month").diff(s, "day");
329
+ break;
330
+ default:
331
+ l = c;
332
+ break;
333
+ }
334
+ return {
335
+ startDate: s,
336
+ count: c,
337
+ totalDays: l
338
+ };
339
+ }
340
+ //#endregion
341
+ //#region src/components/Gantt/hooks/useGanttViewport.ts
342
+ function me({ timeZone: e, initialZoomLevel: t = "day" }) {
343
+ let n = t, [r, i] = p(() => B(e)), a = f(null), [o, s] = p(0), c = I[n], { startDate: u, count: m, totalDays: h } = d(() => W(r, n, c, o), [
344
+ r,
345
+ n,
346
+ c,
347
+ o
348
+ ]), g = h * c;
349
+ return l(() => {
350
+ let e = a.current;
351
+ if (!e) return;
352
+ let t = new ResizeObserver((e) => {
353
+ for (let t of e) s(t.contentRect.width);
354
+ });
355
+ return t.observe(e), s(e.clientWidth), () => t.disconnect();
356
+ }, []), {
357
+ timeZone: e,
358
+ zoomLevel: n,
359
+ pxPerDay: c,
360
+ anchorDate: r,
361
+ containerRef: a,
362
+ viewportWidth: o,
363
+ startDate: u,
364
+ count: m,
365
+ totalDays: h,
366
+ totalWidth: g,
367
+ setAnchorDate: i
368
+ };
369
+ }
370
+ //#endregion
371
+ //#region src/components/Gantt/utils/viewportDateUtils.ts
372
+ function G(e, t, n, r) {
373
+ return ie(e + t / 2, n, r);
374
+ }
375
+ function K(e, t, n, r) {
376
+ let i = z(e, t, n);
377
+ return Math.max(0, i - r / 2);
378
+ }
379
+ //#endregion
380
+ //#region src/components/Gantt/utils/zoomReanchor.ts
381
+ function he({ currentZoomLevel: e, nextZoomLevel: t, currentAnchorDate: n, currentScrollLeft: r, viewportWidth: i }) {
382
+ let a = I[e], o = G(r, i, W(n, e, a, i).startDate, a), s = I[t];
383
+ return {
384
+ anchorDate: o,
385
+ scrollLeft: K(o, W(o, t, s, i).startDate, s, i)
386
+ };
387
+ }
388
+ //#endregion
389
+ //#region src/components/Gantt/hooks/useGanttScroll.ts
390
+ var ge = 2;
391
+ function _e(e, { onZoomLevelChange: t }) {
392
+ let { timeZone: n, zoomLevel: r, anchorDate: i, viewportWidth: a, startDate: o, totalWidth: c, pxPerDay: l, totalDays: d, setAnchorDate: p } = e, m = f(null), h = f(t);
393
+ h.current = t;
394
+ let g = f({
395
+ zoomLevel: r,
396
+ anchorDate: i,
397
+ viewportWidth: a,
398
+ startDate: o,
399
+ totalWidth: c,
400
+ pxPerDay: l,
401
+ totalDays: d
402
+ });
403
+ u(() => {
404
+ g.current = {
405
+ zoomLevel: r,
406
+ anchorDate: i,
407
+ viewportWidth: a,
408
+ startDate: o,
409
+ totalWidth: c,
410
+ pxPerDay: l,
411
+ totalDays: d
412
+ };
413
+ });
414
+ let _ = f(!1), v = f(!1), y = f(!1), b = f(null), x = s(() => m.current?.scrollLeft ?? 0, []), S = s((e, t = "auto") => {
415
+ let n = m.current;
416
+ if (!n) return;
417
+ let r = Math.max(0, n.scrollWidth - n.clientWidth), i = Math.max(0, Math.min(e, r));
418
+ Math.abs(n.scrollLeft - i) <= 1 || n.scrollTo({
419
+ left: i,
420
+ behavior: t
421
+ });
422
+ }, []), C = s((e) => {
423
+ let { zoomLevel: t, anchorDate: n, viewportWidth: r } = g.current;
424
+ if (e === t) return;
425
+ if (r <= 0) {
426
+ h.current(e);
427
+ return;
428
+ }
429
+ let { anchorDate: i, scrollLeft: a } = he({
430
+ currentZoomLevel: t,
431
+ nextZoomLevel: e,
432
+ currentAnchorDate: n,
433
+ currentScrollLeft: m.current?.scrollLeft ?? 0,
434
+ viewportWidth: r
435
+ });
436
+ p(i), h.current(e), y.current = !0, b.current = a;
437
+ }, [p]), w = s(() => {
438
+ let { zoomLevel: e, pxPerDay: t, viewportWidth: r } = g.current, i = B(n), a = K(i, W(i, e, t, r).startDate, t, r);
439
+ y.current = !0, b.current = a, p(i);
440
+ }, [n, p]);
441
+ return u(() => {
442
+ if (a <= 0 || v.current) return;
443
+ let e = K(i, o, l, a);
444
+ y.current = !0, b.current = e, v.current = !0;
445
+ }, [
446
+ i,
447
+ r,
448
+ l,
449
+ a,
450
+ o
451
+ ]), u(() => {
452
+ let e = b.current;
453
+ e !== null && (S(e), b.current = null);
454
+ }, [
455
+ S,
456
+ i,
457
+ r,
458
+ a,
459
+ c
460
+ ]), {
461
+ horizontalScrollRef: m,
462
+ scrollToX: S,
463
+ getScrollLeft: x,
464
+ handleHorizontalScroll: s(() => {
465
+ if (!v.current) return;
466
+ if (y.current) {
467
+ y.current = !1;
468
+ return;
469
+ }
470
+ if (_.current) {
471
+ _.current = !1;
472
+ return;
473
+ }
474
+ let { viewportWidth: e, zoomLevel: t, pxPerDay: n, startDate: r, totalWidth: i } = g.current;
475
+ if (e <= 0) return;
476
+ let a = x(), o = Math.max(0, i - e), s = e * ge, c = a < s, l = a > o - s;
477
+ if (!c && !l) return;
478
+ _.current = !0, y.current = !0;
479
+ let u = G(a, e, r, n);
480
+ b.current = K(u, W(u, t, n, e).startDate, n, e), p(u);
481
+ }, [x, p]),
482
+ setZoomLevel: C,
483
+ handleTodayClick: w,
484
+ navigateToBar: s((e) => {
485
+ if (!e) return;
486
+ let t = m.current;
487
+ if (!t) return;
488
+ let { pxPerDay: n, startDate: r, viewportWidth: i, zoomLevel: a } = g.current, o = z(e, r, n) - i / 2, s = Math.max(0, t.scrollWidth - t.clientWidth);
489
+ if (o >= 0 && o <= s) {
490
+ S(o, Math.abs(o - t.scrollLeft) > i * 2 ? "auto" : "smooth");
491
+ return;
492
+ }
493
+ let c = K(e, W(e, a, n, i).startDate, n, i);
494
+ y.current = !0, b.current = c, p(e);
495
+ }, [S, p])
496
+ };
497
+ }
498
+ //#endregion
499
+ //#region src/components/Gantt/utils/color.ts
500
+ var ve = /^#?([a-f\d])([a-f\d])([a-f\d])$/i, ye = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i, be = (e, t) => {
501
+ if (t < 0 || t > 1) return null;
502
+ let n = e.replace(ve, (e, t, n, r) => t + t + n + n + r + r), r = ye.exec(n);
503
+ return r ? `rgba(${parseInt(r[1], 16)}, ${parseInt(r[2], 16)}, ${parseInt(r[3], 16)}, ${t})` : null;
504
+ }, xe = (e, t = 2.5) => {
505
+ if (!e) return "#121211";
506
+ let n, r, i;
507
+ if (e.startsWith("#")) {
508
+ let t = e.replace("#", ""), a = t.length === 3 ? [...t].map((e) => e + e) : [
509
+ t.slice(0, 2),
510
+ t.slice(2, 4),
511
+ t.slice(4, 6)
512
+ ];
513
+ [n, r, i] = a.map((e) => parseInt(e, 16));
514
+ } else {
515
+ let t = (e.match(/\d+/g) || []).map(Number);
516
+ [n, r, i] = t.slice(0, 3);
517
+ }
518
+ if (n === void 0 || r === void 0 || i === void 0 || Number.isNaN(n)) return "#121211";
519
+ let a = (e) => {
520
+ let t = e / 255;
521
+ return t <= .04045 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
522
+ };
523
+ return 1.05 / (.2126 * a(n) + .7152 * a(r) + .0722 * a(i) + .05) >= t ? "#ffffff" : "#121211";
524
+ }, q = (e) => !e || !e.isValid() ? !1 : e.valueOf() !== e.startOf("day").valueOf(), Se = (e, t) => {
525
+ let n = e?.isValid() ? e : null, r = t?.isValid() ? t : null, i = n ? n.startOf("day") : null, a = r ? r.startOf("day").add(1, "day") : null;
526
+ return {
527
+ rawStart: n,
528
+ rawEnd: r,
529
+ baseStart: i,
530
+ baseEnd: a,
531
+ invalid: n !== null && r !== null && n.valueOf() > r.valueOf() || i === null || a === null || a.valueOf() <= i.valueOf()
532
+ };
533
+ }, Ce = (e, t) => L(t) && (q(e.rawStart) || q(e.rawEnd)) ? {
534
+ start: e.rawStart,
535
+ end: e.rawEnd
536
+ } : {
537
+ start: e.baseStart,
538
+ end: e.baseEnd
539
+ }, we = (e) => e === void 0 ? 1 : Number.isFinite(e) ? e < 0 || e > 1 ? 1 : e : 0;
540
+ function Te(e, t, n) {
541
+ let { startDate: r, pxPerDay: i, zoomLevel: a } = t, o = L(a) ? re(a, i) : i, s = L(a) ? r : r.startOf("day");
542
+ return e.map((e, t) => {
543
+ let r = ae(e.startTime, n), c = ae(e.endTime, n), l = r.isValid(), u = c.isValid(), d = l ? r : null, f = u ? c : null, p = e.color || "#5170E8", m = be(p, .2) || `${p}33`, h = we(e.progress), g = 0, _ = 0, v = !1;
544
+ if (d && f) {
545
+ let e = Se(d, f);
546
+ if (!e.invalid) {
547
+ let { start: t, end: n } = Ce(e, a);
548
+ if (t && n) {
549
+ v = !0, g = z(t, s, i);
550
+ let e = z(n, s, i);
551
+ _ = Math.max(o, e - g);
552
+ }
553
+ }
554
+ }
555
+ return {
556
+ id: e.id,
557
+ label: e.label,
558
+ hasTimeRange: v,
559
+ left: g,
560
+ width: _,
561
+ color: p,
562
+ bgColor: m,
563
+ progress: h,
564
+ rowIndex: t,
565
+ startDate: d,
566
+ endDate: f,
567
+ task: e
568
+ };
569
+ });
570
+ }
571
+ //#endregion
572
+ //#region src/components/Gantt/utils/cx.ts
573
+ var J = (...e) => e.filter(Boolean).join(" ");
574
+ //#endregion
575
+ //#region src/components/Gantt/calcTodayLeft.ts
576
+ function Y(e, t, n, r, i = "day") {
577
+ let a = r * n;
578
+ if (L(i)) {
579
+ let r = R(i), o = e.startOf("day"), s = e.diff(o, "millisecond"), c = Math.floor(s / r), l = o.add(c * r, "millisecond"), u = r / j / 2 * n, d = z(l, t, n) + u;
580
+ return d < 0 || d >= a ? null : d;
581
+ }
582
+ let o = z(e.startOf("day"), t.startOf("day"), n);
583
+ return o < 0 || o >= a ? null : o + n / 2;
584
+ }
585
+ //#endregion
586
+ //#region src/components/Gantt/msUntilNextDay.ts
587
+ function Ee(e) {
588
+ let t = B(e);
589
+ return t.add(1, "day").startOf("day").add(1, "millisecond").valueOf() - t.valueOf();
590
+ }
591
+ function De(e, t) {
592
+ if (t <= 0) return Ee(e);
593
+ let n = B(e), r = n.startOf("day"), i = n.valueOf() - r.valueOf(), a = Math.floor(i / t), o = r.valueOf() + (a + 1) * t + 1;
594
+ return Math.max(1, o - n.valueOf());
595
+ }
596
+ //#endregion
597
+ //#region src/components/Gantt/hooks/useTodayTracker.ts
598
+ function Oe(e, t = "day") {
599
+ let [n, r] = p(() => B(e)), i = f(e);
600
+ i.current = e;
601
+ let a = f(t);
602
+ a.current = t;
603
+ let o = s(() => B(i.current), []);
604
+ return l(() => {
605
+ let e, t = () => {
606
+ let n = a.current, s = i.current, c = L(n) ? De(s, R(n)) : Ee(s);
607
+ e = setTimeout(() => {
608
+ r(o()), t();
609
+ }, c);
610
+ };
611
+ r(o()), t();
612
+ let n = () => {
613
+ document.visibilityState === "visible" && (clearTimeout(e), r(o()), t());
614
+ };
615
+ return document.addEventListener("visibilitychange", n), () => {
616
+ clearTimeout(e), document.removeEventListener("visibilitychange", n);
617
+ };
618
+ }, [
619
+ o,
620
+ t,
621
+ e
622
+ ]), n;
623
+ }
624
+ //#endregion
625
+ //#region src/components/Gantt/StickyLabel.tsx
626
+ var ke = ({ cell: e }) => /* @__PURE__ */ g("div", {
627
+ className: x["bsy-mobile-gantt__sticky-label"],
628
+ style: { width: e.widthPx },
629
+ children: /* @__PURE__ */ g("div", {
630
+ className: x["bsy-mobile-gantt__sticky-label-text"],
631
+ children: e.label
632
+ })
633
+ }), Ae = 34, je = 8, Me = 5, Ne = () => {
634
+ let { t: e } = r(), { zoomLevel: t, pxPerDay: n, timeZone: i, startDate: a, count: o, totalWidth: s, totalDays: c } = w(), { horizontalScrollRef: l } = T(), u = Oe(i, t), f = d(() => U(a, o, t, u, e), [
635
+ a,
636
+ o,
637
+ t,
638
+ u,
639
+ e
640
+ ]), p = d(() => fe(f, t, n, e), [
641
+ f,
642
+ t,
643
+ n,
644
+ e
645
+ ]), m = d(() => Y(u, a, n, c, t), [
646
+ u,
647
+ a,
648
+ n,
649
+ c,
650
+ t
651
+ ]), h = d(() => f.map((e) => e.days * n), [f, n]), v = b({
652
+ count: f.length,
653
+ getScrollElement: () => l.current,
654
+ estimateSize: (e) => h[e],
655
+ horizontal: !0,
656
+ overscan: Me
657
+ });
658
+ return /* @__PURE__ */ _("div", {
659
+ className: x["bsy-mobile-gantt__header"],
660
+ style: { width: s },
661
+ children: [
662
+ /* @__PURE__ */ g("div", {
663
+ className: x["bsy-mobile-gantt__header-row1"],
664
+ children: p.map((e) => /* @__PURE__ */ g(ke, { cell: e }, `${e.label}-${e.startIndex}`))
665
+ }),
666
+ /* @__PURE__ */ g("div", {
667
+ className: x["bsy-mobile-gantt__header-row2"],
668
+ style: { height: Ae },
669
+ children: v.getVirtualItems().map((e) => {
670
+ let t = f[e.index], n = Math.round(e.start), r = Math.max(1, Math.round(e.size));
671
+ return /* @__PURE__ */ g("div", {
672
+ className: x["bsy-mobile-gantt__header-cell"],
673
+ style: {
674
+ left: n,
675
+ width: r,
676
+ height: "100%"
677
+ },
678
+ children: /* @__PURE__ */ g("div", {
679
+ className: J(x["bsy-mobile-gantt__header-cell-label"], t.isToday && x["bsy-mobile-gantt__header-cell-label--today"]),
680
+ style: { lineHeight: `${Ae}px` },
681
+ children: t.label
682
+ })
683
+ }, e.index);
684
+ })
685
+ }),
686
+ m === null ? null : /* @__PURE__ */ g("div", {
687
+ className: x["bsy-mobile-gantt__today-dot"],
688
+ style: { left: m - je / 2 }
689
+ })
690
+ ]
691
+ });
692
+ }, Pe = 2, Fe = ({ today: e, startDate: t, pxPerDay: n, totalDays: r, zoomLevel: i }) => {
693
+ let a = d(() => Y(e, t, n, r, i), [
694
+ e,
695
+ t,
696
+ n,
697
+ r,
698
+ i
699
+ ]);
700
+ return a === null ? null : /* @__PURE__ */ g("div", {
701
+ className: x["bsy-mobile-gantt__today-line"],
702
+ style: {
703
+ left: a - Pe / 2,
704
+ width: Pe
705
+ }
706
+ });
707
+ }, Ie = 26, Le = 6, X = 4;
708
+ function Re(e, t, n, r) {
709
+ let i = t - X * 2;
710
+ if (r > i) return {
711
+ mode: "outside",
712
+ left: t + Le,
713
+ maxWidth: null
714
+ };
715
+ if (e < n) {
716
+ let i = e + t - n;
717
+ return r + X > i ? {
718
+ mode: "outside",
719
+ left: t + Le,
720
+ maxWidth: null
721
+ } : {
722
+ mode: "sticky",
723
+ left: X,
724
+ maxWidth: i - X * 2
725
+ };
726
+ }
727
+ return {
728
+ mode: "inside",
729
+ left: X,
730
+ maxWidth: i
731
+ };
732
+ }
733
+ var ze = o(({ bar: e, top: t, horizontalScrollRef: n, onClick: r }) => {
734
+ let i = e.progress > 0 ? Math.max(4, e.width * e.progress) : 0, a = xe(e.bgColor), o = f(null), [s, c] = p(0);
735
+ return u(() => {
736
+ if (!o.current || !e.label) {
737
+ c(0);
738
+ return;
739
+ }
740
+ c(o.current.scrollWidth);
741
+ }, [e.label]), u(() => {
742
+ let t = o.current, r = n.current;
743
+ if (!t || !r || !e.label) return;
744
+ let i = () => {
745
+ let { scrollLeft: n } = r, i = Re(e.left, e.width, n, s), o = i.mode === "sticky", c = i.mode === "outside";
746
+ o ? t.style.transform = `translate3d(${n - e.left}px, -50%, 0)` : t.style.transform = "translate3d(0, -50%, 0)", t.style.left = `${i.left}px`, t.style.maxWidth = i.maxWidth === null ? "none" : `${Math.max(0, i.maxWidth)}px`, t.style.overflow = c ? "visible" : "hidden", t.style.textOverflow = c ? "clip" : "ellipsis", t.style.color = c ? "#000" : a;
747
+ };
748
+ return i(), r.addEventListener("scroll", i, { passive: !0 }), () => {
749
+ r.removeEventListener("scroll", i);
750
+ };
751
+ }, [
752
+ e.label,
753
+ e.left,
754
+ e.width,
755
+ n,
756
+ a,
757
+ s
758
+ ]), /* @__PURE__ */ _("div", {
759
+ className: x["bsy-mobile-gantt__bar"],
760
+ style: {
761
+ top: t,
762
+ left: e.left,
763
+ width: e.width,
764
+ height: Ie
765
+ },
766
+ onClick: () => r?.(e.task),
767
+ children: [
768
+ /* @__PURE__ */ g("div", {
769
+ className: x["bsy-mobile-gantt__bar-track"],
770
+ style: { backgroundColor: e.bgColor }
771
+ }),
772
+ i > 0 ? /* @__PURE__ */ g("div", {
773
+ className: x["bsy-mobile-gantt__bar-progress"],
774
+ style: {
775
+ width: i,
776
+ backgroundColor: e.color,
777
+ borderRadius: e.progress === 1 ? 4 : "4px 0 0 4px"
778
+ }
779
+ }) : null,
780
+ e.label ? /* @__PURE__ */ g("span", {
781
+ ref: o,
782
+ className: x["bsy-mobile-gantt__bar-label"],
783
+ style: {
784
+ left: X,
785
+ maxWidth: e.width - X * 2,
786
+ lineHeight: `${Ie}px`,
787
+ color: a
788
+ },
789
+ children: e.label
790
+ }) : null
791
+ ]
792
+ });
793
+ }), Z = o(({ direction: e, edge: t, offset: n, onClick: i }) => {
794
+ let { t: a } = r();
795
+ return /* @__PURE__ */ g("button", {
796
+ type: "button",
797
+ className: J(x["bsy-mobile-gantt__offscreen-arrow"], t === "right" && x["bsy-mobile-gantt__offscreen-arrow--right"]),
798
+ style: { [t]: n },
799
+ onClick: i,
800
+ "aria-label": a("gantt.locateTask"),
801
+ children: /* @__PURE__ */ g("svg", {
802
+ width: "16",
803
+ height: "16",
804
+ viewBox: "0 0 16 16",
805
+ "aria-hidden": "true",
806
+ children: e === "left" ? /* @__PURE__ */ g("path", {
807
+ d: "M10 12L6 8l4-4",
808
+ fill: "none",
809
+ stroke: "#666",
810
+ strokeWidth: "1.5"
811
+ }) : /* @__PURE__ */ g("path", {
812
+ d: "M6 4l4 4-4 4",
813
+ fill: "none",
814
+ stroke: "#666",
815
+ strokeWidth: "1.5"
816
+ })
817
+ })
818
+ });
819
+ }), Be = 24, Ve = 4, He = o(({ virtualRows: e, bars: t, horizontalScrollRef: n, viewportWidth: r, rowHeight: i, onNavigate: a }) => {
820
+ let [o, s] = p(() => n.current?.scrollLeft ?? 0), c = f(0);
821
+ l(() => {
822
+ let e = n.current;
823
+ if (!e) return;
824
+ let t = () => {
825
+ cancelAnimationFrame(c.current), c.current = requestAnimationFrame(() => {
826
+ s(e.scrollLeft);
827
+ });
828
+ };
829
+ return e.addEventListener("scroll", t, { passive: !0 }), s(e.scrollLeft), () => {
830
+ e.removeEventListener("scroll", t), cancelAnimationFrame(c.current);
831
+ };
832
+ }, [n]);
833
+ let u = o + r;
834
+ return /* @__PURE__ */ g("div", {
835
+ className: x["bsy-mobile-gantt__offscreen"],
836
+ children: /* @__PURE__ */ g("div", {
837
+ className: x["bsy-mobile-gantt__offscreen-layer"],
838
+ children: e.map((e) => {
839
+ let n = t[e.index];
840
+ if (!n || !n.hasTimeRange) return null;
841
+ let r = n.left + n.width < o, s = n.left > u;
842
+ return !r && !s ? null : /* @__PURE__ */ _("div", {
843
+ className: x["bsy-mobile-gantt__offscreen-row"],
844
+ style: {
845
+ top: e.start + (i - Be) / 2,
846
+ height: Be
847
+ },
848
+ children: [r ? /* @__PURE__ */ g(Z, {
849
+ direction: "left",
850
+ edge: "left",
851
+ offset: Ve,
852
+ onClick: () => a(n.startDate)
853
+ }) : null, s ? /* @__PURE__ */ g(Z, {
854
+ direction: "right",
855
+ edge: "right",
856
+ offset: Ve,
857
+ onClick: () => a(n.startDate)
858
+ }) : null]
859
+ }, `overlay-${n.id}`);
860
+ })
861
+ })
862
+ });
863
+ }), Ue = 5, We = 5, Q = 28, Ge = 4, Ke = ({ bars: e, onTaskClick: t, overlayHostRef: n }) => {
864
+ let { zoomLevel: r, pxPerDay: i, timeZone: a, startDate: o, count: s, totalWidth: c, totalDays: u, viewportWidth: v } = w(), { horizontalScrollRef: y, navigateToBar: S } = T(), C = Oe(a, r), E = d(() => U(o, s, r, C), [
865
+ o,
866
+ s,
867
+ r,
868
+ C
869
+ ]), D = e.length, O = Math.max(D * Q + Ge, 0), k = f(null), A = d(() => E.map((e) => e.days * i), [E, i]), j = b({
870
+ count: E.length,
871
+ getScrollElement: () => y.current,
872
+ estimateSize: (e) => A[e],
873
+ horizontal: !0,
874
+ overscan: Ue
875
+ }), M = b({
876
+ count: D,
877
+ getScrollElement: () => k.current,
878
+ estimateSize: () => Q,
879
+ paddingStart: Ge,
880
+ overscan: We
881
+ }).getVirtualItems(), [N, P] = p(null);
882
+ return l(() => {
883
+ P(n?.current ?? null);
884
+ }, [n]), l(() => {
885
+ let e = k.current, t = N;
886
+ if (!e || !t) return;
887
+ let n = 0, r = () => {
888
+ n ||= window.requestAnimationFrame(() => {
889
+ t.style.setProperty("--gantt-overlay-translate-y", `${-e.scrollTop}px`), n = 0;
890
+ });
891
+ };
892
+ return t.style.setProperty("--gantt-overlay-translate-y", `${-e.scrollTop}px`), e.addEventListener("scroll", r, { passive: !0 }), () => {
893
+ e.removeEventListener("scroll", r), n && window.cancelAnimationFrame(n);
894
+ };
895
+ }, [N]), /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("div", {
896
+ ref: k,
897
+ className: x["bsy-mobile-gantt__timeline"],
898
+ style: { width: c },
899
+ children: /* @__PURE__ */ _("div", {
900
+ className: x["bsy-mobile-gantt__timeline-inner"],
901
+ style: {
902
+ width: c,
903
+ height: O || "100%"
904
+ },
905
+ children: [
906
+ j.getVirtualItems().map((e) => /* @__PURE__ */ g("div", {
907
+ className: J(x["bsy-mobile-gantt__column"], r === "day" && E[e.index]?.isWeekend && x["bsy-mobile-gantt__column--weekend"]),
908
+ style: {
909
+ width: e.size,
910
+ transform: `translateX(${e.start}px)`
911
+ }
912
+ }, e.index)),
913
+ /* @__PURE__ */ g(Fe, {
914
+ today: C,
915
+ startDate: o,
916
+ pxPerDay: i,
917
+ totalDays: u,
918
+ zoomLevel: r
919
+ }),
920
+ M.map((n) => {
921
+ let r = e[n.index];
922
+ return !r || !r.hasTimeRange ? null : /* @__PURE__ */ g(ze, {
923
+ bar: r,
924
+ top: n.start,
925
+ horizontalScrollRef: y,
926
+ onClick: t
927
+ }, r.id);
928
+ })
929
+ ]
930
+ })
931
+ }), N ? m(/* @__PURE__ */ g(He, {
932
+ virtualRows: M,
933
+ bars: e,
934
+ horizontalScrollRef: y,
935
+ viewportWidth: v,
936
+ rowHeight: Q,
937
+ onNavigate: S
938
+ }), N) : null] });
939
+ }, $ = ({ direction: e }) => /* @__PURE__ */ g("svg", {
940
+ className: J(x["bsy-mobile-gantt__chevron"], e === "left" && x["bsy-mobile-gantt__chevron--left"], e === "right" && x["bsy-mobile-gantt__chevron--right"]),
941
+ width: "16",
942
+ height: "16",
943
+ viewBox: "0 0 16 16",
944
+ "aria-hidden": "true",
945
+ children: /* @__PURE__ */ g("path", {
946
+ d: "M4 6l4 4 4-4",
947
+ fill: "none",
948
+ stroke: "currentColor",
949
+ strokeWidth: "1.5"
950
+ })
951
+ }), qe = () => {
952
+ let { t } = r(), { zoomLevel: n, viewportWidth: i, totalWidth: a } = w(), { setZoomLevel: o, getScrollLeft: c, scrollToX: l, handleTodayClick: u } = T(), [d, f] = p(!1), m = s(() => {
953
+ l(Math.max(0, c() - i), "smooth");
954
+ }, [
955
+ c,
956
+ l,
957
+ i
958
+ ]), v = s(() => {
959
+ let e = Math.max(0, a - i);
960
+ l(Math.min(c() + i, e), "smooth");
961
+ }, [
962
+ c,
963
+ l,
964
+ i,
965
+ a
966
+ ]);
967
+ return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _("div", {
968
+ className: x["bsy-mobile-gantt__toolbar"],
969
+ children: [
970
+ /* @__PURE__ */ _("button", {
971
+ type: "button",
972
+ className: x["bsy-mobile-gantt__toolbar-zoom"],
973
+ onClick: () => f(!0),
974
+ children: [/* @__PURE__ */ g("span", { children: t(`gantt.zoom.${n}`) }), /* @__PURE__ */ g($, { direction: "down" })]
975
+ }),
976
+ /* @__PURE__ */ g("div", { className: x["bsy-mobile-gantt__toolbar-divider"] }),
977
+ /* @__PURE__ */ g("button", {
978
+ type: "button",
979
+ className: x["bsy-mobile-gantt__toolbar-today"],
980
+ onClick: u,
981
+ children: t("gantt.today")
982
+ }),
983
+ /* @__PURE__ */ g("button", {
984
+ type: "button",
985
+ className: x["bsy-mobile-gantt__toolbar-nav"],
986
+ onClick: m,
987
+ "aria-label": t("gantt.prevScreen"),
988
+ children: /* @__PURE__ */ g($, { direction: "left" })
989
+ }),
990
+ /* @__PURE__ */ g("button", {
991
+ type: "button",
992
+ className: x["bsy-mobile-gantt__toolbar-nav"],
993
+ onClick: v,
994
+ "aria-label": t("gantt.nextScreen"),
995
+ children: /* @__PURE__ */ g($, { direction: "right" })
996
+ })
997
+ ]
998
+ }), /* @__PURE__ */ g(e, {
999
+ open: d,
1000
+ onClose: () => f(!1),
1001
+ title: t("gantt.zoomSheetTitle"),
1002
+ actions: A.map((e) => ({
1003
+ key: e,
1004
+ text: t(`gantt.zoom.${e}`),
1005
+ selected: n === e
1006
+ })),
1007
+ onAction: (e) => {
1008
+ o(e.key), f(!1);
1009
+ }
1010
+ })] });
1011
+ }, Je = 88, Ye = (e) => {
1012
+ let { tasks: t = [], timeZone: n, className: r, onTaskClick: i } = e, [a, o] = v(e, {
1013
+ defaultValue: "day",
1014
+ defaultValuePropName: "defaultZoomLevel",
1015
+ valuePropName: "zoomLevel",
1016
+ trigger: "onZoomChange"
1017
+ }), s = f(null), c = me({
1018
+ timeZone: n,
1019
+ initialZoomLevel: a
1020
+ }), l = _e(c, { onZoomLevelChange: o }), u = d(() => Te(t, {
1021
+ startDate: c.startDate,
1022
+ pxPerDay: c.pxPerDay,
1023
+ zoomLevel: c.zoomLevel
1024
+ }, n), [
1025
+ t,
1026
+ c.startDate,
1027
+ c.pxPerDay,
1028
+ c.zoomLevel,
1029
+ n
1030
+ ]), p = d(() => ({
1031
+ zoomLevel: c.zoomLevel,
1032
+ pxPerDay: c.pxPerDay,
1033
+ timeZone: n,
1034
+ viewportWidth: c.viewportWidth,
1035
+ anchorDate: c.anchorDate,
1036
+ startDate: c.startDate,
1037
+ count: c.count,
1038
+ totalDays: c.totalDays,
1039
+ totalWidth: c.totalWidth
1040
+ }), [
1041
+ c.zoomLevel,
1042
+ c.pxPerDay,
1043
+ n,
1044
+ c.viewportWidth,
1045
+ c.anchorDate,
1046
+ c.startDate,
1047
+ c.count,
1048
+ c.totalDays,
1049
+ c.totalWidth
1050
+ ]), m = d(() => ({
1051
+ setZoomLevel: l.setZoomLevel,
1052
+ horizontalScrollRef: l.horizontalScrollRef,
1053
+ scrollToX: l.scrollToX,
1054
+ getScrollLeft: l.getScrollLeft,
1055
+ handleTodayClick: l.handleTodayClick,
1056
+ navigateToBar: l.navigateToBar
1057
+ }), [
1058
+ l.setZoomLevel,
1059
+ l.horizontalScrollRef,
1060
+ l.scrollToX,
1061
+ l.getScrollLeft,
1062
+ l.handleTodayClick,
1063
+ l.navigateToBar
1064
+ ]);
1065
+ return /* @__PURE__ */ g(S.Provider, {
1066
+ value: p,
1067
+ children: /* @__PURE__ */ g(C.Provider, {
1068
+ value: m,
1069
+ children: /* @__PURE__ */ _("div", {
1070
+ ref: c.containerRef,
1071
+ className: J(x["bsy-mobile-gantt"], r),
1072
+ children: [
1073
+ /* @__PURE__ */ g("div", {
1074
+ ref: l.horizontalScrollRef,
1075
+ className: x["bsy-mobile-gantt__scroll"],
1076
+ onScroll: l.handleHorizontalScroll,
1077
+ children: /* @__PURE__ */ _("div", {
1078
+ className: x["bsy-mobile-gantt__canvas"],
1079
+ style: { width: c.totalWidth },
1080
+ children: [/* @__PURE__ */ g(Ne, {}), /* @__PURE__ */ g(Ke, {
1081
+ bars: u,
1082
+ onTaskClick: i,
1083
+ overlayHostRef: s
1084
+ })]
1085
+ })
1086
+ }),
1087
+ /* @__PURE__ */ g("div", {
1088
+ ref: s,
1089
+ className: x["bsy-mobile-gantt__overlay-host"],
1090
+ style: { top: Je }
1091
+ }),
1092
+ /* @__PURE__ */ g(qe, {})
1093
+ ]
1094
+ })
1095
+ })
1096
+ });
1097
+ };
1098
+ //#endregion
1099
+ export { A as a, D as i, O as n, k as o, E as r, Ye as t };