@farris/ui-vue 1.5.0-beta.0 → 1.5.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/components/avatar/index.esm.js +897 -901
  2. package/components/avatar/index.umd.cjs +1 -1
  3. package/components/combo-list/index.esm.js +483 -487
  4. package/components/combo-list/index.umd.cjs +1 -1
  5. package/components/component/index.esm.js +482 -486
  6. package/components/component/index.umd.cjs +1 -1
  7. package/components/condition/index.esm.js +543 -547
  8. package/components/condition/index.umd.cjs +1 -1
  9. package/components/content-container/index.esm.js +619 -623
  10. package/components/content-container/index.umd.cjs +1 -1
  11. package/components/data-grid/index.esm.js +439 -440
  12. package/components/data-grid/index.umd.cjs +1 -1
  13. package/components/data-view/index.esm.js +423 -425
  14. package/components/data-view/index.umd.cjs +1 -1
  15. package/components/designer-canvas/index.esm.js +529 -533
  16. package/components/designer-canvas/index.umd.cjs +1 -1
  17. package/components/dynamic-form/index.esm.js +723 -727
  18. package/components/dynamic-form/index.umd.cjs +1 -1
  19. package/components/events-editor/index.esm.js +504 -508
  20. package/components/events-editor/index.umd.cjs +1 -1
  21. package/components/expression-editor/index.esm.js +679 -683
  22. package/components/expression-editor/index.umd.cjs +4 -4
  23. package/components/filter-bar/index.esm.js +503 -507
  24. package/components/filter-bar/index.umd.cjs +1 -1
  25. package/components/filter-condition-editor/index.esm.js +557 -561
  26. package/components/filter-condition-editor/index.umd.cjs +4 -4
  27. package/components/flow-canvas/index.esm.js +327 -331
  28. package/components/flow-canvas/index.umd.cjs +1 -1
  29. package/components/list-view/index.esm.js +502 -506
  30. package/components/list-view/index.umd.cjs +2 -2
  31. package/components/mapping-editor/index.esm.js +347 -348
  32. package/components/mapping-editor/index.umd.cjs +1 -1
  33. package/components/number-range/index.esm.js +479 -483
  34. package/components/number-range/index.umd.cjs +1 -1
  35. package/components/number-spinner/index.esm.js +1037 -1041
  36. package/components/number-spinner/index.umd.cjs +1 -1
  37. package/components/order/index.esm.js +1238 -1242
  38. package/components/order/index.umd.cjs +2 -2
  39. package/components/pagination/index.esm.js +94 -91
  40. package/components/pagination/index.umd.cjs +1 -1
  41. package/components/property-panel/index.esm.js +534 -538
  42. package/components/property-panel/index.umd.cjs +2 -2
  43. package/components/query-solution/index.esm.js +785 -789
  44. package/components/query-solution/index.umd.cjs +5 -5
  45. package/components/response-layout/index.esm.js +710 -714
  46. package/components/response-layout/index.umd.cjs +1 -1
  47. package/components/schema-selector/index.esm.js +701 -702
  48. package/components/schema-selector/index.umd.cjs +3 -3
  49. package/components/section/index.esm.js +502 -506
  50. package/components/section/index.umd.cjs +1 -1
  51. package/components/sort-condition-editor/index.esm.js +556 -560
  52. package/components/sort-condition-editor/index.umd.cjs +4 -4
  53. package/components/textarea/index.esm.js +480 -484
  54. package/components/textarea/index.umd.cjs +2 -2
  55. package/components/time-picker/index.esm.js +594 -598
  56. package/components/time-picker/index.umd.cjs +1 -1
  57. package/components/tooltip/index.esm.js +189 -179
  58. package/components/tooltip/index.umd.cjs +1 -1
  59. package/components/tree-grid/index.esm.js +463 -467
  60. package/components/tree-grid/index.umd.cjs +1 -1
  61. package/components/tree-view/index.esm.js +629 -633
  62. package/components/tree-view/index.umd.cjs +1 -1
  63. package/components/video/index.esm.js +632 -636
  64. package/components/video/index.umd.cjs +1 -1
  65. package/farris.all.esm.js +2583 -2569
  66. package/farris.all.umd.cjs +11 -11
  67. package/index.css +1 -1
  68. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { ref as g, computed as b, defineComponent as Y, watch as U, onMounted as _, createVNode as y, Fragment as B, Teleport as K, nextTick as I, reactive as Q, createApp as Z, onUnmounted as tt, mergeProps as et } from "vue";
2
- const ot = {
1
+ import { ref as g, computed as b, defineComponent as K, watch as Q, onMounted as Z, createVNode as y, Fragment as tt, Teleport as et, nextTick as W, reactive as ot, createApp as lt, onUnmounted as nt, mergeProps as it } from "vue";
2
+ const rt = {
3
3
  /** 提示内容 */
4
4
  content: { type: String, default: "" },
5
5
  /** 模板提示内容 */
@@ -22,329 +22,339 @@ const ot = {
22
22
  // 是否根据溢出自动显示提示
23
23
  overflowShown: { type: Boolean, default: !1 }
24
24
  };
25
- function lt(t, l) {
26
- const c = /* @__PURE__ */ new Map([
25
+ function ct(t, l) {
26
+ const r = /* @__PURE__ */ new Map([
27
27
  ["top", "bottom"],
28
28
  ["bottom", "top"],
29
29
  ["left", "right"],
30
30
  ["right", "left"]
31
- ]), n = /* @__PURE__ */ new Map([
31
+ ]), i = /* @__PURE__ */ new Map([
32
32
  ["top", "height"],
33
33
  ["bottom", "height"],
34
34
  ["left", "width"],
35
35
  ["right", "width"]
36
36
  ]);
37
- function f(e, i) {
38
- const u = c.get(i) || i;
39
- return e.replace(i, u);
37
+ function f(e, c) {
38
+ const u = r.get(c) || c;
39
+ return e.replace(c, u);
40
40
  }
41
- function s(e, i, u, o, d) {
42
- let v = e;
43
- const a = e.split("-")[0], p = n.get(a), h = o[p] + d[p];
44
- return Math.abs(u[a] - i[a]) < h && (v = f(e, a)), v;
41
+ function s(e, c, u, o, d) {
42
+ let h = e;
43
+ const a = e.split("-")[0], p = i.get(a), m = o[p] + d[p];
44
+ return Math.abs(u[a] - c[a]) < m && (h = f(e, a)), h;
45
45
  }
46
46
  return { adjustPlacement: s };
47
47
  }
48
- function nt(t, l) {
49
- function n(s, e, i) {
50
- let u = !1, o = i;
51
- return (e === "left" || e === "top") && i <= s[e] && (u = !0, o = s[e] + 6), (e === "right" || e === "bottom") && i >= s[e] && (u = !0, o = s[e] - 6), { overBound: u, fixedValue: o };
48
+ function st(t, l) {
49
+ function i(s, e, c) {
50
+ let u = !1, o = c;
51
+ return (e === "left" || e === "top") && c <= s[e] && (u = !0, o = s[e] + 6), (e === "right" || e === "bottom") && c >= s[e] && (u = !0, o = s[e] - 6), { overBound: u, fixedValue: o };
52
52
  }
53
- function f(s, e, i, u, o, d, v) {
54
- let a = e.tooltip.left, p = e.tooltip.top, h = e.arrow.left, w = e.arrow.top;
55
- const T = s.split("-")[0];
56
- if (["top", "bottom"].includes(T)) {
57
- const x = n(i, "left", e.tooltip.left), k = n(i, "right", e.tooltip.left + o.width);
58
- a = x.overBound ? x.fixedValue : k.overBound ? k.fixedValue - o.width : e.tooltip.left, h = x.overBound ? o.width - (a + o.width - u.right) - v.width : k.overBound ? u.left - a : e.arrow.left;
53
+ function f(s, e, c, u, o, d, h) {
54
+ let a = e.tooltip.left, p = e.tooltip.top, m = e.arrow.left, w = e.arrow.top;
55
+ const P = s.split("-")[0];
56
+ if (["top", "bottom"].includes(P)) {
57
+ const k = i(c, "left", e.tooltip.left), L = i(c, "right", e.tooltip.left + o.width);
58
+ a = k.overBound ? k.fixedValue : L.overBound ? L.fixedValue - o.width : e.tooltip.left, m = k.overBound ? o.width - (a + o.width - u.right) - h.width : L.overBound ? u.left - a : e.arrow.left;
59
59
  }
60
- const S = n(i, "top", e.tooltip.top), E = n(i, "bottom", e.tooltip.top + o.height);
61
- return p = S.overBound ? S.fixedValue : E.overBound ? E.fixedValue - o.height : e.tooltip.top, w = S.overBound ? e.arrow.top : E.overBound ? o.height - (p + o.height - u.top) : e.arrow.top, { arrow: { left: h, top: w }, tooltip: { left: a, top: p } };
60
+ const E = i(c, "top", e.tooltip.top), x = i(c, "bottom", e.tooltip.top + o.height);
61
+ return p = E.overBound ? E.fixedValue : x.overBound ? x.fixedValue - o.height : e.tooltip.top, w = E.overBound ? e.arrow.top : x.overBound ? o.height - (p + o.height - u.top) : e.arrow.top, { arrow: { left: m, top: w }, tooltip: { left: a, top: p } };
62
62
  }
63
63
  return { adjustPosition: f };
64
64
  }
65
- function it(t, l) {
66
- function n(e, i, u, o, d) {
67
- const v = e.split("-"), a = v[0], p = v[1] || "middle", h = ["top", "bottom"].includes(a) ? p === "middle" ? (o.width - d.width) / 2 : p === "right" ? o.width - d.width - 6 : 6 : 0, w = ["left", "right"].includes(a) ? p === "middle" ? (o.height - d.height) / 2 : p === "bottom" ? o.height - d.height - 6 : 6 : 0, L = a === "left" ? o.width + d.width : 0, T = a === "top" ? o.height + d.height : 0;
68
- return { left: L + h, top: T + w, right: 0 };
65
+ function at(t, l) {
66
+ function i(e, c, u, o, d) {
67
+ const h = e.split("-"), a = h[0], p = h[1] || "middle", m = ["top", "bottom"].includes(a) ? p === "middle" ? (o.width - d.width) / 2 : p === "right" ? o.width - d.width - 6 : 6 : 0, w = ["left", "right"].includes(a) ? p === "middle" ? (o.height - d.height) / 2 : p === "bottom" ? o.height - d.height - 6 : 6 : 0, S = a === "left" ? o.width + d.width : 0, P = a === "top" ? o.height + d.height : 0;
68
+ return { left: S + m, top: P + w, right: 0 };
69
69
  }
70
- function f(e, i, u, o, d) {
71
- const v = e.split("-"), a = v[0], p = v[1] || "middle", h = (u.width - o.width) / 2, w = (u.height - o.height) / 2, L = a === "right" ? i.right : i.left, T = a === "bottom" ? i.bottom : i.top, S = a === "top" ? 0 - w - o.height - d.height : a === "bottom" ? 0 - w + d.height : 0, E = ["left", "right"].includes(a) ? p === "middle" ? (i.height - o.height) / 2 : p === "bottom" ? i.height - o.height : 0 : 0, C = a === "left" ? 0 - h - o.width - d.width : a === "right" ? 0 - h + d.width : 0, O = ["top", "bottom"].includes(a) ? p === "middle" ? (i.width - o.width) / 2 : p === "right" ? i.width - o.width : 0 : 0, x = T + S + E;
72
- return { left: L + C + O, top: x };
70
+ function f(e, c, u, o, d) {
71
+ const h = e.split("-"), a = h[0], p = h[1] || "middle", m = (u.width - o.width) / 2, w = (u.height - o.height) / 2, S = a === "right" ? c.right : c.left, P = a === "bottom" ? c.bottom : c.top, E = a === "top" ? 0 - w - o.height - d.height : a === "bottom" ? 0 - w + d.height : 0, x = ["left", "right"].includes(a) ? p === "middle" ? (c.height - o.height) / 2 : p === "bottom" ? c.height - o.height : 0 : 0, C = a === "left" ? 0 - m - o.width - d.width : a === "right" ? 0 - m + d.width : 0, O = ["top", "bottom"].includes(a) ? p === "middle" ? (c.width - o.width) / 2 : p === "right" ? c.width - o.width : 0 : 0, k = P + E + x;
72
+ return { left: S + C + O, top: k };
73
73
  }
74
- function s(e, i, u, o, d) {
75
- const v = f(e, i, u, o, d);
76
- return { arrow: n(e, i, u, o, d), tooltip: v };
74
+ function s(e, c, u, o, d) {
75
+ const h = f(e, c, u, o, d);
76
+ return { arrow: i(e, c, u, o, d), tooltip: h };
77
77
  }
78
78
  return { calculate: s };
79
79
  }
80
- function rt(t, l) {
81
- const c = g(t.horizontalRelative), n = g(t.verticalRelative);
80
+ function ut(t, l) {
81
+ const r = g(t.horizontalRelative), i = g(t.verticalRelative);
82
82
  function f(e) {
83
83
  return typeof e == "string" ? document.querySelector(e) : e;
84
84
  }
85
85
  function s() {
86
- let e = document.documentElement.clientWidth, i = document.documentElement.clientHeight, u = 0, o = 0, d = 0, v = 0, a = i - u, p = e - o;
87
- return c.value && ({ left: o, right: e, x: d, width: p } = f(c.value).getBoundingClientRect()), n.value && ({ bottom: i, top: u, y: v, height: a } = f(n.value).getBoundingClientRect()), { top: u, left: o, right: e, bottom: i, height: a, width: p, x: d, y: v };
86
+ let e = document.documentElement.clientWidth, c = document.documentElement.clientHeight, u = 0, o = 0, d = 0, h = 0, a = c - u, p = e - o;
87
+ return r.value && ({ left: o, right: e, x: d, width: p } = f(r.value).getBoundingClientRect()), i.value && ({ bottom: c, top: u, y: h, height: a } = f(i.value).getBoundingClientRect()), { top: u, left: o, right: e, bottom: c, height: a, width: p, x: d, y: h };
88
88
  }
89
89
  return { getRelativeElementBound: s };
90
90
  }
91
- function ct(t, l, c, n, f, s) {
92
- const e = g(t.placement), { getRelativeElementBound: i } = rt(t), { calculate: u } = it(), { adjustPlacement: o } = lt(), { adjustPosition: d } = nt(), v = b(() => e.value.split("-")[0]), a = b(() => {
93
- const p = i();
94
- e.value = o(e.value, p, c, n, s);
95
- const h = u(e.value, c, n, f, s);
91
+ function ft(t, l, r, i, f, s) {
92
+ const e = g(t.placement), { getRelativeElementBound: c } = ut(t), { calculate: u } = at(), { adjustPlacement: o } = ct(), { adjustPosition: d } = st(), h = b(() => e.value.split("-")[0]), a = b(() => {
93
+ const p = c();
94
+ e.value = o(e.value, p, r, i, s);
95
+ const m = u(e.value, r, i, f, s);
96
96
  return d(
97
97
  e.value,
98
- h,
98
+ m,
99
99
  p,
100
- c,
101
- n,
100
+ r,
101
+ i,
102
102
  f,
103
103
  s
104
104
  );
105
105
  });
106
- return { tooltipPlacement: v, tooltipPosition: a };
106
+ return { tooltipPlacement: h, tooltipPosition: a };
107
107
  }
108
- function st(t) {
109
- const l = g(), c = g(!1), n = b(() => ({
110
- display: c.value ? "block" : "none"
108
+ function pt(t) {
109
+ const l = g(), r = g(!1), i = b(() => ({
110
+ display: r.value ? "block" : "none"
111
111
  })), f = b(() => {
112
112
  var e;
113
113
  const s = (e = t.customClass) == null ? void 0 : e.split(" ");
114
- return s == null ? void 0 : s.reduce((i, u) => (i[u] = !0, i), {});
114
+ return s == null ? void 0 : s.reduce((c, u) => (c[u] = !0, c), {});
115
115
  });
116
- return { showTooltip: c, tooltipDisplayStyle: n, tooltipCustomClass: f, tooltipContainerRef: l };
116
+ return { showTooltip: r, tooltipDisplayStyle: i, tooltipCustomClass: f, tooltipContainerRef: l };
117
117
  }
118
- const H = /* @__PURE__ */ Y({
118
+ const H = /* @__PURE__ */ K({
119
119
  name: "FTooltip",
120
- props: ot,
120
+ props: rt,
121
121
  emits: ["click"],
122
122
  setup(t, l) {
123
- const c = g(), n = g(), f = g(), s = g(), e = g(), i = g(t.placement.split("-")[0]), u = st(t), {
123
+ const r = g(), i = g(), f = g(), s = g(), e = g(), c = g(t.placement.split("-")[0]), u = pt(t), {
124
124
  showTooltip: o,
125
125
  tooltipDisplayStyle: d,
126
- tooltipCustomClass: v,
126
+ tooltipCustomClass: h,
127
127
  tooltipContainerRef: a
128
- } = u, p = b(() => {
129
- let r = {
128
+ } = u, p = g(!1), m = b(() => {
129
+ let n = {
130
130
  "fv-tooltip": !0,
131
131
  tooltip: !0,
132
132
  show: !0
133
133
  };
134
- const m = `bs-tooltip-${i.value}`;
135
- return r[m] = !0, l.slots.default && (r = {
136
- ...r,
137
- ...v.value
138
- }), r;
139
- }), h = (r) => {
140
- r.stopPropagation(), r.target !== e.value && (o.value = !1);
141
- }, w = b(() => t.content && !t.contentTemplate), L = b(() => t.content), T = g("0px"), S = g("0px"), E = b(() => {
142
- const r = {
143
- left: T.value,
144
- top: S.value
134
+ const v = `bs-tooltip-${c.value}`;
135
+ return n[v] = !0, l.slots.default && (n = {
136
+ ...n,
137
+ ...h.value
138
+ }), n;
139
+ }), w = (n) => {
140
+ n.stopPropagation(), n.target !== e.value && (o.value = !1);
141
+ }, S = b(() => t.content && !t.contentTemplate), P = b(() => t.content), E = g("0px"), x = g("0px"), C = b(() => {
142
+ const n = {
143
+ left: E.value,
144
+ top: x.value
145
145
  };
146
- return l.slots.default, r;
147
- }), C = g(""), O = g(""), x = b(() => ({
148
- left: C.value,
149
- top: O.value
150
- })), k = b(() => ({
146
+ return l.slots.default, n;
147
+ }), O = g(""), k = g(""), L = b(() => ({
148
+ left: O.value,
149
+ top: k.value
150
+ })), M = b(() => ({
151
151
  "tooltip-inner": !0,
152
152
  "tooltip-inner-lg": s.value && s.value && s.value.scrollHeight > s.value.clientHeight
153
- })), W = b(() => {
154
- const r = {};
155
- return t.width && Object.assign(r, {
153
+ })), V = b(() => {
154
+ const n = {};
155
+ return t.width && Object.assign(n, {
156
156
  width: t.width,
157
157
  "max-width": "none"
158
- }), r;
159
- }), z = (r) => {
160
- n.value && f.value && s.value && (k.value, I(() => {
158
+ }), n;
159
+ }), N = (n) => {
160
+ i.value && f.value && s.value && (M.value, W(() => {
161
161
  const {
162
- tooltipPlacement: m,
163
- tooltipPosition: P
164
- } = ct(t, l, r.getBoundingClientRect(), f.value.getBoundingClientRect(), s.value.getBoundingClientRect(), n.value.getBoundingClientRect());
165
- T.value = `${P.value.tooltip.left + document.documentElement.scrollLeft}px`, S.value = `${P.value.tooltip.top + document.documentElement.scrollTop}px`, C.value = `${P.value.arrow.left}px`, O.value = `${P.value.arrow.top}px`, i.value = m.value;
162
+ tooltipPlacement: v,
163
+ tooltipPosition: T
164
+ } = ft(t, l, n.getBoundingClientRect(), f.value.getBoundingClientRect(), s.value.getBoundingClientRect(), i.value.getBoundingClientRect());
165
+ E.value = `${T.value.tooltip.left + document.documentElement.scrollLeft}px`, x.value = `${T.value.tooltip.top + document.documentElement.scrollTop}px`, O.value = `${T.value.arrow.left}px`, k.value = `${T.value.arrow.top}px`, c.value = v.value;
166
166
  }));
167
- }, A = (r) => {
168
- var P;
169
- const m = (P = c.value) == null ? void 0 : P.nextElementSibling;
170
- m && (t.overflowShown && m.scrollWidth === m.clientWidth || (r.stopPropagation(), o.value = !0, I(() => {
171
- z(m);
167
+ }, A = (n) => {
168
+ var T;
169
+ const v = (T = r.value) == null ? void 0 : T.nextElementSibling;
170
+ v && (t.overflowShown && v.scrollWidth === v.clientWidth || (n.stopPropagation(), o.value = !0, W(() => {
171
+ N(v);
172
172
  })));
173
- }, V = (r, m = !0) => {
174
- r.removeEventListener("mouseenter", A), r.removeEventListener("mouseleave", h), m && (r.addEventListener("mouseenter", A), r.addEventListener("mouseleave", h));
173
+ }, F = (n, v = !0) => {
174
+ n.removeEventListener("mouseenter", A), n.removeEventListener("mouseleave", w), v && (n.addEventListener("mouseenter", A), n.addEventListener("mouseleave", w));
175
175
  };
176
- function D(r, m = !0) {
177
- r.removeEventListener("mouseenter", A), r.removeEventListener("mouseleave", h), m && (r.addEventListener("click", A), document.body.addEventListener("click", h));
176
+ function $(n, v = !0) {
177
+ n.removeEventListener("mouseenter", A), n.removeEventListener("mouseleave", w), v && (n.addEventListener("click", A), document.body.addEventListener("click", w));
178
178
  }
179
- function N() {
180
- var m;
179
+ function R() {
180
+ var v;
181
181
  if (!t.enable)
182
182
  return;
183
- const r = (m = c.value) == null ? void 0 : m.nextElementSibling;
184
- r && (t.trigger === "click" && D(r), t.trigger === "hover" && V(r));
183
+ const n = (v = r.value) == null ? void 0 : v.nextElementSibling;
184
+ n && (t.trigger === "click" && $(n), t.trigger === "hover" && F(n));
185
185
  }
186
- function G() {
187
- var m;
188
- const r = (m = c.value) == null ? void 0 : m.nextElementSibling;
189
- r && (t.trigger === "click" && D(r, !1), t.trigger === "hover" && V(r, !1));
186
+ function X() {
187
+ var v;
188
+ const n = (v = r.value) == null ? void 0 : v.nextElementSibling;
189
+ n && (t.trigger === "click" && $(n, !1), t.trigger === "hover" && F(n, !1));
190
+ }
191
+ Q(() => t.enable, (n) => {
192
+ n ? R() : X();
193
+ });
194
+ function Y() {
195
+ r.value && r.value.nodeName === "#text" && !r.value.nextElementSibling && (p.value = !0, W(() => {
196
+ R();
197
+ }));
190
198
  }
191
- U(() => t.enable, (r) => {
192
- r ? N() : G();
193
- }), _(() => {
194
- N(), !w.value && t.contentTemplate && e.value && e.value.appendChild(t.contentTemplate), t.reference && z(t.reference);
199
+ Z(() => {
200
+ Y(), R(), !S.value && t.contentTemplate && e.value && e.value.appendChild(t.contentTemplate), t.reference && N(t.reference);
195
201
  });
196
- function $(r) {
197
- l.emit("click", r);
202
+ function I(n) {
203
+ l.emit("click", n);
198
204
  }
199
- const J = () => y("div", {
205
+ const U = () => y("div", {
200
206
  ref: f,
201
- class: p.value,
202
- style: E.value,
203
- onClick: $
207
+ class: m.value,
208
+ style: C.value,
209
+ onClick: I
204
210
  }, [y("div", {
205
- ref: n,
211
+ ref: i,
206
212
  class: "arrow",
207
- style: x.value
213
+ style: L.value
208
214
  }, null), y("div", {
209
215
  ref: s,
210
- class: k.value,
211
- style: W.value
216
+ class: M.value,
217
+ style: V.value
212
218
  }, [y("div", {
213
219
  class: "tooltip-tmpl"
214
- }, [w.value && y("div", {
220
+ }, [S.value && y("div", {
215
221
  class: "tooltip-text",
216
- innerHTML: L.value
217
- }, null), !w.value && y("div", {
222
+ innerHTML: P.value
223
+ }, null), !S.value && y("div", {
218
224
  class: "tooltip-text",
219
225
  ref: e
220
- }, null)])])]), X = () => y("div", {
226
+ }, null)])])]), _ = () => y("div", {
221
227
  ref: f,
222
- class: p.value,
223
- style: E.value,
224
- onClick: $
228
+ class: m.value,
229
+ style: C.value,
230
+ onClick: I
225
231
  }, [y("div", {
226
- ref: n,
232
+ ref: i,
227
233
  class: "arrow",
228
- style: x.value
234
+ style: L.value
229
235
  }, null), y("div", {
230
236
  ref: s,
231
- class: k.value,
232
- style: W.value
237
+ class: M.value,
238
+ style: V.value
233
239
  }, [y("div", {
234
240
  class: "tooltip-tmpl"
235
241
  }, [y("div", {
236
242
  class: "tooltip-text",
237
243
  ref: e
238
244
  }, [l.slots.contentTemplate ? l.slots.contentTemplate() : t.content])])])]);
239
- return () => l.slots.default ? y(B, {
240
- ref: c
241
- }, [l.slots.default(), y(K, {
245
+ function B() {
246
+ var n, v, T, q;
247
+ return p.value ? y("span", null, [(v = (n = l.slots).default) == null ? void 0 : v.call(n)]) : (q = (T = l.slots).default) == null ? void 0 : q.call(T);
248
+ }
249
+ return () => l.slots.default ? y(tt, {
250
+ ref: r
251
+ }, [B(), y(et, {
242
252
  to: "body"
243
253
  }, {
244
- default: () => [o.value && X()]
245
- })]) : J();
254
+ default: () => [o.value && _()]
255
+ })]) : U();
246
256
  }
247
257
  });
248
- function at(t, l) {
249
- const c = document.createElement("div");
250
- t.customClass && (c.className = t.customClass);
251
- const n = Z({
258
+ function dt(t, l) {
259
+ const r = document.createElement("div");
260
+ t.customClass && (r.className = t.customClass);
261
+ const i = lt({
252
262
  setup() {
253
263
  function f() {
254
- t.clickToHide && n.unmount();
264
+ t.clickToHide && i.unmount();
255
265
  }
256
- return tt(() => {
257
- document.body.removeChild(c);
258
- }), () => y(H, et(t, {
266
+ return nt(() => {
267
+ document.body.removeChild(r);
268
+ }), () => y(H, it(t, {
259
269
  onClick: f
260
270
  }), null);
261
271
  }
262
272
  });
263
- return document.body.appendChild(c), n.mount(c), n;
273
+ return document.body.appendChild(r), i.mount(r), i;
264
274
  }
265
- function q(t) {
266
- const l = Q({
275
+ function J(t) {
276
+ const l = ot({
267
277
  ...t
268
278
  });
269
- return at(l);
279
+ return dt(l);
270
280
  }
271
- function ut(t, l) {
272
- let c;
273
- t.addEventListener("mouseenter", (n) => {
274
- if (l.value.enable !== !1 && !(l.value.overflowShown && t.scrollWidth === t.clientWidth) && (n.stopPropagation(), !c)) {
281
+ function vt(t, l) {
282
+ let r;
283
+ t.addEventListener("mouseenter", (i) => {
284
+ if (l.value.enable !== !1 && !(l.value.overflowShown && t.scrollWidth === t.clientWidth) && (i.stopPropagation(), !r)) {
275
285
  const f = t.dataset.tooltip && JSON.parse(t.dataset.tooltip) || {}, s = Object.assign({
276
286
  reference: t,
277
287
  contentTemplate: l.value.contentTemplate
278
288
  }, f);
279
- c = q(s);
289
+ r = J(s);
280
290
  }
281
- }), t.addEventListener("mouseleave", (n) => {
282
- n.stopPropagation(), c && (c.unmount(), c = null);
291
+ }), t.addEventListener("mouseleave", (i) => {
292
+ i.stopPropagation(), r && (r.unmount(), r = null);
283
293
  });
284
294
  }
285
- let M = null;
286
- const j = /* @__PURE__ */ new WeakMap(), R = "_farris-tooltip-directive_";
287
- function ft() {
288
- document.querySelectorAll(`.${R}`).forEach((t) => {
295
+ let z = null;
296
+ const j = /* @__PURE__ */ new WeakMap(), D = "_farris-tooltip-directive_";
297
+ function ht() {
298
+ document.querySelectorAll(`.${D}`).forEach((t) => {
289
299
  const l = j.get(t);
290
300
  l && (l.unmount(), j.delete(t));
291
301
  });
292
302
  }
293
- function pt(t, l) {
294
- t.addEventListener("click", (c) => {
303
+ function mt(t, l) {
304
+ t.addEventListener("click", (r) => {
295
305
  if (l.value.enable === !1 || l.value.overflowShown === !0 && t.scrollWidth === t.clientWidth)
296
306
  return;
297
- c.stopPropagation();
298
- let n = j.get(t);
299
- if (n)
300
- n.unmount(), j.delete(t);
307
+ r.stopPropagation();
308
+ let i = j.get(t);
309
+ if (i)
310
+ i.unmount(), j.delete(t);
301
311
  else {
302
312
  const f = t.dataset.tooltip && JSON.parse(t.dataset.tooltip) || {}, s = Object.assign({
303
313
  trigger: "hover",
304
314
  reference: t
305
315
  }, f);
306
- n = q(s), j.set(t, n);
316
+ i = J(s), j.set(t, i);
307
317
  }
308
- }), !M && document.body.addEventListener("click", M = (c) => {
309
- const n = c.target, f = n.closest(`.${R}`);
310
- f && j.has(f) || n.closest(".tooltip") || ft();
318
+ }), !z && document.body.addEventListener("click", z = (r) => {
319
+ const i = r.target, f = i.closest(`.${D}`);
320
+ f && j.has(f) || i.closest(".tooltip") || ht();
311
321
  }, !0);
312
322
  }
313
- function F(t, l) {
323
+ function G(t, l) {
314
324
  if (!l.value)
315
325
  t.dataset.tooltip = "";
316
326
  else {
317
327
  const {
318
- contentTemplate: c,
319
- ...n
328
+ contentTemplate: r,
329
+ ...i
320
330
  } = l.value;
321
- t.dataset.tooltip = JSON.stringify(n);
331
+ t.dataset.tooltip = JSON.stringify(i);
322
332
  }
323
333
  }
324
- const dt = {
325
- mounted: (t, l, c) => {
326
- switch (t.classList.add(R), F(t, l), l.value.trigger) {
334
+ const gt = {
335
+ mounted: (t, l, r) => {
336
+ switch (t.classList.add(D), G(t, l), l.value.trigger) {
327
337
  case "click": {
328
- pt(t, l);
338
+ mt(t, l);
329
339
  break;
330
340
  }
331
341
  default:
332
- ut(t, l);
342
+ vt(t, l);
333
343
  }
334
344
  },
335
- unMounted: (t, l, c) => {
336
- l.value.trigger === "click" && document.body.removeEventListener("click", M, !0);
345
+ unMounted: (t, l, r) => {
346
+ l.value.trigger === "click" && document.body.removeEventListener("click", z, !0);
337
347
  },
338
348
  beforeUpdate: (t, l) => {
339
- F(t, l);
349
+ G(t, l);
340
350
  }
341
351
  };
342
352
  H.install = (t) => {
343
- t.component(H.name, H), t.directive("tooltip", dt);
353
+ t.component(H.name, H), t.directive("tooltip", gt);
344
354
  };
345
355
  export {
346
356
  H as FTooltip,
347
- dt as FTooltipDirective,
357
+ gt as FTooltipDirective,
348
358
  H as default,
349
- ot as tooltipProps
359
+ rt as tooltipProps
350
360
  };
@@ -1 +1 @@
1
- (function(w,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],o):(w=typeof globalThis<"u"?globalThis:w||self,o(w.tooltip={},w.Vue))})(this,function(w,o){"use strict";const M={content:{type:String,default:""},contentTemplate:{type:Object},width:{type:String},customClass:{type:String},placement:{type:String,default:"top"},trigger:{type:String,default:"hover"},reference:{type:Object,require:!0},horizontalRelative:{type:String,default:""},verticalRelative:{type:String,default:""},clickToHide:{type:Boolean,default:!0},enable:{type:Boolean,default:!0},overflowShown:{type:Boolean,default:!1}};function _(t,l){const s=new Map([["top","bottom"],["bottom","top"],["left","right"],["right","left"]]),i=new Map([["top","height"],["bottom","height"],["left","width"],["right","width"]]);function d(e,r){const f=s.get(r)||r;return e.replace(r,f)}function a(e,r,f,n,h){let m=e;const u=e.split("-")[0],p=i.get(u),v=n[p]+h[p];return Math.abs(f[u]-r[u])<v&&(m=d(e,u)),m}return{adjustPlacement:a}}function G(t,l){function i(a,e,r){let f=!1,n=r;return(e==="left"||e==="top")&&r<=a[e]&&(f=!0,n=a[e]+6),(e==="right"||e==="bottom")&&r>=a[e]&&(f=!0,n=a[e]-6),{overBound:f,fixedValue:n}}function d(a,e,r,f,n,h,m){let u=e.tooltip.left,p=e.tooltip.top,v=e.arrow.left,y=e.arrow.top;const T=a.split("-")[0];if(["top","bottom"].includes(T)){const E=i(r,"left",e.tooltip.left),k=i(r,"right",e.tooltip.left+n.width);u=E.overBound?E.fixedValue:k.overBound?k.fixedValue-n.width:e.tooltip.left,v=E.overBound?n.width-(u+n.width-f.right)-m.width:k.overBound?f.left-u:e.arrow.left}const b=i(r,"top",e.tooltip.top),S=i(r,"bottom",e.tooltip.top+n.height);return p=b.overBound?b.fixedValue:S.overBound?S.fixedValue-n.height:e.tooltip.top,y=b.overBound?e.arrow.top:S.overBound?n.height-(p+n.height-f.top):e.arrow.top,{arrow:{left:v,top:y},tooltip:{left:u,top:p}}}return{adjustPosition:d}}function J(t,l){function i(e,r,f,n,h){const m=e.split("-"),u=m[0],p=m[1]||"middle",v=["top","bottom"].includes(u)?p==="middle"?(n.width-h.width)/2:p==="right"?n.width-h.width-6:6:0,y=["left","right"].includes(u)?p==="middle"?(n.height-h.height)/2:p==="bottom"?n.height-h.height-6:6:0,L=u==="left"?n.width+h.width:0,T=u==="top"?n.height+h.height:0;return{left:L+v,top:T+y,right:0}}function d(e,r,f,n,h){const m=e.split("-"),u=m[0],p=m[1]||"middle",v=(f.width-n.width)/2,y=(f.height-n.height)/2,L=u==="right"?r.right:r.left,T=u==="bottom"?r.bottom:r.top,b=u==="top"?0-y-n.height-h.height:u==="bottom"?0-y+h.height:0,S=["left","right"].includes(u)?p==="middle"?(r.height-n.height)/2:p==="bottom"?r.height-n.height:0:0,V=u==="left"?0-v-n.width-h.width:u==="right"?0-v+h.width:0,C=["top","bottom"].includes(u)?p==="middle"?(r.width-n.width)/2:p==="right"?r.width-n.width:0:0,E=T+b+S;return{left:L+V+C,top:E}}function a(e,r,f,n,h){const m=d(e,r,f,n,h);return{arrow:i(e,r,f,n,h),tooltip:m}}return{calculate:a}}function X(t,l){const s=o.ref(t.horizontalRelative),i=o.ref(t.verticalRelative);function d(e){return typeof e=="string"?document.querySelector(e):e}function a(){let e=document.documentElement.clientWidth,r=document.documentElement.clientHeight,f=0,n=0,h=0,m=0,u=r-f,p=e-n;return s.value&&({left:n,right:e,x:h,width:p}=d(s.value).getBoundingClientRect()),i.value&&({bottom:r,top:f,y:m,height:u}=d(i.value).getBoundingClientRect()),{top:f,left:n,right:e,bottom:r,height:u,width:p,x:h,y:m}}return{getRelativeElementBound:a}}function Y(t,l,s,i,d,a){const e=o.ref(t.placement),{getRelativeElementBound:r}=X(t),{calculate:f}=J(),{adjustPlacement:n}=_(),{adjustPosition:h}=G(),m=o.computed(()=>e.value.split("-")[0]),u=o.computed(()=>{const p=r();e.value=n(e.value,p,s,i,a);const v=f(e.value,s,i,d,a);return h(e.value,v,p,s,i,d,a)});return{tooltipPlacement:m,tooltipPosition:u}}function U(t){const l=o.ref(),s=o.ref(!1),i=o.computed(()=>({display:s.value?"block":"none"})),d=o.computed(()=>{var e;const a=(e=t.customClass)==null?void 0:e.split(" ");return a==null?void 0:a.reduce((r,f)=>(r[f]=!0,r),{})});return{showTooltip:s,tooltipDisplayStyle:i,tooltipCustomClass:d,tooltipContainerRef:l}}const x=o.defineComponent({name:"FTooltip",props:M,emits:["click"],setup(t,l){const s=o.ref(),i=o.ref(),d=o.ref(),a=o.ref(),e=o.ref(),r=o.ref(t.placement.split("-")[0]),f=U(t),{showTooltip:n,tooltipDisplayStyle:h,tooltipCustomClass:m,tooltipContainerRef:u}=f,p=o.computed(()=>{let c={"fv-tooltip":!0,tooltip:!0,show:!0};const g=`bs-tooltip-${r.value}`;return c[g]=!0,l.slots.default&&(c={...c,...m.value}),c}),v=c=>{c.stopPropagation(),c.target!==e.value&&(n.value=!1)},y=o.computed(()=>t.content&&!t.contentTemplate),L=o.computed(()=>t.content),T=o.ref("0px"),b=o.ref("0px"),S=o.computed(()=>{const c={left:T.value,top:b.value};return l.slots.default,c}),V=o.ref(""),C=o.ref(""),E=o.computed(()=>({left:V.value,top:C.value})),k=o.computed(()=>({"tooltip-inner":!0,"tooltip-inner-lg":a.value&&a.value&&a.value.scrollHeight>a.value.clientHeight})),z=o.computed(()=>{const c={};return t.width&&Object.assign(c,{width:t.width,"max-width":"none"}),c}),D=c=>{i.value&&d.value&&a.value&&(k.value,o.nextTick(()=>{const{tooltipPlacement:g,tooltipPosition:P}=Y(t,l,c.getBoundingClientRect(),d.value.getBoundingClientRect(),a.value.getBoundingClientRect(),i.value.getBoundingClientRect());T.value=`${P.value.tooltip.left+document.documentElement.scrollLeft}px`,b.value=`${P.value.tooltip.top+document.documentElement.scrollTop}px`,V.value=`${P.value.arrow.left}px`,C.value=`${P.value.arrow.top}px`,r.value=g.value}))},O=c=>{var P;const g=(P=s.value)==null?void 0:P.nextElementSibling;g&&(t.overflowShown&&g.scrollWidth===g.clientWidth||(c.stopPropagation(),n.value=!0,o.nextTick(()=>{D(g)})))},$=(c,g=!0)=>{c.removeEventListener("mouseenter",O),c.removeEventListener("mouseleave",v),g&&(c.addEventListener("mouseenter",O),c.addEventListener("mouseleave",v))};function F(c,g=!0){c.removeEventListener("mouseenter",O),c.removeEventListener("mouseleave",v),g&&(c.addEventListener("click",O),document.body.addEventListener("click",v))}function I(){var g;if(!t.enable)return;const c=(g=s.value)==null?void 0:g.nextElementSibling;c&&(t.trigger==="click"&&F(c),t.trigger==="hover"&&$(c))}function tt(){var g;const c=(g=s.value)==null?void 0:g.nextElementSibling;c&&(t.trigger==="click"&&F(c,!1),t.trigger==="hover"&&$(c,!1))}o.watch(()=>t.enable,c=>{c?I():tt()}),o.onMounted(()=>{I(),!y.value&&t.contentTemplate&&e.value&&e.value.appendChild(t.contentTemplate),t.reference&&D(t.reference)});function q(c){l.emit("click",c)}const et=()=>o.createVNode("div",{ref:d,class:p.value,style:S.value,onClick:q},[o.createVNode("div",{ref:i,class:"arrow",style:E.value},null),o.createVNode("div",{ref:a,class:k.value,style:z.value},[o.createVNode("div",{class:"tooltip-tmpl"},[y.value&&o.createVNode("div",{class:"tooltip-text",innerHTML:L.value},null),!y.value&&o.createVNode("div",{class:"tooltip-text",ref:e},null)])])]),ot=()=>o.createVNode("div",{ref:d,class:p.value,style:S.value,onClick:q},[o.createVNode("div",{ref:i,class:"arrow",style:E.value},null),o.createVNode("div",{ref:a,class:k.value,style:z.value},[o.createVNode("div",{class:"tooltip-tmpl"},[o.createVNode("div",{class:"tooltip-text",ref:e},[l.slots.contentTemplate?l.slots.contentTemplate():t.content])])])]);return()=>l.slots.default?o.createVNode(o.Fragment,{ref:s},[l.slots.default(),o.createVNode(o.Teleport,{to:"body"},{default:()=>[n.value&&ot()]})]):et()}});function B(t,l){const s=document.createElement("div");t.customClass&&(s.className=t.customClass);const i=o.createApp({setup(){function d(){t.clickToHide&&i.unmount()}return o.onUnmounted(()=>{document.body.removeChild(s)}),()=>o.createVNode(x,o.mergeProps(t,{onClick:d}),null)}});return document.body.appendChild(s),i.mount(s),i}function H(t){const l=o.reactive({...t});return B(l)}function K(t,l){let s;t.addEventListener("mouseenter",i=>{if(l.value.enable!==!1&&!(l.value.overflowShown&&t.scrollWidth===t.clientWidth)&&(i.stopPropagation(),!s)){const d=t.dataset.tooltip&&JSON.parse(t.dataset.tooltip)||{},a=Object.assign({reference:t,contentTemplate:l.value.contentTemplate},d);s=H(a)}}),t.addEventListener("mouseleave",i=>{i.stopPropagation(),s&&(s.unmount(),s=null)})}let N=null;const j=new WeakMap,A="_farris-tooltip-directive_";function Q(){document.querySelectorAll(`.${A}`).forEach(t=>{const l=j.get(t);l&&(l.unmount(),j.delete(t))})}function Z(t,l){t.addEventListener("click",s=>{if(l.value.enable===!1||l.value.overflowShown===!0&&t.scrollWidth===t.clientWidth)return;s.stopPropagation();let i=j.get(t);if(i)i.unmount(),j.delete(t);else{const d=t.dataset.tooltip&&JSON.parse(t.dataset.tooltip)||{},a=Object.assign({trigger:"hover",reference:t},d);i=H(a),j.set(t,i)}}),!N&&document.body.addEventListener("click",N=s=>{const i=s.target,d=i.closest(`.${A}`);d&&j.has(d)||i.closest(".tooltip")||Q()},!0)}function R(t,l){if(!l.value)t.dataset.tooltip="";else{const{contentTemplate:s,...i}=l.value;t.dataset.tooltip=JSON.stringify(i)}}const W={mounted:(t,l,s)=>{switch(t.classList.add(A),R(t,l),l.value.trigger){case"click":{Z(t,l);break}default:K(t,l)}},unMounted:(t,l,s)=>{l.value.trigger==="click"&&document.body.removeEventListener("click",N,!0)},beforeUpdate:(t,l)=>{R(t,l)}};x.install=t=>{t.component(x.name,x),t.directive("tooltip",W)},w.FTooltip=x,w.FTooltipDirective=W,w.default=x,w.tooltipProps=M,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(w,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(w=typeof globalThis<"u"?globalThis:w||self,e(w.tooltip={},w.Vue))})(this,function(w,e){"use strict";const R={content:{type:String,default:""},contentTemplate:{type:Object},width:{type:String},customClass:{type:String},placement:{type:String,default:"top"},trigger:{type:String,default:"hover"},reference:{type:Object,require:!0},horizontalRelative:{type:String,default:""},verticalRelative:{type:String,default:""},clickToHide:{type:Boolean,default:!0},enable:{type:Boolean,default:!0},overflowShown:{type:Boolean,default:!1}};function J(t,l){const c=new Map([["top","bottom"],["bottom","top"],["left","right"],["right","left"]]),r=new Map([["top","height"],["bottom","height"],["left","width"],["right","width"]]);function d(o,a){const f=c.get(a)||a;return o.replace(a,f)}function s(o,a,f,n,h){let v=o;const u=o.split("-")[0],p=r.get(u),g=n[p]+h[p];return Math.abs(f[u]-a[u])<g&&(v=d(o,u)),v}return{adjustPlacement:s}}function X(t,l){function r(s,o,a){let f=!1,n=a;return(o==="left"||o==="top")&&a<=s[o]&&(f=!0,n=s[o]+6),(o==="right"||o==="bottom")&&a>=s[o]&&(f=!0,n=s[o]-6),{overBound:f,fixedValue:n}}function d(s,o,a,f,n,h,v){let u=o.tooltip.left,p=o.tooltip.top,g=o.arrow.left,y=o.arrow.top;const k=s.split("-")[0];if(["top","bottom"].includes(k)){const x=r(a,"left",o.tooltip.left),P=r(a,"right",o.tooltip.left+n.width);u=x.overBound?x.fixedValue:P.overBound?P.fixedValue-n.width:o.tooltip.left,g=x.overBound?n.width-(u+n.width-f.right)-v.width:P.overBound?f.left-u:o.arrow.left}const S=r(a,"top",o.tooltip.top),E=r(a,"bottom",o.tooltip.top+n.height);return p=S.overBound?S.fixedValue:E.overBound?E.fixedValue-n.height:o.tooltip.top,y=S.overBound?o.arrow.top:E.overBound?n.height-(p+n.height-f.top):o.arrow.top,{arrow:{left:g,top:y},tooltip:{left:u,top:p}}}return{adjustPosition:d}}function Y(t,l){function r(o,a,f,n,h){const v=o.split("-"),u=v[0],p=v[1]||"middle",g=["top","bottom"].includes(u)?p==="middle"?(n.width-h.width)/2:p==="right"?n.width-h.width-6:6:0,y=["left","right"].includes(u)?p==="middle"?(n.height-h.height)/2:p==="bottom"?n.height-h.height-6:6:0,b=u==="left"?n.width+h.width:0,k=u==="top"?n.height+h.height:0;return{left:b+g,top:k+y,right:0}}function d(o,a,f,n,h){const v=o.split("-"),u=v[0],p=v[1]||"middle",g=(f.width-n.width)/2,y=(f.height-n.height)/2,b=u==="right"?a.right:a.left,k=u==="bottom"?a.bottom:a.top,S=u==="top"?0-y-n.height-h.height:u==="bottom"?0-y+h.height:0,E=["left","right"].includes(u)?p==="middle"?(a.height-n.height)/2:p==="bottom"?a.height-n.height:0:0,V=u==="left"?0-g-n.width-h.width:u==="right"?0-g+h.width:0,C=["top","bottom"].includes(u)?p==="middle"?(a.width-n.width)/2:p==="right"?a.width-n.width:0:0,x=k+S+E;return{left:b+V+C,top:x}}function s(o,a,f,n,h){const v=d(o,a,f,n,h);return{arrow:r(o,a,f,n,h),tooltip:v}}return{calculate:s}}function U(t,l){const c=e.ref(t.horizontalRelative),r=e.ref(t.verticalRelative);function d(o){return typeof o=="string"?document.querySelector(o):o}function s(){let o=document.documentElement.clientWidth,a=document.documentElement.clientHeight,f=0,n=0,h=0,v=0,u=a-f,p=o-n;return c.value&&({left:n,right:o,x:h,width:p}=d(c.value).getBoundingClientRect()),r.value&&({bottom:a,top:f,y:v,height:u}=d(r.value).getBoundingClientRect()),{top:f,left:n,right:o,bottom:a,height:u,width:p,x:h,y:v}}return{getRelativeElementBound:s}}function B(t,l,c,r,d,s){const o=e.ref(t.placement),{getRelativeElementBound:a}=U(t),{calculate:f}=Y(),{adjustPlacement:n}=J(),{adjustPosition:h}=X(),v=e.computed(()=>o.value.split("-")[0]),u=e.computed(()=>{const p=a();o.value=n(o.value,p,c,r,s);const g=f(o.value,c,r,d,s);return h(o.value,g,p,c,r,d,s)});return{tooltipPlacement:v,tooltipPosition:u}}function K(t){const l=e.ref(),c=e.ref(!1),r=e.computed(()=>({display:c.value?"block":"none"})),d=e.computed(()=>{var o;const s=(o=t.customClass)==null?void 0:o.split(" ");return s==null?void 0:s.reduce((a,f)=>(a[f]=!0,a),{})});return{showTooltip:c,tooltipDisplayStyle:r,tooltipCustomClass:d,tooltipContainerRef:l}}const j=e.defineComponent({name:"FTooltip",props:R,emits:["click"],setup(t,l){const c=e.ref(),r=e.ref(),d=e.ref(),s=e.ref(),o=e.ref(),a=e.ref(t.placement.split("-")[0]),f=K(t),{showTooltip:n,tooltipDisplayStyle:h,tooltipCustomClass:v,tooltipContainerRef:u}=f,p=e.ref(!1),g=e.computed(()=>{let i={"fv-tooltip":!0,tooltip:!0,show:!0};const m=`bs-tooltip-${a.value}`;return i[m]=!0,l.slots.default&&(i={...i,...v.value}),i}),y=i=>{i.stopPropagation(),i.target!==o.value&&(n.value=!1)},b=e.computed(()=>t.content&&!t.contentTemplate),k=e.computed(()=>t.content),S=e.ref("0px"),E=e.ref("0px"),V=e.computed(()=>{const i={left:S.value,top:E.value};return l.slots.default,i}),C=e.ref(""),x=e.ref(""),P=e.computed(()=>({left:C.value,top:x.value})),M=e.computed(()=>({"tooltip-inner":!0,"tooltip-inner-lg":s.value&&s.value&&s.value.scrollHeight>s.value.clientHeight})),F=e.computed(()=>{const i={};return t.width&&Object.assign(i,{width:t.width,"max-width":"none"}),i}),$=i=>{r.value&&d.value&&s.value&&(M.value,e.nextTick(()=>{const{tooltipPlacement:m,tooltipPosition:T}=B(t,l,i.getBoundingClientRect(),d.value.getBoundingClientRect(),s.value.getBoundingClientRect(),r.value.getBoundingClientRect());S.value=`${T.value.tooltip.left+document.documentElement.scrollLeft}px`,E.value=`${T.value.tooltip.top+document.documentElement.scrollTop}px`,C.value=`${T.value.arrow.left}px`,x.value=`${T.value.arrow.top}px`,a.value=m.value}))},N=i=>{var T;const m=(T=c.value)==null?void 0:T.nextElementSibling;m&&(t.overflowShown&&m.scrollWidth===m.clientWidth||(i.stopPropagation(),n.value=!0,e.nextTick(()=>{$(m)})))},I=(i,m=!0)=>{i.removeEventListener("mouseenter",N),i.removeEventListener("mouseleave",y),m&&(i.addEventListener("mouseenter",N),i.addEventListener("mouseleave",y))};function q(i,m=!0){i.removeEventListener("mouseenter",N),i.removeEventListener("mouseleave",y),m&&(i.addEventListener("click",N),document.body.addEventListener("click",y))}function H(){var m;if(!t.enable)return;const i=(m=c.value)==null?void 0:m.nextElementSibling;i&&(t.trigger==="click"&&q(i),t.trigger==="hover"&&I(i))}function ot(){var m;const i=(m=c.value)==null?void 0:m.nextElementSibling;i&&(t.trigger==="click"&&q(i,!1),t.trigger==="hover"&&I(i,!1))}e.watch(()=>t.enable,i=>{i?H():ot()});function nt(){c.value&&c.value.nodeName==="#text"&&!c.value.nextElementSibling&&(p.value=!0,e.nextTick(()=>{H()}))}e.onMounted(()=>{nt(),H(),!b.value&&t.contentTemplate&&o.value&&o.value.appendChild(t.contentTemplate),t.reference&&$(t.reference)});function _(i){l.emit("click",i)}const lt=()=>e.createVNode("div",{ref:d,class:g.value,style:V.value,onClick:_},[e.createVNode("div",{ref:r,class:"arrow",style:P.value},null),e.createVNode("div",{ref:s,class:M.value,style:F.value},[e.createVNode("div",{class:"tooltip-tmpl"},[b.value&&e.createVNode("div",{class:"tooltip-text",innerHTML:k.value},null),!b.value&&e.createVNode("div",{class:"tooltip-text",ref:o},null)])])]),it=()=>e.createVNode("div",{ref:d,class:g.value,style:V.value,onClick:_},[e.createVNode("div",{ref:r,class:"arrow",style:P.value},null),e.createVNode("div",{ref:s,class:M.value,style:F.value},[e.createVNode("div",{class:"tooltip-tmpl"},[e.createVNode("div",{class:"tooltip-text",ref:o},[l.slots.contentTemplate?l.slots.contentTemplate():t.content])])])]);function rt(){var i,m,T,G;return p.value?e.createVNode("span",null,[(m=(i=l.slots).default)==null?void 0:m.call(i)]):(G=(T=l.slots).default)==null?void 0:G.call(T)}return()=>l.slots.default?e.createVNode(e.Fragment,{ref:c},[rt(),e.createVNode(e.Teleport,{to:"body"},{default:()=>[n.value&&it()]})]):lt()}});function Q(t,l){const c=document.createElement("div");t.customClass&&(c.className=t.customClass);const r=e.createApp({setup(){function d(){t.clickToHide&&r.unmount()}return e.onUnmounted(()=>{document.body.removeChild(c)}),()=>e.createVNode(j,e.mergeProps(t,{onClick:d}),null)}});return document.body.appendChild(c),r.mount(c),r}function W(t){const l=e.reactive({...t});return Q(l)}function Z(t,l){let c;t.addEventListener("mouseenter",r=>{if(l.value.enable!==!1&&!(l.value.overflowShown&&t.scrollWidth===t.clientWidth)&&(r.stopPropagation(),!c)){const d=t.dataset.tooltip&&JSON.parse(t.dataset.tooltip)||{},s=Object.assign({reference:t,contentTemplate:l.value.contentTemplate},d);c=W(s)}}),t.addEventListener("mouseleave",r=>{r.stopPropagation(),c&&(c.unmount(),c=null)})}let O=null;const L=new WeakMap,A="_farris-tooltip-directive_";function tt(){document.querySelectorAll(`.${A}`).forEach(t=>{const l=L.get(t);l&&(l.unmount(),L.delete(t))})}function et(t,l){t.addEventListener("click",c=>{if(l.value.enable===!1||l.value.overflowShown===!0&&t.scrollWidth===t.clientWidth)return;c.stopPropagation();let r=L.get(t);if(r)r.unmount(),L.delete(t);else{const d=t.dataset.tooltip&&JSON.parse(t.dataset.tooltip)||{},s=Object.assign({trigger:"hover",reference:t},d);r=W(s),L.set(t,r)}}),!O&&document.body.addEventListener("click",O=c=>{const r=c.target,d=r.closest(`.${A}`);d&&L.has(d)||r.closest(".tooltip")||tt()},!0)}function z(t,l){if(!l.value)t.dataset.tooltip="";else{const{contentTemplate:c,...r}=l.value;t.dataset.tooltip=JSON.stringify(r)}}const D={mounted:(t,l,c)=>{switch(t.classList.add(A),z(t,l),l.value.trigger){case"click":{et(t,l);break}default:Z(t,l)}},unMounted:(t,l,c)=>{l.value.trigger==="click"&&document.body.removeEventListener("click",O,!0)},beforeUpdate:(t,l)=>{z(t,l)}};j.install=t=>{t.component(j.name,j),t.directive("tooltip",D)},w.FTooltip=j,w.FTooltipDirective=D,w.default=j,w.tooltipProps=R,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});