@thebuoyant-tsdev/mui-ts-library 3.16.0 → 3.17.1
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/README.de.md +15 -0
- package/README.md +15 -0
- package/dist/components/gantt-chart/GanttChart.d.ts +1 -1
- package/dist/components/gantt-chart/GanttChart.js +36 -33
- package/dist/components/gantt-chart/GanttChart.store.d.ts +2 -0
- package/dist/components/gantt-chart/GanttChart.store.js +3 -0
- package/dist/components/gantt-chart/GanttChart.types.d.ts +13 -0
- package/dist/components/gantt-chart/GanttChart.types.js +2 -0
- package/dist/components/gantt-chart/GanttTaskPanel.js +131 -124
- package/dist/components/gantt-chart/GanttTimeline.d.ts +2 -1
- package/dist/components/gantt-chart/GanttTimeline.js +99 -91
- package/dist/components/gantt-chart/GanttToolbar.js +155 -131
- package/dist/components/gantt-chart/hooks/useGanttDrag.d.ts +2 -1
- package/dist/components/gantt-chart/hooks/useGanttDrag.js +35 -35
- package/dist/components/gantt-chart/util/gantt-chart.util.d.ts +5 -0
- package/dist/components/gantt-chart/util/gantt-chart.util.js +36 -30
- package/dist/index.cjs +2 -2
- package/package.json +1 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { calculateTaskPosition as e, computeCriticalPath as t,
|
|
2
|
-
import { useGanttDrag as
|
|
3
|
-
import { GanttTimelineHeader as
|
|
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
|
|
9
|
-
import { useEffect as
|
|
10
|
-
import { Box as v, useTheme as
|
|
11
|
-
import { Fragment as
|
|
12
|
-
import { useVirtualizer as
|
|
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
|
|
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
|
|
24
|
-
|
|
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 ${
|
|
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:
|
|
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),
|
|
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" ?
|
|
45
|
+
})) : N === "weeks" ? l(R).map((e) => ({
|
|
39
46
|
key: e.toISOString(),
|
|
40
|
-
label: `${F.weekColumnPrefix}${
|
|
47
|
+
label: `${F.weekColumnPrefix}${a(e)}`,
|
|
41
48
|
width: 40
|
|
42
|
-
})) : N === "quarters" ?
|
|
49
|
+
})) : N === "quarters" ? s(R).map((e) => ({
|
|
43
50
|
key: e.key,
|
|
44
51
|
label: e.label,
|
|
45
52
|
width: 360
|
|
46
|
-
})) :
|
|
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
|
-
|
|
62
|
+
R,
|
|
56
63
|
F.weekColumnPrefix,
|
|
57
64
|
F.dateLocale
|
|
58
|
-
]),
|
|
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
|
|
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
|
-
|
|
84
|
+
z,
|
|
78
85
|
F.dateLocale
|
|
79
|
-
]),
|
|
80
|
-
I,
|
|
86
|
+
]), be = g(() => de(L, R, B), [
|
|
81
87
|
L,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
-
}),
|
|
95
|
+
}), xe = g(() => {
|
|
89
96
|
if (N !== "days") return [];
|
|
90
97
|
let e = 0;
|
|
91
|
-
return
|
|
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,
|
|
99
|
-
let e = Date.now(), t =
|
|
100
|
-
return e < t || e > n ? null : (e - t) / (n - t) *
|
|
101
|
-
}, [
|
|
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]),
|
|
107
|
-
|
|
108
|
-
if (
|
|
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,
|
|
117
|
+
e.current.scrollLeft = Math.max(0, W - t / 2);
|
|
111
118
|
}, []);
|
|
112
|
-
let
|
|
113
|
-
totalWidth:
|
|
114
|
-
displayRange:
|
|
115
|
-
|
|
116
|
-
|
|
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
|
-
}), [
|
|
119
|
-
|
|
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__ */
|
|
137
|
+
children: /* @__PURE__ */ le(v, {
|
|
130
138
|
sx: {
|
|
131
|
-
minWidth:
|
|
139
|
+
minWidth: B,
|
|
132
140
|
position: "relative"
|
|
133
141
|
},
|
|
134
142
|
children: [
|
|
135
|
-
/* @__PURE__ */ y(
|
|
136
|
-
columns:
|
|
137
|
-
groups:
|
|
138
|
-
todayX:
|
|
143
|
+
/* @__PURE__ */ y(ee, {
|
|
144
|
+
columns: z,
|
|
145
|
+
groups: V,
|
|
146
|
+
todayX: W,
|
|
139
147
|
todayLabel: F.todayLabel,
|
|
140
|
-
todayTooltip:
|
|
141
|
-
todayColor:
|
|
148
|
+
todayTooltip: Se,
|
|
149
|
+
todayColor: Ce
|
|
142
150
|
}),
|
|
143
151
|
/* @__PURE__ */ y(f, {
|
|
144
|
-
strips:
|
|
145
|
-
totalWidth:
|
|
146
|
-
height:
|
|
147
|
-
top:
|
|
152
|
+
strips: xe,
|
|
153
|
+
totalWidth: B,
|
|
154
|
+
height: L.length * 40,
|
|
155
|
+
top: K
|
|
148
156
|
}),
|
|
149
|
-
|
|
157
|
+
fe ? /* @__PURE__ */ y(v, {
|
|
150
158
|
sx: {
|
|
151
159
|
position: "relative",
|
|
152
|
-
height:
|
|
160
|
+
height: U.getTotalSize()
|
|
153
161
|
},
|
|
154
|
-
children:
|
|
155
|
-
task:
|
|
162
|
+
children: U.getVirtualItems().map((e) => /* @__PURE__ */ y(d, {
|
|
163
|
+
task: L[e.index],
|
|
156
164
|
virtualTop: e.start,
|
|
157
|
-
activeDrag:
|
|
158
|
-
displayRange:
|
|
159
|
-
totalWidth:
|
|
160
|
-
gridColumnWidth:
|
|
161
|
-
criticalTaskIds:
|
|
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) =>
|
|
175
|
+
onContextMenu: (e, t, n) => Q({
|
|
168
176
|
task: e,
|
|
169
177
|
mouseX: t,
|
|
170
178
|
mouseY: n
|
|
171
179
|
}),
|
|
172
|
-
suppressClickRef:
|
|
173
|
-
handleBarMouseDown:
|
|
174
|
-
handleProgressMouseDown:
|
|
175
|
-
formatDragDate:
|
|
180
|
+
suppressClickRef: J,
|
|
181
|
+
handleBarMouseDown: Y,
|
|
182
|
+
handleProgressMouseDown: X,
|
|
183
|
+
formatDragDate: Z
|
|
176
184
|
}, e.key))
|
|
177
|
-
}) : /* @__PURE__ */ y(
|
|
185
|
+
}) : /* @__PURE__ */ y(ce, { children: L.map((e) => /* @__PURE__ */ y(d, {
|
|
178
186
|
task: e,
|
|
179
|
-
activeDrag:
|
|
180
|
-
displayRange:
|
|
181
|
-
totalWidth:
|
|
182
|
-
gridColumnWidth:
|
|
183
|
-
criticalTaskIds:
|
|
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) =>
|
|
197
|
+
onContextMenu: (e, t, n) => Q({
|
|
190
198
|
task: e,
|
|
191
199
|
mouseX: t,
|
|
192
200
|
mouseY: n
|
|
193
201
|
}),
|
|
194
|
-
suppressClickRef:
|
|
195
|
-
handleBarMouseDown:
|
|
196
|
-
handleProgressMouseDown:
|
|
197
|
-
formatDragDate:
|
|
202
|
+
suppressClickRef: J,
|
|
203
|
+
handleBarMouseDown: Y,
|
|
204
|
+
handleProgressMouseDown: X,
|
|
205
|
+
formatDragDate: Z
|
|
198
206
|
}, e.id)) }),
|
|
199
207
|
/* @__PURE__ */ y(p, {
|
|
200
|
-
contextMenu:
|
|
201
|
-
onClose: () =>
|
|
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
|
-
|
|
212
|
+
ge({
|
|
205
213
|
...n,
|
|
206
214
|
status: t
|
|
207
|
-
}),
|
|
215
|
+
}), Te.current?.(n, t), $.current?.(P.getState().tasks), Q(null);
|
|
208
216
|
}
|
|
209
217
|
}),
|
|
210
218
|
/* @__PURE__ */ y(m, {
|
|
211
|
-
dependencyLines:
|
|
212
|
-
todayX:
|
|
213
|
-
totalWidth:
|
|
214
|
-
height:
|
|
215
|
-
top:
|
|
216
|
-
arrowMarkerId:
|
|
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,
|
|
4
|
-
import { Fragment as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
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
|
|
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
|
|
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
|
|
20
|
-
let
|
|
21
|
-
days:
|
|
22
|
-
weeks:
|
|
23
|
-
months:
|
|
24
|
-
quarters:
|
|
25
|
-
},
|
|
26
|
-
days:
|
|
27
|
-
weeks:
|
|
28
|
-
months:
|
|
29
|
-
quarters:
|
|
30
|
-
},
|
|
31
|
-
return /* @__PURE__ */
|
|
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 || V !== "", 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: [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
-
|
|
132
|
-
|
|
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 {
|
|
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 {};
|