vlite3 1.4.32 → 1.4.34
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.md +7 -0
- package/components/Alert.vue.js +45 -40
- package/components/Barcode/Barcode.vue.js +34 -21
- package/components/CategoryManager/CategoryNode.vue.js +30 -30
- package/components/CategoryMenu/CategoryMenu.vue.js +9 -11
- package/components/Chart/GanttChart.vue.d.ts +5 -1
- package/components/Chart/GanttChart.vue.js +2 -2
- package/components/Chart/GanttChart.vue2.js +977 -812
- package/components/Chart/GanttChartConnectorRouting.d.ts +83 -0
- package/components/Chart/GanttChartConnectorRouting.js +405 -0
- package/components/Chart/GanttChartDependencyUtils.js +43 -47
- package/components/Chart/types.d.ts +16 -1
- package/components/ColorPicker/ColorIro.vue2.js +78 -64
- package/components/ColorPicker/ColorPicker.vue.d.ts +5 -0
- package/components/ColorPicker/ColorPicker.vue.js +110 -64
- package/components/ColorPicker/constants.d.ts +2 -0
- package/components/ColorPicker/constants.js +4 -0
- package/components/ColorPicker/index.d.ts +1 -0
- package/components/Dropdown/Dropdown.vue.js +100 -97
- package/components/ExportData/ExportData.vue.js +85 -63
- package/components/FilePreview/FilePreview.vue.js +31 -13
- package/components/Form/FormField.vue.js +9 -8
- package/components/ImportData/ImportStep1.vue.js +80 -75
- package/components/Kanban/Kanban.vue.d.ts +16 -2
- package/components/Kanban/Kanban.vue.js +2 -2
- package/components/Kanban/Kanban.vue2.js +150 -86
- package/components/Kanban/types.d.ts +37 -0
- package/components/QRCode/QRCode.vue.js +31 -26
- package/components/ToastNotification.vue.js +1 -1
- package/components/ToastNotification.vue2.js +3 -3
- package/components/index.d.ts +1 -1
- package/composables/useKeyStroke.d.ts +18 -0
- package/composables/useKeyStroke.js +103 -77
- package/composables/useTheme.js +1 -1
- package/directives/vScrollReveal.js +23 -18
- package/index.d.ts +1 -0
- package/index.js +235 -233
- package/package.json +11 -4
- package/style.css +1 -1
- package/utils/UtilsModuleInterop.d.ts +6 -0
- package/utils/UtilsModuleInterop.js +9 -0
- package/utils/environment.d.ts +29 -0
- package/utils/environment.js +4 -0
- package/utils/functions.js +14 -13
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Obstacle-aware dependency connector routing for GanttChart.
|
|
3
|
+
*
|
|
4
|
+
* Replaces the fixed elbow calculation with a deterministic router that:
|
|
5
|
+
* - anchors finish-to-start edges on the predecessor's right edge and the
|
|
6
|
+
* successor's left edge (milestones use the diamond tips)
|
|
7
|
+
* - distributes exit / entry points when several edges share a task so
|
|
8
|
+
* arrowheads and stubs never stack
|
|
9
|
+
* - generates orthogonal candidate paths per edge (direct, Z-shaped and
|
|
10
|
+
* row-corridor routes, plus variants that slide vertical runs past
|
|
11
|
+
* blocking bars) and picks the cheapest one by length + turns +
|
|
12
|
+
* task-bar collisions + connector crossings/overlaps + viewport cost
|
|
13
|
+
* - nudges coincident segments into separate lanes so parallel connectors
|
|
14
|
+
* stay individually traceable
|
|
15
|
+
* - renders unavoidable crossings with a small line bridge (hop) instead
|
|
16
|
+
* of visually merging two connectors
|
|
17
|
+
*
|
|
18
|
+
* The router is pure and layout-driven: the same bars and edges always
|
|
19
|
+
* produce the same paths (no randomness, input-order independent). It
|
|
20
|
+
* knows nothing about dependency semantics — callers must only pass
|
|
21
|
+
* schedule edges (related-to never reaches here).
|
|
22
|
+
*/
|
|
23
|
+
export interface GanttConnectorBar {
|
|
24
|
+
id: string;
|
|
25
|
+
/** Bar left edge in timeline SVG coordinates */
|
|
26
|
+
x: number;
|
|
27
|
+
/** Bar top edge in timeline SVG coordinates */
|
|
28
|
+
y: number;
|
|
29
|
+
/** Full bar width (not progress width) */
|
|
30
|
+
w: number;
|
|
31
|
+
/** Bar height */
|
|
32
|
+
h: number;
|
|
33
|
+
/** Visible row index the bar sits on */
|
|
34
|
+
row: number;
|
|
35
|
+
milestone?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface GanttConnectorEdge {
|
|
38
|
+
predecessorId: string;
|
|
39
|
+
successorId: string;
|
|
40
|
+
/** Stable edge key (see ganttDependencyEdgeKey) */
|
|
41
|
+
key: string;
|
|
42
|
+
}
|
|
43
|
+
export interface GanttRoutedConnector {
|
|
44
|
+
key: string;
|
|
45
|
+
predecessorId: string;
|
|
46
|
+
successorId: string;
|
|
47
|
+
/** Rounded orthogonal SVG path for the connector line */
|
|
48
|
+
d: string;
|
|
49
|
+
/** Arrowhead path entering the successor's left edge */
|
|
50
|
+
ad: string;
|
|
51
|
+
/** On-path midpoint (delete control / label placement) */
|
|
52
|
+
midX: number;
|
|
53
|
+
midY: number;
|
|
54
|
+
}
|
|
55
|
+
export interface GanttConnectorRoutingOptions {
|
|
56
|
+
rowHeight: number;
|
|
57
|
+
barHeight: number;
|
|
58
|
+
/** Timeline drawing width — routes are kept inside the viewport */
|
|
59
|
+
chartWidth: number;
|
|
60
|
+
/** Timeline drawing height */
|
|
61
|
+
chartHeight: number;
|
|
62
|
+
cornerRadius?: number;
|
|
63
|
+
arrowSize?: number;
|
|
64
|
+
}
|
|
65
|
+
type Pt = {
|
|
66
|
+
x: number;
|
|
67
|
+
y: number;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Build an SVG path with consistent rounded corners and crossing bridges.
|
|
71
|
+
* Exposed for reuse by the lightweight interaction preview.
|
|
72
|
+
*/
|
|
73
|
+
export declare function ganttRoundedConnectorPath(points: ReadonlyArray<Pt>, radius?: number, bridges?: Map<number, number[]>): string;
|
|
74
|
+
/** Arrowhead entering horizontally from the left, tip at (x, y) */
|
|
75
|
+
export declare function ganttConnectorArrowPath(x: number, y: number, size?: number): string;
|
|
76
|
+
/**
|
|
77
|
+
* Lightweight connector path used while dragging/resizing. No obstacle
|
|
78
|
+
* lookup — just the classic elbow with the same rounded-corner styling —
|
|
79
|
+
* so per-frame updates stay cheap. Final routing runs after the gesture.
|
|
80
|
+
*/
|
|
81
|
+
export declare function ganttConnectorPreviewPath(fX: number, fY: number, tX: number, tY: number, rowHeight: number, barHeight: number, radius?: number): string;
|
|
82
|
+
export declare function routeGanttDependencyConnectors(edges: GanttConnectorEdge[], barsById: ReadonlyMap<string, GanttConnectorBar>, options: GanttConnectorRoutingOptions): GanttRoutedConnector[];
|
|
83
|
+
export {};
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
const g = (t) => Math.round(t * 100) / 100, H = (t, n, e) => Math.min(e, Math.max(n, t));
|
|
2
|
+
function P(t) {
|
|
3
|
+
return t.h * 0.4;
|
|
4
|
+
}
|
|
5
|
+
function k(t) {
|
|
6
|
+
return t.milestone ? t.x + t.w / 2 + P(t) : t.x + t.w;
|
|
7
|
+
}
|
|
8
|
+
function U(t) {
|
|
9
|
+
return t.milestone ? t.x + t.w / 2 - P(t) : t.x;
|
|
10
|
+
}
|
|
11
|
+
function v(t) {
|
|
12
|
+
return t.y + t.h / 2;
|
|
13
|
+
}
|
|
14
|
+
function T(t) {
|
|
15
|
+
if (t.milestone) {
|
|
16
|
+
const n = P(t), e = t.x + t.w / 2, o = v(t);
|
|
17
|
+
return { id: t.id, x: e - n, y: o - n, w: n * 2, h: n * 2, row: t.row };
|
|
18
|
+
}
|
|
19
|
+
return { id: t.id, x: t.x, y: t.y, w: t.w, h: t.h, row: t.row };
|
|
20
|
+
}
|
|
21
|
+
function C(t) {
|
|
22
|
+
const n = [];
|
|
23
|
+
for (let e = 0; e < t.length - 1; e++) {
|
|
24
|
+
const o = t[e], c = t[e + 1];
|
|
25
|
+
Math.abs(o.x - c.x) < 0.01 && Math.abs(o.y - c.y) < 0.01 || n.push({ x1: o.x, y1: o.y, x2: c.x, y2: c.y, vertical: Math.abs(o.x - c.x) < 0.01 });
|
|
26
|
+
}
|
|
27
|
+
return n;
|
|
28
|
+
}
|
|
29
|
+
function N(t) {
|
|
30
|
+
return Math.abs(t.x2 - t.x1) + Math.abs(t.y2 - t.y1);
|
|
31
|
+
}
|
|
32
|
+
function A(t, n, e, o, c = 0) {
|
|
33
|
+
const s = Math.max(Math.min(t, n), Math.min(e, o));
|
|
34
|
+
return Math.min(Math.max(t, n), Math.max(e, o)) - s > c;
|
|
35
|
+
}
|
|
36
|
+
function B(t, n) {
|
|
37
|
+
return t.vertical ? t.x1 <= n.x + 0.5 || t.x1 >= n.x + n.w - 0.5 ? !1 : A(t.y1, t.y2, n.y + 0.5, n.y + n.h - 0.5) : t.y1 <= n.y + 0.5 || t.y1 >= n.y + n.h - 0.5 ? !1 : A(t.x1, t.x2, n.x + 0.5, n.x + n.w - 0.5);
|
|
38
|
+
}
|
|
39
|
+
function L(t, n, e = 0.75) {
|
|
40
|
+
if (t.vertical === n.vertical) return !1;
|
|
41
|
+
const o = t.vertical ? t : n, c = t.vertical ? n : t, s = o.x1 > Math.min(c.x1, c.x2) + e && o.x1 < Math.max(c.x1, c.x2) - e, i = c.y1 > Math.min(o.y1, o.y2) + e && c.y1 < Math.max(o.y1, o.y2) - e;
|
|
42
|
+
return s && i;
|
|
43
|
+
}
|
|
44
|
+
function G(t, n, e) {
|
|
45
|
+
return t.vertical !== n.vertical ? !1 : t.vertical ? Math.abs(t.x1 - n.x1) >= e ? !1 : A(t.y1, t.y2, n.y1, n.y2, 4) : Math.abs(t.y1 - n.y1) >= e ? !1 : A(t.x1, t.x2, n.x1, n.x2, 4);
|
|
46
|
+
}
|
|
47
|
+
function O(t) {
|
|
48
|
+
const n = [];
|
|
49
|
+
for (const e of t) {
|
|
50
|
+
const o = n[n.length - 1];
|
|
51
|
+
o && Math.abs(o.x - e.x) < 0.01 && Math.abs(o.y - e.y) < 0.01 || n.push({ x: e.x, y: e.y });
|
|
52
|
+
}
|
|
53
|
+
for (let e = n.length - 2; e >= 1; e--) {
|
|
54
|
+
const o = n[e - 1], c = n[e], s = n[e + 1], i = Math.abs(o.x - c.x) < 0.01, r = Math.abs(c.x - s.x) < 0.01, l = Math.abs(o.y - c.y) < 0.01, h = Math.abs(c.y - s.y) < 0.01;
|
|
55
|
+
(i && r || l && h) && n.splice(e, 1);
|
|
56
|
+
}
|
|
57
|
+
return n;
|
|
58
|
+
}
|
|
59
|
+
class V {
|
|
60
|
+
byRow = /* @__PURE__ */ new Map();
|
|
61
|
+
rowHeight;
|
|
62
|
+
constructor(n, e) {
|
|
63
|
+
this.rowHeight = e;
|
|
64
|
+
for (const o of n) {
|
|
65
|
+
const c = T(o), s = this.byRow.get(c.row);
|
|
66
|
+
s ? s.push(c) : this.byRow.set(c.row, [c]);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** First obstacle strictly intersected by the segment, or null */
|
|
70
|
+
firstHit(n, e, o) {
|
|
71
|
+
const c = Math.min(n.y1, n.y2), s = Math.max(n.y1, n.y2), i = Math.floor(c / this.rowHeight) - 1, r = Math.floor(s / this.rowHeight) + 1;
|
|
72
|
+
for (let l = i; l <= r; l++) {
|
|
73
|
+
const h = this.byRow.get(l);
|
|
74
|
+
if (h) {
|
|
75
|
+
for (const f of h)
|
|
76
|
+
if (!(f.id === e || f.id === o) && B(n, f))
|
|
77
|
+
return f;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
/** Number of obstacles strictly intersected by the segment */
|
|
83
|
+
hitCount(n, e, o) {
|
|
84
|
+
const c = Math.min(n.y1, n.y2), s = Math.max(n.y1, n.y2), i = Math.floor(c / this.rowHeight) - 1, r = Math.floor(s / this.rowHeight) + 1;
|
|
85
|
+
let l = 0;
|
|
86
|
+
for (let h = i; h <= r; h++) {
|
|
87
|
+
const f = this.byRow.get(h);
|
|
88
|
+
if (f)
|
|
89
|
+
for (const u of f)
|
|
90
|
+
u.id === e || u.id === o || B(n, u) && l++;
|
|
91
|
+
}
|
|
92
|
+
return l;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function $(t, n, e) {
|
|
96
|
+
const o = /* @__PURE__ */ new Map();
|
|
97
|
+
for (const s of t) {
|
|
98
|
+
const i = n === "source" ? s.pred.id : s.succ.id, r = o.get(i);
|
|
99
|
+
r ? r.push(s) : o.set(i, [s]);
|
|
100
|
+
}
|
|
101
|
+
const c = /* @__PURE__ */ new Map();
|
|
102
|
+
for (const s of o.values()) {
|
|
103
|
+
if (s.length === 1) {
|
|
104
|
+
c.set(s[0].key, 0);
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
const i = [...s].sort((u, a) => {
|
|
108
|
+
const x = n === "source" ? u.succ : u.pred, d = n === "source" ? a.succ : a.pred;
|
|
109
|
+
return x.row !== d.row ? x.row - d.row : x.x !== d.x ? x.x - d.x : u.key < a.key ? -1 : 1;
|
|
110
|
+
}), r = i.length, h = (n === "source" ? i[0].pred : i[0].succ).milestone ? 4 : Math.max(3, e / 2 - 3), f = Math.min(6, 2 * h / (r - 1));
|
|
111
|
+
i.forEach((u, a) => {
|
|
112
|
+
c.set(u.key, H((a - (r - 1) / 2) * f, -h, h));
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return c;
|
|
116
|
+
}
|
|
117
|
+
function W(t, n) {
|
|
118
|
+
if (t === n) return [t, t + 1];
|
|
119
|
+
const e = Math.min(t, n) + 1, o = Math.max(t, n);
|
|
120
|
+
if (o - e <= 3) {
|
|
121
|
+
const c = [];
|
|
122
|
+
for (let s = e; s <= o; s++) c.push(s);
|
|
123
|
+
return c;
|
|
124
|
+
}
|
|
125
|
+
return [.../* @__PURE__ */ new Set([e, Math.floor((e + o) / 2), o])];
|
|
126
|
+
}
|
|
127
|
+
function R(t, n, e, o, c, s, i, r, l) {
|
|
128
|
+
let h = t;
|
|
129
|
+
for (let f = 0; f < 6; f++) {
|
|
130
|
+
const u = l.obstacles.firstHit(
|
|
131
|
+
{ x1: h, y1: n, x2: h, y2: e, vertical: !0 },
|
|
132
|
+
c,
|
|
133
|
+
s
|
|
134
|
+
);
|
|
135
|
+
if (!u) return h >= i && h <= r ? h : null;
|
|
136
|
+
h = o > 0 ? u.x + u.w + 5 : u.x - 5;
|
|
137
|
+
}
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
function F(t, n, e, o, c, s, i) {
|
|
141
|
+
const r = [], l = n.x - t.x >= 24, h = 2, f = i.chartWidth - 2;
|
|
142
|
+
if (l)
|
|
143
|
+
if (Math.abs(t.y - n.y) < 0.75)
|
|
144
|
+
r.push([t, n]);
|
|
145
|
+
else {
|
|
146
|
+
const x = [.../* @__PURE__ */ new Set([t.x + 12, (t.x + n.x) / 2, n.x - 12])], d = [];
|
|
147
|
+
for (const y of x) {
|
|
148
|
+
r.push([t, { x: y, y: t.y }, { x: y, y: n.y }, n]);
|
|
149
|
+
for (const M of [1, -1]) {
|
|
150
|
+
const w = R(
|
|
151
|
+
y,
|
|
152
|
+
t.y,
|
|
153
|
+
n.y,
|
|
154
|
+
M,
|
|
155
|
+
c,
|
|
156
|
+
s,
|
|
157
|
+
t.x + 2,
|
|
158
|
+
n.x - 2,
|
|
159
|
+
i
|
|
160
|
+
);
|
|
161
|
+
w !== null && Math.abs(w - y) > 0.5 && d.push(w);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
for (const y of [...new Set(d)])
|
|
165
|
+
r.push([t, { x: y, y: t.y }, { x: y, y: n.y }, n]);
|
|
166
|
+
}
|
|
167
|
+
const u = H(t.x + 12, h, f), a = H(n.x - 12, h, f);
|
|
168
|
+
for (const x of W(e, o)) {
|
|
169
|
+
const d = H(x * i.rowHeight, 2, i.chartHeight - 2), y = [u], M = R(
|
|
170
|
+
u,
|
|
171
|
+
t.y,
|
|
172
|
+
d,
|
|
173
|
+
1,
|
|
174
|
+
c,
|
|
175
|
+
s,
|
|
176
|
+
t.x + 2,
|
|
177
|
+
f,
|
|
178
|
+
i
|
|
179
|
+
);
|
|
180
|
+
M !== null && Math.abs(M - u) > 0.5 && y.push(M);
|
|
181
|
+
const w = [a], I = R(
|
|
182
|
+
a,
|
|
183
|
+
d,
|
|
184
|
+
n.y,
|
|
185
|
+
-1,
|
|
186
|
+
c,
|
|
187
|
+
s,
|
|
188
|
+
h,
|
|
189
|
+
n.x - 2,
|
|
190
|
+
i
|
|
191
|
+
);
|
|
192
|
+
I !== null && Math.abs(I - a) > 0.5 && w.push(I);
|
|
193
|
+
for (const _ of y)
|
|
194
|
+
for (const E of w)
|
|
195
|
+
r.push([
|
|
196
|
+
t,
|
|
197
|
+
{ x: _, y: t.y },
|
|
198
|
+
{ x: _, y: d },
|
|
199
|
+
{ x: E, y: d },
|
|
200
|
+
{ x: E, y: n.y },
|
|
201
|
+
n
|
|
202
|
+
]);
|
|
203
|
+
}
|
|
204
|
+
return r.map(O).filter((x) => x.length >= 2);
|
|
205
|
+
}
|
|
206
|
+
function z(t, n, e, o) {
|
|
207
|
+
let c = 0, s = 0, i = 0;
|
|
208
|
+
for (const r of t)
|
|
209
|
+
c += N(r), s += o.obstacles.hitCount(r, n, e), (r.x1 < 0 || r.x1 > o.chartWidth || r.x2 < 0 || r.x2 > o.chartWidth || r.y1 < 0 || r.y1 > o.chartHeight || r.y2 < 0 || r.y2 > o.chartHeight) && i++;
|
|
210
|
+
return c + (t.length - 1) * 14 + s * 2e3 + i * 400;
|
|
211
|
+
}
|
|
212
|
+
function j(t, n, e) {
|
|
213
|
+
let o = 0, c = 0;
|
|
214
|
+
for (const s of t) {
|
|
215
|
+
const i = s.vertical ? e : n, r = s.vertical ? n : e;
|
|
216
|
+
for (const l of i)
|
|
217
|
+
L(s, l) && o++;
|
|
218
|
+
for (const l of r)
|
|
219
|
+
G(s, l, 4) && c++;
|
|
220
|
+
}
|
|
221
|
+
return o * 12 + c * 280;
|
|
222
|
+
}
|
|
223
|
+
const Q = 4;
|
|
224
|
+
function Z(t, n, e, o, c, s) {
|
|
225
|
+
const i = t.map((u) => ({ x: u.x, y: u.y })), r = i.length - 1;
|
|
226
|
+
if (r < 3) return i;
|
|
227
|
+
const l = Math.max(0, (s.rowHeight - s.barHeight) / 2), h = [
|
|
228
|
+
5,
|
|
229
|
+
-5,
|
|
230
|
+
10,
|
|
231
|
+
-10,
|
|
232
|
+
15,
|
|
233
|
+
-15
|
|
234
|
+
], f = (u) => {
|
|
235
|
+
if (s.obstacles.firstHit(u, n, e)) return !0;
|
|
236
|
+
const a = u.vertical ? o : c;
|
|
237
|
+
for (const x of a)
|
|
238
|
+
if (G(u, x, 5 - 0.5)) return !0;
|
|
239
|
+
return !1;
|
|
240
|
+
};
|
|
241
|
+
for (let u = 1; u <= r - 2; u++) {
|
|
242
|
+
const a = i[u], x = i[u + 1], d = Math.abs(a.x - x.x) < 0.01, y = { x1: a.x, y1: a.y, x2: x.x, y2: x.y, vertical: d };
|
|
243
|
+
if (f(y))
|
|
244
|
+
if (d) {
|
|
245
|
+
const M = i[u - 1], w = i[u + 2], I = Math.sign(a.x - M.x), _ = Math.sign(w.x - x.x);
|
|
246
|
+
for (const E of h) {
|
|
247
|
+
const S = a.x + E;
|
|
248
|
+
if (!(S < 2 || S > s.chartWidth - 2) && !(I !== 0 && (Math.sign(S - M.x) !== I || Math.abs(S - M.x) < 2)) && !(_ !== 0 && (Math.sign(w.x - S) !== _ || Math.abs(w.x - S) < 2)) && !f({ x1: S, y1: a.y, x2: S, y2: x.y, vertical: !0 })) {
|
|
249
|
+
a.x = S, x.x = S;
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
} else {
|
|
254
|
+
const M = t[u].y, w = i[u - 1], I = i[u + 2], _ = Math.sign(a.y - w.y), E = Math.sign(I.y - x.y), S = Math.max(0, l - 1.5);
|
|
255
|
+
for (const m of h) {
|
|
256
|
+
if (Math.abs(m) > S) continue;
|
|
257
|
+
const p = M + m;
|
|
258
|
+
if (!(p < 2 || p > s.chartHeight - 2) && !(_ !== 0 && (Math.sign(p - w.y) !== _ || Math.abs(p - w.y) < 2)) && !(E !== 0 && (Math.sign(I.y - p) !== E || Math.abs(I.y - p) < 2)) && !f({ x1: a.x, y1: p, x2: x.x, y2: p, vertical: !1 })) {
|
|
259
|
+
a.y = p, x.y = p;
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return i;
|
|
266
|
+
}
|
|
267
|
+
function J(t, n, e, o) {
|
|
268
|
+
const c = /* @__PURE__ */ new Map(), s = C(t), i = o + 3.5 + 2;
|
|
269
|
+
return s.forEach((r, l) => {
|
|
270
|
+
const h = r.vertical ? e : n, f = [];
|
|
271
|
+
for (const y of h)
|
|
272
|
+
L(r, y) && f.push(r.vertical ? y.y1 : y.x1);
|
|
273
|
+
if (!f.length) return;
|
|
274
|
+
const u = (r.vertical ? Math.min(r.y1, r.y2) : Math.min(r.x1, r.x2)) + i, a = (r.vertical ? Math.max(r.y1, r.y2) : Math.max(r.x1, r.x2)) - i, x = [...new Set(f)].sort((y, M) => y - M).filter((y) => y > u && y < a), d = [];
|
|
275
|
+
for (const y of x)
|
|
276
|
+
d.length && y - d[d.length - 1] < 3.5 * 2 + 1 || d.push(y);
|
|
277
|
+
d.length && c.set(l, d);
|
|
278
|
+
}), c;
|
|
279
|
+
}
|
|
280
|
+
function K(t, n, e) {
|
|
281
|
+
const o = t[n - 1], c = t[n], s = t[n + 1], i = Math.abs(c.x - o.x) + Math.abs(c.y - o.y), r = Math.abs(s.x - c.x) + Math.abs(s.y - c.y);
|
|
282
|
+
return Math.max(0, Math.min(e, i / 2, r / 2));
|
|
283
|
+
}
|
|
284
|
+
function D(t, n = 5, e = /* @__PURE__ */ new Map()) {
|
|
285
|
+
const o = O(t);
|
|
286
|
+
if (o.length < 2) return "";
|
|
287
|
+
const c = [`M ${g(o[0].x)} ${g(o[0].y)}`];
|
|
288
|
+
for (let s = 0; s < o.length - 1; s++) {
|
|
289
|
+
const i = o[s], r = o[s + 1], l = Math.sign(r.x - i.x), h = Math.sign(r.y - i.y), f = s < o.length - 2 ? K(o, s + 1, n) : 0, u = e.get(s) ?? [];
|
|
290
|
+
if (u.length) {
|
|
291
|
+
const a = h === 0 ? l : h, x = a > 0 ? 1 : 0, d = [...u].sort((y, M) => a > 0 ? y - M : M - y);
|
|
292
|
+
for (const y of d)
|
|
293
|
+
h === 0 ? (c.push(`L ${g(y - l * 3.5)} ${g(i.y)}`), c.push(`A ${3.5} ${3.5} 0 0 ${x} ${g(y + l * 3.5)} ${g(i.y)}`)) : (c.push(`L ${g(i.x)} ${g(y - h * 3.5)}`), c.push(`A ${3.5} ${3.5} 0 0 ${x} ${g(i.x)} ${g(y + h * 3.5)}`));
|
|
294
|
+
}
|
|
295
|
+
if (c.push(`L ${g(r.x - l * f)} ${g(r.y - h * f)}`), s < o.length - 2 && f > 0) {
|
|
296
|
+
const a = o[s + 2], x = Math.sign(a.x - r.x), d = Math.sign(a.y - r.y);
|
|
297
|
+
c.push(`Q ${g(r.x)} ${g(r.y)} ${g(r.x + x * f)} ${g(r.y + d * f)}`);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return c.join(" ");
|
|
301
|
+
}
|
|
302
|
+
function q(t, n, e = 5) {
|
|
303
|
+
return `M ${g(t)} ${g(n)} L ${g(t - e)} ${g(n - e * 0.6)} L ${g(t - e)} ${g(n + e * 0.6)} Z`;
|
|
304
|
+
}
|
|
305
|
+
function X(t) {
|
|
306
|
+
const n = C(t);
|
|
307
|
+
if (!n.length) return t[0] ?? { x: 0, y: 0 };
|
|
308
|
+
let o = n.reduce((s, i) => s + N(i), 0) / 2;
|
|
309
|
+
for (const s of n) {
|
|
310
|
+
const i = N(s);
|
|
311
|
+
if (o <= i) {
|
|
312
|
+
const r = i > 0 ? o / i : 0;
|
|
313
|
+
return { x: s.x1 + (s.x2 - s.x1) * r, y: s.y1 + (s.y2 - s.y1) * r };
|
|
314
|
+
}
|
|
315
|
+
o -= i;
|
|
316
|
+
}
|
|
317
|
+
const c = n[n.length - 1];
|
|
318
|
+
return { x: c.x2, y: c.y2 };
|
|
319
|
+
}
|
|
320
|
+
function Y(t, n, e, o, c, s, i = 5) {
|
|
321
|
+
let l;
|
|
322
|
+
if (e > t + 32)
|
|
323
|
+
if (Math.abs(n - o) < 2)
|
|
324
|
+
l = [{ x: t, y: n }, { x: e, y: o }];
|
|
325
|
+
else {
|
|
326
|
+
const h = t + (e - t) / 2;
|
|
327
|
+
l = [{ x: t, y: n }, { x: h, y: n }, { x: h, y: o }, { x: e, y: o }];
|
|
328
|
+
}
|
|
329
|
+
else if (Math.abs(n - o) < c * 0.5) {
|
|
330
|
+
const h = Math.max(n, o) + s / 2 + 16;
|
|
331
|
+
l = [
|
|
332
|
+
{ x: t, y: n },
|
|
333
|
+
{ x: t + 16, y: n },
|
|
334
|
+
{ x: t + 16, y: h },
|
|
335
|
+
{ x: e - 16, y: h },
|
|
336
|
+
{ x: e - 16, y: o },
|
|
337
|
+
{ x: e, y: o }
|
|
338
|
+
];
|
|
339
|
+
} else
|
|
340
|
+
l = [{ x: t, y: n }, { x: t + 16, y: n }, { x: t + 16, y: o }, { x: e, y: o }];
|
|
341
|
+
return D(l, i);
|
|
342
|
+
}
|
|
343
|
+
function tt(t, n, e) {
|
|
344
|
+
const o = {
|
|
345
|
+
rowHeight: e.rowHeight,
|
|
346
|
+
barHeight: e.barHeight,
|
|
347
|
+
chartWidth: Math.max(e.chartWidth, 40),
|
|
348
|
+
chartHeight: Math.max(e.chartHeight, e.rowHeight),
|
|
349
|
+
obstacles: new V(n.values(), e.rowHeight)
|
|
350
|
+
}, c = e.cornerRadius, s = e.arrowSize ?? 5, i = [];
|
|
351
|
+
for (const a of t) {
|
|
352
|
+
const x = n.get(a.predecessorId), d = n.get(a.successorId);
|
|
353
|
+
!x || !d || i.push({ key: a.key, predecessorId: a.predecessorId, successorId: a.successorId, pred: x, succ: d });
|
|
354
|
+
}
|
|
355
|
+
i.sort((a, x) => a.pred.row - x.pred.row || a.succ.row - x.succ.row || (a.key < x.key ? -1 : a.key > x.key ? 1 : 0));
|
|
356
|
+
const r = $(i, "source", o.barHeight), l = $(i, "target", o.barHeight), h = [], f = [], u = [];
|
|
357
|
+
for (const a of i) {
|
|
358
|
+
const x = {
|
|
359
|
+
x: k(a.pred),
|
|
360
|
+
y: v(a.pred) + (r.get(a.key) ?? 0)
|
|
361
|
+
}, d = {
|
|
362
|
+
x: U(a.succ),
|
|
363
|
+
y: v(a.succ) + (l.get(a.key) ?? 0)
|
|
364
|
+
}, y = F(
|
|
365
|
+
x,
|
|
366
|
+
d,
|
|
367
|
+
a.pred.row,
|
|
368
|
+
a.succ.row,
|
|
369
|
+
a.pred.id,
|
|
370
|
+
a.succ.id,
|
|
371
|
+
o
|
|
372
|
+
);
|
|
373
|
+
if (!y.length) continue;
|
|
374
|
+
const M = y.map((m, p) => {
|
|
375
|
+
const b = C(m);
|
|
376
|
+
return { pts: m, segs: b, index: p, base: z(b, a.pred.id, a.succ.id, o) };
|
|
377
|
+
}).sort((m, p) => m.base - p.base || m.index - p.index);
|
|
378
|
+
let w = M[0].pts, I = Number.POSITIVE_INFINITY;
|
|
379
|
+
for (const m of M.slice(0, Q)) {
|
|
380
|
+
const p = m.base + j(m.segs, h, f);
|
|
381
|
+
p < I - 1e-6 && (I = p, w = m.pts);
|
|
382
|
+
}
|
|
383
|
+
const _ = O(
|
|
384
|
+
Z(w, a.pred.id, a.succ.id, h, f, o)
|
|
385
|
+
), E = J(_, h, f, c), S = X(_);
|
|
386
|
+
u.push({
|
|
387
|
+
key: a.key,
|
|
388
|
+
predecessorId: a.predecessorId,
|
|
389
|
+
successorId: a.successorId,
|
|
390
|
+
d: D(_, c, E),
|
|
391
|
+
ad: q(d.x, d.y, s),
|
|
392
|
+
midX: g(S.x),
|
|
393
|
+
midY: g(S.y)
|
|
394
|
+
});
|
|
395
|
+
for (const m of C(_))
|
|
396
|
+
m.vertical ? h.push(m) : f.push(m);
|
|
397
|
+
}
|
|
398
|
+
return u;
|
|
399
|
+
}
|
|
400
|
+
export {
|
|
401
|
+
q as ganttConnectorArrowPath,
|
|
402
|
+
Y as ganttConnectorPreviewPath,
|
|
403
|
+
D as ganttRoundedConnectorPath,
|
|
404
|
+
tt as routeGanttDependencyConnectors
|
|
405
|
+
};
|
|
@@ -3,83 +3,83 @@ function D(e) {
|
|
|
3
3
|
return f[e];
|
|
4
4
|
}
|
|
5
5
|
function l(e) {
|
|
6
|
-
const
|
|
7
|
-
!n || !
|
|
6
|
+
const i = /* @__PURE__ */ new Map(), r = (n, t) => {
|
|
7
|
+
!n || !t || n === t || i.set(p(n, t), {
|
|
8
8
|
predecessorId: n,
|
|
9
|
-
successorId:
|
|
9
|
+
successorId: t
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
12
|
for (const n of e) {
|
|
13
|
-
for (const
|
|
14
|
-
|
|
15
|
-
for (const
|
|
16
|
-
|
|
13
|
+
for (const t of n.dependencies ?? [])
|
|
14
|
+
r(t, n.id);
|
|
15
|
+
for (const t of n.dependencyLinks ?? [])
|
|
16
|
+
t.type !== "related-to" && (t.type === "waiting-on" ? r(t.taskId, n.id) : t.type === "blocking" && r(n.id, t.taskId));
|
|
17
17
|
}
|
|
18
|
-
return [...
|
|
18
|
+
return [...i.values()];
|
|
19
19
|
}
|
|
20
|
-
function d(e,
|
|
20
|
+
function d(e, i, r) {
|
|
21
21
|
return l(e).some(
|
|
22
|
-
(n) => n.predecessorId ===
|
|
22
|
+
(n) => n.predecessorId === i && n.successorId === r
|
|
23
23
|
);
|
|
24
24
|
}
|
|
25
|
-
function h(e,
|
|
26
|
-
const n = e.y +
|
|
25
|
+
function h(e, i, r = 8) {
|
|
26
|
+
const n = e.y + i / 2;
|
|
27
27
|
if (e.milestone) {
|
|
28
|
-
const
|
|
29
|
-
return { cx: e.x + e.fullW / 2 +
|
|
28
|
+
const t = i * 0.4;
|
|
29
|
+
return { cx: e.x + e.fullW / 2 + t + r * 0.5, cy: n };
|
|
30
30
|
}
|
|
31
|
-
return { cx: e.x + e.fullW +
|
|
31
|
+
return { cx: e.x + e.fullW + r, cy: n };
|
|
32
32
|
}
|
|
33
|
-
function v(e,
|
|
33
|
+
function v(e, i, r, n, t = 4) {
|
|
34
34
|
for (let c = e.length - 1; c >= 0; c--) {
|
|
35
35
|
const o = e[c];
|
|
36
36
|
if (o.milestone) {
|
|
37
|
-
const s = o.x + o.fullW / 2,
|
|
38
|
-
if (Math.abs(
|
|
37
|
+
const s = o.x + o.fullW / 2, a = o.y + n / 2, u = n * 0.4 + t;
|
|
38
|
+
if (Math.abs(i - s) <= u && Math.abs(r - a) <= u) return o;
|
|
39
39
|
continue;
|
|
40
40
|
}
|
|
41
|
-
if (
|
|
41
|
+
if (i >= o.x - t && i <= o.x + o.fullW + t && r >= o.y - t && r <= o.y + n + t)
|
|
42
42
|
return o;
|
|
43
43
|
}
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
|
-
function y(e,
|
|
47
|
-
if (
|
|
46
|
+
function y(e, i, r) {
|
|
47
|
+
if (i === r) return !0;
|
|
48
48
|
const n = /* @__PURE__ */ new Map();
|
|
49
49
|
for (const o of l(e)) {
|
|
50
50
|
const s = n.get(o.successorId) ?? [];
|
|
51
51
|
s.push(o.predecessorId), n.set(o.successorId, s);
|
|
52
52
|
}
|
|
53
|
-
const
|
|
53
|
+
const t = /* @__PURE__ */ new Set(), c = [i];
|
|
54
54
|
for (; c.length; ) {
|
|
55
55
|
const o = c.shift();
|
|
56
|
-
if (
|
|
57
|
-
|
|
56
|
+
if (t.has(o)) continue;
|
|
57
|
+
t.add(o);
|
|
58
58
|
const s = n.get(o);
|
|
59
59
|
if (s?.length)
|
|
60
|
-
for (const
|
|
61
|
-
if (
|
|
62
|
-
|
|
60
|
+
for (const a of s) {
|
|
61
|
+
if (a === r) return !0;
|
|
62
|
+
t.has(a) || c.push(a);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
return !1;
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
if (
|
|
67
|
+
function $(e, i, r) {
|
|
68
|
+
if (i === r)
|
|
69
69
|
return { valid: !1, reason: "self" };
|
|
70
|
-
const n = e.find((c) => c.id ===
|
|
71
|
-
return n ?
|
|
70
|
+
const n = e.find((c) => c.id === i), t = e.find((c) => c.id === r);
|
|
71
|
+
return n ? t ? d(e, i, r) ? { valid: !1, reason: "duplicate" } : y(e, i, r) ? { valid: !1, reason: "circular" } : { valid: !0 } : { valid: !1, reason: "missing-successor" } : { valid: !1, reason: "missing-predecessor" };
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function k(e, i, r) {
|
|
74
74
|
if (e.valid === !0)
|
|
75
|
-
return `Dependency requested: ${
|
|
75
|
+
return `Dependency requested: ${r} waiting on ${i}`;
|
|
76
76
|
switch ("reason" in e ? e.reason : void 0) {
|
|
77
77
|
case "self":
|
|
78
|
-
return `Cannot create a dependency from ${
|
|
78
|
+
return `Cannot create a dependency from ${i} to itself`;
|
|
79
79
|
case "duplicate":
|
|
80
|
-
return `${
|
|
80
|
+
return `${r} is already waiting on ${i}`;
|
|
81
81
|
case "circular":
|
|
82
|
-
return `Cannot link ${
|
|
82
|
+
return `Cannot link ${i} to ${r}: would create a circular dependency`;
|
|
83
83
|
case "missing-predecessor":
|
|
84
84
|
return "Predecessor task is not available";
|
|
85
85
|
case "missing-successor":
|
|
@@ -88,26 +88,22 @@ function E(e, t, i) {
|
|
|
88
88
|
return "Invalid dependency target";
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
function p(e,
|
|
92
|
-
return `${e}\0${
|
|
91
|
+
function p(e, i) {
|
|
92
|
+
return `${e}\0${i}`;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
return { x: (e + i) / 2, y: (t + n) / 2 };
|
|
96
|
-
}
|
|
97
|
-
function $(e, t, i, n = 40, r = 14) {
|
|
94
|
+
function x(e, i, r, n = 40, t = 14) {
|
|
98
95
|
let c = 0, o = 0;
|
|
99
|
-
return e <
|
|
96
|
+
return e < r.left + n ? c = -t : e > r.right - n && (c = t), i < r.top + n ? o = -t : i > r.bottom - n && (o = t), { dx: c, dy: o };
|
|
100
97
|
}
|
|
101
98
|
export {
|
|
102
|
-
|
|
99
|
+
k as describeGanttDependencyLinkValidation,
|
|
103
100
|
v as findGanttDependencyBarAtPoint,
|
|
104
101
|
p as ganttDependencyEdgeKey,
|
|
105
102
|
y as ganttDependencyReachable,
|
|
106
103
|
D as ganttDependencyTypeLabel,
|
|
107
104
|
h as getGanttDependencyConnectorPosition,
|
|
108
|
-
|
|
109
|
-
$ as getGanttDependencyEdgeScrollDelta,
|
|
105
|
+
x as getGanttDependencyEdgeScrollDelta,
|
|
110
106
|
d as hasGanttScheduleDependency,
|
|
111
107
|
l as resolveGanttScheduleDependencyEdges,
|
|
112
|
-
|
|
108
|
+
$ as validateGanttDependencyLink
|
|
113
109
|
};
|
|
@@ -416,6 +416,14 @@ export interface GanttTask {
|
|
|
416
416
|
dependencyLinks?: GanttTaskDependencyLink[];
|
|
417
417
|
/** If true, renders as a diamond milestone marker instead of a bar */
|
|
418
418
|
milestone?: boolean;
|
|
419
|
+
/**
|
|
420
|
+
* Presentational blocked state (e.g. waiting on incomplete work or manually
|
|
421
|
+
* blocked). Renders a hatched overlay + lock marker on the bar and a
|
|
422
|
+
* blocked line in the tooltip. Purely visual — parents own the rule.
|
|
423
|
+
*/
|
|
424
|
+
blocked?: boolean;
|
|
425
|
+
/** Short human-readable reason shown in the tooltip when `blocked` */
|
|
426
|
+
blockedReason?: string;
|
|
419
427
|
}
|
|
420
428
|
export interface GanttChartProps {
|
|
421
429
|
/** Array of task objects */
|
|
@@ -462,7 +470,14 @@ export interface GanttChartProps {
|
|
|
462
470
|
* rendering of existing arrows). Default `false` for backward compatibility.
|
|
463
471
|
*/
|
|
464
472
|
editableDependencies?: boolean;
|
|
465
|
-
/**
|
|
473
|
+
/**
|
|
474
|
+
* When moving a task, dependent tasks visually FOLLOW during the drag as a
|
|
475
|
+
* preview. On release only ONE `task-update` is emitted (the root task) —
|
|
476
|
+
* the parent/server owns the authoritative cascade and passes the final
|
|
477
|
+
* dates back through `tasks`. (The pre-1.x behavior of emitting one update
|
|
478
|
+
* per dependent task is removed: it produced N independent writes with no
|
|
479
|
+
* transactional guarantee.)
|
|
480
|
+
*/
|
|
466
481
|
cascadeDependencies?: boolean;
|
|
467
482
|
/** Show zoom controls and enable Ctrl/Meta + wheel zoom */
|
|
468
483
|
zoom?: boolean;
|