UNPKG

epic-designer-cjh

Version:

基于vue3的设计器,可视化开发页面表单

1,234 lines (1,233 loc) 43.1 kB
import { i as V } from "./interopRequireDefault-40f894e3.js"; import { r as U } from "./_vue_commonjs-external-eb7fec7f.js"; import { a as z, b as tt, r as it } from "./public_api-1267ff2a.js"; import { a as he, c as _e, o as nt, m as be, g as ot, r as rt, f as at } from "./useConfigInject-bc9599af.js"; import { r as Ue, a as ze, b as Le, c as ut, d as st } from "./Portal-59ca1f55.js"; import { r as We } from "./raf-09a8b76f.js"; import { _ as Ce } from "./typeof-88a201b1.js"; import { r as lt } from "./index-b5b1eb67.js"; import { m as ft, n as ct } from "./isEqual-b1699f9b.js"; import { r as Xe } from "./vnode-8ae20ac3.js"; import { r as dt } from "./ResizeObserver.es-df63660c.js"; var te = {}, ie = {}, W = {}, ne = {}, Me; function pt() { if (Me) return ne; Me = 1, Object.defineProperty(ne, "__esModule", { value: !0 }), ne.cancelRequestAnimationFrame = o, ne.default = c; var a = ["moz", "ms", "webkit"]; function t() { var l = 0; return function(d) { var v = (/* @__PURE__ */ new Date()).getTime(), r = Math.max(0, 16 - (v - l)), u = window.setTimeout(function() { d(v + r); }, r); return l = v + r, u; }; } function c() { if (typeof window > "u") return function() { }; if (window.requestAnimationFrame) return window.requestAnimationFrame.bind(window); var l = a.filter(function(d) { return "".concat(d, "RequestAnimationFrame") in window; })[0]; return l ? window["".concat(l, "RequestAnimationFrame")] : t(); } function o(l) { if (typeof window > "u") return null; if (window.cancelAnimationFrame) return window.cancelAnimationFrame(l); var d = a.filter(function(v) { return "".concat(v, "CancelAnimationFrame") in window || "".concat(v, "CancelRequestAnimationFrame") in window; })[0]; return d ? (window["".concat(d, "CancelAnimationFrame")] || window["".concat(d, "CancelRequestAnimationFrame")]).call(this, l) : clearTimeout(l); } return ne; } var Ae; function vt() { if (Ae) return W; Ae = 1; var a = Ce; Object.defineProperty(W, "__esModule", { value: !0 }), W.requestAnimationTimeout = W.cancelAnimationTimeout = void 0; var t = o(pt()); function c(r) { if (typeof WeakMap != "function") return null; var u = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakMap(); return (c = function(g) { return g ? m : u; })(r); } function o(r, u) { if (!u && r && r.__esModule) return r; if (r === null || a(r) !== "object" && typeof r != "function") return { default: r }; var m = c(u); if (m && m.has(r)) return m.get(r); var f = {}, g = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var T in r) if (T !== "default" && Object.prototype.hasOwnProperty.call(r, T)) { var M = g ? Object.getOwnPropertyDescriptor(r, T) : null; M && (M.get || M.set) ? Object.defineProperty(f, T, M) : f[T] = r[T]; } return f.default = r, m && m.set(r, f), f; } var l = (0, t.default)(), d = function(u) { return (0, t.cancelRequestAnimationFrame)(u.id); }; W.cancelAnimationTimeout = d; var v = function(u) { var m = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, f = Date.now(); function g() { Date.now() - f >= m ? u.call() : T.id = l(g); } var T = { id: l(g) }; return T; }; return W.requestAnimationTimeout = v, W; } var oe = {}, I = {}, xe; function ye() { if (xe) return I; xe = 1; var a = V; Object.defineProperty(I, "__esModule", { value: !0 }), I.popupProps = I.mobileProps = I.innerProps = void 0; var t = a(z()), c = { visible: Boolean, prefixCls: String, zIndex: Number, destroyPopupOnHide: Boolean, forceRender: Boolean, // Legacy Motion animation: [String, Object], transitionName: String, // Measure stretch: { type: String }, // Align align: { type: Object }, point: { type: Object }, getRootDomNode: { type: Function }, getClassNameFromAlign: { type: Function }, onMouseenter: { type: Function }, onMouseleave: { type: Function }, onMousedown: { type: Function }, onTouchstart: { type: Function } }; I.innerProps = c; var o = (0, t.default)((0, t.default)({}, c), {}, { mobile: { type: Object } }); I.mobileProps = o; var l = (0, t.default)((0, t.default)({}, c), {}, { mask: Boolean, mobile: { type: Object }, maskAnimation: String, maskTransitionName: String }); return I.popupProps = l, I; } var ve = {}, me = {}, Oe; function Ye() { if (Oe) return me; Oe = 1, Object.defineProperty(me, "__esModule", { value: !0 }), me.getMotion = a; function a(t) { var c = t.prefixCls, o = t.animation, l = t.transitionName; return o ? { name: "".concat(c, "-").concat(o) } : l ? { name: l } : {}; } return me; } var Re; function mt() { if (Re) return ve; Re = 1; var a = V; Object.defineProperty(ve, "__esModule", { value: !0 }), ve.default = l; var t = U, c = a(z()), o = Ye(); function l(d) { var v = d.prefixCls, r = d.visible, u = d.zIndex, m = d.mask, f = d.maskAnimation, g = d.maskTransitionName; if (!m) return null; var T = {}; return (g || f) && (T = (0, o.getMotion)({ prefixCls: v, transitionName: g, animation: f })), (0, t.createVNode)(t.Transition, (0, c.default)({ appear: !0 }, T), { default: function() { return [(0, t.withDirectives)((0, t.createVNode)("div", { style: { zIndex: u }, class: "".concat(v, "-mask") }, null), [[(0, t.resolveDirective)("if"), r]])]; } }); } return l.displayName = "Mask", ve; } var re = {}, De; function ht() { if (De) return re; De = 1; var a = V; Object.defineProperty(re, "__esModule", { value: !0 }), re.default = void 0; var t = U, c = a(z()), o = he(), l = a(_e()), d = ye(), v = (0, t.defineComponent)({ compatConfig: { MODE: 3 }, name: "MobilePopupInner", inheritAttrs: !1, props: d.mobileProps, emits: ["mouseenter", "mouseleave", "mousedown", "touchstart", "align"], setup: function(u, m) { var f = m.expose, g = m.slots, T = (0, t.ref)(); return f({ forceAlign: function() { }, getElement: function() { return T.value; } }), function() { var M, S = u.zIndex, A = u.visible, b = u.prefixCls, p = u.mobile, w = p === void 0 ? {} : p, N = w.popupClassName, x = w.popupStyle, $ = w.popupMotion, s = $ === void 0 ? {} : $, e = w.popupRender, i = (0, c.default)({ zIndex: S }, x), n = (0, o.flattenChildren)((M = g.default) === null || M === void 0 ? void 0 : M.call(g)); n.length > 1 && (n = (0, t.createVNode)("div", { class: "".concat(b, "-content") }, [n])), e && (n = e(n)); var h = (0, l.default)(b, N); return (0, t.createVNode)(t.Transition, (0, c.default)({ ref: T }, s), { default: function() { return [A ? (0, t.createVNode)("div", { class: h, style: i }, [n]) : null]; } }); }; } }); return re.default = v, re; } var ae = {}, ue = {}, Se; function gt() { if (Se) return ue; Se = 1; var a = V; Object.defineProperty(ue, "__esModule", { value: !0 }), ue.default = void 0; var t = a(lt()), c = a(nt()), o = U, l = a(We()), d = ["measure", "align", null, "motion"], v = function(u, m) { var f = (0, o.ref)(null), g = (0, o.ref)(), T = (0, o.ref)(!1); function M(b) { T.value || (f.value = b); } function S() { l.default.cancel(g.value); } function A(b) { S(), g.value = (0, l.default)(function() { var p = f.value; switch (f.value) { case "align": p = "motion"; break; case "motion": p = "stable"; break; } M(p), b == null || b(); }); } return (0, o.watch)(u, function() { M("measure"); }, { immediate: !0, flush: "post" }), (0, o.onMounted)(function() { (0, o.watch)(f, function() { switch (f.value) { case "measure": m(); break; } f.value && (g.value = (0, l.default)(/* @__PURE__ */ (0, c.default)(/* @__PURE__ */ t.default.mark(function b() { var p, w; return t.default.wrap(function(x) { for (; ; ) switch (x.prev = x.next) { case 0: p = d.indexOf(f.value), w = d[p + 1], w && p !== -1 && M(w); case 3: case "end": return x.stop(); } }, b); })))); }, { immediate: !0, flush: "post" }); }), (0, o.onBeforeUnmount)(function() { T.value = !0, S(); }), [f, A]; }; return ue.default = v, ue; } var se = {}, qe; function Pt() { if (qe) return se; qe = 1, Object.defineProperty(se, "__esModule", { value: !0 }), se.default = void 0; var a = U, t = function(o) { var l = (0, a.ref)({ width: 0, height: 0 }); function d(r) { l.value = { width: r.offsetWidth, height: r.offsetHeight }; } var v = (0, a.computed)(function() { var r = {}; if (o.value) { var u = l.value, m = u.width, f = u.height; o.value.indexOf("height") !== -1 && f ? r.height = "".concat(f, "px") : o.value.indexOf("minHeight") !== -1 && f && (r.minHeight = "".concat(f, "px")), o.value.indexOf("width") !== -1 && m ? r.width = "".concat(m, "px") : o.value.indexOf("minWidth") !== -1 && m && (r.minWidth = "".concat(m, "px")); } return r; }); return [v, d]; }; return se.default = t, se; } var X = {}, le = {}, Ne; function Tt() { if (Ne) return le; Ne = 1, Object.defineProperty(le, "__esModule", { value: !0 }), le.default = void 0; var a = function(c) { if (!c) return !1; if (c.offsetParent) return !0; if (c.getBBox) { var o = c.getBBox(); if (o.width || o.height) return !0; } if (c.getBoundingClientRect) { var l = c.getBoundingClientRect(); if (l.width || l.height) return !0; } return !1; }; return le.default = a, le; } var Q = {}, $e; function _t() { if ($e) return Q; $e = 1; var a = V; Object.defineProperty(Q, "__esModule", { value: !0 }), Q.isSamePoint = l, Q.monitorResize = v, Q.restoreFocus = d; var t = a(be()), c = a(Ue()), o = a(dt); function l(r, u) { return r === u ? !0 : !r || !u ? !1 : "pageX" in u && "pageY" in u ? r.pageX === u.pageX && r.pageY === u.pageY : "clientX" in u && "clientY" in u ? r.clientX === u.clientX && r.clientY === u.clientY : !1; } function d(r, u) { r !== document.activeElement && (0, c.default)(u, r) && typeof r.focus == "function" && r.focus(); } function v(r, u) { var m = null, f = null; function g(M) { var S = (0, t.default)(M, 1), A = S[0].target; if (document.documentElement.contains(A)) { var b = A.getBoundingClientRect(), p = b.width, w = b.height, N = Math.floor(p), x = Math.floor(w); (m !== N || f !== x) && Promise.resolve().then(function() { u({ width: N, height: x }); }), m = N, f = x; } } var T = new o.default(g); return r && T.observe(r), function() { T.disconnect(); }; } return Q; } var fe = {}, ke; function bt() { if (ke) return fe; ke = 1, Object.defineProperty(fe, "__esModule", { value: !0 }), fe.default = void 0; var a = function(c, o) { var l = !1, d = null; function v() { clearTimeout(d); } function r(u) { if (!l || u === !0) { if (c() === !1) return; l = !0, v(), d = setTimeout(function() { l = !1; }, o.value); } else v(), d = setTimeout(function() { l = !1, r(); }, o.value); } return [r, function() { l = !1, v(); }]; }; return fe.default = a, fe; } var Ve; function Ct() { if (Ve) return X; Ve = 1; var a = V; Object.defineProperty(X, "__esModule", { value: !0 }), X.default = X.alignProps = void 0; var t = a(be()), c = a(Ce), o = U, l = ct, d = a(ze()), v = Xe(), r = a(Tt()), u = _t(), m = a(bt()), f = a(ft()), g = { align: Object, target: [Object, Function], onAlign: Function, monitorBufferTime: Number, monitorWindowResize: Boolean, disabled: Boolean }; X.alignProps = g; function T(A) { return typeof A != "function" ? null : A(); } function M(A) { return (0, c.default)(A) !== "object" || !A ? null : A; } var S = (0, o.defineComponent)({ compatConfig: { MODE: 3 }, name: "Align", props: g, emits: ["align"], setup: function(b, p) { var w = p.expose, N = p.slots, x = (0, o.ref)({}), $ = (0, o.ref)(), s = (0, m.default)(function() { var y = b.disabled, D = b.target, O = b.align, j = b.onAlign; if (!y && D && $.value) { var k = $.value, E, F = T(D), L = M(D); x.value.element = F, x.value.point = L, x.value.align = O; var Y = document, J = Y.activeElement; return F && (0, r.default)(F) ? E = (0, l.alignElement)(k, F, O) : L && (E = (0, l.alignPoint)(k, L, O)), (0, u.restoreFocus)(J, k), j && E && j(k, E), !0; } return !1; }, (0, o.computed)(function() { return b.monitorBufferTime; })), e = (0, t.default)(s, 2), i = e[0], n = e[1], h = (0, o.ref)({ cancel: function() { } }), C = (0, o.ref)({ cancel: function() { } }), P = function() { var D = b.target, O = T(D), j = M(D); $.value !== C.value.element && (C.value.cancel(), C.value.element = $.value, C.value.cancel = (0, u.monitorResize)($.value, i)), (x.value.element !== O || !(0, u.isSamePoint)(x.value.point, j) || !(0, f.default)(x.value.align, b.align)) && (i(), h.value.element !== O && (h.value.cancel(), h.value.element = O, h.value.cancel = (0, u.monitorResize)(O, i))); }; (0, o.onMounted)(function() { (0, o.nextTick)(function() { P(); }); }), (0, o.onUpdated)(function() { (0, o.nextTick)(function() { P(); }); }), (0, o.watch)(function() { return b.disabled; }, function(y) { y ? n() : i(); }, { immediate: !0, flush: "post" }); var _ = (0, o.ref)(null); return (0, o.watch)(function() { return b.monitorWindowResize; }, function(y) { y ? _.value || (_.value = (0, d.default)(window, "resize", i)) : _.value && (_.value.remove(), _.value = null); }, { flush: "post" }), (0, o.onUnmounted)(function() { h.value.cancel(), C.value.cancel(), _.value && _.value.remove(), n(); }), w({ forceAlign: function() { return i(!0); } }), function() { var y = N == null ? void 0 : N.default(); return y ? (0, v.cloneElement)(y[0], { ref: $ }, !0, !0) : null; }; } }); return X.default = S, X; } var Ee; function yt() { if (Ee) return ae; Ee = 1; var a = V; Object.defineProperty(ae, "__esModule", { value: !0 }), ae.default = void 0; var t = U, c = a(tt()), o = a(z()), l = a(Ce), d = a(be()), v = a(gt()), r = a(Pt()), u = a(Ct()), m = Ye(), f = he(), g = a(_e()), T = ye(), M = ot(), S = a(Le()), A = (0, t.defineComponent)({ compatConfig: { MODE: 3 }, name: "PopupInner", inheritAttrs: !1, props: T.innerProps, emits: ["mouseenter", "mouseleave", "mousedown", "touchstart", "align"], setup: function(p, w) { var N = w.expose, x = w.attrs, $ = w.slots, s = (0, t.ref)(), e = (0, t.ref)(), i = (0, t.ref)(), n = (0, r.default)((0, t.toRef)(p, "stretch")), h = (0, d.default)(n, 2), C = h[0], P = h[1], _ = function() { p.stretch && P(p.getRootDomNode()); }, y = (0, t.ref)(!1), D; (0, t.watch)(function() { return p.visible; }, function(R) { clearTimeout(D), R ? D = setTimeout(function() { y.value = p.visible; }) : y.value = !1; }, { immediate: !0 }); var O = (0, v.default)(y, _), j = (0, d.default)(O, 2), k = j[0], E = j[1], F = (0, t.ref)(), L = function() { return p.point ? p.point : p.getRootDomNode; }, Y = function() { var q; (q = s.value) === null || q === void 0 || q.forceAlign(); }, J = function(q, H) { var B = p.getClassNameFromAlign(H), K = i.value; if (i.value !== B && (i.value = B), k.value === "align") { var Z; K !== B ? Promise.resolve().then(function() { Y(); }) : E(function() { var ee; (ee = F.value) === null || ee === void 0 || ee.call(F); }), (Z = p.onAlign) === null || Z === void 0 || Z.call(p, q, H); } }, G = (0, t.computed)(function() { var R = (0, l.default)(p.animation) === "object" ? p.animation : (0, m.getMotion)(p); return ["onAfterEnter", "onAfterLeave"].forEach(function(q) { var H = R[q]; R[q] = function(B) { E(), k.value = "stable", H == null || H(B); }; }), R; }), ge = function() { return new Promise(function(q) { F.value = q; }); }; (0, t.watch)([G, k], function() { !G.value && k.value === "motion" && E(); }, { immediate: !0 }), N({ forceAlign: Y, getElement: function() { return e.value.$el || e.value; } }); var Pe = (0, t.computed)(function() { var R; return !((R = p.align) !== null && R !== void 0 && R.points && (k.value === "align" || k.value === "stable")); }); return function() { var R, q = p.zIndex, H = p.align, B = p.prefixCls, K = p.destroyPopupOnHide, Z = p.onMouseenter, ee = p.onMouseleave, we = p.onTouchstart, Ge = we === void 0 ? function() { } : we, Qe = p.onMousedown, Te = k.value, Je = [(0, o.default)((0, o.default)({}, C.value), {}, { zIndex: q, opacity: Te === "motion" || Te === "stable" || !y.value ? null : 0, // pointerEvents: statusValue === 'stable' ? null : 'none', pointerEvents: !y.value && Te !== "stable" ? "none" : null }), x.style], pe = (0, f.flattenChildren)((R = $.default) === null || R === void 0 ? void 0 : R.call($, { visible: p.visible })); pe.length > 1 && (pe = (0, t.createVNode)("div", { class: "".concat(B, "-content") }, [pe])); var Ke = (0, g.default)(B, x.class, i.value), Ze = y.value || !p.visible, et = Ze ? (0, M.getTransitionProps)(G.value.name, G.value) : {}; return (0, t.createVNode)(t.Transition, (0, o.default)((0, o.default)({ ref: e }, et), {}, { onBeforeEnter: ge }), { default: function() { return !K || p.visible ? (0, t.withDirectives)((0, t.createVNode)(u.default, { target: L(), key: "popup", ref: s, monitorWindowResize: !0, disabled: Pe.value, align: H, onAlign: J }, { default: function() { return (0, t.createVNode)("div", (0, o.default)((0, o.default)({ class: Ke, onMouseenter: Z, onMouseleave: ee, onMousedown: (0, t.withModifiers)(Qe, ["capture"]) }, (0, c.default)({}, S.default ? "onTouchstartPassive" : "onTouchstart", (0, t.withModifiers)(Ge, ["capture"]))), {}, { style: Je }), [pe]); } }), [[t.vShow, y.value]]) : null; } }); }; } }); return ae.default = A, ae; } var Fe; function wt() { if (Fe) return oe; Fe = 1; var a = V; Object.defineProperty(oe, "__esModule", { value: !0 }), oe.default = void 0; var t = U, c = a(z()), o = ye(), l = a(mt()), d = a(ht()), v = a(yt()), r = (0, t.defineComponent)({ compatConfig: { MODE: 3 }, name: "Popup", inheritAttrs: !1, props: o.popupProps, setup: function(m, f) { var g = f.attrs, T = f.slots, M = f.expose, S = (0, t.ref)(!1), A = (0, t.ref)(!1), b = (0, t.ref)(); return (0, t.watch)([function() { return m.visible; }, function() { return m.mobile; }], function() { S.value = m.visible, m.visible && m.mobile && (A.value = !0); }, { immediate: !0, flush: "post" }), M({ forceAlign: function() { var w; (w = b.value) === null || w === void 0 || w.forceAlign(); }, getElement: function() { var w; return (w = b.value) === null || w === void 0 ? void 0 : w.getElement(); } }), function() { var p = (0, c.default)((0, c.default)((0, c.default)({}, m), g), {}, { visible: S.value }), w = A.value ? (0, t.createVNode)(d.default, (0, c.default)((0, c.default)({}, p), {}, { mobile: m.mobile, ref: b }), { default: T.default }) : (0, t.createVNode)(v.default, (0, c.default)((0, c.default)({}, p), {}, { ref: b }), { default: T.default }); return (0, t.createVNode)("div", null, [(0, t.createVNode)(l.default, p, null), w]); }; } }); return oe.default = r, oe; } var ce = {}, He; function Mt() { if (He) return ce; He = 1; var a = V; Object.defineProperty(ce, "__esModule", { value: !0 }), ce.getAlignFromPlacement = o, ce.getAlignPopupClassName = l; var t = a(z()); function c(d, v, r) { return r ? d[0] === v[0] : d[0] === v[0] && d[1] === v[1]; } function o(d, v, r) { var u = d[v] || {}; return (0, t.default)((0, t.default)({}, u), r); } function l(d, v, r, u) { for (var m = r.points, f = Object.keys(d), g = 0; g < f.length; g += 1) { var T = f[g]; if (c(d[T].points, m, u)) return "".concat(v, "-placement-").concat(T); } return ""; } return ce; } var de = {}, Be; function At() { if (Be) return de; Be = 1; var a = V; Object.defineProperty(de, "__esModule", { value: !0 }), de.default = void 0; var t = a(rt()), c = a(it()), o = a(z()), l = U, d = he(), v = { methods: { setState: function() { var u = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, m = arguments.length > 1 ? arguments[1] : void 0, f = typeof u == "function" ? u(this.$data, this.$props) : u; if (this.getDerivedStateFromProps) { var g = this.getDerivedStateFromProps((0, d.getOptionProps)(this), (0, o.default)((0, o.default)({}, this.$data), f)); if (g === null) return; f = (0, o.default)((0, o.default)({}, f), g || {}); } (0, c.default)(this.$data, f), this._.isMounted && this.$forceUpdate(), (0, l.nextTick)(function() { m && m(); }); }, __emit: function() { var u = [].slice.call(arguments, 0), m = u[0]; m = "on".concat(m[0].toUpperCase()).concat(m.substring(1)); var f = this.$props[m] || this.$attrs[m]; if (u.length && f) if (Array.isArray(f)) for (var g = 0, T = f.length; g < T; g++) f[g].apply(f, (0, t.default)(u.slice(1))); else f.apply(void 0, (0, t.default)(u.slice(1))); } } }; return de.default = v, de; } var je; function xt() { if (je) return ie; je = 1; var a = V; Object.defineProperty(ie, "__esModule", { value: !0 }), ie.default = void 0; var t = U, c = a(z()), o = a(at()), l = a(Ue()), d = a(We()), v = he(), r = vt(), u = a(ze()), m = a(wt()), f = Mt(), g = a(At()), T = a(ut()), M = a(_e()), S = Xe(), A = a(Le()), b = st(); function p() { } function w() { return ""; } function N(s) { return s ? s.ownerDocument : window.document; } var x = ["onClick", "onMousedown", "onTouchstart", "onMouseenter", "onMouseleave", "onFocus", "onBlur", "onContextmenu"], $ = (0, t.defineComponent)({ compatConfig: { MODE: 3 }, name: "Trigger", mixins: [g.default], inheritAttrs: !1, props: { action: o.default.oneOfType([o.default.string, o.default.arrayOf(o.default.string)]).def([]), showAction: o.default.any.def([]), hideAction: o.default.any.def([]), getPopupClassNameFromAlign: o.default.any.def(w), onPopupVisibleChange: Function, afterPopupVisibleChange: o.default.func.def(p), popup: o.default.any, popupStyle: { type: Object, default: void 0 }, prefixCls: o.default.string.def("rc-trigger-popup"), popupClassName: o.default.string.def(""), popupPlacement: String, builtinPlacements: o.default.object, popupTransitionName: String, popupAnimation: o.default.any, mouseEnterDelay: o.default.number.def(0), mouseLeaveDelay: o.default.number.def(0.1), zIndex: Number, focusDelay: o.default.number.def(0), blurDelay: o.default.number.def(0.15), getPopupContainer: Function, getDocument: o.default.func.def(N), forceRender: { type: Boolean, default: void 0 }, destroyPopupOnHide: { type: Boolean, default: !1 }, mask: { type: Boolean, default: !1 }, maskClosable: { type: Boolean, default: !0 }, // onPopupAlign: PropTypes.func.def(noop), popupAlign: o.default.object.def(function() { return {}; }), popupVisible: { type: Boolean, default: void 0 }, defaultPopupVisible: { type: Boolean, default: !1 }, maskTransitionName: String, maskAnimation: String, stretch: String, alignPoint: { type: Boolean, default: void 0 }, autoDestroy: { type: Boolean, default: !1 }, mobile: Object, getTriggerDOMNode: Function, // portal context will change tryPopPortal: Boolean // no need reactive }, setup: function(e) { var i = (0, t.computed)(function() { var y = e.popupPlacement, D = e.popupAlign, O = e.builtinPlacements; return y && O ? (0, f.getAlignFromPlacement)(O, y, D) : D; }), n = (0, b.useInjectTrigger)(e.tryPopPortal), h = n.setPortal, C = n.popPortal, P = (0, t.ref)(null), _ = function(D) { P.value = D; }; return { popPortal: C, setPortal: h, vcTriggerContext: (0, t.inject)("vcTriggerContext", {}), popupRef: P, setPopupRef: _, triggerRef: (0, t.ref)(null), align: i, focusTime: null, clickOutsideHandler: null, contextmenuOutsideHandler1: null, contextmenuOutsideHandler2: null, touchOutsideHandler: null, attachId: null, delayTimer: null, hasPopupMouseDown: !1, preClickTime: null, preTouchTime: null, mouseDownTimeout: null, childOriginEvents: {} }; }, data: function() { var e = this, i, n = this.$props, h; return this.popupVisible !== void 0 ? h = !!n.popupVisible : h = !!n.defaultPopupVisible, x.forEach(function(C) { e["fire".concat(C)] = function(P) { e.fireEvents(C, P); }; }), (i = this.setPortal) === null || i === void 0 || i.call(this, (0, t.createVNode)(T.default, { key: "portal", getContainer: this.getContainer, didUpdate: this.handlePortalUpdate }, { default: this.getComponent })), { prevPopupVisible: h, sPopupVisible: h, point: null }; }, watch: { popupVisible: function(e) { e !== void 0 && (this.prevPopupVisible = this.sPopupVisible, this.sPopupVisible = e); } }, created: function() { (0, t.provide)("vcTriggerContext", { onPopupMouseDown: this.onPopupMouseDown }), (0, b.useProvidePortal)(this); }, deactivated: function() { this.setPopupVisible(!1); }, mounted: function() { var e = this; this.$nextTick(function() { e.updatedCal(); }); }, updated: function() { var e = this; this.$nextTick(function() { e.updatedCal(); }); }, beforeUnmount: function() { this.clearDelayTimer(), this.clearOutsideHandler(), clearTimeout(this.mouseDownTimeout), d.default.cancel(this.attachId); }, methods: { updatedCal: function() { var e = this.$props, i = this.$data; if (i.sPopupVisible) { var n; !this.clickOutsideHandler && (this.isClickToHide() || this.isContextmenuToShow()) && (n = e.getDocument(this.getRootDomNode()), this.clickOutsideHandler = (0, u.default)(n, "mousedown", this.onDocumentClick)), this.touchOutsideHandler || (n = n || e.getDocument(this.getRootDomNode()), this.touchOutsideHandler = (0, u.default)(n, "touchstart", this.onDocumentClick, A.default ? { passive: !1 } : !1)), !this.contextmenuOutsideHandler1 && this.isContextmenuToShow() && (n = n || e.getDocument(this.getRootDomNode()), this.contextmenuOutsideHandler1 = (0, u.default)(n, "scroll", this.onContextmenuClose)), !this.contextmenuOutsideHandler2 && this.isContextmenuToShow() && (this.contextmenuOutsideHandler2 = (0, u.default)(window, "blur", this.onContextmenuClose)); } else this.clearOutsideHandler(); }, onMouseenter: function(e) { var i = this.$props.mouseEnterDelay; this.fireEvents("onMouseenter", e), this.delaySetPopupVisible(!0, i, i ? null : e); }, onMouseMove: function(e) { this.fireEvents("onMousemove", e), this.setPoint(e); }, onMouseleave: function(e) { this.fireEvents("onMouseleave", e), this.delaySetPopupVisible(!1, this.$props.mouseLeaveDelay); }, onPopupMouseenter: function() { this.clearDelayTimer(); }, onPopupMouseleave: function(e) { var i; e && e.relatedTarget && !e.relatedTarget.setTimeout && (0, l.default)((i = this.popupRef) === null || i === void 0 ? void 0 : i.getElement(), e.relatedTarget) || this.delaySetPopupVisible(!1, this.$props.mouseLeaveDelay); }, onFocus: function(e) { this.fireEvents("onFocus", e), this.clearDelayTimer(), this.isFocusToShow() && (this.focusTime = Date.now(), this.delaySetPopupVisible(!0, this.$props.focusDelay)); }, onMousedown: function(e) { this.fireEvents("onMousedown", e), this.preClickTime = Date.now(); }, onTouchstart: function(e) { this.fireEvents("onTouchstart", e), this.preTouchTime = Date.now(); }, onBlur: function(e) { (0, l.default)(e.target, e.relatedTarget || document.activeElement) || (this.fireEvents("onBlur", e), this.clearDelayTimer(), this.isBlurToHide() && this.delaySetPopupVisible(!1, this.$props.blurDelay)); }, onContextmenu: function(e) { e.preventDefault(), this.fireEvents("onContextmenu", e), this.setPopupVisible(!0, e); }, onContextmenuClose: function() { this.isContextmenuToShow() && this.close(); }, onClick: function(e) { if (this.fireEvents("onClick", e), this.focusTime) { var i; if (this.preClickTime && this.preTouchTime ? i = Math.min(this.preClickTime, this.preTouchTime) : this.preClickTime ? i = this.preClickTime : this.preTouchTime && (i = this.preTouchTime), Math.abs(i - this.focusTime) < 20) return; this.focusTime = 0; } this.preClickTime = 0, this.preTouchTime = 0, this.isClickToShow() && (this.isClickToHide() || this.isBlurToHide()) && e && e.preventDefault && e.preventDefault(), e && e.domEvent && e.domEvent.preventDefault(); var n = !this.$data.sPopupVisible; (this.isClickToHide() && !n || n && this.isClickToShow()) && this.setPopupVisible(!this.$data.sPopupVisible, e); }, onPopupMouseDown: function() { var e = this, i = this.vcTriggerContext, n = i === void 0 ? {} : i; this.hasPopupMouseDown = !0, clearTimeout(this.mouseDownTimeout), this.mouseDownTimeout = setTimeout(function() { e.hasPopupMouseDown = !1; }, 0), n.onPopupMouseDown && n.onPopupMouseDown.apply(n, arguments); }, onDocumentClick: function(e) { if (!(this.$props.mask && !this.$props.maskClosable)) { var i = e.target, n = this.getRootDomNode(), h = this.getPopupDomNode(); // mousedown on the target should also close popup when action is contextMenu. // https://github.com/ant-design/ant-design/issues/29853 (!(0, l.default)(n, i) || this.isContextMenuOnly()) && !(0, l.default)(h, i) && !this.hasPopupMouseDown && this.delaySetPopupVisible(!1, 0.1); } }, getPopupDomNode: function() { var e; return ((e = this.popupRef) === null || e === void 0 ? void 0 : e.getElement()) || null; }, getRootDomNode: function() { var e = this.$props.getTriggerDOMNode; if (e) { var i = (0, v.findDOMNode)(this.triggerRef); return (0, v.findDOMNode)(e(i)); } try { var n = (0, v.findDOMNode)(this.triggerRef); if (n) return n; } catch { } return (0, v.findDOMNode)(this); }, handleGetPopupClassFromAlign: function(e) { var i = [], n = this.$props, h = n.popupPlacement, C = n.builtinPlacements, P = n.prefixCls, _ = n.alignPoint, y = n.getPopupClassNameFromAlign; return h && C && i.push((0, f.getAlignPopupClassName)(C, P, e, _)), y && i.push(y(e)), i.join(" "); }, getPopupAlign: function() { var e = this.$props, i = e.popupPlacement, n = e.popupAlign, h = e.builtinPlacements; return i && h ? (0, f.getAlignFromPlacement)(h, i, n) : n; }, getComponent: function() { var e = this, i = {}; this.isMouseEnterToShow() && (i.onMouseenter = this.onPopupMouseenter), this.isMouseLeaveToHide() && (i.onMouseleave = this.onPopupMouseleave), i.onMousedown = this.onPopupMouseDown, i[A.default ? "onTouchstartPassive" : "onTouchstart"] = this.onPopupMouseDown; var n = this.handleGetPopupClassFromAlign, h = this.getRootDomNode, C = this.getContainer, P = this.$attrs, _ = this.$props, y = _.prefixCls, D = _.destroyPopupOnHide, O = _.popupClassName, j = _.popupAnimation, k = _.popupTransitionName, E = _.popupStyle, F = _.mask, L = _.maskAnimation, Y = _.maskTransitionName, J = _.zIndex, G = _.stretch, ge = _.alignPoint, Pe = _.mobile, R = _.forceRender, q = this.$data, H = q.sPopupVisible, B = q.point, K = (0, c.default)((0, c.default)({ prefixCls: y, destroyPopupOnHide: D, visible: H, point: ge ? B : null, align: this.align, animation: j, getClassNameFromAlign: n, stretch: G, getRootDomNode: h, mask: F, zIndex: J, transitionName: k, maskAnimation: L, maskTransitionName: Y, getContainer: C, class: O, style: E, onAlign: P.onPopupAlign || p }, i), {}, { ref: this.setPopupRef, mobile: Pe, forceRender: R }); return (0, t.createVNode)(m.default, K, { default: this.$slots.popup || function() { return (0, v.getComponent)(e, "popup"); } }); }, attachParent: function(e) { var i = this; d.default.cancel(this.attachId); var n = this.$props, h = n.getPopupContainer, C = n.getDocument, P = this.getRootDomNode(), _; h ? (P || h.length === 0) && (_ = h(P)) : _ = C(this.getRootDomNode()).body, _ ? _.appendChild(e) : this.attachId = (0, d.default)(function() { i.attachParent(e); }); }, getContainer: function() { var e = this.$props, i = e.getDocument, n = i(this.getRootDomNode()).createElement("div"); return n.style.position = "absolute", n.style.top = "0", n.style.left = "0", n.style.width = "100%", this.attachParent(n), n; }, setPopupVisible: function(e, i) { var n = this.alignPoint, h = this.sPopupVisible, C = this.onPopupVisibleChange; this.clearDelayTimer(), h !== e && ((0, v.hasProp)(this, "popupVisible") || this.setState({ sPopupVisible: e, prevPopupVisible: h }), C && C(e)), n && i && e && this.setPoint(i); }, setPoint: function(e) { var i = this.$props.alignPoint; !i || !e || this.setState({ point: { pageX: e.pageX, pageY: e.pageY } }); }, handlePortalUpdate: function() { this.prevPopupVisible !== this.sPopupVisible && this.afterPopupVisibleChange(this.sPopupVisible); }, delaySetPopupVisible: function(e, i, n) { var h = this, C = i * 1e3; if (this.clearDelayTimer(), C) { var P = n ? { pageX: n.pageX, pageY: n.pageY } : null; this.delayTimer = (0, r.requestAnimationTimeout)(function() { h.setPopupVisible(e, P), h.clearDelayTimer(); }, C); } else this.setPopupVisible(e, n); }, clearDelayTimer: function() { this.delayTimer && ((0, r.cancelAnimationTimeout)(this.delayTimer), this.delayTimer = null); }, clearOutsideHandler: function() { this.clickOutsideHandler && (this.clickOutsideHandler.remove(), this.clickOutsideHandler = null), this.contextmenuOutsideHandler1 && (this.contextmenuOutsideHandler1.remove(), this.contextmenuOutsideHandler1 = null), this.contextmenuOutsideHandler2 && (this.contextmenuOutsideHandler2.remove(), this.contextmenuOutsideHandler2 = null), this.touchOutsideHandler && (this.touchOutsideHandler.remove(), this.touchOutsideHandler = null); }, createTwoChains: function(e) { var i = function() { }, n = (0, v.getEvents)(this); return this.childOriginEvents[e] && n[e] ? this["fire".concat(e)] : (i = this.childOriginEvents[e] || n[e] || i, i); }, isClickToShow: function() { var e = this.$props, i = e.action, n = e.showAction; return i.indexOf("click") !== -1 || n.indexOf("click") !== -1; }, isContextMenuOnly: function() { var e = this.$props.action; return e === "contextmenu" || e.length === 1 && e[0] === "contextmenu"; }, isContextmenuToShow: function() { var e = this.$props, i = e.action, n = e.showAction; return i.indexOf("contextmenu") !== -1 || n.indexOf("contextmenu") !== -1; }, isClickToHide: function() { var e = this.$props, i = e.action, n = e.hideAction; return i.indexOf("click") !== -1 || n.indexOf("click") !== -1; }, isMouseEnterToShow: function() { var e = this.$props, i = e.action, n = e.showAction; return i.indexOf("hover") !== -1 || n.indexOf("mouseenter") !== -1; }, isMouseLeaveToHide: function() { var e = this.$props, i = e.action, n = e.hideAction; return i.indexOf("hover") !== -1 || n.indexOf("mouseleave") !== -1; }, isFocusToShow: function() { var e = this.$props, i = e.action, n = e.showAction; return i.indexOf("focus") !== -1 || n.indexOf("focus") !== -1; }, isBlurToHide: function() { var e = this.$props, i = e.action, n = e.hideAction; return i.indexOf("focus") !== -1 || n.indexOf("blur") !== -1; }, forcePopupAlign: function() { if (this.$data.sPopupVisible) { var e; (e = this.popupRef) === null || e === void 0 || e.forceAlign(); } }, fireEvents: function(e, i) { this.childOriginEvents[e] && this.childOriginEvents[e](i); var n = this.$props[e] || this.$attrs[e]; n && n(i); }, close: function() { this.setPopupVisible(!1); } }, render: function() { var e = this, i = this.$attrs, n = (0, v.filterEmpty)((0, v.getSlot)(this)), h = this.$props.alignPoint, C = n[0]; this.childOriginEvents = (0, v.getEvents)(C); var P = { key: "trigger" }; this.isContextmenuToShow() ? P.onContextmenu = this.onContextmenu : P.onContextmenu = this.createTwoChains("onContextmenu"), this.isClickToHide() || this.isClickToShow() ? (P.onClick = this.onClick, P.onMousedown = this.onMousedown, P[A.default ? "onTouchstartPassive" : "onTouchstart"] = this.onTouchstart) : (P.onClick = this.createTwoChains("onClick"), P.onMousedown = this.createTwoChains("onMousedown"), P[A.default ? "onTouchstartPassive" : "onTouchstart"] = this.createTwoChains("onTouchstart")), this.isMouseEnterToShow() ? (P.onMouseenter = this.onMouseenter, h && (P.onMousemove = this.onMouseMove)) : P.onMouseenter = this.createTwoChains("onMouseenter"), this.isMouseLeaveToHide() ? P.onMouseleave = this.onMouseleave : P.onMouseleave = this.createTwoChains("onMouseleave"), this.isFocusToShow() || this.isBlurToHide() ? (P.onFocus = this.onFocus, P.onBlur = this.onBlur) : (P.onFocus = this.createTwoChains("onFocus"), P.onBlur = function(O) { O && (!O.relatedTarget || !(0, l.default)(O.target, O.relatedTarget)) && e.createTwoChains("onBlur")(O); }); var _ = (0, M.default)(C && C.props && C.props.class, i.class); _ && (P.class = _); var y = (0, S.cloneElement)(C, (0, c.default)((0, c.default)({}, P), {}, { ref: "triggerRef" }), !0, !0); if (this.popPortal) return y; var D = (0, t.createVNode)(T.default, { key: "portal", getContainer: this.getContainer, didUpdate: this.handlePortalUpdate }, { default: this.getComponent }); return (0, t.createVNode)(t.Fragment, null, [D, y]); } }); return ie.default = $, ie; } var Ie; function jt() { if (Ie) return te; Ie = 1; var a = V; Object.defineProperty(te, "__esModule", { value: !0 }), te.default = void 0; var t = a(xt()), c = t.default; return te.default = c, te; } export { At as a, Tt as b, jt as r };