@layui/layui-vue
Version:
a component library for Vue 3 base on layui-vue
39 lines (38 loc) • 1.27 kB
JavaScript
import { unref as o } from "vue";
import { arrow as n } from "@floating-ui/dom";
const c = Symbol("LayPopperV2"), m = ({ arrowRef: r, padding: e }) => ({ name: "arrow", options: { element: r, padding: e }, fn(t) {
const a = o(r);
return a ? n({ element: a, padding: e }).fn(t) : {};
} }), f = () => ({ name: "ArrowPlacement", fn: (r) => {
const e = r.placement.split("-")[0];
return r.elements.floating.setAttribute("data-popper-placement", e), {};
} }), d = ({ arrowRef: r }) => ({ name: "ArrowOffer", fn: (e) => {
var a, s;
const t = o(r);
if (!t)
return {};
switch (t.style.cssText = "", e.placement) {
case "bottom":
case "top":
case "bottom-start":
case "top-start":
case "bottom-end":
case "top-end":
t.style.left = "0", t.style.transform = `translate(${(a = e.middlewareData.arrow) == null ? void 0 : a.x}px, 0px)`;
break;
case "left":
case "right":
case "left-start":
case "right-start":
case "left-end":
case "right-end":
t.style.top = "0", t.style.transform = `translate(0px, ${(s = e.middlewareData.arrow) == null ? void 0 : s.y}px`;
}
return {};
} });
export {
c as POPPER_INJECTION_KEY,
m as arrowMiddleware,
d as getArrowOffer,
f as getArrowPlacement
};