@coderlt/form-designer
Version:
基于vue3的设计器,可视化开发页面表单
1,254 lines (1,253 loc) • 39.5 kB
JavaScript
import { i as R } from "./interopRequireDefault-40f894e3.js";
import { r as V } from "./_vue_commonjs-external-eb7fec7f.js";
import { r as U, a as oe } from "./public_api-1267ff2a.js";
import { r as Be } from "./index-f96a976e.js";
import { b as ne, d as de, m as xe } from "./useConfigInject-d85d8c62.js";
import { r as De } from "./raf-dd6c1047.js";
import { r as Re, a as Ne, b as Se, c as je, d as Ue } from "./PortalWrapper-9d2c005f.js";
import { m as Ie, n as ze } from "./isEqual-b1699f9b.js";
import { r as Ae } from "./vnode-45aa23d5.js";
import { r as Le } from "./isVisible-f22c1e3a.js";
import { r as We } from "./ResizeObserver.es-df63660c.js";
import { r as Xe } from "./transition-d16825f8.js";
var le = {}, W = {}, I = {}, fe;
function $e() {
if (fe)
return I;
fe = 1;
var s = R;
Object.defineProperty(I, "__esModule", {
value: !0
}), I.noop = m, I.triggerProps = void 0;
var t = s(Be());
function a() {
return "";
}
function h(o) {
return o ? o.ownerDocument : window.document;
}
function m() {
}
const c = () => ({
action: t.default.oneOfType([t.default.string, t.default.arrayOf(t.default.string)]).def([]),
showAction: t.default.any.def([]),
hideAction: t.default.any.def([]),
getPopupClassNameFromAlign: t.default.any.def(a),
onPopupVisibleChange: Function,
afterPopupVisibleChange: t.default.func.def(m),
popup: t.default.any,
popupStyle: {
type: Object,
default: void 0
},
prefixCls: t.default.string.def("rc-trigger-popup"),
popupClassName: t.default.string.def(""),
popupPlacement: String,
builtinPlacements: t.default.object,
popupTransitionName: String,
popupAnimation: t.default.any,
mouseEnterDelay: t.default.number.def(0),
mouseLeaveDelay: t.default.number.def(0.1),
zIndex: Number,
focusDelay: t.default.number.def(0),
blurDelay: t.default.number.def(0.15),
getPopupContainer: Function,
getDocument: t.default.func.def(h),
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: t.default.object.def(() => ({})),
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
});
return I.triggerProps = c, I;
}
var X = {}, k = {}, pe;
function ce() {
if (pe)
return k;
pe = 1;
var s = R;
Object.defineProperty(k, "__esModule", {
value: !0
}), k.popupProps = k.mobileProps = k.innerProps = void 0;
var t = s(U());
const a = {
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
}
};
k.innerProps = a;
const h = (0, t.default)((0, t.default)({}, a), {
mobile: {
type: Object
}
});
k.mobileProps = h;
const m = (0, t.default)((0, t.default)({}, a), {
mask: Boolean,
mobile: {
type: Object
},
maskAnimation: String,
maskTransitionName: String
});
return k.popupProps = m, k;
}
var ie = {}, he;
function Ye() {
if (he)
return ie;
he = 1;
var s = R;
Object.defineProperty(ie, "__esModule", {
value: !0
}), ie.default = m;
var t = V, a = s(oe()), h = Re();
function m(c) {
const {
prefixCls: o,
visible: r,
zIndex: u,
mask: v,
maskAnimation: M,
maskTransitionName: g
} = c;
if (!v)
return null;
let b = {};
return (g || M) && (b = (0, h.getMotion)({
prefixCls: o,
transitionName: g,
animation: M
})), (0, t.createVNode)(t.Transition, (0, a.default)({
appear: !0
}, b), {
default: () => [(0, t.withDirectives)((0, t.createVNode)("div", {
style: {
zIndex: u
},
class: `${o}-mask`
}, null), [[(0, t.resolveDirective)("if"), r]])]
});
}
return m.displayName = "Mask", ie;
}
var Y = {}, me;
function Ge() {
if (me)
return Y;
me = 1;
var s = R;
Object.defineProperty(Y, "__esModule", {
value: !0
}), Y.default = void 0;
var t = V, a = s(oe()), h = s(U()), m = ne(), c = s(de()), o = ce(), r = (0, t.defineComponent)({
compatConfig: {
MODE: 3
},
name: "MobilePopupInner",
inheritAttrs: !1,
props: o.mobileProps,
emits: ["mouseenter", "mouseleave", "mousedown", "touchstart", "align"],
setup(u, v) {
let {
expose: M,
slots: g
} = v;
const b = (0, t.ref)();
return M({
forceAlign: () => {
},
getElement: () => b.value
}), () => {
var P;
const {
zIndex: l,
visible: y,
prefixCls: T,
mobile: {
popupClassName: C,
popupStyle: e,
popupMotion: i = {},
popupRender: n
} = {}
} = u, f = (0, h.default)({
zIndex: l
}, e);
let d = (0, m.flattenChildren)((P = g.default) === null || P === void 0 ? void 0 : P.call(g));
d.length > 1 && (d = (0, t.createVNode)("div", {
class: `${T}-content`
}, [d])), n && (d = n(d));
const p = (0, c.default)(T, C);
return (0, t.createVNode)(t.Transition, (0, a.default)({
ref: b
}, i), {
default: () => [y ? (0, t.createVNode)("div", {
class: p,
style: f
}, [d]) : null]
});
};
}
});
return Y.default = r, Y;
}
var G = {}, Q = {}, ve;
function Qe() {
if (ve)
return Q;
ve = 1;
var s = R;
Object.defineProperty(Q, "__esModule", {
value: !0
}), Q.default = void 0;
var t = V, a = s(De()), h = function(o, r, u, v) {
function M(g) {
return g instanceof u ? g : new u(function(b) {
b(g);
});
}
return new (u || (u = Promise))(function(g, b) {
function P(T) {
try {
y(v.next(T));
} catch (C) {
b(C);
}
}
function l(T) {
try {
y(v.throw(T));
} catch (C) {
b(C);
}
}
function y(T) {
T.done ? g(T.value) : M(T.value).then(P, l);
}
y((v = v.apply(o, r || [])).next());
});
};
const m = ["measure", "align", null, "motion"];
var c = (o, r) => {
const u = (0, t.shallowRef)(null), v = (0, t.shallowRef)(), M = (0, t.shallowRef)(!1);
function g(l) {
M.value || (u.value = l);
}
function b() {
a.default.cancel(v.value);
}
function P(l) {
b(), v.value = (0, a.default)(() => {
let y = u.value;
switch (u.value) {
case "align":
y = "motion";
break;
case "motion":
y = "stable";
break;
}
g(y), l == null || l();
});
}
return (0, t.watch)(o, () => {
g("measure");
}, {
immediate: !0,
flush: "post"
}), (0, t.onMounted)(() => {
(0, t.watch)(u, () => {
switch (u.value) {
case "measure":
r();
break;
}
u.value && (v.value = (0, a.default)(() => h(void 0, void 0, void 0, function* () {
const l = m.indexOf(u.value), y = m[l + 1];
y && l !== -1 && g(y);
})));
}, {
immediate: !0,
flush: "post"
});
}), (0, t.onBeforeUnmount)(() => {
M.value = !0, b();
}), [u, P];
};
return Q.default = c, Q;
}
var J = {}, ge;
function Je() {
if (ge)
return J;
ge = 1, Object.defineProperty(J, "__esModule", {
value: !0
}), J.default = void 0;
var s = V, t = (a) => {
const h = (0, s.shallowRef)({
width: 0,
height: 0
});
function m(o) {
h.value = {
width: o.offsetWidth,
height: o.offsetHeight
};
}
return [(0, s.computed)(() => {
const o = {};
if (a.value) {
const {
width: r,
height: u
} = h.value;
a.value.indexOf("height") !== -1 && u ? o.height = `${u}px` : a.value.indexOf("minHeight") !== -1 && u && (o.minHeight = `${u}px`), a.value.indexOf("width") !== -1 && r ? o.width = `${r}px` : a.value.indexOf("minWidth") !== -1 && r && (o.minWidth = `${r}px`);
}
return o;
}), m];
};
return J.default = t, J;
}
var j = {}, z = {}, Pe;
function Ke() {
if (Pe)
return z;
Pe = 1;
var s = R;
Object.defineProperty(z, "__esModule", {
value: !0
}), z.isSamePoint = h, z.monitorResize = c, z.restoreFocus = m;
var t = s(xe()), a = s(We);
function h(o, r) {
return o === r ? !0 : !o || !r ? !1 : "pageX" in r && "pageY" in r ? o.pageX === r.pageX && o.pageY === r.pageY : "clientX" in r && "clientY" in r ? o.clientX === r.clientX && o.clientY === r.clientY : !1;
}
function m(o, r) {
o !== document.activeElement && (0, t.default)(r, o) && typeof o.focus == "function" && o.focus();
}
function c(o, r) {
let u = null, v = null;
function M(b) {
let [{
target: P
}] = b;
if (!document.documentElement.contains(P))
return;
const {
width: l,
height: y
} = P.getBoundingClientRect(), T = Math.floor(l), C = Math.floor(y);
(u !== T || v !== C) && Promise.resolve().then(() => {
r({
width: T,
height: C
});
}), u = T, v = C;
}
const g = new a.default(M);
return o && g.observe(o), () => {
g.disconnect();
};
}
return z;
}
var K = {}, be;
function Ze() {
if (be)
return K;
be = 1, Object.defineProperty(K, "__esModule", {
value: !0
}), K.default = void 0;
var s = (t, a) => {
let h = !1, m = null;
function c() {
clearTimeout(m);
}
function o(r) {
if (!h || r === !0) {
if (t() === !1)
return;
h = !0, c(), m = setTimeout(() => {
h = !1;
}, a.value);
} else
c(), m = setTimeout(() => {
h = !1, o();
}, a.value);
}
return [o, () => {
h = !1, c();
}];
};
return K.default = s, K;
}
var Te;
function et() {
if (Te)
return j;
Te = 1;
var s = R;
Object.defineProperty(j, "__esModule", {
value: !0
}), j.default = j.alignProps = void 0;
var t = V, a = ze, h = s(Ne()), m = Ae(), c = s(Le()), o = Ke(), r = s(Ze()), u = s(Ie());
const v = {
align: Object,
target: [Object, Function],
onAlign: Function,
monitorBufferTime: Number,
monitorWindowResize: Boolean,
disabled: Boolean
};
j.alignProps = v;
function M(P) {
return typeof P != "function" ? null : P();
}
function g(P) {
return typeof P != "object" || !P ? null : P;
}
var b = (0, t.defineComponent)({
compatConfig: {
MODE: 3
},
name: "Align",
props: v,
emits: ["align"],
setup(P, l) {
let {
expose: y,
slots: T
} = l;
const C = (0, t.ref)({}), e = (0, t.ref)(), [i, n] = (0, r.default)(() => {
const {
disabled: _,
target: D,
align: O,
onAlign: q
} = P;
if (!_ && D && e.value) {
const S = e.value;
let E;
const A = M(D), B = g(D);
C.value.element = A, C.value.point = B, C.value.align = O;
const {
activeElement: H
} = document;
return A && (0, c.default)(A) ? E = (0, a.alignElement)(S, A, O) : B && (E = (0, a.alignPoint)(S, B, O)), (0, o.restoreFocus)(H, S), q && E && q(S, E), !0;
}
return !1;
}, (0, t.computed)(() => P.monitorBufferTime)), f = (0, t.ref)({
cancel: () => {
}
}), d = (0, t.ref)({
cancel: () => {
}
}), p = () => {
const _ = P.target, D = M(_), O = g(_);
e.value !== d.value.element && (d.value.cancel(), d.value.element = e.value, d.value.cancel = (0, o.monitorResize)(e.value, i)), (C.value.element !== D || !(0, o.isSamePoint)(C.value.point, O) || !(0, u.default)(C.value.align, P.align)) && (i(), f.value.element !== D && (f.value.cancel(), f.value.element = D, f.value.cancel = (0, o.monitorResize)(D, i)));
};
(0, t.onMounted)(() => {
(0, t.nextTick)(() => {
p();
});
}), (0, t.onUpdated)(() => {
(0, t.nextTick)(() => {
p();
});
}), (0, t.watch)(() => P.disabled, (_) => {
_ ? n() : i();
}, {
immediate: !0,
flush: "post"
});
const x = (0, t.ref)(null);
return (0, t.watch)(() => P.monitorWindowResize, (_) => {
_ ? x.value || (x.value = (0, h.default)(window, "resize", i)) : x.value && (x.value.remove(), x.value = null);
}, {
flush: "post"
}), (0, t.onUnmounted)(() => {
f.value.cancel(), d.value.cancel(), x.value && x.value.remove(), n();
}), y({
forceAlign: () => i(!0)
}), () => {
const _ = T == null ? void 0 : T.default();
return _ ? (0, m.cloneElement)(_[0], {
ref: e
}, !0, !0) : null;
};
}
});
return j.default = b, j;
}
var _e;
function tt() {
if (_e)
return G;
_e = 1;
var s = R;
Object.defineProperty(G, "__esModule", {
value: !0
}), G.default = void 0;
var t = V, a = s(oe()), h = s(U()), m = s(Qe()), c = s(Je()), o = s(et()), r = Re(), u = ne(), v = s(de()), M = ce(), g = Xe(), b = s(Se()), P = (0, t.defineComponent)({
compatConfig: {
MODE: 3
},
name: "PopupInner",
inheritAttrs: !1,
props: M.innerProps,
emits: ["mouseenter", "mouseleave", "mousedown", "touchstart", "align"],
setup(l, y) {
let {
expose: T,
attrs: C,
slots: e
} = y;
const i = (0, t.shallowRef)(), n = (0, t.shallowRef)(), f = (0, t.shallowRef)(), [d, p] = (0, c.default)((0, t.toRef)(l, "stretch")), x = () => {
l.stretch && p(l.getRootDomNode());
}, _ = (0, t.shallowRef)(!1);
let D;
(0, t.watch)(() => l.visible, (w) => {
clearTimeout(D), w ? D = setTimeout(() => {
_.value = l.visible;
}) : _.value = !1;
}, {
immediate: !0
});
const [O, q] = (0, m.default)(_, x), S = (0, t.shallowRef)(), E = () => l.point ? l.point : l.getRootDomNode, A = () => {
var w;
(w = i.value) === null || w === void 0 || w.forceAlign();
}, B = (w, $) => {
var N;
const F = l.getClassNameFromAlign($), ae = f.value;
f.value !== F && (f.value = F), O.value === "align" && (ae !== F ? Promise.resolve().then(() => {
A();
}) : q(() => {
var L;
(L = S.value) === null || L === void 0 || L.call(S);
}), (N = l.onAlign) === null || N === void 0 || N.call(l, w, $));
}, H = (0, t.computed)(() => {
const w = typeof l.animation == "object" ? l.animation : (0, r.getMotion)(l);
return ["onAfterEnter", "onAfterLeave"].forEach(($) => {
const N = w[$];
w[$] = (F) => {
q(), O.value = "stable", N == null || N(F);
};
}), w;
}), se = () => new Promise((w) => {
S.value = w;
});
(0, t.watch)([H, O], () => {
!H.value && O.value === "motion" && q();
}, {
immediate: !0
}), T({
forceAlign: A,
getElement: () => n.value.$el || n.value
});
const re = (0, t.computed)(() => {
var w;
return !(!((w = l.align) === null || w === void 0) && w.points && (O.value === "align" || O.value === "stable"));
});
return () => {
var w;
const {
zIndex: $,
align: N,
prefixCls: F,
destroyPopupOnHide: ae,
onMouseenter: L,
onMouseleave: ke,
onTouchstart: Ve = () => {
},
onMousedown: qe
} = l, ue = O.value, Ee = [(0, h.default)((0, h.default)({}, d.value), {
zIndex: $,
opacity: ue === "motion" || ue === "stable" || !_.value ? null : 0,
// pointerEvents: statusValue === 'stable' ? null : 'none',
pointerEvents: !_.value && ue !== "stable" ? "none" : null
}), C.style];
let te = (0, u.flattenChildren)((w = e.default) === null || w === void 0 ? void 0 : w.call(e, {
visible: l.visible
}));
te.length > 1 && (te = (0, t.createVNode)("div", {
class: `${F}-content`
}, [te]));
const He = (0, v.default)(F, C.class, f.value), Fe = _.value || !l.visible ? (0, g.getTransitionProps)(H.value.name, H.value) : {};
return (0, t.createVNode)(t.Transition, (0, a.default)((0, a.default)({
ref: n
}, Fe), {}, {
onBeforeEnter: se
}), {
default: () => !ae || l.visible ? (0, t.withDirectives)((0, t.createVNode)(o.default, {
target: E(),
key: "popup",
ref: i,
monitorWindowResize: !0,
disabled: re.value,
align: N,
onAlign: B
}, {
default: () => (0, t.createVNode)("div", {
class: He,
onMouseenter: L,
onMouseleave: ke,
onMousedown: (0, t.withModifiers)(qe, ["capture"]),
[b.default ? "onTouchstartPassive" : "onTouchstart"]: (0, t.withModifiers)(Ve, ["capture"]),
style: Ee
}, [te])
}), [[t.vShow, _.value]]) : null
});
};
}
});
return G.default = P, G;
}
var Me;
function it() {
if (Me)
return X;
Me = 1;
var s = R;
Object.defineProperty(X, "__esModule", {
value: !0
}), X.default = void 0;
var t = V, a = s(oe()), h = s(U()), m = ce(), c = s(Ye()), o = s(Ge()), r = s(tt()), u = (0, t.defineComponent)({
compatConfig: {
MODE: 3
},
name: "Popup",
inheritAttrs: !1,
props: m.popupProps,
setup(v, M) {
let {
attrs: g,
slots: b,
expose: P
} = M;
const l = (0, t.shallowRef)(!1), y = (0, t.shallowRef)(!1), T = (0, t.shallowRef)(), C = (0, t.shallowRef)();
return (0, t.watch)([() => v.visible, () => v.mobile], () => {
l.value = v.visible, v.visible && v.mobile && (y.value = !0);
}, {
immediate: !0,
flush: "post"
}), P({
forceAlign: () => {
var e;
(e = T.value) === null || e === void 0 || e.forceAlign();
},
getElement: () => {
var e;
return (e = T.value) === null || e === void 0 ? void 0 : e.getElement();
}
}), () => {
const e = (0, h.default)((0, h.default)((0, h.default)({}, v), g), {
visible: l.value
}), i = y.value ? (0, t.createVNode)(o.default, (0, a.default)((0, a.default)({}, e), {}, {
mobile: v.mobile,
ref: T
}), {
default: b.default
}) : (0, t.createVNode)(r.default, (0, a.default)((0, a.default)({}, e), {}, {
ref: T
}), {
default: b.default
});
return (0, t.createVNode)("div", {
ref: C
}, [(0, t.createVNode)(c.default, e, null), i]);
};
}
});
return X.default = u, X;
}
var Z = {}, ye;
function ot() {
if (ye)
return Z;
ye = 1;
var s = R;
Object.defineProperty(Z, "__esModule", {
value: !0
}), Z.getAlignFromPlacement = h, Z.getAlignPopupClassName = m;
var t = s(U());
function a(c, o, r) {
return r ? c[0] === o[0] : c[0] === o[0] && c[1] === o[1];
}
function h(c, o, r) {
const u = c[o] || {};
return (0, t.default)((0, t.default)({}, u), r);
}
function m(c, o, r, u) {
const {
points: v
} = r, M = Object.keys(c);
for (let g = 0; g < M.length; g += 1) {
const b = M[g];
if (a(c[b].points, v, u))
return `${o}-placement-${b}`;
}
return "";
}
return Z;
}
var ee = {}, Ce;
function nt() {
if (Ce)
return ee;
Ce = 1;
var s = R;
Object.defineProperty(ee, "__esModule", {
value: !0
}), ee.default = void 0;
var t = s(U()), a = V, h = ne(), m = {
methods: {
setState() {
let c = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, o = arguments.length > 1 ? arguments[1] : void 0, r = typeof c == "function" ? c(this.$data, this.$props) : c;
if (this.getDerivedStateFromProps) {
const u = this.getDerivedStateFromProps((0, h.getOptionProps)(this), (0, t.default)((0, t.default)({}, this.$data), r));
if (u === null)
return;
r = (0, t.default)((0, t.default)({}, r), u || {});
}
(0, t.default)(this.$data, r), this._.isMounted && this.$forceUpdate(), (0, a.nextTick)(() => {
o && o();
});
},
__emit() {
const c = [].slice.call(arguments, 0);
let o = c[0];
o = `on${o[0].toUpperCase()}${o.substring(1)}`;
const r = this.$props[o] || this.$attrs[o];
if (c.length && r)
if (Array.isArray(r))
for (let u = 0, v = r.length; u < v; u++)
r[u](...c.slice(1));
else
r(...c.slice(1));
}
}
};
return ee.default = m, ee;
}
var we;
function st() {
if (we)
return W;
we = 1;
var s = R;
Object.defineProperty(W, "__esModule", {
value: !0
}), W.default = void 0;
var t = V, a = s(U()), h = $e(), m = s(xe()), c = s(De()), o = ne(), r = s(Ne()), u = s(it()), v = ot(), M = s(nt()), g = s(je()), b = s(de()), P = Ae(), l = s(Se()), y = Ue();
const T = ["onClick", "onMousedown", "onTouchstart", "onMouseenter", "onMouseleave", "onFocus", "onBlur", "onContextmenu"];
var C = (0, t.defineComponent)({
compatConfig: {
MODE: 3
},
name: "Trigger",
mixins: [M.default],
inheritAttrs: !1,
props: (0, h.triggerProps)(),
setup(e) {
const i = (0, t.computed)(() => {
const {
popupPlacement: d,
popupAlign: p,
builtinPlacements: x
} = e;
return d && x ? (0, v.getAlignFromPlacement)(x, d, p) : p;
}), n = (0, t.shallowRef)(null), f = (d) => {
n.value = d;
};
return {
vcTriggerContext: (0, t.inject)("vcTriggerContext", {}),
popupRef: n,
setPopupRef: f,
triggerRef: (0, t.shallowRef)(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() {
const e = this.$props;
let i;
return this.popupVisible !== void 0 ? i = !!e.popupVisible : i = !!e.defaultPopupVisible, T.forEach((n) => {
this[`fire${n}`] = (f) => {
this.fireEvents(n, f);
};
}), {
prevPopupVisible: i,
sPopupVisible: i,
point: null
};
},
watch: {
popupVisible(e) {
e !== void 0 && (this.prevPopupVisible = this.sPopupVisible, this.sPopupVisible = e);
}
},
created() {
(0, t.provide)("vcTriggerContext", {
onPopupMouseDown: this.onPopupMouseDown,
onPopupMouseenter: this.onPopupMouseenter,
onPopupMouseleave: this.onPopupMouseleave
}), (0, y.useProvidePortal)(this);
},
deactivated() {
this.setPopupVisible(!1);
},
mounted() {
this.$nextTick(() => {
this.updatedCal();
});
},
updated() {
this.$nextTick(() => {
this.updatedCal();
});
},
beforeUnmount() {
this.clearDelayTimer(), this.clearOutsideHandler(), clearTimeout(this.mouseDownTimeout), c.default.cancel(this.attachId);
},
methods: {
updatedCal() {
const e = this.$props;
if (this.$data.sPopupVisible) {
let n;
!this.clickOutsideHandler && (this.isClickToHide() || this.isContextmenuToShow()) && (n = e.getDocument(this.getRootDomNode()), this.clickOutsideHandler = (0, r.default)(n, "mousedown", this.onDocumentClick)), this.touchOutsideHandler || (n = n || e.getDocument(this.getRootDomNode()), this.touchOutsideHandler = (0, r.default)(n, "touchstart", this.onDocumentClick, l.default ? {
passive: !1
} : !1)), !this.contextmenuOutsideHandler1 && this.isContextmenuToShow() && (n = n || e.getDocument(this.getRootDomNode()), this.contextmenuOutsideHandler1 = (0, r.default)(n, "scroll", this.onContextmenuClose)), !this.contextmenuOutsideHandler2 && this.isContextmenuToShow() && (this.contextmenuOutsideHandler2 = (0, r.default)(window, "blur", this.onContextmenuClose));
} else
this.clearOutsideHandler();
},
onMouseenter(e) {
const {
mouseEnterDelay: i
} = this.$props;
this.fireEvents("onMouseenter", e), this.delaySetPopupVisible(!0, i, i ? null : e);
},
onMouseMove(e) {
this.fireEvents("onMousemove", e), this.setPoint(e);
},
onMouseleave(e) {
this.fireEvents("onMouseleave", e), this.delaySetPopupVisible(!1, this.$props.mouseLeaveDelay);
},
onPopupMouseenter() {
const {
vcTriggerContext: e = {}
} = this;
e.onPopupMouseenter && e.onPopupMouseenter(), this.clearDelayTimer();
},
onPopupMouseleave(e) {
var i;
if (e && e.relatedTarget && !e.relatedTarget.setTimeout && (0, m.default)((i = this.popupRef) === null || i === void 0 ? void 0 : i.getElement(), e.relatedTarget))
return;
this.delaySetPopupVisible(!1, this.$props.mouseLeaveDelay);
const {
vcTriggerContext: n = {}
} = this;
n.onPopupMouseleave && n.onPopupMouseleave(e);
},
onFocus(e) {
this.fireEvents("onFocus", e), this.clearDelayTimer(), this.isFocusToShow() && (this.focusTime = Date.now(), this.delaySetPopupVisible(!0, this.$props.focusDelay));
},
onMousedown(e) {
this.fireEvents("onMousedown", e), this.preClickTime = Date.now();
},
onTouchstart(e) {
this.fireEvents("onTouchstart", e), this.preTouchTime = Date.now();
},
onBlur(e) {
(0, m.default)(e.target, e.relatedTarget || document.activeElement) || (this.fireEvents("onBlur", e), this.clearDelayTimer(), this.isBlurToHide() && this.delaySetPopupVisible(!1, this.$props.blurDelay));
},
onContextmenu(e) {
e.preventDefault(), this.fireEvents("onContextmenu", e), this.setPopupVisible(!0, e);
},
onContextmenuClose() {
this.isContextmenuToShow() && this.close();
},
onClick(e) {
if (this.fireEvents("onClick", e), this.focusTime) {
let n;
if (this.preClickTime && this.preTouchTime ? n = Math.min(this.preClickTime, this.preTouchTime) : this.preClickTime ? n = this.preClickTime : this.preTouchTime && (n = this.preTouchTime), Math.abs(n - 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();
const i = !this.$data.sPopupVisible;
(this.isClickToHide() && !i || i && this.isClickToShow()) && this.setPopupVisible(!this.$data.sPopupVisible, e);
},
onPopupMouseDown() {
const {
vcTriggerContext: e = {}
} = this;
this.hasPopupMouseDown = !0, clearTimeout(this.mouseDownTimeout), this.mouseDownTimeout = setTimeout(() => {
this.hasPopupMouseDown = !1;
}, 0), e.onPopupMouseDown && e.onPopupMouseDown(...arguments);
},
onDocumentClick(e) {
if (this.$props.mask && !this.$props.maskClosable)
return;
const i = e.target, n = this.getRootDomNode(), f = this.getPopupDomNode();
// mousedown on the target should also close popup when action is contextMenu.
// https://github.com/ant-design/ant-design/issues/29853
(!(0, m.default)(n, i) || this.isContextMenuOnly()) && !(0, m.default)(f, i) && !this.hasPopupMouseDown && this.delaySetPopupVisible(!1, 0.1);
},
getPopupDomNode() {
var e;
return ((e = this.popupRef) === null || e === void 0 ? void 0 : e.getElement()) || null;
},
getRootDomNode() {
var e, i, n, f;
const {
getTriggerDOMNode: d
} = this.$props;
if (d) {
const p = ((i = (e = this.triggerRef) === null || e === void 0 ? void 0 : e.$el) === null || i === void 0 ? void 0 : i.nodeName) === "#comment" ? null : (0, o.findDOMNode)(this.triggerRef);
return (0, o.findDOMNode)(d(p));
}
try {
const p = ((f = (n = this.triggerRef) === null || n === void 0 ? void 0 : n.$el) === null || f === void 0 ? void 0 : f.nodeName) === "#comment" ? null : (0, o.findDOMNode)(this.triggerRef);
if (p)
return p;
} catch {
}
return (0, o.findDOMNode)(this);
},
handleGetPopupClassFromAlign(e) {
const i = [], n = this.$props, {
popupPlacement: f,
builtinPlacements: d,
prefixCls: p,
alignPoint: x,
getPopupClassNameFromAlign: _
} = n;
return f && d && i.push((0, v.getAlignPopupClassName)(d, p, e, x)), _ && i.push(_(e)), i.join(" ");
},
getPopupAlign() {
const e = this.$props, {
popupPlacement: i,
popupAlign: n,
builtinPlacements: f
} = e;
return i && f ? (0, v.getAlignFromPlacement)(f, i, n) : n;
},
getComponent() {
const e = {};
this.isMouseEnterToShow() && (e.onMouseenter = this.onPopupMouseenter), this.isMouseLeaveToHide() && (e.onMouseleave = this.onPopupMouseleave), e.onMousedown = this.onPopupMouseDown, e[l.default ? "onTouchstartPassive" : "onTouchstart"] = this.onPopupMouseDown;
const {
handleGetPopupClassFromAlign: i,
getRootDomNode: n,
$attrs: f
} = this, {
prefixCls: d,
destroyPopupOnHide: p,
popupClassName: x,
popupAnimation: _,
popupTransitionName: D,
popupStyle: O,
mask: q,
maskAnimation: S,
maskTransitionName: E,
zIndex: A,
stretch: B,
alignPoint: H,
mobile: se,
forceRender: re
} = this.$props, {
sPopupVisible: w,
point: $
} = this.$data, N = (0, a.default)((0, a.default)({
prefixCls: d,
destroyPopupOnHide: p,
visible: w,
point: H ? $ : null,
align: this.align,
animation: _,
getClassNameFromAlign: i,
stretch: B,
getRootDomNode: n,
mask: q,
zIndex: A,
transitionName: D,
maskAnimation: S,
maskTransitionName: E,
class: x,
style: O,
onAlign: f.onPopupAlign || h.noop
}, e), {
ref: this.setPopupRef,
mobile: se,
forceRender: re
});
return (0, t.createVNode)(u.default, N, {
default: this.$slots.popup || (() => (0, o.getComponent)(this, "popup"))
});
},
attachParent(e) {
c.default.cancel(this.attachId);
const {
getPopupContainer: i,
getDocument: n
} = this.$props, f = this.getRootDomNode();
let d;
i ? (f || i.length === 0) && (d = i(f)) : d = n(this.getRootDomNode()).body, d ? d.appendChild(e) : this.attachId = (0, c.default)(() => {
this.attachParent(e);
});
},
getContainer() {
const {
$props: e
} = this, {
getDocument: i
} = e, 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(e, i) {
const {
alignPoint: n,
sPopupVisible: f,
onPopupVisibleChange: d
} = this;
this.clearDelayTimer(), f !== e && ((0, o.hasProp)(this, "popupVisible") || this.setState({
sPopupVisible: e,
prevPopupVisible: f
}), d && d(e)), n && i && e && this.setPoint(i);
},
setPoint(e) {
const {
alignPoint: i
} = this.$props;
!i || !e || this.setState({
point: {
pageX: e.pageX,
pageY: e.pageY
}
});
},
handlePortalUpdate() {
this.prevPopupVisible !== this.sPopupVisible && this.afterPopupVisibleChange(this.sPopupVisible);
},
delaySetPopupVisible(e, i, n) {
const f = i * 1e3;
if (this.clearDelayTimer(), f) {
const d = n ? {
pageX: n.pageX,
pageY: n.pageY
} : null;
this.delayTimer = setTimeout(() => {
this.setPopupVisible(e, d), this.clearDelayTimer();
}, f);
} else
this.setPopupVisible(e, n);
},
clearDelayTimer() {
this.delayTimer && (clearTimeout(this.delayTimer), this.delayTimer = null);
},
clearOutsideHandler() {
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(e) {
let i = () => {
};
const n = (0, o.getEvents)(this);
return this.childOriginEvents[e] && n[e] ? this[`fire${e}`] : (i = this.childOriginEvents[e] || n[e] || i, i);
},
isClickToShow() {
const {
action: e,
showAction: i
} = this.$props;
return e.indexOf("click") !== -1 || i.indexOf("click") !== -1;
},
isContextMenuOnly() {
const {
action: e
} = this.$props;
return e === "contextmenu" || e.length === 1 && e[0] === "contextmenu";
},
isContextmenuToShow() {
const {
action: e,
showAction: i
} = this.$props;
return e.indexOf("contextmenu") !== -1 || i.indexOf("contextmenu") !== -1;
},
isClickToHide() {
const {
action: e,
hideAction: i
} = this.$props;
return e.indexOf("click") !== -1 || i.indexOf("click") !== -1;
},
isMouseEnterToShow() {
const {
action: e,
showAction: i
} = this.$props;
return e.indexOf("hover") !== -1 || i.indexOf("mouseenter") !== -1;
},
isMouseLeaveToHide() {
const {
action: e,
hideAction: i
} = this.$props;
return e.indexOf("hover") !== -1 || i.indexOf("mouseleave") !== -1;
},
isFocusToShow() {
const {
action: e,
showAction: i
} = this.$props;
return e.indexOf("focus") !== -1 || i.indexOf("focus") !== -1;
},
isBlurToHide() {
const {
action: e,
hideAction: i
} = this.$props;
return e.indexOf("focus") !== -1 || i.indexOf("blur") !== -1;
},
forcePopupAlign() {
var e;
this.$data.sPopupVisible && ((e = this.popupRef) === null || e === void 0 || e.forceAlign());
},
fireEvents(e, i) {
this.childOriginEvents[e] && this.childOriginEvents[e](i);
const n = this.$props[e] || this.$attrs[e];
n && n(i);
},
close() {
this.setPopupVisible(!1);
}
},
render() {
const {
$attrs: e
} = this, i = (0, o.filterEmpty)((0, o.getSlot)(this)), {
alignPoint: n,
getPopupContainer: f
} = this.$props, d = i[0];
this.childOriginEvents = (0, o.getEvents)(d);
const 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[l.default ? "onTouchstartPassive" : "onTouchstart"] = this.onTouchstart) : (p.onClick = this.createTwoChains("onClick"), p.onMousedown = this.createTwoChains("onMousedown"), p[l.default ? "onTouchstartPassive" : "onTouchstart"] = this.createTwoChains("onTouchstart")), this.isMouseEnterToShow() ? (p.onMouseenter = this.onMouseenter, n && (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 = (O) => {
O && (!O.relatedTarget || !(0, m.default)(O.target, O.relatedTarget)) && this.createTwoChains("onBlur")(O);
});
const x = (0, b.default)(d && d.props && d.props.class, e.class);
x && (p.class = x);
const _ = (0, P.cloneElement)(d, (0, a.default)((0, a.default)({}, p), {
ref: "triggerRef"
}), !0, !0), D = (0, t.createVNode)(g.default, {
key: "portal",
getContainer: f && (() => f(this.getRootDomNode())),
didUpdate: this.handlePortalUpdate,
visible: this.$data.sPopupVisible
}, {
default: this.getComponent
});
return (0, t.createVNode)(t.Fragment, null, [_, D]);
}
});
return W.default = C, W;
}
var Oe;
function bt() {
return Oe || (Oe = 1, function(s) {
var t = R;
Object.defineProperty(s, "__esModule", {
value: !0
}), s.default = void 0, Object.defineProperty(s, "triggerProps", {
enumerable: !0,
get: function() {
return h.triggerProps;
}
});
var a = t(st()), h = $e(), m = a.default;
s.default = m;
}(le)), le;
}
export {
nt as a,
bt as r
};