schedulant 2.0.9-fixed.3 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/schedulant.js +143 -152
- package/package.json +1 -1
package/dist/schedulant.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as a, Fragment as At, jsxs as O } from "react/jsx-runtime";
|
|
2
2
|
import * as ie from "react";
|
|
3
|
-
import { createContext as
|
|
3
|
+
import { createContext as Mt, useReducer as bt, useEffect as N, useContext as wt, useRef as k, useCallback as C, useState as re, useMemo as F, memo as ae, useLayoutEffect as Et } from "react";
|
|
4
4
|
import E from "dayjs";
|
|
5
5
|
import Ct from "dayjs/plugin/weekYear";
|
|
6
6
|
import Dt from "dayjs/plugin/weekOfYear";
|
|
@@ -10,7 +10,7 @@ import { Dropdown as Z, Space as kt } from "antd";
|
|
|
10
10
|
import X from "@ant-design/icons/lib/components/Icon";
|
|
11
11
|
import { PlusSquareOutlined as xt, MinusSquareOutlined as Ot } from "@ant-design/icons";
|
|
12
12
|
import { useSortable as It, SortableContext as Pt, verticalListSortingStrategy as Lt } from "@dnd-kit/sortable";
|
|
13
|
-
import { useSensors as Nt, useSensor as _e, PointerSensor as Yt, KeyboardSensor as _t, DndContext as Wt, closestCenter as
|
|
13
|
+
import { useSensors as Nt, useSensor as _e, PointerSensor as Yt, KeyboardSensor as _t, DndContext as Wt, closestCenter as zt, DragOverlay as Ht } from "@dnd-kit/core";
|
|
14
14
|
import { restrictToVerticalAxis as Vt } from "@dnd-kit/modifiers";
|
|
15
15
|
import { flushSync as Ft } from "react-dom";
|
|
16
16
|
const de = {
|
|
@@ -49,8 +49,8 @@ const de = {
|
|
|
49
49
|
default:
|
|
50
50
|
return t;
|
|
51
51
|
}
|
|
52
|
-
}, ut =
|
|
53
|
-
const [e, n] =
|
|
52
|
+
}, ut = Mt(void 0), Ut = ({ children: t }) => {
|
|
53
|
+
const [e, n] = bt(qt, void 0, Bt);
|
|
54
54
|
return N(() => {
|
|
55
55
|
localStorage.setItem(dt, JSON.stringify(e));
|
|
56
56
|
}, [e]), /* @__PURE__ */ a(ut.Provider, { value: { state: e, dispatch: n }, children: t });
|
|
@@ -59,12 +59,12 @@ const de = {
|
|
|
59
59
|
if (t === void 0)
|
|
60
60
|
throw new Error("useSchedulantContext must be used within a SchedulantProvider");
|
|
61
61
|
return t;
|
|
62
|
-
}, w = (t) => `${t}px`, oe = (t) => Number(t.replace(/px$/, "")), We = (t) => document.querySelector(`.${t}`), jt = 0.7, W = 10, ht = 16,
|
|
62
|
+
}, w = (t) => `${t}px`, oe = (t) => Number(t.replace(/px$/, "")), We = (t) => document.querySelector(`.${t}`), jt = 0.7, W = 10, ht = 16, ze = 13, $t = 0.3, He = 0.8, Gt = 0.25, Xt = 0.75, Qt = 100, Kt = (t) => {
|
|
63
63
|
N(() => {
|
|
64
|
-
const e = document.getElementById("schedulant-view-harness"), n = document.getElementById("schedulant-datagrid-body"), s = document.getElementById("schedulant-timeline-head"), i = n ? n.getBoundingClientRect().height : 0, r = s ? s.getBoundingClientRect().height : 0, o = i + r +
|
|
64
|
+
const e = document.getElementById("schedulant-view-harness"), n = document.getElementById("schedulant-datagrid-body"), s = document.getElementById("schedulant-timeline-head"), i = n ? n.getBoundingClientRect().height : 0, r = s ? s.getBoundingClientRect().height : 0, o = i + r + ze, l = t - o > 0 ? o : t;
|
|
65
65
|
e && (e.style.height = w(l));
|
|
66
66
|
const c = () => {
|
|
67
|
-
const m = n ? n.getBoundingClientRect().height : 0, g = s ? s.getBoundingClientRect().height : 0, h = m + g +
|
|
67
|
+
const m = n ? n.getBoundingClientRect().height : 0, g = s ? s.getBoundingClientRect().height : 0, h = m + g + ze, u = t - h > 0 ? h : t;
|
|
68
68
|
e && (e.style.height = w(u));
|
|
69
69
|
}, d = new ResizeObserver(() => {
|
|
70
70
|
c();
|
|
@@ -296,15 +296,15 @@ class le {
|
|
|
296
296
|
const u = g.pop();
|
|
297
297
|
if (u) {
|
|
298
298
|
const { parentId: A, depth: p } = u, v = h.get(A);
|
|
299
|
-
v && v.sort(le.compare).forEach((
|
|
300
|
-
const f =
|
|
301
|
-
|
|
299
|
+
v && v.sort(le.compare).forEach((M) => {
|
|
300
|
+
const f = M.getId();
|
|
301
|
+
M.setDepth(p), M.setParent(c.get(A)), M.setChildren(h.get(f) || []);
|
|
302
302
|
const y = l.get(f) || [];
|
|
303
|
-
y.forEach((D) => D.setResourceApi(
|
|
303
|
+
y.forEach((D) => D.setResourceApi(M)), M.setEventApis(y);
|
|
304
304
|
const S = d.get(f) || [];
|
|
305
|
-
S.forEach((D) => D.setResourceApi(
|
|
306
|
-
const
|
|
307
|
-
|
|
305
|
+
S.forEach((D) => D.setResourceApi(M)), M.setMilestoneApis(S);
|
|
306
|
+
const b = m.get(f) || [];
|
|
307
|
+
b.forEach((D) => D.setResourceApi(M)), M.setCheckpointApis(b), g.push({ parentId: f, depth: p + 1 });
|
|
308
308
|
});
|
|
309
309
|
}
|
|
310
310
|
}
|
|
@@ -826,7 +826,7 @@ const on = (t, e, n) => {
|
|
|
826
826
|
});
|
|
827
827
|
};
|
|
828
828
|
}, [t, e, n]);
|
|
829
|
-
},
|
|
829
|
+
}, z = ({ condition: t, children: e, fallback: n }) => /* @__PURE__ */ a(At, { children: t ? e : n }), ln = (t, e, n) => {
|
|
830
830
|
const s = k(-1), i = C(() => We("schedulant-datagrid-head"), []), r = C(() => We("schedulant-datagrid-body"), []), o = C((h) => {
|
|
831
831
|
h.preventDefault();
|
|
832
832
|
const u = n.current;
|
|
@@ -844,10 +844,10 @@ const on = (t, e, n) => {
|
|
|
844
844
|
u ? u.addEventListener("mousemove", o) : console.error("scheduleEl", u);
|
|
845
845
|
}, [o, e]), d = C((h) => {
|
|
846
846
|
h.preventDefault();
|
|
847
|
-
const u = s.current, A = i(), p = r(), v = A.firstElementChild,
|
|
847
|
+
const u = s.current, A = i(), p = r(), v = A.firstElementChild, M = p.firstElementChild, f = v?.children, y = M?.children;
|
|
848
848
|
if (f && y) {
|
|
849
|
-
const S = f[u],
|
|
850
|
-
S.style.width = w(D),
|
|
849
|
+
const S = f[u], b = y[u], D = h.clientX - S.getBoundingClientRect().left, T = h.clientX - b.getBoundingClientRect().left;
|
|
850
|
+
S.style.width = w(D), b.style.width = w(T);
|
|
851
851
|
}
|
|
852
852
|
}, [r, i, s]), m = C((h) => {
|
|
853
853
|
h.preventDefault(), s.current = -1;
|
|
@@ -861,8 +861,8 @@ const on = (t, e, n) => {
|
|
|
861
861
|
v.length === 0 && (v = p.getElementsByTagName("th"));
|
|
862
862
|
for (let y = 0; y < v.length; y++)
|
|
863
863
|
v[y] === A && (s.current = y);
|
|
864
|
-
const
|
|
865
|
-
|
|
864
|
+
const M = i(), f = r();
|
|
865
|
+
M.addEventListener("mousemove", d), f.addEventListener("mousemove", d);
|
|
866
866
|
} else
|
|
867
867
|
console.error("trElement", p);
|
|
868
868
|
}, [i, r, d, s]);
|
|
@@ -900,7 +900,7 @@ const on = (t, e, n) => {
|
|
|
900
900
|
children: t.resourceAreaColumn.headerContent
|
|
901
901
|
}
|
|
902
902
|
) }),
|
|
903
|
-
/* @__PURE__ */ a(
|
|
903
|
+
/* @__PURE__ */ a(z, { condition: t.isResizable, children: /* @__PURE__ */ a(
|
|
904
904
|
"div",
|
|
905
905
|
{
|
|
906
906
|
className: "schedulant-datagrid-cell-resizer",
|
|
@@ -1020,13 +1020,13 @@ function mn(t, e, n) {
|
|
|
1020
1020
|
}
|
|
1021
1021
|
const gn = (t) => {
|
|
1022
1022
|
const { dispatch: e } = Te(), n = k(null), i = t.schedulantApi.getScheduleView().getTimelineView().calculateLaneHeight(t.resourceApi), r = C((y, S) => {
|
|
1023
|
-
const
|
|
1024
|
-
if (Object.keys(
|
|
1025
|
-
const I =
|
|
1023
|
+
const b = S.getResource();
|
|
1024
|
+
if (Object.keys(b).includes(y)) {
|
|
1025
|
+
const I = b[y];
|
|
1026
1026
|
if (typeof I == "string")
|
|
1027
1027
|
return I;
|
|
1028
1028
|
} else {
|
|
1029
|
-
const I =
|
|
1029
|
+
const I = b.extendedProps?.[y];
|
|
1030
1030
|
if (typeof I == "string" || typeof I == "number")
|
|
1031
1031
|
return I;
|
|
1032
1032
|
}
|
|
@@ -1040,8 +1040,8 @@ const gn = (t) => {
|
|
|
1040
1040
|
}), h = t.overId === o && t.activeId !== o, u = () => {
|
|
1041
1041
|
const y = ["schedulant-datagrid-cell", "schedulant-resource"];
|
|
1042
1042
|
return mt().has(o) && y.push("schedulant-resource-selected"), t.isDraggable && g && y.push("schedulant-resource-dragging"), t.isDraggable && h && t.dropPosition && y.push(`schedulant-resource-drop-${t.dropPosition}`), y.join(" ");
|
|
1043
|
-
}, [A, p] = re(!1), [v,
|
|
1044
|
-
y &&
|
|
1043
|
+
}, [A, p] = re(!1), [v, M] = re({}), f = C((y) => {
|
|
1044
|
+
y && M(mn(t.schedulantApi, t.resourceApi, t.resourceAreaColumn)), p(y);
|
|
1045
1045
|
}, [t.schedulantApi, t.resourceApi, t.resourceAreaColumn]);
|
|
1046
1046
|
return /* @__PURE__ */ a(
|
|
1047
1047
|
"td",
|
|
@@ -1098,7 +1098,7 @@ const gn = (t) => {
|
|
|
1098
1098
|
t.showPlusSquare && t.resourceApi.getMilestoneApis().length > 0 && /* @__PURE__ */ a("span", { className: "schedulant-milestone-indicator", children: /* @__PURE__ */ a(dn, { width: 14, height: 14, color: "#91003c" }) })
|
|
1099
1099
|
] })
|
|
1100
1100
|
] }) }),
|
|
1101
|
-
/* @__PURE__ */ a(
|
|
1101
|
+
/* @__PURE__ */ a(z, { condition: t.isResizable, children: /* @__PURE__ */ a("div", { className: "schedulant-datagrid-cell-resizer", onMouseUp: t.cellResizerMouseUp, onMouseDown: t.cellResizerMouseDownFunc(n) }) })
|
|
1102
1102
|
]
|
|
1103
1103
|
}
|
|
1104
1104
|
)
|
|
@@ -1180,7 +1180,7 @@ function An() {
|
|
|
1180
1180
|
return fe = e, fe;
|
|
1181
1181
|
}
|
|
1182
1182
|
var pe, je;
|
|
1183
|
-
function
|
|
1183
|
+
function Mn() {
|
|
1184
1184
|
if (je) return pe;
|
|
1185
1185
|
je = 1;
|
|
1186
1186
|
var t = An(), e = /^\s+/;
|
|
@@ -1197,7 +1197,7 @@ function ft() {
|
|
|
1197
1197
|
return ye = e, ye;
|
|
1198
1198
|
}
|
|
1199
1199
|
var ve, Ge;
|
|
1200
|
-
function
|
|
1200
|
+
function bn() {
|
|
1201
1201
|
if (Ge) return ve;
|
|
1202
1202
|
Ge = 1;
|
|
1203
1203
|
var t = ft(), e = Object.prototype, n = e.hasOwnProperty, s = e.toString, i = t ? t.toStringTag : void 0;
|
|
@@ -1227,36 +1227,36 @@ var Ae, Qe;
|
|
|
1227
1227
|
function En() {
|
|
1228
1228
|
if (Qe) return Ae;
|
|
1229
1229
|
Qe = 1;
|
|
1230
|
-
var t = ft(), e =
|
|
1230
|
+
var t = ft(), e = bn(), n = wn(), s = "[object Null]", i = "[object Undefined]", r = t ? t.toStringTag : void 0;
|
|
1231
1231
|
function o(l) {
|
|
1232
1232
|
return l == null ? l === void 0 ? i : s : r && r in Object(l) ? e(l) : n(l);
|
|
1233
1233
|
}
|
|
1234
1234
|
return Ae = o, Ae;
|
|
1235
1235
|
}
|
|
1236
|
-
var
|
|
1236
|
+
var Me, Ke;
|
|
1237
1237
|
function Cn() {
|
|
1238
|
-
if (Ke) return
|
|
1238
|
+
if (Ke) return Me;
|
|
1239
1239
|
Ke = 1;
|
|
1240
1240
|
function t(e) {
|
|
1241
1241
|
return e != null && typeof e == "object";
|
|
1242
1242
|
}
|
|
1243
|
-
return
|
|
1243
|
+
return Me = t, Me;
|
|
1244
1244
|
}
|
|
1245
|
-
var
|
|
1245
|
+
var be, Ze;
|
|
1246
1246
|
function Dn() {
|
|
1247
|
-
if (Ze) return
|
|
1247
|
+
if (Ze) return be;
|
|
1248
1248
|
Ze = 1;
|
|
1249
1249
|
var t = En(), e = Cn(), n = "[object Symbol]";
|
|
1250
1250
|
function s(i) {
|
|
1251
1251
|
return typeof i == "symbol" || e(i) && t(i) == n;
|
|
1252
1252
|
}
|
|
1253
|
-
return
|
|
1253
|
+
return be = s, be;
|
|
1254
1254
|
}
|
|
1255
1255
|
var we, Je;
|
|
1256
1256
|
function Tn() {
|
|
1257
1257
|
if (Je) return we;
|
|
1258
1258
|
Je = 1;
|
|
1259
|
-
var t =
|
|
1259
|
+
var t = Mn(), e = xe(), n = Dn(), s = NaN, i = /^[-+]0x[0-9a-f]+$/i, r = /^0b[01]+$/i, o = /^0o[0-7]+$/i, l = parseInt;
|
|
1260
1260
|
function c(d) {
|
|
1261
1261
|
if (typeof d == "number")
|
|
1262
1262
|
return d;
|
|
@@ -1280,16 +1280,16 @@ function Rn() {
|
|
|
1280
1280
|
et = 1;
|
|
1281
1281
|
var t = xe(), e = Sn(), n = Tn(), s = "Expected a function", i = Math.max, r = Math.min;
|
|
1282
1282
|
function o(l, c, d) {
|
|
1283
|
-
var m, g, h, u, A, p, v = 0,
|
|
1283
|
+
var m, g, h, u, A, p, v = 0, M = !1, f = !1, y = !0;
|
|
1284
1284
|
if (typeof l != "function")
|
|
1285
1285
|
throw new TypeError(s);
|
|
1286
|
-
c = n(c) || 0, t(d) && (
|
|
1286
|
+
c = n(c) || 0, t(d) && (M = !!d.leading, f = "maxWait" in d, h = f ? i(n(d.maxWait) || 0, c) : h, y = "trailing" in d ? !!d.trailing : y);
|
|
1287
1287
|
function S(R) {
|
|
1288
1288
|
var V = m, q = g;
|
|
1289
1289
|
return m = g = void 0, v = R, u = l.apply(q, V), u;
|
|
1290
1290
|
}
|
|
1291
|
-
function
|
|
1292
|
-
return v = R, A = setTimeout(I, c),
|
|
1291
|
+
function b(R) {
|
|
1292
|
+
return v = R, A = setTimeout(I, c), M ? S(R) : u;
|
|
1293
1293
|
}
|
|
1294
1294
|
function D(R) {
|
|
1295
1295
|
var V = R - p, q = R - v, Q = c - V;
|
|
@@ -1311,20 +1311,20 @@ function Rn() {
|
|
|
1311
1311
|
function Y() {
|
|
1312
1312
|
A !== void 0 && clearTimeout(A), v = 0, m = p = g = A = void 0;
|
|
1313
1313
|
}
|
|
1314
|
-
function
|
|
1314
|
+
function H() {
|
|
1315
1315
|
return A === void 0 ? u : P(e());
|
|
1316
1316
|
}
|
|
1317
1317
|
function _() {
|
|
1318
1318
|
var R = e(), V = T(R);
|
|
1319
1319
|
if (m = arguments, g = this, p = R, V) {
|
|
1320
1320
|
if (A === void 0)
|
|
1321
|
-
return
|
|
1321
|
+
return b(p);
|
|
1322
1322
|
if (f)
|
|
1323
1323
|
return clearTimeout(A), A = setTimeout(I, c), S(p);
|
|
1324
1324
|
}
|
|
1325
1325
|
return A === void 0 && (A = setTimeout(I, c)), u;
|
|
1326
1326
|
}
|
|
1327
|
-
return _.cancel = Y, _.flush =
|
|
1327
|
+
return _.cancel = Y, _.flush = H, _;
|
|
1328
1328
|
}
|
|
1329
1329
|
return Ee = o, Ee;
|
|
1330
1330
|
}
|
|
@@ -1348,15 +1348,15 @@ function kn() {
|
|
|
1348
1348
|
var xn = kn();
|
|
1349
1349
|
const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
1350
1350
|
const e = F(() => "schedulant-timeline-event-position-guide", []), n = k(0), s = k(0), i = k(0), r = k(!1), o = k("none"), l = C((f) => {
|
|
1351
|
-
const
|
|
1351
|
+
const b = t.schedulantApi.getScheduleView().getTimelineView(), D = f - n.current, T = t.timelineWidth, I = b.getTotalSlots(), P = Math.round(D / T * I), Y = P / I * T;
|
|
1352
1352
|
return { moveSlots: P, distance: Y, deltaX: D };
|
|
1353
1353
|
}, [t]), c = C((f) => {
|
|
1354
|
-
const y = t.schedulantApi.getScheduleView().getTimelineView(), S = f.style.left,
|
|
1354
|
+
const y = t.schedulantApi.getScheduleView().getTimelineView(), S = f.style.left, b = f.style.right, D = y.calculateLaneHeight(t.resourceApi), T = document.createElement("div");
|
|
1355
1355
|
T.className = e, Object.assign(T.style, {
|
|
1356
1356
|
position: "absolute",
|
|
1357
1357
|
zIndex: 1,
|
|
1358
1358
|
left: S,
|
|
1359
|
-
right:
|
|
1359
|
+
right: b,
|
|
1360
1360
|
height: w(D),
|
|
1361
1361
|
backgroundColor: t.schedulantApi.getDragHintColor()
|
|
1362
1362
|
}), f.parentNode?.insertBefore(T, f);
|
|
@@ -1366,8 +1366,8 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1366
1366
|
}, [e]), m = C((f, y) => {
|
|
1367
1367
|
const S = f.previousElementSibling;
|
|
1368
1368
|
if (S && S.className === e) {
|
|
1369
|
-
const
|
|
1370
|
-
switch (
|
|
1369
|
+
const b = o.current, { distance: D } = l(y);
|
|
1370
|
+
switch (b) {
|
|
1371
1371
|
case "press_event": {
|
|
1372
1372
|
S.style.left = w(Math.max(s.current + D, 0)), S.style.right = w(i.current - D);
|
|
1373
1373
|
break;
|
|
@@ -1385,17 +1385,17 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1385
1385
|
}
|
|
1386
1386
|
}
|
|
1387
1387
|
}, [l, e]), g = C((f, y) => {
|
|
1388
|
-
const S = t.eventApi,
|
|
1388
|
+
const S = t.eventApi, b = t.schedulantApi, D = o.current, { moveSlots: T, distance: I } = l(y);
|
|
1389
1389
|
switch (D) {
|
|
1390
1390
|
case "press_event": {
|
|
1391
1391
|
f.style.left = w(Math.max(s.current + I, 0)), f.style.right = w(i.current - I);
|
|
1392
1392
|
const P = S.getStart().add(T, "day"), Y = S.getEnd().add(T, "day");
|
|
1393
|
-
|
|
1393
|
+
b.eventMove({
|
|
1394
1394
|
el: f,
|
|
1395
1395
|
startDate: P,
|
|
1396
1396
|
endDate: Y,
|
|
1397
1397
|
eventApi: S,
|
|
1398
|
-
schedulantApi:
|
|
1398
|
+
schedulantApi: b
|
|
1399
1399
|
});
|
|
1400
1400
|
break;
|
|
1401
1401
|
}
|
|
@@ -1403,11 +1403,11 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1403
1403
|
const P = Math.max(s.current + I, 0);
|
|
1404
1404
|
f.style.left = w(P);
|
|
1405
1405
|
const Y = S.getStart().add(T, "day");
|
|
1406
|
-
|
|
1406
|
+
b.eventResizeStart({
|
|
1407
1407
|
el: f,
|
|
1408
1408
|
date: Y,
|
|
1409
1409
|
eventApi: S,
|
|
1410
|
-
schedulantApi:
|
|
1410
|
+
schedulantApi: b
|
|
1411
1411
|
});
|
|
1412
1412
|
break;
|
|
1413
1413
|
}
|
|
@@ -1415,11 +1415,11 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1415
1415
|
const P = i.current - I;
|
|
1416
1416
|
f.style.right = w(P);
|
|
1417
1417
|
const Y = S.getEnd().add(T, "day");
|
|
1418
|
-
|
|
1418
|
+
b.eventResizeEnd({
|
|
1419
1419
|
el: f,
|
|
1420
1420
|
date: Y,
|
|
1421
1421
|
eventApi: S,
|
|
1422
|
-
schedulantApi:
|
|
1422
|
+
schedulantApi: b
|
|
1423
1423
|
});
|
|
1424
1424
|
break;
|
|
1425
1425
|
}
|
|
@@ -1428,7 +1428,7 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1428
1428
|
f.preventDefault();
|
|
1429
1429
|
const y = r.current, S = t.timelineEventHarnessRef.current;
|
|
1430
1430
|
if (y && S) {
|
|
1431
|
-
const { deltaX:
|
|
1431
|
+
const { deltaX: b } = l(f.clientX), D = s.current + b, T = i.current - b;
|
|
1432
1432
|
switch (o.current) {
|
|
1433
1433
|
case "press_event":
|
|
1434
1434
|
S.style.left = w(D), S.style.right = w(T);
|
|
@@ -1447,26 +1447,26 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1447
1447
|
[h]
|
|
1448
1448
|
), A = C((f, y) => {
|
|
1449
1449
|
f.preventDefault();
|
|
1450
|
-
const S = t.schedulantApi.getSchedulantElRef().current,
|
|
1451
|
-
|
|
1450
|
+
const S = t.schedulantApi.getSchedulantElRef().current, b = t.timelineEventHarnessRef.current;
|
|
1451
|
+
b && S ? (r.current = !0, o.current = y, n.current = f.clientX, s.current = oe(b.style.left), i.current = oe(b.style.right), c(b), S.addEventListener("mousemove", u)) : (console.error("scheduleEl", S), console.error("timelineEventHarness", b));
|
|
1452
1452
|
}, [t.schedulantApi, t.timelineEventHarnessRef, c, u]), p = C((f) => {
|
|
1453
1453
|
A(f, "press_event");
|
|
1454
1454
|
}, [A]), v = C((f) => {
|
|
1455
1455
|
A(f, "press_event_left");
|
|
1456
|
-
}, [A]),
|
|
1456
|
+
}, [A]), M = C((f) => {
|
|
1457
1457
|
A(f, "press_event_right");
|
|
1458
1458
|
}, [A]);
|
|
1459
1459
|
return N(() => {
|
|
1460
1460
|
const f = t.timelineEventHarnessRef.current, y = t.schedulantApi.getSchedulantElRef().current;
|
|
1461
1461
|
if (y && f) {
|
|
1462
|
-
const S = (
|
|
1463
|
-
|
|
1462
|
+
const S = (b) => {
|
|
1463
|
+
b.preventDefault(), r.current && (d(f), g(f, b.clientX), y.removeEventListener("mousemove", u), r.current = !1, o.current = "none");
|
|
1464
1464
|
};
|
|
1465
1465
|
return document.addEventListener("mouseup", S), () => {
|
|
1466
1466
|
document.removeEventListener("mouseup", S), y.removeEventListener("mousemove", u), u.cancel();
|
|
1467
1467
|
};
|
|
1468
1468
|
}
|
|
1469
|
-
}, [u, t, d, g]), { handleMouseDown: p, leftHandleMouseDown: v, rightHandleMouseDown:
|
|
1469
|
+
}, [u, t, d, g]), { handleMouseDown: p, leftHandleMouseDown: v, rightHandleMouseDown: M };
|
|
1470
1470
|
}, nt = (t) => /* @__PURE__ */ a(X, { component: () => /* @__PURE__ */ a(
|
|
1471
1471
|
"svg",
|
|
1472
1472
|
{
|
|
@@ -1534,8 +1534,8 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1534
1534
|
trigger: ["contextMenu"],
|
|
1535
1535
|
menu: {
|
|
1536
1536
|
items: t.schedulantApi.getEventContextMenuItems(),
|
|
1537
|
-
onClick: (
|
|
1538
|
-
const { key: f, keyPath: y, domEvent: S } =
|
|
1537
|
+
onClick: (M) => {
|
|
1538
|
+
const { key: f, keyPath: y, domEvent: S } = M;
|
|
1539
1539
|
t.schedulantApi.onEventContextMenuClick({
|
|
1540
1540
|
key: f,
|
|
1541
1541
|
keyPath: y,
|
|
@@ -1556,11 +1556,11 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1556
1556
|
ref: e,
|
|
1557
1557
|
children: [
|
|
1558
1558
|
/* @__PURE__ */ a(
|
|
1559
|
-
|
|
1559
|
+
z,
|
|
1560
1560
|
{
|
|
1561
1561
|
condition: t.schedulantApi.isEditable(),
|
|
1562
1562
|
fallback: /* @__PURE__ */ a(
|
|
1563
|
-
|
|
1563
|
+
z,
|
|
1564
1564
|
{
|
|
1565
1565
|
condition: t.eventApi.getStart().isBefore(s.getStart()),
|
|
1566
1566
|
fallback: /* @__PURE__ */ a("div", { style: { width: W, height: d } }),
|
|
@@ -1568,7 +1568,7 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1568
1568
|
}
|
|
1569
1569
|
),
|
|
1570
1570
|
children: /* @__PURE__ */ a(
|
|
1571
|
-
|
|
1571
|
+
z,
|
|
1572
1572
|
{
|
|
1573
1573
|
condition: !t.eventApi.getStart().isBefore(s.getStart()),
|
|
1574
1574
|
fallback: /* @__PURE__ */ a(nt, { width: W, height: d, color: "#FFFFFF" }),
|
|
@@ -1586,7 +1586,7 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1586
1586
|
}
|
|
1587
1587
|
),
|
|
1588
1588
|
/* @__PURE__ */ a(
|
|
1589
|
-
|
|
1589
|
+
z,
|
|
1590
1590
|
{
|
|
1591
1591
|
condition: t.schedulantApi.isEditable() && !t.eventApi.getStart().isBefore(s.getStart()) && t.eventApi.getEnd().isSameOrBefore(s.getEnd()),
|
|
1592
1592
|
fallback: /* @__PURE__ */ a(
|
|
@@ -1595,7 +1595,7 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1595
1595
|
className: "schedulant-event-main",
|
|
1596
1596
|
style: { color: r, width: `calc(100% - ${W * 2}px)` },
|
|
1597
1597
|
children: /* @__PURE__ */ a(
|
|
1598
|
-
|
|
1598
|
+
z,
|
|
1599
1599
|
{
|
|
1600
1600
|
condition: t.eventApi.getUrl().isDefined(),
|
|
1601
1601
|
fallback: /* @__PURE__ */ a("span", { children: t.eventApi.getTitle() }),
|
|
@@ -1618,7 +1618,7 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1618
1618
|
style: { color: r, width: `calc(100% - ${W * 2}px)`, cursor: "grab" },
|
|
1619
1619
|
onMouseDown: A,
|
|
1620
1620
|
children: /* @__PURE__ */ a(
|
|
1621
|
-
|
|
1621
|
+
z,
|
|
1622
1622
|
{
|
|
1623
1623
|
condition: t.eventApi.getUrl().isDefined(),
|
|
1624
1624
|
fallback: /* @__PURE__ */ a("span", { children: t.eventApi.getTitle() }),
|
|
@@ -1637,11 +1637,11 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1637
1637
|
}
|
|
1638
1638
|
),
|
|
1639
1639
|
/* @__PURE__ */ a(
|
|
1640
|
-
|
|
1640
|
+
z,
|
|
1641
1641
|
{
|
|
1642
1642
|
condition: t.schedulantApi.isEditable(),
|
|
1643
1643
|
fallback: /* @__PURE__ */ a(
|
|
1644
|
-
|
|
1644
|
+
z,
|
|
1645
1645
|
{
|
|
1646
1646
|
condition: t.eventApi.getEnd().isAfter(s.getEnd()),
|
|
1647
1647
|
fallback: /* @__PURE__ */ a("div", { style: { width: W, height: d } }),
|
|
@@ -1649,7 +1649,7 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1649
1649
|
}
|
|
1650
1650
|
),
|
|
1651
1651
|
children: /* @__PURE__ */ a(
|
|
1652
|
-
|
|
1652
|
+
z,
|
|
1653
1653
|
{
|
|
1654
1654
|
condition: t.eventApi.getEnd().isSameOrBefore(s.getEnd()),
|
|
1655
1655
|
fallback: /* @__PURE__ */ a(it, { width: W, height: d, color: "#FFFFFF" }),
|
|
@@ -1696,37 +1696,37 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1696
1696
|
}, [e, n, t, i, r, o]), { isPast: i, isFuture: r, isProcess: o };
|
|
1697
1697
|
}, yt = (t) => {
|
|
1698
1698
|
const e = F(() => "schedulant-timeline-marker-position-guide", []), n = k(0), s = k(0), i = k(0), r = k(!1), o = C((p) => {
|
|
1699
|
-
const v = p.style.left,
|
|
1700
|
-
|
|
1699
|
+
const v = p.style.left, M = p.style.right, f = t.schedulantApi.getScheduleView().getTimelineView(), y = t.milestoneApi?.getResourceApi() ?? t.checkpointApi?.getResourceApi(), S = f.calculateLaneHeight(y), b = document.createElement("div");
|
|
1700
|
+
b.className = e, Object.assign(b.style, {
|
|
1701
1701
|
position: "absolute",
|
|
1702
1702
|
zIndex: 1,
|
|
1703
1703
|
left: v,
|
|
1704
|
-
right:
|
|
1704
|
+
right: M,
|
|
1705
1705
|
height: w(S),
|
|
1706
1706
|
backgroundColor: t.schedulantApi.getDragHintColor()
|
|
1707
|
-
}), p.parentNode?.insertBefore(
|
|
1707
|
+
}), p.parentNode?.insertBefore(b, p);
|
|
1708
1708
|
}, [t, e]), l = C((p) => {
|
|
1709
1709
|
const v = p.previousElementSibling;
|
|
1710
1710
|
v?.className === e && p.parentElement?.removeChild(v);
|
|
1711
1711
|
}, [e]), c = C((p) => {
|
|
1712
|
-
const f = t.schedulantApi.getScheduleView().getTimelineView(), y = p - n.current, S = t.timelineWidth,
|
|
1712
|
+
const f = t.schedulantApi.getScheduleView().getTimelineView(), y = p - n.current, S = t.timelineWidth, b = f.getTotalSlots(), D = Math.round(y / S * b), T = D / b * t.timelineWidth;
|
|
1713
1713
|
return {
|
|
1714
1714
|
moveSlots: D,
|
|
1715
1715
|
distance: T,
|
|
1716
1716
|
deltaX: y,
|
|
1717
1717
|
totalWidth: S,
|
|
1718
|
-
totalSlots:
|
|
1718
|
+
totalSlots: b
|
|
1719
1719
|
};
|
|
1720
1720
|
}, [t]), d = C((p, v) => {
|
|
1721
|
-
const
|
|
1722
|
-
if (
|
|
1721
|
+
const M = p.previousElementSibling;
|
|
1722
|
+
if (M && M.className === e) {
|
|
1723
1723
|
const { distance: f } = c(v);
|
|
1724
|
-
|
|
1724
|
+
M.style.left = w(Math.max(s.current + f, 0)), M.style.right = w(i.current - f);
|
|
1725
1725
|
}
|
|
1726
1726
|
}, [e, c]), m = C((p, v) => {
|
|
1727
|
-
const { moveSlots:
|
|
1727
|
+
const { moveSlots: M, distance: f } = c(v);
|
|
1728
1728
|
if (p.style.left = w(Math.max(s.current + f, 0)), p.style.right = w(i.current - f), t.milestoneApi) {
|
|
1729
|
-
const y = t.milestoneApi.getTime().add(
|
|
1729
|
+
const y = t.milestoneApi.getTime().add(M, "day");
|
|
1730
1730
|
t.schedulantApi.milestoneMove({
|
|
1731
1731
|
el: p,
|
|
1732
1732
|
date: y,
|
|
@@ -1734,7 +1734,7 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1734
1734
|
milestoneApi: t.milestoneApi
|
|
1735
1735
|
});
|
|
1736
1736
|
} else if (t.checkpointApi) {
|
|
1737
|
-
const y = t.checkpointApi.getTime().add(
|
|
1737
|
+
const y = t.checkpointApi.getTime().add(M, "day");
|
|
1738
1738
|
t.schedulantApi.checkpointMove({
|
|
1739
1739
|
el: p,
|
|
1740
1740
|
date: y,
|
|
@@ -1745,8 +1745,8 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1745
1745
|
n.current = 0;
|
|
1746
1746
|
}, [t, c]), g = C((p) => {
|
|
1747
1747
|
p.preventDefault();
|
|
1748
|
-
const v = t.markerRef.current,
|
|
1749
|
-
if (v &&
|
|
1748
|
+
const v = t.markerRef.current, M = r.current;
|
|
1749
|
+
if (v && M) {
|
|
1750
1750
|
const f = p.clientX - n.current, y = s.current + f, S = i.current - f;
|
|
1751
1751
|
v.style.left = w(y), v.style.right = w(S), d(v, p.clientX);
|
|
1752
1752
|
}
|
|
@@ -1755,23 +1755,23 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1755
1755
|
[g]
|
|
1756
1756
|
), u = C((p) => {
|
|
1757
1757
|
p.preventDefault();
|
|
1758
|
-
const v = t.markerRef.current,
|
|
1759
|
-
|
|
1758
|
+
const v = t.markerRef.current, M = r.current, f = t.schedulantApi.getSchedulantElRef().current;
|
|
1759
|
+
M && f && v && (l(v), m(v, p.clientX), f.removeEventListener("mousemove", h), r.current = !1);
|
|
1760
1760
|
}, [h, t.markerRef, t.schedulantApi, l, m]), A = C((p) => {
|
|
1761
1761
|
p.preventDefault();
|
|
1762
|
-
const v = t.schedulantApi.getSchedulantElRef().current,
|
|
1763
|
-
v &&
|
|
1762
|
+
const v = t.schedulantApi.getSchedulantElRef().current, M = t.markerRef.current;
|
|
1763
|
+
v && M && (r.current = !0, n.current = p.clientX, s.current = oe(M.style.left), i.current = oe(M.style.right), o(M), v.addEventListener("mousemove", h));
|
|
1764
1764
|
}, [o, h, t.markerRef, t.schedulantApi]);
|
|
1765
1765
|
return N(() => {
|
|
1766
1766
|
const p = t.schedulantApi.getSchedulantElRef().current, v = t.markerRef.current;
|
|
1767
1767
|
if (p && v) {
|
|
1768
|
-
const
|
|
1769
|
-
if (
|
|
1768
|
+
const M = v.parentElement?.parentElement;
|
|
1769
|
+
if (M) {
|
|
1770
1770
|
const f = (y) => {
|
|
1771
|
-
y.preventDefault(), r.current && !
|
|
1771
|
+
y.preventDefault(), r.current && !M.contains(y.relatedTarget) && (l(v), m(v, y.clientX), p.removeEventListener("mousemove", h), r.current = !1);
|
|
1772
1772
|
};
|
|
1773
|
-
return
|
|
1774
|
-
|
|
1773
|
+
return M.addEventListener("mouseup", f), M.addEventListener("mouseout", f), () => {
|
|
1774
|
+
M.removeEventListener("mouseup", f), M.removeEventListener("mouseout", f), p.removeEventListener("mousemove", h), h.cancel();
|
|
1775
1775
|
};
|
|
1776
1776
|
}
|
|
1777
1777
|
}
|
|
@@ -1826,11 +1826,11 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1826
1826
|
menu: {
|
|
1827
1827
|
items: t.schedulantApi.getMilestoneContextMenuItems(),
|
|
1828
1828
|
onClick: (A) => {
|
|
1829
|
-
const { key: p, keyPath: v, domEvent:
|
|
1829
|
+
const { key: p, keyPath: v, domEvent: M } = A;
|
|
1830
1830
|
t.schedulantApi.onMilestoneContextMenuClick({
|
|
1831
1831
|
key: p,
|
|
1832
1832
|
keyPath: v,
|
|
1833
|
-
domEvent:
|
|
1833
|
+
domEvent: M,
|
|
1834
1834
|
isPast: c,
|
|
1835
1835
|
isFuture: d,
|
|
1836
1836
|
isProcess: m,
|
|
@@ -1845,7 +1845,7 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1845
1845
|
className: `schedulant-timeline-milestone${m ? " schedulant-milestone-today" : ""}`,
|
|
1846
1846
|
style: m ? { "--milestone-glow-color": g } : void 0,
|
|
1847
1847
|
ref: e,
|
|
1848
|
-
children: /* @__PURE__ */ a("div", { className: "schedulant-milestone-main", children: /* @__PURE__ */ a(Ln, { width: o *
|
|
1848
|
+
children: /* @__PURE__ */ a("div", { className: "schedulant-milestone-main", children: /* @__PURE__ */ a(Ln, { width: o * He, height: o * He, color: g }) })
|
|
1849
1849
|
}
|
|
1850
1850
|
)
|
|
1851
1851
|
}
|
|
@@ -1934,11 +1934,11 @@ const pt = /* @__PURE__ */ yn(xn), On = (t) => {
|
|
|
1934
1934
|
menu: {
|
|
1935
1935
|
items: t.schedulantApi.getCheckpointContextMenuItems(),
|
|
1936
1936
|
onClick: (A) => {
|
|
1937
|
-
const { key: p, keyPath: v, domEvent:
|
|
1937
|
+
const { key: p, keyPath: v, domEvent: M } = A;
|
|
1938
1938
|
t.schedulantApi.onCheckpointContextMenuClick({
|
|
1939
1939
|
key: p,
|
|
1940
1940
|
keyPath: v,
|
|
1941
|
-
domEvent:
|
|
1941
|
+
domEvent: M,
|
|
1942
1942
|
isPast: d,
|
|
1943
1943
|
isFuture: m,
|
|
1944
1944
|
isProcess: g,
|
|
@@ -2023,7 +2023,7 @@ class J {
|
|
|
2023
2023
|
const ee = (t) => {
|
|
2024
2024
|
const { dates: e, minWidth: n } = t;
|
|
2025
2025
|
return /* @__PURE__ */ a("colgroup", { children: e.map((s) => /* @__PURE__ */ a("col", { style: { minWidth: n } }, s.format("YYYY-MM-DD"))) });
|
|
2026
|
-
},
|
|
2026
|
+
}, zn = (t, e, n) => {
|
|
2027
2027
|
const s = n.isBefore(E(), "day"), i = n.isAfter(E(), "day"), r = n.isSame(E(), "day");
|
|
2028
2028
|
N(() => {
|
|
2029
2029
|
const o = t.current;
|
|
@@ -2050,7 +2050,7 @@ const ee = (t) => {
|
|
|
2050
2050
|
}, [n, i, s, r, e, t]);
|
|
2051
2051
|
}, te = ae((t) => {
|
|
2052
2052
|
const e = k(null);
|
|
2053
|
-
return
|
|
2053
|
+
return zn(e, t.schedulantApi, t.date), /* @__PURE__ */ a(
|
|
2054
2054
|
"td",
|
|
2055
2055
|
{
|
|
2056
2056
|
ref: e,
|
|
@@ -2060,7 +2060,7 @@ const ee = (t) => {
|
|
|
2060
2060
|
},
|
|
2061
2061
|
t.date.format("YYYY-MM-DD")
|
|
2062
2062
|
);
|
|
2063
|
-
}),
|
|
2063
|
+
}), Hn = (t, e, n, s, i) => {
|
|
2064
2064
|
const r = n.isBefore(E(), "day"), o = n.isAfter(E(), "day"), l = n.isSame(E(), "day");
|
|
2065
2065
|
N(() => {
|
|
2066
2066
|
const c = t.current;
|
|
@@ -2091,7 +2091,7 @@ const ee = (t) => {
|
|
|
2091
2091
|
}, [n, o, r, l, s, e, i, t]);
|
|
2092
2092
|
}, B = (t) => {
|
|
2093
2093
|
const e = k(null);
|
|
2094
|
-
return
|
|
2094
|
+
return Hn(e, t.schedulantApi, t.date, t.level, t.timeText), /* @__PURE__ */ a(
|
|
2095
2095
|
"th",
|
|
2096
2096
|
{
|
|
2097
2097
|
ref: e,
|
|
@@ -2303,7 +2303,7 @@ class Bn extends J {
|
|
|
2303
2303
|
] });
|
|
2304
2304
|
}
|
|
2305
2305
|
calculatePosition(e, n, s) {
|
|
2306
|
-
const i = this.getTimelineApi(), r = i.getQuarters(), o = e / r.length, l = n.isBefore(i.getStart()) ? i.getStart() : n, c = s.isAfter(i.getEnd()) ? i.getEnd() : s, d = l.endOf("quarter").diff(l.startOf("quarter"), "day") + 1, m = n.diff(l.startOf("quarter"), "day"), g = o / d, h = m * g, u = i.getQuarterPosition(l) * o, A = n.isSameOrBefore(i.getStart(), "day") ? u : u + h, p = c.endOf("quarter").diff(c.startOf("quarter"), "day") + 1, v = c.endOf("quarter").diff(c, "day"),
|
|
2306
|
+
const i = this.getTimelineApi(), r = i.getQuarters(), o = e / r.length, l = n.isBefore(i.getStart()) ? i.getStart() : n, c = s.isAfter(i.getEnd()) ? i.getEnd() : s, d = l.endOf("quarter").diff(l.startOf("quarter"), "day") + 1, m = n.diff(l.startOf("quarter"), "day"), g = o / d, h = m * g, u = i.getQuarterPosition(l) * o, A = n.isSameOrBefore(i.getStart(), "day") ? u : u + h, p = c.endOf("quarter").diff(c.startOf("quarter"), "day") + 1, v = c.endOf("quarter").diff(c, "day"), M = o / p, f = v * M, y = (i.getQuarterPosition(c) + 1) * o * -1, S = s.isBefore(i.getEnd(), "day") ? y + f : y;
|
|
2307
2307
|
return { left: A, right: S };
|
|
2308
2308
|
}
|
|
2309
2309
|
}
|
|
@@ -2387,7 +2387,7 @@ class Un extends J {
|
|
|
2387
2387
|
)) }) });
|
|
2388
2388
|
}
|
|
2389
2389
|
calculatePosition(e, n, s) {
|
|
2390
|
-
const i = this.getTimelineApi(), r = i.getYears(), o = e / r.length, l = n.isBefore(i.getStart()) ? i.getStart() : n, c = s.isAfter(i.getEnd()) ? i.getEnd() : s, d = l.endOf("year").diff(l.startOf("year"), "day") + 1, m = l.diff(l.startOf("year"), "day"), g = o / d, h = m * g, u = i.getYearPosition(l) * o, A = n.isSameOrBefore(i.getStart(), "day") ? u : u + h, p = c.endOf("year").diff(c.startOf("year"), "day") + 1, v = c.endOf("year").diff(c, "day"),
|
|
2390
|
+
const i = this.getTimelineApi(), r = i.getYears(), o = e / r.length, l = n.isBefore(i.getStart()) ? i.getStart() : n, c = s.isAfter(i.getEnd()) ? i.getEnd() : s, d = l.endOf("year").diff(l.startOf("year"), "day") + 1, m = l.diff(l.startOf("year"), "day"), g = o / d, h = m * g, u = i.getYearPosition(l) * o, A = n.isSameOrBefore(i.getStart(), "day") ? u : u + h, p = c.endOf("year").diff(c.startOf("year"), "day") + 1, v = c.endOf("year").diff(c, "day"), M = o / p, f = v * M, y = (i.getYearPosition(c) + 1) * o * -1, S = s.isBefore(i.getEnd(), "day") ? y + f : y;
|
|
2391
2391
|
return { left: A, right: S };
|
|
2392
2392
|
}
|
|
2393
2393
|
}
|
|
@@ -2559,7 +2559,7 @@ const Kn = (t, e) => {
|
|
|
2559
2559
|
r.current !== null && (r.current = null, i.current = null, s((y) => ({ ...y, overId: null, dropPosition: null })));
|
|
2560
2560
|
return;
|
|
2561
2561
|
}
|
|
2562
|
-
const
|
|
2562
|
+
const M = A.clientY + p.y, f = Xn(M, {
|
|
2563
2563
|
top: u.rect.top,
|
|
2564
2564
|
height: u.rect.height
|
|
2565
2565
|
});
|
|
@@ -2597,28 +2597,28 @@ const Kn = (t, e) => {
|
|
|
2597
2597
|
x: t.x + 20,
|
|
2598
2598
|
y: t.y + 20
|
|
2599
2599
|
} : t, Jn = (t) => {
|
|
2600
|
-
const { schedulantView: e, virtualizer: n, visibleResources: s, collapseIds: i, cellResizerMouseUp: r, cellResizerMouseDownFunc: o } = t, l = e.getScheduleApi(), c = l.getFlatMapResourceApis(), d = C(async (
|
|
2601
|
-
const P = c.find((
|
|
2600
|
+
const { schedulantView: e, virtualizer: n, visibleResources: s, collapseIds: i, cellResizerMouseUp: r, cellResizerMouseDownFunc: o } = t, l = e.getScheduleApi(), c = l.getFlatMapResourceApis(), d = C(async (b, D, T, I) => {
|
|
2601
|
+
const P = c.find((H) => H.getId() === D), Y = c.find((H) => H.getId() === T);
|
|
2602
2602
|
if (P && Y) {
|
|
2603
|
-
const
|
|
2603
|
+
const H = P.getParent();
|
|
2604
2604
|
l.resourceLaneMove({
|
|
2605
|
-
el:
|
|
2605
|
+
el: b,
|
|
2606
2606
|
schedulantApi: l,
|
|
2607
2607
|
draggedResourceApi: P,
|
|
2608
2608
|
targetResourceApi: Y,
|
|
2609
2609
|
position: I,
|
|
2610
|
-
oldParentResourceApi:
|
|
2610
|
+
oldParentResourceApi: H.isDefined() ? H.get() : void 0
|
|
2611
2611
|
});
|
|
2612
2612
|
}
|
|
2613
2613
|
}, [l, c]), { dragState: m, handleDragStart: g, handleDragMove: h, handleDragEnd: u, handleDragCancel: A } = Kn(c, d), p = Nt(
|
|
2614
2614
|
_e(Yt, { activationConstraint: { delay: 300, tolerance: 5 } }),
|
|
2615
2615
|
_e(_t)
|
|
2616
|
-
), v = s.map((
|
|
2616
|
+
), v = s.map((b) => b.getId()), M = l.isEditable(), f = n.getVirtualItems(), y = n.getTotalSize(), S = F(() => m.activeId ? c.find((b) => b.getId() === String(m.activeId)) ?? null : null, [m.activeId, c]);
|
|
2617
2617
|
return /* @__PURE__ */ O(
|
|
2618
2618
|
Wt,
|
|
2619
2619
|
{
|
|
2620
2620
|
sensors: p,
|
|
2621
|
-
collisionDetection:
|
|
2621
|
+
collisionDetection: zt,
|
|
2622
2622
|
modifiers: [Vt],
|
|
2623
2623
|
onDragStart: g,
|
|
2624
2624
|
onDragMove: h,
|
|
@@ -2634,13 +2634,13 @@ const Kn = (t, e) => {
|
|
|
2634
2634
|
children: [
|
|
2635
2635
|
e.renderResourceTableColgroup(),
|
|
2636
2636
|
e.renderResourceLane(s, f, y, i, r, o, {
|
|
2637
|
-
isDraggable:
|
|
2637
|
+
isDraggable: M,
|
|
2638
2638
|
dragState: m
|
|
2639
2639
|
})
|
|
2640
2640
|
]
|
|
2641
2641
|
}
|
|
2642
2642
|
) }),
|
|
2643
|
-
/* @__PURE__ */ a(
|
|
2643
|
+
/* @__PURE__ */ a(Ht, { dropAnimation: null, modifiers: [Zn], children: S ? /* @__PURE__ */ a("div", { className: "schedulant-drag-overlay", children: S.getTitle() }) : null })
|
|
2644
2644
|
]
|
|
2645
2645
|
}
|
|
2646
2646
|
);
|
|
@@ -2648,31 +2648,22 @@ const Kn = (t, e) => {
|
|
|
2648
2648
|
t.schedulantView.renderTimelineTableColgroup(),
|
|
2649
2649
|
t.schedulantView.renderTimelineBodyTableSlots()
|
|
2650
2650
|
] }) }), ts = () => {
|
|
2651
|
-
const t =
|
|
2652
|
-
const l = document.getElementsByClassName("schedulant-timeline-head").item(0).getElementsByTagName("table").item(0)?.offsetWidth;
|
|
2653
|
-
return l || 0;
|
|
2654
|
-
}, []), [e, n] = re(0), { state: s } = Te();
|
|
2651
|
+
const [t, e] = re(0), { state: n } = Te();
|
|
2655
2652
|
return Et(() => {
|
|
2656
|
-
const
|
|
2657
|
-
|
|
2658
|
-
|
|
2653
|
+
const r = document.getElementsByClassName("schedulant-timeline-head").item(0)?.getElementsByTagName("table").item(0);
|
|
2654
|
+
if (!r) return;
|
|
2655
|
+
const o = () => {
|
|
2656
|
+
const c = r.offsetWidth;
|
|
2657
|
+
e((d) => d !== c ? c : d);
|
|
2659
2658
|
};
|
|
2660
|
-
|
|
2661
|
-
const
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
requestAnimationFrame(i);
|
|
2667
|
-
}), c.observe(l, {
|
|
2668
|
-
childList: !0,
|
|
2669
|
-
subtree: !0,
|
|
2670
|
-
attributes: !0,
|
|
2671
|
-
attributeFilter: ["style", "class"]
|
|
2672
|
-
})), () => {
|
|
2673
|
-
window.removeEventListener("resize", r), c?.disconnect();
|
|
2659
|
+
o();
|
|
2660
|
+
const l = new ResizeObserver(() => {
|
|
2661
|
+
o();
|
|
2662
|
+
});
|
|
2663
|
+
return l.observe(r), window.addEventListener("resize", o), () => {
|
|
2664
|
+
l.disconnect(), window.removeEventListener("resize", o);
|
|
2674
2665
|
};
|
|
2675
|
-
}, [
|
|
2666
|
+
}, [n.resourceAreaWidth]), t;
|
|
2676
2667
|
}, ns = (t) => {
|
|
2677
2668
|
const e = ts(), n = t.virtualizer.getVirtualItems(), s = t.virtualizer.getTotalSize();
|
|
2678
2669
|
return /* @__PURE__ */ a(
|
|
@@ -2711,13 +2702,13 @@ function $(t, e, n) {
|
|
|
2711
2702
|
s = g;
|
|
2712
2703
|
let u;
|
|
2713
2704
|
if (n.key && ((c = n.debug) != null && c.call(n)) && (u = Date.now()), i = e(...g), n.key && ((d = n.debug) != null && d.call(n))) {
|
|
2714
|
-
const A = Math.round((Date.now() - m) * 100) / 100, p = Math.round((Date.now() - u) * 100) / 100, v = p / 16,
|
|
2705
|
+
const A = Math.round((Date.now() - m) * 100) / 100, p = Math.round((Date.now() - u) * 100) / 100, v = p / 16, M = (f, y) => {
|
|
2715
2706
|
for (f = String(f); f.length < y; )
|
|
2716
2707
|
f = " " + f;
|
|
2717
2708
|
return f;
|
|
2718
2709
|
};
|
|
2719
2710
|
console.info(
|
|
2720
|
-
`%c⏱ ${
|
|
2711
|
+
`%c⏱ ${M(p, 5)} /${M(A, 5)} ms`,
|
|
2721
2712
|
`
|
|
2722
2713
|
font-size: .6rem;
|
|
2723
2714
|
font-weight: bold;
|
|
@@ -2994,13 +2985,13 @@ class hs {
|
|
|
2994
2985
|
let p, v;
|
|
2995
2986
|
if (A !== void 0 && this.options.lanes > 1) {
|
|
2996
2987
|
p = A;
|
|
2997
|
-
const S = g[p],
|
|
2998
|
-
v =
|
|
2988
|
+
const S = g[p], b = S !== void 0 ? m[S] : void 0;
|
|
2989
|
+
v = b ? b.end + this.options.gap : s + i;
|
|
2999
2990
|
} else {
|
|
3000
2991
|
const S = this.options.lanes === 1 ? m[h - 1] : this.getFurthestMeasurement(m, h);
|
|
3001
2992
|
v = S ? S.end + this.options.gap : s + i, p = S ? S.lane : h % this.options.lanes, this.options.lanes > 1 && this.laneAssignments.set(h, p);
|
|
3002
2993
|
}
|
|
3003
|
-
const
|
|
2994
|
+
const M = c.get(u), f = typeof M == "number" ? M : this.options.estimateSize(h), y = v + f;
|
|
3004
2995
|
m[h] = {
|
|
3005
2996
|
index: h,
|
|
3006
2997
|
start: v,
|
|
@@ -3356,17 +3347,17 @@ const ys = (t, e, n, s) => {
|
|
|
3356
3347
|
slotMinWidth: A,
|
|
3357
3348
|
schedulantMaxHeight: p,
|
|
3358
3349
|
schedulantViewType: v,
|
|
3359
|
-
events:
|
|
3350
|
+
events: M,
|
|
3360
3351
|
resources: f,
|
|
3361
3352
|
milestones: y,
|
|
3362
3353
|
checkpoints: S,
|
|
3363
|
-
resourceAreaColumns:
|
|
3354
|
+
resourceAreaColumns: b,
|
|
3364
3355
|
resourceAreaWidth: D,
|
|
3365
3356
|
companyHolidays: T,
|
|
3366
3357
|
specialWorkdays: I,
|
|
3367
3358
|
nationalHolidays: P,
|
|
3368
3359
|
dragHintColor: Y,
|
|
3369
|
-
selectionColor:
|
|
3360
|
+
selectionColor: H
|
|
3370
3361
|
} = t, _ = F(
|
|
3371
3362
|
() => new jn(t, s),
|
|
3372
3363
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -3379,17 +3370,17 @@ const ys = (t, e, n, s) => {
|
|
|
3379
3370
|
A,
|
|
3380
3371
|
p,
|
|
3381
3372
|
v,
|
|
3382
|
-
|
|
3373
|
+
M,
|
|
3383
3374
|
f,
|
|
3384
3375
|
y,
|
|
3385
3376
|
S,
|
|
3386
|
-
|
|
3377
|
+
b,
|
|
3387
3378
|
D,
|
|
3388
3379
|
T,
|
|
3389
3380
|
I,
|
|
3390
3381
|
P,
|
|
3391
3382
|
Y,
|
|
3392
|
-
|
|
3383
|
+
H
|
|
3393
3384
|
]
|
|
3394
3385
|
), R = F(() => _.getScheduleApi(), [_]);
|
|
3395
3386
|
R.updateProps(t);
|