@m3ui-vue/m3ui-vue 1.2.2 → 1.3.1
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/API.md +3010 -376
- package/dist/MButton-Bl_BSUep.js +172 -0
- package/dist/MButton-Bl_BSUep.js.map +1 -0
- package/dist/MDialog-D_Yik8ou.js +173 -0
- package/dist/MDialog-D_Yik8ou.js.map +1 -0
- package/dist/MIconButton-DoNotQ9v.js +282 -0
- package/dist/MIconButton-DoNotQ9v.js.map +1 -0
- package/dist/MListItem-BxifHJdU.js +824 -0
- package/dist/MListItem-BxifHJdU.js.map +1 -0
- package/dist/MLoadingIndicator-BxbFhSX6.js +115 -0
- package/dist/MLoadingIndicator-BxbFhSX6.js.map +1 -0
- package/dist/MMenuItem-Bih0h4-n.js +604 -0
- package/dist/MMenuItem-Bih0h4-n.js.map +1 -0
- package/dist/MProgressBar-BCoruxA-.js +184 -0
- package/dist/MProgressBar-BCoruxA-.js.map +1 -0
- package/dist/MSeekBar-BeN9QcB3.js +435 -0
- package/dist/MSeekBar-BeN9QcB3.js.map +1 -0
- package/dist/MSegmentedButton-DL9JtJFX.js +65 -0
- package/dist/MSegmentedButton-DL9JtJFX.js.map +1 -0
- package/dist/MSlider-BVSbJlGS.js +691 -0
- package/dist/MSlider-BVSbJlGS.js.map +1 -0
- package/dist/MSpinner-C2SUnWk4.js +65 -0
- package/dist/MSpinner-C2SUnWk4.js.map +1 -0
- package/dist/MTextField-CEkWSZ2v.js +296 -0
- package/dist/MTextField-CEkWSZ2v.js.map +1 -0
- package/dist/MTooltip-CodJGEO-.js +756 -0
- package/dist/MTooltip-CodJGEO-.js.map +1 -0
- package/dist/_storageKeys-CYXsUBwK.js +18 -0
- package/dist/_storageKeys-CYXsUBwK.js.map +1 -0
- package/dist/_useEscapeStack-CjndQhqg.js +19 -0
- package/dist/_useEscapeStack-CjndQhqg.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/chart.js +1 -1
- package/dist/code-editor.js +1 -1
- package/dist/components/MAudioPlayer.vue.d.ts +115 -0
- package/dist/components/MBadge.vue.d.ts +1 -1
- package/dist/components/MBottomSheetScaffold.vue.d.ts +1 -1
- package/dist/components/MBox.vue.d.ts +1 -1
- package/dist/components/MButton.vue.d.ts +1 -1
- package/dist/components/MConfirmDialog.vue.d.ts +1 -1
- package/dist/components/MCopyButton.vue.d.ts +2 -2
- package/dist/components/MDataTable.vue.d.ts +2 -2
- package/dist/components/MDialog.vue.d.ts +2 -2
- package/dist/components/MDivider.vue.d.ts +1 -1
- package/dist/components/MDragHandle.vue.d.ts +1 -1
- package/dist/components/MDrawCanvas.vue.d.ts +150 -0
- package/dist/components/MDrawLayers.vue.d.ts +3 -0
- package/dist/components/MDrawToolbar.vue.d.ts +34 -0
- package/dist/components/MExportButton.vue.d.ts +1 -1
- package/dist/components/MFab.vue.d.ts +2 -2
- package/dist/components/MFabMenu.vue.d.ts +2 -2
- package/dist/components/MFixed.vue.d.ts +1 -1
- package/dist/components/MFlex.vue.d.ts +2 -2
- package/dist/components/MFloorPlan.vue.d.ts +248 -0
- package/dist/components/MFloorPlanInspector.vue.d.ts +56 -0
- package/dist/components/MFloorPlanToolbar.vue.d.ts +51 -0
- package/dist/components/MFlow.vue.d.ts +318 -0
- package/dist/components/MFlowControls.vue.d.ts +33 -0
- package/dist/components/MFlowHandle.vue.d.ts +16 -0
- package/dist/components/MFlowMinimap.vue.d.ts +22 -0
- package/dist/components/MFlowNode.vue.d.ts +35 -0
- package/dist/components/MGantt.vue.d.ts +141 -0
- package/dist/components/MGanttControls.vue.d.ts +32 -0
- package/dist/components/MIconButton.vue.d.ts +3 -1
- package/dist/components/MImageCropper.vue.d.ts +110 -0
- package/dist/components/MInfiniteScroll.vue.d.ts +1 -1
- package/dist/components/MLightbox.vue.d.ts +2 -2
- package/dist/components/MList.vue.d.ts +1 -1
- package/dist/components/MLoadingOverlay.vue.d.ts +1 -1
- package/dist/components/MMapControl.vue.d.ts +1 -1
- package/dist/components/MMapSearch.vue.d.ts +1 -1
- package/dist/components/MMaskField.vue.d.ts +12 -1
- package/dist/components/MMenu.vue.d.ts +1 -1
- package/dist/components/MNavigationDrawer.vue.d.ts +1 -1
- package/dist/components/MNumberField.vue.d.ts +11 -2
- package/dist/components/MPdfViewer.vue.d.ts +174 -0
- package/dist/components/MPullToRefresh.vue.d.ts +1 -1
- package/dist/components/MResourceTimeline.vue.d.ts +149 -0
- package/dist/components/MScheduler.vue.d.ts +3 -3
- package/dist/components/MScheme.vue.d.ts +1 -1
- package/dist/components/MSearchField.vue.d.ts +1 -1
- package/dist/components/MSeekBar.vue.d.ts +1 -1
- package/dist/components/MSimpleCarousel.vue.d.ts +1 -1
- package/dist/components/MSkeleton.vue.d.ts +1 -1
- package/dist/components/MSlider.vue.d.ts +2 -2
- package/dist/components/MSparkline.vue.d.ts +1 -1
- package/dist/components/MSplitter.vue.d.ts +1 -1
- package/dist/components/MStack.vue.d.ts +2 -2
- package/dist/components/MSwipeToDismiss.vue.d.ts +1 -1
- package/dist/components/MSwitch.vue.d.ts +1 -1
- package/dist/components/MTable.vue.d.ts +1 -1
- package/dist/components/MTagInput.vue.d.ts +12 -1
- package/dist/components/MTextField.vue.d.ts +13 -2
- package/dist/components/MToolbar.vue.d.ts +1 -1
- package/dist/components/MTree.vue.d.ts +2 -2
- package/dist/components/MVideoPlayer.vue.d.ts +253 -0
- package/dist/components/MVirtualTable.vue.d.ts +1 -1
- package/dist/components/MWindow.vue.d.ts +3 -3
- package/dist/components/_MFlowEdge.vue.d.ts +9 -0
- package/dist/components/_MFlowEdgeLabel.vue.d.ts +9 -0
- package/dist/components/_MFlowNodeShell.vue.d.ts +9 -0
- package/dist/components/_MPdfPage.vue.d.ts +76 -0
- package/dist/components/_MTimeBackground.vue.d.ts +14 -0
- package/dist/components/_MTimeHeader.vue.d.ts +20 -0
- package/dist/composables/_flowPanel.d.ts +2 -0
- package/dist/composables/_flowSlot.d.ts +5 -0
- package/dist/composables/_ganttTime.d.ts +41 -0
- package/dist/composables/_useTimeAxis.d.ts +90 -0
- package/dist/composables/drawGeometry.d.ts +119 -0
- package/dist/composables/flowFormats.d.ts +79 -0
- package/dist/composables/flowLayout.d.ts +45 -0
- package/dist/composables/flowPaths.d.ts +53 -0
- package/dist/composables/ganttFormats.d.ts +52 -0
- package/dist/composables/ganttSchedule.d.ts +99 -0
- package/dist/composables/useDrawing.d.ts +44 -0
- package/dist/composables/useFloorPlan.d.ts +58 -0
- package/dist/composables/useFlow.d.ts +266 -0
- package/dist/composables/useGantt.d.ts +87 -0
- package/dist/composables/useLocale.d.ts +204 -0
- package/dist/composables/useMediaPlayer.d.ts +101 -0
- package/dist/composables/usePdf.d.ts +119 -0
- package/dist/composables/useResourceTimeline.d.ts +70 -0
- package/dist/draw.d.ts +7 -0
- package/dist/draw.js +1702 -0
- package/dist/draw.js.map +1 -0
- package/dist/flow.d.ts +14 -0
- package/dist/flow.js +3547 -0
- package/dist/flow.js.map +1 -0
- package/dist/flowPaths-CUc6X373.js +161 -0
- package/dist/flowPaths-CUc6X373.js.map +1 -0
- package/dist/gantt.d.ts +12 -0
- package/dist/gantt.js +3575 -0
- package/dist/gantt.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/locales/index.js +1435 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +8248 -7637
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +113 -108
- package/dist/map.js.map +1 -1
- package/dist/media.d.ts +5 -0
- package/dist/media.js +1311 -0
- package/dist/media.js.map +1 -0
- package/dist/pdf.d.ts +4 -0
- package/dist/pdf.js +1871 -0
- package/dist/pdf.js.map +1 -0
- package/dist/rich-text-editor.js +28 -26
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/{useLocale-JYxDDeXC.js → useLocale-CaWwi-b6.js} +206 -2
- package/dist/useLocale-CaWwi-b6.js.map +1 -0
- package/dist/{useThemeTokens-y0HZpyhL.js → useThemeTokens-DQQcaWbE.js} +40 -54
- package/dist/useThemeTokens-DQQcaWbE.js.map +1 -0
- package/package.json +29 -5
- package/src/__tests__/MAudioPlayer.test.ts +75 -0
- package/src/__tests__/MDrawCanvas.test.ts +118 -0
- package/src/__tests__/MFloorPlan.test.ts +299 -0
- package/src/__tests__/MFlow.test.ts +590 -0
- package/src/__tests__/MGantt.test.ts +130 -0
- package/src/__tests__/MImageCropper.test.ts +89 -0
- package/src/__tests__/MPdfViewer.test.ts +235 -0
- package/src/__tests__/MResourceTimeline.test.ts +102 -0
- package/src/__tests__/MVideoPlayer.test.ts +201 -0
- package/src/__tests__/drawGeometry.test.ts +58 -0
- package/src/__tests__/fieldExpose.test.ts +30 -0
- package/src/__tests__/flowFormats.test.ts +185 -0
- package/src/__tests__/flowLayout.test.ts +113 -0
- package/src/__tests__/ganttFormats.test.ts +76 -0
- package/src/__tests__/ganttSchedule.test.ts +136 -0
- package/src/__tests__/pdfMock.ts +83 -0
- package/src/__tests__/useMediaPlayer.test.ts +182 -0
- package/src/__tests__/usePdf.test.ts +102 -0
- package/src/components/MAudioPlayer.vue +319 -0
- package/src/components/MDrawCanvas.vue +819 -0
- package/src/components/MDrawLayers.vue +114 -0
- package/src/components/MDrawToolbar.vue +171 -0
- package/src/components/MFloorPlan.vue +1080 -0
- package/src/components/MFloorPlanInspector.vue +169 -0
- package/src/components/MFloorPlanToolbar.vue +128 -0
- package/src/components/MFlow.vue +2060 -0
- package/src/components/MFlowControls.vue +110 -0
- package/src/components/MFlowHandle.vue +60 -0
- package/src/components/MFlowMinimap.vue +134 -0
- package/src/components/MFlowNode.vue +98 -0
- package/src/components/MGantt.vue +1609 -0
- package/src/components/MGanttControls.vue +77 -0
- package/src/components/MIconButton.vue +3 -1
- package/src/components/MImageCropper.vue +507 -0
- package/src/components/MMaskField.vue +13 -0
- package/src/components/MNumberField.vue +13 -0
- package/src/components/MPdfViewer.vue +1270 -0
- package/src/components/MResourceTimeline.vue +1020 -0
- package/src/components/MTagInput.vue +13 -0
- package/src/components/MTextField.vue +16 -0
- package/src/components/MVideoPlayer.vue +839 -0
- package/src/components/_MFlowEdge.vue +100 -0
- package/src/components/_MFlowEdgeLabel.vue +56 -0
- package/src/components/_MFlowNodeShell.vue +111 -0
- package/src/components/_MPdfPage.vue +456 -0
- package/src/components/_MTimeBackground.vue +16 -0
- package/src/components/_MTimeHeader.vue +31 -0
- package/src/composables/_flowPanel.ts +13 -0
- package/src/composables/_flowSlot.ts +6 -0
- package/src/composables/_ganttTime.ts +200 -0
- package/src/composables/_useTimeAxis.ts +224 -0
- package/src/composables/drawGeometry.ts +405 -0
- package/src/composables/flowFormats.ts +916 -0
- package/src/composables/flowLayout.ts +297 -0
- package/src/composables/flowPaths.ts +239 -0
- package/src/composables/ganttFormats.ts +366 -0
- package/src/composables/ganttSchedule.ts +403 -0
- package/src/composables/useDrawing.ts +53 -0
- package/src/composables/useFloorPlan.ts +73 -0
- package/src/composables/useFlow.ts +250 -0
- package/src/composables/useGantt.ts +92 -0
- package/src/composables/useLocale.ts +410 -0
- package/src/composables/useMediaPlayer.ts +406 -0
- package/src/composables/usePdf.ts +456 -0
- package/src/composables/useResourceTimeline.ts +76 -0
- package/src/draw.ts +25 -0
- package/src/flow.ts +26 -0
- package/src/gantt.ts +12 -0
- package/src/index.ts +9 -0
- package/src/locales/de.ts +204 -0
- package/src/locales/es.ts +204 -0
- package/src/locales/fr.ts +204 -0
- package/src/locales/ja.ts +204 -0
- package/src/locales/ko.ts +204 -0
- package/src/locales/pt.ts +204 -0
- package/src/locales/zh.ts +204 -0
- package/src/media.ts +5 -0
- package/src/pdf.ts +15 -0
- package/dist/MMenuItem-D4Gx_l3F.js +0 -929
- package/dist/MMenuItem-D4Gx_l3F.js.map +0 -1
- package/dist/MSlider-Dx_S3vJ9.js +0 -1506
- package/dist/MSlider-Dx_S3vJ9.js.map +0 -1
- package/dist/MTextField-Bz8JIsnl.js +0 -633
- package/dist/MTextField-Bz8JIsnl.js.map +0 -1
- package/dist/useLocale-JYxDDeXC.js.map +0 -1
- package/dist/useThemeTokens-y0HZpyhL.js.map +0 -1
package/dist/gantt.js
ADDED
|
@@ -0,0 +1,3575 @@
|
|
|
1
|
+
import { i as e } from "./useLocale-CaWwi-b6.js";
|
|
2
|
+
import { f as t, l as n, t as r, u as i } from "./MIconButton-DoNotQ9v.js";
|
|
3
|
+
import { t as a } from "./MSegmentedButton-DL9JtJFX.js";
|
|
4
|
+
import { t as o } from "./flowPaths-CUc6X373.js";
|
|
5
|
+
import { Fragment as s, Teleport as c, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createTextVNode as m, createVNode as h, defineComponent as g, inject as _, nextTick as ee, normalizeClass as v, normalizeStyle as y, onBeforeUnmount as te, onBeforeUpdate as ne, onMounted as re, onUpdated as ie, openBlock as b, provide as ae, ref as x, renderList as S, renderSlot as oe, shallowRef as se, toDisplayString as C, toRaw as ce, unref as w, useSlots as le, vModelText as ue, watch as de, withDirectives as fe, withKeys as pe, withModifiers as me } from "vue";
|
|
6
|
+
//#region src/composables/useGantt.ts
|
|
7
|
+
var he = Symbol("m3-gantt"), ge = Symbol("m3-timeline-controls");
|
|
8
|
+
function T() {
|
|
9
|
+
let e = _(he, null);
|
|
10
|
+
if (!e) throw Error("useGantt() must be called inside <MGantt>");
|
|
11
|
+
return e;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/composables/_ganttTime.ts
|
|
15
|
+
var _e = 36e5, E = 864e5, D = [
|
|
16
|
+
"hour",
|
|
17
|
+
"day",
|
|
18
|
+
"week",
|
|
19
|
+
"month",
|
|
20
|
+
"quarter",
|
|
21
|
+
"year"
|
|
22
|
+
], ve = /^\d{4}-\d{2}-\d{2}$/;
|
|
23
|
+
function O(e) {
|
|
24
|
+
return !!e && ve.test(e);
|
|
25
|
+
}
|
|
26
|
+
function k(e) {
|
|
27
|
+
if (!e) return NaN;
|
|
28
|
+
if (ve.test(e)) {
|
|
29
|
+
let [t, n, r] = e.split("-").map(Number);
|
|
30
|
+
return new Date(t, n - 1, r).getTime();
|
|
31
|
+
}
|
|
32
|
+
let t = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?$/.exec(e);
|
|
33
|
+
if (t) {
|
|
34
|
+
let [, e, n, r, i, a, o] = t;
|
|
35
|
+
return new Date(+e, n - 1, +r, +i, +a, +(o ?? 0)).getTime();
|
|
36
|
+
}
|
|
37
|
+
return Date.parse(e);
|
|
38
|
+
}
|
|
39
|
+
var A = (e) => String(e).padStart(2, "0");
|
|
40
|
+
function j(e, t) {
|
|
41
|
+
let n = new Date(e), r = `${n.getFullYear()}-${A(n.getMonth() + 1)}-${A(n.getDate())}`;
|
|
42
|
+
if (t) return r;
|
|
43
|
+
let i = n.getSeconds();
|
|
44
|
+
return `${r}T${A(n.getHours())}:${A(n.getMinutes())}${i ? `:${A(i)}` : ""}`;
|
|
45
|
+
}
|
|
46
|
+
function M(e) {
|
|
47
|
+
let t = new Date(e);
|
|
48
|
+
return new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime();
|
|
49
|
+
}
|
|
50
|
+
function N(e, t) {
|
|
51
|
+
let n = new Date(e);
|
|
52
|
+
return n.setDate(n.getDate() + t), n.getTime();
|
|
53
|
+
}
|
|
54
|
+
function ye(e, t) {
|
|
55
|
+
return Math.round((M(t) - M(e)) / E);
|
|
56
|
+
}
|
|
57
|
+
function P(e, t, n = 1) {
|
|
58
|
+
let r = new Date(e);
|
|
59
|
+
switch (t) {
|
|
60
|
+
case "hour": return new Date(r.getFullYear(), r.getMonth(), r.getDate(), r.getHours()).getTime();
|
|
61
|
+
case "day": return M(e);
|
|
62
|
+
case "week": {
|
|
63
|
+
let e = (r.getDay() - n + 7) % 7;
|
|
64
|
+
return new Date(r.getFullYear(), r.getMonth(), r.getDate() - e).getTime();
|
|
65
|
+
}
|
|
66
|
+
case "month": return new Date(r.getFullYear(), r.getMonth(), 1).getTime();
|
|
67
|
+
case "quarter": return new Date(r.getFullYear(), Math.floor(r.getMonth() / 3) * 3, 1).getTime();
|
|
68
|
+
case "year": return new Date(r.getFullYear(), 0, 1).getTime();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function be(e, t, n = 1) {
|
|
72
|
+
let r = new Date(e);
|
|
73
|
+
switch (t) {
|
|
74
|
+
case "hour": return new Date(r.getFullYear(), r.getMonth(), r.getDate(), r.getHours() + n).getTime();
|
|
75
|
+
case "day": return N(e, 1);
|
|
76
|
+
case "week": return N(e, 7);
|
|
77
|
+
case "month": return new Date(r.getFullYear(), r.getMonth() + 1, 1).getTime();
|
|
78
|
+
case "quarter": return new Date(r.getFullYear(), r.getMonth() + 3, 1).getTime();
|
|
79
|
+
case "year": return new Date(r.getFullYear() + 1, 0, 1).getTime();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function xe(e, t) {
|
|
83
|
+
if (t >= 1440) {
|
|
84
|
+
let n = Math.round(t / 1440), r = M(e + 12 * _e);
|
|
85
|
+
return n <= 1 ? r : N(r, -((ye(0, r) % n + n) % n));
|
|
86
|
+
}
|
|
87
|
+
let n = t * 6e4, r = M(e);
|
|
88
|
+
return r + Math.round((e - r) / n) * n;
|
|
89
|
+
}
|
|
90
|
+
var Se = {
|
|
91
|
+
hour: 1152,
|
|
92
|
+
day: 40,
|
|
93
|
+
week: 20,
|
|
94
|
+
month: 5,
|
|
95
|
+
quarter: 1.2,
|
|
96
|
+
year: .3
|
|
97
|
+
}, Ce = {
|
|
98
|
+
hour: 1 / 24,
|
|
99
|
+
day: 1,
|
|
100
|
+
week: 7,
|
|
101
|
+
month: 30.44,
|
|
102
|
+
quarter: 91.3,
|
|
103
|
+
year: 365.25
|
|
104
|
+
}, we = {
|
|
105
|
+
hour: 36,
|
|
106
|
+
day: 26,
|
|
107
|
+
week: 52,
|
|
108
|
+
month: 44,
|
|
109
|
+
quarter: 36,
|
|
110
|
+
year: 44
|
|
111
|
+
}, F = {
|
|
112
|
+
hour: "day",
|
|
113
|
+
day: "month",
|
|
114
|
+
week: "month",
|
|
115
|
+
month: "year",
|
|
116
|
+
quarter: "year",
|
|
117
|
+
year: null
|
|
118
|
+
}, Te = [
|
|
119
|
+
1,
|
|
120
|
+
2,
|
|
121
|
+
3,
|
|
122
|
+
6,
|
|
123
|
+
12
|
|
124
|
+
];
|
|
125
|
+
function Ee(e) {
|
|
126
|
+
let t = Te.find((t) => t * e / 24 >= we.hour);
|
|
127
|
+
if (t) return {
|
|
128
|
+
bottom: "hour",
|
|
129
|
+
top: "day",
|
|
130
|
+
step: t
|
|
131
|
+
};
|
|
132
|
+
let n = D.find((t) => t !== "hour" && Ce[t] * e >= we[t]) ?? "year";
|
|
133
|
+
return {
|
|
134
|
+
bottom: n,
|
|
135
|
+
top: F[n],
|
|
136
|
+
step: 1
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function De(e) {
|
|
140
|
+
let t = "day", n = Infinity;
|
|
141
|
+
for (let r of D) {
|
|
142
|
+
let i = Math.abs(Math.log(Se[r] / e));
|
|
143
|
+
i < n && (n = i, t = r);
|
|
144
|
+
}
|
|
145
|
+
return t;
|
|
146
|
+
}
|
|
147
|
+
function Oe(e, t, n, r = 1, i = 1, a = 2e3) {
|
|
148
|
+
let o = [], s = P(e, n, r);
|
|
149
|
+
for (n === "hour" && i > 1 && (s -= new Date(s).getHours() % i * _e); s < t && o.length < a; s = be(s, n, i)) o.push(s);
|
|
150
|
+
return o;
|
|
151
|
+
}
|
|
152
|
+
function I(e, t, n, r, i, a = !1) {
|
|
153
|
+
let o = new Date(e), s = (e) => new Intl.DateTimeFormat(r, e).format(o);
|
|
154
|
+
switch (t) {
|
|
155
|
+
case "hour": return s({ hour: "numeric" });
|
|
156
|
+
case "day": return s(a ? {
|
|
157
|
+
weekday: "short",
|
|
158
|
+
day: "numeric",
|
|
159
|
+
month: "short"
|
|
160
|
+
} : n >= 44 ? {
|
|
161
|
+
weekday: "narrow",
|
|
162
|
+
day: "numeric"
|
|
163
|
+
} : { day: "numeric" });
|
|
164
|
+
case "week": return s({
|
|
165
|
+
month: "short",
|
|
166
|
+
day: "numeric"
|
|
167
|
+
});
|
|
168
|
+
case "month": return s(a ? {
|
|
169
|
+
month: "long",
|
|
170
|
+
year: "numeric"
|
|
171
|
+
} : { month: n >= 90 ? "long" : "short" });
|
|
172
|
+
case "quarter": return i.replace("{n}", String(Math.floor(o.getMonth() / 3) + 1));
|
|
173
|
+
case "year": return s({ year: "numeric" });
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
function ke(e) {
|
|
177
|
+
let t = e / 24;
|
|
178
|
+
return t >= 120 ? 5 : t >= 40 ? 15 : t >= 16 ? 30 : t >= 4 ? 60 : 1440;
|
|
179
|
+
}
|
|
180
|
+
function L(e, t, n) {
|
|
181
|
+
return t.includes(new Date(e).getDay()) && !n.has(j(e, !0));
|
|
182
|
+
}
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/composables/ganttSchedule.ts
|
|
185
|
+
function Ae(e) {
|
|
186
|
+
return typeof e == "string" ? {
|
|
187
|
+
id: e,
|
|
188
|
+
type: "FS",
|
|
189
|
+
lag: 0
|
|
190
|
+
} : {
|
|
191
|
+
id: e.id,
|
|
192
|
+
type: e.type ?? "FS",
|
|
193
|
+
lag: e.lag ?? 0
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function je(e) {
|
|
197
|
+
let t = new Set(e.map((e) => e.id)), n = /* @__PURE__ */ new Set();
|
|
198
|
+
for (let r of e) r.parentId && t.has(r.parentId) && n.add(r.parentId);
|
|
199
|
+
for (let t of e) t.type === "summary" && n.add(t.id);
|
|
200
|
+
return n;
|
|
201
|
+
}
|
|
202
|
+
function R(e) {
|
|
203
|
+
return e.type === "milestone" || !e.end && e.type !== "summary";
|
|
204
|
+
}
|
|
205
|
+
function z(e) {
|
|
206
|
+
let t = k(e.start), n = O(e.start);
|
|
207
|
+
if (e.type === "milestone" || !e.end) return {
|
|
208
|
+
start: t,
|
|
209
|
+
end: t,
|
|
210
|
+
dateOnly: n
|
|
211
|
+
};
|
|
212
|
+
let r = k(e.end), i = O(e.end) ? N(M(r), 1) : r;
|
|
213
|
+
return {
|
|
214
|
+
start: t,
|
|
215
|
+
end: Math.max(t, i),
|
|
216
|
+
dateOnly: n
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
function Me(e, t, n) {
|
|
220
|
+
let r = O(e.start);
|
|
221
|
+
if (e.type === "milestone" || !e.end) return { start: j(r ? M(t) : t, r) };
|
|
222
|
+
if (r) {
|
|
223
|
+
let e = M(t), r = Math.max(e, M(n - 1));
|
|
224
|
+
return {
|
|
225
|
+
start: j(e, !0),
|
|
226
|
+
end: j(r, !0)
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
return {
|
|
230
|
+
start: j(t, !1),
|
|
231
|
+
end: j(Math.max(t, n), !1)
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
function B(e) {
|
|
235
|
+
let t = z(e);
|
|
236
|
+
return t.dateOnly ? ye(t.start, t.end) : (t.end - t.start) / E;
|
|
237
|
+
}
|
|
238
|
+
function Ne(e) {
|
|
239
|
+
let t = je(e);
|
|
240
|
+
if (!t.size) return e;
|
|
241
|
+
let n = /* @__PURE__ */ new Map();
|
|
242
|
+
for (let r of e) r.parentId && t.has(r.parentId) && (n.get(r.parentId) ?? n.set(r.parentId, []).get(r.parentId)).push(r);
|
|
243
|
+
let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set(), a = (e) => {
|
|
244
|
+
if (!t.has(e.id) || !n.has(e.id)) return r.get(e.id) ?? e;
|
|
245
|
+
if (r.has(e.id)) return r.get(e.id);
|
|
246
|
+
if (i.has(e.id)) return e;
|
|
247
|
+
i.add(e.id);
|
|
248
|
+
let o = Infinity, s = -Infinity, c = !0, l = 0, u = 0;
|
|
249
|
+
for (let t of n.get(e.id)) {
|
|
250
|
+
let e = a(t), n = z(e);
|
|
251
|
+
if (!Number.isFinite(n.start)) continue;
|
|
252
|
+
o = Math.min(o, n.start), s = Math.max(s, n.end), n.dateOnly || (c = !1);
|
|
253
|
+
let r = Math.max(n.end - n.start, +!R(e));
|
|
254
|
+
l += r, u += r * (e.progress ?? 0);
|
|
255
|
+
}
|
|
256
|
+
if (i.delete(e.id), !Number.isFinite(o)) return e;
|
|
257
|
+
let d = c ? {
|
|
258
|
+
start: j(o, !0),
|
|
259
|
+
end: j(Math.max(o, M(s - 1)), !0)
|
|
260
|
+
} : {
|
|
261
|
+
start: j(o, !1),
|
|
262
|
+
end: j(s, !1)
|
|
263
|
+
}, f = l ? Math.round(u / l) : e.progress ?? 0, p = d.start === e.start && d.end === e.end && f === (e.progress ?? 0) ? e : {
|
|
264
|
+
...e,
|
|
265
|
+
start: d.start,
|
|
266
|
+
end: d.end,
|
|
267
|
+
progress: f
|
|
268
|
+
};
|
|
269
|
+
return r.set(e.id, p), p;
|
|
270
|
+
}, o = !1, s = e.map((e) => {
|
|
271
|
+
let t = a(e);
|
|
272
|
+
return t !== e && (o = !0), t;
|
|
273
|
+
});
|
|
274
|
+
return o ? s : e;
|
|
275
|
+
}
|
|
276
|
+
function V(e) {
|
|
277
|
+
return {
|
|
278
|
+
days: e?.workingDays ?? [
|
|
279
|
+
1,
|
|
280
|
+
2,
|
|
281
|
+
3,
|
|
282
|
+
4,
|
|
283
|
+
5
|
|
284
|
+
],
|
|
285
|
+
holidays: new Set(e?.holidays ?? [])
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
function Pe(e, t, n) {
|
|
289
|
+
let r = V(n), i = 0, a = M(k(t));
|
|
290
|
+
for (let t = M(k(e)); t <= a; t = N(t, 1)) L(t, r.days, r.holidays) && i++;
|
|
291
|
+
return i;
|
|
292
|
+
}
|
|
293
|
+
function H(e, t, n) {
|
|
294
|
+
let r = V(n);
|
|
295
|
+
if (!r.days.length) return e;
|
|
296
|
+
let i = M(k(e));
|
|
297
|
+
for (; !L(i, r.days, r.holidays);) i = N(i, 1);
|
|
298
|
+
let a = t < 0 ? -1 : 1;
|
|
299
|
+
for (let e = Math.abs(t); e > 0;) i = N(i, a), L(i, r.days, r.holidays) && e--;
|
|
300
|
+
return j(i, !0);
|
|
301
|
+
}
|
|
302
|
+
function U(e) {
|
|
303
|
+
let t = new Map(e.map((e) => [e.id, e])), n = je(e), r = /* @__PURE__ */ new Map();
|
|
304
|
+
for (let n of e) n.parentId && t.has(n.parentId) && (r.get(n.parentId) ?? r.set(n.parentId, []).get(n.parentId)).push(n.id);
|
|
305
|
+
let i = (e, t = 0) => n.has(e) && r.has(e) && t < 100 ? r.get(e).flatMap((e) => i(e, t + 1)) : [e], a = [];
|
|
306
|
+
for (let n of e) for (let e of n.dependencies ?? []) {
|
|
307
|
+
let r = Ae(e);
|
|
308
|
+
if (t.has(r.id) && r.id !== n.id) for (let e of i(n.id)) a.push({
|
|
309
|
+
pred: r.id,
|
|
310
|
+
succ: e,
|
|
311
|
+
type: r.type,
|
|
312
|
+
lag: r.lag,
|
|
313
|
+
key: `${r.id}>${n.id}`
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
return {
|
|
317
|
+
byId: t,
|
|
318
|
+
sums: n,
|
|
319
|
+
kids: r,
|
|
320
|
+
leaves: i,
|
|
321
|
+
links: a
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
function W(e, t) {
|
|
325
|
+
let n = [], r = /* @__PURE__ */ new Map(), i = (e) => {
|
|
326
|
+
if (!r.get(e)) {
|
|
327
|
+
r.set(e, 1);
|
|
328
|
+
for (let n of t.get(e) ?? []) r.get(n) !== 1 && i(n);
|
|
329
|
+
r.set(e, 2), n.push(e);
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
for (let t of e) i(t);
|
|
333
|
+
return n;
|
|
334
|
+
}
|
|
335
|
+
function Fe(e, t = {}) {
|
|
336
|
+
let { sums: n, kids: r, leaves: i, links: a } = U(e), o = t.calendar ? V(t.calendar) : null, s = /* @__PURE__ */ new Map();
|
|
337
|
+
for (let t of e) n.has(t.id) || s.set(t.id, z(t));
|
|
338
|
+
let c = /* @__PURE__ */ new Map();
|
|
339
|
+
for (let e of a) (c.get(e.succ) ?? c.set(e.succ, []).get(e.succ)).push(e.pred);
|
|
340
|
+
for (let e of n) c.set(e, [...c.get(e) ?? [], ...i(e)]);
|
|
341
|
+
let l = /* @__PURE__ */ new Map();
|
|
342
|
+
for (let e of a) (l.get(e.succ) ?? l.set(e.succ, []).get(e.succ)).push(e);
|
|
343
|
+
let u = (e) => {
|
|
344
|
+
if (!n.has(e)) return s.get(e);
|
|
345
|
+
let t = Infinity, r = -Infinity;
|
|
346
|
+
for (let n of i(e)) {
|
|
347
|
+
let e = s.get(n);
|
|
348
|
+
e && (t = Math.min(t, e.start), r = Math.max(r, e.end));
|
|
349
|
+
}
|
|
350
|
+
return Number.isFinite(t) ? {
|
|
351
|
+
start: t,
|
|
352
|
+
end: r,
|
|
353
|
+
dateOnly: !0
|
|
354
|
+
} : void 0;
|
|
355
|
+
}, d = (e, n, r) => !o || !r ? e + n * E : k(H(j(e, !0), n, t.calendar)), f = (e) => {
|
|
356
|
+
let t = 0;
|
|
357
|
+
for (let n = e.start; n < e.end; n = N(n, 1)) L(n, o.days, o.holidays) && t++;
|
|
358
|
+
return t;
|
|
359
|
+
}, p = !1;
|
|
360
|
+
for (let e of W([...s.keys(), ...n], c)) {
|
|
361
|
+
if (n.has(e)) continue;
|
|
362
|
+
let r = s.get(e), i = l.get(e);
|
|
363
|
+
if (!i?.length || !Number.isFinite(r.start)) continue;
|
|
364
|
+
let a = r.end - r.start, c = -Infinity;
|
|
365
|
+
for (let e of i) {
|
|
366
|
+
let t = u(e.pred);
|
|
367
|
+
if (!t) continue;
|
|
368
|
+
let n = t.dateOnly && r.dateOnly, i;
|
|
369
|
+
i = e.type === "FS" ? d(t.end, e.lag, n) : e.type === "SS" ? d(t.start, e.lag, n) : e.type === "FF" ? d(t.end, e.lag, n) - a : d(t.start, e.lag, n) - a, c = Math.max(c, i);
|
|
370
|
+
}
|
|
371
|
+
if (!Number.isFinite(c)) continue;
|
|
372
|
+
let m = t.mode === "asap" ? c : Math.max(r.start, c);
|
|
373
|
+
r.dateOnly && (m = M(m + 432e5));
|
|
374
|
+
let h = m + a;
|
|
375
|
+
if (o && r.dateOnly) {
|
|
376
|
+
let e = f(r);
|
|
377
|
+
m = k(H(j(m, !0), 0, t.calendar)), h = e ? N(k(H(j(m, !0), Math.max(0, e - 1), t.calendar)), 1) : m;
|
|
378
|
+
} else r.dateOnly && (h = N(m, ye(r.start, r.end)));
|
|
379
|
+
(m !== r.start || h !== r.end) && (s.set(e, {
|
|
380
|
+
start: m,
|
|
381
|
+
end: h,
|
|
382
|
+
dateOnly: r.dateOnly
|
|
383
|
+
}), p = !0);
|
|
384
|
+
}
|
|
385
|
+
return Ne(p ? e.map((e) => {
|
|
386
|
+
if (n.has(e.id) && r.has(e.id)) return e;
|
|
387
|
+
let t = s.get(e.id), i = z(e);
|
|
388
|
+
return !t || t.start === i.start && t.end === i.end ? e : {
|
|
389
|
+
...e,
|
|
390
|
+
...Me(e, t.start, t.end)
|
|
391
|
+
};
|
|
392
|
+
}) : e);
|
|
393
|
+
}
|
|
394
|
+
function Ie(e, t = {}) {
|
|
395
|
+
let { sums: n, kids: r, leaves: i, links: a } = U(e), o = /* @__PURE__ */ new Map();
|
|
396
|
+
for (let t of e) (!n.has(t.id) || !r.has(t.id)) && o.set(t.id, z(t));
|
|
397
|
+
let s = [...o.keys()].filter((e) => Number.isFinite(o.get(e).start));
|
|
398
|
+
if (!s.length) return {
|
|
399
|
+
tasks: [],
|
|
400
|
+
dependencies: [],
|
|
401
|
+
slack: {},
|
|
402
|
+
finish: ""
|
|
403
|
+
};
|
|
404
|
+
let c = t.calendar ? V(t.calendar) : null, l = (e) => e / E;
|
|
405
|
+
if (c) {
|
|
406
|
+
let e = M(Math.min(...s.map((e) => o.get(e).start))), t = /* @__PURE__ */ new Map();
|
|
407
|
+
l = (n) => {
|
|
408
|
+
let r = M(n), i = t.get(r);
|
|
409
|
+
if (i === void 0) {
|
|
410
|
+
i = 0;
|
|
411
|
+
let n = r >= e ? 1 : -1;
|
|
412
|
+
for (let t = e; t !== r; t = N(t, n)) L(n > 0 ? t : N(t, -1), c.days, c.holidays) && (i += n);
|
|
413
|
+
t.set(r, i);
|
|
414
|
+
}
|
|
415
|
+
return i + (L(r, c.days, c.holidays) ? (n - r) / E : 0);
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
let u = new Map(s.map((e) => [e, {
|
|
419
|
+
start: l(o.get(e).start),
|
|
420
|
+
end: l(o.get(e).end)
|
|
421
|
+
}])), d = a.flatMap((e) => n.has(e.pred) && r.has(e.pred) ? i(e.pred).map((t) => ({
|
|
422
|
+
...e,
|
|
423
|
+
pred: t
|
|
424
|
+
})) : [e]).filter((e) => u.has(e.pred) && u.has(e.succ)), f = Math.max(...s.map((e) => u.get(e).end)), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
|
|
425
|
+
for (let e of d) (p.get(e.pred) ?? p.set(e.pred, []).get(e.pred)).push(e), (m.get(e.succ) ?? m.set(e.succ, []).get(e.succ)).push(e.pred);
|
|
426
|
+
let h = /* @__PURE__ */ new Map();
|
|
427
|
+
for (let e of W(s, m).reverse()) {
|
|
428
|
+
let t = u.get(e), n = t.end - t.start, r = f;
|
|
429
|
+
for (let t of p.get(e) ?? []) {
|
|
430
|
+
let e = h.get(t.succ);
|
|
431
|
+
if (e === void 0) continue;
|
|
432
|
+
let i = u.get(t.succ), a = e + (i.end - i.start);
|
|
433
|
+
r = t.type === "FS" ? Math.min(r, e - t.lag) : t.type === "SS" ? Math.min(r, e - t.lag + n) : t.type === "FF" ? Math.min(r, a - t.lag) : Math.min(r, a - t.lag + n);
|
|
434
|
+
}
|
|
435
|
+
h.set(e, r - n);
|
|
436
|
+
}
|
|
437
|
+
let g = {}, _ = /* @__PURE__ */ new Set();
|
|
438
|
+
for (let e of s) {
|
|
439
|
+
let t = h.get(e) - u.get(e).start;
|
|
440
|
+
g[e] = Math.round(t * 1e3) / 1e3, t < 1e-6 && _.add(e);
|
|
441
|
+
}
|
|
442
|
+
let ee = /* @__PURE__ */ new Set();
|
|
443
|
+
for (let e of d) {
|
|
444
|
+
if (!_.has(e.pred) || !_.has(e.succ)) continue;
|
|
445
|
+
let t = u.get(e.pred), n = u.get(e.succ), r = (e.type === "FS" || e.type === "FF" ? t.end : t.start) + e.lag, i = e.type === "FS" || e.type === "SS" ? n.start : n.end;
|
|
446
|
+
Math.abs(i - r) < 1e-6 && ee.add(e.key);
|
|
447
|
+
}
|
|
448
|
+
for (let e of n) r.has(e) && i(e).some((e) => _.has(e)) && _.add(e);
|
|
449
|
+
let v = Math.max(...s.map((e) => o.get(e).end)), y = e.find((e) => o.get(e.id)?.end === v);
|
|
450
|
+
return {
|
|
451
|
+
tasks: e.filter((e) => _.has(e.id)).map((e) => e.id),
|
|
452
|
+
dependencies: [...ee],
|
|
453
|
+
slack: g,
|
|
454
|
+
finish: j(O(y?.start) ? N(v, -1) : v, O(y?.start))
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
//#endregion
|
|
458
|
+
//#region src/composables/_useTimeAxis.ts
|
|
459
|
+
function Le(e) {
|
|
460
|
+
let t = (t) => Math.min(e.maxPxPerDay(), Math.max(e.minPxPerDay(), t)), n = x(t(e.pxPerDay() ?? Se[e.scale()])), r = l(() => De(n.value)), a = r.value;
|
|
461
|
+
de(r, (t) => {
|
|
462
|
+
t !== a && (a = t, e.onScale(t));
|
|
463
|
+
}), de(e.scale, (e) => {
|
|
464
|
+
e !== a && (a = e, ie(Se[e]));
|
|
465
|
+
});
|
|
466
|
+
let o = x({
|
|
467
|
+
left: 0,
|
|
468
|
+
top: 0,
|
|
469
|
+
width: 0,
|
|
470
|
+
height: 0
|
|
471
|
+
}), s = l(() => Math.max(0, o.value.width - e.listWidth.value)), c = x(Date.now()), u, d = l(() => {
|
|
472
|
+
let t = e.today();
|
|
473
|
+
return t === null ? null : t ? k(t) : c.value;
|
|
474
|
+
}), f = l(() => Math.max(14, (s.value || 800) / n.value)), p = x(0), m = l(() => Math.max((e.extent.value.max - p.value) / E + f.value, s.value / n.value)), h = l(() => m.value * n.value);
|
|
475
|
+
function g() {
|
|
476
|
+
let t = M(N(e.extent.value.min, -Math.ceil(f.value)));
|
|
477
|
+
if (!p.value) {
|
|
478
|
+
p.value = t;
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
let r = t - p.value > 3 * f.value * E;
|
|
482
|
+
if (t < p.value || r) {
|
|
483
|
+
let r = (p.value - t) / E * n.value;
|
|
484
|
+
p.value = t;
|
|
485
|
+
let i = e.scroller.value;
|
|
486
|
+
i && (i.scrollLeft += r, o.value.left = i.scrollLeft);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
de([e.extent, f], g, { immediate: !0 });
|
|
490
|
+
let _ = (e) => (e - p.value) / E * n.value, v = (e) => p.value + e / n.value * E, y = 0, ne = null;
|
|
491
|
+
function ie(r, a, c = !0) {
|
|
492
|
+
r = t(r);
|
|
493
|
+
let l = a ?? s.value / 2, u = v(o.value.left + l);
|
|
494
|
+
if (!c || i() || !e.scroller.value) {
|
|
495
|
+
cancelAnimationFrame(y), y = 0, ne = null, b(r, l, u);
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
if (ne = {
|
|
499
|
+
z: Math.log(n.value),
|
|
500
|
+
v: ne?.v ?? 0,
|
|
501
|
+
target: Math.log(r),
|
|
502
|
+
anchor: l,
|
|
503
|
+
at: u
|
|
504
|
+
}, y) return;
|
|
505
|
+
let d = performance.now(), f = (e) => {
|
|
506
|
+
let t = ne, n = Math.min((e - d) / 1e3, 1 / 30);
|
|
507
|
+
for (d = e; n > 0;) {
|
|
508
|
+
let e = Math.min(n, .004);
|
|
509
|
+
t.v += (-700 * (t.z - t.target) - 1.8 * Math.sqrt(700) * t.v) * e, t.z += t.v * e, n -= e;
|
|
510
|
+
}
|
|
511
|
+
let r = Math.abs(t.z - t.target) < .001 && Math.abs(t.v) < .01;
|
|
512
|
+
if (b(Math.exp(r ? t.target : t.z), t.anchor, t.at), r) {
|
|
513
|
+
y = 0, ne = null;
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
y = requestAnimationFrame(f);
|
|
517
|
+
};
|
|
518
|
+
y = requestAnimationFrame(f);
|
|
519
|
+
}
|
|
520
|
+
function b(t, r, i) {
|
|
521
|
+
n.value = t, g();
|
|
522
|
+
let a = Math.max(0, _(i) - r);
|
|
523
|
+
o.value.left = a, ee(() => {
|
|
524
|
+
e.scroller.value && (e.scroller.value.scrollLeft = a);
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
let ae = () => ne ? Math.exp(ne.target) : n.value, S = () => ie(ae() * 1.6), oe = () => ie(ae() / 1.6), se = (e) => ie(Se[e]);
|
|
528
|
+
function C(t, n = {}) {
|
|
529
|
+
let r = t ? k(t) : Date.now(), a = _(r) - (n.align === "start" ? 24 : s.value / 2);
|
|
530
|
+
e.scroller.value?.scrollTo({
|
|
531
|
+
left: Math.max(0, a),
|
|
532
|
+
behavior: n.animate === !1 || i() ? "auto" : "smooth"
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
let ce = l(() => Ee(n.value)), w = l(() => v(o.value.left - 200)), le = l(() => v(o.value.left + s.value + 200));
|
|
536
|
+
function ue(t, n) {
|
|
537
|
+
let r = n ? 1 : ce.value.step;
|
|
538
|
+
return Oe(w.value, le.value, t, e.weekStartsOn(), r).map((i) => {
|
|
539
|
+
let a = _(i), o = _(be(i, t, r)) - a;
|
|
540
|
+
return {
|
|
541
|
+
key: i,
|
|
542
|
+
x: a,
|
|
543
|
+
w: o,
|
|
544
|
+
label: I(i, t, o, e.lang.value, e.quarterLabel(), n)
|
|
545
|
+
};
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
let fe = l(() => ue(ce.value.bottom, !1)), pe = l(() => ce.value.top ? ue(ce.value.top, !0).map((e) => ({
|
|
549
|
+
...e,
|
|
550
|
+
labelX: Math.max(0, Math.min(o.value.left - e.x, e.w - 80))
|
|
551
|
+
})) : []), me = l(() => ({
|
|
552
|
+
days: e.calendar()?.workingDays ?? [
|
|
553
|
+
1,
|
|
554
|
+
2,
|
|
555
|
+
3,
|
|
556
|
+
4,
|
|
557
|
+
5
|
|
558
|
+
],
|
|
559
|
+
holidays: new Set(e.calendar()?.holidays ?? [])
|
|
560
|
+
})), he = l(() => {
|
|
561
|
+
let t = [];
|
|
562
|
+
if (n.value < 6) return t;
|
|
563
|
+
let r = e.workHours?.();
|
|
564
|
+
for (let e = M(w.value); e < le.value; e = N(e, 1)) {
|
|
565
|
+
let i = N(e, 1);
|
|
566
|
+
if (!L(e, me.value.days, me.value.holidays)) t.push({
|
|
567
|
+
x: _(e),
|
|
568
|
+
w: _(i) - _(e)
|
|
569
|
+
});
|
|
570
|
+
else if (r && n.value >= 120) {
|
|
571
|
+
let n = e + r[0] * 36e5, a = e + r[1] * 36e5;
|
|
572
|
+
r[0] > 0 && t.push({
|
|
573
|
+
x: _(e),
|
|
574
|
+
w: _(n) - _(e)
|
|
575
|
+
}), r[1] < 24 && t.push({
|
|
576
|
+
x: _(a),
|
|
577
|
+
w: _(i) - _(a)
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
return t;
|
|
582
|
+
});
|
|
583
|
+
function ge(t) {
|
|
584
|
+
if (!t.ctrlKey && !t.metaKey) return;
|
|
585
|
+
t.preventDefault();
|
|
586
|
+
let r = e.scroller.value.getBoundingClientRect(), i = t.clientX - r.left - e.listWidth.value;
|
|
587
|
+
i < 0 || ie(n.value * Math.exp(-t.deltaY * .002 * (t.deltaMode === 1 ? 16 : 1)), i, !1);
|
|
588
|
+
}
|
|
589
|
+
let T = null, _e = () => !!T;
|
|
590
|
+
function D(t) {
|
|
591
|
+
if (t.touches.length !== 2) return;
|
|
592
|
+
e.onPinch?.();
|
|
593
|
+
let [r, i] = [t.touches[0], t.touches[1]], a = e.scroller.value.getBoundingClientRect();
|
|
594
|
+
T = {
|
|
595
|
+
dist: Math.hypot(r.clientX - i.clientX, r.clientY - i.clientY) || 1,
|
|
596
|
+
z: n.value,
|
|
597
|
+
anchor: (r.clientX + i.clientX) / 2 - a.left - e.listWidth.value
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
function ve(e) {
|
|
601
|
+
if (!T || e.touches.length !== 2) return !1;
|
|
602
|
+
e.cancelable && e.preventDefault();
|
|
603
|
+
let [t, n] = [e.touches[0], e.touches[1]];
|
|
604
|
+
return ie(T.z * (Math.hypot(t.clientX - n.clientX, t.clientY - n.clientY) / T.dist), T.anchor, !1), !0;
|
|
605
|
+
}
|
|
606
|
+
function O(e) {
|
|
607
|
+
e.touches.length < 2 && (T = null);
|
|
608
|
+
}
|
|
609
|
+
function A() {
|
|
610
|
+
let t = e.scroller.value;
|
|
611
|
+
t && (o.value = {
|
|
612
|
+
left: t.scrollLeft,
|
|
613
|
+
top: t.scrollTop,
|
|
614
|
+
width: t.clientWidth,
|
|
615
|
+
height: t.clientHeight
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
let j;
|
|
619
|
+
return re(() => {
|
|
620
|
+
let t = e.scroller.value;
|
|
621
|
+
t.addEventListener("wheel", ge, { passive: !1 }), A(), j = new ResizeObserver(A), j.observe(t), e.today() !== null && (u = setInterval(() => {
|
|
622
|
+
c.value = Date.now();
|
|
623
|
+
}, 6e4));
|
|
624
|
+
}), te(() => {
|
|
625
|
+
e.scroller.value?.removeEventListener("wheel", ge), j?.disconnect(), cancelAnimationFrame(y), clearInterval(u);
|
|
626
|
+
}), {
|
|
627
|
+
ppd: n,
|
|
628
|
+
scaleNow: r,
|
|
629
|
+
view: o,
|
|
630
|
+
timelineView: s,
|
|
631
|
+
origin: p,
|
|
632
|
+
timelineWidth: h,
|
|
633
|
+
todayMs: d,
|
|
634
|
+
xOf: _,
|
|
635
|
+
timeAt: v,
|
|
636
|
+
zoomTo: ie,
|
|
637
|
+
zoomIn: S,
|
|
638
|
+
zoomOut: oe,
|
|
639
|
+
setScale: se,
|
|
640
|
+
scrollToDate: C,
|
|
641
|
+
units: ce,
|
|
642
|
+
topCells: pe,
|
|
643
|
+
bottomCells: fe,
|
|
644
|
+
offTimes: he,
|
|
645
|
+
onTouchStart: D,
|
|
646
|
+
pinchMove: ve,
|
|
647
|
+
onTouchEnd: O,
|
|
648
|
+
pinching: _e,
|
|
649
|
+
readView: A
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
//#endregion
|
|
653
|
+
//#region src/components/_MTimeHeader.vue?vue&type=script&setup=true&lang.ts
|
|
654
|
+
var Re = { class: "absolute inset-x-0 top-0 h-7" }, G = { class: "absolute inset-x-0 bottom-0 h-7" }, ze = /* @__PURE__ */ g({
|
|
655
|
+
__name: "_MTimeHeader",
|
|
656
|
+
props: {
|
|
657
|
+
width: {},
|
|
658
|
+
topCells: {},
|
|
659
|
+
bottomCells: {},
|
|
660
|
+
todayX: {}
|
|
661
|
+
},
|
|
662
|
+
setup(e) {
|
|
663
|
+
return (t, n) => (b(), f("div", {
|
|
664
|
+
class: "relative shrink-0 border-b border-outline-variant bg-surface-container-low",
|
|
665
|
+
style: y({ width: `${e.width}px` }),
|
|
666
|
+
"aria-hidden": "true"
|
|
667
|
+
}, [
|
|
668
|
+
p("div", Re, [(b(!0), f(s, null, S(e.topCells, (e) => (b(), f("div", {
|
|
669
|
+
key: e.key,
|
|
670
|
+
class: "absolute inset-y-0 border-l border-outline-variant/60",
|
|
671
|
+
style: y({
|
|
672
|
+
left: `${e.x}px`,
|
|
673
|
+
width: `${e.w}px`
|
|
674
|
+
})
|
|
675
|
+
}, [p("span", {
|
|
676
|
+
class: "absolute top-1.5 truncate pl-2 text-label-medium whitespace-nowrap text-on-surface",
|
|
677
|
+
style: y({ left: `${e.labelX}px` })
|
|
678
|
+
}, C(e.label), 5)], 4))), 128))]),
|
|
679
|
+
p("div", G, [(b(!0), f(s, null, S(e.bottomCells, (e) => (b(), f("div", {
|
|
680
|
+
key: e.key,
|
|
681
|
+
class: "absolute inset-y-0 flex items-center justify-center overflow-hidden border-l border-outline-variant/60 text-label-small whitespace-nowrap text-on-surface-variant",
|
|
682
|
+
style: y({
|
|
683
|
+
left: `${e.x}px`,
|
|
684
|
+
width: `${e.w}px`
|
|
685
|
+
})
|
|
686
|
+
}, C(e.label), 5))), 128))]),
|
|
687
|
+
e.todayX === null ? d("", !0) : (b(), f("div", {
|
|
688
|
+
key: 0,
|
|
689
|
+
class: "absolute bottom-0 size-2 -translate-x-1/2 translate-y-1/2 rounded-full bg-primary",
|
|
690
|
+
style: y({ left: `${e.todayX}px` })
|
|
691
|
+
}, null, 4))
|
|
692
|
+
], 4));
|
|
693
|
+
}
|
|
694
|
+
}), Be = { class: "pointer-events-none absolute inset-0" }, Ve = /* @__PURE__ */ g({
|
|
695
|
+
__name: "_MTimeBackground",
|
|
696
|
+
props: {
|
|
697
|
+
offTimes: {},
|
|
698
|
+
cells: {},
|
|
699
|
+
todayX: {}
|
|
700
|
+
},
|
|
701
|
+
setup(e) {
|
|
702
|
+
return (t, n) => (b(), f("div", Be, [
|
|
703
|
+
(b(!0), f(s, null, S(e.offTimes, (e) => (b(), f("div", {
|
|
704
|
+
key: `o${e.x}`,
|
|
705
|
+
class: "absolute inset-y-0 bg-on-surface/4",
|
|
706
|
+
style: y({
|
|
707
|
+
left: `${e.x}px`,
|
|
708
|
+
width: `${e.w}px`
|
|
709
|
+
})
|
|
710
|
+
}, null, 4))), 128)),
|
|
711
|
+
(b(!0), f(s, null, S(e.cells, (e) => (b(), f("div", {
|
|
712
|
+
key: e.key,
|
|
713
|
+
class: "absolute inset-y-0 border-l border-outline-variant/40",
|
|
714
|
+
style: y({ left: `${e.x}px` })
|
|
715
|
+
}, null, 4))), 128)),
|
|
716
|
+
e.todayX === null ? d("", !0) : (b(), f("div", {
|
|
717
|
+
key: 0,
|
|
718
|
+
class: "absolute inset-y-0 z-[1] w-0.5 -translate-x-1/2 bg-primary",
|
|
719
|
+
style: y({ left: `${e.todayX}px` })
|
|
720
|
+
}, null, 4))
|
|
721
|
+
]));
|
|
722
|
+
}
|
|
723
|
+
}), He = ["aria-label", "aria-rowcount"], Ue = [
|
|
724
|
+
"data-gantt-row",
|
|
725
|
+
"data-gantt-flip",
|
|
726
|
+
"aria-level",
|
|
727
|
+
"aria-rowindex",
|
|
728
|
+
"aria-expanded",
|
|
729
|
+
"aria-selected",
|
|
730
|
+
"tabindex",
|
|
731
|
+
"onPointerdown",
|
|
732
|
+
"onClick",
|
|
733
|
+
"onDblclick",
|
|
734
|
+
"onContextmenu",
|
|
735
|
+
"onKeydown",
|
|
736
|
+
"onFocus"
|
|
737
|
+
], We = ["aria-label", "onClick"], Ge = {
|
|
738
|
+
key: 1,
|
|
739
|
+
class: "w-6 shrink-0"
|
|
740
|
+
}, Ke = {
|
|
741
|
+
key: 2,
|
|
742
|
+
class: "mr-1 size-2 shrink-0 rotate-45 rounded-[1px] bg-tertiary"
|
|
743
|
+
}, qe = ["onDblclick"], Je = { class: "truncate" }, Ye = ["aria-label", "aria-valuenow"], Xe = ["width", "height"], Ze = ["onClick"], Qe = ["stroke-width"], $e = ["d"], et = ["aria-label"], tt = ["data-gantt-flip"], nt = ["onPointerdown"], rt = [
|
|
744
|
+
"data-gantt-task",
|
|
745
|
+
"onPointerdown",
|
|
746
|
+
"onPointerenter",
|
|
747
|
+
"onDblclick",
|
|
748
|
+
"onContextmenu"
|
|
749
|
+
], it = [
|
|
750
|
+
"data-gantt-task",
|
|
751
|
+
"onPointerdown",
|
|
752
|
+
"onPointerenter",
|
|
753
|
+
"onDblclick",
|
|
754
|
+
"onContextmenu"
|
|
755
|
+
], at = [
|
|
756
|
+
"data-gantt-task",
|
|
757
|
+
"onPointerdown",
|
|
758
|
+
"onPointerenter",
|
|
759
|
+
"onDblclick",
|
|
760
|
+
"onContextmenu"
|
|
761
|
+
], ot = { class: "pointer-events-none relative flex h-full items-center px-2 text-label-medium whitespace-nowrap" }, st = {
|
|
762
|
+
key: 0,
|
|
763
|
+
class: "truncate"
|
|
764
|
+
}, ct = ["data-gantt-resize", "onPointerdown"], K = {
|
|
765
|
+
key: 5,
|
|
766
|
+
class: "pointer-events-none absolute top-1/2 left-full ml-2 -translate-y-1/2 text-label-medium whitespace-nowrap text-on-surface-variant"
|
|
767
|
+
}, lt = ["onPointerdown"], ut = ["onPointerdown"], dt = { class: "text-body-medium text-on-surface-variant" }, ft = { class: "text-title-small" }, pt = { class: "text-body-small text-on-surface-variant" }, mt = {
|
|
768
|
+
class: "sr-only",
|
|
769
|
+
"aria-live": "polite"
|
|
770
|
+
}, ht = 56, gt = 6, _t = 10, vt = /* @__PURE__ */ g({
|
|
771
|
+
__name: "MGantt",
|
|
772
|
+
props: {
|
|
773
|
+
tasks: { default: () => [] },
|
|
774
|
+
scale: { default: "day" },
|
|
775
|
+
pxPerDay: {},
|
|
776
|
+
selection: {},
|
|
777
|
+
collapsed: {},
|
|
778
|
+
columns: {},
|
|
779
|
+
gridWidth: {},
|
|
780
|
+
rowHeight: { default: 40 },
|
|
781
|
+
readonly: {
|
|
782
|
+
type: Boolean,
|
|
783
|
+
default: !1
|
|
784
|
+
},
|
|
785
|
+
schedule: { default: "manual" },
|
|
786
|
+
calendar: {},
|
|
787
|
+
criticalPath: {
|
|
788
|
+
type: Boolean,
|
|
789
|
+
default: !1
|
|
790
|
+
},
|
|
791
|
+
baselines: {
|
|
792
|
+
type: Boolean,
|
|
793
|
+
default: !1
|
|
794
|
+
},
|
|
795
|
+
today: {},
|
|
796
|
+
snap: {},
|
|
797
|
+
weekStartsOn: { default: 1 },
|
|
798
|
+
minPxPerDay: { default: .15 },
|
|
799
|
+
maxPxPerDay: { default: 2400 },
|
|
800
|
+
locale: {},
|
|
801
|
+
label: {},
|
|
802
|
+
beforeDelete: {}
|
|
803
|
+
},
|
|
804
|
+
emits: [
|
|
805
|
+
"update:tasks",
|
|
806
|
+
"update:scale",
|
|
807
|
+
"update:selection",
|
|
808
|
+
"update:collapsed",
|
|
809
|
+
"update:gridWidth",
|
|
810
|
+
"task-click",
|
|
811
|
+
"task-dblclick",
|
|
812
|
+
"task-contextmenu",
|
|
813
|
+
"link",
|
|
814
|
+
"unlink",
|
|
815
|
+
"change",
|
|
816
|
+
"delete"
|
|
817
|
+
],
|
|
818
|
+
setup(r, { expose: a, emit: g }) {
|
|
819
|
+
let _ = r, T = g, _e = le(), D = e(), ve = l(() => _.locale ?? (D.lang === "en" ? void 0 : D.lang)), O = se(_.tasks);
|
|
820
|
+
de(() => _.tasks, (e) => {
|
|
821
|
+
O.value = e;
|
|
822
|
+
});
|
|
823
|
+
let A = se(null), M = l(() => Ne(ce(O.value))), P = l(() => A.value ?? M.value), be = [], Se = [], Ce = x(0);
|
|
824
|
+
function we(e) {
|
|
825
|
+
O.value = e, T("update:tasks", e);
|
|
826
|
+
}
|
|
827
|
+
function F(e) {
|
|
828
|
+
e = Ne(e), e !== M.value && (be.push(ce(O.value)), be.length > 100 && be.shift(), Se.length = 0, Ce.value++, we(e));
|
|
829
|
+
}
|
|
830
|
+
function Te() {
|
|
831
|
+
let e = be.pop();
|
|
832
|
+
e && (Se.push(ce(O.value)), Ce.value++, we(e));
|
|
833
|
+
}
|
|
834
|
+
function Ee() {
|
|
835
|
+
let e = Se.pop();
|
|
836
|
+
e && (be.push(ce(O.value)), Ce.value++, we(e));
|
|
837
|
+
}
|
|
838
|
+
let De = l(() => (Ce.value, be.length > 0)), Oe = l(() => (Ce.value, Se.length > 0)), I = l(() => new Map(P.value.map((e) => [e.id, e]))), L = l(() => je(P.value)), V = l(() => {
|
|
839
|
+
let e = /* @__PURE__ */ new Map();
|
|
840
|
+
for (let t of P.value) {
|
|
841
|
+
let n = t.parentId && I.value.has(t.parentId) ? t.parentId : void 0;
|
|
842
|
+
(e.get(n) ?? e.set(n, []).get(n)).push(t);
|
|
843
|
+
}
|
|
844
|
+
return e;
|
|
845
|
+
});
|
|
846
|
+
function Pe(e, t = [], n = 0) {
|
|
847
|
+
if (n > 100) return t;
|
|
848
|
+
for (let r of V.value.get(e) ?? []) t.push(r.id), Pe(r.id, t, n + 1);
|
|
849
|
+
return t;
|
|
850
|
+
}
|
|
851
|
+
let H = x(_.selection ?? []);
|
|
852
|
+
de(() => _.selection, (e) => {
|
|
853
|
+
e && (H.value = e);
|
|
854
|
+
});
|
|
855
|
+
let U = l(() => new Set(H.value));
|
|
856
|
+
function W(e) {
|
|
857
|
+
let t = e.filter((e) => I.value.get(e)?.selectable !== !1);
|
|
858
|
+
H.value = t, T("update:selection", t);
|
|
859
|
+
}
|
|
860
|
+
let Re = x(_.collapsed ?? []);
|
|
861
|
+
de(() => _.collapsed, (e) => {
|
|
862
|
+
e && (Re.value = e);
|
|
863
|
+
});
|
|
864
|
+
let G = l(() => new Set(Re.value));
|
|
865
|
+
function Be(e) {
|
|
866
|
+
Re.value = e, T("update:collapsed", e);
|
|
867
|
+
}
|
|
868
|
+
function vt(e, t) {
|
|
869
|
+
Be(t ?? G.value.has(e) ? Re.value.filter((t) => t !== e) : [...Re.value, e]);
|
|
870
|
+
}
|
|
871
|
+
let q = l(() => {
|
|
872
|
+
let e = [], t = (n, r) => {
|
|
873
|
+
for (let i of V.value.get(n) ?? []) {
|
|
874
|
+
let n = V.value.has(i.id);
|
|
875
|
+
e.push({
|
|
876
|
+
task: i,
|
|
877
|
+
depth: r,
|
|
878
|
+
parent: n
|
|
879
|
+
}), n && !G.value.has(i.id) && r < 100 && t(i.id, r + 1);
|
|
880
|
+
}
|
|
881
|
+
};
|
|
882
|
+
return t(void 0, 0), e;
|
|
883
|
+
}), yt = l(() => new Map(q.value.map((e, t) => [e.task.id, t]))), J = x(), bt = l(() => [
|
|
884
|
+
{
|
|
885
|
+
key: "name",
|
|
886
|
+
label: D.ganttTask
|
|
887
|
+
},
|
|
888
|
+
{
|
|
889
|
+
key: "start",
|
|
890
|
+
label: D.ganttStart,
|
|
891
|
+
width: 96
|
|
892
|
+
},
|
|
893
|
+
{
|
|
894
|
+
key: "duration",
|
|
895
|
+
label: D.ganttDuration,
|
|
896
|
+
width: 80,
|
|
897
|
+
align: "end"
|
|
898
|
+
}
|
|
899
|
+
]), xt = l(() => _.columns ?? bt.value), St = l(() => xt.value.length > 0), Ct = x(_.gridWidth ?? 320);
|
|
900
|
+
de(() => _.gridWidth, (e) => {
|
|
901
|
+
e !== void 0 && (Ct.value = e);
|
|
902
|
+
});
|
|
903
|
+
let wt = l(() => St.value ? Ct.value : 0), Tt = l(() => {
|
|
904
|
+
let e = Infinity, t = -Infinity;
|
|
905
|
+
for (let n of P.value) {
|
|
906
|
+
let r = z(n);
|
|
907
|
+
if (Number.isFinite(r.start) && (e = Math.min(e, r.start), t = Math.max(t, r.end), _.baselines && n.baselineStart)) {
|
|
908
|
+
let r = z({
|
|
909
|
+
start: n.baselineStart,
|
|
910
|
+
end: n.baselineEnd,
|
|
911
|
+
type: n.type
|
|
912
|
+
});
|
|
913
|
+
Number.isFinite(r.start) && (e = Math.min(e, r.start), t = Math.max(t, r.end));
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
return Number.isFinite(e) || (e = t = _.today ? k(_.today) : Date.now()), {
|
|
917
|
+
min: e,
|
|
918
|
+
max: t
|
|
919
|
+
};
|
|
920
|
+
}), Et = Le({
|
|
921
|
+
scroller: J,
|
|
922
|
+
listWidth: wt,
|
|
923
|
+
headerHeight: ht,
|
|
924
|
+
extent: Tt,
|
|
925
|
+
scale: () => _.scale,
|
|
926
|
+
pxPerDay: () => _.pxPerDay,
|
|
927
|
+
minPxPerDay: () => _.minPxPerDay,
|
|
928
|
+
maxPxPerDay: () => _.maxPxPerDay,
|
|
929
|
+
weekStartsOn: () => _.weekStartsOn,
|
|
930
|
+
lang: ve,
|
|
931
|
+
quarterLabel: () => D.ganttQuarter,
|
|
932
|
+
today: () => _.today,
|
|
933
|
+
calendar: () => _.calendar,
|
|
934
|
+
onScale: (e) => T("update:scale", e),
|
|
935
|
+
onPinch: () => {
|
|
936
|
+
Z && Jn({ pointerId: Z.id });
|
|
937
|
+
}
|
|
938
|
+
}), { ppd: Dt, view: Ot, timelineView: kt, origin: At, timelineWidth: jt, todayMs: Mt, xOf: Y, timeAt: X, zoomIn: Nt, zoomOut: Pt, setScale: Ft, scrollToDate: It, topCells: Lt, bottomCells: Rt, offTimes: zt } = Et, Bt = Et.scaleNow;
|
|
939
|
+
function Vt(e) {
|
|
940
|
+
let t = I.value.get(e), n = [];
|
|
941
|
+
for (let e = t?.parentId; e && I.value.has(e); e = I.value.get(e).parentId) G.value.has(e) && n.push(e);
|
|
942
|
+
n.length && Be(Re.value.filter((e) => !n.includes(e))), ee(() => {
|
|
943
|
+
t = I.value.get(e);
|
|
944
|
+
let n = yt.value.get(e);
|
|
945
|
+
if (!t || n === void 0 || !J.value) return;
|
|
946
|
+
let r = z(t), a = n * _.rowHeight, o = J.value, s = o.scrollTop, c = o.clientHeight - ht;
|
|
947
|
+
a < s ? s = a : a + _.rowHeight > s + c && (s = a + _.rowHeight - c);
|
|
948
|
+
let l = o.scrollLeft, u = Y(r.start);
|
|
949
|
+
(u < l || u > l + kt.value - 40) && (l = Math.max(0, u - 48)), o.scrollTo({
|
|
950
|
+
left: l,
|
|
951
|
+
top: s,
|
|
952
|
+
behavior: i() ? "auto" : "smooth"
|
|
953
|
+
});
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
let Ht = l(() => Math.max(0, Math.floor(Ot.value.top / _.rowHeight) - gt)), Ut = l(() => Math.min(q.value.length, Math.ceil((Ot.value.top + Ot.value.height) / _.rowHeight) + gt)), Wt = l(() => q.value.slice(Ht.value, Ut.value).map((e, t) => ({
|
|
957
|
+
...e,
|
|
958
|
+
index: Ht.value + t
|
|
959
|
+
}))), Gt = l(() => Math.max(q.value.length * _.rowHeight, Ot.value.height - ht)), Kt = l(() => Math.round(_.rowHeight * .6)), qt = l(() => _.criticalPath ? Ie(P.value, { calendar: _.calendar }) : null), Jt = l(() => qt.value ?? Ie(P.value, { calendar: _.calendar })), Yt = l(() => new Set(qt.value?.tasks ?? [])), Xt = l(() => new Set(qt.value?.dependencies ?? [])), Zt = l(() => {
|
|
960
|
+
let e = /* @__PURE__ */ new Map();
|
|
961
|
+
for (let t of P.value) {
|
|
962
|
+
let n = z(t);
|
|
963
|
+
Number.isFinite(n.start) && e.set(t.id, {
|
|
964
|
+
x: Y(n.start),
|
|
965
|
+
w: R(t) ? 0 : Math.max(2, Y(n.end) - Y(n.start))
|
|
966
|
+
});
|
|
967
|
+
}
|
|
968
|
+
return e;
|
|
969
|
+
}), Qt = /* @__PURE__ */ new Map(), $t = /* @__PURE__ */ new Map(), en = /* @__PURE__ */ new Map(), tn = 0, nn = {
|
|
970
|
+
ppd: Dt.value,
|
|
971
|
+
origin: At.value
|
|
972
|
+
};
|
|
973
|
+
de(Zt, (e) => {
|
|
974
|
+
let t = nn.ppd !== Dt.value || nn.origin !== At.value || i();
|
|
975
|
+
nn = {
|
|
976
|
+
ppd: Dt.value,
|
|
977
|
+
origin: At.value
|
|
978
|
+
};
|
|
979
|
+
let n = !1;
|
|
980
|
+
for (let [r, i] of e) {
|
|
981
|
+
let e = Qt.get(r);
|
|
982
|
+
if (!e || t) {
|
|
983
|
+
Qt.set(r, {
|
|
984
|
+
x: i.x,
|
|
985
|
+
w: i.w,
|
|
986
|
+
vx: 0,
|
|
987
|
+
vw: 0,
|
|
988
|
+
tx: i.x,
|
|
989
|
+
tw: i.w
|
|
990
|
+
});
|
|
991
|
+
continue;
|
|
992
|
+
}
|
|
993
|
+
(e.tx !== i.x || e.tw !== i.w) && (e.tx = i.x, e.tw = i.w, n = !0);
|
|
994
|
+
}
|
|
995
|
+
for (let t of Qt.keys()) e.has(t) || Qt.delete(t);
|
|
996
|
+
n ? rn() : on();
|
|
997
|
+
}, {
|
|
998
|
+
immediate: !0,
|
|
999
|
+
flush: "post"
|
|
1000
|
+
});
|
|
1001
|
+
function rn() {
|
|
1002
|
+
if (tn) return;
|
|
1003
|
+
let e = performance.now(), t = (n) => {
|
|
1004
|
+
let r = Math.min((n - e) / 1e3, 1 / 30);
|
|
1005
|
+
e = n;
|
|
1006
|
+
let i = !1;
|
|
1007
|
+
for (; r > 0;) {
|
|
1008
|
+
let e = Math.min(r, .004);
|
|
1009
|
+
for (let t of Qt.values()) (t.x !== t.tx || t.w !== t.tw || t.vx || t.vw) && (t.vx += (-700 * (t.x - t.tx) - 1.8 * Math.sqrt(700) * t.vx) * e, t.x += t.vx * e, t.vw += (-700 * (t.w - t.tw) - 1.8 * Math.sqrt(700) * t.vw) * e, t.w += t.vw * e);
|
|
1010
|
+
r -= e;
|
|
1011
|
+
}
|
|
1012
|
+
for (let e of Qt.values()) Math.abs(e.x - e.tx) < .3 && Math.abs(e.vx) < 2 && Math.abs(e.w - e.tw) < .3 && Math.abs(e.vw) < 2 ? (e.x = e.tx, e.w = e.tw, e.vx = 0, e.vw = 0) : i = !0;
|
|
1013
|
+
on(), tn = i ? requestAnimationFrame(t) : 0;
|
|
1014
|
+
};
|
|
1015
|
+
tn = requestAnimationFrame(t);
|
|
1016
|
+
}
|
|
1017
|
+
function an(e, t) {
|
|
1018
|
+
let n = Qt.get(e);
|
|
1019
|
+
n && (t.style.transform = `translateX(${n.x}px)`, t.style.width = `${n.w}px`);
|
|
1020
|
+
}
|
|
1021
|
+
function on() {
|
|
1022
|
+
for (let [e, t] of $t) an(e, t);
|
|
1023
|
+
for (let [e, t] of en) mn(e, t);
|
|
1024
|
+
}
|
|
1025
|
+
function sn(e, t) {
|
|
1026
|
+
t instanceof HTMLElement ? ($t.set(e, t), an(e, t)) : $t.delete(e);
|
|
1027
|
+
}
|
|
1028
|
+
let cn = (e) => Qt.get(e) ?? Zt.value.get(e), ln = l(() => {
|
|
1029
|
+
let e = [];
|
|
1030
|
+
for (let t of P.value) for (let n of t.dependencies ?? []) {
|
|
1031
|
+
let r = Ae(n);
|
|
1032
|
+
I.value.has(r.id) && e.push({
|
|
1033
|
+
key: `${r.id}>${t.id}`,
|
|
1034
|
+
from: r.id,
|
|
1035
|
+
to: t.id,
|
|
1036
|
+
type: r.type,
|
|
1037
|
+
lag: r.lag
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
return e;
|
|
1041
|
+
});
|
|
1042
|
+
function un(e) {
|
|
1043
|
+
let t = I.value.get(e);
|
|
1044
|
+
for (let e = 0; t && e < 100; e++) {
|
|
1045
|
+
let e = yt.value.get(t.id);
|
|
1046
|
+
if (e !== void 0) return e;
|
|
1047
|
+
t = t.parentId ? I.value.get(t.parentId) : void 0;
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
let dn = l(() => {
|
|
1051
|
+
let e = Ht.value, t = Ut.value;
|
|
1052
|
+
return ln.value.filter((n) => {
|
|
1053
|
+
let r = un(n.from), i = un(n.to);
|
|
1054
|
+
return r === void 0 || i === void 0 || r === i ? !1 : Math.min(r, i) <= t && Math.max(r, i) >= e;
|
|
1055
|
+
});
|
|
1056
|
+
});
|
|
1057
|
+
function fn(e) {
|
|
1058
|
+
let t = un(e.from), n = un(e.to);
|
|
1059
|
+
if (t === void 0 || n === void 0) return null;
|
|
1060
|
+
let r = cn(q.value[t].task.id), i = cn(q.value[n].task.id);
|
|
1061
|
+
if (!r || !i) return null;
|
|
1062
|
+
let a = _.rowHeight, o = t * a + a / 2, s = n * a + a / 2, c = e.type === "FS" || e.type === "FF", l = e.type === "FS" || e.type === "SS", u = (e) => e.w ? 0 : Kt.value * .4, d = c ? r.x + r.w + u(r) : r.x - u(r), f = l ? i.x - u(i) : i.x + i.w + u(i), p = d + (c ? _t : -10), m = f + (l ? -10 : _t);
|
|
1063
|
+
if (l ? p <= m : p >= m) return [
|
|
1064
|
+
[d, o],
|
|
1065
|
+
[p, o],
|
|
1066
|
+
[p, s],
|
|
1067
|
+
[f, s]
|
|
1068
|
+
];
|
|
1069
|
+
let h = s > o ? n * a : (n + 1) * a;
|
|
1070
|
+
return [
|
|
1071
|
+
[d, o],
|
|
1072
|
+
[p, o],
|
|
1073
|
+
[p, h],
|
|
1074
|
+
[m, h],
|
|
1075
|
+
[m, s],
|
|
1076
|
+
[f, s]
|
|
1077
|
+
];
|
|
1078
|
+
}
|
|
1079
|
+
function pn(e, t = 6) {
|
|
1080
|
+
let n = `M${e[0][0]},${e[0][1]}`;
|
|
1081
|
+
for (let r = 1; r < e.length - 1; r++) {
|
|
1082
|
+
let [i, a] = e[r - 1], [o, s] = e[r], [c, l] = e[r + 1], u = Math.hypot(o - i, s - a), d = Math.hypot(c - o, l - s), f = Math.min(t, u / 2, d / 2);
|
|
1083
|
+
if (f < .5) {
|
|
1084
|
+
n += ` L${o},${s}`;
|
|
1085
|
+
continue;
|
|
1086
|
+
}
|
|
1087
|
+
let p = o - (o - i) / u * f, m = s - (s - a) / u * f, h = o + (c - o) / d * f, g = s + (l - s) / d * f;
|
|
1088
|
+
n += ` L${p},${m} Q${o},${s} ${h},${g}`;
|
|
1089
|
+
}
|
|
1090
|
+
let [r, i] = e.at(-1);
|
|
1091
|
+
return `${n} L${r},${i}`;
|
|
1092
|
+
}
|
|
1093
|
+
function mn(e, t) {
|
|
1094
|
+
let n = ln.value.find((t) => t.key === e), r = n && fn(n);
|
|
1095
|
+
if (!r) return;
|
|
1096
|
+
let i = pn(r), [a, s] = r.at(-1), c = n.type === "FS" || n.type === "SS", l = t.querySelectorAll("path");
|
|
1097
|
+
l[0]?.setAttribute("d", i), l[1]?.setAttribute("d", i), l[2]?.setAttribute("d", o(a, s, c ? 0 : Math.PI, 7, !0));
|
|
1098
|
+
}
|
|
1099
|
+
function hn(e, t) {
|
|
1100
|
+
t instanceof SVGGElement ? (en.set(e, t), mn(e, t)) : en.delete(e);
|
|
1101
|
+
}
|
|
1102
|
+
let gn = x(null), _n = l(() => {
|
|
1103
|
+
let e = ln.value.find((e) => e.key === gn.value), t = e && fn(e);
|
|
1104
|
+
if (!t) return null;
|
|
1105
|
+
let n = Math.floor((t.length - 1) / 2);
|
|
1106
|
+
return {
|
|
1107
|
+
x: (t[n][0] + t[n + 1][0]) / 2,
|
|
1108
|
+
y: (t[n][1] + t[n + 1][1]) / 2
|
|
1109
|
+
};
|
|
1110
|
+
});
|
|
1111
|
+
function vn(e, t) {
|
|
1112
|
+
O.value.find((e) => e.id === t)?.dependencies?.some((t) => Ae(t).id === e) && (F(O.value.map((n) => n.id === t ? {
|
|
1113
|
+
...n,
|
|
1114
|
+
dependencies: n.dependencies.filter((t) => Ae(t).id !== e)
|
|
1115
|
+
} : n)), gn.value === `${e}>${t}` && (gn.value = null), T("unlink", {
|
|
1116
|
+
from: e,
|
|
1117
|
+
to: t
|
|
1118
|
+
}), _r(D.ganttUnlink));
|
|
1119
|
+
}
|
|
1120
|
+
function yn(e, t) {
|
|
1121
|
+
let n = /* @__PURE__ */ new Set(), r = [e];
|
|
1122
|
+
for (; r.length;) {
|
|
1123
|
+
let e = r.pop();
|
|
1124
|
+
if (e === t) return !0;
|
|
1125
|
+
if (!n.has(e)) {
|
|
1126
|
+
n.add(e);
|
|
1127
|
+
for (let t of I.value.get(e)?.dependencies ?? []) r.push(Ae(t).id);
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
return !1;
|
|
1131
|
+
}
|
|
1132
|
+
function bn(e, t) {
|
|
1133
|
+
if (e === t || _.readonly) return !1;
|
|
1134
|
+
let n = I.value.get(e), r = I.value.get(t);
|
|
1135
|
+
return !n || !r || n.linkable === !1 || r.linkable === !1 || Pe(e).includes(t) || Pe(t).includes(e) || r.dependencies?.some((t) => Ae(t).id === e) ? !1 : !yn(e, t);
|
|
1136
|
+
}
|
|
1137
|
+
function xn(e, t, n = "FS", r = 0) {
|
|
1138
|
+
if (!bn(e, t)) return;
|
|
1139
|
+
let i = n === "FS" && !r ? e : {
|
|
1140
|
+
id: e,
|
|
1141
|
+
type: n,
|
|
1142
|
+
...r ? { lag: r } : {}
|
|
1143
|
+
}, a = O.value.map((e) => e.id === t ? {
|
|
1144
|
+
...e,
|
|
1145
|
+
dependencies: [...e.dependencies ?? [], i]
|
|
1146
|
+
} : e);
|
|
1147
|
+
_.schedule === "auto" && (a = Fe(a, Sn())), F(a), T("link", {
|
|
1148
|
+
from: e,
|
|
1149
|
+
to: t,
|
|
1150
|
+
type: n
|
|
1151
|
+
}), _r(D.ganttLinked.replace("{from}", I.value.get(e)?.name ?? e).replace("{to}", I.value.get(t)?.name ?? t));
|
|
1152
|
+
}
|
|
1153
|
+
let Sn = () => ({ calendar: _.calendar ? _.calendar : void 0 });
|
|
1154
|
+
function Cn(e, t = {}) {
|
|
1155
|
+
let n = Array.isArray(e) ? e : [e], r = [...O.value], i = t.after ? r.findIndex((e) => e.id === t.after) : -1;
|
|
1156
|
+
if (i >= 0) {
|
|
1157
|
+
let e = new Set(Pe(t.after));
|
|
1158
|
+
for (; i + 1 < r.length && e.has(r[i + 1].id);) i++;
|
|
1159
|
+
r.splice(i + 1, 0, ...n);
|
|
1160
|
+
} else r.push(...n);
|
|
1161
|
+
F(r);
|
|
1162
|
+
}
|
|
1163
|
+
function wn(e, t) {
|
|
1164
|
+
let n = O.value.map((n) => n.id === e ? typeof t == "function" ? t(n) : {
|
|
1165
|
+
...n,
|
|
1166
|
+
...t
|
|
1167
|
+
} : n);
|
|
1168
|
+
_.schedule === "auto" && (n = Fe(n, Sn())), F(n);
|
|
1169
|
+
}
|
|
1170
|
+
async function Tn(e) {
|
|
1171
|
+
let t = /* @__PURE__ */ new Set();
|
|
1172
|
+
for (let n of e) {
|
|
1173
|
+
let e = I.value.get(n);
|
|
1174
|
+
if (e && e.deletable !== !1) {
|
|
1175
|
+
t.add(n);
|
|
1176
|
+
for (let e of Pe(n)) t.add(e);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
if (!t.size) return;
|
|
1180
|
+
let n = O.value.filter((e) => t.has(e.id));
|
|
1181
|
+
(!_.beforeDelete || await _.beforeDelete(n)) && (F(O.value.filter((e) => !t.has(e.id)).map((e) => e.dependencies?.some((e) => t.has(Ae(e).id)) ? {
|
|
1182
|
+
...e,
|
|
1183
|
+
dependencies: e.dependencies.filter((e) => !t.has(Ae(e).id))
|
|
1184
|
+
} : e)), W(H.value.filter((e) => !t.has(e))), T("delete", { tasks: n }), _r(D.ganttDeleted.replace("{count}", String(n.length))));
|
|
1185
|
+
}
|
|
1186
|
+
function En(e) {
|
|
1187
|
+
F(Fe(O.value, {
|
|
1188
|
+
...Sn(),
|
|
1189
|
+
...e
|
|
1190
|
+
}));
|
|
1191
|
+
}
|
|
1192
|
+
function Dn(e) {
|
|
1193
|
+
let t = e - (J.value?.getBoundingClientRect()?.left ?? 0) - wt.value + Ot.value.left;
|
|
1194
|
+
return j(xe(X(t), 1440), !0);
|
|
1195
|
+
}
|
|
1196
|
+
let Z = null, On, kn = x(null), Q = x(null), An = x(null), jn = {
|
|
1197
|
+
x: 0,
|
|
1198
|
+
y: 0
|
|
1199
|
+
};
|
|
1200
|
+
function Mn(e, t) {
|
|
1201
|
+
let n = J.value.getBoundingClientRect();
|
|
1202
|
+
return {
|
|
1203
|
+
x: e - n.left - wt.value + J.value.scrollLeft,
|
|
1204
|
+
y: t - n.top - ht + J.value.scrollTop
|
|
1205
|
+
};
|
|
1206
|
+
}
|
|
1207
|
+
let Nn = (e) => e instanceof Element && !!e.closest("input, textarea, select, button, a, [contenteditable], [data-gantt-action]");
|
|
1208
|
+
function Pn(e, t, n) {
|
|
1209
|
+
if (e.button !== 0 || Nn(e.target) || _.readonly && n !== "body") return;
|
|
1210
|
+
e.stopPropagation();
|
|
1211
|
+
let r = e.pointerType === "touch";
|
|
1212
|
+
Z = {
|
|
1213
|
+
kind: "bar",
|
|
1214
|
+
part: n,
|
|
1215
|
+
id: e.pointerId,
|
|
1216
|
+
taskId: t.id,
|
|
1217
|
+
sx: e.clientX,
|
|
1218
|
+
sy: e.clientY,
|
|
1219
|
+
sl: J.value.scrollLeft,
|
|
1220
|
+
touch: r,
|
|
1221
|
+
active: !1,
|
|
1222
|
+
spans: /* @__PURE__ */ new Map(),
|
|
1223
|
+
moving: []
|
|
1224
|
+
}, Rn(), r && n === "body" ? On = setTimeout(() => Bn(e), 250) : r && Bn(e);
|
|
1225
|
+
}
|
|
1226
|
+
function Fn(e) {
|
|
1227
|
+
e.button !== 0 || e.pointerType === "touch" || Nn(e.target) || (Z = {
|
|
1228
|
+
kind: "pan",
|
|
1229
|
+
id: e.pointerId,
|
|
1230
|
+
sx: e.clientX,
|
|
1231
|
+
sy: e.clientY,
|
|
1232
|
+
sl: J.value.scrollLeft,
|
|
1233
|
+
st: J.value.scrollTop,
|
|
1234
|
+
moved: !1
|
|
1235
|
+
}, Rn());
|
|
1236
|
+
}
|
|
1237
|
+
function In(e, t) {
|
|
1238
|
+
if (e.button !== 0 || Nn(e.target) || _.readonly || vr.value) return;
|
|
1239
|
+
let n = e.pointerType === "touch";
|
|
1240
|
+
Z = {
|
|
1241
|
+
kind: "row",
|
|
1242
|
+
id: e.pointerId,
|
|
1243
|
+
taskId: t.id,
|
|
1244
|
+
sx: e.clientX,
|
|
1245
|
+
sy: e.clientY,
|
|
1246
|
+
st: J.value.scrollTop,
|
|
1247
|
+
touch: n,
|
|
1248
|
+
active: !1
|
|
1249
|
+
}, Rn(), n && (On = setTimeout(() => Bn(e), 350));
|
|
1250
|
+
}
|
|
1251
|
+
function Ln(e) {
|
|
1252
|
+
e.button === 0 && (e.preventDefault(), Z = {
|
|
1253
|
+
kind: "split",
|
|
1254
|
+
id: e.pointerId,
|
|
1255
|
+
sx: e.clientX,
|
|
1256
|
+
w: Ct.value
|
|
1257
|
+
}, Rn());
|
|
1258
|
+
}
|
|
1259
|
+
function Rn() {
|
|
1260
|
+
window.addEventListener("pointermove", Vn), window.addEventListener("pointerup", qn), window.addEventListener("pointercancel", Jn);
|
|
1261
|
+
}
|
|
1262
|
+
function zn() {
|
|
1263
|
+
window.removeEventListener("pointermove", Vn), window.removeEventListener("pointerup", qn), window.removeEventListener("pointercancel", Jn), clearTimeout(On), document.body.style.userSelect = "";
|
|
1264
|
+
}
|
|
1265
|
+
function Bn(e) {
|
|
1266
|
+
let t = Z;
|
|
1267
|
+
if (!t || t.kind !== "bar" && t.kind !== "row" || t.active) return;
|
|
1268
|
+
let n = I.value.get(t.taskId);
|
|
1269
|
+
if (n) {
|
|
1270
|
+
if (t.kind === "bar") {
|
|
1271
|
+
if (t.part === "body" && (_.readonly || n.draggable === !1) || (t.part === "start" || t.part === "end") && n.resizable === !1 || (t.part === "link-start" || t.part === "link-end") && n.linkable === !1) return;
|
|
1272
|
+
t.active = !0;
|
|
1273
|
+
let r = t.part === "body" && U.value.has(n.id) ? H.value : [n.id], i = /* @__PURE__ */ new Set();
|
|
1274
|
+
for (let e of r) {
|
|
1275
|
+
let t = I.value.get(e);
|
|
1276
|
+
if (t && t.draggable !== !1) {
|
|
1277
|
+
i.add(e);
|
|
1278
|
+
for (let t of Pe(e)) i.add(t);
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
t.moving = t.part === "body" ? [...i] : [n.id];
|
|
1282
|
+
for (let e of t.moving) {
|
|
1283
|
+
let n = z(I.value.get(e));
|
|
1284
|
+
t.spans.set(e, {
|
|
1285
|
+
start: n.start,
|
|
1286
|
+
end: n.end
|
|
1287
|
+
});
|
|
1288
|
+
}
|
|
1289
|
+
if (U.value.has(n.id) || W([n.id]), kn.value = {
|
|
1290
|
+
taskId: n.id,
|
|
1291
|
+
part: t.part
|
|
1292
|
+
}, t.part === "link-start" || t.part === "link-end") {
|
|
1293
|
+
let r = Mn(e.clientX, e.clientY);
|
|
1294
|
+
Q.value = {
|
|
1295
|
+
from: n.id,
|
|
1296
|
+
fromEnd: t.part === "link-end",
|
|
1297
|
+
x: r.x,
|
|
1298
|
+
y: r.y,
|
|
1299
|
+
target: null,
|
|
1300
|
+
targetEnd: !1,
|
|
1301
|
+
valid: !1
|
|
1302
|
+
};
|
|
1303
|
+
}
|
|
1304
|
+
} else t.active = !0, kn.value = {
|
|
1305
|
+
taskId: n.id,
|
|
1306
|
+
part: "body"
|
|
1307
|
+
};
|
|
1308
|
+
t.touch && navigator.vibrate?.(10), document.body.style.userSelect = "none", Zn();
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
function Vn(e) {
|
|
1312
|
+
let t = Z;
|
|
1313
|
+
if (t && t.id === e.pointerId) {
|
|
1314
|
+
if (jn.x = e.clientX, jn.y = e.clientY, t.kind === "split") {
|
|
1315
|
+
let n = Math.round(Math.min(Math.max(120, t.w + e.clientX - t.sx), Math.max(160, Ot.value.width - 80)));
|
|
1316
|
+
Ct.value = n, T("update:gridWidth", n);
|
|
1317
|
+
return;
|
|
1318
|
+
}
|
|
1319
|
+
if (t.kind === "pan") {
|
|
1320
|
+
let n = e.clientX - t.sx, r = e.clientY - t.sy;
|
|
1321
|
+
if (!t.moved && Math.hypot(n, r) < 4) return;
|
|
1322
|
+
t.moved = !0, J.value.scrollLeft = t.sl - n, J.value.scrollTop = t.st - r;
|
|
1323
|
+
return;
|
|
1324
|
+
}
|
|
1325
|
+
if (!t.active) {
|
|
1326
|
+
let n = Math.hypot(e.clientX - t.sx, e.clientY - t.sy);
|
|
1327
|
+
if (t.touch) {
|
|
1328
|
+
n > 8 && (Z = null, zn());
|
|
1329
|
+
return;
|
|
1330
|
+
}
|
|
1331
|
+
if (n < 4 || (Bn(e), !t.active)) return;
|
|
1332
|
+
}
|
|
1333
|
+
Un(e.clientX, e.clientY);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
function Hn(e) {
|
|
1337
|
+
return z(e).dateOnly ? 1440 : _.snap ?? ke(Dt.value);
|
|
1338
|
+
}
|
|
1339
|
+
function Un(e, t) {
|
|
1340
|
+
let n = Z;
|
|
1341
|
+
if (!n || n.kind !== "bar" && n.kind !== "row" || !n.active) return;
|
|
1342
|
+
if (n.kind === "row") return Gn(t);
|
|
1343
|
+
let r = Mn(e, t), i = (e - n.sx + (J.value.scrollLeft - n.sl)) / Dt.value * E, a = I.value.get(n.taskId), o = M.value;
|
|
1344
|
+
if (n.part === "link-start" || n.part === "link-end") {
|
|
1345
|
+
let i = Wn(e, t), a = i && i !== n.taskId ? i : null, o = a ? cn(a) : void 0, s = !!o && r.x > o.x + o.w / 2;
|
|
1346
|
+
Q.value = {
|
|
1347
|
+
from: n.taskId,
|
|
1348
|
+
fromEnd: n.part === "link-end",
|
|
1349
|
+
x: r.x,
|
|
1350
|
+
y: r.y,
|
|
1351
|
+
target: a,
|
|
1352
|
+
targetEnd: s,
|
|
1353
|
+
valid: !!a && bn(n.taskId, a)
|
|
1354
|
+
};
|
|
1355
|
+
return;
|
|
1356
|
+
}
|
|
1357
|
+
let s = /* @__PURE__ */ new Map();
|
|
1358
|
+
if (n.part === "progress") {
|
|
1359
|
+
let e = n.spans.get(n.taskId), t = Y(e.start), i = Math.max(1, Y(e.end) - t), o = Math.round(Math.min(100, Math.max(0, (r.x - t) / i * 100)));
|
|
1360
|
+
s.set(n.taskId, {
|
|
1361
|
+
...a,
|
|
1362
|
+
progress: o
|
|
1363
|
+
});
|
|
1364
|
+
} else if (n.part === "body") {
|
|
1365
|
+
let e = n.spans.get(n.taskId), t = Hn(a), r = xe(e.start + i, t), c = z(a).dateOnly ? ye(e.start, r) : 0, l = r - e.start;
|
|
1366
|
+
for (let e of n.moving) {
|
|
1367
|
+
let t = o.find((t) => t.id === e), r = n.spans.get(e);
|
|
1368
|
+
if (!t || !r || L.value.has(e) && V.value.has(e)) continue;
|
|
1369
|
+
let i = z(t).dateOnly, a = i ? N(r.start, c || Math.round(l / 864e5)) : r.start + l, u = i ? N(r.end, c || Math.round(l / 864e5)) : r.end + l;
|
|
1370
|
+
s.set(e, {
|
|
1371
|
+
...t,
|
|
1372
|
+
...Me(t, a, u)
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
} else {
|
|
1376
|
+
let e = n.spans.get(n.taskId), t = Hn(a), r = z(a).dateOnly ? E : t * 6e4;
|
|
1377
|
+
if (n.part === "start") {
|
|
1378
|
+
let o = Math.min(xe(e.start + i, t), e.end - r);
|
|
1379
|
+
s.set(n.taskId, {
|
|
1380
|
+
...a,
|
|
1381
|
+
...Me(a, o, e.end)
|
|
1382
|
+
});
|
|
1383
|
+
} else {
|
|
1384
|
+
let o = Math.max(xe(e.end + i, t), e.start + r);
|
|
1385
|
+
s.set(n.taskId, {
|
|
1386
|
+
...a,
|
|
1387
|
+
...Me(a, e.start, o)
|
|
1388
|
+
});
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
let c = o.map((e) => s.get(e.id) ?? e);
|
|
1392
|
+
_.schedule === "auto" && n.part !== "progress" && (c = Fe(c, Sn())), A.value = Ne(c);
|
|
1393
|
+
}
|
|
1394
|
+
function Wn(e, t) {
|
|
1395
|
+
let n = (document.elementFromPoint?.(e, t))?.closest("[data-gantt-task]");
|
|
1396
|
+
if (n) return n.getAttribute("data-gantt-task");
|
|
1397
|
+
let r = Mn(e, t);
|
|
1398
|
+
return q.value[Math.floor(r.y / _.rowHeight)]?.task.id ?? null;
|
|
1399
|
+
}
|
|
1400
|
+
function Gn(e) {
|
|
1401
|
+
let t = Z, n = e - J.value.getBoundingClientRect().top - ht + J.value.scrollTop, r = Math.max(0, Math.min(q.value.length - 1, Math.floor(n / _.rowHeight))), i = q.value[r].task, a = n / _.rowHeight - r, o = i.id === t.taskId || Pe(t.taskId).includes(i.id), s = a < .3 ? "before" : a > .7 ? "after" : "inside";
|
|
1402
|
+
An.value = o ? null : {
|
|
1403
|
+
taskId: t.taskId,
|
|
1404
|
+
target: i.id,
|
|
1405
|
+
where: s
|
|
1406
|
+
};
|
|
1407
|
+
}
|
|
1408
|
+
function Kn(e, t, n) {
|
|
1409
|
+
let r = O.value, i = /* @__PURE__ */ new Set([e, ...Pe(e)]), a = r.filter((e) => i.has(e.id)), o = r.filter((e) => !i.has(e.id)), s = o.findIndex((e) => e.id === t);
|
|
1410
|
+
if (s < 0) return;
|
|
1411
|
+
let c = o[s], l = s;
|
|
1412
|
+
if (n !== "before") {
|
|
1413
|
+
let e = new Set(Pe(t));
|
|
1414
|
+
for (l = s + 1; l < o.length && e.has(o[l].id);) l++;
|
|
1415
|
+
}
|
|
1416
|
+
let u = n === "inside" ? t : c.parentId, d = {
|
|
1417
|
+
...a[0],
|
|
1418
|
+
parentId: u
|
|
1419
|
+
};
|
|
1420
|
+
u || delete d.parentId, a[0] = d;
|
|
1421
|
+
let f = [
|
|
1422
|
+
...o.slice(0, l),
|
|
1423
|
+
...a,
|
|
1424
|
+
...o.slice(l)
|
|
1425
|
+
];
|
|
1426
|
+
n === "inside" && G.value.has(t) && vt(t, !0), F(f);
|
|
1427
|
+
let p = q.value.findIndex((t) => t.task.id === e) + 1;
|
|
1428
|
+
T("change", {
|
|
1429
|
+
tasks: [d],
|
|
1430
|
+
kind: "reorder"
|
|
1431
|
+
}), ee(() => _r(D.ganttReordered.replace("{name}", d.name).replace("{pos}", String(q.value.findIndex((t) => t.task.id === e) + 1 || p))));
|
|
1432
|
+
}
|
|
1433
|
+
function qn(e) {
|
|
1434
|
+
let t = Z;
|
|
1435
|
+
if (!t || t.id !== e.pointerId || (Z = null, zn(), Qn(), t.kind === "pan" || t.kind === "split")) return;
|
|
1436
|
+
if (t.kind === "row") {
|
|
1437
|
+
kn.value = null;
|
|
1438
|
+
let e = An.value;
|
|
1439
|
+
An.value = null, t.active && e && Kn(e.taskId, e.target, e.where);
|
|
1440
|
+
return;
|
|
1441
|
+
}
|
|
1442
|
+
if (kn.value = null, !t.active) {
|
|
1443
|
+
let n = I.value.get(t.taskId);
|
|
1444
|
+
if (!n) return;
|
|
1445
|
+
Yn(n, e), T("task-click", n, e);
|
|
1446
|
+
return;
|
|
1447
|
+
}
|
|
1448
|
+
if (t.part === "link-start" || t.part === "link-end") {
|
|
1449
|
+
let e = Q.value;
|
|
1450
|
+
Q.value = null, e?.target && e.valid && xn(e.from, e.target, e.fromEnd ? e.targetEnd ? "FF" : "FS" : e.targetEnd ? "SF" : "SS");
|
|
1451
|
+
return;
|
|
1452
|
+
}
|
|
1453
|
+
let n = A.value;
|
|
1454
|
+
if (A.value = null, !n) return;
|
|
1455
|
+
let r = new Map(M.value.map((e) => [e.id, e])), i = n.filter((e) => r.get(e.id) && r.get(e.id) !== e && !(L.value.has(e.id) && V.value.has(e.id)));
|
|
1456
|
+
if (!i.length) return;
|
|
1457
|
+
let a = new Map(n.map((e) => [e.id, e]));
|
|
1458
|
+
F(O.value.map((e) => i.some((t) => t.id === e.id) ? a.get(e.id) : e));
|
|
1459
|
+
let o = t.part === "progress" ? "progress" : t.part === "body" ? "move" : "resize";
|
|
1460
|
+
T("change", {
|
|
1461
|
+
tasks: i,
|
|
1462
|
+
kind: o
|
|
1463
|
+
});
|
|
1464
|
+
let s = a.get(t.taskId);
|
|
1465
|
+
_r(o === "progress" ? D.ganttProgressSet.replace("{name}", s.name).replace("{progress}", String(s.progress ?? 0)) : D.ganttMoved.replace("{name}", s.name).replace("{start}", or(s.start)).replace("{end}", or(s.end ?? s.start)));
|
|
1466
|
+
}
|
|
1467
|
+
function Jn(e) {
|
|
1468
|
+
Z && Z.id === e.pointerId && (Z = null, zn(), Qn(), A.value = null, kn.value = null, Q.value = null, An.value = null);
|
|
1469
|
+
}
|
|
1470
|
+
function Yn(e, t) {
|
|
1471
|
+
gn.value = null, e.selectable !== !1 && (t.shiftKey || t.metaKey || t.ctrlKey ? W(U.value.has(e.id) ? H.value.filter((t) => t !== e.id) : [...H.value, e.id]) : W([e.id]), mr.value = e.id);
|
|
1472
|
+
}
|
|
1473
|
+
let Xn = 0;
|
|
1474
|
+
function Zn() {
|
|
1475
|
+
if (Xn) return;
|
|
1476
|
+
let e = () => {
|
|
1477
|
+
Xn = requestAnimationFrame(e);
|
|
1478
|
+
let t = J.value;
|
|
1479
|
+
if (!t || !Z || !("active" in Z) || !Z.active) return;
|
|
1480
|
+
let n = t.getBoundingClientRect(), r = n.left + wt.value, i = 0, a = 0;
|
|
1481
|
+
Z.kind === "bar" && (jn.x < r + 40 ? i = -Math.ceil((r + 40 - jn.x) / 4) : jn.x > n.right - 40 && (i = Math.ceil((jn.x - n.right + 40) / 4))), jn.y < n.top + ht + 40 ? a = -Math.ceil((n.top + ht + 40 - jn.y) / 4) : jn.y > n.bottom - 40 && (a = Math.ceil((jn.y - n.bottom + 40) / 4)), (i || a) && (t.scrollLeft += i, t.scrollTop += a, Un(jn.x, jn.y));
|
|
1482
|
+
};
|
|
1483
|
+
Xn = requestAnimationFrame(e);
|
|
1484
|
+
}
|
|
1485
|
+
function Qn() {
|
|
1486
|
+
cancelAnimationFrame(Xn), Xn = 0;
|
|
1487
|
+
}
|
|
1488
|
+
function $n(e) {
|
|
1489
|
+
Et.pinchMove(e) || Z && "active" in Z && Z.active && e.cancelable && e.preventDefault();
|
|
1490
|
+
}
|
|
1491
|
+
function er() {
|
|
1492
|
+
Et.readView(), tr.value = null;
|
|
1493
|
+
}
|
|
1494
|
+
let tr = x(null), nr;
|
|
1495
|
+
function rr(e, t) {
|
|
1496
|
+
if (e.pointerType === "touch") return;
|
|
1497
|
+
clearTimeout(nr);
|
|
1498
|
+
let n = e.currentTarget;
|
|
1499
|
+
nr = setTimeout(() => {
|
|
1500
|
+
let e = n.getBoundingClientRect();
|
|
1501
|
+
tr.value = {
|
|
1502
|
+
id: t.id,
|
|
1503
|
+
x: e.left + e.width / 2,
|
|
1504
|
+
y: e.top
|
|
1505
|
+
};
|
|
1506
|
+
}, 450);
|
|
1507
|
+
}
|
|
1508
|
+
function ir() {
|
|
1509
|
+
clearTimeout(nr), tr.value = null;
|
|
1510
|
+
}
|
|
1511
|
+
let $ = l(() => {
|
|
1512
|
+
let e = kn.value?.taskId ?? tr.value?.id;
|
|
1513
|
+
return e ? I.value.get(e) : void 0;
|
|
1514
|
+
}), ar = x({
|
|
1515
|
+
x: 0,
|
|
1516
|
+
y: 0
|
|
1517
|
+
});
|
|
1518
|
+
de($, () => {
|
|
1519
|
+
if (kn.value) {
|
|
1520
|
+
let e = $t.get(kn.value.taskId)?.getBoundingClientRect();
|
|
1521
|
+
e && (ar.value = {
|
|
1522
|
+
x: e.left + e.width / 2,
|
|
1523
|
+
y: e.top
|
|
1524
|
+
});
|
|
1525
|
+
} else tr.value && (ar.value = {
|
|
1526
|
+
x: tr.value.x,
|
|
1527
|
+
y: tr.value.y
|
|
1528
|
+
});
|
|
1529
|
+
}, { flush: "post" }), de(A, () => {
|
|
1530
|
+
kn.value && ee(() => {
|
|
1531
|
+
let e = $t.get(kn.value?.taskId ?? "")?.getBoundingClientRect();
|
|
1532
|
+
e && (ar.value = {
|
|
1533
|
+
x: Math.min(Math.max(e.left + e.width / 2, 120), window.innerWidth - 120),
|
|
1534
|
+
y: e.top
|
|
1535
|
+
});
|
|
1536
|
+
});
|
|
1537
|
+
});
|
|
1538
|
+
function or(e) {
|
|
1539
|
+
let t = k(e);
|
|
1540
|
+
if (Number.isNaN(t)) return "";
|
|
1541
|
+
let n = {
|
|
1542
|
+
day: "numeric",
|
|
1543
|
+
month: "short"
|
|
1544
|
+
};
|
|
1545
|
+
return new Date(t).getFullYear() !== (/* @__PURE__ */ new Date()).getFullYear() && (n.year = "2-digit"), /^\d{4}-\d{2}-\d{2}$/.test(e) || (n.hour = "numeric", n.minute = "2-digit"), new Intl.DateTimeFormat(ve.value, n).format(t);
|
|
1546
|
+
}
|
|
1547
|
+
function sr(e) {
|
|
1548
|
+
if (R(e)) return D.ganttMilestone;
|
|
1549
|
+
let t = B(e);
|
|
1550
|
+
return z(e).dateOnly || t >= 1 ? D.ganttDays.replace("{n}", String(Math.round(t * 10) / 10)) : D.ganttHours.replace("{n}", String(Math.round(t * 24 * 10) / 10));
|
|
1551
|
+
}
|
|
1552
|
+
let cr = l(() => {
|
|
1553
|
+
let e = xt.value.reduce((e, t) => e + (t.key === "name" && !t.width ? 0 : t.width ?? 100), 0);
|
|
1554
|
+
return xt.value.map((t) => t.key === "name" && !t.width ? Math.max(120, Ct.value - e) : t.width ?? 100);
|
|
1555
|
+
});
|
|
1556
|
+
function lr(e, t) {
|
|
1557
|
+
if (t.format) return t.format(e);
|
|
1558
|
+
switch (t.key) {
|
|
1559
|
+
case "name": return e.name;
|
|
1560
|
+
case "start": return or(e.start);
|
|
1561
|
+
case "end": return R(e) ? "" : or(e.end ?? e.start);
|
|
1562
|
+
case "duration": return sr(e);
|
|
1563
|
+
case "progress": return R(e) ? "" : `${Math.round(e.progress ?? 0)}%`;
|
|
1564
|
+
}
|
|
1565
|
+
let n = e.data?.[t.key] ?? e[t.key];
|
|
1566
|
+
return n == null ? "" : String(n);
|
|
1567
|
+
}
|
|
1568
|
+
function ur(e) {
|
|
1569
|
+
if (!_.baselines || !e.baselineStart) return null;
|
|
1570
|
+
let t = z({
|
|
1571
|
+
start: e.baselineStart,
|
|
1572
|
+
end: e.baselineEnd ?? (e.end ? e.baselineStart : void 0),
|
|
1573
|
+
type: e.type
|
|
1574
|
+
});
|
|
1575
|
+
return Number.isFinite(t.start) ? {
|
|
1576
|
+
x: Y(t.start),
|
|
1577
|
+
w: Math.max(4, Y(t.end) - Y(t.start))
|
|
1578
|
+
} : null;
|
|
1579
|
+
}
|
|
1580
|
+
let dr = (e) => {
|
|
1581
|
+
let t = Zt.value.get(e.id);
|
|
1582
|
+
return !!t && t.w > e.name.length * 7 + 24;
|
|
1583
|
+
}, fr = {
|
|
1584
|
+
primary: {
|
|
1585
|
+
bar: "bg-primary-container text-on-primary-container",
|
|
1586
|
+
fill: "bg-primary/30",
|
|
1587
|
+
solid: "bg-primary text-primary"
|
|
1588
|
+
},
|
|
1589
|
+
secondary: {
|
|
1590
|
+
bar: "bg-secondary-container text-on-secondary-container",
|
|
1591
|
+
fill: "bg-secondary/30",
|
|
1592
|
+
solid: "bg-secondary text-secondary"
|
|
1593
|
+
},
|
|
1594
|
+
tertiary: {
|
|
1595
|
+
bar: "bg-tertiary-container text-on-tertiary-container",
|
|
1596
|
+
fill: "bg-tertiary/30",
|
|
1597
|
+
solid: "bg-tertiary text-tertiary"
|
|
1598
|
+
},
|
|
1599
|
+
error: {
|
|
1600
|
+
bar: "bg-error-container text-on-error-container",
|
|
1601
|
+
fill: "bg-error/30",
|
|
1602
|
+
solid: "bg-error text-error"
|
|
1603
|
+
},
|
|
1604
|
+
success: {
|
|
1605
|
+
bar: "bg-success-container text-on-success-container",
|
|
1606
|
+
fill: "bg-success/30",
|
|
1607
|
+
solid: "bg-success text-success"
|
|
1608
|
+
},
|
|
1609
|
+
neutral: {
|
|
1610
|
+
bar: "bg-surface-container-highest text-on-surface",
|
|
1611
|
+
fill: "bg-on-surface/16",
|
|
1612
|
+
solid: "bg-on-surface-variant text-on-surface-variant"
|
|
1613
|
+
}
|
|
1614
|
+
};
|
|
1615
|
+
function pr(e) {
|
|
1616
|
+
return Yt.value.has(e.id) && !(L.value.has(e.id) && V.value.has(e.id)) ? fr.error : fr[e.color ?? (L.value.has(e.id) ? "neutral" : "primary")] ?? fr.primary;
|
|
1617
|
+
}
|
|
1618
|
+
let mr = x(null), hr = l(() => mr.value && yt.value.has(mr.value) ? mr.value : q.value[0]?.task.id), gr = x("");
|
|
1619
|
+
function _r(e) {
|
|
1620
|
+
gr.value = "", ee(() => {
|
|
1621
|
+
gr.value = e;
|
|
1622
|
+
});
|
|
1623
|
+
}
|
|
1624
|
+
let vr = x(null), yr = x("");
|
|
1625
|
+
function br(e) {
|
|
1626
|
+
let t = I.value.get(e);
|
|
1627
|
+
t && !_.readonly && (vr.value = e, yr.value = t.name, ee(() => {
|
|
1628
|
+
let e = J.value?.querySelector("[data-gantt-rename]");
|
|
1629
|
+
e?.focus(), e?.select();
|
|
1630
|
+
}));
|
|
1631
|
+
}
|
|
1632
|
+
function xr(e) {
|
|
1633
|
+
let t = vr.value;
|
|
1634
|
+
if (!t) return;
|
|
1635
|
+
vr.value = null;
|
|
1636
|
+
let n = O.value.find((e) => e.id === t);
|
|
1637
|
+
if (e && n && yr.value.trim() && yr.value !== n.name) {
|
|
1638
|
+
let e = {
|
|
1639
|
+
...n,
|
|
1640
|
+
name: yr.value.trim()
|
|
1641
|
+
};
|
|
1642
|
+
F(O.value.map((n) => n.id === t ? e : n)), T("change", {
|
|
1643
|
+
tasks: [e],
|
|
1644
|
+
kind: "rename"
|
|
1645
|
+
});
|
|
1646
|
+
}
|
|
1647
|
+
Sr(t);
|
|
1648
|
+
}
|
|
1649
|
+
function Sr(e) {
|
|
1650
|
+
mr.value = e, ee(() => J.value?.querySelector(`[data-gantt-row="${CSS.escape(e)}"]`)?.focus({ preventScroll: !0 }));
|
|
1651
|
+
}
|
|
1652
|
+
function Cr(e, t, n) {
|
|
1653
|
+
let r = z(e), i = Hn(e), a = (e) => r.dateOnly ? N(e, t) : e + t * i * 6e4, o = n ? r.start : a(r.start), s = a(r.end);
|
|
1654
|
+
n && s <= r.start && (s = r.dateOnly ? N(r.start, 1) : r.start + i * 6e4);
|
|
1655
|
+
let c = n ? [e.id] : [e.id, ...Pe(e.id)], l = O.value.map((n) => {
|
|
1656
|
+
if (!c.includes(n.id) || L.value.has(n.id) && V.value.has(n.id)) return n;
|
|
1657
|
+
if (n.id === e.id) return {
|
|
1658
|
+
...n,
|
|
1659
|
+
...Me(n, o, s)
|
|
1660
|
+
};
|
|
1661
|
+
let r = z(n);
|
|
1662
|
+
return {
|
|
1663
|
+
...n,
|
|
1664
|
+
...Me(n, r.dateOnly ? N(r.start, t) : r.start + t * i * 6e4, r.dateOnly ? N(r.end, t) : r.end + t * i * 6e4)
|
|
1665
|
+
};
|
|
1666
|
+
}), u = _.schedule === "auto" ? Fe(l, Sn()) : l;
|
|
1667
|
+
F(u);
|
|
1668
|
+
let d = Ne(u).find((t) => t.id === e.id);
|
|
1669
|
+
T("change", {
|
|
1670
|
+
tasks: [d],
|
|
1671
|
+
kind: n ? "resize" : "move"
|
|
1672
|
+
}), _r(D.ganttMoved.replace("{name}", d.name).replace("{start}", or(d.start)).replace("{end}", or(d.end ?? d.start)));
|
|
1673
|
+
}
|
|
1674
|
+
function wr(e, t) {
|
|
1675
|
+
if (vr.value) return;
|
|
1676
|
+
let n = yt.value.get(t.id) ?? 0, r = e.ctrlKey || e.metaKey, i = (t) => {
|
|
1677
|
+
let n = q.value[Math.max(0, Math.min(q.value.length - 1, t))];
|
|
1678
|
+
n && (Sr(n.task.id), e.shiftKey ? W([.../* @__PURE__ */ new Set([...H.value, n.task.id])]) : W([n.task.id]), Vt(n.task.id));
|
|
1679
|
+
}, a = !_.readonly;
|
|
1680
|
+
if (e.altKey && a && (e.key === "ArrowLeft" || e.key === "ArrowRight")) {
|
|
1681
|
+
e.preventDefault(), t.draggable !== !1 && Cr(t, e.key === "ArrowLeft" ? -1 : 1, e.shiftKey);
|
|
1682
|
+
return;
|
|
1683
|
+
}
|
|
1684
|
+
if (e.altKey && a && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
|
|
1685
|
+
e.preventDefault();
|
|
1686
|
+
let n = V.value.get(t.parentId && I.value.has(t.parentId) ? t.parentId : void 0) ?? [], r = n[n.findIndex((e) => e.id === t.id) + (e.key === "ArrowUp" ? -1 : 1)];
|
|
1687
|
+
r && Kn(t.id, r.id, e.key === "ArrowUp" ? "before" : "after"), Sr(t.id);
|
|
1688
|
+
return;
|
|
1689
|
+
}
|
|
1690
|
+
if (r && a && (e.key === "]" || e.key === "[")) {
|
|
1691
|
+
if (e.preventDefault(), e.key === "]") {
|
|
1692
|
+
let e = V.value.get(t.parentId && I.value.has(t.parentId) ? t.parentId : void 0) ?? [], n = e[e.findIndex((e) => e.id === t.id) - 1];
|
|
1693
|
+
if (n) {
|
|
1694
|
+
let e = (V.value.get(n.id) ?? []).at(-1);
|
|
1695
|
+
e ? Kn(t.id, e.id, "after") : Kn(t.id, n.id, "inside");
|
|
1696
|
+
}
|
|
1697
|
+
} else t.parentId && I.value.has(t.parentId) && Kn(t.id, t.parentId, "after");
|
|
1698
|
+
Sr(t.id);
|
|
1699
|
+
return;
|
|
1700
|
+
}
|
|
1701
|
+
if (r && e.key.toLowerCase() === "z") {
|
|
1702
|
+
e.preventDefault(), e.shiftKey ? Ee() : Te();
|
|
1703
|
+
return;
|
|
1704
|
+
}
|
|
1705
|
+
if (r && e.key.toLowerCase() === "y") {
|
|
1706
|
+
e.preventDefault(), Ee();
|
|
1707
|
+
return;
|
|
1708
|
+
}
|
|
1709
|
+
if (r && e.key.toLowerCase() === "a") {
|
|
1710
|
+
e.preventDefault(), W(q.value.map((e) => e.task.id));
|
|
1711
|
+
return;
|
|
1712
|
+
}
|
|
1713
|
+
switch (e.key) {
|
|
1714
|
+
case "ArrowDown":
|
|
1715
|
+
e.preventDefault(), i(n + 1);
|
|
1716
|
+
break;
|
|
1717
|
+
case "ArrowUp":
|
|
1718
|
+
e.preventDefault(), i(n - 1);
|
|
1719
|
+
break;
|
|
1720
|
+
case "Home":
|
|
1721
|
+
e.preventDefault(), i(0);
|
|
1722
|
+
break;
|
|
1723
|
+
case "End":
|
|
1724
|
+
e.preventDefault(), i(q.value.length - 1);
|
|
1725
|
+
break;
|
|
1726
|
+
case "ArrowRight":
|
|
1727
|
+
e.preventDefault(), V.value.has(t.id) && G.value.has(t.id) ? vt(t.id, !0) : V.value.has(t.id) && i(n + 1);
|
|
1728
|
+
break;
|
|
1729
|
+
case "ArrowLeft":
|
|
1730
|
+
e.preventDefault(), V.value.has(t.id) && !G.value.has(t.id) ? vt(t.id, !1) : t.parentId && yt.value.has(t.parentId) && i(yt.value.get(t.parentId));
|
|
1731
|
+
break;
|
|
1732
|
+
case " ":
|
|
1733
|
+
e.preventDefault(), W(U.value.has(t.id) ? H.value.filter((e) => e !== t.id) : [...H.value, t.id]);
|
|
1734
|
+
break;
|
|
1735
|
+
case "Enter":
|
|
1736
|
+
e.preventDefault(), T("task-dblclick", t, e);
|
|
1737
|
+
break;
|
|
1738
|
+
case "F2":
|
|
1739
|
+
e.preventDefault(), br(t.id);
|
|
1740
|
+
break;
|
|
1741
|
+
case "Delete":
|
|
1742
|
+
case "Backspace":
|
|
1743
|
+
if (!a) break;
|
|
1744
|
+
e.preventDefault(), Tn(U.value.has(t.id) ? H.value : [t.id]);
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
function Tr(e) {
|
|
1748
|
+
if ((e.key === "Delete" || e.key === "Backspace") && gn.value && !_.readonly) {
|
|
1749
|
+
e.preventDefault();
|
|
1750
|
+
let [t, n] = gn.value.split(">");
|
|
1751
|
+
vn(t, n);
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
let Er = /* @__PURE__ */ new Map();
|
|
1755
|
+
ne(() => {
|
|
1756
|
+
Z && "active" in Z && Z.active || (Er = new Map(q.value.map((e, t) => [e.task.id, t * _.rowHeight])));
|
|
1757
|
+
}), ie(() => {
|
|
1758
|
+
if (!Er.size || i()) return;
|
|
1759
|
+
let e = yt.value;
|
|
1760
|
+
for (let r of J.value?.querySelectorAll("[data-gantt-flip]") ?? []) {
|
|
1761
|
+
let i = r.dataset.ganttFlip, a = Er.get(i), o = e.get(i);
|
|
1762
|
+
if (a === void 0 || o === void 0) continue;
|
|
1763
|
+
let s = a - o * _.rowHeight;
|
|
1764
|
+
if (Math.abs(s) < 1 || Math.abs(s) > _.rowHeight * 40) continue;
|
|
1765
|
+
let c = t(s, 0, 0, {
|
|
1766
|
+
dampingRatio: .9,
|
|
1767
|
+
stiffness: 700
|
|
1768
|
+
}, .5);
|
|
1769
|
+
n(r, c, (e) => ({ translate: `0 ${e}px` }));
|
|
1770
|
+
}
|
|
1771
|
+
Er.clear();
|
|
1772
|
+
});
|
|
1773
|
+
let Dr = {
|
|
1774
|
+
tasks: l(() => P.value),
|
|
1775
|
+
selection: l(() => H.value),
|
|
1776
|
+
scale: Bt,
|
|
1777
|
+
pxPerDay: Dt,
|
|
1778
|
+
readonly: l(() => _.readonly),
|
|
1779
|
+
canUndo: De,
|
|
1780
|
+
canRedo: Oe,
|
|
1781
|
+
collapsed: l(() => Re.value),
|
|
1782
|
+
undo: Te,
|
|
1783
|
+
redo: Ee,
|
|
1784
|
+
zoomIn: Nt,
|
|
1785
|
+
zoomOut: Pt,
|
|
1786
|
+
setScale: Ft,
|
|
1787
|
+
scrollToDate: It,
|
|
1788
|
+
scrollToTask: Vt,
|
|
1789
|
+
toggle: vt,
|
|
1790
|
+
expandAll: () => Be([]),
|
|
1791
|
+
collapseAll: () => Be([...V.value.keys()].filter((e) => !!e)),
|
|
1792
|
+
setSelection: W,
|
|
1793
|
+
addTasks: Cn,
|
|
1794
|
+
updateTask: wn,
|
|
1795
|
+
removeTasks: Tn,
|
|
1796
|
+
link: xn,
|
|
1797
|
+
unlink: vn,
|
|
1798
|
+
schedule: En,
|
|
1799
|
+
criticalPath: Jt,
|
|
1800
|
+
dateAt: Dn
|
|
1801
|
+
};
|
|
1802
|
+
return ae(he, Dr), ae(ge, {
|
|
1803
|
+
...Dr,
|
|
1804
|
+
foldable: l(() => V.value.size > 1),
|
|
1805
|
+
folded: l(() => Re.value.length > 0)
|
|
1806
|
+
}), re(() => {
|
|
1807
|
+
let e = J.value;
|
|
1808
|
+
e.addEventListener("touchmove", $n, { passive: !1 }), ee(() => {
|
|
1809
|
+
let t = Mt.value, n = t !== null && t >= Tt.value.min && t <= Tt.value.max ? t : Tt.value.min;
|
|
1810
|
+
e.scrollLeft = Math.max(0, Y(n) - Math.min(80, kt.value / 4)), Ot.value.left = e.scrollLeft;
|
|
1811
|
+
});
|
|
1812
|
+
}), te(() => {
|
|
1813
|
+
J.value?.removeEventListener("touchmove", $n), zn(), Qn(), cancelAnimationFrame(tn), clearTimeout(nr);
|
|
1814
|
+
}), a(Dr), (e, t) => (b(), f("div", {
|
|
1815
|
+
class: "m3-gantt flex flex-col overflow-hidden rounded-md bg-surface text-on-surface",
|
|
1816
|
+
onKeydown: Tr
|
|
1817
|
+
}, [
|
|
1818
|
+
oe(e.$slots, "default", { gantt: Dr }),
|
|
1819
|
+
p("div", {
|
|
1820
|
+
ref_key: "scroller",
|
|
1821
|
+
ref: J,
|
|
1822
|
+
class: "relative min-h-0 flex-1 touch-pan-x touch-pan-y overflow-auto overscroll-contain",
|
|
1823
|
+
onScrollPassive: er,
|
|
1824
|
+
onTouchstartPassive: t[11] ||= (...e) => w(Et).onTouchStart && w(Et).onTouchStart(...e),
|
|
1825
|
+
onTouchendPassive: t[12] ||= (...e) => w(Et).onTouchEnd && w(Et).onTouchEnd(...e),
|
|
1826
|
+
onContextmenu: t[13] ||= (e) => w(Z) && e.preventDefault()
|
|
1827
|
+
}, [p("div", {
|
|
1828
|
+
class: "relative",
|
|
1829
|
+
style: y({
|
|
1830
|
+
width: `${wt.value + w(jt)}px`,
|
|
1831
|
+
height: `${ht + Gt.value}px`
|
|
1832
|
+
})
|
|
1833
|
+
}, [p("div", {
|
|
1834
|
+
class: "sticky top-0 z-20 flex",
|
|
1835
|
+
style: y({
|
|
1836
|
+
height: `${ht}px`,
|
|
1837
|
+
width: `${wt.value + w(jt)}px`
|
|
1838
|
+
})
|
|
1839
|
+
}, [St.value ? (b(), f("div", {
|
|
1840
|
+
key: 0,
|
|
1841
|
+
class: "sticky left-0 z-10 flex shrink-0 items-end border-r border-b border-outline-variant bg-surface-container-low text-label-medium text-on-surface-variant",
|
|
1842
|
+
style: y({ width: `${wt.value}px` }),
|
|
1843
|
+
role: "row"
|
|
1844
|
+
}, [(b(!0), f(s, null, S(xt.value, (e, t) => (b(), f("div", {
|
|
1845
|
+
key: e.key,
|
|
1846
|
+
role: "columnheader",
|
|
1847
|
+
class: v(["truncate px-3 pb-2", e.align === "end" ? "text-right" : e.align === "center" ? "text-center" : ""]),
|
|
1848
|
+
style: y({ width: `${cr.value[t]}px` })
|
|
1849
|
+
}, C(e.label ?? e.key), 7))), 128))], 4)) : d("", !0), h(ze, {
|
|
1850
|
+
width: w(jt),
|
|
1851
|
+
"top-cells": w(Lt),
|
|
1852
|
+
"bottom-cells": w(Rt),
|
|
1853
|
+
"today-x": w(Mt) === null ? null : w(Y)(w(Mt))
|
|
1854
|
+
}, null, 8, [
|
|
1855
|
+
"width",
|
|
1856
|
+
"top-cells",
|
|
1857
|
+
"bottom-cells",
|
|
1858
|
+
"today-x"
|
|
1859
|
+
])], 4), p("div", {
|
|
1860
|
+
class: "flex",
|
|
1861
|
+
style: y({ height: `${Gt.value}px` })
|
|
1862
|
+
}, [St.value ? (b(), f("div", {
|
|
1863
|
+
key: 0,
|
|
1864
|
+
class: "sticky left-0 z-10 shrink-0 border-r border-outline-variant bg-surface",
|
|
1865
|
+
style: y({ width: `${wt.value}px` }),
|
|
1866
|
+
role: "treegrid",
|
|
1867
|
+
"aria-label": r.label ?? w(D).ganttChart,
|
|
1868
|
+
"aria-rowcount": q.value.length,
|
|
1869
|
+
"aria-multiselectable": "true"
|
|
1870
|
+
}, [
|
|
1871
|
+
(b(!0), f(s, null, S(Wt.value, (n) => (b(), f("div", {
|
|
1872
|
+
key: n.task.id,
|
|
1873
|
+
"data-gantt-row": n.task.id,
|
|
1874
|
+
"data-gantt-flip": n.task.id,
|
|
1875
|
+
role: "row",
|
|
1876
|
+
"aria-level": n.depth + 1,
|
|
1877
|
+
"aria-rowindex": n.index + 1,
|
|
1878
|
+
"aria-expanded": n.parent ? !G.value.has(n.task.id) : void 0,
|
|
1879
|
+
"aria-selected": U.value.has(n.task.id),
|
|
1880
|
+
tabindex: hr.value === n.task.id ? 0 : -1,
|
|
1881
|
+
class: v(["m3-gantt-row absolute inset-x-0 flex items-center text-body-medium outline-none select-none focus-visible:z-10 focus-visible:ring-2 focus-visible:ring-secondary focus-visible:ring-inset", [U.value.has(n.task.id) ? "bg-secondary-container text-on-secondary-container" : "hover:bg-on-surface/8", kn.value?.taskId === n.task.id && !kn.value?.part.startsWith("link") && An.value ? "opacity-50" : ""]]),
|
|
1882
|
+
style: y({
|
|
1883
|
+
top: `${n.index * r.rowHeight}px`,
|
|
1884
|
+
height: `${r.rowHeight}px`
|
|
1885
|
+
}),
|
|
1886
|
+
onPointerdown: (e) => In(e, n.task),
|
|
1887
|
+
onClick: (e) => Yn(n.task, e),
|
|
1888
|
+
onDblclick: (e) => T("task-dblclick", n.task, e),
|
|
1889
|
+
onContextmenu: (e) => T("task-contextmenu", n.task, e),
|
|
1890
|
+
onKeydown: (e) => wr(e, n.task),
|
|
1891
|
+
onFocus: (e) => mr.value = n.task.id
|
|
1892
|
+
}, [(b(!0), f(s, null, S(xt.value, (i, a) => (b(), f("div", {
|
|
1893
|
+
key: i.key,
|
|
1894
|
+
role: "gridcell",
|
|
1895
|
+
class: v(["flex h-full min-w-0 items-center px-3", [i.align === "end" ? "justify-end" : i.align === "center" ? "justify-center" : "", i.key === "name" ? "gap-1" : "text-on-surface-variant"]]),
|
|
1896
|
+
style: y({
|
|
1897
|
+
width: `${cr.value[a]}px`,
|
|
1898
|
+
paddingLeft: i.key === "name" ? `${8 + n.depth * 20}px` : void 0
|
|
1899
|
+
})
|
|
1900
|
+
}, [i.key === "name" ? (b(), f(s, { key: 0 }, [
|
|
1901
|
+
n.parent ? (b(), f("button", {
|
|
1902
|
+
key: 0,
|
|
1903
|
+
type: "button",
|
|
1904
|
+
tabindex: "-1",
|
|
1905
|
+
"data-gantt-action": "",
|
|
1906
|
+
class: "flex size-6 shrink-0 items-center justify-center rounded-full text-on-surface-variant hover:bg-on-surface/8",
|
|
1907
|
+
"aria-label": G.value.has(n.task.id) ? w(D).ganttExpand : w(D).ganttCollapse,
|
|
1908
|
+
onClick: me((e) => vt(n.task.id), ["stop"])
|
|
1909
|
+
}, [p("span", { class: v(["material-symbols-outlined text-[20px] transition-transform duration-200", G.value.has(n.task.id) ? "-rotate-90" : ""]) }, "expand_more", 2)], 8, We)) : (b(), f("span", Ge)),
|
|
1910
|
+
w(R)(n.task) ? (b(), f("span", Ke)) : d("", !0),
|
|
1911
|
+
vr.value === n.task.id ? fe((b(), f("input", {
|
|
1912
|
+
key: 3,
|
|
1913
|
+
"onUpdate:modelValue": t[0] ||= (e) => yr.value = e,
|
|
1914
|
+
"data-gantt-rename": "",
|
|
1915
|
+
class: "h-8 min-w-0 flex-1 rounded-xs border border-primary bg-surface px-2 text-body-medium text-on-surface outline-none",
|
|
1916
|
+
onKeydown: [t[1] ||= pe(me((e) => xr(!0), ["stop", "prevent"]), ["enter"]), t[2] ||= pe(me((e) => xr(!1), ["stop", "prevent"]), ["esc"])],
|
|
1917
|
+
onBlur: t[3] ||= (e) => xr(!0),
|
|
1918
|
+
onClick: t[4] ||= me(() => {}, ["stop"]),
|
|
1919
|
+
onDblclick: t[5] ||= me(() => {}, ["stop"])
|
|
1920
|
+
}, null, 544)), [[ue, yr.value]]) : oe(e.$slots, `cell-${i.key}`, {
|
|
1921
|
+
task: n.task,
|
|
1922
|
+
value: lr(n.task, i)
|
|
1923
|
+
}, () => [p("span", {
|
|
1924
|
+
class: v(["truncate", n.parent ? "font-medium" : ""]),
|
|
1925
|
+
onDblclick: me((e) => r.readonly ? T("task-dblclick", n.task, e) : br(n.task.id), ["stop"])
|
|
1926
|
+
}, C(lr(n.task, i)), 43, qe)], void 0, 4)
|
|
1927
|
+
], 64)) : oe(e.$slots, `cell-${i.key}`, {
|
|
1928
|
+
task: n.task,
|
|
1929
|
+
value: lr(n.task, i)
|
|
1930
|
+
}, () => [p("span", Je, C(lr(n.task, i)), 1)], void 0, 1)], 6))), 128))], 46, Ue))), 128)),
|
|
1931
|
+
An.value ? (b(), f("div", {
|
|
1932
|
+
key: 0,
|
|
1933
|
+
class: v(["pointer-events-none absolute right-2 z-20", An.value.where === "inside" ? "rounded-sm border-2 border-primary" : "h-0.5 rounded-full bg-primary"]),
|
|
1934
|
+
style: y(An.value.where === "inside" ? {
|
|
1935
|
+
top: `${(yt.value.get(An.value.target) ?? 0) * r.rowHeight + 2}px`,
|
|
1936
|
+
height: `${r.rowHeight - 4}px`,
|
|
1937
|
+
left: "8px"
|
|
1938
|
+
} : {
|
|
1939
|
+
top: `${((yt.value.get(An.value.target) ?? 0) + +(An.value.where === "after")) * r.rowHeight - 1}px`,
|
|
1940
|
+
left: `${8 + (q.value[yt.value.get(An.value.target) ?? 0]?.depth ?? 0) * 20}px`
|
|
1941
|
+
})
|
|
1942
|
+
}, null, 6)) : d("", !0),
|
|
1943
|
+
p("div", {
|
|
1944
|
+
role: "separator",
|
|
1945
|
+
"aria-orientation": "vertical",
|
|
1946
|
+
"aria-label": w(D).ganttResize,
|
|
1947
|
+
"aria-valuenow": wt.value,
|
|
1948
|
+
tabindex: "0",
|
|
1949
|
+
class: "absolute inset-y-0 -right-1 z-30 w-2 cursor-col-resize touch-none outline-none hover:bg-primary/20 focus-visible:bg-primary/30",
|
|
1950
|
+
onPointerdown: Ln,
|
|
1951
|
+
onKeydown: [t[6] ||= pe(me((e) => {
|
|
1952
|
+
Ct.value = Math.max(120, Ct.value - 16), T("update:gridWidth", Ct.value);
|
|
1953
|
+
}, ["prevent"]), ["left"]), t[7] ||= pe(me((e) => {
|
|
1954
|
+
Ct.value += 16, T("update:gridWidth", Ct.value);
|
|
1955
|
+
}, ["prevent"]), ["right"])]
|
|
1956
|
+
}, null, 40, Ye)
|
|
1957
|
+
], 12, He)) : d("", !0), p("div", {
|
|
1958
|
+
class: "relative shrink-0",
|
|
1959
|
+
style: y({ width: `${w(jt)}px` }),
|
|
1960
|
+
"aria-hidden": "true",
|
|
1961
|
+
onPointerdown: Fn
|
|
1962
|
+
}, [
|
|
1963
|
+
h(Ve, {
|
|
1964
|
+
"off-times": w(zt),
|
|
1965
|
+
cells: w(Rt),
|
|
1966
|
+
"today-x": w(Mt) === null ? null : w(Y)(w(Mt))
|
|
1967
|
+
}, null, 8, [
|
|
1968
|
+
"off-times",
|
|
1969
|
+
"cells",
|
|
1970
|
+
"today-x"
|
|
1971
|
+
]),
|
|
1972
|
+
(b(!0), f(s, null, S(Wt.value, (e) => (b(), f("div", {
|
|
1973
|
+
key: `r${e.task.id}`,
|
|
1974
|
+
class: v(["absolute inset-x-0", U.value.has(e.task.id) ? "bg-secondary-container/40" : ""]),
|
|
1975
|
+
style: y({
|
|
1976
|
+
top: `${e.index * r.rowHeight}px`,
|
|
1977
|
+
height: `${r.rowHeight}px`
|
|
1978
|
+
})
|
|
1979
|
+
}, null, 6))), 128)),
|
|
1980
|
+
(b(), f("svg", {
|
|
1981
|
+
class: "pointer-events-none absolute inset-0 overflow-visible",
|
|
1982
|
+
width: w(jt),
|
|
1983
|
+
height: Gt.value
|
|
1984
|
+
}, [(b(!0), f(s, null, S(dn.value, (e) => (b(), f("g", {
|
|
1985
|
+
key: e.key,
|
|
1986
|
+
ref_for: !0,
|
|
1987
|
+
ref: (t) => hn(e.key, t),
|
|
1988
|
+
class: v(["m3-gantt-link", Xt.value.has(e.key) ? "text-error" : gn.value === e.key ? "text-primary" : "text-outline"])
|
|
1989
|
+
}, [
|
|
1990
|
+
p("path", {
|
|
1991
|
+
fill: "none",
|
|
1992
|
+
stroke: "transparent",
|
|
1993
|
+
class: "pointer-events-auto cursor-pointer [stroke-width:12px] pointer-coarse:[stroke-width:28px]",
|
|
1994
|
+
onPointerdown: t[8] ||= me(() => {}, ["stop"]),
|
|
1995
|
+
onClick: me((t) => {
|
|
1996
|
+
gn.value = e.key, W([]);
|
|
1997
|
+
}, ["stop"])
|
|
1998
|
+
}, null, 40, Ze),
|
|
1999
|
+
p("path", {
|
|
2000
|
+
fill: "none",
|
|
2001
|
+
stroke: "currentColor",
|
|
2002
|
+
"stroke-width": gn.value === e.key || Xt.value.has(e.key) ? 2.5 : 1.5,
|
|
2003
|
+
"stroke-linejoin": "round"
|
|
2004
|
+
}, null, 8, Qe),
|
|
2005
|
+
t[14] ||= p("path", {
|
|
2006
|
+
fill: "currentColor",
|
|
2007
|
+
stroke: "currentColor",
|
|
2008
|
+
"stroke-width": "1",
|
|
2009
|
+
"stroke-linejoin": "round"
|
|
2010
|
+
}, null, -1)
|
|
2011
|
+
], 2))), 128)), Q.value ? (b(), f("path", {
|
|
2012
|
+
key: 0,
|
|
2013
|
+
fill: "none",
|
|
2014
|
+
"stroke-width": "2",
|
|
2015
|
+
"stroke-dasharray": "6 4",
|
|
2016
|
+
class: v(Q.value.valid ? "stroke-primary" : "stroke-outline"),
|
|
2017
|
+
d: `M${Q.value.fromEnd ? cn(Q.value.from).x + cn(Q.value.from).w : cn(Q.value.from).x},${(yt.value.get(Q.value.from) ?? 0) * r.rowHeight + r.rowHeight / 2} L${Q.value.x},${Q.value.y}`
|
|
2018
|
+
}, null, 10, $e)) : d("", !0)], 8, Xe)),
|
|
2019
|
+
gn.value && _n.value && !r.readonly ? (b(), f("button", {
|
|
2020
|
+
key: 0,
|
|
2021
|
+
type: "button",
|
|
2022
|
+
"data-gantt-action": "",
|
|
2023
|
+
class: "absolute z-10 flex size-6 -translate-1/2 items-center justify-center rounded-full bg-error text-on-error shadow-elevation-2 pointer-coarse:size-10",
|
|
2024
|
+
style: y({
|
|
2025
|
+
left: `${_n.value.x}px`,
|
|
2026
|
+
top: `${_n.value.y}px`
|
|
2027
|
+
}),
|
|
2028
|
+
"aria-label": w(D).ganttUnlink,
|
|
2029
|
+
onPointerdown: t[9] ||= me(() => {}, ["stop"]),
|
|
2030
|
+
onClick: t[10] ||= me((e) => vn(gn.value.split(">")[0], gn.value.split(">")[1]), ["stop"])
|
|
2031
|
+
}, [...t[15] ||= [p("span", { class: "material-symbols-outlined text-[16px]" }, "close", -1)]], 44, et)) : d("", !0),
|
|
2032
|
+
(b(!0), f(s, null, S(Wt.value, (e) => (b(), f(s, { key: `g${e.task.id}` }, [ur(e.task) ? (b(), f("div", {
|
|
2033
|
+
key: 0,
|
|
2034
|
+
class: "pointer-events-none absolute h-1 rounded-full bg-outline",
|
|
2035
|
+
style: y({
|
|
2036
|
+
top: `${e.index * r.rowHeight + r.rowHeight / 2 + Kt.value / 2 + 2}px`,
|
|
2037
|
+
left: `${ur(e.task).x}px`,
|
|
2038
|
+
width: `${ur(e.task).w}px`
|
|
2039
|
+
})
|
|
2040
|
+
}, null, 4)) : d("", !0)], 64))), 128)),
|
|
2041
|
+
(b(!0), f(s, null, S(Wt.value, (n) => (b(), f("div", {
|
|
2042
|
+
key: `b${n.task.id}`,
|
|
2043
|
+
ref_for: !0,
|
|
2044
|
+
ref: (e) => sn(n.task.id, e),
|
|
2045
|
+
"data-gantt-flip": n.task.id,
|
|
2046
|
+
class: v(["m3-gantt-bar group absolute left-0", [n.task.class, kn.value?.taskId === n.task.id ? "z-10" : ""]]),
|
|
2047
|
+
style: y({
|
|
2048
|
+
top: `${n.index * r.rowHeight + (r.rowHeight - Kt.value) / 2}px`,
|
|
2049
|
+
height: `${Kt.value}px`
|
|
2050
|
+
})
|
|
2051
|
+
}, [
|
|
2052
|
+
w(R)(n.task) ? (b(), f("div", {
|
|
2053
|
+
key: 0,
|
|
2054
|
+
class: "absolute top-1/2 left-0 hidden size-11 -translate-1/2 pointer-coarse:block",
|
|
2055
|
+
onPointerdown: (e) => Pn(e, n.task, "body")
|
|
2056
|
+
}, null, 40, nt)) : d("", !0),
|
|
2057
|
+
w(R)(n.task) ? (b(), f("div", {
|
|
2058
|
+
key: 1,
|
|
2059
|
+
"data-gantt-task": n.task.id,
|
|
2060
|
+
class: v(["absolute top-1/2 left-0 -translate-1/2 rotate-45 rounded-[3px] shadow-elevation-1", [
|
|
2061
|
+
Yt.value.has(n.task.id) ? "bg-error" : fr[n.task.color ?? "tertiary"].solid,
|
|
2062
|
+
U.value.has(n.task.id) ? "ring-2 ring-on-surface ring-offset-2 ring-offset-surface" : "",
|
|
2063
|
+
r.readonly ? "" : "cursor-grab"
|
|
2064
|
+
]]),
|
|
2065
|
+
style: y({
|
|
2066
|
+
width: `${Kt.value * .8}px`,
|
|
2067
|
+
height: `${Kt.value * .8}px`
|
|
2068
|
+
}),
|
|
2069
|
+
onPointerdown: (e) => Pn(e, n.task, "body"),
|
|
2070
|
+
onPointerenter: (e) => rr(e, n.task),
|
|
2071
|
+
onPointerleave: ir,
|
|
2072
|
+
onDblclick: (e) => T("task-dblclick", n.task, e),
|
|
2073
|
+
onContextmenu: (e) => T("task-contextmenu", n.task, e)
|
|
2074
|
+
}, null, 46, rt)) : L.value.has(n.task.id) && V.value.has(n.task.id) ? (b(), f("div", {
|
|
2075
|
+
key: 2,
|
|
2076
|
+
"data-gantt-task": n.task.id,
|
|
2077
|
+
class: v(["m3-gantt-summary absolute inset-x-0 top-1/2 h-2.5 -translate-y-1/2 rounded-t-xs", [
|
|
2078
|
+
pr(n.task).solid,
|
|
2079
|
+
U.value.has(n.task.id) ? "ring-2 ring-on-surface ring-offset-1 ring-offset-surface" : "",
|
|
2080
|
+
r.readonly ? "" : "cursor-grab"
|
|
2081
|
+
]]),
|
|
2082
|
+
onPointerdown: (e) => Pn(e, n.task, "body"),
|
|
2083
|
+
onPointerenter: (e) => rr(e, n.task),
|
|
2084
|
+
onPointerleave: ir,
|
|
2085
|
+
onDblclick: (e) => T("task-dblclick", n.task, e),
|
|
2086
|
+
onContextmenu: (e) => T("task-contextmenu", n.task, e)
|
|
2087
|
+
}, null, 42, it)) : (b(), f("div", {
|
|
2088
|
+
key: 3,
|
|
2089
|
+
"data-gantt-task": n.task.id,
|
|
2090
|
+
class: v(["absolute inset-0 overflow-hidden rounded-sm transition-shadow duration-200", [
|
|
2091
|
+
pr(n.task).bar,
|
|
2092
|
+
U.value.has(n.task.id) ? "ring-2 ring-on-surface ring-offset-1 ring-offset-surface" : "",
|
|
2093
|
+
kn.value?.taskId === n.task.id ? "shadow-elevation-3" : "hover:shadow-elevation-1",
|
|
2094
|
+
r.readonly || n.task.draggable === !1 ? "" : "cursor-grab active:cursor-grabbing"
|
|
2095
|
+
]]),
|
|
2096
|
+
onPointerdown: (e) => Pn(e, n.task, "body"),
|
|
2097
|
+
onPointerenter: (e) => rr(e, n.task),
|
|
2098
|
+
onPointerleave: ir,
|
|
2099
|
+
onDblclick: (e) => T("task-dblclick", n.task, e),
|
|
2100
|
+
onContextmenu: (e) => T("task-contextmenu", n.task, e)
|
|
2101
|
+
}, [p("div", {
|
|
2102
|
+
class: v(["pointer-events-none absolute inset-y-0 left-0", pr(n.task).fill]),
|
|
2103
|
+
style: y({ width: `${n.task.progress ?? 0}%` })
|
|
2104
|
+
}, null, 6), p("div", ot, [oe(e.$slots, "bar", {
|
|
2105
|
+
task: n.task,
|
|
2106
|
+
selected: U.value.has(n.task.id),
|
|
2107
|
+
critical: Yt.value.has(n.task.id)
|
|
2108
|
+
}, () => [dr(n.task) ? (b(), f("span", st, C(n.task.name), 1)) : d("", !0)])])], 42, at)),
|
|
2109
|
+
!r.readonly && n.task.resizable !== !1 && !w(R)(n.task) && !(L.value.has(n.task.id) && V.value.has(n.task.id)) ? (b(), f(s, { key: 4 }, S(["start", "end"], (e) => p("div", {
|
|
2110
|
+
key: `rs${e}`,
|
|
2111
|
+
"data-gantt-resize": e,
|
|
2112
|
+
class: v(["absolute inset-y-0 z-[1] flex w-3 cursor-ew-resize items-center justify-center pointer-coarse:w-7", e === "start" ? "-left-1 pointer-coarse:-left-3.5" : "-right-1 pointer-coarse:-right-3.5"]),
|
|
2113
|
+
onPointerdown: (t) => Pn(t, n.task, e)
|
|
2114
|
+
}, [p("span", { class: v(["hidden h-3/5 w-1 rounded-full bg-on-surface pointer-coarse:block", U.value.has(n.task.id) ? "opacity-100" : "opacity-0"]) }, null, 2)], 42, ct)), 64)) : d("", !0),
|
|
2115
|
+
!w(R)(n.task) && !w(_e).bar && !(L.value.has(n.task.id) && V.value.has(n.task.id)) && !dr(n.task) ? (b(), f("span", K, C(n.task.name), 1)) : w(R)(n.task) || L.value.has(n.task.id) && V.value.has(n.task.id) ? (b(), f("span", {
|
|
2116
|
+
key: 6,
|
|
2117
|
+
class: v(["pointer-events-none absolute top-1/2 left-full -translate-y-1/2 text-label-medium whitespace-nowrap", [w(R)(n.task) ? "ml-4" : "ml-2", L.value.has(n.task.id) ? "font-medium text-on-surface" : "text-on-surface-variant"]])
|
|
2118
|
+
}, C(n.task.name), 3)) : d("", !0),
|
|
2119
|
+
!r.readonly && !(L.value.has(n.task.id) && V.value.has(n.task.id)) ? (b(), f(s, { key: 7 }, [w(R)(n.task) ? d("", !0) : (b(), f("div", {
|
|
2120
|
+
key: 0,
|
|
2121
|
+
class: v(["absolute -bottom-2 size-0 -translate-x-1/2 cursor-ew-resize border-x-[6px] border-b-[7px] border-x-transparent border-b-on-surface-variant opacity-0 transition-opacity group-hover:opacity-100", U.value.has(n.task.id) || kn.value?.taskId === n.task.id ? "opacity-100" : ""]),
|
|
2122
|
+
style: y({ left: `${n.task.progress ?? 0}%` }),
|
|
2123
|
+
onPointerdown: (e) => Pn(e, n.task, "progress")
|
|
2124
|
+
}, null, 46, lt)), n.task.linkable === !1 ? d("", !0) : (b(), f(s, { key: 1 }, S(["start", "end"], (e) => p("div", {
|
|
2125
|
+
key: e,
|
|
2126
|
+
class: v(["absolute top-1/2 flex size-5 -translate-y-1/2 cursor-crosshair items-center justify-center transition-opacity pointer-coarse:size-8", [e === "start" ? w(R)(n.task) ? "-left-9 pointer-coarse:-left-14" : "-left-5 pointer-coarse:-left-9" : w(R)(n.task) ? "left-4 pointer-coarse:left-6" : "-right-5 pointer-coarse:-right-9", U.value.has(n.task.id) || Q.value ? "opacity-100" : "pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100"]]),
|
|
2127
|
+
onPointerdown: (t) => Pn(t, n.task, e === "start" ? "link-start" : "link-end")
|
|
2128
|
+
}, [...t[16] ||= [p("span", { class: "size-2.5 rounded-full border-2 border-primary bg-surface" }, null, -1)]], 42, ut)), 64))], 64)) : d("", !0),
|
|
2129
|
+
Q.value?.target === n.task.id ? (b(), f("div", {
|
|
2130
|
+
key: 8,
|
|
2131
|
+
class: v(["pointer-events-none absolute -inset-1 rounded-md border-2", Q.value.valid ? "border-primary" : "border-error"])
|
|
2132
|
+
}, null, 2)) : d("", !0)
|
|
2133
|
+
], 14, tt))), 128)),
|
|
2134
|
+
q.value.length ? d("", !0) : (b(), f("div", {
|
|
2135
|
+
key: 1,
|
|
2136
|
+
class: "absolute inset-0 flex items-center justify-center p-6",
|
|
2137
|
+
style: y({
|
|
2138
|
+
left: `${w(Ot).left}px`,
|
|
2139
|
+
width: `${w(kt)}px`
|
|
2140
|
+
})
|
|
2141
|
+
}, [oe(e.$slots, "empty", {}, () => [p("span", dt, C(w(D).ganttEmpty), 1)])], 4))
|
|
2142
|
+
], 36)], 4)], 4)], 544),
|
|
2143
|
+
(b(), u(c, { to: "body" }, [$.value && !Q.value && !An.value ? (b(), f("div", {
|
|
2144
|
+
key: 0,
|
|
2145
|
+
class: "pointer-events-none fixed z-[300] -translate-x-1/2 -translate-y-full rounded-md bg-surface-container px-3 py-2 text-on-surface shadow-elevation-2",
|
|
2146
|
+
style: y({
|
|
2147
|
+
left: `${ar.value.x}px`,
|
|
2148
|
+
top: `${ar.value.y - 8}px`
|
|
2149
|
+
}),
|
|
2150
|
+
role: "tooltip"
|
|
2151
|
+
}, [oe(e.$slots, "tooltip", {
|
|
2152
|
+
task: $.value,
|
|
2153
|
+
slack: Jt.value.slack[$.value.id]
|
|
2154
|
+
}, () => [
|
|
2155
|
+
p("div", ft, C($.value.name), 1),
|
|
2156
|
+
p("div", pt, [
|
|
2157
|
+
m(C(or($.value.start)), 1),
|
|
2158
|
+
w(R)($.value) ? d("", !0) : (b(), f(s, { key: 0 }, [m(" – " + C(or($.value.end ?? $.value.start)) + " · " + C(sr($.value)), 1)], 64)),
|
|
2159
|
+
!w(R)($.value) && $.value.progress !== void 0 ? (b(), f(s, { key: 1 }, [m(" · " + C(Math.round($.value.progress)) + "%", 1)], 64)) : d("", !0)
|
|
2160
|
+
]),
|
|
2161
|
+
r.criticalPath && Jt.value.slack[$.value.id] !== void 0 ? (b(), f("div", {
|
|
2162
|
+
key: 0,
|
|
2163
|
+
class: v(["text-body-small", Yt.value.has($.value.id) ? "text-error" : "text-on-surface-variant"])
|
|
2164
|
+
}, C(Yt.value.has($.value.id) ? w(D).ganttCritical : w(D).ganttSlack.replace("{n}", String(Math.round(Jt.value.slack[$.value.id] * 10) / 10))), 3)) : d("", !0)
|
|
2165
|
+
])], 4)) : d("", !0)])),
|
|
2166
|
+
p("div", mt, C(gr.value), 1)
|
|
2167
|
+
], 32));
|
|
2168
|
+
}
|
|
2169
|
+
}), q = {
|
|
2170
|
+
class: "m3-gantt-controls flex flex-wrap items-center gap-2 border-b border-outline-variant px-3 py-2",
|
|
2171
|
+
role: "toolbar"
|
|
2172
|
+
}, yt = { class: "flex items-center" }, J = /* @__PURE__ */ g({
|
|
2173
|
+
__name: "MGanttControls",
|
|
2174
|
+
props: {
|
|
2175
|
+
scales: { default: () => [
|
|
2176
|
+
"day",
|
|
2177
|
+
"week",
|
|
2178
|
+
"month",
|
|
2179
|
+
"quarter"
|
|
2180
|
+
] },
|
|
2181
|
+
zoom: {
|
|
2182
|
+
type: Boolean,
|
|
2183
|
+
default: !0
|
|
2184
|
+
},
|
|
2185
|
+
today: {
|
|
2186
|
+
type: Boolean,
|
|
2187
|
+
default: !0
|
|
2188
|
+
},
|
|
2189
|
+
fold: {
|
|
2190
|
+
type: Boolean,
|
|
2191
|
+
default: !0
|
|
2192
|
+
},
|
|
2193
|
+
history: {
|
|
2194
|
+
type: Boolean,
|
|
2195
|
+
default: !0
|
|
2196
|
+
}
|
|
2197
|
+
},
|
|
2198
|
+
setup(t) {
|
|
2199
|
+
let n = t, i = _(ge, null);
|
|
2200
|
+
if (!i) throw Error("MGanttControls must be inside <MGantt> or <MResourceTimeline>");
|
|
2201
|
+
let o = i, c = e(), m = {
|
|
2202
|
+
hour: "ganttScaleHour",
|
|
2203
|
+
day: "ganttScaleDay",
|
|
2204
|
+
week: "ganttScaleWeek",
|
|
2205
|
+
month: "ganttScaleMonth",
|
|
2206
|
+
quarter: "ganttScaleQuarter",
|
|
2207
|
+
year: "ganttScaleYear"
|
|
2208
|
+
}, g = l(() => n.scales.map((e) => ({
|
|
2209
|
+
value: e,
|
|
2210
|
+
label: c[m[e]]
|
|
2211
|
+
})));
|
|
2212
|
+
return (e, n) => (b(), f("div", q, [
|
|
2213
|
+
oe(e.$slots, "default"),
|
|
2214
|
+
g.value.length ? (b(), u(a, {
|
|
2215
|
+
key: 0,
|
|
2216
|
+
"model-value": w(o).scale.value,
|
|
2217
|
+
options: g.value,
|
|
2218
|
+
density: "compact",
|
|
2219
|
+
"onUpdate:modelValue": n[0] ||= (e) => w(o).setScale(e)
|
|
2220
|
+
}, null, 8, ["model-value", "options"])) : d("", !0),
|
|
2221
|
+
p("div", yt, [
|
|
2222
|
+
t.zoom ? (b(), f(s, { key: 0 }, [h(r, {
|
|
2223
|
+
icon: "zoom_out",
|
|
2224
|
+
label: w(c).ganttZoomOut,
|
|
2225
|
+
onClick: n[1] ||= (e) => w(o).zoomOut()
|
|
2226
|
+
}, null, 8, ["label"]), h(r, {
|
|
2227
|
+
icon: "zoom_in",
|
|
2228
|
+
label: w(c).ganttZoomIn,
|
|
2229
|
+
onClick: n[2] ||= (e) => w(o).zoomIn()
|
|
2230
|
+
}, null, 8, ["label"])], 64)) : d("", !0),
|
|
2231
|
+
t.today ? (b(), u(r, {
|
|
2232
|
+
key: 1,
|
|
2233
|
+
icon: "today",
|
|
2234
|
+
label: w(c).ganttToday,
|
|
2235
|
+
onClick: n[3] ||= (e) => w(o).scrollToDate()
|
|
2236
|
+
}, null, 8, ["label"])) : d("", !0),
|
|
2237
|
+
t.fold && w(o).foldable.value ? (b(), u(r, {
|
|
2238
|
+
key: 2,
|
|
2239
|
+
icon: w(o).folded.value ? "unfold_more" : "unfold_less",
|
|
2240
|
+
label: w(o).folded.value ? w(c).ganttExpandAll : w(c).ganttCollapseAll,
|
|
2241
|
+
onClick: n[4] ||= (e) => w(o).folded.value ? w(o).expandAll() : w(o).collapseAll()
|
|
2242
|
+
}, null, 8, ["icon", "label"])) : d("", !0),
|
|
2243
|
+
t.history && !w(o).readonly.value ? (b(), f(s, { key: 3 }, [h(r, {
|
|
2244
|
+
icon: "undo",
|
|
2245
|
+
label: w(c).ganttUndo,
|
|
2246
|
+
disabled: !w(o).canUndo.value,
|
|
2247
|
+
onClick: n[5] ||= (e) => w(o).undo()
|
|
2248
|
+
}, null, 8, ["label", "disabled"]), h(r, {
|
|
2249
|
+
icon: "redo",
|
|
2250
|
+
label: w(c).ganttRedo,
|
|
2251
|
+
disabled: !w(o).canRedo.value,
|
|
2252
|
+
onClick: n[6] ||= (e) => w(o).redo()
|
|
2253
|
+
}, null, 8, ["label", "disabled"])], 64)) : d("", !0)
|
|
2254
|
+
]),
|
|
2255
|
+
n[7] ||= p("div", { class: "flex-1" }, null, -1),
|
|
2256
|
+
oe(e.$slots, "end")
|
|
2257
|
+
]));
|
|
2258
|
+
}
|
|
2259
|
+
});
|
|
2260
|
+
//#endregion
|
|
2261
|
+
//#region src/composables/ganttFormats.ts
|
|
2262
|
+
function bt(e) {
|
|
2263
|
+
let t = Ae(e);
|
|
2264
|
+
return `${t.id}${t.type !== "FS" || t.lag ? ` ${t.type}` : ""}${t.lag ? t.lag > 0 ? `+${t.lag}` : String(t.lag) : ""}`;
|
|
2265
|
+
}
|
|
2266
|
+
function xt(e) {
|
|
2267
|
+
let t = [];
|
|
2268
|
+
for (let n of e.split(/[;,]/)) {
|
|
2269
|
+
let e = /^\s*(.+?)(?:\s+(FS|SS|FF|SF))?\s*([+-]\s*\d+(?:\.\d+)?)?\s*$/i.exec(n);
|
|
2270
|
+
if (!e || !e[1].trim()) continue;
|
|
2271
|
+
let r = e[2]?.toUpperCase() ?? "FS", i = e[3] ? Number(e[3].replace(/\s/g, "")) : 0;
|
|
2272
|
+
t.push(r === "FS" && !i ? e[1].trim() : {
|
|
2273
|
+
id: e[1].trim(),
|
|
2274
|
+
type: r,
|
|
2275
|
+
...i ? { lag: i } : {}
|
|
2276
|
+
});
|
|
2277
|
+
}
|
|
2278
|
+
return t;
|
|
2279
|
+
}
|
|
2280
|
+
var St = [
|
|
2281
|
+
"id",
|
|
2282
|
+
"name",
|
|
2283
|
+
"start",
|
|
2284
|
+
"end",
|
|
2285
|
+
"progress",
|
|
2286
|
+
"type",
|
|
2287
|
+
"parent",
|
|
2288
|
+
"dependencies",
|
|
2289
|
+
"color",
|
|
2290
|
+
"baselineStart",
|
|
2291
|
+
"baselineEnd"
|
|
2292
|
+
];
|
|
2293
|
+
function Ct(e, t) {
|
|
2294
|
+
return /["\n\r]/.test(e) || e.includes(t) ? `"${e.replace(/"/g, "\"\"")}"` : e;
|
|
2295
|
+
}
|
|
2296
|
+
function wt(e, t = {}) {
|
|
2297
|
+
let n = t.separator ?? ",", r = [St.join(n)];
|
|
2298
|
+
for (let t of e) {
|
|
2299
|
+
let e = [
|
|
2300
|
+
t.id,
|
|
2301
|
+
t.name,
|
|
2302
|
+
t.start,
|
|
2303
|
+
t.end ?? "",
|
|
2304
|
+
t.progress === void 0 ? "" : String(t.progress),
|
|
2305
|
+
t.type ?? "",
|
|
2306
|
+
t.parentId ?? "",
|
|
2307
|
+
(t.dependencies ?? []).map(bt).join("; "),
|
|
2308
|
+
t.color ?? "",
|
|
2309
|
+
t.baselineStart ?? "",
|
|
2310
|
+
t.baselineEnd ?? ""
|
|
2311
|
+
];
|
|
2312
|
+
r.push(e.map((e) => Ct(e, n)).join(n));
|
|
2313
|
+
}
|
|
2314
|
+
return r.join("\n") + "\n";
|
|
2315
|
+
}
|
|
2316
|
+
function Tt(e, t) {
|
|
2317
|
+
let n = [], r = [], i = "", a = !1;
|
|
2318
|
+
for (let o = 0; o < e.length; o++) {
|
|
2319
|
+
let s = e[o];
|
|
2320
|
+
a ? s === "\"" && e[o + 1] === "\"" ? (i += "\"", o++) : s === "\"" ? a = !1 : i += s : s === "\"" && !i ? a = !0 : s === t ? (r.push(i), i = "") : s === "\n" || s === "\r" ? (s === "\r" && e[o + 1] === "\n" && o++, r.push(i), r.some((e) => e.trim()) && n.push(r), r = [], i = "") : i += s;
|
|
2321
|
+
}
|
|
2322
|
+
return r.push(i), r.some((e) => e.trim()) && n.push(r), n;
|
|
2323
|
+
}
|
|
2324
|
+
var Et = {
|
|
2325
|
+
id: "id",
|
|
2326
|
+
uid: "id",
|
|
2327
|
+
key: "id",
|
|
2328
|
+
"#": "id",
|
|
2329
|
+
name: "name",
|
|
2330
|
+
task: "name",
|
|
2331
|
+
taskname: "name",
|
|
2332
|
+
title: "name",
|
|
2333
|
+
summary: "name",
|
|
2334
|
+
start: "start",
|
|
2335
|
+
startdate: "start",
|
|
2336
|
+
begin: "start",
|
|
2337
|
+
from: "start",
|
|
2338
|
+
end: "end",
|
|
2339
|
+
finish: "end",
|
|
2340
|
+
enddate: "end",
|
|
2341
|
+
finishdate: "end",
|
|
2342
|
+
due: "end",
|
|
2343
|
+
duedate: "end",
|
|
2344
|
+
to: "end",
|
|
2345
|
+
progress: "progress",
|
|
2346
|
+
percentcomplete: "progress",
|
|
2347
|
+
"%complete": "progress",
|
|
2348
|
+
complete: "progress",
|
|
2349
|
+
done: "progress",
|
|
2350
|
+
type: "type",
|
|
2351
|
+
kind: "type",
|
|
2352
|
+
parent: "parent",
|
|
2353
|
+
parentid: "parent",
|
|
2354
|
+
dependencies: "dependencies",
|
|
2355
|
+
predecessors: "dependencies",
|
|
2356
|
+
dependson: "dependencies",
|
|
2357
|
+
depends: "dependencies",
|
|
2358
|
+
color: "color",
|
|
2359
|
+
baselinestart: "baselineStart",
|
|
2360
|
+
baselineend: "baselineEnd",
|
|
2361
|
+
baselinefinish: "baselineEnd"
|
|
2362
|
+
};
|
|
2363
|
+
function Dt(e, t) {
|
|
2364
|
+
let n = e.trim();
|
|
2365
|
+
if (!n) return;
|
|
2366
|
+
let r = /^(\d{4}-\d{2}-\d{2})(?:[T ](\d{2}:\d{2}))?/.exec(n);
|
|
2367
|
+
if (r) return r[2] ? `${r[1]}T${r[2]}` : r[1];
|
|
2368
|
+
let i = /^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2,4})(?:\s+(\d{1,2}):(\d{2}))?$/.exec(n);
|
|
2369
|
+
if (i) {
|
|
2370
|
+
let [e, n] = t ? [i[2], i[1]] : [i[1], i[2]], r = `${i[3].length === 2 ? `20${i[3]}` : i[3]}-${e.padStart(2, "0")}-${n.padStart(2, "0")}`;
|
|
2371
|
+
return i[4] ? `${r}T${i[4].padStart(2, "0")}:${i[5]}` : r;
|
|
2372
|
+
}
|
|
2373
|
+
let a = Date.parse(n);
|
|
2374
|
+
return Number.isNaN(a) ? void 0 : j(a, !/\d:\d/.test(n));
|
|
2375
|
+
}
|
|
2376
|
+
function Ot(e, t = {}) {
|
|
2377
|
+
let n = e.split(/\r?\n/, 1)[0] ?? "", r = t.separator ?? [
|
|
2378
|
+
",",
|
|
2379
|
+
";",
|
|
2380
|
+
" "
|
|
2381
|
+
].map((e) => [e, n.split(e).length]).sort((e, t) => t[1] - e[1])[0][0], i = Tt(e.replace(/^\uFEFF/, ""), r), a = i.shift();
|
|
2382
|
+
if (!a) return [];
|
|
2383
|
+
let o = a.map((e) => Et[e.toLowerCase().replace(/[\s_-]/g, "")]);
|
|
2384
|
+
if (!o.includes("name") || !o.includes("start")) throw SyntaxError("The CSV needs a name and a start column");
|
|
2385
|
+
let s = t.dayFirst ?? !0, c = [];
|
|
2386
|
+
return i.forEach((e, t) => {
|
|
2387
|
+
let n = (t) => {
|
|
2388
|
+
let n = o.indexOf(t);
|
|
2389
|
+
return n < 0 ? "" : (e[n] ?? "").trim();
|
|
2390
|
+
}, r = Dt(n("start"), s);
|
|
2391
|
+
if (!r) return;
|
|
2392
|
+
let i = {
|
|
2393
|
+
id: n("id") || `t${t + 1}`,
|
|
2394
|
+
name: n("name"),
|
|
2395
|
+
start: r
|
|
2396
|
+
}, a = Dt(n("end"), s);
|
|
2397
|
+
a && (i.end = a);
|
|
2398
|
+
let l = parseFloat(n("progress").replace("%", ""));
|
|
2399
|
+
Number.isFinite(l) && (i.progress = l > 0 && l <= 1 && n("progress").includes(".") && !n("progress").includes("%") ? l * 100 : l);
|
|
2400
|
+
let u = n("type").toLowerCase();
|
|
2401
|
+
u === "task" || u === "milestone" || u === "summary" ? i.type = u : a || (i.type = "milestone"), n("parent") && (i.parentId = n("parent")), n("dependencies") && (i.dependencies = xt(n("dependencies")));
|
|
2402
|
+
let d = n("color");
|
|
2403
|
+
[
|
|
2404
|
+
"primary",
|
|
2405
|
+
"secondary",
|
|
2406
|
+
"tertiary",
|
|
2407
|
+
"error",
|
|
2408
|
+
"success",
|
|
2409
|
+
"neutral"
|
|
2410
|
+
].includes(d) && (i.color = d);
|
|
2411
|
+
let f = Dt(n("baselineStart"), s), p = Dt(n("baselineEnd"), s);
|
|
2412
|
+
f && (i.baselineStart = f), p && (i.baselineEnd = p), c.push(i);
|
|
2413
|
+
}), c;
|
|
2414
|
+
}
|
|
2415
|
+
function kt(e, t = {}) {
|
|
2416
|
+
return JSON.stringify({
|
|
2417
|
+
format: "m3ui-gantt",
|
|
2418
|
+
version: 1,
|
|
2419
|
+
tasks: e
|
|
2420
|
+
}, null, t.space ?? 2);
|
|
2421
|
+
}
|
|
2422
|
+
function At(e) {
|
|
2423
|
+
let t = JSON.parse(e), n = Array.isArray(t) ? t : t && typeof t == "object" && Array.isArray(t.tasks) ? t.tasks : null;
|
|
2424
|
+
if (!n) throw SyntaxError("Expected an array of tasks or { tasks: [...] }");
|
|
2425
|
+
return n.map((e, t) => {
|
|
2426
|
+
if (!e || typeof e != "object") throw SyntaxError(`Task ${t + 1} isn't an object`);
|
|
2427
|
+
let n = e;
|
|
2428
|
+
if (typeof n.start != "string" || Number.isNaN(k(n.start))) throw SyntaxError(`Task ${t + 1} has no valid start`);
|
|
2429
|
+
return {
|
|
2430
|
+
...n,
|
|
2431
|
+
id: n.id === void 0 || n.id === null ? `t${t + 1}` : String(n.id),
|
|
2432
|
+
name: String(n.name ?? ""),
|
|
2433
|
+
start: n.start
|
|
2434
|
+
};
|
|
2435
|
+
});
|
|
2436
|
+
}
|
|
2437
|
+
function jt(e) {
|
|
2438
|
+
return e.replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g, "$1").replace(/&#x([0-9a-f]+);/gi, (e, t) => String.fromCodePoint(parseInt(t, 16))).replace(/&#(\d+);/g, (e, t) => String.fromCodePoint(Number(t))).replace(/</g, "<").replace(/>/g, ">").replace(/"/g, "\"").replace(/'/g, "'").replace(/&/g, "&");
|
|
2439
|
+
}
|
|
2440
|
+
function Mt(e) {
|
|
2441
|
+
let t = {
|
|
2442
|
+
name: "#root",
|
|
2443
|
+
children: [],
|
|
2444
|
+
text: ""
|
|
2445
|
+
}, n = [t], r = /<!--[\s\S]*?-->|<\?[\s\S]*?\?>|<!\[CDATA\[[\s\S]*?\]\]>|<![^>]*>|<\/?([\w:.-]+)[^>]*?(\/?)>|[^<]+/g;
|
|
2446
|
+
for (let t; t = r.exec(e);) {
|
|
2447
|
+
let e = t[0], r = n.at(-1);
|
|
2448
|
+
if (e.startsWith("<![CDATA[")) r.text += jt(e);
|
|
2449
|
+
else if (e.startsWith("<!") || e.startsWith("<?")) continue;
|
|
2450
|
+
else if (e.startsWith("</")) {
|
|
2451
|
+
let e = t[1].replace(/^.*:/, "");
|
|
2452
|
+
for (; n.length > 1 && n.pop().name !== e;);
|
|
2453
|
+
} else if (e.startsWith("<")) {
|
|
2454
|
+
let e = {
|
|
2455
|
+
name: t[1].replace(/^.*:/, ""),
|
|
2456
|
+
children: [],
|
|
2457
|
+
text: ""
|
|
2458
|
+
};
|
|
2459
|
+
r.children.push(e), t[2] || n.push(e);
|
|
2460
|
+
} else r.text += jt(e);
|
|
2461
|
+
}
|
|
2462
|
+
return t;
|
|
2463
|
+
}
|
|
2464
|
+
var Y = (e, t) => e?.children.find((e) => e.name === t), X = (e, t) => Y(e, t)?.text.trim() ?? "", Nt = [
|
|
2465
|
+
"FF",
|
|
2466
|
+
"FS",
|
|
2467
|
+
"SF",
|
|
2468
|
+
"SS"
|
|
2469
|
+
], Pt = 4800, Ft = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
2470
|
+
function It(e) {
|
|
2471
|
+
return `${j(e, !1).slice(0, 16)}:00`;
|
|
2472
|
+
}
|
|
2473
|
+
function Lt(e) {
|
|
2474
|
+
let t = Math.round(e / 6e4);
|
|
2475
|
+
return `PT${Math.floor(t / 60)}H${t % 60}M0S`;
|
|
2476
|
+
}
|
|
2477
|
+
function Rt(e, t = {}) {
|
|
2478
|
+
let n = t.dayStart ?? 8, r = t.dayEnd ?? 17, i = new Set(e.map((e) => e.id)), a = je(e), o = /* @__PURE__ */ new Map();
|
|
2479
|
+
for (let t of e) {
|
|
2480
|
+
let e = t.parentId && i.has(t.parentId) ? t.parentId : void 0;
|
|
2481
|
+
(o.get(e) ?? o.set(e, []).get(e)).push(t);
|
|
2482
|
+
}
|
|
2483
|
+
let s = [], c = (e, t) => {
|
|
2484
|
+
for (let n of o.get(e) ?? []) s.push({
|
|
2485
|
+
t: n,
|
|
2486
|
+
level: t
|
|
2487
|
+
}), t < 100 && c(n.id, t + 1);
|
|
2488
|
+
};
|
|
2489
|
+
c(void 0, 1);
|
|
2490
|
+
let l = new Map(s.map((e, t) => [e.t.id, t + 1])), u = (e, t, i) => {
|
|
2491
|
+
let a = z({
|
|
2492
|
+
start: t ?? e.start,
|
|
2493
|
+
end: i ?? e.end,
|
|
2494
|
+
type: e.type
|
|
2495
|
+
});
|
|
2496
|
+
if (!a.dateOnly) return {
|
|
2497
|
+
start: a.start,
|
|
2498
|
+
finish: a.end,
|
|
2499
|
+
work: a.end - a.start
|
|
2500
|
+
};
|
|
2501
|
+
let o = a.end > a.start ? N(a.end, -1) : a.start, s = Math.max(0, Math.round((M(a.end) - M(a.start)) / E));
|
|
2502
|
+
return {
|
|
2503
|
+
start: a.start + n * 36e5,
|
|
2504
|
+
finish: a.end > a.start ? o + r * 36e5 : a.start + n * 36e5,
|
|
2505
|
+
work: s * (r - n) * 36e5
|
|
2506
|
+
};
|
|
2507
|
+
}, d = ["<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>", "<Project xmlns=\"http://schemas.microsoft.com/project\">"];
|
|
2508
|
+
return t.name && d.push(` <Name>${Ft(t.name)}</Name>`, ` <Title>${Ft(t.name)}</Title>`), d.push(" <ScheduleFromStart>1</ScheduleFromStart>", ` <DefaultStartTime>${String(n).padStart(2, "0")}:00:00</DefaultStartTime>`, ` <DefaultFinishTime>${String(r).padStart(2, "0")}:00:00</DefaultFinishTime>`, " <Tasks>"), s.forEach(({ t: e, level: t }, n) => {
|
|
2509
|
+
let r = u(e), i = e.type === "milestone" || !e.end, o = [
|
|
2510
|
+
`<UID>${n + 1}</UID>`,
|
|
2511
|
+
`<ID>${n + 1}</ID>`,
|
|
2512
|
+
`<Name>${Ft(e.name)}</Name>`,
|
|
2513
|
+
`<OutlineLevel>${t}</OutlineLevel>`,
|
|
2514
|
+
`<Start>${It(r.start)}</Start>`,
|
|
2515
|
+
`<Finish>${It(r.finish)}</Finish>`,
|
|
2516
|
+
`<Duration>${Lt(i ? 0 : r.work)}</Duration>`,
|
|
2517
|
+
"<DurationFormat>7</DurationFormat>",
|
|
2518
|
+
`<PercentComplete>${Math.round(e.progress ?? 0)}</PercentComplete>`,
|
|
2519
|
+
`<Milestone>${+!!i}</Milestone>`,
|
|
2520
|
+
`<Summary>${+!!a.has(e.id)}</Summary>`
|
|
2521
|
+
];
|
|
2522
|
+
if (e.baselineStart) {
|
|
2523
|
+
let t = u(e, e.baselineStart, e.baselineEnd ?? (e.end ? e.baselineStart : void 0));
|
|
2524
|
+
o.push(`<Baseline><Number>0</Number><Start>${It(t.start)}</Start><Finish>${It(t.finish)}</Finish><Duration>${Lt(t.work)}</Duration></Baseline>`);
|
|
2525
|
+
}
|
|
2526
|
+
for (let t of e.dependencies ?? []) {
|
|
2527
|
+
let e = Ae(t);
|
|
2528
|
+
l.has(e.id) && o.push(`<PredecessorLink><PredecessorUID>${l.get(e.id)}</PredecessorUID><Type>${Nt.indexOf(e.type)}</Type><LinkLag>${Math.round(e.lag * Pt)}</LinkLag><LagFormat>7</LagFormat></PredecessorLink>`);
|
|
2529
|
+
}
|
|
2530
|
+
d.push(" <Task>", ...o.map((e) => ` ${e}`), " </Task>");
|
|
2531
|
+
}), d.push(" </Tasks>", "</Project>"), d.join("\n") + "\n";
|
|
2532
|
+
}
|
|
2533
|
+
function zt(e, t = {}) {
|
|
2534
|
+
let n = Y(Mt(e), "Project");
|
|
2535
|
+
if (!n) throw SyntaxError("Not a Microsoft Project XML file (no <Project>)");
|
|
2536
|
+
let r = (Y(n, "Tasks")?.children.filter((e) => e.name === "Task") ?? []).map((e) => ({
|
|
2537
|
+
uid: X(e, "UID"),
|
|
2538
|
+
name: X(e, "Name"),
|
|
2539
|
+
level: Number(X(e, "OutlineLevel") || 1),
|
|
2540
|
+
start: X(e, "Start"),
|
|
2541
|
+
finish: X(e, "Finish"),
|
|
2542
|
+
progress: Number(X(e, "PercentComplete") || 0),
|
|
2543
|
+
milestone: X(e, "Milestone") === "1",
|
|
2544
|
+
summary: X(e, "Summary") === "1",
|
|
2545
|
+
nullTask: X(e, "IsNull") === "1",
|
|
2546
|
+
baseline: e.children.find((e) => e.name === "Baseline" && (X(e, "Number") || "0") === "0"),
|
|
2547
|
+
links: e.children.filter((e) => e.name === "PredecessorLink")
|
|
2548
|
+
})).filter((e) => e.uid && e.start && !e.nullTask && !(e.uid === "0" && e.level <= 0)), i = r.every((e) => /T(0?0:00|0?8:00|0?9:00)/.test(e.start) && (e.milestone || /T(0?0:00|1[6-8]:00|23:59)/.test(e.finish))), a = t.dates === "date" || t.dates !== "datetime" && i, o = (e) => j(k(e.slice(0, 19)), a), s = (e) => {
|
|
2549
|
+
if (!a) return o(e);
|
|
2550
|
+
let t = k(e.slice(0, 19));
|
|
2551
|
+
return j(M(t) === t ? N(t, -1) : t, !0);
|
|
2552
|
+
}, c = [], l = r.map((e) => {
|
|
2553
|
+
c.length = Math.max(0, e.level - 1);
|
|
2554
|
+
let t = {
|
|
2555
|
+
id: e.uid,
|
|
2556
|
+
name: e.name,
|
|
2557
|
+
start: o(e.start)
|
|
2558
|
+
};
|
|
2559
|
+
e.milestone ? t.type = "milestone" : t.end = O(t.start) ? s(e.finish) : o(e.finish), t.end && k(t.end) < k(t.start) && (t.end = t.start), e.progress && (t.progress = e.progress);
|
|
2560
|
+
let n = c[e.level - 2];
|
|
2561
|
+
n && (t.parentId = n), c[e.level - 1] = e.uid, e.summary && (t.type = "summary"), e.baseline && X(e.baseline, "Start") && (t.baselineStart = o(X(e.baseline, "Start")), !e.milestone && X(e.baseline, "Finish") && (t.baselineEnd = O(t.baselineStart) ? s(X(e.baseline, "Finish")) : o(X(e.baseline, "Finish"))));
|
|
2562
|
+
let r = [];
|
|
2563
|
+
for (let t of e.links) {
|
|
2564
|
+
let e = X(t, "PredecessorUID");
|
|
2565
|
+
if (!e) continue;
|
|
2566
|
+
let n = Nt[Number(X(t, "Type") || 1)] ?? "FS", i = Math.round(Number(X(t, "LinkLag") || 0) / Pt * 100) / 100;
|
|
2567
|
+
r.push(n === "FS" && !i ? e : {
|
|
2568
|
+
id: e,
|
|
2569
|
+
type: n,
|
|
2570
|
+
...i ? { lag: i } : {}
|
|
2571
|
+
});
|
|
2572
|
+
}
|
|
2573
|
+
return r.length && (t.dependencies = r), t;
|
|
2574
|
+
}), u = X(n, "Title") || X(n, "Name") || void 0;
|
|
2575
|
+
return {
|
|
2576
|
+
...u ? { name: u } : {},
|
|
2577
|
+
tasks: l
|
|
2578
|
+
};
|
|
2579
|
+
}
|
|
2580
|
+
//#endregion
|
|
2581
|
+
//#region src/composables/useResourceTimeline.ts
|
|
2582
|
+
var Bt = Symbol("m3-resource-timeline");
|
|
2583
|
+
function Vt() {
|
|
2584
|
+
let e = _(Bt, null);
|
|
2585
|
+
if (!e) throw Error("useResourceTimeline() must be called inside <MResourceTimeline>");
|
|
2586
|
+
return e;
|
|
2587
|
+
}
|
|
2588
|
+
//#endregion
|
|
2589
|
+
//#region src/components/MResourceTimeline.vue?vue&type=script&setup=true&lang.ts
|
|
2590
|
+
var Ht = ["aria-label"], Ut = ["aria-expanded", "onClick"], Wt = { class: "truncate" }, Gt = { class: "ml-auto pr-2 text-label-medium text-on-surface-variant" }, Kt = ["src"], qt = {
|
|
2591
|
+
key: 0,
|
|
2592
|
+
class: "material-symbols-outlined text-[20px]"
|
|
2593
|
+
}, Jt = { class: "min-w-0" }, Yt = { class: "block truncate text-body-large text-on-surface" }, Xt = {
|
|
2594
|
+
key: 0,
|
|
2595
|
+
class: "block truncate text-body-small text-on-surface-variant"
|
|
2596
|
+
}, Zt = ["aria-label"], Qt = [
|
|
2597
|
+
"aria-label",
|
|
2598
|
+
"aria-pressed",
|
|
2599
|
+
"onPointerdown",
|
|
2600
|
+
"onDblclick",
|
|
2601
|
+
"onContextmenu",
|
|
2602
|
+
"onKeydown"
|
|
2603
|
+
], $t = { class: "flex min-w-0 flex-1 items-center gap-1 px-2" }, en = { class: "min-w-0 flex-1 leading-tight" }, tn = { class: "block truncate text-label-large" }, nn = {
|
|
2604
|
+
key: 0,
|
|
2605
|
+
class: "block truncate text-label-small opacity-80"
|
|
2606
|
+
}, rn = ["title"], an = ["data-timeline-resize", "onPointerdown"], on = { class: "text-body-medium text-on-surface-variant" }, sn = {
|
|
2607
|
+
class: "sr-only",
|
|
2608
|
+
"aria-live": "polite"
|
|
2609
|
+
}, cn = 40, ln = 56, un = 400, dn = /* @__PURE__ */ g({
|
|
2610
|
+
__name: "MResourceTimeline",
|
|
2611
|
+
props: {
|
|
2612
|
+
events: { default: () => [] },
|
|
2613
|
+
resources: { default: () => [] },
|
|
2614
|
+
scale: { default: "day" },
|
|
2615
|
+
pxPerDay: { default: 240 },
|
|
2616
|
+
selection: {},
|
|
2617
|
+
collapsed: {},
|
|
2618
|
+
listWidth: {},
|
|
2619
|
+
rowHeight: { default: 56 },
|
|
2620
|
+
laneHeight: { default: 40 },
|
|
2621
|
+
overlap: { default: "stack" },
|
|
2622
|
+
creatable: {
|
|
2623
|
+
type: Boolean,
|
|
2624
|
+
default: !1
|
|
2625
|
+
},
|
|
2626
|
+
readonly: {
|
|
2627
|
+
type: Boolean,
|
|
2628
|
+
default: !1
|
|
2629
|
+
},
|
|
2630
|
+
snap: {},
|
|
2631
|
+
calendar: {},
|
|
2632
|
+
workHours: {},
|
|
2633
|
+
now: {},
|
|
2634
|
+
start: {},
|
|
2635
|
+
weekStartsOn: { default: 1 },
|
|
2636
|
+
minPxPerDay: { default: 2 },
|
|
2637
|
+
maxPxPerDay: { default: 4800 },
|
|
2638
|
+
locale: {},
|
|
2639
|
+
label: {},
|
|
2640
|
+
beforeDelete: {}
|
|
2641
|
+
},
|
|
2642
|
+
emits: [
|
|
2643
|
+
"update:events",
|
|
2644
|
+
"update:scale",
|
|
2645
|
+
"update:selection",
|
|
2646
|
+
"update:collapsed",
|
|
2647
|
+
"update:listWidth",
|
|
2648
|
+
"event-click",
|
|
2649
|
+
"event-dblclick",
|
|
2650
|
+
"event-contextmenu",
|
|
2651
|
+
"create",
|
|
2652
|
+
"slot-click",
|
|
2653
|
+
"change",
|
|
2654
|
+
"conflict",
|
|
2655
|
+
"delete"
|
|
2656
|
+
],
|
|
2657
|
+
setup(t, { expose: n, emit: r }) {
|
|
2658
|
+
let a = t, o = r, c = e(), u = l(() => a.locale ?? (c.lang === "en" ? void 0 : c.lang)), g = se(a.events);
|
|
2659
|
+
de(() => a.events, (e) => {
|
|
2660
|
+
g.value = e;
|
|
2661
|
+
});
|
|
2662
|
+
let _ = se(null), ne = l(() => _.value ?? g.value), ie = [], le = [], ue = x(0);
|
|
2663
|
+
function fe(e) {
|
|
2664
|
+
g.value = e, o("update:events", e);
|
|
2665
|
+
}
|
|
2666
|
+
function he(e) {
|
|
2667
|
+
ie.push(ce(g.value)), ie.length > 100 && ie.shift(), le.length = 0, ue.value++, fe(e);
|
|
2668
|
+
}
|
|
2669
|
+
function T() {
|
|
2670
|
+
let e = ie.pop();
|
|
2671
|
+
e && (le.push(ce(g.value)), ue.value++, fe(e));
|
|
2672
|
+
}
|
|
2673
|
+
function D() {
|
|
2674
|
+
let e = le.pop();
|
|
2675
|
+
e && (ie.push(ce(g.value)), ue.value++, fe(e));
|
|
2676
|
+
}
|
|
2677
|
+
let ve = l(() => (ue.value, ie.length > 0)), O = l(() => (ue.value, le.length > 0)), A = l(() => new Map(ne.value.map((e) => [e.id, e]))), M = l(() => new Map(a.resources.map((e) => [e.id, e]))), N = x(a.selection ?? []);
|
|
2678
|
+
de(() => a.selection, (e) => {
|
|
2679
|
+
e && (N.value = e);
|
|
2680
|
+
});
|
|
2681
|
+
let ye = l(() => new Set(N.value));
|
|
2682
|
+
function P(e) {
|
|
2683
|
+
let t = e.filter((e) => A.value.get(e)?.selectable !== !1);
|
|
2684
|
+
N.value = t, o("update:selection", t);
|
|
2685
|
+
}
|
|
2686
|
+
let be = x(a.collapsed ?? []);
|
|
2687
|
+
de(() => a.collapsed, (e) => {
|
|
2688
|
+
e && (be.value = e);
|
|
2689
|
+
});
|
|
2690
|
+
let Se = l(() => new Set(be.value));
|
|
2691
|
+
function Ce(e) {
|
|
2692
|
+
be.value = e, o("update:collapsed", e);
|
|
2693
|
+
}
|
|
2694
|
+
let we = (e) => Ce(Se.value.has(e) ? be.value.filter((t) => t !== e) : [...be.value, e]), F = l(() => {
|
|
2695
|
+
let e = /* @__PURE__ */ new Map();
|
|
2696
|
+
for (let t of ne.value) {
|
|
2697
|
+
let n = z({
|
|
2698
|
+
start: t.start,
|
|
2699
|
+
end: t.end
|
|
2700
|
+
});
|
|
2701
|
+
Number.isFinite(n.start) && e.set(t.id, n);
|
|
2702
|
+
}
|
|
2703
|
+
return e;
|
|
2704
|
+
}), Te = l(() => {
|
|
2705
|
+
let e = /* @__PURE__ */ new Map();
|
|
2706
|
+
for (let t of ne.value) F.value.has(t.id) && (e.get(t.resourceId) ?? e.set(t.resourceId, []).get(t.resourceId)).push(t);
|
|
2707
|
+
for (let t of e.values()) t.sort((e, t) => F.value.get(e.id).start - F.value.get(t.id).start);
|
|
2708
|
+
return e;
|
|
2709
|
+
}), Ee = l(() => {
|
|
2710
|
+
let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map();
|
|
2711
|
+
for (let [n, r] of Te.value) {
|
|
2712
|
+
let i = [];
|
|
2713
|
+
for (let t of r) {
|
|
2714
|
+
let n = F.value.get(t.id), r = i.findIndex((e) => e <= n.start);
|
|
2715
|
+
r < 0 && (r = i.length, i.push(0)), i[r] = n.end, e.set(t.id, r);
|
|
2716
|
+
}
|
|
2717
|
+
t.set(n, Math.max(1, i.length));
|
|
2718
|
+
}
|
|
2719
|
+
return {
|
|
2720
|
+
lane: e,
|
|
2721
|
+
count: t
|
|
2722
|
+
};
|
|
2723
|
+
});
|
|
2724
|
+
function De(e, t, n) {
|
|
2725
|
+
let r = /* @__PURE__ */ new Map(), i = [];
|
|
2726
|
+
for (let a of e) {
|
|
2727
|
+
let e = n.get(a.id);
|
|
2728
|
+
for (let t = i.length - 1; t >= 0; t--) n.get(i[t].id).end <= e.start && i.splice(t, 1);
|
|
2729
|
+
if (i.push(a), i.length > t) for (let e of i) r.set(e.id, i.filter((t) => t !== e).map((e) => e.id));
|
|
2730
|
+
}
|
|
2731
|
+
return r;
|
|
2732
|
+
}
|
|
2733
|
+
let Oe = l(() => {
|
|
2734
|
+
let e = /* @__PURE__ */ new Map();
|
|
2735
|
+
for (let [t, n] of Te.value) for (let [r, i] of De(n, M.value.get(t)?.capacity ?? 1, F.value)) e.set(r, i);
|
|
2736
|
+
return e;
|
|
2737
|
+
}), I = l(() => new Set(Oe.value.keys())), L = l(() => {
|
|
2738
|
+
let e = [], t = /* @__PURE__ */ new Map(), n = [];
|
|
2739
|
+
for (let e of a.resources) {
|
|
2740
|
+
if (!e.group) {
|
|
2741
|
+
n.push(e);
|
|
2742
|
+
continue;
|
|
2743
|
+
}
|
|
2744
|
+
t.has(e.group) || (t.set(e.group, []), n.push(e.group)), t.get(e.group).push(e);
|
|
2745
|
+
}
|
|
2746
|
+
let r = 0, i = (t) => {
|
|
2747
|
+
let n = Math.max(a.rowHeight, (Ee.value.count.get(t.id) ?? 1) * a.laneHeight + 8);
|
|
2748
|
+
e.push({
|
|
2749
|
+
kind: "resource",
|
|
2750
|
+
key: t.id,
|
|
2751
|
+
resource: t,
|
|
2752
|
+
top: r,
|
|
2753
|
+
height: n
|
|
2754
|
+
}), r += n;
|
|
2755
|
+
};
|
|
2756
|
+
for (let a of n) {
|
|
2757
|
+
if (typeof a != "string") {
|
|
2758
|
+
i(a);
|
|
2759
|
+
continue;
|
|
2760
|
+
}
|
|
2761
|
+
let n = t.get(a);
|
|
2762
|
+
e.push({
|
|
2763
|
+
kind: "group",
|
|
2764
|
+
key: `group:${a}`,
|
|
2765
|
+
group: a,
|
|
2766
|
+
top: r,
|
|
2767
|
+
height: cn,
|
|
2768
|
+
resources: n
|
|
2769
|
+
}), r += cn, Se.value.has(a) || n.forEach(i);
|
|
2770
|
+
}
|
|
2771
|
+
return e;
|
|
2772
|
+
}), Ae = l(() => {
|
|
2773
|
+
let e = /* @__PURE__ */ new Map();
|
|
2774
|
+
for (let t of L.value) t.kind === "resource" && e.set(t.resource.id, t);
|
|
2775
|
+
return e;
|
|
2776
|
+
}), je = l(() => {
|
|
2777
|
+
let e = L.value.at(-1);
|
|
2778
|
+
return e ? e.top + e.height : 0;
|
|
2779
|
+
}), R = (e) => M.value.get(e)?.group, B = x(), Ne = x(a.listWidth ?? 220);
|
|
2780
|
+
de(() => a.listWidth, (e) => {
|
|
2781
|
+
e !== void 0 && (Ne.value = e);
|
|
2782
|
+
});
|
|
2783
|
+
let V = l(() => Ne.value), Pe = l(() => {
|
|
2784
|
+
let e = Infinity, t = -Infinity;
|
|
2785
|
+
for (let n of F.value.values()) e = Math.min(e, n.start), t = Math.max(t, n.end);
|
|
2786
|
+
let n = a.start ? k(a.start) : a.now ? k(a.now) : Date.now();
|
|
2787
|
+
return Number.isFinite(e) || (e = n, t = n + E), {
|
|
2788
|
+
min: Math.min(e, n),
|
|
2789
|
+
max: Math.max(t, n + E)
|
|
2790
|
+
};
|
|
2791
|
+
}), H = Le({
|
|
2792
|
+
scroller: B,
|
|
2793
|
+
listWidth: V,
|
|
2794
|
+
headerHeight: ln,
|
|
2795
|
+
extent: Pe,
|
|
2796
|
+
scale: () => a.scale,
|
|
2797
|
+
pxPerDay: () => a.pxPerDay,
|
|
2798
|
+
minPxPerDay: () => a.minPxPerDay,
|
|
2799
|
+
maxPxPerDay: () => a.maxPxPerDay,
|
|
2800
|
+
weekStartsOn: () => a.weekStartsOn,
|
|
2801
|
+
lang: u,
|
|
2802
|
+
quarterLabel: () => c.ganttQuarter,
|
|
2803
|
+
today: () => a.now,
|
|
2804
|
+
calendar: () => a.calendar ?? { workingDays: [
|
|
2805
|
+
0,
|
|
2806
|
+
1,
|
|
2807
|
+
2,
|
|
2808
|
+
3,
|
|
2809
|
+
4,
|
|
2810
|
+
5,
|
|
2811
|
+
6
|
|
2812
|
+
] },
|
|
2813
|
+
workHours: () => a.workHours,
|
|
2814
|
+
onScale: (e) => o("update:scale", e),
|
|
2815
|
+
onPinch: () => {
|
|
2816
|
+
K && Et({ pointerId: K.id });
|
|
2817
|
+
}
|
|
2818
|
+
}), { ppd: U, view: W, timelineView: Fe, timelineWidth: Ie, todayMs: Re, xOf: G, timeAt: Be, zoomIn: He, zoomOut: Ue, setScale: We, scrollToDate: Ge, topCells: Ke, bottomCells: qe, offTimes: Je } = H, Ye = l(() => {
|
|
2819
|
+
let e = W.value.top - un, t = W.value.top + W.value.height + un;
|
|
2820
|
+
return L.value.filter((n) => n.top + n.height >= e && n.top <= t);
|
|
2821
|
+
}), Xe = l(() => Be(W.value.left - 400)), Ze = l(() => Be(W.value.left + Fe.value + 400)), Qe = l(() => {
|
|
2822
|
+
let e = [];
|
|
2823
|
+
for (let t of Ye.value) if (t.kind === "resource") for (let n of Te.value.get(t.resource.id) ?? []) {
|
|
2824
|
+
let r = F.value.get(n.id);
|
|
2825
|
+
r.end >= Xe.value && r.start <= Ze.value && e.push({
|
|
2826
|
+
event: n,
|
|
2827
|
+
row: t
|
|
2828
|
+
});
|
|
2829
|
+
}
|
|
2830
|
+
return e;
|
|
2831
|
+
}), $e = l(() => a.laneHeight - 8), et = l(() => {
|
|
2832
|
+
let e = /* @__PURE__ */ new Map();
|
|
2833
|
+
for (let t of ne.value) {
|
|
2834
|
+
let n = F.value.get(t.id), r = Ae.value.get(t.resourceId);
|
|
2835
|
+
if (!n || !r) continue;
|
|
2836
|
+
let i = (Ee.value.count.get(t.resourceId) ?? 1) * a.laneHeight, o = r.top + (r.height - i) / 2 + (Ee.value.lane.get(t.id) ?? 0) * a.laneHeight + 4;
|
|
2837
|
+
e.set(t.id, {
|
|
2838
|
+
x: G(n.start),
|
|
2839
|
+
y: o,
|
|
2840
|
+
w: Math.max(4, G(n.end) - G(n.start))
|
|
2841
|
+
});
|
|
2842
|
+
}
|
|
2843
|
+
return e;
|
|
2844
|
+
}), tt = /* @__PURE__ */ new Map(), nt = /* @__PURE__ */ new Map(), rt = 0, it = {
|
|
2845
|
+
ppd: U.value,
|
|
2846
|
+
origin: H.origin.value
|
|
2847
|
+
};
|
|
2848
|
+
de(et, (e) => {
|
|
2849
|
+
let t = it.ppd !== U.value || it.origin !== H.origin.value || i();
|
|
2850
|
+
it = {
|
|
2851
|
+
ppd: U.value,
|
|
2852
|
+
origin: H.origin.value
|
|
2853
|
+
};
|
|
2854
|
+
let n = !1;
|
|
2855
|
+
for (let [r, i] of e) {
|
|
2856
|
+
let e = tt.get(r);
|
|
2857
|
+
if (!e || t) {
|
|
2858
|
+
tt.set(r, {
|
|
2859
|
+
...i,
|
|
2860
|
+
vx: 0,
|
|
2861
|
+
vy: 0,
|
|
2862
|
+
vw: 0,
|
|
2863
|
+
tx: i.x,
|
|
2864
|
+
ty: i.y,
|
|
2865
|
+
tw: i.w
|
|
2866
|
+
});
|
|
2867
|
+
continue;
|
|
2868
|
+
}
|
|
2869
|
+
if (ut.value?.id === r && ut.value.part === "body") {
|
|
2870
|
+
Object.assign(e, {
|
|
2871
|
+
x: i.x,
|
|
2872
|
+
y: i.y,
|
|
2873
|
+
w: i.w,
|
|
2874
|
+
tx: i.x,
|
|
2875
|
+
ty: i.y,
|
|
2876
|
+
tw: i.w,
|
|
2877
|
+
vx: 0,
|
|
2878
|
+
vy: 0,
|
|
2879
|
+
vw: 0
|
|
2880
|
+
});
|
|
2881
|
+
continue;
|
|
2882
|
+
}
|
|
2883
|
+
(e.tx !== i.x || e.ty !== i.y || e.tw !== i.w) && (e.tx = i.x, e.ty = i.y, e.tw = i.w, n = !0);
|
|
2884
|
+
}
|
|
2885
|
+
for (let t of tt.keys()) e.has(t) || tt.delete(t);
|
|
2886
|
+
n ? at() : st();
|
|
2887
|
+
}, {
|
|
2888
|
+
immediate: !0,
|
|
2889
|
+
flush: "post"
|
|
2890
|
+
});
|
|
2891
|
+
function at() {
|
|
2892
|
+
if (rt) return;
|
|
2893
|
+
let e = performance.now(), t = 1.8 * Math.sqrt(700), n = (r) => {
|
|
2894
|
+
let i = Math.min((r - e) / 1e3, 1 / 30);
|
|
2895
|
+
for (e = r; i > 0;) {
|
|
2896
|
+
let e = Math.min(i, .004);
|
|
2897
|
+
for (let n of tt.values()) n.vx += (-700 * (n.x - n.tx) - t * n.vx) * e, n.x += n.vx * e, n.vy += (-700 * (n.y - n.ty) - t * n.vy) * e, n.y += n.vy * e, n.vw += (-700 * (n.w - n.tw) - t * n.vw) * e, n.w += n.vw * e;
|
|
2898
|
+
i -= e;
|
|
2899
|
+
}
|
|
2900
|
+
let a = !1;
|
|
2901
|
+
for (let e of tt.values()) Math.abs(e.x - e.tx) + Math.abs(e.y - e.ty) + Math.abs(e.w - e.tw) < .6 && Math.abs(e.vx) + Math.abs(e.vy) + Math.abs(e.vw) < 4 ? Object.assign(e, {
|
|
2902
|
+
x: e.tx,
|
|
2903
|
+
y: e.ty,
|
|
2904
|
+
w: e.tw,
|
|
2905
|
+
vx: 0,
|
|
2906
|
+
vy: 0,
|
|
2907
|
+
vw: 0
|
|
2908
|
+
}) : a = !0;
|
|
2909
|
+
st(), rt = a ? requestAnimationFrame(n) : 0;
|
|
2910
|
+
};
|
|
2911
|
+
rt = requestAnimationFrame(n);
|
|
2912
|
+
}
|
|
2913
|
+
function ot(e, t) {
|
|
2914
|
+
let n = tt.get(e);
|
|
2915
|
+
n && (t.style.transform = `translate(${n.x}px, ${n.y}px)`, t.style.width = `${n.w}px`);
|
|
2916
|
+
}
|
|
2917
|
+
function st() {
|
|
2918
|
+
for (let [e, t] of nt) ot(e, t);
|
|
2919
|
+
}
|
|
2920
|
+
function ct(e, t) {
|
|
2921
|
+
t instanceof HTMLElement ? (nt.set(e, t), ot(e, t)) : nt.delete(e);
|
|
2922
|
+
}
|
|
2923
|
+
let K = null, lt, ut = x(null), dt = x(null), ft = x(!1), pt = {
|
|
2924
|
+
x: 0,
|
|
2925
|
+
y: 0
|
|
2926
|
+
}, mt = (e) => e instanceof Element && !!e.closest("input, textarea, select, button, a, [contenteditable], [data-timeline-action]");
|
|
2927
|
+
function ht(e, t) {
|
|
2928
|
+
let n = B.value.getBoundingClientRect();
|
|
2929
|
+
return {
|
|
2930
|
+
x: e - n.left - V.value + B.value.scrollLeft,
|
|
2931
|
+
y: t - n.top - ln + B.value.scrollTop
|
|
2932
|
+
};
|
|
2933
|
+
}
|
|
2934
|
+
function gt(e) {
|
|
2935
|
+
let t = L.value.find((t) => e >= t.top && e < t.top + t.height);
|
|
2936
|
+
return t?.kind === "resource" ? t.resource : void 0;
|
|
2937
|
+
}
|
|
2938
|
+
function _t(e) {
|
|
2939
|
+
return e ? 1440 : a.snap ?? (U.value >= 192 ? 15 : ke(U.value));
|
|
2940
|
+
}
|
|
2941
|
+
function vt(e, t, n) {
|
|
2942
|
+
if (e.button !== 0 || mt(e.target)) return;
|
|
2943
|
+
e.stopPropagation();
|
|
2944
|
+
let r = F.value.get(t.id);
|
|
2945
|
+
if (!r) return;
|
|
2946
|
+
let i = e.pointerType === "touch";
|
|
2947
|
+
K = {
|
|
2948
|
+
kind: "event",
|
|
2949
|
+
part: n,
|
|
2950
|
+
id: e.pointerId,
|
|
2951
|
+
eventId: t.id,
|
|
2952
|
+
sx: e.clientX,
|
|
2953
|
+
sy: e.clientY,
|
|
2954
|
+
sl: B.value.scrollLeft,
|
|
2955
|
+
st: B.value.scrollTop,
|
|
2956
|
+
touch: i,
|
|
2957
|
+
active: !1,
|
|
2958
|
+
span: r,
|
|
2959
|
+
resourceId: t.resourceId
|
|
2960
|
+
}, J(), i && n === "body" ? lt = setTimeout(() => xt(), 250) : i && xt();
|
|
2961
|
+
}
|
|
2962
|
+
function q(e) {
|
|
2963
|
+
if (e.button !== 0 || mt(e.target)) return;
|
|
2964
|
+
let t = ht(e.clientX, e.clientY), n = gt(t.y), r = e.pointerType === "touch";
|
|
2965
|
+
if (n && a.creatable && !a.readonly) {
|
|
2966
|
+
K = {
|
|
2967
|
+
kind: "empty",
|
|
2968
|
+
id: e.pointerId,
|
|
2969
|
+
resourceId: n.id,
|
|
2970
|
+
sx: e.clientX,
|
|
2971
|
+
sy: e.clientY,
|
|
2972
|
+
t0: Be(t.x),
|
|
2973
|
+
touch: r,
|
|
2974
|
+
active: !1
|
|
2975
|
+
}, J(), r && (lt = setTimeout(() => xt(), 350));
|
|
2976
|
+
return;
|
|
2977
|
+
}
|
|
2978
|
+
if (r) {
|
|
2979
|
+
n && (K = {
|
|
2980
|
+
kind: "empty",
|
|
2981
|
+
id: e.pointerId,
|
|
2982
|
+
resourceId: n.id,
|
|
2983
|
+
sx: e.clientX,
|
|
2984
|
+
sy: e.clientY,
|
|
2985
|
+
t0: Be(t.x),
|
|
2986
|
+
touch: r,
|
|
2987
|
+
active: !1
|
|
2988
|
+
}, J());
|
|
2989
|
+
return;
|
|
2990
|
+
}
|
|
2991
|
+
K = {
|
|
2992
|
+
kind: "pan",
|
|
2993
|
+
id: e.pointerId,
|
|
2994
|
+
sx: e.clientX,
|
|
2995
|
+
sy: e.clientY,
|
|
2996
|
+
sl: B.value.scrollLeft,
|
|
2997
|
+
st: B.value.scrollTop,
|
|
2998
|
+
moved: !1,
|
|
2999
|
+
resourceId: n?.id
|
|
3000
|
+
}, J();
|
|
3001
|
+
}
|
|
3002
|
+
function yt(e) {
|
|
3003
|
+
e.button === 0 && (e.preventDefault(), K = {
|
|
3004
|
+
kind: "split",
|
|
3005
|
+
id: e.pointerId,
|
|
3006
|
+
sx: e.clientX,
|
|
3007
|
+
w: Ne.value
|
|
3008
|
+
}, J());
|
|
3009
|
+
}
|
|
3010
|
+
function J() {
|
|
3011
|
+
window.addEventListener("pointermove", St), window.addEventListener("pointerup", Tt), window.addEventListener("pointercancel", Et);
|
|
3012
|
+
}
|
|
3013
|
+
function bt() {
|
|
3014
|
+
window.removeEventListener("pointermove", St), window.removeEventListener("pointerup", Tt), window.removeEventListener("pointercancel", Et), clearTimeout(lt), document.body.style.userSelect = "";
|
|
3015
|
+
}
|
|
3016
|
+
function xt() {
|
|
3017
|
+
let e = K;
|
|
3018
|
+
if (!(!e || e.kind !== "event" && e.kind !== "empty" || e.active)) {
|
|
3019
|
+
if (e.kind === "event") {
|
|
3020
|
+
let t = A.value.get(e.eventId);
|
|
3021
|
+
if (!t || a.readonly || e.part === "body" && t.draggable === !1 || e.part !== "body" && t.resizable === !1) return;
|
|
3022
|
+
e.active = !0, ye.value.has(t.id) || P([t.id]), ut.value = {
|
|
3023
|
+
id: t.id,
|
|
3024
|
+
part: e.part
|
|
3025
|
+
};
|
|
3026
|
+
} else {
|
|
3027
|
+
if (!a.creatable || a.readonly) return;
|
|
3028
|
+
e.active = !0;
|
|
3029
|
+
let t = _t(!1) * 6e4, n = xe(e.t0, _t(!1));
|
|
3030
|
+
dt.value = {
|
|
3031
|
+
resourceId: e.resourceId,
|
|
3032
|
+
start: n,
|
|
3033
|
+
end: n + Math.max(t, _e)
|
|
3034
|
+
};
|
|
3035
|
+
}
|
|
3036
|
+
e.touch && navigator.vibrate?.(10), document.body.style.userSelect = "none", Ot();
|
|
3037
|
+
}
|
|
3038
|
+
}
|
|
3039
|
+
function St(e) {
|
|
3040
|
+
let t = K;
|
|
3041
|
+
if (t && t.id === e.pointerId) {
|
|
3042
|
+
if (pt.x = e.clientX, pt.y = e.clientY, t.kind === "split") {
|
|
3043
|
+
let n = Math.round(Math.min(Math.max(0, t.w + e.clientX - t.sx), Math.max(160, W.value.width - 80)));
|
|
3044
|
+
Ne.value = n, o("update:listWidth", n);
|
|
3045
|
+
return;
|
|
3046
|
+
}
|
|
3047
|
+
if (t.kind === "pan") {
|
|
3048
|
+
let n = e.clientX - t.sx, r = e.clientY - t.sy;
|
|
3049
|
+
if (!t.moved && Math.hypot(n, r) < 4) return;
|
|
3050
|
+
t.moved = !0, B.value.scrollLeft = t.sl - n, B.value.scrollTop = t.st - r;
|
|
3051
|
+
return;
|
|
3052
|
+
}
|
|
3053
|
+
if (!t.active) {
|
|
3054
|
+
let n = Math.hypot(e.clientX - t.sx, e.clientY - t.sy);
|
|
3055
|
+
if (t.touch) {
|
|
3056
|
+
n > 8 && (K = null, bt());
|
|
3057
|
+
return;
|
|
3058
|
+
}
|
|
3059
|
+
if (n < 4 || (xt(), !t.active)) return;
|
|
3060
|
+
}
|
|
3061
|
+
Ct(e.clientX, e.clientY);
|
|
3062
|
+
}
|
|
3063
|
+
}
|
|
3064
|
+
function Ct(e, t) {
|
|
3065
|
+
let n = K;
|
|
3066
|
+
if (!n || n.kind !== "event" && n.kind !== "empty" || !n.active) return;
|
|
3067
|
+
let r = ht(e, t);
|
|
3068
|
+
if (n.kind === "empty") {
|
|
3069
|
+
let e = _t(!1), t = xe(n.t0, e), i = xe(Be(r.x), e), a = Math.max(e * 6e4, 9e5);
|
|
3070
|
+
dt.value = {
|
|
3071
|
+
resourceId: n.resourceId,
|
|
3072
|
+
start: Math.min(t, i),
|
|
3073
|
+
end: Math.max(Math.max(t, i), Math.min(t, i) + a)
|
|
3074
|
+
};
|
|
3075
|
+
return;
|
|
3076
|
+
}
|
|
3077
|
+
let i = g.value.find((e) => e.id === n.eventId);
|
|
3078
|
+
if (!i) return;
|
|
3079
|
+
let o = n.span, s = (e - n.sx + (B.value.scrollLeft - n.sl)) / U.value * E, c = _t(o.dateOnly), l = o.dateOnly ? E : c * 6e4, u;
|
|
3080
|
+
if (n.part === "body") {
|
|
3081
|
+
let e = xe(o.start + s, c), t = gt(r.y), n = t && !a.readonly ? t.id : i.resourceId;
|
|
3082
|
+
u = {
|
|
3083
|
+
...i,
|
|
3084
|
+
...Me({
|
|
3085
|
+
start: i.start,
|
|
3086
|
+
end: i.end
|
|
3087
|
+
}, e, e + (o.end - o.start)),
|
|
3088
|
+
resourceId: n
|
|
3089
|
+
};
|
|
3090
|
+
} else if (n.part === "start") {
|
|
3091
|
+
let e = Math.min(xe(o.start + s, c), o.end - l);
|
|
3092
|
+
u = {
|
|
3093
|
+
...i,
|
|
3094
|
+
...Me({
|
|
3095
|
+
start: i.start,
|
|
3096
|
+
end: i.end
|
|
3097
|
+
}, e, o.end)
|
|
3098
|
+
};
|
|
3099
|
+
} else {
|
|
3100
|
+
let e = Math.max(xe(o.end + s, c), o.start + l);
|
|
3101
|
+
u = {
|
|
3102
|
+
...i,
|
|
3103
|
+
...Me({
|
|
3104
|
+
start: i.start,
|
|
3105
|
+
end: i.end
|
|
3106
|
+
}, o.start, e)
|
|
3107
|
+
};
|
|
3108
|
+
}
|
|
3109
|
+
let d = g.value.map((e) => e.id === i.id ? u : e);
|
|
3110
|
+
_.value = d, ft.value = a.overlap === "prevent" && wt(u, d).length > 0;
|
|
3111
|
+
}
|
|
3112
|
+
function wt(e, t) {
|
|
3113
|
+
let n = /* @__PURE__ */ new Map(), r = t.filter((t) => t.resourceId === e.resourceId);
|
|
3114
|
+
for (let e of r) n.set(e.id, z({
|
|
3115
|
+
start: e.start,
|
|
3116
|
+
end: e.end
|
|
3117
|
+
}));
|
|
3118
|
+
r.sort((e, t) => n.get(e.id).start - n.get(t.id).start);
|
|
3119
|
+
let i = De(r, M.value.get(e.resourceId)?.capacity ?? 1, n).get(e.id);
|
|
3120
|
+
return i ? r.filter((e) => i.includes(e.id)) : [];
|
|
3121
|
+
}
|
|
3122
|
+
function Tt(e) {
|
|
3123
|
+
let t = K;
|
|
3124
|
+
if (!t || t.id !== e.pointerId || (K = null, bt(), kt(), t.kind === "split")) return;
|
|
3125
|
+
if (t.kind === "pan") {
|
|
3126
|
+
!t.moved && t.resourceId && o("slot-click", {
|
|
3127
|
+
resourceId: t.resourceId,
|
|
3128
|
+
start: j(xe(Be(ht(e.clientX, e.clientY).x), _t(!1)), !1)
|
|
3129
|
+
}), t.moved || P([]);
|
|
3130
|
+
return;
|
|
3131
|
+
}
|
|
3132
|
+
if (t.kind === "empty") {
|
|
3133
|
+
let e = dt.value;
|
|
3134
|
+
dt.value = null, t.active && e ? o("create", {
|
|
3135
|
+
resourceId: e.resourceId,
|
|
3136
|
+
start: j(e.start, !1),
|
|
3137
|
+
end: j(e.end, !1)
|
|
3138
|
+
}) : t.active || (o("slot-click", {
|
|
3139
|
+
resourceId: t.resourceId,
|
|
3140
|
+
start: j(xe(t.t0, _t(!1)), !1)
|
|
3141
|
+
}), P([]));
|
|
3142
|
+
return;
|
|
3143
|
+
}
|
|
3144
|
+
ut.value = null;
|
|
3145
|
+
let n = A.value.get(t.eventId);
|
|
3146
|
+
if (!t.active) {
|
|
3147
|
+
if (_.value = null, !n) return;
|
|
3148
|
+
n.selectable !== !1 && (e.shiftKey || e.ctrlKey || e.metaKey ? P(ye.value.has(n.id) ? N.value.filter((e) => e !== n.id) : [...N.value, n.id]) : P([n.id])), o("event-click", n, e);
|
|
3149
|
+
return;
|
|
3150
|
+
}
|
|
3151
|
+
let r = _.value;
|
|
3152
|
+
_.value = null;
|
|
3153
|
+
let i = r?.find((e) => e.id === t.eventId), s = g.value.find((e) => e.id === t.eventId);
|
|
3154
|
+
if (ft.value = !1, r && i && s && (i.start !== s.start || i.end !== s.end || i.resourceId !== s.resourceId)) {
|
|
3155
|
+
if (a.overlap === "prevent") {
|
|
3156
|
+
let e = wt(i, r);
|
|
3157
|
+
if (e.length) {
|
|
3158
|
+
o("conflict", {
|
|
3159
|
+
event: i,
|
|
3160
|
+
with: e
|
|
3161
|
+
}), Mt(c.timelineConflict);
|
|
3162
|
+
return;
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
he(r), o("change", {
|
|
3166
|
+
events: [i],
|
|
3167
|
+
kind: t.part === "body" ? "move" : "resize"
|
|
3168
|
+
}), Nt(i);
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
function Et(e) {
|
|
3172
|
+
K && K.id === e.pointerId && (K = null, bt(), kt(), _.value = null, ut.value = null, dt.value = null, ft.value = !1);
|
|
3173
|
+
}
|
|
3174
|
+
let Dt = 0;
|
|
3175
|
+
function Ot() {
|
|
3176
|
+
if (Dt) return;
|
|
3177
|
+
let e = () => {
|
|
3178
|
+
Dt = requestAnimationFrame(e);
|
|
3179
|
+
let t = B.value;
|
|
3180
|
+
if (!t || !K || !("active" in K) || !K.active) return;
|
|
3181
|
+
let n = t.getBoundingClientRect(), r = n.left + V.value, i = 0, a = 0;
|
|
3182
|
+
pt.x < r + 40 ? i = -Math.ceil((r + 40 - pt.x) / 4) : pt.x > n.right - 40 && (i = Math.ceil((pt.x - n.right + 40) / 4)), pt.y < n.top + ln + 40 ? a = -Math.ceil((n.top + ln + 40 - pt.y) / 4) : pt.y > n.bottom - 40 && (a = Math.ceil((pt.y - n.bottom + 40) / 4)), (i || a) && (t.scrollLeft += i, t.scrollTop += a, Ct(pt.x, pt.y));
|
|
3183
|
+
};
|
|
3184
|
+
Dt = requestAnimationFrame(e);
|
|
3185
|
+
}
|
|
3186
|
+
function kt() {
|
|
3187
|
+
cancelAnimationFrame(Dt), Dt = 0;
|
|
3188
|
+
}
|
|
3189
|
+
function At(e) {
|
|
3190
|
+
H.pinchMove(e) || K && "active" in K && K.active && e.cancelable && e.preventDefault();
|
|
3191
|
+
}
|
|
3192
|
+
let jt = x("");
|
|
3193
|
+
function Mt(e) {
|
|
3194
|
+
jt.value = "", ee(() => {
|
|
3195
|
+
jt.value = e;
|
|
3196
|
+
});
|
|
3197
|
+
}
|
|
3198
|
+
function Y(e) {
|
|
3199
|
+
let t = k(e), n = /^\d{4}-\d{2}-\d{2}$/.test(e);
|
|
3200
|
+
return new Intl.DateTimeFormat(u.value, n ? {
|
|
3201
|
+
day: "numeric",
|
|
3202
|
+
month: "short"
|
|
3203
|
+
} : {
|
|
3204
|
+
weekday: "short",
|
|
3205
|
+
hour: "numeric",
|
|
3206
|
+
minute: "2-digit"
|
|
3207
|
+
}).format(t);
|
|
3208
|
+
}
|
|
3209
|
+
function X(e) {
|
|
3210
|
+
let t = k(e.start), n = k(e.end);
|
|
3211
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(e.start)) return `${Y(e.start)} – ${Y(e.end)}`;
|
|
3212
|
+
let r = (e) => new Intl.DateTimeFormat(u.value, new Date(e).getMinutes() ? {
|
|
3213
|
+
hour: "numeric",
|
|
3214
|
+
minute: "2-digit"
|
|
3215
|
+
} : { hour: "numeric" }).format(e);
|
|
3216
|
+
return `${r(t)}–${r(n)}`;
|
|
3217
|
+
}
|
|
3218
|
+
function Nt(e) {
|
|
3219
|
+
Mt(c.timelineMoved.replace("{title}", e.title).replace("{resource}", M.value.get(e.resourceId)?.name ?? "").replace("{start}", Y(e.start)).replace("{end}", Y(e.end)));
|
|
3220
|
+
}
|
|
3221
|
+
function Pt(e) {
|
|
3222
|
+
he([...g.value, ...Array.isArray(e) ? e : [e]]);
|
|
3223
|
+
}
|
|
3224
|
+
function Ft(e, t) {
|
|
3225
|
+
he(g.value.map((n) => n.id === e ? typeof t == "function" ? t(n) : {
|
|
3226
|
+
...n,
|
|
3227
|
+
...t
|
|
3228
|
+
} : n));
|
|
3229
|
+
}
|
|
3230
|
+
async function It(e) {
|
|
3231
|
+
let t = g.value.filter((t) => e.includes(t.id) && t.deletable !== !1);
|
|
3232
|
+
if (!t.length || a.beforeDelete && !await a.beforeDelete(t)) return;
|
|
3233
|
+
let n = new Set(t.map((e) => e.id));
|
|
3234
|
+
he(g.value.filter((e) => !n.has(e.id))), P(N.value.filter((e) => !n.has(e))), o("delete", { events: t }), Mt(c.ganttDeleted.replace("{count}", String(t.length)));
|
|
3235
|
+
}
|
|
3236
|
+
function Lt() {
|
|
3237
|
+
return L.value.filter((e) => e.kind === "resource");
|
|
3238
|
+
}
|
|
3239
|
+
function Rt(e, t) {
|
|
3240
|
+
let n = e.ctrlKey || e.metaKey;
|
|
3241
|
+
if (n && e.key.toLowerCase() === "z") {
|
|
3242
|
+
e.preventDefault(), e.shiftKey ? D() : T();
|
|
3243
|
+
return;
|
|
3244
|
+
}
|
|
3245
|
+
if (n && e.key.toLowerCase() === "y") {
|
|
3246
|
+
e.preventDefault(), D();
|
|
3247
|
+
return;
|
|
3248
|
+
}
|
|
3249
|
+
if (e.key === "Enter") {
|
|
3250
|
+
e.preventDefault(), o("event-dblclick", t, e);
|
|
3251
|
+
return;
|
|
3252
|
+
}
|
|
3253
|
+
if (a.readonly) return;
|
|
3254
|
+
if (e.key === "Delete" || e.key === "Backspace") {
|
|
3255
|
+
e.preventDefault(), It(ye.value.has(t.id) ? N.value : [t.id]);
|
|
3256
|
+
return;
|
|
3257
|
+
}
|
|
3258
|
+
let r = F.value.get(t.id);
|
|
3259
|
+
if (!r) return;
|
|
3260
|
+
let i = r.dateOnly ? E : _t(!1) * 6e4, s = null;
|
|
3261
|
+
if ((e.key === "ArrowLeft" || e.key === "ArrowRight") && t.draggable !== !1) {
|
|
3262
|
+
let n = e.key === "ArrowLeft" ? -i : i;
|
|
3263
|
+
if (e.shiftKey) {
|
|
3264
|
+
if (t.resizable === !1) return;
|
|
3265
|
+
s = {
|
|
3266
|
+
...t,
|
|
3267
|
+
...Me({
|
|
3268
|
+
start: t.start,
|
|
3269
|
+
end: t.end
|
|
3270
|
+
}, r.start, Math.max(r.start + i, r.end + n))
|
|
3271
|
+
};
|
|
3272
|
+
} else s = {
|
|
3273
|
+
...t,
|
|
3274
|
+
...Me({
|
|
3275
|
+
start: t.start,
|
|
3276
|
+
end: t.end
|
|
3277
|
+
}, r.start + n, r.end + n)
|
|
3278
|
+
};
|
|
3279
|
+
} else if ((e.key === "ArrowUp" || e.key === "ArrowDown") && t.draggable !== !1) {
|
|
3280
|
+
let n = Lt(), r = n[n.findIndex((e) => e.resource.id === t.resourceId) + (e.key === "ArrowUp" ? -1 : 1)];
|
|
3281
|
+
r && (s = {
|
|
3282
|
+
...t,
|
|
3283
|
+
resourceId: r.resource.id
|
|
3284
|
+
});
|
|
3285
|
+
}
|
|
3286
|
+
if (!s) return;
|
|
3287
|
+
e.preventDefault();
|
|
3288
|
+
let l = g.value.map((e) => e.id === t.id ? s : e);
|
|
3289
|
+
if (a.overlap === "prevent" && wt(s, l).length) {
|
|
3290
|
+
o("conflict", {
|
|
3291
|
+
event: s,
|
|
3292
|
+
with: wt(s, l)
|
|
3293
|
+
}), Mt(c.timelineConflict);
|
|
3294
|
+
return;
|
|
3295
|
+
}
|
|
3296
|
+
he(l), o("change", {
|
|
3297
|
+
events: [s],
|
|
3298
|
+
kind: e.shiftKey ? "resize" : "move"
|
|
3299
|
+
}), Nt(s), ee(() => nt.get(t.id)?.querySelector("[data-timeline-event]")?.focus({ preventScroll: !0 }));
|
|
3300
|
+
}
|
|
3301
|
+
function zt(e) {
|
|
3302
|
+
let t = A.value.get(e);
|
|
3303
|
+
if (!t) return;
|
|
3304
|
+
let n = R(t.resourceId);
|
|
3305
|
+
n && Se.value.has(n) && we(n), ee(() => {
|
|
3306
|
+
let t = et.value.get(e), n = B.value;
|
|
3307
|
+
t && n && n.scrollTo({
|
|
3308
|
+
left: Math.max(0, t.x - 48),
|
|
3309
|
+
top: Math.max(0, t.y - 48),
|
|
3310
|
+
behavior: i() ? "auto" : "smooth"
|
|
3311
|
+
});
|
|
3312
|
+
});
|
|
3313
|
+
}
|
|
3314
|
+
function Vt(e) {
|
|
3315
|
+
(e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "z" && !e.target.closest?.("[data-timeline-event]") && (e.preventDefault(), e.shiftKey ? D() : T());
|
|
3316
|
+
}
|
|
3317
|
+
let dn = {
|
|
3318
|
+
primary: "bg-primary-container text-on-primary-container",
|
|
3319
|
+
secondary: "bg-secondary-container text-on-secondary-container",
|
|
3320
|
+
tertiary: "bg-tertiary-container text-on-tertiary-container",
|
|
3321
|
+
error: "bg-error-container text-on-error-container",
|
|
3322
|
+
success: "bg-success-container text-on-success-container",
|
|
3323
|
+
neutral: "bg-surface-container-highest text-on-surface"
|
|
3324
|
+
}, fn = {
|
|
3325
|
+
primary: "bg-primary",
|
|
3326
|
+
secondary: "bg-secondary",
|
|
3327
|
+
tertiary: "bg-tertiary",
|
|
3328
|
+
error: "bg-error",
|
|
3329
|
+
success: "bg-success",
|
|
3330
|
+
neutral: "bg-outline"
|
|
3331
|
+
}, pn = (e) => e.color ?? M.value.get(e.resourceId)?.color ?? "primary";
|
|
3332
|
+
function mn(e) {
|
|
3333
|
+
return e.split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0].toUpperCase()).join("");
|
|
3334
|
+
}
|
|
3335
|
+
let hn = l(() => {
|
|
3336
|
+
let e = /* @__PURE__ */ new Map();
|
|
3337
|
+
for (let t of ne.value) {
|
|
3338
|
+
let n = F.value.get(t.id);
|
|
3339
|
+
n && e.set(t.resourceId, (e.get(t.resourceId) ?? 0) + (n.end - n.start) / _e);
|
|
3340
|
+
}
|
|
3341
|
+
return e;
|
|
3342
|
+
}), gn = {
|
|
3343
|
+
events: l(() => ne.value),
|
|
3344
|
+
selection: l(() => N.value),
|
|
3345
|
+
conflicts: I,
|
|
3346
|
+
scale: H.scaleNow,
|
|
3347
|
+
pxPerDay: U,
|
|
3348
|
+
canUndo: ve,
|
|
3349
|
+
canRedo: O,
|
|
3350
|
+
undo: T,
|
|
3351
|
+
redo: D,
|
|
3352
|
+
zoomIn: He,
|
|
3353
|
+
zoomOut: Ue,
|
|
3354
|
+
setScale: We,
|
|
3355
|
+
scrollToDate: Ge,
|
|
3356
|
+
scrollToEvent: zt,
|
|
3357
|
+
setSelection: P,
|
|
3358
|
+
addEvents: Pt,
|
|
3359
|
+
updateEvent: Ft,
|
|
3360
|
+
removeEvents: It,
|
|
3361
|
+
dateAt: (e) => {
|
|
3362
|
+
let t = B.value?.getBoundingClientRect();
|
|
3363
|
+
return j(xe(Be(e - (t?.left ?? 0) - V.value + W.value.left), _t(!1)), !1);
|
|
3364
|
+
},
|
|
3365
|
+
resourceAt: (e) => {
|
|
3366
|
+
let t = B.value?.getBoundingClientRect();
|
|
3367
|
+
return gt(e - (t?.top ?? 0) - ln + W.value.top);
|
|
3368
|
+
}
|
|
3369
|
+
};
|
|
3370
|
+
return ae(Bt, gn), ae(ge, {
|
|
3371
|
+
scale: H.scaleNow,
|
|
3372
|
+
readonly: l(() => a.readonly),
|
|
3373
|
+
canUndo: ve,
|
|
3374
|
+
canRedo: O,
|
|
3375
|
+
foldable: l(() => a.resources.some((e) => e.group)),
|
|
3376
|
+
folded: l(() => be.value.length > 0),
|
|
3377
|
+
undo: T,
|
|
3378
|
+
redo: D,
|
|
3379
|
+
zoomIn: He,
|
|
3380
|
+
zoomOut: Ue,
|
|
3381
|
+
setScale: We,
|
|
3382
|
+
scrollToDate: Ge,
|
|
3383
|
+
expandAll: () => Ce([]),
|
|
3384
|
+
collapseAll: () => Ce([...new Set(a.resources.map((e) => e.group).filter((e) => !!e))])
|
|
3385
|
+
}), re(() => {
|
|
3386
|
+
let e = B.value;
|
|
3387
|
+
e.addEventListener("touchmove", At, { passive: !1 }), ee(() => {
|
|
3388
|
+
let t = a.start ? k(a.start) : Re.value ?? Pe.value.min;
|
|
3389
|
+
e.scrollLeft = Math.max(0, G(t) - Math.min(48, Fe.value / 4)), W.value.left = e.scrollLeft;
|
|
3390
|
+
});
|
|
3391
|
+
}), te(() => {
|
|
3392
|
+
B.value?.removeEventListener("touchmove", At), bt(), kt(), cancelAnimationFrame(rt);
|
|
3393
|
+
}), n(gn), (e, n) => (b(), f("div", {
|
|
3394
|
+
class: "m3-resource-timeline flex flex-col overflow-hidden rounded-md bg-surface text-on-surface",
|
|
3395
|
+
onKeydown: Vt
|
|
3396
|
+
}, [
|
|
3397
|
+
oe(e.$slots, "default", { timeline: gn }),
|
|
3398
|
+
p("div", {
|
|
3399
|
+
ref_key: "scroller",
|
|
3400
|
+
ref: B,
|
|
3401
|
+
class: "relative min-h-0 flex-1 touch-pan-x touch-pan-y overflow-auto overscroll-contain",
|
|
3402
|
+
onScrollPassive: n[2] ||= (...e) => w(H).readView && w(H).readView(...e),
|
|
3403
|
+
onTouchstartPassive: n[3] ||= (...e) => w(H).onTouchStart && w(H).onTouchStart(...e),
|
|
3404
|
+
onTouchendPassive: n[4] ||= (...e) => w(H).onTouchEnd && w(H).onTouchEnd(...e),
|
|
3405
|
+
onContextmenu: n[5] ||= (e) => w(K) && e.preventDefault()
|
|
3406
|
+
}, [p("div", {
|
|
3407
|
+
class: "relative",
|
|
3408
|
+
style: y({
|
|
3409
|
+
width: `${V.value + w(Ie)}px`,
|
|
3410
|
+
height: `${ln + Math.max(je.value, w(W).height - ln)}px`
|
|
3411
|
+
})
|
|
3412
|
+
}, [p("div", {
|
|
3413
|
+
class: "sticky top-0 z-20 flex",
|
|
3414
|
+
style: y({
|
|
3415
|
+
height: `${ln}px`,
|
|
3416
|
+
width: `${V.value + w(Ie)}px`
|
|
3417
|
+
})
|
|
3418
|
+
}, [V.value ? (b(), f("div", {
|
|
3419
|
+
key: 0,
|
|
3420
|
+
class: "sticky left-0 z-10 flex shrink-0 items-end border-r border-b border-outline-variant bg-surface-container-low px-4 pb-2 text-label-medium text-on-surface-variant",
|
|
3421
|
+
style: y({ width: `${V.value}px` })
|
|
3422
|
+
}, C(w(c).timelineResource), 5)) : d("", !0), h(ze, {
|
|
3423
|
+
width: w(Ie),
|
|
3424
|
+
"top-cells": w(Ke),
|
|
3425
|
+
"bottom-cells": w(qe),
|
|
3426
|
+
"today-x": w(Re) === null ? null : w(G)(w(Re))
|
|
3427
|
+
}, null, 8, [
|
|
3428
|
+
"width",
|
|
3429
|
+
"top-cells",
|
|
3430
|
+
"bottom-cells",
|
|
3431
|
+
"today-x"
|
|
3432
|
+
])], 4), p("div", {
|
|
3433
|
+
class: "flex",
|
|
3434
|
+
style: y({ height: `${Math.max(je.value, w(W).height - ln)}px` })
|
|
3435
|
+
}, [V.value ? (b(), f("div", {
|
|
3436
|
+
key: 0,
|
|
3437
|
+
class: "sticky left-0 z-10 shrink-0 border-r border-outline-variant bg-surface",
|
|
3438
|
+
style: y({ width: `${V.value}px` }),
|
|
3439
|
+
role: "list",
|
|
3440
|
+
"aria-label": t.label
|
|
3441
|
+
}, [(b(!0), f(s, null, S(Ye.value, (t) => (b(), f(s, { key: t.key }, [t.kind === "group" ? (b(), f("button", {
|
|
3442
|
+
key: 0,
|
|
3443
|
+
type: "button",
|
|
3444
|
+
class: "absolute inset-x-0 flex items-center gap-1 border-b border-outline-variant/60 bg-surface-container-low px-2 text-left text-title-small text-on-surface outline-none hover:bg-on-surface/8 focus-visible:ring-2 focus-visible:ring-secondary focus-visible:ring-inset",
|
|
3445
|
+
style: y({
|
|
3446
|
+
top: `${t.top}px`,
|
|
3447
|
+
height: `${t.height}px`
|
|
3448
|
+
}),
|
|
3449
|
+
"aria-expanded": !Se.value.has(t.group),
|
|
3450
|
+
onClick: (e) => we(t.group)
|
|
3451
|
+
}, [p("span", { class: v(["material-symbols-outlined text-[20px] text-on-surface-variant transition-transform duration-200", Se.value.has(t.group) ? "-rotate-90" : ""]) }, "expand_more", 2), oe(e.$slots, "group", {
|
|
3452
|
+
group: t.group,
|
|
3453
|
+
resources: t.resources,
|
|
3454
|
+
collapsed: Se.value.has(t.group)
|
|
3455
|
+
}, () => [p("span", Wt, C(t.group), 1), p("span", Gt, C(t.resources.length), 1)])], 12, Ut)) : (b(), f("div", {
|
|
3456
|
+
key: 1,
|
|
3457
|
+
role: "listitem",
|
|
3458
|
+
class: "absolute inset-x-0 flex items-center gap-3 border-b border-outline-variant/60 px-4",
|
|
3459
|
+
style: y({
|
|
3460
|
+
top: `${t.top}px`,
|
|
3461
|
+
height: `${t.height}px`
|
|
3462
|
+
})
|
|
3463
|
+
}, [oe(e.$slots, "resource", {
|
|
3464
|
+
resource: t.resource,
|
|
3465
|
+
events: Te.value.get(t.resource.id) ?? [],
|
|
3466
|
+
hours: Math.round((hn.value.get(t.resource.id) ?? 0) * 10) / 10
|
|
3467
|
+
}, () => [t.resource.avatar ? (b(), f("img", {
|
|
3468
|
+
key: 0,
|
|
3469
|
+
src: t.resource.avatar,
|
|
3470
|
+
alt: "",
|
|
3471
|
+
class: "size-9 shrink-0 rounded-full object-cover"
|
|
3472
|
+
}, null, 8, Kt)) : (b(), f("span", {
|
|
3473
|
+
key: 1,
|
|
3474
|
+
class: v(["flex size-9 shrink-0 items-center justify-center rounded-full text-label-large", dn[t.resource.color ?? "neutral"]])
|
|
3475
|
+
}, [t.resource.icon ? (b(), f("span", qt, C(t.resource.icon), 1)) : (b(), f(s, { key: 1 }, [m(C(mn(t.resource.name)), 1)], 64))], 2)), p("span", Jt, [p("span", Yt, C(t.resource.name), 1), t.resource.subtitle ? (b(), f("span", Xt, C(t.resource.subtitle), 1)) : d("", !0)])])], 4))], 64))), 128)), p("div", {
|
|
3476
|
+
role: "separator",
|
|
3477
|
+
"aria-orientation": "vertical",
|
|
3478
|
+
"aria-label": w(c).ganttResize,
|
|
3479
|
+
tabindex: "0",
|
|
3480
|
+
class: "absolute inset-y-0 -right-1 z-30 w-2 cursor-col-resize touch-none outline-none hover:bg-primary/20 focus-visible:bg-primary/30",
|
|
3481
|
+
onPointerdown: yt,
|
|
3482
|
+
onKeydown: [n[0] ||= pe(me((e) => {
|
|
3483
|
+
Ne.value = Math.max(120, Ne.value - 16), o("update:listWidth", Ne.value);
|
|
3484
|
+
}, ["prevent"]), ["left"]), n[1] ||= pe(me((e) => {
|
|
3485
|
+
Ne.value += 16, o("update:listWidth", Ne.value);
|
|
3486
|
+
}, ["prevent"]), ["right"])]
|
|
3487
|
+
}, null, 40, Zt)], 12, Ht)) : d("", !0), p("div", {
|
|
3488
|
+
class: "relative shrink-0",
|
|
3489
|
+
style: y({ width: `${w(Ie)}px` }),
|
|
3490
|
+
onPointerdown: q
|
|
3491
|
+
}, [
|
|
3492
|
+
h(Ve, {
|
|
3493
|
+
"off-times": w(Je),
|
|
3494
|
+
cells: w(qe),
|
|
3495
|
+
"today-x": w(Re) === null ? null : w(G)(w(Re))
|
|
3496
|
+
}, null, 8, [
|
|
3497
|
+
"off-times",
|
|
3498
|
+
"cells",
|
|
3499
|
+
"today-x"
|
|
3500
|
+
]),
|
|
3501
|
+
(b(!0), f(s, null, S(Ye.value, (e) => (b(), f("div", {
|
|
3502
|
+
key: `r${e.key}`,
|
|
3503
|
+
class: v(["pointer-events-none absolute inset-x-0 border-b border-outline-variant/60", e.kind === "group" ? "bg-surface-container-low/60" : ""]),
|
|
3504
|
+
style: y({
|
|
3505
|
+
top: `${e.top}px`,
|
|
3506
|
+
height: `${e.height}px`
|
|
3507
|
+
})
|
|
3508
|
+
}, null, 6))), 128)),
|
|
3509
|
+
dt.value && Ae.value.get(dt.value.resourceId) ? (b(), f("div", {
|
|
3510
|
+
key: 0,
|
|
3511
|
+
class: "pointer-events-none absolute rounded-sm border-2 border-dashed border-primary bg-primary/12",
|
|
3512
|
+
style: y({
|
|
3513
|
+
left: `${w(G)(dt.value.start)}px`,
|
|
3514
|
+
width: `${w(G)(dt.value.end) - w(G)(dt.value.start)}px`,
|
|
3515
|
+
top: `${Ae.value.get(dt.value.resourceId).top + 4}px`,
|
|
3516
|
+
height: `${Ae.value.get(dt.value.resourceId).height - 8}px`
|
|
3517
|
+
})
|
|
3518
|
+
}, null, 4)) : d("", !0),
|
|
3519
|
+
(b(!0), f(s, null, S(Qe.value, ({ event: n }) => (b(), f("div", {
|
|
3520
|
+
key: n.id,
|
|
3521
|
+
ref_for: !0,
|
|
3522
|
+
ref: (e) => ct(n.id, e),
|
|
3523
|
+
class: v(["absolute top-0 left-0", [n.class, ut.value?.id === n.id ? "z-10" : ""]]),
|
|
3524
|
+
style: y({ height: `${$e.value}px` })
|
|
3525
|
+
}, [p("div", {
|
|
3526
|
+
"data-timeline-event": "",
|
|
3527
|
+
role: "button",
|
|
3528
|
+
tabindex: "0",
|
|
3529
|
+
"aria-label": `${n.title}, ${M.value.get(n.resourceId)?.name ?? ""}, ${X(n)}`,
|
|
3530
|
+
"aria-pressed": ye.value.has(n.id),
|
|
3531
|
+
class: v(["group absolute inset-0 flex items-stretch overflow-hidden rounded-sm text-left outline-none select-none focus-visible:ring-2 focus-visible:ring-secondary focus-visible:ring-offset-1", [
|
|
3532
|
+
dn[pn(n)],
|
|
3533
|
+
ye.value.has(n.id) ? "ring-2 ring-on-surface ring-offset-1 ring-offset-surface" : "",
|
|
3534
|
+
I.value.has(n.id) || ut.value?.id === n.id && ft.value ? "outline-2 outline-offset-1 outline-error" : "",
|
|
3535
|
+
ut.value?.id === n.id ? "shadow-elevation-3" : "hover:shadow-elevation-1",
|
|
3536
|
+
t.readonly || n.draggable === !1 ? "" : "cursor-grab active:cursor-grabbing"
|
|
3537
|
+
]]),
|
|
3538
|
+
onPointerdown: (e) => vt(e, n, "body"),
|
|
3539
|
+
onDblclick: (e) => o("event-dblclick", n, e),
|
|
3540
|
+
onContextmenu: (e) => o("event-contextmenu", n, e),
|
|
3541
|
+
onKeydown: (e) => Rt(e, n)
|
|
3542
|
+
}, [p("span", { class: v(["w-1 shrink-0", fn[pn(n)]]) }, null, 2), p("span", $t, [oe(e.$slots, "event", {
|
|
3543
|
+
event: n,
|
|
3544
|
+
resource: M.value.get(n.resourceId),
|
|
3545
|
+
selected: ye.value.has(n.id),
|
|
3546
|
+
conflict: I.value.has(n.id)
|
|
3547
|
+
}, () => [p("span", en, [p("span", tn, C(n.title), 1), $e.value >= 30 ? (b(), f("span", nn, C(n.subtitle ?? X(n)), 1)) : d("", !0)]), I.value.has(n.id) && (et.value.get(n.id)?.w ?? 0) > 72 ? (b(), f("span", {
|
|
3548
|
+
key: 0,
|
|
3549
|
+
class: "material-symbols-outlined shrink-0 text-[18px] text-error",
|
|
3550
|
+
title: w(c).timelineConflict
|
|
3551
|
+
}, "warning", 8, rn)) : d("", !0)])])], 42, Qt), !t.readonly && n.resizable !== !1 ? (b(), f(s, { key: 0 }, S(["start", "end"], (e) => p("span", {
|
|
3552
|
+
key: e,
|
|
3553
|
+
"data-timeline-resize": e,
|
|
3554
|
+
class: v(["absolute inset-y-0 z-[1] flex w-3 cursor-ew-resize items-center justify-center pointer-coarse:w-7", e === "start" ? "-left-1 pointer-coarse:-left-3.5" : "-right-1 pointer-coarse:-right-3.5"]),
|
|
3555
|
+
onPointerdown: (t) => vt(t, n, e)
|
|
3556
|
+
}, [p("span", { class: v(["hidden h-3/5 w-1 rounded-full bg-on-surface pointer-coarse:block", ye.value.has(n.id) ? "opacity-100" : "opacity-0"]) }, null, 2)], 42, an)), 64)) : d("", !0)], 6))), 128)),
|
|
3557
|
+
t.resources.length ? d("", !0) : (b(), f("div", {
|
|
3558
|
+
key: 1,
|
|
3559
|
+
class: "absolute flex items-center justify-center p-6",
|
|
3560
|
+
style: y({
|
|
3561
|
+
left: `${w(W).left}px`,
|
|
3562
|
+
width: `${w(Fe)}px`,
|
|
3563
|
+
top: 0,
|
|
3564
|
+
height: `${Math.max(120, w(W).height - ln)}px`
|
|
3565
|
+
})
|
|
3566
|
+
}, [oe(e.$slots, "empty", {}, () => [p("span", on, C(w(c).timelineEmpty), 1)])], 4))
|
|
3567
|
+
], 36)], 4)], 4)], 544),
|
|
3568
|
+
p("div", sn, C(jt.value), 1)
|
|
3569
|
+
], 32));
|
|
3570
|
+
}
|
|
3571
|
+
});
|
|
3572
|
+
//#endregion
|
|
3573
|
+
export { vt as MGantt, J as MGanttControls, dn as MResourceTimeline, H as addWorkingDays, Ie as criticalPath, Ot as parseGanttCsv, At as parseGanttJson, zt as parseMsProjectXml, Ne as rollupSummaries, Fe as scheduleTasks, z as taskSpan, wt as toGanttCsv, kt as toGanttJson, Rt as toMsProjectXml, T as useGantt, Vt as useResourceTimeline, Pe as workingDays };
|
|
3574
|
+
|
|
3575
|
+
//# sourceMappingURL=gantt.js.map
|