@thebuoyant-tsdev/mui-ts-library 3.15.0 → 3.17.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.
@@ -1,17 +1,17 @@
1
- import { calculateTaskPosition as e, computeCriticalPath as t, getDaysInRange as n, getDisplayRange as r, getISOWeekNumber as i, getMonthsInRange as a, getQuartersInRange as o, getVisibleTasks as s, getWeeksInRange as c } from "./util/gantt-chart.util.js";
2
- import { useGanttDrag as l } from "./hooks/useGanttDrag.js";
3
- import { GanttTimelineHeader as u } from "./GanttTimelineHeader.js";
1
+ import { calculateTaskPosition as e, computeCriticalPath as t, filterByAssignee as n, getDaysInRange as r, getDisplayRange as i, getISOWeekNumber as a, getMonthsInRange as o, getQuartersInRange as s, getVisibleTasks as c, getWeeksInRange as l } from "./util/gantt-chart.util.js";
2
+ import { useGanttDrag as u } from "./hooks/useGanttDrag.js";
3
+ import { GanttTimelineHeader as ee } from "./GanttTimelineHeader.js";
4
4
  import { GanttBarRow as d } from "./GanttBarRow.js";
5
5
  import { GanttWeekendStrips as f } from "./GanttWeekendStrips.js";
6
6
  import { GanttStatusContextMenu as p } from "./GanttStatusContextMenu.js";
7
7
  import { GanttDependencyArrows as m } from "./GanttDependencyArrows.js";
8
- import { useGanttChartStore as h, useGanttTheme as ee, useGanttTranslations as te, useRawGanttChartStore as ne } from "./GanttChart.js";
9
- import { useEffect as re, useId as ie, useMemo as g, useRef as _, useState as ae } from "react";
10
- import { Box as v, useTheme as oe } from "@mui/material";
11
- import { Fragment as se, jsx as y, jsxs as ce } from "react/jsx-runtime";
12
- import { useVirtualizer as le } from "@tanstack/react-virtual";
8
+ import { useGanttChartStore as h, useGanttTheme as te, useGanttTranslations as ne, useRawGanttChartStore as re } from "./GanttChart.js";
9
+ import { useEffect as ie, useId as ae, useMemo as g, useRef as _, useState as oe } from "react";
10
+ import { Box as v, useTheme as se } from "@mui/material";
11
+ import { Fragment as ce, jsx as y, jsxs as le } from "react/jsx-runtime";
12
+ import { useVirtualizer as ue } from "@tanstack/react-virtual";
13
13
  //#region src/components/gantt-chart/GanttTimeline.tsx
14
- function ue(t, n, r) {
14
+ function de(t, n, r) {
15
15
  if (r === 0) return [];
16
16
  let i = [], a = new Map(t.map((e, t) => [e.id, t]));
17
17
  for (let o of t) {
@@ -20,30 +20,37 @@ function ue(t, n, r) {
20
20
  for (let s of o.dependencies) {
21
21
  let u = a.get(s);
22
22
  if (u === void 0) continue;
23
- let d = t[u], f = e(d, n), p = (f.left + f.width) / 100 * r, m = u * 40 + 40 / 2, h;
24
- h = c >= p + 48 ? (p + c) / 2 : p + 24 <= r - 8 ? p + 24 : Math.max(c - 24, 8), i.push({
23
+ let ee = t[u], d = e(ee, n), f = (d.left + d.width) / 100 * r, p = u * 40 + 40 / 2, m;
24
+ m = c >= f + 48 ? (f + c) / 2 : f + 24 <= r - 8 ? f + 24 : Math.max(c - 24, 8), i.push({
25
25
  key: `${s}-${o.id}`,
26
- d: `M ${p} ${m} H ${h} V ${l} H ${c}`
26
+ d: `M ${f} ${p} H ${m} V ${l} H ${c}`
27
27
  });
28
28
  }
29
29
  }
30
30
  return i;
31
31
  }
32
- function b({ scrollRef: e, onScroll: b, onTaskClick: x, onMilestoneClick: S, draggable: C = !1, resizable: w = !1, progressDraggable: T = !1, showCriticalPath: E = !1, virtualizeRows: de = !1, onTaskMoved: fe, onTaskResized: pe, onTasksChange: D, onStatusChange: O }) {
33
- let k = h((e) => e.taskTree), A = h((e) => e.tasks), j = h((e) => e.expandedIds), M = h((e) => e.timelineRange), N = h((e) => e.timeScale), me = h((e) => e.updateTask), P = ne(), F = te(), he = oe(), { todayLineColor: ge } = ee(), _e = `gantt-arrow-${ie().replace(/:/g, "")}`, I = g(() => s(k, j), [k, j]), L = g(() => r(M, N), [M, N]), R = g(() => N === "days" ? n(L).map((e) => ({
32
+ function b({ scrollRef: e, onScroll: b, onTaskClick: x, onMilestoneClick: S, draggable: C = !1, resizable: w = !1, progressDraggable: T = !1, showCriticalPath: E = !1, virtualizeRows: fe = !1, onDragStart: pe, onTaskMoved: me, onTaskResized: he, onTasksChange: D, onStatusChange: O }) {
33
+ let k = h((e) => e.taskTree), A = h((e) => e.tasks), j = h((e) => e.expandedIds), M = h((e) => e.timelineRange), N = h((e) => e.timeScale), ge = h((e) => e.updateTask), P = re(), F = ne(), _e = se(), { todayLineColor: ve } = te(), ye = `gantt-arrow-${ae().replace(/:/g, "")}`, I = h((e) => e.assigneeFilter), L = g(() => {
34
+ let e = c(k, j);
35
+ return I ? n(e, I) : e;
36
+ }, [
37
+ k,
38
+ j,
39
+ I
40
+ ]), R = g(() => i(M, N), [M, N]), z = g(() => N === "days" ? r(R).map((e) => ({
34
41
  key: e.toISOString(),
35
42
  label: String(e.getDate()),
36
43
  width: 20,
37
44
  isWeekend: e.getDay() === 0 || e.getDay() === 6
38
- })) : N === "weeks" ? c(L).map((e) => ({
45
+ })) : N === "weeks" ? l(R).map((e) => ({
39
46
  key: e.toISOString(),
40
- label: `${F.weekColumnPrefix}${i(e)}`,
47
+ label: `${F.weekColumnPrefix}${a(e)}`,
41
48
  width: 40
42
- })) : N === "quarters" ? o(L).map((e) => ({
49
+ })) : N === "quarters" ? s(R).map((e) => ({
43
50
  key: e.key,
44
51
  label: e.label,
45
52
  width: 360
46
- })) : a(L).map((e) => ({
53
+ })) : o(R).map((e) => ({
47
54
  key: e.toISOString(),
48
55
  label: e.toLocaleString(F.dateLocale, {
49
56
  month: "short",
@@ -52,13 +59,13 @@ function b({ scrollRef: e, onScroll: b, onTaskClick: x, onMilestoneClick: S, dra
52
59
  width: 120
53
60
  })), [
54
61
  N,
55
- L,
62
+ R,
56
63
  F.weekColumnPrefix,
57
64
  F.dateLocale
58
- ]), z = g(() => R.reduce((e, t) => e + t.width, 0), [R]), B = g(() => {
65
+ ]), B = g(() => z.reduce((e, t) => e + t.width, 0), [z]), V = g(() => {
59
66
  if (N !== "days") return;
60
67
  let e = /* @__PURE__ */ new Map();
61
- for (let t of R) {
68
+ for (let t of z) {
62
69
  let n = new Date(t.key), r = `${n.getFullYear()}-${n.getMonth()}`;
63
70
  e.has(r) || e.set(r, {
64
71
  label: n.toLocaleString(F.dateLocale, {
@@ -74,49 +81,50 @@ function b({ scrollRef: e, onScroll: b, onTaskClick: x, onMilestoneClick: S, dra
74
81
  }));
75
82
  }, [
76
83
  N,
77
- R,
84
+ z,
78
85
  F.dateLocale
79
- ]), ve = g(() => ue(I, L, z), [
80
- I,
86
+ ]), be = g(() => de(L, R, B), [
81
87
  L,
82
- z
83
- ]), V = g(() => E ? t(A) : /* @__PURE__ */ new Set(), [E, A]), H = le({
84
- count: I.length,
88
+ R,
89
+ B
90
+ ]), H = g(() => E ? t(A) : /* @__PURE__ */ new Set(), [E, A]), U = ue({
91
+ count: L.length,
85
92
  getScrollElement: () => e.current,
86
93
  estimateSize: () => 40,
87
94
  overscan: 5
88
- }), ye = g(() => {
95
+ }), xe = g(() => {
89
96
  if (N !== "days") return [];
90
97
  let e = 0;
91
- return R.flatMap((t) => {
98
+ return z.flatMap((t) => {
92
99
  let n = t.isWeekend ? [{
93
100
  key: t.key,
94
101
  left: e
95
102
  }] : [];
96
103
  return e += t.width, n;
97
104
  });
98
- }, [N, R]), U = g(() => {
99
- let e = Date.now(), t = L.start.getTime(), n = L.end.getTime();
100
- return e < t || e > n ? null : (e - t) / (n - t) * z;
101
- }, [L, z]), be = g(() => (/* @__PURE__ */ new Date()).toLocaleDateString(F.dateLocale, {
105
+ }, [N, z]), W = g(() => {
106
+ let e = Date.now(), t = R.start.getTime(), n = R.end.getTime();
107
+ return e < t || e > n ? null : (e - t) / (n - t) * B;
108
+ }, [R, B]), Se = g(() => (/* @__PURE__ */ new Date()).toLocaleDateString(F.dateLocale, {
102
109
  weekday: "long",
103
110
  day: "numeric",
104
111
  month: "long",
105
112
  year: "numeric"
106
- }), [F.dateLocale]), xe = ge || he.palette.primary.main;
107
- re(() => {
108
- if (U === null || !e.current) return;
113
+ }), [F.dateLocale]), Ce = ve || _e.palette.primary.main;
114
+ ie(() => {
115
+ if (W === null || !e.current) return;
109
116
  let t = e.current.clientWidth;
110
- e.current.scrollLeft = Math.max(0, U - t / 2);
117
+ e.current.scrollLeft = Math.max(0, W - t / 2);
111
118
  }, []);
112
- let W = N === "days" ? 20 : N === "weeks" ? 40 : N === "quarters" ? 360 : 120, G = B ? 80 : 40, { activeDrag: K, suppressClickRef: q, handleBarMouseDown: J, handleProgressMouseDown: Y, formatDragDate: X } = l({
113
- totalWidth: z,
114
- displayRange: L,
115
- onTaskMoved: fe,
116
- onTaskResized: pe,
119
+ let G = N === "days" ? 20 : N === "weeks" ? 40 : N === "quarters" ? 360 : 120, K = V ? 80 : 40, { activeDrag: q, suppressClickRef: J, handleBarMouseDown: Y, handleProgressMouseDown: X, formatDragDate: Z } = u({
120
+ totalWidth: B,
121
+ displayRange: R,
122
+ onDragStart: pe,
123
+ onTaskMoved: me,
124
+ onTaskResized: he,
117
125
  onTasksChange: D
118
- }), [Se, Z] = ae(null), Q = _(O);
119
- Q.current = O;
126
+ }), [we, Q] = oe(null), Te = _(O);
127
+ Te.current = O;
120
128
  let $ = _(D);
121
129
  return $.current = D, /* @__PURE__ */ y(v, {
122
130
  ref: e,
@@ -126,94 +134,94 @@ function b({ scrollRef: e, onScroll: b, onTaskClick: x, onMilestoneClick: S, dra
126
134
  flex: 1,
127
135
  overflow: "auto"
128
136
  },
129
- children: /* @__PURE__ */ ce(v, {
137
+ children: /* @__PURE__ */ le(v, {
130
138
  sx: {
131
- minWidth: z,
139
+ minWidth: B,
132
140
  position: "relative"
133
141
  },
134
142
  children: [
135
- /* @__PURE__ */ y(u, {
136
- columns: R,
137
- groups: B,
138
- todayX: U,
143
+ /* @__PURE__ */ y(ee, {
144
+ columns: z,
145
+ groups: V,
146
+ todayX: W,
139
147
  todayLabel: F.todayLabel,
140
- todayTooltip: be,
141
- todayColor: xe
148
+ todayTooltip: Se,
149
+ todayColor: Ce
142
150
  }),
143
151
  /* @__PURE__ */ y(f, {
144
- strips: ye,
145
- totalWidth: z,
146
- height: I.length * 40,
147
- top: G
152
+ strips: xe,
153
+ totalWidth: B,
154
+ height: L.length * 40,
155
+ top: K
148
156
  }),
149
- de ? /* @__PURE__ */ y(v, {
157
+ fe ? /* @__PURE__ */ y(v, {
150
158
  sx: {
151
159
  position: "relative",
152
- height: H.getTotalSize()
160
+ height: U.getTotalSize()
153
161
  },
154
- children: H.getVirtualItems().map((e) => /* @__PURE__ */ y(d, {
155
- task: I[e.index],
162
+ children: U.getVirtualItems().map((e) => /* @__PURE__ */ y(d, {
163
+ task: L[e.index],
156
164
  virtualTop: e.start,
157
- activeDrag: K,
158
- displayRange: L,
159
- totalWidth: z,
160
- gridColumnWidth: W,
161
- criticalTaskIds: V,
165
+ activeDrag: q,
166
+ displayRange: R,
167
+ totalWidth: B,
168
+ gridColumnWidth: G,
169
+ criticalTaskIds: H,
162
170
  draggable: C,
163
171
  resizable: w,
164
172
  progressDraggable: T,
165
173
  onTaskClick: x,
166
174
  onMilestoneClick: S,
167
- onContextMenu: (e, t, n) => Z({
175
+ onContextMenu: (e, t, n) => Q({
168
176
  task: e,
169
177
  mouseX: t,
170
178
  mouseY: n
171
179
  }),
172
- suppressClickRef: q,
173
- handleBarMouseDown: J,
174
- handleProgressMouseDown: Y,
175
- formatDragDate: X
180
+ suppressClickRef: J,
181
+ handleBarMouseDown: Y,
182
+ handleProgressMouseDown: X,
183
+ formatDragDate: Z
176
184
  }, e.key))
177
- }) : /* @__PURE__ */ y(se, { children: I.map((e) => /* @__PURE__ */ y(d, {
185
+ }) : /* @__PURE__ */ y(ce, { children: L.map((e) => /* @__PURE__ */ y(d, {
178
186
  task: e,
179
- activeDrag: K,
180
- displayRange: L,
181
- totalWidth: z,
182
- gridColumnWidth: W,
183
- criticalTaskIds: V,
187
+ activeDrag: q,
188
+ displayRange: R,
189
+ totalWidth: B,
190
+ gridColumnWidth: G,
191
+ criticalTaskIds: H,
184
192
  draggable: C,
185
193
  resizable: w,
186
194
  progressDraggable: T,
187
195
  onTaskClick: x,
188
196
  onMilestoneClick: S,
189
- onContextMenu: (e, t, n) => Z({
197
+ onContextMenu: (e, t, n) => Q({
190
198
  task: e,
191
199
  mouseX: t,
192
200
  mouseY: n
193
201
  }),
194
- suppressClickRef: q,
195
- handleBarMouseDown: J,
196
- handleProgressMouseDown: Y,
197
- formatDragDate: X
202
+ suppressClickRef: J,
203
+ handleBarMouseDown: Y,
204
+ handleProgressMouseDown: X,
205
+ formatDragDate: Z
198
206
  }, e.id)) }),
199
207
  /* @__PURE__ */ y(p, {
200
- contextMenu: Se,
201
- onClose: () => Z(null),
208
+ contextMenu: we,
209
+ onClose: () => Q(null),
202
210
  onSelect: (e, t) => {
203
211
  let n = P.getState().tasks.find((t) => t.id === e.id) ?? e;
204
- me({
212
+ ge({
205
213
  ...n,
206
214
  status: t
207
- }), Q.current?.(n, t), $.current?.(P.getState().tasks), Z(null);
215
+ }), Te.current?.(n, t), $.current?.(P.getState().tasks), Q(null);
208
216
  }
209
217
  }),
210
218
  /* @__PURE__ */ y(m, {
211
- dependencyLines: ve,
212
- todayX: U,
213
- totalWidth: z,
214
- height: I.length * 40,
215
- top: G,
216
- arrowMarkerId: _e
219
+ dependencyLines: be,
220
+ todayX: W,
221
+ totalWidth: B,
222
+ height: L.length * 40,
223
+ top: K,
224
+ arrowMarkerId: ye
217
225
  })
218
226
  ]
219
227
  })
@@ -1,34 +1,34 @@
1
1
  import { useGanttChartStore as e, useGanttTranslations as t } from "./GanttChart.js";
2
2
  import { useMemo as n } from "react";
3
- import { Box as r, IconButton as i, TextField as a, ToggleButton as o, ToggleButtonGroup as s, Tooltip as c } from "@mui/material";
4
- import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
5
- import f from "@mui/icons-material/Download";
6
- import p from "@mui/icons-material/RestartAlt";
7
- import m from "@mui/icons-material/Restore";
8
- import h from "@mui/icons-material/Today";
9
- import g from "@mui/icons-material/UnfoldLess";
10
- import _ from "@mui/icons-material/UnfoldMore";
3
+ import { Box as r, FormControl as i, IconButton as a, InputLabel as o, MenuItem as s, Select as c, TextField as l, ToggleButton as u, ToggleButtonGroup as d, Tooltip as f } from "@mui/material";
4
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
5
+ import g from "@mui/icons-material/Download";
6
+ import _ from "@mui/icons-material/RestartAlt";
7
+ import v from "@mui/icons-material/Restore";
8
+ import y from "@mui/icons-material/Today";
9
+ import b from "@mui/icons-material/UnfoldLess";
10
+ import x from "@mui/icons-material/UnfoldMore";
11
11
  //#region src/components/gantt-chart/GanttToolbar.tsx
12
- function v(e) {
12
+ function S(e) {
13
13
  return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
14
14
  }
15
- function y(e) {
15
+ function C(e) {
16
16
  let [t, n, r] = e.split("-").map(Number);
17
17
  return !t || !n || !r ? null : new Date(t, n - 1, r, 0, 0, 0, 0);
18
18
  }
19
- function b({ onScrollToToday: b, config: x, onExportCSV: S }) {
20
- let C = t(), w = e((e) => e.timeScale), T = e((e) => e.defaultTimeScale), E = e((e) => e.setTimeScale), D = e((e) => e.timelineRange), O = e((e) => e.isRangeCustomized), k = e((e) => e.isExpandedCustomized), A = e((e) => e.setTimelineRange), j = e((e) => e.resetTimelineRange), M = e((e) => e.resetView), N = e((e) => e.tasks), P = e((e) => e.expandedIds), F = e((e) => e.expandAll), I = e((e) => e.collapseAll), L = N.length > 0 && N.every((e) => P.has(e.id)), R = w !== T || O || k, z = n(() => Date.now(), []), B = z >= D.start.getTime() && z <= D.end.getTime(), V = {
21
- days: C.scaleDays,
22
- weeks: C.scaleWeeks,
23
- months: C.scaleMonths,
24
- quarters: C.scaleQuarters
25
- }, H = {
26
- days: x.showScaleDays,
27
- weeks: x.showScaleWeeks,
28
- months: x.showScaleMonths,
29
- quarters: x.showScaleQuarters
30
- }, U = Object.keys(V).filter((e) => H[e]);
31
- return /* @__PURE__ */ d(r, {
19
+ function w({ onScrollToToday: w, config: T, onExportCSV: E }) {
20
+ let D = t(), O = e((e) => e.timeScale), k = e((e) => e.defaultTimeScale), A = e((e) => e.setTimeScale), j = e((e) => e.timelineRange), M = e((e) => e.isRangeCustomized), N = e((e) => e.isExpandedCustomized), P = e((e) => e.setTimelineRange), F = e((e) => e.resetTimelineRange), I = e((e) => e.resetView), L = e((e) => e.tasks), R = e((e) => e.expandedIds), z = e((e) => e.expandAll), B = e((e) => e.collapseAll), V = e((e) => e.assigneeFilter), H = e((e) => e.setAssigneeFilter), U = n(() => [...new Set(L.flatMap((e) => e.assignee ? [e.assignee] : []))].sort(), [L]), W = L.length > 0 && L.every((e) => R.has(e.id)), G = O !== k || M || N, K = n(() => Date.now(), []), q = K >= j.start.getTime() && K <= j.end.getTime(), J = {
21
+ days: D.scaleDays,
22
+ weeks: D.scaleWeeks,
23
+ months: D.scaleMonths,
24
+ quarters: D.scaleQuarters
25
+ }, Y = {
26
+ days: T.showScaleDays,
27
+ weeks: T.showScaleWeeks,
28
+ months: T.showScaleMonths,
29
+ quarters: T.showScaleQuarters
30
+ }, X = Object.keys(J).filter((e) => Y[e]);
31
+ return /* @__PURE__ */ h(r, {
32
32
  "data-testid": "gantt-toolbar",
33
33
  sx: {
34
34
  display: "flex",
@@ -41,117 +41,141 @@ function b({ onScrollToToday: b, config: x, onExportCSV: S }) {
41
41
  borderColor: "divider",
42
42
  bgcolor: "background.paper"
43
43
  },
44
- children: [U.length > 0 && /* @__PURE__ */ u(s, {
45
- value: w,
46
- exclusive: !0,
47
- onChange: (e, t) => {
48
- t && E(t);
49
- },
50
- size: "small",
51
- "aria-label": C.scaleMonths,
52
- children: U.map((e) => /* @__PURE__ */ u(o, {
53
- value: e,
54
- "data-testid": `gantt-scale-${e}`,
55
- children: V[e]
56
- }, e))
57
- }), /* @__PURE__ */ d(r, {
58
- sx: {
59
- ml: "auto",
60
- display: "flex",
61
- alignItems: "center",
62
- gap: 1
63
- },
64
- children: [
65
- x.showExpandCollapseAll && /* @__PURE__ */ u(c, {
66
- title: L ? C.collapseAllTooltip : C.expandAllTooltip,
67
- children: /* @__PURE__ */ u(i, {
44
+ children: [
45
+ X.length > 0 && /* @__PURE__ */ m(d, {
46
+ value: O,
47
+ exclusive: !0,
48
+ onChange: (e, t) => {
49
+ t && A(t);
50
+ },
51
+ size: "small",
52
+ "aria-label": D.scaleMonths,
53
+ children: X.map((e) => /* @__PURE__ */ m(u, {
54
+ value: e,
55
+ "data-testid": `gantt-scale-${e}`,
56
+ children: J[e]
57
+ }, e))
58
+ }),
59
+ T.showAssigneeFilter && U.length > 0 && /* @__PURE__ */ h(i, {
60
+ size: "small",
61
+ sx: { minWidth: 140 },
62
+ children: [/* @__PURE__ */ m(o, {
63
+ id: "gantt-assignee-filter-label",
64
+ children: D.filterAssigneeLabel ?? "Assignee"
65
+ }), /* @__PURE__ */ h(c, {
66
+ labelId: "gantt-assignee-filter-label",
67
+ value: V,
68
+ label: D.filterAssigneeLabel ?? "Assignee",
69
+ onChange: (e) => H(e.target.value),
70
+ inputProps: { "data-testid": "gantt-assignee-filter" },
71
+ children: [/* @__PURE__ */ m(s, {
72
+ value: "",
73
+ children: D.filterAssigneeAll ?? "Alle"
74
+ }), U.map((e) => /* @__PURE__ */ m(s, {
75
+ value: e,
76
+ children: e
77
+ }, e))]
78
+ })]
79
+ }),
80
+ /* @__PURE__ */ h(r, {
81
+ sx: {
82
+ ml: "auto",
83
+ display: "flex",
84
+ alignItems: "center",
85
+ gap: 1
86
+ },
87
+ children: [
88
+ T.showExpandCollapseAll && /* @__PURE__ */ m(f, {
89
+ title: W ? D.collapseAllTooltip : D.expandAllTooltip,
90
+ children: /* @__PURE__ */ m(a, {
91
+ size: "small",
92
+ onClick: W ? B : z,
93
+ "aria-label": W ? D.collapseAllTooltip : D.expandAllTooltip,
94
+ "data-testid": "gantt-expand-collapse-all",
95
+ children: m(W ? b : x, { fontSize: "small" })
96
+ })
97
+ }),
98
+ T.showScrollToToday && w && /* @__PURE__ */ m(f, {
99
+ title: D.scrollToTodayTooltip,
100
+ children: /* @__PURE__ */ m("span", { children: /* @__PURE__ */ m(a, {
101
+ size: "small",
102
+ onClick: w,
103
+ disabled: !q,
104
+ "aria-label": D.scrollToTodayTooltip,
105
+ "data-testid": "gantt-scroll-to-today",
106
+ children: /* @__PURE__ */ m(y, { fontSize: "small" })
107
+ }) })
108
+ }),
109
+ T.showDateRange && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(l, {
110
+ type: "date",
68
111
  size: "small",
69
- onClick: L ? I : F,
70
- "aria-label": L ? C.collapseAllTooltip : C.expandAllTooltip,
71
- "data-testid": "gantt-expand-collapse-all",
72
- children: u(L ? g : _, { fontSize: "small" })
73
- })
74
- }),
75
- x.showScrollToToday && b && /* @__PURE__ */ u(c, {
76
- title: C.scrollToTodayTooltip,
77
- children: /* @__PURE__ */ u("span", { children: /* @__PURE__ */ u(i, {
78
- size: "small",
79
- onClick: b,
80
- disabled: !B,
81
- "aria-label": C.scrollToTodayTooltip,
82
- "data-testid": "gantt-scroll-to-today",
83
- children: /* @__PURE__ */ u(h, { fontSize: "small" })
84
- }) })
85
- }),
86
- x.showDateRange && /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(a, {
87
- type: "date",
88
- size: "small",
89
- label: C.rangeFrom,
90
- value: v(D.start),
91
- onChange: (e) => {
92
- let t = y(e.target.value);
93
- t && A({
94
- start: t,
95
- end: D.end
96
- });
97
- },
98
- slotProps: {
99
- inputLabel: { shrink: !0 },
100
- htmlInput: { "data-testid": "gantt-range-start" }
101
- },
102
- sx: { width: 148 }
103
- }), /* @__PURE__ */ u(a, {
104
- type: "date",
105
- size: "small",
106
- label: C.rangeTo,
107
- value: v(D.end),
108
- onChange: (e) => {
109
- let t = y(e.target.value);
110
- t && A({
111
- start: D.start,
112
- end: t
113
- });
114
- },
115
- slotProps: {
116
- inputLabel: { shrink: !0 },
117
- htmlInput: { "data-testid": "gantt-range-end" }
118
- },
119
- sx: { width: 148 }
120
- })] }),
121
- x.showRangeReset && O && /* @__PURE__ */ u(c, {
122
- title: C.rangeResetTooltip,
123
- children: /* @__PURE__ */ u(i, {
112
+ label: D.rangeFrom,
113
+ value: S(j.start),
114
+ onChange: (e) => {
115
+ let t = C(e.target.value);
116
+ t && P({
117
+ start: t,
118
+ end: j.end
119
+ });
120
+ },
121
+ slotProps: {
122
+ inputLabel: { shrink: !0 },
123
+ htmlInput: { "data-testid": "gantt-range-start" }
124
+ },
125
+ sx: { width: 148 }
126
+ }), /* @__PURE__ */ m(l, {
127
+ type: "date",
124
128
  size: "small",
125
- onClick: j,
126
- "aria-label": C.rangeResetTooltip,
127
- "data-testid": "gantt-range-reset",
128
- children: /* @__PURE__ */ u(m, { fontSize: "small" })
129
+ label: D.rangeTo,
130
+ value: S(j.end),
131
+ onChange: (e) => {
132
+ let t = C(e.target.value);
133
+ t && P({
134
+ start: j.start,
135
+ end: t
136
+ });
137
+ },
138
+ slotProps: {
139
+ inputLabel: { shrink: !0 },
140
+ htmlInput: { "data-testid": "gantt-range-end" }
141
+ },
142
+ sx: { width: 148 }
143
+ })] }),
144
+ T.showRangeReset && M && /* @__PURE__ */ m(f, {
145
+ title: D.rangeResetTooltip,
146
+ children: /* @__PURE__ */ m(a, {
147
+ size: "small",
148
+ onClick: F,
149
+ "aria-label": D.rangeResetTooltip,
150
+ "data-testid": "gantt-range-reset",
151
+ children: /* @__PURE__ */ m(v, { fontSize: "small" })
152
+ })
153
+ }),
154
+ T.showExportCSV && E && /* @__PURE__ */ m(f, {
155
+ title: D.exportCsvTooltip,
156
+ children: /* @__PURE__ */ m(a, {
157
+ size: "small",
158
+ onClick: E,
159
+ "aria-label": D.exportCsvTooltip,
160
+ "data-testid": "gantt-export-csv",
161
+ children: /* @__PURE__ */ m(g, { fontSize: "small" })
162
+ })
163
+ }),
164
+ T.showResetView && /* @__PURE__ */ m(f, {
165
+ title: D.resetViewTooltip,
166
+ children: /* @__PURE__ */ m("span", { children: /* @__PURE__ */ m(a, {
167
+ size: "small",
168
+ onClick: I,
169
+ disabled: !G,
170
+ "aria-label": D.resetViewTooltip,
171
+ "data-testid": "gantt-reset-view",
172
+ children: /* @__PURE__ */ m(_, { fontSize: "small" })
173
+ }) })
129
174
  })
130
- }),
131
- x.showExportCSV && S && /* @__PURE__ */ u(c, {
132
- title: C.exportCsvTooltip,
133
- children: /* @__PURE__ */ u(i, {
134
- size: "small",
135
- onClick: S,
136
- "aria-label": C.exportCsvTooltip,
137
- "data-testid": "gantt-export-csv",
138
- children: /* @__PURE__ */ u(f, { fontSize: "small" })
139
- })
140
- }),
141
- x.showResetView && /* @__PURE__ */ u(c, {
142
- title: C.resetViewTooltip,
143
- children: /* @__PURE__ */ u("span", { children: /* @__PURE__ */ u(i, {
144
- size: "small",
145
- onClick: M,
146
- disabled: !R,
147
- "aria-label": C.resetViewTooltip,
148
- "data-testid": "gantt-reset-view",
149
- children: /* @__PURE__ */ u(p, { fontSize: "small" })
150
- }) })
151
- })
152
- ]
153
- })]
175
+ ]
176
+ })
177
+ ]
154
178
  });
155
179
  }
156
180
  //#endregion
157
- export { b as GanttToolbar };
181
+ export { w as GanttToolbar };
@@ -29,6 +29,7 @@ export type ActiveDrag = {
29
29
  type UseGanttDragOptions = {
30
30
  totalWidth: number;
31
31
  displayRange: TimelineRange;
32
+ onDragStart?: (task: GanttTask, type: "move" | "resize") => void;
32
33
  onTaskMoved?: (task: GanttTask, newStart: Date, newEnd: Date) => void;
33
34
  onTaskResized?: (task: GanttTask, newEnd: Date) => void;
34
35
  onTasksChange?: (tasks: GanttTask[]) => void;
@@ -40,5 +41,5 @@ type UseGanttDragReturn = {
40
41
  handleProgressMouseDown: (e: React.MouseEvent, task: GanttTaskNode, initialProgress: number, barWidthPx: number) => void;
41
42
  formatDragDate: (d: Date) => string;
42
43
  };
43
- export declare function useGanttDrag({ totalWidth, displayRange, onTaskMoved, onTaskResized, onTasksChange, }: UseGanttDragOptions): UseGanttDragReturn;
44
+ export declare function useGanttDrag({ totalWidth, displayRange, onDragStart, onTaskMoved, onTaskResized, onTasksChange, }: UseGanttDragOptions): UseGanttDragReturn;
44
45
  export {};