@taskctrl/canvas-timeline 0.7.0 → 0.8.1
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/canvas-timeline.cjs.js +1 -1
- package/dist/canvas-timeline.cjs.js.map +1 -1
- package/dist/canvas-timeline.es.js +943 -929
- package/dist/canvas-timeline.es.js.map +1 -1
- package/dist/core/HitTest.d.ts +22 -0
- package/dist/index.d.ts +1 -1
- package/dist/interaction/interactionInfo.d.ts +26 -0
- package/dist/types.d.ts +30 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { flushSync as
|
|
1
|
+
import { jsx as ne, jsxs as Ve, Fragment as ni } from "react/jsx-runtime";
|
|
2
|
+
import ce, { useRef as A, useMemo as K, useCallback as Q, useEffect as le, forwardRef as Oi, useState as Ue, useImperativeHandle as Pi } from "react";
|
|
3
|
+
import { flushSync as Xi } from "react-dom";
|
|
4
4
|
import We from "dayjs";
|
|
5
|
-
const
|
|
5
|
+
const Ce = {
|
|
6
6
|
primary: "#269bf7",
|
|
7
7
|
trainColors: {},
|
|
8
8
|
status: { red: "#EF5350", yellow: "#FBBF24", green: "#31c48d" },
|
|
@@ -12,7 +12,7 @@ const He = {
|
|
|
12
12
|
sidebar: { bg: "#F9FAFB", border: "#E5E7EB", text: "#6c737f" },
|
|
13
13
|
header: { bg: "#F9FAFB", border: "#E5E7EB", text: "#6c737f" }
|
|
14
14
|
};
|
|
15
|
-
class
|
|
15
|
+
class Tt {
|
|
16
16
|
constructor(e) {
|
|
17
17
|
Object.defineProperty(this, "visibleTimeStart", {
|
|
18
18
|
enumerable: !0,
|
|
@@ -89,8 +89,8 @@ class yt {
|
|
|
89
89
|
const e = new Array(this.groupCount + 1);
|
|
90
90
|
e[0] = 0;
|
|
91
91
|
for (let n = 0; n < this.groupCount; n++) {
|
|
92
|
-
const
|
|
93
|
-
e[n + 1] = e[n] +
|
|
92
|
+
const r = ((t = this.groupHeights) == null ? void 0 : t[n]) ?? this.lineHeight;
|
|
93
|
+
e[n + 1] = e[n] + r;
|
|
94
94
|
}
|
|
95
95
|
this.groupYOffsets = e;
|
|
96
96
|
}
|
|
@@ -108,10 +108,10 @@ class yt {
|
|
|
108
108
|
return 0;
|
|
109
109
|
if (t >= this.groupYOffsets[this.groupCount])
|
|
110
110
|
return this.groupCount - 1;
|
|
111
|
-
let n = 0,
|
|
112
|
-
for (; n <
|
|
113
|
-
const d = n +
|
|
114
|
-
this.groupYOffsets[d + 1] > t ?
|
|
111
|
+
let n = 0, r = this.groupCount - 1;
|
|
112
|
+
for (; n < r; ) {
|
|
113
|
+
const d = n + r >>> 1;
|
|
114
|
+
this.groupYOffsets[d + 1] > t ? r = d : n = d + 1;
|
|
115
115
|
}
|
|
116
116
|
return n;
|
|
117
117
|
}
|
|
@@ -143,7 +143,7 @@ class yt {
|
|
|
143
143
|
return this.groupYOffsets[this.groupCount] ?? 0;
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
class
|
|
146
|
+
class $i {
|
|
147
147
|
constructor() {
|
|
148
148
|
Object.defineProperty(this, "root", {
|
|
149
149
|
enumerable: !0,
|
|
@@ -153,26 +153,26 @@ class Ii {
|
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
155
|
buildFromItems(e, t, n) {
|
|
156
|
-
const
|
|
156
|
+
const r = e.map((d) => ({
|
|
157
157
|
item: d,
|
|
158
158
|
start: t(d),
|
|
159
159
|
end: n(d)
|
|
160
160
|
}));
|
|
161
|
-
this.root = this.buildNode(
|
|
161
|
+
this.root = this.buildNode(r);
|
|
162
162
|
}
|
|
163
163
|
buildNode(e) {
|
|
164
164
|
if (e.length === 0)
|
|
165
165
|
return null;
|
|
166
166
|
let t = 1 / 0, n = -1 / 0;
|
|
167
|
-
for (const
|
|
168
|
-
|
|
169
|
-
const
|
|
170
|
-
for (const
|
|
171
|
-
|
|
167
|
+
for (const l of e)
|
|
168
|
+
l.start < t && (t = l.start), l.end > n && (n = l.end);
|
|
169
|
+
const r = (t + n) / 2, d = [], o = [], c = [];
|
|
170
|
+
for (const l of e)
|
|
171
|
+
l.end < r ? d.push(l) : l.start > r ? o.push(l) : c.push(l);
|
|
172
172
|
return {
|
|
173
|
-
center:
|
|
173
|
+
center: r,
|
|
174
174
|
left: this.buildNode(d),
|
|
175
|
-
right: this.buildNode(
|
|
175
|
+
right: this.buildNode(o),
|
|
176
176
|
overlapping: c
|
|
177
177
|
};
|
|
178
178
|
}
|
|
@@ -180,15 +180,15 @@ class Ii {
|
|
|
180
180
|
const n = [];
|
|
181
181
|
return this.queryNode(this.root, e, t, n), n;
|
|
182
182
|
}
|
|
183
|
-
queryNode(e, t, n,
|
|
183
|
+
queryNode(e, t, n, r) {
|
|
184
184
|
if (e !== null) {
|
|
185
185
|
for (const d of e.overlapping)
|
|
186
|
-
d.start <= n && d.end >= t &&
|
|
187
|
-
t <= e.center && e.left !== null && this.queryNode(e.left, t, n,
|
|
186
|
+
d.start <= n && d.end >= t && r.push(d.item);
|
|
187
|
+
t <= e.center && e.left !== null && this.queryNode(e.left, t, n, r), n >= e.center && e.right !== null && this.queryNode(e.right, t, n, r);
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
class
|
|
191
|
+
class _i {
|
|
192
192
|
constructor(e, t) {
|
|
193
193
|
Object.defineProperty(this, "lineHeight", {
|
|
194
194
|
enumerable: !0,
|
|
@@ -214,65 +214,65 @@ class Ri {
|
|
|
214
214
|
}
|
|
215
215
|
computeLayout(e, t, n) {
|
|
216
216
|
this.layoutCache = /* @__PURE__ */ new Map(), this.groupMaxStack = /* @__PURE__ */ new Map();
|
|
217
|
-
const
|
|
217
|
+
const r = this.lineHeight * this.itemHeightRatio, d = r * 0.6;
|
|
218
218
|
if (!t) {
|
|
219
219
|
for (const c of e) {
|
|
220
|
-
const
|
|
221
|
-
this.layoutCache.set(c.id, { stackLevel: 0, itemHeight:
|
|
220
|
+
const l = (n == null ? void 0 : n.isParent(c.id)) ?? !1;
|
|
221
|
+
this.layoutCache.set(c.id, { stackLevel: 0, itemHeight: l ? d : r }), this.groupMaxStack.set(c.group, 0);
|
|
222
222
|
}
|
|
223
223
|
return this.layoutCache;
|
|
224
224
|
}
|
|
225
|
-
const
|
|
225
|
+
const o = /* @__PURE__ */ new Map();
|
|
226
226
|
for (const c of e) {
|
|
227
|
-
let
|
|
228
|
-
|
|
227
|
+
let l = o.get(c.group);
|
|
228
|
+
l || (l = [], o.set(c.group, l)), l.push(c);
|
|
229
229
|
}
|
|
230
|
-
for (const [c,
|
|
231
|
-
n ? this.computeHierarchyLayout(
|
|
230
|
+
for (const [c, l] of o)
|
|
231
|
+
n ? this.computeHierarchyLayout(l, n, r, d, c) : this.computeFlatLayout(l, r, c);
|
|
232
232
|
return this.layoutCache;
|
|
233
233
|
}
|
|
234
234
|
computeFlatLayout(e, t, n) {
|
|
235
|
-
e.sort((
|
|
236
|
-
const
|
|
237
|
-
return
|
|
235
|
+
e.sort((o, c) => {
|
|
236
|
+
const l = o.start_time - c.start_time;
|
|
237
|
+
return l !== 0 ? l : c.end_time - c.start_time - (o.end_time - o.start_time);
|
|
238
238
|
});
|
|
239
|
-
const
|
|
239
|
+
const r = [];
|
|
240
240
|
let d = 0;
|
|
241
|
-
for (const
|
|
241
|
+
for (const o of e) {
|
|
242
242
|
let c = -1;
|
|
243
|
-
for (let
|
|
244
|
-
if (
|
|
245
|
-
c =
|
|
243
|
+
for (let l = 0; l < r.length; l++)
|
|
244
|
+
if (r[l] <= o.start_time) {
|
|
245
|
+
c = l;
|
|
246
246
|
break;
|
|
247
247
|
}
|
|
248
|
-
c === -1 ? (c =
|
|
248
|
+
c === -1 ? (c = r.length, r.push(o.end_time)) : r[c] = o.end_time, c > d && (d = c), this.layoutCache.set(o.id, { stackLevel: c, itemHeight: t });
|
|
249
249
|
}
|
|
250
250
|
this.groupMaxStack.set(n, d);
|
|
251
251
|
}
|
|
252
|
-
computeHierarchyLayout(e, t, n,
|
|
253
|
-
const
|
|
254
|
-
for (const
|
|
255
|
-
t.isParent(
|
|
256
|
-
|
|
257
|
-
const M =
|
|
258
|
-
return M !== 0 ? M : f.end_time - f.start_time - (
|
|
252
|
+
computeHierarchyLayout(e, t, n, r, d) {
|
|
253
|
+
const o = [], c = [];
|
|
254
|
+
for (const h of e)
|
|
255
|
+
t.isParent(h.id) ? c.push(h) : o.push(h);
|
|
256
|
+
o.sort((h, f) => {
|
|
257
|
+
const M = h.start_time - f.start_time;
|
|
258
|
+
return M !== 0 ? M : f.end_time - f.start_time - (h.end_time - h.start_time);
|
|
259
259
|
});
|
|
260
|
-
const
|
|
261
|
-
let
|
|
262
|
-
for (const
|
|
260
|
+
const l = [];
|
|
261
|
+
let v = 0;
|
|
262
|
+
for (const h of o) {
|
|
263
263
|
let f = -1;
|
|
264
|
-
for (let M = 0; M <
|
|
265
|
-
if (
|
|
264
|
+
for (let M = 0; M < l.length; M++)
|
|
265
|
+
if (l[M] <= h.start_time) {
|
|
266
266
|
f = M;
|
|
267
267
|
break;
|
|
268
268
|
}
|
|
269
|
-
f === -1 ? (f =
|
|
269
|
+
f === -1 ? (f = l.length, l.push(h.end_time)) : l[f] = h.end_time, f > v && (v = f), this.layoutCache.set(h.id, { stackLevel: f, itemHeight: n });
|
|
270
270
|
}
|
|
271
|
-
c.sort((
|
|
272
|
-
let
|
|
273
|
-
for (const
|
|
274
|
-
this.layoutCache.set(
|
|
275
|
-
this.groupMaxStack.set(d,
|
|
271
|
+
c.sort((h, f) => t.getNestingDepth(f.id) - t.getNestingDepth(h.id));
|
|
272
|
+
let C = o.length > 0 ? v + 1 : 0;
|
|
273
|
+
for (const h of c)
|
|
274
|
+
this.layoutCache.set(h.id, { stackLevel: C, itemHeight: r }), C > v && (v = C), C++;
|
|
275
|
+
this.groupMaxStack.set(d, v);
|
|
276
276
|
}
|
|
277
277
|
getLayout(e) {
|
|
278
278
|
return this.layoutCache.get(e);
|
|
@@ -281,7 +281,7 @@ class Ri {
|
|
|
281
281
|
return ((this.groupMaxStack.get(e) ?? 0) + 1) * this.lineHeight;
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
|
-
class
|
|
284
|
+
class Yi {
|
|
285
285
|
constructor() {
|
|
286
286
|
Object.defineProperty(this, "parentToChildren", {
|
|
287
287
|
enumerable: !0,
|
|
@@ -317,19 +317,19 @@ class Oi {
|
|
|
317
317
|
}
|
|
318
318
|
for (const t of this.childToParent.keys()) {
|
|
319
319
|
const n = /* @__PURE__ */ new Set();
|
|
320
|
-
let
|
|
321
|
-
for (;
|
|
322
|
-
if (n.has(
|
|
320
|
+
let r = t;
|
|
321
|
+
for (; r !== void 0; ) {
|
|
322
|
+
if (n.has(r)) {
|
|
323
323
|
const d = this.childToParent.get(t);
|
|
324
324
|
this.childToParent.delete(t);
|
|
325
|
-
const
|
|
326
|
-
if (
|
|
327
|
-
const c =
|
|
328
|
-
c !== -1 &&
|
|
325
|
+
const o = this.parentToChildren.get(d);
|
|
326
|
+
if (o) {
|
|
327
|
+
const c = o.indexOf(t);
|
|
328
|
+
c !== -1 && o.splice(c, 1), o.length === 0 && this.parentToChildren.delete(d);
|
|
329
329
|
}
|
|
330
330
|
break;
|
|
331
331
|
}
|
|
332
|
-
n.add(
|
|
332
|
+
n.add(r), r = this.childToParent.get(r);
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
335
|
}
|
|
@@ -346,9 +346,9 @@ class Oi {
|
|
|
346
346
|
getDescendants(e) {
|
|
347
347
|
const t = [], n = [...this.getChildren(e)];
|
|
348
348
|
for (; n.length > 0; ) {
|
|
349
|
-
const
|
|
350
|
-
t.push(
|
|
351
|
-
const d = this.parentToChildren.get(
|
|
349
|
+
const r = n.pop();
|
|
350
|
+
t.push(r);
|
|
351
|
+
const d = this.parentToChildren.get(r);
|
|
352
352
|
d && n.push(...d);
|
|
353
353
|
}
|
|
354
354
|
return t;
|
|
@@ -357,31 +357,31 @@ class Oi {
|
|
|
357
357
|
const t = this.itemMap.get(e);
|
|
358
358
|
if (!t)
|
|
359
359
|
return { start: 0, end: 0 };
|
|
360
|
-
let n = t.start_time,
|
|
360
|
+
let n = t.start_time, r = t.end_time;
|
|
361
361
|
const d = this.getDescendants(e);
|
|
362
|
-
for (const
|
|
363
|
-
const c = this.itemMap.get(
|
|
364
|
-
c && (c.start_time < n && (n = c.start_time), c.end_time >
|
|
362
|
+
for (const o of d) {
|
|
363
|
+
const c = this.itemMap.get(o);
|
|
364
|
+
c && (c.start_time < n && (n = c.start_time), c.end_time > r && (r = c.end_time));
|
|
365
365
|
}
|
|
366
|
-
return { start: n, end:
|
|
366
|
+
return { start: n, end: r };
|
|
367
367
|
}
|
|
368
368
|
getNestingDepth(e) {
|
|
369
369
|
const t = this.depthCache.get(e);
|
|
370
370
|
if (t !== void 0)
|
|
371
371
|
return t;
|
|
372
|
-
let n = 0,
|
|
373
|
-
for (;
|
|
374
|
-
n++,
|
|
372
|
+
let n = 0, r = this.childToParent.get(e);
|
|
373
|
+
for (; r !== void 0; )
|
|
374
|
+
n++, r = this.childToParent.get(r);
|
|
375
375
|
return this.depthCache.set(e, n), n;
|
|
376
376
|
}
|
|
377
377
|
getMoveDelta(e, t) {
|
|
378
378
|
const n = this.itemMap.get(e);
|
|
379
379
|
if (!n)
|
|
380
380
|
return [];
|
|
381
|
-
const
|
|
382
|
-
return this.getDescendants(e).map((
|
|
383
|
-
const c = this.itemMap.get(
|
|
384
|
-
return { itemId:
|
|
381
|
+
const r = t - n.start_time;
|
|
382
|
+
return this.getDescendants(e).map((o) => {
|
|
383
|
+
const c = this.itemMap.get(o);
|
|
384
|
+
return { itemId: o, newStart: c.start_time + r };
|
|
385
385
|
});
|
|
386
386
|
}
|
|
387
387
|
getResizeConstraint(e, t) {
|
|
@@ -389,81 +389,88 @@ class Oi {
|
|
|
389
389
|
if (n.length === 0)
|
|
390
390
|
return t === "left" ? { min: -1 / 0, max: 1 / 0 } : { min: -1 / 0, max: 1 / 0 };
|
|
391
391
|
if (t === "left") {
|
|
392
|
-
let
|
|
392
|
+
let r = 1 / 0;
|
|
393
393
|
for (const d of n) {
|
|
394
|
-
const
|
|
395
|
-
|
|
394
|
+
const o = this.itemMap.get(d);
|
|
395
|
+
o && o.start_time < r && (r = o.start_time);
|
|
396
396
|
}
|
|
397
|
-
return { min: -1 / 0, max:
|
|
397
|
+
return { min: -1 / 0, max: r };
|
|
398
398
|
} else {
|
|
399
|
-
let
|
|
399
|
+
let r = -1 / 0;
|
|
400
400
|
for (const d of n) {
|
|
401
|
-
const
|
|
402
|
-
|
|
401
|
+
const o = this.itemMap.get(d);
|
|
402
|
+
o && o.end_time > r && (r = o.end_time);
|
|
403
403
|
}
|
|
404
|
-
return { min:
|
|
404
|
+
return { min: r, max: 1 / 0 };
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
-
function
|
|
409
|
-
const { x:
|
|
410
|
-
i.globalAlpha = 0.15, i.fillStyle =
|
|
411
|
-
const
|
|
412
|
-
i.fillStyle =
|
|
408
|
+
function Fi(i, e, t, n, r, d) {
|
|
409
|
+
const { x: o, y: c, width: l, height: v } = t, C = d.primary;
|
|
410
|
+
i.globalAlpha = 0.15, i.fillStyle = C, i.fillRect(o, c, l, v), i.globalAlpha = 1, i.strokeStyle = C, i.lineWidth = 1.5, i.strokeRect(o, c, l, v);
|
|
411
|
+
const h = Math.min(v * 0.5, 6), f = c + v / 2;
|
|
412
|
+
i.fillStyle = C, i.beginPath(), i.moveTo(o, f), i.lineTo(o + h, f - h), i.lineTo(o + h * 2, f), i.lineTo(o + h, f + h), i.closePath(), i.fill(), i.beginPath(), i.moveTo(o + l, f), i.lineTo(o + l - h, f - h), i.lineTo(o + l - h * 2, f), i.lineTo(o + l - h, f + h), i.closePath(), i.fill();
|
|
413
413
|
const M = e.title;
|
|
414
|
-
if (M &&
|
|
414
|
+
if (M && l > 30) {
|
|
415
415
|
i.fillStyle = d.item.text, i.font = '500 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', i.textBaseline = "middle";
|
|
416
|
-
const T = i.measureText(M).width,
|
|
417
|
-
if (
|
|
418
|
-
const E = T >
|
|
419
|
-
i.fillText(E,
|
|
416
|
+
const T = i.measureText(M).width, m = l - h * 4 - 4;
|
|
417
|
+
if (m > 20) {
|
|
418
|
+
const E = T > m ? M.slice(0, Math.floor(M.length * m / T)) + "..." : M;
|
|
419
|
+
i.fillText(E, o + l / 2 - Math.min(T, m) / 2, f);
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
|
-
n.selected && (i.strokeStyle = d.item.selectedRing, i.lineWidth = 2, i.strokeRect(
|
|
422
|
+
n.selected && (i.strokeStyle = d.item.selectedRing, i.lineWidth = 2, i.strokeRect(o - 1, c - 1, l + 2, v + 2));
|
|
423
423
|
}
|
|
424
|
-
function
|
|
425
|
-
const
|
|
426
|
-
for (let
|
|
427
|
-
c.set(d[
|
|
428
|
-
const
|
|
429
|
-
let
|
|
430
|
-
for (const
|
|
431
|
-
const f = c.get(
|
|
424
|
+
function Ze(i, e, t, n, r, d) {
|
|
425
|
+
const o = t.xToTime(i), c = /* @__PURE__ */ new Map();
|
|
426
|
+
for (let h = 0; h < d.length; h++)
|
|
427
|
+
c.set(d[h].id, h);
|
|
428
|
+
const l = n.query(o, o);
|
|
429
|
+
let v = null, C = -1 / 0;
|
|
430
|
+
for (const h of l) {
|
|
431
|
+
const f = c.get(h.group);
|
|
432
432
|
if (f === void 0)
|
|
433
433
|
continue;
|
|
434
|
-
const M =
|
|
434
|
+
const M = r.getLayout(h.id);
|
|
435
435
|
if (!M)
|
|
436
436
|
continue;
|
|
437
|
-
const T = t.timeToX(
|
|
438
|
-
if (i < T || i > T +
|
|
437
|
+
const T = t.timeToX(h.start_time), m = t.timeToX(h.end_time) - T;
|
|
438
|
+
if (i < T || i > T + m)
|
|
439
439
|
continue;
|
|
440
|
-
const P = t.groupIndexToY(f) + M.stackLevel * t.lineHeight + (t.lineHeight - M.itemHeight) / 2,
|
|
441
|
-
e < P || e > P +
|
|
440
|
+
const P = t.groupIndexToY(f) + M.stackLevel * t.lineHeight + (t.lineHeight - M.itemHeight) / 2, Y = M.itemHeight;
|
|
441
|
+
e < P || e > P + Y || P > C && (C = P, v = h);
|
|
442
442
|
}
|
|
443
|
-
return
|
|
443
|
+
return v;
|
|
444
444
|
}
|
|
445
|
-
function
|
|
445
|
+
function St(i, e, t) {
|
|
446
446
|
const n = e.yToGroupIndex(i);
|
|
447
447
|
return t[n] ?? null;
|
|
448
448
|
}
|
|
449
|
-
function
|
|
450
|
-
const
|
|
451
|
-
return i -
|
|
449
|
+
function Zt(i, e, t, n = 6) {
|
|
450
|
+
const r = t.timeToX(e.start_time), d = t.timeToX(e.end_time);
|
|
451
|
+
return i - r <= n ? "left" : d - i <= n ? "right" : "body";
|
|
452
452
|
}
|
|
453
|
-
function
|
|
453
|
+
function Wi(i, e) {
|
|
454
454
|
return i.canResize ?? e;
|
|
455
455
|
}
|
|
456
|
-
function
|
|
457
|
-
|
|
458
|
-
(i.width !== o || i.height !== d) && (i.width = o, i.height = d, i.style.width = `${e}px`, i.style.height = `${t}px`);
|
|
459
|
-
const s = i.getContext("2d");
|
|
460
|
-
return s.setTransform(n, 0, 0, n, 0, 0), s;
|
|
456
|
+
function Bi(i, e) {
|
|
457
|
+
return i.canMove ?? e;
|
|
461
458
|
}
|
|
462
|
-
function
|
|
459
|
+
function Vt(i, e, t, n) {
|
|
460
|
+
const r = Wi(i, t);
|
|
461
|
+
return e === "left" && (r === "left" || r === "both") ? "resize-left" : e === "right" && (r === "right" || r === "both") ? "resize-right" : i.canResize === !1 && e !== "body" ? null : Bi(i, n) ? "move" : null;
|
|
462
|
+
}
|
|
463
|
+
function Mt(i, e, t) {
|
|
464
|
+
const n = window.devicePixelRatio || 1, r = Math.round(e * n), d = Math.round(t * n);
|
|
465
|
+
(i.width !== r || i.height !== d) && (i.width = r, i.height = d, i.style.width = `${e}px`, i.style.height = `${t}px`);
|
|
466
|
+
const o = i.getContext("2d");
|
|
467
|
+
return o.setTransform(n, 0, 0, n, 0, 0), o;
|
|
468
|
+
}
|
|
469
|
+
function wt(i, e) {
|
|
463
470
|
const t = window.devicePixelRatio || 1;
|
|
464
471
|
i.clearRect(0, 0, e.width / t, e.height / t);
|
|
465
472
|
}
|
|
466
|
-
class
|
|
473
|
+
class zi {
|
|
467
474
|
constructor(e) {
|
|
468
475
|
Object.defineProperty(this, "dirty", {
|
|
469
476
|
enumerable: !0,
|
|
@@ -503,244 +510,244 @@ var lt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
503
510
|
function at(i) {
|
|
504
511
|
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
|
|
505
512
|
}
|
|
506
|
-
var
|
|
513
|
+
var ri = { exports: {} };
|
|
507
514
|
(function(i, e) {
|
|
508
515
|
(function(t, n) {
|
|
509
516
|
i.exports = n();
|
|
510
517
|
})(lt, function() {
|
|
511
|
-
var t = "minute", n = /[+-]\d\d(?::?\d\d)?/g,
|
|
512
|
-
return function(d,
|
|
513
|
-
var
|
|
514
|
-
c.utc = function(
|
|
515
|
-
var E = { date:
|
|
516
|
-
return new
|
|
517
|
-
},
|
|
518
|
+
var t = "minute", n = /[+-]\d\d(?::?\d\d)?/g, r = /([+-]|\d\d)/g;
|
|
519
|
+
return function(d, o, c) {
|
|
520
|
+
var l = o.prototype;
|
|
521
|
+
c.utc = function(m) {
|
|
522
|
+
var E = { date: m, utc: !0, args: arguments };
|
|
523
|
+
return new o(E);
|
|
524
|
+
}, l.utc = function(m) {
|
|
518
525
|
var E = c(this.toDate(), { locale: this.$L, utc: !0 });
|
|
519
|
-
return
|
|
520
|
-
},
|
|
526
|
+
return m ? E.add(this.utcOffset(), t) : E;
|
|
527
|
+
}, l.local = function() {
|
|
521
528
|
return c(this.toDate(), { locale: this.$L, utc: !1 });
|
|
522
529
|
};
|
|
523
|
-
var
|
|
524
|
-
|
|
525
|
-
|
|
530
|
+
var v = l.parse;
|
|
531
|
+
l.parse = function(m) {
|
|
532
|
+
m.utc && (this.$u = !0), this.$utils().u(m.$offset) || (this.$offset = m.$offset), v.call(this, m);
|
|
526
533
|
};
|
|
527
|
-
var
|
|
528
|
-
|
|
534
|
+
var C = l.init;
|
|
535
|
+
l.init = function() {
|
|
529
536
|
if (this.$u) {
|
|
530
|
-
var
|
|
531
|
-
this.$y =
|
|
532
|
-
} else
|
|
537
|
+
var m = this.$d;
|
|
538
|
+
this.$y = m.getUTCFullYear(), this.$M = m.getUTCMonth(), this.$D = m.getUTCDate(), this.$W = m.getUTCDay(), this.$H = m.getUTCHours(), this.$m = m.getUTCMinutes(), this.$s = m.getUTCSeconds(), this.$ms = m.getUTCMilliseconds();
|
|
539
|
+
} else C.call(this);
|
|
533
540
|
};
|
|
534
|
-
var
|
|
535
|
-
|
|
541
|
+
var h = l.utcOffset;
|
|
542
|
+
l.utcOffset = function(m, E) {
|
|
536
543
|
var P = this.$utils().u;
|
|
537
|
-
if (P(
|
|
538
|
-
if (typeof
|
|
544
|
+
if (P(m)) return this.$u ? 0 : P(this.$offset) ? h.call(this) : this.$offset;
|
|
545
|
+
if (typeof m == "string" && (m = function(w) {
|
|
539
546
|
w === void 0 && (w = "");
|
|
540
547
|
var $ = w.match(n);
|
|
541
548
|
if (!$) return null;
|
|
542
|
-
var B = ("" + $[0]).match(
|
|
543
|
-
return
|
|
544
|
-
}(
|
|
545
|
-
var
|
|
546
|
-
if (
|
|
549
|
+
var B = ("" + $[0]).match(r) || ["-", 0, 0], I = B[0], x = 60 * +B[1] + +B[2];
|
|
550
|
+
return x === 0 ? 0 : I === "+" ? x : -x;
|
|
551
|
+
}(m), m === null)) return this;
|
|
552
|
+
var Y = Math.abs(m) <= 16 ? 60 * m : m;
|
|
553
|
+
if (Y === 0) return this.utc(E);
|
|
547
554
|
var y = this.clone();
|
|
548
|
-
if (E) return y.$offset =
|
|
549
|
-
var
|
|
550
|
-
return (y = this.local().add(
|
|
555
|
+
if (E) return y.$offset = Y, y.$u = !1, y;
|
|
556
|
+
var H = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
|
|
557
|
+
return (y = this.local().add(Y + H, t)).$offset = Y, y.$x.$localOffset = H, y;
|
|
551
558
|
};
|
|
552
|
-
var f =
|
|
553
|
-
|
|
554
|
-
var E =
|
|
559
|
+
var f = l.format;
|
|
560
|
+
l.format = function(m) {
|
|
561
|
+
var E = m || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
|
|
555
562
|
return f.call(this, E);
|
|
556
|
-
},
|
|
557
|
-
var
|
|
558
|
-
return this.$d.valueOf() - 6e4 *
|
|
559
|
-
},
|
|
563
|
+
}, l.valueOf = function() {
|
|
564
|
+
var m = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
|
|
565
|
+
return this.$d.valueOf() - 6e4 * m;
|
|
566
|
+
}, l.isUTC = function() {
|
|
560
567
|
return !!this.$u;
|
|
561
|
-
},
|
|
568
|
+
}, l.toISOString = function() {
|
|
562
569
|
return this.toDate().toISOString();
|
|
563
|
-
},
|
|
570
|
+
}, l.toString = function() {
|
|
564
571
|
return this.toDate().toUTCString();
|
|
565
572
|
};
|
|
566
|
-
var M =
|
|
567
|
-
|
|
568
|
-
return
|
|
573
|
+
var M = l.toDate;
|
|
574
|
+
l.toDate = function(m) {
|
|
575
|
+
return m === "s" && this.$offset ? c(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : M.call(this);
|
|
569
576
|
};
|
|
570
|
-
var T =
|
|
571
|
-
|
|
572
|
-
if (
|
|
573
|
-
var
|
|
574
|
-
return T.call(
|
|
577
|
+
var T = l.diff;
|
|
578
|
+
l.diff = function(m, E, P) {
|
|
579
|
+
if (m && this.$u === m.$u) return T.call(this, m, E, P);
|
|
580
|
+
var Y = this.local(), y = c(m).local();
|
|
581
|
+
return T.call(Y, y, E, P);
|
|
575
582
|
};
|
|
576
583
|
};
|
|
577
584
|
});
|
|
578
|
-
})(
|
|
579
|
-
var
|
|
580
|
-
const
|
|
581
|
-
var
|
|
585
|
+
})(ri);
|
|
586
|
+
var Li = ri.exports;
|
|
587
|
+
const xi = /* @__PURE__ */ at(Li);
|
|
588
|
+
var oi = { exports: {} };
|
|
582
589
|
(function(i, e) {
|
|
583
590
|
(function(t, n) {
|
|
584
591
|
i.exports = n();
|
|
585
592
|
})(lt, function() {
|
|
586
593
|
var t = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, n = {};
|
|
587
|
-
return function(
|
|
588
|
-
var c,
|
|
594
|
+
return function(r, d, o) {
|
|
595
|
+
var c, l = function(f, M, T) {
|
|
589
596
|
T === void 0 && (T = {});
|
|
590
|
-
var
|
|
591
|
-
|
|
592
|
-
var y =
|
|
593
|
-
return w || (w = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone: P, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: y }), n[
|
|
597
|
+
var m = new Date(f), E = function(P, Y) {
|
|
598
|
+
Y === void 0 && (Y = {});
|
|
599
|
+
var y = Y.timeZoneName || "short", H = P + "|" + y, w = n[H];
|
|
600
|
+
return w || (w = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone: P, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: y }), n[H] = w), w;
|
|
594
601
|
}(M, T);
|
|
595
|
-
return E.formatToParts(
|
|
596
|
-
},
|
|
597
|
-
for (var T =
|
|
598
|
-
var P = T[E],
|
|
599
|
-
|
|
602
|
+
return E.formatToParts(m);
|
|
603
|
+
}, v = function(f, M) {
|
|
604
|
+
for (var T = l(f, M), m = [], E = 0; E < T.length; E += 1) {
|
|
605
|
+
var P = T[E], Y = P.type, y = P.value, H = t[Y];
|
|
606
|
+
H >= 0 && (m[H] = parseInt(y, 10));
|
|
600
607
|
}
|
|
601
|
-
var w =
|
|
602
|
-
return (
|
|
603
|
-
},
|
|
604
|
-
|
|
608
|
+
var w = m[3], $ = w === 24 ? 0 : w, B = m[0] + "-" + m[1] + "-" + m[2] + " " + $ + ":" + m[4] + ":" + m[5] + ":000", I = +f;
|
|
609
|
+
return (o.utc(B).valueOf() - (I -= I % 1e3)) / 6e4;
|
|
610
|
+
}, C = d.prototype;
|
|
611
|
+
C.tz = function(f, M) {
|
|
605
612
|
f === void 0 && (f = c);
|
|
606
|
-
var T,
|
|
613
|
+
var T, m = this.utcOffset(), E = this.toDate(), P = E.toLocaleString("en-US", { timeZone: f }), Y = Math.round((E - new Date(P)) / 1e3 / 60), y = 15 * -Math.round(E.getTimezoneOffset() / 15) - Y;
|
|
607
614
|
if (!Number(y)) T = this.utcOffset(0, M);
|
|
608
|
-
else if (T =
|
|
609
|
-
var
|
|
610
|
-
T = T.add(
|
|
615
|
+
else if (T = o(P, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(y, !0), M) {
|
|
616
|
+
var H = T.utcOffset();
|
|
617
|
+
T = T.add(m - H, "minute");
|
|
611
618
|
}
|
|
612
619
|
return T.$x.$timezone = f, T;
|
|
613
|
-
},
|
|
614
|
-
var M = this.$x.$timezone ||
|
|
615
|
-
return
|
|
620
|
+
}, C.offsetName = function(f) {
|
|
621
|
+
var M = this.$x.$timezone || o.tz.guess(), T = l(this.valueOf(), M, { timeZoneName: f }).find(function(m) {
|
|
622
|
+
return m.type.toLowerCase() === "timezonename";
|
|
616
623
|
});
|
|
617
624
|
return T && T.value;
|
|
618
625
|
};
|
|
619
|
-
var
|
|
620
|
-
|
|
621
|
-
if (!this.$x || !this.$x.$timezone) return
|
|
622
|
-
var T =
|
|
623
|
-
return
|
|
624
|
-
},
|
|
625
|
-
var
|
|
626
|
-
if (typeof f != "string") return
|
|
627
|
-
var
|
|
628
|
-
var
|
|
629
|
-
if (B ===
|
|
630
|
-
var
|
|
631
|
-
return
|
|
632
|
-
}(
|
|
626
|
+
var h = C.startOf;
|
|
627
|
+
C.startOf = function(f, M) {
|
|
628
|
+
if (!this.$x || !this.$x.$timezone) return h.call(this, f, M);
|
|
629
|
+
var T = o(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
|
|
630
|
+
return h.call(T, f, M).tz(this.$x.$timezone, !0);
|
|
631
|
+
}, o.tz = function(f, M, T) {
|
|
632
|
+
var m = T && M, E = T || M || c, P = v(+o(), E);
|
|
633
|
+
if (typeof f != "string") return o(f).tz(E);
|
|
634
|
+
var Y = function($, B, I) {
|
|
635
|
+
var x = $ - 60 * B * 1e3, _ = v(x, I);
|
|
636
|
+
if (B === _) return [x, B];
|
|
637
|
+
var ee = v(x -= 60 * (_ - B) * 1e3, I);
|
|
638
|
+
return _ === ee ? [x, _] : [$ - 60 * Math.min(_, ee) * 1e3, Math.max(_, ee)];
|
|
639
|
+
}(o.utc(f, m).valueOf(), P, E), y = Y[0], H = Y[1], w = o(y).utcOffset(H);
|
|
633
640
|
return w.$x.$timezone = E, w;
|
|
634
|
-
},
|
|
641
|
+
}, o.tz.guess = function() {
|
|
635
642
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
636
|
-
},
|
|
643
|
+
}, o.tz.setDefault = function(f) {
|
|
637
644
|
c = f;
|
|
638
645
|
};
|
|
639
646
|
};
|
|
640
647
|
});
|
|
641
|
-
})(
|
|
642
|
-
var
|
|
643
|
-
const
|
|
644
|
-
We.extend(
|
|
645
|
-
We.extend(
|
|
646
|
-
function
|
|
648
|
+
})(oi);
|
|
649
|
+
var Ai = oi.exports;
|
|
650
|
+
const ji = /* @__PURE__ */ at(Ai);
|
|
651
|
+
We.extend(xi);
|
|
652
|
+
We.extend(ji);
|
|
653
|
+
function pe(i, e) {
|
|
647
654
|
return e ? We(i).tz(e) : We(i);
|
|
648
655
|
}
|
|
649
|
-
class
|
|
650
|
-
draw(e, t, n,
|
|
651
|
-
const { firstVisible:
|
|
652
|
-
for (let y =
|
|
653
|
-
const
|
|
656
|
+
class Gi {
|
|
657
|
+
draw(e, t, n, r, d, o, c, l) {
|
|
658
|
+
const { firstVisible: v, lastVisible: C } = t.getVisibleGroupRange();
|
|
659
|
+
for (let y = v; y <= C; y++) {
|
|
660
|
+
const H = t.groupIndexToY(y), w = t.groupIndexToHeight(y), $ = n[y];
|
|
654
661
|
if (!$)
|
|
655
662
|
continue;
|
|
656
663
|
let B;
|
|
657
|
-
const I =
|
|
658
|
-
I != null && I.backgroundColor ? B = I.backgroundColor : B = y % 2 === 0 ? "#FFFFFF" :
|
|
664
|
+
const I = o == null ? void 0 : o($);
|
|
665
|
+
I != null && I.backgroundColor ? B = I.backgroundColor : B = y % 2 === 0 ? "#FFFFFF" : r.grid.rowAlt, e.fillStyle = B, e.fillRect(0, H, t.canvasWidth, w), e.strokeStyle = (I == null ? void 0 : I.borderBottomColor) ?? r.grid.line, e.lineWidth = 0.5, e.beginPath(), e.moveTo(0, H + w), e.lineTo(t.canvasWidth, H + w), e.stroke();
|
|
659
666
|
}
|
|
660
667
|
if (c && c.length > 0)
|
|
661
668
|
for (const y of c) {
|
|
662
|
-
const
|
|
663
|
-
if (w < 0 ||
|
|
669
|
+
const H = t.timeToX(y.start), w = t.timeToX(y.end);
|
|
670
|
+
if (w < 0 || H > t.canvasWidth)
|
|
664
671
|
continue;
|
|
665
|
-
const $ = Math.max(0,
|
|
666
|
-
e.fillStyle = `rgb(${Math.round(
|
|
672
|
+
const $ = Math.max(0, H), B = Math.min(t.canvasWidth, w) - $, I = y.opacity ?? 0.12, x = parseInt(y.color.slice(1, 3), 16), _ = parseInt(y.color.slice(3, 5), 16), ee = parseInt(y.color.slice(5, 7), 16);
|
|
673
|
+
e.fillStyle = `rgb(${Math.round(x * I + 255 * (1 - I))},${Math.round(_ * I + 255 * (1 - I))},${Math.round(ee * I + 255 * (1 - I))})`, e.fillRect($, 0, B, t.canvasHeight);
|
|
667
674
|
}
|
|
668
|
-
const
|
|
675
|
+
const h = t.visibleTimeStart, f = t.visibleTimeEnd, m = 864e5 / (f - h) * t.canvasWidth;
|
|
669
676
|
let E = "day";
|
|
670
|
-
|
|
677
|
+
m < 2 ? E = "month" : m < 8 && (E = "week");
|
|
671
678
|
{
|
|
672
|
-
let y =
|
|
673
|
-
const
|
|
679
|
+
let y = pe(h, l).startOf("day");
|
|
680
|
+
const H = pe(f, l).endOf("day");
|
|
674
681
|
let w = null, $ = 1, B = 0;
|
|
675
|
-
const I = [],
|
|
676
|
-
w !== null && (e.fillStyle = w, $ !== 1 && (e.globalAlpha = $), e.fillRect(B, 0,
|
|
682
|
+
const I = [], x = (_) => {
|
|
683
|
+
w !== null && (e.fillStyle = w, $ !== 1 && (e.globalAlpha = $), e.fillRect(B, 0, _ - B, t.canvasHeight), $ !== 1 && (e.globalAlpha = 1), w = null, $ = 1);
|
|
677
684
|
};
|
|
678
|
-
for (; y.isBefore(
|
|
679
|
-
const
|
|
680
|
-
let
|
|
681
|
-
if (
|
|
682
|
-
|
|
685
|
+
for (; y.isBefore(H); ) {
|
|
686
|
+
const _ = t.timeToX(y.valueOf()), ee = y.toDate(), U = d == null ? void 0 : d(ee);
|
|
687
|
+
let J = null, he = 1;
|
|
688
|
+
if (U != null && U.backgroundColor)
|
|
689
|
+
J = U.backgroundColor, he = U.opacity ?? 1;
|
|
683
690
|
else {
|
|
684
|
-
const
|
|
685
|
-
(
|
|
691
|
+
const ve = y.day();
|
|
692
|
+
(ve === 0 || ve === 6) && (J = r.grid.weekend);
|
|
686
693
|
}
|
|
687
|
-
|
|
694
|
+
U != null && U.borderColor && I.push({ x: _, color: U.borderColor }), J === w && he === $ || (x(_), J !== null && (w = J, $ = he, B = _)), y = y.add(1, "day");
|
|
688
695
|
}
|
|
689
|
-
w !== null &&
|
|
690
|
-
for (const
|
|
691
|
-
e.strokeStyle =
|
|
696
|
+
w !== null && x(t.timeToX(y.valueOf()));
|
|
697
|
+
for (const _ of I)
|
|
698
|
+
e.strokeStyle = _.color, e.lineWidth = 0.5, e.beginPath(), e.moveTo(_.x, 0), e.lineTo(_.x, t.canvasHeight), e.stroke();
|
|
692
699
|
}
|
|
693
|
-
let P =
|
|
694
|
-
const
|
|
695
|
-
for (e.strokeStyle =
|
|
700
|
+
let P = pe(h, l).startOf(E);
|
|
701
|
+
const Y = pe(f, l).add(1, E);
|
|
702
|
+
for (e.strokeStyle = r.grid.line, e.lineWidth = 0.5, e.beginPath(); P.isBefore(Y); ) {
|
|
696
703
|
const y = t.timeToX(P.valueOf());
|
|
697
704
|
e.moveTo(y, 0), e.lineTo(y, t.canvasHeight), P = P.add(1, E);
|
|
698
705
|
}
|
|
699
706
|
if (e.stroke(), c && c.length > 0)
|
|
700
707
|
for (const y of c) {
|
|
701
|
-
const
|
|
702
|
-
if (!(w < 0 ||
|
|
703
|
-
const $ = Math.max(0,
|
|
708
|
+
const H = t.timeToX(y.start), w = t.timeToX(y.end);
|
|
709
|
+
if (!(w < 0 || H > t.canvasWidth) && (e.strokeStyle = y.color, e.globalAlpha = 0.4, e.lineWidth = 1, e.beginPath(), H >= 0 && H <= t.canvasWidth && (e.moveTo(H, 0), e.lineTo(H, t.canvasHeight)), w >= 0 && w <= t.canvasWidth && (e.moveTo(w, 0), e.lineTo(w, t.canvasHeight)), e.stroke(), e.globalAlpha = 1, y.label)) {
|
|
710
|
+
const $ = Math.max(0, H), B = Math.min(t.canvasWidth, w) - $;
|
|
704
711
|
e.save(), e.font = '600 10px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
705
|
-
const I = e.measureText(y.label).width,
|
|
706
|
-
e.fillStyle = y.color, e.globalAlpha = 0.9, e.beginPath(), e.roundRect(
|
|
712
|
+
const I = e.measureText(y.label).width, x = 6, _ = I + x * 2, ee = 18, U = $ + (B - _) / 2, J = 4;
|
|
713
|
+
e.fillStyle = y.color, e.globalAlpha = 0.9, e.beginPath(), e.roundRect(U, J, _, ee, 3), e.fill(), e.globalAlpha = 1, e.fillStyle = "#FFFFFF", e.textBaseline = "middle", e.fillText(y.label, U + x, J + ee / 2), e.restore();
|
|
707
714
|
}
|
|
708
715
|
}
|
|
709
716
|
}
|
|
710
717
|
}
|
|
711
|
-
const
|
|
712
|
-
function
|
|
718
|
+
const qt = '500 12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
719
|
+
function si(i, e) {
|
|
713
720
|
return {
|
|
714
721
|
/**
|
|
715
722
|
* Draws a filled rounded rectangle.
|
|
716
723
|
* Default corner radius is 3px.
|
|
717
724
|
*/
|
|
718
|
-
roundRect(t, n,
|
|
719
|
-
i.beginPath(), i.roundRect(t, n,
|
|
725
|
+
roundRect(t, n, r, d, o = 3) {
|
|
726
|
+
i.beginPath(), i.roundRect(t, n, r, d, o), i.fill();
|
|
720
727
|
},
|
|
721
728
|
/**
|
|
722
729
|
* Draws text at (x, y) using the standard item font.
|
|
723
730
|
* If maxWidth is provided and the text is too wide, binary-search truncates it
|
|
724
731
|
* and appends '...' so it fits within maxWidth.
|
|
725
732
|
*/
|
|
726
|
-
fillText(t, n,
|
|
727
|
-
if (i.font =
|
|
728
|
-
let
|
|
729
|
-
for (;
|
|
730
|
-
const
|
|
731
|
-
i.measureText(
|
|
733
|
+
fillText(t, n, r, d) {
|
|
734
|
+
if (i.font = qt, d !== void 0 && i.measureText(t).width > d) {
|
|
735
|
+
let o = 0, c = t.length;
|
|
736
|
+
for (; o < c; ) {
|
|
737
|
+
const l = Math.ceil((o + c) / 2), v = t.slice(0, l) + "...";
|
|
738
|
+
i.measureText(v).width <= d ? o = l : c = l - 1;
|
|
732
739
|
}
|
|
733
|
-
i.fillText(t.slice(0,
|
|
740
|
+
i.fillText(t.slice(0, o) + "...", n, r);
|
|
734
741
|
} else
|
|
735
|
-
i.fillText(t, n,
|
|
742
|
+
i.fillText(t, n, r);
|
|
736
743
|
},
|
|
737
744
|
/**
|
|
738
745
|
* Creates a 50/50 linear gradient from color1 (0%–50%) to color2 (50%–100%)
|
|
739
746
|
* spanning the given x position and width.
|
|
740
747
|
*/
|
|
741
|
-
gradient(t, n,
|
|
742
|
-
const
|
|
743
|
-
return
|
|
748
|
+
gradient(t, n, r, d) {
|
|
749
|
+
const o = i.createLinearGradient(t, 0, t + n, 0);
|
|
750
|
+
return o.addColorStop(0, r), o.addColorStop(0.5, r), o.addColorStop(0.5, d), o.addColorStop(1, d), o;
|
|
744
751
|
},
|
|
745
752
|
/**
|
|
746
753
|
* Draws a vertical colored bar on the left edge of the item bounds.
|
|
@@ -754,124 +761,124 @@ function ni(i, e) {
|
|
|
754
761
|
* Supported types: 'check', 'danger-red', 'danger-yellow'.
|
|
755
762
|
* Default size is 14px.
|
|
756
763
|
*/
|
|
757
|
-
icon(t, n,
|
|
764
|
+
icon(t, n, r, d = 14) {
|
|
758
765
|
i.save();
|
|
759
|
-
const
|
|
766
|
+
const o = d / 2;
|
|
760
767
|
if (t === "check") {
|
|
761
|
-
i.fillStyle = "#31c48d", i.beginPath(), i.arc(n +
|
|
762
|
-
const c = n +
|
|
763
|
-
i.moveTo(c -
|
|
768
|
+
i.fillStyle = "#31c48d", i.beginPath(), i.arc(n + o, r + o, o, 0, Math.PI * 2), i.fill(), i.strokeStyle = "#ffffff", i.lineWidth = d * 0.12, i.beginPath();
|
|
769
|
+
const c = n + o, l = r + o;
|
|
770
|
+
i.moveTo(c - o * 0.45, l), i.lineTo(c - o * 0.1, l + o * 0.42), i.lineTo(c + o * 0.45, l - o * 0.35), i.stroke();
|
|
764
771
|
} else if (t === "danger-red" || t === "danger-yellow") {
|
|
765
772
|
const c = t === "danger-red" ? "#EF5350" : "#FBBF24";
|
|
766
|
-
i.fillStyle = c, i.beginPath(), i.moveTo(n +
|
|
767
|
-
const
|
|
768
|
-
i.fillRect(
|
|
773
|
+
i.fillStyle = c, i.beginPath(), i.moveTo(n + o, r), i.lineTo(n + d, r + d), i.lineTo(n, r + d), i.closePath(), i.fill(), i.fillStyle = "#ffffff";
|
|
774
|
+
const l = d * 0.12, v = n + o - l / 2;
|
|
775
|
+
i.fillRect(v, r + d * 0.35, l, d * 0.35), i.beginPath(), i.arc(n + o, r + d * 0.82, l * 0.7, 0, Math.PI * 2), i.fill();
|
|
769
776
|
}
|
|
770
777
|
i.restore();
|
|
771
778
|
},
|
|
772
779
|
/**
|
|
773
780
|
* Draws a pill-shaped badge with centered white text on a colored background.
|
|
774
781
|
*/
|
|
775
|
-
badge(t, n,
|
|
776
|
-
i.save(), i.font =
|
|
777
|
-
const c = i.measureText(t).width,
|
|
778
|
-
i.fillStyle = d, i.beginPath(), i.roundRect(n,
|
|
782
|
+
badge(t, n, r, d) {
|
|
783
|
+
i.save(), i.font = qt;
|
|
784
|
+
const c = i.measureText(t).width, l = 8, C = 12 + 3 * 2, h = c + l * 2, f = C / 2;
|
|
785
|
+
i.fillStyle = d, i.beginPath(), i.roundRect(n, r, h, C, f), i.fill(), i.fillStyle = "#ffffff", i.textAlign = "center", i.textBaseline = "middle", i.fillText(t, n + h / 2, r + C / 2), i.restore();
|
|
779
786
|
}
|
|
780
787
|
};
|
|
781
788
|
}
|
|
782
|
-
class
|
|
783
|
-
draw(e, t, n,
|
|
784
|
-
const
|
|
789
|
+
class Ni {
|
|
790
|
+
draw(e, t, n, r, d, o, c, l, v, C, h, f, M, T) {
|
|
791
|
+
const m = (t.visibleTimeEnd - t.visibleTimeStart) * 0.1, E = t.visibleTimeStart - m, P = t.visibleTimeEnd + m, Y = d.query(E, P), y = /* @__PURE__ */ new Map();
|
|
785
792
|
for (let I = 0; I < n.length; I++)
|
|
786
793
|
y.set(n[I].id, I);
|
|
787
|
-
const
|
|
788
|
-
for (const I of
|
|
789
|
-
const
|
|
790
|
-
if (
|
|
794
|
+
const H = new Set(C), w = /* @__PURE__ */ new Map(), $ = -t.lineHeight, B = t.canvasHeight + t.lineHeight;
|
|
795
|
+
for (const I of Y) {
|
|
796
|
+
const x = y.get(I.group);
|
|
797
|
+
if (x === void 0)
|
|
791
798
|
continue;
|
|
792
|
-
const
|
|
793
|
-
if (!
|
|
799
|
+
const _ = o.getLayout(I.id);
|
|
800
|
+
if (!_)
|
|
794
801
|
continue;
|
|
795
|
-
const
|
|
796
|
-
if (
|
|
802
|
+
const U = t.groupIndexToY(x) + _.stackLevel * t.lineHeight + (t.lineHeight - _.itemHeight) / 2, J = _.itemHeight;
|
|
803
|
+
if (U + J < $ || U > B)
|
|
797
804
|
continue;
|
|
798
|
-
const
|
|
799
|
-
w.set(I.id,
|
|
800
|
-
const
|
|
801
|
-
selected:
|
|
802
|
-
hovered:
|
|
805
|
+
const he = t.timeToX(I.start_time), ve = t.timeToX(I.end_time) - he, be = { x: he, y: U, width: ve, height: J };
|
|
806
|
+
w.set(I.id, be);
|
|
807
|
+
const Pe = {
|
|
808
|
+
selected: H.has(I.id),
|
|
809
|
+
hovered: h === I.id,
|
|
803
810
|
dragging: !1,
|
|
804
811
|
filtered: I.filtered !== !1
|
|
805
812
|
};
|
|
806
813
|
e.save();
|
|
807
|
-
const qe =
|
|
808
|
-
let
|
|
809
|
-
M && (T != null && T.isParent(I.id)) ?
|
|
814
|
+
const qe = si(e, be);
|
|
815
|
+
let Ee;
|
|
816
|
+
M && (T != null && T.isParent(I.id)) ? Ee = M : l && (I.type === "control_area_group" || I.type === "construction_train") ? Ee = l : Ee = c, Ee(e, I, be, Pe, qe), e.restore();
|
|
810
817
|
}
|
|
811
818
|
if (f && f.length > 0) {
|
|
812
819
|
const I = /* @__PURE__ */ new Set();
|
|
813
|
-
for (const
|
|
814
|
-
w.has(
|
|
820
|
+
for (const x of f)
|
|
821
|
+
w.has(x.fromItemId) || I.add(x.fromItemId), w.has(x.toItemId) || I.add(x.toItemId);
|
|
815
822
|
if (I.size > 0) {
|
|
816
|
-
const
|
|
817
|
-
for (const
|
|
818
|
-
I.has(
|
|
819
|
-
for (const [
|
|
820
|
-
const
|
|
821
|
-
if (
|
|
823
|
+
const x = /* @__PURE__ */ new Map();
|
|
824
|
+
for (const _ of r)
|
|
825
|
+
I.has(_.id) && x.set(_.id, _);
|
|
826
|
+
for (const [_, ee] of x) {
|
|
827
|
+
const U = y.get(ee.group);
|
|
828
|
+
if (U === void 0)
|
|
822
829
|
continue;
|
|
823
|
-
const
|
|
824
|
-
if (!
|
|
830
|
+
const J = o.getLayout(_);
|
|
831
|
+
if (!J)
|
|
825
832
|
continue;
|
|
826
|
-
const
|
|
827
|
-
w.set(
|
|
833
|
+
const ve = t.groupIndexToY(U) + J.stackLevel * t.lineHeight + (t.lineHeight - J.itemHeight) / 2, be = t.timeToX(ee.start_time), Pe = t.timeToX(ee.end_time) - be;
|
|
834
|
+
w.set(_, { x: be, y: ve, width: Pe, height: J.itemHeight });
|
|
828
835
|
}
|
|
829
836
|
}
|
|
830
|
-
this.drawDependencies(e, f, w,
|
|
837
|
+
this.drawDependencies(e, f, w, h, v);
|
|
831
838
|
}
|
|
832
839
|
}
|
|
833
|
-
drawDependencies(e, t, n,
|
|
834
|
-
for (const
|
|
835
|
-
const c = n.get(
|
|
836
|
-
if (!c || !
|
|
840
|
+
drawDependencies(e, t, n, r, d) {
|
|
841
|
+
for (const o of t) {
|
|
842
|
+
const c = n.get(o.fromItemId), l = n.get(o.toItemId);
|
|
843
|
+
if (!c || !l)
|
|
837
844
|
continue;
|
|
838
|
-
const
|
|
839
|
-
e.strokeStyle =
|
|
840
|
-
const
|
|
841
|
-
e.beginPath(), e.moveTo(
|
|
845
|
+
const v = r === o.fromItemId || r === o.toItemId;
|
|
846
|
+
e.strokeStyle = v ? d.primary : o.color ?? "#94A3B8", e.lineWidth = v ? 2 : 1.5, e.setLineDash([]);
|
|
847
|
+
const C = c.x + c.width, h = c.y + c.height / 2, f = l.x, M = l.y + l.height / 2, T = Math.abs(f - C), m = Math.max(T * 0.4, 30);
|
|
848
|
+
e.beginPath(), e.moveTo(C, h), e.bezierCurveTo(C + m, h, f - m, M, f, M), e.stroke();
|
|
842
849
|
const E = 6;
|
|
843
850
|
e.fillStyle = e.strokeStyle, e.beginPath(), e.moveTo(f, M), e.lineTo(f - E, M - E / 2), e.lineTo(f - E, M + E / 2), e.closePath(), e.fill();
|
|
844
851
|
}
|
|
845
852
|
}
|
|
846
853
|
}
|
|
847
|
-
class
|
|
848
|
-
draw(e, t, n,
|
|
849
|
-
const { cursorX: d, snapX:
|
|
854
|
+
class Ui {
|
|
855
|
+
draw(e, t, n, r) {
|
|
856
|
+
const { cursorX: d, snapX: o, markers: c, interaction: l } = r;
|
|
850
857
|
if (c)
|
|
851
|
-
for (const
|
|
852
|
-
const
|
|
853
|
-
if (e.fillStyle =
|
|
858
|
+
for (const v of c) {
|
|
859
|
+
const C = t.timeToX(v.date);
|
|
860
|
+
if (e.fillStyle = v.color, e.fillRect(C - v.width / 2, 0, v.width, t.canvasHeight), v.label) {
|
|
854
861
|
e.save(), e.font = '500 10px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
855
|
-
const
|
|
856
|
-
e.fillStyle =
|
|
857
|
-
const
|
|
858
|
-
e.fillText(y, E + f, P +
|
|
862
|
+
const h = e.measureText(v.label).width, f = 8, M = 200, T = Math.min(h + f * 2, M), m = 20, E = C - T / 2, P = 4;
|
|
863
|
+
e.fillStyle = v.color, e.beginPath(), e.roundRect(E, P, T, m, 3), e.fill(), e.fillStyle = "#FFFFFF", e.textBaseline = "middle";
|
|
864
|
+
const Y = M - f * 2, y = h > Y ? v.label.slice(0, Math.floor(v.label.length * Y / h)) + "…" : v.label;
|
|
865
|
+
e.fillText(y, E + f, P + m / 2), e.restore();
|
|
859
866
|
}
|
|
860
867
|
}
|
|
861
|
-
if (d != null && (e.strokeStyle = n.marker.cursor, e.lineWidth = 1, e.beginPath(), e.moveTo(d, 0), e.lineTo(d, t.canvasHeight), e.stroke()),
|
|
862
|
-
|
|
863
|
-
const
|
|
864
|
-
|
|
868
|
+
if (d != null && (e.strokeStyle = n.marker.cursor, e.lineWidth = 1, e.beginPath(), e.moveTo(d, 0), e.lineTo(d, t.canvasHeight), e.stroke()), o != null && (e.strokeStyle = n.primary, e.lineWidth = 1, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(o, 0), e.lineTo(o, t.canvasHeight), e.stroke(), e.setLineDash([])), l) {
|
|
869
|
+
l.groupChanged && l.targetGroupY !== void 0 && (e.fillStyle = "rgba(59, 130, 246, 0.08)", e.fillRect(0, l.targetGroupY, t.canvasWidth, t.lineHeight)), e.save(), e.globalAlpha = 0.5;
|
|
870
|
+
const v = si(e, l.bounds);
|
|
871
|
+
l.renderer(e, l.item, l.bounds, { selected: !1, hovered: !1, dragging: !0, filtered: !0 }, v), e.restore();
|
|
865
872
|
}
|
|
866
873
|
}
|
|
867
874
|
}
|
|
868
|
-
const
|
|
869
|
-
function
|
|
875
|
+
const Kt = 120;
|
|
876
|
+
function Zi(i) {
|
|
870
877
|
let e = i.deltaY || i.deltaX;
|
|
871
|
-
return i.deltaMode === 1 ? e *= 15 : i.deltaMode === 2 && (e *= 800), Math.max(-
|
|
878
|
+
return i.deltaMode === 1 ? e *= 15 : i.deltaMode === 2 && (e *= 800), Math.max(-Kt, Math.min(Kt, e));
|
|
872
879
|
}
|
|
873
|
-
class
|
|
874
|
-
constructor(e, t, n,
|
|
880
|
+
class Vi {
|
|
881
|
+
constructor(e, t, n, r, d) {
|
|
875
882
|
Object.defineProperty(this, "onZoom", {
|
|
876
883
|
enumerable: !0,
|
|
877
884
|
configurable: !0,
|
|
@@ -897,21 +904,21 @@ class xi {
|
|
|
897
904
|
configurable: !0,
|
|
898
905
|
writable: !0,
|
|
899
906
|
value: void 0
|
|
900
|
-
}), this.onZoom = e, this.visibleTimeStart = t, this.visibleTimeEnd = n, this.minZoom =
|
|
907
|
+
}), this.onZoom = e, this.visibleTimeStart = t, this.visibleTimeEnd = n, this.minZoom = r, this.maxZoom = d;
|
|
901
908
|
}
|
|
902
909
|
updateBounds(e, t) {
|
|
903
910
|
this.visibleTimeStart = e, this.visibleTimeEnd = t;
|
|
904
911
|
}
|
|
905
912
|
handleWheelZoom(e, t) {
|
|
906
|
-
const n =
|
|
907
|
-
let c = Math.round(
|
|
913
|
+
const n = Zi(e), r = e.ctrlKey ? 10 : e.metaKey ? 3 : 1, d = n > 0 ? 1 + r * n / 500 : 1 / (1 + r * -n / 500), o = this.visibleTimeEnd - this.visibleTimeStart;
|
|
914
|
+
let c = Math.round(o * d);
|
|
908
915
|
c = Math.max(this.minZoom, Math.min(this.maxZoom, c));
|
|
909
|
-
const
|
|
910
|
-
this.onZoom(
|
|
916
|
+
const l = Math.round(this.visibleTimeStart + (o - c) * t), v = l + c;
|
|
917
|
+
this.onZoom(l, v);
|
|
911
918
|
}
|
|
912
919
|
}
|
|
913
|
-
const
|
|
914
|
-
class
|
|
920
|
+
const qi = 4;
|
|
921
|
+
class Ki {
|
|
915
922
|
constructor(e) {
|
|
916
923
|
Object.defineProperty(this, "state", {
|
|
917
924
|
enumerable: !0,
|
|
@@ -930,21 +937,21 @@ class ji {
|
|
|
930
937
|
value: !1
|
|
931
938
|
}), this.dragSnap = e;
|
|
932
939
|
}
|
|
933
|
-
startInteraction(e, t, n,
|
|
940
|
+
startInteraction(e, t, n, r) {
|
|
934
941
|
this.state = {
|
|
935
942
|
item: e,
|
|
936
943
|
mode: t,
|
|
937
944
|
startX: n,
|
|
938
|
-
startY:
|
|
945
|
+
startY: r,
|
|
939
946
|
currentX: n,
|
|
940
|
-
currentY:
|
|
947
|
+
currentY: r,
|
|
941
948
|
deltaX: 0,
|
|
942
949
|
originalGroup: e.group,
|
|
943
950
|
currentGroup: e.group
|
|
944
951
|
}, this.activated = !1;
|
|
945
952
|
}
|
|
946
953
|
update(e, t) {
|
|
947
|
-
this.state && (this.state.currentX = e, this.state.currentY = t, this.state.deltaX = e - this.state.startX, !this.activated && Math.abs(this.state.deltaX) >=
|
|
954
|
+
this.state && (this.state.currentX = e, this.state.currentY = t, this.state.deltaX = e - this.state.startX, !this.activated && Math.abs(this.state.deltaX) >= qi && (this.activated = !0));
|
|
948
955
|
}
|
|
949
956
|
setCurrentGroup(e) {
|
|
950
957
|
this.state && (this.state.currentGroup = e);
|
|
@@ -952,14 +959,14 @@ class ji {
|
|
|
952
959
|
endMove(e) {
|
|
953
960
|
if (!this.state)
|
|
954
961
|
return null;
|
|
955
|
-
const t = this.state.deltaX / e, n = this.state.item.start_time + t,
|
|
956
|
-
return this.state = null, this.activated = !1, { newStartTime:
|
|
962
|
+
const t = this.state.deltaX / e, n = this.state.item.start_time + t, r = Math.round(n / this.dragSnap) * this.dragSnap, d = this.state.currentGroup;
|
|
963
|
+
return this.state = null, this.activated = !1, { newStartTime: r, newGroupId: d };
|
|
957
964
|
}
|
|
958
965
|
endResize(e) {
|
|
959
966
|
if (!this.state)
|
|
960
967
|
return null;
|
|
961
|
-
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,
|
|
962
|
-
return this.state = null, this.activated = !1, { newTime:
|
|
968
|
+
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, o = Math.round(d / this.dragSnap) * this.dragSnap;
|
|
969
|
+
return this.state = null, this.activated = !1, { newTime: o, edge: n };
|
|
963
970
|
}
|
|
964
971
|
cancel() {
|
|
965
972
|
this.state = null, this.activated = !1;
|
|
@@ -978,85 +985,106 @@ class ji {
|
|
|
978
985
|
return this.state !== null;
|
|
979
986
|
}
|
|
980
987
|
}
|
|
981
|
-
function
|
|
988
|
+
function kt(i, e, t) {
|
|
982
989
|
const n = [];
|
|
983
|
-
for (const
|
|
984
|
-
|
|
990
|
+
for (const r of i)
|
|
991
|
+
r.id !== e && (n.push(t(r.start_time)), n.push(t(r.end_time)));
|
|
985
992
|
return n;
|
|
986
993
|
}
|
|
987
|
-
function st(i, e, t, n,
|
|
994
|
+
function st(i, e, t, n, r) {
|
|
988
995
|
if (e.length === 0)
|
|
989
996
|
return null;
|
|
990
|
-
let d = e[0],
|
|
997
|
+
let d = e[0], o = Math.abs(i - d);
|
|
991
998
|
for (let c = 1; c < e.length; c++) {
|
|
992
|
-
const
|
|
993
|
-
|
|
999
|
+
const l = Math.abs(i - e[c]);
|
|
1000
|
+
l < o && (o = l, d = e[c]);
|
|
994
1001
|
}
|
|
995
|
-
return
|
|
1002
|
+
return o <= t ? d : null;
|
|
996
1003
|
}
|
|
997
|
-
|
|
1004
|
+
function li(i, e, t) {
|
|
1005
|
+
const n = t.canvasWidth / (e.visibleTimeEnd - e.visibleTimeStart), r = i.deltaX / n, d = i.item.start_time + r, o = (e.visibleTimeEnd - e.visibleTimeStart) * 0.1, c = t.intervalTree.query(e.visibleTimeStart - o, e.visibleTimeEnd + o), l = kt(c, i.item.id, (h) => e.timeToX(h)), v = st(e.timeToX(d), l, 8, n, t.dragSnap);
|
|
1006
|
+
if (v !== null)
|
|
1007
|
+
return e.xToTime(v);
|
|
1008
|
+
const C = st(e.timeToX(i.item.end_time + r), l, 8, n, t.dragSnap);
|
|
1009
|
+
return C !== null ? e.xToTime(C) - (i.item.end_time - i.item.start_time) : Math.round(d / t.dragSnap) * t.dragSnap;
|
|
1010
|
+
}
|
|
1011
|
+
function ai(i, e, t) {
|
|
1012
|
+
const n = t.canvasWidth / (e.visibleTimeEnd - e.visibleTimeStart), r = i.deltaX / n, d = i.mode === "resize-left" ? "left" : "right", o = (d === "left" ? i.item.start_time : i.item.end_time) + r, c = (e.visibleTimeEnd - e.visibleTimeStart) * 0.1, l = t.intervalTree.query(e.visibleTimeStart - c, e.visibleTimeEnd + c), v = kt(l, i.item.id, (M) => e.timeToX(M)), C = st(e.timeToX(o), v, 8, n, t.dragSnap);
|
|
1013
|
+
let h = C !== null ? e.xToTime(C) : Math.round(o / t.dragSnap) * t.dragSnap;
|
|
1014
|
+
const f = t.hierarchyEngine.getResizeConstraint(i.item.id, d);
|
|
1015
|
+
return d === "left" && h > f.max ? h = f.max : d === "right" && h < f.min && (h = f.min), { edge: d, time: h };
|
|
1016
|
+
}
|
|
1017
|
+
function Ji(i, e, t, n) {
|
|
1018
|
+
if (i.mode === "move") {
|
|
1019
|
+
const l = li(i, e, t), v = i.item.end_time - i.item.start_time;
|
|
1020
|
+
return { itemId: i.item.id, mode: "move", time: l, startTime: l, endTime: l + v, pointerX: n.x, pointerY: n.y };
|
|
1021
|
+
}
|
|
1022
|
+
const { edge: r, time: d } = ai(i, e, t), o = r === "left" ? d : i.item.start_time, c = r === "right" ? d : i.item.end_time;
|
|
1023
|
+
return { itemId: i.item.id, mode: i.mode, edge: r, time: d, startTime: o, endTime: c, pointerX: n.x, pointerY: n.y };
|
|
1024
|
+
}
|
|
1025
|
+
var ui = { exports: {} };
|
|
998
1026
|
(function(i, e) {
|
|
999
1027
|
(function(t, n) {
|
|
1000
1028
|
i.exports = n();
|
|
1001
1029
|
})(lt, function() {
|
|
1002
1030
|
var t = "day";
|
|
1003
|
-
return function(n,
|
|
1004
|
-
var
|
|
1005
|
-
return
|
|
1006
|
-
}, c =
|
|
1031
|
+
return function(n, r, d) {
|
|
1032
|
+
var o = function(v) {
|
|
1033
|
+
return v.add(4 - v.isoWeekday(), t);
|
|
1034
|
+
}, c = r.prototype;
|
|
1007
1035
|
c.isoWeekYear = function() {
|
|
1008
|
-
return
|
|
1009
|
-
}, c.isoWeek = function(
|
|
1010
|
-
if (!this.$utils().u(
|
|
1011
|
-
var
|
|
1012
|
-
return T.diff(
|
|
1013
|
-
}, c.isoWeekday = function(
|
|
1014
|
-
return this.$utils().u(
|
|
1036
|
+
return o(this).year();
|
|
1037
|
+
}, c.isoWeek = function(v) {
|
|
1038
|
+
if (!this.$utils().u(v)) return this.add(7 * (v - this.isoWeek()), t);
|
|
1039
|
+
var C, h, f, M, T = o(this), m = (C = this.isoWeekYear(), h = this.$u, f = (h ? d.utc : d)().year(C).startOf("year"), M = 4 - f.isoWeekday(), f.isoWeekday() > 4 && (M += 7), f.add(M, t));
|
|
1040
|
+
return T.diff(m, "week") + 1;
|
|
1041
|
+
}, c.isoWeekday = function(v) {
|
|
1042
|
+
return this.$utils().u(v) ? this.day() || 7 : this.day(this.day() % 7 ? v : v - 7);
|
|
1015
1043
|
};
|
|
1016
|
-
var
|
|
1017
|
-
c.startOf = function(
|
|
1018
|
-
var
|
|
1019
|
-
return
|
|
1044
|
+
var l = c.startOf;
|
|
1045
|
+
c.startOf = function(v, C) {
|
|
1046
|
+
var h = this.$utils(), f = !!h.u(C) || C;
|
|
1047
|
+
return h.p(v) === "isoweek" ? f ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : l.bind(this)(v, C);
|
|
1020
1048
|
};
|
|
1021
1049
|
};
|
|
1022
1050
|
});
|
|
1023
|
-
})(
|
|
1024
|
-
var
|
|
1025
|
-
const
|
|
1026
|
-
function
|
|
1051
|
+
})(ui);
|
|
1052
|
+
var Qi = ui.exports;
|
|
1053
|
+
const en = /* @__PURE__ */ at(Qi), Jt = 200;
|
|
1054
|
+
function Qt({ groups: i, width: e, lineHeight: t, groupHeights: n, scrollTop: r, canvasHeight: d, theme: o, groupRenderer: c, onScroll: l }) {
|
|
1027
1055
|
var y;
|
|
1028
|
-
const
|
|
1029
|
-
const
|
|
1030
|
-
|
|
1056
|
+
const v = A(null), C = A(!1), h = K(() => {
|
|
1057
|
+
const H = new Array(i.length + 1);
|
|
1058
|
+
H[0] = 0;
|
|
1031
1059
|
for (let w = 0; w < i.length; w++)
|
|
1032
|
-
|
|
1033
|
-
return
|
|
1034
|
-
}, [i.length, n, t]), f =
|
|
1035
|
-
if (i.length === 0 ||
|
|
1060
|
+
H[w + 1] = H[w] + ((n == null ? void 0 : n[w]) ?? t);
|
|
1061
|
+
return H;
|
|
1062
|
+
}, [i.length, n, t]), f = h[i.length] ?? 0, M = d, T = Q((H) => {
|
|
1063
|
+
if (i.length === 0 || H <= 0)
|
|
1036
1064
|
return 0;
|
|
1037
|
-
if (
|
|
1065
|
+
if (H >= f)
|
|
1038
1066
|
return i.length - 1;
|
|
1039
1067
|
let w = 0, $ = i.length - 1;
|
|
1040
1068
|
for (; w < $; ) {
|
|
1041
1069
|
const B = w + $ >>> 1;
|
|
1042
|
-
|
|
1070
|
+
h[B + 1] > H ? $ = B : w = B + 1;
|
|
1043
1071
|
}
|
|
1044
1072
|
return w;
|
|
1045
|
-
}, [i.length,
|
|
1046
|
-
|
|
1047
|
-
}, [
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1073
|
+
}, [i.length, h, f]), m = T(r - Jt), E = T(r + d + Jt), P = Q((H) => {
|
|
1074
|
+
C.current || l(H.currentTarget.scrollTop);
|
|
1075
|
+
}, [l]);
|
|
1076
|
+
le(() => {
|
|
1077
|
+
v.current && (C.current = !0, v.current.scrollTop = r, requestAnimationFrame(() => {
|
|
1078
|
+
C.current = !1;
|
|
1051
1079
|
}));
|
|
1052
|
-
}, [
|
|
1053
|
-
const
|
|
1054
|
-
for (let
|
|
1055
|
-
const w = i[
|
|
1080
|
+
}, [r]);
|
|
1081
|
+
const Y = [];
|
|
1082
|
+
for (let H = m; H <= E; H++) {
|
|
1083
|
+
const w = i[H];
|
|
1056
1084
|
if (!w)
|
|
1057
1085
|
continue;
|
|
1058
|
-
const $ =
|
|
1059
|
-
|
|
1086
|
+
const $ = h[H], B = h[H + 1] - $;
|
|
1087
|
+
Y.push(ne("div", { style: {
|
|
1060
1088
|
position: "absolute",
|
|
1061
1089
|
top: $,
|
|
1062
1090
|
height: B,
|
|
@@ -1064,35 +1092,35 @@ function qt({ groups: i, width: e, lineHeight: t, groupHeights: n, scrollTop: o,
|
|
|
1064
1092
|
overflow: "hidden",
|
|
1065
1093
|
display: "flex",
|
|
1066
1094
|
alignItems: "stretch",
|
|
1067
|
-
borderBottom: `1px solid ${((y =
|
|
1095
|
+
borderBottom: `1px solid ${((y = o.grid) == null ? void 0 : y.line) ?? "#E5E5E5"}`,
|
|
1068
1096
|
boxSizing: "border-box"
|
|
1069
1097
|
}, children: c(w) }, w.id));
|
|
1070
1098
|
}
|
|
1071
|
-
return
|
|
1099
|
+
return ne("div", { ref: v, onScroll: P, style: {
|
|
1072
1100
|
width: e,
|
|
1073
1101
|
height: M,
|
|
1074
1102
|
overflowY: f > d ? "auto" : "hidden",
|
|
1075
1103
|
overflowX: "hidden",
|
|
1076
1104
|
position: "relative",
|
|
1077
|
-
borderRight: `1px solid ${
|
|
1078
|
-
backgroundColor:
|
|
1079
|
-
}, children:
|
|
1105
|
+
borderRight: `1px solid ${o.sidebar.border}`,
|
|
1106
|
+
backgroundColor: o.sidebar.bg
|
|
1107
|
+
}, children: ne("div", { style: { height: f, position: "relative" }, children: Y }) });
|
|
1080
1108
|
}
|
|
1081
|
-
function
|
|
1109
|
+
function tn(i) {
|
|
1082
1110
|
return null;
|
|
1083
1111
|
}
|
|
1084
|
-
|
|
1085
|
-
function
|
|
1112
|
+
tn.displayName = "TodayMarker";
|
|
1113
|
+
function ei(i) {
|
|
1086
1114
|
return { date: Math.floor(Date.now() / 6e4) * 6e4, color: i.color ?? "#FD7171", width: i.width ?? 6, label: i.label };
|
|
1087
1115
|
}
|
|
1088
|
-
function
|
|
1116
|
+
function nn(i) {
|
|
1089
1117
|
return i.interval ?? 1e4;
|
|
1090
1118
|
}
|
|
1091
|
-
function
|
|
1119
|
+
function rn(i) {
|
|
1092
1120
|
return null;
|
|
1093
1121
|
}
|
|
1094
|
-
|
|
1095
|
-
function
|
|
1122
|
+
rn.displayName = "CustomMarker";
|
|
1123
|
+
function ti(i) {
|
|
1096
1124
|
return {
|
|
1097
1125
|
date: i.date,
|
|
1098
1126
|
color: i.color ?? "#3B82F6",
|
|
@@ -1100,583 +1128,569 @@ function Jt(i) {
|
|
|
1100
1128
|
label: i.label
|
|
1101
1129
|
};
|
|
1102
1130
|
}
|
|
1103
|
-
We.extend(
|
|
1104
|
-
function
|
|
1131
|
+
We.extend(en);
|
|
1132
|
+
function on(i) {
|
|
1105
1133
|
return i ? {
|
|
1106
|
-
...
|
|
1134
|
+
...Ce,
|
|
1107
1135
|
...i,
|
|
1108
|
-
status: { ...
|
|
1109
|
-
grid: { ...
|
|
1110
|
-
item: { ...
|
|
1111
|
-
marker: { ...
|
|
1112
|
-
sidebar: { ...
|
|
1113
|
-
header: { ...
|
|
1114
|
-
} :
|
|
1136
|
+
status: { ...Ce.status, ...i.status },
|
|
1137
|
+
grid: { ...Ce.grid, ...i.grid },
|
|
1138
|
+
item: { ...Ce.item, ...i.item },
|
|
1139
|
+
marker: { ...Ce.marker, ...i.marker },
|
|
1140
|
+
sidebar: { ...Ce.sidebar, ...i.sidebar },
|
|
1141
|
+
header: { ...Ce.header, ...i.header }
|
|
1142
|
+
} : Ce;
|
|
1115
1143
|
}
|
|
1116
|
-
const
|
|
1117
|
-
const { groups: n, items:
|
|
1118
|
-
for (let
|
|
1119
|
-
if (
|
|
1120
|
-
return
|
|
1144
|
+
const ii = 32, yn = ce.memo(Oi(function(e, t) {
|
|
1145
|
+
const { groups: n, items: r, defaultTimeStart: d, defaultTimeEnd: o, sidebarWidth: c, lineHeight: l, itemHeightRatio: v, stackItems: C, canMove: h, canChangeGroup: f, canResize: M, dragSnap: T, minZoom: m, maxZoom: E, theme: P, dayStyle: Y, rowStyle: y, showCursorLine: H, itemRenderer: w, groupRenderer: $, sidebarGroupRenderer: B, dependencies: I, highlights: x, onItemClick: _, onItemDoubleClick: ee, onItemContextMenu: U, onItemMove: J, onItemResize: he, moveResizeValidator: ve, onItemHover: be, onInteractionUpdate: Pe, onCanvasDoubleClick: qe, onCanvasContextMenu: Ee, onTimeChange: Ct, onZoom: Et, selected: Ht = [], rightSidebarWidth: ut, rightSidebarGroupRenderer: It, onReady: Ke, maxHeight: Be, timezone: Je, devBadge: di, children: Me } = e, ye = K(() => on(P), [P]), Dt = Q((s, a) => {
|
|
1146
|
+
for (let g = 0; g < a.length; g++)
|
|
1147
|
+
if (a[g].id === s)
|
|
1148
|
+
return g;
|
|
1121
1149
|
return 0;
|
|
1122
|
-
}, []),
|
|
1123
|
-
|
|
1124
|
-
const
|
|
1125
|
-
if (!
|
|
1150
|
+
}, []), fi = Ht.join(","), ct = K(() => Ht, [fi]), Rt = A(null), Ot = A(null), Pt = A(null), ze = A(null), Xt = A(null), $t = A(null), [hi, mi] = Ue(800), [gi, pi] = Ue(null);
|
|
1151
|
+
le(() => {
|
|
1152
|
+
const s = Xt.current;
|
|
1153
|
+
if (!s)
|
|
1126
1154
|
return;
|
|
1127
|
-
const
|
|
1128
|
-
const
|
|
1129
|
-
|
|
1155
|
+
const a = new ResizeObserver((g) => {
|
|
1156
|
+
const p = g[0];
|
|
1157
|
+
p && mi(p.contentRect.width);
|
|
1130
1158
|
});
|
|
1131
|
-
return
|
|
1132
|
-
}, []),
|
|
1133
|
-
const
|
|
1134
|
-
if (!
|
|
1159
|
+
return a.observe(s), () => a.disconnect();
|
|
1160
|
+
}, []), le(() => {
|
|
1161
|
+
const s = $t.current;
|
|
1162
|
+
if (!s || !Be)
|
|
1135
1163
|
return;
|
|
1136
|
-
const
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1164
|
+
const a = new ResizeObserver((g) => {
|
|
1165
|
+
const p = g[0];
|
|
1166
|
+
p && pi(p.contentRect.height);
|
|
1139
1167
|
});
|
|
1140
|
-
return
|
|
1168
|
+
return a.observe(s), () => a.disconnect();
|
|
1141
1169
|
}, [Be]);
|
|
1142
|
-
const
|
|
1143
|
-
const
|
|
1144
|
-
return
|
|
1145
|
-
}, [
|
|
1146
|
-
const
|
|
1147
|
-
return
|
|
1148
|
-
}, [
|
|
1149
|
-
const
|
|
1150
|
-
return
|
|
1151
|
-
}, [
|
|
1170
|
+
const we = Math.max(0, hi - c - (ut ?? 0)), He = K(() => {
|
|
1171
|
+
const s = new Yi();
|
|
1172
|
+
return s.rebuild(r), s;
|
|
1173
|
+
}, [r]), dt = K(() => {
|
|
1174
|
+
const s = new $i();
|
|
1175
|
+
return s.buildFromItems(r, (a) => He.getEffectiveSpan(a.id).start, (a) => He.getEffectiveSpan(a.id).end), s;
|
|
1176
|
+
}, [r, He]), Le = K(() => {
|
|
1177
|
+
const s = new _i(l, v);
|
|
1178
|
+
return s.computeLayout(r, C, He), s;
|
|
1179
|
+
}, [r, l, v, C, He]), Ie = K(() => n.map((s) => Le.getGroupHeight(s.id)), [n, Le]), Qe = K(() => Ie.reduce((s, a) => s + a, 0), [Ie]), _t = typeof Be == "number" ? Be : gi, me = _t ? Math.min(Qe, _t) : Qe, L = A(new Tt({
|
|
1152
1180
|
visibleTimeStart: e.visibleTimeStart ?? d,
|
|
1153
|
-
visibleTimeEnd: e.visibleTimeEnd ??
|
|
1154
|
-
canvasWidth:
|
|
1155
|
-
canvasHeight:
|
|
1181
|
+
visibleTimeEnd: e.visibleTimeEnd ?? o,
|
|
1182
|
+
canvasWidth: we,
|
|
1183
|
+
canvasHeight: me,
|
|
1156
1184
|
sidebarWidth: c,
|
|
1157
|
-
lineHeight:
|
|
1185
|
+
lineHeight: l,
|
|
1158
1186
|
groupCount: n.length,
|
|
1159
1187
|
buffer: e.buffer ?? 3,
|
|
1160
1188
|
scrollTop: 0,
|
|
1161
|
-
groupHeights:
|
|
1162
|
-
})), ft =
|
|
1163
|
-
const
|
|
1164
|
-
|
|
1165
|
-
}, []),
|
|
1166
|
-
Ae.current === null && (Ae.current = setTimeout(
|
|
1167
|
-
}, [
|
|
1168
|
-
|
|
1189
|
+
groupHeights: Ie
|
|
1190
|
+
})), ft = A(null), xe = A(void 0), Yt = A({ x: 0, y: 0 }), ht = A(!1), de = A(null), De = A(!1), Ft = 4, [Wt, vi] = Ue(e.visibleTimeStart ?? d), [Bt, bi] = Ue(e.visibleTimeEnd ?? o), [zt, et] = Ue(0), Ae = A(null), Xe = Q(() => {
|
|
1191
|
+
const s = L.current;
|
|
1192
|
+
vi(s.visibleTimeStart), bi(s.visibleTimeEnd), et(s.scrollTop), Ae.current = null;
|
|
1193
|
+
}, []), mt = Q(() => {
|
|
1194
|
+
Ae.current === null && (Ae.current = setTimeout(Xe, ii));
|
|
1195
|
+
}, [Xe]);
|
|
1196
|
+
le(() => () => {
|
|
1169
1197
|
Ae.current !== null && clearTimeout(Ae.current);
|
|
1170
1198
|
}, []);
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1173
|
-
}, [e.summaryRenderer,
|
|
1174
|
-
const
|
|
1175
|
-
return
|
|
1176
|
-
var
|
|
1177
|
-
if (!
|
|
1199
|
+
const Lt = K(() => e.summaryRenderer ? e.summaryRenderer : (s, a, g, p, u) => {
|
|
1200
|
+
Fi(s, a, g, p, u, ye);
|
|
1201
|
+
}, [e.summaryRenderer, ye]), $e = K(() => new Gi(), []), _e = K(() => new Ni(), []), Ye = K(() => new Ui(), []), ie = K(() => new Ki(T), [T]), tt = K(() => {
|
|
1202
|
+
const s = [];
|
|
1203
|
+
return ce.Children.forEach(Me, (a) => {
|
|
1204
|
+
var p;
|
|
1205
|
+
if (!ce.isValidElement(a))
|
|
1178
1206
|
return;
|
|
1179
|
-
const
|
|
1180
|
-
|
|
1181
|
-
}),
|
|
1182
|
-
}, [
|
|
1207
|
+
const g = (p = a.type) == null ? void 0 : p.displayName;
|
|
1208
|
+
g === "TodayMarker" ? s.push(ei(a.props)) : g === "CustomMarker" && s.push(ti(a.props));
|
|
1209
|
+
}), s;
|
|
1210
|
+
}, [Me]), it = K(() => tt.map((s) => `${s.date}|${s.color}|${s.width}|${s.label ?? ""}`).join(";"), [tt]), je = A(tt);
|
|
1183
1211
|
je.current = tt;
|
|
1184
|
-
const
|
|
1185
|
-
let
|
|
1186
|
-
return
|
|
1187
|
-
var
|
|
1188
|
-
if (!
|
|
1212
|
+
const gt = K(() => {
|
|
1213
|
+
let s = 0;
|
|
1214
|
+
return ce.Children.forEach(Me, (a) => {
|
|
1215
|
+
var p;
|
|
1216
|
+
if (!ce.isValidElement(a))
|
|
1189
1217
|
return;
|
|
1190
|
-
((
|
|
1191
|
-
}),
|
|
1192
|
-
}, [
|
|
1218
|
+
((p = a.type) == null ? void 0 : p.displayName) === "TodayMarker" && (s = nn(a.props));
|
|
1219
|
+
}), s;
|
|
1220
|
+
}, [Me]), j = A({
|
|
1193
1221
|
groups: n,
|
|
1194
|
-
items:
|
|
1222
|
+
items: r,
|
|
1195
1223
|
intervalTree: dt,
|
|
1196
|
-
layoutEngine:
|
|
1224
|
+
layoutEngine: Le,
|
|
1197
1225
|
itemRenderer: w,
|
|
1198
1226
|
groupRenderer: $,
|
|
1199
|
-
theme:
|
|
1227
|
+
theme: ye,
|
|
1200
1228
|
selected: ct,
|
|
1201
1229
|
dependencies: I,
|
|
1202
|
-
highlights:
|
|
1203
|
-
dayStyle:
|
|
1230
|
+
highlights: x,
|
|
1231
|
+
dayStyle: Y,
|
|
1204
1232
|
rowStyle: y,
|
|
1205
|
-
showCursorLine:
|
|
1206
|
-
canvasWidth:
|
|
1207
|
-
canvasHeight:
|
|
1208
|
-
lineHeight:
|
|
1209
|
-
itemHeightRatio:
|
|
1210
|
-
onTimeChange:
|
|
1211
|
-
onZoom:
|
|
1212
|
-
onItemHover:
|
|
1213
|
-
onItemClick:
|
|
1214
|
-
onItemDoubleClick:
|
|
1215
|
-
onItemContextMenu:
|
|
1216
|
-
onItemMove:
|
|
1217
|
-
onItemResize:
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1233
|
+
showCursorLine: H,
|
|
1234
|
+
canvasWidth: we,
|
|
1235
|
+
canvasHeight: me,
|
|
1236
|
+
lineHeight: l,
|
|
1237
|
+
itemHeightRatio: v,
|
|
1238
|
+
onTimeChange: Ct,
|
|
1239
|
+
onZoom: Et,
|
|
1240
|
+
onItemHover: be,
|
|
1241
|
+
onItemClick: _,
|
|
1242
|
+
onItemDoubleClick: ee,
|
|
1243
|
+
onItemContextMenu: U,
|
|
1244
|
+
onItemMove: J,
|
|
1245
|
+
onItemResize: he,
|
|
1246
|
+
onInteractionUpdate: Pe,
|
|
1247
|
+
onCanvasDoubleClick: qe,
|
|
1248
|
+
onCanvasContextMenu: Ee,
|
|
1249
|
+
canMove: h,
|
|
1221
1250
|
canResize: M,
|
|
1222
1251
|
canChangeGroup: f,
|
|
1223
1252
|
dragSnap: T,
|
|
1224
1253
|
sidebarWidth: c,
|
|
1225
|
-
moveResizeValidator:
|
|
1226
|
-
summaryRenderer:
|
|
1227
|
-
hierarchyEngine:
|
|
1254
|
+
moveResizeValidator: ve,
|
|
1255
|
+
summaryRenderer: Lt,
|
|
1256
|
+
hierarchyEngine: He,
|
|
1228
1257
|
timezone: Je
|
|
1229
1258
|
});
|
|
1230
|
-
|
|
1259
|
+
j.current = {
|
|
1231
1260
|
groups: n,
|
|
1232
|
-
items:
|
|
1261
|
+
items: r,
|
|
1233
1262
|
intervalTree: dt,
|
|
1234
|
-
layoutEngine:
|
|
1263
|
+
layoutEngine: Le,
|
|
1235
1264
|
itemRenderer: w,
|
|
1236
1265
|
groupRenderer: $,
|
|
1237
|
-
theme:
|
|
1266
|
+
theme: ye,
|
|
1238
1267
|
selected: ct,
|
|
1239
1268
|
dependencies: I,
|
|
1240
|
-
highlights:
|
|
1241
|
-
dayStyle:
|
|
1269
|
+
highlights: x,
|
|
1270
|
+
dayStyle: Y,
|
|
1242
1271
|
rowStyle: y,
|
|
1243
|
-
showCursorLine:
|
|
1244
|
-
canvasWidth:
|
|
1245
|
-
canvasHeight:
|
|
1246
|
-
lineHeight:
|
|
1247
|
-
itemHeightRatio:
|
|
1248
|
-
onTimeChange:
|
|
1249
|
-
onZoom:
|
|
1250
|
-
onItemHover:
|
|
1251
|
-
onItemClick:
|
|
1252
|
-
onItemDoubleClick:
|
|
1253
|
-
onItemContextMenu:
|
|
1254
|
-
onItemMove:
|
|
1255
|
-
onItemResize:
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1272
|
+
showCursorLine: H,
|
|
1273
|
+
canvasWidth: we,
|
|
1274
|
+
canvasHeight: me,
|
|
1275
|
+
lineHeight: l,
|
|
1276
|
+
itemHeightRatio: v,
|
|
1277
|
+
onTimeChange: Ct,
|
|
1278
|
+
onZoom: Et,
|
|
1279
|
+
onItemHover: be,
|
|
1280
|
+
onItemClick: _,
|
|
1281
|
+
onItemDoubleClick: ee,
|
|
1282
|
+
onItemContextMenu: U,
|
|
1283
|
+
onItemMove: J,
|
|
1284
|
+
onItemResize: he,
|
|
1285
|
+
onInteractionUpdate: Pe,
|
|
1286
|
+
onCanvasDoubleClick: qe,
|
|
1287
|
+
onCanvasContextMenu: Ee,
|
|
1288
|
+
canMove: h,
|
|
1259
1289
|
canResize: M,
|
|
1260
1290
|
canChangeGroup: f,
|
|
1261
1291
|
dragSnap: T,
|
|
1262
1292
|
sidebarWidth: c,
|
|
1263
|
-
moveResizeValidator:
|
|
1264
|
-
summaryRenderer:
|
|
1265
|
-
hierarchyEngine:
|
|
1293
|
+
moveResizeValidator: ve,
|
|
1294
|
+
summaryRenderer: Lt,
|
|
1295
|
+
hierarchyEngine: He,
|
|
1266
1296
|
timezone: Je
|
|
1267
1297
|
};
|
|
1268
|
-
const
|
|
1269
|
-
const
|
|
1270
|
-
if (!
|
|
1298
|
+
const yi = Q(() => {
|
|
1299
|
+
const s = Rt.current;
|
|
1300
|
+
if (!s)
|
|
1271
1301
|
return;
|
|
1272
|
-
const
|
|
1273
|
-
|
|
1274
|
-
}, [
|
|
1275
|
-
const
|
|
1276
|
-
if (!
|
|
1302
|
+
const a = j.current, g = Mt(s, a.canvasWidth, a.canvasHeight);
|
|
1303
|
+
wt(g, s), $e.draw(g, L.current, a.groups, a.theme, a.dayStyle, a.rowStyle, a.highlights, a.timezone);
|
|
1304
|
+
}, [$e]), Ti = Q(() => {
|
|
1305
|
+
const s = Ot.current;
|
|
1306
|
+
if (!s)
|
|
1277
1307
|
return;
|
|
1278
|
-
const
|
|
1279
|
-
|
|
1280
|
-
}, [
|
|
1281
|
-
const
|
|
1282
|
-
|
|
1283
|
-
const X = (
|
|
1284
|
-
for (const
|
|
1285
|
-
const
|
|
1286
|
-
if (
|
|
1287
|
-
return
|
|
1308
|
+
const a = j.current, g = Mt(s, a.canvasWidth, a.canvasHeight);
|
|
1309
|
+
wt(g, s), _e.draw(g, L.current, a.groups, a.items, a.intervalTree, a.layoutEngine, a.itemRenderer, a.groupRenderer, a.theme, a.selected, xe.current, a.dependencies, a.summaryRenderer, a.hierarchyEngine);
|
|
1310
|
+
}, [_e]), xt = Q((s, a, g) => {
|
|
1311
|
+
const p = L.current, u = j.current, b = u.canvasWidth / (p.visibleTimeEnd - p.visibleTimeStart), k = a / b, D = [];
|
|
1312
|
+
g === "move" ? (D.push(p.timeToX(s.start_time + k)), D.push(p.timeToX(s.end_time + k))) : g === "resize-left" ? D.push(p.timeToX(s.start_time + k)) : D.push(p.timeToX(s.end_time + k));
|
|
1313
|
+
const X = (p.visibleTimeEnd - p.visibleTimeStart) * 0.1, F = u.intervalTree.query(p.visibleTimeStart - X, p.visibleTimeEnd + X), W = kt(F, s.id, (V) => p.timeToX(V));
|
|
1314
|
+
for (const V of D) {
|
|
1315
|
+
const N = st(V, W, 8, b, u.dragSnap);
|
|
1316
|
+
if (N !== null)
|
|
1317
|
+
return N;
|
|
1288
1318
|
}
|
|
1289
|
-
const
|
|
1290
|
-
return
|
|
1291
|
-
}, []),
|
|
1292
|
-
const
|
|
1293
|
-
if (!
|
|
1319
|
+
const Z = g === "resize-right" ? s.end_time + k : s.start_time + k, oe = Math.round(Z / u.dragSnap) * u.dragSnap;
|
|
1320
|
+
return p.timeToX(oe);
|
|
1321
|
+
}, []), Si = Q(() => {
|
|
1322
|
+
const s = Pt.current;
|
|
1323
|
+
if (!s)
|
|
1294
1324
|
return;
|
|
1295
|
-
const
|
|
1296
|
-
|
|
1297
|
-
const
|
|
1298
|
-
let
|
|
1325
|
+
const a = j.current, g = Mt(s, a.canvasWidth, a.canvasHeight);
|
|
1326
|
+
wt(g, s);
|
|
1327
|
+
const p = L.current, u = ie.getState();
|
|
1328
|
+
let b = null;
|
|
1299
1329
|
if (u) {
|
|
1300
|
-
const k =
|
|
1301
|
-
let X,
|
|
1302
|
-
u.mode === "resize-left" ? (X = k + u.deltaX,
|
|
1303
|
-
const
|
|
1304
|
-
|
|
1330
|
+
const k = p.timeToX(u.item.start_time), D = p.timeToX(u.item.end_time) - k;
|
|
1331
|
+
let X, F;
|
|
1332
|
+
u.mode === "resize-left" ? (X = k + u.deltaX, F = D - u.deltaX) : u.mode === "resize-right" ? (X = k, F = D + u.deltaX) : (X = k + u.deltaX, F = D);
|
|
1333
|
+
const W = Dt(u.currentGroup, a.groups), Z = p.groupIndexToY(W), oe = u.currentGroup !== u.originalGroup;
|
|
1334
|
+
b = {
|
|
1305
1335
|
item: u.item,
|
|
1306
1336
|
mode: u.mode,
|
|
1307
|
-
bounds: { x: X, y:
|
|
1308
|
-
renderer:
|
|
1309
|
-
targetGroupY:
|
|
1310
|
-
groupChanged:
|
|
1337
|
+
bounds: { x: X, y: Z + (a.lineHeight - a.lineHeight * a.itemHeightRatio) / 2, width: F, height: a.lineHeight * a.itemHeightRatio },
|
|
1338
|
+
renderer: a.itemRenderer,
|
|
1339
|
+
targetGroupY: Z,
|
|
1340
|
+
groupChanged: oe
|
|
1311
1341
|
};
|
|
1312
1342
|
}
|
|
1313
|
-
|
|
1314
|
-
cursorX:
|
|
1315
|
-
snapX: u ?
|
|
1343
|
+
Ye.draw(g, p, a.theme, {
|
|
1344
|
+
cursorX: a.showCursorLine ? ft.current : null,
|
|
1345
|
+
snapX: u ? xt(u.item, u.deltaX, u.mode) : null,
|
|
1316
1346
|
markers: je.current,
|
|
1317
|
-
interaction:
|
|
1318
|
-
});
|
|
1319
|
-
}, [
|
|
1320
|
-
|
|
1321
|
-
|
|
1347
|
+
interaction: b
|
|
1348
|
+
}), a.onInteractionUpdate && (u ? (a.onInteractionUpdate(Ji(u, p, a, Yt.current)), ht.current = !0) : ht.current && (ht.current = !1, a.onInteractionUpdate(null)));
|
|
1349
|
+
}, [Ye, ie, xt, Dt]), pt = A(null);
|
|
1350
|
+
pt.current || (pt.current = new zi((s) => {
|
|
1351
|
+
s.grid && yi(), s.items && Ti(), s.overlay && Si();
|
|
1322
1352
|
}));
|
|
1323
|
-
const
|
|
1324
|
-
|
|
1325
|
-
if (!
|
|
1353
|
+
const R = pt.current;
|
|
1354
|
+
le(() => () => R.dispose(), [R]), le(() => {
|
|
1355
|
+
if (!gt)
|
|
1326
1356
|
return;
|
|
1327
|
-
const
|
|
1328
|
-
const
|
|
1329
|
-
|
|
1357
|
+
const s = setInterval(() => {
|
|
1358
|
+
const a = [];
|
|
1359
|
+
ce.Children.forEach(Me, (g) => {
|
|
1330
1360
|
var u;
|
|
1331
|
-
if (!
|
|
1361
|
+
if (!ce.isValidElement(g))
|
|
1332
1362
|
return;
|
|
1333
|
-
const
|
|
1334
|
-
|
|
1335
|
-
}), je.current =
|
|
1336
|
-
},
|
|
1337
|
-
return () => clearInterval(
|
|
1338
|
-
}, [
|
|
1363
|
+
const p = (u = g.type) == null ? void 0 : u.displayName;
|
|
1364
|
+
p === "TodayMarker" ? a.push(ei(g.props)) : p === "CustomMarker" && a.push(ti(g.props));
|
|
1365
|
+
}), je.current = a, R.markDirty("overlay");
|
|
1366
|
+
}, gt);
|
|
1367
|
+
return () => clearInterval(s);
|
|
1368
|
+
}, [gt, Me, R]), le(() => {
|
|
1339
1369
|
L.current.update({
|
|
1340
|
-
canvasWidth:
|
|
1341
|
-
canvasHeight:
|
|
1370
|
+
canvasWidth: we,
|
|
1371
|
+
canvasHeight: me,
|
|
1342
1372
|
sidebarWidth: c,
|
|
1343
|
-
lineHeight:
|
|
1373
|
+
lineHeight: l,
|
|
1344
1374
|
groupCount: n.length,
|
|
1345
|
-
groupHeights:
|
|
1346
|
-
}),
|
|
1347
|
-
}, [
|
|
1348
|
-
|
|
1349
|
-
}, [
|
|
1350
|
-
const nt =
|
|
1351
|
-
var
|
|
1352
|
-
return ((
|
|
1353
|
-
}, [e.highlights]),
|
|
1354
|
-
|
|
1355
|
-
nt !==
|
|
1356
|
-
}, [nt,
|
|
1357
|
-
const
|
|
1358
|
-
|
|
1359
|
-
it !==
|
|
1360
|
-
}, [it,
|
|
1361
|
-
const
|
|
1362
|
-
e.visibleTimeStart !== void 0 && e.visibleTimeStart !==
|
|
1363
|
-
const Ge =
|
|
1375
|
+
groupHeights: Ie
|
|
1376
|
+
}), R.markAllDirty();
|
|
1377
|
+
}, [we, me, c, l, n.length, Ie, R]), le(() => {
|
|
1378
|
+
R.markDirty("grid"), R.markDirty("items");
|
|
1379
|
+
}, [r, n, ct, ye, Y, y, dt, Le, R]);
|
|
1380
|
+
const nt = K(() => {
|
|
1381
|
+
var s;
|
|
1382
|
+
return ((s = e.highlights) == null ? void 0 : s.map((a) => `${a.start}|${a.end}|${a.color}|${a.label ?? ""}|${a.opacity ?? ""}`).join(";")) ?? "";
|
|
1383
|
+
}, [e.highlights]), At = A(nt);
|
|
1384
|
+
le(() => {
|
|
1385
|
+
nt !== At.current && (At.current = nt, R.markDirty("grid"));
|
|
1386
|
+
}, [nt, R]);
|
|
1387
|
+
const jt = A(it);
|
|
1388
|
+
le(() => {
|
|
1389
|
+
it !== jt.current && (jt.current = it, R.markDirty("overlay"));
|
|
1390
|
+
}, [it, R]);
|
|
1391
|
+
const Gt = A(e.visibleTimeStart), Nt = A(e.visibleTimeEnd);
|
|
1392
|
+
e.visibleTimeStart !== void 0 && e.visibleTimeStart !== Gt.current && (Gt.current = e.visibleTimeStart, L.current.update({ visibleTimeStart: e.visibleTimeStart }), R.markAllDirty()), e.visibleTimeEnd !== void 0 && e.visibleTimeEnd !== Nt.current && (Nt.current = e.visibleTimeEnd, L.current.update({ visibleTimeEnd: e.visibleTimeEnd }), R.markAllDirty());
|
|
1393
|
+
const Ge = A(null), vt = Q((s) => {
|
|
1364
1394
|
Ge.current === null && (Ge.current = setTimeout(() => {
|
|
1365
|
-
var
|
|
1395
|
+
var p, u;
|
|
1366
1396
|
Ge.current = null;
|
|
1367
|
-
const
|
|
1368
|
-
|
|
1369
|
-
},
|
|
1397
|
+
const a = L.current, g = j.current;
|
|
1398
|
+
s === "zoom" ? (p = g.onZoom) == null || p.call(g, a.visibleTimeStart, a.visibleTimeEnd) : (u = g.onTimeChange) == null || u.call(g, a.visibleTimeStart, a.visibleTimeEnd);
|
|
1399
|
+
}, ii));
|
|
1370
1400
|
}, []);
|
|
1371
|
-
|
|
1401
|
+
le(() => () => {
|
|
1372
1402
|
Ge.current !== null && clearTimeout(Ge.current);
|
|
1373
1403
|
}, []);
|
|
1374
|
-
const rt =
|
|
1375
|
-
var
|
|
1376
|
-
L.current.update({ visibleTimeStart:
|
|
1377
|
-
}, d,
|
|
1378
|
-
rt.current =
|
|
1379
|
-
const ot =
|
|
1380
|
-
const
|
|
1381
|
-
u !==
|
|
1382
|
-
}, [
|
|
1383
|
-
var k,
|
|
1384
|
-
const
|
|
1385
|
-
|
|
1386
|
-
}, [
|
|
1387
|
-
|
|
1388
|
-
const
|
|
1389
|
-
if (!
|
|
1404
|
+
const rt = A(null), bt = K(() => new Vi((s, a) => {
|
|
1405
|
+
var g;
|
|
1406
|
+
L.current.update({ visibleTimeStart: s, visibleTimeEnd: a }), (g = rt.current) == null || g.updateBounds(s, a), R.markAllDirty(), mt(), vt("zoom");
|
|
1407
|
+
}, d, o, m, E), []);
|
|
1408
|
+
rt.current = bt;
|
|
1409
|
+
const ot = Q((s) => {
|
|
1410
|
+
const a = L.current, g = a.getTotalHeight(), p = Math.max(0, g - a.canvasHeight), u = Math.max(0, Math.min(p, a.scrollTop + s));
|
|
1411
|
+
u !== a.scrollTop && (a.update({ scrollTop: u }), R.markDirty("grid"), R.markDirty("items"), R.markDirty("overlay"), et(u));
|
|
1412
|
+
}, [R]), Ne = Q((s) => {
|
|
1413
|
+
var k, D, X;
|
|
1414
|
+
const a = L.current, g = a.canvasWidth / (a.visibleTimeEnd - a.visibleTimeStart), p = s / g, u = a.visibleTimeStart + p, b = a.visibleTimeEnd + p;
|
|
1415
|
+
a.update({ visibleTimeStart: u, visibleTimeEnd: b }), (k = rt.current) == null || k.updateBounds(u, b), R.markAllDirty(), Xi(() => Xe()), (X = (D = j.current).onTimeChange) == null || X.call(D, u, b);
|
|
1416
|
+
}, [R, Xe]);
|
|
1417
|
+
le(() => {
|
|
1418
|
+
const s = ze.current;
|
|
1419
|
+
if (!s)
|
|
1390
1420
|
return;
|
|
1391
|
-
const
|
|
1392
|
-
if (
|
|
1393
|
-
|
|
1394
|
-
const
|
|
1395
|
-
|
|
1396
|
-
} else if (
|
|
1397
|
-
|
|
1421
|
+
const a = (g) => {
|
|
1422
|
+
if (g.ctrlKey || g.metaKey || g.altKey) {
|
|
1423
|
+
g.preventDefault();
|
|
1424
|
+
const p = s.getBoundingClientRect(), u = (g.clientX - p.left) / p.width;
|
|
1425
|
+
bt.handleWheelZoom(g, u);
|
|
1426
|
+
} else if (g.shiftKey)
|
|
1427
|
+
g.preventDefault(), Ne(g.deltaY || g.deltaX);
|
|
1398
1428
|
else {
|
|
1399
|
-
const
|
|
1400
|
-
|
|
1429
|
+
const p = g.deltaX;
|
|
1430
|
+
p !== 0 && Math.abs(p) > Math.abs(g.deltaY) ? (g.preventDefault(), Ne(p)) : g.deltaY !== 0 && (Qe > me && g.preventDefault(), ot(g.deltaY));
|
|
1401
1431
|
}
|
|
1402
1432
|
};
|
|
1403
|
-
return
|
|
1404
|
-
}, [
|
|
1405
|
-
const
|
|
1406
|
-
|
|
1407
|
-
const
|
|
1408
|
-
if (!
|
|
1433
|
+
return s.addEventListener("wheel", a, { passive: !1 }), () => s.removeEventListener("wheel", a);
|
|
1434
|
+
}, [bt, ot, Ne, Qe, me]);
|
|
1435
|
+
const ke = A({ lastDistance: null, lastCenter: null });
|
|
1436
|
+
le(() => {
|
|
1437
|
+
const s = ze.current;
|
|
1438
|
+
if (!s)
|
|
1409
1439
|
return;
|
|
1410
|
-
const
|
|
1411
|
-
k.touches.length === 2 && (k.preventDefault(),
|
|
1440
|
+
const a = (k, D) => Math.abs(k.clientX - D.clientX), g = (k, D, X) => (k.clientX + D.clientX) / 2 - X.left, p = (k) => {
|
|
1441
|
+
k.touches.length === 2 && (k.preventDefault(), ke.current.lastDistance = a(k.touches[0], k.touches[1]), ke.current.lastCenter = null);
|
|
1412
1442
|
}, u = (k) => {
|
|
1413
|
-
var
|
|
1414
|
-
if (k.touches.length === 2 &&
|
|
1443
|
+
var D;
|
|
1444
|
+
if (k.touches.length === 2 && ke.current.lastDistance !== null) {
|
|
1415
1445
|
k.preventDefault();
|
|
1416
|
-
const X =
|
|
1417
|
-
if (X !== 0 &&
|
|
1418
|
-
const
|
|
1419
|
-
let
|
|
1420
|
-
|
|
1421
|
-
const
|
|
1422
|
-
|
|
1446
|
+
const X = a(k.touches[0], k.touches[1]), F = s.getBoundingClientRect(), Z = g(k.touches[0], k.touches[1], F) / F.width;
|
|
1447
|
+
if (X !== 0 && ke.current.lastDistance !== 0) {
|
|
1448
|
+
const oe = ke.current.lastDistance / X, V = L.current, N = V.visibleTimeEnd - V.visibleTimeStart;
|
|
1449
|
+
let se = N * oe;
|
|
1450
|
+
se = Math.max(m, Math.min(E, se));
|
|
1451
|
+
const te = V.visibleTimeStart + N * Z, O = te - se * Z, S = te + se * (1 - Z);
|
|
1452
|
+
V.update({ visibleTimeStart: O, visibleTimeEnd: S }), (D = rt.current) == null || D.updateBounds(O, S), R.markAllDirty(), mt(), vt("zoom");
|
|
1423
1453
|
}
|
|
1424
|
-
|
|
1454
|
+
ke.current.lastDistance = X;
|
|
1425
1455
|
}
|
|
1426
|
-
},
|
|
1427
|
-
|
|
1456
|
+
}, b = () => {
|
|
1457
|
+
ke.current.lastDistance = null, ke.current.lastCenter = null;
|
|
1428
1458
|
};
|
|
1429
|
-
return
|
|
1430
|
-
|
|
1459
|
+
return s.addEventListener("touchstart", p, { passive: !1 }), s.addEventListener("touchmove", u, { passive: !1 }), s.addEventListener("touchend", b), () => {
|
|
1460
|
+
s.removeEventListener("touchstart", p), s.removeEventListener("touchmove", u), s.removeEventListener("touchend", b);
|
|
1431
1461
|
};
|
|
1432
|
-
}, [
|
|
1433
|
-
const
|
|
1462
|
+
}, [R, mt, vt]);
|
|
1463
|
+
const Mi = Q((s) => {
|
|
1434
1464
|
var X;
|
|
1435
|
-
const
|
|
1436
|
-
if (ft.current =
|
|
1437
|
-
const
|
|
1438
|
-
if (!
|
|
1439
|
-
const
|
|
1440
|
-
|
|
1465
|
+
const a = s.currentTarget, g = a.getBoundingClientRect(), p = s.clientX - g.left, u = s.clientY - g.top;
|
|
1466
|
+
if (ft.current = p, Yt.current = { x: s.clientX, y: s.clientY }, de.current) {
|
|
1467
|
+
const F = s.clientX - de.current.startX, W = s.clientY - de.current.startY;
|
|
1468
|
+
if (!De.current && (Math.abs(F) >= Ft || Math.abs(W) >= Ft) && (De.current = !0, a.style.cursor = "grabbing", a.setPointerCapture(s.pointerId)), De.current) {
|
|
1469
|
+
const Z = s.clientX - de.current.lastX, oe = s.clientY - de.current.lastY;
|
|
1470
|
+
de.current.lastX = s.clientX, de.current.lastY = s.clientY, Math.abs(Z) > 0 && Ne(-Z), Math.abs(oe) > 0 && ot(-oe);
|
|
1441
1471
|
}
|
|
1442
1472
|
return;
|
|
1443
1473
|
}
|
|
1444
1474
|
if (ie.isPending()) {
|
|
1445
|
-
if (ie.update(
|
|
1446
|
-
const
|
|
1447
|
-
if (
|
|
1448
|
-
const
|
|
1449
|
-
|
|
1475
|
+
if (ie.update(p, u), ie.isActive()) {
|
|
1476
|
+
const F = ie.getState();
|
|
1477
|
+
if (F && F.mode === "move" && j.current.canChangeGroup) {
|
|
1478
|
+
const W = St(u, L.current, j.current.groups);
|
|
1479
|
+
W && ie.setCurrentGroup(W.id);
|
|
1450
1480
|
}
|
|
1451
|
-
|
|
1481
|
+
R.markDirty("overlay");
|
|
1452
1482
|
}
|
|
1453
1483
|
return;
|
|
1454
1484
|
}
|
|
1455
|
-
|
|
1456
|
-
const
|
|
1457
|
-
if (
|
|
1458
|
-
const
|
|
1459
|
-
|
|
1485
|
+
j.current.showCursorLine && R.markDirty("overlay");
|
|
1486
|
+
const b = j.current, k = Ze(p, u, L.current, b.intervalTree, b.layoutEngine, b.groups), D = k == null ? void 0 : k.id;
|
|
1487
|
+
if (D !== xe.current && (xe.current = D, R.markDirty("items"), (X = b.onItemHover) == null || X.call(b, D ?? null, s.nativeEvent)), k) {
|
|
1488
|
+
const F = Zt(p, k, L.current), W = Vt(k, F, b.canResize, b.canMove);
|
|
1489
|
+
a.style.cursor = W === "resize-left" || W === "resize-right" ? "col-resize" : W === "move" ? "grab" : "default";
|
|
1460
1490
|
} else
|
|
1461
|
-
|
|
1462
|
-
}, [ie,
|
|
1463
|
-
const
|
|
1464
|
-
if (!
|
|
1465
|
-
|
|
1491
|
+
a.style.cursor = "default";
|
|
1492
|
+
}, [ie, R, Ne, ot]), wi = Q((s) => {
|
|
1493
|
+
const a = j.current, g = s.currentTarget.getBoundingClientRect(), p = s.clientX - g.left, u = s.clientY - g.top, b = Ze(p, u, L.current, a.intervalTree, a.layoutEngine, a.groups);
|
|
1494
|
+
if (!b) {
|
|
1495
|
+
de.current = { startX: s.clientX, startY: s.clientY, lastX: s.clientX, lastY: s.clientY }, De.current = !1;
|
|
1466
1496
|
return;
|
|
1467
1497
|
}
|
|
1468
|
-
const k =
|
|
1469
|
-
|
|
1470
|
-
}, [ie]),
|
|
1471
|
-
var k,
|
|
1472
|
-
const
|
|
1473
|
-
if (
|
|
1474
|
-
const
|
|
1475
|
-
if (
|
|
1498
|
+
const k = Zt(p, b, L.current), D = Vt(b, k, a.canResize, a.canMove);
|
|
1499
|
+
D && ie.startInteraction(b, D, p, u);
|
|
1500
|
+
}, [ie]), ki = Q((s) => {
|
|
1501
|
+
var k, D, X, F;
|
|
1502
|
+
const a = s.currentTarget;
|
|
1503
|
+
if (de.current) {
|
|
1504
|
+
const W = De.current;
|
|
1505
|
+
if (de.current = null, De.current = !1, a.style.cursor = "default", W)
|
|
1476
1506
|
return;
|
|
1477
1507
|
}
|
|
1478
1508
|
if (ie.isActive()) {
|
|
1479
|
-
const
|
|
1480
|
-
if (
|
|
1481
|
-
const
|
|
1482
|
-
if (
|
|
1483
|
-
const Z = ie.endMove(
|
|
1484
|
-
if (
|
|
1485
|
-
const
|
|
1486
|
-
|
|
1487
|
-
const G = st(j, re, 8, q, S.dragSnap);
|
|
1488
|
-
if (G !== null)
|
|
1489
|
-
V = C.xToTime(G);
|
|
1490
|
-
else {
|
|
1491
|
-
const fe = st(he, re, 8, q, S.dragSnap);
|
|
1492
|
-
if (fe !== null) {
|
|
1493
|
-
const pe = z.item.end_time - z.item.start_time;
|
|
1494
|
-
V = C.xToTime(fe) - pe;
|
|
1495
|
-
}
|
|
1496
|
-
}
|
|
1497
|
-
const Q = de ? de("move", z.item.id, V) : V, ae = x.current.hierarchyEngine.getMoveDelta(z.item.id, Q);
|
|
1498
|
-
(R = (k = x.current).onItemMove) == null || R.call(k, z.item.id, Q, Z.newGroupId, ae.length > 0 ? ae : void 0);
|
|
1509
|
+
const W = ie.getState(), Z = L.current, oe = Z.canvasWidth / (Z.visibleTimeEnd - Z.visibleTimeStart);
|
|
1510
|
+
if (W) {
|
|
1511
|
+
const V = j.current.moveResizeValidator, N = j.current;
|
|
1512
|
+
if (W.mode === "move") {
|
|
1513
|
+
const se = li(W, Z, N), te = ie.endMove(oe);
|
|
1514
|
+
if (te) {
|
|
1515
|
+
const O = V ? V("move", W.item.id, se) : se, S = N.hierarchyEngine.getMoveDelta(W.item.id, O);
|
|
1516
|
+
(k = N.onItemMove) == null || k.call(N, W.item.id, O, te.newGroupId, S.length > 0 ? S : void 0);
|
|
1499
1517
|
}
|
|
1500
1518
|
} else {
|
|
1501
|
-
const
|
|
1502
|
-
if (
|
|
1503
|
-
const
|
|
1504
|
-
|
|
1505
|
-
const Q = x.current.hierarchyEngine.getResizeConstraint(z.item.id, Z.edge);
|
|
1506
|
-
Z.edge === "left" && G > Q.max ? G = Q.max : Z.edge === "right" && G < Q.min && (G = Q.min);
|
|
1507
|
-
const ae = de ? de("resize", z.item.id, G, Z.edge) : G;
|
|
1508
|
-
(Y = (X = x.current).onItemResize) == null || Y.call(X, z.item.id, ae, Z.edge);
|
|
1519
|
+
const { edge: se, time: te } = ai(W, Z, N);
|
|
1520
|
+
if (ie.endResize(oe)) {
|
|
1521
|
+
const S = V ? V("resize", W.item.id, te, se) : te;
|
|
1522
|
+
(D = N.onItemResize) == null || D.call(N, W.item.id, S, se);
|
|
1509
1523
|
}
|
|
1510
1524
|
}
|
|
1511
1525
|
}
|
|
1512
|
-
|
|
1526
|
+
a.style.cursor = "default", R.markDirty("overlay");
|
|
1513
1527
|
return;
|
|
1514
1528
|
}
|
|
1515
1529
|
ie.isPending() && ie.cancel();
|
|
1516
|
-
const
|
|
1517
|
-
|
|
1518
|
-
}, [ie,
|
|
1519
|
-
var k,
|
|
1520
|
-
const
|
|
1521
|
-
if (
|
|
1522
|
-
(k = u.onItemDoubleClick) == null || k.call(u,
|
|
1530
|
+
const g = a.getBoundingClientRect(), p = s.clientX - g.left, u = s.clientY - g.top, b = Ze(p, u, L.current, j.current.intervalTree, j.current.layoutEngine, j.current.groups);
|
|
1531
|
+
b && ((F = (X = j.current).onItemClick) == null || F.call(X, b.id, s.nativeEvent));
|
|
1532
|
+
}, [ie, R]), Ci = Q((s) => {
|
|
1533
|
+
var k, D;
|
|
1534
|
+
const a = s.currentTarget.getBoundingClientRect(), g = s.clientX - a.left, p = s.clientY - a.top, u = j.current, b = Ze(g, p, L.current, u.intervalTree, u.layoutEngine, u.groups);
|
|
1535
|
+
if (b)
|
|
1536
|
+
(k = u.onItemDoubleClick) == null || k.call(u, b.id, s.nativeEvent);
|
|
1523
1537
|
else {
|
|
1524
|
-
const X =
|
|
1525
|
-
X && ((
|
|
1538
|
+
const X = St(p, L.current, u.groups), F = L.current.xToTime(g);
|
|
1539
|
+
X && ((D = u.onCanvasDoubleClick) == null || D.call(u, X.id, F));
|
|
1526
1540
|
}
|
|
1527
|
-
}, []),
|
|
1528
|
-
var k,
|
|
1529
|
-
|
|
1530
|
-
const
|
|
1531
|
-
if (
|
|
1532
|
-
(k = u.onItemContextMenu) == null || k.call(u,
|
|
1541
|
+
}, []), Ei = Q((s) => {
|
|
1542
|
+
var k, D;
|
|
1543
|
+
s.preventDefault();
|
|
1544
|
+
const a = s.currentTarget.getBoundingClientRect(), g = s.clientX - a.left, p = s.clientY - a.top, u = j.current, b = Ze(g, p, L.current, u.intervalTree, u.layoutEngine, u.groups);
|
|
1545
|
+
if (b)
|
|
1546
|
+
(k = u.onItemContextMenu) == null || k.call(u, b.id, s.nativeEvent);
|
|
1533
1547
|
else {
|
|
1534
|
-
const X =
|
|
1535
|
-
X && ((
|
|
1548
|
+
const X = St(p, L.current, u.groups), F = L.current.xToTime(g);
|
|
1549
|
+
X && ((D = u.onCanvasContextMenu) == null || D.call(u, X.id, F, s.nativeEvent));
|
|
1536
1550
|
}
|
|
1537
|
-
}, []),
|
|
1538
|
-
var
|
|
1539
|
-
|
|
1540
|
-
}, [
|
|
1541
|
-
const
|
|
1542
|
-
return
|
|
1543
|
-
var
|
|
1544
|
-
if (!
|
|
1551
|
+
}, []), Hi = Q(() => {
|
|
1552
|
+
var s, a;
|
|
1553
|
+
de.current = null, De.current = !1, ft.current = null, ze.current && (ze.current.style.cursor = "default"), xe.current !== void 0 && (xe.current = void 0, R.markDirty("items"), (a = (s = j.current).onItemHover) == null || a.call(s, null, new PointerEvent("pointerleave"))), j.current.showCursorLine && R.markDirty("overlay");
|
|
1554
|
+
}, [R]), Ii = K(() => {
|
|
1555
|
+
const s = [];
|
|
1556
|
+
return ce.Children.forEach(Me, (a) => {
|
|
1557
|
+
var p;
|
|
1558
|
+
if (!ce.isValidElement(a))
|
|
1545
1559
|
return;
|
|
1546
|
-
if (((
|
|
1547
|
-
const u =
|
|
1548
|
-
|
|
1549
|
-
visibleTimeStart: u.visibleTimeStart ??
|
|
1550
|
-
visibleTimeEnd: u.visibleTimeEnd ??
|
|
1551
|
-
canvasWidth: u.canvasWidth ??
|
|
1560
|
+
if (((p = a.type) == null ? void 0 : p.displayName) === "TimelineHeaders") {
|
|
1561
|
+
const u = a.props;
|
|
1562
|
+
s.push(ce.cloneElement(a, {
|
|
1563
|
+
visibleTimeStart: u.visibleTimeStart ?? Wt,
|
|
1564
|
+
visibleTimeEnd: u.visibleTimeEnd ?? Bt,
|
|
1565
|
+
canvasWidth: u.canvasWidth ?? we,
|
|
1552
1566
|
sidebarWidth: u.sidebarWidth ?? c,
|
|
1553
|
-
theme: u.theme ??
|
|
1567
|
+
theme: u.theme ?? ye,
|
|
1554
1568
|
timezone: u.timezone ?? Je,
|
|
1555
|
-
onZoomToInterval: u.onZoomToInterval ?? ((
|
|
1556
|
-
var
|
|
1557
|
-
L.current.update({ visibleTimeStart:
|
|
1569
|
+
onZoomToInterval: u.onZoomToInterval ?? ((b, k) => {
|
|
1570
|
+
var D, X, F, W;
|
|
1571
|
+
L.current.update({ visibleTimeStart: b, visibleTimeEnd: k }), R.markAllDirty(), Xe(), (X = (D = j.current).onTimeChange) == null || X.call(D, b, k), (W = (F = j.current).onZoom) == null || W.call(F, b, k);
|
|
1558
1572
|
})
|
|
1559
1573
|
}));
|
|
1560
1574
|
}
|
|
1561
|
-
}),
|
|
1562
|
-
}, [
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
}, [
|
|
1566
|
-
captureToCanvas({ timeStart:
|
|
1567
|
-
const u =
|
|
1568
|
-
for (let
|
|
1569
|
-
X.push(X[
|
|
1570
|
-
const
|
|
1571
|
-
|
|
1572
|
-
const
|
|
1573
|
-
|
|
1574
|
-
for (let
|
|
1575
|
-
const
|
|
1575
|
+
}), s;
|
|
1576
|
+
}, [Me, Wt, Bt, we, c, ye, Je, R, Xe]), Ut = A(!1);
|
|
1577
|
+
le(() => {
|
|
1578
|
+
Ut.current || (Ut.current = !0, R.markAllDirty());
|
|
1579
|
+
}, [R]), Pi(t, () => ({
|
|
1580
|
+
captureToCanvas({ timeStart: s, timeEnd: a, scale: g, sidebarWidth: p }) {
|
|
1581
|
+
const u = j.current, b = 28, k = b * 3, D = u.groups.map((G) => u.layoutEngine.getGroupHeight(G.id)), X = [0];
|
|
1582
|
+
for (let G = 0; G < D.length; G++)
|
|
1583
|
+
X.push(X[G] + D[G]);
|
|
1584
|
+
const F = X[D.length], W = L.current, Z = u.canvasWidth / (W.visibleTimeEnd - W.visibleTimeStart), oe = a - s, V = Math.max(u.canvasWidth, Math.round(oe * Z)), N = (p + V) * g, se = (k + F) * g, te = document.createElement("canvas");
|
|
1585
|
+
te.width = N, te.height = se;
|
|
1586
|
+
const O = te.getContext("2d");
|
|
1587
|
+
O.scale(g, g);
|
|
1588
|
+
for (let G = 0; G < u.groups.length; G++) {
|
|
1589
|
+
const Te = u.groups[G], Se = D[G], z = k + X[G];
|
|
1576
1590
|
if (u.rowStyle) {
|
|
1577
|
-
const
|
|
1578
|
-
|
|
1591
|
+
const ue = u.rowStyle(Te);
|
|
1592
|
+
ue != null && ue.backgroundColor && (O.fillStyle = ue.backgroundColor, O.fillRect(0, z, p, Se));
|
|
1579
1593
|
}
|
|
1580
|
-
const
|
|
1581
|
-
let
|
|
1582
|
-
|
|
1594
|
+
const ae = Te.type;
|
|
1595
|
+
let re = "400", q = 8;
|
|
1596
|
+
ae === "project" ? re = "700" : ae === "CAG" ? re = "600" : ae === "CA" && (re = "400", q = 24), O.fillStyle = "#111", O.font = `${re} 12px sans-serif`, O.textBaseline = "middle", O.fillText(Te.title, q, z + Se / 2, p - q - 4);
|
|
1583
1597
|
}
|
|
1584
|
-
const S = (
|
|
1585
|
-
var
|
|
1586
|
-
|
|
1587
|
-
let
|
|
1588
|
-
|
|
1589
|
-
const
|
|
1590
|
-
for (;
|
|
1591
|
-
const
|
|
1592
|
-
|
|
1598
|
+
const S = (G, Te, Se) => {
|
|
1599
|
+
var re, q;
|
|
1600
|
+
O.fillStyle = ((re = u.theme.header) == null ? void 0 : re.bg) ?? "#f5f5f5", O.fillRect(p, G, V, b), O.strokeStyle = ((q = u.theme.grid) == null ? void 0 : q.line) ?? "#e0e0e0", O.lineWidth = 1, O.strokeRect(p, G, V, b);
|
|
1601
|
+
let z = pe(s, u.timezone).startOf(Se);
|
|
1602
|
+
z.valueOf() < s && (z = z.add(1, Se));
|
|
1603
|
+
const ae = V / (a - s);
|
|
1604
|
+
for (; z.valueOf() < a; ) {
|
|
1605
|
+
const ue = z.add(1, Se), fe = p + (z.valueOf() - s) * ae, ge = p + (Math.min(ue.valueOf(), a) - s) * ae - fe;
|
|
1606
|
+
O.beginPath(), O.moveTo(fe, G), O.lineTo(fe, G + b), O.stroke(), O.fillStyle = "#333", O.font = "600 11px sans-serif", O.textBaseline = "middle", O.textAlign = "center", O.fillText(Te(z), fe + ge / 2, G + b / 2, ge - 4), z = ue;
|
|
1593
1607
|
}
|
|
1594
|
-
|
|
1608
|
+
O.textAlign = "start";
|
|
1595
1609
|
};
|
|
1596
|
-
S(0, (
|
|
1597
|
-
const
|
|
1598
|
-
visibleTimeStart:
|
|
1599
|
-
visibleTimeEnd:
|
|
1600
|
-
canvasWidth:
|
|
1601
|
-
canvasHeight:
|
|
1610
|
+
S(0, (G) => G.format("YYYY"), "year"), S(b, (G) => G.format("MM"), "month"), S(b * 2, (G) => String(G.isoWeek()), "week");
|
|
1611
|
+
const Fe = new Tt({
|
|
1612
|
+
visibleTimeStart: s,
|
|
1613
|
+
visibleTimeEnd: a,
|
|
1614
|
+
canvasWidth: V,
|
|
1615
|
+
canvasHeight: F,
|
|
1602
1616
|
sidebarWidth: 0,
|
|
1603
1617
|
lineHeight: u.lineHeight,
|
|
1604
1618
|
groupCount: u.groups.length,
|
|
1605
1619
|
buffer: 1,
|
|
1606
1620
|
scrollTop: 0,
|
|
1607
|
-
groupHeights:
|
|
1621
|
+
groupHeights: D
|
|
1608
1622
|
});
|
|
1609
|
-
return
|
|
1623
|
+
return O.save(), O.translate(p, k), O.beginPath(), O.rect(0, 0, V, F), O.clip(), $e.draw(O, Fe, u.groups, u.theme, u.dayStyle, u.rowStyle, u.highlights, u.timezone), _e.draw(O, Fe, u.groups, u.items, u.intervalTree, u.layoutEngine, u.itemRenderer, u.groupRenderer, u.theme, u.selected, void 0, u.dependencies, u.summaryRenderer, u.hierarchyEngine), Ye.draw(O, Fe, u.theme, {
|
|
1610
1624
|
cursorX: null,
|
|
1611
1625
|
snapX: null,
|
|
1612
1626
|
markers: je.current,
|
|
1613
1627
|
interaction: null
|
|
1614
|
-
}),
|
|
1628
|
+
}), O.restore(), te;
|
|
1615
1629
|
}
|
|
1616
|
-
}), [
|
|
1617
|
-
const
|
|
1618
|
-
captureToCanvas({ timeStart:
|
|
1619
|
-
var
|
|
1620
|
-
const
|
|
1621
|
-
for (let
|
|
1622
|
-
|
|
1623
|
-
const
|
|
1624
|
-
|
|
1625
|
-
const S =
|
|
1626
|
-
S.scale(
|
|
1627
|
-
for (let
|
|
1628
|
-
const
|
|
1629
|
-
S.fillStyle = (
|
|
1630
|
-
const
|
|
1631
|
-
let
|
|
1632
|
-
|
|
1633
|
-
const
|
|
1634
|
-
S.fillText(
|
|
1630
|
+
}), [$e, _e, Ye]), le(() => {
|
|
1631
|
+
const s = {
|
|
1632
|
+
captureToCanvas({ timeStart: a, timeEnd: g, scale: p, sidebarWidth: u }) {
|
|
1633
|
+
var Se;
|
|
1634
|
+
const b = j.current, k = 28, D = k * 3, X = b.groups.map((z) => b.layoutEngine.getGroupHeight(z.id)), F = [0];
|
|
1635
|
+
for (let z = 0; z < X.length; z++)
|
|
1636
|
+
F.push(F[z] + X[z]);
|
|
1637
|
+
const W = F[X.length], Z = L.current, oe = b.canvasWidth / (Z.visibleTimeEnd - Z.visibleTimeStart), V = g - a, N = Math.max(b.canvasWidth, Math.round(V * oe)), se = u + N, te = D + W, O = document.createElement("canvas");
|
|
1638
|
+
O.width = se * p, O.height = te * p;
|
|
1639
|
+
const S = O.getContext("2d");
|
|
1640
|
+
S.scale(p, p), S.fillStyle = "#FFFFFF", S.fillRect(0, 0, se, te), S.save(), S.beginPath(), S.rect(0, 0, u, te), S.clip(), S.fillStyle = "#F9FAFB", S.fillRect(0, 0, u, D), S.strokeStyle = "#E5E7EB", S.lineWidth = 1, S.strokeRect(0, 0, u, D);
|
|
1641
|
+
for (let z = 0; z < b.groups.length; z++) {
|
|
1642
|
+
const ae = b.groups[z], re = X[z], q = D + F[z], ue = (Se = b.rowStyle) == null ? void 0 : Se.call(b, ae);
|
|
1643
|
+
S.fillStyle = (ue == null ? void 0 : ue.backgroundColor) ?? (z % 2 === 0 ? "#FFFFFF" : "#F7F7F7"), S.fillRect(0, q, u, re), S.strokeStyle = "#E5E5E5", S.lineWidth = 0.5, S.beginPath(), S.moveTo(0, q + re), S.lineTo(u, q + re), S.stroke();
|
|
1644
|
+
const fe = ae.type ?? "";
|
|
1645
|
+
let Re = 8, ge = "400", Oe = 11;
|
|
1646
|
+
fe === "project" ? (ge = "700", Oe = 12) : fe === "control_area_group" ? ge = "600" : fe === "control_area" && (Re = 24), S.fillStyle = "#374151", S.font = `${ge} ${Oe}px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, S.textBaseline = "middle";
|
|
1647
|
+
const Ri = typeof ae.title == "string" ? ae.title : String(ae.title);
|
|
1648
|
+
S.fillText(Ri, Re, q + re / 2, u - Re - 8);
|
|
1635
1649
|
}
|
|
1636
|
-
S.strokeStyle = "#E5E7EB", S.lineWidth = 1, S.beginPath(), S.moveTo(u, 0), S.lineTo(u,
|
|
1637
|
-
const
|
|
1650
|
+
S.strokeStyle = "#E5E7EB", S.lineWidth = 1, S.beginPath(), S.moveTo(u, 0), S.lineTo(u, te), S.stroke(), S.restore(), S.save(), S.beginPath(), S.rect(u, 0, N, D), S.clip();
|
|
1651
|
+
const Fe = g - a, G = [
|
|
1638
1652
|
{ unit: "year", row: 0 },
|
|
1639
1653
|
{ unit: "month", row: 1 },
|
|
1640
1654
|
{ unit: "week", row: 2 }
|
|
1641
1655
|
];
|
|
1642
|
-
for (const { unit:
|
|
1643
|
-
const
|
|
1644
|
-
S.fillStyle = "#F9FAFB", S.fillRect(u,
|
|
1645
|
-
let
|
|
1646
|
-
const
|
|
1647
|
-
for (;
|
|
1648
|
-
const
|
|
1649
|
-
S.strokeStyle = "#E5E7EB", S.lineWidth = 0.5, S.strokeRect(
|
|
1650
|
-
let
|
|
1651
|
-
|
|
1656
|
+
for (const { unit: z, row: ae } of G) {
|
|
1657
|
+
const re = ae * k;
|
|
1658
|
+
S.fillStyle = "#F9FAFB", S.fillRect(u, re, N, k);
|
|
1659
|
+
let q = pe(a, b.timezone).startOf(z);
|
|
1660
|
+
const ue = pe(g, b.timezone).add(1, z);
|
|
1661
|
+
for (; q.isBefore(ue); ) {
|
|
1662
|
+
const fe = q.add(1, z), Re = u + (q.valueOf() - a) / Fe * N, ge = (fe.valueOf() - q.valueOf()) / Fe * N;
|
|
1663
|
+
S.strokeStyle = "#E5E7EB", S.lineWidth = 0.5, S.strokeRect(Re, re, ge, k);
|
|
1664
|
+
let Oe;
|
|
1665
|
+
z === "year" ? Oe = q.format("YYYY") : z === "month" ? Oe = q.format("MM") : Oe = `${q.week()}`, S.fillStyle = "#6c737f", S.font = z === "year" ? '600 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif' : '400 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', S.textBaseline = "middle", S.textAlign = "center", ge > 20 && S.fillText(Oe, Re + ge / 2, re + k / 2), q = fe;
|
|
1652
1666
|
}
|
|
1653
1667
|
}
|
|
1654
|
-
S.textAlign = "start", S.restore(), S.save(), S.beginPath(), S.rect(u,
|
|
1655
|
-
const
|
|
1656
|
-
visibleTimeStart:
|
|
1657
|
-
visibleTimeEnd:
|
|
1658
|
-
canvasWidth:
|
|
1659
|
-
canvasHeight:
|
|
1668
|
+
S.textAlign = "start", S.restore(), S.save(), S.beginPath(), S.rect(u, D, N, W), S.clip(), S.translate(u, D);
|
|
1669
|
+
const Te = new Tt({
|
|
1670
|
+
visibleTimeStart: a,
|
|
1671
|
+
visibleTimeEnd: g,
|
|
1672
|
+
canvasWidth: N,
|
|
1673
|
+
canvasHeight: W,
|
|
1660
1674
|
sidebarWidth: 0,
|
|
1661
|
-
lineHeight:
|
|
1662
|
-
groupCount:
|
|
1675
|
+
lineHeight: b.lineHeight,
|
|
1676
|
+
groupCount: b.groups.length,
|
|
1663
1677
|
buffer: 1,
|
|
1664
1678
|
scrollTop: 0,
|
|
1665
1679
|
groupHeights: X
|
|
1666
1680
|
});
|
|
1667
|
-
return
|
|
1681
|
+
return $e.draw(S, Te, b.groups, b.theme, b.dayStyle, b.rowStyle, b.highlights, b.timezone), _e.draw(S, Te, b.groups, b.items, b.intervalTree, b.layoutEngine, b.itemRenderer, b.groupRenderer, b.theme, b.selected, void 0, b.dependencies, b.summaryRenderer, b.hierarchyEngine), Ye.draw(S, Te, b.theme, { cursorX: null, markers: je.current }), S.restore(), O;
|
|
1668
1682
|
}
|
|
1669
1683
|
};
|
|
1670
|
-
Ke == null || Ke(
|
|
1671
|
-
}, [Ke,
|
|
1672
|
-
const
|
|
1684
|
+
Ke == null || Ke(s);
|
|
1685
|
+
}, [Ke, $e, _e, Ye]);
|
|
1686
|
+
const Di = {
|
|
1673
1687
|
position: "relative",
|
|
1674
|
-
width:
|
|
1675
|
-
height:
|
|
1688
|
+
width: we,
|
|
1689
|
+
height: me,
|
|
1676
1690
|
overflow: "hidden",
|
|
1677
1691
|
cursor: "default"
|
|
1678
|
-
},
|
|
1679
|
-
return Ve("div", { ref:
|
|
1692
|
+
}, yt = { position: "absolute", top: 0, left: 0 };
|
|
1693
|
+
return Ve("div", { ref: Xt, style: { display: "flex", flexDirection: "column", width: "100%", position: "relative" }, children: [di ? Ve("div", { style: {
|
|
1680
1694
|
position: "absolute",
|
|
1681
1695
|
top: 0,
|
|
1682
1696
|
left: 0,
|
|
@@ -1690,31 +1704,31 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1690
1704
|
borderBottomRightRadius: 4,
|
|
1691
1705
|
pointerEvents: "none",
|
|
1692
1706
|
userSelect: "none"
|
|
1693
|
-
}, children: ["v", "0.
|
|
1694
|
-
L.current.update({ scrollTop:
|
|
1695
|
-
} }), Ve("div", { ref:
|
|
1696
|
-
L.current.update({ scrollTop:
|
|
1707
|
+
}, children: ["v", "0.8.1", " · ", "08:37:39"] }) : null, Ii, Ve("div", { ref: $t, style: { display: "flex", overflow: "hidden", maxHeight: Be ?? void 0 }, children: [ne(Qt, { groups: n, width: c, lineHeight: l, groupHeights: Ie, scrollTop: zt, canvasHeight: me, theme: ye, groupRenderer: B, onScroll: (s) => {
|
|
1708
|
+
L.current.update({ scrollTop: s }), R.markDirty("grid"), R.markDirty("items"), R.markDirty("overlay"), et(s);
|
|
1709
|
+
} }), Ve("div", { ref: ze, style: Di, onPointerMove: Mi, onPointerDown: wi, onPointerUp: ki, onDoubleClick: Ci, onContextMenu: Ei, onPointerLeave: Hi, children: [ne("canvas", { ref: Rt, style: { ...yt, zIndex: 0 } }), ne("canvas", { ref: Ot, style: { ...yt, zIndex: 1 } }), ne("canvas", { ref: Pt, style: { ...yt, zIndex: 2 } })] }), ut && It ? ne(Qt, { groups: n, width: ut, lineHeight: l, groupHeights: Ie, scrollTop: zt, canvasHeight: me, theme: ye, groupRenderer: It, onScroll: (s) => {
|
|
1710
|
+
L.current.update({ scrollTop: s }), R.markDirty("grid"), R.markDirty("items"), R.markDirty("overlay"), et(s);
|
|
1697
1711
|
} }) : null] })] });
|
|
1698
1712
|
}));
|
|
1699
|
-
function
|
|
1700
|
-
const
|
|
1713
|
+
function sn({ children: i, theme: e, className: t, classNames: n, style: r, visibleTimeStart: d, visibleTimeEnd: o, canvasWidth: c, sidebarWidth: l = 0, onZoomToInterval: v, timezone: C }) {
|
|
1714
|
+
const h = ce.Children.map(i, (f) => {
|
|
1701
1715
|
var T;
|
|
1702
|
-
if (!
|
|
1716
|
+
if (!ce.isValidElement(f))
|
|
1703
1717
|
return f;
|
|
1704
1718
|
if (((T = f.type) == null ? void 0 : T.displayName) === "DateHeader") {
|
|
1705
|
-
const
|
|
1706
|
-
visibleTimeStart:
|
|
1707
|
-
visibleTimeEnd:
|
|
1708
|
-
canvasWidth:
|
|
1709
|
-
theme:
|
|
1710
|
-
onZoomToInterval:
|
|
1711
|
-
timezone:
|
|
1719
|
+
const m = f.props, E = ce.cloneElement(f, {
|
|
1720
|
+
visibleTimeStart: m.visibleTimeStart ?? d,
|
|
1721
|
+
visibleTimeEnd: m.visibleTimeEnd ?? o,
|
|
1722
|
+
canvasWidth: m.canvasWidth ?? c,
|
|
1723
|
+
theme: m.theme ?? e,
|
|
1724
|
+
onZoomToInterval: m.onIntervalClick ?? m.onZoomToInterval ?? v,
|
|
1725
|
+
timezone: m.timezone ?? C
|
|
1712
1726
|
});
|
|
1713
|
-
return Ve("div", { style: { display: "flex" }, children: [
|
|
1727
|
+
return Ve("div", { style: { display: "flex" }, children: [ne("div", { style: { width: l, flexShrink: 0 } }), ne("div", { style: { flex: 1, overflow: "hidden" }, children: E })] });
|
|
1714
1728
|
}
|
|
1715
1729
|
return f;
|
|
1716
1730
|
});
|
|
1717
|
-
return
|
|
1731
|
+
return ne("div", { className: t, style: {
|
|
1718
1732
|
position: "sticky",
|
|
1719
1733
|
top: 0,
|
|
1720
1734
|
zIndex: 20,
|
|
@@ -1723,65 +1737,65 @@ function Ki({ children: i, theme: e, className: t, classNames: n, style: o, visi
|
|
|
1723
1737
|
backgroundColor: (e == null ? void 0 : e.header.bg) ?? "#F9FAFB",
|
|
1724
1738
|
borderTop: `1px solid ${(e == null ? void 0 : e.header.border) ?? "#E5E7EB"}`,
|
|
1725
1739
|
borderBottom: `1px solid ${(e == null ? void 0 : e.header.border) ?? "#E5E7EB"}`,
|
|
1726
|
-
...
|
|
1727
|
-
}, children:
|
|
1740
|
+
...r
|
|
1741
|
+
}, children: h });
|
|
1728
1742
|
}
|
|
1729
|
-
|
|
1730
|
-
var
|
|
1743
|
+
sn.displayName = "TimelineHeaders";
|
|
1744
|
+
var ci = { exports: {} };
|
|
1731
1745
|
(function(i, e) {
|
|
1732
1746
|
(function(t, n) {
|
|
1733
1747
|
i.exports = n();
|
|
1734
1748
|
})(lt, function() {
|
|
1735
1749
|
var t = "week", n = "year";
|
|
1736
|
-
return function(
|
|
1750
|
+
return function(r, d, o) {
|
|
1737
1751
|
var c = d.prototype;
|
|
1738
|
-
c.week = function(
|
|
1739
|
-
if (
|
|
1740
|
-
var
|
|
1752
|
+
c.week = function(l) {
|
|
1753
|
+
if (l === void 0 && (l = null), l !== null) return this.add(7 * (l - this.week()), "day");
|
|
1754
|
+
var v = this.$locale().yearStart || 1;
|
|
1741
1755
|
if (this.month() === 11 && this.date() > 25) {
|
|
1742
|
-
var
|
|
1743
|
-
if (
|
|
1756
|
+
var C = o(this).startOf(n).add(1, n).date(v), h = o(this).endOf(t);
|
|
1757
|
+
if (C.isBefore(h)) return 1;
|
|
1744
1758
|
}
|
|
1745
|
-
var f =
|
|
1746
|
-
return M < 0 ?
|
|
1747
|
-
}, c.weeks = function(
|
|
1748
|
-
return
|
|
1759
|
+
var f = o(this).startOf(n).date(v).startOf(t).subtract(1, "millisecond"), M = this.diff(f, t, !0);
|
|
1760
|
+
return M < 0 ? o(this).startOf("week").week() : Math.ceil(M);
|
|
1761
|
+
}, c.weeks = function(l) {
|
|
1762
|
+
return l === void 0 && (l = null), this.week(l);
|
|
1749
1763
|
};
|
|
1750
1764
|
};
|
|
1751
1765
|
});
|
|
1752
|
-
})(
|
|
1753
|
-
var
|
|
1754
|
-
const
|
|
1755
|
-
We.extend(
|
|
1756
|
-
const
|
|
1766
|
+
})(ci);
|
|
1767
|
+
var ln = ci.exports;
|
|
1768
|
+
const an = /* @__PURE__ */ at(ln);
|
|
1769
|
+
We.extend(an);
|
|
1770
|
+
const un = {
|
|
1757
1771
|
year: 30,
|
|
1758
1772
|
month: 30,
|
|
1759
1773
|
week: 20,
|
|
1760
1774
|
day: 15,
|
|
1761
1775
|
hour: 30
|
|
1762
1776
|
};
|
|
1763
|
-
function
|
|
1764
|
-
const f =
|
|
1777
|
+
function cn({ unit: i, visibleTimeStart: e = 0, visibleTimeEnd: t = 0, canvasWidth: n = 0, theme: r, height: d = 28, className: o, labelFormat: c, onIntervalClick: l, minCellWidth: v, onZoomToInterval: C, timezone: h }) {
|
|
1778
|
+
const f = K(() => {
|
|
1765
1779
|
if (!e || !t || !n)
|
|
1766
1780
|
return [];
|
|
1767
|
-
const T = t - e,
|
|
1768
|
-
if (
|
|
1769
|
-
const y =
|
|
1770
|
-
if ((y.add(1, i).valueOf() - y.valueOf()) / T * n <
|
|
1781
|
+
const T = t - e, m = v ?? un[i];
|
|
1782
|
+
if (m > 0) {
|
|
1783
|
+
const y = pe(e, h).startOf(i);
|
|
1784
|
+
if ((y.add(1, i).valueOf() - y.valueOf()) / T * n < m)
|
|
1771
1785
|
return [];
|
|
1772
1786
|
}
|
|
1773
1787
|
const E = [];
|
|
1774
|
-
let P =
|
|
1775
|
-
const
|
|
1776
|
-
for (; P.valueOf() <
|
|
1777
|
-
const y = P.add(1, i),
|
|
1778
|
-
E.push({ start:
|
|
1788
|
+
let P = pe(e, h).startOf(i).subtract(1, i);
|
|
1789
|
+
const Y = pe(t, h).add(2, i).valueOf();
|
|
1790
|
+
for (; P.valueOf() < Y; ) {
|
|
1791
|
+
const y = P.add(1, i), H = P.valueOf(), w = y.valueOf(), $ = (H - e) / T * n, B = (w - H) / T * n, I = dn(P, y, i, c);
|
|
1792
|
+
E.push({ start: H, end: w, label: I, left: $, width: B }), P = y;
|
|
1779
1793
|
}
|
|
1780
1794
|
return E;
|
|
1781
|
-
}, [e, t, n, i, c,
|
|
1782
|
-
|
|
1783
|
-
}, [
|
|
1784
|
-
return f.length === 0 ? null :
|
|
1795
|
+
}, [e, t, n, i, c, v, h]), M = Q((T, m) => {
|
|
1796
|
+
l ? l(T, m) : C && C(T, m);
|
|
1797
|
+
}, [l, C]);
|
|
1798
|
+
return f.length === 0 ? null : ne("div", { style: { display: "flex", position: "relative", height: d, overflow: "hidden" }, children: f.map((T) => ne("div", { className: o, onClick: () => M(T.start, T.end), style: {
|
|
1785
1799
|
position: "absolute",
|
|
1786
1800
|
left: T.left,
|
|
1787
1801
|
width: T.width,
|
|
@@ -1789,24 +1803,24 @@ function tn({ unit: i, visibleTimeStart: e = 0, visibleTimeEnd: t = 0, canvasWid
|
|
|
1789
1803
|
display: "flex",
|
|
1790
1804
|
alignItems: "center",
|
|
1791
1805
|
justifyContent: "center",
|
|
1792
|
-
borderRight: `1px solid ${(
|
|
1793
|
-
borderBottom: `1px solid ${(
|
|
1806
|
+
borderRight: `1px solid ${(r == null ? void 0 : r.header.border) ?? "#E5E7EB"}`,
|
|
1807
|
+
borderBottom: `1px solid ${(r == null ? void 0 : r.header.border) ?? "#E5E7EB"}`,
|
|
1794
1808
|
fontSize: 12,
|
|
1795
|
-
color: (
|
|
1796
|
-
backgroundColor: (
|
|
1809
|
+
color: (r == null ? void 0 : r.header.text) ?? "#6c737f",
|
|
1810
|
+
backgroundColor: (r == null ? void 0 : r.header.bg) ?? "#F9FAFB",
|
|
1797
1811
|
overflow: "hidden",
|
|
1798
1812
|
whiteSpace: "nowrap",
|
|
1799
1813
|
cursor: "pointer",
|
|
1800
1814
|
userSelect: "none",
|
|
1801
1815
|
padding: "0 4px",
|
|
1802
1816
|
boxSizing: "border-box"
|
|
1803
|
-
}, children:
|
|
1817
|
+
}, children: ne("span", { children: T.label }) }, T.start)) });
|
|
1804
1818
|
}
|
|
1805
|
-
|
|
1806
|
-
function
|
|
1807
|
-
return typeof n == "function" ? n(i.toDate(), e.toDate(), t) : typeof n == "string" ? i.format(n) :
|
|
1819
|
+
cn.displayName = "DateHeader";
|
|
1820
|
+
function dn(i, e, t, n, r) {
|
|
1821
|
+
return typeof n == "function" ? n(i.toDate(), e.toDate(), t) : typeof n == "string" ? i.format(n) : fn(i, t);
|
|
1808
1822
|
}
|
|
1809
|
-
function
|
|
1823
|
+
function fn(i, e) {
|
|
1810
1824
|
switch (e) {
|
|
1811
1825
|
case "year":
|
|
1812
1826
|
return i.format("YYYY");
|
|
@@ -1820,24 +1834,24 @@ function rn(i, e) {
|
|
|
1820
1834
|
return i.format("HH:mm");
|
|
1821
1835
|
}
|
|
1822
1836
|
}
|
|
1823
|
-
function
|
|
1837
|
+
function hn({ width: i, children: e, style: t }) {
|
|
1824
1838
|
const n = () => ({ style: { width: i, ...t } });
|
|
1825
|
-
return e ?
|
|
1839
|
+
return e ? ne(ni, { children: e({ getRootProps: n }) }) : ne("div", { style: { width: i } });
|
|
1826
1840
|
}
|
|
1827
|
-
|
|
1828
|
-
function
|
|
1829
|
-
return
|
|
1841
|
+
hn.displayName = "SidebarHeader";
|
|
1842
|
+
function mn({ children: i }) {
|
|
1843
|
+
return ne(ni, { children: i });
|
|
1830
1844
|
}
|
|
1831
|
-
|
|
1845
|
+
mn.displayName = "CustomHeader";
|
|
1832
1846
|
export {
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1847
|
+
yn as CanvasTimeline,
|
|
1848
|
+
mn as CustomHeader,
|
|
1849
|
+
rn as CustomMarker,
|
|
1850
|
+
Ce as DEFAULT_THEME,
|
|
1851
|
+
cn as DateHeader,
|
|
1852
|
+
Yi as HierarchyEngine,
|
|
1853
|
+
hn as SidebarHeader,
|
|
1854
|
+
sn as TimelineHeaders,
|
|
1855
|
+
tn as TodayMarker
|
|
1842
1856
|
};
|
|
1843
1857
|
//# sourceMappingURL=canvas-timeline.es.js.map
|