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