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