@farris/ui-vue 1.8.5-beta.18 → 1.8.5-beta.19

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.
@@ -1,5 +1,5 @@
1
- import { ref as y, onMounted as J, isRef as it, computed as T, defineComponent as lt, watch as rt, createVNode as g, Fragment as ct, Teleport as st, nextTick as W, mergeProps as U, reactive as at, createApp as ut, onUnmounted as ft } from "vue";
2
- const dt = {
1
+ import { ref as w, onMounted as Y, isRef as ot, computed as T, defineComponent as nt, watch as lt, createVNode as g, Fragment as it, Teleport as rt, nextTick as B, mergeProps as G, reactive as ct, createApp as st, onUnmounted as ut } from "vue";
2
+ const at = {
3
3
  /**
4
4
  * 提示内容,可以是字符串,可以是带 HTML 标签的字符串
5
5
  */
@@ -41,14 +41,14 @@ const dt = {
41
41
  // 是否根据溢出自动显示提示
42
42
  overflowShown: { type: Boolean, default: !1 }
43
43
  };
44
- function pt() {
45
- const t = y(!1);
46
- return J(() => {
44
+ function ft() {
45
+ const t = w(!1);
46
+ return Y(() => {
47
47
  t.value = !0;
48
48
  }), t;
49
49
  }
50
- function vt(t, e) {
51
- const n = /* @__PURE__ */ new Map([
50
+ function dt(t, e) {
51
+ const o = /* @__PURE__ */ new Map([
52
52
  ["top", "bottom"],
53
53
  ["bottom", "top"],
54
54
  ["left", "right"],
@@ -59,354 +59,370 @@ function vt(t, e) {
59
59
  ["left", "width"],
60
60
  ["right", "width"]
61
61
  ]);
62
- function d(o, i) {
63
- const f = n.get(i) || i;
64
- return o.replace(i, f);
62
+ function u(n, i) {
63
+ const a = o.get(i) || i;
64
+ return n.replace(i, a);
65
65
  }
66
- function s(o, i, f, r, a) {
67
- let v = o;
68
- const u = o.split("-")[0], p = l.get(u), m = r[p] + a[p];
69
- return Math.abs(f[u] - i[u]) < m && (v = d(o, u)), v;
66
+ function c(n, i, a, r, f) {
67
+ let v = n;
68
+ const d = n.split("-")[0], p = l.get(d), m = r[p] + f[p];
69
+ return Math.abs(a[d] - i[d]) < m && (v = u(n, d)), v;
70
70
  }
71
- return { adjustPlacement: s };
71
+ return { adjustPlacement: c };
72
72
  }
73
- function ht(t, e) {
74
- function l(s, o, i) {
75
- let f = !1, r = i;
76
- return (o === "left" || o === "top") && i <= s[o] && (f = !0, r = s[o] + 6), (o === "right" || o === "bottom") && i >= s[o] && (f = !0, r = s[o] - 6), { overBound: f, fixedValue: r };
73
+ function pt(t, e) {
74
+ function l(c, n, i) {
75
+ let a = !1, r = i;
76
+ return (n === "left" || n === "top") && i <= c[n] && (a = !0, r = c[n] + 6), (n === "right" || n === "bottom") && i >= c[n] && (a = !0, r = c[n] - 6), { overBound: a, fixedValue: r };
77
77
  }
78
- function d(s, o, i, f, r, a, v) {
79
- let u = o.tooltip.left, p = o.tooltip.top, m = o.arrow.left, w = o.arrow.top;
80
- const b = s.split("-")[0];
78
+ function u(c, n, i, a, r, f, v) {
79
+ let d = n.tooltip.left, p = n.tooltip.top, m = n.arrow.left, y = n.arrow.top;
80
+ const b = c.split("-")[0];
81
81
  if (["top", "bottom"].includes(b)) {
82
- const k = l(i, "left", o.tooltip.left), P = l(i, "right", o.tooltip.left + r.width);
83
- u = k.overBound ? k.fixedValue : P.overBound ? P.fixedValue - r.width : o.tooltip.left, m = k.overBound ? r.width - (u + r.width - f.right) - v.width : P.overBound ? f.left - u : o.arrow.left;
82
+ const x = l(i, "left", n.tooltip.left), C = l(i, "right", n.tooltip.left + r.width);
83
+ d = x.overBound ? x.fixedValue : C.overBound ? C.fixedValue - r.width : n.tooltip.left, m = x.overBound ? r.width - (d + r.width - a.right) - v.width : C.overBound ? a.left - d : n.arrow.left;
84
84
  }
85
- const E = l(i, "top", o.tooltip.top), L = l(i, "bottom", o.tooltip.top + r.height);
86
- return p = E.overBound ? E.fixedValue : L.overBound ? L.fixedValue - r.height : o.tooltip.top, w = E.overBound ? o.arrow.top : L.overBound ? r.height - (p + r.height - f.top) : o.arrow.top, { arrow: { left: m, top: w }, tooltip: { left: u, top: p } };
85
+ const E = l(i, "top", n.tooltip.top), S = l(i, "bottom", n.tooltip.top + r.height);
86
+ return p = E.overBound ? E.fixedValue : S.overBound ? S.fixedValue - r.height : n.tooltip.top, y = E.overBound ? n.arrow.top : S.overBound ? r.height - (p + r.height - a.top) : n.arrow.top, { arrow: { left: m, top: y }, tooltip: { left: d, top: p } };
87
87
  }
88
- return { adjustPosition: d };
88
+ return { adjustPosition: u };
89
89
  }
90
- function mt(t, e) {
91
- function l(o, i, f, r, a) {
92
- const v = o.split("-"), u = v[0], p = v[1] || "middle", m = ["top", "bottom"].includes(u) ? p === "middle" ? (r.width - a.width) / 2 : p === "right" ? r.width - a.width - 6 : 6 : 0, w = ["left", "right"].includes(u) ? p === "middle" ? (r.height - a.height) / 2 : p === "bottom" ? r.height - a.height - 6 : 6 : 0, S = u === "left" ? r.width + a.width : 0, b = u === "top" ? r.height + a.height : 0;
93
- return { left: S + m, top: b + w, right: 0 };
90
+ function vt(t, e) {
91
+ function l(n, i, a, r, f) {
92
+ const v = n.split("-"), d = v[0], p = v[1] || "middle", m = ["top", "bottom"].includes(d) ? p === "middle" ? (r.width - f.width) / 2 : p === "right" ? r.width - f.width - 6 : 6 : 0, y = ["left", "right"].includes(d) ? p === "middle" ? (r.height - f.height) / 2 : p === "bottom" ? r.height - f.height - 6 : 6 : 0, L = d === "left" ? r.width + f.width : 0, b = d === "top" ? r.height + f.height : 0;
93
+ return { left: L + m, top: b + y, right: 0 };
94
94
  }
95
- function d(o, i, f, r, a) {
96
- const v = o.split("-"), u = v[0], p = v[1] || "middle", m = (f.width - r.width) / 2, w = (f.height - r.height) / 2, S = u === "right" ? i.right : i.left, b = u === "bottom" ? i.bottom : i.top, E = u === "top" ? 0 - w - r.height - a.height : u === "bottom" ? 0 - w + a.height : 0, L = ["left", "right"].includes(u) ? p === "middle" ? (i.height - r.height) / 2 : p === "bottom" ? i.height - r.height : 0 : 0, H = u === "left" ? 0 - m - r.width - a.width : u === "right" ? 0 - m + a.width : 0, O = ["top", "bottom"].includes(u) ? p === "middle" ? (i.width - r.width) / 2 : p === "right" ? i.width - r.width : 0 : 0, k = b + E + L;
97
- return { left: S + H + O, top: k };
95
+ function u(n, i, a, r, f) {
96
+ const v = n.split("-"), d = v[0], p = v[1] || "middle", m = (a.width - r.width) / 2, y = (a.height - r.height) / 2, L = d === "right" ? i.right : i.left, b = d === "bottom" ? i.bottom : i.top, E = d === "top" ? 0 - y - r.height - f.height : d === "bottom" ? 0 - y + f.height : 0, S = ["left", "right"].includes(d) ? p === "middle" ? (i.height - r.height) / 2 : p === "bottom" ? i.height - r.height : 0 : 0, H = d === "left" ? 0 - m - r.width - f.width : d === "right" ? 0 - m + f.width : 0, j = ["top", "bottom"].includes(d) ? p === "middle" ? (i.width - r.width) / 2 : p === "right" ? i.width - r.width : 0 : 0, x = b + E + S;
97
+ return { left: L + H + j, top: x };
98
98
  }
99
- function s(o, i, f, r, a) {
100
- const v = d(o, i, f, r, a);
101
- return { arrow: l(o, i, f, r, a), tooltip: v };
99
+ function c(n, i, a, r, f) {
100
+ const v = u(n, i, a, r, f);
101
+ return { arrow: l(n, i, a, r, f), tooltip: v };
102
102
  }
103
- return { calculate: s };
103
+ return { calculate: c };
104
104
  }
105
- function X(t) {
106
- const e = it(t) ? t.value : t;
105
+ function ht(t) {
106
+ const e = ot(t) ? t.value : t;
107
107
  return typeof e == "string" ? e === "body" || typeof document > "u" ? "body" : document.querySelector(e) || "body" : !!e && typeof e.getBoundingClientRect == "function" && typeof e.insertBefore == "function" ? e : "body";
108
108
  }
109
- function gt(t) {
109
+ function mt(t) {
110
110
  return typeof document > "u" ? null : t === "body" ? document.body : t;
111
111
  }
112
- function Y(t, e) {
113
- const n = gt(t);
114
- if (!n) {
115
- const a = typeof window < "u" ? window.innerHeight : 0;
112
+ function gt(t, e) {
113
+ const o = mt(t);
114
+ if (!o) {
115
+ const f = typeof window < "u" ? window.innerHeight : 0;
116
116
  return {
117
117
  left: 0,
118
118
  top: 0,
119
119
  width: 0,
120
- height: a,
121
- bottom: a,
120
+ height: f,
121
+ bottom: f,
122
122
  scrollLeft: 0,
123
123
  scrollTop: 0
124
124
  };
125
125
  }
126
- const l = n.getBoundingClientRect(), d = t === "body" || n === document.body, s = typeof window < "u" ? window.innerHeight : l.height;
127
- let { width: o } = l;
126
+ const l = o.getBoundingClientRect(), u = t === "body" || o === document.body, c = typeof window < "u" ? window.innerHeight : l.height;
127
+ let { width: n } = l;
128
128
  const { top: i } = l;
129
- let { bottom: f, height: r } = l;
130
- if (d) {
131
- const a = Math.max(l.top, 0), v = Math.min(l.bottom, s);
132
- f = v, r = Math.max(v - a, 0) || s, f <= a && (f = s);
129
+ let { bottom: a, height: r } = l;
130
+ if (u) {
131
+ const f = Math.max(l.top, 0), v = Math.min(l.bottom, c);
132
+ a = v, r = Math.max(v - f, 0) || c, a <= f && (a = c);
133
133
  }
134
134
  return {
135
135
  left: l.left,
136
136
  top: i,
137
- width: o,
137
+ width: n,
138
138
  height: r,
139
- bottom: f,
140
- scrollLeft: n.scrollLeft || 0,
141
- scrollTop: n.scrollTop || 0
139
+ bottom: a,
140
+ scrollLeft: o.scrollLeft || 0,
141
+ scrollTop: o.scrollTop || 0
142
142
  };
143
143
  }
144
- function yt(t) {
145
- const e = Y(t);
144
+ function wt(t) {
145
+ const e = t.ownerDocument, o = t.offsetParent;
146
+ if (!o)
147
+ return null;
148
+ if (o === e.body || o === e.documentElement) {
149
+ const u = (e.defaultView || window).getComputedStyle(o), c = (i) => !!i && i !== "none";
150
+ if (!(u.position !== "static" || c(u.transform) || c(u.filter) || c(u.perspective)))
151
+ return null;
152
+ }
153
+ return o;
154
+ }
155
+ function yt(t, e, o) {
156
+ const l = wt(t);
157
+ if (!l) {
158
+ const c = t.ownerDocument, n = c.defaultView || window, i = c.documentElement, a = (n.scrollX ?? i.scrollLeft) || 0, r = (n.scrollY ?? i.scrollTop) || 0;
159
+ return { left: e + a, top: o + r };
160
+ }
161
+ const u = l.getBoundingClientRect();
146
162
  return {
147
- left: e.left - e.scrollLeft,
148
- top: e.top - e.scrollTop
163
+ left: e - u.left - (l.clientLeft || 0) + (l.scrollLeft || 0),
164
+ top: o - u.top - (l.clientTop || 0) + (l.scrollTop || 0)
149
165
  };
150
166
  }
151
- function wt(t, e) {
152
- const n = y(t.horizontalRelative), l = y(t.verticalRelative);
153
- function d(i) {
167
+ function bt(t, e) {
168
+ const o = w(t.horizontalRelative), l = w(t.verticalRelative);
169
+ function u(i) {
154
170
  return typeof i == "string" ? document.querySelector(i) : i;
155
171
  }
156
- function s() {
157
- return Y(X("body"));
172
+ function c() {
173
+ return gt(ht("body"));
158
174
  }
159
- function o() {
160
- const i = s(), f = document.documentElement.clientWidth, r = document.documentElement.clientHeight;
161
- let a = Math.max(i.left, 0), v = Math.max(i.top, 0), u = Math.min(i.left + i.width, f), p = Math.min(i.bottom, r), m = a, w = v, S = u - a, b = p - v;
162
- return n.value && ({ left: a, right: u, x: m, width: S } = d(n.value).getBoundingClientRect()), l.value && ({ bottom: p, top: v, y: w, height: b } = d(l.value).getBoundingClientRect()), { top: v, left: a, right: u, bottom: p, height: b, width: S, x: m, y: w };
175
+ function n() {
176
+ const i = c(), a = document.documentElement.clientWidth, r = document.documentElement.clientHeight;
177
+ let f = Math.max(i.left, 0), v = Math.max(i.top, 0), d = Math.min(i.left + i.width, a), p = Math.min(i.bottom, r), m = f, y = v, L = d - f, b = p - v;
178
+ return o.value && ({ left: f, right: d, x: m, width: L } = u(o.value).getBoundingClientRect()), l.value && ({ bottom: p, top: v, y, height: b } = u(l.value).getBoundingClientRect()), { top: v, left: f, right: d, bottom: p, height: b, width: L, x: m, y };
163
179
  }
164
- return { getRelativeElementBound: o };
180
+ return { getRelativeElementBound: n };
165
181
  }
166
- function bt(t, e, n, l, d, s) {
167
- const o = y(t.placement), { getRelativeElementBound: i } = wt(t), { calculate: f } = mt(), { adjustPlacement: r } = vt(), { adjustPosition: a } = ht(), v = T(() => o.value.split("-")[0]), u = T(() => {
182
+ function Tt(t, e, o, l, u, c) {
183
+ const n = w(t.placement), { getRelativeElementBound: i } = bt(t), { calculate: a } = vt(), { adjustPlacement: r } = dt(), { adjustPosition: f } = pt(), v = T(() => n.value.split("-")[0]), d = T(() => {
168
184
  const p = i();
169
- o.value = r(o.value, p, n, l, s);
170
- const m = f(o.value, n, l, d, s);
171
- return a(
172
- o.value,
185
+ n.value = r(n.value, p, o, l, c);
186
+ const m = a(n.value, o, l, u, c);
187
+ return f(
188
+ n.value,
173
189
  m,
174
190
  p,
175
- n,
191
+ o,
176
192
  l,
177
- d,
178
- s
193
+ u,
194
+ c
179
195
  );
180
196
  });
181
- return { tooltipPlacement: v, tooltipPosition: u };
197
+ return { tooltipPlacement: v, tooltipPosition: d };
182
198
  }
183
- function Tt(t) {
184
- const e = y(), n = y(!1), l = T(() => ({
185
- display: n.value ? "block" : "none"
186
- })), d = T(() => {
187
- var o;
188
- const s = (o = t.customClass) == null ? void 0 : o.split(" ");
189
- return s == null ? void 0 : s.reduce((i, f) => (i[f] = !0, i), {});
199
+ function Et(t) {
200
+ const e = w(), o = w(!1), l = T(() => ({
201
+ display: o.value ? "block" : "none"
202
+ })), u = T(() => {
203
+ var n;
204
+ const c = (n = t.customClass) == null ? void 0 : n.split(" ");
205
+ return c == null ? void 0 : c.reduce((i, a) => (i[a] = !0, i), {});
190
206
  });
191
- return { showTooltip: n, tooltipDisplayStyle: l, tooltipCustomClass: d, tooltipContainerRef: e };
207
+ return { showTooltip: o, tooltipDisplayStyle: l, tooltipCustomClass: u, tooltipContainerRef: e };
192
208
  }
193
- const A = /* @__PURE__ */ lt({
209
+ const M = /* @__PURE__ */ nt({
194
210
  name: "FTooltip",
195
- props: dt,
211
+ props: at,
196
212
  emits: ["click"],
197
213
  setup(t, e) {
198
- const n = y(), l = y(), d = y(), s = y(), o = y(), i = y(t.placement.split("-")[0]), f = Tt(t), {
214
+ const o = w(), l = w(), u = w(), c = w(), n = w(), i = w(t.placement.split("-")[0]), a = Et(t), {
199
215
  showTooltip: r,
200
- tooltipCustomClass: a
201
- } = f, v = y(!1), u = pt(), p = T(() => {
202
- let c = {
216
+ tooltipCustomClass: f
217
+ } = a, v = w(!1), d = ft(), p = T(() => {
218
+ let s = {
203
219
  "fv-tooltip": !0,
204
220
  tooltip: !0,
205
221
  show: !0
206
222
  };
207
223
  const h = `bs-tooltip-${i.value}`;
208
- return c[h] = !0, e.slots.default && (c = {
209
- ...c,
210
- ...a.value
211
- }), c;
212
- }), m = (c) => {
213
- c.target !== o.value && (c.stopPropagation(), document.body.removeEventListener("click", m), r.value = !1);
214
- }, w = T(() => t.content && !t.contentTemplate), S = T(() => t.content), b = y("0px"), E = y("0px"), L = T(() => {
215
- const c = {
224
+ return s[h] = !0, e.slots.default && (s = {
225
+ ...s,
226
+ ...f.value
227
+ }), s;
228
+ }), m = (s) => {
229
+ s.target !== n.value && (s.stopPropagation(), document.body.removeEventListener("click", m), r.value = !1);
230
+ }, y = T(() => t.content && !t.contentTemplate), L = T(() => t.content), b = w("0px"), E = w("0px"), S = T(() => {
231
+ const s = {
216
232
  left: b.value,
217
233
  top: E.value
218
234
  };
219
- return e.slots.default, c;
220
- }), H = y(""), O = y(""), k = T(() => ({
235
+ return e.slots.default, s;
236
+ }), H = w(""), j = w(""), x = T(() => ({
221
237
  left: H.value,
222
- top: O.value
223
- })), P = T(() => ({
238
+ top: j.value
239
+ })), C = T(() => ({
224
240
  "tooltip-inner": !0,
225
- "tooltip-inner-lg": s.value && s.value && s.value.scrollHeight > s.value.clientHeight
241
+ "tooltip-inner-lg": c.value && c.value && c.value.scrollHeight > c.value.clientHeight
226
242
  })), D = T(() => {
227
- const c = {};
228
- return t.width && Object.assign(c, {
243
+ const s = {};
244
+ return t.width && Object.assign(s, {
229
245
  width: t.width,
230
246
  "max-width": "none"
231
- }), c;
232
- }), N = (c) => {
233
- l.value && d.value && s.value && (P.value, W(() => {
247
+ }), s;
248
+ }), z = (s) => {
249
+ l.value && u.value && c.value && (C.value, B(() => {
234
250
  const {
235
251
  tooltipPlacement: h,
236
- tooltipPosition: x
237
- } = bt(t, e, c.getBoundingClientRect(), d.value.getBoundingClientRect(), s.value.getBoundingClientRect(), l.value.getBoundingClientRect()), j = yt(X("body"));
238
- b.value = `${x.value.tooltip.left - j.left}px`, E.value = `${x.value.tooltip.top - j.top}px`, H.value = `${x.value.arrow.left}px`, O.value = `${x.value.arrow.top}px`, i.value = h.value;
252
+ tooltipPosition: k
253
+ } = Tt(t, e, s.getBoundingClientRect(), u.value.getBoundingClientRect(), c.value.getBoundingClientRect(), l.value.getBoundingClientRect()), O = yt(u.value, k.value.tooltip.left, k.value.tooltip.top);
254
+ b.value = `${O.left}px`, E.value = `${O.top}px`, H.value = `${k.value.arrow.left}px`, j.value = `${k.value.arrow.top}px`, i.value = h.value;
239
255
  }));
240
- }, M = (c) => {
241
- var x;
242
- const h = (x = n.value) == null ? void 0 : x.nextElementSibling;
243
- h && (t.overflowShown && h.scrollWidth === h.clientWidth || (c.stopPropagation(), r.value = !0, W(() => {
244
- N(h);
256
+ }, A = (s) => {
257
+ var k;
258
+ const h = (k = o.value) == null ? void 0 : k.nextElementSibling;
259
+ h && (t.overflowShown && h.scrollWidth === h.clientWidth || (s.stopPropagation(), r.value = !0, B(() => {
260
+ z(h);
245
261
  }), t.trigger === "click" && document.body.addEventListener("click", m)));
246
- }, B = (c, h = !0) => {
247
- c.removeEventListener("mouseenter", M), c.removeEventListener("mouseleave", m), h && (c.addEventListener("mouseenter", M), c.addEventListener("mouseleave", m));
262
+ }, N = (s, h = !0) => {
263
+ s.removeEventListener("mouseenter", A), s.removeEventListener("mouseleave", m), h && (s.addEventListener("mouseenter", A), s.addEventListener("mouseleave", m));
248
264
  };
249
- function F(c, h = !0) {
250
- c.removeEventListener("mouseenter", M), c.removeEventListener("mouseleave", m), h && c.addEventListener("click", M);
265
+ function F(s, h = !0) {
266
+ s.removeEventListener("mouseenter", A), s.removeEventListener("mouseleave", m), h && s.addEventListener("click", A);
251
267
  }
252
268
  function R() {
253
269
  var h;
254
270
  if (!t.enable)
255
271
  return;
256
- const c = (h = n.value) == null ? void 0 : h.nextElementSibling;
257
- c && (t.trigger === "click" && F(c), t.trigger === "hover" && B(c));
272
+ const s = (h = o.value) == null ? void 0 : h.nextElementSibling;
273
+ s && (t.trigger === "click" && F(s), t.trigger === "hover" && N(s));
258
274
  }
259
- function Q() {
275
+ function _() {
260
276
  var h;
261
- const c = (h = n.value) == null ? void 0 : h.nextElementSibling;
262
- c && (t.trigger === "click" && F(c, !1), t.trigger === "hover" && B(c, !1));
277
+ const s = (h = o.value) == null ? void 0 : h.nextElementSibling;
278
+ s && (t.trigger === "click" && F(s, !1), t.trigger === "hover" && N(s, !1));
263
279
  }
264
- rt(() => t.enable, (c) => {
265
- c ? R() : Q();
280
+ lt(() => t.enable, (s) => {
281
+ s ? R() : _();
266
282
  });
267
- function Z() {
268
- n.value && n.value.nodeName === "#text" && !n.value.nextElementSibling && (v.value = !0, W(() => {
283
+ function K() {
284
+ o.value && o.value.nodeName === "#text" && !o.value.nextElementSibling && (v.value = !0, B(() => {
269
285
  R();
270
286
  }));
271
287
  }
272
- J(() => {
273
- Z(), R(), !w.value && t.contentTemplate && o.value && o.value.appendChild(t.contentTemplate), t.reference && N(t.reference);
288
+ Y(() => {
289
+ K(), R(), !y.value && t.contentTemplate && n.value && n.value.appendChild(t.contentTemplate), t.reference && z(t.reference);
274
290
  });
275
- function I(c) {
276
- e.emit("click", c);
291
+ function I(s) {
292
+ e.emit("click", s);
277
293
  }
278
- const tt = () => g("div", {
279
- ref: d,
294
+ const Q = () => g("div", {
295
+ ref: u,
280
296
  class: p.value,
281
- style: L.value,
297
+ style: S.value,
282
298
  onClick: I
283
299
  }, [g("div", {
284
300
  ref: l,
285
301
  class: "arrow",
286
- style: k.value
302
+ style: x.value
287
303
  }, null), g("div", {
288
- ref: s,
289
- class: P.value,
304
+ ref: c,
305
+ class: C.value,
290
306
  style: D.value
291
307
  }, [g("div", {
292
308
  class: "tooltip-tmpl"
293
- }, [w.value && g("div", {
309
+ }, [y.value && g("div", {
294
310
  class: "tooltip-text",
295
- innerHTML: S.value
296
- }, null), !w.value && g("div", {
311
+ innerHTML: L.value
312
+ }, null), !y.value && g("div", {
297
313
  class: "tooltip-text",
298
- ref: o
314
+ ref: n
299
315
  }, null)])])]);
300
- function et() {
301
- const c = {
316
+ function Z() {
317
+ const s = {
302
318
  class: "tooltip-text",
303
- ref: o
319
+ ref: n
304
320
  };
305
321
  if (e.slots.contentTemplate)
306
- return g("div", c, [e.slots.contentTemplate()]);
322
+ return g("div", s, [e.slots.contentTemplate()]);
307
323
  if (t.content) {
308
324
  let h = t.content;
309
- return typeof t.content == "function" && (h = t.content()), g("div", U(c, {
325
+ return typeof t.content == "function" && (h = t.content()), g("div", G(s, {
310
326
  innerHTML: h
311
327
  }), null);
312
328
  }
313
- return g("div", c, null);
329
+ return g("div", s, null);
314
330
  }
315
- const ot = () => g("div", {
316
- ref: d,
331
+ const tt = () => g("div", {
332
+ ref: u,
317
333
  class: p.value,
318
- style: L.value,
334
+ style: S.value,
319
335
  onClick: I
320
336
  }, [g("div", {
321
337
  ref: l,
322
338
  class: "arrow",
323
- style: k.value
339
+ style: x.value
324
340
  }, null), g("div", {
325
- ref: s,
326
- class: P.value,
341
+ ref: c,
342
+ class: C.value,
327
343
  style: D.value
328
344
  }, [g("div", {
329
345
  class: "tooltip-tmpl"
330
- }, [et()])])]);
331
- function nt() {
332
- var c, h, x, j;
333
- return v.value ? g("span", null, [(h = (c = e.slots).default) == null ? void 0 : h.call(c)]) : (j = (x = e.slots).default) == null ? void 0 : j.call(x);
346
+ }, [Z()])])]);
347
+ function et() {
348
+ var s, h, k, O;
349
+ return v.value ? g("span", null, [(h = (s = e.slots).default) == null ? void 0 : h.call(s)]) : (O = (k = e.slots).default) == null ? void 0 : O.call(k);
334
350
  }
335
- return () => e.slots.default ? g(ct, {
336
- ref: n
337
- }, [nt(), u.value && g(st, {
351
+ return () => e.slots.default ? g(it, {
352
+ ref: o
353
+ }, [et(), d.value && g(rt, {
338
354
  to: "body"
339
355
  }, {
340
- default: () => [r.value && ot()]
341
- })]) : tt();
356
+ default: () => [r.value && tt()]
357
+ })]) : Q();
342
358
  }
343
359
  });
344
- function Et(t, e) {
345
- const n = document.createElement("div");
346
- t.customClass && (n.className = t.customClass);
347
- const l = ut({
360
+ function kt(t, e) {
361
+ const o = document.createElement("div");
362
+ t.customClass && (o.className = t.customClass);
363
+ const l = st({
348
364
  setup() {
349
- function d() {
365
+ function u() {
350
366
  t.clickToHide && l.unmount();
351
367
  }
352
- return ft(() => {
353
- document.body.removeChild(n);
354
- }), () => g(A, U(t, {
355
- onClick: d
368
+ return ut(() => {
369
+ document.body.removeChild(o);
370
+ }), () => g(M, G(t, {
371
+ onClick: u
356
372
  }), null);
357
373
  }
358
374
  });
359
- return document.body.appendChild(n), l.mount(n), l;
375
+ return document.body.appendChild(o), l.mount(o), l;
360
376
  }
361
- function _(t) {
362
- const e = at({
377
+ function J(t) {
378
+ const e = ct({
363
379
  ...t
364
380
  });
365
- return Et(e);
381
+ return kt(e);
366
382
  }
367
- const C = /* @__PURE__ */ new WeakMap();
368
- function K(t) {
383
+ const P = /* @__PURE__ */ new WeakMap();
384
+ function U(t) {
369
385
  if (!t)
370
386
  return;
371
- const e = C.get(t);
372
- e && (e.unmount(), C.delete(t));
387
+ const e = P.get(t);
388
+ e && (e.unmount(), P.delete(t));
373
389
  }
374
- function xt(t, e) {
375
- let n;
390
+ function Lt(t, e) {
391
+ let o;
376
392
  t.addEventListener("mouseenter", (l) => {
377
- if (e.value.enable !== !1 && !(e.value.overflowShown && t.scrollWidth === t.clientWidth) && (l.stopPropagation(), !n)) {
378
- const d = t.dataset.tooltip && JSON.parse(t.dataset.tooltip) || {}, s = Object.assign({
393
+ if (e.value.enable !== !1 && !(e.value.overflowShown && t.scrollWidth === t.clientWidth) && (l.stopPropagation(), !o)) {
394
+ const u = t.dataset.tooltip && JSON.parse(t.dataset.tooltip) || {}, c = Object.assign({
379
395
  reference: t,
380
396
  contentTemplate: e.value.contentTemplate
381
- }, d);
382
- n = _(s), C.set(t, n);
397
+ }, u);
398
+ o = J(c), P.set(t, o);
383
399
  }
384
400
  }), t.addEventListener("mouseleave", (l) => {
385
- l.stopPropagation(), n && (C.delete(t), n.unmount(), n = null);
401
+ l.stopPropagation(), o && (P.delete(t), o.unmount(), o = null);
386
402
  });
387
403
  }
388
404
  let $ = null;
389
- const z = "_farris-tooltip-directive_";
390
- function V() {
391
- document.querySelectorAll(`.${z}`).forEach((t) => {
392
- K(t);
405
+ const V = "_farris-tooltip-directive_";
406
+ function W() {
407
+ document.querySelectorAll(`.${V}`).forEach((t) => {
408
+ U(t);
393
409
  });
394
410
  }
395
411
  function St(t, e) {
396
- t.addEventListener("click", (n) => {
412
+ t.addEventListener("click", (o) => {
397
413
  if (e.value.enable === !1 || e.value.overflowShown === !0 && t.scrollWidth === t.clientWidth)
398
414
  return;
399
- n.stopPropagation();
400
- let l = C.get(t);
415
+ o.stopPropagation();
416
+ let l = P.get(t);
401
417
  if (l)
402
- l.unmount(), C.delete(t);
418
+ l.unmount(), P.delete(t);
403
419
  else {
404
- V();
405
- const d = t.dataset.tooltip && JSON.parse(t.dataset.tooltip) || {}, s = Object.assign({
420
+ W();
421
+ const u = t.dataset.tooltip && JSON.parse(t.dataset.tooltip) || {}, c = Object.assign({
406
422
  trigger: "hover",
407
423
  reference: t
408
- }, d);
409
- l = _(s), C.set(t, l);
424
+ }, u);
425
+ l = J(c), P.set(t, l);
410
426
  }
411
427
  });
412
428
  }
@@ -415,47 +431,47 @@ function q(t, e) {
415
431
  t.dataset.tooltip = "";
416
432
  else {
417
433
  const {
418
- contentTemplate: n,
434
+ contentTemplate: o,
419
435
  ...l
420
436
  } = e.value;
421
437
  t.dataset.tooltip = JSON.stringify(l);
422
438
  }
423
439
  }
424
- function G(t, e) {
425
- e.value.trigger === "click" || K(t);
440
+ function X(t, e) {
441
+ e.value.trigger === "click" || U(t);
426
442
  }
427
- const Lt = {
428
- mounted: (t, e, n) => {
429
- switch (t.classList.add(z), q(t, e), e.value.trigger) {
443
+ const xt = {
444
+ mounted: (t, e, o) => {
445
+ switch (t.classList.add(V), q(t, e), e.value.trigger) {
430
446
  case "click": {
431
447
  St(t, e);
432
448
  break;
433
449
  }
434
450
  default:
435
- xt(t, e);
451
+ Lt(t, e);
436
452
  }
437
453
  },
438
- beforeUnmount: (t, e, n) => {
439
- G(t, e);
454
+ beforeUnmount: (t, e, o) => {
455
+ X(t, e);
440
456
  },
441
- unmounted: (t, e, n) => {
442
- G(t, e);
457
+ unmounted: (t, e, o) => {
458
+ X(t, e);
443
459
  },
444
460
  beforeUpdate: (t, e) => {
445
461
  q(t, e);
446
462
  }
447
463
  };
448
- typeof window < "u" && (window.clearAllTooltips = V);
464
+ typeof window < "u" && (window.clearAllTooltips = W);
449
465
  typeof document < "u" && document.body && (document.body.removeEventListener("click", $, !0), document.body.addEventListener("click", $ = (t) => {
450
- const e = t.target, n = e.closest(`.${z}`);
451
- n && C.has(n) || e.closest(".tooltip") || V();
466
+ const e = t.target, o = e.closest(`.${V}`);
467
+ o && P.has(o) || e.closest(".tooltip") || W();
452
468
  }, !0));
453
- A.install = (t) => {
454
- t.component(A.name, A), t.directive("tooltip", Lt);
469
+ M.install = (t) => {
470
+ t.component(M.name, M), t.directive("tooltip", xt);
455
471
  };
456
472
  export {
457
- A as FTooltip,
458
- Lt as FTooltipDirective,
459
- A as default,
460
- dt as tooltipProps
473
+ M as FTooltip,
474
+ xt as FTooltipDirective,
475
+ M as default,
476
+ at as tooltipProps
461
477
  };