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