UNPKG

react-gantt-lightweight

Version:
1,248 lines (1,245 loc) 54.3 kB
import './index.css'; import ze, { useRef as Je, useEffect as Te, useState as ie, memo as Ye, useMemo as Ve, forwardRef as yt, useImperativeHandle as wt } from "react"; import { __assign as ee, __spreadArray as bt } from "tslib"; var xt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function Dt(a) { return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a; } var Ce = { exports: {} }, De = {}; /** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Ge; function Et() { if (Ge) return De; Ge = 1; var a = ze, r = Symbol.for("react.element"), c = Symbol.for("react.fragment"), x = Object.prototype.hasOwnProperty, g = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, b = { key: !0, ref: !0, __self: !0, __source: !0 }; function h(_, E, M) { var T, j = {}, D = null, F = null; M !== void 0 && (D = "" + M), E.key !== void 0 && (D = "" + E.key), E.ref !== void 0 && (F = E.ref); for (T in E) x.call(E, T) && !b.hasOwnProperty(T) && (j[T] = E[T]); if (_ && _.defaultProps) for (T in E = _.defaultProps, E) j[T] === void 0 && (j[T] = E[T]); return { $$typeof: r, type: _, key: D, ref: F, props: j, _owner: g.current }; } return De.Fragment = c, De.jsx = h, De.jsxs = h, De; } var Ee = {}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var qe; function Tt() { return qe || (qe = 1, process.env.NODE_ENV !== "production" && function() { var a = ze, r = Symbol.for("react.element"), c = Symbol.for("react.portal"), x = Symbol.for("react.fragment"), g = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), h = Symbol.for("react.provider"), _ = Symbol.for("react.context"), E = Symbol.for("react.forward_ref"), M = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), j = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), F = Symbol.for("react.offscreen"), N = Symbol.iterator, se = "@@iterator"; function I(e) { if (e === null || typeof e != "object") return null; var t = N && e[N] || e[se]; return typeof t == "function" ? t : null; } var K = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function A(e) { { for (var t = arguments.length, o = new Array(t > 1 ? t - 1 : 0), w = 1; w < t; w++) o[w - 1] = arguments[w]; z("error", e, o); } } function z(e, t, o) { { var w = K.ReactDebugCurrentFrame, k = w.getStackAddendum(); k !== "" && (t += "%s", o = o.concat([k])); var W = o.map(function(C) { return String(C); }); W.unshift("Warning: " + t), Function.prototype.apply.call(console[e], console, W); } } var de = !1, te = !1, ne = !1, fe = !1, he = !1, oe; oe = Symbol.for("react.module.reference"); function H(e) { return !!(typeof e == "string" || typeof e == "function" || e === x || e === b || he || e === g || e === M || e === T || fe || e === F || de || te || ne || typeof e == "object" && e !== null && (e.$$typeof === D || e.$$typeof === j || e.$$typeof === h || e.$$typeof === _ || e.$$typeof === E || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. e.$$typeof === oe || e.getModuleId !== void 0)); } function $(e, t, o) { var w = e.displayName; if (w) return w; var k = t.displayName || t.name || ""; return k !== "" ? o + "(" + k + ")" : o; } function le(e) { return e.displayName || "Context"; } function Q(e) { if (e == null) return null; if (typeof e.tag == "number" && A("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function") return e.displayName || e.name || null; if (typeof e == "string") return e; switch (e) { case x: return "Fragment"; case c: return "Portal"; case b: return "Profiler"; case g: return "StrictMode"; case M: return "Suspense"; case T: return "SuspenseList"; } if (typeof e == "object") switch (e.$$typeof) { case _: var t = e; return le(t) + ".Consumer"; case h: var o = e; return le(o._context) + ".Provider"; case E: return $(e, e.render, "ForwardRef"); case j: var w = e.displayName || null; return w !== null ? w : Q(e.type) || "Memo"; case D: { var k = e, W = k._payload, C = k._init; try { return Q(C(W)); } catch { return null; } } } return null; } var d = Object.assign, s = 0, i, f, l, m, p, u, y; function S() { } S.__reactDisabledLog = !0; function O() { { if (s === 0) { i = console.log, f = console.info, l = console.warn, m = console.error, p = console.group, u = console.groupCollapsed, y = console.groupEnd; var e = { configurable: !0, enumerable: !0, value: S, writable: !0 }; Object.defineProperties(console, { info: e, log: e, warn: e, error: e, group: e, groupCollapsed: e, groupEnd: e }); } s++; } } function P() { { if (s--, s === 0) { var e = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { log: d({}, e, { value: i }), info: d({}, e, { value: f }), warn: d({}, e, { value: l }), error: d({}, e, { value: m }), group: d({}, e, { value: p }), groupCollapsed: d({}, e, { value: u }), groupEnd: d({}, e, { value: y }) }); } s < 0 && A("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } var v = K.ReactCurrentDispatcher, V; function X(e, t, o) { { if (V === void 0) try { throw Error(); } catch (k) { var w = k.stack.trim().match(/\n( *(at )?)/); V = w && w[1] || ""; } return ` ` + V + e; } } var U = !1, B; { var G = typeof WeakMap == "function" ? WeakMap : Map; B = new G(); } function Y(e, t) { if (!e || U) return ""; { var o = B.get(e); if (o !== void 0) return o; } var w; U = !0; var k = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var W; W = v.current, v.current = null, O(); try { if (t) { var C = function() { throw Error(); }; if (Object.defineProperty(C.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct(C, []); } catch (ve) { w = ve; } Reflect.construct(e, [], C); } else { try { C.call(); } catch (ve) { w = ve; } e.call(C.prototype); } } else { try { throw Error(); } catch (ve) { w = ve; } e(); } } catch (ve) { if (ve && w && typeof ve.stack == "string") { for (var R = ve.stack.split(` `), re = w.stack.split(` `), q = R.length - 1, J = re.length - 1; q >= 1 && J >= 0 && R[q] !== re[J]; ) J--; for (; q >= 1 && J >= 0; q--, J--) if (R[q] !== re[J]) { if (q !== 1 || J !== 1) do if (q--, J--, J < 0 || R[q] !== re[J]) { var ue = ` ` + R[q].replace(" at new ", " at "); return e.displayName && ue.includes("<anonymous>") && (ue = ue.replace("<anonymous>", e.displayName)), typeof e == "function" && B.set(e, ue), ue; } while (q >= 1 && J >= 0); break; } } } finally { U = !1, v.current = W, P(), Error.prepareStackTrace = k; } var ye = e ? e.displayName || e.name : "", Ue = ye ? X(ye) : ""; return typeof e == "function" && B.set(e, Ue), Ue; } function Z(e, t, o) { return Y(e, !1); } function pe(e) { var t = e.prototype; return !!(t && t.isReactComponent); } function ae(e, t, o) { if (e == null) return ""; if (typeof e == "function") return Y(e, pe(e)); if (typeof e == "string") return X(e); switch (e) { case M: return X("Suspense"); case T: return X("SuspenseList"); } if (typeof e == "object") switch (e.$$typeof) { case E: return Z(e.render); case j: return ae(e.type, t, o); case D: { var w = e, k = w._payload, W = w._init; try { return ae(W(k), t, o); } catch { } } } return ""; } var ce = Object.prototype.hasOwnProperty, ge = {}, be = K.ReactDebugCurrentFrame; function je(e) { if (e) { var t = e._owner, o = ae(e.type, e._source, t ? t.type : null); be.setExtraStackFrame(o); } else be.setExtraStackFrame(null); } function Ke(e, t, o, w, k) { { var W = Function.call.bind(ce); for (var C in e) if (W(e, C)) { var R = void 0; try { if (typeof e[C] != "function") { var re = Error((w || "React class") + ": " + o + " type `" + C + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[C] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); throw re.name = "Invariant Violation", re; } R = e[C](t, C, w, o, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (q) { R = q; } R && !(R instanceof Error) && (je(k), A("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", w || "React class", o, C, typeof R), je(null)), R instanceof Error && !(R.message in ge) && (ge[R.message] = !0, je(k), A("Failed %s type: %s", o, R.message), je(null)); } } } var Qe = Array.isArray; function Me(e) { return Qe(e); } function et(e) { { var t = typeof Symbol == "function" && Symbol.toStringTag, o = t && e[Symbol.toStringTag] || e.constructor.name || "Object"; return o; } } function tt(e) { try { return Pe(e), !1; } catch { return !0; } } function Pe(e) { return "" + e; } function Ne(e) { if (tt(e)) return A("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", et(e)), Pe(e); } var xe = K.ReactCurrentOwner, rt = { key: !0, ref: !0, __self: !0, __source: !0 }, Be, ke, Re; Re = {}; function nt(e) { if (ce.call(e, "ref")) { var t = Object.getOwnPropertyDescriptor(e, "ref").get; if (t && t.isReactWarning) return !1; } return e.ref !== void 0; } function at(e) { if (ce.call(e, "key")) { var t = Object.getOwnPropertyDescriptor(e, "key").get; if (t && t.isReactWarning) return !1; } return e.key !== void 0; } function it(e, t) { if (typeof e.ref == "string" && xe.current && t && xe.current.stateNode !== t) { var o = Q(xe.current.type); Re[o] || (A('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', Q(xe.current.type), e.ref), Re[o] = !0); } } function st(e, t) { { var o = function() { Be || (Be = !0, A("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t)); }; o.isReactWarning = !0, Object.defineProperty(e, "key", { get: o, configurable: !0 }); } } function ot(e, t) { { var o = function() { ke || (ke = !0, A("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t)); }; o.isReactWarning = !0, Object.defineProperty(e, "ref", { get: o, configurable: !0 }); } } var lt = function(e, t, o, w, k, W, C) { var R = { // This tag allows us to uniquely identify this as a React Element $$typeof: r, // Built-in properties that belong on the element type: e, key: t, ref: o, props: C, // Record the component responsible for creating this element. _owner: W }; return R._store = {}, Object.defineProperty(R._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: !1 }), Object.defineProperty(R, "_self", { configurable: !1, enumerable: !1, writable: !1, value: w }), Object.defineProperty(R, "_source", { configurable: !1, enumerable: !1, writable: !1, value: k }), Object.freeze && (Object.freeze(R.props), Object.freeze(R)), R; }; function ut(e, t, o, w, k) { { var W, C = {}, R = null, re = null; o !== void 0 && (Ne(o), R = "" + o), at(t) && (Ne(t.key), R = "" + t.key), nt(t) && (re = t.ref, it(t, k)); for (W in t) ce.call(t, W) && !rt.hasOwnProperty(W) && (C[W] = t[W]); if (e && e.defaultProps) { var q = e.defaultProps; for (W in q) C[W] === void 0 && (C[W] = q[W]); } if (R || re) { var J = typeof e == "function" ? e.displayName || e.name || "Unknown" : e; R && st(C, J), re && ot(C, J); } return lt(e, R, re, k, w, xe.current, C); } } var _e = K.ReactCurrentOwner, We = K.ReactDebugCurrentFrame; function me(e) { if (e) { var t = e._owner, o = ae(e.type, e._source, t ? t.type : null); We.setExtraStackFrame(o); } else We.setExtraStackFrame(null); } var $e; $e = !1; function Se(e) { return typeof e == "object" && e !== null && e.$$typeof === r; } function Le() { { if (_e.current) { var e = Q(_e.current.type); if (e) return ` Check the render method of \`` + e + "`."; } return ""; } } function ct(e) { { if (e !== void 0) { var t = e.fileName.replace(/^.*[\\\/]/, ""), o = e.lineNumber; return ` Check your code at ` + t + ":" + o + "."; } return ""; } } var Ie = {}; function dt(e) { { var t = Le(); if (!t) { var o = typeof e == "string" ? e : e.displayName || e.name; o && (t = ` Check the top-level render call using <` + o + ">."); } return t; } } function He(e, t) { { if (!e._store || e._store.validated || e.key != null) return; e._store.validated = !0; var o = dt(t); if (Ie[o]) return; Ie[o] = !0; var w = ""; e && e._owner && e._owner !== _e.current && (w = " It was passed a child from " + Q(e._owner.type) + "."), me(e), A('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', o, w), me(null); } } function Fe(e, t) { { if (typeof e != "object") return; if (Me(e)) for (var o = 0; o < e.length; o++) { var w = e[o]; Se(w) && He(w, t); } else if (Se(e)) e._store && (e._store.validated = !0); else if (e) { var k = I(e); if (typeof k == "function" && k !== e.entries) for (var W = k.call(e), C; !(C = W.next()).done; ) Se(C.value) && He(C.value, t); } } } function ft(e) { { var t = e.type; if (t == null || typeof t == "string") return; var o; if (typeof t == "function") o = t.propTypes; else if (typeof t == "object" && (t.$$typeof === E || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. t.$$typeof === j)) o = t.propTypes; else return; if (o) { var w = Q(t); Ke(o, e.props, "prop", w, e); } else if (t.PropTypes !== void 0 && !$e) { $e = !0; var k = Q(t); A("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", k || "Unknown"); } typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && A("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function ht(e) { { for (var t = Object.keys(e.props), o = 0; o < t.length; o++) { var w = t[o]; if (w !== "children" && w !== "key") { me(e), A("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", w), me(null); break; } } e.ref !== null && (me(e), A("Invalid attribute `ref` supplied to `React.Fragment`."), me(null)); } } function Ae(e, t, o, w, k, W) { { var C = H(e); if (!C) { var R = ""; (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (R += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); var re = ct(k); re ? R += re : R += Le(); var q; e === null ? q = "null" : Me(e) ? q = "array" : e !== void 0 && e.$$typeof === r ? (q = "<" + (Q(e.type) || "Unknown") + " />", R = " Did you accidentally export a JSX literal instead of a component?") : q = typeof e, A("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", q, R); } var J = ut(e, t, o, k, W); if (J == null) return J; if (C) { var ue = t.children; if (ue !== void 0) if (w) if (Me(ue)) { for (var ye = 0; ye < ue.length; ye++) Fe(ue[ye], e); Object.freeze && Object.freeze(ue); } else A("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else Fe(ue, e); } return e === x ? ht(J) : ft(J), J; } } function vt(e, t, o) { return Ae(e, t, o, !0); } function gt(e, t, o) { return Ae(e, t, o, !1); } var pt = gt, mt = vt; Ee.Fragment = x, Ee.jsx = pt, Ee.jsxs = mt; }()), Ee; } process.env.NODE_ENV === "production" ? Ce.exports = Et() : Ce.exports = Tt(); var n = Ce.exports, jt = function(a) { var r = a.isOpen, c = a.color, x = c === void 0 ? "#000000" : c, g = Je(null); return Te(function() { g.current && x && g.current.style.setProperty("--bg-color", x); }, [g, x]), n.jsx("div", { ref: g, className: "w-[20px] h-[20px] inline-block relative main-arrow" + (r ? " arrow_open" : "") }); }, Ot = function(a) { var r = a.head, c = a.list, x = a.headWidth, g = a.headBodyPaddingY, b = a.headBodyPaddingX, h = a.open, _ = a.scrollBarHeight, E = a.onChange, M = ie(h), T = M[0], j = M[1]; return n.jsxs("div", { className: "ganttOverview-box", children: [h && n.jsx("div", { className: "ganttOverview-arrrow-box", onClick: function() { j(!T), E(!T); }, children: n.jsx("div", { className: "ganttOverview-arrrow", children: n.jsx(jt, { isOpen: !T, color: "#696B6C" }) }) }), n.jsx("div", { style: { width: x }, className: T ? "ganttOverview" : "ganttOverview-close", children: n.jsxs("div", { style: { width: x, height: "100%", display: "flex", flexDirection: "column", overflow: "hidden" }, children: [n.jsx("div", { className: "ganttOverview-head", children: r.map(function(D, F) { return n.jsx("div", { className: "ganttOverview-head-item", style: { textAlign: D.align ? D.align : "center", width: D.width ? D.width : "auto", maxWidth: D.width ? D.width : "auto", minWidth: D.width ? D.width : "auto" }, children: D.renderTableHead ? D.renderTableHead() : D.title }, F); }) }), n.jsxs("div", { className: "ganttOverview-body", children: [n.jsx("div", { style: { flex: 1, overflow: "hidden" }, children: n.jsx("div", { className: "ganttOverview-body-height", style: { paddingLeft: b + "px", paddingRight: b + "px", paddingTop: g + "px", paddingBottom: g + "px" }, children: c.map(function(D, F) { return n.jsxs("div", { className: "ganttOverview-body-cell", children: [n.jsx("div", { className: "ganttOverview-body-cell-filed", children: D.renderHead ? n.jsx("div", { className: "ganttOverview-body-cell-item", children: D.renderHead() }) : r.map(function(N, se) { return n.jsx("div", { style: { textAlign: N.align ? N.align : "center", width: N.width ? N.width : "auto", maxWidth: N.width ? N.width : "auto", minWidth: N.width ? N.width : "auto" }, className: "ganttOverview-body-cell-item", children: N.key ? D[N.key] : "" }, se); }) }, F), D.children && n.jsx("div", { className: "ganttOverview-body-cell-open", children: D.children.map(function(N, se) { return n.jsx("div", { className: "ganttOverview-body-cell-open-cell", children: N.renderHeadChild ? n.jsxs("div", { className: "ganttOverview-body-cell-open-cell-item-first ganttOverview-body-cell-open-cell-item", children: [n.jsx("div", { className: "quan" }), n.jsx("div", { className: "", children: N.renderHeadChild() })] }) : r.map(function(I, K) { return K === 0 ? n.jsxs("div", { className: "ganttOverview-body-cell-open-cell-item ganttOverview-body-cell-open-cell-item-first", children: [n.jsx("div", { className: "quan" }), n.jsx("div", { style: { width: I.width ? I.width : "auto", maxWidth: I.width ? I.width : "auto", minWidth: I.width ? I.width : "auto" }, children: I.key ? N[I.key] : "" })] }, K) : n.jsx("div", { style: { width: I.width ? I.width : "auto", maxWidth: I.width ? I.width : "auto", minWidth: I.width ? I.width : "auto" }, className: "ganttOverview-body-cell-open-cell-item", children: n.jsx("div", { children: I.key ? N[I.key] : "" }) }, K); }) }, se); }) })] }, F); }) }) }), n.jsx("div", { style: { height: _ + "px" } })] })] }) })] }); }, Xe = { exports: {} }; (function(a, r) { (function(c, x) { a.exports = x(); })(xt, function() { var c = 1e3, x = 6e4, g = 36e5, b = "millisecond", h = "second", _ = "minute", E = "hour", M = "day", T = "week", j = "month", D = "quarter", F = "year", N = "date", se = "Invalid Date", I = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, K = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, A = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(d) { var s = ["th", "st", "nd", "rd"], i = d % 100; return "[" + d + (s[(i - 20) % 10] || s[i] || s[0]) + "]"; } }, z = function(d, s, i) { var f = String(d); return !f || f.length >= s ? d : "" + Array(s + 1 - f.length).join(i) + d; }, de = { s: z, z: function(d) { var s = -d.utcOffset(), i = Math.abs(s), f = Math.floor(i / 60), l = i % 60; return (s <= 0 ? "+" : "-") + z(f, 2, "0") + ":" + z(l, 2, "0"); }, m: function d(s, i) { if (s.date() < i.date()) return -d(i, s); var f = 12 * (i.year() - s.year()) + (i.month() - s.month()), l = s.clone().add(f, j), m = i - l < 0, p = s.clone().add(f + (m ? -1 : 1), j); return +(-(f + (i - l) / (m ? l - p : p - l)) || 0); }, a: function(d) { return d < 0 ? Math.ceil(d) || 0 : Math.floor(d); }, p: function(d) { return { M: j, y: F, w: T, d: M, D: N, h: E, m: _, s: h, ms: b, Q: D }[d] || String(d || "").toLowerCase().replace(/s$/, ""); }, u: function(d) { return d === void 0; } }, te = "en", ne = {}; ne[te] = A; var fe = "$isDayjsObject", he = function(d) { return d instanceof le || !(!d || !d[fe]); }, oe = function d(s, i, f) { var l; if (!s) return te; if (typeof s == "string") { var m = s.toLowerCase(); ne[m] && (l = m), i && (ne[m] = i, l = m); var p = s.split("-"); if (!l && p.length > 1) return d(p[0]); } else { var u = s.name; ne[u] = s, l = u; } return !f && l && (te = l), l || !f && te; }, H = function(d, s) { if (he(d)) return d.clone(); var i = typeof s == "object" ? s : {}; return i.date = d, i.args = arguments, new le(i); }, $ = de; $.l = oe, $.i = he, $.w = function(d, s) { return H(d, { locale: s.$L, utc: s.$u, x: s.$x, $offset: s.$offset }); }; var le = function() { function d(i) { this.$L = oe(i.locale, null, !0), this.parse(i), this.$x = this.$x || i.x || {}, this[fe] = !0; } var s = d.prototype; return s.parse = function(i) { this.$d = function(f) { var l = f.date, m = f.utc; if (l === null) return /* @__PURE__ */ new Date(NaN); if ($.u(l)) return /* @__PURE__ */ new Date(); if (l instanceof Date) return new Date(l); if (typeof l == "string" && !/Z$/i.test(l)) { var p = l.match(I); if (p) { var u = p[2] - 1 || 0, y = (p[7] || "0").substring(0, 3); return m ? new Date(Date.UTC(p[1], u, p[3] || 1, p[4] || 0, p[5] || 0, p[6] || 0, y)) : new Date(p[1], u, p[3] || 1, p[4] || 0, p[5] || 0, p[6] || 0, y); } } return new Date(l); }(i), this.init(); }, s.init = function() { var i = this.$d; this.$y = i.getFullYear(), this.$M = i.getMonth(), this.$D = i.getDate(), this.$W = i.getDay(), this.$H = i.getHours(), this.$m = i.getMinutes(), this.$s = i.getSeconds(), this.$ms = i.getMilliseconds(); }, s.$utils = function() { return $; }, s.isValid = function() { return this.$d.toString() !== se; }, s.isSame = function(i, f) { var l = H(i); return this.startOf(f) <= l && l <= this.endOf(f); }, s.isAfter = function(i, f) { return H(i) < this.startOf(f); }, s.isBefore = function(i, f) { return this.endOf(f) < H(i); }, s.$g = function(i, f, l) { return $.u(i) ? this[f] : this.set(l, i); }, s.unix = function() { return Math.floor(this.valueOf() / 1e3); }, s.valueOf = function() { return this.$d.getTime(); }, s.startOf = function(i, f) { var l = this, m = !!$.u(f) || f, p = $.p(i), u = function(U, B) { var G = $.w(l.$u ? Date.UTC(l.$y, B, U) : new Date(l.$y, B, U), l); return m ? G : G.endOf(M); }, y = function(U, B) { return $.w(l.toDate()[U].apply(l.toDate("s"), (m ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(B)), l); }, S = this.$W, O = this.$M, P = this.$D, v = "set" + (this.$u ? "UTC" : ""); switch (p) { case F: return m ? u(1, 0) : u(31, 11); case j: return m ? u(1, O) : u(0, O + 1); case T: var V = this.$locale().weekStart || 0, X = (S < V ? S + 7 : S) - V; return u(m ? P - X : P + (6 - X), O); case M: case N: return y(v + "Hours", 0); case E: return y(v + "Minutes", 1); case _: return y(v + "Seconds", 2); case h: return y(v + "Milliseconds", 3); default: return this.clone(); } }, s.endOf = function(i) { return this.startOf(i, !1); }, s.$set = function(i, f) { var l, m = $.p(i), p = "set" + (this.$u ? "UTC" : ""), u = (l = {}, l[M] = p + "Date", l[N] = p + "Date", l[j] = p + "Month", l[F] = p + "FullYear", l[E] = p + "Hours", l[_] = p + "Minutes", l[h] = p + "Seconds", l[b] = p + "Milliseconds", l)[m], y = m === M ? this.$D + (f - this.$W) : f; if (m === j || m === F) { var S = this.clone().set(N, 1); S.$d[u](y), S.init(), this.$d = S.set(N, Math.min(this.$D, S.daysInMonth())).$d; } else u && this.$d[u](y); return this.init(), this; }, s.set = function(i, f) { return this.clone().$set(i, f); }, s.get = function(i) { return this[$.p(i)](); }, s.add = function(i, f) { var l, m = this; i = Number(i); var p = $.p(f), u = function(O) { var P = H(m); return $.w(P.date(P.date() + Math.round(O * i)), m); }; if (p === j) return this.set(j, this.$M + i); if (p === F) return this.set(F, this.$y + i); if (p === M) return u(1); if (p === T) return u(7); var y = (l = {}, l[_] = x, l[E] = g, l[h] = c, l)[p] || 1, S = this.$d.getTime() + i * y; return $.w(S, this); }, s.subtract = function(i, f) { return this.add(-1 * i, f); }, s.format = function(i) { var f = this, l = this.$locale(); if (!this.isValid()) return l.invalidDate || se; var m = i || "YYYY-MM-DDTHH:mm:ssZ", p = $.z(this), u = this.$H, y = this.$m, S = this.$M, O = l.weekdays, P = l.months, v = l.meridiem, V = function(B, G, Y, Z) { return B && (B[G] || B(f, m)) || Y[G].slice(0, Z); }, X = function(B) { return $.s(u % 12 || 12, B, "0"); }, U = v || function(B, G, Y) { var Z = B < 12 ? "AM" : "PM"; return Y ? Z.toLowerCase() : Z; }; return m.replace(K, function(B, G) { return G || function(Y) { switch (Y) { case "YY": return String(f.$y).slice(-2); case "YYYY": return $.s(f.$y, 4, "0"); case "M": return S + 1; case "MM": return $.s(S + 1, 2, "0"); case "MMM": return V(l.monthsShort, S, P, 3); case "MMMM": return V(P, S); case "D": return f.$D; case "DD": return $.s(f.$D, 2, "0"); case "d": return String(f.$W); case "dd": return V(l.weekdaysMin, f.$W, O, 2); case "ddd": return V(l.weekdaysShort, f.$W, O, 3); case "dddd": return O[f.$W]; case "H": return String(u); case "HH": return $.s(u, 2, "0"); case "h": return X(1); case "hh": return X(2); case "a": return U(u, y, !0); case "A": return U(u, y, !1); case "m": return String(y); case "mm": return $.s(y, 2, "0"); case "s": return String(f.$s); case "ss": return $.s(f.$s, 2, "0"); case "SSS": return $.s(f.$ms, 3, "0"); case "Z": return p; } return null; }(B) || p.replace(":", ""); }); }, s.utcOffset = function() { return 15 * -Math.round(this.$d.getTimezoneOffset() / 15); }, s.diff = function(i, f, l) { var m, p = this, u = $.p(f), y = H(i), S = (y.utcOffset() - this.utcOffset()) * x, O = this - y, P = function() { return $.m(p, y); }; switch (u) { case F: m = P() / 12; break; case j: m = P(); break; case D: m = P() / 3; break; case T: m = (O - S) / 6048e5; break; case M: m = (O - S) / 864e5; break; case E: m = O / g; break; case _: m = O / x; break; case h: m = O / c; break; default: m = O; } return l ? m : $.a(m); }, s.daysInMonth = function() { return this.endOf(j).$D; }, s.$locale = function() { return ne[this.$L]; }, s.locale = function(i, f) { if (!i) return this.$L; var l = this.clone(), m = oe(i, f, !0); return m && (l.$L = m), l; }, s.clone = function() { return $.w(this.$d, this); }, s.toDate = function() { return new Date(this.valueOf()); }, s.toJSON = function() { return this.isValid() ? this.toISOString() : null; }, s.toISOString = function() { return this.$d.toISOString(); }, s.toString = function() { return this.$d.toUTCString(); }, d; }(), Q = le.prototype; return H.prototype = Q, [["$ms", b], ["$s", h], ["$m", _], ["$H", E], ["$W", M], ["$M", j], ["$y", F], ["$D", N]].forEach(function(d) { Q[d[1]] = function(s) { return this.$g(s, d[0], d[1]); }; }), H.extend = function(d, s) { return d.$i || (d(s, le, H), d.$i = !0), H; }, H.locale = oe, H.isDayjs = he, H.unix = function(d) { return H(1e3 * d); }, H.en = ne[te], H.Ls = ne, H.p = {}, H; }); })(Xe); var Yt = Xe.exports; const L = /* @__PURE__ */ Dt(Yt); var Mt = [ { status: "finish", text: "已完成" }, { status: "finishOvertime", text: "已完成" }, { status: "overtime", text: "已超时" }, { status: "progress", text: "进行中" }, { status: "wait", text: "待接受" } ], Rt = function(a, r) { for (var c = new Date(a.slice(0, 8)), x = new Date(r.slice(0, 8)), g = []; c <= x; ) g.push(L(c).format("YYYY-MM")), c.setMonth(c.getMonth() + 1); return g; }, _t = function(a, r, c) { var x = new Date(a), g = c === "day" ? new Date(r) : new Date(new Date(r).getTime() + 864e5 * 30), b = x, h = []; if (c === "day") { var _ = Rt(a, r); _.forEach(function(M, T) { var j = Number(M.split("-")[0]), D = Number(M.split("-")[1]); T === 0 ? h.push({ year: "".concat(j, "-").concat(D), length: L(a).endOf("month").date() - L(a).date() + 1 }) : T === _.length - 1 ? h.push({ year: "".concat(j, "-").concat(D), length: new Date(r).getDate() }) : h.push({ year: "".concat(j, "-").concat(D), length: new Date(j, D, 0).getDate() }); }); } else if (c === "month") { for (var E = []; b <= g; ) E.push(L(b).format("YYYY-MM")), b.setMonth(b.getMonth() + 1); E.forEach(function(M) { var T = Number(M.split("-")[0]), j = Number(M.split("-")[1]); h.push({ year: "".concat(T, "-").concat(j), length: new Date(T, j, 0).getDate() }); }); } return h; }, $t = function(a, r) { for (var c = L(a), x = L(r), g = [], b = c; b.isBefore(x); b = b.add(1, "day")) g.push(b.format("YYYY-MM-DD")); return g.push(r), g; }, we = function(a, r) { return a ? (new Date(a).getTime() - new Date(r).getTime()) / 1e3 / 3600 : ((/* @__PURE__ */ new Date()).getTime() - new Date(r).getTime()) / 1e3 / 3600; }; function St(a, r) { var c; return function() { for (var x = this, g = [], b = 0; b < arguments.length; b++) g[b] = arguments[b]; clearTimeout(c), c = setTimeout(function() { a.apply(x, g); }, r); }; } function Oe() { for (var a = "", r = "0123456789abcdef", c = 0; c < 36; c++) if (c === 8 || c === 13 || c === 18 || c === 23) a += "-"; else if (c === 14) a += "4"; else { var x = Math.floor(Math.random() * 16); a += r[c === 19 ? x & 3 | 8 : x]; } return a; } var Ct = Ye(function(a) { var r = a.days, c = a.width, x = a.bodyRect; return n.jsx("div", { className: "gantt-right-body-content-mark", children: r.map(function(g, b) { return n.jsx("div", { style: { width: c * g.length + "px", minWidth: c * g.length + "px", height: x.scrollHeight ? x.scrollHeight + "px" : "100%" }, className: "gantt-right-body-content-mark-item" }, b); }) }); }), Ze = Ye(function(a) { var r = a.item, c = a.ganttProgressBarId, x = ie({ top: 0, left: 0, bottom: 0, height: 0 }), g = x[0], b = x[1]; return Te(function() { var h = document.getElementsByClassName("progressBar"); document.getElementById("top-time-width").innerHTML = ` <div class="top-time-width-item" style="left:`.concat(r.left + 5, `px;"> <div class="top-time-width-item-child" style="width:`).concat(r.width + 1, "px; background:var(--").concat(r.status === "overtime" ? "progress" : r.status, `Color)"></div> `).concat((r.status === "finishOvertime" || r.status === "overtime") && r.overtimeWidth ? '<div style="width:'.concat(r.overtimeWidth, 'px; background:var(--overtimeColor)"></div>') : "", ` </div>`); for (var _ = 0; _ < h.length; _++) { var E = h[_]; E.id != c && E.classList.add("gantt-animation"); } return function() { for (var M = document.getElementsByClassName("progressBar"), T = 0; T < M.length; T++) { var j = M[T]; j.classList.remove("gantt-animation"); } document.getElementById("top-time-width").innerHTML = ""; }; }, [c]), Te(function() { var h = document.getElementById("gantt-right-body-content"), _ = document.getElementById(r.ganttProgressBarId); if (h && _) { var E = h.getBoundingClientRect().top - _.getBoundingClientRect().top; b(ee(ee({}, g), { top: E - 1, height: h.clientHeight || 0 })); } }, [r]), n.jsxs(n.Fragment, { children: [n.jsx("div", { className: "helpLine-line helpLine-line-".concat(r.status), style: { // left: rect.left + 5 + "px", top: g.top + "px", left: r.left + 5 + "px", height: g.height + "px" } }), n.jsx("div", { className: "helpLine-line helpLine-line-".concat(r.status), style: { left: r.left + 5 + r.width + "px", top: g.top + "px", height: g.height + "px" } }), (r.status === "finishOvertime" || r.status === "overtime") && r.overtimeWidth && n.jsx("div", { className: "helpLine-line helpLine-line-".concat(r.status), style: { top: g.top + "px", borderColor: "#f54040", left: r.left + g.left + 5 + r.width + r.overtimeWidth + "px", height: g.height + "px" } })] }); }), Pt = Ye(function(a) { var r = a.item, c = a.index, x = a.showLine, g = a.statusList, b = a.onClickText, h = ie(r)[0], _ = ie(""), E = _[0], M = _[1], T = function(D) { M(D); }, j = function() { M(""); }; return n.jsxs("div", { className: "gantt-right-body-cell gantt-right-body-cell-isParent-true", children: [n.jsxs("div", { id: "gantt-progressBar-Id" + c, onMouseEnter: function() { return T("gantt-progressBar-Id" + c); }, onMouseLeave: j, className: "progressBar progressBar-".concat(h.status), style: { left: h.left + "px" }, children: [n.jsxs("div", { className: "progressBar-box", children: [n.jsx("div", { className: "progressBar-render", children: h.renderoBar && h.renderoBar(h.width, h.width * h.progress, h.width - h.width * h.progress, h.overtimeWidth) }), n.jsx("div", { className: "progressBar-default", style: { width: h.width + "px" }, children: n.jsx("div", { className: "progressBar-active", style: { width: h.progress * 100 + "%" } }) }), (h.status === "overtime" || h.status === "finishOvertime") && h.overtimeWidth && n.jsx("div", { className: "progressBar-overTimeWidth", style: { width: h.overtimeWidth + "px" }, children: n.jsx("div", { className: "overtimeRender" }) })] }), n.jsx("div", { className: "progress-text", onClick: function() { return b(r); }, children: g.filter(function(D) { return h.status === D.status; })[0].text })] }), x && E === "gantt-progressBar-Id".concat(c) && n.jsx(Ze, { ganttProgressBarId: E, item: ee(ee({}, r), { ganttProgressBarId: "gantt-progressBar-Id" + c }) })] }, c); }), Nt = Ye(function(a) { var r = a.item, c = a.index, x = a.showLine, g = ie(""), b = g[0], h = g[1], _ = function(M) { h(M); }, E = function() { h(""); }; return n.jsxs("div", { className: "gantt-right-body-cell gantt-right-body-cell-isParent-false", children: [n.jsx("div", { id: "gantt-progressBar-Id" + c, onMouseEnter: function() { return _("gantt-progressBar-Id" + c); }, onMouseLeave: E, className: "progressBar progressBar-".concat(r.status), style: { padding: "5px", border: "0", background: "transparent", left: r.left + "px" }, children: n.jsxs("div", { className: "progressBar-box", children: [n.jsx("div", { className: "progressBar-render progressBar-render-child", children: r.renderoBar && r.renderoBar(r.width, r.width * r.progress, r.width - r.width * r.progress, r.overtimeWidth) }), n.jsx("div", { className: "progressBar-default progressBar-default-child", style: { width: r.width + "px" }, children: n.jsx("div", { className: "progressBar-active progressBar-active-child", style: { width: r.progress * 100 + "%" } }) }), (r.status === "overtime" || r.status === "finishOvertime") && r.overtimeWidth && n.jsx("div", { className: "progressBar-overTimeWidth progressBar-overTimeWidth-child", style: { width: r.overtimeWidth + "px" }, children: n.jsx("div", { className: "overtimeRender" }) })] }) }), x && b === "gantt-progressBar-Id".concat(c) && n.jsx(Ze, { ganttProgressBarId: b, item: ee(ee({}, r), { ganttProgressBarId: "gantt-progressBar-Id" + c }) })] }, c); }), Bt = function(a) { var r = a.list, c = a.headBodyPaddingY, x = a.refresh, g = a.showLine, b = a.ganttType, h = a.statusList, _ = h === void 0 ? Mt : h, E = a.onChangeScrollBarHeight, M = a.onClickText, T = ie([]), j = T[0], D = T[1], F = ie([]), N = F[0], se = F[1], I = ie([]), K = I[0], A = I[1], z = Je(null), de = ie(0), te = de[0], ne = de[1], fe = ie(0), he = fe[0], oe = fe[1], H = ie({ height: 0, scrollWidth: 0, scrollHeight: 0 }), $ = H[0], le = H[1], Q = function(u, y, S) { var O = u / 24, P = S.map(function(v) { var V = L(v.startTime), X = V.diff(y.startDate, "day"), U = new Date(v.startTime).getHours(), B = we("", v.startTime), G = we(v.endTime, v.startTime), Y = 0; v.status === "finishOvertime" ? (B = G, Y = v.finishTime ? we(v.finishTime, v.endTime) : 0) : v.status === "overtime" ? (B = G, Y = we("", v.endTime)) : v.status === "finish" ? B = v.finishTime ? we(v.finishTime, v.startTime) : 0 : v.status === "wait" ? B = G : new Date(v.startTime).getTime() > (/* @__PURE__ */ new Date()).getTime() ? B = 0 : B = we("", v.startTime); var Z = B / G; return ee(ee({}, v), { startTime: v.startTime, endTime: v.endTime, finishTime: v.finishTime, overtimeWidth: Y * O, progress: Z, status: v.status, width: Math.abs(G * O), left: X * u + U * O - 5 }); }); A(P); }, d = function(u, y) { var S, O = (S = document.getElementById("gantt-right")) === null || S === void 0 ? void 0 : S.offsetWidth, P = c * 2; if (y.forEach(function(ae) { P += ae.height; }), O) { var v = _t(u.startDate, u.endDate, b), V = 0; if (D(v), b === "day") { var X = $t(u.startDate, u.endDate), U = O / X.length; V = U > 40 ? U : 40; var B = X.map(function(ae) { return { year: ae, length: 1 }; }); oe(O), se(B); } else if (b === "month") { var G = 0; v.forEach(function(ce) { return G += ce.length; }); var U = O / G; V = U > 3 ? U : 3; var Y = {}, Z = []; v.forEach(function(ce) { var ge = Number(ce.year.split("-")[0]), be = Number(ce.year.split("-")[1]); Y[ge] ? Y[ge].length += new Date(ge, be, 0).getDate() : Y[ge] = { length: new Date(ge, be, 0).getDate(), year: ce.year.slice(0, 4) }; }); for (var pe in Y) Z.push(Y[pe]); oe(O), se(v), D(Z); } Q(V, u, y), ne(V); } }, s = function() { A([]), i(); }, i = function() { var u = []; r.forEach(function(y, S) { S > 0 && u.push(ee(ee({}, y), { ganttId: Oe(), isParent: !0, isEmpty: !1, parentIsEmpty: !0, left: 0, width: 0, progress: 0 })), u.push(ee(ee({}, y), { ganttId: Oe(), isParent: !0, isEmpty: !1, parentIsEmpty: !1, left: 0, width: 0, progress: 0 })), y.children && y.children.forEach(function(O, P) { P === 0 && u.push(ee(ee({}, O), { ganttId: Oe(), isParent: !1, parentIsEmpty: !1, isEmpty: !0, left: 0, width: 0, progress: 0 })), u.push(ee(ee({}, O), { ganttId: Oe(), parentIsEmpty: !1, isParent: !1, isEmpty: !1, left: 0, width: 0, progress: 0 })); }); }), f(u); }, f = function(u) { var y = !1, S = bt([], u, !0); S.forEach(function(Y) { if (Y.start) { var Z = new Date(Y.startTime).getTime(), pe = new Date(Y.endTime).getTime(), ae = Y.finishTime ? new Date(Y.finishTime).getTime() : null; ae ? Z < ae && ae <= pe ? Y.status = "finish" : Z < ae && ae > pe && (Y.status = "finishOvertime") : (/* @__PURE__ */ new Date()).getTime() > pe ? (Y.status = "overtime", y = !0) : Y.status = "progress"; } else Y.status = "wait"; }); var O = S.map(function(Y) { return new Date(Y.startTime).getTime(); }).sort(function(Y, Z) { return Y - Z; }), P = S.map(function(Y) { return new Date(Y.endTime).getTime(); }).sort(function(Y, Z) { return Z - Y; }), v = { startDate: "", endDate: "" }; if (b === "day") if (L(O[0]).format("YYYY-MM") === L(P[0]).format("YYYY-MM")) { var V = L(P[0] + 1728e5).format("YYYY-MM"), X = L(P[0]).format("YYYY-MM"), U = L(P[0] + 864e5 * 2).endOf("month").format("YYYY-MM-DD"); v.startDate = L(O[0]).format("YYYY-MM") + "-01", v.endDate = V === X ? U : L(P[0] + 864e5 * 2).format("YYYY-MM-DD"); } else v.startDate = L(O[0] - 864e5).format("YYYY-MM-DD"), v.endDate = L(P[0] + 864e5 * 2).format("YYYY-MM-DD"); else if (b === "month") { var B = L(O[0]), G = B.subtract(1, "month"); if (L(O[0]).format("YYYY") === L(P[0]).format("YYYY")) { var V = L(P[0] + 432e6).format("YYYY-MM-DD"), X = L(P[0]).format("YYYY-MM-DD"), U = L(P[0] + 864e5 * 5).endOf("month").format("YYYY-MM-DD"); v.startDate = L(O[0]).format("YYYY") + "-" + G.format("MM") + "-01", v.endDate = V === X ? U : L(P[0]).format("YYYY-MM-DD"); } else v.startDate = L(O[0]).format("YYYY") + "-" + G.format("MM") + "-01", v.endDate = L(P[0] + 864e5 * 5).format("YYYY-MM-DD"); } y && new Date(v.endDate).getTime() < (/* @__PURE__ */ new Date()).getTime() && (v.endDate = L((/* @__PURE__ */ new Date()).getTime() + 864e5 * 3).format("YYYY-MM