@thebuoyant-tsdev/mui-ts-library 3.11.0 → 3.11.3

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 (31) hide show
  1. package/README.de.md +21 -0
  2. package/README.md +21 -0
  3. package/dist/components/chord-chart/ChordChart.d.ts +1 -1
  4. package/dist/components/chord-chart/ChordChart.js +155 -137
  5. package/dist/components/chord-chart/ChordChart.types.d.ts +1 -1
  6. package/dist/components/circle-packing-chart/CirclePackingChart.d.ts +1 -1
  7. package/dist/components/circle-packing-chart/CirclePackingChart.js +134 -121
  8. package/dist/components/gantt-chart/GanttTaskDialog.js +131 -126
  9. package/dist/components/gantt-chart/hooks/useGanttDrag.js +44 -38
  10. package/dist/components/gantt-chart/util/gantt-chart.util.d.ts +7 -0
  11. package/dist/components/gantt-chart/util/gantt-chart.util.js +31 -20
  12. package/dist/components/horizontal-tree-chart/HorizontalTreeChart.js +222 -206
  13. package/dist/components/horizontal-tree-chart/HorizontalTreeChart.types.d.ts +1 -1
  14. package/dist/components/json-editor/JsonEditorContent.js +134 -119
  15. package/dist/components/json-editor/JsonEditorToolbar.js +3 -3
  16. package/dist/components/password-strength-meter/PasswordStrengthMeter.js +131 -130
  17. package/dist/components/radial-tree-chart/RadialTreeChart.js +197 -186
  18. package/dist/components/rich-text-editor/RichTextEditor.js +1 -1
  19. package/dist/components/rich-text-editor/RichTextEditorMarkdownDialog.js +40 -39
  20. package/dist/components/shared/useTimedFlag.d.ts +6 -0
  21. package/dist/components/shared/useTimedFlag.js +14 -0
  22. package/dist/components/sql-editor/SqlEditorHistoryMenu.js +1 -1
  23. package/dist/components/sql-editor/useSqlQueryHistory.js +14 -12
  24. package/dist/components/sql-editor/util/sqlQueryHistory.util.d.ts +1 -0
  25. package/dist/components/sql-editor/util/sqlQueryHistory.util.js +21 -13
  26. package/dist/components/sunburst-chart/SunburstChart.d.ts +1 -1
  27. package/dist/components/sunburst-chart/SunburstChart.js +126 -115
  28. package/dist/components/tag-selection/TagSelectionAutocomplete.js +7 -5
  29. package/dist/index.cjs +2 -2
  30. package/dist/index.js +7 -7
  31. package/package.json +1 -1
@@ -1,23 +1,24 @@
1
- import { useGanttChartStore as e, useGanttTranslations as t } from "./GanttChart.js";
2
- import { useEffect as n, useMemo as r, useRef as i, useState as a } from "react";
3
- import { Box as o, Button as s, Checkbox as c, Dialog as l, DialogActions as u, DialogContent as d, DialogTitle as f, FormControl as p, FormControlLabel as m, InputLabel as h, MenuItem as g, Select as _, TextField as v, Tooltip as y, Typography as b } from "@mui/material";
4
- import { jsx as x, jsxs as S } from "react/jsx-runtime";
1
+ import { getDependencyCycleCandidates as e } from "./util/gantt-chart.util.js";
2
+ import { useGanttChartStore as t, useGanttTranslations as n } from "./GanttChart.js";
3
+ import { useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
4
+ import { Box as s, Button as c, Checkbox as l, Dialog as u, DialogActions as d, DialogContent as f, DialogTitle as p, FormControl as m, FormControlLabel as h, InputLabel as g, MenuItem as _, Select as v, TextField as y, Tooltip as b, Typography as x } from "@mui/material";
5
+ import { jsx as S, jsxs as C } from "react/jsx-runtime";
5
6
  //#region src/components/gantt-chart/GanttTaskDialog.tsx
6
- function C(e) {
7
+ function w(e) {
7
8
  return e.toISOString().slice(0, 10);
8
9
  }
9
- function w(e, t, n) {
10
+ function T(e, t, n) {
10
11
  return e < t ? t : e > n ? n : e;
11
12
  }
12
- function T(e) {
13
- return e.flatMap((e) => [e, ...T(e.children)]);
13
+ function E(e) {
14
+ return e.flatMap((e) => [e, ...E(e.children)]);
14
15
  }
15
- function E({ label: e }) {
16
- let t = i(null), [n, r] = a(!1);
17
- return /* @__PURE__ */ x(y, {
16
+ function D({ label: e }) {
17
+ let t = a(null), [n, r] = o(!1);
18
+ return /* @__PURE__ */ S(b, {
18
19
  title: e,
19
20
  disableHoverListener: !n,
20
- children: /* @__PURE__ */ x(b, {
21
+ children: /* @__PURE__ */ S(x, {
21
22
  ref: t,
22
23
  component: "span",
23
24
  variant: "body2",
@@ -35,102 +36,106 @@ function E({ label: e }) {
35
36
  })
36
37
  });
37
38
  }
38
- function D({ open: i, mode: y, initialTask: D, defaultParentId: O, onSave: k, onClose: A }) {
39
- let j = t(), M = e((e) => e.taskTree), N = e((e) => e.timelineRange), P = r(() => T(M), [M]), F = r(() => {
40
- if (y === "add" || !D) return /* @__PURE__ */ new Set();
41
- let e = (t) => [t.id, ...t.children.flatMap(e)], t = P.find((e) => e.id === D.id);
42
- return new Set(t ? e(t) : [D.id]);
39
+ function O({ open: a, mode: b, initialTask: O, defaultParentId: k, onSave: A, onClose: j }) {
40
+ let M = n(), N = t((e) => e.taskTree), P = t((e) => e.timelineRange), F = i(() => E(N), [N]), I = i(() => {
41
+ if (b === "add" || !O) return /* @__PURE__ */ new Set();
42
+ let e = (t) => [t.id, ...t.children.flatMap(e)], t = F.find((e) => e.id === O.id);
43
+ return new Set(t ? e(t) : [O.id]);
43
44
  }, [
44
- y,
45
- D,
46
- P
47
- ]), I = P.filter((e) => !F.has(e.id)), L = I, R = C(w(/* @__PURE__ */ new Date(), N.start, N.end)), [z, B] = a({
45
+ b,
46
+ O,
47
+ F
48
+ ]), L = F.filter((e) => !I.has(e.id)), R = i(() => b === "add" || !O ? /* @__PURE__ */ new Set() : e(F, O.id), [
49
+ b,
50
+ O,
51
+ F
52
+ ]), z = L.filter((e) => !R.has(e.id)), B = w(T(/* @__PURE__ */ new Date(), P.start, P.end)), [V, H] = o({
48
53
  name: "",
49
- startDate: R,
50
- endDate: R,
54
+ startDate: B,
55
+ endDate: B,
51
56
  status: "planned",
52
57
  isMilestone: !1,
53
58
  parentId: "",
54
59
  dependencies: [],
55
60
  assignee: ""
56
61
  });
57
- n(() => {
58
- if (!i) return;
59
- let e = C(w(/* @__PURE__ */ new Date(), N.start, N.end));
60
- B(y === "edit" && D ? {
61
- name: D.name,
62
- startDate: C(D.startDate),
63
- endDate: C(D.endDate),
64
- status: D.status,
65
- isMilestone: D.isMilestone ?? !1,
66
- parentId: D.parentId ?? "",
67
- dependencies: D.dependencies ?? [],
68
- assignee: D.assignee ?? ""
62
+ r(() => {
63
+ if (!a) return;
64
+ let e = w(T(/* @__PURE__ */ new Date(), P.start, P.end));
65
+ H(b === "edit" && O ? {
66
+ name: O.name,
67
+ startDate: w(O.startDate),
68
+ endDate: w(O.endDate),
69
+ status: O.status,
70
+ isMilestone: O.isMilestone ?? !1,
71
+ parentId: O.parentId ?? "",
72
+ dependencies: O.dependencies ?? [],
73
+ assignee: O.assignee ?? ""
69
74
  } : {
70
75
  name: "",
71
76
  startDate: e,
72
77
  endDate: e,
73
78
  status: "planned",
74
79
  isMilestone: !1,
75
- parentId: O ?? "",
80
+ parentId: k ?? "",
76
81
  dependencies: [],
77
82
  assignee: ""
78
83
  });
79
84
  }, [
80
- i,
81
- y,
82
- D,
85
+ a,
86
+ b,
83
87
  O,
84
- N
88
+ k,
89
+ P
85
90
  ]);
86
- let V = (e) => {
87
- B((t) => ({
91
+ let U = (e) => {
92
+ H((t) => ({
88
93
  ...t,
89
94
  startDate: e,
90
95
  endDate: t.isMilestone || t.endDate < e ? e : t.endDate
91
96
  }));
92
- }, H = (e) => {
93
- B((t) => ({
97
+ }, W = (e) => {
98
+ H((t) => ({
94
99
  ...t,
95
100
  endDate: e < t.startDate ? t.startDate : e
96
101
  }));
97
- }, U = (e) => {
98
- B((t) => ({
102
+ }, G = (e) => {
103
+ H((t) => ({
99
104
  ...t,
100
105
  isMilestone: e,
101
106
  endDate: e ? t.startDate : t.endDate
102
107
  }));
103
- }, W = z.name.trim() !== "" && z.startDate !== "" && z.endDate !== "" && z.endDate >= z.startDate, G = () => {
104
- W && k({
105
- name: z.name.trim(),
106
- startDate: new Date(z.startDate),
107
- endDate: new Date(z.endDate),
108
- status: z.status,
109
- isMilestone: z.isMilestone || void 0,
110
- parentId: z.parentId || void 0,
111
- dependencies: z.dependencies.length > 0 ? z.dependencies : void 0,
112
- assignee: z.assignee.trim() || void 0
108
+ }, K = V.name.trim() !== "" && V.startDate !== "" && V.endDate !== "" && V.endDate >= V.startDate, q = () => {
109
+ K && A({
110
+ name: V.name.trim(),
111
+ startDate: new Date(V.startDate),
112
+ endDate: new Date(V.endDate),
113
+ status: V.status,
114
+ isMilestone: V.isMilestone || void 0,
115
+ parentId: V.parentId || void 0,
116
+ dependencies: V.dependencies.length > 0 ? V.dependencies : void 0,
117
+ assignee: V.assignee.trim() || void 0
113
118
  });
114
- }, K = [
119
+ }, J = [
115
120
  "planned",
116
121
  "in-progress",
117
122
  "done",
118
123
  "blocked"
119
- ], q = {
120
- planned: j.statusPlanned,
121
- "in-progress": j.statusInProgress,
122
- done: j.statusDone,
123
- blocked: j.statusBlocked
124
+ ], Y = {
125
+ planned: M.statusPlanned,
126
+ "in-progress": M.statusInProgress,
127
+ done: M.statusDone,
128
+ blocked: M.statusBlocked
124
129
  };
125
- return /* @__PURE__ */ S(l, {
126
- open: i,
127
- onClose: A,
130
+ return /* @__PURE__ */ C(u, {
131
+ open: a,
132
+ onClose: j,
128
133
  maxWidth: "xs",
129
134
  fullWidth: !0,
130
135
  "data-testid": "gantt-task-dialog",
131
136
  children: [
132
- /* @__PURE__ */ x(f, { children: y === "add" ? j.dialogAddTitle : j.dialogEditTitle }),
133
- /* @__PURE__ */ S(d, {
137
+ /* @__PURE__ */ S(p, { children: b === "add" ? M.dialogAddTitle : M.dialogEditTitle }),
138
+ /* @__PURE__ */ C(f, {
134
139
  sx: {
135
140
  display: "flex",
136
141
  flexDirection: "column",
@@ -138,10 +143,10 @@ function D({ open: i, mode: y, initialTask: D, defaultParentId: O, onSave: k, on
138
143
  pt: "16px !important"
139
144
  },
140
145
  children: [
141
- /* @__PURE__ */ x(v, {
142
- label: j.dialogFieldName,
143
- value: z.name,
144
- onChange: (e) => B((t) => ({
146
+ /* @__PURE__ */ S(y, {
147
+ label: M.dialogFieldName,
148
+ value: V.name,
149
+ onChange: (e) => H((t) => ({
145
150
  ...t,
146
151
  name: e.target.value
147
152
  })),
@@ -151,10 +156,10 @@ function D({ open: i, mode: y, initialTask: D, defaultParentId: O, onSave: k, on
151
156
  autoFocus: !0,
152
157
  slotProps: { htmlInput: { "data-testid": "gantt-dialog-field-name" } }
153
158
  }),
154
- /* @__PURE__ */ x(v, {
155
- label: j.columnAssignee,
156
- value: z.assignee,
157
- onChange: (e) => B((t) => ({
159
+ /* @__PURE__ */ S(y, {
160
+ label: M.columnAssignee,
161
+ value: V.assignee,
162
+ onChange: (e) => H((t) => ({
158
163
  ...t,
159
164
  assignee: e.target.value
160
165
  })),
@@ -163,11 +168,11 @@ function D({ open: i, mode: y, initialTask: D, defaultParentId: O, onSave: k, on
163
168
  placeholder: "e.g. Jane Smith",
164
169
  slotProps: { htmlInput: { "data-testid": "gantt-dialog-field-assignee" } }
165
170
  }),
166
- /* @__PURE__ */ x(v, {
167
- label: j.dialogFieldStartDate,
171
+ /* @__PURE__ */ S(y, {
172
+ label: M.dialogFieldStartDate,
168
173
  type: "date",
169
- value: z.startDate,
170
- onChange: (e) => V(e.target.value),
174
+ value: V.startDate,
175
+ onChange: (e) => U(e.target.value),
171
176
  required: !0,
172
177
  fullWidth: !0,
173
178
  size: "small",
@@ -176,68 +181,68 @@ function D({ open: i, mode: y, initialTask: D, defaultParentId: O, onSave: k, on
176
181
  htmlInput: { "data-testid": "gantt-dialog-field-start" }
177
182
  }
178
183
  }),
179
- /* @__PURE__ */ x(v, {
180
- label: j.dialogFieldEndDate,
184
+ /* @__PURE__ */ S(y, {
185
+ label: M.dialogFieldEndDate,
181
186
  type: "date",
182
- value: z.endDate,
183
- onChange: (e) => H(e.target.value),
187
+ value: V.endDate,
188
+ onChange: (e) => W(e.target.value),
184
189
  required: !0,
185
190
  fullWidth: !0,
186
191
  size: "small",
187
- disabled: z.isMilestone,
192
+ disabled: V.isMilestone,
188
193
  slotProps: {
189
194
  inputLabel: { shrink: !0 },
190
195
  htmlInput: {
191
196
  "data-testid": "gantt-dialog-field-end",
192
- min: z.startDate
197
+ min: V.startDate
193
198
  }
194
199
  }
195
200
  }),
196
- /* @__PURE__ */ S(p, {
201
+ /* @__PURE__ */ C(m, {
197
202
  size: "small",
198
203
  fullWidth: !0,
199
- children: [/* @__PURE__ */ x(h, { children: j.dialogFieldStatus }), /* @__PURE__ */ x(_, {
200
- value: z.status,
201
- label: j.dialogFieldStatus,
202
- onChange: (e) => B((t) => ({
204
+ children: [/* @__PURE__ */ S(g, { children: M.dialogFieldStatus }), /* @__PURE__ */ S(v, {
205
+ value: V.status,
206
+ label: M.dialogFieldStatus,
207
+ onChange: (e) => H((t) => ({
203
208
  ...t,
204
209
  status: e.target.value
205
210
  })),
206
211
  inputProps: { "data-testid": "gantt-dialog-field-status" },
207
- children: K.map((e) => /* @__PURE__ */ x(g, {
212
+ children: J.map((e) => /* @__PURE__ */ S(_, {
208
213
  value: e,
209
- children: q[e]
214
+ children: Y[e]
210
215
  }, e))
211
216
  })]
212
217
  }),
213
- /* @__PURE__ */ x(m, {
214
- control: /* @__PURE__ */ x(c, {
215
- checked: z.isMilestone,
216
- onChange: (e) => U(e.target.checked),
218
+ /* @__PURE__ */ S(h, {
219
+ control: /* @__PURE__ */ S(l, {
220
+ checked: V.isMilestone,
221
+ onChange: (e) => G(e.target.checked),
217
222
  size: "small",
218
223
  "data-testid": "gantt-dialog-field-milestone"
219
224
  }),
220
- label: j.dialogFieldMilestone
225
+ label: M.dialogFieldMilestone
221
226
  }),
222
- /* @__PURE__ */ S(p, {
227
+ /* @__PURE__ */ C(m, {
223
228
  size: "small",
224
229
  fullWidth: !0,
225
- children: [/* @__PURE__ */ x(h, { children: j.dialogFieldParent }), /* @__PURE__ */ S(_, {
226
- value: z.parentId,
227
- label: j.dialogFieldParent,
228
- onChange: (e) => B((t) => ({
230
+ children: [/* @__PURE__ */ S(g, { children: M.dialogFieldParent }), /* @__PURE__ */ C(v, {
231
+ value: V.parentId,
232
+ label: M.dialogFieldParent,
233
+ onChange: (e) => H((t) => ({
229
234
  ...t,
230
235
  parentId: e.target.value
231
236
  })),
232
237
  inputProps: { "data-testid": "gantt-dialog-field-parent" },
233
238
  MenuProps: { slotProps: { paper: { sx: { maxHeight: 280 } } } },
234
- children: [/* @__PURE__ */ x(g, {
239
+ children: [/* @__PURE__ */ S(_, {
235
240
  value: "",
236
- children: j.dialogFieldParentNone
237
- }), I.map((e) => /* @__PURE__ */ x(g, {
241
+ children: M.dialogFieldParentNone
242
+ }), L.map((e) => /* @__PURE__ */ S(_, {
238
243
  value: e.id,
239
244
  sx: { minWidth: 0 },
240
- children: /* @__PURE__ */ S(o, {
245
+ children: /* @__PURE__ */ C(s, {
241
246
  sx: {
242
247
  display: "flex",
243
248
  alignItems: "center",
@@ -247,7 +252,7 @@ function D({ open: i, mode: y, initialTask: D, defaultParentId: O, onSave: k, on
247
252
  width: "100%",
248
253
  overflow: "hidden"
249
254
  },
250
- children: [e.depth > 0 && /* @__PURE__ */ x(b, {
255
+ children: [e.depth > 0 && /* @__PURE__ */ S(x, {
251
256
  component: "span",
252
257
  variant: "caption",
253
258
  sx: {
@@ -256,32 +261,32 @@ function D({ open: i, mode: y, initialTask: D, defaultParentId: O, onSave: k, on
256
261
  flexShrink: 0
257
262
  },
258
263
  children: "└"
259
- }), /* @__PURE__ */ x(E, { label: e.name })]
264
+ }), /* @__PURE__ */ S(D, { label: e.name })]
260
265
  })
261
266
  }, e.id))]
262
267
  })]
263
268
  }),
264
- /* @__PURE__ */ S(p, {
269
+ /* @__PURE__ */ C(m, {
265
270
  size: "small",
266
271
  fullWidth: !0,
267
- children: [/* @__PURE__ */ x(h, { children: j.dialogFieldDependencies }), /* @__PURE__ */ x(_, {
272
+ children: [/* @__PURE__ */ S(g, { children: M.dialogFieldDependencies }), /* @__PURE__ */ S(v, {
268
273
  multiple: !0,
269
- value: z.dependencies,
270
- label: j.dialogFieldDependencies,
274
+ value: V.dependencies,
275
+ label: M.dialogFieldDependencies,
271
276
  onChange: (e) => {
272
277
  let t = e.target.value;
273
- B((e) => ({
278
+ H((e) => ({
274
279
  ...e,
275
280
  dependencies: typeof t == "string" ? t.split(",") : t
276
281
  }));
277
282
  },
278
283
  inputProps: { "data-testid": "gantt-dialog-field-dependencies" },
279
- renderValue: (e) => e.length === 0 ? j.dialogFieldDependenciesNone : e.map((e) => P.find((t) => t.id === e)?.name ?? e).join(", "),
284
+ renderValue: (e) => e.length === 0 ? M.dialogFieldDependenciesNone : e.map((e) => F.find((t) => t.id === e)?.name ?? e).join(", "),
280
285
  MenuProps: { slotProps: { paper: { sx: { maxHeight: 280 } } } },
281
- children: L.map((e) => /* @__PURE__ */ x(g, {
286
+ children: z.map((e) => /* @__PURE__ */ S(_, {
282
287
  value: e.id,
283
288
  sx: { minWidth: 0 },
284
- children: /* @__PURE__ */ S(o, {
289
+ children: /* @__PURE__ */ C(s, {
285
290
  sx: {
286
291
  display: "flex",
287
292
  alignItems: "center",
@@ -291,7 +296,7 @@ function D({ open: i, mode: y, initialTask: D, defaultParentId: O, onSave: k, on
291
296
  width: "100%",
292
297
  overflow: "hidden"
293
298
  },
294
- children: [e.depth > 0 && /* @__PURE__ */ x(b, {
299
+ children: [e.depth > 0 && /* @__PURE__ */ S(x, {
295
300
  component: "span",
296
301
  variant: "caption",
297
302
  sx: {
@@ -300,25 +305,25 @@ function D({ open: i, mode: y, initialTask: D, defaultParentId: O, onSave: k, on
300
305
  flexShrink: 0
301
306
  },
302
307
  children: "└"
303
- }), /* @__PURE__ */ x(E, { label: e.name })]
308
+ }), /* @__PURE__ */ S(D, { label: e.name })]
304
309
  })
305
310
  }, e.id))
306
311
  })]
307
312
  })
308
313
  ]
309
314
  }),
310
- /* @__PURE__ */ S(u, { children: [/* @__PURE__ */ x(s, {
311
- onClick: A,
312
- children: j.dialogCancel
313
- }), /* @__PURE__ */ x(s, {
314
- onClick: G,
315
+ /* @__PURE__ */ C(d, { children: [/* @__PURE__ */ S(c, {
316
+ onClick: j,
317
+ children: M.dialogCancel
318
+ }), /* @__PURE__ */ S(c, {
319
+ onClick: q,
315
320
  variant: "contained",
316
- disabled: !W,
321
+ disabled: !K,
317
322
  "data-testid": "gantt-dialog-save",
318
- children: j.dialogSave
323
+ children: M.dialogSave
319
324
  })] })
320
325
  ]
321
326
  });
322
327
  }
323
328
  //#endregion
324
- export { D as GanttTaskDialog };
329
+ export { O as GanttTaskDialog };
@@ -1,19 +1,21 @@
1
1
  import { addDays as e } from "../util/gantt-chart.util.js";
2
2
  import { useGanttChartStore as t, useGanttTranslations as n, useRawGanttChartStore as r } from "../GanttChart.js";
3
- import { useLayoutEffect as i, useRef as a, useState as o } from "react";
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
- var s = 864e5;
6
- function c({ totalWidth: c, displayRange: l, onTaskMoved: u, onTaskResized: d, onTasksChange: f }) {
7
- let p = t((e) => e.updateTask), m = r(), h = n(), g = a(1), _ = a(u), v = a(d), y = a(f);
8
- i(() => {
9
- g.current = c > 0 ? c / ((l.end.getTime() - l.start.getTime()) / s) : 1, _.current = u, v.current = d, y.current = f;
5
+ var c = 864e5;
6
+ function l({ totalWidth: l, displayRange: u, onTaskMoved: d, onTaskResized: f, onTasksChange: p }) {
7
+ let m = t((e) => e.updateTask), h = r(), g = n(), _ = o(1), v = o(d), y = o(f), b = o(p);
8
+ a(() => {
9
+ _.current = l > 0 ? l / ((u.end.getTime() - u.start.getTime()) / c) : 1, v.current = d, y.current = f, b.current = p;
10
10
  });
11
- let b = a(null), x = a(null), [S, C] = o(null), w = a(!1);
12
- return {
13
- activeDrag: S,
14
- suppressClickRef: w,
11
+ let x = o(null), S = o(null), [C, w] = s(null), T = o(!1), E = o(null);
12
+ return i(() => () => {
13
+ E.current?.();
14
+ }, []), {
15
+ activeDrag: C,
16
+ suppressClickRef: T,
15
17
  handleBarMouseDown: (t, n, r) => {
16
- t.stopPropagation(), w.current = !1, b.current = {
18
+ t.stopPropagation(), T.current = !1, x.current = {
17
19
  type: r,
18
20
  taskId: n.id,
19
21
  startX: t.clientX,
@@ -21,45 +23,47 @@ function c({ totalWidth: c, displayRange: l, onTaskMoved: u, onTaskResized: d, o
21
23
  originalEnd: n.endDate
22
24
  }, document.body.style.cursor = r === "resize" ? "ew-resize" : "grabbing";
23
25
  let i = (e) => {
24
- let t = b.current;
26
+ let t = x.current;
25
27
  if (!t || t.type === "progress") return;
26
- let n = e.clientX - t.startX, r = Math.round(n / g.current);
27
- Math.abs(n) >= 5 && (w.current = !0);
28
+ let n = e.clientX - t.startX, r = Math.round(n / _.current);
29
+ Math.abs(n) >= 5 && (T.current = !0);
28
30
  let i = {
29
31
  taskId: t.taskId,
30
32
  type: t.type,
31
33
  deltaDays: r
32
34
  };
33
- x.current = i, C(i);
35
+ S.current = i, w(i);
34
36
  }, a = () => {
35
37
  document.body.style.cursor = "";
36
- let t = b.current, n = x.current;
37
- if (t && n && w.current && n.deltaDays !== 0) {
38
- let r = m.getState().tasks.find((e) => e.id === t.taskId);
38
+ let t = x.current, n = S.current;
39
+ if (t && n && T.current && n.deltaDays !== 0) {
40
+ let r = h.getState().tasks.find((e) => e.id === t.taskId);
39
41
  if (r) {
40
42
  if (n.type === "move") {
41
43
  let i = e(t.originalStart, n.deltaDays), a = e(t.originalEnd, n.deltaDays);
42
- p({
44
+ m({
43
45
  ...r,
44
46
  startDate: i,
45
47
  endDate: a
46
- }), _.current?.(r, i, a);
48
+ }), v.current?.(r, i, a);
47
49
  } else {
48
50
  let i = e(t.originalEnd, n.deltaDays), a = i > t.originalStart ? i : e(t.originalStart, 1);
49
- p({
51
+ m({
50
52
  ...r,
51
53
  endDate: a
52
- }), v.current?.(r, a);
54
+ }), y.current?.(r, a);
53
55
  }
54
- y.current?.(m.getState().tasks);
56
+ b.current?.(h.getState().tasks);
55
57
  }
56
58
  }
57
- b.current = null, x.current = null, C(null), document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", a);
59
+ x.current = null, S.current = null, w(null), document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", a), E.current = null;
60
+ };
61
+ document.addEventListener("mousemove", i), document.addEventListener("mouseup", a), E.current = () => {
62
+ document.body.style.cursor = "", document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", a);
58
63
  };
59
- document.addEventListener("mousemove", i), document.addEventListener("mouseup", a);
60
64
  },
61
65
  handleProgressMouseDown: (e, t, n, r) => {
62
- e.stopPropagation(), w.current = !1, b.current = {
66
+ e.stopPropagation(), T.current = !1, x.current = {
63
67
  type: "progress",
64
68
  taskId: t.id,
65
69
  startX: e.clientX,
@@ -69,36 +73,38 @@ function c({ totalWidth: c, displayRange: l, onTaskMoved: u, onTaskResized: d, o
69
73
  barWidthPx: r
70
74
  }, document.body.style.cursor = "ew-resize";
71
75
  let i = (e) => {
72
- let t = b.current;
76
+ let t = x.current;
73
77
  if (!t || t.type !== "progress") return;
74
78
  let n = e.clientX - t.startX;
75
- Math.abs(n) >= 5 && (w.current = !0);
79
+ Math.abs(n) >= 5 && (T.current = !0);
76
80
  let r = n / (t.barWidthPx ?? 1) * 100, i = Math.round(Math.max(0, Math.min(100, (t.initialProgress ?? 0) + r))), a = {
77
81
  taskId: t.taskId,
78
82
  type: "progress",
79
83
  deltaDays: 0,
80
84
  newProgress: i
81
85
  };
82
- x.current = a, C(a);
86
+ S.current = a, w(a);
83
87
  }, a = () => {
84
88
  document.body.style.cursor = "";
85
- let e = b.current, t = x.current;
86
- if (e && t && t.type === "progress" && t.newProgress !== void 0 && w.current) {
87
- let n = m.getState().tasks.find((t) => t.id === e.taskId);
88
- n && (p({
89
+ let e = x.current, t = S.current;
90
+ if (e && t && t.type === "progress" && t.newProgress !== void 0 && T.current) {
91
+ let n = h.getState().tasks.find((t) => t.id === e.taskId);
92
+ n && (m({
89
93
  ...n,
90
94
  progress: t.newProgress
91
- }), y.current?.(m.getState().tasks));
95
+ }), b.current?.(h.getState().tasks));
92
96
  }
93
- b.current = null, x.current = null, C(null), document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", a);
97
+ x.current = null, S.current = null, w(null), document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", a), E.current = null;
98
+ };
99
+ document.addEventListener("mousemove", i), document.addEventListener("mouseup", a), E.current = () => {
100
+ document.body.style.cursor = "", document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", a);
94
101
  };
95
- document.addEventListener("mousemove", i), document.addEventListener("mouseup", a);
96
102
  },
97
- formatDragDate: (e) => e.toLocaleDateString(h.dateLocale, {
103
+ formatDragDate: (e) => e.toLocaleDateString(g.dateLocale, {
98
104
  day: "2-digit",
99
105
  month: "short"
100
106
  })
101
107
  };
102
108
  }
103
109
  //#endregion
104
- export { c as useGanttDrag };
110
+ export { l as useGanttDrag };
@@ -39,6 +39,13 @@ export declare function addDays(date: Date, days: number): Date;
39
39
  * das `visited`-Set abgefangen.
40
40
  */
41
41
  export declare function cascadeDateUpdate(tasks: GanttTask[], changedTaskId: string, deltaMs: number): GanttTask[];
42
+ /**
43
+ * Liefert alle Task-IDs, die — direkt oder transitiv — bereits von `taskId` abhängen
44
+ * (d.h. taskId als Vorgänger in ihrer dependencies-Kette haben). Würde taskId selbst
45
+ * von einer dieser IDs abhängen, entstünde ein Zyklus (Deadlock: beide warten aufeinander) —
46
+ * diese IDs müssen also aus den für taskId wählbaren Dependency-Optionen ausgeschlossen werden.
47
+ */
48
+ export declare function getDependencyCycleCandidates(tasks: GanttTask[], taskId: string): Set<string>;
42
49
  /**
43
50
  * Gibt alle Monatsersten zwischen start und end zurück.
44
51
  * Wird für den Timeline-Header benötigt.