import '@das-fed/upf-ui/packages/components/dropdown/style.css';
import { withInstall as u } from "@das-fed/upf-utils/with-install/index";
import { setI18nRule as C, t as E } from "@das-fed/upf-web/packages/i18n/index";
import "@das-fed/upf-ui/packages/global/theme";
import { defineComponent as m, openBlock as c, createBlock as h, unref as n, mergeProps as v, withCtx as a, renderSlot as p, normalizeProps as k, guardReactiveProps as M, useAttrs as x, ref as s, watch as y, onMounted as B, createElementBlock as I, createVNode as P } from "vue";
import "element-plus/es/components/dropdown-item/style/css";
import { ElDropdownItem as A, ElDropdownMenu as R, ElDropdown as z } from "element-plus";
import "element-plus/es/components/dropdown-menu/style/css";
import "element-plus/es/components/dropdown/style/css";
const O = /* @__PURE__ */ m({
  __name: "dropdownItem",
  props: {
    danger: { type: Boolean, default: !1 }
  },
  setup(t) {
    return (o, d) => (c(), h(n(A), v(o.$attrs, {
      class: { danger: t.danger }
    }), {
      default: a(() => [
        p(o.$slots, "default")
      ]),
      _: 3
      /* FORWARDED */
    }, 16, ["class"]));
  }
}), b = /* @__PURE__ */ m({
  __name: "dropdownMenu",
  setup(t) {
    return (o, d) => (c(), h(
      n(R),
      k(M(o.$attrs)),
      {
        default: a(() => [
          p(o.$slots, "default")
        ]),
        _: 3
        /* FORWARDED */
      },
      16
      /* FULL_PROPS */
    ));
  }
}), F = /* @__PURE__ */ m({
  __name: "index",
  props: {
    selfPopperClass: { default: "" },
    visibleArrow: { type: Boolean, default: !1 }
  },
  setup(t, { expose: o }) {
    const d = x(), w = s(null), r = s(null);
    let D = t, _ = s("hidden-arrow"), l = s({
      modifiers: [
        {
          name: "offset",
          options: {
            offset: [10, 10]
          }
        }
      ]
    });
    y(
      () => D.visibleArrow,
      (e, f) => {
        _.value = e ? "" : "hidden-arrow", l.value = {
          modifiers: [
            {
              name: "offset",
              options: {
                offset: e ? [10, 10] : [4, 4]
              }
            }
          ]
        };
      },
      { immediate: !0 }
    ), B(() => {
      if (d.trigger == "contextmenu") {
        const e = w.value;
        e == null || e.addEventListener("contextmenu", $), e == null || e.addEventListener("mousedown", g);
      }
    });
    function $(e) {
      const f = e.offsetX;
      let i = e.offsetY;
      i = 100 - i, l.value = {
        modifiers: [
          {
            name: "offset",
            options: {
              // offset:[x.value,y.value], x正数，y负数
              offset: [f, -i]
            }
          }
        ]
      }, r.value.handleOpen();
    }
    function g(e) {
      r.value.handleClose();
    }
    return o({
      getElRef: () => r.value
    }), (e, f) => (c(), I(
      "div",
      {
        class: "das-ui-dropdown",
        ref_key: "_selfDropdown",
        ref: w
      },
      [
        P(n(z), v(e.$attrs, {
          "popper-class": `das-ui-dropdown-popper ${t.selfPopperClass} ${n(_)}`,
          "popper-options": n(l),
          ref_key: "_selfElDropdown",
          ref: r
        }), {
          dropdown: a(() => [
            p(e.$slots, "default")
          ]),
          default: a(() => [
            p(e.$slots, "content")
          ]),
          _: 3
          /* FORWARDED */
        }, 16, ["popper-class", "popper-options"])
      ],
      512
      /* NEED_PATCH */
    ));
  }
}), L = { 下拉菜单: { "zh-CN": "下拉菜单", en: "Dropdown Menu", "zh-MO": "下拉式功能表", _appCode: "framework" } };
C(L);
const J = u(O), K = u(b), Q = u(F), T = { name: `Dropdown ${E("下拉菜单")}` };
export {
  Q as DasDropdown,
  J as DasDropdownItem,
  K as DasDropdownMenu,
  T as default
};
