@taskctrl/canvas-timeline 0.3.0 → 0.4.5
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as se, jsxs as
|
|
2
|
-
import ge, { useRef as
|
|
3
|
-
import { flushSync as
|
|
1
|
+
import { jsx as se, jsxs as Ne, Fragment as Nt } from "react/jsx-runtime";
|
|
2
|
+
import ge, { useRef as x, useCallback as ie, useEffect as he, forwardRef as fi, useMemo as oe, useState as Ke, useImperativeHandle as mi } from "react";
|
|
3
|
+
import { flushSync as gi } from "react-dom";
|
|
4
4
|
import pe from "dayjs";
|
|
5
|
-
const
|
|
5
|
+
const Ee = {
|
|
6
6
|
primary: "#269bf7",
|
|
7
7
|
trainColors: {},
|
|
8
8
|
status: { red: "#EF5350", yellow: "#FBBF24", green: "#31c48d" },
|
|
@@ -12,7 +12,7 @@ const we = {
|
|
|
12
12
|
sidebar: { bg: "#F9FAFB", border: "#E5E7EB", text: "#6c737f" },
|
|
13
13
|
header: { bg: "#F9FAFB", border: "#E5E7EB", text: "#6c737f" }
|
|
14
14
|
};
|
|
15
|
-
class
|
|
15
|
+
class ut {
|
|
16
16
|
constructor(e) {
|
|
17
17
|
Object.defineProperty(this, "visibleTimeStart", {
|
|
18
18
|
enumerable: !0,
|
|
@@ -106,7 +106,7 @@ class lt {
|
|
|
106
106
|
return this.groupCount * this.lineHeight;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
class
|
|
109
|
+
class pi {
|
|
110
110
|
constructor() {
|
|
111
111
|
Object.defineProperty(this, "root", {
|
|
112
112
|
enumerable: !0,
|
|
@@ -116,12 +116,12 @@ class hi {
|
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
118
|
buildFromItems(e, t, n) {
|
|
119
|
-
const
|
|
119
|
+
const s = e.map((d) => ({
|
|
120
120
|
item: d,
|
|
121
121
|
start: t(d),
|
|
122
122
|
end: n(d)
|
|
123
123
|
}));
|
|
124
|
-
this.root = this.buildNode(
|
|
124
|
+
this.root = this.buildNode(s);
|
|
125
125
|
}
|
|
126
126
|
buildNode(e) {
|
|
127
127
|
if (e.length === 0)
|
|
@@ -129,13 +129,13 @@ class hi {
|
|
|
129
129
|
let t = 1 / 0, n = -1 / 0;
|
|
130
130
|
for (const c of e)
|
|
131
131
|
c.start < t && (t = c.start), c.end > n && (n = c.end);
|
|
132
|
-
const
|
|
132
|
+
const s = (t + n) / 2, d = [], a = [], u = [];
|
|
133
133
|
for (const c of e)
|
|
134
|
-
c.end <
|
|
134
|
+
c.end < s ? d.push(c) : c.start > s ? a.push(c) : u.push(c);
|
|
135
135
|
return {
|
|
136
|
-
center:
|
|
136
|
+
center: s,
|
|
137
137
|
left: this.buildNode(d),
|
|
138
|
-
right: this.buildNode(
|
|
138
|
+
right: this.buildNode(a),
|
|
139
139
|
overlapping: u
|
|
140
140
|
};
|
|
141
141
|
}
|
|
@@ -143,15 +143,15 @@ class hi {
|
|
|
143
143
|
const n = [];
|
|
144
144
|
return this.queryNode(this.root, e, t, n), n;
|
|
145
145
|
}
|
|
146
|
-
queryNode(e, t, n,
|
|
146
|
+
queryNode(e, t, n, s) {
|
|
147
147
|
if (e !== null) {
|
|
148
148
|
for (const d of e.overlapping)
|
|
149
|
-
d.start <= n && d.end >= t &&
|
|
150
|
-
t <= e.center && e.left !== null && this.queryNode(e.left, t, n,
|
|
149
|
+
d.start <= n && d.end >= t && s.push(d.item);
|
|
150
|
+
t <= e.center && e.left !== null && this.queryNode(e.left, t, n, s), n >= e.center && e.right !== null && this.queryNode(e.right, t, n, s);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
class
|
|
154
|
+
class vi {
|
|
155
155
|
constructor(e, t) {
|
|
156
156
|
Object.defineProperty(this, "lineHeight", {
|
|
157
157
|
enumerable: !0,
|
|
@@ -177,52 +177,52 @@ class fi {
|
|
|
177
177
|
}
|
|
178
178
|
computeLayout(e, t, n) {
|
|
179
179
|
this.layoutCache = /* @__PURE__ */ new Map(), this.groupMaxStack = /* @__PURE__ */ new Map();
|
|
180
|
-
const
|
|
180
|
+
const s = this.lineHeight * this.itemHeightRatio, d = s * 0.6;
|
|
181
181
|
if (!t) {
|
|
182
182
|
for (const u of e) {
|
|
183
183
|
const c = (n == null ? void 0 : n.isParent(u.id)) ?? !1;
|
|
184
|
-
this.layoutCache.set(u.id, { stackLevel: 0, itemHeight: c ? d :
|
|
184
|
+
this.layoutCache.set(u.id, { stackLevel: 0, itemHeight: c ? d : s }), this.groupMaxStack.set(u.group, 0);
|
|
185
185
|
}
|
|
186
186
|
return this.layoutCache;
|
|
187
187
|
}
|
|
188
|
-
const
|
|
188
|
+
const a = /* @__PURE__ */ new Map();
|
|
189
189
|
for (const u of e) {
|
|
190
|
-
let c =
|
|
191
|
-
c || (c = [],
|
|
190
|
+
let c = a.get(u.group);
|
|
191
|
+
c || (c = [], a.set(u.group, c)), c.push(u);
|
|
192
192
|
}
|
|
193
|
-
for (const [u, c] of
|
|
194
|
-
n ? this.computeHierarchyLayout(c, n,
|
|
193
|
+
for (const [u, c] of a)
|
|
194
|
+
n ? this.computeHierarchyLayout(c, n, s, d, u) : this.computeFlatLayout(c, s, u);
|
|
195
195
|
return this.layoutCache;
|
|
196
196
|
}
|
|
197
197
|
computeFlatLayout(e, t, n) {
|
|
198
|
-
e.sort((
|
|
199
|
-
const c =
|
|
200
|
-
return c !== 0 ? c : u.end_time - u.start_time - (
|
|
198
|
+
e.sort((a, u) => {
|
|
199
|
+
const c = a.start_time - u.start_time;
|
|
200
|
+
return c !== 0 ? c : u.end_time - u.start_time - (a.end_time - a.start_time);
|
|
201
201
|
});
|
|
202
|
-
const
|
|
202
|
+
const s = [];
|
|
203
203
|
let d = 0;
|
|
204
|
-
for (const
|
|
204
|
+
for (const a of e) {
|
|
205
205
|
let u = -1;
|
|
206
|
-
for (let c = 0; c <
|
|
207
|
-
if (
|
|
206
|
+
for (let c = 0; c < s.length; c++)
|
|
207
|
+
if (s[c] <= a.start_time) {
|
|
208
208
|
u = c;
|
|
209
209
|
break;
|
|
210
210
|
}
|
|
211
|
-
u === -1 ? (u =
|
|
211
|
+
u === -1 ? (u = s.length, s.push(a.end_time)) : s[u] = a.end_time, u > d && (d = u), this.layoutCache.set(a.id, { stackLevel: u, itemHeight: t });
|
|
212
212
|
}
|
|
213
213
|
this.groupMaxStack.set(n, d);
|
|
214
214
|
}
|
|
215
|
-
computeHierarchyLayout(e, t, n,
|
|
216
|
-
const
|
|
215
|
+
computeHierarchyLayout(e, t, n, s, d) {
|
|
216
|
+
const a = [], u = [];
|
|
217
217
|
for (const g of e)
|
|
218
|
-
t.isParent(g.id) ? u.push(g) :
|
|
219
|
-
|
|
218
|
+
t.isParent(g.id) ? u.push(g) : a.push(g);
|
|
219
|
+
a.sort((g, b) => {
|
|
220
220
|
const T = g.start_time - b.start_time;
|
|
221
221
|
return T !== 0 ? T : b.end_time - b.start_time - (g.end_time - g.start_time);
|
|
222
222
|
});
|
|
223
223
|
const c = [];
|
|
224
224
|
let v = 0;
|
|
225
|
-
for (const g of
|
|
225
|
+
for (const g of a) {
|
|
226
226
|
let b = -1;
|
|
227
227
|
for (let T = 0; T < c.length; T++)
|
|
228
228
|
if (c[T] <= g.start_time) {
|
|
@@ -232,9 +232,9 @@ class fi {
|
|
|
232
232
|
b === -1 ? (b = c.length, c.push(g.end_time)) : c[b] = g.end_time, b > v && (v = b), this.layoutCache.set(g.id, { stackLevel: b, itemHeight: n });
|
|
233
233
|
}
|
|
234
234
|
u.sort((g, b) => t.getNestingDepth(b.id) - t.getNestingDepth(g.id));
|
|
235
|
-
let
|
|
235
|
+
let k = a.length > 0 ? v + 1 : 0;
|
|
236
236
|
for (const g of u)
|
|
237
|
-
this.layoutCache.set(g.id, { stackLevel:
|
|
237
|
+
this.layoutCache.set(g.id, { stackLevel: k, itemHeight: s }), k > v && (v = k), k++;
|
|
238
238
|
this.groupMaxStack.set(d, v);
|
|
239
239
|
}
|
|
240
240
|
getLayout(e) {
|
|
@@ -244,7 +244,7 @@ class fi {
|
|
|
244
244
|
return ((this.groupMaxStack.get(e) ?? 0) + 1) * this.lineHeight;
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
class
|
|
247
|
+
class bi {
|
|
248
248
|
constructor() {
|
|
249
249
|
Object.defineProperty(this, "parentToChildren", {
|
|
250
250
|
enumerable: !0,
|
|
@@ -280,19 +280,19 @@ class mi {
|
|
|
280
280
|
}
|
|
281
281
|
for (const t of this.childToParent.keys()) {
|
|
282
282
|
const n = /* @__PURE__ */ new Set();
|
|
283
|
-
let
|
|
284
|
-
for (;
|
|
285
|
-
if (n.has(
|
|
283
|
+
let s = t;
|
|
284
|
+
for (; s !== void 0; ) {
|
|
285
|
+
if (n.has(s)) {
|
|
286
286
|
const d = this.childToParent.get(t);
|
|
287
287
|
this.childToParent.delete(t);
|
|
288
|
-
const
|
|
289
|
-
if (
|
|
290
|
-
const u =
|
|
291
|
-
u !== -1 &&
|
|
288
|
+
const a = this.parentToChildren.get(d);
|
|
289
|
+
if (a) {
|
|
290
|
+
const u = a.indexOf(t);
|
|
291
|
+
u !== -1 && a.splice(u, 1), a.length === 0 && this.parentToChildren.delete(d);
|
|
292
292
|
}
|
|
293
293
|
break;
|
|
294
294
|
}
|
|
295
|
-
n.add(
|
|
295
|
+
n.add(s), s = this.childToParent.get(s);
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
}
|
|
@@ -309,9 +309,9 @@ class mi {
|
|
|
309
309
|
getDescendants(e) {
|
|
310
310
|
const t = [], n = [...this.getChildren(e)];
|
|
311
311
|
for (; n.length > 0; ) {
|
|
312
|
-
const
|
|
313
|
-
t.push(
|
|
314
|
-
const d = this.parentToChildren.get(
|
|
312
|
+
const s = n.pop();
|
|
313
|
+
t.push(s);
|
|
314
|
+
const d = this.parentToChildren.get(s);
|
|
315
315
|
d && n.push(...d);
|
|
316
316
|
}
|
|
317
317
|
return t;
|
|
@@ -320,31 +320,31 @@ class mi {
|
|
|
320
320
|
const t = this.itemMap.get(e);
|
|
321
321
|
if (!t)
|
|
322
322
|
return { start: 0, end: 0 };
|
|
323
|
-
let n = t.start_time,
|
|
323
|
+
let n = t.start_time, s = t.end_time;
|
|
324
324
|
const d = this.getDescendants(e);
|
|
325
|
-
for (const
|
|
326
|
-
const u = this.itemMap.get(
|
|
327
|
-
u && (u.start_time < n && (n = u.start_time), u.end_time >
|
|
325
|
+
for (const a of d) {
|
|
326
|
+
const u = this.itemMap.get(a);
|
|
327
|
+
u && (u.start_time < n && (n = u.start_time), u.end_time > s && (s = u.end_time));
|
|
328
328
|
}
|
|
329
|
-
return { start: n, end:
|
|
329
|
+
return { start: n, end: s };
|
|
330
330
|
}
|
|
331
331
|
getNestingDepth(e) {
|
|
332
332
|
const t = this.depthCache.get(e);
|
|
333
333
|
if (t !== void 0)
|
|
334
334
|
return t;
|
|
335
|
-
let n = 0,
|
|
336
|
-
for (;
|
|
337
|
-
n++,
|
|
335
|
+
let n = 0, s = this.childToParent.get(e);
|
|
336
|
+
for (; s !== void 0; )
|
|
337
|
+
n++, s = this.childToParent.get(s);
|
|
338
338
|
return this.depthCache.set(e, n), n;
|
|
339
339
|
}
|
|
340
340
|
getMoveDelta(e, t) {
|
|
341
341
|
const n = this.itemMap.get(e);
|
|
342
342
|
if (!n)
|
|
343
343
|
return [];
|
|
344
|
-
const
|
|
345
|
-
return this.getDescendants(e).map((
|
|
346
|
-
const u = this.itemMap.get(
|
|
347
|
-
return { itemId:
|
|
344
|
+
const s = t - n.start_time;
|
|
345
|
+
return this.getDescendants(e).map((a) => {
|
|
346
|
+
const u = this.itemMap.get(a);
|
|
347
|
+
return { itemId: a, newStart: u.start_time + s };
|
|
348
348
|
});
|
|
349
349
|
}
|
|
350
350
|
getResizeConstraint(e, t) {
|
|
@@ -352,78 +352,78 @@ class mi {
|
|
|
352
352
|
if (n.length === 0)
|
|
353
353
|
return t === "left" ? { min: -1 / 0, max: 1 / 0 } : { min: -1 / 0, max: 1 / 0 };
|
|
354
354
|
if (t === "left") {
|
|
355
|
-
let
|
|
355
|
+
let s = 1 / 0;
|
|
356
356
|
for (const d of n) {
|
|
357
|
-
const
|
|
358
|
-
|
|
357
|
+
const a = this.itemMap.get(d);
|
|
358
|
+
a && a.start_time < s && (s = a.start_time);
|
|
359
359
|
}
|
|
360
|
-
return { min: -1 / 0, max:
|
|
360
|
+
return { min: -1 / 0, max: s };
|
|
361
361
|
} else {
|
|
362
|
-
let
|
|
362
|
+
let s = -1 / 0;
|
|
363
363
|
for (const d of n) {
|
|
364
|
-
const
|
|
365
|
-
|
|
364
|
+
const a = this.itemMap.get(d);
|
|
365
|
+
a && a.end_time > s && (s = a.end_time);
|
|
366
366
|
}
|
|
367
|
-
return { min:
|
|
367
|
+
return { min: s, max: 1 / 0 };
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
|
-
function
|
|
372
|
-
const { x:
|
|
373
|
-
i.globalAlpha = 0.15, i.fillStyle =
|
|
371
|
+
function yi(i, e, t, n, s, d) {
|
|
372
|
+
const { x: a, y: u, width: c, height: v } = t, k = d.primary;
|
|
373
|
+
i.globalAlpha = 0.15, i.fillStyle = k, i.fillRect(a, u, c, v), i.globalAlpha = 1, i.strokeStyle = k, i.lineWidth = 1.5, i.strokeRect(a, u, c, v);
|
|
374
374
|
const g = Math.min(v * 0.5, 6), b = u + v / 2;
|
|
375
|
-
i.fillStyle =
|
|
375
|
+
i.fillStyle = k, i.beginPath(), i.moveTo(a, b), i.lineTo(a + g, b - g), i.lineTo(a + g * 2, b), i.lineTo(a + g, b + g), i.closePath(), i.fill(), i.beginPath(), i.moveTo(a + c, b), i.lineTo(a + c - g, b - g), i.lineTo(a + c - g * 2, b), i.lineTo(a + c - g, b + g), i.closePath(), i.fill();
|
|
376
376
|
const T = e.title;
|
|
377
377
|
if (T && c > 30) {
|
|
378
378
|
i.fillStyle = d.item.text, i.font = '500 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', i.textBaseline = "middle";
|
|
379
|
-
const C = i.measureText(T).width,
|
|
380
|
-
if (
|
|
381
|
-
const
|
|
382
|
-
i.fillText(
|
|
379
|
+
const C = i.measureText(T).width, R = c - g * 4 - 4;
|
|
380
|
+
if (R > 20) {
|
|
381
|
+
const O = C > R ? T.slice(0, Math.floor(T.length * R / C)) + "..." : T;
|
|
382
|
+
i.fillText(O, a + c / 2 - Math.min(C, R) / 2, b);
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
|
-
n.selected && (i.strokeStyle = d.item.selectedRing, i.lineWidth = 2, i.strokeRect(
|
|
385
|
+
n.selected && (i.strokeStyle = d.item.selectedRing, i.lineWidth = 2, i.strokeRect(a - 1, u - 1, c + 2, v + 2));
|
|
386
386
|
}
|
|
387
|
-
function
|
|
388
|
-
const
|
|
387
|
+
function je(i, e, t, n, s, d) {
|
|
388
|
+
const a = t.xToTime(i), u = /* @__PURE__ */ new Map();
|
|
389
389
|
for (let g = 0; g < d.length; g++)
|
|
390
390
|
u.set(d[g].id, g);
|
|
391
|
-
const c = n.query(
|
|
392
|
-
let v = null,
|
|
391
|
+
const c = n.query(a, a);
|
|
392
|
+
let v = null, k = -1 / 0;
|
|
393
393
|
for (const g of c) {
|
|
394
394
|
const b = u.get(g.group);
|
|
395
395
|
if (b === void 0)
|
|
396
396
|
continue;
|
|
397
|
-
const T =
|
|
397
|
+
const T = s.getLayout(g.id);
|
|
398
398
|
if (!T)
|
|
399
399
|
continue;
|
|
400
|
-
const C = t.timeToX(g.start_time),
|
|
401
|
-
if (i < C || i > C +
|
|
400
|
+
const C = t.timeToX(g.start_time), R = t.timeToX(g.end_time) - C;
|
|
401
|
+
if (i < C || i > C + R)
|
|
402
402
|
continue;
|
|
403
403
|
const $ = t.groupIndexToY(b) + T.stackLevel * t.lineHeight + (t.lineHeight - T.itemHeight) / 2, S = T.itemHeight;
|
|
404
|
-
e < $ || e > $ + S || $ >
|
|
404
|
+
e < $ || e > $ + S || $ > k && (k = $, v = g);
|
|
405
405
|
}
|
|
406
406
|
return v;
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function dt(i, e, t) {
|
|
409
409
|
const n = e.yToGroupIndex(i);
|
|
410
410
|
return t[n] ?? null;
|
|
411
411
|
}
|
|
412
|
-
function
|
|
413
|
-
const
|
|
414
|
-
return i -
|
|
412
|
+
function Ft(i, e, t, n = 6) {
|
|
413
|
+
const s = t.timeToX(e.start_time), d = t.timeToX(e.end_time);
|
|
414
|
+
return i - s <= n ? "left" : d - i <= n ? "right" : "body";
|
|
415
415
|
}
|
|
416
|
-
function
|
|
417
|
-
const n = window.devicePixelRatio || 1,
|
|
418
|
-
(i.width !==
|
|
419
|
-
const
|
|
420
|
-
return
|
|
416
|
+
function ht(i, e, t) {
|
|
417
|
+
const n = window.devicePixelRatio || 1, s = Math.round(e * n), d = Math.round(t * n);
|
|
418
|
+
(i.width !== s || i.height !== d) && (i.width = s, i.height = d, i.style.width = `${e}px`, i.style.height = `${t}px`);
|
|
419
|
+
const a = i.getContext("2d");
|
|
420
|
+
return a.setTransform(n, 0, 0, n, 0, 0), a;
|
|
421
421
|
}
|
|
422
|
-
function
|
|
422
|
+
function ft(i, e) {
|
|
423
423
|
const t = window.devicePixelRatio || 1;
|
|
424
424
|
i.clearRect(0, 0, e.width / t, e.height / t);
|
|
425
425
|
}
|
|
426
|
-
class
|
|
426
|
+
class Ti {
|
|
427
427
|
constructor(e) {
|
|
428
428
|
Object.defineProperty(this, "dirty", {
|
|
429
429
|
enumerable: !0,
|
|
@@ -459,101 +459,101 @@ class pi {
|
|
|
459
459
|
}));
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
|
-
class
|
|
463
|
-
draw(e, t, n,
|
|
462
|
+
class Si {
|
|
463
|
+
draw(e, t, n, s, d, a, u) {
|
|
464
464
|
const { firstVisible: c, lastVisible: v } = t.getVisibleGroupRange();
|
|
465
465
|
for (let S = c; S <= v; S++) {
|
|
466
|
-
const
|
|
466
|
+
const F = t.groupIndexToY(S), B = n[S];
|
|
467
467
|
if (!B)
|
|
468
468
|
continue;
|
|
469
|
-
let
|
|
470
|
-
const
|
|
471
|
-
|
|
469
|
+
let A;
|
|
470
|
+
const Z = a == null ? void 0 : a(B);
|
|
471
|
+
Z != null && Z.backgroundColor ? A = Z.backgroundColor : A = S % 2 === 0 ? "#FFFFFF" : s.grid.rowAlt, e.fillStyle = A, e.fillRect(0, F, t.canvasWidth, t.lineHeight), e.strokeStyle = (Z == null ? void 0 : Z.borderBottomColor) ?? s.grid.line, e.lineWidth = 0.5, e.beginPath(), e.moveTo(0, F + t.lineHeight), e.lineTo(t.canvasWidth, F + t.lineHeight), e.stroke();
|
|
472
472
|
}
|
|
473
473
|
if (u && u.length > 0)
|
|
474
474
|
for (const S of u) {
|
|
475
|
-
const
|
|
476
|
-
if (B < 0 ||
|
|
475
|
+
const F = t.timeToX(S.start), B = t.timeToX(S.end);
|
|
476
|
+
if (B < 0 || F > t.canvasWidth)
|
|
477
477
|
continue;
|
|
478
|
-
const
|
|
479
|
-
e.fillStyle = `rgb(${Math.round(P * ne + 255 * (1 - ne))},${Math.round(L * ne + 255 * (1 - ne))},${Math.round(
|
|
478
|
+
const A = Math.max(0, F), Z = Math.min(t.canvasWidth, B) - A, ne = S.opacity ?? 0.12, P = parseInt(S.color.slice(1, 3), 16), L = parseInt(S.color.slice(3, 5), 16), q = parseInt(S.color.slice(5, 7), 16);
|
|
479
|
+
e.fillStyle = `rgb(${Math.round(P * ne + 255 * (1 - ne))},${Math.round(L * ne + 255 * (1 - ne))},${Math.round(q * ne + 255 * (1 - ne))})`, e.fillRect(A, 0, Z, t.canvasHeight);
|
|
480
480
|
}
|
|
481
|
-
const
|
|
482
|
-
let
|
|
483
|
-
C < 2 ?
|
|
481
|
+
const k = t.visibleTimeStart, g = t.visibleTimeEnd, C = 864e5 / (g - k) * t.canvasWidth;
|
|
482
|
+
let R = "day";
|
|
483
|
+
C < 2 ? R = "month" : C < 8 && (R = "week");
|
|
484
484
|
{
|
|
485
|
-
let S = pe(
|
|
486
|
-
const
|
|
487
|
-
let B = null,
|
|
485
|
+
let S = pe(k).startOf("day");
|
|
486
|
+
const F = pe(g).endOf("day");
|
|
487
|
+
let B = null, A = 1, Z = 0;
|
|
488
488
|
const ne = [], P = (L) => {
|
|
489
|
-
B !== null && (e.fillStyle = B,
|
|
489
|
+
B !== null && (e.fillStyle = B, A !== 1 && (e.globalAlpha = A), e.fillRect(Z, 0, L - Z, t.canvasHeight), A !== 1 && (e.globalAlpha = 1), B = null, A = 1);
|
|
490
490
|
};
|
|
491
|
-
for (; S.isBefore(
|
|
492
|
-
const L = t.timeToX(S.valueOf()),
|
|
491
|
+
for (; S.isBefore(F); ) {
|
|
492
|
+
const L = t.timeToX(S.valueOf()), q = S.toDate(), J = d == null ? void 0 : d(q);
|
|
493
493
|
let te = null, ue = 1;
|
|
494
|
-
if (
|
|
495
|
-
te =
|
|
494
|
+
if (J != null && J.backgroundColor)
|
|
495
|
+
te = J.backgroundColor, ue = J.opacity ?? 1;
|
|
496
496
|
else {
|
|
497
|
-
const
|
|
498
|
-
(
|
|
497
|
+
const be = S.day();
|
|
498
|
+
(be === 0 || be === 6) && (te = s.grid.weekend);
|
|
499
499
|
}
|
|
500
|
-
|
|
500
|
+
J != null && J.borderColor && ne.push({ x: L, color: J.borderColor }), te === B && ue === A || (P(L), te !== null && (B = te, A = ue, Z = L)), S = S.add(1, "day");
|
|
501
501
|
}
|
|
502
502
|
B !== null && P(t.timeToX(S.valueOf()));
|
|
503
503
|
for (const L of ne)
|
|
504
504
|
e.strokeStyle = L.color, e.lineWidth = 0.5, e.beginPath(), e.moveTo(L.x, 0), e.lineTo(L.x, t.canvasHeight), e.stroke();
|
|
505
505
|
}
|
|
506
|
-
let
|
|
507
|
-
const $ = pe(g).add(1,
|
|
508
|
-
for (e.strokeStyle =
|
|
509
|
-
const S = t.timeToX(
|
|
510
|
-
e.moveTo(S, 0), e.lineTo(S, t.canvasHeight),
|
|
506
|
+
let O = pe(k).startOf(R);
|
|
507
|
+
const $ = pe(g).add(1, R);
|
|
508
|
+
for (e.strokeStyle = s.grid.line, e.lineWidth = 0.5, e.beginPath(); O.isBefore($); ) {
|
|
509
|
+
const S = t.timeToX(O.valueOf());
|
|
510
|
+
e.moveTo(S, 0), e.lineTo(S, t.canvasHeight), O = O.add(1, R);
|
|
511
511
|
}
|
|
512
512
|
if (e.stroke(), u && u.length > 0)
|
|
513
513
|
for (const S of u) {
|
|
514
|
-
const
|
|
515
|
-
if (!(B < 0 ||
|
|
516
|
-
const
|
|
514
|
+
const F = t.timeToX(S.start), B = t.timeToX(S.end);
|
|
515
|
+
if (!(B < 0 || F > t.canvasWidth) && (e.strokeStyle = S.color, e.globalAlpha = 0.4, e.lineWidth = 1, e.beginPath(), F >= 0 && F <= t.canvasWidth && (e.moveTo(F, 0), e.lineTo(F, t.canvasHeight)), B >= 0 && B <= t.canvasWidth && (e.moveTo(B, 0), e.lineTo(B, t.canvasHeight)), e.stroke(), e.globalAlpha = 1, S.label)) {
|
|
516
|
+
const A = Math.max(0, F), Z = Math.min(t.canvasWidth, B) - A;
|
|
517
517
|
e.save(), e.font = '600 10px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
518
|
-
const ne = e.measureText(S.label).width, P = 6, L = ne + P * 2,
|
|
519
|
-
e.fillStyle = S.color, e.globalAlpha = 0.9, e.beginPath(), e.roundRect(
|
|
518
|
+
const ne = e.measureText(S.label).width, P = 6, L = ne + P * 2, q = 18, J = A + (Z - L) / 2, te = 4;
|
|
519
|
+
e.fillStyle = S.color, e.globalAlpha = 0.9, e.beginPath(), e.roundRect(J, te, L, q, 3), e.fill(), e.globalAlpha = 1, e.fillStyle = "#FFFFFF", e.textBaseline = "middle", e.fillText(S.label, J + P, te + q / 2), e.restore();
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
524
|
const Ot = '500 12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
525
|
-
function
|
|
525
|
+
function xt(i, e) {
|
|
526
526
|
return {
|
|
527
527
|
/**
|
|
528
528
|
* Draws a filled rounded rectangle.
|
|
529
529
|
* Default corner radius is 3px.
|
|
530
530
|
*/
|
|
531
|
-
roundRect(t, n,
|
|
532
|
-
i.beginPath(), i.roundRect(t, n,
|
|
531
|
+
roundRect(t, n, s, d, a = 3) {
|
|
532
|
+
i.beginPath(), i.roundRect(t, n, s, d, a), i.fill();
|
|
533
533
|
},
|
|
534
534
|
/**
|
|
535
535
|
* Draws text at (x, y) using the standard item font.
|
|
536
536
|
* If maxWidth is provided and the text is too wide, binary-search truncates it
|
|
537
537
|
* and appends '...' so it fits within maxWidth.
|
|
538
538
|
*/
|
|
539
|
-
fillText(t, n,
|
|
539
|
+
fillText(t, n, s, d) {
|
|
540
540
|
if (i.font = Ot, d !== void 0 && i.measureText(t).width > d) {
|
|
541
|
-
let
|
|
542
|
-
for (;
|
|
543
|
-
const c = Math.ceil((
|
|
544
|
-
i.measureText(v).width <= d ?
|
|
541
|
+
let a = 0, u = t.length;
|
|
542
|
+
for (; a < u; ) {
|
|
543
|
+
const c = Math.ceil((a + u) / 2), v = t.slice(0, c) + "...";
|
|
544
|
+
i.measureText(v).width <= d ? a = c : u = c - 1;
|
|
545
545
|
}
|
|
546
|
-
i.fillText(t.slice(0,
|
|
546
|
+
i.fillText(t.slice(0, a) + "...", n, s);
|
|
547
547
|
} else
|
|
548
|
-
i.fillText(t, n,
|
|
548
|
+
i.fillText(t, n, s);
|
|
549
549
|
},
|
|
550
550
|
/**
|
|
551
551
|
* Creates a 50/50 linear gradient from color1 (0%–50%) to color2 (50%–100%)
|
|
552
552
|
* spanning the given x position and width.
|
|
553
553
|
*/
|
|
554
|
-
gradient(t, n,
|
|
555
|
-
const
|
|
556
|
-
return
|
|
554
|
+
gradient(t, n, s, d) {
|
|
555
|
+
const a = i.createLinearGradient(t, 0, t + n, 0);
|
|
556
|
+
return a.addColorStop(0, s), a.addColorStop(0.5, s), a.addColorStop(0.5, d), a.addColorStop(1, d), a;
|
|
557
557
|
},
|
|
558
558
|
/**
|
|
559
559
|
* Draws a vertical colored bar on the left edge of the item bounds.
|
|
@@ -567,124 +567,124 @@ function Yt(i, e) {
|
|
|
567
567
|
* Supported types: 'check', 'danger-red', 'danger-yellow'.
|
|
568
568
|
* Default size is 14px.
|
|
569
569
|
*/
|
|
570
|
-
icon(t, n,
|
|
570
|
+
icon(t, n, s, d = 14) {
|
|
571
571
|
i.save();
|
|
572
|
-
const
|
|
572
|
+
const a = d / 2;
|
|
573
573
|
if (t === "check") {
|
|
574
|
-
i.fillStyle = "#31c48d", i.beginPath(), i.arc(n +
|
|
575
|
-
const u = n +
|
|
576
|
-
i.moveTo(u -
|
|
574
|
+
i.fillStyle = "#31c48d", i.beginPath(), i.arc(n + a, s + a, a, 0, Math.PI * 2), i.fill(), i.strokeStyle = "#ffffff", i.lineWidth = d * 0.12, i.beginPath();
|
|
575
|
+
const u = n + a, c = s + a;
|
|
576
|
+
i.moveTo(u - a * 0.45, c), i.lineTo(u - a * 0.1, c + a * 0.42), i.lineTo(u + a * 0.45, c - a * 0.35), i.stroke();
|
|
577
577
|
} else if (t === "danger-red" || t === "danger-yellow") {
|
|
578
578
|
const u = t === "danger-red" ? "#EF5350" : "#FBBF24";
|
|
579
|
-
i.fillStyle = u, i.beginPath(), i.moveTo(n +
|
|
580
|
-
const c = d * 0.12, v = n +
|
|
581
|
-
i.fillRect(v,
|
|
579
|
+
i.fillStyle = u, i.beginPath(), i.moveTo(n + a, s), i.lineTo(n + d, s + d), i.lineTo(n, s + d), i.closePath(), i.fill(), i.fillStyle = "#ffffff";
|
|
580
|
+
const c = d * 0.12, v = n + a - c / 2;
|
|
581
|
+
i.fillRect(v, s + d * 0.35, c, d * 0.35), i.beginPath(), i.arc(n + a, s + d * 0.82, c * 0.7, 0, Math.PI * 2), i.fill();
|
|
582
582
|
}
|
|
583
583
|
i.restore();
|
|
584
584
|
},
|
|
585
585
|
/**
|
|
586
586
|
* Draws a pill-shaped badge with centered white text on a colored background.
|
|
587
587
|
*/
|
|
588
|
-
badge(t, n,
|
|
588
|
+
badge(t, n, s, d) {
|
|
589
589
|
i.save(), i.font = Ot;
|
|
590
|
-
const u = i.measureText(t).width, c = 8,
|
|
591
|
-
i.fillStyle = d, i.beginPath(), i.roundRect(n,
|
|
590
|
+
const u = i.measureText(t).width, c = 8, k = 12 + 3 * 2, g = u + c * 2, b = k / 2;
|
|
591
|
+
i.fillStyle = d, i.beginPath(), i.roundRect(n, s, g, k, b), i.fill(), i.fillStyle = "#ffffff", i.textAlign = "center", i.textBaseline = "middle", i.fillText(t, n + g / 2, s + k / 2), i.restore();
|
|
592
592
|
}
|
|
593
593
|
};
|
|
594
594
|
}
|
|
595
|
-
class
|
|
596
|
-
draw(e, t, n,
|
|
597
|
-
const
|
|
595
|
+
class Mi {
|
|
596
|
+
draw(e, t, n, s, d, a, u, c, v, k, g, b, T, C) {
|
|
597
|
+
const R = (t.visibleTimeEnd - t.visibleTimeStart) * 0.1, O = t.visibleTimeStart - R, $ = t.visibleTimeEnd + R, S = d.query(O, $), F = /* @__PURE__ */ new Map();
|
|
598
598
|
for (let P = 0; P < n.length; P++)
|
|
599
|
-
|
|
600
|
-
const B = new Set(
|
|
599
|
+
F.set(n[P].id, P);
|
|
600
|
+
const B = new Set(k), A = /* @__PURE__ */ new Map(), Z = -t.lineHeight, ne = t.canvasHeight + t.lineHeight;
|
|
601
601
|
for (const P of S) {
|
|
602
|
-
const L =
|
|
602
|
+
const L = F.get(P.group);
|
|
603
603
|
if (L === void 0)
|
|
604
604
|
continue;
|
|
605
|
-
const
|
|
606
|
-
if (!
|
|
605
|
+
const q = a.getLayout(P.id);
|
|
606
|
+
if (!q)
|
|
607
607
|
continue;
|
|
608
|
-
const te = t.groupIndexToY(L) +
|
|
609
|
-
if (te + ue <
|
|
608
|
+
const te = t.groupIndexToY(L) + q.stackLevel * t.lineHeight + (t.lineHeight - q.itemHeight) / 2, ue = q.itemHeight;
|
|
609
|
+
if (te + ue < Z || te > ne)
|
|
610
610
|
continue;
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
-
const
|
|
611
|
+
const be = t.timeToX(P.start_time), Re = t.timeToX(P.end_time) - be, ye = { x: be, y: te, width: Re, height: ue };
|
|
612
|
+
A.set(P.id, ye);
|
|
613
|
+
const Pe = {
|
|
614
614
|
selected: B.has(P.id),
|
|
615
615
|
hovered: g === P.id,
|
|
616
616
|
dragging: !1,
|
|
617
617
|
filtered: P.filtered !== !1
|
|
618
618
|
};
|
|
619
619
|
e.save();
|
|
620
|
-
const
|
|
621
|
-
let
|
|
622
|
-
T && (C != null && C.isParent(P.id)) ?
|
|
620
|
+
const xe = xt(e, ye);
|
|
621
|
+
let Ce;
|
|
622
|
+
T && (C != null && C.isParent(P.id)) ? Ce = T : c && (P.type === "control_area_group" || P.type === "construction_train") ? Ce = c : Ce = u, Ce(e, P, ye, Pe, xe), e.restore();
|
|
623
623
|
}
|
|
624
624
|
if (b && b.length > 0) {
|
|
625
625
|
const P = /* @__PURE__ */ new Set();
|
|
626
626
|
for (const L of b)
|
|
627
|
-
|
|
627
|
+
A.has(L.fromItemId) || P.add(L.fromItemId), A.has(L.toItemId) || P.add(L.toItemId);
|
|
628
628
|
if (P.size > 0) {
|
|
629
629
|
const L = /* @__PURE__ */ new Map();
|
|
630
|
-
for (const
|
|
631
|
-
P.has(
|
|
632
|
-
for (const [
|
|
633
|
-
const te =
|
|
630
|
+
for (const q of s)
|
|
631
|
+
P.has(q.id) && L.set(q.id, q);
|
|
632
|
+
for (const [q, J] of L) {
|
|
633
|
+
const te = F.get(J.group);
|
|
634
634
|
if (te === void 0)
|
|
635
635
|
continue;
|
|
636
|
-
const ue =
|
|
636
|
+
const ue = a.getLayout(q);
|
|
637
637
|
if (!ue)
|
|
638
638
|
continue;
|
|
639
|
-
const
|
|
640
|
-
|
|
639
|
+
const Re = t.groupIndexToY(te) + ue.stackLevel * t.lineHeight + (t.lineHeight - ue.itemHeight) / 2, ye = t.timeToX(J.start_time), Pe = t.timeToX(J.end_time) - ye;
|
|
640
|
+
A.set(q, { x: ye, y: Re, width: Pe, height: ue.itemHeight });
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
|
-
this.drawDependencies(e, b,
|
|
643
|
+
this.drawDependencies(e, b, A, g, v);
|
|
644
644
|
}
|
|
645
645
|
}
|
|
646
|
-
drawDependencies(e, t, n,
|
|
647
|
-
for (const
|
|
648
|
-
const u = n.get(
|
|
646
|
+
drawDependencies(e, t, n, s, d) {
|
|
647
|
+
for (const a of t) {
|
|
648
|
+
const u = n.get(a.fromItemId), c = n.get(a.toItemId);
|
|
649
649
|
if (!u || !c)
|
|
650
650
|
continue;
|
|
651
|
-
const v =
|
|
652
|
-
e.strokeStyle = v ? d.primary :
|
|
653
|
-
const
|
|
654
|
-
e.beginPath(), e.moveTo(
|
|
655
|
-
const
|
|
656
|
-
e.fillStyle = e.strokeStyle, e.beginPath(), e.moveTo(b, T), e.lineTo(b -
|
|
651
|
+
const v = s === a.fromItemId || s === a.toItemId;
|
|
652
|
+
e.strokeStyle = v ? d.primary : a.color ?? "#94A3B8", e.lineWidth = v ? 2 : 1.5, e.setLineDash([]);
|
|
653
|
+
const k = u.x + u.width, g = u.y + u.height / 2, b = c.x, T = c.y + c.height / 2, C = Math.abs(b - k), R = Math.max(C * 0.4, 30);
|
|
654
|
+
e.beginPath(), e.moveTo(k, g), e.bezierCurveTo(k + R, g, b - R, T, b, T), e.stroke();
|
|
655
|
+
const O = 6;
|
|
656
|
+
e.fillStyle = e.strokeStyle, e.beginPath(), e.moveTo(b, T), e.lineTo(b - O, T - O / 2), e.lineTo(b - O, T + O / 2), e.closePath(), e.fill();
|
|
657
657
|
}
|
|
658
658
|
}
|
|
659
659
|
}
|
|
660
|
-
class
|
|
661
|
-
draw(e, t, n,
|
|
662
|
-
const { cursorX: d, snapX:
|
|
660
|
+
class ki {
|
|
661
|
+
draw(e, t, n, s) {
|
|
662
|
+
const { cursorX: d, snapX: a, markers: u, interaction: c } = s;
|
|
663
663
|
if (u)
|
|
664
664
|
for (const v of u) {
|
|
665
|
-
const
|
|
666
|
-
if (e.fillStyle = v.color, e.fillRect(
|
|
665
|
+
const k = t.timeToX(v.date);
|
|
666
|
+
if (e.fillStyle = v.color, e.fillRect(k - v.width / 2, 0, v.width, t.canvasHeight), v.label) {
|
|
667
667
|
e.save(), e.font = '500 10px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
668
|
-
const g = e.measureText(v.label).width, b = 8, T = 200, C = Math.min(g + b * 2, T),
|
|
669
|
-
e.fillStyle = v.color, e.beginPath(), e.roundRect(
|
|
670
|
-
const S = T - b * 2,
|
|
671
|
-
e.fillText(
|
|
668
|
+
const g = e.measureText(v.label).width, b = 8, T = 200, C = Math.min(g + b * 2, T), R = 20, O = k - C / 2, $ = 4;
|
|
669
|
+
e.fillStyle = v.color, e.beginPath(), e.roundRect(O, $, C, R, 3), e.fill(), e.fillStyle = "#FFFFFF", e.textBaseline = "middle";
|
|
670
|
+
const S = T - b * 2, F = g > S ? v.label.slice(0, Math.floor(v.label.length * S / g)) + "…" : v.label;
|
|
671
|
+
e.fillText(F, O + b, $ + R / 2), e.restore();
|
|
672
672
|
}
|
|
673
673
|
}
|
|
674
|
-
if (d != null && (e.strokeStyle = n.marker.cursor, e.lineWidth = 1, e.beginPath(), e.moveTo(d, 0), e.lineTo(d, t.canvasHeight), e.stroke()),
|
|
674
|
+
if (d != null && (e.strokeStyle = n.marker.cursor, e.lineWidth = 1, e.beginPath(), e.moveTo(d, 0), e.lineTo(d, t.canvasHeight), e.stroke()), a != null && (e.strokeStyle = n.primary, e.lineWidth = 1, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(a, 0), e.lineTo(a, t.canvasHeight), e.stroke(), e.setLineDash([])), c) {
|
|
675
675
|
c.groupChanged && c.targetGroupY !== void 0 && (e.fillStyle = "rgba(59, 130, 246, 0.08)", e.fillRect(0, c.targetGroupY, t.canvasWidth, t.lineHeight)), e.save(), e.globalAlpha = 0.5;
|
|
676
|
-
const v =
|
|
676
|
+
const v = xt(e, c.bounds);
|
|
677
677
|
c.renderer(e, c.item, c.bounds, { selected: !1, hovered: !1, dragging: !0, filtered: !0 }, v), e.restore();
|
|
678
678
|
}
|
|
679
679
|
}
|
|
680
680
|
}
|
|
681
|
-
const
|
|
682
|
-
function
|
|
681
|
+
const Wt = 120;
|
|
682
|
+
function wi(i) {
|
|
683
683
|
let e = i.deltaY || i.deltaX;
|
|
684
|
-
return i.deltaMode === 1 ? e *= 15 : i.deltaMode === 2 && (e *= 800), Math.max(-
|
|
684
|
+
return i.deltaMode === 1 ? e *= 15 : i.deltaMode === 2 && (e *= 800), Math.max(-Wt, Math.min(Wt, e));
|
|
685
685
|
}
|
|
686
|
-
class
|
|
687
|
-
constructor(e, t, n,
|
|
686
|
+
class Ei {
|
|
687
|
+
constructor(e, t, n, s, d) {
|
|
688
688
|
Object.defineProperty(this, "onZoom", {
|
|
689
689
|
enumerable: !0,
|
|
690
690
|
configurable: !0,
|
|
@@ -710,21 +710,21 @@ class Si {
|
|
|
710
710
|
configurable: !0,
|
|
711
711
|
writable: !0,
|
|
712
712
|
value: void 0
|
|
713
|
-
}), this.onZoom = e, this.visibleTimeStart = t, this.visibleTimeEnd = n, this.minZoom =
|
|
713
|
+
}), this.onZoom = e, this.visibleTimeStart = t, this.visibleTimeEnd = n, this.minZoom = s, this.maxZoom = d;
|
|
714
714
|
}
|
|
715
715
|
updateBounds(e, t) {
|
|
716
716
|
this.visibleTimeStart = e, this.visibleTimeEnd = t;
|
|
717
717
|
}
|
|
718
718
|
handleWheelZoom(e, t) {
|
|
719
|
-
const n =
|
|
720
|
-
let u = Math.round(
|
|
719
|
+
const n = wi(e), s = e.ctrlKey ? 10 : e.metaKey ? 3 : 1, d = n > 0 ? 1 + s * n / 500 : 1 / (1 + s * -n / 500), a = this.visibleTimeEnd - this.visibleTimeStart;
|
|
720
|
+
let u = Math.round(a * d);
|
|
721
721
|
u = Math.max(this.minZoom, Math.min(this.maxZoom, u));
|
|
722
|
-
const c = Math.round(this.visibleTimeStart + (
|
|
722
|
+
const c = Math.round(this.visibleTimeStart + (a - u) * t), v = c + u;
|
|
723
723
|
this.onZoom(c, v);
|
|
724
724
|
}
|
|
725
725
|
}
|
|
726
|
-
const
|
|
727
|
-
class
|
|
726
|
+
const Ci = 4;
|
|
727
|
+
class Hi {
|
|
728
728
|
constructor(e) {
|
|
729
729
|
Object.defineProperty(this, "state", {
|
|
730
730
|
enumerable: !0,
|
|
@@ -743,21 +743,21 @@ class Mi {
|
|
|
743
743
|
value: !1
|
|
744
744
|
}), this.dragSnap = e;
|
|
745
745
|
}
|
|
746
|
-
startInteraction(e, t, n,
|
|
746
|
+
startInteraction(e, t, n, s) {
|
|
747
747
|
this.state = {
|
|
748
748
|
item: e,
|
|
749
749
|
mode: t,
|
|
750
750
|
startX: n,
|
|
751
|
-
startY:
|
|
751
|
+
startY: s,
|
|
752
752
|
currentX: n,
|
|
753
|
-
currentY:
|
|
753
|
+
currentY: s,
|
|
754
754
|
deltaX: 0,
|
|
755
755
|
originalGroup: e.group,
|
|
756
756
|
currentGroup: e.group
|
|
757
757
|
}, this.activated = !1;
|
|
758
758
|
}
|
|
759
759
|
update(e, t) {
|
|
760
|
-
this.state && (this.state.currentX = e, this.state.currentY = t, this.state.deltaX = e - this.state.startX, !this.activated && Math.abs(this.state.deltaX) >=
|
|
760
|
+
this.state && (this.state.currentX = e, this.state.currentY = t, this.state.deltaX = e - this.state.startX, !this.activated && Math.abs(this.state.deltaX) >= Ci && (this.activated = !0));
|
|
761
761
|
}
|
|
762
762
|
setCurrentGroup(e) {
|
|
763
763
|
this.state && (this.state.currentGroup = e);
|
|
@@ -765,14 +765,14 @@ class Mi {
|
|
|
765
765
|
endMove(e) {
|
|
766
766
|
if (!this.state)
|
|
767
767
|
return null;
|
|
768
|
-
const t = this.state.deltaX / e, n = this.state.item.start_time + t,
|
|
769
|
-
return this.state = null, this.activated = !1, { newStartTime:
|
|
768
|
+
const t = this.state.deltaX / e, n = this.state.item.start_time + t, s = Math.round(n / this.dragSnap) * this.dragSnap, d = this.state.currentGroup;
|
|
769
|
+
return this.state = null, this.activated = !1, { newStartTime: s, newGroupId: d };
|
|
770
770
|
}
|
|
771
771
|
endResize(e) {
|
|
772
772
|
if (!this.state)
|
|
773
773
|
return null;
|
|
774
|
-
const t = this.state.deltaX / e, n = this.state.mode === "resize-left" ? "left" : "right", d = (n === "left" ? this.state.item.start_time : this.state.item.end_time) + t,
|
|
775
|
-
return this.state = null, this.activated = !1, { newTime:
|
|
774
|
+
const t = this.state.deltaX / e, n = this.state.mode === "resize-left" ? "left" : "right", d = (n === "left" ? this.state.item.start_time : this.state.item.end_time) + t, a = Math.round(d / this.dragSnap) * this.dragSnap;
|
|
775
|
+
return this.state = null, this.activated = !1, { newTime: a, edge: n };
|
|
776
776
|
}
|
|
777
777
|
cancel() {
|
|
778
778
|
this.state = null, this.activated = !1;
|
|
@@ -791,58 +791,58 @@ class Mi {
|
|
|
791
791
|
return this.state !== null;
|
|
792
792
|
}
|
|
793
793
|
}
|
|
794
|
-
function
|
|
794
|
+
function mt(i, e, t) {
|
|
795
795
|
const n = [];
|
|
796
|
-
for (const
|
|
797
|
-
|
|
796
|
+
for (const s of i)
|
|
797
|
+
s.id !== e && (n.push(t(s.start_time)), n.push(t(s.end_time)));
|
|
798
798
|
return n;
|
|
799
799
|
}
|
|
800
|
-
function
|
|
800
|
+
function Je(i, e, t, n, s) {
|
|
801
801
|
if (e.length === 0)
|
|
802
802
|
return null;
|
|
803
|
-
let d = e[0],
|
|
803
|
+
let d = e[0], a = Math.abs(i - d);
|
|
804
804
|
for (let u = 1; u < e.length; u++) {
|
|
805
805
|
const c = Math.abs(i - e[u]);
|
|
806
|
-
c <
|
|
806
|
+
c < a && (a = c, d = e[u]);
|
|
807
807
|
}
|
|
808
|
-
return
|
|
808
|
+
return a <= t ? d : null;
|
|
809
809
|
}
|
|
810
|
-
var
|
|
811
|
-
function
|
|
810
|
+
var zt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
811
|
+
function $t(i) {
|
|
812
812
|
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
|
|
813
813
|
}
|
|
814
|
-
var
|
|
814
|
+
var Gt = { exports: {} };
|
|
815
815
|
(function(i, e) {
|
|
816
816
|
(function(t, n) {
|
|
817
817
|
i.exports = n();
|
|
818
|
-
})(
|
|
818
|
+
})(zt, function() {
|
|
819
819
|
var t = "day";
|
|
820
|
-
return function(n,
|
|
821
|
-
var
|
|
820
|
+
return function(n, s, d) {
|
|
821
|
+
var a = function(v) {
|
|
822
822
|
return v.add(4 - v.isoWeekday(), t);
|
|
823
|
-
}, u =
|
|
823
|
+
}, u = s.prototype;
|
|
824
824
|
u.isoWeekYear = function() {
|
|
825
|
-
return
|
|
825
|
+
return a(this).year();
|
|
826
826
|
}, u.isoWeek = function(v) {
|
|
827
827
|
if (!this.$utils().u(v)) return this.add(7 * (v - this.isoWeek()), t);
|
|
828
|
-
var
|
|
829
|
-
return C.diff(
|
|
828
|
+
var k, g, b, T, C = a(this), R = (k = this.isoWeekYear(), g = this.$u, b = (g ? d.utc : d)().year(k).startOf("year"), T = 4 - b.isoWeekday(), b.isoWeekday() > 4 && (T += 7), b.add(T, t));
|
|
829
|
+
return C.diff(R, "week") + 1;
|
|
830
830
|
}, u.isoWeekday = function(v) {
|
|
831
831
|
return this.$utils().u(v) ? this.day() || 7 : this.day(this.day() % 7 ? v : v - 7);
|
|
832
832
|
};
|
|
833
833
|
var c = u.startOf;
|
|
834
|
-
u.startOf = function(v,
|
|
835
|
-
var g = this.$utils(), b = !!g.u(
|
|
836
|
-
return g.p(v) === "isoweek" ? b ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : c.bind(this)(v,
|
|
834
|
+
u.startOf = function(v, k) {
|
|
835
|
+
var g = this.$utils(), b = !!g.u(k) || k;
|
|
836
|
+
return g.p(v) === "isoweek" ? b ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : c.bind(this)(v, k);
|
|
837
837
|
};
|
|
838
838
|
};
|
|
839
839
|
});
|
|
840
|
-
})(
|
|
841
|
-
var
|
|
842
|
-
const
|
|
843
|
-
function
|
|
844
|
-
var
|
|
845
|
-
const c =
|
|
840
|
+
})(Gt);
|
|
841
|
+
var Ii = Gt.exports;
|
|
842
|
+
const Ri = /* @__PURE__ */ $t(Ii), Bt = 5;
|
|
843
|
+
function Lt({ groups: i, width: e, lineHeight: t, scrollTop: n, canvasHeight: s, theme: d, groupRenderer: a, onScroll: u }) {
|
|
844
|
+
var O;
|
|
845
|
+
const c = x(null), v = x(!1), k = i.length * t, g = s, b = Math.max(0, Math.floor(n / t) - Bt), T = Math.min(i.length - 1, Math.ceil((n + s) / t) + Bt), C = ie(($) => {
|
|
846
846
|
v.current || u($.currentTarget.scrollTop);
|
|
847
847
|
}, [u]);
|
|
848
848
|
he(() => {
|
|
@@ -850,10 +850,10 @@ function Wt({ groups: i, width: e, lineHeight: t, scrollTop: n, canvasHeight: r,
|
|
|
850
850
|
v.current = !1;
|
|
851
851
|
}));
|
|
852
852
|
}, [n]);
|
|
853
|
-
const
|
|
853
|
+
const R = [];
|
|
854
854
|
for (let $ = b; $ <= T; $++) {
|
|
855
855
|
const S = i[$];
|
|
856
|
-
S &&
|
|
856
|
+
S && R.push(se("div", { style: {
|
|
857
857
|
position: "absolute",
|
|
858
858
|
top: $ * t,
|
|
859
859
|
height: t,
|
|
@@ -861,35 +861,35 @@ function Wt({ groups: i, width: e, lineHeight: t, scrollTop: n, canvasHeight: r,
|
|
|
861
861
|
overflow: "hidden",
|
|
862
862
|
display: "flex",
|
|
863
863
|
alignItems: "stretch",
|
|
864
|
-
borderBottom: `1px solid ${((
|
|
864
|
+
borderBottom: `1px solid ${((O = d.grid) == null ? void 0 : O.line) ?? "#E5E5E5"}`,
|
|
865
865
|
boxSizing: "border-box"
|
|
866
|
-
}, children:
|
|
866
|
+
}, children: a(S) }, S.id));
|
|
867
867
|
}
|
|
868
868
|
return se("div", { ref: c, onScroll: C, style: {
|
|
869
869
|
width: e,
|
|
870
870
|
height: g,
|
|
871
|
-
overflowY:
|
|
871
|
+
overflowY: k > s ? "auto" : "hidden",
|
|
872
872
|
overflowX: "hidden",
|
|
873
873
|
position: "relative",
|
|
874
874
|
borderRight: `1px solid ${d.sidebar.border}`,
|
|
875
875
|
backgroundColor: d.sidebar.bg
|
|
876
|
-
}, children: se("div", { style: { height:
|
|
876
|
+
}, children: se("div", { style: { height: k, position: "relative" }, children: R }) });
|
|
877
877
|
}
|
|
878
|
-
function
|
|
878
|
+
function Pi(i) {
|
|
879
879
|
return null;
|
|
880
880
|
}
|
|
881
|
-
|
|
882
|
-
function
|
|
881
|
+
Pi.displayName = "TodayMarker";
|
|
882
|
+
function Yt(i) {
|
|
883
883
|
return { date: Math.floor(Date.now() / 6e4) * 6e4, color: i.color ?? "#FD7171", width: i.width ?? 6, label: i.label };
|
|
884
884
|
}
|
|
885
|
-
function
|
|
885
|
+
function Di(i) {
|
|
886
886
|
return i.interval ?? 1e4;
|
|
887
887
|
}
|
|
888
|
-
function
|
|
888
|
+
function Xi(i) {
|
|
889
889
|
return null;
|
|
890
890
|
}
|
|
891
|
-
|
|
892
|
-
function
|
|
891
|
+
Xi.displayName = "CustomMarker";
|
|
892
|
+
function At(i) {
|
|
893
893
|
return {
|
|
894
894
|
date: i.date,
|
|
895
895
|
color: i.color ?? "#3B82F6",
|
|
@@ -897,378 +897,393 @@ function Bt(i) {
|
|
|
897
897
|
label: i.label
|
|
898
898
|
};
|
|
899
899
|
}
|
|
900
|
-
pe.extend(
|
|
901
|
-
function
|
|
900
|
+
pe.extend(Ri);
|
|
901
|
+
function _i(i) {
|
|
902
902
|
return i ? {
|
|
903
|
-
...
|
|
903
|
+
...Ee,
|
|
904
904
|
...i,
|
|
905
|
-
status: { ...
|
|
906
|
-
grid: { ...
|
|
907
|
-
item: { ...
|
|
908
|
-
marker: { ...
|
|
909
|
-
sidebar: { ...
|
|
910
|
-
header: { ...
|
|
911
|
-
} :
|
|
905
|
+
status: { ...Ee.status, ...i.status },
|
|
906
|
+
grid: { ...Ee.grid, ...i.grid },
|
|
907
|
+
item: { ...Ee.item, ...i.item },
|
|
908
|
+
marker: { ...Ee.marker, ...i.marker },
|
|
909
|
+
sidebar: { ...Ee.sidebar, ...i.sidebar },
|
|
910
|
+
header: { ...Ee.header, ...i.header }
|
|
911
|
+
} : Ee;
|
|
912
912
|
}
|
|
913
|
-
const
|
|
914
|
-
const { groups: n, items:
|
|
913
|
+
const jt = 32, Vi = ge.memo(fi(function(e, t) {
|
|
914
|
+
const { groups: n, items: s, defaultTimeStart: d, defaultTimeEnd: a, sidebarWidth: u, lineHeight: c, itemHeightRatio: v, stackItems: k, canMove: g, canChangeGroup: b, canResize: T, dragSnap: C, minZoom: R, maxZoom: O, theme: $, dayStyle: S, rowStyle: F, showCursorLine: B, itemRenderer: A, groupRenderer: Z, sidebarGroupRenderer: ne, dependencies: P, highlights: L, onItemClick: q, onItemDoubleClick: J, onItemContextMenu: te, onItemMove: ue, onItemResize: be, moveResizeValidator: Re, onItemHover: ye, onCanvasDoubleClick: Pe, onCanvasContextMenu: xe, onTimeChange: Ce, onZoom: gt, selected: pt = [], rightSidebarWidth: Qe, rightSidebarGroupRenderer: vt, onReady: ze, devBadge: Zt, children: Se } = e, Te = oe(() => _i($), [$]), bt = ie((r, o) => {
|
|
915
915
|
for (let h = 0; h < o.length; h++)
|
|
916
|
-
if (o[h].id ===
|
|
916
|
+
if (o[h].id === r)
|
|
917
917
|
return h;
|
|
918
918
|
return 0;
|
|
919
|
-
}, []),
|
|
919
|
+
}, []), qt = pt.join(","), et = oe(() => pt, [qt]), yt = x(null), Tt = x(null), St = x(null), Oe = x(null), Mt = x(null), Ut = x(null), [Kt, Jt] = Ke(800);
|
|
920
920
|
he(() => {
|
|
921
|
-
const
|
|
922
|
-
if (!
|
|
921
|
+
const r = Mt.current;
|
|
922
|
+
if (!r)
|
|
923
923
|
return;
|
|
924
924
|
const o = new ResizeObserver((h) => {
|
|
925
925
|
const f = h[0];
|
|
926
|
-
f &&
|
|
926
|
+
f && Jt(f.contentRect.width);
|
|
927
927
|
});
|
|
928
|
-
return o.observe(
|
|
928
|
+
return o.observe(r), () => o.disconnect();
|
|
929
929
|
}, []);
|
|
930
|
-
const
|
|
930
|
+
const Me = Math.max(0, Kt - u - (Qe ?? 0)), ke = n.length * c, D = x(new ut({
|
|
931
931
|
visibleTimeStart: e.visibleTimeStart ?? d,
|
|
932
|
-
visibleTimeEnd: e.visibleTimeEnd ??
|
|
933
|
-
canvasWidth:
|
|
932
|
+
visibleTimeEnd: e.visibleTimeEnd ?? a,
|
|
933
|
+
canvasWidth: Me,
|
|
934
934
|
canvasHeight: ke,
|
|
935
935
|
sidebarWidth: u,
|
|
936
936
|
lineHeight: c,
|
|
937
937
|
groupCount: n.length,
|
|
938
938
|
buffer: e.buffer ?? 3,
|
|
939
939
|
scrollTop: 0
|
|
940
|
-
})),
|
|
941
|
-
const
|
|
942
|
-
|
|
943
|
-
}, []),
|
|
944
|
-
|
|
945
|
-
}, [
|
|
940
|
+
})), tt = x(null), We = x(void 0), ve = x(null), He = x(!1), kt = 4, [wt, Qt] = Ke(e.visibleTimeStart ?? d), [Et, ei] = Ke(e.visibleTimeEnd ?? a), [Ct, $e] = Ke(0), Be = x(null), De = ie(() => {
|
|
941
|
+
const r = D.current;
|
|
942
|
+
Qt(r.visibleTimeStart), ei(r.visibleTimeEnd), $e(r.scrollTop), Be.current = null;
|
|
943
|
+
}, []), it = ie(() => {
|
|
944
|
+
Be.current === null && (Be.current = setTimeout(De, jt));
|
|
945
|
+
}, [De]);
|
|
946
946
|
he(() => () => {
|
|
947
|
-
|
|
947
|
+
Be.current !== null && clearTimeout(Be.current);
|
|
948
948
|
}, []);
|
|
949
|
-
const
|
|
950
|
-
const
|
|
951
|
-
return
|
|
952
|
-
}, [
|
|
953
|
-
const
|
|
954
|
-
return
|
|
955
|
-
}, [
|
|
956
|
-
const
|
|
957
|
-
return
|
|
958
|
-
}, [
|
|
959
|
-
|
|
960
|
-
}, [e.summaryRenderer,
|
|
961
|
-
const
|
|
962
|
-
return ge.Children.forEach(
|
|
949
|
+
const Ie = oe(() => {
|
|
950
|
+
const r = new bi();
|
|
951
|
+
return r.rebuild(s), r;
|
|
952
|
+
}, [s]), nt = oe(() => {
|
|
953
|
+
const r = new pi();
|
|
954
|
+
return r.buildFromItems(s, (o) => Ie.getEffectiveSpan(o.id).start, (o) => Ie.getEffectiveSpan(o.id).end), r;
|
|
955
|
+
}, [s, Ie]), rt = oe(() => {
|
|
956
|
+
const r = new vi(c, v);
|
|
957
|
+
return r.computeLayout(s, k, Ie), r;
|
|
958
|
+
}, [s, c, v, k, Ie]), Ht = oe(() => e.summaryRenderer ? e.summaryRenderer : (r, o, h, f, l) => {
|
|
959
|
+
yi(r, o, h, f, l, Te);
|
|
960
|
+
}, [e.summaryRenderer, Te]), Xe = oe(() => new Si(), []), _e = oe(() => new Mi(), []), Fe = oe(() => new ki(), []), Q = oe(() => new Hi(C), [C]), Ge = oe(() => {
|
|
961
|
+
const r = [];
|
|
962
|
+
return ge.Children.forEach(Se, (o) => {
|
|
963
963
|
var f;
|
|
964
964
|
if (!ge.isValidElement(o))
|
|
965
965
|
return;
|
|
966
966
|
const h = (f = o.type) == null ? void 0 : f.displayName;
|
|
967
|
-
h === "TodayMarker" ?
|
|
968
|
-
}),
|
|
969
|
-
}, [
|
|
970
|
-
|
|
971
|
-
const
|
|
972
|
-
let
|
|
973
|
-
return ge.Children.forEach(
|
|
967
|
+
h === "TodayMarker" ? r.push(Yt(o.props)) : h === "CustomMarker" && r.push(At(o.props));
|
|
968
|
+
}), r;
|
|
969
|
+
}, [Se]), Ve = oe(() => Ge.map((r) => `${r.date}|${r.color}|${r.width}|${r.label ?? ""}`).join(";"), [Ge]), Le = x(Ge);
|
|
970
|
+
Le.current = Ge;
|
|
971
|
+
const ot = oe(() => {
|
|
972
|
+
let r = 0;
|
|
973
|
+
return ge.Children.forEach(Se, (o) => {
|
|
974
974
|
var f;
|
|
975
975
|
if (!ge.isValidElement(o))
|
|
976
976
|
return;
|
|
977
|
-
((f = o.type) == null ? void 0 : f.displayName) === "TodayMarker" && (
|
|
978
|
-
}),
|
|
979
|
-
}, [
|
|
977
|
+
((f = o.type) == null ? void 0 : f.displayName) === "TodayMarker" && (r = Di(o.props));
|
|
978
|
+
}), r;
|
|
979
|
+
}, [Se]), _ = x({
|
|
980
980
|
groups: n,
|
|
981
|
-
items:
|
|
982
|
-
intervalTree:
|
|
983
|
-
layoutEngine:
|
|
984
|
-
itemRenderer:
|
|
985
|
-
groupRenderer:
|
|
986
|
-
theme:
|
|
987
|
-
selected:
|
|
981
|
+
items: s,
|
|
982
|
+
intervalTree: nt,
|
|
983
|
+
layoutEngine: rt,
|
|
984
|
+
itemRenderer: A,
|
|
985
|
+
groupRenderer: Z,
|
|
986
|
+
theme: Te,
|
|
987
|
+
selected: et,
|
|
988
988
|
dependencies: P,
|
|
989
989
|
highlights: L,
|
|
990
990
|
dayStyle: S,
|
|
991
|
-
rowStyle:
|
|
991
|
+
rowStyle: F,
|
|
992
992
|
showCursorLine: B,
|
|
993
|
-
canvasWidth:
|
|
993
|
+
canvasWidth: Me,
|
|
994
994
|
canvasHeight: ke,
|
|
995
995
|
lineHeight: c,
|
|
996
996
|
itemHeightRatio: v,
|
|
997
|
-
onTimeChange:
|
|
998
|
-
onZoom:
|
|
999
|
-
onItemHover:
|
|
1000
|
-
onItemClick:
|
|
1001
|
-
onItemDoubleClick:
|
|
997
|
+
onTimeChange: Ce,
|
|
998
|
+
onZoom: gt,
|
|
999
|
+
onItemHover: ye,
|
|
1000
|
+
onItemClick: q,
|
|
1001
|
+
onItemDoubleClick: J,
|
|
1002
1002
|
onItemContextMenu: te,
|
|
1003
1003
|
onItemMove: ue,
|
|
1004
|
-
onItemResize:
|
|
1005
|
-
onCanvasDoubleClick:
|
|
1006
|
-
onCanvasContextMenu:
|
|
1004
|
+
onItemResize: be,
|
|
1005
|
+
onCanvasDoubleClick: Pe,
|
|
1006
|
+
onCanvasContextMenu: xe,
|
|
1007
1007
|
canMove: g,
|
|
1008
1008
|
canResize: T,
|
|
1009
1009
|
canChangeGroup: b,
|
|
1010
1010
|
dragSnap: C,
|
|
1011
1011
|
sidebarWidth: u,
|
|
1012
|
-
moveResizeValidator:
|
|
1013
|
-
summaryRenderer:
|
|
1014
|
-
hierarchyEngine:
|
|
1012
|
+
moveResizeValidator: Re,
|
|
1013
|
+
summaryRenderer: Ht,
|
|
1014
|
+
hierarchyEngine: Ie
|
|
1015
1015
|
});
|
|
1016
|
-
|
|
1016
|
+
_.current = {
|
|
1017
1017
|
groups: n,
|
|
1018
|
-
items:
|
|
1019
|
-
intervalTree:
|
|
1020
|
-
layoutEngine:
|
|
1021
|
-
itemRenderer:
|
|
1022
|
-
groupRenderer:
|
|
1023
|
-
theme:
|
|
1024
|
-
selected:
|
|
1018
|
+
items: s,
|
|
1019
|
+
intervalTree: nt,
|
|
1020
|
+
layoutEngine: rt,
|
|
1021
|
+
itemRenderer: A,
|
|
1022
|
+
groupRenderer: Z,
|
|
1023
|
+
theme: Te,
|
|
1024
|
+
selected: et,
|
|
1025
1025
|
dependencies: P,
|
|
1026
1026
|
highlights: L,
|
|
1027
1027
|
dayStyle: S,
|
|
1028
|
-
rowStyle:
|
|
1028
|
+
rowStyle: F,
|
|
1029
1029
|
showCursorLine: B,
|
|
1030
|
-
canvasWidth:
|
|
1030
|
+
canvasWidth: Me,
|
|
1031
1031
|
canvasHeight: ke,
|
|
1032
1032
|
lineHeight: c,
|
|
1033
1033
|
itemHeightRatio: v,
|
|
1034
|
-
onTimeChange:
|
|
1035
|
-
onZoom:
|
|
1036
|
-
onItemHover:
|
|
1037
|
-
onItemClick:
|
|
1038
|
-
onItemDoubleClick:
|
|
1034
|
+
onTimeChange: Ce,
|
|
1035
|
+
onZoom: gt,
|
|
1036
|
+
onItemHover: ye,
|
|
1037
|
+
onItemClick: q,
|
|
1038
|
+
onItemDoubleClick: J,
|
|
1039
1039
|
onItemContextMenu: te,
|
|
1040
1040
|
onItemMove: ue,
|
|
1041
|
-
onItemResize:
|
|
1042
|
-
onCanvasDoubleClick:
|
|
1043
|
-
onCanvasContextMenu:
|
|
1041
|
+
onItemResize: be,
|
|
1042
|
+
onCanvasDoubleClick: Pe,
|
|
1043
|
+
onCanvasContextMenu: xe,
|
|
1044
1044
|
canMove: g,
|
|
1045
1045
|
canResize: T,
|
|
1046
1046
|
canChangeGroup: b,
|
|
1047
1047
|
dragSnap: C,
|
|
1048
1048
|
sidebarWidth: u,
|
|
1049
|
-
moveResizeValidator:
|
|
1050
|
-
summaryRenderer:
|
|
1051
|
-
hierarchyEngine:
|
|
1049
|
+
moveResizeValidator: Re,
|
|
1050
|
+
summaryRenderer: Ht,
|
|
1051
|
+
hierarchyEngine: Ie
|
|
1052
1052
|
};
|
|
1053
|
-
const
|
|
1054
|
-
const
|
|
1055
|
-
if (!
|
|
1053
|
+
const ti = ie(() => {
|
|
1054
|
+
const r = yt.current;
|
|
1055
|
+
if (!r)
|
|
1056
1056
|
return;
|
|
1057
|
-
const o =
|
|
1058
|
-
|
|
1059
|
-
}, [
|
|
1060
|
-
const
|
|
1061
|
-
if (!
|
|
1057
|
+
const o = _.current, h = ht(r, o.canvasWidth, o.canvasHeight);
|
|
1058
|
+
ft(h, r), Xe.draw(h, D.current, o.groups, o.theme, o.dayStyle, o.rowStyle, o.highlights);
|
|
1059
|
+
}, [Xe]), ii = ie(() => {
|
|
1060
|
+
const r = Tt.current;
|
|
1061
|
+
if (!r)
|
|
1062
1062
|
return;
|
|
1063
|
-
const o =
|
|
1064
|
-
|
|
1065
|
-
}, [
|
|
1066
|
-
const f = D.current,
|
|
1067
|
-
h === "move" ? (
|
|
1068
|
-
const
|
|
1069
|
-
for (const re of
|
|
1070
|
-
const
|
|
1071
|
-
if (
|
|
1072
|
-
return
|
|
1063
|
+
const o = _.current, h = ht(r, o.canvasWidth, o.canvasHeight);
|
|
1064
|
+
ft(h, r), _e.draw(h, D.current, o.groups, o.items, o.intervalTree, o.layoutEngine, o.itemRenderer, o.groupRenderer, o.theme, o.selected, We.current, o.dependencies, o.summaryRenderer, o.hierarchyEngine);
|
|
1065
|
+
}, [_e]), It = ie((r, o, h) => {
|
|
1066
|
+
const f = D.current, l = _.current, m = l.canvasWidth / (f.visibleTimeEnd - f.visibleTimeStart), y = o / m, M = [];
|
|
1067
|
+
h === "move" ? (M.push(f.timeToX(r.start_time + y)), M.push(f.timeToX(r.end_time + y))) : h === "resize-left" ? M.push(f.timeToX(r.start_time + y)) : M.push(f.timeToX(r.end_time + y));
|
|
1068
|
+
const I = (f.visibleTimeEnd - f.visibleTimeStart) * 0.1, X = l.intervalTree.query(f.visibleTimeStart - I, f.visibleTimeEnd + I), z = mt(X, r.id, (re) => f.timeToX(re));
|
|
1069
|
+
for (const re of M) {
|
|
1070
|
+
const V = Je(re, z, 8, m, l.dragSnap);
|
|
1071
|
+
if (V !== null)
|
|
1072
|
+
return V;
|
|
1073
1073
|
}
|
|
1074
|
-
const
|
|
1075
|
-
return f.timeToX(
|
|
1076
|
-
}, []),
|
|
1077
|
-
const
|
|
1078
|
-
if (!
|
|
1074
|
+
const G = h === "resize-right" ? r.end_time + y : r.start_time + y, H = Math.round(G / l.dragSnap) * l.dragSnap;
|
|
1075
|
+
return f.timeToX(H);
|
|
1076
|
+
}, []), ni = ie(() => {
|
|
1077
|
+
const r = St.current;
|
|
1078
|
+
if (!r)
|
|
1079
1079
|
return;
|
|
1080
|
-
const o =
|
|
1081
|
-
|
|
1082
|
-
const f = D.current,
|
|
1080
|
+
const o = _.current, h = ht(r, o.canvasWidth, o.canvasHeight);
|
|
1081
|
+
ft(h, r);
|
|
1082
|
+
const f = D.current, l = Q.getState();
|
|
1083
1083
|
let m = null;
|
|
1084
|
-
if (
|
|
1085
|
-
const y = f.timeToX(
|
|
1086
|
-
let
|
|
1087
|
-
|
|
1088
|
-
const
|
|
1084
|
+
if (l) {
|
|
1085
|
+
const y = f.timeToX(l.item.start_time), M = f.timeToX(l.item.end_time) - y;
|
|
1086
|
+
let I, X;
|
|
1087
|
+
l.mode === "resize-left" ? (I = y + l.deltaX, X = M - l.deltaX) : l.mode === "resize-right" ? (I = y, X = M + l.deltaX) : (I = y + l.deltaX, X = M);
|
|
1088
|
+
const z = bt(l.currentGroup, o.groups), G = f.groupIndexToY(z), H = l.currentGroup !== l.originalGroup;
|
|
1089
1089
|
m = {
|
|
1090
|
-
item:
|
|
1091
|
-
mode:
|
|
1092
|
-
bounds: { x:
|
|
1090
|
+
item: l.item,
|
|
1091
|
+
mode: l.mode,
|
|
1092
|
+
bounds: { x: I, y: G + (o.lineHeight - o.lineHeight * o.itemHeightRatio) / 2, width: X, height: o.lineHeight * o.itemHeightRatio },
|
|
1093
1093
|
renderer: o.itemRenderer,
|
|
1094
|
-
targetGroupY:
|
|
1095
|
-
groupChanged:
|
|
1094
|
+
targetGroupY: G,
|
|
1095
|
+
groupChanged: H
|
|
1096
1096
|
};
|
|
1097
1097
|
}
|
|
1098
|
-
|
|
1099
|
-
cursorX: o.showCursorLine ?
|
|
1100
|
-
snapX:
|
|
1101
|
-
markers:
|
|
1098
|
+
Fe.draw(h, f, o.theme, {
|
|
1099
|
+
cursorX: o.showCursorLine ? tt.current : null,
|
|
1100
|
+
snapX: l ? It(l.item, l.deltaX, l.mode) : null,
|
|
1101
|
+
markers: Le.current,
|
|
1102
1102
|
interaction: m
|
|
1103
1103
|
});
|
|
1104
|
-
}, [
|
|
1105
|
-
|
|
1106
|
-
|
|
1104
|
+
}, [Fe, Q, It, bt]), st = x(null);
|
|
1105
|
+
st.current || (st.current = new Ti((r) => {
|
|
1106
|
+
r.grid && ti(), r.items && ii(), r.overlay && ni();
|
|
1107
1107
|
}));
|
|
1108
|
-
const E =
|
|
1108
|
+
const E = st.current;
|
|
1109
1109
|
he(() => () => E.dispose(), [E]), he(() => {
|
|
1110
|
-
if (!
|
|
1110
|
+
if (!ot)
|
|
1111
1111
|
return;
|
|
1112
|
-
const
|
|
1112
|
+
const r = setInterval(() => {
|
|
1113
1113
|
const o = [];
|
|
1114
|
-
ge.Children.forEach(
|
|
1115
|
-
var
|
|
1114
|
+
ge.Children.forEach(Se, (h) => {
|
|
1115
|
+
var l;
|
|
1116
1116
|
if (!ge.isValidElement(h))
|
|
1117
1117
|
return;
|
|
1118
|
-
const f = (
|
|
1119
|
-
f === "TodayMarker" ? o.push(
|
|
1120
|
-
}),
|
|
1121
|
-
},
|
|
1122
|
-
return () => clearInterval(
|
|
1123
|
-
}, [
|
|
1124
|
-
D.current.update({ canvasWidth:
|
|
1125
|
-
}, [
|
|
1118
|
+
const f = (l = h.type) == null ? void 0 : l.displayName;
|
|
1119
|
+
f === "TodayMarker" ? o.push(Yt(h.props)) : f === "CustomMarker" && o.push(At(h.props));
|
|
1120
|
+
}), Le.current = o, E.markDirty("overlay");
|
|
1121
|
+
}, ot);
|
|
1122
|
+
return () => clearInterval(r);
|
|
1123
|
+
}, [ot, Se, E]), he(() => {
|
|
1124
|
+
D.current.update({ canvasWidth: Me, canvasHeight: ke, sidebarWidth: u, lineHeight: c, groupCount: n.length }), E.markAllDirty();
|
|
1125
|
+
}, [Me, ke, u, c, n.length, E]), he(() => {
|
|
1126
1126
|
E.markDirty("grid"), E.markDirty("items");
|
|
1127
|
-
}, [
|
|
1128
|
-
const
|
|
1129
|
-
var
|
|
1130
|
-
return ((
|
|
1131
|
-
}, [e.highlights]),
|
|
1127
|
+
}, [s, n, et, Te, S, F, nt, rt, E]);
|
|
1128
|
+
const Ze = oe(() => {
|
|
1129
|
+
var r;
|
|
1130
|
+
return ((r = e.highlights) == null ? void 0 : r.map((o) => `${o.start}|${o.end}|${o.color}|${o.label ?? ""}|${o.opacity ?? ""}`).join(";")) ?? "";
|
|
1131
|
+
}, [e.highlights]), Rt = x(Ze);
|
|
1132
1132
|
he(() => {
|
|
1133
|
-
|
|
1134
|
-
}, [
|
|
1135
|
-
const
|
|
1133
|
+
Ze !== Rt.current && (Rt.current = Ze, E.markDirty("grid"));
|
|
1134
|
+
}, [Ze, E]);
|
|
1135
|
+
const Pt = x(Ve);
|
|
1136
1136
|
he(() => {
|
|
1137
|
-
|
|
1138
|
-
}, [
|
|
1139
|
-
const
|
|
1140
|
-
e.visibleTimeStart !== void 0 && e.visibleTimeStart !==
|
|
1141
|
-
const
|
|
1142
|
-
|
|
1143
|
-
var f,
|
|
1144
|
-
|
|
1145
|
-
const o = D.current, h =
|
|
1146
|
-
|
|
1147
|
-
},
|
|
1137
|
+
Ve !== Pt.current && (Pt.current = Ve, E.markDirty("overlay"));
|
|
1138
|
+
}, [Ve, E]);
|
|
1139
|
+
const Dt = x(e.visibleTimeStart), Xt = x(e.visibleTimeEnd);
|
|
1140
|
+
e.visibleTimeStart !== void 0 && e.visibleTimeStart !== Dt.current && (Dt.current = e.visibleTimeStart, D.current.update({ visibleTimeStart: e.visibleTimeStart }), E.markAllDirty()), e.visibleTimeEnd !== void 0 && e.visibleTimeEnd !== Xt.current && (Xt.current = e.visibleTimeEnd, D.current.update({ visibleTimeEnd: e.visibleTimeEnd }), E.markAllDirty());
|
|
1141
|
+
const Ye = x(null), lt = ie((r) => {
|
|
1142
|
+
Ye.current === null && (Ye.current = setTimeout(() => {
|
|
1143
|
+
var f, l;
|
|
1144
|
+
Ye.current = null;
|
|
1145
|
+
const o = D.current, h = _.current;
|
|
1146
|
+
r === "zoom" ? (f = h.onZoom) == null || f.call(h, o.visibleTimeStart, o.visibleTimeEnd) : (l = h.onTimeChange) == null || l.call(h, o.visibleTimeStart, o.visibleTimeEnd);
|
|
1147
|
+
}, jt));
|
|
1148
1148
|
}, []);
|
|
1149
1149
|
he(() => () => {
|
|
1150
|
-
|
|
1150
|
+
Ye.current !== null && clearTimeout(Ye.current);
|
|
1151
1151
|
}, []);
|
|
1152
|
-
const
|
|
1152
|
+
const qe = x(null), at = oe(() => new Ei((r, o) => {
|
|
1153
1153
|
var h;
|
|
1154
|
-
D.current.update({ visibleTimeStart:
|
|
1155
|
-
}, d,
|
|
1156
|
-
|
|
1157
|
-
const
|
|
1158
|
-
const o = D.current, h = o.groupCount * o.lineHeight, f = Math.max(0, h - o.canvasHeight),
|
|
1159
|
-
|
|
1160
|
-
}, [E]),
|
|
1161
|
-
var y,
|
|
1162
|
-
const o = D.current, h = o.canvasWidth / (o.visibleTimeEnd - o.visibleTimeStart), f =
|
|
1163
|
-
o.update({ visibleTimeStart:
|
|
1164
|
-
}, [E,
|
|
1154
|
+
D.current.update({ visibleTimeStart: r, visibleTimeEnd: o }), (h = qe.current) == null || h.updateBounds(r, o), E.markAllDirty(), it(), lt("zoom");
|
|
1155
|
+
}, d, a, R, O), []);
|
|
1156
|
+
qe.current = at;
|
|
1157
|
+
const Ue = ie((r) => {
|
|
1158
|
+
const o = D.current, h = o.groupCount * o.lineHeight, f = Math.max(0, h - o.canvasHeight), l = Math.max(0, Math.min(f, o.scrollTop + r));
|
|
1159
|
+
l !== o.scrollTop && (o.update({ scrollTop: l }), E.markDirty("grid"), E.markDirty("items"), E.markDirty("overlay"), $e(l));
|
|
1160
|
+
}, [E]), Ae = ie((r) => {
|
|
1161
|
+
var y, M, I;
|
|
1162
|
+
const o = D.current, h = o.canvasWidth / (o.visibleTimeEnd - o.visibleTimeStart), f = r / h, l = o.visibleTimeStart + f, m = o.visibleTimeEnd + f;
|
|
1163
|
+
o.update({ visibleTimeStart: l, visibleTimeEnd: m }), (y = qe.current) == null || y.updateBounds(l, m), E.markAllDirty(), gi(() => De()), (I = (M = _.current).onTimeChange) == null || I.call(M, l, m);
|
|
1164
|
+
}, [E, De]);
|
|
1165
1165
|
he(() => {
|
|
1166
|
-
const
|
|
1167
|
-
if (!
|
|
1166
|
+
const r = Oe.current;
|
|
1167
|
+
if (!r)
|
|
1168
1168
|
return;
|
|
1169
1169
|
const o = (h) => {
|
|
1170
1170
|
if (h.ctrlKey || h.metaKey || h.altKey) {
|
|
1171
1171
|
h.preventDefault();
|
|
1172
|
-
const f =
|
|
1173
|
-
|
|
1172
|
+
const f = r.getBoundingClientRect(), l = (h.clientX - f.left) / f.width;
|
|
1173
|
+
at.handleWheelZoom(h, l);
|
|
1174
1174
|
} else if (h.shiftKey)
|
|
1175
|
-
h.preventDefault(),
|
|
1175
|
+
h.preventDefault(), Ae(h.deltaY);
|
|
1176
1176
|
else {
|
|
1177
1177
|
const f = h.deltaX;
|
|
1178
|
-
f !== 0 && Math.abs(f) > Math.abs(h.deltaY) ? (h.preventDefault(),
|
|
1178
|
+
f !== 0 && Math.abs(f) > Math.abs(h.deltaY) ? (h.preventDefault(), Ae(f)) : h.deltaY !== 0 && Ue(h.deltaY);
|
|
1179
1179
|
}
|
|
1180
1180
|
};
|
|
1181
|
-
return
|
|
1182
|
-
}, [
|
|
1183
|
-
const
|
|
1181
|
+
return r.addEventListener("wheel", o, { passive: !1 }), () => r.removeEventListener("wheel", o);
|
|
1182
|
+
}, [at, Ue, Ae]);
|
|
1183
|
+
const we = x({ lastDistance: null, lastCenter: null });
|
|
1184
1184
|
he(() => {
|
|
1185
|
-
const
|
|
1186
|
-
if (!
|
|
1185
|
+
const r = Oe.current;
|
|
1186
|
+
if (!r)
|
|
1187
1187
|
return;
|
|
1188
|
-
const o = (y,
|
|
1189
|
-
y.touches.length === 2 && (y.preventDefault(),
|
|
1190
|
-
},
|
|
1191
|
-
var
|
|
1192
|
-
if (y.touches.length === 2 &&
|
|
1188
|
+
const o = (y, M) => Math.abs(y.clientX - M.clientX), h = (y, M, I) => (y.clientX + M.clientX) / 2 - I.left, f = (y) => {
|
|
1189
|
+
y.touches.length === 2 && (y.preventDefault(), we.current.lastDistance = o(y.touches[0], y.touches[1]), we.current.lastCenter = null);
|
|
1190
|
+
}, l = (y) => {
|
|
1191
|
+
var M;
|
|
1192
|
+
if (y.touches.length === 2 && we.current.lastDistance !== null) {
|
|
1193
1193
|
y.preventDefault();
|
|
1194
|
-
const
|
|
1195
|
-
if (
|
|
1196
|
-
const
|
|
1197
|
-
let w =
|
|
1198
|
-
w = Math.max(
|
|
1199
|
-
const p = re.visibleTimeStart +
|
|
1200
|
-
re.update({ visibleTimeStart: j, visibleTimeEnd:
|
|
1194
|
+
const I = o(y.touches[0], y.touches[1]), X = r.getBoundingClientRect(), G = h(y.touches[0], y.touches[1], X) / X.width;
|
|
1195
|
+
if (I !== 0 && we.current.lastDistance !== 0) {
|
|
1196
|
+
const H = we.current.lastDistance / I, re = D.current, V = re.visibleTimeEnd - re.visibleTimeStart;
|
|
1197
|
+
let w = V * H;
|
|
1198
|
+
w = Math.max(R, Math.min(O, w));
|
|
1199
|
+
const p = re.visibleTimeStart + V * G, j = p - w * G, Y = p + w * (1 - G);
|
|
1200
|
+
re.update({ visibleTimeStart: j, visibleTimeEnd: Y }), (M = qe.current) == null || M.updateBounds(j, Y), E.markAllDirty(), it(), lt("zoom");
|
|
1201
1201
|
}
|
|
1202
|
-
|
|
1202
|
+
we.current.lastDistance = I;
|
|
1203
1203
|
}
|
|
1204
1204
|
}, m = () => {
|
|
1205
|
-
|
|
1205
|
+
we.current.lastDistance = null, we.current.lastCenter = null;
|
|
1206
1206
|
};
|
|
1207
|
-
return
|
|
1208
|
-
|
|
1207
|
+
return r.addEventListener("touchstart", f, { passive: !1 }), r.addEventListener("touchmove", l, { passive: !1 }), r.addEventListener("touchend", m), () => {
|
|
1208
|
+
r.removeEventListener("touchstart", f), r.removeEventListener("touchmove", l), r.removeEventListener("touchend", m);
|
|
1209
1209
|
};
|
|
1210
|
-
}, [E,
|
|
1211
|
-
const
|
|
1212
|
-
var
|
|
1213
|
-
const o =
|
|
1214
|
-
if (
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1210
|
+
}, [E, it, lt]);
|
|
1211
|
+
const ri = ie((r) => {
|
|
1212
|
+
var I;
|
|
1213
|
+
const o = r.currentTarget, h = o.getBoundingClientRect(), f = r.clientX - h.left, l = r.clientY - h.top;
|
|
1214
|
+
if (tt.current = f, ve.current) {
|
|
1215
|
+
const X = r.clientX - ve.current.startX, z = r.clientY - ve.current.startY;
|
|
1216
|
+
if (!He.current && (Math.abs(X) >= kt || Math.abs(z) >= kt) && (He.current = !0, o.style.cursor = "grabbing", o.setPointerCapture(r.pointerId)), He.current) {
|
|
1217
|
+
const G = r.clientX - ve.current.lastX, H = r.clientY - ve.current.lastY;
|
|
1218
|
+
ve.current.lastX = r.clientX, ve.current.lastY = r.clientY, Math.abs(G) > 0 && Ae(-G), Math.abs(H) > 0 && Ue(-H);
|
|
1219
|
+
}
|
|
1220
|
+
return;
|
|
1221
|
+
}
|
|
1222
|
+
if (Q.isPending()) {
|
|
1223
|
+
if (Q.update(f, l), Q.isActive()) {
|
|
1224
|
+
const X = Q.getState();
|
|
1225
|
+
if (X && X.mode === "move" && _.current.canChangeGroup) {
|
|
1226
|
+
const z = dt(l, D.current, _.current.groups);
|
|
1227
|
+
z && Q.setCurrentGroup(z.id);
|
|
1220
1228
|
}
|
|
1221
1229
|
E.markDirty("overlay");
|
|
1222
1230
|
}
|
|
1223
1231
|
return;
|
|
1224
1232
|
}
|
|
1225
|
-
|
|
1226
|
-
const m =
|
|
1227
|
-
if (
|
|
1228
|
-
const
|
|
1229
|
-
|
|
1233
|
+
_.current.showCursorLine && E.markDirty("overlay");
|
|
1234
|
+
const m = _.current, y = je(f, l, D.current, m.intervalTree, m.layoutEngine, m.groups), M = y == null ? void 0 : y.id;
|
|
1235
|
+
if (M !== We.current && (We.current = M, E.markDirty("items"), (I = m.onItemHover) == null || I.call(m, M ?? null, r.nativeEvent)), y) {
|
|
1236
|
+
const X = Ft(f, y, D.current), z = m.canResize;
|
|
1237
|
+
X === "left" && (z === "left" || z === "both") || X === "right" && (z === "right" || z === "both") ? o.style.cursor = "col-resize" : m.canMove ? o.style.cursor = "grab" : o.style.cursor = "default";
|
|
1230
1238
|
} else
|
|
1231
1239
|
o.style.cursor = "default";
|
|
1232
|
-
}, [Q, E]),
|
|
1233
|
-
const o =
|
|
1234
|
-
if (!m)
|
|
1240
|
+
}, [Q, E, Ae, Ue]), oi = ie((r) => {
|
|
1241
|
+
const o = _.current, h = r.currentTarget.getBoundingClientRect(), f = r.clientX - h.left, l = r.clientY - h.top, m = je(f, l, D.current, o.intervalTree, o.layoutEngine, o.groups);
|
|
1242
|
+
if (!m) {
|
|
1243
|
+
ve.current = { startX: r.clientX, startY: r.clientY, lastX: r.clientX, lastY: r.clientY }, He.current = !1;
|
|
1235
1244
|
return;
|
|
1236
|
-
|
|
1237
|
-
y
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1245
|
+
}
|
|
1246
|
+
const y = Ft(f, m, D.current), M = o.canResize;
|
|
1247
|
+
y === "left" && (M === "left" || M === "both") ? Q.startInteraction(m, "resize-left", f, l) : y === "right" && (M === "right" || M === "both") ? Q.startInteraction(m, "resize-right", f, l) : o.canMove && Q.startInteraction(m, "move", f, l);
|
|
1248
|
+
}, [Q]), si = ie((r) => {
|
|
1249
|
+
var y, M, I, X, z, G;
|
|
1250
|
+
const o = r.currentTarget;
|
|
1251
|
+
if (ve.current) {
|
|
1252
|
+
const H = He.current;
|
|
1253
|
+
if (ve.current = null, He.current = !1, o.style.cursor = "default", H)
|
|
1254
|
+
return;
|
|
1255
|
+
}
|
|
1241
1256
|
if (Q.isActive()) {
|
|
1242
|
-
const
|
|
1243
|
-
if (
|
|
1244
|
-
const w =
|
|
1245
|
-
if (
|
|
1246
|
-
const p = Q.endMove(
|
|
1257
|
+
const H = Q.getState(), re = D.current, V = re.canvasWidth / (re.visibleTimeEnd - re.visibleTimeStart);
|
|
1258
|
+
if (H) {
|
|
1259
|
+
const w = _.current.moveResizeValidator;
|
|
1260
|
+
if (H.mode === "move") {
|
|
1261
|
+
const p = Q.endMove(V);
|
|
1247
1262
|
if (p) {
|
|
1248
|
-
const j = D.current,
|
|
1263
|
+
const j = D.current, Y = _.current, ae = H.deltaX / V, fe = j.timeToX(H.item.start_time + ae), W = j.timeToX(H.item.end_time + ae), U = (j.visibleTimeEnd - j.visibleTimeStart) * 0.1, ee = Y.intervalTree.query(j.visibleTimeStart - U, j.visibleTimeEnd + U), N = mt(ee, H.item.id, (me) => j.timeToX(me));
|
|
1249
1264
|
let le = p.newStartTime;
|
|
1250
|
-
const
|
|
1251
|
-
if (
|
|
1252
|
-
le = j.xToTime(
|
|
1265
|
+
const K = Je(fe, N, 8, V, Y.dragSnap);
|
|
1266
|
+
if (K !== null)
|
|
1267
|
+
le = j.xToTime(K);
|
|
1253
1268
|
else {
|
|
1254
|
-
const me =
|
|
1269
|
+
const me = Je(W, N, 8, V, Y.dragSnap);
|
|
1255
1270
|
if (me !== null) {
|
|
1256
|
-
const
|
|
1257
|
-
le = j.xToTime(me) -
|
|
1271
|
+
const hi = H.item.end_time - H.item.start_time;
|
|
1272
|
+
le = j.xToTime(me) - hi;
|
|
1258
1273
|
}
|
|
1259
1274
|
}
|
|
1260
|
-
const ce = w ? w("move",
|
|
1261
|
-
(
|
|
1275
|
+
const ce = w ? w("move", H.item.id, le) : le, de = _.current.hierarchyEngine.getMoveDelta(H.item.id, ce);
|
|
1276
|
+
(M = (y = _.current).onItemMove) == null || M.call(y, H.item.id, ce, p.newGroupId, de.length > 0 ? de : void 0);
|
|
1262
1277
|
}
|
|
1263
1278
|
} else {
|
|
1264
|
-
const p = Q.endResize(
|
|
1279
|
+
const p = Q.endResize(V);
|
|
1265
1280
|
if (p) {
|
|
1266
|
-
const j = D.current,
|
|
1267
|
-
let
|
|
1268
|
-
const ce =
|
|
1269
|
-
p.edge === "left" &&
|
|
1270
|
-
const de = w ? w("resize",
|
|
1271
|
-
(
|
|
1281
|
+
const j = D.current, Y = _.current, ae = H.deltaX / V, fe = p.edge === "left" ? H.item.start_time + ae : H.item.end_time + ae, W = j.timeToX(fe), U = (j.visibleTimeEnd - j.visibleTimeStart) * 0.1, ee = Y.intervalTree.query(j.visibleTimeStart - U, j.visibleTimeEnd + U), N = mt(ee, H.item.id, (me) => j.timeToX(me)), le = Je(W, N, 8, V, Y.dragSnap);
|
|
1282
|
+
let K = le !== null ? j.xToTime(le) : p.newTime;
|
|
1283
|
+
const ce = _.current.hierarchyEngine.getResizeConstraint(H.item.id, p.edge);
|
|
1284
|
+
p.edge === "left" && K > ce.max ? K = ce.max : p.edge === "right" && K < ce.min && (K = ce.min);
|
|
1285
|
+
const de = w ? w("resize", H.item.id, K, p.edge) : K;
|
|
1286
|
+
(X = (I = _.current).onItemResize) == null || X.call(I, H.item.id, de, p.edge);
|
|
1272
1287
|
}
|
|
1273
1288
|
}
|
|
1274
1289
|
}
|
|
@@ -1276,180 +1291,194 @@ const Lt = 32, $i = ge.memo(ci(function(e, t) {
|
|
|
1276
1291
|
return;
|
|
1277
1292
|
}
|
|
1278
1293
|
Q.isPending() && Q.cancel();
|
|
1279
|
-
const h = o.getBoundingClientRect(), f =
|
|
1280
|
-
m && ((
|
|
1281
|
-
}, [Q, E]),
|
|
1282
|
-
var y,
|
|
1283
|
-
const o =
|
|
1294
|
+
const h = o.getBoundingClientRect(), f = r.clientX - h.left, l = r.clientY - h.top, m = je(f, l, D.current, _.current.intervalTree, _.current.layoutEngine, _.current.groups);
|
|
1295
|
+
m && ((G = (z = _.current).onItemClick) == null || G.call(z, m.id, r.nativeEvent));
|
|
1296
|
+
}, [Q, E]), li = ie((r) => {
|
|
1297
|
+
var y, M;
|
|
1298
|
+
const o = r.currentTarget.getBoundingClientRect(), h = r.clientX - o.left, f = r.clientY - o.top, l = _.current, m = je(h, f, D.current, l.intervalTree, l.layoutEngine, l.groups);
|
|
1284
1299
|
if (m)
|
|
1285
|
-
(y =
|
|
1300
|
+
(y = l.onItemDoubleClick) == null || y.call(l, m.id, r.nativeEvent);
|
|
1286
1301
|
else {
|
|
1287
|
-
const
|
|
1288
|
-
|
|
1302
|
+
const I = dt(f, D.current, l.groups), X = D.current.xToTime(h);
|
|
1303
|
+
I && ((M = l.onCanvasDoubleClick) == null || M.call(l, I.id, X));
|
|
1289
1304
|
}
|
|
1290
|
-
}, []),
|
|
1291
|
-
var y,
|
|
1292
|
-
|
|
1293
|
-
const o =
|
|
1305
|
+
}, []), ai = ie((r) => {
|
|
1306
|
+
var y, M;
|
|
1307
|
+
r.preventDefault();
|
|
1308
|
+
const o = r.currentTarget.getBoundingClientRect(), h = r.clientX - o.left, f = r.clientY - o.top, l = _.current, m = je(h, f, D.current, l.intervalTree, l.layoutEngine, l.groups);
|
|
1294
1309
|
if (m)
|
|
1295
|
-
(y =
|
|
1310
|
+
(y = l.onItemContextMenu) == null || y.call(l, m.id, r.nativeEvent);
|
|
1296
1311
|
else {
|
|
1297
|
-
const
|
|
1298
|
-
|
|
1312
|
+
const I = dt(f, D.current, l.groups), X = D.current.xToTime(h);
|
|
1313
|
+
I && ((M = l.onCanvasContextMenu) == null || M.call(l, I.id, X, r.nativeEvent));
|
|
1299
1314
|
}
|
|
1300
|
-
}, []),
|
|
1301
|
-
var
|
|
1302
|
-
|
|
1303
|
-
}, [E]),
|
|
1304
|
-
const
|
|
1305
|
-
return ge.Children.forEach(
|
|
1315
|
+
}, []), ci = ie(() => {
|
|
1316
|
+
var r, o;
|
|
1317
|
+
ve.current = null, He.current = !1, tt.current = null, Oe.current && (Oe.current.style.cursor = "default"), We.current !== void 0 && (We.current = void 0, E.markDirty("items"), (o = (r = _.current).onItemHover) == null || o.call(r, null, new PointerEvent("pointerleave"))), _.current.showCursorLine && E.markDirty("overlay");
|
|
1318
|
+
}, [E]), ui = oe(() => {
|
|
1319
|
+
const r = [];
|
|
1320
|
+
return ge.Children.forEach(Se, (o) => {
|
|
1306
1321
|
var f;
|
|
1307
1322
|
if (!ge.isValidElement(o))
|
|
1308
1323
|
return;
|
|
1309
1324
|
if (((f = o.type) == null ? void 0 : f.displayName) === "TimelineHeaders") {
|
|
1310
|
-
const
|
|
1311
|
-
|
|
1312
|
-
visibleTimeStart:
|
|
1313
|
-
visibleTimeEnd:
|
|
1314
|
-
canvasWidth:
|
|
1315
|
-
sidebarWidth:
|
|
1316
|
-
theme:
|
|
1317
|
-
onZoomToInterval:
|
|
1318
|
-
var
|
|
1319
|
-
D.current.update({ visibleTimeStart: m, visibleTimeEnd: y }), E.markAllDirty(),
|
|
1325
|
+
const l = o.props;
|
|
1326
|
+
r.push(ge.cloneElement(o, {
|
|
1327
|
+
visibleTimeStart: l.visibleTimeStart ?? wt,
|
|
1328
|
+
visibleTimeEnd: l.visibleTimeEnd ?? Et,
|
|
1329
|
+
canvasWidth: l.canvasWidth ?? Me,
|
|
1330
|
+
sidebarWidth: l.sidebarWidth ?? u,
|
|
1331
|
+
theme: l.theme ?? Te,
|
|
1332
|
+
onZoomToInterval: l.onZoomToInterval ?? ((m, y) => {
|
|
1333
|
+
var M, I, X, z;
|
|
1334
|
+
D.current.update({ visibleTimeStart: m, visibleTimeEnd: y }), E.markAllDirty(), De(), (I = (M = _.current).onTimeChange) == null || I.call(M, m, y), (z = (X = _.current).onZoom) == null || z.call(X, m, y);
|
|
1320
1335
|
})
|
|
1321
1336
|
}));
|
|
1322
1337
|
}
|
|
1323
|
-
}),
|
|
1324
|
-
}, [
|
|
1338
|
+
}), r;
|
|
1339
|
+
}, [Se, wt, Et, Me, u, Te, E, De]), _t = x(!1);
|
|
1325
1340
|
he(() => {
|
|
1326
|
-
|
|
1327
|
-
}, [E]),
|
|
1328
|
-
captureToCanvas({ timeStart:
|
|
1329
|
-
const
|
|
1330
|
-
|
|
1331
|
-
const w =
|
|
1341
|
+
_t.current || (_t.current = !0, E.markAllDirty());
|
|
1342
|
+
}, [E]), mi(t, () => ({
|
|
1343
|
+
captureToCanvas({ timeStart: r, timeEnd: o, scale: h, sidebarWidth: f }) {
|
|
1344
|
+
const l = _.current, m = 28, y = m * 3, M = l.groups.length * l.lineHeight, I = D.current, X = l.canvasWidth / (I.visibleTimeEnd - I.visibleTimeStart), z = o - r, G = Math.max(l.canvasWidth, Math.round(z * X)), H = (f + G) * h, re = (y + M) * h, V = document.createElement("canvas");
|
|
1345
|
+
V.width = H, V.height = re;
|
|
1346
|
+
const w = V.getContext("2d");
|
|
1332
1347
|
w.scale(h, h);
|
|
1333
|
-
for (let
|
|
1334
|
-
const ae =
|
|
1335
|
-
if (
|
|
1336
|
-
const N =
|
|
1337
|
-
N != null && N.backgroundColor && (w.fillStyle = N.backgroundColor, w.fillRect(0, fe, f,
|
|
1348
|
+
for (let Y = 0; Y < l.groups.length; Y++) {
|
|
1349
|
+
const ae = l.groups[Y], fe = y + Y * l.lineHeight;
|
|
1350
|
+
if (l.rowStyle) {
|
|
1351
|
+
const N = l.rowStyle(ae);
|
|
1352
|
+
N != null && N.backgroundColor && (w.fillStyle = N.backgroundColor, w.fillRect(0, fe, f, l.lineHeight));
|
|
1338
1353
|
}
|
|
1339
|
-
const
|
|
1340
|
-
let
|
|
1341
|
-
|
|
1354
|
+
const W = ae.type;
|
|
1355
|
+
let U = "400", ee = 8;
|
|
1356
|
+
W === "project" ? U = "700" : W === "CAG" ? U = "600" : W === "CA" && (U = "400", ee = 24), w.fillStyle = "#111", w.font = `${U} 12px sans-serif`, w.textBaseline = "middle", w.fillText(ae.title, ee, fe + l.lineHeight / 2, f - ee - 4);
|
|
1342
1357
|
}
|
|
1343
|
-
const p = (
|
|
1358
|
+
const p = (Y, ae, fe) => {
|
|
1344
1359
|
var ee, N;
|
|
1345
|
-
w.fillStyle = ((ee =
|
|
1346
|
-
let
|
|
1347
|
-
|
|
1348
|
-
const
|
|
1349
|
-
for (;
|
|
1350
|
-
const le =
|
|
1351
|
-
w.beginPath(), w.moveTo(
|
|
1360
|
+
w.fillStyle = ((ee = l.theme.header) == null ? void 0 : ee.bg) ?? "#f5f5f5", w.fillRect(f, Y, G, m), w.strokeStyle = ((N = l.theme.grid) == null ? void 0 : N.line) ?? "#e0e0e0", w.lineWidth = 1, w.strokeRect(f, Y, G, m);
|
|
1361
|
+
let W = pe(r).startOf(fe);
|
|
1362
|
+
W.valueOf() < r && (W = W.add(1, fe));
|
|
1363
|
+
const U = G / (o - r);
|
|
1364
|
+
for (; W.valueOf() < o; ) {
|
|
1365
|
+
const le = W.add(1, fe), K = f + (W.valueOf() - r) * U, de = f + (Math.min(le.valueOf(), o) - r) * U - K;
|
|
1366
|
+
w.beginPath(), w.moveTo(K, Y), w.lineTo(K, Y + m), w.stroke(), w.fillStyle = "#333", w.font = "600 11px sans-serif", w.textBaseline = "middle", w.textAlign = "center", w.fillText(ae(W), K + de / 2, Y + m / 2, de - 4), W = le;
|
|
1352
1367
|
}
|
|
1353
1368
|
w.textAlign = "start";
|
|
1354
1369
|
};
|
|
1355
|
-
p(0, (
|
|
1356
|
-
const j = new
|
|
1357
|
-
visibleTimeStart:
|
|
1370
|
+
p(0, (Y) => Y.format("YYYY"), "year"), p(m, (Y) => Y.format("MM"), "month"), p(m * 2, (Y) => String(Y.isoWeek()), "week");
|
|
1371
|
+
const j = new ut({
|
|
1372
|
+
visibleTimeStart: r,
|
|
1358
1373
|
visibleTimeEnd: o,
|
|
1359
|
-
canvasWidth:
|
|
1360
|
-
canvasHeight:
|
|
1374
|
+
canvasWidth: G,
|
|
1375
|
+
canvasHeight: M,
|
|
1361
1376
|
sidebarWidth: 0,
|
|
1362
|
-
lineHeight:
|
|
1363
|
-
groupCount:
|
|
1377
|
+
lineHeight: l.lineHeight,
|
|
1378
|
+
groupCount: l.groups.length,
|
|
1364
1379
|
buffer: 1,
|
|
1365
1380
|
scrollTop: 0
|
|
1366
1381
|
});
|
|
1367
|
-
return w.save(), w.translate(f, y), w.beginPath(), w.rect(0, 0,
|
|
1382
|
+
return w.save(), w.translate(f, y), w.beginPath(), w.rect(0, 0, G, M), w.clip(), Xe.draw(w, j, l.groups, l.theme, l.dayStyle, l.rowStyle, l.highlights), _e.draw(w, j, l.groups, l.items, l.intervalTree, l.layoutEngine, l.itemRenderer, l.groupRenderer, l.theme, l.selected, void 0, l.dependencies, l.summaryRenderer, l.hierarchyEngine), Fe.draw(w, j, l.theme, {
|
|
1368
1383
|
cursorX: null,
|
|
1369
1384
|
snapX: null,
|
|
1370
|
-
markers:
|
|
1385
|
+
markers: Le.current,
|
|
1371
1386
|
interaction: null
|
|
1372
|
-
}), w.restore(),
|
|
1387
|
+
}), w.restore(), V;
|
|
1373
1388
|
}
|
|
1374
|
-
}), [
|
|
1375
|
-
const
|
|
1376
|
-
captureToCanvas({ timeStart: o, timeEnd: h, scale: f, sidebarWidth:
|
|
1389
|
+
}), [Xe, _e, Fe]), he(() => {
|
|
1390
|
+
const r = {
|
|
1391
|
+
captureToCanvas({ timeStart: o, timeEnd: h, scale: f, sidebarWidth: l }) {
|
|
1377
1392
|
var fe;
|
|
1378
|
-
const m =
|
|
1379
|
-
w.width = re * f, w.height =
|
|
1393
|
+
const m = _.current, y = 28, M = y * 3, I = m.groups.length * m.lineHeight, X = D.current, z = m.canvasWidth / (X.visibleTimeEnd - X.visibleTimeStart), G = h - o, H = Math.max(m.canvasWidth, Math.round(G * z)), re = l + H, V = M + I, w = document.createElement("canvas");
|
|
1394
|
+
w.width = re * f, w.height = V * f;
|
|
1380
1395
|
const p = w.getContext("2d");
|
|
1381
|
-
p.scale(f, f), p.fillStyle = "#FFFFFF", p.fillRect(0, 0, re,
|
|
1382
|
-
for (let
|
|
1383
|
-
const
|
|
1384
|
-
p.fillStyle = (N == null ? void 0 : N.backgroundColor) ?? (
|
|
1385
|
-
const le =
|
|
1386
|
-
let
|
|
1387
|
-
le === "project" ? (ce = "700", de = 12) : le === "control_area_group" ? ce = "600" : le === "control_area" && (
|
|
1388
|
-
const me = typeof
|
|
1389
|
-
p.fillText(me,
|
|
1396
|
+
p.scale(f, f), p.fillStyle = "#FFFFFF", p.fillRect(0, 0, re, V), p.save(), p.beginPath(), p.rect(0, 0, l, V), p.clip(), p.fillStyle = "#F9FAFB", p.fillRect(0, 0, l, M), p.strokeStyle = "#E5E7EB", p.lineWidth = 1, p.strokeRect(0, 0, l, M);
|
|
1397
|
+
for (let W = 0; W < m.groups.length; W++) {
|
|
1398
|
+
const U = m.groups[W], ee = M + W * m.lineHeight, N = (fe = m.rowStyle) == null ? void 0 : fe.call(m, U);
|
|
1399
|
+
p.fillStyle = (N == null ? void 0 : N.backgroundColor) ?? (W % 2 === 0 ? "#FFFFFF" : "#F7F7F7"), p.fillRect(0, ee, l, m.lineHeight), p.strokeStyle = "#E5E5E5", p.lineWidth = 0.5, p.beginPath(), p.moveTo(0, ee + m.lineHeight), p.lineTo(l, ee + m.lineHeight), p.stroke();
|
|
1400
|
+
const le = U.type ?? "";
|
|
1401
|
+
let K = 8, ce = "400", de = 11;
|
|
1402
|
+
le === "project" ? (ce = "700", de = 12) : le === "control_area_group" ? ce = "600" : le === "control_area" && (K = 24), p.fillStyle = "#374151", p.font = `${ce} ${de}px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, p.textBaseline = "middle";
|
|
1403
|
+
const me = typeof U.title == "string" ? U.title : String(U.title);
|
|
1404
|
+
p.fillText(me, K, ee + m.lineHeight / 2, l - K - 8);
|
|
1390
1405
|
}
|
|
1391
|
-
p.strokeStyle = "#E5E7EB", p.lineWidth = 1, p.beginPath(), p.moveTo(
|
|
1392
|
-
const j = h - o,
|
|
1406
|
+
p.strokeStyle = "#E5E7EB", p.lineWidth = 1, p.beginPath(), p.moveTo(l, 0), p.lineTo(l, V), p.stroke(), p.restore(), p.save(), p.beginPath(), p.rect(l, 0, H, M), p.clip();
|
|
1407
|
+
const j = h - o, Y = [
|
|
1393
1408
|
{ unit: "year", row: 0 },
|
|
1394
1409
|
{ unit: "month", row: 1 },
|
|
1395
1410
|
{ unit: "week", row: 2 }
|
|
1396
1411
|
];
|
|
1397
|
-
for (const { unit:
|
|
1398
|
-
const ee =
|
|
1399
|
-
p.fillStyle = "#F9FAFB", p.fillRect(
|
|
1400
|
-
let N = pe(o).startOf(
|
|
1401
|
-
const le = pe(h).add(1,
|
|
1412
|
+
for (const { unit: W, row: U } of Y) {
|
|
1413
|
+
const ee = U * y;
|
|
1414
|
+
p.fillStyle = "#F9FAFB", p.fillRect(l, ee, H, y);
|
|
1415
|
+
let N = pe(o).startOf(W);
|
|
1416
|
+
const le = pe(h).add(1, W);
|
|
1402
1417
|
for (; N.isBefore(le); ) {
|
|
1403
|
-
const
|
|
1418
|
+
const K = N.add(1, W), ce = l + (N.valueOf() - o) / j * H, de = (K.valueOf() - N.valueOf()) / j * H;
|
|
1404
1419
|
p.strokeStyle = "#E5E7EB", p.lineWidth = 0.5, p.strokeRect(ce, ee, de, y);
|
|
1405
1420
|
let me;
|
|
1406
|
-
|
|
1421
|
+
W === "year" ? me = N.format("YYYY") : W === "month" ? me = N.format("MM") : me = `${N.week()}`, p.fillStyle = "#6c737f", p.font = W === "year" ? '600 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif' : '400 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', p.textBaseline = "middle", p.textAlign = "center", de > 20 && p.fillText(me, ce + de / 2, ee + y / 2), N = K;
|
|
1407
1422
|
}
|
|
1408
1423
|
}
|
|
1409
|
-
p.textAlign = "start", p.restore(), p.save(), p.beginPath(), p.rect(
|
|
1410
|
-
const ae = new
|
|
1424
|
+
p.textAlign = "start", p.restore(), p.save(), p.beginPath(), p.rect(l, M, H, I), p.clip(), p.translate(l, M);
|
|
1425
|
+
const ae = new ut({
|
|
1411
1426
|
visibleTimeStart: o,
|
|
1412
1427
|
visibleTimeEnd: h,
|
|
1413
|
-
canvasWidth:
|
|
1414
|
-
canvasHeight:
|
|
1428
|
+
canvasWidth: H,
|
|
1429
|
+
canvasHeight: I,
|
|
1415
1430
|
sidebarWidth: 0,
|
|
1416
1431
|
lineHeight: m.lineHeight,
|
|
1417
1432
|
groupCount: m.groups.length,
|
|
1418
1433
|
buffer: 1,
|
|
1419
1434
|
scrollTop: 0
|
|
1420
1435
|
});
|
|
1421
|
-
return
|
|
1436
|
+
return Xe.draw(p, ae, m.groups, m.theme, m.dayStyle, m.rowStyle, m.highlights), _e.draw(p, ae, m.groups, m.items, m.intervalTree, m.layoutEngine, m.itemRenderer, m.groupRenderer, m.theme, m.selected, void 0, m.dependencies, m.summaryRenderer, m.hierarchyEngine), Fe.draw(p, ae, m.theme, { cursorX: null, markers: Le.current }), p.restore(), w;
|
|
1422
1437
|
}
|
|
1423
1438
|
};
|
|
1424
|
-
|
|
1425
|
-
}, [
|
|
1426
|
-
const
|
|
1439
|
+
ze == null || ze(r);
|
|
1440
|
+
}, [ze, Xe, _e, Fe]);
|
|
1441
|
+
const di = {
|
|
1427
1442
|
position: "relative",
|
|
1428
|
-
width:
|
|
1443
|
+
width: Me,
|
|
1429
1444
|
height: ke,
|
|
1430
1445
|
overflow: "hidden",
|
|
1431
1446
|
cursor: "default"
|
|
1432
|
-
},
|
|
1433
|
-
return
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1447
|
+
}, ct = { position: "absolute", top: 0, left: 0 };
|
|
1448
|
+
return Ne("div", { ref: Mt, style: { display: "flex", flexDirection: "column", width: "100%", position: "relative" }, children: [Zt ? Ne("div", { style: {
|
|
1449
|
+
position: "absolute",
|
|
1450
|
+
top: 0,
|
|
1451
|
+
left: 0,
|
|
1452
|
+
zIndex: 9999,
|
|
1453
|
+
padding: "2px 6px",
|
|
1454
|
+
fontSize: 10,
|
|
1455
|
+
fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
1456
|
+
lineHeight: 1.4,
|
|
1457
|
+
color: "#fff",
|
|
1458
|
+
background: "rgba(17, 24, 39, 0.78)",
|
|
1459
|
+
borderBottomRightRadius: 4,
|
|
1460
|
+
pointerEvents: "none",
|
|
1461
|
+
userSelect: "none"
|
|
1462
|
+
}, children: ["v", "0.4.5", " · ", "09:22:40"] }) : null, ui, Ne("div", { ref: Ut, style: { display: "flex", overflow: "hidden" }, children: [se(Lt, { groups: n, width: u, lineHeight: c, scrollTop: Ct, canvasHeight: ke, theme: Te, groupRenderer: ne, onScroll: (r) => {
|
|
1463
|
+
D.current.update({ scrollTop: r }), E.markDirty("grid"), E.markDirty("items"), E.markDirty("overlay"), $e(r);
|
|
1464
|
+
} }), Ne("div", { ref: Oe, style: di, onPointerMove: ri, onPointerDown: oi, onPointerUp: si, onDoubleClick: li, onContextMenu: ai, onPointerLeave: ci, children: [se("canvas", { ref: yt, style: { ...ct, zIndex: 0 } }), se("canvas", { ref: Tt, style: { ...ct, zIndex: 1 } }), se("canvas", { ref: St, style: { ...ct, zIndex: 2 } })] }), Qe && vt ? se(Lt, { groups: n, width: Qe, lineHeight: c, scrollTop: Ct, canvasHeight: ke, theme: Te, groupRenderer: vt, onScroll: (r) => {
|
|
1465
|
+
D.current.update({ scrollTop: r }), E.markDirty("grid"), E.markDirty("items"), E.markDirty("overlay"), $e(r);
|
|
1437
1466
|
} }) : null] })] });
|
|
1438
1467
|
}));
|
|
1439
|
-
function
|
|
1440
|
-
const
|
|
1468
|
+
function Fi({ children: i, theme: e, className: t, classNames: n, style: s, visibleTimeStart: d, visibleTimeEnd: a, canvasWidth: u, sidebarWidth: c = 0, onZoomToInterval: v }) {
|
|
1469
|
+
const k = ge.Children.map(i, (g) => {
|
|
1441
1470
|
var T;
|
|
1442
1471
|
if (!ge.isValidElement(g))
|
|
1443
1472
|
return g;
|
|
1444
1473
|
if (((T = g.type) == null ? void 0 : T.displayName) === "DateHeader") {
|
|
1445
|
-
const C = g.props,
|
|
1474
|
+
const C = g.props, R = ge.cloneElement(g, {
|
|
1446
1475
|
visibleTimeStart: C.visibleTimeStart ?? d,
|
|
1447
|
-
visibleTimeEnd: C.visibleTimeEnd ??
|
|
1476
|
+
visibleTimeEnd: C.visibleTimeEnd ?? a,
|
|
1448
1477
|
canvasWidth: C.canvasWidth ?? u,
|
|
1449
1478
|
theme: C.theme ?? e,
|
|
1450
1479
|
onZoomToInterval: C.onIntervalClick ?? C.onZoomToInterval ?? v
|
|
1451
1480
|
});
|
|
1452
|
-
return
|
|
1481
|
+
return Ne("div", { style: { display: "flex" }, children: [se("div", { style: { width: c, flexShrink: 0 } }), se("div", { style: { flex: 1, overflow: "hidden" }, children: R })] });
|
|
1453
1482
|
}
|
|
1454
1483
|
return g;
|
|
1455
1484
|
});
|
|
@@ -1462,65 +1491,65 @@ function Pi({ children: i, theme: e, className: t, classNames: n, style: r, visi
|
|
|
1462
1491
|
backgroundColor: (e == null ? void 0 : e.header.bg) ?? "#F9FAFB",
|
|
1463
1492
|
borderTop: `1px solid ${(e == null ? void 0 : e.header.border) ?? "#E5E7EB"}`,
|
|
1464
1493
|
borderBottom: `1px solid ${(e == null ? void 0 : e.header.border) ?? "#E5E7EB"}`,
|
|
1465
|
-
...
|
|
1466
|
-
}, children:
|
|
1494
|
+
...s
|
|
1495
|
+
}, children: k });
|
|
1467
1496
|
}
|
|
1468
|
-
|
|
1469
|
-
var
|
|
1497
|
+
Fi.displayName = "TimelineHeaders";
|
|
1498
|
+
var Vt = { exports: {} };
|
|
1470
1499
|
(function(i, e) {
|
|
1471
1500
|
(function(t, n) {
|
|
1472
1501
|
i.exports = n();
|
|
1473
|
-
})(
|
|
1502
|
+
})(zt, function() {
|
|
1474
1503
|
var t = "week", n = "year";
|
|
1475
|
-
return function(
|
|
1504
|
+
return function(s, d, a) {
|
|
1476
1505
|
var u = d.prototype;
|
|
1477
1506
|
u.week = function(c) {
|
|
1478
1507
|
if (c === void 0 && (c = null), c !== null) return this.add(7 * (c - this.week()), "day");
|
|
1479
1508
|
var v = this.$locale().yearStart || 1;
|
|
1480
1509
|
if (this.month() === 11 && this.date() > 25) {
|
|
1481
|
-
var
|
|
1482
|
-
if (
|
|
1510
|
+
var k = a(this).startOf(n).add(1, n).date(v), g = a(this).endOf(t);
|
|
1511
|
+
if (k.isBefore(g)) return 1;
|
|
1483
1512
|
}
|
|
1484
|
-
var b =
|
|
1485
|
-
return T < 0 ?
|
|
1513
|
+
var b = a(this).startOf(n).date(v).startOf(t).subtract(1, "millisecond"), T = this.diff(b, t, !0);
|
|
1514
|
+
return T < 0 ? a(this).startOf("week").week() : Math.ceil(T);
|
|
1486
1515
|
}, u.weeks = function(c) {
|
|
1487
1516
|
return c === void 0 && (c = null), this.week(c);
|
|
1488
1517
|
};
|
|
1489
1518
|
};
|
|
1490
1519
|
});
|
|
1491
|
-
})(
|
|
1492
|
-
var
|
|
1493
|
-
const
|
|
1494
|
-
pe.extend(
|
|
1495
|
-
const
|
|
1520
|
+
})(Vt);
|
|
1521
|
+
var Oi = Vt.exports;
|
|
1522
|
+
const Wi = /* @__PURE__ */ $t(Oi);
|
|
1523
|
+
pe.extend(Wi);
|
|
1524
|
+
const Bi = {
|
|
1496
1525
|
year: 30,
|
|
1497
1526
|
month: 30,
|
|
1498
1527
|
week: 20,
|
|
1499
1528
|
day: 15,
|
|
1500
1529
|
hour: 30
|
|
1501
1530
|
};
|
|
1502
|
-
function
|
|
1531
|
+
function Li({ unit: i, visibleTimeStart: e = 0, visibleTimeEnd: t = 0, canvasWidth: n = 0, theme: s, height: d = 28, className: a, labelFormat: u, onIntervalClick: c, minCellWidth: v, onZoomToInterval: k }) {
|
|
1503
1532
|
const g = oe(() => {
|
|
1504
1533
|
if (!e || !t || !n)
|
|
1505
1534
|
return [];
|
|
1506
|
-
const T = t - e, C = v ??
|
|
1535
|
+
const T = t - e, C = v ?? Bi[i];
|
|
1507
1536
|
if (C > 0) {
|
|
1508
1537
|
const S = pe(e).startOf(i);
|
|
1509
1538
|
if ((S.add(1, i).valueOf() - S.valueOf()) / T * n < C)
|
|
1510
1539
|
return [];
|
|
1511
1540
|
}
|
|
1512
|
-
const
|
|
1513
|
-
let
|
|
1541
|
+
const R = [];
|
|
1542
|
+
let O = pe(e).startOf(i).subtract(1, i);
|
|
1514
1543
|
const $ = pe(t).add(2, i).valueOf();
|
|
1515
|
-
for (;
|
|
1516
|
-
const S =
|
|
1517
|
-
|
|
1544
|
+
for (; O.valueOf() < $; ) {
|
|
1545
|
+
const S = O.add(1, i), F = O.valueOf(), B = S.valueOf(), A = (F - e) / T * n, Z = (B - F) / T * n, ne = Yi(O, S, i, u);
|
|
1546
|
+
R.push({ start: F, end: B, label: ne, left: A, width: Z }), O = S;
|
|
1518
1547
|
}
|
|
1519
|
-
return
|
|
1548
|
+
return R;
|
|
1520
1549
|
}, [e, t, n, i, u, v]), b = ie((T, C) => {
|
|
1521
|
-
c ? c(T, C) :
|
|
1522
|
-
}, [c,
|
|
1523
|
-
return g.length === 0 ? null : se("div", { style: { display: "flex", position: "relative", height: d, overflow: "hidden" }, children: g.map((T) => se("div", { className:
|
|
1550
|
+
c ? c(T, C) : k && k(T, C);
|
|
1551
|
+
}, [c, k]);
|
|
1552
|
+
return g.length === 0 ? null : se("div", { style: { display: "flex", position: "relative", height: d, overflow: "hidden" }, children: g.map((T) => se("div", { className: a, onClick: () => b(T.start, T.end), style: {
|
|
1524
1553
|
position: "absolute",
|
|
1525
1554
|
left: T.left,
|
|
1526
1555
|
width: T.width,
|
|
@@ -1528,11 +1557,11 @@ function Fi({ unit: i, visibleTimeStart: e = 0, visibleTimeEnd: t = 0, canvasWid
|
|
|
1528
1557
|
display: "flex",
|
|
1529
1558
|
alignItems: "center",
|
|
1530
1559
|
justifyContent: "center",
|
|
1531
|
-
borderRight: `1px solid ${(
|
|
1532
|
-
borderBottom: `1px solid ${(
|
|
1560
|
+
borderRight: `1px solid ${(s == null ? void 0 : s.header.border) ?? "#E5E7EB"}`,
|
|
1561
|
+
borderBottom: `1px solid ${(s == null ? void 0 : s.header.border) ?? "#E5E7EB"}`,
|
|
1533
1562
|
fontSize: 12,
|
|
1534
|
-
color: (
|
|
1535
|
-
backgroundColor: (
|
|
1563
|
+
color: (s == null ? void 0 : s.header.text) ?? "#6c737f",
|
|
1564
|
+
backgroundColor: (s == null ? void 0 : s.header.bg) ?? "#F9FAFB",
|
|
1536
1565
|
overflow: "hidden",
|
|
1537
1566
|
whiteSpace: "nowrap",
|
|
1538
1567
|
cursor: "pointer",
|
|
@@ -1541,11 +1570,11 @@ function Fi({ unit: i, visibleTimeStart: e = 0, visibleTimeEnd: t = 0, canvasWid
|
|
|
1541
1570
|
boxSizing: "border-box"
|
|
1542
1571
|
}, children: se("span", { children: T.label }) }, T.start)) });
|
|
1543
1572
|
}
|
|
1544
|
-
|
|
1545
|
-
function
|
|
1546
|
-
return typeof n == "function" ? n(i.toDate(), e.toDate(), t) : typeof n == "string" ? i.format(n) :
|
|
1573
|
+
Li.displayName = "DateHeader";
|
|
1574
|
+
function Yi(i, e, t, n, s) {
|
|
1575
|
+
return typeof n == "function" ? n(i.toDate(), e.toDate(), t) : typeof n == "string" ? i.format(n) : Ai(i, t);
|
|
1547
1576
|
}
|
|
1548
|
-
function
|
|
1577
|
+
function Ai(i, e) {
|
|
1549
1578
|
switch (e) {
|
|
1550
1579
|
case "year":
|
|
1551
1580
|
return i.format("YYYY");
|
|
@@ -1559,24 +1588,24 @@ function Xi(i, e) {
|
|
|
1559
1588
|
return i.format("HH:mm");
|
|
1560
1589
|
}
|
|
1561
1590
|
}
|
|
1562
|
-
function
|
|
1591
|
+
function ji({ width: i, children: e, style: t }) {
|
|
1563
1592
|
const n = () => ({ style: { width: i, ...t } });
|
|
1564
|
-
return e ? se(
|
|
1593
|
+
return e ? se(Nt, { children: e({ getRootProps: n }) }) : se("div", { style: { width: i } });
|
|
1565
1594
|
}
|
|
1566
|
-
|
|
1567
|
-
function
|
|
1568
|
-
return se(
|
|
1595
|
+
ji.displayName = "SidebarHeader";
|
|
1596
|
+
function Ni({ children: i }) {
|
|
1597
|
+
return se(Nt, { children: i });
|
|
1569
1598
|
}
|
|
1570
|
-
|
|
1599
|
+
Ni.displayName = "CustomHeader";
|
|
1571
1600
|
export {
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1601
|
+
Vi as CanvasTimeline,
|
|
1602
|
+
Ni as CustomHeader,
|
|
1603
|
+
Xi as CustomMarker,
|
|
1604
|
+
Ee as DEFAULT_THEME,
|
|
1605
|
+
Li as DateHeader,
|
|
1606
|
+
bi as HierarchyEngine,
|
|
1607
|
+
ji as SidebarHeader,
|
|
1608
|
+
Fi as TimelineHeaders,
|
|
1609
|
+
Pi as TodayMarker
|
|
1581
1610
|
};
|
|
1582
1611
|
//# sourceMappingURL=canvas-timeline.es.js.map
|