@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.
- package/README.de.md +56 -0
- package/README.md +56 -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 +15 -0
- package/dist/components/gantt-chart/GanttChart.types.js +3 -0
- package/dist/components/gantt-chart/GanttTaskDialog.js +170 -124
- 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
|
@@ -3,67 +3,67 @@ import { useGanttChartStore as t, useGanttTranslations as n, useRawGanttChartSto
|
|
|
3
3
|
import { useEffect as i, useLayoutEffect as a, useRef as o, useState as s } from "react";
|
|
4
4
|
//#region src/components/gantt-chart/hooks/useGanttDrag.ts
|
|
5
5
|
var c = 864e5;
|
|
6
|
-
function l({ totalWidth: l, displayRange: u,
|
|
7
|
-
let
|
|
6
|
+
function l({ totalWidth: l, displayRange: u, onDragStart: d, onTaskMoved: f, onTaskResized: p, onTasksChange: m }) {
|
|
7
|
+
let h = t((e) => e.updateTask), g = r(), _ = n(), v = o(1), y = o(d), b = o(f), x = o(p), S = o(m);
|
|
8
8
|
a(() => {
|
|
9
|
-
|
|
9
|
+
v.current = l > 0 ? l / ((u.end.getTime() - u.start.getTime()) / c) : 1, y.current = d, b.current = f, x.current = p, S.current = m;
|
|
10
10
|
});
|
|
11
|
-
let
|
|
11
|
+
let C = o(null), w = o(null), [T, E] = s(null), D = o(!1), O = o(null);
|
|
12
12
|
return i(() => () => {
|
|
13
|
-
|
|
13
|
+
O.current?.();
|
|
14
14
|
}, []), {
|
|
15
|
-
activeDrag:
|
|
16
|
-
suppressClickRef:
|
|
15
|
+
activeDrag: T,
|
|
16
|
+
suppressClickRef: D,
|
|
17
17
|
handleBarMouseDown: (t, n, r) => {
|
|
18
|
-
t.stopPropagation(),
|
|
18
|
+
t.stopPropagation(), D.current = !1, C.current = {
|
|
19
19
|
type: r,
|
|
20
20
|
taskId: n.id,
|
|
21
21
|
startX: t.clientX,
|
|
22
22
|
originalStart: n.startDate,
|
|
23
23
|
originalEnd: n.endDate
|
|
24
|
-
}, document.body.style.cursor = r === "resize" ? "ew-resize" : "grabbing";
|
|
24
|
+
}, r !== "progress" && y.current?.(n, r), document.body.style.cursor = r === "resize" ? "ew-resize" : "grabbing";
|
|
25
25
|
let i = (e) => {
|
|
26
|
-
let t =
|
|
26
|
+
let t = C.current;
|
|
27
27
|
if (!t || t.type === "progress") return;
|
|
28
|
-
let n = e.clientX - t.startX, r = Math.round(n /
|
|
29
|
-
Math.abs(n) >= 5 && (
|
|
28
|
+
let n = e.clientX - t.startX, r = Math.round(n / v.current);
|
|
29
|
+
Math.abs(n) >= 5 && (D.current = !0);
|
|
30
30
|
let i = {
|
|
31
31
|
taskId: t.taskId,
|
|
32
32
|
type: t.type,
|
|
33
33
|
deltaDays: r
|
|
34
34
|
};
|
|
35
|
-
|
|
35
|
+
w.current = i, E(i);
|
|
36
36
|
}, a = () => {
|
|
37
37
|
document.body.style.cursor = "";
|
|
38
|
-
let t =
|
|
39
|
-
if (t && n &&
|
|
40
|
-
let r =
|
|
38
|
+
let t = C.current, n = w.current;
|
|
39
|
+
if (t && n && D.current && n.deltaDays !== 0) {
|
|
40
|
+
let r = g.getState().tasks.find((e) => e.id === t.taskId);
|
|
41
41
|
if (r) {
|
|
42
42
|
if (n.type === "move") {
|
|
43
43
|
let i = e(t.originalStart, n.deltaDays), a = e(t.originalEnd, n.deltaDays);
|
|
44
|
-
|
|
44
|
+
h({
|
|
45
45
|
...r,
|
|
46
46
|
startDate: i,
|
|
47
47
|
endDate: a
|
|
48
|
-
}),
|
|
48
|
+
}), b.current?.(r, i, a);
|
|
49
49
|
} else {
|
|
50
50
|
let i = e(t.originalEnd, n.deltaDays), a = i > t.originalStart ? i : e(t.originalStart, 1);
|
|
51
|
-
|
|
51
|
+
h({
|
|
52
52
|
...r,
|
|
53
53
|
endDate: a
|
|
54
|
-
}),
|
|
54
|
+
}), x.current?.(r, a);
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
S.current?.(g.getState().tasks);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
C.current = null, w.current = null, E(null), document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", a), O.current = null;
|
|
60
60
|
};
|
|
61
|
-
document.addEventListener("mousemove", i), document.addEventListener("mouseup", a),
|
|
61
|
+
document.addEventListener("mousemove", i), document.addEventListener("mouseup", a), O.current = () => {
|
|
62
62
|
document.body.style.cursor = "", document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", a);
|
|
63
63
|
};
|
|
64
64
|
},
|
|
65
65
|
handleProgressMouseDown: (e, t, n, r) => {
|
|
66
|
-
e.stopPropagation(),
|
|
66
|
+
e.stopPropagation(), D.current = !1, C.current = {
|
|
67
67
|
type: "progress",
|
|
68
68
|
taskId: t.id,
|
|
69
69
|
startX: e.clientX,
|
|
@@ -73,34 +73,34 @@ function l({ totalWidth: l, displayRange: u, onTaskMoved: d, onTaskResized: f, o
|
|
|
73
73
|
barWidthPx: r
|
|
74
74
|
}, document.body.style.cursor = "ew-resize";
|
|
75
75
|
let i = (e) => {
|
|
76
|
-
let t =
|
|
76
|
+
let t = C.current;
|
|
77
77
|
if (!t || t.type !== "progress") return;
|
|
78
78
|
let n = e.clientX - t.startX;
|
|
79
|
-
Math.abs(n) >= 5 && (
|
|
79
|
+
Math.abs(n) >= 5 && (D.current = !0);
|
|
80
80
|
let r = n / (t.barWidthPx ?? 1) * 100, i = Math.round(Math.max(0, Math.min(100, (t.initialProgress ?? 0) + r))), a = {
|
|
81
81
|
taskId: t.taskId,
|
|
82
82
|
type: "progress",
|
|
83
83
|
deltaDays: 0,
|
|
84
84
|
newProgress: i
|
|
85
85
|
};
|
|
86
|
-
|
|
86
|
+
w.current = a, E(a);
|
|
87
87
|
}, a = () => {
|
|
88
88
|
document.body.style.cursor = "";
|
|
89
|
-
let e =
|
|
90
|
-
if (e && t && t.type === "progress" && t.newProgress !== void 0 &&
|
|
91
|
-
let n =
|
|
92
|
-
n && (
|
|
89
|
+
let e = C.current, t = w.current;
|
|
90
|
+
if (e && t && t.type === "progress" && t.newProgress !== void 0 && D.current) {
|
|
91
|
+
let n = g.getState().tasks.find((t) => t.id === e.taskId);
|
|
92
|
+
n && (h({
|
|
93
93
|
...n,
|
|
94
94
|
progress: t.newProgress
|
|
95
|
-
}),
|
|
95
|
+
}), S.current?.(g.getState().tasks));
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
C.current = null, w.current = null, E(null), document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", a), O.current = null;
|
|
98
98
|
};
|
|
99
|
-
document.addEventListener("mousemove", i), document.addEventListener("mouseup", a),
|
|
99
|
+
document.addEventListener("mousemove", i), document.addEventListener("mouseup", a), O.current = () => {
|
|
100
100
|
document.body.style.cursor = "", document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", a);
|
|
101
101
|
};
|
|
102
102
|
},
|
|
103
|
-
formatDragDate: (e) => e.toLocaleDateString(
|
|
103
|
+
formatDragDate: (e) => e.toLocaleDateString(_.dateLocale, {
|
|
104
104
|
day: "2-digit",
|
|
105
105
|
month: "short"
|
|
106
106
|
})
|
|
@@ -29,6 +29,11 @@ export declare function buildTaskTree(tasks: GanttTask[]): GanttTaskNode[];
|
|
|
29
29
|
* Knoten aufgeklappt sind. Root-Tasks sind immer sichtbar.
|
|
30
30
|
*/
|
|
31
31
|
export declare function getVisibleTasks(nodes: GanttTaskNode[], expandedIds: Set<string>): GanttTaskNode[];
|
|
32
|
+
/**
|
|
33
|
+
* Ancestor-inclusive assignee filter on a flat visible-task list.
|
|
34
|
+
* A node is kept if it or any of its tree-descendants has the given assignee.
|
|
35
|
+
*/
|
|
36
|
+
export declare function filterByAssignee(flat: GanttTaskNode[], assignee: string): GanttTaskNode[];
|
|
32
37
|
export declare function startOfMonth(date: Date): Date;
|
|
33
38
|
export declare function endOfMonth(date: Date): Date;
|
|
34
39
|
export declare function addMonths(date: Date, months: number): Date;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
//#region src/components/gantt-chart/util/gantt-chart.util.ts
|
|
2
2
|
function e(e) {
|
|
3
|
-
let t = /* @__PURE__ */ new Date(), n =
|
|
3
|
+
let t = /* @__PURE__ */ new Date(), n = y(t), r = b(t);
|
|
4
4
|
if (e.length === 0) return {
|
|
5
5
|
start: n,
|
|
6
6
|
end: r
|
|
7
7
|
};
|
|
8
|
-
let i = e.map((e) => e.startDate.getTime()), a = e.map((e) => e.endDate.getTime()),
|
|
8
|
+
let i = e.map((e) => e.startDate.getTime()), a = e.map((e) => e.endDate.getTime()), o = s(l(new Date(Math.min(...i)), -1)), u = c(l(new Date(Math.max(...a)), 1));
|
|
9
9
|
return {
|
|
10
|
-
start:
|
|
10
|
+
start: o < n ? o : n,
|
|
11
11
|
end: u > r ? u : r
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
function t(e, t) {
|
|
15
15
|
return t === "weeks" ? {
|
|
16
|
-
start:
|
|
16
|
+
start: h(e.start),
|
|
17
17
|
end: e.end
|
|
18
18
|
} : t === "quarters" ? {
|
|
19
|
-
start:
|
|
20
|
-
end:
|
|
19
|
+
start: y(e.start),
|
|
20
|
+
end: b(e.end)
|
|
21
21
|
} : e;
|
|
22
22
|
}
|
|
23
23
|
function n(e, t) {
|
|
@@ -53,26 +53,32 @@ function a(e, t) {
|
|
|
53
53
|
}
|
|
54
54
|
return r(e), n;
|
|
55
55
|
}
|
|
56
|
-
function o(e) {
|
|
57
|
-
|
|
56
|
+
function o(e, t) {
|
|
57
|
+
function n(e) {
|
|
58
|
+
return e.assignee === t ? !0 : e.children.some(n);
|
|
59
|
+
}
|
|
60
|
+
return e.filter(n);
|
|
58
61
|
}
|
|
59
62
|
function s(e) {
|
|
63
|
+
return new Date(e.getFullYear(), e.getMonth(), 1, 0, 0, 0, 0);
|
|
64
|
+
}
|
|
65
|
+
function c(e) {
|
|
60
66
|
return new Date(e.getFullYear(), e.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
61
67
|
}
|
|
62
|
-
function
|
|
68
|
+
function l(e, t) {
|
|
63
69
|
return new Date(e.getFullYear(), e.getMonth() + t, e.getDate());
|
|
64
70
|
}
|
|
65
|
-
function
|
|
71
|
+
function u(e, t) {
|
|
66
72
|
return new Date(e.getFullYear(), e.getMonth(), e.getDate() + t, 0, 0, 0, 0);
|
|
67
73
|
}
|
|
68
|
-
function
|
|
74
|
+
function d(e) {
|
|
69
75
|
let t = /* @__PURE__ */ new Map();
|
|
70
76
|
for (let n of e) for (let e of n.dependencies ?? []) t.has(e) || t.set(e, []), t.get(e).push(n.id);
|
|
71
77
|
return t;
|
|
72
78
|
}
|
|
73
|
-
function
|
|
79
|
+
function f(e, t, n) {
|
|
74
80
|
if (n === 0) return e;
|
|
75
|
-
let r =
|
|
81
|
+
let r = d(e), i = new Map(e.map((e) => [e.id, e])), a = [...r.get(t) ?? []], o = /* @__PURE__ */ new Set();
|
|
76
82
|
for (; a.length > 0;) {
|
|
77
83
|
let e = a.shift();
|
|
78
84
|
if (o.has(e)) continue;
|
|
@@ -86,49 +92,49 @@ function d(e, t, n) {
|
|
|
86
92
|
}
|
|
87
93
|
return e.map((e) => i.get(e.id));
|
|
88
94
|
}
|
|
89
|
-
function
|
|
90
|
-
let n =
|
|
95
|
+
function p(e, t) {
|
|
96
|
+
let n = d(e), r = /* @__PURE__ */ new Set(), i = [...n.get(t) ?? []];
|
|
91
97
|
for (; i.length > 0;) {
|
|
92
98
|
let e = i.shift();
|
|
93
99
|
r.has(e) || (r.add(e), i.push(...n.get(e) ?? []));
|
|
94
100
|
}
|
|
95
101
|
return r;
|
|
96
102
|
}
|
|
97
|
-
function
|
|
98
|
-
let t = [], n =
|
|
99
|
-
for (; n <= e.end;) t.push(n), n =
|
|
103
|
+
function m(e) {
|
|
104
|
+
let t = [], n = s(e.start);
|
|
105
|
+
for (; n <= e.end;) t.push(n), n = l(n, 1);
|
|
100
106
|
return t;
|
|
101
107
|
}
|
|
102
|
-
function
|
|
108
|
+
function h(e) {
|
|
103
109
|
let t = new Date(e), n = t.getDay(), r = n === 0 ? -6 : 1 - n;
|
|
104
110
|
return t.setDate(t.getDate() + r), t.setHours(0, 0, 0, 0), t;
|
|
105
111
|
}
|
|
106
|
-
function
|
|
112
|
+
function g(e) {
|
|
107
113
|
let t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate())), n = t.getUTCDay() || 7;
|
|
108
114
|
t.setUTCDate(t.getUTCDate() + 4 - n);
|
|
109
115
|
let r = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
|
|
110
116
|
return Math.ceil(((t.getTime() - r.getTime()) / 864e5 + 1) / 7);
|
|
111
117
|
}
|
|
112
|
-
function
|
|
113
|
-
let t = [], n =
|
|
118
|
+
function _(e) {
|
|
119
|
+
let t = [], n = h(e.start);
|
|
114
120
|
for (; n <= e.end;) t.push(new Date(n)), n = new Date(n.getFullYear(), n.getMonth(), n.getDate() + 7);
|
|
115
121
|
return t;
|
|
116
122
|
}
|
|
117
|
-
function
|
|
123
|
+
function v(e) {
|
|
118
124
|
let t = [], n = new Date(e.start.getFullYear(), e.start.getMonth(), e.start.getDate(), 0, 0, 0, 0), r = new Date(e.end.getFullYear(), e.end.getMonth(), e.end.getDate(), 0, 0, 0, 0).getTime();
|
|
119
125
|
for (; n.getTime() <= r;) t.push(new Date(n)), n = new Date(n.getFullYear(), n.getMonth(), n.getDate() + 1, 0, 0, 0, 0);
|
|
120
126
|
return t;
|
|
121
127
|
}
|
|
122
|
-
function
|
|
128
|
+
function y(e) {
|
|
123
129
|
let t = Math.floor(e.getMonth() / 3) * 3;
|
|
124
130
|
return new Date(e.getFullYear(), t, 1, 0, 0, 0, 0);
|
|
125
131
|
}
|
|
126
|
-
function
|
|
132
|
+
function b(e) {
|
|
127
133
|
let t = Math.floor(e.getMonth() / 3) * 3 + 2;
|
|
128
|
-
return
|
|
134
|
+
return c(new Date(e.getFullYear(), t, 1));
|
|
129
135
|
}
|
|
130
|
-
function
|
|
131
|
-
let t = [], n =
|
|
136
|
+
function x(e) {
|
|
137
|
+
let t = [], n = y(e.start);
|
|
132
138
|
for (; n <= e.end;) {
|
|
133
139
|
let e = Math.floor(n.getMonth() / 3) + 1;
|
|
134
140
|
t.push({
|
|
@@ -139,7 +145,7 @@ function b(e) {
|
|
|
139
145
|
}
|
|
140
146
|
return t;
|
|
141
147
|
}
|
|
142
|
-
function
|
|
148
|
+
function S(e) {
|
|
143
149
|
if (e.length === 0) return /* @__PURE__ */ new Set();
|
|
144
150
|
let t = /* @__PURE__ */ new Map();
|
|
145
151
|
for (let n of e) for (let e of n.dependencies ?? []) t.has(e) || t.set(e, []), t.get(e).push(n.id);
|
|
@@ -158,4 +164,4 @@ function x(e) {
|
|
|
158
164
|
return s;
|
|
159
165
|
}
|
|
160
166
|
//#endregion
|
|
161
|
-
export {
|
|
167
|
+
export { u as addDays, l as addMonths, r as buildTaskTree, n as calculateTaskPosition, f as cascadeDateUpdate, S as computeCriticalPath, c as endOfMonth, o as filterByAssignee, v as getDaysInRange, p as getDependencyCycleCandidates, t as getDisplayRange, g as getISOWeekNumber, m as getMonthsInRange, x as getQuartersInRange, e as getTimelineRange, a as getVisibleTasks, _ as getWeeksInRange, s as startOfMonth };
|