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