vue-ganttastic-custom
Version:
A simple and customizable Gantt chart component for Vue.js
1,479 lines • 54.1 kB
JavaScript
import A from "dayjs";
import { inject as lt, computed as I, defineComponent as K, openBlock as O, createElementBlock as D, Fragment as Q, renderList as X, unref as E, normalizeStyle as $, renderSlot as Y, createElementVNode as L, toDisplayString as P, createTextVNode as ut, createCommentVNode as j, toRefs as nt, ref as G, watch as ct, nextTick as St, createBlock as et, Teleport as te, createVNode as Bt, Transition as ee, withCtx as q, getCurrentScope as ne, onScopeDispose as re, getCurrentInstance as ae, onMounted as Lt, useSlots as oe, provide as st, normalizeClass as bt, withModifiers as ie, mergeProps as se, TransitionGroup as le } from "vue";
var J = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Yt = { exports: {} };
(function(t, u) {
(function(e, n) {
t.exports = n();
})(J, function() {
var e = "day";
return function(n, v, c) {
var d = function(r) {
return r.add(4 - r.isoWeekday(), e);
}, a = v.prototype;
a.isoWeekYear = function() {
return d(this).year();
}, a.isoWeek = function(r) {
if (!this.$utils().u(r))
return this.add(7 * (r - this.isoWeek()), e);
var i, s, g, h, w = d(this), m = (i = this.isoWeekYear(), s = this.$u, g = (s ? c.utc : c)().year(i).startOf("year"), h = 4 - g.isoWeekday(), g.isoWeekday() > 4 && (h += 7), g.add(h, e));
return w.diff(m, "week") + 1;
}, a.isoWeekday = function(r) {
return this.$utils().u(r) ? this.day() || 7 : this.day(this.day() % 7 ? r : r - 7);
};
var o = a.startOf;
a.startOf = function(r, i) {
var s = this.$utils(), g = !!s.u(i) || i;
return s.p(r) === "isoweek" ? g ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : o.bind(this)(r, i);
};
};
});
})(Yt);
const ue = Yt.exports;
var Gt = { exports: {} };
(function(t, u) {
(function(e, n) {
t.exports = n();
})(J, function() {
return function(e, n) {
n.prototype.isSameOrBefore = function(v, c) {
return this.isSame(v, c) || this.isBefore(v, c);
};
};
});
})(Gt);
const ce = Gt.exports;
var Rt = { exports: {} };
(function(t, u) {
(function(e, n) {
t.exports = n();
})(J, function() {
return function(e, n) {
n.prototype.isSameOrAfter = function(v, c) {
return this.isSame(v, c) || this.isAfter(v, c);
};
};
});
})(Rt);
const de = Rt.exports;
var It = { exports: {} };
(function(t, u) {
(function(e, n) {
t.exports = n();
})(J, function() {
return function(e, n, v) {
n.prototype.isBetween = function(c, d, a, o) {
var r = v(c), i = v(d), s = (o = o || "()")[0] === "(", g = o[1] === ")";
return (s ? this.isAfter(r, a) : !this.isBefore(r, a)) && (g ? this.isBefore(i, a) : !this.isAfter(i, a)) || (s ? this.isBefore(r, a) : !this.isAfter(r, a)) && (g ? this.isAfter(i, a) : !this.isBefore(i, a));
};
};
});
})(It);
const fe = It.exports;
var Ht = { exports: {} };
(function(t, u) {
(function(e, n) {
t.exports = n();
})(J, function() {
var e = "week", n = "year";
return function(v, c, d) {
var a = c.prototype;
a.week = function(o) {
if (o === void 0 && (o = null), o !== null)
return this.add(7 * (o - this.week()), "day");
var r = this.$locale().yearStart || 1;
if (this.month() === 11 && this.date() > 25) {
var i = d(this).startOf(n).add(1, n).date(r), s = d(this).endOf(e);
if (i.isBefore(s))
return 1;
}
var g = d(this).startOf(n).date(r).startOf(e).subtract(1, "millisecond"), h = this.diff(g, e, !0);
return h < 0 ? d(this).startOf("week").week() : Math.ceil(h);
}, a.weeks = function(o) {
return o === void 0 && (o = null), this.week(o);
};
};
});
})(Ht);
const ge = Ht.exports;
var At = { exports: {} };
(function(t, u) {
(function(e, n) {
t.exports = n();
})(J, function() {
return function(e, n, v) {
var c = n.prototype, d = c.format;
v.en.ordinal = function(a) {
var o = ["th", "st", "nd", "rd"], r = a % 100;
return "[" + a + (o[(r - 20) % 10] || o[r] || o[0]) + "]";
}, c.format = function(a) {
var o = this, r = this.$locale();
if (!this.isValid())
return d.bind(this)(a);
var i = this.$utils(), s = (a || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function(g) {
switch (g) {
case "Q":
return Math.ceil((o.$M + 1) / 3);
case "Do":
return r.ordinal(o.$D);
case "gggg":
return o.weekYear();
case "GGGG":
return o.isoWeekYear();
case "wo":
return r.ordinal(o.week(), "W");
case "w":
case "ww":
return i.s(o.week(), g === "w" ? 1 : 2, "0");
case "W":
case "WW":
return i.s(o.isoWeek(), g === "W" ? 1 : 2, "0");
case "k":
case "kk":
return i.s(String(o.$H === 0 ? 24 : o.$H), g === "k" ? 1 : 2, "0");
case "X":
return Math.floor(o.$d.getTime() / 1e3);
case "x":
return o.$d.getTime();
case "z":
return "[" + o.offsetName() + "]";
case "zzz":
return "[" + o.offsetName("long") + "]";
default:
return g;
}
});
return d.bind(this)(s);
};
};
});
})(At);
const he = At.exports;
var Wt = { exports: {} };
(function(t, u) {
(function(e, n) {
t.exports = n();
})(J, function() {
var e = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, n = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, v = /\d\d/, c = /\d\d?/, d = /\d*[^-_:/,()\s\d]+/, a = {}, o = function(m) {
return (m = +m) + (m > 68 ? 1900 : 2e3);
}, r = function(m) {
return function(p) {
this[m] = +p;
};
}, i = [/[+-]\d\d:?(\d\d)?|Z/, function(m) {
(this.zone || (this.zone = {})).offset = function(p) {
if (!p || p === "Z")
return 0;
var B = p.match(/([+-]|\d\d)/g), k = 60 * B[1] + (+B[2] || 0);
return k === 0 ? 0 : B[0] === "+" ? -k : k;
}(m);
}], s = function(m) {
var p = a[m];
return p && (p.indexOf ? p : p.s.concat(p.f));
}, g = function(m, p) {
var B, k = a.meridiem;
if (k) {
for (var f = 1; f <= 24; f += 1)
if (m.indexOf(k(f, 0, p)) > -1) {
B = f > 12;
break;
}
} else
B = m === (p ? "pm" : "PM");
return B;
}, h = { A: [d, function(m) {
this.afternoon = g(m, !1);
}], a: [d, function(m) {
this.afternoon = g(m, !0);
}], S: [/\d/, function(m) {
this.milliseconds = 100 * +m;
}], SS: [v, function(m) {
this.milliseconds = 10 * +m;
}], SSS: [/\d{3}/, function(m) {
this.milliseconds = +m;
}], s: [c, r("seconds")], ss: [c, r("seconds")], m: [c, r("minutes")], mm: [c, r("minutes")], H: [c, r("hours")], h: [c, r("hours")], HH: [c, r("hours")], hh: [c, r("hours")], D: [c, r("day")], DD: [v, r("day")], Do: [d, function(m) {
var p = a.ordinal, B = m.match(/\d+/);
if (this.day = B[0], p)
for (var k = 1; k <= 31; k += 1)
p(k).replace(/\[|\]/g, "") === m && (this.day = k);
}], M: [c, r("month")], MM: [v, r("month")], MMM: [d, function(m) {
var p = s("months"), B = (s("monthsShort") || p.map(function(k) {
return k.slice(0, 3);
})).indexOf(m) + 1;
if (B < 1)
throw new Error();
this.month = B % 12 || B;
}], MMMM: [d, function(m) {
var p = s("months").indexOf(m) + 1;
if (p < 1)
throw new Error();
this.month = p % 12 || p;
}], Y: [/[+-]?\d+/, r("year")], YY: [v, function(m) {
this.year = o(m);
}], YYYY: [/\d{4}/, r("year")], Z: i, ZZ: i };
function w(m) {
var p, B;
p = m, B = a && a.formats;
for (var k = (m = p.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(C, T, M) {
var S = M && M.toUpperCase();
return T || B[M] || e[M] || B[S].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(R, W, U) {
return W || U.slice(1);
});
})).match(n), f = k.length, x = 0; x < f; x += 1) {
var l = k[x], b = h[l], y = b && b[0], _ = b && b[1];
k[x] = _ ? { regex: y, parser: _ } : l.replace(/^\[|\]$/g, "");
}
return function(C) {
for (var T = {}, M = 0, S = 0; M < f; M += 1) {
var R = k[M];
if (typeof R == "string")
S += R.length;
else {
var W = R.regex, U = R.parser, N = C.slice(S), V = W.exec(N)[0];
U.call(T, V), C = C.replace(V, "");
}
}
return function(F) {
var z = F.afternoon;
if (z !== void 0) {
var tt = F.hours;
z ? tt < 12 && (F.hours += 12) : tt === 12 && (F.hours = 0), delete F.afternoon;
}
}(T), T;
};
}
return function(m, p, B) {
B.p.customParseFormat = !0, m && m.parseTwoDigitYear && (o = m.parseTwoDigitYear);
var k = p.prototype, f = k.parse;
k.parse = function(x) {
var l = x.date, b = x.utc, y = x.args;
this.$u = b;
var _ = y[1];
if (typeof _ == "string") {
var C = y[2] === !0, T = y[3] === !0, M = C || T, S = y[2];
T && (S = y[2]), a = this.$locale(), !C && S && (a = B.Ls[S]), this.$d = function(N, V, F) {
try {
if (["x", "X"].indexOf(V) > -1)
return new Date((V === "X" ? 1e3 : 1) * N);
var z = w(V)(N), tt = z.year, ot = z.month, Qt = z.day, Xt = z.hours, Kt = z.minutes, Zt = z.seconds, Jt = z.milliseconds, kt = z.zone, ft = new Date(), gt = Qt || (tt || ot ? 1 : ft.getDate()), ht = tt || ft.getFullYear(), it = 0;
tt && !ot || (it = ot > 0 ? ot - 1 : ft.getMonth());
var mt = Xt || 0, pt = Kt || 0, vt = Zt || 0, yt = Jt || 0;
return kt ? new Date(Date.UTC(ht, it, gt, mt, pt, vt, yt + 60 * kt.offset * 1e3)) : F ? new Date(Date.UTC(ht, it, gt, mt, pt, vt, yt)) : new Date(ht, it, gt, mt, pt, vt, yt);
} catch {
return new Date("");
}
}(l, _, b), this.init(), S && S !== !0 && (this.$L = this.locale(S).$L), M && l != this.format(_) && (this.$d = new Date("")), a = {};
} else if (_ instanceof Array)
for (var R = _.length, W = 1; W <= R; W += 1) {
y[1] = _[W - 1];
var U = B.apply(this, y);
if (U.isValid()) {
this.$d = U.$d, this.$L = U.$L, this.init();
break;
}
W === R && (this.$d = new Date(""));
}
else
f.call(this, x);
};
};
});
})(Wt);
const me = Wt.exports, Ft = Symbol("CHART_ROWS_KEY"), zt = Symbol("CONFIG_KEY"), Pt = Symbol("EMIT_BAR_EVENT_KEY"), jt = Symbol("BAR_CONTAINER_KEY");
function H() {
const t = lt(zt);
if (!t)
throw Error("Failed to inject config!");
return t;
}
const Ut = "YYYY-MM-DD HH:mm:ss";
function rt(t = H()) {
const { chartStart: u, chartEnd: e, barStart: n, barEnd: v, dateFormat: c } = t, d = I(() => o(u.value)), a = I(() => o(e.value)), o = (i, s) => {
let g;
if (s !== void 0 && typeof i != "string" && !(i instanceof Date) && (g = s === "start" ? i[n.value] : i[v.value]), typeof i == "string")
g = i;
else if (i instanceof Date)
return A(i);
const h = c.value || Ut;
return A(g, h, !0);
};
return {
chartStartDayjs: d,
chartEndDayjs: a,
toDayjs: o,
format: (i, s) => s === !1 ? i instanceof Date ? i : A(i).toDate() : (typeof i == "string" || i instanceof Date ? o(i) : i).format(s)
};
}
function Nt() {
const { precision: t } = H(), { chartStartDayjs: u, chartEndDayjs: e } = rt(), n = I(() => {
switch (t == null ? void 0 : t.value) {
case "hour":
return "day";
case "day":
return "month";
case "date":
case "week":
return "month";
case "month":
return "year";
default:
throw new Error(
"Precision prop incorrect. Must be one of the following: 'hour', 'day', 'date', 'week', 'month'"
);
}
}), v = I(() => {
switch (t.value) {
case "date":
return "day";
case "week":
return "isoWeek";
default:
return t.value;
}
}), c = {
hour: "HH",
date: "DD.MMM",
day: "DD.MMM",
week: "WW",
month: "MMMM YYYY",
year: "YYYY"
};
return {
timeaxisUnits: I(() => {
const a = [], o = [], r = e.value.diff(u.value, "minutes", !0), i = n.value, s = v.value;
let g = u.value, h = u.value;
for (; h.isSameOrBefore(e.value); ) {
const w = h.endOf(s), p = w.isAfter(e.value) ? e.value.diff(h, "minutes", !0) / r * 100 : w.diff(h, "minutes", !0) / r * 100;
o.push({
label: h.format(c[t == null ? void 0 : t.value]),
value: String(h),
date: h.toDate(),
width: String(p) + "%"
}), h = w.add(1, s === "isoWeek" ? "week" : s).startOf(s);
}
for (; g.isSameOrBefore(e.value); ) {
const w = g.endOf(i), p = w.isAfter(e.value) ? e.value.diff(g, "minutes", !0) / r * 100 : w.diff(g, "minutes", !0) / r * 100;
a.push({
label: g.format(c[i]),
value: String(g),
date: g.toDate(),
width: String(p) + "%"
}), g = w.add(1, i).startOf(i);
}
return { upperUnits: a, lowerUnits: o };
})
};
}
const pe = { class: "g-grid-container" }, ve = /* @__PURE__ */ K({
__name: "GGanttGrid",
props: {
highlightedUnits: {}
},
setup(t) {
const { colors: u } = H(), { timeaxisUnits: e } = Nt();
return (n, v) => (O(), D("div", pe, [
(O(!0), D(Q, null, X(E(e).lowerUnits, ({ label: c, value: d, width: a }) => {
var o;
return O(), D("div", {
key: c,
class: "g-grid-line",
style: $({
width: a,
background: (o = n.highlightedUnits) != null && o.includes(Number(d)) ? E(u).hoverHighlight : void 0
})
}, null, 4);
}), 128))
]));
}
});
function _t() {
const t = lt(Ft);
if (!t)
throw Error("Failed to inject getChartRows!");
return t;
}
const ye = { class: "g-label-column-rows" }, be = /* @__PURE__ */ K({
__name: "GGanttLabelColumn",
setup(t) {
const { font: u, colors: e, labelColumnTitle: n, rowHeight: v } = H(), c = _t();
return (d, a) => (O(), D("div", {
class: "g-label-column",
style: $({ fontFamily: E(u), color: E(e).text })
}, [
Y(d.$slots, "label-column-title", {}, () => [
L("div", {
class: "g-label-column-header",
style: $({ background: E(e).primary })
}, P(E(n)), 5)
]),
L("div", ye, [
(O(!0), D(Q, null, X(E(c)(), ({ label: o }, r) => (O(), D("div", {
key: `${o}_${r}`,
class: "g-label-column-row",
style: $({
background: r % 2 === 0 ? E(e).ternary : E(e).quartenary,
height: `${E(v)}px`
})
}, [
Y(d.$slots, "label-column-row", { label: o }, () => [
L("span", null, P(o), 1)
])
], 4))), 128))
])
], 4));
}
});
const we = { class: "g-timeaxis" }, xe = { class: "g-timeunits-container" }, Be = { class: "g-timeunits-container" }, _e = { key: 0 }, ke = { key: 1 }, Ce = {
key: 2,
style: { width: "100%", position: "relative", display: "flex" }
}, Ee = /* @__PURE__ */ K({
__name: "GGanttTimeaxis",
props: {
isActiveInSeconds: { type: Boolean }
},
setup(t) {
const { precision: u, colors: e } = H(), { timeaxisUnits: n } = Nt();
return (v, c) => (O(), D("div", we, [
L("div", xe, [
(O(!0), D(Q, null, X(E(n).upperUnits, ({ label: d, value: a, date: o, width: r }, i) => (O(), D("div", {
key: d,
class: "g-upper-timeunit",
style: $({
background: i % 2 === 0 ? E(e).primary : E(e).secondary,
color: E(e).text,
width: r
})
}, [
Y(v.$slots, "upper-timeunit", {
label: d,
value: a,
date: o
}, () => [
ut(P(d), 1)
])
], 4))), 128))
]),
L("div", Be, [
(O(!0), D(Q, null, X(E(n).lowerUnits, ({ label: d, value: a, date: o, width: r }, i) => (O(), D("div", {
key: d,
class: "g-timeunit",
style: $({
background: i % 2 === 0 ? E(e).ternary : E(e).quartenary,
color: E(e).text,
flexDirection: E(u) === "hour" ? "column" : "row",
alignItems: E(u) === "hour" ? "" : "center",
width: r
})
}, [
Y(v.$slots, "timeunit", {
label: d,
value: a,
date: o
}, () => [
v.isActiveInSeconds ? (O(), D("strong", _e, P(d), 1)) : (O(), D("span", ke, P(d), 1)),
v.isActiveInSeconds ? (O(), D("div", Ce, [
(O(), D(Q, null, X(60, (s) => L("div", {
key: s,
class: "g-timeaxis-hour-pin",
style: $({
background: E(e).text,
position: "absolute",
top: 0,
left: `${(s - 1) * (100 / 60)}%`
})
}, null, 4)), 64)),
(O(), D(Q, null, X(60, (s) => L("span", {
key: `label-${s}`,
style: $({
position: "absolute",
top: "-20px",
left: `${(s - 1) * (100 / 60)}%`,
textAlign: "center",
color: E(e).text,
fontSize: "7px"
})
}, P(s === 1 ? "" : (s - 1) * 1), 5)), 64)),
(O(), D(Q, null, X(3600, (s) => L("div", {
key: s,
class: "g-timeaxis-second-pin",
style: $({
left: `${(s - 1) * (100 / 3600)}%`
})
}, [
(s - 1) % 15 === 0 ? (O(), D("span", {
key: 0,
style: $({
left: `${(s - 1) * (100 / 3600)}%`
})
}, P((s - 1) % 60 === 0 ? "" : (s - 1) % 60), 5)) : j("", !0)
], 4)), 64))
])) : j("", !0)
]),
E(u) === "hour" ? (O(), D("div", {
key: 0,
class: "g-timeaxis-hour-pin",
style: $({ background: E(e).text })
}, null, 4)) : j("", !0)
], 4))), 128))
])
]));
}
});
const Oe = "cadetblue", De = /* @__PURE__ */ K({
__name: "GGanttBarTooltip",
props: {
bar: {},
modelValue: { type: Boolean }
},
setup(t) {
const u = t, e = {
hour: "HH:mm:ss.SSS",
day: "DD. MMM HH:mm:ss.SSS",
date: "DD. MMMM YYYY",
month: "DD. MMMM YYYY",
week: "DD. MMMM YYYY (WW)"
}, { bar: n } = nt(u), { precision: v, font: c, barStart: d, barEnd: a, rowHeight: o } = H(), r = G("0px"), i = G("0px");
ct(
() => u.bar,
async () => {
var l;
await St();
const p = ((l = n == null ? void 0 : n.value) == null ? void 0 : l.ganttBarConfig.id) || "";
if (!p)
return;
const B = document.getElementById(p), { top: k, left: f } = (B == null ? void 0 : B.getBoundingClientRect()) || {
top: 0,
left: 0
}, x = Math.max(f, 10);
r.value = `${k + o.value - 10}px`, i.value = `${x}px`;
},
{ deep: !0, immediate: !0 }
);
const s = I(() => {
var p, B;
return ((B = (p = n == null ? void 0 : n.value) == null ? void 0 : p.ganttBarConfig.style) == null ? void 0 : B.background) || Oe;
}), { toDayjs: g } = rt(), h = I(() => {
var p;
return (p = n.value) == null ? void 0 : p[d.value];
}), w = I(() => {
var p;
return (p = n.value) == null ? void 0 : p[a.value];
}), m = I(() => {
if (!(n != null && n.value))
return "";
const p = e[v.value], B = g(h.value).format(p), k = g(w.value).format(p);
return `${B} \u2013 ${k}`;
});
return (p, B) => (O(), et(te, { to: "body" }, [
Bt(ee, {
name: "g-fade",
mode: "out-in"
}, {
default: q(() => [
p.modelValue ? (O(), D("div", {
key: 0,
class: "g-gantt-tooltip",
style: $({
top: r.value,
left: i.value,
fontFamily: E(c)
})
}, [
L("div", {
class: "g-gantt-tooltip-color-dot",
style: $({ background: s.value })
}, null, 4),
Y(p.$slots, "default", {
bar: E(n),
barStart: h.value,
barEnd: w.value
}, () => [
ut(P(m.value), 1)
])
], 4)) : j("", !0)
]),
_: 3
})
]));
}
});
function dt(t = H()) {
const { dateFormat: u, chartSize: e } = t, { chartStartDayjs: n, chartEndDayjs: v, toDayjs: c, format: d } = rt(t), a = I(() => v.value.diff(n.value, "minutes"));
return {
mapTimeToPosition: (i) => {
const s = e.width.value || 0, g = c(i).diff(n.value, "minutes", !0);
return Math.ceil(g / a.value * s);
},
mapPositionToTime: (i) => {
const s = e.width.value || 0, g = i / s * a.value;
return d(n.value.add(g, "minutes"), u.value);
}
};
}
const Te = /* @__PURE__ */ K({
__name: "GGanttCurrentTime",
setup(t) {
const { mapTimeToPosition: u } = dt(), e = G(A()), { colors: n, dateFormat: v, currentTimeLabel: c } = H(), d = I(() => {
const a = v.value || "YYYY-MM-DD HH:mm";
return u(A(e.value, a).format(a));
});
return (a, o) => (O(), D("div", {
class: "g-grid-current-time",
style: $({
left: `${d.value}px`
})
}, [
L("div", {
class: "g-grid-current-time-marker",
style: $({
border: `1px dashed ${E(n).markerCurrentTime}`
})
}, null, 4),
L("span", {
class: "g-grid-current-time-text",
style: $({ color: E(n).markerCurrentTime })
}, [
Y(a.$slots, "current-time-label", {}, () => [
ut(P(E(c)), 1)
])
], 4)
], 4));
}
});
var Ct;
const at = typeof window < "u";
at && ((Ct = window == null ? void 0 : window.navigator) == null ? void 0 : Ct.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function Me(t) {
return typeof t == "function" ? t() : E(t);
}
function $e(t) {
return t;
}
function Se(t) {
return ne() ? (re(t), !0) : !1;
}
function Le(t, u = !0) {
ae() ? Lt(t) : u ? t() : St(t);
}
function Vt(t) {
var u;
const e = Me(t);
return (u = e == null ? void 0 : e.$el) != null ? u : e;
}
const Ye = at ? window : void 0;
at && window.document;
at && window.navigator;
at && window.location;
function Ge(t, u = !1) {
const e = G(), n = () => e.value = Boolean(t());
return n(), Le(n, u), e;
}
const wt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, xt = "__vueuse_ssr_handlers__";
wt[xt] = wt[xt] || {};
wt[xt];
var Et = Object.getOwnPropertySymbols, Re = Object.prototype.hasOwnProperty, Ie = Object.prototype.propertyIsEnumerable, He = (t, u) => {
var e = {};
for (var n in t)
Re.call(t, n) && u.indexOf(n) < 0 && (e[n] = t[n]);
if (t != null && Et)
for (var n of Et(t))
u.indexOf(n) < 0 && Ie.call(t, n) && (e[n] = t[n]);
return e;
};
function Ae(t, u, e = {}) {
const n = e, { window: v = Ye } = n, c = He(n, ["window"]);
let d;
const a = Ge(() => v && "ResizeObserver" in v), o = () => {
d && (d.disconnect(), d = void 0);
}, r = ct(() => Vt(t), (s) => {
o(), a.value && v && s && (d = new ResizeObserver(u), d.observe(s, c));
}, { immediate: !0, flush: "post" }), i = () => {
o(), r();
};
return Se(i), {
isSupported: a,
stop: i
};
}
function We(t, u = { width: 0, height: 0 }, e = {}) {
const n = G(u.width), v = G(u.height);
return Ae(t, ([c]) => {
n.value = c.contentRect.width, v.value = c.contentRect.height;
}, e), ct(() => Vt(t), (c) => {
n.value = c ? u.width : 0, v.value = c ? u.height : 0;
}), {
width: n,
height: v
};
}
var Ot;
(function(t) {
t.UP = "UP", t.RIGHT = "RIGHT", t.DOWN = "DOWN", t.LEFT = "LEFT", t.NONE = "NONE";
})(Ot || (Ot = {}));
var Fe = Object.defineProperty, Dt = Object.getOwnPropertySymbols, ze = Object.prototype.hasOwnProperty, Pe = Object.prototype.propertyIsEnumerable, Tt = (t, u, e) => u in t ? Fe(t, u, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[u] = e, je = (t, u) => {
for (var e in u || (u = {}))
ze.call(u, e) && Tt(t, e, u[e]);
if (Dt)
for (var e of Dt(u))
Pe.call(u, e) && Tt(t, e, u[e]);
return t;
};
const Ue = {
easeInSine: [0.12, 0, 0.39, 0],
easeOutSine: [0.61, 1, 0.88, 1],
easeInOutSine: [0.37, 0, 0.63, 1],
easeInQuad: [0.11, 0, 0.5, 0],
easeOutQuad: [0.5, 1, 0.89, 1],
easeInOutQuad: [0.45, 0, 0.55, 1],
easeInCubic: [0.32, 0, 0.67, 0],
easeOutCubic: [0.33, 1, 0.68, 1],
easeInOutCubic: [0.65, 0, 0.35, 1],
easeInQuart: [0.5, 0, 0.75, 0],
easeOutQuart: [0.25, 1, 0.5, 1],
easeInOutQuart: [0.76, 0, 0.24, 1],
easeInQuint: [0.64, 0, 0.78, 0],
easeOutQuint: [0.22, 1, 0.36, 1],
easeInOutQuint: [0.83, 0, 0.17, 1],
easeInExpo: [0.7, 0, 0.84, 0],
easeOutExpo: [0.16, 1, 0.3, 1],
easeInOutExpo: [0.87, 0, 0.13, 1],
easeInCirc: [0.55, 0, 1, 0.45],
easeOutCirc: [0, 0.55, 0.45, 1],
easeInOutCirc: [0.85, 0, 0.15, 1],
easeInBack: [0.36, 0, 0.66, -0.56],
easeOutBack: [0.34, 1.56, 0.64, 1],
easeInOutBack: [0.68, -0.6, 0.32, 1.6]
};
je({
linear: $e
}, Ue);
const Mt = {
default: {
primary: "#eeeeee",
secondary: "#E0E0E0",
ternary: "#F5F5F5",
quartenary: "#ededed",
hoverHighlight: "rgba(204, 216, 219, 0.5)",
markerCurrentTime: "#000",
text: "#404040",
background: "white"
},
creamy: {
primary: "#ffe8d9",
secondary: "#fcdcc5",
ternary: "#fff6f0",
quartenary: "#f7ece6",
hoverHighlight: "rgba(230, 221, 202, 0.5)",
markerCurrentTime: "#000",
text: "#542d05",
background: "white"
},
crimson: {
primary: "#a82039",
secondary: "#c41238",
ternary: "#db4f56",
quartenary: "#ce5f64",
hoverHighlight: "rgba(196, 141, 141, 0.5)",
markerCurrentTime: "#000",
text: "white",
background: "white"
},
dark: {
primary: "#404040",
secondary: "#303030",
ternary: "#353535",
quartenary: "#383838",
hoverHighlight: "rgba(159, 160, 161, 0.5)",
markerCurrentTime: "#fff",
text: "white",
background: "#525252",
toast: "#1f1f1f"
},
flare: {
primary: "#e08a38",
secondary: "#e67912",
ternary: "#5e5145",
quartenary: "#665648",
hoverHighlight: "rgba(196, 141, 141, 0.5)",
markerCurrentTime: "#000",
text: "white",
background: "white"
},
fuchsia: {
primary: "#de1d5a",
secondary: "#b50b41",
ternary: "#ff7da6",
quartenary: "#f2799f",
hoverHighlight: "rgba(196, 141, 141, 0.5)",
markerCurrentTime: "#000",
text: "white",
background: "white"
},
grove: {
primary: "#3d9960",
secondary: "#288542",
ternary: "#72b585",
quartenary: "#65a577",
hoverHighlight: "rgba(160, 219, 171, 0.5)",
markerCurrentTime: "#000",
text: "white",
background: "white"
},
"material-blue": {
primary: "#0D47A1",
secondary: "#1565C0",
ternary: "#42a5f5",
quartenary: "#409fed",
hoverHighlight: "rgba(110, 165, 196, 0.5)",
markerCurrentTime: "#000",
text: "white",
background: "white"
},
sky: {
primary: "#b5e3ff",
secondary: "#a1d6f7",
ternary: "#d6f7ff",
quartenary: "#d0edf4",
hoverHighlight: "rgba(193, 202, 214, 0.5)",
markerCurrentTime: "#000",
text: "#022c47",
background: "white"
},
slumber: {
primary: "#2a2f42",
secondary: "#2f3447",
ternary: "#35394d",
quartenary: "#2c3044",
hoverHighlight: "rgba(179, 162, 127, 0.5)",
markerCurrentTime: "#fff",
text: "#ffe0b3",
background: "#38383b",
toast: "#1f1f1f"
},
vue: {
primary: "#258a5d",
secondary: "#41B883",
ternary: "#35495E",
quartenary: "#2a3d51",
hoverHighlight: "rgba(160, 219, 171, 0.5)",
markerCurrentTime: "#000",
text: "white",
background: "white"
}
}, Ne = { class: "g-gantt-rows-container" }, Ve = /* @__PURE__ */ K({
__name: "GGanttChart",
props: {
chartStart: {},
chartEnd: {},
precision: { default: "day" },
barStart: {},
barEnd: {},
currentTime: { type: Boolean },
currentTimeLabel: { default: "" },
dateFormat: { type: [String, Boolean], default: Ut },
width: { default: "100%" },
hideTimeaxis: { type: Boolean, default: !1 },
colorScheme: { default: "default" },
grid: { type: Boolean, default: !1 },
pushOnOverlap: { type: Boolean, default: !1 },
noOverlap: { type: Boolean, default: !1 },
rowHeight: { default: 40 },
highlightedUnits: { default: () => [] },
font: { default: "inherit" },
labelColumnTitle: { default: "" },
labelColumnWidth: { default: "150px" }
},
emits: ["click-bar", "mousedown-bar", "mouseup-bar", "dblclick-bar", "mouseenter-bar", "mouseleave-bar", "dragstart-bar", "drag-bar", "dragend-bar", "contextmenu-bar"],
setup(t, { emit: u }) {
const e = t, { width: n, font: v, colorScheme: c } = nt(e), d = I(() => parseFloat(n.value) > 500), a = oe(), o = I(
() => typeof c.value != "string" ? c.value : Mt[c.value] || Mt.default
), r = () => {
var l;
const f = (l = a.default) == null ? void 0 : l.call(a), x = [];
return f && f.forEach((b) => {
var y;
if ((y = b.props) != null && y.bars) {
const { label: _, bars: C } = b.props;
x.push({ label: _, bars: C });
} else
Array.isArray(b.children) && b.children.forEach((_) => {
var T;
const C = _;
if ((T = C == null ? void 0 : C.props) != null && T.bars) {
const { label: M, bars: S } = C.props;
x.push({ label: M, bars: S });
}
});
}), x;
}, i = G(!1), s = G(!1), g = G(void 0);
let h;
const w = (f) => {
h && clearTimeout(h), h = setTimeout(() => {
i.value = !0;
}, 800), g.value = f;
}, m = () => {
clearTimeout(h), i.value = !1;
}, p = (f, x, l, b) => {
switch (f.type) {
case "click":
u("click-bar", { bar: x, e: f, datetime: l });
break;
case "mousedown":
u("mousedown-bar", { bar: x, e: f, datetime: l });
break;
case "mouseup":
u("mouseup-bar", { bar: x, e: f, datetime: l });
break;
case "dblclick":
u("dblclick-bar", { bar: x, e: f, datetime: l });
break;
case "mouseenter":
w(x), u("mouseenter-bar", { bar: x, e: f });
break;
case "mouseleave":
m(), u("mouseleave-bar", { bar: x, e: f });
break;
case "dragstart":
s.value = !0, u("dragstart-bar", { bar: x, e: f });
break;
case "drag":
u("drag-bar", { bar: x, e: f });
break;
case "dragend":
s.value = !1, u("dragend-bar", { bar: x, e: f, movedBars: b });
break;
case "contextmenu":
u("contextmenu-bar", { bar: x, e: f, datetime: l });
break;
}
}, B = G(null), k = We(B);
return st(Ft, r), st(zt, {
...nt(e),
colors: o,
chartSize: k
}), st(Pt, p), (f, x) => (O(), D("div", null, [
L("div", {
class: bt([{ "labels-in-column": !!f.labelColumnTitle }])
}, [
f.labelColumnTitle ? (O(), et(be, {
key: 0,
style: $({
width: f.labelColumnWidth
})
}, {
"label-column-title": q(() => [
Y(f.$slots, "label-column-title")
]),
"label-column-row": q(({ label: l }) => [
Y(f.$slots, "label-column-row", { label: l })
]),
_: 3
}, 8, ["style"])) : j("", !0),
L("div", {
ref_key: "ganttChart",
ref: B,
class: bt(["g-gantt-chart", { "with-column": f.labelColumnTitle }]),
style: $({ width: E(n), background: o.value.background, fontFamily: E(v) })
}, [
f.hideTimeaxis ? j("", !0) : (O(), et(Ee, {
key: 0,
"is-active-in-seconds": d.value
}, {
"upper-timeunit": q(({ label: l, value: b, date: y }) => [
Y(f.$slots, "upper-timeunit", {
label: l,
value: b,
date: y
})
]),
timeunit: q(({ label: l, value: b, date: y }) => [
Y(f.$slots, "timeunit", {
label: l,
value: b,
date: y
})
]),
_: 3
}, 8, ["is-active-in-seconds"])),
f.grid ? (O(), et(ve, {
key: 1,
"highlighted-units": f.highlightedUnits
}, null, 8, ["highlighted-units"])) : j("", !0),
f.currentTime ? (O(), et(Te, { key: 2 }, {
"current-time-label": q(() => [
Y(f.$slots, "current-time-label")
]),
_: 3
})) : j("", !0),
L("div", Ne, [
Y(f.$slots, "default")
])
], 6)
], 2),
Bt(De, {
"model-value": i.value || s.value,
bar: g.value
}, {
default: q(() => [
Y(f.$slots, "bar-tooltip", { bar: g.value })
]),
_: 3
}, 8, ["model-value", "bar"])
]));
}
});
function $t(t, u = () => null, e = () => null, n = H()) {
const { barStart: v, barEnd: c, pushOnOverlap: d } = n, a = G(!1);
let o = 0, r;
const { mapPositionToTime: i } = dt(n), { toDayjs: s } = rt(n), g = (f) => {
const x = document.getElementById(t.ganttBarConfig.id);
if (!x)
return;
switch (o = f.clientX - (x.getBoundingClientRect().left || 0), f.target.className) {
case "g-gantt-bar-handle-left":
document.body.style.cursor = "ew-resize", r = m;
break;
case "g-gantt-bar-handle-right":
document.body.style.cursor = "ew-resize", r = p;
break;
default:
r = w;
}
a.value = !0, window.addEventListener("mousemove", r), window.addEventListener("mouseup", k);
}, h = () => {
var l;
const f = document.getElementById(t.ganttBarConfig.id), x = (l = f == null ? void 0 : f.closest(".g-gantt-row-bars-container")) == null ? void 0 : l.getBoundingClientRect();
return { barElement: f, barContainer: x };
}, w = (f) => {
const { barElement: x, barContainer: l } = h();
if (!x || !l)
return;
const b = x.getBoundingClientRect().width, y = f.clientX - l.left - o, _ = y + b;
B(y, _) || (t[v.value] = i(y), t[c.value] = i(_), u(f, t));
}, m = (f) => {
const { barElement: x, barContainer: l } = h();
if (!x || !l)
return;
const b = f.clientX - l.left, y = i(b);
s(y).isSameOrAfter(s(t, "end")) || (t[v.value] = y, u(f, t));
}, p = (f) => {
const { barElement: x, barContainer: l } = h();
if (!x || !l)
return;
const b = f.clientX - l.left, y = i(b);
s(y).isSameOrBefore(s(t, "start")) || (t[c.value] = y, u(f, t));
}, B = (f, x) => {
if (!d.value)
return !1;
const l = t.ganttBarConfig.dragLimitLeft, b = t.ganttBarConfig.dragLimitRight;
return f && l != null && f < l || x && b != null && x > b;
}, k = (f) => {
a.value = !1, document.body.style.cursor = "", window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", k), e(f, t);
};
return {
isDragging: a,
initDrag: g
};
}
function qt() {
const t = lt(Pt);
if (!t)
throw Error("Failed to inject emitBarEvent!");
return t;
}
function qe() {
const t = H(), u = _t(), e = qt(), { pushOnOverlap: n, barStart: v, barEnd: c, noOverlap: d, dateFormat: a } = t, o = /* @__PURE__ */ new Map(), { toDayjs: r, format: i } = rt(), s = (l, b) => {
const { initDrag: y } = $t(l, h, k, t);
e({ ...b, type: "dragstart" }, l), y(b), f(l);
}, g = (l, b) => {
const y = l.ganttBarConfig.bundle;
y != null && (u().forEach((_) => {
_.bars.forEach((C) => {
if (C.ganttBarConfig.bundle === y) {
const T = C === l ? k : () => null, { initDrag: M } = $t(C, h, T, t);
M(b), f(C);
}
});
}), e({ ...b, type: "dragstart" }, l));
}, h = (l, b) => {
e({ ...l, type: "drag" }, b), w(b);
}, w = (l) => {
if (!(n != null && n.value))
return;
let b = l, { overlapBar: y, overlapType: _ } = p(b);
for (; y; ) {
f(y);
const C = r(b[v.value]), T = r(b[c.value]), M = r(y[v.value]), S = r(y[c.value]);
let R;
switch (_) {
case "left":
R = S.diff(C, "seconds", !0), y[c.value] = i(b[v.value], a.value), y[v.value] = i(
M.subtract(R, "seconds"),
a.value
);
break;
case "right":
R = T.diff(M, "seconds", !0), y[v.value] = i(T, a.value), y[c.value] = i(
S.add(R, "seconds"),
a.value
);
break;
default:
console.warn(
"Vue-Ganttastic: One bar is inside of the other one! This should never occur while push-on-overlap is active!"
);
return;
}
y && (_ === "left" || _ === "right") && m(y, R, _), b = y, { overlapBar: y, overlapType: _ } = p(y);
}
}, m = (l, b, y) => {
f(l), l.ganttBarConfig.bundle && u().forEach((_) => {
_.bars.forEach((C) => {
C.ganttBarConfig.bundle === l.ganttBarConfig.bundle && C !== l && (f(C), B(C, b, y));
});
});
}, p = (l) => {
var W, U;
let b, y, _;
const C = (U = (W = u().find((N) => N.bars.includes(l))) == null ? void 0 : W.bars) != null ? U : [], T = r(l[v.value]), M = r(l[c.value]);
return { overlapBar: C.find((N) => {
if (N === l)
return !1;
const V = r(N[v.value]), F = r(N[c.value]);
return b = T.isBetween(V, F), y = M.isBetween(V, F), _ = V.isBetween(T, M) || F.isBetween(T, M), b || y || _;
}), overlapType: b ? "left" : y ? "right" : _ ? "between" : null };
}, B = (l, b, y) => {
switch (y) {
case "left":
l[v.value] = i(
r(l, "start").subtract(b, "seconds"),
a.value
), l[c.value] = i(
r(l, "end").subtract(b, "seconds"),
a.value
);
break;
case "right":
l[v.value] = i(
r(l, "start").add(b, "seconds"),
a.value
), l[c.value] = i(r(l, "end").add(b, "seconds"), a.value);
}
w(l);
}, k = (l, b) => {
x();
const y = {
...l,
type: "dragend"
};
e(y, b, void 0, new Map(o)), o.clear();
}, f = (l) => {
if (!o.has(l)) {
const b = l[v.value], y = l[c.value];
o.set(l, { oldStart: b, oldEnd: y });
}
}, x = () => {
if (n.value || !d.value)
return;
let l = !1;
o.forEach((b, y) => {
const { overlapBar: _ } = p(y);
_ != null && (l = !0);
}), l && o.forEach(({ oldStart: b, oldEnd: y }, _) => {
_[v.value] = b, _[c.value] = y;
});
};
return {
initDragOfBar: s,
initDragOfBundle: g
};
}
function Qe() {
const { pushOnOverlap: t } = H(), u = _t(), e = (d) => {
const a = [];
return d != null && u().forEach((o) => {
o.bars.forEach((r) => {
r.ganttBarConfig.bundle === d && a.push(r);
});
}), a;
}, n = (d) => {
if (!t.value || d.ganttBarConfig.pushOnOverlap === !1)
return;
for (const o of ["left", "right"]) {
const r = o, { gapDistanceSoFar: i, bundleBarsAndGapDist: s } = v(
d,
0,
r
);
let g = i;
const h = s;
if (!h)
continue;
for (let m = 0; m < h.length; m++) {
const p = h[m].bar, B = h[m].gapDistance;
e(p.ganttBarConfig.bundle).filter(
(f) => f !== p
).forEach((f) => {
const x = v(f, B, r), l = x.gapDistanceSoFar, b = x.bundleBarsAndGapDist;
l != null && (!g || l < g) && (g = l), b.forEach((y) => {
h.find((_) => _.bar === y.bar) || h.push(y);
});
});
}
const w = document.getElementById(d.ganttBarConfig.id);
g != null && r === "left" ? d.ganttBarConfig.dragLimitLeft = w.offsetLeft - g : g != null && r === "right" && (d.ganttBarConfig.dragLimitRight = w.offsetLeft + w.offsetWidth + g);
}
e(d.ganttBarConfig.bundle).forEach((o) => {
o.ganttBarConfig.dragLimitLeft = d.ganttBarConfig.dragLimitLeft, o.ganttBarConfig.dragLimitRight = d.ganttBarConfig.dragLimitRight;
});
}, v = (d, a = 0, o) => {
const r = d.ganttBarConfig.bundle ? [{ bar: d, gapDistance: a }] : [];
let i = d, s = c(i, o);
if (o === "left")
for (; s; ) {
const g = document.getElementById(i.ganttBarConfig.id), h = document.getElementById(s.ganttBarConfig.id), w = h.offsetLeft + h.offsetWidth;
if (a += g.offsetLeft - w, s.ganttBarConfig.immobile)
return { gapDistanceSoFar: a, bundleBarsAndGapDist: r };
s.ganttBarConfig.bundle && r.push({
bar: s,
gapDistance: a
}), i = s, s = c(s, "left");
}
if (o === "right")
for (; s; ) {
const g = document.getElementById(i.ganttBarConfig.id), h = document.getElementById(s.ganttBarConfig.id), w = g.offsetLeft + g.offsetWidth;
if (a += h.offsetLeft - w, s.ganttBarConfig.immobile)
return { gapDistanceSoFar: a, bundleBarsAndGapDist: r };
s.ganttBarConfig.bundle && r.push({
bar: s,
gapDistance: a
}), i = s, s = c(s, "right");
}
return { gapDistanceSoFar: null, bundleBarsAndGapDist: r };
}, c = (d, a) => {
var s, g;
const o = document.getElementById(d.ganttBarConfig.id), r = (g = (s = u().find((h) => h.bars.includes(d))) == null ? void 0 : s.bars) != null ? g : [];
let i = [];
return a === "left" ? i = r.filter((h) => {
const w = document.getElementById(h.ganttBarConfig.id);
return w && w.offsetLeft < o.offsetLeft && h.ganttBarConfig.pushOnOverlap !== !1;
}) : i = r.filter((h) => {
const w = document.getElementById(h.ganttBarConfig.id);
return w && w.offsetLeft > o.offsetLeft && h.ganttBarConfig.pushOnOverlap !== !1;
}), i.length > 0 ? i.reduce((h, w) => {
const m = document.getElementById(h.ganttBarConfig.id), p = document.getElementById(w.ganttBarConfig.id), B = Math.abs(m.offsetLeft - o.offsetLeft), k = Math.abs(p.offsetLeft - o.offsetLeft);
return B < k ? h : w;
}, i[0]) : null;
};
return {
setDragLimitsOfGanttBar: n
};
}
const Xe = ["id"], Ke = { class: "g-gantt-bar-label" }, Ze = ["innerHTML"], Je = /* @__PURE__ */ L("div", { class: "g-gantt-bar-handle-left" }, null, -1), tn = /* @__PURE__ */ L("div", { class: "g-gantt-bar-handle-right" }, null, -1), en = /* @__PURE__ */ K({
__name: "GGanttBar",
props: {
bar: {}
},
setup(t) {
const u = t, e = qt(), n = H(), { rowHeight: v } = n, { bar: c } = nt(u), { mapTimeToPosition: d, mapPositionToTime: a } = dt(), { initDragOfBar: o, initDragOfBundle: r } = qe(), { setDragLimitsOfGanttBar: i } = Qe(), s = G(!1), g = I(() => c.value.ganttBarConfig);
function h(C) {
g.value.bundle != null ? r(c.value, C) : o(c.value, C), s.value = !0;
}
const w = () => {
i(c.value), !g.value.immobile && (window.addEventListener("mousemove", h, {
once: !0
}), window.addEventListener(
"mouseup",
() => {
window.removeEventListener("mousemove", h), s.value = !1;
},
{ once: !0 }
));
}, m = lt(jt), p = (C) => {
var S;
C.preventDefault(), C.type === "mousedown" && w();
const T = (S = m == null ? void 0 : m.value) == null ? void 0 : S.getBoundingClientRect();
if (!T)
return;
const M = a(C.clientX - T.left);
e(C, c.value, M);
}, { barStart: B, barEnd: k, width: f, chartStart: x, chartEnd: l, chartSize: b } = n, y = G(0), _ = G(0);
return Lt(() => {
ct(
[c, f, x, l, b.width],
() => {
y.value = d(c.value[B.value]), _.value = d(c.value[k.value]);
},
{ deep: !0, immediate: !0 }
);
}), (C, T) => (O(), D("div", {
id: g.value.id,
class: bt(["g-gantt-bar", g.value.class || ""]),
style: $({
...g.value.style,
position: "absolute",
top: `${E(v) * 0.1}px`,
left: `${y.value}px`,
width: `${_.value - y.value}px`,
height: `${E(v) * 0.8}px`,
zIndex: s.value ? 3 : 2
}),
onMousedown: p,
onClick: p,
onDblclick: p,
onMouseenter: p,
onMouseleave: p,
onContextmenu: p
}, [
L("div", Ke, [
Y(C.$slots, "default", { bar: E(c) }, () => [
L("div", null, P(g.value.label || ""), 1),
g.value.html ? (O(), D("div", {
key: 0,
innerHTML: g.value.html
}, null, 8, Ze)) : j("", !0)
])
]),
g.value.hasHandles ? (O(), D(Q, { key: 0 }, [
Je,
tn
], 64)) : j("", !0)
], 46, Xe));
}
});
const nn = /* @__PURE__ */ K({
__name: "GGanttRow",
props: {
label: {},
bars: {},
highlightOnHover: { type: Boolean }
},
emits: ["drop"],
setup(t, { emit: u }) {
const e = t, { rowHeight: n, colors: v, labelColumnTitle: c } = H(), { highlightOnHover: d } = nt(e), a = G(!1), o = I(() => ({
height: `${n.value}px`,
background: (d == null ? void 0 : d.value) && a.value ? v.value.hoverHighlight : null
})), { mapPositionToTime: r } = dt(), i = G(null);
st(jt, i);
const s = (h) => {
var B;
const w = (B = i.value) == null ? void 0 : B.getBoundingClientRect();
if (!w) {
console.error("Vue-Ganttastic: failed to find bar container element for row.");
return;
}
const m = h.clientX - w.left, p = r(m);
u("drop", { e: h, datetime: p });
}, g = (h) => !h || /^\s*$/.test(h);
return (h, w) => (O(), D("div", {
class: "g-gantt-row",
style: $(o.value),
onDragover: w[0] || (w[0] = ie((m) => a.value = !0, ["prevent"])),
onDragleave: w[1] || (w[1] = (m) => a.value = !1),
onDrop: w[2] || (w[2] = (m) => s(m)),
onMouseover: w[3] || (w[3] = (m) => a.value = !0),
onMouseleave: w[4] || (w[4] = (m) => a.value = !1)
}, [
!g(h.label) && !E(c) ? (O(), D("div", {
key: 0,
class: "g-gantt-row-label",
style: $({ background: E(v).primary, color: E(v).text })
}, [
Y(h.$slots, "label", {}, () => [
ut(P(h.label), 1)
])
], 4)) : j("", !0),
L("div", se({
ref_key: "barContainer",
ref: i,
class: "g-gantt-row-bars-container"
}, h.$attrs), [
Bt(le, {
name: "bar-transition",
tag: "div"
}, {
default: q(() => [
(O(!0), D(Q, null, X(h.bars, (m) => (O(), et(en, {
key: m.ganttBarConfig.id,
bar: m
}, {
default: q(() => [
Y(h.$slots, "bar-label", { bar: m })
]),
_: 2
}, 1032, ["bar"]))), 128))
]),
_: 3
})
], 16)
], 36));
}
});
function rn() {
A.extend(ce), A.extend(de), A.extend(fe), A.extend(me), A.extend(ge), A.extend(ue), A.extend(he);
}
const ln = {
install(t, u) {
rn(), t.component("GGanttChart", Ve), t.component("GGanttRow", nn);
}
};
function Z(t, u = "top") {
if (!t || typeof document > "u")
return;
const e = document.head, n = document.createElement("style");
u === "top" && e.firstChild ? e.insertBefore(n, e.firstChild) : e.appendChild(n), n.appendChild(document.createTextNode(t));
}
Z(`
.g-gantt-chart {
position: relative;
display: flex;
flex-direction: column;
overflow-x: hidden;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
font-feature-settings: "tnum";
font-variant-numeric: tabular-nums;
border-radius: 5px;
}
.with-column {
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
}
.g-gantt-rows-container {
position: relative;
}
.labels-in-column {
display: flex;
flex-direction: row;
}
`, "top");
Z(`
.g-gantt-row {
width: 100%;
transition: background 0.4s;
position: relative;
}
.g-gantt-row > .g-gantt-row-bars-container {
position: relative;
border-top: 1px solid #eaeaea;
width: 100%;
border-bottom: 1px solid #eaeaea;
}
.g-gantt-row-label {
position: absolute;
top: 0;
left: 0px;
padding: 0px 8px;
display: flex;
align-items: center;
height: 60%;
min-height: 20px;
font-size: 0.8em;
font-weight: bold;
border-bottom-right-radius: 6px;
background: #f2f2f2;
z-index: 3;
b