@thebuoyant-tsdev/mui-ts-library 3.2.1 → 3.6.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 +31 -0
- package/README.md +31 -0
- package/dist/components/chord-chart/ChordChart.js +284 -0
- package/dist/components/chord-chart/ChordChart.types.js +4 -0
- package/dist/components/circle-packing-chart/CirclePackingChart.js +382 -0
- package/dist/components/circle-packing-chart/CirclePackingChart.types.js +4 -0
- package/dist/components/gantt-chart/GanttBarRow.js +202 -0
- package/dist/components/gantt-chart/GanttChart.constants.js +14 -0
- package/dist/components/gantt-chart/GanttChart.js +258 -0
- package/dist/components/gantt-chart/GanttChart.store.js +119 -0
- package/dist/components/gantt-chart/GanttChart.types.js +47 -0
- package/dist/components/gantt-chart/GanttDeleteDialog.js +30 -0
- package/dist/components/gantt-chart/GanttDependencyArrows.js +54 -0
- package/dist/components/gantt-chart/GanttStatusContextMenu.js +36 -0
- package/dist/components/gantt-chart/GanttTaskDialog.js +324 -0
- package/dist/components/gantt-chart/GanttTaskPanel.js +415 -0
- package/dist/components/gantt-chart/GanttTimeline.js +223 -0
- package/dist/components/gantt-chart/GanttTimelineHeader.js +90 -0
- package/dist/components/gantt-chart/GanttToolbar.js +157 -0
- package/dist/components/gantt-chart/GanttWeekendStrips.js +29 -0
- package/dist/components/gantt-chart/hooks/useGanttDrag.js +104 -0
- package/dist/components/gantt-chart/util/gantt-chart.util.js +150 -0
- package/dist/components/horizontal-tree-chart/HorizontalTreeChart.js +488 -0
- package/dist/components/horizontal-tree-chart/HorizontalTreeChart.types.js +8 -0
- package/dist/components/json-editor/JsonEditor.js +102 -0
- package/dist/components/json-editor/JsonEditor.types.js +21 -0
- package/dist/components/json-editor/JsonEditorContent.js +185 -0
- package/dist/components/json-editor/JsonEditorFooter.js +55 -0
- package/dist/components/json-editor/JsonEditorToolbar.js +148 -0
- package/dist/components/password-strength-meter/PasswordStrengthBar.js +66 -0
- package/dist/components/password-strength-meter/PasswordStrengthMeter.js +272 -0
- package/dist/components/password-strength-meter/PasswordStrengthMeter.types.js +27 -0
- package/dist/components/password-strength-meter/util/password-strength.util.js +38 -0
- package/dist/components/radial-tree-chart/RadialTreeChart.js +447 -0
- package/dist/components/radial-tree-chart/RadialTreeChart.types.js +8 -0
- package/dist/components/rich-text-editor/RichTextEditor.js +135 -0
- package/dist/components/rich-text-editor/RichTextEditor.types.js +74 -0
- package/dist/components/rich-text-editor/RichTextEditorColorPicker.js +185 -0
- package/dist/components/rich-text-editor/RichTextEditorContent.js +129 -0
- package/dist/components/rich-text-editor/RichTextEditorEmojiPicker.js +110 -0
- package/dist/components/rich-text-editor/RichTextEditorFooter.js +33 -0
- package/dist/components/rich-text-editor/RichTextEditorImageDialog.js +74 -0
- package/dist/components/rich-text-editor/RichTextEditorLinkDialog.js +70 -0
- package/dist/components/rich-text-editor/RichTextEditorTableMenu.js +97 -0
- package/dist/components/rich-text-editor/RichTextEditorToolbar.js +362 -0
- package/dist/components/rich-text-editor/util/emojis.js +739 -0
- package/dist/components/shared/ToolbarButton.js +22 -0
- package/dist/components/shared/normalizeSize.js +6 -0
- package/dist/components/sql-editor/SqlEditor.d.ts +1 -1
- package/dist/components/sql-editor/SqlEditor.js +113 -0
- package/dist/components/sql-editor/SqlEditor.types.d.ts +9 -0
- package/dist/components/sql-editor/SqlEditor.types.js +24 -0
- package/dist/components/sql-editor/SqlEditorContent.js +248 -0
- package/dist/components/sql-editor/SqlEditorFooter.js +45 -0
- package/dist/components/sql-editor/SqlEditorHistoryMenu.d.ts +11 -0
- package/dist/components/sql-editor/SqlEditorHistoryMenu.js +75 -0
- package/dist/components/sql-editor/SqlEditorToolbar.d.ts +5 -1
- package/dist/components/sql-editor/SqlEditorToolbar.js +163 -0
- package/dist/components/sql-editor/useSqlQueryHistory.d.ts +6 -0
- package/dist/components/sql-editor/useSqlQueryHistory.js +20 -0
- package/dist/components/sql-editor/util/sqlQueryHistory.util.d.ts +12 -0
- package/dist/components/sql-editor/util/sqlQueryHistory.util.js +28 -0
- package/dist/components/sunburst-chart/SunburstChart.js +292 -0
- package/dist/components/sunburst-chart/SunburstChart.types.js +4 -0
- package/dist/components/tag-selection/TagSelection.js +102 -0
- package/dist/components/tag-selection/TagSelection.store.js +40 -0
- package/dist/components/tag-selection/TagSelection.types.d.ts +2 -0
- package/dist/components/tag-selection/TagSelection.types.js +18 -0
- package/dist/components/tag-selection/TagSelectionAutocomplete.js +382 -0
- package/dist/components/tag-selection/TagSelectionChip.js +30 -0
- package/dist/components/tag-selection/TagSelectionSelectedTags.js +73 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +23 -8035
- package/package.json +1 -1
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { getDisplayRange as e, getTimelineRange as t } from "./util/gantt-chart.util.js";
|
|
2
|
+
import { createGanttChartStore as n } from "./GanttChart.store.js";
|
|
3
|
+
import { DEFAULT_GANTT_TRANSLATIONS as r } from "./GanttChart.types.js";
|
|
4
|
+
import { GanttTaskPanel as i } from "./GanttTaskPanel.js";
|
|
5
|
+
import { GanttTimeline as a } from "./GanttTimeline.js";
|
|
6
|
+
import { GanttToolbar as o } from "./GanttToolbar.js";
|
|
7
|
+
import { createContext as s, useCallback as c, useContext as l, useEffect as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
8
|
+
import { Box as m } from "@mui/material";
|
|
9
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
10
|
+
import { useStore as _ } from "zustand";
|
|
11
|
+
//#region src/components/gantt-chart/GanttChart.tsx
|
|
12
|
+
var v = s(null);
|
|
13
|
+
function y(e) {
|
|
14
|
+
let t = l(v);
|
|
15
|
+
if (!t) throw Error("GanttChartStoreContext is missing.");
|
|
16
|
+
return _(t, e);
|
|
17
|
+
}
|
|
18
|
+
function b() {
|
|
19
|
+
let e = l(v);
|
|
20
|
+
if (!e) throw Error("GanttChartStoreContext is missing.");
|
|
21
|
+
return e;
|
|
22
|
+
}
|
|
23
|
+
var x = s(r);
|
|
24
|
+
function S() {
|
|
25
|
+
return l(x);
|
|
26
|
+
}
|
|
27
|
+
var C = s({});
|
|
28
|
+
function w() {
|
|
29
|
+
return l(C);
|
|
30
|
+
}
|
|
31
|
+
function T(e, t) {
|
|
32
|
+
return e === void 0 ? t : e === "auto" ? "100%" : typeof e == "string" && /^\d+$/.test(e) ? Number(e) : e;
|
|
33
|
+
}
|
|
34
|
+
var E = [
|
|
35
|
+
"days",
|
|
36
|
+
"weeks",
|
|
37
|
+
"months",
|
|
38
|
+
"quarters"
|
|
39
|
+
], D = {
|
|
40
|
+
showScaleDays: !0,
|
|
41
|
+
showScaleWeeks: !0,
|
|
42
|
+
showScaleMonths: !0,
|
|
43
|
+
showScaleQuarters: !0,
|
|
44
|
+
showExpandCollapseAll: !0,
|
|
45
|
+
showScrollToToday: !0,
|
|
46
|
+
showDateRange: !0,
|
|
47
|
+
showRangeReset: !0,
|
|
48
|
+
showResetView: !0,
|
|
49
|
+
showExportCSV: !1
|
|
50
|
+
};
|
|
51
|
+
function O({ tasks: t, onTaskClick: n, onMilestoneClick: r, onAddTask: s, onEditTask: l, onDeleteTask: _, onStatusChange: v, onTasksChange: x, enableBuiltinDialogs: S = !0, onTaskCreated: C, onTaskUpdated: w, onTaskDeleted: O, showToolbar: k = !0, toolbarConfig: A, height: j, width: ee, minPanelWidth: M = 200, maxPanelWidth: N = 600, zoomable: P = !1, draggable: F = !1, resizable: I = !1, inlineEdit: L = !1, progressDraggable: te = !1, showCriticalPath: ne = !1, virtualizeRows: R = !1, showAssigneeColumn: z = !1, onExportCSV: B, onTaskMoved: V, onTaskResized: H }) {
|
|
52
|
+
let U = T(j, 400), W = d(() => ({
|
|
53
|
+
...D,
|
|
54
|
+
...A
|
|
55
|
+
}), [A]), G = T(ee, "100%"), K = y((e) => e.setTasks), q = y((e) => e.timeScale), J = y((e) => e.setTimeScale), Y = y((e) => e.timelineRange), X = f(null), Z = f(null), Q = f(!1), [$, re] = p(320), ie = b(), ae = c(() => {
|
|
56
|
+
let e = ie.getState().tasks, t = [[
|
|
57
|
+
"id",
|
|
58
|
+
"name",
|
|
59
|
+
"status",
|
|
60
|
+
"startDate",
|
|
61
|
+
"endDate",
|
|
62
|
+
"progress",
|
|
63
|
+
"assignee",
|
|
64
|
+
"parentId",
|
|
65
|
+
"isMilestone",
|
|
66
|
+
"dependencies",
|
|
67
|
+
"color"
|
|
68
|
+
].join(","), ...e.map((e) => [
|
|
69
|
+
e.id,
|
|
70
|
+
`"${e.name.replace(/"/g, "\"\"")}"`,
|
|
71
|
+
e.status,
|
|
72
|
+
e.startDate.toISOString().split("T")[0],
|
|
73
|
+
e.endDate.toISOString().split("T")[0],
|
|
74
|
+
e.progress ?? "",
|
|
75
|
+
e.assignee ? `"${e.assignee.replace(/"/g, "\"\"")}"` : "",
|
|
76
|
+
e.parentId ?? "",
|
|
77
|
+
e.isMilestone ? "true" : "false",
|
|
78
|
+
(e.dependencies ?? []).join(";"),
|
|
79
|
+
e.color ?? ""
|
|
80
|
+
].join(","))].join("\n");
|
|
81
|
+
if (B) B(t, e);
|
|
82
|
+
else {
|
|
83
|
+
let e = new Blob([t], { type: "text/csv;charset=utf-8;" }), n = URL.createObjectURL(e), r = document.createElement("a");
|
|
84
|
+
r.href = n, r.download = "gantt-tasks.csv", r.click(), URL.revokeObjectURL(n);
|
|
85
|
+
}
|
|
86
|
+
}, [ie, B]);
|
|
87
|
+
u(() => {
|
|
88
|
+
K(t);
|
|
89
|
+
}, [t, K]);
|
|
90
|
+
let oe = () => {
|
|
91
|
+
Q.current ||= (Q.current = !0, Z.current && X.current && (Z.current.scrollTop = X.current.scrollTop), !1);
|
|
92
|
+
}, se = () => {
|
|
93
|
+
Q.current ||= (Q.current = !0, X.current && Z.current && (X.current.scrollTop = Z.current.scrollTop), !1);
|
|
94
|
+
}, ce = c(() => {
|
|
95
|
+
if (!Z.current) return;
|
|
96
|
+
let t = e(Y, q), n = Date.now(), r = t.start.getTime(), i = t.end.getTime(), a = (n - r) / (i - r) * Z.current.scrollWidth;
|
|
97
|
+
Z.current.scrollLeft = Math.max(0, a - Z.current.clientWidth / 2);
|
|
98
|
+
}, [Y, q]);
|
|
99
|
+
u(() => {
|
|
100
|
+
if (!P || !Z.current) return;
|
|
101
|
+
let e = Z.current, t = (e) => {
|
|
102
|
+
if (!e.ctrlKey) return;
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
let t = E.indexOf(q);
|
|
105
|
+
e.deltaY < 0 && t > 0 ? J(E[t - 1]) : e.deltaY > 0 && t < E.length - 1 && J(E[t + 1]);
|
|
106
|
+
};
|
|
107
|
+
return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
|
|
108
|
+
}, [
|
|
109
|
+
P,
|
|
110
|
+
q,
|
|
111
|
+
J
|
|
112
|
+
]);
|
|
113
|
+
let le = c((e) => {
|
|
114
|
+
e.preventDefault();
|
|
115
|
+
let t = e.clientX, n = $, r = (e) => {
|
|
116
|
+
let r = e.clientX - t;
|
|
117
|
+
re(Math.max(M, Math.min(N, n + r)));
|
|
118
|
+
}, i = () => {
|
|
119
|
+
document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
|
|
120
|
+
};
|
|
121
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", i);
|
|
122
|
+
}, [
|
|
123
|
+
$,
|
|
124
|
+
M,
|
|
125
|
+
N
|
|
126
|
+
]);
|
|
127
|
+
return /* @__PURE__ */ g(m, {
|
|
128
|
+
sx: {
|
|
129
|
+
display: "flex",
|
|
130
|
+
flexDirection: "column",
|
|
131
|
+
height: U,
|
|
132
|
+
width: G,
|
|
133
|
+
border: "1px solid",
|
|
134
|
+
borderColor: "divider",
|
|
135
|
+
borderRadius: 1,
|
|
136
|
+
overflow: "hidden"
|
|
137
|
+
},
|
|
138
|
+
children: [k && /* @__PURE__ */ h(o, {
|
|
139
|
+
onScrollToToday: ce,
|
|
140
|
+
config: W,
|
|
141
|
+
onExportCSV: W.showExportCSV ? ae : void 0
|
|
142
|
+
}), /* @__PURE__ */ g(m, {
|
|
143
|
+
sx: {
|
|
144
|
+
display: "flex",
|
|
145
|
+
flex: 1,
|
|
146
|
+
overflow: "hidden"
|
|
147
|
+
},
|
|
148
|
+
children: [
|
|
149
|
+
/* @__PURE__ */ h(i, {
|
|
150
|
+
scrollRef: X,
|
|
151
|
+
onScroll: oe,
|
|
152
|
+
panelWidth: $,
|
|
153
|
+
onTaskClick: n,
|
|
154
|
+
onAddTask: s,
|
|
155
|
+
onEditTask: l,
|
|
156
|
+
onDeleteTask: _,
|
|
157
|
+
onStatusChange: v,
|
|
158
|
+
onTasksChange: x,
|
|
159
|
+
enableBuiltinDialogs: S,
|
|
160
|
+
onTaskCreated: C,
|
|
161
|
+
onTaskUpdated: w,
|
|
162
|
+
onTaskDeleted: O,
|
|
163
|
+
inlineEdit: L,
|
|
164
|
+
virtualizeRows: R,
|
|
165
|
+
showAssigneeColumn: z
|
|
166
|
+
}),
|
|
167
|
+
/* @__PURE__ */ h(m, {
|
|
168
|
+
"data-testid": "gantt-panel-divider",
|
|
169
|
+
sx: {
|
|
170
|
+
width: 4,
|
|
171
|
+
flexShrink: 0,
|
|
172
|
+
bgcolor: "divider",
|
|
173
|
+
cursor: "col-resize",
|
|
174
|
+
"&:hover": { bgcolor: "action.hover" }
|
|
175
|
+
},
|
|
176
|
+
onMouseDown: le
|
|
177
|
+
}),
|
|
178
|
+
/* @__PURE__ */ h(a, {
|
|
179
|
+
scrollRef: Z,
|
|
180
|
+
onScroll: se,
|
|
181
|
+
onTaskClick: n,
|
|
182
|
+
onMilestoneClick: r,
|
|
183
|
+
draggable: F,
|
|
184
|
+
resizable: I,
|
|
185
|
+
progressDraggable: te,
|
|
186
|
+
showCriticalPath: ne,
|
|
187
|
+
virtualizeRows: R,
|
|
188
|
+
onTaskMoved: V,
|
|
189
|
+
onTaskResized: H,
|
|
190
|
+
onTasksChange: x,
|
|
191
|
+
onStatusChange: v
|
|
192
|
+
})
|
|
193
|
+
]
|
|
194
|
+
})]
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
function k({ tasks: e, timeScale: i = "months", initialExpandAll: a = !1, showToolbar: o = !0, defaultRangeStart: s, defaultRangeEnd: c, translations: l, enableBuiltinDialogs: u = !0, toolbarConfig: f, zoomable: m = !1, draggable: g = !1, resizable: _ = !1, inlineEdit: y = !1, progressDraggable: b = !1, showCriticalPath: S = !1, virtualizeRows: w = !1, showAssigneeColumn: T = !1, cascadeDependencies: E = !1, statusColors: D, ganttTheme: k, onExportCSV: A, onTaskClick: j, onMilestoneClick: ee, onAddTask: M, onEditTask: N, onDeleteTask: P, onStatusChange: F, onTasksChange: I, onTaskMoved: L, onTaskResized: te, onTaskCreated: ne, onTaskUpdated: R, onTaskDeleted: z, height: B, width: V, minPanelWidth: H, maxPanelWidth: U }) {
|
|
198
|
+
let W = d(() => ({
|
|
199
|
+
...r,
|
|
200
|
+
...l
|
|
201
|
+
}), [l]), [G] = p(() => {
|
|
202
|
+
if (!(s !== void 0 || c !== void 0)) return n(e, i, a, void 0, E);
|
|
203
|
+
let r = t(e);
|
|
204
|
+
return n(e, i, a, {
|
|
205
|
+
start: s ?? r.start,
|
|
206
|
+
end: c ?? r.end
|
|
207
|
+
}, E);
|
|
208
|
+
}), K = d(() => ({
|
|
209
|
+
...k,
|
|
210
|
+
statusColors: {
|
|
211
|
+
...D,
|
|
212
|
+
...k?.statusColors
|
|
213
|
+
}
|
|
214
|
+
}), [D, k]);
|
|
215
|
+
return /* @__PURE__ */ h(x.Provider, {
|
|
216
|
+
value: W,
|
|
217
|
+
children: /* @__PURE__ */ h(C.Provider, {
|
|
218
|
+
value: K,
|
|
219
|
+
children: /* @__PURE__ */ h(v.Provider, {
|
|
220
|
+
value: G,
|
|
221
|
+
children: /* @__PURE__ */ h(O, {
|
|
222
|
+
tasks: e,
|
|
223
|
+
timeScale: i,
|
|
224
|
+
enableBuiltinDialogs: u,
|
|
225
|
+
showToolbar: o,
|
|
226
|
+
toolbarConfig: f,
|
|
227
|
+
zoomable: m,
|
|
228
|
+
draggable: g,
|
|
229
|
+
resizable: _,
|
|
230
|
+
inlineEdit: y,
|
|
231
|
+
progressDraggable: b,
|
|
232
|
+
showCriticalPath: S,
|
|
233
|
+
virtualizeRows: w,
|
|
234
|
+
showAssigneeColumn: T,
|
|
235
|
+
onExportCSV: A,
|
|
236
|
+
onTaskClick: j,
|
|
237
|
+
onMilestoneClick: ee,
|
|
238
|
+
onAddTask: M,
|
|
239
|
+
onEditTask: N,
|
|
240
|
+
onDeleteTask: P,
|
|
241
|
+
onStatusChange: F,
|
|
242
|
+
onTasksChange: I,
|
|
243
|
+
onTaskMoved: L,
|
|
244
|
+
onTaskResized: te,
|
|
245
|
+
onTaskCreated: ne,
|
|
246
|
+
onTaskUpdated: R,
|
|
247
|
+
onTaskDeleted: z,
|
|
248
|
+
height: B,
|
|
249
|
+
width: V,
|
|
250
|
+
minPanelWidth: H,
|
|
251
|
+
maxPanelWidth: U
|
|
252
|
+
})
|
|
253
|
+
})
|
|
254
|
+
})
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
//#endregion
|
|
258
|
+
export { k as GanttChart, y as useGanttChartStore, w as useGanttTheme, S as useGanttTranslations, b as useRawGanttChartStore };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { addMonths as e, buildTaskTree as t, cascadeDateUpdate as n, endOfMonth as r, getTimelineRange as i, getVisibleTasks as a, startOfMonth as o } from "./util/gantt-chart.util.js";
|
|
2
|
+
import { createStore as s } from "zustand/vanilla";
|
|
3
|
+
//#region src/components/gantt-chart/GanttChart.store.ts
|
|
4
|
+
function c(t, n) {
|
|
5
|
+
let i = n.startDate < t.start ? o(e(n.startDate, -1)) : t.start, a = n.endDate > t.end ? r(e(n.endDate, 1)) : t.end;
|
|
6
|
+
return i === t.start && a === t.end ? t : {
|
|
7
|
+
start: i,
|
|
8
|
+
end: a
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function l(e, r = "months", o = !1, l, u = !1) {
|
|
12
|
+
let d = i(e);
|
|
13
|
+
return s((s, f) => ({
|
|
14
|
+
tasks: e,
|
|
15
|
+
taskTree: t(e),
|
|
16
|
+
expandedIds: o ? new Set(e.map((e) => e.id)) : new Set(e.filter((e) => !e.parentId).map((e) => e.id)),
|
|
17
|
+
timeScale: r,
|
|
18
|
+
timelineRange: l ?? d,
|
|
19
|
+
isRangeCustomized: l !== void 0,
|
|
20
|
+
cascadeDependencies: u,
|
|
21
|
+
defaultTimeScale: r,
|
|
22
|
+
initialExpandAll: o,
|
|
23
|
+
isExpandedCustomized: !1,
|
|
24
|
+
setTasks: (e) => {
|
|
25
|
+
s((n) => ({
|
|
26
|
+
tasks: e,
|
|
27
|
+
taskTree: t(e),
|
|
28
|
+
...n.isRangeCustomized ? {} : { timelineRange: i(e) }
|
|
29
|
+
}));
|
|
30
|
+
},
|
|
31
|
+
addTask: (e) => {
|
|
32
|
+
s((n) => {
|
|
33
|
+
let r = [...n.tasks, e];
|
|
34
|
+
return {
|
|
35
|
+
tasks: r,
|
|
36
|
+
taskTree: t(r),
|
|
37
|
+
timelineRange: c(n.timelineRange, e)
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
updateTask: (e) => {
|
|
42
|
+
s((r) => {
|
|
43
|
+
let i = r.tasks.find((t) => t.id === e.id), a = r.tasks.map((t) => t.id === e.id ? e : t);
|
|
44
|
+
if (r.cascadeDependencies && i) {
|
|
45
|
+
let t = e.endDate.getTime() - i.endDate.getTime();
|
|
46
|
+
a = n(a, e.id, t);
|
|
47
|
+
}
|
|
48
|
+
let o = c(r.timelineRange, e);
|
|
49
|
+
for (let e of a) o = c(o, e);
|
|
50
|
+
return {
|
|
51
|
+
tasks: a,
|
|
52
|
+
taskTree: t(a),
|
|
53
|
+
timelineRange: o
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
deleteTask: (e) => {
|
|
58
|
+
s((n) => {
|
|
59
|
+
let r = /* @__PURE__ */ new Set(), i = (e) => {
|
|
60
|
+
r.add(e), n.tasks.filter((t) => t.parentId === e).forEach((e) => i(e.id));
|
|
61
|
+
};
|
|
62
|
+
i(e);
|
|
63
|
+
let a = n.tasks.filter((e) => !r.has(e.id));
|
|
64
|
+
return {
|
|
65
|
+
tasks: a,
|
|
66
|
+
taskTree: t(a)
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
toggleExpand: (e) => {
|
|
71
|
+
s((t) => {
|
|
72
|
+
let n = new Set(t.expandedIds);
|
|
73
|
+
return n.has(e) ? n.delete(e) : n.add(e), { expandedIds: n };
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
expandAll: () => {
|
|
77
|
+
s((e) => ({
|
|
78
|
+
expandedIds: new Set(e.tasks.map((e) => e.id)),
|
|
79
|
+
isExpandedCustomized: !0
|
|
80
|
+
}));
|
|
81
|
+
},
|
|
82
|
+
collapseAll: () => {
|
|
83
|
+
s({
|
|
84
|
+
expandedIds: /* @__PURE__ */ new Set(),
|
|
85
|
+
isExpandedCustomized: !0
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
setTimeScale: (e) => {
|
|
89
|
+
s({ timeScale: e });
|
|
90
|
+
},
|
|
91
|
+
setTimelineRange: (e) => {
|
|
92
|
+
s({
|
|
93
|
+
timelineRange: e,
|
|
94
|
+
isRangeCustomized: !0
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
resetTimelineRange: () => {
|
|
98
|
+
s((e) => ({
|
|
99
|
+
timelineRange: i(e.tasks),
|
|
100
|
+
isRangeCustomized: !1
|
|
101
|
+
}));
|
|
102
|
+
},
|
|
103
|
+
resetView: () => {
|
|
104
|
+
s((e) => ({
|
|
105
|
+
timeScale: e.defaultTimeScale,
|
|
106
|
+
timelineRange: i(e.tasks),
|
|
107
|
+
isRangeCustomized: !1,
|
|
108
|
+
isExpandedCustomized: !1,
|
|
109
|
+
expandedIds: e.initialExpandAll ? new Set(e.tasks.map((e) => e.id)) : new Set(e.tasks.filter((e) => !e.parentId).map((e) => e.id))
|
|
110
|
+
}));
|
|
111
|
+
},
|
|
112
|
+
getVisibleTasks: () => {
|
|
113
|
+
let { taskTree: e, expandedIds: t } = f();
|
|
114
|
+
return a(e, t);
|
|
115
|
+
}
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
export { l as createGanttChartStore };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//#region src/components/gantt-chart/GanttChart.types.ts
|
|
2
|
+
var e = {
|
|
3
|
+
scaleDays: "Tage",
|
|
4
|
+
scaleWeeks: "Wochen",
|
|
5
|
+
scaleMonths: "Monate",
|
|
6
|
+
scaleQuarters: "Quartale",
|
|
7
|
+
rangeFrom: "Von",
|
|
8
|
+
rangeTo: "Bis",
|
|
9
|
+
rangeResetTooltip: "Bereich zurücksetzen",
|
|
10
|
+
columnName: "Name",
|
|
11
|
+
columnStatus: "Status",
|
|
12
|
+
statusPlanned: "Planned",
|
|
13
|
+
statusInProgress: "In Progress",
|
|
14
|
+
statusDone: "Done",
|
|
15
|
+
statusBlocked: "Blocked",
|
|
16
|
+
weekColumnPrefix: "KW",
|
|
17
|
+
todayLabel: "Heute",
|
|
18
|
+
dateLocale: "de-DE",
|
|
19
|
+
dialogAddTitle: "Aufgabe hinzufügen",
|
|
20
|
+
dialogEditTitle: "Aufgabe bearbeiten",
|
|
21
|
+
dialogDeleteTitle: "Aufgabe löschen",
|
|
22
|
+
dialogSave: "Speichern",
|
|
23
|
+
dialogCancel: "Abbrechen",
|
|
24
|
+
dialogDelete: "Löschen",
|
|
25
|
+
dialogFieldName: "Name",
|
|
26
|
+
dialogFieldStartDate: "Startdatum",
|
|
27
|
+
dialogFieldEndDate: "Enddatum",
|
|
28
|
+
dialogFieldStatus: "Status",
|
|
29
|
+
dialogFieldMilestone: "Ist Meilenstein",
|
|
30
|
+
dialogFieldParent: "Übergeordnete Aufgabe",
|
|
31
|
+
dialogFieldParentNone: "— Keine —",
|
|
32
|
+
dialogDeleteConfirm: "Soll die Aufgabe \"{name}\" wirklich gelöscht werden?",
|
|
33
|
+
dialogFieldDependencies: "Vorgänger",
|
|
34
|
+
dialogFieldDependenciesNone: "— Keine —",
|
|
35
|
+
scrollToTodayTooltip: "Zum heutigen Tag",
|
|
36
|
+
expandAllTooltip: "Alle aufklappen",
|
|
37
|
+
collapseAllTooltip: "Alle zuklappen",
|
|
38
|
+
resetViewTooltip: "Ansicht zurücksetzen",
|
|
39
|
+
columnActions: "Aktionen",
|
|
40
|
+
columnAssignee: "Assignee",
|
|
41
|
+
exportCsvTooltip: "Als CSV exportieren",
|
|
42
|
+
addTaskTooltip: "Aufgabe hinzufügen",
|
|
43
|
+
editTaskTooltip: "Aufgabe bearbeiten",
|
|
44
|
+
deleteTaskTooltip: "Aufgabe löschen"
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { e as DEFAULT_GANTT_TRANSLATIONS };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useGanttTranslations as e } from "./GanttChart.js";
|
|
2
|
+
import { Button as t, Dialog as n, DialogActions as r, DialogContent as i, DialogContentText as a, DialogTitle as o } from "@mui/material";
|
|
3
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/gantt-chart/GanttDeleteDialog.tsx
|
|
5
|
+
function l({ open: l, task: u, onConfirm: d, onClose: f }) {
|
|
6
|
+
let p = e(), m = p.dialogDeleteConfirm.replace("{name}", u?.name ?? "");
|
|
7
|
+
return /* @__PURE__ */ c(n, {
|
|
8
|
+
open: l,
|
|
9
|
+
onClose: f,
|
|
10
|
+
maxWidth: "xs",
|
|
11
|
+
fullWidth: !0,
|
|
12
|
+
"data-testid": "gantt-delete-dialog",
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ s(o, { children: p.dialogDeleteTitle }),
|
|
15
|
+
/* @__PURE__ */ s(i, { children: /* @__PURE__ */ s(a, { children: m }) }),
|
|
16
|
+
/* @__PURE__ */ c(r, { children: [/* @__PURE__ */ s(t, {
|
|
17
|
+
onClick: f,
|
|
18
|
+
children: p.dialogCancel
|
|
19
|
+
}), /* @__PURE__ */ s(t, {
|
|
20
|
+
onClick: d,
|
|
21
|
+
variant: "contained",
|
|
22
|
+
color: "error",
|
|
23
|
+
"data-testid": "gantt-dialog-delete-confirm",
|
|
24
|
+
children: p.dialogDelete
|
|
25
|
+
})] })
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { l as GanttDeleteDialog };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useGanttTheme as e } from "./GanttChart.js";
|
|
2
|
+
import { useTheme as t } from "@mui/material";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/gantt-chart/GanttDependencyArrows.tsx
|
|
5
|
+
function i({ dependencyLines: i, todayX: a, totalWidth: o, height: s, top: c, arrowMarkerId: l }) {
|
|
6
|
+
let u = t(), { todayLineColor: d } = e();
|
|
7
|
+
return i.length === 0 && a === null ? null : /* @__PURE__ */ r("svg", {
|
|
8
|
+
"data-testid": "gantt-dependency-arrows",
|
|
9
|
+
style: {
|
|
10
|
+
position: "absolute",
|
|
11
|
+
top: c,
|
|
12
|
+
left: 0,
|
|
13
|
+
width: o,
|
|
14
|
+
height: s,
|
|
15
|
+
pointerEvents: "none",
|
|
16
|
+
overflow: "visible"
|
|
17
|
+
},
|
|
18
|
+
children: [
|
|
19
|
+
i.length > 0 && /* @__PURE__ */ n("defs", { children: /* @__PURE__ */ n("marker", {
|
|
20
|
+
id: l,
|
|
21
|
+
markerWidth: "6",
|
|
22
|
+
markerHeight: "4",
|
|
23
|
+
refX: "5",
|
|
24
|
+
refY: "2",
|
|
25
|
+
orient: "auto",
|
|
26
|
+
children: /* @__PURE__ */ n("polygon", {
|
|
27
|
+
points: "0 0, 6 2, 0 4",
|
|
28
|
+
fill: "currentColor"
|
|
29
|
+
})
|
|
30
|
+
}) }),
|
|
31
|
+
i.map((e) => /* @__PURE__ */ n("path", {
|
|
32
|
+
"data-testid": `gantt-dep-${e.key}`,
|
|
33
|
+
d: e.d,
|
|
34
|
+
fill: "none",
|
|
35
|
+
stroke: "currentColor",
|
|
36
|
+
strokeWidth: 1.5,
|
|
37
|
+
strokeOpacity: .4,
|
|
38
|
+
markerEnd: `url(#${l})`
|
|
39
|
+
}, e.key)),
|
|
40
|
+
a !== null && /* @__PURE__ */ n("line", {
|
|
41
|
+
"data-testid": "gantt-today-line",
|
|
42
|
+
x1: a,
|
|
43
|
+
y1: 0,
|
|
44
|
+
x2: a,
|
|
45
|
+
y2: s,
|
|
46
|
+
stroke: d || u.palette.primary.main,
|
|
47
|
+
strokeWidth: 1.5,
|
|
48
|
+
strokeDasharray: "4 2"
|
|
49
|
+
})
|
|
50
|
+
]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { i as GanttDependencyArrows };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useGanttTranslations as e } from "./GanttChart.js";
|
|
2
|
+
import { Menu as t, MenuItem as n } from "@mui/material";
|
|
3
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/gantt-chart/GanttStatusContextMenu.tsx
|
|
5
|
+
function i({ contextMenu: i, onClose: a, onSelect: o }) {
|
|
6
|
+
let s = e(), c = {
|
|
7
|
+
planned: s.statusPlanned,
|
|
8
|
+
"in-progress": s.statusInProgress,
|
|
9
|
+
done: s.statusDone,
|
|
10
|
+
blocked: s.statusBlocked
|
|
11
|
+
};
|
|
12
|
+
return /* @__PURE__ */ r(t, {
|
|
13
|
+
open: i !== null,
|
|
14
|
+
onClose: a,
|
|
15
|
+
anchorReference: "anchorPosition",
|
|
16
|
+
anchorPosition: i === null ? void 0 : {
|
|
17
|
+
top: i.mouseY,
|
|
18
|
+
left: i.mouseX
|
|
19
|
+
},
|
|
20
|
+
children: [
|
|
21
|
+
"planned",
|
|
22
|
+
"in-progress",
|
|
23
|
+
"done",
|
|
24
|
+
"blocked"
|
|
25
|
+
].map((e) => /* @__PURE__ */ r(n, {
|
|
26
|
+
selected: i?.task.status === e,
|
|
27
|
+
"data-testid": `gantt-status-menu-${e}`,
|
|
28
|
+
onClick: () => {
|
|
29
|
+
i && o(i.task, e);
|
|
30
|
+
},
|
|
31
|
+
children: c[e]
|
|
32
|
+
}, e))
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { i as GanttStatusContextMenu };
|