62 lines
16 KiB
JavaScript
62 lines
16 KiB
JavaScript
! function(e, n) { for (var t in n) e[t] = n[t] }(window, function(e) { var n = {};
|
|
|
|
function t(i) { if (n[i]) return n[i].exports; var o = n[i] = { i: i, l: !1, exports: {} }; return e[i].call(o.exports, o, o.exports, t), o.l = !0, o.exports } return t.m = e, t.c = n, t.d = function(e, n, i) { t.o(e, n) || Object.defineProperty(e, n, { enumerable: !0, get: i }) }, t.r = function(e) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 }) }, t.t = function(e, n) { if (1 & n && (e = t(e)), 8 & n) return e; if (4 & n && "object" == typeof e && e && e.__esModule) return e; var i = Object.create(null); if (t.r(i), Object.defineProperty(i, "default", { enumerable: !0, value: e }), 2 & n && "string" != typeof e)
|
|
for (var o in e) t.d(i, o, function(n) { return e[n] }.bind(null, o)); return i }, t.n = function(e) { var n = e && e.__esModule ? function() { return e.default } : function() { return e }; return t.d(n, "a", n), n }, t.o = function(e, n) { return Object.prototype.hasOwnProperty.call(e, n) }, t.p = "", t(t.s = 7) }({ 7: function(e, n, t) { "use strict";
|
|
|
|
function i(e, n) { if (!(e instanceof n)) throw new TypeError("Cannot call a class as a function") }
|
|
|
|
function o(e, n) { for (var t = 0; t < n.length; t++) { var i = n[t];
|
|
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i) } }
|
|
t.r(n), t.d(n, "Menu", (function() { return l })); var s = ["transitionend", "webkitTransitionEnd", "oTransitionEnd"],
|
|
l = function() {
|
|
function e(n) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
|
|
o = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null;
|
|
i(this, e), this._el = n, this._animate = !1 !== t.animate, this._accordion = !1 !== t.accordion, this._closeChildren = Boolean(t.closeChildren), this._onOpen = t.onOpen || function() {}, this._onOpened = t.onOpened || function() {}, this._onClose = t.onClose || function() {}, this._onClosed = t.onClosed || function() {}, this._psScroll = null, this._topParent = null, this._menuBgClass = null, n.classList.add("menu"), n.classList[this._animate ? "remove" : "add"]("menu-no-animation"), n.classList.add("menu-vertical"); var s = o || window.PerfectScrollbar;
|
|
s ? (this._scrollbar = new s(n.querySelector(".menu-inner"), { suppressScrollX: !0, wheelPropagation: !e._hasClass("layout-menu-fixed layout-menu-fixed-offcanvas") }), window.Helpers.menuPsScroll = this._scrollbar) : n.querySelector(".menu-inner").classList.add("overflow-auto"); for (var l = n.classList, r = 0; r < l.length; r++) l[r].startsWith("bg-") && (this._menuBgClass = l[r]);
|
|
n.setAttribute("data-bg-class", this._menuBgClass), this._bindEvents(), n.menuInstance = this } var n, t, l; return n = e, l = [{ key: "childOf", value: function(e, n) { if (e.parentNode) { for (;
|
|
(e = e.parentNode) && e !== n;); return !!e } return !1 } }, { key: "_isRoot", value: function(n) { return !e._findParent(n, "menu-item", !1) } }, { key: "_findParent", value: function(e, n) { var t = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2]; if ("BODY" === e.tagName.toUpperCase()) return null; for (e = e.parentNode;
|
|
"BODY" !== e.tagName.toUpperCase() && !e.classList.contains(n);) e = e.parentNode; if (!(e = "BODY" !== e.tagName.toUpperCase() ? e : null) && t) throw new Error("Cannot find `.".concat(n, "` parent element")); return e } }, { key: "_findChild", value: function(e, n) { for (var t = e.childNodes, i = [], o = 0, s = t.length; o < s; o++)
|
|
if (t[o].classList) { for (var l = 0, r = 0; r < n.length; r++) t[o].classList.contains(n[r]) && (l += 1);
|
|
n.length === l && i.push(t[o]) }
|
|
return i } }, { key: "_findMenu", value: function(e) { for (var n = e.childNodes[0], t = null; n && !t;) n.classList && n.classList.contains("menu-sub") && (t = n), n = n.nextSibling; if (!t) throw new Error("Cannot find `.menu-sub` element for the current `.menu-toggle`"); return t } }, { key: "_hasClass", value: function(e) { var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : window.Helpers.ROOT_EL,
|
|
t = !1; return e.split(" ").forEach((function(e) { n.classList.contains(e) && (t = !0) })), t } }, { key: "_getItem", value: function(n, t) { var i = null,
|
|
o = t ? "menu-toggle" : "menu-link"; if (n.classList.contains("menu-item") ? e._findChild(n, [o]).length && (i = n) : n.classList.contains(o) && (i = n.parentNode.classList.contains("menu-item") ? n.parentNode : null), !i) throw new Error("".concat(t ? "Toggable " : "", "`.menu-item` element not found.")); return i } }, { key: "_getLink", value: function(n, t) { var i = [],
|
|
o = t ? "menu-toggle" : "menu-link"; if (n.classList.contains(o) ? i = [n] : n.classList.contains("menu-item") && (i = e._findChild(n, [o])), !i.length) throw new Error("`".concat(o, "` element not found.")); return i[0] } }, { key: "_bindAnimationEndEvent", value: function(n, t) { var i = function(i) { i.target === n && (e._unbindAnimationEndEvent(n), t(i)) },
|
|
o = window.getComputedStyle(n).transitionDuration;
|
|
o = parseFloat(o) * (-1 !== o.indexOf("ms") ? 1 : 1e3), n._menuAnimationEndEventCb = i, s.forEach((function(e) { return n.addEventListener(e, n._menuAnimationEndEventCb, !1) })), n._menuAnimationEndEventTimeout = setTimeout((function() { i({ target: n }) }), o + 50) } }, { key: "_promisify", value: function(e) { for (var n = arguments.length, t = new Array(n > 1 ? n - 1 : 0), i = 1; i < n; i++) t[i - 1] = arguments[i]; var o = e.apply(void 0, t); return o instanceof Promise ? o : !1 === o ? Promise.reject() : Promise.resolve() } }, { key: "_unbindAnimationEndEvent", value: function(e) { var n = e._menuAnimationEndEventCb;
|
|
e._menuAnimationEndEventTimeout && (clearTimeout(e._menuAnimationEndEventTimeout), e._menuAnimationEndEventTimeout = null), n && (s.forEach((function(t) { return e.removeEventListener(t, n, !1) })), e._menuAnimationEndEventCb = null) } }, { key: "setDisabled", value: function(n, t) { e._getItem(n, !1).classList[t ? "add" : "remove"]("disabled") } }, { key: "isActive", value: function(n) { return e._getItem(n, !1).classList.contains("active") } }, { key: "isOpened", value: function(n) { return e._getItem(n, !1).classList.contains("open") } }, { key: "isDisabled", value: function(n) { return e._getItem(n, !1).classList.contains("disabled") } }], (t = [{ key: "_bindEvents", value: function() { var n = this;
|
|
this._evntElClick = function(t) { if (t.target.closest("ul") && t.target.closest("ul").classList.contains("menu-inner")) { var i = e._findParent(t.target, "menu-item", !1);
|
|
i && (n._topParent = i.childNodes[0]) } var o = t.target.classList.contains("menu-toggle") ? t.target : e._findParent(t.target, "menu-toggle", !1);
|
|
o && (t.preventDefault(), "true" !== o.getAttribute("data-hover") && n.toggle(o)) }, window.Helpers.isMobileDevice && this._el.addEventListener("click", this._evntElClick), this._evntWindowResize = function() { n.update(), n._lastWidth !== window.innerWidth && (n._lastWidth = window.innerWidth, n.update()); var e = document.querySelector("[data-template^='horizontal-menu']");
|
|
n._horizontal || e || n.manageScroll() }, window.addEventListener("resize", this._evntWindowResize) } }, { key: "_unbindEvents", value: function() { this._evntElClick && (this._el.removeEventListener("click", this._evntElClick), this._evntElClick = null), this._evntElMouseOver && (this._el.removeEventListener("mouseover", this._evntElMouseOver), this._evntElMouseOver = null), this._evntElMouseOut && (this._el.removeEventListener("mouseout", this._evntElMouseOut), this._evntElMouseOut = null), this._evntWindowResize && (window.removeEventListener("resize", this._evntWindowResize), this._evntWindowResize = null), this._evntBodyClick && (document.body.removeEventListener("click", this._evntBodyClick), this._evntBodyClick = null), this._evntInnerMousemove && (this._inner.removeEventListener("mousemove", this._evntInnerMousemove), this._evntInnerMousemove = null), this._evntInnerMouseleave && (this._inner.removeEventListener("mouseleave", this._evntInnerMouseleave), this._evntInnerMouseleave = null) } }, { key: "open", value: function(n) { var t = this,
|
|
i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this._closeChildren,
|
|
o = this._findUnopenedParent(e._getItem(n, !0), i); if (o) { var s = e._getLink(o, !0);
|
|
e._promisify(this._onOpen, this, o, s, e._findMenu(o)).then((function() { t._horizontal && e._isRoot(o) ? t._onOpened && t._onOpened(t, o, s, e._findMenu(o)) : t._animate && !t._horizontal ? (window.requestAnimationFrame((function() { return t._toggleAnimation(!0, o, !1) })), t._accordion && t._closeOther(o, i)) : t._animate ? t._onOpened && t._onOpened(t, o, s, e._findMenu(o)) : (o.classList.add("open"), t._onOpened && t._onOpened(t, o, s, e._findMenu(o)), t._accordion && t._closeOther(o, i)) })).catch((function() {})) } } }, { key: "close", value: function(n) { var t = this,
|
|
i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this._closeChildren,
|
|
o = arguments.length > 2 && void 0 !== arguments[2] && arguments[2],
|
|
s = e._getItem(n, !0),
|
|
l = e._getLink(n, !0);
|
|
s.classList.contains("open") && !s.classList.contains("disabled") && e._promisify(this._onClose, this, s, l, e._findMenu(s), o).then((function() { if (t._horizontal && e._isRoot(s)) t._onClosed && t._onClosed(t, s, l, e._findMenu(s));
|
|
else if (t._animate && !t._horizontal) window.requestAnimationFrame((function() { return t._toggleAnimation(!1, s, i) }));
|
|
else { if (s.classList.remove("open"), i)
|
|
for (var n = s.querySelectorAll(".menu-item.open"), o = 0, r = n.length; o < r; o++) n[o].classList.remove("open");
|
|
t._onClosed && t._onClosed(t, s, l, e._findMenu(s)) } })).catch((function() {})) } }, { key: "_closeOther", value: function(n, t) { for (var i = e._findChild(n.parentNode, ["menu-item", "open"]), o = 0, s = i.length; o < s; o++) i[o] !== n && this.close(i[o], t) } }, { key: "toggle", value: function(n) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this._closeChildren,
|
|
i = e._getItem(n, !0);
|
|
i.classList.contains("open") ? this.close(i, t) : this.open(i, t) } }, { key: "_findUnopenedParent", value: function(n, t) { for (var i = [], o = null; n;) n.classList.contains("disabled") ? (o = null, i = []) : (n.classList.contains("open") || (o = n), i.push(n)), n = e._findParent(n, "menu-item", !1); if (!o) return null; if (1 === i.length) return o; for (var s = 0, l = (i = i.slice(0, i.indexOf(o))).length; s < l; s++)
|
|
if (i[s].classList.add("open"), this._accordion)
|
|
for (var r = e._findChild(i[s].parentNode, ["menu-item", "open"]), a = 0, u = r.length; a < u; a++)
|
|
if (r[a] !== i[s] && (r[a].classList.remove("open"), t))
|
|
for (var c = r[a].querySelectorAll(".menu-item.open"), d = 0, h = c.length; d < h; d++) c[d].classList.remove("open");
|
|
return o } }, { key: "_toggleAnimation", value: function(n, t, i) { var o = this,
|
|
s = e._getLink(t, !0),
|
|
l = e._findMenu(t);
|
|
e._unbindAnimationEndEvent(t); var r = Math.round(s.getBoundingClientRect().height);
|
|
t.style.overflow = "hidden"; var a = function() { t.classList.remove("menu-item-animating"), t.classList.remove("menu-item-closing"), t.style.overflow = null, t.style.height = null, o.update() };
|
|
n ? (t.style.height = "".concat(r, "px"), t.classList.add("menu-item-animating"), t.classList.add("open"), e._bindAnimationEndEvent(t, (function() { a(), o._onOpened(o, t, s, l) })), setTimeout((function() { t.style.height = "".concat(r + Math.round(l.getBoundingClientRect().height), "px") }), 50)) : (t.style.height = "".concat(r + Math.round(l.getBoundingClientRect().height), "px"), t.classList.add("menu-item-animating"), t.classList.add("menu-item-closing"), e._bindAnimationEndEvent(t, (function() { if (t.classList.remove("open"), a(), i)
|
|
for (var e = t.querySelectorAll(".menu-item.open"), n = 0, r = e.length; n < r; n++) e[n].classList.remove("open");
|
|
o._onClosed(o, t, s, l) })), setTimeout((function() { t.style.height = "".concat(r, "px") }), 50)) } }, { key: "_getItemOffset", value: function(e) { for (var n = this._inner.childNodes[0], t = 0; n !== e;) n.tagName && (t += Math.round(n.getBoundingClientRect().width)), n = n.nextSibling; return t } }, { key: "_innerWidth", get: function() { for (var e = this._inner.childNodes, n = 0, t = 0, i = e.length; t < i; t++) e[t].tagName && (n += Math.round(e[t].getBoundingClientRect().width)); return n } }, { key: "_innerPosition", get: function() { return parseInt(this._inner.style[this._rtl ? "marginRight" : "marginLeft"] || "0px", 10) }, set: function(e) { return this._inner.style[this._rtl ? "marginRight" : "marginLeft"] = "".concat(e, "px"), e } }, { key: "closeAll", value: function() { for (var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this._closeChildren, n = this._el.querySelectorAll(".menu-inner > .menu-item.open"), t = 0, i = n.length; t < i; t++) this.close(n[t], e) } }, { key: "update", value: function() { this._scrollbar && this._scrollbar.update() } }, { key: "manageScroll", value: function() { var e = window.PerfectScrollbar,
|
|
n = document.querySelector(".menu-inner"); if (window.innerWidth < window.Helpers.LAYOUT_BREAKPOINT) null !== this._scrollbar && (this._scrollbar.destroy(), this._scrollbar = null), n.classList.add("overflow-auto");
|
|
else { if (null === this._scrollbar) { var t = new e(document.querySelector(".menu-inner"), { suppressScrollX: !0, wheelPropagation: !1 });
|
|
this._scrollbar = t }
|
|
n.classList.remove("overflow-auto") } } }, { key: "destroy", value: function() { if (this._el) { this._unbindEvents(); for (var n = this._el.querySelectorAll(".menu-item"), t = 0, i = n.length; t < i; t++) e._unbindAnimationEndEvent(n[t]), n[t].classList.remove("menu-item-animating"), n[t].classList.remove("open"), n[t].style.overflow = null, n[t].style.height = null; for (var o = this._el.querySelectorAll(".menu-menu"), s = 0, l = o.length; s < l; s++) o[s].style.marginRight = null, o[s].style.marginLeft = null;
|
|
this._el.classList.remove("menu-no-animation"), this._wrapper && (this._prevBtn.parentNode.removeChild(this._prevBtn), this._nextBtn.parentNode.removeChild(this._nextBtn), this._wrapper.parentNode.insertBefore(this._inner, this._wrapper), this._wrapper.parentNode.removeChild(this._wrapper), this._inner.style.marginLeft = null, this._inner.style.marginRight = null), this._el.menuInstance = null, delete this._el.menuInstance, this._el = null, this._animate = null, this._accordion = null, this._closeChildren = null, this._onOpen = null, this._onOpened = null, this._onClose = null, this._onClosed = null, this._scrollbar && (this._scrollbar.destroy(), this._scrollbar = null), this._inner = null, this._prevBtn = null, this._wrapper = null, this._nextBtn = null } } }]) && o(n.prototype, t), l && o(n, l), Object.defineProperty(n, "prototype", { writable: !1 }), e }() } })); |