@affino/datagrid-vue-app 0.1.37 → 0.1.39
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/dist/DataGrid.d.ts +1 -1
- package/dist/advanced-filter.js +1 -1
- package/dist/aggregations.js +1 -1
- package/dist/chunks/{DataGridAdvancedFilterPopover-CXT1rG40.js → DataGridAdvancedFilterPopover-BBLSw7c4.js} +1 -1
- package/dist/chunks/{DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-BshOPOFV.js → DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-BUkG_Bz7.js} +1 -1
- package/dist/chunks/{DataGridAggregationsPopover-BRVx8c_y.js → DataGridAggregationsPopover-C8kdwv0O.js} +1 -1
- package/dist/chunks/{DataGridAggregationsPopover.vue_vue_type_script_setup_true_lang-CsQpLONh.js → DataGridAggregationsPopover.vue_vue_type_script_setup_true_lang-t6v8MqIT.js} +1 -1
- package/dist/chunks/{DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-Dc5SowKk.js → DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-xry4J3Lx.js} +66 -62
- package/dist/chunks/DataGridGanttStageEntry-o99nyV0i.js +9665 -0
- package/dist/chunks/{useDataGridAppRowModel-JUDjg-Fq.js → useDataGridAppRowModel-Dy5CF0h4.js} +1614 -1597
- package/dist/gantt.js +4 -4
- package/dist/index.js +413 -397
- package/dist/internal.js +28 -29
- package/dist/stage/dataGridTableStage.types.d.ts +2 -2
- package/dist/stage/useDataGridTableStageRuntime.d.ts +12 -12
- package/package.json +4 -4
- package/dist/chunks/DataGridGanttStage.vue_vue_type_script_setup_true_lang-DJ72Tgpd.js +0 -1007
- package/dist/chunks/DataGridGanttStageEntry-C4qhNhnp.js +0 -40
- package/dist/chunks/DataGridTableStage.vue_vue_type_script_setup_true_lang-Q2ri6J1V.js +0 -8604
|
@@ -1,1007 +0,0 @@
|
|
|
1
|
-
import { defineComponent as _n, computed as d, ref as b, watch as fe, nextTick as Pt, onMounted as xn, onBeforeUnmount as En, openBlock as De, createElementBlock as We, createElementVNode as F, normalizeStyle as oe, createVNode as Cn, mergeProps as Ln, unref as Bn, createCommentVNode as Hn } from "vue";
|
|
2
|
-
import { o as Gn, q as Vn, r as An, _ as Nn } from "./DataGridTableStage.vue_vue_type_script_setup_true_lang-Q2ri6J1V.js";
|
|
3
|
-
import { resolveDataGridGanttAnalysis as zn, buildDataGridGanttVisibleBars as Fn, buildDataGridGanttDependencyPaths as Xn, resolveDataGridGanttRangeFrame as je, buildDataGridTimelineRenderModels as Dt, resolveDataGridTimelineDateToPixel as Wt, resolveDataGridTimelineScrollLeftForDate as On, applyDataGridGanttDragDelta as $n, hitTestDataGridGanttBar as kt, clampDataGridTimelineScrollLeft as Kn, buildDataGridGanttRowEditPatch as Un } from "@affino/datagrid-gantt";
|
|
4
|
-
const Me = 0.5, jn = 1.25;
|
|
5
|
-
function Yn(s) {
|
|
6
|
-
const u = Math.abs(s.deltaX), l = Math.abs(s.deltaY);
|
|
7
|
-
if (s.shiftKey) {
|
|
8
|
-
const c = u > Me ? s.deltaX : s.deltaY;
|
|
9
|
-
return Math.abs(c) > Me ? { horizontalDelta: c, verticalDelta: 0 } : { horizontalDelta: 0, verticalDelta: 0 };
|
|
10
|
-
}
|
|
11
|
-
return u <= Me && l <= Me ? {
|
|
12
|
-
horizontalDelta: 0,
|
|
13
|
-
verticalDelta: 0
|
|
14
|
-
} : u > Me && u > l * jn ? {
|
|
15
|
-
horizontalDelta: s.deltaX,
|
|
16
|
-
verticalDelta: 0
|
|
17
|
-
} : {
|
|
18
|
-
horizontalDelta: 0,
|
|
19
|
-
verticalDelta: s.deltaY
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
const qn = 12, qe = 280, Je = 240;
|
|
23
|
-
function Ye(s, u) {
|
|
24
|
-
return Number.isFinite(s) ? Math.max(1, Math.round(Number(s))) : u;
|
|
25
|
-
}
|
|
26
|
-
function Lt(s) {
|
|
27
|
-
const u = Ye(
|
|
28
|
-
s.minTableWidth,
|
|
29
|
-
qe
|
|
30
|
-
), l = Ye(
|
|
31
|
-
s.minTimelineWidth,
|
|
32
|
-
Je
|
|
33
|
-
), c = Ye(s.requestedWidth, u), R = Number.isFinite(s.stageWidth) ? Math.max(0, Number(s.stageWidth)) : 0, S = Number.isFinite(s.maxTableWidth) ? Math.max(u, Math.round(Number(s.maxTableWidth))) : Number.POSITIVE_INFINITY, g = R > 0 ? Math.max(u, R - l) : Number.POSITIVE_INFINITY;
|
|
34
|
-
return Math.min(
|
|
35
|
-
Math.max(c, u),
|
|
36
|
-
Math.min(S, g)
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
function Jn(s) {
|
|
40
|
-
return Lt({
|
|
41
|
-
requestedWidth: s.originWidth + s.deltaX,
|
|
42
|
-
stageWidth: s.stageWidth,
|
|
43
|
-
minTableWidth: s.minTableWidth,
|
|
44
|
-
minTimelineWidth: s.minTimelineWidth,
|
|
45
|
-
maxTableWidth: s.maxTableWidth
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
const Zn = 44;
|
|
49
|
-
function Qn(s, u, l) {
|
|
50
|
-
const c = s.trim();
|
|
51
|
-
if (c.length === 0 || u < Zn)
|
|
52
|
-
return null;
|
|
53
|
-
if (l(c) <= u)
|
|
54
|
-
return c;
|
|
55
|
-
const R = "...";
|
|
56
|
-
if (l(R) > u)
|
|
57
|
-
return null;
|
|
58
|
-
let g = 0, W = c.length, E = "";
|
|
59
|
-
for (; g <= W; ) {
|
|
60
|
-
const C = Math.floor((g + W) / 2), I = `${c.slice(0, C).trimEnd()}${R}`;
|
|
61
|
-
l(I) <= u ? (E = I, g = C + 1) : W = C - 1;
|
|
62
|
-
}
|
|
63
|
-
return E.length > 0 ? E : null;
|
|
64
|
-
}
|
|
65
|
-
const ea = 6;
|
|
66
|
-
function Te(s) {
|
|
67
|
-
return [
|
|
68
|
-
s.dependencyTaskId,
|
|
69
|
-
s.dependencyType,
|
|
70
|
-
s.sourceBar.rowId,
|
|
71
|
-
s.targetBar.rowId
|
|
72
|
-
].join("::");
|
|
73
|
-
}
|
|
74
|
-
function ta(s, u, l) {
|
|
75
|
-
const c = l.x - u.x, R = l.y - u.y;
|
|
76
|
-
if (c === 0 && R === 0) {
|
|
77
|
-
const A = s.x - u.x, L = s.y - u.y;
|
|
78
|
-
return A * A + L * L;
|
|
79
|
-
}
|
|
80
|
-
const S = ((s.x - u.x) * c + (s.y - u.y) * R) / (c * c + R * R), g = Math.max(0, Math.min(1, S)), W = u.x + c * g, E = u.y + R * g, C = s.x - W, I = s.y - E;
|
|
81
|
-
return C * C + I * I;
|
|
82
|
-
}
|
|
83
|
-
function _t(s, u, l = ea) {
|
|
84
|
-
const c = Math.max(1, l) ** 2;
|
|
85
|
-
let R = null, S = Number.POSITIVE_INFINITY;
|
|
86
|
-
for (const g of s)
|
|
87
|
-
for (let W = 1; W < g.points.length; W += 1) {
|
|
88
|
-
const E = g.points[W - 1], C = g.points[W];
|
|
89
|
-
if (!E || !C)
|
|
90
|
-
continue;
|
|
91
|
-
const I = ta(u, E, C);
|
|
92
|
-
I > c || I >= S || (S = I, R = g);
|
|
93
|
-
}
|
|
94
|
-
return R;
|
|
95
|
-
}
|
|
96
|
-
const na = { class: "datagrid-gantt-stage__timeline" }, aa = { class: "datagrid-gantt-stage__timeline-body" }, ia = {
|
|
97
|
-
key: 0,
|
|
98
|
-
class: "datagrid-gantt-stage__empty"
|
|
99
|
-
}, xt = 48, Et = 240, ke = 40, Ct = 24, sa = /* @__PURE__ */ _n({
|
|
100
|
-
__name: "DataGridGanttStage",
|
|
101
|
-
props: {
|
|
102
|
-
stageContext: {},
|
|
103
|
-
runtime: {},
|
|
104
|
-
gantt: {},
|
|
105
|
-
baseRowHeight: {},
|
|
106
|
-
rowVersion: {}
|
|
107
|
-
},
|
|
108
|
-
setup(s) {
|
|
109
|
-
Gn();
|
|
110
|
-
const u = /* @__PURE__ */ new Set(), l = s, c = l.stageContext, R = d(() => Vn(c)), S = d(() => c.rows.value), g = d(() => c.viewport.value), W = d(() => c.selection.value), E = d(() => c.columns.value), C = d(() => c.rowHeightMode.value), I = b(null), A = b(null), L = b(null), k = b(null), Ze = b(null), le = b(null), X = b(null), Y = b(xt), re = b(0), q = b(0), _e = b(0), P = b(0), N = b(0), m = b(null), se = b(null), J = b(null), O = b(null), B = b(null), Qe = b(!1), de = b(null);
|
|
111
|
-
let ge = !1, me = !1, xe = null, Ee = null, z = null, Ce = !1;
|
|
112
|
-
function Le(e) {
|
|
113
|
-
const n = new Date(e);
|
|
114
|
-
return Date.UTC(n.getUTCFullYear(), n.getUTCMonth(), n.getUTCDate());
|
|
115
|
-
}
|
|
116
|
-
function Bt(e) {
|
|
117
|
-
if (!e)
|
|
118
|
-
return null;
|
|
119
|
-
try {
|
|
120
|
-
return e.getContext("2d");
|
|
121
|
-
} catch {
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
function M(e, n) {
|
|
126
|
-
const a = A.value?.getStageRootElement() ?? k.value;
|
|
127
|
-
if (!a || typeof window > "u")
|
|
128
|
-
return n;
|
|
129
|
-
const o = window.getComputedStyle(a).getPropertyValue(e).trim();
|
|
130
|
-
return o.length > 0 ? o : n;
|
|
131
|
-
}
|
|
132
|
-
function et(e, n, a) {
|
|
133
|
-
const o = Bt(e);
|
|
134
|
-
if (!e || !o)
|
|
135
|
-
return null;
|
|
136
|
-
const r = typeof window > "u" ? 1 : Math.max(1, window.devicePixelRatio || 1), t = Math.max(1, Math.round(n)), v = Math.max(1, Math.round(a));
|
|
137
|
-
return (e.width !== Math.round(t * r) || e.height !== Math.round(v * r)) && (e.width = Math.round(t * r), e.height = Math.round(v * r)), o.setTransform(r, 0, 0, r, 0, 0), o.clearRect(0, 0, t, v), o;
|
|
138
|
-
}
|
|
139
|
-
function tt(e) {
|
|
140
|
-
return e ? Math.max(
|
|
141
|
-
e.clientWidth,
|
|
142
|
-
Math.round(e.getBoundingClientRect().width)
|
|
143
|
-
) : 0;
|
|
144
|
-
}
|
|
145
|
-
function Z(e, n, a, o, r, t) {
|
|
146
|
-
const v = Math.max(0, Math.min(t, o / 2, r / 2));
|
|
147
|
-
e.beginPath(), e.moveTo(n + v, a), e.lineTo(n + o - v, a), e.quadraticCurveTo(n + o, a, n + o, a + v), e.lineTo(n + o, a + r - v), e.quadraticCurveTo(n + o, a + r, n + o - v, a + r), e.lineTo(n + v, a + r), e.quadraticCurveTo(n, a + r, n, a + r - v), e.lineTo(n, a + v), e.quadraticCurveTo(n, a, n + v, a), e.closePath();
|
|
148
|
-
}
|
|
149
|
-
function ue(e, n, a, o) {
|
|
150
|
-
const r = Math.max(1, o / 2);
|
|
151
|
-
e.beginPath(), e.moveTo(n, a - r), e.lineTo(n + r, a), e.lineTo(n, a + r), e.lineTo(n - r, a), e.closePath();
|
|
152
|
-
}
|
|
153
|
-
function nt(e, n, a, o, r) {
|
|
154
|
-
Math.abs(a - n) < 2 || (e.save(), e.strokeStyle = r, e.lineWidth = 1.5, e.lineCap = "round", e.beginPath(), e.moveTo(n, o), e.lineTo(a, o), e.moveTo(n, o - 3), e.lineTo(n, o + 3), e.moveTo(a, o - 3), e.lineTo(a, o + 3), e.stroke(), e.restore());
|
|
155
|
-
}
|
|
156
|
-
function Ht(e, n, a, o, r) {
|
|
157
|
-
const t = n[0];
|
|
158
|
-
if (!t || n.length < 2)
|
|
159
|
-
return;
|
|
160
|
-
e.save();
|
|
161
|
-
const v = a === "FS" ? [] : a === "SS" ? [5, 3] : a === "FF" ? [8, 3] : [2, 3];
|
|
162
|
-
e.setLineDash(v), e.strokeStyle = r, e.lineWidth = 4, e.lineJoin = "round", e.lineCap = "round", e.beginPath(), e.moveTo(t.x, t.y);
|
|
163
|
-
for (let D = 1; D < n.length; D += 1) {
|
|
164
|
-
const _ = n[D];
|
|
165
|
-
_ && e.lineTo(_.x, _.y);
|
|
166
|
-
}
|
|
167
|
-
e.stroke(), e.strokeStyle = o, e.fillStyle = o, e.lineWidth = 1.5, e.lineJoin = "round", e.lineCap = "round", e.beginPath(), e.moveTo(t.x, t.y);
|
|
168
|
-
for (let D = 1; D < n.length; D += 1) {
|
|
169
|
-
const _ = n[D];
|
|
170
|
-
_ && e.lineTo(_.x, _.y);
|
|
171
|
-
}
|
|
172
|
-
e.stroke();
|
|
173
|
-
const f = n[n.length - 1], H = n[n.length - 2];
|
|
174
|
-
if (f && H) {
|
|
175
|
-
e.fillStyle = "rgba(255, 255, 255, 0.85)", e.beginPath(), e.arc(t.x, t.y, 1.75 + 1.25, 0, Math.PI * 2), e.arc(f.x, f.y, 2.5 + 1.5, 0, Math.PI * 2), e.fill(), e.fillStyle = o, e.beginPath(), e.arc(t.x, t.y, 1.75, 0, Math.PI * 2), e.arc(f.x, f.y, 2.5, 0, Math.PI * 2), e.fill();
|
|
176
|
-
const K = Math.atan2(f.y - H.y, f.x - H.x), U = 6, G = Math.PI / 8;
|
|
177
|
-
e.beginPath(), e.moveTo(f.x, f.y), e.lineTo(
|
|
178
|
-
f.x - U * Math.cos(K - G),
|
|
179
|
-
f.y - U * Math.sin(K - G)
|
|
180
|
-
), e.lineTo(
|
|
181
|
-
f.x - U * Math.cos(K + G),
|
|
182
|
-
f.y - U * Math.sin(K + G)
|
|
183
|
-
), e.closePath(), e.fill();
|
|
184
|
-
}
|
|
185
|
-
e.restore();
|
|
186
|
-
}
|
|
187
|
-
function Gt(e, n, a, o, r, t) {
|
|
188
|
-
const f = Math.max(0, r - 16), H = Qn(
|
|
189
|
-
n,
|
|
190
|
-
f,
|
|
191
|
-
(D) => e.measureText(D).width
|
|
192
|
-
);
|
|
193
|
-
H && (e.save(), e.beginPath(), e.rect(a, o, r, t), e.clip(), e.fillText(H, a + 8, o + t / 2), e.restore());
|
|
194
|
-
}
|
|
195
|
-
function Q() {
|
|
196
|
-
const e = X.value;
|
|
197
|
-
if (!e) {
|
|
198
|
-
re.value = 0, q.value = 0;
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
re.value = e.scrollTop, q.value = e.clientHeight;
|
|
202
|
-
}
|
|
203
|
-
function we() {
|
|
204
|
-
const e = A.value?.getHeaderElement() ?? null, n = Math.max(
|
|
205
|
-
1,
|
|
206
|
-
Math.round(
|
|
207
|
-
e?.offsetHeight || e?.clientHeight || e?.getBoundingClientRect().height || xt
|
|
208
|
-
)
|
|
209
|
-
);
|
|
210
|
-
Y.value !== n && (Y.value = n);
|
|
211
|
-
}
|
|
212
|
-
function ee() {
|
|
213
|
-
_e.value = I.value?.clientWidth ?? 0;
|
|
214
|
-
}
|
|
215
|
-
function ye() {
|
|
216
|
-
N.value = Math.max(
|
|
217
|
-
tt(k.value),
|
|
218
|
-
tt(L.value)
|
|
219
|
-
);
|
|
220
|
-
}
|
|
221
|
-
function at(e) {
|
|
222
|
-
if (!e)
|
|
223
|
-
return;
|
|
224
|
-
const n = Math.max(0, e.clientWidth);
|
|
225
|
-
n > 0 && N.value !== n && (N.value = n);
|
|
226
|
-
}
|
|
227
|
-
function w(e = "both") {
|
|
228
|
-
ge = ge || e !== "body", me = me || e !== "header", !(de.value != null || typeof window > "u") && (de.value = window.requestAnimationFrame(() => {
|
|
229
|
-
const n = ge, a = me;
|
|
230
|
-
de.value = null, ge = !1, me = !1, n && on(), a && ln();
|
|
231
|
-
}));
|
|
232
|
-
}
|
|
233
|
-
function Vt() {
|
|
234
|
-
de.value == null || typeof window > "u" || (window.cancelAnimationFrame(de.value), de.value = null, ge = !1, me = !1);
|
|
235
|
-
}
|
|
236
|
-
function it(e) {
|
|
237
|
-
return l.runtime.api.view.getRowHeightOverride(e) ?? l.baseRowHeight;
|
|
238
|
-
}
|
|
239
|
-
const Re = d(() => l.runtime.api.view.getRowHeightVersion()), Be = d(() => {
|
|
240
|
-
if (rt.value, Re.value, C.value !== "auto") {
|
|
241
|
-
const e = [];
|
|
242
|
-
let n = g.value.topSpacerHeight;
|
|
243
|
-
for (let a = 0; a < S.value.displayRows.length; a += 1) {
|
|
244
|
-
const o = g.value.viewportRowStart + a, r = Math.max(1, it(o));
|
|
245
|
-
e.push({
|
|
246
|
-
top: n,
|
|
247
|
-
height: r
|
|
248
|
-
}), n += r;
|
|
249
|
-
}
|
|
250
|
-
return e;
|
|
251
|
-
}
|
|
252
|
-
return A.value?.getVisibleRowMetrics() ?? [];
|
|
253
|
-
}), ot = d(() => l.gantt ? (l.rowVersion, zn({
|
|
254
|
-
getCount: () => l.runtime.api.rows.getCount(),
|
|
255
|
-
get: (e) => l.runtime.api.rows.get(e)
|
|
256
|
-
}, l.gantt)) : null), h = d(() => ot.value?.timeline ?? null), At = d(() => ot.value?.criticalTaskIds ?? u), ce = d(() => !l.gantt || !h.value ? [] : (l.rowVersion, Re.value, Fn({
|
|
257
|
-
rows: S.value.displayRows,
|
|
258
|
-
rowMetrics: Be.value,
|
|
259
|
-
viewportRowStart: g.value.viewportRowStart,
|
|
260
|
-
scrollTop: re.value,
|
|
261
|
-
topSpacerHeight: g.value.topSpacerHeight,
|
|
262
|
-
viewportHeight: Math.max(
|
|
263
|
-
q.value,
|
|
264
|
-
S.value.displayRows.length * l.baseRowHeight
|
|
265
|
-
),
|
|
266
|
-
baseRowHeight: l.baseRowHeight,
|
|
267
|
-
resolveRowHeight: it,
|
|
268
|
-
timeline: h.value,
|
|
269
|
-
options: l.gantt,
|
|
270
|
-
criticalTaskIds: At.value
|
|
271
|
-
}))), lt = d(() => {
|
|
272
|
-
l.rowVersion, Re.value;
|
|
273
|
-
const e = [], n = Math.max(q.value, 0);
|
|
274
|
-
return Be.value.forEach((a) => {
|
|
275
|
-
const o = Math.round(a.top - re.value + a.height) + 0.5;
|
|
276
|
-
o >= -1 && o <= n + 1 && e.push(o);
|
|
277
|
-
}), e;
|
|
278
|
-
}), pe = d(() => {
|
|
279
|
-
const e = h.value;
|
|
280
|
-
return !e || !l.gantt ? [] : Xn({
|
|
281
|
-
bars: ce.value,
|
|
282
|
-
resolveFrame: (n) => {
|
|
283
|
-
const a = dt(n), o = je(
|
|
284
|
-
a,
|
|
285
|
-
e,
|
|
286
|
-
l.gantt?.minBarWidth ?? 6,
|
|
287
|
-
n.milestone ? n.height : void 0
|
|
288
|
-
);
|
|
289
|
-
return {
|
|
290
|
-
x: o.x - P.value,
|
|
291
|
-
width: o.width,
|
|
292
|
-
y: n.y,
|
|
293
|
-
height: n.height
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
}), Nt = d(() => B.value ? pe.value.find((e) => Te(e) === B.value) ?? null : null), zt = d(() => {
|
|
298
|
-
const e = Nt.value;
|
|
299
|
-
return e ? /* @__PURE__ */ new Set([
|
|
300
|
-
e.sourceBar.rowId,
|
|
301
|
-
e.targetBar.rowId
|
|
302
|
-
]) : /* @__PURE__ */ new Set();
|
|
303
|
-
}), Ft = d(() => {
|
|
304
|
-
const e = W.value.selectionRange, n = E.value.visibleColumns.length;
|
|
305
|
-
if (!e || n <= 0)
|
|
306
|
-
return null;
|
|
307
|
-
const a = Math.min(e.startColumn, e.endColumn), o = Math.max(e.startColumn, e.endColumn);
|
|
308
|
-
return a !== 0 || o !== n - 1 ? null : {
|
|
309
|
-
startRow: Math.min(e.startRow, e.endRow),
|
|
310
|
-
endRow: Math.max(e.startRow, e.endRow)
|
|
311
|
-
};
|
|
312
|
-
}), He = d(() => {
|
|
313
|
-
const e = /* @__PURE__ */ new Set(), n = Ft.value;
|
|
314
|
-
return S.value.displayRows.forEach((a, o) => {
|
|
315
|
-
if (a.rowId == null)
|
|
316
|
-
return;
|
|
317
|
-
if (S.value.isRowCheckboxSelected?.(a)) {
|
|
318
|
-
e.add(String(a.rowId));
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
if (!n)
|
|
322
|
-
return;
|
|
323
|
-
const r = g.value.viewportRowStart + o;
|
|
324
|
-
r >= n.startRow && r <= n.endRow && e.add(String(a.rowId));
|
|
325
|
-
}), e;
|
|
326
|
-
}), Xt = d(() => Be.value.flatMap((e, n) => {
|
|
327
|
-
const a = S.value.displayRows[n];
|
|
328
|
-
return !a || a.rowId == null || !He.value.has(String(a.rowId)) ? [] : [{
|
|
329
|
-
top: e.top,
|
|
330
|
-
height: e.height
|
|
331
|
-
}];
|
|
332
|
-
})), rt = d(() => S.value.displayRows.map((e, n) => `${e.rowId == null ? n : String(e.rowId)}`).join("|")), Ot = d(() => [...He.value].join("|"));
|
|
333
|
-
function $t(e) {
|
|
334
|
-
const n = S.value.displayRows.findIndex((o) => String(o.rowId) === e);
|
|
335
|
-
if (n < 0)
|
|
336
|
-
return null;
|
|
337
|
-
const a = S.value.displayRows[n];
|
|
338
|
-
return !a || a.rowId == null ? null : {
|
|
339
|
-
rowIndex: g.value.viewportRowStart + n,
|
|
340
|
-
rowId: a.rowId
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
function Kt(e) {
|
|
344
|
-
const n = $t(e), a = E.value.visibleColumns.length;
|
|
345
|
-
!n || a <= 0 || (l.runtime.api.selection.hasSupport() && l.runtime.api.selection.setSnapshot({
|
|
346
|
-
ranges: [{
|
|
347
|
-
startRow: n.rowIndex,
|
|
348
|
-
endRow: n.rowIndex,
|
|
349
|
-
startCol: 0,
|
|
350
|
-
endCol: a - 1,
|
|
351
|
-
startRowId: n.rowId,
|
|
352
|
-
endRowId: n.rowId,
|
|
353
|
-
anchor: {
|
|
354
|
-
rowIndex: n.rowIndex,
|
|
355
|
-
colIndex: 0,
|
|
356
|
-
rowId: n.rowId
|
|
357
|
-
},
|
|
358
|
-
focus: {
|
|
359
|
-
rowIndex: n.rowIndex,
|
|
360
|
-
colIndex: a - 1,
|
|
361
|
-
rowId: n.rowId
|
|
362
|
-
}
|
|
363
|
-
}],
|
|
364
|
-
activeRangeIndex: 0,
|
|
365
|
-
activeCell: {
|
|
366
|
-
rowIndex: n.rowIndex,
|
|
367
|
-
colIndex: 0,
|
|
368
|
-
rowId: n.rowId
|
|
369
|
-
}
|
|
370
|
-
}), l.runtime.api.rowSelection.hasSupport() && l.runtime.api.rowSelection.setFocusedRow(n.rowId));
|
|
371
|
-
}
|
|
372
|
-
const Ut = d(() => {
|
|
373
|
-
if (!l.gantt)
|
|
374
|
-
return "off";
|
|
375
|
-
const e = [
|
|
376
|
-
l.gantt.workingCalendar.workingWeekdays.join(","),
|
|
377
|
-
l.gantt.workingCalendar.holidayDayStarts.join(",")
|
|
378
|
-
].join("@");
|
|
379
|
-
return [
|
|
380
|
-
l.gantt.startKey,
|
|
381
|
-
l.gantt.endKey,
|
|
382
|
-
l.gantt.baselineStartKey ?? "",
|
|
383
|
-
l.gantt.baselineEndKey ?? "",
|
|
384
|
-
l.gantt.progressKey ?? "",
|
|
385
|
-
l.gantt.dependencyKey ?? "",
|
|
386
|
-
l.gantt.labelKey ?? "",
|
|
387
|
-
l.gantt.idKey ?? "",
|
|
388
|
-
l.gantt.criticalKey ?? "",
|
|
389
|
-
l.gantt.computedCriticalPath ? "computed-critical" : "",
|
|
390
|
-
l.gantt.zoomLevel,
|
|
391
|
-
l.gantt.pixelsPerDay,
|
|
392
|
-
l.gantt.timelineStart == null ? "" : String(l.gantt.timelineStart),
|
|
393
|
-
l.gantt.timelineEnd == null ? "" : String(l.gantt.timelineEnd),
|
|
394
|
-
l.gantt.rangePaddingDays,
|
|
395
|
-
e,
|
|
396
|
-
l.gantt.rowBarHeight,
|
|
397
|
-
l.gantt.minBarWidth,
|
|
398
|
-
l.gantt.resizeHandleWidth,
|
|
399
|
-
l.gantt.paneWidth
|
|
400
|
-
].join("|");
|
|
401
|
-
}), jt = d(() => h.value ? [
|
|
402
|
-
h.value.startMs,
|
|
403
|
-
h.value.endMs,
|
|
404
|
-
h.value.totalWidth,
|
|
405
|
-
h.value.pixelsPerDay,
|
|
406
|
-
h.value.zoomLevel
|
|
407
|
-
].join("|") : "none"), Yt = d(() => ce.value.map((e) => [
|
|
408
|
-
String(e.rowUpdateId),
|
|
409
|
-
e.startMs,
|
|
410
|
-
e.endMs,
|
|
411
|
-
e.x,
|
|
412
|
-
e.width,
|
|
413
|
-
e.y,
|
|
414
|
-
e.height,
|
|
415
|
-
e.progress,
|
|
416
|
-
e.critical ? 1 : 0,
|
|
417
|
-
e.criticalSource ?? "",
|
|
418
|
-
e.milestone ? 1 : 0,
|
|
419
|
-
e.summary ? 1 : 0,
|
|
420
|
-
e.baselineStartMs ?? "",
|
|
421
|
-
e.baselineEndMs ?? "",
|
|
422
|
-
e.dependencyRefs.map((n) => `${n.taskId}:${n.type}`).join(",")
|
|
423
|
-
].join(":")).join("|")), qt = d(() => lt.value.join("|")), Ge = b(l.gantt?.paneWidth ?? 520), be = d(() => Lt({
|
|
424
|
-
requestedWidth: Ge.value,
|
|
425
|
-
stageWidth: _e.value,
|
|
426
|
-
minTableWidth: qe,
|
|
427
|
-
minTimelineWidth: Je
|
|
428
|
-
})), Jt = d(() => ({
|
|
429
|
-
width: `${be.value}px`,
|
|
430
|
-
minWidth: `${be.value}px`,
|
|
431
|
-
maxWidth: `${be.value}px`
|
|
432
|
-
})), Zt = d(() => ({
|
|
433
|
-
left: `${be.value}px`,
|
|
434
|
-
width: `${qn}px`
|
|
435
|
-
})), Qt = d(() => ({
|
|
436
|
-
height: `${Y.value}px`
|
|
437
|
-
})), en = d(() => ({
|
|
438
|
-
height: `${Y.value}px`
|
|
439
|
-
})), tn = d(() => ({
|
|
440
|
-
width: `${h.value?.totalWidth ?? 1}px`,
|
|
441
|
-
minWidth: `${h.value?.totalWidth ?? 1}px`,
|
|
442
|
-
height: `${Y.value}px`
|
|
443
|
-
})), nn = d(() => ({
|
|
444
|
-
width: `${h.value?.totalWidth ?? 1}px`,
|
|
445
|
-
minWidth: `${h.value?.totalWidth ?? 1}px`,
|
|
446
|
-
height: `${Math.max(q.value, 1)}px`
|
|
447
|
-
})), an = d(() => se.value ? "col-resize" : m.value ? m.value.mode === "move" ? "grabbing" : "col-resize" : J.value ? J.value.mode === "move" ? "grab" : "col-resize" : O.value ? "pointer" : "default");
|
|
448
|
-
function st() {
|
|
449
|
-
B.value == null && O.value == null || (B.value = null, O.value = null, w("body"));
|
|
450
|
-
}
|
|
451
|
-
function dt(e) {
|
|
452
|
-
const n = m.value;
|
|
453
|
-
return !n || n.rowId !== e.rowId ? {
|
|
454
|
-
startMs: e.startMs,
|
|
455
|
-
endMs: e.endMs
|
|
456
|
-
} : {
|
|
457
|
-
startMs: n.draftStartMs,
|
|
458
|
-
endMs: n.draftEndMs
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
|
-
function Ve(e) {
|
|
462
|
-
typeof document > "u" || (document.body.style.cursor = e ? "col-resize" : "", document.body.style.userSelect = e ? "none" : "");
|
|
463
|
-
}
|
|
464
|
-
function ut(e, n, a, o, r) {
|
|
465
|
-
for (const t of n) {
|
|
466
|
-
if (t.width < 18)
|
|
467
|
-
continue;
|
|
468
|
-
const v = Math.max(0, t.x), f = Math.min(r, t.x + t.width);
|
|
469
|
-
f <= v || (e.save(), e.beginPath(), e.rect(v, a, f - v, o), e.clip(), e.fillText(
|
|
470
|
-
t.label,
|
|
471
|
-
Math.max(v + 8, t.x + 8),
|
|
472
|
-
a + o / 2
|
|
473
|
-
), e.restore());
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
function on() {
|
|
477
|
-
const e = h.value, n = L.value;
|
|
478
|
-
if (!e || !n)
|
|
479
|
-
return;
|
|
480
|
-
const a = Math.max(1, Y.value), o = Math.max(1, N.value || n.clientWidth || 1), r = Dt({
|
|
481
|
-
timeline: e,
|
|
482
|
-
scrollLeft: P.value,
|
|
483
|
-
viewportWidth: o,
|
|
484
|
-
workingCalendar: l.gantt?.workingCalendar ?? null,
|
|
485
|
-
headerBufferPx: 0,
|
|
486
|
-
bodyBufferPx: Et
|
|
487
|
-
}).header, t = et(
|
|
488
|
-
Ze.value,
|
|
489
|
-
o,
|
|
490
|
-
a
|
|
491
|
-
);
|
|
492
|
-
if (!t)
|
|
493
|
-
return;
|
|
494
|
-
const v = M("--datagrid-column-divider-color", "rgba(148, 163, 184, 0.24)"), f = M("--datagrid-header-divider-color", "rgba(148, 163, 184, 0.42)"), H = M("--datagrid-header-row-bg", "#f8fafc"), D = M("--datagrid-weekend-bg", "rgba(148, 163, 184, 0.12)"), _ = M("--datagrid-text-primary", "#0f172a"), K = M("--datagrid-font-family", "ui-sans-serif, system-ui, sans-serif"), U = M("--datagrid-accent-strong", "#2563eb"), G = Math.max(16, Math.round(a * 0.46)), ne = G, Ie = Math.max(1, a - G);
|
|
495
|
-
t.fillStyle = H, t.fillRect(0, 0, o, a), t.fillStyle = D;
|
|
496
|
-
for (const V of r.nonWorkingSpans) {
|
|
497
|
-
const x = Math.max(0, V.x), Se = Math.min(o, V.x + V.width);
|
|
498
|
-
Se <= x || t.fillRect(x, ne, Se - x, Ie);
|
|
499
|
-
}
|
|
500
|
-
t.strokeStyle = v, t.lineWidth = 1;
|
|
501
|
-
for (const V of r.secondaryLines) {
|
|
502
|
-
const x = Math.round(V.x) + 0.5;
|
|
503
|
-
t.beginPath(), t.moveTo(x, ne), t.lineTo(x, a), t.stroke();
|
|
504
|
-
}
|
|
505
|
-
t.strokeStyle = f;
|
|
506
|
-
for (const V of r.primaryLines) {
|
|
507
|
-
const x = Math.round(V.x) + 0.5;
|
|
508
|
-
t.beginPath(), t.moveTo(x, 0), t.lineTo(x, a), t.stroke();
|
|
509
|
-
}
|
|
510
|
-
t.beginPath(), t.moveTo(0, ne - 0.5), t.lineTo(o, ne - 0.5), t.stroke(), t.strokeStyle = f, t.beginPath(), t.moveTo(0, a - 0.5), t.lineTo(o, a - 0.5), t.stroke(), t.fillStyle = _, t.font = `12px ${K}`, t.textBaseline = "middle", ut(t, r.primarySegments, 0, G, o), ut(t, r.secondarySegments, ne, Ie, o);
|
|
511
|
-
const ae = Wt(Le(Date.now()), e) - P.value;
|
|
512
|
-
ae >= -1 && ae <= o + 1 && (t.strokeStyle = U, t.lineWidth = 2, t.beginPath(), t.moveTo(Math.round(ae) + 0.5, 0), t.lineTo(Math.round(ae) + 0.5, a), t.stroke());
|
|
513
|
-
}
|
|
514
|
-
function ln() {
|
|
515
|
-
const e = h.value, n = k.value;
|
|
516
|
-
if (!e || !n)
|
|
517
|
-
return;
|
|
518
|
-
const a = Math.max(1, q.value || n.clientHeight || ce.value.length * l.baseRowHeight), o = Math.max(1, N.value || n.clientWidth || 1), r = Dt({
|
|
519
|
-
timeline: e,
|
|
520
|
-
scrollLeft: P.value,
|
|
521
|
-
viewportWidth: o,
|
|
522
|
-
workingCalendar: l.gantt?.workingCalendar ?? null,
|
|
523
|
-
headerBufferPx: 0,
|
|
524
|
-
bodyBufferPx: Et
|
|
525
|
-
}).body, t = et(le.value, o, a);
|
|
526
|
-
if (!t)
|
|
527
|
-
return;
|
|
528
|
-
const v = M("--datagrid-viewport-bg", "#ffffff"), f = M("--datagrid-column-divider-color", "rgba(148, 163, 184, 0.16)"), H = M("--datagrid-row-divider-color", "rgba(148, 163, 184, 0.18)"), D = M("--datagrid-weekend-bg", "rgba(148, 163, 184, 0.08)"), _ = M("--datagrid-selection-range-bg", "rgba(37, 99, 235, 0.16)"), K = M("--datagrid-accent-strong", "#2563eb"), U = M("--datagrid-selection-range-bg", "rgba(37, 99, 235, 0.16)"), G = "rgba(30, 64, 175, 0.24)", ne = "rgba(30, 64, 175, 0.96)", Ie = "rgba(59, 130, 246, 0.92)", ae = "rgba(100, 116, 139, 0.28)", V = "rgba(71, 85, 105, 0.44)", x = "rgba(220, 38, 38, 0.62)", Se = "rgba(5, 150, 105, 0.56)", wn = "rgba(255, 255, 255, 0.28)", mt = "#dc2626", wt = "rgba(220, 38, 38, 0.76)", yn = "rgba(15, 23, 42, 0.32)", pn = "rgba(255, 255, 255, 0.72)", yt = "rgba(15, 23, 42, 0.84)", pt = "rgba(255, 255, 255, 0.94)", bn = "rgba(37, 99, 235, 0.68)", Sn = "rgba(255, 255, 255, 0.9)", Mn = M("--datagrid-header-divider-color", "rgba(148, 163, 184, 0.3)"), Tn = "#ffffff", Rn = M("--datagrid-font-family", "ui-sans-serif, system-ui, sans-serif"), In = M("--datagrid-accent-strong", "#2563eb"), Pn = (i) => i.isDependencySelectedBar ? {
|
|
529
|
-
stroke: yt,
|
|
530
|
-
underlay: pt
|
|
531
|
-
} : i.isTableRowSelected ? {
|
|
532
|
-
stroke: bn,
|
|
533
|
-
underlay: Sn
|
|
534
|
-
} : null;
|
|
535
|
-
t.fillStyle = v, t.fillRect(0, 0, o, a), t.fillStyle = D;
|
|
536
|
-
for (const i of r.nonWorkingSpans) {
|
|
537
|
-
const T = Math.max(0, i.x), ie = Math.min(o, i.x + i.width);
|
|
538
|
-
ie <= T || t.fillRect(T, 0, ie - T, a);
|
|
539
|
-
}
|
|
540
|
-
t.fillStyle = _;
|
|
541
|
-
for (const i of Xt.value) {
|
|
542
|
-
const T = Math.round(i.top - re.value), ie = Math.max(1, Math.round(i.height)), y = Math.max(0, T), p = Math.min(a, T + ie);
|
|
543
|
-
p <= y || t.fillRect(0, y, o, p - y);
|
|
544
|
-
}
|
|
545
|
-
t.strokeStyle = f, t.lineWidth = 1;
|
|
546
|
-
for (const i of r.secondaryLines) {
|
|
547
|
-
const T = Math.round(i.x) + 0.5;
|
|
548
|
-
t.beginPath(), t.moveTo(T, 0), t.lineTo(T, a), t.stroke();
|
|
549
|
-
}
|
|
550
|
-
t.strokeStyle = Mn;
|
|
551
|
-
for (const i of r.primaryLines) {
|
|
552
|
-
const T = Math.round(i.x) + 0.5;
|
|
553
|
-
t.beginPath(), t.moveTo(T, 0), t.lineTo(T, a), t.stroke();
|
|
554
|
-
}
|
|
555
|
-
t.strokeStyle = H;
|
|
556
|
-
for (const i of lt.value)
|
|
557
|
-
t.beginPath(), t.moveTo(0, i), t.lineTo(o, i), t.stroke();
|
|
558
|
-
const Pe = Wt(Le(Date.now()), e) - P.value;
|
|
559
|
-
Pe >= -1 && Pe <= o + 1 && (t.strokeStyle = In, t.lineWidth = 2, t.beginPath(), t.moveTo(Math.round(Pe) + 0.5, 0), t.lineTo(Math.round(Pe) + 0.5, a), t.stroke());
|
|
560
|
-
for (const i of pe.value) {
|
|
561
|
-
const T = Te(i) === B.value;
|
|
562
|
-
Ht(
|
|
563
|
-
t,
|
|
564
|
-
i.points,
|
|
565
|
-
i.dependencyType,
|
|
566
|
-
T ? yt : yn,
|
|
567
|
-
T ? pt : pn
|
|
568
|
-
);
|
|
569
|
-
}
|
|
570
|
-
t.font = `12px ${Rn}`, t.textBaseline = "middle";
|
|
571
|
-
for (const i of ce.value) {
|
|
572
|
-
const T = dt(i), ie = je(
|
|
573
|
-
T,
|
|
574
|
-
e,
|
|
575
|
-
l.gantt?.minBarWidth ?? 6,
|
|
576
|
-
i.milestone ? i.height : void 0
|
|
577
|
-
), y = ie.x - P.value, p = ie.width, Dn = He.value.has(i.rowId), Wn = zt.value.has(i.rowId), he = Pn({
|
|
578
|
-
isTableRowSelected: Dn,
|
|
579
|
-
isDependencySelectedBar: Wn
|
|
580
|
-
}), kn = i.baselineStartMs != null && i.baselineEndMs != null && (i.baselineStartMs !== i.startMs || i.baselineEndMs !== i.endMs), bt = i.summary ? G : m.value?.rowId === i.rowId ? U : K;
|
|
581
|
-
if (kn) {
|
|
582
|
-
const j = je(
|
|
583
|
-
{
|
|
584
|
-
startMs: i.baselineStartMs,
|
|
585
|
-
endMs: i.baselineEndMs
|
|
586
|
-
},
|
|
587
|
-
e,
|
|
588
|
-
l.gantt?.minBarWidth ?? 6,
|
|
589
|
-
i.milestone ? i.height : void 0
|
|
590
|
-
), ve = j.x - P.value, St = y, Mt = y + p, Tt = ve, Rt = ve + j.width;
|
|
591
|
-
if (i.milestone)
|
|
592
|
-
ue(
|
|
593
|
-
t,
|
|
594
|
-
ve + j.width / 2,
|
|
595
|
-
i.y + i.height / 2,
|
|
596
|
-
Math.max(Math.max(8, j.width - 2), i.height - 2)
|
|
597
|
-
), t.fillStyle = ae, t.fill(), ue(
|
|
598
|
-
t,
|
|
599
|
-
ve + j.width / 2,
|
|
600
|
-
i.y + i.height / 2,
|
|
601
|
-
Math.max(Math.max(8, j.width - 2), i.height - 2)
|
|
602
|
-
), t.strokeStyle = V, t.lineWidth = 1, t.stroke();
|
|
603
|
-
else {
|
|
604
|
-
const Ue = Math.max(4, Math.min(6, Math.round(i.height * 0.34))), It = i.y + i.height - Ue;
|
|
605
|
-
Z(t, ve, It, j.width, Ue, 3), t.fillStyle = ae, t.fill(), Z(t, ve, It, j.width, Ue, 3), t.strokeStyle = V, t.lineWidth = 1, t.stroke();
|
|
606
|
-
}
|
|
607
|
-
nt(
|
|
608
|
-
t,
|
|
609
|
-
Tt,
|
|
610
|
-
St,
|
|
611
|
-
i.y + 2.5,
|
|
612
|
-
St >= Tt ? x : Se
|
|
613
|
-
), nt(
|
|
614
|
-
t,
|
|
615
|
-
Rt,
|
|
616
|
-
Mt,
|
|
617
|
-
i.y + i.height - 2.5,
|
|
618
|
-
Mt >= Rt ? x : Se
|
|
619
|
-
);
|
|
620
|
-
}
|
|
621
|
-
if (i.milestone) {
|
|
622
|
-
ue(t, y + p / 2, i.y + i.height / 2, Math.max(p, i.height)), t.fillStyle = bt, t.fill(), he && (ue(t, y + p / 2, i.y + i.height / 2, Math.max(p, i.height)), t.strokeStyle = he.underlay, t.lineWidth = 4, t.stroke(), ue(t, y + p / 2, i.y + i.height / 2, Math.max(p, i.height)), t.strokeStyle = he.stroke, t.lineWidth = 2, t.stroke()), i.critical && (ue(t, y + p / 2, i.y + i.height / 2, Math.max(p, i.height)), t.strokeStyle = i.criticalSource === "computed" ? wt : mt, t.lineWidth = 2, t.stroke());
|
|
623
|
-
continue;
|
|
624
|
-
}
|
|
625
|
-
Z(t, y, i.y, p, i.height, i.summary ? 4 : 6), t.fillStyle = bt, t.fill(), i.summary && (t.fillStyle = Ie, t.fillRect(y + 4, i.y + 3, Math.max(8, p - 8), 2), t.strokeStyle = ne, t.lineWidth = 2.5, t.beginPath(), t.moveTo(y, i.y + i.height), t.lineTo(y + 6, i.y), t.lineTo(y + p - 6, i.y), t.lineTo(y + p, i.y + i.height), t.stroke()), !i.summary && i.progress > 0 && (Z(t, y, i.y, Math.max(0, p * i.progress), i.height, 6), t.fillStyle = wn, t.fill()), he && (Z(t, y, i.y, p, i.height, 6), t.strokeStyle = he.underlay, t.lineWidth = 4, t.stroke(), Z(t, y, i.y, p, i.height, 6), t.strokeStyle = he.stroke, t.lineWidth = 2, t.stroke()), i.critical && (Z(t, y, i.y, p, i.height, 6), t.strokeStyle = i.criticalSource === "computed" ? wt : mt, t.lineWidth = 2, t.stroke()), t.fillStyle = Tn, Gt(t, i.label, y, i.y, p, i.height);
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
function rn(e) {
|
|
629
|
-
const n = k.value;
|
|
630
|
-
if (!n)
|
|
631
|
-
return 0;
|
|
632
|
-
const a = n.getBoundingClientRect();
|
|
633
|
-
if (e <= a.left + ke) {
|
|
634
|
-
const r = 1 - Math.max(0, e - a.left) / ke;
|
|
635
|
-
return -Math.max(1, Math.round(Ct * r));
|
|
636
|
-
}
|
|
637
|
-
if (e >= a.right - ke) {
|
|
638
|
-
const r = 1 - Math.max(0, a.right - e) / ke;
|
|
639
|
-
return Math.max(1, Math.round(Ct * r));
|
|
640
|
-
}
|
|
641
|
-
return 0;
|
|
642
|
-
}
|
|
643
|
-
function te(e, n) {
|
|
644
|
-
if (P.value = Kn(
|
|
645
|
-
e,
|
|
646
|
-
h.value?.totalWidth ?? 0,
|
|
647
|
-
N.value
|
|
648
|
-
), Ce) {
|
|
649
|
-
w();
|
|
650
|
-
return;
|
|
651
|
-
}
|
|
652
|
-
Ce = !0, n !== "header" && L.value && L.value.scrollLeft !== P.value && (L.value.scrollLeft = P.value), n !== "body" && k.value && k.value.scrollLeft !== P.value && (k.value.scrollLeft = P.value), Ce = !1, w();
|
|
653
|
-
}
|
|
654
|
-
function $() {
|
|
655
|
-
if (!h.value) {
|
|
656
|
-
te(0, "body");
|
|
657
|
-
return;
|
|
658
|
-
}
|
|
659
|
-
te(P.value, "body");
|
|
660
|
-
}
|
|
661
|
-
function Ae() {
|
|
662
|
-
if (Qe.value || !h.value || N.value <= 0)
|
|
663
|
-
return;
|
|
664
|
-
const e = Le(Date.now()), n = e >= h.value.startMs && e <= h.value.endMs ? On({
|
|
665
|
-
dateMs: e,
|
|
666
|
-
timeline: h.value,
|
|
667
|
-
viewportWidth: N.value,
|
|
668
|
-
align: "center"
|
|
669
|
-
}) : 0;
|
|
670
|
-
te(n, "body"), Qe.value = !0;
|
|
671
|
-
}
|
|
672
|
-
function sn(e) {
|
|
673
|
-
const n = e.target;
|
|
674
|
-
n && (at(n), te(n.scrollLeft, "body"));
|
|
675
|
-
}
|
|
676
|
-
function dn(e) {
|
|
677
|
-
const n = e.target;
|
|
678
|
-
n && (at(n), te(n.scrollLeft, "header"));
|
|
679
|
-
}
|
|
680
|
-
function Ne(e) {
|
|
681
|
-
const n = X.value, a = k.value;
|
|
682
|
-
if (!n || !a)
|
|
683
|
-
return;
|
|
684
|
-
const { horizontalDelta: o, verticalDelta: r } = Yn({
|
|
685
|
-
deltaX: e.deltaX,
|
|
686
|
-
deltaY: e.deltaY,
|
|
687
|
-
shiftKey: e.shiftKey
|
|
688
|
-
});
|
|
689
|
-
if (!(o === 0 && r === 0) && (e.preventDefault(), o !== 0 && (a.scrollLeft += o, te(a.scrollLeft, "body")), r !== 0)) {
|
|
690
|
-
const t = n.scrollTop;
|
|
691
|
-
n.scrollTop = t + r, n.scrollTop !== t && (Q(), w("body"));
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
function un(e) {
|
|
695
|
-
e != null && se.value && se.value.pointerId !== e || (se.value = null, Ve(!1), typeof window < "u" && (window.removeEventListener("pointermove", ze), window.removeEventListener("pointerup", Fe)));
|
|
696
|
-
}
|
|
697
|
-
function ze(e) {
|
|
698
|
-
const n = se.value;
|
|
699
|
-
n && (Ge.value = Jn({
|
|
700
|
-
originWidth: n.originWidth,
|
|
701
|
-
deltaX: e.clientX - n.originClientX,
|
|
702
|
-
stageWidth: _e.value,
|
|
703
|
-
minTableWidth: qe,
|
|
704
|
-
minTimelineWidth: Je
|
|
705
|
-
}), ye(), w());
|
|
706
|
-
}
|
|
707
|
-
function Fe(e) {
|
|
708
|
-
un(e.pointerId);
|
|
709
|
-
}
|
|
710
|
-
function cn(e) {
|
|
711
|
-
e.button === 0 && (e.preventDefault(), ee(), se.value = {
|
|
712
|
-
pointerId: e.pointerId,
|
|
713
|
-
originClientX: e.clientX,
|
|
714
|
-
originWidth: be.value
|
|
715
|
-
}, Ve(!0), typeof window < "u" && (window.addEventListener("pointermove", ze), window.addEventListener("pointerup", Fe)));
|
|
716
|
-
}
|
|
717
|
-
function Xe(e) {
|
|
718
|
-
const n = le.value;
|
|
719
|
-
if (!n)
|
|
720
|
-
return null;
|
|
721
|
-
const a = n.getBoundingClientRect();
|
|
722
|
-
return {
|
|
723
|
-
x: e.clientX - a.left,
|
|
724
|
-
y: e.clientY - a.top
|
|
725
|
-
};
|
|
726
|
-
}
|
|
727
|
-
function Oe(e) {
|
|
728
|
-
const n = Xe(e);
|
|
729
|
-
return n ? {
|
|
730
|
-
x: n.x + P.value,
|
|
731
|
-
y: n.y
|
|
732
|
-
} : null;
|
|
733
|
-
}
|
|
734
|
-
function hn(e) {
|
|
735
|
-
if (!l.gantt) {
|
|
736
|
-
J.value = null;
|
|
737
|
-
return;
|
|
738
|
-
}
|
|
739
|
-
const n = Xe(e), a = Oe(e);
|
|
740
|
-
if (!n || !a) {
|
|
741
|
-
J.value = null, O.value = null;
|
|
742
|
-
return;
|
|
743
|
-
}
|
|
744
|
-
const o = _t(pe.value, n);
|
|
745
|
-
O.value = o ? Te(o) : null, J.value = kt(
|
|
746
|
-
ce.value,
|
|
747
|
-
a,
|
|
748
|
-
l.gantt.resizeHandleWidth
|
|
749
|
-
), J.value && (O.value = null);
|
|
750
|
-
}
|
|
751
|
-
function vn() {
|
|
752
|
-
if (!l.gantt || !m.value) {
|
|
753
|
-
m.value = null;
|
|
754
|
-
return;
|
|
755
|
-
}
|
|
756
|
-
const e = m.value;
|
|
757
|
-
if (m.value = null, e.initialStartMs === e.draftStartMs && e.initialEndMs === e.draftEndMs) {
|
|
758
|
-
w("body");
|
|
759
|
-
return;
|
|
760
|
-
}
|
|
761
|
-
l.runtime.api.rows.applyEdits([Un(
|
|
762
|
-
e.rowUpdateId,
|
|
763
|
-
{
|
|
764
|
-
startMs: e.draftStartMs,
|
|
765
|
-
endMs: e.draftEndMs
|
|
766
|
-
},
|
|
767
|
-
l.gantt
|
|
768
|
-
)], {
|
|
769
|
-
reapply: !0
|
|
770
|
-
}), w("body");
|
|
771
|
-
}
|
|
772
|
-
function $e(e) {
|
|
773
|
-
if (!m.value || !h.value)
|
|
774
|
-
return;
|
|
775
|
-
const n = rn(e.clientX);
|
|
776
|
-
n !== 0 && te(P.value + n, "body");
|
|
777
|
-
const a = Oe(e);
|
|
778
|
-
if (!a)
|
|
779
|
-
return;
|
|
780
|
-
const o = (a.x - m.value.originX) / h.value.pixelsPerDay, r = $n({
|
|
781
|
-
startMs: m.value.initialStartMs,
|
|
782
|
-
endMs: m.value.initialEndMs
|
|
783
|
-
}, m.value.mode, o, h.value.zoomLevel, l.gantt?.workingCalendar);
|
|
784
|
-
m.value = {
|
|
785
|
-
...m.value,
|
|
786
|
-
draftStartMs: r.startMs,
|
|
787
|
-
draftEndMs: r.endMs
|
|
788
|
-
}, w("body");
|
|
789
|
-
}
|
|
790
|
-
function Ke(e) {
|
|
791
|
-
!m.value || e.pointerId !== m.value.pointerId || (le.value?.hasPointerCapture?.(e.pointerId) && le.value.releasePointerCapture(e.pointerId), vn(), typeof window < "u" && (window.removeEventListener("pointermove", $e), window.removeEventListener("pointerup", Ke)));
|
|
792
|
-
}
|
|
793
|
-
function fn(e) {
|
|
794
|
-
if (!l.gantt || !h.value)
|
|
795
|
-
return;
|
|
796
|
-
const n = Xe(e), a = Oe(e);
|
|
797
|
-
if (!n || !a)
|
|
798
|
-
return;
|
|
799
|
-
const o = kt(
|
|
800
|
-
ce.value,
|
|
801
|
-
a,
|
|
802
|
-
l.gantt.resizeHandleWidth
|
|
803
|
-
);
|
|
804
|
-
if (o && (Kt(o.bar.rowId), B.value = null, O.value = null), !o) {
|
|
805
|
-
const r = _t(pe.value, n);
|
|
806
|
-
if (r) {
|
|
807
|
-
e.preventDefault(), B.value = Te(r), w("body");
|
|
808
|
-
return;
|
|
809
|
-
}
|
|
810
|
-
st();
|
|
811
|
-
return;
|
|
812
|
-
}
|
|
813
|
-
e.preventDefault(), le.value?.setPointerCapture?.(e.pointerId), m.value = {
|
|
814
|
-
pointerId: e.pointerId,
|
|
815
|
-
rowId: o.bar.rowId,
|
|
816
|
-
rowUpdateId: o.bar.rowUpdateId,
|
|
817
|
-
mode: o.mode,
|
|
818
|
-
originX: a.x,
|
|
819
|
-
initialStartMs: o.bar.startMs,
|
|
820
|
-
initialEndMs: o.bar.endMs,
|
|
821
|
-
draftStartMs: o.bar.startMs,
|
|
822
|
-
draftEndMs: o.bar.endMs
|
|
823
|
-
}, typeof window < "u" && (window.addEventListener("pointermove", $e), window.addEventListener("pointerup", Ke)), w("body");
|
|
824
|
-
}
|
|
825
|
-
function gn(e) {
|
|
826
|
-
m.value || hn(e);
|
|
827
|
-
}
|
|
828
|
-
function mn() {
|
|
829
|
-
m.value || (J.value = null, O.value = null);
|
|
830
|
-
}
|
|
831
|
-
function ct(e) {
|
|
832
|
-
e.key !== "Escape" || m.value || st();
|
|
833
|
-
}
|
|
834
|
-
function ht() {
|
|
835
|
-
xe?.(), xe = null, X.value = null;
|
|
836
|
-
}
|
|
837
|
-
function vt() {
|
|
838
|
-
if (z?.disconnect(), z = null, typeof window > "u" || typeof window.ResizeObserver != "function")
|
|
839
|
-
return;
|
|
840
|
-
z = new window.ResizeObserver(() => {
|
|
841
|
-
ee(), we(), Q(), ye(), $(), w();
|
|
842
|
-
});
|
|
843
|
-
const e = A.value?.getHeaderElement() ?? null;
|
|
844
|
-
e && z.observe(e), X.value && z.observe(X.value), I.value && z.observe(I.value), k.value && z.observe(k.value);
|
|
845
|
-
}
|
|
846
|
-
function ft() {
|
|
847
|
-
const e = A.value?.getBodyViewportElement() ?? null;
|
|
848
|
-
if (e === X.value) {
|
|
849
|
-
ee(), we(), Q(), vt(), $(), w();
|
|
850
|
-
return;
|
|
851
|
-
}
|
|
852
|
-
if (ht(), X.value = e, !e) {
|
|
853
|
-
ee(), we(), $(), w();
|
|
854
|
-
return;
|
|
855
|
-
}
|
|
856
|
-
const n = () => {
|
|
857
|
-
Q(), w("body");
|
|
858
|
-
};
|
|
859
|
-
e.addEventListener("scroll", n, { passive: !0 }), ee(), we(), Q(), xe = () => {
|
|
860
|
-
e.removeEventListener("scroll", n);
|
|
861
|
-
}, vt(), $(), w();
|
|
862
|
-
}
|
|
863
|
-
function gt() {
|
|
864
|
-
ee(), we(), Q(), ye(), $(), w();
|
|
865
|
-
}
|
|
866
|
-
return fe(
|
|
867
|
-
() => l.gantt?.paneWidth,
|
|
868
|
-
(e) => {
|
|
869
|
-
Ge.value = e ?? 520;
|
|
870
|
-
},
|
|
871
|
-
{ immediate: !0 }
|
|
872
|
-
), fe(
|
|
873
|
-
() => [
|
|
874
|
-
rt.value,
|
|
875
|
-
S.value.displayRows.length,
|
|
876
|
-
g.value.topSpacerHeight,
|
|
877
|
-
g.value.viewportRowStart,
|
|
878
|
-
Ut.value,
|
|
879
|
-
l.rowVersion,
|
|
880
|
-
Re.value
|
|
881
|
-
],
|
|
882
|
-
() => {
|
|
883
|
-
Pt(() => {
|
|
884
|
-
ft(), Q(), ye(), $(), Ae(), w();
|
|
885
|
-
});
|
|
886
|
-
}
|
|
887
|
-
), fe(
|
|
888
|
-
() => [h.value?.totalWidth ?? 0, N.value],
|
|
889
|
-
() => {
|
|
890
|
-
$(), Ae();
|
|
891
|
-
}
|
|
892
|
-
), fe(
|
|
893
|
-
() => [
|
|
894
|
-
Yt.value,
|
|
895
|
-
Ot.value,
|
|
896
|
-
qt.value,
|
|
897
|
-
re.value,
|
|
898
|
-
q.value
|
|
899
|
-
],
|
|
900
|
-
() => {
|
|
901
|
-
w("body");
|
|
902
|
-
}
|
|
903
|
-
), fe(
|
|
904
|
-
() => [
|
|
905
|
-
jt.value,
|
|
906
|
-
Y.value
|
|
907
|
-
],
|
|
908
|
-
() => {
|
|
909
|
-
w();
|
|
910
|
-
}
|
|
911
|
-
), fe(
|
|
912
|
-
() => pe.value.map((e) => Te(e)).join("|"),
|
|
913
|
-
(e) => {
|
|
914
|
-
B.value && !e.split("|").includes(B.value) && (B.value = null, w("body"));
|
|
915
|
-
}
|
|
916
|
-
), xn(() => {
|
|
917
|
-
I.value && (Ee = An({
|
|
918
|
-
root: I.value,
|
|
919
|
-
resolveScrollContainers: () => [
|
|
920
|
-
X.value,
|
|
921
|
-
k.value,
|
|
922
|
-
L.value
|
|
923
|
-
]
|
|
924
|
-
})), Pt(() => {
|
|
925
|
-
ee(), ft(), ye(), $(), Ae(), w();
|
|
926
|
-
}), typeof window < "u" && (window.addEventListener("resize", gt), window.addEventListener("keydown", ct));
|
|
927
|
-
}), En(() => {
|
|
928
|
-
Vt(), Ee?.(), Ee = null, ht(), z?.disconnect(), z = null, typeof window < "u" && (window.removeEventListener("resize", gt), window.removeEventListener("keydown", ct), window.removeEventListener("pointermove", $e), window.removeEventListener("pointerup", Ke), window.removeEventListener("pointermove", ze), window.removeEventListener("pointerup", Fe)), Ve(!1);
|
|
929
|
-
}), (e, n) => (De(), We("section", {
|
|
930
|
-
ref_key: "stageRootRef",
|
|
931
|
-
ref: I,
|
|
932
|
-
class: "datagrid-gantt-stage"
|
|
933
|
-
}, [
|
|
934
|
-
F("div", {
|
|
935
|
-
class: "datagrid-gantt-stage__table",
|
|
936
|
-
style: oe(Jt.value)
|
|
937
|
-
}, [
|
|
938
|
-
Cn(Nn, Ln({
|
|
939
|
-
ref_key: "tableStageRef",
|
|
940
|
-
ref: A
|
|
941
|
-
}, R.value, { "stage-context": Bn(c) }), null, 16, ["stage-context"])
|
|
942
|
-
], 4),
|
|
943
|
-
e.gantt ? (De(), We("button", {
|
|
944
|
-
key: 0,
|
|
945
|
-
type: "button",
|
|
946
|
-
class: "datagrid-gantt-stage__splitter",
|
|
947
|
-
style: oe(Zt.value),
|
|
948
|
-
"aria-label": "Resize gantt split",
|
|
949
|
-
onPointerdown: cn
|
|
950
|
-
}, null, 36)) : Hn("", !0),
|
|
951
|
-
F("div", na, [
|
|
952
|
-
F("div", {
|
|
953
|
-
class: "datagrid-gantt-stage__timeline-header",
|
|
954
|
-
style: oe(Qt.value)
|
|
955
|
-
}, [
|
|
956
|
-
F("div", {
|
|
957
|
-
ref_key: "timelineHeaderViewportRef",
|
|
958
|
-
ref: L,
|
|
959
|
-
class: "datagrid-gantt-timeline__viewport datagrid-gantt-timeline__viewport--header",
|
|
960
|
-
style: oe(en.value),
|
|
961
|
-
onScroll: dn,
|
|
962
|
-
onWheel: Ne
|
|
963
|
-
}, [
|
|
964
|
-
F("div", {
|
|
965
|
-
class: "datagrid-gantt-timeline__track-spacer",
|
|
966
|
-
style: oe(tn.value)
|
|
967
|
-
}, null, 4)
|
|
968
|
-
], 36),
|
|
969
|
-
F("canvas", {
|
|
970
|
-
ref_key: "headerCanvasRef",
|
|
971
|
-
ref: Ze,
|
|
972
|
-
class: "datagrid-gantt-timeline__canvas datagrid-gantt-timeline__canvas--header",
|
|
973
|
-
"aria-hidden": "true"
|
|
974
|
-
}, null, 512)
|
|
975
|
-
], 4),
|
|
976
|
-
F("div", aa, [
|
|
977
|
-
e.gantt ? (De(), We("div", {
|
|
978
|
-
key: 1,
|
|
979
|
-
ref_key: "timelineBodyViewportRef",
|
|
980
|
-
ref: k,
|
|
981
|
-
class: "datagrid-gantt-timeline__viewport datagrid-gantt-timeline__viewport--body",
|
|
982
|
-
onScroll: sn,
|
|
983
|
-
onWheel: Ne
|
|
984
|
-
}, [
|
|
985
|
-
F("div", {
|
|
986
|
-
class: "datagrid-gantt-timeline__track-spacer",
|
|
987
|
-
style: oe(nn.value)
|
|
988
|
-
}, null, 4)
|
|
989
|
-
], 544)) : (De(), We("div", ia, " Configure `gantt.startKey` and `gantt.endKey` to enable the timeline renderer. ")),
|
|
990
|
-
F("canvas", {
|
|
991
|
-
ref_key: "bodyCanvasRef",
|
|
992
|
-
ref: le,
|
|
993
|
-
class: "datagrid-gantt-timeline__canvas datagrid-gantt-timeline__canvas--body",
|
|
994
|
-
style: oe({ cursor: an.value }),
|
|
995
|
-
onPointerdown: fn,
|
|
996
|
-
onPointermove: gn,
|
|
997
|
-
onPointerleave: mn,
|
|
998
|
-
onWheel: Ne
|
|
999
|
-
}, null, 36)
|
|
1000
|
-
])
|
|
1001
|
-
])
|
|
1002
|
-
], 512));
|
|
1003
|
-
}
|
|
1004
|
-
});
|
|
1005
|
-
export {
|
|
1006
|
-
sa as _
|
|
1007
|
-
};
|