import { defineComponent as g, ref as p, reactive as S, computed as m, watch as y, nextTick as f, onMounted as E, resolveDirective as U, withDirectives as T, openBlock as u, createElementBlock as h, normalizeClass as B, createTextVNode as H, toDisplayString as w } from "vue";
import { C as P } from "../Shared/base-PQGakkrl.js";
import { tooltipDirectives as k } from "../Web/__directive__/Tooltip.js";
const C = ["title"], W = /* @__PURE__ */ g({
  name: "ClEllipsis",
  directives: {
    cltooltip: k
  },
  __name: "Index",
  props: {
    className: {},
    text: {},
    isUseTooltip: { type: Boolean },
    tooltipTheme: {},
    tooltipPosition: {},
    tooltipTrigger: {},
    tooltipIsHtml: { type: Boolean },
    tooltipHtml: {},
    isAutoTooltip: { type: Boolean },
    isShowTitle: { type: Boolean }
  },
  setup(t) {
    const e = t, n = p(null), a = p(null), o = S({
      isPosParent: !1,
      isPosSpan: !1,
      isUseTooltip: !1
    }), v = m(() => {
      let i = "";
      return e.isUseTooltip || o.isUseTooltip ? i = "" : i = e.isShowTitle && e.text || "", i;
    }), x = m(() => {
      const i = {
        "panel-ellipsis": !0,
        "ellipsis-txt-title": !0
      };
      return e.className && !P.isEmpty(e.className) && e.className.split(" ").forEach((l) => {
        P.isEmpty(l) || (i[l] = !0);
      }), i;
    }), c = () => {
      if (e.isUseTooltip && e.text && e.text.length > 0 && n.value && a.value) {
        const i = n.value.clientWidth, l = a.value.offsetWidth;
        if (i > 0 && l > 0) {
          const s = i >= l, r = i < l;
          e.isAutoTooltip ? o.isUseTooltip = r : o.isUseTooltip = !0, o.isPosSpan = s, o.isPosParent = r;
        }
      }
    }, d = () => {
      c();
    };
    return y(
      () => e.text,
      () => {
        f(() => {
          c();
        });
      }
    ), E(() => {
      f(() => {
        d();
      });
    }), (i, l) => {
      const s = U("cltooltip");
      return T((u(), h("div", {
        ref_key: "refElParent",
        ref: n,
        class: B(x.value)
      }, [
        T((u(), h("span", {
          ref_key: "refElSpan",
          ref: a,
          title: v.value
        }, [
          H(w(t.text), 1)
        ], 8, C)), [
          [s, {
            init: t.isShowTitle && o.isUseTooltip && o.isPosSpan,
            html: t.tooltipHtml || t.text,
            theme: t.tooltipTheme,
            position: t.tooltipPosition,
            trigger: t.tooltipTrigger,
            isHtml: t.tooltipIsHtml
          }]
        ])
      ], 2)), [
        [s, {
          init: t.isShowTitle && o.isUseTooltip && o.isPosParent,
          html: t.tooltipHtml || t.text,
          theme: t.tooltipTheme,
          position: t.tooltipPosition,
          trigger: t.tooltipTrigger,
          isHtml: t.tooltipIsHtml
        }]
      ]);
    };
  }
});
export {
  W as default
};
//# sourceMappingURL=ClEllipsis.js.map
